diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..1d11d4c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "submodules/build_scripts"] + path = submodules/build_scripts + url = ssh://git@git.thornwave.com:29418/thornwave/build_scripts.git +[submodule "submodules/wxWidgets"] + path = submodules/wxWidgets + url = https://github.com/wxWidgets/wxWidgets.git diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..6225332 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,33 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "(gdb) Launch", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/build/bin/powermon-manager", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/build", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + { + "description": "Set Disassembly Flavor to Intel", + "text": "-gdb-set disassembly-flavor intel", + "ignoreFailures": true + } + ] + } + + ] +} \ No newline at end of file diff --git a/build/Makefile b/build/Makefile new file mode 100644 index 0000000..9dc2c20 --- /dev/null +++ b/build/Makefile @@ -0,0 +1,176 @@ +PROJECT_PATH := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))).. + +TARGET = powermon-manager +BUILD_VERSION = 0.10 +DEB_VERSION = 1 + + +UBUNTU_RELEASE := $(word 2, $(shell lsb_release -c)) + +ARCH_BIT := $(shell getconf LONG_BIT) + +ifeq ($(ARCH_BIT), 32) +ARCH := i386 +else ifeq ($(ARCH_BIT), 64) +ARCH := amd64 +else +$(error Invalid architecture) +endif + +DEBDIR = $(OUTDIR)/$(TARGET)-$(UBUNTU_RELEASE)-$(ARCH) +PKGNAME = $(subst _,-,$(TARGET)) + +INSTALL = install +ECHO = echo +TOUCH = touch +FAKEROOT = fakeroot +DPKG = dpkg + + + + +POWERMON_LIB_PATH = $(PROJECT_PATH)/lib/powermon + + +ifeq ($(RELEASE), yes) + +OPTLEVEL = 3 +DBGLEVEL = 0 +CPPDEFS = + +else + +OPTLEVEL = 3 +DBGLEVEL = 3 +CPPDEFS = DEBUG + +endif + + +#C Source files +CSRCS := + + +#C++ Source files +CXXSRCS = \ +$(PROJECT_PATH)/debug.cpp \ +$(PROJECT_PATH)/version.cpp \ +\ +$(PROJECT_PATH)/gui/model.cpp \ +$(PROJECT_PATH)/gui/gui_about.cpp \ +$(PROJECT_PATH)/gui/gui_app.cpp \ +$(PROJECT_PATH)/gui/gui_global.cpp \ +$(PROJECT_PATH)/gui/gui_calibrate_dialog.cpp \ +$(PROJECT_PATH)/gui/gui_device_config.cpp \ +$(PROJECT_PATH)/gui/gui_device.cpp \ +$(PROJECT_PATH)/gui/gui_dfu_progress.cpp \ +$(PROJECT_PATH)/gui/gui_fg_stats.cpp \ +$(PROJECT_PATH)/gui/gui_main.cpp \ +$(PROJECT_PATH)/gui/gui_chart.cpp \ +$(PROJECT_PATH)/gui/gui_parser.cpp \ +$(PROJECT_PATH)/gui/gui_stats.cpp \ +$(PROJECT_PATH)/gui/gui_string_dialog.cpp \ +$(PROJECT_PATH)/gui/gui_timers_dialog.cpp \ +$(PROJECT_PATH)/gui/gui_wifi_setup.cpp \ +$(PROJECT_PATH)/gui/scope_display.cpp + + +#Include directories and macros +INCDIRS = $(PROJECT_PATH) $(PROJECT_PATH)/gui $(POWERMON_LIB_PATH)/inc +INCDIRS += $(PROJECT_PATH)/submodules/wxWidgets/bin_$(UBUNTU_RELEASE)/lib/wx/include/gtk3-unicode-static-3.2 +INCDIRS += $(PROJECT_PATH)/submodules/wxWidgets/include + +CPPDEFS += _FILE_OFFSET_BITS=64 __WXGTK__ wxDEBUG_LEVEL=0 + +CFLAGS += +CXXFLAGS += -Wno-unused-parameter + +LDFLAGS += -lstdc++ -lbluetooth -lm -ldl +LDFLAGS += -lrt -lpthread -lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lgthread-2.0 -lglib-2.0 -lX11 -lXxf86vm -lSM -lxkbcommon -lXtst -lpangoft2-1.0 -lfontconfig -lfreetype -lpng -lz -ljpeg -ltiff -ljbig -lexpat -lpcre2-32 -lcurl + + + +LIBS += $(POWERMON_LIB_PATH)/powermon_lib.a +LIBS += $(PROJECT_PATH)/submodules/wxWidgets/bin_$(UBUNTU_RELEASE)/lib/libwx_gtk3u-3.2.a + + +include $(PROJECT_PATH)/submodules/build_scripts/config_linux.mk + + + +SHORTCUT = $(OUTDIR)/$(TARGET).desktop + + +user_target: $(OUTDIR)/$(TARGET) + + +$(SHORTCUT): + @echo "Creating shortcut file ..." + @touch $(SHORTCUT) + @echo "[Desktop Entry]" > $(SHORTCUT) + @echo "Version=$(BUILD_VERSION)" >> $(SHORTCUT) + @echo "Type=Application" >> $(SHORTCUT) + @echo "Terminal=false" >> $(SHORTCUT) + @echo "Exec=/usr/bin/$(TARGET)" >> $(SHORTCUT) + @echo "Name=PowerMon Manager $(FQVER)" >> $(SHORTCUT) + @echo "Icon=$(TARGET).png" >> $(SHORTCUT) + @chmod a+x $(SHORTCUT) + + +deb: $(SHORTCUT) +#install the software + @$(INSTALL) -m 555 -D bin/$(TARGET) $(DEBDIR)/usr/bin/$(TARGET) + @$(INSTALL) -m 555 -D $(SHORTCUT) $(DEBDIR)/usr/share/applications/$(TARGET).desktop + @$(INSTALL) -m 444 -D $(PROJECT_PATH)/gui/resources/powermon_icon_512x512.png $(DEBDIR)/usr/share/icons/hicolor/512x512/apps/$(TARGET).png + @$(INSTALL) -m 755 -d $(DEBDIR)/DEBIAN + +#control + @$(RM) -rf $(DEBDIR)/DEBIAN/control + @$(TOUCH) $(DEBDIR)/DEBIAN/control + @$(CHMOD) 644 $(DEBDIR)/DEBIAN/control + @$(ECHO) "Source: $(PKGNAME)" >> $(DEBDIR)/DEBIAN/control + @$(ECHO) "Section: Science" >> $(DEBDIR)/DEBIAN/control + @$(ECHO) "Priority: optional" >> $(DEBDIR)/DEBIAN/control + @$(ECHO) "Maintainer: Thornwave Labs Inc. " >> $(DEBDIR)/DEBIAN/control + @$(ECHO) "Version: $(BUILD_VERSION)" >> $(DEBDIR)/DEBIAN/control + @$(ECHO) "Architecture: $(ARCH)" >> $(DEBDIR)/DEBIAN/control + @$(ECHO) "Package: $(PKGNAME)" >> $(DEBDIR)/DEBIAN/control + @$(ECHO) "Description: PowerMon battery monitor manager tool." >> $(DEBDIR)/DEBIAN/control + @$(ECHO) "Depends: libc6, libstdc++6, libcairo2, libfontconfig1, libgcc-s1, libgdk-pixbuf-2.0-0 | libgdk-pixbuf2.0-0, libglib2.0-0t64 | libglib2.0-0, libgtk-3-0t64 | libgtk-3-0, libjpeg8, libpango-1.0-0, libpangocairo-1.0-0, libnotify4, libpangoft2-1.0-0, libpng16-16t64 | libpng16-16, libsm6, libx11-6, libxkbcommon0, libxtst6" >> $(DEBDIR)/DEBIAN/control + +#postinst + @$(RM) -rf $(DEBDIR)/DEBIAN/postinst + @$(TOUCH) $(DEBDIR)/DEBIAN/postinst + @$(CHMOD) 755 $(DEBDIR)/DEBIAN/postinst + @$(ECHO) "setcap 'cap_net_raw,cap_net_admin+eip' /usr/bin/$(TARGET)" > $(DEBDIR)/DEBIAN/postinst + +#changelog + @$(RM) -rf $(DEBDIR)/DEBIAN/changelog + @$(TOUCH) $(DEBDIR)/DEBIAN/changelog + @$(CHMOD) 644 $(DEBDIR)/DEBIAN/changelog + @$(ECHO) "$(PKGNAME) ($(BUILD_VERSION)) $(UBUNTU_RELEASE); urgency=high" >> $(DEBDIR)/DEBIAN/changelog + @$(ECHO) >> $(DEBDIR)/DEBIAN/changelog + @$(ECHO) " * $(PKGNAME) package" >> $(DEBDIR)/DEBIAN/changelog + @$(ECHO) >> $(DEBDIR)/DEBIAN/changelog + @$(ECHO) " -- Thornwave Labs Inc. "`date -R` >> $(DEBDIR)/DEBIAN/changelog + @$(MKDIR) -p repo/$(UBUNTU_RELEASE) + @$(FAKEROOT) $(DPKG) --build $(DEBDIR)/ repo/$(UBUNTU_RELEASE)/$(PKGNAME)_$(BUILD_VERSION)-$(DEB_VERSION)_$(ARCH).deb + + +publish: + scp -r repo/* pegasus:~/Pending/apt.thornwave.com + + +wxwidgets: + -@$(RM) -rf $(PROJECT_PATH)/submodules/wxWidgets/bin_$(UBUNTU_RELEASE) + @$(MKDIR) $(PROJECT_PATH)/submodules/wxWidgets/bin_$(UBUNTU_RELEASE) + @$(CD) $(PROJECT_PATH)/submodules/wxWidgets/bin_$(UBUNTU_RELEASE); ../configure --disable-shared --with-opengl --with-gtk=3 --enable-monolithic --disable-debug + +$(MAKE) -C $(PROJECT_PATH)/submodules/wxWidgets/bin_$(UBUNTU_RELEASE) + + +wxwidgets_clean: + -@$(RM) -rf $(PROJECT_PATH)/submodules/wxWidgets/bin_$(UBUNTU_RELEASE) + + +user_clean_target: + -@$(RM) -rf repo diff --git a/build/PowermonManagerSetup.vdproj b/build/PowermonManagerSetup.vdproj new file mode 100644 index 0000000..fa0bf86 --- /dev/null +++ b/build/PowermonManagerSetup.vdproj @@ -0,0 +1,1263 @@ +"DeployProject" +{ +"VSVersion" = "3:800" +"ProjectType" = "8:{978C614F-708E-4E1A-B201-565925725DBA}" +"IsWebType" = "8:FALSE" +"ProjectName" = "8:PowermonManagerSetup" +"LanguageId" = "3:1033" +"CodePage" = "3:1252" +"UILanguageId" = "3:1033" +"SccProjectName" = "8:" +"SccLocalPath" = "8:" +"SccAuxPath" = "8:" +"SccProvider" = "8:" + "Hierarchy" + { + "Entry" + { + "MsmKey" = "8:_0B83DAAC740292AC574B2337793BA552" + "OwnerKey" = "8:_18ED212839BC4CEBA8010B98947CDE46" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_18ED212839BC4CEBA8010B98947CDE46" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_1A16F5B33776FAC9CD3D592B20817682" + "OwnerKey" = "8:_18ED212839BC4CEBA8010B98947CDE46" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_28DA4449DEEAC94CA91F25889BF889B6" + "OwnerKey" = "8:_18ED212839BC4CEBA8010B98947CDE46" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_31D586E42AA1717F5C7A5C8F1AB3062F" + "OwnerKey" = "8:_18ED212839BC4CEBA8010B98947CDE46" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_40A5AD14363522E9EEE94DAED34229A8" + "OwnerKey" = "8:_18ED212839BC4CEBA8010B98947CDE46" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_4D91257E737CE6BC32C78B97C5A31C07" + "OwnerKey" = "8:_18ED212839BC4CEBA8010B98947CDE46" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_5333505C3A5B15A5B18AB4B2841AD577" + "OwnerKey" = "8:_18ED212839BC4CEBA8010B98947CDE46" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_5534E2635D6F4494E4B3BB108E3BBCB0" + "OwnerKey" = "8:_18ED212839BC4CEBA8010B98947CDE46" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_6C58F05FDF0444256F30EC4A59A1DC5C" + "OwnerKey" = "8:_18ED212839BC4CEBA8010B98947CDE46" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_720AAA5E32305BB0B6E14EB8524332AE" + "OwnerKey" = "8:_18ED212839BC4CEBA8010B98947CDE46" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_85CAB4554673CC8252138567A79065E3" + "OwnerKey" = "8:_18ED212839BC4CEBA8010B98947CDE46" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_8AEF0256A47A4456AE651A683AFBC4E5" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_8D610F2105E95230B858643581D07E41" + "OwnerKey" = "8:_18ED212839BC4CEBA8010B98947CDE46" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_96E2E9E6D4923AF629E5AF94F74F7AF0" + "OwnerKey" = "8:_18ED212839BC4CEBA8010B98947CDE46" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_9A9E9A40E62727B9390E3D79AFCBE1F8" + "OwnerKey" = "8:_18ED212839BC4CEBA8010B98947CDE46" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_9DDFED4B288F1C5A2B6A571E96C6639F" + "OwnerKey" = "8:_18ED212839BC4CEBA8010B98947CDE46" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_AEBBF2597A8082F78513A68D0E163A1B" + "OwnerKey" = "8:_18ED212839BC4CEBA8010B98947CDE46" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_C0A9B2E5F5C538A31375A49374650FD8" + "OwnerKey" = "8:_18ED212839BC4CEBA8010B98947CDE46" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_C4A936A132CD204A5E8ACA9D46782BA9" + "OwnerKey" = "8:_18ED212839BC4CEBA8010B98947CDE46" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_D3513B8411BAED9F2C460EEA55D3B7D5" + "OwnerKey" = "8:_18ED212839BC4CEBA8010B98947CDE46" + "MsmSig" = "8:_UNDEFINED" + } + } + "Configurations" + { + "Debug" + { + "DisplayName" = "8:Debug" + "IsDebugOnly" = "11:TRUE" + "IsReleaseOnly" = "11:FALSE" + "OutputFilename" = "8:PowermonManagerSetup.msi" + "PackageFilesAs" = "3:2" + "PackageFileSize" = "3:-2147483648" + "CabType" = "3:1" + "Compression" = "3:3" + "SignOutput" = "11:FALSE" + "CertificateFile" = "8:" + "PrivateKeyFile" = "8:" + "TimeStampServer" = "8:" + "InstallerBootstrapper" = "3:2" + "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}" + { + "Enabled" = "11:TRUE" + "PromptEnabled" = "11:TRUE" + "PrerequisitesLocation" = "2:1" + "Url" = "8:" + "ComponentsUrl" = "8:" + "Items" + { + "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:.NETFramework,Version=v4.7.2" + { + "Name" = "8:Microsoft .NET Framework 4.7.2 (x86 and x64)" + "ProductCode" = "8:.NETFramework,Version=v4.7.2" + } + } + } + } + "Release" + { + "DisplayName" = "8:Release" + "IsDebugOnly" = "11:FALSE" + "IsReleaseOnly" = "11:TRUE" + "OutputFilename" = "8:PowermonManagerSetup_v0.10\\PowermonManagerSetup_v0.10.msi" + "PackageFilesAs" = "3:2" + "PackageFileSize" = "3:-2147483648" + "CabType" = "3:1" + "Compression" = "3:3" + "SignOutput" = "11:FALSE" + "CertificateFile" = "8:" + "PrivateKeyFile" = "8:" + "TimeStampServer" = "8:" + "InstallerBootstrapper" = "3:2" + "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}" + { + "Enabled" = "11:TRUE" + "PromptEnabled" = "11:TRUE" + "PrerequisitesLocation" = "2:1" + "Url" = "8:" + "ComponentsUrl" = "8:" + "Items" + { + "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Visual.C++.14.0.x64" + { + "Name" = "8:Visual C++ \"14\" Runtime Libraries (x64)" + "ProductCode" = "8:Microsoft.Visual.C++.14.0.x64" + } + } + } + } + } + "Deployable" + { + "CustomAction" + { + } + "DefaultFeature" + { + "Name" = "8:DefaultFeature" + "Title" = "8:" + "Description" = "8:" + } + "ExternalPersistence" + { + "LaunchCondition" + { + } + } + "File" + { + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_0B83DAAC740292AC574B2337793BA552" + { + "SourcePath" = "8:api-ms-win-crt-convert-l1-1-0.dll" + "TargetName" = "8:api-ms-win-crt-convert-l1-1-0.dll" + "Tag" = "8:" + "Folder" = "8:_126489AD3CDB44138FA5B74F5CCCFF4A" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_1A16F5B33776FAC9CD3D592B20817682" + { + "SourcePath" = "8:UxTheme.dll" + "TargetName" = "8:UxTheme.dll" + "Tag" = "8:" + "Folder" = "8:" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:4" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_28DA4449DEEAC94CA91F25889BF889B6" + { + "SourcePath" = "8:VCRUNTIME140.dll" + "TargetName" = "8:VCRUNTIME140.dll" + "Tag" = "8:" + "Folder" = "8:" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_31D586E42AA1717F5C7A5C8F1AB3062F" + { + "SourcePath" = "8:api-ms-win-crt-runtime-l1-1-0.dll" + "TargetName" = "8:api-ms-win-crt-runtime-l1-1-0.dll" + "Tag" = "8:" + "Folder" = "8:_126489AD3CDB44138FA5B74F5CCCFF4A" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_40A5AD14363522E9EEE94DAED34229A8" + { + "SourcePath" = "8:api-ms-win-crt-stdio-l1-1-0.dll" + "TargetName" = "8:api-ms-win-crt-stdio-l1-1-0.dll" + "Tag" = "8:" + "Folder" = "8:_126489AD3CDB44138FA5B74F5CCCFF4A" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_4D91257E737CE6BC32C78B97C5A31C07" + { + "SourcePath" = "8:api-ms-win-crt-string-l1-1-0.dll" + "TargetName" = "8:api-ms-win-crt-string-l1-1-0.dll" + "Tag" = "8:" + "Folder" = "8:_126489AD3CDB44138FA5B74F5CCCFF4A" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_5333505C3A5B15A5B18AB4B2841AD577" + { + "SourcePath" = "8:VCRUNTIME140_1.dll" + "TargetName" = "8:VCRUNTIME140_1.dll" + "Tag" = "8:" + "Folder" = "8:" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_5534E2635D6F4494E4B3BB108E3BBCB0" + { + "SourcePath" = "8:api-ms-win-crt-utility-l1-1-0.dll" + "TargetName" = "8:api-ms-win-crt-utility-l1-1-0.dll" + "Tag" = "8:" + "Folder" = "8:_126489AD3CDB44138FA5B74F5CCCFF4A" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_6C58F05FDF0444256F30EC4A59A1DC5C" + { + "SourcePath" = "8:COMDLG32.dll" + "TargetName" = "8:COMDLG32.dll" + "Tag" = "8:" + "Folder" = "8:" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_720AAA5E32305BB0B6E14EB8524332AE" + { + "SourcePath" = "8:api-ms-win-crt-heap-l1-1-0.dll" + "TargetName" = "8:api-ms-win-crt-heap-l1-1-0.dll" + "Tag" = "8:" + "Folder" = "8:_126489AD3CDB44138FA5B74F5CCCFF4A" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_85CAB4554673CC8252138567A79065E3" + { + "SourcePath" = "8:api-ms-win-crt-locale-l1-1-0.dll" + "TargetName" = "8:api-ms-win-crt-locale-l1-1-0.dll" + "Tag" = "8:" + "Folder" = "8:_126489AD3CDB44138FA5B74F5CCCFF4A" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_8AEF0256A47A4456AE651A683AFBC4E5" + { + "SourcePath" = "8:..\\gui\\resources\\powermon_icon.ico" + "TargetName" = "8:powermon_icon.ico" + "Tag" = "8:" + "Folder" = "8:_126489AD3CDB44138FA5B74F5CCCFF4A" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_8D610F2105E95230B858643581D07E41" + { + "SourcePath" = "8:MSIMG32.dll" + "TargetName" = "8:MSIMG32.dll" + "Tag" = "8:" + "Folder" = "8:" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_96E2E9E6D4923AF629E5AF94F74F7AF0" + { + "SourcePath" = "8:RPCRT4.dll" + "TargetName" = "8:RPCRT4.dll" + "Tag" = "8:" + "Folder" = "8:" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_9A9E9A40E62727B9390E3D79AFCBE1F8" + { + "SourcePath" = "8:api-ms-win-crt-environment-l1-1-0.dll" + "TargetName" = "8:api-ms-win-crt-environment-l1-1-0.dll" + "Tag" = "8:" + "Folder" = "8:_126489AD3CDB44138FA5B74F5CCCFF4A" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_9DDFED4B288F1C5A2B6A571E96C6639F" + { + "SourcePath" = "8:MSVCP140.dll" + "TargetName" = "8:MSVCP140.dll" + "Tag" = "8:" + "Folder" = "8:" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_AEBBF2597A8082F78513A68D0E163A1B" + { + "SourcePath" = "8:api-ms-win-crt-filesystem-l1-1-0.dll" + "TargetName" = "8:api-ms-win-crt-filesystem-l1-1-0.dll" + "Tag" = "8:" + "Folder" = "8:_126489AD3CDB44138FA5B74F5CCCFF4A" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_C0A9B2E5F5C538A31375A49374650FD8" + { + "SourcePath" = "8:api-ms-win-crt-time-l1-1-0.dll" + "TargetName" = "8:api-ms-win-crt-time-l1-1-0.dll" + "Tag" = "8:" + "Folder" = "8:_126489AD3CDB44138FA5B74F5CCCFF4A" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_C4A936A132CD204A5E8ACA9D46782BA9" + { + "SourcePath" = "8:api-ms-win-crt-math-l1-1-0.dll" + "TargetName" = "8:api-ms-win-crt-math-l1-1-0.dll" + "Tag" = "8:" + "Folder" = "8:_126489AD3CDB44138FA5B74F5CCCFF4A" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_D3513B8411BAED9F2C460EEA55D3B7D5" + { + "SourcePath" = "8:OLEACC.dll" + "TargetName" = "8:OLEACC.dll" + "Tag" = "8:" + "Folder" = "8:" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + } + "FileType" + { + } + "Folder" + { + "{3C67513D-01DD-4637-8A68-80971EB9504F}:_126489AD3CDB44138FA5B74F5CCCFF4A" + { + "DefaultLocation" = "8:[ProgramFiles64Folder][Manufacturer]\\[ProductName]" + "Name" = "8:#1925" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:TARGETDIR" + "Folders" + { + } + } + "{1525181F-901A-416C-8A58-119130FE478E}:_61FA15BD9EE84320B281F3C55902E2C5" + { + "Name" = "8:#1916" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:DesktopFolder" + "Folders" + { + } + } + "{1525181F-901A-416C-8A58-119130FE478E}:_C03E43F2BD784838B1F22C24BE01B0C7" + { + "Name" = "8:#1919" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:ProgramMenuFolder" + "Folders" + { + } + } + } + "LaunchCondition" + { + } + "Locator" + { + } + "MsiBootstrapper" + { + "LangId" = "3:1033" + "RequiresElevation" = "11:FALSE" + } + "Product" + { + "Name" = "8:Microsoft Visual Studio" + "ProductName" = "8:PowerMon Manager" + "ProductCode" = "8:{5A8AC98D-3336-4AED-B5CE-66E7CF674C7D}" + "PackageCode" = "8:{4605CCE6-B16C-4B6E-A9CB-7D7221BD739F}" + "UpgradeCode" = "8:{B0F63B2C-3FD0-4302-852A-3107F5C66B7E}" + "AspNetVersion" = "8:2.0.50727.0" + "RestartWWWService" = "11:FALSE" + "RemovePreviousVersions" = "11:TRUE" + "DetectNewerInstalledVersion" = "11:TRUE" + "InstallAllUsers" = "11:TRUE" + "ProductVersion" = "8:0.10" + "Manufacturer" = "8:Thornwave Labs Inc." + "ARPHELPTELEPHONE" = "8:1-888-399-9283" + "ARPHELPLINK" = "8:www.thornwave.com" + "Title" = "8:PowerMon Manager" + "Subject" = "8:" + "ARPCONTACT" = "8:Thornwave Labs Inc." + "Keywords" = "8:" + "ARPCOMMENTS" = "8:PowerMon Manager - Software for accessing the PowerMon battery monitor features." + "ARPURLINFOABOUT" = "8:www.thornwave.com" + "ARPPRODUCTICON" = "8:_8AEF0256A47A4456AE651A683AFBC4E5" + "ARPIconIndex" = "3:0" + "SearchPath" = "8:" + "UseSystemSearchPath" = "11:TRUE" + "TargetPlatform" = "3:1" + "PreBuildEvent" = "8:" + "PostBuildEvent" = "8:" + "RunPostBuildEvent" = "3:0" + } + "Registry" + { + "HKLM" + { + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_2B76F3C2E2B94DD8B06ACF74EEB7D879" + { + "Name" = "8:Software" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_D6C342E81DCC47448D07613AC8C2BDCB" + { + "Name" = "8:[Manufacturer]" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + } + "Values" + { + } + } + } + "Values" + { + } + } + } + } + "HKCU" + { + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_B0844E9F74E34FC992F4B4A9C3580326" + { + "Name" = "8:Software" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_4C9A71DF78DE403B9FE1E105CF6F02EC" + { + "Name" = "8:[Manufacturer]" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + } + "Values" + { + } + } + } + "Values" + { + } + } + } + } + "HKCR" + { + "Keys" + { + } + } + "HKU" + { + "Keys" + { + } + } + "HKPU" + { + "Keys" + { + } + } + } + "Sequences" + { + } + "Shortcut" + { + "{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_3CE5FF825E1947E6BAD2BB8EF88620DD" + { + "Name" = "8:PowerMon Manager" + "Arguments" = "8:" + "Description" = "8:" + "ShowCmd" = "3:1" + "IconIndex" = "3:0" + "Transitive" = "11:FALSE" + "Target" = "8:_18ED212839BC4CEBA8010B98947CDE46" + "Folder" = "8:_61FA15BD9EE84320B281F3C55902E2C5" + "WorkingFolder" = "8:" + "Icon" = "8:_8AEF0256A47A4456AE651A683AFBC4E5" + "Feature" = "8:" + } + "{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_CC2848BC4C8645ED9980F13B5E884A34" + { + "Name" = "8:PowerMon Manager" + "Arguments" = "8:" + "Description" = "8:" + "ShowCmd" = "3:1" + "IconIndex" = "3:0" + "Transitive" = "11:FALSE" + "Target" = "8:_18ED212839BC4CEBA8010B98947CDE46" + "Folder" = "8:_C03E43F2BD784838B1F22C24BE01B0C7" + "WorkingFolder" = "8:" + "Icon" = "8:_8AEF0256A47A4456AE651A683AFBC4E5" + "Feature" = "8:" + } + } + "UserInterface" + { + "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_17C3AC2940B748FEB06DC1C142F04635" + { + "UseDynamicProperties" = "11:FALSE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdUserInterface.wim" + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_8AC8DFE798A4473D9821835039E13750" + { + "Name" = "8:#1901" + "Sequence" = "3:2" + "Attributes" = "3:2" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_567730C973FE42FDBB345395E1284F52" + { + "Sequence" = "3:100" + "DisplayName" = "8:Progress" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminProgressDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "ShowProgress" + { + "Name" = "8:ShowProgress" + "DisplayName" = "8:#1009" + "Description" = "8:#1109" + "Type" = "3:5" + "ContextData" = "8:1;True=1;False=0" + "Attributes" = "3:0" + "Setting" = "3:0" + "Value" = "3:1" + "DefaultValue" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_AD24981A14CE4465B9440611BA33D6E1" + { + "Name" = "8:#1902" + "Sequence" = "3:1" + "Attributes" = "3:3" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_CF81CE4F6DA74235A89DB92B32441B2F" + { + "Sequence" = "3:100" + "DisplayName" = "8:Finished" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdFinishedDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "UpdateText" + { + "Name" = "8:UpdateText" + "DisplayName" = "8:#1058" + "Description" = "8:#1158" + "Type" = "3:15" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1258" + "DefaultValue" = "8:#1258" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_C280ED7D4C114F90858A0D378DAA00E3" + { + "Name" = "8:#1902" + "Sequence" = "3:2" + "Attributes" = "3:3" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_850E6F7B0DE94A5F943F49326F22460A" + { + "Sequence" = "3:100" + "DisplayName" = "8:Finished" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminFinishedDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_D5A51AF8EE3247488636D19F006A2CEC" + { + "Name" = "8:#1900" + "Sequence" = "3:1" + "Attributes" = "3:1" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_8B30253CDB2647868F2C6A0744A69116" + { + "Sequence" = "3:200" + "DisplayName" = "8:Installation Folder" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdFolderDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "InstallAllUsersVisible" + { + "Name" = "8:InstallAllUsersVisible" + "DisplayName" = "8:#1059" + "Description" = "8:#1159" + "Type" = "3:5" + "ContextData" = "8:1;True=1;False=0" + "Attributes" = "3:0" + "Setting" = "3:0" + "Value" = "3:1" + "DefaultValue" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_D3D69141448A4AD990AC76228B4A8501" + { + "Sequence" = "3:100" + "DisplayName" = "8:Welcome" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdWelcomeDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "CopyrightWarning" + { + "Name" = "8:CopyrightWarning" + "DisplayName" = "8:#1002" + "Description" = "8:#1102" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1202" + "DefaultValue" = "8:#1202" + "UsePlugInResources" = "11:TRUE" + } + "Welcome" + { + "Name" = "8:Welcome" + "DisplayName" = "8:#1003" + "Description" = "8:#1103" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1203" + "DefaultValue" = "8:#1203" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_FF89D3789C884E2EAEC67212256AD431" + { + "Sequence" = "3:300" + "DisplayName" = "8:Confirm Installation" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdConfirmDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_DC592CC0C223437B9329620DEB9B461F" + { + "UseDynamicProperties" = "11:FALSE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdBasicDialogs.wim" + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_E75B9D74E56B4E1E9FF2249913C3C6FD" + { + "Name" = "8:#1901" + "Sequence" = "3:1" + "Attributes" = "3:2" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_7669399A12454D9CB911EBA7B0490953" + { + "Sequence" = "3:100" + "DisplayName" = "8:Progress" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdProgressDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "ShowProgress" + { + "Name" = "8:ShowProgress" + "DisplayName" = "8:#1009" + "Description" = "8:#1109" + "Type" = "3:5" + "ContextData" = "8:1;True=1;False=0" + "Attributes" = "3:0" + "Setting" = "3:0" + "Value" = "3:1" + "DefaultValue" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_EBFECC88BBAB4735A7BE4D7286A94F50" + { + "Name" = "8:#1900" + "Sequence" = "3:2" + "Attributes" = "3:1" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_5C9A5CCCAF93485F9324944504E47FBF" + { + "Sequence" = "3:300" + "DisplayName" = "8:Confirm Installation" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminConfirmDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_A33E9BEB55C64500B270CF862694F8DC" + { + "Sequence" = "3:200" + "DisplayName" = "8:Installation Folder" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminFolderDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_DF904EC079C6427BB459CC97ACF3C73E" + { + "Sequence" = "3:100" + "DisplayName" = "8:Welcome" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminWelcomeDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "CopyrightWarning" + { + "Name" = "8:CopyrightWarning" + "DisplayName" = "8:#1002" + "Description" = "8:#1102" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1202" + "DefaultValue" = "8:#1202" + "UsePlugInResources" = "11:TRUE" + } + "Welcome" + { + "Name" = "8:Welcome" + "DisplayName" = "8:#1003" + "Description" = "8:#1103" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1203" + "DefaultValue" = "8:#1203" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + } + "MergeModule" + { + } + "ProjectOutput" + { + "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_18ED212839BC4CEBA8010B98947CDE46" + { + "SourcePath" = "8:x64\\Release\\powermon_manager.exe" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_126489AD3CDB44138FA5B74F5CCCFF4A" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + "ProjectOutputGroupRegister" = "3:1" + "OutputConfiguration" = "8:" + "OutputGroupCanonicalName" = "8:Built" + "OutputProjectGuid" = "8:{E92D5465-2F74-47B8-931D-3C6D1CA9C8BE}" + "ShowKeyOutput" = "11:TRUE" + "ExcludeFilters" + { + } + } + } + } +} diff --git a/build/app.rc b/build/app.rc new file mode 100644 index 0000000..960091e --- /dev/null +++ b/build/app.rc Binary files differ diff --git a/build/powermon_manager.sln b/build/powermon_manager.sln new file mode 100644 index 0000000..2a8ec53 --- /dev/null +++ b/build/powermon_manager.sln @@ -0,0 +1,41 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.10.34928.147 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "powermon_manager", "powermon_manager.vcxproj", "{E92D5465-2F74-47B8-931D-3C6D1CA9C8BE}" +EndProject +Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "PowermonManagerSetup", "PowermonManagerSetup.vdproj", "{4C21AC07-FF30-4E0D-AE2E-23F3CE23DBBC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E92D5465-2F74-47B8-931D-3C6D1CA9C8BE}.Debug|x64.ActiveCfg = Debug|x64 + {E92D5465-2F74-47B8-931D-3C6D1CA9C8BE}.Debug|x64.Build.0 = Debug|x64 + {E92D5465-2F74-47B8-931D-3C6D1CA9C8BE}.Debug|x86.ActiveCfg = Debug|Win32 + {E92D5465-2F74-47B8-931D-3C6D1CA9C8BE}.Debug|x86.Build.0 = Debug|Win32 + {E92D5465-2F74-47B8-931D-3C6D1CA9C8BE}.Release|x64.ActiveCfg = Release|x64 + {E92D5465-2F74-47B8-931D-3C6D1CA9C8BE}.Release|x64.Build.0 = Release|x64 + {E92D5465-2F74-47B8-931D-3C6D1CA9C8BE}.Release|x86.ActiveCfg = Release|Win32 + {E92D5465-2F74-47B8-931D-3C6D1CA9C8BE}.Release|x86.Build.0 = Release|Win32 + {4C21AC07-FF30-4E0D-AE2E-23F3CE23DBBC}.Debug|x64.ActiveCfg = Debug + {4C21AC07-FF30-4E0D-AE2E-23F3CE23DBBC}.Debug|x64.Build.0 = Debug + {4C21AC07-FF30-4E0D-AE2E-23F3CE23DBBC}.Debug|x86.ActiveCfg = Debug + {4C21AC07-FF30-4E0D-AE2E-23F3CE23DBBC}.Debug|x86.Build.0 = Debug + {4C21AC07-FF30-4E0D-AE2E-23F3CE23DBBC}.Release|x64.ActiveCfg = Release + {4C21AC07-FF30-4E0D-AE2E-23F3CE23DBBC}.Release|x64.Build.0 = Release + {4C21AC07-FF30-4E0D-AE2E-23F3CE23DBBC}.Release|x86.ActiveCfg = Release + {4C21AC07-FF30-4E0D-AE2E-23F3CE23DBBC}.Release|x86.Build.0 = Release + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {87FF486C-616F-47E8-A3AA-6832987F228C} + EndGlobalSection +EndGlobal diff --git a/build/powermon_manager.vcxproj b/build/powermon_manager.vcxproj new file mode 100644 index 0000000..eca4900 --- /dev/null +++ b/build/powermon_manager.vcxproj @@ -0,0 +1,229 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {e92d5465-2f74-47b8-931d-3c6d1ca9c8be} + powermonmanager + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + false + false + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + ..\lib\wxWidgets\lib\vc_x64_lib;..\lib\powermon;$(LibraryPath) + + + ..\lib\wxWidgets\lib\vc_x64_lib;..\lib\powermon;$(LibraryPath) + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG__;_BUILD_VERSION_BCD_=0x0001;_CRT_SECURE_NO_WARNINGS;__WXMSW__;wxUSE_DPI_AWARE_MANIFEST=2;%(PreprocessorDefinitions) + true + ..\lib\wxWidgets\include\msvc;..\lib\wxWidgets\include;..\lib\powermon\inc;..\;..\gui;%(AdditionalIncludeDirectories) + stdcpp20 + MultiThreadedDebugDLL + true + + + + + Windows + true + ws2_32.lib;powermon_libd.lib;%(AdditionalDependencies) + + + ..\;..\lib\wxWidgets\include;%(AdditionalIncludeDirectories) + + + ..\lib\wxWidgets\include\wx\msw\wx_dpi_aware_pmv2.manifest %(AdditionalManifestFiles) + + + + + Level3 + true + true + true + NDEBUG;_BUILD_VERSION_BCD_=0x0010;_CRT_SECURE_NO_WARNINGS;__WXMSW__;wxUSE_DPI_AWARE_MANIFEST=2;%(PreprocessorDefinitions) + true + ..\lib\wxWidgets\include\msvc;..\lib\wxWidgets\include;..\lib\powermon\inc;..\;..\gui;%(AdditionalIncludeDirectories) + stdcpp20 + true + MultiThreadedDLL + None + Speed + true + + + Windows + true + true + false + ws2_32.lib;powermon_lib.lib;%(AdditionalDependencies) + + + ..\;..\lib\wxWidgets\include;%(AdditionalIncludeDirectories) + + + ..\lib\wxWidgets\include\wx\msw\wx_dpi_aware_pmv2.manifest %(AdditionalManifestFiles) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/build/powermon_manager.vcxproj.filters b/build/powermon_manager.vcxproj.filters new file mode 100644 index 0000000..597756a --- /dev/null +++ b/build/powermon_manager.vcxproj.filters @@ -0,0 +1,183 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Resource Files + + + + + Resource Files + + + Resource Files + + + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + \ No newline at end of file diff --git a/build/powermon_manager.vcxproj.user b/build/powermon_manager.vcxproj.user new file mode 100644 index 0000000..88a5509 --- /dev/null +++ b/build/powermon_manager.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/build/publish_deb.sh b/build/publish_deb.sh new file mode 100755 index 0000000..28c18a8 --- /dev/null +++ b/build/publish_deb.sh @@ -0,0 +1,6 @@ +#!/bin/bash -e + +make clean +make RELEASE=yes -j32 +make RELEASE=yes deb +make RELEASE=yes publish diff --git a/build/set_perm.sh b/build/set_perm.sh new file mode 100755 index 0000000..6295b47 --- /dev/null +++ b/build/set_perm.sh @@ -0,0 +1,3 @@ +#!/bin/bash -e + +setcap 'cap_net_raw,cap_net_admin+eip' bin/powermon-manager diff --git a/debug.cpp b/debug.cpp new file mode 100644 index 0000000..e042c64 --- /dev/null +++ b/debug.cpp @@ -0,0 +1,89 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#ifdef DEBUG + +#include +#include +#include + + +int32_t debug_printf(const char* format, ...) +{ + va_list args; + va_start(args, format); + + int32_t rv = vprintf(format, args); + fflush(stdout); + + va_end(args); + + return rv; +} + + + +void debug_dump_hex(const void *data, uint32_t size, bool display_address) +{ + const uint32_t line_length = 16; + uint64_t start_address = (uint64_t)data; + const uint8_t *p_data = (const uint8_t*)data; + + char char_display[line_length + 1]; + + while(size) + { + if (display_address) + printf("\r\n%08lXh ", start_address); + else + printf("\r\n"); + + start_address += line_length; + + char *ptr = char_display; + for(uint32_t i = 0; i < line_length; i++) + { + if (size) + { + if (isgraph(*p_data) || (*p_data == ' ')) + *ptr++ = *p_data; + else + *ptr++ = '.'; + + printf("%02X ", *p_data++); + size--; + } + else + printf(" "); + + if ((i & 3) == 3) + printf(" "); + } + + *ptr = 0; + + printf(" %s", char_display); + } + printf("\r\n"); + fflush(stdout); +} + + + +#endif diff --git a/debug.h b/debug.h new file mode 100644 index 0000000..e5a2c3c --- /dev/null +++ b/debug.h @@ -0,0 +1,36 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _DEBUG_H +#define _DEBUG_H + +#include +#include + +#ifdef DEBUG + +int32_t debug_printf(const char* format, ...); +void debug_dump_hex(const void *data, uint32_t size, bool display_address); + +#else + +#define debug_printf(...) while(0) +#define debug_dump_hex(...) while(0) + +#endif + +#endif diff --git a/gui/gui_about.cpp b/gui/gui_about.cpp new file mode 100644 index 0000000..bcbee0b --- /dev/null +++ b/gui/gui_about.cpp @@ -0,0 +1,194 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include + + +GuiAbout::GuiAbout(wxWindow *parent, const wxString &title, Powermon &powermon): wxDialog(parent, wxID_ANY, title), mPowermon(powermon) +{ + //main window sizer + wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL); + SetSizer(main_sizer); + + wxString str; + + str.Printf(wxT("%s v%X.%02X. (C) Thornwave Labs Inc"), g_version_tag, g_version_bcd >> 8, g_version_bcd & 0xFF); + main_sizer->Add(new wxStaticText(this, wxID_ANY, str), 0, wxALL | wxEXPAND, 5); + + str.Printf(wxT("Device name: %s"), mPowermon.getLastDeviceInfo().name); + main_sizer->Add(new wxStaticText(this, wxID_ANY, str), 0, wxALL | wxEXPAND, 5); + + str.Printf(wxT("Device model: %s"), Powermon::getHardwareString(mPowermon.getLastDeviceInfo().hardware_revision_bcd)); + main_sizer->Add(new wxStaticText(this, wxID_ANY, str), 0, wxALL | wxEXPAND, 5); + + str.Printf(wxT("Device serial: %016" PRIX64), mPowermon.getLastDeviceInfo().serial); + main_sizer->Add(new wxStaticText(this, wxID_ANY, str), 0, wxALL | wxEXPAND, 5); + + uint16_t version = mPowermon.getLastDeviceInfo().firmware_version_bcd; + str.Printf(wxT("Firmware: v%X.%02X"), version >> 8, version & 0xFF); + main_sizer->Add(new wxStaticText(this, wxID_ANY, str), 0, wxALL | wxEXPAND, 5); + + if (Powermon::hasWifi(mPowermon.getLastDeviceInfo().hardware_revision_bcd)) + str = wxString(wxT("Device IP Address: ")) + Powermon::getIpAddressString(mPowermon.getLastDeviceInfo().address); + else + str = wxString(wxT("Device Bluetooth Address: ")) + Powermon::getMacAddressString(mPowermon.getLastDeviceInfo().address); + + main_sizer->Add(new wxStaticText(this, wxID_ANY, str), 0, wxALL | wxEXPAND, 5); + + mStatusStatic = new wxStaticText(this, wxID_ANY, wxT("Checking for firmware update ...")); + main_sizer->AddSpacer(20); + main_sizer->Add(mStatusStatic, 0, wxALL | wxEXPAND, 5); + + main_sizer->AddSpacer(20); + mUpdateButton = new wxButton(this, ID_BUTTON_UPDATE, wxT("Update"), wxDefaultPosition, wxSize(120, 40)); + mUpdateButton->Enable(false); + main_sizer->Add(mUpdateButton, 0, wxALL | wxEXPAND, 5); + + main_sizer->SetSizeHints(this); + Centre(); + + mFirmwareVersionBcd = 0; + + std::thread download_thread([this](void) + { + //wxString str = Powermon::getUpdateFirmwareImageUrl(mPowermon.getLastDeviceInfo().hardware_revision_bcd, mPowermon.getLastDeviceInfo().firmware_version_bcd); + wxString str = wxT("https://files.thornwave.com/fwup/pmonw/pmonw_fw_dfu_dev.bin"); + + wxURI uri(str); + wxHTTP http; + http.SetHeader("Content-type", "text/html; charset=utf-8"); + + http.Connect(uri.GetServer()); + + wxInputStream* httpStream = http.GetInputStream(uri.GetPath()); + + if (http.GetError() == wxPROTO_NOERR) + { + wxMemoryOutputStream out; + httpStream->Read(out); + + wxStreamBuffer* httpStreamBuffer = out.GetOutputStreamBuffer(); + httpStreamBuffer->Seek(0, wxFromStart); + + const size_t size = httpStreamBuffer->GetBufferSize(); + mFirmwareImage.resize(size); + + if (httpStreamBuffer->Read(mFirmwareImage.data(), size) == size) + mFirmwareVersionBcd = Powermon::checkFirmwareImage(mFirmwareImage.data(), mFirmwareImage.size(), mPowermon.getLastDeviceInfo().hardware_revision_bcd); + } + + delete httpStream; + http.Close(); + + wxQueueEvent(this, new GuiEvent([this](const GuiEvent &event) + { + DownloadDone(); + })); + }); + + download_thread.detach(); +} + + + +GuiAbout::~GuiAbout() +{ +} + + +void GuiAbout::DownloadDone(void) +{ + if (mFirmwareVersionBcd > 0 +#ifndef DEBUG + && mFirmwareVersionBcd > mPowermon.getLastDeviceInfo().firmware_version_bcd +#endif + ) + { + wxString str; + str.Printf(wxT("Firmware update to version %X.%02X is available"), mFirmwareVersionBcd >> 8, mFirmwareVersionBcd & 0xFF); + + mStatusStatic->SetLabel(str); + mUpdateButton->Enable(true); + } + else + { + mStatusStatic->SetLabel(wxT("No firmware update is available at the moment")); + } + + mStatusStatic->Refresh(); +} + + +void GuiAbout::UpdateFirmware(void) +{ + GuiDFUProgress progress(this, wxT("Updating firmware ..."), mPowermon, mFirmwareImage); + const auto status = progress.ShowModal(); + + if (status == GuiDFUProgress::SUCCESS) + { + EndModal(wxID_OK); + } + else if (status == GuiDFUProgress::CANCELLED) + { + EndModal(wxID_CANCEL); + } + else if (status == GuiDFUProgress::FAILED) + { + wxMessageDialog msg(this, wxT("Firmware update error."), wxT("Error"), wxOK | wxSTAY_ON_TOP | wxCENTRE | wxICON_ERROR); + msg.ShowModal(); + + EndModal(wxID_CANCEL); + } +} + + +void GuiAbout::OnButtonUpdateClicked(wxCommandEvent &event) +{ + wxMessageDialog msg(this, wxT("You are about to update the firmware in your PowerMon device. \n" + "Do not disconnect the power, sit back and relax."), + wxT("Confirmation"), wxOK | wxCANCEL | wxICON_QUESTION | wxSTAY_ON_TOP | wxCENTRE); + + if (msg.ShowModal() == wxID_OK) + { + UpdateFirmware(); + } +} + + +void GuiAbout::OnGuiEvent(GuiEvent &event) +{ + event.process(); +} + + +BEGIN_EVENT_TABLE(GuiAbout, wxDialog) +GUI_EVT(GuiAbout::OnGuiEvent) + +EVT_BUTTON(ID_BUTTON_UPDATE, GuiAbout::OnButtonUpdateClicked) + +END_EVENT_TABLE() diff --git a/gui/gui_about.h b/gui/gui_about.h new file mode 100644 index 0000000..b536a39 --- /dev/null +++ b/gui/gui_about.h @@ -0,0 +1,64 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _GUI_ABOUT_H +#define _GUI_ABOUT_H + + +#include +#include + +#include +#include + + +class GuiAbout: public wxDialog +{ +public: + GuiAbout(wxWindow* parent, const wxString &title, Powermon &powermon); + ~GuiAbout(); + +private: + enum + { + ID_BUTTON_UPDATE = wxID_HIGHEST + 1, + }; + + Powermon &mPowermon; + + std::vector mFirmwareImage; + uint16_t mFirmwareVersionBcd; + + wxStaticText* mStatusStatic; + + wxButton *mUpdateButton; + + void OnButtonUpdateClicked(wxCommandEvent &event); + void OnClose(wxCloseEvent &event); + + void DownloadDone(void); + + void UpdateFirmware(void); + + void OnGuiEvent(GuiEvent &event); + + DECLARE_EVENT_TABLE() +}; + + +#endif + diff --git a/gui/gui_app.cpp b/gui/gui_app.cpp new file mode 100644 index 0000000..ac64e1b --- /dev/null +++ b/gui/gui_app.cpp @@ -0,0 +1,73 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include +#include + +#include +#include +#include + + +#if defined(_MSC_VER) +#include +#endif + + +IMPLEMENT_APP(GuiApplication) + + + +GuiApplication::GuiApplication() +{ +#if defined(_MSC_VER) + WSAStartup(MAKEWORD(2, 2), &mWsaData); + winrt::init_apartment(); +#endif + + wxLog::SetLogLevel(0); +} + + +GuiApplication::~GuiApplication() +{ +#if defined(_MSC_VER) + WSACleanup(); +#endif +} + + +bool GuiApplication::OnInit(void) +{ + wxSocketBase::Initialize(); + wxImage::AddHandler(new wxPNGHandler); + + Model::getInstance(); + + GuiMain* main_window = new GuiMain(); + main_window->Show(true); + SetTopWindow(main_window); + + return true; +} + + +int GuiApplication::OnExit(void) +{ + printf("\n\n"); + return 0; +} diff --git a/gui/gui_app.h b/gui/gui_app.h new file mode 100644 index 0000000..54856db --- /dev/null +++ b/gui/gui_app.h @@ -0,0 +1,48 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _GUI_APPLICATION_H +#define _GUI_APPLICATION_H + + +#include + +#if defined(_MSC_VER) +#include +#endif + + +class GuiApplication: public wxApp +{ +public: + GuiApplication(); + ~GuiApplication(); + + virtual bool OnInit(void); + virtual int OnExit(void); + +private: +#if defined(_MSC_VER) + WSADATA mWsaData; +#endif +}; + + +DECLARE_APP(GuiApplication) + + +#endif diff --git a/gui/gui_calibrate_dialog.cpp b/gui/gui_calibrate_dialog.cpp new file mode 100644 index 0000000..920c880 --- /dev/null +++ b/gui/gui_calibrate_dialog.cpp @@ -0,0 +1,90 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include + + +GuiCalibrateDialog::GuiCalibrateDialog(wxWindow *parent, wxWindowID id, const wxString &title): wxDialog(parent, id, title) +{ + const size_t BORDER_SIZE = FromDIP(6); + + //main window sizer + wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL); + SetSizer(main_sizer); + + mValueLabel = new wxStaticText(this, wxID_ANY, wxT("Calibration current")); + mValueText = new wxTextCtrl(this, ID_VALUE, wxT(""), wxDefaultPosition, wxDefaultSize); + + main_sizer->AddSpacer(FromDIP(10)); + main_sizer->Add(mValueLabel, 0, wxEXPAND); + main_sizer->Add(mValueText, 0, wxALL | wxEXPAND, BORDER_SIZE); + main_sizer->AddSpacer(FromDIP(10)); + + mErrorLabel = new wxStaticText(this, wxID_ANY, wxT("")); + mErrorLabel->SetForegroundColour(*wxRED); + main_sizer->Add(mErrorLabel, 0, wxALL | wxEXPAND, BORDER_SIZE); + + wxBoxSizer *h_sizer = new wxBoxSizer(wxHORIZONTAL); + main_sizer->Add(h_sizer, 1, wxALL | wxEXPAND, BORDER_SIZE); + + wxButton* button = new wxButton(this, wxID_CANCEL, wxT("Cancel"), wxDefaultPosition, FromDIP(wxSize(150, 40))); + h_sizer->Add(button, 0, wxALL | wxCENTER, BORDER_SIZE); + + mContinueButton = new wxButton(this, wxID_OK, wxT("Continue"), wxDefaultPosition, FromDIP(wxSize(150, 40))); + h_sizer->Add(mContinueButton, 0, wxALL | wxCENTER, BORDER_SIZE); + + main_sizer->SetSizeHints(this); + Centre(); + + Bind(wxEVT_COMMAND_TEXT_UPDATED, &GuiCalibrateDialog::OnTextCtrlUpdated, this, ID_VALUE); +} + + +GuiCalibrateDialog::~GuiCalibrateDialog() +{ +} + + +void GuiCalibrateDialog::OnTextCtrlUpdated(wxCommandEvent &event) +{ + wxString str = mValueText->GetValue(); + bool enable = true; + + if (str.size()) + { + try + { + mValue = ParseTextCtrlFloat(mValueText, wxT("Calibration current")); + mErrorLabel->SetLabel(wxT("")); + } + catch(const ParserException &e) + { + mErrorLabel->SetLabel(e.what()); + enable = false; + } + } + else + { + mErrorLabel->SetLabel(wxT("value is empty")); + enable = false; + } + + mErrorLabel->Refresh(); + mContinueButton->Enable(enable); +} diff --git a/gui/gui_calibrate_dialog.h b/gui/gui_calibrate_dialog.h new file mode 100644 index 0000000..f1bb98a --- /dev/null +++ b/gui/gui_calibrate_dialog.h @@ -0,0 +1,56 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _GUI_CALIBRATE_DIALOG_H +#define _GUI_CALIBRATE_DIALOG_H + + +#include + + +class GuiCalibrateDialog : public wxDialog +{ +public: + + GuiCalibrateDialog(wxWindow *parent, wxWindowID id, const wxString &title); + ~GuiCalibrateDialog(); + + float getValue(void) const + { + return mValue; + } + + +private: + enum + { + ID_VALUE = wxID_HIGHEST + 1, + }; + + wxStaticText* mValueLabel; + wxTextCtrl* mValueText; + + wxButton* mContinueButton; + wxStaticText* mErrorLabel; + + float mValue; + + void OnTextCtrlUpdated(wxCommandEvent &event); +}; + + +#endif diff --git a/gui/gui_chart.cpp b/gui/gui_chart.cpp new file mode 100644 index 0000000..ee33370 --- /dev/null +++ b/gui/gui_chart.cpp @@ -0,0 +1,165 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include +#include + +#include + +#include + +#include + + +GuiChart::GuiChart(wxWindow *parent, const wxString &title): wxFrame(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER | wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN) +{ + wxBitmap icon_bmp = wxBITMAP_PNG_FROM_DATA(img_thornwave_icon); + + wxIcon icon; + icon.CopyFromBitmap(icon_bmp); + SetIcon(icon); + + //main window sizer & panel + wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL); + SetSizer(main_sizer); + + mScopeDisplay = new ScopeDisplay(this, wxID_ANY, wxDefaultPosition, FromDIP(wxSize(800, 600))); + mScopeDisplay->setListener(this); + + std::vector scales; + //scales.push_back((uint64_t)1000 * 1000 * 30); //30 seconds / div + scales.push_back((uint64_t)1000 * 1000 * 60 * 1); //1 minute / div + scales.push_back((uint64_t)1000 * 1000 * 60 * 2); //2 minutes / div + scales.push_back((uint64_t)1000 * 1000 * 60 * 5); //5 minutes / div + scales.push_back((uint64_t)1000 * 1000 * 60 * 10); //10 minutes / div + scales.push_back((uint64_t)1000 * 1000 * 60 * 20); //20 minutes / div + scales.push_back((uint64_t)1000 * 1000 * 60 * 30); //30 minutes / div + scales.push_back((uint64_t)1000 * 1000 * 60 * 60 * 1); //1 hour / div + scales.push_back((uint64_t)1000 * 1000 * 60 * 60 * 2); //2 hours / div + scales.push_back((uint64_t)1000 * 1000 * 60 * 60 * 6); //6 hours / div + scales.push_back((uint64_t)1000 * 1000 * 60 * 60 * 12); //12 hours / div + scales.push_back((uint64_t)1000 * 1000 * 60 * 60 * 24 * 1); //1 day / div + scales.push_back((uint64_t)1000 * 1000 * 60 * 60 * 24 * 2); //2 day / div + scales.push_back((uint64_t)1000 * 1000 * 60 * 60 * 24 * 7); //7 day / div + + mScopeDisplay->SetTimeScales(scales, 6); + + main_sizer->Add(mScopeDisplay, 1, wxALL | wxEXPAND, FromDIP(6)); + + main_sizer->SetSizeHints(this); + Centre(); + + Bind(wxEVT_CLOSE_WINDOW, &GuiChart::OnClose, this); + + mScopeDisplay->addWaveform(wxT("Voltage 1"), wxT("V"), wxT("V"), 5); + mScopeDisplay->addWaveform(wxT("Voltage 2"), wxT("V"), wxT("V"), 5); + mScopeDisplay->addWaveform(wxT("Current"), wxT("I"), wxT("A"), 5); + mScopeDisplay->addWaveform(wxT("Power"), wxT("P"), wxT("W"), 5); + mScopeDisplay->addWaveform(wxT("Temperature"), wxT("T"), wxT("\u00B0C"), 5); + mScopeDisplay->addWaveform(wxT("SoC"), wxT("%"), wxT("%"), 10); +} + + + +GuiChart::~GuiChart() +{ +} + + +void GuiChart::update(void) +{ + const auto &log_data = Model::getInstance().logData; + + mScopeDisplay->setMinTime((uint64_t)log_data.front().time * 1000000); + mScopeDisplay->setMaxTime((uint64_t)log_data.back().time * 1000000); + mScopeDisplay->EndTimePos(); +} + + +void GuiChart::OnClose(wxCloseEvent &event) +{ + Hide(); +} + + +void GuiChart::getChartData(uint64_t start_time, uint64_t last_time, size_t point_count, std::vector &data) +{ + const auto &log_data = Model::getInstance().logData; + + for(auto &d: data) + d = std::vector(point_count, NAN); + + start_time = start_time / 1000000; + last_time = (last_time + 999999) / 1000000; + + const uint32_t step = (last_time - start_time) / point_count; + uint64_t time = start_time + step; + + uint32_t count = 0; + std::vector avg(data.size(), 0); + + std::vector::const_iterator it = std::find_if(log_data.begin(), log_data.end(), [start_time](const PowermonLogFile::Sample &sample) + { + return sample.time >= start_time; + }); + + uint32_t pos; + for(pos = 0; pos < point_count && (it != log_data.end()); it++) + { + if (it->time < time) + { + avg[0] += it->voltage1; + avg[1] += it->voltage2; + avg[2] += it->current; + avg[3] += it->power; + avg[4] += it->temperature; + avg[5] += (it->soc <= 100) ? it->soc : NAN; + + count++; + } + else + { + if (count) + { + uint32_t i = 0; + for(auto &a: avg) + { + a /= count; + data[i++][pos] = a; + } + pos++; + } + + avg[0] = it->voltage1; + avg[1] = it->voltage2; + avg[2] = it->current; + avg[3] = it->power; + avg[4] = it->temperature; + avg[5] = (it->soc <= 100) ? it->soc : NAN; + + count = 1; + time += step; + } + } +} + + + +BEGIN_EVENT_TABLE(GuiChart, wxFrame) +END_EVENT_TABLE() diff --git a/gui/gui_chart.h b/gui/gui_chart.h new file mode 100644 index 0000000..515ffe4 --- /dev/null +++ b/gui/gui_chart.h @@ -0,0 +1,55 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _GUI_CHART_H +#define _GUI_CHART_H + + +#include +#include + +#include + + + +class GuiChart: public wxFrame, public ScopeDisplay::Listener +{ +public: + GuiChart(wxWindow* parent, const wxString &title); + ~GuiChart(); + + void getChartData(uint64_t start_time, uint64_t last_time, size_t point_count, std::vector &data) override final; + + void update(void); + +private: + enum + { + ID_SCOPE_TIMER = wxID_HIGHEST + 1, + }; + + wxMenuBar* mMenuBar; + ScopeDisplay* mScopeDisplay; + + void OnClose(wxCloseEvent &event); + + DECLARE_EVENT_TABLE() +}; + +#endif + + diff --git a/gui/gui_device.cpp b/gui/gui_device.cpp new file mode 100644 index 0000000..c7cce91 --- /dev/null +++ b/gui/gui_device.cpp @@ -0,0 +1,1232 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include + +#include + + +#define MONITOR_FONT wxFont(18, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL) +#define MONITOR_FONT_BOLD wxFont(18, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD) + + +GuiDevice::GuiDevice(wxWindow* parent, const Powermon::DeviceIdentifier &id, PowermonScanner* scanner): wxFrame(parent, wxID_ANY, wxT(""), wxDefaultPosition, wxDefaultSize, wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN), + mPowermon(*Powermon::createInstance()), mStatsDialog(nullptr), mFgStatsDialog(nullptr) +{ + mChart = nullptr; + + wxString title; + title.Printf(wxT("PowerMon Manager: %s"), id.name.c_str()); + SetTitle(title); + + mMonitorDataValid = false; + mSyncInProgress = false; + + mMonitorBackgroundColor = wxColour(0xB3, 0xDF, 0xA6); + + SetDoubleBuffered(true); + + mMenuBar = new wxMenuBar; + + mDeviceMenu = new wxMenu; + + mDeviceMenu->Append(ID_MENU_VIEW_STATS, wxT("View Statistics")); + mDeviceMenu->Enable(ID_MENU_VIEW_STATS, false); + mDeviceMenu->SetHelpString(ID_MENU_VIEW_STATS, wxT("View the device statistics")); + + mDeviceMenu->Append(ID_MENU_VIEW_FG_STATS, wxT("View FuelGauge Statistics")); + mDeviceMenu->Enable(ID_MENU_VIEW_FG_STATS, false); + mDeviceMenu->SetHelpString(ID_MENU_VIEW_FG_STATS, wxT("View the FuelGauge statistics")); + + mDeviceMenu->AppendSeparator(); + + mDeviceMenu->Append(ID_MENU_DATA_LOG, wxT("Data Log")); + mDeviceMenu->Enable(ID_MENU_DATA_LOG, false); + mDeviceMenu->SetHelpString(ID_MENU_DATA_LOG, wxT("Access the data logging feature")); + + mDeviceMenu->Append(ID_MENU_SYNC_LOG, wxT("Sync Log Now")); + mDeviceMenu->Enable(ID_MENU_SYNC_LOG, false); + mDeviceMenu->SetHelpString(ID_MENU_SYNC_LOG, wxT("Synchronize the data log now")); + + mDeviceMenu->Append(ID_MENU_CLEAR_LOCAL_LOG, wxT("Clear Local Data Log")); + mDeviceMenu->Enable(ID_MENU_CLEAR_LOCAL_LOG, false); + mDeviceMenu->SetHelpString(ID_MENU_CLEAR_LOCAL_LOG, wxT("Clear the local copy of the data log feature")); + + mDeviceMenu->AppendSeparator(); + + mDeviceMenu->Append(ID_MENU_TIMERS, wxT("Timers")); + mDeviceMenu->Enable(ID_MENU_TIMERS, false); + mDeviceMenu->SetHelpString(ID_MENU_TIMERS, wxT("Add, edit or delete timers")); + + mDeviceMenu->AppendSeparator(); + + mDeviceMenu->Append(ID_MENU_POWER_CONTROL, wxT("Power Control")); + mDeviceMenu->Enable(ID_MENU_POWER_CONTROL, false); + mDeviceMenu->SetHelpString(ID_MENU_POWER_CONTROL, wxT("Control the device power relay output")); + + mDeviceMenu->AppendSeparator(); + + mDeviceMenu->Append(ID_MENU_RESET_EM, wxT("Reset Energy Meter")); + mDeviceMenu->Enable(ID_MENU_RESET_EM, false); + mDeviceMenu->SetHelpString(ID_MENU_RESET_EM, wxT("Reset the device energy meter")); + + mDeviceMenu->Append(ID_MENU_RESET_CM, wxT("Reset Coulomb Meter")); + mDeviceMenu->Enable(ID_MENU_RESET_CM, false); + mDeviceMenu->SetHelpString(ID_MENU_RESET_CM, wxT("Reset the device coulomb meter")); + + mDeviceMenu->AppendSeparator(); + + mDeviceMenu->Append(ID_MENU_UNLOCK, wxT("Unlock Device")); + mDeviceMenu->Enable(ID_MENU_UNLOCK, false); + mDeviceMenu->SetHelpString(ID_MENU_UNLOCK, wxT("Unlock a password protected device")); + + mDeviceMenu->Append(ID_MENU_SET_USER_PASSWORD, wxT("Set User Password")); + mDeviceMenu->Enable(ID_MENU_SET_USER_PASSWORD, false); + mDeviceMenu->SetHelpString(ID_MENU_SET_USER_PASSWORD, wxT("Set or remove the user password protection")); + + mDeviceMenu->Append(ID_MENU_SET_MASTER_PASSWORD, wxT("Set Master Password")); + mDeviceMenu->Enable(ID_MENU_SET_MASTER_PASSWORD, false); + mDeviceMenu->SetHelpString(ID_MENU_SET_MASTER_PASSWORD, wxT("Set or remove the master password protection")); + + mDeviceMenu->AppendSeparator(); + + mDeviceMenu->Append(ID_MENU_PAIR, wxT("Pair Device")); + mDeviceMenu->SetHelpString(ID_MENU_PAIR, wxT("Pair the device")); + + mDeviceMenu->AppendSeparator(); + + mDeviceMenu->Append(wxID_EXIT, wxT("Disconnect")); + mDeviceMenu->SetHelpString(wxID_EXIT, wxT("Disconnect from the device and close this window")); + + + mSettingsMenu = new wxMenu; + + mSettingsMenu->Append(ID_MENU_RENAME, wxT("Rename Device")); + mSettingsMenu->Enable(ID_MENU_RENAME, false); + mSettingsMenu->SetHelpString(ID_MENU_RENAME, wxT("Change the BLE name of a device")); + + + mSettingsMenu->Append(ID_MENU_CONFIGURATION, wxT("Device Configuration")); + mSettingsMenu->Enable(ID_MENU_CONFIGURATION, false); + mSettingsMenu->SetHelpString(ID_MENU_CONFIGURATION, wxT("Access the device configuration")); + + mSettingsMenu->Append(ID_MENU_WIFI_SETUP, wxT("WiFi Setup")); + mSettingsMenu->Enable(ID_MENU_WIFI_SETUP, false); + mSettingsMenu->SetHelpString(ID_MENU_WIFI_SETUP, wxT("Configure the WiFi network PowerMon connects to")); + + mSettingsMenu->Append(ID_MENU_RESET_FACTORY, wxT("Factory Reset")); + mSettingsMenu->Enable(ID_MENU_RESET_FACTORY, false); + mSettingsMenu->SetHelpString(ID_MENU_RESET_FACTORY, wxT("Access the device configuration")); + + + mSettingsMenu->Append(ID_MENU_SET_TIME, wxT("Set Device Time")); + mSettingsMenu->Enable(ID_MENU_SET_TIME, false); + mSettingsMenu->SetHelpString(ID_MENU_SET_TIME, wxT("Set the BLE device time/date")); + + mSettingsMenu->Append(ID_MENU_ZERO_OFFSET, wxT("Zero Current Offset")); + mSettingsMenu->Enable(ID_MENU_ZERO_OFFSET, false); + mSettingsMenu->SetHelpString(ID_MENU_ZERO_OFFSET, wxT("Zero the current offset")); + + mSettingsMenu->Append(ID_MENU_CALIBRATE_CURRENT, wxT("Calibrate Current")); + mSettingsMenu->Enable(ID_MENU_CALIBRATE_CURRENT, false); + mSettingsMenu->SetHelpString(ID_MENU_CALIBRATE_CURRENT, wxT("Calibrate the current reading")); + + mSettingsMenu->Append(ID_MENU_FORCE_FG_SYNC, wxT("Force SOC Sync")); + mSettingsMenu->Enable(ID_MENU_FORCE_FG_SYNC, false); + mSettingsMenu->SetHelpString(ID_MENU_FORCE_FG_SYNC, wxT("Force the SOC synchronization")); + + + mMenuBar->Append(mDeviceMenu, wxT("&Device")); + mMenuBar->Append(mSettingsMenu, wxT("&Settings")); + + + wxMenu* menu = new wxMenu; + menu->Append(wxID_ABOUT, wxT("&About")); + mMenuBar->Append(menu, wxT("&Help")); + + SetMenuBar(mMenuBar); + + CreateStatusBar(1); + SetStatusText(wxT("Disconnected")); + + + //main window sizer & panel + wxPanel *panel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize); + wxBoxSizer *main_sizer = new wxBoxSizer(wxVERTICAL); + panel->SetSizer(main_sizer); + + + mMonitorPanel = new wxPanel(panel, wxID_ANY, wxDefaultPosition, FromDIP(wxSize(400, 460))); + mMonitorPanel->SetBackgroundStyle(wxBG_STYLE_PAINT); + mMonitorPanel->SetDoubleBuffered(true); + mMonitorPanel->SetBackgroundColour(mMonitorBackgroundColor); + mMonitorPanel->Bind(wxEVT_PAINT, &GuiDevice::OnMonitorPaint, this); + + main_sizer->Add(mMonitorPanel, 1, wxALL | wxEXPAND, FromDIP(10)); + + main_sizer->SetSizeHints(this); + + + mPowermon.setOnConnectCallback([this, scanner]() + { + if (scanner) + scanner->startBleScan(); + + mPowermon.requestGetInfo([this](uint16_t status, const Powermon::DeviceInfo &info) + { + wxQueueEvent(this, new GuiEvent([this, status, info](const GuiEvent &event) + { + if (checkDeviceError(this, status)) + { + SetStatusText(wxT("Connected")); + updateTitle(); + + if (info.isUserLocked()) + deviceUnlock(true); + else + startDevice(); + } + })); + }); + }); + + + mPowermon.setOnDisconnectCallback([this, scanner](Powermon::DisconnectReason reason) + { + if (scanner) + scanner->startBleScan(); + + wxQueueEvent(this, new GuiEvent([this, reason](const GuiEvent &event) + { + mSyncLogTimer->Stop(); + mMonitorDataTimer->Stop(); + Model::getInstance().clearDevice(); + + enableMenus(false); + + if (reason == Powermon::DisconnectReason::NO_ROUTE) + { + wxMessageDialog msg(this, wxT("Device failed to connect"), wxT("Info"), wxOK | wxSTAY_ON_TOP | wxCENTRE); + msg.ShowModal(); + } + else if (reason != Powermon::DisconnectReason::CLOSED) + { + wxMessageDialog msg(this, wxT("Device disconnected"), wxT("Info"), wxOK | wxSTAY_ON_TOP | wxCENTRE); + msg.ShowModal(); + } + + Close(true); + })); + }); + + mPowermon.setOnMonitorDataCallback([this](const Powermon::MonitorData &data) + { + GuiEvent* event = new GuiEvent([this, data](GuiEvent &event) + { + mMonitorData = data; + mMonitorDataValid = true; + mMonitorPanel->Refresh(); + }); + + wxQueueEvent(this, event); + }); + + + mMonitorDataTimer = new wxTimer(this, ID_MONITOR_DATA_TIMER); + mSyncLogTimer = new wxTimer(this, ID_SYNC_LOG_TIMER); + + //start the thread and connect + SetStatusText(wxT("Connecting ...")); + + if (Powermon::hasWifi(id.hardware_revision_bcd)) + { + if (id.address) + mPowermon.connectWifi(id.address); + else + mPowermon.connectWifi(id.access_key); + } + else + { + mPowermon.connectBle(id.address); + } +} + + +GuiDevice::~GuiDevice() +{ + delete mMonitorDataTimer; + delete mSyncLogTimer; +} + + + +void GuiDevice::enableMenus(bool state) +{ + mDeviceMenu->Enable(ID_MENU_PAIR, state); + mDeviceMenu->Enable(ID_MENU_TIMERS, state); + + mDeviceMenu->Enable(ID_MENU_RESET_EM, state); + mDeviceMenu->Enable(ID_MENU_RESET_CM, state); + mDeviceMenu->Enable(ID_MENU_VIEW_STATS, state); + mDeviceMenu->Enable(ID_MENU_VIEW_FG_STATS, state); + + mDeviceMenu->Enable(ID_MENU_POWER_CONTROL, state); + mDeviceMenu->Enable(ID_MENU_DATA_LOG, state); + mDeviceMenu->Enable(ID_MENU_SYNC_LOG, state); + mDeviceMenu->Enable(ID_MENU_CLEAR_LOCAL_LOG, state); + + mDeviceMenu->Enable(ID_MENU_UNLOCK, state); + mDeviceMenu->Enable(ID_MENU_SET_USER_PASSWORD, state); + mDeviceMenu->Enable(ID_MENU_SET_MASTER_PASSWORD, state); + + mSettingsMenu->Enable(ID_MENU_RENAME, state); + + mSettingsMenu->Enable(ID_MENU_WIFI_SETUP, state); + mSettingsMenu->Enable(ID_MENU_RESET_FACTORY, state); + mSettingsMenu->Enable(ID_MENU_CONFIGURATION, state); + mSettingsMenu->Enable(ID_MENU_SET_TIME, state); + + mSettingsMenu->Enable(ID_MENU_ZERO_OFFSET, state); + mSettingsMenu->Enable(ID_MENU_CALIBRATE_CURRENT, state); + + mSettingsMenu->Enable(ID_MENU_FORCE_FG_SYNC, state); +} + + +void GuiDevice::OnSyncLogTimerEvent(wxTimerEvent &event) +{ + startSync(); +} + + +void GuiDevice::startSync(void) +{ + mSyncEnabled = true; + mSyncInProgress = false; + mSyncTotalSize = 0; + mSyncCompletedSize = 0; + + mLogFiles.clear(); + + mPowermon.requestGetFileList([this](uint16_t status, const std::vector &list) + { + if (status == Powermon::RSP_SUCCESS) + { + mSyncCompletedSize = 0; + mSyncTotalSize = 0; + mSyncInProgress = true; + mLogFiles = list; + + for(const auto &log: mLogFiles) + { + mSyncTotalSize += log.size; + + const wxFileName fname = Model::getInstance().getLogFileName(log.id); + + wxULongLong fsize = fname.GetSize(); + if (fsize != wxInvalidSize) + mSyncTotalSize -= fsize.GetValue(); + } + + if (mSyncTotalSize > 0) + readFile(); + else + mSyncInProgress = false; + } + else + { + debug_printf("\r\nFile list error"); + } + }); +} + +void GuiDevice::stopSync(void) +{ + mSyncEnabled = false; + while(mSyncInProgress); +} + + +void GuiDevice::readFile(void) +{ + if (mLogFiles.size() > 0) + { + const wxFileName fname = Model::getInstance().getLogFileName(mLogFiles.front().id); + if (mLogFile.Open(fname.GetFullPath(), wxFile::write_append)) + { + mFileSize = mLogFile.Length(); + + if (mFileSize < mLogFiles.front().size) + { + readFileBlock(); + } + else + { + mLogFile.Close(); + + if (mLogFiles.size()) + mLogFiles.erase(mLogFiles.begin()); + + if (mSyncEnabled) + readFile(); + else + mSyncInProgress = false; + } + } + } + else + { + mSyncInProgress = false; + + if (mSyncEnabled) + { + wxQueueEvent(this, new GuiEvent([this](const GuiEvent &event) + { + mSyncLogTimer->Start(1000 * 60 * 10, wxTIMER_ONE_SHOT); + updateStatusBar(); + })); + } + } +} + + +void GuiDevice::readFileBlock(void) +{ + const uint32_t block_size = Powermon::hasWifi(mPowermon.getLastDeviceInfo().hardware_revision_bcd) ? 128 * 1024 : 4 * 1024; + + mPowermon.requestReadFile(mLogFiles.front().id, mFileSize, block_size, + [this](uint16_t status, const uint8_t* data, size_t size) + { + if ((status == Powermon::RSP_SUCCESS) && size) + { + mLogFile.Write((const char*)data, size); + mFileSize += size; + + mSyncCompletedSize += size; + debug_printf("\r\nProgress: %u / %u", mSyncCompletedSize, mSyncTotalSize); + + wxQueueEvent(this, new GuiEvent([this, status](const GuiEvent &event) + { + updateStatusBar(); + })); + + readFileBlock(); + } + else + { + mLogFile.Close(); + + if (mLogFiles.size()) + mLogFiles.erase(mLogFiles.begin()); + + if (mSyncEnabled) + readFile(); + else + mSyncInProgress = false; + } + }); +} + + +void GuiDevice::startDevice(void) +{ + if (Powermon::hasWifi(mPowermon.getLastDeviceInfo().hardware_revision_bcd)) + mMonitorDataTimer->Start(mPowermon.isLocalConnection() ? 1000 : 2000); + + Model::getInstance().setDevice(mPowermon.getLastDeviceInfo().serial); + mSyncLogTimer->Start(1000 * 2, wxTIMER_ONE_SHOT); + + enableMenus(true); +} + + +void GuiDevice::OnMenuSettingsRename(wxCommandEvent &event) +{ + GuiEnterString dialog(this, wxID_ANY, wxT("Enter New Name"), false, false); + + dialog.setStringLabel(wxT("Enter name")); + dialog.setMaxStringLength(Powermon::hasWifi(mPowermon.getLastDeviceInfo().hardware_revision_bcd) ? MAX_WIFI_NAME_LENGTH : MAX_BLE_NAME_LENGTH); + + dialog.SetFocus(); + if (dialog.ShowModal() == wxID_OK) + { + const wxString name = dialog.getString(); + + mPowermon.requestRename(name.mb_str(), + [this, name](uint16_t status) + { + wxQueueEvent(this, new GuiEvent([this, status, name](const GuiEvent &event) + { + if (checkDeviceError(this, status)) + { + updateTitle(); + } + })); + }); + } +} + + +void GuiDevice::OnMenuDeviceResetEM(wxCommandEvent &event) +{ + wxMessageDialog msg(this, wxT("Reset the energy meter ?"), wxT("Confirmation"), wxOK | wxCANCEL | wxICON_QUESTION | wxSTAY_ON_TOP | wxCENTRE); + if (msg.ShowModal() == wxID_OK) + { + mPowermon.requestResetEnergyMeter([this](uint16_t status) + { + wxQueueEvent(this, new GuiEvent([this, status](const GuiEvent& event) + { + checkDeviceError(this, status); + })); + }); + } +} + + +void GuiDevice::OnMenuDeviceResetCM(wxCommandEvent &event) +{ + wxMessageDialog msg(this, wxT("Reset the coulomb meter ?"), wxT("Confirmation"), wxOK | wxCANCEL | wxICON_QUESTION | wxSTAY_ON_TOP | wxCENTRE); + if (msg.ShowModal() == wxID_OK) + { + mPowermon.requestResetCoulombMeter([this](uint16_t status) + { + wxQueueEvent(this, new GuiEvent([this, status](const GuiEvent& event) + { + checkDeviceError(this, status); + })); + }); + } +} + + +void GuiDevice::OnMenuSettingsForceFgSync(wxCommandEvent &event) +{ + wxMessageDialog msg(this, wxT("Force the fuel gauge SoC synchronization ?"), wxT("Confirmation"), wxOK | wxCANCEL | wxICON_QUESTION | wxSTAY_ON_TOP | wxCENTRE); + if (msg.ShowModal() == wxID_OK) + { + mPowermon.requestFgSynchronize([this](uint16_t status) + { + wxQueueEvent(this, new GuiEvent([this, status](const GuiEvent &event) + { + checkDeviceError(this, status); + })); + }); + } +} + + +void GuiDevice::OnMenuDeviceViewStats(wxCommandEvent &event) +{ + if (mStatsDialog == nullptr) + mStatsDialog = new GuiStats(this, wxT("Statistics"), mPowermon); + + mStatsDialog->Show(); +} + + +void GuiDevice::OnMenuDeviceViewFgStats(wxCommandEvent &event) +{ + mPowermon.requestGetFgStatistics([this](uint16_t status, const Powermon::FuelgaugeStatistics &stats) + { + wxQueueEvent(this, new GuiEvent([this, status, stats](const GuiEvent &event) + { + if (checkDeviceError(this, status)) + { + if (mFgStatsDialog == nullptr) + mFgStatsDialog = new GuiFgStats(this, wxT("Fuel Gauge Statistics"), stats); + + mFgStatsDialog->Show(); + } + })); + }); +} + + +void GuiDevice::OnMenuSettingsZeroCurrentOffset(wxCommandEvent &event) +{ + wxMessageDialog msg(this, wxT("Calibrate the current offset ?"), wxT("Confirmation"), wxOK | wxCANCEL | wxICON_QUESTION | wxSTAY_ON_TOP | wxCENTRE); + if (msg.ShowModal() == wxID_OK) + { + mPowermon.requestZeroCurrentOffset([this](uint16_t status) + { + wxQueueEvent(this, new GuiEvent([this, status](const GuiEvent &event) + { + checkDeviceError(this, status); + })); + }); + } +} + + +void GuiDevice::OnMenuSettingsCalibrateCurrent(wxCommandEvent &event) +{ + GuiCalibrateDialog dialog(this, wxID_ANY, wxT("Current calibration")); + + if (dialog.ShowModal() == wxID_OK) + { + mPowermon.requestCalibrateCurrent(dialog.getValue(), [this](uint16_t status) + { + wxQueueEvent(this, new GuiEvent([this, status](const GuiEvent &event) + { + checkDeviceError(this, status); + })); + }); + } +} + + +void GuiDevice::OnMenuDevicePowerControl(wxCommandEvent &event) +{ + wxMessageDialog msg(this, wxT("Turn the device power ..."), wxT("Device Power"), wxOK | wxCANCEL | wxICON_QUESTION | wxSTAY_ON_TOP | wxCENTRE); + msg.SetOKCancelLabels(wxT("ON"), wxT("OFF")); + const bool power_state = (msg.ShowModal() == wxID_OK); + + mPowermon.requestSetPowerState(power_state, [this](uint16_t status) + { + wxQueueEvent(this, new GuiEvent([this, status](const GuiEvent &event) + { + checkDeviceError(this, status); + })); + }); +} + + +void GuiDevice::OnMenuSettingsResetFactory(wxCommandEvent &event) +{ + wxMessageDialog msg(this, + wxT("You are about to reset your device to factory settings.\n" + "The WiFi configuration, timers, and calibration will also be reset.\n" + "The name will be reset to 'PowerMon-W'. All data logs will be removed!\n" + "\n\n\nThis cannot be undone!\n\n"), + + wxT("Confirmation"), wxOK | wxCANCEL | wxICON_QUESTION | wxSTAY_ON_TOP | wxCENTRE); + + if (msg.ShowModal() != wxID_OK) + return; + + mPowermon.requestResetConfig([this](uint16_t status) + { + wxQueueEvent(this, new GuiEvent([this, status](const GuiEvent &event) + { + if (checkDeviceError(this, status)) + { + wxMessageDialog msg(this, wxT("The device has been reset to factory defaults."), wxT("Info"), wxOK | wxSTAY_ON_TOP | wxCENTRE); + msg.ShowModal(); + } + })); + }); +} + + +void GuiDevice::OnMenuSettingsConfiguration(wxCommandEvent &event) +{ + mPowermon.requestGetConfig([this](uint16_t status, const PowermonConfig &config) + { + wxQueueEvent(this, new GuiEvent([this, status, config](const GuiEvent &event) + { + if (checkDeviceError(this, status)) + { + GuiDeviceConfig dialog(this, wxID_ANY, config, mPowermon); + + if (dialog.ShowModal() == wxID_OK) + { + mPowermon.requestSetConfig(dialog.getConfiguration(), [this](uint16_t status) + { + wxQueueEvent(this, new GuiEvent([this, status](const GuiEvent &event) + { + checkDeviceError(this, status); + })); + + }); + } + } + })); + }); +} + + + +void GuiDevice::OnMenuSettingsSetTime(wxCommandEvent &event) +{ + wxDateTime dt = wxDateTime::Now(); + + wxString message_str; + message_str.Printf(wxT("The device time will be set to:\n%s - %s"), + dt.Format(wxT("%I:%M %p")).mb_str(), + dt.FormatDate().mb_str()); + + wxMessageDialog msg(this, message_str, wxT("Confirmation"), wxOK | wxCANCEL | wxICON_QUESTION | wxSTAY_ON_TOP | wxCENTRE); + if (msg.ShowModal() == wxID_OK) + { + mPowermon.requestSetTime(wxGetLocalTime() + (dt.IsDST() ? 3600 : 0), + [this](uint16_t status) + { + wxQueueEvent(this, new GuiEvent([this, status](const GuiEvent &event) + { + checkDeviceError(this, status); + })); + }); + } +} + + +void GuiDevice::OnMenuDeviceTimers(wxCommandEvent &event) +{ + mPowermon.requestGetSchedules([this](uint16_t status, const std::vector &schedules) + { + wxQueueEvent(this, new GuiEvent([this, status, schedules](const GuiEvent &event) + { + if (checkDeviceError(this, status)) + { + GuiTimersDialog dialog(this, schedules); + + if (dialog.ShowModal() == wxID_OK) + { + const std::vector new_schedules = dialog.getSchedules(); + + mPowermon.requestClearSchedules([this, new_schedules](uint16_t status) + { + wxQueueEvent(this, new GuiEvent([this, status, new_schedules](const GuiEvent &event) + { + if (checkDeviceError(this, status)) + { + if (new_schedules.size()) + { + mPowermon.requestAddSchedules(new_schedules, [this](uint16_t status) + { + wxQueueEvent(this, new GuiEvent([this, status](const GuiEvent &event) + { + checkDeviceError(this, status); + })); + }); + } + + mPowermon.requestCommitSchedules([this](uint16_t status) + { + wxQueueEvent(this, new GuiEvent([this, status](const GuiEvent &event) + { + checkDeviceError(this, status); + })); + }); + } + })); + }); + } + } + })); + }); +} + + +void GuiDevice::OnMenuDeviceClearLocalLog(wxCommandEvent &event) +{ + stopSync(); + Model::getInstance().deleteLogData(); +} + + +void GuiDevice::OnMenuDeviceSyncLog(wxCommandEvent &event) +{ + if (mSyncInProgress == false) + startSync(); +} + + +void GuiDevice::OnMenuDeviceDataLog(wxCommandEvent &event) +{ + if (mChart == nullptr) + mChart = new GuiChart(this, wxT("PowerMon Data Log")); + + Model::getInstance().loadLogData(Model::getInstance().logData); + + mChart->update(); + mChart->SetFocus(); + mChart->Show(); +} + + +void GuiDevice::OnMenuSettingsUnlock(wxCommandEvent &event) +{ + deviceUnlock(false); +} + + +void GuiDevice::OnMenuSettingsSetUserPassword(wxCommandEvent &event) +{ + GuiEnterString dialog(this, wxID_ANY, wxT("Enter new user password"), true, true); + dialog.setStringLabel(wxT("Enter user password")); + dialog.setConfirmLabel(wxT("Confirm user password")); + dialog.setMaxStringLength(256); + + dialog.SetFocus(); + if (dialog.ShowModal() == wxID_OK) + { + if (dialog.getString().size()) + { + const Powermon::AuthKey key = Powermon::getAuthKeyFromPassword(dialog.getString().mb_str()); + + mPowermon.requestSetUserPasswordLock(key, [this](uint16_t status) + { + wxQueueEvent(this, new GuiEvent([this, status](const GuiEvent &event) + { + checkDeviceError(this, status); + })); + }); + } + else + { + mPowermon.requestClearUserPasswordLock([this](uint16_t status) + { + wxQueueEvent(this, new GuiEvent([this, status](const GuiEvent &event) + { + if (checkDeviceError(this, status)) + { + wxMessageDialog msg(this, + wxT("Device user password reset successfully.\n"), + wxT("Confirmation"), wxOK | wxSTAY_ON_TOP | wxCENTRE); + msg.ShowModal(); + } + })); + }); + } + } +} + + +void GuiDevice::OnMenuSettingsSetMasterPassword(wxCommandEvent &event) +{ + GuiEnterString dialog(this, wxID_ANY, wxT("Enter new master password"), true, true); + dialog.setStringLabel(wxT("Enter master password")); + dialog.setConfirmLabel(wxT("Confirm master password")); + dialog.setMaxStringLength(256); + + dialog.SetFocus(); + if (dialog.ShowModal() == wxID_OK) + { + if (dialog.getString().size()) + { + const Powermon::AuthKey key = Powermon::getAuthKeyFromPassword(dialog.getString().mb_str()); + + mPowermon.requestSetMasterPasswordLock(key, [this](uint16_t status) + { + wxQueueEvent(this, new GuiEvent([this, status](const GuiEvent &event) + { + checkDeviceError(this, status); + })); + }); + } + else + { + mPowermon.requestClearMasterPasswordLock([this](uint16_t status) + { + wxQueueEvent(this, new GuiEvent([this, status](const GuiEvent &event) + { + if (checkDeviceError(this, status)) + { + wxMessageDialog msg(this, + wxT("Device master password reset successfully.\n"), + wxT("Confirmation"), wxOK | wxSTAY_ON_TOP | wxCENTRE); + msg.ShowModal(); + } + })); + }); + } + } +} + + +void GuiDevice::OnMenuSettingsWifiSetup(wxCommandEvent &event) +{ + GuiWifiSetup setup(this, mPowermon); + setup.ShowModal(); +} + + +void GuiDevice::OnMenuDevicePair(wxCommandEvent &event) +{ + mPowermon.requestGetAccessKeys([this](uint16_t status, const Powermon::WifiAccessKey &key) + { + wxQueueEvent(this, new GuiEvent([this, status, key](const GuiEvent &event) + { + if (checkDeviceError(this, status)) + { + Powermon::DeviceIdentifier id; + + id.serial = mPowermon.getLastDeviceInfo().serial; + id.name = mPowermon.getLastDeviceInfo().name; + id.hardware_revision_bcd = mPowermon.getLastDeviceInfo().hardware_revision_bcd; + id.access_key = key; + + Model::getInstance().addCloudDevice(id); + + wxMessageDialog msg(this, + wxT("Device paired successfully.\n"), + wxT("Instructions"), wxOK | wxSTAY_ON_TOP | wxCENTRE); + msg.ShowModal(); + } + })); + }); +} + + +void GuiDevice::OnMenuDeviceDisconnect(wxCommandEvent &event) +{ + mPowermon.setOnDisconnectCallback([](Powermon::DisconnectReason){}); + mPowermon.disconnect(); + Close(true); +} + + + +void GuiDevice::OnMenuHelpAbout(wxCommandEvent &event) +{ + GuiAbout about(this, wxT("About"), mPowermon); + if (about.ShowModal() == wxID_OK) + { + wxMessageDialog msg(this, wxT("Your PowerMon just received brand new firmware.\n" + "It will now disconnect and update itself.\n\n" + "DO NOT DISCONNECT THE POWER TO THE DEVICE UNTIL IT COMES BACK ON !"), + wxT("Info"), wxOK | wxSTAY_ON_TOP | wxCENTRE); + msg.ShowModal(); + + mPowermon.disconnect(); + } +} + + +void GuiDevice::OnClose(wxCloseEvent &event) +{ + mPowermon.setOnDisconnectCallback([](Powermon::DisconnectReason){}); + mPowermon.disconnect(); + Destroy(); +} + + +void GuiDevice::OnGuiEvent(GuiEvent &event) +{ + event.process(); +} + + +void GuiDevice::updateTitle(void) +{ + wxString title; + title.Printf(wxT("PowerMon Manager: %s"), mPowermon.getLastDeviceInfo().name.c_str()); + SetTitle(title); +} + + +void GuiDevice::updateStatusBar(void) +{ + if (mSyncInProgress) + { + const uint8_t progress = (100 * mSyncCompletedSize) / mSyncTotalSize; + + wxString str; + str.Printf(wxT("Connected - Downloading data log ... %u%%"), progress); + + SetStatusText(str); + } + else + { + SetStatusText(wxT("Connected")); + } +} + + +void GuiDevice::OnMonitorDataTimerEvent(wxTimerEvent &event) +{ + mPowermon.requestGetMonitorData([this](uint16_t status, const Powermon::MonitorData &data) + { + if (status == Powermon::RSP_SUCCESS) + { + GuiEvent* event = new GuiEvent([this, data](GuiEvent &event) + { + mMonitorData = data; + mMonitorDataValid = true; + mMonitorPanel->Refresh(); + }); + + wxQueueEvent(this, event); + } + }); +} + + +void GuiDevice::deviceUnlock(bool disconnect_on_failure) +{ + GuiEnterString dialog(this, wxID_ANY, wxT("Enter password"), true, false); + dialog.setStringLabel(wxT("Enter password")); + dialog.setMaxStringLength(256); + + dialog.SetFocus(); + if (dialog.ShowModal() == wxID_OK) + { + const Powermon::AuthKey key = Powermon::getAuthKeyFromPassword(dialog.getString().mb_str()); + + mPowermon.requestUnlock(key, [this, disconnect_on_failure](uint16_t status) + { + wxQueueEvent(this, new GuiEvent([this, status, disconnect_on_failure](const GuiEvent &event) + { + if (status == Powermon::RSP_SUCCESS) + { + if (disconnect_on_failure) + startDevice(); + } + else if (status == Powermon::RSP_CANNOT_UNLOCK) + { + wxMessageDialog msg(this, wxT("Invalid password."), wxT("Error"), wxOK | wxSTAY_ON_TOP | wxCENTRE | wxICON_ERROR); + msg.ShowModal(); + + deviceUnlock(disconnect_on_failure); + } + else + { + checkDeviceError(this, status); + } + })); + }); + } + else + { + if (disconnect_on_failure) + mPowermon.disconnect(); + } +} + + +void GuiDevice::OnMonitorPaint(wxPaintEvent &event) +{ + wxBufferedPaintDC dc(mMonitorPanel); + + const int32_t LEFT_BORDER = 2; + const int32_t RIGHT_BORDER = 10; + + const wxSize size = mMonitorPanel->GetSize(); + + //clean background + dc.SetPen(wxPen(mMonitorBackgroundColor, 1)); + dc.SetBrush(wxBrush(mMonitorBackgroundColor)); + dc.DrawRectangle(0, 0, size.x, size.y); + + //set text color + dc.SetTextBackground(mMonitorBackgroundColor); + dc.SetTextForeground(*wxBLACK); + + dc.SetFont(MONITOR_FONT_BOLD); + const int32_t row_height = dc.GetCharHeight(); + + + //draw static text + dc.SetFont(MONITOR_FONT); + + int32_t y = 0; + dc.DrawText(wxT("Voltage 1"), LEFT_BORDER, y); y += row_height; + dc.DrawText(wxT("Voltage 2"), LEFT_BORDER, y); y += row_height; + dc.DrawText(wxT("Current"), LEFT_BORDER, y); y += row_height; + dc.DrawText(wxT("Power"), LEFT_BORDER, y); y += row_height; + dc.DrawText(wxT("Energy Meter"), LEFT_BORDER, y); y += row_height; + dc.DrawText(wxT("Coulomb Meter"), LEFT_BORDER, y); y += row_height; + dc.DrawText(wxT("Battery SoC"), LEFT_BORDER, y); y += row_height; + dc.DrawText(wxT("Battery Runtime"), LEFT_BORDER, y); y += row_height; + dc.DrawText(wxT("Temperature"), LEFT_BORDER, y); y += row_height; + dc.DrawText(wxT("Power Status"), LEFT_BORDER, y); y += row_height; + dc.DrawText(wxT("Device Clock"), LEFT_BORDER, y); y += 2 * row_height; + dc.DrawText(wxT("Device RSSI"), LEFT_BORDER, y); y += row_height; + + //draw values + dc.SetFont(MONITOR_FONT_BOLD); + y = 0; + + const wxString str_na = wxT("n/a"); + + if (mMonitorDataValid) + { + wxString str; + + str.Printf(wxT("%.3f V"), mMonitorData.voltage1); + dc.DrawText(str, size.x - dc.GetTextExtent(str).x - RIGHT_BORDER, y); y += row_height; + + if (!isnan(mMonitorData.voltage2)) + str.Printf(wxT("%.3f V"), mMonitorData.voltage2); + else + str = wxT("n/a"); + dc.DrawText(str, size.x - dc.GetTextExtent(str).x - RIGHT_BORDER, y); y += row_height; + + str.Printf(wxT("%.3f A"), mMonitorData.current); + dc.DrawText(str, size.x - dc.GetTextExtent(str).x - RIGHT_BORDER, y); y += row_height; + + + if (fabs(mMonitorData.power) >= 1000) + str.Printf(wxT("%.3f kW"), mMonitorData.power / 1000.0); + else + str.Printf(wxT("%.2f W"), mMonitorData.power); + + dc.DrawText(str, size.x - dc.GetTextExtent(str).x - RIGHT_BORDER, y); y += row_height; + + + if (fabs(mMonitorData.energy_meter) >= 1000000) + str.Printf(wxT("%.3f kWh"), mMonitorData.energy_meter / 1000000.0); + else + str.Printf(wxT("%.2f Wh"), mMonitorData.energy_meter / 1000.0); + + dc.DrawText(str, size.x - dc.GetTextExtent(str).x - RIGHT_BORDER, y); y += row_height; + + + if (fabs(mMonitorData.coulomb_meter) >= 1000000) + str.Printf(wxT("%.3f Ah"), mMonitorData.coulomb_meter / 1000000.0); + else + str.Printf(wxT("%.3f Ah"), mMonitorData.coulomb_meter / 1000.0); + + dc.DrawText(str, size.x - dc.GetTextExtent(str).x - RIGHT_BORDER, y); y += row_height; + + + if (mMonitorData.fg_soc > 100) + str.Printf(wxT("---")); + else + str.Printf(wxT("%u %%"), mMonitorData.fg_soc); + + dc.DrawText(str, size.x - dc.GetTextExtent(str).x - RIGHT_BORDER, y); y += row_height; + + + if (mMonitorData.fg_runtime > FG_RUNTIME_MAX) + str.Printf(wxT("---")); + else if (mMonitorData.fg_runtime == 0) + str.Printf(wxT("under 1m")); + else if (mMonitorData.fg_runtime > 60 * 24 * 45) + str.Printf(wxT("over 45d")); + else + { + uint32_t minutes = mMonitorData.fg_runtime; + uint32_t days = minutes / (60 * 24); + minutes -= days * 60 * 24; + + uint32_t hours = minutes / 60; + minutes -= hours * 60; + + if (days) + str.Printf(wxT("%ud %uh"), days, hours); + else if (hours) + str.Printf(wxT("%uh %um"), hours, minutes); + else + str.Printf(wxT("%um"), minutes); + } + dc.DrawText(str, size.x - dc.GetTextExtent(str).x - RIGHT_BORDER, y); y += row_height; + + str.Printf(wxT("%.0f \u00B0C"), mMonitorData.temperature); + dc.DrawText(str, size.x - dc.GetTextExtent(str).x - RIGHT_BORDER, y); y += row_height; + + str = wxString(Powermon::getPowerStatusString(mMonitorData.power_status).c_str(), wxConvUTF8); + dc.DrawText(str, size.x - dc.GetTextExtent(str).x - RIGHT_BORDER, y); y += row_height; + + + if (mMonitorData.time) + { + wxDateTime dt; + dt.Set((time_t)mMonitorData.time); + dt.MakeUTC(); + + str = dt.Format(wxT("%I:%M %p")).mb_str(); + dc.DrawText(str, size.x - dc.GetTextExtent(str).x - RIGHT_BORDER, y); y += row_height; + str = dt.Format(wxT("%b %d, %Y")); + dc.DrawText(str, size.x - dc.GetTextExtent(str).x - RIGHT_BORDER, y); y += row_height; + } + else + { + str.Printf(wxT("not set")); + dc.DrawText(str, size.x - dc.GetTextExtent(str).x - RIGHT_BORDER, y); y += 2 * row_height; + } + + if (mMonitorData.rssi != INT16_MIN) + str.Printf(wxT("%d dBm"), mMonitorData.rssi); + else + str.Printf(wxT("n/a")); + dc.DrawText(str, size.x - dc.GetTextExtent(str).x - RIGHT_BORDER, y); y += row_height; + } + else + { + const int32_t x = size.x - dc.GetTextExtent(str_na).x - RIGHT_BORDER; + + dc.DrawText(str_na, x, y); y += row_height; + dc.DrawText(str_na, x, y); y += row_height; + dc.DrawText(str_na, x, y); y += row_height; + dc.DrawText(str_na, x, y); y += row_height; + dc.DrawText(str_na, x, y); y += row_height; + dc.DrawText(str_na, x, y); y += row_height; + dc.DrawText(str_na, x, y); y += row_height; + dc.DrawText(str_na, x, y); y += row_height; + dc.DrawText(str_na, x, y); y += row_height; + dc.DrawText(str_na, x, y); y += row_height; + dc.DrawText(str_na, x, y); y += 2 * row_height; + dc.DrawText(str_na, x, y); y += row_height; + } +} + + +BEGIN_EVENT_TABLE(GuiDevice, wxFrame) +EVT_CLOSE(GuiDevice::OnClose) +GUI_EVT(GuiDevice::OnGuiEvent) + +EVT_ERASE_BACKGROUND(GuiDevice::OnEraseBackGround) + +EVT_MENU(ID_MENU_VIEW_STATS, GuiDevice::OnMenuDeviceViewStats) +EVT_MENU(ID_MENU_VIEW_FG_STATS, GuiDevice::OnMenuDeviceViewFgStats) +EVT_MENU(ID_MENU_DATA_LOG, GuiDevice::OnMenuDeviceDataLog) +EVT_MENU(ID_MENU_SYNC_LOG, GuiDevice::OnMenuDeviceSyncLog) +EVT_MENU(ID_MENU_CLEAR_LOCAL_LOG, GuiDevice::OnMenuDeviceClearLocalLog) +EVT_MENU(ID_MENU_RESET_EM, GuiDevice::OnMenuDeviceResetEM) +EVT_MENU(ID_MENU_RESET_CM, GuiDevice::OnMenuDeviceResetCM) +EVT_MENU(ID_MENU_POWER_CONTROL, GuiDevice::OnMenuDevicePowerControl) +EVT_MENU(ID_MENU_PAIR, GuiDevice::OnMenuDevicePair) +EVT_MENU(wxID_EXIT, GuiDevice::OnMenuDeviceDisconnect) +EVT_MENU(ID_MENU_WIFI_SETUP, GuiDevice::OnMenuSettingsWifiSetup) +EVT_MENU(ID_MENU_TIMERS, GuiDevice::OnMenuDeviceTimers) +EVT_MENU(ID_MENU_RENAME, GuiDevice::OnMenuSettingsRename) +EVT_MENU(ID_MENU_CONFIGURATION, GuiDevice::OnMenuSettingsConfiguration) +EVT_MENU(ID_MENU_UNLOCK, GuiDevice::OnMenuSettingsUnlock) +EVT_MENU(ID_MENU_SET_USER_PASSWORD, GuiDevice::OnMenuSettingsSetUserPassword) +EVT_MENU(ID_MENU_SET_MASTER_PASSWORD, GuiDevice::OnMenuSettingsSetMasterPassword) + + +EVT_MENU(ID_MENU_RESET_FACTORY, GuiDevice::OnMenuSettingsResetFactory) +EVT_MENU(ID_MENU_SET_TIME, GuiDevice::OnMenuSettingsSetTime) +EVT_MENU(ID_MENU_ZERO_OFFSET, GuiDevice::OnMenuSettingsZeroCurrentOffset) +EVT_MENU(ID_MENU_CALIBRATE_CURRENT, GuiDevice::OnMenuSettingsCalibrateCurrent) +EVT_MENU(ID_MENU_FORCE_FG_SYNC, GuiDevice::OnMenuSettingsForceFgSync) +EVT_MENU(wxID_ABOUT, GuiDevice::OnMenuHelpAbout) + +EVT_TIMER(ID_MONITOR_DATA_TIMER, GuiDevice::OnMonitorDataTimerEvent) +EVT_TIMER(ID_SYNC_LOG_TIMER, GuiDevice::OnSyncLogTimerEvent) + +END_EVENT_TABLE() + diff --git a/gui/gui_device.h b/gui/gui_device.h new file mode 100644 index 0000000..0deace8 --- /dev/null +++ b/gui/gui_device.h @@ -0,0 +1,163 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _GUI_DEVICE_H +#define _GUI_DEVICE_H + + +#include + +#include +#include +#include +#include +#include + +#include + + + +class GuiDevice: public wxFrame +{ +public: + GuiDevice(wxWindow* parent, const Powermon::DeviceIdentifier &id, PowermonScanner* scanner); + ~GuiDevice(); + +private: + enum + { + ID_MONITOR_DATA_TIMER = wxID_HIGHEST + 1, + ID_SYNC_LOG_TIMER, + + ID_MENU_SYNC_LOG, + ID_MENU_CLEAR_LOCAL_LOG, + + ID_MENU_PAIR, + + ID_MENU_CONFIGURATION, + ID_MENU_WIFI_SETUP, + ID_MENU_RESET_FACTORY, + + ID_MENU_UNLOCK, + ID_MENU_SET_USER_PASSWORD, + ID_MENU_SET_MASTER_PASSWORD, + ID_MENU_RENAME, + ID_MENU_SET_TIME, + + ID_MENU_ZERO_OFFSET, + ID_MENU_CALIBRATE_CURRENT, + + ID_MENU_RESET_EM, + ID_MENU_RESET_CM, + ID_MENU_VIEW_STATS, + ID_MENU_VIEW_FG_STATS, + ID_MENU_FORCE_FG_SYNC, + + ID_MENU_POWER_CONTROL, + + ID_MENU_DATA_LOG, + ID_MENU_TIMERS, + }; + + Powermon &mPowermon; + + wxColour mMonitorBackgroundColor; + wxMenuBar* mMenuBar; + wxMenu* mDeviceMenu; + wxMenu* mSettingsMenu; + + GuiChart* mChart; + + wxTimer* mMonitorDataTimer; + wxTimer* mSyncLogTimer; + + Powermon::MonitorData mMonitorData; + bool mMonitorDataValid; + wxPanel* mMonitorPanel; + + bool mSyncEnabled; + volatile bool mSyncInProgress; + + size_t mSyncTotalSize; + size_t mSyncCompletedSize; + size_t mFileSize; + wxFile mLogFile; + + std::vector mLogFiles; + + GuiStats* mStatsDialog; + GuiFgStats* mFgStatsDialog; + + void enableMenus(bool state); + void startSync(void); + void stopSync(void); + + void updateTitle(void); + void updateStatusBar(void); + + void deviceUnlock(bool disconnect_on_failure); + void startDevice(void); + + void readFile(void); + void readFileBlock(void); + + void OnMenuDeviceViewStats(wxCommandEvent &event); + void OnMenuDeviceViewFgStats(wxCommandEvent &event); + + void OnMenuSettingsZeroCurrentOffset(wxCommandEvent &event); + void OnMenuSettingsCalibrateCurrent(wxCommandEvent &event); + + void OnMenuDeviceResetEM(wxCommandEvent &event); + void OnMenuDeviceResetCM(wxCommandEvent &event); + + void OnMenuSettingsUnlock(wxCommandEvent &event); + void OnMenuSettingsSetUserPassword(wxCommandEvent &event); + void OnMenuSettingsSetMasterPassword(wxCommandEvent &event); + + void OnMenuDevicePowerControl(wxCommandEvent &event); + + void OnMenuDeviceSyncLog(wxCommandEvent &event); + void OnMenuDeviceDataLog(wxCommandEvent &event); + void OnMenuDeviceClearLocalLog(wxCommandEvent &event); + + void OnMenuDevicePair(wxCommandEvent &event); + void OnMenuDeviceDisconnect(wxCommandEvent &event); + + void OnMenuDeviceTimers(wxCommandEvent &event); + void OnMenuSettingsConfiguration(wxCommandEvent &event); + void OnMenuSettingsWifiSetup(wxCommandEvent &event); + void OnMenuSettingsResetFactory(wxCommandEvent &event); + void OnMenuSettingsSetTime(wxCommandEvent &event); + void OnMenuSettingsRename(wxCommandEvent &event); + void OnMenuSettingsForceFgSync(wxCommandEvent &event); + + void OnMenuHelpAbout(wxCommandEvent &event); + + void OnClose(wxCloseEvent &event); + + void OnGuiEvent(GuiEvent &event); + + void OnMonitorDataTimerEvent(wxTimerEvent &event); + void OnSyncLogTimerEvent(wxTimerEvent &event); + + void OnMonitorPaint(wxPaintEvent &event); + void OnEraseBackGround(wxEraseEvent& event){} + + DECLARE_EVENT_TABLE() +}; + +#endif diff --git a/gui/gui_device_config.cpp b/gui/gui_device_config.cpp new file mode 100644 index 0000000..6f1e21a --- /dev/null +++ b/gui/gui_device_config.cpp @@ -0,0 +1,1391 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + + +typedef struct +{ + uint16_t current_nom; + uint8_t vdrop_nom; + bool integrated; +}shunt_descriptor_t; + + +static const shunt_descriptor_t l_shunts[] = +{ + {.current_nom = 60, .vdrop_nom = 30, .integrated = true}, + + {.current_nom = 75, .vdrop_nom = 50, .integrated = false}, + + {.current_nom = 100, .vdrop_nom = 50, .integrated = false}, + {.current_nom = 100, .vdrop_nom = 75, .integrated = false}, + {.current_nom = 100, .vdrop_nom = 100, .integrated = false}, + + {.current_nom = 150, .vdrop_nom = 50, .integrated = false}, + {.current_nom = 150, .vdrop_nom = 75, .integrated = false}, + {.current_nom = 150, .vdrop_nom = 100, .integrated = false}, + + {.current_nom = 200, .vdrop_nom = 50, .integrated = false}, + {.current_nom = 200, .vdrop_nom = 75, .integrated = false}, + {.current_nom = 200, .vdrop_nom = 100, .integrated = false}, + + {.current_nom = 250, .vdrop_nom = 50, .integrated = false}, + {.current_nom = 250, .vdrop_nom = 75, .integrated = false}, + {.current_nom = 250, .vdrop_nom = 100, .integrated = false}, + + {.current_nom = 300, .vdrop_nom = 50, .integrated = false}, + {.current_nom = 300, .vdrop_nom = 75, .integrated = false}, + {.current_nom = 300, .vdrop_nom = 100, .integrated = false}, + + {.current_nom = 400, .vdrop_nom = 50, .integrated = false}, + {.current_nom = 400, .vdrop_nom = 75, .integrated = false}, + {.current_nom = 400, .vdrop_nom = 100, .integrated = false}, + + {.current_nom = 500, .vdrop_nom = 50, .integrated = false}, + {.current_nom = 500, .vdrop_nom = 75, .integrated = false}, + {.current_nom = 500, .vdrop_nom = 100, .integrated = false}, + + {.current_nom = 1000, .vdrop_nom = 50, .integrated = false}, + {.current_nom = 1000, .vdrop_nom = 75, .integrated = false}, + {.current_nom = 1000, .vdrop_nom = 100, .integrated = false}, +}; + + +GuiDeviceConfig::GuiDeviceConfig(wxWindow *parent, wxWindowID id, const PowermonConfig &config, const Powermon &powermon): wxDialog(parent, id, wxT("PowerMon Configuration"), wxDefaultPosition, wxDefaultSize), mConfig(config), mPowermon(powermon) +{ + const size_t BORDER_SIZE = FromDIP(6); + const size_t GAP_SIZE = FromDIP(3); + const wxSize CTRL_SIZE = FromDIP(wxSize(240, 30)); + const wxSize SIZER_SIZE = FromDIP(wxSize(280, 0)); + + wxBoxSizer* v_sizer; + wxBoxSizer* h_sizer; + wxBoxSizer* main_v_sizer; + + //main window sizer + wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL); + SetSizer(main_sizer); + + + mListBook = new wxListbook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLB_LEFT); + main_sizer->Add(mListBook, 1, wxALL | wxEXPAND, BORDER_SIZE); + + + wxPanel* panel = new wxPanel(mListBook, wxID_ANY, wxDefaultPosition, wxDefaultSize); + mListBook->AddPage(panel, wxT("General")); + main_v_sizer = new wxBoxSizer(wxVERTICAL); + + + if (Powermon::hasWifi(mPowermon.getLastDeviceInfo().hardware_revision_bcd)) + { + mWifiKeepApOnCheckBox = new wxCheckBox(panel, wxID_ANY, wxT("Keep Access Point ON"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mWifiKeepApOnCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + } + + + if (Powermon::hasConfigurableShunt(mPowermon.getLastDeviceInfo().hardware_revision_bcd)) + { + mShuntChoice = new wxChoice(panel, ID_CHOICE_SHUNT, wxDefaultPosition, CTRL_SIZE); + for(uint32_t i = 0; i < sizeof(l_shunts) / sizeof(shunt_descriptor_t); i++) + mShuntChoice->Append(wxString::Format(wxT("%u A / %u mV%s"), l_shunts[i].current_nom, l_shunts[i].vdrop_nom, l_shunts[i].integrated ? " (integrated)" : "")); + + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Shunt Specifications"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mShuntChoice, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL, BORDER_SIZE); + } + + + mMaxShuntCurrentText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Max. Shunt Current (Amperes)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mMaxShuntCurrentText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL, BORDER_SIZE); + + + if (Powermon::hasConfigurableShunt(mPowermon.getLastDeviceInfo().hardware_revision_bcd)) + { + mAdcFlipCurrentSignCheckBox = new wxCheckBox(panel, wxID_ANY, wxT("Flip Current Sign"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mAdcFlipCurrentSignCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + } + + + mAdcDisableV2CheckBox = new wxCheckBox(panel, ID_CHECKBOX_DISABLE_V2, wxT("Disable Voltage 2"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mAdcDisableV2CheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mMeterVoltageSourceCheckBox = new wxCheckBox(panel, wxID_ANY, wxT("Use Voltage 2 for Power"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mMeterVoltageSourceCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcInitialStateCheckBox = new wxCheckBox(panel, wxID_ANY, wxT("Turn On at startup"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mOcInitialStateCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcLatchRelayOnCheckBox = new wxCheckBox(panel, wxID_ANY, wxT("Latch Relay On"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mOcLatchRelayOnCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcInvertOutputCheckBox = new wxCheckBox(panel, wxID_ANY, wxT("Invert Relay Logic"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mOcInvertOutputCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcConnectFilterText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Connect Filter (milliseconds)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcConnectFilterText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mMfTerminalFunctionChoice = new wxChoice(panel, wxID_ANY, wxDefaultPosition, CTRL_SIZE); + mMfTerminalFunctionChoice->Append(wxT("Data Stream Ouput")); + mMfTerminalFunctionChoice->Append(wxT("Temperature Sensor")); + mMfTerminalFunctionChoice->Append(wxT("Push Button Input")); + mMfTerminalFunctionChoice->Append(wxT("Communication")); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("MF Terminal Function"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mMfTerminalFunctionChoice, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + + mLoggingModeChoice = new wxChoice(panel, wxID_ANY, wxDefaultPosition, CTRL_SIZE); + mLoggingModeChoice->Append(wxT("Disabled")); + mLoggingModeChoice->Append(wxT("Every second")); + mLoggingModeChoice->Append(wxT("Every 2 seconds")); + mLoggingModeChoice->Append(wxT("Every 5 seconds")); + mLoggingModeChoice->Append(wxT("Every 10 seconds")); + mLoggingModeChoice->Append(wxT("Every 20 seconds")); + mLoggingModeChoice->Append(wxT("Every 30 seconds")); + mLoggingModeChoice->Append(wxT("Every 60 seconds")); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Data Logging Mode"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mLoggingModeChoice, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + main_v_sizer->SetMinSize(SIZER_SIZE); + panel->SetSizer(main_v_sizer); + + + + panel = new wxPanel(mListBook, wxID_ANY, wxDefaultPosition, wxDefaultSize); + mListBook->AddPage(panel, wxT("Low Voltage Disconnect")); + main_v_sizer = new wxBoxSizer(wxVERTICAL); + + mOcLvdEnableCheckBox = new wxCheckBox(panel, ID_CHECKBOX_ENABLE_FEATURE, wxT("LVD Enable"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mOcLvdEnableCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcLvdVoltageSourceCheckBox = new wxCheckBox(panel, wxID_ANY, wxT("Use Voltage 2"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mOcLvdVoltageSourceCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcLvdDisconnectThresholdText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("LVD Disconnect Threshold (V)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcLvdDisconnectThresholdText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcLvdConnectThresholdText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("LVD Connect Threshold (V)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcLvdConnectThresholdText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcLvdDisconnectFilterText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("LVD Disconnect Filter (milliseconds)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcLvdDisconnectFilterText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + main_v_sizer->SetMinSize(SIZER_SIZE); + panel->SetSizer(main_v_sizer); + + + + panel = new wxPanel(mListBook, wxID_ANY, wxDefaultPosition, wxDefaultSize); + mListBook->AddPage(panel, wxT("High Voltage Disconnect")); + main_v_sizer = new wxBoxSizer(wxVERTICAL); + + mOcHvdEnableCheckBox = new wxCheckBox(panel, ID_CHECKBOX_ENABLE_FEATURE, wxT("HVD Enable"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mOcHvdEnableCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcHvdVoltageSourceCheckBox = new wxCheckBox(panel, wxID_ANY, wxT("Use Voltage 2"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mOcHvdVoltageSourceCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcHvdDisconnectThresholdText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("HVD Disconnect Threshold (V)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcHvdDisconnectThresholdText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcHvdConnectThresholdText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("HVD Connect Threshold (V)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcHvdConnectThresholdText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcHvdDisconnectFilterText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("HVD Disconnect Filter (milliseconds)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcHvdDisconnectFilterText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + main_v_sizer->SetMinSize(SIZER_SIZE); + panel->SetSizer(main_v_sizer); + + + + panel = new wxPanel(mListBook, wxID_ANY, wxDefaultPosition, wxDefaultSize); + mListBook->AddPage(panel, wxT("Over-current Disconnect")); + main_v_sizer = new wxBoxSizer(wxVERTICAL); + + mOcOcdEnableCheckBox = new wxCheckBox(panel, ID_CHECKBOX_ENABLE_FEATURE, wxT("OCD Enable"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mOcOcdEnableCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcOcdTripThresholdText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("OCD Trip Threshold (A)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcOcdTripThresholdText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcOcdTripFilterText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("OCD Trip Filter (milliseconds)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcOcdTripFilterText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + main_v_sizer->SetMinSize(SIZER_SIZE); + panel->SetSizer(main_v_sizer); + + + panel = new wxPanel(mListBook, wxID_ANY, wxDefaultPosition, wxDefaultSize); + mListBook->AddPage(panel, wxT("Auto-OFF / Auto-ON Timer")); + main_v_sizer = new wxBoxSizer(wxVERTICAL); + + + mOcAutoOffEnableCheckBox = new wxCheckBox(panel, ID_CHECKBOX_ENABLE_FEATURE, wxT("Auto-OFF Timer Enable"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mOcAutoOffEnableCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcAutoOffHoursText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Hours"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcAutoOffHoursText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcAutoOffMinutesText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Minutes"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcAutoOffMinutesText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcAutoOffSecondsText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Seconds"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcAutoOffSecondsText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + + + mOcAutoOnEnableCheckBox = new wxCheckBox(panel, ID_CHECKBOX_ENABLE_FEATURE, wxT("Auto-ON Timer Enable"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mOcAutoOnEnableCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcAutoOnHoursText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Hours"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcAutoOnHoursText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcAutoOnMinutesText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Minutes"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcAutoOnMinutesText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcAutoOnSecondsText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Seconds"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcAutoOnSecondsText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + + main_v_sizer->SetMinSize(SIZER_SIZE); + panel->SetSizer(main_v_sizer); + + + + panel = new wxPanel(mListBook, wxID_ANY, wxDefaultPosition, wxDefaultSize); + mListBook->AddPage(panel, wxT("Low Temperature Disconnect")); + main_v_sizer = new wxBoxSizer(wxVERTICAL); + + mOcLtdEnableCheckBox = new wxCheckBox(panel, ID_CHECKBOX_ENABLE_FEATURE, wxT("LTD Enable"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mOcLtdEnableCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcLtdDisconnectThresholdText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("LTD Disconnect Threshold (V)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcLtdDisconnectThresholdText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcLtdConnectThresholdText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("LTD Connect Threshold (V)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcLtdConnectThresholdText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcLtdDisconnectFilterText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("LTD Disconnect Filter (milliseconds)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcLtdDisconnectFilterText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + main_v_sizer->SetMinSize(SIZER_SIZE); + panel->SetSizer(main_v_sizer); + + + panel = new wxPanel(mListBook, wxID_ANY, wxDefaultPosition, wxDefaultSize); + mListBook->AddPage(panel, wxT("High Temperature Disconnect")); + main_v_sizer = new wxBoxSizer(wxVERTICAL); + + mOcHtdEnableCheckBox = new wxCheckBox(panel, ID_CHECKBOX_ENABLE_FEATURE, wxT("HTD Enable"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mOcHtdEnableCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcHtdDisconnectThresholdText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("HTD Disconnect Threshold (V)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcHtdDisconnectThresholdText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcHtdConnectThresholdText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("HTD Connect Threshold (V)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcHtdConnectThresholdText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcHtdDisconnectFilterText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("HTD Disconnect Filter (milliseconds)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcHtdDisconnectFilterText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + main_v_sizer->SetMinSize(SIZER_SIZE); + panel->SetSizer(main_v_sizer); + + + panel = new wxPanel(mListBook, wxID_ANY, wxDefaultPosition, wxDefaultSize); + mListBook->AddPage(panel, wxT("Battery Fuel Gauge")); + main_v_sizer = new wxBoxSizer(wxVERTICAL); + + mFgEnableCheckBox = new wxCheckBox(panel, wxID_ANY, wxT("FG Enable"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mFgEnableCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mFgVoltageSourceCheckBox = new wxCheckBox(panel, wxID_ANY, wxT("Use Voltage 2"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mFgVoltageSourceCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mFgChemistryChoice = new wxChoice(panel, ID_CHOICE_FG_CHEMISTRY, wxDefaultPosition, CTRL_SIZE); + mFgChemistryChoice->Append(wxT("Lead Acid - Flooded")); + mFgChemistryChoice->Append(wxT("Lead Acid - AGM")); + mFgChemistryChoice->Append(wxT("Lithium Iron Phosphate")); + mFgChemistryChoice->Append(wxT("Lithium Ion")); + mFgChemistryChoice->Append(wxT("Lithium Polymer")); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Battery Chemistry"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mFgChemistryChoice, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mFgBatteryVoltageChoice = new wxChoice(panel, ID_CHOICE_FG_VOLTAGE, wxDefaultPosition, CTRL_SIZE); + mFgBatteryVoltageChoice->Append(wxT("6 Volts")); + mFgBatteryVoltageChoice->Append(wxT("12 Volts")); + mFgBatteryVoltageChoice->Append(wxT("24 Volts")); + mFgBatteryVoltageChoice->Append(wxT("36 Volts")); + mFgBatteryVoltageChoice->Append(wxT("48 Volts")); + mFgBatteryVoltageChoice->Append(wxT("Custom")); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Battery Voltage"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mFgBatteryVoltageChoice, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mFgCellCountText = new wxTextCtrl(panel, ID_TEXT_FG_CELLS, wxT(""), wxDefaultPosition, CTRL_SIZE); + mFgCellCountSizer = new wxBoxSizer(wxVERTICAL); + mFgCellCountSizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Battery Cell Count"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + mFgCellCountSizer->Add(mFgCellCountText, 0, wxALL, 0); + main_v_sizer->Add(mFgCellCountSizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mFgCapacityText = new wxTextCtrl(panel, ID_TEXT_FG_CAPACITY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Battery Capacity (Ah)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mFgCapacityText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mFgManualSyncCheckBox = new wxCheckBox(panel, ID_CHECK_MANUAL_DETECTION, wxT("Manual Full Charge Detection"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mFgManualSyncCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + + mFgSyncManualSizer = new wxBoxSizer(wxVERTICAL); + + mFgSyncVoltageThresholdText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Full Charge Detection Voltage Threshold (V)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mFgSyncVoltageThresholdText, 0, wxALL, 0); + mFgSyncManualSizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mFgSyncCurrentThresholdText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Full Charge Detection Current Threshold (A)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mFgSyncCurrentThresholdText, 0, wxALL, 0); + mFgSyncManualSizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mFgSyncFilterText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Full Charge Detection Filter (seconds)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mFgSyncFilterText, 0, wxALL, 0); + mFgSyncManualSizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + main_v_sizer->Add(mFgSyncManualSizer, 0, wxALL | wxALIGN_LEFT, 0); + + + + mOcFgDisconnectEnableCheckBox = new wxCheckBox(panel, ID_CHECKBOX_ENABLE_FEATURE, wxT("Disconnect on Battery SoC"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mOcFgDisconnectEnableCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcFgDisconnectThresholdText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Disconnect On Battery SoC Threshold (%)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcFgDisconnectThresholdText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcFgConnectEnableCheckBox = new wxCheckBox(panel, ID_CHECKBOX_ENABLE_FEATURE, wxT("Re-connect on Battery SoC"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mOcFgConnectEnableCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcFgConnectThresholdText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Re-connect On Battery SoC Threshold (%)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcFgConnectThresholdText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + main_v_sizer->SetMinSize(SIZER_SIZE); + panel->SetSizer(main_v_sizer); + + + + panel = new wxPanel(mListBook, wxID_ANY, wxDefaultPosition, wxDefaultSize); + mListBook->AddPage(panel, wxT("Generator Control")); + main_v_sizer = new wxBoxSizer(wxVERTICAL); + + + mOcGenEnableCheckBox = new wxCheckBox(panel, ID_CHECKBOX_ENABLE_GENERATOR, wxT("Generator Control Enable"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mOcGenEnableCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcGenVoltageSourceCheckBox = new wxCheckBox(panel, wxID_ANY, wxT("Use Voltage 2"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mOcGenVoltageSourceCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcGenVonEnableCheckBox = new wxCheckBox(panel, ID_CHECK_VON_GENERATOR, wxT("Turn On Based on Voltage"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mOcGenVonEnableCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcGenVonSizer = new wxBoxSizer(wxVERTICAL); + + mOcGenVonThresholdText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Turn On Voltage Threshold (V)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcGenVonThresholdText, 0, wxALL, 0); + mOcGenVonSizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcGenVonFilterText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Turn On Voltage Filter (milliseconds)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcGenVonFilterText, 0, wxALL, 0); + mOcGenVonSizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + main_v_sizer->Add(mOcGenVonSizer, 0, wxALL | wxALIGN_LEFT, 0); + + + mOcGenSoconEnableCheckBox = new wxCheckBox(panel, ID_CHECK_VON_GENERATOR, wxT("Turn On Based on SoC"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mOcGenSoconEnableCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcGenSoconThresholdText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + mOcGenSoconSizer = new wxBoxSizer(wxVERTICAL); + mOcGenSoconSizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Turn On SoC Threshold (%)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + mOcGenSoconSizer->Add(mOcGenSoconThresholdText, 0, wxALL, 0); + main_v_sizer->Add(mOcGenSoconSizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcGenVoffEnableCheckBox = new wxCheckBox(panel, ID_CHECK_VON_GENERATOR, wxT("Turn Off Based on Voltage"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mOcGenVoffEnableCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcGenVoffThresholdText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + mOcGenVoffSizer = new wxBoxSizer(wxVERTICAL); + mOcGenVoffSizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Turn Off Voltage Threshold (V)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + mOcGenVoffSizer->Add(mOcGenVoffThresholdText, 0, wxALL, 0); + main_v_sizer->Add(mOcGenVoffSizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcGenSocoffEnableCheckBox = new wxCheckBox(panel, ID_CHECK_VON_GENERATOR, wxT("Turn Off Based on SoC"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mOcGenSocoffEnableCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcGenSocoffThresholdText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + mOcGenSocoffSizer = new wxBoxSizer(wxVERTICAL); + mOcGenSocoffSizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Turn Off SoC Threshold (%)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + mOcGenSocoffSizer->Add(mOcGenSocoffThresholdText, 0, wxALL, 0); + main_v_sizer->Add(mOcGenSocoffSizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcGenTurnOffDelayText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Turn Off Delay (minutes)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcGenTurnOffDelayText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + main_v_sizer->SetMinSize(SIZER_SIZE); + panel->SetSizer(main_v_sizer); + + + if (Powermon::hasVoltage2(mPowermon.getLastDeviceInfo().hardware_revision_bcd)) + { + panel = new wxPanel(mListBook, wxID_ANY, wxDefaultPosition, wxDefaultSize); + mListBook->AddPage(panel, wxT("LiFePO Charge Manager")); + main_v_sizer = new wxBoxSizer(wxVERTICAL); + + mOcLiFePOEnableCheckBox = new wxCheckBox(panel, ID_CHECKBOX_ENABLE_LIFEPO_CM, wxT("LiFePO Charge Manager Enable"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + main_v_sizer->Add(mOcLiFePOEnableCheckBox, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcLiFePOBatteryVoltageChoice = new wxChoice(panel, ID_CHOICE_LIFEPO_CM_VOLTAGE, wxDefaultPosition, CTRL_SIZE); + mOcLiFePOBatteryVoltageChoice->Append(wxT("6 Volts")); + mOcLiFePOBatteryVoltageChoice->Append(wxT("12 Volts")); + mOcLiFePOBatteryVoltageChoice->Append(wxT("24 Volts")); + mOcLiFePOBatteryVoltageChoice->Append(wxT("36 Volts")); + mOcLiFePOBatteryVoltageChoice->Append(wxT("48 Volts")); + mOcLiFePOBatteryVoltageChoice->Append(wxT("Custom")); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Battery Voltage"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcLiFePOBatteryVoltageChoice, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcLiFePOCellCountText = new wxTextCtrl(panel, ID_CHOICE_LIFEPO_CM_CELLS, wxT(""), wxDefaultPosition, CTRL_SIZE); + mOcLiFePOCellCountSizer = new wxBoxSizer(wxVERTICAL); + mOcLiFePOCellCountSizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Battery Cell Count"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + mOcLiFePOCellCountSizer->Add(mOcLiFePOCellCountText, 0, wxALL, 0); + main_v_sizer->Add(mOcLiFePOCellCountSizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + mOcLiFePOBatteryCapacityText = new wxTextCtrl(panel, wxID_ANY, wxT(""), wxDefaultPosition, CTRL_SIZE); + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Battery Capacity (Ah)"), wxDefaultPosition, wxDefaultSize), 0, wxBOTTOM | wxALIGN_LEFT, GAP_SIZE); + v_sizer->Add(mOcLiFePOBatteryCapacityText, 0, wxALL, 0); + main_v_sizer->Add(v_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + main_v_sizer->SetMinSize(SIZER_SIZE); + panel->SetSizer(main_v_sizer); + } + + + //add buttons + h_sizer = new wxBoxSizer(wxHORIZONTAL); + + mCancelButton = new wxButton(this, wxID_CANCEL, wxT("Cancel"), wxDefaultPosition, FromDIP(wxSize(160, 40))); + + h_sizer->AddStretchSpacer(1); + h_sizer->Add(mCancelButton, 0, wxALL | wxEXPAND, BORDER_SIZE); + h_sizer->AddStretchSpacer(1); + + mSaveButton = new wxButton(this, wxID_OK, wxT("Save Configuration"), wxDefaultPosition, FromDIP(wxSize(160, 40))); + h_sizer->Add(mSaveButton, 0, wxALL | wxEXPAND, BORDER_SIZE); + h_sizer->AddStretchSpacer(1); + + main_sizer->Add(h_sizer, 0, wxALL | wxEXPAND, BORDER_SIZE); + + main_sizer->SetSizeHints(this); + + + if (Powermon::hasWifi(mPowermon.getLastDeviceInfo().hardware_revision_bcd)) + mWifiKeepApOnCheckBox->SetValue(mConfig.getWiFiKeepAPOn()); + + if (Powermon::hasConfigurableShunt(mPowermon.getLastDeviceInfo().hardware_revision_bcd)) + { + mShuntChoice->SetSelection(-1); + + const uint16_t current_nom = mConfig.getEngineShuntCurrentNom(); + const uint8_t vdrop_nom = mConfig.getEngineShuntVdropNom(); + + for(uint32_t i = 0; i < sizeof(l_shunts) / sizeof(shunt_descriptor_t); i++) + { + if ((l_shunts[i].current_nom == current_nom) && (l_shunts[i].vdrop_nom == vdrop_nom)) + { + mShuntChoice->SetSelection(i); + break; + } + } + + mAdcFlipCurrentSignCheckBox->SetValue(mConfig.getEngineCurrentSignFlip()); + } + + mMaxShuntCurrentText->SetValue(wxString::Format(wxT("%u"), mConfig.getEngineShuntCurrentMax())); + + + if (Powermon::hasVoltage2(mPowermon.getLastDeviceInfo().hardware_revision_bcd)) + { + mAdcDisableV2CheckBox->SetValue(mConfig.getEngineDisableV2()); + + mMeterVoltageSourceCheckBox->SetValue(mConfig.getEngineMeterVoltageSource()); + mOcLvdVoltageSourceCheckBox->SetValue(mConfig.getOcLvdSource()); + mOcHvdVoltageSourceCheckBox->SetValue(mConfig.getOcHvdSource()); + mFgVoltageSourceCheckBox->SetValue(mConfig.getFgVoltageSource()); + mOcGenVoltageSourceCheckBox->SetValue(mConfig.getOcGenVonEnable() && mConfig.getOcGenVoltageSource()); + + mOcLiFePOEnableCheckBox->SetValue(mConfig.getOcLiFePOEnable()); + mOcLiFePOCellCountText->SetValue(wxString::Format(wxT("%u"), mConfig.getOcLiFePOCellCount())); + switch(mConfig.getOcLiFePOCellCount()) + { + case 2: mOcLiFePOBatteryVoltageChoice->SetSelection(0); break; + case 4: mOcLiFePOBatteryVoltageChoice->SetSelection(1); break; + case 8: mOcLiFePOBatteryVoltageChoice->SetSelection(2); break; + case 12: mOcLiFePOBatteryVoltageChoice->SetSelection(3); break; + case 16: mOcLiFePOBatteryVoltageChoice->SetSelection(4); break; + default: mOcLiFePOBatteryVoltageChoice->SetSelection(5); break; + } + + mOcLiFePOCellCountSizer->ShowItems(mOcLiFePOBatteryVoltageChoice->GetSelection() == 5); + mOcLiFePOBatteryCapacityText->SetValue(wxString::Format(wxT("%.1f"), mConfig.getOcLiFePODesignCapacity())); + + if (mAdcDisableV2CheckBox->GetValue()) + { + mMeterVoltageSourceCheckBox->Hide(); + mOcLvdVoltageSourceCheckBox->Hide(); + mOcHvdVoltageSourceCheckBox->Hide(); + mFgVoltageSourceCheckBox->Hide(); + mOcGenVoltageSourceCheckBox->Hide(); + } + } + else + { + mAdcDisableV2CheckBox->SetValue(true); + mAdcDisableV2CheckBox->Hide(); + + mMeterVoltageSourceCheckBox->Hide(); + mOcLvdVoltageSourceCheckBox->Hide(); + mOcHvdVoltageSourceCheckBox->Hide(); + mFgVoltageSourceCheckBox->Hide(); + mOcGenVoltageSourceCheckBox->Hide(); + } + + + mOcInitialStateCheckBox->SetValue(mConfig.getOcInitialState()); + mOcLatchRelayOnCheckBox->SetValue(mConfig.getOcLatchRelayOn()); + mOcInvertOutputCheckBox->SetValue(mConfig.getOcInvertOutput()); + + mOcConnectFilterText->SetValue(wxString::Format(wxT("%u"), mConfig.getOcConnectFilter())); + + mMfTerminalFunctionChoice->SetSelection(mConfig.getMfMode()); + mLoggingModeChoice->SetSelection(mConfig.getLogMode()); + + + mOcLvdEnableCheckBox->SetValue(mConfig.getOcLvdEnable()); + mOcLvdDisconnectThresholdText->SetValue(wxString::Format(wxT("%.3f"), mConfig.getOcLvdDisconnectThreshold())); + mOcLvdConnectThresholdText->SetValue(wxString::Format(wxT("%.3f"), mConfig.getOcLvdConnectThreshold())); + mOcLvdDisconnectFilterText->SetValue(wxString::Format(wxT("%u"), mConfig.getOcLvdDisconnectFilter())); + + mOcOcdEnableCheckBox->SetValue(mConfig.getOcOcdEnable()); + mOcOcdTripThresholdText->SetValue(wxString::Format(wxT("%.3f"), mConfig.getOcOcdTripThreshold())); + mOcOcdTripFilterText->SetValue(wxString::Format(wxT("%u"), mConfig.getOcOcdTripFilter())); + + mOcHvdEnableCheckBox->SetValue(mConfig.getOcHvdEnable()); + mOcHvdDisconnectThresholdText->SetValue(wxString::Format(wxT("%.3f"), mConfig.getOcHvdDisconnectThreshold())); + mOcHvdConnectThresholdText->SetValue(wxString::Format(wxT("%.3f"), mConfig.getOcHvdConnectThreshold())); + mOcHvdDisconnectFilterText->SetValue(wxString::Format(wxT("%u"), mConfig.getOcHvdDisconnectFilter())); + + + mOcAutoOffEnableCheckBox->SetValue(mConfig.getOcAutoOffTimer() != 0); + if (mConfig.getOcAutoOffTimer()) + { + uint32_t seconds = mConfig.getOcAutoOffTimer(); + uint32_t hours = seconds / 3600; + seconds -= hours * 3600; + uint32_t minutes = seconds / 60; + seconds -= minutes * 60; + + mOcAutoOffHoursText->SetValue(wxString::Format(wxT("%u"), hours)); + mOcAutoOffMinutesText->SetValue(wxString::Format(wxT("%u"), minutes)); + mOcAutoOffSecondsText->SetValue(wxString::Format(wxT("%u"), seconds)); + } + else + { + mOcAutoOffHoursText->SetValue(wxT("0")); + mOcAutoOffMinutesText->SetValue(wxT("0")); + mOcAutoOffSecondsText->SetValue(wxT("0")); + } + + mOcAutoOnEnableCheckBox->SetValue(mConfig.getOcAutoOnTimer() != 0); + if (mConfig.getOcAutoOnTimer()) + { + uint32_t seconds = mConfig.getOcAutoOnTimer(); + uint32_t hours = seconds / 3600; + seconds -= hours * 3600; + uint32_t minutes = seconds / 60; + seconds -= minutes * 60; + + mOcAutoOnHoursText->SetValue(wxString::Format(wxT("%u"), hours)); + mOcAutoOnMinutesText->SetValue(wxString::Format(wxT("%u"), minutes)); + mOcAutoOnSecondsText->SetValue(wxString::Format(wxT("%u"), seconds)); + } + else + { + mOcAutoOnHoursText->SetValue(wxT("0")); + mOcAutoOnMinutesText->SetValue(wxT("0")); + mOcAutoOnSecondsText->SetValue(wxT("0")); + } + + mOcLtdEnableCheckBox->SetValue(mConfig.getOcLtdEnable()); + mOcLtdDisconnectThresholdText->SetValue(wxString::Format(wxT("%d"), mConfig.getOcLtdDisconnectThreshold())); + mOcLtdConnectThresholdText->SetValue(wxString::Format(wxT("%d"), mConfig.getOcLtdConnectThreshold())); + mOcLtdDisconnectFilterText->SetValue(wxString::Format(wxT("%u"), mConfig.getOcLtdDisconnectFilter())); + + mOcHtdEnableCheckBox->SetValue(mConfig.getOcHtdEnable()); + mOcHtdDisconnectThresholdText->SetValue(wxString::Format(wxT("%d"), mConfig.getOcHtdDisconnectThreshold())); + mOcHtdConnectThresholdText->SetValue(wxString::Format(wxT("%d"), mConfig.getOcHtdConnectThreshold())); + mOcHtdDisconnectFilterText->SetValue(wxString::Format(wxT("%u"), mConfig.getOcHtdDisconnectFilter())); + + mFgEnableCheckBox->SetValue(mConfig.getFgEnable()); + mFgChemistryChoice->SetSelection(mConfig.getFgChemistry()); + mFgCellCountText->SetValue(wxString::Format(wxT("%u"), mConfig.getFgCellCount())); + + switch(mFgChemistryChoice->GetSelection()) + { + case 0: + case 1: + switch(mConfig.getFgCellCount()) + { + case 3: mFgBatteryVoltageChoice->SetSelection(0); break; + case 6: mFgBatteryVoltageChoice->SetSelection(1); break; + case 12: mFgBatteryVoltageChoice->SetSelection(2); break; + case 18: mFgBatteryVoltageChoice->SetSelection(3); break; + case 24: mFgBatteryVoltageChoice->SetSelection(4); break; + default: mFgBatteryVoltageChoice->SetSelection(5); break; + } + break; + + + case 2: + case 3: + case 4: + switch(mConfig.getFgCellCount()) + { + case 2: mFgBatteryVoltageChoice->SetSelection(0); break; + case 4: mFgBatteryVoltageChoice->SetSelection(1); break; + case 8: mFgBatteryVoltageChoice->SetSelection(2); break; + case 12: mFgBatteryVoltageChoice->SetSelection(3); break; + case 16: mFgBatteryVoltageChoice->SetSelection(4); break; + default: mFgBatteryVoltageChoice->SetSelection(5); break; + } + break; + } + + mFgCellCountSizer->ShowItems(mFgBatteryVoltageChoice->GetSelection() == 5); + + mFgCapacityText->SetValue(wxString::Format(wxT("%.1f"), mConfig.getFgDesignCapacity())); + + mFgManualSyncCheckBox->SetValue(mConfig.getFgManualChargeDetectionEnable()); + mFgSyncManualSizer->ShowItems(mFgManualSyncCheckBox->GetValue()); + + mFgSyncVoltageThresholdText->SetValue(wxString::Format(wxT("%.3f"), mConfig.getFgSyncVoltageThreshold())); + mFgSyncCurrentThresholdText->SetValue(wxString::Format(wxT("%.3f"), mConfig.getFgSyncCurrentThreshold())); + mFgSyncFilterText->SetValue(wxString::Format(wxT("%u"), mConfig.getFgSyncFilter())); + + mOcFgDisconnectEnableCheckBox->SetValue(mConfig.getOcFgdDisconnectEnable()); + mOcFgDisconnectThresholdText->SetValue(wxString::Format(wxT("%u"), mConfig.getOcFgdDisconnectThreshold())); + + mOcFgConnectEnableCheckBox->SetValue(mConfig.getOcFgdConnectEnable()); + mOcFgConnectThresholdText->SetValue(wxString::Format(wxT("%u"), mConfig.getOcFgdConnectThreshold())); + + + mOcGenEnableCheckBox->SetValue(mConfig.getOcGenControlEnable()); + mOcGenVonEnableCheckBox->SetValue(mConfig.getOcGenVonEnable()); + + mOcGenVoffEnableCheckBox->SetValue(mConfig.getOcGenVoffEnable()); + mOcGenSoconEnableCheckBox->SetValue(mConfig.getOcGenSoconEnable()); + mOcGenSocoffEnableCheckBox->SetValue(mConfig.getOcGenSocoffEnable()); + + mOcGenVonThresholdText->SetValue(wxString::Format(wxT("%.3f"), mConfig.getOcGenVonThreshold())); + mOcGenVonFilterText->SetValue(wxString::Format(wxT("%u"), mConfig.getOcGenVonFilter())); + mOcGenVoffThresholdText->SetValue(wxString::Format(wxT("%.3f"), mConfig.getOcGenVoffThreshold())); + + mOcGenSoconThresholdText->SetValue(wxString::Format(wxT("%u"), mConfig.getOcGenSoconThreshold())); + mOcGenSocoffThresholdText->SetValue(wxString::Format(wxT("%u"), mConfig.getOcGenSocoffThreshold())); + + mOcGenTurnOffDelayText->SetValue(wxString::Format(wxT("%u"), mConfig.getOcGenTurnOffDelay())); + + if (mAdcDisableV2CheckBox->GetValue()) + mOcGenVoltageSourceCheckBox->Hide(); + + mOcGenVonSizer->ShowItems(mOcGenVonEnableCheckBox->GetValue()); + mOcGenVoffSizer->ShowItems(mOcGenVoffEnableCheckBox->GetValue()); + mOcGenSoconSizer->ShowItems(mOcGenSoconEnableCheckBox->GetValue()); + mOcGenSocoffSizer->ShowItems(mOcGenSocoffEnableCheckBox->GetValue()); + +#if defined(_MSC_VER) + mListBook->GetListView()->SetColumnWidth(0, FromDIP(180)); +#endif + + SetSize(FromDIP(wxSize(480, 620))); + + Layout(); + Centre(); +} + + + +void GuiDeviceConfig::OnOcGenCheckBoxClicked(wxCommandEvent &event) +{ + mOcGenVonSizer->ShowItems(mOcGenVonEnableCheckBox->GetValue()); + mOcGenVoffSizer->ShowItems(mOcGenVoffEnableCheckBox->GetValue()); + mOcGenSoconSizer->ShowItems(mOcGenSoconEnableCheckBox->GetValue()); + mOcGenSocoffSizer->ShowItems(mOcGenSocoffEnableCheckBox->GetValue()); + + mListBook->GetCurrentPage()->Fit(); + + wxSize maxSize(0, 0); + for (size_t i = 0; i < mListBook->GetPageCount(); ++i) + { + wxSize pageSize = mListBook->GetPage(i)->GetBestSize(); + maxSize.IncTo(pageSize); + } + + mListBook->SetMinSize(maxSize); + Fit(); +} + + +void GuiDeviceConfig::OnDisableV2CheckBoxClicked(wxCommandEvent &event) +{ + if (mAdcDisableV2CheckBox->GetValue()) + { + mMeterVoltageSourceCheckBox->SetValue(false); + mOcLvdVoltageSourceCheckBox->SetValue(false); + mOcHvdVoltageSourceCheckBox->SetValue(false); + mFgVoltageSourceCheckBox->SetValue(false); + mOcGenVoltageSourceCheckBox->SetValue(false); + + mMeterVoltageSourceCheckBox->Hide(); + mOcLvdVoltageSourceCheckBox->Hide(); + mOcHvdVoltageSourceCheckBox->Hide(); + mFgVoltageSourceCheckBox->Hide(); + mOcGenVoltageSourceCheckBox->Hide(); + } + else + { + mMeterVoltageSourceCheckBox->Show(); + mOcLvdVoltageSourceCheckBox->Show(); + mOcHvdVoltageSourceCheckBox->Show(); + mFgVoltageSourceCheckBox->Show(); + mOcGenVoltageSourceCheckBox->Show(); + } + + mListBook->GetPage(0)->Fit(); + mListBook->GetPage(1)->Fit(); + mListBook->GetPage(2)->Fit(); + mListBook->GetPage(7)->Fit(); + mListBook->GetPage(8)->Fit(); + + wxSize maxSize(0, 0); + for (size_t i = 0; i < mListBook->GetPageCount(); ++i) + { + wxSize pageSize = mListBook->GetPage(i)->GetBestSize(); + maxSize.IncTo(pageSize); + } + + mListBook->SetMinSize(maxSize); + Fit(); +} + + +void GuiDeviceConfig::OnManualCheckBoxClicked(wxCommandEvent &event) +{ + mFgSyncManualSizer->ShowItems(mFgManualSyncCheckBox->GetValue()); + + mListBook->GetCurrentPage()->Fit(); + + wxSize maxSize(0, 0); + for (size_t i = 0; i < mListBook->GetPageCount(); ++i) + { + wxSize pageSize = mListBook->GetPage(i)->GetBestSize(); + maxSize.IncTo(pageSize); + } + + mListBook->SetMinSize(maxSize); + Fit(); + + if (mFgManualSyncCheckBox->GetValue()) + updateFullChargeDetection(); +} + + +void GuiDeviceConfig::OnChoiceBatteryVoltageChanged(wxCommandEvent &event) +{ + updateBatteryCellCount(); + updateFullChargeDetection(); + + mListBook->GetCurrentPage()->Fit(); + + wxSize maxSize(0, 0); + for (size_t i = 0; i < mListBook->GetPageCount(); ++i) + { + wxSize pageSize = mListBook->GetPage(i)->GetBestSize(); + maxSize.IncTo(pageSize); + } + + mListBook->SetMinSize(maxSize); + Fit(); +} + + +void GuiDeviceConfig::OnChoiceShuntChanged(wxCommandEvent &event) +{ + const int32_t selected = mShuntChoice->GetCurrentSelection(); + mMaxShuntCurrentText->SetValue(wxString::Format(wxT("%u"), mConfig.getEngineShuntCurrentMax())); +} + + +void GuiDeviceConfig::OnChoiceBatteryChemistryChanged(wxCommandEvent &event) +{ + updateBatteryCellCount(); + updateFullChargeDetection(); +} + + +void GuiDeviceConfig::OnTextBatteryCapacityChanged(wxCommandEvent &event) +{ + if (mFgCapacityText->IsModified()) + { + try + { + ParseTextCtrlFloat(mFgCapacityText, wxT("Battery Capacity")); + } + catch(ParserException&) + { + return; + } + + updateFullChargeDetection(); + } +} + + +void GuiDeviceConfig::OnTextBatteryCellsChanged(wxCommandEvent &event) +{ + if (mFgCellCountText->IsModified()) + { + try + { + const uint32_t cells = ParseTextCtrlInt(mFgCellCountText, wxT("Battery Cell Count")); + checkCellCount(cells, mFgChemistryChoice->GetSelection()); + } + catch(ParserException &e) + { + wxMessageDialog msg(this, e.what(), wxT("Error"), wxOK | wxICON_ERROR); + msg.ShowModal(); + return; + } + + updateFullChargeDetection(); + } +} + + +void GuiDeviceConfig::OnButtonSaveClicked(wxCommandEvent &event) +{ + try + { + if (Powermon::hasWifi(mPowermon.getLastDeviceInfo().hardware_revision_bcd)) + mConfig.setWiFiKeepAPOn(mWifiKeepApOnCheckBox->GetValue()); + + if (Powermon::hasConfigurableShunt(mPowermon.getLastDeviceInfo().hardware_revision_bcd)) + { + const int32_t selected = mShuntChoice->GetCurrentSelection(); + if (selected < 0) + throw ParserException("Shunt not selected"); + + mConfig.setEngineShuntCurrentNom(l_shunts[selected].current_nom); + mConfig.setEngineShuntVdropNom(l_shunts[selected].vdrop_nom); + } + + const uint32_t max_shunt_current = ParseTextCtrlInt(mMaxShuntCurrentText, wxT("Max. Shunt Current")); + if (max_shunt_current > mConfig.getEngineShuntCurrentNom()) + throw ParserException("Max. Shunt Current cannot be higher than the shunt nominal current"); + mConfig.setEngineShuntCurrentMax(max_shunt_current); + + if (Powermon::hasVoltage2(mPowermon.getLastDeviceInfo().hardware_revision_bcd)) + { + mConfig.setEngineDisableV2(mAdcDisableV2CheckBox->GetValue()); + + mConfig.setEngineMeterVoltageSource(mMeterVoltageSourceCheckBox->GetValue()); + + mConfig.setOcLvdSource(mOcLvdVoltageSourceCheckBox->GetValue()); + mConfig.setOcHvdSource(mOcHvdVoltageSourceCheckBox->GetValue()); + mConfig.setFgVoltageSource(mFgVoltageSourceCheckBox->GetValue()); + mConfig.setOcGenVoltageSource(mOcGenVoltageSourceCheckBox->GetValue()); + } + + mConfig.setEngineCurrentSignFlip(mAdcFlipCurrentSignCheckBox->GetValue()); + mConfig.setOcInitialState(mOcInitialStateCheckBox->GetValue()); + mConfig.setOcLatchRelayOn(mOcLatchRelayOnCheckBox->GetValue()); + + mConfig.setOcInvertOutput(mOcInvertOutputCheckBox->GetValue()); + + mConfig.setOcConnectFilter(ParseTextCtrlInt(mOcConnectFilterText, wxT("Connect Filter"))); + + mConfig.setMfMode((PowermonConfig::MultiFunctionPinMode)mMfTerminalFunctionChoice->GetCurrentSelection()); + mConfig.setLogMode((PowermonConfig::LogMode)mLoggingModeChoice->GetCurrentSelection()); + + mConfig.setOcLvdEnable(mOcLvdEnableCheckBox->GetValue()); + mConfig.setOcLvdDisconnectThreshold(ParseTextCtrlFloat(mOcLvdDisconnectThresholdText, wxT("LVD Disconnect Threshold"))); + mConfig.setOcLvdConnectThreshold(ParseTextCtrlFloat(mOcLvdConnectThresholdText, wxT("LVD Connect Threshold"))); + mConfig.setOcLvdDisconnectFilter(ParseTextCtrlInt(mOcLvdDisconnectFilterText, wxT("LVD Filter"))); + + mConfig.setOcOcdEnable(mOcOcdEnableCheckBox->GetValue()); + mConfig.setOcOcdTripThreshold(ParseTextCtrlFloat(mOcOcdTripThresholdText, wxT("OCD Trip Threshold"))); + mConfig.setOcOcdTripFilter(ParseTextCtrlInt(mOcOcdTripFilterText, wxT("OCD Filter"))); + + mConfig.setOcHvdEnable(mOcHvdEnableCheckBox->GetValue()); + mConfig.setOcHvdDisconnectThreshold(ParseTextCtrlFloat(mOcHvdDisconnectThresholdText, wxT("HVD Disconnect Threshold"))); + mConfig.setOcHvdConnectThreshold(ParseTextCtrlFloat(mOcHvdConnectThresholdText, wxT("HVD Connect Threshold"))); + mConfig.setOcHvdDisconnectFilter(ParseTextCtrlInt(mOcHvdDisconnectFilterText, wxT("HVD Filter"))); + + if (mOcAutoOffEnableCheckBox->GetValue()) + { + const uint32_t hours = ParseTextCtrlInt(mOcAutoOffHoursText, wxT("Auto-OFF Timer Hours")); + const uint32_t minutes = ParseTextCtrlInt(mOcAutoOffMinutesText, wxT("Auto-OFF Timer Minutes")); + const uint32_t seconds = ParseTextCtrlInt(mOcAutoOffSecondsText, wxT("Auto-OFF Timer Seconds")); + + mConfig.setOcAutoOffTimer(hours * 3600 + minutes * 60 + seconds); + } + else + { + mConfig.setOcAutoOffTimer(0); + } + + if (mOcAutoOnEnableCheckBox->GetValue()) + { + const uint32_t hours = ParseTextCtrlInt(mOcAutoOnHoursText, wxT("Auto-ON Timer Hours")); + const uint32_t minutes = ParseTextCtrlInt(mOcAutoOnMinutesText, wxT("Auto-ON Timer Minutes")); + const uint32_t seconds = ParseTextCtrlInt(mOcAutoOnSecondsText, wxT("Auto-ON Timer Seconds")); + + mConfig.setOcAutoOnTimer(hours * 3600 + minutes * 60 + seconds); + } + else + { + mConfig.setOcAutoOnTimer(0); + } + + mConfig.setOcLtdEnable(mOcLtdEnableCheckBox->GetValue()); + mConfig.setOcLtdDisconnectThreshold(ParseTextCtrlInt(mOcLtdDisconnectThresholdText, wxT("LTD Disconnect Threshold"))); + mConfig.setOcLtdConnectThreshold(ParseTextCtrlInt(mOcLtdConnectThresholdText, wxT("LTD Connect Threshold"))); + mConfig.setOcLtdDisconnectFilter(ParseTextCtrlInt(mOcLtdDisconnectFilterText, wxT("LTD Filter"))); + + mConfig.setOcHtdEnable(mOcHtdEnableCheckBox->GetValue()); + mConfig.setOcHtdDisconnectThreshold(ParseTextCtrlInt(mOcHtdDisconnectThresholdText, wxT("HTD Disconnect Threshold"))); + mConfig.setOcHtdConnectThreshold(ParseTextCtrlInt(mOcHtdConnectThresholdText, wxT("HTD Connect Threshold"))); + mConfig.setOcHtdDisconnectFilter(ParseTextCtrlInt(mOcHtdDisconnectFilterText, wxT("HTD Filter"))); + + mConfig.setFgEnable(mFgEnableCheckBox->GetValue()); + + const float val = ParseTextCtrlFloat(mFgCapacityText, wxT("Battery Capacity")); + if ((val < 1.0) || val > 20000) + throw ParserException("Battery Capacity should be between 1.0Ah and 20,000Ah"); + mConfig.setFgDesignCapacity(val); + + mConfig.setFgChemistry((PowermonConfig::FuelgaugeChemistry)mFgChemistryChoice->GetCurrentSelection()); + + const uint32_t cells = ParseTextCtrlInt(mFgCellCountText, wxT("Battery Cell Count")); + checkCellCount(cells, mFgChemistryChoice->GetSelection()); + mConfig.setFgCellCount(cells); + + mConfig.setFgManualChargeDetectionEnable(mFgManualSyncCheckBox->GetValue()); + mConfig.setFgSyncVoltageThreshold(ParseTextCtrlFloat(mFgSyncVoltageThresholdText, wxT("Sync Voltage Threshold"))); + mConfig.setFgSyncCurrentThreshold(ParseTextCtrlFloat(mFgSyncCurrentThresholdText, wxT("Sync Current Threshold"))); + mConfig.setFgSyncFilter(ParseTextCtrlInt(mFgSyncFilterText, wxT("Sync Filter"))); + + mConfig.setOcFgdDisconnectEnable(mOcFgDisconnectEnableCheckBox->GetValue()); + uint32_t value = ParseTextCtrlInt(mOcFgDisconnectThresholdText, wxT("Battery Disconnect Threshold")); + if (value >= 100) + throw ParserException("Battery Disconnect Threshold should be under 100%"); + + mConfig.setOcFgdDisconnectThreshold(value); + + + mConfig.setOcFgdConnectEnable(mOcFgConnectEnableCheckBox->GetValue()); + value = ParseTextCtrlInt(mOcFgConnectThresholdText, wxT("Battery Connect Threshold")); + if (value >= 100) + throw ParserException("Battery Connect Threshold should be under 100%"); + + mConfig.setOcFgdConnectThreshold(value); + + + mConfig.setOcGenControlEnable(mOcGenEnableCheckBox->GetValue()); + + mConfig.setOcGenVonEnable(mOcGenVonEnableCheckBox->GetValue()); + mConfig.setOcGenVoffEnable(mOcGenVoffEnableCheckBox->GetValue()); + mConfig.setOcGenSoconEnable(mOcGenSoconEnableCheckBox->GetValue()); + mConfig.setOcGenSocoffEnable(mOcGenSocoffEnableCheckBox->GetValue()); + + mConfig.setOcGenTurnOffDelay(ParseTextCtrlInt(mOcGenTurnOffDelayText, wxT("Generator Turn Off Delay"))); + + + if (mOcGenVonEnableCheckBox->GetValue()) + { + mConfig.setOcGenVonThreshold(ParseTextCtrlFloat(mOcGenVonThresholdText, wxT("Generator Turn On Voltage Threshold"))); + mConfig.setOcGenVonFilter(ParseTextCtrlInt(mOcGenVonFilterText, wxT("Generator Turn On Voltage Filter"))); + } + + if (mOcGenVoffEnableCheckBox->GetValue()) + mConfig.setOcGenVoffThreshold(ParseTextCtrlFloat(mOcGenVoffThresholdText, wxT("Generator Turn Off Voltage Threshold"))); + + if (mOcGenSoconEnableCheckBox->GetValue()) + mConfig.setOcGenSoconThreshold(ParseTextCtrlInt(mOcGenSoconThresholdText, wxT("Generator Turn On SoC Threshold"))); + + if (mOcGenSocoffEnableCheckBox->GetValue()) + mConfig.setOcGenSocoffThreshold(ParseTextCtrlInt(mOcGenSocoffThresholdText, wxT("Generator Turn Off SoC Threshold"))); + + + if (Powermon::hasVoltage2(mPowermon.getLastDeviceInfo().hardware_revision_bcd)) + { + mConfig.setOcLiFePOEnable(mOcLiFePOEnableCheckBox->GetValue()); + + const uint32_t cells = ParseTextCtrlInt(mOcLiFePOCellCountText, wxT("Battery Cell Count")); + checkCellCount(cells, 2); + mConfig.setOcLiFePOCellCount(cells); + + const float val = ParseTextCtrlFloat(mOcLiFePOBatteryCapacityText, wxT("Battery Capacity")); + if ((val < 1.0) || val > 20000) + throw ParserException("Battery Capacity should be between 1.0Ah and 20,000Ah"); + mConfig.setOcLiFePODesignCapacity(val); + } + } + catch(ParserException &e) + { + wxMessageDialog msg(this, e.what(), wxT("Error"), wxOK | wxICON_ERROR); + msg.ShowModal(); + return; + } + + EndModal(wxID_OK); +} + + +void GuiDeviceConfig::OnOcFeatureEnableCheckBoxClicked(wxCommandEvent &event) +{ + if (mOcLvdEnableCheckBox->GetValue() || + mOcHvdEnableCheckBox->GetValue() || + mOcOcdEnableCheckBox->GetValue() || + mOcAutoOnEnableCheckBox->GetValue() || + mOcAutoOffEnableCheckBox->GetValue() || + mOcLtdEnableCheckBox->GetValue() || + mOcHtdEnableCheckBox->GetValue()) + { + if (Powermon::hasVoltage2(mPowermon.getLastDeviceInfo().hardware_revision_bcd)) + mOcLiFePOEnableCheckBox->SetValue(false); + + mOcGenEnableCheckBox->SetValue(false); + } +} + + +void GuiDeviceConfig::OnOcGenEnableCheckBoxClicked(wxCommandEvent &event) +{ + if (mOcGenEnableCheckBox->GetValue()) + { + wxMessageDialog msg(this, wxT("Enabling the Generator Control will disable all the other disconnect features.") + wxT("Please consult the user manual for details on the Generator Control feature."), wxT("Warning"), wxOK | wxICON_WARNING); + msg.ShowModal(); + + mOcLvdEnableCheckBox->SetValue(false); + mOcHvdEnableCheckBox->SetValue(false); + mOcOcdEnableCheckBox->SetValue(false); + mOcAutoOnEnableCheckBox->SetValue(false); + mOcAutoOffEnableCheckBox->SetValue(false); + mOcLtdEnableCheckBox->SetValue(false); + mOcHtdEnableCheckBox->SetValue(false); + + if (Powermon::hasVoltage2(mPowermon.getLastDeviceInfo().hardware_revision_bcd)) + mOcLiFePOEnableCheckBox->SetValue(false); + } +} + + +void GuiDeviceConfig::OnOcLiFePOEnableCheckBoxClicked(wxCommandEvent &event) +{ + if (mOcLiFePOEnableCheckBox->GetValue()) + { + wxMessageDialog msg(this, wxT("Enabling the LiFePO charge manager will disable all the other features, including the fuel gauge.") + wxT("Please consult the user manual for details on the LiFePO Charge Manager feature."), wxT("Warning"), wxOK | wxICON_WARNING); + msg.ShowModal(); + + mOcLvdEnableCheckBox->SetValue(false); + mOcHvdEnableCheckBox->SetValue(false); + mOcOcdEnableCheckBox->SetValue(false); + mOcAutoOnEnableCheckBox->SetValue(false); + mOcAutoOffEnableCheckBox->SetValue(false); + mOcLtdEnableCheckBox->SetValue(false); + mOcHtdEnableCheckBox->SetValue(false); + mFgEnableCheckBox->SetValue(false); + mOcGenEnableCheckBox->SetValue(false); + } +} + + +void GuiDeviceConfig::OnClose(wxCloseEvent &event) +{ + Hide(); +} + + +void GuiDeviceConfig::updateBatteryCellCount(void) +{ + const int32_t battery_voltage_selection = mFgBatteryVoltageChoice->GetSelection(); + if (battery_voltage_selection < 5) + { + uint8_t cell_count = 0; + switch(mFgChemistryChoice->GetSelection()) + { + case 0: //Lead chemistries + case 1: + switch(battery_voltage_selection) + { + case 0: cell_count = 3; break; + case 1: cell_count = 6; break; + case 2: cell_count = 12; break; + case 3: cell_count = 18; break; + case 4: cell_count = 24; break; + } + break; + + + case 2: //Li chemistries + case 3: + case 4: + switch(battery_voltage_selection) + { + case 0: cell_count = 2; break; + case 1: cell_count = 4; break; + case 2: cell_count = 8; break; + case 3: cell_count = 12; break; + case 4: cell_count = 16; break; + } + break; + } + + mFgCellCountText->SetValue(wxString::Format(wxT("%u"), cell_count)); + mFgCellCountSizer->ShowItems(false); + } + else + { + mFgCellCountSizer->ShowItems(true); + } +} + + +void GuiDeviceConfig::updateFullChargeDetection(void) +{ + const uint32_t cells = ParseTextCtrlInt(mFgCellCountText, wxT("Battery Cell Count")); + checkCellCount(cells, mFgChemistryChoice->GetSelection()); + + const float capacity = ParseTextCtrlFloat(mFgCapacityText, wxT("Battery Capacity")); + if ((capacity < 1.0) || capacity > 20000) + throw ParserException("Battery Capacity should be between 1.0Ah and 20,000Ah"); + + float voltage_threhold = 0; + switch(mFgChemistryChoice->GetSelection()) + { + case 0: + case 1: voltage_threhold = cells * 2.35; break; + case 2: voltage_threhold = cells * 3.5; break; + case 3: + case 4: voltage_threhold = cells * 4.1; break; + } + + mFgSyncVoltageThresholdText->SetValue(wxString::Format(wxT("%.3f"), voltage_threhold)); + mFgSyncCurrentThresholdText->SetValue(wxString::Format(wxT("%.3f"), capacity / 40)); + mFgSyncFilterText->SetValue(wxT("600")); +} + + +void GuiDeviceConfig::OnChoiceLiFePOBatteryVoltageChanged(wxCommandEvent &event) +{ + const int32_t battery_voltage_selection = mOcLiFePOBatteryVoltageChoice->GetSelection(); + if (battery_voltage_selection < 5) + { + uint8_t cell_count = 0; + switch(battery_voltage_selection) + { + case 0: cell_count = 2; break; + case 1: cell_count = 4; break; + case 2: cell_count = 8; break; + case 3: cell_count = 12; break; + case 4: cell_count = 16; break; + } + + mOcLiFePOCellCountText->SetValue(wxString::Format(wxT("%u"), cell_count)); + mOcLiFePOCellCountSizer->ShowItems(false); + } + else + { + mOcLiFePOCellCountSizer->ShowItems(true); + } + + mListBook->GetCurrentPage()->Fit(); + + wxSize maxSize(0, 0); + for (size_t i = 0; i < mListBook->GetPageCount(); ++i) + { + wxSize pageSize = mListBook->GetPage(i)->GetBestSize(); + maxSize.IncTo(pageSize); + } + + mListBook->SetMinSize(maxSize); + Fit(); +} + + +void GuiDeviceConfig::OnTextLiFePOCellsChanged(wxCommandEvent &event) +{ + if (mOcLiFePOCellCountText->IsModified()) + { + try + { + const uint32_t cells = ParseTextCtrlInt(mOcLiFePOCellCountText, wxT("Battery Cell Count")); + checkCellCount(cells, 2); + } + catch(ParserException &e) + { + wxMessageDialog msg(this, e.what(), wxT("Error"), wxOK | wxICON_ERROR); + msg.ShowModal(); + return; + } + } +} + + + +BEGIN_EVENT_TABLE(GuiDeviceConfig, wxDialog) +EVT_CLOSE(GuiDeviceConfig::OnClose) + +EVT_CHECKBOX(ID_CHECKBOX_DISABLE_V2, GuiDeviceConfig::OnDisableV2CheckBoxClicked) +EVT_CHECKBOX(ID_CHECK_MANUAL_DETECTION, GuiDeviceConfig::OnManualCheckBoxClicked) +EVT_CHECKBOX(ID_CHECK_VON_GENERATOR, GuiDeviceConfig::OnOcGenCheckBoxClicked) +EVT_CHECKBOX(ID_CHECKBOX_ENABLE_FEATURE, GuiDeviceConfig::OnOcFeatureEnableCheckBoxClicked) +EVT_CHECKBOX(ID_CHECKBOX_ENABLE_GENERATOR, GuiDeviceConfig::OnOcGenEnableCheckBoxClicked) +EVT_CHECKBOX(ID_CHECKBOX_ENABLE_LIFEPO_CM, GuiDeviceConfig::OnOcLiFePOEnableCheckBoxClicked) + +EVT_CHOICE(ID_CHOICE_SHUNT, GuiDeviceConfig::OnChoiceShuntChanged) +EVT_CHOICE(ID_CHOICE_FG_VOLTAGE, GuiDeviceConfig::OnChoiceBatteryVoltageChanged) +EVT_CHOICE(ID_CHOICE_FG_CHEMISTRY, GuiDeviceConfig::OnChoiceBatteryChemistryChanged) +EVT_CHOICE(ID_CHOICE_LIFEPO_CM_VOLTAGE, GuiDeviceConfig::OnChoiceLiFePOBatteryVoltageChanged) + +EVT_TEXT(ID_TEXT_FG_CAPACITY, GuiDeviceConfig::OnTextBatteryCapacityChanged) +EVT_TEXT(ID_TEXT_FG_CELLS, GuiDeviceConfig::OnTextBatteryCellsChanged) +EVT_TEXT(ID_CHOICE_LIFEPO_CM_CELLS, GuiDeviceConfig::OnTextLiFePOCellsChanged) + + + + +EVT_BUTTON(wxID_OK, GuiDeviceConfig::OnButtonSaveClicked) + +END_EVENT_TABLE() diff --git a/gui/gui_device_config.h b/gui/gui_device_config.h new file mode 100644 index 0000000..a2e66ac --- /dev/null +++ b/gui/gui_device_config.h @@ -0,0 +1,222 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _GUI_DEVICE_CONFIG_H +#define _GUI_DEVICE_CONFIG_H + + +#include +#include + +#include + +#include + + + +class GuiDeviceConfig: public wxDialog +{ +public: + GuiDeviceConfig(wxWindow* parent, wxWindowID id, const PowermonConfig &config, const Powermon &powermon); + + bool AcceptsFocus(void) const + { + return false; + } + + const PowermonConfig& getConfiguration(void) const + { + return mConfig; + } + +private: + enum + { + ID_CHOICE_SHUNT = wxID_HIGHEST + 1, + ID_CHECKBOX_DISABLE_V2, + ID_CHECKBOX_ENABLE_FEATURE, + ID_CHECKBOX_ENABLE_GENERATOR, + ID_CHOICE_FG_VOLTAGE, + ID_TEXT_FG_CAPACITY, + ID_TEXT_FG_CELLS, + ID_CHOICE_FG_CHEMISTRY, + ID_CHECK_MANUAL_DETECTION, + ID_CHECK_VON_GENERATOR, + ID_CHECKBOX_ENABLE_LIFEPO_CM, + ID_CHOICE_LIFEPO_CM_VOLTAGE, + ID_CHOICE_LIFEPO_CM_CELLS + }; + + const Powermon &mPowermon; + PowermonConfig mConfig; + + wxListbook* mListBook; + + wxCheckBox* mWifiKeepApOnCheckBox; + + wxChoice* mShuntChoice; + wxTextCtrl* mMaxShuntCurrentText; + + wxCheckBox* mAdcDisableV2CheckBox; + wxCheckBox* mMeterVoltageSourceCheckBox; + + wxCheckBox* mAdcFlipCurrentSignCheckBox; + + wxCheckBox* mOcInitialStateCheckBox; + wxCheckBox* mOcLatchRelayOnCheckBox; + wxCheckBox* mOcInvertOutputCheckBox; + + wxTextCtrl* mOcConnectFilterText; + + wxChoice* mMfTerminalFunctionChoice; + wxChoice* mLoggingModeChoice; + + wxCheckBox* mOcLvdEnableCheckBox; + wxCheckBox* mOcLvdVoltageSourceCheckBox; + wxTextCtrl* mOcLvdDisconnectThresholdText; + wxTextCtrl* mOcLvdConnectThresholdText; + wxTextCtrl* mOcLvdDisconnectFilterText; + + wxCheckBox* mOcOcdEnableCheckBox; + wxTextCtrl* mOcOcdTripThresholdText; + wxTextCtrl* mOcOcdTripFilterText; + + wxCheckBox* mOcHvdEnableCheckBox; + wxCheckBox* mOcHvdVoltageSourceCheckBox; + wxTextCtrl* mOcHvdDisconnectThresholdText; + wxTextCtrl* mOcHvdConnectThresholdText; + wxTextCtrl* mOcHvdDisconnectFilterText; + + wxCheckBox* mOcAutoOffEnableCheckBox; + wxTextCtrl* mOcAutoOffHoursText; + wxTextCtrl* mOcAutoOffMinutesText; + wxTextCtrl* mOcAutoOffSecondsText; + + wxCheckBox* mOcAutoOnEnableCheckBox; + wxTextCtrl* mOcAutoOnHoursText; + wxTextCtrl* mOcAutoOnMinutesText; + wxTextCtrl* mOcAutoOnSecondsText; + + wxCheckBox* mOcLtdEnableCheckBox; + wxTextCtrl* mOcLtdDisconnectThresholdText; + wxTextCtrl* mOcLtdConnectThresholdText; + wxTextCtrl* mOcLtdDisconnectFilterText; + + wxCheckBox* mOcHtdEnableCheckBox; + wxTextCtrl* mOcHtdDisconnectThresholdText; + wxTextCtrl* mOcHtdConnectThresholdText; + wxTextCtrl* mOcHtdDisconnectFilterText; + + + wxCheckBox* mFgEnableCheckBox; + wxCheckBox* mFgVoltageSourceCheckBox; + wxChoice* mFgChemistryChoice; + wxChoice* mFgBatteryVoltageChoice; + wxBoxSizer* mFgCellCountSizer; + wxTextCtrl* mFgCellCountText; + wxTextCtrl* mFgCapacityText; + + wxCheckBox* mFgManualSyncCheckBox; + + wxBoxSizer* mFgSyncManualSizer; + wxTextCtrl* mFgSyncVoltageThresholdText; + wxTextCtrl* mFgSyncCurrentThresholdText; + wxTextCtrl* mFgSyncFilterText; + + wxCheckBox* mOcFgDisconnectEnableCheckBox; + wxTextCtrl* mOcFgDisconnectThresholdText; + wxCheckBox* mOcFgConnectEnableCheckBox; + wxTextCtrl* mOcFgConnectThresholdText; + + wxCheckBox* mOcGenEnableCheckBox; + wxCheckBox* mOcGenVonEnableCheckBox; + wxCheckBox* mOcGenVoltageSourceCheckBox; + wxTextCtrl* mOcGenVonThresholdText; + wxTextCtrl* mOcGenVonFilterText; + wxCheckBox* mOcGenVoffEnableCheckBox; + wxTextCtrl* mOcGenVoffThresholdText; + wxCheckBox* mOcGenSoconEnableCheckBox; + wxTextCtrl* mOcGenSoconThresholdText; + wxCheckBox* mOcGenSocoffEnableCheckBox; + wxTextCtrl* mOcGenSocoffThresholdText; + wxTextCtrl* mOcGenTurnOffDelayText; + + wxBoxSizer* mOcGenVonSizer; + wxBoxSizer* mOcGenVoffSizer; + wxBoxSizer* mOcGenSoconSizer; + wxBoxSizer* mOcGenSocoffSizer; + + wxCheckBox* mOcLiFePOEnableCheckBox; + wxChoice* mOcLiFePOBatteryVoltageChoice; + wxBoxSizer* mOcLiFePOCellCountSizer; + wxTextCtrl* mOcLiFePOCellCountText; + wxTextCtrl* mOcLiFePOBatteryCapacityText; + + wxButton* mSaveButton; + wxButton* mCancelButton; + + + void OnChoiceShuntChanged(wxCommandEvent &event); + + void OnChoiceBatteryVoltageChanged(wxCommandEvent &event); + void OnChoiceBatteryChemistryChanged(wxCommandEvent &event); + + void OnTextBatteryCapacityChanged(wxCommandEvent &event); + void OnTextBatteryCellsChanged(wxCommandEvent &event); + + void OnDisableV2CheckBoxClicked(wxCommandEvent &event); + void OnManualCheckBoxClicked(wxCommandEvent &event); + + void OnOcGenCheckBoxClicked(wxCommandEvent &event); + + void OnButtonSaveClicked(wxCommandEvent &event); + + void OnOcFeatureEnableCheckBoxClicked(wxCommandEvent &event); + void OnOcGenEnableCheckBoxClicked(wxCommandEvent &event); + + void OnOcLiFePOEnableCheckBoxClicked(wxCommandEvent &event); + void OnChoiceLiFePOBatteryVoltageChanged(wxCommandEvent &event); + void OnTextLiFePOCellsChanged(wxCommandEvent &event); + + void OnClose(wxCloseEvent &event); + + void checkCellCount(uint32_t cells, uint32_t chemistry_index) + { + uint32_t max_cells = 0; + switch(chemistry_index) + { + case 0: + case 1: max_cells = 24; break; + + case 2: + case 3: + case 4: max_cells = 16; break; + } + + if ((cells == 0) || (cells > max_cells)) + throw ParserException(wxString::Format(wxT("Battery Cell Count should be between 1 and %u"), max_cells)); + } + + void updateBatteryCellCount(void); + void updateFullChargeDetection(void); + + DECLARE_EVENT_TABLE() +}; + + +#endif + diff --git a/gui/gui_dfu_progress.cpp b/gui/gui_dfu_progress.cpp new file mode 100644 index 0000000..73804c2 --- /dev/null +++ b/gui/gui_dfu_progress.cpp @@ -0,0 +1,138 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include +#include + + + +GuiDFUProgress::GuiDFUProgress(wxWindow *parent, const wxString &title, Powermon &powermon, const std::vector &image): wxDialog(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize), + mPowermon(powermon), mFirmwareImage(image) +{ + const size_t BORDER_SIZE = FromDIP(6); + + //main window sizer + wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL); + SetSizer(main_sizer); + + main_sizer->AddSpacer(BORDER_SIZE); + + mStatusLabel = new wxStaticText(this, wxID_ANY, wxT("Starting ...")); + main_sizer->Add(mStatusLabel, 0, wxALL | wxEXPAND, BORDER_SIZE); + + mProgressBar = new wxGauge(this, wxID_ANY, 100, wxDefaultPosition, FromDIP(wxSize(200, 20)), wxGA_HORIZONTAL); + main_sizer->Add(mProgressBar, 0, wxLEFT | wxRIGHT | wxEXPAND, 2 * BORDER_SIZE); + + main_sizer->AddSpacer(10); + + wxBoxSizer* h_sizer = new wxBoxSizer(wxHORIZONTAL); + main_sizer->Add(h_sizer, 1, wxALL | wxEXPAND, BORDER_SIZE); + + h_sizer->AddStretchSpacer(1); + + mCancelButton = new wxButton(this, wxID_CANCEL, wxT("Cancel"), wxDefaultPosition, FromDIP(wxSize(130, 40))); + h_sizer->Add(mCancelButton, 0, wxALL | wxCENTER, BORDER_SIZE); + + h_sizer->AddStretchSpacer(1); + + main_sizer->SetSizeHints(this); + Centre(); + SetFocus(); + + Bind(wxEVT_COMMAND_BUTTON_CLICKED, &GuiDFUProgress::OnCancelButtonClicked, this, wxID_CANCEL); + Bind(wxEVT_CLOSE_WINDOW, &GuiDFUProgress::OnClose, this, wxEVT_CLOSE_WINDOW); + Bind(EVT_TYPE_GUI, &GuiDFUProgress::OnGuiEvent, this); + + mInProgress = true; + mCancelUpdate = false; + + mPowermon.requestUpdateFirmware(mFirmwareImage.data(), mFirmwareImage.size(), + [this](uint32_t progress, uint32_t total) + { + if (mCancelUpdate) + return false; + + GuiEvent* event = new GuiEvent([this, progress, total](const GuiEvent &event) //this gets executed in the GUI thread + { + mStatusLabel->SetLabel(wxString::Format(wxT("%u of %u bytes"), progress, total)); + mStatusLabel->Refresh(); + + mProgressBar->SetValue((progress * 100) / total); + mProgressBar->Refresh(); + }); + wxQueueEvent(this, event); + + return true; + }, + + [this](uint16_t status) + { + mInProgress = false; + + GuiEvent* event = new GuiEvent([this, status](const GuiEvent &event) //this gets executed in the GUI thread + { + if (status == Powermon::RSP_SUCCESS) + EndModal(SUCCESS); + else if (status == Powermon::RSP_CANCELLED) + EndModal(CANCELLED); + else + EndModal(FAILED); + }); + wxQueueEvent(this, event); + }); +} + + +GuiDFUProgress::~GuiDFUProgress() +{ +} + + +void GuiDFUProgress::OnClose(wxCloseEvent &event) +{ + mCancelButton->Enable(false); + + if (mInProgress) + { + mCancelUpdate = true; + } + else + { + EndModal(ABORTED); + } +} + + +void GuiDFUProgress::OnCancelButtonClicked(wxCommandEvent &event) +{ + mCancelButton->Enable(false); + + if (mInProgress) + { + mCancelUpdate = true; + } + else + { + EndModal(ABORTED); + } +} + + +void GuiDFUProgress::OnGuiEvent(GuiEvent &event) +{ + event.process(); +} diff --git a/gui/gui_dfu_progress.h b/gui/gui_dfu_progress.h new file mode 100644 index 0000000..653c12a --- /dev/null +++ b/gui/gui_dfu_progress.h @@ -0,0 +1,60 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _GUI_DFU_PROGRESS_H +#define _GUI_DFU_PROGRESS_H + + +#include +#include + + +class GuiDFUProgress: public wxDialog +{ +public: + enum ReturnCode + { + SUCCESS = 0, + FAILED, + CANCELLED, + ABORTED + }; + + + GuiDFUProgress(wxWindow *parent, const wxString &title, Powermon &powermon, const std::vector &image); + ~GuiDFUProgress(); + +private: + Powermon &mPowermon; + + wxButton* mCancelButton; + + wxStaticText* mStatusLabel; + wxGauge* mProgressBar; + bool mInProgress; + volatile bool mCancelUpdate; + + const std::vector &mFirmwareImage; + + void OnGuiEvent(GuiEvent &event); + + void OnClose(wxCloseEvent &event); + void OnCancelButtonClicked(wxCommandEvent &event); +}; + + +#endif diff --git a/gui/gui_fg_stats.cpp b/gui/gui_fg_stats.cpp new file mode 100644 index 0000000..30c38fa --- /dev/null +++ b/gui/gui_fg_stats.cpp @@ -0,0 +1,130 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + + +GuiFgStats::GuiFgStats(wxWindow *parent, const wxString &title, const Powermon::FuelgaugeStatistics &stats): wxDialog(parent, wxID_ANY, title) +{ + const size_t BORDER_SIZE = FromDIP(6); + + mCloseButton = new wxButton(this, wxID_CLOSE, wxT("Close"), wxDefaultPosition, FromDIP(wxSize(110, 40))); + + //main window sizer + wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL); + SetSizer(main_sizer); + + wxString str; + + if (stats.time_since_last_full_charge != 0xFFFFFFFF) + { + uint32_t seconds = stats.time_since_last_full_charge; + + const uint32_t days = seconds / (3600 * 24); + seconds -= days * 3600 * 24; + + const uint32_t hours = seconds / 3600; + seconds -= hours * 3600; + + const uint32_t minutes = seconds / 60; + seconds -= minutes * 60; + + if (days) + str.Printf(wxT("Time since last full charge: %ud %uh %um"), days, hours, minutes); + else if (hours) + str.Printf(wxT("Time since last full charge: %uh %um %us"), hours, minutes, seconds); + else + str.Printf(wxT("Time since last full charge: %um %us"), minutes, seconds); + } + else + { + str.Printf(wxT("Time since last full charge: unknown")); + } + + + main_sizer->Add(new wxStaticText(this, wxID_ANY, str), 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + + str.Printf(wxT("Full charge capacity: %5.0f Ah"), stats.full_charge_capacity); + main_sizer->Add(new wxStaticText(this, wxID_ANY, str), 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + + if (fabs(stats.total_discharge) >= 1000000) + str.Printf(wxT("Total discharged capacity: %.2f kAh"), stats.total_discharge / 1000000.0); + else + str.Printf(wxT("Total discharged capacity: %.1f Ah"), stats.total_discharge / 1000.0); + main_sizer->Add(new wxStaticText(this, wxID_ANY, str), 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + if (fabs(stats.total_discharge_energy) >= 1000000) + str.Printf(wxT("Total discharged energy: %.2f kWh"), stats.total_discharge_energy / 1000000.0); + else + str.Printf(wxT("Total discharged energy: %.0f Wh"), stats.total_discharge_energy / 1000.0); + main_sizer->Add(new wxStaticText(this, wxID_ANY, str), 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + + if (fabs(stats.total_charge) >= 1000000) + str.Printf(wxT("Total charged capacity: %.2f kAh"), stats.total_charge / 1000000.0); + else + str.Printf(wxT("Total charged capacity: %.1f Ah"), stats.total_charge / 1000.0); + main_sizer->Add(new wxStaticText(this, wxID_ANY, str), 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + if (fabs(stats.total_charge_energy) >= 1000000) + str.Printf(wxT("Total charged energy: %.2f kWh"), stats.total_charge_energy / 1000000.0); + else + str.Printf(wxT("Total charged energy: %.0f Wh"), stats.total_charge_energy / 1000.0); + main_sizer->Add(new wxStaticText(this, wxID_ANY, str), 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + + str.Printf(wxT("Minimum battery voltage: %.3f V"), stats.min_voltage); + main_sizer->Add(new wxStaticText(this, wxID_ANY, str), 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + str.Printf(wxT("Maximum battery voltage: %.3f V"), stats.max_voltage); + main_sizer->Add(new wxStaticText(this, wxID_ANY, str), 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + str.Printf(wxT("Maximum discharge current: %.2f A"), stats.max_discharge_current); + main_sizer->Add(new wxStaticText(this, wxID_ANY, str), 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + str.Printf(wxT("Maximum charge current: %.2f A"), stats.max_charge_current); + main_sizer->Add(new wxStaticText(this, wxID_ANY, str), 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + str.Printf(wxT("Last discharge depth: %.1f Ah"), stats.last_discharge); + main_sizer->Add(new wxStaticText(this, wxID_ANY, str), 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + str.Printf(wxT("Deepest discharge: %.1f Ah"), stats.deepest_discharge); + main_sizer->Add(new wxStaticText(this, wxID_ANY, str), 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + str.Printf(wxT("Number of full discharge cycles: %u"), (uint32_t)round(stats.total_discharge / (1000.0 * stats.full_charge_capacity))); + main_sizer->Add(new wxStaticText(this, wxID_ANY, str), 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + main_sizer->Add(mCloseButton, 0, wxALL | wxALIGN_CENTER, BORDER_SIZE); + + main_sizer->SetSizeHints(this); + Centre(); +} + + +void GuiFgStats::OnButtonCloseClicked(wxCommandEvent &event) +{ + Hide(); +} + + +BEGIN_EVENT_TABLE(GuiFgStats, wxDialog) + +EVT_BUTTON(wxID_CLOSE, GuiFgStats::OnButtonCloseClicked) + +END_EVENT_TABLE() diff --git a/gui/gui_fg_stats.h b/gui/gui_fg_stats.h new file mode 100644 index 0000000..6925e7c --- /dev/null +++ b/gui/gui_fg_stats.h @@ -0,0 +1,41 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _GUI_FG_STATS_H +#define _GUI_FG_STATS_H + + +#include +#include + + +class GuiFgStats: public wxDialog +{ +public: + GuiFgStats(wxWindow *parent, const wxString &title, const Powermon::FuelgaugeStatistics &stats); + +private: + wxButton* mCloseButton; + + void OnButtonCloseClicked(wxCommandEvent &event); + + DECLARE_EVENT_TABLE() +}; + + +#endif + diff --git a/gui/gui_global.cpp b/gui/gui_global.cpp new file mode 100644 index 0000000..759384b --- /dev/null +++ b/gui/gui_global.cpp @@ -0,0 +1,20 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +wxDEFINE_EVENT(EVT_TYPE_GUI, GuiEvent); diff --git a/gui/gui_global.h b/gui/gui_global.h new file mode 100644 index 0000000..debf52d --- /dev/null +++ b/gui/gui_global.h @@ -0,0 +1,133 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _GUI_GLOBAL_H +#define _GUI_GLOBAL_H + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#include + +#include + + +class GuiEvent; +wxDECLARE_EVENT(EVT_TYPE_GUI, GuiEvent); + +#define GUI_EVT(func) wx__DECLARE_EVT0(EVT_TYPE_GUI, &func) + + + +class GuiEvent: public wxCommandEvent +{ +public: + GuiEvent(const std::function &fn): wxCommandEvent(EVT_TYPE_GUI, 0), mFunction(fn) + { + } + + wxEvent* Clone(void) const + { + return new GuiEvent(*this); + } + + void process(void) + { + if (mFunction) + mFunction(*this); + } + +private: + std::function mFunction; +}; + + +static inline bool checkDeviceError(wxWindow* window, uint16_t status) +{ + switch(status) + { + case Powermon::RSP_INVALID_REQ: + { + wxMessageDialog msg(window, wxT("Invalid request."), wxT("Error"), wxOK | wxSTAY_ON_TOP | wxCENTRE | wxICON_ERROR); + msg.ShowModal(); + return false; + }break; + + case Powermon::RSP_INVALID_PARAM: + { + wxMessageDialog msg(window, wxT("Invalid parameter."), wxT("Error"), wxOK | wxSTAY_ON_TOP | wxCENTRE | wxICON_ERROR); + msg.ShowModal(); + return false; + }break; + + case Powermon::RSP_ERROR: + { + wxMessageDialog msg(window, wxT("Request failed."), wxT("Error"), wxOK | wxSTAY_ON_TOP | wxCENTRE | wxICON_ERROR); + msg.ShowModal(); + return false; + }break; + + case Powermon::RSP_LOCKED_USER: + { + wxMessageDialog msg(window, wxT("Feature is locked by user password."), wxT("Error"), wxOK | wxSTAY_ON_TOP | wxCENTRE | wxICON_ERROR); + msg.ShowModal(); + return false; + }break; + + case Powermon::RSP_LOCKED_MASTER: + { + wxMessageDialog msg(window, wxT("Feature is locked by master password."), wxT("Error"), wxOK | wxSTAY_ON_TOP | wxCENTRE | wxICON_ERROR); + msg.ShowModal(); + return false; + }break; + + case Powermon::RSP_TIMEOUT: + { + wxMessageDialog msg(window, wxT("Request timeout."), wxT("Error"), wxOK | wxSTAY_ON_TOP | wxCENTRE | wxICON_ERROR); + msg.ShowModal(); + return false; + }break; + + case Powermon::RSP_INVALID: + { + wxMessageDialog msg(window, wxT("Invalid device response."), wxT("Error"), wxOK | wxSTAY_ON_TOP | wxCENTRE | wxICON_ERROR); + msg.ShowModal(); + return false; + }break; + + default: return true; + } + + return true; +} + + +#endif diff --git a/gui/gui_main.cpp b/gui/gui_main.cpp new file mode 100644 index 0000000..6ee110e --- /dev/null +++ b/gui/gui_main.cpp @@ -0,0 +1,480 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include +#include +#include +#include + +#if defined (__GNUC__) +#include +#include +#endif + +#if defined(_MSC_VER) + +#include + +#endif + +#include + +#include + +#include + + + +GuiMain::GuiMain(): wxFrame(0, wxID_ANY, wxT("PowerMon Manager"), wxDefaultPosition, wxDefaultSize, wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxSYSTEM_MENU | wxRESIZE_BORDER | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN) +{ +#if defined(__WXMSW__) + SetIcon(wxIcon(wxT("APP_ICON"))); +#elif defined (__GNUC__) + SetIcon(wxIcon(wxICON(powermon_icon))); +#endif + + Model::getInstance().mMainWindow = this; + + mMenuBar = new wxMenuBar; + + mDeviceMenu = new wxMenu; + + mDeviceMenu->Append(ID_MENU_ADD_DEVICE, wxT("Add New Device")); + mDeviceMenu->Append(ID_MENU_DIRECT_CONNECT, wxT("WiFi Direct Connect")); + mDeviceMenu->SetHelpString(ID_MENU_ADD_DEVICE, wxT("Add New Remote Device")); + mDeviceMenu->SetHelpString(ID_MENU_DIRECT_CONNECT, wxT("Direct Connection to PowerMon-W Device")); + + mMenuBar->Append(mDeviceMenu, wxT("&Device")); + + wxMenu* menu = new wxMenu; + menu->Append(wxID_ABOUT, wxT("&About")); + mMenuBar->Append(menu, wxT("&Help")); + + SetMenuBar(mMenuBar); + + //main window sizer & panel + wxPanel* panel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize); + wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL); + panel->SetSizer(main_sizer); + + + mDeviceListNotebook = new wxNotebook(panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, wxT("")); + main_sizer->Add(mDeviceListNotebook, 1, wxALL | wxEXPAND, FromDIP(10)); + + mLocalDeviceListCtrl = new wxListCtrl(mDeviceListNotebook, ID_LISTBOX_LOCAL_DEVICE_LIST, wxDefaultPosition, wxDefaultSize, wxLC_SINGLE_SEL | wxLC_REPORT | wxLC_VRULES); + mDeviceListNotebook->AddPage(mLocalDeviceListCtrl, wxT("Local Devices")); + + mCloudDeviceListCtrl = new wxListCtrl(mDeviceListNotebook, ID_LISTBOX_CLOUD_DEVICE_LIST, wxDefaultPosition, FromDIP(wxSize(800, 500)), wxLC_SINGLE_SEL | wxLC_REPORT | wxLC_VRULES); + mDeviceListNotebook->AddPage(mCloudDeviceListCtrl, wxT("Cloud Devices")); + + mDeviceConnectButton = new wxButton(panel, ID_BUTTON_DEVICE_CONNECT, wxT("Connect"), wxDefaultPosition, FromDIP(wxSize(150, 40))); + mDeviceConnectButton->Enable(false); + main_sizer->Add(mDeviceConnectButton, 0, wxALL, FromDIP(10)); + + mLocalDeviceListCtrl->AppendColumn(wxT("Name"), wxLIST_FORMAT_LEFT, FromDIP(120)); + mLocalDeviceListCtrl->AppendColumn(wxT("Model"), wxLIST_FORMAT_LEFT, FromDIP(120)); + mLocalDeviceListCtrl->AppendColumn(wxT("Serial"), wxLIST_FORMAT_LEFT, FromDIP(150)); + mLocalDeviceListCtrl->AppendColumn(wxT("FW"), wxLIST_FORMAT_RIGHT, FromDIP(50)); + + mLocalDeviceListCtrl->AppendColumn(wxT("V1"), wxLIST_FORMAT_RIGHT, FromDIP(75)); + mLocalDeviceListCtrl->AppendColumn(wxT("V2"), wxLIST_FORMAT_RIGHT, FromDIP(75)); + mLocalDeviceListCtrl->AppendColumn(wxT("I"), wxLIST_FORMAT_RIGHT, FromDIP(90)); + mLocalDeviceListCtrl->AppendColumn(wxT("P"), wxLIST_FORMAT_RIGHT, FromDIP(80)); + mLocalDeviceListCtrl->AppendColumn(wxT("Wh"), wxLIST_FORMAT_RIGHT, FromDIP(80)); + mLocalDeviceListCtrl->AppendColumn(wxT("Ah"), wxLIST_FORMAT_RIGHT, FromDIP(80)); + mLocalDeviceListCtrl->AppendColumn(wxT("Temp"), wxLIST_FORMAT_RIGHT, FromDIP(60)); + mLocalDeviceListCtrl->AppendColumn(wxT("SoC"), wxLIST_FORMAT_RIGHT, FromDIP(60)); + mLocalDeviceListCtrl->AppendColumn(wxT("Runtime"), wxLIST_FORMAT_RIGHT, FromDIP(100)); + mLocalDeviceListCtrl->AppendColumn(wxT("PS"), wxLIST_FORMAT_RIGHT, FromDIP(50)); + mLocalDeviceListCtrl->AppendColumn(wxT("Address"), wxLIST_FORMAT_RIGHT, FromDIP(150)); + mLocalDeviceListCtrl->AppendColumn(wxT("RSSI"), wxLIST_FORMAT_RIGHT, FromDIP(70)); + + mCloudDeviceListCtrl->AppendColumn(wxT("Name"), wxLIST_FORMAT_LEFT, FromDIP(400)); + mCloudDeviceListCtrl->AppendColumn(wxT("Model"), wxLIST_FORMAT_LEFT, FromDIP(120)); + mCloudDeviceListCtrl->AppendColumn(wxT("Serial"), wxLIST_FORMAT_LEFT, FromDIP(150)); + + main_sizer->SetSizeHints(this); + Centre(); + + UpdateCloudDeviceList(); + mDeviceListNotebook->SetSelection(0); + + mPowermonScanner = PowermonScanner::createInstance(); + + mPowermonScanner->setCallback([this](const PowermonScanner::Advertisment &adv) + { + wxQueueEvent(this, new GuiEvent([this, adv](const GuiEvent &event) mutable + { + bool found = false; + uint32_t index = 0; + for(auto it = mLocalDeviceList.begin(); it != mLocalDeviceList.end(); it++, index++) + { + if (it->adv.serial == adv.serial) + { + it->adv = adv; + it->timestamp = (int64_t)wxGetUTCTimeMillis().GetValue(); + + found = true; + break; + } + } + + if (found == false) + { + DeviceListItem item; + + item.timestamp = wxGetUTCTimeMillis().GetValue(); + item.adv = adv; + + mLocalDeviceList.push_back(item); + index = mLocalDeviceList.size(); + } + + UpdateLocalDeviceList(index, adv); + })); + }); + + mPowermonScanner->startWifiScan(); + mPowermonScanner->startBleScan(); + + mScrubTimer = new wxTimer(this, ID_SCRUB_TIMER); + mScrubTimer->Start(1000); + + SetSize(FromDIP(wxSize(800, 480))); +} + + +GuiMain::~GuiMain() +{ + Model::getInstance().mMainWindow = nullptr; + + mPowermonScanner->stopWifiScan(); + mPowermonScanner->stopBleScan(); + delete mPowermonScanner; + + delete mScrubTimer; +} + + +void GuiMain::UpdateLocalDeviceList(int32_t index, const PowermonScanner::Advertisment &adv) +{ + wxString str; + + if (index >= mLocalDeviceListCtrl->GetItemCount()) + { + wxListItem item; + index = mLocalDeviceListCtrl->InsertItem(index, wxString(adv.name.c_str(), wxConvUTF8)); + } + else + { + mLocalDeviceListCtrl->SetItem(index, 0, wxString(adv.name.c_str(), wxConvUTF8)); + } + + mLocalDeviceListCtrl->SetItem(index, 1, Powermon::getHardwareString(adv.hardware_revision_bcd)); + + str.Printf(wxT("%016" PRIX64), adv.serial); + mLocalDeviceListCtrl->SetItem(index, 2, str); + + str.Printf(wxT("%X.%02X"), adv.firmware_version_bcd >> 8, adv.firmware_version_bcd & 0xFF); + mLocalDeviceListCtrl->SetItem(index, 3, str); + + str.Printf(wxT("%.3f V"), adv.voltage1); + mLocalDeviceListCtrl->SetItem(index, 4, str); + + if (!isnan(adv.voltage2)) + str.Printf(wxT("%.3f V"), adv.voltage2); + else + str.clear(); + mLocalDeviceListCtrl->SetItem(index, 5, str); + + str.Printf(wxT("%.3f A"), adv.current); + mLocalDeviceListCtrl->SetItem(index, 6, str); + + if (fabs(adv.power) >= 1000) + str.Printf(wxT("%.3f kW"), adv.power / 1000.0); + else + str.Printf(wxT("%.2f W"), adv.power); + mLocalDeviceListCtrl->SetItem(index, 7, str); + + + if (fabs(adv.power_meter) >= 1000) + str.Printf(wxT("%.3f kWh"), adv.power_meter / 1000.0); + else + str.Printf(wxT("%.2f Wh"), adv.power_meter); + mLocalDeviceListCtrl->SetItem(index, 8, str); + + + if (fabs(adv.coulomb_meter) >= 1000) + str.Printf(wxT("%.3f kAh"), adv.coulomb_meter / 1000.0); + else + str.Printf(wxT("%.2f Ah"), adv.coulomb_meter); + mLocalDeviceListCtrl->SetItem(index, 9, str); + + + str.Printf(wxT("%s%.0f \u00B0C"), adv.isExternalTemperature() ? "e " : "", adv.temperature); + mLocalDeviceListCtrl->SetItem(index, 10, str); + + if (adv.soc > 100) + str = wxT("---"); + else + str.Printf(wxT("%u %%"), adv.soc); + mLocalDeviceListCtrl->SetItem(index, 11, str); + + + if (adv.runtime > FG_RUNTIME_MAX) + str = wxT("---"); + else if (adv.runtime == 0) + str = wxT("under 1m"); + else if (adv.runtime > 60 * 24 * 45) + str = wxT("over 45d"); + else + { + uint32_t minutes = adv.runtime; + uint32_t days = minutes / (60 * 24); + minutes -= days * 60 * 24; + + uint32_t hours = minutes / 60; + minutes -= hours * 60; + + if (days) + str.Printf(wxT("%ud %uh"), days, hours); + else if (hours) + str.Printf(wxT("%uh %um"), hours, minutes); + else + str.Printf(wxT("%um"), minutes); + } + mLocalDeviceListCtrl->SetItem(index, 12, str); + + mLocalDeviceListCtrl->SetItem(index, 13, wxString(Powermon::getPowerStatusString(adv.power_status).c_str(), wxConvUTF8)); + + std::string strr = Powermon::getIpAddressString(adv.address); + + if (Powermon::hasWifi(adv.hardware_revision_bcd)) + str = Powermon::getIpAddressString(adv.address); + else + str = Powermon::getMacAddressString(adv.address); + + mLocalDeviceListCtrl->SetItem(index, 14, str); + + str.Printf(wxT("%ddBm"), adv.rssi); + mLocalDeviceListCtrl->SetItem(index, 15, str); + + mLocalDeviceListCtrl->RefreshItem(index); +} + + +void GuiMain::UpdateCloudDeviceList(void) +{ + mCloudDeviceListCtrl->DeleteAllItems(); + + for(auto &id: Model::getInstance().cloudDeviceList) + { + size_t index = mCloudDeviceListCtrl->GetItemCount(); + + index = mCloudDeviceListCtrl->InsertItem(index, wxString(id.name.c_str(), wxConvUTF8)); + + mCloudDeviceListCtrl->SetItem(index, 1, Powermon::getHardwareString(id.hardware_revision_bcd)); + + wxString str; + str.Printf(wxT("%" PRIX64), id.serial); + mCloudDeviceListCtrl->SetItem(index, 2, str); + } + + mDeviceListNotebook->SetSelection(1); +} + + +void GuiMain::OnListSelection(wxListEvent &event) +{ + int32_t index = -1; + + if (mDeviceListNotebook->GetSelection() == 0) + index = mLocalDeviceListCtrl->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); + else if (mDeviceListNotebook->GetSelection() == 1) + index = mCloudDeviceListCtrl->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); + + mDeviceConnectButton->Enable(index >= 0); +} + + +void GuiMain::OnListActivation(wxListEvent &event) +{ + startConnection(); +} + + +void GuiMain::OnButtonConnectClicked(wxCommandEvent &event) +{ + startConnection(); +} + + +void GuiMain::OnScrubDeviceListTimerEvent(wxTimerEvent &event) +{ + uint32_t index = 0; + for(auto it = mLocalDeviceList.begin(); it != mLocalDeviceList.end();) + { + if ((wxGetUTCTimeMillis() - it->timestamp) >= 10000) + { + it = mLocalDeviceList.erase(it); + mLocalDeviceListCtrl->DeleteItem(index); + } + else + { + ++it; + index++; + } + } +} + + +void GuiMain::startConnection(void) +{ + if (mDeviceListNotebook->GetSelection() == 0) + { + const int32_t index = mLocalDeviceListCtrl->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); + + if (index >= 0) + { + Powermon::DeviceIdentifier did; + + const DeviceListItem &device = mLocalDeviceList[index]; + + did.name = device.adv.name; + did.serial = device.adv.serial; + did.hardware_revision_bcd = device.adv.hardware_revision_bcd; + did.address = device.adv.address; + + PowermonScanner* scanner = Powermon::hasWifi(device.adv.hardware_revision_bcd) ? nullptr : mPowermonScanner; + + GuiDevice* device_window = new GuiDevice(this, did, scanner); + mDevices.push_back(device_window); + + device_window->SetFocus(); + device_window->Show(); + } + } + else if (mDeviceListNotebook->GetSelection() == 1) + { + const int32_t index = mCloudDeviceListCtrl->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); + + if (index >= 0) + { + const auto cloudDeviceList = Model::getInstance().cloudDeviceList; + const Powermon::DeviceIdentifier &did = cloudDeviceList[index]; + + GuiDevice* device_window = new GuiDevice(this, did, nullptr); + mDevices.push_back(device_window); + + device_window->SetFocus(); + device_window->Show(); + } + } +} + + +void GuiMain::OnMenuDeviceAdd(wxCommandEvent &event) +{ + GuiEnterString dialog(this, wxID_ANY, wxT("Enter PowerMon-W device link"), false, false); + dialog.setMaxStringLength(255); + dialog.setStringLabel(wxT("Device link")); + if (dialog.ShowModal() != wxID_OK) + return; + + char link[256]; + memcpy(link, dialog.getString().mb_str(), dialog.getString().size()); + link[dialog.getString().size()] = 0; + + Powermon::DeviceIdentifier id; + + if (id.fromURL(link)) + Model::getInstance().addCloudDevice(id); + else + wxMessageDialog msg(this, wxT("Invalid PowerMon-W device link"), wxT("Error"), wxOK | wxSTAY_ON_TOP | wxCENTRE | wxICON_ERROR); +} + + +void GuiMain::OnMenuDeviceDirectConnect(wxCommandEvent &event) +{ + wxMessageDialog msg(this, + wxT("Please power up your PowerMon-W battery monitor. \n" + "If you previously disabled the AP mode of your device, power cycle it.\n" + "Use your computer WiFi settings to connect to the device.\b" + "Your device will show up looking like: PMON_12A456B8.\n" + "The password is: powermon"), + wxT("Instructions"), wxCANCEL | wxOK | wxSTAY_ON_TOP | wxCENTRE); + + Powermon::DeviceIdentifier did; + did.address = inet_addr("192.168.100.1"); + did.hardware_revision_bcd = 0x40; + + GuiDevice* device_window = new GuiDevice(this, did, mPowermonScanner); + device_window->SetFocus(); + device_window->Show(); + + mDevices.push_back(device_window); +} + + +void GuiMain::OnMenuHelpAbout(wxCommandEvent &event) +{ + wxString message; + message.Printf(wxT("%s v%X.%02X. (C) Thornwave Labs Inc.\n\n"), + g_version_tag, g_version_bcd >> 8, g_version_bcd & 0xFF); + + wxMessageDialog msg(this, message, wxT("About"), wxOK | wxSTAY_ON_TOP | wxCENTRE); + msg.ShowModal(); +} + + + +void GuiMain::OnClose(wxCloseEvent &event) +{ + Destroy(); +} + + + +void GuiMain::OnGuiEvent(GuiEvent &event) +{ + event.process(); +} + + +BEGIN_EVENT_TABLE(GuiMain, wxFrame) +EVT_CLOSE(GuiMain::OnClose) +GUI_EVT(GuiMain::OnGuiEvent) + +EVT_LIST_ITEM_ACTIVATED(ID_LISTBOX_LOCAL_DEVICE_LIST, GuiMain::OnListActivation) +EVT_LIST_ITEM_ACTIVATED(ID_LISTBOX_CLOUD_DEVICE_LIST, GuiMain::OnListActivation) +EVT_LIST_ITEM_SELECTED(ID_LISTBOX_LOCAL_DEVICE_LIST, GuiMain::OnListSelection) +EVT_LIST_ITEM_SELECTED(ID_LISTBOX_CLOUD_DEVICE_LIST, GuiMain::OnListSelection) +EVT_LIST_ITEM_DESELECTED(ID_LISTBOX_LOCAL_DEVICE_LIST, GuiMain::OnListSelection) +EVT_LIST_ITEM_DESELECTED(ID_LISTBOX_CLOUD_DEVICE_LIST, GuiMain::OnListSelection) + +EVT_BUTTON(ID_BUTTON_DEVICE_CONNECT, GuiMain::OnButtonConnectClicked) + +EVT_TIMER(ID_SCRUB_TIMER, GuiMain::OnScrubDeviceListTimerEvent) + +EVT_MENU(ID_MENU_ADD_DEVICE, GuiMain::OnMenuDeviceAdd) +EVT_MENU(ID_MENU_DIRECT_CONNECT, GuiMain::OnMenuDeviceDirectConnect) +EVT_MENU(wxID_ABOUT, GuiMain::OnMenuHelpAbout) + +END_EVENT_TABLE() + diff --git a/gui/gui_main.h b/gui/gui_main.h new file mode 100644 index 0000000..3505b19 --- /dev/null +++ b/gui/gui_main.h @@ -0,0 +1,96 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _GUI_MAIN_H +#define _GUI_MAIN_H + + +#include +#include +#include + +#include + +#include +#include + + +class GuiMain: public wxFrame +{ +public: + GuiMain(); + ~GuiMain(); + + void UpdateCloudDeviceList(void); + +private: + enum + { + ID_LISTBOX_LOCAL_DEVICE_LIST = wxID_HIGHEST + 1, + ID_LISTBOX_CLOUD_DEVICE_LIST, + ID_BUTTON_DEVICE_CONNECT, + ID_MENU_ADD_DEVICE, + ID_MENU_DIRECT_CONNECT, + + ID_SCRUB_TIMER + }; + + struct DeviceListItem + { + int64_t timestamp; + PowermonScanner::Advertisment adv; + }; + + wxTimer *mScrubTimer; + + wxMenuBar* mMenuBar; + wxMenu* mDeviceMenu; + + wxNotebook* mDeviceListNotebook; + + wxListCtrl* mLocalDeviceListCtrl; + wxListCtrl* mCloudDeviceListCtrl; + + wxButton* mDeviceConnectButton; + + PowermonScanner* mPowermonScanner; + std::vector mLocalDeviceList; + + std::vector mDevices; + + void OnListSelection(wxListEvent &event); + void OnListActivation(wxListEvent &event); + + void OnScrubDeviceListTimerEvent(wxTimerEvent &event); + + void OnButtonConnectClicked(wxCommandEvent &event); + + void OnMenuDeviceAdd(wxCommandEvent &event); + void OnMenuDeviceDirectConnect(wxCommandEvent &event); + + void OnMenuHelpAbout(wxCommandEvent &event); + void OnClose(wxCloseEvent &event); + void OnGuiEvent(GuiEvent &event); + + + void startConnection(void); + void UpdateLocalDeviceList(int32_t index, const PowermonScanner::Advertisment &adv); + + DECLARE_EVENT_TABLE() +}; + +#endif diff --git a/gui/gui_parser.cpp b/gui/gui_parser.cpp new file mode 100644 index 0000000..a45ee96 --- /dev/null +++ b/gui/gui_parser.cpp @@ -0,0 +1,55 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + + +float ParseTextCtrlFloat(wxTextCtrl* text, const wxString &label) +{ + double value_double; + + wxString value = text->GetValue(); + if (value.ToDouble(&value_double)) + return value_double; + else + { + wxString error_message = label; + error_message += wxT(" value is not valid"); + + throw ParserException(error_message); + } +} + + + +int32_t ParseTextCtrlInt(wxTextCtrl* text, const wxString &label) +{ + long value_int; + + wxString value = text->GetValue(); + if (value.ToLong(&value_int)) + return value_int; + else + { + wxString error_message = label; + error_message += wxT(" value is not valid"); + + throw ParserException(error_message); + } +} + + diff --git a/gui/gui_parser.h b/gui/gui_parser.h new file mode 100644 index 0000000..b6f3e2a --- /dev/null +++ b/gui/gui_parser.h @@ -0,0 +1,57 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _GUI_PARSER_H +#define _GUI_PARSER_H + + +#include + + +class ParserException +{ +public: +/** + \brief Constructor + + Initializes an exception object + + \param message The error message +*/ + ParserException(const wxString &message) throw(): mMessage(message) + { + } + + ~ParserException() throw() {} + + wxString what() const throw() /// + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + + +GuiStats::GuiStats(wxWindow *parent, const wxString &title, Powermon &powermon): wxDialog(parent, wxID_ANY, title), mPowermon(powermon) +{ + const size_t BORDER_SIZE = FromDIP(6); + + mSecondsSinceOnText = new wxStaticText(this, wxID_ANY, wxT("")); + mVoltage1MaxText = new wxStaticText(this, wxID_ANY, wxT("")); + mVoltage1MinText = new wxStaticText(this, wxID_ANY, wxT("")); + mVoltage2MaxText = new wxStaticText(this, wxID_ANY, wxT("")); + mVoltage2MinText = new wxStaticText(this, wxID_ANY, wxT("")); + mPeakChargeCurrentText = new wxStaticText(this, wxID_ANY, wxT("")); + mPeakDischargeCurrentText = new wxStaticText(this, wxID_ANY, wxT("")); + mTemperatureMaxText = new wxStaticText(this, wxID_ANY, wxT("")); + mTemperatureMinText = new wxStaticText(this, wxID_ANY, wxT("")); + + mResetButton = new wxButton(this, ID_BUTTON_RESET, wxT("Reset"), wxDefaultPosition, FromDIP(wxSize(110, 40))); + mCloseButton = new wxButton(this, wxID_CANCEL, wxT("Close"), wxDefaultPosition, FromDIP(wxSize(110, 40))); + + //main window sizer + wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL); + SetSizer(main_sizer); + + wxBoxSizer* h_sizer; + + h_sizer = new wxBoxSizer(wxHORIZONTAL); + h_sizer->Add(new wxStaticText(this, wxID_ANY, wxT("Time Since Powered On:")), 0, wxALL | wxALIGN_CENTER, BORDER_SIZE); + h_sizer->Add(mSecondsSinceOnText, 0, wxALL | wxALIGN_CENTER, BORDER_SIZE); + main_sizer->Add(h_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + h_sizer = new wxBoxSizer(wxHORIZONTAL); + h_sizer->Add(new wxStaticText(this, wxID_ANY, wxT("Minimum Voltage 1:")), 0, wxALL | wxALIGN_CENTER, BORDER_SIZE); + h_sizer->Add(mVoltage1MinText, 0, wxALL | wxALIGN_CENTER, BORDER_SIZE); + main_sizer->Add(h_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + h_sizer = new wxBoxSizer(wxHORIZONTAL); + h_sizer->Add(new wxStaticText(this, wxID_ANY, wxT("Maximum Voltage 1:")), 0, wxALL | wxALIGN_CENTER, BORDER_SIZE); + h_sizer->Add(mVoltage1MaxText, 0, wxALL | wxALIGN_CENTER, BORDER_SIZE); + main_sizer->Add(h_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + h_sizer = new wxBoxSizer(wxHORIZONTAL); + h_sizer->Add(new wxStaticText(this, wxID_ANY, wxT("Minimum Voltage 2:")), 0, wxALL | wxALIGN_CENTER, BORDER_SIZE); + h_sizer->Add(mVoltage2MinText, 0, wxALL | wxALIGN_CENTER, BORDER_SIZE); + main_sizer->Add(h_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + h_sizer = new wxBoxSizer(wxHORIZONTAL); + h_sizer->Add(new wxStaticText(this, wxID_ANY, wxT("Maximum Voltage 2:")), 0, wxALL | wxALIGN_CENTER, BORDER_SIZE); + h_sizer->Add(mVoltage2MaxText, 0, wxALL | wxALIGN_CENTER, BORDER_SIZE); + main_sizer->Add(h_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + h_sizer = new wxBoxSizer(wxHORIZONTAL); + h_sizer->Add(new wxStaticText(this, wxID_ANY, wxT("Peak Discharge Current:")), 0, wxALL | wxALIGN_CENTER, BORDER_SIZE); + h_sizer->Add(mPeakDischargeCurrentText, 0, wxALL | wxALIGN_CENTER, BORDER_SIZE); + main_sizer->Add(h_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + h_sizer = new wxBoxSizer(wxHORIZONTAL); + h_sizer->Add(new wxStaticText(this, wxID_ANY, wxT("Peak Charge Current:")), 0, wxALL | wxALIGN_CENTER, BORDER_SIZE); + h_sizer->Add(mPeakChargeCurrentText, 0, wxALL | wxALIGN_CENTER, BORDER_SIZE); + main_sizer->Add(h_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + h_sizer = new wxBoxSizer(wxHORIZONTAL); + h_sizer->Add(new wxStaticText(this, wxID_ANY, wxT("Minimum Temperature:")), 0, wxALL | wxALIGN_CENTER, BORDER_SIZE); + h_sizer->Add(mTemperatureMinText, 0, wxALL | wxALIGN_CENTER, BORDER_SIZE); + main_sizer->Add(h_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + h_sizer = new wxBoxSizer(wxHORIZONTAL); + h_sizer->Add(new wxStaticText(this, wxID_ANY, wxT("Maximum Temperature:")), 0, wxALL | wxALIGN_CENTER, BORDER_SIZE); + h_sizer->Add(mTemperatureMaxText, 0, wxALL | wxALIGN_CENTER, BORDER_SIZE); + main_sizer->Add(h_sizer, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); + + h_sizer = new wxBoxSizer(wxHORIZONTAL); + h_sizer->Add(mResetButton, 0, wxALIGN_CENTER | wxALL, BORDER_SIZE); + h_sizer->Add(mCloseButton, 0, wxALIGN_CENTER | wxALL, BORDER_SIZE); + main_sizer->Add(h_sizer, 0, wxALL | wxALIGN_CENTER, BORDER_SIZE); + + main_sizer->SetSizeHints(this); + Centre(); + + mStatsTimer = new wxTimer(this, ID_STATS_TIMER); +} + + +GuiStats::~GuiStats() +{ + delete mStatsTimer; +} + +bool GuiStats::Show(bool show) +{ + if (show) + { + mStatsTimer->Start(1000); + updateStats(); + } + else + { + mStatsTimer->Stop(); + } + + return wxDialog::Show(show); +} + + +void GuiStats::OnGuiEvent(GuiEvent &event) +{ + event.process(); +} + + +void GuiStats::OnButtonResetClicked(wxCommandEvent &event) +{ + wxMessageDialog msg(this, wxT("Reset the power meter statistics ?"), wxT("Confirmation"), wxOK | wxCANCEL | wxICON_QUESTION | wxSTAY_ON_TOP | wxCENTRE); + if (msg.ShowModal() == wxID_OK) + { + mPowermon.requestResetStatistics([this](uint16_t status) + { + wxQueueEvent(this, new GuiEvent([this, status](const GuiEvent &event) + { + checkDeviceError(this, status); + })); + }); + } +} + + +void GuiStats::OnStatsTimerEvent(wxTimerEvent &event) +{ + updateStats(); +} + + +void GuiStats::updateStats(void) +{ + mPowermon.requestGetStatistics([this](uint16_t status, const Powermon::MonitorStatistics &stats) + { + wxQueueEvent(this, new GuiEvent([this, status, stats](const GuiEvent &event) + { + if (status == Powermon::RSP_SUCCESS) + { + wxString str; + + uint32_t seconds = stats.seconds_since_on; + + uint32_t days = seconds / (3600 * 24); + seconds -= days * 3600 * 24; + + uint32_t hours = seconds / 3600; + seconds -= hours * 3600; + + uint32_t minutes = seconds / 60; + seconds -= minutes * 60; + + if (days) + str.Printf(wxT("%ud %uh %um"), days, hours, minutes); + else if (hours) + str.Printf(wxT("%uh %um %us"), hours, minutes, seconds); + else + str.Printf(wxT("%um %us"), minutes, seconds); + + mSecondsSinceOnText->SetLabel(str); + + str.Printf(wxT("%6.3f V"), stats.voltage1_min); + mVoltage1MinText->SetLabel(str); + str.Printf(wxT("%6.3f V"), stats.voltage1_max); + mVoltage1MaxText->SetLabel(str); + + if (!isnan(stats.voltage2_min)) + { + str.Printf(wxT("%6.3f V"), stats.voltage2_min); + mVoltage2MinText->SetLabel(str); + } + else + { + mVoltage2MinText->SetLabel(wxT("n/a")); + } + + if (!isnan(stats.voltage2_max)) + { + str.Printf(wxT("%6.3f V"), stats.voltage2_max); + mVoltage2MaxText->SetLabel(str); + } + else + { + mVoltage2MaxText->SetLabel(wxT("n/a")); + } + + str.Printf(wxT("%6.2f A"), stats.peak_charge_current); + mPeakChargeCurrentText->SetLabel(str); + + str.Printf(wxT("%6.2f A"), stats.peak_discharge_current); + mPeakDischargeCurrentText->SetLabel(str); + + str.Printf(wxT("%3.0f \u00B0C"), stats.temperature_min); + mTemperatureMinText->SetLabel(str); + str.Printf(wxT("%3.0f \u00B0C"), stats.temperature_max); + mTemperatureMaxText->SetLabel(str); + + Refresh(); + } + })); + }); +} + + +void GuiStats::OnClose(wxCloseEvent &event) +{ + mStatsTimer->Stop(); + Hide(); +} + + +void GuiStats::OnButtonCloseClicked(wxCommandEvent &event) +{ + Close(); +} + + +BEGIN_EVENT_TABLE(GuiStats, wxDialog) +EVT_CLOSE(GuiStats::OnClose) +GUI_EVT(GuiStats::OnGuiEvent) + +EVT_BUTTON(wxID_CANCEL, GuiStats::OnButtonCloseClicked) +EVT_BUTTON(ID_BUTTON_RESET, GuiStats::OnButtonResetClicked) + +EVT_TIMER(ID_STATS_TIMER, GuiStats::OnStatsTimerEvent) + +END_EVENT_TABLE() diff --git a/gui/gui_stats.h b/gui/gui_stats.h new file mode 100644 index 0000000..cf57d54 --- /dev/null +++ b/gui/gui_stats.h @@ -0,0 +1,77 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _GUI_STATS_H +#define _GUI_STATS_H + + +#include +#include + + +class GuiStats: public wxDialog +{ +public: + GuiStats(wxWindow* parent, const wxString &title, Powermon &powermon); + ~GuiStats(); + + bool Show(bool show = true) override final; + +private: + enum + { + ID_STATS_TIMER = wxID_HIGHEST + 1, + ID_BUTTON_RESET, + }; + + Powermon &mPowermon; + + wxTimer* mStatsTimer; + + wxStaticText* mSecondsSinceOnText; + + wxStaticText* mVoltage1MinText; + wxStaticText* mVoltage1MaxText; + + wxStaticText* mVoltage2MinText; + wxStaticText* mVoltage2MaxText; + + wxStaticText* mPeakChargeCurrentText; + wxStaticText* mPeakDischargeCurrentText; + + wxStaticText* mTemperatureMinText; + wxStaticText* mTemperatureMaxText; + + wxButton* mResetButton; + wxButton* mCloseButton; + + void OnGuiEvent(GuiEvent &event); + + void OnStatsTimerEvent(wxTimerEvent &event); + + void OnButtonResetClicked(wxCommandEvent &event); + void OnButtonCloseClicked(wxCommandEvent &event); + void OnClose(wxCloseEvent &event); + + void updateStats(void); + + DECLARE_EVENT_TABLE() +}; + + +#endif + diff --git a/gui/gui_string_dialog.cpp b/gui/gui_string_dialog.cpp new file mode 100644 index 0000000..3f65f0a --- /dev/null +++ b/gui/gui_string_dialog.cpp @@ -0,0 +1,113 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + + +GuiEnterString::GuiEnterString(wxWindow *parent, wxWindowID id, const wxString &title, bool password, bool confirm): wxDialog(parent, id, title), + mMaxStringLength(-1), mPassword(password), mConfirm(confirm) +{ + const size_t BORDER_SIZE = FromDIP(6); + + //main window sizer + wxBoxSizer *main_sizer = new wxBoxSizer(wxVERTICAL); + SetSizer(main_sizer); + + mStringText = new wxTextCtrl(this, ID_STRING, wxT(""), wxDefaultPosition, wxDefaultSize, mPassword ? wxTE_PASSWORD : 0); + mStringLabel = new wxStaticText(this, wxID_ANY, wxT("")); + + if (mConfirm) + { + mConfirmStringText = new wxTextCtrl(this, ID_CONFIRM_STRING, wxT(""), wxDefaultPosition, wxDefaultSize, mPassword ? wxTE_PASSWORD : 0); + mConfirmLabel = new wxStaticText(this, wxID_ANY, wxT("")); + } + + main_sizer->AddSpacer(10); + main_sizer->Add(mStringLabel, 0, wxEXPAND); + main_sizer->Add(mStringText, 0, wxALL | wxEXPAND, BORDER_SIZE); + main_sizer->AddSpacer(10); + + if (mConfirm) + { + main_sizer->Add(mConfirmLabel, 0, wxEXPAND); + main_sizer->Add(mConfirmStringText, 0, wxALL | wxEXPAND, BORDER_SIZE); + main_sizer->AddSpacer(10); + } + + mErrorLabel = new wxStaticText(this, wxID_ANY, wxT("")); + mErrorLabel->SetForegroundColour(*wxRED); + main_sizer->Add(mErrorLabel, 0, wxALL | wxEXPAND, BORDER_SIZE); + + wxBoxSizer *h_sizer = new wxBoxSizer(wxHORIZONTAL); + main_sizer->Add(h_sizer, 1, wxALL | wxEXPAND, BORDER_SIZE); + + wxButton* button = new wxButton(this, wxID_CANCEL, wxT("Cancel"), wxDefaultPosition, FromDIP(wxSize(150, 40))); + h_sizer->Add(button, 0, wxALL | wxCENTER, BORDER_SIZE); + + mContinueButton = new wxButton(this, wxID_OK, wxT("Continue"), wxDefaultPosition, FromDIP(wxSize(150, 40))); + h_sizer->Add(mContinueButton, 0, wxALL | wxCENTER, BORDER_SIZE); + + main_sizer->SetSizeHints(this); + Centre(); + + Bind(wxEVT_COMMAND_TEXT_UPDATED, &GuiEnterString::OnTextCtrlUpdated, this, ID_STRING); + + if (mConfirm) + Bind(wxEVT_COMMAND_TEXT_UPDATED, &GuiEnterString::OnTextCtrlUpdated, this, ID_CONFIRM_STRING); +} + + +GuiEnterString::~GuiEnterString() +{ +} + + +void GuiEnterString::OnTextCtrlUpdated(wxCommandEvent &event) +{ + wxString pass1 = mStringText->GetValue(); + bool enable = true; + + if (pass1.size() > mMaxStringLength) + { + mErrorLabel->SetLabel(wxT("string is too long")); + enable = false; + } + else + { + if (mConfirm) + { + wxString pass2 = mConfirmStringText->GetValue(); + + if (pass1 == pass2) + { + mErrorLabel->SetLabel(wxT("")); + } + else + { + mErrorLabel->SetLabel(wxT("passwords do not match")); + enable = false; + } + } + else + { + mErrorLabel->SetLabel(wxT("")); + } + } + + mErrorLabel->Refresh(); + mContinueButton->Enable(enable); +} diff --git a/gui/gui_string_dialog.h b/gui/gui_string_dialog.h new file mode 100644 index 0000000..7d62687 --- /dev/null +++ b/gui/gui_string_dialog.h @@ -0,0 +1,80 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _GUI_STRING_DIALOG_H +#define _GUI_STRING_DIALOG_H + + +#include + + +class GuiEnterString : public wxDialog +{ +public: + + GuiEnterString(wxWindow *parent, wxWindowID id, const wxString &title, bool password, bool confirm); + ~GuiEnterString(); + + void setStringLabel(const wxString &string) + { + mStringLabel->SetLabel(string); + mStringLabel->Refresh(); + } + + void setConfirmLabel(const wxString &string) + { + mConfirmLabel->SetLabel(string); + mConfirmLabel->Refresh(); + } + + void setMaxStringLength(size_t max_length) + { + mMaxStringLength = max_length; + } + + wxString getString(void) const + { + return mStringText->GetValue(); + } + + +private: + enum + { + ID_STRING = wxID_HIGHEST + 1, + ID_CONFIRM_STRING, + }; + + bool mPassword; + bool mConfirm; + + size_t mMaxStringLength; + + wxStaticText* mStringLabel; + wxStaticText* mConfirmLabel; + + wxButton* mContinueButton; + wxStaticText* mErrorLabel; + + wxTextCtrl* mStringText; + wxTextCtrl* mConfirmStringText; + + void OnTextCtrlUpdated(wxCommandEvent &event); +}; + + +#endif diff --git a/gui/gui_timers_dialog.cpp b/gui/gui_timers_dialog.cpp new file mode 100644 index 0000000..338f886 --- /dev/null +++ b/gui/gui_timers_dialog.cpp @@ -0,0 +1,616 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + + +GuiTimersDialog::GuiTimersDialog(wxWindow *parent, const std::vector &schedules): wxDialog(parent, wxID_ANY, wxT("Powermon Timers"), wxDefaultPosition, wxDefaultSize), + mSchedules(schedules) +{ + const size_t BORDER_SIZE = FromDIP(6); + + mTimerListBox = new wxListBox(this, ID_LISTBOX_TIMER_LIST, wxDefaultPosition, FromDIP(wxSize(240, 370)), 0, nullptr, wxLB_SINGLE | wxLB_NEEDED_SB); + + mAddButton = new wxButton(this, ID_BUTTON_ADD, wxT("Add New Timer"), wxDefaultPosition, FromDIP(wxSize(120, 40))); + mDeleteButton = new wxButton(this, ID_BUTTON_DELETE, wxT("Delete Timer"), wxDefaultPosition, FromDIP(wxSize(120, 40))); + mSaveButton = new wxButton(this, ID_BUTTON_SAVE, wxT("Save Timers"), wxDefaultPosition, FromDIP(wxSize(120, 40))); + mCancelButton = new wxButton(this, ID_BUTTON_CANCEL, wxT("Cancel"), wxDefaultPosition, FromDIP(wxSize(120, 40))); + + mTimerNameText = new wxTextCtrl(this, ID_TEXT_TIMER_NAME, wxT(""), wxDefaultPosition, FromDIP(wxSize(180, 30))); + mTimerNameText->SetMaxLength(MAX_TIMER_NAME_LENGTH); + + mStartCheckBox = new wxCheckBox(this, ID_CHECKBOX_START, wxT("Enable start time"), wxDefaultPosition, wxDefaultSize); + + mStartHourChoice = new wxChoice(this, ID_CHOICE_TIMER_VALUE, wxDefaultPosition, FromDIP(wxSize(90, 30))); + mStartHourChoice->Append(wxT("12 AM")); + mStartHourChoice->Append(wxT("1 AM")); + mStartHourChoice->Append(wxT("2 AM")); + mStartHourChoice->Append(wxT("3 AM")); + mStartHourChoice->Append(wxT("4 AM")); + mStartHourChoice->Append(wxT("5 AM")); + mStartHourChoice->Append(wxT("6 AM")); + mStartHourChoice->Append(wxT("7 AM")); + mStartHourChoice->Append(wxT("8 AM")); + mStartHourChoice->Append(wxT("9 AM")); + mStartHourChoice->Append(wxT("10 AM")); + mStartHourChoice->Append(wxT("11 AM")); + mStartHourChoice->Append(wxT("12 PM")); + mStartHourChoice->Append(wxT("1 PM")); + mStartHourChoice->Append(wxT("2 PM")); + mStartHourChoice->Append(wxT("3 PM")); + mStartHourChoice->Append(wxT("4 PM")); + mStartHourChoice->Append(wxT("5 PM")); + mStartHourChoice->Append(wxT("6 PM")); + mStartHourChoice->Append(wxT("7 PM")); + mStartHourChoice->Append(wxT("8 PM")); + mStartHourChoice->Append(wxT("9 PM")); + mStartHourChoice->Append(wxT("10 PM")); + mStartHourChoice->Append(wxT("11 PM")); + + + mEndCheckBox = new wxCheckBox(this, ID_CHECKBOX_END, wxT("Enable start time"), wxDefaultPosition, wxDefaultSize); + + mEndHourChoice = new wxChoice(this, ID_CHOICE_TIMER_VALUE, wxDefaultPosition, FromDIP(wxSize(90, 30))); + mEndHourChoice->Append(wxT("12 AM")); + mEndHourChoice->Append(wxT("1 AM")); + mEndHourChoice->Append(wxT("2 AM")); + mEndHourChoice->Append(wxT("3 AM")); + mEndHourChoice->Append(wxT("4 AM")); + mEndHourChoice->Append(wxT("5 AM")); + mEndHourChoice->Append(wxT("6 AM")); + mEndHourChoice->Append(wxT("7 AM")); + mEndHourChoice->Append(wxT("8 AM")); + mEndHourChoice->Append(wxT("9 AM")); + mEndHourChoice->Append(wxT("10 AM")); + mEndHourChoice->Append(wxT("11 AM")); + mEndHourChoice->Append(wxT("12 PM")); + mEndHourChoice->Append(wxT("1 PM")); + mEndHourChoice->Append(wxT("2 PM")); + mEndHourChoice->Append(wxT("3 PM")); + mEndHourChoice->Append(wxT("4 PM")); + mEndHourChoice->Append(wxT("5 PM")); + mEndHourChoice->Append(wxT("6 PM")); + mEndHourChoice->Append(wxT("7 PM")); + mEndHourChoice->Append(wxT("8 PM")); + mEndHourChoice->Append(wxT("9 PM")); + mEndHourChoice->Append(wxT("10 PM")); + mEndHourChoice->Append(wxT("11 PM")); + + mStartMinuteChoice = new wxChoice(this, ID_CHOICE_TIMER_VALUE, wxDefaultPosition, FromDIP(wxSize(90, 30))); + mEndMinuteChoice = new wxChoice(this, ID_CHOICE_TIMER_VALUE, wxDefaultPosition, FromDIP(wxSize(90, 30))); + + for(uint32_t i = 0; i < 60; i++) + { + wxString str; + str.Printf(wxT("%u"), i); + mStartMinuteChoice->Append(str); + mEndMinuteChoice->Append(str); + } + + mRepeatModeChoice = new wxChoice(this, ID_CHOICE_TIMER_REPEAT_MODE, wxDefaultPosition, FromDIP(wxSize(140, 30))); + mRepeatModeChoice->Append(wxT("Day of Week")); + mRepeatModeChoice->Append(wxT("Day of Month")); + + mMondayCheckBox = new wxCheckBox(this, ID_CHOICE_TIMER_VALUE, wxT("Monday"), wxDefaultPosition, wxDefaultSize); + mTuesdayCheckBox = new wxCheckBox(this, ID_CHOICE_TIMER_VALUE, wxT("Tuesday"), wxDefaultPosition, wxDefaultSize); + mWednesdayCheckBox = new wxCheckBox(this, ID_CHOICE_TIMER_VALUE, wxT("Wednesday"), wxDefaultPosition, wxDefaultSize); + mThursdayCheckBox = new wxCheckBox(this, ID_CHOICE_TIMER_VALUE, wxT("Thursday"), wxDefaultPosition, wxDefaultSize); + mFridayCheckBox = new wxCheckBox(this, ID_CHOICE_TIMER_VALUE, wxT("Friday"), wxDefaultPosition, wxDefaultSize); + mSaturdayCheckBox = new wxCheckBox(this, ID_CHOICE_TIMER_VALUE, wxT("Saturday"), wxDefaultPosition, wxDefaultSize); + mSundayCheckBox = new wxCheckBox(this, ID_CHOICE_TIMER_VALUE, wxT("Sunday"), wxDefaultPosition, wxDefaultSize); + mDayOfMonthChoice = new wxChoice(this, ID_CHOICE_TIMER_VALUE, wxDefaultPosition, FromDIP(wxSize(100, 30))); + + for(uint32_t i = 1; i < 32; i++) + { + wxString str; + str.Printf(wxT("%u"), i); + mDayOfMonthChoice->Append(str); + } + + + //main window sizer + wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL); + SetSizer(main_sizer); + + wxBoxSizer *main_h_sizer, *main_v_sizer; + wxBoxSizer *h_sizer, *v_sizer; + + main_h_sizer = new wxBoxSizer(wxHORIZONTAL); + + //timer list + main_v_sizer = new wxBoxSizer(wxVERTICAL); + main_v_sizer->Add(new wxStaticText(this, wxID_ANY, wxT("Timer List")), 0, wxALIGN_LEFT, BORDER_SIZE); + main_v_sizer->Add(mTimerListBox, 1, wxEXPAND | wxALL, 0); + + main_h_sizer->Add(main_v_sizer, 1, wxEXPAND | wxALL, 10); + + + main_v_sizer = new wxBoxSizer(wxVERTICAL); + //start of a row + main_v_sizer->Add(new wxStaticText(this, wxID_ANY, wxT("Timer Name")), 0, wxBOTTOM, BORDER_SIZE); + main_v_sizer->Add(mTimerNameText, 0, wxALL, 0); + main_v_sizer->AddSpacer(FromDIP(20)); + + //start of a row + main_v_sizer->Add(new wxStaticText(this, wxID_ANY, wxT("Start Time")), 0, wxBOTTOM, BORDER_SIZE); + main_v_sizer->Add(mStartCheckBox, 0, wxBOTTOM, BORDER_SIZE); + + h_sizer = new wxBoxSizer(wxHORIZONTAL); + h_sizer->Add(new wxStaticText(this, wxID_ANY, wxT("Hour")), 0, wxALIGN_CENTER, 0); + h_sizer->Add(mStartHourChoice, 0, wxALL | wxALIGN_CENTER, 0); + h_sizer->AddSpacer(FromDIP(20)); + h_sizer->Add(new wxStaticText(this, wxID_ANY, wxT("Minute")), 0, wxALIGN_CENTER, 0); + h_sizer->Add(mStartMinuteChoice, 0, wxALL | wxALIGN_CENTER, 0); + main_v_sizer->Add(h_sizer, 0, wxALL, 0); + main_v_sizer->AddSpacer(FromDIP(20)); + + + //start of a row + main_v_sizer->Add(new wxStaticText(this, wxID_ANY, wxT("End Time")), 0, wxBOTTOM, BORDER_SIZE); + + main_v_sizer->Add(mEndCheckBox, 0, wxBOTTOM, BORDER_SIZE); + + h_sizer = new wxBoxSizer(wxHORIZONTAL); + h_sizer->Add(new wxStaticText(this, wxID_ANY, wxT("Hour")), 0, wxALIGN_CENTER, 0); + h_sizer->Add(mEndHourChoice, 0, wxALL | wxALIGN_CENTER, 0); + h_sizer->AddSpacer(20); + h_sizer->Add(new wxStaticText(this, wxID_ANY, wxT("Minute")), 0, wxALIGN_CENTER, 0); + h_sizer->Add(mEndMinuteChoice, 0, wxALL | wxALIGN_CENTER, 0); + main_v_sizer->Add(h_sizer, 0, wxALL, 0); + main_v_sizer->AddSpacer(FromDIP(20)); + + + //start of a row + h_sizer = new wxBoxSizer(wxHORIZONTAL); + + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(this, wxID_ANY, wxT("Repeat Mode")), 0, wxBOTTOM, BORDER_SIZE); + v_sizer->Add(mRepeatModeChoice, 0, wxALL, 0); + h_sizer->Add(v_sizer, 0, wxLEFT | wxRIGHT, 10); + h_sizer->AddSpacer(FromDIP(20)); + + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(new wxStaticText(this, wxID_ANY, wxT("Day Of Month")), 0, wxBOTTOM, BORDER_SIZE); + v_sizer->Add(mDayOfMonthChoice, 0, wxALL, 0); + h_sizer->Add(v_sizer, 0, wxLEFT | wxRIGHT, 10); + + main_v_sizer->Add(h_sizer, 0, wxALL, 0); + main_v_sizer->AddSpacer(FromDIP(20)); + + + //start of a row + h_sizer = new wxBoxSizer(wxHORIZONTAL); + + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(mMondayCheckBox, 0, wxALL, FromDIP(2)); + v_sizer->Add(mTuesdayCheckBox, 0, wxALL, FromDIP(2)); + v_sizer->Add(mWednesdayCheckBox, 0, wxALL, FromDIP(2)); + v_sizer->Add(mThursdayCheckBox, 0, wxALL, FromDIP(2)); + h_sizer->Add(v_sizer, 0, wxLEFT | wxRIGHT, BORDER_SIZE); + + v_sizer = new wxBoxSizer(wxVERTICAL); + v_sizer->Add(mFridayCheckBox, 0, wxALL, FromDIP(2)); + v_sizer->Add(mSaturdayCheckBox, 0, wxALL, FromDIP(2)); + v_sizer->Add(mSundayCheckBox, 0, wxALL, FromDIP(2)); + h_sizer->Add(v_sizer, 0, wxLEFT | wxRIGHT, BORDER_SIZE); + + main_v_sizer->Add(h_sizer, 0, wxEXPAND | wxALIGN_LEFT | wxTOP | wxBOTTOM, BORDER_SIZE); + + main_h_sizer->Add(main_v_sizer, 0, wxEXPAND | wxALIGN_LEFT | wxALL, BORDER_SIZE); + + main_sizer->Add(main_h_sizer, 0, wxALL, 0); + + + //start of a row + h_sizer = new wxBoxSizer(wxHORIZONTAL); + h_sizer->Add(mAddButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, BORDER_SIZE); + h_sizer->Add(mDeleteButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, BORDER_SIZE); + h_sizer->Add(mCancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, BORDER_SIZE); + h_sizer->Add(mSaveButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, BORDER_SIZE); + + main_sizer->Add(h_sizer, 0, wxALL, 0); + + main_sizer->SetSizeHints(this); + Centre(); + SetFocus(); + + for(const auto &s: mSchedules) + mTimerListBox->Append(wxString(s.getName(), wxConvUTF8)); + + listUpdated(); + + mAddButton->Enable(mTimerListBox->GetCount() < MAX_TIMER_COUNT); + mDeleteButton->Enable(mTimerListBox->GetCount() > 0); +} + + +void GuiTimersDialog::OnAddButtonClicked(wxCommandEvent &event) +{ + PowermonSchedule schedule; + mSchedules.push_back(schedule); + + mTimerListBox->Append(wxString(schedule.getName(), wxConvUTF8)); + mTimerListBox->SetSelection(mTimerListBox->GetCount() - 1); + + mTimerListBox->Refresh(); + + mAddButton->Enable(mTimerListBox->GetCount() < MAX_TIMER_COUNT); + mDeleteButton->Enable(true); + + listUpdated(); +} + + +void GuiTimersDialog::OnDeleteButtonClicked(wxCommandEvent &event) +{ + const long index = mTimerListBox->GetSelection(); + + mSchedules.erase(mSchedules.begin() + index); + + mTimerListBox->Delete(index); + mTimerListBox->SetSelection(-1); + mTimerListBox->Refresh(); + + mAddButton->Enable(true); + mDeleteButton->Enable(mTimerListBox->GetCount() > 0); + + listUpdated(); +} + + +void GuiTimersDialog::OnSaveButtonClicked(wxCommandEvent &event) +{ + //check for the validity of the schedules + bool valid = true; + + if (mSchedules.size() >= 2) + { + for(uint32_t i = 0; i < mSchedules.size() - 1; i++) + { + for(uint32_t j = i + 1; j < mSchedules.size(); j++) + { + if (mSchedules[i] == mSchedules[j]) + { + valid = false; + break; + } + + if (valid == false) + break; + } + } + } + + if (valid) + { + EndModal(wxID_OK); + } + else + { + wxMessageDialog msg(this, wxT("Duplicate timer"), wxT("Error"), wxOK | wxSTAY_ON_TOP | wxCENTRE | wxICON_ERROR); + msg.ShowModal(); + } +} + + +void GuiTimersDialog::OnTimerNameChanged(wxCommandEvent &event) +{ + if (mTimerNameText->IsModified() == false) + return; + + const long index = mTimerListBox->GetSelection(); + if (index >= 0) + { + PowermonSchedule &s = mSchedules[index]; + + const wxString name = mTimerNameText->GetValue(); + s.setName(name.mb_str()); + mTimerListBox->SetString(index, name); + } +} + + +void GuiTimersDialog::OnCancelButtonClicked(wxCommandEvent &event) +{ + EndModal(wxID_CANCEL); +} + + +void GuiTimersDialog::OnTimerListSelected(wxCommandEvent &event) +{ + listUpdated(); +} + + +void GuiTimersDialog::listUpdated(void) +{ + const long index = mTimerListBox->GetSelection(); + + if (index >= 0) + { + //enable controls + mTimerNameText->Enable(true); + + mStartCheckBox->Enable(true); + mEndCheckBox->Enable(true); + + mRepeatModeChoice->Enable(true); + + const PowermonSchedule &s = mSchedules[index]; + + mTimerNameText->SetValue(wxString(s.getName(), wxConvUTF8)); + + bool enabled = s.getStartHour() < 24; + mStartCheckBox->SetValue(enabled); + mStartHourChoice->SetSelection(enabled ? s.getStartHour() : -1); + mStartMinuteChoice->SetSelection(enabled ? s.getStartMinute() : -1); + mStartHourChoice->Enable(enabled); + mStartMinuteChoice->Enable(enabled); + + enabled = s.getEndHour() < 24; + mEndCheckBox->SetValue(enabled); + mEndHourChoice->SetSelection(enabled ? s.getEndHour() : -1); + mEndMinuteChoice->SetSelection(enabled ? s.getEndMinute() : -1); + mEndHourChoice->Enable(enabled); + mEndMinuteChoice->Enable(enabled); + + const bool dom = s.isRepeatDOM(); + + mRepeatModeChoice->SetSelection(dom); + + + mDayOfMonthChoice->Enable(dom); + mMondayCheckBox->Enable(!dom); + mTuesdayCheckBox->Enable(!dom); + mWednesdayCheckBox->Enable(!dom); + mThursdayCheckBox->Enable(!dom); + mFridayCheckBox->Enable(!dom); + mSaturdayCheckBox->Enable(!dom); + mSundayCheckBox->Enable(!dom); + + if (dom) + { + mDayOfMonthChoice->SetSelection(s.getRepeat() - 1); + + mMondayCheckBox->SetValue(0); + mTuesdayCheckBox->SetValue(0); + mWednesdayCheckBox->SetValue(0); + mThursdayCheckBox->SetValue(0); + mFridayCheckBox->SetValue(0); + mSaturdayCheckBox->SetValue(0); + mSundayCheckBox->SetValue(0); + } + else + { + mDayOfMonthChoice->SetSelection(-1); + + const uint8_t mask = s.getRepeat(); + + mMondayCheckBox->SetValue(mask & (1 << 0)); + mTuesdayCheckBox->SetValue(mask & (1 << 1)); + mWednesdayCheckBox->SetValue(mask & (1 << 2)); + mThursdayCheckBox->SetValue(mask & (1 << 3)); + mFridayCheckBox->SetValue(mask & (1 << 4)); + mSaturdayCheckBox->SetValue(mask & (1 << 5)); + mSundayCheckBox->SetValue(mask & (1 << 6)); + } + } + else + { + mTimerNameText->Enable(false); + + mStartCheckBox->Enable(false); + mEndCheckBox->Enable(false); + + mStartHourChoice->Enable(false); + mStartMinuteChoice->Enable(false); + mEndHourChoice->Enable(false); + mEndMinuteChoice->Enable(false); + + mRepeatModeChoice->Enable(false); + + mMondayCheckBox->Enable(false); + mTuesdayCheckBox->Enable(false); + mWednesdayCheckBox->Enable(false); + mThursdayCheckBox->Enable(false); + mFridayCheckBox->Enable(false); + mSaturdayCheckBox->Enable(false); + mSundayCheckBox->Enable(false); + + mDayOfMonthChoice->Enable(false); + + mTimerNameText->SetValue(wxT("")); + + mStartCheckBox->SetValue(0); + mStartHourChoice->SetSelection(-1); + mStartMinuteChoice->SetSelection(-1); + + mEndCheckBox->SetValue(0); + mEndHourChoice->SetSelection(-1); + mEndMinuteChoice->SetSelection(-1); + mRepeatModeChoice->SetSelection(-1); + mDayOfMonthChoice->SetSelection(-1); + + mMondayCheckBox->SetValue(0); + mTuesdayCheckBox->SetValue(0); + mWednesdayCheckBox->SetValue(0); + mThursdayCheckBox->SetValue(0); + mFridayCheckBox->SetValue(0); + mSaturdayCheckBox->SetValue(0); + mSundayCheckBox->SetValue(0); + } + + Refresh(); +} + + +void GuiTimersDialog::OnTimerRepeatModeChanged(wxCommandEvent &event) +{ + const long index = mTimerListBox->GetSelection(); + + if (index >= 0) + { + const bool dom = mRepeatModeChoice->GetSelection(); + + mMondayCheckBox->SetValue(!dom); + mTuesdayCheckBox->SetValue(!dom); + mWednesdayCheckBox->SetValue(!dom); + mThursdayCheckBox->SetValue(!dom); + mFridayCheckBox->SetValue(!dom); + mSaturdayCheckBox->SetValue(!dom); + mSundayCheckBox->SetValue(!dom); + + mDayOfMonthChoice->Enable(dom); + mMondayCheckBox->Enable(!dom); + mTuesdayCheckBox->Enable(!dom); + mWednesdayCheckBox->Enable(!dom); + mThursdayCheckBox->Enable(!dom); + mFridayCheckBox->Enable(!dom); + mSaturdayCheckBox->Enable(!dom); + mSundayCheckBox->Enable(!dom); + + PowermonSchedule &s = mSchedules[index]; + + if (dom) + { + mDayOfMonthChoice->SetSelection(0); + s.setRepeatDOM(); + s.setRepeat(1); + } + else + { + mDayOfMonthChoice->SetSelection(-1); + s.setRepeatDOW(); + s.setRepeat(0); + } + + Refresh(); + } +} + + +void GuiTimersDialog::OnTimerValueChanged(wxCommandEvent &event) +{ + const long index = mTimerListBox->GetSelection(); + + if (index >= 0) + { + PowermonSchedule &s = mSchedules[index]; + + s.setStartHour(mStartHourChoice->GetSelection()); + s.setStartMinute(mStartMinuteChoice->GetSelection()); + s.setEndHour(mEndHourChoice->GetSelection()); + s.setEndMinute(mEndMinuteChoice->GetSelection()); + + if (mRepeatModeChoice->GetSelection()) + { + //day of month mode + s.setRepeatDOM(); + + s.setRepeat(mDayOfMonthChoice->GetSelection() + 1); + } + else + { + s.setRepeatDOW(); + + uint8_t mask = 0; + if (mMondayCheckBox->GetValue()) + mask |= (1 << 0); + + if (mTuesdayCheckBox->GetValue()) + mask |= (1 << 1); + + if (mWednesdayCheckBox->GetValue()) + mask |= (1 << 2); + + if (mThursdayCheckBox->GetValue()) + mask |= (1 << 3); + + if (mFridayCheckBox->GetValue()) + mask |= (1 << 4); + + if (mSaturdayCheckBox->GetValue()) + mask |= (1 << 5); + + if (mSundayCheckBox->GetValue()) + mask |= (1 << 6); + + s.setRepeat(mask); + } + + Refresh(); + } +} + + +void GuiTimersDialog::OnStartTimeCheckValueChanged(wxCommandEvent &event) +{ + const long index = mTimerListBox->GetSelection(); + PowermonSchedule &s = mSchedules[index]; + + const bool enabled = mStartCheckBox->GetValue(); + + mStartHourChoice->Enable(enabled); + mStartMinuteChoice->Enable(enabled); + + mStartHourChoice->SetSelection(enabled ? 0 : -1); + mStartMinuteChoice->SetSelection(enabled ? 0 : -1); + + s.setStartHour(enabled ? 0 : 24); + s.setStartMinute(0); +} + + +void GuiTimersDialog::OnEndTimeCheckValueChanged(wxCommandEvent &event) +{ + const long index = mTimerListBox->GetSelection(); + PowermonSchedule &s = mSchedules[index]; + + const bool enabled = mEndCheckBox->GetValue(); + + mEndHourChoice->Enable(enabled); + mEndMinuteChoice->Enable(enabled); + + mEndHourChoice->SetSelection(enabled ? 0 : -1); + mEndMinuteChoice->SetSelection(enabled ? 0 : -1); + + s.setEndHour(enabled ? 0 : 24); + s.setEndMinute(0); +} + + + + +BEGIN_EVENT_TABLE(GuiTimersDialog, wxDialog) + +EVT_CHECKBOX(ID_CHECKBOX_START, GuiTimersDialog::OnStartTimeCheckValueChanged) +EVT_CHECKBOX(ID_CHECKBOX_END, GuiTimersDialog::OnEndTimeCheckValueChanged) +EVT_CHECKBOX(ID_CHOICE_TIMER_VALUE, GuiTimersDialog::OnTimerValueChanged) + +EVT_BUTTON(ID_BUTTON_ADD, GuiTimersDialog::OnAddButtonClicked) +EVT_BUTTON(ID_BUTTON_DELETE, GuiTimersDialog::OnDeleteButtonClicked) +EVT_BUTTON(ID_BUTTON_SAVE, GuiTimersDialog::OnSaveButtonClicked) +EVT_BUTTON(ID_BUTTON_CANCEL, GuiTimersDialog::OnCancelButtonClicked) + +EVT_CHOICE(ID_CHOICE_TIMER_VALUE, GuiTimersDialog::OnTimerValueChanged) +EVT_CHOICE(ID_CHOICE_TIMER_REPEAT_MODE, GuiTimersDialog::OnTimerRepeatModeChanged) + +EVT_LISTBOX(ID_LISTBOX_TIMER_LIST, GuiTimersDialog::OnTimerListSelected) + +EVT_TEXT(ID_TEXT_TIMER_NAME, GuiTimersDialog::OnTimerNameChanged) + +END_EVENT_TABLE() diff --git a/gui/gui_timers_dialog.h b/gui/gui_timers_dialog.h new file mode 100644 index 0000000..9da1cd1 --- /dev/null +++ b/gui/gui_timers_dialog.h @@ -0,0 +1,106 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _GUI_TIMERS_DIALOG_H +#define _GUI_TIMERS_DIALOG_H + + +#include + + +class GuiTimersDialog: public wxDialog +{ +public: + GuiTimersDialog(wxWindow* parent, const std::vector &schedules); + + const std::vector& getSchedules(void) const + { + return mSchedules; + } + + +private: + enum + { + ID_LISTBOX_TIMER_LIST = wxID_HIGHEST + 1, + + ID_BUTTON_ADD, + ID_BUTTON_DELETE, + ID_BUTTON_SAVE, + ID_BUTTON_CANCEL, + + ID_CHECKBOX_START, + ID_CHECKBOX_END, + + ID_CHOICE_TIMER_REPEAT_MODE, + ID_CHOICE_TIMER_VALUE, + + ID_TEXT_TIMER_NAME + }; + + std::vector mSchedules; + + wxListBox* mTimerListBox; + + wxButton* mAddButton; + wxButton* mDeleteButton; + wxButton* mSaveButton; + wxButton* mCancelButton; + + wxTextCtrl* mTimerNameText; + + wxCheckBox* mStartCheckBox; + wxChoice* mStartHourChoice; + wxChoice* mStartMinuteChoice; + + wxCheckBox* mEndCheckBox; + wxChoice* mEndHourChoice; + wxChoice* mEndMinuteChoice; + wxChoice* mRepeatModeChoice; + + wxCheckBox* mMondayCheckBox; + wxCheckBox* mTuesdayCheckBox; + wxCheckBox* mWednesdayCheckBox; + wxCheckBox* mThursdayCheckBox; + wxCheckBox* mFridayCheckBox; + wxCheckBox* mSaturdayCheckBox; + wxCheckBox* mSundayCheckBox; + + wxChoice* mDayOfMonthChoice; + + void OnTimerListSelected(wxCommandEvent &event); + + void OnTimerNameChanged(wxCommandEvent &event); + + void OnStartTimeCheckValueChanged(wxCommandEvent &event); + void OnEndTimeCheckValueChanged(wxCommandEvent &event); + + void OnTimerRepeatModeChanged(wxCommandEvent &event); + void OnTimerValueChanged(wxCommandEvent &event); + + void OnAddButtonClicked(wxCommandEvent &event); + void OnDeleteButtonClicked(wxCommandEvent &event); + void OnSaveButtonClicked(wxCommandEvent &event); + void OnCancelButtonClicked(wxCommandEvent &event); + + void listUpdated(void); + + DECLARE_EVENT_TABLE() +}; + + +#endif diff --git a/gui/gui_wifi_setup.cpp b/gui/gui_wifi_setup.cpp new file mode 100644 index 0000000..d4814f7 --- /dev/null +++ b/gui/gui_wifi_setup.cpp @@ -0,0 +1,248 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include +#include + + +#include + + +GuiWifiSetup::GuiWifiSetup(wxWindow* parent, Powermon &powermon): wxDialog(parent, wxID_ANY, wxT("PowerMon WiFi Setup")), mPowermon(powermon) +{ + const size_t BORDER_SIZE = FromDIP(6); + + wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL); + SetSizer(main_sizer); + + mNetworkStatic = new wxStaticText(this, wxID_ANY, wxT("")); + mStatusStatic = new wxStaticText(this, wxID_ANY, wxT("")); + + wxBoxSizer* h_sizer = new wxBoxSizer(wxHORIZONTAL); + h_sizer->Add(new wxStaticText(this, wxID_ANY, wxT("WiFi Network: ")), 0, wxALL | wxEXPAND, BORDER_SIZE); + h_sizer->Add(mNetworkStatic, 0, wxALL | wxEXPAND, BORDER_SIZE); + main_sizer->Add(h_sizer, 0, wxALL | wxEXPAND, 0); + + h_sizer = new wxBoxSizer(wxHORIZONTAL); + h_sizer->Add(new wxStaticText(this, wxID_ANY, wxT("WiFi Status: ")), 0, wxALL | wxEXPAND, BORDER_SIZE); + h_sizer->Add(mStatusStatic, 0, wxALL | wxEXPAND, BORDER_SIZE); + main_sizer->Add(h_sizer, 0, wxDOWN | wxEXPAND, 20); + + mNetworkListCtrl = new wxListCtrl(this, ID_LISTBOX_NETWORK, wxDefaultPosition, FromDIP(wxSize(300, 420)), wxLC_SINGLE_SEL | wxLC_LIST | wxLC_VRULES); + + main_sizer->Add(new wxStaticText(this, wxID_ANY, wxT("Wireless Network List")), 0, wxBOTTOM | wxEXPAND, BORDER_SIZE); + main_sizer->Add(mNetworkListCtrl, 1, wxEXPAND | wxALL, 0); + + main_sizer->SetSizeHints(this); + Centre(); + + mPowermon.setOnWifiScanReportCallback([this](const Powermon::WifiScanResult* result) + { + if (result) + { + Powermon::WifiScanResult report = *result; + + wxQueueEvent(this, new GuiEvent([this, report](const GuiEvent &event) + { + if (std::find(mNetworkList.begin(), mNetworkList.end(), report) == mNetworkList.end()) + { + mNetworkList.push_back(report); + + char name[33]; + memset(name, 0, sizeof(name)); + + if (report.ssid_length) + { + memcpy(name, report.ssid, report.ssid_length); + + char* ptr = name; + for(uint32_t i = 0; i < report.ssid_length; i++) + { + if (isprint(*ptr) == false) + *ptr = '-'; + + ptr++; + } + } + else + { + strcpy(name, ""); + } + + mNetworkListCtrl->InsertItem(mNetworkListCtrl->GetItemCount(), wxString(name, wxConvUTF8)); + mNetworkListCtrl->Refresh(); + } + })); + } + }); + + mTimer = new wxTimer(this, ID_TIMER); + mTimer->Start(1000); + + UpdateInfo(); + + mPowermon.requestStartWifiScan([this](uint16_t status) + { + }); +} + + +GuiWifiSetup::~GuiWifiSetup() +{ +} + + +void GuiWifiSetup::OnClose(wxCloseEvent &event) +{ + mPowermon.setOnWifiScanReportCallback([this](const Powermon::WifiScanResult* result){}); + mTimer->Stop(); + EndModal(wxID_CANCEL); +} + + +void GuiWifiSetup::OnGuiEvent(GuiEvent &event) +{ + event.process(); +} + + +void GuiWifiSetup::OnTimerEvent(wxTimerEvent &event) +{ + UpdateInfo(); +} + + +void GuiWifiSetup::UpdateInfo(void) +{ + mPowermon.requestGetInfo([this](uint16_t status, const Powermon::DeviceInfo &info) + { + if (status == Powermon::RSP_SUCCESS) + { + debug_printf("\r\nINFO Status: %X", status); + debug_printf("\r\nSerial: %016lX, Name: %s %X", info.serial, info.name.c_str(), info.flags); + + wxQueueEvent(this, new GuiEvent([this, info](GuiEvent &event) + { + char cstr[MAX_WIFI_SSID_SIZE + 1]; + memcpy(cstr, info.ssid, info.ssid_length); + cstr[info.ssid_length] = 0; + + mNetworkStatic->SetLabel(wxString(cstr, wxConvUTF8)); + + if (info.isWifiFailed()) + { + mStatusStatic->SetLabel(wxT("Cannot connect")); + } + else if (info.isWifiConnecting()) + { + mStatusStatic->SetLabel(wxT("Connecting ...")); + } + else if (info.isWifiConnected()) + { + if (info.address) + { + wxString str; + str.Printf(wxT("Connected (%u.%u.%u.%u)"), (info.address >> 0) & 0xFF, + (info.address >> 8) & 0xFF, + (info.address >> 16) & 0xFF, + (info.address >> 24) & 0xFF); + mStatusStatic->SetLabel(str); + } + else + { + mStatusStatic->SetLabel(wxT("Connected (obtaining IP ...)")); + } + } + else + { + mNetworkStatic->SetLabel(wxT("")); + mStatusStatic->SetLabel(wxT("Not connected")); + } + + mNetworkStatic->Refresh(); + mStatusStatic->Refresh(); + })); + } + }); +} + + +void GuiWifiSetup::OnListNetworkActivated(wxListEvent &event) +{ + const int32_t selected = mNetworkListCtrl->GetNextItem(-1, wxLIST_NEXT_BELOW, wxLIST_STATE_SELECTED); + + if (selected >= 0) + { + Powermon::WifiScanResult &scan = mNetworkList[selected]; + + Powermon::WifiNetwork network; + + network.ssid_length = scan.ssid_length; + memcpy(network.ssid, scan.ssid, sizeof(network.ssid)); + + network.security = Powermon::WifiNetwork::SecurityMode::OPEN; + if (scan.security.wpa2) + network.security = Powermon::WifiNetwork::SecurityMode::WPA2_PSK; + else if (scan.security.wpa) + network.security = Powermon::WifiNetwork::SecurityMode::WPA2_WPA1_PSK; + else if (scan.security.wep) + network.security = Powermon::WifiNetwork::SecurityMode::WEP; + + debug_printf("\r\nSelected: %.*s", scan.ssid_length, scan.ssid); + + if (network.security) + { + GuiEnterString dialog(this, wxID_ANY, wxT("Enter password for network"), true, false); + dialog.setMaxStringLength(64); + dialog.setStringLabel(wxT("Network Password")); + + if (dialog.ShowModal() != wxID_OK) + return; + + network.pass_length = dialog.getString().size(); + memcpy(network.pass, dialog.getString().mb_str(), network.pass_length); + + debug_printf("\r\nPass: %.*s", network.pass_length, network.pass); + } + + mPowermon.requestWifiConfigure(network, [this](uint16_t status) + { + debug_printf("\r\nSET WIFI Status: %X %X", status); + + GuiEvent* event = new GuiEvent([this, status](GuiEvent &event) + { + if (status == Powermon::RSP_SUCCESS) + { + + } + else + { + + } + }); + + wxQueueEvent(this, event); + }); + } +} + +BEGIN_EVENT_TABLE(GuiWifiSetup, wxDialog) +EVT_CLOSE(GuiWifiSetup::OnClose) +EVT_LIST_ITEM_ACTIVATED(ID_LISTBOX_NETWORK, GuiWifiSetup::OnListNetworkActivated) +GUI_EVT(GuiWifiSetup::OnGuiEvent) +EVT_TIMER(ID_TIMER, GuiWifiSetup::OnTimerEvent) +END_EVENT_TABLE() diff --git a/gui/gui_wifi_setup.h b/gui/gui_wifi_setup.h new file mode 100644 index 0000000..95e77d5 --- /dev/null +++ b/gui/gui_wifi_setup.h @@ -0,0 +1,65 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _GUI_WIFI_SETUP_H +#define _GUI_WIFI_SETUP_H + + +#include +#include + +#include + +#include + + +class GuiWifiSetup: public wxDialog +{ +public: + GuiWifiSetup(wxWindow* parent, Powermon &powermon); + ~GuiWifiSetup(); + +private: + enum + { + ID_LISTBOX_NETWORK = wxID_HIGHEST + 1, + ID_TIMER + }; + + Powermon &mPowermon; + + wxTimer* mTimer; + + wxStaticText* mNetworkStatic; + wxStaticText* mStatusStatic; + + wxListCtrl* mNetworkListCtrl; + + std::vector mNetworkList; + + void OnTimerEvent(wxTimerEvent &event); + void OnListNetworkActivated(wxListEvent &event); + + void OnGuiEvent(GuiEvent &event); + void OnClose(wxCloseEvent &event); + + void UpdateInfo(void); + + DECLARE_EVENT_TABLE() +}; + +#endif diff --git a/gui/model.cpp b/gui/model.cpp new file mode 100644 index 0000000..68e4fad --- /dev/null +++ b/gui/model.cpp @@ -0,0 +1,197 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include +#include +#include +#include + + +Model::Model(): mMainWindow(nullptr) +{ + mHomePath.AssignDir(wxStandardPaths::Get().GetUserConfigDir()); + +#if defined(_MSC_VER) + mHomePath.AppendDir(wxT("pmon")); +#elif defined (__GNUC__) + mHomePath.AppendDir(wxT(".pmon")); +#endif + + mHomePath.Mkdir(); + + loadCloudDevices(); +} + + +void Model::setDevice(uint64_t serial) +{ + wxString str; + str.Printf(wxT("%" PRIx64), serial); + + mLogFilesPath = mHomePath; + mLogFilesPath.AppendDir(str); + + mLogFilesPath.Mkdir(); +} + + +void Model::clearDevice(void) +{ + mLogFilesPath.Clear(); +} + + +void Model::addCloudDevice(const Powermon::DeviceIdentifier &id) +{ + auto it = std::find(cloudDeviceList.begin(), cloudDeviceList.end(), id); + + if (it != cloudDeviceList.end()) + *it = id; + else + cloudDeviceList.push_back(id); + + saveCloudDevices(); + + if (mMainWindow) + mMainWindow->UpdateCloudDeviceList(); +} + + +void Model::loadCloudDevices(void) +{ + wxFileName fname = mHomePath; + fname.SetFullName(wxT("cloud_devices.cfg")); + + wxTextFile file; + if (!file.Open(fname.GetFullPath())) + return; + + for (wxString line = file.GetFirstLine(); !file.Eof(); line = file.GetNextLine()) + { + if (line.Length()) + { + Powermon::DeviceIdentifier id; + + if (id.fromURL(line.c_str())) + cloudDeviceList.push_back(id); + } + } + + file.Close(); +} + + +void Model::saveCloudDevices(void) +{ + wxFileName fname = mHomePath; + fname.SetFullName(wxT("cloud_devices.cfg")); + + wxTextFile file; + + const wxString path = fname.GetFullPath(); + + if (!file.Open(path)) + if (!file.Create(path)) + return; + + file.Clear(); + + for (auto& id : cloudDeviceList) + { + const wxString line = id.toURL(); + file.AddLine(line); + } + + file.Write(); + file.Close(); +} + + +void Model::loadLogData(std::vector &samples) +{ + samples.clear(); + + if (mLogFilesPath.IsOk()) + { + std::vector log_files; + + wxDir dir; + + if (!dir.Open(mLogFilesPath.GetFullPath())) + return; + + wxString fname; + bool result = dir.GetFirst(&fname, wxT("*.log"), wxDIR_FILES); + while (result) + { + if (fname.GetChar(0) != 'r') + continue; + fname.Remove(0, 1); + + if (fname.Right(4) != wxT(".log")) + continue; + + fname.RemoveLast(4); + + if (fname.Length() != 8) + continue; + + char* endptr; + uint32_t id = strtoul(fname.c_str(), &endptr, 16); + if (*endptr != 0) + continue; + + log_files.push_back(id); + + result = dir.GetNext(&fname); + } + + std::sort(log_files.begin(), log_files.end()); + + for(const uint32_t id: log_files) + { + wxFile file; + + if (!file.Open(getLogFileName(id).GetFullPath(), wxFile::read)) + continue; + + const wxFileOffset fsize = file.Length(); + if (fsize == wxInvalidOffset) + { + file.Close(); + continue; + } + + std::vector buffer(fsize); + + const ssize_t result = file.Read(buffer.data(), fsize); + if (result == fsize) + PowermonLogFile::decode(buffer, samples); + + file.Close(); + } + } +} + + +void Model::deleteLogData(void) +{ + if (mLogFilesPath.IsOk()) + mLogFilesPath.Rmdir(wxPATH_RMDIR_RECURSIVE); +} diff --git a/gui/model.h b/gui/model.h new file mode 100644 index 0000000..713e523 --- /dev/null +++ b/gui/model.h @@ -0,0 +1,92 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _MODEL_H +#define _MODEL_H + + +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +class Model +{ +public: + std::vector cloudDeviceList; + + std::vector logData; + + static Model& getInstance(void) + { + static Model model; + return model; + } + + void loadCloudDevices(void); + void saveCloudDevices(void); + + void addCloudDevice(const Powermon::DeviceIdentifier &id); + + GuiMain* mMainWindow; + + const wxString getHomePath(void) const + { + return mHomePath.GetFullPath(); + } + + void setDevice(uint64_t serial); + void clearDevice(void); + + + wxFileName getLogFileName(uint32_t id) + { + wxString fname; + fname.Printf(wxT("r%08x.log"), id); + + wxFileName path = mLogFilesPath; + path.SetFullName(fname); + + return path; + } + + + void loadLogData(std::vector &samples); + void deleteLogData(void); + + +private: + Model(); + Model(const Model &rhs) = delete; + + wxFileName mHomePath; + wxFileName mLogFilesPath; +}; + + +#endif diff --git a/gui/resources/img_arrow_down_png.cpp b/gui/resources/img_arrow_down_png.cpp new file mode 100644 index 0000000..dfa28d2 --- /dev/null +++ b/gui/resources/img_arrow_down_png.cpp @@ -0,0 +1,94 @@ +static const uint8_t img_arrow_down_png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, 0x61, 0x00, 0x00, 0x00, + 0x04, 0x67, 0x41, 0x4d, 0x41, 0x00, 0x00, 0xaf, 0xc8, 0x37, 0x05, 0x8a, + 0xe9, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47, 0x44, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xf9, 0x43, 0xbb, 0x7f, 0x00, 0x00, 0x00, 0x09, 0x70, + 0x48, 0x59, 0x73, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x48, 0x00, + 0x46, 0xc9, 0x6b, 0x3e, 0x00, 0x00, 0x00, 0x09, 0x76, 0x70, 0x41, 0x67, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x5c, 0xc6, 0xad, + 0xc3, 0x00, 0x00, 0x02, 0x3c, 0x49, 0x44, 0x41, 0x54, 0x38, 0xcb, 0xc5, + 0x93, 0xcd, 0x4b, 0x54, 0x61, 0x14, 0xc6, 0x7f, 0xef, 0x7b, 0xef, 0xdc, + 0xeb, 0x7c, 0xf9, 0x5d, 0xda, 0xcc, 0x48, 0x5a, 0xa6, 0x52, 0xa1, 0xd3, + 0x20, 0x26, 0x6d, 0x8c, 0xe8, 0x4f, 0xc8, 0x95, 0xdb, 0x70, 0x53, 0xb9, + 0x88, 0x24, 0x22, 0x22, 0xa4, 0x5d, 0x6d, 0xda, 0x98, 0x44, 0x52, 0x64, + 0xe1, 0x22, 0x17, 0x45, 0x2d, 0x5c, 0x48, 0x81, 0x10, 0x4c, 0xb4, 0x4b, + 0xdc, 0x24, 0x8d, 0x46, 0x60, 0xea, 0x4c, 0x33, 0xce, 0x87, 0xf3, 0x65, + 0xf7, 0xde, 0xb7, 0x85, 0xa4, 0x22, 0xb6, 0x72, 0xd1, 0x81, 0xb3, 0x39, + 0xf0, 0xfc, 0xe0, 0x9c, 0xe7, 0x39, 0x42, 0x29, 0xc5, 0x41, 0x4a, 0x1e, + 0x48, 0x0d, 0xe8, 0x00, 0x66, 0xcf, 0x93, 0xa8, 0x07, 0xc2, 0x96, 0x82, + 0x82, 0xad, 0xa5, 0x1c, 0x8f, 0xf7, 0x12, 0x86, 0x19, 0xc5, 0x71, 0xa0, + 0x2a, 0x08, 0x02, 0xb0, 0x9d, 0x0e, 0x94, 0x9c, 0xd6, 0xcd, 0x8a, 0x46, + 0xa5, 0xbb, 0x70, 0x34, 0x63, 0xc1, 0x99, 0x6c, 0xed, 0xd2, 0x01, 0x8e, + 0x05, 0xfc, 0xbd, 0xf7, 0x87, 0xcf, 0x51, 0xd2, 0x24, 0xd3, 0xd1, 0xb5, + 0xc0, 0xb3, 0x89, 0xaf, 0x0f, 0x71, 0x89, 0x8b, 0xe8, 0x46, 0x0e, 0x04, + 0xd8, 0x8e, 0x57, 0xb3, 0x9d, 0xb1, 0xb6, 0xd3, 0x81, 0x66, 0xe5, 0xaf, + 0x23, 0xbd, 0x21, 0x48, 0x24, 0xd2, 0x9d, 0xdb, 0x2b, 0xc4, 0x57, 0xf3, + 0x4b, 0x5e, 0x29, 0xe9, 0xef, 0x0d, 0x31, 0x78, 0xf9, 0x0c, 0xe1, 0xee, + 0x50, 0x0f, 0x39, 0x75, 0x0b, 0x77, 0x0d, 0x08, 0x01, 0x79, 0xeb, 0x6a, + 0xe4, 0x44, 0xf5, 0xf9, 0xee, 0x48, 0x13, 0x78, 0x7c, 0x6c, 0xa2, 0x61, + 0xdb, 0x62, 0x6d, 0x1b, 0x90, 0x4a, 0x96, 0xae, 0x0f, 0xde, 0x8b, 0xb2, + 0xb0, 0x92, 0xc7, 0xe3, 0x92, 0xf4, 0x0f, 0x84, 0xa9, 0x3a, 0xec, 0xbf, + 0x46, 0xd9, 0x8a, 0x60, 0x39, 0xad, 0x75, 0xf5, 0x15, 0xc3, 0xed, 0x91, + 0x66, 0xe6, 0x56, 0x24, 0xf1, 0x5f, 0x16, 0xeb, 0x6b, 0xeb, 0xa0, 0xd4, + 0x8d, 0x9d, 0x23, 0xd6, 0xfa, 0xde, 0xc4, 0x16, 0x73, 0x8f, 0xee, 0x8c, + 0xce, 0x53, 0x51, 0x56, 0x1c, 0x09, 0x54, 0x72, 0xf6, 0x42, 0x9b, 0x0f, + 0x25, 0xc6, 0x34, 0xd4, 0xf8, 0xc9, 0x70, 0xb0, 0x6e, 0xa9, 0xe8, 0x65, + 0x39, 0x09, 0xd9, 0x54, 0x16, 0xe5, 0x38, 0x93, 0x48, 0xed, 0xe5, 0x0e, + 0x40, 0xd7, 0xa0, 0xc6, 0x3d, 0x32, 0x35, 0xf3, 0x73, 0xfe, 0xf5, 0xfb, + 0x65, 0x82, 0x1e, 0x68, 0x69, 0x0f, 0xd1, 0x70, 0xf4, 0x50, 0x4f, 0x65, + 0x7d, 0x75, 0x9f, 0xaa, 0x69, 0xe4, 0x7b, 0x02, 0x72, 0x99, 0x02, 0x56, + 0xb1, 0xb4, 0x88, 0xa6, 0xdf, 0x05, 0xb5, 0xcb, 0x46, 0xc7, 0x06, 0xa1, + 0xe2, 0xca, 0xd4, 0x6f, 0x3f, 0x78, 0x1e, 0xb3, 0xe2, 0xab, 0x05, 0x9a, + 0x6a, 0x05, 0x2d, 0x9d, 0xc7, 0x09, 0x76, 0xb4, 0xb0, 0xbc, 0x2e, 0x48, + 0xa5, 0x2d, 0xca, 0xb9, 0x1c, 0x68, 0xda, 0x08, 0xf0, 0x6d, 0xcb, 0x9a, + 0xbf, 0x00, 0xc3, 0x0b, 0x86, 0x07, 0x0c, 0xe3, 0x6d, 0x32, 0x63, 0x8f, + 0x8d, 0xbe, 0xfa, 0x41, 0xa0, 0xd2, 0xc1, 0xe7, 0x31, 0xd8, 0xb0, 0x4d, + 0x92, 0x59, 0x45, 0x31, 0x93, 0x03, 0x78, 0x81, 0x90, 0x13, 0x08, 0x09, + 0x52, 0xdb, 0x05, 0xa8, 0x0a, 0x41, 0x65, 0x03, 0x78, 0xfc, 0xe0, 0x37, + 0x6f, 0x7e, 0xfa, 0x92, 0x99, 0x9b, 0xfd, 0x9c, 0xa2, 0xeb, 0x28, 0x24, + 0xb2, 0x90, 0xcf, 0x16, 0xc1, 0xfe, 0x1d, 0x43, 0x6a, 0x43, 0xfb, 0x27, + 0x51, 0xd9, 0xa0, 0x1c, 0x50, 0x0a, 0x84, 0x28, 0x62, 0xe8, 0x57, 0xa6, + 0x66, 0x92, 0x69, 0x6b, 0xb3, 0xcc, 0xa9, 0x80, 0x8d, 0x9d, 0xcd, 0x97, + 0x90, 0x72, 0x08, 0x48, 0xff, 0x03, 0xa0, 0x76, 0xda, 0x71, 0x40, 0x97, + 0x1f, 0x0b, 0x25, 0xf5, 0xf8, 0xdd, 0x6c, 0x86, 0x42, 0x76, 0x03, 0xe0, + 0x29, 0x88, 0xe9, 0xfd, 0xa2, 0x2c, 0x94, 0x52, 0x88, 0x81, 0xd8, 0xde, + 0x31, 0x08, 0xe1, 0x06, 0xf3, 0x83, 0x70, 0x99, 0x6e, 0x25, 0x45, 0x1f, + 0x82, 0xcc, 0x5e, 0xb1, 0x1a, 0xaf, 0xdd, 0x02, 0xfc, 0xd7, 0x6f, 0xfc, + 0x03, 0x5e, 0xed, 0xe5, 0xe2, 0x76, 0xe5, 0x2a, 0x9b, 0x00, 0x00, 0x00, + 0x25, 0x74, 0x45, 0x58, 0x74, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x2d, + 0x64, 0x61, 0x74, 0x65, 0x00, 0x32, 0x30, 0x30, 0x39, 0x2d, 0x31, 0x31, + 0x2d, 0x31, 0x35, 0x54, 0x31, 0x36, 0x3a, 0x30, 0x38, 0x3a, 0x34, 0x31, + 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x24, 0xae, 0xe1, 0xe0, 0x00, 0x00, + 0x00, 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, 0x74, 0x65, 0x3a, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x00, 0x32, 0x30, 0x31, 0x30, 0x2d, 0x30, + 0x32, 0x2d, 0x32, 0x30, 0x54, 0x32, 0x33, 0x3a, 0x32, 0x36, 0x3a, 0x31, + 0x35, 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x06, 0x3b, 0x5c, 0x81, 0x00, + 0x00, 0x00, 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, 0x74, 0x65, 0x3a, + 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x00, 0x32, 0x30, 0x31, 0x30, 0x2d, + 0x30, 0x31, 0x2d, 0x31, 0x31, 0x54, 0x30, 0x39, 0x3a, 0x31, 0x38, 0x3a, + 0x33, 0x39, 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, 0xf0, 0x5d, 0x31, 0xb1, + 0x00, 0x00, 0x00, 0x35, 0x74, 0x45, 0x58, 0x74, 0x4c, 0x69, 0x63, 0x65, + 0x6e, 0x73, 0x65, 0x00, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x69, 0x76, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x73, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x6c, 0x69, 0x63, 0x65, 0x6e, + 0x73, 0x65, 0x73, 0x2f, 0x4c, 0x47, 0x50, 0x4c, 0x2f, 0x32, 0x2e, 0x31, + 0x2f, 0x3b, 0xc1, 0xb4, 0x18, 0x00, 0x00, 0x00, 0x25, 0x74, 0x45, 0x58, + 0x74, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x2d, 0x64, 0x61, 0x74, 0x65, + 0x00, 0x32, 0x30, 0x30, 0x39, 0x2d, 0x31, 0x31, 0x2d, 0x31, 0x35, 0x54, + 0x31, 0x36, 0x3a, 0x30, 0x38, 0x3a, 0x34, 0x31, 0x2d, 0x30, 0x37, 0x3a, + 0x30, 0x30, 0x7b, 0x1f, 0x97, 0xd4, 0x00, 0x00, 0x00, 0x19, 0x74, 0x45, + 0x58, 0x74, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, + 0x64, 0x6f, 0x62, 0x65, 0x20, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, + 0x61, 0x64, 0x79, 0x71, 0xc9, 0x65, 0x3c, 0x00, 0x00, 0x00, 0x0d, 0x74, + 0x45, 0x58, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x00, 0x4e, 0x75, + 0x76, 0x6f, 0x6c, 0x61, 0xac, 0x4f, 0x35, 0xf1, 0x00, 0x00, 0x00, 0x34, + 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x55, + 0x52, 0x4c, 0x00, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, + 0x77, 0x2e, 0x69, 0x63, 0x6f, 0x6e, 0x2d, 0x6b, 0x69, 0x6e, 0x67, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, + 0x2f, 0x6e, 0x75, 0x76, 0x6f, 0x6c, 0x61, 0x2f, 0x76, 0x3d, 0xb4, 0x52, + 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; + diff --git a/gui/resources/img_arrow_left_double_png.cpp b/gui/resources/img_arrow_left_double_png.cpp new file mode 100644 index 0000000..fe21afe --- /dev/null +++ b/gui/resources/img_arrow_left_double_png.cpp @@ -0,0 +1,111 @@ +static const uint8_t img_arrow_left_double_png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, 0x61, 0x00, 0x00, 0x00, + 0x04, 0x67, 0x41, 0x4d, 0x41, 0x00, 0x00, 0xaf, 0xc8, 0x37, 0x05, 0x8a, + 0xe9, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x00, + 0x48, 0x00, 0x00, 0x00, 0x48, 0x00, 0x46, 0xc9, 0x6b, 0x3e, 0x00, 0x00, + 0x00, 0x09, 0x76, 0x70, 0x41, 0x67, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x10, 0x00, 0x5c, 0xc6, 0xad, 0xc3, 0x00, 0x00, 0x00, 0x06, 0x62, + 0x4b, 0x47, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x43, 0xbb, + 0x7f, 0x00, 0x00, 0x03, 0x08, 0x49, 0x44, 0x41, 0x54, 0x18, 0x19, 0xa5, + 0xc1, 0xdb, 0x6f, 0x14, 0x55, 0x00, 0xc0, 0xe1, 0xdf, 0x99, 0x73, 0x66, + 0x67, 0xa6, 0x9d, 0xe9, 0xee, 0x76, 0x77, 0xc1, 0xda, 0x96, 0x22, 0xc6, + 0x86, 0x6a, 0x13, 0x89, 0x4a, 0xc5, 0x78, 0x81, 0x98, 0x18, 0x11, 0x24, + 0xa2, 0x2f, 0xbc, 0xe0, 0xe5, 0x11, 0xa3, 0x09, 0x89, 0x18, 0x5e, 0xa0, + 0x02, 0x51, 0x9f, 0xbc, 0x61, 0x8c, 0x2f, 0xf0, 0x48, 0x4c, 0xf5, 0x41, + 0xfa, 0xe0, 0x0d, 0x12, 0x14, 0x34, 0x12, 0xa9, 0xc6, 0x4b, 0xac, 0x1a, + 0x0d, 0x15, 0x02, 0xa5, 0xa5, 0x4b, 0xd3, 0x6d, 0xb7, 0x7b, 0xdf, 0x33, + 0x73, 0x8e, 0x01, 0xff, 0x04, 0xbe, 0x4f, 0x58, 0x6b, 0xb9, 0x19, 0x82, + 0x91, 0x8f, 0xb9, 0x41, 0xf0, 0x3f, 0x2b, 0x90, 0x4a, 0xed, 0xce, 0x45, + 0xed, 0xc3, 0x8b, 0xa5, 0xca, 0x7e, 0x1d, 0xdb, 0x37, 0x49, 0x34, 0xa4, + 0xfb, 0xc1, 0xcf, 0x80, 0x31, 0xa0, 0x93, 0xc1, 0x42, 0xce, 0x1b, 0x8f, + 0x95, 0xeb, 0x3b, 0x98, 0x36, 0x24, 0x6d, 0xd0, 0x1a, 0xda, 0x1a, 0x96, + 0xea, 0xbb, 0x9e, 0x7a, 0x30, 0x7b, 0x78, 0xff, 0x9e, 0x11, 0x7c, 0x99, + 0x7a, 0x8c, 0x9a, 0x11, 0x98, 0x00, 0x54, 0x00, 0x58, 0x68, 0x9b, 0x9e, + 0x15, 0x91, 0x7b, 0xec, 0xfd, 0x3d, 0x43, 0x77, 0xae, 0x5b, 0xdb, 0xbd, + 0xca, 0xc1, 0xb4, 0xa0, 0xdd, 0x82, 0x56, 0x0b, 0xaa, 0x8d, 0x9d, 0xf7, + 0xdc, 0x97, 0xf9, 0x60, 0xf4, 0xc0, 0x06, 0x08, 0x42, 0x5a, 0x46, 0x19, + 0x94, 0x82, 0xce, 0x0c, 0xf8, 0x21, 0x24, 0xc6, 0xf3, 0x52, 0xf2, 0x93, + 0x7d, 0x2f, 0x0e, 0x8e, 0xac, 0x1b, 0xc9, 0x51, 0xd6, 0x6e, 0xe2, 0x80, + 0x00, 0x21, 0x40, 0x9b, 0xad, 0x43, 0x77, 0xa5, 0x3f, 0x7c, 0xed, 0xd0, + 0x46, 0x35, 0x55, 0x09, 0xf8, 0xf6, 0xc7, 0x12, 0x31, 0xce, 0x65, 0xc2, + 0xc8, 0x92, 0xce, 0x83, 0xd6, 0x81, 0x63, 0xc5, 0xf1, 0x57, 0x9f, 0x5f, + 0xf3, 0xf0, 0xf0, 0xbd, 0xb7, 0xf0, 0xe9, 0x44, 0x9b, 0xd9, 0x92, 0x69, + 0x29, 0xae, 0xab, 0xc7, 0x23, 0xb7, 0x0d, 0x74, 0x1c, 0x1d, 0x3d, 0xb8, + 0xb1, 0xeb, 0x7c, 0x33, 0xcb, 0x99, 0xcf, 0xae, 0xf0, 0xf5, 0xf8, 0xe4, + 0x5f, 0x46, 0x88, 0x03, 0x74, 0x84, 0xd0, 0x48, 0x04, 0x89, 0x39, 0xf2, + 0xd2, 0x73, 0xb7, 0x6f, 0x19, 0xbe, 0xbf, 0x9f, 0xb1, 0x89, 0x98, 0x53, + 0xdf, 0x14, 0x99, 0x9b, 0xd7, 0x87, 0x14, 0xcd, 0x78, 0x68, 0x45, 0x41, + 0x1d, 0xdb, 0x7b, 0x70, 0x53, 0xcf, 0xaf, 0xd5, 0x95, 0x9c, 0x3c, 0x55, + 0x64, 0xea, 0xf4, 0xc4, 0xe5, 0x66, 0x4b, 0xef, 0x20, 0xca, 0x5e, 0x42, + 0x46, 0x8a, 0x76, 0xeb, 0xbd, 0x67, 0x9f, 0x19, 0xd8, 0x39, 0xb4, 0x7e, + 0x80, 0xa3, 0xdf, 0x59, 0xfe, 0x9e, 0x2c, 0x32, 0x7b, 0xa1, 0xfa, 0x06, + 0x29, 0xf9, 0xae, 0x4a, 0x67, 0x53, 0x63, 0xaf, 0xec, 0xdb, 0x34, 0x38, + 0x51, 0xed, 0x67, 0xfc, 0xc4, 0x22, 0x95, 0xdf, 0x7e, 0xb8, 0x6a, 0x9a, + 0xc9, 0x76, 0x5c, 0xf5, 0x07, 0x32, 0x00, 0x6b, 0x76, 0x6d, 0x7b, 0xbc, + 0xef, 0xe5, 0xb5, 0xeb, 0xd7, 0xf0, 0xf6, 0x49, 0x41, 0xf1, 0xe2, 0x1c, + 0xb5, 0x52, 0xed, 0x1d, 0x42, 0x6f, 0x14, 0x01, 0xca, 0x0f, 0x1c, 0xff, + 0xdc, 0xb4, 0xcf, 0xe9, 0x2b, 0x50, 0x6f, 0x18, 0x22, 0x5f, 0xe9, 0x32, + 0x7e, 0x8d, 0x30, 0x0d, 0xc6, 0x22, 0xc1, 0x2f, 0x19, 0x9f, 0x8f, 0x7e, + 0x72, 0xb8, 0x70, 0x15, 0x42, 0x21, 0x70, 0x7d, 0xbf, 0xa1, 0x55, 0x17, + 0x74, 0x84, 0xc8, 0x5a, 0xf4, 0xc4, 0xb9, 0xa9, 0x3f, 0xaf, 0x6d, 0x2e, + 0x0c, 0xac, 0x4c, 0xcb, 0xee, 0x3c, 0x77, 0xf4, 0x65, 0xd3, 0xc9, 0xf2, + 0xc2, 0xe6, 0x6a, 0x53, 0x7c, 0x45, 0x10, 0x94, 0x2c, 0xe6, 0xe7, 0xe9, + 0x19, 0xbd, 0xca, 0x38, 0xf2, 0xee, 0x4c, 0xa1, 0x93, 0x4c, 0xd8, 0xc9, + 0x40, 0x37, 0x8f, 0x14, 0xcb, 0xb6, 0x61, 0xa5, 0x77, 0x56, 0xd2, 0xb7, + 0x7d, 0xd6, 0x18, 0x3b, 0xa9, 0x97, 0x2b, 0x4f, 0xe6, 0x7a, 0x0b, 0x41, + 0xc9, 0xed, 0x26, 0x9f, 0x0d, 0x73, 0xf5, 0x72, 0x79, 0x43, 0x1b, 0xef, + 0x0b, 0xa4, 0x5c, 0x42, 0x8a, 0x2f, 0x9b, 0x0d, 0x33, 0xdc, 0x15, 0xba, + 0x43, 0xd6, 0xf7, 0x31, 0xd2, 0xa3, 0xd3, 0xe3, 0xd1, 0x72, 0xd3, 0x99, + 0x95, 0xdc, 0xba, 0x0d, 0x54, 0xea, 0xa2, 0x8e, 0xc5, 0xb4, 0xae, 0xd7, + 0xb7, 0x76, 0xf7, 0xe4, 0xd5, 0xa2, 0x4c, 0xd3, 0x8c, 0x55, 0xaf, 0xae, + 0xd7, 0x43, 0x84, 0xf3, 0x39, 0xc2, 0x26, 0xb8, 0x9d, 0x27, 0x6a, 0x4d, + 0x1e, 0xe8, 0x8a, 0xd4, 0x6a, 0x5c, 0x97, 0xe5, 0xb6, 0x72, 0x74, 0xec, + 0x3c, 0xe4, 0x90, 0xc4, 0x60, 0x62, 0xc0, 0x8e, 0x55, 0x17, 0x2a, 0xbb, + 0xe7, 0xff, 0xf9, 0x97, 0x42, 0x94, 0x90, 0xca, 0x74, 0x81, 0xf2, 0x06, + 0x91, 0xae, 0xc0, 0x71, 0x01, 0x5b, 0x36, 0xc8, 0xa7, 0x67, 0xe7, 0x92, + 0x5f, 0x5c, 0x61, 0xc9, 0x46, 0x02, 0xeb, 0x88, 0x0e, 0x87, 0xfc, 0x6a, + 0xc8, 0xf6, 0x42, 0x94, 0x83, 0x8e, 0xf0, 0xc8, 0xd2, 0x42, 0x7d, 0xef, + 0xb5, 0xa9, 0x19, 0x0a, 0xa1, 0x45, 0xa6, 0x3c, 0x07, 0x91, 0x02, 0xe9, + 0x81, 0x70, 0x40, 0xd8, 0xc5, 0xc4, 0x8a, 0x1d, 0x97, 0xe6, 0xf8, 0x3d, + 0x48, 0x41, 0x14, 0x20, 0x15, 0xe9, 0x1e, 0x6e, 0xb0, 0x16, 0xb0, 0x60, + 0xed, 0x5b, 0xf3, 0xc5, 0x9a, 0xb7, 0x5c, 0x77, 0x5e, 0xb7, 0xca, 0xfd, + 0x1e, 0x47, 0x59, 0xae, 0xb3, 0x02, 0x2c, 0xe0, 0x88, 0xa9, 0x96, 0x16, + 0x2f, 0x9c, 0x9f, 0xe1, 0xb8, 0xb5, 0xb8, 0xc2, 0x5a, 0xcb, 0xcd, 0xf8, + 0x0f, 0x5a, 0x98, 0x48, 0x1c, 0x54, 0xc8, 0xf7, 0x91, 0x00, 0x00, 0x00, + 0x25, 0x74, 0x45, 0x58, 0x74, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x2d, + 0x64, 0x61, 0x74, 0x65, 0x00, 0x32, 0x30, 0x30, 0x39, 0x2d, 0x31, 0x31, + 0x2d, 0x31, 0x35, 0x54, 0x31, 0x36, 0x3a, 0x30, 0x38, 0x3a, 0x34, 0x31, + 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x24, 0xae, 0xe1, 0xe0, 0x00, 0x00, + 0x00, 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, 0x74, 0x65, 0x3a, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x00, 0x32, 0x30, 0x31, 0x30, 0x2d, 0x30, + 0x32, 0x2d, 0x32, 0x30, 0x54, 0x32, 0x33, 0x3a, 0x32, 0x36, 0x3a, 0x31, + 0x35, 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x06, 0x3b, 0x5c, 0x81, 0x00, + 0x00, 0x00, 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, 0x74, 0x65, 0x3a, + 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x00, 0x32, 0x30, 0x31, 0x30, 0x2d, + 0x30, 0x31, 0x2d, 0x31, 0x31, 0x54, 0x30, 0x39, 0x3a, 0x31, 0x38, 0x3a, + 0x33, 0x36, 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x06, 0x15, 0x41, 0x58, + 0x00, 0x00, 0x00, 0x35, 0x74, 0x45, 0x58, 0x74, 0x4c, 0x69, 0x63, 0x65, + 0x6e, 0x73, 0x65, 0x00, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x69, 0x76, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x73, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x6c, 0x69, 0x63, 0x65, 0x6e, + 0x73, 0x65, 0x73, 0x2f, 0x4c, 0x47, 0x50, 0x4c, 0x2f, 0x32, 0x2e, 0x31, + 0x2f, 0x3b, 0xc1, 0xb4, 0x18, 0x00, 0x00, 0x00, 0x25, 0x74, 0x45, 0x58, + 0x74, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x2d, 0x64, 0x61, 0x74, 0x65, + 0x00, 0x32, 0x30, 0x30, 0x39, 0x2d, 0x31, 0x31, 0x2d, 0x31, 0x35, 0x54, + 0x31, 0x36, 0x3a, 0x30, 0x38, 0x3a, 0x34, 0x31, 0x2d, 0x30, 0x37, 0x3a, + 0x30, 0x30, 0x7b, 0x1f, 0x97, 0xd4, 0x00, 0x00, 0x00, 0x19, 0x74, 0x45, + 0x58, 0x74, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, + 0x64, 0x6f, 0x62, 0x65, 0x20, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, + 0x61, 0x64, 0x79, 0x71, 0xc9, 0x65, 0x3c, 0x00, 0x00, 0x00, 0x0d, 0x74, + 0x45, 0x58, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x00, 0x4e, 0x75, + 0x76, 0x6f, 0x6c, 0x61, 0xac, 0x4f, 0x35, 0xf1, 0x00, 0x00, 0x00, 0x34, + 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x55, + 0x52, 0x4c, 0x00, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, + 0x77, 0x2e, 0x69, 0x63, 0x6f, 0x6e, 0x2d, 0x6b, 0x69, 0x6e, 0x67, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, + 0x2f, 0x6e, 0x75, 0x76, 0x6f, 0x6c, 0x61, 0x2f, 0x76, 0x3d, 0xb4, 0x52, + 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; + diff --git a/gui/resources/img_arrow_left_png.cpp b/gui/resources/img_arrow_left_png.cpp new file mode 100644 index 0000000..f42e82c --- /dev/null +++ b/gui/resources/img_arrow_left_png.cpp @@ -0,0 +1,95 @@ +static const uint8_t img_arrow_left_png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, 0x61, 0x00, 0x00, 0x00, + 0x04, 0x67, 0x41, 0x4d, 0x41, 0x00, 0x00, 0xaf, 0xc8, 0x37, 0x05, 0x8a, + 0xe9, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47, 0x44, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xf9, 0x43, 0xbb, 0x7f, 0x00, 0x00, 0x00, 0x09, 0x70, + 0x48, 0x59, 0x73, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x48, 0x00, + 0x46, 0xc9, 0x6b, 0x3e, 0x00, 0x00, 0x00, 0x09, 0x76, 0x70, 0x41, 0x67, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x5c, 0xc6, 0xad, + 0xc3, 0x00, 0x00, 0x02, 0x40, 0x49, 0x44, 0x41, 0x54, 0x38, 0xcb, 0xa5, + 0x92, 0x4b, 0x48, 0x54, 0x61, 0x18, 0x86, 0x9f, 0xff, 0x9f, 0x33, 0x73, + 0x66, 0xe6, 0xd8, 0x4c, 0xea, 0x4c, 0x65, 0xd0, 0x90, 0x25, 0x62, 0x84, + 0x10, 0xa6, 0x5d, 0xac, 0x50, 0xa9, 0x08, 0xda, 0x84, 0xbb, 0x08, 0xda, + 0x44, 0x05, 0x8a, 0x20, 0x16, 0x2d, 0xdc, 0xba, 0x10, 0xda, 0x64, 0x9b, + 0x0a, 0xa1, 0x68, 0xd1, 0xa6, 0x16, 0x6d, 0x82, 0xa2, 0xeb, 0x22, 0x08, + 0x31, 0xf2, 0x56, 0xd8, 0xc5, 0x44, 0x2d, 0x75, 0x12, 0x9d, 0xd1, 0xd1, + 0x99, 0x71, 0xee, 0xe7, 0xfc, 0x2d, 0x44, 0x04, 0x15, 0x91, 0x7a, 0xe1, + 0x83, 0x6f, 0xf1, 0xf2, 0x7c, 0x7c, 0xbc, 0xaf, 0x50, 0x4a, 0xf1, 0x3f, + 0xd2, 0x96, 0x17, 0x51, 0xd1, 0x09, 0xa9, 0x2c, 0xe8, 0x1a, 0xd8, 0x6d, + 0x90, 0xc8, 0x82, 0x00, 0x74, 0x3b, 0x58, 0x16, 0x44, 0x92, 0x67, 0xbd, + 0x7e, 0xa3, 0xc3, 0x5f, 0xe4, 0x29, 0xfd, 0x1d, 0xca, 0xf4, 0x66, 0xba, + 0x2e, 0x56, 0x02, 0xc8, 0x8d, 0xf9, 0x02, 0x4c, 0xab, 0x80, 0x48, 0xf2, + 0x76, 0xa0, 0x38, 0xff, 0x59, 0xe7, 0xcd, 0xd3, 0xa5, 0xad, 0xd7, 0x6a, + 0x70, 0xda, 0xf4, 0xfd, 0xcb, 0x8e, 0x8d, 0x01, 0xa6, 0x75, 0x46, 0x26, + 0x32, 0xef, 0xea, 0xcf, 0xed, 0x6b, 0x7e, 0x70, 0xa7, 0xde, 0x76, 0xa0, + 0x6e, 0x37, 0x73, 0x4a, 0x62, 0xda, 0x1c, 0x6b, 0x5f, 0x58, 0x39, 0x2a, + 0xc0, 0x52, 0x0e, 0xb2, 0x66, 0xbb, 0xdf, 0xe7, 0x6e, 0xba, 0xde, 0x78, + 0x54, 0x3f, 0x52, 0x5b, 0xc6, 0xe8, 0xa2, 0x64, 0xf8, 0xab, 0xc5, 0x87, + 0x8f, 0x61, 0xd2, 0x68, 0x0b, 0xeb, 0x03, 0x84, 0x80, 0x54, 0xee, 0x10, + 0xd9, 0xdc, 0xbd, 0x93, 0xb5, 0x7b, 0x2a, 0x1a, 0x1b, 0xaa, 0x89, 0xbb, + 0x0b, 0x79, 0xfa, 0x0d, 0xa2, 0xe1, 0x28, 0xdd, 0x6f, 0x07, 0x19, 0xfa, + 0x1e, 0xea, 0xc5, 0xa5, 0xdf, 0x58, 0x0f, 0xe0, 0x22, 0x91, 0x69, 0xf5, + 0x16, 0xb8, 0x1b, 0x9a, 0x5a, 0xaa, 0x7d, 0x55, 0x75, 0xe5, 0xbc, 0xfc, + 0xa9, 0xd1, 0x3f, 0x66, 0x91, 0x98, 0x1c, 0x63, 0xac, 0x6f, 0x28, 0x19, + 0x9f, 0x4d, 0xde, 0xc5, 0x6b, 0xb4, 0xa1, 0xc9, 0xe8, 0x5a, 0x40, 0xce, + 0x7c, 0x7d, 0xb8, 0xa6, 0xe4, 0x78, 0xc3, 0xd5, 0x6a, 0xc6, 0xad, 0x42, + 0x9a, 0x9f, 0x40, 0x64, 0x3e, 0x89, 0x1a, 0xe9, 0x21, 0x36, 0x13, 0xee, + 0xc7, 0xa6, 0x35, 0xe2, 0xb2, 0x77, 0x83, 0x62, 0x69, 0x56, 0x01, 0xa4, + 0x10, 0x2e, 0x97, 0xc7, 0xc9, 0xfb, 0x49, 0x9d, 0x57, 0x23, 0x30, 0x35, + 0x07, 0x32, 0xad, 0xf0, 0x4a, 0x81, 0xc7, 0x70, 0xa6, 0xa2, 0xa6, 0x7b, + 0x01, 0xa7, 0x01, 0x6e, 0x03, 0x74, 0x63, 0xe5, 0xeb, 0xe5, 0x22, 0x89, + 0x83, 0x9d, 0x6e, 0x62, 0x99, 0x76, 0xbb, 0x7f, 0xdb, 0xe5, 0xc0, 0xb1, + 0x4a, 0xc3, 0x51, 0x54, 0xcc, 0x44, 0x58, 0xe2, 0xd7, 0x2d, 0xca, 0xec, + 0x41, 0xbe, 0x0c, 0xfe, 0x99, 0x0f, 0x86, 0xd5, 0x2d, 0x3c, 0xde, 0x0e, + 0x9c, 0x46, 0x5c, 0x3d, 0x0a, 0xac, 0x8a, 0x51, 0x91, 0xc0, 0x65, 0x6f, + 0xc9, 0x66, 0x33, 0xf5, 0xa3, 0x5d, 0xfd, 0x43, 0xa1, 0x81, 0x01, 0x76, + 0x18, 0x09, 0x22, 0xa6, 0xe4, 0x53, 0x62, 0x17, 0x81, 0x8a, 0xf2, 0xad, + 0x25, 0x65, 0xbe, 0x36, 0x89, 0x7a, 0x81, 0xa5, 0xca, 0xd7, 0xef, 0x81, + 0x42, 0xa1, 0xd9, 0xde, 0x28, 0x87, 0x5e, 0x15, 0x9e, 0x0c, 0xdd, 0x9f, + 0xe8, 0xf9, 0xac, 0xf2, 0xd2, 0x61, 0x10, 0x8a, 0xbe, 0x29, 0x37, 0x19, + 0xdf, 0x5e, 0xf2, 0x77, 0x6e, 0x3f, 0x81, 0x94, 0xcf, 0x37, 0x2e, 0x92, + 0x10, 0x31, 0xa4, 0xbc, 0x92, 0x4e, 0x99, 0x17, 0x82, 0x3f, 0x7e, 0x0d, + 0x5b, 0xb3, 0x41, 0xf2, 0xdd, 0x39, 0x66, 0xe2, 0x82, 0x18, 0x5b, 0x10, + 0x0e, 0xa7, 0x7f, 0x73, 0x4d, 0x14, 0xe2, 0xb1, 0x92, 0x8e, 0x53, 0x73, + 0xd3, 0xb1, 0x87, 0xf3, 0xc1, 0x69, 0xf2, 0x64, 0x1a, 0x4d, 0x13, 0x28, + 0x9b, 0x93, 0xcd, 0x01, 0x96, 0x1c, 0xe3, 0x68, 0xda, 0xa5, 0x54, 0xd2, + 0x3a, 0x1f, 0x09, 0x2d, 0x06, 0x73, 0x99, 0x2c, 0xc2, 0x6e, 0x1f, 0x5b, + 0x93, 0xc2, 0xbf, 0xea, 0x2f, 0x8d, 0xc5, 0xe2, 0xc3, 0xdc, 0xde, 0xf5, + 0xc9, 0x00, 0x00, 0x00, 0x25, 0x74, 0x45, 0x58, 0x74, 0x63, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x2d, 0x64, 0x61, 0x74, 0x65, 0x00, 0x32, 0x30, 0x30, + 0x39, 0x2d, 0x31, 0x31, 0x2d, 0x31, 0x35, 0x54, 0x31, 0x36, 0x3a, 0x30, + 0x38, 0x3a, 0x34, 0x31, 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x24, 0xae, + 0xe1, 0xe0, 0x00, 0x00, 0x00, 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, + 0x74, 0x65, 0x3a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x00, 0x32, 0x30, + 0x31, 0x30, 0x2d, 0x30, 0x32, 0x2d, 0x32, 0x30, 0x54, 0x32, 0x33, 0x3a, + 0x32, 0x36, 0x3a, 0x31, 0x35, 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x06, + 0x3b, 0x5c, 0x81, 0x00, 0x00, 0x00, 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, + 0x61, 0x74, 0x65, 0x3a, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x00, 0x32, + 0x30, 0x31, 0x30, 0x2d, 0x30, 0x31, 0x2d, 0x31, 0x31, 0x54, 0x30, 0x39, + 0x3a, 0x31, 0x38, 0x3a, 0x33, 0x39, 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, + 0xf0, 0x5d, 0x31, 0xb1, 0x00, 0x00, 0x00, 0x35, 0x74, 0x45, 0x58, 0x74, + 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x00, 0x68, 0x74, 0x74, 0x70, + 0x3a, 0x2f, 0x2f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x76, 0x65, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x73, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x6c, + 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x73, 0x2f, 0x4c, 0x47, 0x50, 0x4c, + 0x2f, 0x32, 0x2e, 0x31, 0x2f, 0x3b, 0xc1, 0xb4, 0x18, 0x00, 0x00, 0x00, + 0x25, 0x74, 0x45, 0x58, 0x74, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x2d, + 0x64, 0x61, 0x74, 0x65, 0x00, 0x32, 0x30, 0x30, 0x39, 0x2d, 0x31, 0x31, + 0x2d, 0x31, 0x35, 0x54, 0x31, 0x36, 0x3a, 0x30, 0x38, 0x3a, 0x34, 0x31, + 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x7b, 0x1f, 0x97, 0xd4, 0x00, 0x00, + 0x00, 0x19, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, + 0x72, 0x65, 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x49, 0x6d, 0x61, + 0x67, 0x65, 0x52, 0x65, 0x61, 0x64, 0x79, 0x71, 0xc9, 0x65, 0x3c, 0x00, + 0x00, 0x00, 0x0d, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x00, 0x4e, 0x75, 0x76, 0x6f, 0x6c, 0x61, 0xac, 0x4f, 0x35, 0xf1, + 0x00, 0x00, 0x00, 0x34, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x5f, 0x55, 0x52, 0x4c, 0x00, 0x68, 0x74, 0x74, 0x70, 0x3a, + 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x63, 0x6f, 0x6e, 0x2d, 0x6b, + 0x69, 0x6e, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x6a, + 0x65, 0x63, 0x74, 0x73, 0x2f, 0x6e, 0x75, 0x76, 0x6f, 0x6c, 0x61, 0x2f, + 0x76, 0x3d, 0xb4, 0x52, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, + 0xae, 0x42, 0x60, 0x82 +}; + diff --git a/gui/resources/img_arrow_right_double_png.cpp b/gui/resources/img_arrow_right_double_png.cpp new file mode 100644 index 0000000..a27b47f --- /dev/null +++ b/gui/resources/img_arrow_right_double_png.cpp @@ -0,0 +1,113 @@ +static const uint8_t img_arrow_right_double_png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, 0x61, 0x00, 0x00, 0x00, + 0x04, 0x67, 0x41, 0x4d, 0x41, 0x00, 0x00, 0xaf, 0xc8, 0x37, 0x05, 0x8a, + 0xe9, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x00, + 0x48, 0x00, 0x00, 0x00, 0x48, 0x00, 0x46, 0xc9, 0x6b, 0x3e, 0x00, 0x00, + 0x00, 0x09, 0x76, 0x70, 0x41, 0x67, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x10, 0x00, 0x5c, 0xc6, 0xad, 0xc3, 0x00, 0x00, 0x00, 0x06, 0x62, + 0x4b, 0x47, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x43, 0xbb, + 0x7f, 0x00, 0x00, 0x03, 0x18, 0x49, 0x44, 0x41, 0x54, 0x18, 0x19, 0xa5, + 0xc1, 0x4b, 0x68, 0x1c, 0x65, 0x00, 0xc0, 0xf1, 0xff, 0xf7, 0x7d, 0x33, + 0xbb, 0x93, 0xd9, 0x6c, 0x76, 0xb3, 0x2f, 0xcc, 0x26, 0x6d, 0x1e, 0x95, + 0xb5, 0x52, 0x13, 0x2a, 0xb5, 0x01, 0x21, 0x36, 0x26, 0x28, 0x28, 0x54, + 0xb0, 0x14, 0x8a, 0x4a, 0x8b, 0xbd, 0x28, 0x0a, 0x82, 0x95, 0x82, 0x7a, + 0x91, 0x80, 0x55, 0xf0, 0x20, 0x62, 0x4f, 0x5e, 0x04, 0x3d, 0x78, 0x11, + 0xa4, 0xf8, 0x00, 0x95, 0xde, 0x82, 0xf5, 0x60, 0xb5, 0xf1, 0x91, 0xcd, + 0xd6, 0x62, 0xd2, 0xb4, 0x69, 0xd3, 0xcd, 0x63, 0x77, 0xb3, 0x93, 0x64, + 0x1f, 0x33, 0x3b, 0x33, 0x9f, 0x3d, 0x78, 0xf0, 0xde, 0xdf, 0x4f, 0x68, + 0xad, 0xb9, 0x17, 0x22, 0xf9, 0xd4, 0xb7, 0xf3, 0x51, 0x25, 0xe3, 0xeb, + 0x95, 0xf0, 0x18, 0xb6, 0xf5, 0x3b, 0xd1, 0x18, 0xb4, 0xeb, 0xe0, 0xac, + 0x80, 0x8a, 0x60, 0x18, 0xf2, 0x95, 0x74, 0xdc, 0xf8, 0xa4, 0xb6, 0xb6, + 0xfb, 0x4e, 0x27, 0x12, 0x7d, 0x0f, 0x25, 0x41, 0x73, 0x97, 0x06, 0xad, + 0x91, 0xfb, 0x87, 0x92, 0x85, 0xf3, 0x6f, 0x1f, 0x1e, 0xdc, 0x93, 0xb5, + 0x3e, 0xc7, 0x0b, 0xef, 0x07, 0x0d, 0x66, 0x0c, 0x3c, 0x03, 0xb6, 0x76, + 0x30, 0x5d, 0xef, 0xc8, 0xd9, 0xd7, 0x0e, 0x73, 0xe2, 0xd9, 0x07, 0xce, + 0xe1, 0xb8, 0x67, 0xf1, 0x80, 0xd0, 0x00, 0x61, 0x41, 0x34, 0x8e, 0x74, + 0x3a, 0x22, 0x28, 0x1c, 0xca, 0x31, 0xf3, 0xfa, 0xe8, 0x98, 0x6d, 0x1b, + 0x5f, 0xe2, 0xfb, 0x49, 0xba, 0x53, 0x10, 0x4b, 0x42, 0xe8, 0xd3, 0xe9, + 0x84, 0x61, 0x10, 0xb5, 0x78, 0x6b, 0xe6, 0x08, 0x13, 0x93, 0x83, 0x1f, + 0xd2, 0x08, 0x5f, 0x26, 0x34, 0x40, 0xc4, 0x20, 0x9a, 0x44, 0x31, 0x74, + 0xf2, 0x4c, 0x3c, 0x9f, 0xb1, 0x47, 0x47, 0xd3, 0x0c, 0xa7, 0x22, 0x7d, + 0x3f, 0xcd, 0xd5, 0x1f, 0x0d, 0x35, 0x17, 0x48, 0xe7, 0x5d, 0xdc, 0x2d, + 0xc2, 0xd0, 0x1f, 0xb7, 0x92, 0xa9, 0x89, 0x7c, 0xa1, 0x9f, 0xa9, 0x89, + 0x3e, 0xae, 0xfe, 0x53, 0x7d, 0x72, 0xed, 0x76, 0x6b, 0x89, 0x88, 0x59, + 0xc4, 0x34, 0x50, 0xcd, 0xec, 0x73, 0x5b, 0x4b, 0x37, 0x1b, 0x47, 0x5b, + 0x76, 0x56, 0x1c, 0x7c, 0xa8, 0x97, 0x7d, 0x19, 0x39, 0xf4, 0xf3, 0x15, + 0x67, 0x3f, 0x11, 0xeb, 0x6b, 0xa4, 0x17, 0xd0, 0xac, 0x95, 0x6e, 0x2e, + 0xd5, 0x1f, 0xab, 0xfb, 0xc9, 0x7e, 0xbb, 0x3f, 0xc7, 0x33, 0xd3, 0x39, + 0xa3, 0x38, 0x5f, 0x99, 0xaa, 0xac, 0x7b, 0xbf, 0x61, 0x47, 0x96, 0x15, + 0x23, 0x27, 0xe7, 0xb6, 0xab, 0x6d, 0xaf, 0x5c, 0xf3, 0x9f, 0x58, 0xf1, + 0xd3, 0x8c, 0x8f, 0x25, 0x19, 0x48, 0xe8, 0x07, 0xe7, 0x8a, 0xce, 0x00, + 0xd9, 0xc1, 0x1f, 0x50, 0xa2, 0x1e, 0x38, 0x95, 0xd9, 0xdb, 0x37, 0x2a, + 0x4f, 0xdf, 0x69, 0xa7, 0x52, 0x66, 0x2e, 0xcb, 0xb1, 0xe9, 0xb4, 0x3d, + 0xf7, 0xc7, 0xe6, 0xd4, 0xf6, 0x4e, 0x78, 0x49, 0x31, 0x74, 0x0a, 0xa4, + 0xbc, 0xb4, 0xbb, 0xed, 0xaa, 0x8d, 0x7a, 0x30, 0xf9, 0x97, 0x93, 0x62, + 0xf2, 0x50, 0x0f, 0x99, 0x6e, 0x7d, 0xb0, 0x74, 0xbd, 0x19, 0x60, 0x58, + 0xb3, 0x34, 0xca, 0xb5, 0x00, 0xe3, 0xe2, 0xe6, 0xea, 0xe6, 0xd1, 0xab, + 0xb5, 0x6c, 0x52, 0xa5, 0xd3, 0x1c, 0x9f, 0x4e, 0x26, 0xae, 0x14, 0x6b, + 0x8f, 0x1b, 0xc4, 0x53, 0xe0, 0x87, 0x18, 0x32, 0x68, 0x46, 0x14, 0x7a, + 0x65, 0x13, 0xf1, 0xc5, 0x65, 0x41, 0x5e, 0x9b, 0x18, 0xa6, 0xb0, 0xfc, + 0x8e, 0x82, 0x58, 0x06, 0x7c, 0xbd, 0xd3, 0x1d, 0x15, 0x5e, 0xcb, 0x0d, + 0xf9, 0xee, 0x32, 0x34, 0x47, 0x4c, 0xa2, 0x5d, 0x66, 0xd4, 0x40, 0x83, + 0x20, 0x7c, 0xf5, 0x40, 0x21, 0xf3, 0x7e, 0xa3, 0x77, 0x58, 0x58, 0x80, + 0x73, 0x67, 0x83, 0xc5, 0xe5, 0xea, 0x57, 0xc4, 0xac, 0x77, 0x69, 0x6d, + 0x41, 0x27, 0xdc, 0x9b, 0x49, 0x18, 0xdf, 0xef, 0x1b, 0x7f, 0xa4, 0xb0, + 0x28, 0xb3, 0xc4, 0xc2, 0x6d, 0x7e, 0xbc, 0x30, 0xbf, 0xe9, 0xb5, 0xdd, + 0x17, 0x25, 0xe8, 0x13, 0xf9, 0x81, 0xde, 0x8f, 0x5a, 0xa9, 0x61, 0xd9, + 0x94, 0x0a, 0xb3, 0x51, 0xa5, 0xb2, 0x5a, 0xbb, 0x88, 0x15, 0x39, 0x8d, + 0xb3, 0xda, 0xa2, 0x5e, 0x4e, 0xd9, 0xb6, 0xfa, 0xec, 0xbe, 0xb1, 0x87, + 0x0f, 0xdc, 0x8a, 0xe6, 0x49, 0xa8, 0x26, 0xd5, 0x85, 0xe2, 0xae, 0xd7, + 0x6e, 0xbc, 0x84, 0x29, 0x67, 0xa5, 0x8c, 0x5a, 0xe7, 0x1b, 0x3d, 0x7b, + 0xad, 0xb6, 0x61, 0x62, 0xb6, 0x1c, 0xca, 0xcb, 0xd5, 0x5f, 0xb5, 0x32, + 0x4e, 0x21, 0x74, 0x83, 0x96, 0x03, 0x82, 0x33, 0x61, 0x5f, 0x61, 0x7a, + 0x23, 0xbe, 0x87, 0x98, 0x70, 0xa9, 0x2e, 0x2c, 0x74, 0x1a, 0xb5, 0xc6, + 0x1b, 0x48, 0xf5, 0x0d, 0x77, 0x49, 0x1d, 0xe9, 0x4a, 0xf4, 0x64, 0x6c, + 0xba, 0xfc, 0x5d, 0x56, 0x97, 0xd6, 0x4b, 0x81, 0xe6, 0x38, 0xca, 0xdc, + 0x60, 0xbb, 0x0c, 0x81, 0x0b, 0x2a, 0x32, 0x62, 0xa6, 0xd2, 0xe4, 0x12, + 0x9a, 0x6a, 0x69, 0x01, 0x67, 0xbd, 0xfe, 0x26, 0x52, 0x7c, 0xca, 0x7f, + 0x8c, 0x6e, 0xdb, 0x50, 0xdd, 0x34, 0xb9, 0x7e, 0x6d, 0x6d, 0xd1, 0xef, + 0xe8, 0x17, 0x30, 0xd4, 0x2d, 0xdc, 0x5d, 0xf0, 0xda, 0x20, 0x22, 0x48, + 0x65, 0xca, 0x5c, 0x2c, 0xa0, 0x56, 0xba, 0x46, 0xad, 0x5c, 0x3b, 0x87, + 0x69, 0x7c, 0x8c, 0x10, 0xa0, 0x35, 0x48, 0x89, 0xd1, 0x6e, 0x77, 0x56, + 0x96, 0x4a, 0x6b, 0x71, 0xb7, 0x1d, 0x9e, 0x46, 0x89, 0x3f, 0x41, 0x40, + 0xe0, 0x82, 0x0c, 0xc0, 0xb2, 0xd0, 0x52, 0xfe, 0xb2, 0xfa, 0xf7, 0x8d, + 0xe7, 0xbd, 0xb6, 0xf7, 0x01, 0xa6, 0x39, 0x83, 0x10, 0xfc, 0x9f, 0xd0, + 0x5a, 0x73, 0x2f, 0xfe, 0x05, 0x4b, 0x10, 0x54, 0xc4, 0xf5, 0xf1, 0x8a, + 0xa7, 0x00, 0x00, 0x00, 0x25, 0x74, 0x45, 0x58, 0x74, 0x63, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x2d, 0x64, 0x61, 0x74, 0x65, 0x00, 0x32, 0x30, 0x30, + 0x39, 0x2d, 0x31, 0x31, 0x2d, 0x31, 0x35, 0x54, 0x31, 0x36, 0x3a, 0x30, + 0x38, 0x3a, 0x34, 0x31, 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x24, 0xae, + 0xe1, 0xe0, 0x00, 0x00, 0x00, 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, + 0x74, 0x65, 0x3a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x00, 0x32, 0x30, + 0x31, 0x30, 0x2d, 0x30, 0x32, 0x2d, 0x32, 0x30, 0x54, 0x32, 0x33, 0x3a, + 0x32, 0x36, 0x3a, 0x31, 0x35, 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x06, + 0x3b, 0x5c, 0x81, 0x00, 0x00, 0x00, 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, + 0x61, 0x74, 0x65, 0x3a, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x00, 0x32, + 0x30, 0x31, 0x30, 0x2d, 0x30, 0x31, 0x2d, 0x31, 0x31, 0x54, 0x30, 0x39, + 0x3a, 0x31, 0x38, 0x3a, 0x34, 0x31, 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, + 0xc9, 0x77, 0x76, 0xcf, 0x00, 0x00, 0x00, 0x35, 0x74, 0x45, 0x58, 0x74, + 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x00, 0x68, 0x74, 0x74, 0x70, + 0x3a, 0x2f, 0x2f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x76, 0x65, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x73, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x6c, + 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x73, 0x2f, 0x4c, 0x47, 0x50, 0x4c, + 0x2f, 0x32, 0x2e, 0x31, 0x2f, 0x3b, 0xc1, 0xb4, 0x18, 0x00, 0x00, 0x00, + 0x25, 0x74, 0x45, 0x58, 0x74, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x2d, + 0x64, 0x61, 0x74, 0x65, 0x00, 0x32, 0x30, 0x30, 0x39, 0x2d, 0x31, 0x31, + 0x2d, 0x31, 0x35, 0x54, 0x31, 0x36, 0x3a, 0x30, 0x38, 0x3a, 0x34, 0x31, + 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x7b, 0x1f, 0x97, 0xd4, 0x00, 0x00, + 0x00, 0x19, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, + 0x72, 0x65, 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x49, 0x6d, 0x61, + 0x67, 0x65, 0x52, 0x65, 0x61, 0x64, 0x79, 0x71, 0xc9, 0x65, 0x3c, 0x00, + 0x00, 0x00, 0x0d, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x00, 0x4e, 0x75, 0x76, 0x6f, 0x6c, 0x61, 0xac, 0x4f, 0x35, 0xf1, + 0x00, 0x00, 0x00, 0x34, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x5f, 0x55, 0x52, 0x4c, 0x00, 0x68, 0x74, 0x74, 0x70, 0x3a, + 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x63, 0x6f, 0x6e, 0x2d, 0x6b, + 0x69, 0x6e, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x6a, + 0x65, 0x63, 0x74, 0x73, 0x2f, 0x6e, 0x75, 0x76, 0x6f, 0x6c, 0x61, 0x2f, + 0x76, 0x3d, 0xb4, 0x52, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, + 0xae, 0x42, 0x60, 0x82 +}; + diff --git a/gui/resources/img_arrow_right_png.cpp b/gui/resources/img_arrow_right_png.cpp new file mode 100644 index 0000000..590e852 --- /dev/null +++ b/gui/resources/img_arrow_right_png.cpp @@ -0,0 +1,93 @@ +static const uint8_t img_arrow_right_png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, 0x61, 0x00, 0x00, 0x00, + 0x04, 0x67, 0x41, 0x4d, 0x41, 0x00, 0x00, 0xaf, 0xc8, 0x37, 0x05, 0x8a, + 0xe9, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47, 0x44, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xf9, 0x43, 0xbb, 0x7f, 0x00, 0x00, 0x00, 0x09, 0x70, + 0x48, 0x59, 0x73, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x48, 0x00, + 0x46, 0xc9, 0x6b, 0x3e, 0x00, 0x00, 0x00, 0x09, 0x76, 0x70, 0x41, 0x67, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x5c, 0xc6, 0xad, + 0xc3, 0x00, 0x00, 0x02, 0x2d, 0x49, 0x44, 0x41, 0x54, 0x38, 0xcb, 0xa5, + 0x93, 0x4f, 0x48, 0x14, 0x61, 0x18, 0xc6, 0x7f, 0xdf, 0xcc, 0xec, 0xce, + 0xee, 0xcc, 0x8e, 0xeb, 0xaa, 0x0d, 0x63, 0x59, 0xe9, 0xa2, 0x64, 0x98, + 0x21, 0x52, 0x92, 0x52, 0xd0, 0x4d, 0x24, 0x08, 0xba, 0x74, 0x89, 0x0e, + 0xdd, 0xec, 0x9f, 0x87, 0x40, 0xa8, 0x2e, 0xe1, 0xb5, 0x43, 0x45, 0x11, + 0xa6, 0x1b, 0x1e, 0x2a, 0x3c, 0x55, 0xd4, 0xc9, 0x10, 0xa2, 0x8b, 0x64, + 0x20, 0x44, 0x04, 0x75, 0x08, 0x95, 0xa0, 0x12, 0x94, 0x5c, 0x57, 0x73, + 0x9d, 0x71, 0x76, 0x67, 0xbe, 0x0e, 0xa5, 0x90, 0x59, 0x0a, 0xbe, 0xf0, + 0xc2, 0x7b, 0xfa, 0xf1, 0xf0, 0xbc, 0xcf, 0x23, 0xa4, 0x94, 0x6c, 0x65, + 0xb4, 0x95, 0x23, 0xda, 0x92, 0x19, 0xad, 0x76, 0xac, 0x43, 0xdf, 0xa7, + 0x17, 0x27, 0xe7, 0xe6, 0x8a, 0x97, 0xb0, 0x53, 0xcf, 0xd1, 0x2d, 0x90, + 0x51, 0xd0, 0x0d, 0x48, 0x58, 0xa0, 0xc4, 0x41, 0x35, 0xc1, 0x34, 0x90, + 0x99, 0x24, 0x00, 0xca, 0x0a, 0x40, 0x97, 0x34, 0x75, 0x77, 0xb5, 0x91, + 0xb9, 0xd1, 0x9e, 0x4e, 0xd7, 0x55, 0x3c, 0x23, 0xe7, 0xdf, 0x25, 0x08, + 0x6d, 0xc4, 0xff, 0x15, 0xac, 0x02, 0x42, 0x09, 0x59, 0xa9, 0xd0, 0xd0, + 0xb6, 0x93, 0xfb, 0x37, 0x3b, 0x38, 0x79, 0x62, 0xcf, 0x39, 0x65, 0x39, + 0x7c, 0x49, 0x20, 0x8f, 0x6f, 0x0a, 0xe0, 0x11, 0xc9, 0x8e, 0x8c, 0xce, + 0xf0, 0xea, 0x43, 0xc8, 0x67, 0x69, 0x72, 0xb6, 0xf3, 0x20, 0xd7, 0x2f, + 0x1f, 0xd8, 0xe7, 0x54, 0x18, 0x4f, 0x28, 0xc8, 0xdb, 0x84, 0x32, 0xbe, + 0x1e, 0x40, 0xac, 0x98, 0x28, 0x5a, 0x1f, 0xb5, 0xe2, 0xab, 0xb7, 0x6a, + 0x1b, 0x77, 0xb5, 0xb4, 0xb5, 0xef, 0xa7, 0xa4, 0xcc, 0xa2, 0x79, 0x07, + 0xa4, 0xa4, 0x4b, 0xdf, 0xe3, 0x6f, 0x0c, 0x8f, 0xe5, 0xdf, 0x87, 0xba, + 0x71, 0x9e, 0x78, 0x62, 0x84, 0x84, 0x81, 0xec, 0x4f, 0xae, 0x01, 0x1c, + 0x1e, 0x04, 0x11, 0xb3, 0xf0, 0x94, 0x2b, 0xa6, 0x53, 0x76, 0x31, 0xdd, + 0x54, 0x9b, 0x30, 0x9c, 0x4a, 0x1a, 0xab, 0x04, 0xc7, 0xf6, 0x86, 0xbc, + 0xfb, 0x98, 0xe3, 0xce, 0xd3, 0x1f, 0xb9, 0xec, 0xa2, 0xd6, 0x47, 0x79, + 0xa2, 0x47, 0x66, 0x92, 0xee, 0x3a, 0x00, 0xfd, 0xd7, 0xc6, 0xad, 0x66, + 0x54, 0xbd, 0xd7, 0xb4, 0x2b, 0x5a, 0x34, 0x7b, 0x37, 0x96, 0x19, 0xe1, + 0xcc, 0x11, 0xa8, 0x4b, 0x16, 0xb8, 0xf7, 0x22, 0xcf, 0xeb, 0x09, 0xe5, + 0x8d, 0x1c, 0x28, 0x69, 0xfd, 0xe3, 0x8d, 0xd8, 0xf5, 0x10, 0xf2, 0x7b, + 0xc5, 0x82, 0x65, 0x08, 0x57, 0xd7, 0x54, 0xe6, 0x3d, 0xc9, 0x7c, 0x01, + 0xfa, 0x47, 0xa0, 0xa3, 0x41, 0x25, 0x6e, 0xc5, 0x50, 0x22, 0xac, 0xfa, + 0xa1, 0xad, 0xf1, 0xc4, 0xa4, 0x10, 0x5e, 0x70, 0x1c, 0xa3, 0xbb, 0xa9, + 0xc1, 0x2e, 0x1f, 0x77, 0xcb, 0x59, 0x5a, 0x14, 0xa4, 0xb7, 0x49, 0x8a, + 0xcb, 0x3e, 0x83, 0xc3, 0x45, 0xcf, 0xf7, 0x94, 0x01, 0x4c, 0xf5, 0xea, + 0xdf, 0x00, 0x29, 0xeb, 0x85, 0xa4, 0xb7, 0xa6, 0x36, 0x75, 0xb4, 0xb2, + 0xa6, 0x8a, 0xb7, 0x59, 0x1d, 0x57, 0xc2, 0xf6, 0x54, 0x40, 0x76, 0xc6, + 0x67, 0x36, 0x17, 0x4c, 0x84, 0x52, 0xed, 0x22, 0x2a, 0x86, 0x00, 0xb9, + 0x8e, 0x02, 0x65, 0xa8, 0xb4, 0xca, 0xae, 0x2e, 0xda, 0x95, 0x8c, 0x4d, + 0x29, 0x24, 0x62, 0x50, 0x12, 0xf1, 0xf9, 0xfa, 0x65, 0x19, 0xcf, 0x57, + 0x1f, 0xa2, 0x69, 0x5d, 0x84, 0xe4, 0x08, 0xff, 0x11, 0x65, 0x11, 0x8d, + 0x39, 0x4b, 0x6a, 0x29, 0x6e, 0x5e, 0xa1, 0x34, 0x1e, 0x50, 0xf4, 0x5c, + 0xa6, 0xa6, 0x83, 0x49, 0x29, 0xb4, 0x1e, 0x34, 0xf1, 0x60, 0xc3, 0x2e, + 0x48, 0x4d, 0x47, 0x51, 0x14, 0x4c, 0xe1, 0xb3, 0x30, 0xeb, 0xe2, 0xf9, + 0x0c, 0xa2, 0xaa, 0xd7, 0x80, 0xf1, 0x4d, 0x25, 0x51, 0xa8, 0xfa, 0xa7, + 0xc0, 0x75, 0x99, 0x9b, 0xcd, 0x4f, 0x7b, 0x3e, 0xa7, 0xd1, 0xd4, 0x53, + 0x08, 0xc6, 0xd9, 0xa0, 0xac, 0x62, 0xab, 0x75, 0xfe, 0x09, 0xcc, 0xc0, + 0xd0, 0x98, 0x25, 0x66, 0x67, 0xc0, 0x00, 0x00, 0x00, 0x25, 0x74, 0x45, + 0x58, 0x74, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x2d, 0x64, 0x61, 0x74, + 0x65, 0x00, 0x32, 0x30, 0x30, 0x39, 0x2d, 0x31, 0x31, 0x2d, 0x31, 0x35, + 0x54, 0x31, 0x36, 0x3a, 0x30, 0x38, 0x3a, 0x34, 0x31, 0x2d, 0x30, 0x37, + 0x3a, 0x30, 0x30, 0x24, 0xae, 0xe1, 0xe0, 0x00, 0x00, 0x00, 0x25, 0x74, + 0x45, 0x58, 0x74, 0x64, 0x61, 0x74, 0x65, 0x3a, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x00, 0x32, 0x30, 0x31, 0x30, 0x2d, 0x30, 0x32, 0x2d, 0x32, + 0x30, 0x54, 0x32, 0x33, 0x3a, 0x32, 0x36, 0x3a, 0x31, 0x35, 0x2d, 0x30, + 0x37, 0x3a, 0x30, 0x30, 0x06, 0x3b, 0x5c, 0x81, 0x00, 0x00, 0x00, 0x25, + 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, 0x74, 0x65, 0x3a, 0x6d, 0x6f, 0x64, + 0x69, 0x66, 0x79, 0x00, 0x32, 0x30, 0x31, 0x30, 0x2d, 0x30, 0x31, 0x2d, + 0x31, 0x31, 0x54, 0x30, 0x39, 0x3a, 0x31, 0x38, 0x3a, 0x33, 0x39, 0x2d, + 0x30, 0x37, 0x3a, 0x30, 0x30, 0xf0, 0x5d, 0x31, 0xb1, 0x00, 0x00, 0x00, + 0x35, 0x74, 0x45, 0x58, 0x74, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, + 0x00, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x69, 0x76, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x73, 0x2e, + 0x6f, 0x72, 0x67, 0x2f, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x73, + 0x2f, 0x4c, 0x47, 0x50, 0x4c, 0x2f, 0x32, 0x2e, 0x31, 0x2f, 0x3b, 0xc1, + 0xb4, 0x18, 0x00, 0x00, 0x00, 0x25, 0x74, 0x45, 0x58, 0x74, 0x6d, 0x6f, + 0x64, 0x69, 0x66, 0x79, 0x2d, 0x64, 0x61, 0x74, 0x65, 0x00, 0x32, 0x30, + 0x30, 0x39, 0x2d, 0x31, 0x31, 0x2d, 0x31, 0x35, 0x54, 0x31, 0x36, 0x3a, + 0x30, 0x38, 0x3a, 0x34, 0x31, 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x7b, + 0x1f, 0x97, 0xd4, 0x00, 0x00, 0x00, 0x19, 0x74, 0x45, 0x58, 0x74, 0x53, + 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, 0x64, 0x6f, 0x62, + 0x65, 0x20, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x61, 0x64, 0x79, + 0x71, 0xc9, 0x65, 0x3c, 0x00, 0x00, 0x00, 0x0d, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x00, 0x4e, 0x75, 0x76, 0x6f, 0x6c, + 0x61, 0xac, 0x4f, 0x35, 0xf1, 0x00, 0x00, 0x00, 0x34, 0x74, 0x45, 0x58, + 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x55, 0x52, 0x4c, 0x00, + 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x69, + 0x63, 0x6f, 0x6e, 0x2d, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x6e, 0x75, + 0x76, 0x6f, 0x6c, 0x61, 0x2f, 0x76, 0x3d, 0xb4, 0x52, 0x00, 0x00, 0x00, + 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; + diff --git a/gui/resources/img_arrow_up_png.cpp b/gui/resources/img_arrow_up_png.cpp new file mode 100644 index 0000000..867ff3b --- /dev/null +++ b/gui/resources/img_arrow_up_png.cpp @@ -0,0 +1,95 @@ +static const uint8_t img_arrow_up_png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, 0x61, 0x00, 0x00, 0x00, + 0x04, 0x67, 0x41, 0x4d, 0x41, 0x00, 0x00, 0xaf, 0xc8, 0x37, 0x05, 0x8a, + 0xe9, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47, 0x44, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xf9, 0x43, 0xbb, 0x7f, 0x00, 0x00, 0x00, 0x09, 0x70, + 0x48, 0x59, 0x73, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x48, 0x00, + 0x46, 0xc9, 0x6b, 0x3e, 0x00, 0x00, 0x00, 0x09, 0x76, 0x70, 0x41, 0x67, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x5c, 0xc6, 0xad, + 0xc3, 0x00, 0x00, 0x02, 0x3d, 0x49, 0x44, 0x41, 0x54, 0x38, 0xcb, 0xc5, + 0x93, 0xcb, 0x4b, 0x54, 0x71, 0x14, 0x80, 0xbf, 0xdf, 0x7d, 0xcc, 0xf5, + 0xce, 0x13, 0x1d, 0x1d, 0x75, 0x42, 0xab, 0x31, 0xcd, 0x1e, 0x46, 0x14, + 0x09, 0x33, 0x58, 0xb4, 0xa8, 0x24, 0x5d, 0x24, 0xb5, 0xc8, 0x88, 0x16, + 0x62, 0x9b, 0x44, 0x92, 0x16, 0x45, 0x6d, 0xa2, 0x5c, 0x48, 0x04, 0xe9, + 0x22, 0x2a, 0xa8, 0x7f, 0xa2, 0x16, 0x11, 0x04, 0x12, 0x2d, 0x34, 0x03, + 0x63, 0xc0, 0x7c, 0x95, 0x86, 0x16, 0x93, 0x8c, 0x58, 0xe6, 0x60, 0xce, + 0x8c, 0x33, 0x73, 0xef, 0xaf, 0x85, 0xe4, 0x83, 0x6c, 0xd5, 0xa2, 0x03, + 0xdf, 0xea, 0x70, 0xbe, 0x73, 0x0e, 0x9c, 0x23, 0xa4, 0x94, 0xfc, 0x4b, + 0x28, 0xff, 0x54, 0x0d, 0x68, 0x00, 0xe2, 0xd0, 0xe3, 0x3f, 0x33, 0x52, + 0x9a, 0xa4, 0xad, 0x97, 0x42, 0x08, 0x53, 0x1a, 0xea, 0x11, 0x14, 0x35, + 0x89, 0xd8, 0xd8, 0x4f, 0xbe, 0x6d, 0xf9, 0x3d, 0x81, 0xd8, 0x88, 0x0d, + 0x7c, 0x4b, 0xdd, 0x68, 0xa8, 0x2b, 0xab, 0x6b, 0x3e, 0x59, 0x71, 0x90, + 0xf9, 0x64, 0x17, 0x9a, 0x29, 0xf0, 0x96, 0x80, 0xb7, 0x74, 0x8d, 0xbf, + 0xae, 0x90, 0xce, 0xd5, 0xfa, 0xfd, 0xe6, 0xa5, 0xbb, 0x57, 0x23, 0x34, + 0x9d, 0x0f, 0xe3, 0x0e, 0xf8, 0x2e, 0x92, 0xc9, 0x1e, 0x43, 0x4a, 0x36, + 0xb0, 0xa9, 0xc0, 0x96, 0x0e, 0x52, 0xd9, 0x47, 0xb7, 0xaf, 0xd4, 0x16, + 0x2a, 0xc5, 0x7e, 0x86, 0x7e, 0x7a, 0xd8, 0x7b, 0x22, 0xe2, 0x12, 0x88, + 0xfb, 0xd8, 0xd2, 0x83, 0x94, 0x60, 0x5b, 0x2b, 0xac, 0x09, 0xe4, 0x0a, + 0x39, 0x1b, 0x16, 0x97, 0xbb, 0x4e, 0xd5, 0x87, 0x0e, 0x34, 0x36, 0xd5, + 0xf0, 0x6c, 0x14, 0xa6, 0xe3, 0xa0, 0x96, 0x56, 0x62, 0x94, 0x57, 0xee, + 0xc4, 0xb6, 0xbb, 0xc9, 0x73, 0x43, 0x7e, 0x19, 0xf8, 0xb7, 0x6f, 0x32, + 0x41, 0xd6, 0xaa, 0x0f, 0x06, 0x9c, 0xed, 0xd7, 0x3a, 0x22, 0xf4, 0xc7, + 0x35, 0xa2, 0x13, 0x29, 0x26, 0xa6, 0x96, 0x98, 0x9c, 0x53, 0xc8, 0x94, + 0xec, 0x03, 0xa7, 0xa7, 0x15, 0x45, 0x6b, 0xc6, 0x70, 0x81, 0xe1, 0x59, + 0x27, 0x10, 0x02, 0x2c, 0x59, 0xa0, 0x66, 0xad, 0x3b, 0xd7, 0x2f, 0x87, + 0x8d, 0x05, 0xaf, 0x9f, 0xde, 0x71, 0x9b, 0xd7, 0x4f, 0xfb, 0xf9, 0xd4, + 0x37, 0x80, 0x5b, 0xb1, 0xb1, 0x35, 0x17, 0x4a, 0x70, 0x97, 0x00, 0xd1, + 0x89, 0x6d, 0x95, 0x23, 0xed, 0x75, 0x02, 0x4b, 0xc2, 0x8f, 0xd4, 0xcd, + 0xd3, 0x8d, 0x55, 0xfb, 0xab, 0xc3, 0xd5, 0xf4, 0x7e, 0x80, 0x68, 0xdf, + 0x24, 0xb3, 0xd3, 0xf1, 0x68, 0x26, 0x91, 0x78, 0x53, 0xc1, 0x17, 0x0a, + 0x3d, 0xa0, 0xe5, 0x17, 0x63, 0xf8, 0x83, 0x95, 0x64, 0xad, 0x5b, 0x28, + 0xca, 0x3a, 0xc1, 0x62, 0xba, 0x61, 0x5b, 0x28, 0xbf, 0xfd, 0xcc, 0x85, + 0x30, 0x03, 0x33, 0x0a, 0xc3, 0x63, 0x09, 0x46, 0xfb, 0x47, 0x52, 0xe8, + 0x7a, 0xdb, 0x62, 0xce, 0xd1, 0x3a, 0xfc, 0x3e, 0xb6, 0x10, 0x2a, 0x48, + 0xe2, 0x75, 0x41, 0x59, 0x55, 0x10, 0xd3, 0xe7, 0x6a, 0x41, 0x3a, 0xce, + 0xae, 0x0a, 0x7c, 0x3e, 0xb3, 0xa7, 0xad, 0xe3, 0xa8, 0x3a, 0xef, 0xf6, + 0x32, 0x34, 0x25, 0x19, 0xec, 0x8d, 0xb2, 0xbc, 0x94, 0x7c, 0x88, 0xae, + 0x0e, 0xa0, 0xca, 0xb1, 0x99, 0xb9, 0x4c, 0xf7, 0xdc, 0x54, 0x8c, 0xad, + 0x45, 0x36, 0xd5, 0x3b, 0x74, 0x22, 0x91, 0x62, 0x1c, 0xa6, 0x76, 0x6f, + 0xf5, 0x12, 0x7d, 0x01, 0x77, 0x55, 0x6c, 0x49, 0x63, 0xfc, 0x45, 0x9c, + 0x8f, 0x23, 0xb3, 0xcc, 0x7f, 0x9d, 0x7d, 0x87, 0xdb, 0xd5, 0x89, 0x00, + 0xbc, 0x01, 0x40, 0xeb, 0xf9, 0x1c, 0x4b, 0x1f, 0x97, 0xee, 0xef, 0x87, + 0x3d, 0x0e, 0x2f, 0x9a, 0xaa, 0x62, 0x7a, 0x9d, 0x5b, 0x00, 0x84, 0x94, + 0x12, 0xbd, 0xf6, 0xc9, 0xa0, 0x2a, 0xf4, 0x3d, 0x39, 0xd5, 0xc0, 0x52, + 0xb4, 0x04, 0x9a, 0x7e, 0x0e, 0x45, 0x79, 0x85, 0x94, 0xe0, 0x0f, 0x81, + 0xb4, 0x41, 0x71, 0xd4, 0x08, 0x87, 0xf3, 0xb9, 0x6e, 0xe4, 0x15, 0xa1, + 0x9b, 0xe4, 0x34, 0x63, 0xca, 0x7a, 0x60, 0xec, 0x16, 0xff, 0xfd, 0x1b, + 0x7f, 0x01, 0x2c, 0x42, 0xd1, 0x2f, 0x6d, 0x4e, 0x90, 0x2a, 0x00, 0x00, + 0x00, 0x25, 0x74, 0x45, 0x58, 0x74, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x2d, 0x64, 0x61, 0x74, 0x65, 0x00, 0x32, 0x30, 0x30, 0x39, 0x2d, 0x31, + 0x31, 0x2d, 0x31, 0x35, 0x54, 0x31, 0x36, 0x3a, 0x30, 0x38, 0x3a, 0x34, + 0x31, 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x24, 0xae, 0xe1, 0xe0, 0x00, + 0x00, 0x00, 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, 0x74, 0x65, 0x3a, + 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x00, 0x32, 0x30, 0x31, 0x30, 0x2d, + 0x30, 0x32, 0x2d, 0x32, 0x30, 0x54, 0x32, 0x33, 0x3a, 0x32, 0x36, 0x3a, + 0x31, 0x35, 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x06, 0x3b, 0x5c, 0x81, + 0x00, 0x00, 0x00, 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, 0x74, 0x65, + 0x3a, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x00, 0x32, 0x30, 0x31, 0x30, + 0x2d, 0x30, 0x31, 0x2d, 0x31, 0x31, 0x54, 0x30, 0x39, 0x3a, 0x31, 0x38, + 0x3a, 0x34, 0x30, 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x6f, 0x00, 0x7d, + 0x7b, 0x00, 0x00, 0x00, 0x35, 0x74, 0x45, 0x58, 0x74, 0x4c, 0x69, 0x63, + 0x65, 0x6e, 0x73, 0x65, 0x00, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, + 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x76, 0x65, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x73, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x6c, 0x69, 0x63, 0x65, + 0x6e, 0x73, 0x65, 0x73, 0x2f, 0x4c, 0x47, 0x50, 0x4c, 0x2f, 0x32, 0x2e, + 0x31, 0x2f, 0x3b, 0xc1, 0xb4, 0x18, 0x00, 0x00, 0x00, 0x25, 0x74, 0x45, + 0x58, 0x74, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x2d, 0x64, 0x61, 0x74, + 0x65, 0x00, 0x32, 0x30, 0x30, 0x39, 0x2d, 0x31, 0x31, 0x2d, 0x31, 0x35, + 0x54, 0x31, 0x36, 0x3a, 0x30, 0x38, 0x3a, 0x34, 0x31, 0x2d, 0x30, 0x37, + 0x3a, 0x30, 0x30, 0x7b, 0x1f, 0x97, 0xd4, 0x00, 0x00, 0x00, 0x19, 0x74, + 0x45, 0x58, 0x74, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, + 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, + 0x65, 0x61, 0x64, 0x79, 0x71, 0xc9, 0x65, 0x3c, 0x00, 0x00, 0x00, 0x0d, + 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x00, 0x4e, + 0x75, 0x76, 0x6f, 0x6c, 0x61, 0xac, 0x4f, 0x35, 0xf1, 0x00, 0x00, 0x00, + 0x34, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, + 0x55, 0x52, 0x4c, 0x00, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, + 0x77, 0x77, 0x2e, 0x69, 0x63, 0x6f, 0x6e, 0x2d, 0x6b, 0x69, 0x6e, 0x67, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, + 0x73, 0x2f, 0x6e, 0x75, 0x76, 0x6f, 0x6c, 0x61, 0x2f, 0x76, 0x3d, 0xb4, + 0x52, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, + 0x82 +}; + diff --git a/gui/resources/img_home_png.cpp b/gui/resources/img_home_png.cpp new file mode 100644 index 0000000..6b89f52 --- /dev/null +++ b/gui/resources/img_home_png.cpp @@ -0,0 +1,76 @@ +static const uint8_t img_home_png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x03, 0x00, 0x00, 0x00, 0x28, 0x2d, 0x0f, 0x53, 0x00, 0x00, 0x00, + 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, + 0x48, 0x00, 0x46, 0xc9, 0x6b, 0x3e, 0x00, 0x00, 0x00, 0x09, 0x76, 0x70, + 0x41, 0x67, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x5c, + 0xc6, 0xad, 0xc3, 0x00, 0x00, 0x00, 0xd8, 0x50, 0x4c, 0x54, 0x45, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0x2b, 0x55, 0x80, 0x1a, 0x4d, 0x80, 0x1e, + 0x4b, 0x87, 0x1b, 0x51, 0x86, 0x23, 0x47, 0x87, 0x20, 0x4a, 0x86, 0x20, + 0x4d, 0x88, 0x23, 0x4b, 0x8a, 0x1f, 0x4a, 0x86, 0x24, 0x4d, 0x8a, 0x21, + 0x4b, 0x87, 0x20, 0x4a, 0x88, 0x24, 0x4f, 0x8b, 0x23, 0x4e, 0x8b, 0x25, + 0x4f, 0x8b, 0x24, 0x4f, 0x8a, 0x24, 0x4f, 0x8b, 0x23, 0x4e, 0x8a, 0x24, + 0x4e, 0x89, 0x25, 0x4f, 0x8a, 0x3e, 0x68, 0x9e, 0x2c, 0x55, 0x8f, 0x35, + 0x5e, 0x95, 0x49, 0x70, 0xa5, 0x25, 0x4e, 0x8a, 0x58, 0x7d, 0xae, 0x58, + 0x7d, 0xaf, 0x52, 0x79, 0xac, 0x6a, 0x8f, 0xbb, 0x7e, 0xa1, 0xc8, 0x20, + 0x4a, 0x87, 0x23, 0x4c, 0x88, 0x23, 0x4d, 0x89, 0x26, 0x4f, 0x8a, 0x40, + 0x75, 0xac, 0x45, 0x78, 0xad, 0x47, 0x7b, 0xb1, 0x4e, 0x81, 0xb6, 0x52, + 0x82, 0xb4, 0x55, 0x87, 0xba, 0x5b, 0x80, 0xb0, 0x5c, 0x8d, 0xbf, 0x5f, + 0x8c, 0xbb, 0x63, 0x92, 0xc4, 0x65, 0x94, 0xc5, 0x6a, 0x95, 0xc2, 0x6a, + 0x98, 0xc9, 0x6b, 0x99, 0xc9, 0x6f, 0x9c, 0xcb, 0x70, 0x9b, 0xc9, 0x71, + 0x9e, 0xce, 0x72, 0x9f, 0xcf, 0x76, 0x9f, 0xc8, 0x77, 0xa2, 0xd0, 0x78, + 0xa3, 0xd1, 0x80, 0xa6, 0xcd, 0x89, 0xae, 0xd7, 0x89, 0xaf, 0xd7, 0x8a, + 0xab, 0xd0, 0x8b, 0xad, 0xd3, 0x8b, 0xaf, 0xd5, 0x8c, 0xaf, 0xd4, 0x8f, + 0xb3, 0xd8, 0x93, 0xb2, 0xd6, 0x96, 0xb6, 0xd9, 0x9a, 0xb9, 0xdc, 0x9b, + 0xbb, 0xdd, 0x9c, 0xba, 0xdb, 0xa0, 0xbe, 0xde, 0xa1, 0xbf, 0xdf, 0xee, + 0xb5, 0x9c, 0x5d, 0x00, 0x00, 0x00, 0x20, 0x74, 0x52, 0x4e, 0x53, 0x00, + 0x01, 0x06, 0x0a, 0x11, 0x13, 0x24, 0x37, 0x4f, 0x6d, 0x72, 0x8e, 0xa4, + 0xad, 0xb9, 0xbd, 0xc8, 0xc9, 0xcb, 0xe4, 0xf0, 0xf5, 0xf5, 0xf6, 0xf6, + 0xf6, 0xf7, 0xf8, 0xf8, 0xf9, 0xfc, 0xfe, 0x9b, 0x6b, 0xc4, 0x2c, 0x00, + 0x00, 0x00, 0x01, 0x62, 0x4b, 0x47, 0x44, 0x00, 0x88, 0x05, 0x1d, 0x48, + 0x00, 0x00, 0x00, 0x8f, 0x49, 0x44, 0x41, 0x54, 0x18, 0x19, 0x6d, 0xc1, + 0xd5, 0x16, 0x82, 0x40, 0x00, 0x04, 0xd0, 0x11, 0xb0, 0xbb, 0x5b, 0x47, + 0xec, 0xc4, 0x40, 0xec, 0x46, 0xf9, 0xff, 0x3f, 0x92, 0xd5, 0xd5, 0xe3, + 0x83, 0xf7, 0x02, 0xff, 0x79, 0x42, 0x2a, 0x34, 0x4d, 0xc3, 0x57, 0xb8, + 0x99, 0x50, 0x59, 0x22, 0x3e, 0x82, 0x85, 0x7b, 0x39, 0xa5, 0x3b, 0x84, + 0x14, 0xc8, 0x5f, 0x76, 0x76, 0x85, 0x0e, 0xf1, 0xe6, 0xcf, 0xee, 0xb7, + 0xcb, 0xb5, 0x3d, 0x70, 0x88, 0x17, 0x5f, 0xa6, 0x7e, 0x36, 0x4d, 0x73, + 0x75, 0x7b, 0x50, 0x81, 0xcb, 0x9b, 0xae, 0x1d, 0x67, 0x53, 0xd7, 0xfc, + 0x5a, 0x8c, 0x2b, 0x80, 0x92, 0xac, 0x9e, 0x26, 0xe3, 0x97, 0xc5, 0x21, + 0x17, 0x53, 0x10, 0xa1, 0xbe, 0x19, 0x4a, 0x9b, 0x06, 0xa3, 0x00, 0x68, + 0xf5, 0x25, 0x8b, 0x10, 0x68, 0x74, 0x25, 0x83, 0x10, 0x38, 0xea, 0x48, + 0x23, 0x42, 0x60, 0xaf, 0x25, 0xf5, 0x08, 0x81, 0xed, 0x2f, 0x42, 0xe0, + 0x0f, 0xe0, 0x09, 0xae, 0x09, 0x18, 0x3d, 0x63, 0x45, 0x1d, 0xfa, 0x00, + 0x00, 0x00, 0x25, 0x74, 0x45, 0x58, 0x74, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x2d, 0x64, 0x61, 0x74, 0x65, 0x00, 0x32, 0x30, 0x30, 0x39, 0x2d, + 0x31, 0x31, 0x2d, 0x31, 0x35, 0x54, 0x32, 0x33, 0x3a, 0x30, 0x34, 0x3a, + 0x30, 0x35, 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x2f, 0xd9, 0xbd, 0x4f, + 0x00, 0x00, 0x00, 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, 0x74, 0x65, + 0x3a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x00, 0x32, 0x30, 0x31, 0x30, + 0x2d, 0x30, 0x32, 0x2d, 0x32, 0x30, 0x54, 0x32, 0x33, 0x3a, 0x32, 0x36, + 0x3a, 0x31, 0x35, 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x06, 0x3b, 0x5c, + 0x81, 0x00, 0x00, 0x00, 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, 0x74, + 0x65, 0x3a, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x00, 0x32, 0x30, 0x31, + 0x30, 0x2d, 0x30, 0x31, 0x2d, 0x31, 0x31, 0x54, 0x30, 0x39, 0x3a, 0x30, + 0x38, 0x3a, 0x33, 0x39, 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x31, 0xd3, + 0xee, 0x71, 0x00, 0x00, 0x00, 0x34, 0x74, 0x45, 0x58, 0x74, 0x4c, 0x69, + 0x63, 0x65, 0x6e, 0x73, 0x65, 0x00, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, + 0x2f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x76, 0x65, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x73, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x6c, 0x69, 0x63, + 0x65, 0x6e, 0x73, 0x65, 0x73, 0x2f, 0x47, 0x50, 0x4c, 0x2f, 0x32, 0x2e, + 0x30, 0x2f, 0x6c, 0x6a, 0x06, 0xa8, 0x00, 0x00, 0x00, 0x25, 0x74, 0x45, + 0x58, 0x74, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x2d, 0x64, 0x61, 0x74, + 0x65, 0x00, 0x32, 0x30, 0x30, 0x39, 0x2d, 0x31, 0x31, 0x2d, 0x31, 0x35, + 0x54, 0x32, 0x33, 0x3a, 0x30, 0x34, 0x3a, 0x30, 0x35, 0x2d, 0x30, 0x37, + 0x3a, 0x30, 0x30, 0x70, 0x68, 0xcb, 0x7b, 0x00, 0x00, 0x00, 0x17, 0x74, + 0x45, 0x58, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x00, 0x47, 0x4e, + 0x4f, 0x4d, 0x45, 0x20, 0x49, 0x63, 0x6f, 0x6e, 0x20, 0x54, 0x68, 0x65, + 0x6d, 0x65, 0xc1, 0xf9, 0x26, 0x69, 0x00, 0x00, 0x00, 0x20, 0x74, 0x45, + 0x58, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x55, 0x52, 0x4c, + 0x00, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x61, 0x72, 0x74, 0x2e, + 0x67, 0x6e, 0x6f, 0x6d, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x32, 0xe4, + 0x91, 0x79, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, + 0x60, 0x82 +}; + diff --git a/gui/resources/img_minus_png.cpp b/gui/resources/img_minus_png.cpp new file mode 100644 index 0000000..09eb20b --- /dev/null +++ b/gui/resources/img_minus_png.cpp @@ -0,0 +1,66 @@ +static const uint8_t img_minus_png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, 0x61, 0x00, 0x00, 0x00, + 0x06, 0x62, 0x4b, 0x47, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, + 0x43, 0xbb, 0x7f, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, + 0x00, 0x01, 0xbb, 0x00, 0x00, 0x01, 0xbb, 0x01, 0x3a, 0xec, 0xe3, 0xe2, + 0x00, 0x00, 0x00, 0x09, 0x76, 0x70, 0x41, 0x67, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x5c, 0xc6, 0xad, 0xc3, 0x00, 0x00, 0x00, + 0xca, 0x49, 0x44, 0x41, 0x54, 0x38, 0xcb, 0xe5, 0x91, 0x3d, 0x0a, 0xc2, + 0x40, 0x10, 0x85, 0xbf, 0xcd, 0xbf, 0x01, 0x3b, 0xad, 0xc4, 0x42, 0x2c, + 0x3d, 0x45, 0xce, 0x12, 0xd3, 0x5b, 0x89, 0xbd, 0xb5, 0xa5, 0x5a, 0xa5, + 0xf1, 0x22, 0x69, 0xad, 0xbc, 0x81, 0x9d, 0x9d, 0x18, 0x91, 0xa8, 0x88, + 0xbb, 0x71, 0x6d, 0xe2, 0x1f, 0x58, 0x08, 0x69, 0x44, 0x07, 0x86, 0x79, + 0x03, 0x33, 0x6f, 0xde, 0xf0, 0x84, 0xd6, 0x9a, 0x32, 0x61, 0x94, 0xda, + 0xfe, 0x3d, 0x02, 0x01, 0x58, 0x1f, 0xec, 0x58, 0xc5, 0xec, 0xbd, 0x01, + 0x60, 0x1e, 0x45, 0xc3, 0xd3, 0x72, 0xd9, 0xdf, 0x25, 0x89, 0xed, 0x02, + 0x2e, 0xe0, 0x14, 0xf5, 0x19, 0x57, 0x83, 0x40, 0xf9, 0xad, 0xd6, 0xa8, + 0x12, 0xc7, 0x03, 0x00, 0x71, 0xb3, 0x71, 0x66, 0xdb, 0xab, 0x4e, 0x18, + 0x36, 0xcc, 0x2c, 0xc3, 0x03, 0xec, 0x22, 0xcd, 0xe2, 0xc0, 0xc5, 0xf7, + 0xd9, 0x66, 0x19, 0xc7, 0x34, 0xa5, 0x9d, 0x24, 0x9b, 0xba, 0x94, 0xb5, + 0x17, 0x05, 0x67, 0xa5, 0x38, 0xac, 0xd7, 0xb8, 0x52, 0x62, 0x5a, 0x16, + 0x86, 0xd6, 0x18, 0x79, 0x0e, 0x4a, 0x71, 0x01, 0x76, 0x8b, 0x05, 0xe9, + 0x7e, 0x0f, 0x8e, 0x83, 0x54, 0xea, 0xf1, 0xf7, 0x4d, 0xc1, 0x54, 0x88, + 0xae, 0x07, 0x63, 0x17, 0x9c, 0x77, 0xd2, 0x9f, 0xb0, 0xf4, 0xa0, 0xd7, + 0xd4, 0x7a, 0xf2, 0x42, 0xf0, 0x15, 0x36, 0xfe, 0x2b, 0xc1, 0x15, 0x06, + 0xaf, 0x45, 0x37, 0xa4, 0xa3, 0x9d, 0x67, 0x00, 0x00, 0x00, 0x25, 0x74, + 0x45, 0x58, 0x74, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x2d, 0x64, 0x61, + 0x74, 0x65, 0x00, 0x32, 0x30, 0x30, 0x39, 0x2d, 0x31, 0x31, 0x2d, 0x31, + 0x35, 0x54, 0x31, 0x37, 0x3a, 0x30, 0x32, 0x3a, 0x33, 0x34, 0x2d, 0x30, + 0x37, 0x3a, 0x30, 0x30, 0xb6, 0xe7, 0x8e, 0x12, 0x00, 0x00, 0x00, 0x25, + 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, 0x74, 0x65, 0x3a, 0x63, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x00, 0x32, 0x30, 0x31, 0x30, 0x2d, 0x30, 0x32, 0x2d, + 0x32, 0x30, 0x54, 0x32, 0x33, 0x3a, 0x32, 0x36, 0x3a, 0x31, 0x37, 0x2d, + 0x30, 0x37, 0x3a, 0x30, 0x30, 0x91, 0xa4, 0x4d, 0xa8, 0x00, 0x00, 0x00, + 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, 0x74, 0x65, 0x3a, 0x6d, 0x6f, + 0x64, 0x69, 0x66, 0x79, 0x00, 0x32, 0x30, 0x31, 0x30, 0x2d, 0x30, 0x31, + 0x2d, 0x31, 0x31, 0x54, 0x30, 0x39, 0x3a, 0x32, 0x34, 0x3a, 0x32, 0x35, + 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x78, 0x89, 0xdd, 0xd4, 0x00, 0x00, + 0x00, 0x67, 0x74, 0x45, 0x58, 0x74, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, + 0x65, 0x00, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x63, 0x72, 0x65, + 0x61, 0x74, 0x69, 0x76, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x73, + 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, + 0x73, 0x2f, 0x62, 0x79, 0x2d, 0x73, 0x61, 0x2f, 0x33, 0x2e, 0x30, 0x2f, + 0x20, 0x6f, 0x72, 0x20, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x69, 0x76, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x73, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x6c, 0x69, 0x63, 0x65, 0x6e, + 0x73, 0x65, 0x73, 0x2f, 0x4c, 0x47, 0x50, 0x4c, 0x2f, 0x32, 0x2e, 0x31, + 0x2f, 0x5b, 0x8f, 0x3c, 0x63, 0x00, 0x00, 0x00, 0x25, 0x74, 0x45, 0x58, + 0x74, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x2d, 0x64, 0x61, 0x74, 0x65, + 0x00, 0x32, 0x30, 0x30, 0x39, 0x2d, 0x30, 0x33, 0x2d, 0x31, 0x39, 0x54, + 0x31, 0x30, 0x3a, 0x35, 0x32, 0x3a, 0x35, 0x31, 0x2d, 0x30, 0x36, 0x3a, + 0x30, 0x30, 0x7f, 0x68, 0xfd, 0x06, 0x00, 0x00, 0x00, 0x19, 0x74, 0x45, + 0x58, 0x74, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x77, + 0x77, 0x77, 0x2e, 0x69, 0x6e, 0x6b, 0x73, 0x63, 0x61, 0x70, 0x65, 0x2e, + 0x6f, 0x72, 0x67, 0x9b, 0xee, 0x3c, 0x1a, 0x00, 0x00, 0x00, 0x13, 0x74, + 0x45, 0x58, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x00, 0x4f, 0x78, + 0x79, 0x67, 0x65, 0x6e, 0x20, 0x49, 0x63, 0x6f, 0x6e, 0x73, 0xec, 0x18, + 0xae, 0xe8, 0x00, 0x00, 0x00, 0x27, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x5f, 0x55, 0x52, 0x4c, 0x00, 0x68, 0x74, 0x74, + 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x6f, 0x78, 0x79, 0x67, + 0x65, 0x6e, 0x2d, 0x69, 0x63, 0x6f, 0x6e, 0x73, 0x2e, 0x6f, 0x72, 0x67, + 0x2f, 0xef, 0x37, 0xaa, 0xcb, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, + 0x44, 0xae, 0x42, 0x60, 0x82 +}; + diff --git a/gui/resources/img_plus_png.cpp b/gui/resources/img_plus_png.cpp new file mode 100644 index 0000000..eda743f --- /dev/null +++ b/gui/resources/img_plus_png.cpp @@ -0,0 +1,101 @@ +static const uint8_t img_plus_png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, 0x61, 0x00, 0x00, 0x00, + 0x06, 0x62, 0x4b, 0x47, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, + 0x43, 0xbb, 0x7f, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, + 0x00, 0x0b, 0x13, 0x00, 0x00, 0x0b, 0x13, 0x01, 0x00, 0x9a, 0x9c, 0x18, + 0x00, 0x00, 0x00, 0x09, 0x76, 0x70, 0x41, 0x67, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x5c, 0xc6, 0xad, 0xc3, 0x00, 0x00, 0x02, + 0x7c, 0x49, 0x44, 0x41, 0x54, 0x38, 0xcb, 0x8d, 0x92, 0xcd, 0xab, 0x94, + 0x65, 0x18, 0xc6, 0x7f, 0xcf, 0xfd, 0x3c, 0xef, 0x3b, 0xf3, 0xce, 0x34, + 0x73, 0xbe, 0xd4, 0x51, 0x6b, 0xa1, 0xe5, 0x46, 0x5d, 0x45, 0x14, 0x8a, + 0x41, 0x1f, 0x04, 0xd1, 0x32, 0xa4, 0xbf, 0xa0, 0xbf, 0x20, 0xda, 0x88, + 0x20, 0xea, 0xae, 0x4d, 0x08, 0xad, 0x8d, 0x76, 0x41, 0xbb, 0x36, 0x16, + 0x91, 0x0b, 0xc1, 0x08, 0x54, 0x72, 0x71, 0x42, 0xa1, 0x73, 0x92, 0xca, + 0x8e, 0x7a, 0x3c, 0xc7, 0x73, 0x74, 0xc6, 0x33, 0xef, 0x99, 0x79, 0xdf, + 0xe7, 0xb9, 0xef, 0x16, 0xd3, 0x46, 0x27, 0xa5, 0x0b, 0xae, 0xdd, 0x75, + 0xfd, 0xb8, 0xb9, 0xb9, 0x1c, 0x53, 0x3a, 0x9d, 0xf7, 0xde, 0xf4, 0x1f, + 0xec, 0xdf, 0x37, 0xf7, 0xa9, 0x08, 0xbd, 0xb2, 0x8c, 0x65, 0x7f, 0x50, + 0xfd, 0xf4, 0xd7, 0x83, 0x87, 0x9f, 0xeb, 0xf5, 0xcf, 0xfe, 0x7c, 0x3a, + 0x1d, 0xa6, 0xfa, 0x07, 0x36, 0x67, 0x8a, 0xf6, 0x9e, 0x0f, 0xdf, 0x79, + 0xef, 0xf5, 0x63, 0x45, 0xab, 0x2d, 0x6a, 0xca, 0x37, 0x17, 0xae, 0xbd, + 0x3c, 0x5f, 0xf6, 0x2f, 0x3f, 0xc0, 0xfe, 0x06, 0x97, 0x9e, 0x0f, 0x78, + 0x71, 0x5e, 0x1c, 0x69, 0xd7, 0xe5, 0xa5, 0x0d, 0xd1, 0x66, 0x4d, 0xbf, + 0x8c, 0xa8, 0xf3, 0x85, 0xd4, 0xb6, 0x00, 0x67, 0x3c, 0xf0, 0x04, 0x40, + 0xa6, 0x00, 0xe3, 0x81, 0x37, 0x73, 0x6c, 0x8f, 0x95, 0xe1, 0x28, 0x91, + 0xd4, 0x30, 0x80, 0x2c, 0xe7, 0xbf, 0x14, 0x00, 0x3f, 0xf1, 0x69, 0xe0, + 0xa6, 0x67, 0xd0, 0x6d, 0xca, 0x8c, 0x13, 0x35, 0x48, 0x6a, 0xa4, 0x64, + 0x60, 0x60, 0x2e, 0x65, 0xb0, 0x56, 0xc0, 0x47, 0x7e, 0x52, 0x3d, 0x94, + 0xe0, 0x6c, 0x15, 0x66, 0xdf, 0x3a, 0x71, 0xac, 0x21, 0xcd, 0xd7, 0x34, + 0x69, 0x27, 0x70, 0x90, 0x68, 0xd6, 0x56, 0x4b, 0xaf, 0xa8, 0x2a, 0xb5, + 0x1a, 0x51, 0x8d, 0x60, 0x26, 0x99, 0xd7, 0xf7, 0x77, 0xbf, 0xdd, 0x5b, + 0x70, 0x7e, 0x77, 0x92, 0x28, 0x6a, 0x21, 0xdc, 0x5f, 0xab, 0x4f, 0x5c, + 0x72, 0x87, 0x8e, 0x9f, 0xbb, 0xd2, 0xee, 0xf5, 0x5e, 0x4d, 0x38, 0x31, + 0x35, 0xa2, 0x99, 0x9b, 0xeb, 0xe4, 0x6e, 0x93, 0xae, 0x1b, 0xaa, 0x27, + 0x29, 0xb4, 0x75, 0x8b, 0x5d, 0xa1, 0x52, 0x70, 0x84, 0x20, 0x96, 0x07, + 0xc1, 0xc5, 0x7a, 0x74, 0xe3, 0xd7, 0xa5, 0xaf, 0xc2, 0x0b, 0xdd, 0xe2, + 0xc0, 0xc7, 0xc7, 0x8f, 0x64, 0xab, 0x83, 0x1a, 0x35, 0xc3, 0xd4, 0xd8, + 0xd8, 0x8a, 0x7c, 0xbf, 0x78, 0x9f, 0xa4, 0x93, 0x63, 0xdb, 0x33, 0x73, + 0x1c, 0x3d, 0xbc, 0x53, 0xea, 0xa8, 0xe4, 0x99, 0xa7, 0x11, 0x1c, 0xae, + 0xde, 0x6e, 0x2f, 0xdd, 0x58, 0x3e, 0x18, 0x86, 0xa3, 0xba, 0x3a, 0x7f, + 0xf1, 0x16, 0xd1, 0x09, 0x31, 0x1a, 0x95, 0x1a, 0x75, 0x52, 0x6a, 0x75, + 0x38, 0x27, 0x38, 0x8c, 0xe1, 0xa8, 0xe6, 0xc7, 0xc5, 0x7b, 0x14, 0xb9, + 0xa7, 0x95, 0x7b, 0x8a, 0x46, 0xc0, 0xca, 0x81, 0x89, 0x93, 0x2a, 0x94, + 0xfd, 0xf2, 0x87, 0x78, 0xeb, 0xb7, 0x77, 0xcd, 0xac, 0x69, 0x86, 0x53, + 0x53, 0x09, 0x41, 0x3a, 0x6e, 0xe7, 0xbe, 0x2c, 0x86, 0x82, 0x56, 0xee, + 0x69, 0x96, 0xeb, 0x8c, 0x6e, 0xaf, 0x6e, 0x55, 0xde, 0x8f, 0x86, 0x22, + 0x88, 0x88, 0x9a, 0xe9, 0xe6, 0xb8, 0xd4, 0xef, 0xc2, 0x1f, 0x8b, 0xab, + 0x27, 0xbb, 0xb3, 0x0b, 0xbd, 0x94, 0x95, 0xcd, 0x0e, 0x30, 0xee, 0xf8, + 0x85, 0x4e, 0x1e, 0x4e, 0x35, 0x77, 0xbc, 0xf4, 0x86, 0xcf, 0x84, 0x22, + 0x17, 0x78, 0x34, 0x8e, 0x1b, 0x77, 0xd6, 0xbf, 0x4c, 0x55, 0xfd, 0xad, + 0xcf, 0xfd, 0xf8, 0xf1, 0x10, 0x32, 0x5a, 0x83, 0x47, 0x72, 0x7b, 0x25, + 0xb0, 0x72, 0xee, 0xee, 0x60, 0x85, 0xbb, 0x00, 0x43, 0x80, 0x23, 0x9f, + 0xec, 0x9d, 0x6b, 0xed, 0x78, 0xd8, 0x08, 0x82, 0xcf, 0x85, 0x22, 0xf7, + 0xc4, 0xe0, 0xcd, 0x70, 0xcb, 0xeb, 0x57, 0x9b, 0x3f, 0xc3, 0xd9, 0xea, + 0xf9, 0x43, 0x02, 0x9c, 0x83, 0x46, 0xe6, 0x29, 0xf2, 0x89, 0x83, 0xc0, + 0x64, 0x4d, 0xd3, 0x9a, 0x06, 0x34, 0xba, 0xc9, 0xcc, 0xb4, 0x11, 0x1c, + 0xad, 0x7f, 0x9f, 0x16, 0xbc, 0x80, 0x44, 0xfd, 0x7f, 0x80, 0x3b, 0x9b, + 0x6a, 0xf8, 0xb5, 0xa0, 0x75, 0xca, 0x62, 0x89, 0xaf, 0x4a, 0x5c, 0xaa, + 0xb7, 0x15, 0xd9, 0x78, 0xd6, 0x94, 0x9f, 0xd4, 0xef, 0xf3, 0xfd, 0xc1, + 0x1e, 0xfd, 0xfa, 0xde, 0xcd, 0xe5, 0x59, 0x2f, 0xb6, 0xd7, 0x8b, 0x8b, + 0xa9, 0x8a, 0xd7, 0x7d, 0xff, 0xf1, 0x2f, 0xf0, 0x45, 0xf5, 0x74, 0xfc, + 0x1f, 0xd6, 0xc1, 0x2e, 0xdc, 0xa4, 0x2b, 0xc5, 0xbc, 0x00, 0x00, 0x00, + 0x1d, 0x74, 0x45, 0x58, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, + 0x00, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, + 0x68, 0x20, 0x54, 0x68, 0x65, 0x20, 0x47, 0x49, 0x4d, 0x50, 0xef, 0x64, + 0x25, 0x6e, 0x00, 0x00, 0x00, 0x25, 0x74, 0x45, 0x58, 0x74, 0x63, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x2d, 0x64, 0x61, 0x74, 0x65, 0x00, 0x32, 0x30, + 0x30, 0x39, 0x2d, 0x31, 0x31, 0x2d, 0x31, 0x37, 0x54, 0x32, 0x30, 0x3a, + 0x30, 0x36, 0x3a, 0x35, 0x35, 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x59, + 0xa6, 0x2a, 0xbb, 0x00, 0x00, 0x00, 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, + 0x61, 0x74, 0x65, 0x3a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x00, 0x32, + 0x30, 0x31, 0x30, 0x2d, 0x30, 0x32, 0x2d, 0x32, 0x32, 0x54, 0x31, 0x33, + 0x3a, 0x34, 0x31, 0x3a, 0x30, 0x37, 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, + 0xac, 0xa6, 0x9c, 0xb4, 0x00, 0x00, 0x00, 0x25, 0x74, 0x45, 0x58, 0x74, + 0x64, 0x61, 0x74, 0x65, 0x3a, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x00, + 0x32, 0x30, 0x31, 0x30, 0x2d, 0x30, 0x31, 0x2d, 0x31, 0x31, 0x54, 0x31, + 0x34, 0x3a, 0x32, 0x39, 0x3a, 0x35, 0x39, 0x2d, 0x30, 0x37, 0x3a, 0x30, + 0x30, 0x9a, 0x31, 0xb4, 0x01, 0x00, 0x00, 0x00, 0x34, 0x74, 0x45, 0x58, + 0x74, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x00, 0x68, 0x74, 0x74, + 0x70, 0x3a, 0x2f, 0x2f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x76, 0x65, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x73, 0x2e, 0x6f, 0x72, 0x67, 0x2f, + 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x73, 0x2f, 0x47, 0x50, 0x4c, + 0x2f, 0x32, 0x2e, 0x30, 0x2f, 0x6c, 0x6a, 0x06, 0xa8, 0x00, 0x00, 0x00, + 0x25, 0x74, 0x45, 0x58, 0x74, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x2d, + 0x64, 0x61, 0x74, 0x65, 0x00, 0x32, 0x30, 0x30, 0x39, 0x2d, 0x31, 0x31, + 0x2d, 0x31, 0x37, 0x54, 0x32, 0x30, 0x3a, 0x30, 0x36, 0x3a, 0x35, 0x35, + 0x2d, 0x30, 0x37, 0x3a, 0x30, 0x30, 0x06, 0x17, 0x5c, 0x8f, 0x00, 0x00, + 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x00, 0x49, 0x6e, 0x74, 0x72, 0x69, 0x67, 0x75, 0x65, 0x20, 0x49, 0x63, + 0x6f, 0x6e, 0x20, 0x53, 0x65, 0x74, 0xae, 0x27, 0xa1, 0x3f, 0x00, 0x00, + 0x00, 0x46, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x5f, 0x55, 0x52, 0x4c, 0x00, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, + 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x69, 0x6e, 0x6e, 0x6f, 0x76, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x6e, 0x64, + 0x65, 0x78, 0x2e, 0x70, 0x68, 0x70, 0x3f, 0x70, 0x61, 0x67, 0x65, 0x3d, + 0x32, 0x32, 0x26, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x3d, 0x32, 0x26, + 0x69, 0x64, 0x3d, 0x32, 0x95, 0x41, 0xf9, 0xc6, 0x00, 0x00, 0x00, 0x00, + 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; + diff --git a/gui/resources/img_thornwave_icon_png.cpp b/gui/resources/img_thornwave_icon_png.cpp new file mode 100644 index 0000000..a5f2ebe --- /dev/null +++ b/gui/resources/img_thornwave_icon_png.cpp @@ -0,0 +1,448 @@ +static const uint8_t img_thornwave_icon_png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, + 0x08, 0x06, 0x00, 0x00, 0x00, 0xc3, 0x3e, 0x61, 0xcb, 0x00, 0x00, 0x00, + 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x13, 0x00, 0x00, 0x0b, + 0x13, 0x01, 0x00, 0x9a, 0x9c, 0x18, 0x00, 0x00, 0x00, 0x07, 0x74, 0x49, + 0x4d, 0x45, 0x07, 0xe0, 0x03, 0x11, 0x00, 0x08, 0x1d, 0xde, 0x4a, 0x1d, + 0xd9, 0x00, 0x00, 0x14, 0x77, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0xed, + 0x9d, 0x79, 0x78, 0x54, 0xe5, 0xbd, 0xc7, 0x3f, 0xe7, 0xcc, 0x9e, 0x99, + 0x64, 0x92, 0x49, 0x26, 0x1b, 0x64, 0x21, 0x09, 0x84, 0xb0, 0x6f, 0x8a, + 0x22, 0x8b, 0x28, 0xee, 0xdb, 0xa3, 0x45, 0xb1, 0x5e, 0x97, 0xf6, 0x56, + 0xaa, 0xde, 0xda, 0x7a, 0x5b, 0xee, 0xb5, 0xab, 0xb5, 0xb6, 0xd6, 0xc7, + 0xc7, 0xdb, 0xd6, 0x5a, 0xbd, 0xbd, 0xf7, 0x6a, 0xad, 0xdd, 0x2c, 0x54, + 0x2b, 0xd7, 0x2b, 0x6e, 0x58, 0x28, 0x20, 0x82, 0x05, 0x45, 0x01, 0x81, + 0x40, 0x08, 0x49, 0x20, 0x0b, 0xd9, 0x26, 0x99, 0x49, 0x32, 0x99, 0xfd, + 0x9c, 0xfb, 0xc7, 0x99, 0x9c, 0xc9, 0x64, 0x26, 0x6a, 0x1f, 0xab, 0x90, + 0xf0, 0x7e, 0xff, 0x21, 0x79, 0xcf, 0x9b, 0x77, 0x98, 0x33, 0x9f, 0xf3, + 0xbe, 0xbf, 0xed, 0x7d, 0x47, 0x52, 0x55, 0x55, 0x45, 0xe8, 0x8c, 0x95, + 0x2c, 0x6e, 0x81, 0x00, 0x40, 0x48, 0x00, 0x20, 0x24, 0x00, 0x10, 0x12, + 0x00, 0x08, 0x09, 0x00, 0x84, 0x04, 0x00, 0x42, 0x02, 0x00, 0x21, 0x01, + 0x80, 0x90, 0x00, 0x40, 0x48, 0x00, 0x20, 0x24, 0x00, 0x10, 0x12, 0x00, + 0x08, 0x09, 0x00, 0x84, 0x04, 0x00, 0x42, 0x02, 0x00, 0x21, 0x01, 0x80, + 0x90, 0x00, 0x40, 0x48, 0x00, 0x20, 0x24, 0x00, 0x10, 0x12, 0x00, 0x08, + 0x09, 0x00, 0x84, 0x04, 0x00, 0x42, 0x02, 0x00, 0x21, 0x01, 0x80, 0x90, + 0x00, 0x40, 0x68, 0x0c, 0xca, 0x78, 0xa6, 0xbd, 0x61, 0x45, 0x55, 0x88, + 0x2a, 0x11, 0x62, 0x6a, 0x04, 0x83, 0x64, 0xc0, 0x20, 0x9b, 0x31, 0x48, + 0x06, 0x01, 0xc0, 0x99, 0x22, 0x55, 0x55, 0x69, 0x1d, 0xa8, 0xe7, 0x90, + 0x67, 0x27, 0xbe, 0x60, 0x07, 0x39, 0xd6, 0x5c, 0x2a, 0x9c, 0xb3, 0xc9, + 0xcb, 0x28, 0x25, 0xd7, 0x36, 0xf1, 0x8c, 0x03, 0x40, 0x3a, 0x93, 0x37, + 0x87, 0xd6, 0xf5, 0xbc, 0xc3, 0x96, 0x13, 0xbf, 0xe1, 0xe4, 0xc0, 0x21, + 0x0a, 0x32, 0x4a, 0x28, 0xcf, 0x9a, 0xc9, 0x0c, 0xf7, 0x45, 0x94, 0x38, + 0xe7, 0x08, 0x00, 0xce, 0x14, 0xf5, 0x87, 0x7b, 0x78, 0xbd, 0xe1, 0x71, + 0xea, 0x3c, 0x5b, 0x30, 0x4a, 0xe0, 0x30, 0x65, 0x51, 0xe5, 0x5a, 0xc4, + 0xf2, 0xf2, 0xaf, 0x61, 0x36, 0x64, 0x08, 0x00, 0xce, 0x04, 0x05, 0x22, + 0x7d, 0xfc, 0xa9, 0xf6, 0x5b, 0x74, 0x0c, 0x1c, 0xc2, 0x20, 0xa9, 0x98, + 0x24, 0x28, 0xb0, 0x57, 0x72, 0xe5, 0x94, 0x87, 0x71, 0x58, 0xf2, 0x85, + 0x17, 0x30, 0xde, 0x65, 0x33, 0x65, 0x71, 0x49, 0xc5, 0x3d, 0x58, 0x0c, + 0x0e, 0xbd, 0xcd, 0x13, 0x38, 0xca, 0x86, 0xc3, 0xf7, 0xe0, 0x0f, 0x77, + 0x0b, 0x00, 0xce, 0x04, 0x15, 0x39, 0xaa, 0x99, 0x99, 0x7f, 0x69, 0x52, + 0x9b, 0x2f, 0xdc, 0xc2, 0xe6, 0xfa, 0xef, 0xa2, 0xa8, 0x51, 0x01, 0xc0, + 0x99, 0xa0, 0xc5, 0x25, 0xff, 0x9c, 0xd2, 0xd6, 0x35, 0x78, 0x90, 0xbd, + 0x6d, 0xcf, 0x08, 0x00, 0xce, 0x04, 0x59, 0x8c, 0x19, 0x4c, 0x76, 0x2d, + 0x49, 0x69, 0x6f, 0xe8, 0x79, 0x83, 0xc1, 0x70, 0x97, 0x00, 0x60, 0xbc, + 0xc4, 0x01, 0x22, 0x31, 0x65, 0xd4, 0xeb, 0x95, 0x39, 0x8b, 0xd2, 0x18, + 0x89, 0x1e, 0x5a, 0x7c, 0x3b, 0x05, 0x00, 0xe3, 0xc2, 0xed, 0x91, 0x24, + 0xde, 0x6c, 0xf2, 0xd1, 0xd4, 0x1b, 0x4c, 0x7b, 0xbd, 0xd0, 0x31, 0x35, + 0xa5, 0x4d, 0x51, 0xc3, 0x78, 0xfc, 0x87, 0x04, 0x00, 0xe3, 0x45, 0x93, + 0x72, 0xac, 0xdc, 0xbb, 0xb1, 0x91, 0x98, 0x92, 0xea, 0x01, 0xdb, 0x4d, + 0x2e, 0x20, 0xb5, 0xdd, 0x1f, 0x6e, 0x27, 0x14, 0xf5, 0x09, 0x00, 0xc6, + 0x83, 0x2a, 0x5c, 0x36, 0x9a, 0xbd, 0x21, 0x7e, 0xf2, 0x56, 0x4b, 0x9a, + 0x19, 0x22, 0xfd, 0x2d, 0x09, 0x45, 0x7d, 0x44, 0x62, 0x7e, 0x01, 0xc0, + 0x78, 0xd1, 0xbc, 0x62, 0x07, 0x0f, 0x6e, 0x3d, 0xf1, 0xb1, 0xfb, 0x47, + 0x95, 0x20, 0x31, 0x25, 0x2c, 0x00, 0x18, 0x2f, 0x72, 0x5a, 0x0d, 0x0c, + 0x84, 0x15, 0xb6, 0x34, 0x78, 0x47, 0xac, 0xf7, 0xb1, 0xf4, 0xc6, 0x23, + 0x4a, 0xda, 0xa5, 0x41, 0x00, 0x30, 0x46, 0xd5, 0x1f, 0xd2, 0x3e, 0xe8, + 0xf7, 0xdb, 0x06, 0x92, 0xda, 0x07, 0xc2, 0x5d, 0x80, 0x94, 0xd2, 0xdf, + 0x20, 0x99, 0x91, 0x25, 0xa3, 0x00, 0x60, 0x2c, 0xa8, 0x2f, 0xf8, 0xd1, + 0x91, 0xbb, 0xfa, 0x1e, 0xcd, 0x0b, 0xe8, 0xf0, 0x47, 0x92, 0xda, 0xbb, + 0xfc, 0x0d, 0x69, 0xfb, 0x9b, 0x0c, 0x19, 0x18, 0x64, 0xab, 0x00, 0x60, + 0x2c, 0xe8, 0xb5, 0xba, 0x5e, 0x4e, 0x78, 0x83, 0x1f, 0xda, 0xe7, 0x58, + 0x4f, 0x00, 0x09, 0x90, 0x47, 0x3c, 0xec, 0x6d, 0x03, 0x07, 0xd2, 0xf6, + 0xb7, 0x18, 0x9d, 0x98, 0xc6, 0x61, 0x76, 0x70, 0x5c, 0x02, 0xb0, 0x72, + 0x46, 0x1e, 0x97, 0xfd, 0xf6, 0xe0, 0xa8, 0xd7, 0xf7, 0x9d, 0x1c, 0xa0, + 0x2f, 0xa8, 0x2d, 0x01, 0xf9, 0x76, 0x53, 0xd2, 0xb5, 0xe3, 0xbe, 0xf7, + 0xd2, 0xfe, 0x8d, 0xcd, 0xe4, 0xc6, 0x64, 0xb0, 0x0b, 0x00, 0xc6, 0x82, + 0x0c, 0xb2, 0x44, 0x30, 0xaa, 0xb0, 0xfe, 0x60, 0xfa, 0x4c, 0xde, 0xb6, + 0x26, 0x1f, 0xde, 0xf8, 0x32, 0x51, 0x9d, 0x97, 0x78, 0xaa, 0x07, 0x23, + 0x5e, 0xbc, 0xc1, 0xd6, 0x34, 0xae, 0xa1, 0x01, 0xa7, 0xad, 0x8c, 0x48, + 0x04, 0xde, 0x3e, 0xd1, 0x27, 0x00, 0x18, 0x0b, 0xca, 0xb2, 0x18, 0x78, + 0xe9, 0xb0, 0x27, 0x8d, 0x3f, 0xaf, 0xb0, 0xbd, 0xa9, 0x8f, 0x50, 0x4c, + 0x45, 0x05, 0x16, 0x95, 0x66, 0xe9, 0xd7, 0x0e, 0x75, 0xfd, 0x65, 0x94, + 0xf5, 0xdf, 0x81, 0xcb, 0x56, 0x8d, 0xc9, 0x04, 0x2f, 0x1c, 0xec, 0x4e, + 0x31, 0x1c, 0x05, 0x00, 0xa7, 0xa1, 0x9a, 0x7d, 0x21, 0x9a, 0x7a, 0x43, + 0x29, 0xed, 0xb5, 0x5d, 0x83, 0xec, 0x8c, 0x3f, 0xc5, 0x35, 0x6e, 0x1b, + 0xd9, 0xb6, 0x84, 0x65, 0xbf, 0xaf, 0xf3, 0xd5, 0xb4, 0x63, 0x99, 0x65, + 0x07, 0x6e, 0xc7, 0x0c, 0x00, 0x96, 0x4d, 0x72, 0xb2, 0xfa, 0xc5, 0xa3, + 0x02, 0x80, 0xd3, 0xdb, 0xc5, 0x8b, 0xe2, 0x09, 0xa4, 0x7a, 0x02, 0x8a, + 0xa2, 0xf2, 0xd7, 0x63, 0x5e, 0xda, 0xfa, 0xb5, 0x80, 0xce, 0x3f, 0xcd, + 0x4e, 0x54, 0xfb, 0x74, 0xf8, 0xeb, 0xf1, 0x05, 0x4f, 0xa6, 0x1d, 0xaf, + 0x30, 0x73, 0xae, 0xee, 0x02, 0x96, 0x67, 0x5b, 0xd9, 0x7b, 0x72, 0x80, + 0xda, 0xce, 0x41, 0x01, 0xc0, 0xe9, 0xaa, 0x57, 0x8f, 0xf4, 0xc6, 0x3f, + 0xb8, 0x64, 0x03, 0xaf, 0x37, 0x18, 0xe5, 0xbf, 0x76, 0x27, 0x3e, 0xe4, + 0x2f, 0xce, 0x2b, 0xd0, 0x7f, 0x3e, 0xd0, 0xf9, 0x06, 0xd1, 0x51, 0x22, + 0x7d, 0x93, 0xf3, 0xae, 0x4c, 0x2c, 0x21, 0x31, 0x85, 0x98, 0x0a, 0xbb, + 0x5a, 0xfa, 0xf5, 0xb6, 0xee, 0x11, 0xae, 0xa4, 0x00, 0xe0, 0x14, 0xeb, + 0xd9, 0x7d, 0x9d, 0x48, 0xc0, 0x9c, 0x42, 0x47, 0x52, 0xfb, 0x0b, 0x07, + 0xbb, 0x75, 0xff, 0xff, 0x92, 0xaa, 0x6c, 0x8a, 0xb3, 0x2c, 0x00, 0x0c, + 0x84, 0x7b, 0x68, 0xf0, 0xbe, 0x1b, 0x8f, 0xf6, 0x25, 0x2b, 0xd3, 0x5c, + 0x42, 0x7e, 0x7c, 0xfa, 0x07, 0xa8, 0xeb, 0x0e, 0x68, 0x33, 0xc6, 0x40, + 0x02, 0x96, 0x4d, 0xc7, 0x7a, 0x39, 0xde, 0x1b, 0x14, 0x00, 0x9c, 0x0e, + 0x6a, 0xe8, 0x09, 0xf0, 0x6e, 0xab, 0xf6, 0x74, 0xae, 0xa8, 0xca, 0x4e, + 0x32, 0xfe, 0xee, 0x7d, 0xbd, 0x51, 0xff, 0x7d, 0xcd, 0xe2, 0xc4, 0x1e, + 0x80, 0x63, 0xbd, 0xbb, 0xe9, 0x1a, 0x3c, 0x9e, 0x6a, 0xfd, 0x03, 0x73, + 0x8b, 0x6f, 0x4b, 0x6a, 0xdb, 0xda, 0xe8, 0x8b, 0xc7, 0x0f, 0x12, 0x01, + 0x84, 0x05, 0x13, 0x32, 0xb9, 0xfb, 0xe5, 0x63, 0x02, 0x80, 0xd3, 0x41, + 0x7f, 0xd8, 0xdb, 0x49, 0x87, 0x3f, 0x82, 0xdb, 0x6e, 0x62, 0xc1, 0x84, + 0x4c, 0xbd, 0xfd, 0x9b, 0x1b, 0x1b, 0xf1, 0xc5, 0xc3, 0xbf, 0x0b, 0x27, + 0x66, 0x32, 0xa7, 0x48, 0xf3, 0xe9, 0x03, 0xd1, 0x7e, 0x0e, 0x74, 0x6f, + 0x45, 0x25, 0x35, 0x07, 0x60, 0x31, 0x64, 0x53, 0x99, 0xbb, 0x62, 0xc4, + 0xf2, 0xd2, 0x83, 0xd9, 0x20, 0x51, 0xe8, 0x48, 0x2c, 0x2f, 0x95, 0x2e, + 0x2b, 0xdb, 0x1a, 0x7d, 0xb4, 0xf8, 0x42, 0x02, 0x80, 0x53, 0xa9, 0x16, + 0x5f, 0x88, 0x97, 0x8f, 0xf4, 0xa0, 0xa8, 0xf0, 0x95, 0x85, 0x45, 0x7a, + 0xfb, 0x91, 0xae, 0xc1, 0xa4, 0xb5, 0xff, 0xd6, 0xb9, 0xf9, 0xb8, 0xed, + 0x66, 0x00, 0xda, 0x07, 0x8e, 0x71, 0xb4, 0x77, 0x57, 0xda, 0xf1, 0xe6, + 0x15, 0xdf, 0x9a, 0x14, 0xff, 0xdf, 0x7c, 0xac, 0x97, 0xde, 0x60, 0x14, + 0xa3, 0x2c, 0x31, 0xa3, 0x20, 0x11, 0x14, 0x1a, 0x08, 0xc7, 0x18, 0x08, + 0xc7, 0x38, 0x38, 0x06, 0x0d, 0xc3, 0x71, 0x03, 0x80, 0xaa, 0xaa, 0x6c, + 0x3c, 0xda, 0xcb, 0x3b, 0xad, 0x03, 0x48, 0xc0, 0xdd, 0xe7, 0x14, 0xeb, + 0xed, 0xdf, 0x7e, 0xa3, 0x89, 0x48, 0x4c, 0xcb, 0xe4, 0xcd, 0x2a, 0xb0, + 0x73, 0x65, 0xb5, 0x4b, 0xf3, 0x0a, 0x54, 0x85, 0x4d, 0xc7, 0x9f, 0x26, + 0x5d, 0xf2, 0xc7, 0x61, 0x2a, 0xa0, 0xc2, 0xb5, 0x3c, 0x65, 0x76, 0x09, + 0x44, 0x14, 0xb2, 0x2c, 0x06, 0xe6, 0x16, 0x27, 0xec, 0x8b, 0xbd, 0x27, + 0xb5, 0x3a, 0x81, 0xbe, 0x50, 0x54, 0x00, 0x70, 0xaa, 0xd4, 0x17, 0x8a, + 0xf1, 0xc8, 0x76, 0xad, 0xc0, 0xe3, 0x6b, 0xe7, 0x16, 0xe3, 0xca, 0xd0, + 0xa6, 0xe8, 0x17, 0x6b, 0x3d, 0xbc, 0x51, 0xdf, 0x8b, 0x0a, 0x18, 0x65, + 0xb8, 0x69, 0xb6, 0x9b, 0xd2, 0x6c, 0x2d, 0xa9, 0xb3, 0xbf, 0x6b, 0x2b, + 0x27, 0xfa, 0xd2, 0x87, 0x8c, 0xa7, 0xe5, 0x5f, 0x13, 0xaf, 0x0e, 0xd2, + 0x74, 0xb0, 0xc3, 0xcf, 0xb6, 0x26, 0x1f, 0x2a, 0x70, 0x45, 0xb5, 0x2b, + 0xa9, 0xef, 0x8b, 0xb5, 0x1e, 0xac, 0x46, 0x19, 0xbb, 0xc9, 0x20, 0x00, + 0x38, 0x55, 0xfa, 0xf9, 0xce, 0x56, 0xea, 0x3c, 0x01, 0xec, 0x26, 0x99, + 0xaf, 0x2c, 0xd4, 0x9e, 0x7e, 0xcf, 0x60, 0x84, 0xc7, 0x76, 0xb6, 0xe1, + 0x8f, 0x68, 0xd6, 0x7d, 0x89, 0xd3, 0xc2, 0xbf, 0xc5, 0x8d, 0x3f, 0x45, + 0x8d, 0xf1, 0x52, 0xfd, 0xe3, 0x69, 0xc7, 0xca, 0xb1, 0x96, 0x32, 0x25, + 0xf7, 0x42, 0xbd, 0x3a, 0x48, 0x51, 0x54, 0xd6, 0x1f, 0xf2, 0xd0, 0x18, + 0x0f, 0x2c, 0x7d, 0xe3, 0xbc, 0xe4, 0x4d, 0xa4, 0xbf, 0x7b, 0xbf, 0x83, + 0x2c, 0x8b, 0x81, 0xf2, 0x1c, 0x8b, 0x00, 0xe0, 0x54, 0xa8, 0xd9, 0x1b, + 0xe2, 0x07, 0x7f, 0xd5, 0xaa, 0x7b, 0xee, 0x5a, 0x58, 0x44, 0x59, 0xb6, + 0x05, 0x55, 0x55, 0xd9, 0x70, 0xb8, 0x87, 0x6d, 0x4d, 0x89, 0x3a, 0xbe, + 0x9f, 0x5f, 0x5e, 0x89, 0x21, 0x9e, 0xfe, 0xdb, 0xd8, 0xf8, 0x0c, 0x83, + 0xd1, 0xbe, 0x34, 0x96, 0xbf, 0x81, 0x29, 0x79, 0x17, 0xe2, 0xb4, 0x16, + 0xeb, 0x6d, 0x27, 0x7c, 0x21, 0xfe, 0x3b, 0x6e, 0x43, 0x9c, 0x5b, 0x92, + 0x49, 0x4d, 0x7e, 0x22, 0x7f, 0xf0, 0xe7, 0x03, 0x5d, 0x78, 0x06, 0xa3, + 0xe4, 0xd8, 0x8c, 0x4c, 0xcb, 0xb7, 0x0b, 0x00, 0x4e, 0x85, 0x6e, 0x7a, + 0xfe, 0x30, 0x00, 0x65, 0xd9, 0x16, 0x6e, 0x9e, 0x9d, 0x8f, 0xd9, 0x28, + 0xe3, 0x19, 0x8c, 0xf2, 0xaf, 0xaf, 0x24, 0x5c, 0xb3, 0x8b, 0xab, 0xb2, + 0xb9, 0xba, 0x26, 0x17, 0x00, 0x6f, 0xb0, 0x8b, 0xdd, 0xed, 0xaf, 0xa7, + 0x1d, 0x2b, 0xcb, 0xe2, 0x66, 0x41, 0xf1, 0x4d, 0x49, 0x6d, 0x4f, 0xfc, + 0xad, 0x4d, 0x8f, 0x1e, 0xfe, 0x68, 0x45, 0x59, 0xd2, 0xb5, 0x47, 0x77, + 0xb6, 0xa2, 0x02, 0x97, 0x4e, 0xce, 0x11, 0x6e, 0xe0, 0xa9, 0xd0, 0x53, + 0xef, 0x9c, 0xe4, 0xad, 0xe3, 0x7d, 0x18, 0x24, 0xb8, 0x71, 0xa6, 0x9b, + 0xd9, 0x45, 0x9a, 0x71, 0xb6, 0xe6, 0xb5, 0x06, 0xdd, 0xed, 0xb3, 0x18, + 0x24, 0xfe, 0xf3, 0xaa, 0x2a, 0xfd, 0x6f, 0x76, 0xb4, 0x6d, 0x60, 0x20, + 0x92, 0xbe, 0xc2, 0x77, 0x69, 0xd9, 0x9d, 0x18, 0x65, 0xb3, 0xfe, 0xfb, + 0xae, 0xe6, 0x3e, 0x7e, 0xba, 0x43, 0xcb, 0x10, 0x5e, 0x50, 0xe1, 0x64, + 0x49, 0x99, 0x53, 0xbf, 0xf6, 0xfc, 0x81, 0x2e, 0xf6, 0xc5, 0x0d, 0xc0, + 0x21, 0xa3, 0x53, 0x00, 0xf0, 0x19, 0xaa, 0xb5, 0x2f, 0xc4, 0x13, 0x7f, + 0xd3, 0xa6, 0xe6, 0x02, 0x87, 0x99, 0x6f, 0x2f, 0x2b, 0x01, 0xb4, 0x94, + 0xed, 0xef, 0xf7, 0x76, 0xea, 0xfd, 0xbe, 0xb5, 0xb4, 0x84, 0x4a, 0x97, + 0x66, 0xf8, 0x79, 0x02, 0x27, 0x39, 0xe8, 0x79, 0x1b, 0x35, 0x4d, 0x7d, + 0xdf, 0x84, 0xcc, 0x99, 0x54, 0xe7, 0x2e, 0x4f, 0xf2, 0x2c, 0x6e, 0xf9, + 0xf3, 0x11, 0x00, 0x4c, 0xb2, 0xc4, 0xd7, 0x17, 0x4d, 0xc0, 0x6c, 0xd4, + 0x6e, 0x59, 0xcf, 0x60, 0x84, 0xa7, 0xde, 0x69, 0xc7, 0x1f, 0x51, 0xb8, + 0xaa, 0xda, 0x45, 0x65, 0xae, 0x4d, 0x00, 0xf0, 0x59, 0x6b, 0xed, 0xbe, + 0x2e, 0xf6, 0x77, 0x68, 0x4f, 0xe0, 0x0f, 0x2e, 0x28, 0xc5, 0x69, 0xd5, + 0x7c, 0xf6, 0x7b, 0x37, 0x36, 0xea, 0x1f, 0x6f, 0xa5, 0xcb, 0xca, 0xaa, + 0x99, 0x6e, 0xa4, 0x78, 0xe4, 0xae, 0xde, 0xbb, 0x9f, 0x36, 0x7f, 0x63, + 0xaa, 0x1b, 0x09, 0x5c, 0x54, 0x71, 0x4f, 0x52, 0xdb, 0x57, 0x5f, 0x3e, + 0xc6, 0x51, 0x8f, 0x16, 0xe2, 0xbd, 0x6a, 0xaa, 0x8b, 0x0b, 0x2b, 0xb3, + 0x75, 0x30, 0x5e, 0x39, 0xd2, 0xc3, 0x5f, 0x8e, 0x69, 0x05, 0xa5, 0x8f, + 0x5d, 0x51, 0x39, 0x66, 0xef, 0xe1, 0x98, 0x05, 0xa0, 0xc5, 0x17, 0xe2, + 0x8f, 0xfb, 0x3b, 0xf5, 0x0f, 0x79, 0xf5, 0x59, 0x5a, 0xe0, 0x67, 0xe3, + 0xd1, 0x5e, 0x3e, 0x68, 0x4f, 0xd4, 0xef, 0xaf, 0x9c, 0x9e, 0xa7, 0x1b, + 0x6d, 0xc1, 0xe8, 0x20, 0x6f, 0xb7, 0xbd, 0x9e, 0xc6, 0xf0, 0x83, 0x9a, + 0xdc, 0xf3, 0xc9, 0xb3, 0x95, 0x25, 0x05, 0x7d, 0x9e, 0xdd, 0xa7, 0x8d, + 0x9f, 0x97, 0x61, 0xe4, 0xab, 0xe7, 0x14, 0x63, 0x8b, 0xbb, 0x79, 0x1d, + 0x03, 0x11, 0xd6, 0xbc, 0xa6, 0x41, 0x74, 0xe7, 0x59, 0x85, 0x4c, 0x72, + 0x59, 0x05, 0x00, 0x9f, 0x75, 0xd0, 0x67, 0x57, 0x4b, 0x3f, 0xef, 0xc7, + 0xd7, 0xdf, 0x5f, 0x0c, 0x7b, 0x02, 0xd7, 0xee, 0xef, 0xd4, 0xd7, 0xfe, + 0xe2, 0x4c, 0x33, 0x37, 0xcf, 0x49, 0xa4, 0x7c, 0xbb, 0x02, 0x6d, 0xd4, + 0xfb, 0x52, 0x6b, 0xfe, 0x24, 0xc9, 0xc0, 0xbc, 0xc2, 0xab, 0x31, 0xc8, + 0x5a, 0xec, 0xa0, 0x37, 0x10, 0xe1, 0xc1, 0xad, 0xcd, 0x78, 0xe3, 0x65, + 0x63, 0x9f, 0x9f, 0x95, 0xcf, 0xf9, 0x15, 0x89, 0xbc, 0xc2, 0x57, 0x36, + 0xd4, 0xd3, 0x35, 0x18, 0xa1, 0xd0, 0x61, 0xe2, 0xdf, 0x97, 0x8c, 0xed, + 0x73, 0x85, 0xc6, 0x28, 0x00, 0x9a, 0xf1, 0x07, 0x30, 0x3d, 0x3f, 0x43, + 0x9f, 0x9a, 0x0f, 0x75, 0xfa, 0xf5, 0x62, 0x0f, 0x09, 0x58, 0x52, 0x9e, + 0x95, 0x14, 0xb2, 0xdd, 0xd6, 0xf2, 0x52, 0xda, 0xf1, 0x2a, 0xb2, 0xe7, + 0x53, 0xec, 0xa8, 0xd6, 0xe1, 0x7a, 0x66, 0x4f, 0x07, 0x5b, 0x1b, 0x35, + 0x23, 0xb1, 0xca, 0x65, 0xe5, 0x91, 0x4b, 0x26, 0xe9, 0x7d, 0x7f, 0xb2, + 0xbd, 0x85, 0xf5, 0x87, 0x3c, 0x48, 0xc0, 0x9a, 0xf3, 0x26, 0x32, 0x29, + 0xc7, 0x2a, 0x00, 0xf8, 0xac, 0xd5, 0x1f, 0x8e, 0xb1, 0xb1, 0x5e, 0x5b, + 0x7f, 0x6f, 0x5f, 0x50, 0x88, 0x29, 0xee, 0xdb, 0xef, 0x6f, 0xf7, 0xeb, + 0x6b, 0x36, 0xc0, 0xdd, 0x0b, 0x93, 0x2d, 0xf3, 0x9d, 0x27, 0xdf, 0x48, + 0x19, 0xcb, 0x28, 0x99, 0x98, 0xea, 0x5a, 0x8c, 0xc5, 0x68, 0x8f, 0x2f, + 0x2d, 0x61, 0xbe, 0xbb, 0xa9, 0x49, 0xbf, 0xbe, 0x6e, 0xd5, 0x54, 0xac, + 0x26, 0xed, 0x36, 0xed, 0x6e, 0xe9, 0xe7, 0xa1, 0x6d, 0xcd, 0x80, 0x96, + 0x50, 0xba, 0xe3, 0xec, 0x42, 0xdd, 0xb6, 0x10, 0x00, 0x7c, 0x86, 0xda, + 0x14, 0x37, 0xbe, 0x6c, 0x46, 0x99, 0x25, 0x65, 0x59, 0xc8, 0xb2, 0x44, + 0x30, 0xa2, 0xb0, 0xa5, 0x21, 0xe1, 0xda, 0x4d, 0xc8, 0x32, 0xb3, 0xb8, + 0x3c, 0xe1, 0xb2, 0xed, 0xef, 0xde, 0x85, 0xa2, 0xa6, 0xc9, 0xf7, 0x5b, + 0xdc, 0xd4, 0xe4, 0x25, 0xce, 0x04, 0xb8, 0xf3, 0xa5, 0xa3, 0x04, 0xa3, + 0x9a, 0x09, 0x79, 0xcf, 0xb9, 0xc5, 0xcc, 0x8f, 0x67, 0x14, 0x03, 0x91, + 0x18, 0xdf, 0xdc, 0xd8, 0x48, 0x6f, 0x30, 0x8a, 0xdd, 0x24, 0xf3, 0xd0, + 0xc5, 0xe5, 0x64, 0x5a, 0xc6, 0xfe, 0x46, 0x91, 0x31, 0x09, 0xc0, 0xf6, + 0x78, 0x74, 0x6f, 0x4e, 0x91, 0x9d, 0xc2, 0x4c, 0x73, 0xdc, 0xc0, 0x53, + 0xd8, 0x31, 0xac, 0x62, 0x77, 0xf5, 0x82, 0xc2, 0xa4, 0xbf, 0x79, 0xb7, + 0xe3, 0xcd, 0xb4, 0x63, 0x55, 0x66, 0xcf, 0xc7, 0x6e, 0xd2, 0x40, 0x79, + 0xbd, 0xae, 0x87, 0x57, 0xeb, 0xb4, 0x6a, 0xa2, 0x12, 0xa7, 0x99, 0x7b, + 0x87, 0xad, 0xef, 0xbf, 0xde, 0xd3, 0xc1, 0x9b, 0xf1, 0xd7, 0xfd, 0xd2, + 0xfc, 0x42, 0x96, 0x0f, 0xb3, 0x09, 0x04, 0x00, 0x9f, 0xb1, 0x8e, 0xc5, + 0xab, 0x7a, 0xa6, 0xe4, 0xd9, 0x70, 0xc7, 0x93, 0x3e, 0x81, 0xa8, 0x92, + 0x94, 0x8e, 0x1d, 0x5e, 0xef, 0x07, 0x70, 0xb8, 0x67, 0x6f, 0xda, 0xb1, + 0xce, 0x29, 0xbe, 0x56, 0xff, 0xf9, 0xeb, 0xaf, 0x26, 0x76, 0x05, 0xdd, + 0x73, 0xee, 0x04, 0x8a, 0xe2, 0x70, 0x35, 0x7b, 0x43, 0xfc, 0x74, 0x47, + 0x0b, 0x8a, 0xaa, 0x15, 0x92, 0xfe, 0xec, 0xf2, 0x0a, 0xc6, 0x8b, 0xc6, + 0x24, 0x00, 0xc1, 0xa8, 0x12, 0x9f, 0xe6, 0x2d, 0x7a, 0x60, 0xa6, 0xb5, + 0x2f, 0x51, 0x8c, 0xe1, 0xce, 0x30, 0x25, 0x05, 0x66, 0xfa, 0xc2, 0x5e, + 0xfc, 0x91, 0xfe, 0x94, 0x71, 0xf2, 0x6d, 0x65, 0x14, 0xd8, 0xcb, 0x01, + 0x78, 0x76, 0x6f, 0xa7, 0x0e, 0xd6, 0x34, 0x77, 0x06, 0xd7, 0xcf, 0xc8, + 0xd3, 0xd7, 0xf7, 0x27, 0xdf, 0x3d, 0xa9, 0x27, 0x82, 0x9e, 0xbe, 0x76, + 0x8a, 0x9e, 0x4f, 0x10, 0x00, 0x9c, 0x22, 0x0d, 0x3d, 0x99, 0x4e, 0x4b, + 0x22, 0xfd, 0xda, 0xda, 0x97, 0xa8, 0xd1, 0x3b, 0xaf, 0x2c, 0x2b, 0xa9, + 0xff, 0x49, 0x7f, 0x33, 0xca, 0x88, 0x7a, 0x3f, 0x09, 0x98, 0x57, 0x70, + 0xb1, 0xfe, 0xfb, 0xef, 0xf7, 0x76, 0x10, 0x51, 0x54, 0x0c, 0x12, 0x5c, + 0x51, 0x9d, 0xa3, 0xa7, 0x8c, 0x07, 0x42, 0x31, 0x1e, 0xdc, 0xaa, 0x19, + 0x7e, 0x37, 0xcf, 0xce, 0x67, 0x6e, 0x91, 0x83, 0xf1, 0xa4, 0x31, 0x09, + 0xc0, 0x45, 0x71, 0xb7, 0x6f, 0xf8, 0x01, 0x1f, 0xe1, 0x61, 0xe7, 0xfe, + 0xcc, 0x2c, 0x48, 0xde, 0xc3, 0xe7, 0x0d, 0x79, 0x48, 0x77, 0x1e, 0xe6, + 0xac, 0xfc, 0xf3, 0x01, 0x6d, 0xab, 0x58, 0x9d, 0x47, 0x2b, 0xf6, 0x74, + 0x98, 0x0d, 0xdc, 0x3e, 0xcc, 0x7e, 0x78, 0x74, 0xa7, 0x96, 0x07, 0x30, + 0x1b, 0x24, 0x56, 0x2f, 0x28, 0xd4, 0x3d, 0x02, 0x01, 0xc0, 0x29, 0xd4, + 0xb5, 0xd3, 0xf2, 0x70, 0x5a, 0x0c, 0x34, 0x0f, 0xab, 0xc1, 0xcb, 0xb5, + 0x25, 0x6a, 0xf4, 0x4a, 0x9c, 0xc9, 0x79, 0xf9, 0x40, 0x74, 0x90, 0x91, + 0x7b, 0xfb, 0x33, 0x8c, 0x4e, 0x5c, 0xd6, 0x42, 0xdd, 0x7d, 0x1c, 0x1a, + 0x6b, 0x4e, 0x91, 0x83, 0x29, 0xc3, 0xb6, 0x8b, 0x0d, 0xa5, 0x81, 0x97, + 0x4f, 0x72, 0x32, 0xab, 0x50, 0xec, 0x0d, 0x3c, 0x2d, 0xe4, 0xb0, 0x18, + 0xf8, 0x9f, 0x6b, 0x26, 0xb3, 0xaf, 0xdd, 0xaf, 0xaf, 0xfd, 0x95, 0xc3, + 0xc2, 0xb1, 0x19, 0x23, 0x2a, 0x73, 0xd2, 0x25, 0x7e, 0x26, 0x39, 0x67, + 0xe8, 0x81, 0x9f, 0xda, 0xae, 0x41, 0xe2, 0x66, 0x05, 0x5f, 0x3e, 0x2b, + 0xf1, 0xf4, 0x1f, 0xe8, 0xf0, 0xd3, 0xd6, 0x1f, 0xc6, 0x28, 0xc3, 0xf2, + 0x8a, 0xec, 0xa4, 0x5d, 0x44, 0x02, 0x80, 0x53, 0xac, 0x1b, 0x66, 0xe6, + 0xf1, 0x8d, 0xf3, 0x26, 0xb0, 0xf1, 0x68, 0x2f, 0x31, 0x45, 0xc5, 0x69, + 0x35, 0x32, 0x2b, 0x1e, 0xf5, 0x1b, 0x59, 0x9b, 0x67, 0x35, 0xda, 0x18, + 0x5e, 0xf7, 0x27, 0x01, 0x85, 0x76, 0x2d, 0xba, 0xe7, 0x0f, 0x2b, 0x1c, + 0xf7, 0x26, 0x66, 0x92, 0xcf, 0x4d, 0xcf, 0x4b, 0x71, 0x37, 0x5d, 0x36, + 0x13, 0xe7, 0x4f, 0x72, 0x32, 0x1e, 0x35, 0x66, 0x01, 0x90, 0x24, 0x89, + 0xeb, 0xa6, 0xe7, 0x71, 0xc3, 0x0c, 0x37, 0xa1, 0xa8, 0x56, 0xa8, 0x79, + 0x4b, 0x3c, 0xee, 0x5f, 0xdb, 0x15, 0x48, 0xea, 0xeb, 0xb2, 0xb8, 0x53, + 0x22, 0x76, 0x2e, 0xab, 0x96, 0x3c, 0x8a, 0x28, 0x0a, 0xbd, 0xf1, 0x6d, + 0x64, 0x35, 0x6e, 0x1b, 0x16, 0x63, 0xe2, 0x96, 0x34, 0xc4, 0x37, 0x7b, + 0x64, 0x5b, 0x8d, 0x49, 0x25, 0xe6, 0x02, 0x80, 0xd3, 0x6c, 0x39, 0xc8, + 0x30, 0x1b, 0x90, 0x65, 0x89, 0xeb, 0x67, 0xe4, 0x31, 0xb7, 0xc8, 0x9e, + 0xb2, 0x2b, 0x78, 0x82, 0xa3, 0x0c, 0x79, 0xc4, 0x5b, 0xb5, 0x9b, 0xb2, + 0x86, 0xc1, 0xa4, 0xfd, 0x3b, 0xd2, 0xc2, 0x1f, 0xaa, 0x24, 0x9e, 0xe8, + 0x34, 0x8f, 0x2b, 0xd7, 0x6f, 0x5c, 0x01, 0x30, 0x5c, 0x65, 0x39, 0x56, + 0x7e, 0x79, 0x75, 0x15, 0x31, 0x45, 0xe5, 0xc9, 0x77, 0x12, 0xfb, 0x00, + 0x1c, 0xa6, 0x2c, 0xdc, 0x19, 0x85, 0x29, 0x33, 0x08, 0x80, 0xc5, 0x20, + 0xe3, 0x8e, 0x1f, 0x12, 0x31, 0x21, 0xcb, 0x9c, 0xd4, 0x67, 0x62, 0x7c, + 0xeb, 0xd8, 0x48, 0xa3, 0x52, 0x00, 0x70, 0x1a, 0xeb, 0x9c, 0x92, 0x2c, + 0xde, 0x5a, 0x3d, 0x9b, 0x13, 0xde, 0x10, 0x9b, 0xea, 0x7b, 0xf5, 0xf6, + 0x45, 0x45, 0x17, 0x27, 0xf5, 0x0b, 0x45, 0xb5, 0x65, 0x22, 0xc3, 0x6c, + 0x60, 0x66, 0xdc, 0x76, 0x18, 0x79, 0x6e, 0xe4, 0x55, 0x53, 0x5d, 0x71, + 0x43, 0x11, 0x01, 0xc0, 0x58, 0x9b, 0x09, 0x1e, 0xb8, 0xb0, 0x8c, 0x85, + 0x25, 0x99, 0xf8, 0xc3, 0x5a, 0x4e, 0x7f, 0x79, 0xc9, 0xd5, 0x49, 0x7d, + 0x7a, 0x82, 0xed, 0xfa, 0xcf, 0x17, 0x54, 0x64, 0x53, 0xe8, 0x30, 0x71, + 0xd4, 0x93, 0x6c, 0x3b, 0x54, 0xbb, 0x33, 0xb8, 0x66, 0xaa, 0x8b, 0x7d, + 0xed, 0x7e, 0x01, 0xc0, 0x58, 0x93, 0x41, 0x96, 0xc8, 0xb4, 0x18, 0xb1, + 0x9b, 0x35, 0x97, 0xd0, 0x24, 0x9b, 0xb9, 0xbc, 0xfc, 0xa6, 0xb8, 0x5b, + 0x08, 0x2d, 0xfd, 0x47, 0xf4, 0xbe, 0x73, 0x8b, 0x1d, 0x7c, 0xf9, 0xac, + 0x22, 0xb6, 0x34, 0xf8, 0x50, 0x46, 0x4c, 0x03, 0xeb, 0x56, 0xd5, 0x90, + 0x97, 0x61, 0xd2, 0x37, 0x9c, 0x0a, 0x00, 0xc6, 0xb0, 0x56, 0x94, 0xae, + 0x24, 0xcf, 0xa6, 0xd5, 0x08, 0xd4, 0xf5, 0xee, 0x49, 0x3a, 0x14, 0xf2, + 0x81, 0x0b, 0xcb, 0xb8, 0xf3, 0xec, 0x42, 0xad, 0xcc, 0x7b, 0xd8, 0x9c, + 0x6f, 0x35, 0xc9, 0x3c, 0xff, 0xf9, 0xa9, 0xb4, 0xf7, 0x87, 0x3f, 0xf4, + 0x94, 0x71, 0x01, 0xc0, 0x18, 0x50, 0x86, 0xc9, 0xc1, 0xb5, 0x55, 0xab, + 0x31, 0xc9, 0x66, 0xc2, 0x4a, 0x80, 0xc3, 0x9e, 0xe4, 0x4d, 0xa1, 0x8f, + 0x5c, 0x5a, 0xc1, 0x79, 0x65, 0x59, 0x74, 0x0c, 0x24, 0x1f, 0xf8, 0x90, + 0x63, 0x33, 0x71, 0x45, 0xb5, 0x0b, 0x09, 0x49, 0x00, 0x30, 0xd6, 0x35, + 0xdb, 0xbd, 0x98, 0xa5, 0x13, 0xae, 0x45, 0x05, 0x5e, 0x6d, 0x78, 0x32, + 0xad, 0x11, 0xe9, 0x1e, 0x71, 0x74, 0xdc, 0x90, 0xd7, 0x60, 0x34, 0x08, + 0x00, 0xc6, 0x85, 0xae, 0xaa, 0x5c, 0xcd, 0x6c, 0xf7, 0x52, 0xba, 0x83, + 0xcd, 0xec, 0x6a, 0xdb, 0x90, 0xd6, 0x7e, 0x38, 0x53, 0x74, 0xc6, 0x9e, + 0x15, 0x7c, 0xcb, 0xb4, 0xef, 0xb3, 0xa0, 0xf0, 0x32, 0xde, 0x6c, 0x7e, + 0x96, 0xce, 0x34, 0xfb, 0x04, 0xce, 0x14, 0x7d, 0xec, 0xef, 0x0d, 0x0c, + 0x45, 0x3f, 0xbe, 0x01, 0x24, 0x01, 0x66, 0xa3, 0xcc, 0xff, 0x1e, 0xea, + 0x26, 0xcb, 0x62, 0xe0, 0xc2, 0xca, 0xd3, 0x77, 0xdf, 0xdc, 0xdb, 0xad, + 0xeb, 0x69, 0xee, 0xdf, 0xcf, 0x25, 0xe5, 0x77, 0xe1, 0xb4, 0x16, 0x08, + 0x00, 0xd2, 0xc9, 0x17, 0x8c, 0x32, 0xf5, 0xb1, 0x77, 0xc9, 0x1a, 0x51, + 0x04, 0x69, 0x36, 0x48, 0xa8, 0x24, 0x42, 0xa6, 0x5a, 0x30, 0x45, 0x25, + 0xc7, 0x66, 0x64, 0xd7, 0x1d, 0x73, 0x58, 0xfc, 0xd4, 0x3e, 0xaa, 0x72, + 0x6d, 0xfc, 0xf6, 0x73, 0xd5, 0xa7, 0xf5, 0x4d, 0x68, 0xed, 0xaf, 0xe5, + 0xb0, 0x67, 0x1b, 0xe7, 0x14, 0xaf, 0xc2, 0x6e, 0xce, 0x39, 0xa3, 0x00, + 0xf8, 0x58, 0xf9, 0x4d, 0xb3, 0x41, 0xe2, 0x73, 0xd3, 0xf2, 0x92, 0x8a, + 0x21, 0xc2, 0x51, 0x95, 0x0d, 0x47, 0x3c, 0xe4, 0x66, 0x98, 0xb8, 0xb8, + 0xca, 0xa9, 0x1f, 0xba, 0xac, 0xaa, 0x60, 0x37, 0xcb, 0x48, 0x92, 0x44, + 0x54, 0x51, 0xd3, 0x7e, 0x2d, 0xcb, 0xe9, 0xa6, 0x09, 0x99, 0x35, 0x4c, + 0xc8, 0xac, 0xa1, 0xb6, 0x7b, 0x33, 0x05, 0xf6, 0x29, 0xb8, 0x6c, 0x25, + 0x02, 0x80, 0xe1, 0xb2, 0x99, 0x0c, 0x3c, 0x31, 0x6c, 0x77, 0xad, 0x06, + 0x80, 0x42, 0x7d, 0x4f, 0x80, 0xe9, 0xf9, 0x19, 0xfc, 0xc7, 0xa5, 0xe9, + 0x8b, 0x24, 0x25, 0x49, 0xa2, 0xce, 0x13, 0xe0, 0x37, 0xef, 0x75, 0x24, + 0x55, 0xec, 0x0c, 0x05, 0x63, 0x72, 0xac, 0x46, 0x56, 0x54, 0x66, 0xe3, + 0xca, 0x30, 0xa1, 0x28, 0x2a, 0x07, 0x3a, 0xfd, 0xec, 0x6a, 0xe9, 0x4f, + 0x1b, 0x7a, 0x75, 0x98, 0x0d, 0x9c, 0x57, 0x96, 0x45, 0xa9, 0xd3, 0x82, + 0x24, 0x49, 0x74, 0xf9, 0xc3, 0x6c, 0x6f, 0xea, 0xa3, 0x6b, 0x30, 0x92, + 0xe4, 0x9c, 0x85, 0x63, 0x2a, 0x2b, 0xa7, 0xe7, 0xd1, 0xd2, 0x17, 0x62, + 0x4f, 0xdb, 0x00, 0xb2, 0x94, 0x3e, 0x94, 0x6b, 0x32, 0x48, 0x9c, 0x3f, + 0x29, 0x9b, 0x49, 0x39, 0x56, 0x7a, 0x06, 0x23, 0xbc, 0x76, 0xb4, 0x97, + 0xb3, 0x8b, 0x97, 0x60, 0x37, 0x05, 0x09, 0x44, 0x7c, 0xd8, 0x4c, 0x89, + 0xf4, 0xef, 0x8e, 0xe3, 0x3e, 0xf6, 0xb6, 0xfb, 0xb9, 0xa4, 0x2a, 0x87, + 0xaa, 0x34, 0x9b, 0x40, 0x5f, 0x39, 0xd2, 0xc3, 0x60, 0x24, 0xc6, 0x35, + 0x53, 0x73, 0xd9, 0x58, 0xdf, 0xcb, 0xc9, 0xfe, 0xd1, 0xbf, 0x59, 0xc4, + 0x6d, 0x37, 0xb1, 0xb4, 0xdc, 0x49, 0x96, 0xc5, 0xc0, 0x1f, 0xf6, 0x75, + 0x52, 0xe2, 0xb4, 0xb0, 0xe2, 0x23, 0x96, 0xc8, 0x03, 0x1d, 0x7e, 0x76, + 0xb7, 0xf4, 0xeb, 0xa9, 0xea, 0xad, 0x8d, 0x3e, 0x4e, 0xf6, 0x87, 0x53, + 0x4e, 0x3a, 0x57, 0x81, 0x1a, 0x77, 0x06, 0x0b, 0x27, 0x66, 0x26, 0x65, + 0x35, 0x3f, 0x31, 0x00, 0xe9, 0x14, 0x8c, 0x2a, 0x28, 0xaa, 0x4a, 0x4c, + 0x85, 0x48, 0x4c, 0xc1, 0x64, 0x48, 0x7d, 0x41, 0x59, 0x82, 0x77, 0x5a, + 0x07, 0xf8, 0xe1, 0x96, 0xe3, 0x29, 0x2e, 0x94, 0x2c, 0x49, 0x34, 0xfb, + 0x42, 0xcc, 0x2c, 0xb0, 0xf3, 0xd6, 0xed, 0xb3, 0x79, 0xf9, 0x88, 0x87, + 0x95, 0xeb, 0x6a, 0x29, 0xcf, 0xb6, 0x62, 0x90, 0xa5, 0xa4, 0x22, 0x0e, + 0x09, 0x89, 0x2e, 0x7f, 0x84, 0xdc, 0x0c, 0x23, 0xdb, 0xbe, 0x34, 0x8b, + 0x7c, 0xbb, 0x99, 0x1b, 0xd6, 0x1d, 0x66, 0x67, 0x73, 0x1f, 0xe5, 0xd9, + 0xd6, 0xa4, 0xbe, 0xfd, 0xa1, 0x18, 0xe7, 0x95, 0x66, 0xb1, 0x76, 0x7f, + 0x17, 0x3f, 0xdb, 0xd9, 0x4a, 0x91, 0xc3, 0x44, 0xa6, 0xc5, 0x98, 0xd4, + 0x47, 0x96, 0x24, 0xbc, 0x81, 0x28, 0xfe, 0x48, 0x8c, 0xdd, 0x77, 0xcc, + 0xa5, 0xd2, 0x65, 0xe5, 0x91, 0xed, 0x2d, 0xd8, 0x4c, 0x6d, 0xfc, 0xed, + 0x8e, 0x39, 0x29, 0xa0, 0x5f, 0xb7, 0xb6, 0x96, 0x4e, 0x7f, 0x84, 0xeb, + 0xa6, 0xe5, 0xb2, 0xf6, 0xfa, 0xa9, 0x7a, 0x21, 0x2a, 0x40, 0x30, 0xa2, + 0x70, 0xf5, 0xb3, 0x07, 0xb9, 0xb2, 0xda, 0xc5, 0xf5, 0x33, 0xdc, 0xac, + 0xdd, 0xdf, 0xc5, 0x3b, 0xad, 0xfd, 0x8c, 0xb6, 0x5f, 0xa4, 0xb5, 0x2f, + 0xcc, 0xd2, 0x32, 0x27, 0x1b, 0x6e, 0x9e, 0xae, 0x6f, 0x30, 0xdd, 0x7d, + 0xc7, 0x1c, 0xaa, 0xdd, 0xe9, 0x8f, 0xa2, 0x0f, 0x46, 0x14, 0x56, 0xfd, + 0xe9, 0x30, 0x85, 0x0e, 0x13, 0xd7, 0x4d, 0xcb, 0x63, 0xe5, 0xba, 0x5a, + 0x36, 0x37, 0x78, 0x99, 0x9a, 0x67, 0x23, 0xa6, 0x26, 0xdf, 0x23, 0x45, + 0x55, 0xa9, 0xef, 0x09, 0xf2, 0xd0, 0x8a, 0x72, 0x7d, 0xa7, 0xf4, 0xa7, + 0x06, 0xc0, 0xc7, 0x51, 0x4c, 0x51, 0xb9, 0xa4, 0x2a, 0x87, 0x27, 0xaf, + 0x99, 0x9c, 0xf4, 0x9f, 0x05, 0x6d, 0xbb, 0xf5, 0xd6, 0x46, 0x1f, 0xb7, + 0xad, 0x3f, 0xc2, 0x7b, 0x27, 0x07, 0x58, 0x7f, 0xc8, 0x43, 0xa5, 0xcb, + 0xc6, 0xa6, 0x2f, 0xce, 0x44, 0x19, 0xd1, 0x57, 0x96, 0x24, 0xde, 0x6f, + 0x1b, 0x60, 0xe5, 0xba, 0x5a, 0x8e, 0x74, 0x07, 0x30, 0xca, 0x12, 0x5b, + 0x9b, 0x7c, 0x3c, 0x7e, 0x45, 0x25, 0xd7, 0x4e, 0xcb, 0x25, 0xaa, 0x0c, + 0xb7, 0x41, 0xb4, 0x6f, 0x05, 0x7b, 0xee, 0x40, 0x17, 0x05, 0x76, 0x13, + 0x2f, 0xdd, 0x3c, 0x9d, 0x02, 0x87, 0x39, 0x69, 0x4c, 0x59, 0x92, 0x08, + 0x44, 0x62, 0x54, 0x3f, 0xb6, 0x87, 0x3f, 0x1d, 0xe8, 0xe2, 0x07, 0x17, + 0x94, 0x71, 0xdb, 0xdc, 0x7c, 0xd6, 0xbc, 0xde, 0xc8, 0x07, 0xed, 0x7e, + 0x66, 0x0e, 0x2b, 0xfd, 0x7a, 0xfe, 0x60, 0x37, 0x9d, 0xfe, 0x08, 0xf3, + 0x8a, 0xec, 0xac, 0x3f, 0xe4, 0xe1, 0xa8, 0x27, 0xc0, 0xf4, 0x61, 0xdb, + 0xcd, 0x7e, 0xfd, 0x5e, 0x3b, 0x8a, 0x0a, 0xdf, 0x5b, 0x56, 0x0a, 0xc0, + 0xa3, 0x97, 0x57, 0xe8, 0x55, 0xcb, 0xa9, 0x0f, 0x84, 0xc4, 0xcb, 0x47, + 0x3c, 0xfc, 0xcb, 0x86, 0x63, 0x74, 0x0f, 0x46, 0x78, 0xfc, 0xca, 0x2a, + 0x6a, 0x1e, 0x7b, 0x97, 0x5f, 0xed, 0x69, 0xe7, 0xe1, 0x8b, 0x27, 0xa5, + 0x75, 0x3f, 0x7f, 0xbb, 0xb7, 0x83, 0xa3, 0x9e, 0x00, 0x8f, 0x5f, 0x59, + 0x89, 0x2f, 0x14, 0x65, 0x73, 0x83, 0x97, 0x87, 0x2f, 0x2a, 0xe7, 0x0b, + 0xf3, 0x0a, 0x52, 0x5e, 0xc7, 0x66, 0x94, 0xb9, 0xed, 0x85, 0x3a, 0x9e, + 0xd8, 0xd5, 0x76, 0x7a, 0x00, 0x00, 0x90, 0x9b, 0x61, 0x62, 0xe2, 0x28, + 0xe9, 0xd4, 0xea, 0x3c, 0x5b, 0x7c, 0xda, 0x56, 0x88, 0x2a, 0x9a, 0xf1, + 0x38, 0x5a, 0xea, 0xb5, 0x37, 0x10, 0x21, 0xd3, 0x62, 0x20, 0x10, 0x51, + 0x08, 0xc7, 0x8d, 0xce, 0x52, 0xa7, 0x85, 0x09, 0x59, 0xa3, 0xa7, 0x6a, + 0xad, 0x46, 0x99, 0x29, 0xb9, 0x36, 0xb2, 0xac, 0xa3, 0xbf, 0xcd, 0x21, + 0x03, 0xf6, 0x4b, 0xf3, 0x0b, 0xb9, 0x6f, 0xf3, 0x71, 0x1e, 0x7a, 0xb3, + 0x99, 0xb5, 0x37, 0x24, 0xbe, 0x3b, 0xf0, 0x7b, 0x9b, 0x9a, 0x98, 0x9c, + 0x6b, 0xe5, 0xf1, 0x2b, 0xab, 0x58, 0xb9, 0xf6, 0x10, 0x0f, 0x6c, 0x39, + 0xc1, 0x73, 0x37, 0xd6, 0xe8, 0xd7, 0x9f, 0x79, 0xaf, 0x83, 0xea, 0x3c, + 0x1b, 0x67, 0x4d, 0xd4, 0x0a, 0x46, 0x0a, 0x1c, 0xe6, 0x0f, 0xbd, 0x1f, + 0xe5, 0xd9, 0x56, 0x64, 0x49, 0x33, 0x96, 0x8b, 0x32, 0xcd, 0xdc, 0xbf, + 0xbc, 0x94, 0x6f, 0xfd, 0xa5, 0x89, 0xd5, 0x0b, 0x0a, 0x93, 0x6a, 0x11, + 0x41, 0xdb, 0x8d, 0xb4, 0xe6, 0xb5, 0x06, 0x2e, 0x9f, 0x92, 0xc3, 0x05, + 0x15, 0xd9, 0x1c, 0xec, 0xf0, 0x23, 0x4b, 0x5a, 0xf9, 0xdb, 0x68, 0xaf, + 0x93, 0xef, 0x30, 0x11, 0x69, 0x53, 0xff, 0xb1, 0x36, 0xc0, 0x27, 0xd1, + 0x87, 0x39, 0x19, 0xea, 0x30, 0xb7, 0xf1, 0x23, 0xfb, 0xaa, 0x43, 0x76, + 0xc5, 0xdf, 0xf9, 0xfa, 0x1f, 0xb3, 0x9f, 0xd3, 0x6a, 0xe4, 0xba, 0x69, + 0x79, 0xac, 0x3f, 0xd4, 0x4d, 0xe7, 0x40, 0x98, 0x7c, 0x87, 0x99, 0x97, + 0x6a, 0x3d, 0x34, 0x79, 0x43, 0xdc, 0xbf, 0xbc, 0x94, 0x45, 0xa5, 0x59, + 0x2c, 0x9b, 0x94, 0xcd, 0xba, 0x0f, 0xba, 0x38, 0xe1, 0x0d, 0x52, 0x9a, + 0x6d, 0x65, 0xc7, 0x71, 0x1f, 0x87, 0xbb, 0x07, 0xf9, 0x49, 0xdc, 0x06, + 0x8a, 0x29, 0x2a, 0xf5, 0x9e, 0x00, 0x03, 0xe1, 0xd8, 0xa8, 0x33, 0x40, + 0x5d, 0x77, 0x40, 0x4f, 0x3b, 0x0f, 0x55, 0x35, 0xfd, 0x72, 0xf7, 0x49, + 0x7e, 0xf1, 0x76, 0x1b, 0xbf, 0xb8, 0xa2, 0x12, 0x79, 0xd8, 0x2c, 0xb0, + 0xe6, 0xb5, 0x46, 0xa2, 0x8a, 0xca, 0xc3, 0x17, 0x4f, 0x4a, 0x72, 0xb1, + 0xeb, 0x7b, 0x82, 0x7c, 0xd0, 0xee, 0x4f, 0xb1, 0xab, 0xec, 0x66, 0x03, + 0xdd, 0x83, 0x7f, 0xdf, 0xb9, 0xc5, 0xe3, 0xaf, 0xca, 0xf1, 0x13, 0xe8, + 0xde, 0xc5, 0x13, 0xf9, 0xc3, 0xbe, 0x4e, 0x9e, 0xde, 0xd3, 0xc1, 0xb7, + 0x97, 0x95, 0xf0, 0xf3, 0xb7, 0x5b, 0xb1, 0x19, 0x65, 0xee, 0x39, 0x57, + 0x4b, 0x20, 0xdd, 0x75, 0x76, 0x11, 0xeb, 0x0f, 0x75, 0x73, 0xef, 0xc6, + 0x46, 0xd6, 0xad, 0xaa, 0xe1, 0x95, 0xba, 0x1e, 0x42, 0x51, 0x95, 0x5b, + 0xe3, 0xa5, 0x68, 0xfe, 0x70, 0x8c, 0x55, 0xcf, 0x1d, 0x66, 0x5f, 0xbb, + 0x9f, 0x8c, 0x51, 0xca, 0xc7, 0xa3, 0x23, 0xbc, 0xa2, 0xb2, 0x6c, 0x2b, + 0x77, 0x9d, 0x5d, 0xc4, 0x9a, 0xd7, 0x1b, 0xb9, 0xfb, 0x9c, 0x62, 0xa6, + 0xc6, 0x6d, 0x81, 0x83, 0x1d, 0x7e, 0x7e, 0xb5, 0xa7, 0x9d, 0xbb, 0xce, + 0x2e, 0xd2, 0xdb, 0x86, 0x20, 0xba, 0xff, 0xaf, 0xc7, 0xf9, 0x51, 0x9a, + 0xaf, 0xbc, 0x53, 0x55, 0xb0, 0x99, 0x64, 0x7d, 0xdf, 0x84, 0x00, 0xe0, + 0xef, 0xd4, 0xcc, 0x42, 0x3b, 0xf3, 0x8b, 0x1d, 0xbc, 0x52, 0xd7, 0xc3, + 0xdc, 0x62, 0x3b, 0xbb, 0x5b, 0xfa, 0xb9, 0x75, 0x4e, 0x3e, 0x39, 0xf1, + 0x92, 0xf3, 0xa5, 0xe5, 0x4e, 0x16, 0x4e, 0xcc, 0xe4, 0xa5, 0xc3, 0x3d, + 0x6c, 0x6b, 0xf4, 0xb2, 0xf9, 0x98, 0x97, 0x5b, 0xe6, 0xe4, 0xeb, 0x07, + 0x47, 0x0c, 0xb9, 0xcc, 0xab, 0x66, 0xe4, 0xf1, 0xf5, 0x45, 0x13, 0x52, + 0x3e, 0x6c, 0x83, 0x2c, 0xb1, 0xbd, 0xa9, 0x8f, 0x7b, 0xdf, 0x48, 0x8e, + 0x3c, 0x7e, 0x71, 0x5e, 0x01, 0x4f, 0xbd, 0xdb, 0xce, 0x1d, 0xff, 0x77, + 0x94, 0x6d, 0xb7, 0xcf, 0x46, 0x55, 0x55, 0x1e, 0xde, 0xde, 0x42, 0x6e, + 0x86, 0x91, 0x87, 0x2e, 0x2a, 0x4f, 0xea, 0xab, 0xa8, 0x2a, 0xdf, 0x3f, + 0xbf, 0x94, 0xcb, 0x26, 0xbb, 0x52, 0x66, 0x80, 0x84, 0x87, 0x23, 0x8f, + 0x4d, 0x00, 0xe4, 0x0f, 0x99, 0xdf, 0x25, 0x49, 0x9b, 0xfe, 0x3e, 0xed, + 0xea, 0x9c, 0xfb, 0xce, 0x2f, 0xe5, 0xba, 0xb5, 0x87, 0xb8, 0xe7, 0x95, + 0x06, 0xfc, 0x11, 0x85, 0xfb, 0x2f, 0x48, 0x3e, 0x15, 0xec, 0xc7, 0x2b, + 0xca, 0x59, 0xfa, 0xf4, 0x7e, 0xee, 0xda, 0x50, 0x4f, 0x63, 0x6f, 0x90, + 0x9f, 0x5e, 0x56, 0x91, 0x62, 0xf8, 0x96, 0x66, 0x5b, 0x58, 0x58, 0x92, + 0x95, 0x76, 0x7c, 0x6f, 0x30, 0xca, 0xc8, 0x9c, 0x52, 0x8e, 0xcd, 0xc4, + 0x77, 0x96, 0x95, 0x70, 0xeb, 0x0b, 0x75, 0xac, 0x3f, 0xd8, 0x4d, 0x59, + 0xb6, 0x85, 0x3f, 0xee, 0xef, 0xe4, 0x8f, 0xd7, 0x4f, 0xd5, 0xeb, 0x19, + 0x86, 0x96, 0x33, 0x15, 0x98, 0x91, 0x6f, 0xd7, 0x6d, 0x8e, 0xcf, 0x24, + 0x0e, 0xf0, 0xa9, 0x87, 0x23, 0x25, 0x09, 0x8b, 0x51, 0xa2, 0xb5, 0x2f, + 0x44, 0x38, 0xaa, 0x68, 0x6e, 0xa0, 0x9a, 0xec, 0x4e, 0x7a, 0x06, 0xa3, + 0x78, 0x83, 0x51, 0x32, 0xcc, 0x9f, 0x6e, 0xfa, 0x62, 0x59, 0xb9, 0x93, + 0x22, 0x87, 0x99, 0x3a, 0x4f, 0x80, 0x1b, 0x67, 0xba, 0x53, 0xa6, 0xd3, + 0x25, 0xe5, 0x4e, 0xe6, 0x17, 0x3b, 0xd8, 0xd3, 0x36, 0xc0, 0xc2, 0x89, + 0x99, 0x4c, 0x1e, 0x16, 0x17, 0x30, 0x19, 0x24, 0xcc, 0x06, 0x99, 0xc3, + 0xf1, 0xaa, 0xe4, 0x68, 0x6c, 0xe4, 0x0c, 0xa0, 0x05, 0xd0, 0xd2, 0x31, + 0x7c, 0xcb, 0x9c, 0x02, 0x1e, 0xdd, 0xd9, 0xca, 0xdd, 0x2f, 0xd7, 0xb3, + 0xb8, 0x4c, 0x9b, 0x69, 0x46, 0x1e, 0x3d, 0x67, 0x35, 0xca, 0x48, 0xc0, + 0x91, 0xee, 0xf4, 0xe3, 0x0f, 0x7f, 0x58, 0x3e, 0x6e, 0x42, 0xeb, 0x13, + 0x01, 0x60, 0x31, 0xca, 0xfa, 0xe1, 0x0c, 0xa3, 0x59, 0xe1, 0xe6, 0x0f, + 0x99, 0x8e, 0x64, 0x49, 0xc2, 0x66, 0x34, 0xa0, 0xaa, 0x2a, 0x37, 0xcd, + 0xca, 0x67, 0xd3, 0x31, 0x2f, 0x96, 0x07, 0x76, 0x8c, 0xda, 0x7f, 0x41, + 0xb1, 0x83, 0x59, 0x05, 0x76, 0x06, 0x23, 0x0a, 0x36, 0xa3, 0xfc, 0xa1, + 0x6f, 0xd2, 0x64, 0x90, 0x3e, 0x72, 0x1b, 0x97, 0xcd, 0x28, 0x63, 0x1a, + 0xf1, 0x38, 0xda, 0xcd, 0x32, 0x5f, 0x98, 0x57, 0xc0, 0x8f, 0xb7, 0x35, + 0xf3, 0xb5, 0x51, 0x8e, 0x7e, 0x7b, 0x70, 0x45, 0x19, 0x97, 0xfd, 0x4e, + 0xf3, 0xfd, 0x87, 0x7f, 0xeb, 0x98, 0xcd, 0x64, 0xe0, 0xfa, 0x19, 0x79, + 0xfc, 0x70, 0xcb, 0x09, 0xa4, 0xfb, 0xb6, 0x8f, 0x0e, 0x3c, 0xa4, 0x3d, + 0x58, 0xe2, 0x99, 0x6b, 0xa7, 0x30, 0xf7, 0x97, 0xef, 0xf3, 0x62, 0xad, + 0x87, 0xe7, 0x6f, 0xac, 0xd1, 0x0f, 0xbd, 0x1a, 0x52, 0x55, 0xae, 0x8d, + 0x4b, 0x26, 0xe7, 0x70, 0xdf, 0xe6, 0x26, 0xbe, 0x33, 0xec, 0x10, 0x8b, + 0x14, 0x83, 0xd6, 0x62, 0xc0, 0xfb, 0xbd, 0x45, 0xff, 0xb8, 0x5c, 0x40, + 0x7a, 0xf7, 0x49, 0x61, 0x4b, 0xa3, 0x8f, 0x1c, 0xab, 0x91, 0xf9, 0xc5, + 0x8e, 0x24, 0xeb, 0x75, 0x48, 0x2f, 0x1f, 0xf6, 0x90, 0x65, 0x35, 0xb2, + 0xb4, 0x3c, 0xfd, 0xa6, 0x8a, 0x6e, 0x7f, 0x84, 0x57, 0xea, 0x7a, 0xb8, + 0xa8, 0x52, 0xfb, 0xf2, 0x86, 0xf7, 0xdb, 0x06, 0xd2, 0xd6, 0xdf, 0xa9, + 0xa8, 0x58, 0x8d, 0x32, 0x2b, 0x2a, 0xb3, 0x71, 0xdb, 0xcd, 0xf8, 0xc3, + 0x31, 0x9e, 0x3b, 0xd0, 0xc5, 0x85, 0x15, 0xd9, 0xfa, 0x26, 0xce, 0x91, + 0xda, 0xd3, 0xda, 0x4f, 0x43, 0x6f, 0x90, 0x6b, 0xa6, 0xe6, 0x26, 0x05, + 0x6e, 0x92, 0x6e, 0xf8, 0x7b, 0xed, 0xcc, 0x2e, 0x74, 0x30, 0xaf, 0x38, + 0xb9, 0x1c, 0xbc, 0xd9, 0x17, 0x62, 0xc7, 0x71, 0x1f, 0xd7, 0xd4, 0xe4, + 0x26, 0xad, 0xef, 0xfa, 0x3a, 0xac, 0xa8, 0x3c, 0xbb, 0xbf, 0x93, 0x25, + 0x65, 0x4e, 0xca, 0xd3, 0x1c, 0x11, 0xb3, 0xa5, 0xc1, 0x4b, 0x93, 0x37, + 0x98, 0xb6, 0x80, 0x44, 0x45, 0x25, 0xa6, 0xc0, 0x4d, 0xb3, 0xdc, 0x64, + 0x98, 0x53, 0xc7, 0xfe, 0xf3, 0x81, 0x2e, 0x8c, 0xb2, 0xc4, 0x8a, 0xca, + 0x1c, 0x1c, 0x96, 0xf4, 0x67, 0x0f, 0xbf, 0x70, 0xb0, 0x1b, 0x5f, 0x30, + 0x9a, 0x76, 0xc9, 0x54, 0x51, 0xb1, 0x19, 0x65, 0x6e, 0x9c, 0x95, 0xff, + 0xe9, 0x02, 0x20, 0x34, 0x3e, 0x24, 0x8b, 0x5b, 0x20, 0x00, 0x10, 0x12, + 0x00, 0x08, 0x09, 0x00, 0x84, 0x04, 0x00, 0x42, 0x02, 0x00, 0x21, 0x01, + 0x80, 0x90, 0x00, 0x40, 0x48, 0x00, 0x20, 0x24, 0x00, 0x10, 0x12, 0x00, + 0x08, 0x09, 0x00, 0x84, 0x04, 0x00, 0x42, 0x02, 0x00, 0x21, 0x01, 0x80, + 0x90, 0x00, 0x40, 0x48, 0x00, 0x20, 0x24, 0x00, 0x10, 0x12, 0x00, 0x08, + 0x09, 0x00, 0x84, 0x04, 0x00, 0x42, 0x02, 0x00, 0x21, 0x01, 0x80, 0x90, + 0x00, 0x40, 0x48, 0x00, 0x20, 0x24, 0x00, 0x10, 0x1a, 0x83, 0xfa, 0x7f, + 0x68, 0xf3, 0x83, 0xaa, 0x52, 0x72, 0x79, 0x57, 0x00, 0x00, 0x00, 0x00, + 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; + diff --git a/gui/resources/powermon_icon.ico b/gui/resources/powermon_icon.ico new file mode 100644 index 0000000..afbe171 --- /dev/null +++ b/gui/resources/powermon_icon.ico Binary files differ diff --git a/gui/resources/powermon_icon.png b/gui/resources/powermon_icon.png new file mode 100644 index 0000000..7138b34 --- /dev/null +++ b/gui/resources/powermon_icon.png Binary files differ diff --git a/gui/resources/powermon_icon.xpm b/gui/resources/powermon_icon.xpm new file mode 100644 index 0000000..a97cb6a --- /dev/null +++ b/gui/resources/powermon_icon.xpm @@ -0,0 +1,495 @@ +/* XPM */ +static const char *powermon_icon_xpm[] = { +/* columns rows colors chars-per-pixel */ +"256 256 233 2 ", +" c black", +". c gray8", +"X c #323232", +"o c #5D537D", +"O c #78476A", +"+ c #694D74", +"@ c #67527A", +"# c #745175", +"$ c #646464", +"% c #BA2F3E", +"& c #E52117", +"* c #E3231B", +"= c #E5281F", +"- c #DB2728", +"; c #C82C38", +": c #D62C33", +"> c #DA3337", +", c #CC2E38", +"< c #E12825", +"1 c #E63631", +"2 c #DF231E", +"3 c #963C56", +"4 c #933B55", +"5 c #A73549", +"6 c #B73447", +"7 c #AE3B54", +"8 c #C83644", +"9 c #D43D44", +"0 c #8D415E", +"q c #B64A5B", +"w c #854565", +"e c #924D6E", +"r c #B85968", +"t c #AB546B", +"y c #99657D", +"u c #A8667A", +"i c #B46575", +"p c #C64B57", +"a c #CD4852", +"s c #D95C61", +"d c #E6423E", +"f c #7EC23F", +"g c #5FBA45", +"h c #63BB45", +"j c #6BBD44", +"k c #67BC4A", +"l c #71BF43", +"z c #71BF4A", +"x c #6DBE57", +"c c #72BF60", +"v c #76C042", +"b c #7AC143", +"n c #79C158", +"m c #7BC267", +"M c #83C43F", +"N c #8BC63E", +"B c #94C83C", +"V c #94C83D", +"C c #8EC74D", +"Z c #90C972", +"A c #A6D06A", +"S c #33659C", +"D c #3B6297", +"F c #2F679F", +"G c #1D6EAC", +"H c #0A76BA", +"J c #0479BE", +"K c #0C77BA", +"L c #1373B4", +"P c #1878B8", +"I c #1A70AF", +"U c #266BA6", +"Y c #2D75AE", +"T c #3F5F93", +"R c #495B8C", +"E c #545785", +"W c #415F91", +"Q c #6B5A84", +"! c #516896", +"~ c #7A7798", +"^ c #6F6A8F", +"/ c #4C77A7", +"( c #6C7DA3", +") c #007BC2", +"_ c #0A7EC3", +"` c #137DC2", +"' c #1B7EC3", +"] c #227FC3", +"[ c #976B84", +"{ c #99748C", +"} c #877996", +"| c #967B94", +" . c #886C89", +".. c #A66D81", +"X. c #A57588", +"o. c #A27E91", +"O. c #3384BB", +"+. c #1C80BE", +"@. c #598BB6", +"#. c #518BB9", +"$. c #6984AB", +"%. c #7987A8", +"&. c #688CB3", +"*. c #6995BB", +"=. c #7897B8", +"-. c #758EB1", +";. c #7FA0BF", +":. c #0B81C5", +">. c #1485C6", +",. c #1A85C5", +"<. c #1987C8", +"1. c #1C89C8", +"2. c #1988C7", +"3. c #2B82C4", +"4. c #238DCA", +"5. c #298FCB", +"6. c #2787C5", +"7. c #3383C5", +"8. c #3B85C5", +"9. c #378CC6", +"0. c #2690CB", +"q. c #2C92CC", +"w. c #3395CE", +"e. c #3699CF", +"r. c #3A99CF", +"t. c #3A95CB", +"y. c #3C9BD0", +"u. c #4789C7", +"i. c #548EC9", +"p. c #578EC8", +"a. c #459ACC", +"s. c #4998C9", +"d. c #5C92CA", +"f. c #5699C7", +"g. c #439ED2", +"h. c #4C9DD2", +"j. c #589DD0", +"k. c #6698CA", +"l. c #739DCE", +"z. c #769DC7", +"x. c #6A9FD0", +"c. c #59A2CD", +"v. c #45A1D2", +"b. c #4BA2D3", +"n. c #53A5D5", +"m. c #5AAAD7", +"M. c #5DABD8", +"N. c #56A8D5", +"B. c #52A5D1", +"V. c #65A9CC", +"C. c #78A6C8", +"Z. c #65B0CE", +"A. c #6AB1CF", +"S. c #63AED9", +"D. c #66A9D4", +"F. c #79A3D1", +"G. c #6BB3DB", +"H. c #66B1D9", +"J. c #72B5DD", +"K. c #7BBADE", +"L. c #78B7DA", +"P. c #7EB0CF", +"I. c #7EBCE0", +"U. c #98849B", +"Y. c #8B839C", +"T. c #8889A5", +"R. c #8699B6", +"E. c #9391AA", +"W. c #89A1BD", +"Q. c #A798A2", +"!. c #F0B2B2", +"~. c #EB8C8B", +"^. c #ABD491", +"/. c #B5D9AA", +"(. c #9ACD8A", +"). c #C2DEB2", +"_. c #C9E2BA", +"`. c #88A9D3", +"'. c #86B7DA", +"]. c #98B5D8", +"[. c #8AAACB", +"{. c #A4BBDB", +"}. c #A9BEDC", +"|. c #B4BED3", +" X c #83BEE1", +".X c #88BFE1", +"XX c #829DC4", +"oX c #ADC2DF", +"OX c #B4C2DB", +"+X c #8AC1E2", +"@X c #97C6E4", +"#X c #A7C9E5", +"$X c #BBCBE3", +"%X c #B4C7E1", +"&X c #B8D4EA", +"*X c #AED2EA", +"=X c #8EC2DF", +"-X c #D0D0D2", +";X c #F7D8D9", +":X c #F3C8C8", +">X c #D6E9CD", +",X c #E4F0DB", +"X/.^./.>XeXjXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXqXzXzXzXzXzXzXzXzXzXzX", +"zXzXzXzXzXzXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXjX>XZ n n Z /.>XkXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX-XzXzXzXzXzXzXzXzXzX", +"zXzXzXzXzXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXjX/.C v v b Z ^.>XjXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsX|.zXzXzXzXzXzXzXzX", +"zXzXzXzXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX,XZ v v v v C Z >XjXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXqXzXzXzXzXzXzXzXzX", +"zXzXzXzXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXeX^.b v b f M C Z >XjXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX-XzXzXzXzXzXzXzX", +"zXzXzXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXjX^.b b f M M C C ^.eXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXqXzXzXzXzXzXzXzX", +"zXzXzXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXjX^.b b C C M M M Z >XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX|.zXzXzXzXzXzX", +"zXzXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXkXZ b M M M M M N C ).jXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXqXzXzXzXzXzXzX", +"zXzXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX,XC M M M M N N N C ).jXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXjX$ zXzXzXzXzX", +"zXzXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX).C M M M N N N N C ).gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXQ.zXzXzXzXzX", +"zXzXsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXjXZ M M M N N N N B C >XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX-XzXzXzXzXzX", +"zXzXsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX>XC M M N N N N B B A eXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXqXzXzXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXjXZ M M N N N N B B B ^.jXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXkXzXzXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX).C M N N N N B B B C >XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXeXC M M N N N B B B B A jXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXjXZ M N N N N B B B B C ,XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX/.C N N N N B B B B V ^.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX>XC N N N N B B B B V A kXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX4XsXgXgXgXgXgXgXgXgXgXgXgXgX,XC N N N N B B B B V C >XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX8XoXgXgXgXgXgXgXgXgXgXgXgXgXkXZ N N N N B B B B V V ).gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX`.%XgXgXgXgXgXgXgXgXgXgXgXjXZ N N N N B B B V V V A gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX1Xi.4XgXgXgXgXgXgXgXgXgXgXjXZ N N N N B B V B V V A jXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXu.l.aXgXgXgXgXgXgXgXgXgXgX(.C N N N B B B B V V A eXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXl.] 6XgXgXgXgXgXgXgXgXgXgX(.N N N N B B B B B V C ,XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX].) l.aXgXgXgXgXgXgXgXgXgX(.N N N N B B B B B V C ,XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX%X_ 7.7XgXgXgXgXgXgXgXgXgXA N N N N B B B B B V C >XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$X` _ oXgXgXgXgXgXgXgXgXjXZ N N N N B B B B V V C >XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$X` ) F.gXgXgXgXgXgXgXgXjXZ N N N N B B B B V V C >XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX%X_ ) i.aXgXgXgXgXgXgXgXkXZ N N N N B B B B V V C ,XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX}.) ) u.rXgXgXgXgXgXgXgXeXC N N N N B B B B V V C ,XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX`.) ) 7.8XgXgXgXgXgXgXgX>XC M N N N B B B B V V C eXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsXk.) ) 3.4XgXgXgXgXgXgXgX_.C N N N N B B B B V V A kXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX4XaXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXi.) ) 3.4XgXgXgXgXgXgXgX^.C N N N N B B B B V V A jXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXrX}.sXgXgXgXgXgXgXgXgXgXgXgXgXgXgX7X7.) ) 7.7XgXgXgXgXgXgXjXZ C N N N N B B B B V V ^.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX`.$XgXgXgXgXgXgXgXgXgXgXgXgXgXgX%X` ) ) 8.rXgXgXgXgXgXgXeXC M N N N N B B B B V V ).gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$Xd.tXgXgXgXgXgXgXgXgXgXgXgXgXgX`.) ) ) u.uXgXgXgXgXgXgX>XC M N N N N B B B B V C >XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX8X7.}.gXgXgXgXgXgXgXgXgXgXgXgXuXi.) ) ) d.aXgXgXgXgXgXgX/.C M N N N N B B B B V C ,XgXgXuXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXtXu.k.aXgXgXgXgXgXgXgXgXgXgXgX1X] ) ) ) `.gXgXgXgXgXgXjXZ M M N N N N N B B B V A kXgXgX7X8XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXtX.F.rXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXtXF._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 7.8XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXoX_ ) 3.4XgXgXgXgXgXgXgXrXu.) ) ) ) u.yXgXgXgXgXgXkXZ f M M M M N N N N B B C ,XgXgXgXgXgXgXtXu.) i.uXgXgXgXgXsX2XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXtXu.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ :.:.>.x.rXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXF._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ' .x.rXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXF._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ` $XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX7X7.) ) l.sXgXgXgXgXgXgXrXu.) ) ) ) ] 1XgXgXgXgXgXjXZ b f M M M M N N N N B C >XgXgXgXgXgXgXgX%X` ) u.tXgXgXgXgXgXrXl.tXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX1X6.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ :.:.:.>.F.tXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaX`._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ` $XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX]._ ) _ }.gXgXgXgXgXgXgX]._ ) ) ) ) k.aXgXgXgXgXgX>Xb b f M M M M N N N N B A kXgXgXgXgXgXgXgX`.) ) u.uXgXgXgXgXgXaXk.oXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX2X3.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ :.:.:.>.F.uXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaX].` ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 3.4XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXtXu.) ) 3.4XgXgXgXgXgXgXyXu.) ) ) ) ` %XgXgXgXgXgXjX(.v b f C M M M N N N N C ).gXgXgXgXgXgXgXaXi.) ) d.aXgXgXgXgXgXgXl.d.aXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXyX8.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) :.:.:.>.<.`.aXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsX].' ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) u.uXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX%X` ) ) d.aXgXgXgXgXgXgX].) ) ) ) ) i.uXgXgXgXgXgX>Xn v b f M M M M N N N N C eXgXgXgXgXgXgXgX4X3.) ) l.gXgXgXgXgXgXgXF.3.4XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXd.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ :.:.:.>.,.].sXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXoX] ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) `.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXd.) ) _ {.gXgXgXgXgXgX4X8.) ) ) ) _ }.gXgXgXgXgXgX(.v v b f M M M M N N N N /.gXgXgXgXgXgXgXgX]._ ) ) ].gXgXgXgXgXgXgXl._ oXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX{._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ :.:.>.>.4.}.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX6X7.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 8.4XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$X' ) ) 8.8XgXgXgXgXgXaXF.) ) ) ) ) i.tXgXgXgXgXgX>Xn v v b f M M M M N N N C ,XgXgXgXgXgXgXgXuXi.) ) ' $XgXgXgXgXgXgXsXk.) ].gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXyXu.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ :.:.>.>.9.%XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX4Xu.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ` ].gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXk.) ) ) l.sXgXgXgXgXgX6X] ) ) ) ) _ }.gXgXgXgXgXjX(.v v v b f M M M M N N N ^.gXgXgXgXgXgXgXgX.>.u.2XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXyXd.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ F.aXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX%X' ) ) ] Xn v v v b f M M M M N N C ,XgXgXgXgXgXgXgXsXl.) ) ) k.aXgXgXgXgXgXgX8X8.) F.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaX].` ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ :.:.:.>.<.d.8XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXl.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ` `.uXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXtXd.) ) ) k.aXgXgXgXgXgX{._ ) ) ) ) ` }.gXgXgXgXgXjX(.v v v v b f M M M M N N ^.gXgXgXgXgXgXgXgX4X7.) ) _ ].gXgXgXgXgXgXgX$X' ) `.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaX].' ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ :.:.:.>.<.<.F.uXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsX].` ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ' ].aXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX}.` ) ) ` %XgXgXgXgXgX7Xu.) ) ) ) ) d.uXgXgXgXgXgX>Xv v v v v b f M M M M N C ,XgXgXgXgXgXgXgXgX`.) ) ) 3.2XgXgXgXgXgXgXgX`.) ) ].gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaX{.3.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ :.:.:.>.<.1.].sXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$X3.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 3.{.aXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX8Xu.) ) ) d.uXgXgXgXgXaX`.) ) ) ) ) ' $XgXgXgXgXgXkXZ v v v v v b f M M M M C /.gXgXgXgXgXgXgXgX7X8.) ) ) d.aXgXgXgXgXgXgXuXi.) ` %XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX%X7.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ :.:.>.>.<.5.%XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX7Xu.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 7.oXsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsX`._ ) ) ` %XgXgXgXgXgX.<.<.s.7XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXl.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 8.%XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX1X7.) ) ) k.uXgXgXgXgXuXk.) ) ) ) ) 3.1XgXgXgXgXgXeXZ j l v v v v b f M M M C ).gXgXgXgXgXgXgXgX4X8.) ) ) 8.8XgXgXgXgXgXgXsXF.) ) u.tXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX.<.<.<.F.uXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX{.` ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 8.$XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXk.) ) ) ] $XgXgXgXgXgX}.` ) ) ) ) ) `.sXgXgXgXgXgX/.j j l v v v v b f M M M Z kXgXgXgXgXgXgXgXaXF.) ) ) ) `.gXgXgXgXgXgXgX7X8.) ) l.sXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX.<.<.4.].gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX2X8.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 7.%XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXoX' ) ) ) k.aXgXgXgXgX8Xu.) ) ) ) ) u.8XgXgXgXgXgXeXm j l l v v v v b f M M C _.gXgXgXgXgXgXgXgX1X3.) ) ) 3.2XgXgXgXgXgXgXgX]._ ) ` %XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX.>.>.<.9.1XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXk.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 3.%XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXyXu.) ) ) 7.2XgXgXgXgXsX`.) ) ) ) ) _ ].gXgXgXgXgXgX/.j j l l v v v v b f M M Z jXgXgXgXgXgXgXgXuXk.) ) ) ) l.sXgXgXgXgXgXgX8Xu.) ) 8.8XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX.>.<.1.x.tXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX]._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ] }.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX`._ ) ) _ `.gXgXgXgXgX1X7.) ) ) ) ) i.tXgXgXgXgXgXeXm j j l l v v v v b f M C >XgXgXgXgXgXgXgXgXoX' ) ) ) 3.1XgXgXgXgXgXgXgX]._ ) ) l.sXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$X7.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ :.:.>.>.>.<.4.].gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX2X7.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ` ].sXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX2X7.) ) ) u.8XgXgXgXgXaXk.) ) ) ) ) ` %XgXgXgXgXgXgX/.j j j l l v v v v b f M (.jXgXgXgXgXgXgXgXyXu.) ) ) ) l.sXgXgXgXgXgXgX7Xu.) ) ' 6XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX}.] ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ :.:.:.>.>.<.1.t.1XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXk.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ `.aXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXk.) ) ) _ ].gXgXgXgXgX$X' ) ) ) ) ) k.uXgXgXgXgXgXeXm j j j l l v v v v b f C >XgXgXgXgXgXgXgXsX`._ ) ) ) 3.2XgXgXgXgXgXgXgX`.) ) ) d.uXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsX].` ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) :.:.:.>.>.>.<.1.D.uXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX}.` ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) l.uXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$X' ) ) ) i.tXgXgXgXgXuXd.) ) ) ) ) ] .>.>.<.1.4.oXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX8Xu.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) d.yXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXd.) ) ) ' %XgXgXgXgXgXoX` ) ) ) ) ) l.aXgXgXgXgXgXkXm j j j j l l v v v v b C ,XgXgXgXgXgXgXgXtXd.) ) ) ) u.7XgXgXgXgXgXgXaXk.) ) ) i.tXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXrXk.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) :.:.:.>.<.<.1.1.s.8XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsX`._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 8.2XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXoX` ) ) ) k.uXgXgXgXgXuXd.) ) ) ) ) 3.2XgXgXgXgXgXgX).k j j j j l l v v v v b ^.gXgXgXgXgXgXgXgX]._ ) ) ) _ ].gXgXgXgXgXgXgX%X' ) ) ` }.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX4Xu.) ) ) ) ) ) ) ) ) ) ) ) ) ) _ :.:.>.>.<.<.1.4.'.sXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX2X7.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ] oXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXtXi.) ) ) ] $XgXgXgXgXgXoX` ) ) ) ) ) F.sXgXgXgXgXgXjXZ h j j j j l l v v v v C ,XgXgXgXgXgXgXgX1X7.) ) ) ) d.tXgXgXgXgXgXgX8Xu.) ) ) i.tXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$X3.) ) ) ) ) ) ) ) ) ) ) ) ) _ :.:.:.>.>.<.1.1.t.1XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXl.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ `.aXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXoX` ) ) ) k.aXgXgXgXgXuXd.) ) ) ) ) 7.4XgXgXgXgXgXgX>Xx h h j j j l l v v v v ^.gXgXgXgXgXgXgXtXd.) ) ) ) 3.$XgXgXgXgXgXgXaX`.) ) ) ' %XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX].` ) ) ) ) ) ) ) ) ) ) ) ) ) _ :.:.>.>.>.<.1.4.F.aXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$X] ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) d.rXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXd.) ) ) ' 6XgXgXgXgXgX$X' ) ) ) ) ) F.sXgXgXgXgXgXgX(.h h h j j j l l v v v C ,XgXgXgXgXgXgXgX]._ ) ) ) ) F.aXgXgXgXgXgXgX%X] ) ) ) k.aXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXk.) ) ) ) ) ) ) ) ) ) ) ) ) _ :.:.>.>.>.<.1.4.9.&XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXk.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 7.1XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX.>.<.1.1.4.D.uXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$X' ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ ].gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsXF.) ) ) ` %XgXgXgXgXgX4X7.) ) ) ) ) k.aXgXgXgXgXgXgX/.k h h j j j j l l v v C ,XgXgXgXgXgXgXtXk.) ) ) ) ` }.gXgXgXgXgXgXaXF.) ) ) _ ].gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXoX' ) ) ) ) ) ) ) ) ) ) ) ) _ :.:.>.>.>.<.1.4.5.%XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXd.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) k.uXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXyX8.) ) ) u.tXgXgXgXgXgX]._ ) ) ) ) ' $XgXgXgXgXgXgXjXZ h h h j j j j l l v v (.gXgXgXgXgXgXgX]._ ) ) ) ) k.uXgXgXgXgXgXgX%X' ) ) ) i.rXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXl.) ) ) ) ) ) ) ) ) ) ) ) _ :.:.>.>.>.<.1.4.4.D.uXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$X' ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 7.2XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX%X` ) ) ) ].gXgXgXgXgXuXi.) ) ) ) ) i.uXgXgXgXgXgXgX,Xx h h h j j j j l l v n >XgXgXgXgXgXgX2X8.) ) ) ) 7.2XgXgXgXgXgXgX7Xu.) ) ) ] $XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX7Xu.) ) ) ) ) ) ) ) ) ) ) ) :.:.:.>.>.<.1.1.4.q.$XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXk.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ ].gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsXl.) ) ) 3.2XgXgXgXgXgX1X] ) ) ) ) _ ].gXgXgXgXgXgXgX/.h h h h j j j j l l v Z jXgXgXgXgXgXaXk.) ) ) ) _ ].gXgXgXgXgXgXaXl.) ) ) ) `.aXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX{.` ) ) ) ) ) ) ) ) ) ) ) _ :.:.>.>.>.1.1.4.4.D.aXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$X' ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) i.tXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXtXu.) ) ) d.aXgXgXgXgXgX].) ) ) ) ) 7.4XgXgXgXgXgXgXjXZ h h h h j j j j l l v _.gXgXgXgXgXgX%X' ) ) ) ) p.rXgXgXgXgXgXgX}.` ) ) ) i.8XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXk.) ) ) ) ) ) ) ) ) ) ) _ :.:.>.>.>.<.1.4.4.w.&XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXk.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ' %XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX2X3.) ) ) ].gXgXgXgXgXaXd.) ) ) ) ) k.aXgXgXgXgXgXgXeXx h h h h j j j j l l Z eXgXgXgXgXgXyXu.) ) ) ) ] $XgXgXgXgXgXgX7Xu.) ) ) ] %XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX.>.<.1.1.4.4.F.aXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX2X3.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) k.aXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXoX_ ) ) ] .>.<.<.1.4.4.t.2XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX`.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 3.2XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX`.) ) ) u.rXgXgXgXgXgX$X` ) ) ) ) 7.4XgXgXgXgXgXgXgX(.g h h h h j j j j l n ,XgXgXgXgXgX4X8.) ) ) ) 8.4XgXgXgXgXgXgX%X' ) ) ) u.7XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX4X8.) ) ) ) ) ) ) ) ) ) _ :.:.>.>.>.<.1.4.4.5.'.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX8X8.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) `.sXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXk.) ) ) k.aXgXgXgXgXgX].) ) ) ) ) d.aXgXgXgXgXgXgXjXm g h h h h j j j j l Z jXgXgXgXgXsX`.) ) ) ) _ ].gXgXgXgXgXgXyXu.) ) ) ` }.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX]._ ) ) ) ) ) ) ) ) ) _ :.:.:.>.>.<.1.4.4.4.a.8XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX{._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 7.4XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsXd.) ) ) ].gXgXgXgXgXsXk.) ) ) ) ) ].gXgXgXgXgXgXgXeXx g h h h h j j j j l ).gXgXgXgXgX4X7.) ) ) ) u.yXgXgXgXgXgXgX`._ ) ) ) k.uXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX8Xu.) ) ) ) ) ) ) ) ) _ :.:.:.>.>.<.1.1.4.4.q.#XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXd.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) `.sXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXd.) ) ` %XgXgXgXgXgXaXi.) ) ) ) ' $XgXgXgXgXgXgXgX>Xh g h h h h j j j j n eXgXgXgXgXgX`.) ) ) ) _ {.gXgXgXgXgXgX4X7.) ) ) 3.1XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX]._ ) ) ) ) ) ) ) ) ) _ :.:.>.>.<.<.1.4.4.4.D.aXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX.>.>.<.1.4.4.4.t.3XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX`.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) `.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsXk.) ) 3.7XgXgXgXgXgX8X7.) ) ) ) i.aXgXgXgXgXgXgXgX(.h h h h h h j j j j ).gXgXgXgXgX].) ) ) ) _ ].gXgXgXgXgXgX2X3.) ) ) 8.7XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX].) ) ) ) ) ) ) ) ) _ :.:.>.>.>.<.1.4.4.4.0.'.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXrXu.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 3.2XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX`.) ) 7.8XgXgXgXgXgX4X3.) ) ) ) l.gXgXgXgXgXgXgXsXZ h h h h h h j j j n ,XgXgXgXgXuXi.) ) ) ) u.8XgXgXgXgXgXsXF.) ) ) _ ].gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX8X8.) ) ) ) ) ) ) ) _ :.:.:.>.>.<.1.1.4.4.q.j.rXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$X` ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) l.aXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX}._ ) 7.yXgXgXgXgXgX1X3.) ) ) ) ].gXgXgXgXgXgXgXjXm g g h h h h h j j Z jXgXgXgXgX1X] ) ) ) ) `.gXgXgXgXgXgX7X8.) ) ) u.8XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX`.) ) ) ) ) ) ) ) ) :.:.:.>.>.<.1.1.4.4.5.w.&XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsXl.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ' $XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX4X3.) 7.7XgXgXgXgXgX1X6.) ) ) _ %XgXgXgXgXgXgXgXkXc g g h h h h h j j ^.gXgXgXgXgX`.) ) ) ) 3.2XgXgXgXgXgXgX]._ ) ) _ ].gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX2X3.) ) ) ) ) ) ) ) _ :.:.>.>.<.<.1.4.4.4.q.'.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXrXu.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) p.uXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXk.) ' XgXgXgXgXuXi.) ) ) ) d.aXgXgXgXgXgXaXd.) ) ) 7.7XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXk.) ) ) ) ) ) ) ) _ :.:.>.>.>.<.1.4.4.5.q.j.rXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$X` ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ {.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$X' _ }.gXgXgXgXgX8X7.) ) ) ] 4XgXgXgXgXgXgXgXeXx g g g h h h j j n eXgXgXgXgX4X3.) ) ) _ {.gXgXgXgXgXgX2X3.) ) ) l.sXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX%X` ) ) ) ) ) ) ) _ :.:.>.>.>.<.1.4.4.4.q.t.&XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX`.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 8.7XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXF.) l.sXgXgXgXgXtXu.) ) ) 3.7XgXgXgXgXgXgXgXeXx g g g h h h j j Z jXgXgXgXgXoX_ ) ) ) 7.4XgXgXgXgXgXgX].) ) ) ' $XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXrXu.) ) ) ) ) ) ) _ :.:.>.>.>.<.1.4.4.5.0.w.'.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXi.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) l.sXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXyXd.8.7XgXgXgXgXaXk.) ) ) 7.8XgXgXgXgXgXgXgXeXx g g g h h h h j (.gXgXgXgXgX`.) ) ) ) d.aXgXgXgXgXgXsXk.) ) ) u.tXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX`.) ) ) ) ) ) ) _ :.:.:.>.>.<.1.4.4.4.q.w.c.uXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX1X] ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ` $XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX8Xk.`.sXgXgXgXgX]._ ) ) 3.4XgXgXgXgXgXgXgXeXx g g h h h h h j /.gXgXgXgXaXk.) ) ) _ ].gXgXgXgXgXgXtXu.) ) ) `.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX.>.<.1.1.4.4.q.w.g.2XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX]._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) u.tXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuX].$XgXgXgXgX2X3.) ) ] 1XgXgXgXgXgXgXgXkXc g g h h h h h j _.gXgXgXgXuXu.) ) ) ' .>.<.<.1.4.4.5.q.t.#XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXk.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) F.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX8X8XgXgXgXaXk.) ) ` $XgXgXgXgXgXgXgXjXm g g h h h h h z >XgXgXgXgXrXu.) ) ) 8.rXgXgXgXgXgXgX$X` ) ) 8.yXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX].) ) ) ) ) ) ) _ :.:.>.>.<.<.1.4.4.4.q.w.J.sXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXrXu.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ` $XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX%X' ) ) ].gXgXgXgXgXgXgXjXZ g g h h h h h x ,XgXgXgXgX8X7.) ) ) d.aXgXgXgXgXgXgX%X_ ) ) d.aXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX1X] ) ) ) ) ) ) _ :.:.>.>.<.1.1.4.4.4.q.w.n.rXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX.>.>.<.1.4.4.5.q.w.g.3XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX]._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) k.sXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX4Xu.) 8.8XgXgXgXgXgXgXgX_.h g g h h h j n eXgXgXgXgXyX8.) ) ) ].gXgXgXgXgXgXgXoX_ ) _ {.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX`.) ) ) ) ) ) _ :.:.>.>.>.<.1.4.4.4.q.w.y.#XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsXk.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ }.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$X7._ ].gXgXgXgXgXgXgX,Xx g h h h h j n kXgXgXgXgXuXu.) ) _ %XgXgXgXgXgXgXgX$X` ) ` $XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$X` ) ) ) ) ) _ :.:.>.>.>.<.1.4.4.4.0.w.y.L.sXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXu.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 3.4XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$Xu.u.8XgXgXgXgXgXgXjXm g h h h h j n kXgXgXgXgXaXd.) ) ` $XgXgXgXgXgXgXgX2X] ) ' .>.<.1.4.4.4.0.w.y.D.uXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX4X3.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) i.uXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX2Xd.`.aXgXgXgXgXgXgX^.g h h h h j n eXgXgXgXgXgX`.) ) ` $XgXgXgXgXgXgXgXtXu.) ' .>.<.1.4.4.4.0.w.y.n.8XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$X` ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) l.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXtX].}.sXgXgXgXgXgX>Xk h h h h h n eXgXgXgXgXgX$X' ) _ %XgXgXgXgXgXgXgXgX`.) ` $XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX].) ) ) ) ) _ :.:.:.>.>.<.1.4.4.4.0.w.y.g.&XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX]._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ }.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX8X2XsXgXgXgXgXjXm g h h h h z >XgXgXgXgXgXtXi.) ) {.gXgXgXgXgXgXgXgX1X3._ }.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$X` ) ) ) ) ) :.:.:.>.>.<.1.1.4.4.0.w.y.g.#XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXk.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ] 1XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX/.h h h h h z >XgXgXgXgXgXgX{._ ) F.gXgXgXgXgXgXgXgXsX`.) F.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX7X7.) ) ) ) ) :.:.:.>.>.<.1.4.4.4.0.w.e.g.'.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXi.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) u.rXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXeXm h h h j j /.gXgXgXgXgXgXtXk.) i.uXgXgXgXgXgXgXgXgXyXd.u.tXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXi.) ) ) ) ) _ :.:.>.>.<.1.1.4.4.q.w.t.g.G.aXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXrX8.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) d.aXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX/.k h h j j (.gXgXgXgXgXgXgX4Xu.3.1XgXgXgXgXgXgXgXgXgX4Xd.oXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXl.) ) ) ) ) _ :.:.>.>.<.1.1.4.4.q.w.r.g.m.rXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX2X] ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) `.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXkXZ h h j j m kXgXgXgXgXgXgXgX.>.<.<.1.4.4.q.w.r.g.n.0XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$X` ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ }.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX>Xx h j j z >XgXgXgXgXgXgXgXgX2Xk..>.<.<.1.4.4.q.w.r.g.b.3XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX}._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ' $XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXjX^.h h j j ^.gXgXgXgXgXgXgXgXgXrX{.8XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX2X3.) ) ) ) _ :.:.>.>.<.1.4.4.4.q.w.y.g.b.*XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX`.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 3.4XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXeXZ h j j Z eXgXgXgXgXgXgXgXgXgXgXyXaXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXrX8.) ) ) ) _ :.>.>.>.<.1.1.4.4.q.w.y.g.b.@XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXl.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) u.rXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX>Xn j j l ).gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXi.) ) ) ) _ :.>.>.>.<.1.1.4.4.q.w.r.g.b.'.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXk.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) i.aXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX).x j j Z kXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXk.) ) ) ) :.:.>.>.>.<.1.1.4.4.0.w.y.g.b.L.sXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXi.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) k.sXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX/.z j v ).gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXF.) ) ) ) :.:.:.>.>.<.1.1.4.4.5.w.y.g.b.J.aXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXu.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) F.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXjX/.z v Z eXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX`.) ) ) _ :.:.:.>.>.<.1.4.4.4.0.w.y.g.b.H.iXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXrX8.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) `.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXjX/.n l ^.jXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX{._ ) ) _ :.:.:.>.>.<.1.4.4.4.5.w.y.g.b.D.uXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgX8X7.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ ].gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXjX).n n _.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX%X_ ) ) _ :.:.:.>.>.<.1.4.4.4.5.w.y.g.b.S.rXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgX4X3.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ }.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX>XZ C >XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$X` ) ) _ :.:.>.>.>.<.1.4.4.4.q.w.y.g.b.S.8XgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgX2X] ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ %XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX,XZ Z ,XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX.>.>.<.1.4.4.4.q.w.y.g.b.M.9XgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgX1X' ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ` $XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXkX/.Z ,XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX1X] ) ) _ :.:.>.>.>.<.1.4.4.4.q.w.y.g.b.M.0XgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXX(.,XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX2X3.) ) _ :.:.>.>.>.<.1.4.4.4.q.w.y.g.b.M.2XgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgX.>.<.<.1.4.4.4.q.w.y.b.n.M.2XgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXXjXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX4X3.) ) _ :.:.>.>.<.1.1.4.4.5.q.t.g.b.n.M.2XgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgX.>.<.1.1.4.4.q.w.r.g.b.n.M.2XgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgX.>.<.1.1.4.4.0.w.r.g.b.n.M.0XgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgX.>.>.<.1.4.4.4.0.w.y.g.b.N.S.0XgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgX1X' ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ` $XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXjXjXjXjXjXjXjXjXjXjXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX1X] _ _ :.:.>.>.>.<.1.4.4.4.q.w.y.g.b.N.S.0XgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgX4X3.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ %XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXjXjXjXwXwXwXwXwXjXjXjXjXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX.>.>.1.1.4.4.4.q.w.y.g.b.N.S.8XgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgX7X3.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ }.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXjXjXjXwXwX;X:X;XwXwXjXjXjXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$X` ) _ :.:.>.>.<.<.1.4.4.4.q.w.y.g.n.m.H.8XgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXyX8.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ ].gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXjXjXwXwX;X!.d ~.;XwXwXjXjXjXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX%X_ ) :.:.:.>.>.<.1.1.4.4.5.w.t.g.b.n.m.G.pXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXtXu.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) `.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXjXjXwXwX;X;X~.* s :X;XwXwXjXjXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX{._ _ :.:.:.>.>.<.1.1.4.4.q.w.r.g.b.n.M.J.iXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXu.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) l.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXrX1X.>.>.<.1.4.4.4.0.w.y.g.b.N.M.L.aXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXi.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) d.aXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX%Xu.' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' 8.{.gXgXgXgXgXgXgXgXgXgXgXjXjXjXwX;X:X!.d & d !.:X;XwXwXjXjXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX{.u.' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ] u.%XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXl.) _ :.:.>.>.>.<.1.4.4.4.q.w.y.g.b.N.M.'.sXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsXk.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) u.uXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX8Xu.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 7.4XgXgXgXgXgXgXgXgXgXgXjXjXwXwX;X:X~.1 & 1 !.:X;XwXwXjXjXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX2X7.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) u.8XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXd.) _ :.:.>.>.<.1.1.4.4.4.q.w.y.g.b.m.S.'.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXF.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 8.rXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX6X` ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ oXgXgXgXgXgXgXgXgXgXgXjXjXwX;X:X!.~.* & < ~.:X;X;XwXjXjXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXoX_ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ` 6XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXi.) :.:.:.>.>.<.1.1.4.4.q.w.r.g.b.n.m.S.@XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX].) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 3.4XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$X` ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) }.gXgXgXgXgXgXgXgXgXgXjXjXwX;X:X!.s & * * ~.!.:X;XwXjXjXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX}.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ` $XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXyX8._ :.:.>.>.>.<.1.4.4.4.0.w.y.g.b.n.m.S.*XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXoX_ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ` $XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$X` ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ }.gXgXgXgXgXgXgXgXgXgXjXjXwX;X:X!.d * 1 * s !.:X;XwXjXjXjXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX}.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ` $XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX2X3._ :.:.>.>.<.<.1.4.4.4.q.w.y.g.b.N.M.S.&XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX.>.<.<.1.4.4.4.q.w.y.g.b.N.S.G.0XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX4X3.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) F.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$X` ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ }.gXgXgXgXgXgXgXgXgXjXjXwXwX;X:X~.= d s * s !.:X;XwXjXjXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX}._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ` $XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX]._ :.:.:.>.>.<.1.1.4.4.q.w.r.g.b.n.m.S.J.8XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXtXu.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) d.aXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsXuXoX7.6.6.6.6.3.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.6.].uXiXgXgXgXgXgXgXgXjXjXwX;X:X!.s * s ~.< d !.:X;XwXwXjXjXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXuX].6.6.6.3.6.6.6.6.6.6.6.6.6.6.6.6.6.3.6.6.6.6.7.oXuXsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsXk._ :.:.>.>.>.<.1.4.4.4.0.w.y.g.b.n.M.S.K.iXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXd.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 8.rXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX3XL.A.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.A.L.=XsXgXgXgXgXgXjXjXjXwX;X:X!.s < s ~.1 d !.:X;XwXwXjXjXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsX'.A.A.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.A.L.3XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXi._ :.:.>.>.>.<.1.4.4.4.q.w.y.g.b.N.M.H. XsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXl.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ' .>.<.1.1.4.4.5.q.w.y.g.b.N.S.H.@XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX]._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ {.gXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXtX$X`.k.d.d.p.p.p.p.p.p.p.f.c.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.D.D.D.D.D.D.D.C.=.T.Y.| r * < p p < * r X.Q.E.[.].].=X=X+X+X+X XK.K.K.K.L.L.J.J.G.A.D.D.D.D.D.D.D.c.j.j.j.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.c.i.i.i.i.i.i.i.i.i.p.k.`.$XrXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX%X>.:.:.>.>.>.<.1.4.4.4.q.w.r.g.b.n.m.S.H.*XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$X' ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) l.sXgXgXgXgXgXgXgXgXgXgXgXgXgXgXtX{.i.,.:.:.:.:.:.:.:.:.:.:.:.:.9.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.h.h.B.B.B.y.y.y.g.g.a.f.f.&.%.} [ a * > q q - * p ..U.E.W.[.'.K.K.K.J.J.G.H.S.M.m.N.n.b.b.v.v.v.y.y.e.e.w.q.q.0.4.4.a.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.7.) ) ) ) ) ) ) ) ) ) ) ) ` u.{.tXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX`.:.:.:.>.>.>.<.1.4.4.4.q.w.y.g.b.N.M.S.G.0XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX7X7.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) u.tXgXgXgXgXgXgXgXgXgXgXgXgXgX4Xk.>.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.>.>.>.>.<.<.1.1.4.4.4.q.0.q.q.w.w.e.r.y.y.y.g.v.v.a.f.f.&.%.} y > * 9 q q > & p X.U.E.W.[.'.K.L.J.J.G.H.S.M.M.m.n.n.b.b.v.v.y.y.r.e.w.q.0.0.4.1.<.2.>.>.:.:.:.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ k.4XgXgXgXgXgXgXgXgXgXgXgXgXgXaXd.:.:.:.>.>.<.1.1.4.4.4.q.w.y.g.b.N.M.S.L.rXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXi.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ] 2XgXgXgXgXgXgXgXgXgXgXgXgX2Xi.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.>.>.<.<.<.1.1.4.4.0.0.0.0.q.w.w.e.e.y.y.y.g.v.v.b.h.f.*.$.%.} u : * p q q > & a X.U.E.W.[.'.L.L.J.G.H.H.S.M.m.N.n.b.b.v.v.g.y.y.e.w.q.0.0.4.4.1.<.>.>.>.:._ _ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) u.4XgXgXgXgXgXgXgXgXgXgXgXgX8X8.:.:.>.>.>.<.1.4.4.4.q.w.r.g.b.n.m.S.H. XaXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXF.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ {.gXgXgXgXgXgXgXgXgXgXgXyXd.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.>.>.>.<.<.<.1.1.4.0.0.0.0.q.q.w.e.e.r.y.y.y.v.v.v.b.h.f.*.-.} .t < < q r r a * 9 X.U.E.W.[.'.L.J.G.G.H.S.M.m.m.n.b.b.b.v.v.y.y.e.w.w.q.q.4.4.1.<.<.>.>.:._ _ ) _ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) d.yXgXgXgXgXgXgXgXgXgXgXgX%X>.:.:.>.>.>.<.1.4.4.4.q.w.y.g.b.n.m.S.G.@XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX}._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) k.sXgXgXgXgXgXgXgXgXgXgX`.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.>.>.<.<.<.1.1.4.4.0.0.0.q.q.w.w.e.e.y.y.y.v.v.v.b.b.f.f.*.%.} { r * > r r r p * > ..U.E.W.[.`.L.J.G.H.S.M.M.m.m.n.b.b.v.v.y.y.r.e.w.q.0.0.4.1.1.2.>.>.>._ K K J J J J ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) `.gXgXgXgXgXgXgXgXgXgXgXF.:.:.:.>.>.<.1.4.4.4.4.q.w.y.g.b.N.M.S.G.&XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX2X] ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 8.8XgXgXgXgXgXgXgXgXgX4X7.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.>.>.<.<.<.<.1.1.4.0.0.0.0.q.w.w.e.e.r.y.y.y.v.v.v.b.h.f.k.*.%.} [ a & a t t t q * > ..U.E.W.[.P.P.G.G.H.S.M.m.m.n.n.b.b.v.v.y.y.e.w.q.0.q.4.4.1.2.>.>.>.` K K K H H H J J J ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 7.4XgXgXgXgXgXgXgXgXgXtXi.:.:.>.>.>.<.1.4.4.4.q.w.r.g.b.n.m.S.H.J.9XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXtXu.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ` %XgXgXgXgXgXgXgXgXgX].:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.>.>.>.<.<.<.1.1.4.4.0.0.0.q.q.w.w.e.r.y.y.y.g.v.v.b.b.B.f.*.&.%.} [ > * p t t t r < < i U.E.R.XXP.A.G.H.S.M.M.m.N.n.b.b.v.v.y.y.r.e.w.q.0.0.4.1.<.<.>.>.` P P P L L L K H H J J ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) `.gXgXgXgXgXgXgXgXgX.>.<.<.1.4.4.4.q.w.y.g.b.N.M.S.G. XiXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsXl.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) l.sXgXgXgXgXgXgXgXaXd.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.>.>.<.<.<.1.1.4.4.0.0.0.q.q.w.w.e.e.y.y.y.g.v.v.v.b.b.B.f.*.-.T.| u < < r u i i r < < i U.E.R.XXC.A.H.H.S.M.m.N.n.b.b.v.v.y.y.r.e.w.q.0.0.4.4.1.2.>.>.` P P P I I G I L L K H J ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) i.aXgXgXgXgXgXgXgXgX`.:.:.>.>.>.<.1.1.4.4.5.q.w.y.g.b.m.M.H.G.@XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX}._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 8.yXgXgXgXgXgXgXgXyX9.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.>.>.>.<.<.<.1.1.4.0.0.0.0.q.q.w.e.e.r.y.y.y.g.v.v.b.b.n.B.f.*.-.Y.| r * > i u u u i > * r o.U.R.W.C.A.A.S.M.m.m.n.n.b.b.v.v.y.y.e.w.w.q.q.4.4.1.<.>.>.>.P P I G U U U U U I L H J J ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 7.8XgXgXgXgXgXgXgXuXi.:.:.>.>.>.<.1.4.4.4.0.w.r.g.b.n.m.S.H.J.&XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX4X3.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ oXgXgXgXgXgXgXgX4X6.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.>.>.<.<.<.1.1.4.4.0.0.0.q.q.w.w.e.r.r.y.y.y.v.v.b.b.b.B.c.k.*.%.} { p & a u u u u i 9 * s o.U.E.R.C.A.D.D.M.m.N.n.b.b.v.v.y.y.r.e.w.q.0.0.4.1.1.2.>.>.P P P U U S Q Q D U U I L H J ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ] 2XgXgXgXgXgXgXgX.>.>.<.1.1.4.4.5.q.w.y.g.b.N.M.S.G.K.8XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXi.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) k.aXgXgXgXgXgXgX1X6.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.>.>.>.<.<.<.1.1.4.4.0.0.0.q.w.w.w.r.r.r.r.g.g.v.v.b.b.n.B.c.k.-.%.} { 9 * p u u ....u a & p X.U.E.R.C.V.D.M.m.m.n.b.b.b.v.v.y.y.e.w.q.0.q.4.4.1.<.<.>.>.P P G U D E , : Q D U U L K J J ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ] 1XgXgXgXgXgXgXgX`.:.:.>.>.>.<.1.4.4.4.q.w.r.g.b.n.m.S.H.G.+XaXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX`.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 7.4XgXgXgXgXgXgX1X6.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.>.>.>.<.<.<.1.1.4.4.0.0.0.q.q.w.w.w.r.r.r.a.a.g.v.b.b.b.n.c.c.*.-.T.| ..: * r ....X.X...p & a X.U.T.R.C.V.D.M.m.N.n.b.b.v.v.y.y.e.w.w.q.0.0.4.1.<.>.>.>.>.P I U S W # - < e R D U I L H J ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ] 1XgXgXgXgXgXgXyXu.:.:.>.>.<.1.1.4.4.4.q.w.y.g.b.n.m.S.G.J.#XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX.>.>.<.<.1.1.4.4.0.0.0.q.q.w.w.w.t.t.a.a.s.a.a.v.b.b.n.N.c.k.*.-.Y.| i < : u ..X.X.X.X.r * 9 X.U.T.=.C.V.D.m.N.n.b.b.v.v.y.y.r.e.w.q.0.0.4.1.1.2.>.>.>.P P G F D E e < * e E W F G L H J ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ] 1XgXgXgXgXgXgXoX>.:.>.>.>.<.1.1.4.4.5.q.w.y.g.b.N.M.H.G.K.9XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXtXu.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) i.tXgXgXgXgXgX1X6.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.>.>.>.<.<.<.1.1.4.4.0.0.0.q.w.w.t.t.t.s.s.s.s.s.s.h.h.n.n.N.c.k.*.%.Y.| r * 9 ..X.o.o.X.X.i < > X.| T.=.z.V.D.N.N.n.b.b.v.g.y.y.e.w.w.q.q.0.4.1.<.>.>.>.>.P P U S R o 0 * * 7 o R S U L H J ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ] 1XgXgXgXgXgXaXk.:.:.>.>.<.1.1.4.4.4.0.w.y.g.b.n.m.S.G.J.+XiXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX`.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ` %XgXgXgXgXgX1X6.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.>.>.<.<.<.1.1.4.4.0.0.q.q.q.w.t.t.t.s.s.#.#.#.f.f.f.f.B.N.c.c.k.=.T.} { a * p X.o.o.o.o.X.i < 1 ..| T.-.=.V.c.N.n.b.b.v.v.y.r.r.e.w.q.0.0.4.1.1.2.>.>.>._ K P U D E @ 7 * & 6 + E D U L K J ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ] 1XgXgXgXgXgX1X6.:.>.>.>.<.1.1.4.4.5.q.w.y.g.b.N.M.S.G.J.#XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX.>.<.<.<.<.1.1.4.0.0.0.q.q.w.t.t.t.s.#.#.@.@.@.@.@.f.f.c.c.c.V.k.=.T.| ..> * r X.| U.U.U.X.i 1 < u | T.-.=.V.c.N.b.b.b.v.g.y.y.e.w.q.0.q.0.4.1.<.<.>.:.:._ K I U D E + 6 & & 8 + E W U I L J J ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ] 1XgXgXgXgXsXF.:.:.>.>.<.1.1.4.4.4.0.w.y.g.b.n.m.S.H.J.K.0XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuXi.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 3..>.<.<.<.1.1.4.4.0.0.0.q.q.w.t.t.u.#.@.$.$.( ( $.$.&.k.f.c.V.V.*.-.T.| u < < i o.U.U.U.U.o...> * i | Y.-.=.k.c.n.b.b.v.v.y.y.e.w.w.q.0.4.4.1.<.<.>.>.:._ K K I U W o O ; & & ; O o R S G L H J ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ] 1XgXgXgXgX7X9.:.>.>.>.<.1.1.4.4.5.q.w.y.g.b.N.M.S.G.J.+XaXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX].) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) l.aXgXgXgX1X6.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.>.>.<.<.<.1.1.4.4.4.0.0.q.q.w.w.t.t.#.@.$.( ~ p r ~ %.$.*.k.k.V.k.=.-.Y.| r * > ..o.U.U.U.U.o.X.9 * r { Y.%.*.k.c.n.b.v.v.y.y.r.e.w.q.0.0.4.1.1.2.>.>.>.:._ K P G F R @ O - & & : w @ R S G L H J ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ] 1XgXgXgXgX`.>.:.>.>.<.1.1.4.4.4.0.w.r.g.b.n.m.S.H.G.J.*XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX4X3.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 3.2XgXgXgX1X6.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.>.>.>.<.<.<.1.1.4.0.0.0.q.q.q.w.t.t.s.#.$.( ~ u < - [ ~ %.&.*.k.V.z.=.T.Y.{ p * a X.o.U.E.E.U.U.X.a * p { } %.*.k.c.h.b.v.v.y.y.e.w.w.q.q.4.4.1.2.<.>.>.>._ _ K L U S E + w - & & - w + E S U L H J ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ] 1XgXgXgX8Xu.:.>.>.>.<.1.1.4.4.5.q.w.y.g.b.N.M.S.G.J. X9XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXk.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) F.aXgXgX1X6.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.>.>.>.<.<.<.1.1.4.4.0.0.0.q.q.w.w.t.t.#.@.( ~ .p & * r .~ %.*.*.k.=.=.T.| { 9 * r X.U.U.E.E.E.U.| p & a { } %.*.k.f.h.v.g.y.y.r.e.w.q.0.0.4.1.1.<.>.>.` ` K K K L U D E + 4 - & & - 0 + E D U L H J ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ] 1XgXgXgX].>.>.>.>.<.1.1.4.4.4.0.w.r.g.b.n.m.S.H.J.J.@XsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX%X` ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 3.2XgXgX1X6.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.>.>.<.<.<.<.1.1.4.4.0.0.q.q.w.w.w.t.s.#.@.( ^ y : & & a y } %.-.=.=.=.R.T.| ..1 < i o.U.E.E.E.E.U.| r * 9 [ } %.&.*.f.h.a.g.y.y.e.w.q.0.0.4.4.1.1.,.,.P P P K K L I U D E + 3 * & & - 3 + E D U L H J ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ] 1XgXgX8Xu.:.>.>.>.<.1.4.4.4.5.q.w.y.g.b.N.M.S.G.J.I.3XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXrXu.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) l.aXgX1X6.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.>.>.>.<.<.<.1.1.4.4.0.0.0.q.w.w.w.t.t.s.#.( ~ .t - & & > u [ } %.=.=.=.T.T.| i < 1 ..U.U.E.E.R.E.U.| r * > [ } %.&.*.f.a.a.y.y.e.e.w.q.q.4.4.1.,.,.+.P P P P P L I G U T E O 5 * & & * 3 O E D U L H J ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ] 1XgXgX`.>.>.>.>.<.1.1.4.4.4.q.w.y.g.b.n.m.S.H.G.J.+XuXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX]._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ] .>.>.<.<.1.1.4.4.0.0.0.q.q.w.w.w.t.a.#.@.( ~ y q * * & < t [ } T.-.=.=.T.Y.{ r * 9 X.U.E.E.R.R.E.Y.| i < : y } ~ $.@.f.s.a.r.r.e.w.q.0.0.4.4.1.,.,.P P I Y Y U U U U S R o O 6 & 2 * * 5 O o D U L H J ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ] 1XgX4X8.>.>.>.<.<.1.4.4.4.5.q.w.y.g.b.N.M.S.H.J.K.*XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX7X7._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) k.uX8Xu.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.>.>.>.<.<.<.1.1.4.0.0.0.q.q.q.w.w.t.t.a.#.@.( .y 8 & : - * p y { T.T.-.R.T.Y.X.a * p X.U.E.R.R.R.T.T.| u < < u } ~ $.@.f.s.a.r.e.w.q.q.q.4.4.1.,.,.P Y Y Y F F S U U S D R @ O 6 & - 2 * 5 O o W U L K J ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 7.4XaXF.:.>.>.>.<.1.1.4.4.5.q.w.y.g.b.n.m.S.H.G.J. XrXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsXF._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ` oXsX{.>.:.:.:.:.:.:.:.:.:.:.:.:.:.>.>.>.>.<.<.1.1.4.4.0.0.0.q.q.w.w.e.t.t.s.#.$.~ .e : & , : & 9 u { Y.T.T.T.T.| X.> * i o.U.E.R.R.R.R.T.| ..: < u .~ $.@.i.s.r.r.e.w.q.q.0.4.1.1.,.+.P Y Y S W Q Q W D D W E + O ; & : - * 6 O o W U I K J J ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ `.aX.>.>.<.1.1.4.4.4.q.w.r.y.g.b.N.M.S.H.J.K.#XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX1X6.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) u.yXuXk.:.:.:.:.:.:.:.:.:.:.:.:.:.>.>.>.<.<.1.1.4.4.0.0.0.q.q.w.w.e.e.t.a.s.@.$.~ .t < * 6 8 & : t [ | T.T.T.Y.| u < < i U.U.E.R.W.=.R.T.| [ > * r .~ $.@.#.s.t.w.w.q.q.0.4.4.1.,.,.P Y Y D ! # : 8 Q E R E E + w : & ; - & 6 O o W U I L H J ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) i.yXuXd.>.>.>.>.<.1.1.4.4.4.q.w.y.g.b.n.m.S.H.G.K. X9XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXx.:._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ `.aX2X8.:.:.:.:.:.:.:.:.:.:.:.>.>.>.<.<.<.1.1.4.0.0.0.0.q.q.w.w.e.r.r.a.s.@.$.~ .q * - q q * < t [ | Y.T.T.U.{ r * > X.U.E.R.R.;.=.=.T.} [ 9 * r .~ $.@.#.a.t.t.q.q.q.4.4.1.1.,.+.P Y S ! E q * < w o o E o + 0 - & ; : & 8 O o R F G L H J J J J J J J J J J J J J J J J J J J J J ) ) ) ) ) ) ) ) ) ) 3.$XgX].>.>.>.>.<.1.1.4.4.4.0.w.r.g.b.b.N.M.S.G.J.K.@XsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX.>.<.<.<.<.1.4.4.0.0.0.q.q.w.w.e.r.r.r.s.#.@.( ~ y 8 & > q q - * p [ { | Y.Y.| o.p * a X.U.E.R.W.C.z.=.T.} { a & p .~ ( @.#.s.t.w.q.q.4.4.4.1.,.,.P Y Y W E @ 8 & * 7 + @ @ + O 0 - * % ; & ; O @ R S U L L K H H H H H H H H H H H H H H H H H H J J J J J ) ) ) ) ) ) _ `.aX4X8.>.>.>.<.<.1.4.4.4.5.q.w.y.g.b.n.m.S.G.J.K. X9XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXx._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) d.rXuXl.:.:.:.:.:.:.:.:.:.>.>.<.<.<.<.1.1.4.0.0.0.0.q.w.w.e.e.r.r.a.s.#.$.~ .y : * a q q > & a u { | | | { X.9 * s o.U.E.R.C.C.C.=.-.} .p * 8 .~ ( @.#.u.t.w.q.q.4.4.4.,.,.P P Y S R o O - & & , O + + + O 3 - * 6 ; & : w + E D U U I L L L L L L L L L L L L L L L L L L L L K H H H J J ) ) ) ) d.rXaXx.:.>.>.>.<.1.1.4.4.4.q.w.y.g.b.n.N.M.H.G.J.K.@XsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX.>.<.<.<.1.1.4.4.0.0.0.q.q.w.w.e.r.r.r.s.s.@.$.~ .t < < q q t a * > u { { | { X.u 1 < i o.U.E.R.C.C.C.=.-.} .r * > .~ ( @.#.u.9.w.5.5.6.6.6.,.+.P Y Y W E @ 3 * & & - 4 O O O O 3 * 2 5 ; * - w + E R D F U U U U U G G G G G G G G G G G G G G I I L L L H H J J ) ) 8.2XgX}.,.>.>.>.<.1.1.4.4.4.0.w.t.y.g.b.N.M.S.H.J.K. X9XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXl.:._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 3.$XgX$X3.:.:.:.:.:.:.>.>.<.<.<.1.1.1.4.0.0.0.0.q.w.w.e.e.y.r.a.s.i.@.$.~ .q * : t t t q < < t ..{ { X.X.i < 1 ..U.U.R.=.C.C.z.=.-.} .t * > [ ^ ( / #.8.9.9.5.6.6.6.+.P P Y Y F W E + 6 & - 2 * 5 w O O O 5 * - 5 % * - 4 O + E R T D S S S S F S F F F F F F F F F U U U U U U G L L K H J ) ' }.gX4Xu.>.>.>.<.<.1.4.4.4.5.q.w.y.g.b.n.m.S.H.G.J.I.#XsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX1X7.:.) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) i.8XsX].,.:.:.:.:.>.>.>.<.<.<.1.1.4.0.0.0.q.q.q.w.e.e.r.r.r.a.s.#.&.$.~ .a & 8 t t t t > * p u ..X.....p * a X.U.E.R.=.C.C.V.*.-.~ } u < < y ^ ( / #.O.9.9.9.O.O.Y Y Y Y Y Y D R @ O , & ; - & ; 4 w O 0 6 & - 5 6 * - 3 O O + o E R R R W W W W W W W W W W W W W W D D D S S U U I L K H J `.aXtXk.>.>.>.<.<.1.1.4.4.4.q.w.r.g.b.n.N.M.S.G.J.K.+X9XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXF.:._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) F.aXuXF.:.:.:.:.>.>.<.<.<.1.1.4.4.0.0.0.q.q.q.w.e.e.y.r.a.s.s.@.&.( } [ > * q t t t t a * a u u u u u a * p X.U.T.R.z.C.V.V.*.-.~ } y - < y ^ ^ ( #.#.O.O.O.O.Y Y Y Y Y F S W E @ w - * 6 ; & - 4 0 0 0 ; & : 5 6 2 * 5 4 w O + @ o E E E E E E E E E E E E E E E E E R R W D S U G I L H k.rXaX].>.>.>.>.<.1.1.4.4.4.q.w.t.y.g.b.N.m.S.H.J.K.I.#XsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX7Xu.:._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ' {.gXyXd.:.:.>.>.>.<.<.<.1.1.4.0.0.0.0.q.w.w.e.e.y.y.r.a.s.f.@.$.~ .u < < t u u u u p * > i u u u i 1 * r o.U.E.=.C.C.V.V.*.&.%.~ [ : * t ^ ^ ( #.#.O.O.Y Y / ! ! ! W W W R E + 7 * - 5 6 * - 3 4 4 4 ; & ; 5 5 2 * 5 3 6 6 6 7 7 7 7 7 q q q q 0 0 0 0 0 e e e e e e e e e Q ! U G L #.5XsX%X3.>.>.>.<.1.1.4.4.4.q.w.w.y.g.b.n.m.S.H.G.J.K.+XrXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX].>.:._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 7..>.>.<.<.<.1.1.4.4.0.0.0.q.w.w.w.e.r.y.y.a.a.s.f.&.$.~ .r * > u y y y u t < < r i i i r < < i o.Y.T.=.V.V.V.V.k.&.%.~ .> * q ^ ^ ( / #.O.Y / / ! Q t e E R E E @ O 6 & : 3 5 - * 6 4 4 4 - & ; 5 5 - * 6 ; * & * * * * * * * * * * * * * * * * * * * * < < < < - t F G Y 6XjX4Xu.>.>.>.<.<.1.4.4.4.5.q.w.y.g.b.n.N.M.S.G.J.K. X&XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXrXd.:.:._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) u.7XgX.>.<.<.1.1.1.4.4.0.0.q.q.w.w.e.e.y.y.y.a.a.s.#.&.$.} .8 * p y [ [ [ ..u > * a r r r p * > ..| E.R.=.V.V.c.c.k.&.$.~ .8 * q ^ ^ ( / / Y / / ! E q * 8 # @ o @ + O : & % 4 3 : & ; 4 4 3 - & % 5 5 - * ; - & : ; , 8 8 8 , , , , , , , , , : : : : : : : : : : > e F Y |.jXqXk.>.>.>.<.<.1.1.4.4.4.q.w.r.g.g.b.N.m.S.G.J.J.I.@XiXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX%X6.:.:._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) k.rXgX%X9.<.<.<.1.1.4.0.0.0.0.q.w.w.e.e.r.y.y.g.g.a.f.@.$.( } [ : * r [ { { { { u a & 9 r r r a * a X.| T.=.z.V.V.c.c.f.&.$.~ .p & a ^ ^ ! / / / / ! E # , & - 0 + + + O w - 2 5 4 4 6 & - 3 4 5 - * 6 5 5 - & - * - 3 w O + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ Q Q E D F [.kXtXF.>.>.>.<.<.1.1.4.4.4.0.w.w.y.g.b.n.m.S.H.G.J.I.+X0XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXF.:.:.:._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ F.aXsXoX5.<.1.1.4.4.0.q.0.q.q.w.w.e.e.y.y.y.g.a.s.f.@.$.~ } u < : u { { | | { ..r * - r r r > * p ..| T.=.z.V.c.c.f.f.&.$.~ ^ q * 8 .^ ! / / / ! ! Q e - & * 6 O O O O 7 * - 4 4 4 5 * * 5 3 5 2 2 5 5 5 : & & & ; 0 O + @ E E E E E E E E E E E E E E E E E E R W D S F [.kXkX].,.>.>.>.<.1.1.4.4.4.q.q.w.y.g.b.n.m.M.S.G.J.I. X#XsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX8Xu.:.:.:._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ` ].aXsX].5.1.1.4.4.0.0.q.q.w.w.e.e.y.y.y.g.g.a.s.f.&.%.~ .r * 9 [ { | Y.| | X.i < * p r p < < r { Y.T.=.V.V.m.c.f.f.@.$.~ ^ t * > y ^ ! / / / ! Q # 6 * & & : 4 4 w 0 ; & ; 0 0 0 4 - * % 3 6 * - 5 3 3 ; & & - 3 O + o E R R W W W W W W W W W W W W W W W D D D S U R.qXkX{.3.>.>.>.2.1.1.4.4.4.5.q.w.y.g.b.b.N.M.S.H.J.K.I.@XrXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXoX,.:.:._ _ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ' {.sXaX].5.4.0.0.0.0.q.q.w.w.e.r.y.y.g.g.a.a.f.@.&.%.} [ 9 * p [ | Y.T.Y.U.X.u > * a p a * - i { Y.T.=.V.V.c.B.h.f.@.$.~ ^ t < - e ^ ^ ! ! ! E @ w : & : * 2 5 4 4 4 - * 7 O O w 4 ; & : 5 % & - 3 4 4 % & & 8 O + o E W D S S F U U F S S S U U U U S F F U U U U R.qXjXOX7.' ,.<.<.1.1.4.4.4.5.q.w.r.g.g.b.N.m.S.H.G.J.I.+X3XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXF.>.:.:._ _ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ] }.gXaX].q.4.0.0.q.q.w.w.e.e.r.r.y.g.g.a.s.f.*.$.~ } y : < i { | T.T.T.U.{ u a & > p > & > u { Y.-.*.V.c.N.n.h.f.#.$.~ ^ y < < e Q ^ ! ! ! E # 0 < * 6 - & % 3 4 5 * - 4 O O O w 5 * - 5 ; & : 4 4 4 6 & - w + E R D S U U U U U U U U U U U G U U U U U U G G XXqXjX$X8.' ,.<.<.2.1.4.4.4.4.0.w.r.y.g.b.n.m.S.H.G.J.K. X#XsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX7Xu.:.:.:._ _ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 3.oXgXaX].w.0.0.q.q.w.e.e.r.r.r.a.a.a.s.f.f.&.%.} .t < > u | Y.T.T.E.E.| ..p * < a : & a u { T.-.k.c.c.n.b.h.s.#.$.( ^ y - < e Q Q ! ! E Q # 6 * - 5 ; & - 5 3 % & : w O O O O 4 - * % : & ; 4 0 O 0 : 7 @ E R D U U I L L L L L L L L L L L L L L L L L P XXqXjX6Xu.' >.<.<.,.1.4.4.4.4.0.w.t.y.g.b.n.m.M.S.G.J.K. X@XrXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX%X6.>.:.:.:._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 7.%XgXaXoXt.q.q.w.e.e.r.r.r.a.a.a.s.f.f.*.$.%.} [ p * a { | T.T.R.R.E.U.X.r < * a < * p u | T.=.k.c.B.b.v.a.s.#.@.( ^ .> * t Q Q Q Q E @ w : * % 5 % * 2 6 5 : & 6 O + + + O 0 - & ; : & ; 4 O + @ @ E R D S U G L L H H H H H H H H H H H H H H H H P [.tXsX6Xu.>.>.<.<.1.1.1.4.4.4.q.w.w.y.g.b.n.N.M.S.H.J.K.I.+X0XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaX`.>.>.:.:.:._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 7.oXsXsX%Xa.w.w.e.e.r.r.a.s.s.s.f.@.*.&.%.} .[ > * r { | T.R.R.R.E.U.X.i > * > * < r ..| T.=.k.c.n.b.a.a.s.#.@.( ^ Q 8 * q # Q Q Q Q # 0 < - 5 3 5 - * % 5 - * 7 O + @ @ + O 8 & - - * 6 w O @ E R D S U U I L K H J J J J J J J J J J J J J J J P ].iXsX6Xu.>.>.>.<.<.1.1.4.4.4.q.q.w.y.g.b.b.N.M.S.H.J.J.I. X*XsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXyXj.>.>.:.:.:._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 3.}.sXgX&Xh.w.e.r.r.a.s.s.s.f.@.&.$.%.~ } [ u - < i { Y.T.R.R.R.R.U.o.i a & * & > t [ } %.*.f.B.b.b.g.a.s.#.#.( ^ Q p * 8 # @ Q Q @ # 6 & : 4 4 3 ; & - % * - 0 + @ o o + O 5 * * * * 5 O + E R D U U G L L K J J ) ) ) ) ) ) ) ) ) ) ) ) ) ) 3.}.aXgX$Xu.>.>.>.<.<.1.1.4.4.4.q.q.w.y.g.b.b.N.m.S.H.G.J.K. X@XuXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX1X9.>.>.:.:.:._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ] ].aXgX2Xm.r.r.r.a.s.f.#.@.&.$.%.~ } [ [ r * > ..| T.R.R.XXXXR.E.U...p * & & 9 u { Y.-.*.f.B.b.b.a.a.s.#.#./ ^ ^ q * 8 # # # # # w : * 6 0 4 4 6 * 2 : & , w + o E E o + 4 - & & * 3 O o R D U U I L L H J J ) ) ) ) ) ) ) ) ) ) ) ) ) ) u.$XsXsXoX9.>.>.>.<.<.1.1.4.4.4.5.q.w.y.g.g.b.N.m.S.H.G.J.K. X@X9XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX#X6.>.>.:.:.:._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ' `.uXgX8XD.r.a.s.s.#.@.&.$.~ } } [ [ y a & a { | T.R.XX[.[.W.E.U.X.i < & * p y | T.-.k.f.B.b.g.g.a.t.#.#./ ^ Q q * : e # # # # 0 * - 0 w w 4 3 - & * & 6 O @ E R R E + O , & & - 0 + E W U U L L K H J J ) ) ) ) ) ) ) ) ) ) ) ) ) ) i.2XgXaX{.3.>.>.>.<.<.1.4.4.4.4.5.q.w.y.g.g.b.N.m.S.S.G.J.I. X+X3XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaX`.<.>.>.:.:.:._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ l.yXgXuX].a.s.f.@.&.%.} } [ [ u u t > * r { Y.E.R.XXP.[.[.W.E.o...> & < t { } %.*.f.f.h.b.g.a.r.t.u.#./ ^ Q e * : e # # # O 8 * , O O O O 0 ; & & * 3 + E R D W R o + 6 * & - w @ E D U I L H J J J ) ) ) ) ) ) ) ) ) ) ) ) ) _ l.8XgXuX`.6.>.>.>.<.<.1.4.4.4.4.5.q.w.y.g.g.b.n.m.M.S.G.J.I.I.+X*XsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXtXx.>.>.>.:.:.:._ _ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) d.4XgXaXoXf.f.@.%.p > > > : : - < & < u | T.R.XXP.P.`.[.W.E.U.| p & > ..} T.-.*.f.h.v.g.g.r.r.t.O.#./ ! Q e - - e w O O w : * 7 + + + O O 7 * & : O @ E D D D W E @ 0 - & , + o R S U L H J J ) ) ) ) ) ) ) ) ) ) ) ) ) ) 3.].uXgX8XF.<.>.>.>.<.<.1.4.4.4.4.5.q.w.r.g.g.b.n.m.M.S.G.J.K.I.+X#XaXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX7Xf.>.>.>.:.:.:.:._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) u.$XsXsX1XC.&.%.9 < < < < < < < < a { Y.E.R.[.P.P.'.`.XXR.T.Y...> p | Y.%.*.k.f.h.v.g.y.r.t.t.9.#./ ! Q e - < 0 w w w 7 * - w + @ o @ + O - & 8 @ E W S U U D R E # : & 8 @ E D U I L H J ) ) ) ) ) ) ) ) ) ) ) ) ) ) u.$XsXgX1Xd.>.>.>.>.<.1.1.4.4.4.4.5.q.w.r.g.g.b.n.m.M.S.G.J.K.I. X@XpXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX1Xu.>.>.>.:.:.:.:._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 3.].tXjXqX[.&.} ..u u u u u u ..{ Y.T.R.W.P.P.L.'.'.[.W.R.E.T.| Y.T.%.*.*.f.f.a.g.a.y.r.w.t.9.#./ ! Q e : * q w w w ; & 8 + o E E E E o 7 - e E W D U U U U D R E 6 * 7 E W S U L K J J ) ) ) ) ) ) ) ) ) ) ) ) ` l.7XgXaXoX9.>.>.>.2.<.1.1.4.4.4.4.q.q.w.y.g.g.b.n.m.M.S.H.J.J.I. X@X9XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX$X9.>.>.>.>.:.:.:._ _ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) K l.5XjXwXOXR.%.} } } | | | | T.T.R.W.[.P.L.K.K.P.P.C.=.=.R.-.-.-.*.*.f.f.h.a.g.y.y.e.w.w.9.O./ ! Q # > * 6 0 0 3 - * 0 @ E R W W W R E # E W S U G I I U U D W Q q Q T S U I L H J ) ) ) ) ) ) ) ) ) ) ) ) u.}.aXgXrX`.6.>.>.>.<.<.1.1.4.4.4.4.q.q.w.y.g.g.b.n.m.M.S.H.J.J.K. X+X0XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX#X5.<.<.>.>.:.:.:.:._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) J J #.OXkXwX5XW.%.%.T.Y.T.T.T.T.R.W.[.P.P.K.K.K.L.P.P.C.C.=.=.=.*.k.f.f.h.a.a.g.y.r.w.w.w.9.O./ ! Q # 8 * 6 0 4 6 * - O o E W D S S S D D S F U G L L L I U U S D D D S U G L H J J ) ) ) ) ) ) ) ) ) ) ' l.4XgXgX.>.>.>.<.<.1.1.4.4.4.4.q.q.w.y.g.g.b.n.m.M.S.H.J.J.K. X+X3XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsX].4.<.>.>.>.:.:.:.:._ _ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) J J J P XX5XwXwX-XR.-.-.-.=.=.=.C.C.P.P.K.K.K.K.L.L.A.A.C.V.k.k.k.f.f.h.a.a.g.y.y.e.w.w.q.9.O./ ! Q # 6 * ; 3 3 , & 8 + E R D U U U U U U U U G L L K K L L G U U U U U G L L H J ) ) ) ) ) ) ) ) ) ) u.oXaXgXtX].9.>.>.>.>.<.<.1.1.4.4.4.4.0.w.w.y.g.g.b.n.m.M.S.H.J.J.K. X+X&XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaX].4.<.>.>.>.>.:.:.:.:._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) J H K #.|.kXkXqX|.=.=.z.C.C.C.P.L.K.K.K.K.L.J.J.G.A.V.V.V.V.c.c.B.h.a.g.y.y.r.w.w.q.5.6.O.Y ! E # 7 & - 5 5 - * 3 + E T F U G I I I I I L L K H H H H L L I I I I L L L H J J ) ) ) ) ) ) ) ) 7.`.8XgXsX.>.>.>.<.<.1.1.1.4.4.4.5.q.w.w.y.g.b.b.n.m.M.S.H.J.J.I. X+X&XsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaX].4.<.>.>.>.>.:.:.:.:.:._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) J J J H P z.5XjXjX5X].C.C.P.P.L.K.K.K.K.K.J.J.G.H.H.D.D.m.c.B.B.h.v.v.g.y.r.e.w.q.q.5.6.O.Y ! E # 7 * - 5 % * - w @ E D U I L L L L L L K H H J J J J H K L L L L L K H J J ) ) ) ) ) ) ) ' k.1XsXgXyX`.7.>.>.>.>.<.<.1.1.4.4.4.4.5.q.w.w.y.g.b.b.n.m.M.S.H.J.J.K. X+X&XsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaX'.4.<.<.>.>.>.>.:.:.:.:._ _ ) ) ) ) ) ) ) ) ) ) ) ) ) ) J J J H O.].qXjXjX4X].L.L.K.K.K.K.K.K.J.J.G.H.S.M.m.N.N.n.b.b.v.g.y.y.e.w.w.q.q.5.6.O.Y ! E @ 0 * - 5 : & 8 O o R S U L K H H H H J J J J J ) J J J J H H H H H J J J ) ) ) ) ) ) ` d.$XaXgXuXoXi.>.>.>.>.<.<.1.1.1.4.4.4.4.q.q.w.r.y.g.b.b.N.m.M.S.H.J.J.K. X+X*XsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuX'.4.<.<.>.>.>.>.:.:.:.:.:._ _ ) ) ) ) ) ) ) ) ) ) ) ) ) ) J J J K p.OXuXgXaX2X=XK.K.I.K.K.J.J.G.H.S.M.M.m.N.n.b.b.v.g.y.y.r.e.w.q.0.4.4.6.O.Y ! E @ 0 - * % 2 * 7 + E W U I L H J J J J J J ) ) ) ) ) ) ) J J J J J J J ) ) ) ) ) ) ` d.%XuXgXaX.>.>.>.<.<.1.1.1.4.4.4.4.0.q.w.r.y.g.b.b.N.m.S.S.H.J.J.K. X+X*XsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaX].4.<.<.<.>.>.>.>.:.:.:.:.:._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ' k.$XaXgXsX0X@X XK.J.J.G.G.H.S.M.m.N.n.b.b.b.v.g.y.y.e.w.w.q.0.4.4.6.+.Y / ! @ w - * : * - w + E D U L K J J ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ] k.%XuXgXaX1XF.6.>.>.>.>.<.<.<.1.4.4.4.4.4.5.q.w.w.y.g.g.b.n.N.m.S.S.G.J.J.I. X+X&XsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaX].5.1.<.<.>.>.>.>.>.:.:.:.:.:._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ] k.6XuXgXsX9X@XK.J.G.H.S.M.m.m.n.b.b.b.v.g.y.y.e.w.w.q.q.4.4.4.6.+.Y S ! @ w : & * & 8 O @ R S U L H J ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ 7.l.6XaXgXaX1XF.3.>.>.>.>.>.<.<.1.1.1.4.4.4.4.q.q.w.w.y.g.g.b.n.m.M.S.H.G.J.K.I. X+X&XsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaX{.9.1.1.<.<.>.>.>.>.>.:.:.:.:.:._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ] k.%XuXgXgXrX*XK.G.S.M.m.N.n.b.b.v.v.y.y.r.e.w.q.0.0.4.1.1.,.P Y F ! Q O , & & * 3 + E W U I L H J ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ' u.].4XaXgXuX.>.>.>.>.>.<.1.1.1.4.4.4.4.4.0.q.w.r.y.g.b.b.n.m.M.S.H.G.J.I.I.+X+X&XsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsX%Xt.1.1.<.<.>.>.>.>.>.:.:.:.:.:.:._ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ' i.{.8XgXgXiX0X@XG.m.n.n.b.b.v.g.y.y.e.w.q.q.q.4.4.1.1.,.P Y Y W E + 8 & & : w + E D U L K J ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ 8.l.$XtXgXgXrX%Xk.6.:.>.>.>.>.>.<.<.1.1.1.4.4.4.4.5.q.w.w.y.g.g.b.n.N.m.M.S.H.G.J.K.I. X@X0XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX6Xs.1.1.1.<.<.>.>.>.>.>.:.:.:.:.:.:._ _ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ u.`..>.>.>.>.>.<.<.1.1.1.4.4.4.4.4.0.w.w.r.y.g.g.b.n.N.m.S.S.H.J.J.K. X+X@X9XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX4Xj.4.1.1.1.<.<.>.>.>.>.>.:.:.:.:.:.:._ _ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ] i.].4XaXgXsXpX3X].D.b.y.e.w.w.0.0.4.4.1.<.>.>.P P Y S W E q * - w o R D U I L J J ) ) ) ) ) ) ) ) ) ) _ 3.i.F.%XyXaXgXaX7X}.k.3.>.:.>.>.>.>.>.<.<.1.1.1.4.4.4.4.4.q.q.w.w.y.y.g.b.b.n.m.M.S.H.G.J.J.K. X+X@X8XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXyXF.4.4.1.1.1.<.<.>.>.>.>.>.>.:.:.:.:.:.:._ _ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ 3.k.].2XuXgXgXaX8X%X'.D.a.w.4.4.1.<.>.>.>.` P I U D R e : 8 @ R D U G L H J ) ) ) ) ) ) ) ` 7.i.l.oX4XuXgXgXaX4X}.k.9.>.:.>.>.>.>.>.>.<.<.<.1.1.4.4.4.4.4.5.0.q.w.r.y.g.g.b.n.N.m.M.S.H.G.J.K.I. X+X#XpXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuX].w.4.1.1.1.1.<.<.>.>.>.>.>.>.:.:.:.:.:.:.:._ _ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 3.i.`.$XyXaXgXgXaXyX.:.:.>.>.>.>.>.>.<.<.<.1.1.1.4.4.4.4.4.0.q.w.w.y.y.g.b.b.n.N.M.S.S.H.G.J.K.I. X+X&XaXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsX%Xs.4.4.4.1.1.1.<.<.>.>.>.>.>.>.:.:.:.:.:.:.:._ _ _ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ` 8.d.`.%X4XuXaXgXgXaXuX8X1X$XoX].XX=.&.$.( ( ( ( $.&.*.z.XX].}.$X1X7XtXaXsXgXsXuX7X$X].k.u.,.:.:.:.:.>.>.>.>.>.>.<.<.1.1.1.4.4.4.4.4.4.q.q.w.w.r.y.g.g.b.n.N.m.M.S.H.G.J.J.I. X+X@X0XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX4XD.5.4.4.1.1.1.1.<.<.<.>.>.>.>.>.>.:.:.:.:.:.:.:._ _ _ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ` 3.u.k.`.oX.>.>.>.>.>.>.<.<.1.1.1.1.4.4.4.4.4.5.q.w.w.r.y.g.g.b.b.n.N.M.S.S.H.G.J.K.I. X+X#XrXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuX].t.4.4.4.4.1.1.1.<.<.<.>.>.>.>.>.>.>.:.:.:.:.:.:.:.:._ _ _ _ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ ' 7.u.i.k.l.`.].{.|.|.|.|.OXOXOXOXOX}.].`.F.k.p.u.7.6.>.:.:.:.:.:.:.:.>.>.>.>.>.>.<.<.<.<.1.1.1.1.4.4.4.4.4.5.0.q.w.w.y.y.g.b.b.n.N.m.M.S.H.G.J.J.K.I.+X+X&XaXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsX6Xj.4.4.4.4.4.1.1.1.1.<.<.<.>.>.>.>.>.>.>.>.>.:.:.:.:.:.:.:.:._ _ _ _ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) J K P P P P P P P P P ` _ _ _ :.:.:.:.:.:.:.:.:.:.>.>.>.>.>.>.>.>.<.<.1.1.1.1.4.4.4.4.4.4.5.0.q.w.w.r.y.g.g.b.b.N.m.M.S.S.H.G.J.J.K. X+X@X9XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXyX'.t.4.4.4.4.4.1.1.1.1.<.<.<.>.>.>.>.>.>.>.>.>.:.:.:.:.:.:.:.:.:.:.:.:.:._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ) ) ) _ _ K K K K K K _ _ _ :.:.:.:.:.:.:.:.:.>.>.>.>.>.>.>.>.>.<.<.<.1.1.1.1.4.4.4.4.4.4.5.0.q.w.w.y.y.g.g.b.b.n.N.m.M.S.H.G.J.J.K.I. X+X*XuXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsX&Xj.5.5.4.4.4.4.4.1.1.1.1.<.<.<.<.>.>.>.>.>.>.>.>.>.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:._ _ _ _ _ _ _ _ _ _ _ :.:.:.:.:.:.>.>.>.>.>.>.>.>.>.>.<.<.<.1.1.1.1.4.4.4.4.4.4.4.q.q.q.w.w.y.y.g.g.b.b.n.N.m.M.S.H.H.G.J.K.K. X+X@X0XsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXrX].a.0.5.4.4.4.4.4.4.1.1.1.1.<.<.<.<.>.>.>.>.>.>.>.>.>.>.>.>.>.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.<.<.<.1.1.1.1.4.4.4.4.4.4.4.4.4.q.q.w.w.w.y.y.g.g.b.b.n.N.m.M.S.S.H.G.J.J.K.I. X+X&XuXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX2XD.w.4.5.4.4.4.4.4.4.4.1.1.1.1.1.1.<.<.<.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.:.:.:.:.:.:.:.:.:.:.:.:.:.:.>.:.:.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.<.<.<.<.1.1.1.1.4.4.4.4.4.4.4.4.4.5.0.q.w.w.t.y.y.g.g.b.b.n.N.m.M.S.S.H.G.J.J.K.I. X+X#X9XgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaX%Xj.q.q.5.4.4.4.4.4.4.4.4.1.1.1.1.1.1.<.<.<.<.<.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.<.<.<.<.<.1.1.1.1.1.1.4.4.4.4.4.4.4.4.5.q.q.w.w.w.r.y.y.g.g.b.b.n.N.m.M.S.S.H.G.J.J.K.I. X X@X0XsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXrXoXh.w.q.q.5.4.4.4.4.4.4.4.4.4.1.1.1.1.1.1.<.<.<.<.<.<.<.<.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.<.>.<.<.<.<.<.<.<.1.1.1.1.1.1.1.4.4.4.4.4.4.4.4.4.4.q.q.q.w.w.w.r.y.g.g.g.b.b.n.N.m.M.S.S.H.H.G.J.J.K.I. X@X&XiXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsX zXzXzXzX", +"zXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX8X].h.w.q.q.q.5.4.4.4.4.4.4.4.4.4.4.4.1.1.1.1.1.1.1.1.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.1.1.1.1.1.1.1.1.1.1.4.4.4.4.4.4.4.4.4.4.4.5.q.q.q.w.w.w.r.y.y.g.g.b.b.b.n.N.m.M.S.S.H.H.G.J.J.K.I. X+X*XpXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXkX zXzXzXzX", +"zXzXsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX8X'.h.w.w.q.q.0.q.4.4.4.4.4.4.4.4.4.4.4.4.4.4.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.4.4.4.4.4.4.4.4.4.4.4.4.4.5.0.q.q.w.w.w.r.y.y.g.g.g.b.b.n.N.N.m.M.S.S.H.H.G.J.J.K.I. X+X*XrXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXqX zXzXzXzX", +"zXzXjXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX8X].n.e.w.w.w.q.q.0.5.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.1.1.1.1.1.4.1.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.5.5.q.0.q.q.w.w.w.w.r.y.y.g.g.g.b.b.b.n.N.m.m.M.S.H.H.G.G.J.K.K.I. X+X*XrXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX-X zXzXzXzX", +"zXzXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXrX#XD.y.r.w.w.w.w.q.q.0.0.5.5.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.5.q.0.0.q.q.w.w.w.t.r.y.y.y.g.g.g.b.b.b.n.N.N.m.M.S.S.H.H.G.J.J.J.I.I. X@X&XpXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXQ.zXzXzXzXzX", +"zXzXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuX&XJ.h.y.y.r.w.w.w.w.w.w.q.q.0.0.0.0.5.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.5.5.q.0.0.0.q.q.q.w.w.w.w.w.r.y.y.g.g.g.g.b.b.b.b.n.N.N.m.M.M.S.S.H.H.G.J.J.K.I. X+X@X3XiXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXjX$ zXzXzXzXzX", +"zXzXzXjXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaX4X].D.g.y.y.y.y.r.e.e.w.w.w.w.w.w.q.q.q.q.0.0.0.0.0.0.0.0.5.5.0.0.0.0.0.0.0.q.q.q.q.q.w.w.w.w.w.w.w.r.y.y.y.y.g.g.g.g.b.b.b.n.n.N.N.m.M.M.S.S.H.H.G.J.J.J.K.I. X+X*X9XsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX5XX zXzXzXzXzX", +"zXzXzXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuX&X'.N.g.g.g.g.y.y.y.y.y.r.w.t.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.w.r.y.y.y.y.y.g.g.g.g.g.v.b.b.b.b.n.N.N.N.m.M.M.S.S.H.H.G.J.J.J.K.K.I.+X@X0XiXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXQ. zXzXzXzXzX", +"zXzXzXzXsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXrX*XL.m.b.g.g.g.g.g.g.g.y.y.y.y.y.y.y.y.y.y.e.e.e.e.y.y.y.y.y.y.y.y.y.y.y.g.g.g.g.g.g.g.b.b.b.b.b.n.n.n.N.N.m.m.M.S.S.S.H.H.G.G.J.J.K.I.I. X@X3XrXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXqX$ zXzXzXzXzXzX", +"zXzXzXzXzXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsXrX&X'.D.n.b.b.b.b.g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.b.g.b.b.b.b.b.n.n.n.N.N.m.m.M.M.M.S.S.S.H.H.G.G.J.J.J.K.I.+X#X3XpXsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXQ.. zXzXzXzXzXzX", +"zXzXzXzXzXjXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXuX2X#XL.D.N.n.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.b.n.n.n.n.N.N.N.m.m.m.M.M.S.S.S.S.H.H.H.G.J.J.J.J.K. X@X&X9XiXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXqX$ zXzXzXzXzXzXzX", +"zXzXzXzXzXzXsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsXuX2X*X'.J.S.m.N.N.N.N.N.n.n.n.n.n.N.N.N.N.N.N.N.N.N.m.m.m.m.M.M.M.S.S.S.S.H.H.G.G.G.G.J.J.J.K.'.+X@X&X9XuXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsXU. zXzXzXzXzXzXzX", +"zXzXzXzXzXzXqXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXaXrX2X*X@XK.J.H.S.M.M.M.M.M.m.M.M.M.M.M.M.S.S.S.S.S.S.S.S.H.H.G.G.G.J.J.J.I. X+X#X&X0XrXaXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX-XX zXzXzXzXzXzXzXzX", +"zXzXzXzXzXzXzXqXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsXuXrX0X3X&X#X@X'.K.K.L.J.J.J.J.J.J.J.J.J.L.K.K. X.X+X@X#X&X2X9XrXiXsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX5X$ zXzXzXzXzXzXzXzX", +"zXzXzXzXzXzXzXzXqXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsXaXaXiXuXuXpXrXrXrXrXrXrXuXuXiXaXsXsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXqX$ zXzXzXzXzXzXzXzXzX", +"zXzXzXzXzXzXzXzXzXqXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXqX$ zXzXzXzXzXzXzXzXzXzX", +"zXzXzXzXzXzXzXzXzXzXqXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgX5X$ zXzXzXzXzXzXzXzXzXzXzX", +"zXzXzXzXzXzXzXzXzXzXzX-XsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXjX-X$ zXzXzXzXzXzXzXzXzXzXzXzX", +"zXzXzXzXzXzXzXzXzXzXzXzX|.qXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXqXU.X zXzXzXzXzXzXzXzXzXzXzXzXzX", +"zXzXzXzXzXzXzXzXzXzXzXzXzXzX-XqXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsXqXQ.$ zXzXzXzXzXzXzXzXzXzXzXzXzXzXzX", +"zXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzX|.qXjXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXjX5XQ.$ . zXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzX", +"zXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzX$ Q.-XqXkXsXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXgXsXqX5X-XQ.$ X zXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzX", +"zXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzX zXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzX", +"zXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzX", +"zXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzX", +"zXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzX", +"zXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzXzX" +}; diff --git a/gui/resources/powermon_icon_512x512.png b/gui/resources/powermon_icon_512x512.png new file mode 100644 index 0000000..b150b62 --- /dev/null +++ b/gui/resources/powermon_icon_512x512.png Binary files differ diff --git a/gui/scope_display.cpp b/gui/scope_display.cpp new file mode 100644 index 0000000..ac273b1 --- /dev/null +++ b/gui/scope_display.cpp @@ -0,0 +1,1212 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include + +#include + +#include + +#include +#include + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define SCOPE_CONTROL_BORDER_SIZE FromDIP(10) + +#define SCOPE_TOP_PANEL_HEIGHT FromDIP(50) +#define SCOPE_BOTTOM_PANEL_HEIGHT FromDIP(50) +#define SCOPE_LEFT_PANEL_WIDTH FromDIP(50) + + +#define SCOPE_LEFT_BORDER_SIZE FromDIP(20) +#define SCOPE_RIGHT_BORDER_SIZE FromDIP(20) +#define SCOPE_TOP_BORDER_SIZE FromDIP(25) +#define SCOPE_BOTTOM_BORDER_SIZE FromDIP(25) + +#define SCOPE_VERTICAL_SCALE_WIDTH FromDIP(50) + +#define GRID_SPACING FromDIP(60) +#define ARROW_BASE FromDIP(10) +#define ARROW_HEIGHT FromDIP(16) + + +//#define SCOPE_INTEGER_WAVEFORM_HEIGHT 20 +//#define SCOPE_INTEGER_WAVEFORM_PITCH 50 + + +BEGIN_EVENT_TABLE(ScopeDisplay, wxWindow) + +EVT_KEY_DOWN(ScopeDisplay::OnKeyPressed) +EVT_KEY_UP(ScopeDisplay::OnKeyReleased) + +END_EVENT_TABLE() + + +ScopeDisplay::ScopeDisplay(wxFrame* parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style): wxWindow(parent, id, pos, size, style | wxFULL_REPAINT_ON_RESIZE), + mListener(nullptr), mWaveRefresh(true) +{ + mWaveColors.push_back(WaveColor(wxColour(255, 0, 0))); + mWaveColors.push_back(WaveColor(wxColour(255, 128, 0))); + mWaveColors.push_back(WaveColor(wxColour(0, 192, 0))); + mWaveColors.push_back(WaveColor(wxColour(0, 0, 255))); + mWaveColors.push_back(WaveColor(wxColour(0, 192, 192))); + mWaveColors.push_back(WaveColor(wxColour(192, 192, 0))); + + mCursorsEnable = false; + mCursor1Dragging = false; + mCursor2Dragging = false; + + SetBackgroundStyle(wxBG_STYLE_CUSTOM); + + mGridColor = wxColour(192, 192, 192); + mScalesColor = wxColour(16, 128, 64); + mCursor1Color = wxColour(0, 0, 255); + mCursor2Color = wxColour(255, 0, 255); + + + //default time scales + mTimeScalesIndex = 0; + mTimeScales.push_back(1); //1us / div + mTimeResolution = mTimeScales[mTimeScalesIndex]; + + mMaxTime = 0; + mTimePosition = 0; + + //default vertical scale + mVerticalScale = 1; + mVerticalScaleExponent = 0; + mVertPosition = 0; + + + mFontBig = wxFont(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_ITALIC, wxFONTWEIGHT_BOLD); + mFontMed = wxFont(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_ITALIC, wxFONTWEIGHT_BOLD); + mFontSmall = wxFont(8, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_ITALIC, wxFONTWEIGHT_BOLD); + + mScalesFont = wxFont(6, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); + + + //create panels + wxBoxSizer *main_sizer = new wxBoxSizer(wxVERTICAL); + SetSizer(main_sizer); + + mTopPanel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize/*(0, SCOPE_TOP_PANEL_HEIGHT)*/, wxFULL_REPAINT_ON_RESIZE); + main_sizer->Add(mTopPanel, 0, wxEXPAND); + + wxBoxSizer *sizer = new wxBoxSizer(wxHORIZONTAL); + main_sizer->Add(sizer, 1, wxEXPAND); + + mLeftPanel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize/*(SCOPE_LEFT_PANEL_WIDTH, 0)*/, wxFULL_REPAINT_ON_RESIZE); + sizer->Add(mLeftPanel, 0, wxEXPAND); + + mScopePanel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize); + mScopePanel->SetBackgroundStyle(wxBG_STYLE_PAINT); + sizer->Add(mScopePanel, 1, wxEXPAND); + + mBottomPanel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize/*(0, SCOPE_BOTTOM_PANEL_HEIGHT)*/, wxFULL_REPAINT_ON_RESIZE); + main_sizer->Add(mBottomPanel, 0, wxEXPAND); + + //create buttons + mTimeScaleUpButton = new wxBitmapButton(mBottomPanel, ID_BUTTON_TIME_SCALE_UP, wxBITMAP_PNG_FROM_DATA(img_plus), wxDefaultPosition, FromDIP(wxSize(60, 30))); + mTimeScaleDownButton = new wxBitmapButton(mBottomPanel, ID_BUTTON_TIME_SCALE_DOWN, wxBITMAP_PNG_FROM_DATA(img_minus), wxDefaultPosition, FromDIP(wxSize(60, 30))); + mTimePosUpButton = new wxBitmapButton(mBottomPanel, ID_BUTTON_TIME_POS_UP, wxBITMAP_PNG_FROM_DATA(img_arrow_right), wxDefaultPosition, FromDIP(wxSize(60, 30))); + mTimePosDownButton = new wxBitmapButton(mBottomPanel, ID_BUTTON_TIME_POS_DOWN, wxBITMAP_PNG_FROM_DATA(img_arrow_left), wxDefaultPosition, FromDIP(wxSize(60, 30))); + + mTimePosEndButton = new wxBitmapButton(mBottomPanel, ID_BUTTON_TIME_POS_END, wxBITMAP_PNG_FROM_DATA(img_arrow_right_double), wxDefaultPosition, FromDIP(wxSize(40, 30))); + mTimePosHomeButton = new wxBitmapButton(mBottomPanel, ID_BUTTON_TIME_POS_HOME, wxBITMAP_PNG_FROM_DATA(img_arrow_left_double), wxDefaultPosition, FromDIP(wxSize(40, 30))); + + mVertScaleUpButton = new wxBitmapButton(mLeftPanel, ID_BUTTON_VERT_SCALE_UP, wxBITMAP_PNG_FROM_DATA(img_plus), wxDefaultPosition, FromDIP(wxSize(30, 60))); + mVertScaleDownButton = new wxBitmapButton(mLeftPanel, ID_BUTTON_VERT_SCALE_DOWN, wxBITMAP_PNG_FROM_DATA(img_minus), wxDefaultPosition, FromDIP(wxSize(30, 60))); + mVertPosUpButton = new wxBitmapButton(mLeftPanel, ID_BUTTON_VERT_POS_UP, wxBITMAP_PNG_FROM_DATA(img_arrow_up), wxDefaultPosition, FromDIP(wxSize(30, 60))); + mVertPosDownButton = new wxBitmapButton(mLeftPanel, ID_BUTTON_VERT_POS_DOWN, wxBITMAP_PNG_FROM_DATA(img_arrow_down), wxDefaultPosition, FromDIP(wxSize(30, 60))); + mVertPosHomeButton = new wxBitmapButton(mLeftPanel, ID_BUTTON_VERT_POS_HOME, wxBITMAP_PNG_FROM_DATA(img_home), wxDefaultPosition, FromDIP(wxSize(30, 40))); + + mClearScopeButton = new wxButton(mBottomPanel, ID_BUTTON_CLEAR_SCOPE, wxT("Clear"), wxDefaultPosition, FromDIP(wxSize(60, 30))); + mSaveImageButton = new wxButton(mBottomPanel, ID_BUTTON_SAVE_IMAGE, wxT("Save Image"), wxDefaultPosition, FromDIP(wxSize(120, 30))); + mCursorsButton = new wxToggleButton(mBottomPanel, ID_BUTTON_CURSORS, wxT("Cursors"), wxDefaultPosition, FromDIP(wxSize(80, 30))); + + mSaveDataButton = new wxButton(mBottomPanel, ID_BUTTON_SAVE_DATA, wxT("Save Data"), wxDefaultPosition, FromDIP(wxSize(120, 30))); + mLoadDataButton = new wxButton(mBottomPanel, ID_BUTTON_LOAD_DATA, wxT("Load Data"), wxDefaultPosition, FromDIP(wxSize(120, 30))); + + + main_sizer = new wxBoxSizer(wxHORIZONTAL); + mBottomPanel->SetSizer(main_sizer); + + main_sizer->Add(mTimeScaleDownButton, 0, wxALL | wxALIGN_CENTER_VERTICAL, SCOPE_CONTROL_BORDER_SIZE); + main_sizer->Add(mTimeScaleUpButton, 0, wxALL | wxALIGN_CENTER_VERTICAL, SCOPE_CONTROL_BORDER_SIZE); + + main_sizer->AddSpacer(SCOPE_CONTROL_BORDER_SIZE * 4); + + main_sizer->Add(mTimePosHomeButton, 0, wxALL | wxALIGN_CENTER_VERTICAL, SCOPE_CONTROL_BORDER_SIZE); + main_sizer->Add(mTimePosDownButton, 0, wxALL | wxALIGN_CENTER_VERTICAL, SCOPE_CONTROL_BORDER_SIZE); + main_sizer->Add(mTimePosUpButton, 0, wxALL | wxALIGN_CENTER_VERTICAL, SCOPE_CONTROL_BORDER_SIZE); + main_sizer->Add(mTimePosEndButton, 0, wxALL | wxALIGN_CENTER_VERTICAL, SCOPE_CONTROL_BORDER_SIZE); + + main_sizer->AddStretchSpacer(1); + + main_sizer->Add(mCursorsButton, 0, wxALL | wxALIGN_CENTER_VERTICAL, SCOPE_CONTROL_BORDER_SIZE); + main_sizer->Add(mClearScopeButton, 0, wxALL | wxALIGN_CENTER_VERTICAL, SCOPE_CONTROL_BORDER_SIZE); + main_sizer->Add(mSaveImageButton, 0, wxALL | wxALIGN_CENTER_VERTICAL, SCOPE_CONTROL_BORDER_SIZE); + main_sizer->Add(mLoadDataButton, 0, wxALL | wxALIGN_CENTER_VERTICAL, SCOPE_CONTROL_BORDER_SIZE); + main_sizer->Add(mSaveDataButton, 0, wxALL | wxALIGN_CENTER_VERTICAL, SCOPE_CONTROL_BORDER_SIZE); + + main_sizer->SetSizeHints(mBottomPanel); + + + main_sizer = new wxBoxSizer(wxVERTICAL); + mLeftPanel->SetSizer(main_sizer); + + main_sizer->Add(mVertScaleUpButton, 0, wxALL | wxALIGN_CENTER_HORIZONTAL, SCOPE_CONTROL_BORDER_SIZE); + main_sizer->Add(mVertScaleDownButton, 0, wxALL | wxALIGN_CENTER_HORIZONTAL, SCOPE_CONTROL_BORDER_SIZE); + + main_sizer->AddSpacer(SCOPE_CONTROL_BORDER_SIZE * 4); + + main_sizer->Add(mVertPosUpButton, 0, wxALL | wxALIGN_CENTER_HORIZONTAL, SCOPE_CONTROL_BORDER_SIZE); + main_sizer->Add(mVertPosHomeButton, 0, wxALL | wxALIGN_CENTER_HORIZONTAL, SCOPE_CONTROL_BORDER_SIZE); + main_sizer->Add(mVertPosDownButton, 0, wxALL | wxALIGN_CENTER_HORIZONTAL, SCOPE_CONTROL_BORDER_SIZE); + + main_sizer->SetSizeHints(mLeftPanel); + + + mTopSizer = new wxBoxSizer(wxHORIZONTAL); + mTopPanel->SetSizer(mTopSizer); + mTopSizer->SetSizeHints(mTopPanel); + + GetSizer()->SetSizeHints(this); + + Centre(); + + Bind(wxEVT_COMMAND_BUTTON_CLICKED, &ScopeDisplay::OnButtonVertScaleUpClicked, this, ID_BUTTON_VERT_SCALE_UP); + + Bind(wxEVT_COMMAND_BUTTON_CLICKED, &ScopeDisplay::OnButtonVertScaleDownClicked, this, ID_BUTTON_VERT_SCALE_DOWN); + Bind(wxEVT_COMMAND_BUTTON_CLICKED, &ScopeDisplay::OnButtonTimeScaleUpClicked, this, ID_BUTTON_TIME_SCALE_UP); + Bind(wxEVT_COMMAND_BUTTON_CLICKED, &ScopeDisplay::OnButtonTimeScaleDownClicked, this, ID_BUTTON_TIME_SCALE_DOWN); + + Bind(wxEVT_COMMAND_BUTTON_CLICKED, &ScopeDisplay::OnButtonVertPosUpClicked, this, ID_BUTTON_VERT_POS_UP); + Bind(wxEVT_COMMAND_BUTTON_CLICKED, &ScopeDisplay::OnButtonVertPosDownClicked, this, ID_BUTTON_VERT_POS_DOWN); + Bind(wxEVT_COMMAND_BUTTON_CLICKED, &ScopeDisplay::OnButtonVertPosHomeClicked, this, ID_BUTTON_VERT_POS_HOME); + + Bind(wxEVT_COMMAND_BUTTON_CLICKED, &ScopeDisplay::OnButtonTimePosUpClicked, this, ID_BUTTON_TIME_POS_UP); + Bind(wxEVT_COMMAND_BUTTON_CLICKED, &ScopeDisplay::OnButtonTimePosDownClicked, this, ID_BUTTON_TIME_POS_DOWN); + Bind(wxEVT_COMMAND_BUTTON_CLICKED, &ScopeDisplay::OnButtonTimePosEndClicked, this, ID_BUTTON_TIME_POS_END); + Bind(wxEVT_COMMAND_BUTTON_CLICKED, &ScopeDisplay::OnButtonTimePosHomeClicked, this, ID_BUTTON_TIME_POS_HOME); + + Bind(wxEVT_COMMAND_BUTTON_CLICKED, &ScopeDisplay::OnButtonClearScopeClicked, this, ID_BUTTON_CLEAR_SCOPE); + Bind(wxEVT_COMMAND_BUTTON_CLICKED, &ScopeDisplay::OnButtonSaveImageClicked, this, ID_BUTTON_SAVE_IMAGE); + + Bind(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, &ScopeDisplay::OnButtonCursorsClicked, this, ID_BUTTON_CURSORS); + + + mScopePanel->Bind(wxEVT_PAINT, &ScopeDisplay::OnPaint, this); + mScopePanel->Bind(wxEVT_SIZE, &ScopeDisplay::OnSize, this); + + mScopePanel->Bind(wxEVT_LEFT_DOWN, &ScopeDisplay::OnMouseLeftDown, this); + mScopePanel->Bind(wxEVT_LEFT_UP, &ScopeDisplay::OnMouseLeftUp, this); + + mScopePanel->Bind(wxEVT_RIGHT_DOWN, &ScopeDisplay::OnMouseRightDown, this); + mScopePanel->Bind(wxEVT_RIGHT_UP, &ScopeDisplay::OnMouseRightUp, this); + + mScopePanel->Bind(wxEVT_MOTION, &ScopeDisplay::OnMouseMotion, this); + mScopePanel->Bind(wxEVT_MOUSEWHEEL, &ScopeDisplay::OnMouseWheel, this); +} + + +ScopeDisplay::~ScopeDisplay() +{ +} + + +void ScopeDisplay::addWaveform(const wxString &name, const wxString &scale_name, const wxString &unit, float resolution) +{ + //create the vertical scale + VerticalScale* new_vs = new VerticalScale(scale_name, unit, resolution); + + //try to find a scale we can use + auto found = std::find_if(mVerticalScaleList.begin(), mVerticalScaleList.end(), [new_vs](const VerticalScale* scale) + { + return *scale == *new_vs; + }); + + if (found == mVerticalScaleList.end()) + { + mVerticalScaleList.push_back(new_vs); + found = --mVerticalScaleList.end(); + } + + WaveformDescriptor desc(**found); + + desc.name = name; + + //find first unused color and assign it to the waveform + desc.color = *wxBLACK; + for(auto &wc: mWaveColors) + { + if (wc.in_use == false) + { + desc.color = wc.color; + wc.in_use = true; + break; + } + } + + wxString button_name = name; + button_name.insert(0, wxT(" ")); + button_name.append(wxT(" ")); + desc.button = new wxButton(mTopPanel, wxID_ANY, button_name, wxDefaultPosition, wxSize(-1, 25), wxBU_EXACTFIT); + desc.button->SetForegroundColour(desc.color); + //desc.button->SetForegroundColour(*wxLIGHT_GREY); + desc.button->SetFont(mFontMed); + + desc.id = desc.button->GetId(); + Bind(wxEVT_COMMAND_BUTTON_CLICKED, &ScopeDisplay::OnButtonEnableWaveformClicked, this, desc.id); + + mTopSizer->Add(desc.button, 0, wxALL | wxALIGN_CENTER_VERTICAL, SCOPE_CONTROL_BORDER_SIZE); + + mWaveformDescriptorList.push_back(desc); + mDataVectors.push_back(DataVector()); + + mTopSizer->SetSizeHints(mTopPanel); + mTopSizer->Fit(mTopPanel); + + GetSizer()->Layout(); + + Refresh(); +} + + +void ScopeDisplay::clearWaveforms(void) +{ + for(auto &desc: mWaveformDescriptorList) + { + Unbind(wxEVT_COMMAND_BUTTON_CLICKED, &ScopeDisplay::OnButtonEnableWaveformClicked, this, desc.id); + desc.button->Destroy(); + } + + mWaveformDescriptorList.clear(); + + for(const auto sptr: mVerticalScaleList) + delete sptr; + mVerticalScaleList.clear(); + mDataVectors.clear(); + + for(auto it = mWaveColors.begin(); it != mWaveColors.end(); ++it) + it->in_use = false; + + mTopSizer->SetSizeHints(mTopPanel); + + mTopSizer->Fit(mTopPanel); + + GetSizer()->Layout(); + + Refresh(); +} + + +void ScopeDisplay::ChangeVerticalScale(bool up) +{ + const float min_scale = 0.005f; //5mU / div + const float max_scale = 5.0f; //5U / div + + int32_t scale = mVerticalScale; + int32_t exp = mVerticalScaleExponent; + + if (up) + { + switch(scale) + { + case 1: scale = 2; break; + case 2: scale = 5; break; + case 5: scale = 1; exp++; break; + default: assert(0); + } + } + else + { + switch(scale) + { + case 1: scale = 5; exp--; break; + case 2: scale = 1; break; + case 5: scale = 2; break; + default: assert(0); + } + } + + + //validate new scale is within range + float final_scale = scale * pow(10, exp); + if ((final_scale >= min_scale) && (final_scale <= max_scale)) + { + mVerticalScale = scale; + mVerticalScaleExponent = exp; + } + + + mScopePanel->Refresh(); +} + + + + +void ScopeDisplay::AdvanceTime(uint64_t time) +{ + mMaxTime += time; +} + + +void ScopeDisplay::SetTimeScales(const std::vector &scales, size_t default_scale_index) +{ + mTimeScales = scales; + if (default_scale_index >= mTimeScales.size()) + default_scale_index = mTimeScales.size() - 1; + + mTimeScalesIndex = default_scale_index; + mTimeResolution = mTimeScales[mTimeScalesIndex]; +} + + +void ScopeDisplay::ChangeTimeScale(bool up) +{ + if (up) + { + if (mTimeScalesIndex < (mTimeScales.size() - 1)) + { + mTimeScalesIndex++; + mTimeResolution = mTimeScales[mTimeScalesIndex]; + } + } + else + { + if (mTimeScalesIndex > 0) + { + mTimeScalesIndex--; + mTimeResolution = mTimeScales[mTimeScalesIndex]; + } + } + + mTimePosition -= mTimePosition % mTimeResolution; + + mWaveRefresh = true; + mScopePanel->Refresh(); +} + + + +void ScopeDisplay::HomeTimePos(void) +{ + mTimePosition = mMinTime; + mWaveRefresh = true; + + mScopePanel->Refresh(); +} + + +void ScopeDisplay::UpdateScope(void) +{ + EndTimePos(); +} + + +void ScopeDisplay::EndTimePos(void) +{ + mTimePosition = mMaxTime - mCurrentTimeSpan; + if (mTimePosition < mMinTime) + mTimePosition = mMinTime; + + mWaveRefresh = true; + mScopePanel->Refresh(); +} + + + +void ScopeDisplay::ChangeVerticalPos(bool up, uint32_t increment) +{ + if (up) + mVertPosition += increment; + else + mVertPosition -= increment; + + mVertPosition -= mVertPosition % (int32_t)increment; + + mScopePanel->Refresh(); +} + + + +void ScopeDisplay::HomeVerticalPos(void) +{ + mVertPosition = 0; + mScopePanel->Refresh(); +} + + +void ScopeDisplay::ChangeTimePos(bool up, uint32_t increment) +{ + uint64_t step = mTimeResolution; + + if (increment) + step = (step * increment) / GRID_SPACING; + if (step == 0) + step = 1; + + if (up) + { + mTimePosition += step; + } + else if (mTimePosition >= step) + { + mTimePosition -= step; + } + + mWaveRefresh = true; + mScopePanel->Refresh(); +} + + + + +void ScopeDisplay::OnPaint(wxPaintEvent &event) +{ + wxAutoBufferedPaintDC dc(mScopePanel); + render(dc); +} + + +void ScopeDisplay::OnSize(wxSizeEvent &event) +{ + mWaveRefresh = true; + //wxSize size = event.GetSize(); + //wxLogMessage(wxT("size: %d %d"), size.GetWidth(), size.GetHeight()); + +// mTopPanel->SetSize(wxRect(0, 0, size.x, SCOPE_TOP_PANEL_HEIGHT)); +// mBottomPanel->SetSize(wxRect(0, size.y - SCOPE_BOTTOM_PANEL_HEIGHT, size.x, SCOPE_BOTTOM_PANEL_HEIGHT)); +// mLeftPanel->SetSize(wxRect(0, SCOPE_TOP_PANEL_HEIGHT, SCOPE_LEFT_PANEL_WIDTH, size.y - SCOPE_TOP_PANEL_HEIGHT - SCOPE_BOTTOM_PANEL_HEIGHT)); +} + + +void ScopeDisplay::render(wxDC &dc) +{ + int32_t x, y1, y2; + + const wxSize scope_size = mScopePanel->GetSize(); + + //clear the background + dc.SetPen(wxPen(*wxWHITE, 1)); + dc.SetBrush(wxBrush(*wxWHITE)); + dc.DrawRectangle(wxPoint(0, 0), scope_size); + + mGraphTop = SCOPE_TOP_BORDER_SIZE; + mGraphLeft = SCOPE_LEFT_BORDER_SIZE + SCOPE_VERTICAL_SCALE_WIDTH * mVerticalScaleList.size(); + + //draw grids + dc.SetTextForeground(mScalesColor); + dc.SetFont(mScalesFont); + + mHGridDivisions = (scope_size.y - SCOPE_BOTTOM_BORDER_SIZE - SCOPE_TOP_BORDER_SIZE) / GRID_SPACING; + mVGridDivisions = (scope_size.x - SCOPE_RIGHT_BORDER_SIZE - SCOPE_LEFT_BORDER_SIZE - SCOPE_VERTICAL_SCALE_WIDTH * mVerticalScaleList.size()) / GRID_SPACING; + + mCurrentTimeSpan = mTimeResolution * mVGridDivisions; //in us + + if (mTimePosition > (mMaxTime - mCurrentTimeSpan)) + mTimePosition = mMaxTime - mCurrentTimeSpan; + + mGraphBottom = mGraphTop + GRID_SPACING * mHGridDivisions; + mGraphRight = mGraphLeft + GRID_SPACING * mVGridDivisions; + const int32_t graph_height = mGraphBottom - mGraphTop; + + dc.SetPen(wxPen(mGridColor, 1, wxPENSTYLE_DOT)); + int32_t h_grid = mGraphBottom - GRID_SPACING; + for(int32_t i = 1; i <= mHGridDivisions; i++) + { + dc.DrawLine(wxPoint(mGraphLeft, h_grid), wxPoint(mGraphRight, h_grid)); + h_grid -= GRID_SPACING; + } + + + int32_t v_grid = mGraphLeft; + uint64_t time_grid_value = mTimePosition; + for(int32_t i = 0; i <= mVGridDivisions; i++) + { + dc.SetPen(wxPen(mGridColor, 1, wxPENSTYLE_DOT)); + dc.DrawLine(wxPoint(v_grid, mGraphBottom), wxPoint(v_grid, mGraphTop)); + + dc.SetPen(wxPen(mScalesColor, 1)); + dc.DrawLine(wxPoint(v_grid, mGraphBottom - 3), wxPoint(v_grid, mGraphBottom + 4)); + + const wxString text = PrintTime(time_grid_value); + const wxSize ts = dc.GetTextExtent(text); + + time_grid_value += mTimeResolution; + + dc.DrawText(text, v_grid - (ts.x / 2), mGraphBottom + 4); + + v_grid += GRID_SPACING; + } + + + //draw waveforms + if (mWaveRefresh && mListener) + { + mWaveRefresh = false; + mListener->getChartData(mTimePosition, mTimePosition + mCurrentTimeSpan, mGraphRight - mGraphLeft, mDataVectors); + } + + dc.SetFont(mScalesFont); + size_t i = 0; + for (auto &wd: mWaveformDescriptorList) + { + if (wd.enabled) + { + wd.button->SetForegroundColour(wd.color); + dc.SetPen(wxPen(wd.color, 2)); + dc.SetTextForeground(wd.color); + + DrawAnalogWaveform(dc, mDataVectors[i], wd, mGraphLeft, mGraphBottom, mGraphRight, mGraphTop); + } + else + { + wd.button->SetForegroundColour(*wxLIGHT_GREY); + } + + i++; + } + + //draw vertical axes + dc.SetBrush(wxBrush(*wxBLACK)); + + int32_t scale_x = SCOPE_LEFT_BORDER_SIZE; + for(auto scale: mVerticalScaleList) + { + scale_x += SCOPE_VERTICAL_SCALE_WIDTH; + + //print scale + dc.SetPen(wxPen(mScalesColor, 1)); + dc.SetFont(mScalesFont); + dc.SetTextForeground(mScalesColor); + int32_t h_grid = mGraphBottom; + float scale_value = (mVertPosition / (float)GRID_SPACING) * scale->resolution * mVerticalScale * pow(10, mVerticalScaleExponent); + + for(int32_t i = 0; i < mHGridDivisions + 1; i++) + { + const wxString text = PrintValue(scale_value, scale->unit); + const wxSize ts = dc.GetTextExtent(text); + + dc.SetPen(wxPen(*wxBLACK, 2)); + dc.DrawLine(wxPoint(scale_x - 3, h_grid), wxPoint(scale_x + 3, h_grid)); + dc.DrawText(text, scale_x - ts.x - 5, h_grid - ts.y / 2); + + h_grid -= GRID_SPACING; + scale_value += scale->resolution * mVerticalScale * pow(10, mVerticalScaleExponent); + } + + //draw axis + dc.SetPen(wxPen(*wxBLACK, 2)); + dc.DrawLine(wxPoint(scale_x, mGraphBottom), wxPoint(scale_x, mGraphTop - 4)); + DrawArrow(dc, wxPoint(scale_x, mGraphTop - 20), 0, ARROW_HEIGHT, ARROW_BASE); + + //print axis name + dc.SetFont(mFontBig); + dc.SetTextForeground(*wxBLACK); + const wxSize ts = dc.GetTextExtent(scale->name); + dc.DrawText(scale->name, scale_x - ts.x - ARROW_BASE / 2 - 2, 0); + } + + //draw time axis + dc.SetPen(wxPen(*wxBLACK, 2)); + dc.SetBrush(wxBrush(*wxBLACK)); + dc.DrawLine(wxPoint(mGraphLeft, mGraphBottom), wxPoint(mGraphRight + 4, mGraphBottom)); + + dc.SetTextBackground(*wxWHITE); + dc.SetTextForeground(*wxBLACK); + dc.SetFont(mFontBig); + DrawArrow(dc, wxPoint(mGraphRight + 20, mGraphBottom), 3, ARROW_HEIGHT, ARROW_BASE); + dc.DrawText(wxT("t"), scope_size.x - SCOPE_RIGHT_BORDER_SIZE + 2, mGraphBottom - ARROW_BASE / 2 - dc.GetCharHeight()); + + dc.DrawText(wxT("Time Scale:"), SCOPE_LEFT_BORDER_SIZE, scope_size.y - SCOPE_BOTTOM_BORDER_SIZE); + const wxSize ts = dc.GetTextExtent(wxT("Time Scale:")); + + const wxString text = PrintTimeResolution(mTimeResolution); + dc.SetTextForeground(*wxRED); + dc.DrawText(text, SCOPE_LEFT_BORDER_SIZE + ts.x + dc.GetCharWidth(), scope_size.y - SCOPE_BOTTOM_BORDER_SIZE); + + if (mCursorsEnable) + { + dc.SetTextBackground(*wxWHITE); + dc.SetFont(mFontSmall); + + dc.SetTextForeground(*wxBLACK); + dc.DrawText(wxT("Cursors"), 40, mGraphTop - 3 * dc.GetCharHeight()); + + //draw cursor 1 + dc.SetTextForeground(mCursor1Color); + dc.SetPen(wxPen(mCursor1Color, 1)); + + dc.DrawLine(wxPoint(mCursor1Pos.x, mGraphTop), wxPoint(mCursor1Pos.x, mGraphBottom)); + + //draw cursor 2 + dc.SetTextForeground(mCursor2Color); + dc.SetPen(wxPen(mCursor2Color, 1)); + + dc.DrawLine(wxPoint(mCursor2Pos.x, mGraphTop), wxPoint(mCursor2Pos.x, mGraphBottom)); + + const int64_t time1 = (((mCursor1Pos.x - mGraphLeft) * (uint64_t)mTimeResolution) / GRID_SPACING) + mTimePosition; + const int64_t time2 = (((mCursor2Pos.x - mGraphLeft) * (uint64_t)mTimeResolution) / GRID_SPACING) + mTimePosition; + + + //draw cursor value text + wxString text = PrintTime(time1); + dc.SetTextForeground(mCursor1Color); + wxSize ts = dc.GetTextExtent(text); + + y1 = mGraphBottom - ts.y - 10; + + if ((mGraphRight - mCursor1Pos.x) > ts.x + 40) + x = mCursor1Pos.x + 10; + else + x = mCursor1Pos.x - ts.x - 10; + + dc.DrawText(text, x, y1); + + + text = PrintTime(time2); + dc.SetTextForeground(mCursor2Color); + ts = dc.GetTextExtent(text); + + y2 = mGraphBottom - ts.GetHeight() - 10; + + if ((mGraphRight - mCursor2Pos.x) > ts.x + 40) + x = mCursor2Pos.x + 10; + else + x = mCursor2Pos.x - ts.x - 10; + dc.DrawText(text, x, y2); + + + dc.SetClippingRegion(mGraphLeft - 1, mGraphTop - 1, mGraphRight - mGraphLeft + 1, graph_height + 1); + + dc.SetPen(wxNullPen); + int32_t text_pos1_y = mGraphTop; + int32_t text_pos2_y = mGraphTop; + + const int32_t x1 = mCursor1Pos.x - mGraphLeft; + const int32_t x2 = mCursor2Pos.x - mGraphLeft; + + for(uint32_t i = 0; i < mWaveformDescriptorList.size(); i++) + { + const auto &wd = mWaveformDescriptorList[i]; + + if (wd.enabled) + { + const float v1 = mDataVectors[i][x1]; + const float v2 = mDataVectors[i][x2]; + + const float vertical_resolution = wd.scale.resolution * mVerticalScale * pow(10, mVerticalScaleExponent); + const float vertical_reference = mVertPosition * vertical_resolution / GRID_SPACING; + const float vertical_span = (graph_height / GRID_SPACING) * vertical_resolution; + + dc.SetBrush(wxBrush(wd.color)); + dc.SetTextForeground(wd.color); + + if (!isnan(v1)) + { + const int32_t y1 = ((v1 - vertical_reference) / vertical_span) * graph_height; + dc.DrawCircle(mCursor1Pos.x, mGraphBottom - y1, 4); + + const wxString text = PrintValue(v1, wd.scale.unit); + dc.DrawText(wd.name + wxT(": ") + text, mCursor1Pos.x + 10, text_pos1_y); + text_pos1_y += dc.GetCharHeight(); + } + + if (!isnan(v2)) + { + const int32_t y2 = ((v2 - vertical_reference) / vertical_span) * graph_height; + dc.DrawCircle(mCursor2Pos.x, mGraphBottom - y2, 4); + + const wxString text = PrintValue(v2, wd.scale.unit); + dc.DrawText(wd.name + wxT(": ") + text, mCursor2Pos.x + 10, text_pos2_y); + text_pos2_y += dc.GetCharHeight(); + } + } + } + dc.DestroyClippingRegion(); + } +} + + +void ScopeDisplay::DrawAnalogWaveform(wxDC &dc, const std::vector &wave, const WaveformDescriptor &wd, int32_t x0, int32_t y0, int32_t x1, int32_t y1) +{ + const int32_t screen_size_x = ((x1 - x0) < wave.size()) ? (x1 - x0) : wave.size(); + if (screen_size_x == 0) + return; + + const int32_t screen_size_y = y0 - y1; + + dc.SetClippingRegion(x0 - 1, y1 - 1, screen_size_x + 1, screen_size_y + 1); + + const float vertical_resolution = wd.scale.resolution * mVerticalScale * pow(10, mVerticalScaleExponent); + const float vertical_reference = mVertPosition * vertical_resolution / GRID_SPACING; + const float vertical_span = (screen_size_y / GRID_SPACING) * vertical_resolution; + + const float* vptr = wave.data(); + + float left_val, right_val; + + int32_t left_x, left_y; + int32_t right_y; + + left_val = *vptr++; + left_x = 0; + left_y = ((left_val - vertical_reference) / vertical_span) * screen_size_y; + + if (left_val == left_val) + dc.DrawPoint(x0 + left_x, y0 - left_y); + + for(int32_t right_x = 1; right_x < screen_size_x; right_x++) + { + right_val = *vptr++; + + right_y = ((right_val - vertical_reference) / vertical_span) * screen_size_y; + + if ((right_val == right_val) && (left_val == left_val)) + dc.DrawLine(x0 + left_x, y0 - left_y, x0 + right_x, y0 - right_y); + + left_y = right_y; + left_x = right_x; + + left_val = right_val; + } + + dc.DestroyClippingRegion(); +} + + + +/*void ScopeDisplay::DrawIntegerWaveform(wxDC &dc, IntegerWaveform &wave, int32_t x0, int32_t y0, int32_t x1, int32_t y1) +{ + + const int32_t screen_size_x = x1 - x0; + const int32_t screen_size_y = y1 - y0; + + const uint64_t time_per_pixel = mTimeResolution / GRID_SPACING; + + + if ((wave.ypos + SCOPE_INTEGER_WAVEFORM_PITCH) > screen_size_y) + return; + + int32_t max_x = x0 + (mMaxTime - mTimePosition) / time_per_pixel; + if (max_x >= screen_size_x) + max_x = screen_size_x - 1; + + if (!wave.data->seek(0)) + return; + + + //search for the first value change in the screen + ValueChange vc; + uint32_t prev_val = 0; + //move to the first change in the time window + while(wave.data->pop(vc)) + { + if (vc.time >= mTimePosition) + { + if (mTimePosition == 0) + prev_val = vc.val; + + wave.data->advance(-1); //move back one - this is the first value to be displayed + break; + } + prev_val = vc.val; + } + + const int32_t text_ypos = ((SCOPE_INTEGER_WAVEFORM_HEIGHT + dc.GetCharHeight()) / 2) + wave.ypos - 1; + + int32_t prev_x = x0; + + if (wave.data->pop(vc)) + { + do + { + int32_t vc_x = x0 + (vc.time - mTimePosition) / time_per_pixel; + if (vc_x >= x1) + break; + + //draw the cross + if (vc_x == x0) + { + if (mTimePosition) + { + prev_x = x0 + 5; + dc.DrawLine(vc_x, wave.ypos + SCOPE_INTEGER_WAVEFORM_HEIGHT / 2, prev_x, wave.ypos + SCOPE_INTEGER_WAVEFORM_HEIGHT); + dc.DrawLine(vc_x, wave.ypos + SCOPE_INTEGER_WAVEFORM_HEIGHT / 2, prev_x, wave.ypos); + } + + prev_val = vc.val; + } + else + { + if ((vc_x - 5) > prev_x) + { + dc.DrawLine(prev_x, wave.ypos, vc_x - 5, wave.ypos); + dc.DrawLine(prev_x, wave.ypos + SCOPE_INTEGER_WAVEFORM_HEIGHT, vc_x - 5, wave.ypos + SCOPE_INTEGER_WAVEFORM_HEIGHT); + } + + if ((vc_x - prev_x - 5) > 25) + { + wxString text; + text.Printf(wxT("0x%X"), prev_val); + dc.DrawText(text, prev_x, text_ypos); + } + + dc.DrawLine(vc_x - 5, wave.ypos, vc_x + 5, wave.ypos + SCOPE_INTEGER_WAVEFORM_HEIGHT); + dc.DrawLine(vc_x - 5, wave.ypos + SCOPE_INTEGER_WAVEFORM_HEIGHT, vc_x + 5, wave.ypos); + + prev_x = vc_x + 5; + prev_val = vc.val; + } + }while(wave.data->pop(vc)); + } + + if (max_x > prev_x) + { + dc.DrawLine(prev_x, wave.ypos, max_x, wave.ypos); + dc.DrawLine(prev_x, wave.ypos + SCOPE_INTEGER_WAVEFORM_HEIGHT, max_x, wave.ypos + SCOPE_INTEGER_WAVEFORM_HEIGHT); + } + if ((max_x - prev_x - 5) > 25) + { + wxString text; + text.Printf(wxT("0x%X"), prev_val); + dc.DrawText(text, prev_x, text_ypos); + } + + +} +*/ + + +void ScopeDisplay::DrawArrow(wxDC &dc, const wxPoint &pos, uint8_t dir, int32_t height, int32_t base) +{ + wxPoint points[3]; + + points[0] = wxPoint(0, 0); + + switch(dir) + { + case 0: //up + points[1] = wxPoint(-base / 2, height); + points[2] = wxPoint(base / 2, height); + break; + + case 1: //left + points[1] = wxPoint(height, -base / 2); + points[2] = wxPoint(height, base / 2); + break; + + case 2: //down + points[1] = wxPoint(-base / 2, -height); + points[2] = wxPoint(base / 2, -height); + break; + + case 3: //right + points[1] = wxPoint(-height, -base / 2); + points[2] = wxPoint(-height, base / 2); + break; + } + + dc.DrawPolygon(3, points, pos.x, pos.y); +} + + + +wxBitmap* ScopeDisplay::SaveImage(void) +{ +//TODO + wxBitmap* image = new wxBitmap(1200, 800); + + wxMemoryDC dc; + + dc.SelectObject(*image); + + render(dc); + + return image; +} + + + +void ScopeDisplay::OnKeyPressed(wxKeyEvent &event) +{ + +} + + +void ScopeDisplay::OnKeyReleased(wxKeyEvent &event) +{ + +} + + +void ScopeDisplay::OnMouseWheel(wxMouseEvent &event) +{ + int32_t dir = event.GetWheelRotation() / event.GetWheelDelta(); + uint32_t step = 1; + if (event.ShiftDown()) + step = 10; + + const int32_t mouse_x = event.GetPosition().x - SCOPE_LEFT_BORDER_SIZE; + const uint32_t index = mouse_x / SCOPE_VERTICAL_SCALE_WIDTH; + + if (index < mVerticalScaleList.size()) + { + if (dir > 0) + mVerticalScaleList[index]->resolution *= 2; + else if (dir < 0) + mVerticalScaleList[index]->resolution /= 2; + + mScopePanel->Refresh(); + } + else + { + if (event.AltDown()) + { + if (dir > 0) + ChangeTimePos(true, step); + else if (dir < 0) + ChangeTimePos(false, step); + } + else + { + if (dir > 0) + ChangeVerticalPos(true, step); + else if (dir < 0) + ChangeVerticalPos(false, step); + } + } +} + + + +void ScopeDisplay::OnMouseLeftDown(wxMouseEvent &event) +{ + if (mCursor1Dragging == false) + { + mScopePanel->CaptureMouse(); + mCursor1Dragging = true; + } +} + + +void ScopeDisplay::OnMouseLeftUp(wxMouseEvent &event) +{ + if (mCursor1Dragging == true) + { + mScopePanel->ReleaseMouse(); + mCursor1Dragging = false; + } +} + + +void ScopeDisplay::OnMouseRightDown(wxMouseEvent &event) +{ + if (mCursor2Dragging == false) + { + mScopePanel->CaptureMouse(); + mCursor2Dragging = true; + } +} + + +void ScopeDisplay::OnMouseRightUp(wxMouseEvent &event) +{ + if (mCursor2Dragging == true) + { + mScopePanel->ReleaseMouse(); + mCursor2Dragging = false; + } +} + + +void ScopeDisplay::OnMouseLeaveWindow(wxMouseEvent &event) +{ + +} + + +void ScopeDisplay::OnMouseMotion(wxMouseEvent &event) +{ + wxPoint pos = event.GetPosition(); + + if (pos.x< mGraphLeft) + pos.x = mGraphLeft; + else if (pos.x > mGraphRight) + pos.x = mGraphRight; + + if (pos.y < mGraphTop) + pos.y = mGraphTop; + else if (pos.y > mGraphBottom) + pos.y = mGraphBottom; + + if (mCursor1Dragging) + { + mCursor1Pos = pos; + mScopePanel->Refresh(); + } + else if (mCursor2Dragging) + { + mCursor2Pos = pos; + mScopePanel->Refresh(); + } +} + + +void ScopeDisplay::OnButtonVertScaleUpClicked(wxCommandEvent &event) +{ + ChangeVerticalScale(true); +} + + +void ScopeDisplay::OnButtonVertScaleDownClicked(wxCommandEvent &event) +{ + ChangeVerticalScale(false); +} + + +void ScopeDisplay::OnButtonTimeScaleUpClicked(wxCommandEvent &event) +{ + ChangeTimeScale(true); +} + + +void ScopeDisplay::OnButtonTimeScaleDownClicked(wxCommandEvent &event) +{ + ChangeTimeScale(false); +} + + +void ScopeDisplay::OnButtonVertPosUpClicked(wxCommandEvent &event) +{ + ChangeVerticalPos(true, GRID_SPACING); +} + + +void ScopeDisplay::OnButtonVertPosDownClicked(wxCommandEvent &event) +{ + ChangeVerticalPos(false, GRID_SPACING); +} + + +void ScopeDisplay::OnButtonVertPosHomeClicked(wxCommandEvent &event) +{ + HomeVerticalPos(); +} + + +void ScopeDisplay::OnButtonTimePosUpClicked(wxCommandEvent &event) +{ + ChangeTimePos(true, 0); +} + + +void ScopeDisplay::OnButtonTimePosDownClicked(wxCommandEvent &event) +{ + ChangeTimePos(false, 0); +} + + +void ScopeDisplay::OnButtonTimePosEndClicked(wxCommandEvent &event) +{ + EndTimePos(); +} + + +void ScopeDisplay::OnButtonTimePosHomeClicked(wxCommandEvent &event) +{ + HomeTimePos(); +} + + +void ScopeDisplay::OnButtonClearScopeClicked(wxCommandEvent &event) +{ +/* for(auto it = mWaveforms->begin(); it != mWaveforms->end(); ++it) + it->data.clear();*/ + + /*for(IntegerWaveformList::iterator it = mIntegerWaveforms.begin(); it != mIntegerWaveforms.end(); ++it) + it->data->clear();*/ + + mScopePanel->Refresh(); +} + + +void ScopeDisplay::OnButtonCursorsClicked(wxCommandEvent &event) +{ + CursorsEnable(mCursorsButton->GetValue()); +} + + + +void ScopeDisplay::OnButtonSaveImageClicked(wxCommandEvent &event) +{ +//TODO bug + wxFileDialog *dlg = new wxFileDialog(this, wxT("Choose File to Save Image To"), wxString(), wxString(), wxT("PNG Image File (*.png)|*.png"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT); + + if (dlg->ShowModal() == wxID_OK) + { + wxString file = dlg->GetPath(); + + wxBitmap *image = SaveImage(); + + image->SaveFile(file, wxBITMAP_TYPE_PNG, 0); + + delete image; + } + + dlg->Destroy(); +} + + +void ScopeDisplay::OnButtonEnableWaveformClicked(wxCommandEvent &event) +{ + const int32_t id = event.GetId(); + + for(auto &wd: mWaveformDescriptorList) + { + if (wd.id == id) + { + if (wd.enabled) + { + wd.enabled = false; + wd.button->SetForegroundColour(*wxLIGHT_GREY); + } + else + { + wd.enabled = true; + wd.button->SetForegroundColour(wd.color); + } + } + } + + mScopePanel->Refresh(); +} diff --git a/gui/scope_display.h b/gui/scope_display.h new file mode 100644 index 0000000..ee38249 --- /dev/null +++ b/gui/scope_display.h @@ -0,0 +1,419 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _SCOPE_DISPLAY_H +#define _SCOPE_DISPLAY_H + + +#include +#include + +#include +#include + +#include + + + +typedef std::vector DataVector; + + +class ScopeDisplay: public wxWindow +{ +public: + class Listener + { + public: + virtual void getChartData(uint64_t start_time, uint64_t last_time, size_t point_count, std::vector &data) = 0; + }; + + + ScopeDisplay(wxFrame* parent, wxWindowID id, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = 0); + ~ScopeDisplay(); + + void setListener(Listener* listener) + { + mListener = listener; + } + + void addWaveform(const wxString &name, const wxString &scale_name, const wxString &unit, float resolution); + void clearWaveforms(void); + + + void UpdateScope(void); + + wxBitmap* SaveImage(void); + + void ChangeVerticalScale(bool up); + void ChangeTimeScale(bool up); + + void ChangeVerticalPos(bool up, uint32_t increment); + void HomeVerticalPos(void); + + void SetTimeScales(const std::vector &scales, size_t default_scale_index); + + void ChangeTimePos(bool up, uint32_t increment); //0 means a full division while, >0 means number of pixels on screen + void HomeTimePos(void); + void EndTimePos(void); + + void AdvanceTime(uint64_t time); + + uint64_t GetTime(void) const + { + return mMaxTime; + } + + void setMinTime(uint64_t time) + { + mMinTime = time; + } + + void setMaxTime(uint64_t time) + { + mMaxTime = time; + } + + void UpdateWaveforms(void) + { + EndTimePos(); + Refresh(); + Update(); + } + + void CursorsEnable(bool enable) + { + mCursorsEnable = enable; + + if (mCursorsEnable) + { + mCursor1Pos.x = (mGraphLeft * 2 + mGraphRight) / 3; + mCursor2Pos.x = (mGraphLeft + mGraphRight * 2) / 3; + } + + Refresh(); + Update(); + } + + wxWindowID SaveDataButtonID(void) const + { + return ID_BUTTON_SAVE_DATA; + } + + wxWindowID LoadDataButtonID(void) const + { + return ID_BUTTON_LOAD_DATA; + } + + + void OnKeyPressed(wxKeyEvent &event); + void OnKeyReleased(wxKeyEvent &event); + + DECLARE_EVENT_TABLE() + +private: + enum + { + ID_BUTTON_VERT_SCALE_UP = wxID_HIGHEST + 1, + ID_BUTTON_VERT_SCALE_DOWN, + ID_BUTTON_VERT_POS_UP, + ID_BUTTON_VERT_POS_DOWN, + ID_BUTTON_VERT_POS_HOME, + + ID_BUTTON_TIME_SCALE_UP, + ID_BUTTON_TIME_SCALE_DOWN, + ID_BUTTON_TIME_POS_END, + ID_BUTTON_TIME_POS_UP, + ID_BUTTON_TIME_POS_DOWN, + ID_BUTTON_TIME_POS_HOME, + + ID_BUTTON_CLEAR_SCOPE, + ID_BUTTON_SAVE_IMAGE, + ID_BUTTON_CURSORS, + ID_BUTTON_SAVE_DATA, + ID_BUTTON_LOAD_DATA + }; + + + class VerticalScale + { + public: + VerticalScale(const wxString &init_name, const wxString &init_unit, float init_resolution): name(init_name), unit(init_unit), resolution(init_resolution) + { + } + + bool operator==(const VerticalScale &rhs) const + { + return name == rhs.name; + } + + wxString name; + wxString unit; + float resolution; //vertical resolution (units / division) + }; + + class WaveformDescriptor + { + public: + WaveformDescriptor(VerticalScale &init_scale): scale(init_scale), button(nullptr), enabled(true), id(wxID_ANY) + { + } + + VerticalScale &scale; + wxString name; + + wxColor color; + + wxButton* button; + bool enabled; + int32_t id; + }; + + + class WaveColor + { + public: + WaveColor(wxColour c): color(c), in_use(false) + { + } + + wxColour color; + bool in_use; + }; + + + Listener* mListener; + + std::vector mVerticalScaleList; + std::vector mWaveformDescriptorList; + + std::vector mDataVectors; + bool mWaveRefresh; + + int32_t mGraphTop; + int32_t mGraphBottom; + int32_t mGraphLeft; + int32_t mGraphRight; + + wxColor mGridColor; + wxColor mScalesColor; + wxColor mCursor1Color; + wxColor mCursor2Color; + + std::vector mWaveColors; + + wxFont mFontBig; + wxFont mFontMed; + wxFont mFontSmall; + wxFont mScalesFont; + + int32_t mVGridDivisions; + int32_t mHGridDivisions; + + //time scale + size_t mTimeScalesIndex; + std::vector mTimeScales; + uint64_t mTimeResolution; //micro-seconds per division - horizontal resolution + + uint64_t mTimePosition; //in us + uint64_t mMinTime; //in us + uint64_t mMaxTime; //in us + + int32_t mVertPosition; //in divisions + + //this gets multiplied with the resolution + int32_t mVerticalScale; + int32_t mVerticalScaleExponent; + + uint64_t mCurrentTimeSpan; //in divisons on screen + uint32_t mCurrentVertSpan; //in divisions + + float mSamplesOnScreen[4096]; + + bool mCursorsEnable; + wxPoint mCursor1Pos; + wxPoint mCursor2Pos; + bool mCursor1Dragging; + bool mCursor2Dragging; + + + uint32_t mWaveStreamSamplePeriod; //in us + uint32_t mWaveStreamVerticalOffset; + + + wxPanel* mTopPanel; + wxPanel* mBottomPanel; + wxPanel* mLeftPanel; + wxPanel* mScopePanel; + + wxBoxSizer* mTopSizer; + + wxBitmapButton* mTimeScaleUpButton; + wxBitmapButton* mTimeScaleDownButton; + + wxBitmapButton* mTimePosUpButton; + wxBitmapButton* mTimePosDownButton; + wxBitmapButton* mTimePosEndButton; + wxBitmapButton* mTimePosHomeButton; + + wxBitmapButton* mVertScaleUpButton; + wxBitmapButton* mVertScaleDownButton; + + wxBitmapButton* mVertPosUpButton; + wxBitmapButton* mVertPosDownButton; + wxBitmapButton* mVertPosHomeButton; + + wxButton* mClearScopeButton; + wxButton* mSaveImageButton; + wxToggleButton* mCursorsButton; + + wxButton* mSaveDataButton; + wxButton* mLoadDataButton; + + + inline wxString PrintTimeResolution(uint64_t us) + { + uint64_t scale = 1; + + if (us < (scale * 1000)) + { + return wxString::Format(wxT("%lluus / div"), us / scale); + } + + scale *= 1000; + if (us < (scale * 1000)) + { + return wxString::Format(wxT("%llums / div"), us / scale); + } + + scale *= 1000; + if (us < (scale * 60)) + { + return wxString::Format(wxT("%llus / div"), us / scale); + } + + scale *= 60; + if (us < (scale * 60)) + { + return wxString::Format(wxT("%llum / div"), us / scale); + } + + scale *= 60; + if (us < (scale * 24)) + { + return wxString::Format(wxT("%lluh / div"), us / scale); + } + + scale *= 24; + return wxString::Format(wxT("%llud / div"), us / scale); + } + + + inline wxString PrintTime(int64_t us) + { + wxDateTime dt; + dt.Set((time_t)us / 1000000); + dt.MakeUTC(); + + return dt.Format(wxT("%I:%M:%S %p\n")) + dt.FormatDate(); + } + + + inline wxString PrintDataSize(uint64_t size) + { + if ((size >= (1 << 30)) || (size == 0)) + return wxString::Format(wxT("%.2fGB"), (double)size / (double)(1 << 30)); + else if (size >= (1 << 20)) + return wxString::Format(wxT("%.2fMB"), (double)size / (double)(1 << 20)); + else if (size >= (1 << 10)) + return wxString::Format(wxT("%.2fkB"), (double)size / (double)(1 << 10)); + else + return wxString::Format(wxT("%llubytes"), size); + } + + + inline wxString PrintValue(float val, const wxString &unit) + { + if (!isnan(val)) + { + const float val_abs = fabs(val); + if (val_abs == 0) + return wxT("0"); + else if (val_abs < 0.001) //use micro + return wxString::Format(wxT("%.0fu%s"), val * 1000000, unit.c_str()); + else if (val_abs < 1.0) //use milli + return wxString::Format(wxT("%.0fm%s "), val * 1000, unit.c_str()); + else if (val_abs >= 1000) //use kilo + return wxString::Format(wxT("%.3fk%s"), val / 1000, unit.c_str()); + else + return wxString::Format(wxT("%.3f%s"), val, unit.c_str()); + } + else + { + return wxT("N/A"); + } + } + + void DrawArrow(wxDC &dc, const wxPoint &pos, uint8_t dir, int32_t height, int32_t base); + + void DrawAnalogWaveform(wxDC &dc, const std::vector &wave, const WaveformDescriptor &wd, int32_t x0, int32_t y0, int32_t x1, int32_t y1); + + void render(wxDC &dc); + + + void OnButtonEnableWaveformClicked(wxCommandEvent &event); + + + void OnButtonVertScaleUpClicked(wxCommandEvent &event); + void OnButtonVertScaleDownClicked(wxCommandEvent &event); + + void OnButtonTimeScaleUpClicked(wxCommandEvent &event); + void OnButtonTimeScaleDownClicked(wxCommandEvent &event); + + + void OnButtonVertPosUpClicked(wxCommandEvent &event); + void OnButtonVertPosDownClicked(wxCommandEvent &event); + void OnButtonVertPosHomeClicked(wxCommandEvent &event); + + void OnButtonTimePosUpClicked(wxCommandEvent &event); + void OnButtonTimePosDownClicked(wxCommandEvent &event); + + void OnButtonTimePosEndClicked(wxCommandEvent &event); + void OnButtonTimePosHomeClicked(wxCommandEvent &event); + + void OnButtonClearScopeClicked(wxCommandEvent &event); + void OnButtonSaveImageClicked(wxCommandEvent &event); + + void OnButtonCursorsClicked(wxCommandEvent &event); + + void OnPaint(wxPaintEvent &event); + void OnSize(wxSizeEvent &event); + + void OnMouseLeftDown(wxMouseEvent &event); + void OnMouseLeftUp(wxMouseEvent &event); + void OnMouseRightDown(wxMouseEvent &event); + void OnMouseRightUp(wxMouseEvent &event); + void OnMouseLeaveWindow(wxMouseEvent &event); + + void OnMouseWheel(wxMouseEvent &event); + void OnMouseMotion(wxMouseEvent &event); +}; + + + + +#endif + diff --git a/lib/powermon/inc/powermon.h b/lib/powermon/inc/powermon.h new file mode 100644 index 0000000..9bca041 --- /dev/null +++ b/lib/powermon/inc/powermon.h @@ -0,0 +1,800 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _POWERMON_H +#define _POWERMON_H + + +#include +#include + +#include +#include +#include + + +#include +#include +#include + + +#define MAX_WIFI_SSID_SIZE 32 +#define MAX_WIFI_PASSWORD_SIZE 64 + +#define CHANNEL_ID_SIZE 16 +#define ENCRYPTION_KEY_SIZE 32 + +#define MAX_BLE_NAME_LENGTH 8 +#define MAX_WIFI_NAME_LENGTH 32 + +#define MAX_TIMER_NAME_LENGTH 16 +#define MAX_TIMER_COUNT 16 + +#define FG_SOC_DISABLED 0xFF +#define FG_SOC_UNKNOWN 0xFE + +#define FG_RUNTIME_DISABLED 0xFFFF +#define FG_RUNTIME_UNKNOWN 0xFFFE +#define FG_RUNTIME_MAX 0xFFF0 + + +/** + * \brief Powermon is a class representing one PowerMon device (BLE or WiFi) and offers a set of functions for accessing all features of PowerMon battery monitors. + */ +class Powermon +{ +public: + /** + * \brief HardwareRevision definitions (2 digit BCD format) + */ + enum HardwareRevision: uint8_t + { + FAMILY_MASK = 0xF0, /// &cb) = 0; + + + /** + * \brief Sets the callback to be called by the driver when a connection to the PowerMon device is disconnected + * \param cb Lambda of type `void(Powermmon::DisconnectReason)` + */ + virtual void setOnDisconnectCallback(const std::function &cb) = 0; + + + /** + * \brief Sets the callback to be called by the driver when new monitor data is received. This applies to the BLE devices only. + * For the WiFi devices, use the request to retrieve the monitor data. + * \param cb Lambda of type `void(Powermon::MonitorData&)` + */ + virtual void setOnMonitorDataCallback(const std::function &cb) = 0; + + + /** + * \brief Sets the callback to be called by the driver when a new WiFi scan result is received from the PowerMon. This applies to the WiFi devices only. + * WiFi scanning can be initiated using requestStartWifiScan(). + * \param cb Lambda of type `void(Powermon::WifiScanResult*)` + * \param result Pointer to a WiFiScanResult structure describing a WiFi network. The pointer is only valid inside the scope of the callback closure. + * Do not store this pointer. Result can be nullptr to signal the WiFi scan ending. + */ + virtual void setOnWifiScanReportCallback(const std::function &cb) = 0; + + + /** + * \brief Returns the last DeviceInfo retrieved from the PowerMon + * \return Reference to internal DeviceInfo structure. This is not valid before the first requestGetInfo() that returns success. + */ + virtual const DeviceInfo& getLastDeviceInfo(void) const = 0; + + + /** + * \brief Requests the device information + * \param cb Lambda of type void(ResponseCode, const DeviceInfo&) that will be called to signal the result of the request + */ + virtual void requestGetInfo(const std::function &cb) = 0; + + + /** + * \brief Requests the device monitor data. It only applies to the WiFi devices. + * \param cb Lambda of type void(ResponseCode, const MonitorData&) that will be called to signal the result of the request + */ + virtual void requestGetMonitorData(const std::function &cb) = 0; + + + /** + * \brief Requests the device power monitor statistics data + * \param cb Lambda of type void(ResponseCode, const MonitorStatistics&) that will be called to signal the result of the request + */ + virtual void requestGetStatistics(const std::function &cb) = 0; + + + /** + * \brief Requests the device battery statistics data + * \param cb Lambda of type void(ResponseCode, const FuelgaugeStatistics&) that will be called to signal the result of the request + */ + virtual void requestGetFgStatistics(const std::function &cb) = 0; + + + /** + * \brief Requests unlocking a password protected device + * \param key 32 bytes AuthKey type used to unlock the device. This is typically the SHA256 hash of a password. + * \param cb Lambda of type void(ResponseCode) that will be called to signal the result of the request + */ + virtual void requestUnlock(const AuthKey &key, std::function cb) = 0; + + + /** + * \brief Requests setting a user password lock + * \param key 32 bytes AuthKey type used to unlock the device. This is typically the SHA256 hash of a password. + * \param cb Lambda of type void(ResponseCode) that will be called to signal the result of the request + */ + virtual void requestSetUserPasswordLock(const AuthKey &key, std::function cb) = 0; + + + /** + * \brief Requests setting a master password lock on + * \param key 32 bytes AuthKey type used to unlock the device. This is typically the SHA256 hash of a password. + * \param cb Lambda of type void(ResponseCode) that will be called to signal the result of the request + */ + virtual void requestSetMasterPasswordLock(const AuthKey &key, std::function cb) = 0; + + + /** + * \brief Requests clearing of the user password lock + * \param cb Lambda of type void(ResponseCode) that will be called to signal the result of the request + */ + virtual void requestClearUserPasswordLock(std::function cb) = 0; + + + /** + * \brief Requests clearing of the master password lock + * \param cb Lambda of type void(ResponseCode) that will be called to signal the result of the request + */ + virtual void requestClearMasterPasswordLock(std::function cb) = 0; + + + /** + * \brief Requests the authentication key from the device. This key can be used to unlock a locked device. It acts the same way as the user password lock. + * \param cb Lambda of type void(ResponseCode, const AuthKey&) that will be called to signal the result of the request + */ + virtual void requestGetAuthKey(std::function cb) = 0; + + + /** + * \brief Requests the reset of the device authentication key + * \param cb Lambda of type void(ResponseCode) that will be called to signal the result of the request + */ + virtual void requestResetAuthKey(std::function cb) = 0; + + + /** + * \brief Requests the reset of the energy meter + * \param cb Lambda of type void(ResponseCode) that will be called to signal the result of the request + */ + virtual void requestResetEnergyMeter(const std::function &cb) = 0; + + + /** + * \brief Requests the reset of the coulomb meter + * \param cb Lambda of type void(ResponseCode) that will be called to signal the result of the request + */ + virtual void requestResetCoulombMeter(const std::function &cb) = 0; + + + /** + * \brief Requests the reset of the power meter statistics + * \param cb Lambda of type void(ResponseCode) that will be called to signal the result of the request + */ + virtual void requestResetStatistics(const std::function &cb) = 0; + + + /** + * \brief Requests changing the power state + * \param state New power state (ON / OFF) + * \param cb Lambda of type void(ResponseCode) that will be called to signal the result of the request + */ + virtual void requestSetPowerState(bool state, const std::function &cb) = 0; + + + /** + * \brief Retrieves the device configuration structure + * \param cb Lambda of type void(ResponseCode, const PowermonConfig&) that will be called to signal the result of the request + */ + virtual void requestGetConfig(const std::function &cb) = 0; + + + /** + * \brief Sends new configuration to the device + * \param config New configuration structure + * \param cb Lambda of type void(ResponseCode) that will be called to signal the result of the request + */ + virtual void requestSetConfig(const PowermonConfig &config, const std::function &cb) = 0; + + + /** + * \brief Resets the PowerMon configuration to factory settings + * This will also clear the data log, reset the name, authentication keys and access keys (for WiFi devices). + * \param cb Lambda of type void(ResponseCode) that will be called to signal the result of the request. + */ + virtual void requestResetConfig(const std::function &cb) = 0; + + + /** + * \brief Requests renaming the PowerMon device + * \param name New name. For Bluetooth PowerMons the name is limited to 8 characters. For WiFi PowerMons the name can be up to 32 characters in length. + * \param cb Lambda of type void(ResponseCode) that will be called to signal the result of the request + */ + virtual void requestRename(const char* name, const std::function &cb) = 0; + + + /** + * \brief Requests setting the internal clock of the PowerMon device + * \param time New clock in UNIX format (number of seconds since Jan 1st, 1970) in localtime (not UTC) + * \param cb Lambda of type void(ResponseCode) that will be called to signal the result of the request + */ + virtual void requestSetTime(uint32_t time, const std::function &cb) = 0; + + + /** + * \brief Requests forcing the SoC to 100% (SoC synchronize) + * \param cb Lambda of type void(ResponseCode) that will be called to signal the result of the request + */ + virtual void requestFgSynchronize(const std::function &cb) = 0; + + + /** + * \brief Requests starting the WiFi scan (only applies to the WiFi PowerMons). WiFi scanning will stop automatically after a max of 5 seconds. + * \param cb Lambda of type void(ResponseCode) that will be called to signal the result of the request + */ + virtual void requestStartWifiScan(const std::function &cb) = 0; + + + /** + * \brief Sends new WiFi network credentials to the PowerMon device. + * The new credentials will be saved by the device whether PowerMon can or cannot connect to that specified network. + * \param network WiFi network credentials + * \param cb Lambda of type void(ResponseCode) that will be called to signal the result of the request + */ + virtual void requestWifiConfigure(const WifiNetwork &network, const std::function &cb) = 0; + + + /** + * \brief Requests the WiFi access keys (only applies to the WiFi PowerMons). The access keys are used to remotely access the device. + * \param cb Lambda of type void(ResponseCode, const WifiAccessKey&) that will be called to signal the result of the request + */ + virtual void requestGetAccessKeys(const std::function &cb) = 0; + + + /** + * \brief Requests resetting of the WiFi access keys (only applies to the WiFi PowerMons). This effectively severs the connection to all the paired clients. + * \param cb Lambda of type void(ResponseCode) that will be called to signal the result of the request + */ + virtual void requestResetAccessKeys(const std::function &cb) = 0; + + + /** + * \brief Requests zeroing of the current reading offset + * \param cb Lambda of type void(ResponseCode) that will be called to signal the result of the request + */ + virtual void requestZeroCurrentOffset(const std::function &cb) = 0; + + + /** + * \brief Requests calibration of the current reading + * \param value The actual current flowing through the shunt. An accurate multimeter is required to measure the current. + * \param cb Lambda of type void(ResponseCode) that will be called to signal the result of the request + */ + virtual void requestCalibrateCurrent(float value, const std::function &cb) = 0; + + + /** + * \brief Requests the list of all schedules stored in the device + * \param cb Lambda of type void(ResponseCode, const std::vector&) that will be called to signal the result of the request + */ + virtual void requestGetSchedules(const std::function&)> &cb) = 0; + + + /** + * \brief Requests adding new schedules + * \param schedules A list of schedules to add + * \param cb Lambda of type void(ResponseCode) that will be called to signal the result of the request + */ + virtual void requestAddSchedules(const std::vector &schedules, const std::function &cb) = 0; + + + /** + * \brief Requests updating an existing schedule + * \param old_schedule_descriptor The descriptor of the schedule to update + * \param new_schedule The new schedule + * \param cb Lambda of type void(ResponseCode) that will be called to signal the result of the request + */ + virtual void requestUpdateSchedule(uint64_t old_schedule_descriptor, const PowermonSchedule &new_schedule, const std::function &cb) = 0; + + + /** + * \brief Requests deleting an existing schedule + * \param schedule_descriptor The descriptor of the schedule to delete + * \param cb Lambda of type void(ResponseCode) that will be called to signal the result of the request + */ + virtual void requestDeleteSchedule(uint64_t schedule_descriptor, const std::function &cb) = 0; + + + /** + * \brief Requests clearing of all schedule + * \param cb Lambda of type void(ResponseCode) that will be called to signal the result of the request + */ + virtual void requestClearSchedules(const std::function &cb) = 0; + + + /** + * \brief Requests committing the schedules to non-volatile memory + * \param cb Lambda of type void(ResponseCode) that will be called to signal the result of the request + */ + virtual void requestCommitSchedules(const std::function &cb) = 0; + + + /** + * \brief Requests the list of log files + * \param cb Lambda of type void(ResponseCode, const std::vector&) that will be called to signal the result of the request + */ + virtual void requestGetFileList(const std::function&)> &cb) = 0; + + + /** + * \brief Requests reading of a log file + * \param file_id ID of the file to read (obtained from the LogFileDescriptor) + * \param offset Offset to read from + * \param read_size Read size in bytes + * \param cb Lambda of type void(ResponseCode, const uint8_t*, size_t) that will be called to signal the result of the request + */ + virtual void requestReadFile(uint32_t file_id, uint32_t offset, uint32_t read_size, const std::function &cb) = 0; + + + /** + * \brief Requests firmware update + * \param firmware_image The firmware update image + * \param size Size of the firmware update image + * \param progress_cb Lambda of type bool(uint32_t progress, uint32_t total) that will be called regularly with updates about the progress. + * Returning false fronm the lambda will abort the update operation. + * \param done_cb Lambda of type void(ResponseCode) that will be called to signal the result of the request upon completion of the firmware update + */ + virtual void requestUpdateFirmware(const uint8_t* firmware_image, uint32_t size, const std::function &progress_cb, + const std::function &done_cb) = 0; + + + /** + * \brief Returns the IP address as string + */ + static std::string getIpAddressString(uint32_t ip); + + + /** + * \brief Returns the Bluetooth MAC address as string + */ + static std::string getMacAddressString(uint64_t mac); + + + /** + * \brief Parses a MAC address string + */ + static uint64_t parseMacAddress(const char* address); + + + /** + * \brief Returns the hardware name based on the hardware revision in BCD format + */ + static std::string getHardwareString(uint8_t bcd); + + + /** + * \brief Returns the power status string representation + */ + static std::string getPowerStatusString(PowerStatus ps); + + + /** + * \brief Returns true if the PowerMon described by the BCD hardware revision has V2 + */ + static bool hasVoltage2(uint8_t bcd); + + + /** + * \brief Returns true if the PowerMon described by the BCD hardware revision supports configurable shunts + */ + static bool hasConfigurableShunt(uint8_t bcd); + + + /** + * \brief Returns true if the PowerMon described by the BCD hardware revision has WiFi + */ + static bool hasWifi(uint8_t bcd); + + + /** + * \brief Returns true if the parameter is a valid BCD number + */ + static inline bool checkBCD(uint16_t bcd) + { + for(uint32_t i = 0; i < 4; i++) + { + if ((bcd & 0xF) > 0x9) + return false; + bcd >>= 4; + } + + return true; + } + + /** + * \brief Generates the SHA256 hash of a password + * \param password C string containing the password + * \return Authentication key that can be used for the lock / unlock functions + */ + static AuthKey getAuthKeyFromPassword(const char* password); + + /** + * \brief Returns the update firmware image URL based on the hardware revision and firmware version. + */ + static std::string getUpdateFirmwareImageUrl(uint8_t hardware_revision_bcd, uint16_t firmware_revision_bcd); + + /** + * \brief Checks the validity of the firmware update image. + */ + static uint16_t checkFirmwareImage(const uint8_t* image, size_t size, uint8_t hardware_revision_bcd); +}; + + +#include + + +#endif diff --git a/lib/powermon/inc/powermon_config.h b/lib/powermon/inc/powermon_config.h new file mode 100644 index 0000000..8002e6c --- /dev/null +++ b/lib/powermon/inc/powermon_config.h @@ -0,0 +1,265 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _POWERMON_CONFIG_H +#define _POWERMON_CONFIG_H + + +#include +#include + + +/** + * \brief PowermonConfig is a structure containing the PowerMon configuration + */ +struct PowermonConfig +{ +public: + + enum MultiFunctionPinMode: uint32_t + { + MF_DATA = 0, //data stream + MF_TEMP = 1, //DS18B20 temperature sensor + MF_BUTTON = 2, //button input + MF_COMM = 3 //half duplex communication + }; + + + enum FuelgaugeChemistry: uint32_t + { + FG_CHEM_LEAD_FLOODED = 0, + FG_CHEM_LEAD_AGM = 1, + FG_CHEM_LIFEPO = 2, + FG_CHEM_LIION = 3, + FG_CHEM_LIPOLY = 4, + }; + + + enum LogMode: uint32_t + { + LOG_MODE_DISABLED = 0, + LOG_MODE_1_SEC = 1, + LOG_MODE_2_SEC = 2, + LOG_MODE_5_SEC = 3, + LOG_MODE_10_SEC = 4, + LOG_MODE_20_SEC = 5, + LOG_MODE_30_SEC = 6, + LOG_MODE_60_SEC = 7, + }; + + + void setMfMode(MultiFunctionPinMode mode); + MultiFunctionPinMode getMfMode(void) const; + + void setWiFiKeepAPOn(bool state); + bool getWiFiKeepAPOn(void) const; + + void setEngineShuntVdropNom(uint8_t mv); + uint8_t getEngineShuntVdropNom(void) const; + + void setEngineShuntCurrentNom(uint16_t amperes); + uint16_t getEngineShuntCurrentNom(void) const; + + void setEngineShuntCurrentMax(uint16_t amperes); + uint16_t getEngineShuntCurrentMax(void) const; + + void setEngineDisableV2(bool state); + bool getEngineDisableV2(void) const; + + void setEngineCurrentSignFlip(bool state); + bool getEngineCurrentSignFlip(void) const; + + void setEngineMeterVoltageSource(uint8_t source); + uint8_t getEngineMeterVoltageSource(void) const; + + void setOcInitialState(bool state); + bool getOcInitialState(void) const; + + void setOcInvertOutput(bool state); + bool getOcInvertOutput(void) const; + + void setOcLatchRelayOn(bool state); + bool getOcLatchRelayOn(void) const; + + void setOcConnectFilter(uint32_t filter_ms); + uint32_t getOcConnectFilter(void) const; + + void setOcLvdEnable(bool state); + bool getOcLvdEnable(void) const; + + void setOcLvdSource(uint8_t source); + uint8_t getOcLvdSource(void) const; + + void setOcLvdDisconnectThreshold(float threshold); + float getOcLvdDisconnectThreshold(void) const; + + void setOcLvdConnectThreshold(float threshold); + float getOcLvdConnectThreshold(void) const; + + void setOcLvdDisconnectFilter(uint32_t filter_ms); + uint32_t getOcLvdDisconnectFilter(void) const; + + void setOcHvdEnable(bool state); + bool getOcHvdEnable(void) const; + + void setOcHvdSource(uint8_t source); + uint8_t getOcHvdSource(void) const; + + void setOcHvdDisconnectThreshold(float threshold); + float getOcHvdDisconnectThreshold(void) const; + + void setOcHvdConnectThreshold(float threshold); + float getOcHvdConnectThreshold(void) const; + + void setOcHvdDisconnectFilter(uint32_t filter_ms); + uint32_t getOcHvdDisconnectFilter(void) const; + + void setOcOcdEnable(bool state); + bool getOcOcdEnable(void) const; + + void setOcOcdSource(uint8_t source); + uint8_t getOcOcdSource(void) const; + + void setOcOcdTripThreshold(float threshold); + float getOcOcdTripThreshold(void) const; + + void setOcOcdTripFilter(uint32_t filter_ms); + uint32_t getOcOcdTripFilter(void) const; + + void setOcLtdEnable(bool state); + bool getOcLtdEnable(void) const; + + void setOcLtdDisconnectThreshold(int8_t threshold); + int8_t getOcLtdDisconnectThreshold(void) const; + + void setOcLtdConnectThreshold(int8_t threshold); + int8_t getOcLtdConnectThreshold(void) const; + + void setOcLtdDisconnectFilter(uint32_t filter_ms); + uint32_t getOcLtdDisconnectFilter(void) const; + + void setOcHtdEnable(bool state); + bool getOcHtdEnable(void) const; + + void setOcHtdDisconnectThreshold(int8_t threshold); + int8_t getOcHtdDisconnectThreshold(void) const; + + void setOcHtdConnectThreshold(int8_t threshold); + int8_t getOcHtdConnectThreshold(void) const; + + void setOcHtdDisconnectFilter(uint32_t filter_ms); + uint32_t getOcHtdDisconnectFilter(void) const; + + void setOcFgdConnectEnable(bool state); + bool getOcFgdConnectEnable(void) const; + + void setOcFgdDisconnectEnable(bool state); + bool getOcFgdDisconnectEnable(void) const; + + void setOcFgdConnectThreshold(uint8_t threshold); + uint8_t getOcFgdConnectThreshold(void) const; + + void setOcFgdDisconnectThreshold(uint8_t threshold); + uint8_t getOcFgdDisconnectThreshold(void) const; + + void setOcAutoOnTimer(uint32_t timer_sec); + uint32_t getOcAutoOnTimer(void) const; + + void setOcAutoOffTimer(uint32_t timer_sec); + uint32_t getOcAutoOffTimer(void) const; + + void setOcGenControlEnable(bool state); + bool getOcGenControlEnable(void) const; + + void setOcGenVonEnable(bool state); + bool getOcGenVonEnable(void) const; + + void setOcGenVoffEnable(bool state); + bool getOcGenVoffEnable(void) const; + + void setOcGenSoconEnable(bool state); + bool getOcGenSoconEnable(void) const; + + void setOcGenSocoffEnable(bool state); + bool getOcGenSocoffEnable(void) const; + + void setOcGenVoltageSource(uint8_t source); + uint8_t getOcGenVoltageSource(void) const; + + void setOcGenVonThreshold(float threshold); + float getOcGenVonThreshold(void) const; + + void setOcGenVoffThreshold(float threshold); + float getOcGenVoffThreshold(void) const; + + void setOcGenSoconThreshold(uint8_t threshold); + uint8_t getOcGenSoconThreshold(void) const; + + void setOcGenSocoffThreshold(uint8_t threshold); + uint8_t getOcGenSocoffThreshold(void) const; + + void setOcGenVonFilter(uint32_t filter_ms); + uint32_t getOcGenVonFilter(void) const; + + void setOcGenTurnOffDelay(uint16_t delay_min); + uint16_t getOcGenTurnOffDelay(void) const; + + void setOcLiFePOEnable(bool state); + bool getOcLiFePOEnable(void) const; + + void setOcLiFePODesignCapacity(float capacity); + float getOcLiFePODesignCapacity(void) const; + + void setOcLiFePOCellCount(uint8_t count); + uint8_t getOcLiFePOCellCount(void) const; + + void setFgEnable(bool state); + bool getFgEnable(void) const; + + void setFgChemistry(FuelgaugeChemistry chemistry); + FuelgaugeChemistry getFgChemistry(void) const; + + void setFgCellCount(uint8_t count); + uint8_t getFgCellCount(void) const; + + void setFgVoltageSource(uint8_t source); + uint8_t getFgVoltageSource(void) const; + + void setFgDesignCapacity(float capacity); + float getFgDesignCapacity(void) const; + + void setFgManualChargeDetectionEnable(bool state); + bool getFgManualChargeDetectionEnable(void) const; + + void setFgSyncVoltageThreshold(float threshold); + float getFgSyncVoltageThreshold(void) const; + + void setFgSyncCurrentThreshold(float threshold); + float getFgSyncCurrentThreshold(void) const; + + void setFgSyncFilter(uint32_t filter_ms); + uint32_t getFgSyncFilter(void) const; + + void setLogMode(LogMode mode); + LogMode getLogMode(void) const; + +private: + uint8_t mRawConfig[104] alignas(4); +}; + + +#endif diff --git a/lib/powermon/inc/powermon_log.h b/lib/powermon/inc/powermon_log.h new file mode 100644 index 0000000..1598638 --- /dev/null +++ b/lib/powermon/inc/powermon_log.h @@ -0,0 +1,119 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _POWERMON_LOG_H +#define _POWERMON_LOG_H + + +#include + +#include +#include +#include + + +/** + * \brief PowermonLogFile is a class representing a PowerMon log file. It also contains support to decode the data points from a log file. + */ +class PowermonLogFile +{ +public: + enum Version + { + VER_FAMILY_MASK = 0xF0, + VER_POWERMON_WIFI_5W = 0x00, + }; + + struct Sample + { + uint32_t time; + float voltage1; + float voltage2; + float current; + float power; + float temperature; + uint8_t soc; + uint8_t ps; + }; + + static uint32_t decode(const std::vector &data, std::vector &samples); + +private: + enum Flags + { + POWER_VOLTAGE_SOURCE = (1 << 0) + }; + + enum Mask + { + V1 = (1 << 0), + V2 = (1 << 1), + V3 = (1 << 2), + V4 = (1 << 3), + V5 = (1 << 4), + V6 = (1 << 5), + + I1 = (1 << 6), + I2 = (1 << 7), + + P1 = (1 << 8), + P2 = (1 << 9), + + T1 = (1 << 10), + T2 = (1 << 11), + + SOC1 = (1 << 12), + SOC2 = (1 << 13), + + PS1 = (1 << 14), + PS2 = (1 << 15), + + VOLTAGE_SOURCE = (1 << 31) + }; + + struct Header + { + uint8_t magic[4]; + + uint8_t version; + uint8_t mode; + uint16_t reserved0; + + uint32_t time; + + uint32_t mask; + uint32_t flags; + }; + + static uint32_t getSamplePeriodInSeconds(uint8_t mode) + { + switch(mode) + { + case PowermonConfig::LOG_MODE_1_SEC: return 1; + case PowermonConfig::LOG_MODE_2_SEC: return 2; + case PowermonConfig::LOG_MODE_5_SEC: return 5; + case PowermonConfig::LOG_MODE_10_SEC: return 10; + case PowermonConfig::LOG_MODE_20_SEC: return 20; + case PowermonConfig::LOG_MODE_30_SEC: return 30; + case PowermonConfig::LOG_MODE_60_SEC: return 60; + } + + return 0; + } +}; + +#endif diff --git a/lib/powermon/inc/powermon_scanner.h b/lib/powermon/inc/powermon_scanner.h new file mode 100644 index 0000000..0b8e477 --- /dev/null +++ b/lib/powermon/inc/powermon_scanner.h @@ -0,0 +1,105 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _POWERMON_SCANNER_H +#define _POWERMON_SCANNER_H + + +#include +#include +#include + + +/** + * \brief PowermonScanner offers support for scanning for PowerMon advertisments. Both BLE and WiFi PowerMon devices are supported. + */ +class PowermonScanner +{ +public: + /** + * \brief Advertisment is a structure representing an advertisment packet received from the PowerMon device. + */ + struct Advertisment + { + uint64_t serial; + uint64_t address; + + uint32_t time; + uint32_t flags; + + float voltage1; + float voltage2; + float current; + float power; + + float coulomb_meter; + float power_meter; + + float temperature; + + std::string name; + + uint16_t firmware_version_bcd; + uint8_t hardware_revision_bcd; + + Powermon::PowerStatus power_status; + + uint8_t soc; + uint16_t runtime; + + int16_t rssi; + + bool isExternalTemperature(void) const; + }; + + + /** + * \brief Creates an instance of the PowermonScanner class + * \return Pointer to the newly created PowermonScanner object. Must be freed using delete(). + */ + static PowermonScanner* createInstance(void); + virtual ~PowermonScanner(); + + /** + * \brief Sets the callback to be called by the Powermon scanner when a new advertisment has been received + * \param cb Lambda of type `void(const Advertisment&)` + */ + virtual void setCallback(const std::function &cb) = 0; + + /** + * \brief Starts scanning for WiFi device advertisments + */ + virtual void startWifiScan(void) = 0; + + /** + * \brief Stops scanning for WiFi device advertisments + */ + virtual void stopWifiScan(void) = 0; + + /** + * Starts scanning for BLE device advertisments + */ + virtual void startBleScan(void) = 0; + + /** + * Stops scanning for BLE device advertisments + */ + virtual void stopBleScan(void) = 0; +}; + + +#endif diff --git a/lib/powermon/inc/powermon_schedule.h b/lib/powermon/inc/powermon_schedule.h new file mode 100644 index 0000000..614bc01 --- /dev/null +++ b/lib/powermon/inc/powermon_schedule.h @@ -0,0 +1,68 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _POWERMON_SCHEDULE_H +#define _POWERMON_SCHEDULE_H + + +#include +#include + + +/** + * \brief PowermonSchedule is a structure containing one PowerMon schedule (timer) + */ +struct PowermonSchedule +{ +public: + PowermonSchedule(); + + bool operator==(const PowermonSchedule &rhs) const; + + const char* getName(void) const; + void setName(const char* name); + + uint64_t getDescriptor(void) const; + void setDescriptor(uint64_t descriptor); + + uint32_t getStartHour(void) const; + void setStartHour(uint32_t value); + + uint32_t getStartMinute(void) const; + void setStartMinute(uint32_t value); + + uint32_t getEndHour(void) const; + void setEndHour(uint32_t value); + + uint32_t getEndMinute(void) const; + void setEndMinute(uint32_t value); + + bool isRepeatDOW(void) const; + void setRepeatDOW(void); + + bool isRepeatDOM(void) const; + void setRepeatDOM(void); + + uint8_t getRepeat(void) const; + void setRepeat(uint8_t value); + +private: + uint8_t mRawSchedule[24]; +}; + + +#endif diff --git a/lib/powermon/powermon_lib.a b/lib/powermon/powermon_lib.a new file mode 100644 index 0000000..22325a0 --- /dev/null +++ b/lib/powermon/powermon_lib.a Binary files differ diff --git a/lib/powermon/powermon_lib.lib b/lib/powermon/powermon_lib.lib new file mode 100644 index 0000000..810f373 --- /dev/null +++ b/lib/powermon/powermon_lib.lib Binary files differ diff --git a/lib/powermon/powermon_libd.lib b/lib/powermon/powermon_libd.lib new file mode 100644 index 0000000..08f303e --- /dev/null +++ b/lib/powermon/powermon_libd.lib Binary files differ diff --git a/lib/wxWidgets/include/msvc/wx/setup.h b/lib/wxWidgets/include/msvc/wx/setup.h new file mode 100644 index 0000000..cd7f2ca --- /dev/null +++ b/lib/wxWidgets/include/msvc/wx/setup.h @@ -0,0 +1,297 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 +// Copyright: (c) 2004 Vadim Zeitlin +// 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! + +#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 + #define wxSUFFIX ud + #else // !_UNICODE + #define wxSUFFIX d + #endif // _UNICODE/!_UNICODE +#else + #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 +// +// There is an additional complication with MSVC 14.0, 14.1 and 14.2 versions +// (a.k.a. MSVS 2015, 2017 and 2019): as they're all ABI-compatible with each +// other, it is convenient to use the same "vc14x" compiler prefix for all of +// them, but this is not how wxMSVC_VERSION_AUTO behaves by default, so you +// need to additionally define wxMSVC_VERSION_ABI_COMPAT to opt in into using +// this "vc14x" prefix. +#ifdef wxMSVC_VERSION + #define wxCOMPILER_PREFIX wxCONCAT(vc, wxMSVC_VERSION) +#elif defined(wxMSVC_VERSION_AUTO) || defined(wxMSVC_VERSION_ABI_COMPAT) + #if _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 + #elif _MSC_VER >= 1900 && _MSC_VER < 2000 + #ifdef wxMSVC_VERSION_ABI_COMPAT + #define wxCOMPILER_PREFIX vc14x + #else + #if _MSC_VER < 1910 + #define wxCOMPILER_PREFIX vc140 + #elif _MSC_VER >= 1910 && _MSC_VER < 1920 + #define wxCOMPILER_PREFIX vc141 + #elif _MSC_VER >= 1920 && _MSC_VER < 1930 + #define wxCOMPILER_PREFIX vc142 + #elif _MSC_VER >= 1930 && _MSC_VER < 2000 + #define wxCOMPILER_PREFIX vc143 + #else + #error "Unknown MSVC 14.x compiler version, please report to wx-dev." + #endif + #endif + #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 +#elif defined(_M_ARM64) + #define wxARCH_SUFFIX _arm64 +#elif defined(_M_IA64) + #define wxARCH_SUFFIX _ia64 +#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 + +#ifdef wxSUFFIX + #define wxTOOLKIT_FULL wxCONCAT(wxTOOLKIT_PREFIX, wxSUFFIX) +#else // suffix is empty + #define wxTOOLKIT_FULL wxTOOLKIT_PREFIX +#endif + +// the real setup.h header file we need is in the build-specific directory, +// construct the path to it +#define wxSETUPH_PATH ../../../lib/wxLIB_SUBDIR/wxTOOLKIT_FULL/wx/setup.h + +#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 + +#if defined(wxMONOLITHIC) && wxMONOLITHIC == 1 + #pragma comment(lib, wxWX_LIB_NAME("msw", "")) +#else + #pragma comment(lib, wxWX_LIB_NAME("base", "")) + + #ifndef wxNO_NET_LIB + #pragma comment(lib, wxBASE_LIB_NAME("net")) + #endif + #if wxUSE_XML && !defined(wxNO_XML_LIB) + #pragma comment(lib, wxBASE_LIB_NAME("xml")) + #endif +#endif // defined(wxMONOLITHIC) && wxMONOLITHIC == 1 + +#if !defined(WXUSINGDLL) + #if !defined(wxNO_NET_LIB) + #pragma comment(lib, "ws2_32") + #endif + + #if wxUSE_XML && !defined(wxNO_XML_LIB) && !defined(wxNO_EXPAT_LIB) + #pragma comment(lib, wx3RD_PARTY_LIB_NAME("expat")) + #endif + + #if wxUSE_REGEX && !defined(wxNO_REGEX_LIB) + #pragma comment(lib, wx3RD_PARTY_LIB_NAME_U("regex")) + #endif + #if wxUSE_ZLIB && !defined(wxNO_ZLIB_LIB) + #pragma comment(lib, wx3RD_PARTY_LIB_NAME("zlib")) + #endif +#endif // !defined(WXUSINGDLL) + +#if wxUSE_GUI + #if !defined(WXUSINGDLL) + #if wxUSE_LIBJPEG && !defined(wxNO_JPEG_LIB) + #pragma comment(lib, wx3RD_PARTY_LIB_NAME("jpeg")) + #endif + #if wxUSE_LIBPNG && !defined(wxNO_PNG_LIB) + #pragma comment(lib, wx3RD_PARTY_LIB_NAME("png")) + #endif + #if wxUSE_LIBTIFF && !defined(wxNO_TIFF_LIB) + #pragma comment(lib, wx3RD_PARTY_LIB_NAME("tiff")) + #endif + #if wxUSE_STC && !defined(wxNO_STC_LIB) + #pragma comment(lib, wx3RD_PARTY_LIB_NAME("scintilla")) + #endif + #endif // !defined(WXUSINGDLL) + + + #if !defined(wxMONOLITHIC) || wxMONOLITHIC == 0 + + #pragma comment(lib, wxTOOLKIT_LIB_NAME("core")) + + #if wxUSE_HTML && !defined(wxNO_HTML_LIB) + #pragma comment(lib, wxTOOLKIT_LIB_NAME("html")) + #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")) + #endif + #if wxUSE_WEBVIEW && !defined(wxNO_WEBVIEW_LIB) + #pragma comment(lib, wxTOOLKIT_LIB_NAME("webview")) + #endif + #endif // !defined(wxMONOLITHIC) || wxMONOLITHIC == 0 + + #if wxUSE_GLCANVAS && !defined(wxNO_GL_LIB) + #pragma comment(lib, wxTOOLKIT_LIB_NAME("gl")) + #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__ + #ifdef __WXGTK3__ + #pragma comment(lib, "libgtk-3.dll.a") + #pragma comment(lib, "libgdk-3.dll.a") + #else + #pragma comment(lib, "gtk-win32-2.0.lib") + #pragma comment(lib, "gdk-win32-2.0.lib") + #endif + #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 diff --git a/lib/wxWidgets/include/wx/aboutdlg.h b/lib/wxWidgets/include/wx/aboutdlg.h new file mode 100644 index 0000000..0143154 --- /dev/null +++ b/lib/wxWidgets/include/wx/aboutdlg.h @@ -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 +// 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_ + diff --git a/lib/wxWidgets/include/wx/accel.h b/lib/wxWidgets/include/wx/accel.h new file mode 100644 index 0000000..6011c39 --- /dev/null +++ b/lib/wxWidgets/include/wx/accel.h @@ -0,0 +1,162 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/accel.h +// Purpose: wxAcceleratorEntry and wxAcceleratorTable classes +// Author: Julian Smart, Robert Roebling, Vadim Zeitlin +// Modified by: +// Created: 31.05.01 (extracted from other files) +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ACCEL_H_BASE_ +#define _WX_ACCEL_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_ACCEL + +#include "wx/object.h" + +class WXDLLIMPEXP_FWD_CORE wxAcceleratorTable; +class WXDLLIMPEXP_FWD_CORE wxMenuItem; +class WXDLLIMPEXP_FWD_CORE wxKeyEvent; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// wxAcceleratorEntry flags +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__) + wxACCEL_RAW_CTRL= 0x0008, // +#else + wxACCEL_RAW_CTRL= wxACCEL_CTRL, +#endif + wxACCEL_CMD = wxACCEL_CTRL +}; + +// ---------------------------------------------------------------------------- +// an entry in wxAcceleratorTable corresponds to one accelerator +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxAcceleratorEntry +{ +public: + wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0, + wxMenuItem *item = NULL) + : m_flags(flags) + , m_keyCode(keyCode) + , m_command(cmd) + , m_item(item) + { } + + // create accelerator corresponding to the specified string, return NULL if + // string couldn't be parsed or a pointer to be deleted by the caller + static wxAcceleratorEntry *Create(const wxString& str); + + void Set(int flags, int keyCode, int cmd, wxMenuItem *item = NULL) + { + m_flags = flags; + m_keyCode = keyCode; + m_command = cmd; + m_item = item; + } + + void SetMenuItem(wxMenuItem *item) { m_item = item; } + + int GetFlags() const { return m_flags; } + int GetKeyCode() const { return m_keyCode; } + int GetCommand() const { return m_command; } + + wxMenuItem *GetMenuItem() const { return m_item; } + + bool operator==(const wxAcceleratorEntry& entry) const + { + return m_flags == entry.m_flags && + m_keyCode == entry.m_keyCode && + m_command == entry.m_command && + m_item == entry.m_item; + } + + bool operator!=(const wxAcceleratorEntry& entry) const + { return !(*this == entry); } + +#if defined(__WXMOTIF__) + // Implementation use only + bool MatchesEvent(const wxKeyEvent& event) const; +#endif + + bool IsOk() const + { + return m_keyCode != 0; + } + + + // string <-> wxAcceleratorEntry conversion + // ---------------------------------------- + + // returns a wxString for this accelerator. + // this function formats it using the - format + // where 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) + bool FromString(const wxString& str); + + +private: + wxString AsPossiblyLocalizedString(bool localized) const; + + // common part of Create() and FromString() + static bool ParseAccel(const wxString& str, int *flags, int *keycode); + + + int m_flags; // combination of wxACCEL_XXX constants + int m_keyCode; // ASCII or virtual keycode + int m_command; // Command id to generate + + // the menu item this entry corresponds to, may be NULL + wxMenuItem *m_item; + + // for compatibility with old code, use accessors now! + friend class WXDLLIMPEXP_FWD_CORE wxMenu; +}; + +// ---------------------------------------------------------------------------- +// include wxAcceleratorTable class declaration, it is only used by the library +// and so doesn't have any published user visible interface +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + #include "wx/generic/accel.h" +#elif defined(__WXMSW__) + #include "wx/msw/accel.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/accel.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/accel.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/accel.h" +#elif defined(__WXMAC__) + #include "wx/osx/accel.h" +#elif defined(__WXQT__) + #include "wx/qt/accel.h" +#endif + +extern WXDLLIMPEXP_DATA_CORE(wxAcceleratorTable) wxNullAcceleratorTable; + +#endif // wxUSE_ACCEL + +#endif + // _WX_ACCEL_H_BASE_ diff --git a/lib/wxWidgets/include/wx/access.h b/lib/wxWidgets/include/wx/access.h new file mode 100644 index 0000000..4948969 --- /dev/null +++ b/lib/wxWidgets/include/wx/access.h @@ -0,0 +1,377 @@ +///////////////////////////////////////////////////////////////////////////// +// 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" + +enum wxAccStatus +{ + wxACC_FAIL, + wxACC_FALSE, + wxACC_OK, + wxACC_NOT_IMPLEMENTED, + wxACC_NOT_SUPPORTED, + wxACC_INVALID_ARG +}; + +// Child ids are integer identifiers from 1 up. +// So zero represents 'this' object. +#define wxACC_SELF 0 + +// Navigation constants + +enum wxNavDir +{ + wxNAVDIR_DOWN, + wxNAVDIR_FIRSTCHILD, + wxNAVDIR_LASTCHILD, + wxNAVDIR_LEFT, + wxNAVDIR_NEXT, + wxNAVDIR_PREVIOUS, + wxNAVDIR_RIGHT, + wxNAVDIR_UP +}; + +// Role constants + +enum wxAccRole { + 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 +}; + +// Object types + +enum wxAccObject { + 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 +}; + +// 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 + +enum wxAccSelectionFlags +{ + wxACC_SEL_NONE = 0, + wxACC_SEL_TAKEFOCUS = 1, + wxACC_SEL_TAKESELECTION = 2, + wxACC_SEL_EXTENDSELECTION = 4, + wxACC_SEL_ADDSELECTION = 8, + wxACC_SEL_REMOVESELECTION = 16 +}; + +// 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_ + diff --git a/lib/wxWidgets/include/wx/activityindicator.h b/lib/wxWidgets/include/wx/activityindicator.h new file mode 100644 index 0000000..2d01bdb --- /dev/null +++ b/lib/wxWidgets/include/wx/activityindicator.h @@ -0,0 +1,60 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/activityindicator.h +// Purpose: wxActivityIndicator declaration. +// Author: Vadim Zeitlin +// Created: 2015-03-05 +// Copyright: (c) 2015 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ACTIVITYINDICATOR_H_ +#define _WX_ACTIVITYINDICATOR_H_ + +#include "wx/defs.h" + +#if wxUSE_ACTIVITYINDICATOR + +#include "wx/control.h" + +#define wxActivityIndicatorNameStr wxS("activityindicator") + +// ---------------------------------------------------------------------------- +// wxActivityIndicator: small animated indicator of some application activity. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxActivityIndicatorBase : public wxControl +{ +public: + // Start or stop the activity animation (it is stopped initially). + virtual void Start() = 0; + virtual void Stop() = 0; + + // Return true if the control is currently showing activity. + virtual bool IsRunning() const = 0; + + // Override some base class virtual methods. + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } + virtual bool HasTransparentBackground() wxOVERRIDE { return true; } + +protected: + // choose the default border for this window + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } +}; + +#ifndef __WXUNIVERSAL__ +#if defined(__WXGTK220__) + #define wxHAS_NATIVE_ACTIVITYINDICATOR + #include "wx/gtk/activityindicator.h" +#elif defined(__WXOSX_COCOA__) + #define wxHAS_NATIVE_ACTIVITYINDICATOR + #include "wx/osx/activityindicator.h" +#endif +#endif // !__WXUNIVERSAL__ + +#ifndef wxHAS_NATIVE_ACTIVITYINDICATOR + #include "wx/generic/activityindicator.h" +#endif + +#endif // wxUSE_ACTIVITYINDICATOR + +#endif // _WX_ACTIVITYINDICATOR_H_ diff --git a/lib/wxWidgets/include/wx/addremovectrl.h b/lib/wxWidgets/include/wx/addremovectrl.h new file mode 100644 index 0000000..617dfa1 --- /dev/null +++ b/lib/wxWidgets/include/wx/addremovectrl.h @@ -0,0 +1,109 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/addremovectrl.h +// Purpose: wxAddRemoveCtrl declaration. +// Author: Vadim Zeitlin +// Created: 2015-01-29 +// Copyright: (c) 2015 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ADDREMOVECTRL_H_ +#define _WX_ADDREMOVECTRL_H_ + +#include "wx/panel.h" + +#if wxUSE_ADDREMOVECTRL + +extern WXDLLIMPEXP_DATA_CORE(const char) wxAddRemoveCtrlNameStr[]; + +// ---------------------------------------------------------------------------- +// wxAddRemoveAdaptor: used by wxAddRemoveCtrl to work with the list control +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxAddRemoveAdaptor +{ +public: + // Default ctor and trivial but virtual dtor. + wxAddRemoveAdaptor() { } + virtual ~wxAddRemoveAdaptor() { } + + // Override to return the associated control. + virtual wxWindow* GetItemsCtrl() const = 0; + + // Override to return whether a new item can be added to the control. + virtual bool CanAdd() const = 0; + + // Override to return whether the currently selected item (if any) can be + // removed from the control. + virtual bool CanRemove() const = 0; + + // Called when an item should be added, can only be called if CanAdd() + // currently returns true. + virtual void OnAdd() = 0; + + // Called when the current item should be removed, can only be called if + // CanRemove() currently returns true. + virtual void OnRemove() = 0; + +private: + wxDECLARE_NO_COPY_CLASS(wxAddRemoveAdaptor); +}; + +// ---------------------------------------------------------------------------- +// wxAddRemoveCtrl: a list-like control combined with add/remove buttons +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxAddRemoveCtrl : public wxPanel +{ +public: + wxAddRemoveCtrl() + { + Init(); + } + + wxAddRemoveCtrl(wxWindow* parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxAddRemoveCtrlNameStr)) + { + Init(); + + Create(parent, winid, pos, size, style, name); + } + + bool Create(wxWindow* parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxAddRemoveCtrlNameStr)); + + virtual ~wxAddRemoveCtrl(); + + // Must be called for the control to be usable, takes ownership of the + // pointer. + void SetAdaptor(wxAddRemoveAdaptor* adaptor); + + // Set tooltips to use for the add and remove buttons. + void SetButtonsToolTips(const wxString& addtip, const wxString& removetip); + +protected: + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + +private: + // Common part of all ctors. + void Init() + { + m_impl = NULL; + } + + class wxAddRemoveImpl* m_impl; + + wxDECLARE_NO_COPY_CLASS(wxAddRemoveCtrl); +}; + +#endif // wxUSE_ADDREMOVECTRL + +#endif // _WX_ADDREMOVECTRL_H_ diff --git a/lib/wxWidgets/include/wx/affinematrix2d.h b/lib/wxWidgets/include/wx/affinematrix2d.h new file mode 100644 index 0000000..ce383a9 --- /dev/null +++ b/lib/wxWidgets/include/wx/affinematrix2d.h @@ -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) wxOVERRIDE; + virtual void Get(wxMatrix2D* mat2D, wxPoint2DDouble* tr) const wxOVERRIDE; + virtual void Concat(const wxAffineMatrix2DBase& t) wxOVERRIDE; + virtual bool Invert() wxOVERRIDE; + virtual bool IsIdentity() const wxOVERRIDE; + virtual bool IsEqual(const wxAffineMatrix2DBase& t) const wxOVERRIDE; + virtual void Translate(wxDouble dx, wxDouble dy) wxOVERRIDE; + virtual void Scale(wxDouble xScale, wxDouble yScale) wxOVERRIDE; + virtual void Rotate(wxDouble cRadians) wxOVERRIDE; + +protected: + virtual wxPoint2DDouble DoTransformPoint(const wxPoint2DDouble& p) const wxOVERRIDE; + virtual wxPoint2DDouble DoTransformDistance(const wxPoint2DDouble& p) const wxOVERRIDE; + +private: + wxDouble m_11, m_12, m_21, m_22, m_tx, m_ty; +}; + +#endif // wxUSE_GEOMETRY + +#endif // _WX_AFFINEMATRIX2D_H_ diff --git a/lib/wxWidgets/include/wx/affinematrix2dbase.h b/lib/wxWidgets/include/wx/affinematrix2dbase.h new file mode 100644 index 0000000..f2d51d2 --- /dev/null +++ b/lib/wxWidgets/include/wx/affinematrix2dbase.h @@ -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 values 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_ diff --git a/lib/wxWidgets/include/wx/afterstd.h b/lib/wxWidgets/include/wx/afterstd.h new file mode 100644 index 0000000..5594f69 --- /dev/null +++ b/lib/wxWidgets/include/wx/afterstd.h @@ -0,0 +1,27 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/afterstd.h +// Purpose: #include after STL headers +// Author: Vadim Zeitlin +// Modified by: +// Created: 07/07/03 +// Copyright: (c) 2003 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +/** + See the comments in beforestd.h. + */ + +#if defined(__WINDOWS__) + #include "wx/msw/winundef.h" +#endif + +// undo what we did in wx/beforestd.h +#if defined(__VISUALC__) && __VISUALC__ >= 1910 + #pragma warning(pop) +#endif // VC++ >= 14.1 + +// see beforestd.h for explanation +#if defined(HAVE_VISIBILITY) && defined(HAVE_BROKEN_LIBSTDCXX_VISIBILITY) + #pragma GCC visibility pop +#endif diff --git a/lib/wxWidgets/include/wx/android/chkconf.h b/lib/wxWidgets/include/wx/android/chkconf.h new file mode 100644 index 0000000..5ad1922 --- /dev/null +++ b/lib/wxWidgets/include/wx/android/chkconf.h @@ -0,0 +1,236 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/android/chkconf.h +// Purpose: Android-specific configuration options checks +// Author: Zsolt Bakcsi +// Modified by: +// Created: 2011-12-08 +// RCS-ID: +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ANDROID_CHKCONF_H_ +#define _WX_ANDROID_CHKCONF_H_ + +// For Qt under Android, use default configuration procedure as most features +// should be supported (see documentation for more information) + +#ifndef __WXQT__ + +// ---------------------------------------------------------------------------- +// Disable features which don't work (yet) or don't make sense under Android. +// ---------------------------------------------------------------------------- + +// please keep the list in alphabetic order except for closely related settings +// (e.g. wxUSE_ENH_METAFILE is put immediately after wxUSE_METAFILE) + + +// ---------------------------------------------------------------------------- +// These are disabled because they are TODO. Or to decide whether to do or not. +// ---------------------------------------------------------------------------- + +#undef wxUSE_CONFIG +#define wxUSE_CONFIG 0 + +// This compiles, but not yet tested, so: +#undef wxUSE_CONSOLE_EVENTLOOP +#define wxUSE_CONSOLE_EVENTLOOP 0 + +#undef wxUSE_DEBUGREPORT +#define wxUSE_DEBUGREPORT 0 + +#undef wxUSE_DIALUP_MANAGER +#define wxUSE_DIALUP_MANAGER 0 + +#undef wxUSE_DISPLAY +#define wxUSE_DISPLAY 0 + +#undef wxUSE_DYNAMIC_LOADER +#define wxUSE_DYNAMIC_LOADER 0 + +#undef wxUSE_DYNLIB_CLASS +#define wxUSE_DYNLIB_CLASS 0 + +#undef wxUSE_FSVOLUME +#define wxUSE_FSVOLUME 0 + +// Compile-time errors when last tried (wxHAS_INOTIFY, wxHAS_KQUEUE) +#undef wxUSE_FSWATCHER +#define wxUSE_FSWATCHER 0 + +// Seems like Android lacks locale support. TODO: check! +// Hint: +// http://groups.google.com/group/android-ndk/browse_thread/thread/ffd012a047ec2392?pli=1 +// "Android doesn't provide locale support in its C and C++ runtimes. +// This is handled at a higher-level in the application stack, using ICU +// (which is not exposed by the NDK, since the ABI is very volatile, and the +// set of built-in tables varies from device to device, based on customization +// / size reasons). +// You might want to use a different locale implementation. The STLport and GNU +// libstdc++ do provide then if you're using C++." +#undef wxUSE_INTL +#define wxUSE_INTL 0 +#undef wxUSE_XLOCALE +#define wxUSE_XLOCALE 0 + +#undef wxUSE_IPC +#define wxUSE_IPC 0 + +#undef wxUSE_MEDIACTRL +#define wxUSE_MEDIACTRL 0 + +#undef wxUSE_ON_FATAL_EXCEPTION +#define wxUSE_ON_FATAL_EXCEPTION 0 + +#undef wxUSE_REGEX +#define wxUSE_REGEX 0 + +#undef wxUSE_STDPATHS +#define wxUSE_STDPATHS 0 + +#undef wxUSE_STACKWALKER +#define wxUSE_STACKWALKER 0 + +#undef wxUSE_MIMETYPE +#define wxUSE_MIMETYPE 0 + +#undef wxUSE_REGEX +#define wxUSE_REGEX 0 + +#undef wxUSE_REGKEY +#define wxUSE_REGKEY 0 + +#undef wxUSE_SNGLINST_CHECKER +#define wxUSE_SNGLINST_CHECKER 0 + +#undef wxUSE_SOUND +#define wxUSE_SOUND 0 + +#undef wxUSE_SYSTEM_OPTIONS +#define wxUSE_SYSTEM_OPTIONS 0 + +#undef wxUSE_XRC +#define wxUSE_XRC 0 + + +// ---------------------------------------------------------------------------- +// GUI is completely TODO. +// ---------------------------------------------------------------------------- + +#undef wxUSE_COLOURPICKERCTRL +#define wxUSE_COLOURPICKERCTRL 0 + +#undef wxUSE_COLOURDLG +#define wxUSE_COLOURDLG 0 + +#undef wxUSE_FONTENUM +#define wxUSE_FONTENUM 0 + +#undef wxUSE_FONTMAP +#define wxUSE_FONTMAP 0 + +#undef wxUSE_HELP +#define wxUSE_HELP 0 + +#undef wxUSE_HTML +#define wxUSE_HTML 0 + +#undef wxUSE_LISTBOOK +#define wxUSE_LISTBOOK 0 + +#undef wxUSE_OWNER_DRAWN +#define wxUSE_OWNER_DRAWN 0 + +#undef wxUSE_NOTEBOOK +#define wxUSE_NOTEBOOK 0 + +#undef wxUSE_RICHEDIT +#define wxUSE_RICHEDIT 0 +#undef wxUSE_RICHEDIT2 +#define wxUSE_RICHEDIT2 0 + +#undef wxUSE_STATUSBAR +#define wxUSE_STATUSBAR 0 + +// Are tooltips useful at all on a touch screen? +#undef wxUSE_TOOLTIPS +#define wxUSE_TOOLTIPS 0 + +#undef wxUSE_WXHTML_HELP +#define wxUSE_WXHTML_HELP 0 + + +// ---------------------------------------------------------------------------- +// All image classes are TODO. +// ---------------------------------------------------------------------------- + +#undef wxUSE_IMAGE +#define wxUSE_IMAGE 0 + +#undef wxUSE_LIBPNG +#define wxUSE_LIBPNG 0 + +#undef wxUSE_LIBJPEG +#define wxUSE_LIBJPEG 0 + +#undef wxUSE_LIBTIFF +#define wxUSE_LIBTIFF 0 + +#undef wxUSE_TGA +#define wxUSE_TGA 0 + +#undef wxUSE_GIF +#define wxUSE_GIF 0 + +#undef wxUSE_PNM +#define wxUSE_PNM 0 + +#undef wxUSE_PCX +#define wxUSE_PCX 0 + +#undef wxUSE_IFF +#define wxUSE_IFF 0 + +#undef wxUSE_XPM +#define wxUSE_XPM 0 + +#undef wxUSE_ICO_CUR +#define wxUSE_ICO_CUR 0 + +#undef wxUSE_PALETTE +#define wxUSE_PALETTE 0 + + + +// ---------------------------------------------------------------------------- +// These are disabled because they don't make sense, are not supported, or +// would require too much effort. +// ---------------------------------------------------------------------------- + +// Unnecessary under Android, probably it doesn't even compile. +#undef wxUSE_AUI +#define wxUSE_AUI 0 + +// No command line on Android. +#undef wxUSE_CMDLINE_PARSER +#define wxUSE_CMDLINE_PARSER 0 + +// No joystick on Android devices. +// (What about using the direction sensor or the accelerometer?) +#undef wxUSE_JOYSTICK +#define wxUSE_JOYSTICK 0 + +// No MDI under Android. Well, no GUI at all (yet). +#undef wxUSE_MDI +#define wxUSE_MDI 0 +#undef wxUSE_MDI_ARCHITECTURE +#define wxUSE_MDI_ARCHITECTURE 0 + +// No printing support on Android (2011). +// Although 3rd party SDKs may exist (I know of one payware). +#undef wxUSE_PRINTING_ARCHITECTURE +#define wxUSE_PRINTING_ARCHITECTURE 0 + +#endif // __WXQT__ + +#endif // _WX_ANDROID_CHKCONF_H_ diff --git a/lib/wxWidgets/include/wx/android/config_android.h b/lib/wxWidgets/include/wx/android/config_android.h new file mode 100644 index 0000000..eebbb1a --- /dev/null +++ b/lib/wxWidgets/include/wx/android/config_android.h @@ -0,0 +1,63 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/android/config_android.h +// Purpose: configurations for Android builds +// Author: Zsolt Bakcsi +// Modified by: +// Created: 2011-12-02 +// RCS-ID: +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// Please note that most of these settings are based on config_xcode.h and +// 'fine-tuned' on a trial-and-error basis. This means, no in-depth analysis +// of Android docs / source was done. + +// For Qt under Android, use the default configuration procedure as most +// features should be supported and the following fixed definitions will +// cause compiler warnings or other issues. + +#if !defined(__WXQT__) + +#define wxUSE_UNIX 1 +#define __UNIX__ 1 + +#define HAVE_NANOSLEEP +#define HAVE_FCNTL 1 +#define HAVE_GCC_ATOMIC_BUILTINS +#define HAVE_GETHOSTBYNAME 1 +#define HAVE_GETSERVBYNAME 1 +#define HAVE_GETTIMEOFDAY 1 +#define HAVE_GMTIME_R 1 +#define HAVE_INET_ADDR 1 +#define HAVE_INET_ATON 1 +#define HAVE_LOCALTIME_R 1 +#define HAVE_PTHREAD_MUTEXATTR_T 1 +#define HAVE_PTHREAD_MUTEXATTR_SETTYPE_DECL 1 +#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 +#define HAVE_THREAD_PRIORITY_FUNCTIONS 1 +#define HAVE_SSIZE_T 1 +#define HAVE_WPRINTF 1 + +#define SIZEOF_INT 4 +#define SIZEOF_LONG 4 +#define SIZEOF_LONG_LONG 8 +#define SIZEOF_SIZE_T 4 +#define SIZEOF_VOID_P 4 +#define SIZEOF_WCHAR_T 4 + +#define wxHAVE_PTHREAD_CLEANUP 1 +#define wxNO_WOSTREAM +#define wxSIZE_T_IS_UINT 1 +#define wxWCHAR_T_IS_REAL_TYPE 1 + +#define wxTYPE_SA_HANDLER int + +#define wxUSE_SELECT_DISPATCHER 1 + +#ifdef HAVE_PTHREAD_CANCEL +// Android doesn't support pthread_cancel(). +#undef HAVE_PTHREAD_CANCEL +#endif + +#endif diff --git a/lib/wxWidgets/include/wx/android/setup.h b/lib/wxWidgets/include/wx/android/setup.h new file mode 100644 index 0000000..248a9b1 --- /dev/null +++ b/lib/wxWidgets/include/wx/android/setup.h @@ -0,0 +1,1771 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/android/setup.h +// Purpose: Configuration for the android build of the library +// Author: Julian Smart +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SETUP_H_ +#define _WX_SETUP_H_ + +/* --- start common options --- */ +// ---------------------------------------------------------------------------- +// global settings +// ---------------------------------------------------------------------------- + +// define this to 0 when building wxBase library - this can also be done from +// makefile/project file overriding the value here +#ifndef wxUSE_GUI + #define wxUSE_GUI 1 +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// compatibility settings +// ---------------------------------------------------------------------------- + +// This setting determines the compatibility with 2.8 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_8 0 + +// This setting determines the compatibility with 3.0 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_3_0 1 + +// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when +// default system font is used for wxWindow::GetCharWidth/Height() instead of +// the current font. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxDIALOG_UNIT_COMPATIBILITY 0 + +// Provide unsafe implicit conversions in wxString to "const char*" or +// "std::string" (depending on wxUSE_STD_STRING_CONV_IN_WXSTRING value). +// +// Default is 1 but only for compatibility reasons, it is recommended to set +// this to 0 because converting wxString to a narrow (non-Unicode) string may +// fail unless a locale using UTF-8 encoding is used, which is never the case +// under MSW, for example, hence such conversions can result in silent data +// loss. +// +// Recommended setting: 0 +#define wxUSE_UNSAFE_WXSTRING_CONV 1 + +// If set to 1, enables "reproducible builds", i.e. build output should be +// exactly the same if the same build is redone again. As using __DATE__ and +// __TIME__ macros clearly makes the build irreproducible, setting this option +// to 1 disables their use in the library code. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_REPRODUCIBLE_BUILD 0 + +// ---------------------------------------------------------------------------- +// debugging settings +// ---------------------------------------------------------------------------- + +// wxDEBUG_LEVEL will be defined as 1 in wx/debug.h so normally there is no +// need to define it here. You may do it for two reasons: either completely +// disable/compile out the asserts in release version (then do it inside #ifdef +// NDEBUG) or, on the contrary, enable more asserts, including the usually +// disabled ones, in the debug build (then do it inside #ifndef NDEBUG) +// +// #ifdef NDEBUG +// #define wxDEBUG_LEVEL 0 +// #else +// #define wxDEBUG_LEVEL 2 +// #endif + +// wxHandleFatalExceptions() may be used to catch the program faults at run +// time and, instead of terminating the program with a usual GPF message box, +// call the user-defined wxApp::OnFatalException() function. If you set +// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. +// +// This setting is for Win32 only and can only be enabled if your compiler +// supports Win32 structured exception handling (currently only VC++ does) +// +// Default is 1 +// +// Recommended setting: 1 if your compiler supports it. +#define wxUSE_ON_FATAL_EXCEPTION 1 + +// Set this to 1 to be able to generate a human-readable (unlike +// machine-readable minidump created by wxCrashReport::Generate()) stack back +// trace when your program crashes using wxStackWalker +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_STACKWALKER 1 + +// Set this to 1 to compile in wxDebugReport class which allows you to create +// and optionally upload to your web site a debug report consisting of back +// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, it is compiled into a separate library so there +// is no overhead if you don't use it +#define wxUSE_DEBUGREPORT 1 + +// Generic comment about debugging settings: they are very useful if you don't +// use any other memory leak detection tools such as Purify/BoundsChecker, but +// are probably redundant otherwise. Also, Visual C++ CRT has the same features +// as wxWidgets memory debugging subsystem built in since version 5.0 and you +// may prefer to use it instead of built in memory debugging code because it is +// faster and more fool proof. +// +// Using VC++ CRT memory debugging is enabled by default in debug build (_DEBUG +// is defined) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) +// and if __NO_VC_CRTDBG__ is not defined. + +// The rest of the options in this section are obsolete and not supported, +// enable them at your own risk. + +// If 1, enables wxDebugContext, for writing error messages to file, etc. If +// __WXDEBUG__ is not defined, will still use the normal memory operators. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_CONTEXT 0 + +// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* +// __WXDEBUG__ is also defined. +// +// WARNING: this code may not work with all architectures, especially if +// alignment is an issue. This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 1 if you are not using a memory debugging tool, else 0 +#define wxUSE_MEMORY_TRACING 0 + +// In debug mode, cause new and delete to be redefined globally. +// If this causes problems (e.g. link errors which is a common problem +// especially if you use another library which also redefines the global new +// and delete), set this to 0. +// This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If +// this causes problems (e.g. link errors), set this to 0. You may need to set +// this to 0 if using templates (at least for VC++). This switch is currently +// ignored for MinGW/Cygwin. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_NEW_ALWAYS 0 + + +// ---------------------------------------------------------------------------- +// Unicode support +// ---------------------------------------------------------------------------- + +// This option is deprecated: the library should be always built in Unicode mode +// now, only set wxUSE_UNICODE to 0 to compile legacy code in ANSI mode if +// absolutely necessary -- updating it is strongly recommended as the ANSI mode +// will disappear completely in future wxWidgets releases. +#ifndef wxUSE_UNICODE + #define wxUSE_UNICODE 1 +#endif + +// ---------------------------------------------------------------------------- +// global features +// ---------------------------------------------------------------------------- + +// Compile library in exception-safe mode? If set to 1, the library will try to +// behave correctly in presence of exceptions (even though it still will not +// use the exceptions itself) and notify the user code about any unhandled +// exceptions. If set to 0, propagation of the exceptions through the library +// code will lead to undefined behaviour -- but the code itself will be +// slightly smaller and faster. +// +// Note that like wxUSE_THREADS this option is automatically set to 0 if +// wxNO_EXCEPTIONS is defined. +// +// Default is 1 +// +// Recommended setting: depends on whether you intend to use C++ exceptions +// in your own code (1 if you do, 0 if you don't) +#define wxUSE_EXCEPTIONS 1 + +// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI +// +// This feature is incomplete and experimental, please only enable it if +// you want to participate in its development. +// +// Recommended setting: 0 (unless you wish to try working on it). +#define wxUSE_EXTENDED_RTTI 0 + +// Support for message/error logging. This includes wxLogXXX() functions and +// wxLog and derived classes. Don't set this to 0 unless you really know what +// you are doing. +// +// Default is 1 +// +// Recommended setting: 1 (always) +#define wxUSE_LOG 1 + +// Recommended setting: 1 +#define wxUSE_LOGWINDOW 1 + +// Recommended setting: 1 +#define wxUSE_LOGGUI 1 + +// Recommended setting: 1 +#define wxUSE_LOG_DIALOG 1 + +// Support for command line parsing using wxCmdLineParser class. +// +// Default is 1 +// +// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) +#define wxUSE_CMDLINE_PARSER 1 + +// Support for multithreaded applications: if 1, compile in thread classes +// (thread.h) and make the library a bit more thread safe. Although thread +// support is quite stable by now, you may still consider recompiling the +// library without it if you have no use for it - this will result in a +// somewhat smaller and faster operation. +// +// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset +// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in +// build/msw/config.* file this value will have no effect. +// +// Default is 1 +// +// Recommended setting: 0 unless you do plan to develop MT applications +#define wxUSE_THREADS 1 + +// If enabled, compiles wxWidgets streams classes +// +// wx stream classes are used for image IO, process IO redirection, network +// protocols implementation and much more and so disabling this results in a +// lot of other functionality being lost. +// +// Default is 1 +// +// Recommended setting: 1 as setting it to 0 disables many other things +#define wxUSE_STREAMS 1 + +// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. +// Note that if the system's implementation does not support positional +// parameters, setting this to 1 forces the use of the wxWidgets implementation +// of wxVsnprintf. The standard vsnprintf() supports positional parameters on +// many Unix systems but usually doesn't under Windows. +// +// Positional parameters are very useful when translating a program since using +// them in formatting strings allow translators to correctly reorder the +// translated sentences. +// +// Default is 1 +// +// Recommended setting: 1 if you want to support multiple languages +#define wxUSE_PRINTF_POS_PARAMS 1 + +// Enable the use of compiler-specific thread local storage keyword, if any. +// This is used for wxTLS_XXX() macros implementation and normally should use +// the compiler-provided support as it's simpler and more efficient, but is +// disabled under Windows in wx/msw/chkconf.h as it can't be used if wxWidgets +// is used in a dynamically loaded Win32 DLL (i.e. using LoadLibrary()) under +// XP as this triggers a bug in compiler TLS support that results in crashes +// when any TLS variables are used. +// +// If you're absolutely sure that your build of wxWidgets is never going to be +// used in such situation, either because it's not going to be linked from any +// kind of plugin or because you only target Vista or later systems, you can +// set this to 2 to force the use of compiler TLS even under MSW. +// +// Default is 1 meaning that compiler TLS is used only if it's 100% safe. +// +// Recommended setting: 2 if you want to have maximal performance and don't +// care about the scenario described above. +#define wxUSE_COMPILER_TLS 1 + +// ---------------------------------------------------------------------------- +// Interoperability with the standard library. +// ---------------------------------------------------------------------------- + +// Set wxUSE_STL to 1 to enable maximal interoperability with the standard +// library, even at the cost of backwards compatibility. +// +// Default is 0 +// +// Recommended setting: 0 as the options below already provide a relatively +// good level of interoperability and changing this option arguably isn't worth +// diverging from the official builds of the library. +#define wxUSE_STL 0 + +// This is not a real option but is used as the default value for +// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS_COMPATIBLY. +// +// Set it to 0 if you want to disable the use of all standard classes +// completely for some reason. +#define wxUSE_STD_DEFAULT 1 + +// Use standard C++ containers where it can be done without breaking backwards +// compatibility. +// +// This provides better interoperability with the standard library, e.g. with +// this option on it's possible to insert std::vector<> into many wxWidgets +// containers directly. +// +// Default is 1. +// +// Recommended setting is 1 unless you want to avoid all dependencies on the +// standard library. +#define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT + +// Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<> +// and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but +// usually more limited) implementations are used which allows to avoid the +// dependency on the C++ run-time library. +// +// Default is 0 for compatibility reasons. +// +// Recommended setting: 1 unless compatibility with the official wxWidgets +// build and/or the existing code is a concern. +#define wxUSE_STD_CONTAINERS 0 + +// Use standard C++ streams if 1 instead of wx streams in some places. If +// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the +// standard streams library. +// +// Notice that enabling this does not replace wx streams with std streams +// everywhere, in a lot of places wx streams are used no matter what. +// +// Default is 1 if compiler supports it. +// +// Recommended setting: 1 if you use the standard streams anyhow and so +// dependency on the standard streams library is not a +// problem +#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT + +// Enable minimal interoperability with the standard C++ string class if 1. +// "Minimal" means that wxString can be constructed from std::string or +// std::wstring but can't be implicitly converted to them. You need to enable +// the option below for the latter. +// +// Default is 1 for most compilers. +// +// Recommended setting: 1 unless you want to ensure your program doesn't use +// the standard C++ library at all. +#define wxUSE_STD_STRING wxUSE_STD_DEFAULT + +// Make wxString as much interchangeable with std::[w]string as possible, in +// particular allow implicit conversion of wxString to either of these classes. +// This comes at a price (or a benefit, depending on your point of view) of not +// allowing implicit conversion to "const char *" and "const wchar_t *". +// +// Because a lot of existing code relies on these conversions, this option is +// disabled by default but can be enabled for your build if you don't care +// about compatibility. +// +// Default is 0 if wxUSE_STL has its default value or 1 if it is enabled. +// +// Recommended setting: 0 to remain compatible with the official builds of +// wxWidgets. +#define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL + +// ---------------------------------------------------------------------------- +// non GUI features selection +// ---------------------------------------------------------------------------- + +// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit +// integer which is implemented in terms of native 64 bit integers if any or +// uses emulation otherwise. +// +// This class is required by wxDateTime and so you should enable it if you want +// to use wxDateTime. For most modern platforms, it will use the native 64 bit +// integers in which case (almost) all of its functions are inline and it +// almost does not take any space, so there should be no reason to switch it +// off. +// +// Recommended setting: 1 +#define wxUSE_LONGLONG 1 + +// Set wxUSE_BASE64 to 1, to compile in Base64 support. This is required for +// storing binary data in wxConfig on most platforms. +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_BASE64 1 + +// Set this to 1 to be able to use wxEventLoop even in console applications +// (i.e. using base library only, without GUI). This is mostly useful for +// processing socket events but is also necessary to use timers in console +// applications +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_CONSOLE_EVENTLOOP 1 + +// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level +// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. +// +// Default is 1 +// +// Recommended setting: 1 (wxFile is highly recommended as it is required by +// i18n code, wxFileConfig and others) +#define wxUSE_FILE 1 +#define wxUSE_FFILE 1 + +// Use wxFSVolume class providing access to the configured/active mount points +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely disabled if you don't use it) +#define wxUSE_FSVOLUME 1 + +// Use wxSecretStore class for storing passwords using OS-specific facilities. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely disabled if you don't use it) +#define wxUSE_SECRETSTORE 1 + +// Allow the use of the OS built-in spell checker in wxTextCtrl. +// +// Default is 1, the corresponding wxTextCtrl functions simply won't do +// anything if the functionality is not supported by the current platform. +// +// Recommended setting: 1 unless you want to save a tiny bit of code. +#define wxUSE_SPELLCHECK 1 + +// Use wxStandardPaths class which allows to retrieve some standard locations +// in the file system +// +// Default is 1 +// +// Recommended setting: 1 (may be disabled to save space, but not much) +#define wxUSE_STDPATHS 1 + +// use wxTextBuffer class: required by wxTextFile +#define wxUSE_TEXTBUFFER 1 + +// use wxTextFile class: requires wxFile and wxTextBuffer, required by +// wxFileConfig +#define wxUSE_TEXTFILE 1 + +// i18n support: _() macro, wxLocale class. +#define wxUSE_INTL 1 + +// Provide wxFoo_l() functions similar to standard foo() functions but taking +// an extra locale parameter. +// +// Notice that this is fully implemented only for the systems providing POSIX +// xlocale support or Microsoft Visual C++ >= 8 (which provides proprietary +// almost-equivalent of xlocale functions), otherwise wxFoo_l() functions will +// only work for the current user locale and "C" locale. You can use +// wxHAS_XLOCALE_SUPPORT to test whether the full support is available. +// +// Default is 1 +// +// Recommended setting: 1 but may be disabled if you are writing programs +// running only in C locale anyhow +#define wxUSE_XLOCALE 1 + +// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which +// allow to manipulate dates, times and time intervals. +// +// Requires: wxUSE_LONGLONG +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_DATETIME 1 + +// Set wxUSE_TIMER to 1 to compile wxTimer class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_TIMER 1 + +// Use wxStopWatch class. +// +// Default is 1 +// +// Recommended setting: 1 (needed by wxSocket) +#define wxUSE_STOPWATCH 1 + +// Set wxUSE_FSWATCHER to 1 if you want to enable wxFileSystemWatcher +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_FSWATCHER 1 + +// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes +// which allow the application to store its settings in the persistent +// storage. Setting this to 1 will also enable on-demand creation of the +// global config object in wxApp. +// +// See also wxUSE_CONFIG_NATIVE below. +// +// Recommended setting: 1 +#define wxUSE_CONFIG 1 + +// If wxUSE_CONFIG is 1, you may choose to use either the native config +// classes under Windows (using the registry) or the portable text file +// format used by the config classes under Unix. +// +// Default is 1 to use native classes. Note that you may still use +// wxFileConfig even if you set this to 1 - just the config object created by +// default for the applications needs will be a wxRegConfig or wxIniConfig and +// not wxFileConfig. +// +// Recommended setting: 1 +#define wxUSE_CONFIG_NATIVE 1 + +// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows +// to connect/disconnect from the network and be notified whenever the dial-up +// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DIALUP_MANAGER 1 + +// Compile in classes for run-time DLL loading and function calling. +// Required by wxUSE_DIALUP_MANAGER. +// +// This setting is for Win32 only +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DYNLIB_CLASS 1 + +// experimental, don't use for now +#define wxUSE_DYNAMIC_LOADER 1 + +// Set to 1 to use socket classes +#define wxUSE_SOCKETS 1 + +// Set to 1 to use ipv6 socket classes (requires wxUSE_SOCKETS) +// +// Default is 1. +// +// Recommended setting: 1. +#define wxUSE_IPV6 1 + +// Set to 1 to enable virtual file systems (required by wxHTML) +#define wxUSE_FILESYSTEM 1 + +// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ZIP 1 + +// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ARCHIVE 1 + +// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_INET 1 + +// wxArchive classes for accessing archives such as zip and tar +#define wxUSE_ARCHIVE_STREAMS 1 + +// Set to 1 to compile wxZipInput/OutputStream classes. +#define wxUSE_ZIPSTREAM 1 + +// Set to 1 to compile wxTarInput/OutputStream classes. +#define wxUSE_TARSTREAM 1 + +// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by +// wxUSE_LIBPNG +#define wxUSE_ZLIB 1 + +// Set to 1 if liblzma is available to enable wxLZMA{Input,Output}Stream +// classes. +// +// Notice that if you enable this build option when not using configure or +// CMake, you need to ensure that liblzma headers and libraries are available +// (i.e. by building the library yourself or downloading its binaries) and can +// be found, either by copying them to one of the locations searched by the +// compiler/linker by default (e.g. any of the directories in the INCLUDE or +// LIB environment variables, respectively, when using MSVC) or modify the +// make- or project files to add references to these directories. +// +// Default is 0 under MSW, auto-detected by configure. +// +// Recommended setting: 1 if you need LZMA compression. +#define wxUSE_LIBLZMA 0 + +// If enabled, the code written by Apple will be used to write, in a portable +// way, float on the disk. See extended.c for the license which is different +// from wxWidgets one. +// +// Default is 1. +// +// Recommended setting: 1 unless you don't like the license terms (unlikely) +#define wxUSE_APPLE_IEEE 1 + +// Joystick support class +#define wxUSE_JOYSTICK 1 + +// wxFontEnumerator class +#define wxUSE_FONTENUM 1 + +// wxFontMapper class +#define wxUSE_FONTMAP 1 + +// wxMimeTypesManager class +#define wxUSE_MIMETYPE 1 + +// wxWebRequest allows usage of system libraries for HTTP(S) requests. +// +// Note that for wxWebRequest to be built, at least one of its backends must be +// available. Under MSW and macOS this will always be the case unless +// explicitly disabled. +// +// Default is 1 +// +// Recommended setting: 1, setting it to 0 may be useful to avoid dependencies +// on libcurl on Unix systems. +#define wxUSE_WEBREQUEST 1 + +// wxWebRequest backend based on NSURLSession +// +// Default is 1 under macOS. +// +// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, +// otherwise wxWebRequest won't be available at all under Mac. +#ifdef __APPLE__ +#define wxUSE_WEBREQUEST_URLSESSION wxUSE_WEBREQUEST +#else +#define wxUSE_WEBREQUEST_URLSESSION 0 +#endif + +// wxWebRequest backend based on libcurl, can be used under all platforms. +// +// Default is 0 for MSW and macOS, detected automatically when using configure. +// +// Recommended setting: 0 on Windows and macOS, otherwise 1 as it is required +// for wxWebRequest to be available at all. +#define wxUSE_WEBREQUEST_CURL 0 + +// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP +// or wxURL you need to set this to 1. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_PROTOCOL 1 + +// The settings for the individual URL schemes +#define wxUSE_PROTOCOL_FILE 1 +#define wxUSE_PROTOCOL_FTP 1 +#define wxUSE_PROTOCOL_HTTP 1 + +// Define this to use wxURL class. +#define wxUSE_URL 1 + +// Define this to use native platform url and protocol support. +// Currently valid only for MS-Windows. +// Note: if you set this to 1, you can open ftp/http/gopher sites +// and obtain a valid input stream for these sites +// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. +// Doing so reduces the code size. +// +// This code is experimental and subject to change. +#define wxUSE_URL_NATIVE 0 + +// Support for wxVariant class used in several places throughout the library, +// notably in wxDataViewCtrl API. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size as much as +// possible in which case setting this to 0 can gain up to 100KB. +#define wxUSE_VARIANT 1 + +// Support for wxAny class, the successor for wxVariant. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size by a small amount, +// or your compiler cannot for some reason cope with complexity of templates used. +#define wxUSE_ANY 1 + +// Support for regular expression matching via wxRegEx class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_REGEX 1 + +// wxSystemOptions class +#define wxUSE_SYSTEM_OPTIONS 1 + +// wxSound class +#define wxUSE_SOUND 1 + +// Use wxMediaCtrl +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_MEDIACTRL 1 + +// Use wxWidget's XRC XML-based resource system. Recommended. +// +// Default is 1 +// +// Recommended setting: 1 (requires wxUSE_XML) +#define wxUSE_XRC 1 + +// XML parsing classes. +// +// Default is 1 +// +// Recommended setting: 1 (required by XRC) +#define wxUSE_XML 1 + +// Use wxWidget's AUI docking system +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_AUI 1 + +// Use wxWidget's Ribbon classes for interfaces +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_RIBBON 1 + +// Use wxPropertyGrid. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_PROPGRID 1 + +// Use wxStyledTextCtrl, a wxWidgets Scintilla wrapper. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STC 1 + +// Use wxWidget's web viewing classes +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_WEBVIEW 1 + +// Use the IE wxWebView backend +// +// Default is 1 on MSW +// +// Recommended setting: 1 +#ifdef __WXMSW__ +#define wxUSE_WEBVIEW_IE 1 +#else +#define wxUSE_WEBVIEW_IE 0 +#endif + +// Use the Edge (Chromium) wxWebView backend (Requires WebView2 SDK) +// +// Default is 0 because WebView2 is not always available, set it to 1 if you do have it. +// +// Recommended setting: 1 when building for Windows with WebView2 SDK +#define wxUSE_WEBVIEW_EDGE 0 + +// Use the Edge (Chromium) wxWebView backend without loader DLL +// +// Default is 0, set it to 1 if you don't want to depend on WebView2Loader.dll. +// +// Recommended setting: 0 +#define wxUSE_WEBVIEW_EDGE_STATIC 0 + +// Use the WebKit wxWebView backend +// +// Default is 1 on GTK and OSX +// +// Recommended setting: 1 +#if (defined(__WXGTK__) && !defined(__WXGTK3__)) || defined(__WXOSX__) +#define wxUSE_WEBVIEW_WEBKIT 1 +#else +#define wxUSE_WEBVIEW_WEBKIT 0 +#endif + +// Use the WebKit2 wxWebView backend +// +// Default is 1 on GTK3 +// +// Recommended setting: 1 +#if defined(__WXGTK3__) +#define wxUSE_WEBVIEW_WEBKIT2 1 +#else +#define wxUSE_WEBVIEW_WEBKIT2 0 +#endif + +// Enable wxGraphicsContext and related classes for a modern 2D drawing API. +// +// Default is 1 except if you're using a compiler without support for GDI+ +// under MSW, i.e. gdiplus.h and related headers (MSVC and MinGW >= 4.8 are +// known to have them). For other compilers (e.g. older mingw32) you may need +// to install the headers (and just the headers) yourself. If you do, change +// the setting below manually. +// +// Recommended setting: 1 if supported by the compilation environment + +// Notice that we can't use wxCHECK_VISUALC_VERSION() nor wxCHECK_GCC_VERSION() +// here as this file is included from wx/platform.h before they're defined. +#if defined(_MSC_VER) || \ + (defined(__MINGW32__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 8)) +#define wxUSE_GRAPHICS_CONTEXT 1 +#else +// Disable support for other Windows compilers, enable it if your compiler +// comes with new enough SDK or you installed the headers manually. +// +// Notice that this will be set by configure under non-Windows platforms +// anyhow so the value there is not important. +#define wxUSE_GRAPHICS_CONTEXT 0 +#endif + +// Enable wxGraphicsContext implementation using Cairo library. +// +// This is not needed under Windows and detected automatically by configure +// under other systems, however you may set this to 1 manually if you installed +// Cairo under Windows yourself and prefer to use it instead the native GDI+ +// implementation. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_CAIRO 0 + + +// ---------------------------------------------------------------------------- +// Individual GUI controls +// ---------------------------------------------------------------------------- + +// You must set wxUSE_CONTROLS to 1 if you are using any controls at all +// (without it, wxControl class is not compiled) +// +// Default is 1 +// +// Recommended setting: 1 (don't change except for very special programs) +#define wxUSE_CONTROLS 1 + +// Support markup in control labels, i.e. provide wxControl::SetLabelMarkup(). +// Currently markup is supported only by a few controls and only some ports but +// their number will increase with time. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you want to save on code size) +#define wxUSE_MARKUP 1 + +// wxPopupWindow class is a top level transient window. It is currently used +// to implement wxTipWindow +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) +#define wxUSE_POPUPWIN 1 + +// wxTipWindow allows to implement the custom tooltips, it is used by the +// context help classes. Requires wxUSE_POPUPWIN. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0) +#define wxUSE_TIPWINDOW 1 + +// Each of the settings below corresponds to one wxWidgets control. They are +// all switched on by default but may be disabled if you are sure that your +// program (including any standard dialogs it can show!) doesn't need them and +// if you desperately want to save some space. If you use any of these you must +// set wxUSE_CONTROLS as well. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_ACTIVITYINDICATOR 1 // wxActivityIndicator +#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl +#define wxUSE_BANNERWINDOW 1 // wxBannerWindow +#define wxUSE_BUTTON 1 // wxButton +#define wxUSE_BMPBUTTON 1 // wxBitmapButton +#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl +#define wxUSE_CHECKBOX 1 // wxCheckBox +#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) +#define wxUSE_CHOICE 1 // wxChoice +#define wxUSE_COLLPANE 1 // wxCollapsiblePane +#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl +#define wxUSE_COMBOBOX 1 // wxComboBox +#define wxUSE_COMMANDLINKBUTTON 1 // wxCommandLinkButton +#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl +#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl +#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl +#define wxUSE_EDITABLELISTBOX 1 // wxEditableListBox +#define wxUSE_FILECTRL 1 // wxFileCtrl +#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl +#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl +#define wxUSE_GAUGE 1 // wxGauge +#define wxUSE_HEADERCTRL 1 // wxHeaderCtrl +#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl +#define wxUSE_LISTBOX 1 // wxListBox +#define wxUSE_LISTCTRL 1 // wxListCtrl +#define wxUSE_RADIOBOX 1 // wxRadioBox +#define wxUSE_RADIOBTN 1 // wxRadioButton +#define wxUSE_RICHMSGDLG 1 // wxRichMessageDialog +#define wxUSE_SCROLLBAR 1 // wxScrollBar +#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl +#define wxUSE_SLIDER 1 // wxSlider +#define wxUSE_SPINBTN 1 // wxSpinButton +#define wxUSE_SPINCTRL 1 // wxSpinCtrl +#define wxUSE_STATBOX 1 // wxStaticBox +#define wxUSE_STATLINE 1 // wxStaticLine +#define wxUSE_STATTEXT 1 // wxStaticText +#define wxUSE_STATBMP 1 // wxStaticBitmap +#define wxUSE_TEXTCTRL 1 // wxTextCtrl +#define wxUSE_TIMEPICKCTRL 1 // wxTimePickerCtrl +#define wxUSE_TOGGLEBTN 1 // requires wxButton +#define wxUSE_TREECTRL 1 // wxTreeCtrl +#define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl + +// Use generic version of wxDataViewCtrl even if a native one is available? +// +// Default is 1. +// +// Recommended setting: 1, but can be set to 0 if your program is affected by +// the native control limitations. +#define wxUSE_NATIVE_DATAVIEWCTRL 1 + +// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR +// below either wxStatusBar95 or a generic wxStatusBar will be used. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STATUSBAR 1 + +// Two status bar implementations are available under Win32: the generic one +// or the wrapper around native control. For native look and feel the native +// version should be used. +// +// Default is 1 for the platforms where native status bar is supported. +// +// Recommended setting: 1 (there is no advantage in using the generic one) +#define wxUSE_NATIVE_STATUSBAR 1 + +// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar +// classes at all. Otherwise, use the native toolbar class unless +// wxUSE_TOOLBAR_NATIVE is 0. +// +// Default is 1 for all settings. +// +// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. +#define wxUSE_TOOLBAR 1 +#define wxUSE_TOOLBAR_NATIVE 1 + +// wxNotebook is a control with several "tabs" located on one of its sides. It +// may be used to logically organise the data presented to the user instead of +// putting everything in one huge dialog. It replaces wxTabControl and related +// classes of wxWin 1.6x. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTEBOOK 1 + +// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_LISTBOOK 1 + +// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CHOICEBOOK 1 + +// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TREEBOOK 1 + +// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of +// tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLBOOK 1 + +// wxTaskBarIcon is a small notification icon shown in the system toolbar or +// dock. +// +// Default is 1. +// +// Recommended setting: 1 (but can be set to 0 if you don't need it) +#define wxUSE_TASKBARICON 1 + +// wxGrid class +// +// Default is 1, set to 0 to cut down compilation time and binaries size if you +// don't use it. +// +// Recommended setting: 1 +// +#define wxUSE_GRID 1 + +// wxMiniFrame class: a frame with narrow title bar +// +// Default is 1. +// +// Recommended setting: 1 (it doesn't cost almost anything) +#define wxUSE_MINIFRAME 1 + +// wxComboCtrl and related classes: combobox with custom popup window and +// not necessarily a listbox. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it +// is used by wxComboBox +#define wxUSE_COMBOCTRL 1 + +// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox +// items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0, except where it is +// needed as a base class for generic wxBitmapComboBox. +#define wxUSE_ODCOMBOBOX 1 + +// wxBitmapComboBox is a combobox that can have images in front of text items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 +#define wxUSE_BITMAPCOMBOBOX 1 + +// wxRearrangeCtrl is a wxCheckListBox with two buttons allowing to move items +// up and down in it. It is also used as part of wxRearrangeDialog. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 (currently used only by +// wxHeaderCtrl) +#define wxUSE_REARRANGECTRL 1 + +// wxAddRemoveCtrl is a composite control containing a control showing some +// items (e.g. wxListBox, wxListCtrl, wxTreeCtrl, wxDataViewCtrl, ...) and "+"/ +// "-" buttons allowing to add and remove items to/from the control. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 if you don't need it (not +// used by the library itself). +#define wxUSE_ADDREMOVECTRL 1 + +// ---------------------------------------------------------------------------- +// Miscellaneous GUI stuff +// ---------------------------------------------------------------------------- + +// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) +#define wxUSE_ACCEL 1 + +// Use the standard art provider. The icons returned by this provider are +// embedded into the library as XPMs so disabling it reduces the library size +// somewhat but this should only be done if you use your own custom art +// provider returning the icons or never use any icons not provided by the +// native art provider (which might not be implemented at all for some +// platforms) or by the Tango icons provider (if it's not itself disabled +// below). +// +// Default is 1. +// +// Recommended setting: 1 unless you use your own custom art provider. +#define wxUSE_ARTPROVIDER_STD 1 + +// Use art provider providing Tango icons: this art provider has higher quality +// icons than the default one. It uses SVG format which allows much better scaling +// then when bitmaps are used, at the expense of somewhat larger library size. +// +// Default is 1 under non-GTK ports. Under wxGTK the native art provider using +// the GTK+ stock icons replaces it so it is normally not necessary. +// +// Recommended setting: 1 but can be turned off to reduce the library size. +#define wxUSE_ARTPROVIDER_TANGO 1 + +// Hotkey support (currently Windows and macOS only) +#define wxUSE_HOTKEY 1 + +// Use wxCaret: a class implementing a "cursor" in a text control (called caret +// under Windows). +// +// Default is 1. +// +// Recommended setting: 1 (can be safely set to 0, not used by the library) +#define wxUSE_CARET 1 + +// Use wxDisplay class: it allows enumerating all displays on a system and +// their geometries as well as finding the display on which the given point or +// window lies. +// +// Default is 1. +// +// Recommended setting: 1 if you need it, can be safely set to 0 otherwise +#define wxUSE_DISPLAY 1 + +// Miscellaneous geometry code: needed for Canvas library +#define wxUSE_GEOMETRY 1 + +// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and +// wxListCtrl. +// +// Default is 1. +// +// Recommended setting: 1 (set it to 0 if you don't use any of the controls +// enumerated above, then this class is mostly useless too) +#define wxUSE_IMAGLIST 1 + +// Use wxInfoBar class. +// +// Default is 1. +// +// Recommended setting: 1 (but can be disabled without problems as nothing +// depends on it) +#define wxUSE_INFOBAR 1 + +// Use wxMenu, wxMenuItem. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUS 1 + +// Use wxMenuBar. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUBAR 1 + +// Use wxNotificationMessage. +// +// wxNotificationMessage allows to show non-intrusive messages to the user +// using balloons, banners, popups or whatever is the appropriate method for +// the current platform. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTIFICATION_MESSAGE 1 + +// wxPreferencesEditor provides a common API for different ways of presenting +// the standard "Preferences" or "Properties" dialog under different platforms +// (e.g. some use modal dialogs, some use modeless ones; some apply the changes +// immediately while others require an explicit "Apply" button). +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_PREFERENCES_EDITOR 1 + +// wxFont::AddPrivateFont() allows to use fonts not installed on the system by +// loading them from font files during run-time. +// +// Default is 1 except under Unix where it will be turned off by configure if +// the required libraries are not available or not new enough. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it and +// want to avoid extra dependencies under Linux, for example). +#define wxUSE_PRIVATE_FONTS 1 + +// wxRichToolTip is a customizable tooltip class which has more functionality +// than the stock (but native, unlike this class) wxToolTip. +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely set to 0 if you don't need it) +#define wxUSE_RICHTOOLTIP 1 + +// Use wxSashWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SASH 1 + +// Use wxSplitterWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SPLITTER 1 + +// Use wxToolTip and wxWindow::Set/GetToolTip() methods. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLTIPS 1 + +// wxValidator class and related methods +#define wxUSE_VALIDATORS 1 + +// Use reference counted ID management: this means that wxWidgets will track +// the automatically allocated ids (those used when you use wxID_ANY when +// creating a window, menu or toolbar item &c) instead of just supposing that +// the program never runs out of them. This is mostly useful only under wxMSW +// where the total ids range is limited to SHRT_MIN..SHRT_MAX and where +// long-running programs can run into problems with ids reuse without this. On +// the other platforms, where the ids have the full int range, this shouldn't +// be necessary. +#ifdef __WXMSW__ +#define wxUSE_AUTOID_MANAGEMENT 1 +#else +#define wxUSE_AUTOID_MANAGEMENT 0 +#endif + +// ---------------------------------------------------------------------------- +// common dialogs +// ---------------------------------------------------------------------------- + +// Use common dialogs (e.g. file selector, printer dialog). Switching this off +// also switches off the printing architecture and interactive wxPrinterDC. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COMMON_DIALOGS 1 + +// wxBusyInfo displays window with message when app is busy. Works in same way +// as wxBusyCursor +#define wxUSE_BUSYINFO 1 + +// Use single/multiple choice dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_CHOICEDLG 1 + +// Use colour picker dialog +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COLOURDLG 1 + +// wxDirDlg class for getting a directory name from user +#define wxUSE_DIRDLG 1 + +// Use file open/save dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in many places in the library itself) +#define wxUSE_FILEDLG 1 + +// Use find/replace dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely set to 0) +#define wxUSE_FINDREPLDLG 1 + +// Use font picker dialog +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_FONTDLG 1 + +// Use wxMessageDialog and wxMessageBox. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_MSGDLG 1 + +// progress dialog class for lengthy operations +#define wxUSE_PROGRESSDLG 1 + +// Set to 0 to disable the use of the native progress dialog (currently only +// available under MSW and suffering from some bugs there, hence this option). +#define wxUSE_NATIVE_PROGRESSDLG 1 + +// support for startup tips (wxShowTip &c) +#define wxUSE_STARTUP_TIPS 1 + +// text entry dialog and wxGetTextFromUser function +#define wxUSE_TEXTDLG 1 + +// number entry dialog +#define wxUSE_NUMBERDLG 1 + +// credential entry dialog +#define wxUSE_CREDENTIALDLG 1 + +// splash screen class +#define wxUSE_SPLASH 1 + +// wizards +#define wxUSE_WIZARDDLG 1 + +// Compile in wxAboutBox() function showing the standard "About" dialog. +// +// Default is 1 +// +// Recommended setting: 1 but can be set to 0 to save some space if you don't +// use this function +#define wxUSE_ABOUTDLG 1 + +// wxFileHistory class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_FILE_HISTORY 1 + +// ---------------------------------------------------------------------------- +// Metafiles support +// ---------------------------------------------------------------------------- + +// Windows supports the graphics format known as metafile which, though not +// portable, is widely used under Windows and so is supported by wxWidgets +// (under Windows only, of course). Both the so-called "Window MetaFiles" or +// WMFs, and "Enhanced MetaFiles" or EMFs are supported in wxWin and, by +// default, EMFs will be used. This may be changed by setting +// wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting wxUSE_ENH_METAFILE to 0. +// You may also set wxUSE_METAFILE to 0 to not compile in any metafile +// related classes at all. +// +// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. +// +// Recommended setting: default or 0 for everything for portable programs. +#define wxUSE_METAFILE 1 +#define wxUSE_ENH_METAFILE 1 +#define wxUSE_WIN_METAFILES_ALWAYS 0 + +// ---------------------------------------------------------------------------- +// Big GUI components +// ---------------------------------------------------------------------------- + +// Set to 0 to disable MDI support. +// +// Requires wxUSE_NOTEBOOK under platforms other than MSW. +// +// Default is 1. +// +// Recommended setting: 1, can be safely set to 0. +#define wxUSE_MDI 1 + +// Set to 0 to disable document/view architecture +#define wxUSE_DOC_VIEW_ARCHITECTURE 1 + +// Set to 0 to disable MDI document/view architecture +// +// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE +#define wxUSE_MDI_ARCHITECTURE 1 + +// Set to 0 to disable print/preview architecture code +#define wxUSE_PRINTING_ARCHITECTURE 1 + +// wxHTML allows displaying simple HTML. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_HTML 1 + +// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL +// headers and libraries to be able to compile the library with wxUSE_GLCANVAS +// set to 1 and, under Windows, also to add opengl32.lib and glu32.lib to the +// list of libraries used to link your application when linking to wxWidgets +// statically (although this is done implicitly for Microsoft Visual C++ users). +// +// Default is 1. +// +// Recommended setting: 1 if you intend to use OpenGL, can be safely set to 0 +// otherwise. +#define wxUSE_GLCANVAS 1 + +// Setting wxUSE_GLCANVAS_EGL to 1 enables OpenGL EGL backend. This will be +// automatically enabled if EGL support is detected. EGL support is only +// available under Unix platforms. +// +// Default is 0. +// +#define wxUSE_GLCANVAS_EGL 0 + +// wxRichTextCtrl allows editing of styled text. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 if you want compile a +// smaller library. +#define wxUSE_RICHTEXT 1 + +// ---------------------------------------------------------------------------- +// Data transfer +// ---------------------------------------------------------------------------- + +// Use wxClipboard class for clipboard copy/paste. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CLIPBOARD 1 + +// Use wxDataObject and related classes. Needed for clipboard and OLE drag and +// drop +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DATAOBJ 1 + +// Use wxDropTarget and wxDropSource classes for drag and drop (this is +// different from "built in" drag and drop in wxTreeCtrl which is always +// available). Requires wxUSE_DATAOBJ. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DRAG_AND_DROP 1 + +// Use wxAccessible for enhanced and customisable accessibility. +// Depends on wxUSE_OLE on MSW. +// +// Default is 1 on MSW, 0 elsewhere. +// +// Recommended setting (at present): 1 (MSW-only) +#ifdef __WXMSW__ +#define wxUSE_ACCESSIBILITY 1 +#else +#define wxUSE_ACCESSIBILITY 0 +#endif + +// ---------------------------------------------------------------------------- +// miscellaneous settings +// ---------------------------------------------------------------------------- + +// wxSingleInstanceChecker class allows to verify at startup if another program +// instance is running. +// +// Default is 1 +// +// Recommended setting: 1 (the class is tiny, disabling it won't save much +// space) +#define wxUSE_SNGLINST_CHECKER 1 + +#define wxUSE_DRAGIMAGE 1 + +#define wxUSE_IPC 1 + // 0 for no interprocess comms +#define wxUSE_HELP 1 + // 0 for no help facility + +// Should we use MS HTML help for wxHelpController? If disabled, neither +// wxCHMHelpController nor wxBestHelpController are available. +// +// Default is 1 under MSW, 0 is always used for the other platforms. +// +// Recommended setting: 1, only set to 0 if you have trouble compiling +// wxCHMHelpController (could be a problem with really ancient compilers) +#define wxUSE_MS_HTML_HELP 1 + + +// Use wxHTML-based help controller? +#define wxUSE_WXHTML_HELP 1 + +#define wxUSE_CONSTRAINTS 1 + // 0 for no window layout constraint system + +#define wxUSE_SPLINES 1 + // 0 for no splines + +#define wxUSE_MOUSEWHEEL 1 + // Include mouse wheel support + +// Compile wxUIActionSimulator class? +#define wxUSE_UIACTIONSIMULATOR 1 + +// ---------------------------------------------------------------------------- +// wxDC classes for various output formats +// ---------------------------------------------------------------------------- + +// Set to 1 for PostScript device context. +#define wxUSE_POSTSCRIPT 0 + +// Set to 1 to use font metric files in GetTextExtent +#define wxUSE_AFM_FOR_POSTSCRIPT 1 + +// Set to 1 to compile in support for wxSVGFileDC, a wxDC subclass which allows +// to create files in SVG (Scalable Vector Graphics) format. +#define wxUSE_SVG 1 + +// Should wxDC provide SetTransformMatrix() and related methods? +// +// Default is 1 but can be set to 0 if this functionality is not used. Notice +// that currently wxMSW, wxGTK3 support this for wxDC and all platforms support +// this for wxGCDC so setting this to 0 doesn't change much if neither of these +// is used (although it will still save a few bytes probably). +// +// Recommended setting: 1. +#define wxUSE_DC_TRANSFORM_MATRIX 1 + +// ---------------------------------------------------------------------------- +// image format support +// ---------------------------------------------------------------------------- + +// wxImage supports many different image formats which can be configured at +// compile-time. BMP is always supported, others are optional and can be safely +// disabled if you don't plan to use images in such format sometimes saving +// substantial amount of code in the final library. +// +// Some formats require an extra library (e.g. libpng) which is always included in +// wxWidgets sources but some build systems (cmake, configure) can be configured to +// to use the system or user-provided version. +// +// Set to 1 for wxImage support (recommended). +#define wxUSE_IMAGE 1 + +// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. +#define wxUSE_LIBPNG 1 + +// Set to 1 for JPEG format support (requires libjpeg) +#define wxUSE_LIBJPEG 1 + +// Set to 1 for TIFF format support (requires libtiff) +#define wxUSE_LIBTIFF 1 + +// Set to 1 for SVG rasterizing support using nanosvg +#define wxUSE_NANOSVG 1 + +// Set to 1 to use external nanosvg library when wxUSE_NANOSVG is enabled +#define wxUSE_NANOSVG_EXTERNAL 0 + +// Set to 1 for TGA format support (loading only) +#define wxUSE_TGA 1 + +// Set to 1 for GIF format support +#define wxUSE_GIF 1 + +// Set to 1 for PNM format support +#define wxUSE_PNM 1 + +// Set to 1 for PCX format support +#define wxUSE_PCX 1 + +// Set to 1 for IFF format support (Amiga format) +#define wxUSE_IFF 0 + +// Set to 1 for XPM format support +#define wxUSE_XPM 1 + +// Set to 1 for MS Icons and Cursors format support +#define wxUSE_ICO_CUR 1 + +// Set to 1 to compile in wxPalette class +#define wxUSE_PALETTE 1 + +// ---------------------------------------------------------------------------- +// wxUniversal-only options +// ---------------------------------------------------------------------------- + +// Set to 1 to enable compilation of all themes, this is the default +#define wxUSE_ALL_THEMES 1 + +// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES +// is unset, if it is set these options are not used; notice that metal theme +// uses Win32 one +#define wxUSE_THEME_GTK 0 +#define wxUSE_THEME_METAL 0 +#define wxUSE_THEME_MONO 0 +#define wxUSE_THEME_WIN32 0 + +/* --- end common options --- */ + +/* --- start MSW options --- */ +// ---------------------------------------------------------------------------- +// Windows-only settings +// ---------------------------------------------------------------------------- + +// Set this to 1 for generic OLE support: this is required for drag-and-drop, +// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and +// can't compile/doesn't have the OLE headers. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_OLE 1 + +// Set this to 1 to enable wxAutomationObject class. +// +// Default is 1. +// +// Recommended setting: 1 if you need to control other applications via OLE +// Automation, can be safely set to 0 otherwise +#define wxUSE_OLE_AUTOMATION 1 + +// Set this to 1 to enable wxActiveXContainer class allowing to embed OLE +// controls in wx. +// +// Default is 1. +// +// Recommended setting: 1, required by wxMediaCtrl +#define wxUSE_ACTIVEX 1 + +// wxDC caching implementation +#define wxUSE_DC_CACHEING 1 + +// Set this to 1 to enable wxDIB class used internally for manipulating +// wxBitmap data. +// +// Default is 1, set it to 0 only if you don't use wxImage either +// +// Recommended setting: 1 (without it conversion to/from wxImage won't work) +#define wxUSE_WXDIB 1 + +// Set to 0 to disable PostScript print/preview architecture code under Windows +// (just use Windows printing). +#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1 + +// Set this to 1 to compile in wxRegKey class. +// +// Default is 1 +// +// Recommended setting: 1, this is used internally by wx in a few places +#define wxUSE_REGKEY 1 + +// Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH +// which allows to put more than ~32Kb of text in it even under Win9x (NT +// doesn't have such limitation). +// +// Default is 1 for compilers which support it +// +// Recommended setting: 1, only set it to 0 if your compiler doesn't have +// or can't compile +#define wxUSE_RICHEDIT 1 + +// Set this to 1 to use extra features of richedit v2 and later controls +// +// Default is 1 for compilers which support it +// +// Recommended setting: 1 +#define wxUSE_RICHEDIT2 1 + +// Set this to 1 to enable support for the owner-drawn menu and listboxes. This +// is required by wxUSE_CHECKLISTBOX. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 for a small library size reduction +#define wxUSE_OWNER_DRAWN 1 + +// Set this to 1 to enable MSW-specific wxTaskBarIcon::ShowBalloon() method. It +// is required by native wxNotificationMessage implementation. +// +// Default is 1 but disabled in wx/msw/chkconf.h if SDK is too old to contain +// the necessary declarations. +// +// Recommended setting: 1, set to 0 for a tiny library size reduction +#define wxUSE_TASKBARICON_BALLOONS 1 + +// Set to 1 to compile MS Windows XP theme engine support +#define wxUSE_UXTHEME 1 + +// Set to 1 to use InkEdit control (Tablet PC), if available +#define wxUSE_INKEDIT 0 + +// Set to 1 to enable .INI files based wxConfig implementation (wxIniConfig) +// +// Default is 0. +// +// Recommended setting: 0, nobody uses .INI files any more +#define wxUSE_INICONF 0 + +// Set to 1 if you need to include over +// +// Default is 0. +// +// Recommended setting: 0 +#define wxUSE_WINSOCK2 0 + +// ---------------------------------------------------------------------------- +// Generic versions of native controls +// ---------------------------------------------------------------------------- + +// Set this to 1 to be able to use wxDatePickerCtrlGeneric in addition to the +// native wxDatePickerCtrl +// +// Default is 0. +// +// Recommended setting: 0, this is mainly used for testing +#define wxUSE_DATEPICKCTRL_GENERIC 0 + +// ---------------------------------------------------------------------------- +// Crash debugging helpers +// ---------------------------------------------------------------------------- + +// Set this to 1 to be able to use wxCrashReport::Generate() to create mini +// dumps of your program when it crashes (or at any other moment) +// +// Default is 1 if supported by the compiler (VC++ and recent BC++ only). +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_CRASHREPORT 1 +/* --- end MSW options --- */ + +/* --- start wxUniv options --- */ +// ---------------------------------------------------------------------------- +// wxUniversal-only options +// ---------------------------------------------------------------------------- + +// Set to 1 to enable compilation of all themes, this is the default +#define wxUSE_ALL_THEMES 1 + +// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES +// is unset, if it is set these options are not used; notice that metal theme +// uses Win32 one +#define wxUSE_THEME_GTK 0 +#define wxUSE_THEME_METAL 0 +#define wxUSE_THEME_MONO 0 +#define wxUSE_THEME_WIN32 0 +/* --- end wxUniv options --- */ + +#endif // _WX_SETUP_H_ diff --git a/lib/wxWidgets/include/wx/anidecod.h b/lib/wxWidgets/include/wx/anidecod.h new file mode 100644 index 0000000..bc24dd5 --- /dev/null +++ b/lib/wxWidgets/include/wx/anidecod.h @@ -0,0 +1,81 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/anidecod.h +// Purpose: wxANIDecoder, ANI reader for wxImage and wxAnimation +// Author: Francesco Montorsi +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ANIDECOD_H +#define _WX_ANIDECOD_H + +#include "wx/defs.h" + +#if wxUSE_STREAMS && (wxUSE_ICO_CUR || wxUSE_GIF) + +#include "wx/stream.h" +#include "wx/image.h" +#include "wx/animdecod.h" +#include "wx/dynarray.h" + + +class /*WXDLLIMPEXP_CORE*/ wxANIFrameInfo; // private implementation detail + +WX_DECLARE_EXPORTED_OBJARRAY(wxANIFrameInfo, wxANIFrameInfoArray); +WX_DECLARE_EXPORTED_OBJARRAY(wxImage, wxImageArray); + +// -------------------------------------------------------------------------- +// wxANIDecoder class +// -------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxANIDecoder : public wxAnimationDecoder +{ +public: + // constructor, destructor, etc. + wxANIDecoder(); + ~wxANIDecoder(); + + + virtual wxSize GetFrameSize(unsigned int frame) const wxOVERRIDE; + virtual wxPoint GetFramePosition(unsigned int frame) const wxOVERRIDE; + virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const wxOVERRIDE; + virtual long GetDelay(unsigned int frame) const wxOVERRIDE; + virtual wxColour GetTransparentColour(unsigned int frame) const wxOVERRIDE; + + // implementation of wxAnimationDecoder's pure virtuals + + virtual bool Load( wxInputStream& stream ) wxOVERRIDE; + + bool ConvertToImage(unsigned int frame, wxImage *image) const wxOVERRIDE; + + wxAnimationDecoder *Clone() const wxOVERRIDE + { return new wxANIDecoder; } + wxAnimationType GetType() const wxOVERRIDE + { return wxANIMATION_TYPE_ANI; } + +protected: + // wxAnimationDecoder pure virtual: + virtual bool DoCanRead( wxInputStream& stream ) const wxOVERRIDE; + // modifies current stream position (see wxAnimationDecoder::CanRead) + +private: + // 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. + wxImageArray m_images; + + // the info about each image stored in m_images. + // NB: m_info.GetCount() may differ from m_images.GetCount()! + wxANIFrameInfoArray m_info; + + // this is the wxCURHandler used to load the ICON chunk of the ANI files + static wxCURHandler sm_handler; + + + wxDECLARE_NO_COPY_CLASS(wxANIDecoder); +}; + + +#endif // wxUSE_STREAMS && (wxUSE_ICO_CUR || wxUSE_GIF) + +#endif // _WX_ANIDECOD_H diff --git a/lib/wxWidgets/include/wx/animate.h b/lib/wxWidgets/include/wx/animate.h new file mode 100644 index 0000000..f1dbe6f --- /dev/null +++ b/lib/wxWidgets/include/wx/animate.h @@ -0,0 +1,185 @@ +///////////////////////////////////////////////////////////////////////////// +// 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/bmpbndl.h" + +class WXDLLIMPEXP_FWD_CORE wxAnimation; +class wxAnimationImpl; + +extern WXDLLIMPEXP_DATA_CORE(wxAnimation) wxNullAnimation; +extern WXDLLIMPEXP_DATA_CORE(const char) wxAnimationCtrlNameStr[]; + +WX_DECLARE_LIST_WITH_DECL(wxAnimationDecoder, wxAnimationDecoderList, class WXDLLIMPEXP_CORE); + +// ---------------------------------------------------------------------------- +// wxAnimation +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxAnimation : public wxObject +{ +public: + wxAnimation(); + explicit wxAnimation(const wxString &name, wxAnimationType type = wxANIMATION_TYPE_ANY); + +#ifdef wxHAS_MEMBER_DEFAULT + wxAnimation(const wxAnimation&) = default; + wxAnimation& operator=(const wxAnimation&) = default; +#endif + + bool IsOk() const; + bool IsCompatibleWith(wxClassInfo* ci) const; + + int GetDelay(unsigned int frame) const; + unsigned int GetFrameCount() const; + wxImage GetFrame(unsigned int frame) const; + wxSize GetSize() const; + + bool LoadFile(const wxString& name, wxAnimationType type = wxANIMATION_TYPE_ANY); + bool Load(wxInputStream& stream, wxAnimationType type = wxANIMATION_TYPE_ANY); + + // Methods for managing the list of decoders + static inline wxAnimationDecoderList& GetHandlers() { return sm_handlers; } + static void AddHandler(wxAnimationDecoder *handler); + static void InsertHandler(wxAnimationDecoder *handler); + static const wxAnimationDecoder *FindHandler( wxAnimationType animType ); + + static void CleanUpHandlers(); + static void InitStandardHandlers(); + +protected: + wxAnimationImpl* GetImpl() const; + +private: + static wxAnimationDecoderList sm_handlers; + + // Ctor used by wxAnimationCtrl::CreateAnimation() only. + explicit wxAnimation(wxAnimationImpl* impl); + + // Give it permission to create objects of this class using specific impl + // and access our GetImpl(). + friend class wxAnimationCtrlBase; + + wxDECLARE_DYNAMIC_CLASS(wxAnimation); +}; + + +// ---------------------------------------------------------------------------- +// 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_CORE 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; + wxAnimation GetAnimation() const { return m_animation; } + + virtual bool Play() = 0; + virtual void Stop() = 0; + + virtual bool IsPlaying() const = 0; + + virtual void SetInactiveBitmap(const wxBitmapBundle &bmp); + + // always return the original bitmap set in this control + wxBitmap GetInactiveBitmap() const + { return m_bmpStatic.GetBitmapFor(this); } + + wxAnimation CreateAnimation() const + { return MakeAnimFromImpl(DoCreateAnimationImpl()); } + +protected: + virtual wxAnimationImpl* DoCreateAnimationImpl() const = 0; + + // These methods allow derived classes access to private wxAnimation ctor + // and wxAnimation::GetImpl(), respectively. + static wxAnimation MakeAnimFromImpl(wxAnimationImpl* impl) + { return wxAnimation(impl); } + + wxAnimationImpl* GetAnimImpl() const + { return m_animation.GetImpl(); } + + // The associated animation, possibly invalid/empty. + wxAnimation m_animation; + + // the inactive bitmap as it was set by the user + wxBitmapBundle 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; +}; + + +// ---------------------------------------------------------------------------- +// include the platform-specific version of the wxAnimationCtrl class +// ---------------------------------------------------------------------------- + +#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) + #include "wx/gtk/animate.h" + + #define wxHAS_NATIVE_ANIMATIONCTRL +#else + #include "wx/generic/animate.h" + + class WXDLLIMPEXP_ADV wxAnimationCtrl : public wxGenericAnimationCtrl + { + public: + wxAnimationCtrl() + : wxGenericAnimationCtrl() + {} + wxAnimationCtrl(wxWindow *parent, + wxWindowID id, + const wxAnimation& anim = wxNullAnimation, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxAC_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxAnimationCtrlNameStr)) + : wxGenericAnimationCtrl(parent, id, anim, pos, size, style, name) + {} + + private: + wxDECLARE_DYNAMIC_CLASS(wxAnimationCtrl); + }; +#endif // defined(__WXGTK20__) + +#endif // wxUSE_ANIMATIONCTRL + +#endif // _WX_ANIMATE_H_ diff --git a/lib/wxWidgets/include/wx/animdecod.h b/lib/wxWidgets/include/wx/animdecod.h new file mode 100644 index 0000000..fa91508 --- /dev/null +++ b/lib/wxWidgets/include/wx/animdecod.h @@ -0,0 +1,154 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/animdecod.h +// Purpose: wxAnimationDecoder +// Author: Francesco Montorsi +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ANIMDECOD_H +#define _WX_ANIMDECOD_H + +#include "wx/defs.h" + +#if wxUSE_STREAMS + +#include "wx/colour.h" +#include "wx/gdicmn.h" +#include "wx/log.h" +#include "wx/stream.h" + +class WXDLLIMPEXP_FWD_CORE wxImage; + +/* + + Differences between a wxAnimationDecoder and a wxImageHandler: + + 1) wxImageHandlers always load an input stream directly into a given wxImage + object converting from the format-specific data representation to the + wxImage native format (RGB24). + wxAnimationDecoders always load an input stream using some optimized format + to store it which is format-dependent. This allows to store a (possibly big) + animation using a format which is a good compromise between required memory + and time required to blit it on the screen. + + 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 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 + wxImage uses. + +*/ + + +// -------------------------------------------------------------------------- +// Constants +// -------------------------------------------------------------------------- + +// NB: the values of these enum items are not casual but coincide with the +// GIF disposal codes. Do not change them !! +enum wxAnimationDisposal +{ + // No disposal specified. The decoder is not required to take any action. + wxANIM_UNSPECIFIED = -1, + + // 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 + // restored to the background color. + wxANIM_TOBACKGROUND = 1, + + // 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 +}; + +enum wxAnimationType +{ + wxANIMATION_TYPE_INVALID, + wxANIMATION_TYPE_GIF, + wxANIMATION_TYPE_ANI, + + wxANIMATION_TYPE_ANY +}; + + +// -------------------------------------------------------------------------- +// wxAnimationDecoder class +// -------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxAnimationDecoder : public wxObjectRefData +{ +public: + wxAnimationDecoder() + { + m_nFrames = 0; + } + + virtual bool Load( wxInputStream& stream ) = 0; + + bool CanRead( wxInputStream& stream ) const + { + return wxInputStreamPeeker(stream). + CallIfCanSeek(&wxAnimationDecoder::DoCanRead, this); + } + + virtual wxAnimationDecoder *Clone() const = 0; + virtual wxAnimationType GetType() const = 0; + + // convert given frame to wxImage + virtual bool ConvertToImage(unsigned int frame, wxImage *image) const = 0; + + + // frame specific data getters + + // not all frames may be of the same size; e.g. GIF allows to + // specify that between two frames only a smaller portion of the + // entire animation has changed. + virtual wxSize GetFrameSize(unsigned int frame) const = 0; + + // the position of this frame in case it's not as big as m_szAnimation + // or wxPoint(0,0) otherwise. + virtual wxPoint GetFramePosition(unsigned int frame) const = 0; + + // what should be done after displaying this frame. + virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const = 0; + + // the number of milliseconds this frame should be displayed. + // if returns -1 then the frame must be displayed forever. + virtual long GetDelay(unsigned int frame) const = 0; + + // the transparent colour for this frame if any or wxNullColour. + virtual wxColour GetTransparentColour(unsigned int frame) const = 0; + + // get global data + wxSize GetAnimationSize() const { return m_szAnimation; } + wxColour GetBackgroundColour() const { return m_background; } + 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; + + // this is the colour to use for the wxANIM_TOBACKGROUND disposal. + // if not specified by the animation, it's set to wxNullColour + wxColour m_background; +}; + +#endif // wxUSE_STREAMS + +#endif // _WX_ANIMDECOD_H + diff --git a/lib/wxWidgets/include/wx/any.h b/lib/wxWidgets/include/wx/any.h new file mode 100644 index 0000000..1fb0bd2 --- /dev/null +++ b/lib/wxWidgets/include/wx/any.h @@ -0,0 +1,1149 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/any.h +// Purpose: wxAny class +// Author: Jaakko Salli +// Modified by: +// Created: 07/05/2009 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ANY_H_ +#define _WX_ANY_H_ + +#include "wx/defs.h" + +#if wxUSE_ANY + +#include // for placement new +#include "wx/string.h" +#include "wx/meta/if.h" +#include "wx/typeinfo.h" +#include "wx/list.h" + +// Size of the wxAny value buffer. +enum +{ + WX_ANY_VALUE_BUFFER_SIZE = 16 +}; + +union wxAnyValueBuffer +{ + union Alignment + { + #if wxHAS_INT64 + wxInt64 m_int64; + #endif + long double m_longDouble; + void ( *m_funcPtr )(void); + void ( wxAnyValueBuffer::*m_mFuncPtr )(void); + } m_alignment; + + void* m_ptr; + wxByte m_buffer[WX_ANY_VALUE_BUFFER_SIZE]; + + wxAnyValueBuffer() + { + m_ptr = NULL; + } +}; + +// +// wxAnyValueType is base class for value type functionality for C++ data +// types used with wxAny. Usually the default template (wxAnyValueTypeImpl<>) +// will create a satisfactory wxAnyValueType implementation for a data type. +// +class WXDLLIMPEXP_BASE wxAnyValueType +{ + WX_DECLARE_ABSTRACT_TYPEINFO(wxAnyValueType) +public: + /** + Default constructor. + */ + wxAnyValueType() + { + } + + /** + Destructor. + */ + virtual ~wxAnyValueType() + { + } + + /** + This function is used for internal type matching. + */ + virtual bool IsSameType(const wxAnyValueType* otherType) const = 0; + + /** + This function is called every time the data in wxAny + buffer needs to be freed. + */ + virtual void DeleteValue(wxAnyValueBuffer& buf) const = 0; + + /** + Implement this for buffer-to-buffer copy. + + @param src + This is the source data buffer. + + @param dst + This is the destination data buffer that is in either + uninitialized or freed state. + */ + virtual void CopyBuffer(const wxAnyValueBuffer& src, + wxAnyValueBuffer& dst) const = 0; + + /** + Convert value into buffer of different type. Return false if + not possible. + */ + virtual bool ConvertValue(const wxAnyValueBuffer& src, + wxAnyValueType* dstType, + wxAnyValueBuffer& dst) const = 0; + + /** + Use this template function for checking if wxAnyValueType represents + a specific C++ data type. + + @see wxAny::CheckType() + */ + template + bool CheckType() const; + +#if wxUSE_EXTENDED_RTTI + virtual const wxTypeInfo* GetTypeInfo() const = 0; +#endif +private: +}; + + +// +// We need to allocate wxAnyValueType instances in heap, and need to use +// scoped ptr to properly deallocate them in dynamic library use cases. +// Here we have a minimal specialized scoped ptr implementation to deal +// with various compiler-specific problems with template class' static +// member variable of template type with explicit constructor which +// is initialized in global scope. +// +class wxAnyValueTypeScopedPtr +{ +public: + wxAnyValueTypeScopedPtr(wxAnyValueType* ptr) : m_ptr(ptr) { } + ~wxAnyValueTypeScopedPtr() { delete m_ptr; } + wxAnyValueType* get() const { return m_ptr; } +private: + wxAnyValueType* m_ptr; +}; + + +// Deprecated macro for checking the type which was originally introduced for +// MSVC6 compatibility and is not needed any longer now that this compiler is +// not supported any more. +#define wxANY_VALUE_TYPE_CHECK_TYPE(valueTypePtr, T) \ + wxAnyValueTypeImpl::IsSameClass(valueTypePtr) + + +/** + Helper macro for defining user value types. + + Even though C++ RTTI would be fully available to use, we'd have to + facilitate sub-type system which allows, for instance, wxAny with + signed short '15' to be treated equal to wxAny with signed long long '15'. + Having sm_instance is important here. + + NB: We really need to have wxAnyValueType instances allocated + in heap. They are stored as static template member variables, + and with them we just can't be too careful (eg. not allocating + them in heap broke the type identification in GCC). +*/ +#define WX_DECLARE_ANY_VALUE_TYPE(CLS) \ + friend class wxAny; \ + WX_DECLARE_TYPEINFO_INLINE(CLS) \ +public: \ + static bool IsSameClass(const wxAnyValueType* otherType) \ + { \ + return AreSameClasses(*sm_instance.get(), *otherType); \ + } \ + virtual bool IsSameType(const wxAnyValueType* otherType) const wxOVERRIDE \ + { \ + return IsSameClass(otherType); \ + } \ +private: \ + static bool AreSameClasses(const wxAnyValueType& a, const wxAnyValueType& b) \ + { \ + return wxTypeId(a) == wxTypeId(b); \ + } \ + static wxAnyValueTypeScopedPtr sm_instance; \ +public: \ + static wxAnyValueType* GetInstance() \ + { \ + return sm_instance.get(); \ + } + + +#define WX_IMPLEMENT_ANY_VALUE_TYPE(CLS) \ +wxAnyValueTypeScopedPtr CLS::sm_instance(new CLS()); + + +/** + Following are helper classes for the wxAnyValueTypeImplBase. +*/ +namespace wxPrivate +{ + +template +class wxAnyValueTypeOpsInplace +{ +public: + static void DeleteValue(wxAnyValueBuffer& buf) + { + GetValue(buf).~T(); + } + + static void SetValue(const T& value, + wxAnyValueBuffer& buf) + { + // Use placement new, taking care to avoid running into problems with + // "new" redefinition in wx/msw/msvcrt.h. +#ifdef WXDEBUG_NEW + #undef new +#endif + + void* const place = buf.m_buffer; + ::new(place) T(value); + +#ifdef WXDEBUG_NEW + #define new WXDEBUG_NEW +#endif + } + + static const T& GetValue(const wxAnyValueBuffer& buf) + { + // Use a union to avoid undefined behaviour (and gcc -Wstrict-alias + // warnings about it) which would occur if we just casted a wxByte + // pointer to a T one. + union + { + const T* ptr; + const wxByte *buf; + } u; + u.buf = buf.m_buffer; + + return *u.ptr; + } +}; + + +template +class wxAnyValueTypeOpsGeneric +{ +public: + template + class DataHolder + { + public: + DataHolder(const T2& value) + : m_value(value) + { + } + virtual ~DataHolder() { } + + T2 m_value; + private: + wxDECLARE_NO_COPY_CLASS(DataHolder); + }; + + static void DeleteValue(wxAnyValueBuffer& buf) + { + DataHolder* holder = static_cast*>(buf.m_ptr); + delete holder; + } + + static void SetValue(const T& value, + wxAnyValueBuffer& buf) + { + DataHolder* holder = new DataHolder(value); + buf.m_ptr = holder; + } + + static const T& GetValue(const wxAnyValueBuffer& buf) + { + DataHolder* holder = static_cast*>(buf.m_ptr); + return holder->m_value; + } +}; + + +template +struct wxAnyAsImpl; + +} // namespace wxPrivate + + +/** + Intermediate template for the generic value type implementation. + We can derive from this same value type for multiple actual types + (for instance, we can have wxAnyValueTypeImplInt for all signed + integer types), and also easily implement specialized templates + with specific dynamic type conversion. +*/ +template +class wxAnyValueTypeImplBase : public wxAnyValueType +{ + typedef typename wxIf< sizeof(T) <= WX_ANY_VALUE_BUFFER_SIZE, + wxPrivate::wxAnyValueTypeOpsInplace, + wxPrivate::wxAnyValueTypeOpsGeneric >::value + Ops; + +public: + wxAnyValueTypeImplBase() : wxAnyValueType() { } + virtual ~wxAnyValueTypeImplBase() { } + + virtual void DeleteValue(wxAnyValueBuffer& buf) const wxOVERRIDE + { + Ops::DeleteValue(buf); + } + + virtual void CopyBuffer(const wxAnyValueBuffer& src, + wxAnyValueBuffer& dst) const wxOVERRIDE + { + Ops::SetValue(Ops::GetValue(src), dst); + } + + /** + It is important to reimplement this in any specialized template + classes that inherit from wxAnyValueTypeImplBase. + */ + static void SetValue(const T& value, + wxAnyValueBuffer& buf) + { + Ops::SetValue(value, buf); + } + + /** + It is important to reimplement this in any specialized template + classes that inherit from wxAnyValueTypeImplBase. + */ + static const T& GetValue(const wxAnyValueBuffer& buf) + { + return Ops::GetValue(buf); + } +#if wxUSE_EXTENDED_RTTI + virtual const wxTypeInfo* GetTypeInfo() const + { + return wxGetTypeInfo((T*)NULL); + } +#endif +}; + + +/* + Generic value type template. Note that bulk of the implementation + resides in wxAnyValueTypeImplBase. +*/ +template +class wxAnyValueTypeImpl : public wxAnyValueTypeImplBase +{ + WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImpl) +public: + wxAnyValueTypeImpl() : wxAnyValueTypeImplBase() { } + virtual ~wxAnyValueTypeImpl() { } + + virtual bool ConvertValue(const wxAnyValueBuffer& src, + wxAnyValueType* dstType, + wxAnyValueBuffer& dst) const wxOVERRIDE + { + wxUnusedVar(src); + wxUnusedVar(dstType); + wxUnusedVar(dst); + return false; + } +}; + +template +wxAnyValueTypeScopedPtr wxAnyValueTypeImpl::sm_instance = new wxAnyValueTypeImpl(); + + +// +// Helper macro for using same base value type implementation for multiple +// actual C++ data types. +// +#define _WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE) \ +template<> \ +class wxAnyValueTypeImpl : public wxAnyValueTypeImpl##CLSTYPE \ +{ \ + typedef wxAnyBase##CLSTYPE##Type UseDataType; \ +public: \ + wxAnyValueTypeImpl() : wxAnyValueTypeImpl##CLSTYPE() { } \ + virtual ~wxAnyValueTypeImpl() { } \ + static void SetValue(const T& value, wxAnyValueBuffer& buf) \ + { \ + void* voidPtr = reinterpret_cast(&buf.m_buffer[0]); \ + UseDataType* dptr = reinterpret_cast(voidPtr); \ + *dptr = static_cast(value); \ + } \ + static T GetValue(const wxAnyValueBuffer& buf) \ + { \ + const void* voidPtr = \ + reinterpret_cast(&buf.m_buffer[0]); \ + const UseDataType* sptr = \ + reinterpret_cast(voidPtr); \ + return static_cast(*sptr); \ + } + +#if wxUSE_EXTENDED_RTTI +#define WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE) \ +_WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE)\ + virtual const wxTypeInfo* GetTypeInfo() const \ + { \ + return wxGetTypeInfo((T*)NULL); \ + } \ +}; +#else +#define WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE) \ +_WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE)\ +}; +#endif + +// +// Integer value types +// + +#ifdef wxLongLong_t + typedef wxLongLong_t wxAnyBaseIntType; + typedef wxULongLong_t wxAnyBaseUintType; +#else + typedef long wxAnyBaseIntType; + typedef unsigned long wxAnyBaseUintType; +#endif + + +class WXDLLIMPEXP_BASE wxAnyValueTypeImplInt : + public wxAnyValueTypeImplBase +{ + WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImplInt) +public: + wxAnyValueTypeImplInt() : + wxAnyValueTypeImplBase() { } + virtual ~wxAnyValueTypeImplInt() { } + + virtual bool ConvertValue(const wxAnyValueBuffer& src, + wxAnyValueType* dstType, + wxAnyValueBuffer& dst) const wxOVERRIDE; +}; + + +class WXDLLIMPEXP_BASE wxAnyValueTypeImplUint : + public wxAnyValueTypeImplBase +{ + WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImplUint) +public: + wxAnyValueTypeImplUint() : + wxAnyValueTypeImplBase() { } + virtual ~wxAnyValueTypeImplUint() { } + + virtual bool ConvertValue(const wxAnyValueBuffer& src, + wxAnyValueType* dstType, + wxAnyValueBuffer& dst) const wxOVERRIDE; +}; + + +WX_ANY_DEFINE_SUB_TYPE(signed long, Int) +WX_ANY_DEFINE_SUB_TYPE(signed int, Int) +WX_ANY_DEFINE_SUB_TYPE(signed short, Int) +WX_ANY_DEFINE_SUB_TYPE(signed char, Int) +#ifdef wxLongLong_t +WX_ANY_DEFINE_SUB_TYPE(wxLongLong_t, Int) +#endif + +WX_ANY_DEFINE_SUB_TYPE(unsigned long, Uint) +WX_ANY_DEFINE_SUB_TYPE(unsigned int, Uint) +WX_ANY_DEFINE_SUB_TYPE(unsigned short, Uint) +WX_ANY_DEFINE_SUB_TYPE(unsigned char, Uint) +#ifdef wxLongLong_t +WX_ANY_DEFINE_SUB_TYPE(wxULongLong_t, Uint) +#endif + + +// +// This macro is used in header, but then in source file we must have: +// WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl##TYPENAME) +// +#define _WX_ANY_DEFINE_CONVERTIBLE_TYPE(T, TYPENAME, CONVFUNC, GV) \ +class WXDLLIMPEXP_BASE wxAnyValueTypeImpl##TYPENAME : \ + public wxAnyValueTypeImplBase \ +{ \ + WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImpl##TYPENAME) \ +public: \ + wxAnyValueTypeImpl##TYPENAME() : \ + wxAnyValueTypeImplBase() { } \ + virtual ~wxAnyValueTypeImpl##TYPENAME() { } \ + virtual bool ConvertValue(const wxAnyValueBuffer& src, \ + wxAnyValueType* dstType, \ + wxAnyValueBuffer& dst) const wxOVERRIDE \ + { \ + GV value = GetValue(src); \ + return CONVFUNC(value, dstType, dst); \ + } \ +}; \ +template<> \ +class wxAnyValueTypeImpl : public wxAnyValueTypeImpl##TYPENAME \ +{ \ +public: \ + wxAnyValueTypeImpl() : wxAnyValueTypeImpl##TYPENAME() { } \ + virtual ~wxAnyValueTypeImpl() { } \ +}; + +#define WX_ANY_DEFINE_CONVERTIBLE_TYPE(T, TYPENAME, CONVFUNC, BT) \ +_WX_ANY_DEFINE_CONVERTIBLE_TYPE(T, TYPENAME, CONVFUNC, BT) \ + +#define WX_ANY_DEFINE_CONVERTIBLE_TYPE_BASE(T, TYPENAME, CONVFUNC) \ +_WX_ANY_DEFINE_CONVERTIBLE_TYPE(T, TYPENAME, \ + CONVFUNC, const T&) \ + +// +// String value type +// + +// Convert wxString to destination wxAny value type +extern WXDLLIMPEXP_BASE bool wxAnyConvertString(const wxString& value, + wxAnyValueType* dstType, + wxAnyValueBuffer& dst); + +WX_ANY_DEFINE_CONVERTIBLE_TYPE_BASE(wxString, wxString, wxAnyConvertString) +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +WX_ANY_DEFINE_CONVERTIBLE_TYPE(const char*, ConstCharPtr, + wxAnyConvertString, wxString) +#endif +WX_ANY_DEFINE_CONVERTIBLE_TYPE(const wchar_t*, ConstWchar_tPtr, + wxAnyConvertString, wxString) + +// +// Bool value type +// +template<> +class WXDLLIMPEXP_BASE wxAnyValueTypeImpl : + public wxAnyValueTypeImplBase +{ + WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImpl) +public: + wxAnyValueTypeImpl() : + wxAnyValueTypeImplBase() { } + virtual ~wxAnyValueTypeImpl() { } + + virtual bool ConvertValue(const wxAnyValueBuffer& src, + wxAnyValueType* dstType, + wxAnyValueBuffer& dst) const wxOVERRIDE; +}; + +// +// Floating point value type +// +class WXDLLIMPEXP_BASE wxAnyValueTypeImplDouble : + public wxAnyValueTypeImplBase +{ + WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImplDouble) +public: + wxAnyValueTypeImplDouble() : + wxAnyValueTypeImplBase() { } + virtual ~wxAnyValueTypeImplDouble() { } + + virtual bool ConvertValue(const wxAnyValueBuffer& src, + wxAnyValueType* dstType, + wxAnyValueBuffer& dst) const wxOVERRIDE; +}; + +// WX_ANY_DEFINE_SUB_TYPE requires this +typedef double wxAnyBaseDoubleType; + +WX_ANY_DEFINE_SUB_TYPE(float, Double) +WX_ANY_DEFINE_SUB_TYPE(double, Double) + + +// +// Defines a dummy wxAnyValueTypeImpl<> with given export +// declaration. This is needed if a class is used with +// wxAny in both user shared library and application. +// +#define wxDECLARE_ANY_TYPE(CLS, DECL) \ +template<> \ +class DECL wxAnyValueTypeImpl : \ + public wxAnyValueTypeImplBase \ +{ \ + WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImpl) \ +public: \ + wxAnyValueTypeImpl() : \ + wxAnyValueTypeImplBase() { } \ + virtual ~wxAnyValueTypeImpl() { } \ + \ + virtual bool ConvertValue(const wxAnyValueBuffer& src, \ + wxAnyValueType* dstType, \ + wxAnyValueBuffer& dst) const wxOVERRIDE \ + { \ + wxUnusedVar(src); \ + wxUnusedVar(dstType); \ + wxUnusedVar(dst); \ + return false; \ + } \ +}; + + +// Make sure some of wx's own types get the right wxAnyValueType export +// (this is needed only for types that are referred to from wxBase. +// currently we may not use any of these types from there, but let's +// use the macro on at least one to make sure it compiles since we can't +// really test it properly in unit tests since a separate DLL would +// be needed). +#if wxUSE_DATETIME + #include "wx/datetime.h" + wxDECLARE_ANY_TYPE(wxDateTime, WXDLLIMPEXP_BASE) +#endif + +//#include "wx/object.h" +//wxDECLARE_ANY_TYPE(wxObject*, WXDLLIMPEXP_BASE) + +//#include "wx/arrstr.h" +//wxDECLARE_ANY_TYPE(wxArrayString, WXDLLIMPEXP_BASE) + + +#if wxUSE_VARIANT + +class WXDLLIMPEXP_FWD_BASE wxAnyToVariantRegistration; + +// Because of header inter-dependencies, cannot include this earlier +#include "wx/variant.h" + +// +// wxVariantData* data type implementation. For cases when appropriate +// wxAny<->wxVariant conversion code is missing. +// + +class WXDLLIMPEXP_BASE wxAnyValueTypeImplVariantData : + public wxAnyValueTypeImplBase +{ + WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImplVariantData) +public: + wxAnyValueTypeImplVariantData() : + wxAnyValueTypeImplBase() { } + virtual ~wxAnyValueTypeImplVariantData() { } + + virtual void DeleteValue(wxAnyValueBuffer& buf) const wxOVERRIDE + { + wxVariantData* data = static_cast(buf.m_ptr); + if ( data ) + data->DecRef(); + } + + virtual void CopyBuffer(const wxAnyValueBuffer& src, + wxAnyValueBuffer& dst) const wxOVERRIDE + { + wxVariantData* data = static_cast(src.m_ptr); + if ( data ) + data->IncRef(); + dst.m_ptr = data; + } + + static void SetValue(wxVariantData* value, + wxAnyValueBuffer& buf) + { + value->IncRef(); + buf.m_ptr = value; + } + + static wxVariantData* GetValue(const wxAnyValueBuffer& buf) + { + return static_cast(buf.m_ptr); + } + + virtual bool ConvertValue(const wxAnyValueBuffer& src, + wxAnyValueType* dstType, + wxAnyValueBuffer& dst) const wxOVERRIDE + { + wxUnusedVar(src); + wxUnusedVar(dstType); + wxUnusedVar(dst); + return false; + } +}; + +template<> +class wxAnyValueTypeImpl : + public wxAnyValueTypeImplVariantData +{ +public: + wxAnyValueTypeImpl() : wxAnyValueTypeImplVariantData() { } + virtual ~wxAnyValueTypeImpl() { } +}; + +#endif // wxUSE_VARIANT + + +/* + Let's define a discrete Null value so we don't have to really + ever check if wxAny.m_type pointer is NULL or not. This is an + optimization, mostly. Implementation of this value type is + "hidden" in the source file. +*/ +extern WXDLLIMPEXP_DATA_BASE(wxAnyValueType*) wxAnyNullValueType; + + +// +// We need to implement custom signed/unsigned int equals operators +// for signed/unsigned (eg. wxAny(128UL) == 128L) comparisons to work. +#define WXANY_IMPLEMENT_INT_EQ_OP(TS, TUS) \ +bool operator==(TS value) const \ +{ \ + if ( wxAnyValueTypeImpl::IsSameClass(m_type) ) \ + return (value == static_cast \ + (wxAnyValueTypeImpl::GetValue(m_buffer))); \ + if ( wxAnyValueTypeImpl::IsSameClass(m_type) ) \ + return (value == static_cast \ + (wxAnyValueTypeImpl::GetValue(m_buffer))); \ + return false; \ +} \ +bool operator==(TUS value) const \ +{ \ + if ( wxAnyValueTypeImpl::IsSameClass(m_type) ) \ + return (value == static_cast \ + (wxAnyValueTypeImpl::GetValue(m_buffer))); \ + if ( wxAnyValueTypeImpl::IsSameClass(m_type) ) \ + return (value == static_cast \ + (wxAnyValueTypeImpl::GetValue(m_buffer))); \ + return false; \ +} + + +#if wxUSE_VARIANT + +// Note that the following functions are implemented outside wxAny class +// so that it can reside entirely in header and lack the export declaration. + +// Helper function used to associate wxAnyValueType with a wxVariantData. +extern WXDLLIMPEXP_BASE void +wxPreRegisterAnyToVariant(wxAnyToVariantRegistration* reg); + +// This function performs main wxAny to wxVariant conversion duties. +extern WXDLLIMPEXP_BASE bool +wxConvertAnyToVariant(const wxAny& any, wxVariant* variant); + +#endif // wxUSE_VARIANT + +// +// The wxAny class represents a container for any type. A variant's value +// can be changed at run time, possibly to a different type of value. +// +// As standard, wxAny can store value of almost any type, in a fairly +// optimal manner even. +// +class wxAny +{ +public: + /** + Default constructor. + */ + wxAny() + { + m_type = wxAnyNullValueType; + } + + /** + Destructor. + */ + ~wxAny() + { + m_type->DeleteValue(m_buffer); + } + + //@{ + /** + Various constructors. + */ + template + wxAny(const T& value) + { + m_type = wxAnyValueTypeImpl::sm_instance.get(); + wxAnyValueTypeImpl::SetValue(value, m_buffer); + } + + // These two constructors are needed to deal with string literals +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxAny(const char* value) + { + m_type = wxAnyValueTypeImpl::sm_instance.get(); + wxAnyValueTypeImpl::SetValue(value, m_buffer); + } +#endif + wxAny(const wchar_t* value) + { + m_type = wxAnyValueTypeImpl::sm_instance.get(); + wxAnyValueTypeImpl::SetValue(value, m_buffer); + } + + wxAny(const wxAny& any) + { + m_type = wxAnyNullValueType; + AssignAny(any); + } + +#if wxUSE_VARIANT + wxAny(const wxVariant& variant) + { + m_type = wxAnyNullValueType; + AssignVariant(variant); + } +#endif + + //@} + + /** + Use this template function for checking if this wxAny holds + a specific C++ data type. + + @see wxAnyValueType::CheckType() + */ + template + bool CheckType() const + { + return m_type->CheckType(); + } + + /** + Returns the value type as wxAnyValueType instance. + + @remarks You cannot reliably test whether two wxAnys are of + same value type by simply comparing return values + of wxAny::GetType(). Instead, use wxAny::HasSameType(). + + @see HasSameType() + */ + const wxAnyValueType* GetType() const + { + return m_type; + } + + /** + Returns @true if this and another wxAny have the same + value type. + */ + bool HasSameType(const wxAny& other) const + { + return GetType()->IsSameType(other.GetType()); + } + + /** + Tests if wxAny is null (that is, whether there is no data). + */ + bool IsNull() const + { + return (m_type == wxAnyNullValueType); + } + + /** + Makes wxAny null (that is, clears it). + */ + void MakeNull() + { + m_type->DeleteValue(m_buffer); + m_type = wxAnyNullValueType; + } + + //@{ + /** + Assignment operators. + */ + template + wxAny& operator=(const T &value) + { + m_type->DeleteValue(m_buffer); + m_type = wxAnyValueTypeImpl::sm_instance.get(); + wxAnyValueTypeImpl::SetValue(value, m_buffer); + return *this; + } + + wxAny& operator=(const wxAny &any) + { + if (this != &any) + AssignAny(any); + return *this; + } + +#if wxUSE_VARIANT + wxAny& operator=(const wxVariant &variant) + { + AssignVariant(variant); + return *this; + } +#endif + + // These two operators are needed to deal with string literals +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxAny& operator=(const char* value) + { + Assign(value); + return *this; + } +#endif + wxAny& operator=(const wchar_t* value) + { + Assign(value); + return *this; + } + + //@{ + /** + Equality operators. + */ + bool operator==(const wxString& value) const + { + wxString value2; + if ( !GetAs(&value2) ) + return false; + return value == value2; + } + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + bool operator==(const char* value) const + { return (*this) == wxString(value); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + bool operator==(const wchar_t* value) const + { return (*this) == wxString(value); } + + // + // We need to implement custom signed/unsigned int equals operators + // for signed/unsigned (eg. wxAny(128UL) == 128L) comparisons to work. + WXANY_IMPLEMENT_INT_EQ_OP(signed char, unsigned char) + WXANY_IMPLEMENT_INT_EQ_OP(signed short, unsigned short) + WXANY_IMPLEMENT_INT_EQ_OP(signed int, unsigned int) + WXANY_IMPLEMENT_INT_EQ_OP(signed long, unsigned long) +#ifdef wxLongLong_t + WXANY_IMPLEMENT_INT_EQ_OP(wxLongLong_t, wxULongLong_t) +#endif + + wxGCC_WARNING_SUPPRESS(float-equal) + + bool operator==(float value) const + { + if ( !wxAnyValueTypeImpl::IsSameClass(m_type) ) + return false; + + return value == + static_cast + (wxAnyValueTypeImpl::GetValue(m_buffer)); + } + + bool operator==(double value) const + { + if ( !wxAnyValueTypeImpl::IsSameClass(m_type) ) + return false; + + return value == + static_cast + (wxAnyValueTypeImpl::GetValue(m_buffer)); + } + + wxGCC_WARNING_RESTORE(float-equal) + + bool operator==(bool value) const + { + if ( !wxAnyValueTypeImpl::IsSameClass(m_type) ) + return false; + + return value == (wxAnyValueTypeImpl::GetValue(m_buffer)); + } + + //@} + + //@{ + /** + Inequality operators (implement as template). + */ + template + bool operator!=(const T& value) const + { return !((*this) == value); } + //@} + + /** + This template function converts wxAny into given type. In most cases + no type conversion is performed, so if the type is incorrect an + assertion failure will occur. + + @remarks For convenience, conversion is done when T is wxString. This + is useful when a string literal (which are treated as + const char* and const wchar_t*) has been assigned to wxAny. + */ + template + T As(T* = NULL) const + { + return wxPrivate::wxAnyAsImpl::DoAs(*this); + } + + // Semi private helper: get the value without coercion, for all types. + template + T RawAs() const + { + if ( !wxAnyValueTypeImpl::IsSameClass(m_type) ) + { + wxFAIL_MSG("Incorrect or non-convertible data type"); + } + + return static_cast(wxAnyValueTypeImpl::GetValue(m_buffer)); + } + +#if wxUSE_EXTENDED_RTTI + const wxTypeInfo* GetTypeInfo() const + { + return m_type->GetTypeInfo(); + } +#endif + /** + Template function that retrieves and converts the value of this + variant to the type that T* value is. + + @return Returns @true if conversion was successful. + */ + template + bool GetAs(T* value) const + { + if ( !wxAnyValueTypeImpl::IsSameClass(m_type) ) + { + wxAnyValueType* otherType = + wxAnyValueTypeImpl::sm_instance.get(); + wxAnyValueBuffer temp_buf; + + if ( !m_type->ConvertValue(m_buffer, otherType, temp_buf) ) + return false; + + *value = + static_cast(wxAnyValueTypeImpl::GetValue(temp_buf)); + otherType->DeleteValue(temp_buf); + + return true; + } + *value = static_cast(wxAnyValueTypeImpl::GetValue(m_buffer)); + return true; + } + +#if wxUSE_VARIANT + // GetAs() wxVariant specialization + bool GetAs(wxVariant* value) const + { + return wxConvertAnyToVariant(*this, value); + } +#endif + +private: +#ifdef wxNO_IMPLICIT_WXSTRING_ENCODING + wxAny(const char*); // Disabled + wxAny& operator=(const char *&value); // Disabled + wxAny& operator=(const char value[]); // Disabled + wxAny& operator==(const char *value); // Disabled +#endif + + // Assignment functions + void AssignAny(const wxAny& any) + { + // Must delete value - CopyBuffer() never does that + m_type->DeleteValue(m_buffer); + + wxAnyValueType* newType = any.m_type; + + if ( !newType->IsSameType(m_type) ) + m_type = newType; + + newType->CopyBuffer(any.m_buffer, m_buffer); + } + +#if wxUSE_VARIANT + void AssignVariant(const wxVariant& variant) + { + wxVariantData* data = variant.GetData(); + + if ( data && data->GetAsAny(this) ) + return; + + m_type->DeleteValue(m_buffer); + + if ( variant.IsNull() ) + { + // Init as Null + m_type = wxAnyNullValueType; + } + else + { + // If everything else fails, wrap the whole wxVariantData + m_type = wxAnyValueTypeImpl::sm_instance.get(); + wxAnyValueTypeImpl::SetValue(data, m_buffer); + } + } +#endif + + template + void Assign(const T &value) + { + m_type->DeleteValue(m_buffer); + m_type = wxAnyValueTypeImpl::sm_instance.get(); + wxAnyValueTypeImpl::SetValue(value, m_buffer); + } + + // Data + wxAnyValueBuffer m_buffer; + wxAnyValueType* m_type; +}; + + +namespace wxPrivate +{ + +// Dispatcher for template wxAny::As() implementation which is different for +// wxString and all the other types: the generic implementation check if the +// value is of the right type and returns it. +template +struct wxAnyAsImpl +{ + static T DoAs(const wxAny& any) + { + return any.RawAs(); + } +}; + +// Specialization for wxString does coercion. +template <> +struct wxAnyAsImpl +{ + static wxString DoAs(const wxAny& any) + { + wxString value; + if ( !any.GetAs(&value) ) + { + wxFAIL_MSG("Incorrect or non-convertible data type"); + } + return value; + } +}; + +} + +// See comment for wxANY_VALUE_TYPE_CHECK_TYPE. +#define wxANY_CHECK_TYPE(any, T) \ + wxANY_VALUE_TYPE_CHECK_TYPE((any).GetType(), T) + + +// This macro shouldn't be used any longer for the same reasons as +// wxANY_VALUE_TYPE_CHECK_TYPE(), just call As() directly. +#define wxANY_AS(any, T) \ + (any).As(static_cast(NULL)) + + +template +inline bool wxAnyValueType::CheckType() const +{ + return wxAnyValueTypeImpl::IsSameClass(this); +} + +WX_DECLARE_LIST_WITH_DECL(wxAny, wxAnyList, class WXDLLIMPEXP_BASE); + +#endif // wxUSE_ANY + +#endif // _WX_ANY_H_ diff --git a/lib/wxWidgets/include/wx/anybutton.h b/lib/wxWidgets/include/wx/anybutton.h new file mode 100644 index 0000000..5467e47 --- /dev/null +++ b/lib/wxWidgets/include/wx/anybutton.h @@ -0,0 +1,205 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/anybutton.h +// Purpose: wxAnyButtonBase class +// Author: Vadim Zeitlin +// Created: 2000-08-15 (extracted from button.h) +// Copyright: (c) Vadim Zeitlin +// 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 and have no effect any longer. +#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/bmpbndl.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 wxBitmapBundle& 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 wxBitmapBundle& bitmap) + { DoSetBitmap(bitmap, State_Normal); } + void SetBitmapPressed(const wxBitmapBundle& bitmap) + { DoSetBitmap(bitmap, State_Pressed); } + void SetBitmapDisabled(const wxBitmapBundle& bitmap) + { DoSetBitmap(bitmap, State_Disabled); } + void SetBitmapCurrent(const wxBitmapBundle& bitmap) + { DoSetBitmap(bitmap, State_Current); } + void SetBitmapFocus(const wxBitmapBundle& 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 wxOVERRIDE { 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 + // (and need to be used when using wxBitmapBundle and not just wxBitmap) + 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 the current setting for the "normal" state of the button, it can + // be different from State_Normal for a wxToggleButton + virtual State GetNormalState() const + { + return State_Normal; + } + + // 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 wxOVERRIDE { return wxBORDER_NONE; } + + virtual wxBitmap DoGetBitmap(State WXUNUSED(which)) const + { return wxBitmap(); } + virtual void DoSetBitmap(const wxBitmapBundle& 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(__WXQT__) + #include "wx/qt/anybutton.h" +#else + typedef wxAnyButtonBase wxAnyButton; +#endif + +#endif // wxHAS_ANY_BUTTON + +#endif // _WX_ANYBUTTON_H_BASE_ diff --git a/lib/wxWidgets/include/wx/anystr.h b/lib/wxWidgets/include/wx/anystr.h new file mode 100644 index 0000000..fb71504 --- /dev/null +++ b/lib/wxWidgets/include/wx/anystr.h @@ -0,0 +1,141 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/anystr.h +// Purpose: wxAnyStrPtr class declaration +// Author: Vadim Zeitlin +// Created: 2009-03-23 +// Copyright: (c) 2008 Vadim Zeitlin +// 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 VC7 also needs this one or it complains about ambiguity + // for !anystr expressions + bool operator!() const { return !((bool)*this); } + + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + // 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; + } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + + 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 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 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_DEF_COPY(wxAnyStrPtr); +}; + +#endif // _WX_ANYSTR_H_ + diff --git a/lib/wxWidgets/include/wx/app.h b/lib/wxWidgets/include/wx/app.h new file mode 100644 index 0000000..a2ee467 --- /dev/null +++ b/lib/wxWidgets/include/wx/app.h @@ -0,0 +1,942 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/app.h +// Purpose: wxAppBase class and macros used for declaration of wxApp +// derived class in the user code +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_APP_H_BASE_ +#define _WX_APP_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers we have to include here +// ---------------------------------------------------------------------------- + +#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 wxEventLoopBase; +class WXDLLIMPEXP_FWD_BASE wxMessageOutput; + +#if wxUSE_GUI + 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 +// ---------------------------------------------------------------------------- + +// the type of the function used to create a wxApp object on program start up +typedef wxAppConsole* (*wxAppInitializerFunction)(); + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +enum +{ + wxPRINT_WINDOWS = 1, + wxPRINT_POSTSCRIPT = 2 +}; + +// ---------------------------------------------------------------------------- +// global variables +// ---------------------------------------------------------------------------- + +// 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 + wxAppConsoleBase(); + virtual ~wxAppConsoleBase(); + + + // the virtual functions which may/must be overridden in the derived class + // ----------------------------------------------------------------------- + + // This is the very first function called for a newly created wxApp object, + // it is used by the library to do the global initialization. If, for some + // reason, you must override it (instead of just overriding OnInit(), as + // usual, for app-specific initializations), do not forget to call the base + // class version! + virtual bool Initialize(int& argc, wxChar **argv); + + // This gives wxCocoa a chance to call OnInit() with a memory pool in place + virtual bool CallOnInit() { return OnInit(); } + + // Called before OnRun(), this is a good place to do initialization -- if + // anything fails, return false from here to prevent the program from + // continuing. The command line is normally parsed here, call the base + // class OnInit() to do it. + virtual bool OnInit(); + + // 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(); + + // 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! + virtual void CleanUp(); + + // Called when a fatal exception occurs, this function should take care not + // to do anything which might provoke a nested exception! It may be + // overridden if you wish to react somehow in non-default way (core dump + // under Unix, application crash under Windows) to fatal program errors, + // however extreme care should be taken if you don't want this function to + // crash. + virtual void OnFatalException() { } + + // Called from wxExit() function, should terminate the application a.s.a.p. + virtual void Exit(); + + + // application info: name, description, vendor + // ------------------------------------------- + + // NB: all these should be set by the application itself, there are no + // reasonable default except for the application name which is taken to + // be argv[0] + + // set/get the application name + 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 either 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; } + + // set/get the vendor name + 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 + // ---------------------- + + // all of these methods may be overridden in the derived class to + // customize the command line parsing (by default only a few standard + // options are handled) + // + // you also need to call wxApp::OnInit() from YourApp::OnInit() for all + // this to work + +#if wxUSE_CMDLINE_PARSER + // this one is called from OnInit() to add all supported options + // to the given parser (don't forget to call the base class version if you + // override it!) + virtual void OnInitCmdLine(wxCmdLineParser& parser); + + // called after successfully parsing the command line, return true + // to continue and false to exit (don't forget to call the base class + // version if you override it!) + virtual bool OnCmdLineParsed(wxCmdLineParser& parser); + + // called if "--help" option was specified, return true to continue + // and false to exit + virtual bool OnCmdLineHelp(wxCmdLineParser& parser); + + // called if incorrect command line options were given, return + // false to abort and true to continue + virtual bool OnCmdLineError(wxCmdLineParser& parser); +#endif // wxUSE_CMDLINE_PARSER + + + // miscellaneous customization functions + // ------------------------------------- + + // create the app traits object to which we delegate for everything which + // 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 facade + wxAppTraits *GetTraits(); + + // 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(); + + // 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(); + + // 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; } + + // 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 + // -------------------------- + + // Implement the inherited wxEventFilter method but just return -1 from it + // to indicate that default processing should take place. + virtual int FilterEvent(wxEvent& event) wxOVERRIDE; + + // 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 + // event handler, it would lead to an extra (useless) virtual function call + // if the exceptions were not used, so it doesn't even exist in that case + virtual void HandleEvent(wxEvtHandler *handler, + wxEventFunction func, + wxEvent& event) const; + + // Called when an unhandled C++ exception occurs inside OnRun(): note that + // 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. If this function rethrows the exception, as it does by + // default, simply because there is no general way to handle exceptions, + // StoreCurrentException() will be called to store it because in any case + // the exception can't be allowed to escape. + virtual bool OnExceptionInMainLoop(); + + // This function can be overridden to store the current exception, in view + // of rethrowing it later when RethrowStoredException() is called. If the + // exception was stored, return true. If the exception can't be stored, + // i.e. if this function returns false, the program will abort after + // calling OnUnhandledException(). + // + // The default implementation of this function when using C++98 compiler + // just returns false, as there is no generic way to store an arbitrary + // exception in C++98 and each application must do it on its own for the + // exceptions it uses in its overridden version. When using C++11, the + // default implementation uses std::current_exception() and returns true, + // so it's normally not necessary to override this method when using C++11. + virtual bool StoreCurrentException(); + + // If StoreCurrentException() is overridden, this function should be + // overridden as well to rethrow the exceptions stored by it when the + // control gets back to our code, i.e. when it's safe to do it. + // + // The default version does nothing when using C++98 and uses + // std::rethrow_exception() in C++11. + virtual void RethrowStoredException(); +#endif // wxUSE_EXCEPTIONS + + + // 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(); + + // check if there are pending events on global pending event list + bool HasPendingEvents() const; + + // temporary suspends processing of the pending events + void SuspendProcessingOfPendingEvents(); + + // 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 + // ----------------- + + // 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) + // + // the arguments are the location of the failed assert (func may be empty + // if the compiler doesn't support C99 __FUNCTION__), the text of the + // assert itself and the user-specified message + virtual void OnAssertFailure(const wxChar *file, + int line, + const wxChar *func, + const wxChar *cond, + const wxChar *msg); + + // old version of the function without func parameter, for compatibility + // only, override OnAssertFailure() in the new code + virtual void OnAssert(const wxChar *file, + int line, + const wxChar *cond, + const wxChar *msg); + + // check that the wxBuildOptions object (constructed in the application + // 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); + + // implementation only from now on + // ------------------------------- + + // helpers for dynamic wxApp construction + static void SetInitializerFunction(wxAppInitializerFunction fn) + { ms_appInitFn = fn; } + static wxAppInitializerFunction GetInitializerFunction() + { return ms_appInitFn; } + + // accessors for ms_appInstance field (external code might wish to modify + // it, this is why we provide a setter here as well, but you should really + // know what you're doing if you call it), wxTheApp is usually used instead + // of GetInstance() + static wxAppConsole *GetInstance() { return ms_appInstance; } + static void SetInstance(wxAppConsole *app) { ms_appInstance = app; } + + // returns true for GUI wxApp subclasses + virtual bool IsGUI() const { return false; } + + + // command line arguments (public for backwards compatibility) + 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") + 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; + + // Stub virtual functions for forward binary compatibility. DO NOT USE. + virtual void* WXReservedApp1(void*); + virtual void* WXReservedApp2(void*); + + // the application object is a singleton anyhow, there is no sense in + // copying it + 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 +// ---------------------------------------------------------------------------- + +#if wxUSE_GUI + +class WXDLLIMPEXP_CORE wxAppBase : public wxAppConsole +{ +public: + wxAppBase(); + virtual ~wxAppBase(); + + // the virtual functions which may/must be overridden in the derived class + // ----------------------------------------------------------------------- + + // very first initialization function + // + // Override: very rarely + virtual bool Initialize(int& argc, wxChar **argv) wxOVERRIDE; + + // a platform-dependent version of OnInit(): the code here is likely to + // depend on the toolkit. default version does nothing. + // + // Override: rarely. + virtual bool OnInitGui(); + + // called to start program execution - the default version just enters + // the main GUI loop in which events are received and processed until + // the last window is not deleted (if GetExitOnFrameDelete) or + // ExitMainLoop() is called. In console mode programs, the execution + // of the program really starts here + // + // Override: rarely in GUI applications, always in console ones. + virtual int OnRun() wxOVERRIDE; + + // a matching function for OnInit() + virtual int OnExit() wxOVERRIDE; + + // very last clean up function + // + // Override: very rarely + virtual void CleanUp() wxOVERRIDE; + + + // the worker functions - usually not used directly by the user code + // ----------------------------------------------------------------- + + // 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 + // parties + // + // it should return true if more idle events are needed, false if not + virtual bool ProcessIdle() wxOVERRIDE; + + // override base class version: GUI apps always use an event loop + virtual bool UsesEventLoop() const wxOVERRIDE { return true; } + + + // top level window functions + // -------------------------- + + // return true if our app has focus + virtual bool IsActive() const { return m_isActive; } + + // set the "main" top level window + void SetTopWindow(wxWindow *win) { m_topWindow = win; } + + // return the "main" top level window (if it hadn't been set previously + // with SetTopWindow(), will return just some top level window and, if + // there are none, will return NULL) + virtual wxWindow *GetTopWindow() const; + + // convenient helper which is safe to use even if there is no wxApp at + // all, it will just return NULL in this case + static wxWindow *GetMainTopWindow(); + + // control the exit behaviour: by default, the program will exit the + // main loop (and so, usually, terminate) when the last top-level + // program window is deleted. Beware that if you disable this behaviour + // (with SetExitOnFrameDelete(false)), you'll have to call + // ExitMainLoop() explicitly from somewhere. + void SetExitOnFrameDelete(bool flag) + { m_exitOnFrameDelete = flag ? Yes : No; } + bool GetExitOnFrameDelete() const + { return m_exitOnFrameDelete == Yes; } + + + // display mode, visual, printing mode, ... + // ------------------------------------------------------------------------ + + // Get display mode that is used use. This is only used in framebuffer + // wxWin ports such as wxDFB. + virtual wxVideoMode GetDisplayMode() const; + // Set display mode to use. This is only used in framebuffer wxWin + // 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 ) + { m_useBestVisual = flag; m_forceTrueColour = forceTrueColour; } + bool GetUseBestVisual() const { return m_useBestVisual; } + + // set/get printing mode: see wxPRINT_XXX constants. + // + // default behaviour is the normal one for Unix: always use PostScript + // printing. + virtual void SetPrintMode(int WXUNUSED(mode)) { } + int GetPrintMode() const { return wxPRINT_POSTSCRIPT; } + + // Return the layout direction for the current locale or wxLayout_Default + // 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) + // ------------------------------------------------------------------------ + +#if wxUSE_CMDLINE_PARSER + virtual bool OnCmdLineParsed(wxCmdLineParser& parser) wxOVERRIDE; + virtual void OnInitCmdLine(wxCmdLineParser& parser) wxOVERRIDE; +#endif + + // miscellaneous other stuff + // ------------------------------------------------------------------------ + + // called by toolkit-specific code to set the app status: active (we have + // focus) or not and also the last window which had focus before we were + // deactivated + virtual void SetActive(bool isActive, wxWindow *lastFocus); + + virtual bool IsGUI() const wxOVERRIDE { return true; } + + // returns non-null pointer only if we have a GUI application object: this + // is only useful in the rare cases when the same code can be used in both + // console and GUI applications, but needs to use GUI-specific functions if + // the GUI is available + static wxAppBase *GetGUIInstance() + { + return ms_appInstance && ms_appInstance->IsGUI() + ? static_cast(ms_appInstance) + : NULL; + } + +protected: + // override base class method to use GUI traits + virtual wxAppTraits *CreateTraits() wxOVERRIDE; + + // Helper method deleting all existing top level windows: this is used + // during the application shutdown. + void DeleteAllTLWs(); + + + // the main top level window (may be NULL) + wxWindow *m_topWindow; + + // if Yes, exit the main loop when the last top level window is deleted, if + // No don't do it and if Later -- only do it once we reach our OnRun() + // + // the explanation for using this strange scheme is given in appcmn.cpp + enum + { + Later = -1, + No, + Yes + } m_exitOnFrameDelete; + + // true if the app wants to use the best visual on systems where + // more than one are available (Sun, SGI, XFree86 4.0 ?) + bool m_useBestVisual; + // force TrueColour just in case "best" isn't TrueColour + bool m_forceTrueColour; + + // does any of our windows have focus? + bool m_isActive; + + wxDECLARE_NO_COPY_CLASS(wxAppBase); +}; + +// ---------------------------------------------------------------------------- +// now include the declaration of the real class +// ---------------------------------------------------------------------------- + +#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(__WXQT__) + #include "wx/qt/app.h" +#endif + +#else // !GUI + +// 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 + +// ---------------------------------------------------------------------------- +// the global data +// ---------------------------------------------------------------------------- + +// for compatibility, we define this macro to access the global application +// object of type wxApp +// +// note that instead of using of wxTheApp in application code you should +// 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 (but see also wxApp::GetGUIInstance()) +#define wxTheApp static_cast(wxApp::GetInstance()) + +// ---------------------------------------------------------------------------- +// global functions +// ---------------------------------------------------------------------------- + +// event loop related functions only work in GUI programs +// ------------------------------------------------------ + +// Force an exit from main loop +WXDLLIMPEXP_BASE void wxExit(); + +// 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 +WXDLLIMPEXP_CORE bool wxYield(); + +#endif // wx_YIELD_DECLARED + +// Yield to other apps/messages +WXDLLIMPEXP_BASE void wxWakeUpIdle(); + +// ---------------------------------------------------------------------------- +// macros for dynamic creation of the application object +// ---------------------------------------------------------------------------- + +// Having a global instance of this class allows wxApp to be aware of the app +// creator function. wxApp can then call this function to create a new app +// object. Convoluted, but necessary. + +class WXDLLIMPEXP_BASE wxAppInitializer +{ +public: + wxAppInitializer(wxAppInitializerFunction fn) + { wxApp::SetInitializerFunction(fn); } +}; + +// 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 wxIMPLEMENT_APP should add this code if required. + +// For compilers that support it, prefer to use wmain() and let the CRT parse +// the command line for us, for the others parse it ourselves under Windows to +// ensure that wxWidgets console applications accept arbitrary Unicode strings +// as command line parameters and not just those representable in the current +// locale (under Unix UTF-8, capable of representing any Unicode string, is +// almost always used and there is no way to retrieve the Unicode command line +// anyhow). +#if wxUSE_UNICODE && defined(__WINDOWS__) + #ifdef __VISUALC__ + #define wxIMPLEMENT_WXWIN_MAIN_CONSOLE \ + int wmain(int argc, wchar_t **argv) \ + { \ + wxDISABLE_DEBUG_SUPPORT(); \ + \ + return wxEntry(argc, argv); \ + } + #else // No wmain(), use main() but don't trust its arguments. + #define wxIMPLEMENT_WXWIN_MAIN_CONSOLE \ + int main(int, char **) \ + { \ + wxDISABLE_DEBUG_SUPPORT(); \ + \ + return wxEntry(); \ + } + #endif +#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 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 wxIMPLEMENT_WX_THEME_SUPPORT \ + WX_USE_THEME(wxUNIV_DEFAULT_THEME); + #else + #define wxIMPLEMENT_WX_THEME_SUPPORT + #endif +#else + #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 wxIMPLEMENT_APP_NO_MAIN(appname) \ + appname& wxGetApp() { return *static_cast(wxApp::GetInstance()); } \ + wxAppConsole *wxCreateApp() \ + { \ + wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, \ + "your program"); \ + return new appname; \ + } \ + wxAppInitializer \ + wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp) + +// Same as wxIMPLEMENT_APP() normally but doesn't include themes support in +// wxUniversal builds +#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 wxIMPLEMENT_APP(appname) \ + wxIMPLEMENT_WX_THEME_SUPPORT \ + wxIMPLEMENT_APP_NO_THEMES(appname) + +// Same as wxIMPLEMENT_APP(), but for console applications. +#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 wxDECLARE_APP(appname) \ + extern appname& wxGetApp() + + +// 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 compiler 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_ diff --git a/lib/wxWidgets/include/wx/appprogress.h b/lib/wxWidgets/include/wx/appprogress.h new file mode 100644 index 0000000..63bd6e5 --- /dev/null +++ b/lib/wxWidgets/include/wx/appprogress.h @@ -0,0 +1,54 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/appprogress.h +// Purpose: wxAppProgressIndicator interface. +// Author: Chaobin Zhang +// Created: 2014-09-05 +// Copyright: (c) 2014 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_APPPROG_H_ +#define _WX_APPPROG_H_ + +#include "wx/defs.h" + +class WXDLLIMPEXP_CORE wxAppProgressIndicatorBase +{ +public: + wxAppProgressIndicatorBase() {} + virtual ~wxAppProgressIndicatorBase() {} + + virtual bool IsAvailable() const = 0; + + virtual void SetValue(int value) = 0; + virtual void SetRange(int range) = 0; + virtual void Pulse() = 0; + virtual void Reset() = 0; + +private: + wxDECLARE_NO_COPY_CLASS(wxAppProgressIndicatorBase); +}; + +#if defined(__WXMSW__) && wxUSE_TASKBARBUTTON + #include "wx/msw/appprogress.h" +#elif defined(__WXOSX_COCOA__) + #include "wx/osx/appprogress.h" +#else + class wxAppProgressIndicator : public wxAppProgressIndicatorBase + { + public: + wxAppProgressIndicator(wxWindow* WXUNUSED(parent) = NULL, + int WXUNUSED(maxValue) = 100) + { + } + + virtual bool IsAvailable() const wxOVERRIDE { return false; } + + virtual void SetValue(int WXUNUSED(value)) wxOVERRIDE { } + virtual void SetRange(int WXUNUSED(range)) wxOVERRIDE { } + virtual void Pulse() wxOVERRIDE { } + virtual void Reset() wxOVERRIDE { } + }; +#endif + +#endif // _WX_APPPROG_H_ diff --git a/lib/wxWidgets/include/wx/apptrait.h b/lib/wxWidgets/include/wx/apptrait.h new file mode 100644 index 0000000..13cfab2 --- /dev/null +++ b/lib/wxWidgets/include/wx/apptrait.h @@ -0,0 +1,312 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/apptrait.h +// Purpose: declaration of wxAppTraits and derived classes +// Author: Vadim Zeitlin +// Modified by: +// Created: 19.06.2003 +// Copyright: (c) 2003 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_APPTRAIT_H_ +#define _WX_APPTRAIT_H_ + +#include "wx/string.h" +#include "wx/platinfo.h" + +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 wxSocketManager; + + +// ---------------------------------------------------------------------------- +// wxAppTraits: this class defines various configurable aspects of wxApp +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxAppTraitsBase +{ +public: + // needed since this class declares virtual members + virtual ~wxAppTraitsBase() { } + + // 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; +#endif // wxUSE_LOG + + // create the global object used for printing out messages + virtual wxMessageOutput *CreateMessageOutput() = 0; + +#if wxUSE_FONTMAP + // create the global font mapper object used for encodings/charset mapping + virtual wxFontMapper *CreateFontMapper() = 0; +#endif // wxUSE_FONTMAP + + // get the renderer to use for drawing the generic controls (return value + // may be NULL in which case the default renderer for the current platform + // is used); this is used in GUI only and always returns NULL in console + // + // NB: returned pointer will be deleted by the caller + virtual wxRendererNative *CreateRenderer() = 0; + + // wxStandardPaths object is normally the same for wxBase and wxGUI + virtual wxStandardPaths& GetStandardPaths(); + + + // functions abstracting differences between GUI and console modes + // ------------------------------------------------------------------------ + + // show the assert dialog with the specified message in GUI or just print + // the string to stderr in console mode + // + // base class version has an implementation (in spite of being pure + // virtual) in base/appbase.cpp which can be called as last resort. + // + // return true to suppress subsequent asserts, false to continue as before + virtual bool ShowAssertDialog(const wxString& msg) = 0; + + // show the message safely to the user, i.e. show it in a message box if + // possible (even in a console application!) or return false if we can't do + // it (e.g. GUI is not initialized at all) + // + // note that this function can be called even when wxApp doesn't exist, as + // it's supposed to be always safe to call -- hence the name + // + // return true if the message box was shown, false if nothing was done + virtual bool SafeMessageBox(const wxString& text, const wxString& title) = 0; + + // return true if fprintf(stderr) goes somewhere, false otherwise + virtual bool HasStderr() = 0; + +#if wxUSE_SOCKETS + // 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 = NULL, + int *minVer = NULL, + int *microVer = 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 = 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; + } + + +#if wxUSE_STACKWALKER + // Helper function mostly useful for derived classes ShowAssertDialog() + // implementation. + // + // Returns the stack frame as a plain (and possibly empty) wxString. + virtual wxString GetAssertStackTrace(); +#endif // wxUSE_STACKWALKER + +protected: + // Stub virtual functions for forward binary compatibility. DO NOT USE. + virtual void* WXReservedAppTraits1(void*); + virtual void* WXReservedAppTraits2(void*); + +private: + static wxSocketManager *ms_manager; +}; + +// ---------------------------------------------------------------------------- +// include the platform-specific version of the class +// ---------------------------------------------------------------------------- + +// 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(__WIN32__) + #include "wx/msw/apptbase.h" +#elif defined(__UNIX__) + #include "wx/unix/apptbase.h" +#else // no platform-specific methods to add to wxAppTraits + // wxAppTraits must be a class because it was forward declared as class + class WXDLLIMPEXP_BASE wxAppTraits : public wxAppTraitsBase + { + }; +#endif // platform + +// ============================================================================ +// standard traits for console and GUI applications +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxConsoleAppTraitsBase: wxAppTraits implementation for the console apps +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxConsoleAppTraitsBase : public wxAppTraits +{ +public: +#if !wxUSE_CONSOLE_EVENTLOOP + virtual wxEventLoopBase *CreateEventLoop() wxOVERRIDE { return NULL; } +#endif // !wxUSE_CONSOLE_EVENTLOOP + +#if wxUSE_LOG + virtual wxLog *CreateLogTarget() wxOVERRIDE; +#endif // wxUSE_LOG + virtual wxMessageOutput *CreateMessageOutput() wxOVERRIDE; +#if wxUSE_FONTMAP + virtual wxFontMapper *CreateFontMapper() wxOVERRIDE; +#endif // wxUSE_FONTMAP + virtual wxRendererNative *CreateRenderer() wxOVERRIDE; + + virtual bool ShowAssertDialog(const wxString& msg) wxOVERRIDE; + virtual bool HasStderr() wxOVERRIDE; + virtual bool SafeMessageBox(const wxString& text, + const wxString& title) wxOVERRIDE; + + // the GetToolkitVersion for console application is always the same + wxPortId GetToolkitVersion(int *verMaj = NULL, + int *verMin = NULL, + int *verMicro = NULL) const wxOVERRIDE + { + // no toolkits (wxBase is for console applications without GUI support) + // NB: zero means "no toolkit", -1 means "not initialized yet" + // so we must use zero here! + if (verMaj) *verMaj = 0; + if (verMin) *verMin = 0; + if (verMicro) *verMicro = 0; + return wxPORT_BASE; + } + + virtual bool IsUsingUniversalWidgets() const wxOVERRIDE { return false; } + virtual wxString GetDesktopEnvironment() const wxOVERRIDE { return wxEmptyString; } +}; + +// ---------------------------------------------------------------------------- +// wxGUIAppTraitsBase: wxAppTraits implementation for the GUI apps +// ---------------------------------------------------------------------------- + +#if wxUSE_GUI + +class WXDLLIMPEXP_CORE wxGUIAppTraitsBase : public wxAppTraits +{ +public: +#if wxUSE_LOG + virtual wxLog *CreateLogTarget() wxOVERRIDE; +#endif // wxUSE_LOG + virtual wxMessageOutput *CreateMessageOutput() wxOVERRIDE; +#if wxUSE_FONTMAP + virtual wxFontMapper *CreateFontMapper() wxOVERRIDE; +#endif // wxUSE_FONTMAP + virtual wxRendererNative *CreateRenderer() wxOVERRIDE; + + virtual bool ShowAssertDialog(const wxString& msg) wxOVERRIDE; + virtual bool HasStderr() wxOVERRIDE; + + // Win32 has its own implementation using native message box directly in + // the base class, don't override it. +#ifndef __WIN32__ + virtual bool SafeMessageBox(const wxString& text, + const wxString& title) wxOVERRIDE; +#endif // !__WIN32__ + + virtual bool IsUsingUniversalWidgets() const wxOVERRIDE + { + #ifdef __WXUNIVERSAL__ + return true; + #else + return false; + #endif + } + + virtual wxString GetDesktopEnvironment() const wxOVERRIDE { return wxEmptyString; } +}; + +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// include the platform-specific version of the classes above +// ---------------------------------------------------------------------------- + +// ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port +#if defined(__WIN32__) + #include "wx/msw/apptrait.h" +#elif defined(__UNIX__) + #include "wx/unix/apptrait.h" +#else + #if wxUSE_GUI + class wxGUIAppTraits : public wxGUIAppTraitsBase + { + }; + #endif // wxUSE_GUI + class wxConsoleAppTraits: public wxConsoleAppTraitsBase + { + }; +#endif // platform + +#endif // _WX_APPTRAIT_H_ + diff --git a/lib/wxWidgets/include/wx/archive.h b/lib/wxWidgets/include/wx/archive.h new file mode 100644 index 0000000..2e32e7a --- /dev/null +++ b/lib/wxWidgets/include/wx/archive.h @@ -0,0 +1,378 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/archive.h +// Purpose: Streams for archive formats +// Author: Mike Wetherell +// Copyright: (c) 2004 Mike Wetherell +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ARCHIVE_H__ +#define _WX_ARCHIVE_H__ + +#include "wx/defs.h" + +#if wxUSE_STREAMS && wxUSE_ARCHIVE_STREAMS + +#include "wx/stream.h" +#include "wx/filename.h" + + +///////////////////////////////////////////////////////////////////////////// +// wxArchiveNotifier + +class WXDLLIMPEXP_BASE wxArchiveNotifier +{ +public: + virtual ~wxArchiveNotifier() { } + + virtual void OnEntryUpdated(class wxArchiveEntry& entry) = 0; +}; + + +///////////////////////////////////////////////////////////////////////////// +// wxArchiveEntry +// +// Holds an entry's meta data, such as filename and timestamp. + +class WXDLLIMPEXP_BASE wxArchiveEntry : public wxObject +{ +public: + virtual ~wxArchiveEntry() { } + + virtual wxDateTime GetDateTime() const = 0; + virtual wxFileOffset GetSize() const = 0; + virtual wxFileOffset GetOffset() const = 0; + virtual bool IsDir() const = 0; + virtual bool IsReadOnly() const = 0; + virtual wxString GetInternalName() const = 0; + virtual wxPathFormat GetInternalFormat() const = 0; + virtual wxString GetName(wxPathFormat format = wxPATH_NATIVE) const = 0; + + virtual void SetDateTime(const wxDateTime& dt) = 0; + virtual void SetSize(wxFileOffset size) = 0; + virtual void SetIsDir(bool isDir = true) = 0; + virtual void SetIsReadOnly(bool isReadOnly = true) = 0; + virtual void SetName(const wxString& name, + wxPathFormat format = wxPATH_NATIVE) = 0; + + wxArchiveEntry *Clone() const { return DoClone(); } + + void SetNotifier(wxArchiveNotifier& notifier); + virtual void UnsetNotifier() { m_notifier = NULL; } + +protected: + wxArchiveEntry() : m_notifier(NULL) { } + wxArchiveEntry(const wxArchiveEntry& e) : wxObject(e), m_notifier(NULL) { } + + virtual void SetOffset(wxFileOffset offset) = 0; + virtual wxArchiveEntry* DoClone() const = 0; + + wxArchiveNotifier *GetNotifier() const { return m_notifier; } + wxArchiveEntry& operator=(const wxArchiveEntry& entry); + +private: + wxArchiveNotifier *m_notifier; + + wxDECLARE_ABSTRACT_CLASS(wxArchiveEntry); +}; + + +///////////////////////////////////////////////////////////////////////////// +// wxArchiveInputStream +// +// GetNextEntry() returns a wxArchiveEntry object containing the meta-data +// for the next entry in the archive (and gives away ownership). Reading from +// the wxArchiveInputStream then returns the entry's data. Eof() becomes true +// after an attempt has been made to read past the end of the entry's data. +// +// When there are no more entries, GetNextEntry() returns NULL and sets Eof(). + +class WXDLLIMPEXP_BASE wxArchiveInputStream : public wxFilterInputStream +{ +public: + typedef wxArchiveEntry entry_type; + + virtual ~wxArchiveInputStream() { } + + virtual bool OpenEntry(wxArchiveEntry& entry) = 0; + virtual bool CloseEntry() = 0; + + wxArchiveEntry *GetNextEntry() { return DoGetNextEntry(); } + + virtual char Peek() wxOVERRIDE { return wxInputStream::Peek(); } + +protected: + wxArchiveInputStream(wxInputStream& stream, wxMBConv& conv); + wxArchiveInputStream(wxInputStream *stream, wxMBConv& conv); + + virtual wxArchiveEntry *DoGetNextEntry() = 0; + + wxMBConv& GetConv() const { return m_conv; } + +private: + wxMBConv& m_conv; +}; + + +///////////////////////////////////////////////////////////////////////////// +// wxArchiveOutputStream +// +// PutNextEntry is used to create a new entry in the output archive, then +// the entry's data is written to the wxArchiveOutputStream. +// +// Only one entry can be open for output at a time; another call to +// PutNextEntry closes the current entry and begins the next. +// +// The overload 'bool PutNextEntry(wxArchiveEntry *entry)' takes ownership +// of the entry object. + +class WXDLLIMPEXP_BASE wxArchiveOutputStream : public wxFilterOutputStream +{ +public: + virtual ~wxArchiveOutputStream() { } + + virtual bool PutNextEntry(wxArchiveEntry *entry) = 0; + + virtual bool PutNextEntry(const wxString& name, + const wxDateTime& dt = wxDateTime::Now(), + wxFileOffset size = wxInvalidOffset) = 0; + + virtual bool PutNextDirEntry(const wxString& name, + const wxDateTime& dt = wxDateTime::Now()) = 0; + + virtual bool CopyEntry(wxArchiveEntry *entry, + wxArchiveInputStream& stream) = 0; + + virtual bool CopyArchiveMetaData(wxArchiveInputStream& stream) = 0; + + virtual bool CloseEntry() = 0; + +protected: + wxArchiveOutputStream(wxOutputStream& stream, wxMBConv& conv); + wxArchiveOutputStream(wxOutputStream *stream, wxMBConv& conv); + + wxMBConv& GetConv() const { return m_conv; } + +private: + wxMBConv& m_conv; +}; + + +///////////////////////////////////////////////////////////////////////////// +// wxArchiveIterator +// +// An input iterator that can be used to transfer an archive's catalog to +// a container. + +#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR +#include +#include + +template inline +void _wxSetArchiveIteratorValue( + X& val, Y entry, void *WXUNUSED(d)) +{ + val = X(entry); +} +template inline +void _wxSetArchiveIteratorValue( + std::pair& val, Z entry, Z WXUNUSED(d)) +{ + val = std::make_pair(X(entry->GetInternalName()), Y(entry)); +} + +template +class wxArchiveIterator +{ +public: + typedef std::input_iterator_tag iterator_category; + typedef T value_type; + typedef ptrdiff_t difference_type; + typedef T* pointer; + typedef T& reference; + + wxArchiveIterator() : m_rep(NULL) { } + + wxArchiveIterator(Arc& arc) { + typename Arc::entry_type* entry = arc.GetNextEntry(); + m_rep = entry ? new Rep(arc, entry) : NULL; + } + + wxArchiveIterator(const wxArchiveIterator& it) : m_rep(it.m_rep) { + if (m_rep) + m_rep->AddRef(); + } + + ~wxArchiveIterator() { + if (m_rep) + m_rep->UnRef(); + } + + const T& operator *() const { + return m_rep->GetValue(); + } + + const T* operator ->() const { + return &**this; + } + + wxArchiveIterator& operator =(const wxArchiveIterator& it) { + if (it.m_rep) + it.m_rep.AddRef(); + if (m_rep) + this->m_rep.UnRef(); + m_rep = it.m_rep; + return *this; + } + + wxArchiveIterator& operator ++() { + m_rep = m_rep->Next(); + return *this; + } + + wxArchiveIterator operator ++(int) { + wxArchiveIterator it(*this); + ++(*this); + return it; + } + + bool operator ==(const wxArchiveIterator& j) const { + return m_rep == j.m_rep; + } + + bool operator !=(const wxArchiveIterator& j) const { + return !(*this == j); + } + +private: + class Rep { + Arc& m_arc; + typename Arc::entry_type* m_entry; + T m_value; + int m_ref; + + public: + Rep(Arc& arc, typename Arc::entry_type* entry) + : m_arc(arc), m_entry(entry), m_value(), m_ref(1) { } + ~Rep() + { delete m_entry; } + + void AddRef() { + m_ref++; + } + + void UnRef() { + if (--m_ref == 0) + delete this; + } + + Rep *Next() { + typename Arc::entry_type* entry = m_arc.GetNextEntry(); + if (!entry) { + UnRef(); + return NULL; + } + if (m_ref > 1) { + m_ref--; + return new Rep(m_arc, entry); + } + delete m_entry; + m_entry = entry; + m_value = T(); + return this; + } + + const T& GetValue() { + if (m_entry) { + _wxSetArchiveIteratorValue(m_value, m_entry, m_entry); + m_entry = NULL; + } + return m_value; + } + } *m_rep; +}; + +typedef wxArchiveIterator wxArchiveIter; +typedef wxArchiveIterator > wxArchivePairIter; + +#endif // wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR + + +///////////////////////////////////////////////////////////////////////////// +// wxArchiveClassFactory +// +// A wxArchiveClassFactory instance for a particular archive type allows +// the creation of the other classes that may be needed. + +void WXDLLIMPEXP_BASE wxUseArchiveClasses(); + +class WXDLLIMPEXP_BASE wxArchiveClassFactory : public wxFilterClassFactoryBase +{ +public: + typedef wxArchiveEntry entry_type; + typedef wxArchiveInputStream instream_type; + typedef wxArchiveOutputStream outstream_type; + typedef wxArchiveNotifier notifier_type; +#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR + typedef wxArchiveIter iter_type; + typedef wxArchivePairIter pairiter_type; +#endif + + virtual ~wxArchiveClassFactory() { } + + wxArchiveEntry *NewEntry() const + { return DoNewEntry(); } + wxArchiveInputStream *NewStream(wxInputStream& stream) const + { return DoNewStream(stream); } + wxArchiveOutputStream *NewStream(wxOutputStream& stream) const + { return DoNewStream(stream); } + wxArchiveInputStream *NewStream(wxInputStream *stream) const + { return DoNewStream(stream); } + wxArchiveOutputStream *NewStream(wxOutputStream *stream) const + { return DoNewStream(stream); } + + virtual wxString GetInternalName( + 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 wxString& protocol, + wxStreamProtocolType type + = wxSTREAM_PROTOCOL); + + static const wxArchiveClassFactory *GetFirst(); + const wxArchiveClassFactory *GetNext() const { return m_next; } + + void PushFront() { Remove(); m_next = sm_first; sm_first = this; } + void Remove(); + +protected: + // old compilers don't support covarient returns, so 'Do' methods are + // used to simulate them + virtual wxArchiveEntry *DoNewEntry() const = 0; + virtual wxArchiveInputStream *DoNewStream(wxInputStream& stream) const = 0; + virtual wxArchiveOutputStream *DoNewStream(wxOutputStream& stream) const = 0; + virtual wxArchiveInputStream *DoNewStream(wxInputStream *stream) const = 0; + virtual wxArchiveOutputStream *DoNewStream(wxOutputStream *stream) const = 0; + + wxArchiveClassFactory() : m_pConv(NULL), m_next(this) { } + wxArchiveClassFactory& operator=(const wxArchiveClassFactory& WXUNUSED(f)) + { return *this; } + +private: + wxMBConv *m_pConv; + static wxArchiveClassFactory *sm_first; + wxArchiveClassFactory *m_next; + + wxDECLARE_ABSTRACT_CLASS(wxArchiveClassFactory); +}; + +#endif // wxUSE_STREAMS && wxUSE_ARCHIVE_STREAMS + +#endif // _WX_ARCHIVE_H__ diff --git a/lib/wxWidgets/include/wx/arrimpl.cpp b/lib/wxWidgets/include/wx/arrimpl.cpp new file mode 100644 index 0000000..020280e --- /dev/null +++ b/lib/wxWidgets/include/wx/arrimpl.cpp @@ -0,0 +1,33 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/arrimpl.cpp +// Purpose: helper file for implementation of dynamic lists +// Author: Vadim Zeitlin +// Modified by: +// Created: 16.10.97 +// Copyright: (c) 1997 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +/***************************************************************************** + * Purpose: implements helper functions used by the template class used by * + * DECLARE_OBJARRAY macro and which couldn't be implemented inline * + * (because they need the full definition of type T in scope) * + * * + * Usage: 1) #include dynarray.h * + * 2) WX_DECLARE_OBJARRAY * + * 3) #include arrimpl.cpp * + * 4) WX_DEFINE_OBJARRAY * + *****************************************************************************/ + +#undef WX_DEFINE_OBJARRAY +#define WX_DEFINE_OBJARRAY(name) \ +name::value_type* \ +wxObjectArrayTraitsFor##name::Clone(const name::value_type& item) \ +{ \ + return new name::value_type(item); \ +} \ + \ +void wxObjectArrayTraitsFor##name::Free(name::value_type* p) \ +{ \ + delete p; \ +} diff --git a/lib/wxWidgets/include/wx/arrstr.h b/lib/wxWidgets/include/wx/arrstr.h new file mode 100644 index 0000000..dcc1b6b --- /dev/null +++ b/lib/wxWidgets/include/wx/arrstr.h @@ -0,0 +1,577 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/arrstr.h +// Purpose: wxArrayString class +// Author: Mattia Barbon and Vadim Zeitlin +// Modified by: +// Created: 07/07/03 +// Copyright: (c) 2003 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ARRSTR_H +#define _WX_ARRSTR_H + +#include "wx/defs.h" +#include "wx/string.h" +#include "wx/dynarray.h" + +#if wxUSE_STD_CONTAINERS_COMPATIBLY + #include +#endif +#ifdef wxHAVE_INITIALIZER_LIST + #include +#endif + +// 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(const wxString& s1, const wxString& s2) +{ + return s1.Cmp(s2); +} + +inline int wxCMPFUNC_CONV wxStringSortDescending(const wxString& s1, const wxString& s2) +{ + return wxStringSortAscending(s2, s1); +} + +// This comparison function ignores case when comparing strings differing not +// in case only, i.e. this ensures that "Aa" comes before "AB", unlike with +// wxStringSortAscending(). +inline int wxCMPFUNC_CONV +wxDictionaryStringSortAscending(const wxString& s1, const wxString& s2) +{ + const int cmp = s1.CmpNoCase(s2); + return cmp ? cmp : s1.Cmp(s2); +} + + +inline int wxCMPFUNC_CONV +wxDictionaryStringSortDescending(const wxString& s1, const wxString& s2) +{ + return wxDictionaryStringSortAscending(s2, s1); +} + +WXDLLIMPEXP_BASE +int wxCMPFUNC_CONV wxCmpNatural(const wxString& s1, const wxString& s2); + +WXDLLIMPEXP_BASE +int wxCMPFUNC_CONV wxCmpNaturalGeneric(const wxString& s1, const wxString& s2); + +inline int wxCMPFUNC_CONV wxNaturalStringSortAscending(const wxString& s1, const wxString& s2) +{ + return wxCmpNatural(s1, s2); +} + +inline int wxCMPFUNC_CONV wxNaturalStringSortDescending(const wxString& s1, const wxString& s2) +{ + return wxCmpNatural(s2, s1); +} + + +#if wxUSE_STD_CONTAINERS + +typedef int (wxCMPFUNC_CONV *CMPFUNCwxString)(wxString*, wxString*); +WX_DEFINE_USER_EXPORTED_TYPEARRAY(wxString, wxArrayStringBase, + wxARRAY_DUMMY_BASE, WXDLLIMPEXP_BASE); + +class WXDLLIMPEXP_BASE wxArrayString : public wxArrayStringBase +{ +public: + // type of function used by wxArrayString::Sort() + typedef int (wxCMPFUNC_CONV *CompareFunction)(const wxString& first, + const wxString& second); + + wxArrayString() { } + wxArrayString(size_t sz, const char** a); + wxArrayString(size_t sz, const wchar_t** a); + wxArrayString(size_t sz, const wxString* a); +#ifdef wxHAVE_INITIALIZER_LIST + template + wxArrayString(std::initializer_list list) : wxArrayStringBase(list) { } +#endif + + int Index(const wxString& str, bool bCase = true, bool bFromEnd = false) const; + + void Sort(bool reverseOrder = false); + void Sort(CompareFunction function); + void Sort(CMPFUNCwxString function) { wxArrayStringBase::Sort(function); } + + size_t Add(const wxString& string, size_t copies = 1) + { + wxArrayStringBase::Add(string, copies); + return size() - copies; + } +}; + +// Unlike all the other sorted arrays, this one uses a comparison function +// taking objects by reference rather than value, so define a special functor +// wrapping it. +class wxSortedArrayString_SortFunction +{ +public: + typedef int (wxCMPFUNC_CONV *CMPFUNC)(const wxString&, const wxString&); + + explicit wxSortedArrayString_SortFunction(CMPFUNC f) : m_f(f) { } + + bool operator()(const wxString& s1, const wxString& s2) + { return m_f(s1, s2) < 0; } + +private: + CMPFUNC m_f; +}; + +typedef wxBaseSortedArray + wxSortedArrayStringBase; + +class WXDLLIMPEXP_BASE wxSortedArrayString : public wxSortedArrayStringBase +{ +public: + wxSortedArrayString() : wxSortedArrayStringBase(wxStringSortAscending) + { } + wxSortedArrayString(const wxArrayString& src) + : wxSortedArrayStringBase(wxStringSortAscending) + { + reserve(src.size()); + + for ( size_t n = 0; n < src.size(); n++ ) + Add(src[n]); + } + explicit wxSortedArrayString(wxArrayString::CompareFunction compareFunction) + : wxSortedArrayStringBase(compareFunction) + { } + + 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_STD_CONTAINERS + +#include "wx/beforestd.h" +#include +#include "wx/afterstd.h" + +class WXDLLIMPEXP_BASE wxArrayString +{ +public: + // type of function used by wxArrayString::Sort() + typedef int (wxCMPFUNC_CONV *CompareFunction)(const wxString& first, + const wxString& second); + // type of function used by wxArrayString::Sort(), for compatibility with + // wxArray + typedef int (wxCMPFUNC_CONV *CompareFunction2)(wxString* first, + wxString* second); + + // constructors and destructor + // default ctor + wxArrayString() { Init(false); } + // if autoSort is true, the array is always sorted (in alphabetical order) + // + // 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!). 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. + explicit wxArrayString(int autoSort) { Init(autoSort != 0); } + // C string array ctor + 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 + wxArrayString(const wxArrayString& array); +#ifdef wxHAVE_INITIALIZER_LIST + // list constructor + template + wxArrayString(std::initializer_list list) { Init(false); assign(list.begin(), list.end()); } +#endif + // assignment operator + wxArrayString& operator=(const wxArrayString& src); + // not virtual, this class should not be derived from + ~wxArrayString(); + + // memory management + // empties the list, but doesn't release memory + void Empty(); + // empties the list and releases memory + void Clear(); + // preallocates memory for given number of items + void Alloc(size_t nCount); + // minimizes the memory usage (by freeing all extra memory) + void Shrink(); + + // simple accessors + // number of elements in the array + size_t GetCount() const { return m_nCount; } + // is it empty? + bool IsEmpty() const { return m_nCount == 0; } + // number of elements in the array (GetCount is preferred API) + size_t Count() const { return m_nCount; } + + // items access (range checking is done in debug version) + // get item at position uiIndex + wxString& Item(size_t nIndex) + { + wxASSERT_MSG( nIndex < m_nCount, + wxT("wxArrayString: index out of bounds") ); + + return m_pItems[nIndex]; + } + const wxString& Item(size_t nIndex) const { return const_cast(this)->Item(nIndex); } + + // same as Item() + wxString& operator[](size_t nIndex) { return Item(nIndex); } + const wxString& operator[](size_t nIndex) const { return Item(nIndex); } + // get last item + wxString& Last() + { + wxASSERT_MSG( !IsEmpty(), + wxT("wxArrayString: index out of bounds") ); + return Item(GetCount() - 1); + } + const wxString& Last() const { return const_cast(this)->Last(); } + + + // 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 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); + // add new element at given position + void Insert(const wxString& str, size_t uiIndex, size_t nInsert = 1); + // expand the array to have count elements + void SetCount(size_t count); + // remove first item matching this value + void Remove(const wxString& sz); + // remove item by index + 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 comparison function + void Sort(CompareFunction compareFunction); + void Sort(CompareFunction2 compareFunction); + + // comparison + // compare two arrays case sensitively + bool operator==(const wxArrayString& a) const; + // compare two arrays case sensitively + bool operator!=(const wxArrayString& a) const { return !(*this == a); } + + // STL-like interface + typedef wxString value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type* iterator; + typedef const value_type* const_iterator; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef int difference_type; + typedef size_t size_type; + + // TODO: this code duplicates the one in dynarray.h + class reverse_iterator + { + typedef wxString value_type; + typedef value_type* pointer; + typedef value_type& reference; + typedef reverse_iterator itor; + friend itor operator+(int o, const itor& it); + friend itor operator+(const itor& it, int o); + friend itor operator-(const itor& it, int o); + friend difference_type operator -(const itor& i1, const itor& i2); + public: + pointer m_ptr; + reverse_iterator() : m_ptr(NULL) { } + explicit 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; } + itor& operator++() { --m_ptr; return *this; } + const itor operator++(int) + { const reverse_iterator tmp = *this; --m_ptr; return tmp; } + itor& operator--() { ++m_ptr; return *this; } + const itor operator--(int) { const itor tmp = *this; ++m_ptr; return tmp; } + bool operator ==(const itor& it) const { return m_ptr == it.m_ptr; } + bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; } + }; + + class const_reverse_iterator + { + typedef wxString value_type; + typedef const value_type* pointer; + typedef const value_type& reference; + typedef const_reverse_iterator itor; + friend itor operator+(int o, const itor& it); + friend itor operator+(const itor& it, int o); + friend itor operator-(const itor& it, int o); + friend difference_type operator -(const itor& i1, const itor& i2); + public: + pointer m_ptr; + const_reverse_iterator() : m_ptr(NULL) { } + explicit 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; } + pointer operator->() const { return m_ptr; } + itor& operator++() { --m_ptr; return *this; } + const itor operator++(int) + { const itor tmp = *this; --m_ptr; return tmp; } + itor& operator--() { ++m_ptr; return *this; } + const itor operator--(int) { const itor tmp = *this; ++m_ptr; return tmp; } + bool operator ==(const itor& it) const { return m_ptr == it.m_ptr; } + bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; } + }; + + wxArrayString(const_iterator first, const_iterator last) + { Init(false); assign(first, last); } + wxArrayString(size_type n, const_reference v) { Init(false); assign(n, v); } + + template + void assign(Iterator first, Iterator last) + { + clear(); + reserve(std::distance(first, last)); + for(; first != last; ++first) + push_back(*first); + } + + 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 m_pItems; } + const_iterator begin() const { return m_pItems; } + size_type capacity() const { return m_nSize; } + void clear() { Clear(); } + bool empty() const { return IsEmpty(); } + iterator end() { return begin() + GetCount(); } + const_iterator end() const { return begin() + GetCount(); } + iterator erase(iterator first, iterator last) + { + size_t idx = first - begin(); + RemoveAt(idx, last - first); + return begin() + idx; + } + iterator erase(iterator it) { return erase(it, it + 1); } + reference front() { return *begin(); } + const_reference front() const { return *begin(); } + void insert(iterator it, size_type n, const_reference v) + { Insert(v, it - begin(), n); } + iterator insert(iterator it, const_reference v = value_type()) + { size_t idx = it - begin(); Insert(v, idx); return begin() + idx; } + void insert(iterator it, const_iterator first, const_iterator last); + size_type max_size() const { return INT_MAX; } + 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 + { return const_reverse_iterator(end() - 1); } + reverse_iterator rend() { return reverse_iterator(begin() - 1); } + 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 + + CompareFunction m_compareFunction; // set only from wxSortedArrayString + +private: + // 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); + + // Binary search in the sorted array: return the index of the string if it's + // present, otherwise, if lowerBound is true, return the position at which + // the string should be inserted and if it's false return wxNOT_FOUND. + size_t BinarySearch(const wxString& str, bool lowerBound) const; + + size_t m_nSize, // current size of the array + m_nCount; // current number of elements + + wxString *m_pItems; // pointer to data + + bool m_autoSort; // if true, keep the array always sorted +}; + +class WXDLLIMPEXP_BASE wxSortedArrayString : public wxArrayString +{ +public: + wxSortedArrayString() : wxArrayString(true) + { } + wxSortedArrayString(const wxArrayString& array) : wxArrayString(true) + { Copy(array); } + + explicit wxSortedArrayString(CompareFunction compareFunction) + : wxArrayString(true) + { m_compareFunction = compareFunction; } +}; + +#endif // !wxUSE_STD_CONTAINERS + +// this class provides a temporary wxString* from a +// wxArrayString +class WXDLLIMPEXP_BASE wxCArrayString +{ +public: + wxCArrayString( const wxArrayString& array ) + : m_array( array ), m_strings( NULL ) + { } + ~wxCArrayString() { delete[] m_strings; } + + size_t GetCount() const { return m_array.GetCount(); } + wxString* GetStrings() + { + if( m_strings ) return m_strings; + const size_t count = m_array.GetCount(); + m_strings = new wxString[count]; + for( size_t i = 0; i < count; ++i ) + m_strings[i] = m_array[i]; + return m_strings; + } + + wxString* Release() + { + wxString *r = GetStrings(); + m_strings = NULL; + return r; + } + +private: + const wxArrayString& m_array; + wxString* m_strings; +}; + + +// ---------------------------------------------------------------------------- +// 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; + } + +#if wxUSE_STD_CONTAINERS_COMPATIBLY + // construct an adapter from a vector of strings + wxArrayStringsAdapter(const std::vector& strings) + : m_type(wxSTRING_POINTER), m_size(strings.size()) + { + m_data.ptr = m_size == 0 ? NULL : &strings[0]; + } +#endif // wxUSE_STD_CONTAINERS_COMPATIBLY + + // 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 diff --git a/lib/wxWidgets/include/wx/artprov.h b/lib/wxWidgets/include/wx/artprov.h new file mode 100644 index 0000000..e3fca97 --- /dev/null +++ b/lib/wxWidgets/include/wx/artprov.h @@ -0,0 +1,296 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/artprov.h +// Purpose: wxArtProvider class +// Author: Vaclav Slavik +// Modified by: +// Created: 18/03/2002 +// Copyright: (c) Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ARTPROV_H_ +#define _WX_ARTPROV_H_ + +#include "wx/string.h" +#include "wx/bitmap.h" +#include "wx/icon.h" +#include "wx/iconbndl.h" +#include "wx/bmpbndl.h" + +class WXDLLIMPEXP_FWD_CORE wxArtProvidersList; +class WXDLLIMPEXP_FWD_CORE wxArtProviderCache; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +class wxArtProviderModule; + +// ---------------------------------------------------------------------------- +// Types +// ---------------------------------------------------------------------------- + +typedef wxString wxArtClient; +typedef wxString wxArtID; + +#define wxART_MAKE_CLIENT_ID_FROM_STR(id) ((id) + wxASCII_STR("_C")) +#define wxART_MAKE_CLIENT_ID(id) (#id "_C") +#define wxART_MAKE_ART_ID_FROM_STR(id) (id) +#define wxART_MAKE_ART_ID(id) (#id) + +// ---------------------------------------------------------------------------- +// Art clients +// ---------------------------------------------------------------------------- + +#define wxART_TOOLBAR wxART_MAKE_CLIENT_ID(wxART_TOOLBAR) +#define wxART_MENU wxART_MAKE_CLIENT_ID(wxART_MENU) +#define wxART_FRAME_ICON wxART_MAKE_CLIENT_ID(wxART_FRAME_ICON) + +#define wxART_CMN_DIALOG wxART_MAKE_CLIENT_ID(wxART_CMN_DIALOG) +#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) + +// ---------------------------------------------------------------------------- +// Art IDs +// ---------------------------------------------------------------------------- + +#define wxART_ADD_BOOKMARK wxART_MAKE_ART_ID(wxART_ADD_BOOKMARK) +#define wxART_DEL_BOOKMARK wxART_MAKE_ART_ID(wxART_DEL_BOOKMARK) +#define wxART_HELP_SIDE_PANEL wxART_MAKE_ART_ID(wxART_HELP_SIDE_PANEL) +#define wxART_HELP_SETTINGS wxART_MAKE_ART_ID(wxART_HELP_SETTINGS) +#define wxART_HELP_BOOK wxART_MAKE_ART_ID(wxART_HELP_BOOK) +#define wxART_HELP_FOLDER wxART_MAKE_ART_ID(wxART_HELP_FOLDER) +#define wxART_HELP_PAGE wxART_MAKE_ART_ID(wxART_HELP_PAGE) +#define wxART_GO_BACK wxART_MAKE_ART_ID(wxART_GO_BACK) +#define wxART_GO_FORWARD wxART_MAKE_ART_ID(wxART_GO_FORWARD) +#define wxART_GO_UP wxART_MAKE_ART_ID(wxART_GO_UP) +#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) +#define wxART_PRINT wxART_MAKE_ART_ID(wxART_PRINT) +#define wxART_HELP wxART_MAKE_ART_ID(wxART_HELP) +#define wxART_TIP wxART_MAKE_ART_ID(wxART_TIP) +#define wxART_REPORT_VIEW wxART_MAKE_ART_ID(wxART_REPORT_VIEW) +#define wxART_LIST_VIEW wxART_MAKE_ART_ID(wxART_LIST_VIEW) +#define wxART_NEW_DIR wxART_MAKE_ART_ID(wxART_NEW_DIR) +#define wxART_HARDDISK wxART_MAKE_ART_ID(wxART_HARDDISK) +#define wxART_FLOPPY wxART_MAKE_ART_ID(wxART_FLOPPY) +#define wxART_CDROM wxART_MAKE_ART_ID(wxART_CDROM) +#define wxART_REMOVABLE wxART_MAKE_ART_ID(wxART_REMOVABLE) +#define wxART_FOLDER wxART_MAKE_ART_ID(wxART_FOLDER) +#define wxART_FOLDER_OPEN wxART_MAKE_ART_ID(wxART_FOLDER_OPEN) +#define wxART_GO_DIR_UP wxART_MAKE_ART_ID(wxART_GO_DIR_UP) +#define wxART_EXECUTABLE_FILE wxART_MAKE_ART_ID(wxART_EXECUTABLE_FILE) +#define wxART_NORMAL_FILE wxART_MAKE_ART_ID(wxART_NORMAL_FILE) +#define wxART_TICK_MARK wxART_MAKE_ART_ID(wxART_TICK_MARK) +#define wxART_CROSS_MARK wxART_MAKE_ART_ID(wxART_CROSS_MARK) +#define wxART_ERROR wxART_MAKE_ART_ID(wxART_ERROR) +#define wxART_QUESTION wxART_MAKE_ART_ID(wxART_QUESTION) +#define wxART_WARNING wxART_MAKE_ART_ID(wxART_WARNING) +#define wxART_INFORMATION wxART_MAKE_ART_ID(wxART_INFORMATION) +#define wxART_MISSING_IMAGE wxART_MAKE_ART_ID(wxART_MISSING_IMAGE) + +#define wxART_COPY wxART_MAKE_ART_ID(wxART_COPY) +#define wxART_CUT wxART_MAKE_ART_ID(wxART_CUT) +#define wxART_PASTE wxART_MAKE_ART_ID(wxART_PASTE) +#define wxART_DELETE wxART_MAKE_ART_ID(wxART_DELETE) +#define wxART_NEW wxART_MAKE_ART_ID(wxART_NEW) + +#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) +#define wxART_FIND_AND_REPLACE wxART_MAKE_ART_ID(wxART_FIND_AND_REPLACE) + +#define wxART_FULL_SCREEN wxART_MAKE_ART_ID(wxART_FULL_SCREEN) + +#define wxART_EDIT wxART_MAKE_ART_ID(wxART_EDIT) + +#define wxART_WX_LOGO wxART_MAKE_ART_ID(wxART_WX_LOGO) + +#define wxART_REFRESH wxART_MAKE_ART_ID(wxART_REFRESH) +#define wxART_STOP wxART_MAKE_ART_ID(wxART_STOP) + +// ---------------------------------------------------------------------------- +// wxArtProvider class +// ---------------------------------------------------------------------------- + +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). + static void Push(wxArtProvider *provider); + + // Add new provider to the bottom of providers stack (i.e. the provider + // will be queried as the last one). + static void PushBack(wxArtProvider *provider); + +#if WXWIN_COMPATIBILITY_2_8 + // use PushBack(), it's the same thing + wxDEPRECATED( static void Insert(wxArtProvider *provider) ); +#endif + + // Remove latest added provider and delete it. + static bool Pop(); + + // Remove provider from providers stack but don't delete it. + static bool Remove(wxArtProvider *provider); + + // Delete the given provider and remove it from the providers stack. + static bool Delete(wxArtProvider *provider); + + + // Query the providers for bitmap with given ID and return it. Return + // wxNullBitmap if no provider provides it. + static wxBitmap GetBitmap(const wxArtID& id, + const wxArtClient& client = wxASCII_STR(wxART_OTHER), + const wxSize& size = wxDefaultSize); + + // Query the providers for bitmapbundle with given ID and return it. + // If none is available, then the search for a bitmap with the same properties + // is performed. If successful, the bitmap is wrapped into a bitmap bundle. + static wxBitmapBundle + GetBitmapBundle(const wxArtID& id, + const wxArtClient& client = wxASCII_STR(wxART_OTHER), + const wxSize& size = wxDefaultSize); + + // Query the providers for icon with given ID and return it. Return + // wxNullIcon if no provider provides it. + static wxIcon GetIcon(const wxArtID& id, + const wxArtClient& client = wxASCII_STR(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), wxASCII_STR(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 = wxASCII_STR(wxART_OTHER)); + + // Gets native size for given 'client' or wxDefaultSize if it doesn't + // have native equivalent. The first version returns the size in logical + // pixels while the second one returns it in DIPs. + static wxSize GetNativeSizeHint(const wxArtClient& client, wxWindow* win = NULL); + static wxSize GetNativeDIPSizeHint(const wxArtClient& client); + + // Get the size hint of an icon from a specific wxArtClient from the + // topmost (i.e. first used) provider. + static wxSize GetSizeHint(const wxArtClient& client, wxWindow* win = NULL); + static wxSize GetDIPSizeHint(const wxArtClient& client); + +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_MSG("use GetSizeHint() without bool argument or GetNativeSizeHint()") + static wxSize GetSizeHint(const wxArtClient& client, bool platform_dependent); + + wxDEPRECATED_MSG("use wxBitmap::Rescale() instead.") + static void RescaleBitmap(wxBitmap& bmp, const wxSize& sizeNeeded); +#endif // WXWIN_COMPATIBILITY_3_0 + +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 + static void CleanUpProviders(); + + // Get the default size of an icon for a specific client. + // + // Although this function doesn't have "DIP" in its name, it should return + // the size in DIPs. + virtual wxSize DoGetSizeHint(const wxArtClient& client); + + // Derived classes must override at least one of the CreateXXX() functions + // below to create requested art resource. Overriding more than one of them + // is also possible but is usually not needed, as both GetBitmap() and + // GetBitmapBundle() will try using both CreateBitmap() and + // CreateBitmapBundle(). + // + // Note that these methods are called only once per instance's lifetime for + // each requested wxArtID as the return value is cached. + virtual wxBitmap CreateBitmap(const wxArtID& WXUNUSED(id), + const wxArtClient& WXUNUSED(client), + const wxSize& WXUNUSED(size)) + { + return wxNullBitmap; + } + + virtual wxBitmapBundle CreateBitmapBundle(const wxArtID& WXUNUSED(id), + const wxArtClient& WXUNUSED(client), + const wxSize& WXUNUSED(size)) + { + return wxBitmapBundle(); + } + + virtual wxIconBundle CreateIconBundle(const wxArtID& WXUNUSED(id), + const wxArtClient& WXUNUSED(client)) + { + return wxNullIconBundle; + } + + // Helper for resizing the bitmaps to the requested size without scaling + // them up nor resizing (16, 15) bitmaps to (16, 16) -- or doing anything + // at all if the bitmap is already of the required size. + static void RescaleOrResizeIfNeeded(wxBitmap& bmp, const wxSize& sizeNeeded); + +private: + static void CommonAddingProvider(); + static wxIconBundle DoGetIconBundle(const wxArtID& id, + const wxArtClient& client); + +private: + // list of providers: + static wxArtProvidersList *sm_providers; + // art resources cache (so that CreateXXX is not called that often): + static wxArtProviderCache *sm_cache; + + wxDECLARE_ABSTRACT_CLASS(wxArtProvider); +}; + + +#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_ diff --git a/lib/wxWidgets/include/wx/atomic.h b/lib/wxWidgets/include/wx/atomic.h new file mode 100644 index 0000000..5112623 --- /dev/null +++ b/lib/wxWidgets/include/wx/atomic.h @@ -0,0 +1,156 @@ +///////////////////////////////////////////////////////////////////////////// +// 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" + +// these functions return the new value, after the operation + +#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 wxUint32 wxAtomicInc (wxUint32 &value) +{ + return __sync_add_and_fetch(&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 wxUint32 wxAtomicInc (wxUint32 &value) +{ + return InterlockedIncrement ((LONG*)&value); +} + +inline wxUint32 wxAtomicDec (wxUint32 &value) +{ + return InterlockedDecrement ((LONG*)&value); +} + +#elif defined(__DARWIN__) + +#include "libkern/OSAtomic.h" +inline wxUint32 wxAtomicInc (wxUint32 &value) +{ + return OSAtomicIncrement32 ((int32_t*)&value); +} + +inline wxUint32 wxAtomicDec (wxUint32 &value) +{ + return OSAtomicDecrement32 ((int32_t*)&value); +} + +#elif defined (__SOLARIS__) + +#include + +inline void wxAtomicInc (wxUint32 &value) +{ + return atomic_add_32_nv ((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 wxUint32 wxAtomicInc (wxUint32 &value) { return ++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; } + + wxInt32 Inc() + { + wxCriticalSectionLocker lock(m_locker); + return ++m_value; + } + + wxInt32 Dec() + { + wxCriticalSectionLocker lock(m_locker); + return --m_value; + } + +private: + volatile wxInt32 m_value; + wxCriticalSection m_locker; +}; + +inline wxInt32 wxAtomicInc(wxAtomicInt32 &value) { return value.Inc(); } +inline wxInt32 wxAtomicDec(wxAtomicInt32 &value) { return value.Dec(); } + +#else // !wxNEEDS_GENERIC_ATOMIC_OPS + +#define wxHAS_ATOMIC_OPS + +inline wxInt32 wxAtomicInc(wxInt32 &value) { return 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_ diff --git a/lib/wxWidgets/include/wx/aui/aui.h b/lib/wxWidgets/include/wx/aui/aui.h new file mode 100644 index 0000000..df3a916 --- /dev/null +++ b/lib/wxWidgets/include/wx/aui/aui.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/aui/aui.h +// Purpose: wxaui: wx advanced user interface - docking window manager +// Author: Benjamin I. Williams +// Modified by: +// Created: 2005-05-17 +// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved. +// Licence: wxWindows Library Licence, Version 3.1 +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_AUI_H_ +#define _WX_AUI_H_ + +#include "wx/aui/framemanager.h" +#include "wx/aui/dockart.h" +#include "wx/aui/floatpane.h" +#include "wx/aui/auibar.h" +#include "wx/aui/auibook.h" +#include "wx/aui/tabmdi.h" + +#endif // _WX_AUI_H_ + diff --git a/lib/wxWidgets/include/wx/aui/auibar.h b/lib/wxWidgets/include/wx/aui/auibar.h new file mode 100644 index 0000000..73434fc --- /dev/null +++ b/lib/wxWidgets/include/wx/aui/auibar.h @@ -0,0 +1,772 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/aui/toolbar.h +// Purpose: wxaui: wx advanced user interface - docking window manager +// Author: Benjamin I. Williams +// Modified by: +// Created: 2008-08-04 +// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved. +// Licence: wxWindows Library Licence, Version 3.1 +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_AUIBAR_H_ +#define _WX_AUIBAR_H_ + +#include "wx/defs.h" + +#if wxUSE_AUI + +#include "wx/bmpbndl.h" +#include "wx/control.h" +#include "wx/sizer.h" +#include "wx/pen.h" + +class WXDLLIMPEXP_FWD_CORE wxClientDC; +class WXDLLIMPEXP_FWD_AUI wxAuiPaneInfo; + +enum wxAuiToolBarStyle +{ + wxAUI_TB_TEXT = 1 << 0, + wxAUI_TB_NO_TOOLTIPS = 1 << 1, + wxAUI_TB_NO_AUTORESIZE = 1 << 2, + wxAUI_TB_GRIPPER = 1 << 3, + wxAUI_TB_OVERFLOW = 1 << 4, + // using this style forces the toolbar to be vertical and + // be only dockable to the left or right sides of the window + // whereas by default it can be horizontal or vertical and + // be docked anywhere + wxAUI_TB_VERTICAL = 1 << 5, + wxAUI_TB_HORZ_LAYOUT = 1 << 6, + // analogous to wxAUI_TB_VERTICAL, but forces the toolbar + // to be horizontal + wxAUI_TB_HORIZONTAL = 1 << 7, + wxAUI_TB_PLAIN_BACKGROUND = 1 << 8, + wxAUI_TB_HORZ_TEXT = (wxAUI_TB_HORZ_LAYOUT | wxAUI_TB_TEXT), + wxAUI_ORIENTATION_MASK = (wxAUI_TB_VERTICAL | wxAUI_TB_HORIZONTAL), + wxAUI_TB_DEFAULT_STYLE = 0 +}; + +enum wxAuiToolBarArtSetting +{ + wxAUI_TBART_SEPARATOR_SIZE = 0, + wxAUI_TBART_GRIPPER_SIZE = 1, + wxAUI_TBART_OVERFLOW_SIZE = 2, + wxAUI_TBART_DROPDOWN_SIZE = 3 +}; + +enum wxAuiToolBarToolTextOrientation +{ + wxAUI_TBTOOL_TEXT_LEFT = 0, // unused/unimplemented + wxAUI_TBTOOL_TEXT_RIGHT = 1, + wxAUI_TBTOOL_TEXT_TOP = 2, // unused/unimplemented + wxAUI_TBTOOL_TEXT_BOTTOM = 3 +}; + + +// aui toolbar event class + +class WXDLLIMPEXP_AUI wxAuiToolBarEvent : public wxNotifyEvent +{ +public: + wxAuiToolBarEvent(wxEventType commandType = wxEVT_NULL, + int winId = 0) + : wxNotifyEvent(commandType, winId) + , m_clickPt(-1, -1) + , m_rect(-1, -1, 0, 0) + { + m_isDropdownClicked = false; + m_toolId = -1; + } + wxEvent *Clone() const wxOVERRIDE { return new wxAuiToolBarEvent(*this); } + + bool IsDropDownClicked() const { return m_isDropdownClicked; } + void SetDropDownClicked(bool c) { m_isDropdownClicked = c; } + + wxPoint GetClickPoint() const { return m_clickPt; } + void SetClickPoint(const wxPoint& p) { m_clickPt = p; } + + wxRect GetItemRect() const { return m_rect; } + void SetItemRect(const wxRect& r) { m_rect = r; } + + int GetToolId() const { return m_toolId; } + void SetToolId(int toolId) { m_toolId = toolId; } + +private: + + bool m_isDropdownClicked; + wxPoint m_clickPt; + wxRect m_rect; + int m_toolId; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiToolBarEvent); +}; + + +class WXDLLIMPEXP_AUI wxAuiToolBarItem +{ + friend class wxAuiToolBar; + +public: + + wxAuiToolBarItem() + { + m_window = NULL; + m_sizerItem = NULL; + m_spacerPixels = 0; + m_toolId = 0; + m_kind = wxITEM_NORMAL; + m_state = 0; // normal, enabled + m_proportion = 0; + m_active = true; + m_dropDown = true; + m_sticky = true; + m_userData = 0; + m_alignment = wxALIGN_CENTER; + } + + void Assign(const wxAuiToolBarItem& c) + { + m_window = c.m_window; + m_label = c.m_label; + m_bitmap = c.m_bitmap; + m_disabledBitmap = c.m_disabledBitmap; + m_hoverBitmap = c.m_hoverBitmap; + m_shortHelp = c.m_shortHelp; + m_longHelp = c.m_longHelp; + m_sizerItem = c.m_sizerItem; + m_minSize = c.m_minSize; + m_spacerPixels = c.m_spacerPixels; + m_toolId = c.m_toolId; + m_kind = c.m_kind; + m_state = c.m_state; + m_proportion = c.m_proportion; + m_active = c.m_active; + m_dropDown = c.m_dropDown; + m_sticky = c.m_sticky; + m_userData = c.m_userData; + m_alignment = c.m_alignment; + } + + + void SetWindow(wxWindow* w) { m_window = w; } + wxWindow* GetWindow() { return m_window; } + + void SetId(int newId) { m_toolId = newId; } + int GetId() const { return m_toolId; } + + void SetKind(int newKind) { m_kind = newKind; } + int GetKind() const { return m_kind; } + + void SetState(int newState) { m_state = newState; } + int GetState() const { return m_state; } + + void SetSizerItem(wxSizerItem* s) { m_sizerItem = s; } + wxSizerItem* GetSizerItem() const { return m_sizerItem; } + + void SetLabel(const wxString& s) { m_label = s; } + const wxString& GetLabel() const { return m_label; } + + void SetBitmap(const wxBitmapBundle& bmp) { m_bitmap = bmp; } + const wxBitmapBundle& GetBitmapBundle() const { return m_bitmap; } + wxBitmap GetBitmapFor(wxWindow* wnd) const { return m_bitmap.GetBitmapFor(wnd); } + wxBitmap GetBitmap() const { return GetBitmapFor(m_window); } + + void SetDisabledBitmap(const wxBitmapBundle& bmp) { m_disabledBitmap = bmp; } + const wxBitmapBundle& GetDisabledBitmapBundle() const { return m_disabledBitmap; } + wxBitmap GetDisabledBitmapFor(wxWindow* wnd) const { return m_disabledBitmap.GetBitmapFor(wnd); } + wxBitmap GetDisabledBitmap() const { return GetDisabledBitmapFor(m_window); } + + // Return the bitmap for the current state, normal or disabled. + wxBitmap GetCurrentBitmapFor(wxWindow* wnd) const; + + void SetHoverBitmap(const wxBitmapBundle& bmp) { m_hoverBitmap = bmp; } + const wxBitmapBundle& GetHoverBitmapBundle() const { return m_hoverBitmap; } + wxBitmap GetHoverBitmap() const { return m_hoverBitmap.GetBitmapFor(m_window); } + + void SetShortHelp(const wxString& s) { m_shortHelp = s; } + const wxString& GetShortHelp() const { return m_shortHelp; } + + void SetLongHelp(const wxString& s) { m_longHelp = s; } + const wxString& GetLongHelp() const { return m_longHelp; } + + void SetMinSize(const wxSize& s) { m_minSize = s; } + const wxSize& GetMinSize() const { return m_minSize; } + + void SetSpacerPixels(int s) { m_spacerPixels = s; } + int GetSpacerPixels() const { return m_spacerPixels; } + + void SetProportion(int p) { m_proportion = p; } + int GetProportion() const { return m_proportion; } + + void SetActive(bool b) { m_active = b; } + bool IsActive() const { return m_active; } + + void SetHasDropDown(bool b) + { + wxCHECK_RET( !b || m_kind == wxITEM_NORMAL, + wxS("Only normal tools can have drop downs") ); + + m_dropDown = b; + } + + bool HasDropDown() const { return m_dropDown; } + + void SetSticky(bool b) { m_sticky = b; } + bool IsSticky() const { return m_sticky; } + + void SetUserData(long l) { m_userData = l; } + long GetUserData() const { return m_userData; } + + void SetAlignment(int l) { m_alignment = l; } + int GetAlignment() const { return m_alignment; } + + bool CanBeToggled() const + { + return m_kind == wxITEM_CHECK || m_kind == wxITEM_RADIO; + } + +private: + + wxWindow* m_window; // item's associated window + wxString m_label; // label displayed on the item + wxBitmapBundle m_bitmap; // item's bitmap + wxBitmapBundle m_disabledBitmap; // item's disabled bitmap + wxBitmapBundle m_hoverBitmap; // item's hover bitmap + wxString m_shortHelp; // short help (for tooltip) + wxString m_longHelp; // long help (for status bar) + wxSizerItem* m_sizerItem; // sizer item + wxSize m_minSize; // item's minimum size + int m_spacerPixels; // size of a spacer + int m_toolId; // item's id + int m_kind; // item's kind + int m_state; // state + int m_proportion; // proportion + bool m_active; // true if the item is currently active + bool m_dropDown; // true if the item has a dropdown button + bool m_sticky; // overrides button states if true (always active) + long m_userData; // user-specified data + int m_alignment; // sizer alignment flag, defaults to wxCENTER, may be wxEXPAND or any other +}; + +#ifndef SWIG +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiToolBarItem, wxAuiToolBarItemArray, WXDLLIMPEXP_AUI); +#endif + + + + +// tab art class + +class WXDLLIMPEXP_AUI wxAuiToolBarArt +{ +public: + + wxAuiToolBarArt() { } + virtual ~wxAuiToolBarArt() { } + + virtual wxAuiToolBarArt* Clone() = 0; + virtual void SetFlags(unsigned int flags) = 0; + virtual unsigned int GetFlags() = 0; + virtual void SetFont(const wxFont& font) = 0; + virtual wxFont GetFont() = 0; + virtual void SetTextOrientation(int orientation) = 0; + virtual int GetTextOrientation() = 0; + + virtual void DrawBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) = 0; + + virtual void DrawPlainBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) = 0; + + virtual void DrawLabel( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item, + const wxRect& rect) = 0; + + virtual void DrawButton( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item, + const wxRect& rect) = 0; + + virtual void DrawDropDownButton( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item, + const wxRect& rect) = 0; + + virtual void DrawControlLabel( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item, + const wxRect& rect) = 0; + + virtual void DrawSeparator( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) = 0; + + virtual void DrawGripper( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) = 0; + + virtual void DrawOverflowButton( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect, + int state) = 0; + + virtual wxSize GetLabelSize( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item) = 0; + + virtual wxSize GetToolSize( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item) = 0; + + // Note that these functions work with the size in DIPs, not physical + // pixels. + virtual int GetElementSize(int elementId) = 0; + virtual void SetElementSize(int elementId, int size) = 0; + + virtual int ShowDropDown( + wxWindow* wnd, + const wxAuiToolBarItemArray& items) = 0; + + // Provide opportunity for subclasses to recalculate colours + virtual void UpdateColoursFromSystem() {} + +}; + + + +class WXDLLIMPEXP_AUI wxAuiGenericToolBarArt : public wxAuiToolBarArt +{ + +public: + + wxAuiGenericToolBarArt(); + virtual ~wxAuiGenericToolBarArt(); + + virtual wxAuiToolBarArt* Clone() wxOVERRIDE; + virtual void SetFlags(unsigned int flags) wxOVERRIDE; + virtual unsigned int GetFlags() wxOVERRIDE; + virtual void SetFont(const wxFont& font) wxOVERRIDE; + virtual wxFont GetFont() wxOVERRIDE; + virtual void SetTextOrientation(int orientation) wxOVERRIDE; + virtual int GetTextOrientation() wxOVERRIDE; + + virtual void DrawBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + virtual void DrawPlainBackground(wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + virtual void DrawLabel( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item, + const wxRect& rect) wxOVERRIDE; + + virtual void DrawButton( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item, + const wxRect& rect) wxOVERRIDE; + + virtual void DrawDropDownButton( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item, + const wxRect& rect) wxOVERRIDE; + + virtual void DrawControlLabel( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item, + const wxRect& rect) wxOVERRIDE; + + virtual void DrawSeparator( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + virtual void DrawGripper( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + virtual void DrawOverflowButton( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect, + int state) wxOVERRIDE; + + virtual wxSize GetLabelSize( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item) wxOVERRIDE; + + virtual wxSize GetToolSize( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item) wxOVERRIDE; + + virtual int GetElementSize(int element) wxOVERRIDE; + virtual void SetElementSize(int elementId, int size) wxOVERRIDE; + + virtual int ShowDropDown(wxWindow* wnd, + const wxAuiToolBarItemArray& items) wxOVERRIDE; + + virtual void UpdateColoursFromSystem() wxOVERRIDE; + +protected: + + wxBitmapBundle m_buttonDropDownBmp; + wxBitmapBundle m_disabledButtonDropDownBmp; + wxBitmapBundle m_overflowBmp; + wxBitmapBundle m_disabledOverflowBmp; + wxColour m_baseColour; + wxColour m_highlightColour; + wxFont m_font; + unsigned int m_flags; + int m_textOrientation; + + wxPen m_gripperPen1; + wxPen m_gripperPen2; + wxPen m_gripperPen3; + + // These values are in DIPs and not physical pixels. + int m_separatorSize; + int m_gripperSize; + int m_overflowSize; + int m_dropdownSize; +}; + + + + +class WXDLLIMPEXP_AUI wxAuiToolBar : public wxControl +{ +public: + wxAuiToolBar() { Init(); } + + wxAuiToolBar(wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxAUI_TB_DEFAULT_STYLE) + { + Init(); + Create(parent, id, pos, size, style); + } + + virtual ~wxAuiToolBar(); + + bool Create(wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxAUI_TB_DEFAULT_STYLE); + + virtual void SetWindowStyleFlag(long style) wxOVERRIDE; + + void SetArtProvider(wxAuiToolBarArt* art); + wxAuiToolBarArt* GetArtProvider() const; + + bool SetFont(const wxFont& font) wxOVERRIDE; + + + wxAuiToolBarItem* AddTool(int toolId, + const wxString& label, + const wxBitmapBundle& bitmap, + const wxString& shortHelpString = wxEmptyString, + wxItemKind kind = wxITEM_NORMAL); + + wxAuiToolBarItem* AddTool(int toolId, + const wxString& label, + const wxBitmapBundle& bitmap, + const wxBitmapBundle& disabledBitmap, + wxItemKind kind, + const wxString& shortHelpString, + const wxString& longHelpString, + wxObject* clientData); + + wxAuiToolBarItem* AddTool(int toolId, + const wxBitmapBundle& bitmap, + const wxBitmapBundle& disabledBitmap, + bool toggle = false, + wxObject* clientData = NULL, + const wxString& shortHelpString = wxEmptyString, + const wxString& longHelpString = wxEmptyString) + { + return AddTool(toolId, + wxEmptyString, + bitmap, + disabledBitmap, + toggle ? wxITEM_CHECK : wxITEM_NORMAL, + shortHelpString, + longHelpString, + clientData); + } + + wxAuiToolBarItem* AddLabel(int toolId, + const wxString& label = wxEmptyString, + const int width = -1); + wxAuiToolBarItem* AddControl(wxControl* control, + const wxString& label = wxEmptyString); + wxAuiToolBarItem* AddSeparator(); + wxAuiToolBarItem* AddSpacer(int pixels); + wxAuiToolBarItem* AddStretchSpacer(int proportion = 1); + + bool Realize(); + + wxControl* FindControl(int windowId); + wxAuiToolBarItem* FindToolByPosition(wxCoord x, wxCoord y) const; + wxAuiToolBarItem* FindToolByIndex(int idx) const; + wxAuiToolBarItem* FindTool(int toolId) const; + + void ClearTools() { Clear() ; } + void Clear(); + + bool DestroyTool(int toolId); + bool DestroyToolByIndex(int idx); + + // Note that these methods do _not_ delete the associated control, if any. + // Use DestroyTool() or DestroyToolByIndex() if this is wanted. + bool DeleteTool(int toolId); + bool DeleteByIndex(int toolId); + + size_t GetToolCount() const; + int GetToolPos(int toolId) const { return GetToolIndex(toolId); } + int GetToolIndex(int toolId) const; + bool GetToolFits(int toolId) const; + wxRect GetToolRect(int toolId) const; + bool GetToolFitsByIndex(int toolId) const; + bool GetToolBarFits() const; + + void SetMargins(const wxSize& size) { SetMargins(size.x, size.x, size.y, size.y); } + void SetMargins(int x, int y) { SetMargins(x, x, y, y); } + void SetMargins(int left, int right, int top, int bottom); + + void SetToolBitmapSize(const wxSize& size); + wxSize GetToolBitmapSize() const; + + bool GetOverflowVisible() const; + void SetOverflowVisible(bool visible); + + bool GetGripperVisible() const; + void SetGripperVisible(bool visible); + + void ToggleTool(int toolId, bool state); + bool GetToolToggled(int toolId) const; + + void EnableTool(int toolId, bool state); + bool GetToolEnabled(int toolId) const; + + void SetToolDropDown(int toolId, bool dropdown); + bool GetToolDropDown(int toolId) const; + + void SetToolBorderPadding(int padding); + int GetToolBorderPadding() const; + + void SetToolTextOrientation(int orientation); + int GetToolTextOrientation() const; + + void SetToolPacking(int packing); + int GetToolPacking() const; + + void SetToolProportion(int toolId, int proportion); + int GetToolProportion(int toolId) const; + + void SetToolSeparation(int separation); + int GetToolSeparation() const; + + void SetToolSticky(int toolId, bool sticky); + bool GetToolSticky(int toolId) const; + + wxString GetToolLabel(int toolId) const; + void SetToolLabel(int toolId, const wxString& label); + + wxBitmap GetToolBitmap(int toolId) const; + void SetToolBitmap(int toolId, const wxBitmapBundle& bitmap); + + wxString GetToolShortHelp(int toolId) const; + void SetToolShortHelp(int toolId, const wxString& helpString); + + wxString GetToolLongHelp(int toolId) const; + void SetToolLongHelp(int toolId, const wxString& helpString); + + void SetCustomOverflowItems(const wxAuiToolBarItemArray& prepend, + const wxAuiToolBarItemArray& append); + + // get size of hint rectangle for a particular dock location + wxSize GetHintSize(int dockDirection) const; + bool IsPaneValid(const wxAuiPaneInfo& pane) const; + + // Override to call DoIdleUpdate(). + virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE) wxOVERRIDE; + +protected: + void Init(); + + virtual void OnCustomRender(wxDC& WXUNUSED(dc), + const wxAuiToolBarItem& WXUNUSED(item), + const wxRect& WXUNUSED(rect)) { } + +protected: + + void DoIdleUpdate(); + void SetOrientation(int orientation); + void SetHoverItem(wxAuiToolBarItem* item); + void SetPressedItem(wxAuiToolBarItem* item); + void RefreshOverflowState(); + + int GetOverflowState() const; + wxRect GetOverflowRect() const; + wxSize GetLabelSize(const wxString& label); + wxAuiToolBarItem* FindToolByPositionWithPacking(wxCoord x, wxCoord y) const; + +protected: // handlers + + void OnSize(wxSizeEvent& evt); + void OnIdle(wxIdleEvent& evt); + void OnDPIChanged(wxDPIChangedEvent& evt); + void OnPaint(wxPaintEvent& evt); + void OnEraseBackground(wxEraseEvent& evt); + void OnLeftDown(wxMouseEvent& evt); + void OnLeftUp(wxMouseEvent& evt); + void OnRightDown(wxMouseEvent& evt); + void OnRightUp(wxMouseEvent& evt); + void OnMiddleDown(wxMouseEvent& evt); + void OnMiddleUp(wxMouseEvent& evt); + void OnMotion(wxMouseEvent& evt); + void OnLeaveWindow(wxMouseEvent& evt); + void OnCaptureLost(wxMouseCaptureLostEvent& evt); + void OnSetCursor(wxSetCursorEvent& evt); + void OnSysColourChanged(wxSysColourChangedEvent& event); + +protected: + + wxAuiToolBarItemArray m_items; // array of toolbar items + wxAuiToolBarArt* m_art; // art provider + wxBoxSizer* m_sizer; // main sizer for toolbar + wxAuiToolBarItem* m_actionItem; // item that's being acted upon (pressed) + wxAuiToolBarItem* m_tipItem; // item that has its tooltip shown + wxBitmap m_bitmap; // double-buffer bitmap + wxSizerItem* m_gripperSizerItem; + wxSizerItem* m_overflowSizerItem; + wxSize m_absoluteMinSize; + wxPoint m_actionPos; // position of left-mouse down + wxAuiToolBarItemArray m_customOverflowPrepend; + wxAuiToolBarItemArray m_customOverflowAppend; + + int m_buttonWidth; + int m_buttonHeight; + int m_sizerElementCount; + int m_leftPadding; + int m_rightPadding; + int m_topPadding; + int m_bottomPadding; + int m_toolPacking; + int m_toolBorderPadding; + int m_toolTextOrientation; + int m_overflowState; + bool m_dragging; + bool m_gripperVisible; + bool m_overflowVisible; + + bool RealizeHelper(wxClientDC& dc, bool horizontal); + static bool IsPaneValid(long style, const wxAuiPaneInfo& pane); + bool IsPaneValid(long style) const; + void SetArtFlags() const; + wxOrientation m_orientation; + wxSize m_horzHintSize; + wxSize m_vertHintSize; + +private: + // Common part of OnLeaveWindow() and OnCaptureLost(). + void DoResetMouseState(); + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_CLASS(wxAuiToolBar); +}; + + + + +// wx event machinery + +#ifndef SWIG + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUITOOLBAR_TOOL_DROPDOWN, wxAuiToolBarEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUITOOLBAR_OVERFLOW_CLICK, wxAuiToolBarEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUITOOLBAR_RIGHT_CLICK, wxAuiToolBarEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUITOOLBAR_MIDDLE_CLICK, wxAuiToolBarEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUITOOLBAR_BEGIN_DRAG, wxAuiToolBarEvent ); + +typedef void (wxEvtHandler::*wxAuiToolBarEventFunction)(wxAuiToolBarEvent&); + +#define wxAuiToolBarEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxAuiToolBarEventFunction, func) + +#define EVT_AUITOOLBAR_TOOL_DROPDOWN(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, winid, wxAuiToolBarEventHandler(fn)) +#define EVT_AUITOOLBAR_OVERFLOW_CLICK(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_AUITOOLBAR_OVERFLOW_CLICK, winid, wxAuiToolBarEventHandler(fn)) +#define EVT_AUITOOLBAR_RIGHT_CLICK(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_AUITOOLBAR_RIGHT_CLICK, winid, wxAuiToolBarEventHandler(fn)) +#define EVT_AUITOOLBAR_MIDDLE_CLICK(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_AUITOOLBAR_MIDDLE_CLICK, winid, wxAuiToolBarEventHandler(fn)) +#define EVT_AUITOOLBAR_BEGIN_DRAG(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_AUITOOLBAR_BEGIN_DRAG, winid, wxAuiToolBarEventHandler(fn)) + +#else + +// wxpython/swig event work +%constant wxEventType wxEVT_AUITOOLBAR_TOOL_DROPDOWN; +%constant wxEventType wxEVT_AUITOOLBAR_OVERFLOW_CLICK; +%constant wxEventType wxEVT_AUITOOLBAR_RIGHT_CLICK; +%constant wxEventType wxEVT_AUITOOLBAR_MIDDLE_CLICK; +%constant wxEventType wxEVT_AUITOOLBAR_BEGIN_DRAG; + +%pythoncode { + EVT_AUITOOLBAR_TOOL_DROPDOWN = wx.PyEventBinder( wxEVT_AUITOOLBAR_TOOL_DROPDOWN, 1 ) + EVT_AUITOOLBAR_OVERFLOW_CLICK = wx.PyEventBinder( wxEVT_AUITOOLBAR_OVERFLOW_CLICK, 1 ) + EVT_AUITOOLBAR_RIGHT_CLICK = wx.PyEventBinder( wxEVT_AUITOOLBAR_RIGHT_CLICK, 1 ) + EVT_AUITOOLBAR_MIDDLE_CLICK = wx.PyEventBinder( wxEVT_AUITOOLBAR_MIDDLE_CLICK, 1 ) + EVT_AUITOOLBAR_BEGIN_DRAG = wx.PyEventBinder( wxEVT_AUITOOLBAR_BEGIN_DRAG, 1 ) +} +#endif // SWIG + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_AUITOOLBAR_TOOL_DROPDOWN wxEVT_AUITOOLBAR_TOOL_DROPDOWN +#define wxEVT_COMMAND_AUITOOLBAR_OVERFLOW_CLICK wxEVT_AUITOOLBAR_OVERFLOW_CLICK +#define wxEVT_COMMAND_AUITOOLBAR_RIGHT_CLICK wxEVT_AUITOOLBAR_RIGHT_CLICK +#define wxEVT_COMMAND_AUITOOLBAR_MIDDLE_CLICK wxEVT_AUITOOLBAR_MIDDLE_CLICK +#define wxEVT_COMMAND_AUITOOLBAR_BEGIN_DRAG wxEVT_AUITOOLBAR_BEGIN_DRAG + +#if defined(__WXMSW__) && wxUSE_UXTHEME + #define wxHAS_NATIVE_TOOLBAR_ART + #include "wx/aui/barartmsw.h" + #define wxAuiDefaultToolBarArt wxAuiMSWToolBarArt +#endif + +#ifndef wxHAS_NATIVE_TOOLBAR_ART + #define wxAuiDefaultToolBarArt wxAuiGenericToolBarArt +#endif + +#endif // wxUSE_AUI +#endif // _WX_AUIBAR_H_ + diff --git a/lib/wxWidgets/include/wx/aui/auibook.h b/lib/wxWidgets/include/wx/aui/auibook.h new file mode 100644 index 0000000..1fb144a --- /dev/null +++ b/lib/wxWidgets/include/wx/aui/auibook.h @@ -0,0 +1,565 @@ +////////////////////////////////////////////////////////////////////////////// +// Name: wx/aui/auibook.h +// Purpose: wxaui: wx advanced user interface - notebook +// Author: Benjamin I. Williams +// Modified by: Jens Lody +// Created: 2006-06-28 +// Copyright: (C) Copyright 2006, Kirix Corporation, All Rights Reserved. +// Licence: wxWindows Library Licence, Version 3.1 +/////////////////////////////////////////////////////////////////////////////// + + + +#ifndef _WX_AUINOTEBOOK_H_ +#define _WX_AUINOTEBOOK_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_AUI + +#include "wx/aui/tabart.h" +#include "wx/aui/framemanager.h" +#include "wx/bookctrl.h" +#include "wx/containr.h" + + +class wxAuiNotebook; + + +enum wxAuiNotebookOption +{ + wxAUI_NB_TOP = 1 << 0, + wxAUI_NB_LEFT = 1 << 1, // not implemented yet + wxAUI_NB_RIGHT = 1 << 2, // not implemented yet + wxAUI_NB_BOTTOM = 1 << 3, + wxAUI_NB_TAB_SPLIT = 1 << 4, + wxAUI_NB_TAB_MOVE = 1 << 5, + wxAUI_NB_TAB_EXTERNAL_MOVE = 1 << 6, + wxAUI_NB_TAB_FIXED_WIDTH = 1 << 7, + wxAUI_NB_SCROLL_BUTTONS = 1 << 8, + wxAUI_NB_WINDOWLIST_BUTTON = 1 << 9, + wxAUI_NB_CLOSE_BUTTON = 1 << 10, + wxAUI_NB_CLOSE_ON_ACTIVE_TAB = 1 << 11, + wxAUI_NB_CLOSE_ON_ALL_TABS = 1 << 12, + wxAUI_NB_MIDDLE_CLICK_CLOSE = 1 << 13, + + wxAUI_NB_DEFAULT_STYLE = wxAUI_NB_TOP | + wxAUI_NB_TAB_SPLIT | + wxAUI_NB_TAB_MOVE | + wxAUI_NB_SCROLL_BUTTONS | + wxAUI_NB_CLOSE_ON_ACTIVE_TAB | + wxAUI_NB_MIDDLE_CLICK_CLOSE +}; + +wxALLOW_COMBINING_ENUMS(wxAuiNotebookOption, wxBorder) + + + +// aui notebook event class + +class WXDLLIMPEXP_AUI wxAuiNotebookEvent : public wxBookCtrlEvent +{ +public: + wxAuiNotebookEvent(wxEventType commandType = wxEVT_NULL, + int winId = 0) + : wxBookCtrlEvent(commandType, winId) + { + m_dragSource = NULL; + } + wxEvent *Clone() const wxOVERRIDE { return new wxAuiNotebookEvent(*this); } + + void SetDragSource(wxAuiNotebook* s) { m_dragSource = s; } + wxAuiNotebook* GetDragSource() const { return m_dragSource; } + +private: + wxAuiNotebook* m_dragSource; + +#ifndef SWIG +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiNotebookEvent); +#endif +}; + + +class WXDLLIMPEXP_AUI wxAuiNotebookPage +{ +public: + wxWindow* window; // page's associated window + wxString caption; // caption displayed on the tab + wxString tooltip; // tooltip displayed when hovering over tab title + wxBitmapBundle bitmap;// tab's bitmap + wxRect rect; // tab's hit rectangle + bool active; // true if the page is currently active + bool hover; // true if mouse hovering over tab +}; + +class WXDLLIMPEXP_AUI wxAuiTabContainerButton +{ +public: + + int id; // button's id + int curState; // current state (normal, hover, pressed, etc.) + int location; // buttons location (wxLEFT, wxRIGHT, or wxCENTER) + wxBitmapBundle bitmap; // button's hover bitmap + wxBitmapBundle disBitmap; // button's disabled bitmap + wxRect rect; // button's hit rectangle +}; + + +#ifndef SWIG +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiNotebookPage, wxAuiNotebookPageArray, WXDLLIMPEXP_AUI); +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiTabContainerButton, wxAuiTabContainerButtonArray, WXDLLIMPEXP_AUI); +#endif + + +class WXDLLIMPEXP_AUI wxAuiTabContainer +{ +public: + + wxAuiTabContainer(); + virtual ~wxAuiTabContainer(); + + void SetArtProvider(wxAuiTabArt* art); + wxAuiTabArt* GetArtProvider() const; + + void SetFlags(unsigned int flags); + unsigned int GetFlags() const; + + bool AddPage(wxWindow* page, const wxAuiNotebookPage& info); + bool InsertPage(wxWindow* page, const wxAuiNotebookPage& info, size_t idx); + bool MovePage(wxWindow* page, size_t newIdx); + bool RemovePage(wxWindow* page); + bool SetActivePage(wxWindow* page); + bool SetActivePage(size_t page); + void SetNoneActive(); + int GetActivePage() const; + bool TabHitTest(int x, int y, wxWindow** hit) const; + bool ButtonHitTest(int x, int y, wxAuiTabContainerButton** hit) const; + wxWindow* GetWindowFromIdx(size_t idx) const; + int GetIdxFromWindow(const wxWindow* page) const; + size_t GetPageCount() const; + wxAuiNotebookPage& GetPage(size_t idx); + const wxAuiNotebookPage& GetPage(size_t idx) const; + wxAuiNotebookPageArray& GetPages(); + void SetNormalFont(const wxFont& normalFont); + void SetSelectedFont(const wxFont& selectedFont); + void SetMeasuringFont(const wxFont& measuringFont); + void SetColour(const wxColour& colour); + void SetActiveColour(const wxColour& colour); + void DoShowHide(); + void SetRect(const wxRect& rect, wxWindow* wnd = NULL); + + void RemoveButton(int id); + void AddButton(int id, + int location, + const wxBitmapBundle& normalBitmap = wxBitmapBundle(), + const wxBitmapBundle& disabledBitmap = wxBitmapBundle()); + + size_t GetTabOffset() const; + void SetTabOffset(size_t offset); + + // Is the tab visible? + bool IsTabVisible(int tabPage, int tabOffset, wxDC* dc, wxWindow* wnd); + + // Make the tab visible if it wasn't already + void MakeTabVisible(int tabPage, wxWindow* win); + +protected: + + virtual void Render(wxDC* dc, wxWindow* wnd); + +protected: + + wxAuiTabArt* m_art; + wxAuiNotebookPageArray m_pages; + wxAuiTabContainerButtonArray m_buttons; + wxAuiTabContainerButtonArray m_tabCloseButtons; + wxRect m_rect; + size_t m_tabOffset; + unsigned int m_flags; +}; + + + +class WXDLLIMPEXP_AUI wxAuiTabCtrl : public wxControl, + public wxAuiTabContainer +{ +public: + + wxAuiTabCtrl(wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0); + + ~wxAuiTabCtrl(); + + bool IsDragging() const { return m_isDragging; } + + void SetRect(const wxRect& rect) { wxAuiTabContainer::SetRect(rect, this); } + +protected: + // choose the default border for this window + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + + void OnPaint(wxPaintEvent& evt); + void OnEraseBackground(wxEraseEvent& evt); + void OnSize(wxSizeEvent& evt); + void OnLeftDown(wxMouseEvent& evt); + void OnLeftDClick(wxMouseEvent& evt); + void OnLeftUp(wxMouseEvent& evt); + void OnMiddleDown(wxMouseEvent& evt); + void OnMiddleUp(wxMouseEvent& evt); + void OnRightDown(wxMouseEvent& evt); + void OnRightUp(wxMouseEvent& evt); + void OnMotion(wxMouseEvent& evt); + void OnLeaveWindow(wxMouseEvent& evt); + void OnButton(wxAuiNotebookEvent& evt); + void OnSetFocus(wxFocusEvent& event); + void OnKillFocus(wxFocusEvent& event); + void OnChar(wxKeyEvent& event); + void OnCaptureLost(wxMouseCaptureLostEvent& evt); + void OnSysColourChanged(wxSysColourChangedEvent& event); + +protected: + + wxPoint m_clickPt; + wxWindow* m_clickTab; + bool m_isDragging; + wxAuiTabContainerButton* m_hoverButton; + wxAuiTabContainerButton* m_pressedButton; + + void SetHoverTab(wxWindow* wnd); + +#ifndef SWIG + wxDECLARE_CLASS(wxAuiTabCtrl); + wxDECLARE_EVENT_TABLE(); +#endif +}; + + + + +class WXDLLIMPEXP_AUI wxAuiNotebook : public wxNavigationEnabled +{ + +public: + + wxAuiNotebook() { Init(); } + + wxAuiNotebook(wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxAUI_NB_DEFAULT_STYLE) + { + Init(); + Create(parent, id, pos, size, style); + } + + virtual ~wxAuiNotebook(); + + bool Create(wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0); + + void SetWindowStyleFlag(long style) wxOVERRIDE; + void SetArtProvider(wxAuiTabArt* art); + wxAuiTabArt* GetArtProvider() const; + + virtual void SetUniformBitmapSize(const wxSize& size); + virtual void SetTabCtrlHeight(int height); + + bool AddPage(wxWindow* page, + const wxString& caption, + bool select = false, + const wxBitmapBundle& bitmap = wxBitmapBundle()); + + bool InsertPage(size_t pageIdx, + wxWindow* page, + const wxString& caption, + bool select = false, + const wxBitmapBundle& bitmap = wxBitmapBundle()); + + bool DeletePage(size_t page) wxOVERRIDE; + bool RemovePage(size_t page) wxOVERRIDE; + + virtual size_t GetPageCount() const wxOVERRIDE; + virtual wxWindow* GetPage(size_t pageIdx) const wxOVERRIDE; + virtual int FindPage(const wxWindow* page) const wxOVERRIDE; + + // This is wxAUI-specific equivalent of FindPage(), prefer to use the other + // function. + int GetPageIndex(wxWindow* pageWnd) const { return FindPage(pageWnd); } + + bool SetPageText(size_t page, const wxString& text) wxOVERRIDE; + wxString GetPageText(size_t pageIdx) const wxOVERRIDE; + + bool SetPageToolTip(size_t page, const wxString& text); + wxString GetPageToolTip(size_t pageIdx) const; + + bool SetPageBitmap(size_t page, const wxBitmapBundle& bitmap); + wxBitmap GetPageBitmap(size_t pageIdx) const; + + int SetSelection(size_t newPage) wxOVERRIDE; + int GetSelection() const wxOVERRIDE; + + virtual void Split(size_t page, int direction); + + const wxAuiManager& GetAuiManager() const { return m_mgr; } + + // Sets the normal font + void SetNormalFont(const wxFont& font); + + // Sets the selected tab font + void SetSelectedFont(const wxFont& font); + + // Sets the measuring font + void SetMeasuringFont(const wxFont& font); + + // Sets the tab font + virtual bool SetFont(const wxFont& font) wxOVERRIDE; + + // Gets the tab control height + int GetTabCtrlHeight() const; + + // Gets the height of the notebook for a given page height + int GetHeightForPageHeight(int pageHeight); + + // Shows the window menu + bool ShowWindowMenu(); + + // we do have multiple pages + virtual bool HasMultiplePages() const wxOVERRIDE { return true; } + + // we don't want focus for ourselves + // virtual bool AcceptsFocus() const { return false; } + + //wxBookCtrlBase functions + + virtual void SetPageSize (const wxSize &size) wxOVERRIDE; + virtual int HitTest (const wxPoint &pt, long *flags=NULL) const wxOVERRIDE; + + virtual int GetPageImage(size_t n) const wxOVERRIDE; + virtual bool SetPageImage(size_t n, int imageId) wxOVERRIDE; + + virtual int ChangeSelection(size_t n) wxOVERRIDE; + + virtual bool AddPage(wxWindow *page, const wxString &text, bool select, + int imageId) wxOVERRIDE; + virtual bool DeleteAllPages() wxOVERRIDE; + virtual bool InsertPage(size_t index, wxWindow *page, const wxString &text, + bool select, int imageId) wxOVERRIDE; + + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + wxAuiTabCtrl* GetTabCtrlFromPoint(const wxPoint& pt); + wxAuiTabCtrl* GetActiveTabCtrl(); + bool FindTab(wxWindow* page, wxAuiTabCtrl** ctrl, int* idx); + +protected: + // Common part of all ctors. + void Init(); + + // choose the default border for this window + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + + // Redo sizing after thawing + virtual void DoThaw() wxOVERRIDE; + + // these can be overridden + + // update the height, return true if it was done or false if the new height + // calculated by CalculateTabCtrlHeight() is the same as the old one + virtual bool UpdateTabCtrlHeight(); + + virtual int CalculateTabCtrlHeight(); + virtual wxSize CalculateNewSplitSize(); + + // remove the page and return a pointer to it + virtual wxWindow *DoRemovePage(size_t WXUNUSED(page)) wxOVERRIDE { return NULL; } + + //A general selection function + virtual int DoModifySelection(size_t n, bool events); + +protected: + + void DoSizing(); + void InitNotebook(long style); + wxWindow* GetTabFrameFromTabCtrl(wxWindow* tabCtrl); + void RemoveEmptyTabFrames(); + void UpdateHintWindowSize(); + +protected: + + void OnChildFocusNotebook(wxChildFocusEvent& evt); + void OnRender(wxAuiManagerEvent& evt); + void OnSize(wxSizeEvent& evt); + void OnTabClicked(wxAuiNotebookEvent& evt); + void OnTabBeginDrag(wxAuiNotebookEvent& evt); + void OnTabDragMotion(wxAuiNotebookEvent& evt); + void OnTabEndDrag(wxAuiNotebookEvent& evt); + void OnTabCancelDrag(wxAuiNotebookEvent& evt); + void OnTabButton(wxAuiNotebookEvent& evt); + void OnTabMiddleDown(wxAuiNotebookEvent& evt); + void OnTabMiddleUp(wxAuiNotebookEvent& evt); + void OnTabRightDown(wxAuiNotebookEvent& evt); + void OnTabRightUp(wxAuiNotebookEvent& evt); + void OnTabBgDClick(wxAuiNotebookEvent& evt); + void OnNavigationKeyNotebook(wxNavigationKeyEvent& event); + void OnSysColourChanged(wxSysColourChangedEvent& event); + + // set selection to the given window (which must be non-NULL and be one of + // our pages, otherwise an assert is raised) + void SetSelectionToWindow(wxWindow *win); + void SetSelectionToPage(const wxAuiNotebookPage& page) + { + SetSelectionToWindow(page.window); + } + +protected: + + wxAuiManager m_mgr; + wxAuiTabContainer m_tabs; + int m_curPage; + int m_tabIdCounter; + wxWindow* m_dummyWnd; + + wxSize m_requestedBmpSize; + int m_requestedTabCtrlHeight; + wxFont m_selectedFont; + wxFont m_normalFont; + int m_tabCtrlHeight; + + int m_lastDragX; + unsigned int m_flags; + +#ifndef SWIG + wxDECLARE_CLASS(wxAuiNotebook); + wxDECLARE_EVENT_TABLE(); +#endif +}; + + + + +// wx event machinery + +#ifndef SWIG + +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_PAGE_CHANGING, wxAuiNotebookEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_PAGE_CLOSED, wxAuiNotebookEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_BUTTON, wxAuiNotebookEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_BEGIN_DRAG, wxAuiNotebookEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_END_DRAG, wxAuiNotebookEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_DRAG_MOTION, wxAuiNotebookEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_ALLOW_DND, wxAuiNotebookEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_TAB_MIDDLE_DOWN, wxAuiNotebookEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_TAB_MIDDLE_UP, wxAuiNotebookEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN, wxAuiNotebookEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_TAB_RIGHT_UP, wxAuiNotebookEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_DRAG_DONE, wxAuiNotebookEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_BG_DCLICK, wxAuiNotebookEvent); + +typedef void (wxEvtHandler::*wxAuiNotebookEventFunction)(wxAuiNotebookEvent&); + +#define wxAuiNotebookEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxAuiNotebookEventFunction, func) + +#define EVT_AUINOTEBOOK_PAGE_CLOSE(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_PAGE_CLOSE, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_PAGE_CLOSED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_PAGE_CLOSED, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_PAGE_CHANGED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_PAGE_CHANGED, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_PAGE_CHANGING(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_PAGE_CHANGING, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_BUTTON(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_BUTTON, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_BEGIN_DRAG(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_BEGIN_DRAG, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_END_DRAG(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_END_DRAG, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_DRAG_MOTION(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_DRAG_MOTION, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_ALLOW_DND(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_ALLOW_DND, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_DRAG_DONE(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_DRAG_DONE, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_TAB_MIDDLE_DOWN(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_TAB_MIDDLE_DOWN, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_TAB_MIDDLE_UP(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_TAB_MIDDLE_UP, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_TAB_RIGHT_DOWN(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_TAB_RIGHT_UP(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_TAB_RIGHT_UP, winid, wxAuiNotebookEventHandler(fn)) +#define EVT_AUINOTEBOOK_BG_DCLICK(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_BG_DCLICK, winid, wxAuiNotebookEventHandler(fn)) +#else + +// wxpython/swig event work +%constant wxEventType wxEVT_AUINOTEBOOK_PAGE_CLOSE; +%constant wxEventType wxEVT_AUINOTEBOOK_PAGE_CLOSED; +%constant wxEventType wxEVT_AUINOTEBOOK_PAGE_CHANGED; +%constant wxEventType wxEVT_AUINOTEBOOK_PAGE_CHANGING; +%constant wxEventType wxEVT_AUINOTEBOOK_BUTTON; +%constant wxEventType wxEVT_AUINOTEBOOK_BEGIN_DRAG; +%constant wxEventType wxEVT_AUINOTEBOOK_END_DRAG; +%constant wxEventType wxEVT_AUINOTEBOOK_DRAG_MOTION; +%constant wxEventType wxEVT_AUINOTEBOOK_ALLOW_DND; +%constant wxEventType wxEVT_AUINOTEBOOK_DRAG_DONE; +%constant wxEventType wxEVT_AUINOTEBOOK_TAB_MIDDLE_DOWN; +%constant wxEventType wxEVT_AUINOTEBOOK_TAB_MIDDLE_UP; +%constant wxEventType wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN; +%constant wxEventType wxEVT_AUINOTEBOOK_TAB_RIGHT_UP; +%constant wxEventType wxEVT_AUINOTEBOOK_BG_DCLICK; + +%pythoncode { + EVT_AUINOTEBOOK_PAGE_CLOSE = wx.PyEventBinder( wxEVT_AUINOTEBOOK_PAGE_CLOSE, 1 ) + EVT_AUINOTEBOOK_PAGE_CLOSED = wx.PyEventBinder( wxEVT_AUINOTEBOOK_PAGE_CLOSED, 1 ) + EVT_AUINOTEBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_AUINOTEBOOK_PAGE_CHANGED, 1 ) + EVT_AUINOTEBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_AUINOTEBOOK_PAGE_CHANGING, 1 ) + EVT_AUINOTEBOOK_BUTTON = wx.PyEventBinder( wxEVT_AUINOTEBOOK_BUTTON, 1 ) + EVT_AUINOTEBOOK_BEGIN_DRAG = wx.PyEventBinder( wxEVT_AUINOTEBOOK_BEGIN_DRAG, 1 ) + EVT_AUINOTEBOOK_END_DRAG = wx.PyEventBinder( wxEVT_AUINOTEBOOK_END_DRAG, 1 ) + EVT_AUINOTEBOOK_DRAG_MOTION = wx.PyEventBinder( wxEVT_AUINOTEBOOK_DRAG_MOTION, 1 ) + EVT_AUINOTEBOOK_ALLOW_DND = wx.PyEventBinder( wxEVT_AUINOTEBOOK_ALLOW_DND, 1 ) + EVT_AUINOTEBOOK_DRAG_DONE = wx.PyEventBinder( wxEVT_AUINOTEBOOK_DRAG_DONE, 1 ) + EVT__AUINOTEBOOK_TAB_MIDDLE_DOWN = wx.PyEventBinder( wxEVT_AUINOTEBOOK_TAB_MIDDLE_DOWN, 1 ) + EVT__AUINOTEBOOK_TAB_MIDDLE_UP = wx.PyEventBinder( wxEVT_AUINOTEBOOK_TAB_MIDDLE_UP, 1 ) + EVT__AUINOTEBOOK_TAB_RIGHT_DOWN = wx.PyEventBinder( wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN, 1 ) + EVT__AUINOTEBOOK_TAB_RIGHT_UP = wx.PyEventBinder( wxEVT_AUINOTEBOOK_TAB_RIGHT_UP, 1 ) + EVT_AUINOTEBOOK_BG_DCLICK = wx.PyEventBinder( wxEVT_AUINOTEBOOK_BG_DCLICK, 1 ) +} +#endif + + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE wxEVT_AUINOTEBOOK_PAGE_CLOSE +#define wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED wxEVT_AUINOTEBOOK_PAGE_CLOSED +#define wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED wxEVT_AUINOTEBOOK_PAGE_CHANGED +#define wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING wxEVT_AUINOTEBOOK_PAGE_CHANGING +#define wxEVT_COMMAND_AUINOTEBOOK_BUTTON wxEVT_AUINOTEBOOK_BUTTON +#define wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG wxEVT_AUINOTEBOOK_BEGIN_DRAG +#define wxEVT_COMMAND_AUINOTEBOOK_END_DRAG wxEVT_AUINOTEBOOK_END_DRAG +#define wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION wxEVT_AUINOTEBOOK_DRAG_MOTION +#define wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND wxEVT_AUINOTEBOOK_ALLOW_DND +#define wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE wxEVT_AUINOTEBOOK_DRAG_DONE +#define wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN wxEVT_AUINOTEBOOK_TAB_MIDDLE_DOWN +#define wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP wxEVT_AUINOTEBOOK_TAB_MIDDLE_UP +#define wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN +#define wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP wxEVT_AUINOTEBOOK_TAB_RIGHT_UP +#define wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK wxEVT_AUINOTEBOOK_BG_DCLICK +#define wxEVT_COMMAND_AUINOTEBOOK_CANCEL_DRAG wxEVT_AUINOTEBOOK_CANCEL_DRAG + +#endif // wxUSE_AUI +#endif // _WX_AUINOTEBOOK_H_ diff --git a/lib/wxWidgets/include/wx/aui/barartmsw.h b/lib/wxWidgets/include/wx/aui/barartmsw.h new file mode 100644 index 0000000..59602f0 --- /dev/null +++ b/lib/wxWidgets/include/wx/aui/barartmsw.h @@ -0,0 +1,86 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/aui/barartmsw.h +// Purpose: Interface of wxAuiMSWToolBarArt +// Author: Tobias Taschner +// Created: 2015-09-22 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_AUI_BARART_MSW_H_ +#define _WX_AUI_BARART_MSW_H_ + +class WXDLLIMPEXP_AUI wxAuiMSWToolBarArt : public wxAuiGenericToolBarArt +{ +public: + wxAuiMSWToolBarArt(); + + virtual wxAuiToolBarArt* Clone() wxOVERRIDE; + + virtual void DrawBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + virtual void DrawLabel( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item, + const wxRect& rect) wxOVERRIDE; + + virtual void DrawButton( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item, + const wxRect& rect) wxOVERRIDE; + + virtual void DrawDropDownButton( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item, + const wxRect& rect) wxOVERRIDE; + + virtual void DrawControlLabel( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item, + const wxRect& rect) wxOVERRIDE; + + virtual void DrawSeparator( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + virtual void DrawGripper( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + virtual void DrawOverflowButton( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect, + int state) wxOVERRIDE; + + virtual wxSize GetLabelSize( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item) wxOVERRIDE; + + virtual wxSize GetToolSize( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item) wxOVERRIDE; + + virtual int GetElementSize(int element) wxOVERRIDE; + virtual void SetElementSize(int elementId, int size) wxOVERRIDE; + + virtual int ShowDropDown(wxWindow* wnd, + const wxAuiToolBarItemArray& items) wxOVERRIDE; + +private: + bool m_themed; + wxSize m_buttonSize; +}; + +#endif // _WX_AUI_BARART_MSW_H_ diff --git a/lib/wxWidgets/include/wx/aui/dockart.h b/lib/wxWidgets/include/wx/aui/dockart.h new file mode 100644 index 0000000..84bdb5c --- /dev/null +++ b/lib/wxWidgets/include/wx/aui/dockart.h @@ -0,0 +1,191 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/aui/dockart.h +// Purpose: wxaui: wx advanced user interface - docking window manager +// Author: Benjamin I. Williams +// Modified by: +// Created: 2005-05-17 +// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved. +// Licence: wxWindows Library Licence, Version 3.1 +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DOCKART_H_ +#define _WX_DOCKART_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_AUI + +#include "wx/pen.h" +#include "wx/brush.h" +#include "wx/bmpbndl.h" +#include "wx/colour.h" + +// dock art provider code - a dock provider provides all drawing +// functionality to the wxAui dock manager. This allows the dock +// manager to have pluggable look-and-feels + +class WXDLLIMPEXP_AUI wxAuiDockArt +{ +public: + + wxAuiDockArt() { } + virtual ~wxAuiDockArt() { } + + virtual wxAuiDockArt* Clone() = 0; + virtual int GetMetric(int id) = 0; + virtual void SetMetric(int id, int newVal) = 0; + virtual void SetFont(int id, const wxFont& font) = 0; + virtual wxFont GetFont(int id) = 0; + virtual wxColour GetColour(int id) = 0; + virtual void SetColour(int id, const wxColor& colour) = 0; + wxColour GetColor(int id) { return GetColour(id); } + void SetColor(int id, const wxColour& color) { SetColour(id, color); } + + virtual void DrawSash(wxDC& dc, + wxWindow* window, + int orientation, + const wxRect& rect) = 0; + + virtual void DrawBackground(wxDC& dc, + wxWindow* window, + int orientation, + const wxRect& rect) = 0; + + virtual void DrawCaption(wxDC& dc, + wxWindow* window, + const wxString& text, + const wxRect& rect, + wxAuiPaneInfo& pane) = 0; + + virtual void DrawGripper(wxDC& dc, + wxWindow* window, + const wxRect& rect, + wxAuiPaneInfo& pane) = 0; + + virtual void DrawBorder(wxDC& dc, + wxWindow* window, + const wxRect& rect, + wxAuiPaneInfo& pane) = 0; + + virtual void DrawPaneButton(wxDC& dc, + wxWindow* window, + int button, + int buttonState, + const wxRect& rect, + wxAuiPaneInfo& pane) = 0; + + // Provide opportunity for subclasses to recalculate colours + virtual void UpdateColoursFromSystem() {} +}; + + +// this is the default art provider for wxAuiManager. Dock art +// can be customized by creating a class derived from this one, +// or replacing this class entirely + +class WXDLLIMPEXP_AUI wxAuiDefaultDockArt : public wxAuiDockArt +{ +public: + + wxAuiDefaultDockArt(); + + wxAuiDockArt* Clone() wxOVERRIDE; + int GetMetric(int metricId) wxOVERRIDE; + void SetMetric(int metricId, int newVal) wxOVERRIDE; + wxColour GetColour(int id) wxOVERRIDE; + void SetColour(int id, const wxColor& colour) wxOVERRIDE; + void SetFont(int id, const wxFont& font) wxOVERRIDE; + wxFont GetFont(int id) wxOVERRIDE; + + void DrawSash(wxDC& dc, + wxWindow *window, + int orientation, + const wxRect& rect) wxOVERRIDE; + + void DrawBackground(wxDC& dc, + wxWindow *window, + int orientation, + const wxRect& rect) wxOVERRIDE; + + void DrawCaption(wxDC& dc, + wxWindow *window, + const wxString& text, + const wxRect& rect, + wxAuiPaneInfo& pane) wxOVERRIDE; + + void DrawGripper(wxDC& dc, + wxWindow *window, + const wxRect& rect, + wxAuiPaneInfo& pane) wxOVERRIDE; + + void DrawBorder(wxDC& dc, + wxWindow *window, + const wxRect& rect, + wxAuiPaneInfo& pane) wxOVERRIDE; + + void DrawPaneButton(wxDC& dc, + wxWindow *window, + int button, + int buttonState, + const wxRect& rect, + wxAuiPaneInfo& pane) wxOVERRIDE; + +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_MSG("This is not intended for the public API") + void DrawIcon(wxDC& dc, + const wxRect& rect, + wxAuiPaneInfo& pane); +#endif + + virtual void UpdateColoursFromSystem() wxOVERRIDE; + + +protected: + + void DrawCaptionBackground(wxDC& dc, const wxRect& rect, bool active); + + void DrawIcon(wxDC& dc, wxWindow *window, const wxRect& rect, wxAuiPaneInfo& pane); + + void InitBitmaps(); + +protected: + + wxPen m_borderPen; + wxBrush m_sashBrush; + wxBrush m_backgroundBrush; + wxBrush m_gripperBrush; + wxFont m_captionFont; + wxBitmapBundle m_inactiveCloseBitmap; + wxBitmapBundle m_inactivePinBitmap; + wxBitmapBundle m_inactiveMaximizeBitmap; + wxBitmapBundle m_inactiveRestoreBitmap; + wxBitmapBundle m_activeCloseBitmap; + wxBitmapBundle m_activePinBitmap; + wxBitmapBundle m_activeMaximizeBitmap; + wxBitmapBundle m_activeRestoreBitmap; + wxPen m_gripperPen1; + wxPen m_gripperPen2; + wxPen m_gripperPen3; + wxColour m_baseColour; + wxColour m_activeCaptionColour; + wxColour m_activeCaptionGradientColour; + wxColour m_activeCaptionTextColour; + wxColour m_inactiveCaptionColour; + wxColour m_inactiveCaptionGradientColour; + wxColour m_inactiveCaptionTextColour; + int m_borderSize; + int m_captionSize; + int m_sashSize; + int m_buttonSize; + int m_gripperSize; + int m_gradientType; +}; + + + +#endif // wxUSE_AUI +#endif //_WX_DOCKART_H_ diff --git a/lib/wxWidgets/include/wx/aui/floatpane.h b/lib/wxWidgets/include/wx/aui/floatpane.h new file mode 100644 index 0000000..3a81bf8 --- /dev/null +++ b/lib/wxWidgets/include/wx/aui/floatpane.h @@ -0,0 +1,85 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/aui/floatpane.h +// Purpose: wxaui: wx advanced user interface - docking window manager +// Author: Benjamin I. Williams +// Modified by: +// Created: 2005-05-17 +// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved. +// Licence: wxWindows Library Licence, Version 3.1 +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FLOATPANE_H_ +#define _WX_FLOATPANE_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" +#include "wx/weakref.h" + +#if wxUSE_AUI + +#if wxUSE_MINIFRAME + #include "wx/minifram.h" + #define wxAuiFloatingFrameBaseClass wxMiniFrame +#else + #include "wx/frame.h" + #define wxAuiFloatingFrameBaseClass wxFrame +#endif + +class WXDLLIMPEXP_AUI wxAuiFloatingFrame : public wxAuiFloatingFrameBaseClass +{ +public: + wxAuiFloatingFrame(wxWindow* parent, + wxAuiManager* ownerMgr, + const wxAuiPaneInfo& pane, + wxWindowID id = wxID_ANY, + long style = wxRESIZE_BORDER | wxSYSTEM_MENU | wxCAPTION | + wxFRAME_NO_TASKBAR | wxFRAME_FLOAT_ON_PARENT | + wxCLIP_CHILDREN + ); + virtual ~wxAuiFloatingFrame(); + void SetPaneWindow(const wxAuiPaneInfo& pane); + wxAuiManager* GetOwnerManager() const; + + // Allow processing accelerators to the parent frame + virtual bool IsTopNavigationDomain(NavigationKind kind) const wxOVERRIDE; + + wxAuiManager& GetAuiManager() { return m_mgr; } + +protected: + virtual void OnMoveStart(); + virtual void OnMoving(const wxRect& windowRect, wxDirection dir); + virtual void OnMoveFinished(); + +private: + void OnSize(wxSizeEvent& event); + void OnClose(wxCloseEvent& event); + void OnMoveEvent(wxMoveEvent& event); + void OnIdle(wxIdleEvent& event); + void OnActivate(wxActivateEvent& event); + static bool isMouseDown(); + +private: + wxWindow* m_paneWindow; // pane window being managed + bool m_solidDrag; // true if system uses solid window drag + bool m_moving; + wxRect m_lastRect; + wxRect m_last2Rect; + wxRect m_last3Rect; + wxSize m_lastSize; + wxDirection m_lastDirection; + + wxWeakRef m_ownerMgr; + wxAuiManager m_mgr; + +#ifndef SWIG + wxDECLARE_EVENT_TABLE(); + wxDECLARE_CLASS(wxAuiFloatingFrame); +#endif // SWIG +}; + +#endif // wxUSE_AUI +#endif //_WX_FLOATPANE_H_ + diff --git a/lib/wxWidgets/include/wx/aui/framemanager.h b/lib/wxWidgets/include/wx/aui/framemanager.h new file mode 100644 index 0000000..333f626 --- /dev/null +++ b/lib/wxWidgets/include/wx/aui/framemanager.h @@ -0,0 +1,792 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/aui/framemanager.h +// Purpose: wxaui: wx advanced user interface - docking window manager +// Author: Benjamin I. Williams +// Modified by: +// Created: 2005-05-17 +// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved. +// Licence: wxWindows Library Licence, Version 3.1 +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FRAMEMANAGER_H_ +#define _WX_FRAMEMANAGER_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_AUI + +#include "wx/dynarray.h" +#include "wx/gdicmn.h" +#include "wx/window.h" +#include "wx/timer.h" +#include "wx/sizer.h" +#include "wx/bmpbndl.h" + +enum wxAuiManagerDock +{ + wxAUI_DOCK_NONE = 0, + wxAUI_DOCK_TOP = 1, + wxAUI_DOCK_RIGHT = 2, + wxAUI_DOCK_BOTTOM = 3, + wxAUI_DOCK_LEFT = 4, + wxAUI_DOCK_CENTER = 5, + wxAUI_DOCK_CENTRE = wxAUI_DOCK_CENTER +}; + +enum wxAuiManagerOption +{ + wxAUI_MGR_ALLOW_FLOATING = 1 << 0, + wxAUI_MGR_ALLOW_ACTIVE_PANE = 1 << 1, + wxAUI_MGR_TRANSPARENT_DRAG = 1 << 2, + wxAUI_MGR_TRANSPARENT_HINT = 1 << 3, + wxAUI_MGR_VENETIAN_BLINDS_HINT = 1 << 4, + wxAUI_MGR_RECTANGLE_HINT = 1 << 5, + wxAUI_MGR_HINT_FADE = 1 << 6, + wxAUI_MGR_NO_VENETIAN_BLINDS_FADE = 1 << 7, + wxAUI_MGR_LIVE_RESIZE = 1 << 8, + + wxAUI_MGR_DEFAULT = wxAUI_MGR_ALLOW_FLOATING | + wxAUI_MGR_TRANSPARENT_HINT | + wxAUI_MGR_HINT_FADE | + wxAUI_MGR_NO_VENETIAN_BLINDS_FADE +}; + + +enum wxAuiPaneDockArtSetting +{ + wxAUI_DOCKART_SASH_SIZE = 0, + wxAUI_DOCKART_CAPTION_SIZE = 1, + wxAUI_DOCKART_GRIPPER_SIZE = 2, + wxAUI_DOCKART_PANE_BORDER_SIZE = 3, + wxAUI_DOCKART_PANE_BUTTON_SIZE = 4, + wxAUI_DOCKART_BACKGROUND_COLOUR = 5, + wxAUI_DOCKART_SASH_COLOUR = 6, + wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR = 7, + wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR = 8, + wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR = 9, + wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR = 10, + wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR = 11, + wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR = 12, + wxAUI_DOCKART_BORDER_COLOUR = 13, + wxAUI_DOCKART_GRIPPER_COLOUR = 14, + wxAUI_DOCKART_CAPTION_FONT = 15, + wxAUI_DOCKART_GRADIENT_TYPE = 16 +}; + +enum wxAuiPaneDockArtGradients +{ + wxAUI_GRADIENT_NONE = 0, + wxAUI_GRADIENT_VERTICAL = 1, + wxAUI_GRADIENT_HORIZONTAL = 2 +}; + +enum wxAuiPaneButtonState +{ + wxAUI_BUTTON_STATE_NORMAL = 0, + wxAUI_BUTTON_STATE_HOVER = 1 << 1, + wxAUI_BUTTON_STATE_PRESSED = 1 << 2, + wxAUI_BUTTON_STATE_DISABLED = 1 << 3, + wxAUI_BUTTON_STATE_HIDDEN = 1 << 4, + wxAUI_BUTTON_STATE_CHECKED = 1 << 5 +}; + +enum wxAuiButtonId +{ + wxAUI_BUTTON_CLOSE = 101, + wxAUI_BUTTON_MAXIMIZE_RESTORE = 102, + wxAUI_BUTTON_MINIMIZE = 103, + wxAUI_BUTTON_PIN = 104, + wxAUI_BUTTON_OPTIONS = 105, + wxAUI_BUTTON_WINDOWLIST = 106, + wxAUI_BUTTON_LEFT = 107, + wxAUI_BUTTON_RIGHT = 108, + wxAUI_BUTTON_UP = 109, + wxAUI_BUTTON_DOWN = 110, + wxAUI_BUTTON_CUSTOM1 = 201, + wxAUI_BUTTON_CUSTOM2 = 202, + wxAUI_BUTTON_CUSTOM3 = 203 +}; + +enum wxAuiPaneInsertLevel +{ + wxAUI_INSERT_PANE = 0, + wxAUI_INSERT_ROW = 1, + wxAUI_INSERT_DOCK = 2 +}; + + + + +// forwards and array declarations +class wxAuiDockUIPart; +class wxAuiPaneInfo; +class wxAuiDockInfo; +class wxAuiDockArt; +class wxAuiManagerEvent; + +#ifndef SWIG +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiDockInfo, wxAuiDockInfoArray, WXDLLIMPEXP_AUI); +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiDockUIPart, wxAuiDockUIPartArray, WXDLLIMPEXP_AUI); +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiPaneInfo, wxAuiPaneInfoArray, WXDLLIMPEXP_AUI); +WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxAuiPaneInfo*, wxAuiPaneInfoPtrArray, class WXDLLIMPEXP_AUI); +WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxAuiDockInfo*, wxAuiDockInfoPtrArray, class WXDLLIMPEXP_AUI); +#endif // SWIG + +extern WXDLLIMPEXP_AUI wxAuiDockInfo wxAuiNullDockInfo; +extern WXDLLIMPEXP_AUI wxAuiPaneInfo wxAuiNullPaneInfo; + + + +class WXDLLIMPEXP_AUI wxAuiPaneInfo +{ +public: + + wxAuiPaneInfo() + : best_size(wxDefaultSize) + , min_size(wxDefaultSize) + , max_size(wxDefaultSize) + , floating_pos(wxDefaultPosition) + , floating_size(wxDefaultSize) + { + window = NULL; + frame = NULL; + state = 0; + dock_direction = wxAUI_DOCK_LEFT; + dock_layer = 0; + dock_row = 0; + dock_pos = 0; + dock_proportion = 0; + + DefaultPane(); + } + + ~wxAuiPaneInfo() {} + + // Write the safe parts of a newly loaded PaneInfo structure "source" into "this" + // used on loading perspectives etc. + void SafeSet(wxAuiPaneInfo source) + { + // note source is not passed by reference so we can overwrite, to keep the + // unsafe bits of "dest" + source.window = window; + source.frame = frame; + wxCHECK_RET(source.IsValid(), + "window settings and pane settings are incompatible"); + // now assign + *this = source; + } + + bool IsOk() const { return window != NULL; } + bool IsFixed() const { return !HasFlag(optionResizable); } + bool IsResizable() const { return HasFlag(optionResizable); } + bool IsShown() const { return !HasFlag(optionHidden); } + bool IsFloating() const { return HasFlag(optionFloating); } + bool IsDocked() const { return !HasFlag(optionFloating); } + bool IsToolbar() const { return HasFlag(optionToolbar); } + bool IsTopDockable() const { return HasFlag(optionTopDockable); } + bool IsBottomDockable() const { return HasFlag(optionBottomDockable); } + bool IsLeftDockable() const { return HasFlag(optionLeftDockable); } + bool IsRightDockable() const { return HasFlag(optionRightDockable); } + bool IsDockable() const + { + return HasFlag(optionTopDockable | optionBottomDockable | + optionLeftDockable | optionRightDockable); + } + bool IsFloatable() const { return HasFlag(optionFloatable); } + bool IsMovable() const { return HasFlag(optionMovable); } + bool IsDestroyOnClose() const { return HasFlag(optionDestroyOnClose); } + bool IsMaximized() const { return HasFlag(optionMaximized); } + bool HasCaption() const { return HasFlag(optionCaption); } + bool HasGripper() const { return HasFlag(optionGripper); } + bool HasBorder() const { return HasFlag(optionPaneBorder); } + bool HasCloseButton() const { return HasFlag(buttonClose); } + bool HasMaximizeButton() const { return HasFlag(buttonMaximize); } + bool HasMinimizeButton() const { return HasFlag(buttonMinimize); } + bool HasPinButton() const { return HasFlag(buttonPin); } + bool HasGripperTop() const { return HasFlag(optionGripperTop); } + +#ifdef SWIG + %typemap(out) wxAuiPaneInfo& { $result = $self; Py_INCREF($result); } +#endif + wxAuiPaneInfo& Window(wxWindow* w) + { + wxAuiPaneInfo test(*this); + test.window = w; + wxCHECK_MSG(test.IsValid(), *this, + "window settings and pane settings are incompatible"); + *this = test; + return *this; + } + wxAuiPaneInfo& Name(const wxString& n) { name = n; return *this; } + wxAuiPaneInfo& Caption(const wxString& c) { caption = c; return *this; } + wxAuiPaneInfo& Icon(const wxBitmapBundle& b) { icon = b; return *this; } + wxAuiPaneInfo& Left() { dock_direction = wxAUI_DOCK_LEFT; return *this; } + wxAuiPaneInfo& Right() { dock_direction = wxAUI_DOCK_RIGHT; return *this; } + wxAuiPaneInfo& Top() { dock_direction = wxAUI_DOCK_TOP; return *this; } + wxAuiPaneInfo& Bottom() { dock_direction = wxAUI_DOCK_BOTTOM; return *this; } + wxAuiPaneInfo& Center() { dock_direction = wxAUI_DOCK_CENTER; return *this; } + wxAuiPaneInfo& Centre() { dock_direction = wxAUI_DOCK_CENTRE; return *this; } + wxAuiPaneInfo& Direction(int direction) { dock_direction = direction; return *this; } + wxAuiPaneInfo& Layer(int layer) { dock_layer = layer; return *this; } + wxAuiPaneInfo& Row(int row) { dock_row = row; return *this; } + wxAuiPaneInfo& Position(int pos) { dock_pos = pos; return *this; } + wxAuiPaneInfo& BestSize(const wxSize& size) { best_size = size; return *this; } + wxAuiPaneInfo& MinSize(const wxSize& size) { min_size = size; return *this; } + wxAuiPaneInfo& MaxSize(const wxSize& size) { max_size = size; return *this; } + wxAuiPaneInfo& BestSize(int x, int y) { best_size.Set(x,y); return *this; } + wxAuiPaneInfo& MinSize(int x, int y) { min_size.Set(x,y); return *this; } + wxAuiPaneInfo& MaxSize(int x, int y) { max_size.Set(x,y); return *this; } + wxAuiPaneInfo& FloatingPosition(const wxPoint& pos) { floating_pos = pos; return *this; } + wxAuiPaneInfo& FloatingPosition(int x, int y) { floating_pos.x = x; floating_pos.y = y; return *this; } + wxAuiPaneInfo& FloatingSize(const wxSize& size) { floating_size = size; return *this; } + wxAuiPaneInfo& FloatingSize(int x, int y) { floating_size.Set(x,y); return *this; } + wxAuiPaneInfo& Fixed() { return SetFlag(optionResizable, false); } + wxAuiPaneInfo& Resizable(bool resizable = true) { return SetFlag(optionResizable, resizable); } + wxAuiPaneInfo& Dock() { return SetFlag(optionFloating, false); } + wxAuiPaneInfo& Float() { return SetFlag(optionFloating, true); } + wxAuiPaneInfo& Hide() { return SetFlag(optionHidden, true); } + wxAuiPaneInfo& Show(bool show = true) { return SetFlag(optionHidden, !show); } + wxAuiPaneInfo& CaptionVisible(bool visible = true) { return SetFlag(optionCaption, visible); } + wxAuiPaneInfo& Maximize() { return SetFlag(optionMaximized, true); } + wxAuiPaneInfo& Restore() { return SetFlag(optionMaximized, false); } + wxAuiPaneInfo& PaneBorder(bool visible = true) { return SetFlag(optionPaneBorder, visible); } + wxAuiPaneInfo& Gripper(bool visible = true) { return SetFlag(optionGripper, visible); } + wxAuiPaneInfo& GripperTop(bool attop = true) { return SetFlag(optionGripperTop, attop); } + wxAuiPaneInfo& CloseButton(bool visible = true) { return SetFlag(buttonClose, visible); } + wxAuiPaneInfo& MaximizeButton(bool visible = true) { return SetFlag(buttonMaximize, visible); } + wxAuiPaneInfo& MinimizeButton(bool visible = true) { return SetFlag(buttonMinimize, visible); } + wxAuiPaneInfo& PinButton(bool visible = true) { return SetFlag(buttonPin, visible); } + wxAuiPaneInfo& DestroyOnClose(bool b = true) { return SetFlag(optionDestroyOnClose, b); } + wxAuiPaneInfo& TopDockable(bool b = true) { return SetFlag(optionTopDockable, b); } + wxAuiPaneInfo& BottomDockable(bool b = true) { return SetFlag(optionBottomDockable, b); } + wxAuiPaneInfo& LeftDockable(bool b = true) { return SetFlag(optionLeftDockable, b); } + wxAuiPaneInfo& RightDockable(bool b = true) { return SetFlag(optionRightDockable, b); } + wxAuiPaneInfo& Floatable(bool b = true) { return SetFlag(optionFloatable, b); } + wxAuiPaneInfo& Movable(bool b = true) { return SetFlag(optionMovable, b); } + wxAuiPaneInfo& DockFixed(bool b = true) { return SetFlag(optionDockFixed, b); } + + wxAuiPaneInfo& Dockable(bool b = true) + { + return TopDockable(b).BottomDockable(b).LeftDockable(b).RightDockable(b); + } + + wxAuiPaneInfo& DefaultPane() + { + wxAuiPaneInfo test(*this); + test.state |= optionTopDockable | optionBottomDockable | + optionLeftDockable | optionRightDockable | + optionFloatable | optionMovable | optionResizable | + optionCaption | optionPaneBorder | buttonClose; + wxCHECK_MSG(test.IsValid(), *this, + "window settings and pane settings are incompatible"); + *this = test; + return *this; + } + + wxAuiPaneInfo& CentrePane() { return CenterPane(); } + wxAuiPaneInfo& CenterPane() + { + state = 0; + return Center().PaneBorder().Resizable(); + } + + wxAuiPaneInfo& ToolbarPane() + { + DefaultPane(); + state |= (optionToolbar | optionGripper); + state &= ~(optionResizable | optionCaption); + if (dock_layer == 0) + dock_layer = 10; + return *this; + } + + wxAuiPaneInfo& SetFlag(int flag, bool option_state) + { + wxAuiPaneInfo test(*this); + if (option_state) + test.state |= flag; + else + test.state &= ~flag; + wxCHECK_MSG(test.IsValid(), *this, + "window settings and pane settings are incompatible"); + *this = test; + return *this; + } + + bool HasFlag(int flag) const + { + return (state & flag) != 0; + } + +#ifdef SWIG + %typemap(out) wxAuiPaneInfo& ; +#endif + +public: + + // NOTE: You can add and subtract flags from this list, + // but do not change the values of the flags, because + // they are stored in a binary integer format in the + // perspective string. If you really need to change the + // values around, you'll have to ensure backwards-compatibility + // in the perspective loading code. + enum wxAuiPaneState + { + optionFloating = 1 << 0, + optionHidden = 1 << 1, + optionLeftDockable = 1 << 2, + optionRightDockable = 1 << 3, + optionTopDockable = 1 << 4, + optionBottomDockable = 1 << 5, + optionFloatable = 1 << 6, + optionMovable = 1 << 7, + optionResizable = 1 << 8, + optionPaneBorder = 1 << 9, + optionCaption = 1 << 10, + optionGripper = 1 << 11, + optionDestroyOnClose = 1 << 12, + optionToolbar = 1 << 13, + optionActive = 1 << 14, + optionGripperTop = 1 << 15, + optionMaximized = 1 << 16, + optionDockFixed = 1 << 17, + + buttonClose = 1 << 21, + buttonMaximize = 1 << 22, + buttonMinimize = 1 << 23, + buttonPin = 1 << 24, + + buttonCustom1 = 1 << 26, + buttonCustom2 = 1 << 27, + buttonCustom3 = 1 << 28, + + savedHiddenState = 1 << 30, // used internally + actionPane = 1u << 31 // used internally + }; + +public: + wxString name; // name of the pane + wxString caption; // caption displayed on the window + wxBitmapBundle icon; // icon of the pane, may be invalid + + wxWindow* window; // window that is in this pane + wxFrame* frame; // floating frame window that holds the pane + unsigned int state; // a combination of wxPaneState values + + int dock_direction; // dock direction (top, bottom, left, right, center) + int dock_layer; // layer number (0 = innermost layer) + int dock_row; // row number on the docking bar (0 = first row) + int dock_pos; // position inside the row (0 = first position) + + wxSize best_size; // size that the layout engine will prefer + wxSize min_size; // minimum size the pane window can tolerate + wxSize max_size; // maximum size the pane window can tolerate + + wxPoint floating_pos; // position while floating + wxSize floating_size; // size while floating + int dock_proportion; // proportion while docked + + wxRect rect; // current rectangle (populated by wxAUI) + + bool IsValid() const; +}; + + + +class WXDLLIMPEXP_FWD_AUI wxAuiFloatingFrame; + +class WXDLLIMPEXP_AUI wxAuiManager : public wxEvtHandler +{ + friend class wxAuiFloatingFrame; + +public: + + wxAuiManager(wxWindow* managedWnd = NULL, + unsigned int flags = wxAUI_MGR_DEFAULT); + virtual ~wxAuiManager(); + void UnInit(); + + void SetFlags(unsigned int flags); + unsigned int GetFlags() const; + + static bool AlwaysUsesLiveResize(); + bool HasLiveResize() const; + + void SetManagedWindow(wxWindow* managedWnd); + wxWindow* GetManagedWindow() const; + + static wxAuiManager* GetManager(wxWindow* window); + + void SetArtProvider(wxAuiDockArt* artProvider); + wxAuiDockArt* GetArtProvider() const; + + wxAuiPaneInfo& GetPane(wxWindow* window); + wxAuiPaneInfo& GetPane(const wxString& name); + wxAuiPaneInfoArray& GetAllPanes(); + + bool AddPane(wxWindow* window, + const wxAuiPaneInfo& paneInfo); + + bool AddPane(wxWindow* window, + const wxAuiPaneInfo& paneInfo, + const wxPoint& dropPos); + + bool AddPane(wxWindow* window, + int direction = wxLEFT, + const wxString& caption = wxEmptyString); + + bool InsertPane(wxWindow* window, + const wxAuiPaneInfo& insertLocation, + int insertLevel = wxAUI_INSERT_PANE); + + bool DetachPane(wxWindow* window); + + void Update(); + + wxString SavePaneInfo(const wxAuiPaneInfo& pane); + void LoadPaneInfo(wxString panePart, wxAuiPaneInfo &pane); + wxString SavePerspective(); + bool LoadPerspective(const wxString& perspective, bool update = true); + + void SetDockSizeConstraint(double widthPct, double heightPct); + void GetDockSizeConstraint(double* widthPct, double* heightPct) const; + + void ClosePane(wxAuiPaneInfo& paneInfo); + void MaximizePane(wxAuiPaneInfo& paneInfo); + void RestorePane(wxAuiPaneInfo& paneInfo); + void RestoreMaximizedPane(); + +public: + + virtual wxAuiFloatingFrame* CreateFloatingFrame(wxWindow* parent, const wxAuiPaneInfo& p); + virtual bool CanDockPanel(const wxAuiPaneInfo & p); + + void StartPaneDrag( + wxWindow* paneWindow, + const wxPoint& offset); + + wxRect CalculateHintRect( + wxWindow* paneWindow, + const wxPoint& pt, + const wxPoint& offset); + + void DrawHintRect( + wxWindow* paneWindow, + const wxPoint& pt, + const wxPoint& offset); + + virtual void ShowHint(const wxRect& rect); + virtual void HideHint(); + + void OnHintActivate(wxActivateEvent& event); + +public: + + // deprecated -- please use SetManagedWindow() + // and GetManagedWindow() instead + + wxDEPRECATED( void SetFrame(wxFrame* frame) ); + wxDEPRECATED( wxFrame* GetFrame() const ); + +protected: + + void UpdateHintWindowConfig(); + + void DoFrameLayout(); + + void LayoutAddPane(wxSizer* container, + wxAuiDockInfo& dock, + wxAuiPaneInfo& pane, + wxAuiDockUIPartArray& uiparts, + bool spacerOnly); + + void LayoutAddDock(wxSizer* container, + wxAuiDockInfo& dock, + wxAuiDockUIPartArray& uiParts, + bool spacerOnly); + + wxSizer* LayoutAll(wxAuiPaneInfoArray& panes, + wxAuiDockInfoArray& docks, + wxAuiDockUIPartArray & uiParts, + bool spacerOnly = false); + + virtual bool ProcessDockResult(wxAuiPaneInfo& target, + const wxAuiPaneInfo& newPos); + + bool DoDrop(wxAuiDockInfoArray& docks, + wxAuiPaneInfoArray& panes, + wxAuiPaneInfo& drop, + const wxPoint& pt, + const wxPoint& actionOffset = wxPoint(0,0)); + + wxAuiDockUIPart* HitTest(int x, int y); + wxAuiDockUIPart* GetPanePart(wxWindow* pane); + int GetDockPixelOffset(wxAuiPaneInfo& test); + void OnFloatingPaneMoveStart(wxWindow* window); + void OnFloatingPaneMoving(wxWindow* window, wxDirection dir ); + void OnFloatingPaneMoved(wxWindow* window, wxDirection dir); + void OnFloatingPaneActivated(wxWindow* window); + void OnFloatingPaneClosed(wxWindow* window, wxCloseEvent& evt); + void OnFloatingPaneResized(wxWindow* window, const wxRect& rect); + void Render(wxDC* dc); + void Repaint(wxDC* dc = NULL); + void ProcessMgrEvent(wxAuiManagerEvent& event); + void UpdateButtonOnScreen(wxAuiDockUIPart* buttonUiPart, + const wxMouseEvent& event); + void GetPanePositionsAndSizes(wxAuiDockInfo& dock, + wxArrayInt& positions, + wxArrayInt& sizes); + + /// Ends a resize action, or for live update, resizes the sash + bool DoEndResizeAction(wxMouseEvent& event); + + void SetActivePane(wxWindow* active_pane); + +public: + + // public events (which can be invoked externally) + void OnRender(wxAuiManagerEvent& evt); + void OnPaneButton(wxAuiManagerEvent& evt); + +protected: + + // protected events + void OnDestroy(wxWindowDestroyEvent& evt); + void OnPaint(wxPaintEvent& evt); + void OnEraseBackground(wxEraseEvent& evt); + void OnSize(wxSizeEvent& evt); + void OnSetCursor(wxSetCursorEvent& evt); + void OnLeftDown(wxMouseEvent& evt); + void OnLeftUp(wxMouseEvent& evt); + void OnMotion(wxMouseEvent& evt); + void OnCaptureLost(wxMouseCaptureLostEvent& evt); + void OnLeaveWindow(wxMouseEvent& evt); + void OnChildFocus(wxChildFocusEvent& evt); + void OnHintFadeTimer(wxTimerEvent& evt); + void OnFindManager(wxAuiManagerEvent& evt); + void OnSysColourChanged(wxSysColourChangedEvent& event); + +protected: + + enum + { + actionNone = 0, + actionResize, + actionClickButton, + actionClickCaption, + actionDragToolbarPane, + actionDragFloatingPane + }; + +protected: + + wxWindow* m_frame; // the window being managed + wxAuiDockArt* m_art; // dock art object which does all drawing + unsigned int m_flags; // manager flags wxAUI_MGR_* + + wxAuiPaneInfoArray m_panes; // array of panes structures + wxAuiDockInfoArray m_docks; // array of docks structures + wxAuiDockUIPartArray m_uiParts; // array of UI parts (captions, buttons, etc) + + int m_action; // current mouse action + wxPoint m_actionStart; // position where the action click started + wxPoint m_actionOffset; // offset from upper left of the item clicked + wxAuiDockUIPart* m_actionPart; // ptr to the part the action happened to + wxWindow* m_actionWindow; // action frame or window (NULL if none) + wxRect m_actionHintRect; // hint rectangle for the action + wxRect m_lastRect; + wxAuiDockUIPart* m_hoverButton;// button uipart being hovered over + wxRect m_lastHint; // last hint rectangle + wxPoint m_lastMouseMove; // last mouse move position (see OnMotion) + int m_currentDragItem; + bool m_hasMaximized; + + double m_dockConstraintX; // 0.0 .. 1.0; max pct of window width a dock can consume + double m_dockConstraintY; // 0.0 .. 1.0; max pct of window height a dock can consume + + wxFrame* m_hintWnd; // transparent hint window, if supported by platform + wxTimer m_hintFadeTimer; // transparent fade timer + wxByte m_hintFadeAmt; // transparent fade amount + wxByte m_hintFadeMax; // maximum value of hint fade + + void* m_reserved; + +#ifndef SWIG + wxDECLARE_EVENT_TABLE(); + wxDECLARE_CLASS(wxAuiManager); +#endif // SWIG +}; + + + +// event declarations/classes + +class WXDLLIMPEXP_AUI wxAuiManagerEvent : public wxEvent +{ +public: + wxAuiManagerEvent(wxEventType type=wxEVT_NULL) : wxEvent(0, type) + { + manager = NULL; + pane = NULL; + button = 0; + veto_flag = false; + canveto_flag = true; + dc = NULL; + } + wxEvent *Clone() const wxOVERRIDE { return new wxAuiManagerEvent(*this); } + + void SetManager(wxAuiManager* mgr) { manager = mgr; } + void SetPane(wxAuiPaneInfo* p) { pane = p; } + void SetButton(int b) { button = b; } + void SetDC(wxDC* pdc) { dc = pdc; } + + wxAuiManager* GetManager() const { return manager; } + wxAuiPaneInfo* GetPane() const { return pane; } + int GetButton() const { return button; } + wxDC* GetDC() const { return dc; } + + void Veto(bool veto = true) { veto_flag = veto; } + bool GetVeto() const { return veto_flag; } + void SetCanVeto(bool can_veto) { canveto_flag = can_veto; } + bool CanVeto() const { return canveto_flag && veto_flag; } + +public: + wxAuiManager* manager; + wxAuiPaneInfo* pane; + int button; + bool veto_flag; + bool canveto_flag; + wxDC* dc; + +#ifndef SWIG +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiManagerEvent); +#endif +}; + + +class WXDLLIMPEXP_AUI wxAuiDockInfo +{ +public: + wxAuiDockInfo() + { + dock_direction = 0; + dock_layer = 0; + dock_row = 0; + size = 0; + min_size = 0; + resizable = true; + fixed = false; + toolbar = false; + reserved1 = false; + } + + bool IsOk() const { return dock_direction != 0; } + bool IsHorizontal() const { return dock_direction == wxAUI_DOCK_TOP || + dock_direction == wxAUI_DOCK_BOTTOM; } + bool IsVertical() const { return dock_direction == wxAUI_DOCK_LEFT || + dock_direction == wxAUI_DOCK_RIGHT || + dock_direction == wxAUI_DOCK_CENTER; } +public: + wxAuiPaneInfoPtrArray panes; // array of panes + wxRect rect; // current rectangle + int dock_direction; // dock direction (top, bottom, left, right, center) + int dock_layer; // layer number (0 = innermost layer) + int dock_row; // row number on the docking bar (0 = first row) + int size; // size of the dock + int min_size; // minimum size of a dock (0 if there is no min) + bool resizable; // flag indicating whether the dock is resizable + bool toolbar; // flag indicating dock contains only toolbars + bool fixed; // flag indicating that the dock operates on + // absolute coordinates as opposed to proportional + bool reserved1; +}; + + +class WXDLLIMPEXP_AUI wxAuiDockUIPart +{ +public: + enum + { + typeCaption, + typeGripper, + typeDock, + typeDockSizer, + typePane, + typePaneSizer, + typeBackground, + typePaneBorder, + typePaneButton + }; + + int type; // ui part type (see enum above) + int orientation; // orientation (either wxHORIZONTAL or wxVERTICAL) + wxAuiDockInfo* dock; // which dock the item is associated with + wxAuiPaneInfo* pane; // which pane the item is associated with + int button; // which pane button the item is associated with + wxSizer* cont_sizer; // the part's containing sizer + wxSizerItem* sizer_item; // the sizer item of the part + wxRect rect; // client coord rectangle of the part itself +}; + + + + +#ifndef SWIG + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_BUTTON, wxAuiManagerEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_CLOSE, wxAuiManagerEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_MAXIMIZE, wxAuiManagerEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_RESTORE, wxAuiManagerEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_ACTIVATED, wxAuiManagerEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_RENDER, wxAuiManagerEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_FIND_MANAGER, wxAuiManagerEvent ); + +typedef void (wxEvtHandler::*wxAuiManagerEventFunction)(wxAuiManagerEvent&); + +#define wxAuiManagerEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxAuiManagerEventFunction, func) + +#define EVT_AUI_PANE_BUTTON(func) \ + wx__DECLARE_EVT0(wxEVT_AUI_PANE_BUTTON, wxAuiManagerEventHandler(func)) +#define EVT_AUI_PANE_CLOSE(func) \ + wx__DECLARE_EVT0(wxEVT_AUI_PANE_CLOSE, wxAuiManagerEventHandler(func)) +#define EVT_AUI_PANE_MAXIMIZE(func) \ + wx__DECLARE_EVT0(wxEVT_AUI_PANE_MAXIMIZE, wxAuiManagerEventHandler(func)) +#define EVT_AUI_PANE_RESTORE(func) \ + wx__DECLARE_EVT0(wxEVT_AUI_PANE_RESTORE, wxAuiManagerEventHandler(func)) +#define EVT_AUI_PANE_ACTIVATED(func) \ + wx__DECLARE_EVT0(wxEVT_AUI_PANE_ACTIVATED, wxAuiManagerEventHandler(func)) +#define EVT_AUI_RENDER(func) \ + wx__DECLARE_EVT0(wxEVT_AUI_RENDER, wxAuiManagerEventHandler(func)) +#define EVT_AUI_FIND_MANAGER(func) \ + wx__DECLARE_EVT0(wxEVT_AUI_FIND_MANAGER, wxAuiManagerEventHandler(func)) + +#else + +%constant wxEventType wxEVT_AUI_PANE_BUTTON; +%constant wxEventType wxEVT_AUI_PANE_CLOSE; +%constant wxEventType wxEVT_AUI_PANE_MAXIMIZE; +%constant wxEventType wxEVT_AUI_PANE_RESTORE; +%constant wxEventType wxEVT_AUI_PANE_ACTIVATED; +%constant wxEventType wxEVT_AUI_RENDER; +%constant wxEventType wxEVT_AUI_FIND_MANAGER; + +%pythoncode { + EVT_AUI_PANE_BUTTON = wx.PyEventBinder( wxEVT_AUI_PANE_BUTTON ) + EVT_AUI_PANE_CLOSE = wx.PyEventBinder( wxEVT_AUI_PANE_CLOSE ) + EVT_AUI_PANE_MAXIMIZE = wx.PyEventBinder( wxEVT_AUI_PANE_MAXIMIZE ) + EVT_AUI_PANE_RESTORE = wx.PyEventBinder( wxEVT_AUI_PANE_RESTORE ) + EVT_AUI_PANE_ACTIVATED = wx.PyEventBinder( wxEVT_AUI_PANE_ACTIVATED ) + EVT_AUI_RENDER = wx.PyEventBinder( wxEVT_AUI_RENDER ) + EVT_AUI_FIND_MANAGER = wx.PyEventBinder( wxEVT_AUI_FIND_MANAGER ) +} +#endif // SWIG + +#endif // wxUSE_AUI +#endif //_WX_FRAMEMANAGER_H_ + diff --git a/lib/wxWidgets/include/wx/aui/tabart.h b/lib/wxWidgets/include/wx/aui/tabart.h new file mode 100644 index 0000000..1dde822 --- /dev/null +++ b/lib/wxWidgets/include/wx/aui/tabart.h @@ -0,0 +1,337 @@ +////////////////////////////////////////////////////////////////////////////// +// Name: wx/aui/tabart.h +// Purpose: wxaui: wx advanced user interface - notebook +// Author: Benjamin I. Williams +// Modified by: Jens Lody (extracted from wx/aui/auibook.h) +// Created: 2012-03-21 +// Copyright: (C) Copyright 2006, Kirix Corporation, All Rights Reserved. +// Licence: wxWindows Library Licence, Version 3.1 +/////////////////////////////////////////////////////////////////////////////// + + +#ifndef _WX_AUI_TABART_H_ +#define _WX_AUI_TABART_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_AUI + +#include "wx/colour.h" +#include "wx/gdicmn.h" +#include "wx/font.h" +#include "wx/pen.h" +#include "wx/brush.h" +#include "wx/bmpbndl.h" + + +class wxAuiNotebookPage; +class wxAuiNotebookPageArray; +class wxWindow; +class wxDC; + + +// tab art class + +class WXDLLIMPEXP_AUI wxAuiTabArt +{ +public: + + wxAuiTabArt() { } + virtual ~wxAuiTabArt() { } + + virtual wxAuiTabArt* Clone() = 0; + virtual void SetFlags(unsigned int flags) = 0; + + virtual void SetSizingInfo(const wxSize& tabCtrlSize, + size_t tabCount, + wxWindow* wnd = NULL) = 0; + + virtual void SetNormalFont(const wxFont& font) = 0; + virtual void SetSelectedFont(const wxFont& font) = 0; + virtual void SetMeasuringFont(const wxFont& font) = 0; + virtual void SetColour(const wxColour& colour) = 0; + virtual void SetActiveColour(const wxColour& colour) = 0; + + virtual void DrawBorder( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) = 0; + + virtual void DrawBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) = 0; + + virtual void DrawTab(wxDC& dc, + wxWindow* wnd, + const wxAuiNotebookPage& pane, + const wxRect& inRect, + int closeButtonState, + wxRect* outTabRect, + wxRect* outButtonRect, + int* xExtent) = 0; + + virtual void DrawButton( + wxDC& dc, + wxWindow* wnd, + const wxRect& inRect, + int bitmapId, + int buttonState, + int orientation, + wxRect* outRect) = 0; + + virtual wxSize GetTabSize( + wxDC& dc, + wxWindow* wnd, + const wxString& caption, + const wxBitmapBundle& bitmap, + bool active, + int closeButtonState, + int* xExtent) = 0; + + virtual int ShowDropDown( + wxWindow* wnd, + const wxAuiNotebookPageArray& items, + int activeIdx) = 0; + + virtual int GetIndentSize() = 0; + + virtual int GetBorderWidth( + wxWindow* wnd) = 0; + + virtual int GetAdditionalBorderSpace( + wxWindow* wnd) = 0; + + virtual int GetBestTabCtrlSize( + wxWindow* wnd, + const wxAuiNotebookPageArray& pages, + const wxSize& requiredBmpSize) = 0; + + // Provide opportunity for subclasses to recalculate colours + virtual void UpdateColoursFromSystem() {} +}; + + +class WXDLLIMPEXP_AUI wxAuiGenericTabArt : public wxAuiTabArt +{ + +public: + + wxAuiGenericTabArt(); + virtual ~wxAuiGenericTabArt(); + + wxAuiTabArt* Clone() wxOVERRIDE; + void SetFlags(unsigned int flags) wxOVERRIDE; + void SetSizingInfo(const wxSize& tabCtrlSize, + size_t tabCount, + wxWindow* wnd = NULL) wxOVERRIDE; + + void SetNormalFont(const wxFont& font) wxOVERRIDE; + void SetSelectedFont(const wxFont& font) wxOVERRIDE; + void SetMeasuringFont(const wxFont& font) wxOVERRIDE; + void SetColour(const wxColour& colour) wxOVERRIDE; + void SetActiveColour(const wxColour& colour) wxOVERRIDE; + + void DrawBorder( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + void DrawBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + void DrawTab(wxDC& dc, + wxWindow* wnd, + const wxAuiNotebookPage& pane, + const wxRect& inRect, + int closeButtonState, + wxRect* outTabRect, + wxRect* outButtonRect, + int* xExtent) wxOVERRIDE; + + void DrawButton( + wxDC& dc, + wxWindow* wnd, + const wxRect& inRect, + int bitmapId, + int buttonState, + int orientation, + wxRect* outRect) wxOVERRIDE; + + int GetIndentSize() wxOVERRIDE; + + int GetBorderWidth( + wxWindow* wnd) wxOVERRIDE; + + int GetAdditionalBorderSpace( + wxWindow* wnd) wxOVERRIDE; + + wxSize GetTabSize( + wxDC& dc, + wxWindow* wnd, + const wxString& caption, + const wxBitmapBundle& bitmap, + bool active, + int closeButtonState, + int* xExtent) wxOVERRIDE; + + int ShowDropDown( + wxWindow* wnd, + const wxAuiNotebookPageArray& items, + int activeIdx) wxOVERRIDE; + + int GetBestTabCtrlSize(wxWindow* wnd, + const wxAuiNotebookPageArray& pages, + const wxSize& requiredBmpSize) wxOVERRIDE; + + // Provide opportunity for subclasses to recalculate colours + virtual void UpdateColoursFromSystem() wxOVERRIDE; + +protected: + + wxFont m_normalFont; + wxFont m_selectedFont; + wxFont m_measuringFont; + wxColour m_baseColour; + wxPen m_baseColourPen; + wxPen m_borderPen; + wxBrush m_baseColourBrush; + wxColour m_activeColour; + wxBitmapBundle m_activeCloseBmp; + wxBitmapBundle m_disabledCloseBmp; + wxBitmapBundle m_activeLeftBmp; + wxBitmapBundle m_disabledLeftBmp; + wxBitmapBundle m_activeRightBmp; + wxBitmapBundle m_disabledRightBmp; + wxBitmapBundle m_activeWindowListBmp; + wxBitmapBundle m_disabledWindowListBmp; + + int m_fixedTabWidth; + int m_tabCtrlHeight; + unsigned int m_flags; +}; + + +class WXDLLIMPEXP_AUI wxAuiSimpleTabArt : public wxAuiTabArt +{ + +public: + + wxAuiSimpleTabArt(); + virtual ~wxAuiSimpleTabArt(); + + wxAuiTabArt* Clone() wxOVERRIDE; + void SetFlags(unsigned int flags) wxOVERRIDE; + + void SetSizingInfo(const wxSize& tabCtrlSize, + size_t tabCount, + wxWindow* wnd = NULL) wxOVERRIDE; + + void SetNormalFont(const wxFont& font) wxOVERRIDE; + void SetSelectedFont(const wxFont& font) wxOVERRIDE; + void SetMeasuringFont(const wxFont& font) wxOVERRIDE; + void SetColour(const wxColour& colour) wxOVERRIDE; + void SetActiveColour(const wxColour& colour) wxOVERRIDE; + + void DrawBorder( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + void DrawBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + void DrawTab(wxDC& dc, + wxWindow* wnd, + const wxAuiNotebookPage& pane, + const wxRect& inRect, + int closeButtonState, + wxRect* outTabRect, + wxRect* outButtonRect, + int* xExtent) wxOVERRIDE; + + void DrawButton( + wxDC& dc, + wxWindow* wnd, + const wxRect& inRect, + int bitmapId, + int buttonState, + int orientation, + wxRect* outRect) wxOVERRIDE; + + int GetIndentSize() wxOVERRIDE; + + int GetBorderWidth( + wxWindow* wnd) wxOVERRIDE; + + int GetAdditionalBorderSpace( + wxWindow* wnd) wxOVERRIDE; + + wxSize GetTabSize( + wxDC& dc, + wxWindow* wnd, + const wxString& caption, + const wxBitmapBundle& bitmap, + bool active, + int closeButtonState, + int* xExtent) wxOVERRIDE; + + int ShowDropDown( + wxWindow* wnd, + const wxAuiNotebookPageArray& items, + int activeIdx) wxOVERRIDE; + + int GetBestTabCtrlSize(wxWindow* wnd, + const wxAuiNotebookPageArray& pages, + const wxSize& requiredBmpSize) wxOVERRIDE; + +protected: + + wxFont m_normalFont; + wxFont m_selectedFont; + wxFont m_measuringFont; + wxPen m_normalBkPen; + wxPen m_selectedBkPen; + wxBrush m_normalBkBrush; + wxBrush m_selectedBkBrush; + wxBrush m_bkBrush; + wxBitmapBundle m_activeCloseBmp; + wxBitmapBundle m_disabledCloseBmp; + wxBitmapBundle m_activeLeftBmp; + wxBitmapBundle m_disabledLeftBmp; + wxBitmapBundle m_activeRightBmp; + wxBitmapBundle m_disabledRightBmp; + wxBitmapBundle m_activeWindowListBmp; + wxBitmapBundle m_disabledWindowListBmp; + + int m_fixedTabWidth; + unsigned int m_flags; +}; + +#ifndef __WXUNIVERSAL__ + #if defined(__WXGTK20__) && !defined(__WXGTK3__) + #define wxHAS_NATIVE_TABART + #include "wx/aui/tabartgtk.h" + #define wxAuiDefaultTabArt wxAuiGtkTabArt + #elif defined(__WXMSW__) && wxUSE_UXTHEME + #define wxHAS_NATIVE_TABART + #include "wx/aui/tabartmsw.h" + #define wxAuiDefaultTabArt wxAuiMSWTabArt + #endif +#endif // !__WXUNIVERSAL__ + +#ifndef wxHAS_NATIVE_TABART + #define wxAuiDefaultTabArt wxAuiGenericTabArt +#endif + +#endif // wxUSE_AUI + +#endif // _WX_AUI_TABART_H_ diff --git a/lib/wxWidgets/include/wx/aui/tabartgtk.h b/lib/wxWidgets/include/wx/aui/tabartgtk.h new file mode 100644 index 0000000..5ba7a81 --- /dev/null +++ b/lib/wxWidgets/include/wx/aui/tabartgtk.h @@ -0,0 +1,58 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/aui/tabartgtk.h +// Purpose: declaration of the wxAuiGTKTabArt +// Author: Jens Lody and Teodor Petrov +// Modified by: +// Created: 2012-03-23 +// Copyright: (c) 2012 Jens Lody +// and Teodor Petrov +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_AUI_TABARTGTK_H_ +#define _WX_AUI_TABARTGTK_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_AUI + +#include "wx/aui/tabart.h" +#include "wx/gdicmn.h" + +class wxWindow; +class wxDC; + +class WXDLLIMPEXP_AUI wxAuiGtkTabArt : public wxAuiGenericTabArt +{ +public: + wxAuiGtkTabArt(); + + virtual wxAuiTabArt* Clone() wxOVERRIDE; + virtual void DrawBorder(wxDC& dc, wxWindow* wnd, const wxRect& rect) wxOVERRIDE; + virtual void DrawBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect) wxOVERRIDE; + virtual void DrawTab(wxDC& dc, + wxWindow* wnd, + const wxAuiNotebookPage& page, + const wxRect& in_rect, + int close_button_state, + wxRect* out_tab_rect, + wxRect* out_button_rect, + int* x_extent) wxOVERRIDE; + void DrawButton(wxDC& dc, wxWindow* wnd, const wxRect& in_rect, int bitmap_id, + int button_state, int orientation, wxRect* out_rect) wxOVERRIDE; + int GetBestTabCtrlSize(wxWindow* wnd, const wxAuiNotebookPageArray& pages, + const wxSize& required_bmp_size) wxOVERRIDE; + int GetBorderWidth(wxWindow* wnd) wxOVERRIDE; + int GetAdditionalBorderSpace(wxWindow* wnd) wxOVERRIDE; + virtual wxSize GetTabSize(wxDC& dc, wxWindow* wnd, const wxString& caption, + const wxBitmapBundle& bitmap, bool active, + int close_button_state, int* x_extent) wxOVERRIDE; +}; + +#endif // wxUSE_AUI + +#endif // _WX_AUI_TABARTGTK_H_ diff --git a/lib/wxWidgets/include/wx/aui/tabartmsw.h b/lib/wxWidgets/include/wx/aui/tabartmsw.h new file mode 100644 index 0000000..32063af --- /dev/null +++ b/lib/wxWidgets/include/wx/aui/tabartmsw.h @@ -0,0 +1,88 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/aui/tabartmsw.h +// Purpose: wxAuiMSWTabArt declaration +// Author: Tobias Taschner +// Created: 2015-09-26 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_AUI_TABARTMSW_H_ +#define _WX_AUI_TABARTMSW_H_ + +class WXDLLIMPEXP_AUI wxAuiMSWTabArt : public wxAuiGenericTabArt +{ + +public: + + wxAuiMSWTabArt(); + virtual ~wxAuiMSWTabArt(); + + wxAuiTabArt* Clone() wxOVERRIDE; + + void DrawBorder( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + void DrawBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + void DrawTab(wxDC& dc, + wxWindow* wnd, + const wxAuiNotebookPage& pane, + const wxRect& inRect, + int closeButtonState, + wxRect* outTabRect, + wxRect* outButtonRect, + int* xExtent) wxOVERRIDE; + + void DrawButton( + wxDC& dc, + wxWindow* wnd, + const wxRect& inRect, + int bitmapId, + int buttonState, + int orientation, + wxRect* outRect) wxOVERRIDE; + + int GetIndentSize() wxOVERRIDE; + + int GetBorderWidth( + wxWindow* wnd) wxOVERRIDE; + + int GetAdditionalBorderSpace( + wxWindow* wnd) wxOVERRIDE; + + wxSize GetTabSize( + wxDC& dc, + wxWindow* wnd, + const wxString& caption, + const wxBitmapBundle& bitmap, + bool active, + int closeButtonState, + int* xExtent) wxOVERRIDE; + + int ShowDropDown( + wxWindow* wnd, + const wxAuiNotebookPageArray& items, + int activeIdx) wxOVERRIDE; + + int GetBestTabCtrlSize(wxWindow* wnd, + const wxAuiNotebookPageArray& pages, + const wxSize& requiredBmpSize) wxOVERRIDE; + +private: + bool m_themed; + wxSize m_closeBtnSize; + wxSize m_tabSize; + int m_maxTabHeight; + + void InitSizes(wxWindow* wnd, wxDC& dc); + + bool IsThemed() const; +}; + +#endif // _WX_AUI_TABARTMSW_H_ diff --git a/lib/wxWidgets/include/wx/aui/tabmdi.h b/lib/wxWidgets/include/wx/aui/tabmdi.h new file mode 100644 index 0000000..a8ee5d3 --- /dev/null +++ b/lib/wxWidgets/include/wx/aui/tabmdi.h @@ -0,0 +1,221 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/aui/tabmdi.h +// Purpose: Generic MDI (Multiple Document Interface) classes +// Author: Hans Van Leemputten +// Modified by: Benjamin I. Williams / Kirix Corporation +// Created: 29/07/2002 +// Copyright: (c) Hans Van Leemputten +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_AUITABMDI_H_ +#define _WX_AUITABMDI_H_ + +#if wxUSE_AUI && wxUSE_MDI + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/frame.h" +#include "wx/panel.h" +#include "wx/notebook.h" +#include "wx/icon.h" +#include "wx/mdi.h" +#include "wx/aui/auibook.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_AUI wxAuiMDIParentFrame; +class WXDLLIMPEXP_FWD_AUI wxAuiMDIClientWindow; +class WXDLLIMPEXP_FWD_AUI wxAuiMDIChildFrame; + +//----------------------------------------------------------------------------- +// wxAuiMDIParentFrame +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_AUI wxAuiMDIParentFrame : public wxFrame +{ +public: + wxAuiMDIParentFrame(); + wxAuiMDIParentFrame(wxWindow *parent, + wxWindowID winid, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + ~wxAuiMDIParentFrame(); + + bool Create(wxWindow *parent, + wxWindowID winid, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxASCII_STR(wxFrameNameStr) ); + + void SetArtProvider(wxAuiTabArt* provider); + wxAuiTabArt* GetArtProvider(); + wxAuiNotebook* GetNotebook() const; + +#if wxUSE_MENUS + wxMenu* GetWindowMenu() const { return m_pWindowMenu; } + void SetWindowMenu(wxMenu* pMenu); + + virtual void SetMenuBar(wxMenuBar *pMenuBar) wxOVERRIDE; +#endif // wxUSE_MENUS + + void SetChildMenuBar(wxAuiMDIChildFrame *pChild); + + wxAuiMDIChildFrame *GetActiveChild() const; + void SetActiveChild(wxAuiMDIChildFrame* pChildFrame); + + wxAuiMDIClientWindow *GetClientWindow() const; + virtual wxAuiMDIClientWindow *OnCreateClient(); + + virtual void Cascade() { /* Has no effect */ } + virtual void Tile(wxOrientation orient = wxHORIZONTAL); + virtual void ArrangeIcons() { /* Has no effect */ } + virtual void ActivateNext(); + virtual void ActivatePrevious(); + +protected: + wxAuiMDIClientWindow* m_pClientWindow; + wxEvent* m_pLastEvt; + +#if wxUSE_MENUS + wxMenu *m_pWindowMenu; + wxMenuBar *m_pMyMenuBar; +#endif // wxUSE_MENUS + +protected: + void Init(); + +#if wxUSE_MENUS + void RemoveWindowMenu(wxMenuBar *pMenuBar); + void AddWindowMenu(wxMenuBar *pMenuBar); + + void DoHandleMenu(wxCommandEvent &event); + void DoHandleUpdateUI(wxUpdateUIEvent &event); +#endif // wxUSE_MENUS + + virtual bool ProcessEvent(wxEvent& event) wxOVERRIDE; + + virtual void DoGetClientSize(int *width, int *height) const wxOVERRIDE; + +private: + void OnClose(wxCloseEvent& event); + + // close all children, return false if any of them vetoed it + bool CloseAll(); + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxAuiMDIParentFrame); +}; + +//----------------------------------------------------------------------------- +// wxAuiMDIChildFrame +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_AUI wxAuiMDIChildFrame : public wxTDIChildFrame +{ +public: + wxAuiMDIChildFrame(); + wxAuiMDIChildFrame(wxAuiMDIParentFrame *parent, + wxWindowID winid, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + virtual ~wxAuiMDIChildFrame(); + bool Create(wxAuiMDIParentFrame *parent, + wxWindowID winid, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + +#if wxUSE_MENUS + virtual void SetMenuBar(wxMenuBar *menuBar) wxOVERRIDE; + virtual wxMenuBar *GetMenuBar() const wxOVERRIDE; +#endif // wxUSE_MENUS + + virtual void SetTitle(const wxString& title) wxOVERRIDE; + + virtual void SetIcons(const wxIconBundle& icons) wxOVERRIDE; + + virtual void Activate() wxOVERRIDE; + virtual bool Destroy() wxOVERRIDE; + + virtual bool Show(bool show = true) wxOVERRIDE; + + void OnMenuHighlight(wxMenuEvent& evt); + + void SetMDIParentFrame(wxAuiMDIParentFrame* parent); + wxAuiMDIParentFrame* GetMDIParentFrame() const; + +protected: + void Init(); + +public: + // This function needs to be called when a size change is confirmed, + // we needed this function to prevent anybody from the outside + // changing the panel... it messes the UI layout when we would allow it. + void ApplyMDIChildFrameRect(); + +protected: + wxAuiMDIParentFrame* m_pMDIParentFrame; + bool m_activateOnCreate; + +#if wxUSE_MENUS + wxMenuBar* m_pMenuBar; +#endif // wxUSE_MENUS + + + +private: + wxDECLARE_DYNAMIC_CLASS(wxAuiMDIChildFrame); + wxDECLARE_EVENT_TABLE(); + + friend class wxAuiMDIClientWindow; +}; + +//----------------------------------------------------------------------------- +// wxAuiMDIClientWindow +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_AUI wxAuiMDIClientWindow : public wxAuiNotebook +{ +public: + wxAuiMDIClientWindow(); + wxAuiMDIClientWindow(wxAuiMDIParentFrame *parent, long style = 0); + + virtual bool CreateClient(wxAuiMDIParentFrame *parent, + long style = wxVSCROLL | wxHSCROLL); + + virtual wxAuiMDIChildFrame* GetActiveChild(); + virtual void SetActiveChild(wxAuiMDIChildFrame* pChildFrame) + { + SetSelection(GetPageIndex(pChildFrame)); + } + +protected: + + void PageChanged(int oldSelection, int newSelection); + void OnPageClose(wxAuiNotebookEvent& evt); + void OnPageChanged(wxAuiNotebookEvent& evt); + +private: + wxDECLARE_DYNAMIC_CLASS(wxAuiMDIClientWindow); + wxDECLARE_EVENT_TABLE(); +}; +#endif // wxUSE_AUI && wxUSE_MDI + +#endif // _WX_AUITABMDI_H_ diff --git a/lib/wxWidgets/include/wx/bannerwindow.h b/lib/wxWidgets/include/wx/bannerwindow.h new file mode 100644 index 0000000..6c9ac86 --- /dev/null +++ b/lib/wxWidgets/include/wx/bannerwindow.h @@ -0,0 +1,143 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/bannerwindow.h +// Purpose: wxBannerWindow class declaration +// Author: Vadim Zeitlin +// Created: 2011-08-16 +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BANNERWINDOW_H_ +#define _WX_BANNERWINDOW_H_ + +#include "wx/defs.h" + +#if wxUSE_BANNERWINDOW + +#include "wx/bmpbndl.h" +#include "wx/event.h" +#include "wx/window.h" + +class WXDLLIMPEXP_FWD_CORE wxColour; +class WXDLLIMPEXP_FWD_CORE wxDC; + +extern WXDLLIMPEXP_DATA_CORE(const char) wxBannerWindowNameStr[]; + +// ---------------------------------------------------------------------------- +// A simple banner window showing either a bitmap or text. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE 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 = wxASCII_STR(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 = wxASCII_STR(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 wxBitmapBundle& 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 wxOVERRIDE; + +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. + wxBitmapBundle m_bitmapBundle; + + // 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_ diff --git a/lib/wxWidgets/include/wx/base64.h b/lib/wxWidgets/include/wx/base64.h new file mode 100644 index 0000000..e682757 --- /dev/null +++ b/lib/wxWidgets/include/wx/base64.h @@ -0,0 +1,123 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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_ + +#include "wx/defs.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 wxASCII_STR(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_ diff --git a/lib/wxWidgets/include/wx/beforestd.h b/lib/wxWidgets/include/wx/beforestd.h new file mode 100644 index 0000000..6a2550b --- /dev/null +++ b/lib/wxWidgets/include/wx/beforestd.h @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/beforestd.h +// Purpose: #include before STL headers +// Author: Vadim Zeitlin +// Modified by: +// Created: 07/07/03 +// Copyright: (c) 2003 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +/** + Unfortunately, when compiling at maximum warning level, the standard + headers themselves may generate warnings -- and really lots of them. So + before including them, this header should be included to temporarily + suppress the warnings and after this the header afterstd.h should be + included to enable them back again. + + Note that there are intentionally no inclusion guards in this file, because + it can be included several times. + */ + +#if defined(__VISUALC__) && __VISUALC__ >= 1910 + #pragma warning(push, 1) + + // This warning, given when a malloc.h from 10.0.240.0 version of UCRT, + // which is used when building projects targeting 8.1 SDK, compiled by MSVS + // 2017 or later, is still given even at warning level 1, in spite of it + // being level 4, so we have to explicitly disable it here (as we do it + // after the warning push pragma, it will be restored after pop). + // + // expression before comma has no effect; expected expression with side-effect + #pragma warning(disable:4548) +#endif // VC++ >= 14.1 + +/** + 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(HAVE_VISIBILITY) && defined(HAVE_BROKEN_LIBSTDCXX_VISIBILITY) + #pragma GCC visibility push(default) +#endif diff --git a/lib/wxWidgets/include/wx/bitmap.h b/lib/wxWidgets/include/wx/bitmap.h new file mode 100644 index 0000000..b5960c5 --- /dev/null +++ b/lib/wxWidgets/include/wx/bitmap.h @@ -0,0 +1,362 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/bitmap.h +// Purpose: wxBitmap class interface +// Author: Vaclav Slavik +// Modified by: +// Created: 22.04.01 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BITMAP_H_BASE_ +#define _WX_BITMAP_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#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 wxCursor; +class WXDLLIMPEXP_FWD_CORE wxDC; +class WXDLLIMPEXP_FWD_CORE wxIcon; +class WXDLLIMPEXP_FWD_CORE wxMask; +class WXDLLIMPEXP_FWD_CORE wxPalette; +class WXDLLIMPEXP_FWD_CORE wxPixelDataBase; + +// ---------------------------------------------------------------------------- +// wxVariant support +// ---------------------------------------------------------------------------- + +#if wxUSE_VARIANT +#include "wx/variant.h" +DECLARE_VARIANT_OBJECT_EXPORTED(wxBitmap,WXDLLIMPEXP_CORE) +#endif + +// ---------------------------------------------------------------------------- +// wxMask represents the transparent area of the bitmap +// ---------------------------------------------------------------------------- + +// 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 + bool Create(const wxBitmap& bitmap, const wxColour& colour); + +#if wxUSE_PALETTE + // create the mask from bitmap pixels with the given palette index + bool Create(const wxBitmap& bitmap, int paletteIndex); +#endif // wxUSE_PALETTE + + // create the mask from the given mono bitmap + bool Create(const wxBitmap& bitmap); + +protected: + // this function is called from Create() to free the existing mask data + virtual void FreeData() = 0; + + // these functions must be overridden to implement the corresponding public + // Create() methods, they shouldn't call FreeData() as it's already called + // by the public wrappers + virtual bool InitFromColour(const wxBitmap& bitmap, + const wxColour& colour) = 0; + virtual bool InitFromMonoBitmap(const wxBitmap& bitmap) = 0; +}; + +#if defined(__WXDFB__) || \ + defined(__WXMAC__) || \ + defined(__WXGTK__) || \ + defined(__WXMOTIF__) || \ + defined(__WXX11__) || \ + defined(__WXQT__) + #define wxUSE_BITMAP_BASE 1 +#else + #define wxUSE_BITMAP_BASE 0 +#endif + +// 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); + + // Rescale the given bitmap to the requested size. + static void Rescale(wxBitmap& bmp, const wxSize& sizeNeeded); +}; + + +// All ports except wxMSW use wxBitmapHandler and wxBitmapBase as +// base class for wxBitmapHandler; wxMSW uses wxGDIImageHandler as +// base class since it allows some code reuse there. +#if wxUSE_BITMAP_BASE + +// ---------------------------------------------------------------------------- +// wxBitmapHandler: class which knows how to create/load/save bitmaps in +// different formats +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBitmapHandler : public wxObject +{ +public: + wxBitmapHandler() { m_type = wxBITMAP_TYPE_INVALID; } + virtual ~wxBitmapHandler() { } + + // 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; } + void SetType(wxBitmapType type) { m_type = type; } + const wxString& GetName() const { return m_name; } + const wxString& GetExtension() const { return m_extension; } + wxBitmapType GetType() const { return m_type; } + +private: + wxString m_name; + wxString m_extension; + wxBitmapType m_type; + + wxDECLARE_ABSTRACT_CLASS(wxBitmapHandler); +}; + +// ---------------------------------------------------------------------------- +// 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(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 = wxBITMAP_SCREEN_DEPTH, double scale = 1.0); + + static void InitStandardHandlers(); + */ + + 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; + + bool CreateWithDIPSize(const wxSize& sz, + double scale, + int depth = wxBITMAP_SCREEN_DEPTH) + { return DoCreate(sz, scale, depth); } + bool CreateWithDIPSize(int width, int height, + double scale, + int depth = wxBITMAP_SCREEN_DEPTH) + { return DoCreate(wxSize(width, height), scale, depth); } + + virtual int GetHeight() const = 0; + virtual int GetWidth() const = 0; + virtual int GetDepth() const = 0; + + wxSize GetSize() const + { return wxSize(GetWidth(), GetHeight()); } + + // Store or return the scale factor, which determines the ratio between the + // bitmap physical size and its DIP size (on all platforms). By default + // it's just 1. + virtual void SetScaleFactor(double scale); + virtual double GetScaleFactor() const; + + // This function returns the size divided by the scale factor, so that a + // 64x64 bitmap with a scale factor of 2 has DIP size of 32x32 everywhere. + wxSize GetDIPSize() const; + + // These functions return the corresponding metrics divided by the scale + // factor on platforms with DPI-independent pixels (e.g. GTK, Mac) and just + // return the same thing as normal accessors elsewhere (e.g. MSW). + double GetLogicalWidth() const; + double GetLogicalHeight() const; + wxSize GetLogicalSize() const; + + // Old synonyms for CreateWithDIPSize() and GetLogicalXXX() functions, + // prefer the new names in the new code. + bool CreateScaled(int w, int h, int d, double logicalScale) + { return CreateWithDIPSize(w, h, logicalScale, d); } + double GetScaledWidth() const { return GetLogicalWidth(); } + double GetScaledHeight() const { return GetLogicalHeight(); } + wxSize GetScaledSize() const { return GetLogicalSize(); } + +#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 = NULL) const = 0; + virtual bool LoadFile(const wxString &name, wxBitmapType type) = 0; + + /* + If raw bitmap access is supported (see wx/rawbmp.h), the following + methods should be implemented: + + virtual bool GetRawData(wxRawBitmapData *data) = 0; + virtual void UngetRawData(wxRawBitmapData *data) = 0; + */ + +#if wxUSE_PALETTE + virtual wxPalette *GetPalette() const = 0; + virtual void SetPalette(const wxPalette& palette) = 0; +#endif // wxUSE_PALETTE + + // Alpha support for 32bpp bitmaps: check if it's used, request that it be + // used or not. + virtual bool HasAlpha() const; + virtual bool UseAlpha(bool use = true); + void ResetAlpha() { UseAlpha(false); } + + // copies the contents and mask of the given (colour) icon to the bitmap + bool CopyFromIcon(const wxIcon& icon); + + // implementation: +#if WXWIN_COMPATIBILITY_3_0 + // deprecated + virtual void SetHeight(int height) = 0; + virtual void SetWidth(int width) = 0; + virtual void SetDepth(int depth) = 0; +#endif + + // Format handling + static inline wxList& GetHandlers() { return sm_handlers; } + 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); + static wxBitmapHandler *FindHandler(wxBitmapType bitmapType); + + //static void InitStandardHandlers(); + // (wxBitmap must implement this one) + + static void CleanUpHandlers(); + + // this method is only used by the generic implementation of wxMask + // currently but could be useful elsewhere in the future: it can be + // overridden to quantize the colour to correspond to bitmap colour depth + // if necessary; default implementation simply returns the colour as is + virtual wxColour QuantizeColour(const wxColour& colour) const + { + return colour; + } + +protected: + virtual bool DoCreate(const wxSize& sz, double scale, int depth); + + static wxList sm_handlers; + + wxDECLARE_ABSTRACT_CLASS(wxBitmapBase); +}; + +#endif // wxUSE_BITMAP_BASE + + +// 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(__WXDFB__) + #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_BMP_RESOURCE + #include "wx/dfb/bitmap.h" +#elif defined(__WXMAC__) + #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_PICT_RESOURCE + #include "wx/osx/bitmap.h" +#elif defined(__WXQT__) + #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_XPM + #include "wx/qt/bitmap.h" +#endif + +#if wxUSE_IMAGE +inline +wxBitmap +#if wxUSE_BITMAP_BASE +wxBitmapBase:: +#else +wxBitmap:: +#endif +ConvertToDisabled(unsigned char brightness) const +{ + const wxImage imgDisabled = ConvertToImage().ConvertToDisabled(brightness); + return wxBitmap(imgDisabled, -1, GetScaleFactor()); +} +#endif // wxUSE_IMAGE + +// we must include generic mask.h after wxBitmap definition +#if defined(__WXDFB__) + #define wxUSE_GENERIC_MASK 1 +#else + #define wxUSE_GENERIC_MASK 0 +#endif + +#if wxUSE_GENERIC_MASK + #include "wx/generic/mask.h" +#endif + +#endif // _WX_BITMAP_H_BASE_ diff --git a/lib/wxWidgets/include/wx/bmpbndl.h b/lib/wxWidgets/include/wx/bmpbndl.h new file mode 100644 index 0000000..d099fb7 --- /dev/null +++ b/lib/wxWidgets/include/wx/bmpbndl.h @@ -0,0 +1,292 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/bmpbndl.h +// Purpose: Declaration of wxBitmapBundle class. +// Author: Vadim Zeitlin +// Created: 2021-09-22 +// Copyright: (c) 2021 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BMPBNDL_H_ +#define _WX_BMPBNDL_H_ + +#include "wx/bitmap.h" +#include "wx/object.h" +#include "wx/vector.h" + +class wxBitmapBundleImpl; +class WXDLLIMPEXP_FWD_CORE wxIconBundle; +class WXDLLIMPEXP_FWD_CORE wxImageList; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +// ---------------------------------------------------------------------------- +// wxBitmapBundle provides 1 or more versions of a bitmap, all bundled together +// ---------------------------------------------------------------------------- + +// This class has value semantics and can be copied cheaply. + +class WXDLLIMPEXP_CORE wxBitmapBundle +{ +public: + // Default ctor constructs an empty bundle which can't be used for + // anything, but can be assigned something later. + wxBitmapBundle(); + + // This conversion ctor from a single bitmap does the same thing as + // FromBitmap() and only exists for interoperability with the existing code + // using wxBitmap. + wxBitmapBundle(const wxBitmap& bitmap); + + // This is similar to above and also exists only for compatibility. + wxBitmapBundle(const wxIcon& icon); + + // Another conversion ctor from a single image: this one is needed to allow + // passing wxImage to the functions that used to take wxBitmap but now take + // wxBitmapBundle. + wxBitmapBundle(const wxImage& image); + + // And another one from XPM data, as it's relatively common to pass it to + // various functions that take wxBitmapBundle in the existing code. It is + // not formally deprecated, but should be avoided in any new code and can + // become deprecated in the future. + wxBitmapBundle(const char* const* xpm); + + // Default copy ctor and assignment operator and dtor would be ok, but need + // to be defined out of line, where wxBitmapBundleImpl is fully declared. + + wxBitmapBundle(const wxBitmapBundle& other); + wxBitmapBundle& operator=(const wxBitmapBundle& other); + + ~wxBitmapBundle(); + + + // Create from the given collection of bitmaps (all of which must be valid, + // but if the vector itself is empty, empty bundle is returned). + static wxBitmapBundle FromBitmaps(const wxVector& bitmaps); + static wxBitmapBundle FromBitmaps(const wxBitmap& bitmap1, + const wxBitmap& bitmap2); + + // Create from a single bitmap (this is only useful for compatibility + // with the existing code). Returns empty bundle if bitmap is invalid. + static wxBitmapBundle FromBitmap(const wxBitmap& bitmap); + static wxBitmapBundle FromImage(const wxImage& image); + + // Create from icon bundle. + static wxBitmapBundle FromIconBundle(const wxIconBundle& iconBundle); + + // It should be possible to implement SVG rasterizing without raw bitmap + // support using wxDC::DrawSpline(), but currently we don't do it and so + // FromSVG() is only available in the ports providing raw bitmap access. +#ifdef wxHAS_SVG + // Create from the SVG data (data is supposed to be in UTF-8 encoding). + // Notice that the data here is non-const because it can be temporarily + // modified while parsing it. + static wxBitmapBundle FromSVG(char* data, const wxSize& sizeDef); + + // This overload currently makes a copy of the data. + static wxBitmapBundle FromSVG(const char* data, const wxSize& sizeDef); + + // This overload works for data not terminated with 0 + static wxBitmapBundle FromSVG(const wxByte* data, size_t len, const wxSize& sizeDef); + + // Load SVG image from the given file (must be a local file, not an URL). + static wxBitmapBundle FromSVGFile(const wxString& path, const wxSize& sizeDef); + + // Create from SVG image stored as an application resource. + // On Windows, name must be a resource with RT_RCDATA type. + // On MacOS, name must be a file with an extension "svg" placed in the + // "Resources" subdirectory of the application bundle. + static wxBitmapBundle FromSVGResource(const wxString& name, const wxSize& sizeDef); +#endif // wxHAS_SVG + + // Create from the resources: all existing versions of the bitmap of the + // form name_2x or name@2x (and also using other factors) will be used. + static wxBitmapBundle FromResources(const wxString& name); + + // Create from files: all existing versions of the bitmap of the + // form filename_2x or name@2x (and also using other factors) will be used. + static wxBitmapBundle FromFiles(const wxString& fullpathname); + static wxBitmapBundle FromFiles(const wxString& path, const wxString& filename, const wxString& extension = wxASCII_STR("png")); + + // Create from existing implementation + static wxBitmapBundle FromImpl(wxBitmapBundleImpl* impl); + + // Check if bitmap bundle is non-empty. + bool IsOk() const { return m_impl.get() != NULL; } + + // Clear the bundle contents, IsOk() will return false after doing this. + void Clear(); + + // Get the size of the bitmap represented by this bundle when using the + // default DPI, i.e. 100% scaling. Returns invalid size for empty bundle. + wxSize GetDefaultSize() const; + + // Get the physical size of the preferred bitmap at the given scale. + wxSize GetPreferredBitmapSizeAtScale(double scale) const; + + // Get preferred size, i.e. usually the closest size in which a bitmap is + // available to the ideal size determined from the default size and the DPI + // scaling, for the given window, in physical/logical pixels respectively. + wxSize GetPreferredBitmapSizeFor(const wxWindow* window) const; + wxSize GetPreferredLogicalSizeFor(const wxWindow* window) const; + + // Get bitmap of the specified size, creating a new bitmap from the closest + // available size by rescaling it if necessary. + // + // If size == wxDefaultSize, GetDefaultSize() is used for it instead. + wxBitmap GetBitmap(const wxSize& size) const; + + // Get icon of the specified size, this is just a convenient wrapper for + // GetBitmap() converting the returned bitmap to the icon. + wxIcon GetIcon(const wxSize& size) const; + + // Helpers combining GetPreferredBitmapSizeFor() and GetBitmap() or + // GetIcon(): return the bitmap or icon of the size appropriate for the + // current DPI scaling of the given window. + wxBitmap GetBitmapFor(const wxWindow* window) const; + wxIcon GetIconFor(const wxWindow* window) const; + + // Access implementation + wxBitmapBundleImpl* GetImpl() const { return m_impl.get(); } + + // Check if two objects refer to the same bundle. + bool IsSameAs(const wxBitmapBundle& other) const + { + return GetImpl() == other.GetImpl(); + } + + // Implementation only from now on. + + // Get the bitmap size preferred by the majority of the elements of the + // bundles at the given scale or the scale appropriate for the given window. + static wxSize + GetConsensusSizeFor(double scale, const wxVector& bundles); + static wxSize + GetConsensusSizeFor(wxWindow* win, const wxVector& bundles); + + // Create wxImageList and fill it with the images from the given bundles in + // the sizes appropriate for the DPI scaling used for the specified window. + static wxImageList* + CreateImageList(wxWindow* win, const wxVector& bundles); + +private: + typedef wxObjectDataPtr wxBitmapBundleImplPtr; + + // Private ctor used by static factory functions to create objects of this + // class. It takes ownership of the pointer (which must be non-null). + explicit wxBitmapBundle(wxBitmapBundleImpl* impl); + + wxBitmapBundleImplPtr m_impl; +}; + +// This macro can be used to create a bundle from resources on the platforms +// that support it and from name_png and name_2x_png on the other ones. +#ifdef wxHAS_IMAGE_RESOURCES + #define wxBITMAP_BUNDLE_2(name) wxBitmapBundle::FromResources(#name) +#else + #define wxBITMAP_BUNDLE_2(name) \ + wxBitmapBundle::FromBitmaps(wxBITMAP_PNG_FROM_DATA(name), \ + wxBITMAP_PNG_FROM_DATA(name##_2x)) +#endif + +// Inline functions implementation. + +/* static */ inline +wxBitmapBundle wxBitmapBundle::FromBitmaps(const wxBitmap& bitmap1, + const wxBitmap& bitmap2) +{ + wxVector bitmaps; + if ( bitmap1.IsOk() ) + bitmaps.push_back(bitmap1); + if ( bitmap2.IsOk() ) + bitmaps.push_back(bitmap2); + return FromBitmaps(bitmaps); +} + +/* static */ inline +wxBitmapBundle wxBitmapBundle::FromBitmap(const wxBitmap& bitmap) +{ + return wxBitmapBundle(bitmap); +} + +/* static */ inline +wxBitmapBundle wxBitmapBundle::FromImage(const wxImage& image) +{ + if ( !image.IsOk() ) + return wxBitmapBundle(); + + return FromBitmap(wxBitmap(image)); +} + +// ---------------------------------------------------------------------------- +// wxBitmapBundleImpl is the base class for all wxBitmapBundle implementations +// ---------------------------------------------------------------------------- + +// This class inherits from wxRefCounter to make it possible to use it with +// wxObjectDataPtr in wxBitmapBundle. +// +// It doesn't need to be used directly, but may be inherited from in order to +// implement custom bitmap bundles. +class WXDLLIMPEXP_CORE wxBitmapBundleImpl : public wxRefCounter +{ +protected: + // Standard implementation of GetPreferredBitmapSizeAtScale(): choose the + // scale closest to the given one from the available bitmap scales. + // + // If this function is used, GetNextAvailableScale() must be overridden! + wxSize DoGetPreferredSize(double scale) const; + + // Helper for implementing GetBitmap(): if we need to upscale a bitmap, + // uses GetNextAvailableScale() to find the index of the best bitmap to + // use, where "best" is defined as "using scale which is a divisor of the + // given one", as upscaling by an integer factor is strongly preferable. + size_t GetIndexToUpscale(const wxSize& size) const; + + // Override this function if DoGetPreferredSize() or GetIndexToUpscale() is + // used: it can use the provided parameter as an internal index, it's + // guaranteed to be 0 when calling this function for the first time. When + // there are no more scales, return 0. + // + // This function is not pure virtual because it doesn't need to be + // implemented if DoGetPreferredSize() is never used, but it will assert if + // it's called. + virtual double GetNextAvailableScale(size_t& i) const; + + + virtual ~wxBitmapBundleImpl(); + +public: + // Return the size of the bitmaps represented by this bundle in the default + // DPI (a.k.a. 100% resolution). + // + // Must always return a valid size. + virtual wxSize GetDefaultSize() const = 0; + + // Return the preferred size that should be used at the given scale. + // + // Must always return a valid size. + virtual wxSize GetPreferredBitmapSizeAtScale(double scale) const = 0; + + // Retrieve the bitmap of exactly the given size. + // + // Note that this function is non-const because it may generate the bitmap + // on demand and cache it. + virtual wxBitmap GetBitmap(const wxSize& size) = 0; +}; + +// ---------------------------------------------------------------------------- +// Allow using wxBitmapBundle in wxVariant +// ---------------------------------------------------------------------------- + +#if wxUSE_VARIANT + +class WXDLLIMPEXP_FWD_BASE wxVariant; + +WXDLLIMPEXP_CORE +wxBitmapBundle& operator<<(wxBitmapBundle& value, const wxVariant& variant); +WXDLLIMPEXP_CORE +wxVariant& operator<<(wxVariant& variant, const wxBitmapBundle& value); + +#endif // wxUSE_VARIANT + +#endif // _WX_BMPBNDL_H_ diff --git a/lib/wxWidgets/include/wx/bmpbuttn.h b/lib/wxWidgets/include/wx/bmpbuttn.h new file mode 100644 index 0000000..c7bc9af --- /dev/null +++ b/lib/wxWidgets/include/wx/bmpbuttn.h @@ -0,0 +1,147 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/bmpbuttn.h +// Purpose: wxBitmapButton class interface +// Author: Vadim Zeitlin +// Modified by: +// Created: 25.08.00 +// Copyright: (c) 2000 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BMPBUTTON_H_BASE_ +#define _WX_BMPBUTTON_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_BMPBUTTON + +#include "wx/button.h" + +// FIXME: right now only wxMSW, wxGTK and wxOSX implement bitmap support in wxButton +// itself, this shouldn't be used for the other platforms either +// when all of them do it +#if (defined(__WXMSW__) || defined(__WXGTK20__) || defined(__WXOSX__) || defined(__WXQT__)) && !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 WXDLLIMPEXP_CORE wxBitmapButtonBase : public wxButton +{ +public: + wxBitmapButtonBase() + { +#ifndef wxHAS_BUTTON_BITMAP + m_marginX = + m_marginY = 0; +#endif // wxHAS_BUTTON_BITMAP + } + + 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, wxString(), + pos, size, + style | wxBU_NOTEXT | wxBU_EXACTFIT, + validator, name); + } + + /* + Derived classes also need to declare, but not define, as it's done in + common code in bmpbtncmn.cpp, the following function: + + bool CreateCloseButton(wxWindow* parent, + wxWindowID winid, + const wxString& name = wxString()); + + which is used by NewCloseButton(), and, as Create(), must be + called on default-constructed wxBitmapButton object. + */ + + // Special creation function for a standard "Close" bitmap. It allows to + // simply create a close button with the image appropriate for the current + // platform. + static wxBitmapButton* + NewCloseButton(wxWindow* parent, + wxWindowID winid, + const wxString& name = wxString()); + + // set/get the margins around the button + virtual void SetMargins(int x, int y) + { + DoSetBitmapMargins(x, y); + } + + int GetMarginX() const { return DoGetBitmapMargins().x; } + int GetMarginY() const { return DoGetBitmapMargins().y; } + +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].GetBitmap(wxDefaultSize); } + virtual void DoSetBitmap(const wxBitmapBundle& 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 bitmap bundles for various states + wxBitmapBundle m_bitmaps[State_Max]; + + // the margins around the bitmap + int m_marginX, + m_marginY; +#endif // !wxHAS_BUTTON_BITMAP + + wxDECLARE_NO_COPY_CLASS(wxBitmapButtonBase); +}; + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/bmpbuttn.h" +#elif defined(__WXMSW__) + #include "wx/msw/bmpbuttn.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/bmpbuttn.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/bmpbuttn.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/bmpbuttn.h" +#elif defined(__WXMAC__) + #include "wx/osx/bmpbuttn.h" +#elif defined(__WXQT__) + #include "wx/qt/bmpbuttn.h" +#endif + +#endif // wxUSE_BMPBUTTON + +#endif // _WX_BMPBUTTON_H_BASE_ diff --git a/lib/wxWidgets/include/wx/bmpcbox.h b/lib/wxWidgets/include/wx/bmpcbox.h new file mode 100644 index 0000000..e380660 --- /dev/null +++ b/lib/wxWidgets/include/wx/bmpcbox.h @@ -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/bmpbndl.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_CORE(const char) wxBitmapComboBoxNameStr[]; + + +class WXDLLIMPEXP_CORE wxBitmapComboBoxBase +{ +public: + // ctors and such + wxBitmapComboBoxBase() { Init(); } + + virtual ~wxBitmapComboBoxBase() { } + + // Sets the image for the given item. + virtual void SetItemBitmap(unsigned int n, const wxBitmapBundle& 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 wxBitmapBundle& 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 wxBitmapBundle& 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(); + + wxVector m_bitmapbundles;// 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_ diff --git a/lib/wxWidgets/include/wx/bookctrl.h b/lib/wxWidgets/include/wx/bookctrl.h new file mode 100644 index 0000000..33bf614 --- /dev/null +++ b/lib/wxWidgets/include/wx/bookctrl.h @@ -0,0 +1,455 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/bookctrl.h +// Purpose: wxBookCtrlBase: common base class for wxList/Tree/Notebook +// Author: Vadim Zeitlin +// Modified by: +// Created: 19.08.03 +// Copyright: (c) 2003 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BOOKCTRL_H_ +#define _WX_BOOKCTRL_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_BOOKCTRL + +#include "wx/control.h" +#include "wx/vector.h" +#include "wx/withimages.h" + +class WXDLLIMPEXP_FWD_CORE wxImageList; +class WXDLLIMPEXP_FWD_CORE wxBookCtrlEvent; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// wxBookCtrl hit results +enum +{ + wxBK_HITTEST_NOWHERE = 1, // not on tab + wxBK_HITTEST_ONICON = 2, // on icon + wxBK_HITTEST_ONLABEL = 4, // on label + wxBK_HITTEST_ONITEM = 16, // on tab control but not on its icon or label + wxBK_HITTEST_ONPAGE = 8 // not on tab control, but over the selected page +}; + +// wxBookCtrl flags (common for wxNotebook, wxListbook, wxChoicebook, wxTreebook) +#define wxBK_DEFAULT 0x0000 +#define wxBK_TOP 0x0010 +#define wxBK_BOTTOM 0x0020 +#define wxBK_LEFT 0x0040 +#define wxBK_RIGHT 0x0080 +#define wxBK_ALIGN_MASK (wxBK_TOP | wxBK_BOTTOM | wxBK_LEFT | wxBK_RIGHT) + +// ---------------------------------------------------------------------------- +// wxBookCtrlBase +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBookCtrlBase : public wxControl, + public wxWithImages +{ +public: + // construction + // ------------ + + wxBookCtrlBase() + { + Init(); + } + + wxBookCtrlBase(wxWindow *parent, + wxWindowID winid, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxEmptyString) + { + Init(); + + (void)Create(parent, winid, pos, size, style, name); + } + + // quasi ctor + bool Create(wxWindow *parent, + wxWindowID winid, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxEmptyString); + + + // accessors + // --------- + + // get number of pages in the dialog + virtual size_t GetPageCount() const { return m_pages.size(); } + + // get the panel which represents the given page + virtual wxWindow *GetPage(size_t n) const { return m_pages.at(n); } + + // get the current page or NULL if none + wxWindow *GetCurrentPage() const + { + const int n = GetSelection(); + return n == wxNOT_FOUND ? NULL : GetPage(n); + } + + // get the currently selected page or wxNOT_FOUND if none + virtual int GetSelection() const { return m_selection; } + + // set/get the title of a page + virtual bool SetPageText(size_t n, const wxString& strText) = 0; + virtual wxString GetPageText(size_t n) const = 0; + + + // image list stuff: each page may have an image associated with it (all + // images belong to the same image list) + // --------------------------------------------------------------------- + + // 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; + + + // geometry + // -------- + + // 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 + // + // 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; } + void SetInternalBorder(unsigned int border) { m_internalBorder = border; } + + // Sets/gets the margin around the controller + void SetControlMargin(int margin) { m_controlMargin = margin; } + int GetControlMargin() const { return m_controlMargin; } + + // returns true if we have wxBK_TOP or wxBK_BOTTOM style + bool IsVertical() const { return HasFlag(wxBK_BOTTOM | wxBK_TOP); } + + // set/get option to shrink to fit current page + void SetFitToCurrentPage(bool fit) { m_fitToCurrentPage = fit; } + bool GetFitToCurrentPage() const { return m_fitToCurrentPage; } + + // returns the sizer containing the control, if any + wxSizer* GetControlSizer() const { return m_controlSizer; } + + + // operations + // ---------- + + // remove one page from the control and delete it + virtual bool DeletePage(size_t n); + + // remove one page from the notebook, without deleting it + virtual bool RemovePage(size_t n) + { + DoInvalidateBestSize(); + return DoRemovePage(n) != NULL; + } + + // remove all pages and delete them + virtual bool DeleteAllPages() + { + m_selection = wxNOT_FOUND; + DoInvalidateBestSize(); + WX_CLEAR_ARRAY(m_pages); + return true; + } + + // adds a new page to the control + virtual bool AddPage(wxWindow *page, + const wxString& text, + bool bSelect = false, + int imageId = NO_IMAGE) + { + DoInvalidateBestSize(); + return InsertPage(GetPageCount(), page, text, bSelect, imageId); + } + + // the same as AddPage(), but adds the page at the specified position + virtual bool InsertPage(size_t n, + wxWindow *page, + const wxString& text, + bool bSelect = false, + int imageId = NO_IMAGE) = 0; + + // set the currently selected page, return the index of the previously + // selected one (or wxNOT_FOUND on error) + // + // NB: this function will generate PAGE_CHANGING/ED events + virtual int SetSelection(size_t n) = 0; + + // acts as SetSelection but does not generate events + virtual int ChangeSelection(size_t n) = 0; + + + // cycle thru the pages + void AdvanceSelection(bool forward = true) + { + int nPage = GetNextPage(forward); + 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 + virtual 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 + { + return wxNOT_FOUND; + } + + + // we do have multiple pages + virtual bool HasMultiplePages() const wxOVERRIDE { return true; } + + // returns true if the platform should explicitly apply a theme border + virtual bool CanApplyThemeBorder() const wxOVERRIDE { return false; } + + + // Implementation only from now on. + + // Returns an empty bundle if no image is specified for this page. + wxBitmapBundle GetPageBitmapBundle(size_t n) const + { + return GetBitmapBundle(GetPageImage(n)); + } + +protected: + // flags for DoSetSelection() + enum + { + SetSelection_SendEvent = 1 + }; + + // choose the default border for this window + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { 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 + virtual int DoSetSelection(size_t nPage, int flags = 0); + + // if the derived class uses DoSetSelection() for implementing + // [Set|Change]Selection, it must override UpdateSelectedPage(), + // CreatePageChangingEvent() and MakeChangedEvent(), but as it might not + // use it, these functions are not pure virtual + + // called to notify the control about a new current page + virtual void UpdateSelectedPage(size_t WXUNUSED(newsel)) + { wxFAIL_MSG(wxT("Override this function!")); } + + // create a new "page changing" event + 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(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 + // pages in some sensible way (e.g. wxTreebook overrides this to allow + // having nodes without any associated page) + virtual bool AllowNullPage() const { return false; } + + // For classes that allow null pages, we also need a way to find the + // closest non-NULL page corresponding to the given index, e.g. the first + // leaf item in wxTreebook tree and this method must be overridden to + // return it if AllowNullPage() is overridden. Note that it can still + // return null if there are no valid pages after this one. + virtual wxWindow *TryGetNonNullPage(size_t page) { return GetPage(page); } + + // 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 + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + // helper: get the next page wrapping if we reached the end + int GetNextPage(bool forward) const; + + // Lay out controls + virtual void DoSize(); + + // It is better to make this control transparent so that by default the controls on + // its pages are on the same colour background as the rest of the window. If the user + // prefers a coloured background they can set the background colour on the page panel + virtual bool HasTransparentBackground() wxOVERRIDE { return true; } + + // This method also invalidates the size of the controller and should be + // called instead of just InvalidateBestSize() whenever pages are added or + // removed as this also affects the controller + void DoInvalidateBestSize(); + +#if wxUSE_HELP + // Show the help for the corresponding page + void OnHelp(wxHelpEvent& event); +#endif // wxUSE_HELP + + + // the array of all pages of this control: this is used in most, but not + // all derived classes, notable wxAuiNotebook doesn't store its page here + // and so must override all virtual methods of this class using m_pages + wxVector m_pages; + + // get the page area + virtual wxRect GetPageRect() const; + + // event handlers + void OnSize(wxSizeEvent& event); + + // controller buddy if available, NULL otherwise (usually for native book controls like wxNotebook) + wxWindow *m_bookctrl; + + // Whether to shrink to fit current page + bool m_fitToCurrentPage; + + // the sizer containing the choice control + wxSizer *m_controlSizer; + + // 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 + void Init(); + + // internal border + unsigned int m_internalBorder; + + wxDECLARE_ABSTRACT_CLASS(wxBookCtrlBase); + wxDECLARE_NO_COPY_CLASS(wxBookCtrlBase); + + wxDECLARE_EVENT_TABLE(); +}; + +// ---------------------------------------------------------------------------- +// wxBookCtrlEvent: page changing events generated by book classes +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBookCtrlEvent : public wxNotifyEvent +{ +public: + 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; + } + + wxBookCtrlEvent(const wxBookCtrlEvent& event) + : wxNotifyEvent(event) + { + m_nSel = event.m_nSel; + m_nOldSel = event.m_nOldSel; + } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxBookCtrlEvent(*this); } + + // accessors + // 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 (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 + + wxDECLARE_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 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) +#else + // dedicated to Smartphones + #include "wx/choicebk.h" + #define wxBookCtrl wxChoicebook + #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) +#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 + +#endif // wxUSE_BOOKCTRL + +#endif // _WX_BOOKCTRL_H_ diff --git a/lib/wxWidgets/include/wx/brush.h b/lib/wxWidgets/include/wx/brush.h new file mode 100644 index 0000000..98c204c --- /dev/null +++ b/lib/wxWidgets/include/wx/brush.h @@ -0,0 +1,121 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/brush.h +// Purpose: Includes platform-specific wxBrush file +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BRUSH_H_BASE_ +#define _WX_BRUSH_H_BASE_ + +#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 WXDLLIMPEXP_CORE wxBrushBase: public wxGDIObject +{ +public: + wxDECLARE_DEFAULT_COPY_AND_DEF(wxBrushBase) + virtual ~wxBrushBase() { } + + 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()>=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(__WXMSW__) + #include "wx/msw/brush.h" +#elif defined(__WXMOTIF__) || defined(__WXX11__) + #include "wx/x11/brush.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/brush.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/brush.h" +#elif defined(__WXDFB__) + #include "wx/dfb/brush.h" +#elif defined(__WXMAC__) + #include "wx/osx/brush.h" +#elif defined(__WXQT__) + #include "wx/qt/brush.h" +#endif + +class WXDLLIMPEXP_CORE wxBrushList: public wxGDIObjListBase +{ +public: + wxBrush *FindOrCreateBrush(const wxColour& colour, + wxBrushStyle style = wxBRUSHSTYLE_SOLID); + + wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants") + wxBrush *FindOrCreateBrush(const wxColour& colour, int style) + { return FindOrCreateBrush(colour, (wxBrushStyle)style); } +}; + +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 + +wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants only") +inline bool operator==(wxBrushStyle s, wxDeprecatedGUIConstants t) +{ + return static_cast(s) == static_cast(t); +} + +wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants only") +inline bool operator!=(wxBrushStyle s, wxDeprecatedGUIConstants t) +{ + return static_cast(s) != static_cast(t); +} + +#endif // _WX_BRUSH_H_BASE_ diff --git a/lib/wxWidgets/include/wx/buffer.h b/lib/wxWidgets/include/wx/buffer.h new file mode 100644 index 0000000..9d24f53 --- /dev/null +++ b/lib/wxWidgets/include/wx/buffer.h @@ -0,0 +1,622 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/buffer.h +// Purpose: auto buffer classes: buffers which automatically free memory +// Author: Vadim Zeitlin +// Modified by: +// Created: 12.04.99 +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BUFFER_H +#define _WX_BUFFER_H + +#include "wx/defs.h" +#include "wx/wxcrtbase.h" + +#include // malloc() and free() + +class WXDLLIMPEXP_FWD_BASE wxCStrData; + +// ---------------------------------------------------------------------------- +// Special classes for (wide) character strings: they use malloc/free instead +// of new/delete +// ---------------------------------------------------------------------------- + +// helpers used by wxCharTypeBuffer +namespace wxPrivate +{ + +struct UntypedBufferData +{ + enum Kind + { + Owned, + NonOwned + }; + + UntypedBufferData(void *str, size_t len, Kind kind = Owned) + : m_str(str), m_length(len), m_ref(1), m_owned(kind == Owned) {} + + ~UntypedBufferData() + { + if ( m_owned ) + free(m_str); + } + + void *m_str; + size_t m_length; + + // "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 for persistent variant. +template +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(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(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(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(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 wxScopedCharBuffer; +typedef wxScopedCharTypeBuffer wxScopedWCharBuffer; + + +// this buffer class always stores data in "owned" (persistent) manner +template +class wxCharTypeBuffer : public wxScopedCharTypeBuffer +{ +protected: + typedef typename wxScopedCharTypeBuffer::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(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::operator=(src); + return *this; + } + + wxCharTypeBuffer(const wxScopedCharTypeBuffer& src) + { + this->MakeOwnedCopyOf(src); + } + + wxCharTypeBuffer& operator=(const wxScopedCharTypeBuffer& 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; + } +}; + +class wxCharBuffer : public wxCharTypeBuffer +{ +public: + typedef wxCharTypeBuffer wxCharTypeBufferBase; + typedef wxScopedCharTypeBuffer 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); +}; + +class wxWCharBuffer : public wxCharTypeBuffer +{ +public: + typedef wxCharTypeBuffer wxCharTypeBufferBase; + typedef wxScopedCharTypeBuffer 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 implicitly convertible to T* +template +class wxWritableCharTypeBuffer : public wxCharTypeBuffer +{ +public: + typedef typename wxScopedCharTypeBuffer::CharType CharType; + + wxWritableCharTypeBuffer(const wxScopedCharTypeBuffer& src) + : wxCharTypeBuffer(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(str) {} + + operator CharType*() { return this->data(); } +}; + +typedef wxWritableCharTypeBuffer wxWritableCharBuffer; +typedef wxWritableCharTypeBuffer wxWritableWCharBuffer; + + +#if wxUSE_UNICODE + #define wxWxCharBuffer wxWCharBuffer + + #define wxMB2WXbuf wxWCharBuffer + #define wxWX2MBbuf wxCharBuffer + #if wxUSE_UNICODE_WCHAR + #define wxWC2WXbuf wxChar* + #define wxWX2WCbuf wxChar* + #elif wxUSE_UNICODE_UTF8 + #define wxWC2WXbuf wxWCharBuffer + #define wxWX2WCbuf wxWCharBuffer + #endif +#else // ANSI + #define wxWxCharBuffer wxCharBuffer + + #define wxMB2WXbuf wxChar* + #define wxWX2MBbuf wxChar* + #define wxWC2WXbuf wxCharBuffer + #define wxWX2WCbuf wxWCharBuffer +#endif // Unicode/ANSI + +// ---------------------------------------------------------------------------- +// A class for holding growable data buffers (not necessarily strings) +// ---------------------------------------------------------------------------- + +// This class manages the actual data buffer pointer and is ref-counted. +class wxMemoryBufferData +{ +public: + // the initial size and also the size added by ResizeIfNeeded() + enum { DefBufSize = 1024 }; + + friend class 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) + { + } + ~wxMemoryBufferData() { free(m_data); } + + + void ResizeIfNeeded(size_t newSize) + { + if (newSize > m_size) + { + void* const data = realloc(m_data, newSize + wxMemoryBufferData::DefBufSize); + if ( !data ) + { + // It's better to crash immediately dereferencing a null + // pointer in the function calling us than overflowing the + // buffer which couldn't be made big enough. + free(release()); + return; + } + + m_data = data; + m_size = newSize + wxMemoryBufferData::DefBufSize; + } + } + + void IncRef() { m_ref += 1; } + void DecRef() + { + m_ref -= 1; + if (m_ref == 0) // are there no more references? + 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; + + // the size of the buffer + size_t m_size; + + // the amount of data currently in the buffer + size_t m_len; + + // the reference count + size_t m_ref; + + wxDECLARE_NO_COPY_CLASS(wxMemoryBufferData); +}; + + +class wxMemoryBuffer +{ +public: + // ctor and dtor + wxMemoryBuffer(size_t size = wxMemoryBufferData::DefBufSize) + { + m_bufdata = new wxMemoryBufferData(size); + m_bufdata->IncRef(); + } + + ~wxMemoryBuffer() { m_bufdata->DecRef(); } + + + // copy and assignment + wxMemoryBuffer(const wxMemoryBuffer& src) + : m_bufdata(src.m_bufdata) + { + m_bufdata->IncRef(); + } + + wxMemoryBuffer& operator=(const wxMemoryBuffer& src) + { + if (&src != this) + { + m_bufdata->DecRef(); + m_bufdata = src.m_bufdata; + m_bufdata->IncRef(); + } + return *this; + } + + + // Accessors + void *GetData() const { return m_bufdata->m_data; } + 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) + { + wxASSERT(len <= m_bufdata->m_size); + 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) + { + m_bufdata->ResizeIfNeeded(sizeNeeded); + return m_bufdata->m_data; + } + + // Update the length after the write + void UngetWriteBuf(size_t sizeUsed) { SetDataLen(sizeUsed); } + + // Like the above, but appends to the buffer + void *GetAppendBuf(size_t sizeNeeded) + { + m_bufdata->ResizeIfNeeded(m_bufdata->m_len + sizeNeeded); + return (char*)m_bufdata->m_data + m_bufdata->m_len; + } + + // Update the length after the append + void UngetAppendBuf(size_t sizeUsed) + { + SetDataLen(m_bufdata->m_len + sizeUsed); + } + + // Other ways to append to the buffer + void AppendByte(char data) + { + wxCHECK_RET( m_bufdata->m_data, wxT("invalid wxMemoryBuffer") ); + + m_bufdata->ResizeIfNeeded(m_bufdata->m_len + 1); + *(((char*)m_bufdata->m_data) + m_bufdata->m_len) = data; + m_bufdata->m_len += 1; + } + + void AppendData(const void *data, size_t len) + { + memcpy(GetAppendBuf(len), data, len); + UngetAppendBuf(len); + } + + 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; +}; + +// ---------------------------------------------------------------------------- +// template class for any kind of data +// ---------------------------------------------------------------------------- + +// TODO + +#endif // _WX_BUFFER_H diff --git a/lib/wxWidgets/include/wx/build.h b/lib/wxWidgets/include/wx/build.h new file mode 100644 index 0000000..d94a2bf --- /dev/null +++ b/lib/wxWidgets/include/wx/build.h @@ -0,0 +1,134 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/build.h +// Purpose: Runtime build options checking +// Author: Vadim Zeitlin, Vaclav Slavik +// Modified by: +// Created: 07.05.02 +// Copyright: (c) 2002 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BUILD_H_ +#define _WX_BUILD_H_ + +#include "wx/version.h" + +// NB: This file contains macros for checking binary compatibility of libraries +// 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 +// same; if two builds are binary incompatible, their signatures should +// be different. +// +// Therefore, wxUSE_XXX flags that affect binary compatibility (vtables, +// function signatures) should be accounted for here. So should compilers +// and compiler versions (but note that binary compatible compiler versions +// such as gcc-2.95.2 and gcc-2.95.3 should have same signature!). + +// ---------------------------------------------------------------------------- +// WX_BUILD_OPTIONS_SIGNATURE +// ---------------------------------------------------------------------------- + +#define __WX_BO_STRINGIZE(x) __WX_BO_STRINGIZE0(x) +#define __WX_BO_STRINGIZE0(x) #x + +#if (wxMINOR_VERSION % 2) == 0 + #define __WX_BO_VERSION(x,y,z) \ + __WX_BO_STRINGIZE(x) "." __WX_BO_STRINGIZE(y) +#else + #define __WX_BO_VERSION(x,y,z) \ + __WX_BO_STRINGIZE(x) "." __WX_BO_STRINGIZE(y) "." __WX_BO_STRINGIZE(z) +#endif + +#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 + +// GCC and Intel C++ share same C++ ABI (and possibly others in the future), +// check if compiler versions are compatible: +#if defined(__GXX_ABI_VERSION) + // All the changes since ABI version 1002 so far have been insignificant, + // so just check for this value, first used for g++ 3.4 and used by default + // by all g++ 4 versions, as checking for the exact ABI version simply + // results in run-time breakage whenever a new gcc version is released, + // even if there are no real problems. + #if __GXX_ABI_VERSION >= 1002 + #define __WX_BO_COMPILER \ + ",compiler with C++ ABI compatible with gcc 4" + #else + #define __WX_BO_COMPILER \ + ",compiler with C++ ABI " __WX_BO_STRINGIZE(__GXX_ABI_VERSION) + #endif +#elif defined(__GNUG__) + #define __WX_BO_COMPILER ",GCC " \ + __WX_BO_STRINGIZE(__GNUC__) "." __WX_BO_STRINGIZE(__GNUC_MINOR__) +#elif defined(__VISUALC__) + // VC15 (a.k.a. MSVS 2017) is ABI-compatible with VC14 (MSVS 2015), so use + // the same ABI version for both of them. + #if _MSC_VER >= 1900 && _MSC_VER < 2000 + #define wxMSVC_ABI_VERSION 1900 + #else + #define wxMSVC_ABI_VERSION _MSC_VER + #endif + #define __WX_BO_COMPILER ",Visual C++ " __WX_BO_STRINGIZE(wxMSVC_ABI_VERSION) +#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++" +#else + #define __WX_BO_COMPILER +#endif + +// WXWIN_COMPATIBILITY macros affect presence of virtual functions +#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 +#if WXWIN_COMPATIBILITY_3_0 + #define __WX_BO_WXWIN_COMPAT_3_0 ",compatible with 3.0" +#else + #define __WX_BO_WXWIN_COMPAT_3_0 +#endif + +// deriving wxWin containers from STL ones changes them completely: +#if wxUSE_STD_CONTAINERS + #define __WX_BO_STL ",STL containers" +#else + #define __WX_BO_STL ",wx containers" +#endif + +// This macro is passed as argument to wxAppConsole::CheckBuildOptions() +#define WX_BUILD_OPTIONS_SIGNATURE \ + __WX_BO_VERSION(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) \ + " (" __WX_BO_UNICODE \ + __WX_BO_COMPILER \ + __WX_BO_STL \ + __WX_BO_WXWIN_COMPAT_2_8 __WX_BO_WXWIN_COMPAT_3_0 \ + ")" + + +// ---------------------------------------------------------------------------- +// WX_CHECK_BUILD_OPTIONS +// ---------------------------------------------------------------------------- + +// 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 wxIMPLEMENT_APP() does. +#define WX_CHECK_BUILD_OPTIONS(libName) \ + static struct wxBuildOptionsChecker \ + { \ + wxBuildOptionsChecker() \ + { \ + wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, \ + libName); \ + } \ + } gs_buildOptionsCheck; + + +#endif // _WX_BUILD_H_ diff --git a/lib/wxWidgets/include/wx/busyinfo.h b/lib/wxWidgets/include/wx/busyinfo.h new file mode 100644 index 0000000..94f8fab --- /dev/null +++ b/lib/wxWidgets/include/wx/busyinfo.h @@ -0,0 +1,78 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/busyinfo.h +// Purpose: Information window (when app is busy) +// Author: Vaclav Slavik +// Copyright: (c) 1999 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __BUSYINFO_H_BASE__ +#define __BUSYINFO_H_BASE__ + +#include "wx/defs.h" + +#if wxUSE_BUSYINFO + +#include "wx/colour.h" +#include "wx/icon.h" + +class WXDLLIMPEXP_FWD_CORE wxWindow; + +// This class is used to pass all the various parameters to wxBusyInfo ctor. +// According to the usual naming conventions (see wxAboutDialogInfo, +// wxFontInfo, ...) it would be called wxBusyInfoInfo, but this would have been +// rather strange, so we call it wxBusyInfoFlags instead. +// +// Methods are mostly self-explanatory except for the difference between "Text" +// and "Label": the former can contain markup, while the latter is just plain +// string which is not parsed in any way. +class wxBusyInfoFlags +{ +public: + wxBusyInfoFlags() + { + m_parent = NULL; + m_alpha = wxALPHA_OPAQUE; + } + + wxBusyInfoFlags& Parent(wxWindow* parent) + { m_parent = parent; return *this; } + + wxBusyInfoFlags& Icon(const wxIcon& icon) + { m_icon = icon; return *this; } + wxBusyInfoFlags& Title(const wxString& title) + { m_title = title; return *this; } + wxBusyInfoFlags& Text(const wxString& text) + { m_text = text; return *this; } + wxBusyInfoFlags& Label(const wxString& label) + { m_label = label; return *this; } + + wxBusyInfoFlags& Foreground(const wxColour& foreground) + { m_foreground = foreground; return *this; } + wxBusyInfoFlags& Background(const wxColour& background) + { m_background = background; return *this; } + + wxBusyInfoFlags& Transparency(wxByte alpha) + { m_alpha = alpha; return *this; } + +private: + wxWindow* m_parent; + + wxIcon m_icon; + wxString m_title, + m_text, + m_label; + + wxColour m_foreground, + m_background; + + wxByte m_alpha; + + friend class wxBusyInfo; +}; + +#include "wx/generic/busyinfo.h" + +#endif // wxUSE_BUSYINFO + +#endif // __BUSYINFO_H_BASE__ diff --git a/lib/wxWidgets/include/wx/button.h b/lib/wxWidgets/include/wx/button.h new file mode 100644 index 0000000..0f26c65 --- /dev/null +++ b/lib/wxWidgets/include/wx/button.h @@ -0,0 +1,68 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/button.h +// Purpose: wxButtonBase class +// Author: Vadim Zeitlin +// Modified by: +// Created: 15.08.00 +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BUTTON_H_BASE_ +#define _WX_BUTTON_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_BUTTON + +#include "wx/anybutton.h" + +extern WXDLLIMPEXP_DATA_CORE(const char) wxButtonNameStr[]; + +// ---------------------------------------------------------------------------- +// wxButton: a push button +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxButtonBase : public wxAnyButton +{ +public: + wxButtonBase() { } + + // 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(); } + + // 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, and optionally for a + // specific window when the platform supports per-monitor DPI + static wxSize GetDefaultSize(wxWindow* win = NULL); + +protected: + wxDECLARE_NO_COPY_CLASS(wxButtonBase); +}; + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/button.h" +#elif defined(__WXMSW__) + #include "wx/msw/button.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/button.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/button.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/button.h" +#elif defined(__WXMAC__) + #include "wx/osx/button.h" +#elif defined(__WXQT__) + #include "wx/qt/button.h" +#endif + +#endif // wxUSE_BUTTON + +#endif // _WX_BUTTON_H_BASE_ diff --git a/lib/wxWidgets/include/wx/calctrl.h b/lib/wxWidgets/include/wx/calctrl.h new file mode 100644 index 0000000..8af0a54 --- /dev/null +++ b/lib/wxWidgets/include/wx/calctrl.h @@ -0,0 +1,402 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/calctrl.h +// Purpose: date-picker control +// Author: Vadim Zeitlin +// Modified by: +// Created: 29.12.99 +// Copyright: (c) 1999 Vadim Zeitlin +// 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 = 0x0080, + + // 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 either month or 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_CORE 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_CORE wxCalendarCtrl; + +class WXDLLIMPEXP_CORE 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(wxDateTime::WeekDay wd) { m_wday = wd; } + wxDateTime::WeekDay GetWeekDay() const { return m_wday; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxCalendarEvent(*this); } + +private: + wxDateTime::WeekDay m_wday; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCalendarEvent); +}; + +// ---------------------------------------------------------------------------- +// wxCalendarCtrlBase +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE 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() { } + + // does the week start on monday based on flags and OS settings? + bool WeekStartsOnMonday() const; +}; + +// ---------------------------------------------------------------------------- +// 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" + #elif defined(__WXQT__) + #define wxHAS_NATIVE_CALENDARCTRL + #include "wx/qt/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_CORE, wxEVT_CALENDAR_SEL_CHANGED, wxCalendarEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CALENDAR_PAGE_CHANGED, wxCalendarEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CALENDAR_DOUBLECLICKED, wxCalendarEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CALENDAR_WEEKDAY_CLICKED, wxCalendarEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CALENDAR_WEEK_CLICKED, wxCalendarEvent ); + +// deprecated events +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CALENDAR_DAY_CHANGED, wxCalendarEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CALENDAR_MONTH_CHANGED, wxCalendarEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, 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_ + diff --git a/lib/wxWidgets/include/wx/caret.h b/lib/wxWidgets/include/wx/caret.h new file mode 100644 index 0000000..bb659f2 --- /dev/null +++ b/lib/wxWidgets/include/wx/caret.h @@ -0,0 +1,251 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/caret.h +// Purpose: wxCaretBase class - the interface of wxCaret +// Author: Vadim Zeitlin +// Modified by: +// Created: 23.05.99 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CARET_H_BASE_ +#define _WX_CARET_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_CARET + +// --------------------------------------------------------------------------- +// forward declarations +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxWindowBase; + +// ---------------------------------------------------------------------------- +// headers we have to include +// ---------------------------------------------------------------------------- + +#include "wx/gdicmn.h" // for wxPoint, wxSize + +// ---------------------------------------------------------------------------- +// A caret is a blinking cursor showing the position where the typed text will +// appear. It can be either a solid block or a custom bitmap (TODO) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxCaretBase +{ +public: + // ctors + // ----- + // default - use Create + wxCaretBase() { Init(); } + // create the caret of given (in pixels) width and height and associate + // with the given window + wxCaretBase(wxWindowBase *window, int width, int height) + { + Init(); + + (void)Create(window, width, height); + } + // same as above + wxCaretBase(wxWindowBase *window, const wxSize& size) + { + Init(); + + (void)Create(window, size); + } + + // a virtual dtor has been provided since this class has virtual members + virtual ~wxCaretBase() { } + + // Create() functions - same as ctor but returns the success code + // -------------------------------------------------------------- + + // same as ctor + bool Create(wxWindowBase *window, int width, int height) + { return DoCreate(window, width, height); } + // same as ctor + bool Create(wxWindowBase *window, const wxSize& size) + { return DoCreate(window, size.x, size.y); } + + // accessors + // --------- + + // is the caret valid? + bool IsOk() const { return m_width != 0 && m_height != 0; } + + // is the caret currently shown? + bool IsVisible() const { return m_countVisible > 0; } + + // get the caret position + void GetPosition(int *x, int *y) const + { + if ( x ) *x = m_x; + if ( y ) *y = m_y; + } + wxPoint GetPosition() const { return wxPoint(m_x, m_y); } + + // get the caret size + void GetSize(int *width, int *height) const + { + if ( width ) *width = m_width; + if ( height ) *height = m_height; + } + wxSize GetSize() const { return wxSize(m_width, m_height); } + + // get the window we're associated with + wxWindow *GetWindow() const { return (wxWindow *)m_window; } + + // change the size of the caret + void SetSize(int width, int height) { + m_width = width; + m_height = height; + DoSize(); + } + void SetSize(const wxSize& size) { SetSize(size.x, size.y); } + + + // operations + // ---------- + + // move the caret to given position (in logical coords) + void Move(int x, int y) { m_x = x; m_y = y; DoMove(); } + void Move(const wxPoint& pt) { m_x = pt.x; m_y = pt.y; DoMove(); } + + // show/hide the caret (should be called by wxWindow when needed): + // Show() must be called as many times as Hide() + 1 to make the caret + // visible + virtual void Show(bool show = true) + { + if ( show ) + { + if ( m_countVisible++ == 0 ) + DoShow(); + } + else + { + if ( --m_countVisible == 0 ) + DoHide(); + } + } + virtual void Hide() { Show(false); } + + // blink time is measured in milliseconds and is the time elapsed + // between 2 inversions of the caret (blink time of the caret is common + // to all carets in the Universe, so these functions are static) + static int GetBlinkTime(); + static void SetBlinkTime(int milliseconds); + + // implementation from now on + // -------------------------- + + // these functions should be called by wxWindow when the window gets/loses + // the focus - we create/show and hide/destroy the caret here + virtual void OnSetFocus() { } + virtual void OnKillFocus() { } + +protected: + // 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) + { + m_window = window; + m_width = width; + m_height = height; + DoSize(); + + return true; + } + + // pure virtuals to implement in the derived class + virtual void DoShow() = 0; + virtual void DoHide() = 0; + virtual void DoMove() = 0; + virtual void DoSize() { } + + // the size of the caret + int m_width, m_height; + + // the position of the caret + int m_x, m_y; + + // the window we're associated with + wxWindowBase *m_window; + + // visibility count: the caret is visible only if it's positive + int m_countVisible; + +private: + void Init() + { + m_window = NULL; + m_x = m_y = 0; + m_width = m_height = 0; + m_countVisible = 0; + } + + wxDECLARE_NO_COPY_CLASS(wxCaretBase); +}; + +// --------------------------------------------------------------------------- +// now include the real thing +// --------------------------------------------------------------------------- + +#if defined(__WXMSW__) + #include "wx/msw/caret.h" +#else + #include "wx/generic/caret.h" +#endif // platform + +// ---------------------------------------------------------------------------- +// wxCaretSuspend: a simple class which hides the caret in its ctor and +// restores it in the dtor, this should be used when drawing on the screen to +// avoid overdrawing the caret +// ---------------------------------------------------------------------------- + +#ifdef wxHAS_CARET_USING_OVERLAYS + +// we don't need to hide the caret if it's rendered using overlays +class WXDLLIMPEXP_CORE wxCaretSuspend +{ +public: + wxCaretSuspend(wxWindow *WXUNUSED(win)) {} + + wxDECLARE_NO_COPY_CLASS(wxCaretSuspend); +}; + +#else // !wxHAS_CARET_USING_OVERLAYS + +class WXDLLIMPEXP_CORE wxCaretSuspend +{ +public: + wxCaretSuspend(wxWindow *win) + { + m_caret = win->GetCaret(); + m_show = false; + if ( m_caret && m_caret->IsVisible() ) + { + m_caret->Hide(); + m_show = true; + } + } + + ~wxCaretSuspend() + { + if ( m_caret && m_show ) + m_caret->Show(); + } + +private: + wxCaret *m_caret; + bool m_show; + + wxDECLARE_NO_COPY_CLASS(wxCaretSuspend); +}; + +#endif // wxHAS_CARET_USING_OVERLAYS/!wxHAS_CARET_USING_OVERLAYS + +#endif // wxUSE_CARET + +#endif // _WX_CARET_H_BASE_ diff --git a/lib/wxWidgets/include/wx/catch_cppunit.h b/lib/wxWidgets/include/wx/catch_cppunit.h new file mode 100644 index 0000000..652367c --- /dev/null +++ b/lib/wxWidgets/include/wx/catch_cppunit.h @@ -0,0 +1,287 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/catch_cppunit.h +// Purpose: Reimplementation of CppUnit macros in terms of CATCH +// Author: Vadim Zeitlin +// Created: 2017-10-30 +// Copyright: (c) 2017 Vadim Zeitlin +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CATCH_CPPUNIT_H_ +#define _WX_CATCH_CPPUNIT_H_ + +#include "catch.hpp" + +// CppUnit-compatible macros. + +// CPPUNIT_ASSERTs are mapped to REQUIRE(), not CHECK(), as this is how CppUnit +// works but in many cases they really should be CHECK()s instead, i.e. the +// test should continue to run even if one assert failed. Unfortunately there +// is no automatic way to know it, so the existing code will need to be +// reviewed and CHECK() used explicitly where appropriate. +// +// Also notice that we don't use parentheses around x and y macro arguments in +// the macro expansion, as usual. This is because these parentheses would then +// appear in CATCH error messages if the assertion fails, making them much less +// readable and omitting should be fine here, exceptionally, as the arguments +// of these macros are usually just simple expressions. +#define CPPUNIT_ASSERT(cond) REQUIRE(cond) +#define CPPUNIT_ASSERT_EQUAL(x, y) REQUIRE(x == y) + +// Using INFO() disallows putting more than one of these macros on the same +// line but this can happen if they're used inside another macro, so wrap it +// inside a scope. +#define CPPUNIT_ASSERT_MESSAGE(msg, cond) \ + do { INFO(msg); REQUIRE(cond); } while (Catch::alwaysFalse()) + +#define CPPUNIT_ASSERT_EQUAL_MESSAGE(msg, x, y) \ + do { INFO(msg); REQUIRE(x == y); } while (Catch::alwaysFalse()) + +// CATCH Approx class uses the upper bound of "epsilon*(scale + max(|x|, |y|))" +// for |x - y| which is not really compatible with our fixed delta, so we can't +// use it here. +#define CPPUNIT_ASSERT_DOUBLES_EQUAL(x, y, delta) \ + REQUIRE(std::abs(x - y) < delta) + +#define CPPUNIT_FAIL(msg) FAIL(msg) + +#define CPPUNIT_ASSERT_THROW(expr, exception) \ + try \ + { \ + expr; \ + FAIL("Expected exception of type " #exception \ + " not thrown by " #expr); \ + } \ + catch ( exception& ) {} + +// Define conversions to strings for some common wxWidgets types. +namespace Catch +{ + template <> + struct StringMaker + { + static std::string convert(wxUniChar uc) + { + return wxString(uc).ToStdString(wxConvUTF8); + } + }; + + template <> + struct StringMaker + { + static std::string convert(wxUniCharRef ucr) + { + return wxString(ucr).ToStdString(wxConvUTF8); + } + }; + + // While this conversion already works due to the existence of the stream + // insertion operator for wxString, define a custom one making it more + // obvious when strings containing non-printable characters differ. + template <> + struct StringMaker + { + static std::string convert(const wxString& wxs) + { + std::string s; + s.reserve(wxs.length()); + for ( wxString::const_iterator i = wxs.begin(); + i != wxs.end(); + ++i ) + { +#if wxUSE_UNICODE + if ( !iswprint(*i) ) + s += wxString::Format(wxASCII_STR("\\u%04X"), *i).ToAscii(); + else +#endif // wxUSE_UNICODE + s += *i; + } + + return s; + } + }; +} + +// Use a different namespace for our mock ups of the real declarations in +// CppUnit namespace to avoid clashes if we end up being linked with the real +// CppUnit library, but bring it into scope with a using directive below to +// make it possible to compile the original code using CppUnit unmodified. +namespace CatchCppUnit +{ + +namespace CppUnit +{ + +// These classes don't really correspond to the real CppUnit ones, but contain +// just the minimum we need to make CPPUNIT_TEST() macro and our mock up of +// TestSuite class work. + +class Test +{ +public: + // Name argument exists only for compatibility with the real CppUnit but is + // not used here. + explicit Test(const std::string& name = std::string()) : m_name(name) { } + + virtual ~Test() { } + + virtual void runTest() = 0; + + const std::string& getName() const { return m_name; } + +private: + std::string m_name; +}; + +class TestCase : public Test +{ +public: + explicit TestCase(const std::string& name = std::string()) : Test(name) { } + + virtual void setUp() {} + virtual void tearDown() {} +}; + +class TestSuite : public Test +{ +public: + explicit TestSuite(const std::string& name = std::string()) : Test(name) { } + + ~TestSuite() + { + for ( size_t n = 0; n < m_tests.size(); ++n ) + { + delete m_tests[n]; + } + } + + void addTest(Test* test) { m_tests.push_back(test); } + size_t getChildTestCount() const { return m_tests.size(); } + + void runTest() wxOVERRIDE + { + for ( size_t n = 0; n < m_tests.size(); ++n ) + { + m_tests[n]->runTest(); + } + } + +private: + std::vector m_tests; + + wxDECLARE_NO_COPY_CLASS(TestSuite); +}; + +} // namespace CppUnit + +} // namespace CatchCppUnit + +using namespace CatchCppUnit; + +// Helpers used in the implementation of the macros below. +namespace wxPrivate +{ + +// An object which resets a string to its old value when going out of scope. +class TempStringAssign +{ +public: + explicit TempStringAssign(std::string& str, const char* value) + : m_str(str), + m_orig(str) + { + str = value; + } + + ~TempStringAssign() + { + m_str = m_orig; + } + +private: + std::string& m_str; + const std::string m_orig; + + wxDECLARE_NO_COPY_CLASS(TempStringAssign); +}; + +// These two strings are used to implement wxGetCurrentTestName() and must be +// defined in the test driver. +extern std::string wxTheCurrentTestClass, wxTheCurrentTestMethod; + +} // namespace wxPrivate + +inline std::string wxGetCurrentTestName() +{ + std::string s = wxPrivate::wxTheCurrentTestClass; + if ( !s.empty() && !wxPrivate::wxTheCurrentTestMethod.empty() ) + s += "::"; + s += wxPrivate::wxTheCurrentTestMethod; + + return s; +} + +// Notice that the use of this macro unconditionally changes the protection for +// everything that follows it to "public". This is necessary to allow taking +// the address of the runTest() method in CPPUNIT_TEST_SUITE_REGISTRATION() +// below and there just doesn't seem to be any way around it. +#define CPPUNIT_TEST_SUITE(testclass) \ + public: \ + void runTest() wxOVERRIDE \ + { \ + using namespace wxPrivate; \ + TempStringAssign setClass(wxTheCurrentTestClass, #testclass) + +#define CPPUNIT_TEST(testname) \ + SECTION(#testname) \ + { \ + TempStringAssign setMethod(wxTheCurrentTestMethod, #testname); \ + setUp(); \ + try \ + { \ + testname(); \ + } \ + catch ( ... ) \ + { \ + tearDown(); \ + throw; \ + } \ + tearDown(); \ + } + +#define CPPUNIT_TEST_SUITE_END() \ + } \ + struct EatNextSemicolon + +#define wxREGISTER_UNIT_TEST_WITH_TAGS(testclass, tags) \ + METHOD_AS_TEST_CASE(testclass::runTest, #testclass, tags) \ + struct EatNextSemicolon + +#define CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(testclass, suitename) \ + wxREGISTER_UNIT_TEST_WITH_TAGS(testclass, "[" suitename "]") + +// Existings tests always use both this macro and the named registration one +// above, but we can't register the same test case twice with CATCH, so simply +// ignore this one. +#define CPPUNIT_TEST_SUITE_REGISTRATION(testclass) \ + struct EatNextSemicolon + +// ---------------------------------------------------------------------------- +// wxWidgets-specific macros +// ---------------------------------------------------------------------------- + +// Convenient variant of INFO() which uses wxString::Format() internally. +#define wxINFO_FMT_HELPER(fmt, ...) \ + wxString::Format(fmt, __VA_ARGS__).ToStdString(wxConvUTF8) + +#define wxINFO_FMT(...) INFO(wxINFO_FMT_HELPER(__VA_ARGS__)) + +// 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(wxConvLibc)), (cond)) + +#define WX_ASSERT_EQUAL_MESSAGE(msg, expected, actual) \ + CPPUNIT_ASSERT_EQUAL_MESSAGE(std::string(wxString::Format msg .mb_str(wxConvLibc)), \ + (expected), (actual)) + +#endif // _WX_CATCH_CPPUNIT_H_ diff --git a/lib/wxWidgets/include/wx/chartype.h b/lib/wxWidgets/include/wx/chartype.h new file mode 100644 index 0000000..f75fc28 --- /dev/null +++ b/lib/wxWidgets/include/wx/chartype.h @@ -0,0 +1,269 @@ +/* + * 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_ + +/* + wx/defs.h indirectly includes this file, so we can't include it here, + include just its subset which defines SIZEOF_WCHAR_T that is used here + (under Unix it's in configure-generated setup.h, so including wx/platform.h + would have been enough, but this is not the case under other platforms). + */ +#include "wx/types.h" + +/* This is kept only for backwards compatibility, in case some application code + checks for it. It's always 1 and can't be changed. */ +#define wxUSE_WCHAR_T 1 + +/* + 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(__MINGW32__) + #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 + #ifdef __cplusplus + extern "C" { + #endif + #endif /* Cygwin */ + + #include + + #if defined(__CYGWIN__) && defined(__cplusplus) + } + #endif /* Cygwin and C++ */ + + /* the current (as of Mar 2014) version of Android (up to api level 19) */ + /* doesn't include some declarations (wscdup, wcslen, wcscasecmp, etc.) */ + /* (moved out from __CYGWIN__ block) */ + #if defined(__WXQT__) && !defined(wcsdup) && defined(__ANDROID__) + #ifdef __cplusplus + extern "C" { + #endif + extern wchar_t *wcsdup(const wchar_t *); + extern size_t wcslen (const wchar_t *); + extern size_t wcsnlen (const wchar_t *, size_t ); + extern int wcscasecmp (const wchar_t *, const wchar_t *); + extern int wcsncasecmp (const wchar_t *, const wchar_t *, size_t); + #ifdef __cplusplus + } + #endif + #endif /* Android */ + +#elif defined(HAVE_WCSTR_H) + /* old compilers have relevant declarations here */ + #include +#elif defined(__FreeBSD__) || defined(__DARWIN__) + /* include stdlib.h for wchar_t */ + #include +#endif /* HAVE_WCHAR_H */ + +#ifdef HAVE_WIDEC_H + #include +#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(__MINGW32__) + #define wxHAVE_TCHAR_SUPPORT + #include + #include + #include +#endif /* compilers with (good) TCHAR support */ + +#ifdef wxHAVE_TCHAR_SUPPORT + /* get TCHAR definition if we've got it */ + #include +#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 */ + typedef wchar_t wxChar; + typedef wchar_t wxSChar; + typedef wchar_t wxUChar; +#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 + +#ifndef SIZEOF_WCHAR_T + #error "SIZEOF_WCHAR_T must be defined before including this file in wx/defs.h" +#endif + +#if wxUSE_UNICODE_WCHAR && SIZEOF_WCHAR_T == 2 + #define wxUSE_UNICODE_UTF16 1 +#else + #define wxUSE_UNICODE_UTF16 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 + #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. + */ + #define wxT(x) wxCONCAT_HELPER(L, x) + #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. + */ + #define wxS(x) wxCONCAT_HELPER(L, x) +#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 analogs of the standard __FILE__, DATE and TIME macros. + + These macros exist only for backwards compatibility, there should be no + reason to use them in the new code, just use the standard macros instead. + + Also note that we must not use the actual macro names for the two latter + ones, as doing this would prevent ccache from caching the results of + compiling any file including this header by default, rendering ccache + ineffective for wxWidgets programs. Hence the use of "##" below and avoiding + naming these macros in this comment. + */ +#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_ */ + diff --git a/lib/wxWidgets/include/wx/checkbox.h b/lib/wxWidgets/include/wx/checkbox.h new file mode 100644 index 0000000..36f5276 --- /dev/null +++ b/lib/wxWidgets/include/wx/checkbox.h @@ -0,0 +1,192 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/checkbox.h +// Purpose: wxCheckBox class interface +// Author: Vadim Zeitlin +// Modified by: +// Created: 07.09.00 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CHECKBOX_H_BASE_ +#define _WX_CHECKBOX_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_CHECKBOX + +#include "wx/control.h" + + +/* + * wxCheckBox style flags + * (Using wxCHK_* because wxCB_* is used by wxComboBox). + * 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 0x4000 +#define wxCHK_3STATE 0x1000 + +/* + * If this style is set the user can set the checkbox to the + * undetermined state. If not set the undetermined set can only + * be set programmatically. + * This style can only be used with 3 state checkboxes. + */ +#define wxCHK_ALLOW_3RD_STATE_FOR_USER 0x2000 + +extern WXDLLIMPEXP_DATA_CORE(const char) wxCheckBoxNameStr[]; + +// ---------------------------------------------------------------------------- +// wxCheckBox: a control which shows a label and a box which may be checked +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxCheckBoxBase : public wxControl +{ +public: + wxCheckBoxBase() { } + + // set/get the checked status of the listbox + virtual void SetValue(bool value) = 0; + virtual bool GetValue() const = 0; + + bool IsChecked() const + { + wxASSERT_MSG( !Is3State(), wxT("Calling IsChecked() doesn't make sense for") + wxT(" a three state checkbox, Use Get3StateValue() instead") ); + + return GetValue(); + } + + wxCheckBoxState Get3StateValue() const + { + wxCheckBoxState state = DoGet3StateValue(); + + if ( state == wxCHK_UNDETERMINED && !Is3State() ) + { + // Undetermined state with a 2-state checkbox?? + wxFAIL_MSG( wxT("DoGet3StateValue() says the 2-state checkbox is ") + wxT("in an undetermined/third state") ); + + state = wxCHK_UNCHECKED; + } + + return state; + } + + void Set3StateValue(wxCheckBoxState state) + { + if ( state == wxCHK_UNDETERMINED && !Is3State() ) + { + wxFAIL_MSG(wxT("Setting a 2-state checkbox to undetermined state")); + state = wxCHK_UNCHECKED; + } + + DoSet3StateValue(state); + } + + bool Is3State() const { return HasFlag(wxCHK_3STATE); } + + bool Is3rdStateAllowedForUser() const + { + return HasFlag(wxCHK_ALLOW_3RD_STATE_FOR_USER); + } + + virtual bool HasTransparentBackground() wxOVERRIDE { return true; } + + // This semi-private function is currently used to allow wxMSW checkbox to + // blend in with its parent background colour without changing the + // background colour of the checkbox itself under the other platforms. + virtual void SetTransparentPartColour(const wxColour& WXUNUSED(col)) { } + + // wxCheckBox-specific processing after processing the update event + virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) wxOVERRIDE + { + wxControl::DoUpdateWindowUI(event); + + if ( event.GetSetChecked() ) + SetValue(event.GetChecked()); + } + +protected: + // choose the default border for this window + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + + virtual void DoSet3StateValue(wxCheckBoxState WXUNUSED(state)) { wxFAIL; } + + virtual wxCheckBoxState DoGet3StateValue() const + { + wxFAIL; + 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 specifies + // 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: + 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__) + #include "wx/msw/checkbox.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/checkbox.h" +#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/osx/checkbox.h" +#elif defined(__WXQT__) + #include "wx/qt/checkbox.h" +#endif + +#endif // wxUSE_CHECKBOX + +#endif // _WX_CHECKBOX_H_BASE_ diff --git a/lib/wxWidgets/include/wx/checkeddelete.h b/lib/wxWidgets/include/wx/checkeddelete.h new file mode 100644 index 0000000..fd295fa --- /dev/null +++ b/lib/wxWidgets/include/wx/checkeddelete.h @@ -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_ + diff --git a/lib/wxWidgets/include/wx/checklst.h b/lib/wxWidgets/include/wx/checklst.h new file mode 100644 index 0000000..1b06f34 --- /dev/null +++ b/lib/wxWidgets/include/wx/checklst.h @@ -0,0 +1,57 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/checklst.h +// Purpose: wxCheckListBox class interface +// Author: Vadim Zeitlin +// Modified by: +// Created: 12.09.00 +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CHECKLST_H_BASE_ +#define _WX_CHECKLST_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_CHECKLISTBOX + +#include "wx/listbox.h" + +// ---------------------------------------------------------------------------- +// wxCheckListBox: a listbox whose items may be checked +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxCheckListBoxBase : public wxListBox +{ +public: + wxCheckListBoxBase() { } + + // check list box specific methods + virtual bool IsChecked(unsigned int item) const = 0; + virtual void Check(unsigned int item, bool check = true) = 0; + + virtual unsigned int GetCheckedItems(wxArrayInt& checkedItems) const; + + wxDECLARE_NO_COPY_CLASS(wxCheckListBoxBase); +}; + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/checklst.h" +#elif defined(__WXMSW__) + #include "wx/msw/checklst.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/checklst.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/checklst.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/checklst.h" +#elif defined(__WXMAC__) + #include "wx/osx/checklst.h" +#elif defined(__WXQT__) + #include "wx/qt/checklst.h" +#endif + +#endif // wxUSE_CHECKLISTBOX + +#endif + // _WX_CHECKLST_H_BASE_ diff --git a/lib/wxWidgets/include/wx/chkconf.h b/lib/wxWidgets/include/wx/chkconf.h new file mode 100644 index 0000000..af53597 --- /dev/null +++ b/lib/wxWidgets/include/wx/chkconf.h @@ -0,0 +1,2472 @@ +/* + * Name: wx/chkconf.h + * Purpose: check the config settings for consistency + * Author: Vadim Zeitlin + * Modified by: + * Created: 09.08.00 + * Copyright: (c) 2000 Vadim Zeitlin + * Licence: wxWindows licence + */ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ +#ifndef _WX_CHKCONF_H_ +#define _WX_CHKCONF_H_ + +/* + ************************************************** + PLEASE READ THIS IF YOU GET AN ERROR IN THIS FILE! + ************************************************** + + If you get an error saying "wxUSE_FOO must be defined", it means that you + are not using the correct up-to-date version of setup.h. If you're building + using makefiles under MSW, also remove setup.h under the build directory + (lib/$(COMPILER)_{lib,dll}/msw[u][d][dll]/wx) so that the new setup.h is + copied there. + + If you get an error of the form "wxFoo requires wxBar", then the settings + in your setup.h are inconsistent. You have the choice between correcting + them manually or commenting out #define wxABORT_ON_CONFIG_ERROR below to + try to correct the problems automatically (not really recommended but + might work). + */ + +/* + This file has the following sections: + 1. checks that all wxUSE_XXX symbols we use are defined + a) first the non-GUI ones + b) then the GUI-only ones + 2. platform-specific checks done in the platform headers + 3. generic consistency checks + a) first the non-GUI ones + b) then the GUI-only ones + */ + +/* + this global setting determines what should we do if the setting FOO + requires BAR and BAR is not set: we can either silently unset FOO as well + (do this if you're trying to build the smallest possible library) or give an + error and abort (default as leads to least surprising behaviour) + */ +#define wxABORT_ON_CONFIG_ERROR + +/* + global features + */ + +/* + If we're compiling without support for threads/exceptions we have to + disable the corresponding features. + */ +#ifdef wxNO_THREADS +# undef wxUSE_THREADS +# define wxUSE_THREADS 0 +#endif /* wxNO_THREADS */ + +#ifdef wxNO_EXCEPTIONS +# undef wxUSE_EXCEPTIONS +# define wxUSE_EXCEPTIONS 0 +#endif /* wxNO_EXCEPTIONS */ + +/* we also must disable exceptions if compiler doesn't support them */ +#if defined(_MSC_VER) && !defined(_CPPUNWIND) +# undef wxUSE_EXCEPTIONS +# define wxUSE_EXCEPTIONS 0 +#endif /* VC++ without exceptions support */ + + +/* + Section 1a: tests for non GUI features. + + please keep the options in alphabetical order! + */ + +#ifndef wxUSE_ANY +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ANY must be defined, please read comment near the top of this file." +# else +# define wxUSE_ANY 0 +# endif +#endif /* wxUSE_ANY */ + +#ifndef wxUSE_COMPILER_TLS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_COMPILER_TLS must be defined, please read comment near the top of this file." +# else +# define wxUSE_COMPILER_TLS 0 +# endif +#endif /* !defined(wxUSE_COMPILER_TLS) */ + +#ifndef wxUSE_CONSOLE_EVENTLOOP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_CONSOLE_EVENTLOOP must be defined, please read comment near the top of this file." +# else +# define wxUSE_CONSOLE_EVENTLOOP 0 +# endif +#endif /* !defined(wxUSE_CONSOLE_EVENTLOOP) */ + +#ifndef wxUSE_DYNLIB_CLASS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DYNLIB_CLASS must be defined, please read comment near the top of this file." +# else +# define wxUSE_DYNLIB_CLASS 0 +# endif +#endif /* !defined(wxUSE_DYNLIB_CLASS) */ + +#ifndef wxUSE_EXCEPTIONS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_EXCEPTIONS must be defined, please read comment near the top of this file." +# else +# define wxUSE_EXCEPTIONS 0 +# endif +#endif /* !defined(wxUSE_EXCEPTIONS) */ + +#ifndef wxUSE_FILE_HISTORY +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_FILE_HISTORY must be defined, please read comment near the top of this file." +# else +# define wxUSE_FILE_HISTORY 0 +# endif +#endif /* !defined(wxUSE_FILE_HISTORY) */ + +#ifndef wxUSE_FILESYSTEM +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_FILESYSTEM must be defined, please read comment near the top of this file." +# else +# define wxUSE_FILESYSTEM 0 +# endif +#endif /* !defined(wxUSE_FILESYSTEM) */ + +#ifndef wxUSE_FS_ARCHIVE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_FS_ARCHIVE must be defined, please read comment near the top of this file." +# else +# define wxUSE_FS_ARCHIVE 0 +# endif +#endif /* !defined(wxUSE_FS_ARCHIVE) */ + +#ifndef wxUSE_FSVOLUME +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_FSVOLUME must be defined, please read comment near the top of this file." +# else +# define wxUSE_FSVOLUME 0 +# endif +#endif /* !defined(wxUSE_FSVOLUME) */ + +#ifndef wxUSE_FSWATCHER +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_FSWATCHER must be defined, please read comment near the top of this file." +# else +# define wxUSE_FSWATCHER 0 +# endif +#endif /* !defined(wxUSE_FSWATCHER) */ + +#ifndef wxUSE_DYNAMIC_LOADER +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DYNAMIC_LOADER must be defined, please read comment near the top of this file." +# else +# define wxUSE_DYNAMIC_LOADER 0 +# endif +#endif /* !defined(wxUSE_DYNAMIC_LOADER) */ + +#ifndef wxUSE_INTL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_INTL must be defined, please read comment near the top of this file." +# else +# define wxUSE_INTL 0 +# endif +#endif /* !defined(wxUSE_INTL) */ + +#ifndef wxUSE_IPV6 +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_IPV6 must be defined, please read comment near the top of this file." +# else +# define wxUSE_IPV6 0 +# endif +#endif /* !defined(wxUSE_IPV6) */ + +#ifndef wxUSE_LOG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LOG must be defined, please read comment near the top of this file." +# else +# define wxUSE_LOG 0 +# endif +#endif /* !defined(wxUSE_LOG) */ + +#ifndef wxUSE_LONGLONG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LONGLONG must be defined, please read comment near the top of this file." +# else +# define wxUSE_LONGLONG 0 +# endif +#endif /* !defined(wxUSE_LONGLONG) */ + +#ifndef wxUSE_MIMETYPE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_MIMETYPE must be defined, please read comment near the top of this file." +# else +# define wxUSE_MIMETYPE 0 +# endif +#endif /* !defined(wxUSE_MIMETYPE) */ + +#ifndef wxUSE_ON_FATAL_EXCEPTION +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ON_FATAL_EXCEPTION must be defined, please read comment near the top of this file." +# else +# define wxUSE_ON_FATAL_EXCEPTION 0 +# endif +#endif /* !defined(wxUSE_ON_FATAL_EXCEPTION) */ + +#ifndef wxUSE_PRINTF_POS_PARAMS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PRINTF_POS_PARAMS must be defined, please read comment near the top of this file." +# else +# define wxUSE_PRINTF_POS_PARAMS 0 +# endif +#endif /* !defined(wxUSE_PRINTF_POS_PARAMS) */ + +#ifndef wxUSE_PROTOCOL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PROTOCOL must be defined, please read comment near the top of this file." +# else +# define wxUSE_PROTOCOL 0 +# endif +#endif /* !defined(wxUSE_PROTOCOL) */ + +/* we may not define wxUSE_PROTOCOL_XXX if wxUSE_PROTOCOL is set to 0 */ +#if !wxUSE_PROTOCOL +# undef wxUSE_PROTOCOL_HTTP +# undef wxUSE_PROTOCOL_FTP +# undef wxUSE_PROTOCOL_FILE +# define wxUSE_PROTOCOL_HTTP 0 +# define wxUSE_PROTOCOL_FTP 0 +# define wxUSE_PROTOCOL_FILE 0 +#endif /* wxUSE_PROTOCOL */ + +#ifndef wxUSE_PROTOCOL_HTTP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PROTOCOL_HTTP must be defined, please read comment near the top of this file." +# else +# define wxUSE_PROTOCOL_HTTP 0 +# endif +#endif /* !defined(wxUSE_PROTOCOL_HTTP) */ + +#ifndef wxUSE_PROTOCOL_FTP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PROTOCOL_FTP must be defined, please read comment near the top of this file." +# else +# define wxUSE_PROTOCOL_FTP 0 +# endif +#endif /* !defined(wxUSE_PROTOCOL_FTP) */ + +#ifndef wxUSE_PROTOCOL_FILE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PROTOCOL_FILE must be defined, please read comment near the top of this file." +# else +# define wxUSE_PROTOCOL_FILE 0 +# endif +#endif /* !defined(wxUSE_PROTOCOL_FILE) */ + +#ifndef wxUSE_REGEX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_REGEX must be defined, please read comment near the top of this file." +# else +# define wxUSE_REGEX 0 +# endif +#endif /* !defined(wxUSE_REGEX) */ + +#ifndef wxUSE_SECRETSTORE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_SECRETSTORE must be defined, please read comment near the top of this file." +# else +# define wxUSE_SECRETSTORE 1 +# endif +#endif /* !defined(wxUSE_SECRETSTORE) */ + +#ifndef wxUSE_SPELLCHECK +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_SPELLCHECK must be defined, please read comment near the top of this file." +# else +# define wxUSE_SPELLCHECK 1 +# endif +#endif /* !defined(wxUSE_SPELLCHECK) */ + +#ifndef wxUSE_STDPATHS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_STDPATHS must be defined, please read comment near the top of this file." +# else +# define wxUSE_STDPATHS 1 +# endif +#endif /* !defined(wxUSE_STDPATHS) */ + +#ifndef wxUSE_XML +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_XML must be defined, please read comment near the top of this file." +# else +# define wxUSE_XML 0 +# endif +#endif /* !defined(wxUSE_XML) */ + +#ifndef wxUSE_SOCKETS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_SOCKETS must be defined, please read comment near the top of this file." +# else +# define wxUSE_SOCKETS 0 +# endif +#endif /* !defined(wxUSE_SOCKETS) */ + +#ifndef wxUSE_STD_CONTAINERS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_STD_CONTAINERS must be defined, please read comment near the top of this file." +# else +# define wxUSE_STD_CONTAINERS 0 +# endif +#endif /* !defined(wxUSE_STD_CONTAINERS) */ + +#ifndef wxUSE_STD_CONTAINERS_COMPATIBLY +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_STD_CONTAINERS_COMPATIBLY must be defined, please read comment near the top of this file." +# else +# define wxUSE_STD_CONTAINERS_COMPATIBLY 0 +# endif +#endif /* !defined(wxUSE_STD_CONTAINERS_COMPATIBLY) */ + +#ifndef wxUSE_STD_STRING_CONV_IN_WXSTRING +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_STD_STRING_CONV_IN_WXSTRING must be defined, please read comment near the top of this file." +# else +# define wxUSE_STD_STRING_CONV_IN_WXSTRING 0 +# endif +#endif /* !defined(wxUSE_STD_STRING_CONV_IN_WXSTRING) */ + +#ifndef wxUSE_STREAMS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_STREAMS must be defined, please read comment near the top of this file." +# else +# define wxUSE_STREAMS 0 +# endif +#endif /* !defined(wxUSE_STREAMS) */ + +#ifndef wxUSE_STOPWATCH +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_STOPWATCH must be defined, please read comment near the top of this file." +# else +# define wxUSE_STOPWATCH 0 +# endif +#endif /* !defined(wxUSE_STOPWATCH) */ + +#ifndef wxUSE_TEXTBUFFER +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TEXTBUFFER must be defined, please read comment near the top of this file." +# else +# define wxUSE_TEXTBUFFER 0 +# endif +#endif /* !defined(wxUSE_TEXTBUFFER) */ + +#ifndef wxUSE_TEXTFILE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TEXTFILE must be defined, please read comment near the top of this file." +# else +# define wxUSE_TEXTFILE 0 +# endif +#endif /* !defined(wxUSE_TEXTFILE) */ + +#ifndef wxUSE_UNICODE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_UNICODE must be defined, please read comment near the top of this file." +# else +# define wxUSE_UNICODE 0 +# endif +#endif /* !defined(wxUSE_UNICODE) */ + +#ifndef wxUSE_UNSAFE_WXSTRING_CONV +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_UNSAFE_WXSTRING_CONV must be defined, please read comment near the top of this file." +# else +# define wxUSE_UNSAFE_WXSTRING_CONV 0 +# endif +#endif /* !defined(wxUSE_UNSAFE_WXSTRING_CONV) */ + +#ifndef wxUSE_URL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_URL must be defined, please read comment near the top of this file." +# else +# define wxUSE_URL 0 +# endif +#endif /* !defined(wxUSE_URL) */ + +#ifndef wxUSE_VARIANT +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_VARIANT must be defined, please read comment near the top of this file." +# else +# define wxUSE_VARIANT 0 +# endif +#endif /* wxUSE_VARIANT */ + +#ifndef wxUSE_XLOCALE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_XLOCALE must be defined, please read comment near the top of this file." +# else +# define wxUSE_XLOCALE 0 +# endif +#endif /* !defined(wxUSE_XLOCALE) */ + +/* + Section 1b: all these tests are for GUI only. + + please keep the options in alphabetical order! + */ +#if wxUSE_GUI + +/* + all of the settings tested below must be defined or we'd get an error from + preprocessor about invalid integer expression + */ + +#ifndef wxUSE_ABOUTDLG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ABOUTDLG must be defined, please read comment near the top of this file." +# else +# define wxUSE_ABOUTDLG 0 +# endif +#endif /* !defined(wxUSE_ABOUTDLG) */ + +#ifndef wxUSE_ACCEL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ACCEL must be defined, please read comment near the top of this file." +# else +# define wxUSE_ACCEL 0 +# endif +#endif /* !defined(wxUSE_ACCEL) */ + +#ifndef wxUSE_ACCESSIBILITY +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ACCESSIBILITY must be defined, please read comment near the top of this file." +# else +# define wxUSE_ACCESSIBILITY 0 +# endif +#endif /* !defined(wxUSE_ACCESSIBILITY) */ + +#ifndef wxUSE_ADDREMOVECTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ADDREMOVECTRL must be defined, please read comment near the top of this file." +# else +# define wxUSE_ADDREMOVECTRL 0 +# endif +#endif /* !defined(wxUSE_ADDREMOVECTRL) */ + +#ifndef wxUSE_ACTIVITYINDICATOR +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ACTIVITYINDICATOR must be defined, please read comment near the top of this file." +# else +# define wxUSE_ACTIVITYINDICATOR 0 +# endif +#endif /* !defined(wxUSE_ACTIVITYINDICATOR) */ + +#ifndef wxUSE_ANIMATIONCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ANIMATIONCTRL must be defined, please read comment near the top of this file." +# else +# define wxUSE_ANIMATIONCTRL 0 +# endif +#endif /* !defined(wxUSE_ANIMATIONCTRL) */ + +#ifndef wxUSE_ARTPROVIDER_STD +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ARTPROVIDER_STD must be defined, please read comment near the top of this file." +# else +# define wxUSE_ARTPROVIDER_STD 0 +# endif +#endif /* !defined(wxUSE_ARTPROVIDER_STD) */ + +#ifndef wxUSE_ARTPROVIDER_TANGO +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ARTPROVIDER_TANGO must be defined, please read comment near the top of this file." +# else +# define wxUSE_ARTPROVIDER_TANGO 0 +# endif +#endif /* !defined(wxUSE_ARTPROVIDER_TANGO) */ + +#ifndef wxUSE_AUTOID_MANAGEMENT +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_AUTOID_MANAGEMENT must be defined, please read comment near the top of this file." +# else +# define wxUSE_AUTOID_MANAGEMENT 0 +# endif +#endif /* !defined(wxUSE_AUTOID_MANAGEMENT) */ + +#ifndef wxUSE_BITMAPCOMBOBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_BITMAPCOMBOBOX must be defined, please read comment near the top of this file." +# else +# define wxUSE_BITMAPCOMBOBOX 0 +# endif +#endif /* !defined(wxUSE_BITMAPCOMBOBOX) */ + +#ifndef wxUSE_BMPBUTTON +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_BMPBUTTON must be defined, please read comment near the top of this file." +# else +# define wxUSE_BMPBUTTON 0 +# endif +#endif /* !defined(wxUSE_BMPBUTTON) */ + +#ifndef wxUSE_BUTTON +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_BUTTON must be defined, please read comment near the top of this file." +# else +# define wxUSE_BUTTON 0 +# endif +#endif /* !defined(wxUSE_BUTTON) */ + +#ifndef wxUSE_CAIRO +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_CAIRO must be defined, please read comment near the top of this file." +# else +# define wxUSE_CAIRO 0 +# endif +#endif /* !defined(wxUSE_CAIRO) */ + +#ifndef wxUSE_CALENDARCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_CALENDARCTRL must be defined, please read comment near the top of this file." +# else +# define wxUSE_CALENDARCTRL 0 +# endif +#endif /* !defined(wxUSE_CALENDARCTRL) */ + +#ifndef wxUSE_CARET +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_CARET must be defined, please read comment near the top of this file." +# else +# define wxUSE_CARET 0 +# endif +#endif /* !defined(wxUSE_CARET) */ + +#ifndef wxUSE_CHECKBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_CHECKBOX must be defined, please read comment near the top of this file." +# else +# define wxUSE_CHECKBOX 0 +# endif +#endif /* !defined(wxUSE_CHECKBOX) */ + +#ifndef wxUSE_CHECKLISTBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_CHECKLISTBOX must be defined, please read comment near the top of this file." +# else +# define wxUSE_CHECKLISTBOX 0 +# endif +#endif /* !defined(wxUSE_CHECKLISTBOX) */ + +#ifndef wxUSE_CHOICE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_CHOICE must be defined, please read comment near the top of this file." +# else +# define wxUSE_CHOICE 0 +# endif +#endif /* !defined(wxUSE_CHOICE) */ + +#ifndef wxUSE_CHOICEBOOK +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_CHOICEBOOK must be defined, please read comment near the top of this file." +# else +# define wxUSE_CHOICEBOOK 0 +# endif +#endif /* !defined(wxUSE_CHOICEBOOK) */ + +#ifndef wxUSE_CHOICEDLG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_CHOICEDLG must be defined, please read comment near the top of this file." +# else +# define wxUSE_CHOICEDLG 0 +# endif +#endif /* !defined(wxUSE_CHOICEDLG) */ + +#ifndef wxUSE_CLIPBOARD +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_CLIPBOARD must be defined, please read comment near the top of this file." +# else +# define wxUSE_CLIPBOARD 0 +# endif +#endif /* !defined(wxUSE_CLIPBOARD) */ + +#ifndef wxUSE_COLLPANE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_COLLPANE must be defined, please read comment near the top of this file." +# else +# define wxUSE_COLLPANE 0 +# endif +#endif /* !defined(wxUSE_COLLPANE) */ + +#ifndef wxUSE_COLOURDLG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_COLOURDLG must be defined, please read comment near the top of this file." +# else +# define wxUSE_COLOURDLG 0 +# endif +#endif /* !defined(wxUSE_COLOURDLG) */ + +#ifndef wxUSE_COLOURPICKERCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_COLOURPICKERCTRL must be defined, please read comment near the top of this file." +# else +# define wxUSE_COLOURPICKERCTRL 0 +# endif +#endif /* !defined(wxUSE_COLOURPICKERCTRL) */ + +#ifndef wxUSE_COMBOBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_COMBOBOX must be defined, please read comment near the top of this file." +# else +# define wxUSE_COMBOBOX 0 +# endif +#endif /* !defined(wxUSE_COMBOBOX) */ + +#ifndef wxUSE_COMMANDLINKBUTTON +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_COMMANDLINKBUTTON must be defined, please read comment near the top of this file." +# else +# define wxUSE_COMMANDLINKBUTTON 0 +# endif +#endif /* !defined(wxUSE_COMMANDLINKBUTTON) */ + +#ifndef wxUSE_COMBOCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_COMBOCTRL must be defined, please read comment near the top of this file." +# else +# define wxUSE_COMBOCTRL 0 +# endif +#endif /* !defined(wxUSE_COMBOCTRL) */ + +#ifndef wxUSE_DATAOBJ +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DATAOBJ must be defined, please read comment near the top of this file." +# else +# define wxUSE_DATAOBJ 0 +# endif +#endif /* !defined(wxUSE_DATAOBJ) */ + +#ifndef wxUSE_DATAVIEWCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DATAVIEWCTRL must be defined, please read comment near the top of this file." +# else +# define wxUSE_DATAVIEWCTRL 0 +# endif +#endif /* !defined(wxUSE_DATAVIEWCTRL) */ + +#ifndef wxUSE_NATIVE_DATAVIEWCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_NATIVE_DATAVIEWCTRL must be defined, please read comment near the top of this file." +# else +# define wxUSE_NATIVE_DATAVIEWCTRL 1 +# endif +#endif /* !defined(wxUSE_NATIVE_DATAVIEWCTRL) */ + +#ifndef wxUSE_DATEPICKCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DATEPICKCTRL must be defined, please read comment near the top of this file." +# else +# define wxUSE_DATEPICKCTRL 0 +# endif +#endif /* !defined(wxUSE_DATEPICKCTRL) */ + +#ifndef wxUSE_DC_TRANSFORM_MATRIX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DC_TRANSFORM_MATRIX must be defined, please read comment near the top of this file." +# else +# define wxUSE_DC_TRANSFORM_MATRIX 1 +# endif +#endif /* wxUSE_DC_TRANSFORM_MATRIX */ + +#ifndef wxUSE_DIRPICKERCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DIRPICKERCTRL must be defined, please read comment near the top of this file." +# else +# define wxUSE_DIRPICKERCTRL 0 +# endif +#endif /* !defined(wxUSE_DIRPICKERCTRL) */ + +#ifndef wxUSE_DISPLAY +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DISPLAY must be defined, please read comment near the top of this file." +# else +# define wxUSE_DISPLAY 0 +# endif +#endif /* !defined(wxUSE_DISPLAY) */ + +#ifndef wxUSE_DOC_VIEW_ARCHITECTURE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DOC_VIEW_ARCHITECTURE must be defined, please read comment near the top of this file." +# else +# define wxUSE_DOC_VIEW_ARCHITECTURE 0 +# endif +#endif /* !defined(wxUSE_DOC_VIEW_ARCHITECTURE) */ + +#ifndef wxUSE_FILECTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_FILECTRL must be defined, please read comment near the top of this file." +# else +# define wxUSE_FILECTRL 0 +# endif +#endif /* !defined(wxUSE_FILECTRL) */ + +#ifndef wxUSE_FILEDLG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_FILEDLG must be defined, please read comment near the top of this file." +# else +# define wxUSE_FILEDLG 0 +# endif +#endif /* !defined(wxUSE_FILEDLG) */ + +#ifndef wxUSE_FILEPICKERCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_FILEPICKERCTRL must be defined, please read comment near the top of this file." +# else +# define wxUSE_FILEPICKERCTRL 0 +# endif +#endif /* !defined(wxUSE_FILEPICKERCTRL) */ + +#ifndef wxUSE_FONTDLG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_FONTDLG must be defined, please read comment near the top of this file." +# else +# define wxUSE_FONTDLG 0 +# endif +#endif /* !defined(wxUSE_FONTDLG) */ + +#ifndef wxUSE_FONTMAP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_FONTMAP must be defined, please read comment near the top of this file." +# else +# define wxUSE_FONTMAP 0 +# endif +#endif /* !defined(wxUSE_FONTMAP) */ + +#ifndef wxUSE_FONTPICKERCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_FONTPICKERCTRL must be defined, please read comment near the top of this file." +# else +# define wxUSE_FONTPICKERCTRL 0 +# endif +#endif /* !defined(wxUSE_FONTPICKERCTRL) */ + +#ifndef wxUSE_GAUGE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_GAUGE must be defined, please read comment near the top of this file." +# else +# define wxUSE_GAUGE 0 +# endif +#endif /* !defined(wxUSE_GAUGE) */ + +#ifndef wxUSE_GRAPHICS_CONTEXT +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_GRAPHICS_CONTEXT must be defined, please read comment near the top of this file." +# else +# define wxUSE_GRAPHICS_CONTEXT 0 +# endif +#endif /* !defined(wxUSE_GRAPHICS_CONTEXT) */ + + +#ifndef wxUSE_GRID +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_GRID must be defined, please read comment near the top of this file." +# else +# define wxUSE_GRID 0 +# endif +#endif /* !defined(wxUSE_GRID) */ + +#ifndef wxUSE_HEADERCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_HEADERCTRL must be defined, please read comment near the top of this file." +# else +# define wxUSE_HEADERCTRL 0 +# endif +#endif /* !defined(wxUSE_HEADERCTRL) */ + +#ifndef wxUSE_HELP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_HELP must be defined, please read comment near the top of this file." +# else +# define wxUSE_HELP 0 +# endif +#endif /* !defined(wxUSE_HELP) */ + +#ifndef wxUSE_HYPERLINKCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_HYPERLINKCTRL must be defined, please read comment near the top of this file." +# else +# define wxUSE_HYPERLINKCTRL 0 +# endif +#endif /* !defined(wxUSE_HYPERLINKCTRL) */ + +#ifndef wxUSE_HTML +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_HTML must be defined, please read comment near the top of this file." +# else +# define wxUSE_HTML 0 +# endif +#endif /* !defined(wxUSE_HTML) */ + +#ifndef wxUSE_LIBMSPACK +# if !defined(__UNIX__) + /* set to 0 on platforms that don't have libmspack */ +# define wxUSE_LIBMSPACK 0 +# else +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LIBMSPACK must be defined, please read comment near the top of this file." +# else +# define wxUSE_LIBMSPACK 0 +# endif +# endif +#endif /* !defined(wxUSE_LIBMSPACK) */ + +#ifndef wxUSE_ICO_CUR +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ICO_CUR must be defined, please read comment near the top of this file." +# else +# define wxUSE_ICO_CUR 0 +# endif +#endif /* !defined(wxUSE_ICO_CUR) */ + +#ifndef wxUSE_IFF +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_IFF must be defined, please read comment near the top of this file." +# else +# define wxUSE_IFF 0 +# endif +#endif /* !defined(wxUSE_IFF) */ + +#ifndef wxUSE_IMAGLIST +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_IMAGLIST must be defined, please read comment near the top of this file." +# else +# define wxUSE_IMAGLIST 0 +# endif +#endif /* !defined(wxUSE_IMAGLIST) */ + +#ifndef wxUSE_INFOBAR +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_INFOBAR must be defined, please read comment near the top of this file." +# else +# define wxUSE_INFOBAR 0 +# endif +#endif /* !defined(wxUSE_INFOBAR) */ + +#ifndef wxUSE_JOYSTICK +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_JOYSTICK must be defined, please read comment near the top of this file." +# else +# define wxUSE_JOYSTICK 0 +# endif +#endif /* !defined(wxUSE_JOYSTICK) */ + +#ifndef wxUSE_LISTBOOK +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LISTBOOK must be defined, please read comment near the top of this file." +# else +# define wxUSE_LISTBOOK 0 +# endif +#endif /* !defined(wxUSE_LISTBOOK) */ + +#ifndef wxUSE_LISTBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LISTBOX must be defined, please read comment near the top of this file." +# else +# define wxUSE_LISTBOX 0 +# endif +#endif /* !defined(wxUSE_LISTBOX) */ + +#ifndef wxUSE_LISTCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LISTCTRL must be defined, please read comment near the top of this file." +# else +# define wxUSE_LISTCTRL 0 +# endif +#endif /* !defined(wxUSE_LISTCTRL) */ + +#ifndef wxUSE_LOGGUI +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LOGGUI must be defined, please read comment near the top of this file." +# else +# define wxUSE_LOGGUI 0 +# endif +#endif /* !defined(wxUSE_LOGGUI) */ + +#ifndef wxUSE_LOGWINDOW +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LOGWINDOW must be defined, please read comment near the top of this file." +# else +# define wxUSE_LOGWINDOW 0 +# endif +#endif /* !defined(wxUSE_LOGWINDOW) */ + +#ifndef wxUSE_LOG_DIALOG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LOG_DIALOG must be defined, please read comment near the top of this file." +# else +# define wxUSE_LOG_DIALOG 0 +# endif +#endif /* !defined(wxUSE_LOG_DIALOG) */ + +#ifndef wxUSE_MARKUP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_MARKUP must be defined, please read comment near the top of this file." +# else +# define wxUSE_MARKUP 0 +# endif +#endif /* !defined(wxUSE_MARKUP) */ + +#ifndef wxUSE_MDI +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_MDI must be defined, please read comment near the top of this file." +# else +# define wxUSE_MDI 0 +# endif +#endif /* !defined(wxUSE_MDI) */ + +#ifndef wxUSE_MDI_ARCHITECTURE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_MDI_ARCHITECTURE must be defined, please read comment near the top of this file." +# else +# define wxUSE_MDI_ARCHITECTURE 0 +# endif +#endif /* !defined(wxUSE_MDI_ARCHITECTURE) */ + +#ifndef wxUSE_MENUBAR +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_MENUBAR must be defined, please read comment near the top of this file." +# else +# define wxUSE_MENUBAR 0 +# endif +#endif /* !defined(wxUSE_MENUBAR) */ + +#ifndef wxUSE_MENUS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_MENUS must be defined, please read comment near the top of this file." +# else +# define wxUSE_MENUS 0 +# endif +#endif /* !defined(wxUSE_MENUS) */ + +#ifndef wxUSE_MSGDLG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_MSGDLG must be defined, please read comment near the top of this file." +# else +# define wxUSE_MSGDLG 0 +# endif +#endif /* !defined(wxUSE_MSGDLG) */ + +#ifndef wxUSE_NOTEBOOK +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_NOTEBOOK must be defined, please read comment near the top of this file." +# else +# define wxUSE_NOTEBOOK 0 +# endif +#endif /* !defined(wxUSE_NOTEBOOK) */ + +#ifndef wxUSE_NOTIFICATION_MESSAGE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_NOTIFICATION_MESSAGE must be defined, please read comment near the top of this file." +# else +# define wxUSE_NOTIFICATION_MESSAGE 0 +# endif +#endif /* !defined(wxUSE_NOTIFICATION_MESSAGE) */ + +#ifndef wxUSE_ODCOMBOBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ODCOMBOBOX must be defined, please read comment near the top of this file." +# else +# define wxUSE_ODCOMBOBOX 0 +# endif +#endif /* !defined(wxUSE_ODCOMBOBOX) */ + +#ifndef wxUSE_PALETTE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PALETTE must be defined, please read comment near the top of this file." +# else +# define wxUSE_PALETTE 0 +# endif +#endif /* !defined(wxUSE_PALETTE) */ + +#ifndef wxUSE_POPUPWIN +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_POPUPWIN must be defined, please read comment near the top of this file." +# else +# define wxUSE_POPUPWIN 0 +# endif +#endif /* !defined(wxUSE_POPUPWIN) */ + +#ifndef wxUSE_PREFERENCES_EDITOR +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PREFERENCES_EDITOR must be defined, please read comment near the top of this file." +# else +# define wxUSE_PREFERENCES_EDITOR 0 +# endif +#endif /* !defined(wxUSE_PREFERENCES_EDITOR) */ + +#ifndef wxUSE_PRIVATE_FONTS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PRIVATE_FONTS must be defined, please read comment near the top of this file." +# else +# define wxUSE_PRIVATE_FONTS 0 +# endif +#endif /* !defined(wxUSE_PRIVATE_FONTS) */ + +#ifndef wxUSE_PRINTING_ARCHITECTURE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PRINTING_ARCHITECTURE must be defined, please read comment near the top of this file." +# else +# define wxUSE_PRINTING_ARCHITECTURE 0 +# endif +#endif /* !defined(wxUSE_PRINTING_ARCHITECTURE) */ + +#ifndef wxUSE_RADIOBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_RADIOBOX must be defined, please read comment near the top of this file." +# else +# define wxUSE_RADIOBOX 0 +# endif +#endif /* !defined(wxUSE_RADIOBOX) */ + +#ifndef wxUSE_RADIOBTN +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_RADIOBTN must be defined, please read comment near the top of this file." +# else +# define wxUSE_RADIOBTN 0 +# endif +#endif /* !defined(wxUSE_RADIOBTN) */ + +#ifndef wxUSE_REARRANGECTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_REARRANGECTRL must be defined, please read comment near the top of this file." +# else +# define wxUSE_REARRANGECTRL 0 +# endif +#endif /* !defined(wxUSE_REARRANGECTRL) */ + +#ifndef wxUSE_RIBBON +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_RIBBON must be defined, please read comment near the top of this file." +# else +# define wxUSE_RIBBON 0 +# endif +#endif /* !defined(wxUSE_RIBBON) */ + +#ifndef wxUSE_RICHMSGDLG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_RICHMSGDLG must be defined, please read comment near the top of this file." +# else +# define wxUSE_RICHMSGDLG 0 +# endif +#endif /* !defined(wxUSE_RICHMSGDLG) */ + +#ifndef wxUSE_RICHTOOLTIP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_RICHTOOLTIP must be defined, please read comment near the top of this file." +# else +# define wxUSE_RICHTOOLTIP 0 +# endif +#endif /* !defined(wxUSE_RICHTOOLTIP) */ + +#ifndef wxUSE_SASH +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_SASH must be defined, please read comment near the top of this file." +# else +# define wxUSE_SASH 0 +# endif +#endif /* !defined(wxUSE_SASH) */ + +#ifndef wxUSE_SCROLLBAR +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_SCROLLBAR must be defined, please read comment near the top of this file." +# else +# define wxUSE_SCROLLBAR 0 +# endif +#endif /* !defined(wxUSE_SCROLLBAR) */ + +#ifndef wxUSE_SLIDER +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_SLIDER must be defined, please read comment near the top of this file." +# else +# define wxUSE_SLIDER 0 +# endif +#endif /* !defined(wxUSE_SLIDER) */ + +#ifndef wxUSE_SOUND +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_SOUND must be defined, please read comment near the top of this file." +# else +# define wxUSE_SOUND 0 +# endif +#endif /* !defined(wxUSE_SOUND) */ + +#ifndef wxUSE_SPINBTN +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_SPINBTN must be defined, please read comment near the top of this file." +# else +# define wxUSE_SPINBTN 0 +# endif +#endif /* !defined(wxUSE_SPINBTN) */ + +#ifndef wxUSE_SPINCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_SPINCTRL must be defined, please read comment near the top of this file." +# else +# define wxUSE_SPINCTRL 0 +# endif +#endif /* !defined(wxUSE_SPINCTRL) */ + +#ifndef wxUSE_SPLASH +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_SPLASH must be defined, please read comment near the top of this file." +# else +# define wxUSE_SPLASH 0 +# endif +#endif /* !defined(wxUSE_SPLASH) */ + +#ifndef wxUSE_SPLITTER +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_SPLITTER must be defined, please read comment near the top of this file." +# else +# define wxUSE_SPLITTER 0 +# endif +#endif /* !defined(wxUSE_SPLITTER) */ + +#ifndef wxUSE_STATBMP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_STATBMP must be defined, please read comment near the top of this file." +# else +# define wxUSE_STATBMP 0 +# endif +#endif /* !defined(wxUSE_STATBMP) */ + +#ifndef wxUSE_STATBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_STATBOX must be defined, please read comment near the top of this file." +# else +# define wxUSE_STATBOX 0 +# endif +#endif /* !defined(wxUSE_STATBOX) */ + +#ifndef wxUSE_STATLINE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_STATLINE must be defined, please read comment near the top of this file." +# else +# define wxUSE_STATLINE 0 +# endif +#endif /* !defined(wxUSE_STATLINE) */ + +#ifndef wxUSE_STATTEXT +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_STATTEXT must be defined, please read comment near the top of this file." +# else +# define wxUSE_STATTEXT 0 +# endif +#endif /* !defined(wxUSE_STATTEXT) */ + +#ifndef wxUSE_STATUSBAR +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_STATUSBAR must be defined, please read comment near the top of this file." +# else +# define wxUSE_STATUSBAR 0 +# endif +#endif /* !defined(wxUSE_STATUSBAR) */ + +#ifndef wxUSE_TASKBARICON +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TASKBARICON must be defined, please read comment near the top of this file." +# else +# define wxUSE_TASKBARICON 0 +# endif +#endif /* !defined(wxUSE_TASKBARICON) */ + +#ifndef wxUSE_TEXTCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TEXTCTRL must be defined, please read comment near the top of this file." +# else +# define wxUSE_TEXTCTRL 0 +# endif +#endif /* !defined(wxUSE_TEXTCTRL) */ + +#ifndef wxUSE_TIMEPICKCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TIMEPICKCTRL must be defined, please read comment near the top of this file." +# else +# define wxUSE_TIMEPICKCTRL 0 +# endif +#endif /* !defined(wxUSE_TIMEPICKCTRL) */ + +#ifndef wxUSE_TIPWINDOW +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TIPWINDOW must be defined, please read comment near the top of this file." +# else +# define wxUSE_TIPWINDOW 0 +# endif +#endif /* !defined(wxUSE_TIPWINDOW) */ + +#ifndef wxUSE_TOOLBAR +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TOOLBAR must be defined, please read comment near the top of this file." +# else +# define wxUSE_TOOLBAR 0 +# endif +#endif /* !defined(wxUSE_TOOLBAR) */ + +#ifndef wxUSE_TOOLTIPS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TOOLTIPS must be defined, please read comment near the top of this file." +# else +# define wxUSE_TOOLTIPS 0 +# endif +#endif /* !defined(wxUSE_TOOLTIPS) */ + +#ifndef wxUSE_TREECTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TREECTRL must be defined, please read comment near the top of this file." +# else +# define wxUSE_TREECTRL 0 +# endif +#endif /* !defined(wxUSE_TREECTRL) */ + +#ifndef wxUSE_TREELISTCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TREELISTCTRL must be defined, please read comment near the top of this file." +# else +# define wxUSE_TREELISTCTRL 0 +# endif +#endif /* !defined(wxUSE_TREELISTCTRL) */ + +#ifndef wxUSE_UIACTIONSIMULATOR +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_UIACTIONSIMULATOR must be defined, please read comment near the top of this file." +# else +# define wxUSE_UIACTIONSIMULATOR 0 +# endif +#endif /* !defined(wxUSE_UIACTIONSIMULATOR) */ + +#ifndef wxUSE_VALIDATORS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_VALIDATORS must be defined, please read comment near the top of this file." +# else +# define wxUSE_VALIDATORS 0 +# endif +#endif /* !defined(wxUSE_VALIDATORS) */ + +#ifndef wxUSE_WEBREQUEST +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_WEBREQUEST must be defined, please read comment near the top of this file." +# else +# define wxUSE_WEBREQUEST 0 +# endif +#endif /* !defined(wxUSE_WEBREQUEST) */ + +#ifndef wxUSE_WEBVIEW +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_WEBVIEW must be defined, please read comment near the top of this file." +# else +# define wxUSE_WEBVIEW 0 +# endif +#endif /* !defined(wxUSE_WEBVIEW) */ + +#ifndef wxUSE_WXHTML_HELP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_WXHTML_HELP must be defined, please read comment near the top of this file." +# else +# define wxUSE_WXHTML_HELP 0 +# endif +#endif /* !defined(wxUSE_WXHTML_HELP) */ + +#ifndef wxUSE_XRC +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_XRC must be defined, please read comment near the top of this file." +# else +# define wxUSE_XRC 0 +# endif +#endif /* !defined(wxUSE_XRC) */ + +#endif /* wxUSE_GUI */ + +/* + Section 2: platform-specific checks. + + This must be done after checking that everything is defined as the platform + checks use wxUSE_XXX symbols in #if tests. + */ + +#if defined(__WINDOWS__) +# include "wx/msw/chkconf.h" +# if defined(__WXGTK__) +# include "wx/gtk/chkconf.h" +# endif +#elif defined(__WXGTK__) +# include "wx/gtk/chkconf.h" +#elif defined(__WXMAC__) +# include "wx/osx/chkconf.h" +#elif defined(__WXDFB__) +# include "wx/dfb/chkconf.h" +#elif defined(__WXMOTIF__) +# include "wx/motif/chkconf.h" +#elif defined(__WXX11__) +# include "wx/x11/chkconf.h" +#elif defined(__WXANDROID__) +# include "wx/android/chkconf.h" +#endif + +/* + __UNIX__ is also defined under Cygwin but we shouldn't perform these checks + there if we're building Windows ports. + */ +#if defined(__UNIX__) && !defined(__WINDOWS__) +# include "wx/unix/chkconf.h" +#endif + +#ifdef __WXUNIVERSAL__ +# include "wx/univ/chkconf.h" +#endif + +/* + Section 3a: check consistency of the non-GUI settings. + */ + +#if WXWIN_COMPATIBILITY_2_8 +# if !WXWIN_COMPATIBILITY_3_0 +# ifdef wxABORT_ON_CONFIG_ERROR +# error "2.8.X compatibility requires 3.0.X compatibility" +# else +# undef WXWIN_COMPATIBILITY_3_0 +# define WXWIN_COMPATIBILITY_3_0 1 +# endif +# endif +#endif /* WXWIN_COMPATIBILITY_2_8 */ + +#if wxUSE_ARCHIVE_STREAMS +# if !wxUSE_DATETIME +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxArchive requires wxUSE_DATETIME" +# else +# undef wxUSE_ARCHIVE_STREAMS +# define wxUSE_ARCHIVE_STREAMS 0 +# endif +# endif +#endif /* wxUSE_ARCHIVE_STREAMS */ + +#if wxUSE_PROTOCOL_FILE || wxUSE_PROTOCOL_FTP || wxUSE_PROTOCOL_HTTP +# if !wxUSE_PROTOCOL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PROTOCOL_XXX requires wxUSE_PROTOCOL" +# else +# undef wxUSE_PROTOCOL +# define wxUSE_PROTOCOL 1 +# endif +# endif +#endif /* wxUSE_PROTOCOL_XXX */ + +#if wxUSE_URL +# if !wxUSE_PROTOCOL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_URL requires wxUSE_PROTOCOL" +# else +# undef wxUSE_PROTOCOL +# define wxUSE_PROTOCOL 1 +# endif +# endif +#endif /* wxUSE_URL */ + +#if wxUSE_PROTOCOL +# if !wxUSE_SOCKETS +# if wxUSE_PROTOCOL_HTTP || wxUSE_PROTOCOL_FTP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PROTOCOL_FTP/HTTP requires wxUSE_SOCKETS" +# else +# undef wxUSE_SOCKETS +# define wxUSE_SOCKETS 1 +# endif +# endif +# endif + +# if !wxUSE_STREAMS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PROTOCOL requires wxUSE_STREAMS" +# else +# undef wxUSE_STREAMS +# define wxUSE_STREAMS 1 +# endif +# endif +#endif /* wxUSE_PROTOCOL */ + +/* have to test for wxUSE_HTML before wxUSE_FILESYSTEM */ +#if wxUSE_HTML +# if !wxUSE_FILESYSTEM +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxHTML requires wxFileSystem" +# else +# undef wxUSE_FILESYSTEM +# define wxUSE_FILESYSTEM 1 +# endif +# endif +#endif /* wxUSE_HTML */ + +#if wxUSE_FS_ARCHIVE +# if !wxUSE_FILESYSTEM +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxArchiveFSHandler requires wxFileSystem" +# else +# undef wxUSE_FILESYSTEM +# define wxUSE_FILESYSTEM 1 +# endif +# endif +# if !wxUSE_ARCHIVE_STREAMS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxArchiveFSHandler requires wxArchive" +# else +# undef wxUSE_ARCHIVE_STREAMS +# define wxUSE_ARCHIVE_STREAMS 1 +# endif +# endif +#endif /* wxUSE_FS_ARCHIVE */ + +#if wxUSE_FILESYSTEM +# if !wxUSE_STREAMS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_FILESYSTEM requires wxUSE_STREAMS" +# else +# undef wxUSE_STREAMS +# define wxUSE_STREAMS 1 +# endif +# endif +# if !wxUSE_FILE && !wxUSE_FFILE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_FILESYSTEM requires either wxUSE_FILE or wxUSE_FFILE" +# else +# undef wxUSE_FILE +# define wxUSE_FILE 1 +# undef wxUSE_FFILE +# define wxUSE_FFILE 1 +# endif +# endif +#endif /* wxUSE_FILESYSTEM */ + +#if wxUSE_FS_INET +# if !wxUSE_PROTOCOL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_FS_INET requires wxUSE_PROTOCOL" +# else +# undef wxUSE_PROTOCOL +# define wxUSE_PROTOCOL 1 +# endif +# endif +#endif /* wxUSE_FS_INET */ + +#if wxUSE_STOPWATCH || wxUSE_DATETIME +# if !wxUSE_LONGLONG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_STOPWATCH and wxUSE_DATETIME require wxUSE_LONGLONG" +# else +# undef wxUSE_LONGLONG +# define wxUSE_LONGLONG 1 +# endif +# endif +#endif /* wxUSE_STOPWATCH */ + +#if wxUSE_MIMETYPE && !wxUSE_TEXTFILE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_MIMETYPE requires wxUSE_TEXTFILE" +# else +# undef wxUSE_TEXTFILE +# define wxUSE_TEXTFILE 1 +# endif +#endif /* wxUSE_MIMETYPE */ + +#if wxUSE_TEXTFILE && !wxUSE_TEXTBUFFER +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TEXTFILE requires wxUSE_TEXTBUFFER" +# else +# undef wxUSE_TEXTBUFFER +# define wxUSE_TEXTBUFFER 1 +# endif +#endif /* wxUSE_TEXTFILE */ + +#if wxUSE_TEXTFILE && !wxUSE_FILE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TEXTFILE requires wxUSE_FILE" +# else +# undef wxUSE_FILE +# define wxUSE_FILE 1 +# endif +#endif /* wxUSE_TEXTFILE */ + +#if !wxUSE_DYNLIB_CLASS +# if wxUSE_DYNAMIC_LOADER +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DYNAMIC_LOADER requires wxUSE_DYNLIB_CLASS." +# else +# define wxUSE_DYNLIB_CLASS 1 +# endif +# endif +#endif /* wxUSE_DYNLIB_CLASS */ + +#if wxUSE_ZIPSTREAM +# if !wxUSE_ZLIB +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxZip requires wxZlib" +# else +# undef wxUSE_ZLIB +# define wxUSE_ZLIB 1 +# endif +# endif +# if !wxUSE_ARCHIVE_STREAMS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxZip requires wxArchive" +# else +# undef wxUSE_ARCHIVE_STREAMS +# define wxUSE_ARCHIVE_STREAMS 1 +# endif +# endif +#endif /* wxUSE_ZIPSTREAM */ + +#if wxUSE_TARSTREAM +# if !wxUSE_ARCHIVE_STREAMS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxTar requires wxArchive" +# else +# undef wxUSE_ARCHIVE_STREAMS +# define wxUSE_ARCHIVE_STREAMS 1 +# endif +# endif +#endif /* wxUSE_TARSTREAM */ + +/* + Section 3b: the tests for the GUI settings only. + */ +#if wxUSE_GUI + +#if wxUSE_ACCESSIBILITY && !defined(__WXMSW__) +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ACCESSIBILITY is currently only supported under wxMSW" +# else +# undef wxUSE_ACCESSIBILITY +# define wxUSE_ACCESSIBILITY 0 +# endif +#endif /* wxUSE_ACCESSIBILITY */ + +#if wxUSE_BUTTON || \ + wxUSE_CALENDARCTRL || \ + wxUSE_CARET || \ + wxUSE_COMBOBOX || \ + wxUSE_BMPBUTTON || \ + wxUSE_CHECKBOX || \ + wxUSE_CHECKLISTBOX || \ + wxUSE_CHOICE || \ + wxUSE_GAUGE || \ + wxUSE_GRID || \ + wxUSE_HEADERCTRL || \ + wxUSE_LISTBOX || \ + wxUSE_LISTCTRL || \ + wxUSE_NOTEBOOK || \ + wxUSE_RADIOBOX || \ + wxUSE_RADIOBTN || \ + wxUSE_REARRANGECTRL || \ + wxUSE_SCROLLBAR || \ + wxUSE_SLIDER || \ + wxUSE_SPINBTN || \ + wxUSE_SPINCTRL || \ + wxUSE_STATBMP || \ + wxUSE_STATBOX || \ + wxUSE_STATLINE || \ + wxUSE_STATTEXT || \ + wxUSE_STATUSBAR || \ + wxUSE_TEXTCTRL || \ + wxUSE_TOOLBAR || \ + wxUSE_TREECTRL || \ + wxUSE_TREELISTCTRL +# if !wxUSE_CONTROLS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_CONTROLS unset but some controls used" +# else +# undef wxUSE_CONTROLS +# define wxUSE_CONTROLS 1 +# endif +# endif +#endif /* controls */ + +#if wxUSE_ADDREMOVECTRL +# if !wxUSE_BMPBUTTON +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ADDREMOVECTRL requires wxUSE_BMPBUTTON" +# else +# undef wxUSE_ADDREMOVECTRL +# define wxUSE_ADDREMOVECTRL 0 +# endif +# endif +#endif /* wxUSE_ADDREMOVECTRL */ + +#if wxUSE_ANIMATIONCTRL +# if !wxUSE_STREAMS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ANIMATIONCTRL requires wxUSE_STREAMS" +# else +# undef wxUSE_ANIMATIONCTRL +# define wxUSE_ANIMATIONCTRL 0 +# endif +# endif +#endif /* wxUSE_ANIMATIONCTRL */ + +#if wxUSE_BMPBUTTON +# if !wxUSE_BUTTON +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_BMPBUTTON requires wxUSE_BUTTON" +# else +# undef wxUSE_BUTTON +# define wxUSE_BUTTON 1 +# endif +# endif +#endif /* wxUSE_BMPBUTTON */ + +#if wxUSE_COMMANDLINKBUTTON +# if !wxUSE_BUTTON +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_COMMANDLINKBUTTON requires wxUSE_BUTTON" +# else +# undef wxUSE_BUTTON +# define wxUSE_BUTTON 1 +# endif +# endif +#endif /* wxUSE_COMMANDLINKBUTTON */ + +/* + wxUSE_BOOKCTRL should be only used if any of the controls deriving from it + are used + */ +#ifdef wxUSE_BOOKCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_BOOKCTRL is defined automatically, don't define it" +# else +# undef wxUSE_BOOKCTRL +# endif +#endif + +#define wxUSE_BOOKCTRL (wxUSE_AUI || \ + wxUSE_NOTEBOOK || \ + wxUSE_LISTBOOK || \ + wxUSE_CHOICEBOOK || \ + wxUSE_TOOLBOOK || \ + wxUSE_TREEBOOK) + +#if wxUSE_COLLPANE +# if !wxUSE_BUTTON || !wxUSE_STATLINE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_COLLPANE requires wxUSE_BUTTON and wxUSE_STATLINE" +# else +# undef wxUSE_COLLPANE +# define wxUSE_COLLPANE 0 +# endif +# endif +#endif /* wxUSE_COLLPANE */ + +#if wxUSE_LISTBOOK +# if !wxUSE_LISTCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxListbook requires wxListCtrl" +# else +# undef wxUSE_LISTCTRL +# define wxUSE_LISTCTRL 1 +# endif +# endif +#endif /* wxUSE_LISTBOOK */ + +#if wxUSE_CHOICEBOOK +# if !wxUSE_CHOICE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxChoicebook requires wxChoice" +# else +# undef wxUSE_CHOICE +# define wxUSE_CHOICE 1 +# endif +# endif +#endif /* wxUSE_CHOICEBOOK */ + +#if wxUSE_TOOLBOOK +# if !wxUSE_TOOLBAR +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxToolbook requires wxToolBar" +# else +# undef wxUSE_TOOLBAR +# define wxUSE_TOOLBAR 1 +# endif +# endif +#endif /* wxUSE_TOOLBOOK */ + +#if !wxUSE_ODCOMBOBOX +# if wxUSE_BITMAPCOMBOBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxBitmapComboBox requires wxOwnerDrawnComboBox" +# else +# undef wxUSE_BITMAPCOMBOBOX +# define wxUSE_BITMAPCOMBOBOX 0 +# endif +# endif +#endif /* !wxUSE_ODCOMBOBOX */ + +#if !wxUSE_HEADERCTRL +# if wxUSE_DATAVIEWCTRL || wxUSE_GRID +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxDataViewCtrl and wxGrid require wxHeaderCtrl" +# else +# undef wxUSE_HEADERCTRL +# define wxUSE_HEADERCTRL 1 +# endif +# endif +#endif /* !wxUSE_HEADERCTRL */ + +#if wxUSE_REARRANGECTRL +# if !wxUSE_CHECKLISTBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxRearrangeCtrl requires wxCheckListBox" +# else +# undef wxUSE_REARRANGECTRL +# define wxUSE_REARRANGECTRL 0 +# endif +# endif +#endif /* wxUSE_REARRANGECTRL */ + +#if wxUSE_RICHMSGDLG +# if !wxUSE_MSGDLG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_RICHMSGDLG requires wxUSE_MSGDLG" +# else +# undef wxUSE_MSGDLG +# define wxUSE_MSGDLG 1 +# endif +# endif +#endif /* wxUSE_RICHMSGDLG */ + +/* don't attempt to use native status bar on the platforms not having it */ +#ifndef wxUSE_NATIVE_STATUSBAR +# define wxUSE_NATIVE_STATUSBAR 0 +#elif wxUSE_NATIVE_STATUSBAR +# if defined(__WXUNIVERSAL__) || !(defined(__WXMSW__) || defined(__WXMAC__)) +# undef wxUSE_NATIVE_STATUSBAR +# define wxUSE_NATIVE_STATUSBAR 0 +# endif +#endif + +#if wxUSE_ACTIVITYINDICATOR && !wxUSE_GRAPHICS_CONTEXT +# undef wxUSE_ACTIVITYINDICATOR +# define wxUSE_ACTIVITYINDICATOR 0 +#endif /* wxUSE_ACTIVITYINDICATOR */ + +#if wxUSE_GRAPHICS_CONTEXT && !wxUSE_GEOMETRY +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_GRAPHICS_CONTEXT requires wxUSE_GEOMETRY" +# else +# undef wxUSE_GRAPHICS_CONTEXT +# define wxUSE_GRAPHICS_CONTEXT 0 +# endif +#endif /* wxUSE_GRAPHICS_CONTEXT */ + +#if wxUSE_DC_TRANSFORM_MATRIX && !wxUSE_GEOMETRY +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DC_TRANSFORM_MATRIX requires wxUSE_GEOMETRY" +# else +# undef wxUSE_DC_TRANSFORM_MATRIX +# define wxUSE_DC_TRANSFORM_MATRIX 0 +# endif +#endif /* wxUSE_DC_TRANSFORM_MATRIX */ + +/* generic controls dependencies */ +#if !defined(__WXMSW__) || defined(__WXUNIVERSAL__) +# if wxUSE_FONTDLG || wxUSE_FILEDLG || wxUSE_CHOICEDLG + /* all common controls are needed by these dialogs */ +# if !defined(wxUSE_CHOICE) || \ + !defined(wxUSE_TEXTCTRL) || \ + !defined(wxUSE_BUTTON) || \ + !defined(wxUSE_CHECKBOX) || \ + !defined(wxUSE_STATTEXT) +# ifdef wxABORT_ON_CONFIG_ERROR +# error "These common controls are needed by common dialogs" +# else +# undef wxUSE_CHOICE +# define wxUSE_CHOICE 1 +# undef wxUSE_TEXTCTRL +# define wxUSE_TEXTCTRL 1 +# undef wxUSE_BUTTON +# define wxUSE_BUTTON 1 +# undef wxUSE_CHECKBOX +# define wxUSE_CHECKBOX 1 +# undef wxUSE_STATTEXT +# define wxUSE_STATTEXT 1 +# endif +# endif +# endif +#endif /* !wxMSW || wxUniv */ + +/* generic file dialog depends on (generic) file control */ +#if wxUSE_FILEDLG && !wxUSE_FILECTRL && \ + (defined(__WXUNIVERSAL__) || defined(__WXGTK__)) +# ifdef wxABORT_ON_CONFIG_ERROR +# error "Generic wxFileDialog requires wxFileCtrl" +# else +# undef wxUSE_FILECTRL +# define wxUSE_FILECTRL 1 +# endif +#endif /* wxUSE_FILEDLG */ + +/* common dependencies */ +#if wxUSE_ARTPROVIDER_TANGO +# if !(wxUSE_STREAMS && wxUSE_IMAGE && wxUSE_LIBPNG) +# ifdef wxABORT_ON_CONFIG_ERROR +# error "Tango art provider requires wxImage with streams and PNG support" +# else +# undef wxUSE_ARTPROVIDER_TANGO +# define wxUSE_ARTPROVIDER_TANGO 0 +# endif +# endif +#endif /* wxUSE_ARTPROVIDER_TANGO */ + +#if wxUSE_CALENDARCTRL +# if !(wxUSE_SPINBTN && wxUSE_COMBOBOX) +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxCalendarCtrl requires wxSpinButton and wxComboBox" +# else +# undef wxUSE_SPINBTN +# undef wxUSE_COMBOBOX +# define wxUSE_SPINBTN 1 +# define wxUSE_COMBOBOX 1 +# endif +# endif + +# if !wxUSE_DATETIME +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxCalendarCtrl requires wxUSE_DATETIME" +# else +# undef wxUSE_DATETIME +# define wxUSE_DATETIME 1 +# endif +# endif +#endif /* wxUSE_CALENDARCTRL */ + +#if wxUSE_DATEPICKCTRL + /* Only the generic implementation, not used under MSW and OSX, needs + * wxComboCtrl. */ +# if !wxUSE_COMBOCTRL && (defined(__WXUNIVERSAL__) || \ + !(defined(__WXMSW__) || defined(__WXOSX_COCOA__))) +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxDatePickerCtrl requires wxUSE_COMBOCTRL" +# else +# undef wxUSE_COMBOCTRL +# define wxUSE_COMBOCTRL 1 +# endif +# endif +#endif /* wxUSE_DATEPICKCTRL */ + +#if wxUSE_DATEPICKCTRL || wxUSE_TIMEPICKCTRL +# if !wxUSE_DATETIME +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxDatePickerCtrl and wxTimePickerCtrl requires wxUSE_DATETIME" +# else +# undef wxUSE_DATETIME +# define wxUSE_DATETIME 1 +# endif +# endif +#endif /* wxUSE_DATEPICKCTRL || wxUSE_TIMEPICKCTRL */ + +#if wxUSE_CHECKLISTBOX +# if !wxUSE_LISTBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxCheckListBox requires wxListBox" +# else +# undef wxUSE_LISTBOX +# define wxUSE_LISTBOX 1 +# endif +# endif +#endif /* wxUSE_CHECKLISTBOX */ + +#if wxUSE_CHOICEDLG +# if !wxUSE_LISTBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "Choice dialogs requires wxListBox" +# else +# undef wxUSE_LISTBOX +# define wxUSE_LISTBOX 1 +# endif +# endif +#endif /* wxUSE_CHOICEDLG */ + +#if wxUSE_FILECTRL +# if !wxUSE_DATETIME +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxFileCtrl requires wxDateTime" +# else +# undef wxUSE_DATETIME +# define wxUSE_DATETIME 1 +# endif +# endif +#endif /* wxUSE_FILECTRL */ + +#if wxUSE_HELP +# if !wxUSE_BMPBUTTON +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_HELP requires wxUSE_BMPBUTTON" +# else +# undef wxUSE_BMPBUTTON +# define wxUSE_BMPBUTTON 1 +# endif +# endif + +# if !wxUSE_CHOICEDLG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_HELP requires wxUSE_CHOICEDLG" +# else +# undef wxUSE_CHOICEDLG +# define wxUSE_CHOICEDLG 1 +# endif +# endif +#endif /* wxUSE_HELP */ + +#if wxUSE_MS_HTML_HELP + /* + this doesn't make sense for platforms other than MSW but we still + define it in wx/setup_inc.h so don't complain if it happens to be + defined under another platform but just silently fix it. + */ +# ifndef __WXMSW__ +# undef wxUSE_MS_HTML_HELP +# define wxUSE_MS_HTML_HELP 0 +# endif +#endif /* wxUSE_MS_HTML_HELP */ + +#if wxUSE_WXHTML_HELP +# if !wxUSE_HELP || !wxUSE_HTML || !wxUSE_COMBOBOX || !wxUSE_NOTEBOOK || !wxUSE_SPINCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "Built in help controller can't be compiled" +# else +# undef wxUSE_HELP +# define wxUSE_HELP 1 +# undef wxUSE_HTML +# define wxUSE_HTML 1 +# undef wxUSE_COMBOBOX +# define wxUSE_COMBOBOX 1 +# undef wxUSE_NOTEBOOK +# define wxUSE_NOTEBOOK 1 +# undef wxUSE_SPINCTRL +# define wxUSE_SPINCTRL 1 +# endif +# endif +#endif /* wxUSE_WXHTML_HELP */ + +#if !wxUSE_IMAGE +/* + The default wxUSE_IMAGE setting is 1, so if it's set to 0 we assume the + user explicitly wants this and disable all other features that require + wxUSE_IMAGE. + */ +# if wxUSE_DRAGIMAGE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DRAGIMAGE requires wxUSE_IMAGE" +# else +# undef wxUSE_DRAGIMAGE +# define wxUSE_DRAGIMAGE 0 +# endif +# endif + +# if wxUSE_LIBPNG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LIBPNG requires wxUSE_IMAGE" +# else +# undef wxUSE_LIBPNG +# define wxUSE_LIBPNG 0 +# endif +# endif + +# if wxUSE_LIBJPEG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LIBJPEG requires wxUSE_IMAGE" +# else +# undef wxUSE_LIBJPEG +# define wxUSE_LIBJPEG 0 +# endif +# endif + +# if wxUSE_LIBTIFF +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LIBTIFF requires wxUSE_IMAGE" +# else +# undef wxUSE_LIBTIFF +# define wxUSE_LIBTIFF 0 +# endif +# endif + +# if wxUSE_GIF +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_GIF requires wxUSE_IMAGE" +# else +# undef wxUSE_GIF +# define wxUSE_GIF 0 +# endif +# endif + +# if wxUSE_PNM +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PNM requires wxUSE_IMAGE" +# else +# undef wxUSE_PNM +# define wxUSE_PNM 0 +# endif +# endif + +# if wxUSE_PCX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PCX requires wxUSE_IMAGE" +# else +# undef wxUSE_PCX +# define wxUSE_PCX 0 +# endif +# endif + +# if wxUSE_IFF +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_IFF requires wxUSE_IMAGE" +# else +# undef wxUSE_IFF +# define wxUSE_IFF 0 +# endif +# endif + +# if wxUSE_TOOLBAR +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TOOLBAR requires wxUSE_IMAGE" +# else +# undef wxUSE_TOOLBAR +# define wxUSE_TOOLBAR 0 +# endif +# endif + +# if wxUSE_XPM +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_XPM requires wxUSE_IMAGE" +# else +# undef wxUSE_XPM +# define wxUSE_XPM 0 +# endif +# endif + +#endif /* !wxUSE_IMAGE */ + +#if wxUSE_DOC_VIEW_ARCHITECTURE +# if !wxUSE_MENUS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "DocView requires wxUSE_MENUS" +# else +# undef wxUSE_MENUS +# define wxUSE_MENUS 1 +# endif +# endif + +# if !wxUSE_CHOICEDLG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "DocView requires wxUSE_CHOICEDLG" +# else +# undef wxUSE_CHOICEDLG +# define wxUSE_CHOICEDLG 1 +# endif +# endif + +# if !wxUSE_STREAMS && !wxUSE_STD_IOSTREAM +# ifdef wxABORT_ON_CONFIG_ERROR +# error "DocView requires wxUSE_STREAMS or wxUSE_STD_IOSTREAM" +# else +# undef wxUSE_STREAMS +# define wxUSE_STREAMS 1 +# endif +# endif + +# if !wxUSE_FILE_HISTORY +# ifdef wxABORT_ON_CONFIG_ERROR +# error "DocView requires wxUSE_FILE_HISTORY" +# else +# undef wxUSE_FILE_HISTORY +# define wxUSE_FILE_HISTORY 1 +# endif +# endif +#endif /* wxUSE_DOC_VIEW_ARCHITECTURE */ + +#if wxUSE_PRINTING_ARCHITECTURE +# if !wxUSE_COMBOBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "Print dialog requires wxUSE_COMBOBOX" +# else +# undef wxUSE_COMBOBOX +# define wxUSE_COMBOBOX 1 +# endif +# endif +#endif /* wxUSE_PRINTING_ARCHITECTURE */ + +#if wxUSE_MDI_ARCHITECTURE +# if !wxUSE_MDI +# ifdef wxABORT_ON_CONFIG_ERROR +# error "MDI requires wxUSE_MDI" +# else +# undef wxUSE_MDI +# define wxUSE_MDI 1 +# endif +# endif + +# if !wxUSE_DOC_VIEW_ARCHITECTURE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_MDI_ARCHITECTURE requires wxUSE_DOC_VIEW_ARCHITECTURE" +# else +# undef wxUSE_DOC_VIEW_ARCHITECTURE +# define wxUSE_DOC_VIEW_ARCHITECTURE 1 +# endif +# endif +#endif /* wxUSE_MDI_ARCHITECTURE */ + +#if !wxUSE_FILEDLG +# if wxUSE_DOC_VIEW_ARCHITECTURE || wxUSE_WXHTML_HELP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_FILEDLG is required by wxUSE_DOC_VIEW_ARCHITECTURE and wxUSE_WXHTML_HELP!" +# else +# undef wxUSE_FILEDLG +# define wxUSE_FILEDLG 1 +# endif +# endif +#endif /* wxUSE_FILEDLG */ + +#if !wxUSE_GAUGE || !wxUSE_BUTTON +# if wxUSE_PROGRESSDLG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "Generic progress dialog requires wxUSE_GAUGE and wxUSE_BUTTON" +# else +# undef wxUSE_GAUGE +# undef wxUSE_BUTTON +# define wxUSE_GAUGE 1 +# define wxUSE_BUTTON 1 +# endif +# endif +#endif /* !wxUSE_GAUGE */ + +#if !wxUSE_BUTTON +# if wxUSE_FONTDLG || \ + wxUSE_FILEDLG || \ + wxUSE_CHOICEDLG || \ + wxUSE_CREDENTIALDLG || \ + wxUSE_NUMBERDLG || \ + wxUSE_TEXTDLG || \ + wxUSE_DIRDLG || \ + wxUSE_STARTUP_TIPS || \ + wxUSE_WIZARDDLG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "Common and generic dialogs require wxUSE_BUTTON" +# else +# undef wxUSE_BUTTON +# define wxUSE_BUTTON 1 +# endif +# endif +#endif /* !wxUSE_BUTTON */ + +#if !wxUSE_TOOLBAR +# if wxUSE_TOOLBAR_NATIVE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TOOLBAR is set to 0 but wxUSE_TOOLBAR_NATIVE is set to 1" +# else +# undef wxUSE_TOOLBAR_NATIVE +# define wxUSE_TOOLBAR_NATIVE 0 +# endif +# endif +#endif + +#if !wxUSE_IMAGLIST +# if wxUSE_TREECTRL || wxUSE_NOTEBOOK || wxUSE_LISTCTRL || wxUSE_TREELISTCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxImageList must be compiled as well" +# else +# undef wxUSE_IMAGLIST +# define wxUSE_IMAGLIST 1 +# endif +# endif +#endif /* !wxUSE_IMAGLIST */ + +#if wxUSE_RADIOBOX +# if !wxUSE_RADIOBTN +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_RADIOBOX requires wxUSE_RADIOBTN" +# else +# undef wxUSE_RADIOBTN +# define wxUSE_RADIOBTN 1 +# endif +# endif +# if !wxUSE_STATBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_RADIOBOX requires wxUSE_STATBOX" +# else +# undef wxUSE_STATBOX +# define wxUSE_STATBOX 1 +# endif +# endif +#endif /* wxUSE_RADIOBOX */ + +#if wxUSE_LOGWINDOW +# if !wxUSE_TEXTCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LOGWINDOW requires wxUSE_TEXTCTRL" +# else +# undef wxUSE_TEXTCTRL +# define wxUSE_TEXTCTRL 1 +# endif +# endif +#endif /* wxUSE_LOGWINDOW */ + +#if wxUSE_LOG_DIALOG +# if !wxUSE_LISTCTRL || !wxUSE_BUTTON +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_LOG_DIALOG requires wxUSE_LISTCTRL and wxUSE_BUTTON" +# else +# undef wxUSE_LISTCTRL +# define wxUSE_LISTCTRL 1 +# undef wxUSE_BUTTON +# define wxUSE_BUTTON 1 +# endif +# endif +#endif /* wxUSE_LOG_DIALOG */ + +#if wxUSE_CLIPBOARD && !wxUSE_DATAOBJ +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxClipboard requires wxDataObject" +# else +# undef wxUSE_DATAOBJ +# define wxUSE_DATAOBJ 1 +# endif +#endif /* wxUSE_CLIPBOARD */ + +#if wxUSE_XRC && !wxUSE_XML +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_XRC requires wxUSE_XML" +# else +# undef wxUSE_XRC +# define wxUSE_XRC 0 +# endif +#endif /* wxUSE_XRC */ + +#if wxUSE_SOCKETS && !wxUSE_STOPWATCH +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_SOCKETS requires wxUSE_STOPWATCH" +# else +# undef wxUSE_SOCKETS +# define wxUSE_SOCKETS 0 +# endif +#endif /* wxUSE_SOCKETS */ + +#if wxUSE_SVG && !wxUSE_STREAMS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_SVG requires wxUSE_STREAMS" +# else +# undef wxUSE_SVG +# define wxUSE_SVG 0 +# endif +#endif /* wxUSE_SVG */ + +#if wxUSE_SVG && !wxUSE_IMAGE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_SVG requires wxUSE_IMAGE" +# else +# undef wxUSE_SVG +# define wxUSE_SVG 0 +# endif +#endif /* wxUSE_SVG */ + +#if wxUSE_SVG && !wxUSE_LIBPNG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_SVG requires wxUSE_LIBPNG" +# else +# undef wxUSE_SVG +# define wxUSE_SVG 0 +# endif +#endif /* wxUSE_SVG */ + +#if !wxUSE_MENUS +# if wxUSE_MENUBAR +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_MENUBAR requires wxUSE_MENUS" +# else +# undef wxUSE_MENUBAR +# define wxUSE_MENUBAR 0 +# endif +# endif /* wxUSE_MENUBAR */ + +# if wxUSE_TASKBARICON +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TASKBARICON requires wxUSE_MENUS" +# else +# undef wxUSE_TASKBARICON +# define wxUSE_TASKBARICON 0 +# endif +# endif /* wxUSE_TASKBARICON */ +#endif /* !wxUSE_MENUS */ + +#if !wxUSE_VARIANT +# if wxUSE_DATAVIEWCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxDataViewCtrl requires wxVariant" +# else +# undef wxUSE_DATAVIEWCTRL +# define wxUSE_DATAVIEWCTRL 0 +# endif +# endif +#endif /* wxUSE_VARIANT */ + +#if wxUSE_TREELISTCTRL && !wxUSE_DATAVIEWCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TREELISTCTRL requires wxDataViewCtrl" +# else +# undef wxUSE_TREELISTCTRL +# define wxUSE_TREELISTCTRL 0 +# endif +#endif /* wxUSE_TREELISTCTRL */ + +#if wxUSE_WEBVIEW && !(wxUSE_WEBVIEW_WEBKIT || wxUSE_WEBVIEW_WEBKIT2 || \ + wxUSE_WEBVIEW_IE || wxUSE_WEBVIEW_EDGE) +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_WEBVIEW requires at least one backend" +# else +# undef wxUSE_WEBVIEW +# define wxUSE_WEBVIEW 0 +# endif +#endif /* wxUSE_WEBVIEW && !any web view backend */ + +#if wxUSE_WEBREQUEST && !(wxUSE_WEBREQUEST_WINHTTP || wxUSE_WEBREQUEST_URLSESSION || wxUSE_WEBREQUEST_CURL) +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_WEBREQUEST requires at least one backend" +# else +# undef wxUSE_WEBREQUEST +# define wxUSE_WEBREQUEST 0 +# endif +#endif /* wxUSE_WEBREQUEST && !any web request backend */ + +#if wxUSE_PREFERENCES_EDITOR + /* + We can use either a generic implementation, using wxNotebook, or a + native one under wxOSX/Cocoa but then we must be using the native + toolbar. + */ +# if !wxUSE_NOTEBOOK +# ifdef __WXOSX_COCOA__ +# if !wxUSE_TOOLBAR || !wxOSX_USE_NATIVE_TOOLBAR +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PREFERENCES_EDITOR requires native toolbar in wxOSX" +# else +# undef wxUSE_PREFERENCES_EDITOR +# define wxUSE_PREFERENCES_EDITOR 0 +# endif +# endif +# else +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PREFERENCES_EDITOR requires wxNotebook" +# else +# undef wxUSE_PREFERENCES_EDITOR +# define wxUSE_PREFERENCES_EDITOR 0 +# endif +# endif +# endif +#endif /* wxUSE_PREFERENCES_EDITOR */ + +#if wxUSE_PRIVATE_FONTS +# if !defined(__WXMSW__) && !defined(__WXGTK__) && !defined(__WXOSX__) +# undef wxUSE_PRIVATE_FONTS +# define wxUSE_PRIVATE_FONTS 0 +# endif +#endif /* wxUSE_PRIVATE_FONTS */ + +#if wxUSE_MEDIACTRL +# if !wxUSE_LONGLONG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxMediaCtrl requires wxUSE_LONGLONG" +# else +# undef wxUSE_LONGLONG +# define wxUSE_LONGLONG 1 +# endif +# endif +#endif /* wxUSE_MEDIACTRL */ + +#if wxUSE_STC +# if !wxUSE_STOPWATCH +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxStyledTextCtrl requires wxUSE_STOPWATCH" +# else +# undef wxUSE_STC +# define wxUSE_STC 0 +# endif +# endif + +# if !wxUSE_SCROLLBAR +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxStyledTextCtrl requires wxUSE_SCROLLBAR" +# else +# undef wxUSE_STC +# define wxUSE_STC 0 +# endif +# endif +#endif /* wxUSE_STC */ + +#if wxUSE_RICHTEXT +# if !wxUSE_HTML +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxRichTextCtrl requires wxUSE_HTML" +# else +# undef wxUSE_RICHTEXT +# define wxUSE_RICHTEXT 0 +# endif +# endif +# if !wxUSE_LONGLONG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxRichTextCtrl requires wxUSE_LONGLONG" +# else +# undef wxUSE_LONGLONG +# define wxUSE_LONGLONG 1 +# endif +# endif +# if !wxUSE_VARIANT +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxRichTextCtrl requires wxUSE_VARIANT" +# else +# undef wxUSE_VARIANT +# define wxUSE_VARIANT 1 +# endif +# endif +#endif /* wxUSE_RICHTEXT */ + +#if wxUSE_RICHTOOLTIP +# if !wxUSE_POPUPWIN +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxRichToolTip requires wxUSE_POPUPWIN" +# else +# undef wxUSE_POPUPWIN +# define wxUSE_POPUPWIN 1 +# endif +# endif +#endif /* wxUSE_RICHTOOLTIP */ + +#if wxUSE_PROPGRID +# if !wxUSE_VARIANT +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxPropertyGrid requires wxUSE_VARIANT" +# else +# undef wxUSE_VARIANT +# define wxUSE_VARIANT 1 +# endif +# endif +#endif /* wxUSE_PROPGRID */ + +#if wxUSE_TIPWINDOW +# if !wxUSE_POPUPWIN +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxTipWindow requires wxUSE_POPUPWIN" +# else +# undef wxUSE_POPUPWIN +# define wxUSE_POPUPWIN 1 +# endif +# endif +#endif /* wxUSE_TIPWINDOW */ + +#endif /* wxUSE_GUI */ + +#endif /* _WX_CHKCONF_H_ */ diff --git a/lib/wxWidgets/include/wx/choicdlg.h b/lib/wxWidgets/include/wx/choicdlg.h new file mode 100644 index 0000000..0ab4c07 --- /dev/null +++ b/lib/wxWidgets/include/wx/choicdlg.h @@ -0,0 +1,22 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/choicdlg.h +// Purpose: Includes generic choice dialog file +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#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_ diff --git a/lib/wxWidgets/include/wx/choice.h b/lib/wxWidgets/include/wx/choice.h new file mode 100644 index 0000000..b5bfac3 --- /dev/null +++ b/lib/wxWidgets/include/wx/choice.h @@ -0,0 +1,93 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/choice.h +// Purpose: wxChoice class interface +// Author: Vadim Zeitlin +// Modified by: +// Created: 26.07.99 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CHOICE_H_BASE_ +#define _WX_CHOICE_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_CHOICE + +#include "wx/ctrlsub.h" // the base class + +// ---------------------------------------------------------------------------- +// global data +// ---------------------------------------------------------------------------- + +extern WXDLLIMPEXP_DATA_CORE(const char) wxChoiceNameStr[]; + +// ---------------------------------------------------------------------------- +// wxChoice allows to select one of a non-modifiable list of strings +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxChoiceBase : public wxControlWithItems +{ +public: + wxChoiceBase() { } + virtual ~wxChoiceBase(); + + // all generic methods are in wxControlWithItems + + // get the current selection: this can only be different from the normal + // selection if the popup items list is currently opened and the user + // selected some item in it but didn't close the list yet; otherwise (and + // currently always on platforms other than MSW) this is the same as + // GetSelection() + virtual int GetCurrentSelection() const { return GetSelection(); } + + // set/get the number of columns in the control (as they're not supported on + // most platforms, they do nothing by default) + virtual void SetColumns(int WXUNUSED(n) = 1 ) { } + virtual int GetColumns() const { return 1 ; } + + // emulate selecting the item event.GetInt() + void Command(wxCommandEvent& event) wxOVERRIDE; + + // override wxItemContainer::IsSorted + virtual bool IsSorted() const wxOVERRIDE { 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 wxOVERRIDE; + +private: + wxDECLARE_NO_COPY_CLASS(wxChoiceBase); +}; + +// ---------------------------------------------------------------------------- +// include the platform-dependent class definition +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/choice.h" +#elif defined(__WXMSW__) + #include "wx/msw/choice.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/choice.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/choice.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/choice.h" +#elif defined(__WXMAC__) + #include "wx/osx/choice.h" +#elif defined(__WXQT__) + #include "wx/qt/choice.h" +#endif + +#endif // wxUSE_CHOICE + +#endif // _WX_CHOICE_H_BASE_ diff --git a/lib/wxWidgets/include/wx/choicebk.h b/lib/wxWidgets/include/wx/choicebk.h new file mode 100644 index 0000000..8df8221 --- /dev/null +++ b/lib/wxWidgets/include/wx/choicebk.h @@ -0,0 +1,124 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/choicebk.h +// Purpose: wxChoicebook: wxChoice and wxNotebook combination +// Author: Vadim Zeitlin +// Modified by: Wlodzimierz ABX Skiba from wx/listbook.h +// Created: 15.09.04 +// Copyright: (c) Vadim Zeitlin, Wlodzimierz Skiba +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CHOICEBOOK_H_ +#define _WX_CHOICEBOOK_H_ + +#include "wx/defs.h" + +#if wxUSE_CHOICEBOOK + +#include "wx/bookctrl.h" +#include "wx/choice.h" +#include "wx/containr.h" + +class WXDLLIMPEXP_FWD_CORE wxChoice; + +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 +#define wxCHB_TOP wxBK_TOP +#define wxCHB_BOTTOM wxBK_BOTTOM +#define wxCHB_LEFT wxBK_LEFT +#define wxCHB_RIGHT wxBK_RIGHT +#define wxCHB_ALIGN_MASK wxBK_ALIGN_MASK + +// ---------------------------------------------------------------------------- +// wxChoicebook +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxChoicebook : public wxNavigationEnabled +{ +public: + wxChoicebook() { } + + wxChoicebook(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxEmptyString) + { + (void)Create(parent, id, pos, size, style, name); + } + + // quasi ctor + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxEmptyString); + + + virtual bool SetPageText(size_t n, const wxString& strText) wxOVERRIDE; + virtual wxString GetPageText(size_t n) const wxOVERRIDE; + virtual int GetPageImage(size_t n) const wxOVERRIDE; + virtual bool SetPageImage(size_t n, int imageId) wxOVERRIDE; + virtual bool InsertPage(size_t n, + wxWindow *page, + const wxString& text, + bool bSelect = false, + int imageId = NO_IMAGE) wxOVERRIDE; + virtual int SetSelection(size_t n) wxOVERRIDE + { return DoSetSelection(n, SetSelection_SendEvent); } + virtual int ChangeSelection(size_t n) wxOVERRIDE { return DoSetSelection(n); } + virtual void SetImageList(wxImageList *imageList) wxOVERRIDE; + + virtual bool DeleteAllPages() wxOVERRIDE; + + // returns the choice control + wxChoice* GetChoiceCtrl() const { return (wxChoice*)m_bookctrl; } + +protected: + virtual void DoSetWindowVariant(wxWindowVariant variant) wxOVERRIDE; + + virtual wxWindow *DoRemovePage(size_t page) wxOVERRIDE; + + void UpdateSelectedPage(size_t newsel) wxOVERRIDE + { + GetChoiceCtrl()->Select(static_cast(newsel)); + } + + wxBookCtrlEvent* CreatePageChangingEvent() const wxOVERRIDE; + void MakeChangedEvent(wxBookCtrlEvent &event) wxOVERRIDE; + + // event handlers + void OnChoiceSelected(wxCommandEvent& event); + +private: + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxChoicebook); +}; + +// ---------------------------------------------------------------------------- +// choicebook event class and related stuff +// ---------------------------------------------------------------------------- + +// 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_CHOICEBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn)) + +#define EVT_CHOICEBOOK_PAGE_CHANGING(winid, 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 + +#endif // _WX_CHOICEBOOK_H_ diff --git a/lib/wxWidgets/include/wx/clipbrd.h b/lib/wxWidgets/include/wx/clipbrd.h new file mode 100644 index 0000000..2c37937 --- /dev/null +++ b/lib/wxWidgets/include/wx/clipbrd.h @@ -0,0 +1,202 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/clipbrd.h +// Purpose: wxClipboad class and clipboard functions +// Author: Vadim Zeitlin +// Modified by: +// Created: 19.10.99 +// Copyright: (c) wxWidgets Team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CLIPBRD_H_BASE_ +#define _WX_CLIPBRD_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_CLIPBOARD + + +#include "wx/event.h" +#include "wx/chartype.h" +#include "wx/dataobj.h" // for wxDataFormat +#include "wx/vector.h" + +class WXDLLIMPEXP_FWD_CORE wxClipboard; + +// ---------------------------------------------------------------------------- +// wxClipboard represents the system clipboard. Normally, you should use +// wxTheClipboard which is a global pointer to the (unique) clipboard. +// +// Clipboard can be used to copy data to/paste data from. It works together +// with wxDataObject. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxClipboardBase : public wxObject +{ +public: + wxClipboardBase() { m_usePrimary = false; } + + // open the clipboard before Add/SetData() and GetData() + virtual bool Open() = 0; + + // close the clipboard after Add/SetData() and GetData() + virtual void Close() = 0; + + // query whether the clipboard is opened + virtual bool IsOpened() const = 0; + + // add to the clipboard data + // + // NB: the clipboard owns the pointer and will delete it, so data must be + // allocated on the heap + virtual bool AddData( wxDataObject *data ) = 0; + + // set the clipboard data, this is the same as Clear() followed by + // AddData() + virtual bool SetData( wxDataObject *data ) = 0; + + // 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; + + // clears wxTheClipboard and the system's clipboard if possible + virtual void Clear() = 0; + + // flushes the clipboard: this means that the data which is currently on + // clipboard will stay available even after the application exits (possibly + // eating memory), otherwise the clipboard will be emptied on exit + virtual bool Flush() { return 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 wxOVERRIDE + { + return new wxClipboardEvent(*this); + } + + +protected: + wxVector m_formats; + + wxDECLARE_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 +// ---------------------------------------------------------------------------- + +// The global clipboard object - backward compatible access macro: +#define wxTheClipboard (wxClipboard::Get()) + +// ---------------------------------------------------------------------------- +// include platform-specific class declaration +// ---------------------------------------------------------------------------- + +#if defined(__WXMSW__) + #include "wx/msw/clipbrd.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/clipbrd.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/clipbrd.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/clipbrd.h" +#elif defined(__WXX11__) + #include "wx/x11/clipbrd.h" +#elif defined(__WXMAC__) + #include "wx/osx/clipbrd.h" +#elif defined(__WXQT__) + #include "wx/qt/clipbrd.h" +#endif + +// ---------------------------------------------------------------------------- +// helpful class for opening the clipboard and automatically closing it +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxClipboardLocker +{ +public: + wxClipboardLocker(wxClipboard *clipboard = NULL) + { + m_clipboard = clipboard ? clipboard : wxTheClipboard; + if ( m_clipboard ) + { + m_clipboard->Open(); + } + } + + bool operator!() const { return !m_clipboard->IsOpened(); } + + ~wxClipboardLocker() + { + if ( m_clipboard ) + { + m_clipboard->Close(); + } + } + +private: + wxClipboard *m_clipboard; + + wxDECLARE_NO_COPY_CLASS(wxClipboardLocker); +}; + +#endif // wxUSE_CLIPBOARD + +#endif // _WX_CLIPBRD_H_BASE_ diff --git a/lib/wxWidgets/include/wx/clntdata.h b/lib/wxWidgets/include/wx/clntdata.h new file mode 100644 index 0000000..d6df32e --- /dev/null +++ b/lib/wxWidgets/include/wx/clntdata.h @@ -0,0 +1,205 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/clntdata.h +// Purpose: A mixin class for holding a wxClientData or void pointer +// Author: Robin Dunn +// Modified by: +// Created: 9-Oct-2001 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CLNTDATAH__ +#define _WX_CLNTDATAH__ + +#include "wx/defs.h" +#include "wx/string.h" +#include "wx/hashmap.h" +#include "wx/object.h" + +typedef int (*wxShadowObjectMethod)(void*, void*); +WX_DECLARE_STRING_HASH_MAP_WITH_DECL( + wxShadowObjectMethod, + wxShadowObjectMethods, + class WXDLLIMPEXP_BASE +); +WX_DECLARE_STRING_HASH_MAP_WITH_DECL( + void *, + wxShadowObjectFields, + class WXDLLIMPEXP_BASE +); + +class WXDLLIMPEXP_BASE wxShadowObject +{ +public: + wxShadowObject() { } + + void AddMethod( const wxString &name, wxShadowObjectMethod method ) + { + wxShadowObjectMethods::iterator it = m_methods.find( name ); + if (it == m_methods.end()) + m_methods[ name ] = method; + else + it->second = method; + } + + bool InvokeMethod( const wxString &name, void* window, void* param, int* returnValue ) + { + wxShadowObjectMethods::iterator it = m_methods.find( name ); + if (it == m_methods.end()) + return false; + wxShadowObjectMethod method = it->second; + const int ret = (*method)(window, param); + if (returnValue) + *returnValue = ret; + return true; + } + + void AddField( const wxString &name, void* initialValue = NULL ) + { + wxShadowObjectFields::iterator it = m_fields.find( name ); + if (it == m_fields.end()) + m_fields[ name ] = initialValue; + else + it->second = initialValue; + } + + void SetField( const wxString &name, void* value ) + { + wxShadowObjectFields::iterator it = m_fields.find( name ); + if (it == m_fields.end()) + return; + it->second = value; + } + + void* GetField( const wxString &name, void *defaultValue = NULL ) + { + wxShadowObjectFields::iterator it = m_fields.find( name ); + if (it == m_fields.end()) + return defaultValue; + return it->second; + } + +private: + wxShadowObjectMethods m_methods; + wxShadowObjectFields m_fields; +}; + + +// ---------------------------------------------------------------------------- + +// what kind of client data do we have? +enum wxClientDataType +{ + wxClientData_None, // we don't know yet because we don't have it at all + wxClientData_Object, // our client data is typed and we own it + wxClientData_Void // client data is untyped and we don't own it +}; + +class WXDLLIMPEXP_BASE wxClientData +{ +public: + wxClientData() { } + virtual ~wxClientData() { } +}; + +class WXDLLIMPEXP_BASE wxStringClientData : public wxClientData +{ +public: + wxStringClientData() : m_data() { } + wxStringClientData( const wxString &data ) : m_data(data) { } + void SetData( const wxString &data ) { m_data = data; } + const wxString& GetData() const { return m_data; } + +private: + wxString m_data; +}; + +// This class is a mixin that provides storage and management of "client +// data." The client data stored can either be a pointer to a wxClientData +// object in which case it is managed by the container (i.e. it will delete +// the data when it's destroyed) or an untyped pointer which won't be deleted +// by the container - but not both of them +// +// NOTE: This functionality is currently duplicated in wxEvtHandler in order +// to avoid having more than one vtable in that class hierarchy. + +class WXDLLIMPEXP_BASE wxClientDataContainer +{ +public: + wxClientDataContainer(); + virtual ~wxClientDataContainer(); + + void SetClientObject( wxClientData *data ) { DoSetClientObject(data); } + wxClientData *GetClientObject() const { return DoGetClientObject(); } + + void SetClientData( void *data ) { DoSetClientData(data); } + void *GetClientData() const { return DoGetClientData(); } + +protected: + // The user data: either an object which will be deleted by the container + // when it's deleted or some raw pointer which we do nothing with. Only + // one type of data can be used with the given window, i.e. you cannot set + // the void data and then associate the container with wxClientData or vice + // versa. + union + { + wxClientData *m_clientObject; + void *m_clientData; + }; + + // client data accessors + virtual void DoSetClientObject( wxClientData *data ); + virtual wxClientData *DoGetClientObject() const; + + virtual void DoSetClientData( void *data ); + virtual void *DoGetClientData() const; + + // what kind of data do we have? + wxClientDataType m_clientDataType; + +}; + +// This class is a replacement for wxClientDataContainer, and unlike +// wxClientDataContainer the wxSharedClientDataContainer client data is +// copiable, so it can be copied when objects containing it are cloned. +// Like wxClientDataContainer, wxSharedClientDataContainer is a mixin +// that provides storage and management of "client data.". The client data +// is reference counted and managed by the container. +// +// NOTE: If your class has a clone function and needs to store client data, +// use wxSharedClientDataContainer and not wxClientDataContainer! + +class WXDLLIMPEXP_BASE wxSharedClientDataContainer +{ +public: + // Provide the same functions as in wxClientDataContainer, so that objects + // using it and this class could be used in exactly the same way. + void SetClientObject(wxClientData *data); + wxClientData *GetClientObject() const; + void SetClientData(void *data); + void *GetClientData() const; + +protected: + bool HasClientDataContainer() const { return m_data.get() != NULL; } + void CopyClientDataContainer(const wxSharedClientDataContainer& other) + { + m_data = other.m_data; + } + +private: + class wxRefCountedClientDataContainer : public wxClientDataContainer, + public wxRefCounter + { + }; + + // Helper function that will create m_data if it is currently NULL + wxClientDataContainer *GetValidClientData(); + + // m_data is shared, not deep copied, when cloned. If you make changes to + // the data in one instance of your class, you change it for all cloned + // instances! + wxObjectDataPtr m_data; +}; + +#endif // _WX_CLNTDATAH__ + diff --git a/lib/wxWidgets/include/wx/clrpicker.h b/lib/wxWidgets/include/wx/clrpicker.h new file mode 100644 index 0000000..0917ff6 --- /dev/null +++ b/lib/wxWidgets/include/wx/clrpicker.h @@ -0,0 +1,213 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/clrpicker.h +// Purpose: wxColourPickerCtrl base header +// Author: Francesco Montorsi (based on Vadim Zeitlin's code) +// Modified by: +// Created: 14/4/2006 +// Copyright: (c) Vadim Zeitlin, Francesco Montorsi +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CLRPICKER_H_BASE_ +#define _WX_CLRPICKER_H_BASE_ + +#include "wx/defs.h" + + +#if wxUSE_COLOURPICKERCTRL + +#include "wx/pickerbase.h" + + +class WXDLLIMPEXP_FWD_CORE wxColourPickerEvent; + +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) + + + +// ---------------------------------------------------------------------------- +// wxColourPickerWidgetBase: a generic abstract interface which must be +// implemented by controls used by wxColourPickerCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxColourPickerWidgetBase +{ +public: + wxColourPickerWidgetBase() : m_colour(*wxBLACK) { } + virtual ~wxColourPickerWidgetBase() {} + + wxColour GetColour() const + { return m_colour; } + virtual void SetColour(const wxColour &col) + { m_colour = col; UpdateColour(); } + virtual void SetColour(const wxString &col) + { m_colour.Set(col); UpdateColour(); } + +protected: + + virtual void UpdateColour() = 0; + + // the current colour (may be invalid if none) + wxColour m_colour; +}; + + +// Styles which must be supported by all controls implementing wxColourPickerWidgetBase +// NB: these styles must be defined to carefully-chosen values to +// avoid conflicts with wxButton's styles + +// show the colour in HTML form (#AABBCC) as colour button label +// (instead of no label at all) +// NOTE: this style is supported just by wxColourButtonGeneric and +// thus is not exposed in wxColourPickerCtrl +#define wxCLRP_SHOW_LABEL 0x0008 +#define wxCLRP_SHOW_ALPHA 0x0010 + +// map platform-dependent controls which implement the wxColourPickerWidgetBase +// under the name "wxColourPickerWidget". +// NOTE: wxColourPickerCtrl allocates a wxColourPickerWidget and relies on the +// fact that all classes being mapped as wxColourPickerWidget have the +// same prototype for their constructor (and also explains why we use +// define instead of a typedef) +// since GTK > 2.4, there is GtkColorButton +#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) + #include "wx/gtk/clrpicker.h" + #define wxColourPickerWidget wxColourButton +#elif defined(__WXQT__) && !defined(__WXUNIVERSAL__) + #include "wx/qt/clrpicker.h" +#else + #include "wx/generic/clrpickerg.h" + #define wxColourPickerWidget wxGenericColourButton +#endif + + +// ---------------------------------------------------------------------------- +// wxColourPickerCtrl: platform-independent class which embeds a +// platform-dependent wxColourPickerWidget and, if wxCLRP_USE_TEXTCTRL style is +// used, a textctrl next to it. +// ---------------------------------------------------------------------------- + +#define wxCLRP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL) +#define wxCLRP_DEFAULT_STYLE 0 + +class WXDLLIMPEXP_CORE wxColourPickerCtrl : public wxPickerBase +{ +public: + wxColourPickerCtrl() {} + virtual ~wxColourPickerCtrl() {} + + + wxColourPickerCtrl(wxWindow *parent, wxWindowID id, + const wxColour& col = *wxBLACK, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxCLRP_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxColourPickerCtrlNameStr)) + { Create(parent, id, col, pos, size, style, validator, name); } + + bool Create(wxWindow *parent, wxWindowID id, + const wxColour& col = *wxBLACK, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCLRP_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxColourPickerCtrlNameStr)); + + +public: // public API + + // get the colour chosen + wxColour GetColour() const + { return ((wxColourPickerWidget *)m_picker)->GetColour(); } + + // set currently displayed color + void SetColour(const wxColour& col); + + // set colour using RGB(r,g,b) syntax or considering given text as a colour name; + // returns true if the given text was successfully recognized. + bool SetColour(const wxString& text); + + +public: // internal functions + + // update the button colour to match the text control contents + void UpdatePickerFromTextCtrl() wxOVERRIDE; + + // update the text control to match the button's colour + void UpdateTextCtrlFromPicker() wxOVERRIDE; + + // event handler for our picker + void OnColourChange(wxColourPickerEvent &); + +protected: + virtual long GetPickerStyle(long style) const wxOVERRIDE + { return (style & (wxCLRP_SHOW_LABEL | wxCLRP_SHOW_ALPHA)); } + +private: + wxDECLARE_DYNAMIC_CLASS(wxColourPickerCtrl); +}; + + +// ---------------------------------------------------------------------------- +// wxColourPickerEvent: used by wxColourPickerCtrl only +// ---------------------------------------------------------------------------- + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COLOURPICKER_CHANGED, wxColourPickerEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COLOURPICKER_CURRENT_CHANGED, wxColourPickerEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COLOURPICKER_DIALOG_CANCELLED, wxColourPickerEvent ); + +class WXDLLIMPEXP_CORE wxColourPickerEvent : public wxCommandEvent +{ +public: + wxColourPickerEvent() {} + wxColourPickerEvent(wxObject *generator, int id, const wxColour &col, wxEventType commandType = wxEVT_COLOURPICKER_CHANGED) + : wxCommandEvent(commandType, id), + m_colour(col) + { + SetEventObject(generator); + } + + wxColour GetColour() const { return m_colour; } + void SetColour(const wxColour &c) { m_colour = c; } + + + // default copy ctor, assignment operator and dtor are ok + virtual wxEvent *Clone() const wxOVERRIDE { return new wxColourPickerEvent(*this); } + +private: + wxColour m_colour; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxColourPickerEvent); +}; + +// ---------------------------------------------------------------------------- +// event types and macros +// ---------------------------------------------------------------------------- + +typedef void (wxEvtHandler::*wxColourPickerEventFunction)(wxColourPickerEvent&); + +#define wxColourPickerEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxColourPickerEventFunction, func) + +#define EVT_COLOURPICKER_CHANGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COLOURPICKER_CHANGED, id, wxColourPickerEventHandler(fn)) + +#define EVT_COLOURPICKER_CURRENT_CHANGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COLOURPICKER_CURRENT_CHANGED, id, wxColourPickerEventHandler(fn)) + +#define EVT_COLOURPICKER_DIALOG_CANCELLED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COLOURPICKER_DIALOG_CANCELLED, id, wxColourPickerEventHandler(fn)) + +// old wxEVT_COMMAND_* constant +#define wxEVT_COMMAND_COLOURPICKER_CHANGED wxEVT_COLOURPICKER_CHANGED + +#endif // wxUSE_COLOURPICKERCTRL + +#endif // _WX_CLRPICKER_H_BASE_ + diff --git a/lib/wxWidgets/include/wx/cmdargs.h b/lib/wxWidgets/include/wx/cmdargs.h new file mode 100644 index 0000000..9df612f --- /dev/null +++ b/lib/wxWidgets/include/wx/cmdargs.h @@ -0,0 +1,154 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/cmdargs.h +// Purpose: declaration of wxCmdLineArgsArray helper class +// Author: Vadim Zeitlin +// Created: 2007-11-12 +// Copyright: (c) 2007 Vadim Zeitlin +// 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 + void Init(int argc, T **argv) + { + FreeArgs(); + + m_args.clear(); + m_args.reserve(argc); + + for ( int i = 0; i < argc; i++ ) + { + m_args.push_back(argv[i]); + } + } + + operator char**() const + { + if ( !m_argsA ) + { + const size_t count = m_args.size(); + m_argsA = new char *[count + 1]; + for ( size_t n = 0; n < count; n++ ) + m_argsA[n] = wxStrdup(m_args[n].ToAscii()); + + m_argsA[count] = NULL; + } + + return m_argsA; + } + + operator wchar_t**() const + { + if ( !m_argsW ) + { + const size_t count = m_args.size(); + m_argsW = new wchar_t *[count + 1]; + for ( size_t n = 0; n < count; n++ ) + m_argsW[n] = wxStrdup(m_args[n].wc_str()); + + m_argsW[count] = NULL; + } + + 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 + 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; + args = NULL; + } + + 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_ + diff --git a/lib/wxWidgets/include/wx/cmdline.h b/lib/wxWidgets/include/wx/cmdline.h new file mode 100644 index 0000000..729ac0c --- /dev/null +++ b/lib/wxWidgets/include/wx/cmdline.h @@ -0,0 +1,388 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/cmdline.h +// Purpose: wxCmdLineParser and related classes for parsing the command +// line options +// Author: Vadim Zeitlin +// Modified by: +// Created: 04.01.00 +// Copyright: (c) 2000 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CMDLINE_H_ +#define _WX_CMDLINE_H_ + +#include "wx/defs.h" + +#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 + +class WXDLLIMPEXP_FWD_BASE wxCmdLineParser; +class WXDLLIMPEXP_FWD_BASE wxDateTime; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// 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 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_SWITCH_NEGATABLE = 0x20, // this switch can be negated (e.g. /S-) + wxCMD_LINE_HIDDEN = 0x40 // this switch is not listed by Usage() +}; + +// an option value or parameter may be a string (the most common case), a +// number or a date +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 +}; + +// for constructing the cmd line description using Init() +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 +// ---------------------------------------------------------------------------- + +struct wxCmdLineEntryDesc +{ + wxCmdLineEntryType kind; + 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 } + +// ---------------------------------------------------------------------------- +// wxCmdLineArg contains the value for one command line argument +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxCmdLineArg +{ +public: + virtual ~wxCmdLineArg() {} + + virtual double GetDoubleVal() const = 0; + virtual long GetLongVal() const = 0; + virtual const wxString& GetStrVal() const = 0; +#if wxUSE_DATETIME + virtual const wxDateTime& GetDateVal() const = 0; +#endif // wxUSE_DATETIME + + virtual bool IsNegated() const = 0; + + virtual wxCmdLineEntryType GetKind() const = 0; + virtual wxString GetShortName() const = 0; + virtual wxString GetLongName() const = 0; + virtual wxCmdLineParamType GetType() const = 0; +}; + +// ---------------------------------------------------------------------------- +// wxCmdLineArgs is a container of command line arguments actually parsed and +// allows enumerating them using the standard iterator-based approach. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxCmdLineArgs +{ +public: + class WXDLLIMPEXP_BASE const_iterator + { + public: + typedef int difference_type; + typedef wxCmdLineArg value_type; + typedef const wxCmdLineArg* pointer; + typedef const wxCmdLineArg& reference; + +// We avoid dependency on standard library by default but if we do use +// std::string, then it's ok to use iterator tags as well. +#if wxUSE_STD_STRING + typedef std::bidirectional_iterator_tag iterator_category; +#endif // wx_USE_STD_STRING + + const_iterator() : m_parser(NULL), m_index(0) {} + reference operator *() const; + pointer operator ->() const; + const_iterator &operator ++ (); + const_iterator operator ++ (int); + const_iterator &operator -- (); + const_iterator operator -- (int); + + bool operator == (const const_iterator &other) const { + return m_parser==other.m_parser && m_index==other.m_index; + } + bool operator != (const const_iterator &other) const { + return !operator==(other); + } + + private: + const_iterator (const wxCmdLineParser& parser, size_t index) + : m_parser(&parser), m_index(index) { + } + + const wxCmdLineParser* m_parser; + size_t m_index; + + friend class wxCmdLineArgs; + }; + + wxCmdLineArgs (const wxCmdLineParser& parser) : m_parser(parser) {} + + const_iterator begin() const { return const_iterator(m_parser, 0); } + const_iterator end() const { return const_iterator(m_parser, size()); } + + size_t size() const; + +private: + const wxCmdLineParser& m_parser; + wxDECLARE_NO_ASSIGN_DEF_COPY(wxCmdLineArgs); +}; + +// ---------------------------------------------------------------------------- +// wxCmdLineParser is a class for parsing command line. +// +// It has the following features: +// +// 1. distinguishes options, switches and parameters; allows option grouping +// 2. allows both short and long options +// 3. automatically generates the usage message from the cmd line description +// 4. does type checks on the options values (number, date, ...) +// +// To use it you should: +// +// 1. construct it giving it the cmd line to parse and optionally its desc +// 2. construct the cmd line description using AddXXX() if not done in (1) +// 3. call Parse() +// 4. use GetXXX() to retrieve the parsed info +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxCmdLineParser +{ +public: + // ctors and initializers + // ---------------------- + + // default ctor or ctor giving the cmd line in either Unix or Win form + wxCmdLineParser() { Init(); } + 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); } + + // the same as above, but also gives the cmd line description - otherwise, + // use AddXXX() later + wxCmdLineParser(const wxCmdLineEntryDesc *desc) + { Init(); SetDesc(desc); } + wxCmdLineParser(const wxCmdLineEntryDesc *desc, int argc, char **argv) + { Init(); SetCmdLine(argc, argv); SetDesc(desc); } +#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); } + + // set cmd line to parse after using one of the ctors which don't do it + 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); + + // not virtual, don't use this class polymorphically + ~wxCmdLineParser(); + + // set different parser options + // ---------------------------- + + // by default, '-' is switch char under Unix, '-' or '/' under Win: + // switchChars contains all characters with which an option or switch may + // start + void SetSwitchChars(const wxString& switchChars); + + // long options are not POSIX-compliant, this option allows to disable them + void EnableLongOptions(bool enable = true); + void DisableLongOptions() { EnableLongOptions(false); } + + bool AreLongOptionsEnabled() const; + + // extra text may be shown by Usage() method if set by this function + void SetLogo(const wxString& logo); + + // construct the cmd line description + // ---------------------------------- + + // take the cmd line description from the wxCMD_LINE_NONE terminated table + void SetDesc(const wxCmdLineEntryDesc *desc); + + // a switch: i.e. an option without value + 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 + // ------- + + // parse the command line, return 0 if ok, -1 if "-h" or "--help" option + // was encountered and the help message was given or a positive value if a + // syntax error occurred + // + // if showUsage is true, Usage() is called in case of syntax error or if + // help was requested + int Parse(bool showUsage = true); + + // give the usage message describing all program options + void Usage() const; + + // return the usage string, call Usage() to directly show it to the user + wxString GetUsageString() const; + + // get the command line arguments + // ------------------------------ + + // 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; + + // returns true if an option taking an integer value was found and stores + // 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 + bool Found(const wxString& name, wxDateTime *value) const; +#endif // wxUSE_DATETIME + + // gets the number of parameters found + size_t GetParamCount() const; + + // gets the value of Nth parameter (as string only for now) + wxString GetParam(size_t n = 0u) const; + + // returns a reference to the container of all command line arguments + wxCmdLineArgs GetArguments() const { return wxCmdLineArgs(*this); } + + // Resets switches and options + void Reset(); + + // break down the command line in arguments + static wxArrayString + ConvertStringToArgs(const wxString& cmdline, + wxCmdLineSplitType type = wxCMD_LINE_SPLIT_DOS); + +private: + // common part of all ctors + void Init(); + + struct wxCmdLineParserData *m_data; + + friend class wxCmdLineArgs; + friend class wxCmdLineArgs::const_iterator; + wxDECLARE_NO_COPY_CLASS(wxCmdLineParser); +}; + +#else // !wxUSE_CMDLINE_PARSER + +// this function is always available (even if !wxUSE_CMDLINE_PARSER) because it +// is used by wxWin itself under Windows +class WXDLLIMPEXP_BASE wxCmdLineParser +{ +public: + static wxArrayString + ConvertStringToArgs(const wxString& cmdline, + wxCmdLineSplitType type = wxCMD_LINE_SPLIT_DOS); +}; + +#endif // wxUSE_CMDLINE_PARSER/!wxUSE_CMDLINE_PARSER + +#endif // _WX_CMDLINE_H_ diff --git a/lib/wxWidgets/include/wx/cmdproc.h b/lib/wxWidgets/include/wx/cmdproc.h new file mode 100644 index 0000000..8f9656c --- /dev/null +++ b/lib/wxWidgets/include/wx/cmdproc.h @@ -0,0 +1,140 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/cmdproc.h +// Purpose: undo/redo capable command processing framework +// Author: Julian Smart (extracted from docview.h by VZ) +// Modified by: +// Created: 05.11.00 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CMDPROC_H_ +#define _WX_CMDPROC_H_ + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/list.h" + +class WXDLLIMPEXP_FWD_CORE wxMenu; + +// ---------------------------------------------------------------------------- +// wxCommand: a single command capable of performing itself +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxCommand : public wxObject +{ +public: + wxCommand(bool canUndoIt = false, const wxString& name = wxEmptyString); + virtual ~wxCommand(){} + + // Override this to perform a command + virtual bool Do() = 0; + + // Override this to undo a command + virtual bool Undo() = 0; + + virtual bool CanUndo() const { return m_canUndo; } + virtual wxString GetName() const { return m_commandName; } + +protected: + bool m_canUndo; + wxString m_commandName; + +private: + wxDECLARE_CLASS(wxCommand); +}; + +// ---------------------------------------------------------------------------- +// wxCommandProcessor: wxCommand manager +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxCommandProcessor : public wxObject +{ +public: + // if max number of commands is -1, it is unlimited + wxCommandProcessor(int maxCommands = -1); + virtual ~wxCommandProcessor(); + + // Pass a command to the processor. The processor calls Do(); if + // successful, is appended to the command history unless storeIt is false. + virtual bool Submit(wxCommand *command, bool storeIt = true); + + // just store the command without executing it + virtual void Store(wxCommand *command); + + virtual bool Undo(); + virtual bool Redo(); + virtual bool CanUndo() const; + virtual bool CanRedo() const; + + // Initialises the current command and menu strings. + virtual void Initialize(); + + // Sets the Undo/Redo menu strings for the current menu. + virtual void SetMenuStrings(); + + // Gets the current Undo menu label. + wxString GetUndoMenuLabel() const; + + // Gets the current Undo menu label. + wxString GetRedoMenuLabel() const; + +#if wxUSE_MENUS + // Call this to manage an edit menu. + void SetEditMenu(wxMenu *menu) { m_commandEditMenu = menu; } + wxMenu *GetEditMenu() const { return m_commandEditMenu; } +#endif // wxUSE_MENUS + + // command list access + wxList& GetCommands() { return m_commands; } + const wxList& GetCommands() const { return m_commands; } + wxCommand *GetCurrentCommand() const + { + return (wxCommand *)(m_currentCommand ? m_currentCommand->GetData() : NULL); + } + int GetMaxCommands() const { return m_maxNoCommands; } + virtual void ClearCommands(); + + // Has the current project been changed? + virtual bool IsDirty() const; + + // Mark the current command as the one where the last save took place + void MarkAsSaved() + { + m_lastSavedCommand = m_currentCommand; + } + + + // By default, the accelerators are "\tCtrl+Z" and "\tCtrl+Y" + const wxString& GetUndoAccelerator() const { return m_undoAccelerator; } + const wxString& GetRedoAccelerator() const { return m_redoAccelerator; } + + void SetUndoAccelerator(const wxString& accel) { m_undoAccelerator = accel; } + void SetRedoAccelerator(const wxString& accel) { m_redoAccelerator = accel; } + +protected: + // for further flexibility, command processor doesn't call wxCommand::Do() + // and Undo() directly but uses these functions which can be overridden in + // the derived class + virtual bool DoCommand(wxCommand& cmd); + virtual bool UndoCommand(wxCommand& cmd); + + int m_maxNoCommands; + wxList m_commands; + wxList::compatibility_iterator m_currentCommand, + m_lastSavedCommand; + +#if wxUSE_MENUS + wxMenu* m_commandEditMenu; +#endif // wxUSE_MENUS + + wxString m_undoAccelerator; + wxString m_redoAccelerator; + +private: + wxDECLARE_DYNAMIC_CLASS(wxCommandProcessor); + wxDECLARE_NO_COPY_CLASS(wxCommandProcessor); +}; + +#endif // _WX_CMDPROC_H_ + diff --git a/lib/wxWidgets/include/wx/cmndata.h b/lib/wxWidgets/include/wx/cmndata.h new file mode 100644 index 0000000..db64782 --- /dev/null +++ b/lib/wxWidgets/include/wx/cmndata.h @@ -0,0 +1,310 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/cmndata.h +// Purpose: Common GDI data classes +// Author: Julian Smart and others +// Modified by: +// Created: 01/02/97 +// Copyright: (c) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CMNDATA_H_BASE_ +#define _WX_CMNDATA_H_BASE_ + +#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; + +/* + * wxPrintData + * Encapsulates printer information (not printer dialog information) + */ + +enum wxPrintBin +{ + wxPRINTBIN_DEFAULT, + + wxPRINTBIN_ONLYONE, + wxPRINTBIN_LOWER, + wxPRINTBIN_MIDDLE, + wxPRINTBIN_MANUAL, + wxPRINTBIN_ENVELOPE, + wxPRINTBIN_ENVMANUAL, + wxPRINTBIN_AUTO, + wxPRINTBIN_TRACTOR, + wxPRINTBIN_SMALLFMT, + wxPRINTBIN_LARGEFMT, + wxPRINTBIN_LARGECAPACITY, + wxPRINTBIN_CASSETTE, + wxPRINTBIN_FORMSOURCE, + + wxPRINTBIN_USER +}; + +const int wxPRINTMEDIA_DEFAULT = 0; + +class WXDLLIMPEXP_CORE wxPrintData: public wxObject +{ +public: + wxPrintData(); + wxPrintData(const wxPrintData& printData); + virtual ~wxPrintData(); + + int GetNoCopies() const { return m_printNoCopies; } + bool GetCollate() const { return m_printCollate; } + wxPrintOrientation GetOrientation() const { return m_printOrientation; } + bool IsOrientationReversed() const { return m_printOrientationReversed; } + + // Is this data OK for showing the print dialog? + bool Ok() const { return IsOk(); } + bool IsOk() const ; + + const wxString& GetPrinterName() const { return m_printerName; } + bool GetColour() const { return m_colour; } + wxDuplexMode GetDuplex() const { return m_duplexMode; } + wxPaperSize GetPaperId() const { return m_paperId; } + const wxSize& GetPaperSize() const { return m_paperSize; } + wxPrintQuality GetQuality() const { return m_printQuality; } + wxPrintBin GetBin() const { return m_bin; } + wxPrintMode GetPrintMode() const { return m_printMode; } + int GetMedia() const { return m_media; } + + void SetNoCopies(int v) { m_printNoCopies = v; } + void SetCollate(bool flag) { m_printCollate = flag; } + + // 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; } + void SetColour(bool colour) { m_colour = colour; } + void SetDuplex(wxDuplexMode duplex) { m_duplexMode = duplex; } + void SetPaperId(wxPaperSize sizeId) { m_paperId = sizeId; } + void SetPaperSize(const wxSize& sz) { m_paperSize = sz; } + void SetQuality(wxPrintQuality quality) { m_printQuality = quality; } + void SetBin(wxPrintBin bin) { m_bin = bin; } + void SetMedia(int media) { m_media = media; } + void SetPrintMode(wxPrintMode printMode) { m_printMode = printMode; } + + wxString GetFilename() const { return m_filename; } + void SetFilename( const wxString &filename ) { m_filename = filename; } + + wxPrintData& operator=(const wxPrintData& data); + + char* GetPrivData() const { return m_privData; } + int GetPrivDataLen() const { return m_privDataLen; } + void SetPrivData( char *privData, int len ); + + + // Convert between wxPrintData and native data + void ConvertToNative(); + void ConvertFromNative(); + // Holds the native print data + wxPrintNativeDataBase *GetNativeData() const { return m_nativeData; } + +private: + wxPrintBin m_bin; + int m_media; + wxPrintMode m_printMode; + + int m_printNoCopies; + wxPrintOrientation m_printOrientation; + bool m_printOrientationReversed; + bool m_printCollate; + + wxString m_printerName; + bool m_colour; + wxDuplexMode m_duplexMode; + wxPrintQuality m_printQuality; + wxPaperSize m_paperId; + wxSize m_paperSize; + + wxString m_filename; + + char* m_privData; + int m_privDataLen; + + wxPrintNativeDataBase *m_nativeData; + +private: + wxDECLARE_DYNAMIC_CLASS(wxPrintData); +}; + +/* + * wxPrintDialogData + * Encapsulates information displayed and edited in the printer dialog box. + * Contains a wxPrintData object which is filled in according to the values retrieved + * from the dialog. + */ + +class WXDLLIMPEXP_CORE wxPrintDialogData: public wxObject +{ +public: + wxPrintDialogData(); + wxPrintDialogData(const wxPrintDialogData& dialogData); + wxPrintDialogData(const wxPrintData& printData); + virtual ~wxPrintDialogData(); + + int GetFromPage() const { return m_printFromPage; } + int GetToPage() const { return m_printToPage; } + int GetMinPage() const { return m_printMinPage; } + int GetMaxPage() const { return m_printMaxPage; } + int GetNoCopies() const { return m_printNoCopies; } + bool GetAllPages() const { return m_printAllPages; } + bool GetSelection() const { return m_printSelection; } + bool GetCollate() const { return m_printCollate; } + bool GetPrintToFile() const { return m_printToFile; } + + void SetFromPage(int v) { m_printFromPage = v; } + void SetToPage(int v) { m_printToPage = v; } + void SetMinPage(int v) { m_printMinPage = v; } + void SetMaxPage(int v) { m_printMaxPage = v; } + void SetNoCopies(int v) { m_printNoCopies = v; } + void SetAllPages(bool flag) { m_printAllPages = flag; } + void SetSelection(bool flag) { m_printSelection = flag; } + void SetCollate(bool flag) { m_printCollate = flag; } + void SetPrintToFile(bool flag) { m_printToFile = flag; } + + void EnablePrintToFile(bool flag) { m_printEnablePrintToFile = flag; } + void EnableSelection(bool flag) { m_printEnableSelection = flag; } + void EnablePageNumbers(bool flag) { m_printEnablePageNumbers = flag; } + void EnableHelp(bool flag) { m_printEnableHelp = flag; } + + bool GetEnablePrintToFile() const { return m_printEnablePrintToFile; } + bool GetEnableSelection() const { return m_printEnableSelection; } + bool GetEnablePageNumbers() const { return m_printEnablePageNumbers; } + bool GetEnableHelp() const { return m_printEnableHelp; } + + // Is this data OK for showing the print dialog? + bool Ok() const { return IsOk(); } + bool IsOk() const { return m_printData.IsOk() ; } + + wxPrintData& GetPrintData() { return m_printData; } + void SetPrintData(const wxPrintData& printData) { m_printData = printData; } + + void operator=(const wxPrintDialogData& data); + void operator=(const wxPrintData& data); // Sets internal m_printData member + +private: + int m_printFromPage; + int m_printToPage; + int m_printMinPage; + int m_printMaxPage; + int m_printNoCopies; + bool m_printAllPages; + bool m_printCollate; + bool m_printToFile; + bool m_printSelection; + bool m_printEnableSelection; + bool m_printEnablePageNumbers; + bool m_printEnableHelp; + bool m_printEnablePrintToFile; + wxPrintData m_printData; + +private: + wxDECLARE_DYNAMIC_CLASS(wxPrintDialogData); +}; + +/* +* This is the data used (and returned) by the wxPageSetupDialog. +*/ + +// Compatibility with old name +#define wxPageSetupData wxPageSetupDialogData + +class WXDLLIMPEXP_CORE wxPageSetupDialogData: public wxObject +{ +public: + wxPageSetupDialogData(); + wxPageSetupDialogData(const wxPageSetupDialogData& dialogData); + wxPageSetupDialogData(const wxPrintData& printData); + virtual ~wxPageSetupDialogData(); + + wxSize GetPaperSize() const { return m_paperSize; } + wxPaperSize GetPaperId() const { return m_printData.GetPaperId(); } + wxPoint GetMinMarginTopLeft() const { return m_minMarginTopLeft; } + wxPoint GetMinMarginBottomRight() const { return m_minMarginBottomRight; } + wxPoint GetMarginTopLeft() const { return m_marginTopLeft; } + wxPoint GetMarginBottomRight() const { return m_marginBottomRight; } + + bool GetDefaultMinMargins() const { return m_defaultMinMargins; } + bool GetEnableMargins() const { return m_enableMargins; } + bool GetEnableOrientation() const { return m_enableOrientation; } + bool GetEnablePaper() const { return m_enablePaper; } + bool GetEnablePrinter() const { return m_enablePrinter; } + bool GetDefaultInfo() const { return m_getDefaultInfo; } + bool GetEnableHelp() const { return m_enableHelp; } + + // Is this data OK for showing the page setup dialog? + bool Ok() const { return IsOk(); } + 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. + void SetPaperSize(const wxSize& sz); + + void SetPaperId(wxPaperSize id) { m_printData.SetPaperId(id); } + + // Sets the wxPrintData id, plus the paper width/height if found in the paper database. + void SetPaperSize(wxPaperSize id); + + void SetMinMarginTopLeft(const wxPoint& pt) { m_minMarginTopLeft = pt; } + void SetMinMarginBottomRight(const wxPoint& pt) { m_minMarginBottomRight = pt; } + void SetMarginTopLeft(const wxPoint& pt) { m_marginTopLeft = pt; } + void SetMarginBottomRight(const wxPoint& pt) { m_marginBottomRight = pt; } + void SetDefaultMinMargins(bool flag) { m_defaultMinMargins = flag; } + void SetDefaultInfo(bool flag) { m_getDefaultInfo = flag; } + + void EnableMargins(bool flag) { m_enableMargins = flag; } + void EnableOrientation(bool flag) { m_enableOrientation = flag; } + void EnablePaper(bool flag) { m_enablePaper = flag; } + void EnablePrinter(bool flag) { m_enablePrinter = flag; } + void EnableHelp(bool flag) { m_enableHelp = flag; } + + // Use paper size defined in this object to set the wxPrintData + // paper id + void CalculateIdFromPaperSize(); + + // Use paper id in wxPrintData to set this object's paper size + void CalculatePaperSizeFromId(); + + wxPageSetupDialogData& operator=(const wxPageSetupDialogData& data); + wxPageSetupDialogData& operator=(const wxPrintData& data); + + wxPrintData& GetPrintData() { return m_printData; } + const wxPrintData& GetPrintData() const { return m_printData; } + void SetPrintData(const wxPrintData& printData); + +private: + wxSize m_paperSize; // The dimensions selected by the user (on return, same as in wxPrintData?) + wxPoint m_minMarginTopLeft; + wxPoint m_minMarginBottomRight; + wxPoint m_marginTopLeft; + wxPoint m_marginBottomRight; + bool m_defaultMinMargins; + bool m_enableMargins; + bool m_enableOrientation; + bool m_enablePaper; + bool m_enablePrinter; + bool m_getDefaultInfo; // Equiv. to PSD_RETURNDEFAULT + bool m_enableHelp; + wxPrintData m_printData; + +private: + wxDECLARE_DYNAMIC_CLASS(wxPageSetupDialogData); +}; + +#endif // wxUSE_PRINTING_ARCHITECTURE + +#endif +// _WX_CMNDATA_H_BASE_ diff --git a/lib/wxWidgets/include/wx/collheaderctrl.h b/lib/wxWidgets/include/wx/collheaderctrl.h new file mode 100644 index 0000000..546b7aa --- /dev/null +++ b/lib/wxWidgets/include/wx/collheaderctrl.h @@ -0,0 +1,106 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/collheaderctrl.h +// Purpose: wxCollapsibleHeaderCtrl +// Author: Tobias Taschner +// Created: 2015-09-19 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COLLAPSIBLEHEADER_CTRL_H_ +#define _WX_COLLAPSIBLEHEADER_CTRL_H_ + +#include "wx/defs.h" + +#if wxUSE_COLLPANE + +#include "wx/control.h" + +// class name +extern WXDLLIMPEXP_DATA_CORE(const char) wxCollapsibleHeaderCtrlNameStr[]; + +// +// wxGenericCollapsibleHeaderCtrl +// + +class WXDLLIMPEXP_CORE wxCollapsibleHeaderCtrlBase : public wxControl +{ +public: + wxCollapsibleHeaderCtrlBase() { } + + wxCollapsibleHeaderCtrlBase(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxBORDER_NONE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCollapsibleHeaderCtrlNameStr)) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxBORDER_NONE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCollapsibleHeaderCtrlNameStr)) + { + if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) + return false; + + SetLabel(label); + + return true; + } + + virtual void SetCollapsed(bool collapsed = true) = 0; + + virtual bool IsCollapsed() const = 0; + +private: + + wxDECLARE_NO_COPY_CLASS(wxCollapsibleHeaderCtrlBase); +}; + +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COLLAPSIBLEHEADER_CHANGED, wxCommandEvent); + +#define wxCollapsibleHeaderChangedHandler(func) \ + wxEVENT_HANDLER_CAST(wxCommandEventFunction, func) + +#define EVT_COLLAPSIBLEHEADER_CHANGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COLLAPSIBLEHEADER_CHANGED, id, wxCollapsibleHeaderChangedHandler(fn)) + +// Currently there is only the native implementation, use it for all ports. + +#include "wx/generic/collheaderctrl.h" + +class WXDLLIMPEXP_CORE wxCollapsibleHeaderCtrl + : public wxGenericCollapsibleHeaderCtrl +{ +public: + wxCollapsibleHeaderCtrl() { } + + wxCollapsibleHeaderCtrl(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxBORDER_NONE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCollapsibleHeaderCtrlNameStr)) + { + Create(parent, id, label, pos, size, style, validator, name); + } + +private: + + wxDECLARE_NO_COPY_CLASS(wxCollapsibleHeaderCtrl); +}; + +#endif // wxUSE_COLLPANE + +#endif // _WX_COLLAPSIBLEHEADER_CTRL_H_ diff --git a/lib/wxWidgets/include/wx/collpane.h b/lib/wxWidgets/include/wx/collpane.h new file mode 100644 index 0000000..9965463 --- /dev/null +++ b/lib/wxWidgets/include/wx/collpane.h @@ -0,0 +1,125 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/collpane.h +// Purpose: wxCollapsiblePane +// Author: Francesco Montorsi +// Modified by: +// Created: 8/10/2006 +// Copyright: (c) Francesco Montorsi +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COLLAPSABLE_PANE_H_BASE_ +#define _WX_COLLAPSABLE_PANE_H_BASE_ + +#include "wx/defs.h" + + +#if wxUSE_COLLPANE + +#include "wx/control.h" + +// class name +extern WXDLLIMPEXP_DATA_CORE(const char) wxCollapsiblePaneNameStr[]; + +// ---------------------------------------------------------------------------- +// wxCollapsiblePaneBase: interface for wxCollapsiblePane +// ---------------------------------------------------------------------------- + +#define wxCP_DEFAULT_STYLE (wxTAB_TRAVERSAL | wxNO_BORDER) +#define wxCP_NO_TLW_RESIZE (0x0002) + +class WXDLLIMPEXP_CORE wxCollapsiblePaneBase : public wxControl +{ +public: + wxCollapsiblePaneBase() {} + + virtual void Collapse(bool collapse = true) = 0; + void Expand() { Collapse(false); } + + virtual bool IsCollapsed() const = 0; + bool IsExpanded() const { return !IsCollapsed(); } + + virtual wxWindow *GetPane() const = 0; + + virtual wxString GetLabel() const wxOVERRIDE = 0; + virtual void SetLabel(const wxString& label) wxOVERRIDE = 0; + + virtual bool + InformFirstDirection(int direction, + int size, + int availableOtherDir) wxOVERRIDE + { + wxWindow* const p = GetPane(); + if ( !p ) + return false; + + if ( !p->InformFirstDirection(direction, size, availableOtherDir) ) + return false; + + InvalidateBestSize(); + + return true; + } +}; + + +// ---------------------------------------------------------------------------- +// event types and macros +// ---------------------------------------------------------------------------- + +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_COLLAPSIBLEPANE_CHANGED, id), + m_bCollapsed(collapsed) + { + SetEventObject(generator); + } + + bool GetCollapsed() const { return m_bCollapsed; } + void SetCollapsed(bool c) { m_bCollapsed = c; } + + + // default copy ctor, assignment operator and dtor are ok + virtual wxEvent *Clone() const wxOVERRIDE { return new wxCollapsiblePaneEvent(*this); } + +private: + bool m_bCollapsed; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxCollapsiblePaneEvent); +}; + +// ---------------------------------------------------------------------------- +// event types and macros +// ---------------------------------------------------------------------------- + +typedef void (wxEvtHandler::*wxCollapsiblePaneEventFunction)(wxCollapsiblePaneEvent&); + +#define wxCollapsiblePaneEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxCollapsiblePaneEventFunction, func) + +#define EVT_COLLAPSIBLEPANE_CHANGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COLLAPSIBLEPANE_CHANGED, id, wxCollapsiblePaneEventHandler(fn)) + + +#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) + #include "wx/gtk/collpane.h" +#else + #include "wx/generic/collpaneg.h" + + // use #define and not a typedef to allow forward declaring the class + #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_ diff --git a/lib/wxWidgets/include/wx/colordlg.h b/lib/wxWidgets/include/wx/colordlg.h new file mode 100644 index 0000000..5e724f4 --- /dev/null +++ b/lib/wxWidgets/include/wx/colordlg.h @@ -0,0 +1,89 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/colordlg.h +// Purpose: wxColourDialog +// Author: Vadim Zeitlin +// Modified by: +// Created: 01/02/97 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COLORDLG_H_BASE_ +#define _WX_COLORDLG_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_COLOURDLG + +#include "wx/colourdata.h" + +#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) + #include "wx/msw/colordlg.h" +#elif defined(__WXMAC__) && !defined(__WXUNIVERSAL__) + #include "wx/osx/colordlg.h" +#elif defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) + #include "wx/gtk/colordlg.h" +#elif defined(__WXQT__) + #include "wx/qt/colordlg.h" +#else + #include "wx/generic/colrdlgg.h" + + #define wxColourDialog wxGenericColourDialog +#endif + +// Under some platforms (currently only wxMSW) wxColourDialog can send events +// of this type while it is shown. +// +// Notice that this class is almost identical to wxColourPickerEvent but it +// doesn't really sense to reuse the same class for both controls. +class WXDLLIMPEXP_CORE wxColourDialogEvent : public wxCommandEvent +{ +public: + wxColourDialogEvent() + { + } + + wxColourDialogEvent(wxEventType evtType, + wxColourDialog* dialog, + const wxColour& colour) + : wxCommandEvent(evtType, dialog->GetId()), + m_colour(colour) + { + SetEventObject(dialog); + } + + // default copy ctor and dtor are ok + + wxColour GetColour() const { return m_colour; } + void SetColour(const wxColour& colour) { m_colour = colour; } + + virtual wxEvent *Clone() const wxOVERRIDE + { + return new wxColourDialogEvent(*this); + } + +private: + wxColour m_colour; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxColourDialogEvent); +}; + +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COLOUR_CHANGED, wxColourDialogEvent); + +#define wxColourDialogEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxColourDialogEventFunction, func) + +#define EVT_COLOUR_CHANGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COLOUR_CHANGED, id, wxColourDialogEventHandler(fn)) + + +// get the colour from user and return it +WXDLLIMPEXP_CORE wxColour wxGetColourFromUser(wxWindow *parent = NULL, + const wxColour& colInit = wxNullColour, + const wxString& caption = wxEmptyString, + wxColourData *data = NULL); + +#endif // wxUSE_COLOURDLG + +#endif + // _WX_COLORDLG_H_BASE_ diff --git a/lib/wxWidgets/include/wx/colour.h b/lib/wxWidgets/include/wx/colour.h new file mode 100644 index 0000000..7413b28 --- /dev/null +++ b/lib/wxWidgets/include/wx/colour.h @@ -0,0 +1,249 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/colour.h +// Purpose: wxColourBase definition +// Author: Julian Smart +// Modified by: Francesco Montorsi +// Created: +// Copyright: Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COLOUR_H_BASE_ +#define _WX_COLOUR_H_BASE_ + +#include "wx/defs.h" +#include "wx/gdiobj.h" + +class WXDLLIMPEXP_FWD_CORE wxColour; + +// 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 +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +#define wxWXCOLOUR_CTOR_FROM_CHAR \ + wxColour(const char *colourName) { Init(); Set(colourName); } +#else // wxNO_IMPLICIT_WXSTRING_ENCODING +#define wxWXCOLOUR_CTOR_FROM_CHAR +#endif +#define DEFINE_STD_WXCOLOUR_CONSTRUCTORS \ + 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); } \ + wxWXCOLOUR_CTOR_FROM_CHAR \ + wxColour(const wchar_t *colourName) { Init(); Set(colourName); } + + +// flags for wxColour -> wxString conversion (see wxColour::GetAsString) +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,WXDLLIMPEXP_CORE) +#endif + +//----------------------------------------------------------------------------- +// wxColourBase: this class has no data members, just some functions to avoid +// code redundancy in all native wxColour implementations +//----------------------------------------------------------------------------- + +/* 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( __WXMSW__ ) || defined( __WXQT__ ) +#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 + typedef unsigned char ChannelType; + + wxDECLARE_DEFAULT_COPY_AND_DEF(wxColourBase) + + virtual ~wxColourBase() {} + + + // Set() functions + // --------------- + + void Set(ChannelType red, + ChannelType green, + ChannelType blue, + ChannelType alpha = wxALPHA_OPAQUE) + { InitRGBA(red, green, blue, alpha); } + + // implemented in colourcmn.cpp + bool Set(const wxString &str) + { return FromString(str); } + + void Set(unsigned long colRGB) + { + // we don't need to know sizeof(long) here because we assume that the three + // least significant bytes contain the R, G and B values + Set((ChannelType)(0xFF & colRGB), + (ChannelType)(0xFF & (colRGB >> 8)), + (ChannelType)(0xFF & (colRGB >> 16))); + } + + + + // accessors + // --------- + + virtual ChannelType Red() const = 0; + virtual ChannelType Green() const = 0; + virtual ChannelType Blue() const = 0; + virtual ChannelType Alpha() const + { return wxALPHA_OPAQUE ; } + + // These getters return the values as unsigned int, which avoids promoting + // them to (signed) int in arithmetic expressions, unlike the ones above. + unsigned int GetRed() const { return Red(); } + unsigned int GetGreen() const { return Green(); } + unsigned int GetBlue() const { return Blue(); } + unsigned int GetAlpha() const { return Alpha(); } + + virtual bool IsSolid() const + { return true; } + + // 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 GetRed() | (GetGreen() << 8) | (GetBlue() << 16); } + + wxUint32 GetRGBA() const + { return GetRed() | (GetGreen() << 8) | (GetBlue() << 16) | (GetAlpha() << 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 + + // Return the perceived brightness of the colour, with 0 for black and 1 + // for white. + double GetLuminance() const; + + // 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); + +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 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 wxOVERRIDE + { + wxFAIL_MSG( "must be overridden if used" ); + + return NULL; + } + + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *WXUNUSED(data)) const wxOVERRIDE + { + 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(__WXMSW__) + #include "wx/msw/colour.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/colour.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/colour.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/colour.h" +#elif defined(__WXDFB__) + #include "wx/generic/colour.h" +#elif defined(__WXX11__) + #include "wx/x11/colour.h" +#elif defined(__WXMAC__) + #include "wx/osx/colour.h" +#elif defined(__WXQT__) + #include "wx/qt/colour.h" +#endif + +#define wxColor wxColour + +#endif // _WX_COLOUR_H_BASE_ diff --git a/lib/wxWidgets/include/wx/colourdata.h b/lib/wxWidgets/include/wx/colourdata.h new file mode 100644 index 0000000..d05a9a3 --- /dev/null +++ b/lib/wxWidgets/include/wx/colourdata.h @@ -0,0 +1,56 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 SetChooseAlpha(bool flag) { m_chooseAlpha = flag; } + bool GetChooseAlpha() const { return m_chooseAlpha; } + 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; + +protected: + bool m_chooseAlpha; + + wxDECLARE_DYNAMIC_CLASS(wxColourData); +}; + +#endif // _WX_COLOURDATA_H_ diff --git a/lib/wxWidgets/include/wx/combo.h b/lib/wxWidgets/include/wx/combo.h new file mode 100644 index 0000000..e70edda --- /dev/null +++ b/lib/wxWidgets/include/wx/combo.h @@ -0,0 +1,896 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/combo.h +// Purpose: wxComboCtrl declaration +// Author: Jaakko Salli +// Modified by: +// Created: Apr-30-2006 +// Copyright: (c) Jaakko Salli +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COMBOCONTROL_H_BASE_ +#define _WX_COMBOCONTROL_H_BASE_ + + +/* + A few words about all the classes defined in this file are probably in + order: why do we need extra wxComboCtrl and wxComboPopup classes? + + This is because a traditional combobox is a combination of a text control + (with a button allowing to open the pop down list) with a listbox and + wxComboBox class is exactly such control, however we want to also have other + combinations - in fact, we want to allow anything at all to be used as pop + down list, not just a wxListBox. + + So we define a base wxComboCtrl which can use any control as pop down + list and wxComboBox deriving from it which implements the standard wxWidgets + combobox API. wxComboCtrl needs to be told somehow which control to use + and this is done by SetPopupControl(). However, we need something more than + just a wxControl in this method as, for example, we need to call + SetSelection("initial text value") and wxControl doesn't have such method. + So we also need a wxComboPopup which is just a very simple interface which + must be implemented by a control to be usable as a popup. + + We couldn't derive wxComboPopup from wxControl as this would make it + impossible to have a class deriving from both wxListBx and from it, so + instead it is just a mix-in. + */ + + +#include "wx/defs.h" + +#if wxUSE_COMBOCTRL + +#include "wx/control.h" +#include "wx/renderer.h" // this is needed for wxCONTROL_XXX flags +#include "wx/bmpbndl.h" +#include "wx/textentry.h" +#include "wx/time.h" // needed for wxMilliClock_t + +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; +class WXDLLIMPEXP_FWD_CORE wxComboPopup; + +// +// New window styles for wxComboCtrlBase +// +enum +{ + // Double-clicking a read-only combo triggers call to popup's OnComboPopup. + // In wxOwnerDrawnComboBox, for instance, it cycles item. + wxCC_SPECIAL_DCLICK = 0x0100, + + // Dropbutton acts like standard push button. + wxCC_STD_BUTTON = 0x0200 +}; + + +// wxComboCtrl internal flags +enum +{ + // First those that can be passed to Customize. + // It is Windows style for all flags to be clear. + + // Button is preferred outside the border (GTK style) + wxCC_BUTTON_OUTSIDE_BORDER = 0x0001, + // Show popup on mouse up instead of mouse down (which is the Windows style) + wxCC_POPUP_ON_MOUSE_UP = 0x0002, + // All text is not automatically selected on click + wxCC_NO_TEXT_AUTO_SELECT = 0x0004, + // Drop-button stays down as long as popup is displayed. + wxCC_BUTTON_STAYS_DOWN = 0x0008, + // Drop-button covers the entire control. + wxCC_FULL_BUTTON = 0x0010, + // Drop-button goes over the custom-border (used under WinVista). + wxCC_BUTTON_COVERS_BORDER = 0x0020, + + // Internal use: signals creation is complete + wxCC_IFLAG_CREATED = 0x0100, + // Internal use: really put button outside + wxCC_IFLAG_BUTTON_OUTSIDE = 0x0200, + // 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). + wxCC_IFLAG_USE_ALT_POPUP = 0x1000, + // Internal use: Skip popup animation. + wxCC_IFLAG_DISABLE_POPUP_ANIM = 0x2000, + // Internal use: Drop-button is a bitmap button or has non-default size + // (but can still be on either side of the control), regardless whether + // specified by the platform or the application. + wxCC_IFLAG_HAS_NONSTANDARD_BUTTON = 0x4000 +}; + + +// Flags used by PreprocessMouseEvent and HandleButtonMouseEvent +enum +{ + wxCC_MF_ON_BUTTON = 0x0001, // cursor is on dropbutton area + wxCC_MF_ON_CLICK_AREA = 0x0002 // cursor is on dropbutton or other area + // that can be clicked to show the popup. +}; + + +// Namespace for wxComboCtrl feature flags +struct wxComboCtrlFeatures +{ + enum + { + MovableButton = 0x0001, // Button can be on either side of control + BitmapButton = 0x0002, // Button may be replaced with bitmap + ButtonSpacing = 0x0004, // Button can have spacing from the edge + // of the control + 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 + // painted + Borderless = 0x0040, // wxNO_BORDER window style works + + // There are no feature flags for... + // PushButtonBitmapBackground - if its in wxRendererNative, then it should be + // not an issue to have it automatically under the bitmap. + + All = MovableButton|BitmapButton| + ButtonSpacing|TextIndent| + PaintControl|PaintWritable| + Borderless + }; +}; + + +class WXDLLIMPEXP_CORE wxComboCtrlBase : public wxControl, + public wxTextEntry +{ + friend class wxComboPopup; + friend class wxComboPopupEvtHandler; +public: + // ctors and such + wxComboCtrlBase() : wxControl(), wxTextEntry() { Init(); } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name); + + virtual ~wxComboCtrlBase(); + + // 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(bool generateEvent=false); + + // Override for totally custom combo action + virtual void OnButtonClick(); + + // return true if the popup is currently shown + bool IsPopupShown() const { return m_popupWinState == Visible; } + + // set interface class instance derived from wxComboPopup + // NULL popup can be used to indicate default in a derived class + void SetPopupControl( wxComboPopup* popup ) + { + DoSetPopupControl(popup); + } + + // get interface class instance derived from wxComboPopup + wxComboPopup* GetPopupControl() + { + EnsurePopupControl(); + return m_popupInterface; + } + + // get the popup window containing the popup control + wxWindow *GetPopupWindow() const { return m_winPopup; } + + // Set the control to use instead of the default text control for the main + // (always visible) part of the combobox. + void SetMainControl(wxWindow* win); + + // Get the text control which is part of the combobox. + wxTextCtrl *GetTextCtrl() const { return m_text; } + + // get the dropdown button which is part of the combobox + // note: its not necessarily a wxButton or wxBitmapButton + wxWindow *GetButton() const { return m_btn; } + + // forward these methods to all subcontrols + virtual bool Enable(bool enable = true) wxOVERRIDE; + virtual bool Show(bool show = true) wxOVERRIDE; + virtual bool SetFont(const wxFont& font) wxOVERRIDE; + + // + // 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) wxOVERRIDE + { wxTextEntryBase::SetValue(value); } + virtual void ChangeValue(const wxString& value) wxOVERRIDE + { wxTextEntryBase::ChangeValue(value); } + + virtual void WriteText(const wxString& text) wxOVERRIDE; + virtual void AppendText(const wxString& text) wxOVERRIDE + { wxTextEntryBase::AppendText(text); } + + virtual wxString GetValue() const wxOVERRIDE + { return wxTextEntryBase::GetValue(); } + + virtual wxString GetRange(long from, long to) const wxOVERRIDE + { 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) wxOVERRIDE; + + virtual void Remove(long from, long to) wxOVERRIDE; + + virtual void Copy() wxOVERRIDE; + virtual void Cut() wxOVERRIDE; + virtual void Paste() wxOVERRIDE; + + virtual void Undo() wxOVERRIDE; + virtual void Redo() wxOVERRIDE; + virtual bool CanUndo() const wxOVERRIDE; + virtual bool CanRedo() const wxOVERRIDE; + + virtual void SetInsertionPoint(long pos) wxOVERRIDE; + virtual long GetInsertionPoint() const wxOVERRIDE; + virtual long GetLastPosition() const wxOVERRIDE; + + virtual void SetSelection(long from, long to) wxOVERRIDE; + virtual void GetSelection(long *from, long *to) const wxOVERRIDE; + + virtual bool IsEditable() const wxOVERRIDE; + virtual void SetEditable(bool editable) wxOVERRIDE; + + virtual bool SetHint(const wxString& hint) wxOVERRIDE; + virtual wxString GetHint() const wxOVERRIDE; + + // This method sets the text without affecting list selection + // (ie. wxComboPopup::SetStringValue doesn't get called). + void SetText(const wxString& value); + + // This method sets value and also optionally sends EVT_TEXT + // (needed by combo popups) + 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 + // + + // Sets minimum width of the popup. If wider than combo control, it will extend to the left. + // Remarks: + // * Value -1 indicates the default. + // * Custom popup may choose to ignore this (wxOwnerDrawnComboBox does not). + void SetPopupMinWidth( int width ) + { + m_widthMinPopup = width; + } + + // Sets preferred maximum height of the popup. + // Remarks: + // * Value -1 indicates the default. + // * Custom popup may choose to ignore this (wxOwnerDrawnComboBox does not). + void SetPopupMaxHeight( int height ) + { + m_heightPopup = height; + } + + // Extends popup size horizontally, relative to the edges of the combo control. + // Remarks: + // * Popup minimum width may override extLeft (ie. it has higher precedence). + // * Values 0 indicate default. + // * Custom popup may not take this fully into account (wxOwnerDrawnComboBox takes). + void SetPopupExtents( int extLeft, int extRight ) + { + m_extLeft = extLeft; + m_extRight = extRight; + } + + // Set width, in pixels, of custom paint area in writable combo. + // In read-only, used to indicate area that is not covered by the + // focus rectangle (which may or may not be drawn, depending on the + // popup type). + void SetCustomPaintWidth( int width ); + int GetCustomPaintWidth() const { return m_widthCustomPaint; } + + // Set side of the control to which the popup will align itself. + // Valid values are wxLEFT, wxRIGHT and 0. The default value 0 wmeans + // that the side of the button will be used. + void SetPopupAnchor( int anchorSide ) + { + m_anchorSide = anchorSide; + } + + // Set position of dropdown button. + // width: button width. <= 0 for default. + // height: button height. <= 0 for default. + // side: wxLEFT or wxRIGHT, indicates on which side the button will be placed. + // spacingX: empty space on sides of the button. Default is 0. + // Remarks: + // There is no spacingY - the button will be centred vertically. + void SetButtonPosition( int width = -1, + int height = -1, + int side = wxRIGHT, + int spacingX = 0 ); + + // Returns current size of the dropdown button. + wxSize GetButtonSize(); + + // + // Sets dropbutton to be drawn with custom bitmaps. + // + // bmpNormal: drawn when cursor is not on button + // pushButtonBg: Draw push button background below the image. + // NOTE! This is usually only properly supported on platforms with appropriate + // method in wxRendererNative. + // bmpPressed: drawn when button is depressed + // bmpHover: drawn when cursor hovers on button. This is ignored on platforms + // that do not generally display hover differently. + // bmpDisabled: drawn when combobox is disabled. + void SetButtonBitmaps( const wxBitmapBundle& bmpNormal, + bool pushButtonBg = false, + const wxBitmapBundle& bmpPressed = wxBitmapBundle(), + const wxBitmapBundle& bmpHover = wxBitmapBundle(), + const wxBitmapBundle& bmpDisabled = wxBitmapBundle() ); + +#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. + wxDEPRECATED( void SetTextIndent( int indent ) ); + + // Returns actual indentation in pixels. + wxDEPRECATED( wxCoord GetTextIndent() const ); +#endif + + // Returns area covered by the text field. + const wxRect& GetTextRect() const + { + return m_tcArea; + } + + // Call with enable as true to use a type of popup window that guarantees ability + // to focus the popup control, and normal function of common native controls. + // This alternative popup window is usually a wxDialog, and as such its parent + // frame will appear as if the focus has been lost from it. + void UseAltPopupWindow( bool enable = true ) + { + wxASSERT_MSG( !m_winPopup, + wxT("call this only before SetPopupControl") ); + + if ( enable ) + m_iFlags |= wxCC_IFLAG_USE_ALT_POPUP; + else + m_iFlags &= ~wxCC_IFLAG_USE_ALT_POPUP; + } + + // Call with false to disable popup animation, if any. + void EnablePopupAnimation( bool enable = true ) + { + if ( enable ) + m_iFlags &= ~wxCC_IFLAG_DISABLE_POPUP_ANIM; + else + m_iFlags |= wxCC_IFLAG_DISABLE_POPUP_ANIM; + } + + // + // Utilities needed by the popups or native implementations + // + + // Returns true if given key combination should toggle the popup. + // NB: This is a separate from other keyboard handling because: + // 1) Replaceability. + // 2) Centralized code (otherwise it'd be split up between + // wxComboCtrl key handler and wxVListBoxComboPopup's + // key handler). + virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const = 0; + + // Prepare background of combo control or an item in a dropdown list + // in a way typical on platform. This includes painting the focus/disabled + // background and setting the clipping region. + // Unless you plan to paint your own focus indicator, you should always call this + // in your wxComboPopup::PaintComboControl implementation. + // In addition, it sets pen and text colour to what looks good and proper + // against the background. + // flags: wxRendererNative flags: wxCONTROL_ISSUBMENU: is drawing a list item instead of combo control + // wxCONTROL_SELECTED: list item is selected + // wxCONTROL_DISABLED: control/item is disabled + virtual void PrepareBackground( wxDC& dc, const wxRect& rect, int flags ) const; + + // Returns true if focus indicator should be drawn in the control. + bool ShouldDrawFocus() const + { + const wxWindow* curFocus = FindFocus(); + return ( IsPopupWindowState(Hidden) && + (curFocus == m_mainCtrlWnd || (m_btn && curFocus == m_btn)) && + (m_windowStyle & wxCB_READONLY) ); + } + + // These methods return appropriate dropbutton bitmaps + wxBitmap GetBitmapNormal() const { return m_bmpNormal.GetBitmapFor(this); } + wxBitmap GetBitmapPressed() const { return m_bmpPressed.GetBitmapFor(this); } + wxBitmap GetBitmapHover() const { return m_bmpHover.GetBitmapFor(this); } + wxBitmap GetBitmapDisabled() const { return m_bmpDisabled.GetBitmapFor(this); } + + // 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(bool generateEvent); + + // called if popup is destroyed not by wxComboCtrl itself + void OnPopupDestroy(); + + // PopupShown states + enum + { + Hidden = 0, + Closing = 1, + Animating = 2, + Visible = 3 + }; + + bool IsPopupWindowState( int state ) const { return (state == m_popupWinState) ? true : false; } + + wxByte GetPopupWindowState() const { return m_popupWinState; } + + // 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() wxOVERRIDE + { return m_mainCtrlWnd; } + + // also set the embedded wxTextCtrl colours + virtual bool SetForegroundColour(const wxColour& colour) wxOVERRIDE; + virtual bool SetBackgroundColour(const wxColour& colour) wxOVERRIDE; + +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.empty() && + !m_hintText.empty() && + !ShouldDrawFocus() ); + } + + // + // Override these for customization purposes + // + + // called from wxSizeEvent handler + virtual void OnResize() = 0; + + // Return native text indentation + // (i.e. text margin, for pure text, not textctrl) + virtual wxCoord GetNativeTextIndent() const; + + // Called in syscolourchanged handler and base create + virtual void OnThemeChange(); + + // Creates wxTextCtrl. + // extraStyle: Extra style parameters + void CreateTextCtrl( int extraStyle ); + + // Called when text was changed programmatically + // (e.g. from WriteText()) + void OnSetValue(const wxString& value); + + // Flags for DrawButton + enum + { + Button_PaintBackground = 0x0001, // Paints control background below the button + Button_BitmapOnly = 0x0002 // Only paints the bitmap + }; + + // Draws dropbutton. Using wxRenderer or bitmaps, as appropriate. + // 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 ); + bool HandleButtonMouseEvent( wxMouseEvent& event, int flags ); + + // returns true if event was consumed or filtered (event type is also set to 0 in this case) + bool PreprocessMouseEvent( wxMouseEvent& event, int flags ); + + // + // This will handle left_down and left_dclick events outside button in a Windows-like manner. + // If you need alternate behaviour, it is recommended you manipulate and filter events to it + // instead of building your own handling routine (for reference, on wxEVT_LEFT_DOWN it will + // toggle popup and on wxEVT_LEFT_DCLICK it will do the same or run the popup's dclick method, + // if defined - you should pass events of other types of it for common processing). + void HandleNormalMouseEvent( wxMouseEvent& event ); + + // Creates popup window, calls interface->Create(), etc + void CreatePopup(); + + // Destroy popup window and all related constructs + 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 wxOVERRIDE; + virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const wxOVERRIDE; + + // NULL popup can be used to indicate default in a derived class + virtual void DoSetPopupControl(wxComboPopup* popup); + + // ensures there is at least the default popup + void EnsurePopupControl(); + + // Recalculates button and textctrl areas. Called when size or button setup change. + // btnWidth: default/calculated width of the dropbutton. 0 means unchanged, + // just recalculate. + void CalculateAreas( int btnWidth = 0 ); + + // Standard textctrl positioning routine. Just give it platform-dependent + // textctrl coordinate adjustment. + virtual void PositionTextCtrl( int textCtrlXAdjust = 0, + int textCtrlYAdjust = 0); + + // event handlers + void OnSizeEvent( wxSizeEvent& event ); + void OnFocusEvent(wxFocusEvent& event); + void OnIdleEvent(wxIdleEvent& event); + void OnTextCtrlEvent(wxCommandEvent& event); + void OnSysColourChanged(wxSysColourChangedEvent& event); + void OnKeyEvent(wxKeyEvent& event); + void OnCharEvent(wxKeyEvent& event); + + void OnTextFocus(wxFocusEvent& event); + void OnTextKey(wxKeyEvent& event); + + void OnPopupActivate(wxActivateEvent& event); + void OnPopupKey(wxKeyEvent& event); + void OnPopupSize(wxSizeEvent& event); + + void OnPopupMouseEvent(wxMouseEvent& event); + + // This function can be used as event handle for wxEVT_DPI_CHANGED event + // and simply recalculates button size when it happens. + void WXHandleDPIChanged(wxDPIChangedEvent& event); + + // Set customization flags (directs how wxComboCtrlBase helpers behave) + void Customize( wxUint32 flags ) { m_iFlags |= flags; } + + // Dispatches size event and refreshes + void RecalcAndRefresh(); + + // Flags for DoShowPopup and AnimateShow + enum + { + ShowBelow = 0x0000, // Showing popup below the control + ShowAbove = 0x0001, // Showing popup above the control + CanDeferShow = 0x0002 // Can only return true from AnimateShow if this is set + }; + + // Shows and positions the popup. + virtual void DoShowPopup( const wxRect& rect, int flags ); + + // Implement in derived class to create a drop-down animation. + // Return true if finished immediately. Otherwise popup is only + // shown when the derived class call DoShowPopup. + // Flags are same as for DoShowPopup. + virtual bool AnimateShow( const wxRect& rect, int flags ); + +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip( wxToolTip *tip ) wxOVERRIDE; +#endif + + // protected wxTextEntry methods + virtual void DoSetValue(const wxString& value, int flags) wxOVERRIDE; + virtual wxString DoGetValue() const wxOVERRIDE; + virtual wxWindow *GetEditableWindow() wxOVERRIDE { return this; } + + // margins functions + virtual bool DoSetMargins(const wxPoint& pt) wxOVERRIDE; + virtual wxPoint DoGetMargins() const wxOVERRIDE; + + // 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; + + // This pointer is non-null if we use a text control, and not some other + // window, as the main control. + wxTextCtrl* m_text; + + // the window and button we show all the time + wxWindow* m_mainWindow; + wxWindow* m_btn; + + // wxPopupWindow or similar containing the window managed by the interface. + wxWindow* m_winPopup; + + // the popup control/panel + wxWindow* m_popup; + + // popup interface + wxComboPopup* m_popupInterface; + + // this is for the top level window + wxEvtHandler* m_toplevEvtHandler; + + // main (ie. topmost) window of a composite control (default = this) + wxWindow* m_mainCtrlWnd; + + // used to prevent immediate re-popupping in case closed popup + // by clicking on the combo control (needed because of inconsistent + // transient implementation across platforms). + wxMilliClock_t m_timeCanAcceptClick; + + // how much popup should expand to the left/right of the control + wxCoord m_extLeft; + wxCoord m_extRight; + + // minimum popup width + wxCoord m_widthMinPopup; + + // preferred popup height + wxCoord m_heightPopup; + + // how much of writable combo is custom-paint by callback? + // also used to indicate area that is not covered by "blue" + // selection indicator. + wxCoord m_widthCustomPaint; + + // left margin, in pixels + wxCoord m_marginLeft; + + // side on which the popup is aligned + int m_anchorSide; + + // Width of the "fake" border + wxCoord m_widthCustomBorder; + + // The button and textctrl click/paint areas + 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; + + // button position + int m_btnWid; + int m_btnHei; + int m_btnSide; + int m_btnSpacingX; + + // last default button width + int m_btnWidDefault; + + // custom dropbutton bitmaps + wxBitmapBundle m_bmpNormal; + wxBitmapBundle m_bmpPressed; + wxBitmapBundle m_bmpHover; + wxBitmapBundle m_bmpDisabled; + + // area used by the button + wxSize m_btnSize; + + // 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; + + // is the popup window currently shown? + wxByte m_popupWinState; + + // should the focus be reset to the textctrl in idle time? + bool m_resetFocus; + + // is the text-area background colour overridden? + bool m_hasTcBgCol; + + // flags used while popup is shown + bool m_beenInsidePopup; + bool m_blockEventsToPopup; + +private: + void Init(); + + wxByte m_ignoreEvtText; // Number of next EVT_TEXTs to ignore + + wxDECLARE_EVENT_TABLE(); + + wxDECLARE_ABSTRACT_CLASS(wxComboCtrlBase); +}; + + +// ---------------------------------------------------------------------------- +// wxComboPopup is the interface which must be implemented by a control to be +// used as a popup by wxComboCtrl +// ---------------------------------------------------------------------------- + + +// wxComboPopup internal flags +enum +{ + wxCP_IFLAG_CREATED = 0x0001 // Set by wxComboCtrlBase after Create is called +}; + +class WXDLLIMPEXP_FWD_CORE wxComboCtrl; + + +class WXDLLIMPEXP_CORE wxComboPopup +{ + friend class wxComboCtrlBase; +public: + wxComboPopup() + { + m_combo = NULL; + m_iFlags = 0; + } + + // This is called immediately after construction finishes. m_combo member + // variable has been initialized before the call. + // NOTE: It is not in constructor so the derived class doesn't need to redefine + // a default constructor of its own. + virtual void Init() { } + + virtual ~wxComboPopup(); + + // Create the popup child control. + // 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; + + // Called immediately after the popup is shown + virtual void OnPopup(); + + // Called when popup is dismissed + virtual void OnDismiss(); + + // Called just prior to displaying popup. + // Default implementation does nothing. + virtual void SetStringValue( const wxString& value ); + + // 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 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(); + + // Return final size of popup. Called on every popup, just prior to OnShow. + // minWidth = preferred minimum width for window + // prefHeight = preferred height. Only applies if > 0, + // maxHeight = max height for window, as limited by screen size + // and should only be rounded down, if necessary. + virtual wxSize GetAdjustedSize( int minWidth, int prefHeight, int maxHeight ); + + // Return true if you want delay call to Create until the popup is shown + // for the first time. It is more efficient, but note that it is often + // more convenient to have the control created immediately. + // Default returns false. + virtual bool LazyCreate(); + + // + // Utilities + // + + // Hides the popup + void Dismiss(); + + // Returns true if Create has been called. + bool IsCreated() const + { + 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, + const wxRect& rect ); + +protected: + wxComboCtrlBase* m_combo; + wxUint32 m_iFlags; + +private: + // Called in wxComboCtrlBase::SetPopupControl + void InitBase(wxComboCtrlBase *combo) + { + m_combo = combo; + } +}; + + +// ---------------------------------------------------------------------------- +// include the platform-dependent header defining the real class +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + // No native universal (but it must still be first in the list) +#elif defined(__WXMSW__) + #include "wx/msw/combo.h" +#endif + +// Any ports may need generic as an alternative +#include "wx/generic/combo.h" + +#endif // wxUSE_COMBOCTRL + +#endif + // _WX_COMBOCONTROL_H_BASE_ diff --git a/lib/wxWidgets/include/wx/combobox.h b/lib/wxWidgets/include/wx/combobox.h new file mode 100644 index 0000000..35d7368 --- /dev/null +++ b/lib/wxWidgets/include/wx/combobox.h @@ -0,0 +1,90 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/combobox.h +// Purpose: wxComboBox declaration +// Author: Vadim Zeitlin +// Modified by: +// Created: 24.12.00 +// Copyright: (c) 1996-2000 wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COMBOBOX_H_BASE_ +#define _WX_COMBOBOX_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_COMBOBOX + +// 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/ctrlsub.h" +#include "wx/textentry.h" + +class WXDLLIMPEXP_CORE wxComboBoxBase : public wxItemContainer, + public wxTextEntry +{ +public: + // override these methods to disambiguate between two base classes versions + virtual void Clear() wxOVERRIDE + { + wxItemContainer::Clear(); + wxTextEntry::Clear(); + } + + // 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(); } + + // 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 wxOVERRIDE = 0; + virtual void GetSelection(long *from, long *to) const wxOVERRIDE = 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(); } +}; + +// ---------------------------------------------------------------------------- +// include the platform-dependent header defining the real class +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/combobox.h" +#elif defined(__WXMSW__) + #include "wx/msw/combobox.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/combobox.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/combobox.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/combobox.h" +#elif defined(__WXMAC__) + #include "wx/osx/combobox.h" +#elif defined(__WXQT__) + #include "wx/qt/combobox.h" +#endif + +#endif // wxUSE_COMBOBOX + +#endif // _WX_COMBOBOX_H_BASE_ diff --git a/lib/wxWidgets/include/wx/commandlinkbutton.h b/lib/wxWidgets/include/wx/commandlinkbutton.h new file mode 100644 index 0000000..d42322b --- /dev/null +++ b/lib/wxWidgets/include/wx/commandlinkbutton.h @@ -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 = wxASCII_STR(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 = wxASCII_STR(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 = wxASCII_STR(wxButtonNameStr)); + + virtual void SetMainLabelAndNote(const wxString& mainLabel, + const wxString& note) wxOVERRIDE + { + 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 = wxASCII_STR(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_ diff --git a/lib/wxWidgets/include/wx/compiler.h b/lib/wxWidgets/include/wx/compiler.h new file mode 100644 index 0000000..48bc4b6 --- /dev/null +++ b/lib/wxWidgets/include/wx/compiler.h @@ -0,0 +1,122 @@ +/* + * 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 + * 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__ < 1400 +# error "This Visual C++ version is not supported any longer (at least MSVC 2005 required)." +#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 __VISUALC__ < 2000 + /* There is no __VISUALC13__! */ +# define __VISUALC14__ +#else + /* + Don't forget to update include/msvc/wx/setup.h as well when adding + support for a newer MSVC version here. + */ +# pragma message("Please update wx/compiler.h to recognize this VC++ version") +#endif + +#elif defined(__SUNPRO_CC) +# ifndef __SUNCC__ +# define __SUNCC__ __SUNPRO_CC +# endif /* Sun CC */ +#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 + /* + Things used to be simple with the _MSC_VER value and the version number + increasing in lock step, but _MSC_VER value of 1900 is VC14 and not the + non existing (presumably for the superstitious reasons) VC13, so we now + need to account for this with an extra offset. + */ +# define wxVISUALC_VERSION(major) ( (6 - (major >= 14 ? 1 : 0) + 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 + +/* + wxCHECK_MINGW32_VERSION() is defined in wx/msw/gccpriv.h which is included + later, see comments there. + */ + +#endif // _WX_COMPILER_H_ diff --git a/lib/wxWidgets/include/wx/compositewin.h b/lib/wxWidgets/include/wx/compositewin.h new file mode 100644 index 0000000..8e9e2e8 --- /dev/null +++ b/lib/wxWidgets/include/wx/compositewin.h @@ -0,0 +1,284 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/compositewin.h +// Purpose: wxCompositeWindow<> declaration +// Author: Vadim Zeitlin +// Created: 2011-01-02 +// Copyright: (c) 2011 Vadim Zeitlin +// 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. +// ---------------------------------------------------------------------------- + +// This is the base class of wxCompositeWindow which takes care of propagating +// colours, fonts etc changes to all the children, but doesn't bother with +// handling their events or focus. There should be rarely any need to use it +// rather than the full wxCompositeWindow. + +// The template parameter W must be a wxWindow-derived class. +template +class wxCompositeWindowSettersOnly : public W +{ +public: + typedef W BaseWindowClass; + + // 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) wxOVERRIDE + { + if ( !BaseWindowClass::SetForegroundColour(colour) ) + return false; + + SetForAllParts(&wxWindowBase::SetForegroundColour, colour); + + return true; + } + + virtual bool SetBackgroundColour(const wxColour& colour) wxOVERRIDE + { + if ( !BaseWindowClass::SetBackgroundColour(colour) ) + return false; + + SetForAllParts(&wxWindowBase::SetBackgroundColour, colour); + + return true; + } + + virtual bool SetFont(const wxFont& font) wxOVERRIDE + { + if ( !BaseWindowClass::SetFont(font) ) + return false; + + SetForAllParts(&wxWindowBase::SetFont, font); + + return true; + } + + virtual bool SetCursor(const wxCursor& cursor) wxOVERRIDE + { + if ( !BaseWindowClass::SetCursor(cursor) ) + return false; + + SetForAllParts(&wxWindowBase::SetCursor, cursor); + + return true; + } + + virtual void SetLayoutDirection(wxLayoutDirection dir) wxOVERRIDE + { + BaseWindowClass::SetLayoutDirection(dir); + + SetForAllParts(&wxWindowBase::SetLayoutDirection, dir); + + // The child layout almost invariably depends on the layout direction, + // so redo it when it changes. + // + // However avoid doing it when we're called from wxWindow::Create() in + // wxGTK as the derived window is not fully created yet and calling its + // SetSize() may be unexpected. This does mean that any future calls to + // SetLayoutDirection(wxLayout_Default) wouldn't result in a re-layout + // either, but then we're not supposed to be called with it at all. + if ( dir != wxLayout_Default ) + this->SetSize(-1, -1, -1, -1, wxSIZE_FORCE); + } + +#if wxUSE_TOOLTIPS + virtual void DoSetToolTipText(const wxString &tip) wxOVERRIDE + { + BaseWindowClass::DoSetToolTipText(tip); + + // Use a variable to disambiguate between SetToolTip() overloads. + void (wxWindowBase::*func)(const wxString&) = &wxWindowBase::SetToolTip; + + SetForAllParts(func, tip); + } + + virtual void DoSetToolTip(wxToolTip *tip) wxOVERRIDE + { + BaseWindowClass::DoSetToolTip(tip); + + SetForAllParts(&wxWindowBase::CopyToolTip, tip); + } +#endif // wxUSE_TOOLTIPS + +protected: + // Trivial but necessary default ctor. + wxCompositeWindowSettersOnly() + { + } + +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; + + template + void SetForAllParts(R (wxWindowBase::*func)(TArg), 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); + } + } + + wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxCompositeWindowSettersOnly, W); +}; + +// The real wxCompositeWindow itself, inheriting all the setters defined above. +template +class wxCompositeWindow : public wxCompositeWindowSettersOnly +{ +public: + virtual void SetFocus() wxOVERRIDE + { + wxSetFocusToChild(this, NULL); + } + +protected: + // Default ctor sets things up for handling children events correctly. + wxCompositeWindow() + { + this->Bind(wxEVT_CREATE, &wxCompositeWindow::OnWindowCreate, this); + } + +private: + 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(); + + // Check that it's one of our children: it could also be this window + // itself (for which we don't need to handle focus at all) or one of + // its grandchildren and we don't want to bind to those as child + // controls are supposed to be well-behaved and get their own focus + // event if any of their children get focus anyhow, so binding to them + // would only result in duplicate events. + // + // Notice that we can't use GetCompositeWindowParts() here because the + // member variables that are typically used in its implementation in + // the derived classes would typically not be initialized yet, as this + // event is generated by "m_child = new wxChildControl(this, ...)" code + // before "m_child" is assigned. + if ( child->GetParent() != this ) + return; + + child->Bind(wxEVT_SET_FOCUS, &wxCompositeWindow::OnSetFocus, this); + + child->Bind(wxEVT_KILL_FOCUS, &wxCompositeWindow::OnKillFocus, 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(); + } + + // Make all keyboard events occurring in sub-windows appear as coming + // from the main window itself. + child->Bind(wxEVT_KEY_DOWN, &wxCompositeWindow::OnKeyEvent, this); + child->Bind(wxEVT_CHAR, &wxCompositeWindow::OnKeyEvent, this); + child->Bind(wxEVT_KEY_UP, &wxCompositeWindow::OnKeyEvent, this); + } + + void OnKeyEvent(wxKeyEvent& event) + { + wxEventObjectOriginSetter setThis(event, this, this->GetId()); + + if ( !this->ProcessWindowEvent(event) ) + event.Skip(); + } + + void OnSetFocus(wxFocusEvent& event) + { + event.Skip(); + + // When a child of a composite window gains focus, the entire composite + // focus gains focus as well -- unless it had it already. + // + // We suppose that we hadn't had focus if the event doesn't carry the + // previously focused window as it normally means that it comes from + // outside of this program. + wxWindow* const oldFocus = event.GetWindow(); + if ( !oldFocus || oldFocus->GetMainWindowOfCompositeControl() != this ) + { + wxFocusEvent eventThis(wxEVT_SET_FOCUS, this->GetId()); + eventThis.SetEventObject(this); + eventThis.SetWindow(event.GetWindow()); + + this->ProcessWindowEvent(eventThis); + } + } + + 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(); + } + + wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxCompositeWindow, W); +}; + +#endif // _WX_COMPOSITEWIN_H_ diff --git a/lib/wxWidgets/include/wx/confbase.h b/lib/wxWidgets/include/wx/confbase.h new file mode 100644 index 0000000..84384b2 --- /dev/null +++ b/lib/wxWidgets/include/wx/confbase.h @@ -0,0 +1,486 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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) +// Copyright: (c) 1997 Karsten Ballueder Ballueder@usa.net +// Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#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; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +/// shall we be case sensitive in parsing variable names? +#ifndef wxCONFIG_CASE_SENSITIVE + #define wxCONFIG_CASE_SENSITIVE 0 +#endif + +/// separates group and entry names (probably shouldn't be changed) +#ifndef wxCONFIG_PATH_SEPARATOR + #define wxCONFIG_PATH_SEPARATOR wxT('/') +#endif + +/// introduces immutable entries +// (i.e. the ones which can't be changed from the local config file) +#ifndef wxCONFIG_IMMUTABLE_PREFIX + #define wxCONFIG_IMMUTABLE_PREFIX wxT('!') +#endif + +#if wxUSE_CONFIG + +/// 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)) +#ifndef wxUSE_CONFIG_NATIVE + #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( __VMS ) && \ + !(defined(__HP_aCC) && defined(__hppa)) + #define wxHAS_CONFIG_TEMPLATE_RW +#endif + +// Style flags for constructor style parameter +enum +{ + wxCONFIG_USE_LOCAL_FILE = 1, + wxCONFIG_USE_GLOBAL_FILE = 2, + wxCONFIG_USE_RELATIVE_PATH = 4, + wxCONFIG_USE_NO_ESCAPE_CHARACTERS = 8, + wxCONFIG_USE_SUBDIR = 16 +}; + +// ---------------------------------------------------------------------------- +// abstract base class wxConfigBase which defines the interface for derived +// classes +// +// 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. +// +// Keys are pairs "key_name = value" where value may be of string or integer +// (long) type (TODO doubles and other types such as wxDate coming soon). +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxConfigBase : public wxObject +{ +public: + // constants + // the type of an entry + enum EntryType + { + Type_Unknown, + Type_String, + Type_Boolean, + Type_Integer, // use Read(long *) + Type_Float // use Read(double *) + }; + + // static functions + // sets the config object, returns the previous pointer + static wxConfigBase *Set(wxConfigBase *pConfig); + // get the config object, creates it on demand unless DontCreateOnDemand + // was called + static wxConfigBase *Get(bool createOnDemand = true) + { if ( createOnDemand && (!ms_pConfig) ) Create(); return ms_pConfig; } + // create a new config object: this function will create the "best" + // implementation of wxConfig available for the current platform, see + // comments near definition wxUSE_CONFIG_NATIVE for details. It returns + // the created object and also sets it as ms_pConfig. + static wxConfigBase *Create(); + // should Get() try to create a new log object if the current one is NULL? + static void DontCreateOnDemand() { ms_bAutoCreate = false; } + + // ctor & virtual dtor + // ctor (can be used as default ctor too) + // + // Not all args will always be used by derived classes, but including + // them all in each class ensures compatibility. If appName is empty, + // uses wxApp name + wxConfigBase(const wxString& appName = wxEmptyString, + const wxString& vendorName = wxEmptyString, + const wxString& localFilename = wxEmptyString, + const wxString& globalFilename = wxEmptyString, + long style = 0); + + // empty but ensures that dtor of all derived classes is virtual + virtual ~wxConfigBase(); + + // path management + // set current path: if the first character is '/', it's the absolute path, + // otherwise it's a relative path. '..' is supported. If the strPath + // doesn't exist it is created. + virtual void SetPath(const wxString& strPath) = 0; + // retrieve the current path (always as absolute path) + virtual const wxString& GetPath() const = 0; + + // enumeration: all functions here return false when there are no more items. + // you must pass the same lIndex to GetNext and GetFirst (don't modify it) + // enumerate subgroups + virtual bool GetFirstGroup(wxString& str, long& lIndex) const = 0; + virtual bool GetNextGroup (wxString& str, long& lIndex) const = 0; + // enumerate entries + virtual bool GetFirstEntry(wxString& str, long& lIndex) const = 0; + virtual bool GetNextEntry (wxString& str, long& lIndex) const = 0; + // get number of entries/subgroups in the current group, with or without + // its subgroups + virtual size_t GetNumberOfEntries(bool bRecursive = false) const = 0; + virtual size_t GetNumberOfGroups(bool bRecursive = false) const = 0; + + // tests of existence + // returns true if the group by this name exists + virtual bool HasGroup(const wxString& strName) const = 0; + // same as above, but for an entry + virtual bool HasEntry(const wxString& strName) const = 0; + // returns true if either a group or an entry with a given name exist + bool Exists(const wxString& strName) const + { return HasGroup(strName) || HasEntry(strName); } + + // get the entry type + virtual EntryType GetEntryType(const wxString& name) const + { + // by default all entries are strings + return HasEntry(name) ? Type_String : Type_Unknown; + } + + // key access: returns true if value was really read, false if default used + // (and if the key is not found the default value is returned.) + + // read a string from the key + bool Read(const wxString& key, wxString *pStr) const; + bool Read(const wxString& key, wxString *pStr, const wxString& defVal) const; + + // read a number (long) + bool Read(const wxString& key, long *pl) const; + bool Read(const wxString& key, long *pl, long defVal) const; + + // 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; + + // read a double + 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; + + // read a 64-bit number when long is 32 bits +#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG + bool Read(const wxString& key, wxLongLong_t *pl) const; + bool Read(const wxString& key, wxLongLong_t *pl, wxLongLong_t defVal) const; +#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG + + bool Read(const wxString& key, size_t* val) const; + bool Read(const wxString& key, size_t* val, size_t defVal) const; + +#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 + bool Read(const wxString& key, T* value) const + { + wxString s; + if ( !Read(key, &s) ) + return false; + return wxFromString(s, value); + } + + template + bool Read(const wxString& key, T* value, const T& defVal) const + { + const bool found = Read(key, value); + if ( !found ) + { + if (IsRecordingDefaults()) + const_cast(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; } + + // we have to provide a separate version for C strings as otherwise the + // template Read() would be used +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString Read(const wxString& key, const char* defVal) const + { return Read(key, wxString(defVal)); } +#endif + 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; } + + wxLongLong_t ReadLongLong(const wxString& key, wxLongLong_t defVal) const + { wxLongLong_t ll; (void)Read(key, &ll, defVal); return ll; } + + 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 + 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, 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! +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + 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)); } +#endif + 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); } + +#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG + bool Write(const wxString& key, wxLongLong_t value) + { return DoWriteLongLong(key, value); } + + bool Write(const wxString& key, wxULongLong_t value) + { return DoWriteLongLong(key, value); } +#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG + + bool Write(const wxString& key, float value) + { return DoWriteDouble(key, double(value)); } + + // Causes ambiguities in under OpenVMS +#if !defined( __VMS ) + // for other types, use wxToString() + template + 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; + + // renaming, all functions return false on failure (probably because the new + // name is already taken by an existing entry) + // rename an entry + virtual bool RenameEntry(const wxString& oldName, + const wxString& newName) = 0; + // rename a group + virtual bool RenameGroup(const wxString& oldName, + const wxString& newName) = 0; + + // delete entries/groups + // deletes the specified entry and the group it belongs to if + // it was the last key in it and the second parameter is true + virtual bool DeleteEntry(const wxString& key, + bool bDeleteGroupIfEmpty = true) = 0; + // delete the group (with all subgroups) + virtual bool DeleteGroup(const wxString& key) = 0; + // delete the whole underlying object (disk file, registry key, ...) + // primarily for use by uninstallation routine. + virtual bool DeleteAll() = 0; + + // options + // we can automatically expand environment variables in the config entries + // (this option is on by default, you can turn it on/off at any time) + bool IsExpandingEnvVars() const { return m_bExpandEnvVars; } + void SetExpandEnvVars(bool bDoIt = true) { m_bExpandEnvVars = bDoIt; } + // recording of default values + void SetRecordDefaults(bool bDoIt = true) { m_bRecordDefaults = bDoIt; } + bool IsRecordingDefaults() const { return m_bRecordDefaults; } + // does expansion only if needed + wxString ExpandEnvVars(const wxString& str) const; + + // misc accessors + wxString GetAppName() const { return m_appName; } + wxString GetVendorName() const { return m_vendorName; } + + // Used wxIniConfig to set members in constructor + void SetAppName(const wxString& appName) { m_appName = appName; } + void SetVendorName(const wxString& vendorName) { m_vendorName = vendorName; } + + void SetStyle(long style) { m_style = style; } + long GetStyle() const { return m_style; } + +protected: + static bool IsImmutable(const wxString& key) + { return !key.IsEmpty() && key[0] == wxCONFIG_IMMUTABLE_PREFIX; } + + // return the path without trailing separator, if any: this should be called + // to sanitize paths referring to the group names before passing them to + // wxConfigPathChanger as "/foo/bar/" should be the same as "/foo/bar" and it + // isn't interpreted in the same way by it (and this can't be changed there + // as it's not the same for the entries names) + static wxString RemoveTrailingSeparator(const wxString& key); + + // 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; +#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG + virtual bool DoReadLongLong(const wxString& key, wxLongLong_t *pll) const; +#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG + 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; +#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG + virtual bool DoWriteLongLong(const wxString& key, wxLongLong_t value); +#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG + 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? + bool m_bExpandEnvVars; + // do we record default values? + bool m_bRecordDefaults; + + // static variables + static wxConfigBase *ms_pConfig; + static bool ms_bAutoCreate; + + // Application name and organisation name + wxString m_appName; + wxString m_vendorName; + + // Style flag + long m_style; + + wxDECLARE_ABSTRACT_CLASS(wxConfigBase); +}; + +// a handy little class which changes current path to the path of given entry +// and restores it in dtor: so if you declare a local variable of this type, +// you work in the entry directory and the path is automatically restored +// when the function returns +// Taken out of wxConfig since not all compilers can cope with nested classes. +class WXDLLIMPEXP_BASE wxConfigPathChanger +{ +public: + // ctor/dtor do path changing/restoring of the path + wxConfigPathChanger(const wxConfigBase *pContainer, const wxString& strEntry); + ~wxConfigPathChanger(); + + // get the key name + const wxString& Name() const { return m_strName; } + + // this method must be called if the original path (i.e. the current path at + // the moment of creation of this object) could have been deleted to prevent + // us from restoring the not existing (any more) path + // + // if the original path doesn't exist any more, the path will be restored to + // the deepest still existing component of the old path + void UpdateIfDeleted(); + +private: + wxConfigBase *m_pContainer; // object we live in + wxString m_strName, // name of entry (i.e. name only) + m_strOldPath; // saved path + bool m_bChanged; // was the path changed? + + wxDECLARE_NO_COPY_CLASS(wxConfigPathChanger); +}; + + +#endif // wxUSE_CONFIG + +/* + Replace environment variables ($SOMETHING) with their values. The format is + $VARNAME or ${VARNAME} where VARNAME contains alphanumeric characters and + '_' only. '$' must be escaped ('\$') in order to be taken literally. +*/ + +WXDLLIMPEXP_BASE wxString wxExpandEnvVars(const wxString &sz); + +/* + Split path into parts removing '..' in progress + */ +WXDLLIMPEXP_BASE void wxSplitPath(wxArrayString& aParts, const wxString& path); + +#endif // _WX_CONFBASE_H_ + diff --git a/lib/wxWidgets/include/wx/config.h b/lib/wxWidgets/include/wx/config.h new file mode 100644 index 0000000..2a28e07 --- /dev/null +++ b/lib/wxWidgets/include/wx/config.h @@ -0,0 +1,34 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/config.h +// Purpose: wxConfig base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CONFIG_H_BASE_ +#define _WX_CONFIG_H_BASE_ + +#include "wx/confbase.h" + +#if wxUSE_CONFIG + +// ---------------------------------------------------------------------------- +// 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 +#else // either we're under Unix or wish to always use config files + #include "wx/fileconf.h" + #define wxConfig wxFileConfig +#endif + +#endif // wxUSE_CONFIG + +#endif // _WX_CONFIG_H_BASE_ diff --git a/lib/wxWidgets/include/wx/containr.h b/lib/wxWidgets/include/wx/containr.h new file mode 100644 index 0000000..1c32c01 --- /dev/null +++ b/lib/wxWidgets/include/wx/containr.h @@ -0,0 +1,433 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/containr.h +// Purpose: wxControlContainer and wxNavigationEnabled declarations +// Author: Vadim Zeitlin +// Modified by: +// Created: 06.08.01 +// Copyright: (c) 2001, 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CONTAINR_H_ +#define _WX_CONTAINR_H_ + +#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; + +/* + 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. + */ + +// ---------------------------------------------------------------------------- +// wxControlContainerBase: common part used in both native and generic cases +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxControlContainerBase +{ +public: + // default ctor, SetContainerWindow() must be called later + wxControlContainerBase() + { + m_winParent = NULL; + + // By default, we accept focus ourselves. + m_acceptsFocusSelf = true; + + 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(); + + // returns whether we should accept focus ourselves or not + bool AcceptsFocus() const; + + // Returns whether we or one of our children accepts focus. + bool AcceptsFocusRecursively() const + { return AcceptsFocus() || 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(); + +#ifdef __WXMSW__ + // This is not strictly related to navigation, but all windows containing + // more than one children controls need to return from this method if any + // of their parents has an inheritable background, so do this automatically + // for all of them (another alternative could be to do it in wxWindow + // itself but this would be potentially more backwards incompatible and + // could conceivably break some custom windows). + bool HasTransparentBackground() const; +#endif // __WXMSW__ + +protected: + // set the focus to the child which had it the last time + 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; + + // 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(bool acceptsFocusChildren); + void UpdateParentCanFocus() + { + UpdateParentCanFocus(HasAnyFocusableChildren()); + } + + // 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; + + // a guard against infinite recursion + bool m_inSetFocus; +}; + +#ifdef wxHAS_NATIVE_TAB_TRAVERSAL + +// ---------------------------------------------------------------------------- +// 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() wxOVERRIDE; +}; + +#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 wxNavigationEnabled : public W +{ +public: + typedef W BaseWindowClass; + + wxNavigationEnabled() + { + m_container.SetContainerWindow(this); + +#ifndef wxHAS_NATIVE_TAB_TRAVERSAL + BaseWindowClass::Bind(wxEVT_NAVIGATION_KEY, + &wxNavigationEnabled::OnNavigationKey, this); + + BaseWindowClass::Bind(wxEVT_SET_FOCUS, + &wxNavigationEnabled::OnFocus, this); + BaseWindowClass::Bind(wxEVT_CHILD_FOCUS, + &wxNavigationEnabled::OnChildFocus, this); +#endif // !wxHAS_NATIVE_TAB_TRAVERSAL + } + + WXDLLIMPEXP_INLINE_CORE virtual bool AcceptsFocus() const wxOVERRIDE + { + return m_container.AcceptsFocus(); + } + + WXDLLIMPEXP_INLINE_CORE virtual bool AcceptsFocusRecursively() const wxOVERRIDE + { + return m_container.AcceptsFocusRecursively(); + } + + WXDLLIMPEXP_INLINE_CORE virtual bool AcceptsFocusFromKeyboard() const wxOVERRIDE + { + return m_container.AcceptsFocusFromKeyboard(); + } + + WXDLLIMPEXP_INLINE_CORE virtual void AddChild(wxWindowBase *child) wxOVERRIDE + { + 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) wxOVERRIDE + { +#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() wxOVERRIDE + { + if ( !m_container.DoSetFocus() ) + BaseWindowClass::SetFocus(); + } + + void SetFocusIgnoringChildren() + { + BaseWindowClass::SetFocus(); + } + +#ifdef __WXMSW__ + WXDLLIMPEXP_INLINE_CORE virtual bool HasTransparentBackground() wxOVERRIDE + { + return m_container.HasTransparentBackground(); + } + + WXDLLIMPEXP_INLINE_CORE + virtual void WXSetPendingFocus(wxWindow* win) wxOVERRIDE + { + return m_container.SetLastFocus(win); + } +#endif // __WXMSW__ + +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() \ + 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) \ + EVT_SET_FOCUS(classname::OnFocus) \ + EVT_CHILD_FOCUS(classname::OnChildFocus) \ + EVT_NAVIGATION_KEY(classname::OnNavigationKey) + +// implement the methods forwarding to the wxControlContainer +#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_ diff --git a/lib/wxWidgets/include/wx/control.h b/lib/wxWidgets/include/wx/control.h new file mode 100644 index 0000000..21dc74a --- /dev/null +++ b/lib/wxWidgets/include/wx/control.h @@ -0,0 +1,223 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/control.h +// Purpose: wxControl common interface +// Author: Vadim Zeitlin +// Modified by: +// Created: 26.07.99 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CONTROL_H_BASE_ +#define _WX_CONTROL_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_CONTROLS + +#include "wx/window.h" // base class +#include "wx/gdicmn.h" // wxEllipsize... + +extern WXDLLIMPEXP_DATA_CORE(const char) wxControlNameStr[]; + + +// ---------------------------------------------------------------------------- +// wxControl is the base class for all controls +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxControlBase : public wxWindow +{ +public: + wxControlBase() { } + + virtual ~wxControlBase(); + + // Create() function adds the validator parameter + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxControlNameStr)); + + // get the control alignment (left/right/centre, top/bottom/centre) + int GetAlignment() const { return m_windowStyle & wxALIGN_MASK; } + + // set label with mnemonics + virtual void SetLabel(const wxString& label) wxOVERRIDE + { + 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 wxOVERRIDE { 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 ('&') + 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 , and . 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 "<" 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 "&" 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 + // ShouldInheritColours() to return false + virtual bool ShouldInheritColours() const wxOVERRIDE { return true; } + + + // WARNING: this doesn't work for all controls nor all platforms! + // + // simulates the event of given type (i.e. wxButton::Command() is just as + // if the button was clicked) + virtual void Command(wxCommandEvent &event); + + virtual bool SetFont(const wxFont& font) wxOVERRIDE; + + // wxControl-specific processing after processing the update event + virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) wxOVERRIDE; + + wxSize GetSizeFromTextSize(int xlen, int ylen = -1) const + { return DoGetSizeFromTextSize(xlen, ylen); } + wxSize GetSizeFromTextSize(const wxSize& tsize) const + { return DoGetSizeFromTextSize(tsize.x, tsize.y); } + + wxSize GetSizeFromText(const wxString& text) const + { + return GetSizeFromTextSize(GetTextExtent(text).GetWidth()); + } + + + // 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 wxOVERRIDE; + + // creates the control (calls wxWindowBase::CreateBase inside) and adds it + // to the list of parents children + bool CreateControl(wxWindowBase *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + 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; + +#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); +}; + +// ---------------------------------------------------------------------------- +// include platform-dependent wxControl declarations +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/control.h" +#elif defined(__WXMSW__) + #include "wx/msw/control.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/control.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/control.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/control.h" +#elif defined(__WXMAC__) + #include "wx/osx/control.h" +#elif defined(__WXQT__) + #include "wx/qt/control.h" +#endif + +#endif // wxUSE_CONTROLS + +#endif + // _WX_CONTROL_H_BASE_ diff --git a/lib/wxWidgets/include/wx/convauto.h b/lib/wxWidgets/include/wx/convauto.h new file mode 100644 index 0000000..626da63 --- /dev/null +++ b/lib/wxWidgets/include/wx/convauto.h @@ -0,0 +1,165 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/convauto.h +// Purpose: wxConvAuto class declaration +// Author: Vadim Zeitlin +// Created: 2006-04-03 +// Copyright: (c) 2006 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CONVAUTO_H_ +#define _WX_CONVAUTO_H_ + +#include "wx/strconv.h" +#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(wxFontEncoding enc = wxFONTENCODING_DEFAULT) + { + Init(); + + m_encDefault = enc; + } + + // copy ctor doesn't initialize anything either as conversion can only be + // deduced on first use + 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); + } + + + // override the base class virtual function(s) to use our m_conv + virtual size_t ToWChar(wchar_t *dst, size_t dstLen, + const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + + virtual size_t FromWChar(char *dst, size_t dstLen, + const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + + virtual size_t GetMBNulLen() const wxOVERRIDE { return m_conv->GetMBNulLen(); } + + virtual bool IsUTF8() const wxOVERRIDE { return m_conv && m_conv->IsUTF8(); } + + virtual wxMBConv *Clone() const wxOVERRIDE { return new wxConvAuto(*this); } + + // return the BOM type of this buffer + static wxBOM DetectBOM(const char *src, size_t srcLen); + + // return the characters composing the given BOM. + static const char* GetBOMChars(wxBOM bomType, size_t* count); + + wxBOM GetBOM() const + { + return m_bomType; + } + + wxFontEncoding GetEncoding() const; + + // Return true if the fall-back encoding is used + bool IsUsingFallbackEncoding() const + { + return m_ownsConv && m_bomType == wxBOM_None; + } + +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(wxBOM bomType); + + // create the correct conversion object for the BOM present in the + // 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 + wxBOM m_bomType; + + // true if we allocated m_conv ourselves, false if we just use an existing + // global conversion + bool m_ownsConv; + + // true if we already skipped BOM when converting (and not just calculating + // the size) + bool m_consumedBOM; + + + wxDECLARE_NO_ASSIGN_CLASS(wxConvAuto); +}; + +#endif // _WX_CONVAUTO_H_ + diff --git a/lib/wxWidgets/include/wx/cpp.h b/lib/wxWidgets/include/wx/cpp.h new file mode 100644 index 0000000..2f2b277 --- /dev/null +++ b/lib/wxWidgets/include/wx/cpp.h @@ -0,0 +1,193 @@ +/* + * Name: wx/cpp.h + * Purpose: Various preprocessor helpers + * Author: Vadim Zeitlin + * Created: 2006-09-30 + * Copyright: (c) 2006 Vadim Zeitlin + * Licence: wxWindows licence + */ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#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(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 +#define wxSTRINGIZE(x) wxSTRINGIZE_HELPER(x) + +/* a Unicode-friendly version of wxSTRINGIZE_T */ +#define wxSTRINGIZE_T(x) wxAPPLY_T(wxSTRINGIZE(x)) + +/* + 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 + conflict (it may still happen if this is used in the headers, hence you + should avoid doing it or provide unique prefixes then) but we have to do it + differently for VC++ + */ +#if defined(__VISUALC__) + /* + __LINE__ handling is completely broken in VC++ when using "Edit and + Continue" (/ZI option) and results in preprocessor errors if we use it + inside the macros. Luckily VC7 has another standard macro which can be + used like this and is even better than __LINE__ because it is globally + unique. + */ +# define wxCONCAT_LINE(text) wxCONCAT(text, __COUNTER__) +#else /* normal compilers */ +# define wxCONCAT_LINE(text) wxCONCAT(text, __LINE__) +#endif + +/* Create a "unique" name with the given prefix */ +#define wxMAKE_UNIQUE_NAME(text) wxCONCAT_LINE(text) + +/* + This macro can be passed as argument to another macro when you don't have + anything to pass in fact. + */ +#define wxEMPTY_PARAMETER_VALUE /* Fake macro parameter value */ + +/* + Helpers for defining macros that expand into a single statement. + + The standard 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". + */ +#define wxSTATEMENT_MACRO_BEGIN do { +#define wxSTATEMENT_MACRO_END } while ( (void)0, 0 ) + +/* + Helper for executing the following statement conditionally without using + conditional statements. + + This strange macro is needed in the first place to avoid the problems due + to nested if/else inside macros. E.g. if some MACRO started with "if", then + + if ( cond ) + MACRO(); + else + ... + + would be broken because "..." would bind to the wrong "if" inside the macro + rather than the visible one. So we use wxDO_IF() inside the macro instead + to avoid this problem. + */ +#define wxDO_IF_HELPER(loopvar, condition) \ + for ( bool loopvar = false; !loopvar && condition; loopvar = true ) + +#define wxDO_IF(condition) wxDO_IF_HELPER(wxMAKE_UNIQUE_NAME(wxdoif), condition) + +/* + Define __WXFUNCTION__ which is like standard __FUNCTION__ but defined as + NULL for the compilers which don't support the latter. + */ +#ifndef __WXFUNCTION__ + #if defined(__GNUC__) || \ + defined(__VISUALC__) || \ + 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 1 + #elif defined(__GNUC__) + #define HAVE_VARIADIC_MACROS 1 + #elif wxCHECK_VISUALC_VERSION(8) + #define HAVE_VARIADIC_MACROS 1 + #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 https://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_(args) wxCALL_FOR_EACH_1 args +#define wxCALL_FOR_EACH_2_(args) wxCALL_FOR_EACH_2 args +#define wxCALL_FOR_EACH_3_(args) wxCALL_FOR_EACH_3 args +#define wxCALL_FOR_EACH_4_(args) wxCALL_FOR_EACH_4 args +#define wxCALL_FOR_EACH_5_(args) wxCALL_FOR_EACH_5 args +#define wxCALL_FOR_EACH_6_(args) wxCALL_FOR_EACH_6 args +#define wxCALL_FOR_EACH_7_(args) wxCALL_FOR_EACH_7 args +#define wxCALL_FOR_EACH_8_(args) wxCALL_FOR_EACH_8 args + +#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_ */ + diff --git a/lib/wxWidgets/include/wx/creddlg.h b/lib/wxWidgets/include/wx/creddlg.h new file mode 100644 index 0000000..13c8c72 --- /dev/null +++ b/lib/wxWidgets/include/wx/creddlg.h @@ -0,0 +1,15 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/creddlg.h +// Purpose: wxCredentialEntryDialog interface +// Author: Tobias Taschner +// Created: 2018-10-23 +// Copyright: (c) 2018 wxWidgets development team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CREDDLG_H_BASE +#define _WX_CREDDLG_H_BASE + +#include "wx/generic/creddlgg.h" + +#endif // _WX_CREDDLG_H_BASE diff --git a/lib/wxWidgets/include/wx/crt.h b/lib/wxWidgets/include/wx/crt.h new file mode 100644 index 0000000..9b939fd --- /dev/null +++ b/lib/wxWidgets/include/wx/crt.h @@ -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_ diff --git a/lib/wxWidgets/include/wx/cshelp.h b/lib/wxWidgets/include/wx/cshelp.h new file mode 100644 index 0000000..a1b0e53 --- /dev/null +++ b/lib/wxWidgets/include/wx/cshelp.h @@ -0,0 +1,256 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/cshelp.h +// Purpose: Context-sensitive help support classes +// Author: Julian Smart, Vadim Zeitlin +// Modified by: +// Created: 08/09/2000 +// Copyright: (c) 2000 Julian Smart, Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CSHELP_H_ +#define _WX_CSHELP_H_ + +#include "wx/defs.h" + +#if wxUSE_HELP + +#include "wx/help.h" + +#include "wx/hashmap.h" +#if wxUSE_BMPBUTTON +#include "wx/bmpbuttn.h" +#endif + +#include "wx/event.h" + +// ---------------------------------------------------------------------------- +// classes used to implement context help UI +// ---------------------------------------------------------------------------- + +/* + * wxContextHelp + * Invokes context-sensitive help. When the user + * clicks on a window, a wxEVT_HELP event will be sent to that + * window for the application to display help for. + */ + +class WXDLLIMPEXP_CORE wxContextHelp : public wxObject +{ +public: + wxContextHelp(wxWindow* win = NULL, bool beginHelp = true); + virtual ~wxContextHelp(); + + bool BeginContextHelp(wxWindow* win); + bool EndContextHelp(); + + bool EventLoop(); + bool DispatchEvent(wxWindow* win, const wxPoint& pt); + + void SetStatus(bool status) { m_status = status; } + +protected: + bool m_inHelp; + bool m_status; // true if the user left-clicked + +private: + wxDECLARE_DYNAMIC_CLASS(wxContextHelp); +}; + +#if wxUSE_BMPBUTTON +/* + * wxContextHelpButton + * You can add this to your dialogs (especially on non-Windows platforms) + * to put the application into context help mode. + */ + +class WXDLLIMPEXP_CORE wxContextHelpButton : public wxBitmapButton +{ +public: + wxContextHelpButton() {} + + wxContextHelpButton(wxWindow* parent, + wxWindowID id = wxID_CONTEXT_HELP, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0) + { + Create(parent, id, pos, size, style); + } + + + bool Create(wxWindow* parent, + wxWindowID id = wxID_CONTEXT_HELP, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0); + + + void OnContextHelp(wxCommandEvent& event); + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxContextHelpButton); + wxDECLARE_EVENT_TABLE(); +}; + +#endif + +// ---------------------------------------------------------------------------- +// classes used to implement context help support +// ---------------------------------------------------------------------------- + +// wxHelpProvider is an abstract class used by the program implementing context help to +// show the help text (or whatever: it may be HTML page or anything else) for +// the given window. +// +// The current help provider must be explicitly set by the application using +// wxHelpProvider::Set(). +// +// Special note about ShowHelpAtPoint() and ShowHelp(): we want to be able to +// override ShowHelpAtPoint() when we need to use different help messages for +// different parts of the window, but it should also be possible to override +// just ShowHelp() both for backwards compatibility and just because most +// often the help does not, in fact, depend on the position and so +// implementing just ShowHelp() is simpler and more natural, so by default +// ShowHelpAtPoint() forwards to ShowHelp(). But this means that +// wxSimpleHelpProvider has to override ShowHelp() and not ShowHelpAtPoint() +// for backwards compatibility as otherwise the existing code deriving from it +// 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 WXDLLIMPEXP_CORE wxHelpProvider +{ +public: + // get/set the current (application-global) help provider (Set() returns + // the previous one) + static wxHelpProvider *Set(wxHelpProvider *helpProvider) + { + wxHelpProvider *helpProviderOld = ms_helpProvider; + ms_helpProvider = helpProvider; + return helpProviderOld; + } + + // unlike some other class, the help provider is not created on demand, + // this must be explicitly done by the application + static wxHelpProvider *Get() { return ms_helpProvider; } + + // get the help string (whose interpretation is help provider dependent + // except that empty string always means that no help is associated with + // the window) for this window + virtual wxString GetHelp(const wxWindowBase *window) = 0; + + // do show help for the given window (uses window->GetHelpAtPoint() + // internally if applicable), return true if it was done or false + // if no help available for this window + virtual bool ShowHelpAtPoint(wxWindowBase *window, + const wxPoint& pt, + wxHelpEvent::Origin origin) + { + wxCHECK_MSG( window, false, wxT("window must not be NULL") ); + + m_helptextAtPoint = pt; + m_helptextOrigin = origin; + + return ShowHelp(window); + } + + // show help for the given window, see ShowHelpAtPoint() above + virtual bool ShowHelp(wxWindowBase * WXUNUSED(window)) { return false; } + + // associate the text with the given window or id: although all help + // providers have these functions to allow making wxWindow::SetHelpText() + // work, not all of them implement them + virtual void AddHelp(wxWindowBase *window, const wxString& text); + + // this version associates the given text with all window with this id + // (may be used to set the same help string for all [Cancel] buttons in + // the application, for example) + virtual void AddHelp(wxWindowID id, const wxString& text); + + // removes the association + virtual void RemoveHelp(wxWindowBase* window); + + // virtual dtor for any base class + virtual ~wxHelpProvider(); + +protected: + wxHelpProvider() + : m_helptextAtPoint(wxDefaultPosition), + m_helptextOrigin(wxHelpEvent::Origin_Unknown) + { + } + + // helper method used by ShowHelp(): returns the help string to use by + // using m_helptextAtPoint/m_helptextOrigin if they're set or just GetHelp + // otherwise + wxString GetHelpTextMaybeAtPoint(wxWindowBase *window); + + + // parameters of the last ShowHelpAtPoint() call, used by ShowHelp() + wxPoint m_helptextAtPoint; + wxHelpEvent::Origin m_helptextOrigin; + +private: + static wxHelpProvider *ms_helpProvider; +}; + +WX_DECLARE_EXPORTED_HASH_MAP( wxUIntPtr, wxString, wxIntegerHash, + wxIntegerEqual, wxSimpleHelpProviderHashMap ); + +// 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 WXDLLIMPEXP_CORE wxSimpleHelpProvider : public wxHelpProvider +{ +public: + // implement wxHelpProvider methods + virtual wxString GetHelp(const wxWindowBase *window) wxOVERRIDE; + + // override ShowHelp() and not ShowHelpAtPoint() as explained above + virtual bool ShowHelp(wxWindowBase *window) wxOVERRIDE; + + virtual void AddHelp(wxWindowBase *window, const wxString& text) wxOVERRIDE; + virtual void AddHelp(wxWindowID id, const wxString& text) wxOVERRIDE; + virtual void RemoveHelp(wxWindowBase* window) wxOVERRIDE; + +protected: + // we use 2 hashes for storing the help strings associated with windows + // and the ids + wxSimpleHelpProviderHashMap m_hashWindows, + m_hashIds; +}; + +// wxHelpControllerHelpProvider is an implementation of wxHelpProvider which supports +// 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 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 = NULL); + + // implement wxHelpProvider methods + + // again (see above): this should be ShowHelpAtPoint() but we need to + // override ShowHelp() to avoid breaking existing code + virtual bool ShowHelp(wxWindowBase *window) wxOVERRIDE; + + // Other accessors + void SetHelpController(wxHelpControllerBase* hc) { m_helpController = hc; } + wxHelpControllerBase* GetHelpController() const { return m_helpController; } + +protected: + wxHelpControllerBase* m_helpController; + + wxDECLARE_NO_COPY_CLASS(wxHelpControllerHelpProvider); +}; + +// Convenience function for turning context id into wxString +WXDLLIMPEXP_CORE wxString wxContextId(int id); + +#endif // wxUSE_HELP + +#endif // _WX_CSHELP_H_ + diff --git a/lib/wxWidgets/include/wx/ctrlsub.h b/lib/wxWidgets/include/wx/ctrlsub.h new file mode 100644 index 0000000..7897268 --- /dev/null +++ b/lib/wxWidgets/include/wx/ctrlsub.h @@ -0,0 +1,499 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/ctrlsub.h (read: "wxConTRoL with SUBitems") +// Purpose: wxControlWithItems interface +// Author: Vadim Zeitlin +// Modified by: +// Created: 22.10.99 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CTRLSUB_H_BASE_ +#define _WX_CTRLSUB_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_CONTROLS + +#include "wx/arrstr.h" +#include "wx/control.h" // base class + +#if wxUSE_STD_CONTAINERS_COMPATIBLY +#include +#endif // wxUSE_STD_CONTAINERS_COMPATIBLY + +// ---------------------------------------------------------------------------- +// wxItemContainer defines an interface which is implemented by all controls +// which have string subitems each of which may be selected. +// +// It is decomposed in wxItemContainerImmutable which omits all methods +// adding/removing items and is used by wxRadioBox and wxItemContainer itself. +// +// Examples: wxListBox, wxCheckListBox, wxChoice and wxComboBox (which +// implements an extended interface deriving from this one) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxItemContainerImmutable +{ +public: + wxItemContainerImmutable() { } + virtual ~wxItemContainerImmutable(); + + // accessing strings + // ----------------- + + virtual unsigned int GetCount() const = 0; + bool IsEmpty() const { return GetCount() == 0; } + + virtual wxString GetString(unsigned int n) const = 0; + wxArrayString GetStrings() const; + virtual void SetString(unsigned int n, const wxString& s) = 0; + + // finding string natively is either case sensitive or insensitive + // but never both so fall back to this base version for not + // supported search type + virtual int FindString(const wxString& s, bool bCase = false) const + { + unsigned int count = GetCount(); + + for ( unsigned int i = 0; i < count ; ++i ) + { + if (GetString(i).IsSameAs( s , bCase )) + return (int)i; + } + + return wxNOT_FOUND; + } + + + // selection + // --------- + + virtual void SetSelection(int n) = 0; + virtual int GetSelection() const = 0; + + // set selection to the specified string, return false if not found + bool SetStringSelection(const wxString& s); + + // return the selected string or empty string if none + virtual wxString GetStringSelection() const; + + // this is the same as SetSelection( for single-selection controls but + // reads better for multi-selection ones + void Select(int n) { SetSelection(n); } + + +protected: + // check that the index is valid + bool IsValid(unsigned int n) const { return n < GetCount(); } + bool IsValidInsert(unsigned int n) const { return n <= GetCount(); } +}; + +// ---------------------------------------------------------------------------- +// 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(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(clientData), + wxClientData_Object); + } + +public: + wxItemContainer() { m_clientDataItemsType = wxClientData_None; } + virtual ~wxItemContainer(); + + // 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 AppendItems(item); } + int Append(const wxString& item, void *clientData) + { return AppendItems(item, &clientData); } + int Append(const wxString& item, wxClientData *clientData) + { return AppendItems(item, &clientData); } + + // 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); } + +#if wxUSE_STD_CONTAINERS_COMPATIBLY + int Append(const std::vector& items) + { return AppendItems(items); } +#endif // wxUSE_STD_CONTAINERS_COMPATIBLY + + // 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 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); } + +#if wxUSE_STD_CONTAINERS_COMPATIBLY + int Insert(const std::vector& items, unsigned int pos) + { return InsertItems(items, pos); } +#endif // wxUSE_STD_CONTAINERS_COMPATIBLY + + // 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); } + +#if wxUSE_STD_CONTAINERS_COMPATIBLY + void Set(const std::vector& items) + { Clear(); Append(items); } +#endif // wxUSE_STD_CONTAINERS_COMPATIBLY + + // deleting items + // -------------- + + virtual 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; } + + + // 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 GetClientDataType() == wxClientData_Object; } + bool HasClientUntypedData() const + { return GetClientDataType() == wxClientData_Void; } + +protected: + // 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); + } + + // 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; +}; + +// 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 instead of Window and Container interface directly. +template +class wxWindowWithItems : public W, public C +{ +public: + typedef W BaseWindowClass; + typedef C BaseContainerInterface; + + 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 +{ +public: + wxControlWithItemsBase() { } + + // usually the controls like list/combo boxes have their own background + // colour + virtual bool ShouldInheritColours() const wxOVERRIDE { 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 + // + // calls InitCommandEvent() and, if n != wxNOT_FOUND, also sets the per + // item client data + void InitCommandEventWithItems(wxCommandEvent& event, int n); + +private: + 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" +#elif defined(__WXQT__) + #include "wx/qt/ctrlsub.h" +#else + class WXDLLIMPEXP_CORE wxControlWithItems : public wxControlWithItemsBase + { + public: + wxControlWithItems() { } + + private: + wxDECLARE_ABSTRACT_CLASS(wxControlWithItems); + wxDECLARE_NO_COPY_CLASS(wxControlWithItems); + }; +#endif + +#endif // wxUSE_CONTROLS + +#endif // _WX_CTRLSUB_H_BASE_ diff --git a/lib/wxWidgets/include/wx/cursor.h b/lib/wxWidgets/include/wx/cursor.h new file mode 100644 index 0000000..df0c574 --- /dev/null +++ b/lib/wxWidgets/include/wx/cursor.h @@ -0,0 +1,113 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/cursor.h +// Purpose: wxCursor base header +// Author: Julian Smart, Vadim Zeitlin +// Created: +// Copyright: (c) Julian Smart +// (c) 2014 Vadim Zeitlin (wxCursorBase) +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CURSOR_H_BASE_ +#define _WX_CURSOR_H_BASE_ + +#include "wx/gdiobj.h" +#include "wx/gdicmn.h" + +// Under most ports, wxCursor derives directly from wxGDIObject, but in wxMSW +// there is an intermediate wxGDIImage class. +#ifdef __WXMSW__ + #include "wx/msw/gdiimage.h" +#else + typedef wxGDIObject wxGDIImage; +#endif + +class WXDLLIMPEXP_CORE wxCursorBase : public wxGDIImage +{ +public: +/* + wxCursor classes should provide the following ctors: + + 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 wxPoint GetHotSpot() const { return wxDefaultPosition; } +}; + +#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(__WXDFB__) + #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE + #include "wx/dfb/cursor.h" +#elif defined(__WXMAC__) + #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_MACCURSOR_RESOURCE + #include "wx/osx/cursor.h" +#elif defined(__WXQT__) + #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR + #include "wx/qt/cursor.h" +#endif + +#include "wx/utils.h" + +/* This is a small class which can be used by all ports + to temporarily suspend the busy cursor. Useful in modal + dialogs. + + Actually that is not (any longer) quite true.. currently it is + only used in wxGTK Dialog::ShowModal() and now uses static + wxBusyCursor methods that are only implemented for wxGTK so far. + The BusyCursor handling code should probably be implemented in + common code somewhere instead of the separate implementations we + currently have. Also the name BusyCursorSuspender is a little + misleading since it doesn't actually suspend the BusyCursor, just + masks one that is already showing. + If another call to wxBeginBusyCursor is made while this is active + the Busy Cursor will again be shown. But at least now it doesn't + interfere with the state of wxIsBusy() -- RL + +*/ +class wxBusyCursorSuspender +{ +public: + wxBusyCursorSuspender() + { + if( wxIsBusy() ) + { + wxSetCursor( wxBusyCursor::GetStoredCursor() ); + } + } + ~wxBusyCursorSuspender() + { + if( wxIsBusy() ) + { + wxSetCursor( wxBusyCursor::GetBusyCursor() ); + } + } +}; +#endif + // _WX_CURSOR_H_BASE_ diff --git a/lib/wxWidgets/include/wx/custombgwin.h b/lib/wxWidgets/include/wx/custombgwin.h new file mode 100644 index 0000000..329589c --- /dev/null +++ b/lib/wxWidgets/include/wx/custombgwin.h @@ -0,0 +1,56 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/custombgwin.h +// Purpose: Class adding support for custom window backgrounds. +// Author: Vadim Zeitlin +// Created: 2011-10-10 +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CUSTOMBGWIN_H_ +#define _WX_CUSTOMBGWIN_H_ + +#include "wx/defs.h" + +class WXDLLIMPEXP_FWD_CORE wxBitmap; + +// ---------------------------------------------------------------------------- +// 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_ diff --git a/lib/wxWidgets/include/wx/dataobj.h b/lib/wxWidgets/include/wx/dataobj.h new file mode 100644 index 0000000..ef0c385 --- /dev/null +++ b/lib/wxWidgets/include/wx/dataobj.h @@ -0,0 +1,606 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/dataobj.h +// Purpose: common data object classes +// Author: Vadim Zeitlin, Robert Roebling +// Modified by: +// Created: 26.05.99 +// Copyright: (c) wxWidgets Team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DATAOBJ_H_BASE_ +#define _WX_DATAOBJ_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- +#include "wx/defs.h" + +#if wxUSE_DATAOBJ + +#include "wx/string.h" +#include "wx/bitmap.h" +#include "wx/list.h" +#include "wx/arrstr.h" + +// ============================================================================ +/* + Generic data transfer related classes. The class hierarchy is as follows: + + - wxDataObject- + / \ + / \ + wxDataObjectSimple wxDataObjectComposite + / | \ + / | \ + wxTextDataObject | wxBitmapDataObject + | + wxCustomDataObject + | + | + wxImageDataObject +*/ +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxDataFormat class is declared in platform-specific headers: it represents +// a format for data which may be either one of the standard ones (text, +// bitmap, ...) or a custom one which is then identified by a unique string. +// ---------------------------------------------------------------------------- + +/* the class interface looks like this (pseudo code): + +class wxDataFormat +{ +public: + typedef NativeFormat; + + wxDataFormat(NativeFormat format = wxDF_INVALID); + wxDataFormat(const wxString& format); + + wxDataFormat& operator=(NativeFormat format); + wxDataFormat& operator=(const wxDataFormat& format); + + bool operator==(NativeFormat format) const; + bool operator!=(NativeFormat format) const; + + void SetType(NativeFormat format); + NativeFormat GetType() const; + + wxString GetId() const; + void SetId(const wxString& format); +}; + +*/ + +#if defined(__WXMSW__) + #include "wx/msw/ole/dataform.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/dataform.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/dataform.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/dataform.h" +#elif defined(__WXX11__) + #include "wx/x11/dataform.h" +#elif defined(__WXMAC__) + #include "wx/osx/dataform.h" +#elif defined(__WXQT__) + #include "wx/qt/dataform.h" +#endif + +// the value for default argument to some functions (corresponds to +// wxDF_INVALID) +extern WXDLLIMPEXP_CORE const wxDataFormat& wxFormatInvalid; + +// ---------------------------------------------------------------------------- +// wxDataObject represents a piece of data which knows which formats it +// supports and knows how to render itself in each of them - GetDataHere(), +// and how to restore data from the buffer (SetData()). +// +// Although this class may be used directly (i.e. custom classes may be +// derived from it), in many cases it might be simpler to use either +// wxDataObjectSimple or wxDataObjectComposite classes. +// +// A data object may be "read only", i.e. support only GetData() functions or +// "read-write", i.e. support both GetData() and SetData() (in principle, it +// might be "write only" too, but this is rare). Moreover, it doesn't have to +// support the same formats in Get() and Set() directions: for example, a data +// object containing JPEG image might accept BMPs in GetData() because JPEG +// image may be easily transformed into BMP but not in SetData(). Accordingly, +// all methods dealing with formats take an additional "direction" argument +// which is either SET or GET and which tells the function if the format needs +// to be supported by SetData() or GetDataHere(). +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataObjectBase +{ +public: + enum Direction + { + Get = 0x01, // format is supported by GetDataHere() + Set = 0x02, // format is supported by SetData() + Both = 0x03 // format is supported by both (unused currently) + }; + + // this class is polymorphic, hence it needs a virtual dtor + virtual ~wxDataObjectBase(); + + // get the best suited format for rendering our data + virtual wxDataFormat GetPreferredFormat(Direction dir = Get) const = 0; + + // get the number of formats we support + virtual size_t GetFormatCount(Direction dir = Get) const = 0; + + // return all formats in the provided array (of size GetFormatCount()) + virtual void GetAllFormats(wxDataFormat *formats, + Direction dir = Get) const = 0; + + // get the (total) size of data for the given format + virtual size_t GetDataSize(const wxDataFormat& format) const = 0; + + // copy raw data (in the specified format) to the provided buffer, return + // true if data copied successfully, false otherwise + virtual bool GetDataHere(const wxDataFormat& format, void *buf) const = 0; + + // get data from the buffer of specified length (in the given format), + // return true if the data was read successfully, false otherwise + virtual bool SetData(const wxDataFormat& WXUNUSED(format), + size_t WXUNUSED(len), const void * WXUNUSED(buf)) + { + return false; + } + + // returns true if this format is supported + bool IsSupported(const wxDataFormat& format, Direction dir = Get) const; +}; + +// ---------------------------------------------------------------------------- +// include the platform-specific declarations of wxDataObject +// ---------------------------------------------------------------------------- + +#if defined(__WXMSW__) + #include "wx/msw/ole/dataobj.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/dataobj.h" +#elif defined(__WXX11__) + #include "wx/x11/dataobj.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/dataobj.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/dataobj.h" +#elif defined(__WXMAC__) + #include "wx/osx/dataobj.h" +#elif defined(__WXQT__) + #include "wx/qt/dataobj.h" +#endif + +// ---------------------------------------------------------------------------- +// wxDataObjectSimple is a wxDataObject which only supports one format (in +// both Get and Set directions, but you may return false from GetDataHere() or +// SetData() if one of them is not supported). This is the simplest possible +// wxDataObject implementation. +// +// This is still an "abstract base class" (although it doesn't have any pure +// virtual functions), to use it you should derive from it and implement +// GetDataSize(), GetDataHere() and SetData() functions because the base class +// versions don't do anything - they just return "not implemented". +// +// This class should be used when you provide data in only one format (no +// conversion to/from other formats), either a standard or a custom one. +// Otherwise, you should use wxDataObjectComposite or wxDataObject directly. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataObjectSimple : public wxDataObject +{ +public: + // ctor takes the format we support, but it can also be set later with + // SetFormat() + wxDataObjectSimple(const wxDataFormat& format = wxFormatInvalid) + : m_format(format) + { + } + + // get/set the format we support + const wxDataFormat& GetFormat() const { return m_format; } + void SetFormat(const wxDataFormat& format) { m_format = format; } + + // virtual functions to override in derived class (the base class versions + // just return "not implemented") + // ----------------------------------------------------------------------- + + // get the size of our data + virtual size_t GetDataSize() const + { return 0; } + + // copy our data to the buffer + virtual bool GetDataHere(void *WXUNUSED(buf)) const + { return false; } + + // copy data from buffer to our data + virtual bool SetData(size_t WXUNUSED(len), const void *WXUNUSED(buf)) + { return false; } + + // implement base class pure virtuals + // ---------------------------------- + virtual wxDataFormat GetPreferredFormat(wxDataObjectBase::Direction WXUNUSED(dir) = Get) const wxOVERRIDE + { return m_format; } + virtual size_t GetFormatCount(wxDataObjectBase::Direction WXUNUSED(dir) = Get) const wxOVERRIDE + { return 1; } + virtual void GetAllFormats(wxDataFormat *formats, + wxDataObjectBase::Direction WXUNUSED(dir) = Get) const wxOVERRIDE + { *formats = m_format; } + virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const wxOVERRIDE + { return GetDataSize(); } + virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), + void *buf) const wxOVERRIDE + { return GetDataHere(buf); } + virtual bool SetData(const wxDataFormat& WXUNUSED(format), + size_t len, const void *buf) wxOVERRIDE + { return SetData(len, buf); } + +private: + // the one and only format we support + wxDataFormat m_format; + + wxDECLARE_NO_COPY_CLASS(wxDataObjectSimple); +}; + +// ---------------------------------------------------------------------------- +// wxDataObjectComposite is the simplest way to implement wxDataObject +// supporting multiple formats. It contains several wxDataObjectSimple and +// supports all formats supported by any of them. +// +// This class shouldn't be (normally) derived from, but may be used directly. +// If you need more flexibility than what it provides, you should probably use +// wxDataObject directly. +// ---------------------------------------------------------------------------- + +WX_DECLARE_EXPORTED_LIST(wxDataObjectSimple, wxSimpleDataObjectList); + +class WXDLLIMPEXP_CORE wxDataObjectComposite : public wxDataObject +{ +public: + // ctor + wxDataObjectComposite(); + virtual ~wxDataObjectComposite(); + + // add data object (it will be deleted by wxDataObjectComposite, hence it + // must be allocated on the heap) whose format will become the preferred + // one if preferred == true + 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 received data from + // the clipboard or the DnD operation. You can use this method to find + // 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 wxOVERRIDE; + virtual size_t GetFormatCount(wxDataObjectBase::Direction dir = Get) const wxOVERRIDE; + virtual void GetAllFormats(wxDataFormat *formats, wxDataObjectBase::Direction dir = Get) const wxOVERRIDE; + virtual size_t GetDataSize(const wxDataFormat& format) const wxOVERRIDE; + virtual bool GetDataHere(const wxDataFormat& format, void *buf) const wxOVERRIDE; + virtual bool SetData(const wxDataFormat& format, size_t len, const void *buf) wxOVERRIDE; +#if defined(__WXMSW__) + virtual const void* GetSizeFromBuffer( const void* buffer, size_t* size, + const wxDataFormat& format ) wxOVERRIDE; + virtual void* SetSizeInBuffer( void* buffer, size_t size, + const wxDataFormat& format ) wxOVERRIDE; + virtual size_t GetBufferOffset( const wxDataFormat& format ) wxOVERRIDE; +#endif + +private: + // the list of all (simple) data objects whose formats we support + wxSimpleDataObjectList m_dataObjects; + + // the index of the preferred one (0 initially, so by default the first + // one is the preferred) + size_t m_preferred; + + wxDataFormat m_receivedFormat; + + wxDECLARE_NO_COPY_CLASS(wxDataObjectComposite); +}; + +// ============================================================================ +// Standard implementations of wxDataObjectSimple which can be used directly +// (i.e. without having to derive from them) for standard data type transfers. +// +// Note that although all of them can work with provided data, you can also +// override their virtual GetXXX() functions to only provide data on demand. +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxTextDataObject contains text data +// ---------------------------------------------------------------------------- + +#if wxUSE_UNICODE + #if defined(__WXGTK20__) || defined(__WXX11__) || defined(__WXQT__) + #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 wxOVERRIDE; + virtual bool GetDataHere(void *buf) const wxOVERRIDE; + virtual bool SetData(size_t len, const void *buf) wxOVERRIDE; + + // Must provide overloads to avoid hiding them (and warnings about it) + virtual size_t GetDataSize(const wxDataFormat&) const wxOVERRIDE + { + return GetDataSize(); + } + virtual bool GetDataHere(const wxDataFormat&, void *buf) const wxOVERRIDE + { + return GetDataHere(buf); + } + virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) wxOVERRIDE + { + 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 + // GetText() + wxTextDataObject(const wxString& text = wxEmptyString) + : wxDataObjectSimple( +#if wxUSE_UNICODE + wxDF_UNICODETEXT +#else + wxDF_TEXT +#endif + ), + m_text(text) + { + } + + // 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 GetTextLength() const { return m_text.Len() + 1; } + virtual wxString GetText() const { return m_text; } + virtual void SetText(const wxString& text) { m_text = text; } + + // implement base class pure virtuals + // ---------------------------------- + + // some platforms have 2 and not 1 format for text data +#if defined(wxNEEDS_UTF8_FOR_TEXT_DATAOBJ) || defined(wxNEEDS_UTF16_FOR_TEXT_DATAOBJ) + virtual size_t GetFormatCount(Direction WXUNUSED(dir) = Get) const wxOVERRIDE { return 2; } + virtual void GetAllFormats(wxDataFormat *formats, + wxDataObjectBase::Direction WXUNUSED(dir) = Get) const wxOVERRIDE; + + virtual size_t GetDataSize() const wxOVERRIDE { return GetDataSize(GetPreferredFormat()); } + virtual bool GetDataHere(void *buf) const wxOVERRIDE { return GetDataHere(GetPreferredFormat(), buf); } + virtual bool SetData(size_t len, const void *buf) wxOVERRIDE { return SetData(GetPreferredFormat(), len, buf); } + + size_t GetDataSize(const wxDataFormat& format) const wxOVERRIDE; + bool GetDataHere(const wxDataFormat& format, void *pBuf) const wxOVERRIDE; + bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf) wxOVERRIDE; +#else // !wxNEEDS_UTF{8,16}_FOR_TEXT_DATAOBJ + virtual size_t GetDataSize() const wxOVERRIDE; + virtual bool GetDataHere(void *buf) const wxOVERRIDE; + virtual bool SetData(size_t len, const void *buf) wxOVERRIDE; + // Must provide overloads to avoid hiding them (and warnings about it) + virtual size_t GetDataSize(const wxDataFormat&) const wxOVERRIDE + { + return GetDataSize(); + } + virtual bool GetDataHere(const wxDataFormat&, void *buf) const wxOVERRIDE + { + return GetDataHere(buf); + } + virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) wxOVERRIDE + { + return SetData(len, buf); + } +#endif // different wxTextDataObject implementations + +private: +#if defined(__WXQT__) + // Overridden to set text directly instead of extracting byte array + void QtSetDataSingleFormat(const class QMimeData &mimeData, const wxDataFormat &format) wxOVERRIDE; +#endif + + wxString m_text; + + wxDECLARE_NO_COPY_CLASS(wxTextDataObject); +}; + +// ---------------------------------------------------------------------------- +// wxBitmapDataObject contains a bitmap +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBitmapDataObjectBase : public wxDataObjectSimple +{ +public: + // ctor: you can specify the bitmap here or in SetBitmap(), or override + // GetBitmap() + wxBitmapDataObjectBase(const wxBitmap& bitmap = wxNullBitmap) + : wxDataObjectSimple(wxDF_BITMAP), m_bitmap(bitmap) + { + } + + // virtual functions which you may override if you want to provide data on + // demand only - otherwise, the trivial default versions will be used + virtual wxBitmap GetBitmap() const { return m_bitmap; } + virtual void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; } + +protected: + wxBitmap m_bitmap; + + wxDECLARE_NO_COPY_CLASS(wxBitmapDataObjectBase); +}; + +// ---------------------------------------------------------------------------- +// wxFileDataObject contains a list of filenames +// +// NB: notice that this is a "write only" object, it can only be filled with +// data from drag and drop operation. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFileDataObjectBase : public wxDataObjectSimple +{ +public: + // ctor: use AddFile() later to fill the array + wxFileDataObjectBase() : wxDataObjectSimple(wxDF_FILENAME) { } + + // get a reference to our array + const wxArrayString& GetFilenames() const { return m_filenames; } + +protected: + wxArrayString m_filenames; + + wxDECLARE_NO_COPY_CLASS(wxFileDataObjectBase); +}; + +// ---------------------------------------------------------------------------- +// wxCustomDataObject contains arbitrary untyped user data. +// +// It is understood that this data can be copied bitwise. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxCustomDataObject : public wxDataObjectSimple +{ +public: + // if you don't specify the format in the ctor, you can still use + // SetFormat() later + wxCustomDataObject(const wxDataFormat& format = wxFormatInvalid); + + // the dtor calls Free() + virtual ~wxCustomDataObject(); + + // you can call SetData() to set m_data: it will make a copy of the data + // you pass - or you can use TakeData() which won't copy anything, but + // will take ownership of data (i.e. will call Free() on it later) + void TakeData(size_t size, void *data); + + // this function is called to allocate "size" bytes of memory from + // SetData(). The default version uses operator new[]. + virtual void *Alloc(size_t size); + + // this function is called when the data is freed, you may override it to + // anything you want (or may be nothing at all). The default version calls + // operator delete[] on m_data + virtual void Free(); + + // get data: you may override these functions if you wish to provide data + // only when it's requested + virtual size_t GetSize() const { return m_size; } + virtual void *GetData() const { return m_data; } + + // implement base class pure virtuals + // ---------------------------------- + virtual size_t GetDataSize() const wxOVERRIDE; + virtual bool GetDataHere(void *buf) const wxOVERRIDE; + virtual bool SetData(size_t size, const void *buf) wxOVERRIDE; + // Must provide overloads to avoid hiding them (and warnings about it) + virtual size_t GetDataSize(const wxDataFormat&) const wxOVERRIDE + { + return GetDataSize(); + } + virtual bool GetDataHere(const wxDataFormat&, void *buf) const wxOVERRIDE + { + return GetDataHere(buf); + } + virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) wxOVERRIDE + { + return SetData(len, buf); + } + +private: + size_t m_size; + void *m_data; + + wxDECLARE_NO_COPY_CLASS(wxCustomDataObject); +}; + +// ---------------------------------------------------------------------------- +// wxImageDataObject - data object for wxImage +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxImageDataObject : public wxCustomDataObject +{ +public: + explicit wxImageDataObject(const wxImage& image = wxNullImage); + + void SetImage(const wxImage& image); + wxImage GetImage() const; + +private: + wxDECLARE_NO_COPY_CLASS(wxImageDataObject); +}; + +// ---------------------------------------------------------------------------- +// include platform-specific declarations of wxXXXBase classes +// ---------------------------------------------------------------------------- + +#if defined(__WXMSW__) + #include "wx/msw/ole/dataobj2.h" + // wxURLDataObject defined in msw/ole/dataobj2.h +#elif defined(__WXGTK20__) + #include "wx/gtk/dataobj2.h" + // wxURLDataObject defined in gtk/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/osx/dataobj2.h" + #elif defined(__WXQT__) + #include "wx/qt/dataobj2.h" + #endif + + // wxURLDataObject is simply wxTextDataObject with a different name + class WXDLLIMPEXP_CORE wxURLDataObject : public wxTextDataObject + { + public: + wxURLDataObject(const wxString& url = wxEmptyString) + : wxTextDataObject(url) + { + } + + wxString GetURL() const { return GetText(); } + void SetURL(const wxString& url) { SetText(url); } + }; +#endif + +#endif // wxUSE_DATAOBJ + +#endif // _WX_DATAOBJ_H_BASE_ diff --git a/lib/wxWidgets/include/wx/dataview.h b/lib/wxWidgets/include/wx/dataview.h new file mode 100644 index 0000000..7c9b5de --- /dev/null +++ b/lib/wxWidgets/include/wx/dataview.h @@ -0,0 +1,1509 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dataview.h +// Purpose: wxDataViewCtrl base classes +// Author: Robert Roebling +// Modified by: Bo Yang +// Created: 08.01.06 +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DATAVIEW_H_BASE_ +#define _WX_DATAVIEW_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_DATAVIEWCTRL + +#include "wx/textctrl.h" +#include "wx/headercol.h" +#include "wx/variant.h" +#include "wx/dnd.h" // For wxDragResult declaration only. +#include "wx/dynarray.h" +#include "wx/icon.h" +#include "wx/itemid.h" +#include "wx/weakref.h" +#include "wx/vector.h" +#include "wx/dataobj.h" +#include "wx/withimages.h" +#include "wx/systhemectrl.h" +#include "wx/vector.h" + +class WXDLLIMPEXP_FWD_CORE wxImageList; +class wxItemAttr; +class WXDLLIMPEXP_FWD_CORE wxHeaderCtrl; + +#if wxUSE_NATIVE_DATAVIEWCTRL && !defined(__WXUNIVERSAL__) + #if defined(__WXGTK20__) || defined(__WXOSX__) + #define wxHAS_NATIVE_DATAVIEWCTRL + #endif +#endif + +#ifndef wxHAS_NATIVE_DATAVIEWCTRL + #define wxHAS_GENERIC_DATAVIEWCTRL +#endif + +#ifdef wxHAS_GENERIC_DATAVIEWCTRL + // this symbol doesn't follow the convention for wxUSE_XXX symbols which + // are normally always defined as either 0 or 1, so its use is deprecated + // and it only exists for backwards compatibility, don't use it any more + // and use wxHAS_GENERIC_DATAVIEWCTRL instead + #define wxUSE_GENERICDATAVIEWCTRL +#endif + +// ---------------------------------------------------------------------------- +// wxDataViewCtrl globals +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxDataViewModel; +class WXDLLIMPEXP_FWD_CORE wxDataViewCtrl; +class WXDLLIMPEXP_FWD_CORE wxDataViewColumn; +class WXDLLIMPEXP_FWD_CORE wxDataViewRenderer; +class WXDLLIMPEXP_FWD_CORE wxDataViewModelNotifier; +#if wxUSE_ACCESSIBILITY +class WXDLLIMPEXP_FWD_CORE wxDataViewCtrlAccessible; +#endif // wxUSE_ACCESSIBILITY + +extern WXDLLIMPEXP_DATA_CORE(const char) wxDataViewCtrlNameStr[]; + +// ---------------------------------------------------------------------------- +// wxDataViewCtrl flags +// ---------------------------------------------------------------------------- + +// size of a wxDataViewRenderer without contents: +#define wxDVC_DEFAULT_RENDERER_SIZE 20 + +// the default width of new (text) columns: +#define wxDVC_DEFAULT_WIDTH 80 + +// the default width of new toggle columns: +#define wxDVC_TOGGLE_DEFAULT_WIDTH 30 + +// the default minimal width of the columns: +#define wxDVC_DEFAULT_MINWIDTH 30 + +// The default alignment of wxDataViewRenderers is to take +// the alignment from the column it owns. +#define wxDVR_DEFAULT_ALIGNMENT -1 + + +// --------------------------------------------------------- +// wxDataViewItem +// --------------------------------------------------------- + +// Make it a class and not a typedef to allow forward declaring it. +class wxDataViewItem : public wxItemId +{ +public: + wxDataViewItem() : wxItemId() { } + explicit wxDataViewItem(void* pItem) : wxItemId(pItem) { } +}; + +WX_DEFINE_ARRAY(wxDataViewItem, wxDataViewItemArray); + +// --------------------------------------------------------- +// wxDataViewModelNotifier +// --------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataViewModelNotifier +{ +public: + wxDataViewModelNotifier() { m_owner = NULL; } + virtual ~wxDataViewModelNotifier() { m_owner = NULL; } + + virtual bool ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item ) = 0; + virtual bool ItemDeleted( const wxDataViewItem &parent, const wxDataViewItem &item ) = 0; + virtual bool ItemChanged( const wxDataViewItem &item ) = 0; + virtual bool ItemsAdded( const wxDataViewItem &parent, const wxDataViewItemArray &items ); + virtual bool ItemsDeleted( const wxDataViewItem &parent, const wxDataViewItemArray &items ); + virtual bool ItemsChanged( const wxDataViewItemArray &items ); + virtual bool ValueChanged( const wxDataViewItem &item, unsigned int col ) = 0; + virtual bool Cleared() = 0; + + // some platforms, such as GTK+, may need a two step procedure for ::Reset() + virtual bool BeforeReset() { return true; } + virtual bool AfterReset() { return Cleared(); } + + virtual void Resort() = 0; + + void SetOwner( wxDataViewModel *owner ) { m_owner = owner; } + wxDataViewModel *GetOwner() const { return m_owner; } + +private: + wxDataViewModel *m_owner; +}; + + + +// ---------------------------------------------------------------------------- +// wxDataViewItemAttr: a structure containing the visual attributes of an item +// ---------------------------------------------------------------------------- + +// TODO: Merge with wxItemAttr somehow. + +class WXDLLIMPEXP_CORE wxDataViewItemAttr +{ +public: + // ctors + wxDataViewItemAttr() + { + m_bold = false; + m_italic = false; + m_strikethrough = false; + } + + // setters + void SetColour(const wxColour& colour) { m_colour = colour; } + void SetBold( bool set ) { m_bold = set; } + void SetItalic( bool set ) { m_italic = set; } + void SetStrikethrough( bool set ) { m_strikethrough = set; } + void SetBackgroundColour(const wxColour& colour) { m_bgColour = colour; } + + // accessors + bool HasColour() const { return m_colour.IsOk(); } + const wxColour& GetColour() const { return m_colour; } + + bool HasFont() const { return m_bold || m_italic || m_strikethrough; } + bool GetBold() const { return m_bold; } + bool GetItalic() const { return m_italic; } + bool GetStrikethrough() const { return m_strikethrough; } + + bool HasBackgroundColour() const { return m_bgColour.IsOk(); } + const wxColour& GetBackgroundColour() const { return m_bgColour; } + + bool IsDefault() const { return !(HasColour() || HasFont() || HasBackgroundColour()); } + + // Return the font based on the given one with this attribute applied to it. + wxFont GetEffectiveFont(const wxFont& font) const; + +private: + wxColour m_colour; + bool m_bold; + bool m_italic; + bool m_strikethrough; + wxColour m_bgColour; +}; + + +// --------------------------------------------------------- +// wxDataViewModel +// --------------------------------------------------------- + +typedef wxVector wxDataViewModelNotifiers; + +class WXDLLIMPEXP_CORE wxDataViewModel: public wxRefCounter +{ +public: + wxDataViewModel(); + + // get value into a wxVariant + virtual void GetValue( wxVariant &variant, + const wxDataViewItem &item, unsigned int col ) const = 0; + + // return true if the given item has a value to display in the given + // column: this is always true except for container items which by default + // only show their label in the first column (but see HasContainerColumns()) + virtual bool HasValue(const wxDataViewItem& item, unsigned col) const + { + return col == 0 || !IsContainer(item) || HasContainerColumns(item); + } + + // usually ValueChanged() should be called after changing the value in the + // model to update the control, ChangeValue() does it on its own while + // SetValue() does not -- so while you will override SetValue(), you should + // be usually calling ChangeValue() + virtual bool SetValue(const wxVariant &variant, + const wxDataViewItem &item, + unsigned int col) = 0; + + bool ChangeValue(const wxVariant& variant, + const wxDataViewItem& item, + unsigned int col) + { + return SetValue(variant, item, col) && ValueChanged(item, col); + } + + // Get text attribute, return false of default attributes should be used + virtual bool GetAttr(const wxDataViewItem &WXUNUSED(item), + unsigned int WXUNUSED(col), + wxDataViewItemAttr &WXUNUSED(attr)) const + { + return false; + } + + // Override this if you want to disable specific items + virtual bool IsEnabled(const wxDataViewItem &WXUNUSED(item), + unsigned int WXUNUSED(col)) const + { + return true; + } + + // define hierarchy + virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const = 0; + virtual bool IsContainer( const wxDataViewItem &item ) const = 0; + // Is the container just a header or an item with all columns + virtual bool HasContainerColumns(const wxDataViewItem& WXUNUSED(item)) const + { return false; } + virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const = 0; + + // delegated notifiers + bool ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item ); + bool ItemsAdded( const wxDataViewItem &parent, const wxDataViewItemArray &items ); + bool ItemDeleted( const wxDataViewItem &parent, const wxDataViewItem &item ); + bool ItemsDeleted( const wxDataViewItem &parent, const wxDataViewItemArray &items ); + bool ItemChanged( const wxDataViewItem &item ); + bool ItemsChanged( const wxDataViewItemArray &items ); + bool ValueChanged( const wxDataViewItem &item, unsigned int col ); + bool Cleared(); + + // some platforms, such as GTK+, may need a two step procedure for ::Reset() + bool BeforeReset(); + bool AfterReset(); + + + // delegated action + virtual void Resort(); + + void AddNotifier( wxDataViewModelNotifier *notifier ); + void RemoveNotifier( wxDataViewModelNotifier *notifier ); + + // default compare function + virtual int Compare( const wxDataViewItem &item1, const wxDataViewItem &item2, + unsigned int column, bool ascending ) const; + virtual bool HasDefaultCompare() const { return false; } + + // internal + virtual bool IsListModel() const { return false; } + virtual bool IsVirtualListModel() const { return false; } + + // deprecated: these methods used to be pure virtual but they're not really + // needed by the implementation, and so now overriding them is unnecessary + // as they're never called, but they're still preserved to avoid breaking + // the existing code using "override" with them in the derived classes. + wxDEPRECATED_MSG("Use wxDataViewCtrl::GetColumnCount() and don't override") + virtual unsigned int GetColumnCount() const { return 0; } + wxDEPRECATED_MSG("Don't override this function, is is not needed any more") + virtual wxString GetColumnType( unsigned int WXUNUSED(col) ) const + { + return wxString(); + } + +protected: + // Dtor is protected because the objects of this class must not be deleted, + // DecRef() must be used instead. + virtual ~wxDataViewModel(); + + // Helper function used by the default Compare() implementation to compare + // values of types it is not aware about. Can be overridden in the derived + // classes that use columns of custom types. + virtual int DoCompareValues(const wxVariant& WXUNUSED(value1), + const wxVariant& WXUNUSED(value2)) const + { + return 0; + } + +private: + wxDataViewModelNotifiers m_notifiers; +}; + +// ---------------------------------------------------------------------------- +// wxDataViewListModel: a model of a list, i.e. flat data structure without any +// branches/containers, used as base class by wxDataViewIndexListModel and +// wxDataViewVirtualListModel +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataViewListModel : public wxDataViewModel +{ +public: + // derived classes should override these methods instead of + // {Get,Set}Value() and GetAttr() inherited from the base class + + virtual void GetValueByRow(wxVariant &variant, + unsigned row, unsigned col) const = 0; + + virtual bool SetValueByRow(const wxVariant &variant, + unsigned row, unsigned col) = 0; + + virtual bool + GetAttrByRow(unsigned WXUNUSED(row), unsigned WXUNUSED(col), + wxDataViewItemAttr &WXUNUSED(attr)) const + { + return false; + } + + virtual bool IsEnabledByRow(unsigned int WXUNUSED(row), + unsigned int WXUNUSED(col)) const + { + return true; + } + + + // helper methods provided by list models only + virtual unsigned GetRow( const wxDataViewItem &item ) const = 0; + + // returns the number of rows + virtual unsigned int GetCount() const = 0; + + // implement some base class pure virtual directly + virtual wxDataViewItem + GetParent( const wxDataViewItem & WXUNUSED(item) ) const wxOVERRIDE + { + // items never have valid parent in this model + return wxDataViewItem(); + } + + virtual bool IsContainer( const wxDataViewItem &item ) const wxOVERRIDE + { + // only the invisible (and invalid) root item has children + return !item.IsOk(); + } + + // and implement some others by forwarding them to our own ones + virtual void GetValue( wxVariant &variant, + const wxDataViewItem &item, unsigned int col ) const wxOVERRIDE + { + GetValueByRow(variant, GetRow(item), col); + } + + virtual bool SetValue( const wxVariant &variant, + const wxDataViewItem &item, unsigned int col ) wxOVERRIDE + { + return SetValueByRow( variant, GetRow(item), col ); + } + + virtual bool GetAttr(const wxDataViewItem &item, unsigned int col, + wxDataViewItemAttr &attr) const wxOVERRIDE + { + return GetAttrByRow( GetRow(item), col, attr ); + } + + virtual bool IsEnabled(const wxDataViewItem &item, unsigned int col) const wxOVERRIDE + { + return IsEnabledByRow( GetRow(item), col ); + } + + + virtual bool IsListModel() const wxOVERRIDE { return true; } +}; + +// --------------------------------------------------------- +// wxDataViewIndexListModel +// --------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataViewIndexListModel: public wxDataViewListModel +{ +public: + wxDataViewIndexListModel( unsigned int initial_size = 0 ); + + void RowPrepended(); + void RowInserted( unsigned int before ); + void RowAppended(); + void RowDeleted( unsigned int row ); + void RowsDeleted( const wxArrayInt &rows ); + void RowChanged( unsigned int row ); + void RowValueChanged( unsigned int row, unsigned int col ); + void Reset( unsigned int new_size ); + + // convert to/from row/wxDataViewItem + + virtual unsigned GetRow( const wxDataViewItem &item ) const wxOVERRIDE; + wxDataViewItem GetItem( unsigned int row ) const; + + // implement base methods + virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const wxOVERRIDE; + + unsigned int GetCount() const wxOVERRIDE { return (unsigned int)m_hash.GetCount(); } + +private: + wxDataViewItemArray m_hash; + unsigned int m_nextFreeID; + bool m_ordered; +}; + +// --------------------------------------------------------- +// wxDataViewVirtualListModel +// --------------------------------------------------------- + +#ifdef __WXMAC__ +// better than nothing +typedef wxDataViewIndexListModel wxDataViewVirtualListModel; +#else + +class WXDLLIMPEXP_CORE wxDataViewVirtualListModel: public wxDataViewListModel +{ +public: + wxDataViewVirtualListModel( unsigned int initial_size = 0 ); + + void RowPrepended(); + void RowInserted( unsigned int before ); + void RowAppended(); + void RowDeleted( unsigned int row ); + void RowsDeleted( const wxArrayInt &rows ); + void RowChanged( unsigned int row ); + void RowValueChanged( unsigned int row, unsigned int col ); + void Reset( unsigned int new_size ); + + // convert to/from row/wxDataViewItem + + virtual unsigned GetRow( const wxDataViewItem &item ) const wxOVERRIDE; + wxDataViewItem GetItem( unsigned int row ) const; + + // compare based on index + + virtual int Compare( const wxDataViewItem &item1, const wxDataViewItem &item2, + unsigned int column, bool ascending ) const wxOVERRIDE; + virtual bool HasDefaultCompare() const wxOVERRIDE; + + // implement base methods + virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const wxOVERRIDE; + + unsigned int GetCount() const wxOVERRIDE { return m_size; } + + // internal + virtual bool IsVirtualListModel() const wxOVERRIDE { return true; } + +private: + unsigned int m_size; +}; +#endif + +// ---------------------------------------------------------------------------- +// wxDataViewRenderer and related classes +// ---------------------------------------------------------------------------- + +#include "wx/dvrenderers.h" + +// --------------------------------------------------------- +// wxDataViewColumnBase +// --------------------------------------------------------- + +// for compatibility only, do not use +enum wxDataViewColumnFlags +{ + wxDATAVIEW_COL_RESIZABLE = wxCOL_RESIZABLE, + wxDATAVIEW_COL_SORTABLE = wxCOL_SORTABLE, + wxDATAVIEW_COL_REORDERABLE = wxCOL_REORDERABLE, + wxDATAVIEW_COL_HIDDEN = wxCOL_HIDDEN +}; + +class WXDLLIMPEXP_CORE wxDataViewColumnBase : public wxSettableHeaderColumn +{ +public: + // ctor for the text columns: takes ownership of renderer + wxDataViewColumnBase(wxDataViewRenderer *renderer, + unsigned int model_column) + { + Init(renderer, model_column); + } + + // ctor for the bitmap columns + wxDataViewColumnBase(const wxBitmapBundle& bitmap, + wxDataViewRenderer *renderer, + unsigned int model_column) + : m_bitmap(bitmap) + { + Init(renderer, model_column); + } + + virtual ~wxDataViewColumnBase(); + + // setters: + virtual void SetOwner( wxDataViewCtrl *owner ) + { m_owner = owner; } + + // getters: + unsigned int GetModelColumn() const { return static_cast(m_model_column); } + wxDataViewCtrl *GetOwner() const { return m_owner; } + wxDataViewRenderer* GetRenderer() const { return m_renderer; } + + // implement some of base class pure virtuals (the rest is port-dependent + // and done differently in generic and native versions) + virtual void SetBitmap( const wxBitmapBundle& bitmap ) wxOVERRIDE { m_bitmap = bitmap; } + virtual wxBitmap GetBitmap() const wxOVERRIDE { return m_bitmap.GetBitmap(wxDefaultSize); } + virtual wxBitmapBundle GetBitmapBundle() const wxOVERRIDE { return m_bitmap; } + + // Special accessor for use by wxWidgets only returning the width that was + // explicitly set, either by the application, using SetWidth(), or by the + // user, resizing the column interactively. It is usually the same as + // GetWidth(), but can be different for the last column. + virtual int WXGetSpecifiedWidth() const { return GetWidth(); } + +protected: + wxDataViewRenderer *m_renderer; + int m_model_column; + wxBitmapBundle m_bitmap; + wxDataViewCtrl *m_owner; + +private: + // common part of all ctors + void Init(wxDataViewRenderer *renderer, unsigned int model_column); +}; + +// --------------------------------------------------------- +// wxDataViewCtrlBase +// --------------------------------------------------------- + +#define wxDV_SINGLE 0x0000 // for convenience +#define wxDV_MULTIPLE 0x0001 // can select multiple items + +#define wxDV_NO_HEADER 0x0002 // column titles not visible +#define wxDV_HORIZ_RULES 0x0004 // light horizontal rules between rows +#define wxDV_VERT_RULES 0x0008 // light vertical rules between columns + +#define wxDV_ROW_LINES 0x0010 // alternating colour in rows +#define wxDV_VARIABLE_LINE_HEIGHT 0x0020 // variable line height + +class WXDLLIMPEXP_CORE wxDataViewCtrlBase: public wxSystemThemedControl +{ +public: + wxDataViewCtrlBase(); + virtual ~wxDataViewCtrlBase(); + + // model + // ----- + + virtual bool AssociateModel( wxDataViewModel *model ); + wxDataViewModel* GetModel(); + const wxDataViewModel* GetModel() const; + + + // column management + // ----------------- + + wxDataViewColumn *PrependTextColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxCOL_WIDTH_DEFAULT, + wxAlignment align = wxALIGN_NOT, + int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn *PrependIconTextColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxCOL_WIDTH_DEFAULT, + wxAlignment align = wxALIGN_NOT, + int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn *PrependToggleColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH, + wxAlignment align = wxALIGN_CENTER, + int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn *PrependProgressColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH, + wxAlignment align = wxALIGN_CENTER, + int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn *PrependDateColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = wxCOL_WIDTH_DEFAULT, + wxAlignment align = wxALIGN_NOT, + int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn *PrependBitmapColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxCOL_WIDTH_DEFAULT, + wxAlignment align = wxALIGN_CENTER, + int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn *PrependTextColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxCOL_WIDTH_DEFAULT, + wxAlignment align = wxALIGN_NOT, + int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn *PrependIconTextColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxCOL_WIDTH_DEFAULT, + wxAlignment align = wxALIGN_NOT, + int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn *PrependToggleColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH, + wxAlignment align = wxALIGN_CENTER, + int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn *PrependProgressColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH, + wxAlignment align = wxALIGN_CENTER, + int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn *PrependDateColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = wxCOL_WIDTH_DEFAULT, + wxAlignment align = wxALIGN_NOT, + int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn *PrependBitmapColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxCOL_WIDTH_DEFAULT, + wxAlignment align = wxALIGN_CENTER, + int flags = wxDATAVIEW_COL_RESIZABLE ); + + wxDataViewColumn *AppendTextColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxCOL_WIDTH_DEFAULT, + wxAlignment align = wxALIGN_NOT, + int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn *AppendIconTextColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxCOL_WIDTH_DEFAULT, + wxAlignment align = wxALIGN_NOT, + int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn *AppendToggleColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH, + wxAlignment align = wxALIGN_CENTER, + int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn *AppendProgressColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH, + wxAlignment align = wxALIGN_CENTER, + int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn *AppendDateColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = wxCOL_WIDTH_DEFAULT, + wxAlignment align = wxALIGN_NOT, + int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn *AppendBitmapColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxCOL_WIDTH_DEFAULT, + wxAlignment align = wxALIGN_CENTER, + int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn *AppendTextColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxCOL_WIDTH_DEFAULT, + wxAlignment align = wxALIGN_NOT, + int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn *AppendIconTextColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxCOL_WIDTH_DEFAULT, + wxAlignment align = wxALIGN_NOT, + int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn *AppendToggleColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH, + wxAlignment align = wxALIGN_CENTER, + int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn *AppendProgressColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH, + wxAlignment align = wxALIGN_CENTER, + int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn *AppendDateColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = wxCOL_WIDTH_DEFAULT, + wxAlignment align = wxALIGN_NOT, + int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn *AppendBitmapColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxCOL_WIDTH_DEFAULT, + wxAlignment align = wxALIGN_CENTER, + int flags = wxDATAVIEW_COL_RESIZABLE ); + + virtual bool PrependColumn( wxDataViewColumn *col ); + virtual bool InsertColumn( unsigned int pos, wxDataViewColumn *col ); + virtual bool AppendColumn( wxDataViewColumn *col ); + + virtual unsigned int GetColumnCount() const = 0; + virtual wxDataViewColumn* GetColumn( unsigned int pos ) const = 0; + virtual int GetColumnPosition( const wxDataViewColumn *column ) const = 0; + + virtual bool DeleteColumn( wxDataViewColumn *column ) = 0; + virtual bool ClearColumns() = 0; + + void SetExpanderColumn( wxDataViewColumn *col ) + { m_expander_column = col ; DoSetExpanderColumn(); } + wxDataViewColumn *GetExpanderColumn() const + { return m_expander_column; } + + virtual wxDataViewColumn *GetSortingColumn() const = 0; + virtual wxVector GetSortingColumns() const + { + wxVector columns; + if ( wxDataViewColumn* col = GetSortingColumn() ) + columns.push_back(col); + return columns; + } + + // This must be overridden to return true if the control does allow sorting + // by more than one column, which is not the case by default. + virtual bool AllowMultiColumnSort(bool allow) + { + // We can still return true when disabling multi-column sort. + return !allow; + } + + // Return true if multi column sort is currently allowed. + virtual bool IsMultiColumnSortAllowed() const { return false; } + + // This should also be overridden to actually use the specified column for + // sorting if using multiple columns is supported. + virtual void ToggleSortByColumn(int WXUNUSED(column)) { } + + + // items management + // ---------------- + + void SetIndent( int indent ) + { m_indent = indent ; DoSetIndent(); } + int GetIndent() const + { return m_indent; } + + // Current item is the one used by the keyboard navigation, it is the same + // as the (unique) selected item in single selection mode so these + // functions are mostly useful for controls with wxDV_MULTIPLE style. + wxDataViewItem GetCurrentItem() const; + void SetCurrentItem(const wxDataViewItem& item); + + virtual wxDataViewItem GetTopItem() const { return wxDataViewItem(NULL); } + virtual int GetCountPerPage() const { return wxNOT_FOUND; } + + // Currently focused column of the current item or NULL if no column has focus + virtual wxDataViewColumn *GetCurrentColumn() const = 0; + + // Selection: both GetSelection() and GetSelections() can be used for the + // controls both with and without wxDV_MULTIPLE style. For single selection + // controls GetSelections() is not very useful however. And for multi + // selection controls GetSelection() returns an invalid item if more than + // one item is selected. Use GetSelectedItemsCount() or HasSelection() to + // check if any items are selected at all. + virtual int GetSelectedItemsCount() const = 0; + bool HasSelection() const { return GetSelectedItemsCount() != 0; } + wxDataViewItem GetSelection() const; + virtual int GetSelections( wxDataViewItemArray & sel ) const = 0; + virtual void SetSelections( const wxDataViewItemArray & sel ) = 0; + virtual void Select( const wxDataViewItem & item ) = 0; + virtual void Unselect( const wxDataViewItem & item ) = 0; + virtual bool IsSelected( const wxDataViewItem & item ) const = 0; + + virtual void SelectAll() = 0; + virtual void UnselectAll() = 0; + + void Expand( const wxDataViewItem & item ); + void ExpandChildren( const wxDataViewItem & item ); + void ExpandAncestors( const wxDataViewItem & item ); + virtual void Collapse( const wxDataViewItem & item ) = 0; + virtual bool IsExpanded( const wxDataViewItem & item ) const = 0; + + virtual void EnsureVisible( const wxDataViewItem & item, + const wxDataViewColumn *column = NULL ) = 0; + virtual void HitTest( const wxPoint & point, wxDataViewItem &item, wxDataViewColumn* &column ) const = 0; + virtual wxRect GetItemRect( const wxDataViewItem & item, const wxDataViewColumn *column = NULL ) const = 0; + + virtual bool SetRowHeight( int WXUNUSED(rowHeight) ) { return false; } + + virtual void EditItem(const wxDataViewItem& item, const wxDataViewColumn *column) = 0; + + // Use EditItem() instead + wxDEPRECATED( void StartEditor(const wxDataViewItem& item, unsigned int column) ); + +#if wxUSE_DRAG_AND_DROP + virtual bool EnableDragSource(const wxDataFormat& WXUNUSED(format)) + { return false; } + + bool EnableDropTargets(const wxVector& formats) + { return DoEnableDropTarget(formats); } + + bool EnableDropTarget(const wxDataFormat& format) + { + wxVector formats; + if (format.GetType() != wxDF_INVALID) + { + formats.push_back(format); + } + + return DoEnableDropTarget(formats); + } + +#endif // wxUSE_DRAG_AND_DROP + + // define control visual attributes + // -------------------------------- + + // Header attributes: only implemented in the generic version currently. + virtual bool SetHeaderAttr(const wxItemAttr& WXUNUSED(attr)) + { return false; } + + // Set the colour used for the "alternate" rows when wxDV_ROW_LINES is on. + // Also only supported in the generic version, which returns true to + // indicate it. + virtual bool SetAlternateRowColour(const wxColour& WXUNUSED(colour)) + { return false; } + + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL) + { + return wxControl::GetCompositeControlsDefaultAttributes(variant); + } + +protected: + virtual void DoSetExpanderColumn() = 0 ; + virtual void DoSetIndent() = 0; + +#if wxUSE_DRAG_AND_DROP + // Helper function which can be used by DoEnableDropTarget() implementations + // in the derived classes: return a composite data object supporting the + // given formats or null if the vector is empty. + static wxDataObjectComposite* + CreateDataObject(const wxVector& formats); + + virtual bool DoEnableDropTarget(const wxVector& WXUNUSED(formats)) + { return false; } +#endif // wxUSE_DRAG_AND_DROP + + // Just expand this item assuming it is already shown, i.e. its parent has + // been already expanded using ExpandAncestors(). + // + // If expandChildren is true, also expand all its children recursively. + virtual void DoExpand(const wxDataViewItem & item, bool expandChildren) = 0; + +private: + // Implementation of the public Set/GetCurrentItem() methods which are only + // called in multi selection case (for single selection controls their + // implementation is trivial and is done in the base class itself). + virtual wxDataViewItem DoGetCurrentItem() const = 0; + virtual void DoSetCurrentItem(const wxDataViewItem& item) = 0; + + wxDataViewModel *m_model; + wxDataViewColumn *m_expander_column; + int m_indent ; + +protected: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCtrlBase); +}; + +// ---------------------------------------------------------------------------- +// wxDataViewEvent - the event class for the wxDataViewCtrl notifications +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataViewEvent : public wxNotifyEvent +{ +public: + // Default ctor, normally shouldn't be used and mostly exists only for + // backwards compatibility. + wxDataViewEvent() + : wxNotifyEvent() + { + Init(NULL, NULL, wxDataViewItem()); + } + + // Constructor for the events affecting columns (and possibly also items). + wxDataViewEvent(wxEventType evtType, + wxDataViewCtrlBase* dvc, + wxDataViewColumn* column, + const wxDataViewItem& item = wxDataViewItem()) + : wxNotifyEvent(evtType, dvc->GetId()) + { + Init(dvc, column, item); + } + + // Constructor for the events affecting only the items. + wxDataViewEvent(wxEventType evtType, + wxDataViewCtrlBase* dvc, + const wxDataViewItem& item) + : wxNotifyEvent(evtType, dvc->GetId()) + { + Init(dvc, NULL, item); + } + + wxDataViewEvent(const wxDataViewEvent& event) + : wxNotifyEvent(event), + m_item(event.m_item), + m_col(event.m_col), + m_model(event.m_model), + m_value(event.m_value), + m_column(event.m_column), + m_pos(event.m_pos), + m_cacheFrom(event.m_cacheFrom), + m_cacheTo(event.m_cacheTo), + m_editCancelled(event.m_editCancelled) +#if wxUSE_DRAG_AND_DROP + , m_dataObject(event.m_dataObject), + m_dataFormat(event.m_dataFormat), + m_dataBuffer(event.m_dataBuffer), + m_dataSize(event.m_dataSize), + m_dragFlags(event.m_dragFlags), + m_dropEffect(event.m_dropEffect), + m_proposedDropIndex(event.m_proposedDropIndex) +#endif + { } + + wxDataViewItem GetItem() const { return m_item; } + int GetColumn() const { return m_col; } + wxDataViewModel* GetModel() const { return m_model; } + + const wxVariant &GetValue() const { return m_value; } + void SetValue( const wxVariant &value ) { m_value = value; } + + // for wxEVT_DATAVIEW_ITEM_EDITING_DONE only + bool IsEditCancelled() const { return m_editCancelled; } + + // for wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only + wxDataViewColumn *GetDataViewColumn() const { return m_column; } + + // for wxEVT_DATAVIEW_CONTEXT_MENU only + wxPoint GetPosition() const { return m_pos; } + void SetPosition( int x, int y ) { m_pos.x = x; m_pos.y = y; } + + // For wxEVT_DATAVIEW_CACHE_HINT + int GetCacheFrom() const { return m_cacheFrom; } + int GetCacheTo() const { return m_cacheTo; } + void SetCache(int from, int to) { m_cacheFrom = from; m_cacheTo = to; } + + +#if wxUSE_DRAG_AND_DROP + // For drag operations + void SetDataObject( wxDataObject *obj ) { m_dataObject = obj; } + wxDataObject *GetDataObject() const { return m_dataObject; } + + // For drop operations + void SetDataFormat( const wxDataFormat &format ) { m_dataFormat = format; } + wxDataFormat GetDataFormat() const { return m_dataFormat; } + void SetDataSize( size_t size ) { m_dataSize = size; } + size_t GetDataSize() const { return m_dataSize; } + void SetDataBuffer( void* buf ) { m_dataBuffer = buf;} + void *GetDataBuffer() const { return m_dataBuffer; } + void SetDragFlags( int flags ) { m_dragFlags = flags; } + int GetDragFlags() const { return m_dragFlags; } + void SetDropEffect( wxDragResult effect ) { m_dropEffect = effect; } + wxDragResult GetDropEffect() const { return m_dropEffect; } + // For platforms (currently generic and OSX) that support Drag/Drop + // insertion of items, this is the proposed child index for the insertion. + void SetProposedDropIndex(int index) { m_proposedDropIndex = index; } + int GetProposedDropIndex() const { return m_proposedDropIndex;} + + // Internal, only used by wxWidgets itself. + void InitData(wxDataObjectComposite* obj, wxDataFormat format); +#endif // wxUSE_DRAG_AND_DROP + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxDataViewEvent(*this); } + + // These methods shouldn't be used outside of wxWidgets and wxWidgets + // itself doesn't use them any longer either as it constructs the events + // with the appropriate ctors directly. +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_MSG("Pass the argument to the ctor instead") + void SetModel( wxDataViewModel *model ) { m_model = model; } + wxDEPRECATED_MSG("Pass the argument to the ctor instead") + void SetDataViewColumn( wxDataViewColumn *col ) { m_column = col; } + wxDEPRECATED_MSG("Pass the argument to the ctor instead") + void SetItem( const wxDataViewItem &item ) { m_item = item; } +#endif // WXWIN_COMPATIBILITY_3_0 + + void SetColumn( int col ) { m_col = col; } + void SetEditCancelled() { m_editCancelled = true; } + +protected: + wxDataViewItem m_item; + int m_col; + wxDataViewModel *m_model; + wxVariant m_value; + wxDataViewColumn *m_column; + wxPoint m_pos; + int m_cacheFrom; + int m_cacheTo; + bool m_editCancelled; + +#if wxUSE_DRAG_AND_DROP + wxDataObject *m_dataObject; + + wxMemoryBuffer m_dataBuf; + wxDataFormat m_dataFormat; + void* m_dataBuffer; + size_t m_dataSize; + + int m_dragFlags; + wxDragResult m_dropEffect; + int m_proposedDropIndex; +#endif // wxUSE_DRAG_AND_DROP + +private: + // Common part of non-copy ctors. + void Init(wxDataViewCtrlBase* dvc, + wxDataViewColumn* column, + const wxDataViewItem& item); + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewEvent); +}; + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DATAVIEW_SELECTION_CHANGED, wxDataViewEvent ); + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DATAVIEW_ITEM_ACTIVATED, wxDataViewEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DATAVIEW_ITEM_COLLAPSED, wxDataViewEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DATAVIEW_ITEM_EXPANDED, wxDataViewEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DATAVIEW_ITEM_COLLAPSING, wxDataViewEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DATAVIEW_ITEM_EXPANDING, wxDataViewEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DATAVIEW_ITEM_START_EDITING, wxDataViewEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DATAVIEW_ITEM_EDITING_STARTED, wxDataViewEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DATAVIEW_ITEM_EDITING_DONE, wxDataViewEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DATAVIEW_ITEM_VALUE_CHANGED, wxDataViewEvent ); + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DATAVIEW_ITEM_CONTEXT_MENU, wxDataViewEvent ); + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DATAVIEW_COLUMN_HEADER_CLICK, wxDataViewEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK, wxDataViewEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DATAVIEW_COLUMN_SORTED, wxDataViewEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DATAVIEW_COLUMN_REORDERED, wxDataViewEvent ); + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DATAVIEW_CACHE_HINT, wxDataViewEvent ); + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DATAVIEW_ITEM_BEGIN_DRAG, wxDataViewEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE, wxDataViewEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DATAVIEW_ITEM_DROP, wxDataViewEvent ); + +typedef void (wxEvtHandler::*wxDataViewEventFunction)(wxDataViewEvent&); + +#define wxDataViewEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxDataViewEventFunction, func) + +#define wx__DECLARE_DATAVIEWEVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_DATAVIEW_ ## evt, id, wxDataViewEventHandler(fn)) + +#define EVT_DATAVIEW_SELECTION_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(SELECTION_CHANGED, id, fn) + +#define EVT_DATAVIEW_ITEM_ACTIVATED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_ACTIVATED, id, fn) +#define EVT_DATAVIEW_ITEM_COLLAPSING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_COLLAPSING, id, fn) +#define EVT_DATAVIEW_ITEM_COLLAPSED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_COLLAPSED, id, fn) +#define EVT_DATAVIEW_ITEM_EXPANDING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDING, id, fn) +#define EVT_DATAVIEW_ITEM_EXPANDED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDED, id, fn) +#define EVT_DATAVIEW_ITEM_START_EDITING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_START_EDITING, id, fn) +#define EVT_DATAVIEW_ITEM_EDITING_STARTED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_STARTED, id, fn) +#define EVT_DATAVIEW_ITEM_EDITING_DONE(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_DONE, id, fn) +#define EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_VALUE_CHANGED, id, fn) + +#define EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_CONTEXT_MENU, id, fn) + +#define EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_CLICK, id, fn) +#define EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_RIGHT_CLICK, id, fn) +#define EVT_DATAVIEW_COLUMN_SORTED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_SORTED, id, fn) +#define EVT_DATAVIEW_COLUMN_REORDERED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_REORDERED, id, fn) +#define EVT_DATAVIEW_CACHE_HINT(id, fn) wx__DECLARE_DATAVIEWEVT(CACHE_HINT, id, fn) + +#define EVT_DATAVIEW_ITEM_BEGIN_DRAG(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_BEGIN_DRAG, id, fn) +#define EVT_DATAVIEW_ITEM_DROP_POSSIBLE(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_DROP_POSSIBLE, id, fn) +#define EVT_DATAVIEW_ITEM_DROP(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_DROP, id, fn) + +// Old and not documented synonym, don't use. +#define EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(id, fn) EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK(id, fn) + +#ifdef wxHAS_GENERIC_DATAVIEWCTRL + #include "wx/generic/dataview.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/dataview.h" +#elif defined(__WXMAC__) + #include "wx/osx/dataview.h" +#elif defined(__WXQT__) + #include "wx/qt/dataview.h" +#else + #error "unknown native wxDataViewCtrl implementation" +#endif + +//----------------------------------------------------------------------------- +// wxDataViewListStore +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataViewListStoreLine +{ +public: + wxDataViewListStoreLine( wxUIntPtr data = 0 ) + { + m_data = data; + } + + void SetData( wxUIntPtr data ) + { m_data = data; } + wxUIntPtr GetData() const + { return m_data; } + + wxVector m_values; + +private: + wxUIntPtr m_data; +}; + + +class WXDLLIMPEXP_CORE wxDataViewListStore: public wxDataViewIndexListModel +{ +public: + wxDataViewListStore(); + ~wxDataViewListStore(); + + void PrependColumn( const wxString &varianttype ); + void InsertColumn( unsigned int pos, const wxString &varianttype ); + void AppendColumn( const wxString &varianttype ); + + void AppendItem( const wxVector &values, wxUIntPtr data = 0 ); + void PrependItem( const wxVector &values, wxUIntPtr data = 0 ); + void InsertItem( unsigned int row, const wxVector &values, wxUIntPtr data = 0 ); + void DeleteItem( unsigned int pos ); + void DeleteAllItems(); + void ClearColumns(); + + unsigned int GetItemCount() const; + + void SetItemData( const wxDataViewItem& item, wxUIntPtr data ); + wxUIntPtr GetItemData( const wxDataViewItem& item ) const; + + // override base virtuals + + virtual void GetValueByRow( wxVariant &value, + unsigned int row, unsigned int col ) const wxOVERRIDE; + + virtual bool SetValueByRow( const wxVariant &value, + unsigned int row, unsigned int col ) wxOVERRIDE; + + +public: + wxVector m_data; + wxArrayString m_cols; +}; + +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataViewListCtrl: public wxDataViewCtrl +{ +public: + wxDataViewListCtrl(); + wxDataViewListCtrl( wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxDV_ROW_LINES, + const wxValidator& validator = wxDefaultValidator ); + ~wxDataViewListCtrl(); + + bool Create( wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxDV_ROW_LINES, + const wxValidator& validator = wxDefaultValidator ); + + wxDataViewListStore *GetStore() + { return (wxDataViewListStore*) GetModel(); } + const wxDataViewListStore *GetStore() const + { return (const wxDataViewListStore*) GetModel(); } + + int ItemToRow(const wxDataViewItem &item) const + { return item.IsOk() ? (int)GetStore()->GetRow(item) : wxNOT_FOUND; } + wxDataViewItem RowToItem(int row) const + { return row == wxNOT_FOUND ? wxDataViewItem() : GetStore()->GetItem(row); } + + int GetSelectedRow() const + { return ItemToRow(GetSelection()); } + void SelectRow(unsigned row) + { Select(RowToItem(row)); } + void UnselectRow(unsigned row) + { Unselect(RowToItem(row)); } + bool IsRowSelected(unsigned row) const + { return IsSelected(RowToItem(row)); } + + bool AppendColumn( wxDataViewColumn *column, const wxString &varianttype ); + bool PrependColumn( wxDataViewColumn *column, const wxString &varianttype ); + bool InsertColumn( unsigned int pos, wxDataViewColumn *column, const wxString &varianttype ); + + // overridden from base class + virtual bool PrependColumn( wxDataViewColumn *col ) wxOVERRIDE; + virtual bool InsertColumn( unsigned int pos, wxDataViewColumn *col ) wxOVERRIDE; + virtual bool AppendColumn( wxDataViewColumn *col ) wxOVERRIDE; + virtual bool ClearColumns() wxOVERRIDE; + + wxDataViewColumn *AppendTextColumn( const wxString &label, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxCOL_WIDTH_DEFAULT, + wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn *AppendToggleColumn( const wxString &label, + wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = wxCOL_WIDTH_DEFAULT, + wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn *AppendProgressColumn( const wxString &label, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxCOL_WIDTH_DEFAULT, + wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn *AppendIconTextColumn( const wxString &label, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxCOL_WIDTH_DEFAULT, + wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); + + void AppendItem( const wxVector &values, wxUIntPtr data = 0 ) + { GetStore()->AppendItem( values, data ); } + void PrependItem( const wxVector &values, wxUIntPtr data = 0 ) + { GetStore()->PrependItem( values, data ); } + void InsertItem( unsigned int row, const wxVector &values, wxUIntPtr data = 0 ) + { GetStore()->InsertItem( row, values, data ); } + void DeleteItem( unsigned row ) + { GetStore()->DeleteItem( row ); } + void DeleteAllItems() + { GetStore()->DeleteAllItems(); } + + void SetValue( const wxVariant &value, unsigned int row, unsigned int col ) + { GetStore()->SetValueByRow( value, row, col ); + GetStore()->RowValueChanged( row, col); } + void GetValue( wxVariant &value, unsigned int row, unsigned int col ) + { GetStore()->GetValueByRow( value, row, col ); } + + void SetTextValue( const wxString &value, unsigned int row, unsigned int col ) + { GetStore()->SetValueByRow( value, row, col ); + GetStore()->RowValueChanged( row, col); } + wxString GetTextValue( unsigned int row, unsigned int col ) const + { wxVariant value; GetStore()->GetValueByRow( value, row, col ); return value.GetString(); } + + void SetToggleValue( bool value, unsigned int row, unsigned int col ) + { GetStore()->SetValueByRow( value, row, col ); + GetStore()->RowValueChanged( row, col); } + bool GetToggleValue( unsigned int row, unsigned int col ) const + { wxVariant value; GetStore()->GetValueByRow( value, row, col ); return value.GetBool(); } + + void SetItemData( const wxDataViewItem& item, wxUIntPtr data ) + { GetStore()->SetItemData( item, data ); } + wxUIntPtr GetItemData( const wxDataViewItem& item ) const + { return GetStore()->GetItemData( item ); } + + int GetItemCount() const + { return GetStore()->GetItemCount(); } + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewListCtrl); +}; + +//----------------------------------------------------------------------------- +// wxDataViewTreeStore +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataViewTreeStoreNode +{ +public: + wxDataViewTreeStoreNode( wxDataViewTreeStoreNode *parent, + const wxString &text, + const wxBitmapBundle &icon = wxBitmapBundle(), + wxClientData *data = NULL ); + virtual ~wxDataViewTreeStoreNode(); + + void SetText( const wxString &text ) + { m_text = text; } + wxString GetText() const + { return m_text; } + void SetIcon( const wxBitmapBundle &icon ) + { m_icon = icon; } + const wxBitmapBundle& GetBitmapBundle() const + { return m_icon; } + wxIcon GetIcon() const + { return m_icon.GetIcon(wxDefaultSize); } + void SetData( wxClientData *data ) + { delete m_data; m_data = data; } + wxClientData *GetData() const + { return m_data; } + + wxDataViewItem GetItem() const + { return wxDataViewItem(const_cast(static_cast(this))); } + + virtual bool IsContainer() + { return false; } + + wxDataViewTreeStoreNode *GetParent() + { return m_parent; } + +private: + wxDataViewTreeStoreNode *m_parent; + wxString m_text; + wxBitmapBundle m_icon; + wxClientData *m_data; +}; + +typedef wxVector wxDataViewTreeStoreNodes; + +class WXDLLIMPEXP_CORE wxDataViewTreeStoreContainerNode: public wxDataViewTreeStoreNode +{ +public: + wxDataViewTreeStoreContainerNode( wxDataViewTreeStoreNode *parent, + const wxString &text, + const wxBitmapBundle &icon = wxBitmapBundle(), + const wxBitmapBundle &expanded = wxBitmapBundle(), + wxClientData *data = NULL ); + virtual ~wxDataViewTreeStoreContainerNode(); + + const wxDataViewTreeStoreNodes &GetChildren() const + { return m_children; } + wxDataViewTreeStoreNodes &GetChildren() + { return m_children; } + + wxDataViewTreeStoreNodes::iterator FindChild(wxDataViewTreeStoreNode* node); + + void SetExpandedIcon( const wxBitmapBundle &icon ) + { m_iconExpanded = icon; } + const wxBitmapBundle& GetExpandedBitmapBundle() const + { return m_iconExpanded; } + wxIcon GetExpandedIcon() const + { return m_iconExpanded.GetIcon(wxDefaultSize); } + + void SetExpanded( bool expanded = true ) + { m_isExpanded = expanded; } + bool IsExpanded() const + { return m_isExpanded; } + + virtual bool IsContainer() wxOVERRIDE + { return true; } + + void DestroyChildren(); + +private: + wxDataViewTreeStoreNodes m_children; + wxBitmapBundle m_iconExpanded; + bool m_isExpanded; +}; + +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataViewTreeStore: public wxDataViewModel +{ +public: + wxDataViewTreeStore(); + ~wxDataViewTreeStore(); + + wxDataViewItem AppendItem( const wxDataViewItem& parent, + const wxString &text, + const wxBitmapBundle &icon = wxBitmapBundle(), + wxClientData *data = NULL ); + wxDataViewItem PrependItem( const wxDataViewItem& parent, + const wxString &text, + const wxBitmapBundle &icon = wxBitmapBundle(), + wxClientData *data = NULL ); + wxDataViewItem InsertItem( const wxDataViewItem& parent, const wxDataViewItem& previous, + const wxString &text, + const wxBitmapBundle &icon = wxBitmapBundle(), + wxClientData *data = NULL ); + + wxDataViewItem PrependContainer( const wxDataViewItem& parent, + const wxString &text, + const wxBitmapBundle &icon = wxBitmapBundle(), + const wxBitmapBundle &expanded = wxBitmapBundle(), + wxClientData *data = NULL ); + wxDataViewItem AppendContainer( const wxDataViewItem& parent, + const wxString &text, + const wxBitmapBundle &icon = wxBitmapBundle(), + const wxBitmapBundle &expanded = wxBitmapBundle(), + wxClientData *data = NULL ); + wxDataViewItem InsertContainer( const wxDataViewItem& parent, const wxDataViewItem& previous, + const wxString &text, + const wxBitmapBundle &icon = wxBitmapBundle(), + const wxBitmapBundle &expanded = wxBitmapBundle(), + wxClientData *data = NULL ); + + wxDataViewItem GetNthChild( const wxDataViewItem& parent, unsigned int pos ) const; + int GetChildCount( const wxDataViewItem& parent ) const; + + void SetItemText( const wxDataViewItem& item, const wxString &text ); + wxString GetItemText( const wxDataViewItem& item ) const; + void SetItemIcon( const wxDataViewItem& item, const wxBitmapBundle &icon ); + wxBitmapBundle GetItemBitmapBundle( const wxDataViewItem& item ) const; + wxIcon GetItemIcon( const wxDataViewItem& item ) const; + void SetItemExpandedIcon( const wxDataViewItem& item, const wxBitmapBundle &icon ); + wxBitmapBundle GetItemExpandedBitmapBundle( const wxDataViewItem& item ) const; + wxIcon GetItemExpandedIcon( const wxDataViewItem& item ) const; + void SetItemData( const wxDataViewItem& item, wxClientData *data ); + wxClientData *GetItemData( const wxDataViewItem& item ) const; + + void DeleteItem( const wxDataViewItem& item ); + void DeleteChildren( const wxDataViewItem& item ); + void DeleteAllItems(); + + // implement base methods + + virtual void GetValue( wxVariant &variant, + const wxDataViewItem &item, unsigned int col ) const wxOVERRIDE; + virtual bool SetValue( const wxVariant &variant, + const wxDataViewItem &item, unsigned int col ) wxOVERRIDE; + virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const wxOVERRIDE; + virtual bool IsContainer( const wxDataViewItem &item ) const wxOVERRIDE; + virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const wxOVERRIDE; + + virtual int Compare( const wxDataViewItem &item1, const wxDataViewItem &item2, + unsigned int column, bool ascending ) const wxOVERRIDE; + + virtual bool HasDefaultCompare() const wxOVERRIDE + { return true; } + + wxDataViewTreeStoreNode *FindNode( const wxDataViewItem &item ) const; + wxDataViewTreeStoreContainerNode *FindContainerNode( const wxDataViewItem &item ) const; + wxDataViewTreeStoreNode *GetRoot() const { return m_root; } + +public: + wxDataViewTreeStoreNode *m_root; +}; + +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataViewTreeCtrl: public wxDataViewCtrl, + public wxWithImages +{ +public: + wxDataViewTreeCtrl() { } + wxDataViewTreeCtrl(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDV_NO_HEADER | wxDV_ROW_LINES, + const wxValidator& validator = wxDefaultValidator) + { + Create(parent, id, pos, size, style, validator); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDV_NO_HEADER | wxDV_ROW_LINES, + const wxValidator& validator = wxDefaultValidator); + + wxDataViewTreeStore *GetStore() + { return (wxDataViewTreeStore*) GetModel(); } + const wxDataViewTreeStore *GetStore() const + { return (const wxDataViewTreeStore*) GetModel(); } + + bool IsContainer( const wxDataViewItem& item ) const + { return GetStore()->IsContainer(item); } + + wxDataViewItem AppendItem( const wxDataViewItem& parent, + const wxString &text, int icon = NO_IMAGE, wxClientData *data = NULL ); + wxDataViewItem PrependItem( const wxDataViewItem& parent, + const wxString &text, int icon = NO_IMAGE, wxClientData *data = NULL ); + wxDataViewItem InsertItem( const wxDataViewItem& parent, const wxDataViewItem& previous, + const wxString &text, int icon = NO_IMAGE, wxClientData *data = NULL ); + + wxDataViewItem PrependContainer( const wxDataViewItem& parent, + const wxString &text, int icon = NO_IMAGE, int expanded = NO_IMAGE, + wxClientData *data = NULL ); + wxDataViewItem AppendContainer( const wxDataViewItem& parent, + const wxString &text, int icon = NO_IMAGE, int expanded = NO_IMAGE, + wxClientData *data = NULL ); + wxDataViewItem InsertContainer( const wxDataViewItem& parent, const wxDataViewItem& previous, + const wxString &text, int icon = NO_IMAGE, int expanded = NO_IMAGE, + wxClientData *data = NULL ); + + wxDataViewItem GetNthChild( const wxDataViewItem& parent, unsigned int pos ) const + { return GetStore()->GetNthChild(parent, pos); } + int GetChildCount( const wxDataViewItem& parent ) const + { return GetStore()->GetChildCount(parent); } + wxDataViewItem GetItemParent(wxDataViewItem item) const + { return GetStore()->GetParent(item); } + + void SetItemText( const wxDataViewItem& item, const wxString &text ); + wxString GetItemText( const wxDataViewItem& item ) const + { return GetStore()->GetItemText(item); } + void SetItemIcon( const wxDataViewItem& item, const wxBitmapBundle &icon ); + wxIcon GetItemIcon( const wxDataViewItem& item ) const + { return GetStore()->GetItemIcon(item); } + void SetItemExpandedIcon( const wxDataViewItem& item, const wxBitmapBundle &icon ); + wxIcon GetItemExpandedIcon( const wxDataViewItem& item ) const + { return GetStore()->GetItemExpandedIcon(item); } + void SetItemData( const wxDataViewItem& item, wxClientData *data ) + { GetStore()->SetItemData(item,data); } + wxClientData *GetItemData( const wxDataViewItem& item ) const + { return GetStore()->GetItemData(item); } + + void DeleteItem( const wxDataViewItem& item ); + void DeleteChildren( const wxDataViewItem& item ); + void DeleteAllItems(); + + void OnExpanded( wxDataViewEvent &event ); + void OnCollapsed( wxDataViewEvent &event ); + void OnSize( wxSizeEvent &event ); + +protected: + virtual void OnImagesChanged() wxOVERRIDE; + +private: + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewTreeCtrl); +}; + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED wxEVT_DATAVIEW_SELECTION_CHANGED +#define wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED wxEVT_DATAVIEW_ITEM_ACTIVATED +#define wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED wxEVT_DATAVIEW_ITEM_COLLAPSED +#define wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED wxEVT_DATAVIEW_ITEM_EXPANDED +#define wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING wxEVT_DATAVIEW_ITEM_COLLAPSING +#define wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING wxEVT_DATAVIEW_ITEM_EXPANDING +#define wxEVT_COMMAND_DATAVIEW_ITEM_START_EDITING wxEVT_DATAVIEW_ITEM_START_EDITING +#define wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED wxEVT_DATAVIEW_ITEM_EDITING_STARTED +#define wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE wxEVT_DATAVIEW_ITEM_EDITING_DONE +#define wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED wxEVT_DATAVIEW_ITEM_VALUE_CHANGED +#define wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU wxEVT_DATAVIEW_ITEM_CONTEXT_MENU +#define wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK wxEVT_DATAVIEW_COLUMN_HEADER_CLICK +#define wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK wxEVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK +#define wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED wxEVT_DATAVIEW_COLUMN_SORTED +#define wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED wxEVT_DATAVIEW_COLUMN_REORDERED +#define wxEVT_COMMAND_DATAVIEW_CACHE_HINT wxEVT_DATAVIEW_CACHE_HINT +#define wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG wxEVT_DATAVIEW_ITEM_BEGIN_DRAG +#define wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE +#define wxEVT_COMMAND_DATAVIEW_ITEM_DROP wxEVT_DATAVIEW_ITEM_DROP + +#endif // wxUSE_DATAVIEWCTRL + +#endif + // _WX_DATAVIEW_H_BASE_ diff --git a/lib/wxWidgets/include/wx/datectrl.h b/lib/wxWidgets/include/wx/datectrl.h new file mode 100644 index 0000000..9734cb0 --- /dev/null +++ b/lib/wxWidgets/include/wx/datectrl.h @@ -0,0 +1,120 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/datectrl.h +// Purpose: implements wxDatePickerCtrl +// Author: Vadim Zeitlin +// Modified by: +// Created: 2005-01-09 +// Copyright: (c) 2005 Vadim Zeitlin +// 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 on macOS <10.15.4) + 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 +// ---------------------------------------------------------------------------- + +// The template argument must be a class deriving from wxDateTimePickerCtrlBase +// (i.e. in practice either this class itself or wxDateTimePickerCtrl). +template +class WXDLLIMPEXP_ADV wxDatePickerCtrlCommonBase : public Base +{ +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; +}; + +// This class is defined mostly for compatibility and is used as the base class +// by native wxDatePickerCtrl implementations. +typedef wxDatePickerCtrlCommonBase wxDatePickerCtrlBase; + +#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: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl); + }; +#endif + +#endif // wxUSE_DATEPICKCTRL + +#endif // _WX_DATECTRL_H_ + diff --git a/lib/wxWidgets/include/wx/dateevt.h b/lib/wxWidgets/include/wx/dateevt.h new file mode 100644 index 0000000..5354199 --- /dev/null +++ b/lib/wxWidgets/include/wx/dateevt.h @@ -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 +// 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 wxOVERRIDE { return new wxDateEvent(*this); } + +private: + wxDateTime m_date; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(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_ + diff --git a/lib/wxWidgets/include/wx/datetime.h b/lib/wxWidgets/include/wx/datetime.h new file mode 100644 index 0000000..6eb2f8c --- /dev/null +++ b/lib/wxWidgets/include/wx/datetime.h @@ -0,0 +1,2177 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/datetime.h +// Purpose: declarations of time/date related classes (wxDateTime, +// wxTimeSpan) +// Author: Vadim Zeitlin +// Modified by: +// Created: 10.02.99 +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DATETIME_H +#define _WX_DATETIME_H + +#include "wx/defs.h" + +#if wxUSE_DATETIME + +#include + +#include // 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" + +// not all c-runtimes are based on 1/1/1970 being (time_t) 0 +// set this to the corresponding value in seconds 1/1/1970 has on your +// systems c-runtime + +#define WX_TIME_BASE_OFFSET 0 + +/* + * TODO + * + * + 1. Time zones with minutes (make TimeZone a class) + * ? 2. getdate() function like under Solaris + * + 3. text conversion for wxDateSpan + * + 4. pluggable modules for the workdays calculations + * 5. wxDateTimeHolidayAuthority for Easter and other christian feasts + */ + +/* + The three (main) classes declared in this header represent: + + 1. An absolute moment in the time (wxDateTime) + 2. A difference between two moments in the time, positive or negative + (wxTimeSpan) + 3. A logical difference between two dates expressed in + years/months/weeks/days (wxDateSpan) + + The following arithmetic operations are permitted (all others are not): + + addition + -------- + + wxDateTime + wxTimeSpan = wxDateTime + wxDateTime + wxDateSpan = wxDateTime + wxTimeSpan + wxTimeSpan = wxTimeSpan + wxDateSpan + wxDateSpan = wxDateSpan + + subtraction + ------------ + wxDateTime - wxDateTime = wxTimeSpan + wxDateTime - wxTimeSpan = wxDateTime + wxDateTime - wxDateSpan = wxDateTime + wxTimeSpan - wxTimeSpan = wxTimeSpan + wxDateSpan - wxDateSpan = wxDateSpan + + multiplication + -------------- + wxTimeSpan * number = wxTimeSpan + number * wxTimeSpan = wxTimeSpan + wxDateSpan * number = wxDateSpan + number * wxDateSpan = wxDateSpan + + unitary minus + ------------- + -wxTimeSpan = wxTimeSpan + -wxDateSpan = wxDateSpan + + For each binary operation OP (+, -, *) we have the following operatorOP=() as + a method and the method with a symbolic name OPER (Add, Subtract, Multiply) + as a synonym for it and another const method with the same name which returns + the changed copy of the object and operatorOP() as a global function which is + implemented in terms of the const version of OPEN. For the unary - we have + operator-() as a method, Neg() as synonym for it and Negate() which returns + the copy of the object with the changed sign. +*/ + +// an invalid/default date time object which may be used as the default +// argument for arguments of type wxDateTime; it is also returned by all +// functions returning wxDateTime on failure (this is why it is also called +// wxInvalidDateTime) +class WXDLLIMPEXP_FWD_BASE wxDateTime; + +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 +#else + #define wxHAS_STRFTIME +#endif + +// ---------------------------------------------------------------------------- +// wxDateTime represents an absolute moment in the time +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxDateTime +{ +public: + // types + // ------------------------------------------------------------------------ + + // a small unsigned integer type for storing things like minutes, + // seconds &c. It should be at least short (i.e. not char) to contain + // the number of milliseconds - it may also be 'int' because there is + // no size penalty associated with it in our code, we don't store any + // data in this format + typedef unsigned short wxDateTime_t; + + // constants + // ------------------------------------------------------------------------ + + // the timezones + enum TZ + { + // the time in the current time zone + Local, + + // 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 + + // underscore stands for minus + GMT_12, GMT_11, GMT_10, GMT_9, GMT_8, GMT_7, + GMT_6, GMT_5, GMT_4, GMT_3, GMT_2, GMT_1, + GMT0, + GMT1, GMT2, GMT3, GMT4, GMT5, GMT6, + GMT7, GMT8, GMT9, GMT10, GMT11, GMT12, GMT13, + // Note that GMT12 and GMT_12 are not the same: there is a difference + // of exactly one day between them + + // some symbolic names for TZ + + // Europe + WET = GMT0, // Western Europe Time + WEST = GMT1, // Western Europe Summer Time + CET = GMT1, // Central Europe Time + CEST = GMT2, // Central Europe Summer Time + EET = GMT2, // Eastern Europe Time + EEST = GMT3, // Eastern Europe Summer Time + MSK = GMT3, // Moscow Time + MSD = GMT4, // Moscow Summer Time + + // US and Canada + AST = GMT_4, // Atlantic Standard Time + ADT = GMT_3, // Atlantic Daylight Time + EST = GMT_5, // Eastern Standard Time + EDT = GMT_4, // Eastern Daylight Saving Time + CST = GMT_6, // Central Standard Time + CDT = GMT_5, // Central Daylight Saving Time + MST = GMT_7, // Mountain Standard Time + MDT = GMT_6, // Mountain Daylight Saving Time + PST = GMT_8, // Pacific Standard Time + PDT = GMT_7, // Pacific Daylight Saving Time + HST = GMT_10, // Hawaiian Standard Time + AKST = GMT_9, // Alaska Standard Time + AKDT = GMT_8, // Alaska Daylight Saving Time + + // Australia + + A_WST = GMT8, // Western Standard Time + A_CST = GMT13 + 1, // Central Standard Time (+9.5) + A_EST = GMT10, // Eastern Standard Time + A_ESST = GMT11, // Eastern Summer Time + + // New Zealand + NZST = GMT12, // Standard Time + NZDT = GMT13, // Daylight Saving Time + + // TODO add more symbolic timezone names here + + // Universal Coordinated Time = the new and politically correct name + // for GMT + UTC = GMT0 + }; + + // the calendar systems we know about: notice that it's valid (for + // this classes purpose anyhow) to work with any of these calendars + // even with the dates before the historical appearance of the + // calendar + enum Calendar + { + Gregorian, // current calendar + Julian // calendar in use since -45 until the 1582 (or later) + + // TODO Hebrew, Chinese, Maya, ... (just kidding) (or then may be not?) + }; + + // 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 + // + // TODO move this to intl.h + + enum Country + { + Country_Unknown, // no special information for this country + Country_Default, // set the default country with SetCountry() method + // or use the default country with any other + + // TODO add more countries (for this we must know about DST and/or + // holidays for this country) + + // Western European countries: we assume that they all follow the same + // DST rules (true or false?) + Country_WesternEurope_Start, + Country_EEC = Country_WesternEurope_Start, + France, + Germany, + UK, + Country_WesternEurope_End = UK, + + Russia, + USA + }; + // symbolic names for the months + enum Month + { + Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec, Inv_Month + }; + + // symbolic names for the weekdays + enum WeekDay + { + Sun, Mon, Tue, Wed, Thu, Fri, Sat, Inv_WeekDay + }; + + // invalid value for the year + enum Year + { + Inv_Year = SHRT_MIN // should hold in wxDateTime_t + }; + + // flags for GetWeekDayName and GetMonthName + enum NameFlags + { + Name_Full = 0x01, // return full name + Name_Abbr = 0x02 // return abbreviated name + }; + + // flags for GetWeekOfYear and GetWeekOfMonth + enum WeekFlags + { + Default_First, // Sunday_First for US, Monday_First for the rest + Monday_First, // week starts with a Monday + Sunday_First // week starts with a Sunday + }; + + // Currently we assume that DST is always shifted by 1 hour, this seems to + // be always true in practice. If this ever needs to change, search for all + // places using DST_OFFSET and update them. + enum + { + DST_OFFSET = 3600 + }; + + + // helper classes + // ------------------------------------------------------------------------ + + // a class representing a time zone: basically, this is just an offset + // (in seconds) from GMT + class WXDLLIMPEXP_BASE TimeZone + { + public: + TimeZone(TZ tz); + + // 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; + } + + bool IsLocal() const { return m_offset == -1; } + + long GetOffset() const; + + private: + // offset for this timezone from GMT in seconds + long m_offset; + }; + + // standard struct tm is limited to the years from 1900 (because + // tm_year field is the offset from 1900), so we use our own struct + // instead to represent broken down time + // + // NB: this struct should always be kept normalized (i.e. mon should + // be < 12, 1 <= day <= 31 &c), so use AddMonths(), AddDays() + // instead of modifying the member fields directly! + struct WXDLLIMPEXP_BASE Tm + { + 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; + + // default ctor inits the object to an invalid value + Tm(); + + // ctor from struct tm and the timezone + Tm(const struct tm& tm, const TimeZone& tz); + + // check that the given date/time is valid (in Gregorian calendar) + bool IsValid() const; + + // get the week day + WeekDay GetWeekDay() // not const because wday may be changed + { + if ( wday == Inv_WeekDay ) + ComputeWeekDay(); + + return (WeekDay)wday; + } + + // add the given number of months to the date keeping it normalized + void AddMonths(int monDiff); + + // add the given number of months to the date keeping it normalized + void AddDays(int dayDiff); + + private: + // compute the weekday from other fields + void ComputeWeekDay(); + + // the timezone we correspond to + TimeZone m_tz; + + // 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 + // ------------------------------------------------------------------------ + + // set the current country + static void SetCountry(Country country); + // get the current country + static Country GetCountry(); + + // return true if the country is a West European one (in practice, + // this means that the same DST rules as for EEC apply) + static bool IsWestEuropeanCountry(Country country = Country_Default); + + // return the current year + static int GetCurrentYear(Calendar cal = Gregorian); + + // convert the year as returned by wxDateTime::GetYear() to a year + // suitable for BC/AD notation. The difference is that BC year 1 + // corresponds to the year 0 (while BC year 0 didn't exist) and AD + // year N is just year N. + static int ConvertYearToBC(int year); + + // return the current month + static Month GetCurrentMonth(Calendar cal = Gregorian); + + // returns true if the given year is a leap year in the given calendar + static bool IsLeapYear(int year = Inv_Year, Calendar cal = Gregorian); + + // acquires the first day of week based on locale and/or OS settings + static bool GetFirstWeekDay(WeekDay *firstDay); + + // get the century (19 for 1999, 20 for 2000 and -5 for 492 BC) + static int GetCentury(int year); + + // returns the number of days in this year (356 or 355 for Gregorian + // calendar usually :-) + static wxDateTime_t GetNumberOfDays(int year, Calendar cal = Gregorian); + + // get the number of the days in the given month (default value for + // the year means the current one) + static wxDateTime_t GetNumberOfDays(Month month, + 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); + + // return true if the given country uses DST for this year + static bool IsDSTApplicable(int year = Inv_Year, + Country country = Country_Default); + + // get the beginning of DST for this year, will return invalid object + // if no DST applicable in this year. The default value of the + // parameter means to take the current year. + static wxDateTime GetBeginDST(int year = Inv_Year, + Country country = Country_Default); + // get the end of DST for this year, will return invalid object + // if no DST applicable in this year. The default value of the + // parameter means to take the current year. + static wxDateTime GetEndDST(int year = Inv_Year, + Country country = Country_Default); + + // return the wxDateTime object for the current time + static inline wxDateTime Now(); + + // return the wxDateTime object for the current time with millisecond + // precision (if available on this platform) + static wxDateTime UNow(); + + // return the wxDateTime object for today midnight: i.e. as Now() but + // with time set to 0 + static inline wxDateTime Today(); + + // constructors: you should test whether the constructor succeeded with + // IsValid() function. The values Inv_Month and Inv_Year for the + // parameters mean take current month and/or year values. + // ------------------------------------------------------------------------ + + // default ctor does not initialize the object, use Set()! + wxDateTime() : m_time(wxINT64_MIN) { } + + // from time_t: seconds since the Epoch 00:00:00 UTC, Jan 1, 1970) + inline wxDateTime(time_t timet); + // from broken down time/date (only for standard Unix range) + inline wxDateTime(const struct tm& tm); + // from broken down time/date (any range) + inline wxDateTime(const Tm& tm); + + // from JDN (beware of rounding errors) + inline wxDateTime(double jdn); + + // from separate values for each component, date set to today + inline wxDateTime(wxDateTime_t hour, + wxDateTime_t minute = 0, + wxDateTime_t second = 0, + wxDateTime_t millisec = 0); + // from separate values for each component with explicit date + inline wxDateTime(wxDateTime_t day, // day of the month + Month month, + int year = Inv_Year, // 1999, not 99 please! + wxDateTime_t hour = 0, + 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 + + // no dtor + + // assignment operators and Set() functions: all non const methods return + // the reference to this object. IsValid() should be used to test whether + // the function succeeded. + // ------------------------------------------------------------------------ + + // set to the current time + inline wxDateTime& SetToCurrent(); + + // set to given time_t value + inline wxDateTime& Set(time_t timet); + + // set to given broken down time/date + wxDateTime& Set(const struct tm& tm); + + // set to given broken down time/date + inline wxDateTime& Set(const Tm& tm); + + // set to given JDN (beware of rounding errors) + wxDateTime& Set(double jdn); + + // set to given time, date = today + wxDateTime& Set(wxDateTime_t hour, + wxDateTime_t minute = 0, + wxDateTime_t second = 0, + wxDateTime_t millisec = 0); + + // from separate values for each component with explicit date + // (defaults for month and year are the current values) + wxDateTime& Set(wxDateTime_t day, + Month month, + int year = Inv_Year, // 1999, not 99 please! + wxDateTime_t hour = 0, + wxDateTime_t minute = 0, + wxDateTime_t second = 0, + wxDateTime_t millisec = 0); + + // resets time to 00:00:00, doesn't change the date + wxDateTime& ResetTime(); + + // 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; + + // the following functions don't change the values of the other + // fields, i.e. SetMinute() won't change either hour or seconds value + + // set the year + wxDateTime& SetYear(int year); + // set the month + wxDateTime& SetMonth(Month month); + // set the day of the month + wxDateTime& SetDay(wxDateTime_t day); + // set hour + wxDateTime& SetHour(wxDateTime_t hour); + // set minute + wxDateTime& SetMinute(wxDateTime_t minute); + // set second + wxDateTime& SetSecond(wxDateTime_t second); + // set millisecond + wxDateTime& SetMillisecond(wxDateTime_t millisecond); + + // assignment operator from time_t + wxDateTime& operator=(time_t timet) { return Set(timet); } + + // assignment operator from broken down time/date + wxDateTime& operator=(const struct tm& tm) { return Set(tm); } + + // assignment operator from broken down time/date + wxDateTime& operator=(const Tm& tm) { return Set(tm); } + + // default assignment operator is ok + + // calendar calculations (functions which set the date only leave the time + // unchanged, e.g. don't explicitly zero it): SetXXX() functions modify the + // object itself, GetXXX() ones return a new object. + // ------------------------------------------------------------------------ + + // set to the given week day in the same week as this one + wxDateTime& SetToWeekDayInSameWeek(WeekDay weekday, + WeekFlags flags = Monday_First); + inline wxDateTime GetWeekDayInSameWeek(WeekDay weekday, + WeekFlags flags = Monday_First) const; + + // set to the next week day following this one + wxDateTime& SetToNextWeekDay(WeekDay weekday); + inline wxDateTime GetNextWeekDay(WeekDay weekday) const; + + // set to the previous week day before this one + wxDateTime& SetToPrevWeekDay(WeekDay weekday); + inline wxDateTime GetPrevWeekDay(WeekDay weekday) const; + + // 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()) + bool SetToWeekDay(WeekDay weekday, + int n = 1, + Month month = Inv_Month, + int year = Inv_Year); + inline wxDateTime GetWeekDay(WeekDay weekday, + int n = 1, + Month month = Inv_Month, + int year = Inv_Year) const; + + // sets to the last weekday in the given month, year + inline bool SetToLastWeekDay(WeekDay weekday, + Month month = Inv_Month, + int year = Inv_Year); + inline wxDateTime GetLastWeekDay(WeekDay weekday, + Month month = Inv_Month, + int year = Inv_Year); + + // returns the date corresponding to the given week day of the given + // week (in ISO notation) of the specified year + static wxDateTime SetToWeekOfYear(int year, + wxDateTime_t numWeek, + WeekDay weekday = Mon); + + // sets the date to the last day of the given (or current) month or the + // given (or current) year + wxDateTime& SetToLastMonthDay(Month month = Inv_Month, + int year = Inv_Year); + inline wxDateTime GetLastMonthDay(Month month = Inv_Month, + int year = Inv_Year) const; + + // sets to the given year day (1..365 or 366) + wxDateTime& SetToYearDay(wxDateTime_t yday); + inline wxDateTime GetYearDay(wxDateTime_t yday) const; + + // The definitions below were taken verbatim from + // + // http://www.capecod.net/~pbaum/date/date0.htm + // + // (Peter Baum's home page) + // + // definition: The Julian Day Number, Julian Day, or JD of a + // particular instant of time is the number of days and fractions of a + // day since 12 hours Universal Time (Greenwich mean noon) on January + // 1 of the year -4712, where the year is given in the Julian + // proleptic calendar. The idea of using this reference date was + // originally proposed by Joseph Scalizer in 1582 to count years but + // it was modified by 19th century astronomers to count days. One + // could have equivalently defined the reference time to be noon of + // November 24, -4713 if were understood that Gregorian calendar rules + // were applied. Julian days are Julian Day Numbers and are not to be + // confused with Julian dates. + // + // definition: The Rata Die number is a date specified as the number + // of days relative to a base date of December 31 of the year 0. Thus + // January 1 of the year 1 is Rata Die day 1. + + // get the Julian Day number (the fractional part specifies the time of + // the day, related to noon - beware of rounding errors!) + double GetJulianDayNumber() const; + double GetJDN() const { return GetJulianDayNumber(); } + + // get the Modified Julian Day number: it is equal to JDN - 2400000.5 + // and so integral MJDs correspond to the midnights (and not noons). + // MJD 0 is Nov 17, 1858 + double GetModifiedJulianDayNumber() const { return GetJDN() - 2400000.5; } + double GetMJD() const { return GetModifiedJulianDayNumber(); } + + // get the Rata Die number + double GetRataDie() const; + + // TODO algorithms for calculating some important dates, such as + // religious holidays (Easter...) or moon/solar eclipses? Some + // algorithms can be found in the calendar FAQ + + + // Timezone stuff: a wxDateTime object constructed using given + // day/month/year/hour/min/sec values is interpreted as this moment in + // local time. Using the functions below, it may be converted to another + // time zone (e.g., the Unix epoch is wxDateTime(1, Jan, 1970).ToGMT()). + // + // These functions try to handle DST internally, but there is no magical + // way to know all rules for it in all countries in the world, so if the + // program can handle it itself (or doesn't want to handle it at all for + // whatever reason), the DST handling can be disabled with noDST. + // ------------------------------------------------------------------------ + + // transform to any given timezone + inline wxDateTime ToTimezone(const TimeZone& tz, bool noDST = false) const; + wxDateTime& MakeTimezone(const TimeZone& tz, bool noDST = false); + + // interpret current value as being in another timezone and transform + // it to local one + inline wxDateTime FromTimezone(const TimeZone& tz, bool noDST = false) const; + wxDateTime& MakeFromTimezone(const TimeZone& tz, bool noDST = false); + + // transform to/from GMT/UTC + wxDateTime ToUTC(bool noDST = false) const { return ToTimezone(UTC, noDST); } + wxDateTime& MakeUTC(bool noDST = false) { return MakeTimezone(UTC, noDST); } + + wxDateTime ToGMT(bool noDST = false) const { return ToUTC(noDST); } + wxDateTime& MakeGMT(bool noDST = false) { return MakeUTC(noDST); } + + wxDateTime FromUTC(bool noDST = false) const + { return FromTimezone(UTC, noDST); } + wxDateTime& MakeFromUTC(bool noDST = false) + { return MakeFromTimezone(UTC, noDST); } + + // is daylight savings time in effect at this moment according to the + // rules of the specified country? + // + // Return value is > 0 if DST is in effect, 0 if it is not and -1 if + // the information is not available (this is compatible with ANSI C) + int IsDST(Country country = Country_Default) const; + + + // accessors: many of them take the timezone parameter which indicates the + // timezone for which to make the calculations and the default value means + // to do it for the current timezone of this machine (even if the function + // only operates with the date it's necessary because a date may wrap as + // result of timezone shift) + // ------------------------------------------------------------------------ + + // is the date valid? + inline bool IsValid() const { return m_time != wxLongLong(wxINT64_MIN); } + + // get the broken down date/time representation in the given timezone + // + // If you wish to get several time components (day, month and year), + // consider getting the whole Tm structure first and retrieving the + // value from it - this is much more efficient + Tm GetTm(const TimeZone& tz = Local) const; + + // get the number of seconds since the Unix epoch - returns (time_t)-1 + // if the value is out of range + inline time_t GetTicks() const; + + // get the century, same as GetCentury(GetYear()) + int GetCentury(const TimeZone& tz = Local) const + { return GetCentury(GetYear(tz)); } + // get the year (returns Inv_Year if date is invalid) + int GetYear(const TimeZone& tz = Local) const + { return GetTm(tz).year; } + // get the month (Inv_Month if date is invalid) + Month GetMonth(const TimeZone& tz = Local) const + { return (Month)GetTm(tz).mon; } + // get the month day (in 1..31 range, 0 if date is invalid) + wxDateTime_t GetDay(const TimeZone& tz = Local) const + { return GetTm(tz).mday; } + // get the day of the week (Inv_WeekDay if date is invalid) + WeekDay GetWeekDay(const TimeZone& tz = Local) const + { return GetTm(tz).GetWeekDay(); } + // get the hour of the day + wxDateTime_t GetHour(const TimeZone& tz = Local) const + { return GetTm(tz).hour; } + // get the minute + wxDateTime_t GetMinute(const TimeZone& tz = Local) const + { return GetTm(tz).min; } + // get the second + wxDateTime_t GetSecond(const TimeZone& tz = Local) const + { return GetTm(tz).sec; } + // get milliseconds + wxDateTime_t GetMillisecond(const TimeZone& tz = Local) const + { return GetTm(tz).msec; } + + // get the day since the year start (1..366, 0 if date is invalid) + wxDateTime_t GetDayOfYear(const TimeZone& tz = Local) const; + // get the week number since the year start (1..52 or 53, 0 if date is + // invalid) + wxDateTime_t GetWeekOfYear(WeekFlags flags = Monday_First, + const TimeZone& tz = Local) const; + // get the year to which the number returned from GetWeekOfYear() + // belongs + int GetWeekBasedYear(const TimeZone& tz = Local) const; + // get the week number since the month start (1..5, 0 if date is + // invalid) + wxDateTime_t GetWeekOfMonth(WeekFlags flags = Monday_First, + const TimeZone& tz = Local) const; + + // is this date a work day? This depends on a country, of course, + // because the holidays are different in different countries + bool IsWorkDay(Country country = Country_Default) const; + + // dos date and time format + // ------------------------------------------------------------------------ + + // set from the DOS packed format + wxDateTime& SetFromDOS(unsigned long ddt); + + // 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) + // ------------------------------------------------------------------------ + + // returns true if the two moments are strictly identical + inline bool IsEqualTo(const wxDateTime& datetime) const; + + // returns true if the date is strictly earlier than the given one + inline bool IsEarlierThan(const wxDateTime& datetime) const; + + // returns true if the date is strictly later than the given one + inline bool IsLaterThan(const wxDateTime& datetime) const; + + // returns true if the date is strictly in the given range + inline bool IsStrictlyBetween(const wxDateTime& t1, + const wxDateTime& t2) const; + + // returns true if the date is in the given range + inline bool IsBetween(const wxDateTime& t1, const wxDateTime& t2) const; + + // do these two objects refer to the same date? + inline bool IsSameDate(const wxDateTime& dt) const; + + // do these two objects have the same time? + inline bool IsSameTime(const wxDateTime& dt) const; + + // are these two objects equal up to given timespan? + inline bool IsEqualUpTo(const wxDateTime& dt, const wxTimeSpan& ts) const; + + inline bool operator<(const wxDateTime& dt) const + { + return GetValue() < dt.GetValue(); + } + + inline bool operator<=(const wxDateTime& dt) const + { + return GetValue() <= dt.GetValue(); + } + + inline bool operator>(const wxDateTime& dt) const + { + return GetValue() > dt.GetValue(); + } + + inline bool operator>=(const wxDateTime& dt) const + { + return GetValue() >= dt.GetValue(); + } + + inline bool operator==(const wxDateTime& dt) const + { + // Intentionally do not call GetValue() here, in order that + // invalid wxDateTimes may be compared for equality + return m_time == dt.m_time; + } + + inline bool operator!=(const wxDateTime& dt) const + { + // As above, don't use GetValue() here. + return m_time != dt.m_time; + } + + // arithmetic with dates (see also below for more operators) + // ------------------------------------------------------------------------ + + // return the sum of the date with a time span (positive or negative) + inline wxDateTime Add(const wxTimeSpan& diff) const; + // add a time span (positive or negative) + inline wxDateTime& Add(const wxTimeSpan& diff); + // add a time span (positive or negative) + inline wxDateTime& operator+=(const wxTimeSpan& diff); + inline wxDateTime operator+(const wxTimeSpan& ts) const + { + wxDateTime dt(*this); + dt.Add(ts); + return dt; + } + + // return the difference of the date with a time span + inline wxDateTime Subtract(const wxTimeSpan& diff) const; + // subtract a time span (positive or negative) + inline wxDateTime& Subtract(const wxTimeSpan& diff); + // subtract a time span (positive or negative) + inline wxDateTime& operator-=(const wxTimeSpan& diff); + inline wxDateTime operator-(const wxTimeSpan& ts) const + { + wxDateTime dt(*this); + dt.Subtract(ts); + return dt; + } + + // return the sum of the date with a date span + inline wxDateTime Add(const wxDateSpan& diff) const; + // add a date span (positive or negative) + wxDateTime& Add(const wxDateSpan& diff); + // add a date span (positive or negative) + inline wxDateTime& operator+=(const wxDateSpan& diff); + inline wxDateTime operator+(const wxDateSpan& ds) const + { + wxDateTime dt(*this); + dt.Add(ds); + return dt; + } + + // return the difference of the date with a date span + inline wxDateTime Subtract(const wxDateSpan& diff) const; + // subtract a date span (positive or negative) + inline wxDateTime& Subtract(const wxDateSpan& diff); + // subtract a date span (positive or negative) + inline wxDateTime& operator-=(const wxDateSpan& diff); + inline wxDateTime operator-(const wxDateSpan& ds) const + { + wxDateTime dt(*this); + dt.Subtract(ds); + return dt; + } + + // return the difference between two dates + inline wxTimeSpan Subtract(const wxDateTime& dt) const; + inline wxTimeSpan operator-(const wxDateTime& dt2) const; + + 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") + 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) + 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, wxASCII_STR(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 + bool ParseDateTime(const wxString& datetime, + wxString::const_iterator *end); + + // parse a string containing the date only in "free" format (less + // flexible than ParseDateTime) + bool ParseDate(const wxString& date, + wxString::const_iterator *end); + + // parse a string containing the time only in "free" format + 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 wxString& format = wxASCII_STR(wxDefaultDateTimeFormat), + const TimeZone& tz = Local) const; + // preferred date representation for the current locale + wxString FormatDate() const { return Format(wxS("%x")); } + // preferred time representation for the current locale + 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(wxS("%Y-%m-%d")); } + // returns the string representing the time in ISO 8601 format + // (HH:MM:SS) + 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 = wxASCII_STR(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 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 = wxASCII_STR(wxDefaultDateTimeFormat), + const wxDateTime& dateDef = wxDefaultDateTime) + { ParseFormat(wxString(date), format, dateDef); } + const char* ParseFormat(const char* date, + const wxString& format = wxASCII_STR(wxDefaultDateTimeFormat), + const wxDateTime& dateDef = wxDefaultDateTime); + const wchar_t* ParseFormat(const wchar_t* date, + const wxString& format = wxASCII_STR(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 + // ------------------------------------------------------------------------ + + // construct from internal representation + wxDateTime(const wxLongLong& time) : m_time(time) { } + + // get the internal representation + inline wxLongLong GetValue() const; + + // a helper function to get the current time_t + static time_t GetTimeNow() { return time(NULL); } + + // another one to get the current time broken down + static struct tm *GetTmNow() + { + static struct tm l_CurrentTime; + return GetTmNow(&l_CurrentTime); + } + + // get current time using thread-safe function + static struct tm *GetTmNow(struct tm *tmstruct); + +private: + // the current country - as it's the same for all program objects (unless + // it runs on a _really_ big cluster system :-), this is a static member: + // see SetCountry() and GetCountry() + static Country ms_country; + + // this constant is used to transform a time_t value to the internal + // representation, as time_t is in seconds and we use milliseconds it's + // fixed to 1000 + static const long TIME_T_FACTOR; + + // returns true if we fall in range in which we can use standard ANSI C + // functions + inline bool IsInStdRange() const; + + // assign the preferred first day of a week to flags, if necessary + void UseEffectiveWeekDayFlags(WeekFlags &flags) const; + + // parse time zone (e.g. "+0100") between [iterator,dateEnd) + bool ParseRFC822TimeZone(wxString::const_iterator* iterator, + const wxString::const_iterator& dateEnd); + + // the internal representation of the time is the amount of milliseconds + // elapsed since the origin which is set by convention to the UNIX/C epoch + // value: the midnight of January 1, 1970 (UTC) + wxLongLong m_time; +}; + +// ---------------------------------------------------------------------------- +// This class contains a difference between 2 wxDateTime values, so it makes +// sense to add it to wxDateTime and it is the result of subtraction of 2 +// objects of that class. See also wxDateSpan. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxTimeSpan +{ +public: + // constructors + // ------------------------------------------------------------------------ + + // return the timespan for the given number of milliseconds + static wxTimeSpan Milliseconds(wxLongLong ms) { return wxTimeSpan(0, 0, 0, ms); } + static wxTimeSpan Millisecond() { return Milliseconds(1); } + + // return the timespan for the given number of seconds + static wxTimeSpan Seconds(wxLongLong sec) { return wxTimeSpan(0, 0, sec); } + static wxTimeSpan Second() { return Seconds(1); } + + // return the timespan for the given number of minutes + static wxTimeSpan Minutes(long min) { return wxTimeSpan(0, min, 0 ); } + static wxTimeSpan Minute() { return Minutes(1); } + + // return the timespan for the given number of hours + static wxTimeSpan Hours(long hours) { return wxTimeSpan(hours, 0, 0); } + static wxTimeSpan Hour() { return Hours(1); } + + // return the timespan for the given number of days + static wxTimeSpan Days(long days) { return Hours(24 * days); } + static wxTimeSpan Day() { return Days(1); } + + // return the timespan for the given number of weeks + static wxTimeSpan Weeks(long days) { return Days(7 * days); } + static wxTimeSpan Week() { return Weeks(1); } + + // default ctor constructs the 0 time span + wxTimeSpan() { } + + // from separate values for each component, date set to 0 (hours are + // not restricted to 0..24 range, neither are minutes, seconds or + // milliseconds) + inline wxTimeSpan(long hours, + long minutes = 0, + wxLongLong seconds = 0, + wxLongLong milliseconds = 0); + + // default copy ctor is ok + + // no dtor + + // arithmetic with time spans (see also below for more operators) + // ------------------------------------------------------------------------ + + // return the sum of two timespans + inline wxTimeSpan Add(const wxTimeSpan& diff) const; + // add two timespans together + inline wxTimeSpan& Add(const wxTimeSpan& diff); + // add two timespans together + wxTimeSpan& operator+=(const wxTimeSpan& diff) { return Add(diff); } + inline wxTimeSpan operator+(const wxTimeSpan& ts) const + { + return wxTimeSpan(GetValue() + ts.GetValue()); + } + + // return the difference of two timespans + inline wxTimeSpan Subtract(const wxTimeSpan& diff) const; + // subtract another timespan + inline wxTimeSpan& Subtract(const wxTimeSpan& diff); + // subtract another timespan + wxTimeSpan& operator-=(const wxTimeSpan& diff) { return Subtract(diff); } + inline wxTimeSpan operator-(const wxTimeSpan& ts) const + { + return wxTimeSpan(GetValue() - ts.GetValue()); + } + + // multiply timespan by a scalar + inline wxTimeSpan Multiply(int n) const; + // multiply timespan by a scalar + inline wxTimeSpan& Multiply(int n); + // multiply timespan by a scalar + wxTimeSpan& operator*=(int n) { return Multiply(n); } + inline wxTimeSpan operator*(int n) const + { + return wxTimeSpan(*this).Multiply(n); + } + + // return this timespan with opposite sign + wxTimeSpan Negate() const { return wxTimeSpan(-GetValue()); } + // negate the value of the timespan + wxTimeSpan& Neg() { m_diff = -GetValue(); return *this; } + // negate the value of the timespan + wxTimeSpan& operator-() { return Neg(); } + + // return the absolute value of the timespan: does _not_ modify the + // object + inline wxTimeSpan Abs() const; + + // there is intentionally no division because we don't want to + // introduce rounding errors in time calculations + + // comparison (see also operator versions below) + // ------------------------------------------------------------------------ + + // is the timespan null? + bool IsNull() const { return m_diff == 0l; } + // returns true if the timespan is null + bool operator!() const { return !IsNull(); } + + // is the timespan positive? + bool IsPositive() const { return m_diff > 0l; } + + // is the timespan negative? + bool IsNegative() const { return m_diff < 0l; } + + // are two timespans equal? + inline bool IsEqualTo(const wxTimeSpan& ts) const; + // compare two timestamps: works with the absolute values, i.e. -2 + // hours is longer than 1 hour. Also, it will return false if the + // timespans are equal in absolute value. + inline bool IsLongerThan(const wxTimeSpan& ts) const; + // 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; + + inline bool operator<(const wxTimeSpan &ts) const + { + return GetValue() < ts.GetValue(); + } + + inline bool operator<=(const wxTimeSpan &ts) const + { + return GetValue() <= ts.GetValue(); + } + + inline bool operator>(const wxTimeSpan &ts) const + { + return GetValue() > ts.GetValue(); + } + + inline bool operator>=(const wxTimeSpan &ts) const + { + return GetValue() >= ts.GetValue(); + } + + inline bool operator==(const wxTimeSpan &ts) const + { + return GetValue() == ts.GetValue(); + } + + inline bool operator!=(const wxTimeSpan &ts) const + { + return GetValue() != ts.GetValue(); + } + + // breaking into days, hours, minutes and seconds + // ------------------------------------------------------------------------ + + // get the max number of weeks in this timespan + inline int GetWeeks() const; + // get the max number of days in this timespan + inline int GetDays() const; + // get the max number of hours in this timespan + inline int GetHours() const; + // get the max number of minutes in this timespan + inline int GetMinutes() const; + // get the max number of seconds in this timespan + inline wxLongLong GetSeconds() const; + // get the number of milliseconds in this timespan + wxLongLong GetMilliseconds() const { return m_diff; } + + // conversion to text + // ------------------------------------------------------------------------ + + // 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. 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 wxString& format = wxASCII_STR(wxDefaultTimeSpanFormat)) const; + + // implementation + // ------------------------------------------------------------------------ + + // construct from internal representation + wxTimeSpan(const wxLongLong& diff) : m_diff(diff) { } + + // get the internal representation + wxLongLong GetValue() const { return m_diff; } + +private: + // the (signed) time span in milliseconds + wxLongLong m_diff; +}; + +// ---------------------------------------------------------------------------- +// This class is a "logical time span" and is useful for implementing program +// logic for such things as "add one month to the date" which, in general, +// doesn't mean to add 60*60*24*31 seconds to it, but to take the same date +// the next month (to understand that this is indeed different consider adding +// one month to Feb, 15 - we want to get Mar, 15, of course). +// +// When adding a month to the date, all lesser components (days, hours, ...) +// won't be changed unless the resulting date would be invalid: for example, +// Jan 31 + 1 month will be Feb 28, not (non existing) Feb 31. +// +// Because of this feature, adding and subtracting back again the same +// wxDateSpan will *not*, in general give back the original date: Feb 28 - 1 +// month will be Jan 28, not Jan 31! +// +// wxDateSpan can be either positive or negative. They may be +// multiplied by scalars which multiply all deltas by the scalar: i.e. 2*(1 +// month and 1 day) is 2 months and 2 days. They can be added together and +// with wxDateTime or wxTimeSpan, but the type of result is different for each +// case. +// +// Beware about weeks: if you specify both weeks and days, the total number of +// days added will be 7*weeks + days! See also GetTotalDays() function. +// +// Equality operators are defined for wxDateSpans. Two datespans are equal if +// they both give the same target date when added to *every* source date. +// Thus wxDateSpan::Months(1) is not equal to wxDateSpan::Days(30), because +// they not give the same date when added to 1 Feb. But wxDateSpan::Days(14) is +// equal to wxDateSpan::Weeks(2) +// +// Finally, notice that for adding hours, minutes &c you don't need this +// class: wxTimeSpan will do the job because there are no subtleties +// associated with those. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxDateSpan +{ +public: + // constructors + // ------------------------------------------------------------------------ + + // this many years/months/weeks/days + wxDateSpan(int years = 0, int months = 0, int weeks = 0, int days = 0) + { + m_years = years; + m_months = months; + m_weeks = weeks; + m_days = days; + } + + // get an object for the given number of days + static wxDateSpan Days(int days) { return wxDateSpan(0, 0, 0, days); } + static wxDateSpan Day() { return Days(1); } + + // get an object for the given number of weeks + static wxDateSpan Weeks(int weeks) { return wxDateSpan(0, 0, weeks, 0); } + static wxDateSpan Week() { return Weeks(1); } + + // get an object for the given number of months + static wxDateSpan Months(int mon) { return wxDateSpan(0, mon, 0, 0); } + static wxDateSpan Month() { return Months(1); } + + // get an object for the given number of years + static wxDateSpan Years(int years) { return wxDateSpan(years, 0, 0, 0); } + static wxDateSpan Year() { return Years(1); } + + // default copy ctor is ok + + // no dtor + + // accessors (all SetXXX() return the (modified) wxDateSpan object) + // ------------------------------------------------------------------------ + + // set number of years + wxDateSpan& SetYears(int n) { m_years = n; return *this; } + // set number of months + wxDateSpan& SetMonths(int n) { m_months = n; return *this; } + // set number of weeks + wxDateSpan& SetWeeks(int n) { m_weeks = n; return *this; } + // set number of days + wxDateSpan& SetDays(int n) { m_days = n; return *this; } + + // get number of years + 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 + int GetDays() const { return m_days; } + // returns 7*GetWeeks() + GetDays() + int GetTotalDays() const { return 7*m_weeks + m_days; } + + // arithmetic with date spans (see also below for more operators) + // ------------------------------------------------------------------------ + + // return sum of two date spans + inline wxDateSpan Add(const wxDateSpan& other) const; + // add another wxDateSpan to us + inline wxDateSpan& Add(const wxDateSpan& other); + // add another wxDateSpan to us + inline wxDateSpan& operator+=(const wxDateSpan& other); + inline wxDateSpan operator+(const wxDateSpan& ds) const + { + return wxDateSpan(GetYears() + ds.GetYears(), + GetMonths() + ds.GetMonths(), + GetWeeks() + ds.GetWeeks(), + GetDays() + ds.GetDays()); + } + + // return difference of two date spans + inline wxDateSpan Subtract(const wxDateSpan& other) const; + // subtract another wxDateSpan from us + inline wxDateSpan& Subtract(const wxDateSpan& other); + // subtract another wxDateSpan from us + inline wxDateSpan& operator-=(const wxDateSpan& other); + inline wxDateSpan operator-(const wxDateSpan& ds) const + { + return wxDateSpan(GetYears() - ds.GetYears(), + GetMonths() - ds.GetMonths(), + GetWeeks() - ds.GetWeeks(), + GetDays() - ds.GetDays()); + } + + // return a copy of this time span with changed sign + inline wxDateSpan Negate() const; + // inverse the sign of this timespan + inline wxDateSpan& Neg(); + // inverse the sign of this timespan + wxDateSpan& operator-() { return Neg(); } + + // return the date span proportional to this one with given factor + inline wxDateSpan Multiply(int factor) const; + // multiply all components by a (signed) number + inline wxDateSpan& Multiply(int factor); + // multiply all components by a (signed) number + inline wxDateSpan& operator*=(int factor) { return Multiply(factor); } + inline wxDateSpan operator*(int n) const + { + return wxDateSpan(*this).Multiply(n); + } + + // ds1 == d2 if and only if for every wxDateTime t t + ds1 == t + ds2 + inline bool operator==(const wxDateSpan& ds) const + { + return GetYears() == ds.GetYears() && + GetMonths() == ds.GetMonths() && + GetTotalDays() == ds.GetTotalDays(); + } + + inline bool operator!=(const wxDateSpan& ds) const + { + return !(*this == ds); + } + +private: + int m_years, + m_months, + m_weeks, + m_days; +}; + +// ---------------------------------------------------------------------------- +// wxDateTimeArray: array of dates. +// ---------------------------------------------------------------------------- + +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxDateTime, wxDateTimeArray, WXDLLIMPEXP_BASE); + +// ---------------------------------------------------------------------------- +// wxDateTimeHolidayAuthority: an object of this class will decide whether a +// given date is a holiday and is used by all functions working with "work +// days". +// +// NB: the base class is an ABC, derived classes must implement the pure +// virtual methods to work with the holidays they correspond to. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_BASE wxDateTimeHolidayAuthority; +WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxDateTimeHolidayAuthority *, + wxHolidayAuthoritiesArray, + class WXDLLIMPEXP_BASE); + +class wxDateTimeHolidaysModule; +class WXDLLIMPEXP_BASE wxDateTimeHolidayAuthority +{ +friend class wxDateTimeHolidaysModule; +public: + // returns true if the given date is a holiday + static bool IsHoliday(const wxDateTime& dt); + + // fills the provided array with all holidays in the given range, returns + // the number of them + static size_t GetHolidaysInRange(const wxDateTime& dtStart, + const wxDateTime& dtEnd, + wxDateTimeArray& holidays); + + // clear the list of holiday authorities + static void ClearAllAuthorities(); + + // add a new holiday authority (the pointer will be deleted by + // wxDateTimeHolidayAuthority) + static void AddAuthority(wxDateTimeHolidayAuthority *auth); + + // the base class must have a virtual dtor + virtual ~wxDateTimeHolidayAuthority(); + +protected: + // this function is called to determine whether a given day is a holiday + virtual bool DoIsHoliday(const wxDateTime& dt) const = 0; + + // this function should fill the array with all holidays between the two + // given dates - it is implemented in the base class, but in a very + // inefficient way (it just iterates over all days and uses IsHoliday() for + // each of them), so it must be overridden in the derived class where the + // base class version may be explicitly used if needed + // + // returns the number of holidays in the given range and fills holidays + // array + virtual size_t DoGetHolidaysInRange(const wxDateTime& dtStart, + const wxDateTime& dtEnd, + wxDateTimeArray& holidays) const = 0; + +private: + // all holiday authorities + static wxHolidayAuthoritiesArray ms_authorities; +}; + +// the holidays for this class are all Saturdays and Sundays +class WXDLLIMPEXP_BASE wxDateTimeWorkDays : public wxDateTimeHolidayAuthority +{ +protected: + virtual bool DoIsHoliday(const wxDateTime& dt) const wxOVERRIDE; + virtual size_t DoGetHolidaysInRange(const wxDateTime& dtStart, + const wxDateTime& dtEnd, + wxDateTimeArray& holidays) const wxOVERRIDE; +}; + +// ============================================================================ +// inline functions implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// private macros +// ---------------------------------------------------------------------------- + +#define MILLISECONDS_PER_DAY 86400000l + +// some broken compilers (HP-UX CC) refuse to compile the "normal" version, but +// using a temp variable always might prevent other compilers from optimising +// it away - hence use of this ugly macro +#ifndef __HPUX__ + #define MODIFY_AND_RETURN(op) return wxDateTime(*this).op +#else + #define MODIFY_AND_RETURN(op) wxDateTime dt(*this); dt.op; return dt +#endif + +// ---------------------------------------------------------------------------- +// wxDateTime construction +// ---------------------------------------------------------------------------- + +inline bool wxDateTime::IsInStdRange() const +{ + // if sizeof(time_t) is greater than 32 bits, we assume it + // is safe to return values exceeding wxINT32_MAX + + return m_time >= 0l && + ( (sizeof(time_t) > 4 ) || ( (m_time / TIME_T_FACTOR) < wxINT32_MAX) ); +} + +/* static */ +inline wxDateTime wxDateTime::Now() +{ + struct tm tmstruct; + return wxDateTime(*GetTmNow(&tmstruct)); +} + +/* static */ +inline wxDateTime wxDateTime::Today() +{ + wxDateTime dt(Now()); + dt.ResetTime(); + + return dt; +} + +inline wxDateTime& wxDateTime::Set(time_t timet) +{ + 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; +} + +inline wxDateTime& wxDateTime::SetToCurrent() +{ + *this = Now(); + return *this; +} + +inline wxDateTime::wxDateTime(time_t timet) +{ + Set(timet); +} + +inline wxDateTime::wxDateTime(const struct tm& tm) +{ + Set(tm); +} + +inline wxDateTime::wxDateTime(const Tm& tm) +{ + Set(tm); +} + +inline wxDateTime::wxDateTime(double jdn) +{ + Set(jdn); +} + +inline wxDateTime& wxDateTime::Set(const Tm& tm) +{ + wxASSERT_MSG( tm.IsValid(), wxT("invalid broken down date/time") ); + + return Set(tm.mday, (Month)tm.mon, tm.year, + tm.hour, tm.min, tm.sec, tm.msec); +} + +inline wxDateTime::wxDateTime(wxDateTime_t hour, + wxDateTime_t minute, + wxDateTime_t second, + wxDateTime_t millisec) +{ + Set(hour, minute, second, millisec); +} + +inline wxDateTime::wxDateTime(wxDateTime_t day, + Month month, + int year, + wxDateTime_t hour, + wxDateTime_t minute, + wxDateTime_t second, + wxDateTime_t millisec) +{ + Set(day, month, year, hour, minute, second, millisec); +} + +// ---------------------------------------------------------------------------- +// wxDateTime accessors +// ---------------------------------------------------------------------------- + +inline wxLongLong wxDateTime::GetValue() const +{ + wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime")); + + return m_time; +} + +inline time_t wxDateTime::GetTicks() const +{ + wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime")); + if ( !IsInStdRange() ) + { + return (time_t)-1; + } + + return (time_t)((m_time / TIME_T_FACTOR).GetValue()) + WX_TIME_BASE_OFFSET; +} + +inline bool wxDateTime::SetToLastWeekDay(WeekDay weekday, + Month month, + int year) +{ + return SetToWeekDay(weekday, -1, month, year); +} + +inline wxDateTime +wxDateTime::GetWeekDayInSameWeek(WeekDay weekday, + WeekFlags WXUNUSED(flags)) const +{ + MODIFY_AND_RETURN( SetToWeekDayInSameWeek(weekday) ); +} + +inline wxDateTime wxDateTime::GetNextWeekDay(WeekDay weekday) const +{ + MODIFY_AND_RETURN( SetToNextWeekDay(weekday) ); +} + +inline wxDateTime wxDateTime::GetPrevWeekDay(WeekDay weekday) const +{ + MODIFY_AND_RETURN( SetToPrevWeekDay(weekday) ); +} + +inline wxDateTime wxDateTime::GetWeekDay(WeekDay weekday, + int n, + Month month, + int year) const +{ + wxDateTime dt(*this); + + return dt.SetToWeekDay(weekday, n, month, year) ? dt : wxInvalidDateTime; +} + +inline wxDateTime wxDateTime::GetLastWeekDay(WeekDay weekday, + Month month, + int year) +{ + wxDateTime dt(*this); + + return dt.SetToLastWeekDay(weekday, month, year) ? dt : wxInvalidDateTime; +} + +inline wxDateTime wxDateTime::GetLastMonthDay(Month month, int year) const +{ + MODIFY_AND_RETURN( SetToLastMonthDay(month, year) ); +} + +inline wxDateTime wxDateTime::GetYearDay(wxDateTime_t yday) const +{ + MODIFY_AND_RETURN( SetToYearDay(yday) ); +} + +// ---------------------------------------------------------------------------- +// wxDateTime comparison +// ---------------------------------------------------------------------------- + +inline bool wxDateTime::IsEqualTo(const wxDateTime& datetime) const +{ + return *this == datetime; +} + +inline bool wxDateTime::IsEarlierThan(const wxDateTime& datetime) const +{ + return *this < datetime; +} + +inline bool wxDateTime::IsLaterThan(const wxDateTime& datetime) const +{ + return *this > datetime; +} + +inline bool wxDateTime::IsStrictlyBetween(const wxDateTime& t1, + const wxDateTime& t2) const +{ + // no need for assert, will be checked by the functions we call + return IsLaterThan(t1) && IsEarlierThan(t2); +} + +inline bool wxDateTime::IsBetween(const wxDateTime& t1, + const wxDateTime& t2) const +{ + // no need for assert, will be checked by the functions we call + return IsEqualTo(t1) || IsEqualTo(t2) || IsStrictlyBetween(t1, t2); +} + +inline bool wxDateTime::IsSameDate(const wxDateTime& dt) const +{ + Tm tm1 = GetTm(), + tm2 = dt.GetTm(); + + return tm1.year == tm2.year && + tm1.mon == tm2.mon && + tm1.mday == tm2.mday; +} + +inline bool wxDateTime::IsSameTime(const wxDateTime& dt) const +{ + // notice that we can't do something like this: + // + // m_time % MILLISECONDS_PER_DAY == dt.m_time % MILLISECONDS_PER_DAY + // + // because we have also to deal with (possibly) different DST settings! + Tm tm1 = GetTm(), + tm2 = dt.GetTm(); + + return tm1.hour == tm2.hour && + tm1.min == tm2.min && + tm1.sec == tm2.sec && + tm1.msec == tm2.msec; +} + +inline bool wxDateTime::IsEqualUpTo(const wxDateTime& dt, + const wxTimeSpan& ts) const +{ + return IsBetween(dt.Subtract(ts), dt.Add(ts)); +} + +// ---------------------------------------------------------------------------- +// wxDateTime arithmetic +// ---------------------------------------------------------------------------- + +inline wxDateTime wxDateTime::Add(const wxTimeSpan& diff) const +{ + wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime")); + + return wxDateTime(m_time + diff.GetValue()); +} + +inline wxDateTime& wxDateTime::Add(const wxTimeSpan& diff) +{ + wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime")); + + m_time += diff.GetValue(); + + return *this; +} + +inline wxDateTime& wxDateTime::operator+=(const wxTimeSpan& diff) +{ + return Add(diff); +} + +inline wxDateTime wxDateTime::Subtract(const wxTimeSpan& diff) const +{ + wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime")); + + return wxDateTime(m_time - diff.GetValue()); +} + +inline wxDateTime& wxDateTime::Subtract(const wxTimeSpan& diff) +{ + wxASSERT_MSG( IsValid(), wxT("invalid wxDateTime")); + + m_time -= diff.GetValue(); + + return *this; +} + +inline wxDateTime& wxDateTime::operator-=(const wxTimeSpan& diff) +{ + return Subtract(diff); +} + +inline wxTimeSpan wxDateTime::Subtract(const wxDateTime& datetime) const +{ + wxASSERT_MSG( IsValid() && datetime.IsValid(), wxT("invalid wxDateTime")); + + return wxTimeSpan(GetValue() - datetime.GetValue()); +} + +inline wxTimeSpan wxDateTime::operator-(const wxDateTime& dt2) const +{ + return this->Subtract(dt2); +} + +inline wxDateTime wxDateTime::Add(const wxDateSpan& diff) const +{ + return wxDateTime(*this).Add(diff); +} + +inline wxDateTime& wxDateTime::Subtract(const wxDateSpan& diff) +{ + return Add(diff.Negate()); +} + +inline wxDateTime wxDateTime::Subtract(const wxDateSpan& diff) const +{ + return wxDateTime(*this).Subtract(diff); +} + +inline wxDateTime& wxDateTime::operator-=(const wxDateSpan& diff) +{ + return Subtract(diff); +} + +inline wxDateTime& wxDateTime::operator+=(const wxDateSpan& diff) +{ + return Add(diff); +} + +// ---------------------------------------------------------------------------- +// wxDateTime and timezones +// ---------------------------------------------------------------------------- + +inline wxDateTime +wxDateTime::ToTimezone(const wxDateTime::TimeZone& tz, bool noDST) const +{ + MODIFY_AND_RETURN( MakeTimezone(tz, noDST) ); +} + +inline wxDateTime +wxDateTime::FromTimezone(const wxDateTime::TimeZone& tz, bool noDST) const +{ + MODIFY_AND_RETURN( MakeFromTimezone(tz, noDST) ); +} + +// ---------------------------------------------------------------------------- +// wxTimeSpan construction +// ---------------------------------------------------------------------------- + +inline wxTimeSpan::wxTimeSpan(long hours, + long minutes, + wxLongLong seconds, + wxLongLong milliseconds) +{ + // assign first to avoid precision loss + m_diff = hours; + m_diff *= 60l; + m_diff += minutes; + m_diff *= 60l; + m_diff += seconds; + m_diff *= 1000l; + m_diff += milliseconds; +} + +// ---------------------------------------------------------------------------- +// wxTimeSpan accessors +// ---------------------------------------------------------------------------- + +inline wxLongLong wxTimeSpan::GetSeconds() const +{ + return m_diff / 1000l; +} + +inline int wxTimeSpan::GetMinutes() const +{ + // For compatibility, this method (and the other accessors) return int, + // even though GetLo() actually returns unsigned long with greater range. + return static_cast((GetSeconds() / 60l).GetLo()); +} + +inline int wxTimeSpan::GetHours() const +{ + return GetMinutes() / 60; +} + +inline int wxTimeSpan::GetDays() const +{ + return GetHours() / 24; +} + +inline int wxTimeSpan::GetWeeks() const +{ + return GetDays() / 7; +} + +// ---------------------------------------------------------------------------- +// wxTimeSpan arithmetic +// ---------------------------------------------------------------------------- + +inline wxTimeSpan wxTimeSpan::Add(const wxTimeSpan& diff) const +{ + return wxTimeSpan(m_diff + diff.GetValue()); +} + +inline wxTimeSpan& wxTimeSpan::Add(const wxTimeSpan& diff) +{ + m_diff += diff.GetValue(); + + return *this; +} + +inline wxTimeSpan wxTimeSpan::Subtract(const wxTimeSpan& diff) const +{ + return wxTimeSpan(m_diff - diff.GetValue()); +} + +inline wxTimeSpan& wxTimeSpan::Subtract(const wxTimeSpan& diff) +{ + m_diff -= diff.GetValue(); + + return *this; +} + +inline wxTimeSpan& wxTimeSpan::Multiply(int n) +{ + m_diff *= (long)n; + + return *this; +} + +inline wxTimeSpan wxTimeSpan::Multiply(int n) const +{ + return wxTimeSpan(m_diff * (long)n); +} + +inline wxTimeSpan wxTimeSpan::Abs() const +{ + return wxTimeSpan(GetValue().Abs()); +} + +inline bool wxTimeSpan::IsEqualTo(const wxTimeSpan& ts) const +{ + return GetValue() == ts.GetValue(); +} + +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 +// ---------------------------------------------------------------------------- + +inline wxDateSpan& wxDateSpan::operator+=(const wxDateSpan& other) +{ + m_years += other.m_years; + m_months += other.m_months; + m_weeks += other.m_weeks; + m_days += other.m_days; + + return *this; +} + +inline wxDateSpan& wxDateSpan::Add(const wxDateSpan& other) +{ + return *this += other; +} + +inline wxDateSpan wxDateSpan::Add(const wxDateSpan& other) const +{ + wxDateSpan ds(*this); + ds.Add(other); + return ds; +} + +inline wxDateSpan& wxDateSpan::Multiply(int factor) +{ + m_years *= factor; + m_months *= factor; + m_weeks *= factor; + m_days *= factor; + + return *this; +} + +inline wxDateSpan wxDateSpan::Multiply(int factor) const +{ + wxDateSpan ds(*this); + ds.Multiply(factor); + return ds; +} + +inline wxDateSpan wxDateSpan::Negate() const +{ + return wxDateSpan(-m_years, -m_months, -m_weeks, -m_days); +} + +inline wxDateSpan& wxDateSpan::Neg() +{ + m_years = -m_years; + m_months = -m_months; + m_weeks = -m_weeks; + m_days = -m_days; + + return *this; +} + +inline wxDateSpan& wxDateSpan::operator-=(const wxDateSpan& other) +{ + return *this += other.Negate(); +} + +inline wxDateSpan& wxDateSpan::Subtract(const wxDateSpan& other) +{ + return *this -= other; +} + +inline wxDateSpan wxDateSpan::Subtract(const wxDateSpan& other) const +{ + wxDateSpan ds(*this); + ds.Subtract(other); + return ds; +} + +#undef MILLISECONDS_PER_DAY + +#undef MODIFY_AND_RETURN + +// ============================================================================ +// binary operators +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxTimeSpan operators +// ---------------------------------------------------------------------------- + +wxTimeSpan WXDLLIMPEXP_BASE operator*(int n, const wxTimeSpan& ts); + +// ---------------------------------------------------------------------------- +// wxDateSpan +// ---------------------------------------------------------------------------- + +wxDateSpan WXDLLIMPEXP_BASE operator*(int n, const wxDateSpan& ds); + +// ============================================================================ +// other helper functions +// ============================================================================ + +// ---------------------------------------------------------------------------- +// iteration helpers: can be used to write a for loop over enum variable like +// this: +// for ( m = wxDateTime::Jan; m < wxDateTime::Inv_Month; wxNextMonth(m) ) +// ---------------------------------------------------------------------------- + +WXDLLIMPEXP_BASE void wxNextMonth(wxDateTime::Month& m); +WXDLLIMPEXP_BASE void wxPrevMonth(wxDateTime::Month& m); +WXDLLIMPEXP_BASE void wxNextWDay(wxDateTime::WeekDay& wd); +WXDLLIMPEXP_BASE void wxPrevWDay(wxDateTime::WeekDay& wd); + +#endif // wxUSE_DATETIME + +#endif // _WX_DATETIME_H diff --git a/lib/wxWidgets/include/wx/datetimectrl.h b/lib/wxWidgets/include/wx/datetimectrl.h new file mode 100644 index 0000000..29cff3c --- /dev/null +++ b/lib/wxWidgets/include/wx/datetimectrl.h @@ -0,0 +1,54 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/timectrl.h +// Purpose: Declaration of wxDateTimePickerCtrl class. +// Author: Vadim Zeitlin +// Created: 2011-09-22 +// Copyright: (c) 2011 Vadim Zeitlin +// 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; + + // For the controls with wxDP_ALLOWNONE style, set the string displayed + // when the control doesn't have any valid value. Currently this is only + // actually used under MSW, where it can be used to override the previous + // value which is still displayed by the control in this case, and ignored + // elsewhere. + virtual void SetNullText(const wxString& WXUNUSED(text)) { } +}; + +#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_ diff --git a/lib/wxWidgets/include/wx/datstrm.h b/lib/wxWidgets/include/wx/datstrm.h new file mode 100644 index 0000000..477da30 --- /dev/null +++ b/lib/wxWidgets/include/wx/datstrm.h @@ -0,0 +1,204 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/datstrm.h +// Purpose: Data stream classes +// Author: Guilhem Lavaux +// Modified by: Mickael Gilabert +// Created: 28/06/1998 +// Copyright: (c) Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DATSTREAM_H_ +#define _WX_DATSTREAM_H_ + +#include "wx/stream.h" +#include "wx/longlong.h" +#include "wx/convauto.h" + +#if wxUSE_STREAMS + +// 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 + void SetConv( const wxMBConv &conv ); + wxMBConv *GetConv() const { return m_conv; } +#endif + +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(); } + +#if wxHAS_INT64 + wxUint64 Read64(); +#endif +#if wxUSE_LONGLONG + wxLongLong ReadLL(); +#endif + wxUint32 Read32(); + wxUint16 Read16(); + wxUint8 Read8(); + double ReadDouble(); + float ReadFloat(); + wxString ReadString(); + +#if wxHAS_INT64 + void Read64(wxUint64 *buffer, size_t size); + void Read64(wxInt64 *buffer, size_t size); +#endif +#if defined(wxLongLong_t) && wxUSE_LONGLONG + void Read64(wxULongLong *buffer, size_t size); + void Read64(wxLongLong *buffer, size_t size); +#endif +#if wxUSE_LONGLONG + void ReadLL(wxULongLong *buffer, size_t size); + void ReadLL(wxLongLong *buffer, size_t size); +#endif + void Read32(wxUint32 *buffer, size_t size); + 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); + wxDataInputStream& operator>>(wxInt16& i); + wxDataInputStream& operator>>(wxInt32& i); + wxDataInputStream& operator>>(wxUint8& c); + wxDataInputStream& operator>>(wxUint16& i); + wxDataInputStream& operator>>(wxUint32& i); +#if wxHAS_INT64 + wxDataInputStream& operator>>(wxUint64& i); + wxDataInputStream& operator>>(wxInt64& i); +#endif +#if defined(wxLongLong_t) && wxUSE_LONGLONG + wxDataInputStream& operator>>(wxULongLong& i); + wxDataInputStream& operator>>(wxLongLong& i); +#endif + wxDataInputStream& operator>>(double& d); + wxDataInputStream& operator>>(float& f); + +protected: + wxInputStream *m_input; + + wxDECLARE_NO_COPY_CLASS(wxDataInputStream); +}; + +class WXDLLIMPEXP_BASE wxDataOutputStream : public wxDataStreamBase +{ +public: + wxDataOutputStream(wxOutputStream& s, const wxMBConv& conv = wxConvUTF8); + + bool IsOk() { return m_output->IsOk(); } + +#if wxHAS_INT64 + void Write64(wxUint64 i); + void Write64(wxInt64 i); +#endif +#if wxUSE_LONGLONG + void WriteLL(const wxLongLong &ll); + void WriteLL(const wxULongLong &ll); +#endif + void Write32(wxUint32 i); + void Write16(wxUint16 i); + void Write8(wxUint8 i); + void WriteDouble(double d); + void WriteFloat(float f); + void WriteString(const wxString& string); + +#if wxHAS_INT64 + void Write64(const wxUint64 *buffer, size_t size); + void Write64(const wxInt64 *buffer, size_t size); +#endif +#if defined(wxLongLong_t) && wxUSE_LONGLONG + void Write64(const wxULongLong *buffer, size_t size); + void Write64(const wxLongLong *buffer, size_t size); +#endif +#if wxUSE_LONGLONG + void WriteLL(const wxULongLong *buffer, size_t size); + void WriteLL(const wxLongLong *buffer, size_t size); +#endif + void Write32(const wxUint32 *buffer, size_t size); + 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 wxString& string); + wxDataOutputStream& operator<<(wxInt8 c); + wxDataOutputStream& operator<<(wxInt16 i); + wxDataOutputStream& operator<<(wxInt32 i); + wxDataOutputStream& operator<<(wxUint8 c); + wxDataOutputStream& operator<<(wxUint16 i); + wxDataOutputStream& operator<<(wxUint32 i); +#if wxHAS_INT64 + wxDataOutputStream& operator<<(wxUint64 i); + wxDataOutputStream& operator<<(wxInt64 i); +#endif +#if defined(wxLongLong_t) && wxUSE_LONGLONG + wxDataOutputStream& operator<<(const wxULongLong &i); + wxDataOutputStream& operator<<(const wxLongLong &i); +#endif + wxDataOutputStream& operator<<(double d); + wxDataOutputStream& operator<<(float f); + +protected: + wxOutputStream *m_output; + + wxDECLARE_NO_COPY_CLASS(wxDataOutputStream); +}; + +#endif + // wxUSE_STREAMS + +#endif + // _WX_DATSTREAM_H_ diff --git a/lib/wxWidgets/include/wx/dc.h b/lib/wxWidgets/include/wx/dc.h new file mode 100644 index 0000000..10872f0 --- /dev/null +++ b/lib/wxWidgets/include/wx/dc.h @@ -0,0 +1,1693 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dc.h +// Purpose: wxDC class +// Author: Vadim Zeitlin +// Modified by: +// Created: 05/25/99 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DC_H_BASE_ +#define _WX_DC_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers which we must include here +// ---------------------------------------------------------------------------- + +#include "wx/object.h" // the base class + +#include "wx/intl.h" // for wxLayoutDirection +#include "wx/colour.h" // we have member variables of these classes +#include "wx/font.h" // so we can't do without them +#include "wx/bitmap.h" // for wxNullBitmap +#include "wx/brush.h" +#include "wx/pen.h" +#include "wx/palette.h" +#include "wx/dynarray.h" +#include "wx/math.h" +#include "wx/image.h" +#include "wx/region.h" +#include "wx/affinematrix2d.h" + +#define wxUSE_NEW_DC 1 + +class WXDLLIMPEXP_FWD_CORE wxDC; +class WXDLLIMPEXP_FWD_CORE wxClientDC; +class WXDLLIMPEXP_FWD_CORE wxPaintDC; +class WXDLLIMPEXP_FWD_CORE wxWindowDC; +class WXDLLIMPEXP_FWD_CORE wxScreenDC; +class WXDLLIMPEXP_FWD_CORE wxMemoryDC; +class WXDLLIMPEXP_FWD_CORE wxPrinterDC; +class WXDLLIMPEXP_FWD_CORE wxPrintData; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +#if wxUSE_GRAPHICS_CONTEXT +class WXDLLIMPEXP_FWD_CORE wxGraphicsContext; +#endif + +// Logical ops +enum wxRasterOperationMode +{ + wxCLEAR, // 0 + wxXOR, // src XOR dst + wxINVERT, // NOT dst + wxOR_REVERSE, // src OR (NOT dst) + wxAND_REVERSE, // src AND (NOT dst) + wxCOPY, // src + wxAND, // src AND dst + wxAND_INVERT, // (NOT src) AND dst + wxNO_OP, // dst + wxNOR, // (NOT src) AND (NOT dst) + wxEQUIV, // (NOT src) XOR dst + wxSRC_INVERT, // (NOT src) + wxOR_INVERT, // (NOT src) OR dst + wxNAND, // (NOT src) OR (NOT dst) + wxOR, // src OR dst + wxSET // 1 +#if WXWIN_COMPATIBILITY_2_8 + ,wxROP_BLACK = wxCLEAR, + wxBLIT_BLACKNESS = wxCLEAR, + wxROP_XORPEN = wxXOR, + wxBLIT_SRCINVERT = wxXOR, + wxROP_NOT = wxINVERT, + wxBLIT_DSTINVERT = wxINVERT, + wxROP_MERGEPENNOT = wxOR_REVERSE, + wxBLIT_00DD0228 = wxOR_REVERSE, + wxROP_MASKPENNOT = wxAND_REVERSE, + wxBLIT_SRCERASE = wxAND_REVERSE, + wxROP_COPYPEN = wxCOPY, + wxBLIT_SRCCOPY = wxCOPY, + wxROP_MASKPEN = wxAND, + wxBLIT_SRCAND = wxAND, + wxROP_MASKNOTPEN = wxAND_INVERT, + wxBLIT_00220326 = wxAND_INVERT, + wxROP_NOP = wxNO_OP, + wxBLIT_00AA0029 = wxNO_OP, + wxROP_NOTMERGEPEN = wxNOR, + wxBLIT_NOTSRCERASE = wxNOR, + wxROP_NOTXORPEN = wxEQUIV, + wxBLIT_00990066 = wxEQUIV, + wxROP_NOTCOPYPEN = wxSRC_INVERT, + wxBLIT_NOTSCRCOPY = wxSRC_INVERT, + wxROP_MERGENOTPEN = wxOR_INVERT, + wxBLIT_MERGEPAINT = wxOR_INVERT, + wxROP_NOTMASKPEN = wxNAND, + wxBLIT_007700E6 = wxNAND, + wxROP_MERGEPEN = wxOR, + wxBLIT_SRCPAINT = wxOR, + wxROP_WHITE = wxSET, + wxBLIT_WHITENESS = wxSET +#endif //WXWIN_COMPATIBILITY_2_8 +}; + +// Flood styles +enum wxFloodFillStyle +{ + wxFLOOD_SURFACE = 1, + wxFLOOD_BORDER +}; + +// Mapping modes +enum wxMappingMode +{ + wxMM_TEXT = 1, + wxMM_METRIC, + wxMM_LOMETRIC, + wxMM_TWIPS, + wxMM_POINTS +}; + +// Description of text characteristics. +struct wxFontMetrics +{ + wxFontMetrics() + { + height = + ascent = + descent = + internalLeading = + externalLeading = + averageWidth = 0; + } + + int height, // Total character height. + ascent, // Part of the height above the baseline. + descent, // Part of the height below the baseline. + internalLeading, // Intra-line spacing. + externalLeading, // Inter-line spacing. + averageWidth; // Average font width, a.k.a. "x-width". +}; + +#if WXWIN_COMPATIBILITY_2_8 + +//----------------------------------------------------------------------------- +// wxDrawObject helper class +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDrawObject +{ +public: + wxDEPRECATED_CONSTRUCTOR(wxDrawObject)() + : m_isBBoxValid(false) + , m_minX(0), m_minY(0), m_maxX(0), m_maxY(0) + { } + + virtual ~wxDrawObject() { } + + virtual void Draw(wxDC&) const { } + + virtual void CalcBoundingBox(wxCoord x, wxCoord y) + { + if ( m_isBBoxValid ) + { + if ( x < m_minX ) m_minX = x; + if ( y < m_minY ) m_minY = y; + if ( x > m_maxX ) m_maxX = x; + if ( y > m_maxY ) m_maxY = y; + } + else + { + m_isBBoxValid = true; + + m_minX = x; + m_minY = y; + m_maxX = x; + m_maxY = y; + } + } + + void ResetBoundingBox() + { + m_isBBoxValid = false; + + m_minX = m_maxX = m_minY = m_maxY = 0; + } + + // Get the final bounding box of the PostScript or Metafile picture. + + wxCoord MinX() const { return m_minX; } + wxCoord MaxX() const { return m_maxX; } + wxCoord MinY() const { return m_minY; } + wxCoord MaxY() const { return m_maxY; } + + //to define the type of object for derived objects + virtual int GetType()=0; + +protected: + //for boundingbox calculation + bool m_isBBoxValid:1; + //for boundingbox calculation + wxCoord m_minX, m_minY, m_maxX, m_maxY; +}; + +#endif // WXWIN_COMPATIBILITY_2_8 + + +//----------------------------------------------------------------------------- +// wxDCFactory +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxDCImpl; + +class WXDLLIMPEXP_CORE wxDCFactory +{ +public: + wxDCFactory() {} + virtual ~wxDCFactory() {} + + virtual wxDCImpl* CreateWindowDC( wxWindowDC *owner, wxWindow *window ) = 0; + virtual wxDCImpl* CreateClientDC( wxClientDC *owner, wxWindow *window ) = 0; + virtual wxDCImpl* CreatePaintDC( wxPaintDC *owner, wxWindow *window ) = 0; + virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner ) = 0; + virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxBitmap &bitmap ) = 0; + virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxDC *dc ) = 0; + virtual wxDCImpl* CreateScreenDC( wxScreenDC *owner ) = 0; +#if wxUSE_PRINTING_ARCHITECTURE + virtual wxDCImpl* CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data ) = 0; +#endif + + static void Set(wxDCFactory *factory); + static wxDCFactory *Get(); + +private: + static wxDCFactory *m_factory; +}; + +//----------------------------------------------------------------------------- +// wxNativeDCFactory +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxNativeDCFactory: public wxDCFactory +{ +public: + wxNativeDCFactory() {} + + virtual wxDCImpl* CreateWindowDC( wxWindowDC *owner, wxWindow *window ) wxOVERRIDE; + virtual wxDCImpl* CreateClientDC( wxClientDC *owner, wxWindow *window ) wxOVERRIDE; + virtual wxDCImpl* CreatePaintDC( wxPaintDC *owner, wxWindow *window ) wxOVERRIDE; + virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner ) wxOVERRIDE; + virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxBitmap &bitmap ) wxOVERRIDE; + virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxDC *dc ) wxOVERRIDE; + virtual wxDCImpl* CreateScreenDC( wxScreenDC *owner ) wxOVERRIDE; +#if wxUSE_PRINTING_ARCHITECTURE + virtual wxDCImpl* CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data ) wxOVERRIDE; +#endif +}; + +//----------------------------------------------------------------------------- +// wxDCImpl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDCImpl: public wxObject +{ +public: + wxDCImpl( wxDC *owner ); + virtual ~wxDCImpl(); + + wxDC *GetOwner() const { return m_owner; } + + wxWindow* GetWindow() const { return m_window; } + + void SetWindow(wxWindow* w) { m_window = w; } + + virtual bool IsOk() const { return m_ok; } + + // query capabilities + + virtual bool CanDrawBitmap() const = 0; + virtual bool CanGetTextExtent() const = 0; + + // get Cairo context + virtual void* GetCairoContext() const + { + return NULL; + } + + virtual void* GetHandle() const { return NULL; } + + // query dimension, colour deps, resolution + + virtual void DoGetSize(int *width, int *height) const = 0; + void GetSize(int *width, int *height) const + { + DoGetSize(width, height); + } + + wxSize GetSize() const + { + int w, h; + DoGetSize(&w, &h); + return wxSize(w, h); + } + + virtual void DoGetSizeMM(int* width, int* height) const = 0; + + virtual int GetDepth() const = 0; + virtual wxSize GetPPI() const = 0; + + // Right-To-Left (RTL) modes + + virtual void SetLayoutDirection(wxLayoutDirection WXUNUSED(dir)) { } + virtual wxLayoutDirection GetLayoutDirection() const { return wxLayout_Default; } + + // page and document + + virtual bool StartDoc(const wxString& WXUNUSED(message)) { return true; } + virtual void EndDoc() { } + + virtual void StartPage() { } + virtual void EndPage() { } + + // flushing the content of this dc immediately eg onto screen + virtual void Flush() { } + + // coordinates conversions and transforms + virtual wxPoint DeviceToLogical(wxCoord x, wxCoord y) const; + virtual wxPoint LogicalToDevice(wxCoord x, wxCoord y) const; + virtual wxSize DeviceToLogicalRel(int x, int y) const; + virtual wxSize LogicalToDeviceRel(int x, int y) const; + + // bounding box + + virtual void CalcBoundingBox(wxCoord x, wxCoord y) + { + // Bounding box is internally stored in device units. + wxPoint ptDev = LogicalToDevice(x, y); + x = ptDev.x; + y = ptDev.y; + if ( m_isBBoxValid ) + { + if ( x < m_minX ) m_minX = x; + if ( y < m_minY ) m_minY = y; + if ( x > m_maxX ) m_maxX = x; + if ( y > m_maxY ) m_maxY = y; + } + else + { + m_isBBoxValid = true; + + m_minX = x; + m_minY = y; + m_maxX = x; + m_maxY = y; + } + } + + void CalcBoundingBox(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) + { + CalcBoundingBox(x1, y1); + CalcBoundingBox(x2, y2); + } + + void CalcBoundingBox(const wxPoint& pt, const wxSize& sz) + { + CalcBoundingBox(pt.x, pt.y, pt.x + sz.x, pt.y + sz.y); + } + + void CalcBoundingBox(const wxRect& rect) + { + CalcBoundingBox(rect.GetPosition(), rect.GetSize()); + } + + void ResetBoundingBox() + { + m_isBBoxValid = false; + + m_minX = m_maxX = m_minY = m_maxY = 0; + } + + // Get bounding box in logical units. + wxCoord MinX() const { return m_isBBoxValid ? DeviceToLogical(m_minX, m_minY).x : 0; } + wxCoord MaxX() const { return m_isBBoxValid ? DeviceToLogical(m_maxX, m_maxY).x : 0; } + wxCoord MinY() const { return m_isBBoxValid ? DeviceToLogical(m_minX, m_minY).y : 0; } + wxCoord MaxY() const { return m_isBBoxValid ? DeviceToLogical(m_maxX, m_maxY).y : 0; } + + // setters and getters + + virtual void SetFont(const wxFont& font) = 0; + virtual const wxFont& GetFont() const { return m_font; } + + virtual void SetPen(const wxPen& pen) = 0; + virtual const wxPen& GetPen() const { return m_pen; } + + virtual void SetBrush(const wxBrush& brush) = 0; + virtual const wxBrush& GetBrush() const { return m_brush; } + + virtual void SetBackground(const wxBrush& brush) = 0; + virtual const wxBrush& GetBackground() const { return m_backgroundBrush; } + + virtual void SetBackgroundMode(int mode) = 0; + virtual int GetBackgroundMode() const { return m_backgroundMode; } + + virtual void SetTextForeground(const wxColour& colour) + { m_textForegroundColour = colour; } + virtual const wxColour& GetTextForeground() const + { return m_textForegroundColour; } + + virtual void SetTextBackground(const wxColour& colour) + { m_textBackgroundColour = colour; } + virtual const wxColour& GetTextBackground() const + { return m_textBackgroundColour; } + +#if wxUSE_PALETTE + virtual void SetPalette(const wxPalette& palette) = 0; +#endif // wxUSE_PALETTE + + // inherit the DC attributes (font and colours) from the given window + // + // this is called automatically when a window, client or paint DC is + // created + virtual void InheritAttributes(wxWindow *win); + + + // logical functions + + virtual void SetLogicalFunction(wxRasterOperationMode function) = 0; + virtual wxRasterOperationMode GetLogicalFunction() const + { return m_logicalFunction; } + + // text measurement + + virtual wxCoord GetCharHeight() const = 0; + virtual wxCoord GetCharWidth() const = 0; + + // The derived classes should really override DoGetFontMetrics() to return + // the correct values in the future but for now provide a default + // implementation in terms of DoGetTextExtent() to avoid breaking the + // compilation of all other ports as wxMSW is the only one to implement it. + virtual void DoGetFontMetrics(int *height, + int *ascent, + int *descent, + int *internalLeading, + int *externalLeading, + int *averageWidth) const; + + virtual void DoGetTextExtent(const wxString& string, + wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + const wxFont *theFont = NULL) const = 0; + virtual void GetMultiLineTextExtent(const wxString& string, + wxCoord *width, + wxCoord *height, + wxCoord *heightLine = NULL, + const wxFont *font = NULL) const; + virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; + + // clearing + + virtual void Clear() = 0; + + // clipping + + // Note that this pure virtual method has an implementation that updates + // the values returned by DoGetClippingBox() and so can be called from the + // derived class overridden version if it makes sense (i.e. if the clipping + // box coordinates are not already updated in some other way). + virtual void DoSetClippingRegion(wxCoord x, wxCoord y, + wxCoord w, wxCoord h) = 0; + + // NB: this function works with device coordinates, not the logical ones! + virtual void DoSetDeviceClippingRegion(const wxRegion& region) = 0; + + // Method used to implement wxDC::GetClippingBox(). + // + // Default implementation returns values stored in m_clip[XY][12] member + // variables, so this method doesn't need to be overridden if they're kept + // up to date. + virtual bool DoGetClippingRect(wxRect& rect) const; + +#if WXWIN_COMPATIBILITY_3_0 + // This method is kept for backwards compatibility but shouldn't be used + // nor overridden in the new code, implement DoGetClippingRect() above + // instead. + wxDEPRECATED_BUT_USED_INTERNALLY( + virtual void DoGetClippingBox(wxCoord *x, wxCoord *y, + wxCoord *w, wxCoord *h) const + ); +#endif // WXWIN_COMPATIBILITY_3_0 + + virtual void DestroyClippingRegion() { ResetClipping(); } + + + // coordinates conversions and transforms + + virtual wxCoord DeviceToLogicalX(wxCoord x) const; + virtual wxCoord DeviceToLogicalY(wxCoord y) const; + virtual wxCoord DeviceToLogicalXRel(wxCoord x) const; + virtual wxCoord DeviceToLogicalYRel(wxCoord y) const; + virtual wxCoord LogicalToDeviceX(wxCoord x) const; + virtual wxCoord LogicalToDeviceY(wxCoord y) const; + virtual wxCoord LogicalToDeviceXRel(wxCoord x) const; + virtual wxCoord LogicalToDeviceYRel(wxCoord y) const; + + virtual void SetMapMode(wxMappingMode mode); + virtual wxMappingMode GetMapMode() const { return m_mappingMode; } + + virtual void SetUserScale(double x, double y); + virtual void GetUserScale(double *x, double *y) const + { + if ( x ) *x = m_userScaleX; + if ( y ) *y = m_userScaleY; + } + + virtual void SetLogicalScale(double x, double y); + virtual void GetLogicalScale(double *x, double *y) const + { + if ( x ) *x = m_logicalScaleX; + if ( y ) *y = m_logicalScaleY; + } + + virtual void SetLogicalOrigin(wxCoord x, wxCoord y); + virtual void DoGetLogicalOrigin(wxCoord *x, wxCoord *y) const + { + if ( x ) *x = m_logicalOriginX; + if ( y ) *y = m_logicalOriginY; + } + + virtual void SetDeviceOrigin(wxCoord x, wxCoord y); + virtual void DoGetDeviceOrigin(wxCoord *x, wxCoord *y) const + { + if ( x ) *x = m_deviceOriginX; + if ( y ) *y = m_deviceOriginY; + } + +#if wxUSE_DC_TRANSFORM_MATRIX + // Transform matrix support is not available in most ports right now + // (currently only wxMSW provides it) so do nothing in these methods by + // default. + virtual bool CanUseTransformMatrix() const + { return false; } + virtual bool SetTransformMatrix(const wxAffineMatrix2D& WXUNUSED(matrix)) + { return false; } + virtual wxAffineMatrix2D GetTransformMatrix() const + { return wxAffineMatrix2D(); } + virtual void ResetTransformMatrix() + { } +#endif // wxUSE_DC_TRANSFORM_MATRIX + + virtual void SetDeviceLocalOrigin( wxCoord x, wxCoord y ); + + virtual void ComputeScaleAndOrigin(); + + // this needs to overridden if the axis is inverted + virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp); + + virtual double GetContentScaleFactor() const { return m_contentScaleFactor; } + + virtual wxSize FromDIP(const wxSize& sz) const; + + virtual wxSize ToDIP(const wxSize& sz) const; + +#ifdef __WXMSW__ + // Native Windows functions using the underlying HDC don't honour GDI+ + // transformations which may be applied to it. Using this function we can + // transform the coordinates manually before passing them to such functions + // (as in e.g. wxRendererMSW code). It doesn't do anything if this is not a + // wxGCDC. + virtual wxRect MSWApplyGDIPlusTransform(const wxRect& r) const + { + return r; + } +#endif // __WXMSW__ + + + // --------------------------------------------------------- + // the actual drawing API + + virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, + wxFloodFillStyle style = wxFLOOD_SURFACE) = 0; + + virtual void DoGradientFillLinear(const wxRect& rect, + const wxColour& initialColour, + const wxColour& destColour, + wxDirection nDirection = wxEAST); + + virtual void DoGradientFillConcentric(const wxRect& rect, + const wxColour& initialColour, + const wxColour& destColour, + const wxPoint& circleCenter); + + virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const = 0; + + virtual void DoDrawPoint(wxCoord x, wxCoord y) = 0; + virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) = 0; + + virtual void DoDrawArc(wxCoord x1, wxCoord y1, + wxCoord x2, wxCoord y2, + wxCoord xc, wxCoord yc) = 0; + virtual void DoDrawCheckMark(wxCoord x, wxCoord y, + wxCoord width, wxCoord height); + virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, + double sa, double ea) = 0; + + virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) = 0; + virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, + wxCoord width, wxCoord height, + double radius) = 0; + virtual void DoDrawEllipse(wxCoord x, wxCoord y, + wxCoord width, wxCoord height) = 0; + + virtual void DoCrossHair(wxCoord x, wxCoord y) = 0; + + virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) = 0; + virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, + bool useMask = false) = 0; + + virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) = 0; + virtual void DoDrawRotatedText(const wxString& text, + wxCoord x, wxCoord y, double angle) = 0; + + virtual bool DoBlit(wxCoord xdest, wxCoord ydest, + wxCoord width, wxCoord height, + wxDC *source, + wxCoord xsrc, wxCoord ysrc, + wxRasterOperationMode rop = wxCOPY, + bool useMask = false, + wxCoord xsrcMask = wxDefaultCoord, + wxCoord ysrcMask = wxDefaultCoord) = 0; + + virtual bool DoStretchBlit(wxCoord xdest, wxCoord ydest, + wxCoord dstWidth, wxCoord dstHeight, + wxDC *source, + wxCoord xsrc, wxCoord ysrc, + wxCoord srcWidth, wxCoord srcHeight, + wxRasterOperationMode rop = wxCOPY, + bool useMask = false, + wxCoord xsrcMask = wxDefaultCoord, + wxCoord ysrcMask = wxDefaultCoord); + + virtual wxBitmap DoGetAsBitmap(const wxRect *WXUNUSED(subrect)) const + { return wxNullBitmap; } + + + virtual void DoDrawLines(int n, const wxPoint points[], + wxCoord xoffset, wxCoord yoffset ) = 0; + virtual void DrawLines(const wxPointList *list, + wxCoord xoffset, wxCoord yoffset ); + + virtual void DoDrawPolygon(int n, const wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + wxPolygonFillMode fillStyle = wxODDEVEN_RULE) = 0; + virtual void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + wxPolygonFillMode fillStyle); + void DrawPolygon(const wxPointList *list, + wxCoord xoffset, wxCoord yoffset, + wxPolygonFillMode fillStyle ); + + +#if wxUSE_SPLINES + void DrawSpline(wxCoord x1, wxCoord y1, + wxCoord x2, wxCoord y2, + wxCoord x3, wxCoord y3); + void DrawSpline(int n, const wxPoint points[]); + void DrawSpline(const wxPointList *points) { DoDrawSpline(points); } + + virtual void DoDrawSpline(const wxPointList *points); +#endif + + // --------------------------------------------------------- + // wxMemoryDC Impl API + + virtual void DoSelect(const wxBitmap& WXUNUSED(bmp)) + { } + + virtual const wxBitmap& GetSelectedBitmap() const + { return wxNullBitmap; } + virtual wxBitmap& GetSelectedBitmap() + { return wxNullBitmap; } + + // --------------------------------------------------------- + // wxPrinterDC Impl API + + virtual wxRect GetPaperRect() const + { int w = 0; int h = 0; DoGetSize( &w, &h ); return wxRect(0,0,w,h); } + + virtual int GetResolution() const + { return -1; } + +#if wxUSE_GRAPHICS_CONTEXT + virtual wxGraphicsContext* GetGraphicsContext() const + { return NULL; } + virtual void SetGraphicsContext( wxGraphicsContext* WXUNUSED(ctx) ) + {} +#endif + +private: + wxDC *m_owner; + +protected: + // This method exists for backwards compatibility only (while it's not + // documented, there are derived classes using it outside wxWidgets + // itself), don't use it in any new code and just call wxDCImpl version of + // DestroyClippingRegion() to reset the clipping information instead. + void ResetClipping() + { + m_clipping = false; + + m_clipX1 = m_clipX2 = m_clipY1 = m_clipY2 = 0; + } + + // returns adjustment factor for converting wxFont "point size"; in wx + // it is point size on screen and needs to be multiplied by this value + // for rendering on higher-resolution DCs such as printer ones + static float GetFontPointSizeAdjustment(float dpi); + + // Return the number of pixels per mm in the horizontal and vertical + // directions, respectively. + // + // If the physical size of the DC is not known, or doesn't make sense, as + // for a SVG DC, for example, a fixed value corresponding to the standard + // DPI is used. + double GetMMToPXx() const; + double GetMMToPXy() const; + + + // window on which the DC draws or NULL + wxWindow *m_window; + + // flags + bool m_colour:1; + bool m_ok:1; + bool m_clipping:1; + bool m_isInteractive:1; + bool m_isBBoxValid:1; + + // coordinate system variables + + wxCoord m_logicalOriginX, m_logicalOriginY; + wxCoord m_deviceOriginX, m_deviceOriginY; // Usually 0,0, can be change by user + + wxCoord m_deviceLocalOriginX, m_deviceLocalOriginY; // non-zero if native top-left corner + // is not at 0,0. This was the case under + // Mac's GrafPorts (coordinate system + // used toplevel window's origin) and + // e.g. for Postscript, where the native + // origin in the bottom left corner. + double m_logicalScaleX, m_logicalScaleY; + double m_userScaleX, m_userScaleY; + double m_scaleX, m_scaleY; // calculated from logical scale and user scale + + int m_signX, m_signY; // Used by SetAxisOrientation() to invert the axes + + double m_contentScaleFactor; // used by high resolution displays (retina) + + // Pixel per mm in horizontal and vertical directions. + // + // These variables are computed on demand by GetMMToPX[xy]() functions, + // don't access them directly other than for assigning to them. + mutable double m_mm_to_pix_x, + m_mm_to_pix_y; + + // bounding and clipping boxes + wxCoord m_minX, m_minY, m_maxX, m_maxY; // Bounding box is stored in device units. + wxCoord m_clipX1, m_clipY1, m_clipX2, m_clipY2; // Some derived classes operate directly on clipping box given in logical units. + + wxRasterOperationMode m_logicalFunction; + int m_backgroundMode; + wxMappingMode m_mappingMode; + + wxPen m_pen; + wxBrush m_brush; + wxBrush m_backgroundBrush; + wxColour m_textForegroundColour; + wxColour m_textBackgroundColour; + wxFont m_font; + +#if wxUSE_PALETTE + wxPalette m_palette; + bool m_hasCustomPalette; +#endif // wxUSE_PALETTE + +private: + // Return the full DC area in logical coordinates. + wxRect GetLogicalArea() const; + + wxCoord m_devClipX1, m_devClipY1, m_devClipX2, m_devClipY2; // For proper calculations of clipping box we need to store it in device units. + bool m_useDevClipCoords; + + wxDECLARE_ABSTRACT_CLASS(wxDCImpl); +}; + + +class WXDLLIMPEXP_CORE wxDC : public wxObject +{ +public: + // copy attributes (font, colours and writing direction) from another DC + void CopyAttributes(const wxDC& dc); + + virtual ~wxDC() { delete m_pimpl; } + + wxDCImpl *GetImpl() + { return m_pimpl; } + const wxDCImpl *GetImpl() const + { return m_pimpl; } + + wxWindow *GetWindow() const + { return m_pimpl->GetWindow(); } + + void *GetHandle() const + { return m_pimpl->GetHandle(); } + + bool IsOk() const + { return m_pimpl && m_pimpl->IsOk(); } + + // query capabilities + + bool CanDrawBitmap() const + { return m_pimpl->CanDrawBitmap(); } + bool CanGetTextExtent() const + { return m_pimpl->CanGetTextExtent(); } + + // query dimension, colour deps, resolution + + void GetSize(int *width, int *height) const + { m_pimpl->DoGetSize(width, height); } + wxSize GetSize() const + { return m_pimpl->GetSize(); } + + void GetSizeMM(int* width, int* height) const + { m_pimpl->DoGetSizeMM(width, height); } + wxSize GetSizeMM() const + { + int w, h; + m_pimpl->DoGetSizeMM(&w, &h); + return wxSize(w, h); + } + + int GetDepth() const + { return m_pimpl->GetDepth(); } + wxSize GetPPI() const + { return m_pimpl->GetPPI(); } + + virtual int GetResolution() const + { return m_pimpl->GetResolution(); } + + double GetContentScaleFactor() const + { return m_pimpl->GetContentScaleFactor(); } + + wxSize FromDIP(const wxSize& sz) const + { return m_pimpl->FromDIP(sz); } + wxPoint FromDIP(const wxPoint& pt) const + { + const wxSize sz = FromDIP(wxSize(pt.x, pt.y)); + return wxPoint(sz.x, sz.y); + } + int FromDIP(int d) const + { return FromDIP(wxSize(d, 0)).x; } + + wxSize ToDIP(const wxSize & sz) const + { + return m_pimpl->ToDIP(sz); + } + wxPoint ToDIP(const wxPoint & pt) const + { + const wxSize sz = ToDIP(wxSize(pt.x, pt.y)); + return wxPoint(sz.x, sz.y); + } + int ToDIP(int d) const + { + return ToDIP(wxSize(d, 0)).x; + } + + // Right-To-Left (RTL) modes + + void SetLayoutDirection(wxLayoutDirection dir) + { m_pimpl->SetLayoutDirection( dir ); } + wxLayoutDirection GetLayoutDirection() const + { return m_pimpl->GetLayoutDirection(); } + + // page and document + + bool StartDoc(const wxString& message) + { return m_pimpl->StartDoc(message); } + void EndDoc() + { m_pimpl->EndDoc(); } + + void StartPage() + { m_pimpl->StartPage(); } + void EndPage() + { m_pimpl->EndPage(); } + + // bounding box + + void CalcBoundingBox(wxCoord x, wxCoord y) + { m_pimpl->CalcBoundingBox(x,y); } + void ResetBoundingBox() + { m_pimpl->ResetBoundingBox(); } + + wxCoord MinX() const + { return m_pimpl->MinX(); } + wxCoord MaxX() const + { return m_pimpl->MaxX(); } + wxCoord MinY() const + { return m_pimpl->MinY(); } + wxCoord MaxY() const + { return m_pimpl->MaxY(); } + + // setters and getters + + void SetFont(const wxFont& font) + { m_pimpl->SetFont( font ); } + const wxFont& GetFont() const + { return m_pimpl->GetFont(); } + + void SetPen(const wxPen& pen) + { m_pimpl->SetPen( pen ); } + const wxPen& GetPen() const + { return m_pimpl->GetPen(); } + + void SetBrush(const wxBrush& brush) + { m_pimpl->SetBrush( brush ); } + const wxBrush& GetBrush() const + { return m_pimpl->GetBrush(); } + + void SetBackground(const wxBrush& brush) + { m_pimpl->SetBackground( brush ); } + const wxBrush& GetBackground() const + { return m_pimpl->GetBackground(); } + + void SetBackgroundMode(int mode) + { m_pimpl->SetBackgroundMode( mode ); } + int GetBackgroundMode() const + { return m_pimpl->GetBackgroundMode(); } + + void SetTextForeground(const wxColour& colour) + { m_pimpl->SetTextForeground(colour); } + const wxColour& GetTextForeground() const + { return m_pimpl->GetTextForeground(); } + + void SetTextBackground(const wxColour& colour) + { m_pimpl->SetTextBackground(colour); } + const wxColour& GetTextBackground() const + { return m_pimpl->GetTextBackground(); } + +#if wxUSE_PALETTE + void SetPalette(const wxPalette& palette) + { m_pimpl->SetPalette(palette); } +#endif // wxUSE_PALETTE + + // logical functions + + void SetLogicalFunction(wxRasterOperationMode function) + { m_pimpl->SetLogicalFunction(function); } + wxRasterOperationMode GetLogicalFunction() const + { return m_pimpl->GetLogicalFunction(); } + + // text measurement + + wxCoord GetCharHeight() const + { return m_pimpl->GetCharHeight(); } + wxCoord GetCharWidth() const + { return m_pimpl->GetCharWidth(); } + + wxFontMetrics GetFontMetrics() const + { + wxFontMetrics fm; + m_pimpl->DoGetFontMetrics(&fm.height, &fm.ascent, &fm.descent, + &fm.internalLeading, &fm.externalLeading, + &fm.averageWidth); + return fm; + } + + void GetTextExtent(const wxString& string, + wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + const wxFont *theFont = NULL) const + { m_pimpl->DoGetTextExtent(string, x, y, descent, externalLeading, theFont); } + + wxSize GetTextExtent(const wxString& string) const + { + wxCoord w, h; + m_pimpl->DoGetTextExtent(string, &w, &h); + return wxSize(w, h); + } + + void GetMultiLineTextExtent(const wxString& string, + wxCoord *width, + wxCoord *height, + wxCoord *heightLine = NULL, + const wxFont *font = NULL) const + { m_pimpl->GetMultiLineTextExtent( string, width, height, heightLine, font ); } + + wxSize GetMultiLineTextExtent(const wxString& string) const + { + wxCoord w, h; + m_pimpl->GetMultiLineTextExtent(string, &w, &h); + return wxSize(w, h); + } + + bool GetPartialTextExtents(const wxString& text, wxArrayInt& widths) const + { return m_pimpl->DoGetPartialTextExtents(text, widths); } + + // clearing + + void Clear() + { m_pimpl->Clear(); } + + // clipping + + void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height) + { m_pimpl->DoSetClippingRegion(x, y, width, height); } + void SetClippingRegion(const wxPoint& pt, const wxSize& sz) + { m_pimpl->DoSetClippingRegion(pt.x, pt.y, sz.x, sz.y); } + void SetClippingRegion(const wxRect& rect) + { m_pimpl->DoSetClippingRegion(rect.x, rect.y, rect.width, rect.height); } + + // unlike the functions above, the coordinates of the region used in this + // one are in device coordinates, not the logical ones + void SetDeviceClippingRegion(const wxRegion& region) + { m_pimpl->DoSetDeviceClippingRegion(region); } + + // this function is deprecated because its name is confusing: you may + // expect it to work with logical coordinates but, in fact, it does exactly + // the same thing as SetDeviceClippingRegion() + // + // please review the code using it and either replace it with calls to + // SetDeviceClippingRegion() or correct it if it was [wrongly] passing + // logical coordinates to this function + wxDEPRECATED_INLINE(void SetClippingRegion(const wxRegion& region), + SetDeviceClippingRegion(region); ) + + void DestroyClippingRegion() + { m_pimpl->DestroyClippingRegion(); } + + bool GetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const + { + wxRect r; + const bool clipping = m_pimpl->DoGetClippingRect(r); + if ( x ) + *x = r.x; + if ( y ) + *y = r.y; + if ( w ) + *w = r.width; + if ( h ) + *h = r.height; + return clipping; + } + bool GetClippingBox(wxRect& rect) const + { return m_pimpl->DoGetClippingRect(rect); } + + // coordinates conversions and transforms + + wxCoord DeviceToLogicalX(wxCoord x) const + { return m_pimpl->DeviceToLogicalX(x); } + wxCoord DeviceToLogicalY(wxCoord y) const + { return m_pimpl->DeviceToLogicalY(y); } + wxCoord DeviceToLogicalXRel(wxCoord x) const + { return m_pimpl->DeviceToLogicalXRel(x); } + wxCoord DeviceToLogicalYRel(wxCoord y) const + { return m_pimpl->DeviceToLogicalYRel(y); } + wxPoint DeviceToLogical(const wxPoint& pt) const + { return m_pimpl->DeviceToLogical(pt.x, pt.y); } + wxPoint DeviceToLogical(wxCoord x, wxCoord y) const + { return m_pimpl->DeviceToLogical(x, y); } + wxSize DeviceToLogicalRel(const wxSize& dim) const + { return m_pimpl->DeviceToLogicalRel(dim.x, dim.y); } + wxSize DeviceToLogicalRel(int x, int y) const + { return m_pimpl->DeviceToLogicalRel(x, y); } + wxCoord LogicalToDeviceX(wxCoord x) const + { return m_pimpl->LogicalToDeviceX(x); } + wxCoord LogicalToDeviceY(wxCoord y) const + { return m_pimpl->LogicalToDeviceY(y); } + wxCoord LogicalToDeviceXRel(wxCoord x) const + { return m_pimpl->LogicalToDeviceXRel(x); } + wxCoord LogicalToDeviceYRel(wxCoord y) const + { return m_pimpl->LogicalToDeviceYRel(y); } + wxPoint LogicalToDevice(const wxPoint& pt) const + { return m_pimpl->LogicalToDevice(pt.x, pt.y); } + wxPoint LogicalToDevice(wxCoord x, wxCoord y) const + { return m_pimpl->LogicalToDevice(x, y); } + wxSize LogicalToDeviceRel(const wxSize& dim) const + { return m_pimpl->LogicalToDeviceRel(dim.x, dim.y); } + wxSize LogicalToDeviceRel(int x, int y) const + { return m_pimpl->LogicalToDeviceRel(x, y); } + + void SetMapMode(wxMappingMode mode) + { m_pimpl->SetMapMode(mode); } + wxMappingMode GetMapMode() const + { return m_pimpl->GetMapMode(); } + + void SetUserScale(double x, double y) + { m_pimpl->SetUserScale(x,y); } + void GetUserScale(double *x, double *y) const + { m_pimpl->GetUserScale( x, y ); } + + void SetLogicalScale(double x, double y) + { m_pimpl->SetLogicalScale( x, y ); } + void GetLogicalScale(double *x, double *y) const + { m_pimpl->GetLogicalScale( x, y ); } + + void SetLogicalOrigin(wxCoord x, wxCoord y) + { m_pimpl->SetLogicalOrigin(x,y); } + void GetLogicalOrigin(wxCoord *x, wxCoord *y) const + { m_pimpl->DoGetLogicalOrigin(x, y); } + wxPoint GetLogicalOrigin() const + { wxCoord x, y; m_pimpl->DoGetLogicalOrigin(&x, &y); return wxPoint(x, y); } + + void SetDeviceOrigin(wxCoord x, wxCoord y) + { m_pimpl->SetDeviceOrigin( x, y); } + void GetDeviceOrigin(wxCoord *x, wxCoord *y) const + { m_pimpl->DoGetDeviceOrigin(x, y); } + wxPoint GetDeviceOrigin() const + { wxCoord x, y; m_pimpl->DoGetDeviceOrigin(&x, &y); return wxPoint(x, y); } + + void SetAxisOrientation(bool xLeftRight, bool yBottomUp) + { m_pimpl->SetAxisOrientation(xLeftRight, yBottomUp); } + +#if wxUSE_DC_TRANSFORM_MATRIX + bool CanUseTransformMatrix() const + { return m_pimpl->CanUseTransformMatrix(); } + + bool SetTransformMatrix(const wxAffineMatrix2D &matrix) + { return m_pimpl->SetTransformMatrix(matrix); } + + wxAffineMatrix2D GetTransformMatrix() const + { return m_pimpl->GetTransformMatrix(); } + + void ResetTransformMatrix() + { m_pimpl->ResetTransformMatrix(); } +#endif // wxUSE_DC_TRANSFORM_MATRIX + + // mostly internal + void SetDeviceLocalOrigin( wxCoord x, wxCoord y ) + { m_pimpl->SetDeviceLocalOrigin( x, y ); } + + + // ----------------------------------------------- + // the actual drawing API + + bool FloodFill(wxCoord x, wxCoord y, const wxColour& col, + wxFloodFillStyle style = wxFLOOD_SURFACE) + { return m_pimpl->DoFloodFill(x, y, col, style); } + bool FloodFill(const wxPoint& pt, const wxColour& col, + wxFloodFillStyle style = wxFLOOD_SURFACE) + { return m_pimpl->DoFloodFill(pt.x, pt.y, col, style); } + + // fill the area specified by rect with a radial gradient, starting from + // initialColour in the centre of the cercle and fading to destColour. + void GradientFillConcentric(const wxRect& rect, + const wxColour& initialColour, + const wxColour& destColour) + { m_pimpl->DoGradientFillConcentric( rect, initialColour, destColour, + wxPoint(rect.GetWidth() / 2, + rect.GetHeight() / 2)); } + + void GradientFillConcentric(const wxRect& rect, + const wxColour& initialColour, + const wxColour& destColour, + const wxPoint& circleCenter) + { m_pimpl->DoGradientFillConcentric(rect, initialColour, destColour, circleCenter); } + + // fill the area specified by rect with a linear gradient + void GradientFillLinear(const wxRect& rect, + const wxColour& initialColour, + const wxColour& destColour, + wxDirection nDirection = wxEAST) + { m_pimpl->DoGradientFillLinear(rect, initialColour, destColour, nDirection); } + + bool GetPixel(wxCoord x, wxCoord y, wxColour *col) const + { return m_pimpl->DoGetPixel(x, y, col); } + bool GetPixel(const wxPoint& pt, wxColour *col) const + { return m_pimpl->DoGetPixel(pt.x, pt.y, col); } + + void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) + { m_pimpl->DoDrawLine(x1, y1, x2, y2); } + void DrawLine(const wxPoint& pt1, const wxPoint& pt2) + { m_pimpl->DoDrawLine(pt1.x, pt1.y, pt2.x, pt2.y); } + + void CrossHair(wxCoord x, wxCoord y) + { m_pimpl->DoCrossHair(x, y); } + void CrossHair(const wxPoint& pt) + { m_pimpl->DoCrossHair(pt.x, pt.y); } + + void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, + wxCoord xc, wxCoord yc) + { m_pimpl->DoDrawArc(x1, y1, x2, y2, xc, yc); } + void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre) + { m_pimpl->DoDrawArc(pt1.x, pt1.y, pt2.x, pt2.y, centre.x, centre.y); } + + void DrawCheckMark(wxCoord x, wxCoord y, + wxCoord width, wxCoord height) + { m_pimpl->DoDrawCheckMark(x, y, width, height); } + void DrawCheckMark(const wxRect& rect) + { m_pimpl->DoDrawCheckMark(rect.x, rect.y, rect.width, rect.height); } + + void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, + double sa, double ea) + { m_pimpl->DoDrawEllipticArc(x, y, w, h, sa, ea); } + void DrawEllipticArc(const wxPoint& pt, const wxSize& sz, + double sa, double ea) + { m_pimpl->DoDrawEllipticArc(pt.x, pt.y, sz.x, sz.y, sa, ea); } + + void DrawPoint(wxCoord x, wxCoord y) + { m_pimpl->DoDrawPoint(x, y); } + void DrawPoint(const wxPoint& pt) + { m_pimpl->DoDrawPoint(pt.x, pt.y); } + + void DrawLines(int n, const wxPoint points[], + wxCoord xoffset = 0, wxCoord yoffset = 0) + { m_pimpl->DoDrawLines(n, points, xoffset, yoffset); } + void DrawLines(const wxPointList *list, + wxCoord xoffset = 0, wxCoord yoffset = 0) + { m_pimpl->DrawLines( list, xoffset, yoffset ); } +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED( void DrawLines(const wxList *list, + wxCoord xoffset = 0, wxCoord yoffset = 0) ); +#endif // WXWIN_COMPATIBILITY_2_8 + + void DrawPolygon(int n, const wxPoint points[], + wxCoord xoffset = 0, wxCoord yoffset = 0, + wxPolygonFillMode fillStyle = wxODDEVEN_RULE) + { m_pimpl->DoDrawPolygon(n, points, xoffset, yoffset, fillStyle); } + void DrawPolygon(const wxPointList *list, + wxCoord xoffset = 0, wxCoord yoffset = 0, + wxPolygonFillMode fillStyle = wxODDEVEN_RULE) + { m_pimpl->DrawPolygon( list, xoffset, yoffset, fillStyle ); } + void DrawPolyPolygon(int n, const int count[], const wxPoint points[], + wxCoord xoffset = 0, wxCoord yoffset = 0, + wxPolygonFillMode fillStyle = wxODDEVEN_RULE) + { m_pimpl->DoDrawPolyPolygon(n, count, points, xoffset, yoffset, fillStyle); } +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED( void DrawPolygon(const wxList *list, + wxCoord xoffset = 0, wxCoord yoffset = 0, + wxPolygonFillMode fillStyle = wxODDEVEN_RULE) ); +#endif // WXWIN_COMPATIBILITY_2_8 + + void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) + { m_pimpl->DoDrawRectangle(x, y, width, height); } + void DrawRectangle(const wxPoint& pt, const wxSize& sz) + { m_pimpl->DoDrawRectangle(pt.x, pt.y, sz.x, sz.y); } + void DrawRectangle(const wxRect& rect) + { m_pimpl->DoDrawRectangle(rect.x, rect.y, rect.width, rect.height); } + + void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, + double radius) + { m_pimpl->DoDrawRoundedRectangle(x, y, width, height, radius); } + void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, + double radius) + { m_pimpl->DoDrawRoundedRectangle(pt.x, pt.y, sz.x, sz.y, radius); } + void DrawRoundedRectangle(const wxRect& r, double radius) + { m_pimpl->DoDrawRoundedRectangle(r.x, r.y, r.width, r.height, radius); } + + void DrawCircle(wxCoord x, wxCoord y, wxCoord radius) + { m_pimpl->DoDrawEllipse(x - radius, y - radius, 2*radius, 2*radius); } + void DrawCircle(const wxPoint& pt, wxCoord radius) + { m_pimpl->DoDrawEllipse(pt.x - radius, pt.y - radius, 2*radius, 2*radius); } + + void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) + { m_pimpl->DoDrawEllipse(x, y, width, height); } + void DrawEllipse(const wxPoint& pt, const wxSize& sz) + { m_pimpl->DoDrawEllipse(pt.x, pt.y, sz.x, sz.y); } + void DrawEllipse(const wxRect& rect) + { m_pimpl->DoDrawEllipse(rect.x, rect.y, rect.width, rect.height); } + + void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) + { m_pimpl->DoDrawIcon(icon, x, y); } + void DrawIcon(const wxIcon& icon, const wxPoint& pt) + { m_pimpl->DoDrawIcon(icon, pt.x, pt.y); } + + void DrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, + bool useMask = false) + { m_pimpl->DoDrawBitmap(bmp, x, y, useMask); } + void DrawBitmap(const wxBitmap &bmp, const wxPoint& pt, + bool useMask = false) + { m_pimpl->DoDrawBitmap(bmp, pt.x, pt.y, useMask); } + + void DrawText(const wxString& text, wxCoord x, wxCoord y) + { m_pimpl->DoDrawText(text, x, y); } + void DrawText(const wxString& text, const wxPoint& pt) + { m_pimpl->DoDrawText(text, pt.x, pt.y); } + + void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle) + { m_pimpl->DoDrawRotatedText(text, x, y, angle); } + void DrawRotatedText(const wxString& text, const wxPoint& pt, double angle) + { m_pimpl->DoDrawRotatedText(text, pt.x, pt.y, angle); } + + // this version puts both optional bitmap and the text into the given + // rectangle and aligns is as specified by alignment parameter; it also + // will emphasize the character with the given index if it is != -1 and + // return the bounding rectangle if required + void DrawLabel(const wxString& text, + const wxBitmap& image, + const wxRect& rect, + int alignment = wxALIGN_LEFT | wxALIGN_TOP, + int indexAccel = -1, + wxRect *rectBounding = NULL); + + void DrawLabel(const wxString& text, const wxRect& rect, + int alignment = wxALIGN_LEFT | wxALIGN_TOP, + int indexAccel = -1) + { DrawLabel(text, wxNullBitmap, rect, alignment, indexAccel); } + + bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, + wxDC *source, wxCoord xsrc, wxCoord ysrc, + wxRasterOperationMode rop = wxCOPY, bool useMask = false, + wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) + { + return m_pimpl->DoBlit(xdest, ydest, width, height, + source, xsrc, ysrc, rop, useMask, xsrcMask, ysrcMask); + } + bool Blit(const wxPoint& destPt, const wxSize& sz, + wxDC *source, const wxPoint& srcPt, + wxRasterOperationMode rop = wxCOPY, bool useMask = false, + const wxPoint& srcPtMask = wxDefaultPosition) + { + return m_pimpl->DoBlit(destPt.x, destPt.y, sz.x, sz.y, + source, srcPt.x, srcPt.y, rop, useMask, srcPtMask.x, srcPtMask.y); + } + + bool StretchBlit(wxCoord dstX, wxCoord dstY, + wxCoord dstWidth, wxCoord dstHeight, + wxDC *source, + wxCoord srcX, wxCoord srcY, + wxCoord srcWidth, wxCoord srcHeight, + wxRasterOperationMode rop = wxCOPY, bool useMask = false, + wxCoord srcMaskX = wxDefaultCoord, wxCoord srcMaskY = wxDefaultCoord) + { + return m_pimpl->DoStretchBlit(dstX, dstY, dstWidth, dstHeight, + source, srcX, srcY, srcWidth, srcHeight, rop, useMask, srcMaskX, srcMaskY); + } + bool StretchBlit(const wxPoint& dstPt, const wxSize& dstSize, + wxDC *source, const wxPoint& srcPt, const wxSize& srcSize, + wxRasterOperationMode rop = wxCOPY, bool useMask = false, + const wxPoint& srcMaskPt = wxDefaultPosition) + { + return m_pimpl->DoStretchBlit(dstPt.x, dstPt.y, dstSize.x, dstSize.y, + source, srcPt.x, srcPt.y, srcSize.x, srcSize.y, rop, useMask, srcMaskPt.x, srcMaskPt.y); + } + + wxBitmap GetAsBitmap(const wxRect *subrect = (const wxRect *) NULL) const + { + return m_pimpl->DoGetAsBitmap(subrect); + } + +#if wxUSE_SPLINES + void DrawSpline(wxCoord x1, wxCoord y1, + wxCoord x2, wxCoord y2, + wxCoord x3, wxCoord y3) + { m_pimpl->DrawSpline(x1,y1,x2,y2,x3,y3); } + void DrawSpline(int n, const wxPoint points[]) + { m_pimpl->DrawSpline(n,points); } + void DrawSpline(const wxPointList *points) + { m_pimpl->DrawSpline(points); } +#endif // wxUSE_SPLINES + + +#if WXWIN_COMPATIBILITY_2_8 + // for compatibility with the old code when wxCoord was long everywhere + wxDEPRECATED( void GetTextExtent(const wxString& string, + long *x, long *y, + long *descent = NULL, + long *externalLeading = NULL, + const wxFont *theFont = NULL) const ); + wxDEPRECATED( void GetLogicalOrigin(long *x, long *y) const ); + wxDEPRECATED( void GetDeviceOrigin(long *x, long *y) const ); + wxDEPRECATED( void GetClippingBox(long *x, long *y, long *w, long *h) const ); + + wxDEPRECATED( void DrawObject(wxDrawObject* drawobject) ); +#endif // WXWIN_COMPATIBILITY_2_8 + +#ifdef __WXMSW__ + // GetHDC() is the simplest way to retrieve an HDC From a wxDC but only + // works if this wxDC is GDI-based and fails for GDI+ contexts (and + // anything else without HDC, e.g. wxPostScriptDC) + WXHDC GetHDC() const; + + // don't use these methods manually, use GetTempHDC() instead + virtual WXHDC AcquireHDC() { return GetHDC(); } + virtual void ReleaseHDC(WXHDC WXUNUSED(hdc)) { } + + // helper class holding the result of GetTempHDC() with std::auto_ptr<>-like + // semantics, i.e. it is moved when copied + class TempHDC + { + public: + TempHDC(wxDC& dc) + : m_dc(dc), + m_hdc(dc.AcquireHDC()) + { + } + + TempHDC(const TempHDC& thdc) + : m_dc(thdc.m_dc), + m_hdc(thdc.m_hdc) + { + const_cast(thdc).m_hdc = NULL; + } + + ~TempHDC() + { + if ( m_hdc ) + m_dc.ReleaseHDC(m_hdc); + } + + WXHDC GetHDC() const { return m_hdc; } + + private: + wxDC& m_dc; + WXHDC m_hdc; + + wxDECLARE_NO_ASSIGN_CLASS(TempHDC); + }; + + // GetTempHDC() also works for wxGCDC (but still not for wxPostScriptDC &c) + TempHDC GetTempHDC() { return TempHDC(*this); } +#endif // __WXMSW__ + +#if wxUSE_GRAPHICS_CONTEXT + virtual wxGraphicsContext* GetGraphicsContext() const + { + return m_pimpl->GetGraphicsContext(); + } + virtual void SetGraphicsContext( wxGraphicsContext* ctx ) + { + m_pimpl->SetGraphicsContext(ctx); + } +#endif + +protected: + // ctor takes ownership of the pointer + wxDC(wxDCImpl *pimpl) : m_pimpl(pimpl) { } + + wxDCImpl * const m_pimpl; + + void SetWindow(wxWindow* w) + { return m_pimpl->SetWindow(w); } + +private: + wxDECLARE_ABSTRACT_CLASS(wxDC); + wxDECLARE_NO_COPY_CLASS(wxDC); +}; + +// ---------------------------------------------------------------------------- +// helper class: you can use it to temporarily change the DC text colour and +// restore it automatically when the object goes out of scope +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDCTextColourChanger +{ +public: + wxDCTextColourChanger(wxDC& dc) : m_dc(dc), m_colFgOld() { } + + wxDCTextColourChanger(wxDC& dc, const wxColour& col) : m_dc(dc) + { + Set(col); + } + + ~wxDCTextColourChanger() + { + if ( m_colFgOld.IsOk() ) + m_dc.SetTextForeground(m_colFgOld); + } + + void Set(const wxColour& col) + { + if ( !m_colFgOld.IsOk() ) + m_colFgOld = m_dc.GetTextForeground(); + m_dc.SetTextForeground(col); + } + +private: + wxDC& m_dc; + + wxColour m_colFgOld; + + wxDECLARE_NO_COPY_CLASS(wxDCTextColourChanger); +}; + +// ---------------------------------------------------------------------------- +// helper class: you can use it to temporarily change the DC text background colour and +// restore it automatically when the object goes out of scope +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDCTextBgColourChanger +{ +public: + wxDCTextBgColourChanger(wxDC& dc) : m_dc(dc) { } + + wxDCTextBgColourChanger(wxDC& dc, const wxColour& col) : m_dc(dc) + { + Set(col); + } + + ~wxDCTextBgColourChanger() + { + if ( m_colBgOld.IsOk() ) + m_dc.SetTextBackground(m_colBgOld); + } + + void Set(const wxColour& col) + { + if ( !m_colBgOld.IsOk() ) + m_colBgOld = m_dc.GetTextBackground(); + m_dc.SetTextBackground(col); + } + +private: + wxDC& m_dc; + + wxColour m_colBgOld; + + wxDECLARE_NO_COPY_CLASS(wxDCTextBgColourChanger); +}; + +// ---------------------------------------------------------------------------- +// helper class: you can use it to temporarily change the DC text background mode and +// restore it automatically when the object goes out of scope +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDCTextBgModeChanger +{ +public: + wxDCTextBgModeChanger(wxDC& dc) : m_dc(dc), m_modeOld(wxBRUSHSTYLE_INVALID) { } + + wxDCTextBgModeChanger(wxDC& dc, int mode) : m_dc(dc), m_modeOld(wxBRUSHSTYLE_INVALID) + { + Set(mode); + } + + ~wxDCTextBgModeChanger() + { + if ( m_modeOld != wxBRUSHSTYLE_INVALID ) + m_dc.SetBackgroundMode(m_modeOld); + } + + void Set(int mode) + { + if ( m_modeOld == wxBRUSHSTYLE_INVALID ) + m_modeOld = m_dc.GetBackgroundMode(); + m_dc.SetBackgroundMode(mode); + } + +private: + wxDC& m_dc; + + int m_modeOld; + + wxDECLARE_NO_COPY_CLASS(wxDCTextBgModeChanger); +}; + +// ---------------------------------------------------------------------------- +// helper class: you can use it to temporarily change the DC pen and +// restore it automatically when the object goes out of scope +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDCPenChanger +{ +public: + wxDCPenChanger(wxDC& dc, const wxPen& pen) : m_dc(dc), m_penOld(dc.GetPen()) + { + m_dc.SetPen(pen); + } + + ~wxDCPenChanger() + { + if ( m_penOld.IsOk() ) + m_dc.SetPen(m_penOld); + } + +private: + wxDC& m_dc; + + wxPen m_penOld; + + wxDECLARE_NO_COPY_CLASS(wxDCPenChanger); +}; + +// ---------------------------------------------------------------------------- +// helper class: you can use it to temporarily change the DC brush and +// restore it automatically when the object goes out of scope +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDCBrushChanger +{ +public: + wxDCBrushChanger(wxDC& dc, const wxBrush& brush) : m_dc(dc), m_brushOld(dc.GetBrush()) + { + m_dc.SetBrush(brush); + } + + ~wxDCBrushChanger() + { + if ( m_brushOld.IsOk() ) + m_dc.SetBrush(m_brushOld); + } + +private: + wxDC& m_dc; + + wxBrush m_brushOld; + + wxDECLARE_NO_COPY_CLASS(wxDCBrushChanger); +}; + +// ---------------------------------------------------------------------------- +// another small helper class: sets the clipping region in its ctor and +// destroys it in the dtor +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDCClipper +{ +public: + wxDCClipper(wxDC& dc, const wxRegion& r) : m_dc(dc) + { + Init(r.GetBox()); + } + wxDCClipper(wxDC& dc, const wxRect& r) : m_dc(dc) + { + Init(r); + } + wxDCClipper(wxDC& dc, wxCoord x, wxCoord y, wxCoord w, wxCoord h) : m_dc(dc) + { + Init(wxRect(x, y, w, h)); + } + + ~wxDCClipper() + { + m_dc.DestroyClippingRegion(); + if ( m_restoreOld ) + m_dc.SetClippingRegion(m_oldClipRect); + } + +private: + // Common part of all ctors. + void Init(const wxRect& r) + { + m_restoreOld = m_dc.GetClippingBox(m_oldClipRect); + m_dc.SetClippingRegion(r); + } + + wxDC& m_dc; + wxRect m_oldClipRect; + bool m_restoreOld; + + wxDECLARE_NO_COPY_CLASS(wxDCClipper); +}; + +// ---------------------------------------------------------------------------- +// helper class: you can use it to temporarily change the DC font and +// restore it automatically when the object goes out of scope +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDCFontChanger +{ +public: + wxDCFontChanger(wxDC& dc) + : m_dc(dc), m_fontOld() + { + } + + wxDCFontChanger(wxDC& dc, const wxFont& font) + : m_dc(dc), m_fontOld(dc.GetFont()) + { + m_dc.SetFont(font); + } + + void Set(const wxFont& font) + { + if ( !m_fontOld.IsOk() ) + m_fontOld = m_dc.GetFont(); + m_dc.SetFont(font); + } + + ~wxDCFontChanger() + { + if ( m_fontOld.IsOk() ) + m_dc.SetFont(m_fontOld); + } + +private: + wxDC& m_dc; + + wxFont m_fontOld; + + wxDECLARE_NO_COPY_CLASS(wxDCFontChanger); +}; + + +#endif // _WX_DC_H_BASE_ diff --git a/lib/wxWidgets/include/wx/dcbuffer.h b/lib/wxWidgets/include/wx/dcbuffer.h new file mode 100644 index 0000000..8fc23d6 --- /dev/null +++ b/lib/wxWidgets/include/wx/dcbuffer.h @@ -0,0 +1,252 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dcbuffer.h +// Purpose: wxBufferedDC class +// Author: Ron Lee +// Modified by: Vadim Zeitlin (refactored, added bg preservation) +// Created: 16/03/02 +// Copyright: (c) Ron Lee +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCBUFFER_H_ +#define _WX_DCBUFFER_H_ + +#include "wx/dcmemory.h" +#include "wx/dcclient.h" +#include "wx/window.h" + +// Split platforms into two groups - those which have well-working +// double-buffering by default, and those which do not. +#if defined(__WXMAC__) || defined(__WXGTK20__) || defined(__WXDFB__) || defined(__WXQT__) + #define wxALWAYS_NATIVE_DOUBLE_BUFFER 1 +#else + #define wxALWAYS_NATIVE_DOUBLE_BUFFER 0 +#endif + + +// ---------------------------------------------------------------------------- +// Double buffering helper. +// ---------------------------------------------------------------------------- + +// Assumes the buffer bitmap covers the entire scrolled window, +// and prepares the window DC accordingly +#define wxBUFFER_VIRTUAL_AREA 0x01 + +// Assumes the buffer bitmap only covers the client area; +// does not prepare the window DC +#define wxBUFFER_CLIENT_AREA 0x02 + +// 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. + wxBufferedDC() + : m_dc(NULL), + m_buffer(NULL), + m_style(0) + { + } + + // Construct a wxBufferedDC using a user supplied buffer. + wxBufferedDC(wxDC *dc, + wxBitmap& buffer = wxNullBitmap, + int style = wxBUFFER_CLIENT_AREA) + : m_dc(NULL), m_buffer(NULL) + { + Init(dc, buffer, style); + } + + // Construct a wxBufferedDC with an internal buffer of 'area' + // (where area is usually something like the size of the window + // being buffered) + wxBufferedDC(wxDC *dc, const wxSize& area, int style = wxBUFFER_CLIENT_AREA) + : m_dc(NULL), m_buffer(NULL) + { + Init(dc, area, style); + } + + // The usually desired action in the dtor is to blit the buffer. + virtual ~wxBufferedDC() + { + if ( m_dc ) + UnMask(); + } + + // These reimplement the actions of the ctors for two stage creation + void Init(wxDC *dc, + wxBitmap& buffer = wxNullBitmap, + int style = wxBUFFER_CLIENT_AREA) + { + InitCommon(dc, style); + + m_buffer = &buffer; + + UseBuffer(); + } + + void Init(wxDC *dc, const wxSize &area, int style = wxBUFFER_CLIENT_AREA) + { + InitCommon(dc, style); + + UseBuffer(area.x, area.y); + } + + // Blits the buffer to the dc, and detaches the dc from the buffer (so it + // can be effectively used once only). + // + // 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(); + + // Set and get the style + void SetStyle(int style) { m_style = style; } + int GetStyle() const { return m_style & ~wxBUFFER_USES_SHARED_BUFFER; } + +private: + // common part of Init()s + void InitCommon(wxDC *dc, int style) + { + wxASSERT_MSG( !m_dc, wxT("wxBufferedDC already initialised") ); + + m_dc = dc; + m_style = style; + } + + // check that the bitmap is valid and use it + void UseBuffer(wxCoord w = -1, wxCoord h = -1); + + // the underlying DC to which we copy everything drawn on this one in + // UnMask() + // + // NB: Without the existence of a wxNullDC, this must be a pointer, else it + // could probably be a reference. + wxDC *m_dc; + + // the buffer (selected in this DC), initially invalid + wxBitmap *m_buffer; + + // the buffering style + int m_style; + + wxSize m_area; + + wxDECLARE_DYNAMIC_CLASS(wxBufferedDC); + wxDECLARE_NO_COPY_CLASS(wxBufferedDC); +}; + + +// ---------------------------------------------------------------------------- +// Double buffered PaintDC. +// ---------------------------------------------------------------------------- + +// Creates a double buffered wxPaintDC, optionally allowing the +// user to specify their own buffer to use. +class WXDLLIMPEXP_CORE wxBufferedPaintDC : public wxBufferedDC +{ +public: + // If no bitmap is supplied by the user, a temporary one will be created. + wxBufferedPaintDC(wxWindow *window, wxBitmap& buffer, int style = wxBUFFER_CLIENT_AREA) + : m_paintdc(window) + { + SetWindow(window); + + // If we're buffering the virtual window, scale the paint DC as well + if (style & wxBUFFER_VIRTUAL_AREA) + window->PrepareDC( m_paintdc ); + + if( buffer.IsOk() ) + Init(&m_paintdc, buffer, style); + else + Init(&m_paintdc, GetBufferedSize(window, style), style); + } + + // If no bitmap is supplied by the user, a temporary one will be created. + wxBufferedPaintDC(wxWindow *window, int style = wxBUFFER_CLIENT_AREA) + : m_paintdc(window) + { + SetWindow(window); + + // If we're using the virtual window, scale the paint DC as well + if (style & wxBUFFER_VIRTUAL_AREA) + window->PrepareDC( m_paintdc ); + + Init(&m_paintdc, GetBufferedSize(window, style), style); + } + + // default copy ctor ok. + + virtual ~wxBufferedPaintDC() + { + // We must UnMask here, else by the time the base class + // does it, the PaintDC will have already been destroyed. + UnMask(); + } + +protected: + // return the size needed by the buffer: this depends on whether we're + // buffering just the currently shown part or the total (scrolled) window + static wxSize GetBufferedSize(wxWindow *window, int style) + { + return style & wxBUFFER_VIRTUAL_AREA ? window->GetVirtualSize() + : window->GetClientSize(); + } + +private: + wxPaintDC m_paintdc; + + wxDECLARE_ABSTRACT_CLASS(wxBufferedPaintDC); + wxDECLARE_NO_COPY_CLASS(wxBufferedPaintDC); +}; + + + +// +// wxAutoBufferedPaintDC is a wxPaintDC in toolkits which have double- +// buffering by default. Otherwise it is a wxBufferedPaintDC. Thus, +// you can only expect it work with a simple constructor that +// accepts single wxWindow* argument. +// +#if wxALWAYS_NATIVE_DOUBLE_BUFFER + #define wxAutoBufferedPaintDCBase wxPaintDC +#else + #define wxAutoBufferedPaintDCBase wxBufferedPaintDC +#endif + +class WXDLLIMPEXP_CORE wxAutoBufferedPaintDC : public wxAutoBufferedPaintDCBase +{ +public: + + wxAutoBufferedPaintDC(wxWindow* win) + : wxAutoBufferedPaintDCBase(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: + wxDECLARE_NO_COPY_CLASS(wxAutoBufferedPaintDC); +}; + + + +// Check if the window is natively double buffered and will return a wxPaintDC +// if it is, a wxBufferedPaintDC otherwise. It is the caller's responsibility +// to delete the wxDC pointer when finished with it. +inline wxDC* wxAutoBufferedPaintDCFactory(wxWindow* window) +{ + if ( window->IsDoubleBuffered() ) + return new wxPaintDC(window); + else + return new wxBufferedPaintDC(window); +} + +#endif // _WX_DCBUFFER_H_ diff --git a/lib/wxWidgets/include/wx/dcclient.h b/lib/wxWidgets/include/wx/dcclient.h new file mode 100644 index 0000000..28391d1 --- /dev/null +++ b/lib/wxWidgets/include/wx/dcclient.h @@ -0,0 +1,62 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dcclient.h +// Purpose: wxClientDC base header +// Author: Julian Smart +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCCLIENT_H_BASE_ +#define _WX_DCCLIENT_H_BASE_ + +#include "wx/dc.h" + +//----------------------------------------------------------------------------- +// wxWindowDC +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWindowDC : public wxDC +{ +public: + wxWindowDC(wxWindow *win); + +protected: + wxWindowDC(wxDCImpl *impl) : wxDC(impl) { } + +private: + wxDECLARE_ABSTRACT_CLASS(wxWindowDC); +}; + +//----------------------------------------------------------------------------- +// wxClientDC +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxClientDC : public wxWindowDC +{ +public: + wxClientDC(wxWindow *win); + +protected: + wxClientDC(wxDCImpl *impl) : wxWindowDC(impl) { } + +private: + wxDECLARE_ABSTRACT_CLASS(wxClientDC); +}; + +//----------------------------------------------------------------------------- +// wxPaintDC +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPaintDC : public wxClientDC +{ +public: + wxPaintDC(wxWindow *win); + +protected: + wxPaintDC(wxDCImpl *impl) : wxClientDC(impl) { } + +private: + wxDECLARE_ABSTRACT_CLASS(wxPaintDC); +}; + +#endif // _WX_DCCLIENT_H_BASE_ diff --git a/lib/wxWidgets/include/wx/dcgraph.h b/lib/wxWidgets/include/wx/dcgraph.h new file mode 100644 index 0000000..5b832d8 --- /dev/null +++ b/lib/wxWidgets/include/wx/dcgraph.h @@ -0,0 +1,274 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dcgraph.h +// Purpose: graphics context device bridge header +// Author: Stefan Csomor +// Modified by: +// Created: +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GRAPHICS_DC_H_ +#define _WX_GRAPHICS_DC_H_ + +#if wxUSE_GRAPHICS_CONTEXT + +#include "wx/dc.h" +#include "wx/geometry.h" +#include "wx/graphics.h" + +class WXDLLIMPEXP_FWD_CORE wxWindowDC; + + +class WXDLLIMPEXP_CORE wxGCDC: public wxDC +{ +public: + 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(); + +#ifdef __WXMSW__ + // override wxDC virtual functions to provide access to HDC associated with + // underlying wxGraphicsContext + virtual WXHDC AcquireHDC() wxOVERRIDE; + virtual void ReleaseHDC(WXHDC hdc) wxOVERRIDE; +#endif // __WXMSW__ + +private: + wxDECLARE_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 + + // Ctor using an existing graphics context given to wxGCDC ctor. + wxGCDCImpl(wxDC *owner, wxGraphicsContext* context); + + wxGCDCImpl( wxDC *owner ); + + virtual ~wxGCDCImpl(); + + // implement base class pure virtuals + // ---------------------------------- + + virtual void Clear() wxOVERRIDE; + + virtual bool StartDoc( const wxString& message ) wxOVERRIDE; + virtual void EndDoc() wxOVERRIDE; + + virtual void StartPage() wxOVERRIDE; + virtual void EndPage() wxOVERRIDE; + + // flushing the content of this dc immediately onto screen + virtual void Flush() wxOVERRIDE; + + virtual void SetFont(const wxFont& font) wxOVERRIDE; + virtual void SetPen(const wxPen& pen) wxOVERRIDE; + virtual void SetBrush(const wxBrush& brush) wxOVERRIDE; + virtual void SetBackground(const wxBrush& brush) wxOVERRIDE; + virtual void SetBackgroundMode(int mode) wxOVERRIDE; + +#if wxUSE_PALETTE + virtual void SetPalette(const wxPalette& palette) wxOVERRIDE; +#endif + + virtual void DestroyClippingRegion() wxOVERRIDE; + + virtual wxCoord GetCharHeight() const wxOVERRIDE; + virtual wxCoord GetCharWidth() const wxOVERRIDE; + + virtual bool CanDrawBitmap() const wxOVERRIDE; + virtual bool CanGetTextExtent() const wxOVERRIDE; + virtual int GetDepth() const wxOVERRIDE; + virtual wxSize GetPPI() const wxOVERRIDE; + + virtual void SetLogicalFunction(wxRasterOperationMode function) wxOVERRIDE; + + virtual void SetTextForeground(const wxColour& colour) wxOVERRIDE; + virtual void SetTextBackground(const wxColour& colour) wxOVERRIDE; + + virtual void ComputeScaleAndOrigin() wxOVERRIDE; + + wxGraphicsContext* GetGraphicsContext() const wxOVERRIDE { return m_graphicContext; } + virtual void SetGraphicsContext( wxGraphicsContext* ctx ) wxOVERRIDE; + + virtual void* GetHandle() const wxOVERRIDE; + +#if wxUSE_DC_TRANSFORM_MATRIX + virtual bool CanUseTransformMatrix() const wxOVERRIDE; + virtual bool SetTransformMatrix(const wxAffineMatrix2D& matrix) wxOVERRIDE; + virtual wxAffineMatrix2D GetTransformMatrix() const wxOVERRIDE; + virtual void ResetTransformMatrix() wxOVERRIDE; +#endif // wxUSE_DC_TRANSFORM_MATRIX + + // coordinates conversions and transforms + virtual wxPoint DeviceToLogical(wxCoord x, wxCoord y) const wxOVERRIDE; + virtual wxPoint LogicalToDevice(wxCoord x, wxCoord y) const wxOVERRIDE; + virtual wxSize DeviceToLogicalRel(int x, int y) const wxOVERRIDE; + virtual wxSize LogicalToDeviceRel(int x, int y) const wxOVERRIDE; + + // the true implementations + virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, + wxFloodFillStyle style = wxFLOOD_SURFACE) wxOVERRIDE; + + virtual void DoGradientFillLinear(const wxRect& rect, + const wxColour& initialColour, + const wxColour& destColour, + wxDirection nDirection = wxEAST) wxOVERRIDE; + + virtual void DoGradientFillConcentric(const wxRect& rect, + const wxColour& initialColour, + const wxColour& destColour, + const wxPoint& circleCenter) wxOVERRIDE; + + virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const wxOVERRIDE; + + virtual void DoDrawPoint(wxCoord x, wxCoord y) wxOVERRIDE; + +#if wxUSE_SPLINES + virtual void DoDrawSpline(const wxPointList *points) wxOVERRIDE; +#endif + + virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) wxOVERRIDE; + + virtual void DoDrawArc(wxCoord x1, wxCoord y1, + wxCoord x2, wxCoord y2, + wxCoord xc, wxCoord yc) wxOVERRIDE; + + virtual void DoDrawCheckMark(wxCoord x, wxCoord y, + wxCoord width, wxCoord height) wxOVERRIDE; + + virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, + double sa, double ea) wxOVERRIDE; + + virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE; + virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, + wxCoord width, wxCoord height, + double radius) wxOVERRIDE; + virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE; + + virtual void DoCrossHair(wxCoord x, wxCoord y) wxOVERRIDE; + + virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) wxOVERRIDE; + virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, + bool useMask = false) wxOVERRIDE; + + virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) wxOVERRIDE; + virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, + double angle) wxOVERRIDE; + + virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, + wxDC *source, wxCoord xsrc, wxCoord ysrc, + wxRasterOperationMode rop = wxCOPY, bool useMask = false, + wxCoord xsrcMask = -1, wxCoord ysrcMask = -1) wxOVERRIDE; + + 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) wxOVERRIDE; + + virtual void DoGetSize(int *,int *) const wxOVERRIDE; + virtual void DoGetSizeMM(int* width, int* height) const wxOVERRIDE; + + virtual void DoDrawLines(int n, const wxPoint points[], + wxCoord xoffset, wxCoord yoffset) wxOVERRIDE; + virtual void DoDrawPolygon(int n, const wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + wxPolygonFillMode fillStyle = wxODDEVEN_RULE) wxOVERRIDE; + virtual void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + wxPolygonFillMode fillStyle) wxOVERRIDE; + + virtual void DoSetDeviceClippingRegion(const wxRegion& region) wxOVERRIDE; + virtual void DoSetClippingRegion(wxCoord x, wxCoord y, + wxCoord width, wxCoord height) wxOVERRIDE; + virtual bool DoGetClippingRect(wxRect& rect) const wxOVERRIDE; + + virtual void DoGetTextExtent(const wxString& string, + wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + const wxFont *theFont = NULL) const wxOVERRIDE; + + virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const wxOVERRIDE; + +#ifdef __WXMSW__ + virtual wxRect MSWApplyGDIPlusTransform(const wxRect& r) const wxOVERRIDE; +#endif // __WXMSW__ + + // update the internal clip box variables + void UpdateClipBox(); + +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); + +#ifdef __WXOSX__ + virtual wxPoint OSXGetOrigin() const { return wxPoint(); } +#endif + + // scaling variables + bool m_logicalFunctionSupported; + wxGraphicsMatrix m_matrixOriginal; + wxGraphicsMatrix m_matrixCurrent; + wxGraphicsMatrix m_matrixCurrentInv; +#if wxUSE_DC_TRANSFORM_MATRIX + wxAffineMatrix2D m_matrixExtTransform; +#endif // wxUSE_DC_TRANSFORM_MATRIX + + wxGraphicsContext* m_graphicContext; + + bool m_isClipBoxValid; + +private: + // This method only initializes trivial fields. + void CommonInit(); + + // This method initializes all fields (including those initialized by + // CommonInit() as it calls it) and the given context, if non-null, which + // is assumed to be newly created. + void Init(wxGraphicsContext*); + + // This method initializes m_graphicContext, m_ok and m_matrixOriginal + // fields, returns true if the context was valid. + bool DoInitContext(wxGraphicsContext* ctx); + + // Another convenient wrapper for CalcBoundingBox(). + // This is not an overload in order to avoid hiding the base class ones. + void CalcBoundingBoxForBox(const wxRect2DDouble& box) + { + CalcBoundingBox(wxRound(box.m_x), wxRound(box.m_y)); + CalcBoundingBox(wxRound(box.m_x + box.m_width), + wxRound(box.m_y + box.m_height)); + } + + wxDECLARE_CLASS(wxGCDCImpl); + wxDECLARE_NO_COPY_CLASS(wxGCDCImpl); +}; + +#endif // wxUSE_GRAPHICS_CONTEXT +#endif // _WX_GRAPHICS_DC_H_ diff --git a/lib/wxWidgets/include/wx/dcmemory.h b/lib/wxWidgets/include/wx/dcmemory.h new file mode 100644 index 0000000..573da75 --- /dev/null +++ b/lib/wxWidgets/include/wx/dcmemory.h @@ -0,0 +1,44 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dcmemory.h +// Purpose: wxMemoryDC base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCMEMORY_H_BASE_ +#define _WX_DCMEMORY_H_BASE_ + +#include "wx/dc.h" +#include "wx/bitmap.h" + +//----------------------------------------------------------------------------- +// wxMemoryDC +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMemoryDC: public wxDC +{ +public: + wxMemoryDC(); + wxMemoryDC( wxBitmap& bitmap ); + wxMemoryDC( wxDC *dc ); + + // select the given bitmap to draw on it + void SelectObject(wxBitmap& bmp); + + // select the given bitmap for read-only + void SelectObjectAsSource(const wxBitmap& bmp); + + // get selected bitmap + const wxBitmap& GetSelectedBitmap() const; + wxBitmap& GetSelectedBitmap(); + +private: + wxDECLARE_DYNAMIC_CLASS(wxMemoryDC); +}; + + +#endif + // _WX_DCMEMORY_H_BASE_ diff --git a/lib/wxWidgets/include/wx/dcmirror.h b/lib/wxWidgets/include/wx/dcmirror.h new file mode 100644 index 0000000..44747c1 --- /dev/null +++ b/lib/wxWidgets/include/wx/dcmirror.h @@ -0,0 +1,297 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/dcmirror.h +// Purpose: wxMirrorDC class +// Author: Vadim Zeitlin +// Modified by: +// Created: 21.07.2003 +// Copyright: (c) 2003 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCMIRROR_H_ +#define _WX_DCMIRROR_H_ + +#include "wx/dc.h" + +#include "wx/scopedarray.h" + +// ---------------------------------------------------------------------------- +// wxMirrorDC allows to write the same code for horz/vertical layout +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMirrorDCImpl : public wxDCImpl +{ +public: + // constructs a mirror DC associated with the given real DC + // + // 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 + wxMirrorDCImpl(wxDC *owner, wxDCImpl& dc, bool mirror) + : wxDCImpl(owner), + m_dc(dc) + { + m_mirror = mirror; + } + + // wxDCBase operations + virtual void Clear() wxOVERRIDE { m_dc.Clear(); } + virtual void SetFont(const wxFont& font) wxOVERRIDE { m_dc.SetFont(font); } + virtual void SetPen(const wxPen& pen) wxOVERRIDE { m_dc.SetPen(pen); } + virtual void SetBrush(const wxBrush& brush) wxOVERRIDE { m_dc.SetBrush(brush); } + virtual void SetBackground(const wxBrush& brush) wxOVERRIDE + { m_dc.SetBackground(brush); } + virtual void SetBackgroundMode(int mode) wxOVERRIDE { m_dc.SetBackgroundMode(mode); } +#if wxUSE_PALETTE + virtual void SetPalette(const wxPalette& palette) wxOVERRIDE + { m_dc.SetPalette(palette); } +#endif // wxUSE_PALETTE + virtual void DestroyClippingRegion() wxOVERRIDE { m_dc.DestroyClippingRegion(); } + virtual wxCoord GetCharHeight() const wxOVERRIDE { return m_dc.GetCharHeight(); } + virtual wxCoord GetCharWidth() const wxOVERRIDE { return m_dc.GetCharWidth(); } + virtual bool CanDrawBitmap() const wxOVERRIDE { return m_dc.CanDrawBitmap(); } + virtual bool CanGetTextExtent() const wxOVERRIDE { return m_dc.CanGetTextExtent(); } + virtual int GetDepth() const wxOVERRIDE { return m_dc.GetDepth(); } + virtual wxSize GetPPI() const wxOVERRIDE { return m_dc.GetPPI(); } + virtual bool IsOk() const wxOVERRIDE { return m_dc.IsOk(); } + virtual void SetMapMode(wxMappingMode mode) wxOVERRIDE { m_dc.SetMapMode(mode); } + virtual void SetUserScale(double x, double y) wxOVERRIDE + { m_dc.SetUserScale(GetX(x, y), GetY(x, y)); } + virtual void SetLogicalOrigin(wxCoord x, wxCoord y) wxOVERRIDE + { m_dc.SetLogicalOrigin(GetX(x, y), GetY(x, y)); } + virtual void SetDeviceOrigin(wxCoord x, wxCoord y) wxOVERRIDE + { m_dc.SetDeviceOrigin(GetX(x, y), GetY(x, y)); } + virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp) wxOVERRIDE + { m_dc.SetAxisOrientation(GetX(xLeftRight, yBottomUp), + GetY(xLeftRight, yBottomUp)); } + virtual void SetLogicalFunction(wxRasterOperationMode function) wxOVERRIDE + { m_dc.SetLogicalFunction(function); } + + virtual void* GetHandle() const wxOVERRIDE + { return m_dc.GetHandle(); } + +protected: + // returns x and y if not mirroring or y and x if mirroring + wxCoord GetX(wxCoord x, wxCoord y) const { return m_mirror ? y : x; } + wxCoord GetY(wxCoord x, wxCoord y) const { return m_mirror ? x : y; } + double GetX(double x, double y) const { return m_mirror ? y : x; } + double GetY(double x, double y) const { return m_mirror ? x : y; } + bool GetX(bool x, bool y) const { return m_mirror ? y : x; } + bool GetY(bool x, bool y) const { return m_mirror ? x : y; } + + // same thing but for pointers + 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 components of all points in the array if necessary + 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++ ) + { + 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, + wxFloodFillStyle style = wxFLOOD_SURFACE) wxOVERRIDE + { + return m_dc.DoFloodFill(GetX(x, y), GetY(x, y), col, style); + } + + virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const wxOVERRIDE + { + return m_dc.DoGetPixel(GetX(x, y), GetY(x, y), col); + } + + + virtual void DoDrawPoint(wxCoord x, wxCoord y) wxOVERRIDE + { + m_dc.DoDrawPoint(GetX(x, y), GetY(x, y)); + } + + virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) wxOVERRIDE + { + m_dc.DoDrawLine(GetX(x1, y1), GetY(x1, y1), GetX(x2, y2), GetY(x2, y2)); + } + + virtual void DoDrawArc(wxCoord x1, wxCoord y1, + wxCoord x2, wxCoord y2, + wxCoord xc, wxCoord yc) wxOVERRIDE + { + wxFAIL_MSG( wxT("this is probably wrong") ); + + m_dc.DoDrawArc(GetX(x1, y1), GetY(x1, y1), + GetX(x2, y2), GetY(x2, y2), + xc, yc); + } + + virtual void DoDrawCheckMark(wxCoord x, wxCoord y, + wxCoord w, wxCoord h) wxOVERRIDE + { + m_dc.DoDrawCheckMark(GetX(x, y), GetY(x, y), + GetX(w, h), GetY(w, h)); + } + + virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, + double sa, double ea) wxOVERRIDE + { + wxFAIL_MSG( wxT("this is probably wrong") ); + + m_dc.DoDrawEllipticArc(GetX(x, y), GetY(x, y), + GetX(w, h), GetY(w, h), + sa, ea); + } + + virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h) wxOVERRIDE + { + m_dc.DoDrawRectangle(GetX(x, y), GetY(x, y), GetX(w, h), GetY(w, h)); + } + + virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, + wxCoord w, wxCoord h, + double radius) wxOVERRIDE + { + m_dc.DoDrawRoundedRectangle(GetX(x, y), GetY(x, y), + GetX(w, h), GetY(w, h), + radius); + } + + virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h) wxOVERRIDE + { + m_dc.DoDrawEllipse(GetX(x, y), GetY(x, y), GetX(w, h), GetY(w, h)); + } + + virtual void DoCrossHair(wxCoord x, wxCoord y) wxOVERRIDE + { + m_dc.DoCrossHair(GetX(x, y), GetY(x, y)); + } + + virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) wxOVERRIDE + { + m_dc.DoDrawIcon(icon, GetX(x, y), GetY(x, y)); + } + + virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, + bool useMask = false) wxOVERRIDE + { + m_dc.DoDrawBitmap(bmp, GetX(x, y), GetY(x, y), useMask); + } + + virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) wxOVERRIDE + { + // this is never mirrored + m_dc.DoDrawText(text, x, y); + } + + virtual void DoDrawRotatedText(const wxString& text, + wxCoord x, wxCoord y, double angle) wxOVERRIDE + { + // this is never mirrored + m_dc.DoDrawRotatedText(text, x, y, angle); + } + + virtual bool DoBlit(wxCoord xdest, wxCoord ydest, + wxCoord w, wxCoord h, + wxDC *source, wxCoord xsrc, wxCoord ysrc, + wxRasterOperationMode rop = wxCOPY, + bool useMask = false, + wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) wxOVERRIDE + { + return m_dc.DoBlit(GetX(xdest, ydest), GetY(xdest, ydest), + GetX(w, h), GetY(w, h), + source, GetX(xsrc, ysrc), GetY(xsrc, ysrc), + rop, useMask, + GetX(xsrcMask, ysrcMask), GetX(xsrcMask, ysrcMask)); + } + + virtual void DoGetSize(int *w, int *h) const wxOVERRIDE + { + m_dc.DoGetSize(GetX(w, h), GetY(w, h)); + } + + virtual void DoGetSizeMM(int *w, int *h) const wxOVERRIDE + { + m_dc.DoGetSizeMM(GetX(w, h), GetY(w, h)); + } + + virtual void DoDrawLines(int n, const wxPoint points[], + wxCoord xoffset, wxCoord yoffset) wxOVERRIDE + { + wxScopedArray points_alloc(Mirror(n, points)); + + m_dc.DoDrawLines(n, points, + GetX(xoffset, yoffset), GetY(xoffset, yoffset)); + } + + virtual void DoDrawPolygon(int n, const wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + wxPolygonFillMode fillStyle = wxODDEVEN_RULE) wxOVERRIDE + { + wxScopedArray points_alloc(Mirror(n, points)); + + m_dc.DoDrawPolygon(n, points, + GetX(xoffset, yoffset), GetY(xoffset, yoffset), + fillStyle); + } + + virtual void DoSetDeviceClippingRegion(const wxRegion& WXUNUSED(region)) wxOVERRIDE + { + wxFAIL_MSG( wxT("not implemented") ); + } + + virtual void DoSetClippingRegion(wxCoord x, wxCoord y, + wxCoord w, wxCoord h) wxOVERRIDE + { + m_dc.DoSetClippingRegion(GetX(x, y), GetY(x, y), GetX(w, h), GetY(w, h)); + } + + virtual void DoGetTextExtent(const wxString& string, + wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + const wxFont *theFont = NULL) const wxOVERRIDE + { + // never mirrored + m_dc.DoGetTextExtent(string, x, y, descent, externalLeading, theFont); + } + +private: + wxDCImpl& m_dc; + + bool m_mirror; + + 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_ + diff --git a/lib/wxWidgets/include/wx/dcprint.h b/lib/wxWidgets/include/wx/dcprint.h new file mode 100644 index 0000000..2e98c7e --- /dev/null +++ b/lib/wxWidgets/include/wx/dcprint.h @@ -0,0 +1,42 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dcprint.h +// Purpose: wxPrinterDC base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCPRINT_H_BASE_ +#define _WX_DCPRINT_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_PRINTING_ARCHITECTURE + +#include "wx/dc.h" + +//----------------------------------------------------------------------------- +// wxPrinterDC +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPrinterDC : public wxDC +{ +public: + wxPrinterDC(); + wxPrinterDC(const wxPrintData& data); + + wxRect GetPaperRect() const; + int GetResolution() const wxOVERRIDE; + +protected: + wxPrinterDC(wxDCImpl *impl) : wxDC(impl) { } + +private: + wxDECLARE_DYNAMIC_CLASS(wxPrinterDC); +}; + +#endif // wxUSE_PRINTING_ARCHITECTURE + +#endif // _WX_DCPRINT_H_BASE_ diff --git a/lib/wxWidgets/include/wx/dcps.h b/lib/wxWidgets/include/wx/dcps.h new file mode 100644 index 0000000..659eb59 --- /dev/null +++ b/lib/wxWidgets/include/wx/dcps.h @@ -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 + diff --git a/lib/wxWidgets/include/wx/dcscreen.h b/lib/wxWidgets/include/wx/dcscreen.h new file mode 100644 index 0000000..fb60309 --- /dev/null +++ b/lib/wxWidgets/include/wx/dcscreen.h @@ -0,0 +1,35 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dcscreen.h +// Purpose: wxScreenDC base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCSCREEN_H_BASE_ +#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: + wxDECLARE_DYNAMIC_CLASS(wxScreenDC); +}; + + +#endif + // _WX_DCSCREEN_H_BASE_ diff --git a/lib/wxWidgets/include/wx/dcsvg.h b/lib/wxWidgets/include/wx/dcsvg.h new file mode 100644 index 0000000..fcdecc0 --- /dev/null +++ b/lib/wxWidgets/include/wx/dcsvg.h @@ -0,0 +1,319 @@ +///////////////////////////////////////////////////////////////////////////// +// 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_ + +#if wxUSE_SVG + +#include "wx/string.h" +#include "wx/filename.h" +#include "wx/dc.h" +#include "wx/scopedptr.h" + +#define wxSVGVersion wxT("v0101") + +enum wxSVGShapeRenderingMode +{ + wxSVG_SHAPE_RENDERING_AUTO = 0, + wxSVG_SHAPE_RENDERING_OPTIMIZE_SPEED, + wxSVG_SHAPE_RENDERING_CRISP_EDGES, + wxSVG_SHAPE_RENDERING_GEOMETRIC_PRECISION, + + wxSVG_SHAPE_RENDERING_OPTIMISE_SPEED = wxSVG_SHAPE_RENDERING_OPTIMIZE_SPEED +}; + +class WXDLLIMPEXP_FWD_BASE wxFileOutputStream; + +class WXDLLIMPEXP_FWD_CORE wxSVGFileDC; + +// Base class for bitmap handlers used by wxSVGFileDC, used by the standard +// "embed" and "link" handlers below but can also be used to create a custom +// handler. +class WXDLLIMPEXP_CORE wxSVGBitmapHandler +{ +public: + // Write the representation of the given bitmap, appearing at the specified + // position, to the provided stream. + virtual bool ProcessBitmap(const wxBitmap& bitmap, + wxCoord x, wxCoord y, + wxOutputStream& stream) const = 0; + + virtual ~wxSVGBitmapHandler() {} +}; + +// Predefined standard bitmap handler: creates a file, stores the bitmap in +// this file and uses the file name in the generated SVG. +class WXDLLIMPEXP_CORE wxSVGBitmapFileHandler : public wxSVGBitmapHandler +{ +public: + wxSVGBitmapFileHandler() + : m_path() + { + } + + explicit wxSVGBitmapFileHandler(const wxFileName& path) + : m_path(path) + { + } + + virtual bool ProcessBitmap(const wxBitmap& bitmap, + wxCoord x, wxCoord y, + wxOutputStream& stream) const wxOVERRIDE; + +private: + wxFileName m_path; // When set, name will be appended with _image#.png +}; + +// Predefined handler which embeds the bitmap (base64-encoding it) inside the +// generated SVG file. +class WXDLLIMPEXP_CORE wxSVGBitmapEmbedHandler : public wxSVGBitmapHandler +{ +public: + virtual bool ProcessBitmap(const wxBitmap& bitmap, + wxCoord x, wxCoord y, + wxOutputStream& stream) const wxOVERRIDE; +}; + +class WXDLLIMPEXP_CORE wxSVGFileDCImpl : public wxDCImpl +{ +public: + wxSVGFileDCImpl(wxSVGFileDC* owner, const wxString& filename, + int width = 320, int height = 240, double dpi = 72.0, + const wxString& title = wxString()); + + virtual ~wxSVGFileDCImpl(); + + bool IsOk() const wxOVERRIDE { return m_OK; } + + virtual bool CanDrawBitmap() const wxOVERRIDE { return true; } + virtual bool CanGetTextExtent() const wxOVERRIDE { return true; } + + virtual int GetDepth() const wxOVERRIDE + { + wxFAIL_MSG(wxT("wxSVGFILEDC::GetDepth Call not implemented")); + return -1; + } + + virtual void Clear() wxOVERRIDE; + + virtual void DestroyClippingRegion() wxOVERRIDE; + + virtual wxCoord GetCharHeight() const wxOVERRIDE; + virtual wxCoord GetCharWidth() const wxOVERRIDE; + +#if wxUSE_PALETTE + virtual void SetPalette(const wxPalette& WXUNUSED(palette)) wxOVERRIDE + { + wxFAIL_MSG(wxT("wxSVGFILEDC::SetPalette not implemented")); + } +#endif + + virtual void SetLogicalFunction(wxRasterOperationMode WXUNUSED(function)) wxOVERRIDE + { + wxFAIL_MSG(wxT("wxSVGFILEDC::SetLogicalFunction Call not implemented")); + } + + virtual wxRasterOperationMode GetLogicalFunction() const wxOVERRIDE + { + wxFAIL_MSG(wxT("wxSVGFILEDC::GetLogicalFunction() not implemented")); + return wxCOPY; + } + + virtual void ComputeScaleAndOrigin() wxOVERRIDE; + + virtual void SetBackground(const wxBrush& brush) wxOVERRIDE; + virtual void SetBackgroundMode(int mode) wxOVERRIDE; + virtual void SetBrush(const wxBrush& brush) wxOVERRIDE; + virtual void SetFont(const wxFont& font) wxOVERRIDE; + virtual void SetPen(const wxPen& pen) wxOVERRIDE; + + virtual void* GetHandle() const wxOVERRIDE { return NULL; } + + void SetBitmapHandler(wxSVGBitmapHandler* handler); + + void SetShapeRenderingMode(wxSVGShapeRenderingMode renderingMode); + +private: + virtual bool DoGetPixel(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), + wxColour* WXUNUSED(col)) const wxOVERRIDE + { + wxFAIL_MSG(wxT("wxSVGFILEDC::DoGetPixel Call not implemented")); + return true; + } + + virtual bool DoBlit(wxCoord xdest, wxCoord ydest, + wxCoord width, wxCoord height, + wxDC* source, + wxCoord xsrc, wxCoord ysrc, + wxRasterOperationMode rop, + bool useMask = false, + wxCoord xsrcMask = wxDefaultCoord, + wxCoord ysrcMask = wxDefaultCoord) wxOVERRIDE; + + virtual void DoCrossHair(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) wxOVERRIDE + { + wxFAIL_MSG(wxT("wxSVGFILEDC::CrossHair Call not implemented")); + } + + virtual void DoDrawArc(wxCoord x1, wxCoord y1, + wxCoord x2, wxCoord y2, + wxCoord xc, wxCoord yc) wxOVERRIDE; + + virtual void DoDrawBitmap(const wxBitmap& bmp, wxCoord x, wxCoord y, + bool useMask = false) wxOVERRIDE; + + virtual void DoDrawEllipse(wxCoord x, wxCoord y, + wxCoord width, wxCoord height) wxOVERRIDE; + + virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, + double sa, double ea) wxOVERRIDE; + + virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) wxOVERRIDE; + + virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) wxOVERRIDE; + + virtual void DoDrawLines(int n, const wxPoint points[], + wxCoord xoffset, wxCoord yoffset) wxOVERRIDE; +#if wxUSE_SPLINES + void DoDrawSpline(const wxPointList* points) wxOVERRIDE; +#endif // wxUSE_SPLINES + + virtual void DoDrawPoint(wxCoord x, wxCoord y) wxOVERRIDE; + + virtual void DoDrawPolygon(int n, const wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + wxPolygonFillMode fillStyle = wxODDEVEN_RULE) wxOVERRIDE; + + virtual void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + wxPolygonFillMode fillStyle) wxOVERRIDE; + + virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE; + + virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, + double angle) wxOVERRIDE; + + virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, + wxCoord width, wxCoord height, + double radius) wxOVERRIDE; + + virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) wxOVERRIDE; + + virtual bool DoFloodFill(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), + const wxColour& WXUNUSED(col), + wxFloodFillStyle WXUNUSED(style)) wxOVERRIDE + { + wxFAIL_MSG(wxT("wxSVGFILEDC::DoFloodFill Call not implemented")); + return false; + } + + virtual void DoGradientFillLinear(const wxRect& rect, + const wxColour& initialColour, + const wxColour& destColour, + wxDirection nDirection) wxOVERRIDE; + + virtual void DoGradientFillConcentric(const wxRect& rect, + const wxColour& initialColour, + const wxColour& destColour, + const wxPoint& circleCenter) wxOVERRIDE; + + virtual void DoGetSize(int* width, int* height) const wxOVERRIDE + { + if ( width ) + *width = m_width; + if ( height ) + *height = m_height; + } + + virtual void DoGetTextExtent(const wxString& string, + wxCoord* x, wxCoord* y, + wxCoord* descent = NULL, + wxCoord* externalLeading = NULL, + const wxFont* theFont = NULL) const wxOVERRIDE; + + virtual void DoSetDeviceClippingRegion(const wxRegion& region) wxOVERRIDE; + + virtual void DoSetClippingRegion(wxCoord x, wxCoord y, + wxCoord w, wxCoord h) wxOVERRIDE; + + virtual void DoGetSizeMM(int* width, int* height) const wxOVERRIDE; + + virtual wxSize GetPPI() const wxOVERRIDE; + + virtual wxSize FromDIP(const wxSize& sz) const wxOVERRIDE; + + virtual wxSize ToDIP(const wxSize& sz) const wxOVERRIDE; + + void Init(const wxString& filename, int width, int height, + double dpi, const wxString& title); + + void write(const wxString& s); + +private: + // If m_graphics_changed is true, close the current 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(); + + wxString m_filename; + bool m_OK; + bool m_graphics_changed; // set by Set{Brush,Pen}() + int m_width, m_height; + double m_dpi; + wxScopedPtr m_outfile; + wxScopedPtr m_bmp_handler; // class to handle bitmaps + wxSVGShapeRenderingMode m_renderingMode; + + // 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; + + // Unique ID for every gradient. + size_t m_gradientUniqueId; + + wxDECLARE_ABSTRACT_CLASS(wxSVGFileDCImpl); + wxDECLARE_NO_COPY_CLASS(wxSVGFileDCImpl); +}; + + +class WXDLLIMPEXP_CORE wxSVGFileDC : public wxDC +{ +public: + wxSVGFileDC(const wxString& filename, + int width = 320, + int height = 240, + double dpi = 72.0, + const wxString& title = wxString()) + : wxDC(new wxSVGFileDCImpl(this, filename, width, height, dpi, title)) + { + } + + // wxSVGFileDC-specific methods: + + // Use a custom bitmap handler: takes ownership of the handler. + void SetBitmapHandler(wxSVGBitmapHandler* handler); + + void SetShapeRenderingMode(wxSVGShapeRenderingMode renderingMode); + +private: + wxDECLARE_ABSTRACT_CLASS(wxSVGFileDC); +}; + +#endif // wxUSE_SVG + +#endif // _WX_DCSVG_H_ diff --git a/lib/wxWidgets/include/wx/dde.h b/lib/wxWidgets/include/wx/dde.h new file mode 100644 index 0000000..d6524e1 --- /dev/null +++ b/lib/wxWidgets/include/wx/dde.h @@ -0,0 +1,31 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dde.h +// Purpose: DDE base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DDE_H_BASE_ +#define _WX_DDE_H_BASE_ + +#include "wx/list.h" + +class WXDLLIMPEXP_FWD_BASE wxDDEClient; +class WXDLLIMPEXP_FWD_BASE wxDDEServer; +class WXDLLIMPEXP_FWD_BASE wxDDEConnection; + +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(__WINDOWS__) + #include "wx/msw/dde.h" +#else + #error DDE is only supported under Windows +#endif + +#endif + // _WX_DDE_H_BASE_ diff --git a/lib/wxWidgets/include/wx/debug.h b/lib/wxWidgets/include/wx/debug.h new file mode 100644 index 0000000..a56d266 --- /dev/null +++ b/lib/wxWidgets/include/wx/debug.h @@ -0,0 +1,509 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/debug.h +// Purpose: Misc debug functions and macros +// Author: Vadim Zeitlin +// Created: 29/01/98 +// Copyright: (c) 1998-2009 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DEBUG_H_ +#define _WX_DEBUG_H_ + +#include + +#include // for CHAR_BIT used below + +#include "wx/chartype.h" // for __TFILE__ and wxChar +#include "wx/cpp.h" // for __WXFUNCTION__ +#include "wx/dlimpexp.h" // for WXDLLIMPEXP_FWD_BASE + +class WXDLLIMPEXP_FWD_BASE wxString; +class WXDLLIMPEXP_FWD_BASE wxCStrData; + +// ---------------------------------------------------------------------------- +// 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 +#else + #undef __WXDEBUG__ +#endif + +// 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__ + +// ---------------------------------------------------------------------------- +// Handling assertion failures +// ---------------------------------------------------------------------------- + +/* + 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. + #ifdef __VISUALC__ + #define wxTrap() __debugbreak() + #elif defined(__GNUC__) + #if defined(__i386) || defined(__x86_64) + #define wxTrap() asm volatile ("int $3") + #endif + #endif + + #ifndef wxTrap + // For all the other cases, use a generic function. + extern WXDLLIMPEXP_BASE void wxTrap(); + #endif + + // 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_AT(cond, msg, file, line, func) \ + wxSTATEMENT_MACRO_BEGIN \ + if ( cond ) \ + { \ + } \ + else if ( wxTheAssertHandler && \ + (wxOnAssert(file, line, func, #cond, msg), \ + wxTrapInAssert) ) \ + { \ + wxTrapInAssert = false; \ + wxTrap(); \ + } \ + wxSTATEMENT_MACRO_END + + // A version asserting at the current location. + #define wxASSERT_MSG(cond, msg) \ + wxASSERT_MSG_AT(cond, msg, __FILE__, __LINE__, __WXFUNCTION__) + + // 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_AT(cond, msg, file, line, func) \ + wxSTATEMENT_MACRO_BEGIN \ + if ( wxTheAssertHandler && \ + (wxOnAssert(file, line, func, #cond, msg), \ + wxTrapInAssert) ) \ + { \ + wxTrapInAssert = false; \ + wxTrap(); \ + } \ + wxSTATEMENT_MACRO_END + + #define wxFAIL_MSG_AT(msg, file, line, func) \ + wxFAIL_COND_MSG_AT("Assert failure", msg, file, line, func) + + #define wxFAIL_COND_MSG(cond, msg) \ + wxFAIL_COND_MSG_AT(cond, msg, __FILE__, __LINE__, __WXFUNCTION__) + + #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) + #define wxFAIL_MSG_AT(msg, file, line, func) + #define wxFAIL_COND_MSG_AT(cond, msg, file, line, func) +#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" ) +*/ + +// 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 wxMAKE_UNIQUE_NAME(wxDummyCheckStruct) /* to force a semicolon */ + +// 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, "return" if not (also FAILs in debug mode) +#define wxCHECK(cond, rc) wxCHECK_MSG(cond, rc, (const char*)NULL) + +// check that expression is true, perform op if not +#define wxCHECK2(cond, op) wxCHECK2_MSG(cond, op, (const char*)NULL) + +// 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 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 + macros): we rely on the fact that it is invalid to define a named bit field + in a struct of width 0. All the rest are just the hacks to minimize the + possibility of the compiler warnings when compiling this macro: in + particular, this is why we define a struct and not an object (which would + result in a warning about unused variable) and a named struct (otherwise we'd + get a warning about an unnamed struct not used to define an object!). + */ + +#define wxMAKE_UNIQUE_ASSERT_NAME wxMAKE_UNIQUE_NAME(wxAssert_) + +/* + The second argument of this macro must be a valid C++ identifier and not a + string. I.e. you should use it like this: + + wxCOMPILE_TIME_ASSERT( sizeof(int) >= 2, YourIntsAreTooSmall ); + + It may be used both within a function and in the global scope. +*/ +#if defined( __VMS ) +namespace wxdebug{ + +// HP aCC cannot deal with missing names for template value parameters +template struct STATIC_ASSERTION_FAILURE; + +template <> struct STATIC_ASSERTION_FAILURE { enum { value = 1 }; }; + +// HP aCC cannot deal with missing names for template value parameters +template 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; } +#endif + +/* + When using VC++ 6 with "Edit and Continue" on, the compiler completely + mishandles __LINE__ and so wxCOMPILE_TIME_ASSERT() doesn't work, provide a + way to make "unique" assert names by specifying a unique prefix explicitly + */ +#define wxMAKE_UNIQUE_ASSERT_NAME2(text) wxCONCAT(wxAssert_, text) + +#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 +#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 +#define wxASSERT_MIN_BITSIZE(type, size) \ + wxCOMPILE_TIME_ASSERT(sizeof(type) * CHAR_BIT >= size, \ + wxMAKE_BITSIZE_MSG(type, size)) + + +// ---------------------------------------------------------------------------- +// other miscellaneous debugger-related functions +// ---------------------------------------------------------------------------- + +/* + Return true if we're running under debugger. + + Currently only really works under Win32 and just returns false elsewhere. + */ +#if defined(__WIN32__) + extern bool WXDLLIMPEXP_BASE wxIsDebuggerRunning(); +#else // !Mac + inline bool wxIsDebuggerRunning() { return false; } +#endif // Mac/!Mac + +// 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_ diff --git a/lib/wxWidgets/include/wx/debugrpt.h b/lib/wxWidgets/include/wx/debugrpt.h new file mode 100644 index 0000000..96150af --- /dev/null +++ b/lib/wxWidgets/include/wx/debugrpt.h @@ -0,0 +1,256 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/debugrpt.h +// Purpose: declaration of wxDebugReport class +// Author: Vadim Zeitlin +// Created: 2005-01-17 +// Copyright: (c) 2005 Vadim Zeitlin +// 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" +#include "wx/filename.h" + +class WXDLLIMPEXP_FWD_XML wxXmlNode; + +// ---------------------------------------------------------------------------- +// wxDebugReport: generate a debug report, processing is done in derived class +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_QA wxDebugReport +{ + friend class wxDebugReportDialog; + +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(); + + // return the location where the report will be saved + virtual wxFileName GetSaveLocation() const; + +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() wxOVERRIDE; + + // return the location where the report will be saved + wxFileName GetSaveLocation() const wxOVERRIDE; + +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() wxOVERRIDE; + + // 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 wxOVERRIDE; +}; + +#endif // wxUSE_GUI + +#endif // wxUSE_DEBUGREPORT && wxUSE_XML + +#endif // _WX_DEBUGRPT_H_ diff --git a/lib/wxWidgets/include/wx/defs.h b/lib/wxWidgets/include/wx/defs.h new file mode 100644 index 0000000..39ce129 --- /dev/null +++ b/lib/wxWidgets/include/wx/defs.h @@ -0,0 +1,3320 @@ +/* + * Name: wx/defs.h + * Purpose: Declarations/definitions common to all wx source files + * Author: Julian Smart and others + * Modified by: Ryan Norton (Converted to C) + * Created: 01/02/97 + * Copyright: (c) Julian Smart + * Licence: wxWindows licence + */ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +/* + We want to avoid compilation and, even more perniciously, link errors if + the user code includes before include wxWidgets headers. These + error happen because #define's many common symbols, such as + Yield or GetClassInfo, which are also used in wxWidgets API. Including our + "cleanup" header below un-#defines them to fix this. + + Moreover, notice that it is also possible for the user code to include some + wx header (this including wx/defs.h), then include and then + include another wx header. To avoid the problem for the second header + inclusion, we must include wx/msw/winundef.h from here always and not just + during the first inclusion, so it has to be outside of _WX_DEFS_H_ guard + check below. + */ +#ifdef __cplusplus + /* + Test for _WINDOWS_, used as header guard by windows.h itself, not our + own __WINDOWS__, which is not defined yet. + */ +# ifdef _WINDOWS_ +# include "wx/msw/winundef.h" +# endif /* WIN32 */ +#endif /* __cplusplus */ + + +#ifndef _WX_DEFS_H_ +#define _WX_DEFS_H_ + +/* ---------------------------------------------------------------------------- */ +/* compiler and OS identification */ +/* ---------------------------------------------------------------------------- */ + +#include "wx/platform.h" + +#ifdef __cplusplus +/* Make sure the environment is set correctly */ +# if defined(__WXMSW__) && defined(__X__) +# error "Target can't be both X and MSW" +# elif !defined(__WXMOTIF__) && \ + !defined(__WXMSW__) && \ + !defined(__WXGTK__) && \ + !defined(__WXOSX_COCOA__) && \ + !defined(__WXOSX_IPHONE__) && \ + !defined(__X__) && \ + !defined(__WXDFB__) && \ + !defined(__WXX11__) && \ + !defined(__WXQT__) && \ + wxUSE_GUI +# ifdef __UNIX__ +# error "No Target! You should use wx-config program for compilation flags!" +# else /* !Unix */ +# error "No Target! You should use supplied makefiles for compilation!" +# endif /* Unix/!Unix */ +# endif +#endif /*__cplusplus*/ + +#ifndef __WXWINDOWS__ + #define __WXWINDOWS__ 1 +#endif + +#ifndef wxUSE_BASE + /* by default consider that this is a monolithic build */ + #define wxUSE_BASE 1 +#endif + +#if !wxUSE_GUI && !defined(__WXBASE__) + #define __WXBASE__ +#endif + +/* suppress some Visual C++ warnings */ +#ifdef __VISUALC__ + /* the only "real" warning here is 4244 but there are just too many of them */ + /* in our code... one day someone should go and fix them but until then... */ +# pragma warning(disable:4097) /* typedef used as class */ +# pragma warning(disable:4201) /* nonstandard extension used: nameless struct/union */ +# pragma warning(disable:4244) /* conversion from double to float */ +# pragma warning(disable:4355) /* 'this' used in base member initializer list */ +# pragma warning(disable:4511) /* copy ctor couldn't be generated */ +# pragma warning(disable:4512) /* operator=() couldn't be generated */ +# pragma warning(disable:4514) /* unreferenced inline func has been removed */ +# pragma warning(disable:4710) /* function not inlined */ + + /* + TODO: this warning should really be enabled as it can be genuinely + useful, check where does it occur in wxWidgets + */ + #pragma warning(disable: 4127) /* conditional expression is constant */ + + /* There are too many false positives for this one, particularly when + using templates like wxVector */ + /* class 'foo' needs to have dll-interface to be used by clients of + class 'bar'" */ +# pragma warning(disable:4251) + + /* + This is a similar warning which occurs when deriving from standard + containers. MSDN even mentions that it can be ignored in this case + (albeit only in debug build while the warning is the same in release + too and seems equally harmless). + */ +#if wxUSE_STD_CONTAINERS +# pragma warning(disable:4275) +#endif /* wxUSE_STD_CONTAINERS */ + +# ifdef __VISUALC5__ + /* For VC++ 5.0 for release mode, the warning 'C4702: unreachable code */ + /* is buggy, and occurs for code that does actually get executed */ +# ifndef __WXDEBUG__ +# pragma warning(disable:4702) /* unreachable code */ +# endif + + /* The VC++ 5.0 warning 'C4003: not enough actual parameters for macro' + * is incompatible with the wxWidgets headers since it is given when + * parameters are empty but not missing. */ +# pragma warning(disable:4003) /* not enough actual parameters for macro */ +# endif + + /* + When compiling with VC++ 7 /Wp64 option we get thousands of warnings for + conversion from size_t to int or long. Some precious few of them might + be worth looking into but unfortunately it seems infeasible to fix all + the other, harmless ones (e.g. inserting static_cast(s.length()) + everywhere this method is used though we are quite sure that using >4GB + strings is a bad idea anyhow) so just disable it globally for now. + */ + #if wxCHECK_VISUALC_VERSION(7) + /* conversion from 'size_t' to 'unsigned long', possible loss of data */ + #pragma warning(disable:4267) + #endif /* VC++ 7 or later */ + + /* + VC++ 8 gives a warning when using standard functions such as sprintf, + localtime, ... -- stop this madness, unless the user had already done it + */ + #if wxCHECK_VISUALC_VERSION(8) + #ifndef _CRT_SECURE_NO_DEPRECATE + #define _CRT_SECURE_NO_DEPRECATE 1 + #endif + #ifndef _CRT_NON_CONFORMING_SWPRINTFS + #define _CRT_NON_CONFORMING_SWPRINTFS 1 + #endif + #ifndef _SCL_SECURE_NO_WARNINGS + #define _SCL_SECURE_NO_WARNINGS 1 + #endif + #endif /* VC++ 8 */ +#endif /* __VISUALC__ */ + +/* + g++ gives a warning when a class has private dtor if it has no friends but + this is a perfectly valid situation for a ref-counted class which destroys + itself when its ref count drops to 0, so provide a macro to suppress this + warning + */ +#ifdef __GNUG__ +# define wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(name) \ + friend class wxDummyFriendFor ## name; +#else /* !g++ */ +# define wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(name) +#endif + +/* + Clang Support + */ + +#ifndef WX_HAS_CLANG_FEATURE +# ifndef __has_feature +# define WX_HAS_CLANG_FEATURE(x) 0 +# else +# define WX_HAS_CLANG_FEATURE(x) __has_feature(x) +# endif +#endif + +/* ---------------------------------------------------------------------------- */ +/* wxWidgets version and compatibility defines */ +/* ---------------------------------------------------------------------------- */ + +#include "wx/version.h" + +/* ============================================================================ */ +/* non portable C++ features */ +/* ============================================================================ */ + +/* ---------------------------------------------------------------------------- */ +/* compiler defects workarounds */ +/* ---------------------------------------------------------------------------- */ + +/* + Digital Unix C++ compiler only defines this symbol for .cxx and .hxx files, + so define it ourselves (newer versions do it for all files, though, and + don't allow it to be redefined) + */ +#if defined(__DECCXX) && !defined(__VMS) && !defined(__cplusplus) +#define __cplusplus +#endif /* __DECCXX */ + +/* Resolves linking problems under HP-UX when compiling with gcc/g++ */ +#if defined(__HPUX__) && defined(__GNUG__) +#define va_list __gnuc_va_list +#endif /* HP-UX */ + +/* Prevents conflicts between sys/types.h and winsock.h with Cygwin, */ +/* when using Windows sockets. */ +#if defined(__CYGWIN__) && defined(__WINDOWS__) +#define __USE_W32_SOCKETS +#endif + +#if defined(_MSVC_LANG) +/* + We want to always use the really supported C++ standard when using MSVC + recent enough to define _MSVC_LANG, even if /Zc:__cplusplus option is not + used, but unfortunately we can't just redefine __cplusplus as _MSVC_LANG + because this is not allowed by the standard and, worse, doesn't work in + practice (it results in a warning and nothing else). + + So, instead, we define a macro for testing __cplusplus which also works in + this case. +*/ + #define wxCHECK_CXX_STD(ver) (_MSVC_LANG >= (ver)) +#elif defined(__cplusplus) + #define wxCHECK_CXX_STD(ver) (__cplusplus >= (ver)) +#else + #define wxCHECK_CXX_STD(ver) 0 +#endif + +/* ---------------------------------------------------------------------------- */ +/* check for native bool type and TRUE/FALSE constants */ +/* ---------------------------------------------------------------------------- */ + +/* for backwards compatibility, also define TRUE and FALSE */ +/* */ +/* note that these definitions should work both in C++ and C code, so don't */ +/* use true/false below */ +#ifndef TRUE + #define TRUE 1 +#endif + +#ifndef FALSE + #define FALSE 0 +#endif + +typedef short int WXTYPE; + + +/* ---------------------------------------------------------------------------- */ +/* other feature tests */ +/* ---------------------------------------------------------------------------- */ + +#ifdef __cplusplus + +/* Every ride down a slippery slope begins with a single step.. */ +/* */ +/* Yes, using nested classes is indeed against our coding standards in */ +/* general, but there are places where you can use them to advantage */ +/* without totally breaking ports that cannot use them. If you do, then */ +/* wrap it in this guard, but such cases should still be relatively rare. */ +#define wxUSE_NESTED_CLASSES 1 + +/* This macro is obsolete, use the 'explicit' keyword in the new code. */ +#define wxEXPLICIT explicit + +/* check for override keyword support */ +#ifndef HAVE_OVERRIDE + #if __cplusplus >= 201103L + /* All C++11 compilers should have it. */ + #define HAVE_OVERRIDE + #elif wxCHECK_VISUALC_VERSION(11) + /* + VC++ supports override keyword since version 8 but doesn't define + __cplusplus as indicating C++11 support (at least up to and + including 12), so handle its case specially. + + Also note that while the keyword is supported, using it with + versions 8, 9 and 10 results in C4481 compiler warning ("nonstandard + extension used") and so we avoid using it there, you could disable + this warning and predefine HAVE_OVERRIDE if you don't care about it. + */ + #define HAVE_OVERRIDE + #elif WX_HAS_CLANG_FEATURE(cxx_override_control) + #define HAVE_OVERRIDE + #endif +#endif /* !HAVE_OVERRIDE */ + +#ifdef HAVE_OVERRIDE + #define wxOVERRIDE override +#else /* !HAVE_OVERRIDE */ + #define wxOVERRIDE +#endif /* HAVE_OVERRIDE */ + +/* same for more C++11 keywords which don't have such historic baggage as + override and so can be detected by just testing for C++11 support (which + still requires handling MSVS specially, unfortunately) */ +#if __cplusplus >= 201103L || wxCHECK_VISUALC_VERSION(14) + #define wxHAS_MEMBER_DEFAULT + + // Rvalue references are supported since MSVS 2010, but enabling them + // causes compilation errors on versions before 2015 + // + // And move support in wxString is only available since 3.2.3, so don't + // compile it in when compatibility with older versions is requested. +#if wxABI_VERSION >= 30203 + #define wxHAS_RVALUE_REF +#endif + + #define wxHAS_NOEXCEPT + #define wxNOEXCEPT noexcept +#else + #define wxNOEXCEPT +#endif + +/* + Support for nullptr is available since MSVS 2010, even though it doesn't + define __cplusplus as a C++11 compiler. + */ +#if __cplusplus >= 201103 || wxCHECK_VISUALC_VERSION(10) + #define wxHAS_NULLPTR_T +#endif + +/* wxFALLTHROUGH is used to notate explicit fallthroughs in switch statements */ + +#if wxCHECK_CXX_STD(201703L) + #define wxFALLTHROUGH [[fallthrough]] +#elif __cplusplus >= 201103L && defined(__has_warning) && WX_HAS_CLANG_FEATURE(cxx_attributes) + #define wxFALLTHROUGH [[clang::fallthrough]] +#elif wxCHECK_GCC_VERSION(7, 0) + #define wxFALLTHROUGH __attribute__ ((fallthrough)) +#endif + +#ifndef wxFALLTHROUGH + #define wxFALLTHROUGH ((void)0) +#endif + +/* these macros are obsolete, use the standard C++ casts directly now */ +#define wx_static_cast(t, x) static_cast(x) +#define wx_const_cast(t, x) const_cast(x) +#define wx_reinterpret_cast(t, x) reinterpret_cast(x) + +/* + This one is a wx invention: like static cast but used when we intentionally + truncate from a larger to smaller type, static_cast<> can't be used for it + as it results in warnings when using some compilers (SGI mipspro for example) + */ +#if defined(__INTELC__) + template + inline T wx_truncate_cast_impl(X x) + { + #pragma warning(push) + /* implicit conversion of a 64-bit integral type to a smaller integral type */ + #pragma warning(disable: 1682) + /* conversion from "X" to "T" may lose significant bits */ + #pragma warning(disable: 810) + /* non-pointer conversion from "foo" to "bar" may lose significant bits */ + #pragma warning(disable: 2259) + + return x; + + #pragma warning(pop) + } + + #define wx_truncate_cast(t, x) wx_truncate_cast_impl(x) + +#elif defined(__clang__) + #define wx_truncate_cast(t, x) static_cast(x) + +#elif defined(__VISUALC__) && __VISUALC__ >= 1310 + template + inline T wx_truncate_cast_impl(X x) + { + #pragma warning(push) + /* conversion from 'size_t' to 'type', possible loss of data */ + #pragma warning(disable: 4267) + /* conversion from 'type1' to 'type2', possible loss of data */ + #pragma warning(disable: 4242) + + return x; + + #pragma warning(pop) + } + + #define wx_truncate_cast(t, x) wx_truncate_cast_impl(x) +#else + #define wx_truncate_cast(t, x) ((t)(x)) +#endif + +/* for consistency with wxStatic/DynamicCast defined in wx/object.h */ +#define wxConstCast(obj, className) const_cast(obj) + +#ifndef HAVE_STD_WSTRING + #if __cplusplus >= 201103L + #define HAVE_STD_WSTRING + #elif defined(__VISUALC__) + #define HAVE_STD_WSTRING + #elif defined(__MINGW32__) + #define HAVE_STD_WSTRING + #endif +#endif + +#ifndef HAVE_STD_STRING_COMPARE + #if __cplusplus >= 201103L + #define HAVE_STD_STRING_COMPARE + #elif defined(__VISUALC__) + #define HAVE_STD_STRING_COMPARE + #elif defined(__MINGW32__) || defined(__CYGWIN32__) + #define HAVE_STD_STRING_COMPARE + #endif +#endif + +#ifndef HAVE_TR1_TYPE_TRAITS + #if defined(__VISUALC__) && (_MSC_FULL_VER >= 150030729) + #define HAVE_TR1_TYPE_TRAITS + #endif +#endif + +/* + If using configure, stick to the options detected by it even if different + compiler options could result in detecting something different here, as it + would cause ABI issues otherwise (see #18034). +*/ +#ifndef __WX_SETUP_H__ + /* + Check for C++11 compilers, it is important to do it before the + __has_include() checks because at least g++ 4.9.2+ __has_include() returns + true for C++11 headers which can't be compiled in non-C++11 mode. + */ + #if __cplusplus >= 201103L || wxCHECK_VISUALC_VERSION(10) + #ifndef HAVE_TYPE_TRAITS + #define HAVE_TYPE_TRAITS + #endif + #ifndef HAVE_STD_UNORDERED_MAP + #define HAVE_STD_UNORDERED_MAP + #endif + #ifndef HAVE_STD_UNORDERED_SET + #define HAVE_STD_UNORDERED_SET + #endif + #elif defined(__has_include) + /* + We're in non-C++11 mode here, so only test for pre-C++11 headers. As + mentioned above, using __has_include() to test for C++11 would wrongly + detect them even though they can't be used in this case, don't do it. + */ + #if !defined(HAVE_TR1_TYPE_TRAITS) && __has_include() + #define HAVE_TR1_TYPE_TRAITS + #endif + + #if !defined(HAVE_TR1_UNORDERED_MAP) && __has_include() + #define HAVE_TR1_UNORDERED_MAP + #endif + + #if !defined(HAVE_TR1_UNORDERED_SET) && __has_include() + #define HAVE_TR1_UNORDERED_SET + #endif + #endif /* defined(__has_include) */ +#endif /* !__WX_SETUP_H__ */ + +// Allow disabling the use of std::initializer_list<> if it creates overload +// ambiguities for the existing code by predefining wxNO_INITIALIZER_LIST and +// also always predefine this symbol when ABI compatibility with versions +// before support for std::initializer_list<> was added is requested. +#if wxABI_VERSION < 30205 + #ifndef wxNO_INITIALIZER_LIST + #define wxNO_INITIALIZER_LIST + #endif +#endif /* wxABI_VERSION < 30205 */ + +#if !defined(wxHAVE_INITIALIZER_LIST) && !defined(wxNO_INITIALIZER_LIST) + #if __cplusplus >= 201103L + #define wxHAVE_INITIALIZER_LIST + #elif wxCHECK_VISUALC_VERSION(12) + #define wxHAVE_INITIALIZER_LIST + #endif +#endif /* !wxHAVE_INITIALIZER_LIST && !wxNO_INITIALIZER_LIST */ + +#endif /* __cplusplus */ + +/* provide replacement for C99 va_copy() if the compiler doesn't have it */ + +/* could be already defined by configure or the user */ +#ifndef wxVaCopy + /* if va_copy is a macro or configure detected that we have it, use it */ + #if defined(va_copy) || defined(HAVE_VA_COPY) + #define wxVaCopy va_copy + #else /* no va_copy, try to provide a replacement */ + /* + configure tries to determine whether va_list is an array or struct + type, but it may not be used under Windows, so deal with a few + special cases. + */ + + #if defined(__PPC__) && (defined(_CALL_SYSV) || defined (_WIN32)) + /* + PPC using SysV ABI and NT/PPC are special in that they use an + extra level of indirection. + */ + #define VA_LIST_IS_POINTER + #endif /* SysV or Win32 on __PPC__ */ + + /* + note that we use memmove(), not memcpy(), in case anybody tries + to do wxVaCopy(ap, ap) + */ + #if defined(VA_LIST_IS_POINTER) + #define wxVaCopy(d, s) memmove(*(d), *(s), sizeof(va_list)) + #elif defined(VA_LIST_IS_ARRAY) + #define wxVaCopy(d, s) memmove((d), (s), sizeof(va_list)) + #else /* we can only hope that va_lists are simple lvalues */ + #define wxVaCopy(d, s) ((d) = (s)) + #endif + #endif /* va_copy/!va_copy */ +#endif /* wxVaCopy */ + +#ifndef HAVE_WOSTREAM + /* + Cygwin is the only platform which doesn't have std::wostream + */ + #if !defined(__CYGWIN__) + #define HAVE_WOSTREAM + #endif +#endif /* HAVE_WOSTREAM */ + +/* ---------------------------------------------------------------------------- */ +/* portable calling conventions macros */ +/* ---------------------------------------------------------------------------- */ + +/* stdcall is used for all functions called by Windows under Windows */ +#if defined(__WINDOWS__) + #if defined(__GNUWIN32__) + #define wxSTDCALL __attribute__((stdcall)) + #else + #define wxSTDCALL _stdcall + #endif + +#else /* Win */ + /* no such stupidness under Unix */ + #define wxSTDCALL +#endif /* platform */ + +/* LINKAGEMODE mode is most likely empty everywhere */ +#ifndef LINKAGEMODE + #define LINKAGEMODE +#endif /* LINKAGEMODE */ + +/* wxCALLBACK should be used for the functions which are called back by */ +/* Windows (such as compare function for wxListCtrl) */ +#if defined(__WIN32__) + #define wxCALLBACK wxSTDCALL +#else + /* no stdcall under Unix nor Win16 */ + #define wxCALLBACK +#endif /* platform */ + +/* generic calling convention for the extern "C" functions */ + +#if defined(__VISUALC__) + #define wxC_CALLING_CONV _cdecl +#else /* !Visual C++ */ + #define wxC_CALLING_CONV +#endif /* compiler */ + +/* calling convention for the qsort(3) callback */ +#define wxCMPFUNC_CONV wxC_CALLING_CONV + +/* compatibility :-( */ +#define CMPFUNC_CONV wxCMPFUNC_CONV + +/* DLL import/export declarations */ +#include "wx/dlimpexp.h" + +/* ---------------------------------------------------------------------------- */ +/* Very common macros */ +/* ---------------------------------------------------------------------------- */ + +/* Printf-like attribute definitions to obtain warnings with GNU C/C++ */ +#if defined(__GNUC__) && !wxUSE_UNICODE +# define WX_ATTRIBUTE_FORMAT(like, m, n) __attribute__ ((__format__ (like, m, n))) +#else +# define WX_ATTRIBUTE_FORMAT(like, m, n) +#endif + +#ifndef WX_ATTRIBUTE_PRINTF +# define WX_ATTRIBUTE_PRINTF(m, n) WX_ATTRIBUTE_FORMAT(__printf__, m, n) + +# define WX_ATTRIBUTE_PRINTF_1 WX_ATTRIBUTE_PRINTF(1, 2) +# define WX_ATTRIBUTE_PRINTF_2 WX_ATTRIBUTE_PRINTF(2, 3) +# define WX_ATTRIBUTE_PRINTF_3 WX_ATTRIBUTE_PRINTF(3, 4) +# define WX_ATTRIBUTE_PRINTF_4 WX_ATTRIBUTE_PRINTF(4, 5) +# define WX_ATTRIBUTE_PRINTF_5 WX_ATTRIBUTE_PRINTF(5, 6) +#endif /* !defined(WX_ATTRIBUTE_PRINTF) */ + +#ifndef WX_ATTRIBUTE_NORETURN +# if WX_HAS_CLANG_FEATURE(attribute_analyzer_noreturn) +# define WX_ATTRIBUTE_NORETURN __attribute__((analyzer_noreturn)) +# elif defined( __GNUC__ ) +# define WX_ATTRIBUTE_NORETURN __attribute__ ((noreturn)) +# elif defined(__VISUALC__) +# define WX_ATTRIBUTE_NORETURN __declspec(noreturn) +# else +# define WX_ATTRIBUTE_NORETURN +# endif +#endif + +#if defined(__GNUC__) + #define WX_ATTRIBUTE_UNUSED __attribute__ ((unused)) +#else + #define WX_ATTRIBUTE_UNUSED +#endif + +/* + Macros for marking functions as being deprecated. + + The preferred macro in the new code is wxDEPRECATED_ATTR() which expands to + the standard [[deprecated]] attribute if supported and allows to explain + why is the function deprecated. If supporting older compilers is important, + wxDEPRECATED_MSG() can be used as it's almost universally available and + still allows to explain the reason for the deprecation. + + However almost all the existing code uses the older wxDEPRECATED() or its + variants currently, but this will hopefully change in the future. + */ + +#if defined(__has_cpp_attribute) + #if __has_cpp_attribute(deprecated) + /* gcc 5 claims to support this attribute, but actually doesn't */ + #if !defined(__GNUC__) || wxCHECK_GCC_VERSION(6, 0) + /* Even later gcc versions only support it when using C++11. */ + #ifdef __cplusplus + #if __cplusplus >= 201103L + #define wxHAS_DEPRECATED_ATTR + #endif + #endif + #endif + #endif +#endif + +/* The basic compiler-specific construct to generate a deprecation warning. */ +#ifdef wxHAS_DEPRECATED_ATTR + #define wxDEPRECATED_DECL [[deprecated]] +#elif defined(__clang__) + #define wxDEPRECATED_DECL __attribute__((deprecated)) +#elif defined(__GNUC__) + #define wxDEPRECATED_DECL __attribute__((deprecated)) +#elif defined(__VISUALC__) + #define wxDEPRECATED_DECL __declspec(deprecated) +#else + #define wxDEPRECATED_DECL +#endif + +#ifdef wxHAS_DEPRECATED_ATTR + #define wxDEPRECATED_ATTR(msg) [[deprecated(msg)]] +#else + /* + Note that we can't fall back on wxDEPRECATED_DECL here, as the standard + attribute works in places where the compiler-specific one don't, + notably it can be used after enumerator declaration with MSVC, while + __declspec(deprecated) can't occur there as it can only be used before + the declaration. + */ + #define wxDEPRECATED_ATTR(msg) +#endif + +/* + Macro taking the deprecation message. It applies to the next declaration. + + If the compiler doesn't support showing the message, this degrades to a + simple wxDEPRECATED(), i.e. at least gives a warning, if possible. + */ +#ifdef wxHAS_DEPRECATED_ATTR + #define wxDEPRECATED_MSG(msg) [[deprecated(msg)]] +#elif defined(__clang__) && defined(__has_extension) + #if __has_extension(attribute_deprecated_with_message) + #define wxDEPRECATED_MSG(msg) __attribute__((deprecated(msg))) + #else + #define wxDEPRECATED_MSG(msg) __attribute__((deprecated)) + #endif +#elif wxCHECK_GCC_VERSION(4, 5) + #define wxDEPRECATED_MSG(msg) __attribute__((deprecated(msg))) +#elif wxCHECK_VISUALC_VERSION(8) + #define wxDEPRECATED_MSG(msg) __declspec(deprecated("deprecated: " msg)) +#else + #define wxDEPRECATED_MSG(msg) wxDEPRECATED_DECL +#endif + +/* + Macro taking the declaration that it deprecates. Prefer to use + wxDEPRECATED_MSG() instead as it's simpler (wrapping the entire declaration + makes the code unclear) and allows to specify the explanation. + */ +#define wxDEPRECATED(x) wxDEPRECATED_DECL x + +/* + This macro used to be defined differently for gcc < 3.4, but we don't + support it any more, so it's just the same thing as wxDEPRECATED now. + */ +#define wxDEPRECATED_CONSTRUCTOR(x) wxDEPRECATED(x) + +/* + Macro which marks the function as being deprecated but also defines it + inline. + + Currently it's defined in the same trivial way in all cases but it could + need a special definition with some other compilers in the future which + explains why do we have it. + */ +#define wxDEPRECATED_INLINE(func, body) wxDEPRECATED(func) { body } + +/* + A macro to define a simple deprecated accessor. + */ +#define wxDEPRECATED_ACCESSOR(func, what) wxDEPRECATED_INLINE(func, return what;) + +/* + Special variant of the macro above which should be used for the functions + which are deprecated but called by wx itself: this often happens with + deprecated virtual functions which are called by the library. + */ +#ifdef WXBUILDING +# define wxDEPRECATED_BUT_USED_INTERNALLY(x) x +#else +# define wxDEPRECATED_BUT_USED_INTERNALLY(x) wxDEPRECATED(x) +#endif + +/* + Some gcc versions choke on __has_cpp_attribute(gnu::visibility) due to the + presence of the colon, but we only need this macro in C++ code, so just + don't define it when using C. + */ +#ifdef __cplusplus + +/* + wxDEPRECATED_EXPORT_CORE is a special macro used for the classes that are + exported and deprecated (but not when building the library itself, as this + would trigger warnings about using this class when implementing it). + + It exists because standard [[deprecated]] attribute can't be combined with + legacy __attribute__((visibility)), but we can't use [[visibility]] instead + of the latter because it can't be use in the same place in the declarations + where we use WXDLLIMPEXP_CORE. So we define this special macro which uses + the standard visibility attribute just where we can't do otherwise. + */ +#ifdef WXBUILDING + #define wxDEPRECATED_EXPORT_CORE(msg) WXDLLIMPEXP_CORE +#else /* !WXBUILDING */ + #ifdef wxHAS_DEPRECATED_ATTR + #if __has_cpp_attribute(gnu::visibility) + #define wxDEPRECATED_EXPORT_CORE(msg) \ + [[deprecated(msg), gnu::visibility("default")]] + #endif + #endif + + #ifndef wxDEPRECATED_EXPORT_CORE + /* Fall back when nothing special is needed or available. */ + #define wxDEPRECATED_EXPORT_CORE(msg) \ + wxDEPRECATED_MSG(msg) WXDLLIMPEXP_CORE + #endif +#endif /* WXBUILDING/!WXBUILDING */ + +#endif /* __cplusplus */ + +/* + Macros to suppress and restore gcc warnings, requires g++ >= 4.6 and don't + do anything otherwise. + + Example of use: + + wxGCC_WARNING_SUPPRESS(float-equal) + inline bool wxIsSameDouble(double x, double y) { return x == y; } + wxGCC_WARNING_RESTORE(float-equal) + + Note that these macros apply to both gcc and clang, even though they only + have "GCC" in their names. + */ +#if defined(__clang__) || wxCHECK_GCC_VERSION(4, 6) +# define wxGCC_WARNING_SUPPRESS(x) \ + _Pragma (wxSTRINGIZE(GCC diagnostic push)) \ + _Pragma (wxSTRINGIZE(GCC diagnostic ignored wxSTRINGIZE(wxCONCAT(-W,x)))) +# define wxGCC_WARNING_RESTORE(x) \ + _Pragma (wxSTRINGIZE(GCC diagnostic pop)) +#else /* gcc < 4.6 or not gcc and not clang at all */ +# define wxGCC_WARNING_SUPPRESS(x) +# define wxGCC_WARNING_RESTORE(x) +#endif + +/* + Similar macros but for gcc-specific warnings. + */ +#if defined(__GNUC__) && !defined(__clang__) +# define wxGCC_ONLY_WARNING_SUPPRESS(x) wxGCC_WARNING_SUPPRESS(x) +# define wxGCC_ONLY_WARNING_RESTORE(x) wxGCC_WARNING_RESTORE(x) +#else +# define wxGCC_ONLY_WARNING_SUPPRESS(x) +# define wxGCC_ONLY_WARNING_RESTORE(x) +#endif + +/* Specific macros for -Wcast-function-type warning new in gcc 8. */ +#if wxCHECK_GCC_VERSION(8, 0) + #define wxGCC_WARNING_SUPPRESS_CAST_FUNCTION_TYPE() \ + wxGCC_WARNING_SUPPRESS(cast-function-type) + #define wxGCC_WARNING_RESTORE_CAST_FUNCTION_TYPE() \ + wxGCC_WARNING_RESTORE(cast-function-type) +#else + #define wxGCC_WARNING_SUPPRESS_CAST_FUNCTION_TYPE() + #define wxGCC_WARNING_RESTORE_CAST_FUNCTION_TYPE() +#endif + +/* + Macros to suppress and restore clang warning only when it is valid. + + Example: + wxCLANG_WARNING_SUPPRESS(inconsistent-missing-override) + virtual wxClassInfo *GetClassInfo() const + wxCLANG_WARNING_RESTORE(inconsistent-missing-override) +*/ +#if defined(__clang__) && defined(__has_warning) +# define wxCLANG_HAS_WARNING(x) __has_warning(x) /* allow macro expansion for the warning name */ +# define wxCLANG_IF_VALID_WARNING(x,y) \ + wxCONCAT(wxCLANG_IF_VALID_WARNING_,wxCLANG_HAS_WARNING(wxSTRINGIZE(wxCONCAT(-W,x))))(y) +# define wxCLANG_IF_VALID_WARNING_0(x) +# define wxCLANG_IF_VALID_WARNING_1(x) x +# define wxCLANG_WARNING_SUPPRESS(x) \ + wxCLANG_IF_VALID_WARNING(x,wxGCC_WARNING_SUPPRESS(x)) +# define wxCLANG_WARNING_RESTORE(x) \ + wxCLANG_IF_VALID_WARNING(x,wxGCC_WARNING_RESTORE(x)) +#else +# define wxCLANG_WARNING_SUPPRESS(x) +# define wxCLANG_WARNING_RESTORE(x) +#endif + +/* + Specific macro for disabling warnings related to not using override: this + has to be done differently for gcc and clang and is only supported since + gcc 5.1. + */ +#if defined(__clang__) +# define wxWARNING_SUPPRESS_MISSING_OVERRIDE() \ + wxCLANG_WARNING_SUPPRESS(suggest-override) \ + wxCLANG_WARNING_SUPPRESS(inconsistent-missing-override) +# define wxWARNING_RESTORE_MISSING_OVERRIDE() \ + wxCLANG_WARNING_RESTORE(inconsistent-missing-override) \ + wxCLANG_WARNING_RESTORE(suggest-override) +#elif wxCHECK_GCC_VERSION(5, 1) +# define wxWARNING_SUPPRESS_MISSING_OVERRIDE() \ + wxGCC_WARNING_SUPPRESS(suggest-override) +# define wxWARNING_RESTORE_MISSING_OVERRIDE() \ + wxGCC_WARNING_RESTORE(suggest-override) +#else +# define wxWARNING_SUPPRESS_MISSING_OVERRIDE() +# define wxWARNING_RESTORE_MISSING_OVERRIDE() +#endif + +/* + Macros above don't work with gcc 11 due to a compiler bug, unless we also + use "override" in the function declaration -- but this breaks other + compilers, so define a specific macro for gcc 11 only. + */ +#if wxCHECK_GCC_VERSION(11, 0) +# define wxDUMMY_OVERRIDE wxOVERRIDE +#else +# define wxDUMMY_OVERRIDE +#endif + +/* + Combination of the two variants above: should be used for deprecated + functions which are defined inline and are used by wxWidgets itself. + */ +#ifdef WXBUILDING +# define wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(func, body) func { body } +#else +# define wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(func, body) \ + wxDEPRECATED(func) { body } +#endif + +/* NULL declaration: it must be defined as 0 for C++ programs (in particular, */ +/* it must not be defined as "(void *)0" which is standard for C but completely */ +/* breaks C++ code) */ +#include + +/* size of statically declared array */ +#define WXSIZEOF(array) (sizeof(array)/sizeof(array[0])) + +/* symbolic constant used by all Find()-like functions returning positive */ +/* integer on success as failure indicator */ +#define wxNOT_FOUND (-1) + +/* the default value for some length parameters meaning that the string is */ +/* NUL-terminated */ +#define wxNO_LEN ((size_t)-1) + +/* ---------------------------------------------------------------------------- */ +/* macros dealing with comparison operators */ +/* ---------------------------------------------------------------------------- */ + +/* + Expands into m(op, args...) for each op in the set { ==, !=, <, <=, >, >= }. + */ +#define wxFOR_ALL_COMPARISONS(m) \ + m(==) m(!=) m(>=) m(<=) m(>) m(<) + +#define wxFOR_ALL_COMPARISONS_1(m, x) \ + m(==,x) m(!=,x) m(>=,x) m(<=,x) m(>,x) m(<,x) + +#define wxFOR_ALL_COMPARISONS_2(m, x, y) \ + m(==,x,y) m(!=,x,y) m(>=,x,y) m(<=,x,y) m(>,x,y) m(<,x,y) + +#define wxFOR_ALL_COMPARISONS_3(m, x, y, z) \ + m(==,x,y,z) m(!=,x,y,z) m(>=,x,y,z) m(<=,x,y,z) m(>,x,y,z) m(<,x,y,z) + +/* + These are only used with wxDEFINE_COMPARISON_[BY_]REV: they pass both the + normal and the reversed comparison operators to the macro. + */ +#define wxFOR_ALL_COMPARISONS_2_REV(m, x, y) \ + m(==,x,y,==) m(!=,x,y,!=) m(>=,x,y,<=) \ + m(<=,x,y,>=) m(>,x,y,<) m(<,x,y,>) + +#define wxFOR_ALL_COMPARISONS_3_REV(m, x, y, z) \ + m(==,x,y,z,==) m(!=,x,y,z,!=) m(>=,x,y,z,<=) \ + m(<=,x,y,z,>=) m(>,x,y,z,<) m(<,x,y,z,>) + + +#define wxDEFINE_COMPARISON(op, T1, T2, cmp) \ + inline bool operator op(T1 x, T2 y) { return cmp(x, y, op); } + +#define wxDEFINE_COMPARISON_REV(op, T1, T2, cmp, oprev) \ + inline bool operator op(T2 y, T1 x) { return cmp(x, y, oprev); } + +#define wxDEFINE_COMPARISON_BY_REV(op, T1, T2, oprev) \ + inline bool operator op(T1 x, T2 y) { return y oprev x; } + +/* + Define all 6 comparison operators (==, !=, <, <=, >, >=) for the given + types in the specified order. The implementation is provided by the cmp + macro. Normally wxDEFINE_ALL_COMPARISONS should be used as comparison + operators are usually symmetric. + */ +#define wxDEFINE_COMPARISONS(T1, T2, cmp) \ + wxFOR_ALL_COMPARISONS_3(wxDEFINE_COMPARISON, T1, T2, cmp) + +/* + Define all 6 comparison operators (==, !=, <, <=, >, >=) for the given + types in the specified order, implemented in terms of existing operators + for the reverse order. + */ +#define wxDEFINE_COMPARISONS_BY_REV(T1, T2) \ + wxFOR_ALL_COMPARISONS_2_REV(wxDEFINE_COMPARISON_BY_REV, T1, T2) + +/* + This macro allows to define all 12 comparison operators (6 operators for + both orders of arguments) for the given types using the provided "cmp" + macro to implement the actual comparison: the macro is called with the 2 + arguments names, the first of type T1 and the second of type T2, and the + comparison operator being implemented. + */ +#define wxDEFINE_ALL_COMPARISONS(T1, T2, cmp) \ + wxFOR_ALL_COMPARISONS_3(wxDEFINE_COMPARISON, T1, T2, cmp) \ + wxFOR_ALL_COMPARISONS_3_REV(wxDEFINE_COMPARISON_REV, T1, T2, cmp) + +/* ---------------------------------------------------------------------------- */ +/* macros to avoid compiler warnings */ +/* ---------------------------------------------------------------------------- */ + +/* Macro to cut down on compiler warnings. */ +#if 1 /* there should be no more any compilers needing the "#else" version */ + #define WXUNUSED(identifier) /* identifier */ +#else /* stupid, broken compiler */ + #define WXUNUSED(identifier) identifier +#endif + +/* some arguments are not used in unicode mode */ +#if wxUSE_UNICODE + #define WXUNUSED_IN_UNICODE(param) WXUNUSED(param) +#else + #define WXUNUSED_IN_UNICODE(param) param +#endif + +/* unused parameters in non stream builds */ +#if wxUSE_STREAMS + #define WXUNUSED_UNLESS_STREAMS(param) param +#else + #define WXUNUSED_UNLESS_STREAMS(param) WXUNUSED(param) +#endif + +/* some compilers give warning about a possibly unused variable if it is */ +/* initialized in both branches of if/else and shut up if it is initialized */ +/* when declared, but other compilers then give warnings about unused variable */ +/* value -- this should satisfy both of them */ +#if defined(__VISUALC__) + #define wxDUMMY_INITIALIZE(val) = val +#else + #define wxDUMMY_INITIALIZE(val) +#endif + +/* sometimes the value of a variable is *really* not used, to suppress the */ +/* resulting warning you may pass it to this function */ +#ifdef __cplusplus + template + inline void wxUnusedVar(const T& WXUNUSED(t)) { } +#endif + +/* ---------------------------------------------------------------------------- */ +/* compiler specific settings */ +/* ---------------------------------------------------------------------------- */ + +/* where should i put this? we need to make sure of this as it breaks */ +/* the code. */ +#if defined(__WXDEBUG__) +# undef wxUSE_DEBUG_NEW_ALWAYS +# define wxUSE_DEBUG_NEW_ALWAYS 0 +#endif + +#include "wx/types.h" + +#ifdef __cplusplus + +// everybody gets the assert and other debug macros +#include "wx/debug.h" + + // delete pointer if it is not NULL and NULL it afterwards + template + inline void wxDELETE(T*& ptr) + { + typedef char TypeIsCompleteCheck[sizeof(T)] WX_ATTRIBUTE_UNUSED; + + if ( ptr != NULL ) + { + delete ptr; + ptr = NULL; + } + } + + // delete an array and NULL it (see comments above) + template + inline void wxDELETEA(T*& ptr) + { + typedef char TypeIsCompleteCheck[sizeof(T)] WX_ATTRIBUTE_UNUSED; + + if ( ptr != NULL ) + { + delete [] ptr; + ptr = NULL; + } + } + + // trivial implementation of std::swap() for primitive types + template + inline void wxSwap(T& first, T& second) + { + T tmp(first); + first = second; + second = tmp; + } + +/* And also define a couple of simple functions to cast pointer to/from it. */ +inline wxUIntPtr wxPtrToUInt(const void *p) +{ + /* + VC++ 7.1 gives warnings about casts such as below even when they're + explicit with /Wp64 option, suppress them as we really know what we're + doing here. Same thing with icc with -Wall. + */ +#ifdef __VISUALC__ + #pragma warning(push) + /* pointer truncation from '' to '' */ + #pragma warning(disable: 4311) +#elif defined(__INTELC__) + #pragma warning(push) + /* conversion from pointer to same-sized integral type */ + #pragma warning(disable: 1684) +#endif + + return reinterpret_cast(p); + +#if defined(__VISUALC__) || defined(__INTELC__) + #pragma warning(pop) +#endif +} + +inline void *wxUIntToPtr(wxUIntPtr p) +{ +#ifdef __VISUALC__ + #pragma warning(push) + /* conversion to type of greater size */ + #pragma warning(disable: 4312) +#elif defined(__INTELC__) + #pragma warning(push) + /* invalid type conversion: "wxUIntPtr={unsigned long}" to "void *" */ + #pragma warning(disable: 171) +#endif + + return reinterpret_cast(p); + +#if defined(__VISUALC__) || defined(__INTELC__) + #pragma warning(pop) +#endif +} +#endif /*__cplusplus*/ + + + +/* base floating point types */ +/* wxFloat32: 32 bit IEEE float ( 1 sign, 8 exponent bits, 23 fraction bits ) */ +/* wxFloat64: 64 bit IEEE float ( 1 sign, 11 exponent bits, 52 fraction bits ) */ +/* wxDouble: native fastest representation that has at least wxFloat64 */ +/* precision, so use the IEEE types for storage, and this for */ +/* calculations */ + +typedef float wxFloat32; +typedef double wxFloat64; + +typedef double wxDouble; + +/* + Some (non standard) compilers typedef wchar_t as an existing type instead + of treating it as a real fundamental type, set wxWCHAR_T_IS_REAL_TYPE to 0 + for them and to 1 for all the others. + */ +#ifndef wxWCHAR_T_IS_REAL_TYPE + /* + VC++ typedefs wchar_t as unsigned short by default until VC8, that is + unless /Za or /Zc:wchar_t option is used in which case _WCHAR_T_DEFINED + is defined. + */ +# if defined(__VISUALC__) && !defined(_NATIVE_WCHAR_T_DEFINED) +# define wxWCHAR_T_IS_REAL_TYPE 0 +# else /* compiler having standard-conforming wchar_t */ +# define wxWCHAR_T_IS_REAL_TYPE 1 +# endif +#endif /* !defined(wxWCHAR_T_IS_REAL_TYPE) */ + +/* Helper macro for doing something dependent on whether wchar_t is or isn't a + typedef inside another macro. */ +#if wxWCHAR_T_IS_REAL_TYPE + #define wxIF_WCHAR_T_TYPE(x) x +#else /* !wxWCHAR_T_IS_REAL_TYPE */ + #define wxIF_WCHAR_T_TYPE(x) +#endif /* wxWCHAR_T_IS_REAL_TYPE/!wxWCHAR_T_IS_REAL_TYPE */ + +/* + This constant should be used instead of NULL in vararg functions taking + wxChar* arguments: passing NULL (which is the same as 0, unless the compiler + defines it specially, e.g. like gcc does with its __null built-in) doesn't + work in this case as va_arg() wouldn't interpret the integer 0 correctly + when trying to convert it to a pointer on architectures where sizeof(int) is + strictly less than sizeof(void *). + + Examples of places where this must be used include wxFileTypeInfo ctor. + */ +#define wxNullPtr ((void *)NULL) + + +/* Define wxChar16 and wxChar32 */ + +#if SIZEOF_WCHAR_T == 2 + #define wxWCHAR_T_IS_WXCHAR16 + typedef wchar_t wxChar16; +#else + typedef wxUint16 wxChar16; +#endif + +#if SIZEOF_WCHAR_T == 4 + #define wxWCHAR_T_IS_WXCHAR32 + typedef wchar_t wxChar32; +#else + typedef wxUint32 wxChar32; +#endif + + +/* + Helper macro expanding into the given "m" macro invoked with each of the + integer types as parameter (notice that this does not include char/unsigned + char and bool but does include wchar_t). + */ +#define wxDO_FOR_INT_TYPES(m) \ + m(short) \ + m(unsigned short) \ + m(int) \ + m(unsigned int) \ + m(long) \ + m(unsigned long) \ + wxIF_LONG_LONG_TYPE( m(wxLongLong_t) ) \ + wxIF_LONG_LONG_TYPE( m(wxULongLong_t) ) \ + wxIF_WCHAR_T_TYPE( m(wchar_t) ) + +/* + Same as wxDO_FOR_INT_TYPES() but does include char and unsigned char. + + Notice that we use "char" and "unsigned char" here but not "signed char" + which would be more correct as "char" could be unsigned by default. But + wxWidgets code currently supposes that char is signed and we'd need to + clean up assumptions about it, notably in wx/unichar.h, to be able to use + "signed char" here. + */ +#define wxDO_FOR_CHAR_INT_TYPES(m) \ + m(char) \ + m(unsigned char) \ + wxDO_FOR_INT_TYPES(m) + +/* + Same as wxDO_FOR_INT_TYPES() above except that m macro takes the + type as the first argument and some extra argument, passed from this macro + itself, as the second one. + */ +#define wxDO_FOR_INT_TYPES_1(m, arg) \ + m(short, arg) \ + m(unsigned short, arg) \ + m(int, arg) \ + m(unsigned int, arg) \ + m(long, arg) \ + m(unsigned long, arg) \ + wxIF_LONG_LONG_TYPE( m(wxLongLong_t, arg) ) \ + wxIF_LONG_LONG_TYPE( m(wxULongLong_t, arg) ) \ + wxIF_WCHAR_T_TYPE( m(wchar_t, arg) ) + +/* + Combination of wxDO_FOR_CHAR_INT_TYPES() and wxDO_FOR_INT_TYPES_1(): + invokes the given macro with the specified argument as its second parameter + for all char and int types. + */ +#define wxDO_FOR_CHAR_INT_TYPES_1(m, arg) \ + m(char, arg) \ + m(unsigned char, arg) \ + wxDO_FOR_INT_TYPES_1(m, arg) + + +/* ---------------------------------------------------------------------------- */ +/* byte ordering related definition and macros */ +/* ---------------------------------------------------------------------------- */ + +/* byte sex */ + +#define wxBIG_ENDIAN 4321 +#define wxLITTLE_ENDIAN 1234 +#define wxPDP_ENDIAN 3412 + +#ifdef WORDS_BIGENDIAN +#define wxBYTE_ORDER wxBIG_ENDIAN +#else +#define wxBYTE_ORDER wxLITTLE_ENDIAN +#endif + +/* byte swapping */ + +#define wxUINT16_SWAP_ALWAYS(val) \ + ((wxUint16) ( \ + (((wxUint16) (val) & (wxUint16) 0x00ffU) << 8) | \ + (((wxUint16) (val) & (wxUint16) 0xff00U) >> 8))) + +#define wxINT16_SWAP_ALWAYS(val) \ + ((wxInt16) ( \ + (((wxUint16) (val) & (wxUint16) 0x00ffU) << 8) | \ + (((wxUint16) (val) & (wxUint16) 0xff00U) >> 8))) + +#define wxUINT32_SWAP_ALWAYS(val) \ + ((wxUint32) ( \ + (((wxUint32) (val) & (wxUint32) 0x000000ffU) << 24) | \ + (((wxUint32) (val) & (wxUint32) 0x0000ff00U) << 8) | \ + (((wxUint32) (val) & (wxUint32) 0x00ff0000U) >> 8) | \ + (((wxUint32) (val) & (wxUint32) 0xff000000U) >> 24))) + +#define wxINT32_SWAP_ALWAYS(val) \ + ((wxInt32) ( \ + (((wxUint32) (val) & (wxUint32) 0x000000ffU) << 24) | \ + (((wxUint32) (val) & (wxUint32) 0x0000ff00U) << 8) | \ + (((wxUint32) (val) & (wxUint32) 0x00ff0000U) >> 8) | \ + (((wxUint32) (val) & (wxUint32) 0xff000000U) >> 24))) +/* machine specific byte swapping */ + +#ifdef wxLongLong_t + #define wxUINT64_SWAP_ALWAYS(val) \ + ((wxUint64) ( \ + (((wxUint64) (val) & (wxUint64) wxULL(0x00000000000000ff)) << 56) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0x000000000000ff00)) << 40) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0x0000000000ff0000)) << 24) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0x00000000ff000000)) << 8) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0x000000ff00000000)) >> 8) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0x0000ff0000000000)) >> 24) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0x00ff000000000000)) >> 40) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0xff00000000000000)) >> 56))) + + #define wxINT64_SWAP_ALWAYS(val) \ + ((wxInt64) ( \ + (((wxUint64) (val) & (wxUint64) wxULL(0x00000000000000ff)) << 56) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0x000000000000ff00)) << 40) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0x0000000000ff0000)) << 24) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0x00000000ff000000)) << 8) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0x000000ff00000000)) >> 8) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0x0000ff0000000000)) >> 24) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0x00ff000000000000)) >> 40) | \ + (((wxUint64) (val) & (wxUint64) wxULL(0xff00000000000000)) >> 56))) +#elif wxUSE_LONGLONG /* !wxLongLong_t */ + #define wxUINT64_SWAP_ALWAYS(val) \ + ((wxUint64) ( \ + ((wxULongLong(val) & wxULongLong(0L, 0x000000ffU)) << 56) | \ + ((wxULongLong(val) & wxULongLong(0L, 0x0000ff00U)) << 40) | \ + ((wxULongLong(val) & wxULongLong(0L, 0x00ff0000U)) << 24) | \ + ((wxULongLong(val) & wxULongLong(0L, 0xff000000U)) << 8) | \ + ((wxULongLong(val) & wxULongLong(0x000000ffL, 0U)) >> 8) | \ + ((wxULongLong(val) & wxULongLong(0x0000ff00L, 0U)) >> 24) | \ + ((wxULongLong(val) & wxULongLong(0x00ff0000L, 0U)) >> 40) | \ + ((wxULongLong(val) & wxULongLong(0xff000000L, 0U)) >> 56))) + + #define wxINT64_SWAP_ALWAYS(val) \ + ((wxInt64) ( \ + ((wxLongLong(val) & wxLongLong(0L, 0x000000ffU)) << 56) | \ + ((wxLongLong(val) & wxLongLong(0L, 0x0000ff00U)) << 40) | \ + ((wxLongLong(val) & wxLongLong(0L, 0x00ff0000U)) << 24) | \ + ((wxLongLong(val) & wxLongLong(0L, 0xff000000U)) << 8) | \ + ((wxLongLong(val) & wxLongLong(0x000000ffL, 0U)) >> 8) | \ + ((wxLongLong(val) & wxLongLong(0x0000ff00L, 0U)) >> 24) | \ + ((wxLongLong(val) & wxLongLong(0x00ff0000L, 0U)) >> 40) | \ + ((wxLongLong(val) & wxLongLong(0xff000000L, 0U)) >> 56))) +#endif /* wxLongLong_t/!wxLongLong_t */ + +#ifdef WORDS_BIGENDIAN + #define wxUINT16_SWAP_ON_BE(val) wxUINT16_SWAP_ALWAYS(val) + #define wxINT16_SWAP_ON_BE(val) wxINT16_SWAP_ALWAYS(val) + #define wxUINT16_SWAP_ON_LE(val) (val) + #define wxINT16_SWAP_ON_LE(val) (val) + #define wxUINT32_SWAP_ON_BE(val) wxUINT32_SWAP_ALWAYS(val) + #define wxINT32_SWAP_ON_BE(val) wxINT32_SWAP_ALWAYS(val) + #define wxUINT32_SWAP_ON_LE(val) (val) + #define wxINT32_SWAP_ON_LE(val) (val) + #if wxHAS_INT64 + #define wxUINT64_SWAP_ON_BE(val) wxUINT64_SWAP_ALWAYS(val) + #define wxUINT64_SWAP_ON_LE(val) (val) + #define wxINT64_SWAP_ON_BE(val) wxINT64_SWAP_ALWAYS(val) + #define wxINT64_SWAP_ON_LE(val) (val) + + #define wxUINT64_SWAP_ON_BE_IN_PLACE(val) val = wxUINT64_SWAP_ALWAYS(val) + #define wxINT64_SWAP_ON_BE_IN_PLACE(val) val = wxINT64_SWAP_ALWAYS(val) + #define wxUINT64_SWAP_ON_LE_IN_PLACE(val) + #define wxINT64_SWAP_ON_LE_IN_PLACE(val) + #endif + + #define wxUINT16_SWAP_ON_BE_IN_PLACE(val) val = wxUINT16_SWAP_ALWAYS(val) + #define wxINT16_SWAP_ON_BE_IN_PLACE(val) val = wxINT16_SWAP_ALWAYS(val) + #define wxUINT16_SWAP_ON_LE_IN_PLACE(val) + #define wxINT16_SWAP_ON_LE_IN_PLACE(val) + #define wxUINT32_SWAP_ON_BE_IN_PLACE(val) val = wxUINT32_SWAP_ALWAYS(val) + #define wxINT32_SWAP_ON_BE_IN_PLACE(val) val = wxINT32_SWAP_ALWAYS(val) + #define wxUINT32_SWAP_ON_LE_IN_PLACE(val) + #define wxINT32_SWAP_ON_LE_IN_PLACE(val) +#else + #define wxUINT16_SWAP_ON_LE(val) wxUINT16_SWAP_ALWAYS(val) + #define wxINT16_SWAP_ON_LE(val) wxINT16_SWAP_ALWAYS(val) + #define wxUINT16_SWAP_ON_BE(val) (val) + #define wxINT16_SWAP_ON_BE(val) (val) + #define wxUINT32_SWAP_ON_LE(val) wxUINT32_SWAP_ALWAYS(val) + #define wxINT32_SWAP_ON_LE(val) wxINT32_SWAP_ALWAYS(val) + #define wxUINT32_SWAP_ON_BE(val) (val) + #define wxINT32_SWAP_ON_BE(val) (val) + #if wxHAS_INT64 + #define wxUINT64_SWAP_ON_LE(val) wxUINT64_SWAP_ALWAYS(val) + #define wxUINT64_SWAP_ON_BE(val) (val) + #define wxINT64_SWAP_ON_LE(val) wxINT64_SWAP_ALWAYS(val) + #define wxINT64_SWAP_ON_BE(val) (val) + #define wxUINT64_SWAP_ON_BE_IN_PLACE(val) + #define wxINT64_SWAP_ON_BE_IN_PLACE(val) + #define wxUINT64_SWAP_ON_LE_IN_PLACE(val) val = wxUINT64_SWAP_ALWAYS(val) + #define wxINT64_SWAP_ON_LE_IN_PLACE(val) val = wxINT64_SWAP_ALWAYS(val) + #endif + + #define wxUINT16_SWAP_ON_BE_IN_PLACE(val) + #define wxINT16_SWAP_ON_BE_IN_PLACE(val) + #define wxUINT16_SWAP_ON_LE_IN_PLACE(val) val = wxUINT16_SWAP_ALWAYS(val) + #define wxINT16_SWAP_ON_LE_IN_PLACE(val) val = wxINT16_SWAP_ALWAYS(val) + #define wxUINT32_SWAP_ON_BE_IN_PLACE(val) + #define wxINT32_SWAP_ON_BE_IN_PLACE(val) + #define wxUINT32_SWAP_ON_LE_IN_PLACE(val) val = wxUINT32_SWAP_ALWAYS(val) + #define wxINT32_SWAP_ON_LE_IN_PLACE(val) val = wxINT32_SWAP_ALWAYS(val) +#endif + +/* ---------------------------------------------------------------------------- */ +/* Geometric flags */ +/* ---------------------------------------------------------------------------- */ + +/* + In C++20 operations on the elements of different enums are deprecated and + many compilers (clang 10+, gcc 11+, MSVS 2019) warn about combining them, + as a lot of existing code using them does, so we provide explicit operators + for doing this, that do the same thing as would happen without them, but + without the warnings. + */ +#if wxCHECK_CXX_STD(202002L) + #define wxALLOW_COMBINING_ENUMS_IMPL(en1, en2) \ + inline int operator|(en1 v1, en2 v2) \ + { return static_cast(v1) | static_cast(v2); } \ + inline int operator+(en1 v1, en2 v2) \ + { return static_cast(v1) + static_cast(v2); } + + #define wxALLOW_COMBINING_ENUMS(en1, en2) \ + wxALLOW_COMBINING_ENUMS_IMPL(en1, en2) \ + wxALLOW_COMBINING_ENUMS_IMPL(en2, en1) +#else /* !C++ 20 */ + /* Don't bother doing anything in this case. */ + #define wxALLOW_COMBINING_ENUMS(en1, en2) +#endif /* C++ 20 */ + +enum wxGeometryCentre +{ + wxCENTRE = 0x0001, + wxCENTER = wxCENTRE +}; + +/* centering into frame rather than screen (obsolete) */ +#define wxCENTER_FRAME 0x0000 +/* centre on screen rather than parent */ +#define wxCENTRE_ON_SCREEN 0x0002 +#define wxCENTER_ON_SCREEN wxCENTRE_ON_SCREEN + +enum wxOrientation +{ + /* don't change the values of these elements, they are used elsewhere */ + wxHORIZONTAL = 0x0004, + wxVERTICAL = 0x0008, + + wxBOTH = wxVERTICAL | wxHORIZONTAL, + + /* a mask to extract orientation from the combination of flags */ + wxORIENTATION_MASK = wxBOTH +}; + +enum wxDirection +{ + wxLEFT = 0x0010, + wxRIGHT = 0x0020, + wxUP = 0x0040, + wxDOWN = 0x0080, + + wxTOP = wxUP, + wxBOTTOM = wxDOWN, + + wxNORTH = wxUP, + wxSOUTH = wxDOWN, + wxWEST = wxLEFT, + wxEAST = wxRIGHT, + + wxALL = (wxUP | wxDOWN | wxRIGHT | wxLEFT), + + /* a mask to extract direction from the combination of flags */ + wxDIRECTION_MASK = wxALL +}; + +enum wxAlignment +{ + /* + 0 is a valid wxAlignment value (both wxALIGN_LEFT and wxALIGN_TOP + use it) so define a symbolic name for an invalid alignment value + which can be assumed to be different from anything else + */ + wxALIGN_INVALID = -1, + + wxALIGN_NOT = 0x0000, + wxALIGN_CENTER_HORIZONTAL = 0x0100, + wxALIGN_CENTRE_HORIZONTAL = wxALIGN_CENTER_HORIZONTAL, + wxALIGN_LEFT = wxALIGN_NOT, + wxALIGN_TOP = wxALIGN_NOT, + wxALIGN_RIGHT = 0x0200, + wxALIGN_BOTTOM = 0x0400, + wxALIGN_CENTER_VERTICAL = 0x0800, + wxALIGN_CENTRE_VERTICAL = wxALIGN_CENTER_VERTICAL, + + wxALIGN_CENTER = (wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL), + wxALIGN_CENTRE = wxALIGN_CENTER, + + /* a mask to extract alignment from the combination of flags */ + wxALIGN_MASK = 0x0f00 +}; + +/* misc. flags for wxSizer items */ +enum wxSizerFlagBits +{ + /* + wxADJUST_MINSIZE doesn't do anything any more but we still define + it for compatibility. Notice that it may be also predefined (as 0, + hopefully) in the user code in order to use it even in + !WXWIN_COMPATIBILITY_2_8 builds so don't redefine it in such case. + */ +#if WXWIN_COMPATIBILITY_2_8 && !defined(wxADJUST_MINSIZE) + wxADJUST_MINSIZE = 0, +#endif + wxFIXED_MINSIZE = 0x8000, + wxRESERVE_SPACE_EVEN_IF_HIDDEN = 0x0002, + + /* a mask to extract wxSizerFlagBits from combination of flags */ + wxSIZER_FLAG_BITS_MASK = 0x8002 +}; + +enum wxStretch +{ + wxSTRETCH_NOT = 0x0000, + wxSHRINK = 0x1000, + wxGROW = 0x2000, + wxEXPAND = wxGROW, + wxSHAPED = 0x4000, + wxTILE = 0xc000, /* wxSHAPED | wxFIXED_MINSIZE */ + + /* a mask to extract stretch from the combination of flags */ + wxSTRETCH_MASK = 0x7000 /* sans wxTILE */ +}; + +/* border flags: the values are chosen for backwards compatibility */ +enum wxBorder +{ + /* this is different from wxBORDER_NONE as by default the controls do have */ + /* border */ + wxBORDER_DEFAULT = 0, + + wxBORDER_NONE = 0x00200000, + wxBORDER_STATIC = 0x01000000, + wxBORDER_SIMPLE = 0x02000000, + wxBORDER_RAISED = 0x04000000, + wxBORDER_SUNKEN = 0x08000000, + wxBORDER_DOUBLE = 0x10000000, /* deprecated */ + wxBORDER_THEME = wxBORDER_DOUBLE, + + /* a mask to extract border style from the combination of flags */ + wxBORDER_MASK = 0x1f200000 +}; + +/* This makes it easier to specify a 'normal' border for a control */ +#define wxDEFAULT_CONTROL_BORDER wxBORDER_SUNKEN + +/* + Elements of these enums can be combined with each other when using + wxSizer::Add() overload not using wxSizerFlags. + */ +wxALLOW_COMBINING_ENUMS(wxAlignment, wxBorder) +wxALLOW_COMBINING_ENUMS(wxAlignment, wxDirection) +wxALLOW_COMBINING_ENUMS(wxAlignment, wxGeometryCentre) +wxALLOW_COMBINING_ENUMS(wxAlignment, wxSizerFlagBits) +wxALLOW_COMBINING_ENUMS(wxAlignment, wxStretch) +wxALLOW_COMBINING_ENUMS(wxBorder, wxDirection) +wxALLOW_COMBINING_ENUMS(wxBorder, wxGeometryCentre) +wxALLOW_COMBINING_ENUMS(wxBorder, wxSizerFlagBits) +wxALLOW_COMBINING_ENUMS(wxBorder, wxStretch) +wxALLOW_COMBINING_ENUMS(wxDirection, wxGeometryCentre) +wxALLOW_COMBINING_ENUMS(wxDirection, wxStretch) +wxALLOW_COMBINING_ENUMS(wxDirection, wxSizerFlagBits) +wxALLOW_COMBINING_ENUMS(wxGeometryCentre, wxSizerFlagBits) +wxALLOW_COMBINING_ENUMS(wxGeometryCentre, wxStretch) +wxALLOW_COMBINING_ENUMS(wxSizerFlagBits, wxStretch) + +/* ---------------------------------------------------------------------------- */ +/* Window style flags */ +/* ---------------------------------------------------------------------------- */ + +/* + * Values are chosen so they can be |'ed in a bit list. + * Some styles are used across more than one group, + * so the values mustn't clash with others in the group. + * Otherwise, numbers can be reused across groups. + */ + +/* + Summary of the bits used by various styles. + + High word, containing styles which can be used with many windows: + + +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16| + +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | \_ wxFULL_REPAINT_ON_RESIZE + | | | | | | | | | | | | | | \____ wxPOPUP_WINDOW + | | | | | | | | | | | | | \_______ wxWANTS_CHARS + | | | | | | | | | | | | \__________ wxTAB_TRAVERSAL + | | | | | | | | | | | \_____________ wxTRANSPARENT_WINDOW + | | | | | | | | | | \________________ wxBORDER_NONE + | | | | | | | | | \___________________ wxCLIP_CHILDREN + | | | | | | | | \______________________ wxALWAYS_SHOW_SB + | | | | | | | \_________________________ wxBORDER_STATIC + | | | | | | \____________________________ wxBORDER_SIMPLE + | | | | | \_______________________________ wxBORDER_RAISED + | | | | \__________________________________ wxBORDER_SUNKEN + | | | \_____________________________________ wxBORDER_{DOUBLE,THEME} + | | \________________________________________ wxCAPTION/wxCLIP_SIBLINGS + | \___________________________________________ wxHSCROLL + \______________________________________________ wxVSCROLL + + + Low word style bits is class-specific meaning that the same bit can have + different meanings for different controls (e.g. 0x10 is wxCB_READONLY + meaning that the control can't be modified for wxComboBox but wxLB_SORT + meaning that the control should be kept sorted for wxListBox, while + wxLB_SORT has a different value -- and this is just fine). + */ + +/* + * Window (Frame/dialog/subwindow/panel item) style flags + */ + +/* The cast is needed to avoid g++ -Wnarrowing warnings when initializing + * values of int type with wxVSCROLL on 32 bit platforms, where its value is + * greater than INT_MAX. + */ +#define wxVSCROLL ((int)0x80000000) +#define wxHSCROLL 0x40000000 +#define wxCAPTION 0x20000000 + +/* New styles (border styles are now in their own enum) */ +#define wxDOUBLE_BORDER wxBORDER_DOUBLE +#define wxSUNKEN_BORDER wxBORDER_SUNKEN +#define wxRAISED_BORDER wxBORDER_RAISED +#define wxBORDER wxBORDER_SIMPLE +#define wxSIMPLE_BORDER wxBORDER_SIMPLE +#define wxSTATIC_BORDER wxBORDER_STATIC +#define wxNO_BORDER wxBORDER_NONE + +/* wxALWAYS_SHOW_SB: instead of hiding the scrollbar when it is not needed, */ +/* disable it - but still show (see also wxLB_ALWAYS_SB style) */ +/* */ +/* NB: as this style is only supported by wxUniversal and wxMSW so far */ +#define wxALWAYS_SHOW_SB 0x00800000 + +/* Clip children when painting, which reduces flicker in e.g. frames and */ +/* splitter windows, but can't be used in a panel where a static box must be */ +/* 'transparent' (panel paints the background for it) */ +#define wxCLIP_CHILDREN 0x00400000 + +/* Note we're reusing the wxCAPTION style because we won't need captions */ +/* for subwindows/controls */ +#define wxCLIP_SIBLINGS 0x20000000 + +#define wxTRANSPARENT_WINDOW 0x00100000 + +/* Add this style to a panel to get tab traversal working outside of dialogs */ +/* (on by default for wxPanel, wxDialog, wxScrolledWindow) */ +#define wxTAB_TRAVERSAL 0x00080000 + +/* Add this style if the control wants to get all keyboard messages (under */ +/* Windows, it won't normally get the dialog navigation key events) */ +#define wxWANTS_CHARS 0x00040000 + +/* Make window retained (Motif only, see src/generic/scrolwing.cpp) + * This is non-zero only under wxMotif, to avoid a clash with wxPOPUP_WINDOW + * on other platforms + */ + +#ifdef __WXMOTIF__ +#define wxRETAINED 0x00020000 +#else +#define wxRETAINED 0x00000000 +#endif +#define wxBACKINGSTORE wxRETAINED + +/* set this flag to create a special popup window: it will be always shown on */ +/* top of other windows, will capture the mouse and will be dismissed when the */ +/* mouse is clicked outside of it or if it loses focus in any other way */ +#define wxPOPUP_WINDOW 0x00020000 + +/* force a full repaint when the window is resized (instead of repainting just */ +/* the invalidated area) */ +#define wxFULL_REPAINT_ON_RESIZE 0x00010000 + +/* obsolete: now this is the default behaviour */ +/* */ +/* don't invalidate the whole window (resulting in a PAINT event) when the */ +/* window is resized (currently, makes sense for wxMSW only) */ +#define wxNO_FULL_REPAINT_ON_RESIZE 0 + +/* A mask which can be used to filter (out) all wxWindow-specific styles. + */ +#define wxWINDOW_STYLE_MASK \ + (wxVSCROLL|wxHSCROLL|wxBORDER_MASK|wxALWAYS_SHOW_SB|wxCLIP_CHILDREN| \ + wxCLIP_SIBLINGS|wxTRANSPARENT_WINDOW|wxTAB_TRAVERSAL|wxWANTS_CHARS| \ + wxRETAINED|wxPOPUP_WINDOW|wxFULL_REPAINT_ON_RESIZE) + +/* + * Extra window style flags (use wxWS_EX prefix to make it clear that they + * should be passed to wxWindow::SetExtraStyle(), not SetWindowStyle()) + */ + +/* This flag is obsolete as recursive validation is now the default (and only + * possible) behaviour. Simply don't use it any more in the new code. */ +#define wxWS_EX_VALIDATE_RECURSIVELY 0x00000000 /* used to be 1 */ + +/* wxCommandEvents and the objects of the derived classes are forwarded to the */ +/* parent window and so on recursively by default. Using this flag for the */ +/* given window allows to block this propagation at this window, i.e. prevent */ +/* the events from being propagated further upwards. The dialogs have this */ +/* flag on by default. */ +#define wxWS_EX_BLOCK_EVENTS 0x00000002 + +/* don't use this window as an implicit parent for the other windows: this must */ +/* be used with transient windows as otherwise there is the risk of creating a */ +/* dialog/frame with this window as a parent which would lead to a crash if the */ +/* parent is destroyed before the child */ +#define wxWS_EX_TRANSIENT 0x00000004 + +/* don't paint the window background, we'll assume it will */ +/* be done by a theming engine. This is not yet used but could */ +/* possibly be made to work in the future, at least on Windows */ +#define wxWS_EX_THEMED_BACKGROUND 0x00000008 + +/* this window should always process idle events */ +#define wxWS_EX_PROCESS_IDLE 0x00000010 + +/* this window should always process UI update events */ +#define wxWS_EX_PROCESS_UI_UPDATES 0x00000020 + +/* Draw the window in a metal theme on Mac */ +#define wxFRAME_EX_METAL 0x00000040 +#define wxDIALOG_EX_METAL 0x00000040 + +/* Use this style to add a context-sensitive help to the window (currently for */ +/* Win32 only and it doesn't work if wxMINIMIZE_BOX or wxMAXIMIZE_BOX are used) */ +#define wxWS_EX_CONTEXTHELP 0x00000080 + +/* synonyms for wxWS_EX_CONTEXTHELP for compatibility */ +#define wxFRAME_EX_CONTEXTHELP wxWS_EX_CONTEXTHELP +#define wxDIALOG_EX_CONTEXTHELP wxWS_EX_CONTEXTHELP + +/* Create a window which is attachable to another top level window */ +#define wxFRAME_DRAWER 0x0020 + +/* + * MDI parent frame style flags + * Can overlap with some of the above. + */ + +#define wxFRAME_NO_WINDOW_MENU 0x0100 + +/* + * wxMenuBar style flags + */ +/* use native docking */ +#define wxMB_DOCKABLE 0x0001 + +/* + * wxMenu style flags + */ +#define wxMENU_TEAROFF 0x0001 + +/* + * Apply to all panel items + */ +#define wxCOLOURED 0x0800 +#define wxFIXED_LENGTH 0x0400 + +/* + * Styles for wxListBox + */ +#define wxLB_SORT 0x0010 +#define wxLB_SINGLE 0x0020 +#define wxLB_MULTIPLE 0x0040 +#define wxLB_EXTENDED 0x0080 +/* wxLB_OWNERDRAW is Windows-only */ +#define wxLB_NEEDED_SB 0x0000 +#define wxLB_OWNERDRAW 0x0100 +#define wxLB_ALWAYS_SB 0x0200 +#define wxLB_NO_SB 0x0400 +#define wxLB_HSCROLL wxHSCROLL +/* always show an entire number of rows */ +#define wxLB_INT_HEIGHT 0x0800 + +/* + * wxComboBox style flags + */ +#define wxCB_SIMPLE 0x0004 +#define wxCB_SORT 0x0008 +#define wxCB_READONLY 0x0010 +#define wxCB_DROPDOWN 0x0020 + +/* + * wxRadioBox style flags + * These styles are not used in any port. + */ +#define wxRA_LEFTTORIGHT 0x0001 +#define wxRA_TOPTOBOTTOM 0x0002 + +/* New, more intuitive names to specify majorDim argument */ +#define wxRA_SPECIFY_COLS wxHORIZONTAL +#define wxRA_SPECIFY_ROWS wxVERTICAL + +/* Old names for compatibility */ +#define wxRA_HORIZONTAL wxHORIZONTAL +#define wxRA_VERTICAL wxVERTICAL + +/* + * wxRadioButton style flag + */ +#define wxRB_GROUP 0x0004 +#define wxRB_SINGLE 0x0008 + +/* + * wxScrollBar flags + */ +#define wxSB_HORIZONTAL wxHORIZONTAL +#define wxSB_VERTICAL wxVERTICAL + +/* + * wxSpinButton flags. + * Note that a wxSpinCtrl is sometimes defined as a wxTextCtrl, and so the + * flags shouldn't overlap with wxTextCtrl flags that can be used for a single + * line controls (currently we reuse wxTE_CHARWRAP and wxTE_RICH2 neither of + * which makes sense for them). + */ +#define wxSP_HORIZONTAL wxHORIZONTAL /* 4 */ +#define wxSP_VERTICAL wxVERTICAL /* 8 */ +#define wxSP_ARROW_KEYS 0x4000 +#define wxSP_WRAP 0x8000 + +/* + * wxTabCtrl flags + */ +#define wxTC_RIGHTJUSTIFY 0x0010 +#define wxTC_FIXEDWIDTH 0x0020 +#define wxTC_TOP 0x0000 /* default */ +#define wxTC_LEFT 0x0020 +#define wxTC_RIGHT 0x0040 +#define wxTC_BOTTOM 0x0080 +#define wxTC_MULTILINE 0x0200 /* == wxNB_MULTILINE */ +#define wxTC_OWNERDRAW 0x0400 + +/* + * wxStaticBitmap flags + */ +#define wxBI_EXPAND wxEXPAND + +/* + * wxStaticLine flags + */ +#define wxLI_HORIZONTAL wxHORIZONTAL +#define wxLI_VERTICAL wxVERTICAL + +/* + wxTextCtrl flags also used by other controls. + + wxComboBox, wxSpinCtrl and maybe others can also use some of these flags, + so define them in common header. More wxTE_XXX are in wx/textctrl.h. + */ +#define wxTE_READONLY 0x0010 +#define wxTE_MULTILINE 0x0020 +#define wxTE_PROCESS_TAB 0x0040 + +#define wxTE_PROCESS_ENTER 0x0400 +#define wxTE_PASSWORD 0x0800 + + +/* + * extended dialog specifiers. these values are stored in a different + * flag and thus do not overlap with other style flags. note that these + * values do not correspond to the return values of the dialogs (for + * those values, look at the wxID_XXX defines). + */ + +/* wxCENTRE already defined as 0x00000001 */ +#define wxYES 0x00000002 +#define wxOK 0x00000004 +#define wxNO 0x00000008 +#define wxYES_NO (wxYES | wxNO) +#define wxCANCEL 0x00000010 +#define wxAPPLY 0x00000020 +#define wxCLOSE 0x00000040 + +#define wxOK_DEFAULT 0x00000000 /* has no effect (default) */ +#define wxYES_DEFAULT 0x00000000 /* has no effect (default) */ +#define wxNO_DEFAULT 0x00000080 /* only valid with wxYES_NO */ +#define wxCANCEL_DEFAULT 0x80000000 /* only valid with wxCANCEL */ + +#define wxICON_WARNING 0x00000100 +#define wxICON_ERROR 0x00000200 +#define wxICON_QUESTION 0x00000400 +#define wxICON_INFORMATION 0x00000800 +#define wxICON_EXCLAMATION wxICON_WARNING +#define wxICON_HAND wxICON_ERROR +#define wxICON_STOP wxICON_ERROR +#define wxICON_ASTERISK wxICON_INFORMATION + +#define wxHELP 0x00001000 +#define wxFORWARD 0x00002000 +#define wxBACKWARD 0x00004000 +#define wxRESET 0x00008000 +#define wxMORE 0x00010000 +#define wxSETUP 0x00020000 +#define wxICON_NONE 0x00040000 +#define wxICON_AUTH_NEEDED 0x00080000 + +#define wxICON_MASK \ + (wxICON_EXCLAMATION|wxICON_HAND|wxICON_QUESTION|wxICON_INFORMATION|wxICON_NONE|wxICON_AUTH_NEEDED) + +/* + * Background styles. See wxWindow::SetBackgroundStyle + */ +enum wxBackgroundStyle +{ + /* + background is erased in the EVT_ERASE_BACKGROUND handler or using + the system default background if no such handler is defined (this + is the default style) + */ + wxBG_STYLE_ERASE, + + /* + background is erased by the system, no EVT_ERASE_BACKGROUND event + is generated at all + */ + wxBG_STYLE_SYSTEM, + + /* + background is erased in EVT_PAINT handler and not erased at all + before it, this should be used if the paint handler paints over + the entire window to avoid flicker + */ + wxBG_STYLE_PAINT, + + /* + Indicates that the window background is not erased, letting the parent + window show through. + */ + wxBG_STYLE_TRANSPARENT, + + /* this style is deprecated and doesn't do anything, don't use */ + wxBG_STYLE_COLOUR, + + /* + this style is deprecated and is synonymous with + wxBG_STYLE_PAINT, use the new name + */ + wxBG_STYLE_CUSTOM = wxBG_STYLE_PAINT +}; + +/* + * Key types used by (old style) lists and hashes. + */ +enum wxKeyType +{ + wxKEY_NONE, + wxKEY_INTEGER, + wxKEY_STRING +}; + +/* ---------------------------------------------------------------------------- */ +/* standard IDs */ +/* ---------------------------------------------------------------------------- */ + +/* Standard menu IDs */ +enum wxStandardID +{ + /* + These ids delimit the range used by automatically-generated ids + (i.e. those used when wxID_ANY is specified during construction). + */ +#if defined(__WXMSW__) || wxUSE_AUTOID_MANAGEMENT + /* + On MSW the range is always restricted no matter if id management + is used or not because the native window ids are limited to short + range. On other platforms the range is only restricted if id + management is used so the reference count buffer won't be so big. + */ + wxID_AUTO_LOWEST = -32000, + wxID_AUTO_HIGHEST = -2000, +#else + wxID_AUTO_LOWEST = -1000000, + wxID_AUTO_HIGHEST = -2000, +#endif + + /* no id matches this one when compared to it */ + wxID_NONE = -3, + + /* id for a separator line in the menu (invalid for normal item) */ + wxID_SEPARATOR = -2, + + /* any id: means that we don't care about the id, whether when installing + * an event handler or when creating a new window */ + wxID_ANY = -1, + + + /* all predefined ids are between wxID_LOWEST and wxID_HIGHEST */ + wxID_LOWEST = 4999, + + wxID_OPEN, + wxID_CLOSE, + wxID_NEW, + wxID_SAVE, + wxID_SAVEAS, + wxID_REVERT, + wxID_EXIT, + wxID_UNDO, + wxID_REDO, + wxID_HELP, + wxID_PRINT, + wxID_PRINT_SETUP, + wxID_PAGE_SETUP, + wxID_PREVIEW, + wxID_ABOUT, + wxID_HELP_CONTENTS, + wxID_HELP_INDEX, + wxID_HELP_SEARCH, + wxID_HELP_COMMANDS, + wxID_HELP_PROCEDURES, + wxID_HELP_CONTEXT, + wxID_CLOSE_ALL, + wxID_PREFERENCES, + + wxID_EDIT = 5030, + wxID_CUT, + wxID_COPY, + wxID_PASTE, + wxID_CLEAR, + wxID_FIND, + wxID_DUPLICATE, + wxID_SELECTALL, + wxID_DELETE, + wxID_REPLACE, + wxID_REPLACE_ALL, + wxID_PROPERTIES, + + wxID_VIEW_DETAILS, + wxID_VIEW_LARGEICONS, + wxID_VIEW_SMALLICONS, + wxID_VIEW_LIST, + wxID_VIEW_SORTDATE, + wxID_VIEW_SORTNAME, + wxID_VIEW_SORTSIZE, + wxID_VIEW_SORTTYPE, + + wxID_FILE = 5050, + wxID_FILE1, + wxID_FILE2, + wxID_FILE3, + wxID_FILE4, + wxID_FILE5, + wxID_FILE6, + wxID_FILE7, + wxID_FILE8, + wxID_FILE9, + + /* Standard button and menu IDs */ + wxID_OK = 5100, + wxID_CANCEL, + wxID_APPLY, + wxID_YES, + wxID_NO, + wxID_STATIC, + wxID_FORWARD, + wxID_BACKWARD, + wxID_DEFAULT, + wxID_MORE, + wxID_SETUP, + wxID_RESET, + wxID_CONTEXT_HELP, + wxID_YESTOALL, + wxID_NOTOALL, + wxID_ABORT, + wxID_RETRY, + wxID_IGNORE, + wxID_ADD, + wxID_REMOVE, + + wxID_UP, + wxID_DOWN, + wxID_HOME, + wxID_REFRESH, + wxID_STOP, + wxID_INDEX, + + wxID_BOLD, + wxID_ITALIC, + wxID_JUSTIFY_CENTER, + wxID_JUSTIFY_FILL, + wxID_JUSTIFY_RIGHT, + wxID_JUSTIFY_LEFT, + wxID_UNDERLINE, + wxID_INDENT, + wxID_UNINDENT, + wxID_ZOOM_100, + wxID_ZOOM_FIT, + wxID_ZOOM_IN, + wxID_ZOOM_OUT, + wxID_UNDELETE, + wxID_REVERT_TO_SAVED, + wxID_CDROM, + wxID_CONVERT, + wxID_EXECUTE, + wxID_FLOPPY, + wxID_HARDDISK, + wxID_BOTTOM, + wxID_FIRST, + wxID_LAST, + wxID_TOP, + wxID_INFO, + wxID_JUMP_TO, + wxID_NETWORK, + wxID_SELECT_COLOR, + wxID_SELECT_FONT, + wxID_SORT_ASCENDING, + wxID_SORT_DESCENDING, + wxID_SPELL_CHECK, + wxID_STRIKETHROUGH, + + /* System menu IDs (used by wxUniv): */ + wxID_SYSTEM_MENU = 5200, + wxID_CLOSE_FRAME, + wxID_MOVE_FRAME, + wxID_RESIZE_FRAME, + wxID_MAXIMIZE_FRAME, + wxID_ICONIZE_FRAME, + wxID_RESTORE_FRAME, + + /* MDI window menu ids */ + wxID_MDI_WINDOW_FIRST = 5230, + wxID_MDI_WINDOW_CASCADE = wxID_MDI_WINDOW_FIRST, + wxID_MDI_WINDOW_TILE_HORZ, + wxID_MDI_WINDOW_TILE_VERT, + wxID_MDI_WINDOW_ARRANGE_ICONS, + wxID_MDI_WINDOW_PREV, + wxID_MDI_WINDOW_NEXT, + wxID_MDI_WINDOW_LAST = wxID_MDI_WINDOW_NEXT, + + /* OS X system menu ids */ + wxID_OSX_MENU_FIRST = 5250, + wxID_OSX_HIDE = wxID_OSX_MENU_FIRST, + wxID_OSX_HIDEOTHERS, + wxID_OSX_SHOWALL, +#if wxABI_VERSION >= 30001 + wxID_OSX_SERVICES, + wxID_OSX_MENU_LAST = wxID_OSX_SERVICES, +#else + wxID_OSX_MENU_LAST = wxID_OSX_SHOWALL, +#endif + + /* IDs used by generic file dialog (13 consecutive starting from this value) */ + wxID_FILEDLGG = 5900, + + /* IDs used by generic file ctrl (4 consecutive starting from this value) */ + wxID_FILECTRL = 5950, + + wxID_HIGHEST = 5999 +}; + +/* ---------------------------------------------------------------------------- */ +/* wxWindowID type */ +/* ---------------------------------------------------------------------------- */ + +/* Note that this is defined even in non-GUI code as the same type is also used + for e.g. timer IDs. */ +typedef int wxWindowID; + +/* ---------------------------------------------------------------------------- */ +/* other constants */ +/* ---------------------------------------------------------------------------- */ + +/* menu and toolbar item kinds */ +enum wxItemKind +{ + wxITEM_SEPARATOR = -1, + wxITEM_NORMAL, + wxITEM_CHECK, + wxITEM_RADIO, + wxITEM_DROPDOWN, + wxITEM_MAX +}; + +/* + * 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 */ +}; + + +/* hit test results */ +enum wxHitTest +{ + wxHT_NOWHERE, + + /* scrollbar */ + wxHT_SCROLLBAR_FIRST = wxHT_NOWHERE, + wxHT_SCROLLBAR_ARROW_LINE_1, /* left or upper arrow to scroll by line */ + wxHT_SCROLLBAR_ARROW_LINE_2, /* right or down */ + wxHT_SCROLLBAR_ARROW_PAGE_1, /* left or upper arrow to scroll by page */ + wxHT_SCROLLBAR_ARROW_PAGE_2, /* right or down */ + wxHT_SCROLLBAR_THUMB, /* on the thumb */ + wxHT_SCROLLBAR_BAR_1, /* bar to the left/above the thumb */ + wxHT_SCROLLBAR_BAR_2, /* bar to the right/below the thumb */ + wxHT_SCROLLBAR_LAST, + + /* window */ + wxHT_WINDOW_OUTSIDE, /* not in this window at all */ + wxHT_WINDOW_INSIDE, /* in the client area */ + wxHT_WINDOW_VERT_SCROLLBAR, /* on the vertical scrollbar */ + wxHT_WINDOW_HORZ_SCROLLBAR, /* on the horizontal scrollbar */ + wxHT_WINDOW_CORNER, /* on the corner between 2 scrollbars */ + + wxHT_MAX +}; + +/* ---------------------------------------------------------------------------- */ +/* Possible SetSize flags */ +/* ---------------------------------------------------------------------------- */ + +/* Use internally-calculated width if -1 */ +#define wxSIZE_AUTO_WIDTH 0x0001 +/* Use internally-calculated height if -1 */ +#define wxSIZE_AUTO_HEIGHT 0x0002 +/* Use internally-calculated width and height if each is -1 */ +#define wxSIZE_AUTO (wxSIZE_AUTO_WIDTH|wxSIZE_AUTO_HEIGHT) +/* Ignore missing (-1) dimensions (use existing). */ +/* For readability only: test for wxSIZE_AUTO_WIDTH/HEIGHT in code. */ +#define wxSIZE_USE_EXISTING 0x0000 +/* Allow -1 as a valid position */ +#define wxSIZE_ALLOW_MINUS_ONE 0x0004 +/* Don't do parent client adjustments (for implementation only) */ +#define wxSIZE_NO_ADJUSTMENTS 0x0008 +/* Change the window position even if it seems to be already correct */ +#define wxSIZE_FORCE 0x0010 +/* Emit size event even if size didn't change */ +#define wxSIZE_FORCE_EVENT 0x0020 + +/* ---------------------------------------------------------------------------- */ +/* GDI descriptions */ +/* ---------------------------------------------------------------------------- */ + +// Hatch styles used by both pen and brush styles. +// +// NB: Do not use these constants directly, they're for internal use only, use +// wxBRUSHSTYLE_XXX_HATCH and wxPENSTYLE_XXX_HATCH instead. +enum wxHatchStyle +{ + wxHATCHSTYLE_INVALID = -1, + + /* + The value of the first style is chosen to fit with + wxDeprecatedGUIConstants values below, don't change it. + */ + wxHATCHSTYLE_FIRST = 111, + wxHATCHSTYLE_BDIAGONAL = wxHATCHSTYLE_FIRST, + wxHATCHSTYLE_CROSSDIAG, + wxHATCHSTYLE_FDIAGONAL, + wxHATCHSTYLE_CROSS, + wxHATCHSTYLE_HORIZONTAL, + wxHATCHSTYLE_VERTICAL, + wxHATCHSTYLE_LAST = wxHATCHSTYLE_VERTICAL +}; + +/* + WARNING: the following styles are deprecated; use the + wxFontFamily, wxFontStyle, wxFontWeight, wxBrushStyle, + wxPenStyle, wxPenCap, wxPenJoin enum values instead! +*/ + +/* don't use any elements of this enum in the new code */ +enum wxDeprecatedGUIConstants +{ + /* Text font families */ + wxDEFAULT = 70, + wxDECORATIVE, + wxROMAN, + wxSCRIPT, + wxSWISS, + wxMODERN, + wxTELETYPE, /* @@@@ */ + + /* Proportional or Fixed width fonts (not yet used) */ + wxVARIABLE = 80, + wxFIXED, + + wxNORMAL = 90, + wxLIGHT, + wxBOLD, + /* Also wxNORMAL for normal (non-italic text) */ + wxITALIC, + wxSLANT, + + /* Pen styles */ + wxSOLID = 100, + wxDOT, + wxLONG_DASH, + wxSHORT_DASH, + wxDOT_DASH, + wxUSER_DASH, + + wxTRANSPARENT, + + /* Brush & Pen Stippling. Note that a stippled pen cannot be dashed!! */ + /* Note also that stippling a Pen IS meaningful, because a Line is */ + wxSTIPPLE_MASK_OPAQUE, /* mask is used for blitting monochrome using text fore and back ground colors */ + wxSTIPPLE_MASK, /* mask is used for masking areas in the stipple bitmap (TO DO) */ + /* drawn with a Pen, and without any Brush -- and it can be stippled. */ + wxSTIPPLE = 110, + + wxBDIAGONAL_HATCH = wxHATCHSTYLE_BDIAGONAL, + wxCROSSDIAG_HATCH = wxHATCHSTYLE_CROSSDIAG, + wxFDIAGONAL_HATCH = wxHATCHSTYLE_FDIAGONAL, + wxCROSS_HATCH = wxHATCHSTYLE_CROSS, + wxHORIZONTAL_HATCH = wxHATCHSTYLE_HORIZONTAL, + wxVERTICAL_HATCH = wxHATCHSTYLE_VERTICAL, + wxFIRST_HATCH = wxHATCHSTYLE_FIRST, + wxLAST_HATCH = wxHATCHSTYLE_LAST +}; + +/* ToolPanel in wxFrame (VZ: unused?) */ +enum +{ + wxTOOL_TOP = 1, + wxTOOL_BOTTOM, + wxTOOL_LEFT, + wxTOOL_RIGHT +}; + +/* the values of the format constants should be the same as corresponding */ +/* CF_XXX constants in Windows API */ +enum wxDataFormatId +{ + wxDF_INVALID = 0, + wxDF_TEXT = 1, /* CF_TEXT */ + wxDF_BITMAP = 2, /* CF_BITMAP */ + wxDF_METAFILE = 3, /* CF_METAFILEPICT */ + wxDF_SYLK = 4, + wxDF_DIF = 5, + wxDF_TIFF = 6, + wxDF_OEMTEXT = 7, /* CF_OEMTEXT */ + wxDF_DIB = 8, /* CF_DIB */ + wxDF_PALETTE = 9, + wxDF_PENDATA = 10, + wxDF_RIFF = 11, + wxDF_WAVE = 12, + wxDF_UNICODETEXT = 13, + wxDF_ENHMETAFILE = 14, + wxDF_FILENAME = 15, /* CF_HDROP */ + wxDF_LOCALE = 16, + wxDF_PRIVATE = 20, + wxDF_HTML = 30, /* Note: does not correspond to CF_ constant */ + wxDF_PNG = 31, /* Note: does not correspond to CF_ constant */ + wxDF_MAX +}; + +/* Key codes */ +enum wxKeyCode +{ + WXK_NONE = 0, + + WXK_CONTROL_A = 1, + WXK_CONTROL_B, + WXK_CONTROL_C, + WXK_CONTROL_D, + WXK_CONTROL_E, + WXK_CONTROL_F, + WXK_CONTROL_G, + WXK_CONTROL_H, + WXK_CONTROL_I, + WXK_CONTROL_J, + WXK_CONTROL_K, + WXK_CONTROL_L, + WXK_CONTROL_M, + WXK_CONTROL_N, + WXK_CONTROL_O, + WXK_CONTROL_P, + WXK_CONTROL_Q, + WXK_CONTROL_R, + WXK_CONTROL_S, + WXK_CONTROL_T, + WXK_CONTROL_U, + WXK_CONTROL_V, + WXK_CONTROL_W, + WXK_CONTROL_X, + WXK_CONTROL_Y, + WXK_CONTROL_Z, + + WXK_BACK = 8, /* backspace */ + WXK_TAB = 9, + WXK_RETURN = 13, + WXK_ESCAPE = 27, + + /* values from 33 to 126 are reserved for the standard ASCII characters */ + + WXK_SPACE = 32, + WXK_DELETE = 127, + + /* values from 128 to 255 are reserved for ASCII extended characters + (note that there isn't a single fixed standard for the meaning + of these values; avoid them in portable apps!) */ + + /* These are not compatible with unicode characters. + If you want to get a unicode character from a key event, use + wxKeyEvent::GetUnicodeKey */ + WXK_START = 300, + WXK_LBUTTON, + WXK_RBUTTON, + WXK_CANCEL, + WXK_MBUTTON, + WXK_CLEAR, + WXK_SHIFT, + WXK_ALT, + WXK_CONTROL, + WXK_MENU, + WXK_PAUSE, + WXK_CAPITAL, + WXK_END, + WXK_HOME, + WXK_LEFT, + WXK_UP, + WXK_RIGHT, + WXK_DOWN, + WXK_SELECT, + WXK_PRINT, + WXK_EXECUTE, + WXK_SNAPSHOT, + WXK_INSERT, + WXK_HELP, + WXK_NUMPAD0, + WXK_NUMPAD1, + WXK_NUMPAD2, + WXK_NUMPAD3, + WXK_NUMPAD4, + WXK_NUMPAD5, + WXK_NUMPAD6, + WXK_NUMPAD7, + WXK_NUMPAD8, + WXK_NUMPAD9, + WXK_MULTIPLY, + WXK_ADD, + WXK_SEPARATOR, + WXK_SUBTRACT, + WXK_DECIMAL, + WXK_DIVIDE, + WXK_F1, + WXK_F2, + WXK_F3, + WXK_F4, + WXK_F5, + WXK_F6, + WXK_F7, + WXK_F8, + WXK_F9, + WXK_F10, + WXK_F11, + WXK_F12, + WXK_F13, + WXK_F14, + WXK_F15, + WXK_F16, + WXK_F17, + WXK_F18, + WXK_F19, + WXK_F20, + WXK_F21, + WXK_F22, + WXK_F23, + WXK_F24, + WXK_NUMLOCK, + WXK_SCROLL, + WXK_PAGEUP, + WXK_PAGEDOWN, + WXK_NUMPAD_SPACE, + WXK_NUMPAD_TAB, + WXK_NUMPAD_ENTER, + WXK_NUMPAD_F1, + WXK_NUMPAD_F2, + WXK_NUMPAD_F3, + WXK_NUMPAD_F4, + WXK_NUMPAD_HOME, + WXK_NUMPAD_LEFT, + WXK_NUMPAD_UP, + WXK_NUMPAD_RIGHT, + WXK_NUMPAD_DOWN, + WXK_NUMPAD_PAGEUP, + WXK_NUMPAD_PAGEDOWN, + WXK_NUMPAD_END, + WXK_NUMPAD_BEGIN, + WXK_NUMPAD_INSERT, + WXK_NUMPAD_DELETE, + WXK_NUMPAD_EQUAL, + WXK_NUMPAD_MULTIPLY, + WXK_NUMPAD_ADD, + WXK_NUMPAD_SEPARATOR, + WXK_NUMPAD_SUBTRACT, + WXK_NUMPAD_DECIMAL, + WXK_NUMPAD_DIVIDE, + + WXK_WINDOWS_LEFT, + WXK_WINDOWS_RIGHT, + WXK_WINDOWS_MENU , +#ifdef __WXOSX__ + WXK_RAW_CONTROL, +#else + WXK_RAW_CONTROL = WXK_CONTROL, +#endif + WXK_COMMAND = WXK_CONTROL, + + /* Hardware-specific buttons */ + WXK_SPECIAL1 = WXK_WINDOWS_MENU + 2, /* Skip WXK_RAW_CONTROL if necessary */ + WXK_SPECIAL2, + WXK_SPECIAL3, + WXK_SPECIAL4, + WXK_SPECIAL5, + WXK_SPECIAL6, + WXK_SPECIAL7, + WXK_SPECIAL8, + WXK_SPECIAL9, + WXK_SPECIAL10, + WXK_SPECIAL11, + WXK_SPECIAL12, + WXK_SPECIAL13, + WXK_SPECIAL14, + WXK_SPECIAL15, + WXK_SPECIAL16, + WXK_SPECIAL17, + WXK_SPECIAL18, + WXK_SPECIAL19, + WXK_SPECIAL20, + + WXK_BROWSER_BACK, + WXK_BROWSER_FORWARD, + WXK_BROWSER_REFRESH, + WXK_BROWSER_STOP, + WXK_BROWSER_SEARCH, + WXK_BROWSER_FAVORITES, + WXK_BROWSER_HOME, + WXK_VOLUME_MUTE, + WXK_VOLUME_DOWN, + WXK_VOLUME_UP, + WXK_MEDIA_NEXT_TRACK, + WXK_MEDIA_PREV_TRACK, + WXK_MEDIA_STOP, + WXK_MEDIA_PLAY_PAUSE, + WXK_LAUNCH_MAIL, + + // Events for these keys are currently only generated by wxGTK, with the + // exception of WXK_LAUNCH_{A,B}, see WXK_LAUNCH_APP{1,2} below. + WXK_LAUNCH_0, + WXK_LAUNCH_1, + WXK_LAUNCH_2, + WXK_LAUNCH_3, + WXK_LAUNCH_4, + WXK_LAUNCH_5, + WXK_LAUNCH_6, + WXK_LAUNCH_7, + WXK_LAUNCH_8, + WXK_LAUNCH_9, + WXK_LAUNCH_A, + WXK_LAUNCH_B, + WXK_LAUNCH_C, + WXK_LAUNCH_D, + WXK_LAUNCH_E, + WXK_LAUNCH_F, + + // These constants are the same as the corresponding GTK keys, so give them + // the same value, but they are also generated by wxMSW. + WXK_LAUNCH_APP1 = WXK_LAUNCH_A, + WXK_LAUNCH_APP2 = WXK_LAUNCH_B +}; + +/* This enum contains bit mask constants used in wxKeyEvent */ +enum wxKeyModifier +{ + wxMOD_NONE = 0x0000, + wxMOD_ALT = 0x0001, + wxMOD_CONTROL = 0x0002, + wxMOD_ALTGR = wxMOD_ALT | wxMOD_CONTROL, + wxMOD_SHIFT = 0x0004, + wxMOD_META = 0x0008, + wxMOD_WIN = wxMOD_META, +#if defined(__WXMAC__) + wxMOD_RAW_CONTROL = 0x0010, +#else + wxMOD_RAW_CONTROL = wxMOD_CONTROL, +#endif + wxMOD_CMD = wxMOD_CONTROL, + wxMOD_ALL = 0xffff +}; + +/* Shortcut for easier dialog-unit-to-pixel conversion */ +#define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt) + +/* Paper types */ +enum wxPaperSize +{ + wxPAPER_NONE, /* Use specific dimensions */ + wxPAPER_LETTER, /* Letter, 8 1/2 by 11 inches */ + wxPAPER_LEGAL, /* Legal, 8 1/2 by 14 inches */ + wxPAPER_A4, /* A4 Sheet, 210 by 297 millimeters */ + wxPAPER_CSHEET, /* C Sheet, 17 by 22 inches */ + wxPAPER_DSHEET, /* D Sheet, 22 by 34 inches */ + wxPAPER_ESHEET, /* E Sheet, 34 by 44 inches */ + wxPAPER_LETTERSMALL, /* Letter Small, 8 1/2 by 11 inches */ + wxPAPER_TABLOID, /* Tabloid, 11 by 17 inches */ + wxPAPER_LEDGER, /* Ledger, 17 by 11 inches */ + wxPAPER_STATEMENT, /* Statement, 5 1/2 by 8 1/2 inches */ + wxPAPER_EXECUTIVE, /* Executive, 7 1/4 by 10 1/2 inches */ + wxPAPER_A3, /* A3 sheet, 297 by 420 millimeters */ + wxPAPER_A4SMALL, /* A4 small sheet, 210 by 297 millimeters */ + wxPAPER_A5, /* A5 sheet, 148 by 210 millimeters */ + wxPAPER_B4, /* B4 sheet, 250 by 354 millimeters */ + wxPAPER_B5, /* B5 sheet, 182-by-257-millimeter paper */ + wxPAPER_FOLIO, /* Folio, 8-1/2-by-13-inch paper */ + wxPAPER_QUARTO, /* Quarto, 215-by-275-millimeter paper */ + wxPAPER_10X14, /* 10-by-14-inch sheet */ + wxPAPER_11X17, /* 11-by-17-inch sheet */ + wxPAPER_NOTE, /* Note, 8 1/2 by 11 inches */ + wxPAPER_ENV_9, /* #9 Envelope, 3 7/8 by 8 7/8 inches */ + wxPAPER_ENV_10, /* #10 Envelope, 4 1/8 by 9 1/2 inches */ + wxPAPER_ENV_11, /* #11 Envelope, 4 1/2 by 10 3/8 inches */ + wxPAPER_ENV_12, /* #12 Envelope, 4 3/4 by 11 inches */ + wxPAPER_ENV_14, /* #14 Envelope, 5 by 11 1/2 inches */ + wxPAPER_ENV_DL, /* DL Envelope, 110 by 220 millimeters */ + wxPAPER_ENV_C5, /* C5 Envelope, 162 by 229 millimeters */ + wxPAPER_ENV_C3, /* C3 Envelope, 324 by 458 millimeters */ + wxPAPER_ENV_C4, /* C4 Envelope, 229 by 324 millimeters */ + wxPAPER_ENV_C6, /* C6 Envelope, 114 by 162 millimeters */ + wxPAPER_ENV_C65, /* C65 Envelope, 114 by 229 millimeters */ + wxPAPER_ENV_B4, /* B4 Envelope, 250 by 353 millimeters */ + wxPAPER_ENV_B5, /* B5 Envelope, 176 by 250 millimeters */ + wxPAPER_ENV_B6, /* B6 Envelope, 176 by 125 millimeters */ + wxPAPER_ENV_ITALY, /* Italy Envelope, 110 by 230 millimeters */ + wxPAPER_ENV_MONARCH, /* Monarch Envelope, 3 7/8 by 7 1/2 inches */ + wxPAPER_ENV_PERSONAL, /* 6 3/4 Envelope, 3 5/8 by 6 1/2 inches */ + wxPAPER_FANFOLD_US, /* US Std Fanfold, 14 7/8 by 11 inches */ + wxPAPER_FANFOLD_STD_GERMAN, /* German Std Fanfold, 8 1/2 by 12 inches */ + wxPAPER_FANFOLD_LGL_GERMAN, /* German Legal Fanfold, 8 1/2 by 13 inches */ + + wxPAPER_ISO_B4, /* B4 (ISO) 250 x 353 mm */ + wxPAPER_JAPANESE_POSTCARD, /* Japanese Postcard 100 x 148 mm */ + wxPAPER_9X11, /* 9 x 11 in */ + wxPAPER_10X11, /* 10 x 11 in */ + wxPAPER_15X11, /* 15 x 11 in */ + wxPAPER_ENV_INVITE, /* Envelope Invite 220 x 220 mm */ + wxPAPER_LETTER_EXTRA, /* Letter Extra 9 \275 x 12 in */ + wxPAPER_LEGAL_EXTRA, /* Legal Extra 9 \275 x 15 in */ + wxPAPER_TABLOID_EXTRA, /* Tabloid Extra 11.69 x 18 in */ + wxPAPER_A4_EXTRA, /* A4 Extra 9.27 x 12.69 in */ + wxPAPER_LETTER_TRANSVERSE, /* Letter Transverse 8 \275 x 11 in */ + wxPAPER_A4_TRANSVERSE, /* A4 Transverse 210 x 297 mm */ + wxPAPER_LETTER_EXTRA_TRANSVERSE, /* Letter Extra Transverse 9\275 x 12 in */ + wxPAPER_A_PLUS, /* SuperA/SuperA/A4 227 x 356 mm */ + wxPAPER_B_PLUS, /* SuperB/SuperB/A3 305 x 487 mm */ + wxPAPER_LETTER_PLUS, /* Letter Plus 8.5 x 12.69 in */ + wxPAPER_A4_PLUS, /* A4 Plus 210 x 330 mm */ + wxPAPER_A5_TRANSVERSE, /* A5 Transverse 148 x 210 mm */ + wxPAPER_B5_TRANSVERSE, /* B5 (JIS) Transverse 182 x 257 mm */ + wxPAPER_A3_EXTRA, /* A3 Extra 322 x 445 mm */ + wxPAPER_A5_EXTRA, /* A5 Extra 174 x 235 mm */ + wxPAPER_B5_EXTRA, /* B5 (ISO) Extra 201 x 276 mm */ + wxPAPER_A2, /* A2 420 x 594 mm */ + wxPAPER_A3_TRANSVERSE, /* A3 Transverse 297 x 420 mm */ + wxPAPER_A3_EXTRA_TRANSVERSE, /* A3 Extra Transverse 322 x 445 mm */ + + wxPAPER_DBL_JAPANESE_POSTCARD,/* Japanese Double Postcard 200 x 148 mm */ + wxPAPER_A6, /* A6 105 x 148 mm */ + wxPAPER_JENV_KAKU2, /* Japanese Envelope Kaku #2 */ + wxPAPER_JENV_KAKU3, /* Japanese Envelope Kaku #3 */ + wxPAPER_JENV_CHOU3, /* Japanese Envelope Chou #3 */ + wxPAPER_JENV_CHOU4, /* Japanese Envelope Chou #4 */ + wxPAPER_LETTER_ROTATED, /* Letter Rotated 11 x 8 1/2 in */ + wxPAPER_A3_ROTATED, /* A3 Rotated 420 x 297 mm */ + wxPAPER_A4_ROTATED, /* A4 Rotated 297 x 210 mm */ + wxPAPER_A5_ROTATED, /* A5 Rotated 210 x 148 mm */ + wxPAPER_B4_JIS_ROTATED, /* B4 (JIS) Rotated 364 x 257 mm */ + wxPAPER_B5_JIS_ROTATED, /* B5 (JIS) Rotated 257 x 182 mm */ + wxPAPER_JAPANESE_POSTCARD_ROTATED,/* Japanese Postcard Rotated 148 x 100 mm */ + wxPAPER_DBL_JAPANESE_POSTCARD_ROTATED,/* Double Japanese Postcard Rotated 148 x 200 mm */ + wxPAPER_A6_ROTATED, /* A6 Rotated 148 x 105 mm */ + wxPAPER_JENV_KAKU2_ROTATED, /* Japanese Envelope Kaku #2 Rotated */ + wxPAPER_JENV_KAKU3_ROTATED, /* Japanese Envelope Kaku #3 Rotated */ + wxPAPER_JENV_CHOU3_ROTATED, /* Japanese Envelope Chou #3 Rotated */ + wxPAPER_JENV_CHOU4_ROTATED, /* Japanese Envelope Chou #4 Rotated */ + wxPAPER_B6_JIS, /* B6 (JIS) 128 x 182 mm */ + wxPAPER_B6_JIS_ROTATED, /* B6 (JIS) Rotated 182 x 128 mm */ + wxPAPER_12X11, /* 12 x 11 in */ + wxPAPER_JENV_YOU4, /* Japanese Envelope You #4 */ + wxPAPER_JENV_YOU4_ROTATED, /* Japanese Envelope You #4 Rotated */ + wxPAPER_P16K, /* PRC 16K 146 x 215 mm */ + wxPAPER_P32K, /* PRC 32K 97 x 151 mm */ + wxPAPER_P32KBIG, /* PRC 32K(Big) 97 x 151 mm */ + wxPAPER_PENV_1, /* PRC Envelope #1 102 x 165 mm */ + wxPAPER_PENV_2, /* PRC Envelope #2 102 x 176 mm */ + wxPAPER_PENV_3, /* PRC Envelope #3 125 x 176 mm */ + wxPAPER_PENV_4, /* PRC Envelope #4 110 x 208 mm */ + wxPAPER_PENV_5, /* PRC Envelope #5 110 x 220 mm */ + wxPAPER_PENV_6, /* PRC Envelope #6 120 x 230 mm */ + wxPAPER_PENV_7, /* PRC Envelope #7 160 x 230 mm */ + wxPAPER_PENV_8, /* PRC Envelope #8 120 x 309 mm */ + wxPAPER_PENV_9, /* PRC Envelope #9 229 x 324 mm */ + wxPAPER_PENV_10, /* PRC Envelope #10 324 x 458 mm */ + wxPAPER_P16K_ROTATED, /* PRC 16K Rotated */ + wxPAPER_P32K_ROTATED, /* PRC 32K Rotated */ + wxPAPER_P32KBIG_ROTATED, /* PRC 32K(Big) Rotated */ + wxPAPER_PENV_1_ROTATED, /* PRC Envelope #1 Rotated 165 x 102 mm */ + wxPAPER_PENV_2_ROTATED, /* PRC Envelope #2 Rotated 176 x 102 mm */ + wxPAPER_PENV_3_ROTATED, /* PRC Envelope #3 Rotated 176 x 125 mm */ + wxPAPER_PENV_4_ROTATED, /* PRC Envelope #4 Rotated 208 x 110 mm */ + wxPAPER_PENV_5_ROTATED, /* PRC Envelope #5 Rotated 220 x 110 mm */ + wxPAPER_PENV_6_ROTATED, /* PRC Envelope #6 Rotated 230 x 120 mm */ + wxPAPER_PENV_7_ROTATED, /* PRC Envelope #7 Rotated 230 x 160 mm */ + wxPAPER_PENV_8_ROTATED, /* PRC Envelope #8 Rotated 309 x 120 mm */ + wxPAPER_PENV_9_ROTATED, /* PRC Envelope #9 Rotated 324 x 229 mm */ + wxPAPER_PENV_10_ROTATED, /* PRC Envelope #10 Rotated 458 x 324 m */ + wxPAPER_A0, /* A0 Sheet 841 x 1189 mm */ + wxPAPER_A1 /* A1 Sheet 594 x 841 mm */ +}; + +/* Printing orientation */ +enum wxPrintOrientation +{ + wxPORTRAIT = 1, + wxLANDSCAPE +}; + +/* Duplex printing modes + */ + +enum wxDuplexMode +{ + wxDUPLEX_SIMPLEX, /* Non-duplex */ + wxDUPLEX_HORIZONTAL, + wxDUPLEX_VERTICAL +}; + +/* Print quality. + */ + +#define wxPRINT_QUALITY_HIGH -1 +#define wxPRINT_QUALITY_MEDIUM -2 +#define wxPRINT_QUALITY_LOW -3 +#define wxPRINT_QUALITY_DRAFT -4 + +typedef int wxPrintQuality; + +/* Print mode (currently PostScript only) + */ + +enum wxPrintMode +{ + wxPRINT_MODE_NONE = 0, + wxPRINT_MODE_PREVIEW = 1, /* Preview in external application */ + wxPRINT_MODE_FILE = 2, /* Print to file */ + wxPRINT_MODE_PRINTER = 3, /* Send to printer */ + wxPRINT_MODE_STREAM = 4 /* Send postscript data into a stream */ +}; + +/* ---------------------------------------------------------------------------- */ +/* UpdateWindowUI flags */ +/* ---------------------------------------------------------------------------- */ + +enum wxUpdateUI +{ + wxUPDATE_UI_NONE = 0x0000, + wxUPDATE_UI_RECURSE = 0x0001, + wxUPDATE_UI_FROMIDLE = 0x0002 /* Invoked from On(Internal)Idle */ +}; + + +/* ---------------------------------------------------------------------------- */ +/* wxList types */ +/* ---------------------------------------------------------------------------- */ + +/* type of compare function for list sort operation (as in 'qsort'): it should + return a negative value, 0 or positive value if the first element is less + than, equal or greater than the second */ + +typedef int (* LINKAGEMODE wxSortCompareFunction)(const void *elem1, const void *elem2); + +/* wxList iterator function */ +typedef int (* LINKAGEMODE wxListIterateFunction)(void *current); + + +/* ---------------------------------------------------------------------------- */ +/* miscellaneous */ +/* ---------------------------------------------------------------------------- */ + +/* define this macro if font handling is done using the X font names */ +#if (defined(__WXGTK__) && !defined(__WXGTK20__)) || defined(__X__) + #define _WX_X_FONTLIKE +#endif + +/* macro to specify "All Files" on different platforms */ +#if defined(__WXMSW__) +# define wxALL_FILES_PATTERN wxT("*.*") +# define wxALL_FILES gettext_noop("All files (*.*)|*.*") +#else +# define wxALL_FILES_PATTERN wxT("*") +# define wxALL_FILES gettext_noop("All files (*)|*") +#endif + +#if defined(__CYGWIN__) && defined(__WXMSW__) +# if wxUSE_STD_CONTAINERS || defined(wxUSE_STD_STRING) + /* + NASTY HACK because the gethostname in sys/unistd.h which the gnu + stl includes and wx builds with by default clash with each other + (windows version 2nd param is int, sys/unistd.h version is unsigned + int). + */ +# define gethostname gethostnameHACK +# include +# undef gethostname +# endif +#endif + +/* --------------------------------------------------------------------------- */ +/* macros that enable wxWidgets apps to be compiled in absence of the */ +/* system headers, although some platform specific types are used in the */ +/* platform specific (implementation) parts of the headers */ +/* --------------------------------------------------------------------------- */ + +#ifdef __DARWIN__ +#define DECLARE_WXOSX_OPAQUE_CFREF( name ) typedef struct __##name* name##Ref; +#define DECLARE_WXOSX_OPAQUE_CONST_CFREF( name ) typedef const struct __##name* name##Ref; + +#endif + +#ifdef __WXMAC__ + +#define WX_OPAQUE_TYPE( name ) struct wxOpaque##name + +typedef void* WXHCURSOR; +typedef void* WXRECTPTR; +typedef void* WXPOINTPTR; +typedef void* WXHWND; +typedef void* WXEVENTREF; +typedef void* WXEVENTHANDLERREF; +typedef void* WXEVENTHANDLERCALLREF; +typedef void* WXAPPLEEVENTREF; + +typedef unsigned int WXUINT; +typedef unsigned long WXDWORD; +typedef unsigned short WXWORD; + +typedef WX_OPAQUE_TYPE(PicHandle ) * WXHMETAFILE ; + +typedef void* WXDisplay; + +/* + * core frameworks + */ + +#if __has_attribute(objc_bridge) && __has_feature(objc_bridge_id) && __has_feature(objc_bridge_id_on_typedefs) + +#ifdef __OBJC__ +@class NSArray; +@class NSString; +@class NSData; +@class NSDictionary; +#endif + +#define WXOSX_BRIDGED_TYPE(T) __attribute__((objc_bridge(T))) +#define WXOSX_BRIDGED_MUTABLE_TYPE(T) __attribute__((objc_bridge_mutable(T))) + +#else + +#define WXOSX_BRIDGED_TYPE(T) +#define WXOSX_BRIDGED_MUTABLE_TYPE(T) + +#endif + +#define DECLARE_WXOSX_BRIDGED_TYPE_AND_CFREF( name ) \ + typedef const struct WXOSX_BRIDGED_TYPE(NS##name) __CF##name* CF##name##Ref; +#define DECLARE_WXOSX_BRIDGED_MUTABLE_TYPE_AND_CFREF( name ) \ + typedef struct WXOSX_BRIDGED_MUTABLE_TYPE(NSMutable##name) __CF##name* CFMutable##name##Ref; + +typedef const WXOSX_BRIDGED_TYPE(id) void * CFTypeRef; + +DECLARE_WXOSX_BRIDGED_TYPE_AND_CFREF( Data ) +DECLARE_WXOSX_BRIDGED_MUTABLE_TYPE_AND_CFREF( Data ) + +DECLARE_WXOSX_BRIDGED_TYPE_AND_CFREF( String ) +DECLARE_WXOSX_BRIDGED_MUTABLE_TYPE_AND_CFREF( String ) + +DECLARE_WXOSX_BRIDGED_TYPE_AND_CFREF( Dictionary ) +DECLARE_WXOSX_BRIDGED_MUTABLE_TYPE_AND_CFREF( Dictionary ) + +DECLARE_WXOSX_BRIDGED_TYPE_AND_CFREF( Array ) +DECLARE_WXOSX_BRIDGED_MUTABLE_TYPE_AND_CFREF( Array ) + +DECLARE_WXOSX_OPAQUE_CFREF( CFRunLoopSource ) +DECLARE_WXOSX_OPAQUE_CONST_CFREF( CTFont ) +DECLARE_WXOSX_OPAQUE_CONST_CFREF( CTFontDescriptor ) + +#define DECLARE_WXOSX_OPAQUE_CGREF( name ) typedef struct name* name##Ref; + +DECLARE_WXOSX_OPAQUE_CGREF( CGColor ) +DECLARE_WXOSX_OPAQUE_CGREF( CGImage ) +DECLARE_WXOSX_OPAQUE_CGREF( CGContext ) +DECLARE_WXOSX_OPAQUE_CGREF( CGFont ) + +typedef CGColorRef WXCOLORREF; +typedef CGImageRef WXCGIMAGEREF; +typedef CGContextRef WXHDC; +typedef CGContextRef WXHBITMAP; + +/* + * carbon + */ + +typedef const struct __HIShape * HIShapeRef; +typedef struct __HIShape * HIMutableShapeRef; + +#define DECLARE_WXMAC_OPAQUE_REF( name ) typedef struct Opaque##name* name; + +DECLARE_WXMAC_OPAQUE_REF( PasteboardRef ) +DECLARE_WXMAC_OPAQUE_REF( IconRef ) +DECLARE_WXMAC_OPAQUE_REF( MenuRef ) + +typedef IconRef WXHICON ; +typedef HIShapeRef WXHRGN; + +#endif // __WXMAC__ + +#if defined(__WXMAC__) + +/* Objective-C type declarations. + * These are to be used in public headers in lieu of NSSomething* because + * Objective-C class names are not available in C/C++ code. + */ + +/* NOTE: This ought to work with other compilers too, but I'm being cautious */ +#if (defined(__GNUC__) && defined(__APPLE__)) +/* It's desirable to have type safety for Objective-C(++) code as it does +at least catch typos of method names among other things. However, it +is not possible to declare an Objective-C class from plain old C or C++ +code. Furthermore, because of C++ name mangling, the type name must +be the same for both C++ and Objective-C++ code. Therefore, we define +what should be a pointer to an Objective-C class as a pointer to a plain +old C struct with the same name. Unfortunately, because the compiler +does not see a struct as an Objective-C class we cannot declare it +as a struct in Objective-C(++) mode. +*/ +#if defined(__OBJC__) +#define DECLARE_WXCOCOA_OBJC_CLASS(klass) \ +@class klass; \ +typedef klass *WX_##klass +#else /* not defined(__OBJC__) */ +#define DECLARE_WXCOCOA_OBJC_CLASS(klass) \ +typedef struct klass *WX_##klass +#endif /* defined(__OBJC__) */ + +#else /* not Apple's gcc */ +#warning "Objective-C types will not be checked by the compiler." +/* NOTE: typedef struct objc_object *id; */ +/* IOW, we're declaring these using the id type without using that name, */ +/* since "id" is used extensively not only within wxWidgets itself, but */ +/* also in wxWidgets application code. The following works fine when */ +/* compiling C(++) code, and works without typesafety for Obj-C(++) code */ +#define DECLARE_WXCOCOA_OBJC_CLASS(klass) \ +typedef struct objc_object *WX_##klass + +#endif /* (defined(__GNUC__) && defined(__APPLE__)) */ + +DECLARE_WXCOCOA_OBJC_CLASS(NSArray); +DECLARE_WXCOCOA_OBJC_CLASS(NSData); +DECLARE_WXCOCOA_OBJC_CLASS(NSMutableArray); +DECLARE_WXCOCOA_OBJC_CLASS(NSString); +DECLARE_WXCOCOA_OBJC_CLASS(NSObject); + +#if wxOSX_USE_COCOA + +DECLARE_WXCOCOA_OBJC_CLASS(NSApplication); +DECLARE_WXCOCOA_OBJC_CLASS(NSBitmapImageRep); +DECLARE_WXCOCOA_OBJC_CLASS(NSBox); +DECLARE_WXCOCOA_OBJC_CLASS(NSButton); +DECLARE_WXCOCOA_OBJC_CLASS(NSColor); +DECLARE_WXCOCOA_OBJC_CLASS(NSColorPanel); +DECLARE_WXCOCOA_OBJC_CLASS(NSControl); +DECLARE_WXCOCOA_OBJC_CLASS(NSCursor); +DECLARE_WXCOCOA_OBJC_CLASS(NSEvent); +DECLARE_WXCOCOA_OBJC_CLASS(NSFont); +DECLARE_WXCOCOA_OBJC_CLASS(NSFontDescriptor); +DECLARE_WXCOCOA_OBJC_CLASS(NSFontPanel); +DECLARE_WXCOCOA_OBJC_CLASS(NSImage); +DECLARE_WXCOCOA_OBJC_CLASS(NSLayoutManager); +DECLARE_WXCOCOA_OBJC_CLASS(NSMenu); +DECLARE_WXCOCOA_OBJC_CLASS(NSMenuExtra); +DECLARE_WXCOCOA_OBJC_CLASS(NSMenuItem); +DECLARE_WXCOCOA_OBJC_CLASS(NSNotification); +DECLARE_WXCOCOA_OBJC_CLASS(NSPanel); +DECLARE_WXCOCOA_OBJC_CLASS(NSResponder); +DECLARE_WXCOCOA_OBJC_CLASS(NSScrollView); +DECLARE_WXCOCOA_OBJC_CLASS(NSSound); +DECLARE_WXCOCOA_OBJC_CLASS(NSStatusItem); +DECLARE_WXCOCOA_OBJC_CLASS(NSTableColumn); +DECLARE_WXCOCOA_OBJC_CLASS(NSTableView); +DECLARE_WXCOCOA_OBJC_CLASS(NSTextContainer); +DECLARE_WXCOCOA_OBJC_CLASS(NSTextField); +DECLARE_WXCOCOA_OBJC_CLASS(NSTextStorage); +DECLARE_WXCOCOA_OBJC_CLASS(NSThread); +DECLARE_WXCOCOA_OBJC_CLASS(NSWindow); +DECLARE_WXCOCOA_OBJC_CLASS(NSView); +DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLContext); +DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLPixelFormat); +DECLARE_WXCOCOA_OBJC_CLASS(NSPrintInfo); +DECLARE_WXCOCOA_OBJC_CLASS(NSGestureRecognizer); +DECLARE_WXCOCOA_OBJC_CLASS(NSPanGestureRecognizer); +DECLARE_WXCOCOA_OBJC_CLASS(NSMagnificationGestureRecognizer); +DECLARE_WXCOCOA_OBJC_CLASS(NSRotationGestureRecognizer); +DECLARE_WXCOCOA_OBJC_CLASS(NSPressGestureRecognizer); +DECLARE_WXCOCOA_OBJC_CLASS(NSTouch); +DECLARE_WXCOCOA_OBJC_CLASS(NSPasteboard); +DECLARE_WXCOCOA_OBJC_CLASS(WKWebView); + +typedef WX_NSWindow WXWindow; +typedef WX_NSView WXWidget; +typedef WX_NSImage WXImage; +typedef WX_NSMenu WXHMENU; +typedef WX_NSOpenGLPixelFormat WXGLPixelFormat; +typedef WX_NSOpenGLContext WXGLContext; +typedef WX_NSPasteboard OSXPasteboard; +typedef WX_WKWebView OSXWebViewPtr; + +#elif wxOSX_USE_IPHONE + +DECLARE_WXCOCOA_OBJC_CLASS(UIMenu); +DECLARE_WXCOCOA_OBJC_CLASS(UIMenuItem); +DECLARE_WXCOCOA_OBJC_CLASS(UIWindow); +DECLARE_WXCOCOA_OBJC_CLASS(UImage); +DECLARE_WXCOCOA_OBJC_CLASS(UIView); +DECLARE_WXCOCOA_OBJC_CLASS(UIFont); +DECLARE_WXCOCOA_OBJC_CLASS(UIImage); +DECLARE_WXCOCOA_OBJC_CLASS(UIEvent); +DECLARE_WXCOCOA_OBJC_CLASS(NSSet); +DECLARE_WXCOCOA_OBJC_CLASS(EAGLContext); +DECLARE_WXCOCOA_OBJC_CLASS(UIPasteboard); + +typedef WX_UIWindow WXWindow; +typedef WX_UIView WXWidget; +typedef WX_UIImage WXImage; +typedef WX_UIMenu WXHMENU; +typedef WX_EAGLContext WXGLContext; +typedef WX_NSString WXGLPixelFormat; +typedef WX_UIPasteboard WXOSXPasteboard; + +#endif + + + +#endif /* __WXMAC__ */ + +/* ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port */ +#if defined(__WIN32__) + +/* Stand-ins for Windows types to avoid #including all of windows.h */ + +#ifndef NO_STRICT + #define WX_MSW_DECLARE_HANDLE(type) typedef struct type##__ * WX##type +#else + #define WX_MSW_DECLARE_HANDLE(type) typedef void * WX##type +#endif + +typedef void* WXHANDLE; +WX_MSW_DECLARE_HANDLE(HWND); +WX_MSW_DECLARE_HANDLE(HICON); +WX_MSW_DECLARE_HANDLE(HFONT); +WX_MSW_DECLARE_HANDLE(HMENU); +WX_MSW_DECLARE_HANDLE(HPEN); +WX_MSW_DECLARE_HANDLE(HBRUSH); +WX_MSW_DECLARE_HANDLE(HPALETTE); +WX_MSW_DECLARE_HANDLE(HCURSOR); +WX_MSW_DECLARE_HANDLE(HRGN); +WX_MSW_DECLARE_HANDLE(RECTPTR); +WX_MSW_DECLARE_HANDLE(HACCEL); +WX_MSW_DECLARE_HANDLE(HINSTANCE); +WX_MSW_DECLARE_HANDLE(HBITMAP); +WX_MSW_DECLARE_HANDLE(HIMAGELIST); +WX_MSW_DECLARE_HANDLE(HGLOBAL); +WX_MSW_DECLARE_HANDLE(HDC); +WX_MSW_DECLARE_HANDLE(DPI_AWARENESS_CONTEXT); +typedef WXHINSTANCE WXHMODULE; + +#undef WX_MSW_DECLARE_HANDLE + +typedef unsigned int WXUINT; +typedef unsigned long WXDWORD; +typedef unsigned short WXWORD; + +typedef unsigned long WXCOLORREF; +typedef void * WXRGNDATA; +typedef struct tagMSG WXMSG; +typedef void * WXHCONV; +typedef void * WXHKEY; +typedef void * WXHTREEITEM; + +typedef void * WXDRAWITEMSTRUCT; +typedef void * WXMEASUREITEMSTRUCT; +typedef void * WXLPCREATESTRUCT; + +#ifdef __WXMSW__ +typedef WXHWND WXWidget; +#endif + +#ifdef __WIN64__ +typedef wxUint64 WXWPARAM; +typedef wxInt64 WXLPARAM; +typedef wxInt64 WXLRESULT; +#else +typedef wxW64 unsigned int WXWPARAM; +typedef wxW64 long WXLPARAM; +typedef wxW64 long WXLRESULT; +#endif + +/* + This is defined for compatibility only, it's not really the same thing as + FARPROC. + */ +#if defined(__GNUWIN32__) +typedef int (*WXFARPROC)(); +#else +typedef int (__stdcall *WXFARPROC)(); +#endif + +typedef WXLRESULT (wxSTDCALL *WXWNDPROC)(WXHWND, WXUINT, WXWPARAM, WXLPARAM); + +#endif /* __WIN32__ */ + + +#if defined(__WXMOTIF__) || defined(__WXX11__) +/* Stand-ins for X/Xt/Motif types */ +typedef void* WXWindow; +typedef void* WXWidget; +typedef void* WXAppContext; +typedef void* WXColormap; +typedef void* WXColor; +typedef void WXDisplay; +typedef void WXEvent; +typedef void* WXCursor; +typedef void* WXPixmap; +typedef void* WXFontStructPtr; +typedef void* WXGC; +typedef void* WXRegion; +typedef void* WXFont; +typedef void* WXImage; +typedef void* WXFontList; +typedef void* WXFontSet; +typedef void* WXRendition; +typedef void* WXRenderTable; +typedef void* WXFontType; /* either a XmFontList or XmRenderTable */ +typedef void* WXString; + +typedef unsigned long Atom; /* this might fail on a few architectures */ +typedef long WXPixel; /* safety catch in src/motif/colour.cpp */ + +#endif /* Motif */ + +#ifdef __WXGTK__ + +/* Stand-ins for GLIB types */ +typedef struct _GSList GSList; + +/* Stand-ins for GDK types */ +typedef struct _GdkColor GdkColor; +typedef struct _GdkCursor GdkCursor; +typedef struct _GdkDragContext GdkDragContext; + +#if defined(__WXGTK20__) + typedef struct _GdkAtom* GdkAtom; +#else + typedef unsigned long GdkAtom; +#endif + +#if !defined(__WXGTK3__) + typedef struct _GdkColormap GdkColormap; + typedef struct _GdkFont GdkFont; + typedef struct _GdkGC GdkGC; + typedef struct _GdkRegion GdkRegion; +#endif + +#if defined(__WXGTK3__) + typedef struct _GdkWindow GdkWindow; + typedef struct _GdkEventSequence GdkEventSequence; +#elif defined(__WXGTK20__) + typedef struct _GdkDrawable GdkWindow; + typedef struct _GdkDrawable GdkPixmap; +#else + typedef struct _GdkWindow GdkWindow; + typedef struct _GdkWindow GdkBitmap; + typedef struct _GdkWindow GdkPixmap; +#endif + +/* Stand-ins for GTK types */ +typedef struct _GtkWidget GtkWidget; +typedef struct _GtkRcStyle GtkRcStyle; +typedef struct _GtkAdjustment GtkAdjustment; +typedef struct _GtkToolbar GtkToolbar; +typedef struct _GtkNotebook GtkNotebook; +typedef struct _GtkNotebookPage GtkNotebookPage; +typedef struct _GtkAccelGroup GtkAccelGroup; +typedef struct _GtkSelectionData GtkSelectionData; +typedef struct _GtkTextBuffer GtkTextBuffer; +typedef struct _GtkRange GtkRange; +typedef struct _GtkCellRenderer GtkCellRenderer; + +typedef GtkWidget *WXWidget; + +#ifndef __WXGTK20__ +#define GTK_OBJECT_GET_CLASS(object) (GTK_OBJECT(object)->klass) +#define GTK_CLASS_TYPE(klass) ((klass)->type) +#endif + +#endif /* __WXGTK__ */ + +#if defined(__WXGTK20__) || (defined(__WXX11__) && wxUSE_UNICODE) +#define wxUSE_PANGO 1 +#else +#define wxUSE_PANGO 0 +#endif + +#if wxUSE_PANGO +/* Stand-ins for Pango types */ +typedef struct _PangoContext PangoContext; +typedef struct _PangoLayout PangoLayout; +typedef struct _PangoFontDescription PangoFontDescription; +#endif + +#ifdef __WXDFB__ +/* DirectFB doesn't have the concept of non-TLW window, so use + something arbitrary */ +typedef const void* WXWidget; +#endif /* DFB */ + +#ifdef __WXQT__ +#include "wx/qt/defs.h" +#endif + +/* include the feature test macros */ +#include "wx/features.h" + +/* --------------------------------------------------------------------------- */ +/* macros to define a class without copy ctor nor assignment operator */ +/* --------------------------------------------------------------------------- */ + +#if defined(__cplusplus) && (__cplusplus >= 201103L || wxCHECK_VISUALC_VERSION(14)) + #define wxMEMBER_DELETE = delete + + // Note that all these macros don't require a semicolon after them because + // they are empty in the "#else" branch and can't be followed by a + // semicolon in that case. + #define wxDECLARE_DEFAULT_COPY_CTOR(classname) \ + public: \ + classname(const classname&) = default; + + #define wxDECLARE_DEFAULT_COPY(classname) \ + wxDECLARE_DEFAULT_COPY_CTOR(classname) \ + classname& operator=(const classname&) = default; + + #define wxDECLARE_DEFAULT_COPY_AND_DEF(classname) \ + classname() = default; \ + wxDECLARE_DEFAULT_COPY(classname) +#else + #define wxMEMBER_DELETE + + // We can't do this without C++11 "= default". + #define wxDECLARE_DEFAULT_COPY_CTOR(classname) + #define wxDECLARE_DEFAULT_COPY(classname) + #define wxDECLARE_DEFAULT_COPY_AND_DEF(classname) +#endif + +#define wxDECLARE_NO_COPY_CLASS(classname) \ + private: \ + classname(const classname&) wxMEMBER_DELETE; \ + classname& operator=(const classname&) wxMEMBER_DELETE + +#define wxDECLARE_NO_COPY_TEMPLATE_CLASS(classname, arg) \ + private: \ + classname(const classname&) wxMEMBER_DELETE; \ + classname& operator=(const classname&) wxMEMBER_DELETE + +#define wxDECLARE_NO_COPY_TEMPLATE_CLASS_2(classname, arg1, arg2) \ + private: \ + classname(const classname&) wxMEMBER_DELETE; \ + classname& operator=(const classname&) wxMEMBER_DELETE + +#define wxDECLARE_NO_ASSIGN_CLASS(classname) \ + private: \ + classname& operator=(const classname&) wxMEMBER_DELETE + +#define wxDECLARE_NO_ASSIGN_DEF_COPY(classname) \ + wxDECLARE_DEFAULT_COPY_CTOR(classname) \ + private: \ + classname& operator=(const classname&) wxMEMBER_DELETE + +/* deprecated variants _not_ requiring a semicolon after them */ +#define DECLARE_NO_COPY_CLASS(classname) \ + wxDECLARE_NO_COPY_CLASS(classname); +#define DECLARE_NO_COPY_TEMPLATE_CLASS(classname, arg) \ + wxDECLARE_NO_COPY_TEMPLATE_CLASS(classname, arg); +#define DECLARE_NO_ASSIGN_CLASS(classname) \ + wxDECLARE_NO_ASSIGN_CLASS(classname); + +/* --------------------------------------------------------------------------- */ +/* If a manifest is being automatically generated, add common controls 6 to it */ +/* --------------------------------------------------------------------------- */ + +#if wxUSE_GUI && \ + (!defined wxUSE_NO_MANIFEST || wxUSE_NO_MANIFEST == 0 ) && \ + ( defined _MSC_FULL_VER && _MSC_FULL_VER >= 140040130 ) + +#define WX_CC_MANIFEST \ + "/manifestdependency:\"type='win32' \ + name='Microsoft.Windows.Common-Controls' \ + version='6.0.0.0' \ + processorArchitecture='*' \ + publicKeyToken='6595b64144ccf1df' \ + language='*'\"" + +#pragma comment(linker, WX_CC_MANIFEST) + +#endif /* !wxUSE_NO_MANIFEST && _MSC_FULL_VER >= 140040130 */ + +/* wxThread and wxProcess priorities */ +enum +{ + wxPRIORITY_MIN = 0u, /* lowest possible priority */ + wxPRIORITY_DEFAULT = 50u, /* normal priority */ + wxPRIORITY_MAX = 100u /* highest possible priority */ +}; + +#endif + /* _WX_DEFS_H_ */ diff --git a/lib/wxWidgets/include/wx/dfb/app.h b/lib/wxWidgets/include/wx/dfb/app.h new file mode 100644 index 0000000..1319964 --- /dev/null +++ b/lib/wxWidgets/include/wx/dfb/app.h @@ -0,0 +1,44 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dfb/app.h +// Purpose: wxApp class +// Author: Vaclav Slavik +// Created: 2006-08-10 +// Copyright: (c) 2006 REA Elektronik GmbH +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DFB_APP_H_ +#define _WX_DFB_APP_H_ + +#include "wx/dfb/dfbptr.h" + +#include "wx/vidmode.h" + +wxDFB_DECLARE_INTERFACE(IDirectFB); + +//----------------------------------------------------------------------------- +// wxApp +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxApp: public wxAppBase +{ +public: + wxApp(); + ~wxApp(); + + // override base class (pure) virtuals + virtual bool Initialize(int& argc, wxChar **argv); + virtual void CleanUp(); + + virtual void WakeUpIdle(); + + virtual wxVideoMode GetDisplayMode() const; + virtual bool SetDisplayMode(const wxVideoMode& mode); + +private: + wxVideoMode m_videoMode; + + wxDECLARE_DYNAMIC_CLASS(wxApp); +}; + +#endif // _WX_DFB_APP_H_ diff --git a/lib/wxWidgets/include/wx/dfb/bitmap.h b/lib/wxWidgets/include/wx/dfb/bitmap.h new file mode 100644 index 0000000..c3967b1 --- /dev/null +++ b/lib/wxWidgets/include/wx/dfb/bitmap.h @@ -0,0 +1,99 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dfb/bitmap.h +// Purpose: wxBitmap class +// Author: Vaclav Slavik +// Created: 2006-08-04 +// Copyright: (c) 2006 REA Elektronik GmbH +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DFB_BITMAP_H_ +#define _WX_DFB_BITMAP_H_ + +#include "wx/dfb/dfbptr.h" + +class WXDLLIMPEXP_FWD_CORE wxPixelDataBase; + +wxDFB_DECLARE_INTERFACE(IDirectFBSurface); + +//----------------------------------------------------------------------------- +// wxBitmap +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBitmap : public wxBitmapBase +{ +public: + wxBitmap() {} + wxBitmap(const wxIDirectFBSurfacePtr& surface) { Create(surface); } + wxBitmap(int width, int height, int depth = -1) { Create(width, height, depth); } + wxBitmap(const wxSize& sz, int depth = -1) { Create(sz, depth); } + wxBitmap(int width, int height, const wxDC& dc) { Create(width, height, dc); } + wxBitmap(const char bits[], int width, int height, int depth = 1); + wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); + wxBitmap(const char* const* bits); +#if wxUSE_IMAGE + wxBitmap(const wxImage& image, int depth = -1, double scale = 1.0) + { InitFromImage(image, depth, scale); } + wxBitmap(const wxImage& image, const wxDC& WXUNUSED(dc)) + { InitFromImage(image, -1, 1.0); } +#endif + + bool Create(const wxIDirectFBSurfacePtr& surface); + bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); + bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) + { return Create(sz.GetWidth(), sz.GetHeight(), depth); } + bool Create(int width, int height, const wxDC& WXUNUSED(dc)) + { return Create(width,height); } + + virtual int GetHeight() const; + virtual int GetWidth() const; + virtual int GetDepth() const; + +#if wxUSE_IMAGE + virtual wxImage ConvertToImage() const; +#endif + + virtual wxMask *GetMask() const; + virtual void SetMask(wxMask *mask); + + virtual wxBitmap GetSubBitmap(const wxRect& rect) const; + + virtual bool SaveFile(const wxString &name, wxBitmapType type, + const wxPalette *palette = NULL) const; + virtual bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); + +#if wxUSE_PALETTE + virtual wxPalette *GetPalette() const; + virtual void SetPalette(const wxPalette& palette); +#endif + + static void InitStandardHandlers(); + + // raw bitmap access support functions + void *GetRawData(wxPixelDataBase& data, int bpp); + void UngetRawData(wxPixelDataBase& data); + + bool HasAlpha() const; + + // implementation: +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED(virtual void SetHeight(int height)); + wxDEPRECATED(virtual void SetWidth(int width)); + wxDEPRECATED(virtual void SetDepth(int depth)); +#endif + + // get underlying native representation: + wxIDirectFBSurfacePtr GetDirectFBSurface() const; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + + void InitFromImage(const wxImage& image, int depth, double scale); + + bool CreateWithFormat(int width, int height, int dfbFormat); + + wxDECLARE_DYNAMIC_CLASS(wxBitmap); +}; + +#endif // _WX_DFB_BITMAP_H_ diff --git a/lib/wxWidgets/include/wx/dfb/brush.h b/lib/wxWidgets/include/wx/dfb/brush.h new file mode 100644 index 0000000..278f64e --- /dev/null +++ b/lib/wxWidgets/include/wx/dfb/brush.h @@ -0,0 +1,63 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dfb/brush.h +// Purpose: wxBrush class declaration +// Author: Vaclav Slavik +// Created: 2006-08-04 +// Copyright: (c) 2006 REA Elektronik GmbH +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DFB_BRUSH_H_ +#define _WX_DFB_BRUSH_H_ + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/string.h" +#include "wx/gdiobj.h" +#include "wx/bitmap.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxBitmap; +class WXDLLIMPEXP_FWD_CORE wxBrush; + +//----------------------------------------------------------------------------- +// wxBrush +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBrush : public wxBrushBase +{ +public: + wxBrush() {} + wxBrush(const wxColour &colour, wxBrushStyle style = wxBRUSHSTYLE_SOLID); + wxBrush(const wxBitmap &stippleBitmap); + + bool operator==(const wxBrush& brush) const; + bool operator!=(const wxBrush& brush) const { return !(*this == brush); } + + wxBrushStyle GetStyle() const; + wxColour GetColour() const; + wxBitmap *GetStipple() const; + + void SetColour(const wxColour& col); + void SetColour(unsigned char r, unsigned char g, unsigned char b); + void SetStyle(wxBrushStyle style); + void SetStipple(const wxBitmap& stipple); + + + wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants") + wxBrush(const wxColour& col, int style); + + wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants") + void SetStyle(int style) { SetStyle((wxBrushStyle)style); } + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + + wxDECLARE_DYNAMIC_CLASS(wxBrush); +}; + +#endif // _WX_DFB_BRUSH_H_ diff --git a/lib/wxWidgets/include/wx/dfb/chkconf.h b/lib/wxWidgets/include/wx/dfb/chkconf.h new file mode 100644 index 0000000..89f35ed --- /dev/null +++ b/lib/wxWidgets/include/wx/dfb/chkconf.h @@ -0,0 +1,41 @@ +/* + * Name: wx/dfb/chkconf.h + * Author: Vaclav Slavik + * Purpose: Compiler-specific configuration checking + * Created: 2006-08-10 + * Copyright: (c) 2006 REA Elektronik GmbH + * Licence: wxWindows licence + */ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#ifndef _WX_DFB_CHKCONF_H_ +#define _WX_DFB_CHKCONF_H_ + +#ifndef __WXUNIVERSAL__ +# error "wxDirectFB cannot be built without wxUniversal" +#endif + +#if !wxUSE_CONFIG +# error "wxFileConfig is required by wxDFB port" +#endif + +#if wxUSE_SOCKETS && !wxUSE_CONSOLE_EVENTLOOP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxSocket requires wxSelectDispatcher in wxDFB" +# else +# undef wxUSE_CONSOLE_EVENTLOOP +# define wxUSE_CONSOLE_EVENTLOOP 1 +# endif +#endif + +#if wxUSE_DATAOBJ +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxDataObject not supported in wxDFB" +# else +# undef wxUSE_DATAOBJ +# define wxUSE_DATAOBJ 0 +# endif +#endif + +#endif /* _WX_DFB_CHKCONF_H_ */ diff --git a/lib/wxWidgets/include/wx/dfb/cursor.h b/lib/wxWidgets/include/wx/dfb/cursor.h new file mode 100644 index 0000000..86b2e85 --- /dev/null +++ b/lib/wxWidgets/include/wx/dfb/cursor.h @@ -0,0 +1,49 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dfb/cursor.h +// Purpose: wxCursor declaration +// Author: Vaclav Slavik +// Created: 2006-08-08 +// Copyright: (c) 2006 REA Elektronik GmbH +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DFB_CURSOR_H_ +#define _WX_DFB_CURSOR_H_ + +class WXDLLIMPEXP_FWD_CORE wxBitmap; +class WXDLLIMPEXP_FWD_CORE wxImage; + +//----------------------------------------------------------------------------- +// wxCursor +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxCursor : public wxCursorBase +{ +public: + wxCursor() {} + wxCursor(wxStockCursor id) { InitFromStock(id); } +#if WXWIN_COMPATIBILITY_2_8 + wxCursor(int id) { InitFromStock((wxStockCursor)id); } +#endif +#if wxUSE_IMAGE + wxCursor(const wxImage& image); + wxCursor(const char* const* xpmData); +#endif // wxUSE_IMAGE + wxCursor(const wxString& name, + wxBitmapType type = wxCURSOR_DEFAULT_TYPE, + int hotSpotX = 0, int hotSpotY = 0); + + // implementation + wxBitmap GetBitmap() const; + +protected: + void InitFromStock(wxStockCursor); + + // ref counting code + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + + wxDECLARE_DYNAMIC_CLASS(wxCursor); +}; + +#endif // _WX_DFB_CURSOR_H_ diff --git a/lib/wxWidgets/include/wx/dfb/dc.h b/lib/wxWidgets/include/wx/dfb/dc.h new file mode 100644 index 0000000..4dac548 --- /dev/null +++ b/lib/wxWidgets/include/wx/dfb/dc.h @@ -0,0 +1,165 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dfb/dc.h +// Purpose: wxDC class +// Author: Vaclav Slavik +// Created: 2006-08-07 +// Copyright: (c) 2006 REA Elektronik GmbH +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DFB_DC_H_ +#define _WX_DFB_DC_H_ + +#include "wx/defs.h" +#include "wx/region.h" +#include "wx/dc.h" +#include "wx/dfb/dfbptr.h" + +wxDFB_DECLARE_INTERFACE(IDirectFBSurface); + +//----------------------------------------------------------------------------- +// wxDFBDCImpl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDFBDCImpl : public wxDCImpl +{ +public: + // ctors + wxDFBDCImpl(wxDC *owner) : wxDCImpl(owner) { m_surface = NULL; } + wxDFBDCImpl(wxDC *owner, const wxIDirectFBSurfacePtr& surface) + : wxDCImpl(owner) + { + DFBInit(surface); + } + + bool IsOk() const { return m_surface != NULL; } + + // implement base class pure virtuals + // ---------------------------------- + + virtual void Clear(); + + virtual bool StartDoc(const wxString& message); + virtual void EndDoc(); + + virtual void StartPage(); + virtual void EndPage(); + + virtual void SetFont(const wxFont& font); + virtual void SetPen(const wxPen& pen); + virtual void SetBrush(const wxBrush& brush); + virtual void SetBackground(const wxBrush& brush); + virtual void SetBackgroundMode(int mode); +#if wxUSE_PALETTE + virtual void SetPalette(const wxPalette& palette); +#endif + + virtual void SetLogicalFunction(wxRasterOperationMode function); + + virtual void DestroyClippingRegion(); + + virtual wxCoord GetCharHeight() const; + virtual wxCoord GetCharWidth() const; + virtual void DoGetTextExtent(const wxString& string, + wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + const wxFont *theFont = NULL) const; + + virtual bool CanDrawBitmap() const { return true; } + virtual bool CanGetTextExtent() const { return true; } + virtual int GetDepth() const; + virtual wxSize GetPPI() const; + + // Returns the surface (and increases its ref count) + wxIDirectFBSurfacePtr GetDirectFBSurface() const { return m_surface; } + +protected: + // implementation + wxCoord XDEV2LOG(wxCoord x) const { return DeviceToLogicalX(x); } + wxCoord XDEV2LOGREL(wxCoord x) const { return DeviceToLogicalXRel(x); } + wxCoord YDEV2LOG(wxCoord y) const { return DeviceToLogicalY(y); } + wxCoord YDEV2LOGREL(wxCoord y) const { return DeviceToLogicalYRel(y); } + wxCoord XLOG2DEV(wxCoord x) const { return LogicalToDeviceX(x); } + wxCoord XLOG2DEVREL(wxCoord x) const { return LogicalToDeviceXRel(x); } + wxCoord YLOG2DEV(wxCoord y) const { return LogicalToDeviceY(y); } + wxCoord YLOG2DEVREL(wxCoord y) const { return LogicalToDeviceYRel(y); } + + // initializes the DC from a surface, must be called if default ctor + // was used + void DFBInit(const wxIDirectFBSurfacePtr& surface); + + virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, + wxFloodFillStyle style = wxFLOOD_SURFACE); + + virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const; + + virtual void DoDrawPoint(wxCoord x, wxCoord y); + virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); + + virtual void DoDrawArc(wxCoord x1, wxCoord y1, + wxCoord x2, wxCoord y2, + wxCoord xc, wxCoord yc); + virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, + double sa, double ea); + + virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, + wxCoord width, wxCoord height, + double radius); + virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + + virtual void DoCrossHair(wxCoord x, wxCoord y); + + virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); + virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, + bool useMask = false); + + virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); + virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, + double angle); + + virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, + wxDC *source, wxCoord xsrc, wxCoord ysrc, + wxRasterOperationMode rop = wxCOPY, bool useMask = false, + wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); + + virtual void DoSetClippingRegion(wxCoord x, wxCoord y, + wxCoord width, wxCoord height); + virtual void DoSetDeviceClippingRegion(const wxRegion& region); + + virtual void DoGetSize(int *width, int *height) const; + virtual void DoGetSizeMM(int* width, int* height) const; + + virtual void DoDrawLines(int n, const wxPoint points[], + wxCoord xoffset, wxCoord yoffset); + virtual void DoDrawPolygon(int n, const wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + wxPolygonFillMode fillStyle = wxODDEVEN_RULE); + + // implementation from now on: +protected: + wxIDirectFBFontPtr GetCurrentFont() const; + +private: + // Unified implementation of DrawIcon, DrawBitmap and Blit: + void DoDrawSubBitmap(const wxBitmap &bmp, + wxCoord x, wxCoord y, wxCoord w, wxCoord h, + wxCoord destx, wxCoord desty, int rop, bool useMask); + bool DoBlitFromSurface(const wxIDirectFBSurfacePtr& src, + wxCoord srcx, wxCoord srcy, + wxCoord w, wxCoord h, + wxCoord dstx, wxCoord dsty); + + // selects colour into surface's state + void SelectColour(const wxColour& clr); + +protected: + wxIDirectFBSurfacePtr m_surface; + + friend class WXDLLIMPEXP_FWD_CORE wxOverlayImpl; // for Init + + wxDECLARE_ABSTRACT_CLASS(wxDFBDCImpl); +}; + +#endif // _WX_DFB_DC_H_ diff --git a/lib/wxWidgets/include/wx/dfb/dcclient.h b/lib/wxWidgets/include/wx/dfb/dcclient.h new file mode 100644 index 0000000..bc185c6 --- /dev/null +++ b/lib/wxWidgets/include/wx/dfb/dcclient.h @@ -0,0 +1,73 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dfb/dcclient.h +// Purpose: wxWindowDCImpl, wxClientDCImpl and wxPaintDCImpl +// Author: Vaclav Slavik +// Created: 2006-08-10 +// Copyright: (c) 2006 REA Elektronik GmbH +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DFB_DCCLIENT_H_ +#define _WX_DFB_DCCLIENT_H_ + +#include "wx/dfb/dc.h" + +class WXDLLIMPEXP_FWD_CORE wxWindow; + +//----------------------------------------------------------------------------- +// wxWindowDCImpl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWindowDCImpl : public wxDFBDCImpl +{ +public: + wxWindowDCImpl(wxDC *owner) : wxDFBDCImpl(owner), m_shouldFlip(false) { } + wxWindowDCImpl(wxDC *owner, wxWindow *win); + virtual ~wxWindowDCImpl(); + +protected: + // initializes the DC for painting on given window; if rect!=NULL, then + // for painting only on the given region of the window + void InitForWin(wxWindow *win, const wxRect *rect); + +private: + wxRect m_winRect; // rectangle of the window being painted + + bool m_shouldFlip; // flip the surface when done? + + friend class wxOverlayImpl; // for m_shouldFlip; + + wxDECLARE_DYNAMIC_CLASS(wxWindowDCImpl); + wxDECLARE_NO_COPY_CLASS(wxWindowDCImpl); +}; + +//----------------------------------------------------------------------------- +// wxClientDCImpl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxClientDCImpl : public wxWindowDCImpl +{ +public: + wxClientDCImpl(wxDC *owner) : wxWindowDCImpl(owner) { } + wxClientDCImpl(wxDC *owner, wxWindow *win); + + wxDECLARE_DYNAMIC_CLASS(wxClientDCImpl); + wxDECLARE_NO_COPY_CLASS(wxClientDCImpl); +}; + + +//----------------------------------------------------------------------------- +// wxPaintDCImpl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPaintDCImpl : public wxClientDCImpl +{ +public: + wxPaintDCImpl(wxDC *owner) : wxClientDCImpl(owner) { } + wxPaintDCImpl(wxDC *owner, wxWindow *win) : wxClientDCImpl(owner, win) { } + + wxDECLARE_DYNAMIC_CLASS(wxPaintDCImpl); + wxDECLARE_NO_COPY_CLASS(wxPaintDCImpl); +}; + +#endif // _WX_DFB_DCCLIENT_H_ diff --git a/lib/wxWidgets/include/wx/dfb/dcmemory.h b/lib/wxWidgets/include/wx/dfb/dcmemory.h new file mode 100644 index 0000000..0ea21e1 --- /dev/null +++ b/lib/wxWidgets/include/wx/dfb/dcmemory.h @@ -0,0 +1,37 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dfb/dcmemory.h +// Purpose: wxMemoryDC class declaration +// Created: 2006-08-10 +// Author: Vaclav Slavik +// Copyright: (c) 2006 REA Elektronik GmbH +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DFB_DCMEMORY_H_ +#define _WX_DFB_DCMEMORY_H_ + +#include "wx/dfb/dc.h" +#include "wx/bitmap.h" + +class WXDLLIMPEXP_CORE wxMemoryDCImpl : public wxDFBDCImpl +{ +public: + wxMemoryDCImpl(wxMemoryDC *owner); + wxMemoryDCImpl(wxMemoryDC *owner, wxBitmap& bitmap); + wxMemoryDCImpl(wxMemoryDC *owner, wxDC *dc); // create compatible DC + + // override wxMemoryDC-specific base class virtual methods + virtual const wxBitmap& GetSelectedBitmap() const { return m_bmp; } + virtual wxBitmap& GetSelectedBitmap() { return m_bmp; } + virtual void DoSelect(const wxBitmap& bitmap); + +private: + void Init(); + + wxBitmap m_bmp; + + wxDECLARE_DYNAMIC_CLASS(wxMemoryDCImpl); +}; + +#endif // _WX_DFB_DCMEMORY_H_ + diff --git a/lib/wxWidgets/include/wx/dfb/dcscreen.h b/lib/wxWidgets/include/wx/dfb/dcscreen.h new file mode 100644 index 0000000..d35d1ef --- /dev/null +++ b/lib/wxWidgets/include/wx/dfb/dcscreen.h @@ -0,0 +1,23 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dfb/dcscreen.h +// Purpose: wxScreenDCImpl declaration +// Author: Vaclav Slavik +// Created: 2006-08-10 +// Copyright: (c) 2006 REA Elektronik GmbH +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DFB_DCSCREEN_H_ +#define _WX_DFB_DCSCREEN_H_ + +#include "wx/dfb/dc.h" + +class WXDLLIMPEXP_CORE wxScreenDCImpl : public wxDFBDCImpl +{ +public: + wxScreenDCImpl(wxScreenDC *owner); + + wxDECLARE_DYNAMIC_CLASS(wxScreenDCImpl); +}; + +#endif // _WX_DFB_DCSCREEN_H_ diff --git a/lib/wxWidgets/include/wx/dfb/dfbptr.h b/lib/wxWidgets/include/wx/dfb/dfbptr.h new file mode 100644 index 0000000..0d442b8 --- /dev/null +++ b/lib/wxWidgets/include/wx/dfb/dfbptr.h @@ -0,0 +1,109 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dfb/dfbptr.h +// Purpose: wxDfbPtr for holding objects declared in wrapdfb.h +// Author: Vaclav Slavik +// Created: 2006-08-09 +// Copyright: (c) 2006 REA Elektronik GmbH +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DFB_DFBPTR_H_ +#define _WX_DFB_DFBPTR_H_ + +//----------------------------------------------------------------------------- +// wxDFB_DECLARE_INTERFACE +//----------------------------------------------------------------------------- + +/** + Forward declares wx wrapper around DirectFB interface @a name. + + Also declares wx##name##Ptr typedef for wxDfbPtr pointer. + + @param name name of the DirectFB interface + */ +#define wxDFB_DECLARE_INTERFACE(name) \ + class wx##name; \ + typedef wxDfbPtr wx##name##Ptr + + +//----------------------------------------------------------------------------- +// wxDfbPtr +//----------------------------------------------------------------------------- + +class wxDfbWrapperBase; + +class WXDLLIMPEXP_CORE wxDfbPtrBase +{ +protected: + static void DoAddRef(wxDfbWrapperBase *ptr); + static void DoRelease(wxDfbWrapperBase *ptr); +}; + +/** + This template implements smart pointer for keeping pointers to DirectFB + wrappers (i.e. wxIFoo classes derived from wxDfbWrapper). Interface's + reference count is increased on copying and the interface is released when + the pointer is deleted. + */ +template +class wxDfbPtr : private wxDfbPtrBase +{ +public: + /** + Creates the pointer from raw pointer to the wrapper. + + Takes ownership of @a ptr, i.e. AddRef() is @em not called on it. + */ + wxDfbPtr(T *ptr = NULL) : m_ptr(ptr) {} + + /// Copy ctor + wxDfbPtr(const wxDfbPtr& ptr) { InitFrom(ptr); } + + /// Dtor. Releases the interface + ~wxDfbPtr() { Reset(); } + + /// Resets the pointer to NULL, decreasing reference count of the interface. + void Reset() + { + if ( m_ptr ) + { + this->DoRelease((wxDfbWrapperBase*)m_ptr); + m_ptr = NULL; + } + } + + /// Cast to the wrapper pointer + operator T*() const { return m_ptr; } + + // standard operators: + + wxDfbPtr& operator=(T *ptr) + { + Reset(); + m_ptr = ptr; + return *this; + } + + wxDfbPtr& operator=(const wxDfbPtr& ptr) + { + Reset(); + InitFrom(ptr); + return *this; + } + + T& operator*() const { return *m_ptr; } + T* operator->() const { return m_ptr; } + +private: + void InitFrom(const wxDfbPtr& ptr) + { + m_ptr = ptr.m_ptr; + if ( m_ptr ) + this->DoAddRef((wxDfbWrapperBase*)m_ptr); + } + +private: + T *m_ptr; +}; + +#endif // _WX_DFB_DFBPTR_H_ diff --git a/lib/wxWidgets/include/wx/dfb/evtloop.h b/lib/wxWidgets/include/wx/dfb/evtloop.h new file mode 100644 index 0000000..c328e21 --- /dev/null +++ b/lib/wxWidgets/include/wx/dfb/evtloop.h @@ -0,0 +1,46 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/dfb/evtloop.h +// Purpose: declares wxEventLoop class +// Author: Vaclav Slavik +// Created: 2006-08-16 +// Copyright: (c) 2006 REA Elektronik GmbH +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DFB_EVTLOOP_H_ +#define _WX_DFB_EVTLOOP_H_ + +#include "wx/dfb/dfbptr.h" +#include "wx/unix/evtloop.h" + +wxDFB_DECLARE_INTERFACE(IDirectFBEventBuffer); + +// ---------------------------------------------------------------------------- +// wxEventLoop +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxConsoleEventLoop +{ +public: + wxGUIEventLoop(); + + // returns DirectFB event buffer used by wx + static wxIDirectFBEventBufferPtr GetDirectFBEventBuffer(); + +protected: + virtual void DoYieldFor(long eventsToProcess); + +private: + static void InitBuffer(); + static void CleanUp(); + + friend class wxApp; // calls CleanUp() + +private: + static wxIDirectFBEventBufferPtr ms_buffer; + static int ms_bufferFd; + + wxDECLARE_NO_COPY_CLASS(wxGUIEventLoop); +}; + +#endif // _WX_DFB_EVTLOOP_H_ diff --git a/lib/wxWidgets/include/wx/dfb/font.h b/lib/wxWidgets/include/wx/dfb/font.h new file mode 100644 index 0000000..14d91b5 --- /dev/null +++ b/lib/wxWidgets/include/wx/dfb/font.h @@ -0,0 +1,122 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dfb/font.h +// Author: Vaclav Slavik +// Purpose: wxFont declaration +// Created: 2006-08-08 +// Copyright: (c) 2006 REA Elektronik GmbH +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DFB_FONT_H_ +#define _WX_DFB_FONT_H_ + +#include "wx/dfb/dfbptr.h" + +wxDFB_DECLARE_INTERFACE(IDirectFBFont); + +// ---------------------------------------------------------------------------- +// wxFont +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFont : public wxFontBase +{ +public: + wxFont() {} + + wxFont(const wxFontInfo& info) + { + Create(info.GetPointSize(), + info.GetFamily(), + info.GetStyle(), + info.GetWeight(), + info.IsUnderlined(), + info.GetFaceName(), + info.GetEncoding()); + + if ( info.IsUsingSizeInPixels() ) + SetPixelSize(info.GetPixelSize()); + } + + wxFont(const wxNativeFontInfo& info) { Create(info); } + + wxFont(const wxString& nativeFontInfoString); + + wxFont(int size, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + Create(size, family, style, weight, underlined, face, encoding); + } + + wxFont(const wxSize& pixelSize, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + Create(10, family, style, weight, underlined, face, encoding); + SetPixelSize(pixelSize); + } + + bool Create(int size, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + bool Create(const wxNativeFontInfo& fontinfo); + + // implement base class pure virtuals + virtual double GetFractionalPointSize() const; + virtual wxFontStyle GetStyle() const; + virtual int GetNumericWeight() const; + virtual wxString GetFaceName() const; + virtual bool GetUnderlined() const; + virtual wxFontEncoding GetEncoding() const; + virtual bool IsFixedWidth() const; + virtual const wxNativeFontInfo *GetNativeFontInfo() const; + + virtual void SetFractionalPointSize(double pointSize); + virtual void SetFamily(wxFontFamily family); + virtual void SetStyle(wxFontStyle style); + virtual void SetNumericWeight(int weight); + virtual bool SetFaceName(const wxString& faceName); + virtual void SetUnderlined(bool underlined); + virtual void SetEncoding(wxFontEncoding encoding); + + wxDECLARE_COMMON_FONT_METHODS(); + + + wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants") + wxFont(int size, + int family, + int style, + int weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); + } + + // implementation from now on: + wxIDirectFBFontPtr GetDirectFBFont(bool antialiased) const; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + + virtual wxFontFamily DoGetFamily() const; + +private: + wxDECLARE_DYNAMIC_CLASS(wxFont); +}; + +#endif // _WX_DFB_FONT_H_ diff --git a/lib/wxWidgets/include/wx/dfb/nonownedwnd.h b/lib/wxWidgets/include/wx/dfb/nonownedwnd.h new file mode 100644 index 0000000..c586ab3 --- /dev/null +++ b/lib/wxWidgets/include/wx/dfb/nonownedwnd.h @@ -0,0 +1,125 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/dfb/nonownedwnd.h +// Purpose: declares wxNonOwnedWindow class +// Author: Vaclav Slavik +// Modified by: +// Created: 2006-12-24 +// Copyright: (c) 2006 TT-Solutions +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DFB_NONOWNEDWND_H_ +#define _WX_DFB_NONOWNEDWND_H_ + +#include "wx/window.h" +#include "wx/dfb/dfbptr.h" + +wxDFB_DECLARE_INTERFACE(IDirectFBWindow); +class wxDfbQueuedPaintRequests; +struct wxDFBWindowEvent; +class wxDFBEventsHandler; + +//----------------------------------------------------------------------------- +// wxNonOwnedWindow +//----------------------------------------------------------------------------- + +// This class represents "non-owned" window. A window is owned by another +// window if it has a parent and is positioned within the parent. For example, +// wxFrame is non-owned, because even though it can have a parent, it's +// location is independent of it. This class is for internal use only, it's +// the base class for wxTopLevelWindow and wxPopupWindow. +class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxNonOwnedWindowBase +{ +public: + // construction + wxNonOwnedWindow() { Init(); } + wxNonOwnedWindow(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)) + { + Init(); + + Create(parent, id, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)); + + virtual ~wxNonOwnedWindow(); + + // implement base class pure virtuals + virtual bool Show(bool show = true); + + virtual void Update(); + + virtual void Raise(); + virtual void Lower(); + + // implementation from now on + // -------------------------- + + void OnInternalIdle(); + + wxIDirectFBWindowPtr GetDirectFBWindow() const { return m_dfbwin; } + + // Returns true if some invalidated area of the TLW is currently being + // painted + bool IsPainting() const { return m_isPainting; } + +protected: + // common part of all ctors + void Init(); + + virtual wxIDirectFBSurfacePtr ObtainDfbSurface() const; + + // overridden wxWindow methods + virtual void DoGetPosition(int *x, int *y) const; + virtual void DoGetSize(int *width, int *height) const; + virtual void DoMoveWindow(int x, int y, int width, int height); + + virtual void DoRefreshRect(const wxRect& rect); + + // sets DirectFB keyboard focus to this toplevel window (note that DFB + // focus is different from wx: only shown TLWs can have it and not any + // wxWindows as in wx + void SetDfbFocus(); + + // overridden in wxTopLevelWindowDFB, there's no common handling for wxTLW + // and wxPopupWindow to be done here + virtual void HandleFocusEvent(const wxDFBWindowEvent& WXUNUSED(event_)) {} + +private: + // do queued painting in idle time + void HandleQueuedPaintRequests(); + + // DirectFB events handling + static void HandleDFBWindowEvent(const wxDFBWindowEvent& event_); + +protected: + // did we sent wxSizeEvent at least once? + bool m_sizeSet:1; + + // window's opacity (0: transparent, 255: opaque) + wxByte m_opacity; + + // interface to the underlying DirectFB window + wxIDirectFBWindowPtr m_dfbwin; + +private: + // invalidated areas of the TLW that need repainting + wxDfbQueuedPaintRequests *m_toPaint; + // are we currently painting some area of this TLW? + bool m_isPainting; + + friend class wxDFBEventsHandler; // for HandleDFBWindowEvent + friend class wxWindowDFB; // for SetDfbFocus +}; + +#endif // _WX_DFB_NONOWNEDWND_H_ diff --git a/lib/wxWidgets/include/wx/dfb/pen.h b/lib/wxWidgets/include/wx/dfb/pen.h new file mode 100644 index 0000000..24b03a9 --- /dev/null +++ b/lib/wxWidgets/include/wx/dfb/pen.h @@ -0,0 +1,76 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dfb/pen.h +// Purpose: wxPen class declaration +// Author: Vaclav Slavik +// Created: 2006-08-04 +// Copyright: (c) 2006 REA Elektronik GmbH +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DFB_PEN_H_ +#define _WX_DFB_PEN_H_ + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/string.h" +#include "wx/gdiobj.h" +#include "wx/gdicmn.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxBitmap; +class WXDLLIMPEXP_FWD_CORE wxPen; + +//----------------------------------------------------------------------------- +// wxPen +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPen: public wxPenBase +{ +public: + wxPen() {} + wxPen(const wxColour &colour, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID); + + wxPen(const wxBitmap& stipple, int width); + + wxPen(const wxPenInfo& info); + + bool operator==(const wxPen& pen) const; + bool operator!=(const wxPen& pen) const { return !(*this == pen); } + + void SetColour(const wxColour &colour); + void SetColour(unsigned char red, unsigned char green, unsigned char blue); + void SetCap(wxPenCap capStyle); + void SetJoin(wxPenJoin joinStyle); + void SetStyle(wxPenStyle style); + void SetWidth(int width); + void SetDashes(int number_of_dashes, const wxDash *dash); + void SetStipple(const wxBitmap& stipple); + + wxColour GetColour() const; + wxPenCap GetCap() const; + wxPenJoin GetJoin() const; + wxPenStyle GetStyle() const; + int GetWidth() const; + int GetDashes(wxDash **ptr) const; + int GetDashCount() const; + wxDash* GetDash() const; + wxBitmap *GetStipple() const; + + + wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") + wxPen(const wxColour& col, int width, int style); + + wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") + void SetStyle(int style) { SetStyle((wxPenStyle)style); } + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + + wxDECLARE_DYNAMIC_CLASS(wxPen); +}; + +#endif // _WX_DFB_PEN_H_ diff --git a/lib/wxWidgets/include/wx/dfb/popupwin.h b/lib/wxWidgets/include/wx/dfb/popupwin.h new file mode 100644 index 0000000..73c9dad --- /dev/null +++ b/lib/wxWidgets/include/wx/dfb/popupwin.h @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/dfb/popupwin.h +// Purpose: wxPopupWindow class for wxDFB +// Author: Vaclav Slavik +// Created: 2006-12-24 +// Copyright: (c) 2006 TT-Solutions +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DFB_POPUPWIN_H_ +#define _WX_DFB_POPUPWIN_H_ + +// ---------------------------------------------------------------------------- +// wxPopupWindow +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPopupWindow : public wxPopupWindowBase +{ +public: + wxPopupWindow() {} + + wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE) + { Create(parent, flags); } + + bool Create(wxWindow *parent, int flags = wxBORDER_NONE) + { + if ( !wxPopupWindowBase::Create(parent) ) + return false; + + return wxNonOwnedWindow::Create + ( + parent, + -1, + // DFB windows must have valid pos & size: + wxPoint(0, 0), wxSize(1, 1), + (flags & wxBORDER_MASK) | wxPOPUP_WINDOW + ); + } + + wxDECLARE_DYNAMIC_CLASS(wxPopupWindow); +}; + +#endif // _WX_DFB_POPUPWIN_H_ + diff --git a/lib/wxWidgets/include/wx/dfb/private.h b/lib/wxWidgets/include/wx/dfb/private.h new file mode 100644 index 0000000..d8c0b86 --- /dev/null +++ b/lib/wxWidgets/include/wx/dfb/private.h @@ -0,0 +1,40 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dfb/private.h +// Purpose: private helpers for wxDFB implementation +// Author: Vaclav Slavik +// Created: 2006-08-09 +// Copyright: (c) 2006 REA Elektronik GmbH +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DFB_PRIVATE_H_ +#define _WX_DFB_PRIVATE_H_ + +#include "wx/intl.h" +#include "wx/log.h" + +#include "wx/dfb/wrapdfb.h" +#include + +//----------------------------------------------------------------------------- +// misc helpers +//----------------------------------------------------------------------------- + +/// Convert DirectFB timestamp to wxEvent one: +#define wxDFB_EVENT_TIMESTAMP(event) \ + ((event).timestamp.tv_sec * 1000 + (event).timestamp.tv_usec / 1000) + +/** + Check if DirectFB library version is at least @a major.@a minor.@a release. + + @see wxCHECK_VERSION + */ +#define wxCHECK_DFB_VERSION(major,minor,release) \ + (DIRECTFB_MAJOR_VERSION > (major) || \ + (DIRECTFB_MAJOR_VERSION == (major) && \ + DIRECTFB_MINOR_VERSION > (minor)) || \ + (DIRECTFB_MAJOR_VERSION == (major) && \ + DIRECTFB_MINOR_VERSION == (minor) && \ + DIRECTFB_MICRO_VERSION >= (release))) + +#endif // _WX_DFB_PRIVATE_H_ diff --git a/lib/wxWidgets/include/wx/dfb/private/fontmgr.h b/lib/wxWidgets/include/wx/dfb/private/fontmgr.h new file mode 100644 index 0000000..bec290a --- /dev/null +++ b/lib/wxWidgets/include/wx/dfb/private/fontmgr.h @@ -0,0 +1,83 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dfb/private/fontmgr.h +// Purpose: font management for wxDFB +// Author: Vaclav Slavik +// Created: 2006-11-18 +// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com) +// (c) 2006 REA Elektronik GmbH +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DFB_PRIVATE_FONTMGR_H_ +#define _WX_DFB_PRIVATE_FONTMGR_H_ + +#include "wx/dfb/wrapdfb.h" + +class wxFileConfig; + +class wxFontInstance : public wxFontInstanceBase +{ +public: + wxFontInstance(float ptSize, bool aa, const wxString& filename); + + wxIDirectFBFontPtr GetDirectFBFont() const { return m_font; } + +private: + wxIDirectFBFontPtr m_font; +}; + +class wxFontFace : public wxFontFaceBase +{ +public: + wxFontFace(const wxString& filename) : m_fileName(filename) {} + +protected: + wxFontInstance *CreateFontInstance(float ptSize, bool aa); + +private: + wxString m_fileName; +}; + +class wxFontBundle : public wxFontBundleBase +{ +public: + wxFontBundle(const wxString& name, + const wxString& fileRegular, + const wxString& fileBold, + const wxString& fileItalic, + const wxString& fileBoldItalic, + bool isFixed); + + /// Returns name of the family + virtual wxString GetName() const { return m_name; } + + virtual bool IsFixed() const { return m_isFixed; } + +private: + wxString m_name; + bool m_isFixed; +}; + +class wxFontsManager : public wxFontsManagerBase +{ +public: + wxFontsManager() { AddAllFonts(); } + + virtual wxString GetDefaultFacename(wxFontFamily family) const + { + return m_defaultFacenames[family]; + } + +private: + // adds all fonts using AddBundle() + void AddAllFonts(); + void AddFontsFromDir(const wxString& indexFile); + void AddFont(const wxString& dir, const wxString& name, wxFileConfig& cfg); + void SetDefaultFonts(wxFileConfig& cfg); + +private: + // default facenames + wxString m_defaultFacenames[wxFONTFAMILY_MAX]; +}; + +#endif // _WX_DFB_PRIVATE_FONTMGR_H_ diff --git a/lib/wxWidgets/include/wx/dfb/private/overlay.h b/lib/wxWidgets/include/wx/dfb/private/overlay.h new file mode 100644 index 0000000..bfa262d --- /dev/null +++ b/lib/wxWidgets/include/wx/dfb/private/overlay.h @@ -0,0 +1,52 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dfb/private/overlay.h +// Purpose: wxOverlayImpl declaration +// Author: Vaclav Slavik +// Created: 2006-10-20 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DFB_PRIVATE_OVERLAY_H_ +#define _WX_DFB_PRIVATE_OVERLAY_H_ + +#include "wx/dfb/dfbptr.h" +#include "wx/gdicmn.h" +#include "wx/private/overlay.h" + +wxDFB_DECLARE_INTERFACE(IDirectFBSurface); + +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxDC; + +class wxOverlayImpl: public wxOverlay::Impl +{ +public: + wxOverlayImpl(); + ~wxOverlayImpl(); + + virtual void Reset() wxOVERRIDE; + virtual bool IsOk() wxOVERRIDE; + virtual void Init(wxDC* dc, int x, int y, int width, int height) wxOVERRIDE; + virtual void BeginDrawing(wxDC* dc) wxOVERRIDE; + virtual void EndDrawing(wxDC* dc) wxOVERRIDE; + virtual void Clear(wxDC* dc) wxOVERRIDE; + + // wxDFB specific methods: + bool IsEmpty() const { return m_isEmpty; } + wxRect GetRect() const { return m_rect; } + wxIDirectFBSurfacePtr GetDirectFBSurface() const { return m_surface; } + +public: + // window the overlay is associated with + wxWindow *m_window; + // rectangle covered by the overlay, in m_window's window coordinates + wxRect m_rect; + // surface of the overlay, same size as m_rect + wxIDirectFBSurfacePtr m_surface; + // this flag is set to true if nothing was drawn on the overlay (either + // initially or Clear() was called) + bool m_isEmpty; +}; + +#endif // _WX_DFB_PRIVATE_OVERLAY_H_ diff --git a/lib/wxWidgets/include/wx/dfb/region.h b/lib/wxWidgets/include/wx/dfb/region.h new file mode 100644 index 0000000..e8b01c5 --- /dev/null +++ b/lib/wxWidgets/include/wx/dfb/region.h @@ -0,0 +1,95 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dfb/region.h +// Purpose: wxRegion class +// Author: Vaclav Slavik +// Created: 2006-08-08 +// Copyright: (c) 2006 REA Elektronik GmbH +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DFB_REGION_H_ +#define _WX_DFB_REGION_H_ + +class WXDLLIMPEXP_CORE wxRegion : public wxRegionBase +{ +public: + wxRegion(); + wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h); + wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight); + wxRegion(const wxRect& rect); + wxRegion(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE); + wxRegion(const wxBitmap& bmp) + { + Union(bmp); + } + wxRegion(const wxBitmap& bmp, + const wxColour& transColour, int tolerance = 0) + { + Union(bmp, transColour, tolerance); + } + + virtual ~wxRegion(); + + // wxRegionBase methods + virtual void Clear(); + virtual bool IsEmpty() const; + + // NB: implementation detail of DirectFB, should be removed if full + // (i.e. not rect-only version is implemented) so that all code that + // assumes region==rect breaks + wxRect AsRect() const { return GetBox(); } + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + + // wxRegionBase pure virtuals + virtual bool DoIsEqual(const wxRegion& region) const; + virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const; + virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const; + virtual wxRegionContain DoContainsRect(const wxRect& rect) const; + + virtual bool DoOffset(wxCoord x, wxCoord y); + virtual bool DoUnionWithRect(const wxRect& rect); + virtual bool DoUnionWithRegion(const wxRegion& region); + virtual bool DoIntersect(const wxRegion& region); + virtual bool DoSubtract(const wxRegion& region); + virtual bool DoXor(const wxRegion& region); + + + friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator; + + wxDECLARE_DYNAMIC_CLASS(wxRegion); +}; + + +class WXDLLIMPEXP_CORE wxRegionIterator : public wxObject +{ +public: + wxRegionIterator() {} + wxRegionIterator(const wxRegion& region) { Reset(region); } + + void Reset() { m_rect = wxRect(); } + void Reset(const wxRegion& region); + + bool HaveRects() const { return !m_rect.IsEmpty(); } + operator bool() const { return HaveRects(); } + + wxRegionIterator& operator++(); + wxRegionIterator operator++(int); + + wxCoord GetX() const { return m_rect.GetX(); } + wxCoord GetY() const { return m_rect.GetY(); } + wxCoord GetW() const { return m_rect.GetWidth(); } + wxCoord GetWidth() const { return GetW(); } + wxCoord GetH() const { return m_rect.GetHeight(); } + wxCoord GetHeight() const { return GetH(); } + wxRect GetRect() const { return m_rect; } + +private: + wxRect m_rect; + + wxDECLARE_DYNAMIC_CLASS(wxRegionIterator); +}; + +#endif // _WX_DFB_REGION_H_ diff --git a/lib/wxWidgets/include/wx/dfb/toplevel.h b/lib/wxWidgets/include/wx/dfb/toplevel.h new file mode 100644 index 0000000..c662de7 --- /dev/null +++ b/lib/wxWidgets/include/wx/dfb/toplevel.h @@ -0,0 +1,78 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dfb/toplevel.h +// Purpose: Top level window, abstraction of wxFrame and wxDialog +// Author: Vaclav Slavik +// Created: 2006-08-10 +// Copyright: (c) 2006 REA Elektronik GmbH +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DFB_TOPLEVEL_H_ +#define _WX_DFB_TOPLEVEL_H_ + +//----------------------------------------------------------------------------- +// wxTopLevelWindowDFB +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTopLevelWindowDFB : public wxTopLevelWindowBase +{ +public: + // construction + wxTopLevelWindowDFB() { Init(); } + wxTopLevelWindowDFB(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Init(); + + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + // implement base class pure virtuals + virtual void Maximize(bool maximize = true); + virtual bool IsMaximized() const; + virtual void Iconize(bool iconize = true); + virtual bool IsIconized() const; + virtual void Restore(); + + virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); + virtual bool IsFullScreen() const { return m_fsIsShowing; } + + virtual bool CanSetTransparent() { return true; } + virtual bool SetTransparent(wxByte alpha); + + virtual void SetTitle(const wxString &title) { m_title = title; } + virtual wxString GetTitle() const { return m_title; } + +protected: + // common part of all ctors + void Init(); + + virtual void HandleFocusEvent(const wxDFBWindowEvent& event_); + +protected: + wxString m_title; + + bool m_fsIsShowing:1; /* full screen */ + long m_fsSaveStyle; + long m_fsSaveFlag; + wxRect m_fsSaveFrame; + + // is the frame currently maximized? + bool m_isMaximized:1; + wxRect m_savedFrame; +}; + +#endif // _WX_DFB_TOPLEVEL_H_ diff --git a/lib/wxWidgets/include/wx/dfb/window.h b/lib/wxWidgets/include/wx/dfb/window.h new file mode 100644 index 0000000..ccd7df1 --- /dev/null +++ b/lib/wxWidgets/include/wx/dfb/window.h @@ -0,0 +1,193 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dfb/window.h +// Purpose: wxWindow class +// Author: Vaclav Slavik +// Created: 2006-08-10 +// Copyright: (c) 2006 REA Elektronik GmbH +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DFB_WINDOW_H_ +#define _WX_DFB_WINDOW_H_ + +// --------------------------------------------------------------------------- +// headers +// --------------------------------------------------------------------------- + +#include "wx/dfb/dfbptr.h" + +wxDFB_DECLARE_INTERFACE(IDirectFBSurface); +struct wxDFBWindowEvent; + +class WXDLLIMPEXP_FWD_CORE wxFont; +class WXDLLIMPEXP_FWD_CORE wxNonOwnedWindow; + +class wxOverlayImpl; +class wxDfbOverlaysList; + +// --------------------------------------------------------------------------- +// wxWindow +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWindowDFB : public wxWindowBase +{ +public: + wxWindowDFB() { Init(); } + + wxWindowDFB(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)) + { + Init(); + Create(parent, id, pos, size, style, name); + } + + virtual ~wxWindowDFB(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)); + + // implement base class (pure) virtual methods + // ------------------------------------------- + + virtual void SetLabel( const wxString &WXUNUSED(label) ) {} + virtual wxString GetLabel() const { return wxEmptyString; } + + virtual void Raise(); + virtual void Lower(); + + virtual bool Show(bool show = true); + + virtual void SetFocus(); + + virtual bool Reparent(wxWindowBase *newParent); + + virtual void WarpPointer(int x, int y); + + virtual void Refresh(bool eraseBackground = true, + const wxRect *rect = (const wxRect *) NULL); + virtual void Update(); + + virtual bool SetCursor(const wxCursor &cursor); + virtual bool SetFont(const wxFont &font) { m_font = font; return true; } + + virtual int GetCharHeight() const; + virtual int GetCharWidth() const; + +#if wxUSE_DRAG_AND_DROP + virtual void SetDropTarget(wxDropTarget *dropTarget); + + // Accept files for dragging + virtual void DragAcceptFiles(bool accept); +#endif // wxUSE_DRAG_AND_DROP + + virtual WXWidget GetHandle() const { return this; } + + // implementation from now on + // -------------------------- + + // Returns DirectFB surface used for rendering of this window + wxIDirectFBSurfacePtr GetDfbSurface(); + + // returns toplevel window the window belongs to + wxNonOwnedWindow *GetTLW() const { return m_tlw; } + + virtual bool IsDoubleBuffered() const { return true; } + +protected: + // implement the base class pure virtuals + virtual void DoGetTextExtent(const wxString& string, + int *x, int *y, + int *descent = NULL, + int *externalLeading = NULL, + const wxFont *theFont = NULL) const; + virtual void DoClientToScreen(int *x, int *y) const; + virtual void DoScreenToClient(int *x, int *y) const; + virtual void DoGetPosition(int *x, int *y) const; + virtual void DoGetSize(int *width, int *height) const; + virtual void DoGetClientSize(int *width, int *height) const; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + virtual void DoSetClientSize(int width, int height); + + virtual void DoCaptureMouse(); + virtual void DoReleaseMouse(); + + virtual void DoThaw(); + + // move the window to the specified location and resize it: this is called + // from both DoSetSize() and DoSetClientSize() and would usually just call + // ::MoveWindow() except for composite controls which will want to arrange + // themselves inside the given rectangle + virtual void DoMoveWindow(int x, int y, int width, int height); + + // return DFB surface used to render this window (will be assigned to + // m_surface if the window is visible) + virtual wxIDirectFBSurfacePtr ObtainDfbSurface() const; + + // this method must be called when window's position, size or visibility + // changes; it resets m_surface so that ObtainDfbSurface has to be called + // next time GetDfbSurface is called + void InvalidateDfbSurface(); + + // called by parent to render (part of) the window + void PaintWindow(const wxRect& rect); + + // paint window's overlays (if any) on top of window's surface + void PaintOverlays(const wxRect& rect); + + // refreshes the entire window (including non-client areas) + void DoRefreshWindow(); + // refreshes given rectangle of the window (in window, _not_ client coords) + virtual void DoRefreshRect(const wxRect& rect); + // refreshes given rectangle; unlike RefreshRect(), the argument is in + // window, not client, coords and unlike DoRefreshRect() and like Refresh(), + // does nothing if the window is hidden or frozen + void RefreshWindowRect(const wxRect& rect); + + // add/remove overlay for this window + void AddOverlay(wxOverlayImpl *overlay); + void RemoveOverlay(wxOverlayImpl *overlay); + + // DirectFB events handling + void HandleKeyEvent(const wxDFBWindowEvent& event_); + +private: + // common part of all ctors + void Init(); + // counterpart to SetFocus + void DFBKillFocus(); + +protected: + // toplevel window (i.e. DirectFB window) this window belongs to + wxNonOwnedWindow *m_tlw; + +private: + // subsurface of TLW's surface covered by this window + wxIDirectFBSurfacePtr m_surface; + + // position of the window (relative to the parent, not used by wxTLW, so + // don't access it directly) + wxRect m_rect; + + // overlays for this window (or NULL if it doesn't have any) + wxDfbOverlaysList *m_overlays; + + friend class wxNonOwnedWindow; // for HandleXXXEvent + friend class wxOverlayImpl; // for Add/RemoveOverlay + friend class wxWindowDCImpl; // for PaintOverlays + + wxDECLARE_DYNAMIC_CLASS(wxWindowDFB); + wxDECLARE_NO_COPY_CLASS(wxWindowDFB); + wxDECLARE_EVENT_TABLE(); +}; + +#endif // _WX_DFB_WINDOW_H_ diff --git a/lib/wxWidgets/include/wx/dfb/wrapdfb.h b/lib/wxWidgets/include/wx/dfb/wrapdfb.h new file mode 100644 index 0000000..14d8b02 --- /dev/null +++ b/lib/wxWidgets/include/wx/dfb/wrapdfb.h @@ -0,0 +1,536 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dfb/wrapdfb.h +// Purpose: wx wrappers for DirectFB interfaces +// Author: Vaclav Slavik +// Created: 2006-08-23 +// Copyright: (c) 2006 REA Elektronik GmbH +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DFB_WRAPDFB_H_ +#define _WX_DFB_WRAPDFB_H_ + +#include "wx/dfb/dfbptr.h" +#include "wx/gdicmn.h" +#include "wx/vidmode.h" + +#include +#include + +// DFB < 1.0 didn't have u8 type, only __u8 +#if DIRECTFB_MAJOR_VERSION == 0 +typedef __u8 u8; +#endif + + +wxDFB_DECLARE_INTERFACE(IDirectFB); +wxDFB_DECLARE_INTERFACE(IDirectFBDisplayLayer); +wxDFB_DECLARE_INTERFACE(IDirectFBFont); +wxDFB_DECLARE_INTERFACE(IDirectFBWindow); +wxDFB_DECLARE_INTERFACE(IDirectFBSurface); +wxDFB_DECLARE_INTERFACE(IDirectFBPalette); +wxDFB_DECLARE_INTERFACE(IDirectFBEventBuffer); + + +/** + Checks the @a code of a DirectFB call and returns true if it was + successful and false if it failed, logging the errors as appropriate + (asserts for programming errors, wxLogError for runtime failures). + */ +bool wxDfbCheckReturn(DFBResult code); + +//----------------------------------------------------------------------------- +// wxDfbEvent +//----------------------------------------------------------------------------- + +/** + The struct defined by this macro is a thin wrapper around DFB*Event type. + It is needed because DFB*Event are typedefs and so we can't forward declare + them, but we need to pass them to methods declared in public headers where + cannot be included. So this struct just holds the event value, + it's sole purpose is that it can be forward declared. + */ +#define WXDFB_DEFINE_EVENT_WRAPPER(T) \ + struct wx##T \ + { \ + wx##T() {} \ + wx##T(const T& event) : m_event(event) {} \ + \ + operator T&() { return m_event; } \ + operator const T&() const { return m_event; } \ + T* operator&() { return &m_event; } \ + \ + DFBEventClass GetClass() const { return m_event.clazz; } \ + \ + private: \ + T m_event; \ + }; + +WXDFB_DEFINE_EVENT_WRAPPER(DFBEvent) +WXDFB_DEFINE_EVENT_WRAPPER(DFBWindowEvent) + + +//----------------------------------------------------------------------------- +// wxDfbWrapper +//----------------------------------------------------------------------------- + +/// Base class for wxDfbWrapper +class wxDfbWrapperBase +{ +public: + /// Increases reference count of the object + void AddRef() + { + m_refCnt++; + } + + /// Decreases reference count and if it reaches zero, deletes the object + void Release() + { + if ( --m_refCnt == 0 ) + delete this; + } + + /// Returns result code of the last call + DFBResult GetLastResult() const { return m_lastResult; } + +protected: + wxDfbWrapperBase() : m_refCnt(1), m_lastResult(DFB_OK) {} + + /// Dtor may only be called from Release() + virtual ~wxDfbWrapperBase() {} + + /** + Checks the @a result of a DirectFB call and returns true if it was + successful and false if it failed. Also stores result of the call + so that it can be obtained by calling GetLastResult(). + */ + bool Check(DFBResult result) + { + m_lastResult = result; + return wxDfbCheckReturn(result); + } + +protected: + /// Reference count + unsigned m_refCnt; + + /// Result of the last DirectFB call + DFBResult m_lastResult; +}; + +/** + This template is base class for friendly C++ wrapper around DirectFB + interface T. + + The wrapper provides same API as DirectFB, with a few exceptions: + - methods return true/false instead of error code + - methods that return or create another interface return pointer to the + interface (or NULL on failure) instead of storing it in the last + argument + - interface arguments use wxFooPtr type instead of raw DirectFB pointer + - methods taking flags use int type instead of an enum when the flags + can be or-combination of enum elements (this is workaround for + C++-unfriendly DirectFB API) + */ +template +class wxDfbWrapper : public wxDfbWrapperBase +{ +public: + /// "Raw" DirectFB interface type + typedef T DirectFBIface; + + /// Returns raw DirectFB pointer + T *GetRaw() const { return m_ptr; } + +protected: + /// To be called from ctor. Takes ownership of raw object. + void Init(T *ptr) { m_ptr = ptr; } + + /// Dtor may only be used from Release + ~wxDfbWrapper() + { + if ( m_ptr ) + m_ptr->Release(m_ptr); + } + +protected: + // pointer to DirectFB object + T *m_ptr; +}; + + +//----------------------------------------------------------------------------- +// wxIDirectFBFont +//----------------------------------------------------------------------------- + +struct wxIDirectFBFont : public wxDfbWrapper +{ + wxIDirectFBFont(IDirectFBFont *s) { Init(s); } + + bool GetStringWidth(const char *text, int bytes, int *w) + { return Check(m_ptr->GetStringWidth(m_ptr, text, bytes, w)); } + + bool GetStringExtents(const char *text, int bytes, + DFBRectangle *logicalRect, DFBRectangle *inkRect) + { + return Check(m_ptr->GetStringExtents(m_ptr, text, bytes, + logicalRect, inkRect)); + } + + bool GetHeight(int *h) + { return Check(m_ptr->GetHeight(m_ptr, h)); } + + bool GetDescender(int *descender) + { return Check(m_ptr->GetDescender(m_ptr, descender)); } +}; + + +//----------------------------------------------------------------------------- +// wxIDirectFBPalette +//----------------------------------------------------------------------------- + +struct wxIDirectFBPalette : public wxDfbWrapper +{ + wxIDirectFBPalette(IDirectFBPalette *s) { Init(s); } +}; + + +//----------------------------------------------------------------------------- +// wxIDirectFBSurface +//----------------------------------------------------------------------------- + +struct wxIDirectFBSurface : public wxDfbWrapper +{ + wxIDirectFBSurface(IDirectFBSurface *s) { Init(s); } + + bool GetSize(int *w, int *h) + { return Check(m_ptr->GetSize(m_ptr, w, h)); } + + bool GetCapabilities(DFBSurfaceCapabilities *caps) + { return Check(m_ptr->GetCapabilities(m_ptr, caps)); } + + bool GetPixelFormat(DFBSurfacePixelFormat *caps) + { return Check(m_ptr->GetPixelFormat(m_ptr, caps)); } + + // convenience version of GetPixelFormat, returns DSPF_UNKNOWN if fails + DFBSurfacePixelFormat GetPixelFormat(); + + bool SetClip(const DFBRegion *clip) + { return Check(m_ptr->SetClip(m_ptr, clip)); } + + bool SetColor(u8 r, u8 g, u8 b, u8 a) + { return Check(m_ptr->SetColor(m_ptr, r, g, b, a)); } + + bool Clear(u8 r, u8 g, u8 b, u8 a) + { return Check(m_ptr->Clear(m_ptr, r, g, b, a)); } + + bool DrawLine(int x1, int y1, int x2, int y2) + { return Check(m_ptr->DrawLine(m_ptr, x1, y1, x2, y2)); } + + bool DrawRectangle(int x, int y, int w, int h) + { return Check(m_ptr->DrawRectangle(m_ptr, x, y, w, h)); } + + bool FillRectangle(int x, int y, int w, int h) + { return Check(m_ptr->FillRectangle(m_ptr, x, y, w, h)); } + + bool SetFont(const wxIDirectFBFontPtr& font) + { return Check(m_ptr->SetFont(m_ptr, font->GetRaw())); } + + bool DrawString(const char *text, int bytes, int x, int y, int flags) + { + return Check(m_ptr->DrawString(m_ptr, text, bytes, x, y, + (DFBSurfaceTextFlags)flags)); + } + + /** + Updates the front buffer from the back buffer. If @a region is not + NULL, only given rectangle is updated. + */ + bool FlipToFront(const DFBRegion *region = NULL); + + wxIDirectFBSurfacePtr GetSubSurface(const DFBRectangle *rect) + { + IDirectFBSurface *s; + if ( Check(m_ptr->GetSubSurface(m_ptr, rect, &s)) ) + return new wxIDirectFBSurface(s); + else + return NULL; + } + + wxIDirectFBPalettePtr GetPalette() + { + IDirectFBPalette *s; + if ( Check(m_ptr->GetPalette(m_ptr, &s)) ) + return new wxIDirectFBPalette(s); + else + return NULL; + } + + bool SetPalette(const wxIDirectFBPalettePtr& pal) + { return Check(m_ptr->SetPalette(m_ptr, pal->GetRaw())); } + + bool SetBlittingFlags(int flags) + { + return Check( + m_ptr->SetBlittingFlags(m_ptr, (DFBSurfaceBlittingFlags)flags)); + } + + bool Blit(const wxIDirectFBSurfacePtr& source, + const DFBRectangle *source_rect, + int x, int y) + { return Blit(source->GetRaw(), source_rect, x, y); } + + bool Blit(IDirectFBSurface *source, + const DFBRectangle *source_rect, + int x, int y) + { return Check(m_ptr->Blit(m_ptr, source, source_rect, x, y)); } + + bool StretchBlit(const wxIDirectFBSurfacePtr& source, + const DFBRectangle *source_rect, + const DFBRectangle *dest_rect) + { + return Check(m_ptr->StretchBlit(m_ptr, source->GetRaw(), + source_rect, dest_rect)); + } + + /// Returns bit depth used by the surface or -1 on error + int GetDepth(); + + /** + Creates a new surface by cloning this one. New surface will have same + capabilities, pixel format and pixel data as the existing one. + + @see CreateCompatible + */ + wxIDirectFBSurfacePtr Clone(); + + /// Flags for CreateCompatible() + enum CreateCompatibleFlags + { + /// Don't create double-buffered surface + CreateCompatible_NoBackBuffer = 1 + }; + + /** + Creates a surface compatible with this one, i.e. surface with the same + capabilities and pixel format, but with different and size. + + @param size Size of the surface to create. If wxDefaultSize, use the + size of this surface. + @param flags Or-combination of CreateCompatibleFlags values + */ + wxIDirectFBSurfacePtr CreateCompatible(const wxSize& size = wxDefaultSize, + int flags = 0); + + bool Lock(DFBSurfaceLockFlags flags, void **ret_ptr, int *ret_pitch) + { return Check(m_ptr->Lock(m_ptr, flags, ret_ptr, ret_pitch)); } + + bool Unlock() + { return Check(m_ptr->Unlock(m_ptr)); } + + /// Helper struct for safe locking & unlocking of surfaces + struct Locked + { + Locked(const wxIDirectFBSurfacePtr& surface, DFBSurfaceLockFlags flags) + : m_surface(surface) + { + if ( !surface->Lock(flags, &ptr, &pitch) ) + ptr = NULL; + } + + ~Locked() + { + if ( ptr ) + m_surface->Unlock(); + } + + void *ptr; + int pitch; + + private: + wxIDirectFBSurfacePtr m_surface; + }; + + +private: + // this is private because we want user code to use FlipToFront() + bool Flip(const DFBRegion *region, int flags); +}; + + +//----------------------------------------------------------------------------- +// wxIDirectFBEventBuffer +//----------------------------------------------------------------------------- + +struct wxIDirectFBEventBuffer : public wxDfbWrapper +{ + wxIDirectFBEventBuffer(IDirectFBEventBuffer *s) { Init(s); } + + bool CreateFileDescriptor(int *ret_fd) + { + return Check(m_ptr->CreateFileDescriptor(m_ptr, ret_fd)); + } +}; + + +//----------------------------------------------------------------------------- +// wxIDirectFBWindow +//----------------------------------------------------------------------------- + +struct wxIDirectFBWindow : public wxDfbWrapper +{ + wxIDirectFBWindow(IDirectFBWindow *s) { Init(s); } + + bool GetID(DFBWindowID *id) + { return Check(m_ptr->GetID(m_ptr, id)); } + + bool GetPosition(int *x, int *y) + { return Check(m_ptr->GetPosition(m_ptr, x, y)); } + + bool GetSize(int *w, int *h) + { return Check(m_ptr->GetSize(m_ptr, w, h)); } + + bool MoveTo(int x, int y) + { return Check(m_ptr->MoveTo(m_ptr, x, y)); } + + bool Resize(int w, int h) + { return Check(m_ptr->Resize(m_ptr, w, h)); } + + bool SetOpacity(u8 opacity) + { return Check(m_ptr->SetOpacity(m_ptr, opacity)); } + + bool SetStackingClass(DFBWindowStackingClass klass) + { return Check(m_ptr->SetStackingClass(m_ptr, klass)); } + + bool RaiseToTop() + { return Check(m_ptr->RaiseToTop(m_ptr)); } + + bool LowerToBottom() + { return Check(m_ptr->LowerToBottom(m_ptr)); } + + wxIDirectFBSurfacePtr GetSurface() + { + IDirectFBSurface *s; + if ( Check(m_ptr->GetSurface(m_ptr, &s)) ) + return new wxIDirectFBSurface(s); + else + return NULL; + } + + bool AttachEventBuffer(const wxIDirectFBEventBufferPtr& buffer) + { return Check(m_ptr->AttachEventBuffer(m_ptr, buffer->GetRaw())); } + + bool RequestFocus() + { return Check(m_ptr->RequestFocus(m_ptr)); } + + bool Destroy() + { return Check(m_ptr->Destroy(m_ptr)); } +}; + + +//----------------------------------------------------------------------------- +// wxIDirectFBDisplayLayer +//----------------------------------------------------------------------------- + +struct wxIDirectFBDisplayLayer : public wxDfbWrapper +{ + wxIDirectFBDisplayLayer(IDirectFBDisplayLayer *s) { Init(s); } + + wxIDirectFBWindowPtr CreateWindow(const DFBWindowDescription *desc) + { + IDirectFBWindow *w; + if ( Check(m_ptr->CreateWindow(m_ptr, desc, &w)) ) + return new wxIDirectFBWindow(w); + else + return NULL; + } + + bool GetConfiguration(DFBDisplayLayerConfig *config) + { return Check(m_ptr->GetConfiguration(m_ptr, config)); } + + wxVideoMode GetVideoMode(); + + bool GetCursorPosition(int *x, int *y) + { return Check(m_ptr->GetCursorPosition(m_ptr, x, y)); } + + bool WarpCursor(int x, int y) + { return Check(m_ptr->WarpCursor(m_ptr, x, y)); } +}; + + +//----------------------------------------------------------------------------- +// wxIDirectFB +//----------------------------------------------------------------------------- + +struct wxIDirectFB : public wxDfbWrapper +{ + /** + Returns pointer to DirectFB singleton object, it never returns NULL + after wxApp was initialized. The object is cached, so calling this + method is cheap. + */ + static wxIDirectFBPtr Get() + { + if ( !ms_ptr ) CreateDirectFB(); + return ms_ptr; + } + + bool SetVideoMode(int w, int h, int bpp) + { return Check(m_ptr->SetVideoMode(m_ptr, w, h, bpp)); } + + wxIDirectFBSurfacePtr CreateSurface(const DFBSurfaceDescription *desc) + { + IDirectFBSurface *s; + if ( Check(m_ptr->CreateSurface(m_ptr, desc, &s)) ) + return new wxIDirectFBSurface(s); + else + return NULL; + } + + wxIDirectFBEventBufferPtr CreateEventBuffer() + { + IDirectFBEventBuffer *b; + if ( Check(m_ptr->CreateEventBuffer(m_ptr, &b)) ) + return new wxIDirectFBEventBuffer(b); + else + return NULL; + } + + wxIDirectFBFontPtr CreateFont(const char *filename, + const DFBFontDescription *desc) + { + IDirectFBFont *f; + if ( Check(m_ptr->CreateFont(m_ptr, filename, desc, &f)) ) + return new wxIDirectFBFont(f); + else + return NULL; + } + + wxIDirectFBDisplayLayerPtr + GetDisplayLayer(DFBDisplayLayerID id = DLID_PRIMARY) + { + IDirectFBDisplayLayer *l; + if ( Check(m_ptr->GetDisplayLayer(m_ptr, id, &l)) ) + return new wxIDirectFBDisplayLayer(l); + else + return NULL; + } + + /// Returns primary surface + wxIDirectFBSurfacePtr GetPrimarySurface(); + +private: + wxIDirectFB(IDirectFB *ptr) { Init(ptr); } + + // creates ms_ptr instance + static void CreateDirectFB(); + + static void CleanUp(); + friend class wxApp; // calls CleanUp + + // pointer to the singleton IDirectFB object + static wxIDirectFBPtr ms_ptr; +}; + +#endif // _WX_DFB_WRAPDFB_H_ diff --git a/lib/wxWidgets/include/wx/dialog.h b/lib/wxWidgets/include/wx/dialog.h new file mode 100644 index 0000000..e56174c --- /dev/null +++ b/lib/wxWidgets/include/wx/dialog.h @@ -0,0 +1,452 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dialog.h +// Purpose: wxDialogBase class +// Author: Vadim Zeitlin +// Modified by: +// Created: 29.06.99 +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DIALOG_H_BASE_ +#define _WX_DIALOG_H_BASE_ + +#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; + +// Also see the bit summary table in wx/toplevel.h. + +#define wxDIALOG_NO_PARENT 0x00000020 // Don't make owned by apps top window + +#define wxDEFAULT_DIALOG_STYLE (wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX) + +// Layout adaptation levels, for SetLayoutAdaptationLevel + +// 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 +{ +public: + 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 ); + + template + void ShowWindowModalThenDo(const Functor& onEndModal); + + // Modal dialogs have a return code - usually the id of the last + // pressed button + void SetReturnCode(int returnCode) { m_returnCode = returnCode; } + int GetReturnCode() const { return m_returnCode; } + + // Set the identifier for the affirmative button: this button will close + // the dialog after validating data and calling TransferDataFromWindow() + void SetAffirmativeId(int affirmativeId); + int GetAffirmativeId() const { return m_affirmativeId; } + + // Set identifier for Esc key translation: the button with this id will + // close the dialog without doing anything else; special value wxID_NONE + // means to not handle Esc at all while wxID_ANY means to map Esc to + // wxID_CANCEL if present and GetAffirmativeId() otherwise + 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 + { + return DoGetParentForDialog(wxDIALOG_MODALITY_APP_MODAL, parent, style); + } + + // 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()); + } + + // This function is similar to GetParentForModalDialog() but should be used + // for modeless dialogs and skips the checks irrelevant for them (currently + // just the one checking that the candidate parent window is visible, as it + // is possible to create a modeless dialog before its parent is shown if it + // is only shown later, after showing the parent). + wxWindow *GetParentForModelessDialog(wxWindow *parent, long style) const + { + return DoGetParentForDialog(wxDIALOG_MODALITY_NONE, parent, style); + } + +#if wxUSE_STATTEXT // && wxUSE_TEXTCTRL + // splits text up at newlines and places the lines into a vertical + // wxBoxSizer, with the given maximum width, lines will not be wrapped + // for negative values of widthMax + wxSizer *CreateTextSizer(const wxString& message, int widthMax = -1); + + // same as above but uses a customized wxTextSizerWrapper to create + // non-standard controls for the lines + wxSizer *CreateTextSizer(const wxString& message, + wxTextSizerWrapper& wrapper, + int widthMax = -1); +#endif // wxUSE_STATTEXT // && wxUSE_TEXTCTRL + + // returns a horizontal wxBoxSizer containing the given buttons + // + // notice that the returned sizer can be NULL if no buttons are put in the + // sizer (this mostly happens under smart phones and other atypical + // 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 + // + // return true if button was "clicked" or false if we don't have it + bool EmulateButtonClickIfPresent(int id); + + // this function is used by OnCharHook() to decide whether the given key + // should close the dialog + // + // for most platforms the default implementation (which just checks for + // Esc) is sufficient, but Mac port also adds Cmd-. here and other ports + // could do something different if needed + virtual bool IsEscapeKey(const wxKeyEvent& event); + + // end either modal or modeless dialog, for the modal dialog rc is used as + // the dialog return code + void EndDialog(int rc); + + // call Validate() and TransferDataFromWindow() and close dialog with + // wxID_OK return code + void AcceptAndClose(); + + // The return code from modal dialog + int m_returnCode; + + // The identifier for the affirmative button (usually wxID_OK) + int m_affirmativeId; + + // 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 implementation of GetParentFor{Modal,Modeless}Dialog(). + wxWindow *DoGetParentForDialog(wxDialogModality modality, + wxWindow *parent, + long style) const; + + // helper of DoGetParentForDialog(): returns the passed in window if it + // can be used as parent for this kind of dialog or NULL if it can't + wxWindow *CheckIfCanBeUsedAsParent(wxDialogModality modality, + 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); + + // handle closing the dialog window + void OnCloseWindow(wxCloseEvent& event); + + // handle the standard buttons + void OnButton(wxCommandEvent& event); + + // update the background colour + void OnSysColourChanged(wxSysColourChangedEvent& event); + + + wxDECLARE_NO_COPY_CLASS(wxDialogBase); + wxDECLARE_EVENT_TABLE(); +}; + +/*! + * 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 +{ + wxDECLARE_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 +{ + wxDECLARE_CLASS(wxStandardDialogLayoutAdapter); +public: + wxStandardDialogLayoutAdapter() {} + +// Overrides + + // Indicate that adaptation should be done + virtual bool CanDoLayoutAdaptation(wxDialog* dialog) wxOVERRIDE; + + // Do layout adaptation + virtual bool DoLayoutAdaptation(wxDialog* dialog) wxOVERRIDE; + +// 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__) + #include "wx/univ/dialog.h" +#else + #if defined(__WXMSW__) + #include "wx/msw/dialog.h" + #elif defined(__WXMOTIF__) + #include "wx/motif/dialog.h" + #elif defined(__WXGTK20__) + #include "wx/gtk/dialog.h" + #elif defined(__WXGTK__) + #include "wx/gtk1/dialog.h" + #elif defined(__WXMAC__) + #include "wx/osx/dialog.h" + #elif defined(__WXQT__) + #include "wx/qt/dialog.h" + #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 wxOVERRIDE { return new wxWindowModalDialogEvent (*this); } + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(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)) + +template +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(m_f); + m_f.reset(); + + (*functor)(event.GetReturnCode()); + } + else // was already called once + { + event.Skip(); + } + } + +private: + wxSharedPtr m_f; +}; + +template +void wxDialogBase::ShowWindowModalThenDo(const Functor& onEndModal) +{ + Bind(wxEVT_WINDOW_MODAL_DIALOG_CLOSED, + wxWindowModalDialogEventFunctor(onEndModal)); + ShowWindowModal(); +} + +#endif + // _WX_DIALOG_H_BASE_ diff --git a/lib/wxWidgets/include/wx/dialup.h b/lib/wxWidgets/include/wx/dialup.h new file mode 100644 index 0000000..448f7ed --- /dev/null +++ b/lib/wxWidgets/include/wx/dialup.h @@ -0,0 +1,200 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dialup.h +// Purpose: Network related wxWidgets classes and functions +// Author: Vadim Zeitlin +// Modified by: +// Created: 07.07.99 +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DIALUP_H +#define _WX_DIALUP_H + +#if wxUSE_DIALUP_MANAGER + +#include "wx/event.h" + +// ---------------------------------------------------------------------------- +// misc +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_BASE wxArrayString; + +#define WXDIALUP_MANAGER_DEFAULT_BEACONHOST wxT("www.yahoo.com") + +// ---------------------------------------------------------------------------- +// A class which groups functions dealing with connecting to the network from a +// workstation using dial-up access to the net. There is at most one instance +// of this class in the program accessed via GetDialUpManager(). +// ---------------------------------------------------------------------------- + +/* TODO + * + * 1. more configurability for Unix: i.e. how to initiate the connection, how + * to check for online status, &c. + * 2. a function to enumerate all connections (ISPs) and show a dialog in + * Dial() allowing to choose between them if no ISP given + * 3. add an async version of dialing functions which notify the caller about + * the progress (or may be even start another thread to monitor it) + * 4. the static creation/accessor functions are not MT-safe - but is this + * really crucial? I think we may suppose they're always called from the + * main thread? + */ + +class WXDLLIMPEXP_CORE wxDialUpManager +{ +public: + // this function should create and return the object of the + // platform-specific class derived from wxDialUpManager. It's implemented + // in the platform-specific source files. + static wxDialUpManager *Create(); + + // could the dialup manager be initialized correctly? If this function + // returns false, no other functions will work either, so it's a good idea + // to call this function and check its result before calling any other + // wxDialUpManager methods + virtual bool IsOk() const = 0; + + // virtual dtor for any base class + virtual ~wxDialUpManager() { } + + // operations + // ---------- + + // fills the array with the names of all possible values for the first + // parameter to Dial() on this machine and returns their number (may be 0) + virtual size_t GetISPNames(wxArrayString& names) const = 0; + + // dial the given ISP, use username and password to authenticate + // + // if no nameOfISP is given, the function will select the default one + // + // if no username/password are given, the function will try to do without + // them, but will ask the user if really needed + // + // if async parameter is false, the function waits until the end of dialing + // and returns true upon successful completion. + // if async is true, the function only initiates the connection and returns + // immediately - the result is reported via events (an event is sent + // anyhow, but if dialing failed it will be a DISCONNECTED one) + virtual bool Dial(const wxString& nameOfISP = wxEmptyString, + const wxString& username = wxEmptyString, + const wxString& password = wxEmptyString, + bool async = true) = 0; + + // returns true if (async) dialing is in progress + virtual bool IsDialing() const = 0; + + // cancel dialing the number initiated with Dial(async = true) + // NB: this won't result in DISCONNECTED event being sent + virtual bool CancelDialing() = 0; + + // hang up the currently active dial up connection + virtual bool HangUp() = 0; + + // online status + // ------------- + + // returns true if the computer has a permanent network connection (i.e. is + // on a LAN) and so there is no need to use Dial() function to go online + // + // NB: this functions tries to guess the result and it is not always + // guaranteed to be correct, so it's better to ask user for + // confirmation or give him a possibility to override it + virtual bool IsAlwaysOnline() const = 0; + + // returns true if the computer is connected to the network: under Windows, + // this just means that a RAS connection exists, under Unix we check that + // the "well-known host" (as specified by SetWellKnownHost) is reachable + virtual bool IsOnline() const = 0; + + // sometimes the built-in logic for determining the online status may fail, + // so, in general, the user should be allowed to override it. This function + // allows to forcefully set the online status - whatever our internal + // algorithm may think about it. + virtual void SetOnlineStatus(bool isOnline = true) = 0; + + // set misc wxDialUpManager options + // -------------------------------- + + // enable automatic checks for the connection status and sending of + // wxEVT_DIALUP_CONNECTED/wxEVT_DIALUP_DISCONNECTED events. The interval + // parameter is only for Unix where we do the check manually: under + // Windows, the notification about the change of connection status is + // instantaneous. + // + // Returns false if couldn't set up automatic check for online status. + virtual bool EnableAutoCheckOnlineStatus(size_t nSeconds = 60) = 0; + + // disable automatic check for connection status change - notice that the + // wxEVT_DIALUP_XXX events won't be sent any more either. + virtual void DisableAutoCheckOnlineStatus() = 0; + + // additional Unix-only configuration + // ---------------------------------- + + // under Unix, the value of well-known host is used to check whether we're + // connected to the internet. It's unused under Windows, but this function + // is always safe to call. The default value is www.yahoo.com. + virtual void SetWellKnownHost(const wxString& hostname, + int portno = 80) = 0; + + // Sets the commands to start up the network and to hang up again. Used by + // the Unix implementations only. + virtual void + SetConnectCommand(const wxString& commandDial = wxT("/usr/bin/pon"), + const wxString& commandHangup = wxT("/usr/bin/poff")) = 0; +}; + +// ---------------------------------------------------------------------------- +// wxDialUpManager events +// ---------------------------------------------------------------------------- + +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 WXDLLIMPEXP_CORE wxDialUpEvent : public wxEvent +{ +public: + wxDialUpEvent(bool isConnected, bool isOwnEvent) : wxEvent(isOwnEvent) + { + SetEventType(isConnected ? wxEVT_DIALUP_CONNECTED + : wxEVT_DIALUP_DISCONNECTED); + } + + // is this a CONNECTED or DISCONNECTED event? + bool IsConnectedEvent() const + { return GetEventType() == wxEVT_DIALUP_CONNECTED; } + + // 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; } + + // implement the base class pure virtual + virtual wxEvent *Clone() const wxOVERRIDE { return new wxDialUpEvent(*this); } + +private: + wxDECLARE_NO_ASSIGN_DEF_COPY(wxDialUpEvent); +}; + +// the type of dialup event handler function +typedef void (wxEvtHandler::*wxDialUpEventFunction)(wxDialUpEvent&); + +#define wxDialUpEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxDialUpEventFunction, func) + +// macros to catch dialup events +#define EVT_DIALUP_CONNECTED(func) \ + wx__DECLARE_EVT0(wxEVT_DIALUP_CONNECTED, wxDialUpEventHandler(func)) +#define EVT_DIALUP_DISCONNECTED(func) \ + wx__DECLARE_EVT0(wxEVT_DIALUP_DISCONNECTED, wxDialUpEventHandler(func)) + + +#endif // wxUSE_DIALUP_MANAGER + +#endif // _WX_DIALUP_H diff --git a/lib/wxWidgets/include/wx/dir.h b/lib/wxWidgets/include/wx/dir.h new file mode 100644 index 0000000..305411b --- /dev/null +++ b/lib/wxWidgets/include/wx/dir.h @@ -0,0 +1,191 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dir.h +// Purpose: wxDir is a class for enumerating the files in a directory +// Author: Vadim Zeitlin +// Modified by: +// Created: 08.12.99 +// Copyright: (c) 1999 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DIR_H_ +#define _WX_DIR_H_ + +#include "wx/longlong.h" +#include "wx/string.h" +#include "wx/filefn.h" // for wxS_DIR_DEFAULT + +class WXDLLIMPEXP_FWD_BASE wxArrayString; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// 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 +}; + +// these constants are possible return value of wxDirTraverser::OnDir() +enum wxDirTraverseResult +{ + wxDIR_IGNORE = -1, // ignore this directory but continue with others + wxDIR_STOP, // stop traversing + wxDIR_CONTINUE // continue into this directory +}; + +#if wxUSE_LONGLONG +// error code of wxDir::GetTotalSize() +extern WXDLLIMPEXP_DATA_BASE(const wxULongLong) wxInvalidSize; +#endif // wxUSE_LONGLONG + +// ---------------------------------------------------------------------------- +// wxDirTraverser: helper class for wxDir::Traverse() +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxDirTraverser +{ +public: + /// a virtual dtor has been provided since this class has virtual members + virtual ~wxDirTraverser() { } + // called for each file found by wxDir::Traverse() + // + // return wxDIR_STOP or wxDIR_CONTINUE from here (wxDIR_IGNORE doesn't + // make sense) + virtual wxDirTraverseResult OnFile(const wxString& filename) = 0; + + // called for each directory found by wxDir::Traverse() + // + // return one of the enum elements defined above + virtual wxDirTraverseResult OnDir(const wxString& dirname) = 0; + + // called for each directory which we couldn't open during our traversal + // 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 + // opening the directory and so may lead to infinite loop if it is + // returned unconditionally, be careful with this! + // + // the base class version always returns wxDIR_IGNORE + virtual wxDirTraverseResult OnOpenError(const wxString& dirname); +}; + +// ---------------------------------------------------------------------------- +// wxDir: portable equivalent of {open/read/close}dir functions +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_BASE wxDirData; + +class WXDLLIMPEXP_BASE wxDir +{ +public: + + // ctors + // ----- + + // default, use Open() + wxDir() { m_data = NULL; } + + // opens the directory for enumeration, use IsOpened() to test success + wxDir(const wxString& dir); + + // 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 + // ------------------------- + + // start enumerating all files matching filespec (or all files if it is + // empty) and flags, return true on success + bool GetFirst(wxString *filename, + const wxString& filespec = wxEmptyString, + int flags = wxDIR_DEFAULT) const; + + // get next file in the enumeration started with GetFirst() + bool GetNext(wxString *filename) const; + + // return true if this directory has any files in it + bool HasFiles(const wxString& spec = wxEmptyString) const; + + // return true if this directory has any subdirectories + bool HasSubDirs(const wxString& spec = wxEmptyString) const; + + // enumerate all files in this directory and its subdirectories + // + // return the number of files found + size_t Traverse(wxDirTraverser& sink, + const wxString& filespec = wxEmptyString, + int flags = wxDIR_DEFAULT) const; + + // simplest version of Traverse(): get the names of all files under this + // directory into filenames array, return the number of files + static size_t GetAllFiles(const wxString& dirname, + wxArrayString *files, + const wxString& filespec = wxEmptyString, + int flags = wxDIR_DEFAULT); + + // check if there any files matching the given filespec under the given + // directory (i.e. searches recursively), return the file path if found or + // empty string otherwise + static wxString FindFirst(const wxString& dirname, + 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; + + wxDECLARE_NO_COPY_CLASS(wxDir); +}; + +#endif // _WX_DIR_H_ + diff --git a/lib/wxWidgets/include/wx/dirctrl.h b/lib/wxWidgets/include/wx/dirctrl.h new file mode 100644 index 0000000..1d9d1ba --- /dev/null +++ b/lib/wxWidgets/include/wx/dirctrl.h @@ -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_ diff --git a/lib/wxWidgets/include/wx/dirdlg.h b/lib/wxWidgets/include/wx/dirdlg.h new file mode 100644 index 0000000..0136069 --- /dev/null +++ b/lib/wxWidgets/include/wx/dirdlg.h @@ -0,0 +1,148 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dirdlg.h +// Purpose: wxDirDialog base class +// Author: Robert Roebling +// Modified by: +// Created: +// Copyright: (c) Robert Roebling +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DIRDLG_H_BASE_ +#define _WX_DIRDLG_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_DIRDLG + +#include "wx/dialog.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +extern WXDLLIMPEXP_DATA_CORE(const char) wxDirDialogNameStr[]; +extern WXDLLIMPEXP_DATA_CORE(const char) wxDirDialogDefaultFolderStr[]; +extern WXDLLIMPEXP_DATA_CORE(const char) wxDirSelectorPromptStr[]; + + +/* + The flags below must coexist with the following flags in m_windowStyle + #define wxCAPTION 0x20000000 + #define wxMAXIMIZE 0x00002000 + #define wxCLOSE_BOX 0x00001000 + #define wxSYSTEM_MENU 0x00000800 + wxBORDER_NONE = 0x00200000 + #define wxRESIZE_BORDER 0x00000040 + #define wxDIALOG_NO_PARENT 0x00000020 +*/ + +#define wxDD_CHANGE_DIR 0x0100 +#define wxDD_DIR_MUST_EXIST 0x0200 +#define wxDD_MULTIPLE 0x0400 +#define wxDD_SHOW_HIDDEN 0x0001 + +// deprecated, on by default now, use wxDD_DIR_MUST_EXIST to disable it +#define wxDD_NEW_DIR_BUTTON 0 + +#define wxDD_DEFAULT_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) + +//------------------------------------------------------------------------- +// wxDirDialogBase +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDirDialogBase : public wxDialog +{ +public: + wxDirDialogBase() {} + wxDirDialogBase(wxWindow *parent, + const wxString& title = wxASCII_STR(wxDirSelectorPromptStr), + const wxString& defaultPath = wxEmptyString, + long style = wxDD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + const wxString& name = wxASCII_STR(wxDirDialogNameStr)) + { + Create(parent, title, defaultPath, style, pos, sz, name); + } + + virtual ~wxDirDialogBase() {} + + + bool Create(wxWindow *parent, + const wxString& title = wxASCII_STR(wxDirSelectorPromptStr), + const wxString& defaultPath = wxEmptyString, + long style = wxDD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + const wxString& name = wxASCII_STR(wxDirDialogNameStr)) + { + if (!wxDialog::Create(parent, wxID_ANY, title, pos, sz, style, name)) + return false; + m_path = defaultPath; + m_message = title; + return true; + } + + virtual void SetMessage(const wxString& message) { m_message = message; } + virtual void SetPath(const wxString& path) { m_path = path; } + + virtual wxString GetMessage() const { return m_message; } + virtual wxString GetPath() const + { + wxCHECK_MSG( !HasFlag(wxDD_MULTIPLE), wxString(), + "When using wxDD_MULTIPLE, must call GetPaths() instead" ); + return m_path; + } + + virtual void GetPaths(wxArrayString& paths) const + { + paths = m_paths; + } + +protected: + wxString m_message; + wxString m_path; + wxArrayString m_paths; +}; + + +// Universal and non-port related switches with need for generic implementation +#if defined(__WXUNIVERSAL__) + #include "wx/generic/dirdlgg.h" + #define wxDirDialog wxGenericDirDialog +#elif defined(__WXMSW__) && !wxUSE_OLE + #include "wx/generic/dirdlgg.h" + #define wxDirDialog wxGenericDirDialog +#elif defined(__WXMSW__) + #include "wx/msw/dirdlg.h" // Native MSW +#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/osx/dirdlg.h" // Native Mac +#elif defined(__WXMOTIF__) || \ + defined(__WXX11__) + #include "wx/generic/dirdlgg.h" // Other ports use generic implementation + #define wxDirDialog wxGenericDirDialog +#elif defined(__WXQT__) + #include "wx/qt/dirdlg.h" +#endif + +// ---------------------------------------------------------------------------- +// common ::wxDirSelector() function +// ---------------------------------------------------------------------------- + +WXDLLIMPEXP_CORE wxString +wxDirSelector(const wxString& message = wxASCII_STR(wxDirSelectorPromptStr), + const wxString& defaultPath = wxEmptyString, + long style = wxDD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + wxWindow *parent = NULL); + +#endif // wxUSE_DIRDLG + +#endif + // _WX_DIRDLG_H_BASE_ diff --git a/lib/wxWidgets/include/wx/display.h b/lib/wxWidgets/include/wx/display.h new file mode 100644 index 0000000..a5e8271 --- /dev/null +++ b/lib/wxWidgets/include/wx/display.h @@ -0,0 +1,164 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/display.h +// Purpose: wxDisplay class +// Author: Royce Mitchell III, Vadim Zeitlin +// Created: 06/21/02 +// Copyright: (c) 2002-2006 wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DISPLAY_H_BASE_ +#define _WX_DISPLAY_H_BASE_ + +#include "wx/defs.h" +#include "wx/gdicmn.h" // wxSize + +// NB: no #if wxUSE_DISPLAY here, the display geometry part of this class (but +// not the video mode stuff) is always available but if wxUSE_DISPLAY == 0 +// it becomes just a trivial wrapper around the old wxDisplayXXX() functions + +#if wxUSE_DISPLAY + #include "wx/dynarray.h" + #include "wx/vidmode.h" + + WX_DECLARE_EXPORTED_OBJARRAY(wxVideoMode, wxArrayVideoModes); + + // default, uninitialized, video mode object + extern WXDLLIMPEXP_DATA_CORE(const wxVideoMode) wxDefaultVideoMode; +#endif // wxUSE_DISPLAY + +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxPoint; +class WXDLLIMPEXP_FWD_CORE wxRect; +class WXDLLIMPEXP_FWD_BASE wxString; + +class WXDLLIMPEXP_FWD_CORE wxDisplayFactory; +class WXDLLIMPEXP_FWD_CORE wxDisplayImpl; + +// ---------------------------------------------------------------------------- +// wxDisplay: represents a display/monitor attached to the system +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDisplay +{ +public: + // default ctor creates the object corresponding to the primary display + wxDisplay(); + + // initialize the object containing all information about the given + // display + // + // the displays are numbered from 0 to GetCount() - 1 + explicit wxDisplay(unsigned n); + + // create display object corresponding to the display of the given window + // or the default one if the window display couldn't be found + explicit wxDisplay(const wxWindow* window); + + // dtor is not virtual as this is a concrete class not meant to be derived + // from + + + // return the number of available displays, valid parameters to + // wxDisplay ctor are from 0 up to this number + static unsigned GetCount(); + + // find the display where the given point lies, return wxNOT_FOUND if + // it doesn't belong to any display + static int GetFromPoint(const wxPoint& pt); + + // find the display where the given window lies, return wxNOT_FOUND if it + // is not shown at all + static int GetFromWindow(const wxWindow *window); + + + // return true if the object was initialized successfully + bool IsOk() const { return m_impl != NULL; } + + // get the full display size + wxRect GetGeometry() const; + + // get the client area of the display, i.e. without taskbars and such + wxRect GetClientArea() const; + + // get the depth, i.e. number of bits per pixel (0 if unknown) + int GetDepth() const; + + // get the resolution of this monitor in pixels per inch + wxSize GetPPI() const; + + // get the default resolution for displays on this platform + static int GetStdPPIValue() + { +#ifdef __WXOSX__ + return 72; +#else + return 96; +#endif + } + + static wxSize GetStdPPI() + { + return wxSize(GetStdPPIValue(), GetStdPPIValue()); + } + + // get the scaling used by this display + double GetScaleFactor() const; + + // name may be empty + wxString GetName() const; + + // display 0 is usually the primary display + bool IsPrimary() const; + + +#if wxUSE_DISPLAY + // enumerate all video modes supported by this display matching the given + // one (in the sense of wxVideoMode::Match()) + // + // as any mode matches the default value of the argument and there is + // always at least one video mode supported by display, the returned array + // is only empty for the default value of the argument if this function is + // not supported at all on this platform + wxArrayVideoModes + GetModes(const wxVideoMode& mode = wxDefaultVideoMode) const; + + // get current video mode + wxVideoMode GetCurrentMode() const; + + // change current mode, return true if succeeded, false otherwise + // + // for the default value of the argument restores the video mode to default + bool ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode); + + // restore the default video mode (just a more readable synonym) + void ResetMode() { (void)ChangeMode(); } +#endif // wxUSE_DISPLAY + + // If the implementation caches any information about the displays, calling + // this function clears it -- this should be done e.g. after a display + // [dis]connection. + static void InvalidateCache(); + +private: + // returns the factory used to implement our static methods and create new + // displays + static wxDisplayFactory& Factory(); + + // creates the factory object, called by Factory() when it is called for + // the first time and should return a pointer allocated with new (the + // caller will delete it) + // + // this method must be implemented in platform-specific code if + // wxUSE_DISPLAY == 1 (if it is 0 we provide the stub in common code) + static wxDisplayFactory *CreateFactory(); + + + // the real implementation + wxDisplayImpl *m_impl; + + + wxDECLARE_NO_COPY_CLASS(wxDisplay); +}; + +#endif // _WX_DISPLAY_H_BASE_ diff --git a/lib/wxWidgets/include/wx/dlimpexp.h b/lib/wxWidgets/include/wx/dlimpexp.h new file mode 100644 index 0000000..fd75cb9 --- /dev/null +++ b/lib/wxWidgets/include/wx/dlimpexp.h @@ -0,0 +1,311 @@ +/* + * Name: wx/dlimpexp.h + * Purpose: Macros for declaring DLL-imported/exported functions + * Author: Vadim Zeitlin + * Modified by: + * Created: 16.10.2003 (extracted from wx/defs.h) + * Copyright: (c) 2003 Vadim Zeitlin + * Licence: wxWindows licence + */ + +/* + This is a C file, not C++ one, do not use C++ comments here! + */ + +#ifndef _WX_DLIMPEXP_H_ +#define _WX_DLIMPEXP_H_ + +#if defined(HAVE_VISIBILITY) +# define WXEXPORT __attribute__ ((visibility("default"))) +# define WXIMPORT __attribute__ ((visibility("default"))) +#elif defined(__WINDOWS__) + /* + __declspec works in as VC++. + */ +# if defined(__VISUALC__) +# define WXEXPORT __declspec(dllexport) +# define WXIMPORT __declspec(dllimport) + /* + While gcc also supports __declspec(dllexport), it created unusably huge + DLL files in gcc 4.[56] (while taking horribly long amounts of time), + see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43601. Because of this + we rely on binutils auto export/import support which seems to work + quite well for 4.5+. However the problem was fixed in 4.7 and later and + not exporting everything creates smaller DLLs (~8% size difference), so + do use the explicit attributes again for the newer versions. + */ +# elif defined(__GNUC__) && \ + (!wxCHECK_GCC_VERSION(4, 5) || wxCHECK_GCC_VERSION(4, 7)) + /* + __declspec could be used here too but let's use the native + __attribute__ instead for clarity. + */ +# define WXEXPORT __attribute__((dllexport)) +# define WXIMPORT __attribute__((dllimport)) +# endif +#elif defined(__CYGWIN__) +# define WXEXPORT __declspec(dllexport) +# define WXIMPORT __declspec(dllimport) +#endif + +/* for other platforms/compilers we don't anything */ +#ifndef WXEXPORT +# define WXEXPORT +# define WXIMPORT +#endif + +/* + We support building wxWidgets as a set of several libraries but we don't + support arbitrary combinations of libs/DLLs: either we build all of them as + DLLs (in which case WXMAKINGDLL is defined) or none (it isn't). + + However we have a problem because we need separate WXDLLIMPEXP versions for + different libraries as, for example, wxString class should be dllexported + when compiled in wxBase and dllimported otherwise, so we do define separate + WXMAKING/USINGDLL_XYZ constants for each component XYZ. + */ +#ifdef WXMAKINGDLL +# if wxUSE_BASE +# define WXMAKINGDLL_BASE +# endif + +# define WXMAKINGDLL_NET +# define WXMAKINGDLL_CORE +# define WXMAKINGDLL_ADV +# define WXMAKINGDLL_QA +# define WXMAKINGDLL_HTML +# define WXMAKINGDLL_GL +# define WXMAKINGDLL_XML +# define WXMAKINGDLL_XRC +# define WXMAKINGDLL_AUI +# define WXMAKINGDLL_PROPGRID +# define WXMAKINGDLL_RIBBON +# define WXMAKINGDLL_RICHTEXT +# define WXMAKINGDLL_MEDIA +# define WXMAKINGDLL_STC +# define WXMAKINGDLL_WEBVIEW +#endif /* WXMAKINGDLL */ + +/* + WXDLLIMPEXP_CORE maps to export declaration when building the DLL, to import + declaration if using it or to nothing at all if we don't use wxWin as DLL + */ +#ifdef WXMAKINGDLL_BASE +# define WXDLLIMPEXP_BASE WXEXPORT +# define WXDLLIMPEXP_DATA_BASE(type) WXEXPORT type +# if defined(HAVE_VISIBILITY) +# define WXDLLIMPEXP_INLINE_BASE WXEXPORT +# else +# define WXDLLIMPEXP_INLINE_BASE +# endif +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_BASE WXIMPORT +# define WXDLLIMPEXP_DATA_BASE(type) WXIMPORT type +# if defined(HAVE_VISIBILITY) +# define WXDLLIMPEXP_INLINE_BASE WXIMPORT +# else +# define WXDLLIMPEXP_INLINE_BASE +# endif +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_BASE +# define WXDLLIMPEXP_DATA_BASE(type) type +# define WXDLLIMPEXP_INLINE_BASE +#endif + +#ifdef WXMAKINGDLL_NET +# define WXDLLIMPEXP_NET WXEXPORT +# define WXDLLIMPEXP_DATA_NET(type) WXEXPORT type +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_NET WXIMPORT +# define WXDLLIMPEXP_DATA_NET(type) WXIMPORT type +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_NET +# define WXDLLIMPEXP_DATA_NET(type) type +#endif + +#ifdef WXMAKINGDLL_CORE +# define WXDLLIMPEXP_CORE WXEXPORT +# define WXDLLIMPEXP_DATA_CORE(type) WXEXPORT type +# if defined(HAVE_VISIBILITY) +# define WXDLLIMPEXP_INLINE_CORE WXEXPORT +# else +# define WXDLLIMPEXP_INLINE_CORE +# endif +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_CORE WXIMPORT +# define WXDLLIMPEXP_DATA_CORE(type) WXIMPORT type +# if defined(HAVE_VISIBILITY) +# define WXDLLIMPEXP_INLINE_CORE WXIMPORT +# else +# define WXDLLIMPEXP_INLINE_CORE +# endif +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_CORE +# define WXDLLIMPEXP_DATA_CORE(type) type +# define WXDLLIMPEXP_INLINE_CORE +#endif + +/* Advanced library doesn't exist any longer, but its macros are preserved for + compatibility. Do not use them in the new code. */ +#define WXDLLIMPEXP_ADV WXDLLIMPEXP_CORE +#define WXDLLIMPEXP_DATA_ADV(type) WXDLLIMPEXP_DATA_CORE(type) + +#ifdef WXMAKINGDLL_QA +# define WXDLLIMPEXP_QA WXEXPORT +# define WXDLLIMPEXP_DATA_QA(type) WXEXPORT type +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_QA WXIMPORT +# define WXDLLIMPEXP_DATA_QA(type) WXIMPORT type +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_QA +# define WXDLLIMPEXP_DATA_QA(type) type +#endif + +#ifdef WXMAKINGDLL_HTML +# define WXDLLIMPEXP_HTML WXEXPORT +# define WXDLLIMPEXP_DATA_HTML(type) WXEXPORT type +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_HTML WXIMPORT +# define WXDLLIMPEXP_DATA_HTML(type) WXIMPORT type +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_HTML +# define WXDLLIMPEXP_DATA_HTML(type) type +#endif + +#ifdef WXMAKINGDLL_GL +# define WXDLLIMPEXP_GL WXEXPORT +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_GL WXIMPORT +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_GL +#endif + +#ifdef WXMAKINGDLL_XML +# define WXDLLIMPEXP_XML WXEXPORT +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_XML WXIMPORT +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_XML +#endif + +#ifdef WXMAKINGDLL_XRC +# define WXDLLIMPEXP_XRC WXEXPORT +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_XRC WXIMPORT +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_XRC +#endif + +#ifdef WXMAKINGDLL_AUI +# define WXDLLIMPEXP_AUI WXEXPORT +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_AUI WXIMPORT +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_AUI +#endif + +#ifdef WXMAKINGDLL_PROPGRID +# define WXDLLIMPEXP_PROPGRID WXEXPORT +# define WXDLLIMPEXP_DATA_PROPGRID(type) WXEXPORT type +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_PROPGRID WXIMPORT +# define WXDLLIMPEXP_DATA_PROPGRID(type) WXIMPORT type +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_PROPGRID +# define WXDLLIMPEXP_DATA_PROPGRID(type) type +#endif + +#ifdef WXMAKINGDLL_RIBBON +# define WXDLLIMPEXP_RIBBON WXEXPORT +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_RIBBON WXIMPORT +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_RIBBON +#endif + +#ifdef WXMAKINGDLL_RICHTEXT +# define WXDLLIMPEXP_RICHTEXT WXEXPORT +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_RICHTEXT WXIMPORT +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_RICHTEXT +#endif + +#ifdef WXMAKINGDLL_MEDIA +# define WXDLLIMPEXP_MEDIA WXEXPORT +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_MEDIA WXIMPORT +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_MEDIA +#endif + +#ifdef WXMAKINGDLL_STC +# define WXDLLIMPEXP_STC WXEXPORT +# define WXDLLIMPEXP_DATA_STC(type) WXEXPORT type +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_STC WXIMPORT +# define WXDLLIMPEXP_DATA_STC(type) WXIMPORT type +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_STC +# define WXDLLIMPEXP_DATA_STC(type) type +#endif + +#ifdef WXMAKINGDLL_WEBVIEW +# define WXDLLIMPEXP_WEBVIEW WXEXPORT +# define WXDLLIMPEXP_DATA_WEBVIEW(type) WXEXPORT type +#elif defined(WXUSINGDLL) +# define WXDLLIMPEXP_WEBVIEW WXIMPORT +# define WXDLLIMPEXP_DATA_WEBVIEW(type) WXIMPORT type +#else /* not making nor using DLL */ +# define WXDLLIMPEXP_WEBVIEW +# define WXDLLIMPEXP_DATA_WEBVIEW(type) type +#endif + +/* + GCC warns about using __attribute__ (and also __declspec in mingw32 case) on + forward declarations while MSVC complains about forward declarations without + __declspec for the classes later declared with it, so we need a separate set + of macros for forward declarations to hide this difference: + */ +#if defined(HAVE_VISIBILITY) || (defined(__WINDOWS__) && defined(__GNUC__)) + #define WXDLLIMPEXP_FWD_BASE + #define WXDLLIMPEXP_FWD_NET + #define WXDLLIMPEXP_FWD_CORE + #define WXDLLIMPEXP_FWD_QA + #define WXDLLIMPEXP_FWD_HTML + #define WXDLLIMPEXP_FWD_GL + #define WXDLLIMPEXP_FWD_XML + #define WXDLLIMPEXP_FWD_XRC + #define WXDLLIMPEXP_FWD_AUI + #define WXDLLIMPEXP_FWD_PROPGRID + #define WXDLLIMPEXP_FWD_RIBBON + #define WXDLLIMPEXP_FWD_RICHTEXT + #define WXDLLIMPEXP_FWD_MEDIA + #define WXDLLIMPEXP_FWD_STC + #define WXDLLIMPEXP_FWD_WEBVIEW +#else + #define WXDLLIMPEXP_FWD_BASE WXDLLIMPEXP_BASE + #define WXDLLIMPEXP_FWD_NET WXDLLIMPEXP_NET + #define WXDLLIMPEXP_FWD_CORE WXDLLIMPEXP_CORE + #define WXDLLIMPEXP_FWD_QA WXDLLIMPEXP_QA + #define WXDLLIMPEXP_FWD_HTML WXDLLIMPEXP_HTML + #define WXDLLIMPEXP_FWD_GL WXDLLIMPEXP_GL + #define WXDLLIMPEXP_FWD_XML WXDLLIMPEXP_XML + #define WXDLLIMPEXP_FWD_XRC WXDLLIMPEXP_XRC + #define WXDLLIMPEXP_FWD_AUI WXDLLIMPEXP_AUI + #define WXDLLIMPEXP_FWD_PROPGRID WXDLLIMPEXP_PROPGRID + #define WXDLLIMPEXP_FWD_RIBBON WXDLLIMPEXP_RIBBON + #define WXDLLIMPEXP_FWD_RICHTEXT WXDLLIMPEXP_RICHTEXT + #define WXDLLIMPEXP_FWD_MEDIA WXDLLIMPEXP_MEDIA + #define WXDLLIMPEXP_FWD_STC WXDLLIMPEXP_STC + #define WXDLLIMPEXP_FWD_WEBVIEW WXDLLIMPEXP_WEBVIEW +#endif + +/* This macro continues to exist for backwards compatibility only. */ +#define WXDLLIMPEXP_FWD_ADV WXDLLIMPEXP_FWD_CORE + +/* for backwards compatibility, define suffix-less versions too */ +#define WXDLLEXPORT WXDLLIMPEXP_CORE +#define WXDLLEXPORT_DATA WXDLLIMPEXP_DATA_CORE + +#endif /* _WX_DLIMPEXP_H_ */ diff --git a/lib/wxWidgets/include/wx/dlist.h b/lib/wxWidgets/include/wx/dlist.h new file mode 100644 index 0000000..28d4835 --- /dev/null +++ b/lib/wxWidgets/include/wx/dlist.h @@ -0,0 +1,848 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/dlist.h +// Purpose: wxDList which is a template version of wxList +// Author: Robert Roebling +// Created: 18.09.2008 +// Copyright: (c) 2008 wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DLIST_H_ +#define _WX_DLIST_H_ + +#include "wx/defs.h" +#include "wx/utils.h" + +#if wxUSE_STD_CONTAINERS + +#include "wx/beforestd.h" +#include +#include +#include +#include "wx/afterstd.h" + +template +class wxDList: public std::list +{ +private: + bool m_destroy; + typedef std::list BaseListType; + typedef wxDList ListType; + +public: + typedef typename BaseListType::iterator iterator; + + class compatibility_iterator + { + private: + friend class wxDList; + + iterator m_iter; + ListType *m_list; + + public: + compatibility_iterator() + : m_iter(), m_list( NULL ) {} + compatibility_iterator( ListType* li, iterator i ) + : m_iter( i ), m_list( li ) {} + compatibility_iterator( const ListType* li, iterator i ) + : m_iter( i ), m_list( const_cast(li) ) {} + + compatibility_iterator* operator->() { return this; } + const compatibility_iterator* operator->() const { return this; } + + bool operator==(const compatibility_iterator& i) const + { + wxASSERT_MSG( m_list && i.m_list, + "comparing invalid iterators is illegal" ); + return (m_list == i.m_list) && (m_iter == i.m_iter); + } + bool operator!=(const compatibility_iterator& i) const + { return !( operator==( i ) ); } + operator bool() const + { return m_list ? m_iter != m_list->end() : false; } + bool operator !() const + { return !( operator bool() ); } + + T* GetData() const { return *m_iter; } + void SetData( T* e ) { *m_iter = e; } + + compatibility_iterator GetNext() const + { + iterator i = m_iter; + return compatibility_iterator( m_list, ++i ); + } + + compatibility_iterator GetPrevious() const + { + if ( m_iter == m_list->begin() ) + return compatibility_iterator(); + + iterator i = m_iter; + return compatibility_iterator( m_list, --i ); + } + + int IndexOf() const + { + return *this ? std::distance( m_list->begin(), m_iter ) + : wxNOT_FOUND; + } + }; + +public: + wxDList() : m_destroy( false ) {} + + ~wxDList() { Clear(); } + + compatibility_iterator Find( const T* e ) const + { + return compatibility_iterator( this, + std::find( const_cast(this)->begin(), + const_cast(this)->end(), e ) ); + } + + bool IsEmpty() const + { return this->empty(); } + size_t GetCount() const + { return this->size(); } + + compatibility_iterator Item( size_t idx ) const + { + iterator i = const_cast(this)->begin(); + std::advance( i, idx ); + return compatibility_iterator( this, i ); + } + + T* operator[](size_t idx) const + { + return Item(idx).GetData(); + } + + compatibility_iterator GetFirst() const + { + return compatibility_iterator( this, const_cast(this)->begin() ); + } + compatibility_iterator GetLast() const + { + iterator i = const_cast(this)->end(); + return compatibility_iterator( this, !(this->empty()) ? --i : i ); + } + compatibility_iterator Member( T* e ) const + { return Find( e ); } + compatibility_iterator Nth( int n ) const + { return Item( n ); } + int IndexOf( T* e ) const + { return Find( e ).IndexOf(); } + + compatibility_iterator Append( T* e ) + { + this->push_back( e ); + return GetLast(); + } + + compatibility_iterator Insert( T* e ) + { + this->push_front( e ); + return compatibility_iterator( this, this->begin() ); + } + + compatibility_iterator Insert( compatibility_iterator & i, T* e ) + { + return compatibility_iterator( this, this->insert( i.m_iter, e ) ); + } + + compatibility_iterator Insert( size_t idx, T* e ) + { + return compatibility_iterator( this, + this->insert( Item( idx ).m_iter, e ) ); + } + + void DeleteContents( bool destroy ) + { m_destroy = destroy; } + + bool GetDeleteContents() const + { return m_destroy; } + + void Erase( const compatibility_iterator& i ) + { + if ( m_destroy ) + delete i->GetData(); + this->erase( i.m_iter ); + } + + bool DeleteNode( const compatibility_iterator& i ) + { + if( i ) + { + Erase( i ); + return true; + } + return false; + } + + bool DeleteObject( T* e ) + { + return DeleteNode( Find( e ) ); + } + + void Clear() + { + if ( m_destroy ) + { + iterator it, en; + for ( it = this->begin(), en = this->end(); it != en; ++it ) + delete *it; + } + this->clear(); + } +}; + +#else // !wxUSE_STD_CONTAINERS + +template +class wxDList +{ +public: + class Node + { + public: + Node(wxDList *list = NULL, + Node *previous = NULL, + Node *next = NULL, + T *data = NULL) + { + m_list = list; + m_previous = previous; + m_next = next; + m_data = data; + if (previous) + previous->m_next = this; + if (next) + next->m_previous = this; + } + + ~Node() + { + // handle the case when we're being deleted from the list by + // the user (i.e. not by the list itself from DeleteNode) - + // we must do it for compatibility with old code + if (m_list != NULL) + m_list->DetachNode(this); + } + + void DeleteData() + { + delete m_data; + } + + Node *GetNext() const { return m_next; } + Node *GetPrevious() const { return m_previous; } + T *GetData() const { return m_data; } + T **GetDataPtr() const { return &(const_cast(this)->m_data); } + void SetData( T *data ) { m_data = data; } + + int IndexOf() const + { + wxCHECK_MSG( m_list, wxNOT_FOUND, + "node doesn't belong to a list in IndexOf" ); + + int i; + Node *prev = m_previous; + for( i = 0; prev; i++ ) + prev = prev->m_previous; + return i; + } + + private: + T *m_data; // user data + Node *m_next, // next and previous nodes in the list + *m_previous; + wxDList *m_list; // list we belong to + + friend class wxDList; + }; + + typedef Node nodetype; + + class compatibility_iterator + { + public: + compatibility_iterator(nodetype *ptr = NULL) : m_ptr(ptr) { } + nodetype *operator->() const { return m_ptr; } + operator nodetype *() const { return m_ptr; } + + private: + nodetype *m_ptr; + }; + +private: + void Init() + { + m_nodeFirst = + m_nodeLast = NULL; + m_count = 0; + m_destroy = false; + } + + void DoDeleteNode( nodetype *node ) + { + if ( m_destroy ) + node->DeleteData(); + // so that the node knows that it's being deleted by the list + node->m_list = NULL; + delete node; + } + + size_t m_count; // number of elements in the list + bool m_destroy; // destroy user data when deleting list items? + nodetype *m_nodeFirst, // pointers to the head and tail of the list + *m_nodeLast; + +public: + wxDList() + { + Init(); + } + + wxDList( const wxDList& list ) + { + Init(); + Assign(list); + } + + wxDList( size_t count, T *elements[] ) + { + Init(); + size_t n; + for (n = 0; n < count; n++) + Append( elements[n] ); + } + + wxDList& operator=( const wxDList& list ) + { + if (&list != this) + Assign(list); + return *this; + } + + ~wxDList() + { + nodetype *each = m_nodeFirst; + while ( each != NULL ) + { + nodetype *next = each->GetNext(); + DoDeleteNode(each); + each = next; + } + } + + void Assign(const wxDList &list) + { + wxASSERT_MSG( !list.m_destroy, + "copying list which owns its elements is a bad idea" ); + Clear(); + m_destroy = list.m_destroy; + m_nodeFirst = NULL; + m_nodeLast = NULL; + nodetype* node; + for (node = list.GetFirst(); node; node = node->GetNext() ) + Append(node->GetData()); + wxASSERT_MSG( m_count == list.m_count, "logic error in Assign()" ); + } + + nodetype *Append( T *object ) + { + nodetype *node = new nodetype( this, m_nodeLast, NULL, object ); + + if ( !m_nodeFirst ) + { + m_nodeFirst = node; + m_nodeLast = m_nodeFirst; + } + else + { + m_nodeLast->m_next = node; + m_nodeLast = node; + } + m_count++; + return node; + } + + nodetype *Insert( T* object ) + { + return Insert( NULL, object ); + } + + nodetype *Insert( size_t pos, T* object ) + { + if (pos == m_count) + return Append( object ); + else + return Insert( Item(pos), object ); + } + + nodetype *Insert( nodetype *position, T* object ) + { + wxCHECK_MSG( !position || position->m_list == this, NULL, + "can't insert before a node from another list" ); + + // previous and next node for the node being inserted + nodetype *prev, *next; + if ( position ) + { + prev = position->GetPrevious(); + next = position; + } + else + { + // inserting in the beginning of the list + prev = NULL; + next = m_nodeFirst; + } + nodetype *node = new nodetype( this, prev, next, object ); + if ( !m_nodeFirst ) + m_nodeLast = node; + if ( prev == NULL ) + m_nodeFirst = node; + m_count++; + return node; + } + + nodetype *GetFirst() const { return m_nodeFirst; } + nodetype *GetLast() const { return m_nodeLast; } + size_t GetCount() const { return m_count; } + bool IsEmpty() const { return m_count == 0; } + + void DeleteContents(bool destroy) { m_destroy = destroy; } + bool GetDeleteContents() const { return m_destroy; } + + nodetype *Item(size_t index) const + { + for ( nodetype *current = GetFirst(); current; current = current->GetNext() ) + { + if ( index-- == 0 ) + return current; + } + wxFAIL_MSG( "invalid index in Item()" ); + return NULL; + } + + T *operator[](size_t index) const + { + nodetype *node = Item(index); + return node ? node->GetData() : NULL; + } + + nodetype *DetachNode( nodetype *node ) + { + wxCHECK_MSG( node, NULL, "detaching NULL wxNodeBase" ); + wxCHECK_MSG( node->m_list == this, NULL, + "detaching node which is not from this list" ); + // update the list + nodetype **prevNext = node->GetPrevious() ? &node->GetPrevious()->m_next + : &m_nodeFirst; + nodetype **nextPrev = node->GetNext() ? &node->GetNext()->m_previous + : &m_nodeLast; + *prevNext = node->GetNext(); + *nextPrev = node->GetPrevious(); + m_count--; + // mark the node as not belonging to this list any more + node->m_list = NULL; + return node; + } + + void Erase( nodetype *node ) + { + DeleteNode(node); + } + + bool DeleteNode( nodetype *node ) + { + if ( !DetachNode(node) ) + return false; + DoDeleteNode(node); + return true; + } + + bool DeleteObject( T *object ) + { + for ( nodetype *current = GetFirst(); current; current = current->GetNext() ) + { + if ( current->GetData() == object ) + { + DeleteNode(current); + return true; + } + } + // not found + return false; + } + + nodetype *Find(const T *object) const + { + for ( nodetype *current = GetFirst(); current; current = current->GetNext() ) + { + if ( current->GetData() == object ) + return current; + } + // not found + return NULL; + } + + int IndexOf(const T *object) const + { + int n = 0; + for ( nodetype *current = GetFirst(); current; current = current->GetNext() ) + { + if ( current->GetData() == object ) + return n; + n++; + } + return wxNOT_FOUND; + } + + void Clear() + { + nodetype *current = m_nodeFirst; + while ( current ) + { + nodetype *next = current->GetNext(); + DoDeleteNode(current); + current = next; + } + m_nodeFirst = + m_nodeLast = NULL; + m_count = 0; + } + + void Reverse() + { + nodetype * node = m_nodeFirst; + nodetype* tmp; + while (node) + { + // swap prev and next pointers + tmp = node->m_next; + node->m_next = node->m_previous; + node->m_previous = tmp; + // this is the node that was next before swapping + node = tmp; + } + // swap first and last node + tmp = m_nodeFirst; m_nodeFirst = m_nodeLast; m_nodeLast = tmp; + } + + void DeleteNodes(nodetype* first, nodetype* last) + { + nodetype * node = first; + while (node != last) + { + nodetype* next = node->GetNext(); + DeleteNode(node); + node = next; + } + } + + void ForEach(wxListIterateFunction F) + { + for ( nodetype *current = GetFirst(); current; current = current->GetNext() ) + (*F)(current->GetData()); + } + + T *FirstThat(wxListIterateFunction F) + { + for ( nodetype *current = GetFirst(); current; current = current->GetNext() ) + { + if ( (*F)(current->GetData()) ) + return current->GetData(); + } + return NULL; + } + + T *LastThat(wxListIterateFunction F) + { + for ( nodetype *current = GetLast(); current; current = current->GetPrevious() ) + { + if ( (*F)(current->GetData()) ) + return current->GetData(); + } + return NULL; + } + + /* STL interface */ +public: + typedef size_t size_type; + typedef int difference_type; + typedef T* value_type; + typedef value_type& reference; + typedef const value_type& const_reference; + + class iterator + { + public: + typedef nodetype Node; + typedef iterator itor; + typedef T* value_type; + typedef value_type* ptr_type; + typedef value_type& reference; + + Node* m_node; + Node* m_init; + public: + typedef reference reference_type; + typedef ptr_type pointer_type; + + iterator(Node* node, Node* init) : m_node(node), m_init(init) {} + iterator() : m_node(NULL), m_init(NULL) { } + reference_type operator*() const + { return *m_node->GetDataPtr(); } + // ptrop + itor& operator++() { m_node = m_node->GetNext(); return *this; } + const itor operator++(int) + { itor tmp = *this; m_node = m_node->GetNext(); return tmp; } + itor& operator--() + { + m_node = m_node ? m_node->GetPrevious() : m_init; + return *this; + } + const itor operator--(int) + { + itor tmp = *this; + m_node = m_node ? m_node->GetPrevious() : m_init; + return tmp; + } + bool operator!=(const itor& it) const + { return it.m_node != m_node; } + bool operator==(const itor& it) const + { return it.m_node == m_node; } + }; + class const_iterator + { + public: + typedef nodetype Node; + typedef T* value_type; + typedef const value_type& const_reference; + typedef const_iterator itor; + typedef value_type* ptr_type; + + Node* m_node; + Node* m_init; + public: + typedef const_reference reference_type; + typedef const ptr_type pointer_type; + + const_iterator(Node* node, Node* init) + : m_node(node), m_init(init) { } + const_iterator() : m_node(NULL), m_init(NULL) { } + const_iterator(const iterator& it) + : m_node(it.m_node), m_init(it.m_init) { } + reference_type operator*() const + { return *m_node->GetDataPtr(); } + // ptrop + itor& operator++() { m_node = m_node->GetNext(); return *this; } + const itor operator++(int) + { itor tmp = *this; m_node = m_node->GetNext(); return tmp; } + itor& operator--() + { + m_node = m_node ? m_node->GetPrevious() : m_init; + return *this; + } + const itor operator--(int) + { + itor tmp = *this; + m_node = m_node ? m_node->GetPrevious() : m_init; + return tmp; + } + bool operator!=(const itor& it) const + { return it.m_node != m_node; } + bool operator==(const itor& it) const + { return it.m_node == m_node; } + }; + + class reverse_iterator + { + public: + typedef nodetype Node; + typedef T* value_type; + typedef reverse_iterator itor; + typedef value_type* ptr_type; + typedef value_type& reference; + + Node* m_node; + Node* m_init; + public: + typedef reference reference_type; + typedef ptr_type pointer_type; + + reverse_iterator(Node* node, Node* init) + : m_node(node), m_init(init) { } + reverse_iterator() : m_node(NULL), m_init(NULL) { } + reference_type operator*() const + { return *m_node->GetDataPtr(); } + // ptrop + itor& operator++() + { m_node = m_node->GetPrevious(); return *this; } + const itor operator++(int) + { itor tmp = *this; m_node = m_node->GetPrevious(); return tmp; } + itor& operator--() + { m_node = m_node ? m_node->GetNext() : m_init; return *this; } + const itor operator--(int) + { + itor tmp = *this; + m_node = m_node ? m_node->GetNext() : m_init; + return tmp; + } + bool operator!=(const itor& it) const + { return it.m_node != m_node; } + bool operator==(const itor& it) const + { return it.m_node == m_node; } + }; + + class const_reverse_iterator + { + public: + typedef nodetype Node; + typedef T* value_type; + typedef const_reverse_iterator itor; + typedef value_type* ptr_type; + typedef const value_type& const_reference; + + Node* m_node; + Node* m_init; + public: + typedef const_reference reference_type; + typedef const ptr_type pointer_type; + + const_reverse_iterator(Node* node, Node* init) + : m_node(node), m_init(init) { } + const_reverse_iterator() : m_node(NULL), m_init(NULL) { } + const_reverse_iterator(const reverse_iterator& it) + : m_node(it.m_node), m_init(it.m_init) { } + reference_type operator*() const + { return *m_node->GetDataPtr(); } + // ptrop + itor& operator++() + { m_node = m_node->GetPrevious(); return *this; } + const itor operator++(int) + { itor tmp = *this; m_node = m_node->GetPrevious(); return tmp; } + itor& operator--() + { m_node = m_node ? m_node->GetNext() : m_init; return *this;} + const itor operator--(int) + { + itor tmp = *this; + m_node = m_node ? m_node->GetNext() : m_init; + return tmp; + } + bool operator!=(const itor& it) const + { return it.m_node != m_node; } + bool operator==(const itor& it) const + { return it.m_node == m_node; } + }; + + explicit wxDList(size_type n, const_reference v = value_type()) + { assign(n, v); } + wxDList(const const_iterator& first, const const_iterator& last) + { assign(first, last); } + iterator begin() { return iterator(GetFirst(), GetLast()); } + const_iterator begin() const + { return const_iterator(GetFirst(), GetLast()); } + iterator end() { return iterator(NULL, GetLast()); } + const_iterator end() const { return const_iterator(NULL, GetLast()); } + reverse_iterator rbegin() + { return reverse_iterator(GetLast(), GetFirst()); } + const_reverse_iterator rbegin() const + { return const_reverse_iterator(GetLast(), GetFirst()); } + reverse_iterator rend() { return reverse_iterator(NULL, GetFirst()); } + const_reverse_iterator rend() const + { return const_reverse_iterator(NULL, GetFirst()); } + void resize(size_type n, value_type v = value_type()) + { + while (n < size()) + pop_back(); + while (n > size()) + push_back(v); + } + size_type size() const { return GetCount(); } + size_type max_size() const { return INT_MAX; } + bool empty() const { return IsEmpty(); } + reference front() { return *begin(); } + const_reference front() const { return *begin(); } + reference back() { iterator tmp = end(); return *--tmp; } + const_reference back() const { const_iterator tmp = end(); return *--tmp; } + void push_front(const_reference v = value_type()) + { Insert(GetFirst(), v); } + void pop_front() { DeleteNode(GetFirst()); } + void push_back(const_reference v = value_type()) + { Append( v ); } + void pop_back() { DeleteNode(GetLast()); } + void assign(const_iterator first, const const_iterator& last) + { + clear(); + for(; first != last; ++first) + Append(*first); + } + void assign(size_type n, const_reference v = value_type()) + { + clear(); + for(size_type i = 0; i < n; ++i) + Append(v); + } + iterator insert(const iterator& it, const_reference v) + { + if (it == end()) + Append( v ); + else + Insert(it.m_node,v); + iterator itprev(it); + return itprev--; + } + void insert(const iterator& it, size_type n, const_reference v) + { + for(size_type i = 0; i < n; ++i) + Insert(it.m_node, v); + } + void insert(const iterator& it, const_iterator first, const const_iterator& last) + { + for(; first != last; ++first) + Insert(it.m_node, *first); + } + iterator erase(const iterator& it) + { + iterator next = iterator(it.m_node->GetNext(), GetLast()); + DeleteNode(it.m_node); return next; + } + iterator erase(const iterator& first, const iterator& last) + { + iterator next = last; ++next; + DeleteNodes(first.m_node, last.m_node); + return next; + } + void clear() { Clear(); } + void splice(const iterator& it, wxDList& l, const iterator& first, const iterator& last) + { insert(it, first, last); l.erase(first, last); } + void splice(const iterator& it, wxDList& l) + { splice(it, l, l.begin(), l.end() ); } + void splice(const iterator& it, wxDList& l, const iterator& first) + { + iterator tmp = first; ++tmp; + if(it == first || it == tmp) return; + insert(it, *first); + l.erase(first); + } + void remove(const_reference v) + { DeleteObject(v); } + void reverse() + { Reverse(); } + /* void swap(list& l) + { + { size_t t = m_count; m_count = l.m_count; l.m_count = t; } + { bool t = m_destroy; m_destroy = l.m_destroy; l.m_destroy = t; } + { wxNodeBase* t = m_nodeFirst; m_nodeFirst = l.m_nodeFirst; l.m_nodeFirst = t; } + { wxNodeBase* t = m_nodeLast; m_nodeLast = l.m_nodeLast; l.m_nodeLast = t; } + { wxKeyType t = m_keyType; m_keyType = l.m_keyType; l.m_keyType = t; } + } */ +}; + +#endif // wxUSE_STD_CONTAINERS/!wxUSE_STD_CONTAINERS + +#endif // _WX_DLIST_H_ diff --git a/lib/wxWidgets/include/wx/dnd.h b/lib/wxWidgets/include/wx/dnd.h new file mode 100644 index 0000000..c430836 --- /dev/null +++ b/lib/wxWidgets/include/wx/dnd.h @@ -0,0 +1,266 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/dnd.h +// Purpose: Drag and drop classes declarations +// Author: Vadim Zeitlin, Robert Roebling +// Modified by: +// Created: 26.05.99 +// Copyright: (c) wxWidgets Team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DND_H_BASE_ +#define _WX_DND_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_DRAG_AND_DROP + +#include "wx/dataobj.h" +#include "wx/cursor.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// flags for wxDropSource::DoDragDrop() +// +// NB: wxDrag_CopyOnly must be 0 (== FALSE) and wxDrag_AllowMove must be 1 +// (== TRUE) for compatibility with the old DoDragDrop(bool) method! +enum +{ + wxDrag_CopyOnly = 0, // allow only copying + wxDrag_AllowMove = 1, // allow moving (copying is always allowed) + wxDrag_DefaultMove = 3 // the default operation is move, not copy +}; + +// result of wxDropSource::DoDragDrop() call +enum wxDragResult +{ + wxDragError, // error prevented the d&d operation from completing + wxDragNone, // drag target didn't accept the data + wxDragCopy, // the data was successfully copied + wxDragMove, // the data was successfully moved (MSW only) + wxDragLink, // operation is a drag-link + wxDragCancel // the operation was cancelled by user (not an error) +}; + +// return true if res indicates that something was done during a dnd operation, +// i.e. is neither error nor none nor cancel +WXDLLIMPEXP_CORE bool wxIsDragResultOk(wxDragResult res); + +// ---------------------------------------------------------------------------- +// wxDropSource is the object you need to create (and call DoDragDrop on it) +// to initiate a drag-and-drop operation +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDropSourceBase +{ +public: + wxDropSourceBase(const wxCursor &cursorCopy = wxNullCursor, + const wxCursor &cursorMove = wxNullCursor, + const wxCursor &cursorStop = wxNullCursor) + : m_cursorCopy(cursorCopy), + m_cursorMove(cursorMove), + m_cursorStop(cursorStop) + { m_data = NULL; } + virtual ~wxDropSourceBase() { } + + // set the data which is transferred by drag and drop + void SetData(wxDataObject& data) + { m_data = &data; } + + wxDataObject *GetDataObject() + { return m_data; } + + // set the icon corresponding to given drag result + void SetCursor(wxDragResult res, const wxCursor& cursor) + { + if ( res == wxDragCopy ) + m_cursorCopy = cursor; + else if ( res == wxDragMove ) + m_cursorMove = cursor; + else + m_cursorStop = cursor; + } + + // start drag action, see enum wxDragResult for return value description + // + // if flags contains wxDrag_AllowMove, moving (and only copying) data is + // allowed, if it contains wxDrag_DefaultMove (which includes the previous + // flag), it is even the default operation + virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly) = 0; + + // override to give feedback depending on the current operation result + // "effect" and return true if you did something, false to let the library + // give the default feedback + virtual bool GiveFeedback(wxDragResult WXUNUSED(effect)) { return false; } + +protected: + const wxCursor& GetCursor(wxDragResult res) const + { + if ( res == wxDragCopy ) + return m_cursorCopy; + else if ( res == wxDragMove ) + return m_cursorMove; + else + return m_cursorStop; + } + + // the data we're dragging + wxDataObject *m_data; + + // the cursors to use for feedback + wxCursor m_cursorCopy, + m_cursorMove, + m_cursorStop; + + wxDECLARE_NO_COPY_CLASS(wxDropSourceBase); +}; + +// ---------------------------------------------------------------------------- +// wxDropTarget should be associated with a window if it wants to be able to +// receive data via drag and drop. +// +// To use this class, you should derive from wxDropTarget and implement +// OnData() pure virtual method. You may also wish to override OnDrop() if you +// want to accept the data only inside some region of the window (this may +// avoid having to copy the data to this application which happens only when +// OnData() is called) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDropTargetBase +{ +public: + // ctor takes a pointer to heap-allocated wxDataObject which will be owned + // by wxDropTarget and deleted by it automatically. If you don't give it + // here, you can use SetDataObject() later. + wxDropTargetBase(wxDataObject *dataObject = NULL) + { m_dataObject = dataObject; m_defaultAction = wxDragNone; } + // dtor deletes our data object + virtual ~wxDropTargetBase() + { delete m_dataObject; } + + // get/set the associated wxDataObject + wxDataObject *GetDataObject() const + { return m_dataObject; } + void SetDataObject(wxDataObject *dataObject) + { delete m_dataObject; + m_dataObject = dataObject; } + + // these functions are called when data is moved over position (x, y) and + // may return either wxDragCopy, wxDragMove or wxDragNone depending on + // what would happen if the data were dropped here. + // + // the last parameter is what would happen by default and is determined by + // the platform-specific logic (for example, under Windows it's wxDragCopy + // if Ctrl key is pressed and wxDragMove otherwise) except that it will + // always be wxDragNone if the carried data is in an unsupported format. + + // called when the mouse enters the window (only once until OnLeave()) + virtual wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def) + { return OnDragOver(x, y, def); } + + // called when the mouse moves in the window - shouldn't take long to + // execute or otherwise mouse movement would be too slow + virtual wxDragResult OnDragOver(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), + wxDragResult def) + { return def; } + + // called when mouse leaves the window: might be used to remove the + // feedback which was given in OnEnter() + virtual void OnLeave() { } + + // this function is called when data is dropped at position (x, y) - if it + // returns true, OnData() will be called immediately afterwards which will + // allow to retrieve the data dropped. + virtual bool OnDrop(wxCoord x, wxCoord y) = 0; + + // called after OnDrop() returns TRUE: you will usually just call + // GetData() from here and, probably, also refresh something to update the + // new data and, finally, return the code indicating how did the operation + // complete (returning default value in case of success and wxDragError on + // failure is usually ok) + virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def) = 0; + + // may be called *only* from inside OnData() and will fill m_dataObject + // with the data from the drop source if it returns true + virtual bool GetData() = 0; + + // sets the default action for drag and drop: + // use wxDragMove or wxDragCopy to set default action to move or copy + // and use wxDragNone (default) to set default action specified by + // initialization of dragging (see wxDropSourceBase::DoDragDrop()) + void SetDefaultAction(wxDragResult action) + { m_defaultAction = action; } + + // returns default action for drag and drop or + // wxDragNone if this not specified + wxDragResult GetDefaultAction() + { return m_defaultAction; } + +protected: + wxDataObject *m_dataObject; + wxDragResult m_defaultAction; + + wxDECLARE_NO_COPY_CLASS(wxDropTargetBase); +}; + +// ---------------------------------------------------------------------------- +// include platform dependent class declarations +// ---------------------------------------------------------------------------- + +#if defined(__WXMSW__) + #include "wx/msw/ole/dropsrc.h" + #include "wx/msw/ole/droptgt.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/dnd.h" +#elif defined(__WXX11__) + #include "wx/x11/dnd.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/dnd.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/dnd.h" +#elif defined(__WXMAC__) + #include "wx/osx/dnd.h" +#elif defined(__WXQT__) + #include "wx/qt/dnd.h" +#endif + +// ---------------------------------------------------------------------------- +// standard wxDropTarget implementations (implemented in common/dobjcmn.cpp) +// ---------------------------------------------------------------------------- + +// A simple wxDropTarget derived class for text data: you only need to +// override OnDropText() to get something working +class WXDLLIMPEXP_CORE wxTextDropTarget : public wxDropTarget +{ +public: + wxTextDropTarget(); + + virtual bool OnDropText(wxCoord x, wxCoord y, const wxString& text) = 0; + + virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def) wxOVERRIDE; + +private: + wxDECLARE_NO_COPY_CLASS(wxTextDropTarget); +}; + +// A drop target which accepts files (dragged from File Manager or Explorer) +class WXDLLIMPEXP_CORE wxFileDropTarget : public wxDropTarget +{ +public: + wxFileDropTarget(); + + // parameters are the number of files and the array of file names + virtual bool OnDropFiles(wxCoord x, wxCoord y, + const wxArrayString& filenames) = 0; + + virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def) wxOVERRIDE; + +private: + wxDECLARE_NO_COPY_CLASS(wxFileDropTarget); +}; + +#endif // wxUSE_DRAG_AND_DROP + +#endif // _WX_DND_H_BASE_ diff --git a/lib/wxWidgets/include/wx/docmdi.h b/lib/wxWidgets/include/wx/docmdi.h new file mode 100644 index 0000000..3809379 --- /dev/null +++ b/lib/wxWidgets/include/wx/docmdi.h @@ -0,0 +1,88 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/docmdi.h +// Purpose: Frame classes for MDI document/view applications +// Author: Julian Smart +// Created: 01/02/97 +// Copyright: (c) 1997 Julian Smart +// (c) 2010 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DOCMDI_H_ +#define _WX_DOCMDI_H_ + +#include "wx/defs.h" + +#if wxUSE_MDI_ARCHITECTURE + +#include "wx/docview.h" +#include "wx/mdi.h" + +// Define MDI versions of the doc-view frame classes. Note that we need to +// define them as classes for wxRTTI, otherwise we could simply define them as +// typedefs. + +// ---------------------------------------------------------------------------- +// An MDI document parent frame +// ---------------------------------------------------------------------------- + +typedef + wxDocParentFrameAny wxDocMDIParentFrameBase; + +class WXDLLIMPEXP_CORE wxDocMDIParentFrame : public wxDocMDIParentFrameBase +{ +public: + wxDocMDIParentFrame() : wxDocMDIParentFrameBase() { } + + wxDocMDIParentFrame(wxDocManager *manager, + wxFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + : wxDocMDIParentFrameBase(manager, + parent, id, title, pos, size, style, name) + { + } + +private: + wxDECLARE_CLASS(wxDocMDIParentFrame); + wxDECLARE_NO_COPY_CLASS(wxDocMDIParentFrame); +}; + +// ---------------------------------------------------------------------------- +// An MDI document child frame +// ---------------------------------------------------------------------------- + +typedef + wxDocChildFrameAny wxDocMDIChildFrameBase; + +class WXDLLIMPEXP_CORE wxDocMDIChildFrame : public wxDocMDIChildFrameBase +{ +public: + wxDocMDIChildFrame() { } + + wxDocMDIChildFrame(wxDocument *doc, + wxView *view, + wxMDIParentFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + : wxDocMDIChildFrameBase(doc, view, + parent, id, title, pos, size, style, name) + { + } + +private: + wxDECLARE_CLASS(wxDocMDIChildFrame); + wxDECLARE_NO_COPY_CLASS(wxDocMDIChildFrame); +}; + +#endif // wxUSE_MDI_ARCHITECTURE + +#endif // _WX_DOCMDI_H_ diff --git a/lib/wxWidgets/include/wx/docview.h b/lib/wxWidgets/include/wx/docview.h new file mode 100644 index 0000000..c969da7 --- /dev/null +++ b/lib/wxWidgets/include/wx/docview.h @@ -0,0 +1,1019 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/docview.h +// Purpose: Doc/View classes +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DOCH__ +#define _WX_DOCH__ + +#include "wx/defs.h" + +#if wxUSE_DOC_VIEW_ARCHITECTURE + +#include "wx/list.h" +#include "wx/dlist.h" +#include "wx/string.h" +#include "wx/frame.h" +#include "wx/filehistory.h" +#include "wx/vector.h" + +#if wxUSE_PRINTING_ARCHITECTURE + #include "wx/print.h" +#endif + +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxDocument; +class WXDLLIMPEXP_FWD_CORE wxView; +class WXDLLIMPEXP_FWD_CORE wxDocTemplate; +class WXDLLIMPEXP_FWD_CORE wxDocManager; +class WXDLLIMPEXP_FWD_CORE wxPrintInfo; +class WXDLLIMPEXP_FWD_CORE wxCommandProcessor; +class WXDLLIMPEXP_FWD_BASE wxConfigBase; + +class wxDocChildFrameAnyBase; + +#if wxUSE_STD_IOSTREAM + #include "wx/iosfwrap.h" +#else + #include "wx/stream.h" +#endif + +// Flags for wxDocManager (can be combined). +enum +{ + wxDOC_NEW = 1, + wxDOC_SILENT = 2 +}; + +// Document template flags +enum +{ + wxTEMPLATE_VISIBLE = 1, + wxTEMPLATE_INVISIBLE = 2, + wxDEFAULT_TEMPLATE_FLAGS = wxTEMPLATE_VISIBLE +}; + +#define wxMAX_FILE_HISTORY 9 + +typedef wxVector wxDocVector; +typedef wxVector wxViewVector; +typedef wxVector wxDocTemplateVector; + +class WXDLLIMPEXP_CORE wxDocument : public wxEvtHandler +{ +public: + wxDocument(wxDocument *parent = NULL); + virtual ~wxDocument(); + + // accessors + void SetFilename(const wxString& filename, bool notifyViews = false); + wxString GetFilename() const { return m_documentFile; } + + void SetTitle(const wxString& title) { m_documentTitle = title; } + wxString GetTitle() const { return m_documentTitle; } + + void SetDocumentName(const wxString& name) { m_documentTypeName = name; } + wxString GetDocumentName() const { return m_documentTypeName; } + + // access the flag indicating whether this document had been already saved, + // SetDocumentSaved() is only used internally, don't call it + bool GetDocumentSaved() const { return m_savedYet; } + void SetDocumentSaved(bool saved = true) { m_savedYet = saved; } + + // activate the first view of the document if any + void Activate(); + + // return true if the document hasn't been modified since the last time it + // was saved (implying that it returns false if it was never saved, even if + // the document is not modified) + bool AlreadySaved() const { return !IsModified() && GetDocumentSaved(); } + + virtual bool Close(); + virtual bool Save(); + virtual bool SaveAs(); + virtual bool Revert(); + +#if wxUSE_STD_IOSTREAM + virtual wxSTD ostream& SaveObject(wxSTD ostream& stream); + virtual wxSTD istream& LoadObject(wxSTD istream& stream); +#else + virtual wxOutputStream& SaveObject(wxOutputStream& stream); + virtual wxInputStream& LoadObject(wxInputStream& stream); +#endif + + // Called by wxWidgets + virtual bool OnSaveDocument(const wxString& filename); + virtual bool OnOpenDocument(const wxString& filename); + virtual bool OnNewDocument(); + virtual bool OnCloseDocument(); + + // Prompts for saving if about to close a modified document. Returns true + // if ok to close the document (may have saved in the meantime, or set + // modified to false) + virtual bool OnSaveModified(); + + // if you override, remember to call the default + // implementation (wxDocument::OnChangeFilename) + virtual void OnChangeFilename(bool notifyViews); + + // Called by framework if created automatically by the default document + // manager: gives document a chance to initialise and (usually) create a + // view + virtual bool OnCreate(const wxString& path, long flags); + + // By default, creates a base wxCommandProcessor. + virtual wxCommandProcessor *OnCreateCommandProcessor(); + virtual wxCommandProcessor *GetCommandProcessor() const + { return m_commandProcessor; } + virtual void SetCommandProcessor(wxCommandProcessor *proc) + { m_commandProcessor = proc; } + + // Called after a view is added or removed. The default implementation + // deletes the document if this is there are no more views. + virtual void OnChangedViewList(); + + // Called from OnCloseDocument(), does nothing by default but may be + // overridden. Return value is ignored. + virtual bool DeleteContents(); + + virtual bool Draw(wxDC&); + virtual bool IsModified() const { return m_documentModified; } + virtual void Modify(bool mod); + + virtual bool AddView(wxView *view); + virtual bool RemoveView(wxView *view); + + wxViewVector GetViewsVector() const; + + wxList& GetViews() { return m_documentViews; } + const wxList& GetViews() const { return m_documentViews; } + + wxView *GetFirstView() const; + + virtual void UpdateAllViews(wxView *sender = NULL, wxObject *hint = NULL); + virtual void NotifyClosing(); + + // Remove all views (because we're closing the document) + virtual bool DeleteAllViews(); + + // Other stuff + virtual wxDocManager *GetDocumentManager() const; + virtual wxDocTemplate *GetDocumentTemplate() const + { return m_documentTemplate; } + virtual void SetDocumentTemplate(wxDocTemplate *temp) + { m_documentTemplate = temp; } + + // Get the document name to be shown to the user: the title if there is + // any, otherwise the filename if the document was saved and, finally, + // "unnamed" otherwise + virtual wxString GetUserReadableName() const; + +#if WXWIN_COMPATIBILITY_2_8 + // use GetUserReadableName() instead + wxDEPRECATED_BUT_USED_INTERNALLY( + virtual bool GetPrintableName(wxString& buf) const + ); +#endif // WXWIN_COMPATIBILITY_2_8 + + // Returns a window that can be used as a parent for document-related + // dialogs. Override if necessary. + virtual wxWindow *GetDocumentWindow() const; + + // Returns true if this document is a child document corresponding to a + // part of the parent document and not a disk file as usual. + bool IsChildDocument() const { return m_documentParent != NULL; } + +protected: + wxList m_documentViews; + wxString m_documentFile; + wxString m_documentTitle; + wxString m_documentTypeName; + wxDocTemplate* m_documentTemplate; + bool m_documentModified; + + // if the document parent is non-NULL, it's a pseudo-document corresponding + // to a part of the parent document which can't be saved or loaded + // independently of its parent and is always closed when its parent is + wxDocument* m_documentParent; + + wxCommandProcessor* m_commandProcessor; + bool m_savedYet; + + // Called by OnSaveDocument and OnOpenDocument to implement standard + // Save/Load behaviour. Re-implement in derived class for custom + // behaviour. + virtual bool DoSaveDocument(const wxString& file); + virtual bool DoOpenDocument(const wxString& file); + + // the default implementation of GetUserReadableName() + wxString DoGetUserReadableName() const; + +private: + // list of all documents whose m_documentParent is this one + typedef wxDList DocsList; + DocsList m_childDocuments; + + wxDECLARE_ABSTRACT_CLASS(wxDocument); + wxDECLARE_NO_COPY_CLASS(wxDocument); +}; + +class WXDLLIMPEXP_CORE wxView: public wxEvtHandler +{ +public: + wxView(); + virtual ~wxView(); + + wxDocument *GetDocument() const { return m_viewDocument; } + virtual void SetDocument(wxDocument *doc); + + wxString GetViewName() const { return m_viewTypeName; } + void SetViewName(const wxString& name) { m_viewTypeName = name; } + + wxWindow *GetFrame() const { return m_viewFrame ; } + void SetFrame(wxWindow *frame) { m_viewFrame = frame; } + + virtual void OnActivateView(bool activate, + wxView *activeView, + wxView *deactiveView); + virtual void OnDraw(wxDC *dc) = 0; + virtual void OnPrint(wxDC *dc, wxObject *info); + virtual void OnUpdate(wxView *sender, wxObject *hint = NULL); + virtual void OnClosingDocument() {} + virtual void OnChangeFilename(); + + // Called by framework if created automatically by the default document + // manager class: gives view a chance to initialise + virtual bool OnCreate(wxDocument *WXUNUSED(doc), long WXUNUSED(flags)) + { return true; } + + // Checks if the view is the last one for the document; if so, asks user + // to confirm save data (if modified). If ok, deletes itself and returns + // true. + virtual bool Close(bool deleteWindow = true); + + // Override to do cleanup/veto close + virtual bool OnClose(bool deleteWindow); + + // A view's window can call this to notify the view it is (in)active. + // The function then notifies the document manager. + virtual void Activate(bool activate); + + wxDocManager *GetDocumentManager() const + { return m_viewDocument->GetDocumentManager(); } + +#if wxUSE_PRINTING_ARCHITECTURE + virtual wxPrintout *OnCreatePrintout(); +#endif + + // implementation only + // ------------------- + + // set the associated frame, it is used to reset its view when we're + // destroyed + void SetDocChildFrame(wxDocChildFrameAnyBase *docChildFrame); + + // get the associated frame, may be NULL during destruction + wxDocChildFrameAnyBase* GetDocChildFrame() const { return m_docChildFrame; } + +protected: + // hook the document into event handlers chain here + virtual bool TryBefore(wxEvent& event) wxOVERRIDE; + + wxDocument* m_viewDocument; + wxString m_viewTypeName; + wxWindow* m_viewFrame; + + wxDocChildFrameAnyBase *m_docChildFrame; + +private: + wxDECLARE_ABSTRACT_CLASS(wxView); + wxDECLARE_NO_COPY_CLASS(wxView); +}; + +// Represents user interface (and other) properties of documents and views +class WXDLLIMPEXP_CORE wxDocTemplate: public wxObject +{ + +friend class WXDLLIMPEXP_FWD_CORE wxDocManager; + +public: + // Associate document and view types. They're for identifying what view is + // associated with what template/document type + wxDocTemplate(wxDocManager *manager, + const wxString& descr, + const wxString& filter, + const wxString& dir, + const wxString& ext, + const wxString& docTypeName, + const wxString& viewTypeName, + wxClassInfo *docClassInfo = NULL, + wxClassInfo *viewClassInfo = NULL, + long flags = wxDEFAULT_TEMPLATE_FLAGS); + + virtual ~wxDocTemplate(); + + // By default, these two member functions dynamically creates document and + // view using dynamic instance construction. Override these if you need a + // different method of construction. + virtual wxDocument *CreateDocument(const wxString& path, long flags = 0); + virtual wxView *CreateView(wxDocument *doc, long flags = 0); + + // Helper method for CreateDocument; also allows you to do your own document + // creation + virtual bool InitDocument(wxDocument* doc, + const wxString& path, + long flags = 0); + + wxString GetDefaultExtension() const { return m_defaultExt; } + wxString GetDescription() const { return m_description; } + wxString GetDirectory() const { return m_directory; } + wxDocManager *GetDocumentManager() const { return m_documentManager; } + void SetDocumentManager(wxDocManager *manager) + { m_documentManager = manager; } + wxString GetFileFilter() const { return m_fileFilter; } + long GetFlags() const { return m_flags; } + virtual wxString GetViewName() const { return m_viewTypeName; } + virtual wxString GetDocumentName() const { return m_docTypeName; } + + void SetFileFilter(const wxString& filter) { m_fileFilter = filter; } + void SetDirectory(const wxString& dir) { m_directory = dir; } + void SetDescription(const wxString& descr) { m_description = descr; } + void SetDefaultExtension(const wxString& ext) { m_defaultExt = ext; } + void SetFlags(long flags) { m_flags = flags; } + + bool IsVisible() const { return (m_flags & wxTEMPLATE_VISIBLE) != 0; } + + wxClassInfo* GetDocClassInfo() const { return m_docClassInfo; } + wxClassInfo* GetViewClassInfo() const { return m_viewClassInfo; } + + virtual bool FileMatchesTemplate(const wxString& path); + +protected: + long m_flags; + wxString m_fileFilter; + wxString m_directory; + wxString m_description; + wxString m_defaultExt; + wxString m_docTypeName; + wxString m_viewTypeName; + wxDocManager* m_documentManager; + + // For dynamic creation of appropriate instances. + wxClassInfo* m_docClassInfo; + wxClassInfo* m_viewClassInfo; + + // Called by CreateDocument and CreateView to create the actual + // document/view object. + // + // By default uses the ClassInfo provided to the constructor. Override + // these functions to provide a different method of creation. + virtual wxDocument *DoCreateDocument(); + virtual wxView *DoCreateView(); + +private: + wxDECLARE_CLASS(wxDocTemplate); + wxDECLARE_NO_COPY_CLASS(wxDocTemplate); +}; + +// One object of this class may be created in an application, to manage all +// the templates and documents. +class WXDLLIMPEXP_CORE wxDocManager: public wxEvtHandler +{ +public: + // NB: flags are unused, don't pass wxDOC_XXX to this ctor + wxDocManager(long flags = 0, bool initialize = true); + virtual ~wxDocManager(); + + virtual bool Initialize(); + + // Handlers for common user commands + void OnFileClose(wxCommandEvent& event); + void OnFileCloseAll(wxCommandEvent& event); + void OnFileNew(wxCommandEvent& event); + void OnFileOpen(wxCommandEvent& event); + void OnFileRevert(wxCommandEvent& event); + void OnFileSave(wxCommandEvent& event); + void OnFileSaveAs(wxCommandEvent& event); + void OnMRUFile(wxCommandEvent& event); +#if wxUSE_PRINTING_ARCHITECTURE + void OnPrint(wxCommandEvent& event); + void OnPreview(wxCommandEvent& event); + void OnPageSetup(wxCommandEvent& event); +#endif // wxUSE_PRINTING_ARCHITECTURE + void OnUndo(wxCommandEvent& event); + void OnRedo(wxCommandEvent& event); + + // Handlers for UI update commands + void OnUpdateFileOpen(wxUpdateUIEvent& event); + void OnUpdateDisableIfNoDoc(wxUpdateUIEvent& event); + void OnUpdateFileRevert(wxUpdateUIEvent& event); + void OnUpdateFileNew(wxUpdateUIEvent& event); + void OnUpdateFileSave(wxUpdateUIEvent& event); + void OnUpdateFileSaveAs(wxUpdateUIEvent& event); + void OnUpdateUndo(wxUpdateUIEvent& event); + void OnUpdateRedo(wxUpdateUIEvent& event); + + // called when file format detection didn't work, can be overridden to do + // something in this case + virtual void OnOpenFileFailure() { } + + virtual wxDocument *CreateDocument(const wxString& path, long flags = 0); + + // wrapper around CreateDocument() with a more clear name + wxDocument *CreateNewDocument() + { return CreateDocument(wxString(), wxDOC_NEW); } + + virtual wxView *CreateView(wxDocument *doc, long flags = 0); + virtual void DeleteTemplate(wxDocTemplate *temp, long flags = 0); + virtual bool FlushDoc(wxDocument *doc); + virtual wxDocTemplate *MatchTemplate(const wxString& path); + virtual wxDocTemplate *SelectDocumentPath(wxDocTemplate **templates, + int noTemplates, wxString& path, long flags, bool save = false); + virtual wxDocTemplate *SelectDocumentType(wxDocTemplate **templates, + int noTemplates, bool sort = false); + virtual wxDocTemplate *SelectViewType(wxDocTemplate **templates, + int noTemplates, bool sort = false); + virtual wxDocTemplate *FindTemplateForPath(const wxString& path); + + void AssociateTemplate(wxDocTemplate *temp); + void DisassociateTemplate(wxDocTemplate *temp); + + // Find template from document class info, may return NULL. + wxDocTemplate* FindTemplate(const wxClassInfo* documentClassInfo); + + // Find document from file name, may return NULL. + wxDocument* FindDocumentByPath(const wxString& path) const; + + wxDocument *GetCurrentDocument() const; + + void SetMaxDocsOpen(int n) { m_maxDocsOpen = n; } + int GetMaxDocsOpen() const { return m_maxDocsOpen; } + + // Add and remove a document from the manager's list + void AddDocument(wxDocument *doc); + void RemoveDocument(wxDocument *doc); + + // closes all currently open documents + bool CloseDocuments(bool force = true); + + // closes the specified document + bool CloseDocument(wxDocument* doc, bool force = false); + + // Clear remaining documents and templates + bool Clear(bool force = true); + + // Views or windows should inform the document manager + // when a view is going in or out of focus + virtual void ActivateView(wxView *view, bool activate = true); + virtual wxView *GetCurrentView() const { return m_currentView; } + + // This method tries to find an active view harder than GetCurrentView(): + // if the latter is NULL, it also checks if we don't have just a single + // view and returns it then. + wxView *GetAnyUsableView() const; + + + wxDocVector GetDocumentsVector() const; + wxDocTemplateVector GetTemplatesVector() const; + + wxList& GetDocuments() { return m_docs; } + wxList& GetTemplates() { return m_templates; } + + // Return the default name for a new document (by default returns strings + // in the form "unnamed " but can be overridden) + virtual wxString MakeNewDocumentName(); + + // Make a frame title (override this to do something different) + virtual wxString MakeFrameTitle(wxDocument* doc); + + virtual wxFileHistory *OnCreateFileHistory(); + virtual wxFileHistory *GetFileHistory() const { return m_fileHistory; } + + // File history management + virtual void AddFileToHistory(const wxString& file); + virtual void RemoveFileFromHistory(size_t i); + virtual size_t GetHistoryFilesCount() const; + virtual wxString GetHistoryFile(size_t i) const; + virtual void FileHistoryUseMenu(wxMenu *menu); + virtual void FileHistoryRemoveMenu(wxMenu *menu); +#if wxUSE_CONFIG + virtual void FileHistoryLoad(const wxConfigBase& config); + virtual void FileHistorySave(wxConfigBase& config); +#endif // wxUSE_CONFIG + + virtual void FileHistoryAddFilesToMenu(); + virtual void FileHistoryAddFilesToMenu(wxMenu* menu); + + wxString GetLastDirectory() const; + void SetLastDirectory(const wxString& dir) { m_lastDirectory = dir; } + + // Get the current document manager + static wxDocManager* GetDocumentManager() { return sm_docManager; } + +#if wxUSE_PRINTING_ARCHITECTURE + wxPageSetupDialogData& GetPageSetupDialogData() + { return m_pageSetupDialogData; } + const wxPageSetupDialogData& GetPageSetupDialogData() const + { return m_pageSetupDialogData; } +#endif // wxUSE_PRINTING_ARCHITECTURE + +#if WXWIN_COMPATIBILITY_2_8 + // deprecated, override GetDefaultName() instead + wxDEPRECATED_BUT_USED_INTERNALLY( + virtual bool MakeDefaultName(wxString& buf) + ); +#endif + +protected: + // Called when a file selected from the MRU list doesn't exist any more. + // The default behaviour is to remove the file from the MRU and notify the + // user about it but this method can be overridden to customize it. + virtual void OnMRUFileNotExist(unsigned n, const wxString& filename); + + // Open the MRU file with the given index in our associated file history. + void DoOpenMRUFile(unsigned n); +#if wxUSE_PRINTING_ARCHITECTURE + virtual wxPreviewFrame* CreatePreviewFrame(wxPrintPreviewBase* preview, + wxWindow *parent, + const wxString& title); +#endif // wxUSE_PRINTING_ARCHITECTURE + + // hook the currently active view into event handlers chain here + virtual bool TryBefore(wxEvent& event) wxOVERRIDE; + + // return the command processor for the current document, if any + wxCommandProcessor *GetCurrentCommandProcessor() const; + + int m_defaultDocumentNameCounter; + int m_maxDocsOpen; + wxList m_docs; + wxList m_templates; + wxView* m_currentView; + wxFileHistory* m_fileHistory; + wxString m_lastDirectory; + static wxDocManager* sm_docManager; + +#if wxUSE_PRINTING_ARCHITECTURE + wxPageSetupDialogData m_pageSetupDialogData; +#endif // wxUSE_PRINTING_ARCHITECTURE + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxDocManager); + wxDECLARE_NO_COPY_CLASS(wxDocManager); +}; + +// ---------------------------------------------------------------------------- +// Base class for child frames -- this is what wxView renders itself into +// +// Notice that this is a mix-in class so it doesn't derive from wxWindow, only +// wxDocChildFrameAny does +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDocChildFrameAnyBase +{ +public: + // default ctor, use Create() after it + wxDocChildFrameAnyBase() + { + m_childDocument = NULL; + m_childView = NULL; + m_win = NULL; + m_lastEvent = NULL; + } + + // full ctor equivalent to using the default one and Create() + wxDocChildFrameAnyBase(wxDocument *doc, wxView *view, wxWindow *win) + { + Create(doc, view, win); + } + + // method which must be called for an object created using the default ctor + // + // note that it returns bool just for consistency with Create() methods in + // other classes, we never return false from here + bool Create(wxDocument *doc, wxView *view, wxWindow *win) + { + m_childDocument = doc; + m_childView = view; + m_win = win; + + if ( view ) + view->SetDocChildFrame(this); + + return true; + } + + // dtor doesn't need to be virtual, an object should never be destroyed via + // a pointer to this class + ~wxDocChildFrameAnyBase() + { + // prevent the view from deleting us if we're being deleted directly + // (and not via Close() + Destroy()) + if ( m_childView ) + m_childView->SetDocChildFrame(NULL); + } + + wxDocument *GetDocument() const { return m_childDocument; } + wxView *GetView() const { return m_childView; } + void SetDocument(wxDocument *doc) { m_childDocument = doc; } + void SetView(wxView *view) { m_childView = view; } + + wxWindow *GetWindow() const { return m_win; } + + // implementation only + + // Check if this event had been just processed in this frame. + bool HasAlreadyProcessed(wxEvent& event) const + { + return m_lastEvent == &event; + } + +protected: + // we're not a wxEvtHandler but we provide this wxEvtHandler-like function + // which is called from TryBefore() of the derived classes to give our view + // a chance to process the message before the frame event handlers are used + bool TryProcessEvent(wxEvent& event); + + // called from EVT_CLOSE handler in the frame: check if we can close and do + // cleanup if so; veto the event otherwise + bool CloseView(wxCloseEvent& event); + + + wxDocument* m_childDocument; + wxView* m_childView; + + // the associated window: having it here is not terribly elegant but it + // allows us to avoid having any virtual functions in this class + wxWindow* m_win; + +private: + // Pointer to the last processed event used to avoid sending the same event + // twice to wxDocManager, from here and from wxDocParentFrameAnyBase. + wxEvent* m_lastEvent; + + wxDECLARE_NO_COPY_CLASS(wxDocChildFrameAnyBase); +}; + +// ---------------------------------------------------------------------------- +// Template implementing child frame concept using the given wxFrame-like class +// +// This is used to define wxDocChildFrame and wxDocMDIChildFrame: ChildFrame is +// a wxFrame or wxMDIChildFrame (although in theory it could be any wxWindow- +// derived class as long as it provided a ctor with the same signature as +// wxFrame and OnActivate() method) and ParentFrame is either wxFrame or +// wxMDIParentFrame. +// ---------------------------------------------------------------------------- + +// Note that we intentionally do not use WXDLLIMPEXP_CORE for this class as it +// has only inline methods. + +template +class wxDocChildFrameAny : public ChildFrame, + public wxDocChildFrameAnyBase +{ +public: + typedef ChildFrame BaseClass; + + // default ctor, use Create after it + wxDocChildFrameAny() { } + + // ctor for a frame showing the given view of the specified document + wxDocChildFrameAny(wxDocument *doc, + wxView *view, + ParentFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Create(doc, view, parent, id, title, pos, size, style, name); + } + + bool Create(wxDocument *doc, + wxView *view, + ParentFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + if ( !wxDocChildFrameAnyBase::Create(doc, view, this) ) + return false; + + if ( !BaseClass::Create(parent, id, title, pos, size, style, name) ) + return false; + + this->Bind(wxEVT_ACTIVATE, &wxDocChildFrameAny::OnActivate, this); + this->Bind(wxEVT_CLOSE_WINDOW, &wxDocChildFrameAny::OnCloseWindow, this); + + return true; + } + +protected: + // hook the child view into event handlers chain here + virtual bool TryBefore(wxEvent& event) wxOVERRIDE + { + return TryProcessEvent(event) || BaseClass::TryBefore(event); + } + +private: + void OnActivate(wxActivateEvent& event) + { + BaseClass::OnActivate(event); + + if ( m_childView ) + m_childView->Activate(event.GetActive()); + } + + void OnCloseWindow(wxCloseEvent& event) + { + if ( CloseView(event) ) + this->Destroy(); + //else: vetoed + } + + wxDECLARE_NO_COPY_TEMPLATE_CLASS_2(wxDocChildFrameAny, + ChildFrame, ParentFrame); +}; + +// ---------------------------------------------------------------------------- +// A default child frame: we need to define it as a class just for wxRTTI, +// otherwise we could simply typedef it +// ---------------------------------------------------------------------------- + +typedef wxDocChildFrameAny wxDocChildFrameBase; + +class WXDLLIMPEXP_CORE wxDocChildFrame : public wxDocChildFrameBase +{ +public: + wxDocChildFrame() + { + } + + wxDocChildFrame(wxDocument *doc, + wxView *view, + wxFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + : wxDocChildFrameBase(doc, view, + parent, id, title, pos, size, style, name) + { + } + + bool Create(wxDocument *doc, + wxView *view, + wxFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + return wxDocChildFrameBase::Create + ( + doc, view, + parent, id, title, pos, size, style, name + ); + } + +private: + wxDECLARE_CLASS(wxDocChildFrame); + wxDECLARE_NO_COPY_CLASS(wxDocChildFrame); +}; + +// ---------------------------------------------------------------------------- +// wxDocParentFrame and related classes. +// +// As with wxDocChildFrame we define a template base class used by both normal +// and MDI versions +// ---------------------------------------------------------------------------- + +// Base class containing type-independent code of wxDocParentFrameAny +// +// Similarly to wxDocChildFrameAnyBase, this class is a mix-in and doesn't +// derive from wxWindow. +class WXDLLIMPEXP_CORE wxDocParentFrameAnyBase +{ +public: + wxDocParentFrameAnyBase(wxWindow* frame) + : m_frame(frame) + { + m_docManager = NULL; + } + + wxDocManager *GetDocumentManager() const { return m_docManager; } + +protected: + // This is similar to wxDocChildFrameAnyBase method with the same name: + // while we're not an event handler ourselves and so can't override + // TryBefore(), we provide a helper that the derived template class can use + // from its TryBefore() implementation. + bool TryProcessEvent(wxEvent& event); + + wxWindow* const m_frame; + wxDocManager *m_docManager; + + wxDECLARE_NO_COPY_CLASS(wxDocParentFrameAnyBase); +}; + +// This is similar to wxDocChildFrameAny and is used to provide common +// implementation for both wxDocParentFrame and wxDocMDIParentFrame +template +class wxDocParentFrameAny : public BaseFrame, + public wxDocParentFrameAnyBase +{ +public: + wxDocParentFrameAny() : wxDocParentFrameAnyBase(this) { } + wxDocParentFrameAny(wxDocManager *manager, + wxFrame *frame, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + : wxDocParentFrameAnyBase(this) + { + Create(manager, frame, id, title, pos, size, style, name); + } + + bool Create(wxDocManager *manager, + wxFrame *frame, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + m_docManager = manager; + + if ( !BaseFrame::Create(frame, id, title, pos, size, style, name) ) + return false; + + this->Bind(wxEVT_MENU, &wxDocParentFrameAny::OnExit, this, wxID_EXIT); + this->Bind(wxEVT_CLOSE_WINDOW, &wxDocParentFrameAny::OnCloseWindow, this); + + return true; + } + +protected: + // hook the document manager into event handling chain here + virtual bool TryBefore(wxEvent& event) wxOVERRIDE + { + // It is important to send the event to the base class first as + // wxMDIParentFrame overrides its TryBefore() to send the menu events + // to the currently active child frame and the child must get them + // before our own TryProcessEvent() is executed, not afterwards. + return BaseFrame::TryBefore(event) || TryProcessEvent(event); + } + +private: + void OnExit(wxCommandEvent& WXUNUSED(event)) + { + this->Close(); + } + + void OnCloseWindow(wxCloseEvent& event) + { + if ( m_docManager && !m_docManager->Clear(!event.CanVeto()) ) + { + // The user decided not to close finally, abort. + event.Veto(); + } + else + { + // Just skip the event, base class handler will destroy the window. + event.Skip(); + } + } + + + wxDECLARE_NO_COPY_CLASS(wxDocParentFrameAny); +}; + +typedef wxDocParentFrameAny wxDocParentFrameBase; + +class WXDLLIMPEXP_CORE wxDocParentFrame : public wxDocParentFrameBase +{ +public: + wxDocParentFrame() : wxDocParentFrameBase() { } + + wxDocParentFrame(wxDocManager *manager, + wxFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + : wxDocParentFrameBase(manager, + parent, id, title, pos, size, style, name) + { + } + + bool Create(wxDocManager *manager, + wxFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + return wxDocParentFrameBase::Create(manager, + parent, id, title, + pos, size, style, name); + } + +private: + wxDECLARE_CLASS(wxDocParentFrame); + wxDECLARE_NO_COPY_CLASS(wxDocParentFrame); +}; + +// ---------------------------------------------------------------------------- +// Provide simple default printing facilities +// ---------------------------------------------------------------------------- + +#if wxUSE_PRINTING_ARCHITECTURE +class WXDLLIMPEXP_CORE wxDocPrintout : public wxPrintout +{ +public: + wxDocPrintout(wxView *view = NULL, const wxString& title = wxString()); + + // implement wxPrintout methods + virtual bool OnPrintPage(int page) wxOVERRIDE; + virtual bool HasPage(int page) wxOVERRIDE; + virtual bool OnBeginDocument(int startPage, int endPage) wxOVERRIDE; + virtual void GetPageInfo(int *minPage, int *maxPage, + int *selPageFrom, int *selPageTo) wxOVERRIDE; + + virtual wxView *GetView() { return m_printoutView; } + +protected: + wxView* m_printoutView; + +private: + wxDECLARE_DYNAMIC_CLASS(wxDocPrintout); + wxDECLARE_NO_COPY_CLASS(wxDocPrintout); +}; +#endif // wxUSE_PRINTING_ARCHITECTURE + +// For compatibility with existing file formats: +// converts from/to a stream to/from a temporary file. +#if wxUSE_STD_IOSTREAM +bool WXDLLIMPEXP_CORE +wxTransferFileToStream(const wxString& filename, wxSTD ostream& stream); +bool WXDLLIMPEXP_CORE +wxTransferStreamToFile(wxSTD istream& stream, const wxString& filename); +#else +bool WXDLLIMPEXP_CORE +wxTransferFileToStream(const wxString& filename, wxOutputStream& stream); +bool WXDLLIMPEXP_CORE +wxTransferStreamToFile(wxInputStream& stream, const wxString& filename); +#endif // wxUSE_STD_IOSTREAM + + +// these flags are not used anywhere by wxWidgets and kept only for an unlikely +// case of existing user code using them for its own purposes +#if WXWIN_COMPATIBILITY_2_8 +enum +{ + wxDOC_SDI = 1, + wxDOC_MDI, + wxDEFAULT_DOCMAN_FLAGS = wxDOC_SDI +}; +#endif // WXWIN_COMPATIBILITY_2_8 + +inline wxViewVector wxDocument::GetViewsVector() const +{ + return m_documentViews.AsVector(); +} + +inline wxDocVector wxDocManager::GetDocumentsVector() const +{ + return m_docs.AsVector(); +} + +inline wxDocTemplateVector wxDocManager::GetTemplatesVector() const +{ + return m_templates.AsVector(); +} + +#endif // wxUSE_DOC_VIEW_ARCHITECTURE + +#endif // _WX_DOCH__ diff --git a/lib/wxWidgets/include/wx/dragimag.h b/lib/wxWidgets/include/wx/dragimag.h new file mode 100644 index 0000000..4f8bc6a --- /dev/null +++ b/lib/wxWidgets/include/wx/dragimag.h @@ -0,0 +1,53 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dragimag.h +// Purpose: wxDragImage base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DRAGIMAG_H_BASE_ +#define _WX_DRAGIMAG_H_BASE_ + +#if wxUSE_DRAGIMAGE + +class WXDLLIMPEXP_FWD_CORE wxRect; +class WXDLLIMPEXP_FWD_CORE wxMemoryDC; +class WXDLLIMPEXP_FWD_CORE wxDC; + +#if defined(__WXMSW__) +# if defined(__WXUNIVERSAL__) +# include "wx/generic/dragimgg.h" +# define wxDragImage wxGenericDragImage +# else +# include "wx/msw/dragimag.h" +# endif + +#elif defined(__WXMOTIF__) +# include "wx/generic/dragimgg.h" +# define wxDragImage wxGenericDragImage + +#elif defined(__WXGTK__) +# include "wx/generic/dragimgg.h" +# define wxDragImage wxGenericDragImage + +#elif defined(__WXX11__) +# include "wx/generic/dragimgg.h" +# define wxDragImage wxGenericDragImage + +#elif defined(__WXMAC__) +# include "wx/generic/dragimgg.h" +# define wxDragImage wxGenericDragImage + +#elif defined(__WXQT__) +# include "wx/generic/dragimgg.h" +# define wxDragImage wxGenericDragImage + +#endif + +#endif // wxUSE_DRAGIMAGE + +#endif + // _WX_DRAGIMAG_H_BASE_ diff --git a/lib/wxWidgets/include/wx/dvrenderers.h b/lib/wxWidgets/include/wx/dvrenderers.h new file mode 100644 index 0000000..f1b3fc1 --- /dev/null +++ b/lib/wxWidgets/include/wx/dvrenderers.h @@ -0,0 +1,618 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/dvrenderers.h +// Purpose: Declare all wxDataViewCtrl classes +// Author: Robert Roebling, Vadim Zeitlin +// Created: 2009-11-08 (extracted from wx/dataview.h) +// Copyright: (c) 2006 Robert Roebling +// (c) 2009 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DVRENDERERS_H_ +#define _WX_DVRENDERERS_H_ + +/* + Note about the structure of various headers: they're organized in a more + complicated way than usual because of the various dependencies which are + different for different ports. In any case the only public header, i.e. the + one which can be included directly is wx/dataview.h. It, in turn, includes + this one to define all the renderer classes. + + We define the base wxDataViewRendererBase class first and then include a + port-dependent wx/xxx/dvrenderer.h which defines wxDataViewRenderer itself. + After this we can define wxDataViewRendererCustomBase (and maybe in the + future base classes for other renderers if the need arises, i.e. if there + is any non-trivial code or API which it makes sense to keep in common code) + and include wx/xxx/dvrenderers.h (notice the plural) which defines all the + rest of the renderer classes. + */ + +class WXDLLIMPEXP_FWD_CORE wxDataViewCustomRenderer; + +// ---------------------------------------------------------------------------- +// wxDataViewIconText: helper class used by wxDataViewIconTextRenderer +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataViewIconText : public wxObject +{ +public: + wxDataViewIconText( const wxString &text = wxEmptyString, + const wxBitmapBundle& bitmap = wxBitmapBundle() ) + : m_text(text), + m_bitmap(bitmap) + { } + + void SetText( const wxString &text ) { m_text = text; } + wxString GetText() const { return m_text; } + + void SetBitmapBundle(const wxBitmapBundle& bitmap) { m_bitmap = bitmap; } + const wxBitmapBundle& GetBitmapBundle() const { return m_bitmap; } + + // These methods exist for compatibility, prefer using the methods above. + void SetIcon( const wxIcon &icon ) { m_bitmap = wxBitmapBundle(icon); } + wxIcon GetIcon() const { return m_bitmap.GetIcon(wxDefaultSize); } + + bool IsSameAs(const wxDataViewIconText& other) const + { + return m_text == other.m_text && m_bitmap.IsSameAs(other.m_bitmap); + } + + bool operator==(const wxDataViewIconText& other) const + { + return IsSameAs(other); + } + + bool operator!=(const wxDataViewIconText& other) const + { + return !IsSameAs(other); + } + +private: + wxString m_text; + wxBitmapBundle m_bitmap; + + wxDECLARE_DYNAMIC_CLASS(wxDataViewIconText); +}; + +DECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewIconText, WXDLLIMPEXP_CORE) + +// ---------------------------------------------------------------------------- +// wxDataViewCheckIconText: value class used by wxDataViewCheckIconTextRenderer +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataViewCheckIconText : public wxDataViewIconText +{ +public: + wxDataViewCheckIconText(const wxString& text = wxString(), + const wxBitmapBundle& icon = wxBitmapBundle(), + wxCheckBoxState checkedState = wxCHK_UNDETERMINED) + : wxDataViewIconText(text, icon), + m_checkedState(checkedState) + { + } + + wxCheckBoxState GetCheckedState() const { return m_checkedState; } + void SetCheckedState(wxCheckBoxState state) { m_checkedState = state; } + +private: + wxCheckBoxState m_checkedState; + + wxDECLARE_DYNAMIC_CLASS(wxDataViewCheckIconText); +}; + +DECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewCheckIconText, WXDLLIMPEXP_CORE) + +// ---------------------------------------------------------------------------- +// wxDataViewRendererBase +// ---------------------------------------------------------------------------- + +enum wxDataViewCellMode +{ + wxDATAVIEW_CELL_INERT, + wxDATAVIEW_CELL_ACTIVATABLE, + wxDATAVIEW_CELL_EDITABLE +}; + +enum wxDataViewCellRenderState +{ + wxDATAVIEW_CELL_SELECTED = 1, + wxDATAVIEW_CELL_PRELIT = 2, + wxDATAVIEW_CELL_INSENSITIVE = 4, + wxDATAVIEW_CELL_FOCUSED = 8 +}; + +// helper for fine-tuning rendering of values depending on row's state +class WXDLLIMPEXP_CORE wxDataViewValueAdjuster +{ +public: + virtual ~wxDataViewValueAdjuster() {} + + // changes the value to have appearance suitable for highlighted rows + virtual wxVariant MakeHighlighted(const wxVariant& value) const { return value; } +}; + +class WXDLLIMPEXP_CORE wxDataViewRendererBase: public wxObject +{ +public: + wxDataViewRendererBase( const wxString &varianttype, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int alignment = wxDVR_DEFAULT_ALIGNMENT ); + virtual ~wxDataViewRendererBase(); + + virtual bool Validate( wxVariant& WXUNUSED(value) ) + { return true; } + + void SetOwner( wxDataViewColumn *owner ) { m_owner = owner; } + wxDataViewColumn* GetOwner() const { return m_owner; } + + // renderer value and attributes: SetValue() and SetAttr() are called + // before a cell is rendered using this renderer + virtual bool SetValue(const wxVariant& value) = 0; + virtual bool GetValue(wxVariant& value) const = 0; +#if wxUSE_ACCESSIBILITY + virtual wxString GetAccessibleDescription() const = 0; +#endif // wxUSE_ACCESSIBILITY + + wxString GetVariantType() const { return m_variantType; } + + // Check if the given variant type is compatible with the type expected by + // this renderer: by default, just compare it with GetVariantType(), but + // can be overridden to accept other types that can be converted to the + // type needed by the renderer. + virtual bool IsCompatibleVariantType(const wxString& variantType) const + { + return variantType == GetVariantType(); + } + + // Prepare for rendering the value of the corresponding item in the given + // column taken from the provided non-null model. + // + // Notice that the column must be the same as GetOwner()->GetModelColumn(), + // it is only passed to this method because the existing code already has + // it and should probably be removed in the future. + // + // Return true if this cell is non-empty or false otherwise (and also if + // the model returned a value of the wrong type, i.e. such that our + // IsCompatibleVariantType() returned false for it, in which case a debug + // error is also logged). + bool PrepareForItem(const wxDataViewModel *model, + const wxDataViewItem& item, + unsigned column); + + // renderer properties: + virtual void SetMode( wxDataViewCellMode mode ) = 0; + virtual wxDataViewCellMode GetMode() const = 0; + + // NOTE: Set/GetAlignment do not take/return a wxAlignment enum but + // rather an "int"; that's because for rendering cells it's allowed + // to combine alignment flags (e.g. wxALIGN_LEFT|wxALIGN_BOTTOM) + virtual void SetAlignment( int align ) = 0; + virtual int GetAlignment() const = 0; + + // enable or disable (if called with wxELLIPSIZE_NONE) replacing parts of + // the item text (hence this only makes sense for renderers showing + // text...) with ellipsis in order to make it fit the column width + virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE) = 0; + void DisableEllipsize() { EnableEllipsize(wxELLIPSIZE_NONE); } + + virtual wxEllipsizeMode GetEllipsizeMode() const = 0; + + // in-place editing + virtual bool HasEditorCtrl() const + { return false; } + virtual wxWindow* CreateEditorCtrl(wxWindow * WXUNUSED(parent), + wxRect WXUNUSED(labelRect), + const wxVariant& WXUNUSED(value)) + { return NULL; } + virtual bool GetValueFromEditorCtrl(wxWindow * WXUNUSED(editor), + wxVariant& WXUNUSED(value)) + { return false; } + + virtual bool StartEditing( const wxDataViewItem &item, wxRect labelRect ); + virtual void CancelEditing(); + virtual bool FinishEditing(); + + wxWindow *GetEditorCtrl() const { return m_editorCtrl; } + + virtual bool IsCustomRenderer() const { return false; } + + + // Implementation only from now on. + + // Return the alignment of this renderer if it's specified (i.e. has value + // different from the default wxDVR_DEFAULT_ALIGNMENT) or the alignment of + // the column it is used for otherwise. + // + // Unlike GetAlignment(), this always returns a valid combination of + // wxALIGN_XXX flags (although possibly wxALIGN_NOT) and never returns + // wxDVR_DEFAULT_ALIGNMENT. + int GetEffectiveAlignment() const; + + // Like GetEffectiveAlignment(), but returns wxDVR_DEFAULT_ALIGNMENT if + // the owner isn't set and GetAlignment() is default. + int GetEffectiveAlignmentIfKnown() const; + + // Send wxEVT_DATAVIEW_ITEM_EDITING_STARTED event. + void NotifyEditingStarted(const wxDataViewItem& item); + + // Sets the transformer for fine-tuning rendering of values depending on row's state + void SetValueAdjuster(wxDataViewValueAdjuster *transformer) + { delete m_valueAdjuster; m_valueAdjuster = transformer; } + +protected: + // These methods are called from PrepareForItem() and should do whatever is + // needed for the current platform to ensure that the item is rendered + // using the given attributes and enabled/disabled state. + virtual void SetAttr(const wxDataViewItemAttr& attr) = 0; + virtual void SetEnabled(bool enabled) = 0; + + // Return whether the currently rendered item is on a highlighted row + // (typically selection with dark background). For internal use only. + virtual bool IsHighlighted() const = 0; + + // Helper of PrepareForItem() also used in StartEditing(): returns the + // value checking that its type matches our GetVariantType(). + wxVariant CheckedGetValue(const wxDataViewModel* model, + const wxDataViewItem& item, + unsigned column) const; + + // Validates the given value (if it is non-null) and sends (in any case) + // ITEM_EDITING_DONE event and, finally, updates the model with the value + // (f it is valid, of course) if the event wasn't vetoed. + bool DoHandleEditingDone(wxVariant* value); + + + wxString m_variantType; + wxDataViewColumn *m_owner; + wxWeakRef m_editorCtrl; + wxDataViewItem m_item; // Item being currently edited, if valid. + + wxDataViewValueAdjuster *m_valueAdjuster; + + // internal utility, may be used anywhere the window associated with the + // renderer is required + wxDataViewCtrl* GetView() const; + +private: + // Called from {Called,Finish}Editing() and dtor to cleanup m_editorCtrl + void DestroyEditControl(); + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase); +}; + +// include the real wxDataViewRenderer declaration for the native ports +#ifdef wxHAS_GENERIC_DATAVIEWCTRL + // in the generic implementation there is no real wxDataViewRenderer, all + // renderers are custom so it's the same as wxDataViewCustomRenderer and + // wxDataViewCustomRendererBase derives from wxDataViewRendererBase directly + // + // this is a rather ugly hack but unfortunately it just doesn't seem to be + // possible to have the same class hierarchy in all ports and avoid + // duplicating the entire wxDataViewCustomRendererBase in the generic + // wxDataViewRenderer class (well, we could use a mix-in but this would + // make classes hierarchy non linear and arguably even more complex) + #define wxDataViewCustomRendererRealBase wxDataViewRendererBase +#else + #if defined(__WXGTK20__) + #include "wx/gtk/dvrenderer.h" + #elif defined(__WXMAC__) + #include "wx/osx/dvrenderer.h" + #elif defined(__WXQT__) + #include "wx/qt/dvrenderer.h" + #else + #error "unknown native wxDataViewCtrl implementation" + #endif + #define wxDataViewCustomRendererRealBase wxDataViewRenderer +#endif + +// ---------------------------------------------------------------------------- +// wxDataViewCustomRendererBase +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataViewCustomRendererBase + : public wxDataViewCustomRendererRealBase +{ +public: + // Constructor must specify the usual renderer parameters which we simply + // pass to the base class + wxDataViewCustomRendererBase(const wxString& varianttype = wxASCII_STR("string"), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT) + : wxDataViewCustomRendererRealBase(varianttype, mode, align) + { + } + + + // Render the item using the current value (returned by GetValue()). + virtual bool Render(wxRect cell, wxDC *dc, int state) = 0; + + // Return the size of the item appropriate to its current value. + virtual wxSize GetSize() const = 0; + + // Define virtual function which are called when a key is pressed on the + // item, clicked or the user starts to drag it: by default they all simply + // return false indicating that the events are not handled + + virtual bool ActivateCell(const wxRect& cell, + wxDataViewModel *model, + const wxDataViewItem & item, + unsigned int col, + const wxMouseEvent* mouseEvent); + + // Deprecated, use (and override) ActivateCell() instead + wxDEPRECATED_BUT_USED_INTERNALLY_INLINE( + virtual bool Activate(wxRect WXUNUSED(cell), + wxDataViewModel *WXUNUSED(model), + const wxDataViewItem & WXUNUSED(item), + unsigned int WXUNUSED(col)), + return false; ) + + // Deprecated, use (and override) ActivateCell() instead + wxDEPRECATED_BUT_USED_INTERNALLY_INLINE( + virtual bool LeftClick(wxPoint WXUNUSED(cursor), + wxRect WXUNUSED(cell), + wxDataViewModel *WXUNUSED(model), + const wxDataViewItem & WXUNUSED(item), + unsigned int WXUNUSED(col)), + return false; ) + + virtual bool StartDrag(const wxPoint& WXUNUSED(cursor), + const wxRect& WXUNUSED(cell), + wxDataViewModel *WXUNUSED(model), + const wxDataViewItem & WXUNUSED(item), + unsigned int WXUNUSED(col) ) + { return false; } + + + // Helper which can be used by Render() implementation in the derived + // classes: it will draw the text in the same manner as the standard + // renderers do. + virtual void RenderText(const wxString& text, + int xoffset, + wxRect cell, + wxDC *dc, + int state); + + + // Override the base class virtual method to simply store the attribute so + // that it can be accessed using GetAttr() from Render() if needed. + virtual void SetAttr(const wxDataViewItemAttr& attr) wxOVERRIDE { m_attr = attr; } + const wxDataViewItemAttr& GetAttr() const { return m_attr; } + + // Store the enabled state of the item so that it can be accessed from + // Render() via GetEnabled() if needed. + virtual void SetEnabled(bool enabled) wxOVERRIDE; + bool GetEnabled() const { return m_enabled; } + + + // Implementation only from now on + + // Retrieve the DC to use for drawing. This is implemented in derived + // platform-specific classes. + virtual wxDC *GetDC() = 0; + + // To draw background use the background colour in wxDataViewItemAttr + virtual void RenderBackground(wxDC* dc, const wxRect& rect); + + // Prepare DC to use attributes and call Render(). + void WXCallRender(wxRect rect, wxDC *dc, int state); + + virtual bool IsCustomRenderer() const wxOVERRIDE { return true; } + +protected: + // helper for GetSize() implementations, respects attributes + wxSize GetTextExtent(const wxString& str) const; + +private: + wxDataViewItemAttr m_attr; + bool m_enabled; + + wxDECLARE_NO_COPY_CLASS(wxDataViewCustomRendererBase); +}; + +// include the declaration of all the other renderers to get the real +// wxDataViewCustomRenderer from which we need to inherit below +#ifdef wxHAS_GENERIC_DATAVIEWCTRL + // because of the different renderer classes hierarchy in the generic + // version, as explained above, we can include the header defining + // wxDataViewRenderer only here and not before wxDataViewCustomRendererBase + // declaration as for the native ports + #include "wx/generic/dvrenderer.h" + #include "wx/generic/dvrenderers.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/dvrenderers.h" +#elif defined(__WXMAC__) + #include "wx/osx/dvrenderers.h" +#elif defined(__WXQT__) + #include "wx/qt/dvrenderers.h" +#else + #error "unknown native wxDataViewCtrl implementation" +#endif + +#if wxUSE_SPINCTRL + +// ---------------------------------------------------------------------------- +// wxDataViewSpinRenderer +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataViewSpinRenderer: public wxDataViewCustomRenderer +{ +public: + wxDataViewSpinRenderer( int min, int max, + wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, + int alignment = wxDVR_DEFAULT_ALIGNMENT ); + virtual bool HasEditorCtrl() const wxOVERRIDE { return true; } + virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ) wxOVERRIDE; + virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value ) wxOVERRIDE; + virtual bool Render( wxRect rect, wxDC *dc, int state ) wxOVERRIDE; + virtual wxSize GetSize() const wxOVERRIDE; + virtual bool SetValue( const wxVariant &value ) wxOVERRIDE; + virtual bool GetValue( wxVariant &value ) const wxOVERRIDE; +#if wxUSE_ACCESSIBILITY + virtual wxString GetAccessibleDescription() const wxOVERRIDE; +#endif // wxUSE_ACCESSIBILITY + +private: + long m_data; + long m_min,m_max; +}; + +#endif // wxUSE_SPINCTRL + +#if defined(wxHAS_GENERIC_DATAVIEWCTRL) + +// ---------------------------------------------------------------------------- +// wxDataViewChoiceRenderer +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataViewChoiceRenderer: public wxDataViewCustomRenderer +{ +public: + wxDataViewChoiceRenderer( const wxArrayString &choices, + wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, + int alignment = wxDVR_DEFAULT_ALIGNMENT ); + virtual bool HasEditorCtrl() const wxOVERRIDE { return true; } + virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ) wxOVERRIDE; + virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value ) wxOVERRIDE; + virtual bool Render( wxRect rect, wxDC *dc, int state ) wxOVERRIDE; + virtual wxSize GetSize() const wxOVERRIDE; + virtual bool SetValue( const wxVariant &value ) wxOVERRIDE; + virtual bool GetValue( wxVariant &value ) const wxOVERRIDE; +#if wxUSE_ACCESSIBILITY + virtual wxString GetAccessibleDescription() const wxOVERRIDE; +#endif // wxUSE_ACCESSIBILITY + + wxString GetChoice(size_t index) const { return m_choices[index]; } + const wxArrayString& GetChoices() const { return m_choices; } + +private: + wxArrayString m_choices; + wxString m_data; +}; + +// ---------------------------------------------------------------------------- +// wxDataViewChoiceByIndexRenderer +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataViewChoiceByIndexRenderer: public wxDataViewChoiceRenderer +{ +public: + wxDataViewChoiceByIndexRenderer( const wxArrayString &choices, + wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, + int alignment = wxDVR_DEFAULT_ALIGNMENT ); + + virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ) wxOVERRIDE; + virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value ) wxOVERRIDE; + + virtual bool SetValue( const wxVariant &value ) wxOVERRIDE; + virtual bool GetValue( wxVariant &value ) const wxOVERRIDE; +#if wxUSE_ACCESSIBILITY + virtual wxString GetAccessibleDescription() const wxOVERRIDE; +#endif // wxUSE_ACCESSIBILITY +}; + + +#endif // generic version + +#if defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(__WXGTK__) + +// ---------------------------------------------------------------------------- +// wxDataViewDateRenderer +// ---------------------------------------------------------------------------- + +#if wxUSE_DATEPICKCTRL +class WXDLLIMPEXP_CORE wxDataViewDateRenderer: public wxDataViewCustomRenderer +{ +public: + static wxString GetDefaultType() { return wxS("datetime"); } + + wxDataViewDateRenderer(const wxString &varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, + int align = wxDVR_DEFAULT_ALIGNMENT); + + virtual bool HasEditorCtrl() const wxOVERRIDE { return true; } + virtual wxWindow *CreateEditorCtrl(wxWindow *parent, wxRect labelRect, const wxVariant &value) wxOVERRIDE; + virtual bool GetValueFromEditorCtrl(wxWindow* editor, wxVariant &value) wxOVERRIDE; + virtual bool SetValue(const wxVariant &value) wxOVERRIDE; + virtual bool GetValue(wxVariant& value) const wxOVERRIDE; +#if wxUSE_ACCESSIBILITY + virtual wxString GetAccessibleDescription() const wxOVERRIDE; +#endif // wxUSE_ACCESSIBILITY + virtual bool Render( wxRect cell, wxDC *dc, int state ) wxOVERRIDE; + virtual wxSize GetSize() const wxOVERRIDE; + +private: + wxString FormatDate() const; + + wxDateTime m_date; +}; +#else // !wxUSE_DATEPICKCTRL +typedef wxDataViewTextRenderer wxDataViewDateRenderer; +#endif + +#endif // generic or GTK+ versions + +// ---------------------------------------------------------------------------- +// wxDataViewCheckIconTextRenderer: 3-state checkbox + text + optional icon +// ---------------------------------------------------------------------------- + +#if defined(wxHAS_GENERIC_DATAVIEWCTRL) || !defined(__WXOSX__) + +class WXDLLIMPEXP_CORE wxDataViewCheckIconTextRenderer + : public wxDataViewCustomRenderer +{ +public: + static wxString GetDefaultType() { return wxS("wxDataViewCheckIconText"); } + + explicit wxDataViewCheckIconTextRenderer + ( + wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, + int align = wxDVR_DEFAULT_ALIGNMENT + ); + + // This renderer can always display the 3rd ("indeterminate") checkbox + // state if the model contains cells with wxCHK_UNDETERMINED value, but it + // doesn't allow the user to set it by default. Call this method to allow + // this to happen. + void Allow3rdStateForUser(bool allow = true); + + virtual bool SetValue(const wxVariant& value) wxOVERRIDE; + virtual bool GetValue(wxVariant& value) const wxOVERRIDE; + +#if wxUSE_ACCESSIBILITY + virtual wxString GetAccessibleDescription() const wxOVERRIDE; +#endif // wxUSE_ACCESSIBILITY + + virtual wxSize GetSize() const wxOVERRIDE; + virtual bool Render(wxRect cell, wxDC* dc, int state) wxOVERRIDE; + virtual bool ActivateCell(const wxRect& cell, + wxDataViewModel *model, + const wxDataViewItem & item, + unsigned int col, + const wxMouseEvent *mouseEvent) wxOVERRIDE; + +private: + wxSize GetCheckSize() const; + + // Just some arbitrary constants defining margins, in pixels. + enum + { + MARGIN_CHECK_ICON = 3, + MARGIN_ICON_TEXT = 4 + }; + + wxDataViewCheckIconText m_value; + + bool m_allow3rdStateForUser; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCheckIconTextRenderer); +}; + +#endif // ! native __WXOSX__ + +// this class is obsolete, its functionality was merged in +// wxDataViewTextRenderer itself now, don't use it any more +#define wxDataViewTextRendererAttr wxDataViewTextRenderer + +#endif // _WX_DVRENDERERS_H_ + diff --git a/lib/wxWidgets/include/wx/dynarray.h b/lib/wxWidgets/include/wx/dynarray.h new file mode 100644 index 0000000..07729a3 --- /dev/null +++ b/lib/wxWidgets/include/wx/dynarray.h @@ -0,0 +1,929 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/dynarray.h +// Purpose: auto-resizable (i.e. dynamic) array support +// Author: Vadim Zeitlin +// Modified by: +// Created: 12.09.97 +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _DYNARRAY_H +#define _DYNARRAY_H + +#include "wx/defs.h" + +#include "wx/vector.h" + +#ifdef wxHAVE_INITIALIZER_LIST + #include +#endif + +/* + This header defines legacy dynamic arrays and object arrays (i.e. arrays + which own their elements) classes. + + Do *NOT* use them in the new code, these classes exist for compatibility + only. Simply use standard container, e.g. std::vector<>, in your own code. + */ + +#define _WX_ERROR_REMOVE "removing inexistent element in wxArray::Remove" + +// ---------------------------------------------------------------------------- +// types +// ---------------------------------------------------------------------------- + +/* + Callback compare function for quick sort. + + It must return negative value, 0 or positive value if the first item is + less than, equal to or greater than the second one. + */ +extern "C" +{ +typedef int (wxCMPFUNC_CONV *CMPFUNC)(const void* pItem1, const void* pItem2); +} + +// ---------------------------------------------------------------------------- +// Array class providing legacy dynamic arrays API on top of wxVector<> +// ---------------------------------------------------------------------------- + +// For some reasons lost in the depths of time, sort functions with different +// signatures are used to sort normal arrays and to keep sorted arrays sorted. +// These two functors can be used as predicates with std::sort() adapting the +// sort function to it, whichever signature it uses. + +template +class wxArray_SortFunction +{ +public: + typedef int (wxCMPFUNC_CONV *CMPFUNC)(T* pItem1, T* pItem2); + + wxArray_SortFunction(CMPFUNC f) : m_f(f) { } + bool operator()(const T& i1, const T& i2) + { return m_f(const_cast(&i1), const_cast(&i2)) < 0; } +private: + CMPFUNC m_f; +}; + +template +class wxSortedArray_SortFunction +{ +public: + typedef int (wxCMPFUNC_CONV *CMPFUNC)(T, T); + + wxSortedArray_SortFunction(CMPFUNC f) : m_f(f) { } + bool operator()(const T& i1, const T& i2) + { return m_f(i1, i2) < 0; } +private: + CMPFUNC m_f; +}; + +template > +class wxBaseArray : public wxVector +{ +public: + typedef typename Sorter::CMPFUNC SCMPFUNC; + typedef typename wxArray_SortFunction::CMPFUNC CMPFUNC; + + typedef wxVector base_vec; + + typedef typename base_vec::value_type value_type; + typedef typename base_vec::reference reference; + typedef typename base_vec::const_reference const_reference; + typedef typename base_vec::iterator iterator; + typedef typename base_vec::const_iterator const_iterator; + typedef typename base_vec::const_reverse_iterator const_reverse_iterator; + typedef typename base_vec::difference_type difference_type; + typedef typename base_vec::size_type size_type; + +public: + typedef T base_type; + + wxBaseArray() : base_vec() { } + explicit wxBaseArray(size_t n) : base_vec(n) { } + wxBaseArray(size_t n, const_reference v) : base_vec(n, v) { } + + template + wxBaseArray(InputIterator first, InputIterator last) + : base_vec(first, last) + { } + +#ifdef wxHAVE_INITIALIZER_LIST + template + wxBaseArray(std::initializer_list list) : base_vec(list.begin(), list.end()) {} +#endif + + void Empty() { this->clear(); } + void Clear() { this->clear(); } + void Alloc(size_t uiSize) { this->reserve(uiSize); } + + void Shrink() + { + wxShrinkToFit(*this); + } + + size_t GetCount() const { return this->size(); } + void SetCount(size_t n, T v = T()) { this->resize(n, v); } + bool IsEmpty() const { return this->empty(); } + size_t Count() const { return this->size(); } + + T& Item(size_t uiIndex) const + { + wxASSERT( uiIndex < this->size() ); + return const_cast((*this)[uiIndex]); + } + + T& Last() const { return Item(this->size() - 1); } + + int Index(T item, bool bFromEnd = false) const + { + if ( bFromEnd ) + { + const const_reverse_iterator b = this->rbegin(), + e = this->rend(); + for ( const_reverse_iterator i = b; i != e; ++i ) + if ( *i == item ) + return (int)(e - i - 1); + } + else + { + const const_iterator b = this->begin(), + e = this->end(); + for ( const_iterator i = b; i != e; ++i ) + if ( *i == item ) + return (int)(i - b); + } + + return wxNOT_FOUND; + } + + int Index(T lItem, SCMPFUNC fnCompare) const + { + Sorter p(fnCompare); + const_iterator i = std::lower_bound(this->begin(), this->end(), lItem, p); + return i != this->end() && !p(lItem, *i) ? (int)(i - this->begin()) + : wxNOT_FOUND; + } + + size_t IndexForInsert(T lItem, SCMPFUNC fnCompare) const + { + Sorter p(fnCompare); + const_iterator i = std::lower_bound(this->begin(), this->end(), lItem, p); + return i - this->begin(); + } + + void Add(T lItem, size_t nInsert = 1) + { + this->insert(this->end(), nInsert, lItem); + } + + size_t Add(T lItem, SCMPFUNC fnCompare) + { + size_t n = IndexForInsert(lItem, fnCompare); + Insert(lItem, n); + return n; + } + + void Insert(T lItem, size_t uiIndex, size_t nInsert = 1) + { + this->insert(this->begin() + uiIndex, nInsert, lItem); + } + + void Remove(T lItem) + { + int n = Index(lItem); + wxCHECK_RET( n != wxNOT_FOUND, _WX_ERROR_REMOVE ); + RemoveAt((size_t)n); + } + + void RemoveAt(size_t uiIndex, size_t nRemove = 1) + { + this->erase(this->begin() + uiIndex, this->begin() + uiIndex + nRemove); + } + + void Sort(CMPFUNC fCmp) + { + wxArray_SortFunction p(fCmp); + std::sort(this->begin(), this->end(), p); + } + + void Sort(SCMPFUNC fCmp) + { + Sorter p(fCmp); + std::sort(this->begin(), this->end(), p); + } +}; + +// ============================================================================ +// The private helper macros containing the core of the array classes +// ============================================================================ + +// ---------------------------------------------------------------------------- +// _WX_DEFINE_SORTED_TYPEARRAY: sorted array for simple data types +// cannot handle types with size greater than pointer because of sorting +// ---------------------------------------------------------------------------- + +// Note that "classdecl" here is intentionally not used because this class has +// only inline methods and so never needs to be exported from a DLL. +#define _WX_DEFINE_SORTED_TYPEARRAY_2(T, name, base, defcomp, classdecl) \ + typedef wxBaseSortedArray wxBaseSortedArrayFor##name; \ + class name : public wxBaseSortedArrayFor##name \ + { \ + public: \ + name(wxBaseSortedArrayFor##name::SCMPFUNC fn defcomp) \ + : wxBaseSortedArrayFor##name(fn) { } \ + } + + +template > +class wxBaseSortedArray : public wxBaseArray +{ +public: + typedef typename Sorter::CMPFUNC SCMPFUNC; + + explicit wxBaseSortedArray(SCMPFUNC fn) : m_fnCompare(fn) { } + + size_t IndexForInsert(T item) const + { + return this->wxBaseArray::IndexForInsert(item, m_fnCompare); + } + + void AddAt(T item, size_t index) + { + this->insert(this->begin() + index, item); + } + + size_t Add(T item) + { + return this->wxBaseArray::Add(item, m_fnCompare); + } + + void push_back(T item) + { + Add(item); + } + +protected: + SCMPFUNC GetCompareFunction() const wxNOEXCEPT { return m_fnCompare; } + +private: + SCMPFUNC m_fnCompare; +}; + + +// ---------------------------------------------------------------------------- +// _WX_DECLARE_OBJARRAY: an array for pointers to type T with owning semantics +// ---------------------------------------------------------------------------- + +// This class must be able to be declared with incomplete types, so it doesn't +// actually use type T in its definition, and relies on a helper template +// parameter, which is declared by WX_DECLARE_OBJARRAY() and defined by +// WX_DEFINE_OBJARRAY(), for providing a way to create and destroy objects of +// type T +template +class wxBaseObjectArray : private wxBaseArray +{ + typedef wxBaseArray base; + +public: + typedef T value_type; + + typedef int (wxCMPFUNC_CONV *CMPFUNC)(T **pItem1, T **pItem2); + + wxBaseObjectArray() + { + } + + wxBaseObjectArray(const wxBaseObjectArray& src) : base() + { + DoCopy(src); + } + + wxBaseObjectArray& operator=(const wxBaseObjectArray& src) + { + Empty(); + DoCopy(src); + + return *this; + } + + ~wxBaseObjectArray() + { + Empty(); + } + + void Alloc(size_t count) { base::reserve(count); } + void reserve(size_t count) { base::reserve(count); } + size_t GetCount() const { return base::size(); } + size_t size() const { return base::size(); } + bool IsEmpty() const { return base::empty(); } + bool empty() const { return base::empty(); } + size_t Count() const { return base::size(); } + void Shrink() { base::Shrink(); } + + T& operator[](size_t uiIndex) const + { + return *base::operator[](uiIndex); + } + + T& Item(size_t uiIndex) const + { + return *base::operator[](uiIndex); + } + + T& Last() const + { + return *(base::operator[](size() - 1)); + } + + int Index(const T& item, bool bFromEnd = false) const + { + if ( bFromEnd ) + { + if ( size() > 0 ) + { + size_t ui = size() - 1; + do + { + if ( base::operator[](ui) == &item ) + return static_cast(ui); + ui--; + } + while ( ui != 0 ); + } + } + else + { + for ( size_t ui = 0; ui < size(); ++ui ) + { + if( base::operator[](ui) == &item ) + return static_cast(ui); + } + } + + return wxNOT_FOUND; + } + + void Add(const T& item, size_t nInsert = 1) + { + if ( nInsert == 0 ) + return; + + T* const pItem = Traits::Clone(item); + + const size_t nOldSize = size(); + if ( pItem != NULL ) + base::insert(this->end(), nInsert, pItem); + + for ( size_t i = 1; i < nInsert; i++ ) + base::operator[](nOldSize + i) = Traits::Clone(item); + } + + void Add(const T* pItem) + { + base::push_back(const_cast(pItem)); + } + + void push_back(const T* pItem) { Add(pItem); } + void push_back(const T& item) { Add(item); } + + void Insert(const T& item, size_t uiIndex, size_t nInsert = 1) + { + if ( nInsert == 0 ) + return; + + T* const pItem = Traits::Clone(item); + if ( pItem != NULL ) + base::insert(this->begin() + uiIndex, nInsert, pItem); + + for ( size_t i = 1; i < nInsert; ++i ) + base::operator[](uiIndex + i) = Traits::Clone(item); + } + + void Insert(const T* pItem, size_t uiIndex) + { + base::insert(this->begin() + uiIndex, const_cast(pItem)); + } + + void Empty() { DoEmpty(); base::clear(); } + void Clear() { DoEmpty(); base::clear(); } + + T* Detach(size_t uiIndex) + { + T* const p = base::operator[](uiIndex); + + base::erase(this->begin() + uiIndex); + return p; + } + + void RemoveAt(size_t uiIndex, size_t nRemove = 1) + { + wxCHECK_RET( uiIndex < size(), "bad index in RemoveAt()" ); + + for ( size_t i = 0; i < nRemove; ++i ) + Traits::Free(base::operator[](uiIndex + i)); + + base::erase(this->begin() + uiIndex, this->begin() + uiIndex + nRemove); + } + + void Sort(CMPFUNC fCmp) { base::Sort(fCmp); } + +private: + void DoEmpty() + { + for ( size_t n = 0; n < size(); ++n ) + Traits::Free(base::operator[](n)); + } + + void DoCopy(const wxBaseObjectArray& src) + { + reserve(src.size()); + for ( size_t n = 0; n < src.size(); ++n ) + Add(src[n]); + } +}; + +// ============================================================================ +// The public macros for declaration and definition of the dynamic arrays +// ============================================================================ + +// Please note that for each macro WX_FOO_ARRAY we also have +// WX_FOO_EXPORTED_ARRAY and WX_FOO_USER_EXPORTED_ARRAY which are exactly the +// same except that they use an additional __declspec(dllexport) or equivalent +// under Windows if needed. +// +// The first (just EXPORTED) macros do it if wxWidgets was compiled as a DLL +// and so must be used inside the library. The second kind (USER_EXPORTED) +// allow the user code to do it when it wants. This is needed if you have a dll +// that wants to export a wxArray daubed with your own import/export goo. +// +// Finally, you can define the macro below as something special to modify the +// arrays defined by a simple WX_FOO_ARRAY as well. By default is empty. +#define wxARRAY_DEFAULT_EXPORT + +// ---------------------------------------------------------------------------- +// WX_DECLARE_BASEARRAY(T, name): now is the same as WX_DEFINE_TYPEARRAY() +// below, only preserved for compatibility. +// ---------------------------------------------------------------------------- + +#define wxARRAY_DUMMY_BASE + +#define WX_DECLARE_BASEARRAY(T, name) \ + WX_DEFINE_TYPEARRAY(T, name) + +#define WX_DECLARE_EXPORTED_BASEARRAY(T, name) \ + WX_DEFINE_EXPORTED_TYPEARRAY(T, name, WXDLLIMPEXP_CORE) + +#define WX_DECLARE_USER_EXPORTED_BASEARRAY(T, name, expmode) \ + WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, wxARRAY_DUMMY_BASE, class expmode) + +// ---------------------------------------------------------------------------- +// WX_DEFINE_TYPEARRAY(T, name, base) define an array class named "name" +// containing the elements of type T. Note that the argument "base" is unused +// and is preserved for compatibility only. Also, macros with and without +// "_PTR" suffix are identical, and the latter ones are also kept only for +// compatibility. +// ---------------------------------------------------------------------------- + +#define WX_DEFINE_TYPEARRAY(T, name, base) \ + WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, class wxARRAY_DEFAULT_EXPORT) + +#define WX_DEFINE_TYPEARRAY_PTR(T, name, base) \ + WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, class wxARRAY_DEFAULT_EXPORT) + +#define WX_DEFINE_EXPORTED_TYPEARRAY(T, name, base) \ + WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, class WXDLLIMPEXP_CORE) + +#define WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, base) \ + WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, class WXDLLIMPEXP_CORE) + +#define WX_DEFINE_USER_EXPORTED_TYPEARRAY(T, name, base, expdecl) \ + WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, class expdecl) + +#define WX_DEFINE_USER_EXPORTED_TYPEARRAY_PTR(T, name, base, expdecl) \ + WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, class expdecl) + +#ifdef wxHAVE_INITIALIZER_LIST + #define WX_DEFINE_CTOR_FROM_INIT_LIST(T, name, base, classdecl) \ + template \ + name(std::initializer_list list) : Base(list.begin(), list.end()) { } +#else + #define WX_DEFINE_CTOR_FROM_INIT_LIST(T, name, base, classdecl) // No support for initializer_list +#endif + +// This is the only non-trivial macro, which actually defines the array class +// with the given name containing the elements of the specified type. +// +// Note that "name" must be a class and not just a typedef because it can be +// (and is) forward declared in the existing code. +// +// As mentioned above, "base" is unused and so is "classdecl" as this class has +// only inline methods and so never needs to be exported from MSW DLLs. +// +// Note about apparently redundant wxBaseArray##name typedef: this is needed to +// avoid clashes between T and symbols defined in wxBaseArray<> scope, e.g. if +// we didn't do this, we would have compilation problems with arrays of type +// "Item" (which is also the name of a method in wxBaseArray<>). +#define WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, classdecl) \ + typedef wxBaseArray wxBaseArrayFor##name; \ + class name : public wxBaseArrayFor##name \ + { \ + typedef wxBaseArrayFor##name Base; \ + public: \ + name() : Base() { } \ + explicit name(size_t n) : Base(n) { } \ + name(size_t n, Base::const_reference v) : Base(n, v) { } \ + template \ + name(InputIterator first, InputIterator last) : Base(first, last) { } \ + WX_DEFINE_CTOR_FROM_INIT_LIST(T, name, base, classdecl) \ + } + + +#define WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, base, classdecl) \ + WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, base, classdecl) + +// ---------------------------------------------------------------------------- +// WX_DEFINE_SORTED_TYPEARRAY: this is the same as the previous macro, but it +// defines a sorted array. +// +// Differences: +// 1) it must be given a COMPARE function in ctor which takes 2 items of type +// T* and should return -1, 0 or +1 if the first one is less/greater +// than/equal to the second one. +// 2) the Add() method inserts the item in such was that the array is always +// sorted (it uses the COMPARE function) +// 3) it has no Sort() method because it's always sorted +// 4) Index() method is much faster (the sorted arrays use binary search +// instead of linear one), but Add() is slower. +// 5) there is no Insert() method because you can't insert an item into the +// given position in a sorted array but there is IndexForInsert()/AddAt() +// pair which may be used to optimize a common operation of "insert only if +// not found" +// +// Note that you have to specify the comparison function when creating the +// objects of this array type. If, as in 99% of cases, the comparison function +// is the same for all objects of a class, WX_DEFINE_SORTED_TYPEARRAY_CMP below +// is more convenient. +// +// Summary: use this class when the speed of Index() function is important, use +// the normal arrays otherwise. +// ---------------------------------------------------------------------------- + +// we need a macro which expands to nothing to pass correct number of +// parameters to a nested macro invocation even when we don't have anything to +// pass it +#define wxARRAY_EMPTY + +#define WX_DEFINE_SORTED_TYPEARRAY(T, name, base) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, base, \ + wxARRAY_DEFAULT_EXPORT) + +#define WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, base) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, base, WXDLLIMPEXP_CORE) + +#define WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, base, expmode) \ + typedef T _wxArray##name; \ + _WX_DEFINE_SORTED_TYPEARRAY_2(_wxArray##name, name, base, \ + wxARRAY_EMPTY, class expmode) + +// ---------------------------------------------------------------------------- +// WX_DEFINE_SORTED_TYPEARRAY_CMP: exactly the same as above but the comparison +// function is provided by this macro and the objects of this class have a +// default constructor which just uses it. +// +// The arguments are: the element type, the comparison function and the array +// name +// +// NB: this is, of course, how WX_DEFINE_SORTED_TYPEARRAY() should have worked +// from the very beginning - unfortunately I didn't think about this earlier +// ---------------------------------------------------------------------------- + +#define WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, base) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base, \ + wxARRAY_DEFAULT_EXPORT) + +#define WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base, \ + WXDLLIMPEXP_CORE) + +#define WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, base, \ + expmode) \ + typedef T _wxArray##name; \ + _WX_DEFINE_SORTED_TYPEARRAY_2(_wxArray##name, name, base, = cmpfunc, \ + class expmode) + +// ---------------------------------------------------------------------------- +// WX_DECLARE_OBJARRAY(T, name): this macro generates a new array class +// named "name" which owns the objects of type T it contains, i.e. it will +// delete them when it is destroyed. +// +// An element is of type T*, but arguments of type T& are taken (see below!) +// and T& is returned. +// +// Don't use this for simple types such as "int" or "long"! +// +// Note on Add/Insert functions: +// 1) function(T*) gives the object to the array, i.e. it will delete the +// object when it's removed or in the array's dtor +// 2) function(T&) will create a copy of the object and work with it +// +// Also: +// 1) Remove() will delete the object after removing it from the array +// 2) Detach() just removes the object from the array (returning pointer to it) +// +// NB1: Base type T should have an accessible copy ctor if Add(T&) is used +// NB2: Never ever cast an array to it's base type: as dtor is not virtual +// and so you risk having at least the memory leaks and probably worse +// +// Some functions of this class are not inline, so it takes some space to +// define new class from this template even if you don't use it - which is not +// the case for the simple (non-object) array classes +// +// To use an objarray class you must +// #include "dynarray.h" +// WX_DECLARE_OBJARRAY(element_type, list_class_name) +// #include "arrimpl.cpp" +// WX_DEFINE_OBJARRAY(list_class_name) // name must be the same as above! +// +// This is necessary because at the moment of DEFINE_OBJARRAY class parsing the +// element_type must be fully defined (i.e. forward declaration is not +// enough), while WX_DECLARE_OBJARRAY may be done anywhere. The separation of +// two allows to break circcular dependencies with classes which have member +// variables of objarray type. +// ---------------------------------------------------------------------------- + +#define WX_DECLARE_OBJARRAY(T, name) \ + WX_DECLARE_USER_EXPORTED_OBJARRAY(T, name, wxARRAY_DEFAULT_EXPORT) + +#define WX_DECLARE_EXPORTED_OBJARRAY(T, name) \ + WX_DECLARE_USER_EXPORTED_OBJARRAY(T, name, WXDLLIMPEXP_CORE) + +#define WX_DECLARE_OBJARRAY_WITH_DECL(T, name, classdecl) \ + classdecl wxObjectArrayTraitsFor##name \ + { \ + public: \ + static T* Clone(T const& item); \ + static void Free(T* p); \ + }; \ + typedef wxBaseObjectArray \ + wxBaseObjectArrayFor##name; \ + classdecl name : public wxBaseObjectArrayFor##name \ + { \ + } + +#define WX_DECLARE_USER_EXPORTED_OBJARRAY(T, name, expmode) \ + WX_DECLARE_OBJARRAY_WITH_DECL(T, name, class expmode) + +// WX_DEFINE_OBJARRAY is going to be redefined when arrimpl.cpp is included, +// try to provoke a human-understandable error if it used incorrectly. +// +// there is no real need for 3 different macros in the DEFINE case but do it +// anyhow for consistency +#define WX_DEFINE_OBJARRAY(name) DidYouIncludeArrimplCpp +#define WX_DEFINE_EXPORTED_OBJARRAY(name) WX_DEFINE_OBJARRAY(name) +#define WX_DEFINE_USER_EXPORTED_OBJARRAY(name) WX_DEFINE_OBJARRAY(name) + +// ---------------------------------------------------------------------------- +// Some commonly used predefined base arrays +// ---------------------------------------------------------------------------- + +WX_DECLARE_USER_EXPORTED_BASEARRAY(const void *, wxBaseArrayPtrVoid, + WXDLLIMPEXP_BASE); +WX_DECLARE_USER_EXPORTED_BASEARRAY(char, wxBaseArrayChar, WXDLLIMPEXP_BASE); +WX_DECLARE_USER_EXPORTED_BASEARRAY(short, wxBaseArrayShort, WXDLLIMPEXP_BASE); +WX_DECLARE_USER_EXPORTED_BASEARRAY(int, wxBaseArrayInt, WXDLLIMPEXP_BASE); +WX_DECLARE_USER_EXPORTED_BASEARRAY(long, wxBaseArrayLong, WXDLLIMPEXP_BASE); +WX_DECLARE_USER_EXPORTED_BASEARRAY(size_t, wxBaseArraySizeT, WXDLLIMPEXP_BASE); +WX_DECLARE_USER_EXPORTED_BASEARRAY(double, wxBaseArrayDouble, WXDLLIMPEXP_BASE); + +// ---------------------------------------------------------------------------- +// Convenience macros to define arrays from base arrays +// ---------------------------------------------------------------------------- + +#define WX_DEFINE_ARRAY(T, name) \ + WX_DEFINE_TYPEARRAY(T, name, wxBaseArrayPtrVoid) +#define WX_DEFINE_ARRAY_PTR(T, name) \ + WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayPtrVoid) +#define WX_DEFINE_EXPORTED_ARRAY(T, name) \ + WX_DEFINE_EXPORTED_TYPEARRAY(T, name, wxBaseArrayPtrVoid) +#define WX_DEFINE_EXPORTED_ARRAY_PTR(T, name) \ + WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayPtrVoid) +#define WX_DEFINE_ARRAY_WITH_DECL_PTR(T, name, decl) \ + WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayPtrVoid, decl) +#define WX_DEFINE_USER_EXPORTED_ARRAY(T, name, expmode) \ + WX_DEFINE_TYPEARRAY_WITH_DECL(T, name, wxBaseArrayPtrVoid, wxARRAY_EMPTY expmode) +#define WX_DEFINE_USER_EXPORTED_ARRAY_PTR(T, name, expmode) \ + WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayPtrVoid, wxARRAY_EMPTY expmode) + +#define WX_DEFINE_ARRAY_CHAR(T, name) \ + WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayChar) +#define WX_DEFINE_EXPORTED_ARRAY_CHAR(T, name) \ + WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayChar) +#define WX_DEFINE_USER_EXPORTED_ARRAY_CHAR(T, name, expmode) \ + WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayChar, wxARRAY_EMPTY expmode) + +#define WX_DEFINE_ARRAY_SHORT(T, name) \ + WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayShort) +#define WX_DEFINE_EXPORTED_ARRAY_SHORT(T, name) \ + WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayShort) +#define WX_DEFINE_USER_EXPORTED_ARRAY_SHORT(T, name, expmode) \ + WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayShort, wxARRAY_EMPTY expmode) + +#define WX_DEFINE_ARRAY_INT(T, name) \ + WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayInt) +#define WX_DEFINE_EXPORTED_ARRAY_INT(T, name) \ + WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayInt) +#define WX_DEFINE_USER_EXPORTED_ARRAY_INT(T, name, expmode) \ + WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayInt, wxARRAY_EMPTY expmode) + +#define WX_DEFINE_ARRAY_LONG(T, name) \ + WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayLong) +#define WX_DEFINE_EXPORTED_ARRAY_LONG(T, name) \ + WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayLong) +#define WX_DEFINE_USER_EXPORTED_ARRAY_LONG(T, name, expmode) \ + WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayLong, wxARRAY_EMPTY expmode) + +#define WX_DEFINE_ARRAY_SIZE_T(T, name) \ + WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArraySizeT) +#define WX_DEFINE_EXPORTED_ARRAY_SIZE_T(T, name) \ + WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArraySizeT) +#define WX_DEFINE_USER_EXPORTED_ARRAY_SIZE_T(T, name, expmode) \ + WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArraySizeT, wxARRAY_EMPTY expmode) + +#define WX_DEFINE_ARRAY_DOUBLE(T, name) \ + WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayDouble) +#define WX_DEFINE_EXPORTED_ARRAY_DOUBLE(T, name) \ + WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayDouble) +#define WX_DEFINE_USER_EXPORTED_ARRAY_DOUBLE(T, name, expmode) \ + WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayDouble, wxARRAY_EMPTY expmode) + +// ---------------------------------------------------------------------------- +// Convenience macros to define sorted arrays from base arrays +// ---------------------------------------------------------------------------- + +#define WX_DEFINE_SORTED_ARRAY(T, name) \ + WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayPtrVoid) +#define WX_DEFINE_SORTED_EXPORTED_ARRAY(T, name) \ + WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayPtrVoid) +#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY(T, name, expmode) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayPtrVoid, wxARRAY_EMPTY expmode) + +#define WX_DEFINE_SORTED_ARRAY_CHAR(T, name) \ + WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayChar) +#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CHAR(T, name) \ + WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayChar) +#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CHAR(T, name, expmode) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayChar, wxARRAY_EMPTY expmode) + +#define WX_DEFINE_SORTED_ARRAY_SHORT(T, name) \ + WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayShort) +#define WX_DEFINE_SORTED_EXPORTED_ARRAY_SHORT(T, name) \ + WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayShort) +#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_SHORT(T, name, expmode) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayShort, wxARRAY_EMPTY expmode) + +#define WX_DEFINE_SORTED_ARRAY_INT(T, name) \ + WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayInt) +#define WX_DEFINE_SORTED_EXPORTED_ARRAY_INT(T, name) \ + WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayInt) +#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_INT(T, name, expmode) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayInt, expmode) + +#define WX_DEFINE_SORTED_ARRAY_LONG(T, name) \ + WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayLong) +#define WX_DEFINE_SORTED_EXPORTED_ARRAY_LONG(T, name) \ + WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayLong) +#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_LONG(T, name, expmode) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayLong, expmode) + +#define WX_DEFINE_SORTED_ARRAY_SIZE_T(T, name) \ + WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArraySizeT) +#define WX_DEFINE_SORTED_EXPORTED_ARRAY_SIZE_T(T, name) \ + WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArraySizeT) +#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_SIZE_T(T, name, expmode) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArraySizeT, wxARRAY_EMPTY expmode) + +// ---------------------------------------------------------------------------- +// Convenience macros to define sorted arrays from base arrays +// ---------------------------------------------------------------------------- + +#define WX_DEFINE_SORTED_ARRAY_CMP(T, cmpfunc, name) \ + WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayPtrVoid) +#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP(T, cmpfunc, name) \ + WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayPtrVoid) +#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP(T, cmpfunc, \ + name, expmode) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \ + wxBaseArrayPtrVoid, \ + wxARRAY_EMPTY expmode) + +#define WX_DEFINE_SORTED_ARRAY_CMP_CHAR(T, cmpfunc, name) \ + WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayChar) +#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_CHAR(T, cmpfunc, name) \ + WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayChar) +#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_CHAR(T, cmpfunc, \ + name, expmode) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \ + wxBaseArrayChar, \ + wxARRAY_EMPTY expmode) + +#define WX_DEFINE_SORTED_ARRAY_CMP_SHORT(T, cmpfunc, name) \ + WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayShort) +#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_SHORT(T, cmpfunc, name) \ + WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayShort) +#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_SHORT(T, cmpfunc, \ + name, expmode) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \ + wxBaseArrayShort, \ + wxARRAY_EMPTY expmode) + +#define WX_DEFINE_SORTED_ARRAY_CMP_INT(T, cmpfunc, name) \ + WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayInt) +#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_INT(T, cmpfunc, name) \ + WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayInt) +#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_INT(T, cmpfunc, \ + name, expmode) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \ + wxBaseArrayInt, \ + wxARRAY_EMPTY expmode) + +#define WX_DEFINE_SORTED_ARRAY_CMP_LONG(T, cmpfunc, name) \ + WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayLong) +#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_LONG(T, cmpfunc, name) \ + WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayLong) +#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_LONG(T, cmpfunc, \ + name, expmode) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \ + wxBaseArrayLong, \ + wxARRAY_EMPTY expmode) + +#define WX_DEFINE_SORTED_ARRAY_CMP_SIZE_T(T, cmpfunc, name) \ + WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArraySizeT) +#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_SIZE_T(T, cmpfunc, name) \ + WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArraySizeT) +#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_SIZE_T(T, cmpfunc, \ + name, expmode) \ + WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, \ + wxBaseArraySizeT, \ + wxARRAY_EMPTY expmode) + +// ---------------------------------------------------------------------------- +// Some commonly used predefined arrays +// ---------------------------------------------------------------------------- + +WX_DEFINE_USER_EXPORTED_ARRAY_SHORT(short, wxArrayShort, class WXDLLIMPEXP_BASE); +WX_DEFINE_USER_EXPORTED_ARRAY_INT(int, wxArrayInt, class WXDLLIMPEXP_BASE); +WX_DEFINE_USER_EXPORTED_ARRAY_DOUBLE(double, wxArrayDouble, class WXDLLIMPEXP_BASE); +WX_DEFINE_USER_EXPORTED_ARRAY_LONG(long, wxArrayLong, class WXDLLIMPEXP_BASE); +WX_DEFINE_USER_EXPORTED_ARRAY_PTR(void *, wxArrayPtrVoid, class WXDLLIMPEXP_BASE); + +// ----------------------------------------------------------------------------- +// convenience functions: they used to be macros, hence the naming convention +// ----------------------------------------------------------------------------- + +// prepend all element of one array to another one; e.g. if first array contains +// elements X,Y,Z and the second contains A,B,C (in those orders), then the +// first array will be result as A,B,C,X,Y,Z +template +inline void WX_PREPEND_ARRAY(A1& array, const A2& other) +{ + const size_t size = other.size(); + array.reserve(size); + for ( size_t n = 0; n < size; n++ ) + { + array.Insert(other[n], n); + } +} + +// append all element of one array to another one +template +inline void WX_APPEND_ARRAY(A1& array, const A2& other) +{ + size_t size = other.size(); + array.reserve(size); + for ( size_t n = 0; n < size; n++ ) + { + array.push_back(other[n]); + } +} + +// delete all array elements +// +// NB: the class declaration of the array elements must be visible from the +// place where you use this macro, otherwise the proper destructor may not +// be called (a decent compiler should give a warning about it, but don't +// count on it)! +template +inline void WX_CLEAR_ARRAY(A& array) +{ + size_t size = array.size(); + for ( size_t n = 0; n < size; n++ ) + { + delete array[n]; + } + + array.clear(); +} + +#endif // _DYNARRAY_H diff --git a/lib/wxWidgets/include/wx/dynlib.h b/lib/wxWidgets/include/wx/dynlib.h new file mode 100644 index 0000000..93473b0 --- /dev/null +++ b/lib/wxWidgets/include/wx/dynlib.h @@ -0,0 +1,407 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dynlib.h +// Purpose: Dynamic library loading classes +// Author: Guilhem Lavaux, Vadim Zeitlin, Vaclav Slavik +// Modified by: +// Created: 20/07/98 +// Copyright: (c) 1998 Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DYNLIB_H__ +#define _WX_DYNLIB_H__ + +#include "wx/defs.h" + +#if wxUSE_DYNLIB_CLASS + +#include "wx/string.h" +#include "wx/dynarray.h" + +class WXDLLIMPEXP_FWD_BASE wxDynamicLibraryDetailsCreator; + +// ---------------------------------------------------------------------------- +// conditional compilation +// ---------------------------------------------------------------------------- + +#if defined(__WINDOWS__) + typedef WXHMODULE wxDllType; +#elif defined(HAVE_DLOPEN) + #include + typedef void *wxDllType; +#elif defined(__WXMAC__) + #include + typedef CFragConnectionID wxDllType; +#else + #error "Dynamic Loading classes can't be compiled on this platform, sorry." +#endif + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +enum wxDLFlags +{ + wxDL_LAZY = 0x00000001, // resolve undefined symbols at first use + // (only works on some Unix versions) + wxDL_NOW = 0x00000002, // resolve undefined symbols on load + // (default, always the case under Win32) + wxDL_GLOBAL = 0x00000004, // export extern symbols to subsequently + // loaded libs. + wxDL_VERBATIM = 0x00000008, // attempt to load the supplied library + // name without appending the usual dll + // filename extension. + + // this flag is obsolete, don't use + wxDL_NOSHARE = 0x00000010, // load new DLL, don't reuse already loaded + // (only for wxPluginManager) + + wxDL_QUIET = 0x00000020, // don't log an error if failed to load + + // this flag is dangerous, for internal use of wxMSW only, don't use at all + // and especially don't use directly, use wxLoadedDLL instead if you really + // do need it + wxDL_GET_LOADED = 0x00000040, // Win32 only: return handle of already + // loaded DLL or NULL otherwise; Unload() + // should not be called so don't forget to + // Detach() if you use this function + + wxDL_DEFAULT = wxDL_NOW // default flags correspond to Win32 +}; + +enum wxDynamicLibraryCategory +{ + wxDL_LIBRARY, // standard library + wxDL_MODULE // loadable module/plugin +}; + +enum wxPluginCategory +{ + wxDL_PLUGIN_GUI, // plugin that uses GUI classes + wxDL_PLUGIN_BASE // wxBase-only plugin +}; + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +// when loading a function from a DLL you always have to cast the returned +// "void *" pointer to the correct type and, even more annoyingly, you have to +// repeat this type twice if you want to declare and define a function pointer +// all in one line +// +// this macro makes this slightly less painful by allowing you to specify the +// type only once, as the first parameter, and creating a variable of this type +// called "pfn" initialized with the "name" from the "dynlib" +#define wxDYNLIB_FUNCTION(type, name, dynlib) \ + type pfn ## name = (type)(dynlib).GetSymbol(wxT(#name)) + + +// a more convenient function replacing wxDYNLIB_FUNCTION above +// +// it uses the convention that the type of the function is its name suffixed +// with "_t" but it doesn't define a variable but just assigns the loaded value +// to it and also allows to pass it the prefix to be used instead of hardcoding +// "pfn" (the prefix can be "m_" or "gs_pfn" or whatever) +// +// notice that this function doesn't generate error messages if the symbol +// couldn't be loaded, the caller should generate the appropriate message +#define wxDL_INIT_FUNC(pfx, name, dynlib) \ + pfx ## name = (name ## _t)(dynlib).RawGetSymbol(#name) + +#ifdef __WINDOWS__ + +// same as wxDL_INIT_FUNC() but appends 'A' or 'W' to the function name, see +// wxDynamicLibrary::GetSymbolAorW() +#define wxDL_INIT_FUNC_AW(pfx, name, dynlib) \ + pfx ## name = (name ## _t)(dynlib).GetSymbolAorW(#name) + +#endif // __WINDOWS__ + +// the following macros can be used to redirect a whole library to a class and +// check at run-time if the library is present and contains all required +// methods +// +// notice that they are supposed to be used inside a class which has "m_ok" +// member variable indicating if the library had been successfully loaded + +// helper macros constructing the name of the variable storing the function +// pointer and the name of its type from the function name +#define wxDL_METHOD_NAME(name) m_pfn ## name +#define wxDL_METHOD_TYPE(name) name ## _t + +// parameters are: +// - rettype: return type of the function, e.g. "int" +// - name: name of the function, e.g. "foo" +// - args: function signature in parentheses, e.g. "(int x, int y)" +// - argnames: the names of the parameters in parentheses, e.g. "(x, y)" +// - defret: the value to return if the library wasn't successfully loaded +#define wxDL_METHOD_DEFINE( rettype, name, args, argnames, defret ) \ + typedef rettype (* wxDL_METHOD_TYPE(name)) args ; \ + wxDL_METHOD_TYPE(name) wxDL_METHOD_NAME(name); \ + rettype name args \ + { return m_ok ? wxDL_METHOD_NAME(name) argnames : defret; } + +#define wxDL_VOIDMETHOD_DEFINE( name, args, argnames ) \ + typedef void (* wxDL_METHOD_TYPE(name)) args ; \ + wxDL_METHOD_TYPE(name) wxDL_METHOD_NAME(name); \ + void name args \ + { if ( m_ok ) wxDL_METHOD_NAME(name) argnames ; } + +#define wxDL_METHOD_LOAD(lib, name) \ + wxDL_METHOD_NAME(name) = \ + (wxDL_METHOD_TYPE(name)) lib.GetSymbol(#name, &m_ok); \ + if ( !m_ok ) return false + +// ---------------------------------------------------------------------------- +// wxDynamicLibraryDetails: contains details about a loaded wxDynamicLibrary +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxDynamicLibraryDetails +{ +public: + // ctor, normally never used as these objects are only created by + // wxDynamicLibrary::ListLoaded() + wxDynamicLibraryDetails() { m_address = NULL; m_length = 0; } + + // get the (base) name + wxString GetName() const { return m_name; } + + // get the full path of this object + wxString GetPath() const { return m_path; } + + // get the load address and the extent, return true if this information is + // available + bool GetAddress(void **addr, size_t *len) const + { + if ( !m_address ) + return false; + + if ( addr ) + *addr = m_address; + if ( len ) + *len = m_length; + + return true; + } + + // return the version of the DLL (may be empty if no version info) + wxString GetVersion() const + { + return m_version; + } + +private: + wxString m_name, + m_path, + m_version; + + void *m_address; + size_t m_length; + + friend class wxDynamicLibraryDetailsCreator; +}; + +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxDynamicLibraryDetails, + wxDynamicLibraryDetailsArray, + WXDLLIMPEXP_BASE); + +// ---------------------------------------------------------------------------- +// wxDynamicLibrary: represents a handle to a DLL/shared object +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxDynamicLibrary +{ +public: + // return a valid handle for the main program itself or NULL if back + // linking is not supported by the current platform (e.g. Win32) + static wxDllType GetProgramHandle(); + + // return the platform standard DLL extension (with leading dot) + static wxString GetDllExt(wxDynamicLibraryCategory cat = wxDL_LIBRARY); + + wxDynamicLibrary() : m_handle(NULL) { } + wxDynamicLibrary(const wxString& libname, int flags = wxDL_DEFAULT) + : m_handle(NULL) + { + Load(libname, flags); + } + + // NOTE: this class is (deliberately) not virtual, do not attempt + // to use it polymorphically. + ~wxDynamicLibrary() { Unload(); } + + // return true if the library was loaded successfully + bool IsLoaded() const { return m_handle != NULL; } + + // load the library with the given name (full or not), return true if ok + bool Load(const wxString& libname, int flags = wxDL_DEFAULT); + + // raw function for loading dynamic libs: always behaves as if + // wxDL_VERBATIM were specified and doesn't log error message if the + // library couldn't be loaded but simply returns NULL + static wxDllType RawLoad(const wxString& libname, int flags = wxDL_DEFAULT); + + // attach to an existing handle + void Attach(wxDllType h) { Unload(); m_handle = h; } + + // detach the library object from its handle, i.e. prevent the object from + // unloading the library in its dtor -- the caller is now responsible for + // doing this + wxDllType Detach() { wxDllType h = m_handle; m_handle = NULL; return h; } + + // unload the given library handle (presumably returned by Detach() before) + static void Unload(wxDllType handle); + + // unload the library, also done automatically in dtor + void Unload() { if ( IsLoaded() ) { Unload(m_handle); m_handle = NULL; } } + + // Return the raw handle from dlopen and friends. + wxDllType GetLibHandle() const { return m_handle; } + + // check if the given symbol is present in the library, useful to verify if + // a loadable module is our plugin, for example, without provoking error + // messages from GetSymbol() + bool HasSymbol(const wxString& name) const + { + bool ok; + DoGetSymbol(name, &ok); + return ok; + } + + // resolve a symbol in a loaded DLL, such as a variable or function name. + // 'name' is the (possibly mangled) name of the symbol. (use extern "C" to + // export unmangled names) + // + // Since it is perfectly valid for the returned symbol to actually be NULL, + // that is not always indication of an error. Pass and test the parameter + // 'success' for a true indication of success or failure to load the + // symbol. + // + // Returns a pointer to the symbol on success, or NULL if an error occurred + // or the symbol wasn't found. + void *GetSymbol(const wxString& name, bool *success = NULL) const; + + // low-level version of GetSymbol() + static void *RawGetSymbol(wxDllType handle, const wxString& name); + void *RawGetSymbol(const wxString& name) const + { + return RawGetSymbol(m_handle, name); + } + +#ifdef __WINDOWS__ + // this function is useful for loading functions from the standard Windows + // DLLs: such functions have an 'A' (in ANSI build) or 'W' (in Unicode, or + // wide character build) suffix if they take string parameters + static void *RawGetSymbolAorW(wxDllType handle, const wxString& name) + { + return RawGetSymbol + ( + handle, + name + +#if wxUSE_UNICODE + L'W' +#else + 'A' +#endif + ); + } + + void *GetSymbolAorW(const wxString& name) const + { + return RawGetSymbolAorW(m_handle, name); + } +#endif // __WINDOWS__ + + // return all modules/shared libraries in the address space of this process + // + // returns an empty array if not implemented or an error occurred + static wxDynamicLibraryDetailsArray ListLoaded(); + + // return platform-specific name of dynamic library with proper extension + // and prefix (e.g. "foo.dll" on Windows or "libfoo.so" on Linux) + static wxString CanonicalizeName(const wxString& name, + wxDynamicLibraryCategory cat = wxDL_LIBRARY); + + // return name of wxWidgets plugin (adds compiler and version info + // to the filename): + static wxString + CanonicalizePluginName(const wxString& name, + wxPluginCategory cat = wxDL_PLUGIN_GUI); + + // return plugin directory on platforms where it makes sense and empty + // string on others: + static wxString GetPluginsDirectory(); + + // Return the load address of the module containing the given address or + // NULL if not found. + // + // If path output parameter is non-NULL, fill it with the full path to this + // module disk file on success. + static void* GetModuleFromAddress(const void* addr, wxString* path = NULL); + +#ifdef __WINDOWS__ + // return the handle (HMODULE/HINSTANCE) of the DLL with the given name + // and/or containing the specified address: for XP and later systems only + // the address is used and the name is ignored but for the previous systems + // only the name (which may be either a full path to the DLL or just its + // base name, possibly even without extension) is used + // + // the returned handle reference count is not incremented so it doesn't + // need to be freed using FreeLibrary() but it also means that it can + // become invalid if the DLL is unloaded + static WXHMODULE MSWGetModuleHandle(const wxString& name, void *addr); +#endif // __WINDOWS__ + +protected: + // common part of GetSymbol() and HasSymbol() + void* DoGetSymbol(const wxString& name, bool* success = NULL) const; + + // log the error after an OS dynamic library function failure + static void ReportError(const wxString& msg, + const wxString& name = wxString()); + + // the handle to DLL or NULL + wxDllType m_handle; + + // no copy ctor/assignment operators (or we'd try to unload the library + // twice) + wxDECLARE_NO_COPY_CLASS(wxDynamicLibrary); +}; + +#ifdef __WINDOWS__ + +// ---------------------------------------------------------------------------- +// wxLoadedDLL is a MSW-only internal helper class allowing to dynamically bind +// to a DLL already loaded into the project address space +// ---------------------------------------------------------------------------- + +class wxLoadedDLL : public wxDynamicLibrary +{ +public: + wxLoadedDLL(const wxString& dllname) + : wxDynamicLibrary(dllname, wxDL_GET_LOADED | wxDL_VERBATIM | wxDL_QUIET) + { + } + + ~wxLoadedDLL() + { + Detach(); + } +}; + +#endif // __WINDOWS__ + +// ---------------------------------------------------------------------------- +// Interesting defines +// ---------------------------------------------------------------------------- + +#define WXDLL_ENTRY_FUNCTION() \ +extern "C" WXEXPORT const wxClassInfo *wxGetClassFirst(); \ +const wxClassInfo *wxGetClassFirst() { \ + return wxClassInfo::GetFirst(); \ +} + +#endif // wxUSE_DYNLIB_CLASS + +#endif // _WX_DYNLIB_H__ diff --git a/lib/wxWidgets/include/wx/dynload.h b/lib/wxWidgets/include/wx/dynload.h new file mode 100644 index 0000000..5637387 --- /dev/null +++ b/lib/wxWidgets/include/wx/dynload.h @@ -0,0 +1,155 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/dynload.h +// Purpose: Dynamic loading framework +// Author: Ron Lee, David Falkinder, Vadim Zeitlin and a cast of 1000's +// (derived in part from dynlib.cpp (c) 1998 Guilhem Lavaux) +// Modified by: +// Created: 03/12/01 +// Copyright: (c) 2001 Ron Lee +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DYNAMICLOADER_H__ +#define _WX_DYNAMICLOADER_H__ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_DYNAMIC_LOADER + +#include "wx/dynlib.h" +#include "wx/hashmap.h" +#include "wx/module.h" + +class WXDLLIMPEXP_FWD_BASE wxPluginLibrary; + + +WX_DECLARE_STRING_HASH_MAP_WITH_DECL(wxPluginLibrary *, wxDLManifest, + class WXDLLIMPEXP_BASE); +typedef wxDLManifest wxDLImports; + +// --------------------------------------------------------------------------- +// wxPluginLibrary +// --------------------------------------------------------------------------- + +// NOTE: Do not attempt to use a base class pointer to this class. +// wxDL is not virtual and we deliberately hide some of its +// methods here. +// +// Unless you know exactly why you need to, you probably shouldn't +// instantiate this class directly anyway, use wxPluginManager +// instead. + +class WXDLLIMPEXP_BASE wxPluginLibrary : public wxDynamicLibrary +{ +public: + + static wxDLImports* ms_classes; // Static hash of all imported classes. + + wxPluginLibrary( const wxString &libname, int flags = wxDL_DEFAULT ); + ~wxPluginLibrary(); + + wxPluginLibrary *RefLib(); + bool UnrefLib(); + + // These two are called by the PluginSentinel on (PLUGGABLE) object + // creation/destruction. There is usually no reason for the user to + // call them directly. We have to separate this from the link count, + // since the two are not interchangeable. + + // FIXME: for even better debugging PluginSentinel should register + // the name of the class created too, then we can state + // exactly which object was not destroyed which may be + // difficult to find otherwise. Also this code should + // probably only be active in DEBUG mode, but let's just + // get it right first. + + void RefObj() { ++m_objcount; } + void UnrefObj() + { + wxASSERT_MSG( m_objcount > 0, wxT("Too many objects deleted??") ); + --m_objcount; + } + + // Override/hide some base class methods + + bool IsLoaded() const { return m_linkcount > 0; } + void Unload() { UnrefLib(); } + +private: + + // These pointers may be NULL but if they are not, then m_ourLast follows + // m_ourFirst in the linked list, i.e. can be found by calling GetNext() a + // sufficient number of times. + const wxClassInfo *m_ourFirst; // first class info in this plugin + const wxClassInfo *m_ourLast; // ..and the last one + + size_t m_linkcount; // Ref count of library link calls + size_t m_objcount; // ..and (pluggable) object instantiations. + wxModuleList m_wxmodules; // any wxModules that we initialised. + + void UpdateClasses(); // Update ms_classes + void RestoreClasses(); // Removes this library from ms_classes + void RegisterModules(); // Init any wxModules in the lib. + void UnregisterModules(); // Cleanup any wxModules we installed. + + wxDECLARE_NO_COPY_CLASS(wxPluginLibrary); +}; + + +class WXDLLIMPEXP_BASE wxPluginManager +{ +public: + + // Static accessors. + + static wxPluginLibrary *LoadLibrary( const wxString &libname, + int flags = wxDL_DEFAULT ); + static bool UnloadLibrary(const wxString &libname); + + // Instance methods. + + wxPluginManager() : m_entry(NULL) {} + wxPluginManager(const wxString &libname, int flags = wxDL_DEFAULT) + { + Load(libname, flags); + } + ~wxPluginManager() { if ( IsLoaded() ) Unload(); } + + bool Load(const wxString &libname, int flags = wxDL_DEFAULT); + void Unload(); + + bool IsLoaded() const { return m_entry && m_entry->IsLoaded(); } + void* GetSymbol(const wxString& symbol, bool* success = NULL) + { + return m_entry->GetSymbol( symbol, success ); + } + + static void CreateManifest() { ms_manifest = new wxDLManifest(wxKEY_STRING); } + static void ClearManifest() { delete ms_manifest; ms_manifest = NULL; } + +private: + // return the pointer to the entry for the library with given name in + // ms_manifest or NULL if none + static wxPluginLibrary *FindByName(const wxString& name) + { + const wxDLManifest::iterator i = ms_manifest->find(name); + + return i == ms_manifest->end() ? NULL : i->second; + } + + static wxDLManifest* ms_manifest; // Static hash of loaded libs. + wxPluginLibrary* m_entry; // Cache our entry in the manifest. + + // We could allow this class to be copied if we really + // wanted to, but not without modification. + wxDECLARE_NO_COPY_CLASS(wxPluginManager); +}; + + +#endif // wxUSE_DYNAMIC_LOADER +#endif // _WX_DYNAMICLOADER_H__ + diff --git a/lib/wxWidgets/include/wx/editlbox.h b/lib/wxWidgets/include/wx/editlbox.h new file mode 100644 index 0000000..5ad53fd --- /dev/null +++ b/lib/wxWidgets/include/wx/editlbox.h @@ -0,0 +1,99 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/editlbox.h +// Purpose: ListBox with editable items +// Author: Vaclav Slavik +// Copyright: (c) Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __WX_EDITLBOX_H__ +#define __WX_EDITLBOX_H__ + +#include "wx/defs.h" + +#if wxUSE_EDITABLELISTBOX + +#include "wx/panel.h" + +class WXDLLIMPEXP_FWD_CORE wxBitmapButton; +class WXDLLIMPEXP_FWD_CORE wxListCtrl; +class WXDLLIMPEXP_FWD_CORE wxListEvent; + +#define wxEL_ALLOW_NEW 0x0100 +#define wxEL_ALLOW_EDIT 0x0200 +#define wxEL_ALLOW_DELETE 0x0400 +#define wxEL_NO_REORDER 0x0800 +#define wxEL_DEFAULT_STYLE (wxEL_ALLOW_NEW | wxEL_ALLOW_EDIT | wxEL_ALLOW_DELETE) + +extern WXDLLIMPEXP_DATA_CORE(const char) wxEditableListBoxNameStr[]; + +// This class provides a composite control that lets the +// user easily enter list of strings + +class WXDLLIMPEXP_CORE wxEditableListBox : public wxPanel +{ +public: + wxEditableListBox() { Init(); } + + wxEditableListBox(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxEL_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxEditableListBoxNameStr)) + { + Init(); + Create(parent, id, label, pos, size, style, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxEL_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxEditableListBoxNameStr)); + + void SetStrings(const wxArrayString& strings); + void GetStrings(wxArrayString& strings) const; + + wxListCtrl* GetListCtrl() { return m_listCtrl; } + wxBitmapButton* GetDelButton() { return m_bDel; } + wxBitmapButton* GetNewButton() { return m_bNew; } + wxBitmapButton* GetUpButton() { return m_bUp; } + wxBitmapButton* GetDownButton() { return m_bDown; } + wxBitmapButton* GetEditButton() { return m_bEdit; } + +protected: + wxBitmapButton *m_bDel, *m_bNew, *m_bUp, *m_bDown, *m_bEdit; + wxListCtrl *m_listCtrl; + int m_selection; + long m_style; + + void Init() + { + m_style = 0; + m_selection = 0; + m_bEdit = m_bNew = m_bDel = m_bUp = m_bDown = NULL; + m_listCtrl = NULL; + } + + void OnItemSelected(wxListEvent& event); + void OnEndLabelEdit(wxListEvent& event); + void OnNewItem(wxCommandEvent& event); + void OnDelItem(wxCommandEvent& event); + void OnEditItem(wxCommandEvent& event); + void OnUpItem(wxCommandEvent& event); + void OnDownItem(wxCommandEvent& event); + + wxDECLARE_CLASS(wxEditableListBox); + wxDECLARE_EVENT_TABLE(); + +private: + void SwapItems(long i1, long i2); + +}; + +#endif // wxUSE_EDITABLELISTBOX + +#endif // __WX_EDITLBOX_H__ diff --git a/lib/wxWidgets/include/wx/effects.h b/lib/wxWidgets/include/wx/effects.h new file mode 100644 index 0000000..d80e069 --- /dev/null +++ b/lib/wxWidgets/include/wx/effects.h @@ -0,0 +1,90 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/effects.h +// Purpose: wxEffects class +// Draws 3D effects. +// Author: Julian Smart et al +// Modified by: +// Created: 25/4/2000 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_EFFECTS_H_ +#define _WX_EFFECTS_H_ + +// this class is deprecated and will be removed in the next wx version +// +// please use wxRenderer::DrawBorder() instead of DrawSunkenEdge(); there is no +// replacement for TileBitmap() but it doesn't seem to be very useful anyhow +#if WXWIN_COMPATIBILITY_2_8 + +/* + * wxEffects: various 3D effects + */ + +#include "wx/object.h" +#include "wx/colour.h" +#include "wx/gdicmn.h" +#include "wx/dc.h" + +class WXDLLIMPEXP_CORE wxEffectsImpl: public wxObject +{ +public: + // Assume system colours + wxEffectsImpl() ; + // Going from lightest to darkest + wxEffectsImpl(const wxColour& highlightColour, const wxColour& lightShadow, + const wxColour& faceColour, const wxColour& mediumShadow, + const wxColour& darkShadow) ; + + // Accessors + wxColour GetHighlightColour() const { return m_highlightColour; } + wxColour GetLightShadow() const { return m_lightShadow; } + wxColour GetFaceColour() const { return m_faceColour; } + wxColour GetMediumShadow() const { return m_mediumShadow; } + wxColour GetDarkShadow() const { return m_darkShadow; } + + void SetHighlightColour(const wxColour& c) { m_highlightColour = c; } + void SetLightShadow(const wxColour& c) { m_lightShadow = c; } + void SetFaceColour(const wxColour& c) { m_faceColour = c; } + void SetMediumShadow(const wxColour& c) { m_mediumShadow = c; } + void SetDarkShadow(const wxColour& c) { m_darkShadow = c; } + + void Set(const wxColour& highlightColour, const wxColour& lightShadow, + const wxColour& faceColour, const wxColour& mediumShadow, + const wxColour& darkShadow) + { + SetHighlightColour(highlightColour); + SetLightShadow(lightShadow); + SetFaceColour(faceColour); + SetMediumShadow(mediumShadow); + SetDarkShadow(darkShadow); + } + + // Draw a sunken edge + void DrawSunkenEdge(wxDC& dc, const wxRect& rect, int borderSize = 1); + + // Tile a bitmap + bool TileBitmap(const wxRect& rect, wxDC& dc, const wxBitmap& bitmap); + +protected: + wxColour m_highlightColour; // Usually white + wxColour m_lightShadow; // Usually light grey + wxColour m_faceColour; // Usually grey + wxColour m_mediumShadow; // Usually dark grey + wxColour m_darkShadow; // Usually black + + wxDECLARE_CLASS(wxEffectsImpl); +}; + +// current versions of g++ don't generate deprecation warnings for classes +// declared deprecated, so define wxEffects as a typedef instead: this does +// generate warnings with both g++ and VC (which also has no troubles with +// directly deprecating the classes...) +// +// note that this g++ bug (16370) is supposed to be fixed in g++ 4.3.0 +wxDEPRECATED(typedef wxEffectsImpl wxEffects); + +#endif // WXWIN_COMPATIBILITY_2_8 + +#endif // _WX_EFFECTS_H_ diff --git a/lib/wxWidgets/include/wx/encconv.h b/lib/wxWidgets/include/wx/encconv.h new file mode 100644 index 0000000..0d2b900 --- /dev/null +++ b/lib/wxWidgets/include/wx/encconv.h @@ -0,0 +1,152 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/encconv.h +// Purpose: wxEncodingConverter class for converting between different +// font encodings +// Author: Vaclav Slavik +// Copyright: (c) 1999 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ENCCONV_H_ +#define _WX_ENCCONV_H_ + +#include "wx/defs.h" + +#include "wx/object.h" +#include "wx/fontenc.h" +#include "wx/dynarray.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +enum +{ + wxCONVERT_STRICT, + wxCONVERT_SUBSTITUTE +}; + + +enum +{ + wxPLATFORM_CURRENT = -1, + + wxPLATFORM_UNIX = 0, + wxPLATFORM_WINDOWS, + wxPLATFORM_MAC +}; + +// ---------------------------------------------------------------------------- +// types +// ---------------------------------------------------------------------------- + +WX_DEFINE_ARRAY_INT(wxFontEncoding, wxFontEncodingArray); + +//-------------------------------------------------------------------------------- +// wxEncodingConverter +// This class is capable of converting strings between any two +// 8bit encodings/charsets. It can also convert from/to Unicode +//-------------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxEncodingConverter : public wxObject +{ + public: + + wxEncodingConverter(); + virtual ~wxEncodingConverter() { delete[] m_Table; } + + // Initialize conversion. Both output or input encoding may + // be wxFONTENCODING_UNICODE. + // + // All subsequent calls to Convert() will interpret it's argument + // as a string in input_enc encoding and will output string in + // output_enc encoding. + // + // You must call this method before calling Convert. You may call + // it more than once in order to switch to another conversion + // + // Method affects behaviour of Convert() in case input character + // cannot be converted because it does not exist in output encoding: + // wxCONVERT_STRICT -- + // follow behaviour of GNU Recode - just copy unconvertable + // characters to output and don't change them (it's integer + // value will stay the same) + // wxCONVERT_SUBSTITUTE -- + // try some (lossy) substitutions - e.g. replace + // unconvertable latin capitals with acute by ordinary + // capitals, replace en-dash or em-dash by '-' etc. + // both modes guarantee that output string will have same length + // as input string + // + // Returns false if given conversion is impossible, true otherwise + // (conversion may be impossible either if you try to convert + // to Unicode with non-Unicode build of wxWidgets or if input + // or output encoding is not supported.) + bool Init(wxFontEncoding input_enc, wxFontEncoding output_enc, int method = wxCONVERT_STRICT); + + // Convert input string according to settings passed to Init. + // Note that you must call Init before using Convert! + bool Convert(const char* input, char* output) const; + bool Convert(char* str) const { return Convert(str, str); } + wxString Convert(const wxString& input) const; + + bool Convert(const char* input, wchar_t* output) const; + bool Convert(const wchar_t* input, char* output) const; + bool Convert(const wchar_t* input, wchar_t* output) const; + bool Convert(wchar_t* str) const { return Convert(str, str); } + + // Return equivalent(s) for given font that are used + // under given platform. wxPLATFORM_CURRENT means the platform + // this binary was compiled for + // + // Examples: + // current platform enc returned value + // ----------------------------------------------------- + // unix CP1250 {ISO8859_2} + // unix ISO8859_2 {} + // windows ISO8859_2 {CP1250} + // + // Equivalence is defined in terms of convertibility: + // 2 encodings are equivalent if you can convert text between + // then without losing information (it may - and will - happen + // that you lose special chars like quotation marks or em-dashes + // but you shouldn't lose any diacritics and language-specific + // characters when converting between equivalent encodings). + // + // Convert() method is not limited to converting between + // equivalent encodings, it can convert between arbitrary + // two encodings! + // + // Remember that this function does _NOT_ check for presence of + // fonts in system. It only tells you what are most suitable + // encodings. (It usually returns only one encoding) + // + // Note that argument enc itself may be present in returned array! + // (so that you can -- as a side effect -- detect whether the + // encoding is native for this platform or not) + static wxFontEncodingArray GetPlatformEquivalents(wxFontEncoding enc, int platform = wxPLATFORM_CURRENT); + + // Similar to GetPlatformEquivalent, but this one will return ALL + // equivalent encodings, regardless the platform, including itself. + static wxFontEncodingArray GetAllEquivalents(wxFontEncoding enc); + + // Return true if [any text in] one multibyte encoding can be + // converted to another one losslessly. + // + // Do not call this with wxFONTENCODING_UNICODE, it doesn't make + // sense (always works in one sense and always depends on the text + // to convert in the other) + static bool CanConvert(wxFontEncoding encIn, wxFontEncoding encOut) + { + return GetAllEquivalents(encIn).Index(encOut) != wxNOT_FOUND; + } + + private: + wchar_t *m_Table; + bool m_UnicodeInput, m_UnicodeOutput; + bool m_JustCopy; + + wxDECLARE_NO_COPY_CLASS(wxEncodingConverter); +}; + +#endif // _WX_ENCCONV_H_ diff --git a/lib/wxWidgets/include/wx/encinfo.h b/lib/wxWidgets/include/wx/encinfo.h new file mode 100644 index 0000000..176da52 --- /dev/null +++ b/lib/wxWidgets/include/wx/encinfo.h @@ -0,0 +1,65 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/encinfo.h +// Purpose: declares wxNativeEncodingInfo struct +// Author: Vadim Zeitlin +// Modified by: +// Created: 19.09.2003 (extracted from wx/fontenc.h) +// Copyright: (c) 2003 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ENCINFO_H_ +#define _WX_ENCINFO_H_ + +#include "wx/string.h" + +// ---------------------------------------------------------------------------- +// wxNativeEncodingInfo contains all encoding parameters for this platform +// ---------------------------------------------------------------------------- + +// This private structure specifies all the parameters needed to create a font +// with the given encoding on this platform. +// +// Under X, it contains the last 2 elements of the font specifications +// (registry and encoding). +// +// Under Windows, it contains a number which is one of predefined XXX_CHARSET +// values (https://msdn.microsoft.com/en-us/library/cc250412.aspx). +// +// Under all platforms it also contains a facename string which should be +// used, if not empty, to create fonts in this encoding (this is the only way +// to create a font of non-standard encoding (like KOI8) under Windows - the +// facename specifies the encoding then) + +struct WXDLLIMPEXP_CORE wxNativeEncodingInfo +{ + wxString facename; // may be empty meaning "any" + wxFontEncoding encoding; // so that we know what this struct represents + +#if defined(__WXMSW__) || \ + defined(__WXMAC__) || \ + defined(__WXQT__) + + wxNativeEncodingInfo() + : facename() + , encoding(wxFONTENCODING_SYSTEM) + , charset(0) /* ANSI_CHARSET */ + { } + + int charset; +#elif defined(_WX_X_FONTLIKE) + wxString xregistry, + xencoding; +#elif defined(wxHAS_UTF8_FONTS) + // ports using UTF-8 for text don't need encoding information for fonts +#else + #error "Unsupported toolkit" +#endif + // this struct is saved in config by wxFontMapper, so it should know to + // serialise itself (implemented in platform-specific code) + bool FromString(const wxString& s); + wxString ToString() const; +}; + +#endif // _WX_ENCINFO_H_ + diff --git a/lib/wxWidgets/include/wx/event.h b/lib/wxWidgets/include/wx/event.h new file mode 100644 index 0000000..1be19c7 --- /dev/null +++ b/lib/wxWidgets/include/wx/event.h @@ -0,0 +1,4840 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/event.h +// Purpose: Event classes +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_EVENT_H_ +#define _WX_EVENT_H_ + +#include "wx/defs.h" +#include "wx/cpp.h" +#include "wx/object.h" +#include "wx/clntdata.h" +#include "wx/math.h" + +#if wxUSE_GUI + #include "wx/gdicmn.h" + #include "wx/cursor.h" + #include "wx/mousestate.h" +#endif + +#include "wx/dynarray.h" +#include "wx/thread.h" +#include "wx/tracker.h" +#include "wx/typeinfo.h" +#include "wx/any.h" +#include "wx/vector.h" + +#include "wx/meta/convertible.h" +#include "wx/meta/removeref.h" + +// This is now always defined, but keep it for backwards compatibility. +#define wxHAS_CALL_AFTER + +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_BASE wxList; +class WXDLLIMPEXP_FWD_BASE wxEvent; +class WXDLLIMPEXP_FWD_BASE wxEventFilter; +#if wxUSE_GUI + class WXDLLIMPEXP_FWD_CORE wxDC; + class WXDLLIMPEXP_FWD_CORE wxMenu; + class WXDLLIMPEXP_FWD_CORE wxWindow; + class WXDLLIMPEXP_FWD_CORE wxWindowBase; +#endif // wxUSE_GUI + +// We operate with pointer to members of wxEvtHandler (such functions are used +// as event handlers in the event tables or as arguments to Connect()) but by +// default MSVC uses a restricted (but more efficient) representation of +// pointers to members which can't deal with multiple base classes. To avoid +// mysterious (as the compiler is not good enough to detect this and give a +// sensible error message) errors in the user code as soon as it defines +// classes inheriting from both wxEvtHandler (possibly indirectly, e.g. via +// wxWindow) and something else (including our own wxTrackable but not limited +// to it), we use the special MSVC keyword telling the compiler to use a more +// general pointer to member representation for the classes inheriting from +// wxEvtHandler. +#ifdef __VISUALC__ + #define wxMSVC_FWD_MULTIPLE_BASES __multiple_inheritance +#else + #define wxMSVC_FWD_MULTIPLE_BASES +#endif + +class WXDLLIMPEXP_FWD_BASE wxMSVC_FWD_MULTIPLE_BASES wxEvtHandler; +class wxEventConnectionRef; + +// ---------------------------------------------------------------------------- +// Event types +// ---------------------------------------------------------------------------- + +typedef int wxEventType; + +#define wxEVT_ANY ((wxEventType)-1) + +// This macro exists for compatibility only (even though it was never public, +// it still appears in some code using wxWidgets), see public +// wxEVENT_HANDLER_CAST instead. +#define wxStaticCastEvent(type, val) static_cast(val) + +#define wxDECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \ + wxEventTableEntry(type, winid, idLast, wxNewEventTableFunctor(type, fn), obj) + +#define wxDECLARE_EVENT_TABLE_TERMINATOR() \ + wxEventTableEntry(wxEVT_NULL, 0, 0, NULL, NULL) + +// generate a new unique event type +extern WXDLLIMPEXP_BASE wxEventType wxNewEventType(); + +// events are represented by an instance of wxEventTypeTag and the +// corresponding type must be specified for type-safety checks + +// define a new custom event type, can be used alone or after event +// declaration in the header using one of the macros below +#define wxDEFINE_EVENT( name, type ) \ + const wxEventTypeTag< type > name( wxNewEventType() ) + +// the general version allowing exporting the event type from DLL, used by +// wxWidgets itself +#define wxDECLARE_EXPORTED_EVENT( expdecl, name, type ) \ + extern const expdecl wxEventTypeTag< type > name + +// this is the version which will normally be used in the user code +#define wxDECLARE_EVENT( name, type ) \ + wxDECLARE_EXPORTED_EVENT( wxEMPTY_PARAMETER_VALUE, name, type ) + + +// these macros are only used internally for backwards compatibility and +// allow to define an alias for an existing event type (this is used by +// wxEVT_SPIN_XXX) +#define wxDEFINE_EVENT_ALIAS( name, type, value ) \ + const wxEventTypeTag< type > name( value ) + +#define wxDECLARE_EXPORTED_EVENT_ALIAS( expdecl, name, type ) \ + extern const expdecl wxEventTypeTag< type > name + +// The type-erased method signature used for event handling. +typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&); + +template +inline wxEventFunction wxEventFunctionCast(void (wxEvtHandler::*func)(T&)) +{ + // There is no going around the cast here: we do rely calling the event + // handler method, which takes a reference to an object of a class derived + // from wxEvent, as if it took wxEvent itself. On all platforms supported + // by wxWidgets, this cast is harmless, but it's not a valid cast in C++ + // and gcc 8 started giving warnings about this (with -Wextra), so suppress + // them locally to avoid generating hundreds of them when compiling any + // code using event table macros. + + wxGCC_WARNING_SUPPRESS_CAST_FUNCTION_TYPE() + + return reinterpret_cast(func); + + wxGCC_WARNING_RESTORE_CAST_FUNCTION_TYPE() +} + +// In good old pre-C++17 times we could just static_cast the event handler, +// defined in some class deriving from wxEvtHandler, to the "functype" which is +// a type of wxEvtHandler method. But with C++17 this doesn't work when the +// handler is a noexcept function, so we need to cast it to a noexcept function +// pointer first. +#if wxCHECK_CXX_STD(201703L) + +namespace wxPrivate +{ + +// Cast to noexcept function type first if necessary. +template +constexpr auto DoCast(void (C::*pmf)(E&)) +{ + return static_cast(pmf); +} + +template +constexpr auto DoCast(void (C::*pmf)(E&) noexcept) +{ + return static_cast( + static_cast(pmf) + ); +} + +// Helper used to recover the type of the handler argument from the function +// type. This is required in order to explicitly pass this type to DoCast<> as +// the compiler would be unable to deduce it for overloaded functions. + +// Generic template version, doing nothing. +template +struct EventArgOf; + +// Specialization sufficient to cover all event handler function types. +template +struct EventArgOf +{ + using type = E; +}; + + +} // namespace wxPrivate + +#define wxEventHandlerNoexceptCast(functype, pmf) \ + wxPrivate::DoCast::type>(pmf) +#else +#define wxEventHandlerNoexceptCast(functype, pmf) static_cast(pmf) +#endif + +// Try to cast the given event handler to the correct handler type: +#define wxEVENT_HANDLER_CAST( functype, func ) \ + wxEventFunctionCast(wxEventHandlerNoexceptCast(functype, &func)) + + +// The tag is a type associated to the event type (which is an integer itself, +// in spite of its name) value. It exists in order to be used as a template +// parameter and provide a mapping between the event type values and their +// corresponding wxEvent-derived classes. +template +class wxEventTypeTag +{ +public: + // The class of wxEvent-derived class carried by the events of this type. + typedef T EventClass; + + wxEventTypeTag(wxEventType type) : m_type(type) { } + + // Return a wxEventType reference for the initialization of the static + // event tables. See wxEventTableEntry::m_eventType for a more thorough + // explanation. + operator const wxEventType&() const { return m_type; } + +private: + wxEventType m_type; +}; + +// We had some trouble with using wxEventFunction +// in the past so we had introduced wxObjectEventFunction which +// used to be a typedef for a member of wxObject and not wxEvtHandler to work +// around this but as eVC is not really supported any longer we now only keep +// this for backwards compatibility and, despite its name, this is a typedef +// for wxEvtHandler member now -- but if we have the same problem with another +// compiler we can restore its old definition for it. +typedef wxEventFunction wxObjectEventFunction; + +// The event functor which is stored in the static and dynamic event tables: +class WXDLLIMPEXP_BASE wxEventFunctor +{ +public: + virtual ~wxEventFunctor(); + + // Invoke the actual event handler: + virtual void operator()(wxEvtHandler *, wxEvent&) = 0; + + // this function tests whether this functor is matched, for the purpose of + // finding it in an event table in Unbind(), by the given functor: + virtual bool IsMatching(const wxEventFunctor& functor) const = 0; + + // If the functor holds an wxEvtHandler, then get access to it and track + // its lifetime with wxEventConnectionRef: + virtual wxEvtHandler *GetEvtHandler() const + { return NULL; } + + // This is only used to maintain backward compatibility in + // wxAppConsoleBase::CallEventHandler and ensures that an overwritten + // wxAppConsoleBase::HandleEvent is still called for functors which hold an + // wxEventFunction: + virtual wxEventFunction GetEvtMethod() const + { return NULL; } + +private: + WX_DECLARE_ABSTRACT_TYPEINFO(wxEventFunctor) +}; + +// A plain method functor for the untyped legacy event types: +class wxObjectEventFunctor : public wxEventFunctor +{ +public: + wxObjectEventFunctor(wxObjectEventFunction method, wxEvtHandler *handler) + : m_handler( handler ), m_method( method ) + { } + + virtual void operator()(wxEvtHandler *handler, wxEvent& event) wxOVERRIDE; + + virtual bool IsMatching(const wxEventFunctor& functor) const wxOVERRIDE + { + if ( wxTypeId(functor) == wxTypeId(*this) ) + { + const wxObjectEventFunctor &other = + static_cast< const wxObjectEventFunctor & >( functor ); + + return ( m_method == other.m_method || !other.m_method ) && + ( m_handler == other.m_handler || !other.m_handler ); + } + else + return false; + } + + virtual wxEvtHandler *GetEvtHandler() const wxOVERRIDE + { return m_handler; } + + virtual wxEventFunction GetEvtMethod() const wxOVERRIDE + { return m_method; } + +private: + wxEvtHandler *m_handler; + wxEventFunction m_method; + + // Provide a dummy default ctor for type info purposes + wxObjectEventFunctor() : m_handler(NULL), m_method(NULL) { } + + WX_DECLARE_TYPEINFO_INLINE(wxObjectEventFunctor) +}; + +// Create a functor for the legacy events: used by Connect() +inline wxObjectEventFunctor * +wxNewEventFunctor(const wxEventType& WXUNUSED(evtType), + wxObjectEventFunction method, + wxEvtHandler *handler) +{ + return new wxObjectEventFunctor(method, handler); +} + +// This version is used by wxDECLARE_EVENT_TABLE_ENTRY() +inline wxObjectEventFunctor * +wxNewEventTableFunctor(const wxEventType& WXUNUSED(evtType), + wxObjectEventFunction method) +{ + return new wxObjectEventFunctor(method, NULL); +} + +inline wxObjectEventFunctor +wxMakeEventFunctor(const wxEventType& WXUNUSED(evtType), + wxObjectEventFunction method, + wxEvtHandler *handler) +{ + return wxObjectEventFunctor(method, handler); +} + +namespace wxPrivate +{ + +// helper template defining nested "type" typedef as the event class +// corresponding to the given event type +template struct EventClassOf; + +// the typed events provide the information about the class of the events they +// carry themselves: +template +struct EventClassOf< wxEventTypeTag > +{ + typedef typename wxEventTypeTag::EventClass type; +}; + +// for the old untyped events we don't have information about the exact event +// class carried by them +template <> +struct EventClassOf +{ + typedef wxEvent type; +}; + + +// helper class defining operations different for method functors using an +// object of wxEvtHandler-derived class as handler and the others +template struct HandlerImpl; + +// specialization for handlers deriving from wxEvtHandler +template +struct HandlerImpl +{ + static bool IsEvtHandler() + { return true; } + static T *ConvertFromEvtHandler(wxEvtHandler *p) + { return static_cast(p); } + static wxEvtHandler *ConvertToEvtHandler(T *p) + { return p; } + static wxEventFunction ConvertToEvtMethod(void (T::*f)(A&)) + { return wxEventFunctionCast( + static_cast(f)); } +}; + +// specialization for handlers not deriving from wxEvtHandler +template +struct HandlerImpl +{ + static bool IsEvtHandler() + { return false; } + static T *ConvertFromEvtHandler(wxEvtHandler *) + { return NULL; } + static wxEvtHandler *ConvertToEvtHandler(T *) + { return NULL; } + static wxEventFunction ConvertToEvtMethod(void (T::*)(A&)) + { return NULL; } +}; + +} // namespace wxPrivate + +// functor forwarding the event to a method of the given object +// +// notice that the object class may be different from the class in which the +// method is defined but it must be convertible to this class +// +// also, the type of the handler parameter doesn't need to be exactly the same +// as EventTag::EventClass but it must be its base class -- this is explicitly +// allowed to handle different events in the same handler taking wxEvent&, for +// example +template + +class wxEventFunctorMethod + : public wxEventFunctor, + private wxPrivate::HandlerImpl + < + Class, + EventArg, + wxIsPubliclyDerived::value != 0 + > +{ +private: + static void CheckHandlerArgument(EventArg *) { } + +public: + // the event class associated with the given event tag + typedef typename wxPrivate::EventClassOf::type EventClass; + + + wxEventFunctorMethod(void (Class::*method)(EventArg&), EventHandler *handler) + : m_handler( handler ), m_method( method ) + { + wxASSERT_MSG( handler || this->IsEvtHandler(), + "handlers defined in non-wxEvtHandler-derived classes " + "must be connected with a valid sink object" ); + + // if you get an error here it means that the signature of the handler + // you're trying to use is not compatible with (i.e. is not the same as + // or a base class of) the real event class used for this event type + CheckHandlerArgument(static_cast(NULL)); + } + + virtual void operator()(wxEvtHandler *handler, wxEvent& event) wxOVERRIDE + { + Class * realHandler = m_handler; + if ( !realHandler ) + { + realHandler = this->ConvertFromEvtHandler(handler); + + // this is not supposed to happen but check for it nevertheless + wxCHECK_RET( realHandler, "invalid event handler" ); + } + + // the real (run-time) type of event is EventClass and we checked in + // the ctor that EventClass can be converted to EventArg, so this cast + // is always valid + (realHandler->*m_method)(static_cast(event)); + } + + virtual bool IsMatching(const wxEventFunctor& functor) const wxOVERRIDE + { + if ( wxTypeId(functor) != wxTypeId(*this) ) + return false; + + typedef wxEventFunctorMethod + ThisFunctor; + + // the cast is valid because wxTypeId()s matched above + const ThisFunctor& other = static_cast(functor); + + return (m_method == other.m_method || other.m_method == NULL) && + (m_handler == other.m_handler || other.m_handler == NULL); + } + + virtual wxEvtHandler *GetEvtHandler() const wxOVERRIDE + { return this->ConvertToEvtHandler(m_handler); } + + virtual wxEventFunction GetEvtMethod() const wxOVERRIDE + { return this->ConvertToEvtMethod(m_method); } + +private: + EventHandler *m_handler; + void (Class::*m_method)(EventArg&); + + // Provide a dummy default ctor for type info purposes + wxEventFunctorMethod() { } + + typedef wxEventFunctorMethod thisClass; + WX_DECLARE_TYPEINFO_INLINE(thisClass) +}; + + +// functor forwarding the event to function (function, static method) +template +class wxEventFunctorFunction : public wxEventFunctor +{ +private: + static void CheckHandlerArgument(EventArg *) { } + +public: + // the event class associated with the given event tag + typedef typename wxPrivate::EventClassOf::type EventClass; + + wxEventFunctorFunction( void ( *handler )( EventArg & )) + : m_handler( handler ) + { + // if you get an error here it means that the signature of the handler + // you're trying to use is not compatible with (i.e. is not the same as + // or a base class of) the real event class used for this event type + CheckHandlerArgument(static_cast(NULL)); + } + + virtual void operator()(wxEvtHandler *WXUNUSED(handler), wxEvent& event) wxOVERRIDE + { + // If you get an error here like "must use .* or ->* to call + // pointer-to-member function" then you probably tried to call + // Bind/Unbind with a method pointer but without a handler pointer or + // NULL as a handler e.g.: + // Unbind( wxEVT_XXX, &EventHandler::method ); + // or + // Unbind( wxEVT_XXX, &EventHandler::method, NULL ) + m_handler(static_cast(event)); + } + + virtual bool IsMatching(const wxEventFunctor &functor) const wxOVERRIDE + { + if ( wxTypeId(functor) != wxTypeId(*this) ) + return false; + + typedef wxEventFunctorFunction ThisFunctor; + + const ThisFunctor& other = static_cast( functor ); + + return m_handler == other.m_handler; + } + +private: + void (*m_handler)(EventArg&); + + // Provide a dummy default ctor for type info purposes + wxEventFunctorFunction() { } + + typedef wxEventFunctorFunction thisClass; + WX_DECLARE_TYPEINFO_INLINE(thisClass) +}; + + +template +class wxEventFunctorFunctor : public wxEventFunctor +{ +public: + typedef typename EventTag::EventClass EventArg; + + wxEventFunctorFunctor(const Functor& handler) + : m_handler(handler), m_handlerAddr(&handler) + { } + + virtual void operator()(wxEvtHandler *WXUNUSED(handler), wxEvent& event) wxOVERRIDE + { + // If you get an error here like "must use '.*' or '->*' to call + // pointer-to-member function" then you probably tried to call + // Bind/Unbind with a method pointer but without a handler pointer or + // NULL as a handler e.g.: + // Unbind( wxEVT_XXX, &EventHandler::method ); + // or + // Unbind( wxEVT_XXX, &EventHandler::method, NULL ) + m_handler(static_cast(event)); + } + + virtual bool IsMatching(const wxEventFunctor &functor) const wxOVERRIDE + { + if ( wxTypeId(functor) != wxTypeId(*this) ) + return false; + + typedef wxEventFunctorFunctor FunctorThis; + + const FunctorThis& other = static_cast(functor); + + // The only reliable/portable way to compare two functors is by + // identity: + return m_handlerAddr == other.m_handlerAddr; + } + +private: + // Store a copy of the functor to prevent using/calling an already + // destroyed instance: + Functor m_handler; + + // Use the address of the original functor for comparison in IsMatching: + const void *m_handlerAddr; + + // Provide a dummy default ctor for type info purposes + wxEventFunctorFunctor() { } + + typedef wxEventFunctorFunctor thisClass; + WX_DECLARE_TYPEINFO_INLINE(thisClass) +}; + +// Create functors for the templatized events, either allocated on the heap for +// wxNewXXX() variants (this is needed in wxEvtHandler::Bind<>() to store them +// in dynamic event table) or just by returning them as temporary objects (this +// is enough for Unbind<>() and we avoid unnecessary heap allocation like this). + + +// Create functors wrapping functions: +template +inline wxEventFunctorFunction * +wxNewEventFunctor(const EventTag&, void (*func)(EventArg &)) +{ + return new wxEventFunctorFunction(func); +} + +template +inline wxEventFunctorFunction +wxMakeEventFunctor(const EventTag&, void (*func)(EventArg &)) +{ + return wxEventFunctorFunction(func); +} + +// Create functors wrapping other functors: +template +inline wxEventFunctorFunctor * +wxNewEventFunctor(const EventTag&, const Functor &func) +{ + return new wxEventFunctorFunctor(func); +} + +template +inline wxEventFunctorFunctor +wxMakeEventFunctor(const EventTag&, const Functor &func) +{ + return wxEventFunctorFunctor(func); +} + +// Create functors wrapping methods: +template + +inline wxEventFunctorMethod * +wxNewEventFunctor(const EventTag&, + void (Class::*method)(EventArg&), + EventHandler *handler) +{ + return new wxEventFunctorMethod( + method, handler); +} + +template + +inline wxEventFunctorMethod +wxMakeEventFunctor(const EventTag&, + void (Class::*method)(EventArg&), + EventHandler *handler) +{ + return wxEventFunctorMethod( + method, handler); +} + +// Create an event functor for the event table via wxDECLARE_EVENT_TABLE_ENTRY: +// in this case we don't have the handler (as it's always the same as the +// object which generated the event) so we must use Class as its type +template +inline wxEventFunctorMethod * +wxNewEventTableFunctor(const EventTag&, void (Class::*method)(EventArg&)) +{ + return new wxEventFunctorMethod( + method, NULL); +} + + +// many, but not all, standard event types + + // some generic events +extern WXDLLIMPEXP_BASE const wxEventType wxEVT_NULL; +extern WXDLLIMPEXP_BASE const wxEventType wxEVT_FIRST; +extern WXDLLIMPEXP_BASE const wxEventType wxEVT_USER_FIRST; + + // Need events declared to do this +class WXDLLIMPEXP_FWD_BASE wxIdleEvent; +class WXDLLIMPEXP_FWD_BASE wxThreadEvent; +class WXDLLIMPEXP_FWD_BASE wxAsyncMethodCallEvent; +class WXDLLIMPEXP_FWD_CORE wxCommandEvent; +class WXDLLIMPEXP_FWD_CORE wxMouseEvent; +class WXDLLIMPEXP_FWD_CORE wxFocusEvent; +class WXDLLIMPEXP_FWD_CORE wxChildFocusEvent; +class WXDLLIMPEXP_FWD_CORE wxKeyEvent; +class WXDLLIMPEXP_FWD_CORE wxNavigationKeyEvent; +class WXDLLIMPEXP_FWD_CORE wxSetCursorEvent; +class WXDLLIMPEXP_FWD_CORE wxScrollEvent; +class WXDLLIMPEXP_FWD_CORE wxSpinEvent; +class WXDLLIMPEXP_FWD_CORE wxScrollWinEvent; +class WXDLLIMPEXP_FWD_CORE wxSizeEvent; +class WXDLLIMPEXP_FWD_CORE wxMoveEvent; +class WXDLLIMPEXP_FWD_CORE wxCloseEvent; +class WXDLLIMPEXP_FWD_CORE wxActivateEvent; +class WXDLLIMPEXP_FWD_CORE wxWindowCreateEvent; +class WXDLLIMPEXP_FWD_CORE wxWindowDestroyEvent; +class WXDLLIMPEXP_FWD_CORE wxShowEvent; +class WXDLLIMPEXP_FWD_CORE wxIconizeEvent; +class WXDLLIMPEXP_FWD_CORE wxMaximizeEvent; +class WXDLLIMPEXP_FWD_CORE wxFullScreenEvent; +class WXDLLIMPEXP_FWD_CORE wxMouseCaptureChangedEvent; +class WXDLLIMPEXP_FWD_CORE wxMouseCaptureLostEvent; +class WXDLLIMPEXP_FWD_CORE wxPaintEvent; +class WXDLLIMPEXP_FWD_CORE wxEraseEvent; +class WXDLLIMPEXP_FWD_CORE wxNcPaintEvent; +class WXDLLIMPEXP_FWD_CORE wxMenuEvent; +class WXDLLIMPEXP_FWD_CORE wxContextMenuEvent; +class WXDLLIMPEXP_FWD_CORE wxSysColourChangedEvent; +class WXDLLIMPEXP_FWD_CORE wxDisplayChangedEvent; +class WXDLLIMPEXP_FWD_CORE wxDPIChangedEvent; +class WXDLLIMPEXP_FWD_CORE wxQueryNewPaletteEvent; +class WXDLLIMPEXP_FWD_CORE wxPaletteChangedEvent; +class WXDLLIMPEXP_FWD_CORE wxJoystickEvent; +class WXDLLIMPEXP_FWD_CORE wxDropFilesEvent; +class WXDLLIMPEXP_FWD_CORE wxInitDialogEvent; +class WXDLLIMPEXP_FWD_CORE wxUpdateUIEvent; +class WXDLLIMPEXP_FWD_CORE wxClipboardTextEvent; +class WXDLLIMPEXP_FWD_CORE wxHelpEvent; +class WXDLLIMPEXP_FWD_CORE wxGestureEvent; +class WXDLLIMPEXP_FWD_CORE wxPanGestureEvent; +class WXDLLIMPEXP_FWD_CORE wxZoomGestureEvent; +class WXDLLIMPEXP_FWD_CORE wxRotateGestureEvent; +class WXDLLIMPEXP_FWD_CORE wxTwoFingerTapEvent; +class WXDLLIMPEXP_FWD_CORE wxLongPressEvent; +class WXDLLIMPEXP_FWD_CORE wxPressAndTapEvent; + + + // Command events +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_BUTTON, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHECKBOX, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHOICE, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LISTBOX, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LISTBOX_DCLICK, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHECKLISTBOX, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SLIDER, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RADIOBOX, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RADIOBUTTON, wxCommandEvent); + +// wxEVT_SCROLLBAR is deprecated, use wxEVT_SCROLL... events +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLBAR, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_VLBOX, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMBOBOX, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TOOL_RCLICKED, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TOOL_DROPDOWN, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TOOL_ENTER, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMBOBOX_DROPDOWN, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMBOBOX_CLOSEUP, wxCommandEvent); + + // Thread and asynchronous method call events +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_THREAD, wxThreadEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_ASYNC_METHOD_CALL, wxAsyncMethodCallEvent); + + // Mouse event types +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEFT_DOWN, wxMouseEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEFT_UP, wxMouseEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MIDDLE_DOWN, wxMouseEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MIDDLE_UP, wxMouseEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RIGHT_DOWN, wxMouseEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RIGHT_UP, wxMouseEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOTION, wxMouseEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ENTER_WINDOW, wxMouseEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEAVE_WINDOW, wxMouseEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEFT_DCLICK, wxMouseEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MIDDLE_DCLICK, wxMouseEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RIGHT_DCLICK, wxMouseEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SET_FOCUS, wxFocusEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_KILL_FOCUS, wxFocusEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHILD_FOCUS, wxChildFocusEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOUSEWHEEL, wxMouseEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX1_DOWN, wxMouseEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX1_UP, wxMouseEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX1_DCLICK, wxMouseEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_DOWN, wxMouseEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_UP, wxMouseEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_DCLICK, wxMouseEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MAGNIFY, wxMouseEvent); + + // Character input event type +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHAR, wxKeyEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHAR_HOOK, wxKeyEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_NAVIGATION_KEY, wxNavigationKeyEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_KEY_DOWN, wxKeyEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_KEY_UP, wxKeyEvent); +#if wxUSE_HOTKEY +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_HOTKEY, wxKeyEvent); +#endif +// This is a private event used by wxMSW code only and subject to change or +// disappear in the future. Don't use. +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AFTER_CHAR, wxKeyEvent); + + // Set cursor event +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SET_CURSOR, wxSetCursorEvent); + + // wxScrollBar and wxSlider event identifiers +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_TOP, wxScrollEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_BOTTOM, wxScrollEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_LINEUP, wxScrollEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_LINEDOWN, wxScrollEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_PAGEUP, wxScrollEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_PAGEDOWN, wxScrollEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_THUMBTRACK, wxScrollEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_THUMBRELEASE, wxScrollEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_CHANGED, wxScrollEvent); + +// Due to a bug in older wx versions, wxSpinEvents were being sent with type of +// wxEVT_SCROLL_LINEUP, wxEVT_SCROLL_LINEDOWN and wxEVT_SCROLL_THUMBTRACK. But +// with the type-safe events in place, these event types are associated with +// wxScrollEvent. To allow handling of spin events, new event types have been +// defined in spinbutt.h/spinnbuttcmn.cpp. To maintain backward compatibility +// the spin event types are being initialized with the scroll event types. + +#if wxUSE_SPINBTN + +wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE, wxEVT_SPIN_UP, wxSpinEvent ); +wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE, wxEVT_SPIN_DOWN, wxSpinEvent ); +wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE, wxEVT_SPIN, wxSpinEvent ); + +#endif + + // Scroll events from wxWindow +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_TOP, wxScrollWinEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_BOTTOM, wxScrollWinEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_LINEUP, wxScrollWinEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_LINEDOWN, wxScrollWinEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_PAGEUP, wxScrollWinEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_PAGEDOWN, wxScrollWinEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_THUMBRELEASE, wxScrollWinEvent); + + // Gesture events +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_GESTURE_PAN, wxPanGestureEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_GESTURE_ZOOM, wxZoomGestureEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_GESTURE_ROTATE, wxRotateGestureEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TWO_FINGER_TAP, wxTwoFingerTapEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LONG_PRESS, wxLongPressEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_PRESS_AND_TAP, wxPressAndTapEvent); + + // System events +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SIZE, wxSizeEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVE, wxMoveEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CLOSE_WINDOW, wxCloseEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_END_SESSION, wxCloseEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_QUERY_END_SESSION, wxCloseEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ACTIVATE_APP, wxActivateEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ACTIVATE, wxActivateEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CREATE, wxWindowCreateEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DESTROY, wxWindowDestroyEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SHOW, wxShowEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ICONIZE, wxIconizeEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MAXIMIZE, wxMaximizeEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_FULLSCREEN, wxFullScreenEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOUSE_CAPTURE_CHANGED, wxMouseCaptureChangedEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOUSE_CAPTURE_LOST, wxMouseCaptureLostEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_PAINT, wxPaintEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ERASE_BACKGROUND, wxEraseEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_NC_PAINT, wxNcPaintEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU_OPEN, wxMenuEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU_CLOSE, wxMenuEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU_HIGHLIGHT, wxMenuEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CONTEXT_MENU, wxContextMenuEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SYS_COLOUR_CHANGED, wxSysColourChangedEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DISPLAY_CHANGED, wxDisplayChangedEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DPI_CHANGED, wxDPIChangedEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_QUERY_NEW_PALETTE, wxQueryNewPaletteEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_PALETTE_CHANGED, wxPaletteChangedEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_BUTTON_DOWN, wxJoystickEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_BUTTON_UP, wxJoystickEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_MOVE, wxJoystickEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_ZMOVE, wxJoystickEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DROP_FILES, wxDropFilesEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_INIT_DIALOG, wxInitDialogEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_IDLE, wxIdleEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_UPDATE_UI, wxUpdateUIEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SIZING, wxSizeEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVING, wxMoveEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVE_START, wxMoveEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVE_END, wxMoveEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_HIBERNATE, wxActivateEvent); + + // Clipboard events +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT_COPY, wxClipboardTextEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT_CUT, wxClipboardTextEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT_PASTE, wxClipboardTextEvent); + + // Generic command events + // Note: a click is a higher-level event than button down/up +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_LEFT_CLICK, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_LEFT_DCLICK, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_RIGHT_CLICK, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_RIGHT_DCLICK, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_SET_FOCUS, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_KILL_FOCUS, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_ENTER, wxCommandEvent); + + // Help events +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_HELP, wxHelpEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DETAILED_HELP, wxHelpEvent); + +// these 2 events are the same +#define wxEVT_TOOL wxEVT_MENU + +// ---------------------------------------------------------------------------- +// Compatibility +// ---------------------------------------------------------------------------- + +// this event is also used by wxComboBox and wxSpinCtrl which don't include +// wx/textctrl.h in all ports [yet], so declare it here as well +// +// still, any new code using it should include wx/textctrl.h explicitly +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT, wxCommandEvent); + + +// ---------------------------------------------------------------------------- +// wxEvent(-derived) classes +// ---------------------------------------------------------------------------- + +// the predefined constants for the number of times we propagate event +// upwards window child-parent chain +enum wxEventPropagation +{ + // don't propagate it at all + wxEVENT_PROPAGATE_NONE = 0, + + // propagate it until it is processed + wxEVENT_PROPAGATE_MAX = INT_MAX +}; + +// The different categories for a wxEvent; see wxEvent::GetEventCategory. +// NOTE: they are used as OR-combinable flags by wxEventLoopBase::YieldFor +enum wxEventCategory +{ + // this is the category for those events which are generated to update + // the appearance of the GUI but which (usually) do not comport data + // processing, i.e. which do not provide input or output data + // (e.g. size events, scroll events, etc). + // They are events NOT directly generated by the user's input devices. + wxEVT_CATEGORY_UI = 1, + + // this category groups those events which are generated directly from the + // user through input devices like mouse and keyboard and usually result in + // data to be processed from the application. + // (e.g. mouse clicks, key presses, etc) + wxEVT_CATEGORY_USER_INPUT = 2, + + // this category is for wxSocketEvent + wxEVT_CATEGORY_SOCKET = 4, + + // this category is for wxTimerEvent + wxEVT_CATEGORY_TIMER = 8, + + // this category is for any event used to send notifications from the + // secondary threads to the main one or in general for notifications among + // different threads (which may or may not be user-generated) + wxEVT_CATEGORY_THREAD = 16, + + + // implementation only + + // used in the implementations of wxEventLoopBase::YieldFor + wxEVT_CATEGORY_UNKNOWN = 32, + + // a special category used as an argument to wxEventLoopBase::YieldFor to indicate that + // Yield() should leave all wxEvents on the queue while emptying the native event queue + // (native events will be processed but the wxEvents they generate will be queued) + wxEVT_CATEGORY_CLIPBOARD = 64, + + + // shortcut masks + + // this category groups those events which are emitted in response to + // events of the native toolkit and which typically are not-"delayable". + wxEVT_CATEGORY_NATIVE_EVENTS = wxEVT_CATEGORY_UI|wxEVT_CATEGORY_USER_INPUT, + + // used in wxEventLoopBase::YieldFor to specify all event categories should be processed: + wxEVT_CATEGORY_ALL = + wxEVT_CATEGORY_UI|wxEVT_CATEGORY_USER_INPUT|wxEVT_CATEGORY_SOCKET| \ + wxEVT_CATEGORY_TIMER|wxEVT_CATEGORY_THREAD|wxEVT_CATEGORY_UNKNOWN| \ + wxEVT_CATEGORY_CLIPBOARD +}; + +/* + * wxWidgets events, covering all interesting things that might happen + * (button clicking, resizing, setting text in widgets, etc.). + * + * For each completely new event type, derive a new event class. + * An event CLASS represents a C++ class defining a range of similar event TYPES; + * examples are canvas events, panel item command events. + * An event TYPE is a unique identifier for a particular system event, + * such as a button press or a listbox deselection. + * + */ + +class WXDLLIMPEXP_BASE wxEvent : public wxObject +{ +public: + wxEvent(int winid = 0, wxEventType commandType = wxEVT_NULL ); + + void SetEventType(wxEventType typ) { m_eventType = typ; } + wxEventType GetEventType() const { return m_eventType; } + + wxObject *GetEventObject() const { return m_eventObject; } + void SetEventObject(wxObject *obj) { m_eventObject = obj; } + + long GetTimestamp() const { return m_timeStamp; } + void SetTimestamp(long ts = 0) { m_timeStamp = ts; } + + int GetId() const { return m_id; } + void SetId(int Id) { m_id = Id; } + + // Returns the user data optionally associated with the event handler when + // using Connect() or Bind(). + wxObject *GetEventUserData() const { return m_callbackUserData; } + + // Can instruct event processor that we wish to ignore this event + // (treat as if the event table entry had not been found): this must be done + // to allow the event processing by the base classes (calling event.Skip() + // is the analog of calling the base class version of a virtual function) + void Skip(bool skip = true) { m_skipped = skip; } + bool GetSkipped() const { return m_skipped; } + + // This function is used to create a copy of the event polymorphically and + // all derived classes must implement it because otherwise wxPostEvent() + // for them wouldn't work (it needs to do a copy of the event) + virtual wxEvent *Clone() const = 0; + + // this function is used to selectively process events in wxEventLoopBase::YieldFor + // NOTE: by default it returns wxEVT_CATEGORY_UI just because the major + // part of wxWidgets events belong to that category. + virtual wxEventCategory GetEventCategory() const + { return wxEVT_CATEGORY_UI; } + + // Implementation only: this test is explicitly anti OO and this function + // exists only for optimization purposes. + bool IsCommandEvent() const { return m_isCommandEvent; } + + // Determine if this event should be propagating to the parent window. + bool ShouldPropagate() const + { return m_propagationLevel != wxEVENT_PROPAGATE_NONE; } + + // Stop an event from propagating to its parent window, returns the old + // propagation level value + int StopPropagation() + { + const int propagationLevel = m_propagationLevel; + m_propagationLevel = wxEVENT_PROPAGATE_NONE; + return propagationLevel; + } + + // Resume the event propagation by restoring the propagation level + // (returned by StopPropagation()) + void ResumePropagation(int propagationLevel) + { + m_propagationLevel = propagationLevel; + } + + // This method is for internal use only and allows to get the object that + // is propagating this event upwards the window hierarchy, if any. + wxEvtHandler* GetPropagatedFrom() const { return m_propagatedFrom; } + + // This is for internal use only and is only called by + // wxEvtHandler::ProcessEvent() to check whether it's the first time this + // event is being processed + bool WasProcessed() + { + if ( m_wasProcessed ) + return true; + + m_wasProcessed = true; + + return false; + } + + // This is for internal use only and is used for setting, testing and + // resetting of m_willBeProcessedAgain flag. + void SetWillBeProcessedAgain() + { + m_willBeProcessedAgain = true; + } + + bool WillBeProcessedAgain() + { + if ( m_willBeProcessedAgain ) + { + m_willBeProcessedAgain = false; + return true; + } + + return false; + } + + // This is also used only internally by ProcessEvent() to check if it + // should process the event normally or only restrict the search for the + // event handler to this object itself. + bool ShouldProcessOnlyIn(wxEvtHandler *h) const + { + return h == m_handlerToProcessOnlyIn; + } + + // Called to indicate that the result of ShouldProcessOnlyIn() wasn't taken + // into account. The existence of this function may seem counterintuitive + // but unfortunately it's needed by wxScrollHelperEvtHandler, see comments + // there. Don't even think of using this in your own code, this is a gross + // hack and is only needed because of wx complicated history and should + // never be used anywhere else. + void DidntHonourProcessOnlyIn() + { + m_handlerToProcessOnlyIn = NULL; + } + +protected: + wxObject* m_eventObject; + wxEventType m_eventType; + long m_timeStamp; + int m_id; + +public: + // m_callbackUserData is for internal usage only + wxObject* m_callbackUserData; + +private: + // If this handler + wxEvtHandler *m_handlerToProcessOnlyIn; + +protected: + // the propagation level: while it is positive, we propagate the event to + // the parent window (if any) + int m_propagationLevel; + + // The object that the event is being propagated from, initially NULL and + // only set by wxPropagateOnce. + wxEvtHandler* m_propagatedFrom; + + bool m_skipped; + bool m_isCommandEvent; + + // initially false but becomes true as soon as WasProcessed() is called for + // the first time, as this is done only by ProcessEvent() it explains the + // variable name: it becomes true after ProcessEvent() was called at least + // once for this event + bool m_wasProcessed; + + // This one is initially false too, but can be set to true to indicate that + // the event will be passed to another handler if it's not processed in + // this one. + bool m_willBeProcessedAgain; + +protected: + wxEvent(const wxEvent&); // for implementing Clone() + wxEvent& operator=(const wxEvent&); // for derived classes operator=() + +private: + // It needs to access our m_propagationLevel and m_propagatedFrom fields. + friend class WXDLLIMPEXP_FWD_BASE wxPropagateOnce; + + // and this one needs to access our m_handlerToProcessOnlyIn + friend class WXDLLIMPEXP_FWD_BASE wxEventProcessInHandlerOnly; + + + wxDECLARE_ABSTRACT_CLASS(wxEvent); +}; + +/* + * Helper class to temporarily change an event not to propagate. + */ +class WXDLLIMPEXP_BASE wxPropagationDisabler +{ +public: + wxPropagationDisabler(wxEvent& event) : m_event(event) + { + m_propagationLevelOld = m_event.StopPropagation(); + } + + ~wxPropagationDisabler() + { + m_event.ResumePropagation(m_propagationLevelOld); + } + +private: + wxEvent& m_event; + int m_propagationLevelOld; + + wxDECLARE_NO_COPY_CLASS(wxPropagationDisabler); +}; + +/* + * Helper used to indicate that an event is propagated upwards the window + * hierarchy by the given window. + */ +class WXDLLIMPEXP_BASE wxPropagateOnce +{ +public: + // The handler argument should normally be non-NULL to allow the parent + // event handler to know that it's being used to process an event coming + // from the child, it's only NULL by default for backwards compatibility. + wxPropagateOnce(wxEvent& event, wxEvtHandler* handler = NULL) + : m_event(event), + m_propagatedFromOld(event.m_propagatedFrom) + { + wxASSERT_MSG( m_event.m_propagationLevel > 0, + wxT("shouldn't be used unless ShouldPropagate()!") ); + + m_event.m_propagationLevel--; + m_event.m_propagatedFrom = handler; + } + + ~wxPropagateOnce() + { + m_event.m_propagatedFrom = m_propagatedFromOld; + m_event.m_propagationLevel++; + } + +private: + wxEvent& m_event; + wxEvtHandler* const m_propagatedFromOld; + + wxDECLARE_NO_COPY_CLASS(wxPropagateOnce); +}; + +// Helper class changing the event object to make the event appear as coming +// from a different source: this is somewhat of a hack, but avoids copying the +// events just to change their event object field. +class wxEventObjectOriginSetter +{ +public: + wxEventObjectOriginSetter(wxEvent& event, wxObject* source, int winid = 0) + : m_event(event), + m_sourceOrig(event.GetEventObject()), + m_idOrig(event.GetId()) + { + m_event.SetEventObject(source); + m_event.SetId(winid); + } + + ~wxEventObjectOriginSetter() + { + m_event.SetId(m_idOrig); + m_event.SetEventObject(m_sourceOrig); + } + +private: + wxEvent& m_event; + wxObject* const m_sourceOrig; + const int m_idOrig; + + wxDECLARE_NO_COPY_CLASS(wxEventObjectOriginSetter); +}; + +// A helper object used to temporarily make wxEvent::ShouldProcessOnlyIn() +// return true for the handler passed to its ctor. +class wxEventProcessInHandlerOnly +{ +public: + wxEventProcessInHandlerOnly(wxEvent& event, wxEvtHandler *handler) + : m_event(event), + m_handlerToProcessOnlyInOld(event.m_handlerToProcessOnlyIn) + { + m_event.m_handlerToProcessOnlyIn = handler; + } + + ~wxEventProcessInHandlerOnly() + { + m_event.m_handlerToProcessOnlyIn = m_handlerToProcessOnlyInOld; + } + +private: + wxEvent& m_event; + wxEvtHandler * const m_handlerToProcessOnlyInOld; + + wxDECLARE_NO_COPY_CLASS(wxEventProcessInHandlerOnly); +}; + + +class WXDLLIMPEXP_BASE wxEventBasicPayloadMixin +{ +public: + wxEventBasicPayloadMixin() + : m_commandInt(0), + m_extraLong(0) + { + } + + void SetString(const wxString& s) { m_cmdString = s; } + const wxString& GetString() const { return m_cmdString; } + + void SetInt(int i) { m_commandInt = i; } + int GetInt() const { return m_commandInt; } + + void SetExtraLong(long extraLong) { m_extraLong = extraLong; } + long GetExtraLong() const { return m_extraLong; } + +protected: + // Note: these variables have "cmd" or "command" in their name for backward compatibility: + // they used to be part of wxCommandEvent, not this mixin. + wxString m_cmdString; // String event argument + int m_commandInt; + long m_extraLong; // Additional information (e.g. select/deselect) + + wxDECLARE_NO_ASSIGN_DEF_COPY(wxEventBasicPayloadMixin); +}; + +class WXDLLIMPEXP_BASE wxEventAnyPayloadMixin : public wxEventBasicPayloadMixin +{ +public: + wxEventAnyPayloadMixin() : wxEventBasicPayloadMixin() {} + +#if wxUSE_ANY + template + void SetPayload(const T& payload) + { + m_payload = payload; + } + + template + T GetPayload() const + { + return m_payload.As(); + } + +protected: + wxAny m_payload; +#endif // wxUSE_ANY + + wxDECLARE_NO_ASSIGN_CLASS(wxEventBasicPayloadMixin); +}; + + +// Idle event +/* + wxEVT_IDLE + */ + +// Whether to always send idle events to windows, or +// to only send update events to those with the +// wxWS_EX_PROCESS_IDLE style. + +enum wxIdleMode +{ + // Send idle events to all windows + wxIDLE_PROCESS_ALL, + + // Send idle events to windows that have + // the wxWS_EX_PROCESS_IDLE flag specified + wxIDLE_PROCESS_SPECIFIED +}; + +class WXDLLIMPEXP_BASE wxIdleEvent : public wxEvent +{ +public: + wxIdleEvent() + : wxEvent(0, wxEVT_IDLE), + m_requestMore(false) + { } + wxIdleEvent(const wxIdleEvent& event) + : wxEvent(event), + m_requestMore(event.m_requestMore) + { } + + void RequestMore(bool needMore = true) { m_requestMore = needMore; } + bool MoreRequested() const { return m_requestMore; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxIdleEvent(*this); } + + // Specify how wxWidgets will send idle events: to + // all windows, or only to those which specify that they + // will process the events. + static void SetMode(wxIdleMode mode) { sm_idleMode = mode; } + + // Returns the idle event mode + static wxIdleMode GetMode() { return sm_idleMode; } + +protected: + bool m_requestMore; + static wxIdleMode sm_idleMode; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIdleEvent); +}; + + +// Thread event + +class WXDLLIMPEXP_BASE wxThreadEvent : public wxEvent, + public wxEventAnyPayloadMixin +{ +public: + wxThreadEvent(wxEventType eventType = wxEVT_THREAD, int id = wxID_ANY) + : wxEvent(id, eventType) + { } + + wxThreadEvent(const wxThreadEvent& event) + : wxEvent(event), + wxEventAnyPayloadMixin(event) + { + // make sure our string member (which uses COW, aka refcounting) is not + // shared by other wxString instances: + SetString(GetString().Clone()); + } + + virtual wxEvent *Clone() const wxOVERRIDE + { + return new wxThreadEvent(*this); + } + + // this is important to avoid that calling wxEventLoopBase::YieldFor thread events + // gets processed when this is unwanted: + virtual wxEventCategory GetEventCategory() const wxOVERRIDE + { return wxEVT_CATEGORY_THREAD; } + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxThreadEvent); +}; + + +// Asynchronous method call events: these event are processed by wxEvtHandler +// itself and result in a call to its Execute() method which simply calls the +// specified method. The difference with a simple method call is that this is +// done asynchronously, i.e. at some later time, instead of immediately when +// the event object is constructed. + +// This is a base class used to process all method calls. +class wxAsyncMethodCallEvent : public wxEvent +{ +public: + wxAsyncMethodCallEvent(wxObject* object) + : wxEvent(wxID_ANY, wxEVT_ASYNC_METHOD_CALL) + { + SetEventObject(object); + } + + wxAsyncMethodCallEvent(const wxAsyncMethodCallEvent& other) + : wxEvent(other) + { + } + + virtual void Execute() = 0; +}; + +// This is a version for calling methods without parameters. +template +class wxAsyncMethodCallEvent0 : public wxAsyncMethodCallEvent +{ +public: + typedef T ObjectType; + typedef void (ObjectType::*MethodType)(); + + wxAsyncMethodCallEvent0(ObjectType* object, + MethodType method) + : wxAsyncMethodCallEvent(object), + m_object(object), + m_method(method) + { + } + + wxAsyncMethodCallEvent0(const wxAsyncMethodCallEvent0& other) + : wxAsyncMethodCallEvent(other), + m_object(other.m_object), + m_method(other.m_method) + { + } + + virtual wxEvent *Clone() const wxOVERRIDE + { + return new wxAsyncMethodCallEvent0(*this); + } + + virtual void Execute() wxOVERRIDE + { + (m_object->*m_method)(); + } + +private: + ObjectType* const m_object; + const MethodType m_method; +}; + +// This is a version for calling methods with a single parameter. +template +class wxAsyncMethodCallEvent1 : public wxAsyncMethodCallEvent +{ +public: + typedef T ObjectType; + typedef void (ObjectType::*MethodType)(T1 x1); + typedef typename wxRemoveRef::type ParamType1; + + wxAsyncMethodCallEvent1(ObjectType* object, + MethodType method, + const ParamType1& x1) + : wxAsyncMethodCallEvent(object), + m_object(object), + m_method(method), + m_param1(x1) + { + } + + wxAsyncMethodCallEvent1(const wxAsyncMethodCallEvent1& other) + : wxAsyncMethodCallEvent(other), + m_object(other.m_object), + m_method(other.m_method), + m_param1(other.m_param1) + { + } + + virtual wxEvent *Clone() const wxOVERRIDE + { + return new wxAsyncMethodCallEvent1(*this); + } + + virtual void Execute() wxOVERRIDE + { + (m_object->*m_method)(m_param1); + } + +private: + ObjectType* const m_object; + const MethodType m_method; + const ParamType1 m_param1; +}; + +// This is a version for calling methods with two parameters. +template +class wxAsyncMethodCallEvent2 : public wxAsyncMethodCallEvent +{ +public: + typedef T ObjectType; + typedef void (ObjectType::*MethodType)(T1 x1, T2 x2); + typedef typename wxRemoveRef::type ParamType1; + typedef typename wxRemoveRef::type ParamType2; + + wxAsyncMethodCallEvent2(ObjectType* object, + MethodType method, + const ParamType1& x1, + const ParamType2& x2) + : wxAsyncMethodCallEvent(object), + m_object(object), + m_method(method), + m_param1(x1), + m_param2(x2) + { + } + + wxAsyncMethodCallEvent2(const wxAsyncMethodCallEvent2& other) + : wxAsyncMethodCallEvent(other), + m_object(other.m_object), + m_method(other.m_method), + m_param1(other.m_param1), + m_param2(other.m_param2) + { + } + + virtual wxEvent *Clone() const wxOVERRIDE + { + return new wxAsyncMethodCallEvent2(*this); + } + + virtual void Execute() wxOVERRIDE + { + (m_object->*m_method)(m_param1, m_param2); + } + +private: + ObjectType* const m_object; + const MethodType m_method; + const ParamType1 m_param1; + const ParamType2 m_param2; +}; + +// This is a version for calling any functors +template +class wxAsyncMethodCallEventFunctor : public wxAsyncMethodCallEvent +{ +public: + typedef T FunctorType; + + wxAsyncMethodCallEventFunctor(wxObject *object, const FunctorType& fn) + : wxAsyncMethodCallEvent(object), + m_fn(fn) + { + } + + wxAsyncMethodCallEventFunctor(const wxAsyncMethodCallEventFunctor& other) + : wxAsyncMethodCallEvent(other), + m_fn(other.m_fn) + { + } + + virtual wxEvent *Clone() const wxOVERRIDE + { + return new wxAsyncMethodCallEventFunctor(*this); + } + + virtual void Execute() wxOVERRIDE + { + m_fn(); + } + +private: + FunctorType m_fn; +}; + +#if wxUSE_GUI + + +// Item or menu event class +/* + wxEVT_BUTTON + wxEVT_CHECKBOX + wxEVT_CHOICE + wxEVT_LISTBOX + wxEVT_LISTBOX_DCLICK + wxEVT_TEXT + wxEVT_TEXT_ENTER + wxEVT_MENU + wxEVT_SLIDER + wxEVT_RADIOBOX + wxEVT_RADIOBUTTON + wxEVT_SCROLLBAR + wxEVT_VLBOX + wxEVT_COMBOBOX + wxEVT_TOGGLEBUTTON +*/ + +class WXDLLIMPEXP_CORE wxCommandEvent : public wxEvent, + public wxEventBasicPayloadMixin +{ +public: + wxCommandEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) + : wxEvent(winid, commandType) + { + m_clientData = NULL; + m_clientObject = NULL; + m_isCommandEvent = true; + + // the command events are propagated upwards by default + m_propagationLevel = wxEVENT_PROPAGATE_MAX; + } + + wxCommandEvent(const wxCommandEvent& event) + : wxEvent(event), + wxEventBasicPayloadMixin(event), + m_clientData(event.m_clientData), + m_clientObject(event.m_clientObject) + { + // Because GetString() can retrieve the string text only on demand, we + // need to copy it explicitly. + if ( m_cmdString.empty() ) + m_cmdString = event.GetString(); + } + + // Set/Get client data from controls + void SetClientData(void* clientData) { m_clientData = clientData; } + void *GetClientData() const { return m_clientData; } + + // Set/Get client object from controls + void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; } + wxClientData *GetClientObject() const { return m_clientObject; } + + // Note: this shadows wxEventBasicPayloadMixin::GetString(), because it does some + // GUI-specific hacks + wxString GetString() const; + + // Get listbox selection if single-choice + int GetSelection() const { return m_commandInt; } + + // Get checkbox value + bool IsChecked() const { return m_commandInt != 0; } + + // true if the listbox event was a selection. + bool IsSelection() const { return (m_extraLong != 0); } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxCommandEvent(*this); } + virtual wxEventCategory GetEventCategory() const wxOVERRIDE { return wxEVT_CATEGORY_USER_INPUT; } + +protected: + void* m_clientData; // Arbitrary client data + wxClientData* m_clientObject; // Arbitrary client object + +private: + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCommandEvent); +}; + +// this class adds a possibility to react (from the user) code to a control +// notification: allow or veto the operation being reported. +class WXDLLIMPEXP_CORE wxNotifyEvent : public wxCommandEvent +{ +public: + wxNotifyEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) + : wxCommandEvent(commandType, winid) + { m_bAllow = true; } + + wxNotifyEvent(const wxNotifyEvent& event) + : wxCommandEvent(event) + { m_bAllow = event.m_bAllow; } + + // veto the operation (usually it's allowed by default) + void Veto() { m_bAllow = false; } + + // allow the operation if it was disabled by default + void Allow() { m_bAllow = true; } + + // for implementation code only: is the operation allowed? + bool IsAllowed() const { return m_bAllow; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxNotifyEvent(*this); } + +private: + bool m_bAllow; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNotifyEvent); +}; + + +// Scroll event class, derived from wxCommandEvent. wxScrollEvents are +// sent by wxSlider and wxScrollBar. +/* + wxEVT_SCROLL_TOP + wxEVT_SCROLL_BOTTOM + wxEVT_SCROLL_LINEUP + wxEVT_SCROLL_LINEDOWN + wxEVT_SCROLL_PAGEUP + wxEVT_SCROLL_PAGEDOWN + wxEVT_SCROLL_THUMBTRACK + wxEVT_SCROLL_THUMBRELEASE + wxEVT_SCROLL_CHANGED +*/ + +class WXDLLIMPEXP_CORE wxScrollEvent : public wxCommandEvent +{ +public: + wxScrollEvent(wxEventType commandType = wxEVT_NULL, + int winid = 0, int pos = 0, int orient = 0); + + int GetOrientation() const { return (int) m_extraLong; } + int GetPosition() const { return m_commandInt; } + void SetOrientation(int orient) { m_extraLong = (long) orient; } + void SetPosition(int pos) { m_commandInt = pos; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxScrollEvent(*this); } + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxScrollEvent); +}; + +// ScrollWin event class, derived fom wxEvent. wxScrollWinEvents +// are sent by wxWindow. +/* + wxEVT_SCROLLWIN_TOP + wxEVT_SCROLLWIN_BOTTOM + wxEVT_SCROLLWIN_LINEUP + wxEVT_SCROLLWIN_LINEDOWN + wxEVT_SCROLLWIN_PAGEUP + wxEVT_SCROLLWIN_PAGEDOWN + wxEVT_SCROLLWIN_THUMBTRACK + wxEVT_SCROLLWIN_THUMBRELEASE +*/ + +class WXDLLIMPEXP_CORE wxScrollWinEvent : public wxEvent +{ +public: + wxScrollWinEvent(wxEventType commandType = wxEVT_NULL, + int pos = 0, int orient = 0); + wxScrollWinEvent(const wxScrollWinEvent& event) : wxEvent(event) + { m_commandInt = event.m_commandInt; + m_extraLong = event.m_extraLong; } + + int GetOrientation() const { return (int) m_extraLong; } + int GetPosition() const { return m_commandInt; } + void SetOrientation(int orient) { m_extraLong = (long) orient; } + void SetPosition(int pos) { m_commandInt = pos; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxScrollWinEvent(*this); } + +protected: + int m_commandInt; + long m_extraLong; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxScrollWinEvent); +}; + + + +// Mouse event class + +/* + wxEVT_LEFT_DOWN + wxEVT_LEFT_UP + wxEVT_MIDDLE_DOWN + wxEVT_MIDDLE_UP + wxEVT_RIGHT_DOWN + wxEVT_RIGHT_UP + wxEVT_MOTION + wxEVT_ENTER_WINDOW + wxEVT_LEAVE_WINDOW + wxEVT_LEFT_DCLICK + wxEVT_MIDDLE_DCLICK + wxEVT_RIGHT_DCLICK +*/ + +enum wxMouseWheelAxis +{ + wxMOUSE_WHEEL_VERTICAL, + wxMOUSE_WHEEL_HORIZONTAL +}; + +class WXDLLIMPEXP_CORE wxMouseEvent : public wxEvent, + public wxMouseState +{ +public: + wxMouseEvent(wxEventType mouseType = wxEVT_NULL); + wxMouseEvent(const wxMouseEvent& event) + : wxEvent(event), + wxMouseState(event) + { + Assign(event); + } + + // Was it a button event? (*doesn't* mean: is any button *down*?) + bool IsButton() const { return Button(wxMOUSE_BTN_ANY); } + + // Was it a down event from this (or any) button? + bool ButtonDown(int but = wxMOUSE_BTN_ANY) const; + + // Was it a dclick event from this (or any) button? + bool ButtonDClick(int but = wxMOUSE_BTN_ANY) const; + + // Was it a up event from this (or any) button? + bool ButtonUp(int but = wxMOUSE_BTN_ANY) const; + + // Was this event generated by the given button? + bool Button(int but) const; + + // Get the button which is changing state (wxMOUSE_BTN_NONE if none) + int GetButton() const; + + // Find which event was just generated + bool LeftDown() const { return (m_eventType == wxEVT_LEFT_DOWN); } + bool MiddleDown() const { return (m_eventType == wxEVT_MIDDLE_DOWN); } + bool RightDown() const { return (m_eventType == wxEVT_RIGHT_DOWN); } + bool Aux1Down() const { return (m_eventType == wxEVT_AUX1_DOWN); } + bool Aux2Down() const { return (m_eventType == wxEVT_AUX2_DOWN); } + + bool LeftUp() const { return (m_eventType == wxEVT_LEFT_UP); } + bool MiddleUp() const { return (m_eventType == wxEVT_MIDDLE_UP); } + bool RightUp() const { return (m_eventType == wxEVT_RIGHT_UP); } + bool Aux1Up() const { return (m_eventType == wxEVT_AUX1_UP); } + bool Aux2Up() const { return (m_eventType == wxEVT_AUX2_UP); } + + bool LeftDClick() const { return (m_eventType == wxEVT_LEFT_DCLICK); } + bool MiddleDClick() const { return (m_eventType == wxEVT_MIDDLE_DCLICK); } + bool RightDClick() const { return (m_eventType == wxEVT_RIGHT_DCLICK); } + bool Aux1DClick() const { return (m_eventType == wxEVT_AUX1_DCLICK); } + bool Aux2DClick() const { return (m_eventType == wxEVT_AUX2_DCLICK); } + + bool Magnify() const { return (m_eventType == wxEVT_MAGNIFY); } + + // True if a button is down and the mouse is moving + bool Dragging() const + { + return (m_eventType == wxEVT_MOTION) && ButtonIsDown(wxMOUSE_BTN_ANY); + } + + // True if the mouse is moving, and no button is down + bool Moving() const + { + return (m_eventType == wxEVT_MOTION) && !ButtonIsDown(wxMOUSE_BTN_ANY); + } + + // True if the mouse is just entering the window + bool Entering() const { return (m_eventType == wxEVT_ENTER_WINDOW); } + + // True if the mouse is just leaving the window + bool Leaving() const { return (m_eventType == wxEVT_LEAVE_WINDOW); } + + // Returns the number of mouse clicks associated with this event. + int GetClickCount() const { return m_clickCount; } + + // Find the logical position of the event given the DC + wxPoint GetLogicalPosition(const wxDC& dc) const; + + // Get wheel rotation, positive or negative indicates direction of + // rotation. Current devices all send an event when rotation is equal to + // +/-WheelDelta, but this allows for finer resolution devices to be + // created in the future. Because of this you shouldn't assume that one + // event is equal to 1 line or whatever, but you should be able to either + // do partial line scrolling or wait until +/-WheelDelta rotation values + // have been accumulated before scrolling. + int GetWheelRotation() const { return m_wheelRotation; } + + // Get wheel delta, normally 120. This is the threshold for action to be + // taken, and one such action (for example, scrolling one increment) + // should occur for each delta. + int GetWheelDelta() const { return m_wheelDelta; } + + // On Mac, has the user selected "Natural" scrolling in their System + // Preferences? Currently false on all other OS's. + bool IsWheelInverted() const { return m_wheelInverted; } + + // Gets the axis the wheel operation concerns; wxMOUSE_WHEEL_VERTICAL + // (most common case) or wxMOUSE_WHEEL_HORIZONTAL (for horizontal scrolling + // using e.g. a trackpad). + wxMouseWheelAxis GetWheelAxis() const { return m_wheelAxis; } + + // Returns the configured number of lines (or whatever) to be scrolled per + // wheel action. Defaults to three. + int GetLinesPerAction() const { return m_linesPerAction; } + + // Returns the configured number of columns (or whatever) to be scrolled per + // wheel action. Defaults to three. + int GetColumnsPerAction() const { return m_columnsPerAction; } + + // Is the system set to do page scrolling? + bool IsPageScroll() const { return ((unsigned int)m_linesPerAction == UINT_MAX); } + + float GetMagnification() const { return m_magnification; } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxMouseEvent(*this); } + virtual wxEventCategory GetEventCategory() const wxOVERRIDE { return wxEVT_CATEGORY_USER_INPUT; } + + wxMouseEvent& operator=(const wxMouseEvent& event) + { + if (&event != this) + Assign(event); + return *this; + } + +public: + int m_clickCount; + + wxMouseWheelAxis m_wheelAxis; + int m_wheelRotation; + int m_wheelDelta; + bool m_wheelInverted; + int m_linesPerAction; + int m_columnsPerAction; + float m_magnification; + +protected: + void Assign(const wxMouseEvent& evt); + +private: + wxDECLARE_DYNAMIC_CLASS(wxMouseEvent); +}; + +// Cursor set event + +/* + wxEVT_SET_CURSOR + */ + +class WXDLLIMPEXP_CORE wxSetCursorEvent : public wxEvent +{ +public: + wxSetCursorEvent(wxCoord x = 0, wxCoord y = 0) + : wxEvent(0, wxEVT_SET_CURSOR), + m_x(x), m_y(y), m_cursor() + { } + + wxSetCursorEvent(const wxSetCursorEvent& event) + : wxEvent(event), + m_x(event.m_x), + m_y(event.m_y), + m_cursor(event.m_cursor) + { } + + wxCoord GetX() const { return m_x; } + wxCoord GetY() const { return m_y; } + + void SetCursor(const wxCursor& cursor) { m_cursor = cursor; } + const wxCursor& GetCursor() const { return m_cursor; } + bool HasCursor() const { return m_cursor.IsOk(); } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxSetCursorEvent(*this); } + +private: + wxCoord m_x, m_y; + wxCursor m_cursor; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSetCursorEvent); +}; + + // Gesture Event + +const unsigned int wxTwoFingerTimeInterval = 200; + +class WXDLLIMPEXP_CORE wxGestureEvent : public wxEvent +{ +public: + wxGestureEvent(wxWindowID winid = 0, wxEventType type = wxEVT_NULL) + : wxEvent(winid, type) + { + m_isStart = false; + m_isEnd = false; + } + + wxGestureEvent(const wxGestureEvent& event) : wxEvent(event) + , m_pos(event.m_pos) + { + m_isStart = event.m_isStart; + m_isEnd = event.m_isEnd; + } + + const wxPoint& GetPosition() const { return m_pos; } + void SetPosition(const wxPoint& pos) { m_pos = pos; } + bool IsGestureStart() const { return m_isStart; } + void SetGestureStart(bool isStart = true) { m_isStart = isStart; } + bool IsGestureEnd() const { return m_isEnd; } + void SetGestureEnd(bool isEnd = true) { m_isEnd = isEnd; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxGestureEvent(*this); } + +protected: + wxPoint m_pos; + bool m_isStart, m_isEnd; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxGestureEvent); + +}; + + // Pan Gesture Event + + /* + wxEVT_GESTURE_PAN + */ + +class WXDLLIMPEXP_CORE wxPanGestureEvent : public wxGestureEvent +{ +public: + wxPanGestureEvent(wxWindowID winid = 0) + : wxGestureEvent(winid, wxEVT_GESTURE_PAN) + { + } + + wxPanGestureEvent(const wxPanGestureEvent& event) + : wxGestureEvent(event), + m_delta(event.m_delta) + { + } + + wxPoint GetDelta() const { return m_delta; } + void SetDelta(const wxPoint& delta) { m_delta = delta; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxPanGestureEvent(*this); } + +private: + wxPoint m_delta; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPanGestureEvent); +}; + + // Zoom Gesture Event + + /* + wxEVT_GESTURE_ZOOM + */ + +class WXDLLIMPEXP_CORE wxZoomGestureEvent : public wxGestureEvent +{ +public: + wxZoomGestureEvent(wxWindowID winid = 0) + : wxGestureEvent(winid, wxEVT_GESTURE_ZOOM) + { m_zoomFactor = 1.0; } + + wxZoomGestureEvent(const wxZoomGestureEvent& event) : wxGestureEvent(event) + { + m_zoomFactor = event.m_zoomFactor; + } + + double GetZoomFactor() const { return m_zoomFactor; } + void SetZoomFactor(double zoomFactor) { m_zoomFactor = zoomFactor; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxZoomGestureEvent(*this); } + +private: + double m_zoomFactor; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxZoomGestureEvent); +}; + + // Rotate Gesture Event + + /* + wxEVT_GESTURE_ROTATE + */ + +class WXDLLIMPEXP_CORE wxRotateGestureEvent : public wxGestureEvent +{ +public: + wxRotateGestureEvent(wxWindowID winid = 0) + : wxGestureEvent(winid, wxEVT_GESTURE_ROTATE) + { m_rotationAngle = 0.0; } + + wxRotateGestureEvent(const wxRotateGestureEvent& event) : wxGestureEvent(event) + { + m_rotationAngle = event.m_rotationAngle; + } + + double GetRotationAngle() const { return m_rotationAngle; } + void SetRotationAngle(double rotationAngle) { m_rotationAngle = rotationAngle; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxRotateGestureEvent(*this); } + +private: + double m_rotationAngle; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxRotateGestureEvent); +}; + + // Two Finger Tap Gesture Event + + /* + wxEVT_TWO_FINGER_TAP + */ + +class WXDLLIMPEXP_CORE wxTwoFingerTapEvent : public wxGestureEvent +{ +public: + wxTwoFingerTapEvent(wxWindowID winid = 0) + : wxGestureEvent(winid, wxEVT_TWO_FINGER_TAP) + { } + + wxTwoFingerTapEvent(const wxTwoFingerTapEvent& event) : wxGestureEvent(event) + { } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxTwoFingerTapEvent(*this); } + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxTwoFingerTapEvent); +}; + + // Long Press Gesture Event + + /* + wxEVT_LONG_PRESS + */ + +class WXDLLIMPEXP_CORE wxLongPressEvent : public wxGestureEvent +{ +public: + wxLongPressEvent(wxWindowID winid = 0) + : wxGestureEvent(winid, wxEVT_LONG_PRESS) + { } + + wxLongPressEvent(const wxLongPressEvent& event) : wxGestureEvent(event) + { } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxLongPressEvent(*this); } +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxLongPressEvent); +}; + + // Press And Tap Gesture Event + + /* + wxEVT_PRESS_AND_TAP + */ + +class WXDLLIMPEXP_CORE wxPressAndTapEvent : public wxGestureEvent +{ +public: + wxPressAndTapEvent(wxWindowID winid = 0) + : wxGestureEvent(winid, wxEVT_PRESS_AND_TAP) + { } + + wxPressAndTapEvent(const wxPressAndTapEvent& event) : wxGestureEvent(event) + { } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxPressAndTapEvent(*this); } +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPressAndTapEvent); +}; + +// Keyboard input event class + +/* + wxEVT_CHAR + wxEVT_CHAR_HOOK + wxEVT_KEY_DOWN + wxEVT_KEY_UP + wxEVT_HOTKEY + */ + +// key categories: the bit flags for IsKeyInCategory() function +// +// the enum values used may change in future version of wx +// use the named constants only, or bitwise combinations thereof +enum wxKeyCategoryFlags +{ + // arrow keys, on and off numeric keypads + WXK_CATEGORY_ARROW = 1, + + // page up and page down keys, on and off numeric keypads + WXK_CATEGORY_PAGING = 2, + + // home and end keys, on and off numeric keypads + WXK_CATEGORY_JUMP = 4, + + // tab key, on and off numeric keypads + WXK_CATEGORY_TAB = 8, + + // backspace and delete keys, on and off numeric keypads + WXK_CATEGORY_CUT = 16, + + // all keys usually used for navigation + WXK_CATEGORY_NAVIGATION = WXK_CATEGORY_ARROW | + WXK_CATEGORY_PAGING | + WXK_CATEGORY_JUMP +}; + +class WXDLLIMPEXP_CORE wxKeyEvent : public wxEvent, + public wxKeyboardState +{ +public: + wxKeyEvent(wxEventType keyType = wxEVT_NULL); + + // Normal copy ctor and a ctor creating a new event for the same key as the + // given one but a different event type (this is used in implementation + // code only, do not use outside of the library). + wxKeyEvent(const wxKeyEvent& evt); + wxKeyEvent(wxEventType eventType, const wxKeyEvent& evt); + + // get the key code: an ASCII7 char or an element of wxKeyCode enum + int GetKeyCode() const { return (int)m_keyCode; } + + // returns true iff this event's key code is of a certain type + bool IsKeyInCategory(int category) const; + +#if wxUSE_UNICODE + // get the Unicode character corresponding to this key + wxChar GetUnicodeKey() const { return m_uniChar; } +#endif // wxUSE_UNICODE + + // get the raw key code (platform-dependent) + wxUint32 GetRawKeyCode() const { return m_rawCode; } + + // get the raw key flags (platform-dependent) + wxUint32 GetRawKeyFlags() const { return m_rawFlags; } + + // returns true if this is a key auto repeat event + bool IsAutoRepeat() const { return m_isRepeat; } + + // Find the position of the event + void GetPosition(wxCoord *xpos, wxCoord *ypos) const + { + if (xpos) + *xpos = GetX(); + if (ypos) + *ypos = GetY(); + } + + // This version if provided only for backwards compatibility, don't use. + void GetPosition(long *xpos, long *ypos) const + { + if (xpos) + *xpos = GetX(); + if (ypos) + *ypos = GetY(); + } + + wxPoint GetPosition() const + { return wxPoint(GetX(), GetY()); } + + // Get X position + wxCoord GetX() const; + + // Get Y position + wxCoord GetY() const; + + // Can be called from wxEVT_CHAR_HOOK handler to allow generation of normal + // key events even though the event had been handled (by default they would + // not be generated in this case). + void DoAllowNextEvent() { m_allowNext = true; } + + // Return the value of the "allow next" flag, for internal use only. + bool IsNextEventAllowed() const { return m_allowNext; } + + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxKeyEvent(*this); } + virtual wxEventCategory GetEventCategory() const wxOVERRIDE { return wxEVT_CATEGORY_USER_INPUT; } + + // we do need to copy wxKeyEvent sometimes (in wxTreeCtrl code, for + // example) + wxKeyEvent& operator=(const wxKeyEvent& evt); + +public: + // Do not use these fields directly, they are initialized on demand, so + // call GetX() and GetY() or GetPosition() instead. + wxCoord m_x, m_y; + + long m_keyCode; + +#if wxUSE_UNICODE + // This contains the full Unicode character + // in a character events in Unicode mode + wxChar m_uniChar; +#endif + + // these fields contain the platform-specific information about + // key that was pressed + wxUint32 m_rawCode; + wxUint32 m_rawFlags; + + // Indicates whether the key event is a repeat + bool m_isRepeat; + +private: + // Set the event to propagate if necessary, i.e. if it's of wxEVT_CHAR_HOOK + // type. This is used by all ctors. + void InitPropagation() + { + if ( m_eventType == wxEVT_CHAR_HOOK ) + m_propagationLevel = wxEVENT_PROPAGATE_MAX; + + m_allowNext = false; + } + + // Copy only the event data present in this class, this is used by + // AssignKeyData() and copy ctor. + void DoAssignMembers(const wxKeyEvent& evt) + { + m_x = evt.m_x; + m_y = evt.m_y; + m_hasPosition = evt.m_hasPosition; + + m_keyCode = evt.m_keyCode; + + m_rawCode = evt.m_rawCode; + m_rawFlags = evt.m_rawFlags; +#if wxUSE_UNICODE + m_uniChar = evt.m_uniChar; +#endif + m_isRepeat = evt.m_isRepeat; + } + + // Initialize m_x and m_y using the current mouse cursor position if + // necessary. + void InitPositionIfNecessary() const; + + // If this flag is true, the normal key events should still be generated + // even if wxEVT_CHAR_HOOK had been handled. By default it is false as + // handling wxEVT_CHAR_HOOK suppresses all the subsequent events. + bool m_allowNext; + + // If true, m_x and m_y were already initialized. If false, try to get them + // when they're requested. + bool m_hasPosition; + + wxDECLARE_DYNAMIC_CLASS(wxKeyEvent); +}; + +// Size event class +/* + wxEVT_SIZE + */ + +class WXDLLIMPEXP_CORE wxSizeEvent : public wxEvent +{ +public: + wxSizeEvent() : wxEvent(0, wxEVT_SIZE) + { } + wxSizeEvent(const wxSize& sz, int winid = 0) + : wxEvent(winid, wxEVT_SIZE), + m_size(sz) + { } + wxSizeEvent(const wxSizeEvent& event) + : wxEvent(event), + m_size(event.m_size), m_rect(event.m_rect) + { } + wxSizeEvent(const wxRect& rect, int id = 0) + : m_size(rect.GetSize()), m_rect(rect) + { m_eventType = wxEVT_SIZING; m_id = id; } + + wxSize GetSize() const { return m_size; } + void SetSize(wxSize size) { m_size = size; } + wxRect GetRect() const { return m_rect; } + void SetRect(const wxRect& rect) { m_rect = rect; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxSizeEvent(*this); } + +public: + // For internal usage only. Will be converted to protected members. + wxSize m_size; + wxRect m_rect; // Used for wxEVT_SIZING + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSizeEvent); +}; + +// Move event class + +/* + wxEVT_MOVE + */ + +class WXDLLIMPEXP_CORE wxMoveEvent : public wxEvent +{ +public: + wxMoveEvent() + : wxEvent(0, wxEVT_MOVE) + { } + wxMoveEvent(const wxPoint& pos, int winid = 0) + : wxEvent(winid, wxEVT_MOVE), + m_pos(pos) + { } + wxMoveEvent(const wxMoveEvent& event) + : wxEvent(event), + m_pos(event.m_pos) + { } + wxMoveEvent(const wxRect& rect, int id = 0) + : m_pos(rect.GetPosition()), m_rect(rect) + { m_eventType = wxEVT_MOVING; m_id = id; } + + wxPoint GetPosition() const { return m_pos; } + void SetPosition(const wxPoint& pos) { m_pos = pos; } + wxRect GetRect() const { return m_rect; } + void SetRect(const wxRect& rect) { m_rect = rect; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxMoveEvent(*this); } + +protected: + wxPoint m_pos; + wxRect m_rect; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMoveEvent); +}; + +// Paint event class +/* + wxEVT_PAINT + wxEVT_NC_PAINT + */ + +class WXDLLIMPEXP_CORE wxPaintEvent : public wxEvent +{ + // This ctor is only intended to be used by wxWidgets itself, so it's + // intentionally declared as private when not building the library itself. +#ifdef WXBUILDING +public: +#endif // WXBUILDING + explicit wxPaintEvent(wxWindowBase* window = NULL); + +public: + // default copy ctor and dtor are fine + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxPaintEvent(*this); } + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxPaintEvent); +}; + +class WXDLLIMPEXP_CORE wxNcPaintEvent : public wxEvent +{ + // This ctor is only intended to be used by wxWidgets itself, so it's + // intentionally declared as private when not building the library itself. +#ifdef WXBUILDING +public: +#endif // WXBUILDING + explicit wxNcPaintEvent(wxWindowBase* window = NULL); + +public: + virtual wxEvent *Clone() const wxOVERRIDE { return new wxNcPaintEvent(*this); } + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxNcPaintEvent); +}; + +// Erase background event class +/* + wxEVT_ERASE_BACKGROUND + */ + +class WXDLLIMPEXP_CORE wxEraseEvent : public wxEvent +{ +public: + wxEraseEvent(int Id = 0, wxDC *dc = NULL) + : wxEvent(Id, wxEVT_ERASE_BACKGROUND), + m_dc(dc) + { } + + wxEraseEvent(const wxEraseEvent& event) + : wxEvent(event), + m_dc(event.m_dc) + { } + + wxDC *GetDC() const { return m_dc; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxEraseEvent(*this); } + +protected: + wxDC *m_dc; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxEraseEvent); +}; + +// Focus event class +/* + wxEVT_SET_FOCUS + wxEVT_KILL_FOCUS + */ + +class WXDLLIMPEXP_CORE wxFocusEvent : public wxEvent +{ +public: + wxFocusEvent(wxEventType type = wxEVT_NULL, int winid = 0) + : wxEvent(winid, type) + { m_win = NULL; } + + wxFocusEvent(const wxFocusEvent& event) + : wxEvent(event) + { m_win = event.m_win; } + + // The window associated with this event is the window which had focus + // before for SET event and the window which will have focus for the KILL + // one. NB: it may be NULL in both cases! + wxWindow *GetWindow() const { return m_win; } + void SetWindow(wxWindow *win) { m_win = win; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxFocusEvent(*this); } + +private: + wxWindow *m_win; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFocusEvent); +}; + +// wxChildFocusEvent notifies the parent that a child has got the focus: unlike +// wxFocusEvent it is propagated upwards the window chain +class WXDLLIMPEXP_CORE wxChildFocusEvent : public wxCommandEvent +{ +public: + wxChildFocusEvent(wxWindow *win = NULL); + + wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxChildFocusEvent(*this); } + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxChildFocusEvent); +}; + +// Activate event class +/* + wxEVT_ACTIVATE + wxEVT_ACTIVATE_APP + wxEVT_HIBERNATE + */ + +class WXDLLIMPEXP_CORE wxActivateEvent : public wxEvent +{ +public: + // Type of activation. For now we can only detect if it was by mouse or by + // some other method and even this is only available under wxMSW. + enum Reason + { + Reason_Mouse, + Reason_Unknown + }; + + wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = true, + int Id = 0, Reason activationReason = Reason_Unknown) + : wxEvent(Id, type), + m_activationReason(activationReason) + { + m_active = active; + } + wxActivateEvent(const wxActivateEvent& event) + : wxEvent(event) + { + m_active = event.m_active; + m_activationReason = event.m_activationReason; + } + + bool GetActive() const { return m_active; } + Reason GetActivationReason() const { return m_activationReason;} + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxActivateEvent(*this); } + +private: + bool m_active; + Reason m_activationReason; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxActivateEvent); +}; + +// InitDialog event class +/* + wxEVT_INIT_DIALOG + */ + +class WXDLLIMPEXP_CORE wxInitDialogEvent : public wxEvent +{ +public: + wxInitDialogEvent(int Id = 0) + : wxEvent(Id, wxEVT_INIT_DIALOG) + { } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxInitDialogEvent(*this); } + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxInitDialogEvent); +}; + +// Miscellaneous menu event class +/* + wxEVT_MENU_OPEN, + wxEVT_MENU_CLOSE, + wxEVT_MENU_HIGHLIGHT, +*/ + +class WXDLLIMPEXP_CORE wxMenuEvent : public wxEvent +{ +public: + wxMenuEvent(wxEventType type = wxEVT_NULL, int winid = 0, wxMenu* menu = NULL) + : wxEvent(winid, type) + { m_menuId = winid; m_menu = menu; } + wxMenuEvent(const wxMenuEvent& event) + : wxEvent(event) + { m_menuId = event.m_menuId; m_menu = event.m_menu; } + + // only for wxEVT_MENU_HIGHLIGHT + int GetMenuId() const { return m_menuId; } + + // only for wxEVT_MENU_OPEN/CLOSE + bool IsPopup() const { return m_menuId == wxID_ANY; } + + // only for wxEVT_MENU_OPEN/CLOSE + wxMenu* GetMenu() const { return m_menu; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxMenuEvent(*this); } + +private: + int m_menuId; + wxMenu* m_menu; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMenuEvent); +}; + +// Window close or session close event class +/* + wxEVT_CLOSE_WINDOW, + wxEVT_END_SESSION, + wxEVT_QUERY_END_SESSION + */ + +class WXDLLIMPEXP_CORE wxCloseEvent : public wxEvent +{ +public: + wxCloseEvent(wxEventType type = wxEVT_NULL, int winid = 0) + : wxEvent(winid, type), + m_loggingOff(true), + m_veto(false), // should be false by default + m_canVeto(true) {} + + wxCloseEvent(const wxCloseEvent& event) + : wxEvent(event), + m_loggingOff(event.m_loggingOff), + m_veto(event.m_veto), + m_canVeto(event.m_canVeto) {} + + void SetLoggingOff(bool logOff) { m_loggingOff = logOff; } + bool GetLoggingOff() const + { + // m_loggingOff flag is only used by wxEVT_[QUERY_]END_SESSION, it + // doesn't make sense for wxEVT_CLOSE_WINDOW + wxASSERT_MSG( m_eventType != wxEVT_CLOSE_WINDOW, + wxT("this flag is for end session events only") ); + + return m_loggingOff; + } + + void Veto(bool veto = true) + { + // GetVeto() will return false anyhow... + wxCHECK_RET( m_canVeto, + wxT("call to Veto() ignored (can't veto this event)") ); + + m_veto = veto; + } + void SetCanVeto(bool canVeto) { m_canVeto = canVeto; } + bool CanVeto() const { return m_canVeto; } + bool GetVeto() const { return m_canVeto && m_veto; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxCloseEvent(*this); } + +protected: + bool m_loggingOff, + m_veto, + m_canVeto; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCloseEvent); +}; + +/* + wxEVT_SHOW + */ + +class WXDLLIMPEXP_CORE wxShowEvent : public wxEvent +{ +public: + wxShowEvent(int winid = 0, bool show = false) + : wxEvent(winid, wxEVT_SHOW) + { m_show = show; } + wxShowEvent(const wxShowEvent& event) + : wxEvent(event) + { m_show = event.m_show; } + + void SetShow(bool show) { m_show = show; } + + // return true if the window was shown, false if hidden + bool IsShown() const { return m_show; } + +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED( bool GetShow() const { return IsShown(); } ) +#endif + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxShowEvent(*this); } + +protected: + bool m_show; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxShowEvent); +}; + +/* + wxEVT_ICONIZE + */ + +class WXDLLIMPEXP_CORE wxIconizeEvent : public wxEvent +{ +public: + wxIconizeEvent(int winid = 0, bool iconized = true) + : wxEvent(winid, wxEVT_ICONIZE) + { m_iconized = iconized; } + wxIconizeEvent(const wxIconizeEvent& event) + : wxEvent(event) + { m_iconized = event.m_iconized; } + +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED( bool Iconized() const { return IsIconized(); } ) +#endif + // return true if the frame was iconized, false if restored + bool IsIconized() const { return m_iconized; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxIconizeEvent(*this); } + +protected: + bool m_iconized; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIconizeEvent); +}; +/* + wxEVT_MAXIMIZE + */ + +class WXDLLIMPEXP_CORE wxMaximizeEvent : public wxEvent +{ +public: + wxMaximizeEvent(int winid = 0) + : wxEvent(winid, wxEVT_MAXIMIZE) + { } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxMaximizeEvent(*this); } + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxMaximizeEvent); +}; + +/* + wxEVT_FULLSCREEN + */ +class WXDLLIMPEXP_CORE wxFullScreenEvent : public wxEvent +{ +public: + wxFullScreenEvent(int winid = 0, bool fullscreen = true) + : wxEvent(winid, wxEVT_FULLSCREEN) + { m_fullscreen = fullscreen; } + wxFullScreenEvent(const wxFullScreenEvent& event) + : wxEvent(event) + { m_fullscreen = event.m_fullscreen; } + + bool IsFullScreen() const { return m_fullscreen; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxFullScreenEvent(*this); } + +protected: + bool m_fullscreen; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFullScreenEvent); +}; + +// Joystick event class +/* + wxEVT_JOY_BUTTON_DOWN, + wxEVT_JOY_BUTTON_UP, + wxEVT_JOY_MOVE, + wxEVT_JOY_ZMOVE +*/ + +// Which joystick? Same as Windows ids so no conversion necessary. +enum +{ + wxJOYSTICK1, + wxJOYSTICK2 +}; + +// Which button is down? +enum +{ + wxJOY_BUTTON_ANY = -1, + wxJOY_BUTTON1 = 1, + wxJOY_BUTTON2 = 2, + wxJOY_BUTTON3 = 4, + wxJOY_BUTTON4 = 8 +}; + +class WXDLLIMPEXP_CORE wxJoystickEvent : public wxEvent +{ +protected: + wxPoint m_pos; + int m_zPosition; + int m_buttonChange; // Which button changed? + int m_buttonState; // Which buttons are down? + int m_joyStick; // Which joystick? + +public: + wxJoystickEvent(wxEventType type = wxEVT_NULL, + int state = 0, + int joystick = wxJOYSTICK1, + int change = 0) + : wxEvent(0, type), + m_pos(), + m_zPosition(0), + m_buttonChange(change), + m_buttonState(state), + m_joyStick(joystick) + { + } + wxJoystickEvent(const wxJoystickEvent& event) + : wxEvent(event), + m_pos(event.m_pos), + m_zPosition(event.m_zPosition), + m_buttonChange(event.m_buttonChange), + m_buttonState(event.m_buttonState), + m_joyStick(event.m_joyStick) + { } + + wxPoint GetPosition() const { return m_pos; } + int GetZPosition() const { return m_zPosition; } + int GetButtonState() const { return m_buttonState; } + int GetButtonChange() const { return m_buttonChange; } + int GetButtonOrdinal() const { return wxCTZ(m_buttonChange); } + int GetJoystick() const { return m_joyStick; } + + void SetJoystick(int stick) { m_joyStick = stick; } + void SetButtonState(int state) { m_buttonState = state; } + void SetButtonChange(int change) { m_buttonChange = change; } + void SetPosition(const wxPoint& pos) { m_pos = pos; } + void SetZPosition(int zPos) { m_zPosition = zPos; } + + // Was it a button event? (*doesn't* mean: is any button *down*?) + bool IsButton() const { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) || + (GetEventType() == wxEVT_JOY_BUTTON_UP)); } + + // Was it a move event? + bool IsMove() const { return (GetEventType() == wxEVT_JOY_MOVE); } + + // Was it a zmove event? + bool IsZMove() const { return (GetEventType() == wxEVT_JOY_ZMOVE); } + + // Was it a down event from button 1, 2, 3, 4 or any? + bool ButtonDown(int but = wxJOY_BUTTON_ANY) const + { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) && + ((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); } + + // Was it a up event from button 1, 2, 3 or any? + bool ButtonUp(int but = wxJOY_BUTTON_ANY) const + { return ((GetEventType() == wxEVT_JOY_BUTTON_UP) && + ((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); } + + // Was the given button 1,2,3,4 or any in Down state? + bool ButtonIsDown(int but = wxJOY_BUTTON_ANY) const + { return (((but == wxJOY_BUTTON_ANY) && (m_buttonState != 0)) || + ((m_buttonState & but) == but)); } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxJoystickEvent(*this); } + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxJoystickEvent); +}; + +// Drop files event class +/* + wxEVT_DROP_FILES + */ + +class WXDLLIMPEXP_CORE wxDropFilesEvent : public wxEvent +{ +public: + int m_noFiles; + wxPoint m_pos; + wxString* m_files; + + wxDropFilesEvent(wxEventType type = wxEVT_NULL, + int noFiles = 0, + wxString *files = NULL) + : wxEvent(0, type), + m_noFiles(noFiles), + m_pos(), + m_files(files) + { } + + // we need a copy ctor to avoid deleting m_files pointer twice + wxDropFilesEvent(const wxDropFilesEvent& other) + : wxEvent(other), + m_noFiles(other.m_noFiles), + m_pos(other.m_pos), + m_files(NULL) + { + m_files = new wxString[m_noFiles]; + for ( int n = 0; n < m_noFiles; n++ ) + { + m_files[n] = other.m_files[n]; + } + } + + virtual ~wxDropFilesEvent() + { + delete [] m_files; + } + + wxPoint GetPosition() const { return m_pos; } + int GetNumberOfFiles() const { return m_noFiles; } + wxString *GetFiles() const { return m_files; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxDropFilesEvent(*this); } + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDropFilesEvent); +}; + +// Update UI event +/* + wxEVT_UPDATE_UI + */ + +// Whether to always send update events to windows, or +// to only send update events to those with the +// wxWS_EX_PROCESS_UI_UPDATES style. + +enum wxUpdateUIMode +{ + // Send UI update events to all windows + wxUPDATE_UI_PROCESS_ALL, + + // Send UI update events to windows that have + // the wxWS_EX_PROCESS_UI_UPDATES flag specified + wxUPDATE_UI_PROCESS_SPECIFIED +}; + +class WXDLLIMPEXP_CORE wxUpdateUIEvent : public wxCommandEvent +{ +public: + wxUpdateUIEvent(wxWindowID commandId = 0) + : wxCommandEvent(wxEVT_UPDATE_UI, commandId) + { + m_checked = + m_enabled = + m_shown = + m_setEnabled = + m_setShown = + m_setText = + m_setChecked = false; + m_isCheckable = true; + } + wxUpdateUIEvent(const wxUpdateUIEvent& event) + : wxCommandEvent(event), + m_checked(event.m_checked), + m_enabled(event.m_enabled), + m_shown(event.m_shown), + m_setEnabled(event.m_setEnabled), + m_setShown(event.m_setShown), + m_setText(event.m_setText), + m_setChecked(event.m_setChecked), + m_isCheckable(event.m_isCheckable), + m_text(event.m_text) + { } + + bool GetChecked() const { return m_checked; } + bool GetEnabled() const { return m_enabled; } + bool GetShown() const { return m_shown; } + wxString GetText() const { return m_text; } + bool GetSetText() const { return m_setText; } + bool GetSetChecked() const { return m_setChecked; } + bool GetSetEnabled() const { return m_setEnabled; } + bool GetSetShown() const { return m_setShown; } + + void Check(bool check) { m_checked = check; m_setChecked = true; } + void Enable(bool enable) { m_enabled = enable; m_setEnabled = true; } + void Show(bool show) { m_shown = show; m_setShown = true; } + void SetText(const wxString& text) { m_text = text; m_setText = true; } + + // A flag saying if the item can be checked. True by default. + bool IsCheckable() const { return m_isCheckable; } + void DisallowCheck() { m_isCheckable = false; } + + // Sets the interval between updates in milliseconds. + // Set to -1 to disable updates, or to 0 to update as frequently as possible. + static void SetUpdateInterval(long updateInterval) { sm_updateInterval = updateInterval; } + + // Returns the current interval between updates in milliseconds + static long GetUpdateInterval() { return sm_updateInterval; } + + // Can we update this window? + static bool CanUpdate(wxWindowBase *win); + + // Reset the update time to provide a delay until the next + // time we should update + static void ResetUpdateTime(); + + // Specify how wxWidgets will send update events: to + // all windows, or only to those which specify that they + // will process the events. + static void SetMode(wxUpdateUIMode mode) { sm_updateMode = mode; } + + // Returns the UI update mode + static wxUpdateUIMode GetMode() { return sm_updateMode; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxUpdateUIEvent(*this); } + +protected: + bool m_checked; + bool m_enabled; + bool m_shown; + bool m_setEnabled; + bool m_setShown; + bool m_setText; + bool m_setChecked; + bool m_isCheckable; + wxString m_text; +#if wxUSE_LONGLONG + static wxLongLong sm_lastUpdate; +#endif + static long sm_updateInterval; + static wxUpdateUIMode sm_updateMode; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxUpdateUIEvent); +}; + +/* + wxEVT_SYS_COLOUR_CHANGED + */ + +// TODO: shouldn't all events record the window ID? +class WXDLLIMPEXP_CORE wxSysColourChangedEvent : public wxEvent +{ +public: + wxSysColourChangedEvent() + : wxEvent(0, wxEVT_SYS_COLOUR_CHANGED) + { } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxSysColourChangedEvent(*this); } + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxSysColourChangedEvent); +}; + +/* + wxEVT_MOUSE_CAPTURE_CHANGED + The window losing the capture receives this message + (even if it released the capture itself). + */ + +class WXDLLIMPEXP_CORE wxMouseCaptureChangedEvent : public wxEvent +{ +public: + wxMouseCaptureChangedEvent(wxWindowID winid = 0, wxWindow* gainedCapture = NULL) + : wxEvent(winid, wxEVT_MOUSE_CAPTURE_CHANGED), + m_gainedCapture(gainedCapture) + { } + + wxMouseCaptureChangedEvent(const wxMouseCaptureChangedEvent& event) + : wxEvent(event), + m_gainedCapture(event.m_gainedCapture) + { } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxMouseCaptureChangedEvent(*this); } + + wxWindow* GetCapturedWindow() const { return m_gainedCapture; } + +private: + wxWindow* m_gainedCapture; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMouseCaptureChangedEvent); +}; + +/* + wxEVT_MOUSE_CAPTURE_LOST + The window losing the capture receives this message, unless it released + it itself or unless wxWindow::CaptureMouse was called on another window + (and so capture will be restored when the new capturer releases it). + */ + +class WXDLLIMPEXP_CORE wxMouseCaptureLostEvent : public wxEvent +{ +public: + wxMouseCaptureLostEvent(wxWindowID winid = 0) + : wxEvent(winid, wxEVT_MOUSE_CAPTURE_LOST) + {} + + wxMouseCaptureLostEvent(const wxMouseCaptureLostEvent& event) + : wxEvent(event) + {} + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxMouseCaptureLostEvent(*this); } + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMouseCaptureLostEvent); +}; + +/* + wxEVT_DISPLAY_CHANGED + */ +class WXDLLIMPEXP_CORE wxDisplayChangedEvent : public wxEvent +{ +public: + wxDisplayChangedEvent() + : wxEvent(0, wxEVT_DISPLAY_CHANGED) + { } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxDisplayChangedEvent(*this); } + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxDisplayChangedEvent); +}; + +/* + wxEVT_DPI_CHANGED + */ +class WXDLLIMPEXP_CORE wxDPIChangedEvent : public wxEvent +{ +public: + explicit + wxDPIChangedEvent(const wxSize& oldDPI = wxDefaultSize, + const wxSize& newDPI = wxDefaultSize) + : wxEvent(0, wxEVT_DPI_CHANGED), + m_oldDPI(oldDPI), + m_newDPI(newDPI) + { } + + wxSize GetOldDPI() const { return m_oldDPI; } + wxSize GetNewDPI() const { return m_newDPI; } + + // Scale the value by the ratio between new and old DPIs carried by this + // event. + wxSize Scale(wxSize sz) const; + + int ScaleX(int x) const { return Scale(wxSize(x, -1)).x; } + int ScaleY(int y) const { return Scale(wxSize(-1, y)).y; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxDPIChangedEvent(*this); } + +private: + wxSize m_oldDPI; + wxSize m_newDPI; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxDPIChangedEvent); +}; + +/* + wxEVT_PALETTE_CHANGED + */ + +class WXDLLIMPEXP_CORE wxPaletteChangedEvent : public wxEvent +{ +public: + wxPaletteChangedEvent(wxWindowID winid = 0) + : wxEvent(winid, wxEVT_PALETTE_CHANGED), + m_changedWindow(NULL) + { } + + wxPaletteChangedEvent(const wxPaletteChangedEvent& event) + : wxEvent(event), + m_changedWindow(event.m_changedWindow) + { } + + void SetChangedWindow(wxWindow* win) { m_changedWindow = win; } + wxWindow* GetChangedWindow() const { return m_changedWindow; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxPaletteChangedEvent(*this); } + +protected: + wxWindow* m_changedWindow; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPaletteChangedEvent); +}; + +/* + wxEVT_QUERY_NEW_PALETTE + Indicates the window is getting keyboard focus and should re-do its palette. + */ + +class WXDLLIMPEXP_CORE wxQueryNewPaletteEvent : public wxEvent +{ +public: + wxQueryNewPaletteEvent(wxWindowID winid = 0) + : wxEvent(winid, wxEVT_QUERY_NEW_PALETTE), + m_paletteRealized(false) + { } + wxQueryNewPaletteEvent(const wxQueryNewPaletteEvent& event) + : wxEvent(event), + m_paletteRealized(event.m_paletteRealized) + { } + + // App sets this if it changes the palette. + void SetPaletteRealized(bool realized) { m_paletteRealized = realized; } + bool GetPaletteRealized() const { return m_paletteRealized; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxQueryNewPaletteEvent(*this); } + +protected: + bool m_paletteRealized; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxQueryNewPaletteEvent); +}; + +/* + Event generated by dialog navigation keys + wxEVT_NAVIGATION_KEY + */ +// NB: don't derive from command event to avoid being propagated to the parent +class WXDLLIMPEXP_CORE wxNavigationKeyEvent : public wxEvent +{ +public: + wxNavigationKeyEvent() + : wxEvent(0, wxEVT_NAVIGATION_KEY), + m_flags(IsForward | FromTab), // defaults are for TAB + m_focus(NULL) + { + m_propagationLevel = wxEVENT_PROPAGATE_NONE; + } + + wxNavigationKeyEvent(const wxNavigationKeyEvent& event) + : wxEvent(event), + m_flags(event.m_flags), + m_focus(event.m_focus) + { } + + // direction: forward (true) or backward (false) + bool GetDirection() const + { return (m_flags & IsForward) != 0; } + void SetDirection(bool bForward) + { if ( bForward ) m_flags |= IsForward; else m_flags &= ~IsForward; } + + // it may be a window change event (MDI, notebook pages...) or a control + // change event + bool IsWindowChange() const + { return (m_flags & WinChange) != 0; } + void SetWindowChange(bool bIs) + { if ( bIs ) m_flags |= WinChange; else m_flags &= ~WinChange; } + + // Set to true under MSW if the event was generated using the tab key. + // This is required for proper navogation over radio buttons + bool IsFromTab() const + { return (m_flags & FromTab) != 0; } + void SetFromTab(bool bIs) + { if ( bIs ) m_flags |= FromTab; else m_flags &= ~FromTab; } + + // the child which has the focus currently (may be NULL - use + // wxWindow::FindFocus then) + wxWindow* GetCurrentFocus() const { return m_focus; } + void SetCurrentFocus(wxWindow *win) { m_focus = win; } + + // Set flags + void SetFlags(long flags) { m_flags = flags; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxNavigationKeyEvent(*this); } + + enum wxNavigationKeyEventFlags + { + IsBackward = 0x0000, + IsForward = 0x0001, + WinChange = 0x0002, + FromTab = 0x0004 + }; + + long m_flags; + wxWindow *m_focus; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNavigationKeyEvent); +}; + +// Window creation/destruction events: the first is sent as soon as window is +// created (i.e. the underlying GUI object exists), but when the C++ object is +// fully initialized (so virtual functions may be called). The second, +// wxEVT_DESTROY, is sent right before the window is destroyed - again, it's +// still safe to call virtual functions at this moment +/* + wxEVT_CREATE + wxEVT_DESTROY + */ + +class WXDLLIMPEXP_CORE wxWindowCreateEvent : public wxCommandEvent +{ +public: + wxWindowCreateEvent(wxWindow *win = NULL); + + wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxWindowCreateEvent(*this); } + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxWindowCreateEvent); +}; + +class WXDLLIMPEXP_CORE wxWindowDestroyEvent : public wxCommandEvent +{ +public: + wxWindowDestroyEvent(wxWindow *win = NULL); + + wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxWindowDestroyEvent(*this); } + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxWindowDestroyEvent); +}; + +// A help event is sent when the user clicks on a window in context-help mode. +/* + wxEVT_HELP + wxEVT_DETAILED_HELP +*/ + +class WXDLLIMPEXP_CORE wxHelpEvent : public wxCommandEvent +{ +public: + // how was this help event generated? + enum Origin + { + Origin_Unknown, // unrecognized event source + Origin_Keyboard, // event generated from F1 key press + Origin_HelpButton // event from [?] button on the title bar (Windows) + }; + + wxHelpEvent(wxEventType type = wxEVT_NULL, + wxWindowID winid = 0, + const wxPoint& pt = wxDefaultPosition, + Origin origin = Origin_Unknown) + : wxCommandEvent(type, winid), + m_pos(pt), + m_origin(GuessOrigin(origin)) + { } + wxHelpEvent(const wxHelpEvent& event) + : wxCommandEvent(event), + m_pos(event.m_pos), + m_target(event.m_target), + m_link(event.m_link), + m_origin(event.m_origin) + { } + + // Position of event (in screen coordinates) + const wxPoint& GetPosition() const { return m_pos; } + void SetPosition(const wxPoint& pos) { m_pos = pos; } + + // Optional link to further help + const wxString& GetLink() const { return m_link; } + void SetLink(const wxString& link) { m_link = link; } + + // Optional target to display help in. E.g. a window specification + const wxString& GetTarget() const { return m_target; } + void SetTarget(const wxString& target) { m_target = target; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxHelpEvent(*this); } + + // optional indication of the event source + Origin GetOrigin() const { return m_origin; } + void SetOrigin(Origin origin) { m_origin = origin; } + +protected: + wxPoint m_pos; + wxString m_target; + wxString m_link; + Origin m_origin; + + // we can try to guess the event origin ourselves, even if none is + // specified in the ctor + static Origin GuessOrigin(Origin origin); + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHelpEvent); +}; + +// A Clipboard Text event is sent when a window intercepts text copy/cut/paste +// message, i.e. the user has cut/copied/pasted data from/into a text control +// via ctrl-C/X/V, ctrl/shift-del/insert, a popup menu command, etc. +// NOTE : under windows these events are *NOT* generated automatically +// for a Rich Edit text control. +/* +wxEVT_TEXT_COPY +wxEVT_TEXT_CUT +wxEVT_TEXT_PASTE +*/ + +class WXDLLIMPEXP_CORE wxClipboardTextEvent : public wxCommandEvent +{ +public: + wxClipboardTextEvent(wxEventType type = wxEVT_NULL, + wxWindowID winid = 0) + : wxCommandEvent(type, winid) + { } + wxClipboardTextEvent(const wxClipboardTextEvent& event) + : wxCommandEvent(event) + { } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxClipboardTextEvent(*this); } + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxClipboardTextEvent); +}; + +// A Context event is sent when the user right clicks on a window or +// presses Shift-F10 +// NOTE : Under windows this is a repackaged WM_CONTETXMENU message +// Under other systems it may have to be generated from a right click event +/* + wxEVT_CONTEXT_MENU +*/ + +class WXDLLIMPEXP_CORE wxContextMenuEvent : public wxCommandEvent +{ +public: + wxContextMenuEvent(wxEventType type = wxEVT_NULL, + wxWindowID winid = 0, + const wxPoint& pt = wxDefaultPosition) + : wxCommandEvent(type, winid), + m_pos(pt) + { } + wxContextMenuEvent(const wxContextMenuEvent& event) + : wxCommandEvent(event), + m_pos(event.m_pos) + { } + + // Position of event (in screen coordinates) + const wxPoint& GetPosition() const { return m_pos; } + void SetPosition(const wxPoint& pos) { m_pos = pos; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxContextMenuEvent(*this); } + +protected: + wxPoint m_pos; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxContextMenuEvent); +}; + + +/* TODO + wxEVT_SETTING_CHANGED, // WM_WININICHANGE +// wxEVT_FONT_CHANGED, // WM_FONTCHANGE: roll into wxEVT_SETTING_CHANGED, but remember to propagate + // wxEVT_FONT_CHANGED to all other windows (maybe). + wxEVT_DRAW_ITEM, // Leave these three as virtual functions in wxControl?? Platform-specific. + wxEVT_MEASURE_ITEM, + wxEVT_COMPARE_ITEM +*/ + +#endif // wxUSE_GUI + + +// ============================================================================ +// event handler and related classes +// ============================================================================ + + +// struct containing the members common to static and dynamic event tables +// entries +struct WXDLLIMPEXP_BASE wxEventTableEntryBase +{ + wxEventTableEntryBase(int winid, int idLast, + wxEventFunctor* fn, wxObject *data) + : m_id(winid), + m_lastId(idLast), + m_fn(fn), + m_callbackUserData(data) + { + wxASSERT_MSG( idLast == wxID_ANY || winid <= idLast, + "invalid IDs range: lower bound > upper bound" ); + } + + wxEventTableEntryBase( const wxEventTableEntryBase &entry ) + : m_id( entry.m_id ), + m_lastId( entry.m_lastId ), + m_fn( entry.m_fn ), + m_callbackUserData( entry.m_callbackUserData ) + { + // This is a 'hack' to ensure that only one instance tries to delete + // the functor pointer. It is safe as long as the only place where the + // copy constructor is being called is when the static event tables are + // being initialized (a temporary instance is created and then this + // constructor is called). + + const_cast( entry ).m_fn = NULL; + } + + ~wxEventTableEntryBase() + { + delete m_fn; + } + + // the range of ids for this entry: if m_lastId == wxID_ANY, the range + // consists only of m_id, otherwise it is m_id..m_lastId inclusive + int m_id, + m_lastId; + + // function/method/functor to call + wxEventFunctor* m_fn; + + // arbitrary user data associated with the callback + wxObject* m_callbackUserData; + +private: + wxDECLARE_NO_ASSIGN_CLASS(wxEventTableEntryBase); +}; + +// an entry from a static event table +struct WXDLLIMPEXP_BASE wxEventTableEntry : public wxEventTableEntryBase +{ + wxEventTableEntry(const int& evType, int winid, int idLast, + wxEventFunctor* fn, wxObject *data) + : wxEventTableEntryBase(winid, idLast, fn, data), + m_eventType(evType) + { } + + // the reference to event type: this allows us to not care about the + // (undefined) order in which the event table entries and the event types + // are initialized: initially the value of this reference might be + // invalid, but by the time it is used for the first time, all global + // objects will have been initialized (including the event type constants) + // and so it will have the correct value when it is needed + const int& m_eventType; + +private: + wxDECLARE_NO_ASSIGN_CLASS(wxEventTableEntry); +}; + +// an entry used in dynamic event table managed by wxEvtHandler::Connect() +struct WXDLLIMPEXP_BASE wxDynamicEventTableEntry : public wxEventTableEntryBase +{ + wxDynamicEventTableEntry(int evType, int winid, int idLast, + wxEventFunctor* fn, wxObject *data) + : wxEventTableEntryBase(winid, idLast, fn, data), + m_eventType(evType) + { } + + // not a reference here as we can't keep a reference to a temporary int + // created to wrap the constant value typically passed to Connect() - nor + // do we need it + int m_eventType; + +private: + wxDECLARE_NO_ASSIGN_CLASS(wxDynamicEventTableEntry); +}; + +// ---------------------------------------------------------------------------- +// wxEventTable: an array of event entries terminated with {0, 0, 0, 0, 0} +// ---------------------------------------------------------------------------- + +struct WXDLLIMPEXP_BASE wxEventTable +{ + const wxEventTable *baseTable; // base event table (next in chain) + const wxEventTableEntry *entries; // bottom of entry array +}; + +// ---------------------------------------------------------------------------- +// wxEventHashTable: a helper of wxEvtHandler to speed up wxEventTable lookups. +// ---------------------------------------------------------------------------- + +WX_DEFINE_ARRAY_PTR(const wxEventTableEntry*, wxEventTableEntryPointerArray); + +class WXDLLIMPEXP_BASE wxEventHashTable +{ +private: + // Internal data structs + struct EventTypeTable + { + wxEventType eventType; + wxEventTableEntryPointerArray eventEntryTable; + }; + typedef EventTypeTable* EventTypeTablePointer; + +public: + // Constructor, needs the event table it needs to hash later on. + // Note: hashing of the event table is not done in the constructor as it + // can be that the event table is not yet full initialize, the hash + // will gets initialized when handling the first event look-up request. + wxEventHashTable(const wxEventTable &table); + // Destructor. + ~wxEventHashTable(); + + // Handle the given event, in other words search the event table hash + // and call self->ProcessEvent() if a match was found. + bool HandleEvent(wxEvent& event, wxEvtHandler *self); + + // Clear table + void Clear(); + +#if wxUSE_MEMORY_TRACING + // Clear all tables: only used to work around problems in memory tracing + // code + static void ClearAll(); +#endif // wxUSE_MEMORY_TRACING + +protected: + // Init the hash table with the entries of the static event table. + void InitHashTable(); + // Helper function of InitHashTable() to insert 1 entry into the hash table. + void AddEntry(const wxEventTableEntry &entry); + // Allocate and init with null pointers the base hash table. + void AllocEventTypeTable(size_t size); + // Grow the hash table in size and transfer all items currently + // in the table to the correct location in the new table. + void GrowEventTypeTable(); + +protected: + const wxEventTable &m_table; + bool m_rebuildHash; + + size_t m_size; + EventTypeTablePointer *m_eventTypeTable; + + static wxEventHashTable* sm_first; + wxEventHashTable* m_previous; + wxEventHashTable* m_next; + + wxDECLARE_NO_COPY_CLASS(wxEventHashTable); +}; + +// ---------------------------------------------------------------------------- +// wxEvtHandler: the base class for all objects handling wxWidgets events +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxEvtHandler : public wxObject + , public wxTrackable +{ +public: + wxEvtHandler(); + virtual ~wxEvtHandler(); + + + // Event handler chain + // ------------------- + + wxEvtHandler *GetNextHandler() const { return m_nextHandler; } + wxEvtHandler *GetPreviousHandler() const { return m_previousHandler; } + virtual void SetNextHandler(wxEvtHandler *handler) { m_nextHandler = handler; } + virtual void SetPreviousHandler(wxEvtHandler *handler) { m_previousHandler = handler; } + + void SetEvtHandlerEnabled(bool enabled) { m_enabled = enabled; } + bool GetEvtHandlerEnabled() const { return m_enabled; } + + void Unlink(); + bool IsUnlinked() const; + + + // Global event filters + // -------------------- + + // Add an event filter whose FilterEvent() method will be called for each + // and every event processed by wxWidgets. The filters are called in LIFO + // order and wxApp is registered as an event filter by default. The pointer + // must remain valid until it's removed with RemoveFilter() and is not + // deleted by wxEvtHandler. + static void AddFilter(wxEventFilter* filter); + + // Remove a filter previously installed with AddFilter(). + static void RemoveFilter(wxEventFilter* filter); + + + // Event queuing and processing + // ---------------------------- + + // Process an event right now: this can only be called from the main + // thread, use QueueEvent() for scheduling the events for + // processing from other threads. + virtual bool ProcessEvent(wxEvent& event); + + // Process an event by calling ProcessEvent and handling any exceptions + // thrown by event handlers. It's mostly useful when processing wx events + // when called from C code (e.g. in GTK+ callback) when the exception + // wouldn't correctly propagate to wxEventLoop. + bool SafelyProcessEvent(wxEvent& event); + // NOTE: uses ProcessEvent() + + // This method tries to process the event in this event handler, including + // any preprocessing done by TryBefore() and all the handlers chained to + // it, but excluding the post-processing done in TryAfter(). + // + // It is meant to be called from ProcessEvent() only and is not virtual, + // additional event handlers can be hooked into the normal event processing + // logic using TryBefore() and TryAfter() hooks. + // + // You can also call it yourself to forward an event to another handler but + // without propagating it upwards if it's unhandled (this is usually + // unwanted when forwarding as the original handler would already do it if + // needed normally). + bool ProcessEventLocally(wxEvent& event); + + // Schedule the given event to be processed later. It takes ownership of + // the event pointer, i.e. it will be deleted later. This is safe to call + // from multiple threads although you still need to ensure that wxString + // fields of the event object are deep copies and not use the same string + // buffer as other wxString objects in this thread. + virtual void QueueEvent(wxEvent *event); + + // Add an event to be processed later: notice that this function is not + // safe to call from threads other than main, use QueueEvent() + virtual void AddPendingEvent(const wxEvent& event) + { + // notice that the thread-safety problem comes from the fact that + // Clone() doesn't make deep copies of wxString fields of wxEvent + // object and so the same wxString could be used from both threads when + // the event object is destroyed in this one -- QueueEvent() avoids + // this problem as the event pointer is not used any more in this + // thread at all after it is called. + QueueEvent(event.Clone()); + } + + void ProcessPendingEvents(); + // NOTE: uses ProcessEvent() + + void DeletePendingEvents(); + +#if wxUSE_THREADS + bool ProcessThreadEvent(const wxEvent& event); + // NOTE: uses AddPendingEvent(); call only from secondary threads +#endif + +#if wxUSE_EXCEPTIONS + // This is a private function which handles any exceptions arising during + // the execution of user-defined code called in the event loop context by + // forwarding them to wxApp::OnExceptionInMainLoop() and, if it rethrows, + // to wxApp::OnUnhandledException(). In any case this function ensures that + // no exceptions ever escape from it and so is useful to call at module + // boundary. + // + // It must be only called when handling an active exception. + static void WXConsumeException(); +#endif // wxUSE_EXCEPTIONS + + // Asynchronous method calls: these methods schedule the given method + // pointer for a later call (during the next idle event loop iteration). + // + // Notice that the method is called on this object itself, so the object + // CallAfter() is called on must have the correct dynamic type. + // + // These method can be used from another thread. + + template + void CallAfter(void (T::*method)()) + { + QueueEvent( + new wxAsyncMethodCallEvent0(static_cast(this), method) + ); + } + + // Notice that we use P1 and not T1 for the parameter to allow passing + // parameters that are convertible to the type taken by the method + // instead of being exactly the same, to be closer to the usual method call + // semantics. + template + void CallAfter(void (T::*method)(T1 x1), P1 x1) + { + QueueEvent( + new wxAsyncMethodCallEvent1( + static_cast(this), method, x1) + ); + } + + template + void CallAfter(void (T::*method)(T1 x1, T2 x2), P1 x1, P2 x2) + { + QueueEvent( + new wxAsyncMethodCallEvent2( + static_cast(this), method, x1, x2) + ); + } + + template + void CallAfter(const T& fn) + { + QueueEvent(new wxAsyncMethodCallEventFunctor(this, fn)); + } + + + // Connecting and disconnecting + // ---------------------------- + + // These functions are used for old, untyped, event handlers and don't + // check that the type of the function passed to them actually matches the + // type of the event. They also only allow connecting events to methods of + // wxEvtHandler-derived classes. + // + // The template Connect() methods below are safer and allow connecting + // events to arbitrary functions or functors -- but require compiler + // support for templates. + + // Dynamic association of a member function handler with the event handler, + // winid and event type + void Connect(int winid, + int lastId, + wxEventType eventType, + wxObjectEventFunction func, + wxObject *userData = NULL, + wxEvtHandler *eventSink = NULL) + { + DoBind(winid, lastId, eventType, + wxNewEventFunctor(eventType, func, eventSink), + userData); + } + + // Convenience function: take just one id + void Connect(int winid, + wxEventType eventType, + wxObjectEventFunction func, + wxObject *userData = NULL, + wxEvtHandler *eventSink = NULL) + { Connect(winid, wxID_ANY, eventType, func, userData, eventSink); } + + // Even more convenient: without id (same as using id of wxID_ANY) + void Connect(wxEventType eventType, + wxObjectEventFunction func, + wxObject *userData = NULL, + wxEvtHandler *eventSink = NULL) + { Connect(wxID_ANY, wxID_ANY, eventType, func, userData, eventSink); } + + bool Disconnect(int winid, + int lastId, + wxEventType eventType, + wxObjectEventFunction func = NULL, + wxObject *userData = NULL, + wxEvtHandler *eventSink = NULL) + { + return DoUnbind(winid, lastId, eventType, + wxMakeEventFunctor(eventType, func, eventSink), + userData ); + } + + bool Disconnect(int winid = wxID_ANY, + wxEventType eventType = wxEVT_NULL, + wxObjectEventFunction func = NULL, + wxObject *userData = NULL, + wxEvtHandler *eventSink = NULL) + { return Disconnect(winid, wxID_ANY, eventType, func, userData, eventSink); } + + bool Disconnect(wxEventType eventType, + wxObjectEventFunction func, + wxObject *userData = NULL, + wxEvtHandler *eventSink = NULL) + { return Disconnect(wxID_ANY, eventType, func, userData, eventSink); } + + // Bind functions to an event: + template + void Bind(const EventTag& eventType, + void (*function)(EventArg &), + int winid = wxID_ANY, + int lastId = wxID_ANY, + wxObject *userData = NULL) + { + DoBind(winid, lastId, eventType, + wxNewEventFunctor(eventType, function), + userData); + } + + + template + bool Unbind(const EventTag& eventType, + void (*function)(EventArg &), + int winid = wxID_ANY, + int lastId = wxID_ANY, + wxObject *userData = NULL) + { + return DoUnbind(winid, lastId, eventType, + wxMakeEventFunctor(eventType, function), + userData); + } + + // Bind functors to an event: + template + void Bind(const EventTag& eventType, + const Functor &functor, + int winid = wxID_ANY, + int lastId = wxID_ANY, + wxObject *userData = NULL) + { + DoBind(winid, lastId, eventType, + wxNewEventFunctor(eventType, functor), + userData); + } + + + template + bool Unbind(const EventTag& eventType, + const Functor &functor, + int winid = wxID_ANY, + int lastId = wxID_ANY, + wxObject *userData = NULL) + { + return DoUnbind(winid, lastId, eventType, + wxMakeEventFunctor(eventType, functor), + userData); + } + + + // Bind a method of a class (called on the specified handler which must + // be convertible to this class) object to an event: + + template + void Bind(const EventTag &eventType, + void (Class::*method)(EventArg &), + EventHandler *handler, + int winid = wxID_ANY, + int lastId = wxID_ANY, + wxObject *userData = NULL) + { + DoBind(winid, lastId, eventType, + wxNewEventFunctor(eventType, method, handler), + userData); + } + + template + bool Unbind(const EventTag &eventType, + void (Class::*method)(EventArg&), + EventHandler *handler, + int winid = wxID_ANY, + int lastId = wxID_ANY, + wxObject *userData = NULL ) + { + return DoUnbind(winid, lastId, eventType, + wxMakeEventFunctor(eventType, method, handler), + userData); + } + + // User data can be associated with each wxEvtHandler + void SetClientObject( wxClientData *data ) { DoSetClientObject(data); } + wxClientData *GetClientObject() const { return DoGetClientObject(); } + + void SetClientData( void *data ) { DoSetClientData(data); } + void *GetClientData() const { return DoGetClientData(); } + + + // implementation from now on + // -------------------------- + + // check if the given event table entry matches this event by id (the check + // for the event type should be done by caller) and call the handler if it + // does + // + // return true if the event was processed, false otherwise (no match or the + // handler decided to skip the event) + static bool ProcessEventIfMatchesId(const wxEventTableEntryBase& tableEntry, + wxEvtHandler *handler, + wxEvent& event); + + // Allow iterating over all connected dynamic event handlers: you must pass + // the same "cookie" to GetFirst() and GetNext() and call them until null + // is returned. + // + // These functions are for internal use only. + wxDynamicEventTableEntry* GetFirstDynamicEntry(size_t& cookie) const; + wxDynamicEventTableEntry* GetNextDynamicEntry(size_t& cookie) const; + + virtual bool SearchEventTable(wxEventTable& table, wxEvent& event); + bool SearchDynamicEventTable( wxEvent& event ); + + // Avoid problems at exit by cleaning up static hash table gracefully + void ClearEventHashTable() { GetEventHashTable().Clear(); } + void OnSinkDestroyed( wxEvtHandler *sink ); + + +private: + void DoBind(int winid, + int lastId, + wxEventType eventType, + wxEventFunctor *func, + wxObject* userData = NULL); + + bool DoUnbind(int winid, + int lastId, + wxEventType eventType, + const wxEventFunctor& func, + wxObject *userData = NULL); + + static const wxEventTableEntry sm_eventTableEntries[]; + +protected: + // hooks for wxWindow used by ProcessEvent() + // ----------------------------------------- + + // this one is called before trying our own event table to allow plugging + // in the event handlers overriding the default logic, this is used by e.g. + // validators. + virtual bool TryBefore(wxEvent& event); + + // This one is not a hook but just a helper which looks up the handler in + // this object itself. + // + // It is called from ProcessEventLocally() and normally shouldn't be called + // directly as doing it would ignore any chained event handlers + bool TryHereOnly(wxEvent& event); + + // Another helper which simply calls pre-processing hook and then tries to + // handle the event at this handler level. + bool TryBeforeAndHere(wxEvent& event) + { + return TryBefore(event) || TryHereOnly(event); + } + + // this one is called after failing to find the event handle in our own + // table to give a chance to the other windows to process it + // + // base class implementation passes the event to wxTheApp + virtual bool TryAfter(wxEvent& event); + +#if WXWIN_COMPATIBILITY_2_8 + // deprecated method: override TryBefore() instead of this one + wxDEPRECATED_BUT_USED_INTERNALLY_INLINE( + virtual bool TryValidator(wxEvent& WXUNUSED(event)), return false; ) + + wxDEPRECATED_BUT_USED_INTERNALLY_INLINE( + virtual bool TryParent(wxEvent& event), return DoTryApp(event); ) +#endif // WXWIN_COMPATIBILITY_2_8 + + // Overriding this method allows filtering the event handlers dynamically + // connected to this object. If this method returns false, the handler is + // not connected at all. If it returns true, it is connected using the + // possibly modified fields of the given entry. + virtual bool OnDynamicBind(wxDynamicEventTableEntry& WXUNUSED(entry)) + { + return true; + } + + + static const wxEventTable sm_eventTable; + virtual const wxEventTable *GetEventTable() const; + + static wxEventHashTable sm_eventHashTable; + virtual wxEventHashTable& GetEventHashTable() const; + + wxEvtHandler* m_nextHandler; + wxEvtHandler* m_previousHandler; + + typedef wxVector DynamicEvents; + DynamicEvents* m_dynamicEvents; + + wxList* m_pendingEvents; + +#if wxUSE_THREADS + // critical section protecting m_pendingEvents + wxCriticalSection m_pendingEventsLock; +#endif // wxUSE_THREADS + + // Is event handler enabled? + bool m_enabled; + + + // The user data: either an object which will be deleted by the container + // when it's deleted or some raw pointer which we do nothing with - only + // one type of data can be used with the given window (i.e. you cannot set + // the void data and then associate the container with wxClientData or vice + // versa) + union + { + wxClientData *m_clientObject; + void *m_clientData; + }; + + // what kind of data do we have? + wxClientDataType m_clientDataType; + + // client data accessors + virtual void DoSetClientObject( wxClientData *data ); + virtual wxClientData *DoGetClientObject() const; + + virtual void DoSetClientData( void *data ); + virtual void *DoGetClientData() const; + + // Search tracker objects for event connection with this sink + wxEventConnectionRef *FindRefInTrackerList(wxEvtHandler *handler); + + // Stub virtual functions for forward binary compatibility. DO NOT USE. + virtual void* WXReservedEvtHandler1(void*); + virtual void* WXReservedEvtHandler2(void*); + +private: + // pass the event to wxTheApp instance, called from TryAfter() + bool DoTryApp(wxEvent& event); + + // try to process events in all handlers chained to this one + bool DoTryChain(wxEvent& event); + + // Head of the event filter linked list. + static wxEventFilter* ms_filterList; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxEvtHandler); +}; + +WX_DEFINE_ARRAY_WITH_DECL_PTR(wxEvtHandler *, wxEvtHandlerArray, class WXDLLIMPEXP_BASE); + + +// Define an inline method of wxObjectEventFunctor which couldn't be defined +// before wxEvtHandler declaration: at least Sun CC refuses to compile function +// calls through pointer to member for forward-declared classes (see #12452). +inline void wxObjectEventFunctor::operator()(wxEvtHandler *handler, wxEvent& event) +{ + wxEvtHandler * const realHandler = m_handler ? m_handler : handler; + + (realHandler->*m_method)(event); +} + +// ---------------------------------------------------------------------------- +// wxEventConnectionRef represents all connections between two event handlers +// and enables automatic disconnect when an event handler sink goes out of +// scope. Each connection/disconnect increases/decreases ref count, and +// when it reaches zero the node goes out of scope. +// ---------------------------------------------------------------------------- + +class wxEventConnectionRef : public wxTrackerNode +{ +public: + wxEventConnectionRef() : m_src(NULL), m_sink(NULL), m_refCount(0) { } + wxEventConnectionRef(wxEvtHandler *src, wxEvtHandler *sink) + : m_src(src), m_sink(sink), m_refCount(1) + { + m_sink->AddNode(this); + } + + // The sink is being destroyed + virtual void OnObjectDestroy( ) wxOVERRIDE + { + if ( m_src ) + m_src->OnSinkDestroyed( m_sink ); + delete this; + } + + virtual wxEventConnectionRef *ToEventConnection() wxOVERRIDE { return this; } + + void IncRef() { m_refCount++; } + void DecRef() + { + if ( !--m_refCount ) + { + // The sink holds the only external pointer to this object + if ( m_sink ) + m_sink->RemoveNode(this); + delete this; + } + } + +private: + wxEvtHandler *m_src, + *m_sink; + int m_refCount; + + friend class wxEvtHandler; + + wxDECLARE_NO_ASSIGN_CLASS(wxEventConnectionRef); +}; + +// Post a message to the given event handler which will be processed during the +// next event loop iteration. +// +// Notice that this one is not thread-safe, use wxQueueEvent() +inline void wxPostEvent(wxEvtHandler *dest, const wxEvent& event) +{ + wxCHECK_RET( dest, "need an object to post event to" ); + + dest->AddPendingEvent(event); +} + +// Wrapper around wxEvtHandler::QueueEvent(): adds an event for later +// processing, unlike wxPostEvent it is safe to use from different thread even +// for events with wxString members +inline void wxQueueEvent(wxEvtHandler *dest, wxEvent *event) +{ + wxCHECK_RET( dest, "need an object to queue event for" ); + + dest->QueueEvent(event); +} + +typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&); +typedef void (wxEvtHandler::*wxIdleEventFunction)(wxIdleEvent&); +typedef void (wxEvtHandler::*wxThreadEventFunction)(wxThreadEvent&); + +#define wxEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxEventFunction, func) +#define wxIdleEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxIdleEventFunction, func) +#define wxThreadEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxThreadEventFunction, func) + +#if wxUSE_GUI + +// ---------------------------------------------------------------------------- +// wxEventBlocker: helper class to temporarily disable event handling for a window +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxEventBlocker : public wxEvtHandler +{ +public: + wxEventBlocker(wxWindow *win, wxEventType type = wxEVT_ANY); + virtual ~wxEventBlocker(); + + void Block(wxEventType type) + { + m_eventsToBlock.push_back(type); + } + + virtual bool ProcessEvent(wxEvent& event) wxOVERRIDE; + +protected: + wxArrayInt m_eventsToBlock; + wxWindow *m_window; + + wxDECLARE_NO_COPY_CLASS(wxEventBlocker); +}; + +typedef void (wxEvtHandler::*wxCommandEventFunction)(wxCommandEvent&); +typedef void (wxEvtHandler::*wxScrollEventFunction)(wxScrollEvent&); +typedef void (wxEvtHandler::*wxScrollWinEventFunction)(wxScrollWinEvent&); +typedef void (wxEvtHandler::*wxSizeEventFunction)(wxSizeEvent&); +typedef void (wxEvtHandler::*wxMoveEventFunction)(wxMoveEvent&); +typedef void (wxEvtHandler::*wxPaintEventFunction)(wxPaintEvent&); +typedef void (wxEvtHandler::*wxNcPaintEventFunction)(wxNcPaintEvent&); +typedef void (wxEvtHandler::*wxEraseEventFunction)(wxEraseEvent&); +typedef void (wxEvtHandler::*wxMouseEventFunction)(wxMouseEvent&); +typedef void (wxEvtHandler::*wxCharEventFunction)(wxKeyEvent&); +typedef void (wxEvtHandler::*wxFocusEventFunction)(wxFocusEvent&); +typedef void (wxEvtHandler::*wxChildFocusEventFunction)(wxChildFocusEvent&); +typedef void (wxEvtHandler::*wxActivateEventFunction)(wxActivateEvent&); +typedef void (wxEvtHandler::*wxMenuEventFunction)(wxMenuEvent&); +typedef void (wxEvtHandler::*wxJoystickEventFunction)(wxJoystickEvent&); +typedef void (wxEvtHandler::*wxDropFilesEventFunction)(wxDropFilesEvent&); +typedef void (wxEvtHandler::*wxInitDialogEventFunction)(wxInitDialogEvent&); +typedef void (wxEvtHandler::*wxSysColourChangedEventFunction)(wxSysColourChangedEvent&); +typedef void (wxEvtHandler::*wxDisplayChangedEventFunction)(wxDisplayChangedEvent&); +typedef void (wxEvtHandler::*wxDPIChangedEventFunction)(wxDPIChangedEvent&); +typedef void (wxEvtHandler::*wxUpdateUIEventFunction)(wxUpdateUIEvent&); +typedef void (wxEvtHandler::*wxCloseEventFunction)(wxCloseEvent&); +typedef void (wxEvtHandler::*wxShowEventFunction)(wxShowEvent&); +typedef void (wxEvtHandler::*wxIconizeEventFunction)(wxIconizeEvent&); +typedef void (wxEvtHandler::*wxMaximizeEventFunction)(wxMaximizeEvent&); +typedef void (wxEvtHandler::*wxNavigationKeyEventFunction)(wxNavigationKeyEvent&); +typedef void (wxEvtHandler::*wxPaletteChangedEventFunction)(wxPaletteChangedEvent&); +typedef void (wxEvtHandler::*wxQueryNewPaletteEventFunction)(wxQueryNewPaletteEvent&); +typedef void (wxEvtHandler::*wxWindowCreateEventFunction)(wxWindowCreateEvent&); +typedef void (wxEvtHandler::*wxWindowDestroyEventFunction)(wxWindowDestroyEvent&); +typedef void (wxEvtHandler::*wxSetCursorEventFunction)(wxSetCursorEvent&); +typedef void (wxEvtHandler::*wxNotifyEventFunction)(wxNotifyEvent&); +typedef void (wxEvtHandler::*wxHelpEventFunction)(wxHelpEvent&); +typedef void (wxEvtHandler::*wxContextMenuEventFunction)(wxContextMenuEvent&); +typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureChangedEvent&); +typedef void (wxEvtHandler::*wxMouseCaptureLostEventFunction)(wxMouseCaptureLostEvent&); +typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent&); +typedef void (wxEvtHandler::*wxPanGestureEventFunction)(wxPanGestureEvent&); +typedef void (wxEvtHandler::*wxZoomGestureEventFunction)(wxZoomGestureEvent&); +typedef void (wxEvtHandler::*wxRotateGestureEventFunction)(wxRotateGestureEvent&); +typedef void (wxEvtHandler::*wxTwoFingerTapEventFunction)(wxTwoFingerTapEvent&); +typedef void (wxEvtHandler::*wxLongPressEventFunction)(wxLongPressEvent&); +typedef void (wxEvtHandler::*wxPressAndTapEventFunction)(wxPressAndTapEvent&); +typedef void (wxEvtHandler::*wxFullScreenEventFunction)(wxFullScreenEvent&); + +#define wxCommandEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxCommandEventFunction, func) +#define wxScrollEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxScrollEventFunction, func) +#define wxScrollWinEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxScrollWinEventFunction, func) +#define wxSizeEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxSizeEventFunction, func) +#define wxMoveEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxMoveEventFunction, func) +#define wxPaintEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxPaintEventFunction, func) +#define wxNcPaintEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxNcPaintEventFunction, func) +#define wxEraseEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxEraseEventFunction, func) +#define wxMouseEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxMouseEventFunction, func) +#define wxCharEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxCharEventFunction, func) +#define wxKeyEventHandler(func) wxCharEventHandler(func) +#define wxFocusEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxFocusEventFunction, func) +#define wxChildFocusEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxChildFocusEventFunction, func) +#define wxActivateEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxActivateEventFunction, func) +#define wxMenuEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxMenuEventFunction, func) +#define wxJoystickEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxJoystickEventFunction, func) +#define wxDropFilesEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxDropFilesEventFunction, func) +#define wxInitDialogEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxInitDialogEventFunction, func) +#define wxSysColourChangedEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxSysColourChangedEventFunction, func) +#define wxDisplayChangedEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxDisplayChangedEventFunction, func) +#define wxDPIChangedEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxDPIChangedEventFunction, func) +#define wxUpdateUIEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxUpdateUIEventFunction, func) +#define wxCloseEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxCloseEventFunction, func) +#define wxShowEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxShowEventFunction, func) +#define wxIconizeEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxIconizeEventFunction, func) +#define wxMaximizeEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxMaximizeEventFunction, func) +#define wxNavigationKeyEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxNavigationKeyEventFunction, func) +#define wxPaletteChangedEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxPaletteChangedEventFunction, func) +#define wxQueryNewPaletteEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxQueryNewPaletteEventFunction, func) +#define wxWindowCreateEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxWindowCreateEventFunction, func) +#define wxWindowDestroyEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxWindowDestroyEventFunction, func) +#define wxSetCursorEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxSetCursorEventFunction, func) +#define wxNotifyEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxNotifyEventFunction, func) +#define wxHelpEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxHelpEventFunction, func) +#define wxContextMenuEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxContextMenuEventFunction, func) +#define wxMouseCaptureChangedEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxMouseCaptureChangedEventFunction, func) +#define wxMouseCaptureLostEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxMouseCaptureLostEventFunction, func) +#define wxClipboardTextEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxClipboardTextEventFunction, func) +#define wxPanGestureEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxPanGestureEventFunction, func) +#define wxZoomGestureEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxZoomGestureEventFunction, func) +#define wxRotateGestureEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxRotateGestureEventFunction, func) +#define wxTwoFingerTapEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxTwoFingerTapEventFunction, func) +#define wxLongPressEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxLongPressEventFunction, func) +#define wxPressAndTapEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxPressAndTapEventFunction, func) +#define wxFullScreenEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxFullScreenEventFunction, func) + +#endif // wxUSE_GUI + +// N.B. In GNU-WIN32, you *have* to take the address of a member function +// (use &) or the compiler crashes... + +#define wxDECLARE_EVENT_TABLE() \ + private: \ + static const wxEventTableEntry sm_eventTableEntries[]; \ + protected: \ + wxWARNING_SUPPRESS_MISSING_OVERRIDE() \ + const wxEventTable* GetEventTable() const wxDUMMY_OVERRIDE; \ + wxEventHashTable& GetEventHashTable() const wxDUMMY_OVERRIDE; \ + wxWARNING_RESTORE_MISSING_OVERRIDE() \ + static const wxEventTable sm_eventTable; \ + static wxEventHashTable sm_eventHashTable + +#define wxBEGIN_EVENT_TABLE(theClass, baseClass) \ + const wxEventTable theClass::sm_eventTable = \ + { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ + const wxEventTable *theClass::GetEventTable() const \ + { return &theClass::sm_eventTable; } \ + wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ + wxEventHashTable &theClass::GetEventHashTable() const \ + { return theClass::sm_eventHashTable; } \ + const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ + +#define wxBEGIN_EVENT_TABLE_TEMPLATE1(theClass, baseClass, T1) \ + template \ + const wxEventTable theClass::sm_eventTable = \ + { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ + template \ + const wxEventTable *theClass::GetEventTable() const \ + { return &theClass::sm_eventTable; } \ + template \ + wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ + template \ + wxEventHashTable &theClass::GetEventHashTable() const \ + { return theClass::sm_eventHashTable; } \ + template \ + const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ + +#define wxBEGIN_EVENT_TABLE_TEMPLATE2(theClass, baseClass, T1, T2) \ + template \ + const wxEventTable theClass::sm_eventTable = \ + { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ + template \ + const wxEventTable *theClass::GetEventTable() const \ + { return &theClass::sm_eventTable; } \ + template \ + wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ + template \ + wxEventHashTable &theClass::GetEventHashTable() const \ + { return theClass::sm_eventHashTable; } \ + template \ + const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ + +#define wxBEGIN_EVENT_TABLE_TEMPLATE3(theClass, baseClass, T1, T2, T3) \ + template \ + const wxEventTable theClass::sm_eventTable = \ + { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ + template \ + const wxEventTable *theClass::GetEventTable() const \ + { return &theClass::sm_eventTable; } \ + template \ + wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ + template \ + wxEventHashTable &theClass::GetEventHashTable() const \ + { return theClass::sm_eventHashTable; } \ + template \ + const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ + +#define wxBEGIN_EVENT_TABLE_TEMPLATE4(theClass, baseClass, T1, T2, T3, T4) \ + template \ + const wxEventTable theClass::sm_eventTable = \ + { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ + template \ + const wxEventTable *theClass::GetEventTable() const \ + { return &theClass::sm_eventTable; } \ + template \ + wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ + template \ + wxEventHashTable &theClass::GetEventHashTable() const \ + { return theClass::sm_eventHashTable; } \ + template \ + const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ + +#define wxBEGIN_EVENT_TABLE_TEMPLATE5(theClass, baseClass, T1, T2, T3, T4, T5) \ + template \ + const wxEventTable theClass::sm_eventTable = \ + { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ + template \ + const wxEventTable *theClass::GetEventTable() const \ + { return &theClass::sm_eventTable; } \ + template \ + wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ + template \ + wxEventHashTable &theClass::GetEventHashTable() const \ + { return theClass::sm_eventHashTable; } \ + template \ + const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ + +#define wxBEGIN_EVENT_TABLE_TEMPLATE7(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7) \ + template \ + const wxEventTable theClass::sm_eventTable = \ + { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ + template \ + const wxEventTable *theClass::GetEventTable() const \ + { return &theClass::sm_eventTable; } \ + template \ + wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ + template \ + wxEventHashTable &theClass::GetEventHashTable() const \ + { return theClass::sm_eventHashTable; } \ + template \ + const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ + +#define wxBEGIN_EVENT_TABLE_TEMPLATE8(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7, T8) \ + template \ + const wxEventTable theClass::sm_eventTable = \ + { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \ + template \ + const wxEventTable *theClass::GetEventTable() const \ + { return &theClass::sm_eventTable; } \ + template \ + wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \ + template \ + wxEventHashTable &theClass::GetEventHashTable() const \ + { return theClass::sm_eventHashTable; } \ + template \ + const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ + +#define wxEND_EVENT_TABLE() \ + wxDECLARE_EVENT_TABLE_TERMINATOR() }; + +/* + * Event table macros + */ + +// helpers for writing shorter code below: declare an event macro taking 2, 1 +// or none ids (the missing ids default to wxID_ANY) +// +// macro arguments: +// - evt one of wxEVT_XXX constants +// - id1, id2 ids of the first/last id +// - fn the function (should be cast to the right type) +#define wx__DECLARE_EVT2(evt, id1, id2, fn) \ + wxDECLARE_EVENT_TABLE_ENTRY(evt, id1, id2, fn, NULL), +#define wx__DECLARE_EVT1(evt, id, fn) \ + wx__DECLARE_EVT2(evt, id, wxID_ANY, fn) +#define wx__DECLARE_EVT0(evt, fn) \ + wx__DECLARE_EVT1(evt, wxID_ANY, fn) + + +// Generic events +#define EVT_CUSTOM(event, winid, func) \ + wx__DECLARE_EVT1(event, winid, wxEventHandler(func)) +#define EVT_CUSTOM_RANGE(event, id1, id2, func) \ + wx__DECLARE_EVT2(event, id1, id2, wxEventHandler(func)) + +// EVT_COMMAND +#define EVT_COMMAND(winid, event, func) \ + wx__DECLARE_EVT1(event, winid, wxCommandEventHandler(func)) + +#define EVT_COMMAND_RANGE(id1, id2, event, func) \ + wx__DECLARE_EVT2(event, id1, id2, wxCommandEventHandler(func)) + +#define EVT_NOTIFY(event, winid, func) \ + wx__DECLARE_EVT1(event, winid, wxNotifyEventHandler(func)) + +#define EVT_NOTIFY_RANGE(event, id1, id2, func) \ + wx__DECLARE_EVT2(event, id1, id2, wxNotifyEventHandler(func)) + +// Miscellaneous +#define EVT_SIZE(func) wx__DECLARE_EVT0(wxEVT_SIZE, wxSizeEventHandler(func)) +#define EVT_SIZING(func) wx__DECLARE_EVT0(wxEVT_SIZING, wxSizeEventHandler(func)) +#define EVT_MOVE(func) wx__DECLARE_EVT0(wxEVT_MOVE, wxMoveEventHandler(func)) +#define EVT_MOVING(func) wx__DECLARE_EVT0(wxEVT_MOVING, wxMoveEventHandler(func)) +#define EVT_MOVE_START(func) wx__DECLARE_EVT0(wxEVT_MOVE_START, wxMoveEventHandler(func)) +#define EVT_MOVE_END(func) wx__DECLARE_EVT0(wxEVT_MOVE_END, wxMoveEventHandler(func)) +#define EVT_CLOSE(func) wx__DECLARE_EVT0(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(func)) +#define EVT_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_END_SESSION, wxCloseEventHandler(func)) +#define EVT_QUERY_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_QUERY_END_SESSION, wxCloseEventHandler(func)) +#define EVT_PAINT(func) wx__DECLARE_EVT0(wxEVT_PAINT, wxPaintEventHandler(func)) +#define EVT_NC_PAINT(func) wx__DECLARE_EVT0(wxEVT_NC_PAINT, wxNcPaintEventHandler(func)) +#define EVT_ERASE_BACKGROUND(func) wx__DECLARE_EVT0(wxEVT_ERASE_BACKGROUND, wxEraseEventHandler(func)) +#define EVT_CHAR(func) wx__DECLARE_EVT0(wxEVT_CHAR, wxCharEventHandler(func)) +#define EVT_KEY_DOWN(func) wx__DECLARE_EVT0(wxEVT_KEY_DOWN, wxKeyEventHandler(func)) +#define EVT_KEY_UP(func) wx__DECLARE_EVT0(wxEVT_KEY_UP, wxKeyEventHandler(func)) +#if wxUSE_HOTKEY +#define EVT_HOTKEY(winid, func) wx__DECLARE_EVT1(wxEVT_HOTKEY, winid, wxCharEventHandler(func)) +#endif +#define EVT_CHAR_HOOK(func) wx__DECLARE_EVT0(wxEVT_CHAR_HOOK, wxCharEventHandler(func)) +#define EVT_MENU_OPEN(func) wx__DECLARE_EVT0(wxEVT_MENU_OPEN, wxMenuEventHandler(func)) +#define EVT_MENU_CLOSE(func) wx__DECLARE_EVT0(wxEVT_MENU_CLOSE, wxMenuEventHandler(func)) +#define EVT_MENU_HIGHLIGHT(winid, func) wx__DECLARE_EVT1(wxEVT_MENU_HIGHLIGHT, winid, wxMenuEventHandler(func)) +#define EVT_MENU_HIGHLIGHT_ALL(func) wx__DECLARE_EVT0(wxEVT_MENU_HIGHLIGHT, wxMenuEventHandler(func)) +#define EVT_SET_FOCUS(func) wx__DECLARE_EVT0(wxEVT_SET_FOCUS, wxFocusEventHandler(func)) +#define EVT_KILL_FOCUS(func) wx__DECLARE_EVT0(wxEVT_KILL_FOCUS, wxFocusEventHandler(func)) +#define EVT_CHILD_FOCUS(func) wx__DECLARE_EVT0(wxEVT_CHILD_FOCUS, wxChildFocusEventHandler(func)) +#define EVT_ACTIVATE(func) wx__DECLARE_EVT0(wxEVT_ACTIVATE, wxActivateEventHandler(func)) +#define EVT_ACTIVATE_APP(func) wx__DECLARE_EVT0(wxEVT_ACTIVATE_APP, wxActivateEventHandler(func)) +#define EVT_HIBERNATE(func) wx__DECLARE_EVT0(wxEVT_HIBERNATE, wxActivateEventHandler(func)) +#define EVT_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_END_SESSION, wxCloseEventHandler(func)) +#define EVT_QUERY_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_QUERY_END_SESSION, wxCloseEventHandler(func)) +#define EVT_DROP_FILES(func) wx__DECLARE_EVT0(wxEVT_DROP_FILES, wxDropFilesEventHandler(func)) +#define EVT_INIT_DIALOG(func) wx__DECLARE_EVT0(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(func)) +#define EVT_SYS_COLOUR_CHANGED(func) wx__DECLARE_EVT0(wxEVT_SYS_COLOUR_CHANGED, wxSysColourChangedEventHandler(func)) +#define EVT_DISPLAY_CHANGED(func) wx__DECLARE_EVT0(wxEVT_DISPLAY_CHANGED, wxDisplayChangedEventHandler(func)) +#define EVT_DPI_CHANGED(func) wx__DECLARE_EVT0(wxEVT_DPI_CHANGED, wxDPIChangedEventHandler(func)) +#define EVT_SHOW(func) wx__DECLARE_EVT0(wxEVT_SHOW, wxShowEventHandler(func)) +#define EVT_MAXIMIZE(func) wx__DECLARE_EVT0(wxEVT_MAXIMIZE, wxMaximizeEventHandler(func)) +#define EVT_ICONIZE(func) wx__DECLARE_EVT0(wxEVT_ICONIZE, wxIconizeEventHandler(func)) +#define EVT_NAVIGATION_KEY(func) wx__DECLARE_EVT0(wxEVT_NAVIGATION_KEY, wxNavigationKeyEventHandler(func)) +#define EVT_PALETTE_CHANGED(func) wx__DECLARE_EVT0(wxEVT_PALETTE_CHANGED, wxPaletteChangedEventHandler(func)) +#define EVT_QUERY_NEW_PALETTE(func) wx__DECLARE_EVT0(wxEVT_QUERY_NEW_PALETTE, wxQueryNewPaletteEventHandler(func)) +#define EVT_WINDOW_CREATE(func) wx__DECLARE_EVT0(wxEVT_CREATE, wxWindowCreateEventHandler(func)) +#define EVT_WINDOW_DESTROY(func) wx__DECLARE_EVT0(wxEVT_DESTROY, wxWindowDestroyEventHandler(func)) +#define EVT_SET_CURSOR(func) wx__DECLARE_EVT0(wxEVT_SET_CURSOR, wxSetCursorEventHandler(func)) +#define EVT_MOUSE_CAPTURE_CHANGED(func) wx__DECLARE_EVT0(wxEVT_MOUSE_CAPTURE_CHANGED, wxMouseCaptureChangedEventHandler(func)) +#define EVT_MOUSE_CAPTURE_LOST(func) wx__DECLARE_EVT0(wxEVT_MOUSE_CAPTURE_LOST, wxMouseCaptureLostEventHandler(func)) +#define EVT_FULLSCREEN(func) wx__DECLARE_EVT0(wxEVT_FULLSCREEN, wxFullScreenEventHandler(func)) + +// Mouse events +#define EVT_LEFT_DOWN(func) wx__DECLARE_EVT0(wxEVT_LEFT_DOWN, wxMouseEventHandler(func)) +#define EVT_LEFT_UP(func) wx__DECLARE_EVT0(wxEVT_LEFT_UP, wxMouseEventHandler(func)) +#define EVT_MIDDLE_DOWN(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_DOWN, wxMouseEventHandler(func)) +#define EVT_MIDDLE_UP(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_UP, wxMouseEventHandler(func)) +#define EVT_RIGHT_DOWN(func) wx__DECLARE_EVT0(wxEVT_RIGHT_DOWN, wxMouseEventHandler(func)) +#define EVT_RIGHT_UP(func) wx__DECLARE_EVT0(wxEVT_RIGHT_UP, wxMouseEventHandler(func)) +#define EVT_MOTION(func) wx__DECLARE_EVT0(wxEVT_MOTION, wxMouseEventHandler(func)) +#define EVT_LEFT_DCLICK(func) wx__DECLARE_EVT0(wxEVT_LEFT_DCLICK, wxMouseEventHandler(func)) +#define EVT_MIDDLE_DCLICK(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_DCLICK, wxMouseEventHandler(func)) +#define EVT_RIGHT_DCLICK(func) wx__DECLARE_EVT0(wxEVT_RIGHT_DCLICK, wxMouseEventHandler(func)) +#define EVT_LEAVE_WINDOW(func) wx__DECLARE_EVT0(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(func)) +#define EVT_ENTER_WINDOW(func) wx__DECLARE_EVT0(wxEVT_ENTER_WINDOW, wxMouseEventHandler(func)) +#define EVT_MOUSEWHEEL(func) wx__DECLARE_EVT0(wxEVT_MOUSEWHEEL, wxMouseEventHandler(func)) +#define EVT_MOUSE_AUX1_DOWN(func) wx__DECLARE_EVT0(wxEVT_AUX1_DOWN, wxMouseEventHandler(func)) +#define EVT_MOUSE_AUX1_UP(func) wx__DECLARE_EVT0(wxEVT_AUX1_UP, wxMouseEventHandler(func)) +#define EVT_MOUSE_AUX1_DCLICK(func) wx__DECLARE_EVT0(wxEVT_AUX1_DCLICK, wxMouseEventHandler(func)) +#define EVT_MOUSE_AUX2_DOWN(func) wx__DECLARE_EVT0(wxEVT_AUX2_DOWN, wxMouseEventHandler(func)) +#define EVT_MOUSE_AUX2_UP(func) wx__DECLARE_EVT0(wxEVT_AUX2_UP, wxMouseEventHandler(func)) +#define EVT_MOUSE_AUX2_DCLICK(func) wx__DECLARE_EVT0(wxEVT_AUX2_DCLICK, wxMouseEventHandler(func)) +#define EVT_MAGNIFY(func) wx__DECLARE_EVT0(wxEVT_MAGNIFY, wxMouseEventHandler(func)) + +// All mouse events +#define EVT_MOUSE_EVENTS(func) \ + EVT_LEFT_DOWN(func) \ + EVT_LEFT_UP(func) \ + EVT_LEFT_DCLICK(func) \ + EVT_MIDDLE_DOWN(func) \ + EVT_MIDDLE_UP(func) \ + EVT_MIDDLE_DCLICK(func) \ + EVT_RIGHT_DOWN(func) \ + EVT_RIGHT_UP(func) \ + EVT_RIGHT_DCLICK(func) \ + EVT_MOUSE_AUX1_DOWN(func) \ + EVT_MOUSE_AUX1_UP(func) \ + EVT_MOUSE_AUX1_DCLICK(func) \ + EVT_MOUSE_AUX2_DOWN(func) \ + EVT_MOUSE_AUX2_UP(func) \ + EVT_MOUSE_AUX2_DCLICK(func) \ + EVT_MOTION(func) \ + EVT_LEAVE_WINDOW(func) \ + EVT_ENTER_WINDOW(func) \ + EVT_MOUSEWHEEL(func) \ + EVT_MAGNIFY(func) + +// Scrolling from wxWindow (sent to wxScrolledWindow) +#define EVT_SCROLLWIN_TOP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_TOP, wxScrollWinEventHandler(func)) +#define EVT_SCROLLWIN_BOTTOM(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_BOTTOM, wxScrollWinEventHandler(func)) +#define EVT_SCROLLWIN_LINEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_LINEUP, wxScrollWinEventHandler(func)) +#define EVT_SCROLLWIN_LINEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_LINEDOWN, wxScrollWinEventHandler(func)) +#define EVT_SCROLLWIN_PAGEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_PAGEUP, wxScrollWinEventHandler(func)) +#define EVT_SCROLLWIN_PAGEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_PAGEDOWN, wxScrollWinEventHandler(func)) +#define EVT_SCROLLWIN_THUMBTRACK(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEventHandler(func)) +#define EVT_SCROLLWIN_THUMBRELEASE(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_THUMBRELEASE, wxScrollWinEventHandler(func)) + +#define EVT_SCROLLWIN(func) \ + EVT_SCROLLWIN_TOP(func) \ + EVT_SCROLLWIN_BOTTOM(func) \ + EVT_SCROLLWIN_LINEUP(func) \ + EVT_SCROLLWIN_LINEDOWN(func) \ + EVT_SCROLLWIN_PAGEUP(func) \ + EVT_SCROLLWIN_PAGEDOWN(func) \ + EVT_SCROLLWIN_THUMBTRACK(func) \ + EVT_SCROLLWIN_THUMBRELEASE(func) + +// Scrolling from wxSlider and wxScrollBar +#define EVT_SCROLL_TOP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_TOP, wxScrollEventHandler(func)) +#define EVT_SCROLL_BOTTOM(func) wx__DECLARE_EVT0(wxEVT_SCROLL_BOTTOM, wxScrollEventHandler(func)) +#define EVT_SCROLL_LINEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_LINEUP, wxScrollEventHandler(func)) +#define EVT_SCROLL_LINEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler(func)) +#define EVT_SCROLL_PAGEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_PAGEUP, wxScrollEventHandler(func)) +#define EVT_SCROLL_PAGEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler(func)) +#define EVT_SCROLL_THUMBTRACK(func) wx__DECLARE_EVT0(wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler(func)) +#define EVT_SCROLL_THUMBRELEASE(func) wx__DECLARE_EVT0(wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler(func)) +#define EVT_SCROLL_CHANGED(func) wx__DECLARE_EVT0(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(func)) + +#define EVT_SCROLL(func) \ + EVT_SCROLL_TOP(func) \ + EVT_SCROLL_BOTTOM(func) \ + EVT_SCROLL_LINEUP(func) \ + EVT_SCROLL_LINEDOWN(func) \ + EVT_SCROLL_PAGEUP(func) \ + EVT_SCROLL_PAGEDOWN(func) \ + EVT_SCROLL_THUMBTRACK(func) \ + EVT_SCROLL_THUMBRELEASE(func) \ + EVT_SCROLL_CHANGED(func) + +// Scrolling from wxSlider and wxScrollBar, with an id +#define EVT_COMMAND_SCROLL_TOP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_TOP, winid, wxScrollEventHandler(func)) +#define EVT_COMMAND_SCROLL_BOTTOM(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_BOTTOM, winid, wxScrollEventHandler(func)) +#define EVT_COMMAND_SCROLL_LINEUP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_LINEUP, winid, wxScrollEventHandler(func)) +#define EVT_COMMAND_SCROLL_LINEDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_LINEDOWN, winid, wxScrollEventHandler(func)) +#define EVT_COMMAND_SCROLL_PAGEUP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_PAGEUP, winid, wxScrollEventHandler(func)) +#define EVT_COMMAND_SCROLL_PAGEDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_PAGEDOWN, winid, wxScrollEventHandler(func)) +#define EVT_COMMAND_SCROLL_THUMBTRACK(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBTRACK, winid, wxScrollEventHandler(func)) +#define EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBRELEASE, winid, wxScrollEventHandler(func)) +#define EVT_COMMAND_SCROLL_CHANGED(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_CHANGED, winid, wxScrollEventHandler(func)) + +#define EVT_COMMAND_SCROLL(winid, func) \ + EVT_COMMAND_SCROLL_TOP(winid, func) \ + EVT_COMMAND_SCROLL_BOTTOM(winid, func) \ + EVT_COMMAND_SCROLL_LINEUP(winid, func) \ + EVT_COMMAND_SCROLL_LINEDOWN(winid, func) \ + EVT_COMMAND_SCROLL_PAGEUP(winid, func) \ + EVT_COMMAND_SCROLL_PAGEDOWN(winid, func) \ + EVT_COMMAND_SCROLL_THUMBTRACK(winid, func) \ + EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) \ + EVT_COMMAND_SCROLL_CHANGED(winid, func) + +// Gesture events +#define EVT_GESTURE_PAN(winid, func) wx__DECLARE_EVT1(wxEVT_GESTURE_PAN, winid, wxPanGestureEventHandler(func)) +#define EVT_GESTURE_ZOOM(winid, func) wx__DECLARE_EVT1(wxEVT_GESTURE_ZOOM, winid, wxZoomGestureEventHandler(func)) +#define EVT_GESTURE_ROTATE(winid, func) wx__DECLARE_EVT1(wxEVT_GESTURE_ROTATE, winid, wxRotateGestureEventHandler(func)) +#define EVT_TWO_FINGER_TAP(winid, func) wx__DECLARE_EVT1(wxEVT_TWO_FINGER_TAP, winid, wxTwoFingerTapEventHandler(func)) +#define EVT_LONG_PRESS(winid, func) wx__DECLARE_EVT1(wxEVT_LONG_PRESS, winid, wxLongPressEventHandler(func)) +#define EVT_PRESS_AND_TAP(winid, func) wx__DECLARE_EVT1(wxEVT_PRESS_AND_TAP, winid, wxPressAndTapEventHandler(func)) + +// Convenience macros for commonly-used commands +#define EVT_CHECKBOX(winid, func) wx__DECLARE_EVT1(wxEVT_CHECKBOX, winid, wxCommandEventHandler(func)) +#define EVT_CHOICE(winid, func) wx__DECLARE_EVT1(wxEVT_CHOICE, winid, wxCommandEventHandler(func)) +#define EVT_LISTBOX(winid, func) wx__DECLARE_EVT1(wxEVT_LISTBOX, winid, wxCommandEventHandler(func)) +#define EVT_LISTBOX_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_LISTBOX_DCLICK, winid, wxCommandEventHandler(func)) +#define EVT_MENU(winid, func) wx__DECLARE_EVT1(wxEVT_MENU, winid, wxCommandEventHandler(func)) +#define EVT_MENU_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_MENU, id1, id2, wxCommandEventHandler(func)) +#define EVT_BUTTON(winid, func) wx__DECLARE_EVT1(wxEVT_BUTTON, winid, wxCommandEventHandler(func)) +#define EVT_SLIDER(winid, func) wx__DECLARE_EVT1(wxEVT_SLIDER, winid, wxCommandEventHandler(func)) +#define EVT_RADIOBOX(winid, func) wx__DECLARE_EVT1(wxEVT_RADIOBOX, winid, wxCommandEventHandler(func)) +#define EVT_RADIOBUTTON(winid, func) wx__DECLARE_EVT1(wxEVT_RADIOBUTTON, winid, wxCommandEventHandler(func)) +// EVT_SCROLLBAR is now obsolete since we use EVT_COMMAND_SCROLL... events +#define EVT_SCROLLBAR(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLLBAR, winid, wxCommandEventHandler(func)) +#define EVT_VLBOX(winid, func) wx__DECLARE_EVT1(wxEVT_VLBOX, winid, wxCommandEventHandler(func)) +#define EVT_COMBOBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMBOBOX, winid, wxCommandEventHandler(func)) +#define EVT_TOOL(winid, func) wx__DECLARE_EVT1(wxEVT_TOOL, winid, wxCommandEventHandler(func)) +#define EVT_TOOL_DROPDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_TOOL_DROPDOWN, winid, wxCommandEventHandler(func)) +#define EVT_TOOL_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_TOOL, id1, id2, wxCommandEventHandler(func)) +#define EVT_TOOL_RCLICKED(winid, func) wx__DECLARE_EVT1(wxEVT_TOOL_RCLICKED, winid, wxCommandEventHandler(func)) +#define EVT_TOOL_RCLICKED_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_TOOL_RCLICKED, id1, id2, wxCommandEventHandler(func)) +#define EVT_TOOL_ENTER(winid, func) wx__DECLARE_EVT1(wxEVT_TOOL_ENTER, winid, wxCommandEventHandler(func)) +#define EVT_CHECKLISTBOX(winid, func) wx__DECLARE_EVT1(wxEVT_CHECKLISTBOX, winid, wxCommandEventHandler(func)) +#define EVT_COMBOBOX_DROPDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_COMBOBOX_DROPDOWN, winid, wxCommandEventHandler(func)) +#define EVT_COMBOBOX_CLOSEUP(winid, func) wx__DECLARE_EVT1(wxEVT_COMBOBOX_CLOSEUP, winid, wxCommandEventHandler(func)) + +// Generic command events +#define EVT_COMMAND_LEFT_CLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LEFT_CLICK, winid, wxCommandEventHandler(func)) +#define EVT_COMMAND_LEFT_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LEFT_DCLICK, winid, wxCommandEventHandler(func)) +#define EVT_COMMAND_RIGHT_CLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RIGHT_CLICK, winid, wxCommandEventHandler(func)) +#define EVT_COMMAND_RIGHT_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RIGHT_DCLICK, winid, wxCommandEventHandler(func)) +#define EVT_COMMAND_SET_FOCUS(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_SET_FOCUS, winid, wxCommandEventHandler(func)) +#define EVT_COMMAND_KILL_FOCUS(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_KILL_FOCUS, winid, wxCommandEventHandler(func)) +#define EVT_COMMAND_ENTER(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_ENTER, winid, wxCommandEventHandler(func)) + +// Joystick events + +#define EVT_JOY_BUTTON_DOWN(func) wx__DECLARE_EVT0(wxEVT_JOY_BUTTON_DOWN, wxJoystickEventHandler(func)) +#define EVT_JOY_BUTTON_UP(func) wx__DECLARE_EVT0(wxEVT_JOY_BUTTON_UP, wxJoystickEventHandler(func)) +#define EVT_JOY_MOVE(func) wx__DECLARE_EVT0(wxEVT_JOY_MOVE, wxJoystickEventHandler(func)) +#define EVT_JOY_ZMOVE(func) wx__DECLARE_EVT0(wxEVT_JOY_ZMOVE, wxJoystickEventHandler(func)) + +// All joystick events +#define EVT_JOYSTICK_EVENTS(func) \ + EVT_JOY_BUTTON_DOWN(func) \ + EVT_JOY_BUTTON_UP(func) \ + EVT_JOY_MOVE(func) \ + EVT_JOY_ZMOVE(func) + +// Idle event +#define EVT_IDLE(func) wx__DECLARE_EVT0(wxEVT_IDLE, wxIdleEventHandler(func)) + +// Update UI event +#define EVT_UPDATE_UI(winid, func) wx__DECLARE_EVT1(wxEVT_UPDATE_UI, winid, wxUpdateUIEventHandler(func)) +#define EVT_UPDATE_UI_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_UPDATE_UI, id1, id2, wxUpdateUIEventHandler(func)) + +// Help events +#define EVT_HELP(winid, func) wx__DECLARE_EVT1(wxEVT_HELP, winid, wxHelpEventHandler(func)) +#define EVT_HELP_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_HELP, id1, id2, wxHelpEventHandler(func)) +#define EVT_DETAILED_HELP(winid, func) wx__DECLARE_EVT1(wxEVT_DETAILED_HELP, winid, wxHelpEventHandler(func)) +#define EVT_DETAILED_HELP_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_DETAILED_HELP, id1, id2, wxHelpEventHandler(func)) + +// Context Menu Events +#define EVT_CONTEXT_MENU(func) wx__DECLARE_EVT0(wxEVT_CONTEXT_MENU, wxContextMenuEventHandler(func)) +#define EVT_COMMAND_CONTEXT_MENU(winid, func) wx__DECLARE_EVT1(wxEVT_CONTEXT_MENU, winid, wxContextMenuEventHandler(func)) + +// Clipboard text Events +#define EVT_TEXT_CUT(winid, func) wx__DECLARE_EVT1(wxEVT_TEXT_CUT, winid, wxClipboardTextEventHandler(func)) +#define EVT_TEXT_COPY(winid, func) wx__DECLARE_EVT1(wxEVT_TEXT_COPY, winid, wxClipboardTextEventHandler(func)) +#define EVT_TEXT_PASTE(winid, func) wx__DECLARE_EVT1(wxEVT_TEXT_PASTE, winid, wxClipboardTextEventHandler(func)) + +// Thread events +#define EVT_THREAD(id, func) wx__DECLARE_EVT1(wxEVT_THREAD, id, wxThreadEventHandler(func)) + +// ---------------------------------------------------------------------------- +// Helper functions +// ---------------------------------------------------------------------------- + +#if wxUSE_GUI + +// Find a window with the focus, that is also a descendant of the given window. +// This is used to determine the window to initially send commands to. +WXDLLIMPEXP_CORE wxWindow* wxFindFocusDescendant(wxWindow* ancestor); + +#endif // wxUSE_GUI + + +// ---------------------------------------------------------------------------- +// Compatibility macro aliases +// ---------------------------------------------------------------------------- + +// deprecated variants _not_ requiring a semicolon after them and without wx prefix +// (note that also some wx-prefixed macro do _not_ require a semicolon because +// it's not always possible to force the compiler to require it) + +#define DECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \ + wxDECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) +#define DECLARE_EVENT_TABLE_TERMINATOR() wxDECLARE_EVENT_TABLE_TERMINATOR() +#define DECLARE_EVENT_TABLE() wxDECLARE_EVENT_TABLE(); +#define BEGIN_EVENT_TABLE(a,b) wxBEGIN_EVENT_TABLE(a,b) +#define BEGIN_EVENT_TABLE_TEMPLATE1(a,b,c) wxBEGIN_EVENT_TABLE_TEMPLATE1(a,b,c) +#define BEGIN_EVENT_TABLE_TEMPLATE2(a,b,c,d) wxBEGIN_EVENT_TABLE_TEMPLATE2(a,b,c,d) +#define BEGIN_EVENT_TABLE_TEMPLATE3(a,b,c,d,e) wxBEGIN_EVENT_TABLE_TEMPLATE3(a,b,c,d,e) +#define BEGIN_EVENT_TABLE_TEMPLATE4(a,b,c,d,e,f) wxBEGIN_EVENT_TABLE_TEMPLATE4(a,b,c,d,e,f) +#define BEGIN_EVENT_TABLE_TEMPLATE5(a,b,c,d,e,f,g) wxBEGIN_EVENT_TABLE_TEMPLATE5(a,b,c,d,e,f,g) +#define BEGIN_EVENT_TABLE_TEMPLATE6(a,b,c,d,e,f,g,h) wxBEGIN_EVENT_TABLE_TEMPLATE6(a,b,c,d,e,f,g,h) +#define END_EVENT_TABLE() wxEND_EVENT_TABLE() + +// other obsolete event declaration/definition macros; we don't need them any longer +// but we keep them for compatibility as it doesn't cost us anything anyhow +#define BEGIN_DECLARE_EVENT_TYPES() +#define END_DECLARE_EVENT_TYPES() +#define DECLARE_EXPORTED_EVENT_TYPE(expdecl, name, value) \ + extern expdecl const wxEventType name; +#define DECLARE_EVENT_TYPE(name, value) \ + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, name, value) +#define DECLARE_LOCAL_EVENT_TYPE(name, value) \ + DECLARE_EXPORTED_EVENT_TYPE(wxEMPTY_PARAMETER_VALUE, name, value) +#define DEFINE_EVENT_TYPE(name) const wxEventType name = wxNewEventType(); +#define DEFINE_LOCAL_EVENT_TYPE(name) DEFINE_EVENT_TYPE(name) + +// alias for backward compatibility with 2.9.0: +#define wxEVT_COMMAND_THREAD wxEVT_THREAD +// other old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_BUTTON_CLICKED wxEVT_BUTTON +#define wxEVT_COMMAND_CHECKBOX_CLICKED wxEVT_CHECKBOX +#define wxEVT_COMMAND_CHOICE_SELECTED wxEVT_CHOICE +#define wxEVT_COMMAND_LISTBOX_SELECTED wxEVT_LISTBOX +#define wxEVT_COMMAND_LISTBOX_DOUBLECLICKED wxEVT_LISTBOX_DCLICK +#define wxEVT_COMMAND_CHECKLISTBOX_TOGGLED wxEVT_CHECKLISTBOX +#define wxEVT_COMMAND_MENU_SELECTED wxEVT_MENU +#define wxEVT_COMMAND_TOOL_CLICKED wxEVT_TOOL +#define wxEVT_COMMAND_SLIDER_UPDATED wxEVT_SLIDER +#define wxEVT_COMMAND_RADIOBOX_SELECTED wxEVT_RADIOBOX +#define wxEVT_COMMAND_RADIOBUTTON_SELECTED wxEVT_RADIOBUTTON +#define wxEVT_COMMAND_SCROLLBAR_UPDATED wxEVT_SCROLLBAR +#define wxEVT_COMMAND_VLBOX_SELECTED wxEVT_VLBOX +#define wxEVT_COMMAND_COMBOBOX_SELECTED wxEVT_COMBOBOX +#define wxEVT_COMMAND_TOOL_RCLICKED wxEVT_TOOL_RCLICKED +#define wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED wxEVT_TOOL_DROPDOWN +#define wxEVT_COMMAND_TOOL_ENTER wxEVT_TOOL_ENTER +#define wxEVT_COMMAND_COMBOBOX_DROPDOWN wxEVT_COMBOBOX_DROPDOWN +#define wxEVT_COMMAND_COMBOBOX_CLOSEUP wxEVT_COMBOBOX_CLOSEUP +#define wxEVT_COMMAND_TEXT_COPY wxEVT_TEXT_COPY +#define wxEVT_COMMAND_TEXT_CUT wxEVT_TEXT_CUT +#define wxEVT_COMMAND_TEXT_PASTE wxEVT_TEXT_PASTE +#define wxEVT_COMMAND_TEXT_UPDATED wxEVT_TEXT + +#endif // _WX_EVENT_H_ diff --git a/lib/wxWidgets/include/wx/eventfilter.h b/lib/wxWidgets/include/wx/eventfilter.h new file mode 100644 index 0000000..1205216 --- /dev/null +++ b/lib/wxWidgets/include/wx/eventfilter.h @@ -0,0 +1,71 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/eventfilter.h +// Purpose: wxEventFilter class declaration. +// Author: Vadim Zeitlin +// Created: 2011-11-21 +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_EVENTFILTER_H_ +#define _WX_EVENTFILTER_H_ + +#include "wx/defs.h" + +class WXDLLIMPEXP_FWD_BASE wxEvent; +class WXDLLIMPEXP_FWD_BASE wxEvtHandler; + +// ---------------------------------------------------------------------------- +// wxEventFilter is used with wxEvtHandler::AddFilter() and ProcessEvent(). +// ---------------------------------------------------------------------------- + +class wxEventFilter +{ +public: + // Possible return values for FilterEvent(). + // + // Notice that the values of these enum elements are fixed due to backwards + // compatibility constraints. + enum + { + // Process event as usual. + Event_Skip = -1, + + // Don't process the event normally at all. + Event_Ignore = 0, + + // Event was already handled, don't process it normally. + Event_Processed = 1 + }; + + wxEventFilter() + { + m_next = NULL; + } + + virtual ~wxEventFilter() + { + wxASSERT_MSG( !m_next, "Forgot to call wxEvtHandler::RemoveFilter()?" ); + } + + // 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 a 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. + virtual int FilterEvent(wxEvent& event) = 0; + +private: + // Objects of this class are made to be stored in a linked list in + // wxEvtHandler so put the next node pointer directly in the class itself. + wxEventFilter* m_next; + + // And provide access to it for wxEvtHandler [only]. + friend class wxEvtHandler; + + wxDECLARE_NO_COPY_CLASS(wxEventFilter); +}; + +#endif // _WX_EVENTFILTER_H_ diff --git a/lib/wxWidgets/include/wx/evtloop.h b/lib/wxWidgets/include/wx/evtloop.h new file mode 100644 index 0000000..257b757 --- /dev/null +++ b/lib/wxWidgets/include/wx/evtloop.h @@ -0,0 +1,450 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/evtloop.h +// Purpose: declares wxEventLoop class +// Author: Vadim Zeitlin +// Modified by: +// Created: 01.06.01 +// Copyright: (c) 2001 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_EVTLOOP_H_ +#define _WX_EVTLOOP_H_ + +#include "wx/event.h" +#include "wx/utils.h" + +// TODO: implement wxEventLoopSource for MSW (it should wrap a HANDLE and be +// monitored using MsgWaitForMultipleObjects()) +#if defined(__WXOSX__) || (defined(__UNIX__) && !defined(__WINDOWS__)) + #define wxUSE_EVENTLOOP_SOURCE 1 +#else + #define wxUSE_EVENTLOOP_SOURCE 0 +#endif + +#if wxUSE_EVENTLOOP_SOURCE + class wxEventLoopSource; + class wxEventLoopSourceHandler; +#endif + +/* + NOTE ABOUT wxEventLoopBase::YieldFor LOGIC + ------------------------------------------ + + The YieldFor() function helps to avoid re-entrancy problems and problems + caused by out-of-order event processing + (see "wxYield-like problems" and "wxProgressDialog+threading BUG" wx-dev threads). + + The logic behind YieldFor() is simple: it analyzes the queue of the native + events generated by the underlying GUI toolkit and picks out and processes + only those matching the given mask. + + It's important to note that YieldFor() is used to selectively process the + events generated by the NATIVE toolkit. + Events synthesized by wxWidgets code or by user code are instead selectively + processed thanks to the logic built into wxEvtHandler::ProcessPendingEvents(). + In fact, when wxEvtHandler::ProcessPendingEvents gets called from inside a + YieldFor() call, wxEventLoopBase::IsEventAllowedInsideYield is used to decide + if the pending events for that event handler can be processed. + If all the pending events associated with that event handler result as "not processable", + the event handler "delays" itself calling wxEventLoopBase::DelayPendingEventHandler + (so it's moved: m_handlersWithPendingEvents => m_handlersWithPendingDelayedEvents). + Last, wxEventLoopBase::ProcessPendingEvents() before exiting moves the delayed + event handlers back into the list of handlers with pending events + (m_handlersWithPendingDelayedEvents => m_handlersWithPendingEvents) so that + a later call to ProcessPendingEvents() (possibly outside the YieldFor() call) + will process all pending events as usual. +*/ + +// ---------------------------------------------------------------------------- +// wxEventLoopBase: interface for wxEventLoop +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxEventLoopBase +{ +public: + wxEventLoopBase(); + virtual ~wxEventLoopBase(); + + // use this to check whether the event loop was successfully created before + // using it + virtual bool IsOk() const { return true; } + + // returns true if this is the main loop + bool IsMain() const; + +#if wxUSE_EVENTLOOP_SOURCE + // create a new event loop source wrapping the given file descriptor and + // monitor it for events occurring on this descriptor in all event loops + static wxEventLoopSource * + AddSourceForFD(int fd, wxEventLoopSourceHandler *handler, int flags); +#endif // wxUSE_EVENTLOOP_SOURCE + + // dispatch&processing + // ------------------- + + // start the event loop, return the exit code when it is finished + // + // notice that wx ports should override DoRun(), this method is virtual + // only to allow overriding it in the user code for custom event loops + virtual int Run(); + + // is this event loop running now? + // + // notice that even if this event loop hasn't terminated yet but has just + // spawned a nested (e.g. modal) event loop, this would return false + bool IsRunning() const; + + // exit from the loop with the given exit code + // + // this can be only used to exit the currently running loop, use + // ScheduleExit() if this might not be the case + virtual void Exit(int rc = 0); + + // ask the event loop to exit with the given exit code, can be used even if + // this loop is not running right now but the loop must have been started, + // i.e. Run() should have been already called + virtual void ScheduleExit(int rc = 0) = 0; + + // return true if any events are available + virtual bool Pending() const = 0; + + // dispatch a single event, return false if we should exit from the loop + virtual bool Dispatch() = 0; + + // same as Dispatch() but doesn't wait for longer than the specified (in + // ms) timeout, return true if an event was processed, false if we should + // exit the loop or -1 if timeout expired + virtual int DispatchTimeout(unsigned long timeout) = 0; + + // implement this to wake up the loop: usually done by posting a dummy event + // to it (can be called from non main thread) + virtual void WakeUp() = 0; + + + // idle handling + // ------------- + + // make sure that idle events are sent again: this is just an obsolete + // synonym for WakeUp() + void WakeUpIdle() { WakeUp(); } + + // this virtual function is called when the application + // becomes idle and by default it forwards to wxApp::ProcessIdle() and + // while it can be overridden in a custom event loop, you must call the + // base class version to ensure that idle events are still generated + // + // it should return true if more idle events are needed, false if not + virtual bool ProcessIdle(); + + + // Yield-related hooks + // ------------------- + + // process all currently pending events right now + // + // if onlyIfNeeded is true, returns false without doing anything else if + // we're already inside Yield() + // + // 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! + bool Yield(bool onlyIfNeeded = false); + + // more selective version of Yield() + // + // notice that it is virtual for backwards-compatibility but new code + // should override DoYieldFor() and not YieldFor() itself + virtual bool YieldFor(long eventsToProcess); + + // returns true if the main thread is inside a Yield() call + virtual bool IsYielding() const + { return m_yieldLevel != 0; } + + // returns true if events of the given event category should be immediately + // processed inside a wxApp::Yield() call or rather should be queued for + // later processing by the main event loop + virtual bool IsEventAllowedInsideYield(wxEventCategory cat) const + { return (m_eventsToProcessInsideYield & cat) != 0; } + + // no SafeYield hooks since it uses wxWindow which is not available when wxUSE_GUI=0 + + + // active loop + // ----------- + + // return currently active (running) event loop, may be NULL + static wxEventLoopBase *GetActive() { return ms_activeLoop; } + + // set currently active (running) event loop + static void SetActive(wxEventLoopBase* loop); + + +protected: + // real implementation of Run() + virtual int DoRun() = 0; + + // And the real, port-specific, implementation of YieldFor(). + // + // The base class version is pure virtual to ensure that it is overridden + // in the derived classes but does have an implementation which processes + // pending events in wxApp if eventsToProcess allows it, and so should be + // called from the overridden version at an appropriate place (i.e. after + // processing the native events but before doing anything else that could + // be affected by pending events dispatching). + virtual void DoYieldFor(long eventsToProcess) = 0; + + // this function should be called before the event loop terminates, whether + // this happens normally (because of Exit() call) or abnormally (because of + // an exception thrown from inside the loop) + virtual void OnExit(); + + // Return true if we're currently inside our Run(), even if another nested + // event loop is currently running, unlike IsRunning() (which should have + // been really called IsActive() but it's too late to change this now). + bool IsInsideRun() const { return m_isInsideRun; } + + + // the pointer to currently active loop + static wxEventLoopBase *ms_activeLoop; + + // should we exit the loop? + bool m_shouldExit; + + // incremented each time on entering Yield() and decremented on leaving it + int m_yieldLevel; + + // the argument of the last call to YieldFor() + long m_eventsToProcessInsideYield; + +private: + // this flag is set on entry into Run() and reset before leaving it + bool m_isInsideRun; + + wxDECLARE_NO_COPY_CLASS(wxEventLoopBase); +}; + +#if defined(__WINDOWS__) || defined(__WXMAC__) || defined(__WXDFB__) || (defined(__UNIX__) && !defined(__WXOSX__)) + +// this class can be used to implement a standard event loop logic using +// Pending() and Dispatch() +// +// it also handles idle processing automatically +class WXDLLIMPEXP_BASE wxEventLoopManual : public wxEventLoopBase +{ +public: + wxEventLoopManual(); + + // sets the "should exit" flag and wakes up the loop so that it terminates + // soon + virtual void ScheduleExit(int rc = 0) wxOVERRIDE; + +protected: + // enters a loop calling OnNextIteration(), Pending() and Dispatch() and + // terminating when Exit() is called + virtual int DoRun() wxOVERRIDE; + + // may be overridden to perform some action at the start of each new event + // loop iteration + virtual void OnNextIteration() { } + + + // the loop exit code + int m_exitcode; + +private: + // process all already pending events and dispatch a new one (blocking + // until it appears in the event queue if necessary) + // + // returns the return value of Dispatch() + bool ProcessEvents(); + + wxDECLARE_NO_COPY_CLASS(wxEventLoopManual); +}; + +#endif // platforms using "manual" loop + +// we're moving away from old m_impl wxEventLoop model as otherwise the user +// code doesn't have access to platform-specific wxEventLoop methods and this +// can sometimes be very useful (e.g. under MSW this is necessary for +// integration with MFC) but currently this is not done for all ports yet (e.g. +// wxX11) so fall back to the old wxGUIEventLoop definition below for them + +#if defined(__DARWIN__) + // CoreFoundation-based event loop is currently in wxBase so include it in + // any case too (although maybe it actually shouldn't be there at all) + #include "wx/osx/core/evtloop.h" +#endif + +// include the header defining wxConsoleEventLoop +#if defined(__UNIX__) && !defined(__WINDOWS__) + #include "wx/unix/evtloop.h" +#elif defined(__WINDOWS__) + #include "wx/msw/evtloopconsole.h" +#endif + +#if wxUSE_GUI + +// include the appropriate header defining wxGUIEventLoop + +#if defined(__WXMSW__) + #include "wx/msw/evtloop.h" +#elif defined(__WXOSX__) + #include "wx/osx/evtloop.h" +#elif defined(__WXDFB__) + #include "wx/dfb/evtloop.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/evtloop.h" +#elif defined(__WXQT__) + #include "wx/qt/evtloop.h" +#else // other platform + +#include "wx/stopwatch.h" // for wxMilliClock_t + +class WXDLLIMPEXP_FWD_CORE wxEventLoopImpl; + +class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxEventLoopBase +{ +public: + wxGUIEventLoop() { m_impl = NULL; } + virtual ~wxGUIEventLoop(); + + virtual void ScheduleExit(int rc = 0); + virtual bool Pending() const; + virtual bool Dispatch(); + virtual int DispatchTimeout(unsigned long timeout) + { + // TODO: this is, of course, horribly inefficient and a proper wait with + // timeout should be implemented for all ports natively... + const wxMilliClock_t timeEnd = wxGetLocalTimeMillis() + timeout; + for ( ;; ) + { + if ( Pending() ) + return Dispatch(); + + if ( wxGetLocalTimeMillis() >= timeEnd ) + return -1; + } + } + virtual void WakeUp() { } + +protected: + virtual int DoRun(); + virtual void DoYieldFor(long eventsToProcess); + + // the pointer to the port specific implementation class + wxEventLoopImpl *m_impl; + + wxDECLARE_NO_COPY_CLASS(wxGUIEventLoop); +}; + +#endif // platforms + +#endif // wxUSE_GUI + +#if wxUSE_GUI + // we use a class rather than a typedef because wxEventLoop is + // forward-declared in many places + class wxEventLoop : public wxGUIEventLoop { }; +#else // !wxUSE_GUI + // we can't define wxEventLoop differently in GUI and base libraries so use + // a #define to still allow writing wxEventLoop in the user code + #if wxUSE_CONSOLE_EVENTLOOP && (defined(__WINDOWS__) || defined(__UNIX__)) + #define wxEventLoop wxConsoleEventLoop + #else // we still must define it somehow for the code below... + #define wxEventLoop wxEventLoopBase + #endif +#endif + +inline bool wxEventLoopBase::IsRunning() const { return GetActive() == this; } + +#if wxUSE_GUI && !defined(__WXOSX__) +// ---------------------------------------------------------------------------- +// wxModalEventLoop +// ---------------------------------------------------------------------------- + +// this is a naive generic implementation which uses wxWindowDisabler to +// implement modality, we will surely need platform-specific implementations +// too, this generic implementation is here only temporarily to see how it +// works +class WXDLLIMPEXP_CORE wxModalEventLoop : public wxGUIEventLoop +{ +public: + wxModalEventLoop(wxWindow *winModal) + { + m_windowDisabler = new wxWindowDisabler(winModal); + } + +protected: + virtual void OnExit() wxOVERRIDE + { + delete m_windowDisabler; + m_windowDisabler = NULL; + + wxGUIEventLoop::OnExit(); + } + +private: + wxWindowDisabler *m_windowDisabler; +}; + +#endif //wxUSE_GUI + +// ---------------------------------------------------------------------------- +// wxEventLoopActivator: helper class for wxEventLoop implementations +// ---------------------------------------------------------------------------- + +// this object sets the wxEventLoop given to the ctor as the currently active +// one and unsets it in its dtor, this is especially useful in presence of +// exceptions but is more tidy even when we don't use them +class wxEventLoopActivator +{ +public: + wxEventLoopActivator(wxEventLoopBase *evtLoop) + { + m_evtLoopOld = wxEventLoopBase::GetActive(); + wxEventLoopBase::SetActive(evtLoop); + } + + ~wxEventLoopActivator() + { + // restore the previously active event loop + wxEventLoopBase::SetActive(m_evtLoopOld); + } + +private: + wxEventLoopBase *m_evtLoopOld; +}; + +#if wxUSE_GUI || wxUSE_CONSOLE_EVENTLOOP + +class wxEventLoopGuarantor +{ +public: + wxEventLoopGuarantor() + { + m_evtLoopNew = NULL; + if (!wxEventLoop::GetActive()) + { + m_evtLoopNew = new wxEventLoop; + wxEventLoop::SetActive(m_evtLoopNew); + } + } + + ~wxEventLoopGuarantor() + { + if (m_evtLoopNew) + { + wxEventLoop::SetActive(NULL); + delete m_evtLoopNew; + } + } + +private: + wxEventLoop *m_evtLoopNew; +}; + +#endif // wxUSE_GUI || wxUSE_CONSOLE_EVENTLOOP + +#endif // _WX_EVTLOOP_H_ diff --git a/lib/wxWidgets/include/wx/evtloopsrc.h b/lib/wxWidgets/include/wx/evtloopsrc.h new file mode 100644 index 0000000..6b7f2b1 --- /dev/null +++ b/lib/wxWidgets/include/wx/evtloopsrc.h @@ -0,0 +1,104 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/evtloopsrc.h +// Purpose: declaration of wxEventLoopSource class +// Author: Vadim Zeitlin +// Created: 2009-10-21 +// Copyright: (c) 2009 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_EVTLOOPSRC_H_ +#define _WX_EVTLOOPSRC_H_ + +// Include the header to get wxUSE_EVENTLOOP_SOURCE definition from it. +#include "wx/evtloop.h" +// ---------------------------------------------------------------------------- +// wxEventLoopSource: a source of events which may be added to wxEventLoop +// ---------------------------------------------------------------------------- + +// TODO: refactor wxSocket under Unix to reuse wxEventLoopSource instead of +// duplicating much of its logic +// +// TODO: freeze the API and document it + +#if wxUSE_EVENTLOOP_SOURCE + +#define wxTRACE_EVT_SOURCE "EventSource" + +// handler used to process events on event loop sources +class wxEventLoopSourceHandler +{ +public: + // called when descriptor is available for non-blocking read + virtual void OnReadWaiting() = 0; + + // called when descriptor is available for non-blocking write + virtual void OnWriteWaiting() = 0; + + // called when there is exception on descriptor + virtual void OnExceptionWaiting() = 0; + + // virtual dtor for the base class + virtual ~wxEventLoopSourceHandler() { } +}; + +// flags describing which kind of IO events we're interested in +enum +{ + wxEVENT_SOURCE_INPUT = 0x01, + wxEVENT_SOURCE_OUTPUT = 0x02, + wxEVENT_SOURCE_EXCEPTION = 0x04, + wxEVENT_SOURCE_ALL = wxEVENT_SOURCE_INPUT | + wxEVENT_SOURCE_OUTPUT | + wxEVENT_SOURCE_EXCEPTION +}; + +// wxEventLoopSource itself is an ABC and can't be created directly, currently +// the only way to create it is by using wxEventLoop::AddSourceForFD(). +class wxEventLoopSource +{ +public: + // dtor is pure virtual because it must be overridden to remove the source + // from the event loop monitoring it + virtual ~wxEventLoopSource() = 0; + + void SetHandler(wxEventLoopSourceHandler* handler) { m_handler = handler; } + wxEventLoopSourceHandler* GetHandler() const { return m_handler; } + + void SetFlags(int flags) { m_flags = flags; } + int GetFlags() const { return m_flags; } + +protected: + // ctor is only used by the derived classes + wxEventLoopSource(wxEventLoopSourceHandler *handler, int flags) + : m_handler(handler), + m_flags(flags) + { + } + + wxEventLoopSourceHandler* m_handler; + int m_flags; + + wxDECLARE_NO_COPY_CLASS(wxEventLoopSource); +}; + +inline wxEventLoopSource::~wxEventLoopSource() { } + +#if defined(__UNIX__) + #include "wx/unix/evtloopsrc.h" +#endif // __UNIX__ + +#if defined(__WXGTK20__) + #include "wx/gtk/evtloopsrc.h" +#endif + +#if defined(__DARWIN__) + #include "wx/osx/evtloopsrc.h" +#elif defined(__WXQT__) + #include "wx/unix/evtloopsrc.h" +#endif + +#endif // wxUSE_EVENTLOOP_SOURCE + +#endif // _WX_EVTLOOPSRC_H_ + diff --git a/lib/wxWidgets/include/wx/except.h b/lib/wxWidgets/include/wx/except.h new file mode 100644 index 0000000..7558916 --- /dev/null +++ b/lib/wxWidgets/include/wx/except.h @@ -0,0 +1,40 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/except.h +// Purpose: C++ exception related stuff +// Author: Vadim Zeitlin +// Modified by: +// Created: 17.09.2003 +// Copyright: (c) 2003 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_EXCEPT_H_ +#define _WX_EXCEPT_H_ + +#include "wx/defs.h" + +// ---------------------------------------------------------------------------- +// macros working whether wxUSE_EXCEPTIONS is 0 or 1 +// ---------------------------------------------------------------------------- + +// even if the library itself was compiled with exceptions support, the user +// code using it might be compiling with a compiler switch disabling them in +// which cases we shouldn't use try/catch in the headers -- this results in +// compilation errors in e.g. wx/scopeguard.h with at least g++ 4 +#if !wxUSE_EXCEPTIONS || \ + (defined(__GNUG__) && !defined(__EXCEPTIONS)) + #ifndef wxNO_EXCEPTIONS + #define wxNO_EXCEPTIONS + #endif +#endif + +#ifdef wxNO_EXCEPTIONS + #define wxTRY + #define wxCATCH_ALL(code) +#else // do use exceptions + #define wxTRY try + #define wxCATCH_ALL(code) catch ( ... ) { code } +#endif // wxNO_EXCEPTIONS/!wxNO_EXCEPTIONS + +#endif // _WX_EXCEPT_H_ + diff --git a/lib/wxWidgets/include/wx/fdrepdlg.h b/lib/wxWidgets/include/wx/fdrepdlg.h new file mode 100644 index 0000000..e01a4bf --- /dev/null +++ b/lib/wxWidgets/include/wx/fdrepdlg.h @@ -0,0 +1,203 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/fdrepdlg.h +// Purpose: wxFindReplaceDialog class +// Author: Markus Greither and Vadim Zeitlin +// Modified by: +// Created: 23/03/2001 +// Copyright: (c) Markus Greither +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FINDREPLACEDLG_H_ +#define _WX_FINDREPLACEDLG_H_ + +#include "wx/defs.h" + +#if wxUSE_FINDREPLDLG + +#include "wx/dialog.h" + +class WXDLLIMPEXP_FWD_CORE wxFindDialogEvent; +class WXDLLIMPEXP_FWD_CORE wxFindReplaceDialog; +class WXDLLIMPEXP_FWD_CORE wxFindReplaceData; +class WXDLLIMPEXP_FWD_CORE wxFindReplaceDialogImpl; + +// ---------------------------------------------------------------------------- +// Flags for wxFindReplaceData.Flags +// ---------------------------------------------------------------------------- + +// flags used by wxFindDialogEvent::GetFlags() +enum wxFindReplaceFlags +{ + // downward search/replace selected (otherwise - upwards) + wxFR_DOWN = 1, + + // whole word search/replace selected + wxFR_WHOLEWORD = 2, + + // case sensitive search/replace selected (otherwise - case insensitive) + wxFR_MATCHCASE = 4 +}; + +// these flags can be specified in wxFindReplaceDialog ctor or Create() +enum wxFindReplaceDialogStyles +{ + // replace dialog (otherwise find dialog) + wxFR_REPLACEDIALOG = 1, + + // don't allow changing the search direction + wxFR_NOUPDOWN = 2, + + // don't allow case sensitive searching + wxFR_NOMATCHCASE = 4, + + // don't allow whole word searching + wxFR_NOWHOLEWORD = 8 +}; + +// ---------------------------------------------------------------------------- +// wxFindReplaceData: holds Setup Data/Feedback Data for wxFindReplaceDialog +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFindReplaceData : public wxObject +{ +public: + wxFindReplaceData() { Init(); } + wxFindReplaceData(wxUint32 flags) { Init(); SetFlags(flags); } + + // accessors + const wxString& GetFindString() const { return m_FindWhat; } + const wxString& GetReplaceString() const { return m_ReplaceWith; } + + int GetFlags() const { return m_Flags; } + + // setters: may only be called before showing the dialog, no effect later + void SetFlags(wxUint32 flags) { m_Flags = flags; } + + void SetFindString(const wxString& str) { m_FindWhat = str; } + void SetReplaceString(const wxString& str) { m_ReplaceWith = str; } + +protected: + void Init(); + +private: + wxUint32 m_Flags; + wxString m_FindWhat, + m_ReplaceWith; + + friend class wxFindReplaceDialogBase; +}; + +// ---------------------------------------------------------------------------- +// wxFindReplaceDialogBase +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFindReplaceDialogBase : public wxDialog +{ +public: + // ctors and such + wxFindReplaceDialogBase() { m_FindReplaceData = NULL; } + wxFindReplaceDialogBase(wxWindow * WXUNUSED(parent), + wxFindReplaceData *data, + const wxString& WXUNUSED(title), + int WXUNUSED(style) = 0) + { + m_FindReplaceData = data; + } + + virtual ~wxFindReplaceDialogBase(); + + // find dialog data access + const wxFindReplaceData *GetData() const { return m_FindReplaceData; } + void SetData(wxFindReplaceData *data) { m_FindReplaceData = data; } + + // implementation only, don't use + void Send(wxFindDialogEvent& event); + +protected: + wxFindReplaceData *m_FindReplaceData; + + // the last string we searched for + wxString m_lastSearch; + + wxDECLARE_NO_COPY_CLASS(wxFindReplaceDialogBase); +}; + +// include wxFindReplaceDialog declaration +#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) + #include "wx/msw/fdrepdlg.h" +#else + #define wxGenericFindReplaceDialog wxFindReplaceDialog + + #include "wx/generic/fdrepdlg.h" +#endif + +// ---------------------------------------------------------------------------- +// wxFindReplaceDialog events +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFindDialogEvent : public wxCommandEvent +{ +public: + wxFindDialogEvent(wxEventType commandType = wxEVT_NULL, int id = 0) + : wxCommandEvent(commandType, id) { } + wxFindDialogEvent(const wxFindDialogEvent& event) + : wxCommandEvent(event), m_strReplace(event.m_strReplace) { } + + int GetFlags() const { return GetInt(); } + wxString GetFindString() const { return GetString(); } + const wxString& GetReplaceString() const { return m_strReplace; } + + wxFindReplaceDialog *GetDialog() const + { return wxStaticCast(GetEventObject(), wxFindReplaceDialog); } + + // implementation only + void SetFlags(int flags) { SetInt(flags); } + void SetFindString(const wxString& str) { SetString(str); } + void SetReplaceString(const wxString& str) { m_strReplace = str; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxFindDialogEvent(*this); } + +private: + wxString m_strReplace; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFindDialogEvent); +}; + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FIND, wxFindDialogEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FIND_NEXT, wxFindDialogEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FIND_REPLACE, wxFindDialogEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FIND_REPLACE_ALL, wxFindDialogEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FIND_CLOSE, wxFindDialogEvent ); + +typedef void (wxEvtHandler::*wxFindDialogEventFunction)(wxFindDialogEvent&); + +#define wxFindDialogEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxFindDialogEventFunction, func) + +#define EVT_FIND(id, fn) \ + wx__DECLARE_EVT1(wxEVT_FIND, id, wxFindDialogEventHandler(fn)) + +#define EVT_FIND_NEXT(id, fn) \ + wx__DECLARE_EVT1(wxEVT_FIND_NEXT, id, wxFindDialogEventHandler(fn)) + +#define EVT_FIND_REPLACE(id, fn) \ + wx__DECLARE_EVT1(wxEVT_FIND_REPLACE, id, wxFindDialogEventHandler(fn)) + +#define EVT_FIND_REPLACE_ALL(id, fn) \ + wx__DECLARE_EVT1(wxEVT_FIND_REPLACE_ALL, id, wxFindDialogEventHandler(fn)) + +#define EVT_FIND_CLOSE(id, fn) \ + wx__DECLARE_EVT1(wxEVT_FIND_CLOSE, id, wxFindDialogEventHandler(fn)) + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_FIND wxEVT_FIND +#define wxEVT_COMMAND_FIND_NEXT wxEVT_FIND_NEXT +#define wxEVT_COMMAND_FIND_REPLACE wxEVT_FIND_REPLACE +#define wxEVT_COMMAND_FIND_REPLACE_ALL wxEVT_FIND_REPLACE_ALL +#define wxEVT_COMMAND_FIND_CLOSE wxEVT_FIND_CLOSE + +#endif // wxUSE_FINDREPLDLG + +#endif + // _WX_FDREPDLG_H diff --git a/lib/wxWidgets/include/wx/features.h b/lib/wxWidgets/include/wx/features.h new file mode 100644 index 0000000..7465b9f --- /dev/null +++ b/lib/wxWidgets/include/wx/features.h @@ -0,0 +1,130 @@ +/** +* Name: wx/features.h +* Purpose: test macros for the features which might be available in some +* wxWidgets ports but not others +* Author: Vadim Zeitlin +* Modified by: Ryan Norton (Converted to C) +* Created: 18.03.02 +* Copyright: (c) 2002 Vadim Zeitlin +* Licence: wxWindows licence +*/ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#ifndef _WX_FEATURES_H_ +#define _WX_FEATURES_H_ + +/* radio menu items are currently not implemented in wxMotif, use this + symbol (kept for compatibility from the time when they were not implemented + under other platforms as well) to test for this */ +#if !defined(__WXMOTIF__) + #define wxHAS_RADIO_MENU_ITEMS +#else + #undef wxHAS_RADIO_MENU_ITEMS +#endif + +/* the raw keyboard codes are generated under wxGTK and wxMSW only */ +#if defined(__WXGTK__) || defined(__WXMSW__) || defined(__WXMAC__) \ + || defined(__WXDFB__) + #define wxHAS_RAW_KEY_CODES +#else + #undef wxHAS_RAW_KEY_CODES +#endif + +/* taskbar is implemented in the major ports */ +#if defined(__WXMSW__) \ + || defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXX11__) \ + || defined(__WXOSX_MAC__) || defined(__WXQT__) + #define wxHAS_TASK_BAR_ICON +#else + #undef wxUSE_TASKBARICON + #define wxUSE_TASKBARICON 0 + #undef wxHAS_TASK_BAR_ICON +#endif + +/* wxIconLocation appeared in the middle of 2.5.0 so it's handy to have a */ +/* separate define for it */ +#define wxHAS_ICON_LOCATION + +/* same for wxCrashReport */ +#ifdef __WXMSW__ + #define wxHAS_CRASH_REPORT +#else + #undef wxHAS_CRASH_REPORT +#endif + +/* wxRE_ADVANCED is always defined now and kept for compatibility only. */ +#define wxHAS_REGEX_ADVANCED + +/* Pango-based ports and wxDFB use UTF-8 for text and font encodings + * internally and so their fonts can handle any encodings: */ +#if wxUSE_PANGO || defined(__WXDFB__) + #define wxHAS_UTF8_FONTS +#endif + +/* This is defined when the underlying toolkit handles tab traversal natively. + Otherwise we implement it ourselves in wxControlContainer. */ +#if defined(__WXGTK20__) || defined(__WXQT__) + #define wxHAS_NATIVE_TAB_TRAVERSAL +#endif + +/* This is defined when the compiler provides some type of extended locale + functions. Otherwise, we implement them ourselves to only support the + 'C' locale */ +#if defined(HAVE_LOCALE_T) || \ + (wxCHECK_VISUALC_VERSION(8)) + #define wxHAS_XLOCALE_SUPPORT +#else + #undef wxHAS_XLOCALE_SUPPORT +#endif + +/* Direct access to bitmap data is not implemented in all ports yet */ +#if defined(__WXGTK20__) || defined(__WXMAC__) || defined(__WXDFB__) || \ + defined(__WXMSW__) || defined(__WXQT__) + + /* + HP aCC for PA-RISC can't deal with templates in wx/rawbmp.h. + */ + #if !(defined(__HP_aCC) && defined(__hppa)) + #define wxHAS_RAW_BITMAP + #endif +#endif + +/* also define deprecated synonym which exists for compatibility only */ +#ifdef wxHAS_RAW_BITMAP + #define wxHAVE_RAW_BITMAP +#endif + +/* + While it should be possible to implement SVG rasterizing without raw bitmap + support using wxDC::DrawSpline(), currently we don't do it and so FromSVG() + is only available in the ports providing raw bitmap access. + */ +#if defined(wxHAS_RAW_BITMAP) && wxUSE_NANOSVG + #define wxHAS_SVG +#endif + + +// Previously this symbol wasn't defined for all compilers as Bind() couldn't +// be implemented for some of them (notably MSVC 6), but this is not the case +// any more and Bind() is always implemented when using any currently supported +// compiler, so this symbol exists purely for compatibility. +#define wxHAS_EVENT_BIND + + +/* + Some platforms use DPI-independent pixels, i.e. pixels actually scale with + DPI and a 100px-wide window has the same apparent size on the display in + normal and high (i.e. 2x, or 200% scaling) DPI, while others always use + physical pixels and a window must be 200px wide to have the same apparent + size in high DPI as in normal DPI. + */ +#if defined(__WXGTK3__) || defined(__WXMAC__) + #define wxHAS_DPI_INDEPENDENT_PIXELS + + // This is an older synonym kept only for compatibility + #define wxHAVE_DPI_INDEPENDENT_PIXELS +#endif + +#endif /* _WX_FEATURES_H_ */ + diff --git a/lib/wxWidgets/include/wx/ffile.h b/lib/wxWidgets/include/wx/ffile.h new file mode 100644 index 0000000..954a700 --- /dev/null +++ b/lib/wxWidgets/include/wx/ffile.h @@ -0,0 +1,167 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/ffile.h +// Purpose: wxFFile - encapsulates "FILE *" stream +// Author: Vadim Zeitlin +// Modified by: +// Created: 14.07.99 +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FFILE_H_ +#define _WX_FFILE_H_ + +#include "wx/defs.h" // for wxUSE_FFILE + +#if wxUSE_FFILE + +#include "wx/string.h" +#include "wx/filefn.h" +#include "wx/convauto.h" + +#include + +// ---------------------------------------------------------------------------- +// class wxFFile: standard C stream library IO +// +// NB: for space efficiency this class has no virtual functions, including +// dtor which is _not_ virtual, so it shouldn't be used as a base class. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFFile +{ +public: + // ctors + // ----- + // def ctor + wxFFile() { m_fp = NULL; } + // open specified file (may fail, use IsOpened()) + wxFFile(const wxString& filename, const wxString& mode = wxT("r")); + // attach to (already opened) file + wxFFile(FILE *lfp) { m_fp = lfp; } + + // open/close + // open a file (existing or not - the mode controls what happens) + bool Open(const wxString& filename, const wxString& mode = wxT("r")); + // closes the opened file (this is a NOP if not opened) + bool Close(); + + // assign an existing file descriptor and get it back from wxFFile object + void Attach(FILE *lfp, const wxString& name = wxEmptyString) + { Close(); m_fp = lfp; m_name = name; } + FILE* Detach() { FILE* fpOld = m_fp; m_fp = NULL; return fpOld; } + FILE *fp() const { return m_fp; } + + // read/write (unbuffered) + // read all data from the file into a string (useful for text files) + bool ReadAll(wxString *str, const wxMBConv& conv = wxConvAuto()); + // returns number of bytes read - use Eof() and Error() to see if an error + // occurred or not + size_t Read(void *pBuf, size_t nCount); + // returns the number of bytes written + size_t Write(const void *pBuf, size_t nCount); + // returns true on success + bool Write(const wxString& s, const wxMBConv& conv = wxConvAuto()); + // flush data not yet written + bool Flush(); + + // file pointer operations (return ofsInvalid on failure) + // move ptr ofs bytes related to start/current pos/end of file + bool Seek(wxFileOffset ofs, wxSeekMode mode = wxFromStart); + // move ptr to ofs bytes before the end + bool SeekEnd(wxFileOffset ofs = 0) { return Seek(ofs, wxFromEnd); } + // get current position in the file + wxFileOffset Tell() const; + // get current file length + wxFileOffset Length() const; + + // simple accessors: note that Eof() and Error() may only be called if + // IsOpened(). Otherwise they assert and return false. + // is file opened? + bool IsOpened() const { return m_fp != NULL; } + // is end of file reached? + bool Eof() const; + // has an error occurred? + bool Error() const; + // get the file name + const wxString& GetName() const { return m_name; } + // type such as disk or pipe + wxFileKind GetKind() const { return wxGetFileKind(m_fp); } + + // dtor closes the file if opened + ~wxFFile() { Close(); } + +private: + // copy ctor and assignment operator are private because it doesn't make + // sense to copy files this way: attempt to do it will provoke a compile-time + // error. + wxFFile(const wxFFile&); + wxFFile& operator=(const wxFFile&); + + FILE *m_fp; // IO stream or NULL if not opened + + wxString m_name; // the name of the file (for diagnostic messages) +}; + +// ---------------------------------------------------------------------------- +// class wxTempFFile: if you want to replace another file, create an instance +// of wxTempFFile passing the name of the file to be replaced to the ctor. Then +// you can write to wxTempFFile and call Commit() function to replace the old +// file (and close this one) or call Discard() to cancel the modification. If +// you call neither of them, dtor will call Discard(). +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxTempFFile +{ +public: + // ctors + // default + wxTempFFile() { } + // associates the temp file with the file to be replaced and opens it + explicit wxTempFFile(const wxString& strName); + + // open the temp file (strName is the name of file to be replaced) + bool Open(const wxString& strName); + + // is the file opened? + bool IsOpened() const { return m_file.IsOpened(); } + // get current file length + wxFileOffset Length() const { return m_file.Length(); } + // move ptr ofs bytes related to start/current pos/end of file + bool Seek(wxFileOffset ofs, wxSeekMode mode = wxFromStart) + { return m_file.Seek(ofs, mode); } + // get current position in the file + wxFileOffset Tell() const { return m_file.Tell(); } + + // I/O (both functions return true on success, false on failure) + bool Write(const void *p, size_t n) { return m_file.Write(p, n) == n; } + bool Write(const wxString& str, const wxMBConv& conv = wxMBConvUTF8()) + { return m_file.Write(str, conv); } + + // flush data: can be called before closing file to ensure that data was + // correctly written out + bool Flush() { return m_file.Flush(); } + + // different ways to close the file + // validate changes and delete the old file of name m_strName + bool Commit(); + // discard changes + void Discard(); + + // dtor calls Discard() if file is still opened + ~wxTempFFile(); + +private: + // no copy ctor/assignment operator + wxTempFFile(const wxTempFFile&); + wxTempFFile& operator=(const wxTempFFile&); + + wxString m_strName, // name of the file to replace in Commit() + m_strTemp; // temporary file name + wxFFile m_file; // the temporary file +}; + +#endif // wxUSE_FFILE + +#endif // _WX_FFILE_H_ + diff --git a/lib/wxWidgets/include/wx/file.h b/lib/wxWidgets/include/wx/file.h new file mode 100644 index 0000000..8a6faba --- /dev/null +++ b/lib/wxWidgets/include/wx/file.h @@ -0,0 +1,195 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/file.h +// Purpose: wxFile - encapsulates low-level "file descriptor" +// wxTempFile - safely replace the old file +// Author: Vadim Zeitlin +// Modified by: +// Created: 29/01/98 +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FILEH__ +#define _WX_FILEH__ + +#include "wx/defs.h" + +#if wxUSE_FILE + +#include "wx/string.h" +#include "wx/filefn.h" +#include "wx/convauto.h" + +// ---------------------------------------------------------------------------- +// class wxFile: raw file IO +// +// NB: for space efficiency this class has no virtual functions, including +// dtor which is _not_ virtual, so it shouldn't be used as a base class. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFile +{ +public: + // more file constants + // ------------------- + // suppress Xcode 11 warning about shadowing global read() symbol + wxCLANG_WARNING_SUPPRESS(shadow) + + // opening mode + enum OpenMode { read, write, read_write, write_append, write_excl }; + // standard values for file descriptor + enum { fd_invalid = -1, fd_stdin, fd_stdout, fd_stderr }; + + wxCLANG_WARNING_RESTORE(shadow) + + // static functions + // ---------------- + // check whether a regular file by this name exists + static bool Exists(const wxString& name); + // check whether we can access the given file in given mode + // (only read and write make sense here) + static bool Access(const wxString& name, OpenMode mode); + + // ctors + // ----- + // def ctor + wxFile() { m_fd = fd_invalid; m_lasterror = 0; } + // open specified file (may fail, use IsOpened()) + wxFile(const wxString& fileName, OpenMode mode = read); + // attach to (already opened) file + wxFile(int lfd) { m_fd = lfd; m_lasterror = 0; } + + // open/close + // create a new file (with the default value of bOverwrite, it will fail if + // the file already exists, otherwise it will overwrite it and succeed) + bool Create(const wxString& fileName, bool bOverwrite = false, + int access = wxS_DEFAULT); + bool Open(const wxString& fileName, OpenMode mode = read, + int access = wxS_DEFAULT); + bool Close(); // Close is a NOP if not opened + + // assign an existing file descriptor and get it back from wxFile object + void Attach(int lfd) { Close(); m_fd = lfd; m_lasterror = 0; } + int Detach() { const int fdOld = m_fd; m_fd = fd_invalid; return fdOld; } + int fd() const { return m_fd; } + + // read/write (unbuffered) + // read all data from the file into a string (useful for text files) + bool ReadAll(wxString *str, const wxMBConv& conv = wxConvAuto()); + // returns number of bytes read or wxInvalidOffset on error + ssize_t Read(void *pBuf, size_t nCount); + // returns the number of bytes written + size_t Write(const void *pBuf, size_t nCount); + // returns true on success + bool Write(const wxString& s, const wxMBConv& conv = wxConvAuto()); + // flush data not yet written + bool Flush(); + + // file pointer operations (return wxInvalidOffset on failure) + // move ptr ofs bytes related to start/current offset/end of file + wxFileOffset Seek(wxFileOffset ofs, wxSeekMode mode = wxFromStart); + // move ptr to ofs bytes before the end + wxFileOffset SeekEnd(wxFileOffset ofs = 0) { return Seek(ofs, wxFromEnd); } + // get current offset + wxFileOffset Tell() const; + // get current file length + wxFileOffset Length() const; + + // simple accessors + // is file opened? + bool IsOpened() const { return m_fd != fd_invalid; } + // is end of file reached? + bool Eof() const; + // has an error occurred? + bool Error() const { return m_lasterror != 0; } + // get last errno + int GetLastError() const { return m_lasterror; } + // reset error state + void ClearLastError() { m_lasterror = 0; } + // type such as disk or pipe + wxFileKind GetKind() const { return wxGetFileKind(m_fd); } + + + // dtor closes the file if opened + ~wxFile() { Close(); } + +private: + // copy ctor and assignment operator are private because + // it doesn't make sense to copy files this way: + // attempt to do it will provoke a compile-time error. + wxFile(const wxFile&); + wxFile& operator=(const wxFile&); + + // Copy the value of errno into m_lasterror if rc == -1 and return true in + // this case (indicating that we've got an error). Otherwise return false. + // + // Notice that we use the possibly 64 bit wxFileOffset instead of int here so + // that it works for checking the result of functions such as tell() too. + bool CheckForError(wxFileOffset rc) const; + + + int m_fd; // file descriptor or INVALID_FD if not opened + int m_lasterror; // errno value of last error +}; + +// ---------------------------------------------------------------------------- +// class wxTempFile: if you want to replace another file, create an instance +// of wxTempFile passing the name of the file to be replaced to the ctor. Then +// you can write to wxTempFile and call Commit() function to replace the old +// file (and close this one) or call Discard() to cancel the modification. If +// you call neither of them, dtor will call Discard(). +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxTempFile +{ +public: + // ctors + // default + wxTempFile() { } + // associates the temp file with the file to be replaced and opens it + explicit wxTempFile(const wxString& strName); + + // open the temp file (strName is the name of file to be replaced) + bool Open(const wxString& strName); + + // is the file opened? + bool IsOpened() const { return m_file.IsOpened(); } + // get current file length + wxFileOffset Length() const { return m_file.Length(); } + // move ptr ofs bytes related to start/current offset/end of file + wxFileOffset Seek(wxFileOffset ofs, wxSeekMode mode = wxFromStart) + { return m_file.Seek(ofs, mode); } + // get current offset + wxFileOffset Tell() const { return m_file.Tell(); } + + // I/O (both functions return true on success, false on failure) + bool Write(const void *p, size_t n) { return m_file.Write(p, n) == n; } + bool Write(const wxString& str, const wxMBConv& conv = wxMBConvUTF8()) + { return m_file.Write(str, conv); } + + // flush data: can be called before closing file to ensure that data was + // correctly written out + bool Flush() { return m_file.Flush(); } + + // different ways to close the file + // validate changes and delete the old file of name m_strName + bool Commit(); + // discard changes + void Discard(); + + // dtor calls Discard() if file is still opened + ~wxTempFile(); + +private: + // no copy ctor/assignment operator + wxTempFile(const wxTempFile&); + wxTempFile& operator=(const wxTempFile&); + + wxString m_strName, // name of the file to replace in Commit() + m_strTemp; // temporary file name + wxFile m_file; // the temporary file +}; + +#endif // wxUSE_FILE + +#endif // _WX_FILEH__ diff --git a/lib/wxWidgets/include/wx/fileconf.h b/lib/wxWidgets/include/wx/fileconf.h new file mode 100644 index 0000000..fd392da --- /dev/null +++ b/lib/wxWidgets/include/wx/fileconf.h @@ -0,0 +1,267 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/fileconf.h +// Purpose: wxFileConfig derivation of wxConfigBase +// Author: Vadim Zeitlin +// Modified by: +// Created: 07.04.98 (adapted from appconf.cpp) +// Copyright: (c) 1997 Karsten Ballueder & Vadim Zeitlin +// Ballueder@usa.net +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _FILECONF_H +#define _FILECONF_H + +#include "wx/defs.h" + +#if wxUSE_CONFIG + +#include "wx/textfile.h" +#include "wx/string.h" +#include "wx/confbase.h" +#include "wx/filename.h" + +// ---------------------------------------------------------------------------- +// wxFileConfig +// ---------------------------------------------------------------------------- + +/* + wxFileConfig derives from base Config and implements file based config class, + i.e. it uses ASCII disk files to store the information. These files are + alternatively called INI, .conf or .rc in the documentation. They are + organized in groups or sections, which can nest (i.e. a group contains + subgroups, which contain their own subgroups &c). Each group has some + number of entries, which are "key = value" pairs. More precisely, the format + is: + + # comments are allowed after either ';' or '#' (Win/UNIX standard) + + # blank lines (as above) are ignored + + # global entries are members of special (no name) top group + written_for = Windows + platform = Linux + + # the start of the group 'Foo' + [Foo] # may put comments like this also + # following 3 lines are entries + key = value + another_key = " strings with spaces in the beginning should be quoted, \ + otherwise the spaces are lost" + last_key = but you don't have to put " normally (nor quote them, like here) + + # subgroup of the group 'Foo' + # (order is not important, only the name is: separator is '/', as in paths) + [Foo/Bar] + # entries prefixed with "!" are immutable, i.e. can't be changed if they are + # set in the system-wide config file + !special_key = value + bar_entry = whatever + + [Foo/Bar/Fubar] # depth is (theoretically :-) unlimited + # may have the same name as key in another section + bar_entry = whatever not + + You have {read/write/delete}Entry functions (guess what they do) and also + setCurrentPath to select current group. enum{Subgroups/Entries} allow you + to get all entries in the config file (in the current group). Finally, + flush() writes immediately all changed entries to disk (otherwise it would + be done automatically in dtor) + + wxFileConfig manages not less than 2 config files for each program: global + and local (or system and user if you prefer). Entries are read from both of + them and the local entries override the global ones unless the latter is + immutable (prefixed with '!') in which case a warning message is generated + and local value is ignored. Of course, the changes are always written to local + file only. + + The names of these files can be specified in a number of ways. First of all, + you can use the standard convention: using the ctor which takes 'strAppName' + parameter will probably be sufficient for 90% of cases. If, for whatever + reason you wish to use the files with some other names, you can always use the + second ctor. + + wxFileConfig also may automatically expand the values of environment variables + in the entries it reads: for example, if you have an entry + score_file = $HOME/.score + a call to Read(&str, "score_file") will return a complete path to .score file + unless the expansion was previously disabled with SetExpandEnvVars(false) call + (it's on by default, the current status can be retrieved with + IsExpandingEnvVars function). +*/ +class WXDLLIMPEXP_FWD_BASE wxFileConfigGroup; +class WXDLLIMPEXP_FWD_BASE wxFileConfigEntry; +class WXDLLIMPEXP_FWD_BASE wxFileConfigLineList; + +#if wxUSE_STREAMS +class WXDLLIMPEXP_FWD_BASE wxInputStream; +class WXDLLIMPEXP_FWD_BASE wxOutputStream; +#endif // wxUSE_STREAMS + +class WXDLLIMPEXP_BASE wxFileConfig : public wxConfigBase +{ +public: + // construct the "standard" full name for global (system-wide) and + // local (user-specific) config files from the base file name. + // + // the following are the filenames returned by this functions: + // global local + // Unix /etc/file.ext ~/.file + // Win %windir%\file.ext %USERPROFILE%\file.ext + // + // where file is the basename of szFile, ext is its extension + // or .conf (Unix) or .ini (Win) if it has none + static wxFileName GetGlobalFile(const wxString& szFile); + static wxFileName GetLocalFile(const wxString& szFile, int style = 0); + + static wxString GetGlobalFileName(const wxString& szFile) + { + return GetGlobalFile(szFile).GetFullPath(); + } + + static wxString GetLocalFileName(const wxString& szFile, int style = 0) + { + return GetLocalFile(szFile, style).GetFullPath(); + } + + // ctor & dtor + // New constructor: one size fits all. Specify wxCONFIG_USE_LOCAL_FILE or + // wxCONFIG_USE_GLOBAL_FILE to say which files should be used. + wxFileConfig(const wxString& appName = wxEmptyString, + const wxString& vendorName = wxEmptyString, + const wxString& localFilename = wxEmptyString, + const wxString& globalFilename = wxEmptyString, + long style = wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_GLOBAL_FILE, + const wxMBConv& conv = wxConvAuto()); + +#if wxUSE_STREAMS + // ctor that takes an input stream. + wxFileConfig(wxInputStream &inStream, const wxMBConv& conv = wxConvAuto()); +#endif // wxUSE_STREAMS + + // dtor will save unsaved data + virtual ~wxFileConfig(); + + // under Unix, set the umask to be used for the file creation, do nothing + // under other systems +#ifdef __UNIX__ + void SetUmask(int mode) { m_umask = mode; } +#else // !__UNIX__ + void SetUmask(int WXUNUSED(mode)) { } +#endif // __UNIX__/!__UNIX__ + + // implement inherited pure virtual functions + virtual void SetPath(const wxString& strPath) wxOVERRIDE; + virtual const wxString& GetPath() const wxOVERRIDE; + + virtual bool GetFirstGroup(wxString& str, long& lIndex) const wxOVERRIDE; + virtual bool GetNextGroup (wxString& str, long& lIndex) const wxOVERRIDE; + virtual bool GetFirstEntry(wxString& str, long& lIndex) const wxOVERRIDE; + virtual bool GetNextEntry (wxString& str, long& lIndex) const wxOVERRIDE; + + virtual size_t GetNumberOfEntries(bool bRecursive = false) const wxOVERRIDE; + virtual size_t GetNumberOfGroups(bool bRecursive = false) const wxOVERRIDE; + + virtual bool HasGroup(const wxString& strName) const wxOVERRIDE; + virtual bool HasEntry(const wxString& strName) const wxOVERRIDE; + + virtual bool Flush(bool bCurrentOnly = false) wxOVERRIDE; + + virtual bool RenameEntry(const wxString& oldName, const wxString& newName) wxOVERRIDE; + virtual bool RenameGroup(const wxString& oldName, const wxString& newName) wxOVERRIDE; + + virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = true) wxOVERRIDE; + virtual bool DeleteGroup(const wxString& szKey) wxOVERRIDE; + virtual bool DeleteAll() wxOVERRIDE; + + // additional, wxFileConfig-specific, functionality +#if wxUSE_STREAMS + // save the entire config file text to the given stream, note that the text + // won't be saved again in dtor when Flush() is called if you use this method + // as it won't be "changed" any more + virtual bool Save(wxOutputStream& os, const wxMBConv& conv = wxConvAuto()); +#endif // wxUSE_STREAMS + + void EnableAutoSave() { m_autosave = true; } + void DisableAutoSave() { m_autosave = false; } + +public: + // functions to work with this list + wxFileConfigLineList *LineListAppend(const wxString& str); + wxFileConfigLineList *LineListInsert(const wxString& str, + wxFileConfigLineList *pLine); // NULL => Prepend() + void LineListRemove(wxFileConfigLineList *pLine); + bool LineListIsEmpty(); + +protected: + virtual bool DoReadString(const wxString& key, wxString *pStr) const wxOVERRIDE; + virtual bool DoReadLong(const wxString& key, long *pl) const wxOVERRIDE; +#if wxUSE_BASE64 + virtual bool DoReadBinary(const wxString& key, wxMemoryBuffer* buf) const wxOVERRIDE; +#endif // wxUSE_BASE64 + + virtual bool DoWriteString(const wxString& key, const wxString& szValue) wxOVERRIDE; + virtual bool DoWriteLong(const wxString& key, long lValue) wxOVERRIDE; +#if wxUSE_BASE64 + virtual bool DoWriteBinary(const wxString& key, const wxMemoryBuffer& buf) wxOVERRIDE; +#endif // wxUSE_BASE64 + +private: + // GetXXXFileName helpers: return ('/' terminated) directory names + static wxString GetGlobalDir(); + static wxString GetLocalDir(int style = 0); + + // common part of all ctors (assumes that m_str{Local|Global}File are already + // initialized + void Init(); + + // common part of from dtor and DeleteAll + void CleanUp(); + + // parse the whole file + void Parse(const wxTextBuffer& buffer, bool bLocal); + + // the same as SetPath("/") + void SetRootPath(); + + // real SetPath() implementation, returns true if path could be set or false + // if path doesn't exist and createMissingComponents == false + bool DoSetPath(const wxString& strPath, bool createMissingComponents); + + // set/test the dirty flag + void SetDirty() { m_isDirty = true; } + void ResetDirty() { m_isDirty = false; } + bool IsDirty() const { return m_isDirty; } + + + // member variables + // ---------------- + wxFileConfigLineList *m_linesHead, // head of the linked list + *m_linesTail; // tail + + wxFileName m_fnLocalFile, // local file name passed to ctor + m_fnGlobalFile; // global + wxString m_strPath; // current path (not '/' terminated) + + wxFileConfigGroup *m_pRootGroup, // the top (unnamed) group + *m_pCurrentGroup; // the current group + + wxMBConv *m_conv; + +#ifdef __UNIX__ + int m_umask; // the umask to use for file creation +#endif // __UNIX__ + + bool m_isDirty; // if true, we have unsaved changes + bool m_autosave; // if true, save changes on destruction + + wxDECLARE_NO_COPY_CLASS(wxFileConfig); + wxDECLARE_ABSTRACT_CLASS(wxFileConfig); +}; + +#endif + // wxUSE_CONFIG + +#endif + //_FILECONF_H + diff --git a/lib/wxWidgets/include/wx/filectrl.h b/lib/wxWidgets/include/wx/filectrl.h new file mode 100644 index 0000000..d543958 --- /dev/null +++ b/lib/wxWidgets/include/wx/filectrl.h @@ -0,0 +1,145 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/filectrl.h +// Purpose: Header for wxFileCtrlBase and other common functions used by +// platform-specific wxFileCtrl's +// Author: Diaa M. Sami +// Modified by: +// Created: Jul-07-2007 +// Copyright: (c) Diaa M. Sami +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FILECTRL_H_BASE_ +#define _WX_FILECTRL_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_FILECTRL + +#include "wx/string.h" +#include "wx/event.h" + +enum +{ + wxFC_OPEN = 0x0001, + wxFC_SAVE = 0x0002, + wxFC_MULTIPLE = 0x0004, + wxFC_NOSHOWHIDDEN = 0x0008 +}; + +#define wxFC_DEFAULT_STYLE wxFC_OPEN +extern WXDLLIMPEXP_DATA_CORE(const char) wxFileCtrlNameStr[]; // in filectrlcmn.cpp + +class WXDLLIMPEXP_CORE wxFileCtrlBase +{ +public: + virtual ~wxFileCtrlBase() {} + + virtual void SetWildcard( const wxString& wildCard ) = 0; + virtual void SetFilterIndex( int filterindex ) = 0; + virtual bool SetDirectory( const wxString& dir ) = 0; + + // Selects a certain file. + // In case the filename specified isn't found/couldn't be shown with + // currently selected filter, false is returned and nothing happens + virtual bool SetFilename( const wxString& name ) = 0; + + // chdirs to a certain directory and selects a certain file. + // In case the filename specified isn't found/couldn't be shown with + // currently selected filter, false is returned and if directory exists + // it's chdir'ed to + virtual bool SetPath( const wxString& path ) = 0; + + virtual wxString GetFilename() const = 0; + virtual wxString GetDirectory() const = 0; + virtual wxString GetWildcard() const = 0; + virtual wxString GetPath() const = 0; + virtual void GetPaths( wxArrayString& paths ) const = 0; + virtual void GetFilenames( wxArrayString& files ) const = 0; + virtual int GetFilterIndex() const = 0; + + virtual bool HasMultipleFileSelection() const = 0; + virtual void ShowHidden(bool show) = 0; +}; + +void wxGenerateFilterChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd ); +void wxGenerateFolderChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd ); +void wxGenerateSelectionChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd ); +void wxGenerateFileActivatedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd, const wxString& filename = wxEmptyString ); + +#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) + #define wxFileCtrl wxGtkFileCtrl + #include "wx/gtk/filectrl.h" +#else + #define wxFileCtrl wxGenericFileCtrl + #include "wx/generic/filectrlg.h" +#endif + +// Some documentation +// On wxEVT_FILECTRL_FILTERCHANGED, only the value returned by GetFilterIndex is +// valid and it represents the (new) current filter index for the wxFileCtrl. +// On wxEVT_FILECTRL_FOLDERCHANGED, only the value returned by GetDirectory is +// valid and it represents the (new) current directory for the wxFileCtrl. +// On wxEVT_FILECTRL_FILEACTIVATED, GetDirectory returns the current directory +// for the wxFileCtrl and GetFiles returns the names of the file(s) activated. +// On wxEVT_FILECTRL_SELECTIONCHANGED, GetDirectory returns the current directory +// for the wxFileCtrl and GetFiles returns the names of the currently selected +// file(s). +// In wxGTK, after each wxEVT_FILECTRL_FOLDERCHANGED, wxEVT_FILECTRL_SELECTIONCHANGED +// is fired automatically once or more with 0 files. +class WXDLLIMPEXP_CORE wxFileCtrlEvent : public wxCommandEvent +{ +public: + wxFileCtrlEvent() {} + wxFileCtrlEvent( wxEventType type, wxObject *evtObject, int id ) + : wxCommandEvent( type, id ) + { + SetEventObject( evtObject ); + } + + // no need for the copy constructor as the default one will be fine. + virtual wxEvent *Clone() const wxOVERRIDE { return new wxFileCtrlEvent( *this ); } + + void SetFiles( const wxArrayString &files ) { m_files = files; } + void SetDirectory( const wxString &directory ) { m_directory = directory; } + void SetFilterIndex( int filterIndex ) { m_filterIndex = filterIndex; } + + wxArrayString GetFiles() const { return m_files; } + wxString GetDirectory() const { return m_directory; } + int GetFilterIndex() const { return m_filterIndex; } + + wxString GetFile() const; + +protected: + int m_filterIndex; + wxString m_directory; + wxArrayString m_files; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxFileCtrlEvent); +}; + +typedef void ( wxEvtHandler::*wxFileCtrlEventFunction )( wxFileCtrlEvent& ); + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FILECTRL_SELECTIONCHANGED, wxFileCtrlEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FILECTRL_FILEACTIVATED, wxFileCtrlEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FILECTRL_FOLDERCHANGED, wxFileCtrlEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FILECTRL_FILTERCHANGED, wxFileCtrlEvent ); + +#define wxFileCtrlEventHandler(func) \ + wxEVENT_HANDLER_CAST( wxFileCtrlEventFunction, func ) + +#define EVT_FILECTRL_FILEACTIVATED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_FILECTRL_FILEACTIVATED, id, wxFileCtrlEventHandler(fn)) + +#define EVT_FILECTRL_SELECTIONCHANGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_FILECTRL_SELECTIONCHANGED, id, wxFileCtrlEventHandler(fn)) + +#define EVT_FILECTRL_FOLDERCHANGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_FILECTRL_FOLDERCHANGED, id, wxFileCtrlEventHandler(fn)) + +#define EVT_FILECTRL_FILTERCHANGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_FILECTRL_FILTERCHANGED, id, wxFileCtrlEventHandler(fn)) + +#endif // wxUSE_FILECTRL + +#endif // _WX_FILECTRL_H_BASE_ diff --git a/lib/wxWidgets/include/wx/filedlg.h b/lib/wxWidgets/include/wx/filedlg.h new file mode 100644 index 0000000..418c2b7 --- /dev/null +++ b/lib/wxWidgets/include/wx/filedlg.h @@ -0,0 +1,305 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/filedlg.h +// Purpose: wxFileDialog base header +// Author: Robert Roebling +// Modified by: +// Created: 8/17/99 +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FILEDLG_H_BASE_ +#define _WX_FILEDLG_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_FILEDLG + +#include "wx/dialog.h" +#include "wx/arrstr.h" + +// this symbol is defined for the platforms which support multiple +// ('|'-separated) filters in the file dialog +#if defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXMAC__) + #define wxHAS_MULTIPLE_FILEDLG_FILTERS +#endif + +class WXDLLIMPEXP_FWD_CORE wxFileDialogCustomizeHook; + +//---------------------------------------------------------------------------- +// wxFileDialog data +//---------------------------------------------------------------------------- + +/* + The flags below must coexist with the following flags in m_windowStyle + #define wxCAPTION 0x20000000 + #define wxMAXIMIZE 0x00002000 + #define wxCLOSE_BOX 0x00001000 + #define wxSYSTEM_MENU 0x00000800 + wxBORDER_NONE = 0x00200000 + #define wxRESIZE_BORDER 0x00000040 + #define wxDIALOG_NO_PARENT 0x00000020 +*/ + +enum +{ + wxFD_OPEN = 0x0001, + wxFD_SAVE = 0x0002, + wxFD_OVERWRITE_PROMPT = 0x0004, + wxFD_NO_FOLLOW = 0x0008, + wxFD_FILE_MUST_EXIST = 0x0010, + wxFD_CHANGE_DIR = 0x0080, + wxFD_PREVIEW = 0x0100, + wxFD_MULTIPLE = 0x0200, + wxFD_SHOW_HIDDEN = 0x0400 +}; + +#define wxFD_DEFAULT_STYLE wxFD_OPEN + +#if wxABI_VERSION >= 30201 + +// Flags for wxFileDialog::AddShortcut(). +enum +{ + wxFD_SHORTCUT_TOP = 0x0001, + wxFD_SHORTCUT_BOTTOM = 0x0002 +}; + +#endif // wxABI_VERSION >= 3.2.1 + +extern WXDLLIMPEXP_DATA_CORE(const char) wxFileDialogNameStr[]; +extern WXDLLIMPEXP_DATA_CORE(const char) wxFileSelectorPromptStr[]; +extern WXDLLIMPEXP_DATA_CORE(const char) wxFileSelectorDefaultWildcardStr[]; + +//---------------------------------------------------------------------------- +// wxFileDialogBase +//---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFileDialogBase: public wxDialog +{ +public: + wxFileDialogBase () { Init(); } + + wxFileDialogBase(wxWindow *parent, + const wxString& message = wxASCII_STR(wxFileSelectorPromptStr), + const wxString& defaultDir = wxEmptyString, + const wxString& defaultFile = wxEmptyString, + const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + long style = wxFD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + const wxString& name = wxASCII_STR(wxFileDialogNameStr)) + { + Init(); + Create(parent, message, defaultDir, defaultFile, wildCard, style, pos, sz, name); + } + + virtual ~wxFileDialogBase() {} + + + bool Create(wxWindow *parent, + const wxString& message = wxASCII_STR(wxFileSelectorPromptStr), + const wxString& defaultDir = wxEmptyString, + const wxString& defaultFile = wxEmptyString, + const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + long style = wxFD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + const wxString& name = wxASCII_STR(wxFileDialogNameStr)); + + bool HasFdFlag(int flag) const { return HasFlag(flag); } + + virtual void SetMessage(const wxString& message) { m_message = message; } + virtual void SetPath(const wxString& path); + virtual void SetDirectory(const wxString& dir); + virtual void SetFilename(const wxString& name); + virtual void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; } + virtual void SetFilterIndex(int filterIndex) { m_filterIndex = filterIndex; } + + virtual wxString GetMessage() const { return m_message; } + virtual wxString GetPath() const + { + wxCHECK_MSG( !HasFlag(wxFD_MULTIPLE), wxString(), "When using wxFD_MULTIPLE, must call GetPaths() instead" ); + return m_path; + } + + virtual void GetPaths(wxArrayString& paths) const { paths.Empty(); paths.Add(m_path); } + virtual wxString GetDirectory() const { return m_dir; } + virtual wxString GetFilename() const + { + wxCHECK_MSG( !HasFlag(wxFD_MULTIPLE), wxString(), "When using wxFD_MULTIPLE, must call GetFilenames() instead" ); + return m_fileName; + } + virtual void GetFilenames(wxArrayString& files) const { files.Empty(); files.Add(m_fileName); } + virtual wxString GetWildcard() const { return m_wildCard; } + virtual int GetFilterIndex() const { return m_filterIndex; } + + virtual wxString GetCurrentlySelectedFilename() const + { return m_currentlySelectedFilename; } + + virtual int GetCurrentlySelectedFilterIndex () const + { return m_currentlySelectedFilterIndex; } + + +#if defined(__WXUNIVERSAL__) || !(defined(__WXMSW__) || defined(__WXGTK20__)) +#if wxABI_VERSION >= 30201 + // Add a shortcut to the given directory in the sidebar containing such + // shortcuts if supported. + bool AddShortcut(const wxString& directory, int flags = 0); +#endif // wxABI_VERSION >= 3.2.1 +#endif // Platforms without native implementation. + + // A customize hook methods will be called by wxFileDialog later if this + // function returns true, see its documentation for details. + // + // Note that the customizeHook object must remain alive at least until + // ShowModal() returns. + // + // If this function returns false, it means that customizing the file + // dialog is not supported on this platforms. + virtual bool SetCustomizeHook(wxFileDialogCustomizeHook& customizeHook); + + + // Extra controls support is deprecated now as it doesn't allow to use the + // contemporary file dialogs under MSW, use wxFileDialogCustomize-based + // API above instead in the new code. + + // this function is called with wxFileDialog as parameter and should + // create the window containing the extra controls we want to show in it + typedef wxWindow *(*ExtraControlCreatorFunction)(wxWindow*); + + virtual bool SupportsExtraControl() const { return false; } + + bool SetExtraControlCreator(ExtraControlCreatorFunction creator); + wxWindow *GetExtraControl() const { return m_extraControl; } + + // Utility functions + + // Append first extension to filePath from a ';' separated extensionList + // if filePath = "path/foo.bar" just return it as is + // if filePath = "foo[.]" and extensionList = "*.jpg;*.png" return "foo.jpg" + // if the extension is "*.j?g" (has wildcards) or "jpg" then return filePath + static wxString AppendExtension(const wxString &filePath, + const wxString &extensionList); + + // Set the filter index to match the given extension. + // + // This is always valid to call, even if the extension is empty or the + // filter list doesn't contain it, the function will just do nothing in + // these cases. + void SetFilterIndexFromExt(const wxString& ext); + +protected: + wxString m_message; + wxString m_dir; + wxString m_path; // Full path + wxString m_fileName; + wxString m_wildCard; + int m_filterIndex; + + // Currently selected, but not yet necessarily accepted by the user, file. + // This should be updated whenever the selection in the control changes by + // the platform-specific code to provide a useful implementation of + // GetCurrentlySelectedFilename(). + wxString m_currentlySelectedFilename; + + // Currently selected, but not yet necessarily accepted by the user, file + // type (a.k.a. filter) index. This should be updated whenever the + // selection in the control changes by the platform-specific code to + // provide a useful implementation of GetCurrentlySelectedFilterIndex(). + int m_currentlySelectedFilterIndex; + + wxFileDialogCustomizeHook* m_customizeHook; + + wxWindow* m_extraControl; + + // create and return the extra control using the given parent + wxWindow* CreateExtraControlWithParent(wxWindow* parent) const; + // returns true if control is created, also sets m_extraControl + bool CreateExtraControl(); + // destroy m_extraControl and reset it to NULL + void DestroyExtraControl(); + // return true if SetExtraControlCreator() was called + bool HasExtraControlCreator() const + { return m_extraControlCreator != NULL; } + // Helper function for native file dialog usage where no wx events + // are processed. + void UpdateExtraControlUI(); + // Helper function simply transferring data from custom controls if they + // are used -- must be called if the dialog was accepted. + void TransferDataFromExtraControl(); + + // Stub virtual functions for forward binary compatibility. DO NOT USE. + virtual void* WXReservedFileDialog1(void*); + virtual void* WXReservedFileDialog2(void*); + +private: + ExtraControlCreatorFunction m_extraControlCreator; + + void Init(); + wxDECLARE_DYNAMIC_CLASS(wxFileDialogBase); + wxDECLARE_NO_COPY_CLASS(wxFileDialogBase); +}; + + +//---------------------------------------------------------------------------- +// wxFileDialog convenience functions +//---------------------------------------------------------------------------- + +// File selector - backward compatibility +WXDLLIMPEXP_CORE wxString +wxFileSelector(const wxString& message = wxASCII_STR(wxFileSelectorPromptStr), + const wxString& default_path = wxEmptyString, + const wxString& default_filename = wxEmptyString, + const wxString& default_extension = wxEmptyString, + const wxString& wildcard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + int flags = 0, + wxWindow *parent = NULL, + int x = wxDefaultCoord, int y = wxDefaultCoord); + +// An extended version of wxFileSelector +WXDLLIMPEXP_CORE wxString +wxFileSelectorEx(const wxString& message = wxASCII_STR(wxFileSelectorPromptStr), + const wxString& default_path = wxEmptyString, + const wxString& default_filename = wxEmptyString, + int *indexDefaultExtension = NULL, + const wxString& wildcard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + int flags = 0, + wxWindow *parent = NULL, + int x = wxDefaultCoord, int y = wxDefaultCoord); + +// Ask for filename to load +WXDLLIMPEXP_CORE wxString +wxLoadFileSelector(const wxString& what, + const wxString& extension, + const wxString& default_name = wxEmptyString, + wxWindow *parent = NULL); + +// Ask for filename to save +WXDLLIMPEXP_CORE wxString +wxSaveFileSelector(const wxString& what, + const wxString& extension, + const wxString& default_name = wxEmptyString, + wxWindow *parent = NULL); + + +#if defined (__WXUNIVERSAL__) + #define wxHAS_GENERIC_FILEDIALOG + #include "wx/generic/filedlgg.h" +#elif defined(__WXMSW__) + #include "wx/msw/filedlg.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/filedlg.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/filedlg.h" // GTK+ > 2.4 has native version +#elif defined(__WXGTK__) + #include "wx/gtk1/filedlg.h" +#elif defined(__WXMAC__) + #include "wx/osx/filedlg.h" +#elif defined(__WXQT__) + #include "wx/qt/filedlg.h" +#endif + +#endif // wxUSE_FILEDLG + +#endif // _WX_FILEDLG_H_BASE_ diff --git a/lib/wxWidgets/include/wx/filedlgcustomize.h b/lib/wxWidgets/include/wx/filedlgcustomize.h new file mode 100644 index 0000000..4821e5e --- /dev/null +++ b/lib/wxWidgets/include/wx/filedlgcustomize.h @@ -0,0 +1,222 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/filedlgcustomize.h +// Purpose: Classes for wxFileDialog customization. +// Author: Vadim Zeitlin +// Created: 2022-05-26 +// Copyright: (c) 2022 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FILEDLGCUSTOMIZE_H_ +#define _WX_FILEDLGCUSTOMIZE_H_ + +#include "wx/vector.h" + +class wxFileDialogCustomControlImpl; +class wxFileDialogButtonImpl; +class wxFileDialogCheckBoxImpl; +class wxFileDialogRadioButtonImpl; +class wxFileDialogChoiceImpl; +class wxFileDialogTextCtrlImpl; +class wxFileDialogStaticTextImpl; +class wxFileDialogCustomizeImpl; + +// ---------------------------------------------------------------------------- +// wxFileDialog custom controls +// ---------------------------------------------------------------------------- + +// All these controls support a very limited set of functions, but use the same +// names for the things that they do support as the corresponding "normal" wx +// classes and also generate some (but not all) of the same events. + +// The base class for all wxFileDialog custom controls. +class WXDLLIMPEXP_CORE wxFileDialogCustomControl : public wxEvtHandler +{ +public: + void Show(bool show = true); + void Hide() { Show(false); } + + void Enable(bool enable = true); + void Disable() { Enable(false); } + + ~wxFileDialogCustomControl(); + +protected: + explicit wxFileDialogCustomControl(wxFileDialogCustomControlImpl* impl) + : m_impl(impl) + { + } + + // By default custom controls don't generate any events, but some of them + // override this function to allow connecting to the selected events. + virtual bool OnDynamicBind(wxDynamicEventTableEntry& entry) wxOVERRIDE; + + + wxFileDialogCustomControlImpl* const m_impl; + + wxDECLARE_NO_COPY_CLASS(wxFileDialogCustomControl); +}; + +// A class representing a custom button. +class WXDLLIMPEXP_CORE wxFileDialogButton : public wxFileDialogCustomControl +{ +public: + // Ctor is only used by wxWidgets itself. + explicit wxFileDialogButton(wxFileDialogButtonImpl* impl); + +protected: + virtual bool OnDynamicBind(wxDynamicEventTableEntry& entry) wxOVERRIDE; + +private: + wxFileDialogButtonImpl* GetImpl() const; + + wxDECLARE_NO_COPY_CLASS(wxFileDialogButton); +}; + +// A class representing a custom checkbox. +class WXDLLIMPEXP_CORE wxFileDialogCheckBox : public wxFileDialogCustomControl +{ +public: + bool GetValue() const; + void SetValue(bool value); + + // Ctor is only used by wxWidgets itself. + explicit wxFileDialogCheckBox(wxFileDialogCheckBoxImpl* impl); + +protected: + virtual bool OnDynamicBind(wxDynamicEventTableEntry& entry) wxOVERRIDE; + +private: + wxFileDialogCheckBoxImpl* GetImpl() const; + + wxDECLARE_NO_COPY_CLASS(wxFileDialogCheckBox); +}; + +// A class representing a custom radio button. +class WXDLLIMPEXP_CORE wxFileDialogRadioButton : public wxFileDialogCustomControl +{ +public: + bool GetValue() const; + void SetValue(bool value); + + // Ctor is only used by wxWidgets itself. + explicit wxFileDialogRadioButton(wxFileDialogRadioButtonImpl* impl); + +protected: + virtual bool OnDynamicBind(wxDynamicEventTableEntry& entry) wxOVERRIDE; + +private: + wxFileDialogRadioButtonImpl* GetImpl() const; + + wxDECLARE_NO_COPY_CLASS(wxFileDialogRadioButton); +}; + +// A class representing a custom combobox button. +class WXDLLIMPEXP_CORE wxFileDialogChoice : public wxFileDialogCustomControl +{ +public: + int GetSelection() const; + void SetSelection(int n); + + // Ctor is only used by wxWidgets itself. + explicit wxFileDialogChoice(wxFileDialogChoiceImpl* impl); + +protected: + virtual bool OnDynamicBind(wxDynamicEventTableEntry& entry) wxOVERRIDE; + +private: + wxFileDialogChoiceImpl* GetImpl() const; + + wxDECLARE_NO_COPY_CLASS(wxFileDialogChoice); +}; + +// A class representing a custom text control. +class WXDLLIMPEXP_CORE wxFileDialogTextCtrl : public wxFileDialogCustomControl +{ +public: + wxString GetValue() const; + void SetValue(const wxString& text); + + // Ctor is only used by wxWidgets itself. + explicit wxFileDialogTextCtrl(wxFileDialogTextCtrlImpl* impl); + +private: + wxFileDialogTextCtrlImpl* GetImpl() const; + + wxDECLARE_NO_COPY_CLASS(wxFileDialogTextCtrl); +}; + +// A class representing a custom static text. +class WXDLLIMPEXP_CORE wxFileDialogStaticText : public wxFileDialogCustomControl +{ +public: + void SetLabelText(const wxString& text); + + // Ctor is only used by wxWidgets itself. + explicit wxFileDialogStaticText(wxFileDialogStaticTextImpl* impl); + +private: + wxFileDialogStaticTextImpl* GetImpl() const; + + wxDECLARE_NO_COPY_CLASS(wxFileDialogStaticText); +}; + +// ---------------------------------------------------------------------------- +// wxFileDialogCustomizer is used by wxFileDialogCustomizeHook +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFileDialogCustomize +{ +public: + wxFileDialogButton* AddButton(const wxString& label); + wxFileDialogCheckBox* AddCheckBox(const wxString& label); + wxFileDialogRadioButton* AddRadioButton(const wxString& label); + wxFileDialogChoice* AddChoice(size_t n, const wxString* strings); + wxFileDialogTextCtrl* AddTextCtrl(const wxString& label = wxString()); + wxFileDialogStaticText* AddStaticText(const wxString& label); + + ~wxFileDialogCustomize(); + +protected: + // Ctor is only used by wxWidgets itself. + // + // Note that we don't take ownership of the implementation pointer here, + // see the comment in the dtor for more details. + explicit wxFileDialogCustomize(wxFileDialogCustomizeImpl* impl) + : m_impl(impl) + { + } + + wxVector m_controls; + +private: + template T* StoreAndReturn(T* control); + + wxFileDialogCustomizeImpl* const m_impl; + + wxDECLARE_NO_COPY_CLASS(wxFileDialogCustomize); +}; + +// ---------------------------------------------------------------------------- +// wxFileDialogCustomizeHook: used by wxFileDialog itself +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFileDialogCustomizeHook +{ +public: + // This method must be overridden to add custom controls to the dialog + // using the provided customizer object. + virtual void AddCustomControls(wxFileDialogCustomize& customizer) = 0; + + // This method may be overridden to update the custom controls whenever + // something changes in the dialog. + virtual void UpdateCustomControls() { } + + // This method should typically be overridden to save the values of the + // custom controls when the dialog is accepted. + virtual void TransferDataFromCustomControls() { } + + virtual ~wxFileDialogCustomizeHook(); +}; + +#endif // _WX_FILEDLGCUSTOMIZE_H_ diff --git a/lib/wxWidgets/include/wx/filefn.h b/lib/wxWidgets/include/wx/filefn.h new file mode 100644 index 0000000..fe019f9 --- /dev/null +++ b/lib/wxWidgets/include/wx/filefn.h @@ -0,0 +1,707 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/filefn.h +// Purpose: File- and directory-related functions +// Author: Julian Smart +// Modified by: +// Created: 29/01/98 +// Copyright: (c) 1998 Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _FILEFN_H_ +#define _FILEFN_H_ + +#include "wx/list.h" +#include "wx/arrstr.h" + +#include + +#include +#include + +#if defined(__UNIX__) + #include + #include +#endif + +#if defined(__WINDOWS__) +#if !defined( __GNUWIN32__ ) && !defined(__CYGWIN__) + #include + #include + #include +#endif // __WINDOWS__ +#endif // native Win compiler + +#include // O_RDONLY &c + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// MSVC doesn't define mode_t, so do it ourselves unless someone else +// had already predefined it. +#if defined(__VISUALC__) && !defined(wxHAS_MODE_T) + #define wxHAS_MODE_T + typedef int mode_t; +#endif + +// define off_t +#include + +#if defined(__VISUALC__) + typedef _off_t off_t; +#endif + +enum wxSeekMode +{ + wxFromStart, + wxFromCurrent, + wxFromEnd +}; + +enum wxFileKind +{ + wxFILE_KIND_UNKNOWN, + wxFILE_KIND_DISK, // a file supporting seeking to arbitrary offsets + wxFILE_KIND_TERMINAL, // a tty + wxFILE_KIND_PIPE // a pipe +}; + +// we redefine these constants here because S_IREAD &c are _not_ standard +// however, we do assume that the values correspond to the Unix umask bits +enum wxPosixPermissions +{ + // standard Posix names for these permission flags: + wxS_IRUSR = 00400, + wxS_IWUSR = 00200, + wxS_IXUSR = 00100, + + wxS_IRGRP = 00040, + wxS_IWGRP = 00020, + wxS_IXGRP = 00010, + + wxS_IROTH = 00004, + wxS_IWOTH = 00002, + wxS_IXOTH = 00001, + + // longer but more readable synonyms for the constants above: + wxPOSIX_USER_READ = wxS_IRUSR, + wxPOSIX_USER_WRITE = wxS_IWUSR, + wxPOSIX_USER_EXECUTE = wxS_IXUSR, + + wxPOSIX_GROUP_READ = wxS_IRGRP, + wxPOSIX_GROUP_WRITE = wxS_IWGRP, + wxPOSIX_GROUP_EXECUTE = wxS_IXGRP, + + wxPOSIX_OTHERS_READ = wxS_IROTH, + wxPOSIX_OTHERS_WRITE = wxS_IWOTH, + wxPOSIX_OTHERS_EXECUTE = wxS_IXOTH, + + // default mode for the new files: allow reading/writing them to everybody but + // the effective file mode will be set after anding this value with umask and + // so won't include wxS_IW{GRP,OTH} for the default 022 umask value + wxS_DEFAULT = (wxPOSIX_USER_READ | wxPOSIX_USER_WRITE | \ + wxPOSIX_GROUP_READ | wxPOSIX_GROUP_WRITE | \ + wxPOSIX_OTHERS_READ | wxPOSIX_OTHERS_WRITE), + + // default mode for the new directories (see wxFileName::Mkdir): allow + // reading/writing/executing them to everybody, but just like wxS_DEFAULT + // the effective directory mode will be set after anding this value with umask + wxS_DIR_DEFAULT = (wxPOSIX_USER_READ | wxPOSIX_USER_WRITE | wxPOSIX_USER_EXECUTE | \ + wxPOSIX_GROUP_READ | wxPOSIX_GROUP_WRITE | wxPOSIX_GROUP_EXECUTE | \ + wxPOSIX_OTHERS_READ | wxPOSIX_OTHERS_WRITE | wxPOSIX_OTHERS_EXECUTE) +}; + +// ---------------------------------------------------------------------------- +// declare our versions of low level file functions: some compilers prepend +// underscores to the usual names, some also have Unicode versions of them +// ---------------------------------------------------------------------------- + +#if defined(__WINDOWS__) && \ + ( \ + defined(__VISUALC__) || \ + defined(__MINGW64_TOOLCHAIN__) || \ + (defined(__MINGW32__) && !defined(__WINE__)) \ + ) + + // temporary defines just used immediately below + #undef wxHAS_HUGE_FILES + #undef wxHAS_HUGE_STDIO_FILES + + // detect compilers which have support for huge files + #if defined(__VISUALC__) + #define wxHAS_HUGE_FILES 1 + #elif defined(__MINGW32__) + #define wxHAS_HUGE_FILES 1 + #elif defined(_LARGE_FILES) + #define wxHAS_HUGE_FILES 1 + #endif + + // detect compilers which have support for huge stdio files + #if wxCHECK_VISUALC_VERSION(8) + #define wxHAS_HUGE_STDIO_FILES + #define wxFseek _fseeki64 + #define wxFtell _ftelli64 + #elif wxCHECK_MINGW32_VERSION(3, 5) // mingw-runtime version (not gcc) + #define wxHAS_HUGE_STDIO_FILES + + wxDECL_FOR_STRICT_MINGW32(int, fseeko64, (FILE*, long long, int)) + #define wxFseek fseeko64 + + #ifdef wxNEEDS_STRICT_ANSI_WORKAROUNDS + // Unfortunately ftello64() is not defined in the library for + // whatever reason but as an inline function, so define wxFtell() + // here similarly. + inline long long wxFtell(FILE* fp) + { + fpos_t pos; + if ( fgetpos(fp, &pos) != 0 ) + return -1LL; + + // Unfortunately our interface assumes that the file position + // is representable as "long long", so we have to get it from + // fpos_t, even though it's an opaque type. And its exact + // representation has changed in MinGW, so we have to test for + // mingwrt version. + #if wxCHECK_MINGW32_VERSION(5, 2) + // In 5.2.2 it's a union with a __value field. + return pos.__value; + #else + // Up to 5.1.1 it was a simple typedef. + return pos; + #endif + } + #else + #define wxFtell ftello64 + #endif + #endif + + + // types + + #ifdef wxHAS_HUGE_FILES + typedef wxLongLong_t wxFileOffset; + #define wxFileOffsetFmtSpec wxLongLongFmtSpec + #else + typedef off_t wxFileOffset; + #endif + + + #define wxPOSIX_STRUCT(s) struct wxPOSIX_IDENT(s) + + #ifdef wxHAS_HUGE_FILES + #define wxStructStat struct _stati64 + #else + #define wxStructStat struct _stat + #endif + + + // functions + + // MSVC and compatible compilers prepend underscores to the POSIX function + // names, other compilers don't and even if their later versions usually do + // define the versions with underscores for MSVC compatibility, it's better + // to avoid using them as they're not present in earlier versions and + // always using the native functions spelling is easier than testing for + // the versions + #if defined(__MINGW64_TOOLCHAIN__) + #define wxPOSIX_IDENT(func) ::func + #else // by default assume MSVC-compatible names + #define wxPOSIX_IDENT(func) _ ## func + #define wxHAS_UNDERSCORES_IN_POSIX_IDENTS + #endif + + // first functions not working with strings, i.e. without ANSI/Unicode + // complications + #define wxClose wxPOSIX_IDENT(close) + + #define wxRead wxPOSIX_IDENT(read) + #define wxWrite wxPOSIX_IDENT(write) + + #ifdef wxHAS_HUGE_FILES + #ifndef __MINGW64_TOOLCHAIN__ + #define wxSeek wxPOSIX_IDENT(lseeki64) + #define wxLseek wxPOSIX_IDENT(lseeki64) + #define wxTell wxPOSIX_IDENT(telli64) + #else + // unfortunately, mingw-W64 is somewhat inconsistent... + #define wxSeek _lseeki64 + #define wxLseek _lseeki64 + #define wxTell _telli64 + #endif + #else // !wxHAS_HUGE_FILES + #define wxSeek wxPOSIX_IDENT(lseek) + #define wxLseek wxPOSIX_IDENT(lseek) + #define wxTell wxPOSIX_IDENT(tell) + #endif // wxHAS_HUGE_FILES/!wxHAS_HUGE_FILES + + + #define wxFsync _commit + + // could be already defined by configure (Cygwin) + #ifndef HAVE_FSYNC + #define HAVE_FSYNC + #endif + + #define wxEof wxPOSIX_IDENT(eof) + + // then the functions taking strings + + // first the ANSI versions + #define wxCRT_OpenA wxPOSIX_IDENT(open) + #define wxCRT_AccessA wxPOSIX_IDENT(access) + #define wxCRT_ChmodA wxPOSIX_IDENT(chmod) + #define wxCRT_MkDirA wxPOSIX_IDENT(mkdir) + #define wxCRT_RmDirA wxPOSIX_IDENT(rmdir) + #ifdef wxHAS_HUGE_FILES + // MinGW-64 provides underscore-less versions of all file functions + // except for this one. + #ifdef __MINGW64_TOOLCHAIN__ + #define wxCRT_StatA _stati64 + #else + #define wxCRT_StatA wxPOSIX_IDENT(stati64) + #endif + #else + #define wxCRT_StatA wxPOSIX_IDENT(stat) + #endif + + // then wide char ones + #if wxUSE_UNICODE + + #define wxCRT_OpenW _wopen + + wxDECL_FOR_STRICT_MINGW32(int, _wopen, (const wchar_t*, int, ...)) + wxDECL_FOR_STRICT_MINGW32(int, _waccess, (const wchar_t*, int)) + wxDECL_FOR_STRICT_MINGW32(int, _wchmod, (const wchar_t*, int)) + wxDECL_FOR_STRICT_MINGW32(int, _wmkdir, (const wchar_t*)) + wxDECL_FOR_STRICT_MINGW32(int, _wrmdir, (const wchar_t*)) + wxDECL_FOR_STRICT_MINGW32(int, _wstati64, (const wchar_t*, struct _stati64*)) + + #define wxCRT_AccessW _waccess + #define wxCRT_ChmodW _wchmod + #define wxCRT_MkDirW _wmkdir + #define wxCRT_RmDirW _wrmdir + #ifdef wxHAS_HUGE_FILES + #define wxCRT_StatW _wstati64 + #else + #define wxCRT_StatW _wstat + #endif + #endif // wxUSE_UNICODE + + + // finally the default char-type versions + #if wxUSE_UNICODE + #define wxCRT_Open wxCRT_OpenW + #define wxCRT_Access wxCRT_AccessW + #define wxCRT_Chmod wxCRT_ChmodW + #define wxCRT_MkDir wxCRT_MkDirW + #define wxCRT_RmDir wxCRT_RmDirW + #define wxCRT_Stat wxCRT_StatW + #else // !wxUSE_UNICODE + #define wxCRT_Open wxCRT_OpenA + #define wxCRT_Access wxCRT_AccessA + #define wxCRT_Chmod wxCRT_ChmodA + #define wxCRT_MkDir wxCRT_MkDirA + #define wxCRT_RmDir wxCRT_RmDirA + #define wxCRT_Stat wxCRT_StatA + #endif // wxUSE_UNICODE/!wxUSE_UNICODE + + + // constants (unless already defined by the user code) + #ifdef wxHAS_UNDERSCORES_IN_POSIX_IDENTS + #ifndef O_RDONLY + #define O_RDONLY _O_RDONLY + #define O_WRONLY _O_WRONLY + #define O_RDWR _O_RDWR + #define O_EXCL _O_EXCL + #define O_CREAT _O_CREAT + #define O_BINARY _O_BINARY + #endif + + #ifndef S_IFMT + #define S_IFMT _S_IFMT + #define S_IFDIR _S_IFDIR + #define S_IFREG _S_IFREG + #endif + #endif // wxHAS_UNDERSCORES_IN_POSIX_IDENTS + + #ifdef wxHAS_HUGE_FILES + // wxFile is present and supports large files. + #if wxUSE_FILE + #define wxHAS_LARGE_FILES + #endif + // wxFFile is present and supports large files + #if wxUSE_FFILE && defined wxHAS_HUGE_STDIO_FILES + #define wxHAS_LARGE_FFILES + #endif + #endif + + // private defines, undefine so that nobody gets tempted to use + #undef wxHAS_HUGE_FILES + #undef wxHAS_HUGE_STDIO_FILES +#else // Unix or Windows using unknown compiler, assume POSIX supported + typedef off_t wxFileOffset; + #ifdef HAVE_LARGEFILE_SUPPORT + #define wxFileOffsetFmtSpec wxLongLongFmtSpec + wxCOMPILE_TIME_ASSERT( sizeof(off_t) == sizeof(wxLongLong_t), + BadFileSizeType ); + // wxFile is present and supports large files + #if wxUSE_FILE + #define wxHAS_LARGE_FILES + #endif + // wxFFile is present and supports large files + #if wxUSE_FFILE && (SIZEOF_LONG == 8 || defined HAVE_FSEEKO) + #define wxHAS_LARGE_FFILES + #endif + #ifdef HAVE_FSEEKO + #define wxFseek fseeko + #define wxFtell ftello + #endif + #else + #define wxFileOffsetFmtSpec wxT("") + #endif + // functions + #define wxClose close + #define wxRead ::read + #define wxWrite ::write + #define wxLseek lseek + #define wxSeek lseek + #define wxFsync fsync + #define wxEof eof + #define wxCRT_MkDir mkdir + #define wxCRT_RmDir rmdir + + #define wxTell(fd) lseek(fd, 0, SEEK_CUR) + + #define wxStructStat struct stat + + #define wxCRT_Open open + #define wxCRT_Stat stat + #define wxCRT_Lstat lstat + #define wxCRT_Access access + #define wxCRT_Chmod chmod + + #define wxCRT_Readlink readlink + + #define wxHAS_NATIVE_LSTAT + #define wxHAS_NATIVE_READLINK +#endif // platforms + +// if the platform doesn't have symlinks, define wxCRT_Lstat to be the same as +// wxCRT_Stat to avoid #ifdefs in the code using it +#ifndef wxHAS_NATIVE_LSTAT + #define wxCRT_Lstat wxCRT_Stat +#endif + +// define wxFseek/wxFtell to large file versions if available (done above) or +// to fseek/ftell if not, to save ifdefs in using code +#ifndef wxFseek + #define wxFseek fseek +#endif +#ifndef wxFtell + #define wxFtell ftell +#endif + +inline int wxAccess(const wxString& path, mode_t mode) + { return wxCRT_Access(path.fn_str(), mode); } +inline int wxChmod(const wxString& path, mode_t mode) + { return wxCRT_Chmod(path.fn_str(), mode); } +inline int wxOpen(const wxString& path, int flags, mode_t mode) + { return wxCRT_Open(path.fn_str(), flags, mode); } + +#if defined(wxHAS_NATIVE_READLINK) +inline ssize_t wxReadlink(const wxString& path, char* buf, int size) + { return wxCRT_Readlink(path.fn_str(), buf, size); } +#endif + +inline int wxStat(const wxString& path, wxStructStat *buf) + { return wxCRT_Stat(path.fn_str(), buf); } +inline int wxLstat(const wxString& path, wxStructStat *buf) + { return wxCRT_Lstat(path.fn_str(), buf); } +inline int wxRmDir(const wxString& path) + { return wxCRT_RmDir(path.fn_str()); } +#if (defined(__WINDOWS__) && !defined(__CYGWIN__)) +inline int wxMkDir(const wxString& path, mode_t WXUNUSED(mode) = 0) + { return wxCRT_MkDir(path.fn_str()); } +#else +inline int wxMkDir(const wxString& path, mode_t mode) + { return wxCRT_MkDir(path.fn_str(), mode); } +#endif + +#ifdef O_BINARY + #define wxO_BINARY O_BINARY +#else + #define wxO_BINARY 0 +#endif + +const int wxInvalidOffset = -1; + +// ---------------------------------------------------------------------------- +// functions +// ---------------------------------------------------------------------------- +WXDLLIMPEXP_BASE bool wxFileExists(const wxString& filename); + +// does the path exist? (may have or not '/' or '\\' at the end) +WXDLLIMPEXP_BASE bool wxDirExists(const wxString& pathName); + +WXDLLIMPEXP_BASE bool wxIsAbsolutePath(const wxString& filename); + +// Get filename +WXDLLIMPEXP_BASE wxChar* wxFileNameFromPath(wxChar *path); +WXDLLIMPEXP_BASE wxString wxFileNameFromPath(const wxString& path); + +// Get directory +WXDLLIMPEXP_BASE wxString wxPathOnly(const wxString& path); + +// all deprecated functions below are deprecated in favour of wxFileName's methods +#if WXWIN_COMPATIBILITY_2_8 + +wxDEPRECATED( WXDLLIMPEXP_BASE void wxDos2UnixFilename(char *s) ); +wxDEPRECATED( WXDLLIMPEXP_BASE void wxDos2UnixFilename(wchar_t *s) ); + +wxDEPRECATED_BUT_USED_INTERNALLY( + WXDLLIMPEXP_BASE void wxUnix2DosFilename(char *s) ); +wxDEPRECATED_BUT_USED_INTERNALLY( + WXDLLIMPEXP_BASE void wxUnix2DosFilename(wchar_t *s) ); + +// Strip the extension, in situ +// Deprecated in favour of wxFileName::StripExtension() but notice that their +// behaviour is slightly different, see the manual +wxDEPRECATED( WXDLLIMPEXP_BASE void wxStripExtension(char *buffer) ); +wxDEPRECATED( WXDLLIMPEXP_BASE void wxStripExtension(wchar_t *buffer) ); +wxDEPRECATED( WXDLLIMPEXP_BASE void wxStripExtension(wxString& buffer) ); + +// Get a temporary filename +wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE wxChar* wxGetTempFileName(const wxString& prefix, wxChar *buf = NULL) ); +wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE bool wxGetTempFileName(const wxString& prefix, wxString& buf) ); + +// Expand file name (~/ and ${OPENWINHOME}/ stuff) +wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE char* wxExpandPath(char *dest, const wxString& path) ); +wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE wchar_t* wxExpandPath(wchar_t *dest, const wxString& path) ); + // DEPRECATED: use wxFileName::Normalize(wxPATH_NORM_ENV_VARS) + +// Contract w.r.t environment ( -> ${OPENWINHOME}/lib) +// and make (if under the home tree) relative to home +// [caller must copy-- volatile] +wxDEPRECATED( +WXDLLIMPEXP_BASE wxChar* wxContractPath(const wxString& filename, + const wxString& envname = wxEmptyString, + const wxString& user = wxEmptyString) ); + // DEPRECATED: use wxFileName::ReplaceEnvVariable and wxFileName::ReplaceHomeDir + +// Destructive removal of /./ and /../ stuff +wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE char* wxRealPath(char *path) ); +wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE wchar_t* wxRealPath(wchar_t *path) ); +wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE wxString wxRealPath(const wxString& path) ); + // DEPRECATED: use wxFileName::Normalize instead + +// Allocate a copy of the full absolute path +wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* wxCopyAbsolutePath(const wxString& path) ); + // DEPRECATED: use wxFileName::MakeAbsolute instead +#endif + +// Get first file name matching given wild card. +// Flags are reserved for future use. +#define wxFILE 1 +#define wxDIR 2 +WXDLLIMPEXP_BASE wxString wxFindFirstFile(const wxString& spec, int flags = wxFILE); +WXDLLIMPEXP_BASE wxString wxFindNextFile(); + +// Does the pattern contain wildcards? +WXDLLIMPEXP_BASE bool wxIsWild(const wxString& pattern); + +// Does the pattern match the text (usually a filename)? +// If dot_special is true, doesn't match * against . (eliminating +// `hidden' dot files) +WXDLLIMPEXP_BASE bool wxMatchWild(const wxString& pattern, const wxString& text, bool dot_special = true); + +// Concatenate two files to form third +WXDLLIMPEXP_BASE bool wxConcatFiles(const wxString& src1, const wxString& src2, const wxString& dest); + +// Copy file +WXDLLIMPEXP_BASE bool wxCopyFile(const wxString& src, const wxString& dest, + bool overwrite = true); + +// Remove file +WXDLLIMPEXP_BASE bool wxRemoveFile(const wxString& file); + +// Rename file +WXDLLIMPEXP_BASE bool wxRenameFile(const wxString& oldpath, const wxString& newpath, bool overwrite = true); + +// Get current working directory. +WXDLLIMPEXP_BASE wxString wxGetCwd(); + +// Set working directory +WXDLLIMPEXP_BASE bool wxSetWorkingDirectory(const wxString& d); + +// Make directory +WXDLLIMPEXP_BASE bool wxMkdir(const wxString& dir, int perm = wxS_DIR_DEFAULT); + +// Remove directory. Flags reserved for future use. +WXDLLIMPEXP_BASE bool wxRmdir(const wxString& dir, int flags = 0); + +// Return the type of an open file +WXDLLIMPEXP_BASE wxFileKind wxGetFileKind(int fd); +WXDLLIMPEXP_BASE wxFileKind wxGetFileKind(FILE *fp); + +// permissions; these functions work both on files and directories: +WXDLLIMPEXP_BASE bool wxIsWritable(const wxString &path); +WXDLLIMPEXP_BASE bool wxIsReadable(const wxString &path); +WXDLLIMPEXP_BASE bool wxIsExecutable(const wxString &path); + +// ---------------------------------------------------------------------------- +// separators in file names +// ---------------------------------------------------------------------------- + +// between file name and extension +#define wxFILE_SEP_EXT wxT('.') + +// between drive/volume name and the path +#define wxFILE_SEP_DSK wxT(':') + +// between the path components +#define wxFILE_SEP_PATH_DOS wxT('\\') +#define wxFILE_SEP_PATH_UNIX wxT('/') +#define wxFILE_SEP_PATH_MAC wxT(':') +#define wxFILE_SEP_PATH_VMS wxT('.') // VMS also uses '[' and ']' + +// separator in the path list (as in PATH environment variable) +// there is no PATH variable in Classic Mac OS so just use the +// semicolon (it must be different from the file name separator) +// NB: these are strings and not characters on purpose! +#define wxPATH_SEP_DOS wxT(";") +#define wxPATH_SEP_UNIX wxT(":") +#define wxPATH_SEP_MAC wxT(";") + +// platform independent versions +#if defined(__UNIX__) + // CYGWIN also uses UNIX settings + #define wxFILE_SEP_PATH wxFILE_SEP_PATH_UNIX + #define wxPATH_SEP wxPATH_SEP_UNIX +#elif defined(__MAC__) + #define wxFILE_SEP_PATH wxFILE_SEP_PATH_MAC + #define wxPATH_SEP wxPATH_SEP_MAC +#else // Windows + #define wxFILE_SEP_PATH wxFILE_SEP_PATH_DOS + #define wxPATH_SEP wxPATH_SEP_DOS +#endif // Unix/Windows + +// this is useful for wxString::IsSameAs(): to compare two file names use +// filename1.IsSameAs(filename2, wxARE_FILENAMES_CASE_SENSITIVE) +#if defined(__UNIX__) && !defined(__DARWIN__) + #define wxARE_FILENAMES_CASE_SENSITIVE true +#else // Windows and OSX + #define wxARE_FILENAMES_CASE_SENSITIVE false +#endif // Unix/Windows + +// is the char a path separator? +inline bool wxIsPathSeparator(wxChar c) +{ + // under DOS/Windows we should understand both Unix and DOS file separators +#if defined(__UNIX__) || defined(__MAC__) + return c == wxFILE_SEP_PATH; +#else + return c == wxFILE_SEP_PATH_DOS || c == wxFILE_SEP_PATH_UNIX; +#endif +} + +// does the string ends with path separator? +WXDLLIMPEXP_BASE bool wxEndsWithPathSeparator(const wxString& filename); + +#if WXWIN_COMPATIBILITY_2_8 +// split the full path into path (including drive for DOS), name and extension +// (understands both '/' and '\\') +// Deprecated in favour of wxFileName::SplitPath +wxDEPRECATED( WXDLLIMPEXP_BASE void wxSplitPath(const wxString& fileName, + wxString *pstrPath, + wxString *pstrName, + wxString *pstrExt) ); +#endif + +// find a file in a list of directories, returns false if not found +WXDLLIMPEXP_BASE bool wxFindFileInPath(wxString *pStr, const wxString& szPath, const wxString& szFile); + +// Get the OS directory if appropriate (such as the Windows directory). +// On non-Windows platform, probably just return the empty string. +WXDLLIMPEXP_BASE wxString wxGetOSDirectory(); + +#if wxUSE_DATETIME + +// Get file modification time +WXDLLIMPEXP_BASE time_t wxFileModificationTime(const wxString& filename); + +#endif // wxUSE_DATETIME + +// Parses the wildCard, returning the number of filters. +// Returns 0 if none or if there's a problem, +// The arrays will contain an equal number of items found before the error. +// wildCard is in the form: +// "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png" +WXDLLIMPEXP_BASE int wxParseCommonDialogsFilter(const wxString& wildCard, wxArrayString& descriptions, wxArrayString& filters); + +// ---------------------------------------------------------------------------- +// classes +// ---------------------------------------------------------------------------- + +#ifdef __UNIX__ + +// set umask to the given value in ctor and reset it to the old one in dtor +class WXDLLIMPEXP_BASE wxUmaskChanger +{ +public: + // change the umask to the given one if it is not -1: this allows to write + // the same code whether you really want to change umask or not, as is in + // wxFileConfig::Flush() for example + wxUmaskChanger(int umaskNew) + { + m_umaskOld = umaskNew == -1 ? -1 : (int)umask((mode_t)umaskNew); + } + + ~wxUmaskChanger() + { + if ( m_umaskOld != -1 ) + umask((mode_t)m_umaskOld); + } + +private: + int m_umaskOld; +}; + +// this macro expands to an "anonymous" wxUmaskChanger object under Unix and +// nothing elsewhere +#define wxCHANGE_UMASK(m) wxUmaskChanger wxMAKE_UNIQUE_NAME(umaskChanger_)(m) + +#else // !__UNIX__ + +#define wxCHANGE_UMASK(m) + +#endif // __UNIX__/!__UNIX__ + + +// Path searching +class WXDLLIMPEXP_BASE wxPathList : public wxArrayString +{ +public: + wxPathList() {} + wxPathList(const wxArrayString &arr) + { Add(arr); } + + // Adds all paths in environment variable + void AddEnvList(const wxString& envVariable); + + // Adds given path to this list + bool Add(const wxString& path); + void Add(const wxArrayString &paths); + + // Find the first full path for which the file exists + wxString FindValidPath(const wxString& filename) const; + + // Find the first full path for which the file exists; ensure it's an + // absolute path that gets returned. + wxString FindAbsoluteValidPath(const wxString& filename) const; + + // Given full path and filename, add path to list + bool EnsureFileAccessible(const wxString& path); +}; + +#endif // _WX_FILEFN_H_ diff --git a/lib/wxWidgets/include/wx/filehistory.h b/lib/wxWidgets/include/wx/filehistory.h new file mode 100644 index 0000000..a5756a7 --- /dev/null +++ b/lib/wxWidgets/include/wx/filehistory.h @@ -0,0 +1,119 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/filehistory.h +// Purpose: wxFileHistory class +// Author: Julian Smart, Vaclav Slavik +// Created: 2010-05-03 +// Copyright: (c) Julian Smart, Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FILEHISTORY_H_ +#define _WX_FILEHISTORY_H_ + +#include "wx/defs.h" + +#if wxUSE_FILE_HISTORY + +#include "wx/windowid.h" +#include "wx/object.h" +#include "wx/list.h" +#include "wx/string.h" +#include "wx/arrstr.h" + +class WXDLLIMPEXP_FWD_CORE wxMenu; +class WXDLLIMPEXP_FWD_BASE wxConfigBase; +class WXDLLIMPEXP_FWD_BASE wxFileName; + +enum wxFileHistoryMenuPathStyle +{ + wxFH_PATH_SHOW_IF_DIFFERENT, + wxFH_PATH_SHOW_NEVER, + wxFH_PATH_SHOW_ALWAYS +}; + +// ---------------------------------------------------------------------------- +// File history management +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFileHistoryBase : public wxObject +{ +public: + wxFileHistoryBase(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1); + + // Operations + virtual void AddFileToHistory(const wxString& file); + virtual void RemoveFileFromHistory(size_t i); + virtual int GetMaxFiles() const { return (int)m_fileMaxFiles; } + virtual void UseMenu(wxMenu *menu); + + // Remove menu from the list (MDI child may be closing) + virtual void RemoveMenu(wxMenu *menu); + +#if wxUSE_CONFIG + virtual void Load(const wxConfigBase& config); + virtual void Save(wxConfigBase& config); +#endif // wxUSE_CONFIG + + virtual void AddFilesToMenu(); + virtual void AddFilesToMenu(wxMenu* menu); // Single menu + + // Accessors + virtual wxString GetHistoryFile(size_t i) const { return m_fileHistory[i]; } + virtual size_t GetCount() const { return m_fileHistory.GetCount(); } + + const wxList& GetMenus() const { return m_fileMenus; } + + // Set/get base id + void SetBaseId(wxWindowID baseId) { m_idBase = baseId; } + wxWindowID GetBaseId() const { return m_idBase; } + + void SetMenuPathStyle(wxFileHistoryMenuPathStyle style); + wxFileHistoryMenuPathStyle GetMenuPathStyle() const { return m_menuPathStyle; } + +protected: + // Last n files + wxArrayString m_fileHistory; + + // Menus to maintain (may need several for an MDI app) + wxList m_fileMenus; + + // Max files to maintain + size_t m_fileMaxFiles; + + // Style of the paths in the menu labels + wxFileHistoryMenuPathStyle m_menuPathStyle; + +private: + void DoRefreshLabels(); + + + // The ID of the first history menu item (Doesn't have to be wxID_FILE1) + wxWindowID m_idBase; + + // Normalize a file name to canonical form. We have a special function for + // this to ensure the same normalization is used everywhere. + static wxString NormalizeFileName(const wxFileName& filename); + + // Remove any existing entries from the associated menus. + void RemoveExistingHistory(); + + wxDECLARE_NO_COPY_CLASS(wxFileHistoryBase); +}; + +#if defined(__WXGTK20__) + #include "wx/gtk/filehistory.h" +#else + // no platform-specific implementation of wxFileHistory yet + class WXDLLIMPEXP_CORE wxFileHistory : public wxFileHistoryBase + { + public: + wxFileHistory(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1) + : wxFileHistoryBase(maxFiles, idBase) {} + + wxDECLARE_DYNAMIC_CLASS(wxFileHistory); + }; +#endif + +#endif // wxUSE_FILE_HISTORY + +#endif // _WX_FILEHISTORY_H_ diff --git a/lib/wxWidgets/include/wx/filename.h b/lib/wxWidgets/include/wx/filename.h new file mode 100644 index 0000000..1bdb3b7 --- /dev/null +++ b/lib/wxWidgets/include/wx/filename.h @@ -0,0 +1,677 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/filename.h +// Purpose: wxFileName - encapsulates a file path +// Author: Robert Roebling, Vadim Zeitlin +// Modified by: +// Created: 28.12.00 +// Copyright: (c) 2000 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FILENAME_H_ +#define _WX_FILENAME_H_ + +#include "wx/arrstr.h" +#include "wx/filefn.h" +#include "wx/datetime.h" +#include "wx/intl.h" +#include "wx/longlong.h" +#include "wx/file.h" + +#if wxUSE_FILE +class WXDLLIMPEXP_FWD_BASE wxFile; +#endif + +#if wxUSE_FFILE +class WXDLLIMPEXP_FWD_BASE wxFFile; +#endif + +// this symbol is defined for the platforms where file systems use volumes in +// paths +#if defined(__WINDOWS__) + #define wxHAS_FILESYSTEM_VOLUMES +#endif + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// the various values for the path format: this mainly affects the path +// separator but also whether or not the path has the drive part (as under +// Windows) +enum wxPathFormat +{ + wxPATH_NATIVE = 0, // the path format for the current platform + wxPATH_UNIX, + wxPATH_BEOS = wxPATH_UNIX, + wxPATH_MAC, + wxPATH_DOS, + wxPATH_WIN = wxPATH_DOS, + wxPATH_OS2 = wxPATH_DOS, + wxPATH_VMS, + + wxPATH_MAX // Not a valid value for specifying path format +}; + +// different conventions that may be used with GetHumanReadableSize() +enum wxSizeConvention +{ + wxSIZE_CONV_TRADITIONAL, // 1024 bytes = 1 KB + wxSIZE_CONV_IEC, // 1024 bytes = 1 KiB + wxSIZE_CONV_SI // 1000 bytes = 1 KB +}; + +// the kind of normalization to do with the file name: these values can be +// or'd together to perform several operations at once +enum wxPathNormalize +{ + wxPATH_NORM_ENV_VARS = 0x0001, // replace env vars with their values + wxPATH_NORM_DOTS = 0x0002, // squeeze all .. and . + wxPATH_NORM_TILDE = 0x0004, // Unix only: replace ~ and ~user + wxPATH_NORM_CASE = 0x0008, // if case insensitive => tolower + wxPATH_NORM_ABSOLUTE = 0x0010, // make the path absolute + wxPATH_NORM_LONG = 0x0020, // make the path the long form (MSW-only) + wxPATH_NORM_SHORTCUT = 0x0040, // resolve the shortcut, if it is a shortcut + + // Don't use this constant, it used to correspond to the default + // Normalize() behaviour but this is deprecated now. + wxPATH_NORM_DEPR_OLD_DEFAULT= 0x00ff & ~wxPATH_NORM_CASE, + + // This constant name is misleading, as it doesn't really include all the + // flags above, so its use is discouraged, please use the flags you want + // explicitly instead. + wxPATH_NORM_ALL + wxDEPRECATED_ATTR("specify the wanted flags explicitly to avoid surprises") + = wxPATH_NORM_DEPR_OLD_DEFAULT +}; + +// what exactly should GetPath() return? +enum +{ + wxPATH_NO_SEPARATOR = 0x0000, // for symmetry with wxPATH_GET_SEPARATOR + wxPATH_GET_VOLUME = 0x0001, // include the volume if applicable + wxPATH_GET_SEPARATOR = 0x0002 // terminate the path with the separator +}; + +// Mkdir flags +enum +{ + wxPATH_MKDIR_FULL = 0x0001 // create directories recursively +}; + +// Rmdir flags +enum +{ + wxPATH_RMDIR_FULL = 0x0001, // delete with subdirectories if empty + wxPATH_RMDIR_RECURSIVE = 0x0002 // delete all recursively (dangerous!) +}; + +// FileExists flags +enum +{ + wxFILE_EXISTS_REGULAR = 0x0001, // check for existence of a regular file + wxFILE_EXISTS_DIR = 0x0002, // check for existence of a directory + wxFILE_EXISTS_SYMLINK = 0x1004, // check for existence of a symbolic link; + // also sets wxFILE_EXISTS_NO_FOLLOW as + // it would never be satisfied otherwise + wxFILE_EXISTS_DEVICE = 0x0008, // check for existence of a device + wxFILE_EXISTS_FIFO = 0x0010, // check for existence of a FIFO + wxFILE_EXISTS_SOCKET = 0x0020, // check for existence of a socket + // gap for future types + wxFILE_EXISTS_NO_FOLLOW = 0x1000, // don't dereference a contained symlink + wxFILE_EXISTS_ANY = 0x1FFF // check for existence of anything +}; + +#if wxUSE_LONGLONG +// error code of wxFileName::GetSize() +extern WXDLLIMPEXP_DATA_BASE(const wxULongLong) wxInvalidSize; +#endif // wxUSE_LONGLONG + + + +// ---------------------------------------------------------------------------- +// wxFileName: encapsulates a file path +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFileName +{ +public: + // constructors and assignment + + // the usual stuff + wxFileName() { Clear(); } + wxFileName(const wxFileName& filepath) { Assign(filepath); } + + // from a full filename: if it terminates with a '/', a directory path + // is constructed (the name will be empty), otherwise a file name and + // extension are extracted from it + wxFileName( const wxString& fullpath, wxPathFormat format = wxPATH_NATIVE ) + { Assign( fullpath, format ); m_dontFollowLinks = false; } + + // from a directory name and a file name + wxFileName(const wxString& path, + const wxString& name, + wxPathFormat format = wxPATH_NATIVE) + { Assign(path, name, format); m_dontFollowLinks = false; } + + // from a volume, directory name, file base name and extension + wxFileName(const wxString& volume, + const wxString& path, + const wxString& name, + const wxString& ext, + wxPathFormat format = wxPATH_NATIVE) + { Assign(volume, path, name, ext, format); m_dontFollowLinks = false; } + + // from a directory name, file base name and extension + wxFileName(const wxString& path, + const wxString& name, + const wxString& ext, + wxPathFormat format = wxPATH_NATIVE) + { Assign(path, name, ext, format); m_dontFollowLinks = false; } + + // the same for delayed initialization + + void Assign(const wxFileName& filepath); + + void Assign(const wxString& fullpath, + wxPathFormat format = wxPATH_NATIVE); + + void Assign(const wxString& volume, + const wxString& path, + const wxString& name, + const wxString& ext, + bool hasExt, + wxPathFormat format = wxPATH_NATIVE); + + void Assign(const wxString& volume, + const wxString& path, + const wxString& name, + const wxString& ext, + wxPathFormat format = wxPATH_NATIVE) + { Assign(volume, path, name, ext, !ext.empty(), format); } + + void Assign(const wxString& path, + const wxString& name, + wxPathFormat format = wxPATH_NATIVE); + + void Assign(const wxString& path, + const wxString& name, + const wxString& ext, + wxPathFormat format = wxPATH_NATIVE); + + void AssignDir(const wxString& dir, wxPathFormat format = wxPATH_NATIVE); + + // assorted assignment operators + + wxFileName& operator=(const wxFileName& filename) + { if (this != &filename) Assign(filename); return *this; } + + wxFileName& operator=(const wxString& filename) + { Assign(filename); return *this; } + + // reset all components to default, uninitialized state + void Clear(); + + // static pseudo constructors + static wxFileName FileName(const wxString& file, + wxPathFormat format = wxPATH_NATIVE); + static wxFileName DirName(const wxString& dir, + wxPathFormat format = wxPATH_NATIVE); + + // file tests + + // is the filename valid at all? + bool IsOk() const + { + // we're fine if we have the path or the name or if we're a root dir + return m_dirs.size() != 0 || !m_name.empty() || !m_relative || + !m_ext.empty() || m_hasExt; + } + + // does the file with this name exist? + bool FileExists() const; + static bool FileExists( const wxString &file ); + + // does the directory with this name exist? + bool DirExists() const; + static bool DirExists( const wxString &dir ); + + // does anything at all with this name (i.e. file, directory or some + // other file system object such as a device, socket, ...) exist? + bool Exists(int flags = wxFILE_EXISTS_ANY) const; + static bool Exists(const wxString& path, int flags = wxFILE_EXISTS_ANY); + + + // checks on most common flags for files/directories; + // more platform-specific features (like e.g. Unix permissions) are not + // available in wxFileName + + bool IsDirWritable() const { return wxIsWritable(GetPath()); } + static bool IsDirWritable(const wxString &path) { return wxDirExists(path) && wxIsWritable(path); } + + bool IsDirReadable() const { return wxIsReadable(GetPath()); } + static bool IsDirReadable(const wxString &path) { return wxDirExists(path) && wxIsReadable(path); } + + // NOTE: IsDirExecutable() is not present because the meaning of "executable" + // directory is very platform-dependent and also not so useful + + bool IsFileWritable() const { return wxIsWritable(GetFullPath()); } + static bool IsFileWritable(const wxString &path) { return wxFileExists(path) && wxIsWritable(path); } + + bool IsFileReadable() const { return wxIsReadable(GetFullPath()); } + static bool IsFileReadable(const wxString &path) { return wxFileExists(path) && wxIsReadable(path); } + + bool IsFileExecutable() const { return wxIsExecutable(GetFullPath()); } + static bool IsFileExecutable(const wxString &path) { return wxFileExists(path) && wxIsExecutable(path); } + + // set the file permissions to a combination of wxPosixPermissions enum + // values + bool SetPermissions(int permissions); + + // Returns the native path for a file URL + static wxFileName URLToFileName(const wxString& url); + + // Returns the file URL for a native path + static wxString FileNameToURL(const wxFileName& filename); + + // time functions +#if wxUSE_DATETIME + // set the file last access/mod and creation times + // (any of the pointers may be NULL) + bool SetTimes(const wxDateTime *dtAccess, + const wxDateTime *dtMod, + const wxDateTime *dtCreate) const; + + // set the access and modification times to the current moment + bool Touch() const; + + // return the last access, last modification and create times + // (any of the pointers may be NULL) + bool GetTimes(wxDateTime *dtAccess, + wxDateTime *dtMod, + wxDateTime *dtCreate) const; + + // convenience wrapper: get just the last mod time of the file + wxDateTime GetModificationTime() const + { + wxDateTime dtMod; + (void)GetTimes(NULL, &dtMod, NULL); + return dtMod; + } +#endif // wxUSE_DATETIME + + // various file/dir operations + + // retrieve the value of the current working directory + void AssignCwd(const wxString& volume = wxEmptyString); + static wxString GetCwd(const wxString& volume = wxEmptyString); + + // change the current working directory + bool SetCwd() const; + static bool SetCwd( const wxString &cwd ); + + // get the value of user home (Unix only mainly) + void AssignHomeDir(); + static wxString GetHomeDir(); + + // get the system temporary directory + static wxString GetTempDir(); + +#if wxUSE_FILE || wxUSE_FFILE + // get a temp file name starting with the specified prefix + void AssignTempFileName(const wxString& prefix); + static wxString CreateTempFileName(const wxString& prefix); +#endif // wxUSE_FILE + +#if wxUSE_FILE + // get a temp file name starting with the specified prefix and open the + // file passed to us using this name for writing (atomically if + // possible) + void AssignTempFileName(const wxString& prefix, wxFile *fileTemp); + static wxString CreateTempFileName(const wxString& prefix, + wxFile *fileTemp); +#endif // wxUSE_FILE + +#if wxUSE_FFILE + // get a temp file name starting with the specified prefix and open the + // file passed to us using this name for writing (atomically if + // possible) + void AssignTempFileName(const wxString& prefix, wxFFile *fileTemp); + static wxString CreateTempFileName(const wxString& prefix, + wxFFile *fileTemp); +#endif // wxUSE_FFILE + + // directory creation and removal. + bool Mkdir(int perm = wxS_DIR_DEFAULT, int flags = 0) const; + static bool Mkdir(const wxString &dir, int perm = wxS_DIR_DEFAULT, + int flags = 0); + + bool Rmdir(int flags = 0) const; + static bool Rmdir(const wxString &dir, int flags = 0); + + // operations on the path + + // normalize the path using the specified normalizations, use + // MakeAbsolute() for a simpler form applying the standard ones + // + // this may be done using another (than current) value of cwd + bool Normalize(int flags, + const wxString& cwd = wxEmptyString, + wxPathFormat format = wxPATH_NATIVE); + + // using wxPATH_NORM_ALL may give unexpected results, so avoid using + // this function and call Normalize(wxPATH_NORM_ENV_VARS | ...) + // explicitly if you really need environment variables expansion + wxDEPRECATED_MSG("specify the wanted flags explicitly to avoid surprises") + bool Normalize() + { return Normalize(wxPATH_NORM_DEPR_OLD_DEFAULT); } + + // get a path path relative to the given base directory, i.e. opposite + // of Normalize + // + // pass an empty string to get a path relative to the working directory + // + // returns true if the file name was modified, false if we failed to do + // anything with it (happens when the file is on a different volume, + // for example) + bool MakeRelativeTo(const wxString& pathBase = wxEmptyString, + wxPathFormat format = wxPATH_NATIVE); + + // make the path absolute and resolve any "." and ".." in it + // + // this may be done using another (than current) value of cwd + bool MakeAbsolute(const wxString& cwd = wxEmptyString, + wxPathFormat format = wxPATH_NATIVE) + { return Normalize(wxPATH_NORM_DOTS | wxPATH_NORM_ABSOLUTE | + wxPATH_NORM_TILDE, cwd, format); } + + // Convenient helper for returning the absolute path corresponding to + // the given one. + wxString GetAbsolutePath(const wxString& cwd = wxEmptyString, + wxPathFormat format = wxPATH_NATIVE) const + { + wxFileName fn(*this); + fn.MakeAbsolute(cwd, format); + return fn.GetFullPath(); + } + + // If the path is a symbolic link (Unix-only), indicate that all + // filesystem operations on this path should be performed on the link + // itself and not on the file it points to, as is the case by default. + // + // No effect if this is not a symbolic link. + void DontFollowLink() + { + m_dontFollowLinks = true; + } + + // If the path is a symbolic link (Unix-only), returns whether various + // file operations should act on the link itself, or on its target. + // + // This does not test if the path is really a symlink or not. + bool ShouldFollowLink() const + { + return !m_dontFollowLinks; + } + + // Resolve a wxFileName object representing a link to its target + wxFileName ResolveLink(); + +#if defined(__WIN32__) && wxUSE_OLE + // if the path is a shortcut, return the target and optionally, + // the arguments + bool GetShortcutTarget(const wxString& shortcutPath, + wxString& targetFilename, + wxString* arguments = NULL) const; +#endif + + // if the path contains the value of the environment variable named envname + // then this function replaces it with the string obtained from + // wxString::Format(replacementFmtString, value_of_envname_variable) + // + // Example: + // wxFileName fn("/usr/openwin/lib/someFile"); + // fn.ReplaceEnvVariable("OPENWINHOME"); + // // now fn.GetFullPath() == "$OPENWINHOME/lib/someFile" + bool ReplaceEnvVariable(const wxString& envname, + const wxString& replacementFmtString = wxS("$%s"), + wxPathFormat format = wxPATH_NATIVE); + + // replaces, if present in the path, the home directory for the given user + // (see wxGetHomeDir) with a tilde + bool ReplaceHomeDir(wxPathFormat format = wxPATH_NATIVE); + + + // Comparison + + // compares with the rules of the given platforms format + bool SameAs(const wxFileName& filepath, + wxPathFormat format = wxPATH_NATIVE) const; + + // compare with another filename object + bool operator==(const wxFileName& filename) const + { return SameAs(filename); } + bool operator!=(const wxFileName& filename) const + { return !SameAs(filename); } + + // compare with a filename string interpreted as a native file name + bool operator==(const wxString& filename) const + { return SameAs(wxFileName(filename)); } + bool operator!=(const wxString& filename) const + { return !SameAs(wxFileName(filename)); } + + // are the file names of this type cases sensitive? + static bool IsCaseSensitive( wxPathFormat format = wxPATH_NATIVE ); + + // is this filename absolute? + bool IsAbsolute(wxPathFormat format = wxPATH_NATIVE) const; + + // is this filename relative? + bool IsRelative(wxPathFormat format = wxPATH_NATIVE) const + { return !IsAbsolute(format); } + + // Returns the characters that aren't allowed in filenames + // on the specified platform. + static wxString GetForbiddenChars(wxPathFormat format = wxPATH_NATIVE); + + // Information about path format + + // get the string separating the volume from the path for this format, + // return an empty string if this format doesn't support the notion of + // volumes at all + static wxString GetVolumeSeparator(wxPathFormat format = wxPATH_NATIVE); + + // get the string of path separators for this format + static wxString GetPathSeparators(wxPathFormat format = wxPATH_NATIVE); + + // get the string of path terminators, i.e. characters which terminate the + // path + static wxString GetPathTerminators(wxPathFormat format = wxPATH_NATIVE); + + // get the canonical path separator for this format + static wxUniChar GetPathSeparator(wxPathFormat format = wxPATH_NATIVE) + { return GetPathSeparators(format)[0u]; } + + // is the char a path separator for this format? + static bool IsPathSeparator(wxChar ch, wxPathFormat format = wxPATH_NATIVE); + + // is this is a DOS path which begins with a windows unique volume name + // ('\\?\Volume{guid}\')? + static bool IsMSWUniqueVolumeNamePath(const wxString& path, + wxPathFormat format = wxPATH_NATIVE); + + // Dir accessors + size_t GetDirCount() const { return m_dirs.size(); } + bool AppendDir(const wxString& dir); + void PrependDir(const wxString& dir); + bool InsertDir(size_t before, const wxString& dir); + void RemoveDir(size_t pos); + void RemoveLastDir() { RemoveDir(GetDirCount() - 1); } + + // Other accessors + void SetExt( const wxString &ext ) { m_ext = ext; m_hasExt = !m_ext.empty(); } + void ClearExt() { m_ext.clear(); m_hasExt = false; } + void SetEmptyExt() { m_ext.clear(); m_hasExt = true; } + wxString GetExt() const { return m_ext; } + bool HasExt() const { return m_hasExt; } + + void SetName( const wxString &name ) { m_name = name; } + wxString GetName() const { return m_name; } + bool HasName() const { return !m_name.empty(); } + + void SetVolume( const wxString &volume ) { m_volume = volume; } + wxString GetVolume() const { return m_volume; } + bool HasVolume() const { return !m_volume.empty(); } + + // full name is the file name + extension (but without the path) + void SetFullName(const wxString& fullname); + wxString GetFullName() const; + + const wxArrayString& GetDirs() const { return m_dirs; } + + // flags are combination of wxPATH_GET_XXX flags + wxString GetPath(int flags = wxPATH_GET_VOLUME, + wxPathFormat format = wxPATH_NATIVE) const; + + // Replace current path with this one + void SetPath( const wxString &path, wxPathFormat format = wxPATH_NATIVE ); + + // Construct full path with name and ext + wxString GetFullPath( wxPathFormat format = wxPATH_NATIVE ) const; + + // Return the short form of the path (returns identity on non-Windows platforms) + wxString GetShortPath() const; + + // Return the long form of the path (returns identity on non-Windows platforms) + wxString GetLongPath() const; + + // Is this a file or directory (not necessarily an existing one) + bool IsDir() const { return m_name.empty() && m_ext.empty(); } + + // various helpers + + // get the canonical path format for this platform + static wxPathFormat GetFormat( wxPathFormat format = wxPATH_NATIVE ); + + // split a fullpath into the volume, path, (base) name and extension + // (all of the pointers can be NULL) + static void SplitPath(const wxString& fullpath, + wxString *volume, + wxString *path, + wxString *name, + wxString *ext, + bool *hasExt = NULL, + wxPathFormat format = wxPATH_NATIVE); + + static void SplitPath(const wxString& fullpath, + wxString *volume, + wxString *path, + wxString *name, + wxString *ext, + wxPathFormat format) + { + SplitPath(fullpath, volume, path, name, ext, NULL, format); + } + + // compatibility version: volume is part of path + static void SplitPath(const wxString& fullpath, + wxString *path, + wxString *name, + wxString *ext, + wxPathFormat format = wxPATH_NATIVE); + + // split a path into volume and pure path part + static void SplitVolume(const wxString& fullpathWithVolume, + wxString *volume, + wxString *path, + wxPathFormat format = wxPATH_NATIVE); + + // strip the file extension: "foo.bar" => "foo" (but ".baz" => ".baz") + static wxString StripExtension(const wxString& fullpath); + +#ifdef wxHAS_FILESYSTEM_VOLUMES + // return the string representing a file system volume, or drive + static wxString GetVolumeString(char drive, int flags = wxPATH_GET_SEPARATOR); +#endif // wxHAS_FILESYSTEM_VOLUMES + + // File size + +#if wxUSE_LONGLONG + // returns the size of the given filename + wxULongLong GetSize() const; + static wxULongLong GetSize(const wxString &file); + + // returns the size in a human readable form + wxString + GetHumanReadableSize(const wxString& nullsize = wxGetTranslation(wxASCII_STR("Not available")), + int precision = 1, + wxSizeConvention conv = wxSIZE_CONV_TRADITIONAL) const; + static wxString + GetHumanReadableSize(const wxULongLong& sz, + const wxString& nullsize = wxGetTranslation(wxASCII_STR("Not available")), + int precision = 1, + wxSizeConvention conv = wxSIZE_CONV_TRADITIONAL); +#endif // wxUSE_LONGLONG + + + // deprecated methods, don't use any more + // -------------------------------------- + + wxString GetPath( bool withSep, wxPathFormat format = wxPATH_NATIVE ) const + { return GetPath(withSep ? wxPATH_GET_SEPARATOR : 0, format); } + wxString GetPathWithSep(wxPathFormat format = wxPATH_NATIVE ) const + { return GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR, format); } + +private: + // check whether this dir is valid for Append/Prepend/InsertDir() + static bool IsValidDirComponent(const wxString& dir); + + // flags used with DoSetPath() + enum + { + SetPath_PathOnly = 0, + SetPath_MayHaveVolume = 1 + }; + + // helper of public SetPath() also used internally + void DoSetPath(const wxString& path, wxPathFormat format, + int flags = SetPath_MayHaveVolume); + + // the drive/volume/device specification (always empty for Unix) + // + // for the drive letters, contains just the letter itself, but for MSW UNC + // and volume GUID paths, it starts with double backslash, e.g. "\\share" + wxString m_volume; + + // the path components of the file + wxArrayString m_dirs; + + // the file name and extension (empty for directories) + wxString m_name, + m_ext; + + // when m_dirs is empty it may mean either that we have no path at all or + // that our path is '/', i.e. the root directory + // + // we use m_relative to distinguish between these two cases, it will be + // true in the former and false in the latter + // + // NB: the path is not absolute just because m_relative is false, it still + // needs the drive (i.e. volume) in some formats (Windows) + bool m_relative; + + // when m_ext is empty, it may be because we don't have any extension or + // because we have an empty extension + // + // the difference is important as file with name "foo" and without + // extension has full name "foo" while with empty extension it is "foo." + bool m_hasExt; + + // by default, symlinks are dereferenced but this flag can be set with + // DontFollowLink() to change this and make different operations work on + // this file path itself instead of the target of the symlink + bool m_dontFollowLinks; +}; + +#endif // _WX_FILENAME_H_ + diff --git a/lib/wxWidgets/include/wx/filepicker.h b/lib/wxWidgets/include/wx/filepicker.h new file mode 100644 index 0000000..d978842 --- /dev/null +++ b/lib/wxWidgets/include/wx/filepicker.h @@ -0,0 +1,418 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/filepicker.h +// Purpose: wxFilePickerCtrl, wxDirPickerCtrl base header +// Author: Francesco Montorsi +// Modified by: +// Created: 14/4/2006 +// Copyright: (c) Francesco Montorsi +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FILEDIRPICKER_H_BASE_ +#define _WX_FILEDIRPICKER_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL + +#include "wx/pickerbase.h" +#include "wx/filename.h" + +class WXDLLIMPEXP_FWD_CORE wxDialog; +class WXDLLIMPEXP_FWD_CORE wxFileDirPickerEvent; + +extern WXDLLIMPEXP_DATA_CORE(const char) wxFilePickerWidgetLabel[]; +extern WXDLLIMPEXP_DATA_CORE(const char) wxFilePickerWidgetNameStr[]; +extern WXDLLIMPEXP_DATA_CORE(const char) wxFilePickerCtrlNameStr[]; +extern WXDLLIMPEXP_DATA_CORE(const char) wxFileSelectorPromptStr[]; + +extern WXDLLIMPEXP_DATA_CORE(const char) wxDirPickerWidgetLabel[]; +extern WXDLLIMPEXP_DATA_CORE(const char) wxDirPickerWidgetNameStr[]; +extern WXDLLIMPEXP_DATA_CORE(const char) wxDirPickerCtrlNameStr[]; +extern WXDLLIMPEXP_DATA_CORE(const char) wxDirSelectorPromptStr[]; + +// ---------------------------------------------------------------------------- +// wxFileDirPickerEvent: used by wxFilePickerCtrl and wxDirPickerCtrl only +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFileDirPickerEvent : public wxCommandEvent +{ +public: + wxFileDirPickerEvent() {} + wxFileDirPickerEvent(wxEventType type, wxObject *generator, int id, const wxString &path) + : wxCommandEvent(type, id), + m_path(path) + { + SetEventObject(generator); + } + + wxString GetPath() const { return m_path; } + void SetPath(const wxString &p) { m_path = p; } + + // default copy ctor, assignment operator and dtor are ok + virtual wxEvent *Clone() const wxOVERRIDE { return new wxFileDirPickerEvent(*this); } + +private: + wxString m_path; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxFileDirPickerEvent); +}; + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FILEPICKER_CHANGED, wxFileDirPickerEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DIRPICKER_CHANGED, wxFileDirPickerEvent ); + +// ---------------------------------------------------------------------------- +// event types and macros +// ---------------------------------------------------------------------------- + +typedef void (wxEvtHandler::*wxFileDirPickerEventFunction)(wxFileDirPickerEvent&); + +#define wxFileDirPickerEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxFileDirPickerEventFunction, func) + +#define EVT_FILEPICKER_CHANGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_FILEPICKER_CHANGED, id, wxFileDirPickerEventHandler(fn)) +#define EVT_DIRPICKER_CHANGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_DIRPICKER_CHANGED, id, wxFileDirPickerEventHandler(fn)) + +// ---------------------------------------------------------------------------- +// wxFileDirPickerWidgetBase: a generic abstract interface which must be +// implemented by controls used by wxFileDirPickerCtrlBase +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFileDirPickerWidgetBase +{ +public: + wxFileDirPickerWidgetBase() { } + virtual ~wxFileDirPickerWidgetBase() { } + + // Path here is the name of the selected file or directory. + wxString GetPath() const { return m_path; } + virtual void SetPath(const wxString &str) { m_path=str; } + + // Set the directory to open the file browse dialog at initially. + virtual void SetInitialDirectory(const wxString& dir) = 0; + + // returns the picker widget cast to wxControl + virtual wxControl *AsControl() = 0; + +protected: + virtual void UpdateDialogPath(wxDialog *) = 0; + virtual void UpdatePathFromDialog(wxDialog *) = 0; + + wxString m_path; +}; + +// Styles which must be supported by all controls implementing wxFileDirPickerWidgetBase +// NB: these styles must be defined to carefully-chosen values to +// avoid conflicts with wxButton's styles + +#define wxFLP_OPEN 0x0400 +#define wxFLP_SAVE 0x0800 +#define wxFLP_OVERWRITE_PROMPT 0x1000 +#define wxFLP_FILE_MUST_EXIST 0x2000 +#define wxFLP_CHANGE_DIR 0x4000 +#define wxFLP_SMALL wxPB_SMALL + +// NOTE: wxMULTIPLE is not supported ! + + +#define wxDIRP_DIR_MUST_EXIST 0x0008 +#define wxDIRP_CHANGE_DIR 0x0010 +#define wxDIRP_SMALL wxPB_SMALL + + +// map platform-dependent controls which implement the wxFileDirPickerWidgetBase +// under the name "wxFilePickerWidget" and "wxDirPickerWidget". +// NOTE: wxFileDirPickerCtrlBase will allocate a wx{File|Dir}PickerWidget and this +// requires that all classes being mapped as wx{File|Dir}PickerWidget have the +// same prototype for the constructor... +// since GTK >= 2.6, there is GtkFileButton +#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) + #include "wx/gtk/filepicker.h" + #define wxFilePickerWidget wxFileButton + #define wxDirPickerWidget wxDirButton +#else + #include "wx/generic/filepickerg.h" + #define wxFilePickerWidget wxGenericFileButton + #define wxDirPickerWidget wxGenericDirButton +#endif + + + +// ---------------------------------------------------------------------------- +// wxFileDirPickerCtrlBase +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFileDirPickerCtrlBase : public wxPickerBase +{ +public: + wxFileDirPickerCtrlBase() {} + +protected: + // NB: no default values since this function will never be used + // directly by the user and derived classes wouldn't use them + bool CreateBase(wxWindow *parent, + wxWindowID id, + const wxString& path, + const wxString &message, + const wxString &wildcard, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name); + +public: // public API + + wxString GetPath() const; + void SetPath(const wxString &str); + + // Set the directory to open the file browse dialog at initially. + void SetInitialDirectory(const wxString& dir) + { + m_pickerIface->SetInitialDirectory(dir); + } + +public: // internal functions + + void UpdatePickerFromTextCtrl() wxOVERRIDE; + void UpdateTextCtrlFromPicker() wxOVERRIDE; + + // event handler for our picker + void OnFileDirChange(wxFileDirPickerEvent &); + + // TRUE if any textctrl change should update the current working directory + virtual bool IsCwdToUpdate() const = 0; + + // Returns the event type sent by this picker + virtual wxEventType GetEventType() const = 0; + + virtual void DoConnect( wxControl *sender, wxFileDirPickerCtrlBase *eventSink ) = 0; + + // Returns the filtered value currently placed in the text control (if present). + virtual wxString GetTextCtrlValue() const = 0; + +protected: + // creates the picker control + virtual + wxFileDirPickerWidgetBase *CreatePicker(wxWindow *parent, + const wxString& path, + const wxString& message, + const wxString& wildcard) = 0; + +protected: + + // m_picker object as wxFileDirPickerWidgetBase interface + wxFileDirPickerWidgetBase *m_pickerIface; +}; + +#endif // wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL + + +#if wxUSE_FILEPICKERCTRL + +// ---------------------------------------------------------------------------- +// wxFilePickerCtrl: platform-independent class which embeds the +// platform-dependent wxFilePickerWidget and, if wxFLP_USE_TEXTCTRL style is +// used, a textctrl next to it. +// ---------------------------------------------------------------------------- + +#define wxFLP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL) + +#ifdef __WXGTK__ + // GTK apps usually don't have a textctrl next to the picker + #define wxFLP_DEFAULT_STYLE (wxFLP_OPEN|wxFLP_FILE_MUST_EXIST) +#else + #define wxFLP_DEFAULT_STYLE (wxFLP_USE_TEXTCTRL|wxFLP_OPEN|wxFLP_FILE_MUST_EXIST) +#endif + +class WXDLLIMPEXP_CORE wxFilePickerCtrl : public wxFileDirPickerCtrlBase +{ +public: + wxFilePickerCtrl() {} + + wxFilePickerCtrl(wxWindow *parent, + wxWindowID id, + const wxString& path = wxEmptyString, + const wxString& message = wxASCII_STR(wxFileSelectorPromptStr), + const wxString& wildcard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxFLP_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxFilePickerCtrlNameStr)) + { + Create(parent, id, path, message, wildcard, pos, size, style, + validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& path = wxEmptyString, + const wxString& message = wxASCII_STR(wxFileSelectorPromptStr), + const wxString& wildcard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxFLP_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxFilePickerCtrlNameStr)); + + void SetFileName(const wxFileName &filename) + { SetPath(filename.GetFullPath()); } + + wxFileName GetFileName() const + { return wxFileName(GetPath()); } + +public: // overrides + + // return the text control value in canonical form + wxString GetTextCtrlValue() const wxOVERRIDE; + + bool IsCwdToUpdate() const wxOVERRIDE + { return HasFlag(wxFLP_CHANGE_DIR); } + + wxEventType GetEventType() const wxOVERRIDE + { return wxEVT_FILEPICKER_CHANGED; } + + virtual void DoConnect( wxControl *sender, wxFileDirPickerCtrlBase *eventSink ) wxOVERRIDE + { + sender->Bind(wxEVT_FILEPICKER_CHANGED, + &wxFileDirPickerCtrlBase::OnFileDirChange, eventSink ); + } + + +protected: + virtual + wxFileDirPickerWidgetBase *CreatePicker(wxWindow *parent, + const wxString& path, + const wxString& message, + const wxString& wildcard) wxOVERRIDE + { + return new wxFilePickerWidget(parent, wxID_ANY, + wxGetTranslation(wxFilePickerWidgetLabel), + path, message, wildcard, + wxDefaultPosition, wxDefaultSize, + GetPickerStyle(GetWindowStyle())); + } + + // extracts the style for our picker from wxFileDirPickerCtrlBase's style + long GetPickerStyle(long style) const wxOVERRIDE + { + return style & (wxFLP_OPEN | + wxFLP_SAVE | + wxFLP_OVERWRITE_PROMPT | + wxFLP_FILE_MUST_EXIST | + wxFLP_CHANGE_DIR | + wxFLP_USE_TEXTCTRL | + wxFLP_SMALL); + } + +private: + wxDECLARE_DYNAMIC_CLASS(wxFilePickerCtrl); +}; + +#endif // wxUSE_FILEPICKERCTRL + + +#if wxUSE_DIRPICKERCTRL + +// ---------------------------------------------------------------------------- +// wxDirPickerCtrl: platform-independent class which embeds the +// platform-dependent wxDirPickerWidget and eventually a textctrl +// (see wxDIRP_USE_TEXTCTRL) next to it. +// ---------------------------------------------------------------------------- + +#define wxDIRP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL) + +#ifdef __WXGTK__ + // GTK apps usually don't have a textctrl next to the picker + #define wxDIRP_DEFAULT_STYLE (wxDIRP_DIR_MUST_EXIST) +#else + #define wxDIRP_DEFAULT_STYLE (wxDIRP_USE_TEXTCTRL|wxDIRP_DIR_MUST_EXIST) +#endif + +class WXDLLIMPEXP_CORE wxDirPickerCtrl : public wxFileDirPickerCtrlBase +{ +public: + wxDirPickerCtrl() {} + + wxDirPickerCtrl(wxWindow *parent, wxWindowID id, + const wxString& path = wxEmptyString, + const wxString& message = wxASCII_STR(wxDirSelectorPromptStr), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDIRP_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxDirPickerCtrlNameStr)) + { + Create(parent, id, path, message, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& path = wxEmptyString, + const wxString& message = wxASCII_STR(wxDirSelectorPromptStr), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDIRP_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxDirPickerCtrlNameStr)); + + void SetDirName(const wxFileName &dirname) + { SetPath(dirname.GetPath()); } + + wxFileName GetDirName() const + { return wxFileName::DirName(GetPath()); } + +public: // overrides + + wxString GetTextCtrlValue() const wxOVERRIDE; + + bool IsCwdToUpdate() const wxOVERRIDE + { return HasFlag(wxDIRP_CHANGE_DIR); } + + wxEventType GetEventType() const wxOVERRIDE + { return wxEVT_DIRPICKER_CHANGED; } + + virtual void DoConnect( wxControl *sender, wxFileDirPickerCtrlBase *eventSink ) wxOVERRIDE + { + sender->Bind( wxEVT_DIRPICKER_CHANGED, + &wxFileDirPickerCtrlBase::OnFileDirChange, eventSink ); + } + + +protected: + virtual + wxFileDirPickerWidgetBase *CreatePicker(wxWindow *parent, + const wxString& path, + const wxString& message, + const wxString& WXUNUSED(wildcard)) wxOVERRIDE + { + return new wxDirPickerWidget(parent, wxID_ANY, + wxGetTranslation(wxDirPickerWidgetLabel), + path, message, + wxDefaultPosition, wxDefaultSize, + GetPickerStyle(GetWindowStyle())); + } + + // extracts the style for our picker from wxFileDirPickerCtrlBase's style + long GetPickerStyle(long style) const wxOVERRIDE + { + return style & (wxDIRP_DIR_MUST_EXIST | + wxDIRP_CHANGE_DIR | + wxDIRP_USE_TEXTCTRL | + wxDIRP_SMALL); + } + +private: + wxDECLARE_DYNAMIC_CLASS(wxDirPickerCtrl); +}; + +#endif // wxUSE_DIRPICKERCTRL + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_FILEPICKER_CHANGED wxEVT_FILEPICKER_CHANGED +#define wxEVT_COMMAND_DIRPICKER_CHANGED wxEVT_DIRPICKER_CHANGED + +#endif // _WX_FILEDIRPICKER_H_BASE_ + diff --git a/lib/wxWidgets/include/wx/filesys.h b/lib/wxWidgets/include/wx/filesys.h new file mode 100644 index 0000000..c16af49 --- /dev/null +++ b/lib/wxWidgets/include/wx/filesys.h @@ -0,0 +1,306 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/filesys.h +// Purpose: class for opening files - virtual file system +// Author: Vaclav Slavik +// Copyright: (c) 1999 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __FILESYS_H__ +#define __FILESYS_H__ + +#include "wx/defs.h" + +#if wxUSE_FILESYSTEM + +#include "wx/stream.h" +#include "wx/datetime.h" +#include "wx/filename.h" +#include "wx/hashmap.h" + +class WXDLLIMPEXP_FWD_BASE wxFSFile; +class WXDLLIMPEXP_FWD_BASE wxFileSystemHandler; +class WXDLLIMPEXP_FWD_BASE wxFileSystem; + +//-------------------------------------------------------------------------------- +// wxFSFile +// This class is a file opened using wxFileSystem. It consists of +// input stream, location, mime type & optional anchor +// (in 'index.htm#chapter2', 'chapter2' is anchor) +//-------------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFSFile : public wxObject +{ +public: + wxFSFile(wxInputStream *stream, const wxString& loc, + const wxString& mimetype, const wxString& anchor +#if wxUSE_DATETIME + , wxDateTime modif +#endif // wxUSE_DATETIME + ) + : m_Location(loc) + , m_MimeType(mimetype.Lower()) + , m_Anchor(anchor) +#if wxUSE_DATETIME + , m_Modif(modif) +#endif + { + m_Stream = stream; + } + + virtual ~wxFSFile() { delete m_Stream; } + + // returns stream. This doesn't give away ownership of the stream object. + wxInputStream *GetStream() const { return m_Stream; } + + // gives away the ownership of the current stream. + wxInputStream *DetachStream() + { + wxInputStream *stream = m_Stream; + m_Stream = NULL; + return stream; + } + + // deletes the current stream and takes ownership of another. + void SetStream(wxInputStream *stream) + { + delete m_Stream; + m_Stream = stream; + } + + // returns file's mime type + const wxString& GetMimeType() const; + + // returns the original location (aka filename) of the file + const wxString& GetLocation() const { return m_Location; } + + const wxString& GetAnchor() const { return m_Anchor; } + +#if wxUSE_DATETIME + wxDateTime GetModificationTime() const { return m_Modif; } +#endif // wxUSE_DATETIME + +private: + wxInputStream *m_Stream; + wxString m_Location; + wxString m_MimeType; + wxString m_Anchor; +#if wxUSE_DATETIME + wxDateTime m_Modif; +#endif // wxUSE_DATETIME + + wxDECLARE_ABSTRACT_CLASS(wxFSFile); + wxDECLARE_NO_COPY_CLASS(wxFSFile); +}; + + + + + +//-------------------------------------------------------------------------------- +// wxFileSystemHandler +// This class is FS handler for wxFileSystem. It provides +// interface to access certain +// kinds of files (HTPP, FTP, local, tar.gz etc..) +//-------------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFileSystemHandler : public wxObject +{ +public: + wxFileSystemHandler() : wxObject() {} + + // returns true if this handler is able to open given location + virtual bool CanOpen(const wxString& location) = 0; + + // opens given file and returns pointer to input stream. + // Returns NULL if opening failed. + // The location is always absolute path. + virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) = 0; + + // Finds first/next file that matches spec wildcard. flags can be wxDIR for restricting + // the query to directories or wxFILE for files only or 0 for either. + // Returns filename or empty string if no more matching file exists + virtual wxString FindFirst(const wxString& spec, int flags = 0); + virtual wxString FindNext(); + + // Returns MIME type of the file - w/o need to open it + // (default behaviour is that it returns type based on extension) + static wxString GetMimeTypeFromExt(const wxString& location); + +protected: + // returns protocol ("file", "http", "tar" etc.) The last (most right) + // protocol is used: + // {it returns "tar" for "file:subdir/archive.tar.gz#tar:/README.txt"} + static wxString GetProtocol(const wxString& location); + + // returns left part of address: + // {it returns "file:subdir/archive.tar.gz" for "file:subdir/archive.tar.gz#tar:/README.txt"} + static wxString GetLeftLocation(const wxString& location); + + // returns anchor part of address: + // {it returns "anchor" for "file:subdir/archive.tar.gz#tar:/README.txt#anchor"} + // NOTE: anchor is NOT a part of GetLeftLocation()'s return value + static wxString GetAnchor(const wxString& location); + + // returns right part of address: + // {it returns "/README.txt" for "file:subdir/archive.tar.gz#tar:/README.txt"} + static wxString GetRightLocation(const wxString& location); + + wxDECLARE_ABSTRACT_CLASS(wxFileSystemHandler); +}; + + + + +//-------------------------------------------------------------------------------- +// wxFileSystem +// This class provides simple interface for opening various +// kinds of files (HTPP, FTP, local, tar.gz etc..) +//-------------------------------------------------------------------------------- + +// Open Bit Flags +enum wxFileSystemOpenFlags +{ + wxFS_READ = 1, // Open for reading + wxFS_SEEKABLE = 4 // Returned stream will be seekable +}; + +WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL(wxFileSystemHandler*, wxFSHandlerHash, class WXDLLIMPEXP_BASE); + +class WXDLLIMPEXP_BASE wxFileSystem : public wxObject +{ +public: + wxFileSystem() : wxObject() { m_FindFileHandler = NULL;} + virtual ~wxFileSystem(); + + // sets the current location. Every call to OpenFile is + // relative to this location. + // NOTE !! + // unless is_dir = true 'location' is *not* the directory but + // file contained in this directory + // (so ChangePathTo("dir/subdir/xh.htm") sets m_Path to "dir/subdir/") + void ChangePathTo(const wxString& location, bool is_dir = false); + + wxString GetPath() const {return m_Path;} + + // opens given file and returns pointer to input stream. + // Returns NULL if opening failed. + // It first tries to open the file in relative scope + // (based on ChangePathTo()'s value) and then as an absolute + // path. + wxFSFile* OpenFile(const wxString& location, int flags = wxFS_READ); + + // Finds first/next file that matches spec wildcard. flags can be wxDIR for restricting + // the query to directories or wxFILE for files only or 0 for either. + // Returns filename or empty string if no more matching file exists + wxString FindFirst(const wxString& spec, int flags = 0); + wxString FindNext(); + + // find a file in a list of directories, returns false if not found + bool FindFileInPath(wxString *pStr, + const wxString& path, const wxString& file); + + // Adds FS handler. + // In fact, this class is only front-end to the FS handlers :-) + static void AddHandler(wxFileSystemHandler *handler); + + // Removes FS handler + static wxFileSystemHandler* RemoveHandler(wxFileSystemHandler *handler); + + // Returns true if there is a handler which can open the given location. + static bool HasHandlerForPath(const wxString& location); + + // remove all items from the m_Handlers list + static void CleanUpHandlers(); + + // Returns the native path for a file URL + static wxFileName URLToFileName(const wxString& url); + + // Returns the file URL for a native path + static wxString FileNameToURL(const wxFileName& filename); + + +protected: + wxFileSystemHandler *MakeLocal(wxFileSystemHandler *h); + + wxString m_Path; + // the path (location) we are currently in + // this is path, not file! + // (so if you opened test/demo.htm, it is + // "test/", not "test/demo.htm") + wxString m_LastName; + // name of last opened file (full path) + static wxList m_Handlers; + // list of FS handlers + wxFileSystemHandler *m_FindFileHandler; + // handler that succeed in FindFirst query + wxFSHandlerHash m_LocalHandlers; + // Handlers local to this instance + + wxDECLARE_DYNAMIC_CLASS(wxFileSystem); + wxDECLARE_NO_COPY_CLASS(wxFileSystem); +}; + + +/* + +'location' syntax: + +To determine FS type, we're using standard KDE notation: +file:/absolute/path/file.htm +file:relative_path/xxxxx.html +/some/path/x.file ('file:' is default) +http://www.gnome.org +file:subdir/archive.tar.gz#tar:/README.txt + +special characters : + ':' - FS identificator is before this char + '#' - separator. It can be either HTML anchor ("index.html#news") + (in case there is no ':' in the string to the right from it) + or FS separator + (example : http://www.wxhtml.org/wxhtml-0.1.tar.gz#tar:/include/wxhtml/filesys.h" + this would access tgz archive stored on web) + '/' - directory (path) separator. It is used to determine upper-level path. + HEY! Don't use \ even if you're on Windows! + +*/ + + +class WXDLLIMPEXP_BASE wxLocalFSHandler : public wxFileSystemHandler +{ +public: + virtual bool CanOpen(const wxString& location) wxOVERRIDE; + virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) wxOVERRIDE; + virtual wxString FindFirst(const wxString& spec, int flags = 0) wxOVERRIDE; + virtual wxString FindNext() wxOVERRIDE; + + // wxLocalFSHandler will prefix all filenames with 'root' before accessing + // files on disk. This effectively makes 'root' the top-level directory + // and prevents access to files outside this directory. + // (This is similar to Unix command 'chroot'.) + static void Chroot(const wxString& root) { ms_root = root; } + +protected: + static wxString ms_root; +}; + +// Stream reading data from wxFSFile: this allows to use virtual files with any +// wx functions accepting streams. +class WXDLLIMPEXP_BASE wxFSInputStream : public wxWrapperInputStream +{ +public: + // Notice that wxFS_READ is implied in flags. + wxFSInputStream(const wxString& filename, int flags = 0); + virtual ~wxFSInputStream(); + +private: + wxFSFile* m_file; + + wxDECLARE_NO_COPY_CLASS(wxFSInputStream); +}; + +#endif + // wxUSE_FILESYSTEM + +#endif + // __FILESYS_H__ diff --git a/lib/wxWidgets/include/wx/flags.h b/lib/wxWidgets/include/wx/flags.h new file mode 100644 index 0000000..c45bafa --- /dev/null +++ b/lib/wxWidgets/include/wx/flags.h @@ -0,0 +1,176 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/flags.h +// Purpose: a bitset suited for replacing the current style flags +// Author: Stefan Csomor +// Modified by: +// Created: 27/07/03 +// Copyright: (c) 2003 Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SETH__ +#define _WX_SETH__ + +// wxBitset should be applied to an enum, then this can be used like +// bitwise operators but keeps the type safety and information, the +// enums must be in a sequence , their value determines the bit position +// that they represent +// The api is made as close as possible to + +template class wxBitset +{ + friend class wxEnumData ; +public: + // creates a wxBitset<> object with all flags initialized to 0 + wxBitset() { m_data = 0; } + + // created a wxBitset<> object initialized according to the bits of the + // integral value val + wxBitset(unsigned long val) { m_data = val ; } + + // copies the content in the new wxBitset<> object from another one + wxBitset(const wxBitset &src) { m_data = src.m_data; } + + // creates a wxBitset<> object that has the specific flag set + wxBitset(const T el) { m_data |= 1 << el; } + + // returns the integral value that the bits of this object represent + unsigned long to_ulong() const { return m_data ; } + + // assignment + wxBitset &operator =(const wxBitset &rhs) + { + m_data = rhs.m_data; + return *this; + } + + // bitwise or operator, sets all bits that are in rhs and leaves + // the rest unchanged + wxBitset &operator |=(const wxBitset &rhs) + { + m_data |= rhs.m_data; + return *this; + } + + // bitwsie exclusive-or operator, toggles the value of all bits + // that are set in bits and leaves all others unchanged + wxBitset &operator ^=(const wxBitset &rhs) // difference + { + m_data ^= rhs.m_data; + return *this; + } + + // bitwise and operator, resets all bits that are not in rhs and leaves + // all others unchanged + wxBitset &operator &=(const wxBitset &rhs) // intersection + { + m_data &= rhs.m_data; + return *this; + } + + // bitwise or operator, returns a new bitset that has all bits set that set are in + // bitset2 or in this bitset + wxBitset operator |(const wxBitset &bitset2) const // union + { + wxBitset s; + s.m_data = m_data | bitset2.m_data; + return s; + } + + // bitwise exclusive-or operator, returns a new bitset that has all bits set that are set either in + // bitset2 or in this bitset but not in both + wxBitset operator ^(const wxBitset &bitset2) const // difference + { + wxBitset s; + s.m_data = m_data ^ bitset2.m_data; + return s; + } + + // bitwise and operator, returns a new bitset that has all bits set that are set both in + // bitset2 and in this bitset + wxBitset operator &(const wxBitset &bitset2) const // intersection + { + wxBitset s; + s.m_data = m_data & bitset2.m_data; + return s; + } + + // sets appropriate the bit to true + wxBitset& set(const T el) //Add element + { + m_data |= 1 << el; + return *this; + } + + // clears the appropriate flag to false + wxBitset& reset(const T el) //remove element + { + m_data &= ~(1 << el); + return *this; + } + + // clear all flags + wxBitset& reset() + { + m_data = 0; + return *this; + } + + // true if this flag is set + bool test(const T el) const + { + return (m_data & (1 << el)) ? true : false; + } + + // true if no flag is set + bool none() const + { + return m_data == 0; + } + + // true if any flag is set + bool any() const + { + return m_data != 0; + } + + // true if both have the same flags + bool operator ==(const wxBitset &rhs) const + { + return m_data == rhs.m_data; + } + + // true if both differ in their flags set + bool operator !=(const wxBitset &rhs) const + { + return !operator==(rhs); + } + + bool operator[] (const T el) const { return test(el) ; } + +private : + unsigned long m_data; +}; + +#if wxUSE_EXTENDED_RTTI + +#define wxDEFINE_FLAGS( flags ) \ + class WXDLLIMPEXP_BASE flags \ + {\ + public : \ + flags(long data=0) :m_data(data) {} \ + long m_data ;\ + bool operator ==(const flags &rhs) const { return m_data == rhs.m_data; }\ + } ; + +#else + +#define wxDEFINE_FLAGS( flags ) + +#endif + +#if WXWIN_COMPATIBILITY_2_8 + #define WX_DEFINE_FLAGS wxDEFINE_FLAGS +#endif + +#endif diff --git a/lib/wxWidgets/include/wx/fmappriv.h b/lib/wxWidgets/include/wx/fmappriv.h new file mode 100644 index 0000000..6637088 --- /dev/null +++ b/lib/wxWidgets/include/wx/fmappriv.h @@ -0,0 +1,73 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/fmappriv.h +// Purpose: private wxFontMapper stuff, not to be used by the library users +// Author: Vadim Zeitlin +// Modified by: +// Created: 21.06.2003 (extracted from common/fontmap.cpp) +// Copyright: (c) 1999-2003 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FMAPPRIV_H_ +#define _WX_FMAPPRIV_H_ + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// a special pseudo encoding which means "don't ask me about this charset +// any more" -- we need it to avoid driving the user crazy with asking him +// time after time about the same charset which he [presumably] doesn't +// have the fonts for +enum { wxFONTENCODING_UNKNOWN = -2 }; + +// the config paths we use +#if wxUSE_CONFIG + +#define FONTMAPPER_ROOT_PATH wxT("/wxWindows/FontMapper") +#define FONTMAPPER_CHARSET_PATH wxT("Charsets") +#define FONTMAPPER_CHARSET_ALIAS_PATH wxT("Aliases") + +#endif // wxUSE_CONFIG + +// ---------------------------------------------------------------------------- +// wxFontMapperPathChanger: change the config path during our lifetime +// ---------------------------------------------------------------------------- + +#if wxUSE_CONFIG && wxUSE_FILECONFIG + +class wxFontMapperPathChanger +{ +public: + wxFontMapperPathChanger(wxFontMapperBase *fontMapper, const wxString& path) + { + m_fontMapper = fontMapper; + m_ok = m_fontMapper->ChangePath(path, &m_pathOld); + } + + bool IsOk() const { return m_ok; } + + ~wxFontMapperPathChanger() + { + if ( IsOk() ) + m_fontMapper->RestorePath(m_pathOld); + } + +private: + // the fontmapper object we're working with + wxFontMapperBase *m_fontMapper; + + // the old path to be restored if m_ok + wxString m_pathOld; + + // have we changed the path successfully? + bool m_ok; + + + wxDECLARE_NO_COPY_CLASS(wxFontMapperPathChanger); +}; + +#endif // wxUSE_CONFIG + +#endif // _WX_FMAPPRIV_H_ + diff --git a/lib/wxWidgets/include/wx/font.h b/lib/wxWidgets/include/wx/font.h new file mode 100644 index 0000000..23f2cdb --- /dev/null +++ b/lib/wxWidgets/include/wx/font.h @@ -0,0 +1,700 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/font.h +// Purpose: wxFontBase class: the interface of wxFont +// Author: Vadim Zeitlin +// Modified by: +// Created: 20.09.99 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONT_H_BASE_ +#define _WX_FONT_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" // for wxDEFAULT &c +#include "wx/fontenc.h" // the font encoding constants +#include "wx/gdiobj.h" // the base class +#include "wx/gdicmn.h" // for wxGDIObjListBase +#include "wx/math.h" // for wxRound() + +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxFont; + +// ---------------------------------------------------------------------------- +// font constants +// ---------------------------------------------------------------------------- + +// standard font families: these may be used only for the font creation, it +// doesn't make sense to query an existing font for its font family as, +// especially if the font had been created from a native font description, it +// may be unknown +enum wxFontFamily +{ + wxFONTFAMILY_DEFAULT = wxDEFAULT, + wxFONTFAMILY_DECORATIVE = wxDECORATIVE, + wxFONTFAMILY_ROMAN = wxROMAN, + wxFONTFAMILY_SCRIPT = wxSCRIPT, + wxFONTFAMILY_SWISS = wxSWISS, + wxFONTFAMILY_MODERN = wxMODERN, + wxFONTFAMILY_TELETYPE = wxTELETYPE, + wxFONTFAMILY_MAX, + wxFONTFAMILY_UNKNOWN = wxFONTFAMILY_MAX +}; + +// font styles +enum wxFontStyle +{ + wxFONTSTYLE_NORMAL = wxNORMAL, + wxFONTSTYLE_ITALIC = wxITALIC, + wxFONTSTYLE_SLANT = wxSLANT, + wxFONTSTYLE_MAX +}; + +// font weights +enum wxFontWeight +{ + wxFONTWEIGHT_INVALID = 0, + wxFONTWEIGHT_THIN = 100, + wxFONTWEIGHT_EXTRALIGHT = 200, + wxFONTWEIGHT_LIGHT = 300, + wxFONTWEIGHT_NORMAL = 400, + wxFONTWEIGHT_MEDIUM = 500, + wxFONTWEIGHT_SEMIBOLD = 600, + wxFONTWEIGHT_BOLD = 700, + wxFONTWEIGHT_EXTRABOLD = 800, + wxFONTWEIGHT_HEAVY = 900, + wxFONTWEIGHT_EXTRAHEAVY = 1000, + wxFONTWEIGHT_MAX = wxFONTWEIGHT_EXTRAHEAVY +}; + +// Symbolic font sizes as defined in CSS specification. +enum wxFontSymbolicSize +{ + wxFONTSIZE_XX_SMALL = -3, + wxFONTSIZE_X_SMALL, + wxFONTSIZE_SMALL, + wxFONTSIZE_MEDIUM, + wxFONTSIZE_LARGE, + wxFONTSIZE_X_LARGE, + wxFONTSIZE_XX_LARGE +}; + +// the font flag bits for the new font ctor accepting one combined flags word +enum wxFontFlag +{ + // no special flags: font with default weight/slant/anti-aliasing + wxFONTFLAG_DEFAULT = 0, + + // slant flags (default: no slant) + wxFONTFLAG_ITALIC = 1 << 0, + wxFONTFLAG_SLANT = 1 << 1, + + // weight flags (default: medium): + wxFONTFLAG_LIGHT = 1 << 2, + wxFONTFLAG_BOLD = 1 << 3, + + // anti-aliasing flag: force on or off (default: the current system default) + wxFONTFLAG_ANTIALIASED = 1 << 4, + wxFONTFLAG_NOT_ANTIALIASED = 1 << 5, + + // underlined/strikethrough flags (default: no lines) + wxFONTFLAG_UNDERLINED = 1 << 6, + wxFONTFLAG_STRIKETHROUGH = 1 << 7, + + // the mask of all currently used flags + wxFONTFLAG_MASK = wxFONTFLAG_ITALIC | + wxFONTFLAG_SLANT | + wxFONTFLAG_LIGHT | + wxFONTFLAG_BOLD | + wxFONTFLAG_ANTIALIASED | + wxFONTFLAG_NOT_ANTIALIASED | + wxFONTFLAG_UNDERLINED | + wxFONTFLAG_STRIKETHROUGH +}; + +// ---------------------------------------------------------------------------- +// wxFontInfo describes a wxFont +// ---------------------------------------------------------------------------- + +class wxFontInfo +{ +public: + // Default ctor uses the default font size appropriate for the current + // platform. + wxFontInfo() + : m_pointSize(-1.0) + , m_pixelSize(wxDefaultSize) + { + Init(); + } + + // These ctors specify the font size, either in points or in pixels. + explicit wxFontInfo(double pointSize) + : m_pointSize(pointSize >= 0.0 ? pointSize : -1.0) + , m_pixelSize(wxDefaultSize) + { + Init(); + if (!wxIsSameDouble(m_pointSize, pointSize)) + { + wxFAIL_MSG("Invalid font point size"); + } + } + explicit wxFontInfo(const wxSize& pixelSize) + : m_pointSize(-1.0) + , m_pixelSize(pixelSize) + { + Init(); + } + // Default copy ctor, assignment operator and dtor are OK + + // Setters for the various attributes. All of them return the object itself + // so that the calls to them could be chained. + wxFontInfo& Family(wxFontFamily family) + { m_family = family; return *this; } + wxFontInfo& FaceName(const wxString& faceName) + { m_faceName = faceName; return *this; } + + wxFontInfo& Weight(int weight) + { m_weight = weight; return *this; } + wxFontInfo& Bold(bool bold = true) + { return Weight(bold ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL); } + wxFontInfo& Light(bool light = true) + { return Weight(light ? wxFONTWEIGHT_LIGHT : wxFONTWEIGHT_NORMAL); } + + wxFontInfo& Italic(bool italic = true) + { SetFlag(wxFONTFLAG_ITALIC, italic); return *this; } + wxFontInfo& Slant(bool slant = true) + { SetFlag(wxFONTFLAG_SLANT, slant); return *this; } + wxFontInfo& Style(wxFontStyle style) + { + if ( style == wxFONTSTYLE_ITALIC ) + return Italic(); + + if ( style == wxFONTSTYLE_SLANT ) + return Slant(); + + return *this; + } + + wxFontInfo& AntiAliased(bool antiAliased = true) + { SetFlag(wxFONTFLAG_ANTIALIASED, antiAliased); return *this; } + wxFontInfo& Underlined(bool underlined = true) + { SetFlag(wxFONTFLAG_UNDERLINED, underlined); return *this; } + wxFontInfo& Strikethrough(bool strikethrough = true) + { SetFlag(wxFONTFLAG_STRIKETHROUGH, strikethrough); return *this; } + + wxFontInfo& Encoding(wxFontEncoding encoding) + { m_encoding = encoding; return *this; } + + // Set all flags at once. + wxFontInfo& AllFlags(int flags) + { + m_flags = flags; + + m_weight = m_flags & wxFONTFLAG_BOLD + ? wxFONTWEIGHT_BOLD + : m_flags & wxFONTFLAG_LIGHT + ? wxFONTWEIGHT_LIGHT + : wxFONTWEIGHT_NORMAL; + + return *this; + } + + // Accessors are mostly meant to be used by wxFont itself to extract the + // various pieces of the font description. + + bool IsUsingSizeInPixels() const { return m_pixelSize != wxDefaultSize; } + double GetFractionalPointSize() const { return m_pointSize; } + int GetPointSize() const { return wxRound(m_pointSize); } + wxSize GetPixelSize() const { return m_pixelSize; } + + // If face name is not empty, it has priority, otherwise use family. + bool HasFaceName() const { return !m_faceName.empty(); } + wxFontFamily GetFamily() const { return m_family; } + const wxString& GetFaceName() const { return m_faceName; } + + wxFontStyle GetStyle() const + { + return m_flags & wxFONTFLAG_ITALIC + ? wxFONTSTYLE_ITALIC + : m_flags & wxFONTFLAG_SLANT + ? wxFONTSTYLE_SLANT + : wxFONTSTYLE_NORMAL; + } + + int GetNumericWeight() const + { + return m_weight; + } + + wxFontWeight GetWeight() const + { + return GetWeightClosestToNumericValue(m_weight); + } + + bool IsAntiAliased() const + { + return (m_flags & wxFONTFLAG_ANTIALIASED) != 0; + } + + bool IsUnderlined() const + { + return (m_flags & wxFONTFLAG_UNDERLINED) != 0; + } + + bool IsStrikethrough() const + { + return (m_flags & wxFONTFLAG_STRIKETHROUGH) != 0; + } + + wxFontEncoding GetEncoding() const { return m_encoding; } + + // Another helper for converting arbitrary numeric weight to the closest + // value of wxFontWeight enum. It should be avoided in the new code (also + // note that the function for the conversion in the other direction is + // trivial and so is not provided, we only have GetNumericWeightOf() which + // contains backwards compatibility hacks, but we don't need it here). + static wxFontWeight GetWeightClosestToNumericValue(int numWeight) + { + wxASSERT(numWeight > 0); + wxASSERT(numWeight <= 1000); + + // round to nearest hundredth = wxFONTWEIGHT_ constant + int weight = ((numWeight + 50) / 100) * 100; + + if (weight < wxFONTWEIGHT_THIN) + weight = wxFONTWEIGHT_THIN; + if (weight > wxFONTWEIGHT_MAX) + weight = wxFONTWEIGHT_MAX; + + return static_cast(weight); + } + +private: + void Init() + { + m_family = wxFONTFAMILY_DEFAULT; + m_flags = wxFONTFLAG_DEFAULT; + m_weight = wxFONTWEIGHT_NORMAL; + m_encoding = wxFONTENCODING_DEFAULT; + } + + // Turn on or off the given bit in m_flags depending on the value of the + // boolean argument. + void SetFlag(int flag, bool on) + { + if ( on ) + m_flags |= flag; + else + m_flags &= ~flag; + } + + // The size information: if m_pixelSize is valid (!= wxDefaultSize), then + // it is used. Otherwise m_pointSize is used, except if it is < 0, which + // means that the platform dependent font size should be used instead. + double m_pointSize; + wxSize m_pixelSize; + + wxFontFamily m_family; + wxString m_faceName; + int m_flags; + int m_weight; + wxFontEncoding m_encoding; +}; + +// ---------------------------------------------------------------------------- +// wxFontBase represents a font object +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxNativeFontInfo; + +class WXDLLIMPEXP_CORE wxFontBase : public wxGDIObject +{ +public: + /* + derived classes should provide the following ctors: + + wxFont(); + wxFont(const wxFontInfo& info); + wxFont(const wxString& nativeFontInfoString); + wxFont(const wxNativeFontInfo& info); + wxFont(int size, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + wxFont(const wxSize& pixelSize, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + */ + + wxDECLARE_DEFAULT_COPY_AND_DEF(wxFontBase) + + virtual ~wxFontBase(); + + + // from the font components + static wxFont *New( + int pointSize, // size of the font in points + wxFontFamily family, // see wxFontFamily enum + wxFontStyle style, // see wxFontStyle enum + wxFontWeight weight, // see wxFontWeight enum + bool underlined = false, // not underlined by default + const wxString& face = wxEmptyString, // facename + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); // ISO8859-X, ... + + // from the font components + static wxFont *New( + const wxSize& pixelSize, // size of the font in pixels + wxFontFamily family, // see wxFontFamily enum + wxFontStyle style, // see wxFontStyle enum + wxFontWeight weight, // see wxFontWeight enum + bool underlined = false, // not underlined by default + const wxString& face = wxEmptyString, // facename + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); // ISO8859-X, ... + + // from the font components but using the font flags instead of separate + // parameters for each flag + static wxFont *New(int pointSize, + wxFontFamily family, + int flags = wxFONTFLAG_DEFAULT, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + + + // from the font components but using the font flags instead of separate + // parameters for each flag + static wxFont *New(const wxSize& pixelSize, + wxFontFamily family, + int flags = wxFONTFLAG_DEFAULT, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + + // from the (opaque) native font description object + static wxFont *New(const wxNativeFontInfo& nativeFontDesc); + + // from the string representation of wxNativeFontInfo + static wxFont *New(const wxString& strNativeFontDesc); + + // Load the font from the given file and return true on success or false on + // error (an error message will be logged in this case). +#if wxUSE_PRIVATE_FONTS + static bool AddPrivateFont(const wxString& filename); +#endif // wxUSE_PRIVATE_FONTS + + // comparison + bool operator==(const wxFontBase& font) const; + bool operator!=(const wxFontBase& font) const { return !(*this == font); } + + // accessors: get the font characteristics + virtual int GetPointSize() const; + virtual double GetFractionalPointSize() const = 0; + virtual wxSize GetPixelSize() const; + virtual bool IsUsingSizeInPixels() const; + wxFontFamily GetFamily() const; + virtual wxFontStyle GetStyle() const = 0; + virtual int GetNumericWeight() const = 0; + virtual bool GetUnderlined() const = 0; + virtual bool GetStrikethrough() const { return false; } + virtual wxString GetFaceName() const = 0; + virtual wxFontEncoding GetEncoding() const = 0; + virtual const wxNativeFontInfo *GetNativeFontInfo() const = 0; + + // Accessors that can be overridden in the platform-specific code but for + // which we provide a reasonable default implementation in the base class. + virtual wxFontWeight GetWeight() const; + virtual bool IsFixedWidth() const; + + wxString GetNativeFontInfoDesc() const; + wxString GetNativeFontInfoUserDesc() const; + + // change the font characteristics + virtual void SetPointSize( int pointSize ); + virtual void SetFractionalPointSize( double pointSize ) = 0; + virtual void SetPixelSize( const wxSize& pixelSize ); + virtual void SetFamily( wxFontFamily family ) = 0; + virtual void SetStyle( wxFontStyle style ) = 0; + virtual void SetNumericWeight( int weight ) = 0; + + virtual void SetUnderlined( bool underlined ) = 0; + virtual void SetStrikethrough( bool WXUNUSED(strikethrough) ) {} + virtual void SetEncoding(wxFontEncoding encoding) = 0; + virtual bool SetFaceName( const wxString& faceName ); + void SetNativeFontInfo(const wxNativeFontInfo& info) + { DoSetNativeFontInfo(info); } + + // Similarly to the accessors above, the functions in this group have a + // reasonable default implementation in the base class. + virtual void SetWeight( wxFontWeight weight ); + + bool SetNativeFontInfo(const wxString& info); + bool SetNativeFontInfoUserDesc(const wxString& info); + + // Symbolic font sizes support: set the font size to "large" or "very + // small" either absolutely (i.e. compared to the default font size) or + // relatively to the given font size. + void SetSymbolicSize(wxFontSymbolicSize size); + void SetSymbolicSizeRelativeTo(wxFontSymbolicSize size, int base) + { + SetPointSize(AdjustToSymbolicSize(size, base)); + } + + // Adjust the base size in points according to symbolic size. + static int AdjustToSymbolicSize(wxFontSymbolicSize size, int base); + + + // translate the fonts into human-readable string (i.e. GetStyleString() + // will return "wxITALIC" for an italic font, ...) + wxString GetFamilyString() const; + wxString GetStyleString() const; + wxString GetWeightString() const; + + // the default encoding is used for creating all fonts with default + // encoding parameter + static wxFontEncoding GetDefaultEncoding() { return ms_encodingDefault; } + static void SetDefaultEncoding(wxFontEncoding encoding); + + // Account for legacy font weight values: if the argument is one of + // wxNORMAL, wxLIGHT or wxBOLD, return the corresponding wxFONTWEIGHT_XXX + // enum value. Otherwise just return it unchanged. + static int ConvertFromLegacyWeightIfNecessary(int weight); + + // Convert between symbolic and numeric font weights. This function uses + // ConvertFromLegacyWeightIfNecessary(), so takes legacy values into + // account as well. + static int GetNumericWeightOf(wxFontWeight weight); + + // this doesn't do anything and is kept for compatibility only +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED_INLINE(void SetNoAntiAliasing(bool no = true), wxUnusedVar(no);) + wxDEPRECATED_INLINE(bool GetNoAntiAliasing() const, return false;) +#endif // WXWIN_COMPATIBILITY_2_8 + + wxDEPRECATED_MSG("use wxFONTWEIGHT_XXX constants instead of raw values") + void SetWeight(int weight) + { SetWeight(static_cast(weight)); } + + wxDEPRECATED_MSG("use wxFONTWEIGHT_XXX constants instead of wxLIGHT/wxNORMAL/wxBOLD") + void SetWeight(wxDeprecatedGUIConstants weight) + { SetWeight(static_cast(weight)); } + + // from the font components + wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants") + static wxFont *New( + int pointSize, // size of the font in points + int family, // see wxFontFamily enum + int style, // see wxFontStyle enum + int weight, // see wxFontWeight enum + bool underlined = false, // not underlined by default + const wxString& face = wxEmptyString, // facename + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) // ISO8859-X, ... + { return New(pointSize, (wxFontFamily)family, (wxFontStyle)style, + (wxFontWeight)weight, underlined, face, encoding); } + + // from the font components + wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants") + static wxFont *New( + const wxSize& pixelSize, // size of the font in pixels + int family, // see wxFontFamily enum + int style, // see wxFontStyle enum + int weight, // see wxFontWeight enum + bool underlined = false, // not underlined by default + const wxString& face = wxEmptyString, // facename + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) // ISO8859-X, ... + { return New(pixelSize, (wxFontFamily)family, (wxFontStyle)style, + (wxFontWeight)weight, underlined, face, encoding); } + + +protected: + // the function called by both overloads of SetNativeFontInfo() + virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info); + + // The function called by public GetFamily(): it can return + // wxFONTFAMILY_UNKNOWN unlike the public method (see comment there). + virtual wxFontFamily DoGetFamily() const = 0; + + + // Helper functions to recover wxFONTSTYLE/wxFONTWEIGHT and underlined flag + // values from flags containing a combination of wxFONTFLAG_XXX. + static wxFontStyle GetStyleFromFlags(int flags) + { + return flags & wxFONTFLAG_ITALIC + ? wxFONTSTYLE_ITALIC + : flags & wxFONTFLAG_SLANT + ? wxFONTSTYLE_SLANT + : wxFONTSTYLE_NORMAL; + } + + static wxFontWeight GetWeightFromFlags(int flags) + { + return flags & wxFONTFLAG_LIGHT + ? wxFONTWEIGHT_LIGHT + : flags & wxFONTFLAG_BOLD + ? wxFONTWEIGHT_BOLD + : wxFONTWEIGHT_NORMAL; + } + + static bool GetUnderlinedFromFlags(int flags) + { + return (flags & wxFONTFLAG_UNDERLINED) != 0; + } + + static bool GetStrikethroughFromFlags(int flags) + { + return (flags & wxFONTFLAG_STRIKETHROUGH) != 0; + } + + // Create wxFontInfo object from the parameters passed to the legacy wxFont + // ctor/Create() overload. This function implements the compatibility hack + // which interprets wxDEFAULT value of size as meaning -1 and also supports + // specifying wxNORMAL, wxLIGHT and wxBOLD as weight values. + static wxFontInfo InfoFromLegacyParams(int pointSize, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined, + const wxString& face, + wxFontEncoding encoding); + + static wxFontInfo InfoFromLegacyParams(const wxSize& pixelSize, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined, + const wxString& face, + wxFontEncoding encoding); + +private: + // the currently default encoding: by default, it's the default system + // encoding, but may be changed by the application using + // SetDefaultEncoding() to make all subsequent fonts created without + // specifying encoding parameter using this encoding + static wxFontEncoding ms_encodingDefault; +}; + +// wxFontBase <-> wxString utilities, used by wxConfig +WXDLLIMPEXP_CORE wxString wxToString(const wxFontBase& font); +WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxFontBase* font); + + +// this macro must be used in all derived wxFont classes declarations +#define wxDECLARE_COMMON_FONT_METHODS() \ + wxDEPRECATED_MSG("use wxFONTFAMILY_XXX constants") \ + void SetFamily(int family) \ + { SetFamily((wxFontFamily)family); } \ + wxDEPRECATED_MSG("use wxFONTSTYLE_XXX constants") \ + void SetStyle(int style) \ + { SetStyle((wxFontStyle)style); } \ + wxDEPRECATED_MSG("use wxFONTFAMILY_XXX constants") \ + void SetFamily(wxDeprecatedGUIConstants family) \ + { SetFamily((wxFontFamily)family); } \ + wxDEPRECATED_MSG("use wxFONTSTYLE_XXX constants") \ + void SetStyle(wxDeprecatedGUIConstants style) \ + { SetStyle((wxFontStyle)style); } \ + \ + /* functions for modifying font in place */ \ + wxFont& MakeBold(); \ + wxFont& MakeItalic(); \ + wxFont& MakeUnderlined(); \ + wxFont& MakeStrikethrough(); \ + wxFont& MakeLarger() { return Scale(1.2f); } \ + wxFont& MakeSmaller() { return Scale(1/1.2f); } \ + wxFont& Scale(float x); \ + /* functions for creating fonts based on this one */ \ + wxFont Bold() const; \ + wxFont GetBaseFont() const; \ + wxFont Italic() const; \ + wxFont Underlined() const; \ + wxFont Strikethrough() const; \ + wxFont Larger() const { return Scaled(1.2f); } \ + wxFont Smaller() const { return Scaled(1/1.2f); } \ + wxFont Scaled(float x) const + +// include the real class declaration +#if defined(__WXMSW__) + #include "wx/msw/font.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/font.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/font.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/font.h" +#elif defined(__WXX11__) + #include "wx/x11/font.h" +#elif defined(__WXDFB__) + #include "wx/dfb/font.h" +#elif defined(__WXMAC__) + #include "wx/osx/font.h" +#elif defined(__WXQT__) + #include "wx/qt/font.h" +#endif + +class WXDLLIMPEXP_CORE wxFontList: public wxGDIObjListBase +{ +public: + wxFont *FindOrCreateFont(int pointSize, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underline = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + + wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants") + wxFont *FindOrCreateFont(int pointSize, int family, int style, int weight, + bool underline = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { return FindOrCreateFont(pointSize, (wxFontFamily)family, (wxFontStyle)style, + (wxFontWeight)weight, underline, face, encoding); } + + wxFont *FindOrCreateFont(const wxFontInfo& fontInfo) + { return FindOrCreateFont(fontInfo.GetPointSize(), fontInfo.GetFamily(), + fontInfo.GetStyle(), fontInfo.GetWeight(), + fontInfo.IsUnderlined(), fontInfo.GetFaceName(), + fontInfo.GetEncoding()); } +}; + +extern WXDLLIMPEXP_DATA_CORE(wxFontList*) wxTheFontList; + + +// provide comparison operators to allow code such as +// +// if ( font.GetStyle() == wxFONTSTYLE_SLANT ) +// +// to compile without warnings which it would otherwise provoke from some +// compilers as it compares elements of different enums + +wxDEPRECATED_MSG("use wxFONTFAMILY_XXX constants") \ +inline bool operator==(wxFontFamily s, wxDeprecatedGUIConstants t) + { return static_cast(s) == static_cast(t); } +wxDEPRECATED_MSG("use wxFONTFAMILY_XXX constants") \ +inline bool operator!=(wxFontFamily s, wxDeprecatedGUIConstants t) + { return static_cast(s) != static_cast(t); } +wxDEPRECATED_MSG("use wxFONTSTYLE_XXX constants") \ +inline bool operator==(wxFontStyle s, wxDeprecatedGUIConstants t) + { return static_cast(s) == static_cast(t); } +wxDEPRECATED_MSG("use wxFONTSTYLE_XXX constants") \ +inline bool operator!=(wxFontStyle s, wxDeprecatedGUIConstants t) + { return static_cast(s) != static_cast(t); } +wxDEPRECATED_MSG("use wxFONTWEIGHT_XXX constants") \ +inline bool operator==(wxFontWeight s, wxDeprecatedGUIConstants t) + { return static_cast(s) == static_cast(t); } +wxDEPRECATED_MSG("use wxFONTWEIGHT_XXX constants") \ +inline bool operator!=(wxFontWeight s, wxDeprecatedGUIConstants t) + { return static_cast(s) != static_cast(t); } + +#endif // _WX_FONT_H_BASE_ diff --git a/lib/wxWidgets/include/wx/fontdata.h b/lib/wxWidgets/include/wx/fontdata.h new file mode 100644 index 0000000..4e7d047 --- /dev/null +++ b/lib/wxWidgets/include/wx/fontdata.h @@ -0,0 +1,82 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/fontdata.h +// Author: Julian Smart +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONTDATA_H_ +#define _WX_FONTDATA_H_ + +#include "wx/font.h" +#include "wx/colour.h" +#include "wx/encinfo.h" + +// Possible values for RestrictSelection() flags. +enum +{ + wxFONTRESTRICT_NONE = 0, + wxFONTRESTRICT_SCALABLE = 1 << 0, + wxFONTRESTRICT_FIXEDPITCH = 1 << 1 +}; + +class WXDLLIMPEXP_CORE wxFontData : public wxObject +{ +public: + wxFontData(); + virtual ~wxFontData(); + + wxFontData(const wxFontData& data); + wxFontData& operator=(const wxFontData& data); + + 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 RestrictSelection(int flags) { m_restrictSelection = flags; } + int GetRestrictSelection() const { return m_restrictSelection; } + + 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 + 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; + int m_restrictSelection; + + wxDECLARE_DYNAMIC_CLASS(wxFontData); +}; + +#endif // _WX_FONTDATA_H_ diff --git a/lib/wxWidgets/include/wx/fontdlg.h b/lib/wxWidgets/include/wx/fontdlg.h new file mode 100644 index 0000000..63e7fd4 --- /dev/null +++ b/lib/wxWidgets/include/wx/fontdlg.h @@ -0,0 +1,97 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/fontdlg.h +// Purpose: common interface for different wxFontDialog classes +// Author: Vadim Zeitlin +// Modified by: +// Created: 12.05.02 +// Copyright: (c) 1997-2002 wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONTDLG_H_BASE_ +#define _WX_FONTDLG_H_BASE_ + +#include "wx/defs.h" // for wxUSE_FONTDLG + +#if wxUSE_FONTDLG + +#include "wx/dialog.h" // the base class +#include "wx/fontdata.h" + +// ---------------------------------------------------------------------------- +// wxFontDialog interface +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFontDialogBase : public wxDialog +{ +public: + // create the font dialog + wxFontDialogBase() { } + wxFontDialogBase(wxWindow *parent) { m_parent = parent; } + wxFontDialogBase(wxWindow *parent, const wxFontData& data) + { m_parent = parent; InitFontData(&data); } + + bool Create(wxWindow *parent) + { return DoCreate(parent); } + bool Create(wxWindow *parent, const wxFontData& data) + { InitFontData(&data); return Create(parent); } + + // retrieve the font data + const wxFontData& GetFontData() const { return m_fontData; } + wxFontData& GetFontData() { return m_fontData; } + +protected: + virtual bool DoCreate(wxWindow *parent) { m_parent = parent; return true; } + + void InitFontData(const wxFontData *data = NULL) + { if ( data ) m_fontData = *data; } + + wxFontData m_fontData; + + wxDECLARE_NO_COPY_CLASS(wxFontDialogBase); +}; + +// ---------------------------------------------------------------------------- +// platform-specific wxFontDialog implementation +// ---------------------------------------------------------------------------- + +#if defined( __WXOSX_MAC__ ) +//set to 1 to use native mac font and color dialogs +#define USE_NATIVE_FONT_DIALOG_FOR_MACOSX 1 +#else +//not supported on these platforms, leave 0 +#define USE_NATIVE_FONT_DIALOG_FOR_MACOSX 0 +#endif + +#if defined(__WXUNIVERSAL__) || \ + defined(__WXMOTIF__) || \ + defined(__WXGPE__) + + #include "wx/generic/fontdlgg.h" + #define wxFontDialog wxGenericFontDialog +#elif defined(__WXMSW__) + #include "wx/msw/fontdlg.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/fontdlg.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/fontdlg.h" +#elif defined(__WXMAC__) + #include "wx/osx/fontdlg.h" +#elif defined(__WXQT__) + #include "wx/qt/fontdlg.h" +#endif + +// ---------------------------------------------------------------------------- +// global public functions +// ---------------------------------------------------------------------------- + +// get the font from user and return it, returns wxNullFont if the dialog was +// cancelled +WXDLLIMPEXP_CORE wxFont wxGetFontFromUser(wxWindow *parent = NULL, + const wxFont& fontInit = wxNullFont, + const wxString& caption = wxEmptyString); + +#endif // wxUSE_FONTDLG + +#endif + // _WX_FONTDLG_H_BASE_ diff --git a/lib/wxWidgets/include/wx/fontenc.h b/lib/wxWidgets/include/wx/fontenc.h new file mode 100644 index 0000000..5263997 --- /dev/null +++ b/lib/wxWidgets/include/wx/fontenc.h @@ -0,0 +1,163 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/fontenc.h +// Purpose: wxFontEncoding constants +// Author: Vadim Zeitlin +// Modified by: +// Created: 29.03.00 +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONTENC_H_ +#define _WX_FONTENC_H_ + +// font encodings +enum wxFontEncoding +{ + wxFONTENCODING_SYSTEM = -1, // system default + wxFONTENCODING_DEFAULT, // current default encoding + + // ISO8859 standard defines a number of single-byte charsets + wxFONTENCODING_ISO8859_1, // West European (Latin1) + wxFONTENCODING_ISO8859_2, // Central and East European (Latin2) + wxFONTENCODING_ISO8859_3, // Esperanto (Latin3) + wxFONTENCODING_ISO8859_4, // Baltic (old) (Latin4) + wxFONTENCODING_ISO8859_5, // Cyrillic + wxFONTENCODING_ISO8859_6, // Arabic + wxFONTENCODING_ISO8859_7, // Greek + wxFONTENCODING_ISO8859_8, // Hebrew + wxFONTENCODING_ISO8859_9, // Turkish (Latin5) + wxFONTENCODING_ISO8859_10, // Variation of Latin4 (Latin6) + wxFONTENCODING_ISO8859_11, // Thai + wxFONTENCODING_ISO8859_12, // doesn't exist currently, but put it + // here anyhow to make all ISO8859 + // consecutive numbers + wxFONTENCODING_ISO8859_13, // Baltic (Latin7) + wxFONTENCODING_ISO8859_14, // Latin8 + wxFONTENCODING_ISO8859_15, // Latin9 (a.k.a. Latin0, includes euro) + wxFONTENCODING_ISO8859_MAX, + + // Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html) + wxFONTENCODING_KOI8, // KOI8 Russian + wxFONTENCODING_KOI8_U, // KOI8 Ukrainian + wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866 + wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria + + // what would we do without Microsoft? They have their own encodings + // for DOS + wxFONTENCODING_CP437, // original MS-DOS codepage + wxFONTENCODING_CP850, // CP437 merged with Latin1 + wxFONTENCODING_CP852, // CP437 merged with Latin2 + wxFONTENCODING_CP855, // another cyrillic encoding + wxFONTENCODING_CP866, // and another one + // and for Windows + wxFONTENCODING_CP874, // WinThai + wxFONTENCODING_CP932, // Japanese (shift-JIS) + wxFONTENCODING_CP936, // Chinese simplified (GB) + wxFONTENCODING_CP949, // Korean (Hangul charset, a.k.a. EUC-KR) + wxFONTENCODING_CP950, // Chinese (traditional - Big5) + wxFONTENCODING_CP1250, // WinLatin2 + wxFONTENCODING_CP1251, // WinCyrillic + wxFONTENCODING_CP1252, // WinLatin1 + wxFONTENCODING_CP1253, // WinGreek (8859-7) + wxFONTENCODING_CP1254, // WinTurkish + wxFONTENCODING_CP1255, // WinHebrew + wxFONTENCODING_CP1256, // WinArabic + wxFONTENCODING_CP1257, // WinBaltic (same as Latin 7) + wxFONTENCODING_CP1258, // WinVietnamese + wxFONTENCODING_CP1361, // Johab Korean character set. + wxFONTENCODING_CP12_MAX, + + wxFONTENCODING_UTF7, // UTF-7 Unicode encoding + wxFONTENCODING_UTF8, // UTF-8 Unicode encoding + wxFONTENCODING_EUC_JP, // Extended Unix Codepage for Japanese + wxFONTENCODING_UTF16BE, // UTF-16 Big Endian Unicode encoding + wxFONTENCODING_UTF16LE, // UTF-16 Little Endian Unicode encoding + wxFONTENCODING_UTF32BE, // UTF-32 Big Endian Unicode encoding + wxFONTENCODING_UTF32LE, // UTF-32 Little Endian Unicode encoding + + wxFONTENCODING_MACROMAN, // the standard mac encodings + wxFONTENCODING_MACJAPANESE, + wxFONTENCODING_MACCHINESETRAD, + wxFONTENCODING_MACKOREAN, + wxFONTENCODING_MACARABIC, + wxFONTENCODING_MACHEBREW, + wxFONTENCODING_MACGREEK, + wxFONTENCODING_MACCYRILLIC, + wxFONTENCODING_MACDEVANAGARI, + wxFONTENCODING_MACGURMUKHI, + wxFONTENCODING_MACGUJARATI, + wxFONTENCODING_MACORIYA, + wxFONTENCODING_MACBENGALI, + wxFONTENCODING_MACTAMIL, + wxFONTENCODING_MACTELUGU, + wxFONTENCODING_MACKANNADA, + wxFONTENCODING_MACMALAJALAM, + wxFONTENCODING_MACSINHALESE, + wxFONTENCODING_MACBURMESE, + wxFONTENCODING_MACKHMER, + wxFONTENCODING_MACTHAI, + wxFONTENCODING_MACLAOTIAN, + wxFONTENCODING_MACGEORGIAN, + wxFONTENCODING_MACARMENIAN, + wxFONTENCODING_MACCHINESESIMP, + wxFONTENCODING_MACTIBETAN, + wxFONTENCODING_MACMONGOLIAN, + wxFONTENCODING_MACETHIOPIC, + wxFONTENCODING_MACCENTRALEUR, + wxFONTENCODING_MACVIATNAMESE, + wxFONTENCODING_MACARABICEXT, + wxFONTENCODING_MACSYMBOL, + wxFONTENCODING_MACDINGBATS, + wxFONTENCODING_MACTURKISH, + wxFONTENCODING_MACCROATIAN, + wxFONTENCODING_MACICELANDIC, + wxFONTENCODING_MACROMANIAN, + wxFONTENCODING_MACCELTIC, + wxFONTENCODING_MACGAELIC, + wxFONTENCODING_MACKEYBOARD, + + // more CJK encodings (for historical reasons some are already declared + // above) + wxFONTENCODING_ISO2022_JP, // ISO-2022-JP JIS encoding + + wxFONTENCODING_MAX, // highest enumerated encoding value + + wxFONTENCODING_MACMIN = wxFONTENCODING_MACROMAN , + wxFONTENCODING_MACMAX = wxFONTENCODING_MACKEYBOARD , + + // aliases for endian-dependent UTF encodings +#ifdef WORDS_BIGENDIAN + wxFONTENCODING_UTF16 = wxFONTENCODING_UTF16BE, // native UTF-16 + wxFONTENCODING_UTF32 = wxFONTENCODING_UTF32BE, // native UTF-32 +#else // WORDS_BIGENDIAN + wxFONTENCODING_UTF16 = wxFONTENCODING_UTF16LE, // native UTF-16 + wxFONTENCODING_UTF32 = wxFONTENCODING_UTF32LE, // native UTF-32 +#endif // WORDS_BIGENDIAN + + // alias for the native Unicode encoding on this platform + // (this is used by wxEncodingConverter and wxUTFFile only for now) +#if SIZEOF_WCHAR_T == 2 + wxFONTENCODING_UNICODE = wxFONTENCODING_UTF16, +#else // SIZEOF_WCHAR_T == 4 + wxFONTENCODING_UNICODE = wxFONTENCODING_UTF32, +#endif + + // alternative names for Far Eastern encodings + // Chinese + wxFONTENCODING_GB2312 = wxFONTENCODING_CP936, // Simplified Chinese + wxFONTENCODING_BIG5 = wxFONTENCODING_CP950, // Traditional Chinese + + // Japanese (see http://zsigri.tripod.com/fontboard/cjk/jis.html) + wxFONTENCODING_SHIFT_JIS = wxFONTENCODING_CP932, // Shift JIS + + // Korean (CP 949 not actually the same but close enough) + wxFONTENCODING_EUC_KR = wxFONTENCODING_CP949, + wxFONTENCODING_JOHAB = wxFONTENCODING_CP1361, + + // Vietnamese + wxFONTENCODING_VIETNAMESE = wxFONTENCODING_CP1258 +}; + +#endif // _WX_FONTENC_H_ + diff --git a/lib/wxWidgets/include/wx/fontenum.h b/lib/wxWidgets/include/wx/fontenum.h new file mode 100644 index 0000000..fcdb31f --- /dev/null +++ b/lib/wxWidgets/include/wx/fontenum.h @@ -0,0 +1,93 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/fontenum.h +// Purpose: wxFontEnumerator class for getting available fonts +// Author: Julian Smart, Vadim Zeitlin +// Modified by: extended to enumerate more than just font facenames and works +// not only on Windows now (VZ) +// Created: 04/01/98 +// Copyright: (c) Julian Smart, Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONTENUM_H_ +#define _WX_FONTENUM_H_ + +#include "wx/defs.h" + +#if wxUSE_FONTENUM + +#include "wx/fontenc.h" +#include "wx/arrstr.h" + +// ---------------------------------------------------------------------------- +// wxFontEnumerator enumerates all available fonts on the system or only the +// fonts with given attributes +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFontEnumerator +{ +public: + wxFontEnumerator() {} + + // virtual dtor for the base class + virtual ~wxFontEnumerator() {} + + // start enumerating font facenames (either all of them or those which + // support the given encoding) - will result in OnFacename() being + // called for each available facename (until they are exhausted or + // OnFacename returns false) + virtual bool EnumerateFacenames + ( + wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all + bool fixedWidthOnly = false + ); + + // enumerate the different encodings either for given font facename or for + // all facenames - will result in OnFontEncoding() being called for each + // available (facename, encoding) couple + virtual bool EnumerateEncodings(const wxString& facename = wxEmptyString); + + // callbacks which are called after one of EnumerateXXX() functions from + // above is invoked - all of them may return false to stop enumeration or + // true to continue with it + + // called by EnumerateFacenames + virtual bool OnFacename(const wxString& WXUNUSED(facename)) + { return true; } + + // called by EnumerateEncodings + virtual bool OnFontEncoding(const wxString& WXUNUSED(facename), + const wxString& WXUNUSED(encoding)) + { return true; } + + + + // convenience function that returns array of facenames. + static wxArrayString + GetFacenames(wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all + bool fixedWidthOnly = false); + + // convenience function that returns array of all available encodings. + static wxArrayString GetEncodings(const wxString& facename = wxEmptyString); + + // convenience function that returns true if the given face name exist + // in the user's system + static bool IsValidFacename(const wxString &str); + + // Invalidate cache used by some of the methods of this class internally. + // This should be called if the list of the fonts available on the system + // changes, for whatever reason. + static void InvalidateCache(); + +private: +#ifdef wxHAS_UTF8_FONTS + // helper for ports that only use UTF-8 encoding natively + bool EnumerateEncodingsUTF8(const wxString& facename); +#endif + + wxDECLARE_NO_COPY_CLASS(wxFontEnumerator); +}; + +#endif // wxUSE_FONTENUM + +#endif // _WX_FONTENUM_H_ diff --git a/lib/wxWidgets/include/wx/fontmap.h b/lib/wxWidgets/include/wx/fontmap.h new file mode 100644 index 0000000..26883de --- /dev/null +++ b/lib/wxWidgets/include/wx/fontmap.h @@ -0,0 +1,289 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/fontmap.h +// Purpose: wxFontMapper class +// Author: Vadim Zeitlin +// Modified by: +// Created: 04.11.99 +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONTMAPPER_H_ +#define _WX_FONTMAPPER_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if wxUSE_FONTMAP + +#include "wx/fontenc.h" // for wxFontEncoding + +#if wxUSE_GUI + #include "wx/fontutil.h" // for wxNativeEncodingInfo +#endif // wxUSE_GUI + +#if wxUSE_CONFIG && wxUSE_FILECONFIG + class WXDLLIMPEXP_FWD_BASE wxConfigBase; +#endif // wxUSE_CONFIG + +class WXDLLIMPEXP_FWD_CORE wxFontMapper; + +#if wxUSE_GUI + class WXDLLIMPEXP_FWD_CORE wxWindow; +#endif // wxUSE_GUI + +// ============================================================================ +// wxFontMapper manages user-definable correspondence between wxWidgets font +// encodings and the fonts present on the machine. +// +// This is a singleton class, font mapper objects can only be accessed using +// wxFontMapper::Get(). +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxFontMapperBase: this is a non-interactive class which just uses its built +// in knowledge of the encodings equivalence +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFontMapperBase +{ +public: + // constructor and such + // --------------------- + + // default ctor + wxFontMapperBase(); + + // virtual dtor for any base class + virtual ~wxFontMapperBase(); + + // return instance of the wxFontMapper singleton + // wxBase code only cares that it's a wxFontMapperBase + // In wxBase, wxFontMapper is only forward declared + // so one cannot implicitly cast from it to wxFontMapperBase. + static wxFontMapperBase *Get(); + + // set the singleton to 'mapper' instance and return previous one + static wxFontMapper *Set(wxFontMapper *mapper); + + // delete the existing font mapper if any + static void Reset(); + + + // translates charset strings to encoding + // -------------------------------------- + + // returns the encoding for the given charset (in the form of RFC 2046) or + // wxFONTENCODING_SYSTEM if couldn't decode it + // + // interactive parameter is ignored in the base class, we behave as if it + // were always false + virtual wxFontEncoding CharsetToEncoding(const wxString& charset, + bool interactive = true); + + // information about supported encodings + // ------------------------------------- + + // get the number of font encodings we know about + static size_t GetSupportedEncodingsCount(); + + // get the n-th supported encoding + static wxFontEncoding GetEncoding(size_t n); + + // return canonical name of this encoding (this is a short string, + // GetEncodingDescription() returns a longer one) + static wxString GetEncodingName(wxFontEncoding encoding); + + // return a list of all names of this encoding (see GetEncodingName) + static const wxChar** GetAllEncodingNames(wxFontEncoding encoding); + + // return user-readable string describing the given encoding + // + // NB: hard-coded now, but might change later (read it from config?) + static wxString GetEncodingDescription(wxFontEncoding encoding); + + // find the encoding corresponding to the given name, inverse of + // GetEncodingName() and less general than CharsetToEncoding() + // + // returns wxFONTENCODING_MAX if the name is not a supported encoding + static wxFontEncoding GetEncodingFromName(const wxString& name); + + + // functions which allow to configure the config object used: by default, + // the global one (from wxConfigBase::Get() will be used) and the default + // root path for the config settings is the string returned by + // GetDefaultConfigPath() + // ---------------------------------------------------------------------- + +#if wxUSE_CONFIG && wxUSE_FILECONFIG + // set the root config path to use (should be an absolute path) + void SetConfigPath(const wxString& prefix); + + // return default config path + static const wxString& GetDefaultConfigPath(); +#endif // wxUSE_CONFIG + + + // returns true for the base class and false for a "real" font mapper object + // (implementation-only) + virtual bool IsDummy() { return true; } + +protected: +#if wxUSE_CONFIG && wxUSE_FILECONFIG + // get the config object we're using -- either the global config object + // or a wxMemoryConfig object created by this class otherwise + wxConfigBase *GetConfig(); + + // gets the root path for our settings -- if it wasn't set explicitly, use + // GetDefaultConfigPath() + const wxString& GetConfigPath(); + + // change to the given (relative) path in the config, return true if ok + // (then GetConfig() will return something !NULL), false if no config + // object + // + // caller should provide a pointer to the string variable which should be + // later passed to RestorePath() + bool ChangePath(const wxString& pathNew, wxString *pathOld); + + // restore the config path after use + void RestorePath(const wxString& pathOld); + + // config object and path (in it) to use + wxConfigBase *m_configDummy; + + wxString m_configRootPath; +#endif // wxUSE_CONFIG + + // the real implementation of the base class version of CharsetToEncoding() + // + // returns wxFONTENCODING_UNKNOWN if encoding is unknown and we shouldn't + // ask the user about it, wxFONTENCODING_SYSTEM if it is unknown but we + // should/could ask the user + int NonInteractiveCharsetToEncoding(const wxString& charset); + +private: + // the global fontmapper object or NULL + static wxFontMapper *sm_instance; + + friend class wxFontMapperPathChanger; + + wxDECLARE_NO_COPY_CLASS(wxFontMapperBase); +}; + +// ---------------------------------------------------------------------------- +// wxFontMapper: interactive extension of wxFontMapperBase +// +// The default implementations of all functions will ask the user if they are +// not capable of finding the answer themselves and store the answer in a +// config file (configurable via SetConfigXXX functions). This behaviour may +// be disabled by giving the value of false to "interactive" parameter. +// However, the functions will always consult the config file to allow the +// user-defined values override the default logic and there is no way to +// disable this -- which shouldn't be ever needed because if "interactive" was +// never true, the config file is never created anyhow. +// ---------------------------------------------------------------------------- + +#if wxUSE_GUI + +class WXDLLIMPEXP_CORE wxFontMapper : public wxFontMapperBase +{ +public: + // default ctor + wxFontMapper(); + + // virtual dtor for a base class + virtual ~wxFontMapper(); + + // working with the encodings + // -------------------------- + + // returns the encoding for the given charset (in the form of RFC 2046) or + // wxFONTENCODING_SYSTEM if couldn't decode it + virtual wxFontEncoding CharsetToEncoding(const wxString& charset, + bool interactive = true) wxOVERRIDE; + + // find an alternative for the given encoding (which is supposed to not be + // available on this system). If successful, return true and fill info + // structure with the parameters required to create the font, otherwise + // return false + virtual bool GetAltForEncoding(wxFontEncoding encoding, + wxNativeEncodingInfo *info, + const wxString& facename = wxEmptyString, + bool interactive = true); + + // version better suitable for 'public' use. Returns wxFontEcoding + // that can be used it wxFont ctor + bool GetAltForEncoding(wxFontEncoding encoding, + wxFontEncoding *alt_encoding, + const wxString& facename = wxEmptyString, + bool interactive = true); + + // checks whether given encoding is available in given face or not. + // + // if no facename is given (default), return true if it's available in any + // facename at alll. + virtual bool IsEncodingAvailable(wxFontEncoding encoding, + const wxString& facename = wxEmptyString); + + + // configure the appearance of the dialogs we may popup + // ---------------------------------------------------- + + // the parent window for modal dialogs + void SetDialogParent(wxWindow *parent) { m_windowParent = parent; } + + // the title for the dialogs (note that default is quite reasonable) + void SetDialogTitle(const wxString& title) { m_titleDialog = title; } + + // GUI code needs to know it's a wxFontMapper because there + // are additional methods in the subclass. + static wxFontMapper *Get(); + + // pseudo-RTTI since we aren't a wxObject. + virtual bool IsDummy() wxOVERRIDE { return false; } + +protected: + // GetAltForEncoding() helper: tests for the existence of the given + // encoding and saves the result in config if ok - this results in the + // following (desired) behaviour: when an unknown/unavailable encoding is + // requested for the first time, the user is asked about a replacement, + // but if he doesn't choose any and the default logic finds one, it will + // be saved in the config so that the user won't be asked about it any + // more + bool TestAltEncoding(const wxString& configEntry, + wxFontEncoding encReplacement, + wxNativeEncodingInfo *info); + + // the title for our dialogs + wxString m_titleDialog; + + // the parent window for our dialogs + wxWindow *m_windowParent; + +private: + wxDECLARE_NO_COPY_CLASS(wxFontMapper); +}; + +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// global variables +// ---------------------------------------------------------------------------- + +// the default font mapper for wxWidgets programs do NOT use! This is for +// backward compatibility, use wxFontMapper::Get() instead +#define wxTheFontMapper (wxFontMapper::Get()) + +#else // !wxUSE_FONTMAP + +#if wxUSE_GUI + // wxEncodingToCodepage (utils.cpp) needs wxGetNativeFontEncoding + #include "wx/fontutil.h" +#endif + +#endif // wxUSE_FONTMAP/!wxUSE_FONTMAP + +#endif // _WX_FONTMAPPER_H_ + diff --git a/lib/wxWidgets/include/wx/fontpicker.h b/lib/wxWidgets/include/wx/fontpicker.h new file mode 100644 index 0000000..8b3faef --- /dev/null +++ b/lib/wxWidgets/include/wx/fontpicker.h @@ -0,0 +1,243 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/fontpicker.h +// Purpose: wxFontPickerCtrl base header +// Author: Francesco Montorsi +// Modified by: +// Created: 14/4/2006 +// Copyright: (c) Francesco Montorsi +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONTPICKER_H_BASE_ +#define _WX_FONTPICKER_H_BASE_ + +#include "wx/defs.h" + + +#if wxUSE_FONTPICKERCTRL + +#include "wx/pickerbase.h" + + +class WXDLLIMPEXP_FWD_CORE wxFontPickerEvent; + +extern WXDLLIMPEXP_DATA_CORE(const char) wxFontPickerWidgetNameStr[]; +extern WXDLLIMPEXP_DATA_CORE(const char) wxFontPickerCtrlNameStr[]; + + +// ---------------------------------------------------------------------------- +// wxFontPickerWidgetBase: a generic abstract interface which must be +// implemented by controls used by wxFontPickerCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFontPickerWidgetBase +{ +public: + wxFontPickerWidgetBase() : m_selectedFont(*wxNORMAL_FONT) { } + virtual ~wxFontPickerWidgetBase() {} + + wxFont GetSelectedFont() const + { return m_selectedFont; } + virtual void SetSelectedFont(const wxFont &f) + { m_selectedFont = f; UpdateFont(); } + + virtual wxColour GetSelectedColour() const = 0; + virtual void SetSelectedColour(const wxColour &colour) = 0; + +protected: + + virtual void UpdateFont() = 0; + + // the current font (may be invalid if none) + // NOTE: don't call this m_font as wxWindow::m_font already exists + wxFont m_selectedFont; +}; + +// Styles which must be supported by all controls implementing wxFontPickerWidgetBase +// NB: these styles must be defined to carefully-chosen values to +// avoid conflicts with wxButton's styles + + +// keeps the label of the button updated with the fontface name + font size +// E.g. choosing "Times New Roman bold, italic with size 10" from the fontdialog, +// updates the wxFontButtonGeneric's label (overwriting any previous label) +// with the "Times New Roman, 10" text (only fontface + fontsize is displayed +// to avoid extralong labels). +#define wxFNTP_FONTDESC_AS_LABEL 0x0008 + +// uses the currently selected font to draw the label of the button +#define wxFNTP_USEFONT_FOR_LABEL 0x0010 + +#define wxFONTBTN_DEFAULT_STYLE \ + (wxFNTP_FONTDESC_AS_LABEL | wxFNTP_USEFONT_FOR_LABEL) + +// native version currently only exists in wxGTK2 +#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) + #include "wx/gtk/fontpicker.h" + #define wxFontPickerWidget wxFontButton +#else + #include "wx/generic/fontpickerg.h" + #define wxFontPickerWidget wxGenericFontButton +#endif + + +// ---------------------------------------------------------------------------- +// wxFontPickerCtrl specific flags +// ---------------------------------------------------------------------------- + +#define wxFNTP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL) +#define wxFNTP_DEFAULT_STYLE (wxFNTP_FONTDESC_AS_LABEL|wxFNTP_USEFONT_FOR_LABEL) + +// not a style but rather the default value of the minimum/maximum pointsize allowed +#define wxFNTP_MINPOINT_SIZE 0 +#define wxFNTP_MAXPOINT_SIZE 100 + + +// ---------------------------------------------------------------------------- +// wxFontPickerCtrl: platform-independent class which embeds the +// platform-dependent wxFontPickerWidget and if wxFNTP_USE_TEXTCTRL style is +// used, a textctrl next to it. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFontPickerCtrl : public wxPickerBase +{ +public: + wxFontPickerCtrl() + : m_nMinPointSize(wxFNTP_MINPOINT_SIZE), m_nMaxPointSize(wxFNTP_MAXPOINT_SIZE) + { + } + + virtual ~wxFontPickerCtrl() {} + + + wxFontPickerCtrl(wxWindow *parent, + wxWindowID id, + const wxFont& initial = wxNullFont, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxFNTP_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxFontPickerCtrlNameStr)) + : m_nMinPointSize(wxFNTP_MINPOINT_SIZE), m_nMaxPointSize(wxFNTP_MAXPOINT_SIZE) + { + Create(parent, id, initial, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxFont& initial = wxNullFont, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxFNTP_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxFontPickerCtrlNameStr)); + + +public: // public API + + // get the font chosen + wxFont GetSelectedFont() const + { return GetPickerWidget()->GetSelectedFont(); } + + // sets currently displayed font + void SetSelectedFont(const wxFont& f); + + // returns the selected color + wxColour GetSelectedColour() const + { return GetPickerWidget()->GetSelectedColour(); } + + // sets the currently selected color + void SetSelectedColour(const wxColour& colour) + { GetPickerWidget()->SetSelectedColour(colour); } + + // set/get the min point size + void SetMinPointSize(unsigned int min); + unsigned int GetMinPointSize() const + { return m_nMinPointSize; } + + // set/get the max point size + void SetMaxPointSize(unsigned int max); + unsigned int GetMaxPointSize() const + { return m_nMaxPointSize; } + +public: // internal functions + + void UpdatePickerFromTextCtrl() wxOVERRIDE; + void UpdateTextCtrlFromPicker() wxOVERRIDE; + + // event handler for our picker + void OnFontChange(wxFontPickerEvent &); + + // used to convert wxString <-> wxFont + virtual wxString Font2String(const wxFont &font); + virtual wxFont String2Font(const wxString &font); + +protected: + + // extracts the style for our picker from wxFontPickerCtrl's style + long GetPickerStyle(long style) const wxOVERRIDE + { return (style & (wxFNTP_FONTDESC_AS_LABEL|wxFNTP_USEFONT_FOR_LABEL)); } + + // the minimum pointsize allowed to the user + unsigned int m_nMinPointSize; + + // the maximum pointsize allowed to the user + unsigned int m_nMaxPointSize; + +private: + wxFontPickerWidget* GetPickerWidget() const + { return static_cast(m_picker); } + + wxDECLARE_DYNAMIC_CLASS(wxFontPickerCtrl); +}; + + +// ---------------------------------------------------------------------------- +// wxFontPickerEvent: used by wxFontPickerCtrl only +// ---------------------------------------------------------------------------- + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FONTPICKER_CHANGED, wxFontPickerEvent ); + +class WXDLLIMPEXP_CORE wxFontPickerEvent : public wxCommandEvent +{ +public: + wxFontPickerEvent() {} + wxFontPickerEvent(wxObject *generator, int id, const wxFont &f) + : wxCommandEvent(wxEVT_FONTPICKER_CHANGED, id), + m_font(f) + { + SetEventObject(generator); + } + + wxFont GetFont() const { return m_font; } + void SetFont(const wxFont &c) { m_font = c; } + + // default copy ctor, assignment operator and dtor are ok + virtual wxEvent *Clone() const wxOVERRIDE { return new wxFontPickerEvent(*this); } + +private: + wxFont m_font; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxFontPickerEvent); +}; + +// ---------------------------------------------------------------------------- +// event types and macros +// ---------------------------------------------------------------------------- + +typedef void (wxEvtHandler::*wxFontPickerEventFunction)(wxFontPickerEvent&); + +#define wxFontPickerEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxFontPickerEventFunction, func) + +#define EVT_FONTPICKER_CHANGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_FONTPICKER_CHANGED, id, wxFontPickerEventHandler(fn)) + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_FONTPICKER_CHANGED wxEVT_FONTPICKER_CHANGED + + +#endif // wxUSE_FONTPICKERCTRL + +#endif + // _WX_FONTPICKER_H_BASE_ diff --git a/lib/wxWidgets/include/wx/fontutil.h b/lib/wxWidgets/include/wx/fontutil.h new file mode 100644 index 0000000..30529db --- /dev/null +++ b/lib/wxWidgets/include/wx/fontutil.h @@ -0,0 +1,360 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/fontutil.h +// Purpose: font-related helper functions +// Author: Vadim Zeitlin +// Modified by: +// Created: 05.11.99 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// General note: this header is private to wxWidgets and is not supposed to be +// included by user code. The functions declared here are implemented in +// msw/fontutil.cpp for Windows, unix/fontutil.cpp for GTK/Motif &c. + +#ifndef _WX_FONTUTIL_H_ +#define _WX_FONTUTIL_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/font.h" // for wxFont and wxFontEncoding + +#if defined(__WXMSW__) + #include "wx/msw/wrapwin.h" +#endif + +#if defined(__WXQT__) + #include +#endif + +#if defined(__WXOSX__) +#include "wx/osx/core/cfref.h" +#endif + +class WXDLLIMPEXP_FWD_BASE wxArrayString; +class WXDLLIMPEXP_FWD_CORE wxWindow; +struct WXDLLIMPEXP_FWD_CORE wxNativeEncodingInfo; + +#if defined(_WX_X_FONTLIKE) + +// the symbolic names for the XLFD fields (with examples for their value) +// +// NB: we suppose that the font always starts with the empty token (font name +// registry field) as we never use nor generate it anyhow +enum wxXLFDField +{ + wxXLFD_FOUNDRY, // adobe + wxXLFD_FAMILY, // courier, times, ... + wxXLFD_WEIGHT, // black, bold, demibold, medium, regular, light + wxXLFD_SLANT, // r/i/o (roman/italique/oblique) + wxXLFD_SETWIDTH, // condensed, expanded, ... + wxXLFD_ADDSTYLE, // whatever - usually nothing + wxXLFD_PIXELSIZE, // size in pixels + wxXLFD_POINTSIZE, // size in points + wxXLFD_RESX, // 72, 75, 100, ... + wxXLFD_RESY, + wxXLFD_SPACING, // m/p/c (monospaced/proportional/character cell) + wxXLFD_AVGWIDTH, // average width in 1/10 pixels + wxXLFD_REGISTRY, // iso8859, rawin, koi8, ... + wxXLFD_ENCODING, // 1, r, r, ... + wxXLFD_MAX +}; + +#endif // _WX_X_FONTLIKE + +// ---------------------------------------------------------------------------- +// types +// ---------------------------------------------------------------------------- + +// wxNativeFontInfo is platform-specific font representation: this struct +// should be considered as opaque font description only used by the native +// functions, the user code can only get the objects of this type from +// somewhere and pass it somewhere else (possibly save them somewhere using +// ToString() and restore them using FromString()) + +class WXDLLIMPEXP_CORE wxNativeFontInfo +{ +public: +#if wxUSE_PANGO + PangoFontDescription *description; + + // Pango font description doesn't have these attributes, so we store them + // separately and handle them ourselves in {To,From}String() methods. + bool m_underlined; + bool m_strikethrough; +#elif defined(_WX_X_FONTLIKE) + // the members can't be accessed directly as we only parse the + // xFontName on demand +private: + // the components of the XLFD + wxString fontElements[wxXLFD_MAX]; + + // the full XLFD + wxString xFontName; + + // true until SetXFontName() is called + bool m_isDefault; + + // return true if we have already initialized fontElements + inline bool HasElements() const; + +public: + // init the elements from an XLFD, return true if ok + bool FromXFontName(const wxString& xFontName); + + // return false if we were never initialized with a valid XLFD + bool IsDefault() const { return m_isDefault; } + + // return the XLFD (using the fontElements if necessary) + wxString GetXFontName() const; + + // get the given XFLD component + wxString GetXFontComponent(wxXLFDField field) const; + + // change the font component + void SetXFontComponent(wxXLFDField field, const wxString& value); + + // set the XFLD + void SetXFontName(const wxString& xFontName); +#elif defined(__WXMSW__) + // Preserve compatibility in the semi-public (i.e. private, but still + // unfortunately used by some existing code outside of the library) API + // by allowing to create wxNativeFontInfo from just LOGFONT, but ensure + // that we always specify the window, to use the correct DPI, when creating + // fonts inside the library itself. + wxNativeFontInfo(const LOGFONT& lf_, const wxWindow* win +#ifndef WXBUILDING + = NULL +#endif + ); + + // MSW-specific: get point size from LOGFONT height using specified DPI, + // or screen DPI when 0. + static double GetPointSizeAtPPI(int lfHeight, int ppi = 0); + + // MSW-specific: get the height value in pixels using LOGFONT convention + // (i.e. negative) corresponding to the given size in points and DPI. + static int GetLogFontHeightAtPPI(double size, int ppi); + + LOGFONT lf; + + // MSW only has limited support for fractional point sizes and we need to + // store the fractional point size separately if it was initially specified + // as we can't losslessly recover it from LOGFONT later. + double pointSize; +#elif defined(__WXOSX__) +public: + wxNativeFontInfo(const wxNativeFontInfo& info) { Init(info); } + + ~wxNativeFontInfo() { Free(); } + + wxNativeFontInfo& operator=(const wxNativeFontInfo& info) + { + if (this != &info) + { + Free(); + Init(info); + } + return *this; + } + + void InitFromFont(CTFontRef font); + void InitFromFontDescriptor(CTFontDescriptorRef font); + void Init(const wxNativeFontInfo& info); + + void Free(); + + // not all style attributes like condensed etc, are exposed in the public API methods + // for best fidelity PostScript names are useful, they are also used in the toString/fromString methods + wxString GetPostScriptName() const; + bool SetPostScriptName(const wxString& postScriptName); + + static double GetCTWeight( CTFontRef font ); + static double GetCTWeight( CTFontDescriptorRef font ); + static double GetCTwidth( CTFontDescriptorRef font ); + static double GetCTSlant( CTFontDescriptorRef font ); + + CTFontDescriptorRef GetCTFontDescriptor() const; + + void RealizeResource() const; +private: + // attributes for regenerating a CTFontDescriptor, stay close to native values + // for better roundtrip fidelity + double m_ctWeight; + double m_ctWidth; + wxFontStyle m_style; + double m_ctSize; + wxFontFamily m_family; + + wxString m_familyName; + wxString m_postScriptName; + + // native font description + wxCFRef m_descriptor; + void CreateCTFontDescriptor(); + + // these attributes are not part of a CTFont + bool m_underlined; + bool m_strikethrough; + wxFontEncoding m_encoding; + +public : +#elif defined(__WXQT__) + QFont m_qtFont; +#else // other platforms + // + // This is a generic implementation that should work on all ports + // without specific support by the port. + // + #define wxNO_NATIVE_FONTINFO + + double pointSize; + wxFontFamily family; + wxFontStyle style; + int weight; + bool underlined; + bool strikethrough; + wxString faceName; + wxFontEncoding encoding; +#endif // platforms + + // default ctor (default copy ctor is ok) + wxNativeFontInfo() { Init(); } + +#if wxUSE_PANGO +private: + void Init(const wxNativeFontInfo& info); + void Free(); + +public: + wxNativeFontInfo(const wxNativeFontInfo& info) { Init(info); } + ~wxNativeFontInfo() { Free(); } + + wxNativeFontInfo& operator=(const wxNativeFontInfo& info) + { + if (this != &info) + { + Free(); + Init(info); + } + return *this; + } +#endif // wxUSE_PANGO + + // reset to the default state + void Init(); + + // init with the parameters of the given font + void InitFromFont(const wxFont& font) + { +#if wxUSE_PANGO || defined(__WXOSX__) + Init(*font.GetNativeFontInfo()); +#else + // translate all font parameters + SetStyle((wxFontStyle)font.GetStyle()); + SetNumericWeight(font.GetNumericWeight()); + SetUnderlined(font.GetUnderlined()); + SetStrikethrough(font.GetStrikethrough()); +#if defined(__WXMSW__) + if ( font.IsUsingSizeInPixels() ) + SetPixelSize(font.GetPixelSize()); + else + SetFractionalPointSize(font.GetFractionalPointSize()); +#else + SetFractionalPointSize(font.GetFractionalPointSize()); +#endif + + // set the family/facename + SetFamily((wxFontFamily)font.GetFamily()); + const wxString& facename = font.GetFaceName(); + if ( !facename.empty() ) + { + SetFaceName(facename); + } + + // deal with encoding now (it may override the font family and facename + // so do it after setting them) + SetEncoding(font.GetEncoding()); +#endif // !wxUSE_PANGO + } + + // accessors and modifiers for the font elements + int GetPointSize() const; + double GetFractionalPointSize() const; + wxSize GetPixelSize() const; + wxFontStyle GetStyle() const; + wxFontWeight GetWeight() const; + int GetNumericWeight() const; + bool GetUnderlined() const; + bool GetStrikethrough() const; + wxString GetFaceName() const; + wxFontFamily GetFamily() const; + wxFontEncoding GetEncoding() const; + + void SetPointSize(int pointsize); + void SetFractionalPointSize(double pointsize); + void SetPixelSize(const wxSize& pixelSize); + void SetStyle(wxFontStyle style); + void SetNumericWeight(int weight); + void SetWeight(wxFontWeight weight); + void SetUnderlined(bool underlined); + void SetStrikethrough(bool strikethrough); + bool SetFaceName(const wxString& facename); + void SetFamily(wxFontFamily family); + void SetEncoding(wxFontEncoding encoding); + + // Helper used in many ports: use the normal font size if the input is + // negative, as we handle -1 as meaning this for compatibility. + void SetSizeOrDefault(double size) + { + SetFractionalPointSize + ( + size < 0 ? wxNORMAL_FONT->GetFractionalPointSize() + : size + ); + } + + // sets the first facename in the given array which is found + // to be valid. If no valid facename is given, sets the + // first valid facename returned by wxFontEnumerator::GetFacenames(). + // Does not return a bool since it cannot fail. + void SetFaceName(const wxArrayString &facenames); + + + // it is important to be able to serialize wxNativeFontInfo objects to be + // able to store them (in config file, for example) + bool FromString(const wxString& s); + wxString ToString() const; + + // we also want to present the native font descriptions to the user in some + // human-readable form (it is not platform independent either, but can + // hopefully be understood by the user) + bool FromUserString(const wxString& s); + wxString ToUserString() const; +}; + +// ---------------------------------------------------------------------------- +// font-related functions (common) +// ---------------------------------------------------------------------------- + +// translate a wxFontEncoding into native encoding parameter (defined above), +// returning true if an (exact) macth could be found, false otherwise (without +// attempting any substitutions) +WXDLLIMPEXP_CORE bool wxGetNativeFontEncoding(wxFontEncoding encoding, + wxNativeEncodingInfo *info); + +// test for the existence of the font described by this facename/encoding, +// return true if such font(s) exist, false otherwise +WXDLLIMPEXP_CORE bool wxTestFontEncoding(const wxNativeEncodingInfo& info); + +// ---------------------------------------------------------------------------- +// font-related functions (X and GTK) +// ---------------------------------------------------------------------------- + +#ifdef _WX_X_FONTLIKE + #include "wx/unix/fontutil.h" +#endif // X || GDK + +#endif // _WX_FONTUTIL_H_ diff --git a/lib/wxWidgets/include/wx/frame.h b/lib/wxWidgets/include/wx/frame.h new file mode 100644 index 0000000..c202f57 --- /dev/null +++ b/lib/wxWidgets/include/wx/frame.h @@ -0,0 +1,278 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/frame.h +// Purpose: wxFrame class interface +// Author: Vadim Zeitlin +// Modified by: +// Created: 15.11.99 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FRAME_H_BASE_ +#define _WX_FRAME_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/toplevel.h" // the base class +#include "wx/statusbr.h" + +// the default names for various classes +extern WXDLLIMPEXP_DATA_CORE(const char) wxStatusLineNameStr[]; +extern WXDLLIMPEXP_DATA_CORE(const char) wxToolBarNameStr[]; + +class WXDLLIMPEXP_FWD_CORE wxFrame; +#if wxUSE_MENUBAR +class WXDLLIMPEXP_FWD_CORE wxMenuBar; +#endif +class WXDLLIMPEXP_FWD_CORE wxMenuItem; +class WXDLLIMPEXP_FWD_CORE wxStatusBar; +class WXDLLIMPEXP_FWD_CORE wxToolBar; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// wxFrame-specific (i.e. not for wxDialog) styles +// +// Also see the bit summary table in wx/toplevel.h. +#define wxFRAME_NO_TASKBAR 0x0002 // No taskbar button (MSW only) +#define wxFRAME_TOOL_WINDOW 0x0004 // No taskbar button, no system menu +#define wxFRAME_FLOAT_ON_PARENT 0x0008 // Always above its parent + +// ---------------------------------------------------------------------------- +// wxFrame is a top-level window with optional menubar, statusbar and toolbar +// +// For each of *bars, a frame may have several of them, but only one is +// managed by the frame, i.e. resized/moved when the frame is and whose size +// is accounted for in client size calculations - all others should be taken +// care of manually. The CreateXXXBar() functions create this, main, XXXBar, +// but the actual creation is done in OnCreateXXXBar() functions which may be +// overridden to create custom objects instead of standard ones when +// CreateXXXBar() is called. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFrameBase : public wxTopLevelWindow +{ +public: + // construction + wxFrameBase(); + virtual ~wxFrameBase(); + + wxFrame *New(wxWindow *parent, + wxWindowID winid, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + // frame state + // ----------- + + // get the origin of the client area (which may be different from (0, 0) + // if the frame has a toolbar) in client coordinates + virtual wxPoint GetClientAreaOrigin() const wxOVERRIDE; + + + // menu bar functions + // ------------------ + +#if wxUSE_MENUS +#if wxUSE_MENUBAR + virtual void SetMenuBar(wxMenuBar *menubar); + virtual wxMenuBar *GetMenuBar() const { return m_frameMenuBar; } + + // find the item by id in the frame menu bar: this is an internal function + // and exists mainly in order to be overridden in the MDI parent frame + // which also looks at its active child menu bar + virtual wxMenuItem *FindItemInMenuBar(int menuId) const; +#endif + // generate menu command corresponding to the given menu item + // + // returns true if processed + bool ProcessCommand(wxMenuItem *item); + + // generate menu command corresponding to the given menu command id + // + // returns true if processed + bool ProcessCommand(int winid); +#else + bool ProcessCommand(int WXUNUSED(winid)) { return false; } +#endif // wxUSE_MENUS + + // status bar functions + // -------------------- +#if wxUSE_STATUSBAR + // create the main status bar by calling OnCreateStatusBar() + virtual wxStatusBar* CreateStatusBar(int number = 1, + long style = wxSTB_DEFAULT_STYLE, + wxWindowID winid = 0, + const wxString& name = wxASCII_STR(wxStatusLineNameStr)); + // return a new status bar + virtual wxStatusBar *OnCreateStatusBar(int number, + long style, + wxWindowID winid, + const wxString& name); + // get the main status bar + virtual wxStatusBar *GetStatusBar() const { return m_frameStatusBar; } + + // sets the main status bar + virtual void SetStatusBar(wxStatusBar *statBar); + + // forward these to status bar + virtual void SetStatusText(const wxString &text, int number = 0); + virtual void SetStatusWidths(int n, const int widths_field[]); + void PushStatusText(const wxString &text, int number = 0); + void PopStatusText(int number = 0); + + // set the status bar pane the help will be shown in + void SetStatusBarPane(int n) { m_statusBarPane = n; } + int GetStatusBarPane() const { return m_statusBarPane; } +#endif // wxUSE_STATUSBAR + + // toolbar functions + // ----------------- + +#if wxUSE_TOOLBAR + // create main toolbar bycalling OnCreateToolBar() + virtual wxToolBar* CreateToolBar(long style = -1, + wxWindowID winid = wxID_ANY, + const wxString& name = wxASCII_STR(wxToolBarNameStr)); + // return a new toolbar + virtual wxToolBar *OnCreateToolBar(long style, + wxWindowID winid, + const wxString& name ); + + // get/set the main toolbar + virtual wxToolBar *GetToolBar() const { return m_frameToolBar; } + virtual void SetToolBar(wxToolBar *toolbar); +#endif // wxUSE_TOOLBAR + + // implementation only from now on + // ------------------------------- + + // event handlers +#if wxUSE_MENUS + void OnMenuOpen(wxMenuEvent& event); +#if wxUSE_STATUSBAR + void OnMenuClose(wxMenuEvent& event); + void OnMenuHighlight(wxMenuEvent& event); +#endif // wxUSE_STATUSBAR + + // send wxUpdateUIEvents for all menu items in the menubar, + // or just for menu if non-NULL + virtual void DoMenuUpdates(wxMenu* menu = NULL); +#endif // wxUSE_MENUS + + // do the UI update processing for this window + virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE) wxOVERRIDE; + + // Implement internal behaviour (menu updating on some platforms) + virtual void OnInternalIdle() wxOVERRIDE; + +#if wxUSE_MENUS || wxUSE_TOOLBAR + // show help text for the currently selected menu or toolbar item + // (typically in the status bar) or hide it and restore the status bar text + // originally shown before the menu was opened if show == false + virtual void DoGiveHelp(const wxString& text, bool show); +#endif + + virtual bool IsClientAreaChild(const wxWindow *child) const wxOVERRIDE + { + return !IsOneOfBars(child) && wxTopLevelWindow::IsClientAreaChild(child); + } + +protected: + // the frame main menu/status/tool bars + // ------------------------------------ + + // this (non virtual!) function should be called from dtor to delete the + // main menubar, statusbar and toolbar (if any) + void DeleteAllBars(); + + // test whether this window makes part of the frame + virtual bool IsOneOfBars(const wxWindow *win) const wxOVERRIDE; + +#if wxUSE_MENUBAR + // override to update menu bar position when the frame size changes + virtual void PositionMenuBar() { } + + // override to do something special when the menu bar is being removed + // from the frame + virtual void DetachMenuBar(); + + // override to do something special when the menu bar is attached to the + // frame + virtual void AttachMenuBar(wxMenuBar *menubar); +#endif // wxUSE_MENUBAR + + // Return true if we should update the menu item state from idle event + // handler or false if we should delay it until the menu is opened. + static bool ShouldUpdateMenuFromIdle(); + +#if wxUSE_MENUBAR + wxMenuBar *m_frameMenuBar; +#endif // wxUSE_MENUBAR + +#if wxUSE_STATUSBAR && (wxUSE_MENUS || wxUSE_TOOLBAR) + // the saved status bar text overwritten by DoGiveHelp() + wxString m_oldStatusText; + + // the last help string we have shown in the status bar + wxString m_lastHelpShown; +#endif + +#if wxUSE_STATUSBAR + // override to update status bar position (or anything else) when + // something changes + virtual void PositionStatusBar() { } + + // show the help string for the given menu item using DoGiveHelp() if the + // given item does have a help string (as determined by FindInMenuBar()), + // return false if there is no help for such item + bool ShowMenuHelp(int helpid); + + wxStatusBar *m_frameStatusBar; +#endif // wxUSE_STATUSBAR + + + int m_statusBarPane; + +#if wxUSE_TOOLBAR + // override to update status bar position (or anything else) when + // something changes + virtual void PositionToolBar() { } + + wxToolBar *m_frameToolBar; +#endif // wxUSE_TOOLBAR + +#if wxUSE_MENUS + wxDECLARE_EVENT_TABLE(); +#endif // wxUSE_MENUS + + wxDECLARE_NO_COPY_CLASS(wxFrameBase); +}; + +// include the real class declaration +#if defined(__WXUNIVERSAL__) + #include "wx/univ/frame.h" +#else // !__WXUNIVERSAL__ + #if defined(__WXMSW__) + #include "wx/msw/frame.h" + #elif defined(__WXGTK20__) + #include "wx/gtk/frame.h" + #elif defined(__WXGTK__) + #include "wx/gtk1/frame.h" + #elif defined(__WXMOTIF__) + #include "wx/motif/frame.h" + #elif defined(__WXMAC__) + #include "wx/osx/frame.h" + #elif defined(__WXQT__) + #include "wx/qt/frame.h" + #endif +#endif + +#endif + // _WX_FRAME_H_BASE_ diff --git a/lib/wxWidgets/include/wx/fs_arc.h b/lib/wxWidgets/include/wx/fs_arc.h new file mode 100644 index 0000000..014270d --- /dev/null +++ b/lib/wxWidgets/include/wx/fs_arc.h @@ -0,0 +1,55 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/fs_arc.h +// Purpose: Archive file system +// Author: Vaclav Slavik, Mike Wetherell +// Copyright: (c) 1999 Vaclav Slavik, (c) 2006 Mike Wetherell +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FS_ARC_H_ +#define _WX_FS_ARC_H_ + +#include "wx/defs.h" + +#if wxUSE_FS_ARCHIVE + +#include "wx/filesys.h" +#include "wx/hashmap.h" + +WX_DECLARE_STRING_HASH_MAP(int, wxArchiveFilenameHashMap); + +//--------------------------------------------------------------------------- +// wxArchiveFSHandler +//--------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxArchiveFSHandler : public wxFileSystemHandler +{ +public: + wxArchiveFSHandler(); + virtual bool CanOpen(const wxString& location) wxOVERRIDE; + virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) wxOVERRIDE; + virtual wxString FindFirst(const wxString& spec, int flags = 0) wxOVERRIDE; + virtual wxString FindNext() wxOVERRIDE; + void Cleanup(); + virtual ~wxArchiveFSHandler(); + +private: + class wxArchiveFSCache *m_cache; + wxFileSystem m_fs; + + // these vars are used by FindFirst/Next: + class wxArchiveFSCacheData *m_Archive; + struct wxArchiveFSEntry *m_FindEntry; + wxString m_Pattern, m_BaseDir, m_ZipFile; + bool m_AllowDirs, m_AllowFiles; + wxArchiveFilenameHashMap *m_DirsFound; + + wxString DoFind(); + + wxDECLARE_NO_COPY_CLASS(wxArchiveFSHandler); + wxDECLARE_DYNAMIC_CLASS(wxArchiveFSHandler); +}; + +#endif // wxUSE_FS_ARCHIVE + +#endif // _WX_FS_ARC_H_ diff --git a/lib/wxWidgets/include/wx/fs_filter.h b/lib/wxWidgets/include/wx/fs_filter.h new file mode 100644 index 0000000..4391921 --- /dev/null +++ b/lib/wxWidgets/include/wx/fs_filter.h @@ -0,0 +1,40 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/fs_filter.h +// Purpose: Filter file system handler +// Author: Mike Wetherell +// Copyright: (c) 2006 Mike Wetherell +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FS_FILTER_H_ +#define _WX_FS_FILTER_H_ + +#include "wx/defs.h" + +#if wxUSE_FILESYSTEM + +#include "wx/filesys.h" + +//--------------------------------------------------------------------------- +// wxFilterFSHandler +//--------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFilterFSHandler : public wxFileSystemHandler +{ +public: + wxFilterFSHandler() : wxFileSystemHandler() { } + virtual ~wxFilterFSHandler() { } + + virtual bool CanOpen(const wxString& location) wxOVERRIDE; + virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) wxOVERRIDE; + + virtual wxString FindFirst(const wxString& spec, int flags = 0) wxOVERRIDE; + virtual wxString FindNext() wxOVERRIDE; + +private: + wxDECLARE_NO_COPY_CLASS(wxFilterFSHandler); +}; + +#endif // wxUSE_FILESYSTEM + +#endif // _WX_FS_FILTER_H_ diff --git a/lib/wxWidgets/include/wx/fs_inet.h b/lib/wxWidgets/include/wx/fs_inet.h new file mode 100644 index 0000000..58b74ab --- /dev/null +++ b/lib/wxWidgets/include/wx/fs_inet.h @@ -0,0 +1,33 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/fs_inet.h +// Purpose: HTTP and FTP file system +// Author: Vaclav Slavik +// Copyright: (c) 1999 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FS_INET_H_ +#define _WX_FS_INET_H_ + +#include "wx/defs.h" + +#if wxUSE_FILESYSTEM && wxUSE_FS_INET && wxUSE_STREAMS && wxUSE_SOCKETS + +#include "wx/filesys.h" + +// ---------------------------------------------------------------------------- +// wxInternetFSHandler +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_NET wxInternetFSHandler : public wxFileSystemHandler +{ + public: + virtual bool CanOpen(const wxString& location) wxOVERRIDE; + virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) wxOVERRIDE; +}; + +#endif + // wxUSE_FILESYSTEM && wxUSE_FS_INET && wxUSE_STREAMS && wxUSE_SOCKETS + +#endif // _WX_FS_INET_H_ + diff --git a/lib/wxWidgets/include/wx/fs_mem.h b/lib/wxWidgets/include/wx/fs_mem.h new file mode 100644 index 0000000..08f879b --- /dev/null +++ b/lib/wxWidgets/include/wx/fs_mem.h @@ -0,0 +1,139 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/fs_mem.h +// Purpose: in-memory file system +// Author: Vaclav Slavik +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FS_MEM_H_ +#define _WX_FS_MEM_H_ + +#include "wx/defs.h" + +#if wxUSE_FILESYSTEM + +#include "wx/filesys.h" + +#include "wx/hashmap.h" + +class wxMemoryFSFile; +WX_DECLARE_STRING_HASH_MAP(wxMemoryFSFile *, wxMemoryFSHash); + +#if wxUSE_GUI + #include "wx/bitmap.h" +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// wxMemoryFSHandlerBase +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMemoryFSHandlerBase : public wxFileSystemHandler +{ +public: + wxMemoryFSHandlerBase(); + virtual ~wxMemoryFSHandlerBase(); + + // Add file to list of files stored in memory. Stored data (bitmap, text or + // raw data) will be copied into private memory stream and available under + // name "memory:" + filename + static void AddFile(const wxString& filename, const wxString& textdata); + static void AddFile(const wxString& filename, const void *binarydata, size_t size); + static void AddFileWithMimeType(const wxString& filename, + const wxString& textdata, + const wxString& mimetype); + static void AddFileWithMimeType(const wxString& filename, + const void *binarydata, size_t size, + const wxString& mimetype); + + // Remove file from memory FS and free occupied memory + static void RemoveFile(const wxString& filename); + + virtual bool CanOpen(const wxString& location) wxOVERRIDE; + virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) wxOVERRIDE; + virtual wxString FindFirst(const wxString& spec, int flags = 0) wxOVERRIDE; + virtual wxString FindNext() wxOVERRIDE; + +protected: + // check that the given file is not already present in m_Hash; logs an + // error and returns false if it does exist + static bool CheckDoesntExist(const wxString& filename); + + // the hash map indexed by the names of the files stored in the memory FS + static wxMemoryFSHash m_Hash; + + // the file name currently being searched for, i.e. the argument of the + // last FindFirst() call or empty string if FindFirst() hasn't been called + // yet + wxString m_findArgument; + + // iterator into m_Hash used by FindFirst/Next(), possibly m_Hash.end() + wxMemoryFSHash::const_iterator m_findIter; +}; + +// ---------------------------------------------------------------------------- +// wxMemoryFSHandler +// ---------------------------------------------------------------------------- + +#if wxUSE_GUI + +// add GUI-only operations to the base class +class WXDLLIMPEXP_CORE wxMemoryFSHandler : public wxMemoryFSHandlerBase +{ +public: + // bring the base class versions into the scope, otherwise they would be + // inaccessible in wxMemoryFSHandler + // (unfortunately "using" can't be used as gcc 2.95 doesn't have it...) + static void AddFile(const wxString& filename, const wxString& textdata) + { + wxMemoryFSHandlerBase::AddFile(filename, textdata); + } + + static void AddFile(const wxString& filename, + const void *binarydata, + size_t size) + { + wxMemoryFSHandlerBase::AddFile(filename, binarydata, size); + } + static void AddFileWithMimeType(const wxString& filename, + const wxString& textdata, + const wxString& mimetype) + { + wxMemoryFSHandlerBase::AddFileWithMimeType(filename, + textdata, + mimetype); + } + static void AddFileWithMimeType(const wxString& filename, + const void *binarydata, size_t size, + const wxString& mimetype) + { + wxMemoryFSHandlerBase::AddFileWithMimeType(filename, + binarydata, size, + mimetype); + } + +#if wxUSE_IMAGE + static void AddFile(const wxString& filename, + const wxImage& image, + wxBitmapType type); + + static void AddFile(const wxString& filename, + const wxBitmap& bitmap, + wxBitmapType type); +#endif // wxUSE_IMAGE + +}; + +#else // !wxUSE_GUI + +// just the same thing as the base class in wxBase +class WXDLLIMPEXP_BASE wxMemoryFSHandler : public wxMemoryFSHandlerBase +{ +}; + +#endif // wxUSE_GUI/!wxUSE_GUI + +#endif // wxUSE_FILESYSTEM + +#endif // _WX_FS_MEM_H_ + diff --git a/lib/wxWidgets/include/wx/fs_zip.h b/lib/wxWidgets/include/wx/fs_zip.h new file mode 100644 index 0000000..197a46a --- /dev/null +++ b/lib/wxWidgets/include/wx/fs_zip.h @@ -0,0 +1,22 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/fs_zip.h +// Purpose: wxZipFSHandler typedef for compatibility +// Author: Mike Wetherell +// Copyright: (c) 2006 Mike Wetherell +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FS_ZIP_H_ +#define _WX_FS_ZIP_H_ + +#include "wx/defs.h" + +#if wxUSE_FS_ZIP + +#include "wx/fs_arc.h" + +typedef wxArchiveFSHandler wxZipFSHandler; + +#endif // wxUSE_FS_ZIP + +#endif // _WX_FS_ZIP_H_ diff --git a/lib/wxWidgets/include/wx/fswatcher.h b/lib/wxWidgets/include/wx/fswatcher.h new file mode 100644 index 0000000..700c92d --- /dev/null +++ b/lib/wxWidgets/include/wx/fswatcher.h @@ -0,0 +1,407 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/fswatcher.h +// Purpose: wxFileSystemWatcherBase +// Author: Bartosz Bekier +// Created: 2009-05-23 +// Copyright: (c) 2009 Bartosz Bekier +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FSWATCHER_BASE_H_ +#define _WX_FSWATCHER_BASE_H_ + +#include "wx/defs.h" + +#if wxUSE_FSWATCHER + +#include "wx/log.h" +#include "wx/event.h" +#include "wx/evtloop.h" +#include "wx/filename.h" +#include "wx/dir.h" +#include "wx/hashmap.h" + +#define wxTRACE_FSWATCHER "fswatcher" + +// ---------------------------------------------------------------------------- +// wxFileSystemWatcherEventType & wxFileSystemWatcherEvent +// ---------------------------------------------------------------------------- + +/** + * Possible types of file system events. + * This is a subset that will work fine an all platforms (actually, we will + * see how it works on Mac). + * + * We got 2 types of error events: + * - warning: these are not fatal and further events can still be generated + * - error: indicates fatal error and causes that no more events will happen + */ +enum +{ + wxFSW_EVENT_CREATE = 0x01, + wxFSW_EVENT_DELETE = 0x02, + wxFSW_EVENT_RENAME = 0x04, + wxFSW_EVENT_MODIFY = 0x08, + wxFSW_EVENT_ACCESS = 0x10, + wxFSW_EVENT_ATTRIB = 0x20, // Currently this is wxGTK-only + + // error events + wxFSW_EVENT_WARNING = 0x40, + wxFSW_EVENT_ERROR = 0x80, + wxFSW_EVENT_ALL = wxFSW_EVENT_CREATE | wxFSW_EVENT_DELETE | + wxFSW_EVENT_RENAME | wxFSW_EVENT_MODIFY | + wxFSW_EVENT_ACCESS | wxFSW_EVENT_ATTRIB | + wxFSW_EVENT_WARNING | wxFSW_EVENT_ERROR +#if defined(wxHAS_INOTIFY) || defined(wxHAVE_FSEVENTS_FILE_NOTIFICATIONS) + ,wxFSW_EVENT_UNMOUNT = 0x2000 +#endif +}; + +// Type of the path watched, used only internally for now. +enum wxFSWPathType +{ + wxFSWPath_None, // Invalid value for an initialized watch. + wxFSWPath_File, // Plain file. + wxFSWPath_Dir, // Watch a directory and the files in it. + wxFSWPath_Tree // Watch a directory and all its children recursively. +}; + +// Type of the warning for the events notifying about them. +enum wxFSWWarningType +{ + wxFSW_WARNING_NONE, + wxFSW_WARNING_GENERAL, + wxFSW_WARNING_OVERFLOW +}; + +/** + * Event containing information about file system change. + */ +class WXDLLIMPEXP_FWD_BASE wxFileSystemWatcherEvent; +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_FSWATCHER, + wxFileSystemWatcherEvent); + +class WXDLLIMPEXP_BASE wxFileSystemWatcherEvent: public wxEvent +{ +public: + // Constructor for any kind of events, also used as default ctor. + wxFileSystemWatcherEvent(int changeType = 0, int watchid = wxID_ANY) : + wxEvent(watchid, wxEVT_FSWATCHER), + m_changeType(changeType), + m_warningType(wxFSW_WARNING_NONE) + { + } + + // Constructor for the error or warning events. + wxFileSystemWatcherEvent(int changeType, + wxFSWWarningType warningType, + const wxString& errorMsg = wxString(), + int watchid = wxID_ANY) : + wxEvent(watchid, wxEVT_FSWATCHER), + m_changeType(changeType), + m_warningType(warningType), + m_errorMsg(errorMsg) + { + } + + // Constructor for the normal events carrying information about the changes. + wxFileSystemWatcherEvent(int changeType, + const wxFileName& path, const wxFileName& newPath, + int watchid = wxID_ANY) : + wxEvent(watchid, wxEVT_FSWATCHER), + m_changeType(changeType), + m_warningType(wxFSW_WARNING_NONE), + m_path(path), + m_newPath(newPath) + + { + } + + /** + * Returns the path at which the event occurred. + */ + const wxFileName& GetPath() const + { + return m_path; + } + + /** + * Sets the path at which the event occurred + */ + void SetPath(const wxFileName& path) + { + m_path = path; + } + + /** + * In case of rename(move?) events, returns the new path related to the + * event. The "new" means newer in the sense of time. In case of other + * events it returns the same path as GetPath(). + */ + const wxFileName& GetNewPath() const + { + return m_newPath; + } + + /** + * Sets the new path related to the event. See above. + */ + void SetNewPath(const wxFileName& path) + { + m_newPath = path; + } + + /** + * Returns the type of file system event that occurred. + */ + int GetChangeType() const + { + return m_changeType; + } + + virtual wxEvent* Clone() const wxOVERRIDE + { + wxFileSystemWatcherEvent* evt = new wxFileSystemWatcherEvent(*this); + evt->m_errorMsg = m_errorMsg.Clone(); + evt->m_path = wxFileName(m_path.GetFullPath().Clone()); + evt->m_newPath = wxFileName(m_newPath.GetFullPath().Clone()); + evt->m_warningType = m_warningType; + return evt; + } + + virtual wxEventCategory GetEventCategory() const wxOVERRIDE + { + // TODO this has to be merged with "similar" categories and changed + return wxEVT_CATEGORY_UNKNOWN; + } + + /** + * Returns if this error is an error event + */ + bool IsError() const + { + return (m_changeType & (wxFSW_EVENT_ERROR | wxFSW_EVENT_WARNING)) != 0; + } + + wxString GetErrorDescription() const + { + return m_errorMsg; + } + + wxFSWWarningType GetWarningType() const + { + return m_warningType; + } + + /** + * Returns a wxString describing an event useful for debugging or testing + */ + wxString ToString() const; + +protected: + int m_changeType; + wxFSWWarningType m_warningType; + wxFileName m_path; + wxFileName m_newPath; + wxString m_errorMsg; +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxFileSystemWatcherEvent); +}; + +typedef void (wxEvtHandler::*wxFileSystemWatcherEventFunction) + (wxFileSystemWatcherEvent&); + +#define wxFileSystemWatcherEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxFileSystemWatcherEventFunction, func) + +#define EVT_FSWATCHER(winid, func) \ + wx__DECLARE_EVT1(wxEVT_FSWATCHER, winid, wxFileSystemWatcherEventHandler(func)) + +// ---------------------------------------------------------------------------- +// wxFileSystemWatcherBase: interface for wxFileSystemWatcher +// ---------------------------------------------------------------------------- + +// Simple container to store information about one watched path. +class wxFSWatchInfo +{ +public: + wxFSWatchInfo() : + m_events(-1), m_type(wxFSWPath_None), m_refcount(-1) + { + } + + wxFSWatchInfo(const wxString& path, + int events, + wxFSWPathType type, + const wxString& filespec = wxString()) : + m_path(path), m_filespec(filespec), m_events(events), m_type(type), + m_refcount(1) + { + } + + const wxString& GetPath() const + { + return m_path; + } + + const wxString& GetFilespec() const { return m_filespec; } + + int GetFlags() const + { + return m_events; + } + + wxFSWPathType GetType() const + { + return m_type; + } + + // Reference counting of watch entries is used to avoid watching the same + // file system path multiple times (this can happen even accidentally, e.g. + // when you have a recursive watch and then decide to watch some file or + // directory under it separately). + int IncRef() + { + return ++m_refcount; + } + + int DecRef() + { + wxASSERT_MSG( m_refcount > 0, wxS("Trying to decrement a zero count") ); + return --m_refcount; + } + +protected: + wxString m_path; + wxString m_filespec; // For tree watches, holds any filespec to apply + int m_events; + wxFSWPathType m_type; + int m_refcount; +}; + +WX_DECLARE_STRING_HASH_MAP(wxFSWatchInfo, wxFSWatchInfoMap); + +/** + * Encapsulation of platform-specific file system event mechanism + */ +class wxFSWatcherImpl; + +/** + * Main entry point for clients interested in file system events. + * Defines interface that can be used to receive that kind of events. + */ +class WXDLLIMPEXP_BASE wxFileSystemWatcherBase: public wxEvtHandler +{ +public: + wxFileSystemWatcherBase(); + + virtual ~wxFileSystemWatcherBase(); + + /** + * Adds path to currently watched files. Any events concerning this + * particular path will be sent to handler. Optionally a filter can be + * specified to receive only events of particular type. + * + * Please note that when adding a dir, immediate children will be watched + * as well. + */ + virtual bool Add(const wxFileName& path, int events = wxFSW_EVENT_ALL); + + /** + * Like above, but recursively adds every file/dir in the tree rooted in + * path. Additionally a file mask can be specified to include only files + * of particular type. + */ + virtual bool AddTree(const wxFileName& path, int events = wxFSW_EVENT_ALL, + const wxString& filespec = wxEmptyString); + + /** + * Removes path from the list of watched paths. + */ + virtual bool Remove(const wxFileName& path); + + /** + * Same as above, but also removes every file belonging to the tree rooted + * at path. + */ + virtual bool RemoveTree(const wxFileName& path); + + /** + * Clears the list of currently watched paths. + */ + virtual bool RemoveAll(); + + /** + * Returns the number of watched paths + */ + int GetWatchedPathsCount() const; + + /** + * Retrieves all watched paths and places them in wxArrayString. Returns + * the number of paths. + * + * TODO think about API here: we need to return more information (like is + * the path watched recursively) + */ + int GetWatchedPaths(wxArrayString* paths) const; + + wxEvtHandler* GetOwner() const + { + return m_owner; + } + + void SetOwner(wxEvtHandler* handler) + { + if (!handler) + m_owner = this; + else + m_owner = handler; + } + + + // This is a semi-private function used by wxWidgets itself only. + // + // Delegates the real work of adding the path to wxFSWatcherImpl::Add() and + // updates m_watches if the new path was successfully added. + bool AddAny(const wxFileName& path, int events, wxFSWPathType type, + const wxString& filespec = wxString()); + +protected: + + static wxString GetCanonicalPath(const wxFileName& path) + { + return path.GetAbsolutePath(); + } + + + wxFSWatchInfoMap m_watches; // path=>wxFSWatchInfo map + wxFSWatcherImpl* m_service; // file system events service + wxEvtHandler* m_owner; // handler for file system events + + friend class wxFSWatcherImpl; +}; + +// include the platform specific file defining wxFileSystemWatcher +// inheriting from wxFileSystemWatcherBase + +#ifdef wxHAS_INOTIFY + #include "wx/unix/fswatcher_inotify.h" + #define wxFileSystemWatcher wxInotifyFileSystemWatcher +#elif defined(wxHAS_KQUEUE) && defined(wxHAVE_FSEVENTS_FILE_NOTIFICATIONS) + #include "wx/unix/fswatcher_kqueue.h" + #include "wx/osx/fswatcher_fsevents.h" + #define wxFileSystemWatcher wxFsEventsFileSystemWatcher +#elif defined(wxHAS_KQUEUE) + #include "wx/unix/fswatcher_kqueue.h" + #define wxFileSystemWatcher wxKqueueFileSystemWatcher +#elif defined(__WINDOWS__) + #include "wx/msw/fswatcher.h" + #define wxFileSystemWatcher wxMSWFileSystemWatcher +#else + #include "wx/generic/fswatcher.h" + #define wxFileSystemWatcher wxPollingFileSystemWatcher +#endif + +#endif // wxUSE_FSWATCHER + +#endif /* _WX_FSWATCHER_BASE_H_ */ diff --git a/lib/wxWidgets/include/wx/gauge.h b/lib/wxWidgets/include/wx/gauge.h new file mode 100644 index 0000000..6e642ce --- /dev/null +++ b/lib/wxWidgets/include/wx/gauge.h @@ -0,0 +1,146 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gauge.h +// Purpose: wxGauge interface +// Author: Vadim Zeitlin +// Modified by: +// Created: 20.02.01 +// Copyright: (c) 1996-2001 wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GAUGE_H_BASE_ +#define _WX_GAUGE_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_GAUGE + +#include "wx/control.h" + +// ---------------------------------------------------------------------------- +// wxGauge style flags +// ---------------------------------------------------------------------------- + +#define wxGA_HORIZONTAL wxHORIZONTAL +#define wxGA_VERTICAL wxVERTICAL + +// Available since Windows 7 only. With this style, the value of gauge will +// reflect on the taskbar button. +#define wxGA_PROGRESS 0x0010 +// Win32 only, is default (and only) on some other platforms +#define wxGA_SMOOTH 0x0020 +// QT only, display current completed percentage (text default format "%p%") +#define wxGA_TEXT 0x0040 + +// GTK and Mac always have native implementation of the indeterminate mode +// wxMSW has native implementation only if comctl32.dll >= 6.00 +#if !defined(__WXGTK20__) && !defined(__WXMAC__) + #define wxGAUGE_EMULATE_INDETERMINATE_MODE 1 +#else + #define wxGAUGE_EMULATE_INDETERMINATE_MODE 0 +#endif + +extern WXDLLIMPEXP_DATA_CORE(const char) wxGaugeNameStr[]; + +class WXDLLIMPEXP_FWD_CORE wxAppProgressIndicator; + +// ---------------------------------------------------------------------------- +// wxGauge: a progress bar +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGaugeBase : public wxControl +{ +public: + wxGaugeBase() : m_rangeMax(0), m_gaugePos(0), +#if wxGAUGE_EMULATE_INDETERMINATE_MODE + m_nDirection(wxRIGHT), +#endif + m_appProgressIndicator(NULL) { } + + virtual ~wxGaugeBase(); + + bool Create(wxWindow *parent, + wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxGaugeNameStr)); + + // determinate mode API + + // set/get the control range + virtual void SetRange(int range); + virtual int GetRange() const; + + virtual void SetValue(int pos); + virtual int GetValue() const; + + // indeterminate mode API + virtual void Pulse(); + + // simple accessors + bool IsVertical() const { return HasFlag(wxGA_VERTICAL); } + + // overridden base class virtuals + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } + + // Deprecated methods not doing anything since a long time. + wxDEPRECATED_MSG("Remove calls to this method, it doesn't do anything") + void SetShadowWidth(int WXUNUSED(w)) { } + + wxDEPRECATED_MSG("Remove calls to this method, it always returns 0") + int GetShadowWidth() const { return 0; } + + wxDEPRECATED_MSG("Remove calls to this method, it doesn't do anything") + void SetBezelFace(int WXUNUSED(w)) { } + + wxDEPRECATED_MSG("Remove calls to this method, it always returns 0") + int GetBezelFace() const { return 0; } + +protected: + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + + // Initialize m_appProgressIndicator if necessary, i.e. if this object has + // wxGA_PROGRESS style. This method is supposed to be called from the + // derived class Create() if it doesn't call the base class Create(), which + // already does it, after initializing the window style and range. + void InitProgressIndicatorIfNeeded(); + + + // the max position + int m_rangeMax; + + // the current position + int m_gaugePos; + +#if wxGAUGE_EMULATE_INDETERMINATE_MODE + int m_nDirection; // can be wxRIGHT or wxLEFT +#endif + + wxAppProgressIndicator *m_appProgressIndicator; + + wxDECLARE_NO_COPY_CLASS(wxGaugeBase); +}; + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/gauge.h" +#elif defined(__WXMSW__) + #include "wx/msw/gauge.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/gauge.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/gauge.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/gauge.h" +#elif defined(__WXMAC__) + #include "wx/osx/gauge.h" +#elif defined(__WXQT__) + #include "wx/qt/gauge.h" +#endif + +#endif // wxUSE_GAUGE + +#endif + // _WX_GAUGE_H_BASE_ diff --git a/lib/wxWidgets/include/wx/gbsizer.h b/lib/wxWidgets/include/wx/gbsizer.h new file mode 100644 index 0000000..3ddb9be --- /dev/null +++ b/lib/wxWidgets/include/wx/gbsizer.h @@ -0,0 +1,341 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gbsizer.h +// Purpose: wxGridBagSizer: A sizer that can lay out items in a grid, +// with items at specified cells, and with the option of row +// and/or column spanning +// +// Author: Robin Dunn +// Created: 03-Nov-2003 +// Copyright: (c) Robin Dunn +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __WXGBSIZER_H__ +#define __WXGBSIZER_H__ + +#include "wx/sizer.h" + + +//--------------------------------------------------------------------------- +// Classes to represent a position in the grid and a size of an item in the +// grid, IOW, the number of rows and columns it occupies. I chose to use these +// instead of wxPoint and wxSize because they are (x,y) and usually pixel +// oriented while grids and tables are usually thought of as (row,col) so some +// confusion would definitely result in using wxPoint... +// +// NOTE: This should probably be refactored to a common RowCol data type which +// is used for this and also for wxGridCellCoords. +//--------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGBPosition +{ +public: + wxGBPosition() : m_row(0), m_col(0) {} + wxGBPosition(int row, int col) : m_row(row), m_col(col) {} + + // default copy ctor and assignment operator are okay. + + int GetRow() const { return m_row; } + int GetCol() const { return m_col; } + void SetRow(int row) { m_row = row; } + void SetCol(int col) { m_col = col; } + + bool operator==(const wxGBPosition& p) const { return m_row == p.m_row && m_col == p.m_col; } + bool operator!=(const wxGBPosition& p) const { return !(*this == p); } + +private: + int m_row; + int m_col; +}; + + +class WXDLLIMPEXP_CORE wxGBSpan +{ +public: + wxGBSpan() { Init(); } + wxGBSpan(int rowspan, int colspan) + { + // Initialize the members to valid values as not doing it may result in + // infinite loop in wxGBSizer code if the user passed 0 for any of + // them, see #12934. + Init(); + + SetRowspan(rowspan); + SetColspan(colspan); + } + + // default copy ctor and assignment operator are okay. + + // Factor constructor creating an invalid wxGBSpan: this is mostly supposed + // to be used as return value for functions returning wxGBSpan in case of + // errors. + static wxGBSpan Invalid() + { + return wxGBSpan(NULL); + } + + int GetRowspan() const { return m_rowspan; } + int GetColspan() const { return m_colspan; } + void SetRowspan(int rowspan) + { + wxCHECK_RET( rowspan > 0, "Row span should be strictly positive" ); + + m_rowspan = rowspan; + } + + void SetColspan(int colspan) + { + wxCHECK_RET( colspan > 0, "Column span should be strictly positive" ); + + m_colspan = colspan; + } + + bool operator==(const wxGBSpan& o) const { return m_rowspan == o.m_rowspan && m_colspan == o.m_colspan; } + bool operator!=(const wxGBSpan& o) const { return !(*this == o); } + +private: + // This private ctor is used by Invalid() only. + wxGBSpan(struct InvalidCtorTag*) + { + m_rowspan = + m_colspan = -1; + } + + void Init() + { + m_rowspan = + m_colspan = 1; + } + + int m_rowspan; + int m_colspan; +}; + + +extern WXDLLIMPEXP_DATA_CORE(const wxGBSpan) wxDefaultSpan; + + +//--------------------------------------------------------------------------- +// wxGBSizerItem +//--------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxGridBagSizer; + + +class WXDLLIMPEXP_CORE wxGBSizerItem : public wxSizerItem +{ +public: + // spacer + wxGBSizerItem( int width, + int height, + const wxGBPosition& pos, + const wxGBSpan& span=wxDefaultSpan, + int flag=0, + int border=0, + wxObject* userData=NULL); + + // window + wxGBSizerItem( wxWindow *window, + const wxGBPosition& pos, + const wxGBSpan& span=wxDefaultSpan, + int flag=0, + int border=0, + wxObject* userData=NULL ); + + // subsizer + wxGBSizerItem( wxSizer *sizer, + const wxGBPosition& pos, + const wxGBSpan& span=wxDefaultSpan, + int flag=0, + int border=0, + wxObject* userData=NULL ); + + // default ctor + wxGBSizerItem(); + + + // Get the grid position of the item + wxGBPosition GetPos() const { return m_pos; } + void GetPos(int& row, int& col) const; + + // Get the row and column spanning of the item + wxGBSpan GetSpan() const { return m_span; } + void GetSpan(int& rowspan, int& colspan) const; + + // If the item is already a member of a sizer then first ensure that there + // is no other item that would intersect with this one at the new + // position, then set the new position. Returns true if the change is + // successful and after the next Layout the item will be moved. + bool SetPos( const wxGBPosition& pos ); + + // If the item is already a member of a sizer then first ensure that there + // is no other item that would intersect with this one with its new + // spanning size, then set the new spanning. Returns true if the change + // is successful and after the next Layout the item will be resized. + bool SetSpan( const wxGBSpan& span ); + + // Returns true if this item and the other item intersect + bool Intersects(const wxGBSizerItem& other); + + // Returns true if the given pos/span would intersect with this item. + bool Intersects(const wxGBPosition& pos, const wxGBSpan& span); + + // Get the row and column of the endpoint of this item + void GetEndPos(int& row, int& col); + + + wxGridBagSizer* GetGBSizer() const { return m_gbsizer; } + void SetGBSizer(wxGridBagSizer* sizer) { m_gbsizer = sizer; } + + +protected: + wxGBPosition m_pos; + wxGBSpan m_span; + wxGridBagSizer* m_gbsizer; // so SetPos/SetSpan can check for intersects + + +private: + wxDECLARE_DYNAMIC_CLASS(wxGBSizerItem); + wxDECLARE_NO_COPY_CLASS(wxGBSizerItem); +}; + + +//--------------------------------------------------------------------------- +// wxGridBagSizer +//--------------------------------------------------------------------------- + + +class WXDLLIMPEXP_CORE wxGridBagSizer : public wxFlexGridSizer +{ +public: + wxGridBagSizer(int vgap = 0, int hgap = 0 ); + + // The Add methods return true if the item was successfully placed at the + // given position, false if something was already there. + wxSizerItem* Add( wxWindow *window, + const wxGBPosition& pos, + const wxGBSpan& span = wxDefaultSpan, + int flag = 0, + int border = 0, + wxObject* userData = NULL ); + wxSizerItem* Add( wxSizer *sizer, + const wxGBPosition& pos, + const wxGBSpan& span = wxDefaultSpan, + int flag = 0, + int border = 0, + wxObject* userData = NULL ); + wxSizerItem* Add( int width, + int height, + const wxGBPosition& pos, + const wxGBSpan& span = wxDefaultSpan, + int flag = 0, + int border = 0, + wxObject* userData = NULL ); + wxSizerItem* Add( wxGBSizerItem *item ); + + + // Get/Set the size used for cells in the grid with no item. + wxSize GetEmptyCellSize() const { return m_emptyCellSize; } + void SetEmptyCellSize(const wxSize& sz) { m_emptyCellSize = sz; } + + // Get the size of the specified cell, including hgap and vgap. Only + // valid after a Layout. + wxSize GetCellSize(int row, int col) const; + + // Get the grid position of the specified item (non-recursive) + wxGBPosition GetItemPosition(wxWindow *window); + wxGBPosition GetItemPosition(wxSizer *sizer); + wxGBPosition GetItemPosition(size_t index); + + // Set the grid position of the specified item. Returns true on success. + // If the move is not allowed (because an item is already there) then + // false is returned. (non-recursive) + bool SetItemPosition(wxWindow *window, const wxGBPosition& pos); + bool SetItemPosition(wxSizer *sizer, const wxGBPosition& pos); + bool SetItemPosition(size_t index, const wxGBPosition& pos); + + // Get the row/col spanning of the specified item (non-recursive) + wxGBSpan GetItemSpan(wxWindow *window); + wxGBSpan GetItemSpan(wxSizer *sizer); + wxGBSpan GetItemSpan(size_t index); + + // Set the row/col spanning of the specified item. Returns true on + // success. If the move is not allowed (because an item is already there) + // then false is returned. (non-recursive) + bool SetItemSpan(wxWindow *window, const wxGBSpan& span); + bool SetItemSpan(wxSizer *sizer, const wxGBSpan& span); + bool SetItemSpan(size_t index, const wxGBSpan& span); + + + // Find the sizer item for the given window or subsizer, returns NULL if + // not found. (non-recursive) + wxGBSizerItem* FindItem(wxWindow* window); + wxGBSizerItem* FindItem(wxSizer* sizer); + + + // Return the sizer item for the given grid cell, or NULL if there is no + // item at that position. (non-recursive) + wxGBSizerItem* FindItemAtPosition(const wxGBPosition& pos); + + + // Return the sizer item located at the point given in pt, or NULL if + // there is no item at that point. The (x,y) coordinates in pt correspond + // to the client coordinates of the window using the sizer for + // layout. (non-recursive) + wxGBSizerItem* FindItemAtPoint(const wxPoint& pt); + + + // Return the sizer item that has a matching user data (it only compares + // pointer values) or NULL if not found. (non-recursive) + wxGBSizerItem* FindItemWithData(const wxObject* userData); + + + // These are what make the sizer do size calculations and layout + virtual wxSize CalcMin() wxOVERRIDE; + virtual void RepositionChildren(const wxSize& minSize) wxOVERRIDE; + + + // Look at all items and see if any intersect (or would overlap) the given + // item. Returns true if so, false if there would be no overlap. If an + // excludeItem is given then it will not be checked for intersection, for + // example it may be the item we are checking the position of. + bool CheckForIntersection(wxGBSizerItem* item, wxGBSizerItem* excludeItem = NULL); + bool CheckForIntersection(const wxGBPosition& pos, const wxGBSpan& span, wxGBSizerItem* excludeItem = NULL); + + + // The Add base class virtuals should not be used with this class, but + // we'll try to make them automatically select a location for the item + // anyway. + virtual wxSizerItem* Add( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual wxSizerItem* Add( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual wxSizerItem* Add( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + + // The Insert and Prepend base class virtuals that are not appropriate for + // this class and should not be used. Their implementation in this class + // simply fails. + virtual wxSizerItem* Add( wxSizerItem *item ); + virtual wxSizerItem* Insert( size_t index, wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual wxSizerItem* Insert( size_t index, wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual wxSizerItem* Insert( size_t index, int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual wxSizerItem* Insert( size_t index, wxSizerItem *item ) wxOVERRIDE; + virtual wxSizerItem* Prepend( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual wxSizerItem* Prepend( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual wxSizerItem* Prepend( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual wxSizerItem* Prepend( wxSizerItem *item ); + + +protected: + wxGBPosition FindEmptyCell(); + void AdjustForOverflow(); + + wxSize m_emptyCellSize; + + +private: + + wxDECLARE_CLASS(wxGridBagSizer); + wxDECLARE_NO_COPY_CLASS(wxGridBagSizer); +}; + +//--------------------------------------------------------------------------- +#endif diff --git a/lib/wxWidgets/include/wx/gdicmn.h b/lib/wxWidgets/include/wx/gdicmn.h new file mode 100644 index 0000000..2f5f8ee --- /dev/null +++ b/lib/wxWidgets/include/wx/gdicmn.h @@ -0,0 +1,1122 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gdicmn.h +// Purpose: Common GDI classes, types and declarations +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GDICMNH__ +#define _WX_GDICMNH__ + +// --------------------------------------------------------------------------- +// headers +// --------------------------------------------------------------------------- + +#include "wx/defs.h" +#include "wx/list.h" +#include "wx/string.h" +#include "wx/fontenc.h" +#include "wx/hashmap.h" +#include "wx/math.h" + +// --------------------------------------------------------------------------- +// forward declarations +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxBitmap; +class WXDLLIMPEXP_FWD_CORE wxBrush; +class WXDLLIMPEXP_FWD_CORE wxColour; +class WXDLLIMPEXP_FWD_CORE wxCursor; +class WXDLLIMPEXP_FWD_CORE wxFont; +class WXDLLIMPEXP_FWD_CORE wxIcon; +class WXDLLIMPEXP_FWD_CORE wxPalette; +class WXDLLIMPEXP_FWD_CORE wxPen; +class WXDLLIMPEXP_FWD_CORE wxRegion; +class WXDLLIMPEXP_FWD_BASE wxString; +class WXDLLIMPEXP_FWD_CORE wxIconBundle; +class WXDLLIMPEXP_FWD_CORE wxPoint; + +// --------------------------------------------------------------------------- +// constants +// --------------------------------------------------------------------------- + +// Bitmap flags +enum wxBitmapType +{ + wxBITMAP_TYPE_INVALID, // should be == 0 for compatibility! + wxBITMAP_TYPE_BMP, + wxBITMAP_TYPE_BMP_RESOURCE, + wxBITMAP_TYPE_RESOURCE = wxBITMAP_TYPE_BMP_RESOURCE, + wxBITMAP_TYPE_ICO, + wxBITMAP_TYPE_ICO_RESOURCE, + wxBITMAP_TYPE_CUR, + wxBITMAP_TYPE_CUR_RESOURCE, + wxBITMAP_TYPE_XBM, + wxBITMAP_TYPE_XBM_DATA, + wxBITMAP_TYPE_XPM, + wxBITMAP_TYPE_XPM_DATA, + wxBITMAP_TYPE_TIFF, + wxBITMAP_TYPE_TIF = wxBITMAP_TYPE_TIFF, + wxBITMAP_TYPE_TIFF_RESOURCE, + wxBITMAP_TYPE_TIF_RESOURCE = wxBITMAP_TYPE_TIFF_RESOURCE, + wxBITMAP_TYPE_GIF, + wxBITMAP_TYPE_GIF_RESOURCE, + wxBITMAP_TYPE_PNG, + wxBITMAP_TYPE_PNG_RESOURCE, + wxBITMAP_TYPE_JPEG, + wxBITMAP_TYPE_JPEG_RESOURCE, + wxBITMAP_TYPE_PNM, + wxBITMAP_TYPE_PNM_RESOURCE, + wxBITMAP_TYPE_PCX, + wxBITMAP_TYPE_PCX_RESOURCE, + wxBITMAP_TYPE_PICT, + wxBITMAP_TYPE_PICT_RESOURCE, + wxBITMAP_TYPE_ICON, + wxBITMAP_TYPE_ICON_RESOURCE, + wxBITMAP_TYPE_ANI, + wxBITMAP_TYPE_IFF, + wxBITMAP_TYPE_TGA, + wxBITMAP_TYPE_MACCURSOR, + wxBITMAP_TYPE_MACCURSOR_RESOURCE, + + wxBITMAP_TYPE_MAX, + wxBITMAP_TYPE_ANY = 50 +}; + +// Polygon filling mode +enum wxPolygonFillMode +{ + wxODDEVEN_RULE = 1, + wxWINDING_RULE +}; + +// Standard cursors +enum wxStockCursor +{ + wxCURSOR_NONE, // should be 0 + wxCURSOR_ARROW, + wxCURSOR_RIGHT_ARROW, + wxCURSOR_BULLSEYE, + wxCURSOR_CHAR, + wxCURSOR_CROSS, + wxCURSOR_HAND, + wxCURSOR_IBEAM, + wxCURSOR_LEFT_BUTTON, + wxCURSOR_MAGNIFIER, + wxCURSOR_MIDDLE_BUTTON, + wxCURSOR_NO_ENTRY, + wxCURSOR_PAINT_BRUSH, + wxCURSOR_PENCIL, + wxCURSOR_POINT_LEFT, + wxCURSOR_POINT_RIGHT, + wxCURSOR_QUESTION_ARROW, + wxCURSOR_RIGHT_BUTTON, + wxCURSOR_SIZENESW, + wxCURSOR_SIZENS, + wxCURSOR_SIZENWSE, + wxCURSOR_SIZEWE, + wxCURSOR_SIZING, + wxCURSOR_SPRAYCAN, + wxCURSOR_WAIT, + wxCURSOR_WATCH, + wxCURSOR_BLANK, +#ifdef __WXGTK__ + wxCURSOR_DEFAULT, // standard X11 cursor +#endif +#ifdef __WXMAC__ + wxCURSOR_COPY_ARROW , // MacOS Theme Plus arrow +#endif +#ifdef __X__ + // Not yet implemented for Windows + wxCURSOR_CROSS_REVERSE, + wxCURSOR_DOUBLE_ARROW, + wxCURSOR_BASED_ARROW_UP, + wxCURSOR_BASED_ARROW_DOWN, +#endif // X11 + wxCURSOR_ARROWWAIT, +#ifdef __WXMAC__ + wxCURSOR_OPEN_HAND, + wxCURSOR_CLOSED_HAND, +#endif + + wxCURSOR_MAX +}; + +#ifndef __WXGTK__ + #define wxCURSOR_DEFAULT wxCURSOR_ARROW +#endif + +#ifndef __WXMAC__ + // TODO CS supply openhand and closedhand cursors + #define wxCURSOR_OPEN_HAND wxCURSOR_HAND + #define wxCURSOR_CLOSED_HAND wxCURSOR_HAND +#endif + +// ---------------------------------------------------------------------------- +// 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 +}; + +// --------------------------------------------------------------------------- +// macros +// --------------------------------------------------------------------------- + +// The difference between wxHAS_IMAGES_IN_RESOURCES and wxHAS_IMAGE_RESOURCES +// is that the former is, historically, only defined under MSW while the latter +// is also defined under macOS, which uses a different resource concept, and +// may be also defined for any other ports where images don't need to be +// embedded into the program text in order to be available during run-time. +#if defined(__WINDOWS__) && wxUSE_WXDIB + #define wxHAS_IMAGES_IN_RESOURCES +#endif + +#if defined(wxHAS_IMAGES_IN_RESOURCES) || defined(__WXOSX__) + #define wxHAS_IMAGE_RESOURCES +#endif + +/* Useful macro for creating icons portably, for example: + + wxIcon *icon = new wxICON(sample); + + expands into: + + wxIcon *icon = new wxIcon("sample"); // On Windows + wxIcon *icon = new wxIcon(sample_xpm); // On wxGTK/Linux + */ + +#ifdef wxHAS_IMAGES_IN_RESOURCES + // Load from a resource + #define wxICON(X) wxIcon(wxT(#X)) +#elif defined(__WXDFB__) + // Initialize from an included XPM + #define wxICON(X) wxIcon( X##_xpm ) +#elif defined(__WXGTK__) + // Initialize from an included XPM + #define wxICON(X) wxIcon( X##_xpm ) +#elif defined(__WXMAC__) + // Initialize from an included XPM + #define wxICON(X) wxIcon( X##_xpm ) +#elif defined(__WXMOTIF__) + // Initialize from an included XPM + #define wxICON(X) wxIcon( X##_xpm ) +#elif defined(__WXX11__) + // Initialize from an included XPM + #define wxICON(X) wxIcon( X##_xpm ) +#elif defined(__WXQT__) + // Initialize from an included XPM + #define wxICON(X) wxIcon( X##_xpm ) +#else + // This will usually mean something on any platform + #define wxICON(X) wxIcon(wxT(#X)) +#endif // platform + +/* Another macro: this one is for portable creation of bitmaps. We assume that + under Unix bitmaps live in XPMs and under Windows they're in resources. + */ + +#if defined(__WINDOWS__) && wxUSE_WXDIB + #define wxBITMAP(name) wxBitmap(wxT(#name), wxBITMAP_TYPE_BMP_RESOURCE) +#elif defined(__WXGTK__) || \ + defined(__WXMOTIF__) || \ + defined(__WXX11__) || \ + defined(__WXMAC__) || \ + defined(__WXDFB__) + // Initialize from an included XPM + #define wxBITMAP(name) wxBitmap(name##_xpm) +#else // other platforms + #define wxBITMAP(name) wxBitmap(name##_xpm, wxBITMAP_TYPE_XPM) +#endif // platform + +// Macro for creating wxBitmap from in-memory PNG data. +// +// It reads PNG data from name_png static byte arrays that can be created using +// e.g. misc/scripts/png2c.py. +// +// This macro exists mostly as a helper for wxBITMAP_PNG() below but also +// because it's slightly more convenient to use than NewFromPNGData() directly. +#define wxBITMAP_PNG_FROM_DATA(name) \ + wxBitmap::NewFromPNGData(name##_png, WXSIZEOF(name##_png)) + +// Similar to wxBITMAP but used for the bitmaps in PNG format. +// +// Under Windows they should be embedded into the resource file using RT_RCDATA +// resource type and under OS X the PNG file with the specified name must be +// available in the resource subdirectory of the bundle. Elsewhere, this is +// exactly the same thing as wxBITMAP_PNG_FROM_DATA() described above. +#ifdef wxHAS_IMAGE_RESOURCES + #define wxBITMAP_PNG(name) wxBitmap(wxS(#name), wxBITMAP_TYPE_PNG_RESOURCE) +#else + #define wxBITMAP_PNG(name) wxBITMAP_PNG_FROM_DATA(name) +#endif + +// =========================================================================== +// classes +// =========================================================================== + +// --------------------------------------------------------------------------- +// wxSize +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSize +{ +public: + // members are public for compatibility, don't use them directly. + int x, y; + + // constructors + wxSize() : x(0), y(0) { } + wxSize(int xx, int yy) : x(xx), y(yy) { } + + // no copy ctor or assignment operator - the defaults are ok + + wxSize& operator+=(const wxSize& sz) { x += sz.x; y += sz.y; return *this; } + wxSize& operator-=(const wxSize& sz) { x -= sz.x; y -= sz.y; return *this; } + wxSize& operator/=(int i) { x /= i; y /= i; return *this; } + wxSize& operator*=(int i) { x *= i; y *= i; return *this; } + wxSize& operator/=(unsigned int i) { x /= i; y /= i; return *this; } + wxSize& operator*=(unsigned int i) { x *= i; y *= i; return *this; } + wxSize& operator/=(long i) { x /= i; y /= i; return *this; } + wxSize& operator*=(long i) { x *= i; y *= i; return *this; } + wxSize& operator/=(unsigned long i) { x /= i; y /= i; return *this; } + wxSize& operator*=(unsigned long i) { x *= i; y *= i; return *this; } + wxSize& operator/=(double i) { x = wxRound(x/i); y = wxRound(y/i); return *this; } + wxSize& operator*=(double i) { x = wxRound(x*i); y = wxRound(y*i); return *this; } + + void IncTo(const wxSize& sz) + { if ( sz.x > x ) x = sz.x; if ( sz.y > y ) y = sz.y; } + void DecTo(const wxSize& sz) + { if ( sz.x < x ) x = sz.x; if ( sz.y < y ) y = sz.y; } + void DecToIfSpecified(const wxSize& sz) + { + if ( sz.x != wxDefaultCoord && sz.x < x ) + x = sz.x; + if ( sz.y != wxDefaultCoord && sz.y < y ) + y = sz.y; + } + + void IncBy(int dx, int dy) { x += dx; y += dy; } + void IncBy(const wxPoint& pt); + void IncBy(const wxSize& sz) { IncBy(sz.x, sz.y); } + void IncBy(int d) { IncBy(d, d); } + + void DecBy(int dx, int dy) { IncBy(-dx, -dy); } + void DecBy(const wxPoint& pt); + void DecBy(const wxSize& sz) { DecBy(sz.x, sz.y); } + void DecBy(int d) { DecBy(d, d); } + + + wxSize& Scale(double xscale, double yscale) + { x = wxRound(x*xscale); y = wxRound(y*yscale); return *this; } + + // accessors + void Set(int xx, int yy) { x = xx; y = yy; } + void SetWidth(int w) { x = w; } + void SetHeight(int h) { y = h; } + + int GetWidth() const { return x; } + int GetHeight() const { return y; } + + bool IsFullySpecified() const { return x != wxDefaultCoord && y != wxDefaultCoord; } + + // combine this size with the other one replacing the default (i.e. equal + // to wxDefaultCoord) components of this object with those of the other + void SetDefaults(const wxSize& size) + { + if ( x == wxDefaultCoord ) + x = size.x; + if ( y == wxDefaultCoord ) + y = size.y; + } + + // compatibility + int GetX() const { return x; } + int GetY() const { return y; } +}; + +inline bool operator==(const wxSize& s1, const wxSize& s2) +{ + return s1.x == s2.x && s1.y == s2.y; +} + +inline bool operator!=(const wxSize& s1, const wxSize& s2) +{ + return s1.x != s2.x || s1.y != s2.y; +} + +inline wxSize operator+(const wxSize& s1, const wxSize& s2) +{ + return wxSize(s1.x + s2.x, s1.y + s2.y); +} + +inline wxSize operator-(const wxSize& s1, const wxSize& s2) +{ + return wxSize(s1.x - s2.x, s1.y - s2.y); +} + +inline wxSize operator/(const wxSize& s, int i) +{ + return wxSize(s.x / i, s.y / i); +} + +inline wxSize operator*(const wxSize& s, int i) +{ + return wxSize(s.x * i, s.y * i); +} + +inline wxSize operator*(int i, const wxSize& s) +{ + return wxSize(s.x * i, s.y * i); +} + +inline wxSize operator/(const wxSize& s, unsigned int i) +{ + return wxSize(s.x / i, s.y / i); +} + +inline wxSize operator*(const wxSize& s, unsigned int i) +{ + return wxSize(s.x * i, s.y * i); +} + +inline wxSize operator*(unsigned int i, const wxSize& s) +{ + return wxSize(s.x * i, s.y * i); +} + +inline wxSize operator/(const wxSize& s, long i) +{ + return wxSize(s.x / i, s.y / i); +} + +inline wxSize operator*(const wxSize& s, long i) +{ + return wxSize(int(s.x * i), int(s.y * i)); +} + +inline wxSize operator*(long i, const wxSize& s) +{ + return wxSize(int(s.x * i), int(s.y * i)); +} + +inline wxSize operator/(const wxSize& s, unsigned long i) +{ + return wxSize(int(s.x / i), int(s.y / i)); +} + +inline wxSize operator*(const wxSize& s, unsigned long i) +{ + return wxSize(int(s.x * i), int(s.y * i)); +} + +inline wxSize operator*(unsigned long i, const wxSize& s) +{ + return wxSize(int(s.x * i), int(s.y * i)); +} + +inline wxSize operator/(const wxSize& s, double i) +{ + return wxSize(wxRound(s.x / i), wxRound(s.y / i)); +} + +inline wxSize operator*(const wxSize& s, double i) +{ + return wxSize(wxRound(s.x * i), wxRound(s.y * i)); +} + +inline wxSize operator*(double i, const wxSize& s) +{ + return wxSize(wxRound(s.x * i), wxRound(s.y * i)); +} + + + +// --------------------------------------------------------------------------- +// Point classes: with real or integer coordinates +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxRealPoint +{ +public: + double x; + double y; + + wxRealPoint() : x(0.0), y(0.0) { } + wxRealPoint(double xx, double yy) : x(xx), y(yy) { } + wxRealPoint(const wxPoint& pt); + + // no copy ctor or assignment operator - the defaults are ok + + //assignment operators + wxRealPoint& operator+=(const wxRealPoint& p) { x += p.x; y += p.y; return *this; } + wxRealPoint& operator-=(const wxRealPoint& p) { x -= p.x; y -= p.y; return *this; } + + wxRealPoint& operator+=(const wxSize& s) { x += s.GetWidth(); y += s.GetHeight(); return *this; } + wxRealPoint& operator-=(const wxSize& s) { x -= s.GetWidth(); y -= s.GetHeight(); return *this; } +}; + + +inline bool operator==(const wxRealPoint& p1, const wxRealPoint& p2) +{ + return wxIsSameDouble(p1.x, p2.x) && wxIsSameDouble(p1.y, p2.y); +} + +inline bool operator!=(const wxRealPoint& p1, const wxRealPoint& p2) +{ + return !(p1 == p2); +} + +inline wxRealPoint operator+(const wxRealPoint& p1, const wxRealPoint& p2) +{ + return wxRealPoint(p1.x + p2.x, p1.y + p2.y); +} + + +inline wxRealPoint operator-(const wxRealPoint& p1, const wxRealPoint& p2) +{ + return wxRealPoint(p1.x - p2.x, p1.y - p2.y); +} + + +inline wxRealPoint operator/(const wxRealPoint& s, int i) +{ + return wxRealPoint(s.x / i, s.y / i); +} + +inline wxRealPoint operator*(const wxRealPoint& s, int i) +{ + return wxRealPoint(s.x * i, s.y * i); +} + +inline wxRealPoint operator*(int i, const wxRealPoint& s) +{ + return wxRealPoint(s.x * i, s.y * i); +} + +inline wxRealPoint operator/(const wxRealPoint& s, unsigned int i) +{ + return wxRealPoint(s.x / i, s.y / i); +} + +inline wxRealPoint operator*(const wxRealPoint& s, unsigned int i) +{ + return wxRealPoint(s.x * i, s.y * i); +} + +inline wxRealPoint operator*(unsigned int i, const wxRealPoint& s) +{ + return wxRealPoint(s.x * i, s.y * i); +} + +inline wxRealPoint operator/(const wxRealPoint& s, long i) +{ + return wxRealPoint(s.x / i, s.y / i); +} + +inline wxRealPoint operator*(const wxRealPoint& s, long i) +{ + return wxRealPoint(s.x * i, s.y * i); +} + +inline wxRealPoint operator*(long i, const wxRealPoint& s) +{ + return wxRealPoint(s.x * i, s.y * i); +} + +inline wxRealPoint operator/(const wxRealPoint& s, unsigned long i) +{ + return wxRealPoint(s.x / i, s.y / i); +} + +inline wxRealPoint operator*(const wxRealPoint& s, unsigned long i) +{ + return wxRealPoint(s.x * i, s.y * i); +} + +inline wxRealPoint operator*(unsigned long i, const wxRealPoint& s) +{ + return wxRealPoint(s.x * i, s.y * i); +} + +inline wxRealPoint operator*(const wxRealPoint& s, double i) +{ + return wxRealPoint(s.x * i, s.y * i); +} + +inline wxRealPoint operator*(double i, const wxRealPoint& s) +{ + return wxRealPoint(s.x * i, s.y * i); +} + + +// ---------------------------------------------------------------------------- +// wxPoint: 2D point with integer coordinates +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPoint +{ +public: + int x, y; + + wxPoint() : x(0), y(0) { } + wxPoint(int xx, int yy) : x(xx), y(yy) { } + wxPoint(const wxRealPoint& pt) : x(wxRound(pt.x)), y(wxRound(pt.y)) { } + + // no copy ctor or assignment operator - the defaults are ok + + //assignment operators + wxPoint& operator+=(const wxPoint& p) { x += p.x; y += p.y; return *this; } + wxPoint& operator-=(const wxPoint& p) { x -= p.x; y -= p.y; return *this; } + + wxPoint& operator+=(const wxSize& s) { x += s.GetWidth(); y += s.GetHeight(); return *this; } + wxPoint& operator-=(const wxSize& s) { x -= s.GetWidth(); y -= s.GetHeight(); return *this; } + + // check if both components are set/initialized + bool IsFullySpecified() const { return x != wxDefaultCoord && y != wxDefaultCoord; } + + // fill in the unset components with the values from the other point + void SetDefaults(const wxPoint& pt) + { + if ( x == wxDefaultCoord ) + x = pt.x; + if ( y == wxDefaultCoord ) + y = pt.y; + } +}; + + +// comparison +inline bool operator==(const wxPoint& p1, const wxPoint& p2) +{ + return p1.x == p2.x && p1.y == p2.y; +} + +inline bool operator!=(const wxPoint& p1, const wxPoint& p2) +{ + return !(p1 == p2); +} + + +// arithmetic operations (component wise) +inline wxPoint operator+(const wxPoint& p1, const wxPoint& p2) +{ + return wxPoint(p1.x + p2.x, p1.y + p2.y); +} + +inline wxPoint operator-(const wxPoint& p1, const wxPoint& p2) +{ + return wxPoint(p1.x - p2.x, p1.y - p2.y); +} + +inline wxPoint operator+(const wxPoint& p, const wxSize& s) +{ + return wxPoint(p.x + s.x, p.y + s.y); +} + +inline wxPoint operator-(const wxPoint& p, const wxSize& s) +{ + return wxPoint(p.x - s.x, p.y - s.y); +} + +inline wxPoint operator+(const wxSize& s, const wxPoint& p) +{ + return wxPoint(p.x + s.x, p.y + s.y); +} + +inline wxPoint operator-(const wxSize& s, const wxPoint& p) +{ + return wxPoint(s.x - p.x, s.y - p.y); +} + +inline wxPoint operator-(const wxPoint& p) +{ + return wxPoint(-p.x, -p.y); +} + +inline wxPoint operator/(const wxPoint& s, int i) +{ + return wxPoint(s.x / i, s.y / i); +} + +inline wxPoint operator*(const wxPoint& s, int i) +{ + return wxPoint(s.x * i, s.y * i); +} + +inline wxPoint operator*(int i, const wxPoint& s) +{ + return wxPoint(s.x * i, s.y * i); +} + +inline wxPoint operator/(const wxPoint& s, unsigned int i) +{ + return wxPoint(s.x / i, s.y / i); +} + +inline wxPoint operator*(const wxPoint& s, unsigned int i) +{ + return wxPoint(s.x * i, s.y * i); +} + +inline wxPoint operator*(unsigned int i, const wxPoint& s) +{ + return wxPoint(s.x * i, s.y * i); +} + +inline wxPoint operator/(const wxPoint& s, long i) +{ + return wxPoint(s.x / i, s.y / i); +} + +inline wxPoint operator*(const wxPoint& s, long i) +{ + return wxPoint(int(s.x * i), int(s.y * i)); +} + +inline wxPoint operator*(long i, const wxPoint& s) +{ + return wxPoint(int(s.x * i), int(s.y * i)); +} + +inline wxPoint operator/(const wxPoint& s, unsigned long i) +{ + return wxPoint(s.x / i, s.y / i); +} + +inline wxPoint operator*(const wxPoint& s, unsigned long i) +{ + return wxPoint(int(s.x * i), int(s.y * i)); +} + +inline wxPoint operator*(unsigned long i, const wxPoint& s) +{ + return wxPoint(int(s.x * i), int(s.y * i)); +} + +inline wxPoint operator*(const wxPoint& s, double i) +{ + return wxPoint(int(s.x * i), int(s.y * i)); +} + +inline wxPoint operator*(double i, const wxPoint& s) +{ + return wxPoint(int(s.x * i), int(s.y * i)); +} + +WX_DECLARE_LIST_WITH_DECL(wxPoint, wxPointList, class WXDLLIMPEXP_CORE); + +// --------------------------------------------------------------------------- +// wxRect +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxRect +{ +public: + wxRect() + : x(0), y(0), width(0), height(0) + { } + wxRect(int xx, int yy, int ww, int hh) + : x(xx), y(yy), width(ww), height(hh) + { } + wxRect(const wxPoint& topLeft, const wxPoint& bottomRight); + wxRect(const wxPoint& pt, const wxSize& size) + : x(pt.x), y(pt.y), width(size.x), height(size.y) + { } + wxRect(const wxSize& size) + : x(0), y(0), width(size.x), height(size.y) + { } + + // default copy ctor and assignment operators ok + + int GetX() const { return x; } + void SetX(int xx) { x = xx; } + + int GetY() const { return y; } + void SetY(int yy) { y = yy; } + + int GetWidth() const { return width; } + void SetWidth(int w) { width = w; } + + int GetHeight() const { return height; } + void SetHeight(int h) { height = h; } + + wxPoint GetPosition() const { return wxPoint(x, y); } + void SetPosition( const wxPoint &p ) { x = p.x; y = p.y; } + + wxSize GetSize() const { return wxSize(width, height); } + void SetSize( const wxSize &s ) { width = s.GetWidth(); height = s.GetHeight(); } + + bool IsEmpty() const { return (width <= 0) || (height <= 0); } + + int GetLeft() const { return x; } + int GetTop() const { return y; } + int GetBottom() const { return y + height - 1; } + int GetRight() const { return x + width - 1; } + + void SetLeft(int left) { x = left; } + void SetRight(int right) { width = right - x + 1; } + void SetTop(int top) { y = top; } + void SetBottom(int bottom) { height = bottom - y + 1; } + + wxPoint GetTopLeft() const { return GetPosition(); } + wxPoint GetLeftTop() const { return GetTopLeft(); } + void SetTopLeft(const wxPoint &p) { SetPosition(p); } + void SetLeftTop(const wxPoint &p) { SetTopLeft(p); } + + wxPoint GetBottomRight() const { return wxPoint(GetRight(), GetBottom()); } + wxPoint GetRightBottom() const { return GetBottomRight(); } + void SetBottomRight(const wxPoint &p) { SetRight(p.x); SetBottom(p.y); } + void SetRightBottom(const wxPoint &p) { SetBottomRight(p); } + + wxPoint GetTopRight() const { return wxPoint(GetRight(), GetTop()); } + wxPoint GetRightTop() const { return GetTopRight(); } + void SetTopRight(const wxPoint &p) { SetRight(p.x); SetTop(p.y); } + void SetRightTop(const wxPoint &p) { SetTopRight(p); } + + wxPoint GetBottomLeft() const { return wxPoint(GetLeft(), GetBottom()); } + wxPoint GetLeftBottom() const { return GetBottomLeft(); } + void SetBottomLeft(const wxPoint &p) { SetLeft(p.x); SetBottom(p.y); } + void SetLeftBottom(const wxPoint &p) { SetBottomLeft(p); } + + // operations with rect + wxRect& Inflate(wxCoord dx, wxCoord dy); + wxRect& Inflate(const wxSize& d) { return Inflate(d.x, d.y); } + wxRect& Inflate(wxCoord d) { return Inflate(d, d); } + wxRect Inflate(wxCoord dx, wxCoord dy) const + { + wxRect r = *this; + r.Inflate(dx, dy); + return r; + } + + wxRect& Deflate(wxCoord dx, wxCoord dy) { return Inflate(-dx, -dy); } + wxRect& Deflate(const wxSize& d) { return Inflate(-d.x, -d.y); } + wxRect& Deflate(wxCoord d) { return Inflate(-d); } + wxRect Deflate(wxCoord dx, wxCoord dy) const + { + wxRect r = *this; + r.Deflate(dx, dy); + return r; + } + + void Offset(wxCoord dx, wxCoord dy) { x += dx; y += dy; } + void Offset(const wxPoint& pt) { Offset(pt.x, pt.y); } + + wxRect& Intersect(const wxRect& rect); + wxRect Intersect(const wxRect& rect) const + { + wxRect r = *this; + r.Intersect(rect); + return r; + } + + wxRect& Union(const wxRect& rect); + wxRect Union(const wxRect& rect) const + { + wxRect r = *this; + r.Union(rect); + return r; + } + + // return true if the point is (not strictly) inside the rect + bool Contains(int x, int y) const; + bool Contains(const wxPoint& pt) const { return Contains(pt.x, pt.y); } + // return true if the rectangle 'rect' is (not strictly) inside this rect + bool Contains(const wxRect& rect) const; + + // return true if the rectangles have a non empty intersection + bool Intersects(const wxRect& rect) const; + + // like Union() but don't ignore empty rectangles + wxRect& operator+=(const wxRect& rect); + + // intersections of two rectangles not testing for empty rectangles + wxRect& operator*=(const wxRect& rect); + + // centre this rectangle in the given (usually, but not necessarily, + // larger) one + wxRect CentreIn(const wxRect& r, int dir = wxBOTH) const + { + return wxRect(dir & wxHORIZONTAL ? r.x + (r.width - width)/2 : x, + dir & wxVERTICAL ? r.y + (r.height - height)/2 : y, + width, height); + } + + wxRect CenterIn(const wxRect& r, int dir = wxBOTH) const + { + return CentreIn(r, dir); + } + +public: + int x, y, width, height; +}; + + +// compare rectangles +inline bool operator==(const wxRect& r1, const wxRect& r2) +{ + return (r1.x == r2.x) && (r1.y == r2.y) && + (r1.width == r2.width) && (r1.height == r2.height); +} + +inline bool operator!=(const wxRect& r1, const wxRect& r2) +{ + return !(r1 == r2); +} + +// like Union() but don't treat empty rectangles specially +WXDLLIMPEXP_CORE wxRect operator+(const wxRect& r1, const wxRect& r2); + +// intersections of two rectangles +WXDLLIMPEXP_CORE wxRect operator*(const wxRect& r1, const wxRect& r2); + +// define functions which couldn't be defined above because of declarations +// order +inline void wxSize::IncBy(const wxPoint& pt) { IncBy(pt.x, pt.y); } +inline void wxSize::DecBy(const wxPoint& pt) { DecBy(pt.x, pt.y); } + +// --------------------------------------------------------------------------- +// Management of pens, brushes and fonts +// --------------------------------------------------------------------------- + +typedef wxInt8 wxDash; + +class WXDLLIMPEXP_CORE wxGDIObjListBase { +public: + wxGDIObjListBase(); + ~wxGDIObjListBase(); + +protected: + wxList list; +}; + +WX_DECLARE_STRING_HASH_MAP(wxColour*, wxStringToColourHashMap); + +class WXDLLIMPEXP_CORE wxColourDatabase +{ +public: + wxColourDatabase(); + ~wxColourDatabase(); + + // find colour by name or name for the given colour + wxColour Find(const wxString& name) const; + wxString FindName(const wxColour& colour) const; + + // add a new colour to the database + void AddColour(const wxString& name, const wxColour& colour); + +private: + // load the database with the built in colour values when called for the + // first time, do nothing after this + void Initialize(); + + wxStringToColourHashMap *m_map; +}; + +class WXDLLIMPEXP_CORE wxResourceCache: public wxList +{ +public: + wxResourceCache() { } +#if !wxUSE_STD_CONTAINERS + wxResourceCache(unsigned int keyType) : wxList(keyType) { } +#endif + virtual ~wxResourceCache(); +}; + +// --------------------------------------------------------------------------- +// global variables +// --------------------------------------------------------------------------- + + +/* Stock objects + + wxStockGDI creates the stock GDI objects on demand. Pointers to the + created objects are stored in the ms_stockObject array, which is indexed + by the Item enum values. Platform-specific fonts can be created by + implementing a derived class with an override for the GetFont function. + wxStockGDI operates as a singleton, accessed through the ms_instance + pointer. By default this pointer is set to an instance of wxStockGDI. + A derived class must arrange to set this pointer to an instance of itself. +*/ +class WXDLLIMPEXP_CORE wxStockGDI +{ +public: + enum Item { + BRUSH_BLACK, + BRUSH_BLUE, + BRUSH_CYAN, + BRUSH_GREEN, + BRUSH_YELLOW, + BRUSH_GREY, + BRUSH_LIGHTGREY, + BRUSH_MEDIUMGREY, + BRUSH_RED, + BRUSH_TRANSPARENT, + BRUSH_WHITE, + COLOUR_BLACK, + COLOUR_BLUE, + COLOUR_CYAN, + COLOUR_GREEN, + COLOUR_YELLOW, + COLOUR_LIGHTGREY, + COLOUR_RED, + COLOUR_WHITE, + CURSOR_CROSS, + CURSOR_HOURGLASS, + CURSOR_STANDARD, + FONT_ITALIC, + FONT_NORMAL, + FONT_SMALL, + FONT_SWISS, + PEN_BLACK, + PEN_BLACKDASHED, + PEN_BLUE, + PEN_CYAN, + PEN_GREEN, + PEN_YELLOW, + PEN_GREY, + PEN_LIGHTGREY, + PEN_MEDIUMGREY, + PEN_RED, + PEN_TRANSPARENT, + PEN_WHITE, + ITEMCOUNT + }; + + wxStockGDI(); + virtual ~wxStockGDI(); + static void DeleteAll(); + + static wxStockGDI& instance() { return *ms_instance; } + + static const wxBrush* GetBrush(Item item); + static const wxColour* GetColour(Item item); + static const wxCursor* GetCursor(Item item); + // Can be overridden by platform-specific derived classes + virtual const wxFont* GetFont(Item item); + static const wxPen* GetPen(Item item); + +protected: + static wxStockGDI* ms_instance; + + static wxObject* ms_stockObject[ITEMCOUNT]; + + wxDECLARE_NO_COPY_CLASS(wxStockGDI); +}; + +#define wxITALIC_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_ITALIC) +#define wxNORMAL_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_NORMAL) +#define wxSMALL_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_SMALL) +#define wxSWISS_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_SWISS) + +#define wxBLACK_DASHED_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLACKDASHED) +#define wxBLACK_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLACK) +#define wxBLUE_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLUE) +#define wxCYAN_PEN wxStockGDI::GetPen(wxStockGDI::PEN_CYAN) +#define wxGREEN_PEN wxStockGDI::GetPen(wxStockGDI::PEN_GREEN) +#define wxYELLOW_PEN wxStockGDI::GetPen(wxStockGDI::PEN_YELLOW) +#define wxGREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_GREY) +#define wxLIGHT_GREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_LIGHTGREY) +#define wxMEDIUM_GREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_MEDIUMGREY) +#define wxRED_PEN wxStockGDI::GetPen(wxStockGDI::PEN_RED) +#define wxTRANSPARENT_PEN wxStockGDI::GetPen(wxStockGDI::PEN_TRANSPARENT) +#define wxWHITE_PEN wxStockGDI::GetPen(wxStockGDI::PEN_WHITE) + +#define wxBLACK_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_BLACK) +#define wxBLUE_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_BLUE) +#define wxCYAN_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_CYAN) +#define wxGREEN_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_GREEN) +#define wxYELLOW_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_YELLOW) +#define wxGREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_GREY) +#define wxLIGHT_GREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_LIGHTGREY) +#define wxMEDIUM_GREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_MEDIUMGREY) +#define wxRED_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_RED) +#define wxTRANSPARENT_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_TRANSPARENT) +#define wxWHITE_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_WHITE) + +#define wxBLACK wxStockGDI::GetColour(wxStockGDI::COLOUR_BLACK) +#define wxBLUE wxStockGDI::GetColour(wxStockGDI::COLOUR_BLUE) +#define wxCYAN wxStockGDI::GetColour(wxStockGDI::COLOUR_CYAN) +#define wxGREEN wxStockGDI::GetColour(wxStockGDI::COLOUR_GREEN) +#define wxYELLOW wxStockGDI::GetColour(wxStockGDI::COLOUR_YELLOW) +#define wxLIGHT_GREY wxStockGDI::GetColour(wxStockGDI::COLOUR_LIGHTGREY) +#define wxRED wxStockGDI::GetColour(wxStockGDI::COLOUR_RED) +#define wxWHITE wxStockGDI::GetColour(wxStockGDI::COLOUR_WHITE) + +#define wxCROSS_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_CROSS) +#define wxHOURGLASS_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_HOURGLASS) +#define wxSTANDARD_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_STANDARD) + +// 'Null' objects +extern WXDLLIMPEXP_DATA_CORE(wxBitmap) wxNullBitmap; +extern WXDLLIMPEXP_DATA_CORE(wxIcon) wxNullIcon; +extern WXDLLIMPEXP_DATA_CORE(wxCursor) wxNullCursor; +extern WXDLLIMPEXP_DATA_CORE(wxPen) wxNullPen; +extern WXDLLIMPEXP_DATA_CORE(wxBrush) wxNullBrush; +extern WXDLLIMPEXP_DATA_CORE(wxPalette) wxNullPalette; +extern WXDLLIMPEXP_DATA_CORE(wxFont) wxNullFont; +extern WXDLLIMPEXP_DATA_CORE(wxColour) wxNullColour; +extern WXDLLIMPEXP_DATA_CORE(wxIconBundle) wxNullIconBundle; + +extern WXDLLIMPEXP_DATA_CORE(wxColourDatabase*) wxTheColourDatabase; + +extern WXDLLIMPEXP_DATA_CORE(const char) wxPanelNameStr[]; + +extern WXDLLIMPEXP_DATA_CORE(const wxSize) wxDefaultSize; +extern WXDLLIMPEXP_DATA_CORE(const wxPoint) wxDefaultPosition; + +// --------------------------------------------------------------------------- +// global functions +// --------------------------------------------------------------------------- + +// resource management +extern void WXDLLIMPEXP_CORE wxInitializeStockLists(); +extern void WXDLLIMPEXP_CORE wxDeleteStockLists(); + +// Note: all the display-related functions here exist for compatibility only, +// please use wxDisplay class in the new code + +// is the display colour (or monochrome)? +extern bool WXDLLIMPEXP_CORE wxColourDisplay(); + +// Returns depth of screen +extern int WXDLLIMPEXP_CORE wxDisplayDepth(); +#define wxGetDisplayDepth wxDisplayDepth + +// get the display size +extern void WXDLLIMPEXP_CORE wxDisplaySize(int *width, int *height); +extern wxSize WXDLLIMPEXP_CORE wxGetDisplaySize(); +extern void WXDLLIMPEXP_CORE wxDisplaySizeMM(int *width, int *height); +extern wxSize WXDLLIMPEXP_CORE wxGetDisplaySizeMM(); +extern wxSize WXDLLIMPEXP_CORE wxGetDisplayPPI(); + +// Get position and size of the display workarea +extern void WXDLLIMPEXP_CORE wxClientDisplayRect(int *x, int *y, int *width, int *height); +extern wxRect WXDLLIMPEXP_CORE wxGetClientDisplayRect(); + +// set global cursor +extern void WXDLLIMPEXP_CORE wxSetCursor(const wxCursor& cursor); + +#endif + // _WX_GDICMNH__ diff --git a/lib/wxWidgets/include/wx/gdiobj.h b/lib/wxWidgets/include/wx/gdiobj.h new file mode 100644 index 0000000..d8e7956 --- /dev/null +++ b/lib/wxWidgets/include/wx/gdiobj.h @@ -0,0 +1,92 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gdiobj.h +// Purpose: wxGDIObject base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GDIOBJ_H_BASE_ +#define _WX_GDIOBJ_H_BASE_ + +#include "wx/object.h" + +// ---------------------------------------------------------------------------- +// wxGDIRefData is the base class for wxXXXData structures which contain the +// real data for the GDI object and are shared among all wxWin objects sharing +// the same native GDI object +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGDIRefData : public wxObjectRefData +{ +public: + // Default ctor which needs to be defined just because we use + // wxDECLARE_NO_COPY_CLASS() below. + wxGDIRefData() { } + + // override this in the derived classes to check if this data object is + // really fully initialized + virtual bool IsOk() const { return true; } + +private: + wxDECLARE_NO_COPY_CLASS(wxGDIRefData); +}; + +// ---------------------------------------------------------------------------- +// wxGDIObject: base class for bitmaps, pens, brushes, ... +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGDIObject : public wxObject +{ +public: + // checks if the object can be used + virtual bool IsOk() const + { + // the cast here is safe because the derived classes always create + // wxGDIRefData objects + return m_refData && static_cast(m_refData)->IsOk(); + } + + // don't use in the new code, use IsOk() instead + bool IsNull() const { return m_refData == NULL; } + + // older version, for backwards compatibility only (but not deprecated + // because it's still widely used) + bool Ok() const { return IsOk(); } + +#if defined(__WXMSW__) + // Creates the resource + virtual bool RealizeResource() { return false; } + + // Frees the resource + virtual bool FreeResource(bool WXUNUSED(force) = false) { return false; } + + virtual bool IsFree() const { return false; } + + // Returns handle. + virtual WXHANDLE GetResourceHandle() const { return NULL; } +#endif // defined(__WXMSW__) + +protected: + // replace base class functions using wxObjectRefData with our own which + // use wxGDIRefData to ensure that we always work with data objects of the + // correct type (i.e. derived from wxGDIRefData) + virtual wxObjectRefData *CreateRefData() const wxOVERRIDE + { + return CreateGDIRefData(); + } + + virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const wxOVERRIDE + { + return CloneGDIRefData(static_cast(data)); + } + + virtual wxGDIRefData *CreateGDIRefData() const = 0; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const = 0; + + wxDECLARE_DYNAMIC_CLASS(wxGDIObject); +}; + +#endif // _WX_GDIOBJ_H_BASE_ diff --git a/lib/wxWidgets/include/wx/generic/aboutdlgg.h b/lib/wxWidgets/include/wx/generic/aboutdlgg.h new file mode 100644 index 0000000..6b363e2 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/aboutdlgg.h @@ -0,0 +1,102 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/aboutdlgg.h +// Purpose: generic wxAboutBox() implementation +// Author: Vadim Zeitlin +// Created: 2006-10-07 +// Copyright: (c) 2006 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_ABOUTDLGG_H_ +#define _WX_GENERIC_ABOUTDLGG_H_ + +#include "wx/defs.h" + +#if wxUSE_ABOUTDLG + +#include "wx/dialog.h" + +class WXDLLIMPEXP_FWD_CORE wxAboutDialogInfo; +class WXDLLIMPEXP_FWD_CORE wxSizer; +class WXDLLIMPEXP_FWD_CORE wxSizerFlags; + +// Under GTK and OS X "About" dialogs are not supposed to be modal, unlike MSW +// and, presumably, all the other platforms. +#ifndef wxUSE_MODAL_ABOUT_DIALOG + #if defined(__WXGTK__) || defined(__WXMAC__) + #define wxUSE_MODAL_ABOUT_DIALOG 0 + #else + #define wxUSE_MODAL_ABOUT_DIALOG 1 + #endif +#endif // wxUSE_MODAL_ABOUT_DIALOG not defined + +// ---------------------------------------------------------------------------- +// wxGenericAboutDialog: generic "About" dialog implementation +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGenericAboutDialog : public wxDialog +{ +public: + // constructors and Create() method + // -------------------------------- + + // default ctor, you must use Create() to really initialize the dialog + wxGenericAboutDialog() { Init(); } + + // ctor which fully initializes the object + wxGenericAboutDialog(const wxAboutDialogInfo& info, wxWindow* parent = NULL) + { + Init(); + + (void)Create(info, parent); + } + + // this method must be called if and only if the default ctor was used + bool Create(const wxAboutDialogInfo& info, wxWindow* parent = NULL); + +protected: + // this virtual method may be overridden to add some more controls to the + // dialog + // + // notice that for this to work you must call Create() from the derived + // class ctor and not use the base class ctor directly as otherwise the + // virtual function of the derived class wouldn't be called + virtual void DoAddCustomControls() { } + + // add arbitrary control to the text sizer contents with the specified + // flags + void AddControl(wxWindow *win, const wxSizerFlags& flags); + + // add arbitrary control to the text sizer contents and center it + void AddControl(wxWindow *win); + + // add the text, if it's not empty, to the text sizer contents + void AddText(const wxString& text); + +#if wxUSE_COLLPANE + // add a wxCollapsiblePane containing the given text + void AddCollapsiblePane(const wxString& title, const wxString& text); +#endif // wxUSE_COLLPANE + +private: + // common part of all ctors + void Init() { m_sizerText = NULL; } + +#if !wxUSE_MODAL_ABOUT_DIALOG + // An explicit handler for deleting the dialog when it's closed is needed + // when we show it non-modally. + void OnCloseWindow(wxCloseEvent& event); + void OnOK(wxCommandEvent& event); +#endif // !wxUSE_MODAL_ABOUT_DIALOG + + wxSizer *m_sizerText; +}; + +// unlike wxAboutBox which can show either the native or generic about dialog, +// this function always shows the generic one +WXDLLIMPEXP_CORE void wxGenericAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL); + +#endif // wxUSE_ABOUTDLG + +#endif // _WX_GENERIC_ABOUTDLGG_H_ + diff --git a/lib/wxWidgets/include/wx/generic/accel.h b/lib/wxWidgets/include/wx/generic/accel.h new file mode 100644 index 0000000..95074b9 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/accel.h @@ -0,0 +1,52 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/accel.h +// Purpose: wxAcceleratorTable class +// Author: Robert Roebling +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_ACCEL_H_ +#define _WX_GENERIC_ACCEL_H_ + +class WXDLLIMPEXP_FWD_CORE wxKeyEvent; + +// ---------------------------------------------------------------------------- +// wxAcceleratorTable +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxAcceleratorTable : public wxObject +{ +public: + wxAcceleratorTable(); + wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]); + + wxDECLARE_DEFAULT_COPY(wxAcceleratorTable) + + virtual ~wxAcceleratorTable(); + + bool Ok() const { return IsOk(); } + bool IsOk() const; + + void Add(const wxAcceleratorEntry& entry); + void Remove(const wxAcceleratorEntry& entry); + + // implementation + // -------------- + + wxMenuItem *GetMenuItem(const wxKeyEvent& event) const; + int GetCommand(const wxKeyEvent& event) const; + + const wxAcceleratorEntry *GetEntry(const wxKeyEvent& event) const; + +protected: + // ref counting code + virtual wxObjectRefData *CreateRefData() const wxOVERRIDE; + virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxAcceleratorTable); +}; + +#endif // _WX_GENERIC_ACCEL_H_ + diff --git a/lib/wxWidgets/include/wx/generic/activityindicator.h b/lib/wxWidgets/include/wx/generic/activityindicator.h new file mode 100644 index 0000000..1fbeb8e --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/activityindicator.h @@ -0,0 +1,67 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/activityindicator.h +// Purpose: Declaration of wxActivityIndicatorGeneric. +// Author: Vadim Zeitlin +// Created: 2015-03-06 +// Copyright: (c) 2015 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_ACTIVITYINDICATOR_H_ +#define _WX_GENERIC_ACTIVITYINDICATOR_H_ + +#ifndef wxHAS_NATIVE_ACTIVITYINDICATOR + // This is the only implementation we have, so call it accordingly. + #define wxActivityIndicatorGeneric wxActivityIndicator +#endif + +// ---------------------------------------------------------------------------- +// wxActivityIndicatorGeneric: built-in generic implementation. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxActivityIndicatorGeneric : public wxActivityIndicatorBase +{ +public: + wxActivityIndicatorGeneric() + { + m_impl = NULL; + } + + explicit + wxActivityIndicatorGeneric(wxWindow* parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxActivityIndicatorNameStr) + { + m_impl = NULL; + + Create(parent, winid, pos, size, style, name); + } + + bool Create(wxWindow* parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxActivityIndicatorNameStr); + + virtual ~wxActivityIndicatorGeneric(); + + virtual void Start() wxOVERRIDE; + virtual void Stop() wxOVERRIDE; + virtual bool IsRunning() const wxOVERRIDE; + +protected: + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + +private: + class wxActivityIndicatorImpl *m_impl; + +#ifndef wxHAS_NATIVE_ACTIVITYINDICATOR + wxDECLARE_DYNAMIC_CLASS(wxActivityIndicator); +#endif +}; + +#endif // _WX_GENERIC_ACTIVITYINDICATOR_H_ diff --git a/lib/wxWidgets/include/wx/generic/animate.h b/lib/wxWidgets/include/wx/generic/animate.h new file mode 100644 index 0000000..0ec40a2 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/animate.h @@ -0,0 +1,148 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/animate.h +// Purpose: wxGenericAnimationCtrl +// 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_GENERIC_ANIMATEH__ +#define _WX_GENERIC_ANIMATEH__ + +#include "wx/bmpbndl.h" + + +// ---------------------------------------------------------------------------- +// wxGenericAnimationCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxGenericAnimationCtrl: public wxAnimationCtrlBase +{ +public: + wxGenericAnimationCtrl() { Init(); } + wxGenericAnimationCtrl(wxWindow *parent, + wxWindowID id, + const wxAnimation& anim = wxNullAnimation, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxAC_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxAnimationCtrlNameStr)) + { + Init(); + + Create(parent, id, anim, pos, size, style, name); + } + + void Init(); + + bool Create(wxWindow *parent, wxWindowID id, + const wxAnimation& anim = wxNullAnimation, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxAC_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxAnimationCtrlNameStr)); + + ~wxGenericAnimationCtrl(); + + +public: + virtual bool LoadFile(const wxString& filename, wxAnimationType type = wxANIMATION_TYPE_ANY) wxOVERRIDE; + virtual bool Load(wxInputStream& stream, wxAnimationType type = wxANIMATION_TYPE_ANY) wxOVERRIDE; + + virtual void Stop() wxOVERRIDE; + virtual bool Play() wxOVERRIDE + { return Play(true /* looped */); } + virtual bool IsPlaying() const wxOVERRIDE + { return m_isPlaying; } + + void SetAnimation(const wxAnimation &animation) wxOVERRIDE; + + virtual void SetInactiveBitmap(const wxBitmapBundle &bmp) wxOVERRIDE; + + // override base class method + virtual bool SetBackgroundColour(const wxColour& col) wxOVERRIDE; + + static wxAnimation CreateCompatibleAnimation(); + +public: // event handlers + + void OnPaint(wxPaintEvent& event); + void OnTimer(wxTimerEvent& event); + void OnSize(wxSizeEvent& event); + +public: // extended API specific to this implementation of wxAnimateCtrl + + // Specify whether the animation's background colour is to be shown (the default), + // or whether the window background should show through + void SetUseWindowBackgroundColour(bool useWinBackground = true) + { m_useWinBackgroundColour = useWinBackground; } + bool IsUsingWindowBackgroundColour() const + { return m_useWinBackgroundColour; } + + // This overload of Play() lets you specify if the animation must loop or not + bool Play(bool looped); + + // Draw the current frame of the animation into given DC. + // This is fast as current frame is always cached. + void DrawCurrentFrame(wxDC& dc); + + // Returns a wxBitmap with the current frame drawn in it + wxBitmap& GetBackingStore() + { return m_backingStore; } + +protected: // internal utilities + virtual wxAnimationImpl* DoCreateAnimationImpl() const wxOVERRIDE; + + // resize this control to fit m_animation + void FitToAnimation(); + + // Draw the background; use this when e.g. previous frame had wxANIM_TOBACKGROUND disposal. + void DisposeToBackground(); + void DisposeToBackground(wxDC& dc); + void DisposeToBackground(wxDC& dc, const wxPoint &pos, const wxSize &sz); + + void IncrementalUpdateBackingStore(); + bool RebuildBackingStoreUpToFrame(unsigned int); + void DrawFrame(wxDC &dc, unsigned int); + + virtual void DisplayStaticImage() wxOVERRIDE; + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + // This function can be used as event handler for wxEVT_DPI_CHANGED event + // and simply calls UpdateStaticImage() to refresh the m_bmpStaticReal when it happens. + void WXHandleDPIChanged(wxDPIChangedEvent& event) + { + UpdateStaticImage(); + + event.Skip(); + } + + // Helpers to safely access methods in the wxAnimationGenericImpl that are + // specific to the generic implementation + wxPoint AnimationImplGetFramePosition(unsigned int frame) const; + wxSize AnimationImplGetFrameSize(unsigned int frame) const; + wxAnimationDisposal AnimationImplGetDisposalMethod(unsigned int frame) const; + wxColour AnimationImplGetTransparentColour(unsigned int frame) const; + wxColour AnimationImplGetBackgroundColour() const; + + +protected: + unsigned int m_currentFrame; // Current frame + bool m_looped; // Looped, or not + wxTimer m_timer; // The timer + + bool m_isPlaying; // Is the animation playing? + bool m_useWinBackgroundColour; // Use animation bg colour or window bg colour? + + wxBitmap m_backingStore; // The frames are drawn here and then blitted + // on the screen + +private: + typedef wxAnimationCtrlBase base_type; + wxDECLARE_DYNAMIC_CLASS(wxGenericAnimationCtrl); + wxDECLARE_EVENT_TABLE(); +}; + +#endif // _WX_GENERIC_ANIMATEH__ diff --git a/lib/wxWidgets/include/wx/generic/bmpcbox.h b/lib/wxWidgets/include/wx/generic/bmpcbox.h new file mode 100644 index 0000000..eaec30a --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/bmpcbox.h @@ -0,0 +1,138 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/bmpcbox.h +// Purpose: wxBitmapComboBox +// Author: Jaakko Salli +// Modified by: +// Created: Aug-30-2006 +// Copyright: (c) Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_BMPCBOX_H_ +#define _WX_GENERIC_BMPCBOX_H_ + + +#define wxGENERIC_BITMAPCOMBOBOX 1 + +#include "wx/odcombo.h" + +// ---------------------------------------------------------------------------- +// wxBitmapComboBox: a wxComboBox that allows images to be shown +// in front of string items. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxBitmapComboBox : public wxOwnerDrawnComboBox, + public wxBitmapComboBoxBase +{ +public: + + // ctors and such + wxBitmapComboBox() : wxOwnerDrawnComboBox(), wxBitmapComboBoxBase() + { + Init(); + } + + wxBitmapComboBox(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, + const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr)) + : wxOwnerDrawnComboBox(), + wxBitmapComboBoxBase() + { + Init(); + + (void)Create(parent, id, value, pos, size, n, + choices, style, validator, name); + } + + wxBitmapComboBox(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + int n, + const wxString choices[], + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr)); + + virtual ~wxBitmapComboBox(); + + virtual wxString GetStringSelection() const wxOVERRIDE; + + // Adds item with image to the end of the combo box. + int Append(const wxString& item, const wxBitmapBundle& bitmap = wxBitmapBundle()); + int Append(const wxString& item, const wxBitmapBundle& bitmap, void *clientData); + int Append(const wxString& item, const wxBitmapBundle& bitmap, wxClientData *clientData); + + // Inserts item with image into the list before pos. Not valid for wxCB_SORT + // styles, use Append instead. + int Insert(const wxString& item, const wxBitmapBundle& bitmap, unsigned int pos); + int Insert(const wxString& item, const wxBitmapBundle& bitmap, + unsigned int pos, void *clientData); + int Insert(const wxString& item, const wxBitmapBundle& bitmap, + unsigned int pos, wxClientData *clientData); + + // Sets the image for the given item. + virtual void SetItemBitmap(unsigned int n, const wxBitmapBundle& bitmap) wxOVERRIDE; + virtual bool SetFont(const wxFont& font) wxOVERRIDE; + +protected: + + virtual void OnDrawBackground(wxDC& dc, const wxRect& rect, int item, int flags) const wxOVERRIDE; + virtual void OnDrawItem(wxDC& dc, const wxRect& rect, int item, int flags) const wxOVERRIDE; + virtual wxCoord OnMeasureItem(size_t item) const wxOVERRIDE; + virtual wxCoord OnMeasureItemWidth(size_t item) const wxOVERRIDE; + + // Event handlers + void OnSize(wxSizeEvent& event); + + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + virtual wxItemContainer* GetItemContainer() wxOVERRIDE { return this; } + virtual wxWindow* GetControl() wxOVERRIDE { return this; } + + // wxItemContainer implementation + virtual int DoInsertItems(const wxArrayStringsAdapter & items, + unsigned int pos, + void **clientData, wxClientDataType type) wxOVERRIDE; + virtual void DoClear() wxOVERRIDE; + virtual void DoDeleteOneItem(unsigned int n) wxOVERRIDE; + +private: + bool m_inResize; + + void Init(); + + wxDECLARE_EVENT_TABLE(); + + wxDECLARE_DYNAMIC_CLASS(wxBitmapComboBox); +}; + +#endif // _WX_GENERIC_BMPCBOX_H_ diff --git a/lib/wxWidgets/include/wx/generic/busyinfo.h b/lib/wxWidgets/include/wx/generic/busyinfo.h new file mode 100644 index 0000000..df1c764 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/busyinfo.h @@ -0,0 +1,56 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/busyinfo.h +// Purpose: Information window (when app is busy) +// Author: Vaclav Slavik +// Copyright: (c) 1999 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BUSYINFO_H_ +#define _WX_BUSYINFO_H_ + +#include "wx/defs.h" + +#if wxUSE_BUSYINFO + +#include "wx/object.h" + +class WXDLLIMPEXP_FWD_CORE wxFrame; +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxControl; + +//-------------------------------------------------------------------------------- +// wxBusyInfo +// Displays progress information +// Can be used in exactly same way as wxBusyCursor +//-------------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBusyInfo : public wxObject +{ +public: + wxBusyInfo(const wxBusyInfoFlags& flags) + { + Init(flags); + } + + wxBusyInfo(const wxString& message, wxWindow *parent = NULL) + { + Init(wxBusyInfoFlags().Parent(parent).Label(message)); + } + + void UpdateText(const wxString& str); + void UpdateLabel(const wxString& str); + + virtual ~wxBusyInfo(); + +private: + void Init(const wxBusyInfoFlags& flags); + + wxFrame *m_InfoFrame; + wxControl *m_text; + + wxDECLARE_NO_COPY_CLASS(wxBusyInfo); +}; + +#endif // wxUSE_BUSYINFO +#endif // _WX_BUSYINFO_H_ diff --git a/lib/wxWidgets/include/wx/generic/buttonbar.h b/lib/wxWidgets/include/wx/generic/buttonbar.h new file mode 100644 index 0000000..2d8d6e0 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/buttonbar.h @@ -0,0 +1,123 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/buttonbar.h +// Purpose: wxButtonToolBar declaration +// Author: Julian Smart, after Robert Roebling, Vadim Zeitlin, SciTech +// Modified by: +// Created: 2006-04-13 +// Copyright: (c) Julian Smart, Robert Roebling, Vadim Zeitlin, +// SciTech Software, Inc. +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BUTTONBAR_H_ +#define _WX_BUTTONBAR_H_ + +#include "wx/bmpbuttn.h" +#include "wx/toolbar.h" + +class WXDLLIMPEXP_FWD_CORE wxButtonToolBarTool; + +// ---------------------------------------------------------------------------- +// wxButtonToolBar +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxButtonToolBar : public wxToolBarBase +{ +public: + // construction/destruction + wxButtonToolBar() { Init(); } + wxButtonToolBar(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxToolBarNameStr)) + { + Init(); + + Create(parent, id, pos, size, style, name); + } + + bool Create( wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxToolBarNameStr) ); + + virtual ~wxButtonToolBar(); + + virtual bool Realize() wxOVERRIDE; + + virtual void SetToolShortHelp(int id, const wxString& helpString) wxOVERRIDE; + virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const wxOVERRIDE; + +protected: + // common part of all ctors + void Init(); + + // implement base class pure virtuals + virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE; + virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE; + + virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable) wxOVERRIDE; + virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle) wxOVERRIDE; + virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle) wxOVERRIDE; + + virtual wxToolBarToolBase *CreateTool(int id, + const wxString& label, + const wxBitmapBundle& bmpNormal, + const wxBitmapBundle& bmpDisabled, + wxItemKind kind, + wxObject *clientData, + const wxString& shortHelp, + const wxString& longHelp) wxOVERRIDE; + virtual wxToolBarToolBase *CreateTool(wxControl *control, + const wxString& label) wxOVERRIDE; + + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + + // calculate layout + void DoLayout(); + + // get the bounding rect for the given tool + wxRect GetToolRect(wxToolBarToolBase *tool) const; + + // get the rect limits depending on the orientation: top/bottom for a + // vertical toolbar, left/right for a horizontal one + void GetRectLimits(const wxRect& rect, wxCoord *start, wxCoord *end) const; + + // receives button commands + void OnCommand(wxCommandEvent& event); + + // paints a border + void OnPaint(wxPaintEvent& event); + + // detects mouse clicks outside buttons + void OnLeftUp(wxMouseEvent& event); + +private: + // have we calculated the positions of our tools? + bool m_needsLayout; + + // the width of a separator + wxCoord m_widthSeparator; + + // the total size of all toolbar elements + wxCoord m_maxWidth, + m_maxHeight; + + // the height of a label + int m_labelHeight; + + // the space above the label + int m_labelMargin; + +private: + wxDECLARE_DYNAMIC_CLASS(wxButtonToolBar); + wxDECLARE_EVENT_TABLE(); +}; + +#endif + // _WX_BUTTONBAR_H_ + diff --git a/lib/wxWidgets/include/wx/generic/calctrlg.h b/lib/wxWidgets/include/wx/generic/calctrlg.h new file mode 100644 index 0000000..8f829e6 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/calctrlg.h @@ -0,0 +1,320 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/calctrlg.h +// Purpose: generic implementation of date-picker control +// Author: Vadim Zeitlin +// Modified by: +// Created: 29.12.99 +// Copyright: (c) 1999 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_CALCTRLG_H +#define _WX_GENERIC_CALCTRLG_H + +#include "wx/control.h" // the base class +#include "wx/dcclient.h" // for wxPaintDC + +class WXDLLIMPEXP_FWD_CORE wxChoice; +// Not used here any more, but still declared for backwards compatibility. +class WXDLLIMPEXP_FWD_CORE wxComboBox; +class WXDLLIMPEXP_FWD_CORE wxStaticText; +class WXDLLIMPEXP_FWD_CORE wxSpinCtrl; +class WXDLLIMPEXP_FWD_CORE wxSpinEvent; + +// ---------------------------------------------------------------------------- +// wxGenericCalendarCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxGenericCalendarCtrl : public wxCalendarCtrlBase +{ +public: + // construction + wxGenericCalendarCtrl() { Init(); } + wxGenericCalendarCtrl(wxWindow *parent, + wxWindowID id, + const wxDateTime& date = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCAL_SHOW_HOLIDAYS, + const wxString& name = wxASCII_STR(wxCalendarNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxDateTime& date = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCAL_SHOW_HOLIDAYS, + const wxString& name = wxASCII_STR(wxCalendarNameStr)); + + virtual ~wxGenericCalendarCtrl(); + + virtual bool Destroy() wxOVERRIDE; + + // set/get the current date + // ------------------------ + + virtual bool SetDate(const wxDateTime& date) wxOVERRIDE; + virtual wxDateTime GetDate() const wxOVERRIDE { return m_date; } + + + // set/get the range in which selection can occur + // --------------------------------------------- + + virtual bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime, + const wxDateTime& upperdate = wxDefaultDateTime) wxOVERRIDE; + + virtual bool GetDateRange(wxDateTime *lowerdate, wxDateTime *upperdate) const wxOVERRIDE; + + // these functions are for generic version only, don't use them but use the + // Set/GetDateRange() above instead + bool SetLowerDateLimit(const wxDateTime& date = wxDefaultDateTime); + const wxDateTime& GetLowerDateLimit() const { return m_lowdate; } + bool SetUpperDateLimit(const wxDateTime& date = wxDefaultDateTime); + const wxDateTime& GetUpperDateLimit() const { return m_highdate; } + + + // calendar mode + // ------------- + + // some calendar styles can't be changed after the control creation by + // just using SetWindowStyle() and Refresh() and the functions below + // should be used instead for them + + // corresponds to wxCAL_NO_MONTH_CHANGE bit + virtual bool EnableMonthChange(bool enable = true) wxOVERRIDE; + + // corresponds to wxCAL_NO_YEAR_CHANGE bit, deprecated, generic only + void EnableYearChange(bool enable = true); + + + // customization + // ------------- + + virtual void Mark(size_t day, bool mark) wxOVERRIDE; + + // all other functions in this section are for generic version only + + // header colours are used for painting the weekdays at the top + virtual void SetHeaderColours(const wxColour& colFg, const wxColour& colBg) wxOVERRIDE + { + m_colHeaderFg = colFg; + m_colHeaderBg = colBg; + } + + virtual const wxColour& GetHeaderColourFg() const wxOVERRIDE { return m_colHeaderFg; } + virtual const wxColour& GetHeaderColourBg() const wxOVERRIDE { return m_colHeaderBg; } + + // highlight colour is used for the currently selected date + virtual void SetHighlightColours(const wxColour& colFg, const wxColour& colBg) wxOVERRIDE + { + m_colHighlightFg = colFg; + m_colHighlightBg = colBg; + } + + virtual const wxColour& GetHighlightColourFg() const wxOVERRIDE { return m_colHighlightFg; } + virtual const wxColour& GetHighlightColourBg() const wxOVERRIDE { return m_colHighlightBg; } + + // holiday colour is used for the holidays (if style & wxCAL_SHOW_HOLIDAYS) + virtual void SetHolidayColours(const wxColour& colFg, const wxColour& colBg) wxOVERRIDE + { + m_colHolidayFg = colFg; + m_colHolidayBg = colBg; + } + + virtual const wxColour& GetHolidayColourFg() const wxOVERRIDE { return m_colHolidayFg; } + virtual const wxColour& GetHolidayColourBg() const wxOVERRIDE { return m_colHolidayBg; } + + virtual wxCalendarDateAttr *GetAttr(size_t day) const wxOVERRIDE + { + wxCHECK_MSG( day > 0 && day < 32, NULL, wxT("invalid day") ); + + return m_attrs[day - 1]; + } + + virtual void SetAttr(size_t day, wxCalendarDateAttr *attr) wxOVERRIDE + { + wxCHECK_RET( day > 0 && day < 32, wxT("invalid day") ); + + delete m_attrs[day - 1]; + m_attrs[day - 1] = attr; + } + + virtual void ResetAttr(size_t day) wxOVERRIDE { SetAttr(day, NULL); } + + virtual void SetHoliday(size_t day) wxOVERRIDE; + + virtual wxCalendarHitTestResult HitTest(const wxPoint& pos, + wxDateTime *date = NULL, + wxDateTime::WeekDay *wd = NULL) wxOVERRIDE; + + // implementation only from now on + // ------------------------------- + + // forward these functions to all subcontrols + virtual bool Enable(bool enable = true) wxOVERRIDE; + virtual bool Show(bool show = true) wxOVERRIDE; + + virtual void SetWindowStyleFlag(long style) wxOVERRIDE; + + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE + { return GetClassDefaultAttributes(GetWindowVariant()); } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + void OnSysColourChanged(wxSysColourChangedEvent& event); + +protected: + // override some base class virtuals + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; + +private: + // common part of all ctors + void Init(); + + // startup colours and reinitialization after colour changes in system + void InitColours(); + + // event handlers + void OnPaint(wxPaintEvent& event); + void OnClick(wxMouseEvent& event); + void OnDClick(wxMouseEvent& event); + void OnWheel(wxMouseEvent& event); + void OnChar(wxKeyEvent& event); + void OnMonthChange(wxCommandEvent& event); + + void HandleYearChange(wxCommandEvent& event); + void OnYearChange(wxSpinEvent& event); + void OnYearTextChange(wxCommandEvent& event); + + // (re)calc m_widthCol and m_heightRow + void RecalcGeometry(); + + // set the date and send the notification + void SetDateAndNotify(const wxDateTime& date); + + // get the week (row, in range 1..6) for the given date + size_t GetWeek(const wxDateTime& date) const; + + // get the date from which we start drawing days + wxDateTime GetStartDate() const; + + // get the first/last days of the week corresponding to the current style + wxDateTime::WeekDay GetWeekStart() const + { + return WeekStartsOnMonday() ? wxDateTime::Mon + : wxDateTime::Sun; + } + + wxDateTime::WeekDay GetWeekEnd() const + { + return WeekStartsOnMonday() ? wxDateTime::Sun + : wxDateTime::Sat; + } + + + // is this date shown? + bool IsDateShown(const wxDateTime& date) const; + + // is this date in the currently allowed range? + bool IsDateInRange(const wxDateTime& date) const; + + // adjust the date to the currently allowed range, return true if it was + // changed + bool AdjustDateToRange(wxDateTime *date) const; + + // redraw the given date + void RefreshDate(const wxDateTime& date); + + // change the date inside the same month/year + void ChangeDay(const wxDateTime& date); + + // deprecated + bool AllowYearChange() const + { + return !(GetWindowStyle() & wxCAL_NO_YEAR_CHANGE); + } + + // show the correct controls + void ShowCurrentControls(); + + // create the month choice and year spin controls: the name is misleading + // (it should be called CreateMonthChoice()) but preserved for compatibility + void CreateMonthComboBox(); + void CreateYearSpinCtrl(); + +public: + // get the currently shown control for month/year + wxControl *GetMonthControl() const; + wxControl *GetYearControl() const; + +private: + virtual void ResetHolidayAttrs() wxOVERRIDE; + virtual void RefreshHolidays() wxOVERRIDE { Refresh(); } + + // OnPaint helper-methods + + // Highlight the [fromdate : todate] range using pen and brush + void HighlightRange(wxPaintDC* dc, const wxDateTime& fromdate, const wxDateTime& todate, const wxPen* pen, const wxBrush* brush); + + // Get the "coordinates" for the date relative to the month currently displayed. + // using (day, week): upper left coord is (1, 1), lower right coord is (7, 6) + // if the date isn't visible (-1, -1) is put in (day, week) and false is returned + bool GetDateCoord(const wxDateTime& date, int *day, int *week) const; + + // Set the flag for SetDate(): otherwise it would overwrite the year + // typed in by the user + void SetUserChangedYear() { m_userChangedYear = true; } + + + // the subcontrols + wxStaticText *m_staticMonth; + wxChoice *m_choiceMonth; + + wxStaticText *m_staticYear; + wxSpinCtrl *m_spinYear; + + // the current selection + wxDateTime m_date; + + // the date-range + wxDateTime m_lowdate; + wxDateTime m_highdate; + + // default attributes + wxColour m_colHighlightFg, + m_colHighlightBg, + m_colHolidayFg, + m_colHolidayBg, + m_colHeaderFg, + m_colHeaderBg, + m_colBackground, + m_colSurrounding; + + // the attributes for each of the month days + wxCalendarDateAttr *m_attrs[31]; + + // the width and height of one column/row in the calendar + wxCoord m_widthCol, + m_heightRow, + m_rowOffset, + m_calendarWeekWidth; + + wxRect m_leftArrowRect, + m_rightArrowRect; + + // the week day names + wxString m_weekdays[7]; + + // true if SetDate() is being called as the result of changing the year in + // the year control + bool m_userChangedYear; + + wxDECLARE_DYNAMIC_CLASS(wxGenericCalendarCtrl); + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxGenericCalendarCtrl); +}; + +#endif // _WX_GENERIC_CALCTRLG_H diff --git a/lib/wxWidgets/include/wx/generic/caret.h b/lib/wxWidgets/include/wx/generic/caret.h new file mode 100644 index 0000000..7223983 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/caret.h @@ -0,0 +1,86 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/caret.h +// Purpose: generic wxCaret class +// Author: Vadim Zeitlin (original code by Robert Roebling) +// Modified by: +// Created: 25.05.99 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CARET_H_ +#define _WX_CARET_H_ + +#include "wx/timer.h" +#include "wx/dc.h" +#include "wx/overlay.h" + +class WXDLLIMPEXP_FWD_CORE wxCaret; + +class WXDLLIMPEXP_CORE wxCaretTimer : public wxTimer +{ +public: + wxCaretTimer(wxCaret *caret); + virtual void Notify() wxOVERRIDE; + +private: + wxCaret *m_caret; +}; + +class WXDLLIMPEXP_CORE wxCaret : public wxCaretBase +{ +public: + // ctors + // ----- + // default - use Create() + wxCaret() : m_timer(this) { InitGeneric(); } + // creates a block caret associated with the given window + wxCaret(wxWindowBase *window, int width, int height) + : wxCaretBase(window, width, height), m_timer(this) { InitGeneric(); } + wxCaret(wxWindowBase *window, const wxSize& size) + : wxCaretBase(window, size), m_timer(this) { InitGeneric(); } + + virtual ~wxCaret(); + + // implementation + // -------------- + + // called by wxWindow (not using the event tables) + virtual void OnSetFocus() wxOVERRIDE; + virtual void OnKillFocus() wxOVERRIDE; + + // called by wxCaretTimer + void OnTimer(); + +protected: + virtual void DoShow() wxOVERRIDE; + virtual void DoHide() wxOVERRIDE; + virtual void DoMove() wxOVERRIDE; + virtual void DoSize() wxOVERRIDE; + + // blink the caret once + void Blink(); + + // refresh the caret + void Refresh(); + + // draw the caret on the given DC + void DoDraw(wxDC *dc, wxWindow* win); + +private: + // GTK specific initialization + void InitGeneric(); + + // the overlay for displaying the caret + wxOverlay m_overlay; + // the bitmap holding the part of window hidden by the caret when it was + // at (m_xOld, m_yOld) + wxBitmap m_bmpUnderCaret; + int m_xOld, + m_yOld; + wxCaretTimer m_timer; + bool m_blinkedOut, // true => caret hidden right now + m_hasFocus; // true => our window has focus +}; + +#endif // _WX_CARET_H_ diff --git a/lib/wxWidgets/include/wx/generic/choicdgg.h b/lib/wxWidgets/include/wx/generic/choicdgg.h new file mode 100644 index 0000000..152b581 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/choicdgg.h @@ -0,0 +1,454 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/choicdgg.h +// Purpose: Generic choice dialogs +// Author: Julian Smart +// Modified by: 03.11.00: VZ to add wxArrayString and multiple sel functions +// Created: 01/02/97 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_CHOICDGG_H_ +#define _WX_GENERIC_CHOICDGG_H_ + +#include "wx/dynarray.h" +#include "wx/dialog.h" + +class WXDLLIMPEXP_FWD_CORE wxListBoxBase; + +// ---------------------------------------------------------------------------- +// some (ugly...) constants +// ---------------------------------------------------------------------------- + +#define wxCHOICE_HEIGHT 150 +#define wxCHOICE_WIDTH 200 + +#define wxCHOICEDLG_STYLE \ + (wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE) + +// ---------------------------------------------------------------------------- +// wxAnyChoiceDialog: a base class for dialogs containing a listbox +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxAnyChoiceDialog : public wxDialog +{ +public: + wxAnyChoiceDialog() : m_listbox(NULL) { } + + wxAnyChoiceDialog(wxWindow *parent, + const wxString& message, + const wxString& caption, + int n, const wxString *choices, + long styleDlg = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition, + long styleLbox = wxLB_ALWAYS_SB) + { + (void)Create(parent, message, caption, n, choices, + styleDlg, pos, styleLbox); + } + wxAnyChoiceDialog(wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + long styleDlg = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition, + long styleLbox = wxLB_ALWAYS_SB) + { + (void)Create(parent, message, caption, choices, + styleDlg, pos, styleLbox); + } + + bool Create(wxWindow *parent, + const wxString& message, + const wxString& caption, + int n, const wxString *choices, + long styleDlg = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition, + long styleLbox = wxLB_ALWAYS_SB); + bool Create(wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + long styleDlg = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition, + long styleLbox = wxLB_ALWAYS_SB); + +protected: + wxListBoxBase *m_listbox; + + virtual wxListBoxBase *CreateList(int n, + const wxString *choices, + long styleLbox); + + wxDECLARE_NO_COPY_CLASS(wxAnyChoiceDialog); +}; + +// ---------------------------------------------------------------------------- +// wxSingleChoiceDialog: a dialog with single selection listbox +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSingleChoiceDialog : public wxAnyChoiceDialog +{ +public: + wxSingleChoiceDialog() + { + m_selection = -1; + } + + wxSingleChoiceDialog(wxWindow *parent, + const wxString& message, + const wxString& caption, + int n, + const wxString *choices, + void **clientData = NULL, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition) + { + Create(parent, message, caption, n, choices, clientData, style, pos); + } + + wxSingleChoiceDialog(wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + void **clientData = NULL, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition) + { + Create(parent, message, caption, choices, clientData, style, pos); + } + + bool Create(wxWindow *parent, + const wxString& message, + const wxString& caption, + int n, + const wxString *choices, + void **clientData = NULL, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition); + bool Create(wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + void **clientData = NULL, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition); + + void SetSelection(int sel); + int GetSelection() const { return m_selection; } + wxString GetStringSelection() const { return m_stringSelection; } + void* GetSelectionData() const { return m_clientData; } + +#if WXWIN_COMPATIBILITY_2_8 + // Deprecated overloads taking "char**" client data. + wxDEPRECATED_CONSTRUCTOR + ( + wxSingleChoiceDialog(wxWindow *parent, + const wxString& message, + const wxString& caption, + int n, + const wxString *choices, + char **clientData, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition) + ) + { + Create(parent, message, caption, n, choices, + (void**)clientData, style, pos); + } + + wxDEPRECATED_CONSTRUCTOR + ( + wxSingleChoiceDialog(wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + char **clientData, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition) + ) + { + Create(parent, message, caption, choices, + (void**)clientData, style, pos); + } + + wxDEPRECATED_INLINE + ( + bool Create(wxWindow *parent, + const wxString& message, + const wxString& caption, + int n, + const wxString *choices, + char **clientData, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition), + return Create(parent, message, caption, n, choices, + (void**)clientData, style, pos); + ) + + wxDEPRECATED_INLINE + ( + bool Create(wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + char **clientData, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition), + return Create(parent, message, caption, choices, + (void**)clientData, style, pos); + ) + + // NB: no need to make it return wxChar, it's untyped + wxDEPRECATED_ACCESSOR + ( + char* GetSelectionClientData() const, + (char*)GetSelectionData() + ) +#endif // WXWIN_COMPATIBILITY_2_8 + + // implementation from now on + void OnOK(wxCommandEvent& event); + void OnListBoxDClick(wxCommandEvent& event); + +protected: + int m_selection; + wxString m_stringSelection; + + void DoChoice(); + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxSingleChoiceDialog); + wxDECLARE_EVENT_TABLE(); +}; + +// ---------------------------------------------------------------------------- +// wxMultiChoiceDialog: a dialog with multi selection listbox +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMultiChoiceDialog : public wxAnyChoiceDialog +{ +public: + wxMultiChoiceDialog() { } + + wxMultiChoiceDialog(wxWindow *parent, + const wxString& message, + const wxString& caption, + int n, + const wxString *choices, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition) + { + (void)Create(parent, message, caption, n, choices, style, pos); + } + wxMultiChoiceDialog(wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition) + { + (void)Create(parent, message, caption, choices, style, pos); + } + + bool Create(wxWindow *parent, + const wxString& message, + const wxString& caption, + int n, + const wxString *choices, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition); + bool Create(wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition); + + void SetSelections(const wxArrayInt& selections); + wxArrayInt GetSelections() const { return m_selections; } + + // implementation from now on + virtual bool TransferDataFromWindow() wxOVERRIDE; + +protected: +#if wxUSE_CHECKLISTBOX + virtual wxListBoxBase *CreateList(int n, + const wxString *choices, + long styleLbox) wxOVERRIDE; +#endif // wxUSE_CHECKLISTBOX + + wxArrayInt m_selections; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMultiChoiceDialog); +}; + +// ---------------------------------------------------------------------------- +// wrapper functions which can be used to get selection(s) from the user +// ---------------------------------------------------------------------------- + +// get the user selection as a string +WXDLLIMPEXP_CORE wxString wxGetSingleChoice(const wxString& message, + const wxString& caption, + const wxArrayString& choices, + wxWindow *parent = NULL, + int x = wxDefaultCoord, + int y = wxDefaultCoord, + bool centre = true, + int width = wxCHOICE_WIDTH, + int height = wxCHOICE_HEIGHT, + int initialSelection = 0); + +WXDLLIMPEXP_CORE wxString wxGetSingleChoice(const wxString& message, + const wxString& caption, + int n, const wxString *choices, + wxWindow *parent = NULL, + int x = wxDefaultCoord, + int y = wxDefaultCoord, + bool centre = true, + int width = wxCHOICE_WIDTH, + int height = wxCHOICE_HEIGHT, + int initialSelection = 0); + +WXDLLIMPEXP_CORE wxString wxGetSingleChoice(const wxString& message, + const wxString& caption, + const wxArrayString& choices, + int initialSelection, + wxWindow *parent = NULL); + +WXDLLIMPEXP_CORE wxString wxGetSingleChoice(const wxString& message, + const wxString& caption, + int n, const wxString *choices, + int initialSelection, + wxWindow *parent = NULL); + +// Same as above but gets position in list of strings, instead of string, +// or -1 if no selection +WXDLLIMPEXP_CORE int wxGetSingleChoiceIndex(const wxString& message, + const wxString& caption, + const wxArrayString& choices, + wxWindow *parent = NULL, + int x = wxDefaultCoord, + int y = wxDefaultCoord, + bool centre = true, + int width = wxCHOICE_WIDTH, + int height = wxCHOICE_HEIGHT, + int initialSelection = 0); + +WXDLLIMPEXP_CORE int wxGetSingleChoiceIndex(const wxString& message, + const wxString& caption, + int n, const wxString *choices, + wxWindow *parent = NULL, + int x = wxDefaultCoord, + int y = wxDefaultCoord, + bool centre = true, + int width = wxCHOICE_WIDTH, + int height = wxCHOICE_HEIGHT, + int initialSelection = 0); + +WXDLLIMPEXP_CORE int wxGetSingleChoiceIndex(const wxString& message, + const wxString& caption, + const wxArrayString& choices, + int initialSelection, + wxWindow *parent = NULL); + +WXDLLIMPEXP_CORE int wxGetSingleChoiceIndex(const wxString& message, + const wxString& caption, + int n, const wxString *choices, + int initialSelection, + wxWindow *parent = NULL); + +// Return client data instead or NULL if canceled +WXDLLIMPEXP_CORE void* wxGetSingleChoiceData(const wxString& message, + const wxString& caption, + const wxArrayString& choices, + void **client_data, + wxWindow *parent = NULL, + int x = wxDefaultCoord, + int y = wxDefaultCoord, + bool centre = true, + int width = wxCHOICE_WIDTH, + int height = wxCHOICE_HEIGHT, + int initialSelection = 0); + +WXDLLIMPEXP_CORE void* wxGetSingleChoiceData(const wxString& message, + const wxString& caption, + int n, const wxString *choices, + void **client_data, + wxWindow *parent = NULL, + int x = wxDefaultCoord, + int y = wxDefaultCoord, + bool centre = true, + int width = wxCHOICE_WIDTH, + int height = wxCHOICE_HEIGHT, + int initialSelection = 0); + +WXDLLIMPEXP_CORE void* wxGetSingleChoiceData(const wxString& message, + const wxString& caption, + const wxArrayString& choices, + void **client_data, + int initialSelection, + wxWindow *parent = NULL); + + +WXDLLIMPEXP_CORE void* wxGetSingleChoiceData(const wxString& message, + const wxString& caption, + int n, const wxString *choices, + void **client_data, + int initialSelection, + wxWindow *parent = NULL); + +// fill the array with the indices of the chosen items, it will be empty +// if no items were selected or Cancel was pressed - return the number of +// selections or -1 if cancelled +WXDLLIMPEXP_CORE int wxGetSelectedChoices(wxArrayInt& selections, + const wxString& message, + const wxString& caption, + int n, const wxString *choices, + wxWindow *parent = NULL, + int x = wxDefaultCoord, + int y = wxDefaultCoord, + bool centre = true, + int width = wxCHOICE_WIDTH, + int height = wxCHOICE_HEIGHT); + +WXDLLIMPEXP_CORE int wxGetSelectedChoices(wxArrayInt& selections, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + wxWindow *parent = NULL, + int x = wxDefaultCoord, + int y = wxDefaultCoord, + bool centre = true, + int width = wxCHOICE_WIDTH, + int height = wxCHOICE_HEIGHT); + +#if WXWIN_COMPATIBILITY_2_8 +// fill the array with the indices of the chosen items, it will be empty +// if no items were selected or Cancel was pressed - return the number of +// selections +wxDEPRECATED( WXDLLIMPEXP_CORE size_t wxGetMultipleChoices(wxArrayInt& selections, + const wxString& message, + const wxString& caption, + int n, const wxString *choices, + wxWindow *parent = NULL, + int x = wxDefaultCoord, + int y = wxDefaultCoord, + bool centre = true, + int width = wxCHOICE_WIDTH, + int height = wxCHOICE_HEIGHT) ); + +wxDEPRECATED( WXDLLIMPEXP_CORE size_t wxGetMultipleChoices(wxArrayInt& selections, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + wxWindow *parent = NULL, + int x = wxDefaultCoord, + int y = wxDefaultCoord, + bool centre = true, + int width = wxCHOICE_WIDTH, + int height = wxCHOICE_HEIGHT)); +#endif // WXWIN_COMPATIBILITY_2_8 + +#endif // _WX_GENERIC_CHOICDGG_H_ diff --git a/lib/wxWidgets/include/wx/generic/clrpickerg.h b/lib/wxWidgets/include/wx/generic/clrpickerg.h new file mode 100644 index 0000000..2194d72 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/clrpickerg.h @@ -0,0 +1,88 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/clrpickerg.h +// Purpose: wxGenericColourButton header +// Author: Francesco Montorsi (based on Vadim Zeitlin's code) +// Modified by: +// Created: 14/4/2006 +// Copyright: (c) Vadim Zeitlin, Francesco Montorsi +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CLRPICKER_H_ +#define _WX_CLRPICKER_H_ + +#include "wx/button.h" +#include "wx/bmpbuttn.h" +#include "wx/colourdata.h" + +class wxColourDialogEvent; + +//----------------------------------------------------------------------------- +// wxGenericColourButton: a button which brings up a wxColourDialog +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGenericColourButton : public wxBitmapButton, + public wxColourPickerWidgetBase +{ +public: + wxGenericColourButton() {} + wxGenericColourButton(wxWindow *parent, + wxWindowID id, + const wxColour& col = *wxBLACK, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCLRBTN_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxColourPickerWidgetNameStr)) + { + Create(parent, id, col, pos, size, style, validator, name); + } + + virtual ~wxGenericColourButton() {} + + +public: // API extensions specific for wxGenericColourButton + + // user can override this to init colour data in a different way + virtual void InitColourData(); + + // returns the colour data shown in wxColourDialog + wxColourData *GetColourData() { return &ms_data; } + + +public: + + bool Create(wxWindow *parent, + wxWindowID id, + const wxColour& col = *wxBLACK, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCLRBTN_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxColourPickerWidgetNameStr)); + + void OnButtonClick(wxCommandEvent &); + + +protected: + wxBitmap m_bitmap; + + wxSize DoGetBestSize() const wxOVERRIDE; + + void UpdateColour() wxOVERRIDE; + + void OnDPIChanged(wxDPIChangedEvent& event); + + // the colour data shown in wxColourPickerCtrlGeneric + // controls. This member is static so that all colour pickers + // in the program share the same set of custom colours. + static wxColourData ms_data; + +private: + void OnColourChanged(wxColourDialogEvent& event); + + wxDECLARE_DYNAMIC_CLASS(wxGenericColourButton); +}; + + +#endif // _WX_CLRPICKER_H_ diff --git a/lib/wxWidgets/include/wx/generic/collheaderctrl.h b/lib/wxWidgets/include/wx/generic/collheaderctrl.h new file mode 100644 index 0000000..0fbddf7 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/collheaderctrl.h @@ -0,0 +1,83 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/collheaderctrl.h +// Purpose: wxGenericCollapsibleHeaderCtrl +// Author: Tobias Taschner +// Created: 2015-09-19 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_COLLAPSIBLEHEADER_CTRL_H_ +#define _WX_GENERIC_COLLAPSIBLEHEADER_CTRL_H_ + +class WXDLLIMPEXP_CORE wxGenericCollapsibleHeaderCtrl + : public wxCollapsibleHeaderCtrlBase +{ +public: + wxGenericCollapsibleHeaderCtrl() { Init(); } + + wxGenericCollapsibleHeaderCtrl(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxBORDER_NONE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCollapsibleHeaderCtrlNameStr)) + { + Init(); + + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxBORDER_NONE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCollapsibleHeaderCtrlNameStr)); + + virtual void SetCollapsed(bool collapsed = true) wxOVERRIDE; + + virtual bool IsCollapsed() const wxOVERRIDE + { return m_collapsed; } + +protected: + + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + +private: + bool m_collapsed; + bool m_inWindow; + bool m_mouseDown; + + void Init(); + + void OnPaint(wxPaintEvent& event); + + // Handle set/kill focus events (invalidate for painting focus rect) + void OnFocus(wxFocusEvent& event); + + // Handle click + void OnLeftUp(wxMouseEvent& event); + + // Handle pressed state + void OnLeftDown(wxMouseEvent& event); + + // Handle current state + void OnEnterWindow(wxMouseEvent& event); + + void OnLeaveWindow(wxMouseEvent& event); + + // Toggle on space + void OnChar(wxKeyEvent& event); + + void DoSetCollapsed(bool collapsed); + + wxDECLARE_NO_COPY_CLASS(wxGenericCollapsibleHeaderCtrl); +}; + + +#endif // _WX_GENERIC_COLLAPSIBLEHEADER_CTRL_H_ diff --git a/lib/wxWidgets/include/wx/generic/collpaneg.h b/lib/wxWidgets/include/wx/generic/collpaneg.h new file mode 100644 index 0000000..d45bde1 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/collpaneg.h @@ -0,0 +1,96 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/collpaneg.h +// Purpose: wxGenericCollapsiblePane +// Author: Francesco Montorsi +// Modified by: +// Created: 8/10/2006 +// Copyright: (c) Francesco Montorsi +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COLLAPSABLE_PANE_H_GENERIC_ +#define _WX_COLLAPSABLE_PANE_H_GENERIC_ + +// forward declared +class WXDLLIMPEXP_FWD_CORE wxCollapsibleHeaderCtrl; + +#include "wx/containr.h" + +// ---------------------------------------------------------------------------- +// wxGenericCollapsiblePane +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGenericCollapsiblePane : + public wxNavigationEnabled +{ +public: + wxGenericCollapsiblePane() { Init(); } + + wxGenericCollapsiblePane(wxWindow *parent, + wxWindowID winid, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCP_DEFAULT_STYLE, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCollapsiblePaneNameStr)) + { + Init(); + + Create(parent, winid, label, pos, size, style, val, name); + } + + virtual ~wxGenericCollapsiblePane(); + + bool Create(wxWindow *parent, + wxWindowID winid, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCP_DEFAULT_STYLE, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCollapsiblePaneNameStr)); + + // public wxCollapsiblePane API + virtual void Collapse(bool collapse = true) wxOVERRIDE; + virtual void SetLabel(const wxString &label) wxOVERRIDE; + + virtual bool IsCollapsed() const wxOVERRIDE + { return m_pPane==NULL || !m_pPane->IsShown(); } + virtual wxWindow *GetPane() const wxOVERRIDE + { return m_pPane; } + virtual wxString GetLabel() const wxOVERRIDE; + + virtual bool Layout() wxOVERRIDE; + + + // for the generic collapsible pane only: + wxControl* GetControlWidget() const + { return (wxControl*)m_pButton; } + + // implementation only, don't use + void OnStateChange(const wxSize& sizeNew); + +protected: + // overridden methods + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + + int GetBorder() const; + + // child controls + wxCollapsibleHeaderCtrl *m_pButton; + wxWindow *m_pPane; + wxSizer *m_sz; + +private: + void Init(); + + // event handlers + void OnButton(wxCommandEvent &ev); + void OnSize(wxSizeEvent &ev); + + wxDECLARE_DYNAMIC_CLASS(wxGenericCollapsiblePane); + wxDECLARE_EVENT_TABLE(); +}; + +#endif // _WX_COLLAPSABLE_PANE_H_GENERIC_ diff --git a/lib/wxWidgets/include/wx/generic/colour.h b/lib/wxWidgets/include/wx/generic/colour.h new file mode 100644 index 0000000..af9c654 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/colour.h @@ -0,0 +1,68 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/colour.h +// Purpose: wxColour class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_COLOUR_H_ +#define _WX_GENERIC_COLOUR_H_ + +#include "wx/object.h" + +// Colour +class WXDLLIMPEXP_CORE wxColour: public wxColourBase +{ +public: + // constructors + // ------------ + DEFINE_STD_WXCOLOUR_CONSTRUCTORS + + // copy ctors and assignment operators + wxDECLARE_DEFAULT_COPY_CTOR(wxColour) + + wxColour& operator=(const wxColour& col); + + // accessors + virtual bool IsOk() const { return m_isInit; } + + unsigned char Red() const { return m_red; } + unsigned char Green() const { return m_green; } + unsigned char Blue() const { return m_blue; } + unsigned char Alpha() const { return m_alpha; } + + // comparison + bool operator==(const wxColour& colour) const + { + return (m_red == colour.m_red && + m_green == colour.m_green && + m_blue == colour.m_blue && + m_alpha == colour.m_alpha && + m_isInit == colour.m_isInit); + } + + bool operator!=(const wxColour& colour) const { return !(*this == colour); } + +protected: + + // Helper function + void Init(); + + virtual void + InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a); + +private: + bool m_isInit; + unsigned char m_red; + unsigned char m_blue; + unsigned char m_green; + unsigned char m_alpha; + +private: + wxDECLARE_DYNAMIC_CLASS(wxColour); +}; + +#endif // _WX_GENERIC_COLOUR_H_ diff --git a/lib/wxWidgets/include/wx/generic/colrdlgg.h b/lib/wxWidgets/include/wx/generic/colrdlgg.h new file mode 100644 index 0000000..98fe616 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/colrdlgg.h @@ -0,0 +1,133 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/colrdlgg.h +// Purpose: wxGenericColourDialog +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COLORDLGG_H_ +#define _WX_COLORDLGG_H_ + +#include "wx/gdicmn.h" +#include "wx/dialog.h" + +#if wxUSE_SLIDER + class WXDLLIMPEXP_FWD_CORE wxSlider; +#endif // wxUSE_SLIDER + +// Preview with opacity is possible only if wxGCDC and wxStaticBitmap are +// available and currently it only works in wxOSX and wxMSW as it uses wxBitmap +// UseAlpha() and HasAlpha() methods which only these ports provide. +#if ((wxUSE_GRAPHICS_CONTEXT && wxUSE_STATBMP) && \ + (defined(__WXMSW__) || defined(__WXOSX__))) + #define wxCLRDLGG_USE_PREVIEW_WITH_ALPHA 1 +#else + #define wxCLRDLGG_USE_PREVIEW_WITH_ALPHA 0 +#endif + +#if wxCLRDLGG_USE_PREVIEW_WITH_ALPHA +class wxStaticBitmap; +#endif // wxCLRDLGG_USE_PREVIEW_WITH_ALPHA + +class WXDLLIMPEXP_CORE wxGenericColourDialog : public wxDialog +{ +public: + wxGenericColourDialog(); + wxGenericColourDialog(wxWindow *parent, + const wxColourData *data = NULL); + virtual ~wxGenericColourDialog(); + + bool Create(wxWindow *parent, const wxColourData *data = NULL); + + wxColourData &GetColourData() { return m_colourData; } + + virtual int ShowModal() wxOVERRIDE; + + // Internal functions + void OnMouseEvent(wxMouseEvent& event); + void OnPaint(wxPaintEvent& event); + void OnDPIChanged(wxDPIChangedEvent& event); +#if wxCLRDLGG_USE_PREVIEW_WITH_ALPHA + void OnCustomColourMouseClick(wxMouseEvent& event); +#endif // wxCLRDLGG_USE_PREVIEW_WITH_ALPHA + + virtual void CalculateMeasurements(); + virtual void CreateWidgets(); + virtual void InitializeColours(); + + virtual void PaintBasicColours(wxDC& dc); +#if !wxCLRDLGG_USE_PREVIEW_WITH_ALPHA + virtual void PaintCustomColours(wxDC& dc, int clrIndex = -1); +#endif // !wxCLRDLGG_USE_PREVIEW_WITH_ALPHA + virtual void PaintCustomColour(wxDC& dc); + virtual void PaintHighlight(wxDC& dc, bool draw); + + virtual void OnBasicColourClick(int which); + virtual void OnCustomColourClick(int which); + + void OnAddCustom(wxCommandEvent& event); + +#if wxUSE_SLIDER + void OnRedSlider(wxCommandEvent& event); + void OnGreenSlider(wxCommandEvent& event); + void OnBlueSlider(wxCommandEvent& event); + void OnAlphaSlider(wxCommandEvent& event); +#endif // wxUSE_SLIDER + + void OnCloseWindow(wxCloseEvent& event); + +#if wxCLRDLGG_USE_PREVIEW_WITH_ALPHA + virtual void CreateCustomBitmaps(); + void DoPreviewBitmap(wxBitmap& bmp, const wxColour& colour); +#endif // wxCLRDLGG_USE_PREVIEW_WITH_ALPHA + +protected: + wxColourData m_colourData; + + // Area reserved for grids of colours + wxRect m_standardColoursRect; + wxRect m_customColoursRect; + wxRect m_singleCustomColourRect; + + // Size of each colour rectangle + wxSize m_smallRectangleSize; + + // Grid spacing (between rectangles) + int m_gridSpacing; + + // Section spacing (between left and right halves of dialog box) + int m_sectionSpacing; + + // 48 'standard' colours + wxColour m_standardColours[48]; + + // 16 'custom' colours + wxColour m_customColours[16]; + + // Which colour is selected? An index into one of the two areas. + int m_colourSelection; + int m_whichKind; // 1 for standard colours, 2 for custom colours, + +#if wxUSE_SLIDER + wxSlider *m_redSlider; + wxSlider *m_greenSlider; + wxSlider *m_blueSlider; + wxSlider *m_alphaSlider; +#endif // wxUSE_SLIDER +#if wxCLRDLGG_USE_PREVIEW_WITH_ALPHA + // Bitmap to preview selected colour (with alpha channel) + wxStaticBitmap *m_customColourBmp; + // Bitmaps to preview custom colours (with alpha channel) + wxStaticBitmap *m_customColoursBmp[16]; +#endif // wxCLRDLGG_USE_PREVIEW_WITH_ALPHA + + // static bool colourDialogCancelled; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxGenericColourDialog); +}; + +#endif // _WX_COLORDLGG_H_ diff --git a/lib/wxWidgets/include/wx/generic/combo.h b/lib/wxWidgets/include/wx/generic/combo.h new file mode 100644 index 0000000..3733b32 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/combo.h @@ -0,0 +1,158 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/combo.h +// Purpose: Generic wxComboCtrl +// Author: Jaakko Salli +// Modified by: +// Created: Apr-30-2006 +// Copyright: (c) Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_COMBOCTRL_H_ +#define _WX_GENERIC_COMBOCTRL_H_ + +#if wxUSE_COMBOCTRL + +// Only define generic if native doesn't have all the features +#if !defined(wxCOMBOCONTROL_FULLY_FEATURED) + +#include "wx/containr.h" + +// ---------------------------------------------------------------------------- +// Generic wxComboCtrl +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + +// all actions of single line text controls are supported + +// popup/dismiss the choice window +#define wxACTION_COMBOBOX_POPUP wxT("popup") +#define wxACTION_COMBOBOX_DISMISS wxT("dismiss") + +#endif + +extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[]; + +class WXDLLIMPEXP_CORE wxGenericComboCtrl + : public wxNavigationEnabled +{ +public: + // ctors and such + wxGenericComboCtrl() { Init(); } + + wxGenericComboCtrl(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)) + { + Init(); + + (void)Create(parent, id, value, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)); + + virtual ~wxGenericComboCtrl(); + + void SetCustomPaintWidth( int width ); + + virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const wxOVERRIDE; + + static int GetFeatures() { return wxComboCtrlFeatures::All; } + +#if defined(__WXUNIVERSAL__) + // we have our own input handler and our own actions + virtual bool PerformAction(const wxControlAction& action, + long numArg = 0l, + const wxString& strArg = wxEmptyString); +#endif + +protected: + + // Dummies for platform-specific wxTextEntry implementations +#if defined(__WXUNIVERSAL__) + // Looks like there's nothing we need to override here +#elif defined(__WXMOTIF__) + virtual WXWidget GetTextWidget() const { return NULL; } +#elif defined(__WXGTK__) +#if defined(__WXGTK20__) + virtual GtkEditable *GetEditable() const wxOVERRIDE { return NULL; } + virtual GtkEntry *GetEntry() const wxOVERRIDE { return NULL; } +#endif +#elif defined(__WXOSX__) + virtual wxTextWidgetImpl * GetTextPeer() const wxOVERRIDE; +#endif + + // For better transparent background rendering + virtual bool HasTransparentBackground() wxOVERRIDE; + + // Mandatory virtuals + virtual void OnResize() wxOVERRIDE; + + // Event handlers + void OnPaintEvent( wxPaintEvent& event ); + void OnMouseEvent( wxMouseEvent& event ); + +private: + void Init(); + + wxDECLARE_EVENT_TABLE(); + + wxDECLARE_DYNAMIC_CLASS(wxGenericComboCtrl); +}; + + +#ifndef _WX_COMBOCONTROL_H_ + +// If native wxComboCtrl was not defined, then prepare a simple +// front-end so that wxRTTI works as expected. + +class WXDLLIMPEXP_CORE wxComboCtrl : public wxGenericComboCtrl +{ +public: + wxComboCtrl() : wxGenericComboCtrl() {} + + wxComboCtrl(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)) + : wxGenericComboCtrl() + { + (void)Create(parent, id, value, pos, size, style, validator, name); + } + + virtual ~wxComboCtrl() {} + +protected: + +private: + wxDECLARE_DYNAMIC_CLASS(wxComboCtrl); +}; + +#endif // _WX_COMBOCONTROL_H_ + +#else + +#define wxGenericComboCtrl wxComboCtrl + +#endif // !defined(wxCOMBOCONTROL_FULLY_FEATURED) + +#endif // wxUSE_COMBOCTRL +#endif + // _WX_GENERIC_COMBOCTRL_H_ diff --git a/lib/wxWidgets/include/wx/generic/creddlgg.h b/lib/wxWidgets/include/wx/generic/creddlgg.h new file mode 100644 index 0000000..9f99cb8 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/creddlgg.h @@ -0,0 +1,53 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/creddlgg.h +// Purpose: wxGenericCredentialEntryDialog interface +// Author: Tobias Taschner +// Created: 2018-10-23 +// Copyright: (c) 2018 wxWidgets development team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CREDDLGG_H_BASE +#define _WX_CREDDLGG_H_BASE + +#include "wx/defs.h" + +#if wxUSE_CREDENTIALDLG + +#include "wx/dialog.h" +#include "wx/webrequest.h" + +class WXDLLIMPEXP_CORE wxGenericCredentialEntryDialog : public wxDialog +{ +public: + wxGenericCredentialEntryDialog(); + + wxGenericCredentialEntryDialog(wxWindow* parent, const wxString& message, + const wxString& title, + const wxWebCredentials& cred = wxWebCredentials()); + + bool Create(wxWindow* parent, const wxString& message, + const wxString& title, + const wxWebCredentials& cred = wxWebCredentials()); + + void SetUser(const wxString& user) { m_userTextCtrl->SetValue(user); } + void SetPassword(const wxString& password) + { m_passwordTextCtrl->SetValue(password); } + + wxWebCredentials GetCredentials() const; + +private: + wxTextCtrl* m_userTextCtrl; + wxTextCtrl* m_passwordTextCtrl; + + void Init(const wxString& message, const wxWebCredentials& cred); + + wxDECLARE_NO_COPY_CLASS(wxGenericCredentialEntryDialog); +}; + +// Add this typedef as long as the generic version is the only one available +typedef wxGenericCredentialEntryDialog wxCredentialEntryDialog; + +#endif // wxUSE_CREDENTIALDLG + +#endif // _WX_CREDDLGG_H_BASE diff --git a/lib/wxWidgets/include/wx/generic/ctrlsub.h b/lib/wxWidgets/include/wx/generic/ctrlsub.h new file mode 100644 index 0000000..2636192 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/ctrlsub.h @@ -0,0 +1,122 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/ctrlsub.h +// Purpose: common functionality of wxItemContainer-derived controls +// Author: Vadim Zeitlin +// Created: 2007-07-25 +// Copyright: (c) 2007 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_CTRLSUB_H_ +#define _WX_GENERIC_CTRLSUB_H_ + +#include "wx/dynarray.h" + +// ---------------------------------------------------------------------------- +// wxControlWithItemsGeneric: generic implementation of item client data +// ---------------------------------------------------------------------------- + +class wxControlWithItemsGeneric : public wxControlWithItemsBase +{ +public: + wxControlWithItemsGeneric() { } + + virtual void DoInitItemClientData() + { + m_itemsClientData.resize(GetCount(), NULL); + } + + virtual void DoSetItemClientData(unsigned int n, void *clientData) + { + m_itemsClientData[n] = clientData; + } + + virtual void *DoGetItemClientData(unsigned int n) const + { + return m_itemsClientData[n]; + } + + virtual void DoClear() { m_itemsClientData.clear(); } + virtual void DoDeleteOneItem(unsigned int pos) + { + if ( HasClientData() ) + m_itemsClientData.RemoveAt(pos); + } + +protected: + // preallocate memory for numItems new items: this should be called from + // the derived classes DoInsertItems() to speed up appending big numbers of + // items with client data; it is safe to call even if we don't use client + // data at all and does nothing in this case + void AllocClientData(unsigned int numItems) + { + if ( HasClientData() ) + m_itemsClientData.reserve(m_itemsClientData.size() + numItems); + } + + // this must be called by derived classes when a new item is added to the + // control to add storage for the corresponding client data pointer (before + // inserting many items, call AllocClientData()) + void InsertNewItemClientData(unsigned int pos, + void **clientData, + unsigned int n, + wxClientDataType type) + { + if ( InitClientDataIfNeeded(type) ) + m_itemsClientData.Insert(clientData[n], pos); + } + + // the same as InsertNewItemClientData() but for numItems consecutive items + // (this can only be used if the control doesn't support sorting as + // otherwise the items positions wouldn't be consecutive any more) + void InsertNewItemsClientData(unsigned int pos, + unsigned int numItems, + void **clientData, + wxClientDataType type) + { + if ( InitClientDataIfNeeded(type) ) + { + // it's more efficient to insert everything at once and then update + // for big number of items to avoid moving the array contents + // around (which would result in O(N^2) algorithm) + m_itemsClientData.Insert(NULL, pos, numItems); + + for ( unsigned int n = 0; n < numItems; ++n, ++pos ) + m_itemsClientData[pos] = clientData[n]; + } + } + + + // vector containing the client data pointers: it is either empty (if + // client data is not used) or has the same number of elements as the + // control + wxArrayPtrVoid m_itemsClientData; + +private: + // initialize client data if needed, return false if we don't have any + // client data and true otherwise + bool InitClientDataIfNeeded(wxClientDataType type) + { + if ( !HasClientData() ) + { + if ( type == wxClientData_None ) + { + // we didn't have the client data before and are not asked to + // store it now either + return false; + } + + // this is the first time client data is used with this control + DoInitItemClientData(); + SetClientDataType(type); + } + //else: we already have client data + + return true; + } + + wxDECLARE_NO_COPY_CLASS(wxControlWithItemsGeneric); +}; + +#endif // _WX_GENERIC_CTRLSUB_H_ + diff --git a/lib/wxWidgets/include/wx/generic/custombgwin.h b/lib/wxWidgets/include/wx/generic/custombgwin.h new file mode 100644 index 0000000..c646b70 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/custombgwin.h @@ -0,0 +1,98 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/custombgwin.h +// Purpose: Generic implementation of wxCustomBackgroundWindow. +// Author: Vadim Zeitlin +// Created: 2011-10-10 +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_CUSTOMBGWIN_H_ +#define _WX_GENERIC_CUSTOMBGWIN_H_ + +#include "wx/bitmap.h" +#include "wx/dc.h" +#include "wx/event.h" +#include "wx/window.h" + +// A helper to avoid template bloat: this class contains all type-independent +// code of wxCustomBackgroundWindow<> below. +class wxCustomBackgroundWindowGenericBase : public wxCustomBackgroundWindowBase +{ +public: + wxCustomBackgroundWindowGenericBase() { } + +protected: + void DoEraseBackground(wxEraseEvent& event, wxWindow* win) + { + wxDC& dc = *event.GetDC(); + + const wxSize clientSize = win->GetClientSize(); + const wxSize bitmapSize = m_bitmapBg.GetSize(); + + for ( int x = 0; x < clientSize.x; x += bitmapSize.x ) + { + for ( int y = 0; y < clientSize.y; y += bitmapSize.y ) + { + dc.DrawBitmap(m_bitmapBg, x, y); + } + } + } + + + // The bitmap used for painting the background if valid. + wxBitmap m_bitmapBg; + + + wxDECLARE_NO_COPY_CLASS(wxCustomBackgroundWindowGenericBase); +}; + +// ---------------------------------------------------------------------------- +// wxCustomBackgroundWindow +// ---------------------------------------------------------------------------- + +template +class wxCustomBackgroundWindow : public W, + public wxCustomBackgroundWindowGenericBase +{ +public: + typedef W BaseWindowClass; + + wxCustomBackgroundWindow() { } + +protected: + virtual void DoSetBackgroundBitmap(const wxBitmap& bmp) wxOVERRIDE + { + m_bitmapBg = bmp; + + if ( m_bitmapBg.IsOk() ) + { + BaseWindowClass::Bind + ( + wxEVT_ERASE_BACKGROUND, + &wxCustomBackgroundWindow::OnEraseBackground, this + ); + } + else + { + BaseWindowClass::Unbind + ( + wxEVT_ERASE_BACKGROUND, + &wxCustomBackgroundWindow::OnEraseBackground, this + ); + } + } + +private: + // Event handler for erasing the background which is only used when we have + // a valid background bitmap. + void OnEraseBackground(wxEraseEvent& event) + { + DoEraseBackground(event, this); + } + + + wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxCustomBackgroundWindow, W); +}; + +#endif // _WX_GENERIC_CUSTOMBGWIN_H_ diff --git a/lib/wxWidgets/include/wx/generic/dataview.h b/lib/wxWidgets/include/wx/generic/dataview.h new file mode 100644 index 0000000..6602b4a --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/dataview.h @@ -0,0 +1,482 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/dataview.h +// Purpose: wxDataViewCtrl generic implementation header +// Author: Robert Roebling +// Modified By: Bo Yang +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GENERICDATAVIEWCTRLH__ +#define __GENERICDATAVIEWCTRLH__ + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/compositewin.h" +#include "wx/control.h" +#include "wx/scrolwin.h" +#include "wx/icon.h" +#include "wx/vector.h" +#if wxUSE_ACCESSIBILITY + #include "wx/access.h" +#endif // wxUSE_ACCESSIBILITY + +class WXDLLIMPEXP_FWD_CORE wxDataViewMainWindow; +class WXDLLIMPEXP_FWD_CORE wxDataViewHeaderWindow; +#if wxUSE_ACCESSIBILITY +class WXDLLIMPEXP_FWD_CORE wxDataViewCtrlAccessible; +#endif // wxUSE_ACCESSIBILITY + +// --------------------------------------------------------- +// wxDataViewColumn +// --------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataViewColumn : public wxDataViewColumnBase +{ +public: + wxDataViewColumn(const wxString& title, + wxDataViewRenderer *renderer, + unsigned int model_column, + int width = wxDVC_DEFAULT_WIDTH, + wxAlignment align = wxALIGN_CENTER, + int flags = wxDATAVIEW_COL_RESIZABLE) + : wxDataViewColumnBase(renderer, model_column), + m_title(title) + { + Init(width, align, flags); + } + + wxDataViewColumn(const wxBitmapBundle& bitmap, + wxDataViewRenderer *renderer, + unsigned int model_column, + int width = wxDVC_DEFAULT_WIDTH, + wxAlignment align = wxALIGN_CENTER, + int flags = wxDATAVIEW_COL_RESIZABLE) + : wxDataViewColumnBase(bitmap, renderer, model_column) + { + Init(width, align, flags); + } + + // implement wxHeaderColumnBase methods + virtual void SetTitle(const wxString& title) wxOVERRIDE + { + m_title = title; + UpdateWidth(); + } + virtual wxString GetTitle() const wxOVERRIDE + { + return m_title; + } + + virtual void SetWidth(int width) wxOVERRIDE + { + // Call the actual update method, used for both automatic and "manual" + // width changes. + WXUpdateWidth(width); + + // Do remember the last explicitly set width: this is used to prevent + // UpdateColumnSizes() from resizing the last column to be smaller than + // this size. + m_manuallySetWidth = width; + } + virtual int GetWidth() const wxOVERRIDE; + + virtual void SetMinWidth(int minWidth) wxOVERRIDE + { + m_minWidth = minWidth; + UpdateWidth(); + } + virtual int GetMinWidth() const wxOVERRIDE + { + return m_minWidth; + } + + virtual void SetAlignment(wxAlignment align) wxOVERRIDE + { + m_align = align; + UpdateDisplay(); + } + virtual wxAlignment GetAlignment() const wxOVERRIDE + { + return m_align; + } + + virtual void SetFlags(int flags) wxOVERRIDE + { + m_flags = flags; + UpdateDisplay(); + } + virtual int GetFlags() const wxOVERRIDE + { + return m_flags; + } + + virtual bool IsSortKey() const wxOVERRIDE + { + return m_sort; + } + + virtual void UnsetAsSortKey() wxOVERRIDE; + + virtual void SetSortOrder(bool ascending) wxOVERRIDE; + + virtual bool IsSortOrderAscending() const wxOVERRIDE + { + return m_sortAscending; + } + + virtual void SetBitmap( const wxBitmapBundle& bitmap ) wxOVERRIDE + { + wxDataViewColumnBase::SetBitmap(bitmap); + UpdateWidth(); + } + + // This method is specific to the generic implementation and is used only + // by wxWidgets itself. + void WXUpdateWidth(int width) + { + if ( width == m_width ) + return; + + m_width = width; + UpdateWidth(); + } + + // This method is also internal and called when the column is resized by + // user interactively. + void WXOnResize(int width); + + virtual int WXGetSpecifiedWidth() const wxOVERRIDE; + +private: + // common part of all ctors + void Init(int width, wxAlignment align, int flags); + + // These methods forward to wxDataViewCtrl::OnColumnChange() and + // OnColumnWidthChange() respectively, i.e. the latter is stronger than the + // former. + void UpdateDisplay(); + void UpdateWidth(); + + // Return the effective value corresponding to the given width, handling + // its negative values such as wxCOL_WIDTH_DEFAULT. + int DoGetEffectiveWidth(int width) const; + + + wxString m_title; + int m_width, + m_manuallySetWidth, + m_minWidth; + wxAlignment m_align; + int m_flags; + bool m_sort, + m_sortAscending; + + friend class wxDataViewHeaderWindowBase; + friend class wxDataViewHeaderWindow; + friend class wxDataViewHeaderWindowMSW; +}; + +// --------------------------------------------------------- +// wxDataViewCtrl +// --------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataViewCtrl + : public wxCompositeWindow, + public wxScrollHelper +{ + friend class wxDataViewMainWindow; + friend class wxDataViewHeaderWindowBase; + friend class wxDataViewHeaderWindow; + friend class wxDataViewHeaderWindowMSW; + friend class wxDataViewColumn; +#if wxUSE_ACCESSIBILITY + friend class wxDataViewCtrlAccessible; +#endif // wxUSE_ACCESSIBILITY + + typedef wxCompositeWindow BaseType; + +public: + wxDataViewCtrl() : wxScrollHelper(this) + { + Init(); + } + + wxDataViewCtrl( wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxDataViewCtrlNameStr) ) + : wxScrollHelper(this) + { + Create(parent, id, pos, size, style, validator, name); + } + + virtual ~wxDataViewCtrl(); + + void Init(); + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxDataViewCtrlNameStr)); + + virtual bool AssociateModel( wxDataViewModel *model ) wxOVERRIDE; + + virtual bool AppendColumn( wxDataViewColumn *col ) wxOVERRIDE; + virtual bool PrependColumn( wxDataViewColumn *col ) wxOVERRIDE; + virtual bool InsertColumn( unsigned int pos, wxDataViewColumn *col ) wxOVERRIDE; + + virtual void DoSetExpanderColumn() wxOVERRIDE; + virtual void DoSetIndent() wxOVERRIDE; + + virtual unsigned int GetColumnCount() const wxOVERRIDE; + virtual wxDataViewColumn* GetColumn( unsigned int pos ) const wxOVERRIDE; + virtual bool DeleteColumn( wxDataViewColumn *column ) wxOVERRIDE; + virtual bool ClearColumns() wxOVERRIDE; + virtual int GetColumnPosition( const wxDataViewColumn *column ) const wxOVERRIDE; + + virtual wxDataViewColumn *GetSortingColumn() const wxOVERRIDE; + virtual wxVector GetSortingColumns() const wxOVERRIDE; + + virtual wxDataViewItem GetTopItem() const wxOVERRIDE; + virtual int GetCountPerPage() const wxOVERRIDE; + + virtual int GetSelectedItemsCount() const wxOVERRIDE; + virtual int GetSelections( wxDataViewItemArray & sel ) const wxOVERRIDE; + virtual void SetSelections( const wxDataViewItemArray & sel ) wxOVERRIDE; + virtual void Select( const wxDataViewItem & item ) wxOVERRIDE; + virtual void Unselect( const wxDataViewItem & item ) wxOVERRIDE; + virtual bool IsSelected( const wxDataViewItem & item ) const wxOVERRIDE; + + virtual void SelectAll() wxOVERRIDE; + virtual void UnselectAll() wxOVERRIDE; + + virtual void EnsureVisible( const wxDataViewItem & item, + const wxDataViewColumn *column = NULL ) wxOVERRIDE; + virtual void HitTest( const wxPoint & point, wxDataViewItem & item, + wxDataViewColumn* &column ) const wxOVERRIDE; + virtual wxRect GetItemRect( const wxDataViewItem & item, + const wxDataViewColumn *column = NULL ) const wxOVERRIDE; + + virtual bool SetRowHeight( int rowHeight ) wxOVERRIDE; + + virtual void Collapse( const wxDataViewItem & item ) wxOVERRIDE; + virtual bool IsExpanded( const wxDataViewItem & item ) const wxOVERRIDE; + + virtual void SetFocus() wxOVERRIDE; + + virtual bool SetFont(const wxFont & font) wxOVERRIDE; + virtual bool SetForegroundColour(const wxColour& colour) wxOVERRIDE; + virtual bool SetBackgroundColour(const wxColour& colour) wxOVERRIDE; + +#if wxUSE_ACCESSIBILITY + virtual bool Show(bool show = true) wxOVERRIDE; + virtual void SetName(const wxString &name) wxOVERRIDE; + virtual bool Reparent(wxWindowBase *newParent) wxOVERRIDE; +#endif // wxUSE_ACCESSIBILITY + virtual bool Enable(bool enable = true) wxOVERRIDE; + + virtual bool AllowMultiColumnSort(bool allow) wxOVERRIDE; + virtual bool IsMultiColumnSortAllowed() const wxOVERRIDE { return m_allowMultiColumnSort; } + virtual void ToggleSortByColumn(int column) wxOVERRIDE; + +#if wxUSE_DRAG_AND_DROP + virtual bool EnableDragSource( const wxDataFormat &format ) wxOVERRIDE; + virtual bool DoEnableDropTarget(const wxVector& formats) wxOVERRIDE; +#endif // wxUSE_DRAG_AND_DROP + + virtual wxBorder GetDefaultBorder() const wxOVERRIDE; + + virtual void EditItem(const wxDataViewItem& item, const wxDataViewColumn *column) wxOVERRIDE; + + virtual bool SetHeaderAttr(const wxItemAttr& attr) wxOVERRIDE; + + virtual bool SetAlternateRowColour(const wxColour& colour) wxOVERRIDE; + + // This method is specific to generic wxDataViewCtrl implementation and + // should not be used in portable code. + wxColour GetAlternateRowColour() const { return m_alternateRowColour; } + + // The returned pointer is null if the control has wxDV_NO_HEADER style. + // + // This method is only available in the generic versions. + wxHeaderCtrl* GenericGetHeader() const; + +protected: + void EnsureVisibleRowCol( int row, int column ); + + // Notice that row here may be invalid (i.e. >= GetRowCount()), this is not + // an error and this function simply returns an invalid item in this case. + wxDataViewItem GetItemByRow( unsigned int row ) const; + int GetRowByItem( const wxDataViewItem & item ) const; + + // Mark the column as being used or not for sorting. + void UseColumnForSorting(int idx); + void DontUseColumnForSorting(int idx); + + // Return true if the given column is sorted + bool IsColumnSorted(int idx) const; + + // Reset all columns currently used for sorting. + void ResetAllSortColumns(); + + virtual void DoEnableSystemTheme(bool enable, wxWindow* window) wxOVERRIDE; + + void OnDPIChanged(wxDPIChangedEvent& event); + +public: // utility functions not part of the API + + // returns the "best" width for the idx-th column + unsigned int GetBestColumnWidth(int idx) const; + + // called by header window after reorder + void ColumnMoved( wxDataViewColumn* col, unsigned int new_pos ); + + // update the display after a change to an individual column + void OnColumnChange(unsigned int idx); + + // update after the column width changes due to interactive resizing + void OnColumnResized(); + + // update after the column width changes because of e.g. title or bitmap + // change, invalidates the column best width and calls OnColumnChange() + void OnColumnWidthChange(unsigned int idx); + + // update after a change to the number of columns + void OnColumnsCountChanged(); + + wxWindow *GetMainWindow() { return (wxWindow*) m_clientArea; } + + // return the index of the given column in m_cols + int GetColumnIndex(const wxDataViewColumn *column) const; + + // Return the index of the column having the given model index. + int GetModelColumnIndex(unsigned int model_column) const; + + // return the column displayed at the given position in the control + wxDataViewColumn *GetColumnAt(unsigned int pos) const; + + virtual wxDataViewColumn *GetCurrentColumn() const wxOVERRIDE; + + virtual void OnInternalIdle() wxOVERRIDE; + +#if wxUSE_ACCESSIBILITY + virtual wxAccessible* CreateAccessible() wxOVERRIDE; +#endif // wxUSE_ACCESSIBILITY + +private: + // Implement pure virtual method inherited from wxCompositeWindow. + virtual wxWindowList GetCompositeWindowParts() const wxOVERRIDE; + + virtual wxDataViewItem DoGetCurrentItem() const wxOVERRIDE; + virtual void DoSetCurrentItem(const wxDataViewItem& item) wxOVERRIDE; + + virtual void DoExpand(const wxDataViewItem& item, bool expandChildren) wxOVERRIDE; + + void InvalidateColBestWidths(); + void InvalidateColBestWidth(int idx); + void UpdateColWidths(); + + void DoClearColumns(); + + wxVector m_cols; + // cached column best widths information, values are for + // respective columns from m_cols and the arrays have same size + struct CachedColWidthInfo + { + CachedColWidthInfo() : width(0), dirty(true) {} + int width; // cached width or 0 if not computed + bool dirty; // column was invalidated, header needs updating + }; + wxVector m_colsBestWidths; + // This indicates that at least one entry in m_colsBestWidths has 'dirty' + // flag set. It's cheaper to check one flag in OnInternalIdle() than to + // iterate over m_colsBestWidths to check if anything needs to be done. + bool m_colsDirty; + + wxDataViewModelNotifier *m_notifier; + wxDataViewMainWindow *m_clientArea; + wxDataViewHeaderWindow *m_headerArea; + + // user defined color to draw row lines, may be invalid + wxColour m_alternateRowColour; + + // columns indices used for sorting, empty if nothing is sorted + wxVector m_sortingColumnIdxs; + + // if true, allow sorting by more than one column + bool m_allowMultiColumnSort; + +private: + void OnSize( wxSizeEvent &event ); + virtual wxSize GetSizeAvailableForScrollTarget(const wxSize& size) wxOVERRIDE; + + // we need to return a special WM_GETDLGCODE value to process just the + // arrows but let the other navigation characters through +#ifdef __WXMSW__ + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) wxOVERRIDE; +#endif // __WXMSW__ + + WX_FORWARD_TO_SCROLL_HELPER() + +private: + wxDECLARE_DYNAMIC_CLASS(wxDataViewCtrl); + wxDECLARE_NO_COPY_CLASS(wxDataViewCtrl); + wxDECLARE_EVENT_TABLE(); +}; + +#if wxUSE_ACCESSIBILITY +//----------------------------------------------------------------------------- +// wxDataViewCtrlAccessible +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataViewCtrlAccessible: public wxWindowAccessible +{ +public: + wxDataViewCtrlAccessible(wxDataViewCtrl* win); + virtual ~wxDataViewCtrlAccessible() {} + + virtual wxAccStatus HitTest(const wxPoint& pt, int* childId, + wxAccessible** childObject) wxOVERRIDE; + + virtual wxAccStatus GetLocation(wxRect& rect, int elementId) wxOVERRIDE; + + virtual wxAccStatus Navigate(wxNavDir navDir, int fromId, + int* toId, wxAccessible** toObject) wxOVERRIDE; + + virtual wxAccStatus GetName(int childId, wxString* name) wxOVERRIDE; + + virtual wxAccStatus GetChildCount(int* childCount) wxOVERRIDE; + + virtual wxAccStatus GetChild(int childId, wxAccessible** child) wxOVERRIDE; + + // wxWindowAccessible::GetParent() implementation is enough. + // virtual wxAccStatus GetParent(wxAccessible** parent) wxOVERRIDE; + + virtual wxAccStatus DoDefaultAction(int childId) wxOVERRIDE; + + virtual wxAccStatus GetDefaultAction(int childId, wxString* actionName) wxOVERRIDE; + + virtual wxAccStatus GetDescription(int childId, wxString* description) wxOVERRIDE; + + virtual wxAccStatus GetHelpText(int childId, wxString* helpText) wxOVERRIDE; + + virtual wxAccStatus GetKeyboardShortcut(int childId, wxString* shortcut) wxOVERRIDE; + + virtual wxAccStatus GetRole(int childId, wxAccRole* role) wxOVERRIDE; + + virtual wxAccStatus GetState(int childId, long* state) wxOVERRIDE; + + virtual wxAccStatus GetValue(int childId, wxString* strValue) wxOVERRIDE; + + virtual wxAccStatus Select(int childId, wxAccSelectionFlags selectFlags) wxOVERRIDE; + + virtual wxAccStatus GetFocus(int* childId, wxAccessible** child) wxOVERRIDE; + + virtual wxAccStatus GetSelections(wxVariant* selections) wxOVERRIDE; +}; +#endif // wxUSE_ACCESSIBILITY + +#endif // __GENERICDATAVIEWCTRLH__ diff --git a/lib/wxWidgets/include/wx/generic/datectrl.h b/lib/wxWidgets/include/wx/generic/datectrl.h new file mode 100644 index 0000000..365f568 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/datectrl.h @@ -0,0 +1,94 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/datectrl.h +// Purpose: generic wxDatePickerCtrl implementation +// Author: Andreas Pflug +// Modified by: +// Created: 2005-01-19 +// Copyright: (c) 2005 Andreas Pflug +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_DATECTRL_H_ +#define _WX_GENERIC_DATECTRL_H_ + +#include "wx/compositewin.h" +#include "wx/containr.h" + +class WXDLLIMPEXP_FWD_CORE wxComboCtrl; + +class WXDLLIMPEXP_FWD_CORE wxCalendarCtrl; +class WXDLLIMPEXP_FWD_CORE wxCalendarComboPopup; + +typedef wxDatePickerCtrlCommonBase wxDatePickerCtrlGenericBase; + +class WXDLLIMPEXP_CORE wxDatePickerCtrlGeneric + : public wxCompositeWindow< wxNavigationEnabled > +{ +public: + // creating the control + wxDatePickerCtrlGeneric() { Init(); } + virtual ~wxDatePickerCtrlGeneric(); + wxDatePickerCtrlGeneric(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) + { + Init(); + + (void)Create(parent, id, date, pos, size, style, validator, name); + } + + bool Create(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); + + // wxDatePickerCtrl methods + void SetValue(const wxDateTime& date) wxOVERRIDE; + wxDateTime GetValue() const wxOVERRIDE; + + bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const wxOVERRIDE; + void SetRange(const wxDateTime &dt1, const wxDateTime &dt2) wxOVERRIDE; + + bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime, + const wxDateTime& upperdate = wxDefaultDateTime); + + // extra methods available only in this (generic) implementation + wxCalendarCtrl *GetCalendar() const; + + + // implementation only from now on + // ------------------------------- + + // overridden base class methods + virtual bool Destroy() wxOVERRIDE; + +protected: + virtual wxSize DoGetBestSize() const wxOVERRIDE; + +private: + void Init(); + + // return the list of the windows composing this one + virtual wxWindowList GetCompositeWindowParts() const wxOVERRIDE; + + void OnText(wxCommandEvent &event); + void OnSize(wxSizeEvent& event); + + wxComboCtrl* m_combo; + wxCalendarComboPopup* m_popup; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxDatePickerCtrlGeneric); +}; + +#endif // _WX_GENERIC_DATECTRL_H_ + diff --git a/lib/wxWidgets/include/wx/generic/dcpsg.h b/lib/wxWidgets/include/wx/generic/dcpsg.h new file mode 100644 index 0000000..cf3e135 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/dcpsg.h @@ -0,0 +1,174 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/dcpsg.h +// Purpose: wxPostScriptDC class +// Author: Julian Smart and others +// Modified by: +// Copyright: (c) Julian Smart and Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCPSG_H_ +#define _WX_DCPSG_H_ + +#include "wx/defs.h" + +#if wxUSE_PRINTING_ARCHITECTURE && wxUSE_POSTSCRIPT + +#include "wx/dc.h" +#include "wx/dcprint.h" +#include "wx/dialog.h" +#include "wx/module.h" +#include "wx/cmndata.h" +#include "wx/strvararg.h" + +//----------------------------------------------------------------------------- +// wxPostScriptDC +//----------------------------------------------------------------------------- + + +class WXDLLIMPEXP_CORE wxPostScriptDC : public wxDC +{ +public: + wxPostScriptDC(); + + // Recommended constructor + wxPostScriptDC(const wxPrintData& printData); + +private: + wxDECLARE_DYNAMIC_CLASS(wxPostScriptDC); +}; + +class WXDLLIMPEXP_CORE wxPostScriptDCImpl : public wxDCImpl +{ +public: + wxPostScriptDCImpl( wxPrinterDC *owner ); + wxPostScriptDCImpl( wxPrinterDC *owner, const wxPrintData& data ); + wxPostScriptDCImpl( wxPostScriptDC *owner ); + wxPostScriptDCImpl( wxPostScriptDC *owner, const wxPrintData& data ); + + void Init(); + + virtual ~wxPostScriptDCImpl(); + + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk() const wxOVERRIDE; + + bool CanDrawBitmap() const wxOVERRIDE { return true; } + + void Clear() wxOVERRIDE; + void SetFont( const wxFont& font ) wxOVERRIDE; + void SetPen( const wxPen& pen ) wxOVERRIDE; + void SetBrush( const wxBrush& brush ) wxOVERRIDE; + void SetLogicalFunction( wxRasterOperationMode function ) wxOVERRIDE; + void SetBackground( const wxBrush& brush ) wxOVERRIDE; + + void DestroyClippingRegion() wxOVERRIDE; + + bool StartDoc(const wxString& message) wxOVERRIDE; + void EndDoc() wxOVERRIDE; + void StartPage() wxOVERRIDE; + void EndPage() wxOVERRIDE; + + wxCoord GetCharHeight() const wxOVERRIDE; + wxCoord GetCharWidth() const wxOVERRIDE; + bool CanGetTextExtent() const wxOVERRIDE { return true; } + + // Resolution in pixels per logical inch + wxSize GetPPI() const wxOVERRIDE; + + virtual wxSize FromDIP(const wxSize& sz) const wxOVERRIDE; + + virtual wxSize ToDIP(const wxSize& sz) const wxOVERRIDE; + + virtual void ComputeScaleAndOrigin() wxOVERRIDE; + + void SetBackgroundMode(int WXUNUSED(mode)) wxOVERRIDE { } +#if wxUSE_PALETTE + void SetPalette(const wxPalette& WXUNUSED(palette)) wxOVERRIDE { } +#endif + + void SetPrintData(const wxPrintData& data); + wxPrintData& GetPrintData() { return m_printData; } + + virtual int GetDepth() const wxOVERRIDE { return 24; } + + void PsPrint( const wxString& psdata ); + + // Overridden for wxPrinterDC Impl + + virtual int GetResolution() const wxOVERRIDE; + virtual wxRect GetPaperRect() const wxOVERRIDE; + + virtual void* GetHandle() const wxOVERRIDE { return NULL; } + +protected: + bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, + wxFloodFillStyle style = wxFLOOD_SURFACE) wxOVERRIDE; + bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const wxOVERRIDE; + void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) wxOVERRIDE; + void DoCrossHair(wxCoord x, wxCoord y) wxOVERRIDE ; + void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc) wxOVERRIDE; + void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea) wxOVERRIDE; + void DoDrawPoint(wxCoord x, wxCoord y) wxOVERRIDE; + void DoDrawLines(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0) wxOVERRIDE; + void DoDrawPolygon(int n, const wxPoint points[], + wxCoord xoffset = 0, wxCoord yoffset = 0, + wxPolygonFillMode fillStyle = wxODDEVEN_RULE) wxOVERRIDE; + void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[], + wxCoord xoffset = 0, wxCoord yoffset = 0, + wxPolygonFillMode fillStyle = wxODDEVEN_RULE) wxOVERRIDE; + void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE; + void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20) wxOVERRIDE; + void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE; +#if wxUSE_SPLINES + void DoDrawSpline(const wxPointList *points) wxOVERRIDE; +#endif + bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, + wxDC *source, wxCoord xsrc, wxCoord ysrc, + wxRasterOperationMode rop = wxCOPY, bool useMask = false, + wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) wxOVERRIDE; + void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) wxOVERRIDE; + void DoDrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false) wxOVERRIDE; + void DoDrawText(const wxString& text, wxCoord x, wxCoord y) wxOVERRIDE; + void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle) wxOVERRIDE; + void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE; + void DoSetDeviceClippingRegion( const wxRegion &WXUNUSED(clip)) wxOVERRIDE + { + wxFAIL_MSG( "not implemented" ); + } + void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + const wxFont *theFont = NULL) const wxOVERRIDE; + void DoGetSize(int* width, int* height) const wxOVERRIDE; + void DoGetSizeMM(int *width, int *height) const wxOVERRIDE; + + // Common part of DoDrawText() and DoDrawRotatedText() + void DrawAnyText(const wxWX2MBbuf& textbuf, wxCoord testDescent, double lineHeight); + // Actually set PostScript font + void SetPSFont(); + // Set PostScript color + void SetPSColour(const wxColour& col); + + FILE* m_pstream; // PostScript output stream + unsigned char m_currentRed; + unsigned char m_currentGreen; + unsigned char m_currentBlue; + int m_pageNumber; + bool m_clipping; + mutable double m_underlinePosition; + mutable double m_underlineThickness; + wxPrintData m_printData; + double m_pageHeight; + wxArrayString m_definedPSFonts; + bool m_isFontChanged; + +private: + wxDECLARE_DYNAMIC_CLASS(wxPostScriptDCImpl); +}; + +#endif + // wxUSE_POSTSCRIPT && wxUSE_PRINTING_ARCHITECTURE + +#endif + // _WX_DCPSG_H_ diff --git a/lib/wxWidgets/include/wx/generic/dirctrlg.h b/lib/wxWidgets/include/wx/generic/dirctrlg.h new file mode 100644 index 0000000..35bb306 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/dirctrlg.h @@ -0,0 +1,328 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/dirctrlg.h +// Purpose: wxGenericDirCtrl class +// Builds on wxDirCtrl class written by Robert Roebling for the +// wxFile application, modified by Harm van der Heijden. +// Further modified for Windows. +// Author: Robert Roebling, Harm van der Heijden, Julian Smart et al +// Modified by: +// Created: 21/3/2000 +// Copyright: (c) Robert Roebling, Harm van der Heijden, Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DIRCTRL_H_ +#define _WX_DIRCTRL_H_ + +#if wxUSE_DIRDLG || wxUSE_FILEDLG + +#include "wx/treectrl.h" +#include "wx/dialog.h" +#include "wx/dirdlg.h" +#include "wx/choice.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; +class WXDLLIMPEXP_FWD_BASE wxHashTable; + +extern WXDLLIMPEXP_DATA_CORE(const char) wxDirDialogDefaultFolderStr[]; + +//----------------------------------------------------------------------------- +// Extra styles for wxGenericDirCtrl +//----------------------------------------------------------------------------- + +enum +{ + // Only allow directory viewing/selection, no files + wxDIRCTRL_DIR_ONLY = 0x0010, + // When setting the default path, select the first file in the directory + wxDIRCTRL_SELECT_FIRST = 0x0020, + // Show the filter list + wxDIRCTRL_SHOW_FILTERS = 0x0040, + // Use 3D borders on internal controls + wxDIRCTRL_3D_INTERNAL = 0x0080, + // Editable labels + wxDIRCTRL_EDIT_LABELS = 0x0100, + // Allow multiple selection + wxDIRCTRL_MULTIPLE = 0x0200, + + wxDIRCTRL_DEFAULT_STYLE = wxDIRCTRL_3D_INTERNAL +}; + +//----------------------------------------------------------------------------- +// wxDirItemData +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDirItemData : public wxTreeItemData +{ +public: + wxDirItemData(const wxString& path, const wxString& name, bool isDir); + virtual ~wxDirItemData(){} + void SetNewDirName(const wxString& path); + + bool HasSubDirs() const; + bool HasFiles(const wxString& spec = wxEmptyString) const; + + wxString m_path, m_name; + bool m_isHidden; + bool m_isExpanded; + bool m_isDir; +}; + +//----------------------------------------------------------------------------- +// wxDirCtrl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxDirFilterListCtrl; + +class WXDLLIMPEXP_CORE wxGenericDirCtrl: public wxControl +{ +public: + wxGenericDirCtrl(); + wxGenericDirCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, + const wxString &dir = wxASCII_STR(wxDirDialogDefaultFolderStr), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDIRCTRL_DEFAULT_STYLE, + const wxString& filter = wxEmptyString, + int defaultFilter = 0, + const wxString& name = wxASCII_STR(wxTreeCtrlNameStr) ) + { + Init(); + Create(parent, id, dir, pos, size, style, filter, defaultFilter, name); + } + + bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, + const wxString &dir = wxASCII_STR(wxDirDialogDefaultFolderStr), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDIRCTRL_DEFAULT_STYLE, + const wxString& filter = wxEmptyString, + int defaultFilter = 0, + const wxString& name = wxASCII_STR(wxTreeCtrlNameStr) ); + + virtual void Init(); + + virtual ~wxGenericDirCtrl(); + + void OnExpandItem(wxTreeEvent &event ); + void OnCollapseItem(wxTreeEvent &event ); + void OnBeginEditItem(wxTreeEvent &event ); + void OnEndEditItem(wxTreeEvent &event ); + void OnTreeSelChange(wxTreeEvent &event); + void OnItemActivated(wxTreeEvent &event); + void OnSize(wxSizeEvent &event ); + + // Try to expand as much of the given path as possible. + virtual bool ExpandPath(const wxString& path); + // collapse the path + virtual bool CollapsePath(const wxString& path); + + // Accessors + + virtual inline wxString GetDefaultPath() const { return m_defaultPath; } + virtual void SetDefaultPath(const wxString& path) { m_defaultPath = path; } + + // Get dir or filename + virtual wxString GetPath() const; + virtual void GetPaths(wxArrayString& paths) const; + + // Get selected filename path only (else empty string). + // I.e. don't count a directory as a selection + virtual wxString GetFilePath() const; + virtual void GetFilePaths(wxArrayString& paths) const; + virtual void SetPath(const wxString& path); + + virtual void SelectPath(const wxString& path, bool select = true); + virtual void SelectPaths(const wxArrayString& paths); + + virtual void ShowHidden( bool show ); + virtual bool GetShowHidden() { return m_showHidden; } + + virtual wxString GetFilter() const { return m_filter; } + virtual void SetFilter(const wxString& filter); + + virtual int GetFilterIndex() const { return m_currentFilter; } + virtual void SetFilterIndex(int n); + + virtual wxTreeItemId GetRootId() { return m_rootId; } + + virtual wxTreeCtrl* GetTreeCtrl() const { return m_treeCtrl; } + virtual wxDirFilterListCtrl* GetFilterListCtrl() const { return m_filterListCtrl; } + + virtual void UnselectAll(); + + // Helper + virtual void SetupSections(); + + // Find the child that matches the first part of 'path'. + // E.g. if a child path is "/usr" and 'path' is "/usr/include" + // then the child for /usr is returned. + // If the path string has been used (we're at the leaf), done is set to true + virtual wxTreeItemId FindChild(wxTreeItemId parentId, const wxString& path, bool& done); + + wxString GetPath(wxTreeItemId itemId) const; + + // Resize the components of the control + virtual void DoResize(); + + // Collapse & expand the tree, thus re-creating it from scratch: + virtual void ReCreateTree(); + + // Collapse the entire tree + virtual void CollapseTree(); + + // overridden base class methods + virtual void SetFocus() wxOVERRIDE; + +protected: + virtual void ExpandRoot(); + virtual void ExpandDir(wxTreeItemId parentId); + virtual void CollapseDir(wxTreeItemId parentId); + virtual const wxTreeItemId AddSection(const wxString& path, const wxString& name, int imageId = 0); + virtual wxTreeItemId AppendItem (const wxTreeItemId & parent, + const wxString & text, + int image = -1, int selectedImage = -1, + wxTreeItemData * data = NULL); + //void FindChildFiles(wxTreeItemId id, int dirFlags, wxArrayString& filenames); + virtual wxTreeCtrl* CreateTreeCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long treeStyle); + + // Extract description and actual filter from overall filter string + bool ExtractWildcard(const wxString& filterStr, int n, wxString& filter, wxString& description); + +private: + void PopulateNode(wxTreeItemId node); + wxDirItemData* GetItemData(wxTreeItemId itemId); + + bool m_showHidden; + wxTreeItemId m_rootId; + wxString m_defaultPath; // Starting path + long m_styleEx; // Extended style + wxString m_filter; // Wildcards in same format as per wxFileDialog + int m_currentFilter; // The current filter index + wxString m_currentFilterStr; // Current filter string + wxTreeCtrl* m_treeCtrl; + wxDirFilterListCtrl* m_filterListCtrl; + +private: + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxGenericDirCtrl); + wxDECLARE_NO_COPY_CLASS(wxGenericDirCtrl); +}; + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DIRCTRL_SELECTIONCHANGED, wxTreeEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DIRCTRL_FILEACTIVATED, wxTreeEvent ); + +#define wx__DECLARE_DIRCTRL_EVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_DIRCTRL_ ## evt, id, wxTreeEventHandler(fn)) + +#define EVT_DIRCTRL_SELECTIONCHANGED(id, fn) wx__DECLARE_DIRCTRL_EVT(SELECTIONCHANGED, id, fn) +#define EVT_DIRCTRL_FILEACTIVATED(id, fn) wx__DECLARE_DIRCTRL_EVT(FILEACTIVATED, id, fn) + +//----------------------------------------------------------------------------- +// wxDirFilterListCtrl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDirFilterListCtrl: public wxChoice +{ +public: + wxDirFilterListCtrl() { Init(); } + wxDirFilterListCtrl(wxGenericDirCtrl* parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0) + { + Init(); + Create(parent, id, pos, size, style); + } + + bool Create(wxGenericDirCtrl* parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0); + + void Init(); + + virtual ~wxDirFilterListCtrl() {} + + //// Operations + void FillFilterList(const wxString& filter, int defaultFilter); + + //// Events + void OnSelFilter(wxCommandEvent& event); + +protected: + wxGenericDirCtrl* m_dirCtrl; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_CLASS(wxDirFilterListCtrl); + wxDECLARE_NO_COPY_CLASS(wxDirFilterListCtrl); +}; + +#if !defined(__WXMSW__) && !defined(__WXMAC__) + #define wxDirCtrl wxGenericDirCtrl +#endif + +// Symbols for accessing individual controls +#define wxID_TREECTRL 7000 +#define wxID_FILTERLISTCTRL 7001 + +#endif // wxUSE_DIRDLG + +//------------------------------------------------------------------------- +// wxFileIconsTable - use wxTheFileIconsTable which is created as necessary +//------------------------------------------------------------------------- + +#if wxUSE_DIRDLG || wxUSE_FILEDLG || wxUSE_FILECTRL + +class WXDLLIMPEXP_FWD_CORE wxImageList; + +class WXDLLIMPEXP_CORE wxFileIconsTable +{ +public: + wxFileIconsTable(); + ~wxFileIconsTable(); + + enum iconId_Type + { + folder, + folder_open, + computer, + drive, + cdrom, + floppy, + removeable, + file, + executable + }; + + int GetIconID(const wxString& extension, const wxString& mime = wxEmptyString); + wxImageList *GetSmallImageList(); + + const wxSize& GetSize() const { return m_size; } + void SetSize(const wxSize& sz) { m_size = sz; } + + bool IsOk() const { return m_smallImageList != NULL; } + +protected: + void Create(const wxSize& sz); // create on first use + + wxImageList *m_smallImageList; + wxHashTable *m_HashTable; + wxSize m_size; +}; + +// The global fileicons table +extern WXDLLIMPEXP_DATA_CORE(wxFileIconsTable *) wxTheFileIconsTable; + +#endif // wxUSE_DIRDLG || wxUSE_FILEDLG || wxUSE_FILECTRL + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_DIRCTRL_SELECTIONCHANGED wxEVT_DIRCTRL_SELECTIONCHANGED +#define wxEVT_COMMAND_DIRCTRL_FILEACTIVATED wxEVT_DIRCTRL_FILEACTIVATED + +#endif + // _WX_DIRCTRLG_H_ diff --git a/lib/wxWidgets/include/wx/generic/dirdlgg.h b/lib/wxWidgets/include/wx/generic/dirdlgg.h new file mode 100644 index 0000000..5656ef5 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/dirdlgg.h @@ -0,0 +1,84 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/dirdlgg.h +// Purpose: wxGenericDirCtrl class +// Builds on wxDirCtrl class written by Robert Roebling for the +// wxFile application, modified by Harm van der Heijden. +// Further modified for Windows. +// Author: Robert Roebling, Harm van der Heijden, Julian Smart et al +// Modified by: +// Created: 21/3/2000 +// Copyright: (c) Robert Roebling, Harm van der Heijden, Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DIRDLGG_H_ +#define _WX_DIRDLGG_H_ + +class WXDLLIMPEXP_FWD_CORE wxGenericDirCtrl; +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; +class WXDLLIMPEXP_FWD_CORE wxTreeEvent; + +// we may be included directly as well as from wx/dirdlg.h (FIXME) +extern WXDLLIMPEXP_DATA_CORE(const char) wxDirDialogNameStr[]; +extern WXDLLIMPEXP_DATA_CORE(const char) wxDirSelectorPromptStr[]; + +#ifndef wxDD_DEFAULT_STYLE +#define wxDD_DEFAULT_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) +#endif + +#include "wx/dialog.h" + +//----------------------------------------------------------------------------- +// wxGenericDirDialog +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGenericDirDialog : public wxDirDialogBase +{ +public: + wxGenericDirDialog() : wxDirDialogBase() { } + + wxGenericDirDialog(wxWindow* parent, + const wxString& title = wxASCII_STR(wxDirSelectorPromptStr), + const wxString& defaultPath = wxEmptyString, + long style = wxDD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize,//Size(450, 550), + const wxString& name = wxASCII_STR(wxDirDialogNameStr)); + + bool Create(wxWindow* parent, + const wxString& title = wxASCII_STR(wxDirSelectorPromptStr), + const wxString& defaultPath = wxEmptyString, + long style = wxDD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize,//Size(450, 550), + const wxString& name = wxASCII_STR(wxDirDialogNameStr)); + + //// Accessors + void SetPath(const wxString& path) wxOVERRIDE; + wxString GetPath() const wxOVERRIDE; + + //// Overrides + virtual int ShowModal() wxOVERRIDE; + virtual void EndModal(int retCode) wxOVERRIDE; + + // this one is specific to wxGenericDirDialog + wxTextCtrl* GetInputCtrl() const { return m_input; } + +protected: + //// Event handlers + void OnCloseWindow(wxCloseEvent& event); + void OnOK(wxCommandEvent& event); + void OnTreeSelected(wxTreeEvent &event); + void OnTreeKeyDown(wxTreeEvent &event); + void OnNew(wxCommandEvent& event); + void OnGoHome(wxCommandEvent& event); + void OnShowHidden(wxCommandEvent& event); + + wxGenericDirCtrl* m_dirCtrl; + wxTextCtrl* m_input; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxGenericDirDialog); +}; + +#endif // _WX_DIRDLGG_H_ diff --git a/lib/wxWidgets/include/wx/generic/dragimgg.h b/lib/wxWidgets/include/wx/generic/dragimgg.h new file mode 100644 index 0000000..4c54243 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/dragimgg.h @@ -0,0 +1,248 @@ +////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/dragimgg.h +// Purpose: wxDragImage class: a kind of a cursor, that can cope +// with more sophisticated images +// Author: Julian Smart +// Modified by: +// Created: 29/2/2000 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DRAGIMGG_H_ +#define _WX_DRAGIMGG_H_ + +#include "wx/bitmap.h" +#include "wx/icon.h" +#include "wx/cursor.h" +#include "wx/treectrl.h" +#include "wx/listctrl.h" +#include "wx/log.h" +#include "wx/overlay.h" + +/* + To use this class, create a wxDragImage when you start dragging, for example: + + void MyTreeCtrl::OnBeginDrag(wxTreeEvent& event) + { +#ifdef __WXMSW__ + ::UpdateWindow((HWND) GetHWND()); // We need to implement this in wxWidgets +#endif + + CaptureMouse(); + + m_dragImage = new wxDragImage(* this, itemId); + m_dragImage->BeginDrag(wxPoint(0, 0), this); + m_dragImage->Move(pt, this); + m_dragImage->Show(this); + ... + } + + In your OnMouseMove function, hide the image, do any display updating required, + then move and show the image again: + + void MyTreeCtrl::OnMouseMove(wxMouseEvent& event) + { + if (m_dragMode == MY_TREE_DRAG_NONE) + { + event.Skip(); + return; + } + + // Prevent screen corruption by hiding the image + if (m_dragImage) + m_dragImage->Hide(this); + + // Do some updating of the window, such as highlighting the drop target + ... + +#ifdef __WXMSW__ + if (updateWindow) + ::UpdateWindow((HWND) GetHWND()); +#endif + + // Move and show the image again + m_dragImage->Move(event.GetPosition(), this); + m_dragImage->Show(this); + } + + Eventually we end the drag and delete the drag image. + + void MyTreeCtrl::OnLeftUp(wxMouseEvent& event) + { + ... + + // End the drag and delete the drag image + if (m_dragImage) + { + m_dragImage->EndDrag(this); + delete m_dragImage; + m_dragImage = NULL; + } + ReleaseMouse(); + } +*/ + +/* + * wxGenericDragImage + */ + +class WXDLLIMPEXP_CORE wxGenericDragImage: public wxObject +{ +public: + + // Ctors & dtor + //////////////////////////////////////////////////////////////////////////// + + wxGenericDragImage(const wxCursor& cursor = wxNullCursor) + { + Init(); + Create(cursor); + } + + wxGenericDragImage(const wxBitmap& image, const wxCursor& cursor = wxNullCursor) + { + Init(); + + Create(image, cursor); + } + + wxGenericDragImage(const wxIcon& image, const wxCursor& cursor = wxNullCursor) + { + Init(); + + Create(image, cursor); + } + + wxGenericDragImage(const wxString& str, const wxCursor& cursor = wxNullCursor) + { + Init(); + + Create(str, cursor); + } + +#if wxUSE_TREECTRL + wxGenericDragImage(const wxTreeCtrl& treeCtrl, wxTreeItemId& id) + { + Init(); + + Create(treeCtrl, id); + } +#endif + +#if wxUSE_LISTCTRL + wxGenericDragImage(const wxListCtrl& listCtrl, long id) + { + Init(); + + Create(listCtrl, id); + } +#endif + + virtual ~wxGenericDragImage(); + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + // For efficiency, tell wxGenericDragImage to use a bitmap that's already + // created (e.g. from last drag) + void SetBackingBitmap(wxBitmap* bitmap) { m_pBackingBitmap = bitmap; } + + // Operations + //////////////////////////////////////////////////////////////////////////// + + // Create a drag image with a virtual image (need to override DoDrawImage, GetImageRect) + bool Create(const wxCursor& cursor = wxNullCursor); + + // Create a drag image from a bitmap and optional cursor + bool Create(const wxBitmap& image, const wxCursor& cursor = wxNullCursor); + + // Create a drag image from an icon and optional cursor + bool Create(const wxIcon& image, const wxCursor& cursor = wxNullCursor); + + // Create a drag image from a string and optional cursor + bool Create(const wxString& str, const wxCursor& cursor = wxNullCursor); + +#if wxUSE_TREECTRL + // Create a drag image for the given tree control item + bool Create(const wxTreeCtrl& treeCtrl, wxTreeItemId& id); +#endif + +#if wxUSE_LISTCTRL + // Create a drag image for the given list control item + bool Create(const wxListCtrl& listCtrl, long id); +#endif + + // Begin drag. hotspot is the location of the drag position relative to the upper-left + // corner of the image. + bool BeginDrag(const wxPoint& hotspot, wxWindow* window, bool fullScreen = false, wxRect* rect = NULL); + + // Begin drag. hotspot is the location of the drag position relative to the upper-left + // corner of the image. This is full screen only. fullScreenRect gives the + // position of the window on the screen, to restrict the drag to. + bool BeginDrag(const wxPoint& hotspot, wxWindow* window, wxWindow* fullScreenRect); + + // End drag + bool EndDrag(); + + // Move the image: call from OnMouseMove. Pt is in window client coordinates if window + // is non-NULL, or in screen coordinates if NULL. + bool Move(const wxPoint& pt); + + // Show the image + bool Show(); + + // Hide the image + bool Hide(); + + // Implementation + //////////////////////////////////////////////////////////////////////////// + + void Init(); + + // Override this if you are using a virtual image (drawing your own image) + virtual wxRect GetImageRect(const wxPoint& pos) const; + + // Override this if you are using a virtual image (drawing your own image) + virtual bool DoDrawImage(wxDC& dc, const wxPoint& pos) const; + + // Override this if you wish to draw the window contents to the backing bitmap + // yourself. This can be desirable if you wish to avoid flicker by not having to + // redraw the window itself before dragging in order to be graphic-minus-dragged-objects. + // Instead, paint the drag image's backing bitmap to be correct, and leave the window + // to be updated only when dragging the objects away (thus giving a smoother appearance). + virtual bool UpdateBackingFromWindow(wxDC& windowDC, wxMemoryDC& destDC, + const wxRect& sourceRect, const wxRect& destRect) const; + + // Erase and redraw simultaneously if possible + virtual bool RedrawImage(const wxPoint& oldPos, const wxPoint& newPos, bool eraseOld, bool drawNew); + +protected: + wxBitmap m_bitmap; + wxIcon m_icon; + wxCursor m_cursor; + wxCursor m_oldCursor; +// wxPoint m_hotspot; + wxPoint m_offset; // The hostpot value passed to BeginDrag + wxPoint m_position; + bool m_isDirty; + bool m_isShown; + wxWindow* m_window; + wxDC* m_windowDC; + wxOverlay m_overlay; + // Stores the window contents while we're dragging the image around + wxBitmap m_backingBitmap; + wxBitmap* m_pBackingBitmap; // Pointer to existing backing bitmap + // (pass to wxGenericDragImage as an efficiency measure) + // A temporary bitmap for repairing/redrawing + wxBitmap m_repairBitmap; + wxRect m_boundingRect; + bool m_fullScreen; + +private: + wxDECLARE_DYNAMIC_CLASS(wxGenericDragImage); + wxDECLARE_NO_COPY_CLASS(wxGenericDragImage); +}; + +#endif + // _WX_DRAGIMGG_H_ diff --git a/lib/wxWidgets/include/wx/generic/dvrenderer.h b/lib/wxWidgets/include/wx/generic/dvrenderer.h new file mode 100644 index 0000000..a2acca8 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/dvrenderer.h @@ -0,0 +1,75 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/dvrenderer.h +// Purpose: wxDataViewRenderer for generic wxDataViewCtrl implementation +// Author: Robert Roebling, Vadim Zeitlin +// Created: 2009-11-07 (extracted from wx/generic/dataview.h) +// Copyright: (c) 2006 Robert Roebling +// (c) 2009 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_DVRENDERER_H_ +#define _WX_GENERIC_DVRENDERER_H_ + +// ---------------------------------------------------------------------------- +// wxDataViewRenderer +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewRenderer: public wxDataViewCustomRendererBase +{ +public: + wxDataViewRenderer( const wxString &varianttype, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT ); + virtual ~wxDataViewRenderer(); + + virtual wxDC *GetDC() wxOVERRIDE; + + virtual void SetAlignment( int align ) wxOVERRIDE; + virtual int GetAlignment() const wxOVERRIDE; + + virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE) wxOVERRIDE + { m_ellipsizeMode = mode; } + virtual wxEllipsizeMode GetEllipsizeMode() const wxOVERRIDE + { return m_ellipsizeMode; } + + virtual void SetMode( wxDataViewCellMode mode ) wxOVERRIDE + { m_mode = mode; } + virtual wxDataViewCellMode GetMode() const wxOVERRIDE + { return m_mode; } + + // implementation + + // This callback is used by generic implementation of wxDVC itself. It's + // different from the corresponding ActivateCell() method which should only + // be overridable for the custom renderers while the generic implementation + // uses this one for all of them, including the standard ones. + + virtual bool WXActivateCell(const wxRect& WXUNUSED(cell), + wxDataViewModel *WXUNUSED(model), + const wxDataViewItem & WXUNUSED(item), + unsigned int WXUNUSED(col), + const wxMouseEvent* WXUNUSED(mouseEvent)) + { return false; } + + void SetState(int state) { m_state = state; } + +protected: + virtual bool IsHighlighted() const wxOVERRIDE + { return m_state & wxDATAVIEW_CELL_SELECTED; } + +private: + int m_align; + wxDataViewCellMode m_mode; + + wxEllipsizeMode m_ellipsizeMode; + + wxDC *m_dc; + + int m_state; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer); +}; + +#endif // _WX_GENERIC_DVRENDERER_H_ + diff --git a/lib/wxWidgets/include/wx/generic/dvrenderers.h b/lib/wxWidgets/include/wx/generic/dvrenderers.h new file mode 100644 index 0000000..17d963e --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/dvrenderers.h @@ -0,0 +1,229 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/dvrenderers.h +// Purpose: All generic wxDataViewCtrl renderer classes +// Author: Robert Roebling, Vadim Zeitlin +// Created: 2009-11-07 (extracted from wx/generic/dataview.h) +// Copyright: (c) 2006 Robert Roebling +// (c) 2009 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_DVRENDERERS_H_ +#define _WX_GENERIC_DVRENDERERS_H_ + +// --------------------------------------------------------- +// wxDataViewCustomRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewCustomRenderer: public wxDataViewRenderer +{ +public: + static wxString GetDefaultType() { return wxS("string"); } + + wxDataViewCustomRenderer( const wxString &varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT ); + + + // see the explanation of the following WXOnXXX() methods in wx/generic/dvrenderer.h + + virtual bool WXActivateCell(const wxRect& cell, + wxDataViewModel *model, + const wxDataViewItem& item, + unsigned int col, + const wxMouseEvent *mouseEvent) wxOVERRIDE + { + return ActivateCell(cell, model, item, col, mouseEvent); + } + +#if wxUSE_ACCESSIBILITY + virtual wxString GetAccessibleDescription() const wxOVERRIDE; +#endif // wxUSE_ACCESSIBILITY + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer); +}; + + +// --------------------------------------------------------- +// wxDataViewTextRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer +{ +public: + static wxString GetDefaultType() { return wxS("string"); } + + wxDataViewTextRenderer( const wxString &varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT ); + virtual ~wxDataViewTextRenderer(); + +#if wxUSE_MARKUP + void EnableMarkup(bool enable = true); +#endif // wxUSE_MARKUP + + virtual bool SetValue( const wxVariant &value ) wxOVERRIDE; + virtual bool GetValue( wxVariant &value ) const wxOVERRIDE; +#if wxUSE_ACCESSIBILITY + virtual wxString GetAccessibleDescription() const wxOVERRIDE; +#endif // wxUSE_ACCESSIBILITY + + virtual bool Render(wxRect cell, wxDC *dc, int state) wxOVERRIDE; + virtual wxSize GetSize() const wxOVERRIDE; + + // in-place editing + virtual bool HasEditorCtrl() const wxOVERRIDE; + virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, + const wxVariant &value ) wxOVERRIDE; + virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value ) wxOVERRIDE; + +protected: + wxString m_text; + +private: +#if wxUSE_MARKUP + class wxItemMarkupText *m_markupText; +#endif // wxUSE_MARKUP + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer); +}; + +// --------------------------------------------------------- +// wxDataViewBitmapRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer +{ +public: + static wxString GetDefaultType() { return wxS("wxBitmapBundle"); } + + wxDataViewBitmapRenderer( const wxString &varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT ); + + virtual bool SetValue( const wxVariant &value ) wxOVERRIDE; + virtual bool GetValue( wxVariant &value ) const wxOVERRIDE; + + virtual + bool IsCompatibleVariantType(const wxString& variantType) const wxOVERRIDE; + +#if wxUSE_ACCESSIBILITY + virtual wxString GetAccessibleDescription() const wxOVERRIDE; +#endif // wxUSE_ACCESSIBILITY + + virtual bool Render( wxRect cell, wxDC *dc, int state ) wxOVERRIDE; + virtual wxSize GetSize() const wxOVERRIDE; + +private: + wxBitmapBundle m_bitmapBundle; + +protected: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer); +}; + +// --------------------------------------------------------- +// wxDataViewToggleRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer +{ +public: + static wxString GetDefaultType() { return wxS("bool"); } + + wxDataViewToggleRenderer( const wxString &varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT ); + + void ShowAsRadio() { m_radio = true; } + + virtual bool SetValue( const wxVariant &value ) wxOVERRIDE; + virtual bool GetValue( wxVariant &value ) const wxOVERRIDE; +#if wxUSE_ACCESSIBILITY + virtual wxString GetAccessibleDescription() const wxOVERRIDE; +#endif // wxUSE_ACCESSIBILITY + + virtual bool Render( wxRect cell, wxDC *dc, int state ) wxOVERRIDE; + virtual wxSize GetSize() const wxOVERRIDE; + + // Implementation only, don't use nor override + virtual bool WXActivateCell(const wxRect& cell, + wxDataViewModel *model, + const wxDataViewItem& item, + unsigned int col, + const wxMouseEvent *mouseEvent) wxOVERRIDE; +private: + bool m_toggle; + bool m_radio; + +protected: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer); +}; + +// --------------------------------------------------------- +// wxDataViewProgressRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewRenderer +{ +public: + static wxString GetDefaultType() { return wxS("long"); } + + wxDataViewProgressRenderer( const wxString &label = wxEmptyString, + const wxString &varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT ); + + virtual bool SetValue( const wxVariant &value ) wxOVERRIDE; + virtual bool GetValue( wxVariant& value ) const wxOVERRIDE; +#if wxUSE_ACCESSIBILITY + virtual wxString GetAccessibleDescription() const wxOVERRIDE; +#endif // wxUSE_ACCESSIBILITY + + virtual bool Render(wxRect cell, wxDC *dc, int state) wxOVERRIDE; + virtual wxSize GetSize() const wxOVERRIDE; + +private: + wxString m_label; + int m_value; + +protected: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer); +}; + +// --------------------------------------------------------- +// wxDataViewIconTextRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewRenderer +{ +public: + static wxString GetDefaultType() { return wxS("wxDataViewIconText"); } + + wxDataViewIconTextRenderer( const wxString &varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT ); + + virtual bool SetValue( const wxVariant &value ) wxOVERRIDE; + virtual bool GetValue( wxVariant &value ) const wxOVERRIDE; +#if wxUSE_ACCESSIBILITY + virtual wxString GetAccessibleDescription() const wxOVERRIDE; +#endif // wxUSE_ACCESSIBILITY + + virtual bool Render(wxRect cell, wxDC *dc, int state) wxOVERRIDE; + virtual wxSize GetSize() const wxOVERRIDE; + + virtual bool HasEditorCtrl() const wxOVERRIDE { return true; } + virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, + const wxVariant &value ) wxOVERRIDE; + virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value ) wxOVERRIDE; + +private: + wxDataViewIconText m_value; + +protected: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer); +}; + +#endif // _WX_GENERIC_DVRENDERERS_H_ + diff --git a/lib/wxWidgets/include/wx/generic/fdrepdlg.h b/lib/wxWidgets/include/wx/generic/fdrepdlg.h new file mode 100644 index 0000000..052193c --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/fdrepdlg.h @@ -0,0 +1,70 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/fdrepdlg.h +// Purpose: wxGenericFindReplaceDialog class +// Author: Markus Greither +// Modified by: +// Created: 25/05/2001 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_FDREPDLG_H_ +#define _WX_GENERIC_FDREPDLG_H_ + +class WXDLLIMPEXP_FWD_CORE wxCheckBox; +class WXDLLIMPEXP_FWD_CORE wxRadioBox; +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; + +// ---------------------------------------------------------------------------- +// wxGenericFindReplaceDialog: dialog for searching / replacing text +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGenericFindReplaceDialog : public wxFindReplaceDialogBase +{ +public: + wxGenericFindReplaceDialog() { Init(); } + + wxGenericFindReplaceDialog(wxWindow *parent, + wxFindReplaceData *data, + const wxString& title, + int style = 0) + { + Init(); + + (void)Create(parent, data, title, style); + } + + bool Create(wxWindow *parent, + wxFindReplaceData *data, + const wxString& title, + int style = 0); + +protected: + void Init(); + + void SendEvent(const wxEventType& evtType); + + void OnFind(wxCommandEvent& event); + void OnReplace(wxCommandEvent& event); + void OnReplaceAll(wxCommandEvent& event); + void OnCancel(wxCommandEvent& event); + + void OnUpdateFindUI(wxUpdateUIEvent& event); + + void OnCloseWindow(wxCloseEvent& event); + + wxCheckBox *m_chkCase, + *m_chkWord; + + wxRadioBox *m_radioDir; + + wxTextCtrl *m_textFind, + *m_textRepl; + +private: + wxDECLARE_DYNAMIC_CLASS(wxGenericFindReplaceDialog); + + wxDECLARE_EVENT_TABLE(); +}; + +#endif // _WX_GENERIC_FDREPDLG_H_ diff --git a/lib/wxWidgets/include/wx/generic/filectrlg.h b/lib/wxWidgets/include/wx/generic/filectrlg.h new file mode 100644 index 0000000..76ca57e --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/filectrlg.h @@ -0,0 +1,304 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/filectrlg.h +// Purpose: wxGenericFileCtrl Header +// Author: Diaa M. Sami +// Modified by: +// Created: Jul-07-2007 +// Copyright: (c) Diaa M. Sami +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_FILECTRL_H_ +#define _WX_GENERIC_FILECTRL_H_ + +#if wxUSE_FILECTRL + +#include "wx/containr.h" +#include "wx/listctrl.h" +#include "wx/filectrl.h" +#include "wx/filename.h" + +class WXDLLIMPEXP_FWD_CORE wxCheckBox; +class WXDLLIMPEXP_FWD_CORE wxChoice; +class WXDLLIMPEXP_FWD_CORE wxStaticText; +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; + +extern WXDLLIMPEXP_DATA_CORE(const char) wxFileSelectorDefaultWildcardStr[]; + +//----------------------------------------------------------------------------- +// wxFileData - a class to hold the file info for the wxFileListCtrl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFileData +{ +public: + enum fileType + { + is_file = 0x0000, + is_dir = 0x0001, + is_link = 0x0002, + is_exe = 0x0004, + is_drive = 0x0008 + }; + + wxFileData() { Init(); } + // Full copy constructor + wxFileData( const wxFileData& fileData ) { Copy(fileData); } + // Create a filedata from this information + wxFileData( const wxString &filePath, const wxString &fileName, + fileType type, int image_id ); + + // make a full copy of the other wxFileData + void Copy( const wxFileData &other ); + + // (re)read the extra data about the file from the system + void ReadData(); + + // get the name of the file, dir, drive + wxString GetFileName() const { return m_fileName; } + // get the full path + name of the file, dir, path + wxString GetFilePath() const { return m_filePath; } + // Set the path + name and name of the item + void SetNewName( const wxString &filePath, const wxString &fileName ); + + // Get the size of the file in bytes + wxFileOffset GetSize() const { return m_size; } + // Get the type of file, either file extension or , , + wxString GetFileType() const; + // get the last modification time + wxDateTime GetDateTime() const { return m_dateTime; } + // Get the time as a formatted string + wxString GetModificationTime() const; + // in UNIX get rwx for file, in MSW get attributes ARHS + wxString GetPermissions() const { return m_permissions; } + // Get the id of the image used in a wxImageList + int GetImageId() const { return m_image; } + + bool IsFile() const { return !IsDir() && !IsLink() && !IsDrive(); } + bool IsDir() const { return (m_type & is_dir ) != 0; } + bool IsLink() const { return (m_type & is_link ) != 0; } + bool IsExe() const { return (m_type & is_exe ) != 0; } + bool IsDrive() const { return (m_type & is_drive) != 0; } + + // Get/Set the type of file, file/dir/drive/link + int GetType() const { return m_type; } + + // the wxFileListCtrl fields in report view + enum fileListFieldType + { + FileList_Name, + FileList_Size, + FileList_Type, + FileList_Time, +#if defined(__UNIX__) || defined(__WIN32__) + FileList_Perm, +#endif // defined(__UNIX__) || defined(__WIN32__) + FileList_Max + }; + + // Get the entry for report view of wxFileListCtrl + wxString GetEntry( fileListFieldType num ) const; + + // Get a string representation of the file info + wxString GetHint() const; + // initialize a wxListItem attributes + void MakeItem( wxListItem &item ); + + // operators + wxFileData& operator = (const wxFileData& fd) { Copy(fd); return *this; } + +protected: + wxString m_fileName; + wxString m_filePath; + wxFileOffset m_size; + wxDateTime m_dateTime; + wxString m_permissions; + int m_type; + int m_image; + +private: + void Init(); +}; + +//----------------------------------------------------------------------------- +// wxFileListCtrl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFileListCtrl : public wxListCtrl +{ +public: + wxFileListCtrl(); + wxFileListCtrl( wxWindow *win, + wxWindowID id, + const wxString &wild, + bool showHidden, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLC_LIST, + const wxValidator &validator = wxDefaultValidator, + const wxString &name = wxT("filelist") ); + virtual ~wxFileListCtrl(); + + virtual void ChangeToListMode(); + virtual void ChangeToReportMode(); + virtual void ChangeToSmallIconMode(); + virtual void ShowHidden( bool show = true ); + bool GetShowHidden() const { return m_showHidden; } + + virtual long Add( wxFileData *fd, wxListItem &item ); + virtual void UpdateItem(const wxListItem &item); + virtual void UpdateFiles(); + virtual void MakeDir(); + virtual void GoToParentDir(); + virtual void GoToHomeDir(); + virtual void GoToDir( const wxString &dir ); + virtual void SetWild( const wxString &wild ); + wxString GetWild() const { return m_wild; } + wxString GetDir() const { return m_dirName; } + + void OnListDeleteItem( wxListEvent &event ); + void OnListDeleteAllItems( wxListEvent &event ); + void OnListEndLabelEdit( wxListEvent &event ); + void OnListColClick( wxListEvent &event ); + void OnSize( wxSizeEvent &event ); + + virtual void SortItems(wxFileData::fileListFieldType field, bool forward); + bool GetSortDirection() const { return m_sort_forward; } + wxFileData::fileListFieldType GetSortField() const { return m_sort_field; } + +protected: + void FreeItemData(wxListItem& item); + void FreeAllItemsData(); + + wxString m_dirName; + bool m_showHidden; + wxString m_wild; + + bool m_sort_forward; + wxFileData::fileListFieldType m_sort_field; + +private: + wxDECLARE_DYNAMIC_CLASS(wxFileListCtrl); + wxDECLARE_EVENT_TABLE(); +}; + +class WXDLLIMPEXP_CORE wxGenericFileCtrl : public wxNavigationEnabled, + public wxFileCtrlBase +{ +public: + wxGenericFileCtrl() + { + m_ignoreChanges = false; + } + + wxGenericFileCtrl ( wxWindow *parent, + wxWindowID id, + const wxString& defaultDirectory = wxEmptyString, + const wxString& defaultFilename = wxEmptyString, + const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + long style = wxFC_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxString& name = wxASCII_STR(wxFileCtrlNameStr) ) + { + m_ignoreChanges = false; + Create(parent, id, defaultDirectory, defaultFilename, wildCard, + style, pos, size, name ); + } + + virtual ~wxGenericFileCtrl() {} + + bool Create( wxWindow *parent, + wxWindowID id, + const wxString& defaultDirectory = wxEmptyString, + const wxString& defaultFileName = wxEmptyString, + const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + long style = wxFC_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxString& name = wxASCII_STR(wxFileCtrlNameStr) ); + + virtual void SetWildcard( const wxString& wildCard ) wxOVERRIDE; + virtual void SetFilterIndex( int filterindex ) wxOVERRIDE; + virtual bool SetDirectory( const wxString& dir ) wxOVERRIDE; + + // Selects a certain file. + // In case the filename specified isn't found/couldn't be shown with + // currently selected filter, false is returned and nothing happens + virtual bool SetFilename( const wxString& name ) wxOVERRIDE; + + // Changes to a certain directory and selects a certain file. + // In case the filename specified isn't found/couldn't be shown with + // currently selected filter, false is returned and if directory exists + // it's chdir'ed to + virtual bool SetPath( const wxString& path ) wxOVERRIDE; + + virtual wxString GetFilename() const wxOVERRIDE; + virtual wxString GetDirectory() const wxOVERRIDE; + virtual wxString GetWildcard() const wxOVERRIDE { return this->m_wildCard; } + virtual wxString GetPath() const wxOVERRIDE; + virtual void GetPaths( wxArrayString& paths ) const wxOVERRIDE; + virtual void GetFilenames( wxArrayString& files ) const wxOVERRIDE; + virtual int GetFilterIndex() const wxOVERRIDE { return m_filterIndex; } + + virtual bool HasMultipleFileSelection() const wxOVERRIDE + { return HasFlag(wxFC_MULTIPLE); } + virtual void ShowHidden(bool show) wxOVERRIDE { m_list->ShowHidden( show ); } + + void GoToParentDir(); + void GoToHomeDir(); + + // get the directory currently shown in the control: this can be different + // from GetDirectory() if the user entered a full path (with a path other + // than the one currently shown in the control) in the text control + // manually + wxString GetShownDirectory() const { return m_list->GetDir(); } + + wxFileListCtrl *GetFileList() { return m_list; } + + void ChangeToReportMode() { m_list->ChangeToReportMode(); } + void ChangeToListMode() { m_list->ChangeToListMode(); } + + +private: + void OnChoiceFilter( wxCommandEvent &event ); + void OnCheck( wxCommandEvent &event ); + void OnActivated( wxListEvent &event ); + void OnTextEnter( wxCommandEvent &WXUNUSED( event ) ); + void OnTextChange( wxCommandEvent &WXUNUSED( event ) ); + void OnSelected( wxListEvent &event ); + void HandleAction( const wxString &fn ); + + void DoSetFilterIndex( int filterindex ); + void UpdateControls(); + + // the first of these methods can only be used for the controls with single + // selection (i.e. without wxFC_MULTIPLE style), the second one in any case + wxFileName DoGetFileName() const; + void DoGetFilenames( wxArrayString& filenames, bool fullPath ) const; + + int m_style; + + wxString m_filterExtension; + wxChoice *m_choice; + wxTextCtrl *m_text; + wxFileListCtrl *m_list; + wxCheckBox *m_check; + wxStaticText *m_static; + + wxString m_dir; + wxString m_fileName; + wxString m_wildCard; // wild card in one string as we got it + + int m_filterIndex; + bool m_inSelected; + bool m_ignoreChanges; + bool m_noSelChgEvent; // suppress selection changed events. + + wxDECLARE_DYNAMIC_CLASS(wxGenericFileCtrl); + wxDECLARE_EVENT_TABLE(); +}; + +#endif // wxUSE_FILECTRL + +#endif // _WX_GENERIC_FILECTRL_H_ diff --git a/lib/wxWidgets/include/wx/generic/filedlgg.h b/lib/wxWidgets/include/wx/generic/filedlgg.h new file mode 100644 index 0000000..9ec1b51 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/filedlgg.h @@ -0,0 +1,166 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/filedlgg.h +// Purpose: wxGenericFileDialog +// Author: Robert Roebling +// Modified by: +// Created: 8/17/99 +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FILEDLGG_H_ +#define _WX_FILEDLGG_H_ + +#include "wx/listctrl.h" +#include "wx/datetime.h" +#include "wx/filefn.h" +#include "wx/artprov.h" +#include "wx/filedlg.h" +#include "wx/generic/filectrlg.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxBitmapButton; +class WXDLLIMPEXP_FWD_CORE wxGenericFileCtrl; +class WXDLLIMPEXP_FWD_CORE wxGenericFileDialog; +class WXDLLIMPEXP_FWD_CORE wxFileCtrlEvent; + +//------------------------------------------------------------------------- +// wxGenericFileDialog +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGenericFileDialog: public wxFileDialogBase +{ +public: + wxGenericFileDialog() : wxFileDialogBase() { Init(); } + + wxGenericFileDialog(wxWindow *parent, + const wxString& message = wxASCII_STR(wxFileSelectorPromptStr), + const wxString& defaultDir = wxEmptyString, + const wxString& defaultFile = wxEmptyString, + const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + long style = wxFD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + const wxString& name = wxASCII_STR(wxFileDialogNameStr), + bool bypassGenericImpl = false ); + + bool Create( wxWindow *parent, + const wxString& message = wxASCII_STR(wxFileSelectorPromptStr), + const wxString& defaultDir = wxEmptyString, + const wxString& defaultFile = wxEmptyString, + const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + long style = wxFD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + const wxString& name = wxASCII_STR(wxFileDialogNameStr), + bool bypassGenericImpl = false ); + + virtual ~wxGenericFileDialog(); + + virtual void SetDirectory(const wxString& dir) wxOVERRIDE + { m_filectrl->SetDirectory(dir); } + virtual void SetFilename(const wxString& name) wxOVERRIDE + { m_filectrl->SetFilename(name); } + virtual void SetMessage(const wxString& message) wxOVERRIDE { SetTitle(message); } + virtual void SetPath(const wxString& path) wxOVERRIDE + { m_filectrl->SetPath(path); } + virtual void SetFilterIndex(int filterIndex) wxOVERRIDE + { m_filectrl->SetFilterIndex(filterIndex); } + virtual void SetWildcard(const wxString& wildCard) wxOVERRIDE + { m_filectrl->SetWildcard(wildCard); } + + virtual wxString GetPath() const wxOVERRIDE + { + wxCHECK_MSG( !HasFlag(wxFD_MULTIPLE), wxString(), "When using wxFD_MULTIPLE, must call GetPaths() instead" ); + return m_filectrl->GetPath(); + } + virtual void GetPaths(wxArrayString& paths) const wxOVERRIDE + { m_filectrl->GetPaths(paths); } + virtual wxString GetDirectory() const wxOVERRIDE + { return m_filectrl->GetDirectory(); } + virtual wxString GetFilename() const wxOVERRIDE + { + wxCHECK_MSG( !HasFlag(wxFD_MULTIPLE), wxString(), "When using wxFD_MULTIPLE, must call GetFilenames() instead" ); + return m_filectrl->GetFilename(); + } + virtual void GetFilenames(wxArrayString& files) const wxOVERRIDE + { m_filectrl->GetFilenames(files); } + virtual wxString GetWildcard() const wxOVERRIDE + { return m_filectrl->GetWildcard(); } + virtual int GetFilterIndex() const wxOVERRIDE + { return m_filectrl->GetFilterIndex(); } + virtual bool SupportsExtraControl() const wxOVERRIDE { return true; } + + // implementation only from now on + // ------------------------------- + + virtual int ShowModal() wxOVERRIDE; + virtual bool Show( bool show = true ) wxOVERRIDE; + + void OnList( wxCommandEvent &event ); + void OnReport( wxCommandEvent &event ); + void OnUp( wxCommandEvent &event ); + void OnHome( wxCommandEvent &event ); + void OnOk( wxCommandEvent &event ); + void OnNew( wxCommandEvent &event ); + void OnFileActivated( wxFileCtrlEvent &event); + +private: + // if true, don't use this implementation at all + bool m_bypassGenericImpl; + +protected: + // update the state of m_upDirButton and m_newDirButton depending on the + // currently selected directory + void OnUpdateButtonsUI(wxUpdateUIEvent& event); + + wxString m_filterExtension; + wxGenericFileCtrl *m_filectrl; + wxBitmapButton *m_upDirButton; + wxBitmapButton *m_newDirButton; + +private: + void Init(); + wxBitmapButton* AddBitmapButton( wxWindowID winId, const wxArtID& artId, + const wxString& tip, wxSizer *sizer ); + + wxDECLARE_DYNAMIC_CLASS(wxGenericFileDialog); + wxDECLARE_EVENT_TABLE(); + + // these variables are preserved between wxGenericFileDialog calls + static long ms_lastViewStyle; // list or report? + static bool ms_lastShowHidden; // did we show hidden files? +}; + +#ifdef wxHAS_GENERIC_FILEDIALOG + +class WXDLLIMPEXP_CORE wxFileDialog: public wxGenericFileDialog +{ +public: + wxFileDialog() {} + + wxFileDialog(wxWindow *parent, + const wxString& message = wxASCII_STR(wxFileSelectorPromptStr), + const wxString& defaultDir = wxEmptyString, + const wxString& defaultFile = wxEmptyString, + const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + long style = 0, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize) + :wxGenericFileDialog(parent, message, + defaultDir, defaultFile, wildCard, + style, + pos, size) + { + } + +private: + wxDECLARE_DYNAMIC_CLASS(wxFileDialog); +}; + +#endif // wxHAS_GENERIC_FILEDIALOG + +#endif // _WX_FILEDLGG_H_ diff --git a/lib/wxWidgets/include/wx/generic/filepickerg.h b/lib/wxWidgets/include/wx/generic/filepickerg.h new file mode 100644 index 0000000..762dc4f --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/filepickerg.h @@ -0,0 +1,221 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/filepickerg.h +// Purpose: wxGenericFileDirButton, wxGenericFileButton, wxGenericDirButton +// Author: Francesco Montorsi +// Modified by: +// Created: 14/4/2006 +// Copyright: (c) Francesco Montorsi +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FILEDIRPICKER_H_ +#define _WX_FILEDIRPICKER_H_ + +#include "wx/button.h" +#include "wx/filedlg.h" +#include "wx/dirdlg.h" + + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DIRPICKER_CHANGED, wxFileDirPickerEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FILEPICKER_CHANGED, wxFileDirPickerEvent ); + + +//----------------------------------------------------------------------------- +// wxGenericFileDirButton: a button which brings up a wx{File|Dir}Dialog +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGenericFileDirButton : public wxButton, + public wxFileDirPickerWidgetBase +{ +public: + wxGenericFileDirButton() { Init(); } + wxGenericFileDirButton(wxWindow *parent, + wxWindowID id, + const wxString& label = wxASCII_STR(wxFilePickerWidgetLabel), + const wxString& path = wxEmptyString, + const wxString &message = wxASCII_STR(wxFileSelectorPromptStr), + const wxString &wildcard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxFilePickerWidgetNameStr)) + { + Init(); + Create(parent, id, label, path, message, wildcard, + pos, size, style, validator, name); + } + + virtual wxControl *AsControl() wxOVERRIDE { return this; } + +public: // overridable + + virtual wxDialog *CreateDialog() = 0; + + virtual wxWindow *GetDialogParent() + { return GetParent(); } + + virtual wxEventType GetEventType() const = 0; + + virtual void SetInitialDirectory(const wxString& dir) wxOVERRIDE; + +public: + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& label = wxASCII_STR(wxFilePickerWidgetLabel), + const wxString& path = wxEmptyString, + const wxString &message = wxASCII_STR(wxFileSelectorPromptStr), + const wxString &wildcard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxFilePickerWidgetNameStr)); + + // event handler for the click + void OnButtonClick(wxCommandEvent &); + +protected: + wxString m_message, m_wildcard; + + // we just store the style passed to the ctor here instead of passing it to + // wxButton as some of our bits can conflict with wxButton styles and it + // just doesn't make sense to use picker styles for wxButton anyhow + long m_pickerStyle; + + // Initial directory set by SetInitialDirectory() call or empty. + wxString m_initialDir; + +private: + // common part of all ctors + void Init() { m_pickerStyle = -1; } +}; + + +//----------------------------------------------------------------------------- +// wxGenericFileButton: a button which brings up a wxFileDialog +//----------------------------------------------------------------------------- + +#define wxFILEBTN_DEFAULT_STYLE (wxFLP_OPEN) + +class WXDLLIMPEXP_CORE wxGenericFileButton : public wxGenericFileDirButton +{ +public: + wxGenericFileButton() {} + wxGenericFileButton(wxWindow *parent, + wxWindowID id, + const wxString& label = wxASCII_STR(wxFilePickerWidgetLabel), + const wxString& path = wxEmptyString, + const wxString &message = wxASCII_STR(wxFileSelectorPromptStr), + const wxString &wildcard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxFILEBTN_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxFilePickerWidgetNameStr)) + { + Create(parent, id, label, path, message, wildcard, + pos, size, style, validator, name); + } + +public: // overridable + + virtual long GetDialogStyle() const + { + // the derived class must initialize it if it doesn't use the + // non-default wxGenericFileDirButton ctor + wxASSERT_MSG( m_pickerStyle != -1, + "forgot to initialize m_pickerStyle?" ); + + + long filedlgstyle = 0; + + if ( m_pickerStyle & wxFLP_OPEN ) + filedlgstyle |= wxFD_OPEN; + if ( m_pickerStyle & wxFLP_SAVE ) + filedlgstyle |= wxFD_SAVE; + if ( m_pickerStyle & wxFLP_OVERWRITE_PROMPT ) + filedlgstyle |= wxFD_OVERWRITE_PROMPT; + if ( m_pickerStyle & wxFLP_FILE_MUST_EXIST ) + filedlgstyle |= wxFD_FILE_MUST_EXIST; + if ( m_pickerStyle & wxFLP_CHANGE_DIR ) + filedlgstyle |= wxFD_CHANGE_DIR; + + return filedlgstyle; + } + + virtual wxDialog *CreateDialog() wxOVERRIDE; + + wxEventType GetEventType() const wxOVERRIDE + { return wxEVT_FILEPICKER_CHANGED; } + +protected: + void UpdateDialogPath(wxDialog *p) wxOVERRIDE + { wxStaticCast(p, wxFileDialog)->SetPath(m_path); } + void UpdatePathFromDialog(wxDialog *p) wxOVERRIDE + { m_path = wxStaticCast(p, wxFileDialog)->GetPath(); } + +private: + wxDECLARE_DYNAMIC_CLASS(wxGenericFileButton); +}; + + +//----------------------------------------------------------------------------- +// wxGenericDirButton: a button which brings up a wxDirDialog +//----------------------------------------------------------------------------- + +#define wxDIRBTN_DEFAULT_STYLE 0 + +class WXDLLIMPEXP_CORE wxGenericDirButton : public wxGenericFileDirButton +{ +public: + wxGenericDirButton() {} + wxGenericDirButton(wxWindow *parent, + wxWindowID id, + const wxString& label = wxASCII_STR(wxDirPickerWidgetLabel), + const wxString& path = wxEmptyString, + const wxString &message = wxASCII_STR(wxDirSelectorPromptStr), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDIRBTN_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxDirPickerWidgetNameStr)) + { + Create(parent, id, label, path, message, wxEmptyString, + pos, size, style, validator, name); + } + +public: // overridable + + virtual long GetDialogStyle() const + { + long dirdlgstyle = wxDD_DEFAULT_STYLE; + + if ( m_pickerStyle & wxDIRP_DIR_MUST_EXIST ) + dirdlgstyle |= wxDD_DIR_MUST_EXIST; + if ( m_pickerStyle & wxDIRP_CHANGE_DIR ) + dirdlgstyle |= wxDD_CHANGE_DIR; + + return dirdlgstyle; + } + + virtual wxDialog *CreateDialog() wxOVERRIDE; + + wxEventType GetEventType() const wxOVERRIDE + { return wxEVT_DIRPICKER_CHANGED; } + +protected: + void UpdateDialogPath(wxDialog *p) wxOVERRIDE + { wxStaticCast(p, wxDirDialog)->SetPath(m_path); } + void UpdatePathFromDialog(wxDialog *p) wxOVERRIDE + { m_path = wxStaticCast(p, wxDirDialog)->GetPath(); } + +private: + wxDECLARE_DYNAMIC_CLASS(wxGenericDirButton); +}; + +// old wxEVT_COMMAND_* constants +//#define wxEVT_COMMAND_DIRPICKER_CHANGED wxEVT_DIRPICKER_CHANGED +//#define wxEVT_COMMAND_FILEPICKER_CHANGED wxEVT_FILEPICKER_CHANGED + +#endif // _WX_FILEDIRPICKER_H_ diff --git a/lib/wxWidgets/include/wx/generic/fontdlgg.h b/lib/wxWidgets/include/wx/generic/fontdlgg.h new file mode 100644 index 0000000..0df6d3b --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/fontdlgg.h @@ -0,0 +1,95 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/fontdlgg.h +// Purpose: wxGenericFontDialog +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_FONTDLGG_H +#define _WX_GENERIC_FONTDLGG_H + +#include "wx/gdicmn.h" +#include "wx/font.h" + +#define USE_SPINCTRL_FOR_POINT_SIZE 0 + +/* + * FONT DIALOG + */ + +class WXDLLIMPEXP_FWD_CORE wxChoice; +class WXDLLIMPEXP_FWD_CORE wxText; +class WXDLLIMPEXP_FWD_CORE wxCheckBox; +class WXDLLIMPEXP_FWD_CORE wxFontPreviewer; + +enum +{ + wxID_FONT_UNDERLINE = 3000, + wxID_FONT_STYLE, + wxID_FONT_WEIGHT, + wxID_FONT_FAMILY, + wxID_FONT_COLOUR, + wxID_FONT_SIZE +}; + +class WXDLLIMPEXP_CORE wxGenericFontDialog : public wxFontDialogBase +{ +public: + wxGenericFontDialog() { Init(); } + wxGenericFontDialog(wxWindow *parent) + : wxFontDialogBase(parent) { Init(); } + wxGenericFontDialog(wxWindow *parent, const wxFontData& data) + : wxFontDialogBase(parent, data) { Init(); } + virtual ~wxGenericFontDialog(); + + virtual int ShowModal() wxOVERRIDE; + + // Internal functions + void OnCloseWindow(wxCloseEvent& event); + + virtual void CreateWidgets(); + virtual void InitializeFont(); + + void OnChangeFont(wxCommandEvent& event); + +#if USE_SPINCTRL_FOR_POINT_SIZE + void OnChangeSize(wxSpinEvent& event); +#endif + +protected: + + virtual bool DoCreate(wxWindow *parent) wxOVERRIDE; + +private: + + // common part of all ctors + void Init(); + + void DoChangeFont(); + + wxFont m_dialogFont; + + wxChoice *m_familyChoice; + wxChoice *m_styleChoice; + wxChoice *m_weightChoice; + wxChoice *m_colourChoice; + wxCheckBox *m_underLineCheckBox; + +#if USE_SPINCTRL_FOR_POINT_SIZE + wxSpinCtrl *m_pointSizeSpin; +#else + wxChoice *m_pointSizeChoice; +#endif + + wxFontPreviewer *m_previewer; + bool m_useEvents; + + // static bool fontDialogCancelled; + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxGenericFontDialog); +}; + +#endif // _WX_GENERIC_FONTDLGG_H diff --git a/lib/wxWidgets/include/wx/generic/fontpickerg.h b/lib/wxWidgets/include/wx/generic/fontpickerg.h new file mode 100644 index 0000000..2273d1d --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/fontpickerg.h @@ -0,0 +1,81 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/fontpickerg.h +// Purpose: wxGenericFontButton header +// Author: Francesco Montorsi +// Modified by: +// Created: 14/4/2006 +// Copyright: (c) Francesco Montorsi +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONTPICKER_H_ +#define _WX_FONTPICKER_H_ + +#include "wx/button.h" +#include "wx/fontdata.h" + +//----------------------------------------------------------------------------- +// wxGenericFontButton: a button which brings up a wxFontDialog +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGenericFontButton : public wxButton, + public wxFontPickerWidgetBase +{ +public: + wxGenericFontButton() {} + wxGenericFontButton(wxWindow *parent, + wxWindowID id, + const wxFont &initial = wxNullFont, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxFONTBTN_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxFontPickerWidgetNameStr)) + { + Create(parent, id, initial, pos, size, style, validator, name); + } + + virtual wxColour GetSelectedColour() const wxOVERRIDE + { return m_data.GetColour(); } + + virtual void SetSelectedColour(const wxColour &colour) wxOVERRIDE + { m_data.SetColour(colour); UpdateFont(); } + + virtual ~wxGenericFontButton() {} + + +public: // API extensions specific for wxGenericFontButton + + // user can override this to init font data in a different way + virtual void InitFontData(); + + // returns the font data shown in wxFontDialog + wxFontData *GetFontData() { return &m_data; } + + +public: + + bool Create(wxWindow *parent, + wxWindowID id, + const wxFont &initial = *wxNORMAL_FONT, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxFONTBTN_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxFontPickerWidgetNameStr)); + + void OnButtonClick(wxCommandEvent &); + + +protected: + + void UpdateFont() wxOVERRIDE; + + wxFontData m_data; + +private: + wxDECLARE_DYNAMIC_CLASS(wxGenericFontButton); +}; + + +#endif // _WX_FONTPICKER_H_ diff --git a/lib/wxWidgets/include/wx/generic/fswatcher.h b/lib/wxWidgets/include/wx/generic/fswatcher.h new file mode 100644 index 0000000..efd7631 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/fswatcher.h @@ -0,0 +1,25 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/fswatcher.h +// Purpose: wxPollingFileSystemWatcher +// Author: Bartosz Bekier +// Created: 2009-05-26 +// Copyright: (c) 2009 Bartosz Bekier +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FSWATCHER_GENERIC_H_ +#define _WX_FSWATCHER_GENERIC_H_ + +#include "wx/defs.h" + +#if wxUSE_FSWATCHER + +class WXDLLIMPEXP_BASE wxPollingFileSystemWatcher : public wxFileSystemWatcherBase +{ +public: + +}; + +#endif // wxUSE_FSWATCHER + +#endif /* _WX_FSWATCHER_GENERIC_H_ */ diff --git a/lib/wxWidgets/include/wx/generic/grid.h b/lib/wxWidgets/include/wx/generic/grid.h new file mode 100644 index 0000000..1bd58bb --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/grid.h @@ -0,0 +1,3623 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/grid.h +// Purpose: wxGrid and related classes +// Author: Michael Bedward (based on code by Julian Smart, Robin Dunn) +// Modified by: Santiago Palacios +// Created: 1/08/1999 +// Copyright: (c) Michael Bedward +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_GRID_H_ +#define _WX_GENERIC_GRID_H_ + +#include "wx/defs.h" + +#if wxUSE_GRID + +#include "wx/hashmap.h" + +#include "wx/scrolwin.h" + +#if wxUSE_STD_CONTAINERS_COMPATIBLY + #include +#endif + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +extern WXDLLIMPEXP_DATA_CORE(const char) wxGridNameStr[]; + +// Obsolete constants not used by wxWidgets itself any longer, preserved only +// for compatibility. +#define WXGRID_DEFAULT_NUMBER_ROWS 10 +#define WXGRID_DEFAULT_NUMBER_COLS 10 +#if defined(__WXMSW__) || defined(__WXGTK20__) +#define WXGRID_DEFAULT_ROW_HEIGHT 25 +#else +#define WXGRID_DEFAULT_ROW_HEIGHT 30 +#endif // __WXMSW__ +#define WXGRID_DEFAULT_SCROLLBAR_WIDTH 16 + +// Various constants used in wxGrid code. +// +// Note that all the values are in DIPs, not pixels, i.e. you must use +// FromDIP() when using them in your code. +#define WXGRID_DEFAULT_COL_WIDTH 80 +#define WXGRID_DEFAULT_COL_LABEL_HEIGHT 32 +#define WXGRID_DEFAULT_ROW_LABEL_WIDTH 82 +#define WXGRID_LABEL_EDGE_ZONE 2 +#define WXGRID_MIN_ROW_HEIGHT 15 +#define WXGRID_MIN_COL_WIDTH 15 + +// type names for grid table values +#define wxGRID_VALUE_STRING wxT("string") +#define wxGRID_VALUE_BOOL wxT("bool") +#define wxGRID_VALUE_NUMBER wxT("long") +#define wxGRID_VALUE_FLOAT wxT("double") +#define wxGRID_VALUE_CHOICE wxT("choice") +#define wxGRID_VALUE_DATE wxT("date") + +#define wxGRID_VALUE_TEXT wxGRID_VALUE_STRING +#define wxGRID_VALUE_LONG wxGRID_VALUE_NUMBER + +// magic constant which tells (to some functions) to automatically calculate +// the appropriate size +#define wxGRID_AUTOSIZE (-1) + +// many wxGrid methods work either with columns or rows, this enum is used for +// the parameter indicating which one should it be +enum wxGridDirection +{ + wxGRID_COLUMN, + wxGRID_ROW +}; + +// Flags used with wxGrid::Render() to select parts of the grid to draw. +enum wxGridRenderStyle +{ + wxGRID_DRAW_ROWS_HEADER = 0x001, + wxGRID_DRAW_COLS_HEADER = 0x002, + wxGRID_DRAW_CELL_LINES = 0x004, + wxGRID_DRAW_BOX_RECT = 0x008, + wxGRID_DRAW_SELECTION = 0x010, + wxGRID_DRAW_DEFAULT = wxGRID_DRAW_ROWS_HEADER | + wxGRID_DRAW_COLS_HEADER | + wxGRID_DRAW_CELL_LINES | + wxGRID_DRAW_BOX_RECT +}; + +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxGrid; +class WXDLLIMPEXP_FWD_CORE wxGridCellAttr; +class WXDLLIMPEXP_FWD_CORE wxGridCellAttrProviderData; +class WXDLLIMPEXP_FWD_CORE wxGridColLabelWindow; +class WXDLLIMPEXP_FWD_CORE wxGridCornerLabelWindow; +class WXDLLIMPEXP_FWD_CORE wxGridEvent; +class WXDLLIMPEXP_FWD_CORE wxGridRowLabelWindow; +class WXDLLIMPEXP_FWD_CORE wxGridWindow; +class WXDLLIMPEXP_FWD_CORE wxGridSubwindow; +class WXDLLIMPEXP_FWD_CORE wxGridTypeRegistry; +class WXDLLIMPEXP_FWD_CORE wxGridSelection; + +class WXDLLIMPEXP_FWD_CORE wxHeaderCtrl; +class WXDLLIMPEXP_FWD_CORE wxCheckBox; +class WXDLLIMPEXP_FWD_CORE wxComboBox; +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; +#if wxUSE_SPINCTRL +class WXDLLIMPEXP_FWD_CORE wxSpinCtrl; +#endif +#if wxUSE_DATEPICKCTRL +class WXDLLIMPEXP_FWD_CORE wxDatePickerCtrl; +#endif + +class wxGridFixedIndicesSet; + +class wxGridOperations; +class wxGridRowOperations; +class wxGridColumnOperations; +class wxGridDirectionOperations; + + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +#define wxSafeIncRef(p) if ( p ) (p)->IncRef() +#define wxSafeDecRef(p) if ( p ) (p)->DecRef() + +// ---------------------------------------------------------------------------- +// wxGridCellWorker: common base class for wxGridCellRenderer and +// wxGridCellEditor +// +// NB: this is more an implementation convenience than a design issue, so this +// class is not documented and is not public at all +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGridCellWorker : public wxSharedClientDataContainer, + public wxRefCounter +{ +public: + wxGridCellWorker() { } + + wxGridCellWorker(const wxGridCellWorker& other); + + // interpret renderer parameters: arbitrary string whose interpretation is + // left to the derived classes + virtual void SetParameters(const wxString& params); + +protected: + // virtual dtor for any base class - private because only DecRef() can + // delete us + virtual ~wxGridCellWorker(); + +private: + // suppress the stupid gcc warning about the class having private dtor and + // no friends + friend class wxGridCellWorkerDummyFriend; +}; + +// ---------------------------------------------------------------------------- +// wxGridCellRenderer: this class is responsible for actually drawing the cell +// in the grid. You may pass it to the wxGridCellAttr (below) to change the +// format of one given cell or to wxGrid::SetDefaultRenderer() to change the +// view of all cells. This is an ABC, you will normally use one of the +// predefined derived classes or derive your own class from it. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGridCellRenderer : public wxGridCellWorker +{ +public: + wxGridCellRenderer() + : wxGridCellWorker() + { + } + + wxGridCellRenderer(const wxGridCellRenderer& other) + : wxGridCellWorker(other) + { + } + + // draw the given cell on the provided DC inside the given rectangle + // using the style specified by the attribute and the default or selected + // state corresponding to the isSelected value. + // + // this pure virtual function has a default implementation which will + // prepare the DC using the given attribute: it will draw the rectangle + // with the bg colour from attr and set the text colour and font + virtual void Draw(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + const wxRect& rect, + int row, int col, + bool isSelected) = 0; + + // get the preferred size of the cell for its contents + virtual wxSize GetBestSize(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col) = 0; + + // Get the preferred height for a given width. Override this method if the + // renderer computes height as function of its width, as is the case of the + // standard wxGridCellAutoWrapStringRenderer, for example. + // and vice versa + virtual int GetBestHeight(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col, + int WXUNUSED(width)) + { + return GetBestSize(grid, attr, dc, row, col).GetHeight(); + } + + // Get the preferred width for a given height, this is the symmetric + // version of GetBestHeight(). + virtual int GetBestWidth(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col, + int WXUNUSED(height)) + { + return GetBestSize(grid, attr, dc, row, col).GetWidth(); + } + + + // Unlike GetBestSize(), this functions is optional: it is used when + // auto-sizing columns to determine the best width without iterating over + // all cells in this column, if possible. + // + // If it isn't, return wxDefaultSize as the base class version does by + // default. + virtual wxSize GetMaxBestSize(wxGrid& WXUNUSED(grid), + wxGridCellAttr& WXUNUSED(attr), + wxDC& WXUNUSED(dc)) + { + return wxDefaultSize; + } + + // create a new object which is the copy of this one + virtual wxGridCellRenderer *Clone() const = 0; + +protected: + // set the text colours before drawing + void SetTextColoursAndFont(const wxGrid& grid, + const wxGridCellAttr& attr, + wxDC& dc, + bool isSelected); +}; + +// Smart pointer to wxGridCellRenderer, calling DecRef() on it automatically. +typedef wxObjectDataPtr wxGridCellRendererPtr; + + +// ---------------------------------------------------------------------------- +// Helper classes used by wxGridCellEditor::TryActivate() and DoActivate(). +// ---------------------------------------------------------------------------- + +// This class represents a source of cell activation, which may be either a +// user event (mouse or keyboard) or the program itself. +// +// Note that objects of this class are supposed to be ephemeral and so store +// pointers to the events specified when creating them, which are supposed to +// have life-time greater than that of the objects of this class. +class wxGridActivationSource +{ +public: + enum Origin + { + Program, + Key, + Mouse + }; + + // Factory functions, only used by the library itself. + static wxGridActivationSource FromProgram() + { + return wxGridActivationSource(Program, NULL); + } + + static wxGridActivationSource From(const wxKeyEvent& event) + { + return wxGridActivationSource(Key, &event); + } + + static wxGridActivationSource From(const wxMouseEvent& event) + { + return wxGridActivationSource(Mouse, &event); + } + + // Accessors allowing to retrieve information about the source. + + // Can be called for any object. + Origin GetOrigin() const { return m_origin; } + + // Can be called for objects with Key origin only. + const wxKeyEvent& GetKeyEvent() const + { + wxASSERT( m_origin == Key ); + + return *static_cast(m_event); + } + + // Can be called for objects with Mouse origin only. + const wxMouseEvent& GetMouseEvent() const + { + wxASSERT( m_origin == Mouse ); + + return *static_cast(m_event); + } + +private: + wxGridActivationSource(Origin origin, const wxEvent* event) + : m_origin(origin), + m_event(event) + { + } + + const Origin m_origin; + const wxEvent* const m_event; +}; + +// This class represents the result of TryActivate(), which may be either +// absence of any action (if activating wouldn't change the value anyhow), +// attempt to change the value to the specified one or just start normal +// editing, which is the default for the editors not supporting activation. +class wxGridActivationResult +{ +public: + enum Action + { + Ignore, + Change, + ShowEditor + }; + + // Factory functions, only used by the library itself. + static wxGridActivationResult DoNothing() + { + return wxGridActivationResult(Ignore); + } + + static wxGridActivationResult DoChange(const wxString& newval) + { + return wxGridActivationResult(Change, newval); + } + + static wxGridActivationResult DoEdit() + { + return wxGridActivationResult(ShowEditor); + } + + // Accessors allowing to retrieve information about the result. + + // Can be called for any object. + Action GetAction() const { return m_action; } + + // Can be called for objects with Change action type only. + const wxString& GetNewValue() const + { + wxASSERT( m_action == Change ); + + return m_newval; + } + +private: + explicit + wxGridActivationResult(Action action, const wxString& newval = wxString()) + : m_action(action), + m_newval(newval) + { + } + + const Action m_action; + const wxString m_newval; +}; + +// ---------------------------------------------------------------------------- +// wxGridCellEditor: This class is responsible for providing and manipulating +// the in-place edit controls for the grid. Instances of wxGridCellEditor +// (actually, instances of derived classes since it is an ABC) can be +// associated with the cell attributes for individual cells, rows, columns, or +// even for the entire grid. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGridCellEditor : public wxGridCellWorker +{ +public: + wxGridCellEditor() + : wxGridCellWorker(), + m_control(NULL), + m_attr(NULL) + { + } + + wxGridCellEditor(const wxGridCellEditor& other); + + bool IsCreated() const { return m_control != NULL; } + + wxWindow* GetWindow() const { return m_control; } + void SetWindow(wxWindow* window) { m_control = window; } + + wxGridCellAttr* GetCellAttr() const { return m_attr; } + void SetCellAttr(wxGridCellAttr* attr) { m_attr = attr; } + + // Creates the actual edit control + virtual void Create(wxWindow* parent, + wxWindowID id, + wxEvtHandler* evtHandler) = 0; + + // Size and position the edit control + virtual void SetSize(const wxRect& rect); + + // Show or hide the edit control, use the specified attributes to set + // colours/fonts for it + virtual void Show(bool show, wxGridCellAttr *attr = NULL); + + // Draws the part of the cell not occupied by the control: the base class + // version just fills it with background colour from the attribute + virtual void PaintBackground(wxDC& dc, + const wxRect& rectCell, + const wxGridCellAttr& attr); + + + // The methods called by wxGrid when a cell is edited: first BeginEdit() is + // called, then EndEdit() is and if it returns true and if the change is + // not vetoed by a user-defined event handler, finally ApplyEdit() is called + + // Fetch the value from the table and prepare the edit control + // to begin editing. Set the focus to the edit control. + virtual void BeginEdit(int row, int col, wxGrid* grid) = 0; + + // Returns false if nothing changed, otherwise returns true and return the + // new value in its string form in the newval output parameter. + // + // This should also store the new value in its real type internally so that + // it could be used by ApplyEdit() but it must not modify the grid as the + // change could still be vetoed. + virtual bool EndEdit(int row, int col, const wxGrid *grid, + const wxString& oldval, wxString *newval) = 0; + + // Complete the editing of the current cell by storing the value saved by + // the previous call to EndEdit() in the grid + virtual void ApplyEdit(int row, int col, wxGrid* grid) = 0; + + + // Reset the value in the control back to its starting value + virtual void Reset() = 0; + + // return true to allow the given key to start editing: the base class + // version only checks that the event has no modifiers. The derived + // classes are supposed to do "if ( base::IsAcceptedKey() && ... )" in + // their IsAcceptedKey() implementation, although, of course, it is not a + // mandatory requirement. + // + // NB: if the key is F2 (special), editing will always start and this + // method will not be called at all (but StartingKey() will) + virtual bool IsAcceptedKey(wxKeyEvent& event); + + // If the editor is enabled by pressing keys on the grid, this will be + // called to let the editor do something about that first key if desired + virtual void StartingKey(wxKeyEvent& event); + + // if the editor is enabled by clicking on the cell, this method will be + // called + virtual void StartingClick(); + + // Some types of controls on some platforms may need some help + // with the Return key. + virtual void HandleReturn(wxKeyEvent& event); + + // Final cleanup + virtual void Destroy(); + + // create a new object which is the copy of this one + virtual wxGridCellEditor *Clone() const = 0; + + // added GetValue so we can get the value which is in the control + virtual wxString GetValue() const = 0; + + + // These functions exist only for backward compatibility, use Get and + // SetWindow() instead in the new code. + wxControl* GetControl() { return wxDynamicCast(m_control, wxControl); } + void SetControl(wxControl* control) { m_control = control; } + + + // Support for "activatable" editors: those change the value of the cell + // immediately, instead of creating an editor control and waiting for user + // input. + // + // See wxGridCellBoolEditor for an example of such editor. + + // Override this function to return "Change" activation result from it to + // show that the editor supports activation. DoActivate() will be called if + // the cell changing event is not vetoed. + virtual + wxGridActivationResult + TryActivate(int WXUNUSED(row), int WXUNUSED(col), + wxGrid* WXUNUSED(grid), + const wxGridActivationSource& WXUNUSED(actSource)) + { + return wxGridActivationResult::DoEdit(); + } + + virtual + void + DoActivate(int WXUNUSED(row), int WXUNUSED(col), wxGrid* WXUNUSED(grid)) + { + wxFAIL_MSG( "Must be overridden if TryActivate() is overridden" ); + } + +protected: + // the dtor is private because only DecRef() can delete us + virtual ~wxGridCellEditor(); + + // Helper for the derived classes positioning the control according to the + // attribute alignment if the desired control size is smaller than the cell + // size, or centering it vertically if its size is bigger: this looks like + // the best compromise when the editor control doesn't fit into the cell. + void DoPositionEditor(const wxSize& size, + const wxRect& rectCell, + int hAlign = wxALIGN_LEFT, + int vAlign = wxALIGN_CENTRE_VERTICAL); + + + // the actual window we show on screen (this variable should actually be + // named m_window, but m_control is kept for backward compatibility) + wxWindow* m_control; + + // a temporary pointer to the attribute being edited + wxGridCellAttr* m_attr; + + // if we change the colours/font of the control from the default ones, we + // must restore the default later and we save them here between calls to + // Show(true) and Show(false) + wxColour m_colFgOld, + m_colBgOld; + wxFont m_fontOld; + + // suppress the stupid gcc warning about the class having private dtor and + // no friends + friend class wxGridCellEditorDummyFriend; +}; + +// Smart pointer to wxGridCellEditor, calling DecRef() on it automatically. +typedef wxObjectDataPtr wxGridCellEditorPtr; + +// Base class for editors that can be only activated and not edited normally. +class wxGridCellActivatableEditor : public wxGridCellEditor +{ +public: + wxGridCellActivatableEditor() + : wxGridCellEditor() + { + } + + wxGridCellActivatableEditor(const wxGridCellActivatableEditor& other) + : wxGridCellEditor(other) + { + } + + // In this class these methods must be overridden. + virtual wxGridActivationResult + TryActivate(int row, int col, wxGrid* grid, + const wxGridActivationSource& actSource) wxOVERRIDE = 0; + virtual void DoActivate(int row, int col, wxGrid* grid) wxOVERRIDE = 0; + + // All the other methods that normally must be implemented in an editor are + // defined as just stubs below, as they should be never called. + + virtual void Create(wxWindow*, wxWindowID, wxEvtHandler*) wxOVERRIDE + { wxFAIL; } + virtual void BeginEdit(int, int, wxGrid*) wxOVERRIDE + { wxFAIL; } + virtual bool EndEdit(int, int, const wxGrid*, + const wxString&, wxString*) wxOVERRIDE + { wxFAIL; return false; } + virtual void ApplyEdit(int, int, wxGrid*) wxOVERRIDE + { wxFAIL; } + virtual void Reset() wxOVERRIDE + { wxFAIL; } + virtual wxString GetValue() const wxOVERRIDE + { wxFAIL; return wxString(); } +}; + +// ---------------------------------------------------------------------------- +// wxGridHeaderRenderer and company: like wxGridCellRenderer but for headers +// ---------------------------------------------------------------------------- + +// Base class for header cells renderers. +class WXDLLIMPEXP_CORE wxGridHeaderLabelsRenderer +{ +public: + virtual ~wxGridHeaderLabelsRenderer() {} + + // Draw the border around cell window. + virtual void DrawBorder(const wxGrid& grid, + wxDC& dc, + wxRect& rect) const = 0; + + // Draw header cell label + virtual void DrawLabel(const wxGrid& grid, + wxDC& dc, + const wxString& value, + const wxRect& rect, + int horizAlign, + int vertAlign, + int textOrientation) const; +}; + +// Currently the row/column/corner renders don't need any methods other than +// those already in wxGridHeaderLabelsRenderer but still define separate classes +// for them for future extensions and also for better type safety (i.e. to +// avoid inadvertently using a column header renderer for the row headers) +class WXDLLIMPEXP_CORE wxGridRowHeaderRenderer + : public wxGridHeaderLabelsRenderer +{ +}; + +class WXDLLIMPEXP_CORE wxGridColumnHeaderRenderer + : public wxGridHeaderLabelsRenderer +{ +}; + +class WXDLLIMPEXP_CORE wxGridCornerHeaderRenderer + : public wxGridHeaderLabelsRenderer +{ +}; + +// Also define the default renderers which are used by wxGridCellAttrProvider +// by default +class WXDLLIMPEXP_CORE wxGridRowHeaderRendererDefault + : public wxGridRowHeaderRenderer +{ +public: + virtual void DrawBorder(const wxGrid& grid, + wxDC& dc, + wxRect& rect) const wxOVERRIDE; +}; + +// Column header cells renderers +class WXDLLIMPEXP_CORE wxGridColumnHeaderRendererDefault + : public wxGridColumnHeaderRenderer +{ +public: + virtual void DrawBorder(const wxGrid& grid, + wxDC& dc, + wxRect& rect) const wxOVERRIDE; +}; + +// Header corner renderer +class WXDLLIMPEXP_CORE wxGridCornerHeaderRendererDefault + : public wxGridCornerHeaderRenderer +{ +public: + virtual void DrawBorder(const wxGrid& grid, + wxDC& dc, + wxRect& rect) const wxOVERRIDE; +}; + +// ---------------------------------------------------------------------------- +// Helper class used to define What should happen if the cell contents doesn't +// fit into its allotted space. +// ---------------------------------------------------------------------------- + +class wxGridFitMode +{ +public: + // Default ctor creates an object not specifying any particular behaviour. + wxGridFitMode() : m_mode(Mode_Unset) {} + + // Static methods allowing to create objects actually specifying behaviour. + static wxGridFitMode Clip() { return wxGridFitMode(Mode_Clip); } + static wxGridFitMode Overflow() { return wxGridFitMode(Mode_Overflow); } + static wxGridFitMode Ellipsize(wxEllipsizeMode ellipsize = wxELLIPSIZE_END) + { + // This cast works because the enum elements are the same, see below. + return wxGridFitMode(static_cast(ellipsize)); + } + + // Accessors. + bool IsSpecified() const { return m_mode != Mode_Unset; } + bool IsClip() const { return m_mode == Mode_Clip; } + bool IsOverflow() const { return m_mode == Mode_Overflow; } + + wxEllipsizeMode GetEllipsizeMode() const + { + switch ( m_mode ) + { + case Mode_Unset: + case Mode_EllipsizeStart: + case Mode_EllipsizeMiddle: + case Mode_EllipsizeEnd: + return static_cast(m_mode); + + case Mode_Overflow: + case Mode_Clip: + break; + } + + return wxELLIPSIZE_NONE; + } + + // This one is used in the implementation only. + static wxGridFitMode FromOverflowFlag(bool allow) + { return allow ? Overflow() : Clip(); } + +private: + enum Mode + { + // This is a hack to save space: the first 4 elements of this enum are + // the same as those of wxEllipsizeMode. + Mode_Unset = wxELLIPSIZE_NONE, + Mode_EllipsizeStart = wxELLIPSIZE_START, + Mode_EllipsizeMiddle = wxELLIPSIZE_MIDDLE, + Mode_EllipsizeEnd = wxELLIPSIZE_END, + Mode_Overflow, + Mode_Clip + }; + + explicit wxGridFitMode(Mode mode) : m_mode(mode) {} + + Mode m_mode; +}; + +// ---------------------------------------------------------------------------- +// wxGridCellAttr: this class can be used to alter the cells appearance in +// the grid by changing their colour/font/... from default. An object of this +// class may be returned by wxGridTable::GetAttr(). +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGridCellAttr : public wxSharedClientDataContainer, + public wxRefCounter +{ +public: + enum wxAttrKind + { + Any, + Default, + Cell, + Row, + Col, + Merged + }; + + // default ctor + explicit wxGridCellAttr(wxGridCellAttr *attrDefault = NULL) + { + Init(attrDefault); + + SetAlignment(wxALIGN_INVALID, wxALIGN_INVALID); + } + + // ctor setting the most common attributes + wxGridCellAttr(const wxColour& colText, + const wxColour& colBack, + const wxFont& font, + int hAlign, + int vAlign) + : m_colText(colText), m_colBack(colBack), m_font(font) + { + Init(); + SetAlignment(hAlign, vAlign); + } + + // creates a new copy of this object + wxGridCellAttr *Clone() const; + void MergeWith(wxGridCellAttr *mergefrom); + + // setters + void SetTextColour(const wxColour& colText) { m_colText = colText; } + void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; } + void SetFont(const wxFont& font) { m_font = font; } + void SetAlignment(int hAlign, int vAlign) + { + m_hAlign = hAlign; + m_vAlign = vAlign; + } + void SetSize(int num_rows, int num_cols); + void SetFitMode(wxGridFitMode fitMode) { m_fitMode = fitMode; } + void SetOverflow(bool allow = true) + { SetFitMode(wxGridFitMode::FromOverflowFlag(allow)); } + void SetReadOnly(bool isReadOnly = true) + { m_isReadOnly = isReadOnly ? ReadOnly : ReadWrite; } + + // takes ownership of the pointer + void SetRenderer(wxGridCellRenderer *renderer) + { wxSafeDecRef(m_renderer); m_renderer = renderer; } + void SetEditor(wxGridCellEditor* editor) + { wxSafeDecRef(m_editor); m_editor = editor; } + + void SetKind(wxAttrKind kind) { m_attrkind = kind; } + + // accessors + bool HasTextColour() const { return m_colText.IsOk(); } + bool HasBackgroundColour() const { return m_colBack.IsOk(); } + bool HasFont() const { return m_font.IsOk(); } + bool HasAlignment() const + { + return m_hAlign != wxALIGN_INVALID || m_vAlign != wxALIGN_INVALID; + } + bool HasRenderer() const { return m_renderer != NULL; } + bool HasEditor() const { return m_editor != NULL; } + bool HasReadWriteMode() const { return m_isReadOnly != Unset; } + bool HasOverflowMode() const { return m_fitMode.IsSpecified(); } + bool HasSize() const { return m_sizeRows != 1 || m_sizeCols != 1; } + + const wxColour& GetTextColour() const; + const wxColour& GetBackgroundColour() const; + const wxFont& GetFont() const; + void GetAlignment(int *hAlign, int *vAlign) const; + + // unlike GetAlignment() which always overwrites its output arguments with + // the alignment values to use, falling back on default alignment if this + // attribute doesn't have any, this function will preserve the values of + // parameters on entry if the corresponding alignment is not set in this + // attribute meaning that they can be initialized to default alignment (and + // also that they must be initialized, unlike with GetAlignment()) + void GetNonDefaultAlignment(int *hAlign, int *vAlign) const; + + void GetSize(int *num_rows, int *num_cols) const; + wxGridFitMode GetFitMode() const; + bool GetOverflow() const { return GetFitMode().IsOverflow(); } + // whether the cell will draw the overflowed text to neighbour cells + // currently only left aligned cells can overflow + bool CanOverflow() const; + + wxGridCellRenderer *GetRenderer(const wxGrid* grid, int row, int col) const; + wxGridCellRendererPtr GetRendererPtr(const wxGrid* grid, int row, int col) const + { + return wxGridCellRendererPtr(GetRenderer(grid, row, col)); + } + + wxGridCellEditor *GetEditor(const wxGrid* grid, int row, int col) const; + wxGridCellEditorPtr GetEditorPtr(const wxGrid* grid, int row, int col) const + { + return wxGridCellEditorPtr(GetEditor(grid, row, col)); + } + + bool IsReadOnly() const { return m_isReadOnly == wxGridCellAttr::ReadOnly; } + + wxAttrKind GetKind() { return m_attrkind; } + + void SetDefAttr(wxGridCellAttr* defAttr) { m_defGridAttr = defAttr; } + +protected: + // the dtor is private because only DecRef() can delete us + virtual ~wxGridCellAttr() + { + wxSafeDecRef(m_renderer); + wxSafeDecRef(m_editor); + } + +private: + enum wxAttrReadMode + { + Unset = -1, + ReadWrite, + ReadOnly + }; + + // the common part of all ctors + void Init(wxGridCellAttr *attrDefault = NULL); + + + wxColour m_colText, + m_colBack; + wxFont m_font; + int m_hAlign, + m_vAlign; + int m_sizeRows, + m_sizeCols; + + wxGridFitMode m_fitMode; + + wxGridCellRenderer* m_renderer; + wxGridCellEditor* m_editor; + wxGridCellAttr* m_defGridAttr; + + wxAttrReadMode m_isReadOnly; + + wxAttrKind m_attrkind; + + // use Clone() instead + wxDECLARE_NO_COPY_CLASS(wxGridCellAttr); + + // suppress the stupid gcc warning about the class having private dtor and + // no friends + friend class wxGridCellAttrDummyFriend; +}; + +// Smart pointer to wxGridCellAttr, calling DecRef() on it automatically. +typedef wxObjectDataPtr wxGridCellAttrPtr; + +// ---------------------------------------------------------------------------- +// wxGridCellAttrProvider: class used by wxGridTableBase to retrieve/store the +// cell attributes. +// ---------------------------------------------------------------------------- + +// implementation note: we separate it from wxGridTableBase because we wish to +// avoid deriving a new table class if possible, and sometimes it will be +// enough to just derive another wxGridCellAttrProvider instead +// +// the default implementation is reasonably efficient for the generic case, +// but you might still wish to implement your own for some specific situations +// if you have performance problems with the stock one +class WXDLLIMPEXP_CORE wxGridCellAttrProvider : public wxClientDataContainer +{ +public: + wxGridCellAttrProvider(); + virtual ~wxGridCellAttrProvider(); + + // DecRef() must be called on the returned pointer + virtual wxGridCellAttr *GetAttr(int row, int col, + wxGridCellAttr::wxAttrKind kind ) const; + + // Helper returning smart pointer calling DecRef() automatically. + wxGridCellAttrPtr GetAttrPtr(int row, int col, + wxGridCellAttr::wxAttrKind kind ) const + { + return wxGridCellAttrPtr(GetAttr(row, col, kind)); + } + + // all these functions take ownership of the pointer, don't call DecRef() + // on it + virtual void SetAttr(wxGridCellAttr *attr, int row, int col); + virtual void SetRowAttr(wxGridCellAttr *attr, int row); + virtual void SetColAttr(wxGridCellAttr *attr, int col); + + // these functions must be called whenever some rows/cols are deleted + // because the internal data must be updated then + void UpdateAttrRows( size_t pos, int numRows ); + void UpdateAttrCols( size_t pos, int numCols ); + + + // get renderers for the given row/column header label and the corner + // window: unlike cell renderers, these objects are not reference counted + // and are never NULL so they are returned by reference + virtual const wxGridColumnHeaderRenderer& GetColumnHeaderRenderer(int col); + virtual const wxGridRowHeaderRenderer& GetRowHeaderRenderer(int row); + virtual const wxGridCornerHeaderRenderer& GetCornerRenderer(); + +private: + void InitData(); + + wxGridCellAttrProviderData *m_data; + + wxDECLARE_NO_COPY_CLASS(wxGridCellAttrProvider); +}; + +// ---------------------------------------------------------------------------- +// wxGridCellCoords: location of a cell in the grid +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGridCellCoords +{ +public: + wxGridCellCoords() { m_row = m_col = -1; } + wxGridCellCoords( int r, int c ) { m_row = r; m_col = c; } + + // default copy ctor is ok + + int GetRow() const { return m_row; } + void SetRow( int n ) { m_row = n; } + int GetCol() const { return m_col; } + void SetCol( int n ) { m_col = n; } + void Set( int row, int col ) { m_row = row; m_col = col; } + + bool operator==( const wxGridCellCoords& other ) const + { + return (m_row == other.m_row && m_col == other.m_col); + } + + bool operator!=( const wxGridCellCoords& other ) const + { + return (m_row != other.m_row || m_col != other.m_col); + } + + bool operator!() const + { + return (m_row == -1 && m_col == -1 ); + } + +private: + int m_row; + int m_col; +}; + + +// ---------------------------------------------------------------------------- +// wxGridBlockCoords: location of a block of cells in the grid +// ---------------------------------------------------------------------------- + +struct wxGridBlockDiffResult; + +class WXDLLIMPEXP_CORE wxGridBlockCoords +{ +public: + wxGridBlockCoords() : + m_topRow(-1), + m_leftCol(-1), + m_bottomRow(-1), + m_rightCol(-1) + { + } + + wxGridBlockCoords(int topRow, int leftCol, int bottomRow, int rightCol) : + m_topRow(topRow), + m_leftCol(leftCol), + m_bottomRow(bottomRow), + m_rightCol(rightCol) + { + } + + // default copy ctor is ok + + int GetTopRow() const { return m_topRow; } + void SetTopRow(int row) { m_topRow = row; } + int GetLeftCol() const { return m_leftCol; } + void SetLeftCol(int col) { m_leftCol = col; } + int GetBottomRow() const { return m_bottomRow; } + void SetBottomRow(int row) { m_bottomRow = row; } + int GetRightCol() const { return m_rightCol; } + void SetRightCol(int col) { m_rightCol = col; } + + wxGridCellCoords GetTopLeft() const + { + return wxGridCellCoords(m_topRow, m_leftCol); + } + + wxGridCellCoords GetBottomRight() const + { + return wxGridCellCoords(m_bottomRow, m_rightCol); + } + + wxGridBlockCoords Canonicalize() const + { + wxGridBlockCoords result = *this; + + if ( result.m_topRow > result.m_bottomRow ) + wxSwap(result.m_topRow, result.m_bottomRow); + + if ( result.m_leftCol > result.m_rightCol ) + wxSwap(result.m_leftCol, result.m_rightCol); + + return result; + } + + bool Intersects(const wxGridBlockCoords& other) const + { + return m_topRow <= other.m_bottomRow && m_bottomRow >= other.m_topRow && + m_leftCol <= other.m_rightCol && m_rightCol >= other.m_leftCol; + } + + // Return whether this block contains the given cell. + bool Contains(const wxGridCellCoords& cell) const + { + return m_topRow <= cell.GetRow() && cell.GetRow() <= m_bottomRow && + m_leftCol <= cell.GetCol() && cell.GetCol() <= m_rightCol; + } + + // Return whether this blocks fully contains another one. + bool Contains(const wxGridBlockCoords& other) const + { + return m_topRow <= other.m_topRow && other.m_bottomRow <= m_bottomRow && + m_leftCol <= other.m_leftCol && other.m_rightCol <= m_rightCol; + } + + // Calculates the result blocks by subtracting the other block from this + // block. splitOrientation can be wxVERTICAL or wxHORIZONTAL. + wxGridBlockDiffResult + Difference(const wxGridBlockCoords& other, int splitOrientation) const; + + // Calculates the symmetric difference of the blocks. + wxGridBlockDiffResult + SymDifference(const wxGridBlockCoords& other) const; + + bool operator==(const wxGridBlockCoords& other) const + { + return m_topRow == other.m_topRow && m_leftCol == other.m_leftCol && + m_bottomRow == other.m_bottomRow && m_rightCol == other.m_rightCol; + } + + bool operator!=(const wxGridBlockCoords& other) const + { + return !(*this == other); + } + + bool operator!() const + { + return m_topRow == -1 && m_leftCol == -1 && + m_bottomRow == -1 && m_rightCol == -1; + } + +private: + int m_topRow; + int m_leftCol; + int m_bottomRow; + int m_rightCol; +}; + +typedef wxVector wxGridBlockCoordsVector; + +// ---------------------------------------------------------------------------- +// wxGridBlockDiffResult: The helper struct uses as a result type for difference +// functions of wxGridBlockCoords class. +// Parts can be uninitialized (equals to wxGridNoBlockCoords), that means +// that the corresponding part doesn't exists in the result. +// ---------------------------------------------------------------------------- + +struct wxGridBlockDiffResult +{ + wxGridBlockCoords m_parts[4]; +}; + +// ---------------------------------------------------------------------------- +// wxGridBlocks: a range of grid blocks that can be iterated over +// ---------------------------------------------------------------------------- + +class wxGridBlocks +{ + typedef wxGridBlockCoordsVector::const_iterator iterator_impl; + +public: + class iterator + { + public: +#if wxUSE_STD_CONTAINERS_COMPATIBLY + typedef std::forward_iterator_tag iterator_category; +#endif + typedef ptrdiff_t difference_type; + typedef wxGridBlockCoords value_type; + typedef const value_type& reference; + typedef const value_type* pointer; + + iterator() : m_it() { } + + reference operator*() const { return *m_it; } + pointer operator->() const { return &*m_it; } + + iterator& operator++() + { ++m_it; return *this; } + iterator operator++(int) + { iterator tmp = *this; ++m_it; return tmp; } + + bool operator==(const iterator& it) const + { return m_it == it.m_it; } + bool operator!=(const iterator& it) const + { return m_it != it.m_it; } + + private: + explicit iterator(iterator_impl it) : m_it(it) { } + + iterator_impl m_it; + + friend class wxGridBlocks; + }; + + iterator begin() const + { + return m_begin; + } + + iterator end() const + { + return m_end; + } + +private: + wxGridBlocks() : + m_begin(), + m_end() + { + } + + wxGridBlocks(iterator_impl ibegin, iterator_impl iend) : + m_begin(ibegin), + m_end(iend) + { + } + + const iterator m_begin; + const iterator m_end; + + friend class wxGrid; +}; + +// For comparisons... +// +extern WXDLLIMPEXP_CORE wxGridCellCoords wxGridNoCellCoords; +extern WXDLLIMPEXP_CORE wxGridBlockCoords wxGridNoBlockCoords; +extern WXDLLIMPEXP_CORE wxRect wxGridNoCellRect; + +// An array of cell coords... +// +WX_DECLARE_OBJARRAY_WITH_DECL(wxGridCellCoords, wxGridCellCoordsArray, + class WXDLLIMPEXP_CORE); + +// ---------------------------------------------------------------------------- +// Grid table classes +// ---------------------------------------------------------------------------- + +// the abstract base class +class WXDLLIMPEXP_CORE wxGridTableBase : public wxObject, + public wxClientDataContainer +{ +public: + wxGridTableBase(); + virtual ~wxGridTableBase(); + + // You must override these functions in a derived table class + // + + // return the number of rows and columns in this table + virtual int GetNumberRows() = 0; + virtual int GetNumberCols() = 0; + + // the methods above are unfortunately non-const even though they should + // have been const -- but changing it now is not possible any longer as it + // would break the existing code overriding them, so instead we provide + // these const synonyms which can be used from const-correct code + int GetRowsCount() const + { return const_cast(this)->GetNumberRows(); } + int GetColsCount() const + { return const_cast(this)->GetNumberCols(); } + + + virtual bool IsEmptyCell( int row, int col ) + { + return GetValue(row, col).empty(); + } + + bool IsEmpty(const wxGridCellCoords& coord) + { + return IsEmptyCell(coord.GetRow(), coord.GetCol()); + } + + virtual wxString GetValue( int row, int col ) = 0; + virtual void SetValue( int row, int col, const wxString& value ) = 0; + + // Data type determination and value access + virtual wxString GetTypeName( int row, int col ); + virtual bool CanGetValueAs( int row, int col, const wxString& typeName ); + virtual bool CanSetValueAs( int row, int col, const wxString& typeName ); + + virtual long GetValueAsLong( int row, int col ); + virtual double GetValueAsDouble( int row, int col ); + virtual bool GetValueAsBool( int row, int col ); + + virtual void SetValueAsLong( int row, int col, long value ); + virtual void SetValueAsDouble( int row, int col, double value ); + virtual void SetValueAsBool( int row, int col, bool value ); + + // For user defined types + virtual void* GetValueAsCustom( int row, int col, const wxString& typeName ); + virtual void SetValueAsCustom( int row, int col, const wxString& typeName, void* value ); + + + // Overriding these is optional + // + virtual void SetView( wxGrid *grid ) { m_view = grid; } + virtual wxGrid * GetView() const { return m_view; } + + virtual void Clear() {} + virtual bool InsertRows( size_t pos = 0, size_t numRows = 1 ); + virtual bool AppendRows( size_t numRows = 1 ); + virtual bool DeleteRows( size_t pos = 0, size_t numRows = 1 ); + virtual bool InsertCols( size_t pos = 0, size_t numCols = 1 ); + virtual bool AppendCols( size_t numCols = 1 ); + virtual bool DeleteCols( size_t pos = 0, size_t numCols = 1 ); + + virtual wxString GetRowLabelValue( int row ); + virtual wxString GetColLabelValue( int col ); + virtual wxString GetCornerLabelValue() const; + virtual void SetRowLabelValue( int WXUNUSED(row), const wxString& ) {} + virtual void SetColLabelValue( int WXUNUSED(col), const wxString& ) {} + virtual void SetCornerLabelValue( const wxString& ) {} + + // Attribute handling + // + + // give us the attr provider to use - we take ownership of the pointer + void SetAttrProvider(wxGridCellAttrProvider *attrProvider); + + // get the currently used attr provider (may be NULL) + wxGridCellAttrProvider *GetAttrProvider() const { return m_attrProvider; } + + // Does this table allow attributes? Default implementation creates + // a wxGridCellAttrProvider if necessary. + virtual bool CanHaveAttributes(); + + // by default forwarded to wxGridCellAttrProvider if any. May be + // overridden to handle attributes directly in the table. + virtual wxGridCellAttr *GetAttr( int row, int col, + wxGridCellAttr::wxAttrKind kind ); + + wxGridCellAttrPtr GetAttrPtr(int row, int col, + wxGridCellAttr::wxAttrKind kind) + { + return wxGridCellAttrPtr(GetAttr(row, col, kind)); + } + + // This is an optimization for a common case when the entire column uses + // roughly the same attribute, which can thus be reused for measuring all + // the cells in this column. Override this to return true (possibly for + // some columns only) to speed up AutoSizeColumns() for the grids using + // this table. + virtual bool CanMeasureColUsingSameAttr(int WXUNUSED(col)) const + { + return false; + } + + // these functions take ownership of the pointer + virtual void SetAttr(wxGridCellAttr* attr, int row, int col); + virtual void SetRowAttr(wxGridCellAttr *attr, int row); + virtual void SetColAttr(wxGridCellAttr *attr, int col); + +private: + wxGrid * m_view; + wxGridCellAttrProvider *m_attrProvider; + + wxDECLARE_ABSTRACT_CLASS(wxGridTableBase); + wxDECLARE_NO_COPY_CLASS(wxGridTableBase); +}; + + +// ---------------------------------------------------------------------------- +// wxGridTableMessage +// ---------------------------------------------------------------------------- + +// IDs for messages sent from grid table to view +// +enum wxGridTableRequest +{ + // The first two requests never did anything, simply don't use them. +#if WXWIN_COMPATIBILITY_3_0 + wxGRIDTABLE_REQUEST_VIEW_GET_VALUES = 2000, + wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES, +#endif // WXWIN_COMPATIBILITY_3_0 + wxGRIDTABLE_NOTIFY_ROWS_INSERTED = 2002, + wxGRIDTABLE_NOTIFY_ROWS_APPENDED, + wxGRIDTABLE_NOTIFY_ROWS_DELETED, + wxGRIDTABLE_NOTIFY_COLS_INSERTED, + wxGRIDTABLE_NOTIFY_COLS_APPENDED, + wxGRIDTABLE_NOTIFY_COLS_DELETED +}; + +class WXDLLIMPEXP_CORE wxGridTableMessage +{ +public: + wxGridTableMessage(); + wxGridTableMessage( wxGridTableBase *table, int id, + int comInt1 = -1, + int comInt2 = -1 ); + + void SetTableObject( wxGridTableBase *table ) { m_table = table; } + wxGridTableBase * GetTableObject() const { return m_table; } + void SetId( int id ) { m_id = id; } + int GetId() const { return m_id; } + void SetCommandInt( int comInt1 ) { m_comInt1 = comInt1; } + int GetCommandInt() const { return m_comInt1; } + void SetCommandInt2( int comInt2 ) { m_comInt2 = comInt2; } + int GetCommandInt2() const { return m_comInt2; } + +private: + wxGridTableBase *m_table; + int m_id; + int m_comInt1; + int m_comInt2; + + wxDECLARE_NO_COPY_CLASS(wxGridTableMessage); +}; + + + +// ------ wxGridStringArray +// A 2-dimensional array of strings for data values +// + +WX_DECLARE_OBJARRAY_WITH_DECL(wxArrayString, wxGridStringArray, + class WXDLLIMPEXP_CORE); + + + +// ------ wxGridStringTable +// +// Simplest type of data table for a grid for small tables of strings +// that are stored in memory +// + +class WXDLLIMPEXP_CORE wxGridStringTable : public wxGridTableBase +{ +public: + wxGridStringTable(); + wxGridStringTable( int numRows, int numCols ); + + // these are pure virtual in wxGridTableBase + // + virtual int GetNumberRows() wxOVERRIDE { return static_cast(m_data.size()); } + virtual int GetNumberCols() wxOVERRIDE { return m_numCols; } + virtual wxString GetValue( int row, int col ) wxOVERRIDE; + virtual void SetValue( int row, int col, const wxString& s ) wxOVERRIDE; + + // overridden functions from wxGridTableBase + // + void Clear() wxOVERRIDE; + bool InsertRows( size_t pos = 0, size_t numRows = 1 ) wxOVERRIDE; + bool AppendRows( size_t numRows = 1 ) wxOVERRIDE; + bool DeleteRows( size_t pos = 0, size_t numRows = 1 ) wxOVERRIDE; + bool InsertCols( size_t pos = 0, size_t numCols = 1 ) wxOVERRIDE; + bool AppendCols( size_t numCols = 1 ) wxOVERRIDE; + bool DeleteCols( size_t pos = 0, size_t numCols = 1 ) wxOVERRIDE; + + void SetRowLabelValue( int row, const wxString& ) wxOVERRIDE; + void SetColLabelValue( int col, const wxString& ) wxOVERRIDE; + void SetCornerLabelValue( const wxString& ) wxOVERRIDE; + wxString GetRowLabelValue( int row ) wxOVERRIDE; + wxString GetColLabelValue( int col ) wxOVERRIDE; + wxString GetCornerLabelValue() const wxOVERRIDE; + +private: + wxGridStringArray m_data; + + // notice that while we don't need to store the number of our rows as it's + // always equal to the size of m_data array, we do need to store the number + // of our columns as we can't retrieve it from m_data when the number of + // rows is 0 (see #10818) + int m_numCols; + + // These only get used if you set your own labels, otherwise the + // GetRow/ColLabelValue functions return wxGridTableBase defaults + // + wxArrayString m_rowLabels; + wxArrayString m_colLabels; + + wxString m_cornerLabel; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxGridStringTable); +}; + + + +// ============================================================================ +// Grid view classes +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxGridSizesInfo stores information about sizes of the rows or columns. +// +// It assumes that most of the columns or rows have default size and so stores +// the default size separately and uses a hash to map column or row numbers to +// their non default size for those which don't have the default size. +// ---------------------------------------------------------------------------- + +// hash map to store positions as the keys and sizes as the values +WX_DECLARE_HASH_MAP_WITH_DECL( unsigned, int, wxIntegerHash, wxIntegerEqual, + wxUnsignedToIntHashMap, class WXDLLIMPEXP_CORE ); + +struct WXDLLIMPEXP_CORE wxGridSizesInfo +{ + // default ctor, initialize m_sizeDefault and m_customSizes later + wxGridSizesInfo() { } + + // ctor used by wxGrid::Get{Col,Row}Sizes() + wxGridSizesInfo(int defSize, const wxArrayInt& allSizes); + + // default copy ctor, assignment operator and dtor are ok + + // Get the size of the element with the given index + int GetSize(unsigned pos) const; + + + // default size + int m_sizeDefault; + + // position -> size map containing all elements with non-default size + wxUnsignedToIntHashMap m_customSizes; +}; + +// ---------------------------------------------------------------------------- +// wxGrid +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGrid : public wxScrolledCanvas +{ +public: + // possible selection modes + enum wxGridSelectionModes + { + wxGridSelectCells = 0, // allow selecting anything + wxGridSelectRows = 1, // allow selecting only entire rows + wxGridSelectColumns = 2, // allow selecting only entire columns + wxGridSelectRowsOrColumns = wxGridSelectRows | wxGridSelectColumns, + wxGridSelectNone = 4 // disallow selecting anything + }; + + // Different behaviour of the TAB key when the end (or the beginning, for + // Shift-TAB) of the current row is reached: + enum TabBehaviour + { + Tab_Stop, // Do nothing, this is default. + Tab_Wrap, // Move to the next (or previous) row. + Tab_Leave // Move to the next (or previous) control. + }; + + // creation and destruction + // ------------------------ + + // ctor and Create() create the grid window, as with the other controls + wxGrid() { Init(); } + + wxGrid(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxWANTS_CHARS, + const wxString& name = wxASCII_STR(wxGridNameStr)) + { + Init(); + + Create(parent, id, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxWANTS_CHARS, + const wxString& name = wxASCII_STR(wxGridNameStr)); + + virtual ~wxGrid(); + + // however to initialize grid data either CreateGrid() (to use a simple + // default table class) or {Set,Assign}Table() (to use a custom table) must + // be also called + + // this is basically equivalent to + // + // AssignTable(new wxGridStringTable(numRows, numCols), selmode) + // + bool CreateGrid( int numRows, int numCols, + wxGridSelectionModes selmode = wxGridSelectCells ); + + bool SetTable( wxGridTableBase *table, + bool takeOwnership = false, + wxGridSelectionModes selmode = wxGridSelectCells ); + + void AssignTable( wxGridTableBase *table, + wxGridSelectionModes selmode = wxGridSelectCells ); + + bool ProcessTableMessage(wxGridTableMessage&); + + wxGridTableBase *GetTable() const { return m_table; } + + + void SetSelectionMode(wxGridSelectionModes selmode); + wxGridSelectionModes GetSelectionMode() const; + + // ------ grid dimensions + // + int GetNumberRows() const { return m_numRows; } + int GetNumberCols() const { return m_numCols; } + + int GetNumberFrozenRows() const { return m_numFrozenRows; } + int GetNumberFrozenCols() const { return m_numFrozenCols; } + + // ------ display update functions + // + wxArrayInt CalcRowLabelsExposed( const wxRegion& reg, + wxGridWindow *gridWindow = NULL) const; + wxArrayInt CalcColLabelsExposed( const wxRegion& reg, + wxGridWindow *gridWindow = NULL) const; + wxGridCellCoordsArray CalcCellsExposed( const wxRegion& reg, + wxGridWindow *gridWindow = NULL) const; + + void PrepareDCFor(wxDC &dc, wxGridWindow *gridWindow); + + void ClearGrid(); + bool InsertRows(int pos = 0, int numRows = 1, bool updateLabels = true) + { + return DoModifyLines(&wxGridTableBase::InsertRows, + pos, numRows, updateLabels); + } + bool InsertCols(int pos = 0, int numCols = 1, bool updateLabels = true) + { + return DoModifyLines(&wxGridTableBase::InsertCols, + pos, numCols, updateLabels); + } + + bool AppendRows(int numRows = 1, bool updateLabels = true) + { + return DoAppendLines(&wxGridTableBase::AppendRows, numRows, updateLabels); + } + bool AppendCols(int numCols = 1, bool updateLabels = true) + { + return DoAppendLines(&wxGridTableBase::AppendCols, numCols, updateLabels); + } + + bool DeleteRows(int pos = 0, int numRows = 1, bool updateLabels = true) + { + return DoModifyLines(&wxGridTableBase::DeleteRows, + pos, numRows, updateLabels); + } + bool DeleteCols(int pos = 0, int numCols = 1, bool updateLabels = true) + { + return DoModifyLines(&wxGridTableBase::DeleteCols, + pos, numCols, updateLabels); + } + + bool FreezeTo(int row, int col); + bool FreezeTo(const wxGridCellCoords& coords) + { + return FreezeTo(coords.GetRow(), coords.GetCol()); + } + + bool IsFrozen() const; + + void DrawGridCellArea( wxDC& dc , const wxGridCellCoordsArray& cells ); + void DrawGridSpace( wxDC& dc, wxGridWindow *gridWindow ); + void DrawCellBorder( wxDC& dc, const wxGridCellCoords& ); + void DrawAllGridLines(); + void DrawAllGridWindowLines( wxDC& dc, const wxRegion & reg , wxGridWindow *gridWindow); + void DrawCell( wxDC& dc, const wxGridCellCoords& ); + void DrawHighlight(wxDC& dc, const wxGridCellCoordsArray& cells); + void DrawFrozenBorder( wxDC& dc, wxGridWindow *gridWindow ); + void DrawLabelFrozenBorder( wxDC& dc, wxWindow *window, bool isRow ); + + void ScrollWindow( int dx, int dy, const wxRect *rect ) wxOVERRIDE; + + void UpdateGridWindows() const; + + // this function is called when the current cell highlight must be redrawn + // and may be overridden by the user + virtual void DrawCellHighlight( wxDC& dc, const wxGridCellAttr *attr ); + + virtual void DrawRowLabels( wxDC& dc, const wxArrayInt& rows ); + virtual void DrawRowLabel( wxDC& dc, int row ); + + virtual void DrawColLabels( wxDC& dc, const wxArrayInt& cols ); + virtual void DrawColLabel( wxDC& dc, int col ); + + virtual void DrawCornerLabel(wxDC& dc); + + // ------ Cell text drawing functions + // + void DrawTextRectangle( wxDC& dc, const wxString&, const wxRect&, + int horizontalAlignment = wxALIGN_LEFT, + int verticalAlignment = wxALIGN_TOP, + int textOrientation = wxHORIZONTAL ) const; + + void DrawTextRectangle( wxDC& dc, const wxArrayString& lines, const wxRect&, + int horizontalAlignment = wxALIGN_LEFT, + int verticalAlignment = wxALIGN_TOP, + int textOrientation = wxHORIZONTAL ) const; + + void DrawTextRectangle(wxDC& dc, + const wxString& text, + const wxRect& rect, + const wxGridCellAttr& attr, + int defaultHAlign = wxALIGN_INVALID, + int defaultVAlign = wxALIGN_INVALID) const; + + // ------ grid render function for printing + // + void Render( wxDC& dc, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxGridCellCoords& topLeft = wxGridCellCoords(-1, -1), + const wxGridCellCoords& bottomRight = wxGridCellCoords(-1, -1), + int style = wxGRID_DRAW_DEFAULT ); + + // Split a string containing newline characters into an array of + // strings and return the number of lines + // + void StringToLines( const wxString& value, wxArrayString& lines ) const; + + void GetTextBoxSize( const wxDC& dc, + const wxArrayString& lines, + long *width, long *height ) const; + + // If bottomRight is invalid, i.e. == wxGridNoCellCoords, it defaults to + // topLeft. If topLeft itself is invalid, the function simply returns. + void RefreshBlock(const wxGridCellCoords& topLeft, + const wxGridCellCoords& bottomRight); + + void RefreshBlock(int topRow, int leftCol, + int bottomRow, int rightCol); + + // ------ + // Code that does a lot of grid modification can be enclosed + // between BeginBatch() and EndBatch() calls to avoid screen + // flicker + // + void BeginBatch() { m_batchCount++; } + void EndBatch(); + + int GetBatchCount() const { return m_batchCount; } + + virtual void Refresh(bool eraseb = true, const wxRect* rect = NULL) wxOVERRIDE; + + // Use this, rather than wxWindow::Refresh(), to force an + // immediate repainting of the grid. Has no effect if you are + // already inside a BeginBatch / EndBatch block. + // + // This function is necessary because wxGrid has a minimal OnPaint() + // handler to reduce screen flicker. + // + void ForceRefresh(); + + + // ------ edit control functions + // + bool IsEditable() const { return m_editable; } + void EnableEditing( bool edit ); + + void EnableCellEditControl( bool enable = true ); + void DisableCellEditControl() { EnableCellEditControl(false); } + bool CanEnableCellControl() const; + bool IsCellEditControlEnabled() const { return m_cellEditCtrlEnabled; } + bool IsCellEditControlShown() const; + + bool IsCurrentCellReadOnly() const; + + void ShowCellEditControl(); // Use EnableCellEditControl() instead. + void HideCellEditControl(); + void SaveEditControlValue(); + + + // ------ grid location functions + // Note that all of these functions work with the logical coordinates of + // grid cells and labels so you will need to convert from device + // coordinates for mouse events etc. + // + wxGridCellCoords XYToCell(int x, int y, wxGridWindow *gridWindow = NULL) const; + void XYToCell(int x, int y, + wxGridCellCoords& coords, + wxGridWindow *gridWindow = NULL) const + { coords = XYToCell(x, y, gridWindow); } + + wxGridCellCoords XYToCell(const wxPoint& pos, + wxGridWindow *gridWindow = NULL) const + { return XYToCell(pos.x, pos.y, gridWindow); } + + // these functions return the index of the row/columns corresponding to the + // given logical position in pixels + // + // if clipToMinMax is false (default, wxNOT_FOUND is returned if the + // position is outside any row/column, otherwise the first/last element is + // returned in this case + int YToRow( int y, bool clipToMinMax = false, wxGridWindow *gridWindow = NULL ) const; + int XToCol( int x, bool clipToMinMax = false, wxGridWindow *gridWindow = NULL ) const; + + int YToEdgeOfRow( int y ) const; + int XToEdgeOfCol( int x ) const; + + wxRect CellToRect( int row, int col ) const; + wxRect CellToRect( const wxGridCellCoords& coords ) const + { return CellToRect( coords.GetRow(), coords.GetCol() ); } + + wxGridWindow* CellToGridWindow( int row, int col ) const; + wxGridWindow* CellToGridWindow( const wxGridCellCoords& coords ) const + { return CellToGridWindow( coords.GetRow(), coords.GetCol() ); } + + const wxGridCellCoords& GetGridCursorCoords() const + { return m_currentCellCoords; } + + int GetGridCursorRow() const { return m_currentCellCoords.GetRow(); } + int GetGridCursorCol() const { return m_currentCellCoords.GetCol(); } + + void GetGridWindowOffset(const wxGridWindow *gridWindow, int &x, int &y) const; + wxPoint GetGridWindowOffset(const wxGridWindow *gridWindow) const; + + wxGridWindow* DevicePosToGridWindow(wxPoint pos) const; + wxGridWindow* DevicePosToGridWindow(int x, int y) const; + + void CalcGridWindowUnscrolledPosition(int x, int y, int *xx, int *yy, + const wxGridWindow *gridWindow) const; + wxPoint CalcGridWindowUnscrolledPosition(const wxPoint& pt, + const wxGridWindow *gridWindow) const; + + void CalcGridWindowScrolledPosition(int x, int y, int *xx, int *yy, + const wxGridWindow *gridWindow) const; + wxPoint CalcGridWindowScrolledPosition(const wxPoint& pt, + const wxGridWindow *gridWindow) const; + + // check to see if a cell is either wholly visible (the default arg) or + // at least partially visible in the grid window + // + bool IsVisible( int row, int col, bool wholeCellVisible = true ) const; + bool IsVisible( const wxGridCellCoords& coords, bool wholeCellVisible = true ) const + { return IsVisible( coords.GetRow(), coords.GetCol(), wholeCellVisible ); } + void MakeCellVisible( int row, int col ); + void MakeCellVisible( const wxGridCellCoords& coords ) + { MakeCellVisible( coords.GetRow(), coords.GetCol() ); } + + // Returns the topmost row of the current visible area. + int GetFirstFullyVisibleRow() const; + // Returns the leftmost column of the current visible area. + int GetFirstFullyVisibleColumn() const; + + // ------ grid cursor movement functions + // + void SetGridCursor(int row, int col) { SetCurrentCell(row, col); } + void SetGridCursor(const wxGridCellCoords& c) { SetCurrentCell(c); } + + void GoToCell(int row, int col) + { + if ( SetCurrentCell(row, col) ) + MakeCellVisible(row, col); + } + + void GoToCell(const wxGridCellCoords& coords) + { + if ( SetCurrentCell(coords) ) + MakeCellVisible(coords); + } + + bool MoveCursorUp( bool expandSelection ); + bool MoveCursorDown( bool expandSelection ); + bool MoveCursorLeft( bool expandSelection ); + bool MoveCursorRight( bool expandSelection ); + bool MovePageDown(); + bool MovePageUp(); + bool MoveCursorUpBlock( bool expandSelection ); + bool MoveCursorDownBlock( bool expandSelection ); + bool MoveCursorLeftBlock( bool expandSelection ); + bool MoveCursorRightBlock( bool expandSelection ); + + void SetTabBehaviour(TabBehaviour behaviour) { m_tabBehaviour = behaviour; } + + + // ------ label and gridline formatting + // + int GetDefaultRowLabelSize() const { return FromDIP(WXGRID_DEFAULT_ROW_LABEL_WIDTH); } + int GetRowLabelSize() const { return m_rowLabelWidth; } + int GetDefaultColLabelSize() const { return FromDIP(WXGRID_DEFAULT_COL_LABEL_HEIGHT); } + int GetColLabelSize() const { return m_colLabelHeight; } + wxColour GetLabelBackgroundColour() const { return m_labelBackgroundColour; } + wxColour GetLabelTextColour() const { return m_labelTextColour; } + wxFont GetLabelFont() const { return m_labelFont; } + void GetRowLabelAlignment( int *horiz, int *vert ) const; + void GetColLabelAlignment( int *horiz, int *vert ) const; + void GetCornerLabelAlignment( int *horiz, int *vert ) const; + int GetColLabelTextOrientation() const; + int GetCornerLabelTextOrientation() const; + wxString GetRowLabelValue( int row ) const; + wxString GetColLabelValue( int col ) const; + wxString GetCornerLabelValue() const; + + wxColour GetCellHighlightColour() const { return m_cellHighlightColour; } + int GetCellHighlightPenWidth() const { return m_cellHighlightPenWidth; } + int GetCellHighlightROPenWidth() const { return m_cellHighlightROPenWidth; } + wxColor GetGridFrozenBorderColour() const { return m_gridFrozenBorderColour; } + int GetGridFrozenBorderPenWidth() const { return m_gridFrozenBorderPenWidth; } + + // this one will use wxHeaderCtrl for the column labels + bool UseNativeColHeader(bool native = true); + + // this one will still draw them manually but using the native renderer + // instead of using the same appearance as for the row labels + void SetUseNativeColLabels( bool native = true ); + + void SetRowLabelSize( int width ); + void SetColLabelSize( int height ); + void HideRowLabels() { SetRowLabelSize( 0 ); } + void HideColLabels() { SetColLabelSize( 0 ); } + void SetLabelBackgroundColour( const wxColour& ); + void SetLabelTextColour( const wxColour& ); + void SetLabelFont( const wxFont& ); + void SetRowLabelAlignment( int horiz, int vert ); + void SetColLabelAlignment( int horiz, int vert ); + void SetCornerLabelAlignment( int horiz, int vert ); + void SetColLabelTextOrientation( int textOrientation ); + void SetCornerLabelTextOrientation( int textOrientation ); + void SetRowLabelValue( int row, const wxString& ); + void SetColLabelValue( int col, const wxString& ); + void SetCornerLabelValue( const wxString& ); + void SetCellHighlightColour( const wxColour& ); + void SetCellHighlightPenWidth( int width ); + void SetCellHighlightROPenWidth( int width ); + void SetGridFrozenBorderColour( const wxColour& ); + void SetGridFrozenBorderPenWidth( int width ); + + // interactive grid mouse operations control + // ----------------------------------------- + + // functions globally enabling row/column interactive resizing (enabled by + // default) + void EnableDragRowSize( bool enable = true ); + void DisableDragRowSize() { EnableDragRowSize( false ); } + + void EnableDragColSize( bool enable = true ); + void DisableDragColSize() { EnableDragColSize( false ); } + + // if interactive resizing is enabled, some rows/columns can still have + // fixed size + void DisableRowResize(int row) { DoDisableLineResize(row, m_setFixedRows); } + void DisableColResize(int col) { DoDisableLineResize(col, m_setFixedCols); } + + // These function return true if resizing rows/columns by dragging + // their edges inside the grid is enabled. Note that this doesn't cover + // dragging their separators in the label windows (which can be enabled + // for the columns even if dragging inside the grid is not), nor checks + // whether a particular row/column is resizeable or not, so you should + // always check CanDrag{Row,Col}Size() below too. + bool CanDragGridRowEdges() const + { + return m_canDragGridSize && m_canDragRowSize; + } + + bool CanDragGridColEdges() const + { + // When using the native header window we can only resize the columns by + // dragging the dividers in the header itself, but not by dragging them + // in the grid because we can't make the native control enter into the + // column resizing mode programmatically. + return m_canDragGridSize && m_canDragColSize && !m_useNativeHeader; + } + + // These functions return whether the given row/column can be + // effectively resized: for this interactive resizing must be enabled + // and this index must not have been passed to DisableRow/ColResize() + bool CanDragRowSize(int row) const + { return m_canDragRowSize && DoCanResizeLine(row, m_setFixedRows); } + bool CanDragColSize(int col) const + { return m_canDragColSize && DoCanResizeLine(col, m_setFixedCols); } + + // interactive row reordering (disabled by default) + bool EnableDragRowMove( bool enable = true ); + void DisableDragRowMove() { EnableDragRowMove( false ); } + bool CanDragRowMove() const { return m_canDragRowMove; } + + // interactive column reordering (disabled by default) + bool EnableDragColMove( bool enable = true ); + void DisableDragColMove() { EnableDragColMove( false ); } + bool CanDragColMove() const { return m_canDragColMove; } + + // interactive column hiding (enabled by default, works only for native header) + bool EnableHidingColumns( bool enable = true ); + void DisableHidingColumns() { EnableHidingColumns(false); } + bool CanHideColumns() const { return m_canHideColumns; } + + // interactive resizing of grid cells (enabled by default) + void EnableDragGridSize(bool enable = true); + void DisableDragGridSize() { EnableDragGridSize(false); } + bool CanDragGridSize() const { return m_canDragGridSize; } + + // interactive dragging of cells (disabled by default) + void EnableDragCell( bool enable = true ); + void DisableDragCell() { EnableDragCell( false ); } + bool CanDragCell() const { return m_canDragCell; } + + + // grid lines + // ---------- + + // enable or disable drawing of the lines + void EnableGridLines(bool enable = true); + bool GridLinesEnabled() const { return m_gridLinesEnabled; } + + // by default grid lines stop at last column/row, but this may be changed + void ClipHorzGridLines(bool clip) + { DoClipGridLines(m_gridLinesClipHorz, clip); } + void ClipVertGridLines(bool clip) + { DoClipGridLines(m_gridLinesClipVert, clip); } + bool AreHorzGridLinesClipped() const { return m_gridLinesClipHorz; } + bool AreVertGridLinesClipped() const { return m_gridLinesClipVert; } + + // this can be used to change the global grid lines colour + void SetGridLineColour(const wxColour& col); + wxColour GetGridLineColour() const { return m_gridLineColour; } + + // these methods may be overridden to customize individual grid lines + // appearance + virtual wxPen GetDefaultGridLinePen(); + virtual wxPen GetRowGridLinePen(int row); + virtual wxPen GetColGridLinePen(int col); + + + // attributes + // ---------- + + // this sets the specified attribute for this cell or in this row/col + void SetAttr(int row, int col, wxGridCellAttr *attr); + void SetRowAttr(int row, wxGridCellAttr *attr); + void SetColAttr(int col, wxGridCellAttr *attr); + + // the grid can cache attributes for the recently used cells (currently it + // only caches one attribute for the most recently used one) and might + // notice that its value in the attribute provider has changed -- if this + // happens, call this function to force it + void RefreshAttr(int row, int col); + + // returns the attribute we may modify in place: a new one if this cell + // doesn't have any yet or the existing one if it does + // + // DecRef() must be called on the returned pointer, as usual + wxGridCellAttr *GetOrCreateCellAttr(int row, int col) const; + + wxGridCellAttrPtr GetOrCreateCellAttrPtr(int row, int col) const + { + return wxGridCellAttrPtr(GetOrCreateCellAttr(row, col)); + } + + + // shortcuts for setting the column parameters + + // set the format for the data in the column: default is string + void SetColFormatBool(int col); + void SetColFormatNumber(int col); + void SetColFormatFloat(int col, int width = -1, int precision = -1); + void SetColFormatDate(int col, const wxString& format = wxString()); + void SetColFormatCustom(int col, const wxString& typeName); + + // ------ row and col formatting + // + int GetDefaultRowSize() const; + int GetRowSize( int row ) const; + bool IsRowShown(int row) const { return GetRowSize(row) != 0; } + int GetDefaultColSize() const; + int GetColSize( int col ) const; + bool IsColShown(int col) const { return GetColSize(col) != 0; } + wxColour GetDefaultCellBackgroundColour() const; + wxColour GetCellBackgroundColour( int row, int col ) const; + wxColour GetDefaultCellTextColour() const; + wxColour GetCellTextColour( int row, int col ) const; + wxFont GetDefaultCellFont() const; + wxFont GetCellFont( int row, int col ) const; + void GetDefaultCellAlignment( int *horiz, int *vert ) const; + void GetCellAlignment( int row, int col, int *horiz, int *vert ) const; + + wxGridFitMode GetDefaultCellFitMode() const; + wxGridFitMode GetCellFitMode(int row, int col) const; + + bool GetDefaultCellOverflow() const + { return GetDefaultCellFitMode().IsOverflow(); } + bool GetCellOverflow( int row, int col ) const + { return GetCellFitMode(row, col).IsOverflow(); } + + // this function returns 1 in num_rows and num_cols for normal cells, + // positive numbers for a cell spanning multiple columns/rows (as set with + // SetCellSize()) and _negative_ numbers corresponding to the offset of the + // top left cell of the span from this one for the other cells covered by + // this cell + // + // the return value is CellSpan_None, CellSpan_Main or CellSpan_Inside for + // each of these cases respectively + enum CellSpan + { + CellSpan_Inside = -1, + CellSpan_None = 0, + CellSpan_Main + }; + + CellSpan GetCellSize( int row, int col, int *num_rows, int *num_cols ) const; + + wxSize GetCellSize(const wxGridCellCoords& coords) const + { + wxSize s; + GetCellSize(coords.GetRow(), coords.GetCol(), &s.x, &s.y); + return s; + } + + // ------ row and col sizes + void SetDefaultRowSize( int height, bool resizeExistingRows = false ); + void SetRowSize( int row, int height ); + void HideRow(int row) { DoSetRowSize(row, 0); } + void ShowRow(int row) { DoSetRowSize(row, -1); } + + void SetDefaultColSize( int width, bool resizeExistingCols = false ); + void SetColSize( int col, int width ); + void HideCol(int col) { DoSetColSize(col, 0); } + void ShowCol(int col) { DoSetColSize(col, -1); } + + // the row and column sizes can be also set all at once using + // wxGridSizesInfo which holds all of them at once + + wxGridSizesInfo GetColSizes() const + { return wxGridSizesInfo(GetDefaultColSize(), m_colWidths); } + wxGridSizesInfo GetRowSizes() const + { return wxGridSizesInfo(GetDefaultRowSize(), m_rowHeights); } + + void SetColSizes(const wxGridSizesInfo& sizeInfo); + void SetRowSizes(const wxGridSizesInfo& sizeInfo); + + + // ------- rows and columns reordering + + // rows and columns index <-> positions mapping: by default, the position + // is the same as its index, but they can also be reordered + // (either by calling SetRowPos()/SetColPos() explicitly or by the user + // dragging around) in which case their indices don't correspond to their + // positions on display any longer + // + // internally we always work with indices except for the functions which + // have "Pos" in their names (and which work with rows and columns, not + // pixels) and only the display and hit testing code really cares about + // display positions at all + + // set the positions of all rows or columns at once (this method uses the + // same conventions as wxHeaderCtrl::SetColumnsOrder() for the order array) + void SetRowsOrder(const wxArrayInt& order); + void SetColumnsOrder(const wxArrayInt& order); + + // return the row index corresponding to the given (valid) position + int GetRowAt(int pos) const + { + return m_rowAt.empty() ? pos : m_rowAt[pos]; + } + + // return the column index corresponding to the given (valid) position + int GetColAt(int pos) const + { + return m_colAt.empty() ? pos : m_colAt[pos]; + } + + // reorder the rows so that the row with the given index is now shown + // as the position pos + void SetRowPos(int idx, int pos); + + // reorder the columns so that the column with the given index is now shown + // as the position pos + void SetColPos(int idx, int pos); + + // return the position at which the row with the given index is + // displayed: notice that this is a slow operation as we don't maintain the + // reverse mapping currently + int GetRowPos(int idx) const; + + // return the position at which the column with the given index is + // displayed: notice that this is a slow operation as we don't maintain the + // reverse mapping currently + int GetColPos(int idx) const; + + // reset the rows or columns positions to the default order + void ResetRowPos(); + void ResetColPos(); + + + // automatically size the column or row to fit to its contents, if + // setAsMin is true, this optimal width will also be set as minimal width + // for this column + void AutoSizeColumn( int col, bool setAsMin = true ) + { AutoSizeColOrRow(col, setAsMin, wxGRID_COLUMN); } + void AutoSizeRow( int row, bool setAsMin = true ) + { AutoSizeColOrRow(row, setAsMin, wxGRID_ROW); } + + // auto size all columns (very ineffective for big grids!) + void AutoSizeColumns( bool setAsMin = true ); + void AutoSizeRows( bool setAsMin = true ); + + // auto size the grid, that is make the columns/rows of the "right" size + // and also set the grid size to just fit its contents + void AutoSize(); + + // Note for both AutoSizeRowLabelSize and AutoSizeColLabelSize: + // If col equals to wxGRID_AUTOSIZE value then function autosizes labels column + // instead of data column. Note that this operation may be slow for large + // tables. + // autosize row height depending on label text + void AutoSizeRowLabelSize( int row ); + + // autosize column width depending on label text + void AutoSizeColLabelSize( int col ); + + // column won't be resized to be lesser width - this must be called during + // the grid creation because it won't resize the column if it's already + // narrower than the minimal width + void SetColMinimalWidth( int col, int width ); + void SetRowMinimalHeight( int row, int width ); + + /* These members can be used to query and modify the minimal + * acceptable size of grid rows and columns. Call this function in + * your code which creates the grid if you want to display cells + * with a size smaller than the default acceptable minimum size. + * Like the members SetColMinimalWidth and SetRowMinimalWidth, + * the existing rows or columns will not be checked/resized. + */ + void SetColMinimalAcceptableWidth( int width ); + void SetRowMinimalAcceptableHeight( int width ); + int GetColMinimalAcceptableWidth() const; + int GetRowMinimalAcceptableHeight() const; + + void SetDefaultCellBackgroundColour( const wxColour& ); + void SetCellBackgroundColour( int row, int col, const wxColour& ); + void SetDefaultCellTextColour( const wxColour& ); + + void SetCellTextColour( int row, int col, const wxColour& ); + void SetDefaultCellFont( const wxFont& ); + void SetCellFont( int row, int col, const wxFont& ); + void SetDefaultCellAlignment( int horiz, int vert ); + void SetCellAlignment( int row, int col, int horiz, int vert ); + + void SetDefaultCellFitMode(wxGridFitMode fitMode); + void SetCellFitMode(int row, int col, wxGridFitMode fitMode); + void SetDefaultCellOverflow( bool allow ) + { SetDefaultCellFitMode(wxGridFitMode::FromOverflowFlag(allow)); } + void SetCellOverflow( int row, int col, bool allow ) + { SetCellFitMode(row, col, wxGridFitMode::FromOverflowFlag(allow)); } + + void SetCellSize( int row, int col, int num_rows, int num_cols ); + + // takes ownership of the pointer + void SetDefaultRenderer(wxGridCellRenderer *renderer); + void SetCellRenderer(int row, int col, wxGridCellRenderer *renderer); + wxGridCellRenderer *GetDefaultRenderer() const; + wxGridCellRenderer* GetCellRenderer(int row, int col) const; + + // takes ownership of the pointer + void SetDefaultEditor(wxGridCellEditor *editor); + void SetCellEditor(int row, int col, wxGridCellEditor *editor); + wxGridCellEditor *GetDefaultEditor() const; + wxGridCellEditor* GetCellEditor(int row, int col) const; + + + + // ------ cell value accessors + // + wxString GetCellValue( int row, int col ) const + { + if ( m_table ) + { + return m_table->GetValue( row, col ); + } + else + { + return wxEmptyString; + } + } + + wxString GetCellValue( const wxGridCellCoords& coords ) const + { return GetCellValue( coords.GetRow(), coords.GetCol() ); } + + void SetCellValue( int row, int col, const wxString& s ); + void SetCellValue( const wxGridCellCoords& coords, const wxString& s ) + { SetCellValue( coords.GetRow(), coords.GetCol(), s ); } + + // returns true if the cell can't be edited + bool IsReadOnly(int row, int col) const; + + // make the cell editable/readonly + void SetReadOnly(int row, int col, bool isReadOnly = true); + + // ------ select blocks of cells + // + void SelectRow( int row, bool addToSelected = false ); + void SelectCol( int col, bool addToSelected = false ); + + void SelectBlock( int topRow, int leftCol, int bottomRow, int rightCol, + bool addToSelected = false ); + + void SelectBlock( const wxGridCellCoords& topLeft, + const wxGridCellCoords& bottomRight, + bool addToSelected = false ) + { SelectBlock( topLeft.GetRow(), topLeft.GetCol(), + bottomRight.GetRow(), bottomRight.GetCol(), + addToSelected ); } + + void SelectAll(); + + bool IsSelection() const; + + // ------ deselect blocks or cells + // + void DeselectRow( int row ); + void DeselectCol( int col ); + void DeselectCell( int row, int col ); + + void ClearSelection(); + + bool IsInSelection( int row, int col ) const; + + bool IsInSelection( const wxGridCellCoords& coords ) const + { return IsInSelection( coords.GetRow(), coords.GetCol() ); } + + // Efficient methods returning the selected blocks (there are few of those). + wxGridBlocks GetSelectedBlocks() const; + wxGridBlockCoordsVector GetSelectedRowBlocks() const; + wxGridBlockCoordsVector GetSelectedColBlocks() const; + + // Less efficient (but maybe more convenient methods) returning all + // selected cells, rows or columns -- there can be many and many of those. + wxGridCellCoordsArray GetSelectedCells() const; + wxGridCellCoordsArray GetSelectionBlockTopLeft() const; + wxGridCellCoordsArray GetSelectionBlockBottomRight() const; + wxArrayInt GetSelectedRows() const; + wxArrayInt GetSelectedCols() const; + + // This function returns the rectangle that encloses the block of cells + // limited by TopLeft and BottomRight cell in device coords and clipped + // to the client size of the grid window. + // + wxRect BlockToDeviceRect( const wxGridCellCoords & topLeft, + const wxGridCellCoords & bottomRight, + const wxGridWindow *gridWindow = NULL) const; + + // Access or update the selection fore/back colours + wxColour GetSelectionBackground() const + { return m_selectionBackground; } + wxColour GetSelectionForeground() const + { return m_selectionForeground; } + + void SetSelectionBackground(const wxColour& c) { m_selectionBackground = c; } + void SetSelectionForeground(const wxColour& c) { m_selectionForeground = c; } + + + // Methods for a registry for mapping data types to Renderers/Editors + void RegisterDataType(const wxString& typeName, + wxGridCellRenderer* renderer, + wxGridCellEditor* editor); + // DJC MAPTEK + virtual wxGridCellEditor* GetDefaultEditorForCell(int row, int col) const; + wxGridCellEditor* GetDefaultEditorForCell(const wxGridCellCoords& c) const + { return GetDefaultEditorForCell(c.GetRow(), c.GetCol()); } + virtual wxGridCellRenderer* GetDefaultRendererForCell(int row, int col) const; + virtual wxGridCellEditor* GetDefaultEditorForType(const wxString& typeName) const; + virtual wxGridCellRenderer* GetDefaultRendererForType(const wxString& typeName) const; + + // grid may occupy more space than needed for its rows/columns, this + // function allows to set how big this extra space is + void SetMargins(int extraWidth, int extraHeight) + { + m_extraWidth = extraWidth; + m_extraHeight = extraHeight; + + CalcDimensions(); + } + + // Accessors for component windows + wxWindow* GetGridWindow() const { return (wxWindow*)m_gridWin; } + wxWindow* GetFrozenCornerGridWindow()const { return (wxWindow*)m_frozenCornerGridWin; } + wxWindow* GetFrozenRowGridWindow() const { return (wxWindow*)m_frozenRowGridWin; } + wxWindow* GetFrozenColGridWindow() const { return (wxWindow*)m_frozenColGridWin; } + wxWindow* GetGridRowLabelWindow() const { return (wxWindow*)m_rowLabelWin; } + wxWindow* GetGridColLabelWindow() const { return m_colLabelWin; } + wxWindow* GetGridCornerLabelWindow() const { return (wxWindow*)m_cornerLabelWin; } + + // Return true if native header is used by the grid. + bool IsUsingNativeHeader() const { return m_useNativeHeader; } + + // This one can only be called if we are using the native header window + wxHeaderCtrl *GetGridColHeader() const + { + wxASSERT_MSG( m_useNativeHeader, "no column header window" ); + + // static_cast<> doesn't work without the full class declaration in + // view and we prefer to avoid adding more compile-time dependencies + // even at the cost of using reinterpret_cast<> + return reinterpret_cast(m_colLabelWin); + } + + // Allow adjustment of scroll increment. The default is (15, 15). + void SetScrollLineX(int x) { m_xScrollPixelsPerLine = x; } + void SetScrollLineY(int y) { m_yScrollPixelsPerLine = y; } + int GetScrollLineX() const { return m_xScrollPixelsPerLine; } + int GetScrollLineY() const { return m_yScrollPixelsPerLine; } + + // ------- drag and drop +#if wxUSE_DRAG_AND_DROP + virtual void SetDropTarget(wxDropTarget *dropTarget) wxOVERRIDE; +#endif // wxUSE_DRAG_AND_DROP + + + // ------- sorting support + + // wxGrid doesn't support sorting on its own but it can indicate the sort + // order in the column header (currently only if native header control is + // used though) + + // return the column currently displaying the sort indicator or wxNOT_FOUND + // if none + int GetSortingColumn() const { return m_sortCol; } + + // return true if this column is currently used for sorting + bool IsSortingBy(int col) const { return GetSortingColumn() == col; } + + // return the current sorting order (on GetSortingColumn()): true for + // ascending sort and false for descending; it doesn't make sense to call + // it if GetSortingColumn() returns wxNOT_FOUND + bool IsSortOrderAscending() const { return m_sortIsAscending; } + + // set the sorting column (or unsets any existing one if wxNOT_FOUND) and + // the order in which to sort + void SetSortingColumn(int col, bool ascending = true); + + // unset any existing sorting column + void UnsetSortingColumn() { SetSortingColumn(wxNOT_FOUND); } + +#if WXWIN_COMPATIBILITY_2_8 + // ------ For compatibility with previous wxGrid only... + // + // ************************************************ + // ** Don't use these in new code because they ** + // ** are liable to disappear in a future ** + // ** revision ** + // ************************************************ + // + + wxGrid( wxWindow *parent, + int x, int y, int w = wxDefaultCoord, int h = wxDefaultCoord, + long style = wxWANTS_CHARS, + const wxString& name = wxASCII_STR(wxPanelNameStr) ) + { + Init(); + Create(parent, wxID_ANY, wxPoint(x, y), wxSize(w, h), style, name); + } + + void SetCellValue( const wxString& val, int row, int col ) + { SetCellValue( row, col, val ); } + + void UpdateDimensions() + { CalcDimensions(); } + + int GetRows() const { return GetNumberRows(); } + int GetCols() const { return GetNumberCols(); } + int GetCursorRow() const { return GetGridCursorRow(); } + int GetCursorColumn() const { return GetGridCursorCol(); } + + int GetScrollPosX() const { return 0; } + int GetScrollPosY() const { return 0; } + + void SetScrollX( int WXUNUSED(x) ) { } + void SetScrollY( int WXUNUSED(y) ) { } + + void SetColumnWidth( int col, int width ) + { SetColSize( col, width ); } + + int GetColumnWidth( int col ) const + { return GetColSize( col ); } + + void SetRowHeight( int row, int height ) + { SetRowSize( row, height ); } + + // GetRowHeight() is below + + int GetViewHeight() const // returned num whole rows visible + { return 0; } + + int GetViewWidth() const // returned num whole cols visible + { return 0; } + + void SetLabelSize( int orientation, int sz ) + { + if ( orientation == wxHORIZONTAL ) + SetColLabelSize( sz ); + else + SetRowLabelSize( sz ); + } + + int GetLabelSize( int orientation ) const + { + if ( orientation == wxHORIZONTAL ) + return GetColLabelSize(); + else + return GetRowLabelSize(); + } + + void SetLabelAlignment( int orientation, int align ) + { + if ( orientation == wxHORIZONTAL ) + SetColLabelAlignment( align, wxALIGN_INVALID ); + else + SetRowLabelAlignment( align, wxALIGN_INVALID ); + } + + int GetLabelAlignment( int orientation, int WXUNUSED(align) ) const + { + int h, v; + if ( orientation == wxHORIZONTAL ) + { + GetColLabelAlignment( &h, &v ); + return h; + } + else + { + GetRowLabelAlignment( &h, &v ); + return h; + } + } + + void SetLabelValue( int orientation, const wxString& val, int pos ) + { + if ( orientation == wxHORIZONTAL ) + SetColLabelValue( pos, val ); + else + SetRowLabelValue( pos, val ); + } + + wxString GetLabelValue( int orientation, int pos) const + { + if ( orientation == wxHORIZONTAL ) + return GetColLabelValue( pos ); + else + return GetRowLabelValue( pos ); + } + + wxFont GetCellTextFont() const + { return m_defaultCellAttr->GetFont(); } + + wxFont GetCellTextFont(int WXUNUSED(row), int WXUNUSED(col)) const + { return m_defaultCellAttr->GetFont(); } + + void SetCellTextFont(const wxFont& fnt) + { SetDefaultCellFont( fnt ); } + + void SetCellTextFont(const wxFont& fnt, int row, int col) + { SetCellFont( row, col, fnt ); } + + void SetCellTextColour(const wxColour& val, int row, int col) + { SetCellTextColour( row, col, val ); } + + void SetCellTextColour(const wxColour& col) + { SetDefaultCellTextColour( col ); } + + void SetCellBackgroundColour(const wxColour& col) + { SetDefaultCellBackgroundColour( col ); } + + void SetCellBackgroundColour(const wxColour& colour, int row, int col) + { SetCellBackgroundColour( row, col, colour ); } + + bool GetEditable() const { return IsEditable(); } + void SetEditable( bool edit = true ) { EnableEditing( edit ); } + bool GetEditInPlace() const { return IsCellEditControlEnabled(); } + + void SetEditInPlace(bool WXUNUSED(edit) = true) { } + + void SetCellAlignment( int align, int row, int col) + { SetCellAlignment(row, col, align, wxALIGN_CENTER); } + void SetCellAlignment( int WXUNUSED(align) ) {} + void SetCellBitmap(wxBitmap *WXUNUSED(bitmap), int WXUNUSED(row), int WXUNUSED(col)) + { } + void SetDividerPen(const wxPen& WXUNUSED(pen)) { } + wxPen& GetDividerPen() const; + void OnActivate(bool WXUNUSED(active)) {} + + // ******** End of compatibility functions ********** + + + + // ------ control IDs + enum { wxGRID_CELLCTRL = 2000, + wxGRID_TOPCTRL }; + + // ------ control types + enum { wxGRID_TEXTCTRL = 2100, + wxGRID_CHECKBOX, + wxGRID_CHOICE, + wxGRID_COMBOBOX }; + + wxDEPRECATED_INLINE(bool CanDragRowSize() const, return m_canDragRowSize; ) + wxDEPRECATED_INLINE(bool CanDragColSize() const, return m_canDragColSize; ) +#endif // WXWIN_COMPATIBILITY_2_8 + + + // override some base class functions + virtual void Fit() wxOVERRIDE; + virtual void SetFocus() wxOVERRIDE; + + // implementation only + void CancelMouseCapture(); + +protected: + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual void DoEnable(bool enable) wxOVERRIDE; + + bool m_created; + + wxGridWindow *m_gridWin; + wxGridWindow *m_frozenColGridWin; + wxGridWindow *m_frozenRowGridWin; + wxGridWindow *m_frozenCornerGridWin; + wxGridCornerLabelWindow *m_cornerLabelWin; + wxGridRowLabelWindow *m_rowLabelWin; + wxGridRowLabelWindow *m_rowFrozenLabelWin; + + // the real type of the column window depends on m_useNativeHeader value: + // if it is true, its dynamic type is wxHeaderCtrl, otherwise it is + // wxGridColLabelWindow, use accessors below when the real type matters + wxWindow *m_colLabelWin; + wxWindow *m_colFrozenLabelWin; + + wxGridColLabelWindow *GetColLabelWindow() const + { + wxASSERT_MSG( !m_useNativeHeader, "no column label window" ); + + return reinterpret_cast(m_colLabelWin); + } + + wxGridTableBase *m_table; + bool m_ownTable; + + int m_numRows; + int m_numCols; + + // Number of frozen rows/columns in the beginning of the grid, 0 if none. + int m_numFrozenRows; + int m_numFrozenCols; + + wxGridCellCoords m_currentCellCoords; + + // the corners of the block being currently selected or wxGridNoCellCoords + wxGridCellCoords m_selectedBlockTopLeft; + wxGridCellCoords m_selectedBlockBottomRight; + + // when selecting blocks of cells (either from the keyboard using Shift + // with cursor keys, or by dragging the mouse), the selection is anchored + // at m_currentCellCoords which defines one of the corners of the rectangle + // being selected -- and this variable defines the other corner, i.e. it's + // either m_selectedBlockTopLeft or m_selectedBlockBottomRight depending on + // which of them is not m_currentCellCoords + // + // if no block selection is in process, it is set to wxGridNoCellCoords + wxGridCellCoords m_selectedBlockCorner; + + wxGridSelection *m_selection; + + wxColour m_selectionBackground; + wxColour m_selectionForeground; + + // NB: *never* access m_row/col arrays directly because they are created + // on demand, *always* use accessor functions instead! + + // init the m_rowHeights/Bottoms arrays with default values + void InitRowHeights(); + + int m_defaultRowHeight; + int m_minAcceptableRowHeight; + wxArrayInt m_rowHeights; + wxArrayInt m_rowBottoms; + + // init the m_colWidths/Rights arrays + void InitColWidths(); + + int m_defaultColWidth; + int m_minAcceptableColWidth; + wxArrayInt m_colWidths; + wxArrayInt m_colRights; + + int m_sortCol; + bool m_sortIsAscending; + + bool m_useNativeHeader, + m_nativeColumnLabels; + + // get the col/row coords + int GetColWidth(int col) const; + int GetColLeft(int col) const; + int GetColRight(int col) const; + + // this function must be public for compatibility... +public: + int GetRowHeight(int row) const; +protected: + + int GetRowTop(int row) const; + int GetRowBottom(int row) const; + + int m_rowLabelWidth; + int m_colLabelHeight; + + // the size of the margin left to the right and bottom of the cell area + int m_extraWidth, + m_extraHeight; + + wxColour m_labelBackgroundColour; + wxColour m_labelTextColour; + wxFont m_labelFont; + + int m_rowLabelHorizAlign; + int m_rowLabelVertAlign; + int m_colLabelHorizAlign; + int m_colLabelVertAlign; + int m_colLabelTextOrientation; + int m_cornerLabelHorizAlign; + int m_cornerLabelVertAlign; + int m_cornerLabelTextOrientation; + + bool m_defaultRowLabelValues; + bool m_defaultColLabelValues; + + wxColour m_gridLineColour; + bool m_gridLinesEnabled; + bool m_gridLinesClipHorz, + m_gridLinesClipVert; + wxColour m_cellHighlightColour; + int m_cellHighlightPenWidth; + int m_cellHighlightROPenWidth; + wxColour m_gridFrozenBorderColour; + int m_gridFrozenBorderPenWidth; + + // common part of AutoSizeColumn/Row() + void AutoSizeColOrRow(int n, bool setAsMin, wxGridDirection direction); + + // Calculate the minimum acceptable size for labels area + wxCoord CalcColOrRowLabelAreaMinSize(wxGridDirection direction); + + // if a column has a minimal width, it will be the value for it in this + // hash table + wxLongToLongHashMap m_colMinWidths, + m_rowMinHeights; + + // get the minimal width of the given column/row + int GetColMinimalWidth(int col) const; + int GetRowMinimalHeight(int col) const; + + // do we have some place to store attributes in? + bool CanHaveAttributes() const; + + // cell attribute cache (currently we only cache 1, may be will do + // more/better later) + struct CachedAttr + { + int row, col; + wxGridCellAttr *attr; + } m_attrCache; + + // invalidates the attribute cache + void ClearAttrCache(); + + // adds an attribute to cache + void CacheAttr(int row, int col, wxGridCellAttr *attr) const; + + // looks for an attr in cache, returns true if found + bool LookupAttr(int row, int col, wxGridCellAttr **attr) const; + + // looks for the attr in cache, if not found asks the table and caches the + // result + wxGridCellAttr *GetCellAttr(int row, int col) const; + wxGridCellAttr *GetCellAttr(const wxGridCellCoords& coords ) const + { return GetCellAttr( coords.GetRow(), coords.GetCol() ); } + + wxGridCellAttrPtr GetCellAttrPtr(int row, int col) const + { + return wxGridCellAttrPtr(GetCellAttr(row, col)); + } + wxGridCellAttrPtr GetCellAttrPtr(const wxGridCellCoords& coords) const + { + return wxGridCellAttrPtr(GetCellAttr(coords)); + } + + + // the default cell attr object for cells that don't have their own + wxGridCellAttr* m_defaultCellAttr; + + + int m_batchCount; + + + wxGridTypeRegistry* m_typeRegistry; + + enum CursorMode + { + WXGRID_CURSOR_SELECT_CELL, + WXGRID_CURSOR_RESIZE_ROW, + WXGRID_CURSOR_RESIZE_COL, + WXGRID_CURSOR_SELECT_ROW, + WXGRID_CURSOR_SELECT_COL, + WXGRID_CURSOR_MOVE_ROW, + WXGRID_CURSOR_MOVE_COL + }; + + // this method not only sets m_cursorMode but also sets the correct cursor + // for the given mode and, if captureMouse is not false releases the mouse + // if it was captured and captures it if it must be captured + // + // for this to work, you should always use it and not set m_cursorMode + // directly! + void ChangeCursorMode(CursorMode mode, + wxWindow *win = NULL, + bool captureMouse = true); + + wxWindow *m_winCapture; // the window which captured the mouse + + // this variable is used not for finding the correct current cursor but + // mainly for finding out what is going to happen if the mouse starts being + // dragged right now + // + // by default it is WXGRID_CURSOR_SELECT_CELL meaning that nothing else is + // going on, and it is set to one of RESIZE/SELECT/MOVE values while the + // corresponding operation will be started if the user starts dragging the + // mouse from the current position + CursorMode m_cursorMode; + + + //Row positions + wxArrayInt m_rowAt; + + //Column positions + wxArrayInt m_colAt; + + bool m_canDragRowSize; + bool m_canDragColSize; + bool m_canDragRowMove; + bool m_canDragColMove; + bool m_canHideColumns; + bool m_canDragGridSize; + bool m_canDragCell; + + // Index of the row or column being drag-moved or -1 if there is no move + // operation in progress. + int m_dragMoveRowOrCol; + + // Last drag marker position while drag-moving a row or column. + int m_dragLastPos; + + // Last drag marker colour while drag-moving a row or column. + const wxColour *m_dragLastColour; + + // Row or column (depending on m_cursorMode value) currently being resized + // or -1 if there is no resize operation in progress. + int m_dragRowOrCol; + + // Original row or column size when resizing; used when the user cancels + int m_dragRowOrColOldSize; + + // true if a drag operation is in progress; when this is true, + // m_startDragPos is valid, i.e. not wxDefaultPosition + bool m_isDragging; + + // true if a drag operation was canceled + // (mouse event Dragging() might still be active until LeftUp) + // m_isDragging can only be set after m_cancelledDragging is cleared. + // This is done when a mouse event happens with left button up. + bool m_cancelledDragging; + + // the position (in physical coordinates) where the user started dragging + // the mouse or wxDefaultPosition if mouse isn't being dragged + // + // notice that this can be != wxDefaultPosition while m_isDragging is still + // false because we wait until the mouse is moved some distance away before + // setting m_isDragging to true + wxPoint m_startDragPos; + + // the position of the last mouse event + // used for detection of the movement direction + wxPoint m_lastMousePos; + + bool m_waitForSlowClick; + + wxCursor m_rowResizeCursor; + wxCursor m_colResizeCursor; + + bool m_editable; // applies to whole grid + bool m_cellEditCtrlEnabled; // is in-place edit currently shown? + + TabBehaviour m_tabBehaviour; // determines how the TAB key behaves + + void Init(); // common part of all ctors + void Create(); + void CreateColumnWindow(); + void CalcDimensions(); + void CalcWindowSizes(); + bool Redimension( wxGridTableMessage& ); + + + enum EventResult + { + Event_Vetoed = -1, + Event_Unhandled, + Event_Handled, + Event_CellDeleted // Event handler deleted the cell. + }; + + // Send the given grid event and returns one of the event handling results + // defined above. + EventResult DoSendEvent(wxGridEvent& gridEvt); + + // Generate an event of the given type and call DoSendEvent(). + EventResult SendEvent(wxEventType evtType, + int row, int col, + const wxMouseEvent& e); + EventResult SendEvent(wxEventType evtType, + const wxGridCellCoords& coords, + const wxMouseEvent& e) + { return SendEvent(evtType, coords.GetRow(), coords.GetCol(), e); } + EventResult SendEvent(wxEventType evtType, + int row, int col, + const wxString& s = wxString()); + EventResult SendEvent(wxEventType evtType, + const wxGridCellCoords& coords, + const wxString& s = wxString()) + { return SendEvent(evtType, coords.GetRow(), coords.GetCol(), s); } + EventResult SendEvent(wxEventType evtType, const wxString& s = wxString()) + { return SendEvent(evtType, m_currentCellCoords, s); } + + // send wxEVT_GRID_{ROW,COL}_SIZE or wxEVT_GRID_{ROW,COL}_AUTO_SIZE, return true + // if the event was processed, false otherwise + bool SendGridSizeEvent(wxEventType type, + int rowOrCol, + const wxMouseEvent& mouseEv); + + void OnSize( wxSizeEvent& ); + void OnKeyDown( wxKeyEvent& ); + void OnKeyUp( wxKeyEvent& ); + void OnChar( wxKeyEvent& ); + + + bool SetCurrentCell( const wxGridCellCoords& coords ); + bool SetCurrentCell( int row, int col ) + { return SetCurrentCell( wxGridCellCoords(row, col) ); } + + + virtual bool ShouldScrollToChildOnFocus(wxWindow* WXUNUSED(win)) wxOVERRIDE + { return false; } + + friend class WXDLLIMPEXP_FWD_CORE wxGridSelection; + friend class wxGridOperations; + friend class wxGridRowOperations; + friend class wxGridColumnOperations; + + // they call our private Process{{Corner,Col,Row}Label,GridCell}MouseEvent() + friend class wxGridCornerLabelWindow; + friend class wxGridColLabelWindow; + friend class wxGridRowLabelWindow; + friend class wxGridWindow; + friend class wxGridHeaderRenderer; + + friend class wxGridHeaderColumn; + friend class wxGridHeaderCtrl; + +private: + // This is called from both Create() and OnDPIChanged() to (re)initialize + // the values in pixels, which depend on the current DPI. + void InitPixelFields(); + + // Event handler for DPI change event recomputes pixel values and relays + // out the grid. + void OnDPIChanged(wxDPIChangedEvent& event); + + // implement wxScrolledCanvas method to return m_gridWin size + virtual wxSize GetSizeAvailableForScrollTarget(const wxSize& size) wxOVERRIDE; + + // depending on the values of m_numFrozenRows and m_numFrozenCols, it will + // create and initialize or delete the frozen windows + void InitializeFrozenWindows(); + + // redraw the grid lines, should be called after changing their attributes + void RedrawGridLines(); + + // draw all grid lines in the given cell region (unlike the public + // DrawAllGridLines() which just draws all of them) + void DrawRangeGridLines(wxDC& dc, const wxRegion& reg, + const wxGridCellCoords& topLeft, + const wxGridCellCoords& bottomRight); + + // draw all lines from top to bottom row and left to right column in the + // rectangle determined by (top, left)-(bottom, right) -- but notice that + // the caller must have set up the clipping correctly, this rectangle is + // only used here for optimization + void DoDrawGridLines(wxDC& dc, + int top, int left, + int bottom, int right, + int topRow, int leftCol, + int bottomRight, int rightCol); + + // common part of Clip{Horz,Vert}GridLines + void DoClipGridLines(bool& var, bool clip); + + // Redimension() helper: update m_currentCellCoords if necessary after a + // grid size change + void UpdateCurrentCellOnRedim(); + + // update the sorting indicator shown in the specified column (whose index + // must be valid) + // + // this will use GetSortingColumn() and IsSortOrderAscending() to determine + // the sorting indicator to effectively show + void UpdateColumnSortingIndicator(int col); + + // update the grid after changing the rows or columns order (common part + // of Set{Row,Col}Pos() and Reset{Row,Col}Pos()) + void RefreshAfterRowPosChange(); + void RefreshAfterColPosChange(); + + // reset the variables used during dragging operations after it ended, + // either because we called EndDraggingIfNecessary() ourselves or because + // we lost mouse capture + void DoAfterDraggingEnd(); + + // release the mouse capture if it's currently captured + void EndDraggingIfNecessary(); + + // helper for Process...MouseEvent to block re-triggering m_isDragging + bool CheckIfDragCancelled(wxMouseEvent *event); + + // helper for Process...MouseEvent to scroll + void CheckDoDragScroll(wxGridSubwindow *eventGridWindow, wxGridSubwindow *gridWindow, + wxPoint posEvent, int direction); + + // helper for Process...LabelMouseEvent to check whether a drag operation + // would end at the source line, i.e. have no effect + bool CheckIfAtDragSourceLine(const wxGridOperations &oper, int coord); + + // return true if the grid should be refreshed right now + bool ShouldRefresh() const + { + return !GetBatchCount() && IsShownOnScreen(); + } + + + // return the position (not index) of the row or column at the given logical + // pixel position + // + // this always returns a valid position, even if the coordinate is out of + // bounds (in which case first/last row/column is returned) + int YToPos(int y, wxGridWindow *gridWindow) const; + int XToPos(int x, wxGridWindow *gridWindow) const; + + // event handlers and their helpers + // -------------------------------- + + // process mouse drag event in WXGRID_CURSOR_SELECT_CELL mode + bool DoGridCellDrag(wxMouseEvent& event, + const wxGridCellCoords& coords, + bool isFirstDrag); + + // process mouse drag event in the grid window, return false if starting + // dragging was vetoed by the user-defined wxEVT_GRID_CELL_BEGIN_DRAG + // handler + bool DoGridDragEvent(wxMouseEvent& event, + const wxGridCellCoords& coords, + bool isFirstDrag, + wxGridWindow* gridWindow); + + // Update the width/height of the column/row being drag-resized. + // Should be only called when m_dragRowOrCol != -1, i.e. dragging is + // actually in progress. + void DoGridDragResize(const wxPoint& position, + const wxGridOperations& oper, + wxGridWindow* gridWindow); + + // process different clicks on grid cells + void DoGridCellLeftDown(wxMouseEvent& event, + const wxGridCellCoords& coords, + const wxPoint& pos); + void DoGridCellLeftDClick(wxMouseEvent& event, + const wxGridCellCoords& coords, + const wxPoint& pos); + void DoGridCellLeftUp(wxMouseEvent& event, + const wxGridCellCoords& coords, + wxGridWindow* gridWindow); + + // process movement (but not dragging) event in the grid cell area + void DoGridMouseMoveEvent(wxMouseEvent& event, + const wxGridCellCoords& coords, + const wxPoint& pos, + wxGridWindow* gridWindow); + + // process mouse events in the grid window + void ProcessGridCellMouseEvent(wxMouseEvent& event, wxGridWindow* gridWindow); + + // process mouse events in the row/column labels/corner windows + void ProcessRowColLabelMouseEvent(const wxGridOperations &oper, + wxMouseEvent& event, + wxGridSubwindow* rowLabelWin); + void ProcessCornerLabelMouseEvent(wxMouseEvent& event); + + void HandleRowAutosize(int col, const wxMouseEvent& event); + void HandleColumnAutosize(int col, const wxMouseEvent& event); + + void DoColHeaderClick(int col); + + void DoStartResizeRowOrCol(int col, int size); + void DoStartMoveRowOrCol(int col); + + // These functions should only be called when actually resizing/moving, + // i.e. m_dragRowOrCol and m_dragMoveCol, respectively, are valid. + void DoEndDragResizeRow(const wxMouseEvent& event, wxGridWindow *gridWindow); + void DoEndDragResizeCol(const wxMouseEvent& event, wxGridWindow *gridWindow); + void DoEndMoveRow(int pos); + void DoEndMoveCol(int pos); + + // Helper function returning the position (only the horizontal component + // really counts) corresponding to the given column drag-resize event. + // + // It's a bit ugly to create a phantom mouse position when we really only + // need the column width anyhow, but wxGrid code was originally written to + // expect the position and not the width and it's simpler to keep it happy + // by giving it the position than to change it. + wxPoint GetPositionForResizeEvent(int width) const; + + // functions called by wxGridHeaderCtrl while resizing m_dragRowOrCol + void DoHeaderStartDragResizeCol(int col); + void DoHeaderDragResizeCol(int width); + void DoHeaderEndDragResizeCol(int width); + + // process a TAB keypress + void DoGridProcessTab(wxKeyboardState& kbdState); + + // common implementations of methods defined for both rows and columns + int PosToLinePos(int pos, bool clipToMinMax, + const wxGridOperations& oper, + wxGridWindow *gridWindow) const; + int PosToLine(int pos, bool clipToMinMax, + const wxGridOperations& oper, + wxGridWindow *gridWindow) const; + int PosToEdgeOfLine(int pos, const wxGridOperations& oper) const; + + void DoMoveCursorFromKeyboard(const wxKeyboardState& kbdState, + const wxGridDirectionOperations& diroper); + bool DoMoveCursor(const wxKeyboardState& kbdState, + const wxGridDirectionOperations& diroper); + bool DoMoveCursorByPage(const wxKeyboardState& kbdState, + const wxGridDirectionOperations& diroper); + bool AdvanceByPage(wxGridCellCoords& coords, + const wxGridDirectionOperations& diroper); + bool DoMoveCursorByBlock(const wxKeyboardState& kbdState, + const wxGridDirectionOperations& diroper); + void AdvanceToNextNonEmpty(wxGridCellCoords& coords, + const wxGridDirectionOperations& diroper); + bool AdvanceByBlock(wxGridCellCoords& coords, + const wxGridDirectionOperations& diroper); + + // common part of {Insert,Delete}{Rows,Cols} + bool DoModifyLines(bool (wxGridTableBase::*funcModify)(size_t, size_t), + int pos, int num, bool updateLabels); + // Append{Rows,Cols} is a bit different because of one less parameter + bool DoAppendLines(bool (wxGridTableBase::*funcAppend)(size_t), + int num, bool updateLabels); + + // common part of Set{Col,Row}Sizes + void DoSetSizes(const wxGridSizesInfo& sizeInfo, + const wxGridOperations& oper); + + // common part of Disable{Row,Col}Resize and CanDrag{Row,Col}Size + void DoDisableLineResize(int line, wxGridFixedIndicesSet *& setFixed); + bool DoCanResizeLine(int line, const wxGridFixedIndicesSet *setFixed) const; + + // Helper of Render(): get grid size, origin offset and fill cell arrays + void GetRenderSizes( const wxGridCellCoords& topLeft, + const wxGridCellCoords& bottomRight, + wxPoint& pointOffSet, wxSize& sizeGrid, + wxGridCellCoordsArray& renderCells, + wxArrayInt& arrayCols, wxArrayInt& arrayRows ) const; + + // Helper of Render(): set the scale to draw the cells at the right size. + void SetRenderScale( wxDC& dc, const wxPoint& pos, const wxSize& size, + const wxSize& sizeGrid ); + + // Helper of Render(): get render start position from passed parameter + wxPoint GetRenderPosition( wxDC& dc, const wxPoint& position ); + + // Helper of Render(): draws a box around the rendered area + void DoRenderBox( wxDC& dc, const int& style, + const wxPoint& pointOffSet, + const wxSize& sizeCellArea, + const wxGridCellCoords& topLeft, + const wxGridCellCoords& bottomRight ); + + // Implementation of public Set{Row,Col}Size() and {Hide,Show}{Row,Col}(). + // They interpret their height or width parameter slightly different from + // the public methods where -1 in it means "auto fit to the label" for the + // compatibility reasons. Here it means "show a previously hidden row or + // column" while 0 means "hide it" just as in the public methods. And any + // positive values are handled naturally, i.e. they just specify the size. + void DoSetRowSize( int row, int height ); + void DoSetColSize( int col, int width ); + + // These methods can only be called when m_useNativeHeader is true and call + // SetColumnCount() and Set- or ResetColumnsOrder() as necessary on the + // native wxHeaderCtrl being used. Note that the first one already calls + // the second one, so it's never necessary to call both of them. + void SetNativeHeaderColCount(); + void SetNativeHeaderColOrder(); + + // Return the editor which should be used for the current cell. + wxGridCellEditorPtr GetCurrentCellEditorPtr() const + { + return GetCellAttrPtr(m_currentCellCoords)->GetEditorPtr + ( + this, + m_currentCellCoords.GetRow(), + m_currentCellCoords.GetCol() + ); + } + + // Show/hide the cell editor for the current cell unconditionally. + + // Return false if the editor was activated instead of being shown and also + // sets m_cellEditCtrlEnabled to true when it returns true as a side effect. + bool DoShowCellEditControl(const wxGridActivationSource& actSource); + void DoHideCellEditControl(); + + // Unconditionally try showing the editor for the current cell. + // + // Returns false if the user code vetoed wxEVT_GRID_EDITOR_SHOWN or if the + // editor was simply activated and won't be permanently shown. + bool DoEnableCellEditControl(const wxGridActivationSource& actSource); + + // Unconditionally disable (accepting the changes) the editor. + void DoDisableCellEditControl(); + + // Accept the changes in the edit control, i.e. save them to the table and + // dismiss the editor. Also reset m_cellEditCtrlEnabled. + void DoAcceptCellEditControl(); + + // As above, but do nothing if the control is not currently shown. + void AcceptCellEditControlIfShown(); + + // Unlike the public SaveEditControlValue(), this method doesn't check if + // the edit control is shown, but just supposes that it is. + void DoSaveEditControlValue(); + + // these sets contain the indices of fixed, i.e. non-resizable + // interactively, grid rows or columns and are NULL if there are no fixed + // elements (which is the default) + wxGridFixedIndicesSet *m_setFixedRows, + *m_setFixedCols; + + wxDECLARE_DYNAMIC_CLASS(wxGrid); + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxGrid); +}; + +// ---------------------------------------------------------------------------- +// wxGridUpdateLocker prevents updates to a grid during its lifetime +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGridUpdateLocker +{ +public: + // if the pointer is NULL, Create() can be called later + wxGridUpdateLocker(wxGrid *grid = NULL) + { + Init(grid); + } + + // can be called if ctor was used with a NULL pointer, must not be called + // more than once + void Create(wxGrid *grid) + { + wxASSERT_MSG( !m_grid, wxT("shouldn't be called more than once") ); + + Init(grid); + } + + ~wxGridUpdateLocker() + { + if ( m_grid ) + m_grid->EndBatch(); + } + +private: + void Init(wxGrid *grid) + { + m_grid = grid; + if ( m_grid ) + m_grid->BeginBatch(); + } + + wxGrid *m_grid; + + wxDECLARE_NO_COPY_CLASS(wxGridUpdateLocker); +}; + +// ---------------------------------------------------------------------------- +// Grid event class and event types +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGridEvent : public wxNotifyEvent, + public wxKeyboardState +{ +public: + wxGridEvent() + : wxNotifyEvent() + { + Init(-1, -1, -1, -1, false); + } + + wxGridEvent(int id, + wxEventType type, + wxObject* obj, + int row = -1, int col = -1, + int x = -1, int y = -1, + bool sel = true, + const wxKeyboardState& kbd = wxKeyboardState()) + : wxNotifyEvent(type, id), + wxKeyboardState(kbd) + { + Init(row, col, x, y, sel); + SetEventObject(obj); + } + + // explicitly specifying inline allows gcc < 3.4 to + // handle the deprecation attribute even in the constructor. + wxDEPRECATED_CONSTRUCTOR( + wxGridEvent(int id, + wxEventType type, + wxObject* obj, + int row, int col, + int x, int y, + bool sel, + bool control, + bool shift = false, bool alt = false, bool meta = false)); + + int GetRow() const { return m_row; } + int GetCol() const { return m_col; } + wxPoint GetPosition() const { return wxPoint( m_x, m_y ); } + bool Selecting() const { return m_selecting; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxGridEvent(*this); } + +protected: + int m_row; + int m_col; + int m_x; + int m_y; + bool m_selecting; + +private: + void Init(int row, int col, int x, int y, bool sel) + { + m_row = row; + m_col = col; + m_x = x; + m_y = y; + m_selecting = sel; + } + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxGridEvent); +}; + +class WXDLLIMPEXP_CORE wxGridSizeEvent : public wxNotifyEvent, + public wxKeyboardState +{ +public: + wxGridSizeEvent() + : wxNotifyEvent() + { + Init(-1, -1, -1); + } + + wxGridSizeEvent(int id, + wxEventType type, + wxObject* obj, + int rowOrCol = -1, + int x = -1, int y = -1, + const wxKeyboardState& kbd = wxKeyboardState()) + : wxNotifyEvent(type, id), + wxKeyboardState(kbd) + { + Init(rowOrCol, x, y); + + SetEventObject(obj); + } + + wxDEPRECATED_CONSTRUCTOR( + wxGridSizeEvent(int id, + wxEventType type, + wxObject* obj, + int rowOrCol, + int x, int y, + bool control, + bool shift = false, + bool alt = false, + bool meta = false) ); + + int GetRowOrCol() const { return m_rowOrCol; } + wxPoint GetPosition() const { return wxPoint( m_x, m_y ); } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxGridSizeEvent(*this); } + +protected: + int m_rowOrCol; + int m_x; + int m_y; + +private: + void Init(int rowOrCol, int x, int y) + { + m_rowOrCol = rowOrCol; + m_x = x; + m_y = y; + } + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxGridSizeEvent); +}; + + +class WXDLLIMPEXP_CORE wxGridRangeSelectEvent : public wxNotifyEvent, + public wxKeyboardState +{ +public: + wxGridRangeSelectEvent() + : wxNotifyEvent() + { + Init(wxGridNoCellCoords, wxGridNoCellCoords, false); + } + + wxGridRangeSelectEvent(int id, + wxEventType type, + wxObject* obj, + const wxGridCellCoords& topLeft, + const wxGridCellCoords& bottomRight, + bool sel = true, + const wxKeyboardState& kbd = wxKeyboardState()) + : wxNotifyEvent(type, id), + wxKeyboardState(kbd) + { + Init(topLeft, bottomRight, sel); + + SetEventObject(obj); + } + + wxDEPRECATED_CONSTRUCTOR( + wxGridRangeSelectEvent(int id, + wxEventType type, + wxObject* obj, + const wxGridCellCoords& topLeft, + const wxGridCellCoords& bottomRight, + bool sel, + bool control, + bool shift = false, + bool alt = false, + bool meta = false) ); + + wxGridCellCoords GetTopLeftCoords() const { return m_topLeft; } + wxGridCellCoords GetBottomRightCoords() const { return m_bottomRight; } + int GetTopRow() const { return m_topLeft.GetRow(); } + int GetBottomRow() const { return m_bottomRight.GetRow(); } + int GetLeftCol() const { return m_topLeft.GetCol(); } + int GetRightCol() const { return m_bottomRight.GetCol(); } + bool Selecting() const { return m_selecting; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxGridRangeSelectEvent(*this); } + +protected: + void Init(const wxGridCellCoords& topLeft, + const wxGridCellCoords& bottomRight, + bool selecting) + { + m_topLeft = topLeft; + m_bottomRight = bottomRight; + m_selecting = selecting; + } + + wxGridCellCoords m_topLeft; + wxGridCellCoords m_bottomRight; + bool m_selecting; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxGridRangeSelectEvent); +}; + + +class WXDLLIMPEXP_CORE wxGridEditorCreatedEvent : public wxCommandEvent +{ +public: + wxGridEditorCreatedEvent() + : wxCommandEvent() + { + m_row = 0; + m_col = 0; + m_window = NULL; + } + + wxGridEditorCreatedEvent(int id, wxEventType type, wxObject* obj, + int row, int col, wxWindow* window); + + int GetRow() const { return m_row; } + int GetCol() const { return m_col; } + wxWindow* GetWindow() const { return m_window; } + void SetRow(int row) { m_row = row; } + void SetCol(int col) { m_col = col; } + void SetWindow(wxWindow* window) { m_window = window; } + + // These functions exist only for backward compatibility, use Get and + // SetWindow() instead in the new code. + wxControl* GetControl() { return wxDynamicCast(m_window, wxControl); } + void SetControl(wxControl* ctrl) { m_window = ctrl; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxGridEditorCreatedEvent(*this); } + +private: + int m_row; + int m_col; + wxWindow* m_window; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxGridEditorCreatedEvent); +}; + + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_CELL_LEFT_CLICK, wxGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_CELL_RIGHT_DCLICK, wxGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_LABEL_RIGHT_CLICK, wxGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_LABEL_LEFT_DCLICK, wxGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_LABEL_RIGHT_DCLICK, wxGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_ROW_SIZE, wxGridSizeEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_ROW_AUTO_SIZE, wxGridSizeEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_COL_SIZE, wxGridSizeEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_COL_AUTO_SIZE, wxGridSizeEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_RANGE_SELECTING, wxGridRangeSelectEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_RANGE_SELECTED, wxGridRangeSelectEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_CELL_CHANGING, wxGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_CELL_CHANGED, wxGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_SELECT_CELL, wxGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_EDITOR_SHOWN, wxGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_EDITOR_HIDDEN, wxGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_EDITOR_CREATED, wxGridEditorCreatedEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_CELL_BEGIN_DRAG, wxGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_ROW_MOVE, wxGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_COL_MOVE, wxGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_COL_SORT, wxGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_GRID_TABBING, wxGridEvent ); + +typedef void (wxEvtHandler::*wxGridEventFunction)(wxGridEvent&); +typedef void (wxEvtHandler::*wxGridSizeEventFunction)(wxGridSizeEvent&); +typedef void (wxEvtHandler::*wxGridRangeSelectEventFunction)(wxGridRangeSelectEvent&); +typedef void (wxEvtHandler::*wxGridEditorCreatedEventFunction)(wxGridEditorCreatedEvent&); + +#define wxGridEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxGridEventFunction, func) + +#define wxGridSizeEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxGridSizeEventFunction, func) + +#define wxGridRangeSelectEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxGridRangeSelectEventFunction, func) + +#define wxGridEditorCreatedEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxGridEditorCreatedEventFunction, func) + +#define wx__DECLARE_GRIDEVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_GRID_ ## evt, id, wxGridEventHandler(fn)) + +#define wx__DECLARE_GRIDSIZEEVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_GRID_ ## evt, id, wxGridSizeEventHandler(fn)) + +#define wx__DECLARE_GRIDRANGESELEVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_GRID_ ## evt, id, wxGridRangeSelectEventHandler(fn)) + +#define wx__DECLARE_GRIDEDITOREVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_GRID_ ## evt, id, wxGridEditorCreatedEventHandler(fn)) + +#define EVT_GRID_CMD_CELL_LEFT_CLICK(id, fn) wx__DECLARE_GRIDEVT(CELL_LEFT_CLICK, id, fn) +#define EVT_GRID_CMD_CELL_RIGHT_CLICK(id, fn) wx__DECLARE_GRIDEVT(CELL_RIGHT_CLICK, id, fn) +#define EVT_GRID_CMD_CELL_LEFT_DCLICK(id, fn) wx__DECLARE_GRIDEVT(CELL_LEFT_DCLICK, id, fn) +#define EVT_GRID_CMD_CELL_RIGHT_DCLICK(id, fn) wx__DECLARE_GRIDEVT(CELL_RIGHT_DCLICK, id, fn) +#define EVT_GRID_CMD_LABEL_LEFT_CLICK(id, fn) wx__DECLARE_GRIDEVT(LABEL_LEFT_CLICK, id, fn) +#define EVT_GRID_CMD_LABEL_RIGHT_CLICK(id, fn) wx__DECLARE_GRIDEVT(LABEL_RIGHT_CLICK, id, fn) +#define EVT_GRID_CMD_LABEL_LEFT_DCLICK(id, fn) wx__DECLARE_GRIDEVT(LABEL_LEFT_DCLICK, id, fn) +#define EVT_GRID_CMD_LABEL_RIGHT_DCLICK(id, fn) wx__DECLARE_GRIDEVT(LABEL_RIGHT_DCLICK, id, fn) +#define EVT_GRID_CMD_ROW_SIZE(id, fn) wx__DECLARE_GRIDSIZEEVT(ROW_SIZE, id, fn) +#define EVT_GRID_CMD_COL_SIZE(id, fn) wx__DECLARE_GRIDSIZEEVT(COL_SIZE, id, fn) +#define EVT_GRID_CMD_COL_AUTO_SIZE(id, fn) wx__DECLARE_GRIDSIZEEVT(COL_AUTO_SIZE, id, fn) +#define EVT_GRID_CMD_ROW_MOVE(id, fn) wx__DECLARE_GRIDEVT(ROW_MOVE, id, fn) +#define EVT_GRID_CMD_COL_MOVE(id, fn) wx__DECLARE_GRIDEVT(COL_MOVE, id, fn) +#define EVT_GRID_CMD_COL_SORT(id, fn) wx__DECLARE_GRIDEVT(COL_SORT, id, fn) +#define EVT_GRID_CMD_RANGE_SELECTING(id, fn) wx__DECLARE_GRIDRANGESELEVT(RANGE_SELECTING, id, fn) +#define EVT_GRID_CMD_RANGE_SELECTED(id, fn) wx__DECLARE_GRIDRANGESELEVT(RANGE_SELECTED, id, fn) +#define EVT_GRID_CMD_CELL_CHANGING(id, fn) wx__DECLARE_GRIDEVT(CELL_CHANGING, id, fn) +#define EVT_GRID_CMD_CELL_CHANGED(id, fn) wx__DECLARE_GRIDEVT(CELL_CHANGED, id, fn) +#define EVT_GRID_CMD_SELECT_CELL(id, fn) wx__DECLARE_GRIDEVT(SELECT_CELL, id, fn) +#define EVT_GRID_CMD_EDITOR_SHOWN(id, fn) wx__DECLARE_GRIDEVT(EDITOR_SHOWN, id, fn) +#define EVT_GRID_CMD_EDITOR_HIDDEN(id, fn) wx__DECLARE_GRIDEVT(EDITOR_HIDDEN, id, fn) +#define EVT_GRID_CMD_EDITOR_CREATED(id, fn) wx__DECLARE_GRIDEDITOREVT(EDITOR_CREATED, id, fn) +#define EVT_GRID_CMD_CELL_BEGIN_DRAG(id, fn) wx__DECLARE_GRIDEVT(CELL_BEGIN_DRAG, id, fn) +#define EVT_GRID_CMD_TABBING(id, fn) wx__DECLARE_GRIDEVT(TABBING, id, fn) + +// same as above but for any id (exists mainly for backwards compatibility but +// then it's also true that you rarely have multiple grid in the same window) +#define EVT_GRID_CELL_LEFT_CLICK(fn) EVT_GRID_CMD_CELL_LEFT_CLICK(wxID_ANY, fn) +#define EVT_GRID_CELL_RIGHT_CLICK(fn) EVT_GRID_CMD_CELL_RIGHT_CLICK(wxID_ANY, fn) +#define EVT_GRID_CELL_LEFT_DCLICK(fn) EVT_GRID_CMD_CELL_LEFT_DCLICK(wxID_ANY, fn) +#define EVT_GRID_CELL_RIGHT_DCLICK(fn) EVT_GRID_CMD_CELL_RIGHT_DCLICK(wxID_ANY, fn) +#define EVT_GRID_LABEL_LEFT_CLICK(fn) EVT_GRID_CMD_LABEL_LEFT_CLICK(wxID_ANY, fn) +#define EVT_GRID_LABEL_RIGHT_CLICK(fn) EVT_GRID_CMD_LABEL_RIGHT_CLICK(wxID_ANY, fn) +#define EVT_GRID_LABEL_LEFT_DCLICK(fn) EVT_GRID_CMD_LABEL_LEFT_DCLICK(wxID_ANY, fn) +#define EVT_GRID_LABEL_RIGHT_DCLICK(fn) EVT_GRID_CMD_LABEL_RIGHT_DCLICK(wxID_ANY, fn) +#define EVT_GRID_ROW_SIZE(fn) EVT_GRID_CMD_ROW_SIZE(wxID_ANY, fn) +#define EVT_GRID_COL_SIZE(fn) EVT_GRID_CMD_COL_SIZE(wxID_ANY, fn) +#define EVT_GRID_COL_AUTO_SIZE(fn) EVT_GRID_CMD_COL_AUTO_SIZE(wxID_ANY, fn) +#define EVT_GRID_ROW_MOVE(fn) EVT_GRID_CMD_ROW_MOVE(wxID_ANY, fn) +#define EVT_GRID_COL_MOVE(fn) EVT_GRID_CMD_COL_MOVE(wxID_ANY, fn) +#define EVT_GRID_COL_SORT(fn) EVT_GRID_CMD_COL_SORT(wxID_ANY, fn) +#define EVT_GRID_RANGE_SELECTING(fn) EVT_GRID_CMD_RANGE_SELECTING(wxID_ANY, fn) +#define EVT_GRID_RANGE_SELECTED(fn) EVT_GRID_CMD_RANGE_SELECTED(wxID_ANY, fn) +#define EVT_GRID_CELL_CHANGING(fn) EVT_GRID_CMD_CELL_CHANGING(wxID_ANY, fn) +#define EVT_GRID_CELL_CHANGED(fn) EVT_GRID_CMD_CELL_CHANGED(wxID_ANY, fn) +#define EVT_GRID_SELECT_CELL(fn) EVT_GRID_CMD_SELECT_CELL(wxID_ANY, fn) +#define EVT_GRID_EDITOR_SHOWN(fn) EVT_GRID_CMD_EDITOR_SHOWN(wxID_ANY, fn) +#define EVT_GRID_EDITOR_HIDDEN(fn) EVT_GRID_CMD_EDITOR_HIDDEN(wxID_ANY, fn) +#define EVT_GRID_EDITOR_CREATED(fn) EVT_GRID_CMD_EDITOR_CREATED(wxID_ANY, fn) +#define EVT_GRID_CELL_BEGIN_DRAG(fn) EVT_GRID_CMD_CELL_BEGIN_DRAG(wxID_ANY, fn) +#define EVT_GRID_TABBING(fn) EVT_GRID_CMD_TABBING(wxID_ANY, fn) + +// we used to have a single wxEVT_GRID_CELL_CHANGE event but it was split into +// wxEVT_GRID_CELL_CHANGING and CHANGED ones in wx 2.9.0, however the CHANGED +// is basically the same as the old CHANGE event so we keep the name for +// compatibility +#define wxEVT_GRID_CELL_CHANGE wxEVT_GRID_CELL_CHANGED + +#define EVT_GRID_CMD_CELL_CHANGE EVT_GRID_CMD_CELL_CHANGED +#define EVT_GRID_CELL_CHANGE EVT_GRID_CELL_CHANGED + +// same as above: RANGE_SELECT was split in RANGE_SELECTING and SELECTED in 3.2, +// but we keep the old name for compatibility +#define wxEVT_GRID_RANGE_SELECT wxEVT_GRID_RANGE_SELECTED + +#define EVT_GRID_CMD_RANGE_SELECT EVT_GRID_CMD_RANGE_SELECTED +#define EVT_GRID_RANGE_SELECT EVT_GRID_RANGE_SELECTED + + +#if 0 // TODO: implement these ? others ? + +extern const int wxEVT_GRID_CREATE_CELL; +extern const int wxEVT_GRID_CHANGE_LABELS; +extern const int wxEVT_GRID_CHANGE_SEL_LABEL; + +#define EVT_GRID_CREATE_CELL(fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CREATE_CELL, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ), +#define EVT_GRID_CHANGE_LABELS(fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CHANGE_LABELS, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ), +#define EVT_GRID_CHANGE_SEL_LABEL(fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CHANGE_SEL_LABEL, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ), + +#endif + +#endif // wxUSE_GRID +#endif // _WX_GENERIC_GRID_H_ diff --git a/lib/wxWidgets/include/wx/generic/gridctrl.h b/lib/wxWidgets/include/wx/generic/gridctrl.h new file mode 100644 index 0000000..1e61c4b --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/gridctrl.h @@ -0,0 +1,415 @@ +/////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/gridctrl.h +// Purpose: wxGrid controls +// Author: Paul Gammans, Roger Gammans +// Modified by: +// Created: 11/04/2001 +// Copyright: (c) The Computer Surgery (paul@compsurg.co.uk) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_GRIDCTRL_H_ +#define _WX_GENERIC_GRIDCTRL_H_ + +#include "wx/grid.h" + +#if wxUSE_GRID + +#define wxGRID_VALUE_CHOICEINT wxT("choiceint") +#define wxGRID_VALUE_DATETIME wxT("datetime") + + +// the default renderer for the cells containing string data +class WXDLLIMPEXP_ADV wxGridCellStringRenderer : public wxGridCellRenderer +{ +public: + wxGridCellStringRenderer() + : wxGridCellRenderer() + { + } + + wxGridCellStringRenderer(const wxGridCellStringRenderer& other) + : wxGridCellRenderer(other) + { + } + + // draw the string + virtual void Draw(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + const wxRect& rect, + int row, int col, + bool isSelected) wxOVERRIDE; + + // return the string extent + virtual wxSize GetBestSize(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col) wxOVERRIDE; + + virtual wxGridCellRenderer *Clone() const wxOVERRIDE + { return new wxGridCellStringRenderer(*this); } + +protected: + // calc the string extent for given string/font + wxSize DoGetBestSize(const wxGridCellAttr& attr, + wxDC& dc, + const wxString& text); +}; + +// the default renderer for the cells containing numeric (long) data +class WXDLLIMPEXP_ADV wxGridCellNumberRenderer : public wxGridCellStringRenderer +{ +public: + explicit wxGridCellNumberRenderer(long minValue = LONG_MIN, + long maxValue = LONG_MAX) + : wxGridCellStringRenderer(), + m_minValue(minValue), + m_maxValue(maxValue) + { + } + + wxGridCellNumberRenderer(const wxGridCellNumberRenderer& other) + : wxGridCellStringRenderer(other), + m_minValue(other.m_minValue), + m_maxValue(other.m_maxValue) + { + } + + // draw the string right aligned + virtual void Draw(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + const wxRect& rect, + int row, int col, + bool isSelected) wxOVERRIDE; + + virtual wxSize GetBestSize(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col) wxOVERRIDE; + + virtual wxSize GetMaxBestSize(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc) wxOVERRIDE; + + // Optional parameters for this renderer are ",". + virtual void SetParameters(const wxString& params) wxOVERRIDE; + + virtual wxGridCellRenderer *Clone() const wxOVERRIDE + { return new wxGridCellNumberRenderer(*this); } + +protected: + wxString GetString(const wxGrid& grid, int row, int col); + + long m_minValue, + m_maxValue; +}; + +class WXDLLIMPEXP_ADV wxGridCellFloatRenderer : public wxGridCellStringRenderer +{ +public: + wxGridCellFloatRenderer(int width = -1, + int precision = -1, + int format = wxGRID_FLOAT_FORMAT_DEFAULT); + + wxGridCellFloatRenderer(const wxGridCellFloatRenderer& other) + : wxGridCellStringRenderer(other), + m_width(other.m_width), + m_precision(other.m_precision), + m_style(other.m_style), + m_format(other.m_format) + { + } + + // get/change formatting parameters + int GetWidth() const { return m_width; } + void SetWidth(int width) { m_width = width; m_format.clear(); } + int GetPrecision() const { return m_precision; } + void SetPrecision(int precision) { m_precision = precision; m_format.clear(); } + int GetFormat() const { return m_style; } + void SetFormat(int format) { m_style = format; m_format.clear(); } + + // draw the string right aligned with given width/precision + virtual void Draw(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + const wxRect& rect, + int row, int col, + bool isSelected) wxOVERRIDE; + + virtual wxSize GetBestSize(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col) wxOVERRIDE; + + // parameters string format is "width[,precision[,format]]" + // with format being one of f|e|g|E|F|G + virtual void SetParameters(const wxString& params) wxOVERRIDE; + + virtual wxGridCellRenderer *Clone() const wxOVERRIDE + { return new wxGridCellFloatRenderer(*this); } + +protected: + wxString GetString(const wxGrid& grid, int row, int col); + +private: + // formatting parameters + int m_width, + m_precision; + + int m_style; + wxString m_format; +}; + +// renderer for boolean fields +class WXDLLIMPEXP_ADV wxGridCellBoolRenderer : public wxGridCellRenderer +{ +public: + wxGridCellBoolRenderer() + : wxGridCellRenderer() + { + } + + wxGridCellBoolRenderer(const wxGridCellBoolRenderer& other) + : wxGridCellRenderer(other) + { + } + + // draw a check mark or nothing + virtual void Draw(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + const wxRect& rect, + int row, int col, + bool isSelected) wxOVERRIDE; + + // return the checkmark size + virtual wxSize GetBestSize(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col) wxOVERRIDE; + + virtual wxSize GetMaxBestSize(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc) wxOVERRIDE; + + virtual wxGridCellRenderer *Clone() const wxOVERRIDE + { return new wxGridCellBoolRenderer(*this); } +}; + + +#if wxUSE_DATETIME + +#include "wx/datetime.h" + +namespace wxGridPrivate { class DateParseParams; } + +// renderer for the cells containing dates only, without time component +class WXDLLIMPEXP_ADV wxGridCellDateRenderer : public wxGridCellStringRenderer +{ +public: + explicit wxGridCellDateRenderer(const wxString& outformat = wxString()); + + wxGridCellDateRenderer(const wxGridCellDateRenderer& other) + : wxGridCellStringRenderer(other), + m_oformat(other.m_oformat), + m_tz(other.m_tz) + { + } + + // draw the string right aligned + virtual void Draw(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + const wxRect& rect, + int row, int col, + bool isSelected) wxOVERRIDE; + + virtual wxSize GetBestSize(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col) wxOVERRIDE; + + virtual wxSize GetMaxBestSize(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc) wxOVERRIDE; + + virtual wxGridCellRenderer *Clone() const wxOVERRIDE + { return new wxGridCellDateRenderer(*this); } + + // output strptime()-like format string + virtual void SetParameters(const wxString& params) wxOVERRIDE; + +protected: + wxString GetString(const wxGrid& grid, int row, int col); + + // This is overridden in wxGridCellDateTimeRenderer which uses a separate + // input format and forbids fallback to ParseDate(). + virtual void + GetDateParseParams(wxGridPrivate::DateParseParams& params) const; + + wxString m_oformat; + wxDateTime::TimeZone m_tz; +}; + +// the default renderer for the cells containing times and dates +class WXDLLIMPEXP_ADV wxGridCellDateTimeRenderer : public wxGridCellDateRenderer +{ +public: + wxGridCellDateTimeRenderer(const wxString& outformat = wxASCII_STR(wxDefaultDateTimeFormat), + const wxString& informat = wxASCII_STR(wxDefaultDateTimeFormat)); + + wxGridCellDateTimeRenderer(const wxGridCellDateTimeRenderer& other) + : wxGridCellDateRenderer(other), + m_iformat(other.m_iformat) + { + } + + virtual wxGridCellRenderer *Clone() const wxOVERRIDE + { return new wxGridCellDateTimeRenderer(*this); } + +protected: + virtual void + GetDateParseParams(wxGridPrivate::DateParseParams& params) const wxOVERRIDE; + + wxString m_iformat; +}; + +#endif // wxUSE_DATETIME + +// Renderer for fields taking one of a limited set of values: this is the same +// as the renderer for strings, except that it can implement GetMaxBestSize(). +class WXDLLIMPEXP_ADV wxGridCellChoiceRenderer : public wxGridCellStringRenderer +{ +public: + explicit wxGridCellChoiceRenderer(const wxString& choices = wxString()); + + wxGridCellChoiceRenderer(const wxGridCellChoiceRenderer& other); + + virtual wxSize GetMaxBestSize(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc) wxOVERRIDE; + + // Parameters string is a comma-separated list of values. + virtual void SetParameters(const wxString& params) wxOVERRIDE; + + virtual wxGridCellRenderer *Clone() const wxOVERRIDE + { + return new wxGridCellChoiceRenderer(*this); + } + +protected: + + wxArrayString m_choices; +}; + + +// renders a number using the corresponding text string +class WXDLLIMPEXP_ADV wxGridCellEnumRenderer : public wxGridCellChoiceRenderer +{ +public: + explicit wxGridCellEnumRenderer(const wxString& choices = wxString()) + : wxGridCellChoiceRenderer(choices) + { + } + + wxGridCellEnumRenderer(const wxGridCellEnumRenderer& other) + : wxGridCellChoiceRenderer(other) + { + } + + // draw the string right aligned + virtual void Draw(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + const wxRect& rect, + int row, int col, + bool isSelected) wxOVERRIDE; + + virtual wxSize GetBestSize(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col) wxOVERRIDE; + + virtual wxGridCellRenderer *Clone() const wxOVERRIDE + { return new wxGridCellEnumRenderer(*this); } + +protected: + wxString GetString(const wxGrid& grid, int row, int col); +}; + + +class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringRenderer : public wxGridCellStringRenderer +{ +public: + wxGridCellAutoWrapStringRenderer() + : wxGridCellStringRenderer() + { + } + + wxGridCellAutoWrapStringRenderer(const wxGridCellAutoWrapStringRenderer& other) + : wxGridCellStringRenderer(other) + { + } + + virtual void Draw(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + const wxRect& rect, + int row, int col, + bool isSelected) wxOVERRIDE; + + virtual wxSize GetBestSize(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col) wxOVERRIDE; + + virtual int GetBestHeight(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col, + int width) wxOVERRIDE; + + virtual int GetBestWidth(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col, + int height) wxOVERRIDE; + + virtual wxGridCellRenderer *Clone() const wxOVERRIDE + { return new wxGridCellAutoWrapStringRenderer(*this); } + +private: + wxArrayString GetTextLines( wxGrid& grid, + wxDC& dc, + const wxGridCellAttr& attr, + const wxRect& rect, + int row, int col); + + // Helper methods of GetTextLines() + + // Break a single logical line of text into several physical lines, all of + // which are added to the lines array. The lines are broken at maxWidth and + // the dc is used for measuring text extent only. + void BreakLine(wxDC& dc, + const wxString& logicalLine, + wxCoord maxWidth, + wxArrayString& lines); + + // Break a word, which is supposed to be wider than maxWidth, into several + // lines, which are added to lines array and the last, incomplete, of which + // is returned in line output parameter. + // + // Returns the width of the last line. + wxCoord BreakWord(wxDC& dc, + const wxString& word, + wxCoord maxWidth, + wxArrayString& lines, + wxString& line); + + +}; + +#endif // wxUSE_GRID +#endif // _WX_GENERIC_GRIDCTRL_H_ diff --git a/lib/wxWidgets/include/wx/generic/grideditors.h b/lib/wxWidgets/include/wx/generic/grideditors.h new file mode 100644 index 0000000..9d3e991 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/grideditors.h @@ -0,0 +1,498 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/grideditors.h +// Purpose: wxGridCellEditorEvtHandler and wxGrid editors +// Author: Michael Bedward (based on code by Julian Smart, Robin Dunn) +// Modified by: Santiago Palacios +// Created: 1/08/1999 +// Copyright: (c) Michael Bedward +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_GRID_EDITORS_H_ +#define _WX_GENERIC_GRID_EDITORS_H_ + +#include "wx/defs.h" + +#if wxUSE_GRID + +#include "wx/scopedptr.h" + +class wxGridCellEditorEvtHandler : public wxEvtHandler +{ +public: + wxGridCellEditorEvtHandler(wxGrid* grid, wxGridCellEditor* editor) + : m_grid(grid), + m_editor(editor), + m_inSetFocus(false) + { + } + + void DismissEditor(); + + void OnKillFocus(wxFocusEvent& event); + void OnKeyDown(wxKeyEvent& event); + void OnChar(wxKeyEvent& event); + + void SetInSetFocus(bool inSetFocus) { m_inSetFocus = inSetFocus; } + +private: + wxGrid *m_grid; + wxGridCellEditor *m_editor; + + // Work around the fact that a focus kill event can be sent to + // a combobox within a set focus event. + bool m_inSetFocus; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxGridCellEditorEvtHandler); + wxDECLARE_NO_COPY_CLASS(wxGridCellEditorEvtHandler); +}; + + +#if wxUSE_TEXTCTRL + +// the editor for string/text data +class WXDLLIMPEXP_ADV wxGridCellTextEditor : public wxGridCellEditor +{ +public: + explicit wxGridCellTextEditor(size_t maxChars = 0) + : wxGridCellEditor(), + m_maxChars(maxChars) + { + } + + wxGridCellTextEditor(const wxGridCellTextEditor& other); + + virtual void Create(wxWindow* parent, + wxWindowID id, + wxEvtHandler* evtHandler) wxOVERRIDE; + virtual void SetSize(const wxRect& rect) wxOVERRIDE; + + virtual bool IsAcceptedKey(wxKeyEvent& event) wxOVERRIDE; + virtual void BeginEdit(int row, int col, wxGrid* grid) wxOVERRIDE; + virtual bool EndEdit(int row, int col, const wxGrid* grid, + const wxString& oldval, wxString *newval) wxOVERRIDE; + virtual void ApplyEdit(int row, int col, wxGrid* grid) wxOVERRIDE; + + virtual void Reset() wxOVERRIDE; + virtual void StartingKey(wxKeyEvent& event) wxOVERRIDE; + virtual void HandleReturn(wxKeyEvent& event) wxOVERRIDE; + + // parameters string format is "max_width" + virtual void SetParameters(const wxString& params) wxOVERRIDE; +#if wxUSE_VALIDATORS + virtual void SetValidator(const wxValidator& validator); +#endif + + virtual wxGridCellEditor *Clone() const wxOVERRIDE + { return new wxGridCellTextEditor(*this); } + + // added GetValue so we can get the value which is in the control + virtual wxString GetValue() const wxOVERRIDE; + +protected: + wxTextCtrl *Text() const { return (wxTextCtrl *)m_control; } + + // parts of our virtual functions reused by the derived classes + void DoCreate(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler, + long style = 0); + void DoBeginEdit(const wxString& startValue); + void DoReset(const wxString& startValue); + +private: + size_t m_maxChars; // max number of chars allowed +#if wxUSE_VALIDATORS + wxScopedPtr m_validator; +#endif + wxString m_value; +}; + +// the editor for numeric (long) data +class WXDLLIMPEXP_ADV wxGridCellNumberEditor : public wxGridCellTextEditor +{ +public: + // allows to specify the range - if min == max == -1, no range checking is + // done + explicit wxGridCellNumberEditor(int min = -1, int max = -1) + : wxGridCellTextEditor(), + m_min(min), + m_max(max), + m_value(0L) + { + } + + wxGridCellNumberEditor(const wxGridCellNumberEditor& other) + : wxGridCellTextEditor(other), + m_min(other.m_min), + m_max(other.m_max), + m_value(other.m_value) + { + } + + virtual void Create(wxWindow* parent, + wxWindowID id, + wxEvtHandler* evtHandler) wxOVERRIDE; + + virtual void SetSize(const wxRect& rect) wxOVERRIDE; + + virtual bool IsAcceptedKey(wxKeyEvent& event) wxOVERRIDE; + virtual void BeginEdit(int row, int col, wxGrid* grid) wxOVERRIDE; + virtual bool EndEdit(int row, int col, const wxGrid* grid, + const wxString& oldval, wxString *newval) wxOVERRIDE; + virtual void ApplyEdit(int row, int col, wxGrid* grid) wxOVERRIDE; + + virtual void Reset() wxOVERRIDE; + virtual void StartingKey(wxKeyEvent& event) wxOVERRIDE; + + // parameters string format is "min,max" + virtual void SetParameters(const wxString& params) wxOVERRIDE; + + virtual wxGridCellEditor *Clone() const wxOVERRIDE + { return new wxGridCellNumberEditor(*this); } + + // added GetValue so we can get the value which is in the control + virtual wxString GetValue() const wxOVERRIDE; + +protected: +#if wxUSE_SPINCTRL + wxSpinCtrl *Spin() const { return (wxSpinCtrl *)m_control; } +#endif + + // if HasRange(), we use wxSpinCtrl - otherwise wxTextCtrl + bool HasRange() const + { +#if wxUSE_SPINCTRL + return m_min != m_max; +#else + return false; +#endif + } + + // string representation of our value + wxString GetString() const + { return wxString::Format(wxT("%ld"), m_value); } + +private: + int m_min, + m_max; + + long m_value; +}; + + +enum wxGridCellFloatFormat +{ + // Decimal floating point (%f) + wxGRID_FLOAT_FORMAT_FIXED = 0x0010, + + // Scientific notation (mantise/exponent) using e character (%e) + wxGRID_FLOAT_FORMAT_SCIENTIFIC = 0x0020, + + // Use the shorter of %e or %f (%g) + wxGRID_FLOAT_FORMAT_COMPACT = 0x0040, + + // To use in combination with one of the above formats (%F/%E/%G) + wxGRID_FLOAT_FORMAT_UPPER = 0x0080, + + // Format used by default. + wxGRID_FLOAT_FORMAT_DEFAULT = wxGRID_FLOAT_FORMAT_FIXED, + + // A mask to extract format from the combination of flags. + wxGRID_FLOAT_FORMAT_MASK = wxGRID_FLOAT_FORMAT_FIXED | + wxGRID_FLOAT_FORMAT_SCIENTIFIC | + wxGRID_FLOAT_FORMAT_COMPACT | + wxGRID_FLOAT_FORMAT_UPPER +}; + +// the editor for floating point numbers (double) data +class WXDLLIMPEXP_ADV wxGridCellFloatEditor : public wxGridCellTextEditor +{ +public: + explicit wxGridCellFloatEditor(int width = -1, + int precision = -1, + int format = wxGRID_FLOAT_FORMAT_DEFAULT) + : wxGridCellTextEditor(), + m_width(width), + m_precision(precision), + m_value(0.0), + m_style(format) + { + } + + wxGridCellFloatEditor(const wxGridCellFloatEditor& other) + : wxGridCellTextEditor(other), + m_width(other.m_width), + m_precision(other.m_precision), + m_value(other.m_value), + m_style(other.m_style), + m_format(other.m_format) + { + } + + virtual void Create(wxWindow* parent, + wxWindowID id, + wxEvtHandler* evtHandler) wxOVERRIDE; + + virtual bool IsAcceptedKey(wxKeyEvent& event) wxOVERRIDE; + virtual void BeginEdit(int row, int col, wxGrid* grid) wxOVERRIDE; + virtual bool EndEdit(int row, int col, const wxGrid* grid, + const wxString& oldval, wxString *newval) wxOVERRIDE; + virtual void ApplyEdit(int row, int col, wxGrid* grid) wxOVERRIDE; + + virtual void Reset() wxOVERRIDE; + virtual void StartingKey(wxKeyEvent& event) wxOVERRIDE; + + virtual wxGridCellEditor *Clone() const wxOVERRIDE + { return new wxGridCellFloatEditor(*this); } + + // parameters string format is "width[,precision[,format]]" + // format to choose between f|e|g|E|G (f is used by default) + virtual void SetParameters(const wxString& params) wxOVERRIDE; + +protected: + // string representation of our value + wxString GetString(); + +private: + int m_width, + m_precision; + double m_value; + + int m_style; + wxString m_format; +}; + +#endif // wxUSE_TEXTCTRL + +#if wxUSE_CHECKBOX + +// the editor for boolean data +class WXDLLIMPEXP_ADV wxGridCellBoolEditor : public wxGridCellEditor +{ +public: + wxGridCellBoolEditor() + : wxGridCellEditor() + { + } + + wxGridCellBoolEditor(const wxGridCellBoolEditor& other) + : wxGridCellEditor(other), + m_value(other.m_value) + { + } + + virtual wxGridActivationResult + TryActivate(int row, int col, wxGrid* grid, + const wxGridActivationSource& actSource) wxOVERRIDE; + virtual void DoActivate(int row, int col, wxGrid* grid) wxOVERRIDE; + + virtual void Create(wxWindow* parent, + wxWindowID id, + wxEvtHandler* evtHandler) wxOVERRIDE; + + virtual void SetSize(const wxRect& rect) wxOVERRIDE; + virtual void Show(bool show, wxGridCellAttr *attr = NULL) wxOVERRIDE; + + virtual bool IsAcceptedKey(wxKeyEvent& event) wxOVERRIDE; + virtual void BeginEdit(int row, int col, wxGrid* grid) wxOVERRIDE; + virtual bool EndEdit(int row, int col, const wxGrid* grid, + const wxString& oldval, wxString *newval) wxOVERRIDE; + virtual void ApplyEdit(int row, int col, wxGrid* grid) wxOVERRIDE; + + virtual void Reset() wxOVERRIDE; + virtual void StartingClick() wxOVERRIDE; + virtual void StartingKey(wxKeyEvent& event) wxOVERRIDE; + + virtual wxGridCellEditor *Clone() const wxOVERRIDE + { return new wxGridCellBoolEditor(*this); } + + // added GetValue so we can get the value which is in the control, see + // also UseStringValues() + virtual wxString GetValue() const wxOVERRIDE; + + // set the string values returned by GetValue() for the true and false + // states, respectively + static void UseStringValues(const wxString& valueTrue = wxT("1"), + const wxString& valueFalse = wxString()); + + // return true if the given string is equal to the string representation of + // true value which we currently use + static bool IsTrueValue(const wxString& value); + +protected: + wxCheckBox *CBox() const { return (wxCheckBox *)m_control; } + +private: + // These functions modify or use m_value. + void SetValueFromGrid(int row, int col, wxGrid* grid); + void SetGridFromValue(int row, int col, wxGrid* grid) const; + + wxString GetStringValue() const { return GetStringValue(m_value); } + + static + wxString GetStringValue(bool value) { return ms_stringValues[value]; } + + bool m_value; + + static wxString ms_stringValues[2]; +}; + +#endif // wxUSE_CHECKBOX + +#if wxUSE_COMBOBOX + +// the editor for string data allowing to choose from the list of strings +class WXDLLIMPEXP_ADV wxGridCellChoiceEditor : public wxGridCellEditor +{ +public: + // if !allowOthers, user can't type a string not in choices array + explicit wxGridCellChoiceEditor(size_t count = 0, + const wxString choices[] = NULL, + bool allowOthers = false); + explicit wxGridCellChoiceEditor(const wxArrayString& choices, + bool allowOthers = false) + : wxGridCellEditor(), + m_choices(choices), + m_allowOthers(allowOthers) + { + } + + wxGridCellChoiceEditor(const wxGridCellChoiceEditor& other) + : wxGridCellEditor(other), + m_value(other.m_value), + m_choices(other.m_choices), + m_allowOthers(other.m_allowOthers) + { + } + + virtual void Create(wxWindow* parent, + wxWindowID id, + wxEvtHandler* evtHandler) wxOVERRIDE; + + virtual void SetSize(const wxRect& rect) wxOVERRIDE; + + virtual void BeginEdit(int row, int col, wxGrid* grid) wxOVERRIDE; + virtual bool EndEdit(int row, int col, const wxGrid* grid, + const wxString& oldval, wxString *newval) wxOVERRIDE; + virtual void ApplyEdit(int row, int col, wxGrid* grid) wxOVERRIDE; + + virtual void Reset() wxOVERRIDE; + + // parameters string format is "item1[,item2[...,itemN]]" + virtual void SetParameters(const wxString& params) wxOVERRIDE; + + virtual wxGridCellEditor *Clone() const wxOVERRIDE + { return new wxGridCellChoiceEditor(*this); } + + // added GetValue so we can get the value which is in the control + virtual wxString GetValue() const wxOVERRIDE; + +protected: + wxComboBox *Combo() const { return (wxComboBox *)m_control; } + + void OnComboCloseUp(wxCommandEvent& evt); + + wxString m_value; + wxArrayString m_choices; + bool m_allowOthers; +}; + +#endif // wxUSE_COMBOBOX + +#if wxUSE_COMBOBOX + +class WXDLLIMPEXP_ADV wxGridCellEnumEditor : public wxGridCellChoiceEditor +{ +public: + explicit wxGridCellEnumEditor(const wxString& choices = wxString()); + + wxGridCellEnumEditor(const wxGridCellEnumEditor& other) + : wxGridCellChoiceEditor(other), + m_index(other.m_index) + { + } + + virtual ~wxGridCellEnumEditor() {} + + virtual wxGridCellEditor* Clone() const wxOVERRIDE + { return new wxGridCellEnumEditor(*this); } + + virtual void BeginEdit(int row, int col, wxGrid* grid) wxOVERRIDE; + virtual bool EndEdit(int row, int col, const wxGrid* grid, + const wxString& oldval, wxString *newval) wxOVERRIDE; + virtual void ApplyEdit(int row, int col, wxGrid* grid) wxOVERRIDE; + +private: + long m_index; +}; + +#endif // wxUSE_COMBOBOX + +class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor +{ +public: + wxGridCellAutoWrapStringEditor() + : wxGridCellTextEditor() + { + } + + wxGridCellAutoWrapStringEditor(const wxGridCellAutoWrapStringEditor& other) + : wxGridCellTextEditor(other) + { + } + + virtual void Create(wxWindow* parent, + wxWindowID id, + wxEvtHandler* evtHandler) wxOVERRIDE; + + virtual wxGridCellEditor *Clone() const wxOVERRIDE + { return new wxGridCellAutoWrapStringEditor(*this); } +}; + +#if wxUSE_DATEPICKCTRL + +class WXDLLIMPEXP_ADV wxGridCellDateEditor : public wxGridCellEditor +{ +public: + explicit wxGridCellDateEditor(const wxString& format = wxString()); + + wxGridCellDateEditor(const wxGridCellDateEditor& other) + : wxGridCellEditor(other), + m_value(other.m_value), + m_format(other.m_format) + { + } + + virtual void SetParameters(const wxString& params) wxOVERRIDE; + + virtual void Create(wxWindow* parent, + wxWindowID id, + wxEvtHandler* evtHandler) wxOVERRIDE; + + virtual void SetSize(const wxRect& rect) wxOVERRIDE; + + virtual void BeginEdit(int row, int col, wxGrid* grid) wxOVERRIDE; + virtual bool EndEdit(int row, int col, const wxGrid* grid, + const wxString& oldval, wxString *newval) wxOVERRIDE; + virtual void ApplyEdit(int row, int col, wxGrid* grid) wxOVERRIDE; + + virtual void Reset() wxOVERRIDE; + + virtual wxGridCellEditor *Clone() const wxOVERRIDE + { return new wxGridCellDateEditor(*this); } + + virtual wxString GetValue() const wxOVERRIDE; + +protected: + wxDatePickerCtrl* DatePicker() const; + +private: + wxDateTime m_value; + wxString m_format; +}; + +#endif // wxUSE_DATEPICKCTRL + +#endif // wxUSE_GRID + +#endif // _WX_GENERIC_GRID_EDITORS_H_ diff --git a/lib/wxWidgets/include/wx/generic/gridsel.h b/lib/wxWidgets/include/wx/generic/gridsel.h new file mode 100644 index 0000000..e2dcaaf --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/gridsel.h @@ -0,0 +1,158 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/gridsel.h +// Purpose: wxGridSelection +// Author: Stefan Neis +// Modified by: +// Created: 20/02/2000 +// Copyright: (c) Stefan Neis +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_GRIDSEL_H_ +#define _WX_GENERIC_GRIDSEL_H_ + +#include "wx/defs.h" + +#if wxUSE_GRID + +#include "wx/grid.h" + +#include "wx/vector.h" + +typedef wxVector wxVectorGridBlockCoords; + +// Note: for all eventType arguments of the methods of this class wxEVT_NULL +// may be passed to forbid events generation completely. +class WXDLLIMPEXP_CORE wxGridSelection +{ +public: + wxGridSelection(wxGrid *grid, + wxGrid::wxGridSelectionModes sel = wxGrid::wxGridSelectCells); + + bool IsSelection(); + bool IsInSelection(int row, int col) const; + bool IsInSelection(const wxGridCellCoords& coords) const + { + return IsInSelection(coords.GetRow(), coords.GetCol()); + } + + void SetSelectionMode(wxGrid::wxGridSelectionModes selmode); + wxGrid::wxGridSelectionModes GetSelectionMode() { return m_selectionMode; } + void SelectRow(int row, const wxKeyboardState& kbd = wxKeyboardState()); + void SelectCol(int col, const wxKeyboardState& kbd = wxKeyboardState()); + void SelectBlock(int topRow, int leftCol, + int bottomRow, int rightCol, + const wxKeyboardState& kbd = wxKeyboardState(), + wxEventType eventType = wxEVT_GRID_RANGE_SELECTED); + void SelectBlock(const wxGridCellCoords& topLeft, + const wxGridCellCoords& bottomRight, + const wxKeyboardState& kbd = wxKeyboardState(), + wxEventType eventType = wxEVT_GRID_RANGE_SELECTED) + { + SelectBlock(topLeft.GetRow(), topLeft.GetCol(), + bottomRight.GetRow(), bottomRight.GetCol(), + kbd, eventType); + } + + // This function replaces all the existing selected blocks (which become + // redundant) with a single block covering the entire grid. + void SelectAll(); + + void DeselectBlock(const wxGridBlockCoords& block, + const wxKeyboardState& kbd = wxKeyboardState(), + wxEventType eventType = wxEVT_GRID_RANGE_SELECTED); + + // Note that this method refreshes the previously selected blocks and sends + // an event about the selection change. + void ClearSelection(); + + void UpdateRows( size_t pos, int numRows ); + void UpdateCols( size_t pos, int numCols ); + + // Extend (or shrink) the current selection block (creating it if + // necessary, i.e. if there is no selection at all currently or if the + // current cell isn't selected, as in this case a new block + // containing it is always added) to the one specified by the start and end + // coordinates of its opposite corners (which don't have to be in + // top/bottom left/right order). + // + // Note that blockStart is equal to wxGrid::m_currentCellCoords almost + // always, but not always (the exception is when we scrolled out from + // the top of the grid and select a column or scrolled right and select + // a row: in this case the lowest visible row/column will be set as + // current, not the first one). + // + // Both components of both blockStart and blockEnd must be valid. + // + // This function sends an event notifying about the selection change using + // the provided event type, which is wxEVT_GRID_RANGE_SELECTED by default, + // but may also be wxEVT_GRID_RANGE_SELECTING, when the selection is not + // final yet. + // + // Return true if the current block was actually changed. + bool ExtendCurrentBlock(const wxGridCellCoords& blockStart, + const wxGridCellCoords& blockEnd, + const wxKeyboardState& kbd, + wxEventType eventType = wxEVT_GRID_RANGE_SELECTED); + + + // Return the coordinates of the cell from which the selection should + // continue to be extended. This is normally the opposite corner of the + // last selected block from the current cell coordinates. + // + // If there is no selection, just returns the current cell coordinates. + wxGridCellCoords GetExtensionAnchor() const; + + wxGridCellCoordsArray GetCellSelection() const; + wxGridCellCoordsArray GetBlockSelectionTopLeft() const; + wxGridCellCoordsArray GetBlockSelectionBottomRight() const; + wxArrayInt GetRowSelection() const; + wxArrayInt GetColSelection() const; + + wxVectorGridBlockCoords& GetBlocks() { return m_selection; } + + void EndSelecting(); + void CancelSelecting(); + +private: + void SelectBlockNoEvent(const wxGridBlockCoords& block) + { + SelectBlock(block.GetTopRow(), block.GetLeftCol(), + block.GetBottomRow(), block.GetRightCol(), + wxKeyboardState(), false); + } + + // Really select the block and don't check for the current selection mode. + void Select(const wxGridBlockCoords& block, + const wxKeyboardState& kbd, + wxEventType eventType); + + // Ensure that the new "block" becomes part of "blocks", adding it to them + // if necessary and, if we do it, also removing any existing elements of + // "blocks" that become unnecessary because they're entirely contained in + // the new "block". However note that we may also not to have to add it at + // all, if it's already contained in one of the existing blocks. + // + // We don't currently check if the new block is contained by several + // existing blocks, as this would be more difficult and doesn't seem to be + // really needed in practice. + void MergeOrAddBlock(wxVectorGridBlockCoords& blocks, + const wxGridBlockCoords& block); + + // All currently selected blocks. We expect there to be a relatively small + // amount of them, even for very large grids, as each block must be + // selected by the user, so we store them unsorted. + // + // Selection may be empty, but if it isn't, the last block is special, as + // it is the current block, which is affected by operations such as + // extending the current selection from keyboard. + wxVectorGridBlockCoords m_selection; + + wxGrid *m_grid; + wxGrid::wxGridSelectionModes m_selectionMode; + + wxDECLARE_NO_COPY_CLASS(wxGridSelection); +}; + +#endif // wxUSE_GRID +#endif // _WX_GENERIC_GRIDSEL_H_ diff --git a/lib/wxWidgets/include/wx/generic/headerctrlg.h b/lib/wxWidgets/include/wx/generic/headerctrlg.h new file mode 100644 index 0000000..77da772 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/headerctrlg.h @@ -0,0 +1,186 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/headerctrlg.h +// Purpose: Generic wxHeaderCtrl implementation +// Author: Vadim Zeitlin +// Created: 2008-12-01 +// Copyright: (c) 2008 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_HEADERCTRLG_H_ +#define _WX_GENERIC_HEADERCTRLG_H_ + +#include "wx/event.h" +#include "wx/vector.h" +#include "wx/overlay.h" + +// ---------------------------------------------------------------------------- +// wxHeaderCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxHeaderCtrl : public wxHeaderCtrlBase +{ +public: + wxHeaderCtrl() + { + Init(); + } + + wxHeaderCtrl(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxHD_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxHeaderCtrlNameStr)) + { + Init(); + + Create(parent, id, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxHD_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxHeaderCtrlNameStr)); + + virtual ~wxHeaderCtrl(); + +protected: + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + +private: + // implement base class pure virtuals + virtual void DoSetCount(unsigned int count) wxOVERRIDE; + virtual unsigned int DoGetCount() const wxOVERRIDE; + virtual void DoUpdate(unsigned int idx) wxOVERRIDE; + + virtual void DoScrollHorz(int dx) wxOVERRIDE; + + virtual void DoSetColumnsOrder(const wxArrayInt& order) wxOVERRIDE; + virtual wxArrayInt DoGetColumnsOrder() const wxOVERRIDE; + + // common part of all ctors + void Init(); + + // event handlers + void OnPaint(wxPaintEvent& event); + void OnMouse(wxMouseEvent& event); + void OnKeyDown(wxKeyEvent& event); + void OnCaptureLost(wxMouseCaptureLostEvent& event); + + // move the column with given idx at given position (this doesn't generate + // any events but does refresh the display) + void DoMoveCol(unsigned int idx, unsigned int pos); + + // return the horizontal start position of the given column in physical + // coordinates + int GetColStart(unsigned int idx) const; + + // and the end position + int GetColEnd(unsigned int idx) const; + + // refresh the given column [only]; idx must be valid + void RefreshCol(unsigned int idx); + + // refresh the given column if idx is valid + void RefreshColIfNotNone(unsigned int idx); + + // refresh all the controls starting from (and including) the given one + void RefreshColsAfter(unsigned int idx); + + // return the column at the given position or -1 if it is beyond the + // rightmost column and put true into onSeparator output parameter if the + // position is near the divider at the right end of this column (notice + // that this means that we return column 0 even if the position is over + // column 1 but close enough to the divider separating it from column 0) + unsigned int FindColumnAtPoint(int x, bool *onSeparator = NULL) const; + + // return the result of FindColumnAtPoint() if it is a valid column, + // otherwise the index of the last (rightmost) displayed column + unsigned int FindColumnClosestToPoint(int xPhysical) const; + + // return true if a drag resizing operation is currently in progress + bool IsResizing() const; + + // return true if a drag reordering operation is currently in progress + bool IsReordering() const; + + // return true if any drag operation is currently in progress + bool IsDragging() const { return IsResizing() || IsReordering(); } + + // end any drag operation currently in progress (resizing or reordering) + void EndDragging(); + + // cancel the drag operation currently in progress and generate an event + // about it + void CancelDragging(); + + // start (if m_colBeingResized is -1) or continue resizing the column + // + // this generates wxEVT_HEADER_BEGIN_RESIZE/RESIZING events and can + // cancel the operation if the user handler decides so + void StartOrContinueResizing(unsigned int col, int xPhysical); + + // end the resizing operation currently in progress and generate an event + // about it with its cancelled flag set if xPhysical is -1 + void EndResizing(int xPhysical); + + // same functions as above but for column moving/reordering instead of + // resizing + void StartReordering(unsigned int col, int xPhysical); + + // returns true if we did drag the column somewhere else or false if we + // didn't really move it -- in this case we consider that no reordering + // took place and that a normal column click event should be generated + bool EndReordering(int xPhysical); + + // constrain the given position to be larger than the start position of the + // given column plus its minimal width and return the effective width + int ConstrainByMinWidth(unsigned int col, int& xPhysical); + + // update the information displayed while a column is being moved around + void UpdateReorderingMarker(int xPhysical); + + // clear any overlaid markers + void ClearMarkers(); + + + // number of columns in the control currently + unsigned int m_numColumns; + + // index of the column under mouse or -1 if none + unsigned int m_hover; + + // the column being resized or -1 if there is no resizing operation in + // progress + unsigned int m_colBeingResized; + + // the column being moved or -1 if there is no reordering operation in + // progress + unsigned int m_colBeingReordered; + + // the distance from the start of m_colBeingReordered and the mouse + // position when the user started to drag it + int m_dragOffset; + + // the horizontal scroll offset + int m_scrollOffset; + + // the overlay display used during the dragging operations + wxOverlay m_overlay; + + // the indices of the column appearing at the given position on the display + // (its size is always m_numColumns) + wxArrayInt m_colIndices; + + bool m_wasSeparatorDClick; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxHeaderCtrl); +}; + +#endif // _WX_GENERIC_HEADERCTRLG_H_ + diff --git a/lib/wxWidgets/include/wx/generic/helpext.h b/lib/wxWidgets/include/wx/generic/helpext.h new file mode 100644 index 0000000..67d5294 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/helpext.h @@ -0,0 +1,105 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/helpext.h +// Purpose: an external help controller for wxWidgets +// Author: Karsten Ballueder (Ballueder@usa.net) +// Modified by: +// Copyright: (c) Karsten Ballueder 1998 +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __WX_HELPEXT_H_ +#define __WX_HELPEXT_H_ + +#if wxUSE_HELP + + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/helpbase.h" + + +// ---------------------------------------------------------------------------- +// wxExtHelpController +// ---------------------------------------------------------------------------- + +// This class implements help via an external browser. +class WXDLLIMPEXP_ADV wxExtHelpController : public wxHelpControllerBase +{ +public: + wxExtHelpController(wxWindow* parentWindow = NULL); + virtual ~wxExtHelpController(); + +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED(void SetBrowser(const wxString& browsername = wxEmptyString, bool isNetscape = false) ); +#endif + + // Set viewer: new name for SetBrowser + virtual void SetViewer(const wxString& viewer = wxEmptyString, + long flags = wxHELP_NETSCAPE) wxOVERRIDE; + + virtual bool Initialize(const wxString& dir, int WXUNUSED(server)) wxOVERRIDE + { return Initialize(dir); } + + virtual bool Initialize(const wxString& dir) wxOVERRIDE; + virtual bool LoadFile(const wxString& file = wxEmptyString) wxOVERRIDE; + virtual bool DisplayContents() wxOVERRIDE; + virtual bool DisplaySection(int sectionNo) wxOVERRIDE; + virtual bool DisplaySection(const wxString& section) wxOVERRIDE; + virtual bool DisplayBlock(long blockNo) wxOVERRIDE; + virtual bool KeywordSearch(const wxString& k, + wxHelpSearchMode mode = wxHELP_SEARCH_ALL) wxOVERRIDE; + + virtual bool Quit() wxOVERRIDE; + virtual void OnQuit() wxOVERRIDE; + + virtual bool DisplayHelp(const wxString &) ; + + virtual void SetFrameParameters(const wxString& WXUNUSED(title), + const wxSize& WXUNUSED(size), + const wxPoint& WXUNUSED(pos) = wxDefaultPosition, + bool WXUNUSED(newFrameEachTime) = false) wxOVERRIDE + { + // does nothing by default + } + + virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL, + wxPoint *WXUNUSED(pos) = NULL, + bool *WXUNUSED(newFrameEachTime) = NULL) wxOVERRIDE + { + return NULL; // does nothing by default + } + +protected: + // Filename of currently active map file. + wxString m_helpDir; + + // How many entries do we have in the map file? + int m_NumOfEntries; + + // A list containing all id,url,documentation triples. + wxList *m_MapList; + +private: + // parse a single line of the map file (called by LoadFile()) + // + // return true if the line was valid or false otherwise + bool ParseMapFileLine(const wxString& line); + + // Deletes the list and all objects. + void DeleteList(); + + + // How to call the html viewer. + wxString m_BrowserName; + + // Is the viewer a variant of netscape? + bool m_BrowserIsNetscape; + + wxDECLARE_CLASS(wxExtHelpController); +}; + +#endif // wxUSE_HELP + +#endif // __WX_HELPEXT_H_ diff --git a/lib/wxWidgets/include/wx/generic/hyperlink.h b/lib/wxWidgets/include/wx/generic/hyperlink.h new file mode 100644 index 0000000..0c238e1 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/hyperlink.h @@ -0,0 +1,144 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/hyperlink.h +// Purpose: Hyperlink control +// Author: David Norris , Otto Wyss +// Modified by: Ryan Norton, Francesco Montorsi +// Created: 04/02/2005 +// Copyright: (c) 2005 David Norris +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERICHYPERLINKCTRL_H_ +#define _WX_GENERICHYPERLINKCTRL_H_ + +// ---------------------------------------------------------------------------- +// wxGenericHyperlinkCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxGenericHyperlinkCtrl : public wxHyperlinkCtrlBase +{ +public: + // Default constructor (for two-step construction). + wxGenericHyperlinkCtrl() { Init(); } + + // Constructor. + wxGenericHyperlinkCtrl(wxWindow *parent, + wxWindowID id, + const wxString& label, const wxString& url, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxHL_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxHyperlinkCtrlNameStr)) + { + Init(); + (void) Create(parent, id, label, url, pos, size, style, name); + } + + // Creation function (for two-step construction). + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, const wxString& url, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxHL_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxHyperlinkCtrlNameStr)); + + + // get/set + wxColour GetHoverColour() const wxOVERRIDE { return m_hoverColour; } + void SetHoverColour(const wxColour &colour) wxOVERRIDE { m_hoverColour = colour; } + + wxColour GetNormalColour() const wxOVERRIDE { return m_normalColour; } + void SetNormalColour(const wxColour &colour) wxOVERRIDE; + + wxColour GetVisitedColour() const wxOVERRIDE { return m_visitedColour; } + void SetVisitedColour(const wxColour &colour) wxOVERRIDE; + + wxString GetURL() const wxOVERRIDE { return m_url; } + void SetURL (const wxString &url) wxOVERRIDE { m_url=url; } + + void SetVisited(bool visited = true) wxOVERRIDE { m_visited=visited; } + bool GetVisited() const wxOVERRIDE { return m_visited; } + + // NOTE: also wxWindow::Set/GetLabel, wxWindow::Set/GetBackgroundColour, + // wxWindow::Get/SetFont, wxWindow::Get/SetCursor are important ! + + +protected: + // Helper used by this class itself and native MSW implementation that + // connects OnRightUp() and OnPopUpCopy() handlers. + void ConnectMenuHandlers(); + + // event handlers + + // Renders the hyperlink. + void OnPaint(wxPaintEvent& event); + + // Handle set/kill focus events (invalidate for painting focus rect) + void OnFocus(wxFocusEvent& event); + + // Fire a HyperlinkEvent on space + void OnChar(wxKeyEvent& event); + + // Returns the wxRect of the label of this hyperlink. + // This is different from the clientsize's rectangle when + // clientsize != bestsize and this rectangle is influenced + // by the alignment of the label (wxHL_ALIGN_*). + wxRect GetLabelRect() const; + + // If the click originates inside the bounding box of the label, + // a flag is set so that an event will be fired when the left + // button is released. + void OnLeftDown(wxMouseEvent& event); + + // If the click both originated and finished inside the bounding box + // of the label, a HyperlinkEvent is fired. + void OnLeftUp(wxMouseEvent& event); + void OnRightUp(wxMouseEvent& event); + + // Changes the cursor to a hand, if the mouse is inside the label's + // bounding box. + void OnMotion(wxMouseEvent& event); + + // Changes the cursor back to the default, if necessary. + void OnLeaveWindow(wxMouseEvent& event); + + // handles "Copy URL" menuitem + void OnPopUpCopy(wxCommandEvent& event); + + // overridden base class virtuals + + // Returns the best size for the window, which is the size needed + // to display the text label. + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + + // creates a context menu with "Copy URL" menuitem + virtual void DoContextMenu(const wxPoint &); + +private: + // Common part of all ctors. + void Init(); + + // URL associated with the link. This is transmitted inside + // the HyperlinkEvent fired when the user clicks on the label. + wxString m_url; + + // Foreground colours for various link types. + // NOTE: wxWindow::m_backgroundColour is used for background, + // wxWindow::m_foregroundColour is used to render non-visited links + wxColour m_hoverColour; + wxColour m_normalColour; + wxColour m_visitedColour; + + // True if the mouse cursor is inside the label's bounding box. + bool m_rollover; + + // True if the link has been clicked before. + bool m_visited; + + // True if a click is in progress (left button down) and the click + // originated inside the label's bounding box. + bool m_clicking; +}; + +#endif // _WX_GENERICHYPERLINKCTRL_H_ diff --git a/lib/wxWidgets/include/wx/generic/icon.h b/lib/wxWidgets/include/wx/generic/icon.h new file mode 100644 index 0000000..df215e2 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/icon.h @@ -0,0 +1,59 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/icon.h +// Purpose: wxIcon implementation for ports where it's same as wxBitmap +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_ICON_H_ +#define _WX_GENERIC_ICON_H_ + +#include "wx/bitmap.h" + +//----------------------------------------------------------------------------- +// wxIcon +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxIcon: public wxBitmap +{ +public: + wxIcon(); + + wxIcon(const char* const* bits); + + // For compatibility with wxMSW where desired size is sometimes required to + // distinguish between multiple icons in a resource. + wxIcon( const wxString& filename, + wxBitmapType type = wxICON_DEFAULT_TYPE, + int WXUNUSED(desiredWidth)=-1, int WXUNUSED(desiredHeight)=-1 ) : + wxBitmap(filename, type) + { + } + + wxIcon(const wxIconLocation& loc) + : wxBitmap(loc.GetFileName(), wxBITMAP_TYPE_ANY) + { + } + + bool LoadFile(const wxString& name, wxBitmapType flags, + int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight)) + { return wxBitmap::LoadFile(name, flags); } + + // unhide the base class version + virtual bool LoadFile(const wxString& name, + wxBitmapType flags = wxICON_DEFAULT_TYPE) wxOVERRIDE + { return wxBitmap::LoadFile(name, flags); } + + // create from bitmap (which should have a mask unless it's monochrome): + // there shouldn't be any implicit bitmap -> icon conversion (i.e. no + // ctors, assignment operators...), but it's ok to have such function + void CopyFromBitmap(const wxBitmap& bmp); + +private: + wxDECLARE_DYNAMIC_CLASS(wxIcon); +}; + +#endif // _WX_GENERIC_ICON_H_ diff --git a/lib/wxWidgets/include/wx/generic/imaglist.h b/lib/wxWidgets/include/wx/generic/imaglist.h new file mode 100644 index 0000000..2560418 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/imaglist.h @@ -0,0 +1,93 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/imaglist.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Copyright: (c) 1998 Robert Roebling and Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGLISTG_H_ +#define _WX_IMAGLISTG_H_ + +#include "wx/bitmap.h" +#include "wx/gdicmn.h" +#include "wx/vector.h" + +class WXDLLIMPEXP_FWD_CORE wxDC; +class WXDLLIMPEXP_FWD_CORE wxIcon; +class WXDLLIMPEXP_FWD_CORE wxColour; + + +class WXDLLIMPEXP_CORE wxGenericImageList: public wxObject +{ +public: + wxGenericImageList(); + wxGenericImageList( int width, int height, bool mask = true, int initialCount = 1 ); + virtual ~wxGenericImageList(); + bool Create( int width, int height, bool mask = true, int initialCount = 1 ); + void Destroy(); + + virtual int GetImageCount() const; + virtual bool GetSize( int index, int &width, int &height ) const; + virtual wxSize GetSize() const { return m_size; } + + int Add( const wxBitmap& bitmap ); + int Add( const wxBitmap& bitmap, const wxBitmap& mask ); + int Add( const wxBitmap& bitmap, const wxColour& maskColour ); + wxBitmap GetBitmap(int index) const; + wxIcon GetIcon(int index) const; + bool Replace( int index, + const wxBitmap& bitmap, + const wxBitmap& mask = wxNullBitmap ); + bool Remove( int index ); + bool RemoveAll(); + + virtual bool Draw(int index, wxDC& dc, int x, int y, + int flags = wxIMAGELIST_DRAW_NORMAL, + bool solidBackground = false); + +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_MSG("Don't use this overload: it's not portable and does nothing") + bool Create() { return true; } + + wxDEPRECATED_MSG("Use GetBitmap() instead") + const wxBitmap *GetBitmapPtr(int index) const { return DoGetPtr(index); } +#endif // WXWIN_COMPATIBILITY_3_0 + +private: + const wxBitmap *DoGetPtr(int index) const; + + wxBitmap GetImageListBitmap(const wxBitmap& bitmap) const; + + wxVector m_images; + bool m_useMask; + + // Size of a single bitmap in the list. + wxSize m_size; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericImageList); +}; + +#ifndef wxHAS_NATIVE_IMAGELIST + +/* + * wxImageList has to be a real class or we have problems with + * the run-time information. + */ + +class WXDLLIMPEXP_CORE wxImageList: public wxGenericImageList +{ + wxDECLARE_DYNAMIC_CLASS(wxImageList); + +public: + wxImageList() {} + + wxImageList( int width, int height, bool mask = true, int initialCount = 1 ) + : wxGenericImageList(width, height, mask, initialCount) + { + } +}; +#endif // !wxHAS_NATIVE_IMAGELIST + +#endif // _WX_IMAGLISTG_H_ diff --git a/lib/wxWidgets/include/wx/generic/infobar.h b/lib/wxWidgets/include/wx/generic/infobar.h new file mode 100644 index 0000000..2fb2312 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/infobar.h @@ -0,0 +1,139 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/infobar.h +// Purpose: generic wxInfoBar class declaration +// Author: Vadim Zeitlin +// Created: 2009-07-28 +// Copyright: (c) 2009 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_INFOBAR_H_ +#define _WX_GENERIC_INFOBAR_H_ + +class WXDLLIMPEXP_FWD_CORE wxBitmapButton; +class WXDLLIMPEXP_FWD_CORE wxStaticBitmap; +class WXDLLIMPEXP_FWD_CORE wxStaticText; + +// ---------------------------------------------------------------------------- +// wxInfoBar +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxInfoBarGeneric : public wxInfoBarBase +{ +public: + // the usual ctors and Create() but remember that info bar is created + // hidden + wxInfoBarGeneric() { Init(); } + + wxInfoBarGeneric(wxWindow *parent, wxWindowID winid = wxID_ANY) + { + Init(); + Create(parent, winid); + } + + bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY); + + + // implement base class methods + // ---------------------------- + + virtual void ShowMessage(const wxString& msg, + int flags = wxICON_INFORMATION) wxOVERRIDE; + + virtual void Dismiss() wxOVERRIDE; + + virtual void AddButton(wxWindowID btnid, const wxString& label = wxString()) wxOVERRIDE; + + virtual void RemoveButton(wxWindowID btnid) wxOVERRIDE; + + virtual size_t GetButtonCount() const wxOVERRIDE; + virtual wxWindowID GetButtonId(size_t idx) const wxOVERRIDE; + virtual bool HasButtonId(wxWindowID btnid) const wxOVERRIDE; + + // methods specific to this version + // -------------------------------- + + // set the effect(s) to use when showing/hiding the bar, may be + // wxSHOW_EFFECT_NONE to disable any effects entirely + // + // by default, slide to bottom/top is used when it's positioned on the top + // of the window for showing/hiding it and top/bottom when it's positioned + // at the bottom + void SetShowHideEffects(wxShowEffect showEffect, wxShowEffect hideEffect) + { + m_showEffect = showEffect; + m_hideEffect = hideEffect; + } + + // get effect used when showing/hiding the window + wxShowEffect GetShowEffect() const; + wxShowEffect GetHideEffect() const; + + // set the duration of animation used when showing/hiding the bar, in ms + void SetEffectDuration(int duration) { m_effectDuration = duration; } + + // get the currently used effect animation duration + int GetEffectDuration() const { return m_effectDuration; } + + + // overridden base class methods + // ----------------------------- + + // setting the font of this window sets it for the text control inside it + // (default font is a larger and bold version of the normal one) + virtual bool SetFont(const wxFont& font) wxOVERRIDE; + + // same thing with the colour: this affects the text colour + virtual bool SetForegroundColour(const wxColor& colour) wxOVERRIDE; + +protected: + // info bar shouldn't have any border by default, the colour difference + // between it and the main window separates it well enough + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + + + // update the parent to take our new or changed size into account (notably + // should be called when we're shown or hidden) + void UpdateParent(); + +private: + // common part of all ctors + void Init(); + + // handler for the close button + void OnButton(wxCommandEvent& event); + + // show/hide the bar + void DoShow(); + void DoHide(); + + // determine the placement of the bar from its position in the containing + // sizer + enum BarPlacement + { + BarPlacement_Top, + BarPlacement_Bottom, + BarPlacement_Unknown + }; + + BarPlacement GetBarPlacement() const; + + + // different controls making up the bar + wxStaticBitmap *m_icon; + wxStaticText *m_text; + wxBitmapButton *m_button; + + // the effects to use when showing/hiding and duration for them: by default + // the effect is determined by the info bar automatically depending on its + // position and the default duration is used + wxShowEffect m_showEffect, + m_hideEffect; + int m_effectDuration; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxInfoBarGeneric); +}; + +#endif // _WX_GENERIC_INFOBAR_H_ + diff --git a/lib/wxWidgets/include/wx/generic/laywin.h b/lib/wxWidgets/include/wx/generic/laywin.h new file mode 100644 index 0000000..0066be9 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/laywin.h @@ -0,0 +1,227 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/laywin.h +// Purpose: Implements a simple layout algorithm, plus +// wxSashLayoutWindow which is an example of a window with +// layout-awareness (via event handlers). This is suited to +// IDE-style window layout. +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LAYWIN_H_G_ +#define _WX_LAYWIN_H_G_ + +#if wxUSE_SASH + #include "wx/sashwin.h" +#endif // wxUSE_SASH + +#include "wx/event.h" + +class WXDLLIMPEXP_FWD_CORE wxQueryLayoutInfoEvent; +class WXDLLIMPEXP_FWD_CORE wxCalculateLayoutEvent; + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_QUERY_LAYOUT_INFO, wxQueryLayoutInfoEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CALCULATE_LAYOUT, wxCalculateLayoutEvent ); + +enum wxLayoutOrientation +{ + wxLAYOUT_HORIZONTAL, + wxLAYOUT_VERTICAL +}; + +enum wxLayoutAlignment +{ + wxLAYOUT_NONE, + wxLAYOUT_TOP, + wxLAYOUT_LEFT, + wxLAYOUT_RIGHT, + wxLAYOUT_BOTTOM +}; + +// Not sure this is necessary +// Tell window which dimension we're sizing on +#define wxLAYOUT_LENGTH_Y 0x0008 +#define wxLAYOUT_LENGTH_X 0x0000 + +// Use most recently used length +#define wxLAYOUT_MRU_LENGTH 0x0010 + +// Only a query, so don't actually move it. +#define wxLAYOUT_QUERY 0x0100 + +/* + * This event is used to get information about window alignment, + * orientation and size. + */ + +class WXDLLIMPEXP_CORE wxQueryLayoutInfoEvent: public wxEvent +{ +public: + wxQueryLayoutInfoEvent(wxWindowID id = 0) + { + SetEventType(wxEVT_QUERY_LAYOUT_INFO); + m_requestedLength = 0; + m_flags = 0; + m_id = id; + m_alignment = wxLAYOUT_TOP; + m_orientation = wxLAYOUT_HORIZONTAL; + } + + // Read by the app + void SetRequestedLength(int length) { m_requestedLength = length; } + int GetRequestedLength() const { return m_requestedLength; } + + void SetFlags(int flags) { m_flags = flags; } + int GetFlags() const { return m_flags; } + + // Set by the app + void SetSize(const wxSize& size) { m_size = size; } + wxSize GetSize() const { return m_size; } + + void SetOrientation(wxLayoutOrientation orient) { m_orientation = orient; } + wxLayoutOrientation GetOrientation() const { return m_orientation; } + + void SetAlignment(wxLayoutAlignment align) { m_alignment = align; } + wxLayoutAlignment GetAlignment() const { return m_alignment; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxQueryLayoutInfoEvent(*this); } + +protected: + int m_flags; + int m_requestedLength; + wxSize m_size; + wxLayoutOrientation m_orientation; + wxLayoutAlignment m_alignment; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxQueryLayoutInfoEvent); +}; + +typedef void (wxEvtHandler::*wxQueryLayoutInfoEventFunction)(wxQueryLayoutInfoEvent&); + +#define wxQueryLayoutInfoEventHandler( func ) \ + wxEVENT_HANDLER_CAST( wxQueryLayoutInfoEventFunction, func ) + +#define EVT_QUERY_LAYOUT_INFO(func) \ + wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_QUERY_LAYOUT_INFO, wxID_ANY, wxID_ANY, wxQueryLayoutInfoEventHandler( func ), NULL ), + +/* + * This event is used to take a bite out of the available client area. + */ + +class WXDLLIMPEXP_CORE wxCalculateLayoutEvent: public wxEvent +{ +public: + wxCalculateLayoutEvent(wxWindowID id = 0) + { + SetEventType(wxEVT_CALCULATE_LAYOUT); + m_flags = 0; + m_id = id; + } + + // Read by the app + void SetFlags(int flags) { m_flags = flags; } + int GetFlags() const { return m_flags; } + + // Set by the app + void SetRect(const wxRect& rect) { m_rect = rect; } + wxRect GetRect() const { return m_rect; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxCalculateLayoutEvent(*this); } + +protected: + int m_flags; + wxRect m_rect; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxCalculateLayoutEvent); +}; + +typedef void (wxEvtHandler::*wxCalculateLayoutEventFunction)(wxCalculateLayoutEvent&); + +#define wxCalculateLayoutEventHandler( func ) wxEVENT_HANDLER_CAST(wxCalculateLayoutEventFunction, func) + +#define EVT_CALCULATE_LAYOUT(func) \ + wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_CALCULATE_LAYOUT, wxID_ANY, wxID_ANY, wxCalculateLayoutEventHandler( func ), NULL ), + +#if wxUSE_SASH + +// This is window that can remember alignment/orientation, does its own layout, +// and can provide sashes too. Useful for implementing docked windows with sashes in +// an IDE-style interface. +class WXDLLIMPEXP_CORE wxSashLayoutWindow: public wxSashWindow +{ +public: + wxSashLayoutWindow() + { + Init(); + } + + wxSashLayoutWindow(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = wxT("layoutWindow")) + { + Create(parent, id, pos, size, style, name); + } + + bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = wxT("layoutWindow")); + +// Accessors + inline wxLayoutAlignment GetAlignment() const { return m_alignment; } + inline wxLayoutOrientation GetOrientation() const { return m_orientation; } + + inline void SetAlignment(wxLayoutAlignment align) { m_alignment = align; } + inline void SetOrientation(wxLayoutOrientation orient) { m_orientation = orient; } + + // Give the window default dimensions + inline void SetDefaultSize(const wxSize& size) { m_defaultSize = size; } + +// Event handlers + // Called by layout algorithm to allow window to take a bit out of the + // client rectangle, and size itself if not in wxLAYOUT_QUERY mode. + void OnCalculateLayout(wxCalculateLayoutEvent& event); + + // Called by layout algorithm to retrieve information about the window. + void OnQueryLayoutInfo(wxQueryLayoutInfoEvent& event); + +private: + void Init(); + + wxLayoutAlignment m_alignment; + wxLayoutOrientation m_orientation; + wxSize m_defaultSize; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxSashLayoutWindow); + wxDECLARE_EVENT_TABLE(); +}; + +#endif // wxUSE_SASH + +class WXDLLIMPEXP_FWD_CORE wxMDIParentFrame; +class WXDLLIMPEXP_FWD_CORE wxFrame; + +// This class implements the layout algorithm +class WXDLLIMPEXP_CORE wxLayoutAlgorithm: public wxObject +{ +public: + wxLayoutAlgorithm() {} + +#if wxUSE_MDI_ARCHITECTURE + // The MDI client window is sized to whatever's left over. + bool LayoutMDIFrame(wxMDIParentFrame* frame, wxRect* rect = NULL); +#endif // wxUSE_MDI_ARCHITECTURE + + // mainWindow is sized to whatever's left over. This function for backward + // compatibility; use LayoutWindow. + bool LayoutFrame(wxFrame* frame, wxWindow* mainWindow = NULL); + + // mainWindow is sized to whatever's left over. + bool LayoutWindow(wxWindow* frame, wxWindow* mainWindow = NULL); +}; + +#endif + // _WX_LAYWIN_H_G_ diff --git a/lib/wxWidgets/include/wx/generic/listctrl.h b/lib/wxWidgets/include/wx/generic/listctrl.h new file mode 100644 index 0000000..ff2d2f9 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/listctrl.h @@ -0,0 +1,274 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/listctrl.h +// Purpose: Generic list control +// Author: Robert Roebling +// Created: 01/02/97 +// Copyright: (c) 1998 Robert Roebling and Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_LISTCTRL_H_ +#define _WX_GENERIC_LISTCTRL_H_ + +#include "wx/containr.h" +#include "wx/scrolwin.h" +#include "wx/textctrl.h" + +#if wxUSE_DRAG_AND_DROP +class WXDLLIMPEXP_FWD_CORE wxDropTarget; +#endif + +//----------------------------------------------------------------------------- +// internal classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxListHeaderWindow; +class WXDLLIMPEXP_FWD_CORE wxListMainWindow; + +//----------------------------------------------------------------------------- +// wxListCtrl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGenericListCtrl: public wxNavigationEnabled, + public wxScrollHelper +{ + typedef wxNavigationEnabled BaseType; + +public: + wxGenericListCtrl() : wxScrollHelper(this) + { + Init(); + } + + wxGenericListCtrl( wxWindow *parent, + wxWindowID winid = wxID_ANY, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLC_ICON, + const wxValidator& validator = wxDefaultValidator, + const wxString &name = wxASCII_STR(wxListCtrlNameStr)) + : wxScrollHelper(this) + { + Create(parent, winid, pos, size, style, validator, name); + } + + virtual ~wxGenericListCtrl(); + + void Init(); + + bool Create( wxWindow *parent, + wxWindowID winid = wxID_ANY, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLC_ICON, + const wxValidator& validator = wxDefaultValidator, + const wxString &name = wxASCII_STR(wxListCtrlNameStr)); + + bool GetColumn( int col, wxListItem& item ) const wxOVERRIDE; + bool SetColumn( int col, const wxListItem& item ) wxOVERRIDE; + int GetColumnWidth( int col ) const wxOVERRIDE; + bool SetColumnWidth( int col, int width) wxOVERRIDE; + + // Column ordering functions + int GetColumnOrder(int col) const wxOVERRIDE; + int GetColumnIndexFromOrder(int order) const wxOVERRIDE; + + wxArrayInt GetColumnsOrder() const wxOVERRIDE; + bool SetColumnsOrder(const wxArrayInt& orders) wxOVERRIDE; + + int GetCountPerPage() const; // not the same in wxGLC as in Windows, I think + wxRect GetViewRect() const; + + bool GetItem( wxListItem& info ) const; + bool SetItem( wxListItem& info ) ; + bool SetItem( long index, int col, const wxString& label, int imageId = -1 ); + int GetItemState( long item, long stateMask ) const; + bool SetItemState( long item, long state, long stateMask); + bool SetItemImage( long item, int image, int selImage = -1 ); + bool SetItemColumnImage( long item, long column, int image ); + wxString GetItemText( long item, int col = 0 ) const; + void SetItemText( long item, const wxString& str ); + wxUIntPtr GetItemData( long item ) const; + bool SetItemPtrData(long item, wxUIntPtr data); + bool SetItemData(long item, long data) { return SetItemPtrData(item, data); } + bool GetItemRect( long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS ) const; + bool GetSubItemRect( long item, long subItem, wxRect& rect, int code = wxLIST_RECT_BOUNDS ) const; + bool GetItemPosition( long item, wxPoint& pos ) const; + bool SetItemPosition( long item, const wxPoint& pos ); // not supported in wxGLC + int GetItemCount() const wxOVERRIDE; + int GetColumnCount() const wxOVERRIDE; + void SetItemSpacing( int spacing, bool isSmall = false ); + wxSize GetItemSpacing() const; + void SetItemTextColour( long item, const wxColour& col); + wxColour GetItemTextColour( long item ) const; + void SetItemBackgroundColour( long item, const wxColour &col); + wxColour GetItemBackgroundColour( long item ) const; + void SetItemFont( long item, const wxFont &f); + wxFont GetItemFont( long item ) const; + int GetSelectedItemCount() const; + wxColour GetTextColour() const; + void SetTextColour(const wxColour& col); + long GetTopItem() const; + + bool HasCheckBoxes() const wxOVERRIDE; + bool EnableCheckBoxes(bool enable = true) wxOVERRIDE; + bool IsItemChecked(long item) const wxOVERRIDE; + void CheckItem(long item, bool check) wxOVERRIDE; + + void ShowSortIndicator(int idx, bool ascending = true) wxOVERRIDE; + int GetSortIndicator() const wxOVERRIDE; + bool IsAscendingSortIndicator() const wxOVERRIDE; + + void SetSingleStyle( long style, bool add = true ) ; + void SetWindowStyleFlag( long style ) wxOVERRIDE; + void RecreateWindow() {} + long GetNextItem( long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE ) const; + bool Arrange( int flag = wxLIST_ALIGN_DEFAULT ); // always wxLIST_ALIGN_LEFT in wxGLC + + void ClearAll(); + bool DeleteItem( long item ); + bool DeleteAllItems(); + bool DeleteAllColumns() wxOVERRIDE; + bool DeleteColumn( int col ) wxOVERRIDE; + + void SetItemCount(long count); + + wxTextCtrl *EditLabel(long item, + wxClassInfo* textControlClass = wxCLASSINFO(wxTextCtrl)); + + // End label editing, optionally cancelling the edit + bool EndEditLabel(bool cancel); + + wxTextCtrl* GetEditControl() const; + bool IsVisible(long item) const wxOVERRIDE; + void Edit( long item ) { EditLabel(item); } + + bool EnsureVisible( long item ); + long FindItem( long start, const wxString& str, bool partial = false ); + long FindItem( long start, wxUIntPtr data ); + long FindItem( long start, const wxPoint& pt, int direction ); // not supported in wxGLC + long HitTest( const wxPoint& point, int& flags, long *pSubItem = NULL ) const; + long InsertItem(wxListItem& info); + long InsertItem( long index, const wxString& label ); + long InsertItem( long index, int imageIndex ); + long InsertItem( long index, const wxString& label, int imageIndex ); + bool ScrollList( int dx, int dy ); + bool SortItems( wxListCtrlCompare fn, wxIntPtr data ); + + // do we have a header window? + bool HasHeader() const + { return InReportView() && !HasFlag(wxLC_NO_HEADER); } + + // refresh items selectively (only useful for virtual list controls) + void RefreshItem(long item); + void RefreshItems(long itemFrom, long itemTo); + + virtual void EnableBellOnNoMatch(bool on = true) wxOVERRIDE; + + // overridden base class virtuals + // ------------------------------ + + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + virtual void Update() wxOVERRIDE; + + + // implementation only from now on + // ------------------------------- + + // generic version extension, don't use in portable code + bool Update( long item ); + + void OnInternalIdle( ) wxOVERRIDE; + + // We have to hand down a few functions + virtual void Refresh(bool eraseBackground = true, + const wxRect *rect = NULL) wxOVERRIDE; + + virtual bool SetBackgroundColour( const wxColour &colour ) wxOVERRIDE; + virtual bool SetForegroundColour( const wxColour &colour ) wxOVERRIDE; + virtual wxColour GetBackgroundColour() const; + virtual wxColour GetForegroundColour() const; + virtual bool SetFont( const wxFont &font ) wxOVERRIDE; + virtual bool SetCursor( const wxCursor &cursor ) wxOVERRIDE; + + virtual void ExtendRulesAndAlternateColour(bool extend = true) wxOVERRIDE; + +#if wxUSE_DRAG_AND_DROP + virtual void SetDropTarget( wxDropTarget *dropTarget ) wxOVERRIDE; + virtual wxDropTarget *GetDropTarget() const wxOVERRIDE; +#endif + + virtual bool ShouldInheritColours() const wxOVERRIDE { return false; } + + // implementation + // -------------- + + wxListHeaderWindow *m_headerWin; + wxListMainWindow *m_mainWin; + +protected: + // Implement base class pure virtual methods. + long DoInsertColumn(long col, const wxListItem& info) wxOVERRIDE; + void DoUpdateImages(int which) wxOVERRIDE; + + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + + // it calls our OnGetXXX() functions + friend class WXDLLIMPEXP_FWD_CORE wxListMainWindow; + + virtual wxBorder GetDefaultBorder() const wxOVERRIDE; + + virtual wxSize GetSizeAvailableForScrollTarget(const wxSize& size) wxOVERRIDE; + +private: + void CreateOrDestroyHeaderWindowAsNeeded(); + void OnScroll( wxScrollWinEvent& event ); + void OnSize( wxSizeEvent &event ); + + // we need to return a special WM_GETDLGCODE value to process just the + // arrows but let the other navigation characters through +#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) + virtual WXLRESULT + MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) wxOVERRIDE; +#endif // __WXMSW__ + + WX_FORWARD_TO_SCROLL_HELPER() + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxGenericListCtrl); +}; + +#if (!defined(__WXMSW__) || defined(__WXUNIVERSAL__)) && (!(defined(__WXMAC__) && wxOSX_USE_CARBON) || defined(__WXUNIVERSAL__ )) +/* + * wxListCtrl has to be a real class or we have problems with + * the run-time information. + */ + +class WXDLLIMPEXP_CORE wxListCtrl: public wxGenericListCtrl +{ + wxDECLARE_DYNAMIC_CLASS(wxListCtrl); + +public: + wxListCtrl() {} + + wxListCtrl(wxWindow *parent, wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxLC_ICON, + const wxValidator &validator = wxDefaultValidator, + const wxString &name = wxASCII_STR(wxListCtrlNameStr)) + : wxGenericListCtrl(parent, winid, pos, size, style, validator, name) + { + } + +}; +#endif // !__WXMSW__ || __WXUNIVERSAL__ + +#endif // _WX_GENERIC_LISTCTRL_H_ diff --git a/lib/wxWidgets/include/wx/generic/logg.h b/lib/wxWidgets/include/wx/generic/logg.h new file mode 100644 index 0000000..f45731d --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/logg.h @@ -0,0 +1,152 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/logg.h +// Purpose: Assorted wxLogXXX functions, and wxLog (sink for logs) +// Author: Vadim Zeitlin +// Modified by: +// Created: 29/01/98 +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LOGG_H_ +#define _WX_LOGG_H_ + +#if wxUSE_GUI + +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; +class WXDLLIMPEXP_FWD_CORE wxLogFrame; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +// ---------------------------------------------------------------------------- +// the following log targets are only compiled in if the we're compiling the +// GUI part (andnot just the base one) of the library, they're implemented in +// src/generic/logg.cpp *and not src/common/log.cpp unlike all the rest) +// ---------------------------------------------------------------------------- + +#if wxUSE_TEXTCTRL + +// log everything to a text window (GUI only of course) +class WXDLLIMPEXP_CORE wxLogTextCtrl : public wxLog +{ +public: + wxLogTextCtrl(wxTextCtrl *pTextCtrl); + +protected: + // implement sink function + virtual void DoLogText(const wxString& msg) wxOVERRIDE; + +private: + // the control we use + wxTextCtrl *m_pTextCtrl; + + wxDECLARE_NO_COPY_CLASS(wxLogTextCtrl); +}; + +#endif // wxUSE_TEXTCTRL + +// ---------------------------------------------------------------------------- +// GUI log target, the default one for wxWidgets programs +// ---------------------------------------------------------------------------- + +#if wxUSE_LOGGUI + +class WXDLLIMPEXP_CORE wxLogGui : public wxLog +{ +public: + // ctor + wxLogGui(); + + // show all messages that were logged since the last Flush() + virtual void Flush() wxOVERRIDE; + +protected: + virtual void DoLogRecord(wxLogLevel level, + const wxString& msg, + const wxLogRecordInfo& info) wxOVERRIDE; + + // return the title to be used for the log dialog, depending on m_bErrors + // and m_bWarnings values + wxString GetTitle() const; + + // return the icon (one of wxICON_XXX constants) to be used for the dialog + // depending on m_bErrors/m_bWarnings + int GetSeverityIcon() const; + + // empty everything + void Clear(); + + + wxArrayString m_aMessages; // the log message texts + wxArrayInt m_aSeverity; // one of wxLOG_XXX values + wxArrayLong m_aTimes; // the time of each message + bool m_bErrors, // do we have any errors? + m_bWarnings, // any warnings? + m_bHasMessages; // any messages at all? + +private: + // this method is called to show a single log message, it uses + // wxMessageBox() by default + virtual void DoShowSingleLogMessage(const wxString& message, + const wxString& title, + int style); + + // this method is called to show multiple log messages, it uses wxLogDialog + virtual void DoShowMultipleLogMessages(const wxArrayString& messages, + const wxArrayInt& severities, + const wxArrayLong& times, + const wxString& title, + int style); +}; + +#endif // wxUSE_LOGGUI + +// ---------------------------------------------------------------------------- +// (background) log window: this class forwards all log messages to the log +// target which was active when it was instantiated, but also collects them +// to the log window. This window has its own menu which allows the user to +// close it, clear the log contents or save it to the file. +// ---------------------------------------------------------------------------- + +#if wxUSE_LOGWINDOW + +class WXDLLIMPEXP_CORE wxLogWindow : public wxLogPassThrough +{ +public: + wxLogWindow(wxWindow *pParent, // the parent frame (can be NULL) + const wxString& szTitle, // the title of the frame + bool bShow = true, // show window immediately? + bool bPassToOld = true); // pass messages to the old target? + + virtual ~wxLogWindow(); + + // window operations + // show/hide the log window + void Show(bool bShow = true); + // retrieve the pointer to the frame + wxFrame *GetFrame() const; + + // overridables + // called if the user closes the window interactively, will not be + // called if it is destroyed for another reason (such as when program + // exits) - return true from here to allow the frame to close, false + // to prevent this from happening + virtual bool OnFrameClose(wxFrame *frame); + // called right before the log frame is going to be deleted: will + // always be called unlike OnFrameClose() + virtual void OnFrameDelete(wxFrame *frame); + +protected: + virtual void DoLogTextAtLevel(wxLogLevel level, const wxString& msg) wxOVERRIDE; + +private: + wxLogFrame *m_pLogFrame; // the log frame + + wxDECLARE_NO_COPY_CLASS(wxLogWindow); +}; + +#endif // wxUSE_LOGWINDOW + +#endif // wxUSE_GUI + +#endif // _WX_LOGG_H_ + diff --git a/lib/wxWidgets/include/wx/generic/mask.h b/lib/wxWidgets/include/wx/generic/mask.h new file mode 100644 index 0000000..99307b3 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/mask.h @@ -0,0 +1,53 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/mask.h +// Purpose: generic implementation of wxMask +// Author: Vadim Zeitlin +// Created: 2006-09-28 +// Copyright: (c) 2006 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_MASKG_H_ +#define _WX_GENERIC_MASKG_H_ + +// ---------------------------------------------------------------------------- +// generic wxMask implementation +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMask : public wxMaskBase +{ +public: + wxMask() { } + wxMask(const wxBitmap& bitmap, const wxColour& colour) + { + InitFromColour(bitmap, colour); + } + +#if wxUSE_PALETTE + wxMask(const wxBitmap& bitmap, int paletteIndex) + { + Create(bitmap, paletteIndex); + } +#endif // wxUSE_PALETTE + + wxMask(const wxBitmap& bitmap) + { + InitFromMonoBitmap(bitmap); + } + + // implementation-only from now on + wxBitmap GetBitmap() const { return m_bitmap; } + +private: + // implement wxMaskBase pure virtuals + virtual void FreeData(); + virtual bool InitFromColour(const wxBitmap& bitmap, const wxColour& colour); + virtual bool InitFromMonoBitmap(const wxBitmap& bitmap); + + wxBitmap m_bitmap; + + wxDECLARE_DYNAMIC_CLASS(wxMask); +}; + +#endif // _WX_GENERIC_MASKG_H_ + diff --git a/lib/wxWidgets/include/wx/generic/mdig.h b/lib/wxWidgets/include/wx/generic/mdig.h new file mode 100644 index 0000000..cb3a12d --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/mdig.h @@ -0,0 +1,262 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/mdig.h +// Purpose: Generic MDI (Multiple Document Interface) classes +// Author: Hans Van Leemputten +// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes +// Created: 29/07/2002 +// Copyright: (c) 2002 Hans Van Leemputten +// (c) 2008 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_MDIG_H_ +#define _WX_GENERIC_MDIG_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/panel.h" + +class WXDLLIMPEXP_FWD_CORE wxBookCtrlBase; +class WXDLLIMPEXP_FWD_CORE wxBookCtrlEvent; +class WXDLLIMPEXP_FWD_CORE wxIcon; +class WXDLLIMPEXP_FWD_CORE wxIconBundle; +class WXDLLIMPEXP_FWD_CORE wxNotebook; + +#if wxUSE_GENERIC_MDI_AS_NATIVE + #define wxGenericMDIParentFrame wxMDIParentFrame + #define wxGenericMDIChildFrame wxMDIChildFrame + #define wxGenericMDIClientWindow wxMDIClientWindow +#else // !wxUSE_GENERIC_MDI_AS_NATIVE + class WXDLLIMPEXP_FWD_CORE wxGenericMDIParentFrame; + class WXDLLIMPEXP_FWD_CORE wxGenericMDIChildFrame; + class WXDLLIMPEXP_FWD_CORE wxGenericMDIClientWindow; +#endif // wxUSE_GENERIC_MDI_AS_NATIVE/!wxUSE_GENERIC_MDI_AS_NATIVE + +// ---------------------------------------------------------------------------- +// wxGenericMDIParentFrame +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGenericMDIParentFrame : public wxMDIParentFrameBase +{ +public: + wxGenericMDIParentFrame() { Init(); } + wxGenericMDIParentFrame(wxWindow *parent, + wxWindowID winid, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Init(); + + Create(parent, winid, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID winid, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + virtual ~wxGenericMDIParentFrame(); + + // implement base class pure virtuals + static bool IsTDI() { return true; } + + virtual void ActivateNext() { AdvanceActive(true); } + virtual void ActivatePrevious() { AdvanceActive(false); } + +#if wxUSE_MENUS + virtual void SetWindowMenu(wxMenu* pMenu); + + virtual void SetMenuBar(wxMenuBar *pMenuBar); +#endif // wxUSE_MENUS + + virtual wxGenericMDIClientWindow *OnCreateGenericClient(); + + + // implementation only from now on + void WXSetChildMenuBar(wxGenericMDIChildFrame *child); + void WXUpdateChildTitle(wxGenericMDIChildFrame *child); + void WXActivateChild(wxGenericMDIChildFrame *child); + void WXRemoveChild(wxGenericMDIChildFrame *child); + bool WXIsActiveChild(wxGenericMDIChildFrame *child) const; + bool WXIsInsideChildHandler(wxGenericMDIChildFrame *child) const; + + // return the book control used by the client window to manage the pages + wxBookCtrlBase *GetBookCtrl() const; + +protected: +#if wxUSE_MENUS + wxMenuBar *m_pMyMenuBar; +#endif // wxUSE_MENUS + + // advance the activation forward or backwards + void AdvanceActive(bool forward); + +private: + void Init(); + +#if wxUSE_MENUS + void RemoveWindowMenu(wxMenuBar *pMenuBar); + void AddWindowMenu(wxMenuBar *pMenuBar); + + void OnWindowMenu(wxCommandEvent& event); +#endif // wxUSE_MENUS + + virtual bool ProcessEvent(wxEvent& event); + + void OnClose(wxCloseEvent& event); + + // return the client window, may be NULL if we hadn't been created yet + wxGenericMDIClientWindow *GetGenericClientWindow() const; + + // close all children, return false if any of them vetoed it + bool CloseAll(); + + + // this pointer is non-NULL if we're currently inside our ProcessEvent() + // and we forwarded the event to this child (as we do with menu events) + wxMDIChildFrameBase *m_childHandler; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxGenericMDIParentFrame); +}; + +// ---------------------------------------------------------------------------- +// wxGenericMDIChildFrame +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGenericMDIChildFrame : public wxTDIChildFrame +{ +public: + wxGenericMDIChildFrame() { Init(); } + wxGenericMDIChildFrame(wxGenericMDIParentFrame *parent, + wxWindowID winid, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Init(); + + Create(parent, winid, title, pos, size, style, name); + } + + bool Create(wxGenericMDIParentFrame *parent, + wxWindowID winid, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + virtual ~wxGenericMDIChildFrame(); + + // implement MDI operations + virtual void Activate(); + + +#if wxUSE_MENUS + virtual void SetMenuBar( wxMenuBar *menu_bar ); + virtual wxMenuBar *GetMenuBar() const; +#endif // wxUSE_MENUS + + virtual wxString GetTitle() const { return m_title; } + virtual void SetTitle(const wxString& title); + + virtual bool TryAfter(wxEvent& event); + + // implementation only from now on + + wxGenericMDIParentFrame* GetGenericMDIParent() const + { +#if wxUSE_GENERIC_MDI_AS_NATIVE + return GetMDIParent(); +#else // generic != native + return m_mdiParentGeneric; +#endif + } + +protected: + wxString m_title; + +#if wxUSE_MENUS + wxMenuBar *m_pMenuBar; +#endif // wxUSE_MENUS + +#if !wxUSE_GENERIC_MDI_AS_NATIVE + wxGenericMDIParentFrame *m_mdiParentGeneric; +#endif + +protected: + void Init(); + +private: +#if wxUSE_MENUS + void OnMenuHighlight(wxMenuEvent& event); +#endif // wxUSE_MENUS + void OnClose(wxCloseEvent& event); + + wxDECLARE_DYNAMIC_CLASS(wxGenericMDIChildFrame); + wxDECLARE_EVENT_TABLE(); + + friend class wxGenericMDIClientWindow; +}; + +// ---------------------------------------------------------------------------- +// wxGenericMDIClientWindow +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGenericMDIClientWindow : public wxMDIClientWindowBase +{ +public: + wxGenericMDIClientWindow() { } + + // unfortunately we need to provide our own version of CreateClient() + // because of the difference in the type of the first parameter and + // implement the base class pure virtual method in terms of it + // (CreateGenericClient() is virtual itself to allow customizing the client + // window creation by overriding it in the derived classes) + virtual bool CreateGenericClient(wxWindow *parent); + virtual bool CreateClient(wxMDIParentFrame *parent, + long WXUNUSED(style) = wxVSCROLL | wxHSCROLL) + { + return CreateGenericClient(parent); + } + + // implementation only + wxBookCtrlBase *GetBookCtrl() const; + wxGenericMDIChildFrame *GetChild(size_t pos) const; + int FindChild(wxGenericMDIChildFrame *child) const; + +private: + void PageChanged(int OldSelection, int newSelection); + + void OnPageChanged(wxBookCtrlEvent& event); + void OnSize(wxSizeEvent& event); + + // the notebook containing all MDI children as its pages + wxNotebook *m_notebook; + + wxDECLARE_DYNAMIC_CLASS(wxGenericMDIClientWindow); +}; + +// ---------------------------------------------------------------------------- +// inline functions implementation +// ---------------------------------------------------------------------------- + +inline bool +wxGenericMDIParentFrame:: +WXIsInsideChildHandler(wxGenericMDIChildFrame *child) const +{ + return child == m_childHandler; +} + +#endif // _WX_GENERIC_MDIG_H_ diff --git a/lib/wxWidgets/include/wx/generic/msgdlgg.h b/lib/wxWidgets/include/wx/generic/msgdlgg.h new file mode 100644 index 0000000..e85744a --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/msgdlgg.h @@ -0,0 +1,55 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/msgdlgg.h +// Purpose: Generic wxMessageDialog +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_MSGDLGG_H_ +#define _WX_GENERIC_MSGDLGG_H_ + +class WXDLLIMPEXP_FWD_CORE wxSizer; + +class WXDLLIMPEXP_CORE wxGenericMessageDialog : public wxMessageDialogBase +{ +public: + wxGenericMessageDialog(wxWindow *parent, + const wxString& message, + const wxString& caption = wxASCII_STR(wxMessageBoxCaptionStr), + long style = wxOK|wxCENTRE, + const wxPoint& pos = wxDefaultPosition); + + virtual int ShowModal() wxOVERRIDE; + +protected: + // Creates a message dialog taking any options that have been set after + // object creation into account such as custom labels. + void DoCreateMsgdialog(); + + void OnYes(wxCommandEvent& event); + void OnNo(wxCommandEvent& event); + void OnHelp(wxCommandEvent& event); + void OnCancel(wxCommandEvent& event); + + // can be overridden to provide more contents to the dialog + virtual void AddMessageDialogCheckBox(wxSizer *WXUNUSED(sizer)) { } + virtual void AddMessageDialogDetails(wxSizer *WXUNUSED(sizer)) { } + +private: + // Creates and returns a standard button sizer using the style of this + // dialog and the custom labels, if any. + // + // May return NULL on smart phone platforms not using buttons at all. + wxSizer *CreateMsgDlgButtonSizer(); + + wxPoint m_pos; + bool m_created; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxGenericMessageDialog); +}; + +#endif // _WX_GENERIC_MSGDLGG_H_ diff --git a/lib/wxWidgets/include/wx/generic/notebook.h b/lib/wxWidgets/include/wx/generic/notebook.h new file mode 100644 index 0000000..40ff917 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/notebook.h @@ -0,0 +1,155 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/notebook.h +// Purpose: wxNotebook class (a.k.a. property sheet, tabbed dialog) +// Author: Julian Smart +// Modified by: +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_NOTEBOOK_H_ +#define _WX_NOTEBOOK_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- +#include "wx/event.h" +#include "wx/control.h" + +// ---------------------------------------------------------------------------- +// types +// ---------------------------------------------------------------------------- + +// fwd declarations +class WXDLLIMPEXP_FWD_CORE wxImageList; +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxTabView; + +// ---------------------------------------------------------------------------- +// wxNotebook +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase +{ +public: + // ctors + // ----- + // default for dynamic class + wxNotebook(); + // the same arguments as for wxControl (@@@ any special styles?) + wxNotebook(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxNotebookNameStr)); + // Create() function + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxNotebookNameStr)); + // dtor + virtual ~wxNotebook(); + + // accessors + // --------- + // Find the position of the wxNotebookPage, wxNOT_FOUND if not found. + int FindPagePosition(wxNotebookPage* page) const; + + // set the currently selected page, return the index of the previously + // selected one (or wxNOT_FOUND on error) + // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events + int SetSelection(size_t nPage); + // cycle thru the tabs + // void AdvanceSelection(bool bForward = true); + + // changes selected page without sending events + int ChangeSelection(size_t nPage); + + // set/get the title of a page + bool SetPageText(size_t nPage, const wxString& strText); + wxString GetPageText(size_t nPage) const; + + // get the number of rows for a control with wxNB_MULTILINE style (not all + // versions support it - they will always return 1 then) + virtual int GetRowCount() const ; + + // sets/returns item's image index in the current image list + int GetPageImage(size_t nPage) const; + bool SetPageImage(size_t nPage, int nImage); + + // control the appearance of the notebook pages + // set the size (the same for all pages) + void SetPageSize(const wxSize& size); + // set the padding between tabs (in pixels) + void SetPadding(const wxSize& padding); + + // Sets the size of the tabs (assumes all tabs are the same size) + void SetTabSize(const wxSize& sz); + + // operations + // ---------- + // remove one page from the notebook, and delete the page. + bool DeletePage(size_t nPage); + bool DeletePage(wxNotebookPage* page); + // remove one page from the notebook, without deleting the page. + bool RemovePage(size_t nPage); + bool RemovePage(wxNotebookPage* page); + virtual wxWindow* DoRemovePage(size_t nPage); + + // remove all pages + bool DeleteAllPages(); + // the same as AddPage(), but adds it at the specified position + bool InsertPage(size_t nPage, + wxNotebookPage *pPage, + const wxString& strText, + bool bSelect = false, + int imageId = NO_IMAGE); + + // callbacks + // --------- + void OnSize(wxSizeEvent& event); + void OnInternalIdle(); + void OnSelChange(wxBookCtrlEvent& event); + void OnSetFocus(wxFocusEvent& event); + void OnNavigationKey(wxNavigationKeyEvent& event); + + // base class virtuals + // ------------------- + virtual void Command(wxCommandEvent& event); + virtual void SetConstraintSizes(bool recurse = true); + virtual bool DoPhase(int nPhase); + + virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; + + // Implementation + + // wxNotebook on Motif uses a generic wxTabView to implement itself. + wxTabView *GetTabView() const { return m_tabView; } + void SetTabView(wxTabView *v) { m_tabView = v; } + + void OnMouseEvent(wxMouseEvent& event); + void OnPaint(wxPaintEvent& event); + + virtual wxRect GetAvailableClientSize(); + + // Implementation: calculate the layout of the view rect + // and resize the children if required + bool RefreshLayout(bool force = true); + +protected: + // common part of all ctors + void Init(); + + // helper functions + void ChangePage(int nOldSel, int nSel); // change pages + + wxTabView* m_tabView; + + wxDECLARE_DYNAMIC_CLASS(wxNotebook); + wxDECLARE_EVENT_TABLE(); +}; + +#endif // _WX_NOTEBOOK_H_ diff --git a/lib/wxWidgets/include/wx/generic/notifmsg.h b/lib/wxWidgets/include/wx/generic/notifmsg.h new file mode 100644 index 0000000..ee178c2 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/notifmsg.h @@ -0,0 +1,47 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/notifmsg.h +// Purpose: generic implementation of wxGenericNotificationMessage +// Author: Vadim Zeitlin +// Created: 2007-11-24 +// Copyright: (c) 2007 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_NOTIFMSG_H_ +#define _WX_GENERIC_NOTIFMSG_H_ + +// ---------------------------------------------------------------------------- +// wxGenericNotificationMessage +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxGenericNotificationMessage : public wxNotificationMessageBase +{ +public: + wxGenericNotificationMessage() + { + Init(); + } + + wxGenericNotificationMessage(const wxString& title, + const wxString& message = wxString(), + wxWindow *parent = NULL, + int flags = wxICON_INFORMATION) + { + Init(); + Create(title, message, parent, flags); + } + + // generic implementation-specific methods + + // get/set the default timeout (used if Timeout_Auto is specified) + static int GetDefaultTimeout(); + static void SetDefaultTimeout(int timeout); + +private: + void Init(); + + wxDECLARE_NO_COPY_CLASS(wxGenericNotificationMessage); +}; + +#endif // _WX_GENERIC_NOTIFMSG_H_ + diff --git a/lib/wxWidgets/include/wx/generic/numdlgg.h b/lib/wxWidgets/include/wx/generic/numdlgg.h new file mode 100644 index 0000000..905efee --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/numdlgg.h @@ -0,0 +1,93 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/numdlgg.h +// Purpose: wxNumberEntryDialog class +// Author: John Labenski +// Modified by: +// Created: 07.02.04 (extracted from textdlgg.cpp) +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __NUMDLGH_G__ +#define __NUMDLGH_G__ + +#include "wx/defs.h" + +#if wxUSE_NUMBERDLG + +#include "wx/dialog.h" + +#if wxUSE_SPINCTRL + class WXDLLIMPEXP_FWD_CORE wxSpinCtrl; +#else + class WXDLLIMPEXP_FWD_CORE wxTextCtrl; +#endif // wxUSE_SPINCTRL + +// ---------------------------------------------------------------------------- +// wxNumberEntryDialog: a dialog with spin control, [ok] and [cancel] buttons +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxNumberEntryDialog : public wxDialog +{ +public: + wxNumberEntryDialog() + { + m_value = m_min = m_max = 0; + } + + wxNumberEntryDialog(wxWindow *parent, + const wxString& message, + const wxString& prompt, + const wxString& caption, + long value, long min, long max, + const wxPoint& pos = wxDefaultPosition) + { + Create(parent, message, prompt, caption, value, min, max, pos); + } + + bool Create(wxWindow *parent, + const wxString& message, + const wxString& prompt, + const wxString& caption, + long value, long min, long max, + const wxPoint& pos = wxDefaultPosition); + + long GetValue() const { return m_value; } + + // implementation only + void OnOK(wxCommandEvent& event); + void OnCancel(wxCommandEvent& event); + +protected: + +#if wxUSE_SPINCTRL + wxSpinCtrl *m_spinctrl; +#else + wxTextCtrl *m_spinctrl; +#endif // wxUSE_SPINCTRL + + long m_value, m_min, m_max; + +private: + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxNumberEntryDialog); + wxDECLARE_NO_COPY_CLASS(wxNumberEntryDialog); +}; + +// ---------------------------------------------------------------------------- +// function to get a number from user +// ---------------------------------------------------------------------------- + +WXDLLIMPEXP_CORE long + wxGetNumberFromUser(const wxString& message, + const wxString& prompt, + const wxString& caption, + long value = 0, + long min = 0, + long max = 100, + wxWindow *parent = NULL, + const wxPoint& pos = wxDefaultPosition); + +#endif // wxUSE_NUMBERDLG + +#endif // __NUMDLGH_G__ diff --git a/lib/wxWidgets/include/wx/generic/paletteg.h b/lib/wxWidgets/include/wx/generic/paletteg.h new file mode 100644 index 0000000..6035402 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/paletteg.h @@ -0,0 +1,53 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/paletteg.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Copyright: (c) 1998 Robert Roebling and Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __WX_PALETTEG_H__ +#define __WX_PALETTEG_H__ + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/gdiobj.h" +#include "wx/gdicmn.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxPalette; + +//----------------------------------------------------------------------------- +// wxPalette +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPalette: public wxPaletteBase +{ +public: + wxPalette(); + wxPalette( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue ); + + wxDECLARE_DEFAULT_COPY(wxPalette) + + virtual ~wxPalette(); + + bool Create( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); + int GetPixel( unsigned char red, unsigned char green, unsigned char blue ) const; + bool GetRGB( int pixel, unsigned char *red, unsigned char *green, unsigned char *blue ) const; + + virtual int GetColoursCount() const wxOVERRIDE; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxPalette); +}; + +#endif // __WX_PALETTEG_H__ diff --git a/lib/wxWidgets/include/wx/generic/panelg.h b/lib/wxWidgets/include/wx/generic/panelg.h new file mode 100644 index 0000000..61124e0 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/panelg.h @@ -0,0 +1,48 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/panelg.h +// Purpose: wxPanel: a container for child controls +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_PANELG_H_ +#define _WX_GENERIC_PANELG_H_ + +#include "wx/bitmap.h" + +class WXDLLIMPEXP_CORE wxPanel : public wxPanelBase +{ +public: + wxPanel() { } + + // Constructor + wxPanel(wxWindow *parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTAB_TRAVERSAL | wxNO_BORDER, + const wxString& name = wxASCII_STR(wxPanelNameStr)) + { + Create(parent, winid, pos, size, style, name); + } + +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED_CONSTRUCTOR( + wxPanel(wxWindow *parent, + int x, int y, int width, int height, + long style = wxTAB_TRAVERSAL | wxNO_BORDER, + const wxString& name = wxASCII_STR(wxPanelNameStr)) + { + Create(parent, wxID_ANY, wxPoint(x, y), wxSize(width, height), style, name); + } + ) +#endif // WXWIN_COMPATIBILITY_2_8 + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxPanel); +}; + +#endif // _WX_GENERIC_PANELG_H_ diff --git a/lib/wxWidgets/include/wx/generic/printps.h b/lib/wxWidgets/include/wx/generic/printps.h new file mode 100644 index 0000000..7d83738 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/printps.h @@ -0,0 +1,67 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/printps.h +// Purpose: wxPostScriptPrinter, wxPostScriptPrintPreview +// wxGenericPageSetupDialog +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __PRINTPSH__ +#define __PRINTPSH__ + +#include "wx/prntbase.h" + +#if wxUSE_PRINTING_ARCHITECTURE && wxUSE_POSTSCRIPT + +// ---------------------------------------------------------------------------- +// Represents the printer: manages printing a wxPrintout object +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPostScriptPrinter : public wxPrinterBase +{ +public: + wxPostScriptPrinter(wxPrintDialogData *data = NULL); + virtual ~wxPostScriptPrinter(); + + virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true) wxOVERRIDE; + virtual wxDC* PrintDialog(wxWindow *parent) wxOVERRIDE; + virtual bool Setup(wxWindow *parent) wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxPostScriptPrinter); +}; + +// ---------------------------------------------------------------------------- +// wxPrintPreview: programmer creates an object of this class to preview a +// wxPrintout. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPostScriptPrintPreview : public wxPrintPreviewBase +{ +public: + wxPostScriptPrintPreview(wxPrintout *printout, + wxPrintout *printoutForPrinting = NULL, + wxPrintDialogData *data = NULL); + wxPostScriptPrintPreview(wxPrintout *printout, + wxPrintout *printoutForPrinting, + wxPrintData *data); + + virtual ~wxPostScriptPrintPreview(); + + virtual bool Print(bool interactive) wxOVERRIDE; + virtual void DetermineScaling() wxOVERRIDE; + +private: + void Init(wxPrintout *printout, wxPrintout *printoutForPrinting); + +private: + wxDECLARE_CLASS(wxPostScriptPrintPreview); +}; + +#endif + +#endif +// __PRINTPSH__ diff --git a/lib/wxWidgets/include/wx/generic/private/addremovectrl.h b/lib/wxWidgets/include/wx/generic/private/addremovectrl.h new file mode 100644 index 0000000..2eea6fa --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/private/addremovectrl.h @@ -0,0 +1,65 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/private/addremovectrl.h +// Purpose: Generic wxAddRemoveImpl implementation, also used in wxMSW +// Author: Vadim Zeitlin +// Created: 2015-02-05 +// Copyright: (c) 2015 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_PRIVATE_ADDREMOVECTRL_H_ +#define _WX_GENERIC_PRIVATE_ADDREMOVECTRL_H_ + +// ---------------------------------------------------------------------------- +// wxAddRemoveImpl +// ---------------------------------------------------------------------------- + +class wxAddRemoveImpl : public wxAddRemoveImplWithButtons +{ +public: + wxAddRemoveImpl(wxAddRemoveAdaptor* adaptor, + wxAddRemoveCtrl* parent, + wxWindow* ctrlItems) + : wxAddRemoveImplWithButtons(adaptor, parent, ctrlItems) + { + m_btnAdd = new wxButton(parent, wxID_ADD, GetAddButtonLabel(), + wxDefaultPosition, wxDefaultSize, + wxBU_EXACTFIT | wxBORDER_NONE); + m_btnRemove = new wxButton(parent, wxID_REMOVE, GetRemoveButtonLabel(), + wxDefaultPosition, wxDefaultSize, + wxBU_EXACTFIT | wxBORDER_NONE); + + wxSizer* const sizerBtns = new wxBoxSizer(wxVERTICAL); + sizerBtns->Add(m_btnAdd, wxSizerFlags().Expand()); + sizerBtns->Add(m_btnRemove, wxSizerFlags().Expand()); + + wxSizer* const sizerTop = new wxBoxSizer(wxHORIZONTAL); + sizerTop->Add(ctrlItems, wxSizerFlags(1).Expand()); + sizerTop->Add(sizerBtns, wxSizerFlags().Centre().Border(wxLEFT)); + parent->SetSizer(sizerTop); + + SetUpEvents(); + } + +private: + static wxString GetAddButtonLabel() + { +#if wxUSE_UNICODE + return wchar_t(0xFF0B); // FULLWIDTH PLUS SIGN +#else + return "+"; +#endif + } + + static wxString GetRemoveButtonLabel() + { +#if wxUSE_UNICODE + return wchar_t(0x2012); // FIGURE DASH +#else + return "-"; +#endif + } + +}; + +#endif // _WX_GENERIC_PRIVATE_ADDREMOVECTRL_H_ diff --git a/lib/wxWidgets/include/wx/generic/private/animate.h b/lib/wxWidgets/include/wx/generic/private/animate.h new file mode 100644 index 0000000..9906b0c --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/private/animate.h @@ -0,0 +1,56 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/private/animate.h +// Purpose: wxAnimationGenericImpl +// 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_GENERIC_PRIVATE_ANIMATEH__ +#define _WX_GENERIC_PRIVATE_ANIMATEH__ + +#include "wx/private/animate.h" + +// ---------------------------------------------------------------------------- +// wxAnimationGenericImpl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxAnimationGenericImpl : public wxAnimationImpl +{ +public: + wxAnimationGenericImpl() : m_decoder(NULL) {} + virtual ~wxAnimationGenericImpl() { UnRef(); } + + virtual bool IsOk() const wxOVERRIDE + { return m_decoder != NULL; } + virtual bool IsCompatibleWith(wxClassInfo* ci) const wxOVERRIDE; + + virtual unsigned int GetFrameCount() const wxOVERRIDE; + virtual int GetDelay(unsigned int i) const wxOVERRIDE; + virtual wxImage GetFrame(unsigned int i) const wxOVERRIDE; + virtual wxSize GetSize() const wxOVERRIDE; + + virtual bool LoadFile(const wxString& filename, + wxAnimationType type = wxANIMATION_TYPE_ANY) wxOVERRIDE; + virtual bool Load(wxInputStream& stream, + wxAnimationType type = wxANIMATION_TYPE_ANY) wxOVERRIDE; + + // extended interface used only by the generic implementation of wxAnimationCtrl + virtual wxPoint GetFramePosition(unsigned int frame) const; + virtual wxSize GetFrameSize(unsigned int frame) const; + virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const; + virtual wxColour GetTransparentColour(unsigned int frame) const; + virtual wxColour GetBackgroundColour() const; + +private: + void UnRef(); + + wxAnimationDecoder* m_decoder; + + wxDECLARE_NO_COPY_CLASS(wxAnimationGenericImpl); +}; + + +#endif // _WX_GENERIC_PRIVATE_ANIMATEH__ diff --git a/lib/wxWidgets/include/wx/generic/private/drawbitmap.h b/lib/wxWidgets/include/wx/generic/private/drawbitmap.h new file mode 100644 index 0000000..af6d64e --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/private/drawbitmap.h @@ -0,0 +1,41 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/private/drawbitmap.h +// Purpose: Small helper for drawing images. +// Author: Vadim Zeitlin +// Created: 2022-10-25 +// Copyright: (c) 2022 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_PRIVATE_DRAWBITMAP_H_ +#define _WX_GENERIC_PRIVATE_DRAWBITMAP_H_ + +#include "wx/dc.h" +#include "wx/window.h" +#include "wx/withimages.h" + +// Just a trivial wrapper for wxDC::DrawBitmap() using wxWithImages: this is +// used in several places in the generic wxListCtrl and wxTreeCtrl code. +inline void +wxDrawImageBitmap(wxWindow* window, + const wxWithImages& images, + int image, + wxDC& dc, + int x, + int y) +{ + dc.DrawBitmap(images.GetImageBitmapFor(window, image), + x, y, + true /* use mask */); +} + +// Overload for the controls deriving from both wxWindow and wxWithImages, as +// both wxListCtrl and wxTreeCtrl do. +template +inline void +wxDrawImageBitmap(T* window, int image, wxDC& dc, int x, int y) +{ + wxDrawImageBitmap(window, *window, image, dc, x, y); +} + +#endif // _WX_GENERIC_PRIVATE_DRAWBITMAP_H_ diff --git a/lib/wxWidgets/include/wx/generic/private/grid.h b/lib/wxWidgets/include/wx/generic/private/grid.h new file mode 100644 index 0000000..9ada566 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/private/grid.h @@ -0,0 +1,1269 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/private/grid.h +// Purpose: Private wxGrid structures +// Author: Michael Bedward (based on code by Julian Smart, Robin Dunn) +// Modified by: Santiago Palacios +// Created: 1/08/1999 +// Copyright: (c) Michael Bedward +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_GRID_PRIVATE_H_ +#define _WX_GENERIC_GRID_PRIVATE_H_ + +#include "wx/defs.h" + +#if wxUSE_GRID + +#include "wx/headerctrl.h" + +// for wxGridOperations +#include "wx/generic/gridsel.h" + +// ---------------------------------------------------------------------------- +// array classes +// ---------------------------------------------------------------------------- + +WX_DEFINE_ARRAY_WITH_DECL_PTR(wxGridCellAttr *, wxArrayAttrs, + class WXDLLIMPEXP_ADV); + +WX_DECLARE_HASH_MAP_WITH_DECL(wxLongLong_t, wxGridCellAttr*, + wxIntegerHash, wxIntegerEqual, + wxGridCoordsToAttrMap, class WXDLLIMPEXP_CORE); + + +// ---------------------------------------------------------------------------- +// private classes +// ---------------------------------------------------------------------------- + +// header column providing access to the column information stored in wxGrid +// via wxHeaderColumn interface +class wxGridHeaderColumn : public wxHeaderColumn +{ +public: + wxGridHeaderColumn(wxGrid *grid, int col) + : m_grid(grid), + m_col(col) + { + } + + virtual wxString GetTitle() const wxOVERRIDE { return m_grid->GetColLabelValue(m_col); } + virtual wxBitmap GetBitmap() const wxOVERRIDE { return wxNullBitmap; } + virtual wxBitmapBundle GetBitmapBundle() const wxOVERRIDE { return wxBitmapBundle(); } + virtual int GetWidth() const wxOVERRIDE { return m_grid->GetColSize(m_col); } + virtual int GetMinWidth() const wxOVERRIDE { return m_grid->GetColMinimalWidth(m_col); } + virtual wxAlignment GetAlignment() const wxOVERRIDE + { + int horz, + vert; + m_grid->GetColLabelAlignment(&horz, &vert); + + return static_cast(horz); + } + + virtual int GetFlags() const wxOVERRIDE + { + // we can't know in advance whether we can sort by this column or not + // with wxGrid API so suppose we can by default + int flags = wxCOL_SORTABLE; + if ( m_grid->CanDragColSize(m_col) ) + flags |= wxCOL_RESIZABLE; + if ( m_grid->CanDragColMove() ) + flags |= wxCOL_REORDERABLE; + if ( GetWidth() == 0 ) + flags |= wxCOL_HIDDEN; + + return flags; + } + + virtual bool IsSortKey() const wxOVERRIDE + { + return m_grid->IsSortingBy(m_col); + } + + virtual bool IsSortOrderAscending() const wxOVERRIDE + { + return m_grid->IsSortOrderAscending(); + } + +private: + // these really should be const but are not because the column needs to be + // assignable to be used in a wxVector (in STL build, in non-STL build we + // avoid the need for this) + wxGrid *m_grid; + int m_col; +}; + +// header control retrieving column information from the grid +class wxGridHeaderCtrl : public wxHeaderCtrl +{ +public: + wxGridHeaderCtrl(wxGrid *owner) + : wxHeaderCtrl(owner, + wxID_ANY, + wxDefaultPosition, + wxDefaultSize, + (owner->CanHideColumns() ? wxHD_ALLOW_HIDE : 0) | + (owner->CanDragColMove() ? wxHD_ALLOW_REORDER : 0)) + { + m_inResizing = 0; + } + + // Special method to call from wxGrid::DoSetColSize(), see comments there. + void UpdateIfNotResizing(unsigned int idx) + { + if ( !m_inResizing ) + UpdateColumn(idx); + } + +protected: + virtual const wxHeaderColumn& GetColumn(unsigned int idx) const wxOVERRIDE + { + return m_columns[idx]; + } + + wxGrid *GetOwner() const { return static_cast(GetParent()); } + +private: + wxMouseEvent GetDummyMouseEvent() const + { + // make up a dummy event for the grid event to use -- unfortunately we + // can't do anything else here + wxMouseEvent e; + e.SetState(wxGetMouseState()); + GetOwner()->ScreenToClient(&e.m_x, &e.m_y); + return e; + } + + // override the base class method to update our m_columns array + virtual void OnColumnCountChanging(unsigned int count) wxOVERRIDE + { + const unsigned countOld = m_columns.size(); + if ( count < countOld ) + { + // just discard the columns which don't exist any more (notice that + // we can't use resize() here as it would require the vector + // value_type, i.e. wxGridHeaderColumn to be default constructible, + // which it is not) + m_columns.erase(m_columns.begin() + count, m_columns.end()); + } + else // new columns added + { + // add columns for the new elements + for ( unsigned n = countOld; n < count; n++ ) + m_columns.push_back(wxGridHeaderColumn(GetOwner(), n)); + } + } + + // override to implement column auto sizing + virtual bool UpdateColumnWidthToFit(unsigned int idx, int WXUNUSED(widthTitle)) wxOVERRIDE + { + GetOwner()->HandleColumnAutosize(idx, GetDummyMouseEvent()); + + return true; + } + + // overridden to react to the actions using the columns popup menu + virtual void UpdateColumnVisibility(unsigned int idx, bool show) wxOVERRIDE + { + GetOwner()->SetColSize(idx, show ? wxGRID_AUTOSIZE : 0); + + // as this is done by the user we should notify the main program about + // it + GetOwner()->SendGridSizeEvent(wxEVT_GRID_COL_SIZE, idx, + GetDummyMouseEvent()); + } + + // overridden to react to the columns order changes in the customization + // dialog + virtual void UpdateColumnsOrder(const wxArrayInt& order) wxOVERRIDE + { + GetOwner()->SetColumnsOrder(order); + } + + + // event handlers forwarding wxHeaderCtrl events to wxGrid + void OnClick(wxHeaderCtrlEvent& event) + { + GetOwner()->SendEvent(wxEVT_GRID_LABEL_LEFT_CLICK, + -1, event.GetColumn(), + GetDummyMouseEvent()); + + GetOwner()->DoColHeaderClick(event.GetColumn()); + } + + void OnDoubleClick(wxHeaderCtrlEvent& event) + { + if ( !GetOwner()->SendEvent(wxEVT_GRID_LABEL_LEFT_DCLICK, + -1, event.GetColumn(), + GetDummyMouseEvent()) ) + { + event.Skip(); + } + } + + void OnRightClick(wxHeaderCtrlEvent& event) + { + if ( !GetOwner()->SendEvent(wxEVT_GRID_LABEL_RIGHT_CLICK, + -1, event.GetColumn(), + GetDummyMouseEvent()) ) + { + event.Skip(); + } + } + + void OnBeginResize(wxHeaderCtrlEvent& event) + { + GetOwner()->DoHeaderStartDragResizeCol(event.GetColumn()); + + event.Skip(); + } + + void OnResizing(wxHeaderCtrlEvent& event) + { + // Calling wxGrid method results in a call to our own UpdateColumn() + // because it ends up in wxGrid::SetColSize() which must indeed update + // the column when it's called by the program -- but in the case where + // the size change comes from the column itself, it is useless and, in + // fact, harmful, as it results in extra flicker due to the inefficient + // implementation of UpdateColumn() in wxMSW wxHeaderCtrl, so skip + // calling it from our overridden version by setting this flag for the + // duration of this function execution and checking it in our + // UpdateIfNotResizing(). + m_inResizing++; + + GetOwner()->DoHeaderDragResizeCol(event.GetWidth()); + + m_inResizing--; + } + + void OnEndResize(wxHeaderCtrlEvent& event) + { + GetOwner()->DoHeaderEndDragResizeCol(event.GetWidth()); + + event.Skip(); + } + + void OnBeginReorder(wxHeaderCtrlEvent& event) + { + GetOwner()->DoStartMoveRowOrCol(event.GetColumn()); + } + + void OnEndReorder(wxHeaderCtrlEvent& event) + { + GetOwner()->DoEndMoveCol(event.GetNewOrder()); + } + + wxVector m_columns; + + // The count of OnResizing() call nesting, 0 if not inside it. + int m_inResizing; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxGridHeaderCtrl); +}; + +// common base class for various grid subwindows +class WXDLLIMPEXP_ADV wxGridSubwindow : public wxWindow +{ +public: + wxGridSubwindow(wxGrid *owner, + int additionalStyle = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)) + : wxWindow(owner, wxID_ANY, + wxDefaultPosition, wxDefaultSize, + wxBORDER_NONE | additionalStyle, + name) + { + m_owner = owner; + } + + virtual wxWindow *GetMainWindowOfCompositeControl() wxOVERRIDE { return m_owner; } + + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } + + wxGrid *GetOwner() { return m_owner; } + + virtual bool IsFrozen() const { return false; } + +protected: + void OnMouseCaptureLost(wxMouseCaptureLostEvent& event); + + wxGrid *m_owner; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxGridSubwindow); +}; + +class WXDLLIMPEXP_ADV wxGridRowLabelWindow : public wxGridSubwindow +{ +public: + wxGridRowLabelWindow(wxGrid *parent) + : wxGridSubwindow(parent) + { + } + +private: + void OnPaint( wxPaintEvent& event ); + void OnMouseEvent( wxMouseEvent& event ); + void OnMouseWheel( wxMouseEvent& event ); + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxGridRowLabelWindow); +}; + + +class wxGridRowFrozenLabelWindow : public wxGridRowLabelWindow +{ +public: + wxGridRowFrozenLabelWindow(wxGrid *parent) + : wxGridRowLabelWindow(parent) + { + } + + virtual bool IsFrozen() const wxOVERRIDE { return true; } +}; + + +class WXDLLIMPEXP_ADV wxGridColLabelWindow : public wxGridSubwindow +{ +public: + wxGridColLabelWindow(wxGrid *parent) + : wxGridSubwindow(parent) + { + } + +private: + void OnPaint( wxPaintEvent& event ); + void OnMouseEvent( wxMouseEvent& event ); + void OnMouseWheel( wxMouseEvent& event ); + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxGridColLabelWindow); +}; + + +class wxGridColFrozenLabelWindow : public wxGridColLabelWindow +{ +public: + wxGridColFrozenLabelWindow(wxGrid *parent) + : wxGridColLabelWindow(parent) + { + } + + virtual bool IsFrozen() const wxOVERRIDE { return true; } +}; + + +class WXDLLIMPEXP_ADV wxGridCornerLabelWindow : public wxGridSubwindow +{ +public: + wxGridCornerLabelWindow(wxGrid *parent) + : wxGridSubwindow(parent) + { + } + +private: + void OnMouseEvent( wxMouseEvent& event ); + void OnMouseWheel( wxMouseEvent& event ); + void OnPaint( wxPaintEvent& event ); + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxGridCornerLabelWindow); +}; + +class WXDLLIMPEXP_ADV wxGridWindow : public wxGridSubwindow +{ +public: + // grid window variants for scrolling possibilities + enum wxGridWindowType + { + wxGridWindowNormal = 0, + wxGridWindowFrozenCol = 1, + wxGridWindowFrozenRow = 2, + wxGridWindowFrozenCorner = wxGridWindowFrozenCol | + wxGridWindowFrozenRow + }; + + wxGridWindow(wxGrid *parent, wxGridWindowType type) + : wxGridSubwindow(parent, + wxWANTS_CHARS | wxCLIP_CHILDREN, + "GridWindow"), + m_type(type) + { + SetBackgroundStyle(wxBG_STYLE_PAINT); + } + + + virtual void ScrollWindow( int dx, int dy, const wxRect *rect ) wxOVERRIDE; + + virtual bool AcceptsFocus() const wxOVERRIDE { return true; } + + wxGridWindowType GetType() const { return m_type; } + +private: + const wxGridWindowType m_type; + + void OnPaint( wxPaintEvent &event ); + void OnMouseWheel( wxMouseEvent& event ); + void OnMouseEvent( wxMouseEvent& event ); + void OnKeyDown( wxKeyEvent& ); + void OnKeyUp( wxKeyEvent& ); + void OnChar( wxKeyEvent& ); + void OnFocus( wxFocusEvent& ); + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxGridWindow); +}; + +// ---------------------------------------------------------------------------- +// the internal data representation used by wxGridCellAttrProvider +// ---------------------------------------------------------------------------- + +// this class stores attributes set for cells +class WXDLLIMPEXP_ADV wxGridCellAttrData +{ +public: + ~wxGridCellAttrData(); + + void SetAttr(wxGridCellAttr *attr, int row, int col); + wxGridCellAttr *GetAttr(int row, int col) const; + void UpdateAttrRows( size_t pos, int numRows ); + void UpdateAttrCols( size_t pos, int numCols ); + +private: + // Tries to search for the attr for given cell. + wxGridCoordsToAttrMap::iterator FindIndex(int row, int col) const; + + mutable wxGridCoordsToAttrMap m_attrs; +}; + +// this class stores attributes set for rows or columns +class WXDLLIMPEXP_ADV wxGridRowOrColAttrData +{ +public: + // empty ctor to suppress warnings + wxGridRowOrColAttrData() {} + ~wxGridRowOrColAttrData(); + + void SetAttr(wxGridCellAttr *attr, int rowOrCol); + wxGridCellAttr *GetAttr(int rowOrCol) const; + void UpdateAttrRowsOrCols( size_t pos, int numRowsOrCols ); + +private: + wxArrayInt m_rowsOrCols; + wxArrayAttrs m_attrs; +}; + +// NB: this is just a wrapper around 3 objects: one which stores cell +// attributes, and 2 others for row/col ones +class WXDLLIMPEXP_ADV wxGridCellAttrProviderData +{ +public: + wxGridCellAttrData m_cellAttrs; + wxGridRowOrColAttrData m_rowAttrs, + m_colAttrs; +}; + +// ---------------------------------------------------------------------------- +// operations classes abstracting the difference between operating on rows and +// columns +// ---------------------------------------------------------------------------- + +// This class allows to write a function only once because by using its methods +// it will apply to both columns and rows. +// +// This is an abstract interface definition, the two concrete implementations +// below should be used when working with rows and columns respectively. +class wxGridOperations +{ +public: + // Returns the operations in the other direction, i.e. wxGridRowOperations + // if this object is a wxGridColumnOperations and vice versa. + virtual wxGridOperations& Dual() const = 0; + + // returns wxHORIZONTAL or wxVERTICAL for row/col operations + virtual int GetOrientation() const = 0; + + // return row/col specific cursor modes + virtual wxGrid::CursorMode GetCursorModeResize() const = 0; + virtual wxGrid::CursorMode GetCursorModeSelect() const = 0; + virtual wxGrid::CursorMode GetCursorModeMove() const = 0; + + // Return the total number of rows or columns. + virtual int GetTotalNumberOfLines(const wxGrid *grid) const = 0; + + // Return the current number of rows or columns of a grid window. + virtual int GetNumberOfLines(const wxGrid *grid, wxGridWindow *gridWindow) const = 0; + + // Return the first line for this grid type. + virtual int GetFirstLine(const wxGrid *grid, wxGridWindow *gridWindow) const = 0; + + // Return the selection mode which allows selecting rows or columns. + virtual wxGrid::wxGridSelectionModes GetSelectionMode() const = 0; + + // Make a wxGridCellCoords from the given components: thisDir is row or + // column and otherDir is column or row + virtual wxGridCellCoords MakeCoords(int thisDir, int otherDir) const = 0; + + // Calculate the scrolled position of the given abscissa or ordinate. + virtual int CalcScrolledPosition(wxGrid *grid, int pos) const = 0; + + // Selects the horizontal or vertical component from the given object. + virtual int Select(const wxGridCellCoords& coords) const = 0; + virtual int Select(const wxPoint& pt) const = 0; + virtual int Select(const wxSize& sz) const = 0; + virtual int Select(const wxRect& r) const = 0; + virtual int& Select(wxRect& r) const = 0; + + // Return or set left/top or right/bottom component of a block. + virtual int SelectFirst(const wxGridBlockCoords& block) const = 0; + virtual int SelectLast(const wxGridBlockCoords& block) const = 0; + virtual void SetFirst(wxGridBlockCoords& block, int line) const = 0; + virtual void SetLast(wxGridBlockCoords& block, int line) const = 0; + + // Returns width or height of the rectangle + virtual int& SelectSize(wxRect& r) const = 0; + + // Make a wxSize such that Select() applied to it returns first component + virtual wxSize MakeSize(int first, int second) const = 0; + + // Sets the row or column component of the given cell coordinates + virtual void Set(wxGridCellCoords& coords, int line) const = 0; + + + // Draws a line parallel to the row or column, i.e. horizontal or vertical: + // pos is the horizontal or vertical position of the line and start and end + // are the coordinates of the line extremities in the other direction + virtual void + DrawParallelLine(wxDC& dc, int start, int end, int pos) const = 0; + + // Draw a horizontal or vertical line across the given rectangle + // (this is implemented in terms of above and uses Select() to extract + // start and end from the given rectangle) + void DrawParallelLineInRect(wxDC& dc, const wxRect& rect, int pos) const + { + const int posStart = Select(rect.GetPosition()); + DrawParallelLine(dc, posStart, posStart + Select(rect.GetSize()), pos); + } + + + // Return the index of the row or column at the given pixel coordinate. + virtual int + PosToLine(const wxGrid *grid, int pos, wxGridWindow *gridWindow, bool clip = false) const = 0; + + // Get the top/left position, in pixels, of the given row or column + virtual int GetLineStartPos(const wxGrid *grid, int line) const = 0; + + // Get the bottom/right position, in pixels, of the given row or column + virtual int GetLineEndPos(const wxGrid *grid, int line) const = 0; + + // Get the height/width of the given row/column + virtual int GetLineSize(const wxGrid *grid, int line) const = 0; + + // Get wxGrid::m_rowBottoms/m_colRights array + virtual const wxArrayInt& GetLineEnds(const wxGrid *grid) const = 0; + + // Get default height row height or column width + virtual int GetDefaultLineSize(const wxGrid *grid) const = 0; + + // Return the minimal acceptable row height or column width + virtual int GetMinimalAcceptableLineSize(const wxGrid *grid) const = 0; + + // Return the minimal row height or column width + virtual int GetMinimalLineSize(const wxGrid *grid, int line) const = 0; + + // Set the row height or column width + virtual void SetLineSize(wxGrid *grid, int line, int size) const = 0; + + // Set the row default height or column default width + virtual void SetDefaultLineSize(wxGrid *grid, int size, bool resizeExisting) const = 0; + + // auto size the row height or column width from the label content + virtual void HandleLineAutosize(wxGrid *grid, int line, const wxMouseEvent& event) const = 0; + + // Return the index of the line at the given position + virtual int GetLineAt(const wxGrid *grid, int pos) const = 0; + + // Return the display position of the line with the given index. + virtual int GetLinePos(const wxGrid *grid, int line) const = 0; + + // Return the index of the line just before the given one or wxNOT_FOUND. + virtual int GetLineBefore(const wxGrid* grid, int line) const = 0; + + // Get the row or column label window + virtual wxWindow *GetHeaderWindow(wxGrid *grid) const = 0; + + // Get the width or height of the row or column label window + virtual int GetHeaderWindowSize(wxGrid *grid) const = 0; + + // Get the row or column frozen grid window + virtual wxGridWindow *GetFrozenGrid(wxGrid* grid) const = 0; + + + // return the value of m_canDragRow/ColMove + virtual bool CanDragMove(wxGrid *grid) const = 0; + + // call DoEndMoveRow or DoEndMoveColumn + virtual void DoEndMove(wxGrid* grid, int line) const = 0; + + // return whether the given row/column can be interactively resized + virtual bool CanDragLineSize(wxGrid *grid, int line) const = 0; + + // call DoEndDragResizeRow or DoEndDragResizeCol + virtual void DoEndLineResize(wxGrid *grid, const wxMouseEvent& event, wxGridWindow* gridWindow) const = 0; + + + // extend current selection block up to given row or column + virtual bool SelectionExtendCurrentBlock(wxGrid *grid, int line, + const wxMouseEvent &event, + wxEventType eventType = wxEVT_GRID_RANGE_SELECTED) const = 0; + + // select or de-select a row or column + virtual void SelectLine(wxGrid *grid, int line, wxMouseEvent &event) const = 0; + virtual void DeselectLine(wxGrid * grid, int line) const = 0; + + // check whether the row or columns first cell is in selected + virtual bool IsLineInSelection(wxGrid *grid, int line) const = 0; + + + // sent a result with row or column and the other value -1 + virtual wxGrid::EventResult SendEvent(wxGrid *grid, wxEventType eventType, + int line, const wxMouseEvent& event) const = 0; + + // call DrawRowLabel or DrawColumnLabel + virtual void DrawLineLabel(wxGrid *grid, wxDC& dc, int line) const = 0; + + // helper for Process...MouseEvent for drawing markers on label windows + void PrepareDCForLabels(wxGrid *grid, wxDC &dc) const; + + // make the specified line visible by doing a minimal amount of scrolling + virtual void MakeLineVisible(wxGrid *grid, int line) const = 0; + + // set cursor into the first visible cell of the given row or column + virtual void MakeLineCurrent(wxGrid *grid, int line) const = 0; + + + // This class is never used polymorphically but give it a virtual dtor + // anyhow to suppress g++ complaints about it + virtual ~wxGridOperations() { } +}; + +class wxGridRowOperations : public wxGridOperations +{ +public: + virtual wxGridOperations& Dual() const wxOVERRIDE; + + virtual int GetOrientation() const wxOVERRIDE + { return wxVERTICAL; } + + virtual wxGrid::CursorMode GetCursorModeResize() const wxOVERRIDE + { return wxGrid::WXGRID_CURSOR_RESIZE_ROW; } + virtual wxGrid::CursorMode GetCursorModeSelect() const wxOVERRIDE + { return wxGrid::WXGRID_CURSOR_SELECT_ROW; } + virtual wxGrid::CursorMode GetCursorModeMove() const wxOVERRIDE + { return wxGrid::WXGRID_CURSOR_MOVE_ROW; } + + virtual int GetTotalNumberOfLines(const wxGrid *grid) const wxOVERRIDE + { return grid->GetNumberRows(); } + + virtual int GetNumberOfLines(const wxGrid *grid, wxGridWindow *gridWindow) const wxOVERRIDE; + + virtual int GetFirstLine(const wxGrid *grid, wxGridWindow *gridWindow) const wxOVERRIDE; + + virtual wxGrid::wxGridSelectionModes GetSelectionMode() const wxOVERRIDE + { return wxGrid::wxGridSelectRows; } + + virtual wxGridCellCoords MakeCoords(int thisDir, int otherDir) const wxOVERRIDE + { return wxGridCellCoords(thisDir, otherDir); } + + virtual int CalcScrolledPosition(wxGrid *grid, int pos) const wxOVERRIDE + { return grid->CalcScrolledPosition(wxPoint(pos, 0)).x; } + + virtual int Select(const wxGridCellCoords& c) const wxOVERRIDE { return c.GetRow(); } + virtual int Select(const wxPoint& pt) const wxOVERRIDE { return pt.x; } + virtual int Select(const wxSize& sz) const wxOVERRIDE { return sz.x; } + virtual int Select(const wxRect& r) const wxOVERRIDE { return r.x; } + virtual int& Select(wxRect& r) const wxOVERRIDE { return r.x; } + virtual int SelectFirst(const wxGridBlockCoords& block) const wxOVERRIDE + { return block.GetTopRow(); } + virtual int SelectLast(const wxGridBlockCoords& block) const wxOVERRIDE + { return block.GetBottomRow(); } + virtual void SetFirst(wxGridBlockCoords& block, int line) const wxOVERRIDE + { block.SetTopRow(line); } + virtual void SetLast(wxGridBlockCoords& block, int line) const wxOVERRIDE + { block.SetBottomRow(line); } + virtual int& SelectSize(wxRect& r) const wxOVERRIDE { return r.width; } + virtual wxSize MakeSize(int first, int second) const wxOVERRIDE + { return wxSize(first, second); } + virtual void Set(wxGridCellCoords& coords, int line) const wxOVERRIDE + { coords.SetRow(line); } + + virtual void DrawParallelLine(wxDC& dc, int start, int end, int pos) const wxOVERRIDE + { dc.DrawLine(start, pos, end, pos); } + + virtual int PosToLine(const wxGrid *grid, int pos, wxGridWindow *gridWindow , bool clip = false) const wxOVERRIDE + { return grid->YToRow(pos, clip, gridWindow); } + virtual int GetLineStartPos(const wxGrid *grid, int line) const wxOVERRIDE + { return grid->GetRowTop(line); } + virtual int GetLineEndPos(const wxGrid *grid, int line) const wxOVERRIDE + { return grid->GetRowBottom(line); } + virtual int GetLineSize(const wxGrid *grid, int line) const wxOVERRIDE + { return grid->GetRowHeight(line); } + virtual const wxArrayInt& GetLineEnds(const wxGrid *grid) const wxOVERRIDE + { return grid->m_rowBottoms; } + virtual int GetDefaultLineSize(const wxGrid *grid) const wxOVERRIDE + { return grid->GetDefaultRowSize(); } + virtual int GetMinimalAcceptableLineSize(const wxGrid *grid) const wxOVERRIDE + { return grid->GetRowMinimalAcceptableHeight(); } + virtual int GetMinimalLineSize(const wxGrid *grid, int line) const wxOVERRIDE + { return grid->GetRowMinimalHeight(line); } + virtual void SetLineSize(wxGrid *grid, int line, int size) const wxOVERRIDE + { grid->SetRowSize(line, size); } + virtual void SetDefaultLineSize(wxGrid *grid, int size, bool resizeExisting) const wxOVERRIDE + { grid->SetDefaultRowSize(size, resizeExisting); } + virtual void HandleLineAutosize(wxGrid *grid, int line, const wxMouseEvent& event) const wxOVERRIDE + { grid->HandleRowAutosize(line, event); } + + virtual int GetLineAt(const wxGrid *grid, int pos) const wxOVERRIDE + { return grid->GetRowAt(pos); } + virtual int GetLinePos(const wxGrid *grid, int line) const wxOVERRIDE + { return grid->GetRowPos(line); } + + virtual int GetLineBefore(const wxGrid *grid, int line) const wxOVERRIDE + { + int posBefore = grid->GetRowPos(line) - 1; + return posBefore >= 0 ? grid->GetRowAt(posBefore) : wxNOT_FOUND; + } + + virtual wxWindow *GetHeaderWindow(wxGrid *grid) const wxOVERRIDE + { return grid->GetGridRowLabelWindow(); } + virtual int GetHeaderWindowSize(wxGrid *grid) const wxOVERRIDE + { return grid->GetRowLabelSize(); } + + virtual wxGridWindow *GetFrozenGrid(wxGrid* grid) const wxOVERRIDE + { return (wxGridWindow*)grid->GetFrozenRowGridWindow(); } + + virtual bool CanDragMove(wxGrid *grid) const wxOVERRIDE + { return grid->m_canDragRowMove; } + virtual void DoEndMove(wxGrid* grid, int line) const wxOVERRIDE + { grid->DoEndMoveRow(line); } + + virtual bool CanDragLineSize(wxGrid *grid, int line) const wxOVERRIDE + { return grid->CanDragRowSize(line); } + virtual void DoEndLineResize(wxGrid *grid, const wxMouseEvent& event, + wxGridWindow* gridWindow) const wxOVERRIDE + { grid->DoEndDragResizeRow(event, gridWindow); } + + + virtual bool SelectionExtendCurrentBlock(wxGrid *grid, int line, + const wxMouseEvent &event, + wxEventType eventType = wxEVT_GRID_RANGE_SELECTED) const wxOVERRIDE + { + return grid->m_selection->ExtendCurrentBlock + ( + wxGridCellCoords(grid->m_currentCellCoords.GetRow(), 0), + wxGridCellCoords(line, grid->GetNumberCols() - 1), + event, + eventType + ); + } + + virtual void SelectLine(wxGrid *grid, int line, wxMouseEvent &event) const wxOVERRIDE + { grid->m_selection->SelectRow(line, event); }; + virtual void DeselectLine(wxGrid * grid, int line) const wxOVERRIDE + { grid->DeselectRow(line); } + + virtual bool IsLineInSelection(wxGrid *grid, int line) const wxOVERRIDE + { return grid->m_selection->IsInSelection(line, 0); } + + virtual wxGrid::EventResult SendEvent(wxGrid *grid, wxEventType eventType, + int line, const wxMouseEvent& event) const wxOVERRIDE + { return grid->SendEvent(eventType, line, -1, event ); } + + virtual void DrawLineLabel(wxGrid *grid, wxDC& dc, int line) const wxOVERRIDE + { grid->DrawRowLabel(dc, line); } + + virtual void MakeLineVisible(wxGrid *grid, int line) const wxOVERRIDE + { grid->MakeCellVisible(line, -1); } + virtual void MakeLineCurrent(wxGrid *grid, int line) const wxOVERRIDE + { grid->SetCurrentCell(line, grid->GetFirstFullyVisibleColumn()); } + +}; + +class wxGridColumnOperations : public wxGridOperations +{ + +public: + virtual wxGridOperations& Dual() const wxOVERRIDE; + + virtual int GetOrientation() const wxOVERRIDE + { return wxHORIZONTAL; } + + virtual wxGrid::CursorMode GetCursorModeResize() const wxOVERRIDE + { return wxGrid::WXGRID_CURSOR_RESIZE_COL; } + virtual wxGrid::CursorMode GetCursorModeSelect() const wxOVERRIDE + { return wxGrid::WXGRID_CURSOR_SELECT_COL; } + virtual wxGrid::CursorMode GetCursorModeMove() const wxOVERRIDE + { return wxGrid::WXGRID_CURSOR_MOVE_COL; } + + virtual int GetTotalNumberOfLines(const wxGrid *grid) const wxOVERRIDE + { return grid->GetNumberCols(); } + + virtual int GetNumberOfLines(const wxGrid *grid, wxGridWindow *gridWindow) const wxOVERRIDE; + + virtual int GetFirstLine(const wxGrid *grid, wxGridWindow *gridWindow) const wxOVERRIDE; + + virtual wxGrid::wxGridSelectionModes GetSelectionMode() const wxOVERRIDE + { return wxGrid::wxGridSelectColumns; } + + virtual wxGridCellCoords MakeCoords(int thisDir, int otherDir) const wxOVERRIDE + { return wxGridCellCoords(otherDir, thisDir); } + + virtual int CalcScrolledPosition(wxGrid *grid, int pos) const wxOVERRIDE + { return grid->CalcScrolledPosition(wxPoint(0, pos)).y; } + + virtual int Select(const wxGridCellCoords& c) const wxOVERRIDE { return c.GetCol(); } + virtual int Select(const wxPoint& pt) const wxOVERRIDE { return pt.y; } + virtual int Select(const wxSize& sz) const wxOVERRIDE { return sz.y; } + virtual int Select(const wxRect& r) const wxOVERRIDE { return r.y; } + virtual int& Select(wxRect& r) const wxOVERRIDE { return r.y; } + virtual int SelectFirst(const wxGridBlockCoords& block) const wxOVERRIDE + { return block.GetLeftCol(); } + virtual int SelectLast(const wxGridBlockCoords& block) const wxOVERRIDE + { return block.GetRightCol(); } + virtual void SetFirst(wxGridBlockCoords& block, int line) const wxOVERRIDE + { block.SetLeftCol(line); } + virtual void SetLast(wxGridBlockCoords& block, int line) const wxOVERRIDE + { block.SetRightCol(line); } + virtual int& SelectSize(wxRect& r) const wxOVERRIDE { return r.height; } + virtual wxSize MakeSize(int first, int second) const wxOVERRIDE + { return wxSize(second, first); } + virtual void Set(wxGridCellCoords& coords, int line) const wxOVERRIDE + { coords.SetCol(line); } + + virtual void DrawParallelLine(wxDC& dc, int start, int end, int pos) const wxOVERRIDE + { dc.DrawLine(pos, start, pos, end); } + + virtual int PosToLine(const wxGrid *grid, int pos, wxGridWindow *gridWindow, bool clip = false) const wxOVERRIDE + { return grid->XToCol(pos, clip, gridWindow); } + virtual int GetLineStartPos(const wxGrid *grid, int line) const wxOVERRIDE + { return grid->GetColLeft(line); } + virtual int GetLineEndPos(const wxGrid *grid, int line) const wxOVERRIDE + { return grid->GetColRight(line); } + virtual int GetLineSize(const wxGrid *grid, int line) const wxOVERRIDE + { return grid->GetColWidth(line); } + virtual const wxArrayInt& GetLineEnds(const wxGrid *grid) const wxOVERRIDE + { return grid->m_colRights; } + virtual int GetDefaultLineSize(const wxGrid *grid) const wxOVERRIDE + { return grid->GetDefaultColSize(); } + virtual int GetMinimalAcceptableLineSize(const wxGrid *grid) const wxOVERRIDE + { return grid->GetColMinimalAcceptableWidth(); } + virtual int GetMinimalLineSize(const wxGrid *grid, int line) const wxOVERRIDE + { return grid->GetColMinimalWidth(line); } + virtual void SetLineSize(wxGrid *grid, int line, int size) const wxOVERRIDE + { grid->SetColSize(line, size); } + virtual void SetDefaultLineSize(wxGrid *grid, int size, bool resizeExisting) const wxOVERRIDE + { grid->SetDefaultColSize(size, resizeExisting); } + virtual void HandleLineAutosize(wxGrid *grid, int line, const wxMouseEvent& event) const wxOVERRIDE + { grid->HandleColumnAutosize(line, event); } + + virtual int GetLineAt(const wxGrid *grid, int pos) const wxOVERRIDE + { return grid->GetColAt(pos); } + virtual int GetLinePos(const wxGrid *grid, int line) const wxOVERRIDE + { return grid->GetColPos(line); } + + virtual int GetLineBefore(const wxGrid* grid, int line) const wxOVERRIDE + { + int posBefore = grid->GetColPos(line) - 1; + return posBefore >= 0 ? grid->GetColAt(posBefore) : wxNOT_FOUND; + } + + virtual wxWindow *GetHeaderWindow(wxGrid *grid) const wxOVERRIDE + { return grid->GetGridColLabelWindow(); } + virtual int GetHeaderWindowSize(wxGrid *grid) const wxOVERRIDE + { return grid->GetColLabelSize(); } + + virtual wxGridWindow *GetFrozenGrid(wxGrid* grid) const wxOVERRIDE + { return (wxGridWindow*)grid->GetFrozenColGridWindow(); } + + virtual bool CanDragMove(wxGrid *grid) const wxOVERRIDE + { return grid->m_canDragColMove; } + virtual void DoEndMove(wxGrid* grid, int line) const wxOVERRIDE + { grid->DoEndMoveCol(line); } + + virtual bool CanDragLineSize(wxGrid *grid, int line) const wxOVERRIDE + { return grid->CanDragColSize(line); } + virtual void DoEndLineResize(wxGrid *grid, const wxMouseEvent& event, + wxGridWindow* gridWindow) const wxOVERRIDE + { grid->DoEndDragResizeCol(event, gridWindow); } + + virtual bool SelectionExtendCurrentBlock(wxGrid *grid, int line, + const wxMouseEvent &event, + wxEventType eventType = wxEVT_GRID_RANGE_SELECTED) const wxOVERRIDE + { + return grid->m_selection->ExtendCurrentBlock + ( + wxGridCellCoords(0, grid->m_currentCellCoords.GetCol()), + wxGridCellCoords(grid->GetNumberRows() - 1, line), + event, + eventType + ); + } + + virtual void SelectLine(wxGrid *grid, int line, wxMouseEvent &event) const wxOVERRIDE + { grid->m_selection->SelectCol(line, event); }; + virtual void DeselectLine(wxGrid * grid, int line) const wxOVERRIDE + { grid->DeselectCol(line); } + + virtual bool IsLineInSelection(wxGrid *grid, int line) const wxOVERRIDE + { return grid->m_selection->IsInSelection(line, 0); } + + virtual wxGrid::EventResult SendEvent(wxGrid *grid, wxEventType eventType, + int line, const wxMouseEvent& event) const wxOVERRIDE + { return grid->SendEvent(eventType, -1, line, event ); } + + virtual void DrawLineLabel(wxGrid *grid, wxDC& dc, int line) const wxOVERRIDE + { grid->DrawColLabel(dc, line); } + + virtual void MakeLineVisible(wxGrid *grid, int line) const wxOVERRIDE + { grid->MakeCellVisible(-1, line); } + virtual void MakeLineCurrent(wxGrid *grid, int line) const wxOVERRIDE + { grid->SetCurrentCell(grid->GetFirstFullyVisibleRow(), line); } + +}; + +// This class abstracts the difference between operations going forward +// (down/right) and backward (up/left) and allows to use the same code for +// functions which differ only in the direction of grid traversal. +// +// Notice that all operations in this class work with display positions and not +// internal indices which can be different if the columns were reordered. +// +// Like wxGridOperations it's an ABC with two concrete subclasses below. Unlike +// it, this is a normal object and not just a function dispatch table and has a +// non-default ctor. +// +// Note: the explanation of this discrepancy is the existence of (very useful) +// Dual() method in wxGridOperations which forces us to make wxGridOperations a +// function dispatcher only. +class wxGridDirectionOperations +{ +public: + // The oper parameter to ctor selects whether we work with rows or columns + wxGridDirectionOperations(wxGrid *grid, const wxGridOperations& oper) + : m_grid(grid), + m_oper(oper) + { + } + + // Check if the component of this point in our direction is at the + // boundary, i.e. is the first/last row/column + virtual bool IsAtBoundary(const wxGridCellCoords& coords) const = 0; + + // Check if the component of this point in our direction is + // valid, i.e. not -1 + bool IsValid(const wxGridCellCoords& coords) const + { + return m_oper.Select(coords) != -1; + } + + // Make the coordinates with the other component value of -1. + wxGridCellCoords MakeWholeLineCoords(const wxGridCellCoords& coords) const + { + return m_oper.MakeCoords(m_oper.Select(coords), -1); + } + + // Increment the component of this point in our direction + // + // Note that this can't be called if IsAtBoundary() is true, use + // TryToAdvance() if this might be the case. + virtual void Advance(wxGridCellCoords& coords) const = 0; + + // Try to advance in our direction, return true if succeeded or false + // otherwise, i.e. if the coordinates are already at the grid boundary. + bool TryToAdvance(wxGridCellCoords& coords) const + { + if ( IsAtBoundary(coords) ) + return false; + + Advance(coords); + + return true; + } + + // Find the line at the given distance, in pixels, away from this one + // (this uses clipping, i.e. anything after the last line is counted as the + // last one and anything before the first one as 0) + // + // TODO: Implementation of this method currently doesn't support column + // reordering as it mixes up indices and positions. But this doesn't + // really matter as it's only called for rows (Page Up/Down only work + // vertically) and row reordering is not currently supported. We'd + // need to fix it if this ever changes however. + virtual int MoveByPixelDistance(int line, int distance) const = 0; + + // This class is never used polymorphically but give it a virtual dtor + // anyhow to suppress g++ complaints about it + virtual ~wxGridDirectionOperations() { } + +protected: + // Get the position of the row or column from the given coordinates pair. + // + // This is just a shortcut to avoid repeating m_oper and m_grid multiple + // times in the derived classes code. + int GetLinePos(const wxGridCellCoords& coords) const + { + return m_oper.GetLinePos(m_grid, m_oper.Select(coords)); + } + + // Get the index of the row or column from the position. + int GetLineAt(int pos) const + { + return m_oper.GetLineAt(m_grid, pos); + } + + // Check if the given line is visible, i.e. has non 0 size. + bool IsLineVisible(int line) const + { + return m_oper.GetLineSize(m_grid, line) != 0; + } + + + wxGrid * const m_grid; + const wxGridOperations& m_oper; +}; + +class wxGridBackwardOperations : public wxGridDirectionOperations +{ +public: + wxGridBackwardOperations(wxGrid *grid, const wxGridOperations& oper) + : wxGridDirectionOperations(grid, oper) + { + } + + virtual bool IsAtBoundary(const wxGridCellCoords& coords) const wxOVERRIDE + { + wxASSERT_MSG( m_oper.Select(coords) >= 0, "invalid row/column" ); + + int pos = GetLinePos(coords); + while ( pos ) + { + // Check the previous line. + int line = GetLineAt(--pos); + if ( IsLineVisible(line) ) + { + // There is another visible line before this one, hence it's + // not at boundary. + return false; + } + } + + // We reached the boundary without finding any visible lines. + return true; + } + + virtual void Advance(wxGridCellCoords& coords) const wxOVERRIDE + { + int pos = GetLinePos(coords); + for ( ;; ) + { + // This is not supposed to happen if IsAtBoundary() returned false. + wxCHECK_RET( pos, "can't advance when already at boundary" ); + + int line = GetLineAt(--pos); + if ( IsLineVisible(line) ) + { + m_oper.Set(coords, line); + break; + } + } + } + + virtual int MoveByPixelDistance(int line, int distance) const wxOVERRIDE + { + int pos = m_oper.GetLineStartPos(m_grid, line); + return m_oper.PosToLine(m_grid, pos - distance + 1, NULL, true); + } +}; + +// Please refer to the comments above when reading this class code, it's +// absolutely symmetrical to wxGridBackwardOperations. +class wxGridForwardOperations : public wxGridDirectionOperations +{ +public: + wxGridForwardOperations(wxGrid *grid, const wxGridOperations& oper) + : wxGridDirectionOperations(grid, oper), + m_numLines(oper.GetTotalNumberOfLines(grid)) + { + } + + virtual bool IsAtBoundary(const wxGridCellCoords& coords) const wxOVERRIDE + { + wxASSERT_MSG( m_oper.Select(coords) < m_numLines, "invalid row/column" ); + + int pos = GetLinePos(coords); + while ( pos < m_numLines - 1 ) + { + int line = GetLineAt(++pos); + if ( IsLineVisible(line) ) + return false; + } + + return true; + } + + virtual void Advance(wxGridCellCoords& coords) const wxOVERRIDE + { + int pos = GetLinePos(coords); + for ( ;; ) + { + wxCHECK_RET( pos < m_numLines - 1, + "can't advance when already at boundary" ); + + int line = GetLineAt(++pos); + if ( IsLineVisible(line) ) + { + m_oper.Set(coords, line); + break; + } + } + } + + virtual int MoveByPixelDistance(int line, int distance) const wxOVERRIDE + { + int pos = m_oper.GetLineStartPos(m_grid, line); + return m_oper.PosToLine(m_grid, pos + distance, NULL, true); + } + +private: + const int m_numLines; +}; + +// ---------------------------------------------------------------------------- +// data structures used for the data type registry +// ---------------------------------------------------------------------------- + +struct wxGridDataTypeInfo +{ + wxGridDataTypeInfo(const wxString& typeName, + wxGridCellRenderer* renderer, + wxGridCellEditor* editor) + : m_typeName(typeName), m_renderer(renderer), m_editor(editor) + {} + + ~wxGridDataTypeInfo() + { + wxSafeDecRef(m_renderer); + wxSafeDecRef(m_editor); + } + + wxString m_typeName; + wxGridCellRenderer* m_renderer; + wxGridCellEditor* m_editor; + + wxDECLARE_NO_COPY_CLASS(wxGridDataTypeInfo); +}; + + +WX_DEFINE_ARRAY_WITH_DECL_PTR(wxGridDataTypeInfo*, wxGridDataTypeInfoArray, + class WXDLLIMPEXP_ADV); + + +class WXDLLIMPEXP_ADV wxGridTypeRegistry +{ +public: + wxGridTypeRegistry() {} + ~wxGridTypeRegistry(); + + void RegisterDataType(const wxString& typeName, + wxGridCellRenderer* renderer, + wxGridCellEditor* editor); + + // find one of already registered data types + int FindRegisteredDataType(const wxString& typeName); + + // try to FindRegisteredDataType(), if this fails and typeName is one of + // standard typenames, register it and return its index + int FindDataType(const wxString& typeName); + + // try to FindDataType(), if it fails see if it is not one of already + // registered data types with some params in which case clone the + // registered data type and set params for it + int FindOrCloneDataType(const wxString& typeName); + + wxGridCellRenderer* GetRenderer(int index); + wxGridCellEditor* GetEditor(int index); + +private: + wxGridDataTypeInfoArray m_typeinfo; +}; + +// Returns the rectangle for showing something of the given size in a cell with +// the given alignment. +// +// The function is used by wxGridCellBoolEditor and wxGridCellBoolRenderer to +// draw a check mark and position wxCheckBox respectively. +wxRect +wxGetContentRect(wxSize contentSize, + const wxRect& cellRect, + int hAlign, + int vAlign); + +namespace wxGridPrivate +{ + +#if wxUSE_DATETIME + +// This is used as TryGetValueAsDate() parameter. +class DateParseParams +{ +public: + // Unfortunately we have to provide the default ctor (and also make the + // members non-const) because we use these objects as out-parameters as + // they are not fully declared in the public headers. The factory functions + // below must be used to create a really usable object. + DateParseParams() : fallbackParseDate(false) { } + + // Use these functions to really initialize the object. + static DateParseParams WithFallback(const wxString& format) + { + return DateParseParams(format, true); + } + + static DateParseParams WithoutFallback(const wxString& format) + { + return DateParseParams(format, false); + } + + // The usual format, e.g. "%x" or "%Y-%m-%d". + wxString format; + + // Whether fall back to ParseDate() is allowed. + bool fallbackParseDate; + +private: + DateParseParams(const wxString& format_, bool fallbackParseDate_) + : format(format_), + fallbackParseDate(fallbackParseDate_) + { + } +}; + +// Helper function trying to get a date from the given cell: if possible, get +// the date value from the table directly, otherwise get the string value for +// this cell and try to parse it using the specified date format and, if this +// doesn't work and fallbackParseDate is true, try using ParseDate() as a +// fallback. If this still fails, returns false. +bool +TryGetValueAsDate(wxDateTime& result, + const DateParseParams& params, + const wxGrid& grid, + int row, int col); + +#endif // wxUSE_DATETIME + +} // namespace wxGridPrivate + +#endif // wxUSE_GRID +#endif // _WX_GENERIC_GRID_PRIVATE_H_ diff --git a/lib/wxWidgets/include/wx/generic/private/listctrl.h b/lib/wxWidgets/include/wx/generic/private/listctrl.h new file mode 100644 index 0000000..cbd8cdf --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/private/listctrl.h @@ -0,0 +1,967 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/private/listctrl.h +// Purpose: private definitions of wxListCtrl helpers +// Author: Robert Roebling +// Vadim Zeitlin (virtual list control support) +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_LISTCTRL_PRIVATE_H_ +#define _WX_GENERIC_LISTCTRL_PRIVATE_H_ + +#include "wx/defs.h" + +#if wxUSE_LISTCTRL + +#include "wx/listctrl.h" +#include "wx/selstore.h" +#include "wx/timer.h" +#include "wx/settings.h" + +// ============================================================================ +// private classes +// ============================================================================ + +//----------------------------------------------------------------------------- +// wxColWidthInfo (internal) +//----------------------------------------------------------------------------- + +struct wxColWidthInfo +{ + int nMaxWidth; + bool bNeedsUpdate; // only set to true when an item whose + // width == nMaxWidth is removed + + wxColWidthInfo(int w = 0, bool needsUpdate = false) + { + nMaxWidth = w; + bNeedsUpdate = needsUpdate; + } +}; + +WX_DEFINE_ARRAY_PTR(wxColWidthInfo *, ColWidthArray); + +//----------------------------------------------------------------------------- +// wxListItemData (internal) +//----------------------------------------------------------------------------- + +class wxListItemData +{ +public: + wxListItemData(wxListMainWindow *owner); + ~wxListItemData(); + + void SetItem( const wxListItem &info ); + void SetImage( int image ) { m_image = image; } + void SetData( wxUIntPtr data ) { m_data = data; } + void SetPosition( int x, int y ); + void SetSize( int width, int height ); + + bool HasText() const { return !m_text.empty(); } + const wxString& GetText() const { return m_text; } + void SetText(const wxString& text) { m_text = text; } + + // we can't use empty string for measuring the string width/height, so + // always return something + wxString GetTextForMeasuring() const + { + wxString s = GetText(); + if ( s.empty() ) + s = wxT('H'); + + return s; + } + + bool IsHit( int x, int y ) const; + + int GetX() const; + int GetY() const; + int GetWidth() const; + int GetHeight() const; + + int GetImage() const { return m_image; } + bool HasImage() const { return GetImage() != -1; } + + void GetItem( wxListItem &info ) const; + + void SetAttr(wxItemAttr *attr) { m_attr = attr; } + wxItemAttr *GetAttr() const { return m_attr; } + +public: + // the item image or -1 + int m_image; + + // user data associated with the item + wxUIntPtr m_data; + + // the item coordinates are not used in report mode; instead this pointer is + // NULL and the owner window is used to retrieve the item position and size + wxRect *m_rect; + + // the list ctrl we are in + wxListMainWindow *m_owner; + + // custom attributes or NULL + wxItemAttr *m_attr; + +protected: + // common part of all ctors + void Init(); + + wxString m_text; +}; + +//----------------------------------------------------------------------------- +// wxListHeaderData (internal) +//----------------------------------------------------------------------------- + +class wxListHeaderData : public wxObject +{ +public: + wxListHeaderData(); + wxListHeaderData( const wxListItem &info ); + void SetItem( const wxListItem &item ); + void SetPosition( int x, int y ); + void SetWidth( int w ); + void SetState( int state ); + void SetFormat( int format ); + void SetHeight( int h ); + bool HasImage() const; + + bool HasText() const { return !m_text.empty(); } + const wxString& GetText() const { return m_text; } + void SetText(const wxString& text) { m_text = text; } + + void GetItem( wxListItem &item ); + + bool IsHit( int x, int y ) const; + int GetImage() const; + int GetWidth() const; + int GetFormat() const; + int GetState() const; + +protected: + long m_mask; + int m_image; + wxString m_text; + int m_format; + int m_width; + int m_xpos, + m_ypos; + int m_height; + int m_state; + +private: + void Init(); +}; + +//----------------------------------------------------------------------------- +// wxListLineData (internal) +//----------------------------------------------------------------------------- + +WX_DECLARE_LIST(wxListItemData, wxListItemDataList); + +class wxListLineData +{ +public: + // the list of subitems: only may have more than one item in report mode + wxListItemDataList m_items; + + // this is not used in report view + struct GeometryInfo + { + // total item rect + wxRect m_rectAll; + + // label only + wxRect m_rectLabel; + + // icon only + wxRect m_rectIcon; + + // the part to be highlighted + wxRect m_rectHighlight; + + // extend all our rects to be centered inside the one of given width + void ExtendWidth(wxCoord w) + { + wxASSERT_MSG( m_rectAll.width <= w, + wxT("width can only be increased") ); + + int delta = (w - m_rectAll.width) / 2; + m_rectAll.width = w; + m_rectLabel.x += delta; + m_rectIcon.x += delta; + m_rectHighlight.x += delta; + } + } + *m_gi; + + // is this item selected? [NB: not used in virtual mode] + bool m_highlighted; + + bool m_checked; + + // back pointer to the list ctrl + wxListMainWindow *m_owner; + +public: + wxListLineData(wxListMainWindow *owner); + + ~wxListLineData() + { + WX_CLEAR_LIST(wxListItemDataList, m_items); + delete m_gi; + } + + // called by the owner when it toggles report view + void SetReportView(bool inReportView) + { + // we only need m_gi when we're not in report view so update as needed + if ( inReportView ) + { + delete m_gi; + m_gi = NULL; + } + else + { + m_gi = new GeometryInfo; + } + } + + // are we in report mode? + inline bool InReportView() const; + + // are we in virtual report mode? + inline bool IsVirtual() const; + + // these 2 methods shouldn't be called for report view controls, in that + // case we determine our position/size ourselves + + // calculate the size of the line + void CalculateSize( wxDC *dc, int spacing ); + + // remember the position this line appears at + void SetPosition( int x, int y, int spacing ); + + // wxListCtrl API + + void SetImage( int image ) { SetImage(0, image); } + int GetImage() const { return GetImage(0); } + void SetImage( int index, int image ); + int GetImage( int index ) const; + + void Check(bool check) { m_checked = check; } + bool IsChecked() { return m_checked; } + + bool HasImage() const { return GetImage() != -1; } + bool HasText() const { return !GetText(0).empty(); } + + void SetItem( int index, const wxListItem &info ); + void GetItem( int index, wxListItem &info ) const; + + wxString GetText(int index) const; + void SetText( int index, const wxString& s ); + + wxItemAttr *GetAttr() const; + void SetAttr(wxItemAttr *attr); + + // return true if the highlighting really changed + bool Highlight( bool on ); + + void ReverseHighlight(); + + bool IsHighlighted() const + { + wxASSERT_MSG( !IsVirtual(), wxT("unexpected call to IsHighlighted") ); + + return m_highlighted; + } + + // draw the line on the given DC in icon/list mode + void Draw( wxDC *dc, bool current ); + + // the same in report mode: it needs more parameters as we don't store + // everything in the item in report mode + void DrawInReportMode( wxDC *dc, + const wxRect& rect, + const wxRect& rectHL, + bool highlighted, + bool current, + bool checked ); + +private: + // set the line to contain num items (only can be > 1 in report mode) + void InitItems( int num ); + + // get the mode (i.e. style) of the list control + inline int GetMode() const; + + // Apply this item attributes to the given DC: set the text font and colour + // and also erase the background appropriately. + void ApplyAttributes(wxDC *dc, + const wxRect& rectHL, + bool highlighted, + bool current); + + // draw the text on the DC with the correct justification; also add an + // ellipsis if the text is too large to fit in the current width + void DrawTextFormatted(wxDC *dc, + const wxString &text, + int col, + int x, + int yMid, // this is middle, not top, of the text + int width); +}; + +class wxListLineDataArray : public wxVector +{ +public: + void Clear() + { + for ( size_t n = 0; n < size(); ++n ) + delete (*this)[n]; + clear(); + } + + ~wxListLineDataArray() { Clear(); } +}; + +//----------------------------------------------------------------------------- +// wxListHeaderWindow (internal) +//----------------------------------------------------------------------------- + +class wxListHeaderWindow : public wxWindow +{ +protected: + wxListMainWindow *m_owner; + const wxCursor *m_currentCursor; + wxCursor *m_resizeCursor; + bool m_isDragging; + + // column being resized or -1 + int m_column; + + // divider line position in logical (unscrolled) coords + int m_currentX; + + // minimal position beyond which the divider line + // can't be dragged in logical coords + int m_minX; + +public: + wxListHeaderWindow(); + + // We provide only Create(), not the ctor, because we need to create the + // C++ object before creating the window, see the explanations in + // CreateOrDestroyHeaderWindowAsNeeded() + bool Create( wxWindow *win, + wxWindowID id, + wxListMainWindow *owner, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxString &name = wxT("wxlistctrlcolumntitles") ); + + virtual ~wxListHeaderWindow(); + + // We never need focus as we don't have any keyboard interface. + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } + + void DrawCurrent(); + void AdjustDC( wxDC& dc ); + + void OnPaint( wxPaintEvent &event ); + void OnMouse( wxMouseEvent &event ); + + // needs refresh + bool m_dirty; + + // Update main window's column later + bool m_sendSetColumnWidth; + int m_colToSend; + int m_widthToSend; + + bool m_sortAsc; + int m_sortCol; + + virtual wxWindow *GetMainWindowOfCompositeControl() wxOVERRIDE { return GetParent(); } + + virtual void OnInternalIdle() wxOVERRIDE; + +private: + // common part of all ctors + void Init(); + + // generate and process the list event of the given type, return true if + // it wasn't vetoed, i.e. if we should proceed + bool SendListEvent(wxEventType type, const wxPoint& pos); + + wxDECLARE_EVENT_TABLE(); +}; + +//----------------------------------------------------------------------------- +// wxListRenameTimer (internal) +//----------------------------------------------------------------------------- + +class wxListRenameTimer: public wxTimer +{ +private: + wxListMainWindow *m_owner; + +public: + wxListRenameTimer( wxListMainWindow *owner ); + void Notify() wxOVERRIDE; +}; + +//----------------------------------------------------------------------------- +// wxListFindTimer (internal) +//----------------------------------------------------------------------------- + +class wxListFindTimer: public wxTimer +{ +public: + // reset the current prefix after half a second of inactivity + enum { DELAY = 500 }; + + wxListFindTimer( wxListMainWindow *owner ) + : m_owner(owner) + { + } + + virtual void Notify() wxOVERRIDE; + +private: + wxListMainWindow *m_owner; +}; + +//----------------------------------------------------------------------------- +// wxListTextCtrlWrapper: wraps a wxTextCtrl to make it work for inline editing +//----------------------------------------------------------------------------- + +class wxListTextCtrlWrapper : public wxEvtHandler +{ +public: + // NB: text must be a valid object but not Create()d yet + wxListTextCtrlWrapper(wxListMainWindow *owner, + wxTextCtrl *text, + size_t itemEdit); + + wxTextCtrl *GetText() const { return m_text; } + + // Check if the given key event should stop editing and return true if it + // does or false otherwise. + bool CheckForEndEditKey(const wxKeyEvent& event); + + // Different reasons for calling EndEdit(): + // + // It was called because: + enum EndReason + { + End_Accept, // user has accepted the changes. + End_Discard, // user has cancelled editing. + End_Destroy // the entire control is being destroyed. + }; + + void EndEdit(EndReason reason); + +protected: + void OnChar( wxKeyEvent &event ); + void OnKeyUp( wxKeyEvent &event ); + void OnKillFocus( wxFocusEvent &event ); + + bool AcceptChanges(); + void Finish( bool setfocus ); + +private: + wxListMainWindow *m_owner; + wxTextCtrl *m_text; + wxString m_startValue; + size_t m_itemEdited; + bool m_aboutToFinish; + + wxDECLARE_EVENT_TABLE(); +}; + +//----------------------------------------------------------------------------- +// wxListMainWindow (internal) +//----------------------------------------------------------------------------- + +WX_DECLARE_LIST(wxListHeaderData, wxListHeaderDataList); + +class wxListMainWindow : public wxWindow +{ +public: + wxListMainWindow(); + wxListMainWindow( wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size ); + + virtual ~wxListMainWindow(); + + // called by the main control when its mode changes + void SetReportView(bool inReportView); + + // helper to simplify testing for wxLC_XXX flags + bool HasFlag(int flag) const { return m_parent->HasFlag(flag); } + + // return true if this is a virtual list control + bool IsVirtual() const { return HasFlag(wxLC_VIRTUAL); } + + // return true if the control is in report mode + bool InReportView() const { return HasFlag(wxLC_REPORT); } + + // return true if we are in single selection mode, false if multi sel + bool IsSingleSel() const { return HasFlag(wxLC_SINGLE_SEL); } + + // do we have a header window? + bool HasHeader() const + { return InReportView() && !HasFlag(wxLC_NO_HEADER); } + + void HighlightAll( bool on ); + + // all these functions only do something if the line is currently visible + + // Make sure that _line_ is the only item highlighted in the control. + // _oldLine_ is the old focused item. + void HighlightOnly( size_t line, size_t oldLine = (size_t)-1 ); + + // In multiple selection mode, instead of sending one notification per item + // (which is too slow if a lot of items are selected) we send only one notification + // for all of them which is the wxMSW behaviour. Currently done for virtual + // list controls and for deselection only. + enum SendEvent { SendEvent_None, SendEvent_Normal }; + + // change the line "selected" state, return true if it really changed + bool HighlightLine( size_t line, bool highlight = true, + SendEvent sendEvent = SendEvent_Normal ); + + // as HighlightLine() but do it for the range of lines: this is incredibly + // more efficient for virtual list controls! + // + // NB: unlike HighlightLine() this one does refresh the lines on screen + void HighlightLines( size_t lineFrom, size_t lineTo, bool on = true, + SendEvent sendEvent = SendEvent_Normal ); + + // toggle the line state and refresh it + void ReverseHighlight( size_t line ) + { HighlightLine(line, !IsHighlighted(line)); RefreshLine(line); } + + // return true if the line is highlighted + bool IsHighlighted(size_t line) const; + + // refresh one or several lines at once + void RefreshLine( size_t line ); + void RefreshLines( size_t lineFrom, size_t lineTo ); + + // refresh all selected items + void RefreshSelected(); + + // refresh all lines below the given one: the difference with + // RefreshLines() is that the index here might not be a valid one (happens + // when the last line is deleted) + void RefreshAfter( size_t lineFrom ); + + // the methods which are forwarded to wxListLineData itself in list/icon + // modes but are here because the lines don't store their positions in the + // report mode + + // get the bound rect for the entire line + wxRect GetLineRect(size_t line) const; + + // get the bound rect of the label + wxRect GetLineLabelRect(size_t line) const; + + // get the bound rect of the items icon (only may be called if we do have + // an icon!) + wxRect GetLineIconRect(size_t line) const; + + // get the rect to be highlighted when the item has focus + wxRect GetLineHighlightRect(size_t line) const; + + // get the size of the total line rect + wxSize GetLineSize(size_t line) const + { return GetLineRect(line).GetSize(); } + + // return the hit code for the corresponding position (in this line) + long HitTestLine(size_t line, int x, int y) const; + + // bring the selected item into view, scrolling to it if necessary + void MoveToItem(size_t item); + + bool ScrollList( int WXUNUSED(dx), int dy ); + + // bring the current item into view + void MoveToFocus() { MoveToItem(m_current); } + + // start editing the label of the given item + wxTextCtrl *EditLabel(long item, + wxClassInfo* textControlClass = wxCLASSINFO(wxTextCtrl)); + + bool EndEditLabel(bool cancel); + + wxTextCtrl *GetEditControl() const + { + return m_textctrlWrapper ? m_textctrlWrapper->GetText() : NULL; + } + + void ResetTextControl(wxTextCtrl *text) + { + delete text; + m_textctrlWrapper = NULL; + } + + void OnRenameTimer(); + bool OnRenameAccept(size_t itemEdit, const wxString& value); + void OnRenameCancelled(size_t itemEdit); + + void OnFindTimer(); + // set whether or not to ring the find bell + // (does nothing on MSW - bell is always rung) + void EnableBellOnNoMatch( bool on ); + + void OnMouse( wxMouseEvent &event ); + + // called to switch the selection from the current item to newCurrent, + void OnArrowChar( size_t newCurrent, const wxKeyEvent& event ); + + void OnCharHook( wxKeyEvent &event ); + void OnChar( wxKeyEvent &event ); + void OnKeyDown( wxKeyEvent &event ); + void OnKeyUp( wxKeyEvent &event ); + void OnSetFocus( wxFocusEvent &event ); + void OnKillFocus( wxFocusEvent &event ); + void OnScroll( wxScrollWinEvent& event ); + + void OnPaint( wxPaintEvent &event ); + + void OnChildFocus(wxChildFocusEvent& event); + + void DrawImage( int index, wxDC *dc, int x, int y ); + void GetImageSize( int index, int &width, int &height ) const; + + void SetImages( wxWithImages *images, const int which ); + void SetItemSpacing( int spacing, bool isSmall = false ); + int GetItemSpacing( bool isSmall = false ); + + void SetColumn( int col, const wxListItem &item ); + void SetColumnWidth( int col, int width ); + void GetColumn( int col, wxListItem &item ) const; + int GetColumnWidth( int col ) const; + int GetColumnCount() const { return m_columns.GetCount(); } + + // returns the sum of the heights of all columns + int GetHeaderWidth() const; + + int GetCountPerPage() const; + + void SetItem( wxListItem &item ); + void GetItem( wxListItem &item ) const; + void SetItemState( long item, long state, long stateMask ); + void SetItemStateAll( long state, long stateMask ); + int GetItemState( long item, long stateMask ) const; + bool GetItemRect( long item, wxRect &rect ) const + { + return GetSubItemRect(item, wxLIST_GETSUBITEMRECT_WHOLEITEM, rect); + } + bool GetSubItemRect( long item, long subItem, wxRect& rect, + int code = wxLIST_RECT_BOUNDS ) const; + wxRect GetViewRect() const; + bool GetItemPosition( long item, wxPoint& pos ) const; + int GetSelectedItemCount() const; + + bool HasCheckBoxes() const; + bool EnableCheckBoxes(bool enable = true); + bool IsItemChecked(long item) const; + void CheckItem(long item, bool check); + + wxString GetItemText(long item, int col = 0) const + { + wxListItem info; + info.m_mask = wxLIST_MASK_TEXT; + info.m_itemId = item; + info.m_col = col; + GetItem( info ); + return info.m_text; + } + + void SetItemText(long item, const wxString& value) + { + wxListItem info; + info.m_mask = wxLIST_MASK_TEXT; + info.m_itemId = item; + info.m_text = value; + SetItem( info ); + } + + wxWithImages* GetSmallImages() const + { return m_small_images; } + + + // set the scrollbars and update the positions of the items + void RecalculatePositions(); + + // do the same thing and also call Refresh() + void RecalculatePositionsAndRefresh(); + + long GetNextItem( long item, int geometry, int state ) const; + void DeleteItem( long index ); + void DeleteAllItems(); + void DeleteColumn( int col ); + void DeleteEverything(); + void EnsureVisible( long index ); + long FindItem( long start, const wxString& str, bool partial = false ); + long FindItem( long start, wxUIntPtr data); + long FindItem( const wxPoint& pt ); + long HitTest( int x, int y, int &flags ) const; + void InsertItem( wxListItem &item ); + long InsertColumn( long col, const wxListItem &item ); + int GetItemWidthWithImage(wxListItem * item); + void SortItems( wxListCtrlCompare fn, wxIntPtr data ); + + size_t GetItemCount() const; + bool IsEmpty() const { return GetItemCount() == 0; } + void SetItemCount(long count); + + // change the current (== focused) item, send a notification event + void ChangeCurrent(size_t current); + void ResetCurrent() { ChangeCurrent((size_t)-1); } + bool HasCurrent() const { return m_current != (size_t)-1; } + + // send out a wxListEvent + void SendNotify( size_t line, + wxEventType command, + const wxPoint& point = wxDefaultPosition ); + + // override base class virtual to reset m_lineHeight when the font changes + virtual bool SetFont(const wxFont& font) wxOVERRIDE + { + if ( !wxWindow::SetFont(font) ) + return false; + + m_lineHeight = 0; + + return true; + } + + void ExtendRulesAndAlternateColour(bool extend) + { + m_extendRulesAndAlternateColour = extend; + } + + + // these are for wxListLineData usage only + + // get the backpointer to the list ctrl + wxGenericListCtrl *GetListCtrl() const + { + return wxStaticCast(GetParent(), wxGenericListCtrl); + } + + // get the height of all lines (assuming they all do have the same height) + wxCoord GetLineHeight() const; + + // get the y position of the given line (only for report view) + wxCoord GetLineY(size_t line) const; + + // get the brush to use for the item highlighting + wxBrush *GetHighlightBrush() const + { + return m_hasFocus ? m_highlightBrush : m_highlightUnfocusedBrush; + } + + bool HasFocus() const wxOVERRIDE + { + return m_hasFocus; + } + + void UpdateSelectionCount(bool selected) + { + wxASSERT_MSG( !IsVirtual(), "Can be called for non virtual lists only" ); + + if ( IsSingleSel() ) + return; + + selected ? ++m_selCount : --m_selCount; + } + + void DrawInReportModeOnBlank ( wxDC *dc, + const wxRect& rect, + int lineNumber ); + +protected: + // the array of all line objects for a non virtual list control (for the + // virtual list control we only ever use m_lines[0]) + wxListLineDataArray m_lines; + + // the list of column objects + wxListHeaderDataList m_columns; + + // currently focused item or -1 + size_t m_current; + + // the number of lines per page + int m_linesPerPage; + + // this flag is set when something which should result in the window + // redrawing happens (i.e. an item was added or deleted, or its appearance + // changed) and OnPaint() doesn't redraw the window while it is set which + // allows to minimize the number of repaintings when a lot of items are + // being added. The real repainting occurs only after the next OnIdle() + // call + bool m_dirty; + + wxColour *m_highlightColour; + wxWithImages *m_small_images; + wxWithImages *m_normal_images; + + int m_small_spacing; + int m_normal_spacing; + bool m_hasFocus; + + bool m_lastOnSame; + wxTimer *m_renameTimer; + + // incremental search data + wxString m_findPrefix; + wxTimer *m_findTimer; + // This flag is set to 0 if the bell is disabled, 1 if it is enabled and -1 + // if it is globally enabled but has been temporarily disabled because we + // had already beeped for this particular search. + int m_findBell; + + bool m_isCreated; + int m_dragCount; + wxPoint m_dragStart; + ColWidthArray m_aColWidths; + + // for double click logic + size_t m_lineLastClicked, + m_lineBeforeLastClicked, + m_lineSelectSingleOnUp; + + // Multiple selection extends from the anchor. Not used in single-selection mode. + size_t m_anchor; + + bool m_hasCheckBoxes; + +protected: + wxWindow *GetMainWindowOfCompositeControl() wxOVERRIDE { return GetParent(); } + + // the total count of items selected in a non virtual list control with + // multiple selections (always 0 otherwise) + size_t m_selCount; + + // the total count of items in a virtual list control + size_t m_countVirt; + + // the object maintaining the items selection state, only used in virtual + // controls + wxSelectionStore m_selStore; + + // common part of all ctors + void Init(); + + // get the line data for the given index + wxListLineData *GetLine(size_t n) const + { + wxASSERT_MSG( n != (size_t)-1, wxT("invalid line index") ); + + if ( IsVirtual() ) + { + wxConstCast(this, wxListMainWindow)->CacheLineData(n); + n = 0; + } + + return m_lines[n]; + } + + // get a dummy line which can be used for geometry calculations and such: + // you must use GetLine() if you want to really draw the line + wxListLineData *GetDummyLine() const; + + // cache the line data of the n-th line in m_lines[0] + void CacheLineData(size_t line); + + // get the range of visible lines + void GetVisibleLinesRange(size_t *from, size_t *to); + + // force us to recalculate the range of visible lines + void ResetVisibleLinesRange() { m_lineFrom = (size_t)-1; } + + // find the first item starting with the given prefix after the given item + size_t PrefixFindItem(size_t item, const wxString& prefix) const; + + // get the colour to be used for drawing the rules + wxColour GetRuleColour() const + { + return wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT); + } + +private: + // initialize the current item if needed + void UpdateCurrent(); + + // change the current (== focused) item, without sending any event + // return true if m_current really changed. + bool ChangeCurrentWithoutEvent(size_t current); + + // Trying to activate the current item from keyboard is only possible + // if it is actually selected. We don't send wxEVT_LIST_ITEM_ACTIVATED + // event if it is not, and wxEVT_LIST_KEY_DOWN event should carry -1 + // in this case, as the wxMSW implementation does. + bool ShouldSendEventForCurrent() const + { + return HasCurrent() && IsHighlighted(m_current); + } + + // For multiple selection mode. + // Change the selected range from [anchor, oldCurrent] to [anchor, newCurrent] + // without generating unnecessary wxEVT_LIST_ITEM_{DE}SELECTED events. + void ExtendSelection(size_t oldCurrent, size_t newCurrent); + + // delete all items but don't refresh: called from dtor + void DoDeleteAllItems(); + + // Compute the minimal width needed to fully display the column header. + int ComputeMinHeaderWidth(const wxListHeaderData* header) const; + + // Check if the given point is inside the checkbox of this item. + // + // Always returns false if there are no checkboxes. + bool IsInsideCheckBox(long item, int x, int y); + + // the height of one line using the current font + wxCoord m_lineHeight; + + // the total header width or 0 if not calculated yet + wxCoord m_headerWidth; + + // the first and last lines being shown on screen right now (inclusive), + // both may be -1 if they must be calculated so never access them directly: + // use GetVisibleLinesRange() above instead + size_t m_lineFrom, + m_lineTo; + + // the brushes to use for item highlighting when we do/don't have focus + wxBrush *m_highlightBrush, + *m_highlightUnfocusedBrush; + + // wrapper around the text control currently used for in place editing or + // NULL if no item is being edited + wxListTextCtrlWrapper *m_textctrlWrapper; + + // tells whether or not to paint empty rows with alternate colour and draw + // rulers on empty rows + bool m_extendRulesAndAlternateColour; + + wxDECLARE_EVENT_TABLE(); + + friend class wxGenericListCtrl; + friend class wxListCtrlMaxWidthCalculator; +}; + +#endif // wxUSE_LISTCTRL +#endif // _WX_GENERIC_LISTCTRL_PRIVATE_H_ diff --git a/lib/wxWidgets/include/wx/generic/private/markuptext.h b/lib/wxWidgets/include/wx/generic/private/markuptext.h new file mode 100644 index 0000000..4fa7286 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/private/markuptext.h @@ -0,0 +1,138 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/private/markuptext.h +// Purpose: Generic wx*MarkupText classes for managing text with markup. +// Author: Vadim Zeitlin +// Created: 2011-02-21 +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_PRIVATE_MARKUPTEXT_H_ +#define _WX_GENERIC_PRIVATE_MARKUPTEXT_H_ + +#include "wx/defs.h" +#include "wx/gdicmn.h" + +class WXDLLIMPEXP_FWD_CORE wxDC; + +class wxMarkupParserOutput; + +// ---------------------------------------------------------------------------- +// wxMarkupText: allows to measure and draw the text containing markup. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMarkupTextBase +{ +public: + virtual ~wxMarkupTextBase() {} + + // Update the markup string. + void SetMarkup(const wxString& markup) { m_markup = markup; } + + // Return the width and height required by the given string and optionally + // the height of the visible part above the baseline (i.e. ascent minus + // internal leading). + // + // The font currently selected into the DC is used for measuring (notice + // that it is changed by this function but normally -- i.e. if markup is + // valid -- restored to its original value when it returns). + wxSize Measure(wxDC& dc, int *visibleHeight = NULL) const; + +protected: + wxMarkupTextBase(const wxString& markup) + : m_markup(markup) + { + } + + // Return m_markup suitable for measuring by Measure, i.e. stripped of + // any mnenomics. + virtual wxString GetMarkupForMeasuring() const = 0; + + wxString m_markup; +}; + + +class WXDLLIMPEXP_CORE wxMarkupText : public wxMarkupTextBase +{ +public: + // Constants for Render() flags. + enum + { + Render_Default = 0, // Don't show mnemonics visually. + Render_ShowAccels = 1 // Underline mnemonics. + }; + + + // Initialize with the given string containing markup (which is supposed to + // be valid, the caller must check for it before constructing this object). + // + // Notice that the usual rules for mnemonics apply to the markup text: if + // it contains any '&' characters they must be escaped by doubling them, + // otherwise they indicate that the next character is the mnemonic for this + // field. + // + // TODO-MULTILINE-MARKUP: Currently only single line labels are supported, + // search for other occurrences of this comment to find the places which + // need to be updated to support multiline labels with markup. + wxMarkupText(const wxString& markup) : wxMarkupTextBase(markup) + { + } + + // Default copy ctor, assignment operator and dtor are ok. + + // Update the markup string. + // + // The same rules for mnemonics as in the ctor apply to this string. + void SetMarkup(const wxString& markup) { m_markup = markup; } + + // Render the markup string into the given DC in the specified rectangle. + // + // Notice that while the function uses the provided rectangle for alignment + // (it centers the text in it), no clipping is done by it so use Measure() + // and set the clipping region before rendering if necessary. + void Render(wxDC& dc, const wxRect& rect, int flags); + +protected: + virtual wxString GetMarkupForMeasuring() const wxOVERRIDE; +}; + + +// ---------------------------------------------------------------------------- +// wxItemMarkupText: variant of wxMarkupText for items without mnemonics +// ---------------------------------------------------------------------------- + +// This class has similar interface to wxItemMarkup, but no strings contain +// mnemonics and no escaping is done. +class WXDLLIMPEXP_CORE wxItemMarkupText : public wxMarkupTextBase +{ +public: + // Initialize with the given string containing markup (which is supposed to + // be valid, the caller must check for it before constructing this object). + // Notice that mnemonics are not interpreted at all by this class, so + // literal ampersands shouldn't be escaped/doubled. + wxItemMarkupText(const wxString& markup) : wxMarkupTextBase(markup) + { + } + + // Default copy ctor, assignment operator and dtor are ok. + + // Similar to wxMarkupText::Render(), but uses wxRendererNative::DrawItemText() + // instead of generic wxDC::DrawLabel(), so is more suitable for use in + // controls that already use DrawItemText() for its items. + // + // The meaning of the flags here is different than in wxMarkupText too: + // they're passed to DrawItemText(). + // + // Currently the only supported ellipsize modes are wxELLIPSIZE_NONE and + // wxELLIPSIZE_END, the others are treated as wxELLIPSIZE_END. + void Render(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int rendererFlags, + wxEllipsizeMode ellipsizeMode); + +protected: + virtual wxString GetMarkupForMeasuring() const wxOVERRIDE { return m_markup; } +}; + +#endif // _WX_GENERIC_PRIVATE_MARKUPTEXT_H_ diff --git a/lib/wxWidgets/include/wx/generic/private/notifmsg.h b/lib/wxWidgets/include/wx/generic/private/notifmsg.h new file mode 100644 index 0000000..6c5fd90 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/private/notifmsg.h @@ -0,0 +1,52 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/private/notifmsg.h +// Purpose: wxGenericNotificationMessage declarations +// Author: Tobias Taschner +// Created: 2015-08-04 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_PRIVATE_NOTIFMSG_H_ +#define _WX_GENERIC_PRIVATE_NOTIFMSG_H_ + +#include "wx/private/notifmsg.h" + +class wxGenericNotificationMessageImpl : public wxNotificationMessageImpl +{ +public: + wxGenericNotificationMessageImpl(wxNotificationMessageBase* notification); + + virtual ~wxGenericNotificationMessageImpl(); + + virtual bool Show(int timeout) wxOVERRIDE; + + virtual bool Close() wxOVERRIDE; + + virtual void SetTitle(const wxString& title) wxOVERRIDE; + + virtual void SetMessage(const wxString& message) wxOVERRIDE; + + virtual void SetParent(wxWindow *parent) wxOVERRIDE; + + virtual void SetFlags(int flags) wxOVERRIDE; + + virtual void SetIcon(const wxIcon& icon) wxOVERRIDE; + + virtual bool AddAction(wxWindowID actionid, const wxString &label) wxOVERRIDE; + + // get/set the default timeout (used if Timeout_Auto is specified) + static int GetDefaultTimeout() { return ms_timeout; } + static void SetDefaultTimeout(int timeout); + +private: + // default timeout + static int ms_timeout; + + // notification message is represented by a frame in this implementation + class wxNotificationMessageWindow *m_window; + + wxDECLARE_NO_COPY_CLASS(wxGenericNotificationMessageImpl); +}; + +#endif // _WX_GENERIC_PRIVATE_NOTIFMSG_H_ diff --git a/lib/wxWidgets/include/wx/generic/private/richtooltip.h b/lib/wxWidgets/include/wx/generic/private/richtooltip.h new file mode 100644 index 0000000..4d97364 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/private/richtooltip.h @@ -0,0 +1,64 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/private/richtooltip.h +// Purpose: wxRichToolTipGenericImpl declaration. +// Author: Vadim Zeitlin +// Created: 2011-10-18 +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_PRIVATE_RICHTOOLTIP_H_ +#define _WX_GENERIC_PRIVATE_RICHTOOLTIP_H_ + +#include "wx/bmpbndl.h" +#include "wx/colour.h" + +// ---------------------------------------------------------------------------- +// wxRichToolTipGenericImpl: defines generic wxRichToolTip implementation. +// ---------------------------------------------------------------------------- + +class wxRichToolTipGenericImpl : public wxRichToolTipImpl +{ +public: + wxRichToolTipGenericImpl(const wxString& title, const wxString& message) : + m_title(title), + m_message(message) + { + m_tipKind = wxTipKind_Auto; + + // This is pretty arbitrary, we could follow MSW and use some multiple + // of double-click time here. + m_timeout = 5000; + m_delay = 0; + } + + virtual void SetBackgroundColour(const wxColour& col, + const wxColour& colEnd) wxOVERRIDE; + virtual void SetCustomIcon(const wxBitmapBundle& icon) wxOVERRIDE; + virtual void SetStandardIcon(int icon) wxOVERRIDE; + virtual void SetTimeout(unsigned milliseconds, + unsigned millisecondsDelay = 0) wxOVERRIDE; + virtual void SetTipKind(wxTipKind tipKind) wxOVERRIDE; + virtual void SetTitleFont(const wxFont& font) wxOVERRIDE; + + virtual void ShowFor(wxWindow* win, const wxRect* rect = NULL) wxOVERRIDE; + +protected: + wxString m_title, + m_message; + +private: + wxBitmapBundle m_icon; + + wxColour m_colStart, + m_colEnd; + + unsigned m_timeout, + m_delay; + + wxTipKind m_tipKind; + + wxFont m_titleFont; +}; + +#endif // _WX_GENERIC_PRIVATE_RICHTOOLTIP_H_ diff --git a/lib/wxWidgets/include/wx/generic/private/rowheightcache.h b/lib/wxWidgets/include/wx/generic/private/rowheightcache.h new file mode 100644 index 0000000..9136a38 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/private/rowheightcache.h @@ -0,0 +1,155 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/rowheightcache.h +// Purpose: height cache of rows in a dataview +// Author: Jens Goepfert (mail@jensgoepfert.de) +// Created: 2018-03-06 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_ROWHEIGHTCACHE_H_ +#define _WX_PRIVATE_ROWHEIGHTCACHE_H_ + +#include "wx/hashmap.h" +#include "wx/vector.h" + +// struct describing a range of rows which contains rows .. +struct RowRange +{ + unsigned int from; + unsigned int to; +}; + +/** + A helper class that manages a set of RowRange objects. + + It stores the indices that are members of a group in a memory + efficient way. +*/ +class WXDLLIMPEXP_CORE RowRanges +{ +public: + /** + Adds a row index to this group by adding it to an existing RowRange + or by creating a new one. + */ + void Add(unsigned int row); + + /** + Removes a row index and all indices after idx from this group. + */ + void Remove(unsigned int row); + + /** + Checks whether a row index is contained in this group. + */ + bool Has(unsigned int row) const; + + /** + Returns the number of row indices that are contained in this group. + */ + unsigned int CountAll() const; + + /** + Returns the number of rows that are in this group before the given row + index. + + Not that this doesn't include the given row. + */ + unsigned int CountTo(unsigned int row) const; + + /** + Returns the size of the range. + + This is only used for testing and debugging. + */ + unsigned int GetSize() const { return m_ranges.size(); } + +private: + wxVector m_ranges; + + /** + If a new row index was inserted, Cleanup() checks if the neighbour + ranges of idx can includes the same row indices and discards + unnecessary RowRange objects. + */ + void CleanUp(unsigned int idx); +}; + +WX_DECLARE_HASH_MAP(unsigned int, RowRanges*, wxIntegerHash, wxIntegerEqual, + HeightToRowRangesMap); + +/** + HeightCache implements a cache mechanism for wxDataViewCtrl. + + It gives fast access to: + * the height of one line (GetLineHeight) + * the y-coordinate where a row starts (GetLineStart) + * and vice versa (GetLineAt) + + The layout of the cache is a hashmap where the keys are all existing row + heights in pixels. The values are RowRange objects that represent all rows + having the specified height. + + An example: + @code + { + 22: RowRange([0..10], [15..17], [20..2000]), + 42: RowRange([11..12], [18..18]), + 62: RowRange([13..14], [19..19]) + } + @endcode + + Examples + ======== + + GetLineStart + ------------ + To retrieve the y-coordinate of item 1000 it is necessary to look into + each key of the hashmap *m_heightToRowRange*. Get the row count of + indices lower than 1000 (RowRange::CountTo) and multiplies it which the + according height. + + RowRange([0..10], [15..17], [20..2000]).CountTo(1000) + --> 0..10 are 11 items, 15..17 are 3 items and 20..1000 are 980 items (1000-20) + = 11 + 3 + 980 = 994 items + + GetLineStart(1000) --> (22 * 994) + (42 * 3) + (62 * 3) = 22180 + + GetLineHeight + ------------- + To retrieve the line height look into each key and check if row is + contained in RowRange (RowRange::Has) + + GetLineAt + --------- + To retrieve the row that starts at a specific y-coordinate. + Look into each key and count all rows. + Use bisect algorithm in combination with GetLineStart() to + find the appropriate item +*/ +class WXDLLIMPEXP_CORE HeightCache +{ +public: + ~HeightCache(); + bool GetLineStart(unsigned int row, int& start); + bool GetLineHeight(unsigned int row, int& height); + bool GetLineAt(int y, unsigned int& row); + bool GetLineInfo(unsigned int row, int &start, int &height); + + void Put(unsigned int row, int height); + + /** + Removes the stored height of the given row from the cache and + invalidates all cached rows (including the given one). + */ + void Remove(unsigned int row); + + void Clear(); + +private: + HeightToRowRangesMap m_heightToRowRange; +}; + + +#endif // _WX_PRIVATE_ROWHEIGHTCACHE_H_ diff --git a/lib/wxWidgets/include/wx/generic/private/textmeasure.h b/lib/wxWidgets/include/wx/generic/private/textmeasure.h new file mode 100644 index 0000000..c6145b9 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/private/textmeasure.h @@ -0,0 +1,39 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/private/textmeasure.h +// Purpose: Generic wxTextMeasure declaration. +// Author: Vadim Zeitlin +// Created: 2012-10-17 +// Copyright: (c) 1997-2012 wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_PRIVATE_TEXTMEASURE_H_ +#define _WX_GENERIC_PRIVATE_TEXTMEASURE_H_ + +// ---------------------------------------------------------------------------- +// wxTextMeasure for the platforms without native support. +// ---------------------------------------------------------------------------- + +class wxTextMeasure : public wxTextMeasureBase +{ +public: + explicit wxTextMeasure(const wxDC *dc, const wxFont *font = NULL) + : wxTextMeasureBase(dc, font) {} + explicit wxTextMeasure(const wxWindow *win, const wxFont *font = NULL) + : wxTextMeasureBase(win, font) {} + +protected: + virtual void DoGetTextExtent(const wxString& string, + wxCoord *width, + wxCoord *height, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL) wxOVERRIDE; + + virtual bool DoGetPartialTextExtents(const wxString& text, + wxArrayInt& widths, + double scaleX) wxOVERRIDE; + + wxDECLARE_NO_COPY_CLASS(wxTextMeasure); +}; + +#endif // _WX_GENERIC_PRIVATE_TEXTMEASURE_H_ diff --git a/lib/wxWidgets/include/wx/generic/private/timer.h b/lib/wxWidgets/include/wx/generic/private/timer.h new file mode 100644 index 0000000..6941870 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/private/timer.h @@ -0,0 +1,45 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/private/timer.h +// Purpose: Generic implementation of wxTimer class +// Author: Vaclav Slavik +// Copyright: (c) Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_PRIVATE_TIMER_H_ +#define _WX_GENERIC_PRIVATE_TIMER_H_ + +#if wxUSE_TIMER + +#include "wx/private/timer.h" + +//----------------------------------------------------------------------------- +// wxTimer +//----------------------------------------------------------------------------- + +class wxTimerDesc; + +class WXDLLIMPEXP_CORE wxGenericTimerImpl : public wxTimerImpl +{ +public: + wxGenericTimerImpl(wxTimer* timer) : wxTimerImpl(timer) { Init(); } + virtual ~wxGenericTimerImpl(); + + virtual bool Start(int millisecs = -1, bool oneShot = false); + virtual void Stop(); + + virtual bool IsRunning() const; + + // implementation + static void NotifyTimers(); + +protected: + void Init(); + +private: + wxTimerDesc *m_desc; +}; + +#endif // wxUSE_TIMER + +#endif // _WX_GENERIC_PRIVATE_TIMER_H_ diff --git a/lib/wxWidgets/include/wx/generic/private/widthcalc.h b/lib/wxWidgets/include/wx/generic/private/widthcalc.h new file mode 100644 index 0000000..cacfbf8 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/private/widthcalc.h @@ -0,0 +1,123 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/private/widthcalc.h +// Purpose: wxMaxWidthCalculatorBase helper class. +// Author: Václav Slavík, Kinaou Hervé +// Copyright: (c) 2015 wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_PRIVATE_WIDTHCALC_H_ +#define _WX_GENERIC_PRIVATE_WIDTHCALC_H_ + +#include "wx/defs.h" + +#if wxUSE_DATAVIEWCTRL || wxUSE_LISTCTRL + +#include "wx/log.h" +#include "wx/timer.h" + +// ---------------------------------------------------------------------------- +// wxMaxWidthCalculatorBase: base class for calculating max column width +// ---------------------------------------------------------------------------- + +class wxMaxWidthCalculatorBase +{ +public: + // column of which calculate the width + explicit wxMaxWidthCalculatorBase(size_t column) + : m_column(column), + m_width(0) + { + } + + void UpdateWithWidth(int width) + { + m_width = wxMax(m_width, width); + } + + // Update the max with for the expected row + virtual void UpdateWithRow(int row) = 0; + + int GetMaxWidth() const { return m_width; } + size_t GetColumn() const { return m_column; } + + void + ComputeBestColumnWidth(size_t count, + size_t first_visible, + size_t last_visible) + { + // The code below deserves some explanation. For very large controls, we + // simply can't afford to calculate sizes for all items, it takes too + // long. So the best we can do is to check the first and the last N/2 + // items in the control for some sufficiently large N and calculate best + // sizes from that. That can result in the calculated best width being too + // small for some outliers, but it's better to get slightly imperfect + // result than to wait several seconds after every update. To avoid highly + // visible miscalculations, we also include all currently visible items + // no matter what. Finally, the value of N is determined dynamically by + // measuring how much time we spent on the determining item widths so far. + +#if wxUSE_STOPWATCH + size_t top_part_end = count; + static const long CALC_TIMEOUT = 20/*ms*/; + // don't call wxStopWatch::Time() too often + static const unsigned CALC_CHECK_FREQ = 100; + wxStopWatch timer; +#else + // use some hard-coded limit, that's the best we can do without timer + size_t top_part_end = wxMin(500, count); +#endif // wxUSE_STOPWATCH/!wxUSE_STOPWATCH + + size_t row = 0; + + for ( row = 0; row < top_part_end; row++ ) + { +#if wxUSE_STOPWATCH + if ( row % CALC_CHECK_FREQ == CALC_CHECK_FREQ-1 && + timer.Time() > CALC_TIMEOUT ) + break; +#endif // wxUSE_STOPWATCH + UpdateWithRow(row); + } + + // row is the first unmeasured item now; that's our value of N/2 + if ( row < count ) + { + top_part_end = row; + + // add bottom N/2 items now: + const size_t bottom_part_start = wxMax(row, count - row); + for ( row = bottom_part_start; row < count; row++ ) + { + UpdateWithRow(row); + } + + // finally, include currently visible items in the calculation: + first_visible = wxMax(first_visible, top_part_end); + last_visible = wxMin(bottom_part_start, last_visible); + + for ( row = first_visible; row < last_visible; row++ ) + { + UpdateWithRow(row); + } + + wxLogTrace("items container", + "determined best size from %zu top, %zu bottom " + "plus %zu more visible items out of %zu total", + top_part_end, + count - bottom_part_start, + last_visible - first_visible, + count); + } + } + +private: + const size_t m_column; + int m_width; + + wxDECLARE_NO_COPY_CLASS(wxMaxWidthCalculatorBase); +}; + +#endif // wxUSE_DATAVIEWCTRL || wxUSE_LISTCTRL + +#endif // _WX_GENERIC_PRIVATE_WIDTHCALC_H_ diff --git a/lib/wxWidgets/include/wx/generic/prntdlgg.h b/lib/wxWidgets/include/wx/generic/prntdlgg.h new file mode 100644 index 0000000..7c4cd1b --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/prntdlgg.h @@ -0,0 +1,256 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/prntdlgg.h +// Purpose: wxGenericPrintDialog, wxGenericPrintSetupDialog, +// wxGenericPageSetupDialog +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __PRINTDLGH_G_ +#define __PRINTDLGH_G_ + +#include "wx/defs.h" + +#if wxUSE_PRINTING_ARCHITECTURE + +#include "wx/dialog.h" +#include "wx/cmndata.h" +#include "wx/prntbase.h" +#include "wx/printdlg.h" +#include "wx/listctrl.h" + +#include "wx/dc.h" +#if wxUSE_POSTSCRIPT + #include "wx/dcps.h" +#endif + +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; +class WXDLLIMPEXP_FWD_CORE wxButton; +class WXDLLIMPEXP_FWD_CORE wxCheckBox; +class WXDLLIMPEXP_FWD_CORE wxComboBox; +class WXDLLIMPEXP_FWD_CORE wxStaticText; +class WXDLLIMPEXP_FWD_CORE wxRadioBox; +class WXDLLIMPEXP_FWD_CORE wxPageSetupDialogData; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// This is not clear why all these enums start with 10 or 30 but do not change it +// without good reason to avoid some subtle backwards compatibility breakage + +enum +{ + wxPRINTID_STATIC = 10, + wxPRINTID_RANGE, + wxPRINTID_FROM, + wxPRINTID_TO, + wxPRINTID_COPIES, + wxPRINTID_PRINTTOFILE, + wxPRINTID_SETUP +}; + +enum +{ + wxPRINTID_LEFTMARGIN = 30, + wxPRINTID_RIGHTMARGIN, + wxPRINTID_TOPMARGIN, + wxPRINTID_BOTTOMMARGIN +}; + +enum +{ + wxPRINTID_PRINTCOLOUR = 10, + wxPRINTID_ORIENTATION, + wxPRINTID_COMMAND, + wxPRINTID_OPTIONS, + wxPRINTID_PAPERSIZE, + wxPRINTID_PRINTER +}; + +#if wxUSE_POSTSCRIPT + +//---------------------------------------------------------------------------- +// wxPostScriptNativeData +//---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPostScriptPrintNativeData: public wxPrintNativeDataBase +{ +public: + wxPostScriptPrintNativeData(); + virtual ~wxPostScriptPrintNativeData(); + + virtual bool TransferTo( wxPrintData &data ) wxOVERRIDE; + virtual bool TransferFrom( const wxPrintData &data ) wxOVERRIDE; + + virtual bool Ok() const wxOVERRIDE { return IsOk(); } + virtual bool IsOk() const wxOVERRIDE { return true; } + + const wxString& GetPrinterCommand() const { return m_printerCommand; } + const wxString& GetPrinterOptions() const { return m_printerOptions; } + const wxString& GetPreviewCommand() const { return m_previewCommand; } + const wxString& GetFontMetricPath() const { return m_afmPath; } + double GetPrinterScaleX() const { return m_printerScaleX; } + double GetPrinterScaleY() const { return m_printerScaleY; } + long GetPrinterTranslateX() const { return m_printerTranslateX; } + long GetPrinterTranslateY() const { return m_printerTranslateY; } + + void SetPrinterCommand(const wxString& command) { m_printerCommand = command; } + void SetPrinterOptions(const wxString& options) { m_printerOptions = options; } + void SetPreviewCommand(const wxString& command) { m_previewCommand = command; } + void SetFontMetricPath(const wxString& path) { m_afmPath = path; } + void SetPrinterScaleX(double x) { m_printerScaleX = x; } + void SetPrinterScaleY(double y) { m_printerScaleY = y; } + void SetPrinterScaling(double x, double y) { m_printerScaleX = x; m_printerScaleY = y; } + void SetPrinterTranslateX(long x) { m_printerTranslateX = x; } + void SetPrinterTranslateY(long y) { m_printerTranslateY = y; } + void SetPrinterTranslation(long x, long y) { m_printerTranslateX = x; m_printerTranslateY = y; } + +#if wxUSE_STREAMS + wxOutputStream *GetOutputStream() { return m_outputStream; } + void SetOutputStream( wxOutputStream *output ) { m_outputStream = output; } +#endif + +private: + wxString m_printerCommand; + wxString m_previewCommand; + wxString m_printerOptions; + wxString m_afmPath; + double m_printerScaleX; + double m_printerScaleY; + long m_printerTranslateX; + long m_printerTranslateY; +#if wxUSE_STREAMS + wxOutputStream *m_outputStream; +#endif + +private: + wxDECLARE_DYNAMIC_CLASS(wxPostScriptPrintNativeData); +}; + +// ---------------------------------------------------------------------------- +// Simulated Print and Print Setup dialogs for non-Windows platforms (and +// Windows using PostScript print/preview) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGenericPrintDialog : public wxPrintDialogBase +{ +public: + wxGenericPrintDialog(wxWindow *parent, + wxPrintDialogData* data = NULL); + wxGenericPrintDialog(wxWindow *parent, wxPrintData* data); + + virtual ~wxGenericPrintDialog(); + + void OnSetup(wxCommandEvent& event); + void OnRange(wxCommandEvent& event); + void OnOK(wxCommandEvent& event); + + virtual bool TransferDataFromWindow() wxOVERRIDE; + virtual bool TransferDataToWindow() wxOVERRIDE; + + virtual int ShowModal() wxOVERRIDE; + + wxPrintData& GetPrintData() wxOVERRIDE + { return m_printDialogData.GetPrintData(); } + + wxPrintDialogData& GetPrintDialogData() wxOVERRIDE { return m_printDialogData; } + wxDC *GetPrintDC() wxOVERRIDE; + +public: +// wxStaticText* m_printerMessage; + wxButton* m_setupButton; +// wxButton* m_helpButton; + wxRadioBox* m_rangeRadioBox; + wxTextCtrl* m_fromText; + wxTextCtrl* m_toText; + wxTextCtrl* m_noCopiesText; + wxCheckBox* m_printToFileCheckBox; +// wxCheckBox* m_collateCopiesCheckBox; + + wxPrintDialogData m_printDialogData; + +protected: + void Init(wxWindow *parent); + +private: + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxGenericPrintDialog); +}; + +class WXDLLIMPEXP_CORE wxGenericPrintSetupDialog : public wxDialog +{ +public: + // There are no configuration options for the dialog, so we + // just pass the wxPrintData object (no wxPrintSetupDialogData class needed) + wxGenericPrintSetupDialog(wxWindow *parent, wxPrintData* data); + virtual ~wxGenericPrintSetupDialog(); + + void Init(wxPrintData* data); + + void OnPrinter(wxListEvent& event); + + virtual bool TransferDataFromWindow() wxOVERRIDE; + virtual bool TransferDataToWindow() wxOVERRIDE; + + virtual wxComboBox *CreatePaperTypeChoice(); + +public: + wxListCtrl* m_printerListCtrl; + wxRadioBox* m_orientationRadioBox; + wxTextCtrl* m_printerCommandText; + wxTextCtrl* m_printerOptionsText; + wxCheckBox* m_colourCheckBox; + wxComboBox* m_paperTypeChoice; + + wxPrintData m_printData; + wxPrintData& GetPrintData() { return m_printData; } + + // After pressing OK, write data here. + wxPrintData* m_targetData; + +private: + wxDECLARE_EVENT_TABLE(); + wxDECLARE_CLASS(wxGenericPrintSetupDialog); +}; +#endif + // wxUSE_POSTSCRIPT + +class WXDLLIMPEXP_CORE wxGenericPageSetupDialog : public wxPageSetupDialogBase +{ +public: + wxGenericPageSetupDialog(wxWindow *parent = NULL, + wxPageSetupDialogData* data = NULL); + virtual ~wxGenericPageSetupDialog(); + + virtual bool TransferDataFromWindow() wxOVERRIDE; + virtual bool TransferDataToWindow() wxOVERRIDE; + + virtual wxPageSetupDialogData& GetPageSetupDialogData() wxOVERRIDE; + + void OnPrinter(wxCommandEvent& event); + wxComboBox *CreatePaperTypeChoice(int* x, int* y); + +public: + wxButton* m_printerButton; + wxRadioBox* m_orientationRadioBox; + wxTextCtrl* m_marginLeftText; + wxTextCtrl* m_marginTopText; + wxTextCtrl* m_marginRightText; + wxTextCtrl* m_marginBottomText; + wxComboBox* m_paperTypeChoice; + + wxPageSetupDialogData m_pageData; + +private: + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericPageSetupDialog); +}; + +#endif + +#endif +// __PRINTDLGH_G_ diff --git a/lib/wxWidgets/include/wx/generic/progdlgg.h b/lib/wxWidgets/include/wx/generic/progdlgg.h new file mode 100644 index 0000000..0252498 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/progdlgg.h @@ -0,0 +1,232 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/progdlgg.h +// Purpose: wxGenericProgressDialog class +// Author: Karsten Ballueder +// Modified by: Francesco Montorsi +// Created: 09.05.1999 +// Copyright: (c) Karsten Ballueder +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef __PROGDLGH_G__ +#define __PROGDLGH_G__ + +#include "wx/dialog.h" +#include "wx/weakref.h" + +class WXDLLIMPEXP_FWD_CORE wxButton; +class WXDLLIMPEXP_FWD_CORE wxEventLoop; +class WXDLLIMPEXP_FWD_CORE wxGauge; +class WXDLLIMPEXP_FWD_CORE wxStaticText; +class WXDLLIMPEXP_FWD_CORE wxWindowDisabler; + +/* + Progress dialog which shows a moving progress bar. + Taken from the Mahogany project. +*/ +class WXDLLIMPEXP_CORE wxGenericProgressDialog : public wxDialog +{ +public: + wxGenericProgressDialog(); + wxGenericProgressDialog(const wxString& title, const wxString& message, + int maximum = 100, + wxWindow *parent = NULL, + int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE); + + virtual ~wxGenericProgressDialog(); + + bool Create(const wxString& title, + const wxString& message, + int maximum = 100, + wxWindow *parent = NULL, + int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE); + + virtual bool Update(int value, const wxString& newmsg = wxEmptyString, bool *skip = NULL); + virtual bool Pulse(const wxString& newmsg = wxEmptyString, bool *skip = NULL); + + virtual void Resume(); + + virtual int GetValue() const; + virtual int GetRange() const; + virtual wxString GetMessage() const; + + virtual void SetRange(int maximum); + + // Return whether "Cancel" or "Skip" button was pressed, always return + // false if the corresponding button is not shown. + virtual bool WasCancelled() const; + virtual bool WasSkipped() const; + + // Must provide overload to avoid hiding it (and warnings about it) + virtual void Update() wxOVERRIDE { wxDialog::Update(); } + + virtual bool Show( bool show = true ) wxOVERRIDE; + + // This enum is an implementation detail and should not be used + // by user code. + enum State + { + Uncancelable = -1, // dialog can't be canceled + Canceled, // can be cancelled and, in fact, was + Continue, // can be cancelled but wasn't + Finished, // finished, waiting to be removed from screen + Dismissed // was closed by user after finishing + }; + +protected: + // Update just the m_maximum field, this is used by public SetRange() but, + // unlike it, doesn't update the controls state. This makes it useful for + // both this class and its derived classes that don't use m_gauge to + // display progress. + void SetMaximum(int maximum); + + // Return the labels to use for showing the elapsed/estimated/remaining + // times respectively. + static wxString GetElapsedLabel() { return wxGetTranslation("Elapsed time:"); } + static wxString GetEstimatedLabel() { return wxGetTranslation("Estimated time:"); } + static wxString GetRemainingLabel() { return wxGetTranslation("Remaining time:"); } + + + // Similar to wxWindow::HasFlag() but tests for a presence of a wxPD_XXX + // flag in our (separate) flags instead of using m_windowStyle. + bool HasPDFlag(int flag) const { return (m_pdStyle & flag) != 0; } + + // Return the progress dialog style. Prefer to use HasPDFlag() if possible. + int GetPDStyle() const { return m_pdStyle; } + void SetPDStyle(int pdStyle) { m_pdStyle = pdStyle; } + + // Updates estimated times from a given progress bar value and stores the + // results in provided arguments. + void UpdateTimeEstimates(int value, + unsigned long &elapsedTime, + unsigned long &estimatedTime, + unsigned long &remainingTime); + + // Converts seconds to HH:mm:ss format. + static wxString GetFormattedTime(unsigned long timeInSec); + + // Create a new event loop if there is no currently running one. + void EnsureActiveEventLoopExists(); + + // callback for optional abort button + void OnCancel(wxCommandEvent&); + + // callback for optional skip button + void OnSkip(wxCommandEvent&); + + // callback to disable "hard" window closing + void OnClose(wxCloseEvent&); + + // called to disable the other windows while this dialog is shown + void DisableOtherWindows(); + + // must be called to re-enable the other windows temporarily disabled while + // the dialog was shown + void ReenableOtherWindows(); + + // Store the parent window as wxWindow::m_parent and also set the top level + // parent reference we store in this class itself. + void SetTopParent(wxWindow* parent); + + // return the top level parent window of this dialog (may be NULL) + wxWindow *GetTopParent() const { return m_parentTop; } + + + // continue processing or not (return value for Update()) + State m_state; + + // the maximum value + int m_maximum; + +#if defined(__WXMSW__) + // the factor we use to always keep the value in 16 bit range as the native + // control only supports ranges from 0 to 65,535 + size_t m_factor; +#endif // __WXMSW__ + + // time when the dialog was created + unsigned long m_timeStart; + // time when the dialog was closed or cancelled + unsigned long m_timeStop; + // time between the moment the dialog was closed/cancelled and resume + unsigned long m_break; + +private: + // update the label to show the given time (in seconds) + static void SetTimeLabel(unsigned long val, wxStaticText *label); + + // common part of all ctors + void Init(); + + // create the label with given text and another one to show the time nearby + // as the next windows in the sizer, returns the created control + wxStaticText *CreateLabel(const wxString& text, wxSizer *sizer); + + // updates the label message + void UpdateMessage(const wxString &newmsg); + + // common part of Update() and Pulse(), returns true if not cancelled + bool DoBeforeUpdate(bool *skip); + + // common part of Update() and Pulse() + void DoAfterUpdate(); + + // shortcuts for enabling buttons + void EnableClose(); + void EnableSkip(bool enable = true); + void EnableAbort(bool enable = true); + void DisableSkip() { EnableSkip(false); } + void DisableAbort() { EnableAbort(false); } + + // the widget displaying current status (may be NULL) + wxGauge *m_gauge; + // the message displayed + wxStaticText *m_msg; + // displayed elapsed, estimated, remaining time + wxStaticText *m_elapsed, + *m_estimated, + *m_remaining; + + // Reference to the parent top level window, automatically becomes NULL if + // it is destroyed and could be always NULL if it's not given at all. + wxWindowRef m_parentTop; + + // Progress dialog styles: this is not the same as m_windowStyle because + // wxPD_XXX constants clash with the existing TLW styles so to be sure we + // don't have any conflicts we just use a separate variable for storing + // them. + int m_pdStyle; + + // skip some portion + bool m_skip; + + // the abort and skip buttons (or NULL if none) + wxButton *m_btnAbort; + wxButton *m_btnSkip; + + // saves the time when elapsed time was updated so there is only one + // update per second + unsigned long m_last_timeupdate; + + // tells how often a change of the estimated time has to be confirmed + // before it is actually displayed - this reduces the frequency of updates + // of estimated and remaining time + int m_delay; + + // counts the confirmations + int m_ctdelay; + unsigned long m_display_estimated; + + // for wxPD_APP_MODAL case + wxWindowDisabler *m_winDisabler; + + // Temporary event loop created by the dialog itself if there is no + // currently active loop when it is created. + wxEventLoop *m_tempEventLoop; + + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxGenericProgressDialog); +}; + +#endif // __PROGDLGH_G__ diff --git a/lib/wxWidgets/include/wx/generic/propdlg.h b/lib/wxWidgets/include/wx/generic/propdlg.h new file mode 100644 index 0000000..4dc1bef --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/propdlg.h @@ -0,0 +1,162 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/propdlg.h +// Purpose: wxPropertySheetDialog +// Author: Julian Smart +// Modified by: +// Created: 2005-03-12 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PROPDLG_H_ +#define _WX_PROPDLG_H_ + +#include "wx/defs.h" + +#if wxUSE_BOOKCTRL + +#include "wx/dialog.h" + +class WXDLLIMPEXP_FWD_CORE wxBookCtrlBase; + +//----------------------------------------------------------------------------- +// wxPropertySheetDialog +// A platform-independent properties dialog with a notebook and standard +// buttons. +// +// To use this class, call Create from your derived class. +// Then create pages and add to the book control. Finally call CreateButtons and +// LayoutDialog. +// +// For example: +// +// MyPropertySheetDialog::Create(...) +// { +// wxPropertySheetDialog::Create(...); +// +// // Add page +// wxPanel* panel = new wxPanel(GetBookCtrl(), ...); +// GetBookCtrl()->AddPage(panel, wxT("General")); +// +// CreateButtons(); +// LayoutDialog(); +// } +// +// Override CreateBookCtrl and AddBookCtrl to create and add a different +// kind of book control. +//----------------------------------------------------------------------------- + +enum wxPropertySheetDialogFlags +{ + // Use the platform default + wxPROPSHEET_DEFAULT = 0x0001, + + // Use a notebook + wxPROPSHEET_NOTEBOOK = 0x0002, + + // Use a toolbook + wxPROPSHEET_TOOLBOOK = 0x0004, + + // Use a choicebook + wxPROPSHEET_CHOICEBOOK = 0x0008, + + // Use a listbook + wxPROPSHEET_LISTBOOK = 0x0010, + + // Use a wxButtonToolBar toolbook + wxPROPSHEET_BUTTONTOOLBOOK = 0x0020, + + // Use a treebook + wxPROPSHEET_TREEBOOK = 0x0040, + + // Shrink dialog to fit current page + wxPROPSHEET_SHRINKTOFIT = 0x0100 +}; + +class WXDLLIMPEXP_ADV wxPropertySheetDialog : public wxDialog +{ +public: + wxPropertySheetDialog() : wxDialog() { Init(); } + + wxPropertySheetDialog(wxWindow* parent, wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxASCII_STR(wxDialogNameStr)) + { + Init(); + Create(parent, id, title, pos, sz, style, name); + } + + bool Create(wxWindow* parent, wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxASCII_STR(wxDialogNameStr)); + +//// Accessors + + // Set and get the notebook + void SetBookCtrl(wxBookCtrlBase* book) { m_bookCtrl = book; } + wxBookCtrlBase* GetBookCtrl() const { return m_bookCtrl; } + + // Override function in base + virtual wxWindow* GetContentWindow() const wxOVERRIDE; + + // Set and get the inner sizer + void SetInnerSizer(wxSizer* sizer) { m_innerSizer = sizer; } + wxSizer* GetInnerSizer() const { return m_innerSizer ; } + + // Set and get the book style + void SetSheetStyle(long sheetStyle) { m_sheetStyle = sheetStyle; } + long GetSheetStyle() const { return m_sheetStyle ; } + + // Set and get the border around the whole dialog + void SetSheetOuterBorder(int border) { m_sheetOuterBorder = border; } + int GetSheetOuterBorder() const { return m_sheetOuterBorder ; } + + // Set and get the border around the book control only + void SetSheetInnerBorder(int border) { m_sheetInnerBorder = border; } + int GetSheetInnerBorder() const { return m_sheetInnerBorder ; } + +/// Operations + + // Creates the buttons + virtual void CreateButtons(int flags = wxOK|wxCANCEL); + + // Lay out the dialog, to be called after pages have been created + virtual void LayoutDialog(int centreFlags = wxBOTH); + +/// Implementation + + // Creates the book control. If you want to use a different kind of + // control, override. + virtual wxBookCtrlBase* CreateBookCtrl(); + + // Adds the book control to the inner sizer. + virtual void AddBookCtrl(wxSizer* sizer); + + // Resize dialog if necessary + void OnIdle(wxIdleEvent& event); + +private: + void Init(); + +protected: + wxBookCtrlBase* m_bookCtrl; + wxSizer* m_innerSizer; // sizer for extra space + long m_sheetStyle; + int m_sheetOuterBorder; + int m_sheetInnerBorder; + int m_selectedPage; + + wxDECLARE_DYNAMIC_CLASS(wxPropertySheetDialog); + wxDECLARE_EVENT_TABLE(); +}; + +#endif // wxUSE_BOOKCTRL + +#endif // _WX_PROPDLG_H_ + diff --git a/lib/wxWidgets/include/wx/generic/region.h b/lib/wxWidgets/include/wx/generic/region.h new file mode 100644 index 0000000..1c5048d --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/region.h @@ -0,0 +1,81 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/region.h +// Purpose: generic wxRegion class +// Author: David Elliott +// Modified by: +// Created: 2004/04/12 +// Copyright: (c) 2004 David Elliott +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_REGION_H__ +#define _WX_GENERIC_REGION_H__ + +class WXDLLIMPEXP_CORE wxRegionGeneric : public wxRegionBase +{ +public: + wxRegionGeneric(wxCoord x, wxCoord y, wxCoord w, wxCoord h); + wxRegionGeneric(const wxPoint& topLeft, const wxPoint& bottomRight); + wxRegionGeneric(const wxRect& rect); + wxRegionGeneric(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE); + wxRegionGeneric(const wxBitmap& bmp); + wxRegionGeneric(const wxBitmap& bmp, const wxColour& transp, int tolerance = 0); + wxRegionGeneric(); + virtual ~wxRegionGeneric(); + + // wxRegionBase pure virtuals + virtual void Clear(); + virtual bool IsEmpty() const; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + + // wxRegionBase pure virtuals + virtual bool DoIsEqual(const wxRegion& region) const; + virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const; + virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const; + virtual wxRegionContain DoContainsRect(const wxRect& rect) const; + + virtual bool DoOffset(wxCoord x, wxCoord y); + virtual bool DoUnionWithRect(const wxRect& rect); + virtual bool DoUnionWithRegion(const wxRegion& region); + virtual bool DoIntersect(const wxRegion& region); + virtual bool DoSubtract(const wxRegion& region); + virtual bool DoXor(const wxRegion& region); + + friend class WXDLLIMPEXP_FWD_CORE wxRegionIteratorGeneric; +}; + +class WXDLLIMPEXP_CORE wxRegionIteratorGeneric : public wxObject +{ +public: + wxRegionIteratorGeneric(); + wxRegionIteratorGeneric(const wxRegionGeneric& region); + wxRegionIteratorGeneric(const wxRegionIteratorGeneric& iterator); + virtual ~wxRegionIteratorGeneric(); + + wxRegionIteratorGeneric& operator=(const wxRegionIteratorGeneric& iterator); + + void Reset() { m_current = 0; } + void Reset(const wxRegionGeneric& region); + + operator bool () const { return HaveRects(); } + bool HaveRects() const; + + wxRegionIteratorGeneric& operator++(); + wxRegionIteratorGeneric operator++(int); + + long GetX() const; + long GetY() const; + long GetW() const; + long GetWidth() const { return GetW(); } + long GetH() const; + long GetHeight() const { return GetH(); } + wxRect GetRect() const; +private: + long m_current; + wxRegionGeneric m_region; +}; + +#endif // _WX_GENERIC_REGION_H__ diff --git a/lib/wxWidgets/include/wx/generic/richmsgdlgg.h b/lib/wxWidgets/include/wx/generic/richmsgdlgg.h new file mode 100644 index 0000000..bf1d9d5 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/richmsgdlgg.h @@ -0,0 +1,48 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/richmsgdlgg.h +// Purpose: wxGenericRichMessageDialog +// Author: Rickard Westerlund +// Created: 2010-07-04 +// Copyright: (c) 2010 wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_RICHMSGDLGG_H_ +#define _WX_GENERIC_RICHMSGDLGG_H_ + +class WXDLLIMPEXP_FWD_CORE wxCheckBox; +class WXDLLIMPEXP_FWD_CORE wxCollapsiblePane; +class WXDLLIMPEXP_FWD_CORE wxCollapsiblePaneEvent; + +class WXDLLIMPEXP_CORE wxGenericRichMessageDialog + : public wxRichMessageDialogBase +{ +public: + wxGenericRichMessageDialog(wxWindow *parent, + const wxString& message, + const wxString& caption = wxASCII_STR(wxMessageBoxCaptionStr), + long style = wxOK | wxCENTRE) + : wxRichMessageDialogBase( parent, message, caption, style ), + m_checkBox(NULL), + m_detailsPane(NULL) + { } + + virtual bool IsCheckBoxChecked() const wxOVERRIDE; + +protected: + wxCheckBox *m_checkBox; + wxCollapsiblePane *m_detailsPane; + + // overrides methods in the base class + virtual void AddMessageDialogCheckBox(wxSizer *sizer) wxOVERRIDE; + virtual void AddMessageDialogDetails(wxSizer *sizer) wxOVERRIDE; + +private: + void OnPaneChanged(wxCollapsiblePaneEvent& event); + + wxDECLARE_EVENT_TABLE(); + + wxDECLARE_NO_COPY_CLASS(wxGenericRichMessageDialog); +}; + +#endif // _WX_GENERIC_RICHMSGDLGG_H_ diff --git a/lib/wxWidgets/include/wx/generic/sashwin.h b/lib/wxWidgets/include/wx/generic/sashwin.h new file mode 100644 index 0000000..595ecf1 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/sashwin.h @@ -0,0 +1,251 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/sashwin.h +// Purpose: wxSashWindow implementation. A sash window has an optional +// sash on each edge, allowing it to be dragged. An event +// is generated when the sash is released. +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SASHWIN_H_G_ +#define _WX_SASHWIN_H_G_ + +#if wxUSE_SASH + +#include "wx/defs.h" +#include "wx/window.h" +#include "wx/string.h" + +#define wxSASH_DRAG_NONE 0 +#define wxSASH_DRAG_DRAGGING 1 +#define wxSASH_DRAG_LEFT_DOWN 2 + +enum wxSashEdgePosition { + wxSASH_TOP = 0, + wxSASH_RIGHT, + wxSASH_BOTTOM, + wxSASH_LEFT, + wxSASH_NONE = 100 +}; + +/* + * wxSashEdge represents one of the four edges of a window. + */ + +class WXDLLIMPEXP_CORE wxSashEdge +{ +public: + wxSashEdge() + { m_show = false; + m_margin = 0; } + + bool m_show; // Is the sash showing? + int m_margin; // The margin size +}; + +/* + * wxSashWindow flags + */ + +#define wxSW_NOBORDER 0x0000 +//#define wxSW_3D 0x0010 +#define wxSW_BORDER 0x0020 +#define wxSW_3DSASH 0x0040 +#define wxSW_3DBORDER 0x0080 +#define wxSW_3D (wxSW_3DSASH | wxSW_3DBORDER) + +/* + * wxSashWindow allows any of its edges to have a sash which can be dragged + * to resize the window. The actual content window will be created as a child + * of wxSashWindow. + */ + +class WXDLLIMPEXP_CORE wxSashWindow: public wxWindow +{ +public: + // Default constructor + wxSashWindow() + { + Init(); + } + + // Normal constructor + wxSashWindow(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = wxT("sashWindow")) + { + Init(); + Create(parent, id, pos, size, style, name); + } + + virtual ~wxSashWindow(); + + bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = wxT("sashWindow")); + + // Set whether there's a sash in this position + void SetSashVisible(wxSashEdgePosition edge, bool sash); + + // Get whether there's a sash in this position + bool GetSashVisible(wxSashEdgePosition edge) const { return m_sashes[edge].m_show; } + + // Get border size + int GetEdgeMargin(wxSashEdgePosition edge) const { return m_sashes[edge].m_margin; } + + // Sets the default sash border size + void SetDefaultBorderSize(int width) { m_borderSize = width; } + + // Gets the default sash border size + int GetDefaultBorderSize() const { return m_borderSize; } + + // Sets the addition border size between child and sash window + void SetExtraBorderSize(int width) { m_extraBorderSize = width; } + + // Gets the addition border size between child and sash window + int GetExtraBorderSize() const { return m_extraBorderSize; } + + virtual void SetMinimumSizeX(int min) { m_minimumPaneSizeX = min; } + virtual void SetMinimumSizeY(int min) { m_minimumPaneSizeY = min; } + virtual int GetMinimumSizeX() const { return m_minimumPaneSizeX; } + virtual int GetMinimumSizeY() const { return m_minimumPaneSizeY; } + + virtual void SetMaximumSizeX(int max) { m_maximumPaneSizeX = max; } + virtual void SetMaximumSizeY(int max) { m_maximumPaneSizeY = max; } + virtual int GetMaximumSizeX() const { return m_maximumPaneSizeX; } + virtual int GetMaximumSizeY() const { return m_maximumPaneSizeY; } + +//////////////////////////////////////////////////////////////////////////// +// Implementation + + // Paints the border and sash + void OnPaint(wxPaintEvent& event); + + // Handles mouse events + void OnMouseEvent(wxMouseEvent& ev); + + // Adjusts the panes + void OnSize(wxSizeEvent& event); + +#if defined(__WXMSW__) || defined(__WXMAC__) + // Handle cursor correctly + void OnSetCursor(wxSetCursorEvent& event); +#endif // wxMSW + + // Draws borders + void DrawBorders(wxDC& dc); + + // Draws the sashes + void DrawSash(wxSashEdgePosition edge, wxDC& dc); + + // Draws the sashes + void DrawSashes(wxDC& dc); + + // Draws the sash tracker (for whilst moving the sash) + void DrawSashTracker(wxSashEdgePosition edge, int x, int y); + + // Tests for x, y over sash + wxSashEdgePosition SashHitTest(int x, int y, int tolerance = 2); + + // Resizes subwindows + void SizeWindows(); + + // Initialize colours + void InitColours(); + +private: + void Init(); + + wxSashEdge m_sashes[4]; + int m_dragMode; + wxSashEdgePosition m_draggingEdge; + int m_oldX; + int m_oldY; + int m_borderSize; + int m_extraBorderSize; + int m_firstX; + int m_firstY; + int m_minimumPaneSizeX; + int m_minimumPaneSizeY; + int m_maximumPaneSizeX; + int m_maximumPaneSizeY; + wxCursor* m_sashCursorWE; + wxCursor* m_sashCursorNS; + wxColour m_lightShadowColour; + wxColour m_mediumShadowColour; + wxColour m_darkShadowColour; + wxColour m_hilightColour; + wxColour m_faceColour; + bool m_mouseCaptured; + wxCursor* m_currentCursor; + +private: + wxDECLARE_DYNAMIC_CLASS(wxSashWindow); + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxSashWindow); +}; + +class WXDLLIMPEXP_FWD_CORE wxSashEvent; + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_SASH_DRAGGED, wxSashEvent ); + +enum wxSashDragStatus +{ + wxSASH_STATUS_OK, + wxSASH_STATUS_OUT_OF_RANGE +}; + +class WXDLLIMPEXP_CORE wxSashEvent: public wxCommandEvent +{ +public: + wxSashEvent(int id = 0, wxSashEdgePosition edge = wxSASH_NONE) + { + m_eventType = (wxEventType) wxEVT_SASH_DRAGGED; + m_id = id; + m_edge = edge; + } + + wxSashEvent(const wxSashEvent& event) + : wxCommandEvent(event), + m_edge(event.m_edge), + m_dragRect(event.m_dragRect), + m_dragStatus(event.m_dragStatus) { } + + void SetEdge(wxSashEdgePosition edge) { m_edge = edge; } + wxSashEdgePosition GetEdge() const { return m_edge; } + + //// The rectangle formed by the drag operation + void SetDragRect(const wxRect& rect) { m_dragRect = rect; } + wxRect GetDragRect() const { return m_dragRect; } + + //// Whether the drag caused the rectangle to be reversed (e.g. + //// dragging the top below the bottom) + void SetDragStatus(wxSashDragStatus status) { m_dragStatus = status; } + wxSashDragStatus GetDragStatus() const { return m_dragStatus; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxSashEvent(*this); } + +private: + wxSashEdgePosition m_edge; + wxRect m_dragRect; + wxSashDragStatus m_dragStatus; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSashEvent); +}; + +typedef void (wxEvtHandler::*wxSashEventFunction)(wxSashEvent&); + +#define wxSashEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxSashEventFunction, func) + +#define EVT_SASH_DRAGGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_SASH_DRAGGED, id, wxSashEventHandler(fn)) +#define EVT_SASH_DRAGGED_RANGE(id1, id2, fn) \ + wx__DECLARE_EVT2(wxEVT_SASH_DRAGGED, id1, id2, wxSashEventHandler(fn)) + +#endif // wxUSE_SASH + +#endif + // _WX_SASHWIN_H_G_ diff --git a/lib/wxWidgets/include/wx/generic/scrolwin.h b/lib/wxWidgets/include/wx/generic/scrolwin.h new file mode 100644 index 0000000..4ea5725 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/scrolwin.h @@ -0,0 +1,56 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/scrolwin.h +// Purpose: generic wxScrollHelper +// Author: Vadim Zeitlin +// Created: 2008-12-24 (replacing old file with the same name) +// Copyright: (c) 2008 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_SCROLLWIN_H_ +#define _WX_GENERIC_SCROLLWIN_H_ + +#include "wx/recguard.h" + +// ---------------------------------------------------------------------------- +// generic wxScrollHelper implementation +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxScrollHelper : public wxScrollHelperBase +{ +public: + wxScrollHelper(wxWindow *winToScroll); + + // implement base class pure virtuals + virtual void AdjustScrollbars() wxOVERRIDE; + virtual bool IsScrollbarShown(int orient) const wxOVERRIDE; + +protected: + virtual void DoScroll(int x, int y) wxOVERRIDE; + virtual void DoShowScrollbars(wxScrollbarVisibility horz, + wxScrollbarVisibility vert) wxOVERRIDE; + +private: + // helper of AdjustScrollbars(): does the work for the single scrollbar + // + // notice that the parameters passed by non-const references are modified + // by this function + void DoAdjustScrollbar(int orient, + int clientSize, + int virtSize, + int pixelsPerUnit, + int& scrollUnits, + int& scrollPosition, + int& scrollLinesPerPage, + wxScrollbarVisibility visibility); + + + wxScrollbarVisibility m_xVisibility, + m_yVisibility; + wxRecursionGuardFlag m_adjustScrollFlagReentrancy; + + wxDECLARE_NO_COPY_CLASS(wxScrollHelper); +}; + +#endif // _WX_GENERIC_SCROLLWIN_H_ + diff --git a/lib/wxWidgets/include/wx/generic/spinctlg.h b/lib/wxWidgets/include/wx/generic/spinctlg.h new file mode 100644 index 0000000..594a4d0 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/spinctlg.h @@ -0,0 +1,436 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/spinctlg.h +// Purpose: generic wxSpinCtrl class +// Author: Vadim Zeitlin +// Modified by: +// Created: 28.10.99 +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_SPINCTRL_H_ +#define _WX_GENERIC_SPINCTRL_H_ + +// ---------------------------------------------------------------------------- +// wxSpinCtrl is a combination of wxSpinButton and wxTextCtrl, so if +// wxSpinButton is available, this is what we do - but if it isn't, we still +// define wxSpinCtrl class which then has the same appearance as wxTextCtrl but +// the different interface. This allows to write programs using wxSpinCtrl +// without tons of #ifdefs. +// ---------------------------------------------------------------------------- + +#if wxUSE_SPINBTN + +#include "wx/compositewin.h" + +class WXDLLIMPEXP_FWD_CORE wxSpinButton; +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; + +class wxSpinCtrlTextGeneric; // wxTextCtrl used for the wxSpinCtrlGenericBase + +// The !wxUSE_SPINBTN version's GetValue() function conflicts with the +// wxTextCtrl's GetValue() and so you have to input a dummy int value. +#define wxSPINCTRL_GETVALUE_FIX + +// ---------------------------------------------------------------------------- +// wxSpinCtrlGeneric is a combination of wxTextCtrl and wxSpinButton +// +// This class manages a double valued generic spinctrl through the DoGet/SetXXX +// functions that are made public as Get/SetXXX functions for int or double +// for the wxSpinCtrl and wxSpinCtrlDouble classes respectively to avoid +// function ambiguity. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSpinCtrlGenericBase + : public wxNavigationEnabled > +{ +public: + wxSpinCtrlGenericBase() { Init(); } + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + double min = 0, double max = 100, double initial = 0, + double inc = 1, + const wxString& name = wxT("wxSpinCtrl")); + + virtual ~wxSpinCtrlGenericBase(); + + // accessors + virtual wxString GetTextValue() const wxOVERRIDE; + // T GetValue() const + // T GetMin() const + // T GetMax() const + // T GetIncrement() const + virtual bool GetSnapToTicks() const wxOVERRIDE { return m_snap_to_ticks; } + // unsigned GetDigits() const - wxSpinCtrlDouble only + + // operations + virtual void SetValue(const wxString& text) wxOVERRIDE; + // void SetValue(T val) + // void SetRange(T minVal, T maxVal) + // void SetIncrement(T inc) + virtual void SetSnapToTicks(bool snap_to_ticks) wxOVERRIDE; + // void SetDigits(unsigned digits) - wxSpinCtrlDouble only + + // Select text in the textctrl + void SetSelection(long from, long to) wxOVERRIDE; + + // implementation from now on + + // forward these functions to all subcontrols + virtual bool Enable(bool enable = true) wxOVERRIDE; + virtual bool Show(bool show = true) wxOVERRIDE; + + virtual bool SetBackgroundColour(const wxColour& colour) wxOVERRIDE; + + // get the subcontrols + wxTextCtrl *GetText() const { return m_textCtrl; } + wxSpinButton *GetSpinButton() const { return m_spinButton; } + + // forwarded events from children windows + void OnSpinButton(wxSpinEvent& event); + void OnTextLostFocus(wxFocusEvent& event); + void OnTextChar(wxKeyEvent& event); + + // this window itself is used only as a container for its sub windows so it + // shouldn't accept the focus at all and any attempts to explicitly set + // focus to it should give focus to its text constol part + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } + virtual void SetFocus() wxOVERRIDE; + + friend class wxSpinCtrlTextGeneric; + +protected: + // override the base class virtuals involved into geometry calculations + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const wxOVERRIDE; + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; + +#ifdef __WXMSW__ + // and, for MSW, enabling this window itself + virtual void DoEnable(bool enable) wxOVERRIDE; +#endif // __WXMSW__ + + enum SendEvent + { + SendEvent_None, + SendEvent_Text + }; + + // generic double valued functions + double DoGetValue() const { return m_value; } + bool DoSetValue(double val, SendEvent sendEvent); + void DoSetRange(double min_val, double max_val); + void DoSetIncrement(double inc); + + // update our value to reflect the text control contents (if it has been + // modified by user, do nothing otherwise) + // + // can also change the text control if its value is invalid + // + // return true if our value has changed + bool SyncSpinToText(SendEvent sendEvent); + + // Send the correct event type + virtual void DoSendEvent() = 0; + + // Convert the text to/from the corresponding value. + virtual bool DoTextToValue(const wxString& text, double *val) = 0; + virtual wxString DoValueToText(double val) = 0; + + // check if the value is in range + bool InRange(double n) const { return (n >= m_min) && (n <= m_max); } + + // adjust the value to fit the range and snap it to ticks if necessary + double AdjustAndSnap(double value) const; + + // ensure that the value is in range wrapping it round if necessary + double AdjustToFitInRange(double value) const; + + // Assign validator with current parameters + virtual void ResetTextValidator() = 0; + + double m_value; + double m_min; + double m_max; + double m_increment; + bool m_snap_to_ticks; + + int m_spin_value; + + // the subcontrols + wxTextCtrl *m_textCtrl; + wxSpinButton *m_spinButton; + +private: + // common part of all ctors + void Init(); + + // Implement pure virtual function inherited from wxCompositeWindow. + virtual wxWindowList GetCompositeWindowParts() const wxOVERRIDE; + + wxDECLARE_EVENT_TABLE(); +}; + +#else // !wxUSE_SPINBTN + +#define wxSPINCTRL_GETVALUE_FIX int = 1 + +// ---------------------------------------------------------------------------- +// wxSpinCtrl is just a text control +// ---------------------------------------------------------------------------- + +#include "wx/textctrl.h" + +class WXDLLIMPEXP_CORE wxSpinCtrlGenericBase : public wxTextCtrl +{ +public: + wxSpinCtrlGenericBase() : m_value(0), m_min(0), m_max(100), + m_increment(1), m_snap_to_ticks(false), + m_format(wxT("%g")) { } + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + double min = 0, double max = 100, double initial = 0, + double inc = 1, + const wxString& name = wxT("wxSpinCtrl")) + { + m_min = min; + m_max = max; + m_value = initial; + m_increment = inc; + + bool ok = wxTextCtrl::Create(parent, id, value, pos, size, style, + wxDefaultValidator, name); + DoSetValue(initial, SendEvent_None); + + return ok; + } + + // accessors + // T GetValue() const + // T GetMin() const + // T GetMax() const + // T GetIncrement() const + virtual bool GetSnapToTicks() const { return m_snap_to_ticks; } + // unsigned GetDigits() const - wxSpinCtrlDouble only + + // operations + virtual void SetValue(const wxString& text) { wxTextCtrl::SetValue(text); } + // void SetValue(T val) + // void SetRange(T minVal, T maxVal) + // void SetIncrement(T inc) + virtual void SetSnapToTicks(bool snap_to_ticks) + { m_snap_to_ticks = snap_to_ticks; } + // void SetDigits(unsigned digits) - wxSpinCtrlDouble only + + // Select text in the textctrl + //void SetSelection(long from, long to); + +protected: + // generic double valued + double DoGetValue() const + { + double n; + if ( (wxSscanf(wxTextCtrl::GetValue(), wxT("%lf"), &n) != 1) ) + n = INT_MIN; + + return n; + } + + bool DoSetValue(double val, SendEvent sendEvent) + { + wxString str(wxString::Format(m_format, val)); + switch ( sendEvent ) + { + case SendEvent_None: + wxTextCtrl::ChangeValue(str); + break; + + case SendEvent_Text: + wxTextCtrl::SetValue(str); + break; + } + + return true; + } + void DoSetRange(double min_val, double max_val) + { + m_min = min_val; + m_max = max_val; + } + void DoSetIncrement(double inc) { m_increment = inc; } // Note: unused + + double m_value; + double m_min; + double m_max; + double m_increment; + bool m_snap_to_ticks; + wxString m_format; +}; + +#endif // wxUSE_SPINBTN/!wxUSE_SPINBTN + +#if !defined(wxHAS_NATIVE_SPINCTRL) + +//----------------------------------------------------------------------------- +// wxSpinCtrl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSpinCtrl : public wxSpinCtrlGenericBase +{ +public: + wxSpinCtrl() { Init(); } + wxSpinCtrl(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + int min = 0, int max = 100, int initial = 0, + const wxString& name = wxT("wxSpinCtrl")) + { + Init(); + + Create(parent, id, value, pos, size, style, min, max, initial, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + int min = 0, int max = 100, int initial = 0, + const wxString& name = wxT("wxSpinCtrl")) + { + return wxSpinCtrlGenericBase::Create(parent, id, value, pos, size, + style, min, max, initial, 1, name); + } + + // accessors + int GetValue(wxSPINCTRL_GETVALUE_FIX) const { return int(DoGetValue()); } + int GetMin() const { return int(m_min); } + int GetMax() const { return int(m_max); } + int GetIncrement() const { return int(m_increment); } + + // operations + virtual void SetValue(const wxString& value) wxOVERRIDE + { wxSpinCtrlGenericBase::SetValue(value); } + void SetValue( int value ) { DoSetValue(value, SendEvent_None); } + void SetRange( int minVal, int maxVal ) { DoSetRange(minVal, maxVal); } + void SetIncrement(int inc) { DoSetIncrement(inc); } + + virtual int GetBase() const wxOVERRIDE { return m_base; } + virtual bool SetBase(int base) wxOVERRIDE; + +protected: + virtual void DoSendEvent() wxOVERRIDE; + + virtual bool DoTextToValue(const wxString& text, double *val) wxOVERRIDE; + virtual wxString DoValueToText(double val) wxOVERRIDE; + virtual void ResetTextValidator() wxOVERRIDE; + +private: + // Common part of all ctors. + void Init() + { + m_base = 10; + } + + int m_base; + + wxDECLARE_DYNAMIC_CLASS(wxSpinCtrl); +}; + +#endif // wxHAS_NATIVE_SPINCTRL + +//----------------------------------------------------------------------------- +// wxSpinCtrlDouble +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSpinCtrlDouble : public wxSpinCtrlGenericBase +{ +public: + wxSpinCtrlDouble() { Init(); } + wxSpinCtrlDouble(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + double min = 0, double max = 100, double initial = 0, + double inc = 1, + const wxString& name = wxT("wxSpinCtrlDouble")) + { + Init(); + + Create(parent, id, value, pos, size, style, + min, max, initial, inc, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + double min = 0, double max = 100, double initial = 0, + double inc = 1, + const wxString& name = wxT("wxSpinCtrlDouble")); + + // accessors + double GetValue(wxSPINCTRL_GETVALUE_FIX) const { return DoGetValue(); } + double GetMin() const { return m_min; } + double GetMax() const { return m_max; } + double GetIncrement() const { return m_increment; } + unsigned GetDigits() const { return m_digits; } + + // operations + void SetValue(const wxString& value) wxOVERRIDE + { wxSpinCtrlGenericBase::SetValue(value); } + void SetValue(double value) { DoSetValue(value, SendEvent_None); } + void SetRange(double minVal, double maxVal) { DoSetRange(minVal, maxVal); } + void SetIncrement(double inc); + void SetDigits(unsigned digits); + + // We don't implement bases support for floating point numbers, this is not + // very useful in practice. + virtual int GetBase() const wxOVERRIDE { return 10; } + virtual bool SetBase(int WXUNUSED(base)) wxOVERRIDE { return false; } + +protected: + virtual void DoSendEvent() wxOVERRIDE; + + virtual bool DoTextToValue(const wxString& text, double *val) wxOVERRIDE; + virtual wxString DoValueToText(double val) wxOVERRIDE; + virtual void ResetTextValidator() wxOVERRIDE; + + unsigned m_digits; + +private: + // Common part of all ctors. + void Init() + { + DoSetDigits(0); + } + + // Just set the number of digits and the format unconditionally. + void DoSetDigits(unsigned digits); + + // Call DoSetDigits() and update the appearance. + void DoSetDigitsAndUpdate(unsigned digits); + + + wxDECLARE_DYNAMIC_CLASS(wxSpinCtrlDouble); +}; + +#endif // _WX_GENERIC_SPINCTRL_H_ diff --git a/lib/wxWidgets/include/wx/generic/splash.h b/lib/wxWidgets/include/wx/generic/splash.h new file mode 100644 index 0000000..58a0add --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/splash.h @@ -0,0 +1,97 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/splash.h +// Purpose: Splash screen class +// Author: Julian Smart +// Modified by: +// Created: 28/6/2000 +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SPLASH_H_ +#define _WX_SPLASH_H_ + +#include "wx/bitmap.h" +#include "wx/eventfilter.h" +#include "wx/frame.h" +#include "wx/timer.h" + + +/* + * A window for displaying a splash screen + */ + +#define wxSPLASH_CENTRE_ON_PARENT 0x01 +#define wxSPLASH_CENTRE_ON_SCREEN 0x02 +#define wxSPLASH_NO_CENTRE 0x00 +#define wxSPLASH_TIMEOUT 0x04 +#define wxSPLASH_NO_TIMEOUT 0x00 + +class WXDLLIMPEXP_FWD_CORE wxSplashScreenWindow; + +/* + * wxSplashScreen + */ + +class WXDLLIMPEXP_CORE wxSplashScreen: public wxFrame, + public wxEventFilter +{ +public: + // for RTTI macros only + wxSplashScreen() { Init(); } + wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds, + wxWindow* parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP); + virtual ~wxSplashScreen(); + + void OnCloseWindow(wxCloseEvent& event); + void OnNotify(wxTimerEvent& event); + + long GetSplashStyle() const { return m_splashStyle; } + wxSplashScreenWindow* GetSplashWindow() const { return m_window; } + int GetTimeout() const { return m_milliseconds; } + + // Override wxEventFilter method to hide splash screen on any user input. + virtual int FilterEvent(wxEvent& event) wxOVERRIDE; + +protected: + // Common part of all ctors. + void Init(); + + wxSplashScreenWindow* m_window; + long m_splashStyle; + int m_milliseconds; + wxTimer m_timer; + + wxDECLARE_DYNAMIC_CLASS(wxSplashScreen); + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxSplashScreen); +}; + +/* + * wxSplashScreenWindow + */ + +class WXDLLIMPEXP_CORE wxSplashScreenWindow: public wxWindow +{ +public: + wxSplashScreenWindow(const wxBitmap& bitmap, wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxNO_BORDER); + + void OnPaint(wxPaintEvent& event); + void OnEraseBackground(wxEraseEvent& event); + + void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; } + wxBitmap& GetBitmap() { return m_bitmap; } + +protected: + wxBitmap m_bitmap; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxSplashScreenWindow); +}; + + +#endif + // _WX_SPLASH_H_ diff --git a/lib/wxWidgets/include/wx/generic/splitter.h b/lib/wxWidgets/include/wx/generic/splitter.h new file mode 100644 index 0000000..17089c5 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/splitter.h @@ -0,0 +1,453 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/splitter.h +// Purpose: wxSplitterWindow class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_SPLITTER_H_ +#define _WX_GENERIC_SPLITTER_H_ + +#include "wx/window.h" // base class declaration +#include "wx/containr.h" // wxControlContainer + +class WXDLLIMPEXP_FWD_CORE wxSplitterEvent; + +// --------------------------------------------------------------------------- +// splitter constants +// --------------------------------------------------------------------------- + +enum wxSplitMode +{ + wxSPLIT_HORIZONTAL = 1, + wxSPLIT_VERTICAL +}; + +enum +{ + wxSPLIT_DRAG_NONE, + wxSPLIT_DRAG_DRAGGING, + wxSPLIT_DRAG_LEFT_DOWN +}; + +// --------------------------------------------------------------------------- +// wxSplitterWindow maintains one or two panes, with +// an optional vertical or horizontal split which +// can be used with the mouse or programmatically. +// --------------------------------------------------------------------------- + +// TODO: +// 1) Perhaps make the borders sensitive to dragging in order to create a split. +// The MFC splitter window manages scrollbars as well so is able to +// put sash buttons on the scrollbars, but we probably don't want to go down +// this path. +// 2) for wxWidgets 2.0, we must find a way to set the WS_CLIPCHILDREN style +// to prevent flickering. (WS_CLIPCHILDREN doesn't work in all cases so can't be +// standard). + +class WXDLLIMPEXP_CORE wxSplitterWindow: public wxNavigationEnabled +{ +public: + +//////////////////////////////////////////////////////////////////////////// +// Public API + + // Default constructor + wxSplitterWindow() + { + Init(); + } + + // Normal constructor + wxSplitterWindow(wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_3D, + const wxString& name = wxT("splitter")) + { + Init(); + Create(parent, id, pos, size, style, name); + } + + virtual ~wxSplitterWindow(); + + bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_3D, + const wxString& name = wxT("splitter")); + + // Gets the only or left/top pane + wxWindow *GetWindow1() const { return m_windowOne; } + + // Gets the right/bottom pane + wxWindow *GetWindow2() const { return m_windowTwo; } + + // Sets the split mode + void SetSplitMode(int mode) + { + wxASSERT_MSG( mode == wxSPLIT_VERTICAL || mode == wxSPLIT_HORIZONTAL, + wxT("invalid split mode") ); + + m_splitMode = (wxSplitMode)mode; + } + + // Gets the split mode + wxSplitMode GetSplitMode() const { return m_splitMode; } + + // Initialize with one window + void Initialize(wxWindow *window); + + // Associates the given window with window 2, drawing the appropriate sash + // and changing the split mode. + // Does nothing and returns false if the window is already split. + // A sashPosition of 0 means choose a default sash position, + // negative sashPosition specifies the size of right/lower pane as its + // absolute value rather than the size of left/upper pane. + virtual bool SplitVertically(wxWindow *window1, + wxWindow *window2, + int sashPosition = 0) + { return DoSplit(wxSPLIT_VERTICAL, window1, window2, sashPosition); } + virtual bool SplitHorizontally(wxWindow *window1, + wxWindow *window2, + int sashPosition = 0) + { return DoSplit(wxSPLIT_HORIZONTAL, window1, window2, sashPosition); } + + // Removes the specified (or second) window from the view + // Doesn't actually delete the window. + bool Unsplit(wxWindow *toRemove = NULL); + + // Replaces one of the windows with another one (neither old nor new + // parameter should be NULL) + bool ReplaceWindow(wxWindow *winOld, wxWindow *winNew); + + // Make sure the child window sizes are updated. This is useful + // for reducing flicker by updating the sizes before a + // window is shown, if you know the overall size is correct. + void UpdateSize(); + + // Is the window split? + bool IsSplit() const { return (m_windowTwo != NULL); } + + // Sets the border size + void SetBorderSize(int WXUNUSED(width)) { } + + // Hide or show the sash and test whether it's currently hidden. + void SetSashInvisible(bool invisible = true); + bool IsSashInvisible() const { return HasFlag(wxSP_NOSASH); } + + // Gets the current sash size which may be 0 if it's hidden and the default + // sash size. + int GetSashSize() const; + int GetDefaultSashSize() const; + + // Gets the border size + int GetBorderSize() const; + + // Set the sash position + void SetSashPosition(int position, bool redraw = true); + + // Gets the sash position + int GetSashPosition() const { return m_sashPosition; } + + // Set the sash gravity + void SetSashGravity(double gravity); + + // Gets the sash gravity + double GetSashGravity() const { return m_sashGravity; } + + // If this is zero, we can remove panes by dragging the sash. + void SetMinimumPaneSize(int min); + int GetMinimumPaneSize() const { return m_minimumPaneSize; } + + // NB: the OnXXX() functions below are for backwards compatibility only, + // don't use them in new code but handle the events instead! + + // called when the sash position is about to change, may return a new value + // for the sash or -1 to prevent the change from happening at all + virtual int OnSashPositionChanging(int newSashPosition); + + // Called when the sash position is about to be changed, return + // false from here to prevent the change from taking place. + // Repositions sash to minimum position if pane would be too small. + // newSashPosition here is always positive or zero. + virtual bool OnSashPositionChange(int newSashPosition); + + // If the sash is moved to an extreme position, a subwindow + // is removed from the splitter window, and the app is + // notified. The app should delete or hide the window. + virtual void OnUnsplit(wxWindow *removed); + + // Called when the sash is double-clicked. + // The default behaviour is to remove the sash if the + // minimum pane size is zero. + virtual void OnDoubleClickSash(int x, int y); + +//////////////////////////////////////////////////////////////////////////// +// Implementation + + // Paints the border and sash + void OnPaint(wxPaintEvent& event); + + // Handles mouse events + void OnMouseEvent(wxMouseEvent& ev); + + // Aborts dragging mode + void OnMouseCaptureLost(wxMouseCaptureLostEvent& event); + + // Adjusts the panes + void OnSize(wxSizeEvent& event); + + void OnDPIChanged(wxDPIChangedEvent& event); + + // In live mode, resize child windows in idle time + void OnInternalIdle() wxOVERRIDE; + + // Draws the sash + virtual void DrawSash(wxDC& dc); + + // Draws the sash tracker (for whilst moving the sash) + virtual void DrawSashTracker(int x, int y); + + // Tests for x, y over sash + virtual bool SashHitTest(int x, int y); + + // Resizes subwindows + virtual void SizeWindows(); + +#ifdef __WXMAC__ + virtual bool MacClipGrandChildren() const wxOVERRIDE { return true ; } +#endif + + // Sets the sash size: this doesn't do anything and shouldn't be used at + // all any more. + wxDEPRECATED_INLINE( void SetSashSize(int WXUNUSED(width)), return; ) + +protected: + // event handlers +#if defined(__WXMSW__) || defined(__WXMAC__) + void OnSetCursor(wxSetCursorEvent& event); +#endif // wxMSW + + // common part of all ctors + void Init(); + + // common part of SplitVertically() and SplitHorizontally() + bool DoSplit(wxSplitMode mode, + wxWindow *window1, wxWindow *window2, + int sashPosition); + + // adjusts sash position with respect to min. pane and window sizes + int AdjustSashPosition(int sashPos) const; + + // get either width or height depending on the split mode + int GetWindowSize() const; + + // convert the user specified sash position which may be > 0 (as is), < 0 + // (specifying the size of the right pane) or 0 (use default) to the real + // position to be passed to DoSetSashPosition() + int ConvertSashPosition(int sashPos) const; + + // set the real sash position, sashPos here must be positive + // + // returns true if the sash position has been changed, false otherwise + bool DoSetSashPosition(int sashPos); + + // set the sash position and send an event about it having been changed + void SetSashPositionAndNotify(int sashPos); + + // callbacks executed when we detect that the mouse has entered or left + // the sash + virtual void OnEnterSash(); + virtual void OnLeaveSash(); + + // set the cursor appropriate for the current split mode + void SetResizeCursor(); + + // redraw the splitter if its "hotness" changed if necessary + void RedrawIfHotSensitive(bool isHot); + + // return the best size of the splitter equal to best sizes of its + // subwindows + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + + wxSplitMode m_splitMode; + wxWindow* m_windowOne; + wxWindow* m_windowTwo; + int m_dragMode; + int m_oldX; // current tracker position if not live mode + int m_oldY; // current tracker position if not live mode + int m_sashPosition; // Number of pixels from left or top + double m_sashGravity; + wxSize m_lastSize; + int m_requestedSashPosition; + int m_sashPositionCurrent; // while dragging + wxPoint m_ptStart; // mouse position when dragging started + int m_sashStart; // sash position when dragging started + int m_minimumPaneSize; + wxCursor m_sashCursorWE; + wxCursor m_sashCursorNS; + wxPen *m_sashTrackerPen; + + // when in live mode, set this to true to resize children in idle + bool m_needUpdating:1; + bool m_permitUnsplitAlways:1; + bool m_isHot:1; + +private: + wxDECLARE_DYNAMIC_CLASS(wxSplitterWindow); + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxSplitterWindow); +}; + +// ---------------------------------------------------------------------------- +// event class and macros +// ---------------------------------------------------------------------------- + +// we reuse the same class for all splitter event types because this is the +// usual wxWin convention, but the three event types have different kind of +// data associated with them, so the accessors can be only used if the real +// event type matches with the one for which the accessors make sense +class WXDLLIMPEXP_CORE wxSplitterEvent : public wxNotifyEvent +{ +public: + wxSplitterEvent(wxEventType type = wxEVT_NULL, + wxSplitterWindow *splitter = NULL) + : wxNotifyEvent(type) + { + SetEventObject(splitter); + if (splitter) m_id = splitter->GetId(); + + m_data.resize.oldSize = 0; + m_data.resize.newSize = 0; + } + wxSplitterEvent(const wxSplitterEvent& event) + : wxNotifyEvent(event), m_data(event.m_data) + { } + + // SASH_POS_CHANGED methods + + // setting the sash position to -1 prevents the change from taking place at + // all + void SetSashPosition(int pos) + { + wxASSERT( GetEventType() == wxEVT_SPLITTER_SASH_POS_CHANGED + || GetEventType() == wxEVT_SPLITTER_SASH_POS_CHANGING + || GetEventType() == wxEVT_SPLITTER_SASH_POS_RESIZE); + + m_data.resize.pos = pos; + } + + int GetSashPosition() const + { + wxASSERT( GetEventType() == wxEVT_SPLITTER_SASH_POS_CHANGED + || GetEventType() == wxEVT_SPLITTER_SASH_POS_CHANGING + || GetEventType() == wxEVT_SPLITTER_SASH_POS_RESIZE); + + return m_data.resize.pos; + } + + void SetSize(int oldSize, int newSize) + { + wxASSERT(GetEventType() == wxEVT_SPLITTER_SASH_POS_RESIZE); + + m_data.resize.oldSize = oldSize; + m_data.resize.newSize = newSize; + } + + int GetOldSize() const + { + wxASSERT(GetEventType() == wxEVT_SPLITTER_SASH_POS_RESIZE); + + return m_data.resize.oldSize; + } + + int GetNewSize() const + { + wxASSERT(GetEventType() == wxEVT_SPLITTER_SASH_POS_RESIZE); + + return m_data.resize.newSize; + } + + // UNSPLIT event methods + wxWindow *GetWindowBeingRemoved() const + { + wxASSERT( GetEventType() == wxEVT_SPLITTER_UNSPLIT ); + + return m_data.win; + } + + // DCLICK event methods + int GetX() const + { + wxASSERT( GetEventType() == wxEVT_SPLITTER_DOUBLECLICKED ); + + return m_data.pt.x; + } + + int GetY() const + { + wxASSERT( GetEventType() == wxEVT_SPLITTER_DOUBLECLICKED ); + + return m_data.pt.y; + } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxSplitterEvent(*this); } + +private: + friend class WXDLLIMPEXP_FWD_CORE wxSplitterWindow; + + // data for the different types of event + union + { + struct + { + int pos; // position for SASH_POS_* events + int oldSize; // window size for SASH_POS_RESIZE event + int newSize; // window size for SASH_POS_RESIZE event + } resize; + wxWindow *win; // window being removed for UNSPLIT event + struct + { + int x, y; + } pt; // position of double click for DCLICK event + } m_data; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSplitterEvent); +}; + +typedef void (wxEvtHandler::*wxSplitterEventFunction)(wxSplitterEvent&); + +#define wxSplitterEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxSplitterEventFunction, func) + +#define wx__DECLARE_SPLITTEREVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_SPLITTER_ ## evt, id, wxSplitterEventHandler(fn)) + +#define EVT_SPLITTER_SASH_POS_CHANGED(id, fn) \ + wx__DECLARE_SPLITTEREVT(SASH_POS_CHANGED, id, fn) + +#define EVT_SPLITTER_SASH_POS_CHANGING(id, fn) \ + wx__DECLARE_SPLITTEREVT(SASH_POS_CHANGING, id, fn) + +#define EVT_SPLITTER_SASH_POS_RESIZE(id, fn) \ + wx__DECLARE_SPLITTEREVT(SASH_POS_RESIZE, id, fn) + +#define EVT_SPLITTER_DCLICK(id, fn) \ + wx__DECLARE_SPLITTEREVT(DOUBLECLICKED, id, fn) + +#define EVT_SPLITTER_UNSPLIT(id, fn) \ + wx__DECLARE_SPLITTEREVT(UNSPLIT, id, fn) + + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED wxEVT_SPLITTER_SASH_POS_CHANGED +#define wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING wxEVT_SPLITTER_SASH_POS_CHANGING +#define wxEVT_COMMAND_SPLITTER_DOUBLECLICKED wxEVT_SPLITTER_DOUBLECLICKED +#define wxEVT_COMMAND_SPLITTER_UNSPLIT wxEVT_SPLITTER_UNSPLIT + +#endif // _WX_GENERIC_SPLITTER_H_ diff --git a/lib/wxWidgets/include/wx/generic/srchctlg.h b/lib/wxWidgets/include/wx/generic/srchctlg.h new file mode 100644 index 0000000..47acfb1 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/srchctlg.h @@ -0,0 +1,262 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/srchctlg.h +// Purpose: generic wxSearchCtrl class +// Author: Vince Harron +// Created: 2006-02-19 +// Copyright: Vince Harron +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_SEARCHCTRL_H_ +#define _WX_GENERIC_SEARCHCTRL_H_ + +#if wxUSE_SEARCHCTRL + +#include "wx/bitmap.h" + +class WXDLLIMPEXP_FWD_CORE wxSearchButton; +class WXDLLIMPEXP_FWD_CORE wxSearchTextCtrl; + +// ---------------------------------------------------------------------------- +// wxSearchCtrl is a combination of wxTextCtrl and wxSearchButton +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSearchCtrl : public wxSearchCtrlBase +{ +public: + // creation + // -------- + + wxSearchCtrl(); + wxSearchCtrl(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxSearchCtrlNameStr)); + + virtual ~wxSearchCtrl(); + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxSearchCtrlNameStr)); + +#if wxUSE_MENUS + // get/set search button menu + // -------------------------- + virtual void SetMenu( wxMenu* menu ) wxOVERRIDE; + virtual wxMenu* GetMenu() wxOVERRIDE; +#endif // wxUSE_MENUS + + // get/set search options + // ---------------------- + virtual void ShowSearchButton( bool show ) wxOVERRIDE; + virtual bool IsSearchButtonVisible() const wxOVERRIDE; + + virtual void ShowCancelButton( bool show ) wxOVERRIDE; + virtual bool IsCancelButtonVisible() const wxOVERRIDE; + + virtual void SetDescriptiveText(const wxString& text) wxOVERRIDE; + virtual wxString GetDescriptiveText() const wxOVERRIDE; + + // accessors + // --------- + + virtual wxString GetRange(long from, long to) const wxOVERRIDE; + + virtual int GetLineLength(long lineNo) const wxOVERRIDE; + virtual wxString GetLineText(long lineNo) const wxOVERRIDE; + virtual int GetNumberOfLines() const wxOVERRIDE; + + virtual bool IsModified() const wxOVERRIDE; + virtual bool IsEditable() const wxOVERRIDE; + + // more readable flag testing methods + virtual bool IsSingleLine() const; + virtual bool IsMultiLine() const; + + // If the return values from and to are the same, there is no selection. + virtual void GetSelection(long* from, long* to) const wxOVERRIDE; + + virtual wxString GetStringSelection() const wxOVERRIDE; + + // operations + // ---------- + + virtual void ChangeValue(const wxString& value) wxOVERRIDE; + + // editing + virtual void Clear() wxOVERRIDE; + virtual void Replace(long from, long to, const wxString& value) wxOVERRIDE; + virtual void Remove(long from, long to) wxOVERRIDE; + + // load/save the controls contents from/to the file + virtual bool LoadFile(const wxString& file); + virtual bool SaveFile(const wxString& file = wxEmptyString); + + // sets/clears the dirty flag + virtual void MarkDirty() wxOVERRIDE; + virtual void DiscardEdits() wxOVERRIDE; + + // set the max number of characters which may be entered in a single line + // text control + virtual void SetMaxLength(unsigned long WXUNUSED(len)) wxOVERRIDE; + + // writing text inserts it at the current position, appending always + // inserts it at the end + virtual void WriteText(const wxString& text) wxOVERRIDE; + virtual void AppendText(const wxString& text) wxOVERRIDE; + + // insert the character which would have resulted from this key event, + // return true if anything has been inserted + virtual bool EmulateKeyPress(const wxKeyEvent& event); + + // text control under some platforms supports the text styles: these + // methods allow to apply the given text style to the given selection or to + // set/get the style which will be used for all appended text + virtual bool SetStyle(long start, long end, const wxTextAttr& style) wxOVERRIDE; + virtual bool GetStyle(long position, wxTextAttr& style) wxOVERRIDE; + virtual bool SetDefaultStyle(const wxTextAttr& style) wxOVERRIDE; + virtual const wxTextAttr& GetDefaultStyle() const wxOVERRIDE; + + // translate between the position (which is just an index in the text ctrl + // considering all its contents as a single strings) and (x, y) coordinates + // which represent column and line. + virtual long XYToPosition(long x, long y) const wxOVERRIDE; + virtual bool PositionToXY(long pos, long *x, long *y) const wxOVERRIDE; + + virtual void ShowPosition(long pos) wxOVERRIDE; + + // find the character at position given in pixels + // + // NB: pt is in device coords (not adjusted for the client area origin nor + // scrolling) + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const wxOVERRIDE; + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, + wxTextCoord *col, + wxTextCoord *row) const wxOVERRIDE; + + // Clipboard operations + virtual void Copy() wxOVERRIDE; + virtual void Cut() wxOVERRIDE; + virtual void Paste() wxOVERRIDE; + + virtual bool CanCopy() const wxOVERRIDE; + virtual bool CanCut() const wxOVERRIDE; + virtual bool CanPaste() const wxOVERRIDE; + + // Undo/redo + virtual void Undo() wxOVERRIDE; + virtual void Redo() wxOVERRIDE; + + virtual bool CanUndo() const wxOVERRIDE; + virtual bool CanRedo() const wxOVERRIDE; + + // Insertion point + virtual void SetInsertionPoint(long pos) wxOVERRIDE; + virtual void SetInsertionPointEnd() wxOVERRIDE; + virtual long GetInsertionPoint() const wxOVERRIDE; + virtual wxTextPos GetLastPosition() const wxOVERRIDE; + + virtual void SetSelection(long from, long to) wxOVERRIDE; + virtual void SelectAll() wxOVERRIDE; + virtual void SetEditable(bool editable) wxOVERRIDE; + + // Autocomplete + virtual bool DoAutoCompleteStrings(const wxArrayString &choices) wxOVERRIDE; + virtual bool DoAutoCompleteFileNames(int flags) wxOVERRIDE; + virtual bool DoAutoCompleteCustom(wxTextCompleter *completer) wxOVERRIDE; + + virtual bool ShouldInheritColours() const wxOVERRIDE; + + // wxWindow overrides + virtual bool SetFont(const wxFont& font) wxOVERRIDE; + virtual bool SetBackgroundColour(const wxColour& colour) wxOVERRIDE; + + // search control generic only + void SetSearchBitmap( const wxBitmap& bitmap ); + void SetCancelBitmap( const wxBitmap& bitmap ); +#if wxUSE_MENUS + void SetSearchMenuBitmap( const wxBitmap& bitmap ); +#endif // wxUSE_MENUS + +protected: + virtual void DoSetValue(const wxString& value, int flags) wxOVERRIDE; + virtual wxString DoGetValue() const wxOVERRIDE; + + virtual bool DoLoadFile(const wxString& file, int fileType) wxOVERRIDE; + virtual bool DoSaveFile(const wxString& file, int fileType) wxOVERRIDE; + + // override the base class virtuals involved into geometry calculations + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + + virtual void RecalcBitmaps(); + + void Init(); + + virtual wxBitmap RenderSearchBitmap( int x, int y, bool renderDrop ); + virtual wxBitmap RenderCancelBitmap( int x, int y ); + + void OnCancelButton( wxCommandEvent& event ); + + void OnSize( wxSizeEvent& event ); + + void OnDPIChanged(wxDPIChangedEvent& event); + + bool HasMenu() const + { +#if wxUSE_MENUS + return m_menu != NULL; +#else // !wxUSE_MENUS + return false; +#endif // wxUSE_MENUS/!wxUSE_MENUS + } + +private: + friend class wxSearchButton; + + // Implement pure virtual function inherited from wxCompositeWindow. + virtual wxWindowList GetCompositeWindowParts() const wxOVERRIDE; + + // Position the child controls using the current window size. + void LayoutControls(); + +#if wxUSE_MENUS + void PopupSearchMenu(); +#endif // wxUSE_MENUS + + // the subcontrols + wxSearchTextCtrl *m_text; + wxSearchButton *m_searchButton; + wxSearchButton *m_cancelButton; +#if wxUSE_MENUS + wxMenu *m_menu; +#endif // wxUSE_MENUS + + bool m_searchBitmapUser; + bool m_cancelBitmapUser; +#if wxUSE_MENUS + bool m_searchMenuBitmapUser; +#endif // wxUSE_MENUS + + wxBitmap m_searchBitmap; + wxBitmap m_cancelBitmap; +#if wxUSE_MENUS + wxBitmap m_searchMenuBitmap; +#endif // wxUSE_MENUS + +private: + wxDECLARE_DYNAMIC_CLASS(wxSearchCtrl); + + wxDECLARE_EVENT_TABLE(); +}; + +#endif // wxUSE_SEARCHCTRL + +#endif // _WX_GENERIC_SEARCHCTRL_H_ + diff --git a/lib/wxWidgets/include/wx/generic/statbmpg.h b/lib/wxWidgets/include/wx/generic/statbmpg.h new file mode 100644 index 0000000..2f54711 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/statbmpg.h @@ -0,0 +1,63 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/statbmpg.h +// Purpose: wxGenericStaticBitmap header +// Author: Marcin Wojdyr, Stefan Csomor +// Created: 2008-06-16 +// Copyright: wxWidgets developers +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_STATBMP_H_ +#define _WX_GENERIC_STATBMP_H_ + +#include "wx/statbmp.h" + +class WXDLLIMPEXP_CORE wxGenericStaticBitmap : public wxStaticBitmapBase +{ +public: + wxGenericStaticBitmap() {} + wxGenericStaticBitmap(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBitmapNameStr)) + { + Create(parent, id, bitmap, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBitmapNameStr)); + + virtual void SetBitmap(const wxBitmapBundle& bitmap) wxOVERRIDE + { + m_bitmapBundle = bitmap; + InvalidateBestSize(); + SetSize(GetBestSize()); + Refresh(); + } + + virtual void SetScaleMode(ScaleMode scaleMode) wxOVERRIDE + { + m_scaleMode = scaleMode; + Refresh(); + } + + virtual ScaleMode GetScaleMode() const wxOVERRIDE { return m_scaleMode; } + +private: + void OnPaint(wxPaintEvent& event); + + ScaleMode m_scaleMode; + + wxDECLARE_DYNAMIC_CLASS(wxGenericStaticBitmap); +}; + + +#endif //_WX_GENERIC_STATBMP_H_ diff --git a/lib/wxWidgets/include/wx/generic/statline.h b/lib/wxWidgets/include/wx/generic/statline.h new file mode 100644 index 0000000..39dfa09 --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/statline.h @@ -0,0 +1,61 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/statline.h +// Purpose: a generic wxStaticLine class +// Author: Vadim Zeitlin +// Created: 28.06.99 +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_STATLINE_H_ +#define _WX_GENERIC_STATLINE_H_ + +class wxStaticBox; + +// ---------------------------------------------------------------------------- +// wxStaticLine +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxStaticLine : public wxStaticLineBase +{ + wxDECLARE_DYNAMIC_CLASS(wxStaticLine); + +public: + // constructors and pseudo-constructors + wxStaticLine() { m_statbox = NULL; } + + wxStaticLine( wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxASCII_STR(wxStaticLineNameStr) ) + { + Create(parent, id, pos, size, style, name); + } + + virtual ~wxStaticLine(); + + bool Create( wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxASCII_STR(wxStaticLineNameStr) ); + + // it's necessary to override this wxWindow function because we + // will want to return the main widget for m_statbox + // + WXWidget GetMainWidget() const; + + // override wxWindow methods to make things work + virtual void DoSetSize(int x, int y, int width, int height, + int sizeFlags = wxSIZE_AUTO); + virtual void DoMoveWindow(int x, int y, int width, int height); +protected: + // we implement the static line using a static box + wxStaticBox *m_statbox; +}; + +#endif // _WX_GENERIC_STATLINE_H_ + diff --git a/lib/wxWidgets/include/wx/generic/stattextg.h b/lib/wxWidgets/include/wx/generic/stattextg.h new file mode 100644 index 0000000..6b98f6c --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/stattextg.h @@ -0,0 +1,90 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/stattextg.h +// Purpose: wxGenericStaticText header +// Author: Marcin Wojdyr +// Created: 2008-06-26 +// Copyright: Marcin Wojdyr +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_STATTEXTG_H_ +#define _WX_GENERIC_STATTEXTG_H_ + +// prevent it from including the platform-specific wxStaticText declaration as +// this is not going to compile if it derives from wxGenericStaticText defined +// below (currently this is only the case in wxUniv but it could also happen +// with other ports) +#define wxNO_PORT_STATTEXT_INCLUDE +#include "wx/stattext.h" +#undef wxNO_PORT_STATTEXT_INCLUDE + +class WXDLLIMPEXP_CORE wxGenericStaticText : public wxStaticTextBase +{ +public: + wxGenericStaticText() { Init(); } + + wxGenericStaticText(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticTextNameStr)) + { + Init(); + + Create(parent, id, label, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticTextNameStr)); + + virtual ~wxGenericStaticText(); + + + // overridden base class virtual methods + virtual void SetLabel(const wxString& label) wxOVERRIDE; + virtual bool SetFont(const wxFont &font) wxOVERRIDE; + +protected: + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + + virtual wxString WXGetVisibleLabel() const wxOVERRIDE { return m_label; } + virtual void WXSetVisibleLabel(const wxString& label) wxOVERRIDE; + + void DoSetSize(int x, int y, int width, int height, int sizeFlags) wxOVERRIDE; + +#if wxUSE_MARKUP + virtual bool DoSetLabelMarkup(const wxString& markup) wxOVERRIDE; +#endif // wxUSE_MARKUP + +private: + void Init() + { +#if wxUSE_MARKUP + m_markupText = NULL; +#endif // wxUSE_MARKUP + } + + void OnPaint(wxPaintEvent& event); + + void DoDrawLabel(wxDC& dc, const wxRect& rect); + + // These fields are only used if m_markupText == NULL. + wxString m_label; + int m_mnemonic; + +#if wxUSE_MARKUP + class wxMarkupText *m_markupText; +#endif // wxUSE_MARKUP + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericStaticText); +}; + +#endif // _WX_GENERIC_STATTEXTG_H_ + diff --git a/lib/wxWidgets/include/wx/generic/statusbr.h b/lib/wxWidgets/include/wx/generic/statusbr.h new file mode 100644 index 0000000..a13ca9e --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/statusbr.h @@ -0,0 +1,119 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/statusbr.h +// Purpose: wxStatusBarGeneric class +// Author: Julian Smart +// Modified by: VZ at 05.02.00 to derive from wxStatusBarBase +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_STATUSBR_H_ +#define _WX_GENERIC_STATUSBR_H_ + +#include "wx/defs.h" + +#if wxUSE_STATUSBAR + +#include "wx/pen.h" +#include "wx/arrstr.h" + + +// ---------------------------------------------------------------------------- +// wxStatusBarGeneric +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxStatusBarGeneric : public wxStatusBarBase +{ +public: + wxStatusBarGeneric() { Init(); } + wxStatusBarGeneric(wxWindow *parent, + wxWindowID winid = wxID_ANY, + long style = wxSTB_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxStatusBarNameStr)) + { + Init(); + + Create(parent, winid, style, name); + } + + virtual ~wxStatusBarGeneric(); + + bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY, + long style = wxSTB_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxStatusBarNameStr)); + + // implement base class methods + virtual void SetStatusWidths(int n, const int widths_field[]) wxOVERRIDE; + virtual bool GetFieldRect(int i, wxRect& rect) const wxOVERRIDE; + virtual void SetMinHeight(int height) wxOVERRIDE; + + virtual int GetBorderX() const wxOVERRIDE { return m_borderX; } + virtual int GetBorderY() const wxOVERRIDE { return m_borderY; } + + + // implementation only (not part of wxStatusBar public API): + + int GetFieldFromPoint(const wxPoint& point) const; + +protected: + virtual void DoUpdateStatusText(int number) wxOVERRIDE; + + // event handlers + void OnPaint(wxPaintEvent& event); + void OnSize(wxSizeEvent& event); + + void OnLeftDown(wxMouseEvent& event); + void OnRightDown(wxMouseEvent& event); + + // Responds to colour changes + void OnSysColourChanged(wxSysColourChangedEvent& event); + +protected: + virtual int GetEffectiveFieldStyle(int i) const { return m_panes[i].GetStyle(); } + virtual void DrawFieldText(wxDC& dc, const wxRect& rc, int i, int textHeight); + virtual void DrawField(wxDC& dc, int i, int textHeight); + + void SetBorderX(int x); + void SetBorderY(int y); + + virtual void InitColours(); + + // true if the status bar shows the size grip: for this it must have + // wxSTB_SIZEGRIP style and the window it is attached to must be resizable + // and not maximized (note that currently size grip is only used in wxGTK) + bool ShowsSizeGrip() const; + + // returns the position and the size of the size grip + wxRect GetSizeGripRect() const; + + // common part of all ctors + void Init(); + + // the last known size, fields widths must be updated whenever it's out of + // date + wxSize m_lastClientSize; + + // the absolute widths of the status bar panes in pixels + wxArrayInt m_widthsAbs; + + int m_borderX; + int m_borderY; + + wxPen m_mediumShadowPen; + wxPen m_hilightPen; + + virtual wxSize DoGetBestSize() const wxOVERRIDE; + +private: + // Update m_lastClientSize and m_widthsAbs from the current size. + void DoUpdateFieldWidths(); + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxStatusBarGeneric); +}; + +#endif // wxUSE_STATUSBAR + +#endif + // _WX_GENERIC_STATUSBR_H_ diff --git a/lib/wxWidgets/include/wx/generic/tabg.h b/lib/wxWidgets/include/wx/generic/tabg.h new file mode 100644 index 0000000..f67870d --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/tabg.h @@ -0,0 +1,358 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/tabg.h +// Purpose: Generic tabbed dialogs; used by wxMotif's wxNotebook +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __TABGH_G__ +#define __TABGH_G__ + +#define WXTAB_VERSION 1.1 + +#include "wx/hashmap.h" +#include "wx/string.h" +#include "wx/dialog.h" +#include "wx/panel.h" +#include "wx/list.h" + +class WXDLLIMPEXP_FWD_CORE wxTabView; + +/* + * A wxTabControl is the internal and visual representation + * of the tab. + */ + +class WXDLLIMPEXP_CORE wxTabControl: public wxObject +{ + wxDECLARE_DYNAMIC_CLASS(wxTabControl); +public: + wxTabControl(wxTabView *v = NULL); + virtual ~wxTabControl(void); + + virtual void OnDraw(wxDC& dc, bool lastInRow); + void SetLabel(const wxString& str) { m_controlLabel = str; } + wxString GetLabel(void) const { return m_controlLabel; } + + void SetFont(const wxFont& f) { m_labelFont = f; } + wxFont *GetFont(void) const { return (wxFont*) & m_labelFont; } + + void SetSelected(bool sel) { m_isSelected = sel; } + bool IsSelected(void) const { return m_isSelected; } + + void SetPosition(int x, int y) { m_offsetX = x; m_offsetY = y; } + void SetSize(int x, int y) { m_width = x; m_height = y; } + + void SetRowPosition(int r) { m_rowPosition = r; } + int GetRowPosition() const { return m_rowPosition; } + void SetColPosition(int c) { m_colPosition = c; } + int GetColPosition() const { return m_colPosition; } + + int GetX(void) const { return m_offsetX; } + int GetY(void) const { return m_offsetY; } + int GetWidth(void) const { return m_width; } + int GetHeight(void) const { return m_height; } + + int GetId(void) const { return m_id; } + void SetId(int i) { m_id = i; } + + virtual bool HitTest(int x, int y) const ; + +protected: + wxTabView* m_view; + wxString m_controlLabel; + bool m_isSelected; + wxFont m_labelFont; + int m_offsetX; // Offsets from top-left of tab view area (the area below the tabs) + int m_offsetY; + int m_width; + int m_height; + int m_id; + int m_rowPosition; // Position in row from 0 + int m_colPosition; // Position in col from 0 +}; + +/* + * Each wxTabLayer is a list of tabs. E.g. there + * are 3 layers in the MS Word Options dialog. + */ + +class WXDLLIMPEXP_CORE wxTabLayer: public wxList +{ +}; + +/* + * The wxTabView controls and draws the tabbed object + */ + +WX_DECLARE_LIST(wxTabLayer, wxTabLayerList); + +#define wxTAB_STYLE_DRAW_BOX 1 // Draws 3D boxes round tab layers +#define wxTAB_STYLE_COLOUR_INTERIOR 2 // Colours interior of tabs, otherwise draws outline + +class WXDLLIMPEXP_CORE wxTabView: public wxObject +{ + wxDECLARE_DYNAMIC_CLASS(wxTabView); +public: + wxTabView(long style = wxTAB_STYLE_DRAW_BOX | wxTAB_STYLE_COLOUR_INTERIOR); + virtual ~wxTabView(); + + inline int GetNumberOfLayers() const { return m_layers.GetCount(); } + inline wxTabLayerList& GetLayers() { return m_layers; } + + inline void SetWindow(wxWindow* wnd) { m_window = wnd; } + inline wxWindow* GetWindow(void) const { return m_window; } + + // Automatically positions tabs + wxTabControl *AddTab(int id, const wxString& label, wxTabControl *existingTab = NULL); + + // Remove the tab without deleting the window + bool RemoveTab(int id); + + void ClearTabs(bool deleteTabs = true); + + bool SetTabText(int id, const wxString& label); + wxString GetTabText(int id) const; + + // Layout tabs (optional, e.g. if resizing window) + void LayoutTabs(); + + // Draw all tabs + virtual void Draw(wxDC& dc); + + // Process mouse event, return false if we didn't process it + virtual bool OnEvent(wxMouseEvent& event); + + // Called when a tab is activated + virtual void OnTabActivate(int activateId, int deactivateId); + // Allows vetoing + virtual bool OnTabPreActivate(int WXUNUSED(activateId), int WXUNUSED(deactivateId) ) { return true; } + + // Allows use of application-supplied wxTabControl classes. + virtual wxTabControl *OnCreateTabControl(void) { return new wxTabControl(this); } + + void SetHighlightColour(const wxColour& col); + void SetShadowColour(const wxColour& col); + void SetBackgroundColour(const wxColour& col); + inline void SetTextColour(const wxColour& col) { m_textColour = col; } + + inline wxColour GetHighlightColour(void) const { return m_highlightColour; } + inline wxColour GetShadowColour(void) const { return m_shadowColour; } + inline wxColour GetBackgroundColour(void) const { return m_backgroundColour; } + inline wxColour GetTextColour(void) const { return m_textColour; } + inline const wxPen *GetHighlightPen(void) const { return m_highlightPen; } + inline const wxPen *GetShadowPen(void) const { return m_shadowPen; } + inline const wxPen *GetBackgroundPen(void) const { return m_backgroundPen; } + inline const wxBrush *GetBackgroundBrush(void) const { return m_backgroundBrush; } + + inline void SetViewRect(const wxRect& rect) { m_tabViewRect = rect; } + inline wxRect GetViewRect(void) const { return m_tabViewRect; } + + // Calculate tab width to fit to view, and optionally adjust the view + // to fit the tabs exactly. + int CalculateTabWidth(int noTabs, bool adjustView = false); + + inline void SetTabStyle(long style) { m_tabStyle = style; } + inline long GetTabStyle(void) const { return m_tabStyle; } + + inline void SetTabSize(int w, int h) { m_tabWidth = w; m_tabHeight = h; } + inline int GetTabWidth(void) const { return m_tabWidth; } + inline int GetTabHeight(void) const { return m_tabHeight; } + inline void SetTabSelectionHeight(int h) { m_tabSelectionHeight = h; } + inline int GetTabSelectionHeight(void) const { return m_tabSelectionHeight; } + + // Returns the total height of the tabs component -- this may be several + // times the height of a tab, if there are several tab layers (rows). + int GetTotalTabHeight(); + + inline int GetTopMargin(void) const { return m_topMargin; } + inline void SetTopMargin(int margin) { m_topMargin = margin; } + + void SetTabSelection(int sel, bool activateTool = true); + inline int GetTabSelection() const { return m_tabSelection; } + + // Find tab control for id + wxTabControl *FindTabControlForId(int id) const ; + + // Find tab control for layer, position (starting from zero) + wxTabControl *FindTabControlForPosition(int layer, int position) const ; + + inline int GetHorizontalTabOffset() const { return m_tabHorizontalOffset; } + inline int GetHorizontalTabSpacing() const { return m_tabHorizontalSpacing; } + inline void SetHorizontalTabOffset(int sp) { m_tabHorizontalOffset = sp; } + inline void SetHorizontalTabSpacing(int sp) { m_tabHorizontalSpacing = sp; } + + inline void SetVerticalTabTextSpacing(int s) { m_tabVerticalTextSpacing = s; } + inline int GetVerticalTabTextSpacing() const { return m_tabVerticalTextSpacing; } + + inline wxFont *GetTabFont() const { return (wxFont*) & m_tabFont; } + inline void SetTabFont(const wxFont& f) { m_tabFont = f; } + + inline wxFont *GetSelectedTabFont() const { return (wxFont*) & m_tabSelectedFont; } + inline void SetSelectedTabFont(const wxFont& f) { m_tabSelectedFont = f; } + // Find the node and the column at which this control is positioned. + wxList::compatibility_iterator FindTabNodeAndColumn(wxTabControl *control, int *col) const ; + + // Do the necessary to change to this tab + virtual bool ChangeTab(wxTabControl *control); + + // Move the selected tab to the bottom layer, if necessary, + // without calling app activation code + bool MoveSelectionTab(wxTabControl *control); + + inline int GetNumberOfTabs() const { return m_noTabs; } + +protected: + // List of layers, from front to back. + wxTabLayerList m_layers; + + // Selected tab + int m_tabSelection; + + // Usual tab height + int m_tabHeight; + + // The height of the selected tab + int m_tabSelectionHeight; + + // Usual tab width + int m_tabWidth; + + // Space between tabs + int m_tabHorizontalSpacing; + + // Space between top of normal tab and text + int m_tabVerticalTextSpacing; + + // Horizontal offset of each tab row above the first + int m_tabHorizontalOffset; + + // The distance between the bottom of the first tab row + // and the top of the client area (i.e. the margin) + int m_topMargin; + + // The position and size of the view above which the tabs are placed. + // I.e., the internal client area of the sheet. + wxRect m_tabViewRect; + + // Bitlist of styles + long m_tabStyle; + + // Colours + wxColour m_highlightColour; + wxColour m_shadowColour; + wxColour m_backgroundColour; + wxColour m_textColour; + + // Pen and brush cache + const wxPen* m_highlightPen; + const wxPen* m_shadowPen; + const wxPen* m_backgroundPen; + const wxBrush* m_backgroundBrush; + + wxFont m_tabFont; + wxFont m_tabSelectedFont; + + int m_noTabs; + + wxWindow* m_window; +}; + +/* + * A dialog box class that is tab-friendly + */ + +class WXDLLIMPEXP_CORE wxTabbedDialog : public wxDialog +{ + wxDECLARE_DYNAMIC_CLASS(wxTabbedDialog); + +public: + wxTabbedDialog(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long windowStyle = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxASCII_STR(wxDialogNameStr)); + virtual ~wxTabbedDialog(); + + wxTabView *GetTabView() const { return m_tabView; } + void SetTabView(wxTabView *v) { m_tabView = v; } + + void OnCloseWindow(wxCloseEvent& event); + void OnMouseEvent(wxMouseEvent& event); + void OnPaint(wxPaintEvent& event); + +protected: + wxTabView* m_tabView; + +private: + wxDECLARE_EVENT_TABLE(); +}; + +/* + * A panel class that is tab-friendly + */ + +class WXDLLIMPEXP_CORE wxTabbedPanel : public wxPanel +{ + wxDECLARE_DYNAMIC_CLASS(wxTabbedPanel); + +public: + wxTabbedPanel(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long windowStyle = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)); + virtual ~wxTabbedPanel(); + + wxTabView *GetTabView() const { return m_tabView; } + void SetTabView(wxTabView *v) { m_tabView = v; } + + void OnMouseEvent(wxMouseEvent& event); + void OnPaint(wxPaintEvent& event); + +protected: + wxTabView* m_tabView; + +private: + wxDECLARE_EVENT_TABLE(); +}; + +WX_DECLARE_HASH_MAP(int, wxWindow*, wxIntegerHash, wxIntegerEqual, + wxIntToWindowHashMap); + +class WXDLLIMPEXP_CORE wxPanelTabView : public wxTabView +{ + wxDECLARE_DYNAMIC_CLASS(wxPanelTabView); + +public: + wxPanelTabView(wxPanel *pan, long style = wxTAB_STYLE_DRAW_BOX | wxTAB_STYLE_COLOUR_INTERIOR); + virtual ~wxPanelTabView(void); + + // Called when a tab is activated + virtual void OnTabActivate(int activateId, int deactivateId); + + // Specific to this class + void AddTabWindow(int id, wxWindow *window); + wxWindow *GetTabWindow(int id) const ; + void ClearWindows(bool deleteWindows = true); + wxWindow *GetCurrentWindow() const { return m_currentWindow; } + + void ShowWindowForTab(int id); + // wxList& GetWindows() const { return (wxList&) m_tabWindows; } + +protected: + // List of panels, one for each tab. Indexed + // by tab ID. + wxIntToWindowHashMap m_tabWindows; + wxWindow* m_currentWindow; + wxPanel* m_panel; +}; + +#endif + diff --git a/lib/wxWidgets/include/wx/generic/textdlgg.h b/lib/wxWidgets/include/wx/generic/textdlgg.h new file mode 100644 index 0000000..7d9d61e --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/textdlgg.h @@ -0,0 +1,150 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/textdlgg.h +// Purpose: wxTextEntryDialog class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TEXTDLGG_H_ +#define _WX_TEXTDLGG_H_ + +#include "wx/defs.h" + +#if wxUSE_TEXTDLG + +#include "wx/dialog.h" + +#if wxUSE_VALIDATORS +#include "wx/valtext.h" +#include "wx/textctrl.h" +#endif + +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; + +extern WXDLLIMPEXP_DATA_CORE(const char) wxGetTextFromUserPromptStr[]; +extern WXDLLIMPEXP_DATA_CORE(const char) wxGetPasswordFromUserPromptStr[]; + +#define wxTextEntryDialogStyle (wxOK | wxCANCEL | wxCENTRE) + +// ---------------------------------------------------------------------------- +// wxTextEntryDialog: a dialog with text control, [ok] and [cancel] buttons +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTextEntryDialog : public wxDialog +{ +public: + wxTextEntryDialog() + { + m_textctrl = NULL; + m_dialogStyle = 0; + } + + wxTextEntryDialog(wxWindow *parent, + const wxString& message, + const wxString& caption = wxASCII_STR(wxGetTextFromUserPromptStr), + const wxString& value = wxEmptyString, + long style = wxTextEntryDialogStyle, + const wxPoint& pos = wxDefaultPosition) + { + Create(parent, message, caption, value, style, pos); + } + + bool Create(wxWindow *parent, + const wxString& message, + const wxString& caption = wxASCII_STR(wxGetTextFromUserPromptStr), + const wxString& value = wxEmptyString, + long style = wxTextEntryDialogStyle, + const wxPoint& pos = wxDefaultPosition); + + void SetValue(const wxString& val); + wxString GetValue() const { return m_value; } + + void SetMaxLength(unsigned long len); + + void ForceUpper(); + +#if wxUSE_VALIDATORS + void SetTextValidator( const wxTextValidator& validator ); +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED( void SetTextValidator( long style ) ); +#endif + void SetTextValidator( wxTextValidatorStyle style = wxFILTER_NONE ); + wxTextValidator* GetTextValidator() { return (wxTextValidator*)m_textctrl->GetValidator(); } +#endif // wxUSE_VALIDATORS + + virtual bool TransferDataToWindow() wxOVERRIDE; + virtual bool TransferDataFromWindow() wxOVERRIDE; + + // implementation only + void OnOK(wxCommandEvent& event); + +protected: + wxTextCtrl *m_textctrl; + wxString m_value; + long m_dialogStyle; + +private: + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxTextEntryDialog); + wxDECLARE_NO_COPY_CLASS(wxTextEntryDialog); +}; + +// ---------------------------------------------------------------------------- +// wxPasswordEntryDialog: dialog with password control, [ok] and [cancel] +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPasswordEntryDialog : public wxTextEntryDialog +{ +public: + wxPasswordEntryDialog() { } + wxPasswordEntryDialog(wxWindow *parent, + const wxString& message, + const wxString& caption = wxASCII_STR(wxGetPasswordFromUserPromptStr), + const wxString& value = wxEmptyString, + long style = wxTextEntryDialogStyle, + const wxPoint& pos = wxDefaultPosition) + { + Create(parent, message, caption, value, style, pos); + } + + bool Create(wxWindow *parent, + const wxString& message, + const wxString& caption = wxASCII_STR(wxGetPasswordFromUserPromptStr), + const wxString& value = wxEmptyString, + long style = wxTextEntryDialogStyle, + const wxPoint& pos = wxDefaultPosition); + + +private: + wxDECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog); + wxDECLARE_NO_COPY_CLASS(wxPasswordEntryDialog); +}; + +// ---------------------------------------------------------------------------- +// function to get a string from user +// ---------------------------------------------------------------------------- + +WXDLLIMPEXP_CORE wxString + wxGetTextFromUser(const wxString& message, + const wxString& caption = wxASCII_STR(wxGetTextFromUserPromptStr), + const wxString& default_value = wxEmptyString, + wxWindow *parent = NULL, + wxCoord x = wxDefaultCoord, + wxCoord y = wxDefaultCoord, + bool centre = true); + +WXDLLIMPEXP_CORE wxString + wxGetPasswordFromUser(const wxString& message, + const wxString& caption = wxASCII_STR(wxGetPasswordFromUserPromptStr), + const wxString& default_value = wxEmptyString, + wxWindow *parent = NULL, + wxCoord x = wxDefaultCoord, + wxCoord y = wxDefaultCoord, + bool centre = true); + +#endif + // wxUSE_TEXTDLG +#endif // _WX_TEXTDLGG_H_ diff --git a/lib/wxWidgets/include/wx/generic/timectrl.h b/lib/wxWidgets/include/wx/generic/timectrl.h new file mode 100644 index 0000000..84f7a4f --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/timectrl.h @@ -0,0 +1,71 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/timectrl.h +// Purpose: Generic implementation of wxTimePickerCtrl. +// Author: Paul Breen, Vadim Zeitlin +// Created: 2011-09-22 +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_TIMECTRL_H_ +#define _WX_GENERIC_TIMECTRL_H_ + +#include "wx/containr.h" +#include "wx/compositewin.h" + +typedef wxTimePickerCtrlCommonBase wxTimePickerCtrlGenericBase; + +class WXDLLIMPEXP_ADV wxTimePickerCtrlGeneric + : public wxCompositeWindow< wxNavigationEnabled > +{ +public: + typedef wxCompositeWindow< wxNavigationEnabled > Base; + + // Creating the control. + wxTimePickerCtrlGeneric() { Init(); } + virtual ~wxTimePickerCtrlGeneric(); + wxTimePickerCtrlGeneric(wxWindow *parent, + wxWindowID id, + const wxDateTime& date = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTP_DEFAULT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTimePickerCtrlNameStr) + { + Init(); + + (void)Create(parent, id, date, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxDateTime& date = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTP_DEFAULT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTimePickerCtrlNameStr); + + // Implement pure virtual wxTimePickerCtrlBase methods. + virtual void SetValue(const wxDateTime& date) wxOVERRIDE; + virtual wxDateTime GetValue() const wxOVERRIDE; + +protected: + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; + +private: + void Init(); + + // Return the list of the windows composing this one. + virtual wxWindowList GetCompositeWindowParts() const wxOVERRIDE; + + // Implementation data. + class wxTimePickerGenericImpl* m_impl; + + wxDECLARE_NO_COPY_CLASS(wxTimePickerCtrlGeneric); +}; + +#endif // _WX_GENERIC_TIMECTRL_H_ diff --git a/lib/wxWidgets/include/wx/generic/treectlg.h b/lib/wxWidgets/include/wx/generic/treectlg.h new file mode 100644 index 0000000..dda068b --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/treectlg.h @@ -0,0 +1,416 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/treectlg.h +// Purpose: wxTreeCtrl class +// Author: Robert Roebling +// Modified by: +// Created: 01/02/97 +// Copyright: (c) 1997,1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _GENERIC_TREECTRL_H_ +#define _GENERIC_TREECTRL_H_ + +#if wxUSE_TREECTRL + +#include "wx/brush.h" +#include "wx/pen.h" +#include "wx/scrolwin.h" + +// ----------------------------------------------------------------------------- +// forward declaration +// ----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxGenericTreeItem; + +class WXDLLIMPEXP_FWD_CORE wxTreeItemData; + +class WXDLLIMPEXP_FWD_CORE wxTreeRenameTimer; +class WXDLLIMPEXP_FWD_CORE wxTreeFindTimer; +class WXDLLIMPEXP_FWD_CORE wxTreeTextCtrl; +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; + +// ----------------------------------------------------------------------------- +// wxGenericTreeCtrl - the tree control +// ----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGenericTreeCtrl : public wxTreeCtrlBase, + public wxScrollHelper +{ +public: + // creation + // -------- + + wxGenericTreeCtrl() : wxTreeCtrlBase(), wxScrollHelper(this) { Init(); } + + wxGenericTreeCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTR_DEFAULT_STYLE, + const wxValidator &validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxTreeCtrlNameStr)) + : wxTreeCtrlBase(), + wxScrollHelper(this) + { + Init(); + Create(parent, id, pos, size, style, validator, name); + } + + virtual ~wxGenericTreeCtrl(); + + bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTR_DEFAULT_STYLE, + const wxValidator &validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxTreeCtrlNameStr)); + + // implement base class pure virtuals + // ---------------------------------- + + virtual unsigned int GetCount() const wxOVERRIDE; + + virtual unsigned int GetIndent() const wxOVERRIDE { return m_indent; } + virtual void SetIndent(unsigned int indent) wxOVERRIDE; + + + virtual void SetImageList(wxImageList *imageList) wxOVERRIDE; + virtual void SetStateImageList(wxImageList *imageList) wxOVERRIDE; + + virtual wxString GetItemText(const wxTreeItemId& item) const wxOVERRIDE; + virtual int GetItemImage(const wxTreeItemId& item, + wxTreeItemIcon which = wxTreeItemIcon_Normal) const wxOVERRIDE; + virtual wxTreeItemData *GetItemData(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxColour GetItemTextColour(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxColour GetItemBackgroundColour(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxFont GetItemFont(const wxTreeItemId& item) const wxOVERRIDE; + + virtual void SetItemText(const wxTreeItemId& item, const wxString& text) wxOVERRIDE; + virtual void SetItemImage(const wxTreeItemId& item, + int image, + wxTreeItemIcon which = wxTreeItemIcon_Normal) wxOVERRIDE; + virtual void SetItemData(const wxTreeItemId& item, wxTreeItemData *data) wxOVERRIDE; + + virtual void SetItemHasChildren(const wxTreeItemId& item, bool has = true) wxOVERRIDE; + virtual void SetItemBold(const wxTreeItemId& item, bool bold = true) wxOVERRIDE; + virtual void SetItemDropHighlight(const wxTreeItemId& item, bool highlight = true) wxOVERRIDE; + virtual void SetItemTextColour(const wxTreeItemId& item, const wxColour& col) wxOVERRIDE; + virtual void SetItemBackgroundColour(const wxTreeItemId& item, const wxColour& col) wxOVERRIDE; + virtual void SetItemFont(const wxTreeItemId& item, const wxFont& font) wxOVERRIDE; + + virtual bool IsVisible(const wxTreeItemId& item) const wxOVERRIDE; + virtual bool ItemHasChildren(const wxTreeItemId& item) const wxOVERRIDE; + virtual bool IsExpanded(const wxTreeItemId& item) const wxOVERRIDE; + virtual bool IsSelected(const wxTreeItemId& item) const wxOVERRIDE; + virtual bool IsBold(const wxTreeItemId& item) const wxOVERRIDE; + + virtual size_t GetChildrenCount(const wxTreeItemId& item, + bool recursively = true) const wxOVERRIDE; + + // navigation + // ---------- + + virtual wxTreeItemId GetRootItem() const wxOVERRIDE { return m_anchor; } + virtual wxTreeItemId GetSelection() const wxOVERRIDE + { + wxASSERT_MSG( !HasFlag(wxTR_MULTIPLE), + wxT("must use GetSelections() with this control") ); + + return m_current; + } + virtual size_t GetSelections(wxArrayTreeItemIds&) const wxOVERRIDE; + virtual wxTreeItemId GetFocusedItem() const wxOVERRIDE { return m_current; } + + virtual void ClearFocusedItem() wxOVERRIDE; + virtual void SetFocusedItem(const wxTreeItemId& item) wxOVERRIDE; + + virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxTreeItemId GetFirstChild(const wxTreeItemId& item, + wxTreeItemIdValue& cookie) const wxOVERRIDE; + virtual wxTreeItemId GetNextChild(const wxTreeItemId& item, + wxTreeItemIdValue& cookie) const wxOVERRIDE; + virtual wxTreeItemId GetLastChild(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxTreeItemId GetNextSibling(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const wxOVERRIDE; + + virtual wxTreeItemId GetFirstVisibleItem() const wxOVERRIDE; + virtual wxTreeItemId GetNextVisible(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const wxOVERRIDE; + + + // operations + // ---------- + + virtual wxTreeItemId AddRoot(const wxString& text, + int image = -1, int selectedImage = -1, + wxTreeItemData *data = NULL) wxOVERRIDE; + + virtual void Delete(const wxTreeItemId& item) wxOVERRIDE; + virtual void DeleteChildren(const wxTreeItemId& item) wxOVERRIDE; + virtual void DeleteAllItems() wxOVERRIDE; + + virtual void Expand(const wxTreeItemId& item) wxOVERRIDE; + virtual void Collapse(const wxTreeItemId& item) wxOVERRIDE; + virtual void CollapseAndReset(const wxTreeItemId& item) wxOVERRIDE; + virtual void Toggle(const wxTreeItemId& item) wxOVERRIDE; + + virtual void Unselect() wxOVERRIDE; + virtual void UnselectAll() wxOVERRIDE; + virtual void SelectItem(const wxTreeItemId& item, bool select = true) wxOVERRIDE; + virtual void SelectChildren(const wxTreeItemId& parent) wxOVERRIDE; + + virtual void EnsureVisible(const wxTreeItemId& item) wxOVERRIDE; + virtual void ScrollTo(const wxTreeItemId& item) wxOVERRIDE; + + virtual wxTextCtrl *EditLabel(const wxTreeItemId& item, + wxClassInfo* textCtrlClass = wxCLASSINFO(wxTextCtrl)) wxOVERRIDE; + virtual wxTextCtrl *GetEditControl() const wxOVERRIDE; + virtual void EndEditLabel(const wxTreeItemId& item, + bool discardChanges = false) wxOVERRIDE; + + virtual void EnableBellOnNoMatch(bool on = true) wxOVERRIDE; + + virtual void SortChildren(const wxTreeItemId& item) wxOVERRIDE; + + // items geometry + // -------------- + + virtual bool GetBoundingRect(const wxTreeItemId& item, + wxRect& rect, + bool textOnly = false) const wxOVERRIDE; + + + // this version specific methods + // ----------------------------- + + wxImageList *GetButtonsImageList() const + { + return m_imagesButtons.GetImageList(); + } + void SetButtonsImageList(wxImageList *imageList); + void AssignButtonsImageList(wxImageList *imageList); + + void SetDropEffectAboveItem( bool above = false ) { m_dropEffectAboveItem = above; } + bool GetDropEffectAboveItem() const { return m_dropEffectAboveItem; } + + wxTreeItemId GetNext(const wxTreeItemId& item) const; + + // implementation only from now on + + // overridden base class virtuals + virtual bool SetBackgroundColour(const wxColour& colour) wxOVERRIDE; + virtual bool SetForegroundColour(const wxColour& colour) wxOVERRIDE; + + virtual void Refresh(bool eraseBackground = true, const wxRect *rect = NULL) wxOVERRIDE; + + virtual bool SetFont( const wxFont &font ) wxOVERRIDE; + virtual void SetWindowStyleFlag(long styles) wxOVERRIDE; + + // callbacks + void OnPaint( wxPaintEvent &event ); + void OnSetFocus( wxFocusEvent &event ); + void OnKillFocus( wxFocusEvent &event ); + void OnKeyDown( wxKeyEvent &event ); + void OnChar( wxKeyEvent &event ); + void OnMouse( wxMouseEvent &event ); + void OnGetToolTip( wxTreeEvent &event ); + void OnSize( wxSizeEvent &event ); + void OnInternalIdle( ) wxOVERRIDE; + + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // implementation helpers + void AdjustMyScrollbars(); + + WX_FORWARD_TO_SCROLL_HELPER() + +protected: + friend class wxGenericTreeItem; + friend class wxTreeRenameTimer; + friend class wxTreeFindTimer; + friend class wxTreeTextCtrl; + + wxFont m_normalFont; + wxFont m_boldFont; + + wxGenericTreeItem *m_anchor; + wxGenericTreeItem *m_current, + *m_key_current, + // A hint to select a parent item after deleting a child + *m_select_me; + unsigned short m_indent; + int m_lineHeight; + wxPen m_dottedPen; + wxBrush m_hilightBrush, + m_hilightUnfocusedBrush; + bool m_hasFocus; + bool m_dirty; + bool m_isDragging; // true between BEGIN/END drag events + bool m_lastOnSame; // last click on the same item as prev + + wxWithImages m_imagesButtons; + + int m_dragCount; + wxPoint m_dragStart; + wxGenericTreeItem *m_dropTarget; + wxCursor m_oldCursor; // cursor is changed while dragging + wxGenericTreeItem *m_oldSelection; + wxGenericTreeItem *m_underMouse; // for visual effects + + enum { NoEffect, BorderEffect, AboveEffect, BelowEffect } m_dndEffect; + wxGenericTreeItem *m_dndEffectItem; + + wxTreeTextCtrl *m_textCtrl; + + + wxTimer *m_renameTimer; + + // incremental search data + wxString m_findPrefix; + wxTimer *m_findTimer; + // This flag is set to 0 if the bell is disabled, 1 if it is enabled and -1 + // if it is globally enabled but has been temporarily disabled because we + // had already beeped for this particular search. + int m_findBell; + + bool m_dropEffectAboveItem; + + // the common part of all ctors + void Init(); + + // overridden wxWindow methods + virtual void DoThaw() wxOVERRIDE; + + virtual void OnImagesChanged() wxOVERRIDE; + void UpdateAfterImageListChange(); + + // misc helpers + void SendDeleteEvent(wxGenericTreeItem *itemBeingDeleted); + + void DrawBorder(const wxTreeItemId& item); + void DrawLine(const wxTreeItemId& item, bool below); + void DrawDropEffect(wxGenericTreeItem *item); + + void DoSelectItem(const wxTreeItemId& id, + bool unselect_others = true, + bool extended_select = false); + + virtual int DoGetItemState(const wxTreeItemId& item) const wxOVERRIDE; + virtual void DoSetItemState(const wxTreeItemId& item, int state) wxOVERRIDE; + + virtual wxTreeItemId DoInsertItem(const wxTreeItemId& parent, + size_t previous, + const wxString& text, + int image, + int selectedImage, + wxTreeItemData *data) wxOVERRIDE; + virtual wxTreeItemId DoInsertAfter(const wxTreeItemId& parent, + const wxTreeItemId& idPrevious, + const wxString& text, + int image = -1, int selImage = -1, + wxTreeItemData *data = NULL) wxOVERRIDE; + virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, int& flags) const wxOVERRIDE; + + // called by wxTextTreeCtrl when it marks itself for deletion + void ResetTextControl(); + + // find the first item starting with the given prefix after the given item + wxTreeItemId FindItem(const wxTreeItemId& id, const wxString& prefix) const; + + bool HasButtons() const { return HasFlag(wxTR_HAS_BUTTONS); } + + void CalculateLineHeight(); + int GetLineHeight(wxGenericTreeItem *item) const; + void PaintLevel( wxGenericTreeItem *item, wxDC& dc, int level, int &y ); + void PaintItem( wxGenericTreeItem *item, wxDC& dc); + + void CalculateLevel( wxGenericTreeItem *item, wxDC &dc, int level, int &y ); + void CalculatePositions(); + + void RefreshSubtree( wxGenericTreeItem *item ); + void RefreshLine( wxGenericTreeItem *item ); + + // redraw all selected items + void RefreshSelected(); + + // RefreshSelected() recursive helper + void RefreshSelectedUnder(wxGenericTreeItem *item); + + void OnRenameTimer(); + bool OnRenameAccept(wxGenericTreeItem *item, const wxString& value); + void OnRenameCancelled(wxGenericTreeItem *item); + + void FillArray(wxGenericTreeItem*, wxArrayTreeItemIds&) const; + void SelectItemRange( wxGenericTreeItem *item1, wxGenericTreeItem *item2 ); + bool TagAllChildrenUntilLast(wxGenericTreeItem *crt_item, wxGenericTreeItem *last_item, bool select); + bool TagNextChildren(wxGenericTreeItem *crt_item, wxGenericTreeItem *last_item, bool select); + void UnselectAllChildren( wxGenericTreeItem *item ); + void ChildrenClosing(wxGenericTreeItem* item); + + void DoDirtyProcessing(); + + virtual wxSize DoGetBestSize() const wxOVERRIDE; + +private: + void OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event)) + { + InitVisualAttributes(); + } + + // (Re)initialize colours, fonts, pens, brushes used by the control using + // the current system colours and font. + void InitVisualAttributes(); + + // Reset the state of the last find (i.e. keyboard incremental search) + // operation. + void ResetFindState(); + + + // True if we're using custom colours/font, respectively, or false if we're + // using the default colours and should update them whenever system colours + // change. + bool m_hasExplicitFgCol:1, + m_hasExplicitBgCol:1, + m_hasExplicitFont:1; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxGenericTreeCtrl); + wxDECLARE_NO_COPY_CLASS(wxGenericTreeCtrl); +}; + +// Also define wxTreeCtrl to be wxGenericTreeCtrl on all platforms without a +// native version, i.e. all but MSW and Qt. +#if !(defined(__WXMSW__) || defined(__WXQT__)) || defined(__WXUNIVERSAL__) +/* + * wxTreeCtrl has to be a real class or we have problems with + * the run-time information. + */ + +class WXDLLIMPEXP_CORE wxTreeCtrl: public wxGenericTreeCtrl +{ + wxDECLARE_DYNAMIC_CLASS(wxTreeCtrl); + +public: + wxTreeCtrl() {} + + wxTreeCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTR_DEFAULT_STYLE, + const wxValidator &validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxTreeCtrlNameStr)) + : wxGenericTreeCtrl(parent, id, pos, size, style, validator, name) + { + } +}; +#endif // !(__WXMSW__ || __WXQT__) || __WXUNIVERSAL__ + +#endif // wxUSE_TREECTRL + +#endif // _GENERIC_TREECTRL_H_ diff --git a/lib/wxWidgets/include/wx/generic/wizard.h b/lib/wxWidgets/include/wx/generic/wizard.h new file mode 100644 index 0000000..06c86da --- /dev/null +++ b/lib/wxWidgets/include/wx/generic/wizard.h @@ -0,0 +1,176 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/wizard.h +// Purpose: declaration of generic wxWizard class +// Author: Vadim Zeitlin +// Modified by: Robert Vazan (sizers) +// Created: 28.09.99 +// Copyright: (c) 1999 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_WIZARD_H_ +#define _WX_GENERIC_WIZARD_H_ + +// ---------------------------------------------------------------------------- +// wxWizard +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxButton; +class WXDLLIMPEXP_FWD_CORE wxStaticBitmap; +class WXDLLIMPEXP_FWD_CORE wxWizardEvent; +class WXDLLIMPEXP_FWD_CORE wxBoxSizer; +class WXDLLIMPEXP_FWD_CORE wxWizardSizer; + +class WXDLLIMPEXP_CORE wxWizard : public wxWizardBase +{ +public: + // ctor + wxWizard() { Init(); } + wxWizard(wxWindow *parent, + int id = wxID_ANY, + const wxString& title = wxEmptyString, + const wxBitmapBundle& bitmap = wxBitmapBundle(), + const wxPoint& pos = wxDefaultPosition, + long style = wxDEFAULT_DIALOG_STYLE) + { + Init(); + Create(parent, id, title, bitmap, pos, style); + } + bool Create(wxWindow *parent, + int id = wxID_ANY, + const wxString& title = wxEmptyString, + const wxBitmapBundle& bitmap = wxBitmapBundle(), + const wxPoint& pos = wxDefaultPosition, + long style = wxDEFAULT_DIALOG_STYLE); + void Init(); + virtual ~wxWizard(); + + // implement base class pure virtuals + virtual bool RunWizard(wxWizardPage *firstPage) wxOVERRIDE; + virtual wxWizardPage *GetCurrentPage() const wxOVERRIDE; + virtual void SetPageSize(const wxSize& size) wxOVERRIDE; + virtual wxSize GetPageSize() const wxOVERRIDE; + virtual void FitToPage(const wxWizardPage *firstPage) wxOVERRIDE; + virtual wxSizer *GetPageAreaSizer() const wxOVERRIDE; + virtual void SetBorder(int border) wxOVERRIDE; + + /// set/get bitmap + wxBitmap GetBitmap() const { return m_bitmap.GetBitmapFor(this); } + void SetBitmap(const wxBitmapBundle& bitmap); + + // implementation only from now on + // ------------------------------- + + // is the wizard running? + bool IsRunning() const { return m_page != NULL; } + + // show the prev/next page, but call TransferDataFromWindow on the current + // page first and return false without changing the page if + // TransferDataFromWindow() returns false - otherwise, returns true + virtual bool ShowPage(wxWizardPage *page, bool goingForward = true); + + // do fill the dialog with controls + // this is app-overridable to, for example, set help and tooltip text + virtual void DoCreateControls(); + + // Do the adaptation + virtual bool DoLayoutAdaptation() wxOVERRIDE; + + // Set/get bitmap background colour + void SetBitmapBackgroundColour(const wxColour& colour) { m_bitmapBackgroundColour = colour; } + const wxColour& GetBitmapBackgroundColour() const { return m_bitmapBackgroundColour; } + + // Set/get bitmap placement (centred, tiled etc.) + void SetBitmapPlacement(int placement) { m_bitmapPlacement = placement; } + int GetBitmapPlacement() const { return m_bitmapPlacement; } + + // Set/get minimum bitmap width + void SetMinimumBitmapWidth(int w) { m_bitmapMinimumWidth = w; } + int GetMinimumBitmapWidth() const { return m_bitmapMinimumWidth; } + + // Tile bitmap + static bool TileBitmap(const wxRect& rect, wxDC& dc, const wxBitmap& bitmap); + +protected: + // for compatibility only, doesn't do anything any more + void FinishLayout() { } + + // Do fit, and adjust to screen size if necessary + virtual void DoWizardLayout(); + + // Resize bitmap if necessary + virtual bool ResizeBitmap(wxBitmap& bmp); + + // was the dialog really created? + bool WasCreated() const { return m_btnPrev != NULL; } + + // event handlers + void OnCancel(wxCommandEvent& event); + void OnBackOrNext(wxCommandEvent& event); + void OnHelp(wxCommandEvent& event); + + void OnWizEvent(wxWizardEvent& event); + + void AddBitmapRow(wxBoxSizer *mainColumn); + void AddStaticLine(wxBoxSizer *mainColumn); + void AddBackNextPair(wxBoxSizer *buttonRow); + void AddButtonRow(wxBoxSizer *mainColumn); + + // This function can be used as event handle for wxEVT_DPI_CHANGED event. + void WXHandleDPIChanged(wxDPIChangedEvent& event); + + // the page size requested by user + wxSize m_sizePage; + + // the dialog position from the ctor + wxPoint m_posWizard; + + // wizard state + wxWizardPage *m_page; // the current page or NULL + wxWizardPage *m_firstpage; // the page RunWizard started on or NULL + wxBitmapBundle m_bitmap; // the default bitmap to show + + // wizard controls + wxButton *m_btnPrev, // the "" or "Finish" button + wxStaticBitmap *m_statbmp; // the control for the bitmap + + // cached labels so their translations stay consistent + wxString m_nextLabel, + m_finishLabel; + + // Border around page area sizer requested using SetBorder() + int m_border; + + // Whether RunWizard() was called + bool m_started; + + // Whether was modal (modeless has to be destroyed on finish or cancel) + bool m_wasModal; + + // True if pages are laid out using the sizer + bool m_usingSizer; + + // Page area sizer will be inserted here with padding + wxBoxSizer *m_sizerBmpAndPage; + + // Actual position and size of pages + wxWizardSizer *m_sizerPage; + + // Bitmap background colour if resizing bitmap + wxColour m_bitmapBackgroundColour; + + // Bitmap placement flags + int m_bitmapPlacement; + + // Minimum bitmap width + int m_bitmapMinimumWidth; + + friend class wxWizardSizer; + + wxDECLARE_DYNAMIC_CLASS(wxWizard); + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxWizard); +}; + +#endif // _WX_GENERIC_WIZARD_H_ diff --git a/lib/wxWidgets/include/wx/geometry.h b/lib/wxWidgets/include/wx/geometry.h new file mode 100644 index 0000000..bfb18c8 --- /dev/null +++ b/lib/wxWidgets/include/wx/geometry.h @@ -0,0 +1,760 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/geometry.h +// Purpose: Common Geometry Classes +// Author: Stefan Csomor +// Modified by: +// Created: 08/05/99 +// Copyright: (c) 1999 Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GEOMETRY_H_ +#define _WX_GEOMETRY_H_ + +#include "wx/defs.h" + +#if wxUSE_GEOMETRY + +#include "wx/utils.h" +#include "wx/gdicmn.h" +#include "wx/math.h" + +class WXDLLIMPEXP_FWD_BASE wxDataInputStream; +class WXDLLIMPEXP_FWD_BASE wxDataOutputStream; + +// clipping from Cohen-Sutherland + +enum wxOutCode +{ + wxInside = 0x00 , + wxOutLeft = 0x01 , + wxOutRight = 0x02 , + wxOutTop = 0x08 , + wxOutBottom = 0x04 +}; + +class WXDLLIMPEXP_CORE wxPoint2DInt +{ +public : + inline wxPoint2DInt(); + inline wxPoint2DInt( wxInt32 x , wxInt32 y ); + inline wxPoint2DInt( const wxPoint &pt ); + // default copy ctor and copy-assign operator are OK + + // noops for this class, just return the coords + inline void GetFloor( wxInt32 *x , wxInt32 *y ) const; + inline void GetRounded( wxInt32 *x , wxInt32 *y ) const; + + inline wxDouble GetVectorLength() const; + wxDouble GetVectorAngle() const; + inline void SetVectorLength( wxDouble length ); + void SetVectorAngle( wxDouble degrees ); + // set the vector length to 1.0, preserving the angle + inline void Normalize(); + + inline wxDouble GetDistance( const wxPoint2DInt &pt ) const; + inline wxDouble GetDistanceSquare( const wxPoint2DInt &pt ) const; + inline wxInt32 GetDotProduct( const wxPoint2DInt &vec ) const; + inline wxInt32 GetCrossProduct( const wxPoint2DInt &vec ) const; + + // the reflection of this point + wxPoint2DInt operator-() const; + + inline wxPoint2DInt& operator+=(const wxPoint2DInt& pt); + inline wxPoint2DInt& operator-=(const wxPoint2DInt& pt); + inline wxPoint2DInt& operator*=(const wxPoint2DInt& pt); + inline wxPoint2DInt& operator*=(wxDouble n); + inline wxPoint2DInt& operator*=(wxInt32 n); + inline wxPoint2DInt& operator/=(const wxPoint2DInt& pt); + inline wxPoint2DInt& operator/=(wxDouble n); + inline wxPoint2DInt& operator/=(wxInt32 n); + inline operator wxPoint() const; + inline bool operator==(const wxPoint2DInt& pt) const; + inline bool operator!=(const wxPoint2DInt& pt) const; + +#if wxUSE_STREAMS + void WriteTo( wxDataOutputStream &stream ) const; + void ReadFrom( wxDataInputStream &stream ); +#endif // wxUSE_STREAMS + + wxInt32 m_x; + wxInt32 m_y; +}; + +inline wxPoint2DInt operator+(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); +inline wxPoint2DInt operator-(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); +inline wxPoint2DInt operator*(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); +inline wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt); +inline wxPoint2DInt operator*(wxDouble n , const wxPoint2DInt& pt); +inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n); +inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxDouble n); +inline wxPoint2DInt operator/(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); +inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n); +inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxDouble n); + +inline wxPoint2DInt::wxPoint2DInt() +{ + m_x = 0; + m_y = 0; +} + +inline wxPoint2DInt::wxPoint2DInt( wxInt32 x , wxInt32 y ) +{ + m_x = x; + m_y = y; +} + +inline wxPoint2DInt::wxPoint2DInt( const wxPoint &pt ) +{ + m_x = pt.x; + m_y = pt.y; +} + +inline void wxPoint2DInt::GetFloor( wxInt32 *x , wxInt32 *y ) const +{ + if ( x ) + *x = m_x; + if ( y ) + *y = m_y; +} + +inline void wxPoint2DInt::GetRounded( wxInt32 *x , wxInt32 *y ) const +{ + GetFloor(x, y); +} + +inline wxDouble wxPoint2DInt::GetVectorLength() const +{ + // cast needed MIPSpro compiler under SGI + return sqrt( (wxDouble)(m_x)*(m_x) + (wxDouble)(m_y)*(m_y) ); +} + +inline void wxPoint2DInt::SetVectorLength( wxDouble length ) +{ + wxDouble before = GetVectorLength(); + m_x = (wxInt32)(m_x * length / before); + m_y = (wxInt32)(m_y * length / before); +} + +inline void wxPoint2DInt::Normalize() +{ + SetVectorLength( 1 ); +} + +inline wxDouble wxPoint2DInt::GetDistance( const wxPoint2DInt &pt ) const +{ + return sqrt( GetDistanceSquare( pt ) ); +} + +inline wxDouble wxPoint2DInt::GetDistanceSquare( const wxPoint2DInt &pt ) const +{ + return ( ((wxDouble)pt.m_x-m_x)*((wxDouble)pt.m_x-m_x) + + ((wxDouble)pt.m_y-m_y)*((wxDouble)pt.m_y-m_y) ); +} + +inline wxInt32 wxPoint2DInt::GetDotProduct( const wxPoint2DInt &vec ) const +{ + return ( m_x * vec.m_x + m_y * vec.m_y ); +} + +inline wxInt32 wxPoint2DInt::GetCrossProduct( const wxPoint2DInt &vec ) const +{ + return ( m_x * vec.m_y - vec.m_x * m_y ); +} + +inline wxPoint2DInt::operator wxPoint() const +{ + return wxPoint( m_x, m_y); +} + +inline wxPoint2DInt wxPoint2DInt::operator-() const +{ + return wxPoint2DInt( -m_x, -m_y); +} + +inline wxPoint2DInt& wxPoint2DInt::operator+=(const wxPoint2DInt& pt) +{ + m_x = m_x + pt.m_x; + m_y = m_y + pt.m_y; + return *this; +} + +inline wxPoint2DInt& wxPoint2DInt::operator-=(const wxPoint2DInt& pt) +{ + m_x = m_x - pt.m_x; + m_y = m_y - pt.m_y; + return *this; +} + +inline wxPoint2DInt& wxPoint2DInt::operator*=(const wxPoint2DInt& pt) +{ + m_x = m_x * pt.m_x; + m_y = m_y * pt.m_y; + return *this; +} + +inline wxPoint2DInt& wxPoint2DInt::operator/=(const wxPoint2DInt& pt) +{ + m_x = m_x / pt.m_x; + m_y = m_y / pt.m_y; + return *this; +} + +inline bool wxPoint2DInt::operator==(const wxPoint2DInt& pt) const +{ + return m_x == pt.m_x && m_y == pt.m_y; +} + +inline bool wxPoint2DInt::operator!=(const wxPoint2DInt& pt) const +{ + return m_x != pt.m_x || m_y != pt.m_y; +} + +inline wxPoint2DInt operator+(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2) +{ + return wxPoint2DInt( pt1.m_x + pt2.m_x , pt1.m_y + pt2.m_y ); +} + +inline wxPoint2DInt operator-(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2) +{ + return wxPoint2DInt( pt1.m_x - pt2.m_x , pt1.m_y - pt2.m_y ); +} + + +inline wxPoint2DInt operator*(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2) +{ + return wxPoint2DInt( pt1.m_x * pt2.m_x , pt1.m_y * pt2.m_y ); +} + +inline wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt) +{ + return wxPoint2DInt( pt.m_x * n , pt.m_y * n ); +} + +inline wxPoint2DInt operator*(wxDouble n , const wxPoint2DInt& pt) +{ + return wxPoint2DInt( static_cast(pt.m_x * n) , + static_cast(pt.m_y * n) ); +} + +inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n) +{ + return wxPoint2DInt( pt.m_x * n , pt.m_y * n ); +} + +inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxDouble n) +{ + return wxPoint2DInt( static_cast(pt.m_x * n) , + static_cast(pt.m_y * n) ); +} + +inline wxPoint2DInt operator/(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2) +{ + return wxPoint2DInt( pt1.m_x / pt2.m_x , pt1.m_y / pt2.m_y ); +} + +inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n) +{ + return wxPoint2DInt( pt.m_x / n , pt.m_y / n ); +} + +inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxDouble n) +{ + return wxPoint2DInt( static_cast(pt.m_x / n) , + static_cast(pt.m_y / n) ); +} + +// wxPoint2Ds represent a point or a vector in a 2d coordinate system + +class WXDLLIMPEXP_CORE wxPoint2DDouble +{ +public : + inline wxPoint2DDouble(); + inline wxPoint2DDouble( wxDouble x , wxDouble y ); + wxPoint2DDouble( const wxPoint2DInt &pt ) + { m_x = (wxDouble) pt.m_x ; m_y = (wxDouble) pt.m_y ; } + wxPoint2DDouble( const wxPoint &pt ) + { m_x = (wxDouble) pt.x ; m_y = (wxDouble) pt.y ; } + // default copy ctor and copy-assign operator are OK + + // two different conversions to integers, floor and rounding + inline void GetFloor( wxInt32 *x , wxInt32 *y ) const; + inline void GetRounded( wxInt32 *x , wxInt32 *y ) const; + + inline wxDouble GetVectorLength() const; + wxDouble GetVectorAngle() const ; + void SetVectorLength( wxDouble length ); + void SetVectorAngle( wxDouble degrees ); + // set the vector length to 1.0, preserving the angle + void Normalize(); + + inline wxDouble GetDistance( const wxPoint2DDouble &pt ) const; + inline wxDouble GetDistanceSquare( const wxPoint2DDouble &pt ) const; + inline wxDouble GetDotProduct( const wxPoint2DDouble &vec ) const; + inline wxDouble GetCrossProduct( const wxPoint2DDouble &vec ) const; + + // the reflection of this point + wxPoint2DDouble operator-() const; + + inline wxPoint2DDouble& operator+=(const wxPoint2DDouble& pt); + inline wxPoint2DDouble& operator-=(const wxPoint2DDouble& pt); + inline wxPoint2DDouble& operator*=(const wxPoint2DDouble& pt); + inline wxPoint2DDouble& operator*=(wxDouble n); + inline wxPoint2DDouble& operator*=(wxInt32 n); + inline wxPoint2DDouble& operator/=(const wxPoint2DDouble& pt); + inline wxPoint2DDouble& operator/=(wxDouble n); + inline wxPoint2DDouble& operator/=(wxInt32 n); + + inline bool operator==(const wxPoint2DDouble& pt) const; + inline bool operator!=(const wxPoint2DDouble& pt) const; + + wxDouble m_x; + wxDouble m_y; +}; + +inline wxPoint2DDouble operator+(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2); +inline wxPoint2DDouble operator-(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2); +inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2); +inline wxPoint2DDouble operator*(wxDouble n , const wxPoint2DDouble& pt); +inline wxPoint2DDouble operator*(wxInt32 n , const wxPoint2DDouble& pt); +inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxDouble n); +inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxInt32 n); +inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2); +inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxDouble n); +inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxInt32 n); + +inline wxPoint2DDouble::wxPoint2DDouble() +{ + m_x = 0.0; + m_y = 0.0; +} + +inline wxPoint2DDouble::wxPoint2DDouble( wxDouble x , wxDouble y ) +{ + m_x = x; + m_y = y; +} + +inline void wxPoint2DDouble::GetFloor( wxInt32 *x , wxInt32 *y ) const +{ + *x = (wxInt32) floor( m_x ); + *y = (wxInt32) floor( m_y ); +} + +inline void wxPoint2DDouble::GetRounded( wxInt32 *x , wxInt32 *y ) const +{ + *x = (wxInt32) floor( m_x + 0.5 ); + *y = (wxInt32) floor( m_y + 0.5); +} + +inline wxDouble wxPoint2DDouble::GetVectorLength() const +{ + return sqrt( (m_x)*(m_x) + (m_y)*(m_y) ) ; +} + +inline void wxPoint2DDouble::SetVectorLength( wxDouble length ) +{ + wxDouble before = GetVectorLength() ; + m_x = (m_x * length / before) ; + m_y = (m_y * length / before) ; +} + +inline void wxPoint2DDouble::Normalize() +{ + SetVectorLength( 1 ); +} + +inline wxDouble wxPoint2DDouble::GetDistance( const wxPoint2DDouble &pt ) const +{ + return sqrt( GetDistanceSquare( pt ) ); +} + +inline wxDouble wxPoint2DDouble::GetDistanceSquare( const wxPoint2DDouble &pt ) const +{ + return ( (pt.m_x-m_x)*(pt.m_x-m_x) + (pt.m_y-m_y)*(pt.m_y-m_y) ); +} + +inline wxDouble wxPoint2DDouble::GetDotProduct( const wxPoint2DDouble &vec ) const +{ + return ( m_x * vec.m_x + m_y * vec.m_y ); +} + +inline wxDouble wxPoint2DDouble::GetCrossProduct( const wxPoint2DDouble &vec ) const +{ + return ( m_x * vec.m_y - vec.m_x * m_y ); +} + +inline wxPoint2DDouble wxPoint2DDouble::operator-() const +{ + return wxPoint2DDouble( -m_x, -m_y); +} + +inline wxPoint2DDouble& wxPoint2DDouble::operator+=(const wxPoint2DDouble& pt) +{ + m_x = m_x + pt.m_x; + m_y = m_y + pt.m_y; + return *this; +} + +inline wxPoint2DDouble& wxPoint2DDouble::operator-=(const wxPoint2DDouble& pt) +{ + m_x = m_x - pt.m_x; + m_y = m_y - pt.m_y; + return *this; +} + +inline wxPoint2DDouble& wxPoint2DDouble::operator*=(const wxPoint2DDouble& pt) +{ + m_x = m_x * pt.m_x; + m_y = m_y * pt.m_y; + return *this; +} + +inline wxPoint2DDouble& wxPoint2DDouble::operator/=(const wxPoint2DDouble& pt) +{ + m_x = m_x / pt.m_x; + m_y = m_y / pt.m_y; + return *this; +} + +inline bool wxPoint2DDouble::operator==(const wxPoint2DDouble& pt) const +{ + return wxIsSameDouble(m_x, pt.m_x) && wxIsSameDouble(m_y, pt.m_y); +} + +inline bool wxPoint2DDouble::operator!=(const wxPoint2DDouble& pt) const +{ + return !(*this == pt); +} + +inline wxPoint2DDouble operator+(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2) +{ + return wxPoint2DDouble( pt1.m_x + pt2.m_x , pt1.m_y + pt2.m_y ); +} + +inline wxPoint2DDouble operator-(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2) +{ + return wxPoint2DDouble( pt1.m_x - pt2.m_x , pt1.m_y - pt2.m_y ); +} + + +inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2) +{ + return wxPoint2DDouble( pt1.m_x * pt2.m_x , pt1.m_y * pt2.m_y ); +} + +inline wxPoint2DDouble operator*(wxDouble n , const wxPoint2DDouble& pt) +{ + return wxPoint2DDouble( pt.m_x * n , pt.m_y * n ); +} + +inline wxPoint2DDouble operator*(wxInt32 n , const wxPoint2DDouble& pt) +{ + return wxPoint2DDouble( pt.m_x * n , pt.m_y * n ); +} + +inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxDouble n) +{ + return wxPoint2DDouble( pt.m_x * n , pt.m_y * n ); +} + +inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxInt32 n) +{ + return wxPoint2DDouble( pt.m_x * n , pt.m_y * n ); +} + +inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2) +{ + return wxPoint2DDouble( pt1.m_x / pt2.m_x , pt1.m_y / pt2.m_y ); +} + +inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxDouble n) +{ + return wxPoint2DDouble( pt.m_x / n , pt.m_y / n ); +} + +inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxInt32 n) +{ + return wxPoint2DDouble( pt.m_x / n , pt.m_y / n ); +} + +// wxRect2Ds are an axis-aligned rectangles, each side of the rect is parallel to the x- or m_y- axis. The rectangle is either defined by the +// top left and bottom right corner, or by the top left corner and size. A point is contained within the rectangle if +// left <= x < right and top <= m_y < bottom , thus it is a half open interval. + +class WXDLLIMPEXP_CORE wxRect2DDouble +{ +public: + wxRect2DDouble() + { m_x = m_y = m_width = m_height = 0; } + wxRect2DDouble(wxDouble x, wxDouble y, wxDouble w, wxDouble h) + { m_x = x; m_y = y; m_width = w; m_height = h; } +/* + wxRect2DDouble(const wxPoint2DDouble& topLeft, const wxPoint2DDouble& bottomRight); + wxRect2DDouble(const wxPoint2DDouble& pos, const wxSize& size); + wxRect2DDouble(const wxRect2DDouble& rect); +*/ + // single attribute accessors + + wxPoint2DDouble GetPosition() const + { return wxPoint2DDouble(m_x, m_y); } + wxSize GetSize() const + { return wxSize((int) m_width, (int) m_height); } + + // for the edge and corner accessors there are two setters counterparts, the Set.. functions keep the other corners at their + // position whenever sensible, the Move.. functions keep the size of the rect and move the other corners appropriately + + inline wxDouble GetLeft() const { return m_x; } + inline void SetLeft( wxDouble n ) { m_width += m_x - n; m_x = n; } + inline void MoveLeftTo( wxDouble n ) { m_x = n; } + inline wxDouble GetTop() const { return m_y; } + inline void SetTop( wxDouble n ) { m_height += m_y - n; m_y = n; } + inline void MoveTopTo( wxDouble n ) { m_y = n; } + inline wxDouble GetBottom() const { return m_y + m_height; } + inline void SetBottom( wxDouble n ) { m_height += n - (m_y+m_height);} + inline void MoveBottomTo( wxDouble n ) { m_y = n - m_height; } + inline wxDouble GetRight() const { return m_x + m_width; } + inline void SetRight( wxDouble n ) { m_width += n - (m_x+m_width) ; } + inline void MoveRightTo( wxDouble n ) { m_x = n - m_width; } + + inline wxPoint2DDouble GetLeftTop() const + { return wxPoint2DDouble( m_x , m_y ); } + inline void SetLeftTop( const wxPoint2DDouble &pt ) + { m_width += m_x - pt.m_x; m_height += m_y - pt.m_y; m_x = pt.m_x; m_y = pt.m_y; } + inline void MoveLeftTopTo( const wxPoint2DDouble &pt ) + { m_x = pt.m_x; m_y = pt.m_y; } + inline wxPoint2DDouble GetLeftBottom() const + { return wxPoint2DDouble( m_x , m_y + m_height ); } + inline void SetLeftBottom( const wxPoint2DDouble &pt ) + { m_width += m_x - pt.m_x; m_height += pt.m_y - (m_y+m_height) ; m_x = pt.m_x; } + inline void MoveLeftBottomTo( const wxPoint2DDouble &pt ) + { m_x = pt.m_x; m_y = pt.m_y - m_height; } + inline wxPoint2DDouble GetRightTop() const + { return wxPoint2DDouble( m_x+m_width , m_y ); } + inline void SetRightTop( const wxPoint2DDouble &pt ) + { m_width += pt.m_x - ( m_x + m_width ); m_height += m_y - pt.m_y; m_y = pt.m_y; } + inline void MoveRightTopTo( const wxPoint2DDouble &pt ) + { m_x = pt.m_x - m_width; m_y = pt.m_y; } + inline wxPoint2DDouble GetRightBottom() const + { return wxPoint2DDouble( m_x+m_width , m_y + m_height ); } + inline void SetRightBottom( const wxPoint2DDouble &pt ) + { m_width += pt.m_x - ( m_x + m_width ); m_height += pt.m_y - (m_y+m_height);} + inline void MoveRightBottomTo( const wxPoint2DDouble &pt ) + { m_x = pt.m_x - m_width; m_y = pt.m_y - m_height; } + inline wxPoint2DDouble GetCentre() const + { return wxPoint2DDouble( m_x+m_width/2 , m_y+m_height/2 ); } + inline void SetCentre( const wxPoint2DDouble &pt ) + { MoveCentreTo( pt ); } // since this is impossible without moving... + inline void MoveCentreTo( const wxPoint2DDouble &pt ) + { m_x += pt.m_x - (m_x+m_width/2); m_y += pt.m_y -(m_y+m_height/2); } + inline wxOutCode GetOutCode( const wxPoint2DDouble &pt ) const + { return (wxOutCode) (( ( pt.m_x < m_x ) ? wxOutLeft : 0 ) + + ( ( pt.m_x > m_x + m_width ) ? wxOutRight : 0 ) + + ( ( pt.m_y < m_y ) ? wxOutTop : 0 ) + + ( ( pt.m_y > m_y + m_height ) ? wxOutBottom : 0 )); } + inline wxOutCode GetOutcode(const wxPoint2DDouble &pt) const + { return GetOutCode(pt) ; } + inline bool Contains( const wxPoint2DDouble &pt ) const + { return GetOutCode( pt ) == wxInside; } + inline bool Contains( const wxRect2DDouble &rect ) const + { return ( ( ( m_x <= rect.m_x ) && ( rect.m_x + rect.m_width <= m_x + m_width ) ) && + ( ( m_y <= rect.m_y ) && ( rect.m_y + rect.m_height <= m_y + m_height ) ) ); } + inline bool IsEmpty() const + { return m_width <= 0 || m_height <= 0; } + inline bool HaveEqualSize( const wxRect2DDouble &rect ) const + { return wxIsSameDouble(rect.m_width, m_width) && wxIsSameDouble(rect.m_height, m_height); } + + inline void Inset( wxDouble x , wxDouble y ) + { m_x += x; m_y += y; m_width -= 2 * x; m_height -= 2 * y; } + inline void Inset( wxDouble left , wxDouble top ,wxDouble right , wxDouble bottom ) + { m_x += left; m_y += top; m_width -= left + right; m_height -= top + bottom;} + inline void Offset( const wxPoint2DDouble &pt ) + { m_x += pt.m_x; m_y += pt.m_y; } + + void ConstrainTo( const wxRect2DDouble &rect ); + + wxPoint2DDouble Interpolate( wxInt32 widthfactor, wxInt32 heightfactor ) const + { return wxPoint2DDouble( m_x + m_width * widthfactor , m_y + m_height * heightfactor ); } + + static void Intersect( const wxRect2DDouble &src1 , const wxRect2DDouble &src2 , wxRect2DDouble *dest ); + inline void Intersect( const wxRect2DDouble &otherRect ) + { Intersect( *this , otherRect , this ); } + inline wxRect2DDouble CreateIntersection( const wxRect2DDouble &otherRect ) const + { wxRect2DDouble result; Intersect( *this , otherRect , &result); return result; } + bool Intersects( const wxRect2DDouble &rect ) const; + + static void Union( const wxRect2DDouble &src1 , const wxRect2DDouble &src2 , wxRect2DDouble *dest ); + void Union( const wxRect2DDouble &otherRect ) + { Union( *this , otherRect , this ); } + void Union( const wxPoint2DDouble &pt ); + inline wxRect2DDouble CreateUnion( const wxRect2DDouble &otherRect ) const + { wxRect2DDouble result; Union( *this , otherRect , &result); return result; } + + inline void Scale( wxDouble f ) + { m_x *= f; m_y *= f; m_width *= f; m_height *= f;} + inline void Scale( wxInt32 num , wxInt32 denum ) + { m_x *= ((wxDouble)num)/((wxDouble)denum); m_y *= ((wxDouble)num)/((wxDouble)denum); + m_width *= ((wxDouble)num)/((wxDouble)denum); m_height *= ((wxDouble)num)/((wxDouble)denum);} + + inline bool operator == (const wxRect2DDouble& rect) const + { return wxIsSameDouble(m_x, rect.m_x) && wxIsSameDouble(m_y, rect.m_y) && HaveEqualSize(rect); } + inline bool operator != (const wxRect2DDouble& rect) const + { return !(*this == rect); } + + wxDouble m_x; + wxDouble m_y; + wxDouble m_width; + wxDouble m_height; +}; + + +// wxRect2Ds are a axis-aligned rectangles, each side of the rect is parallel to the x- or m_y- axis. The rectangle is either defined by the +// top left and bottom right corner, or by the top left corner and size. A point is contained within the rectangle if +// left <= x < right and top <= m_y < bottom , thus it is a half open interval. + +class WXDLLIMPEXP_CORE wxRect2DInt +{ +public: + wxRect2DInt() { m_x = m_y = m_width = m_height = 0; } + wxRect2DInt( const wxRect& r ) { m_x = r.x ; m_y = r.y ; m_width = r.width ; m_height = r.height ; } + wxRect2DInt(wxInt32 x, wxInt32 y, wxInt32 w, wxInt32 h) { m_x = x; m_y = y; m_width = w; m_height = h; } + wxRect2DInt(const wxPoint2DInt& topLeft, const wxPoint2DInt& bottomRight); + inline wxRect2DInt(const wxPoint2DInt& pos, const wxSize& size); + // default copy ctor and copy-assign operator are OK + + // single attribute accessors + + wxPoint2DInt GetPosition() const { return wxPoint2DInt(m_x, m_y); } + wxSize GetSize() const { return wxSize(m_width, m_height); } + + // for the edge and corner accessors there are two setters counterparts, the Set.. functions keep the other corners at their + // position whenever sensible, the Move.. functions keep the size of the rect and move the other corners appropriately + + inline wxInt32 GetLeft() const { return m_x; } + inline void SetLeft( wxInt32 n ) { m_width += m_x - n; m_x = n; } + inline void MoveLeftTo( wxInt32 n ) { m_x = n; } + inline wxInt32 GetTop() const { return m_y; } + inline void SetTop( wxInt32 n ) { m_height += m_y - n; m_y = n; } + inline void MoveTopTo( wxInt32 n ) { m_y = n; } + inline wxInt32 GetBottom() const { return m_y + m_height; } + inline void SetBottom( wxInt32 n ) { m_height += n - (m_y+m_height);} + inline void MoveBottomTo( wxInt32 n ) { m_y = n - m_height; } + inline wxInt32 GetRight() const { return m_x + m_width; } + inline void SetRight( wxInt32 n ) { m_width += n - (m_x+m_width) ; } + inline void MoveRightTo( wxInt32 n ) { m_x = n - m_width; } + + inline wxPoint2DInt GetLeftTop() const { return wxPoint2DInt( m_x , m_y ); } + inline void SetLeftTop( const wxPoint2DInt &pt ) { m_width += m_x - pt.m_x; m_height += m_y - pt.m_y; m_x = pt.m_x; m_y = pt.m_y; } + inline void MoveLeftTopTo( const wxPoint2DInt &pt ) { m_x = pt.m_x; m_y = pt.m_y; } + inline wxPoint2DInt GetLeftBottom() const { return wxPoint2DInt( m_x , m_y + m_height ); } + inline void SetLeftBottom( const wxPoint2DInt &pt ) { m_width += m_x - pt.m_x; m_height += pt.m_y - (m_y+m_height) ; m_x = pt.m_x; } + inline void MoveLeftBottomTo( const wxPoint2DInt &pt ) { m_x = pt.m_x; m_y = pt.m_y - m_height; } + inline wxPoint2DInt GetRightTop() const { return wxPoint2DInt( m_x+m_width , m_y ); } + inline void SetRightTop( const wxPoint2DInt &pt ) { m_width += pt.m_x - ( m_x + m_width ); m_height += m_y - pt.m_y; m_y = pt.m_y; } + inline void MoveRightTopTo( const wxPoint2DInt &pt ) { m_x = pt.m_x - m_width; m_y = pt.m_y; } + inline wxPoint2DInt GetRightBottom() const { return wxPoint2DInt( m_x+m_width , m_y + m_height ); } + inline void SetRightBottom( const wxPoint2DInt &pt ) { m_width += pt.m_x - ( m_x + m_width ); m_height += pt.m_y - (m_y+m_height);} + inline void MoveRightBottomTo( const wxPoint2DInt &pt ) { m_x = pt.m_x - m_width; m_y = pt.m_y - m_height; } + inline wxPoint2DInt GetCentre() const { return wxPoint2DInt( m_x+m_width/2 , m_y+m_height/2 ); } + inline void SetCentre( const wxPoint2DInt &pt ) { MoveCentreTo( pt ); } // since this is impossible without moving... + inline void MoveCentreTo( const wxPoint2DInt &pt ) { m_x += pt.m_x - (m_x+m_width/2); m_y += pt.m_y -(m_y+m_height/2); } + inline wxOutCode GetOutCode( const wxPoint2DInt &pt ) const + { return (wxOutCode) (( ( pt.m_x < m_x ) ? wxOutLeft : 0 ) + + ( ( pt.m_x >= m_x + m_width ) ? wxOutRight : 0 ) + + ( ( pt.m_y < m_y ) ? wxOutTop : 0 ) + + ( ( pt.m_y >= m_y + m_height ) ? wxOutBottom : 0 )); } + inline wxOutCode GetOutcode( const wxPoint2DInt &pt ) const + { return GetOutCode( pt ) ; } + inline bool Contains( const wxPoint2DInt &pt ) const + { return GetOutCode( pt ) == wxInside; } + inline bool Contains( const wxRect2DInt &rect ) const + { return ( ( ( m_x <= rect.m_x ) && ( rect.m_x + rect.m_width <= m_x + m_width ) ) && + ( ( m_y <= rect.m_y ) && ( rect.m_y + rect.m_height <= m_y + m_height ) ) ); } + inline bool IsEmpty() const + { return ( m_width <= 0 || m_height <= 0 ); } + inline bool HaveEqualSize( const wxRect2DInt &rect ) const + { return ( rect.m_width == m_width && rect.m_height == m_height ); } + + inline void Inset( wxInt32 x , wxInt32 y ) { m_x += x; m_y += y; m_width -= 2 * x; m_height -= 2 * y; } + inline void Inset( wxInt32 left , wxInt32 top ,wxInt32 right , wxInt32 bottom ) + { m_x += left; m_y += top; m_width -= left + right; m_height -= top + bottom;} + inline void Offset( const wxPoint2DInt &pt ) { m_x += pt.m_x; m_y += pt.m_y; } + void ConstrainTo( const wxRect2DInt &rect ); + wxPoint2DInt Interpolate( wxInt32 widthfactor, wxInt32 heightfactor ) const + { return wxPoint2DInt( m_x + m_width * widthfactor, m_y + m_height * heightfactor ); } + + static void Intersect( const wxRect2DInt &src1 , const wxRect2DInt &src2 , wxRect2DInt *dest ); + inline void Intersect( const wxRect2DInt &otherRect ) { Intersect( *this , otherRect , this ); } + inline wxRect2DInt CreateIntersection( const wxRect2DInt &otherRect ) const { wxRect2DInt result; Intersect( *this , otherRect , &result); return result; } + bool Intersects( const wxRect2DInt &rect ) const; + + static void Union( const wxRect2DInt &src1 , const wxRect2DInt &src2 , wxRect2DInt *dest ); + void Union( const wxRect2DInt &otherRect ) { Union( *this , otherRect , this ); } + void Union( const wxPoint2DInt &pt ); + inline wxRect2DInt CreateUnion( const wxRect2DInt &otherRect ) const { wxRect2DInt result; Union( *this , otherRect , &result); return result; } + + inline void Scale( wxInt32 f ) { m_x *= f; m_y *= f; m_width *= f; m_height *= f;} + inline void Scale( wxInt32 num , wxInt32 denum ) + { m_x *= ((wxInt32)num)/((wxInt32)denum); m_y *= ((wxInt32)num)/((wxInt32)denum); + m_width *= ((wxInt32)num)/((wxInt32)denum); m_height *= ((wxInt32)num)/((wxInt32)denum);} + + bool operator == (const wxRect2DInt& rect) const; + bool operator != (const wxRect2DInt& rect) const; + +#if wxUSE_STREAMS + void WriteTo( wxDataOutputStream &stream ) const; + void ReadFrom( wxDataInputStream &stream ); +#endif // wxUSE_STREAMS + + wxInt32 m_x; + wxInt32 m_y; + wxInt32 m_width; + wxInt32 m_height; +}; + +inline wxRect2DInt::wxRect2DInt( const wxPoint2DInt &a , const wxPoint2DInt &b) +{ + m_x = wxMin( a.m_x , b.m_x ); + m_y = wxMin( a.m_y , b.m_y ); + m_width = abs( a.m_x - b.m_x ); + m_height = abs( a.m_y - b.m_y ); +} + +inline wxRect2DInt::wxRect2DInt( const wxPoint2DInt& pos, const wxSize& size) +{ + m_x = pos.m_x; + m_y = pos.m_y; + m_width = size.x; + m_height = size.y; +} + +inline bool wxRect2DInt::operator == (const wxRect2DInt& rect) const +{ + return (m_x==rect.m_x && m_y==rect.m_y && + m_width==rect.m_width && m_height==rect.m_height); +} + +inline bool wxRect2DInt::operator != (const wxRect2DInt& rect) const +{ + return !(*this == rect); +} + +class WXDLLIMPEXP_CORE wxTransform2D +{ +public : + virtual ~wxTransform2D() { } + virtual void Transform( wxPoint2DInt* pt )const = 0; + virtual void Transform( wxRect2DInt* r ) const; + virtual wxPoint2DInt Transform( const wxPoint2DInt &pt ) const; + virtual wxRect2DInt Transform( const wxRect2DInt &r ) const ; + + virtual void InverseTransform( wxPoint2DInt* pt ) const = 0; + virtual void InverseTransform( wxRect2DInt* r ) const ; + virtual wxPoint2DInt InverseTransform( const wxPoint2DInt &pt ) const ; + virtual wxRect2DInt InverseTransform( const wxRect2DInt &r ) const ; +}; + + +#endif // wxUSE_GEOMETRY + +#endif // _WX_GEOMETRY_H_ diff --git a/lib/wxWidgets/include/wx/gifdecod.h b/lib/wxWidgets/include/wx/gifdecod.h new file mode 100644 index 0000000..5dee4ca --- /dev/null +++ b/lib/wxWidgets/include/wx/gifdecod.h @@ -0,0 +1,114 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gifdecod.h +// Purpose: wxGIFDecoder, GIF reader for wxImage and wxAnimation +// Author: Guillermo Rodriguez Garcia +// Version: 3.02 +// Copyright: (c) 1999 Guillermo Rodriguez Garcia +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GIFDECOD_H_ +#define _WX_GIFDECOD_H_ + +#include "wx/defs.h" + +#if wxUSE_STREAMS && wxUSE_GIF + +#include "wx/stream.h" +#include "wx/image.h" +#include "wx/animdecod.h" +#include "wx/dynarray.h" + +// internal utility used to store a frame in 8bit-per-pixel format +class GIFImage; + + +// -------------------------------------------------------------------------- +// Constants +// -------------------------------------------------------------------------- + +// Error codes: +// Note that the error code wxGIF_TRUNCATED means that the image itself +// is most probably OK, but the decoder didn't reach the end of the data +// stream; this means that if it was not reading directly from file, +// the stream will not be correctly positioned. +// +enum wxGIFErrorCode +{ + wxGIF_OK = 0, // everything was OK + wxGIF_INVFORMAT, // error in GIF header + wxGIF_MEMERR, // error allocating memory + wxGIF_TRUNCATED // file appears to be truncated +}; + +// -------------------------------------------------------------------------- +// wxGIFDecoder class +// -------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGIFDecoder : public wxAnimationDecoder +{ +public: + // constructor, destructor, etc. + wxGIFDecoder(); + ~wxGIFDecoder(); + + // get data of current frame + unsigned char* GetData(unsigned int frame) const; + unsigned char* GetPalette(unsigned int frame) const; + unsigned int GetNcolours(unsigned int frame) const; + int GetTransparentColourIndex(unsigned int frame) const; + wxColour GetTransparentColour(unsigned int frame) const wxOVERRIDE; + + virtual wxSize GetFrameSize(unsigned int frame) const wxOVERRIDE; + virtual wxPoint GetFramePosition(unsigned int frame) const wxOVERRIDE; + virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const wxOVERRIDE; + virtual long GetDelay(unsigned int frame) const wxOVERRIDE; + + // GIFs can contain both static images and animations + bool IsAnimation() const + { return m_nFrames > 1; } + + // load function which returns more info than just Load(): + wxGIFErrorCode LoadGIF( wxInputStream& stream ); + + // free all internal frames + void Destroy(); + + // implementation of wxAnimationDecoder's pure virtuals + virtual bool Load( wxInputStream& stream ) wxOVERRIDE + { return LoadGIF(stream) == wxGIF_OK; } + + bool ConvertToImage(unsigned int frame, wxImage *image) const wxOVERRIDE; + + wxAnimationDecoder *Clone() const wxOVERRIDE + { return new wxGIFDecoder; } + wxAnimationType GetType() const wxOVERRIDE + { return wxANIMATION_TYPE_GIF; } + +protected: + // wxAnimationDecoder pure virtual + virtual bool DoCanRead( wxInputStream& stream ) const wxOVERRIDE; + // modifies current stream position (see wxAnimationDecoder::CanRead) + +private: + int getcode(wxInputStream& stream, int bits, int abfin); + wxGIFErrorCode dgif(wxInputStream& stream, + GIFImage *img, int interl, int bits); + + + // array of all frames + wxArrayPtrVoid m_frames; + + // decoder state vars + int m_restbits; // remaining valid bits + unsigned int m_restbyte; // remaining bytes in this block + unsigned int m_lastbyte; // last byte read + unsigned char m_buffer[256]; // buffer for reading + unsigned char *m_bufp; // pointer to next byte in buffer + + wxDECLARE_NO_COPY_CLASS(wxGIFDecoder); +}; + +#endif // wxUSE_STREAMS && wxUSE_GIF + +#endif // _WX_GIFDECOD_H_ diff --git a/lib/wxWidgets/include/wx/glcanvas.h b/lib/wxWidgets/include/wx/glcanvas.h new file mode 100644 index 0000000..00f1495 --- /dev/null +++ b/lib/wxWidgets/include/wx/glcanvas.h @@ -0,0 +1,384 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/glcanvas.h +// Purpose: wxGLCanvas base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GLCANVAS_H_BASE_ +#define _WX_GLCANVAS_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_GLCANVAS + +#include "wx/app.h" +#include "wx/palette.h" +#include "wx/window.h" + +class WXDLLIMPEXP_FWD_GL wxGLCanvas; +class WXDLLIMPEXP_FWD_GL wxGLContext; + +// ---------------------------------------------------------------------------- +// Constants for attributes list +// ---------------------------------------------------------------------------- + +// Notice that not all implementation support options such as stereo, auxiliary +// buffers, alpha channel, and accumulator buffer, use IsDisplaySupported() to +// check for individual attributes support. +enum +{ + WX_GL_RGBA = 1, // use true color palette (on if no attrs specified) + WX_GL_BUFFER_SIZE, // bits for buffer if not WX_GL_RGBA + WX_GL_LEVEL, // 0 for main buffer, >0 for overlay, <0 for underlay + WX_GL_DOUBLEBUFFER, // use double buffering (on if no attrs specified) + WX_GL_STEREO, // use stereoscopic display + WX_GL_AUX_BUFFERS, // number of auxiliary buffers + WX_GL_MIN_RED, // use red buffer with most bits (> MIN_RED bits) + WX_GL_MIN_GREEN, // use green buffer with most bits (> MIN_GREEN bits) + WX_GL_MIN_BLUE, // use blue buffer with most bits (> MIN_BLUE bits) + WX_GL_MIN_ALPHA, // use alpha buffer with most bits (> MIN_ALPHA bits) + WX_GL_DEPTH_SIZE, // bits for Z-buffer (0,16,32) + WX_GL_STENCIL_SIZE, // bits for stencil buffer + WX_GL_MIN_ACCUM_RED, // use red accum buffer with most bits (> MIN_ACCUM_RED bits) + WX_GL_MIN_ACCUM_GREEN, // use green buffer with most bits (> MIN_ACCUM_GREEN bits) + WX_GL_MIN_ACCUM_BLUE, // use blue buffer with most bits (> MIN_ACCUM_BLUE bits) + WX_GL_MIN_ACCUM_ALPHA, // use alpha buffer with most bits (> MIN_ACCUM_ALPHA bits) + WX_GL_SAMPLE_BUFFERS, // 1 for multisampling support (antialiasing) + WX_GL_SAMPLES, // 4 for 2x2 antialiasing supersampling on most graphics cards + WX_GL_FRAMEBUFFER_SRGB,// capability for sRGB framebuffer + // Context attributes + WX_GL_CORE_PROFILE, // use an OpenGL core profile + WX_GL_MAJOR_VERSION, // major OpenGL version of the core profile + WX_GL_MINOR_VERSION, // minor OpenGL version of the core profile + wx_GL_COMPAT_PROFILE, // use compatible profile (use all versions features) + WX_GL_FORWARD_COMPAT, // forward compatible context. OpenGL >= 3.0 + WX_GL_ES2, // ES or ES2 context. + WX_GL_DEBUG, // create a debug context + WX_GL_ROBUST_ACCESS, // robustness. + WX_GL_NO_RESET_NOTIFY, // never deliver notification of reset events + WX_GL_LOSE_ON_RESET, // if graphics reset, all context state is lost + WX_GL_RESET_ISOLATION, // protect other apps or share contexts from reset side-effects + WX_GL_RELEASE_FLUSH, // on context release, flush pending commands + WX_GL_RELEASE_NONE // on context release, pending commands are not flushed +}; + +#define wxGLCanvasName wxT("GLCanvas") + +// ---------------------------------------------------------------------------- +// wxGLAttribsBase: OpenGL rendering attributes +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_GL wxGLAttribsBase +{ +public: + wxGLAttribsBase() { Reset(); } + + // Setters + void AddAttribute(int attribute) { m_GLValues.push_back(attribute); } + // Search for searchVal and combine the next value with combineVal + void AddAttribBits(int searchVal, int combineVal); + // ARB functions necessity + void SetNeedsARB(bool needsARB = true) { m_needsARB = needsARB; } + + // Delete contents + void Reset() + { + m_GLValues.clear(); + m_needsARB = false; + } + + // Accessors + const int* GetGLAttrs() const + { + return (m_GLValues.empty() || !m_GLValues[0]) ? NULL : &*m_GLValues.begin(); + } + + int GetSize() const { return (int)(m_GLValues.size()); } + + // ARB function (e.g. wglCreateContextAttribsARB) is needed + bool NeedsARB() const { return m_needsARB; } + +private: + wxVector m_GLValues; + bool m_needsARB; +}; + +// ---------------------------------------------------------------------------- +// wxGLContextAttrs: OpenGL rendering context attributes +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_GL wxGLContextAttrs : public wxGLAttribsBase +{ +public: + // Setters, allowing chained calls + wxGLContextAttrs& CoreProfile(); + wxGLContextAttrs& MajorVersion(int val); + wxGLContextAttrs& MinorVersion(int val); + wxGLContextAttrs& OGLVersion(int vmayor, int vminor) + { return MajorVersion(vmayor).MinorVersion(vminor); } + wxGLContextAttrs& CompatibilityProfile(); + wxGLContextAttrs& ForwardCompatible(); + wxGLContextAttrs& ES2(); + wxGLContextAttrs& DebugCtx(); + wxGLContextAttrs& Robust(); + wxGLContextAttrs& NoResetNotify(); + wxGLContextAttrs& LoseOnReset(); + wxGLContextAttrs& ResetIsolation(); + wxGLContextAttrs& ReleaseFlush(int val = 1); //'int' allows future values + wxGLContextAttrs& PlatformDefaults(); + void EndList(); // No more values can be chained + + // Currently only used for X11 context creation + bool x11Direct; // X11 direct render + bool renderTypeRGBA; +}; + +// ---------------------------------------------------------------------------- +// wxGLAttributes: canvas configuration +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_GL wxGLAttributes : public wxGLAttribsBase +{ +public: + // Setters, allowing chained calls + wxGLAttributes& RGBA(); + wxGLAttributes& BufferSize(int val); + wxGLAttributes& Level(int val); + wxGLAttributes& DoubleBuffer(); + wxGLAttributes& Stereo(); + wxGLAttributes& AuxBuffers(int val); + wxGLAttributes& MinRGBA(int mRed, int mGreen, int mBlue, int mAlpha); + wxGLAttributes& Depth(int val); + wxGLAttributes& Stencil(int val); + wxGLAttributes& MinAcumRGBA(int mRed, int mGreen, int mBlue, int mAlpha); + wxGLAttributes& PlatformDefaults(); + wxGLAttributes& Defaults(); + wxGLAttributes& SampleBuffers(int val); + wxGLAttributes& Samplers(int val); + wxGLAttributes& FrameBuffersRGB(); + void EndList(); // No more values can be chained + + // This function is undocumented and cannot be chained on purpose! + // To keep backwards compatibility with versions before wx3.1 we add here + // the default values used in those versions for the case of NULL list. + void AddDefaultsForWXBefore31(); +}; + +// ---------------------------------------------------------------------------- +// wxGLContextBase: OpenGL rendering context +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_GL wxGLContextBase : public wxObject +{ +public: + +// The derived class should provide a ctor with this signature: +// +// wxGLContext(wxGLCanvas *win, +// const wxGLContext *other = NULL, +// const wxGLContextAttrs *ctxAttrs = NULL); + + // set this context as the current one + virtual bool SetCurrent(const wxGLCanvas& win) const = 0; + + bool IsOK() const { return m_isOk; } + +protected: + bool m_isOk; +}; + +// ---------------------------------------------------------------------------- +// wxGLCanvasBase: window which can be used for OpenGL rendering +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_GL wxGLCanvasBase : public wxWindow +{ +public: + // default ctor doesn't initialize the window, use Create() later + wxGLCanvasBase(); + + virtual ~wxGLCanvasBase(); + + + /* + The derived class should provide a ctor with this signature: + + wxGLCanvas(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + */ + + // operations + // ---------- + + // set the given context associated with this window as the current one + bool SetCurrent(const wxGLContext& context) const; + + // flush the back buffer (if we have it) + virtual bool SwapBuffers() = 0; + + + // accessors + // --------- + + // check if the given attributes are supported without creating a canvas + static bool IsDisplaySupported(const wxGLAttributes& dispAttrs); + static bool IsDisplaySupported(const int *attribList); + +#if wxUSE_PALETTE + const wxPalette *GetPalette() const { return &m_palette; } +#endif // wxUSE_PALETTE + + // miscellaneous helper functions + // ------------------------------ + + // call glcolor() for the colour with the given name, return false if + // colour not found + bool SetColour(const wxString& colour); + + // return true if the extension with given name is supported + // + // notice that while this function is implemented for all of GLX, WGL and + // AGL the extensions names are usually not the same for different + // platforms and so the code using it still usually uses conditional + // compilation + static bool IsExtensionSupported(const char *extension); + + // Get the wxGLContextAttrs object filled with the context-related values + // of the list of attributes passed at ctor when no wxGLAttributes is used + // as a parameter + wxGLContextAttrs& GetGLCTXAttrs() { return m_GLCTXAttrs; } + + // deprecated methods using the implicit wxGLContext +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED( wxGLContext* GetContext() const ); + + wxDEPRECATED( void SetCurrent() ); + + wxDEPRECATED( void OnSize(wxSizeEvent& event) ); +#endif // WXWIN_COMPATIBILITY_2_8 + +#ifdef __WXUNIVERSAL__ + // resolve the conflict with wxWindowUniv::SetCurrent() + virtual bool SetCurrent(bool doit) { return wxWindow::SetCurrent(doit); } +#endif + +protected: + // override this to implement SetColour() in GL_INDEX_MODE + // (currently only implemented in wxX11 and wxMotif ports) + virtual int GetColourIndex(const wxColour& WXUNUSED(col)) { return -1; } + + // check if the given extension name is present in the space-separated list + // of extensions supported by the current implementation such as returned + // by glXQueryExtensionsString() or glGetString(GL_EXTENSIONS) + static bool IsExtensionInList(const char *list, const char *extension); + + // For the case of "int* attribList" at ctor is != 0 + wxGLContextAttrs m_GLCTXAttrs; + + // Extract pixel format and context attributes. + // Return false if an unknown attribute is found. + static bool ParseAttribList(const int* attribList, + wxGLAttributes& dispAttrs, + wxGLContextAttrs* ctxAttrs = NULL); + +#if wxUSE_PALETTE + // create default palette if we're not using RGBA mode + // (not supported in most ports) + virtual wxPalette CreateDefaultPalette() { return wxNullPalette; } + + wxPalette m_palette; +#endif // wxUSE_PALETTE + +#if WXWIN_COMPATIBILITY_2_8 + wxGLContext *m_glContext; +#endif // WXWIN_COMPATIBILITY_2_8 +}; + +// ---------------------------------------------------------------------------- +// wxGLApp: a special wxApp subclass for OpenGL applications which must be used +// to select a visual compatible with the given attributes +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_GL wxGLAppBase : public wxApp +{ +public: + wxGLAppBase() : wxApp() { } + + // use this in the constructor of the user-derived wxGLApp class to + // determine if an OpenGL rendering context with these attributes + // is available - returns true if so, false if not. + virtual bool InitGLVisual(const int *attribList) = 0; +}; + +#if defined(__WXMSW__) + #include "wx/msw/glcanvas.h" +#elif defined(__WXMOTIF__) || defined(__WXX11__) + #include "wx/x11/glcanvas.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/glcanvas.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/glcanvas.h" +#elif defined(__WXMAC__) + #include "wx/osx/glcanvas.h" +#elif defined(__WXQT__) + #include "wx/qt/glcanvas.h" +#else + #error "wxGLCanvas not supported in this wxWidgets port" +#endif + +// wxMac and wxMSW don't need anything extra in wxGLAppBase, so declare it here +#ifndef wxGL_APP_DEFINED + +class WXDLLIMPEXP_GL wxGLApp : public wxGLAppBase +{ +public: + wxGLApp() : wxGLAppBase() { } + + virtual bool InitGLVisual(const int *attribList) wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxGLApp); +}; + +#endif // !wxGL_APP_DEFINED + +// ---------------------------------------------------------------------------- +// wxGLAPI: an API wrapper that allows the use of 'old' APIs even on OpenGL +// platforms that don't support it natively anymore, if the APIs are available +// it's a mere redirect +// ---------------------------------------------------------------------------- + +#ifndef wxUSE_OPENGL_EMULATION + #define wxUSE_OPENGL_EMULATION 0 +#endif + +class WXDLLIMPEXP_GL wxGLAPI : public wxObject +{ +public: + wxGLAPI(); + ~wxGLAPI(); + + static void glFrustum(GLfloat left, GLfloat right, GLfloat bottom, + GLfloat top, GLfloat zNear, GLfloat zFar); + static void glBegin(GLenum mode); + static void glTexCoord2f(GLfloat s, GLfloat t); + static void glVertex3f(GLfloat x, GLfloat y, GLfloat z); + static void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz); + static void glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a); + static void glColor3f(GLfloat r, GLfloat g, GLfloat b); + static void glEnd(); +}; + +#endif // wxUSE_GLCANVAS + +#endif // _WX_GLCANVAS_H_BASE_ diff --git a/lib/wxWidgets/include/wx/graphics.h b/lib/wxWidgets/include/wx/graphics.h new file mode 100644 index 0000000..e12e074 --- /dev/null +++ b/lib/wxWidgets/include/wx/graphics.h @@ -0,0 +1,1126 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/graphics.h +// Purpose: graphics context header +// Author: Stefan Csomor +// Modified by: +// Created: +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GRAPHICS_H_ +#define _WX_GRAPHICS_H_ + +#include "wx/defs.h" + +#if wxUSE_GRAPHICS_CONTEXT + +#include "wx/affinematrix2d.h" +#include "wx/geometry.h" +#include "wx/colour.h" +#include "wx/dynarray.h" +#include "wx/font.h" +#include "wx/image.h" +#include "wx/peninfobase.h" +#include "wx/vector.h" + +enum wxAntialiasMode +{ + wxANTIALIAS_NONE, // should be 0 + wxANTIALIAS_DEFAULT +}; + +enum wxInterpolationQuality +{ + // default interpolation + wxINTERPOLATION_DEFAULT, + // no interpolation + wxINTERPOLATION_NONE, + // fast interpolation, suited for interactivity + wxINTERPOLATION_FAST, + // better quality + wxINTERPOLATION_GOOD, + // best quality, not suited for interactivity + wxINTERPOLATION_BEST +}; + +enum wxCompositionMode +{ + // R = Result, S = Source, D = Destination, premultiplied with alpha + // Ra, Sa, Da their alpha components + + // classic Porter-Duff compositions + // http://keithp.com/~keithp/porterduff/p253-porter.pdf + + wxCOMPOSITION_INVALID = -1, /* indicates invalid/unsupported mode */ + wxCOMPOSITION_CLEAR, /* R = 0 */ + wxCOMPOSITION_SOURCE, /* R = S */ + wxCOMPOSITION_OVER, /* R = S + D*(1 - Sa) */ + wxCOMPOSITION_IN, /* R = S*Da */ + wxCOMPOSITION_OUT, /* R = S*(1 - Da) */ + wxCOMPOSITION_ATOP, /* R = S*Da + D*(1 - Sa) */ + + wxCOMPOSITION_DEST, /* R = D, essentially a noop */ + wxCOMPOSITION_DEST_OVER, /* R = S*(1 - Da) + D */ + wxCOMPOSITION_DEST_IN, /* R = D*Sa */ + wxCOMPOSITION_DEST_OUT, /* R = D*(1 - Sa) */ + wxCOMPOSITION_DEST_ATOP, /* R = S*(1 - Da) + D*Sa */ + wxCOMPOSITION_XOR, /* R = S*(1 - Da) + D*(1 - Sa) */ + + // mathematical compositions + wxCOMPOSITION_ADD, /* R = S + D */ + wxCOMPOSITION_DIFF /* R = abs(S - D) */ +}; + +enum wxGradientType +{ + wxGRADIENT_NONE, + wxGRADIENT_LINEAR, + wxGRADIENT_RADIAL +}; + + +class WXDLLIMPEXP_FWD_CORE wxDC; +class WXDLLIMPEXP_FWD_CORE wxWindowDC; +class WXDLLIMPEXP_FWD_CORE wxMemoryDC; +#if wxUSE_PRINTING_ARCHITECTURE +class WXDLLIMPEXP_FWD_CORE wxPrinterDC; +#endif +#ifdef __WXMSW__ +#if wxUSE_ENH_METAFILE +class WXDLLIMPEXP_FWD_CORE wxEnhMetaFileDC; +#endif +#endif +class WXDLLIMPEXP_FWD_CORE wxGraphicsContext; +class WXDLLIMPEXP_FWD_CORE wxGraphicsPath; +class WXDLLIMPEXP_FWD_CORE wxGraphicsMatrix; +class WXDLLIMPEXP_FWD_CORE wxGraphicsFigure; +class WXDLLIMPEXP_FWD_CORE wxGraphicsRenderer; +class WXDLLIMPEXP_FWD_CORE wxGraphicsPen; +class WXDLLIMPEXP_FWD_CORE wxGraphicsBrush; +class WXDLLIMPEXP_FWD_CORE wxGraphicsFont; +class WXDLLIMPEXP_FWD_CORE wxGraphicsBitmap; + + +/* + * notes about the graphics context apis + * + * angles : are measured in radians, 0.0 being in direction of positive x axis, PI/2 being + * in direction of positive y axis. + */ + +// Base class of all objects used for drawing in the new graphics API, the always point back to their +// originating rendering engine, there is no dynamic unloading of a renderer currently allowed, +// these references are not counted + +// +// The data used by objects like graphics pens etc is ref counted, in order to avoid unnecessary expensive +// duplication. Any operation on a shared instance that results in a modified state, uncouples this +// instance from the other instances that were shared - using copy on write semantics +// + +class WXDLLIMPEXP_FWD_CORE wxGraphicsObjectRefData; +class WXDLLIMPEXP_FWD_CORE wxGraphicsBitmapData; +class WXDLLIMPEXP_FWD_CORE wxGraphicsMatrixData; +class WXDLLIMPEXP_FWD_CORE wxGraphicsPathData; + +class WXDLLIMPEXP_CORE wxGraphicsObject : public wxObject +{ +public: + wxGraphicsObject(); + wxGraphicsObject( wxGraphicsRenderer* renderer ); + + wxDECLARE_DEFAULT_COPY(wxGraphicsObject) + + virtual ~wxGraphicsObject(); + + bool IsNull() const; + + // returns the renderer that was used to create this instance, or NULL if it has not been initialized yet + wxGraphicsRenderer* GetRenderer() const; + wxGraphicsObjectRefData* GetGraphicsData() const; +protected: + virtual wxObjectRefData* CreateRefData() const wxOVERRIDE; + virtual wxObjectRefData* CloneRefData(const wxObjectRefData* data) const wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxGraphicsObject); +}; + + + +class WXDLLIMPEXP_CORE wxGraphicsPen : public wxGraphicsObject +{ +public: + wxGraphicsPen() {} + virtual ~wxGraphicsPen() {} +private: + wxDECLARE_DYNAMIC_CLASS(wxGraphicsPen); +}; + +extern WXDLLIMPEXP_DATA_CORE(wxGraphicsPen) wxNullGraphicsPen; + +class WXDLLIMPEXP_CORE wxGraphicsBrush : public wxGraphicsObject +{ +public: + wxGraphicsBrush() {} + virtual ~wxGraphicsBrush() {} +private: + wxDECLARE_DYNAMIC_CLASS(wxGraphicsBrush); +}; + +extern WXDLLIMPEXP_DATA_CORE(wxGraphicsBrush) wxNullGraphicsBrush; + +class WXDLLIMPEXP_CORE wxGraphicsFont : public wxGraphicsObject +{ +public: + wxGraphicsFont() {} + virtual ~wxGraphicsFont() {} +private: + wxDECLARE_DYNAMIC_CLASS(wxGraphicsFont); +}; + +extern WXDLLIMPEXP_DATA_CORE(wxGraphicsFont) wxNullGraphicsFont; + +class WXDLLIMPEXP_CORE wxGraphicsBitmap : public wxGraphicsObject +{ +public: + wxGraphicsBitmap() {} + virtual ~wxGraphicsBitmap() {} + + // Convert bitmap to wxImage: this is more efficient than converting to + // wxBitmap first and then to wxImage and also works without X server + // connection under Unix that wxBitmap requires. +#if wxUSE_IMAGE + wxImage ConvertToImage() const; +#endif // wxUSE_IMAGE + + void* GetNativeBitmap() const; + + const wxGraphicsBitmapData* GetBitmapData() const + { return (const wxGraphicsBitmapData*) GetRefData(); } + wxGraphicsBitmapData* GetBitmapData() + { return (wxGraphicsBitmapData*) GetRefData(); } + +private: + wxDECLARE_DYNAMIC_CLASS(wxGraphicsBitmap); +}; + +extern WXDLLIMPEXP_DATA_CORE(wxGraphicsBitmap) wxNullGraphicsBitmap; + +class WXDLLIMPEXP_CORE wxGraphicsMatrix : public wxGraphicsObject +{ +public: + wxGraphicsMatrix() {} + + wxDECLARE_DEFAULT_COPY(wxGraphicsMatrix) + + virtual ~wxGraphicsMatrix() {} + + // concatenates the matrix + virtual void Concat( const wxGraphicsMatrix *t ); + void Concat( const wxGraphicsMatrix &t ) { Concat( &t ); } + + // sets the matrix to the respective values + virtual void Set(wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, + wxDouble tx=0.0, wxDouble ty=0.0); + + // gets the component values of the matrix + virtual void Get(wxDouble* a=NULL, wxDouble* b=NULL, wxDouble* c=NULL, + wxDouble* d=NULL, wxDouble* tx=NULL, wxDouble* ty=NULL) const; + + // makes this the inverse matrix + virtual void Invert(); + + // returns true if the elements of the transformation matrix are equal ? + virtual bool IsEqual( const wxGraphicsMatrix* t) const; + bool IsEqual( const wxGraphicsMatrix& t) const { return IsEqual( &t ); } + + // return true if this is the identity matrix + virtual bool IsIdentity() const; + + // + // transformation + // + + // add the translation to this matrix + virtual void Translate( wxDouble dx , wxDouble dy ); + + // add the scale to this matrix + virtual void Scale( wxDouble xScale , wxDouble yScale ); + + // add the rotation to this matrix (radians) + virtual void Rotate( wxDouble angle ); + + // + // apply the transforms + // + + // applies that matrix to the point + virtual void TransformPoint( wxDouble *x, wxDouble *y ) const; + + // applies the matrix except for translations + virtual void TransformDistance( wxDouble *dx, wxDouble *dy ) const; + + // returns the native representation + virtual void * GetNativeMatrix() const; + + const wxGraphicsMatrixData* GetMatrixData() const + { return (const wxGraphicsMatrixData*) GetRefData(); } + wxGraphicsMatrixData* GetMatrixData() + { return (wxGraphicsMatrixData*) GetRefData(); } + +private: + wxDECLARE_DYNAMIC_CLASS(wxGraphicsMatrix); +}; + +extern WXDLLIMPEXP_DATA_CORE(wxGraphicsMatrix) wxNullGraphicsMatrix; + +// ---------------------------------------------------------------------------- +// wxGradientStop and wxGradientStops: Specify what intermediate colors are used +// and how they are spread out in a gradient +// ---------------------------------------------------------------------------- + +// gcc 9 gives a nonsensical warning about implicitly generated move ctor not +// throwing but not being noexcept, suppress it. +#if wxCHECK_GCC_VERSION(9, 1) && !wxCHECK_GCC_VERSION(10, 0) +wxGCC_WARNING_SUPPRESS(noexcept) +#endif + +// Describes a single gradient stop. +class wxGraphicsGradientStop +{ +public: + wxGraphicsGradientStop(wxColour col = wxTransparentColour, + float pos = 0.0f) + : m_col(col), + m_pos(pos) + { + } + + // default copy ctor, assignment operator and dtor are ok + + const wxColour& GetColour() const { return m_col; } + void SetColour(const wxColour& col) { m_col = col; } + + float GetPosition() const { return m_pos; } + void SetPosition(float pos) + { + wxASSERT_MSG( pos >= 0 && pos <= 1, "invalid gradient stop position" ); + + m_pos = pos; + } + +private: + // The colour of this gradient band. + wxColour m_col; + + // Its starting position: 0 is the beginning and 1 is the end. + float m_pos; +}; + +#if wxCHECK_GCC_VERSION(9, 1) && !wxCHECK_GCC_VERSION(10, 0) +wxGCC_WARNING_RESTORE(noexcept) +#endif + +// A collection of gradient stops ordered by their positions (from lowest to +// highest). The first stop (index 0, position 0.0) is always the starting +// colour and the last one (index GetCount() - 1, position 1.0) is the end +// colour. +class WXDLLIMPEXP_CORE wxGraphicsGradientStops +{ +public: + wxGraphicsGradientStops(wxColour startCol = wxTransparentColour, + wxColour endCol = wxTransparentColour) + { + // we can't use Add() here as it relies on having start/end stops as + // first/last array elements so do it manually + m_stops.push_back(wxGraphicsGradientStop(startCol, 0.f)); + m_stops.push_back(wxGraphicsGradientStop(endCol, 1.f)); + } + + // default copy ctor, assignment operator and dtor are ok for this class + + + // Add a stop in correct order. + void Add(const wxGraphicsGradientStop& stop); + void Add(wxColour col, float pos) { Add(wxGraphicsGradientStop(col, pos)); } + + // Get the number of stops. + size_t GetCount() const { return m_stops.size(); } + + // Return the stop at the given index (which must be valid). + wxGraphicsGradientStop Item(unsigned n) const { return m_stops.at(n); } + + // Get/set start and end colours. + void SetStartColour(wxColour col) + { m_stops[0].SetColour(col); } + wxColour GetStartColour() const + { return m_stops[0].GetColour(); } + void SetEndColour(wxColour col) + { m_stops[m_stops.size() - 1].SetColour(col); } + wxColour GetEndColour() const + { return m_stops[m_stops.size() - 1].GetColour(); } + +private: + // All the stops stored in ascending order of positions. + wxVector m_stops; +}; + +// ---------------------------------------------------------------------------- +// wxGraphicsPenInfo describes a wxGraphicsPen +// ---------------------------------------------------------------------------- + +class wxGraphicsPenInfo : public wxPenInfoBase +{ +public: + explicit wxGraphicsPenInfo(const wxColour& colour = wxColour(), + wxDouble width = 1.0, + wxPenStyle style = wxPENSTYLE_SOLID) + : wxPenInfoBase(colour, style) + { + m_width = width; + m_gradientType = wxGRADIENT_NONE; + } + + // Setters + + wxGraphicsPenInfo& Width(wxDouble width) + { m_width = width; return *this; } + + wxGraphicsPenInfo& + LinearGradient(wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, + const wxColour& c1, const wxColour& c2, + const wxGraphicsMatrix& matrix = wxNullGraphicsMatrix) + { + m_gradientType = wxGRADIENT_LINEAR; + m_x1 = x1; + m_y1 = y1; + m_x2 = x2; + m_y2 = y2; + m_stops.SetStartColour(c1); + m_stops.SetEndColour(c2); + m_matrix = matrix; + return *this; + } + + wxGraphicsPenInfo& + LinearGradient(wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, + const wxGraphicsGradientStops& stops, + const wxGraphicsMatrix& matrix = wxNullGraphicsMatrix) + { + m_gradientType = wxGRADIENT_LINEAR; + m_x1 = x1; + m_y1 = y1; + m_x2 = x2; + m_y2 = y2; + m_stops = stops; + m_matrix = matrix; + return *this; + } + + wxGraphicsPenInfo& + RadialGradient(wxDouble startX, wxDouble startY, + wxDouble endX, wxDouble endY, wxDouble radius, + const wxColour& oColor, const wxColour& cColor, + const wxGraphicsMatrix& matrix = wxNullGraphicsMatrix) + { + m_gradientType = wxGRADIENT_RADIAL; + m_x1 = startX; + m_y1 = startY; + m_x2 = endX; + m_y2 = endY; + m_radius = radius; + m_stops.SetStartColour(oColor); + m_stops.SetEndColour(cColor); + m_matrix = matrix; + return *this; + } + + wxGraphicsPenInfo& + RadialGradient(wxDouble startX, wxDouble startY, + wxDouble endX, wxDouble endY, + wxDouble radius, const wxGraphicsGradientStops& stops, + const wxGraphicsMatrix& matrix = wxNullGraphicsMatrix) + { + m_gradientType = wxGRADIENT_RADIAL; + m_x1 = startX; + m_y1 = startY; + m_x2 = endX; + m_y2 = endY; + m_radius = radius; + m_stops = stops; + m_matrix = matrix; + return *this; + } + + // Accessors + + wxDouble GetWidth() const { return m_width; } + wxGradientType GetGradientType() const { return m_gradientType; } + wxDouble GetX1() const { return m_x1; } + wxDouble GetY1() const { return m_y1; } + wxDouble GetX2() const { return m_x2; } + wxDouble GetY2() const { return m_y2; } + wxDouble GetStartX() const { return m_x1; } + wxDouble GetStartY() const { return m_y1; } + wxDouble GetEndX() const { return m_x2; } + wxDouble GetEndY() const { return m_y2; } + wxDouble GetRadius() const { return m_radius; } + const wxGraphicsGradientStops& GetStops() const { return m_stops; } + const wxGraphicsMatrix& GetMatrix() const { return m_matrix; } + +private: + wxDouble m_width; + wxGradientType m_gradientType; + wxDouble m_x1, m_y1, m_x2, m_y2; // also used for m_xo, m_yo, m_xc, m_yc + wxDouble m_radius; + wxGraphicsGradientStops m_stops; + wxGraphicsMatrix m_matrix; +}; + + + +class WXDLLIMPEXP_CORE wxGraphicsPath : public wxGraphicsObject +{ +public: + wxGraphicsPath() {} + virtual ~wxGraphicsPath() {} + + // + // These are the path primitives from which everything else can be constructed + // + + // begins a new subpath at (x,y) + virtual void MoveToPoint( wxDouble x, wxDouble y ); + void MoveToPoint( const wxPoint2DDouble& p); + + // adds a straight line from the current point to (x,y) + virtual void AddLineToPoint( wxDouble x, wxDouble y ); + void AddLineToPoint( const wxPoint2DDouble& p); + + // adds a cubic Bezier curve from the current point, using two control points and an end point + virtual void AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y ); + void AddCurveToPoint( const wxPoint2DDouble& c1, const wxPoint2DDouble& c2, const wxPoint2DDouble& e); + + // adds another path + virtual void AddPath( const wxGraphicsPath& path ); + + // closes the current sub-path + virtual void CloseSubpath(); + + // gets the last point of the current path, (0,0) if not yet set + virtual void GetCurrentPoint( wxDouble* x, wxDouble* y) const; + wxPoint2DDouble GetCurrentPoint() const; + + // adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle + virtual void AddArc( wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise ); + void AddArc( const wxPoint2DDouble& c, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise); + + // + // These are convenience functions which - if not available natively will be assembled + // using the primitives from above + // + + // adds a quadratic Bezier curve from the current point, using a control point and an end point + virtual void AddQuadCurveToPoint( wxDouble cx, wxDouble cy, wxDouble x, wxDouble y ); + + // appends a rectangle as a new closed subpath + virtual void AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h ); + + // appends an ellipsis as a new closed subpath fitting the passed rectangle + virtual void AddCircle( wxDouble x, wxDouble y, wxDouble r ); + + // appends a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1) + virtual void AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ); + + // appends an ellipse + virtual void AddEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h); + + // appends a rounded rectangle + virtual void AddRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius); + + // returns the native path + virtual void * GetNativePath() const; + + // give the native path returned by GetNativePath() back (there might be some deallocations necessary) + virtual void UnGetNativePath(void *p)const; + + // transforms each point of this path by the matrix + virtual void Transform( const wxGraphicsMatrix& matrix ); + + // gets the bounding box enclosing all points (possibly including control points) + virtual void GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h)const; + wxRect2DDouble GetBox()const; + + virtual bool Contains( wxDouble x, wxDouble y, wxPolygonFillMode fillStyle = wxODDEVEN_RULE)const; + bool Contains( const wxPoint2DDouble& c, wxPolygonFillMode fillStyle = wxODDEVEN_RULE)const; + + const wxGraphicsPathData* GetPathData() const + { return (const wxGraphicsPathData*) GetRefData(); } + wxGraphicsPathData* GetPathData() + { return (wxGraphicsPathData*) GetRefData(); } + +private: + wxDECLARE_DYNAMIC_CLASS(wxGraphicsPath); +}; + +extern WXDLLIMPEXP_DATA_CORE(wxGraphicsPath) wxNullGraphicsPath; + + +class WXDLLIMPEXP_CORE wxGraphicsContext : public wxGraphicsObject +{ +public: + wxGraphicsContext(wxGraphicsRenderer* renderer, wxWindow* window = NULL); + + virtual ~wxGraphicsContext(); + + static wxGraphicsContext* Create( const wxWindowDC& dc); + static wxGraphicsContext * Create( const wxMemoryDC& dc); +#if wxUSE_PRINTING_ARCHITECTURE + static wxGraphicsContext * Create( const wxPrinterDC& dc); +#endif +#ifdef __WXMSW__ +#if wxUSE_ENH_METAFILE + static wxGraphicsContext * Create( const wxEnhMetaFileDC& dc); +#endif +#endif + + // Create a context from a DC of unknown type, if supported, returns NULL otherwise + static wxGraphicsContext* CreateFromUnknownDC(const wxDC& dc); + + static wxGraphicsContext* CreateFromNative( void * context ); + + static wxGraphicsContext* CreateFromNativeWindow( void * window ); + +#ifdef __WXMSW__ + static wxGraphicsContext* CreateFromNativeHDC(WXHDC dc); +#endif + + static wxGraphicsContext* Create( wxWindow* window ); + +#if wxUSE_IMAGE + // Create a context for drawing onto a wxImage. The image life time must be + // greater than that of the context itself as when the context is destroyed + // it will copy its contents to the specified image. + static wxGraphicsContext* Create(wxImage& image); +#endif // wxUSE_IMAGE + + // create a context that can be used for measuring texts only, no drawing allowed + static wxGraphicsContext * Create(); + + // Return the window this context is associated with, if any. + wxWindow* GetWindow() const { return m_window; } + + // begin a new document (relevant only for printing / pdf etc) if there is a progress dialog, message will be shown + virtual bool StartDoc( const wxString& message ); + + // done with that document (relevant only for printing / pdf etc) + virtual void EndDoc(); + + // opens a new page (relevant only for printing / pdf etc) with the given size in points + // (if both are null the default page size will be used) + virtual void StartPage( wxDouble width = 0, wxDouble height = 0 ); + + // ends the current page (relevant only for printing / pdf etc) + virtual void EndPage(); + + // make sure that the current content of this context is immediately visible + virtual void Flush(); + + wxGraphicsPath CreatePath() const; + + wxGraphicsPen CreatePen(const wxPen& pen) const; + + wxGraphicsPen CreatePen(const wxGraphicsPenInfo& info) const + { return DoCreatePen(info); } + + virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) const; + + // sets the brush to a linear gradient, starting at (x1,y1) and ending at + // (x2,y2) with the given boundary colours or the specified stops + wxGraphicsBrush + CreateLinearGradientBrush(wxDouble x1, wxDouble y1, + wxDouble x2, wxDouble y2, + const wxColour& c1, const wxColour& c2, + const wxGraphicsMatrix& matrix = wxNullGraphicsMatrix) const; + wxGraphicsBrush + CreateLinearGradientBrush(wxDouble x1, wxDouble y1, + wxDouble x2, wxDouble y2, + const wxGraphicsGradientStops& stops, + const wxGraphicsMatrix& matrix = wxNullGraphicsMatrix) const; + + // sets the brush to a radial gradient originating at (xo,yc) and ending + // on a circle around (xc,yc) with the given radius; the colours may be + // specified by just the two extremes or the full array of gradient stops + wxGraphicsBrush + CreateRadialGradientBrush(wxDouble startX, wxDouble startY, + wxDouble endX, wxDouble endY, wxDouble radius, + const wxColour& oColor, const wxColour& cColor, + const wxGraphicsMatrix& matrix = wxNullGraphicsMatrix) const; + + wxGraphicsBrush + CreateRadialGradientBrush(wxDouble startX, wxDouble startY, + wxDouble endX, wxDouble endY, wxDouble radius, + const wxGraphicsGradientStops& stops, + const wxGraphicsMatrix& matrix = wxNullGraphicsMatrix) const; + + // creates a font + virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) const; + virtual wxGraphicsFont CreateFont(double sizeInPixels, + const wxString& facename, + int flags = wxFONTFLAG_DEFAULT, + const wxColour& col = *wxBLACK) const; + + // create a native bitmap representation + virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) const; +#if wxUSE_IMAGE + wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image) const; +#endif // wxUSE_IMAGE + + // create a native bitmap representation + virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) const; + + // create a 'native' matrix corresponding to these values + virtual wxGraphicsMatrix CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, + wxDouble tx=0.0, wxDouble ty=0.0) const; + + wxGraphicsMatrix CreateMatrix( const wxAffineMatrix2DBase& mat ) const + { + wxMatrix2D mat2D; + wxPoint2DDouble tr; + mat.Get(&mat2D, &tr); + + return CreateMatrix(mat2D.m_11, mat2D.m_12, mat2D.m_21, mat2D.m_22, + tr.m_x, tr.m_y); + } + + // push the current state of the context, ie the transformation matrix on a stack + virtual void PushState() = 0; + + // pops a stored state from the stack + virtual void PopState() = 0; + + // clips drawings to the region intersected with the current clipping region + virtual void Clip( const wxRegion ®ion ) = 0; + + // clips drawings to the rect intersected with the current clipping region + virtual void Clip( wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0; + + // resets the clipping to original extent + virtual void ResetClip() = 0; + + // returns bounding box of the clipping region + virtual void GetClipBox(wxDouble* x, wxDouble* y, wxDouble* w, wxDouble* h) = 0; + + // returns the native context + virtual void * GetNativeContext() = 0; + + // returns the current shape antialiasing mode + virtual wxAntialiasMode GetAntialiasMode() const { return m_antialias; } + + // sets the antialiasing mode, returns true if it supported + virtual bool SetAntialiasMode(wxAntialiasMode antialias) = 0; + + // returns the current interpolation quality + virtual wxInterpolationQuality GetInterpolationQuality() const { return m_interpolation; } + + // sets the interpolation quality, returns true if it supported + virtual bool SetInterpolationQuality(wxInterpolationQuality interpolation) = 0; + + // returns the current compositing operator + virtual wxCompositionMode GetCompositionMode() const { return m_composition; } + + // sets the compositing operator, returns true if it supported + virtual bool SetCompositionMode(wxCompositionMode op) = 0; + + // returns the size of the graphics context in device coordinates + void GetSize(wxDouble* width, wxDouble* height) const + { + if ( width ) + *width = m_width; + if ( height ) + *height = m_height; + } + + // returns the resolution of the graphics context in device points per inch + virtual void GetDPI( wxDouble* dpiX, wxDouble* dpiY) const; + + wxSize FromDIP(const wxSize& sz) const; + wxPoint FromDIP(const wxPoint& pt) const + { + const wxSize sz = FromDIP(wxSize(pt.x, pt.y)); + return wxPoint(sz.x, sz.y); + } + int FromDIP(int d) const + { + return FromDIP(wxSize(d, 0)).x; + } + + wxSize ToDIP(const wxSize& sz) const; + wxPoint ToDIP(const wxPoint& pt) const + { + const wxSize sz = ToDIP(wxSize(pt.x, pt.y)); + return wxPoint(sz.x, sz.y); + } + int ToDIP(int d) const + { + return ToDIP(wxSize(d, 0)).x; + } + +#if 0 + // sets the current alpha on this context + virtual void SetAlpha( wxDouble alpha ); + + // returns the alpha on this context + virtual wxDouble GetAlpha() const; +#endif + + // all rendering is done into a fully transparent temporary context + virtual void BeginLayer(wxDouble opacity) = 0; + + // composites back the drawings into the context with the opacity given at + // the BeginLayer call + virtual void EndLayer() = 0; + + // + // transformation : changes the current transformation matrix CTM of the context + // + + // translate + virtual void Translate( wxDouble dx , wxDouble dy ) = 0; + + // scale + virtual void Scale( wxDouble xScale , wxDouble yScale ) = 0; + + // rotate (radians) + virtual void Rotate( wxDouble angle ) = 0; + + // concatenates this transform with the current transform of this context + virtual void ConcatTransform( const wxGraphicsMatrix& matrix ) = 0; + + // sets the transform of this context + virtual void SetTransform( const wxGraphicsMatrix& matrix ) = 0; + + // gets the matrix of this context + virtual wxGraphicsMatrix GetTransform() const = 0; + // + // setting the paint + // + + // sets the pen + virtual void SetPen( const wxGraphicsPen& pen ); + + void SetPen( const wxPen& pen ); + + // sets the brush for filling + virtual void SetBrush( const wxGraphicsBrush& brush ); + + void SetBrush( const wxBrush& brush ); + + // sets the font + virtual void SetFont( const wxGraphicsFont& font ); + + void SetFont( const wxFont& font, const wxColour& colour ); + + + // strokes along a path with the current pen + virtual void StrokePath( const wxGraphicsPath& path ) = 0; + + // fills a path with the current brush + virtual void FillPath( const wxGraphicsPath& path, wxPolygonFillMode fillStyle = wxODDEVEN_RULE ) = 0; + + // draws a path by first filling and then stroking + virtual void DrawPath( const wxGraphicsPath& path, wxPolygonFillMode fillStyle = wxODDEVEN_RULE ); + + // paints a transparent rectangle (only useful for bitmaps or windows) + virtual void ClearRectangle(wxDouble x, wxDouble y, wxDouble w, wxDouble h); + + // + // text + // + + void DrawText( const wxString &str, wxDouble x, wxDouble y ) + { DoDrawText(str, x, y); } + + void DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle ) + { DoDrawRotatedText(str, x, y, angle); } + + void DrawText( const wxString &str, wxDouble x, wxDouble y, + const wxGraphicsBrush& backgroundBrush ) + { DoDrawFilledText(str, x, y, backgroundBrush); } + + void DrawText( const wxString &str, wxDouble x, wxDouble y, + wxDouble angle, const wxGraphicsBrush& backgroundBrush ) + { DoDrawRotatedFilledText(str, x, y, angle, backgroundBrush); } + + + virtual void GetTextExtent( const wxString &text, wxDouble *width, wxDouble *height, + wxDouble *descent = NULL, wxDouble *externalLeading = NULL ) const = 0; + + virtual void GetPartialTextExtents(const wxString& text, wxArrayDouble& widths) const = 0; + + // + // image support + // + + virtual void DrawBitmap( const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0; + + virtual void DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0; + + virtual void DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0; + + // + // convenience methods + // + + // strokes a single line + virtual void StrokeLine( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2); + + // stroke lines connecting each of the points + virtual void StrokeLines( size_t n, const wxPoint2DDouble *points); + + // stroke disconnected lines from begin to end points + virtual void StrokeLines( size_t n, const wxPoint2DDouble *beginPoints, const wxPoint2DDouble *endPoints); + + // draws a polygon + virtual void DrawLines( size_t n, const wxPoint2DDouble *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE ); + + // draws a rectangle + virtual void DrawRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h); + + // draws an ellipse + virtual void DrawEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h); + + // draws a rounded rectangle + virtual void DrawRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius); + + // wrappers using wxPoint2DDouble TODO + + // helper to determine if a 0.5 offset should be applied for the drawing operation + virtual bool ShouldOffset() const { return false; } + + // indicates whether the context should try to offset for pixel boundaries, this only makes sense on + // bitmap devices like screen, by default this is turned off + virtual void EnableOffset(bool enable = true); + + void DisableOffset() { EnableOffset(false); } + bool OffsetEnabled() const { return m_enableOffset; } + + void SetContentScaleFactor(double contentScaleFactor); + double GetContentScaleFactor() const { return m_contentScaleFactor; } + +#ifdef __WXMSW__ + virtual WXHDC GetNativeHDC() = 0; + virtual void ReleaseNativeHDC(WXHDC hdc) = 0; +#endif + +protected: + // These fields must be initialized in the derived class ctors. + wxDouble m_width, + m_height; + + wxGraphicsPen m_pen; + wxGraphicsBrush m_brush; + wxGraphicsFont m_font; + wxAntialiasMode m_antialias; + wxCompositionMode m_composition; + wxInterpolationQuality m_interpolation; + bool m_enableOffset; + +protected: + // implementations of overloaded public functions: we use different names + // for them to avoid the virtual function hiding problems in the derived + // classes + virtual wxGraphicsPen DoCreatePen(const wxGraphicsPenInfo& info) const; + + virtual void DoDrawText(const wxString& str, wxDouble x, wxDouble y) = 0; + virtual void DoDrawRotatedText(const wxString& str, wxDouble x, wxDouble y, + wxDouble angle); + virtual void DoDrawFilledText(const wxString& str, wxDouble x, wxDouble y, + const wxGraphicsBrush& backgroundBrush); + virtual void DoDrawRotatedFilledText(const wxString& str, + wxDouble x, wxDouble y, + wxDouble angle, + const wxGraphicsBrush& backgroundBrush); + +private: + // The associated window, if any, i.e. if one was passed directly to + // Create() or the associated window of the wxDC this context was created + // from. + wxWindow* const m_window; + double m_contentScaleFactor; + + wxDECLARE_NO_COPY_CLASS(wxGraphicsContext); + wxDECLARE_ABSTRACT_CLASS(wxGraphicsContext); +}; + +#if 0 + +// +// A graphics figure allows to cache path, pen etc creations, also will be a basis for layering/grouping elements +// + +class WXDLLIMPEXP_CORE wxGraphicsFigure : public wxGraphicsObject +{ +public: + wxGraphicsFigure(wxGraphicsRenderer* renderer); + + virtual ~wxGraphicsFigure(); + + void SetPath( wxGraphicsMatrix* matrix ); + + void SetMatrix( wxGraphicsPath* path); + + // draws this object on the context + virtual void Draw( wxGraphicsContext* cg ); + + // returns the path of this object + wxGraphicsPath* GetPath() { return m_path; } + + // returns the transformation matrix of this object, may be null if there is no transformation necessary + wxGraphicsMatrix* GetMatrix() { return m_matrix; } + +private: + wxGraphicsMatrix* m_matrix; + wxGraphicsPath* m_path; + + wxDECLARE_DYNAMIC_CLASS(wxGraphicsFigure); +}; + +#endif + +// +// The graphics renderer is the instance corresponding to the rendering engine used, eg there is ONE core graphics renderer +// instance on OSX. This instance is pointed back to by all objects created by it. Therefore you can create eg additional +// paths at any point from a given matrix etc. +// + +class WXDLLIMPEXP_CORE wxGraphicsRenderer : public wxObject +{ +public: + wxGraphicsRenderer() {} + + virtual ~wxGraphicsRenderer() {} + + static wxGraphicsRenderer* GetDefaultRenderer(); + + static wxGraphicsRenderer* GetCairoRenderer(); + +#ifdef __WXMSW__ +#if wxUSE_GRAPHICS_GDIPLUS + static wxGraphicsRenderer* GetGDIPlusRenderer(); +#endif + +#if wxUSE_GRAPHICS_DIRECT2D + static wxGraphicsRenderer* GetDirect2DRenderer(); +#endif +#endif + + // Context + + virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc) = 0; + virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc) = 0; +#if wxUSE_PRINTING_ARCHITECTURE + virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc) = 0; +#endif +#ifdef __WXMSW__ +#if wxUSE_ENH_METAFILE + virtual wxGraphicsContext * CreateContext( const wxEnhMetaFileDC& dc) = 0; +#endif +#endif + + wxGraphicsContext* CreateContextFromUnknownDC(const wxDC& dc); + + virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ) = 0; + + virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window ) = 0; + +#ifdef __WXMSW__ + virtual wxGraphicsContext * CreateContextFromNativeHDC(WXHDC dc) = 0; +#endif + + virtual wxGraphicsContext * CreateContext( wxWindow* window ) = 0; + +#if wxUSE_IMAGE + virtual wxGraphicsContext * CreateContextFromImage(wxImage& image) = 0; +#endif // wxUSE_IMAGE + + // create a context that can be used for measuring texts only, no drawing allowed + virtual wxGraphicsContext * CreateMeasuringContext() = 0; + + // Path + + virtual wxGraphicsPath CreatePath() = 0; + + // Matrix + + virtual wxGraphicsMatrix CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, + wxDouble tx=0.0, wxDouble ty=0.0) = 0; + + // Paints + + virtual wxGraphicsPen CreatePen(const wxGraphicsPenInfo& info) = 0; + + virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) = 0; + + // Gradient brush creation functions may not honour all the stops specified + // stops and use just its boundary colours (this is currently the case + // under OS X) + virtual wxGraphicsBrush + CreateLinearGradientBrush(wxDouble x1, wxDouble y1, + wxDouble x2, wxDouble y2, + const wxGraphicsGradientStops& stops, + const wxGraphicsMatrix& matrix = wxNullGraphicsMatrix) = 0; + + virtual wxGraphicsBrush + CreateRadialGradientBrush(wxDouble startX, wxDouble startY, + wxDouble endX, wxDouble endY, + wxDouble radius, + const wxGraphicsGradientStops& stops, + const wxGraphicsMatrix& matrix = wxNullGraphicsMatrix) = 0; + + // sets the font + virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) = 0; + virtual wxGraphicsFont CreateFont(double sizeInPixels, + const wxString& facename, + int flags = wxFONTFLAG_DEFAULT, + const wxColour& col = *wxBLACK) = 0; + virtual wxGraphicsFont CreateFontAtDPI(const wxFont& font, + const wxRealPoint& dpi, + const wxColour& col = *wxBLACK) = 0; + + // create a native bitmap representation + virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) = 0; +#if wxUSE_IMAGE + virtual wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image) = 0; + virtual wxImage CreateImageFromBitmap(const wxGraphicsBitmap& bmp) = 0; +#endif // wxUSE_IMAGE + + // create a graphics bitmap from a native bitmap + virtual wxGraphicsBitmap CreateBitmapFromNativeBitmap( void* bitmap ) = 0; + + // create a subimage from a native image representation + virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0; + + virtual wxString GetName() const = 0; + virtual void + GetVersion(int* major, int* minor = NULL, int* micro = NULL) const = 0; + +private: + wxDECLARE_NO_COPY_CLASS(wxGraphicsRenderer); + wxDECLARE_ABSTRACT_CLASS(wxGraphicsRenderer); +}; + + +#if wxUSE_IMAGE +inline +wxImage wxGraphicsBitmap::ConvertToImage() const +{ + wxGraphicsRenderer* renderer = GetRenderer(); + return renderer ? renderer->CreateImageFromBitmap(*this) : wxNullImage; +} +#endif // wxUSE_IMAGE + +#endif // wxUSE_GRAPHICS_CONTEXT + +#endif // _WX_GRAPHICS_H_ diff --git a/lib/wxWidgets/include/wx/grid.h b/lib/wxWidgets/include/wx/grid.h new file mode 100644 index 0000000..0205565 --- /dev/null +++ b/lib/wxWidgets/include/wx/grid.h @@ -0,0 +1,21 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/grid.h +// Purpose: wxGrid base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GRID_H_BASE_ +#define _WX_GRID_H_BASE_ + +#include "wx/generic/grid.h" + +// these headers used to be included from the above header but isn't any more, +// still do it from here for compatibility +#include "wx/generic/grideditors.h" +#include "wx/generic/gridctrl.h" + +#endif // _WX_GRID_H_BASE_ diff --git a/lib/wxWidgets/include/wx/gtk/accel.h b/lib/wxWidgets/include/wx/gtk/accel.h new file mode 100644 index 0000000..09ffb61 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/accel.h @@ -0,0 +1,14 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/accel.h +// Purpose: wxAcceleratorTable redirection file +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// VZ: keeping the old file just in case we're going to have a native GTK+ +// wxAcceleratorTable implementation one day, but for now use the generic +// version +#include "wx/generic/accel.h" diff --git a/lib/wxWidgets/include/wx/gtk/activityindicator.h b/lib/wxWidgets/include/wx/gtk/activityindicator.h new file mode 100644 index 0000000..72889df --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/activityindicator.h @@ -0,0 +1,66 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/activityindicator.h +// Purpose: Declaration of wxActivityIndicator for wxGTK. +// Author: Vadim Zeitlin +// Created: 2015-03-05 +// Copyright: (c) 2015 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_ACTIVITYINDICATOR_H_ +#define _WX_GTK_ACTIVITYINDICATOR_H_ + +// With GTK+ 3 we can always be certain that this control is available, so use +// the normal base class. With GTK+ 2 however, we may determine during run-time +// that we need to fall back to the generic implementation because the GTK+ +// version is earlier than 2.20, so we need to inherit from the generic class. +#ifdef __WXGTK3__ + #define wxActivityIndicatorGtkBase wxActivityIndicatorBase +#else + #include "wx/generic/activityindicator.h" + + #define wxActivityIndicatorGtkBase wxActivityIndicatorGeneric +#endif + +// ---------------------------------------------------------------------------- +// wxActivityIndicator: implementation using GtkSpinner. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxActivityIndicator : public wxActivityIndicatorGtkBase +{ +public: + wxActivityIndicator() + { + } + + explicit + wxActivityIndicator(wxWindow* parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxActivityIndicatorNameStr) + { + Create(parent, winid, pos, size, style, name); + } + + bool Create(wxWindow* parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxActivityIndicatorNameStr); + + virtual void Start() wxOVERRIDE; + virtual void Stop() wxOVERRIDE; + virtual bool IsRunning() const wxOVERRIDE; + +protected: + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxActivityIndicator); + wxDECLARE_NO_COPY_CLASS(wxActivityIndicator); +}; + +#endif // _WX_GTK_ACTIVITYINDICATOR_H_ diff --git a/lib/wxWidgets/include/wx/gtk/animate.h b/lib/wxWidgets/include/wx/gtk/animate.h new file mode 100644 index 0000000..c1fc331 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/animate.h @@ -0,0 +1,103 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/animate.h +// Purpose: Animation classes +// 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_GTKANIMATEH__ +#define _WX_GTKANIMATEH__ + +typedef struct _GdkPixbufAnimation GdkPixbufAnimation; +typedef struct _GdkPixbufAnimationIter GdkPixbufAnimationIter; + +// ---------------------------------------------------------------------------- +// wxAnimationCtrl +// ---------------------------------------------------------------------------- + +// Resize to animation size if this is set +#define wxAN_FIT_ANIMATION 0x0010 + +class WXDLLIMPEXP_ADV wxAnimationCtrl: public wxAnimationCtrlBase +{ +public: + wxAnimationCtrl() { Init(); } + wxAnimationCtrl(wxWindow *parent, + wxWindowID id, + const wxAnimation& anim = wxNullAnimation, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxAC_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxAnimationCtrlNameStr)) + { + Init(); + + Create(parent, id, anim, pos, size, style, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxAnimation& anim = wxNullAnimation, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxAC_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxAnimationCtrlNameStr)); + + ~wxAnimationCtrl(); + +public: // event handler + + void OnTimer(wxTimerEvent &); + +public: // public API + + virtual bool LoadFile(const wxString& filename, wxAnimationType type = wxANIMATION_TYPE_ANY) wxOVERRIDE; + virtual bool Load(wxInputStream& stream, wxAnimationType type = wxANIMATION_TYPE_ANY) wxOVERRIDE; + + void SetAnimation(const wxAnimation &anim) wxOVERRIDE; + + virtual bool Play() wxOVERRIDE; + virtual void Stop() wxOVERRIDE; + + virtual bool IsPlaying() const wxOVERRIDE; + + bool SetBackgroundColour( const wxColour &colour ) wxOVERRIDE; + + static wxAnimation CreateCompatibleAnimation(); + +protected: + virtual wxAnimationImpl* DoCreateAnimationImpl() const wxOVERRIDE; + + virtual void DisplayStaticImage() wxOVERRIDE; + virtual wxSize DoGetBestSize() const wxOVERRIDE; + void FitToAnimation(); + void ClearToBackgroundColour(); + + void ResetAnim(); + void ResetIter(); + + // Helpers to safely access methods in the wxAnimationGTKImpl that are + // specific to the gtk implementation + GdkPixbufAnimation *AnimationImplGetPixbuf() const; + void AnimationImplSetPixbuf(GdkPixbufAnimation* p); + +protected: // internal vars + + GdkPixbufAnimation *m_anim; + GdkPixbufAnimationIter *m_iter; + + wxTimer m_timer; + bool m_bPlaying; + +private: + typedef wxAnimationCtrlBase base_type; + + void Init(); + + wxDECLARE_DYNAMIC_CLASS(wxAnimationCtrl); + wxDECLARE_EVENT_TABLE(); +}; + +#endif // _WX_GTKANIMATEH__ diff --git a/lib/wxWidgets/include/wx/gtk/anybutton.h b/lib/wxWidgets/include/wx/gtk/anybutton.h new file mode 100644 index 0000000..d62e849 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/anybutton.h @@ -0,0 +1,80 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/anybutton.h +// Purpose: wxGTK wxAnyButton class declaration +// Author: Robert Roebling +// Created: 1998-05-20 (extracted from button.h) +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_ANYBUTTON_H_ +#define _WX_GTK_ANYBUTTON_H_ + +//----------------------------------------------------------------------------- +// wxAnyButton +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxAnyButton : public wxAnyButtonBase +{ +public: + wxAnyButton() + { + m_isCurrent = + m_isPressed = false; + } + + // implementation + // -------------- + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // called from GTK callbacks: they update the button state and call + // GTKUpdateBitmap() + void GTKMouseEnters(); + void GTKMouseLeaves(); + void GTKPressed(); + void GTKReleased(); + +protected: + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; + + virtual void DoEnable(bool enable) wxOVERRIDE; + + virtual wxBitmap DoGetBitmap(State which) const wxOVERRIDE; + virtual void DoSetBitmap(const wxBitmapBundle& bitmap, State which) wxOVERRIDE; + virtual void DoSetBitmapPosition(wxDirection dir) wxOVERRIDE; + + // update the bitmap to correspond to the current button state + void GTKUpdateBitmap(); + +private: + typedef wxAnyButtonBase base_type; + + // focus event handler: calls GTKUpdateBitmap() + void GTKOnFocus(wxFocusEvent& event); + + // return the state whose bitmap is being currently shown (so this is + // different from the real current state, e.g. it could be State_Normal + // even if the button is pressed if no button was set for State_Pressed) + State GTKGetCurrentBitmapState() const; + + // show the given bitmap (must be valid) + void GTKDoShowBitmap(const wxBitmapBundle& bitmap); + + + // the bitmaps for the different state of the buttons, all of them may be + // invalid and the button only shows a bitmap at all if State_Normal bitmap + // is valid + wxBitmapBundle m_bitmaps[State_Max]; + + // true iff mouse is currently over the button + bool m_isCurrent; + + // true iff the button is in pressed state + bool m_isPressed; + + wxDECLARE_NO_COPY_CLASS(wxAnyButton); +}; + +#endif // _WX_GTK_ANYBUTTON_H_ diff --git a/lib/wxWidgets/include/wx/gtk/app.h b/lib/wxWidgets/include/wx/gtk/app.h new file mode 100644 index 0000000..a14ff74 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/app.h @@ -0,0 +1,95 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/app.h +// Purpose: wxApp definition for wxGTK +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling, Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_APP_H_ +#define _WX_GTK_APP_H_ + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// wxApp +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxApp: public wxAppBase +{ +public: + wxApp(); + virtual ~wxApp(); + + /* override for altering the way wxGTK initializes the GUI + * (palette/visual/colorcube). under wxMSW, OnInitGui() does nothing by + * default. when overriding this method, the code in it is likely to be + * platform dependent, otherwise use OnInit(). */ + virtual bool SetNativeTheme(const wxString& theme) wxOVERRIDE; + virtual bool OnInitGui() wxOVERRIDE; + + // override base class (pure) virtuals + virtual void WakeUpIdle() wxOVERRIDE; + + virtual bool Initialize(int& argc, wxChar **argv) wxOVERRIDE; + virtual void CleanUp() wxOVERRIDE; + + virtual void OnAssertFailure(const wxChar *file, + int line, + const wxChar *func, + const wxChar *cond, + const wxChar *msg) wxOVERRIDE; + + // GTK-specific methods + // ------------------- + + // this can be overridden to return a specific visual to be used for GTK+ + // instead of the default one (it's used by wxGLApp) + // + // must return XVisualInfo pointer (it is not freed by caller) + virtual void *GetXVisualInfo() { return NULL; } + + // Check if we're using a global menu. Currently this is only true when + // running under Ubuntu Unity and global menu is not disabled. + // + // This is mostly used in the implementation in order to work around + // various bugs arising due to this. + static bool GTKIsUsingGlobalMenu(); + + // Provide the ability to suppress GTK output. By default, all output + // will be suppressed, but the user can pass in a mask specifying the + // types of messages to suppress. Flags are defined by glib with the + // GLogLevelFlags enum. + static void GTKSuppressDiagnostics(int flags = -1); + +#if wxABI_VERSION >= 30201 + // Allow wxWidgets to control GTK diagnostics. This is recommended because + // it prevents spurious GTK messages from appearing, but can't be done by + // default because it would result in a fatal error if the application + // calls g_log_set_writer_func() itself. + static void GTKAllowDiagnosticsControl(); +#endif // wxABI_VERSION >= 3.2.1 + + + // implementation only from now on + // ------------------------------- + + // check for pending events, without interference from our idle source + bool EventsPending(); + bool DoIdle(); + +private: + // true if we're inside an assert modal dialog + bool m_isInAssert; + +#if wxUSE_THREADS + wxMutex m_idleMutex; +#endif + unsigned m_idleSourceId; + + wxDECLARE_DYNAMIC_CLASS(wxApp); +}; + +#endif // _WX_GTK_APP_H_ diff --git a/lib/wxWidgets/include/wx/gtk/assertdlg_gtk.h b/lib/wxWidgets/include/wx/gtk/assertdlg_gtk.h new file mode 100644 index 0000000..098e9b1 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/assertdlg_gtk.h @@ -0,0 +1,77 @@ +/* /////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/assertdlg_gtk.h +// Purpose: GtkAssertDialog +// Author: Francesco Montorsi +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////// */ + +#ifndef _WX_GTK_ASSERTDLG_H_ +#define _WX_GTK_ASSERTDLG_H_ + +#define GTK_TYPE_ASSERT_DIALOG (gtk_assert_dialog_get_type ()) +#define GTK_ASSERT_DIALOG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_ASSERT_DIALOG, GtkAssertDialog)) +#define GTK_ASSERT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ASSERT_DIALOG, GtkAssertDialogClass)) +#define GTK_IS_ASSERT_DIALOG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GTK_TYPE_ASSERT_DIALOG)) +#define GTK_IS_ASSERT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ASSERT_DIALOG)) +#define GTK_ASSERT_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ASSERT_DIALOG, GtkAssertDialogClass)) + +typedef struct _GtkAssertDialog GtkAssertDialog; +typedef struct _GtkAssertDialogClass GtkAssertDialogClass; +typedef void (*GtkAssertDialogStackFrameCallback)(void *); + +struct _GtkAssertDialog +{ + GtkDialog parent_instance; + + /* GtkAssertDialog widgets */ + GtkWidget *expander; + GtkWidget *message; + GtkWidget *treeview; + + GtkWidget *shownexttime; + + /* callback for processing the stack frame */ + GtkAssertDialogStackFrameCallback callback; + void *userdata; +}; + +struct _GtkAssertDialogClass +{ + GtkDialogClass parent_class; +}; + +typedef enum +{ + GTK_ASSERT_DIALOG_STOP, + GTK_ASSERT_DIALOG_CONTINUE, + GTK_ASSERT_DIALOG_CONTINUE_SUPPRESSING +} GtkAssertDialogResponseID; + + + + +GType gtk_assert_dialog_get_type(void); +GtkWidget *gtk_assert_dialog_new(void); + +/* get the assert message */ +gchar *gtk_assert_dialog_get_message(GtkAssertDialog *assertdlg); + +/* set the assert message */ +void gtk_assert_dialog_set_message(GtkAssertDialog *assertdlg, const gchar *msg); + +/* get a string containing all stack frames appended to the dialog */ +gchar *gtk_assert_dialog_get_backtrace(GtkAssertDialog *assertdlg); + +/* sets the callback to use when the user wants to see the stackframe */ +void gtk_assert_dialog_set_backtrace_callback(GtkAssertDialog *assertdlg, + GtkAssertDialogStackFrameCallback callback, + void *userdata); + +/* appends a stack frame to the dialog */ +void gtk_assert_dialog_append_stack_frame(GtkAssertDialog *dlg, + const gchar *function, + const gchar *sourcefile, + guint line_number); + +#endif /* _WX_GTK_ASSERTDLG_H_ */ diff --git a/lib/wxWidgets/include/wx/gtk/bitmap.h b/lib/wxWidgets/include/wx/gtk/bitmap.h new file mode 100644 index 0000000..fa6c55f --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/bitmap.h @@ -0,0 +1,192 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/bitmap.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_BITMAP_H_ +#define _WX_GTK_BITMAP_H_ + +#ifdef __WXGTK3__ +typedef struct _cairo cairo_t; +typedef struct _cairo_surface cairo_surface_t; +#endif +typedef struct _GdkPixbuf GdkPixbuf; + +//----------------------------------------------------------------------------- +// wxMask +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMask: public wxMaskBase +{ +public: + wxMask(); + wxMask(const wxMask& mask); + wxMask( const wxBitmap& bitmap, const wxColour& colour ); +#if wxUSE_PALETTE + wxMask( const wxBitmap& bitmap, int paletteIndex ); +#endif // wxUSE_PALETTE + wxMask( const wxBitmap& bitmap ); + virtual ~wxMask(); + wxBitmap GetBitmap() const; + + // implementation +#ifdef __WXGTK3__ + wxMask(cairo_surface_t*); + operator cairo_surface_t*() const; +#else + wxMask(GdkPixmap*); + operator GdkPixmap*() const; +#endif + +protected: + virtual void FreeData() wxOVERRIDE; + virtual bool InitFromColour(const wxBitmap& bitmap, const wxColour& colour) wxOVERRIDE; + virtual bool InitFromMonoBitmap(const wxBitmap& bitmap) wxOVERRIDE; + +private: +#ifdef __WXGTK3__ + cairo_surface_t* m_bitmap; +#else + GdkPixmap* m_bitmap; +#endif + + wxDECLARE_DYNAMIC_CLASS(wxMask); +}; + +//----------------------------------------------------------------------------- +// wxBitmap +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase +{ +public: + wxBitmap() { } + wxBitmap( int width, int height, int depth = wxBITMAP_SCREEN_DEPTH ) + { Create(width, height, depth); } + wxBitmap( const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH ) + { Create(sz, depth); } + wxBitmap( int width, int height, const wxDC& dc ) + { Create(width, height, dc); } + wxBitmap( const char bits[], int width, int height, int depth = 1 ); + wxBitmap( const char* const* bits ); + wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE ); +#if wxUSE_IMAGE + wxBitmap(const wxImage& image, int depth = wxBITMAP_SCREEN_DEPTH, double scale = 1.0); + wxBitmap(const wxImage& image, const wxDC& dc); +#endif // wxUSE_IMAGE + wxBitmap(GdkPixbuf* pixbuf, int depth = 0); + explicit wxBitmap(const wxCursor& cursor); + + wxDECLARE_DEFAULT_COPY(wxBitmap) + + virtual ~wxBitmap(); + + bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH) wxOVERRIDE; + bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) wxOVERRIDE + { return Create(sz.GetWidth(), sz.GetHeight(), depth); } +#ifdef __WXGTK3__ + bool Create(int width, int height, const wxDC& dc); + virtual void SetScaleFactor(double scale) wxOVERRIDE; + virtual double GetScaleFactor() const wxOVERRIDE; +#else + bool Create(int width, int height, const wxDC& WXUNUSED(dc)) + { return Create(width,height); } +#endif + + virtual int GetHeight() const wxOVERRIDE; + virtual int GetWidth() const wxOVERRIDE; + virtual int GetDepth() const wxOVERRIDE; + +#if wxUSE_IMAGE + wxImage ConvertToImage() const wxOVERRIDE; +#endif // wxUSE_IMAGE + + wxMask *GetMask() const wxOVERRIDE; + void SetMask( wxMask *mask ) wxOVERRIDE; + + wxBitmap GetSubBitmap( const wxRect& rect ) const wxOVERRIDE; + + bool SaveFile(const wxString &name, wxBitmapType type, + const wxPalette *palette = NULL) const wxOVERRIDE; + bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE) wxOVERRIDE; + +#if wxUSE_PALETTE + wxPalette *GetPalette() const wxOVERRIDE; + void SetPalette(const wxPalette& palette) wxOVERRIDE; + wxPalette *GetColourMap() const { return GetPalette(); } +#endif // wxUSE_PALETTE + + static void InitStandardHandlers(); + + // implementation + // -------------- + +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED(void SetHeight( int height ) wxOVERRIDE); + wxDEPRECATED(void SetWidth( int width ) wxOVERRIDE); + wxDEPRECATED(void SetDepth( int depth ) wxOVERRIDE); +#endif + +#ifdef __WXGTK3__ + cairo_t* CairoCreate() const; + void Draw(cairo_t* cr, int x, int y, bool useMask = true, const wxColour* fg = NULL, const wxColour* bg = NULL) const; + void SetSourceSurface(cairo_t* cr, int x, int y, const wxColour* fg = NULL, const wxColour* bg = NULL) const; + wxBitmap CreateDisabled() const; +#else + GdkPixmap *GetPixmap() const; + bool HasPixmap() const; + bool HasPixbuf() const; + wxBitmap(GdkPixmap* pixmap); +#endif + GdkPixbuf* GetPixbufNoMask() const; + GdkPixbuf *GetPixbuf() const; + + // raw bitmap access support functions + void *GetRawData(wxPixelDataBase& data, int bpp); + void UngetRawData(wxPixelDataBase& data); + + bool HasAlpha() const wxOVERRIDE; + +protected: +#if wxUSE_IMAGE + void InitFromImage(const wxImage& image, int depth, double scale); +#ifndef __WXGTK3__ + bool CreateFromImage(const wxImage& image, int depth); +#endif +#endif // wxUSE_IMAGE + + virtual wxGDIRefData* CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData* CloneGDIRefData(const wxGDIRefData* data) const wxOVERRIDE; + +#ifdef __WXGTK3__ + virtual bool DoCreate(const wxSize& sz, double scale, int depth) wxOVERRIDE; +#endif + +private: +#ifndef __WXGTK3__ + void SetPixmap(GdkPixmap* pixmap); +#if wxUSE_IMAGE + // to be called from CreateFromImage only! + bool CreateFromImageAsPixmap(const wxImage& image, int depth); + bool CreateFromImageAsPixbuf(const wxImage& image); +#endif // wxUSE_IMAGE + +public: + // implementation only + enum Representation + { + Pixmap, + Pixbuf + }; + // removes other representations from memory, keeping only 'keep' + // (wxBitmap may keep same bitmap e.g. as both pixmap and pixbuf): + void PurgeOtherRepresentations(Representation keep); +#endif + + wxDECLARE_DYNAMIC_CLASS(wxBitmap); +}; + +#endif // _WX_GTK_BITMAP_H_ diff --git a/lib/wxWidgets/include/wx/gtk/bmpbuttn.h b/lib/wxWidgets/include/wx/gtk/bmpbuttn.h new file mode 100644 index 0000000..37d7d31 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/bmpbuttn.h @@ -0,0 +1,49 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/bmpbutton.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_BMPBUTTON_H_ +#define _WX_GTK_BMPBUTTON_H_ + +// ---------------------------------------------------------------------------- +// wxBitmapButton +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBitmapButton : public wxBitmapButtonBase +{ +public: + wxBitmapButton() { } + + wxBitmapButton(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)) + { + Create(parent, id, bitmap, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)); + + bool CreateCloseButton(wxWindow* parent, + wxWindowID winid, + const wxString& name = wxString()); +private: + wxDECLARE_DYNAMIC_CLASS(wxBitmapButton); +}; + +#endif // _WX_GTK_BMPBUTTON_H_ diff --git a/lib/wxWidgets/include/wx/gtk/bmpcbox.h b/lib/wxWidgets/include/wx/gtk/bmpcbox.h new file mode 100644 index 0000000..ca62709 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/bmpcbox.h @@ -0,0 +1,146 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/bmpcbox.h +// Purpose: wxBitmapComboBox +// Author: Jaakko Salli +// Created: 2008-05-19 +// Copyright: (c) 2008 Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_BMPCBOX_H_ +#define _WX_GTK_BMPCBOX_H_ + + +#include "wx/combobox.h" + +// ---------------------------------------------------------------------------- +// wxBitmapComboBox: a wxComboBox that allows images to be shown +// in front of string items. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxBitmapComboBox : public wxComboBox, + public wxBitmapComboBoxBase +{ +public: + // ctors and such + wxBitmapComboBox() : wxComboBox(), wxBitmapComboBoxBase() + { + Init(); + } + + wxBitmapComboBox(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, + const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr)) + : wxComboBox(), + wxBitmapComboBoxBase() + { + Init(); + + (void)Create(parent, id, value, pos, size, n, + choices, style, validator, name); + } + + wxBitmapComboBox(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + int n, + const wxString choices[], + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr)); + + virtual ~wxBitmapComboBox(); + + // Sets the image for the given item. + virtual void SetItemBitmap(unsigned int n, const wxBitmapBundle& bitmap) wxOVERRIDE; + + // Returns the image of the item with the given index. + virtual wxBitmap GetItemBitmap(unsigned int n) const wxOVERRIDE; + + // Returns size of the image used in list + virtual wxSize GetBitmapSize() const wxOVERRIDE + { + return m_bitmapSize; + } + + // Adds item with image to the end of the combo box. + int Append(const wxString& item, const wxBitmapBundle& bitmap = wxBitmapBundle()); + int Append(const wxString& item, const wxBitmapBundle& bitmap, void *clientData); + int Append(const wxString& item, const wxBitmapBundle& bitmap, wxClientData *clientData); + + // Inserts item with image into the list before pos. Not valid for wxCB_SORT + // styles, use Append instead. + int Insert(const wxString& item, const wxBitmapBundle& bitmap, unsigned int pos); + int Insert(const wxString& item, const wxBitmapBundle& bitmap, + unsigned int pos, void *clientData); + int Insert(const wxString& item, const wxBitmapBundle& bitmap, + unsigned int pos, wxClientData *clientData); + + // Override some wxTextEntry interface. + virtual void WriteText(const wxString& value) wxOVERRIDE; + + virtual wxString GetValue() const wxOVERRIDE; + virtual void Remove(long from, long to) wxOVERRIDE; + + virtual void SetInsertionPoint(long pos) wxOVERRIDE; + virtual long GetInsertionPoint() const wxOVERRIDE; + virtual long GetLastPosition() const wxOVERRIDE; + + virtual void SetSelection(long from, long to) wxOVERRIDE; + virtual void GetSelection(long *from, long *to) const wxOVERRIDE; + + virtual void SetSelection(int n) wxOVERRIDE { wxComboBox::SetSelection(n); } + virtual int GetSelection() const wxOVERRIDE { return wxComboBox::GetSelection(); } + + virtual bool IsEditable() const wxOVERRIDE; + virtual void SetEditable(bool editable) wxOVERRIDE; + + virtual GtkWidget* GetConnectWidget() wxOVERRIDE; + +protected: + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; + + virtual void GTKCreateComboBoxWidget() wxOVERRIDE; + virtual void GTKInsertComboBoxTextItem( unsigned int n, const wxString& text ) wxOVERRIDE; + + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + wxSize m_bitmapSize; + int m_bitmapCellIndex; + +private: + void Init(); + + wxDECLARE_DYNAMIC_CLASS(wxBitmapComboBox); +}; + +#endif // _WX_GTK_BMPCBOX_H_ diff --git a/lib/wxWidgets/include/wx/gtk/brush.h b/lib/wxWidgets/include/wx/gtk/brush.h new file mode 100644 index 0000000..2eadf1e --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/brush.h @@ -0,0 +1,56 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/brush.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_BRUSH_H_ +#define _WX_GTK_BRUSH_H_ + +class WXDLLIMPEXP_FWD_CORE wxBitmap; +class WXDLLIMPEXP_FWD_CORE wxColour; + +//----------------------------------------------------------------------------- +// wxBrush +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBrush: public wxBrushBase +{ +public: + wxBrush() { } + + wxBrush( const wxColour &colour, wxBrushStyle style = wxBRUSHSTYLE_SOLID ); + wxBrush( const wxBitmap &stippleBitmap ); + + wxDECLARE_DEFAULT_COPY(wxBrush) + + virtual ~wxBrush(); + + bool operator==(const wxBrush& brush) const; + bool operator!=(const wxBrush& brush) const { return !(*this == brush); } + + wxBrushStyle GetStyle() const wxOVERRIDE; + wxColour GetColour() const wxOVERRIDE; + wxBitmap *GetStipple() const wxOVERRIDE; + + void SetColour( const wxColour& col ) wxOVERRIDE; + void SetColour( unsigned char r, unsigned char g, unsigned char b ) wxOVERRIDE; + void SetStyle( wxBrushStyle style ) wxOVERRIDE; + void SetStipple( const wxBitmap& stipple ) wxOVERRIDE; + + wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants") + wxBrush(const wxColour& col, int style); + + wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants") + void SetStyle(int style) { SetStyle((wxBrushStyle)style); } + +protected: + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxBrush); +}; + +#endif // _WX_GTK_BRUSH_H_ diff --git a/lib/wxWidgets/include/wx/gtk/button.h b/lib/wxWidgets/include/wx/gtk/button.h new file mode 100644 index 0000000..e6fb1b5 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/button.h @@ -0,0 +1,79 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/button.h +// Purpose: wxGTK wxButton class declaration +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_BUTTON_H_ +#define _WX_GTK_BUTTON_H_ + +//----------------------------------------------------------------------------- +// wxButton +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxButton : public wxButtonBase +{ +public: + wxButton() {} + wxButton(wxWindow *parent, wxWindowID id, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)); + + virtual wxWindow *SetDefault() wxOVERRIDE; + virtual void SetLabel( const wxString &label ) wxOVERRIDE; + + // implementation + // -------------- + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // helper to allow access to protected member from GTK callback + void MoveWindow(int x, int y, int width, int height) { DoMoveWindow(x, y, width, height); } + + // called from GTK callbacks: they update the button state and call + // GTKUpdateBitmap() + void GTKMouseEnters(); + void GTKMouseLeaves(); + void GTKPressed(); + void GTKReleased(); + +protected: + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE; + +#if wxUSE_MARKUP + virtual bool DoSetLabelMarkup(const wxString& markup) wxOVERRIDE; +#endif // wxUSE_MARKUP + +private: + typedef wxButtonBase base_type; + + // Return the GtkLabel used by this button. + GtkLabel *GTKGetLabel() const; + +#ifndef __WXGTK3__ + // To mark if special GTK style for buttons with wxBU_EXACTFIT flag + // was already defined. + static bool m_exactFitStyleDefined; +#endif // !__WXGTK3__ + + wxDECLARE_DYNAMIC_CLASS(wxButton); +}; + +#endif // _WX_GTK_BUTTON_H_ diff --git a/lib/wxWidgets/include/wx/gtk/calctrl.h b/lib/wxWidgets/include/wx/gtk/calctrl.h new file mode 100644 index 0000000..5682cee --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/calctrl.h @@ -0,0 +1,69 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/calctrl.h +// Purpose: wxGtkCalendarCtrl control +// Author: Marcin Wojdyr +// Copyright: (C) 2008 Marcin Wojdyr +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef GTK_CALCTRL_H__ +#define GTK_CALCTRL_H__ + +class WXDLLIMPEXP_ADV wxGtkCalendarCtrl : public wxCalendarCtrlBase +{ +public: + wxGtkCalendarCtrl() {} + wxGtkCalendarCtrl(wxWindow *parent, + wxWindowID id, + const wxDateTime& date = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCAL_SHOW_HOLIDAYS, + const wxString& name = wxASCII_STR(wxCalendarNameStr)) + { + Create(parent, id, date, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxDateTime& date = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCAL_SHOW_HOLIDAYS, + const wxString& name = wxASCII_STR(wxCalendarNameStr)); + + virtual ~wxGtkCalendarCtrl() {} + + virtual bool SetDate(const wxDateTime& date) wxOVERRIDE; + virtual wxDateTime GetDate() const wxOVERRIDE; + + virtual bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime, + const wxDateTime& upperdate = wxDefaultDateTime) wxOVERRIDE; + virtual bool GetDateRange(wxDateTime *lowerdate, wxDateTime *upperdate) const wxOVERRIDE; + + virtual bool EnableMonthChange(bool enable = true) wxOVERRIDE; + + virtual void Mark(size_t day, bool mark) wxOVERRIDE; + + // implementation + // -------------- + + void GTKGenerateEvent(wxEventType type); + +private: + bool IsInValidRange(const wxDateTime& dt) const; + + // Range of the dates that can be selected by user, either or both may be + // invalid to indicate that no corresponding restriction is set. + wxDateTime m_validStart, + m_validEnd; + + // Last known selected date, may be different from the real selection in + // the control while a handler for day-selected is running. + wxDateTime m_selectedDate; + + wxDECLARE_DYNAMIC_CLASS(wxGtkCalendarCtrl); + wxDECLARE_NO_COPY_CLASS(wxGtkCalendarCtrl); +}; + +#endif // GTK_CALCTRL_H__ diff --git a/lib/wxWidgets/include/wx/gtk/checkbox.h b/lib/wxWidgets/include/wx/gtk/checkbox.h new file mode 100644 index 0000000..e20b834 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/checkbox.h @@ -0,0 +1,68 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/checkbox.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTKCHECKBOX_H_ +#define _WX_GTKCHECKBOX_H_ + +// ---------------------------------------------------------------------------- +// wxCheckBox +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxCheckBox : public wxCheckBoxBase +{ +public: + wxCheckBox(); + ~wxCheckBox(); + wxCheckBox( wxWindow *parent, wxWindowID id, const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)) + { + Create(parent, id, label, pos, size, style, validator, name); + } + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr) ); + + void SetValue( bool state ) wxOVERRIDE; + bool GetValue() const wxOVERRIDE; + + virtual void SetLabel( const wxString& label ) wxOVERRIDE; + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // implementation + void GTKDisableEvents(); + void GTKEnableEvents(); + +protected: + virtual void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE; + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; + + virtual void DoEnable(bool enable) wxOVERRIDE; + + void DoSet3StateValue(wxCheckBoxState state) wxOVERRIDE; + wxCheckBoxState DoGet3StateValue() const wxOVERRIDE; + +private: + typedef wxCheckBoxBase base_type; + + GtkWidget *m_widgetCheckbox; + GtkWidget *m_widgetLabel; + + wxDECLARE_DYNAMIC_CLASS(wxCheckBox); +}; + +#endif // _WX_GTKCHECKBOX_H_ diff --git a/lib/wxWidgets/include/wx/gtk/checklst.h b/lib/wxWidgets/include/wx/gtk/checklst.h new file mode 100644 index 0000000..6f9a264 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/checklst.h @@ -0,0 +1,48 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/checklst.h +// Purpose: wxCheckListBox class +// Author: Robert Roebling +// Modified by: +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTKCHECKLIST_H_ +#define _WX_GTKCHECKLIST_H_ + +//----------------------------------------------------------------------------- +// wxCheckListBox +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxCheckListBox : public wxCheckListBoxBase +{ +public: + wxCheckListBox(); + wxCheckListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int nStrings = 0, + const wxString *choices = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + wxCheckListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + + virtual bool IsChecked(unsigned int index) const wxOVERRIDE; + virtual void Check(unsigned int index, bool check = true) wxOVERRIDE; + + int GetItemHeight() const; + + void DoCreateCheckList(); + +private: + wxDECLARE_DYNAMIC_CLASS(wxCheckListBox); +}; + +#endif // _WX_GTKCHECKLIST_H_ diff --git a/lib/wxWidgets/include/wx/gtk/chkconf.h b/lib/wxWidgets/include/wx/gtk/chkconf.h new file mode 100644 index 0000000..84595b2 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/chkconf.h @@ -0,0 +1,98 @@ +/* + * Name: wx/gtk/chkconf.h + * Purpose: wxGTK-specific settings consistency checks + * Author: Vadim Zeitlin + * Created: 2007-07-19 (extracted from wx/chkconf.h) + * Copyright: (c) 2000-2007 Vadim Zeitlin + * Licence: wxWindows licence + */ + +#ifndef __WXUNIVERSAL__ +# if wxUSE_MDI_ARCHITECTURE && !wxUSE_MENUS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "MDI requires wxUSE_MENUS in wxGTK" +# else +# undef wxUSE_MENUS +# define wxUSE_MENUS 1 +# endif +# endif +#endif /* !__WXUNIVERSAL__ */ + +#if wxUSE_JOYSTICK +# if !wxUSE_THREADS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxJoystick requires threads in wxGTK" +# else +# undef wxUSE_JOYSTICK +# define wxUSE_JOYSTICK 0 +# endif +# endif +#endif /* wxUSE_JOYSTICK */ + +#if wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW && !wxUSE_POSTSCRIPT +# undef wxUSE_POSTSCRIPT +# define wxUSE_POSTSCRIPT 1 +#endif + +#if wxUSE_OWNER_DRAWN +# undef wxUSE_OWNER_DRAWN +# define wxUSE_OWNER_DRAWN 0 +#endif + +#if wxUSE_METAFILE +# undef wxUSE_METAFILE +# define wxUSE_METAFILE 0 +#endif + +#if wxUSE_ENH_METAFILE +# undef wxUSE_ENH_METAFILE +# define wxUSE_ENH_METAFILE 0 +#endif + +#ifndef __UNIX__ + +# undef wxUSE_WEBVIEW +# define wxUSE_WEBVIEW 0 +# undef wxUSE_WEBVIEW_WEBKIT +# define wxUSE_WEBVIEW_WEBKIT 0 + +# undef wxUSE_MEDIACTRL +# define wxUSE_MEDIACTRL 0 + + /* + We could use GDK_WINDOWING_X11 for those but this would require + including gdk/gdk.h and we don't want to do it from here, so assume + we're not using X11 if we're not under Unix. + */ + +# undef wxUSE_UIACTIONSIMULATOR +# define wxUSE_UIACTIONSIMULATOR 0 + +# undef wxUSE_GLCANVAS +# define wxUSE_GLCANVAS 0 + +#endif /* __UNIX__ */ + +/* + We always need Cairo with wxGTK, enable it if necessary (this can only + happen under Windows). + */ +#ifdef __WINDOWS__ + +#if !wxUSE_CAIRO +# undef wxUSE_CAIRO +# define wxUSE_CAIRO 1 +#endif + +#endif /* __WINDOWS__ */ + +#ifdef __WXGTK3__ + #if !wxUSE_GRAPHICS_CONTEXT + #ifdef wxABORT_ON_CONFIG_ERROR + #error "GTK+ 3 support requires wxGraphicsContext" + #else + #undef wxUSE_GRAPHICS_CONTEXT + #define wxUSE_GRAPHICS_CONTEXT 1 + #endif + #endif +#endif diff --git a/lib/wxWidgets/include/wx/gtk/choice.h b/lib/wxWidgets/include/wx/gtk/choice.h new file mode 100644 index 0000000..ed8a514 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/choice.h @@ -0,0 +1,119 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/choice.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_CHOICE_H_ +#define _WX_GTK_CHOICE_H_ + +class WXDLLIMPEXP_FWD_BASE wxSortedArrayString; +class WXDLLIMPEXP_FWD_BASE wxArrayString; + +//----------------------------------------------------------------------------- +// wxChoice +//----------------------------------------------------------------------------- + +class wxGtkCollatedArrayString; + +class WXDLLIMPEXP_CORE wxChoice : public wxChoiceBase +{ +public: + wxChoice() + { + Init(); + } + wxChoice( wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = (const wxString *) NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr) ) + { + Init(); + Create(parent, id, pos, size, n, choices, style, validator, name); + } + wxChoice( wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr) ) + { + Init(); + Create(parent, id, pos, size, choices, style, validator, name); + } + virtual ~wxChoice(); + bool Create( wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr) ); + bool Create( wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr) ); + + int GetSelection() const wxOVERRIDE; + void SetSelection(int n) wxOVERRIDE; + + virtual unsigned int GetCount() const wxOVERRIDE; + virtual int FindString(const wxString& s, bool bCase = false) const wxOVERRIDE; + virtual wxString GetString(unsigned int n) const wxOVERRIDE; + virtual void SetString(unsigned int n, const wxString& string) wxOVERRIDE; + + virtual void SetColumns(int n=1) wxOVERRIDE; + virtual int GetColumns() const wxOVERRIDE; + + virtual void GTKDisableEvents(); + virtual void GTKEnableEvents(); + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + +protected: + // this array is only used for controls with wxCB_SORT style, so only + // allocate it if it's needed (hence using pointer) + wxGtkCollatedArrayString *m_strings; + + // contains the client data for the items + wxArrayPtrVoid m_clientData; + + // index to GtkListStore cell which displays the item text + int m_stringCellIndex; + + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const wxOVERRIDE; + virtual int DoInsertItems(const wxArrayStringsAdapter& items, + unsigned int pos, + void **clientData, wxClientDataType type) wxOVERRIDE; + virtual void DoSetItemClientData(unsigned int n, void* clientData) wxOVERRIDE; + virtual void* DoGetItemClientData(unsigned int n) const wxOVERRIDE; + virtual void DoClear() wxOVERRIDE; + virtual void DoDeleteOneItem(unsigned int n) wxOVERRIDE; + + virtual bool GTKHandleFocusOut() wxOVERRIDE; + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; + virtual void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE; + + // in derived classes, implement this to insert list store entry + // with all items default except text + virtual void GTKInsertComboBoxTextItem( unsigned int n, const wxString& text ); + +private: + void Init(); + + wxDECLARE_DYNAMIC_CLASS(wxChoice); +}; + + +#endif // _WX_GTK_CHOICE_H_ diff --git a/lib/wxWidgets/include/wx/gtk/clipbrd.h b/lib/wxWidgets/include/wx/gtk/clipbrd.h new file mode 100644 index 0000000..eeb84b7 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/clipbrd.h @@ -0,0 +1,143 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/clipbrd.h +// Purpose: wxClipboard for wxGTK +// Author: Robert Roebling, Vadim Zeitlin +// Copyright: (c) 1998 Robert Roebling +// (c) 2007 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_CLIPBOARD_H_ +#define _WX_GTK_CLIPBOARD_H_ + +// ---------------------------------------------------------------------------- +// wxClipboard +// ---------------------------------------------------------------------------- + +#include "wx/weakref.h" + +class WXDLLIMPEXP_CORE wxClipboard : public wxClipboardBase +{ +public: + // there are several clipboards in X11 (and in GDK) + enum Kind + { + Primary, + Clipboard + }; + + wxClipboard(); + virtual ~wxClipboard(); + + // open the clipboard before SetData() and GetData() + virtual bool Open() wxOVERRIDE; + + // close the clipboard after SetData() and GetData() + virtual void Close() wxOVERRIDE; + + // query whether the clipboard is opened + virtual bool IsOpened() const wxOVERRIDE; + + // set the clipboard data. all other formats will be deleted. + virtual bool SetData( wxDataObject *data ) wxOVERRIDE; + + // add to the clipboard data. + virtual bool AddData( wxDataObject *data ) wxOVERRIDE; + + // ask if data in correct format is available + virtual bool IsSupported( const wxDataFormat& format ) wxOVERRIDE; + + // ask if data in correct format is available + virtual bool IsSupportedAsync( wxEvtHandler *sink ) wxOVERRIDE; + + // fill data with data on the clipboard (if available) + virtual bool GetData( wxDataObject& data ) wxOVERRIDE; + + // flushes the clipboard; that means that the data which is currently on + // clipboard will stay available even after the application exits (possibly + // eating memory), otherwise the clipboard will be emptied on exit + virtual bool Flush() wxOVERRIDE; + + // clears wxTheClipboard and the system's clipboard if possible + virtual void Clear() wxOVERRIDE; + + + + // implementation from now on + // -------------------------- + + // get our clipboard item (depending on m_usePrimary value) + GdkAtom GTKGetClipboardAtom() const; + + // get the data object currently being requested + wxDataObject *GTKGetDataObject( GdkAtom atom ); + + // clear the data for the given clipboard kind + void GTKClearData(Kind kind); + + // called when selection data is received + void GTKOnSelectionReceived(const GtkSelectionData& sel); + + // called when available target information is received + bool GTKOnTargetReceived(const wxDataFormat& format); + +private: + // the data object for the specific selection + wxDataObject *& Data(Kind kind) + { + return kind == Primary ? m_dataPrimary : m_dataClipboard; + } + + // the data object we're currently using + wxDataObject *& Data() + { + return Data(m_usePrimary ? Primary : Clipboard); + } + + + // set or unset selection ownership + bool SetSelectionOwner(bool set = true); + + // add atom to the list of supported targets + void AddSupportedTarget(GdkAtom atom); + + // get the atom corresponding to the given format if it's supported + GdkAtom DoGetTarget(const wxDataFormat& format); + + // just check if the given format is supported + bool DoIsSupported(const wxDataFormat& format); + + + // both of these pointers can be non-NULL simultaneously but we only use + // one of them at any moment depending on m_usePrimary value, use Data() + // (from inside) or GTKGetDataObject() (from outside) accessors + wxDataObject *m_dataPrimary, + *m_dataClipboard; + + // this is used to temporarily hold the object passed to our GetData() so + // that GTK callbacks could access it + wxDataObject *m_receivedData; + + // used to pass information about the format we need from DoIsSupported() + // to GTKOnTargetReceived() and return the supported format from the latter + GdkAtom m_targetRequested; + + GtkWidget *m_clipboardWidget; // for getting and offering data + GtkWidget *m_targetsWidget; // for getting list of supported formats + + // ID of the connection to "selection_get" signal, initially 0. + unsigned long m_idSelectionGetHandler; + + bool m_open; + bool m_formatSupported; + +public: + // async stuff + wxEvtHandlerRef m_sink; +private: + GtkWidget *m_targetsWidgetAsync; // for getting list of supported formats + + wxDECLARE_DYNAMIC_CLASS(wxClipboard); +}; + +#endif // _WX_GTK_CLIPBOARD_H_ diff --git a/lib/wxWidgets/include/wx/gtk/clrpicker.h b/lib/wxWidgets/include/wx/gtk/clrpicker.h new file mode 100644 index 0000000..395fb9f --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/clrpicker.h @@ -0,0 +1,64 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/clrpicker.h +// Purpose: wxColourButton header +// Author: Francesco Montorsi +// Modified by: +// Created: 14/4/2006 +// Copyright: (c) Francesco Montorsi +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_CLRPICKER_H_ +#define _WX_GTK_CLRPICKER_H_ + +#include "wx/button.h" + +//----------------------------------------------------------------------------- +// wxColourButton +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxColourButton : public wxButton, + public wxColourPickerWidgetBase +{ +public: + wxColourButton() : m_topParent(NULL) {} + wxColourButton(wxWindow *parent, + wxWindowID id, + const wxColour& initial = *wxBLACK, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCLRBTN_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxColourPickerWidgetNameStr)) + : m_topParent(NULL) + { + Create(parent, id, initial, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxColour& initial = *wxBLACK, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCLRBTN_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxColourPickerWidgetNameStr)); + + virtual ~wxColourButton(); + +protected: + void UpdateColour() wxOVERRIDE; + +public: // used by the GTK callback only + + void GTKSetColour(const wxColour& colour) + { m_colour = colour; } + + wxWindow *m_topParent; + +private: + wxDECLARE_DYNAMIC_CLASS(wxColourButton); +}; + +#endif // _WX_GTK_CLRPICKER_H_ + diff --git a/lib/wxWidgets/include/wx/gtk/collpane.h b/lib/wxWidgets/include/wx/gtk/collpane.h new file mode 100644 index 0000000..053b9b5 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/collpane.h @@ -0,0 +1,79 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/collpane.h +// Purpose: wxCollapsiblePane +// Author: Francesco Montorsi +// Modified by: +// Created: 8/10/2006 +// Copyright: (c) Francesco Montorsi +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COLLAPSABLE_PANEL_H_GTK_ +#define _WX_COLLAPSABLE_PANEL_H_GTK_ + +// ---------------------------------------------------------------------------- +// wxCollapsiblePane +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxCollapsiblePane : public wxCollapsiblePaneBase +{ +public: + wxCollapsiblePane() { Init(); } + + wxCollapsiblePane(wxWindow *parent, + wxWindowID winid, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCP_DEFAULT_STYLE, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCollapsiblePaneNameStr)) + { + Init(); + + Create(parent, winid, label, pos, size, style, val, name); + } + + bool Create(wxWindow *parent, + wxWindowID winid, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCP_DEFAULT_STYLE, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCollapsiblePaneNameStr)); + + virtual void Collapse(bool collapse = true) wxOVERRIDE; + virtual bool IsCollapsed() const wxOVERRIDE; + virtual void SetLabel(const wxString& str) wxOVERRIDE; + + virtual wxWindow *GetPane() const wxOVERRIDE { return m_pPane; } + virtual wxString GetLabel() const wxOVERRIDE { return m_strLabel; } + +protected: + virtual wxSize DoGetBestSize() const wxOVERRIDE; + +public: // used by GTK callbacks + bool m_bIgnoreNextChange; + wxSize m_szCollapsed; + + wxWindow *m_pPane; + + // the button label without ">>" or "<<" + wxString m_strLabel; + +private: + void Init() + { + m_bIgnoreNextChange = false; + } + + void OnSize(wxSizeEvent&); + virtual void AddChildGTK(wxWindowGTK* child) wxOVERRIDE; + GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxCollapsiblePane); + wxDECLARE_EVENT_TABLE(); +}; + +#endif // _WX_COLLAPSABLE_PANEL_H_GTK_ diff --git a/lib/wxWidgets/include/wx/gtk/colordlg.h b/lib/wxWidgets/include/wx/gtk/colordlg.h new file mode 100644 index 0000000..08bf264 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/colordlg.h @@ -0,0 +1,48 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/colordlg.h +// Purpose: wxColourDialog +// Author: Vaclav Slavik +// Modified by: +// Created: 2004/06/04 +// Copyright: (c) Vaclav Slavik, 2004 +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_COLORDLG_H_ +#define _WX_GTK_COLORDLG_H_ + +#include "wx/dialog.h" + +class WXDLLIMPEXP_CORE wxColourDialog : public wxDialog +{ +public: + wxColourDialog() {} + wxColourDialog(wxWindow *parent, + const wxColourData *data = NULL); + virtual ~wxColourDialog() {} + + bool Create(wxWindow *parent, const wxColourData *data = NULL); + + wxColourData &GetColourData() { return m_data; } + + virtual int ShowModal() wxOVERRIDE; + +protected: + // implement some base class methods to do nothing to avoid asserts and + // GTK warnings, since this is not a real wxDialog. + virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y), + int WXUNUSED(width), int WXUNUSED(height), + int WXUNUSED(sizeFlags) = wxSIZE_AUTO) wxOVERRIDE {} + virtual void DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), + int WXUNUSED(width), int WXUNUSED(height)) wxOVERRIDE {} + + // copy data between the dialog and m_colourData: + void ColourDataToDialog(); + void DialogToColourData(); + + wxColourData m_data; + + wxDECLARE_DYNAMIC_CLASS(wxColourDialog); +}; + +#endif diff --git a/lib/wxWidgets/include/wx/gtk/colour.h b/lib/wxWidgets/include/wx/gtk/colour.h new file mode 100644 index 0000000..91b40a0 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/colour.h @@ -0,0 +1,61 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/colour.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_COLOUR_H_ +#define _WX_GTK_COLOUR_H_ + +#ifdef __WXGTK3__ +typedef struct _GdkRGBA GdkRGBA; +#endif + +//----------------------------------------------------------------------------- +// wxColour +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxColour : public wxColourBase +{ +public: + // constructors + // ------------ + DEFINE_STD_WXCOLOUR_CONSTRUCTORS + wxColour(const GdkColor& gdkColor); +#ifdef __WXGTK3__ + wxColour(const GdkRGBA& gdkRGBA); +#endif + + wxDECLARE_DEFAULT_COPY(wxColour) + + virtual ~wxColour(); + + bool operator==(const wxColour& col) const; + bool operator!=(const wxColour& col) const { return !(*this == col); } + + unsigned char Red() const wxOVERRIDE; + unsigned char Green() const wxOVERRIDE; + unsigned char Blue() const wxOVERRIDE; + unsigned char Alpha() const wxOVERRIDE; + + // Implementation part +#ifdef __WXGTK3__ + operator const GdkRGBA*() const; +#else + void CalcPixel( GdkColormap *cmap ); + int GetPixel() const; +#endif + const GdkColor *GetColor() const; + +protected: + virtual void + InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a) wxOVERRIDE; + + virtual bool FromString(const wxString& str) wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxColour); +}; + +#endif // _WX_GTK_COLOUR_H_ diff --git a/lib/wxWidgets/include/wx/gtk/combobox.h b/lib/wxWidgets/include/wx/gtk/combobox.h new file mode 100644 index 0000000..982caa1 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/combobox.h @@ -0,0 +1,167 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/combobox.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_COMBOBOX_H_ +#define _WX_GTK_COMBOBOX_H_ + +#include "wx/choice.h" + +typedef struct _GtkEntry GtkEntry; + +//----------------------------------------------------------------------------- +// wxComboBox +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxComboBox : public wxChoice, + public wxTextEntry +{ +public: + wxComboBox() + : wxChoice(), wxTextEntry() + { + Init(); + } + wxComboBox(wxWindow *parent, + wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)) + : wxChoice(), wxTextEntry() + { + Init(); + Create(parent, id, value, pos, size, n, choices, style, validator, name); + } + + wxComboBox(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)) + : wxChoice(), wxTextEntry() + { + Init(); + Create(parent, id, value, pos, size, choices, style, validator, name); + } + ~wxComboBox(); + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = (const wxString *) NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)); + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)); + + // Set/GetSelection() from wxTextEntry and wxChoice + + virtual void SetSelection(int n) wxOVERRIDE { wxChoice::SetSelection(n); } + virtual void SetSelection(long from, long to) wxOVERRIDE + { wxTextEntry::SetSelection(from, to); } + + virtual int GetSelection() const wxOVERRIDE { return wxChoice::GetSelection(); } + virtual void GetSelection(long *from, long *to) const wxOVERRIDE + { return wxTextEntry::GetSelection(from, to); } + + virtual wxString GetStringSelection() const wxOVERRIDE + { + return wxItemContainer::GetStringSelection(); + } + + virtual void SetString(unsigned int n, const wxString& string) wxOVERRIDE; + + virtual void Popup(); + virtual void Dismiss(); + + virtual void Clear() wxOVERRIDE; + + // See wxComboBoxBase discussion of IsEmpty(). + bool IsListEmpty() const { return wxItemContainer::IsEmpty(); } + bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); } + + void OnChar( wxKeyEvent &event ); + + virtual void SetValue(const wxString& value) wxOVERRIDE; + + // Standard event handling + void OnCut(wxCommandEvent& event); + void OnCopy(wxCommandEvent& event); + void OnPaste(wxCommandEvent& event); + void OnUndo(wxCommandEvent& event); + void OnRedo(wxCommandEvent& event); + void OnDelete(wxCommandEvent& event); + void OnSelectAll(wxCommandEvent& event); + + void OnUpdateCut(wxUpdateUIEvent& event); + void OnUpdateCopy(wxUpdateUIEvent& event); + void OnUpdatePaste(wxUpdateUIEvent& event); + void OnUpdateUndo(wxUpdateUIEvent& event); + void OnUpdateRedo(wxUpdateUIEvent& event); + void OnUpdateDelete(wxUpdateUIEvent& event); + void OnUpdateSelectAll(wxUpdateUIEvent& event); + + virtual void GTKDisableEvents() wxOVERRIDE; + virtual void GTKEnableEvents() wxOVERRIDE; + GtkWidget* GetConnectWidget() wxOVERRIDE; + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + virtual const wxTextEntry* WXGetTextEntry() const wxOVERRIDE { return this; } + +protected: + // From wxWindowGTK: + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; + + // Widgets that use the style->base colour for the BG colour should + // override this and return true. + virtual bool UseGTKStyleBase() const wxOVERRIDE { return true; } + + // Override in derived classes to create combo box widgets with + // custom list stores. + virtual void GTKCreateComboBoxWidget(); + + virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const wxOVERRIDE; + + virtual GtkEntry *GetEntry() const wxOVERRIDE + { return m_entry; } + + virtual int GTKIMFilterKeypress(GdkEventKey* event) const wxOVERRIDE + { return GTKEntryIMFilterKeypress(event); } + + + GtkEntry* m_entry; + +private: + // From wxTextEntry: + virtual wxWindow *GetEditableWindow() wxOVERRIDE { return this; } + virtual GtkEditable *GetEditable() const wxOVERRIDE; + + void Init(); + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox); + wxDECLARE_EVENT_TABLE(); +}; + +#endif // _WX_GTK_COMBOBOX_H_ diff --git a/lib/wxWidgets/include/wx/gtk/control.h b/lib/wxWidgets/include/wx/gtk/control.h new file mode 100644 index 0000000..fcfe03d --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/control.h @@ -0,0 +1,93 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/control.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling, Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_CONTROL_H_ +#define _WX_GTK_CONTROL_H_ + +typedef struct _GtkLabel GtkLabel; +typedef struct _GtkFrame GtkFrame; +typedef struct _GtkEntry GtkEntry; + +//----------------------------------------------------------------------------- +// wxControl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxControl : public wxControlBase +{ + typedef wxControlBase base_type; +public: + wxControl(); + wxControl(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxControlNameStr)) + { + Create(parent, id, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxControlNameStr)); + + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE; +#ifdef __WXGTK3__ + virtual bool SetFont(const wxFont& font) wxOVERRIDE; +#endif + +protected: + virtual wxSize DoGetBestSize() const wxOVERRIDE; + void PostCreation(const wxSize& size); + + // sets the label to the given string and also sets it for the given widget + void GTKSetLabelForLabel(GtkLabel *w, const wxString& label); +#if wxUSE_MARKUP + void GTKSetLabelWithMarkupForLabel(GtkLabel *w, const wxString& label); +#endif // wxUSE_MARKUP + + // GtkFrame helpers + GtkWidget* GTKCreateFrame(const wxString& label); + void GTKSetLabelForFrame(GtkFrame *w, const wxString& label); + void GTKFrameApplyWidgetStyle(GtkFrame* w, GtkRcStyle* rc); + void GTKFrameSetMnemonicWidget(GtkFrame* w, GtkWidget* widget); + + // remove mnemonics ("&"s) from the label + static wxString GTKRemoveMnemonics(const wxString& label); + + // converts wx label to GTK+ label, i.e. basically replace "&"s with "_"s + static wxString GTKConvertMnemonics(const wxString &label); + + // converts wx label to GTK+ labels preserving Pango markup + static wxString GTKConvertMnemonicsWithMarkup(const wxString& label); + + // These are used by GetDefaultAttributes + static wxVisualAttributes + GetDefaultAttributesFromGTKWidget(GtkWidget* widget, + bool useBase = false, + int state = 0); + + // Widgets that use the style->base colour for the BG colour should + // override this and return true. + virtual bool UseGTKStyleBase() const { return false; } + + // Fix sensitivity due to bug in GTK+ < 2.14 + void GTKFixSensitivity(bool onlyIfUnderMouse = true); + + // Ask GTK+ for preferred size. Use it after setting the font. + wxSize GTKGetPreferredSize(GtkWidget* widget) const; + + // Inner margins in a GtkEntry + wxSize GTKGetEntryMargins(GtkEntry* entry) const; + +private: + wxDECLARE_DYNAMIC_CLASS(wxControl); +}; + +#endif // _WX_GTK_CONTROL_H_ diff --git a/lib/wxWidgets/include/wx/gtk/cursor.h b/lib/wxWidgets/include/wx/gtk/cursor.h new file mode 100644 index 0000000..9ff7666 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/cursor.h @@ -0,0 +1,61 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/cursor.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_CURSOR_H_ +#define _WX_GTK_CURSOR_H_ + +class WXDLLIMPEXP_FWD_CORE wxImage; + +//----------------------------------------------------------------------------- +// wxCursor +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxCursor : public wxCursorBase +{ +public: + wxCursor(); + wxCursor(wxStockCursor id) { InitFromStock(id); } +#if WXWIN_COMPATIBILITY_2_8 + wxCursor(int id) { InitFromStock((wxStockCursor)id); } +#endif +#if wxUSE_IMAGE + wxCursor( const wxImage & image ); + wxCursor(const char* const* xpmData); +#endif // wxUSE_IMAGE + wxCursor(const wxString& name, + wxBitmapType type = wxCURSOR_DEFAULT_TYPE, + int hotSpotX = 0, int hotSpotY = 0); + wxCursor( const char bits[], int width, int height, + int hotSpotX = -1, int hotSpotY = -1, + const char maskBits[] = NULL, + const wxColour* fg = NULL, const wxColour* bg = NULL); + + wxDECLARE_DEFAULT_COPY(wxCursor) + + virtual wxPoint GetHotSpot() const wxOVERRIDE; + + virtual ~wxCursor(); + + // implementation + + GdkCursor *GetCursor() const; + +protected: + void InitFromStock(wxStockCursor); +#if wxUSE_IMAGE + void InitFromImage(const wxImage& image); +#endif + + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxCursor); +}; + +#endif // _WX_GTK_CURSOR_H_ diff --git a/lib/wxWidgets/include/wx/gtk/dataform.h b/lib/wxWidgets/include/wx/gtk/dataform.h new file mode 100644 index 0000000..afd7857 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/dataform.h @@ -0,0 +1,76 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/dataform.h +// Purpose: declaration of the wxDataFormat class +// Author: Vadim Zeitlin +// Modified by: +// Created: 19.10.99 (extracted from gtk/dataobj.h) +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_DATAFORM_H +#define _WX_GTK_DATAFORM_H + +class WXDLLIMPEXP_CORE wxDataFormat +{ +public: + // the clipboard formats under GDK are GdkAtoms + typedef GdkAtom NativeFormat; + + wxDataFormat(); + wxDataFormat( wxDataFormatId type ); + wxDataFormat( NativeFormat format ); + + // we have to provide all the overloads to allow using strings instead of + // data formats (as a lot of existing code does) + wxDataFormat( const wxString& id ) { InitFromString(id); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxDataFormat( const char *id ) { InitFromString(id); } +#endif + wxDataFormat( const wchar_t *id ) { InitFromString(id); } + wxDataFormat( const wxCStrData& id ) { InitFromString(id); } + + wxDataFormat& operator=(NativeFormat format) + { SetId(format); return *this; } + + // comparison + bool operator==(wxDataFormatId type) const + { return m_type == type; } + bool operator!=(wxDataFormatId type) const + { return m_type != type; } + bool operator==(NativeFormat format) const + { return m_format == (NativeFormat)format; } + bool operator!=(NativeFormat format) const + { return m_format != (NativeFormat)format; } + bool operator==(const wxDataFormat& other) const; + bool operator!=(const wxDataFormat& other) const + { return m_format != other.m_format; } + + // explicit and implicit conversions to NativeFormat which is one of + // standard data types (implicit conversion is useful for preserving the + // compatibility with old code) + NativeFormat GetFormatId() const { return m_format; } + operator NativeFormat() const { return m_format; } + + void SetId( NativeFormat format ); + + // string ids are used for custom types - this SetId() must be used for + // application-specific formats + wxString GetId() const; + void SetId( const wxString& id ); + + // implementation + wxDataFormatId GetType() const; + void SetType( wxDataFormatId type ); + +private: + // common part of ctors from format name + void InitFromString(const wxString& id); + + wxDataFormatId m_type; + NativeFormat m_format; + + void PrepareFormats(); +}; + +#endif // _WX_GTK_DATAFORM_H diff --git a/lib/wxWidgets/include/wx/gtk/dataobj.h b/lib/wxWidgets/include/wx/gtk/dataobj.h new file mode 100644 index 0000000..859093f --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/dataobj.h @@ -0,0 +1,26 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/dataobj.h +// Purpose: declaration of the wxDataObject +// Author: Robert Roebling +// Copyright: (c) 1998, 1999 Vadim Zeitlin, Robert Roebling +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_DATAOBJ_H_ +#define _WX_GTK_DATAOBJ_H_ + +// ---------------------------------------------------------------------------- +// wxDataObject is the same as wxDataObjectBase under wxGTK +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataObject : public wxDataObjectBase +{ +public: + wxDataObject(); + virtual ~wxDataObject(); + + virtual bool IsSupportedFormat( const wxDataFormat& format, Direction dir = Get ) const; +}; + +#endif // _WX_GTK_DATAOBJ_H_ + diff --git a/lib/wxWidgets/include/wx/gtk/dataobj2.h b/lib/wxWidgets/include/wx/gtk/dataobj2.h new file mode 100644 index 0000000..5e94b4e --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/dataobj2.h @@ -0,0 +1,114 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/dataobj2.h +// Purpose: declaration of standard wxDataObjectSimple-derived classes +// Author: Robert Roebling +// Created: 19.10.99 (extracted from gtk/dataobj.h) +// Copyright: (c) 1998, 1999 Vadim Zeitlin, Robert Roebling +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_DATAOBJ2_H_ +#define _WX_GTK_DATAOBJ2_H_ + +// ---------------------------------------------------------------------------- +// wxBitmapDataObject is a specialization of wxDataObject for bitmaps +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBitmapDataObject : public wxBitmapDataObjectBase +{ +public: + // ctors + wxBitmapDataObject(); + wxBitmapDataObject(const wxBitmap& bitmap); + + // destr + virtual ~wxBitmapDataObject(); + + // override base class virtual to update PNG data too + virtual void SetBitmap(const wxBitmap& bitmap) wxOVERRIDE; + + // implement base class pure virtuals + // ---------------------------------- + + virtual size_t GetDataSize() const wxOVERRIDE { return m_pngSize; } + virtual bool GetDataHere(void *buf) const wxOVERRIDE; + virtual bool SetData(size_t len, const void *buf) wxOVERRIDE; + // Must provide overloads to avoid hiding them (and warnings about it) + virtual size_t GetDataSize(const wxDataFormat&) const wxOVERRIDE + { + return GetDataSize(); + } + virtual bool GetDataHere(const wxDataFormat&, void *buf) const wxOVERRIDE + { + return GetDataHere(buf); + } + virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) wxOVERRIDE + { + return SetData(len, buf); + } + +protected: + void Clear() { free(m_pngData); } + void ClearAll() { Clear(); Init(); } + + size_t m_pngSize; + void *m_pngData; + + void DoConvertToPng(); + +private: + void Init() { m_pngData = NULL; m_pngSize = 0; } +}; + +// ---------------------------------------------------------------------------- +// wxFileDataObject is a specialization of wxDataObject for file names +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFileDataObject : public wxFileDataObjectBase +{ +public: + // implement base class pure virtuals + // ---------------------------------- + + void AddFile( const wxString &filename ); + + virtual size_t GetDataSize() const wxOVERRIDE; + virtual bool GetDataHere(void *buf) const wxOVERRIDE; + virtual bool SetData(size_t len, const void *buf) wxOVERRIDE; + // Must provide overloads to avoid hiding them (and warnings about it) + virtual size_t GetDataSize(const wxDataFormat&) const wxOVERRIDE + { + return GetDataSize(); + } + virtual bool GetDataHere(const wxDataFormat&, void *buf) const wxOVERRIDE + { + return GetDataHere(buf); + } + virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) wxOVERRIDE + { + return SetData(len, buf); + } +}; + +// ---------------------------------------------------------------------------- +// wxURLDataObject is a specialization of wxDataObject for URLs +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxURLDataObject : public wxDataObjectComposite +{ +public: + wxURLDataObject(const wxString& url = wxEmptyString); + + wxString GetURL() const; + void SetURL(const wxString& url); + +private: + class wxTextURIListDataObject* const m_dobjURIList; + wxTextDataObject* const m_dobjText; + + wxDECLARE_NO_COPY_CLASS(wxURLDataObject); +}; + + +#endif // _WX_GTK_DATAOBJ2_H_ + diff --git a/lib/wxWidgets/include/wx/gtk/dataview.h b/lib/wxWidgets/include/wx/gtk/dataview.h new file mode 100644 index 0000000..f3633ce --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/dataview.h @@ -0,0 +1,255 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/dataview.h +// Purpose: wxDataViewCtrl GTK+2 implementation header +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTKDATAVIEWCTRL_H_ +#define _WX_GTKDATAVIEWCTRL_H_ + +#include "wx/list.h" + +class WXDLLIMPEXP_FWD_CORE wxDataViewCtrlInternal; + +struct _GtkTreePath; + +// --------------------------------------------------------- +// wxDataViewColumn +// --------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataViewColumn: public wxDataViewColumnBase +{ +public: + wxDataViewColumn( const wxString &title, wxDataViewRenderer *renderer, + unsigned int model_column, int width = wxDVC_DEFAULT_WIDTH, + wxAlignment align = wxALIGN_CENTER, + int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn( const wxBitmapBundle &bitmap, wxDataViewRenderer *renderer, + unsigned int model_column, int width = wxDVC_DEFAULT_WIDTH, + wxAlignment align = wxALIGN_CENTER, + int flags = wxDATAVIEW_COL_RESIZABLE ); + + + // setters: + + virtual void SetTitle( const wxString &title ) wxOVERRIDE; + virtual void SetBitmap( const wxBitmapBundle &bitmap ) wxOVERRIDE; + + virtual void SetOwner( wxDataViewCtrl *owner ) wxOVERRIDE; + + virtual void SetAlignment( wxAlignment align ) wxOVERRIDE; + + virtual void SetSortable( bool sortable ) wxOVERRIDE; + virtual void SetSortOrder( bool ascending ) wxOVERRIDE; + virtual void UnsetAsSortKey() wxOVERRIDE; + + virtual void SetResizeable( bool resizable ) wxOVERRIDE; + virtual void SetHidden( bool hidden ) wxOVERRIDE; + + virtual void SetMinWidth( int minWidth ) wxOVERRIDE; + virtual void SetWidth( int width ) wxOVERRIDE; + + virtual void SetReorderable( bool reorderable ) wxOVERRIDE; + + virtual void SetFlags(int flags) wxOVERRIDE { SetIndividualFlags(flags); } + + // getters: + + virtual wxString GetTitle() const wxOVERRIDE; + virtual wxAlignment GetAlignment() const wxOVERRIDE; + + virtual bool IsSortable() const wxOVERRIDE; + virtual bool IsSortOrderAscending() const wxOVERRIDE; + virtual bool IsSortKey() const wxOVERRIDE; + + virtual bool IsResizeable() const wxOVERRIDE; + virtual bool IsHidden() const wxOVERRIDE; + + virtual int GetWidth() const wxOVERRIDE; + virtual int GetMinWidth() const wxOVERRIDE; + + virtual bool IsReorderable() const wxOVERRIDE; + + virtual int GetFlags() const wxOVERRIDE { return GetFromIndividualFlags(); } + + // implementation + GtkWidget* GetGtkHandle() const { return m_column; } + +private: + // holds the GTK handle + GtkWidget *m_column; + + // holds GTK handles for title/bitmap in the header + GtkWidget *m_image; + GtkWidget *m_label; + + // delayed connection to mouse events + friend class wxDataViewCtrl; + void OnInternalIdle(); + bool m_isConnected; + + void Init(wxAlignment align, int flags, int width); +}; + +WX_DECLARE_LIST_WITH_DECL(wxDataViewColumn, wxDataViewColumnList, + class WXDLLIMPEXP_CORE); + +// --------------------------------------------------------- +// wxDataViewCtrl +// --------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataViewCtrl: public wxDataViewCtrlBase +{ +public: + wxDataViewCtrl() + { + Init(); + } + + wxDataViewCtrl( wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxDataViewCtrlNameStr) ) + { + Init(); + + Create(parent, id, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxDataViewCtrlNameStr)); + + virtual ~wxDataViewCtrl(); + + virtual bool AssociateModel( wxDataViewModel *model ) wxOVERRIDE; + + virtual bool PrependColumn( wxDataViewColumn *col ) wxOVERRIDE; + virtual bool AppendColumn( wxDataViewColumn *col ) wxOVERRIDE; + virtual bool InsertColumn( unsigned int pos, wxDataViewColumn *col ) wxOVERRIDE; + + virtual unsigned int GetColumnCount() const wxOVERRIDE; + virtual wxDataViewColumn* GetColumn( unsigned int pos ) const wxOVERRIDE; + virtual bool DeleteColumn( wxDataViewColumn *column ) wxOVERRIDE; + virtual bool ClearColumns() wxOVERRIDE; + virtual int GetColumnPosition( const wxDataViewColumn *column ) const wxOVERRIDE; + + virtual wxDataViewColumn *GetSortingColumn() const wxOVERRIDE; + + virtual int GetSelectedItemsCount() const wxOVERRIDE; + virtual int GetSelections( wxDataViewItemArray & sel ) const wxOVERRIDE; + virtual void SetSelections( const wxDataViewItemArray & sel ) wxOVERRIDE; + virtual void Select( const wxDataViewItem & item ) wxOVERRIDE; + virtual void Unselect( const wxDataViewItem & item ) wxOVERRIDE; + virtual bool IsSelected( const wxDataViewItem & item ) const wxOVERRIDE; + virtual void SelectAll() wxOVERRIDE; + virtual void UnselectAll() wxOVERRIDE; + + virtual void EnsureVisible( const wxDataViewItem& item, + const wxDataViewColumn *column = NULL ) wxOVERRIDE; + virtual void HitTest( const wxPoint &point, + wxDataViewItem &item, + wxDataViewColumn *&column ) const wxOVERRIDE; + virtual wxRect GetItemRect( const wxDataViewItem &item, + const wxDataViewColumn *column = NULL ) const wxOVERRIDE; + + virtual bool SetRowHeight( int rowHeight ) wxOVERRIDE; + + virtual void EditItem(const wxDataViewItem& item, const wxDataViewColumn *column) wxOVERRIDE; + + virtual void Collapse( const wxDataViewItem & item ) wxOVERRIDE; + virtual bool IsExpanded( const wxDataViewItem & item ) const wxOVERRIDE; + + virtual bool EnableDragSource( const wxDataFormat &format ) wxOVERRIDE; + virtual bool DoEnableDropTarget( const wxVector& formats ) wxOVERRIDE; + + virtual wxDataViewColumn *GetCurrentColumn() const wxOVERRIDE; + + virtual wxDataViewItem GetTopItem() const wxOVERRIDE; + virtual int GetCountPerPage() const wxOVERRIDE; + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + wxWindow *GetMainWindow() { return (wxWindow*) this; } + + GtkWidget *GtkGetTreeView() { return m_treeview; } + wxDataViewCtrlInternal* GtkGetInternal() { return m_internal; } + + // Convert GTK path to our item. Returned item may be invalid if get_iter() + // failed. + wxDataViewItem GTKPathToItem(struct _GtkTreePath *path) const; + + // Return wxDataViewColumn matching the given GtkTreeViewColumn. + // + // If the input argument is NULL, return NULL too. Otherwise we must find + // the matching column and assert if we didn't. + wxDataViewColumn* GTKColumnToWX(GtkTreeViewColumn *gtk_col) const; + + virtual void OnInternalIdle() wxOVERRIDE; + + int GTKGetUniformRowHeight() const { return m_uniformRowHeight; } + + // Simple RAII helper for disabling selection events during its lifetime. + class SelectionEventsSuppressor + { + public: + explicit SelectionEventsSuppressor(wxDataViewCtrl* ctrl) + : m_ctrl(ctrl) + { + m_ctrl->GtkDisableSelectionEvents(); + } + + ~SelectionEventsSuppressor() + { + m_ctrl->GtkEnableSelectionEvents(); + } + + private: + wxDataViewCtrl* const m_ctrl; + }; + +protected: + virtual void DoSetExpanderColumn() wxOVERRIDE; + virtual void DoSetIndent() wxOVERRIDE; + + virtual void DoExpand(const wxDataViewItem& item, bool expandChildren) wxOVERRIDE; + + virtual void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE; + virtual GdkWindow* GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; + +private: + void Init(); + + virtual wxDataViewItem DoGetCurrentItem() const wxOVERRIDE; + virtual void DoSetCurrentItem(const wxDataViewItem& item) wxOVERRIDE; + + friend class wxDataViewCtrlDCImpl; + friend class wxDataViewColumn; + friend class wxDataViewCtrlInternal; + + GtkWidget *m_treeview; + wxDataViewCtrlInternal *m_internal; + wxDataViewColumnList m_cols; + wxDataViewItem m_ensureVisibleDefered; + + // By default this is set to -1 and the height of the rows is determined by + // GetRect() methods of the renderers but this can be set to a positive + // value to force the height of all rows to the given value. + int m_uniformRowHeight; + + virtual void AddChildGTK(wxWindowGTK* child) wxOVERRIDE; + void GtkEnableSelectionEvents(); + void GtkDisableSelectionEvents(); + + wxDECLARE_DYNAMIC_CLASS(wxDataViewCtrl); + wxDECLARE_NO_COPY_CLASS(wxDataViewCtrl); +}; + + +#endif // _WX_GTKDATAVIEWCTRL_H_ diff --git a/lib/wxWidgets/include/wx/gtk/dc.h b/lib/wxWidgets/include/wx/gtk/dc.h new file mode 100644 index 0000000..67008e4 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/dc.h @@ -0,0 +1,167 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/dc.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTKDC_H_ +#define _WX_GTKDC_H_ + +#ifdef __WXGTK3__ + +#include "wx/dcgraph.h" + +class wxGTKCairoDCImpl: public wxGCDCImpl +{ + typedef wxGCDCImpl BaseType; +public: + wxGTKCairoDCImpl(wxDC* owner); + wxGTKCairoDCImpl(wxDC* owner, wxWindow* window, wxLayoutDirection dir = wxLayout_Default, int width = 0); + + virtual void DoDrawBitmap(const wxBitmap& bitmap, int x, int y, bool useMask) wxOVERRIDE; + virtual void DoDrawCheckMark(int x, int y, int width, int height) wxOVERRIDE; + virtual void DoDrawIcon(const wxIcon& icon, int x, int y) wxOVERRIDE; + virtual void DoDrawText(const wxString& text, int x, int y) wxOVERRIDE; + virtual void DoDrawRotatedText(const wxString& text, int x, int y, double angle) wxOVERRIDE; +#if wxUSE_IMAGE + virtual bool DoFloodFill(int x, int y, const wxColour& col, wxFloodFillStyle style) wxOVERRIDE; +#endif + virtual wxBitmap DoGetAsBitmap(const wxRect* subrect) const wxOVERRIDE; + virtual bool DoGetPixel(int x, int y, wxColour* col) const wxOVERRIDE; + virtual void DoGetSize(int* width, int* height) const wxOVERRIDE; + virtual bool DoStretchBlit(int xdest, int ydest, int dstWidth, int dstHeight, wxDC* source, int xsrc, int ysrc, int srcWidth, int srcHeight, wxRasterOperationMode rop, bool useMask, int xsrcMask, int ysrcMask) wxOVERRIDE; + virtual void* GetCairoContext() const wxOVERRIDE; + + virtual wxSize GetPPI() const wxOVERRIDE; + virtual void SetLayoutDirection(wxLayoutDirection dir) wxOVERRIDE; + virtual wxLayoutDirection GetLayoutDirection() const wxOVERRIDE; + +protected: + // Set m_size from the given (valid) GdkWindow. + void InitSize(GdkWindow* window); + void AdjustForRTL(cairo_t* cr); + + wxSize m_size; + wxLayoutDirection m_layoutDir; + + wxDECLARE_NO_COPY_CLASS(wxGTKCairoDCImpl); +}; +//----------------------------------------------------------------------------- + +class wxWindowDCImpl: public wxGTKCairoDCImpl +{ +public: + wxWindowDCImpl(wxWindowDC* owner, wxWindow* window); + + wxDECLARE_NO_COPY_CLASS(wxWindowDCImpl); +}; +//----------------------------------------------------------------------------- + +class wxClientDCImpl: public wxGTKCairoDCImpl +{ +public: + wxClientDCImpl(wxClientDC* owner, wxWindow* window); + + wxDECLARE_NO_COPY_CLASS(wxClientDCImpl); +}; +//----------------------------------------------------------------------------- + +class wxPaintDCImpl: public wxGTKCairoDCImpl +{ + typedef wxGTKCairoDCImpl BaseType; +public: + wxPaintDCImpl(wxPaintDC* owner, wxWindow* window); + virtual void DestroyClippingRegion() wxOVERRIDE; + +private: + const wxRegion& m_clip; + + wxDECLARE_NO_COPY_CLASS(wxPaintDCImpl); +}; +//----------------------------------------------------------------------------- + +class wxScreenDCImpl: public wxGTKCairoDCImpl +{ +public: + wxScreenDCImpl(wxScreenDC* owner); + + virtual wxSize GetPPI() const wxOVERRIDE; + + wxDECLARE_NO_COPY_CLASS(wxScreenDCImpl); +}; +//----------------------------------------------------------------------------- + +class wxMemoryDCImpl: public wxGTKCairoDCImpl +{ +public: + wxMemoryDCImpl(wxMemoryDC* owner); + wxMemoryDCImpl(wxMemoryDC* owner, wxBitmap& bitmap); + wxMemoryDCImpl(wxMemoryDC* owner, wxDC* dc); + virtual wxBitmap DoGetAsBitmap(const wxRect* subrect) const wxOVERRIDE; + virtual void DoSelect(const wxBitmap& bitmap) wxOVERRIDE; + virtual const wxBitmap& GetSelectedBitmap() const wxOVERRIDE; + virtual wxBitmap& GetSelectedBitmap() wxOVERRIDE; + +private: + void Setup(); + wxBitmap m_bitmap; + + wxDECLARE_NO_COPY_CLASS(wxMemoryDCImpl); +}; +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGTKCairoDC: public wxDC +{ +public: + wxGTKCairoDC(cairo_t* cr, wxWindow* window, wxLayoutDirection dir = wxLayout_LeftToRight, int width = 0); + + wxDECLARE_NO_COPY_CLASS(wxGTKCairoDC); +}; + +#else + +#include "wx/dc.h" + +//----------------------------------------------------------------------------- +// wxDC +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGTKDCImpl : public wxDCImpl +{ +public: + wxGTKDCImpl( wxDC *owner ); + virtual ~wxGTKDCImpl(); + +#if wxUSE_PALETTE + void SetColourMap( const wxPalette& palette ) { SetPalette(palette); } +#endif // wxUSE_PALETTE + + // Resolution in pixels per logical inch + virtual wxSize GetPPI() const wxOVERRIDE; + + virtual bool StartDoc( const wxString& WXUNUSED(message) ) wxOVERRIDE { return true; } + virtual void EndDoc() wxOVERRIDE { } + virtual void StartPage() wxOVERRIDE { } + virtual void EndPage() wxOVERRIDE { } + + virtual GdkWindow* GetGDKWindow() const { return NULL; } + virtual void* GetHandle() const wxOVERRIDE { return GetGDKWindow(); } + + // base class pure virtuals implemented here + virtual void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE; + virtual void DoGetSizeMM(int* width, int* height) const wxOVERRIDE; + + wxDECLARE_ABSTRACT_CLASS(wxGTKDCImpl); +}; + +// this must be defined when wxDC::Blit() honours the DC origin and needed to +// allow wxUniv code in univ/winuniv.cpp to work with versions of wxGTK +// 2.3.[23] +#ifndef wxHAS_WORKING_GTK_DC_BLIT + #define wxHAS_WORKING_GTK_DC_BLIT +#endif + +#endif +#endif // _WX_GTKDC_H_ diff --git a/lib/wxWidgets/include/wx/gtk/dcclient.h b/lib/wxWidgets/include/wx/gtk/dcclient.h new file mode 100644 index 0000000..5c04100 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/dcclient.h @@ -0,0 +1,169 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/dcclient.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTKDCCLIENT_H_ +#define _WX_GTKDCCLIENT_H_ + +#include "wx/gtk/dc.h" + +//----------------------------------------------------------------------------- +// wxWindowDCImpl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWindowDCImpl : public wxGTKDCImpl +{ +public: + wxWindowDCImpl( wxDC *owner ); + wxWindowDCImpl( wxDC *owner, wxWindow *win ); + + virtual ~wxWindowDCImpl(); + + virtual bool CanDrawBitmap() const wxOVERRIDE { return true; } + virtual bool CanGetTextExtent() const wxOVERRIDE { return true; } + + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; + virtual bool DoFloodFill( wxCoord x, wxCoord y, const wxColour& col, + wxFloodFillStyle style=wxFLOOD_SURFACE ) wxOVERRIDE; + virtual bool DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const wxOVERRIDE; + + virtual void DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ) wxOVERRIDE; + virtual void DoCrossHair( wxCoord x, wxCoord y ) wxOVERRIDE; + virtual void DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, + wxCoord xc, wxCoord yc ) wxOVERRIDE; + virtual void DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord height, + double sa, double ea ) wxOVERRIDE; + virtual void DoDrawPoint( wxCoord x, wxCoord y ) wxOVERRIDE; + + virtual void DoDrawLines(int n, const wxPoint points[], + wxCoord xoffset, wxCoord yoffset) wxOVERRIDE; + virtual void DoDrawPolygon(int n, const wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + wxPolygonFillMode fillStyle = wxODDEVEN_RULE) wxOVERRIDE; + + virtual void DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) wxOVERRIDE; + virtual void DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0 ) wxOVERRIDE; + virtual void DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) wxOVERRIDE; + + virtual void DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ) wxOVERRIDE; + virtual void DoDrawBitmap( const wxBitmap &bitmap, wxCoord x, wxCoord y, + bool useMask = false ) wxOVERRIDE; + + virtual bool DoBlit( wxCoord xdest, wxCoord ydest, + wxCoord width, wxCoord height, + wxDC *source, wxCoord xsrc, wxCoord ysrc, + wxRasterOperationMode logical_func = wxCOPY, + bool useMask = false, + wxCoord xsrcMask = -1, wxCoord ysrcMask = -1 ) wxOVERRIDE; + + virtual void DoDrawText( const wxString &text, wxCoord x, wxCoord y ) wxOVERRIDE; + virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, + double angle) wxOVERRIDE; + virtual void DoGetTextExtent( const wxString &string, + wxCoord *width, wxCoord *height, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + const wxFont *theFont = NULL) const wxOVERRIDE; + virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const wxOVERRIDE; + virtual void DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) wxOVERRIDE; + virtual void DoSetDeviceClippingRegion( const wxRegion ®ion ) wxOVERRIDE; + virtual bool DoGetClippingRect(wxRect& rect) const wxOVERRIDE; + + virtual wxCoord GetCharWidth() const wxOVERRIDE; + virtual wxCoord GetCharHeight() const wxOVERRIDE; + + virtual void Clear() wxOVERRIDE; + + virtual void SetFont( const wxFont &font ) wxOVERRIDE; + virtual void SetPen( const wxPen &pen ) wxOVERRIDE; + virtual void SetBrush( const wxBrush &brush ) wxOVERRIDE; + virtual void SetBackground( const wxBrush &brush ) wxOVERRIDE; + virtual void SetLogicalFunction( wxRasterOperationMode function ) wxOVERRIDE; + virtual void SetTextForeground( const wxColour &col ) wxOVERRIDE; + virtual void SetTextBackground( const wxColour &col ) wxOVERRIDE; + virtual void SetBackgroundMode( int mode ) wxOVERRIDE; + +#if wxUSE_PALETTE + virtual void SetPalette( const wxPalette& palette ) wxOVERRIDE; +#endif + + virtual void DestroyClippingRegion() wxOVERRIDE; + + // Resolution in pixels per logical inch + virtual wxSize GetPPI() const wxOVERRIDE; + virtual int GetDepth() const wxOVERRIDE; + + // overridden here for RTL + virtual void SetDeviceOrigin( wxCoord x, wxCoord y ) wxOVERRIDE; + virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp ) wxOVERRIDE; + +// protected: + // implementation + // -------------- + + GdkWindow *m_gdkwindow; + GdkGC *m_penGC; + GdkGC *m_brushGC; + GdkGC *m_textGC; + GdkGC *m_bgGC; + GdkColormap *m_cmap; + bool m_isScreenDC; + wxRegion m_currentClippingRegion; + wxRegion m_paintClippingRegion; + bool m_isClipBoxValid; + + // PangoContext stuff for GTK 2.0 + PangoContext *m_context; + PangoLayout *m_layout; + PangoFontDescription *m_fontdesc; + + void SetUpDC( bool ismem = false ); + void Destroy(); + + virtual void ComputeScaleAndOrigin() wxOVERRIDE; + + virtual GdkWindow *GetGDKWindow() const wxOVERRIDE { return m_gdkwindow; } + + // Update the internal clip box variables + void UpdateClipBox(); + +private: + void DrawingSetup(GdkGC*& gc, bool& originChanged); + GdkPixmap* MonoToColor(GdkPixmap* monoPixmap, int x, int y, int w, int h) const; + + wxDECLARE_ABSTRACT_CLASS(wxWindowDCImpl); +}; + +//----------------------------------------------------------------------------- +// wxClientDCImpl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxClientDCImpl : public wxWindowDCImpl +{ +public: + wxClientDCImpl( wxDC *owner ); + wxClientDCImpl( wxDC *owner, wxWindow *win ); + + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; + + wxDECLARE_ABSTRACT_CLASS(wxClientDCImpl); +}; + +//----------------------------------------------------------------------------- +// wxPaintDCImpl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPaintDCImpl : public wxClientDCImpl +{ +public: + wxPaintDCImpl( wxDC *owner ); + wxPaintDCImpl( wxDC *owner, wxWindow *win ); + + wxDECLARE_ABSTRACT_CLASS(wxPaintDCImpl); +}; + +#endif // _WX_GTKDCCLIENT_H_ diff --git a/lib/wxWidgets/include/wx/gtk/dcmemory.h b/lib/wxWidgets/include/wx/gtk/dcmemory.h new file mode 100644 index 0000000..08036ac --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/dcmemory.h @@ -0,0 +1,59 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/dcmemory.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_DCMEMORY_H_ +#define _WX_GTK_DCMEMORY_H_ + +#include "wx/dcmemory.h" +#include "wx/gtk/dcclient.h" + +//----------------------------------------------------------------------------- +// wxMemoryDCImpl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMemoryDCImpl : public wxWindowDCImpl +{ +public: + wxMemoryDCImpl( wxMemoryDC *owner ); + wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap ); + wxMemoryDCImpl( wxMemoryDC *owner, wxDC *dc ); + + virtual ~wxMemoryDCImpl(); + + // these get reimplemented for mono-bitmaps to behave + // more like their Win32 counterparts. They now interpret + // wxWHITE, wxWHITE_BRUSH and wxWHITE_PEN as drawing 0 + // and everything else as drawing 1. + virtual void SetPen( const wxPen &pen ) wxOVERRIDE; + virtual void SetBrush( const wxBrush &brush ) wxOVERRIDE; + virtual void SetBackground( const wxBrush &brush ) wxOVERRIDE; + virtual void SetTextForeground( const wxColour &col ) wxOVERRIDE; + virtual void SetTextBackground( const wxColour &col ) wxOVERRIDE; + + // overridden from wxDCImpl + virtual void DoGetSize( int *width, int *height ) const wxOVERRIDE; + virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const wxOVERRIDE; + virtual void* GetHandle() const wxOVERRIDE; + + // overridden for wxMemoryDC Impl + virtual void DoSelect(const wxBitmap& bitmap) wxOVERRIDE; + + virtual const wxBitmap& GetSelectedBitmap() const wxOVERRIDE; + virtual wxBitmap& GetSelectedBitmap() wxOVERRIDE; + +private: + wxBitmap m_selected; + + void Init(); + + wxDECLARE_ABSTRACT_CLASS(wxMemoryDCImpl); +}; + +#endif + // _WX_GTK_DCMEMORY_H_ + diff --git a/lib/wxWidgets/include/wx/gtk/dcscreen.h b/lib/wxWidgets/include/wx/gtk/dcscreen.h new file mode 100644 index 0000000..f59d6e3 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/dcscreen.h @@ -0,0 +1,33 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/dcscreen.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTKDCSCREEN_H_ +#define _WX_GTKDCSCREEN_H_ + +#include "wx/dcscreen.h" +#include "wx/gtk/dcclient.h" + +//----------------------------------------------------------------------------- +// wxScreenDCImpl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxScreenDCImpl : public wxWindowDCImpl +{ +public: + wxScreenDCImpl( wxScreenDC *owner ); + ~wxScreenDCImpl(); + + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; + +private: + void Init(); + + wxDECLARE_ABSTRACT_CLASS(wxScreenDCImpl); +}; + +#endif // _WX_GTKDCSCREEN_H_ diff --git a/lib/wxWidgets/include/wx/gtk/dialog.h b/lib/wxWidgets/include/wx/gtk/dialog.h new file mode 100644 index 0000000..29f2fb5 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/dialog.h @@ -0,0 +1,52 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/dialog.h +// Purpose: +// Author: Robert Roebling +// Created: +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTKDIALOG_H_ +#define _WX_GTKDIALOG_H_ + +class WXDLLIMPEXP_FWD_CORE wxGUIEventLoop; + +//----------------------------------------------------------------------------- +// wxDialog +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDialog: public wxDialogBase +{ +public: + wxDialog() { Init(); } + wxDialog( wxWindow *parent, wxWindowID id, + const wxString &title, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString &name = wxASCII_STR(wxDialogNameStr) ); + bool Create( wxWindow *parent, wxWindowID id, + const wxString &title, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString &name = wxASCII_STR(wxDialogNameStr) ); + virtual ~wxDialog(); + + virtual bool Show( bool show = true ) wxOVERRIDE; + virtual int ShowModal() wxOVERRIDE; + virtual void EndModal( int retCode ) wxOVERRIDE; + virtual bool IsModal() const wxOVERRIDE; + +private: + // common part of all ctors + void Init(); + + bool m_modalShowing; + wxGUIEventLoop *m_modalLoop; + + wxDECLARE_DYNAMIC_CLASS(wxDialog); +}; + +#endif // _WX_GTKDIALOG_H_ diff --git a/lib/wxWidgets/include/wx/gtk/dirdlg.h b/lib/wxWidgets/include/wx/gtk/dirdlg.h new file mode 100644 index 0000000..e25e0b2 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/dirdlg.h @@ -0,0 +1,60 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/dirdlg.h +// Purpose: wxDirDialog +// Author: Francesco Montorsi +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKDIRDLGH__ +#define __GTKDIRDLGH__ + +//------------------------------------------------------------------------- +// wxDirDialog +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDirDialog : public wxDirDialogBase +{ +public: + wxDirDialog() { } + + wxDirDialog(wxWindow *parent, + const wxString& message = wxASCII_STR(wxDirSelectorPromptStr), + const wxString& defaultPath = wxEmptyString, + long style = wxDD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxString& name = wxASCII_STR(wxDirDialogNameStr)); + bool Create(wxWindow *parent, + const wxString& message = wxASCII_STR(wxDirSelectorPromptStr), + const wxString& defaultPath = wxEmptyString, + long style = wxDD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxString& name = wxASCII_STR(wxDirDialogNameStr)); + virtual ~wxDirDialog() { } + + +public: // overrides from wxGenericDirDialog + + void SetPath(const wxString& path) wxOVERRIDE; + + + // Implementation only. + + void GTKOnAccept(); + void GTKOnCancel(); + +protected: + // override this from wxTLW since the native + // form doesn't have any m_wxwindow + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; + + +private: + wxDECLARE_DYNAMIC_CLASS(wxDirDialog); +}; + +#endif // __GTKDIRDLGH__ diff --git a/lib/wxWidgets/include/wx/gtk/dnd.h b/lib/wxWidgets/include/wx/gtk/dnd.h new file mode 100644 index 0000000..3c771e2 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/dnd.h @@ -0,0 +1,124 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/dnd.h +// Purpose: declaration of the wxDropTarget class +// Author: Robert Roebling +// Copyright: (c) 1998 Vadim Zeitlin, Robert Roebling +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_DND_H_ +#define _WX_GTK_DND_H_ + +#include "wx/icon.h" + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +// this macro may be used instead for wxDropSource ctor arguments: it will use +// the icon 'name' from an XPM file under GTK, but will expand to something +// else under MSW. If you don't use it, you will have to use #ifdef in the +// application code. +#define wxDROP_ICON(name) wxICON(name) + +//------------------------------------------------------------------------- +// wxDropTarget +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDropTarget: public wxDropTargetBase +{ +public: + wxDropTarget(wxDataObject *dataObject = NULL ); + + virtual wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def) wxOVERRIDE; + virtual bool OnDrop(wxCoord x, wxCoord y) wxOVERRIDE; + virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def) wxOVERRIDE; + virtual bool GetData() wxOVERRIDE; + + // Can only be called during OnXXX methods. + wxDataFormat GetMatchingPair(); + + // implementation + + GdkAtom GTKGetMatchingPair(bool quiet = false); + wxDragResult GTKFigureOutSuggestedAction(); + + void GtkRegisterWidget( GtkWidget *widget ); + void GtkUnregisterWidget( GtkWidget *widget ); + + GdkDragContext *m_dragContext; + GtkWidget *m_dragWidget; + GtkSelectionData *m_dragData; + unsigned m_dragTime; + bool m_firstMotion; // gdk has no "gdk_drag_enter" event + + void GTKSetDragContext( GdkDragContext *dc ) { m_dragContext = dc; } + void GTKSetDragWidget( GtkWidget *w ) { m_dragWidget = w; } + void GTKSetDragData( GtkSelectionData *sd ) { m_dragData = sd; } + void GTKSetDragTime(unsigned time) { m_dragTime = time; } +}; + +//------------------------------------------------------------------------- +// wxDropSource +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDropSource: public wxDropSourceBase +{ +public: + // constructor. set data later with SetData() + wxDropSource( wxWindow *win = NULL, + const wxIcon © = wxNullIcon, + const wxIcon &move = wxNullIcon, + const wxIcon &none = wxNullIcon); + + // constructor for setting one data object + wxDropSource( wxDataObject& data, + wxWindow *win, + const wxIcon © = wxNullIcon, + const wxIcon &move = wxNullIcon, + const wxIcon &none = wxNullIcon); + + virtual ~wxDropSource(); + + // set the icon corresponding to given drag result + void SetIcon(wxDragResult res, const wxIcon& icon) + { + if ( res == wxDragCopy ) + m_iconCopy = icon; + else if ( res == wxDragMove ) + m_iconMove = icon; + else + m_iconNone = icon; + } + + // start drag action + virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly) wxOVERRIDE; + + void PrepareIcon( int action, GdkDragContext *context ); + + GtkWidget *m_widget; + GtkWidget *m_iconWindow; + GdkDragContext *m_dragContext; + wxWindow *m_window; + + wxDragResult m_retValue; + wxIcon m_iconCopy, + m_iconMove, + m_iconNone; + + bool m_waiting; + +private: + // common part of both ctors + void SetIcons(const wxIcon& copy, + const wxIcon& move, + const wxIcon& none); + + // GTK implementation + void GTKConnectDragSignals(); + void GTKDisconnectDragSignals(); + +}; + +#endif // _WX_GTK_DND_H_ + diff --git a/lib/wxWidgets/include/wx/gtk/dvrenderer.h b/lib/wxWidgets/include/wx/gtk/dvrenderer.h new file mode 100644 index 0000000..0704b89 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/dvrenderer.h @@ -0,0 +1,111 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/dvrenderer.h +// Purpose: wxDataViewRenderer for GTK wxDataViewCtrl implementation +// Author: Robert Roebling, Vadim Zeitlin +// Created: 2009-11-07 (extracted from wx/gtk/dataview.h) +// Copyright: (c) 2006 Robert Roebling +// (c) 2009 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_DVRENDERER_H_ +#define _WX_GTK_DVRENDERER_H_ + +typedef struct _GtkCellRendererText GtkCellRendererText; +typedef struct _GtkTreeViewColumn GtkTreeViewColumn; + +// ---------------------------------------------------------------------------- +// wxDataViewRenderer +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewRenderer: public wxDataViewRendererBase +{ +public: + wxDataViewRenderer( const wxString &varianttype, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT ); + + virtual void SetMode( wxDataViewCellMode mode ) wxOVERRIDE; + virtual wxDataViewCellMode GetMode() const wxOVERRIDE; + + virtual void SetAlignment( int align ) wxOVERRIDE; + virtual int GetAlignment() const wxOVERRIDE; + + virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE) wxOVERRIDE; + virtual wxEllipsizeMode GetEllipsizeMode() const wxOVERRIDE; + + virtual bool FinishEditing() wxOVERRIDE; + + // GTK-specific implementation + // --------------------------- + + // pack the GTK cell renderers used by this renderer to the given column + // + // by default only a single m_renderer is used but some renderers use more + // than one GTK cell renderer + virtual void GtkPackIntoColumn(GtkTreeViewColumn *column); + + // called when the cell value was edited by user with the new value + // + // it uses GtkGetValueFromString() to parse the new value, then validates + // it by calling Validate() and notifies the model about the change if it + // passes validation + void GtkOnTextEdited(const char *itempath, const wxString& value); + + GtkCellRenderer* GetGtkHandle() { return m_renderer; } + void GtkInitHandlers(); + virtual void GtkUpdateAlignment() { GtkApplyAlignment(m_renderer); } + + // return the text renderer used by this renderer for setting text cell + // specific attributes: can return NULL if this renderer doesn't render any + // text + virtual GtkCellRendererText *GtkGetTextRenderer() const { return NULL; } + + // return the widget actually used by the renderer for editing, this may be + // different from the editor control widget for the custom renderers + virtual GtkWidget* GtkGetEditorWidget() const; + + void GtkSetCurrentItem(const wxDataViewItem& item) { m_itemBeingRendered = item; } + +private: + // Change the mode at GTK level without touching m_mode, this is useful for + // temporarily making the renderer insensitive but does mean that GetMode() + // may return a value different from the actual GTK renderer mode. + void GtkSetMode(wxDataViewCellMode mode); + +protected: + virtual void SetAttr(const wxDataViewItemAttr& attr) wxOVERRIDE; + virtual void SetEnabled(bool enabled) wxOVERRIDE; + + virtual bool IsHighlighted() const wxOVERRIDE; + + // Apply our effective alignment (i.e. m_alignment if specified or the + // associated column alignment by default) to the given renderer. + void GtkApplyAlignment(GtkCellRenderer *renderer); + + // This method is used to interpret the string entered by user and by + // default just uses it as is, but can be overridden for classes requiring + // special treatment. + virtual wxVariant GtkGetValueFromString(const wxString& str) const; + + + GtkCellRenderer *m_renderer; + int m_alignment; + + // We store the renderer mode at wx level as it can differ from the mode of + // the corresponding GTK+ renderer as explained above. + wxDataViewCellMode m_mode; + + // true if we hadn't changed any visual attributes or restored them since + // doing this + bool m_usingDefaultAttrs; + + // the item currently being rendered + wxDataViewItem m_itemBeingRendered; + +protected: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer); +}; + +#endif // _WX_GTK_DVRENDERER_H_ + diff --git a/lib/wxWidgets/include/wx/gtk/dvrenderers.h b/lib/wxWidgets/include/wx/gtk/dvrenderers.h new file mode 100644 index 0000000..e8a65c3 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/dvrenderers.h @@ -0,0 +1,295 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/dvrenderers.h +// Purpose: All GTK wxDataViewCtrl renderer classes +// Author: Robert Roebling, Vadim Zeitlin +// Created: 2009-11-07 (extracted from wx/gtk/dataview.h) +// Copyright: (c) 2006 Robert Roebling +// (c) 2009 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_DVRENDERERS_H_ +#define _WX_GTK_DVRENDERERS_H_ + +#ifdef __WXGTK3__ + typedef struct _cairo_rectangle_int cairo_rectangle_int_t; + typedef cairo_rectangle_int_t GdkRectangle; +#else + typedef struct _GdkRectangle GdkRectangle; +#endif + +// --------------------------------------------------------- +// wxDataViewTextRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer +{ +public: + static wxString GetDefaultType() { return wxS("string"); } + + wxDataViewTextRenderer( const wxString &varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT ); + +#if wxUSE_MARKUP + void EnableMarkup(bool enable = true); +#endif // wxUSE_MARKUP + + virtual bool SetValue( const wxVariant &value ) wxOVERRIDE + { + return SetTextValue(value); + } + + virtual bool GetValue( wxVariant &value ) const wxOVERRIDE + { + wxString str; + if ( !GetTextValue(str) ) + return false; + + value = str; + + return true; + } + + virtual void GtkUpdateAlignment() wxOVERRIDE; + + virtual GtkCellRendererText *GtkGetTextRenderer() const wxOVERRIDE; + +protected: + virtual void SetAttr(const wxDataViewItemAttr& attr) wxOVERRIDE; + + // implementation of Set/GetValue() + bool SetTextValue(const wxString& str); + bool GetTextValue(wxString& str) const; + + // Return the name of the GtkCellRendererText property to use: "text" or + // "markup". + const char* GetTextPropertyName() const; + +#if wxUSE_MARKUP + // True if we should interpret markup in our text. + bool m_useMarkup; +#endif // wxUSE_MARKUP + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer); +}; + +// --------------------------------------------------------- +// wxDataViewBitmapRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer +{ +public: + static wxString GetDefaultType() { return wxS("wxBitmapBundle"); } + + wxDataViewBitmapRenderer( const wxString &varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT ); + + bool SetValue( const wxVariant &value ) wxOVERRIDE; + bool GetValue( wxVariant &value ) const wxOVERRIDE; + + virtual + bool IsCompatibleVariantType(const wxString& variantType) const wxOVERRIDE; + +protected: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer); +}; + +// --------------------------------------------------------- +// wxDataViewToggleRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer +{ +public: + static wxString GetDefaultType() { return wxS("bool"); } + + wxDataViewToggleRenderer( const wxString &varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT ); + + void ShowAsRadio(); + + bool SetValue( const wxVariant &value ) wxOVERRIDE; + bool GetValue( wxVariant &value ) const wxOVERRIDE; + +protected: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer); +}; + +// --------------------------------------------------------- +// wxDataViewCustomRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewCustomRenderer: public wxDataViewCustomRendererBase +{ +public: + static wxString GetDefaultType() { return wxS("string"); } + + wxDataViewCustomRenderer( const wxString &varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT, + bool no_init = false ); + virtual ~wxDataViewCustomRenderer(); + + + // Create DC on request + virtual wxDC *GetDC() wxOVERRIDE; + + // override the base class function to use GTK text cell renderer + virtual void RenderText(const wxString& text, + int xoffset, + wxRect cell, + wxDC *dc, + int state) wxOVERRIDE; + + struct GTKRenderParams; + + // store GTK render call parameters for possible later use + void GTKSetRenderParams(GTKRenderParams* renderParams) + { + m_renderParams = renderParams; + } + + virtual GtkCellRendererText *GtkGetTextRenderer() const wxOVERRIDE; + virtual GtkWidget* GtkGetEditorWidget() const wxOVERRIDE; + + virtual void GtkUpdateAlignment() wxOVERRIDE; + +private: + bool Init(wxDataViewCellMode mode, int align); + + // Called from GtkGetTextRenderer() to really create the renderer if + // necessary. + void GtkInitTextRenderer(); + + wxDC *m_dc; + + GtkCellRendererText *m_text_renderer; + + // parameters of the original render() call stored so that we could pass + // them forward to m_text_renderer if our RenderText() is called + GTKRenderParams* m_renderParams; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer); +}; + +// --------------------------------------------------------- +// wxDataViewProgressRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewCustomRenderer +{ +public: + static wxString GetDefaultType() { return wxS("long"); } + + wxDataViewProgressRenderer( const wxString &label = wxEmptyString, + const wxString &varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT ); + virtual ~wxDataViewProgressRenderer(); + + bool SetValue( const wxVariant &value ) wxOVERRIDE; + bool GetValue( wxVariant &value ) const wxOVERRIDE; + + virtual bool Render( wxRect cell, wxDC *dc, int state ) wxOVERRIDE; + virtual wxSize GetSize() const wxOVERRIDE; + +private: + void GTKSetLabel(); + + wxString m_label; + int m_value; + +#if !wxUSE_UNICODE + // Flag used to indicate that we need to set the label because we were + // unable to do it in the ctor (see comments there). + bool m_needsToSetLabel; +#endif // !wxUSE_UNICODE + +protected: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer); +}; + +// --------------------------------------------------------- +// wxDataViewIconTextRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewTextRenderer +{ + typedef wxDataViewTextRenderer BaseType; +public: + static wxString GetDefaultType() { return wxS("wxDataViewIconText"); } + + wxDataViewIconTextRenderer( const wxString &varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT ); + virtual ~wxDataViewIconTextRenderer(); + + bool SetValue( const wxVariant &value ) wxOVERRIDE; + bool GetValue( wxVariant &value ) const wxOVERRIDE; + + virtual void GtkPackIntoColumn(GtkTreeViewColumn *column) wxOVERRIDE; + +protected: + virtual void SetAttr(const wxDataViewItemAttr& attr) wxOVERRIDE; + virtual wxVariant GtkGetValueFromString(const wxString& str) const wxOVERRIDE; + +private: + wxDataViewIconText m_value; + + // we use the base class m_renderer for the text and this one for the icon + GtkCellRenderer *m_rendererIcon; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer); +}; + +// ------------------------------------- +// wxDataViewChoiceRenderer +// ------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewChoiceRenderer: public wxDataViewCustomRenderer +{ +public: + wxDataViewChoiceRenderer(const wxArrayString &choices, + wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, + int alignment = wxDVR_DEFAULT_ALIGNMENT ); + virtual bool Render( wxRect rect, wxDC *dc, int state ) wxOVERRIDE; + virtual wxSize GetSize() const wxOVERRIDE; + virtual bool SetValue( const wxVariant &value ) wxOVERRIDE; + virtual bool GetValue( wxVariant &value ) const wxOVERRIDE; + + virtual void GtkUpdateAlignment() wxOVERRIDE; + + wxString GetChoice(size_t index) const { return m_choices[index]; } + const wxArrayString& GetChoices() const { return m_choices; } + +private: + wxArrayString m_choices; + wxString m_data; +}; + +// ---------------------------------------------------------------------------- +// wxDataViewChoiceByIndexRenderer +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewChoiceByIndexRenderer: public wxDataViewChoiceRenderer +{ +public: + wxDataViewChoiceByIndexRenderer( const wxArrayString &choices, + wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, + int alignment = wxDVR_DEFAULT_ALIGNMENT ); + + virtual bool SetValue( const wxVariant &value ) wxOVERRIDE; + virtual bool GetValue( wxVariant &value ) const wxOVERRIDE; + +private: + virtual wxVariant GtkGetValueFromString(const wxString& str) const wxOVERRIDE; +}; + + + +#endif // _WX_GTK_DVRENDERERS_H_ + diff --git a/lib/wxWidgets/include/wx/gtk/evtloop.h b/lib/wxWidgets/include/wx/gtk/evtloop.h new file mode 100644 index 0000000..0e3c1b1 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/evtloop.h @@ -0,0 +1,47 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/evtloop.h +// Purpose: wxGTK event loop implementation +// Author: Vadim Zeitlin +// Created: 2008-12-27 +// Copyright: (c) 2008 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_EVTLOOP_H_ +#define _WX_GTK_EVTLOOP_H_ + +// ---------------------------------------------------------------------------- +// wxGUIEventLoop for wxGTK +// ---------------------------------------------------------------------------- + +typedef union _GdkEvent GdkEvent; + +class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxEventLoopBase +{ +public: + wxGUIEventLoop(); + + virtual void ScheduleExit(int rc = 0) wxOVERRIDE; + virtual bool Pending() const wxOVERRIDE; + virtual bool Dispatch() wxOVERRIDE; + virtual int DispatchTimeout(unsigned long timeout) wxOVERRIDE; + virtual void WakeUp() wxOVERRIDE; + + void StoreGdkEventForLaterProcessing(GdkEvent* ev) + { m_arrGdkEvents.Add(ev); } + +protected: + virtual int DoRun() wxOVERRIDE; + virtual void DoYieldFor(long eventsToProcess) wxOVERRIDE; + +private: + // the exit code of this event loop + int m_exitcode; + + // used to temporarily store events in DoYield() + wxArrayPtrVoid m_arrGdkEvents; + + wxDECLARE_NO_COPY_CLASS(wxGUIEventLoop); +}; + +#endif // _WX_GTK_EVTLOOP_H_ diff --git a/lib/wxWidgets/include/wx/gtk/evtloopsrc.h b/lib/wxWidgets/include/wx/gtk/evtloopsrc.h new file mode 100644 index 0000000..f805234 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/evtloopsrc.h @@ -0,0 +1,39 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/evtloopsrc.h +// Purpose: wxGTKEventLoopSource class +// Author: Vadim Zeitlin +// Created: 2009-10-21 +// Copyright: (c) 2009 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_EVTLOOPSRC_H_ +#define _WX_GTK_EVTLOOPSRC_H_ + +// ---------------------------------------------------------------------------- +// wxGTKEventLoopSource: wxEventLoopSource for GTK port +// ---------------------------------------------------------------------------- + +class wxGTKEventLoopSource : public wxEventLoopSource +{ +public: + // sourceId is the id of the watch in GTK context, not the FD of the file + // this source corresponds to + wxGTKEventLoopSource(unsigned sourceId, + wxEventLoopSourceHandler *handler, + int flags) + : wxEventLoopSource(handler, flags), + m_sourceId(sourceId) + { + } + + virtual ~wxGTKEventLoopSource(); + +private: + const unsigned m_sourceId; + + wxDECLARE_NO_COPY_CLASS(wxGTKEventLoopSource); +}; + +#endif // _WX_GTK_EVTLOOPSRC_H_ + diff --git a/lib/wxWidgets/include/wx/gtk/filectrl.h b/lib/wxWidgets/include/wx/gtk/filectrl.h new file mode 100644 index 0000000..870c575 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/filectrl.h @@ -0,0 +1,144 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/filectrl.h +// Purpose: wxGtkFileCtrl Header +// Author: Diaa M. Sami +// Modified by: +// Created: Aug-10-2007 +// Copyright: (c) Diaa M. Sami +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + + +#ifndef _WX_GTK_FILECTRL_H_ +#define _WX_GTK_FILECTRL_H_ + +#include "wx/control.h" +#include "wx/filectrl.h" + +extern WXDLLIMPEXP_DATA_CORE(const char) wxFileSelectorDefaultWildcardStr[]; + +typedef struct _GtkFileChooser GtkFileChooser; + +// [GTK] current problems: +// All methods(e.g. SetFilename(), SetPath(), etc) which change the state of +// the control result in events fired, such events should be suppressed. +// ------ +// Sometimes a selection event(with 0 files) is fired before +// wxEVT_FILECTRL_FOLDERCHANGED, unfortunately this can hardly be detected! + +// A wx wrapper for any Gtk object implementing the interface GtkFileChooser + +class WXDLLIMPEXP_CORE wxGtkFileChooser +{ +public: + wxGtkFileChooser() { m_ignoreNextFilterEvent = false; } + + void SetWidget(GtkFileChooser *w); + + wxString GetPath() const; + void GetPaths( wxArrayString& paths ) const; + wxString GetDirectory() const; + wxString GetFilename() const; + void GetFilenames( wxArrayString& files ) const; + int GetFilterIndex() const; + + bool SetPath( const wxString& path ); + bool SetDirectory( const wxString& dir ); + void SetWildcard( const wxString& wildCard ); + void SetFilterIndex( int filterIndex ); + + bool HasFilterChoice() const; + + bool ShouldIgnoreNextFilterEvent() const { return m_ignoreNextFilterEvent; } + + wxString GetCurrentWildCard() const + { return m_wildcards[GetFilterIndex()]; } + +private: + GtkFileChooser *m_widget; + // First wildcard in filter, to be used when the user + // saves a file without giving an extension. + wxArrayString m_wildcards; + + // If true, ignore the next event because it was generated by us and not + // the user. + bool m_ignoreNextFilterEvent; +}; + +#if wxUSE_FILECTRL + +class WXDLLIMPEXP_CORE wxGtkFileCtrl: public wxControl, + public wxFileCtrlBase +{ +public: + wxGtkFileCtrl () { Init(); } + + wxGtkFileCtrl ( wxWindow *parent, + wxWindowID id, + const wxString& defaultDirectory = wxEmptyString, + const wxString& defaultFilename = wxEmptyString, + const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + long style = wxFC_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxString& name = wxASCII_STR(wxFileCtrlNameStr) ) + { + Init(); + Create( parent, id, defaultDirectory, defaultFilename, wildCard, style, pos, size, name ); + } + + virtual ~wxGtkFileCtrl(); + + bool Create( wxWindow *parent, + wxWindowID id, + const wxString& defaultDirectory = wxEmptyString, + const wxString& defaultFileName = wxEmptyString, + const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + long style = wxFC_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxString& name = wxASCII_STR(wxFileCtrlNameStr) ); + + virtual void SetWildcard( const wxString& wildCard ) wxOVERRIDE; + virtual void SetFilterIndex( int filterIndex ) wxOVERRIDE; + virtual bool SetDirectory( const wxString& dir ) wxOVERRIDE; + virtual bool SetFilename( const wxString& name ) wxOVERRIDE; + virtual bool SetPath( const wxString& path ) wxOVERRIDE; + + virtual wxString GetFilename() const wxOVERRIDE; + virtual wxString GetDirectory() const wxOVERRIDE; + virtual wxString GetWildcard() const wxOVERRIDE { return this->m_wildCard; } + virtual wxString GetPath() const wxOVERRIDE; + virtual void GetPaths( wxArrayString& paths ) const wxOVERRIDE; + virtual void GetFilenames( wxArrayString& files ) const wxOVERRIDE; + virtual int GetFilterIndex() const wxOVERRIDE { return m_fc.GetFilterIndex(); } + + virtual bool HasMultipleFileSelection() const wxOVERRIDE { return HasFlag( wxFC_MULTIPLE ); } + virtual void ShowHidden(bool show) wxOVERRIDE; + + virtual bool HasFilterChoice() const + { return m_fc.HasFilterChoice(); } + + + // Implementation only from now on. + bool GTKShouldIgnoreNextFilterEvent() const + { return m_fc.ShouldIgnoreNextFilterEvent(); } + + bool m_checkNextSelEvent; + bool m_ignoreNextFolderChangeEvent; + +protected: + GtkFileChooser *m_fcWidget; + wxGtkFileChooser m_fc; + wxString m_wildCard; + +private: + void Init(); + + wxDECLARE_DYNAMIC_CLASS(wxGtkFileCtrl); +}; + +#endif // wxUSE_FILECTRL + +#endif // _WX_GTK_FILECTRL_H_ + diff --git a/lib/wxWidgets/include/wx/gtk/filedlg.h b/lib/wxWidgets/include/wx/gtk/filedlg.h new file mode 100644 index 0000000..809805d --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/filedlg.h @@ -0,0 +1,86 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/filedlg.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTKFILEDLG_H_ +#define _WX_GTKFILEDLG_H_ + +#include "wx/gtk/filectrl.h" // for wxGtkFileChooser + +//------------------------------------------------------------------------- +// wxFileDialog +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFileDialog: public wxFileDialogBase +{ +public: + wxFileDialog() { } + + wxFileDialog(wxWindow *parent, + const wxString& message = wxASCII_STR(wxFileSelectorPromptStr), + const wxString& defaultDir = wxEmptyString, + const wxString& defaultFile = wxEmptyString, + const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + long style = wxFD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + const wxString& name = wxASCII_STR(wxFileDialogNameStr)); + bool Create(wxWindow *parent, + const wxString& message = wxASCII_STR(wxFileSelectorPromptStr), + const wxString& defaultDir = wxEmptyString, + const wxString& defaultFile = wxEmptyString, + const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + long style = wxFD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + const wxString& name = wxASCII_STR(wxFileDialogNameStr)); + virtual ~wxFileDialog(); + + virtual wxString GetPath() const wxOVERRIDE; + virtual void GetPaths(wxArrayString& paths) const wxOVERRIDE; + virtual wxString GetFilename() const wxOVERRIDE; + virtual void GetFilenames(wxArrayString& files) const wxOVERRIDE; + virtual int GetFilterIndex() const wxOVERRIDE; + + virtual void SetMessage(const wxString& message) wxOVERRIDE; + virtual void SetPath(const wxString& path) wxOVERRIDE; + virtual void SetDirectory(const wxString& dir) wxOVERRIDE; + virtual void SetFilename(const wxString& name) wxOVERRIDE; + virtual void SetWildcard(const wxString& wildCard) wxOVERRIDE; + virtual void SetFilterIndex(int filterIndex) wxOVERRIDE; + + virtual int ShowModal() wxOVERRIDE; + +#if wxABI_VERSION >= 30201 + bool AddShortcut(const wxString& directory, int flags = 0); +#endif // wxABI_VERSION >= 3.2.1 + virtual bool SupportsExtraControl() const wxOVERRIDE { return true; } + + // Implementation only. + void GTKSelectionChanged(const wxString& filename); + + +protected: + // override this from wxTLW since the native + // form doesn't have any m_wxwindow + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; + + +private: + void OnFakeOk( wxCommandEvent &event ); + void OnSize(wxSizeEvent&); + virtual void AddChildGTK(wxWindowGTK* child) wxOVERRIDE; + + wxGtkFileChooser m_fc; + + wxDECLARE_DYNAMIC_CLASS(wxFileDialog); + wxDECLARE_EVENT_TABLE(); +}; + +#endif // _WX_GTKFILEDLG_H_ diff --git a/lib/wxWidgets/include/wx/gtk/filehistory.h b/lib/wxWidgets/include/wx/gtk/filehistory.h new file mode 100644 index 0000000..edeb175 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/filehistory.h @@ -0,0 +1,24 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/filehistory.h +// Purpose: GTK+ bits for wxFileHistory +// Author: Vaclav Slavik +// Created: 2010-05-06 +// Copyright: (c) 2010 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_FILEHISTORY_H_ +#define _WX_GTK_FILEHISTORY_H_ + +class WXDLLIMPEXP_CORE wxFileHistory : public wxFileHistoryBase +{ +public: + wxFileHistory(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1) + : wxFileHistoryBase(maxFiles, idBase) {} + + virtual void AddFileToHistory(const wxString& file) wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxFileHistory); +}; + +#endif // _WX_GTK_FILEHISTORY_H_ diff --git a/lib/wxWidgets/include/wx/gtk/filepicker.h b/lib/wxWidgets/include/wx/gtk/filepicker.h new file mode 100644 index 0000000..b2ab35c --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/filepicker.h @@ -0,0 +1,196 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/filedirpicker.h +// Purpose: wxFileButton, wxDirButton header +// Author: Francesco Montorsi +// Modified by: +// Created: 14/4/2006 +// Copyright: (c) Francesco Montorsi +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_FILEPICKER_H_ +#define _WX_GTK_FILEPICKER_H_ + +// since GtkColorButton is available only for GTK+ >= 2.4, +// we need to use generic versions if we detect (at runtime) +// that GTK+ < 2.4 +#include "wx/generic/filepickerg.h" + +//----------------------------------------------------------------------------- +// wxFileButton and wxDirButton shared code +// (cannot be a base class since they need to derive from wxGenericFileButton +// and from wxGenericDirButton classes !) +//----------------------------------------------------------------------------- + +#define FILEDIRBTN_OVERRIDES \ + /* NULL is because of a problem with destruction order which happens */ \ + /* if we pass GetParent(): in fact, this GTK native implementation */ \ + /* needs to create the dialog in ::Create() and not for each user */ \ + /* request in response to the user click as the generic implementation */ \ + /* does. */ \ + virtual wxWindow *GetDialogParent() wxOVERRIDE \ + { \ + return NULL; \ + } \ + \ + /* even if wx derive from wxGenericFileButton, i.e. from wxButton, our */ \ + /* native GTK+ widget does not derive from GtkButton thus *all* uses */ \ + /* GTK_BUTTON(m_widget) macro done by wxButton must be bypassed to */ \ + /* avoid bunch of GTK+ warnings like: */ \ + /* invalid cast from `GtkFileChooserButton' to `GtkButton' */ \ + /* so, override wxButton::GTKGetWindow and return NULL as GTK+ doesn't */ \ + /* give us access to the internal GdkWindow of a GtkFileChooserButton */ \ +protected: \ + virtual GdkWindow * \ + GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const wxOVERRIDE \ + { return NULL; } + + +//----------------------------------------------------------------------------- +// wxFileButton +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFileButton : public wxGenericFileButton +{ +public: + wxFileButton() { Init(); } + wxFileButton(wxWindow *parent, + wxWindowID id, + const wxString& label = wxASCII_STR(wxFilePickerWidgetLabel), + const wxString &path = wxEmptyString, + const wxString &message = wxASCII_STR(wxFileSelectorPromptStr), + const wxString &wildcard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxFILEBTN_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxFilePickerWidgetNameStr)) + { + Init(); + m_pickerStyle = style; + Create(parent, id, label, path, message, wildcard, + pos, size, style, validator, name); + } + + virtual ~wxFileButton(); + + +public: // overrides + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label = wxASCII_STR(wxFilePickerWidgetLabel), + const wxString &path = wxEmptyString, + const wxString &message = wxASCII_STR(wxFileSelectorPromptStr), + const wxString &wildcard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxFilePickerWidgetNameStr)); + + // event handler for the click + void OnDialogOK(wxCommandEvent &); + + virtual void SetPath(const wxString &str) wxOVERRIDE; + virtual void SetInitialDirectory(const wxString& dir) wxOVERRIDE; + + // see macro defined above + FILEDIRBTN_OVERRIDES + +protected: + wxDialog *m_dialog; + + virtual void DoApplyWidgetStyle(GtkRcStyle*) wxOVERRIDE; + +private: + // common part of all ctors + void Init() { m_dialog = NULL; } + + wxDECLARE_DYNAMIC_CLASS(wxFileButton); +}; + + +//----------------------------------------------------------------------------- +// wxDirButton +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDirButton : public wxGenericDirButton +{ +public: + wxDirButton() { Init(); } + wxDirButton(wxWindow *parent, + wxWindowID id, + const wxString& label = wxASCII_STR(wxFilePickerWidgetLabel), + const wxString &path = wxEmptyString, + const wxString &message = wxASCII_STR(wxFileSelectorPromptStr), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDIRBTN_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxFilePickerWidgetNameStr)) + { + Init(); + + m_pickerStyle = style; + + Create(parent, id, label, path, message, wxEmptyString, + pos, size, style, validator, name); + } + + virtual ~wxDirButton(); + + +public: // overrides + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label = wxASCII_STR(wxFilePickerWidgetLabel), + const wxString &path = wxEmptyString, + const wxString &message = wxASCII_STR(wxFileSelectorPromptStr), + const wxString &wildcard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxFilePickerWidgetNameStr)); + + + // GtkFileChooserButton does not support GTK_FILE_CHOOSER_CREATE_FOLDER + // thus we must ensure that the wxDD_DIR_MUST_EXIST style was given + long GetDialogStyle() const wxOVERRIDE + { + return (wxGenericDirButton::GetDialogStyle() | wxDD_DIR_MUST_EXIST); + } + + virtual void SetPath(const wxString &str) wxOVERRIDE; + virtual void SetInitialDirectory(const wxString& dir) wxOVERRIDE; + + // see macro defined above + FILEDIRBTN_OVERRIDES + +protected: + wxDialog *m_dialog; + + virtual void DoApplyWidgetStyle(GtkRcStyle*) wxOVERRIDE; + +public: // used by the GTK callback only + + bool m_bIgnoreNextChange; + + void GTKUpdatePath(const char *gtkpath); + +private: + void Init() + { + m_dialog = NULL; + m_bIgnoreNextChange = false; + } + + wxDECLARE_DYNAMIC_CLASS(wxDirButton); +}; + +#undef FILEDIRBTN_OVERRIDES + +#endif // _WX_GTK_FILEPICKER_H_ + diff --git a/lib/wxWidgets/include/wx/gtk/font.h b/lib/wxWidgets/include/wx/gtk/font.h new file mode 100644 index 0000000..797f901 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/font.h @@ -0,0 +1,123 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/font.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_FONT_H_ +#define _WX_GTK_FONT_H_ + +// ---------------------------------------------------------------------------- +// wxFont +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFont : public wxFontBase +{ +public: + wxFont() { } + + wxFont(const wxFontInfo& info); + + wxFont(const wxString& nativeFontInfoString) + { + Create(nativeFontInfoString); + } + + wxFont(const wxNativeFontInfo& info); + + wxFont(int size, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + Create(size, family, style, weight, underlined, face, encoding); + } + + wxFont(const wxSize& pixelSize, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + Create(10, family, style, weight, underlined, face, encoding); + SetPixelSize(pixelSize); + } + + wxDECLARE_DEFAULT_COPY(wxFont) + + bool Create(int size, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + + // wxGTK-specific + bool Create(const wxString& fontname); + + virtual ~wxFont(); + + // implement base class pure virtuals + virtual double GetFractionalPointSize() const wxOVERRIDE; + virtual wxFontStyle GetStyle() const wxOVERRIDE; + virtual int GetNumericWeight() const wxOVERRIDE; + virtual wxString GetFaceName() const wxOVERRIDE; + virtual bool GetUnderlined() const wxOVERRIDE; + virtual bool GetStrikethrough() const wxOVERRIDE; + virtual wxFontEncoding GetEncoding() const wxOVERRIDE; + virtual const wxNativeFontInfo *GetNativeFontInfo() const wxOVERRIDE; + virtual bool IsFixedWidth() const wxOVERRIDE; + + virtual void SetFractionalPointSize(double pointSize) wxOVERRIDE; + virtual void SetFamily(wxFontFamily family) wxOVERRIDE; + virtual void SetStyle(wxFontStyle style) wxOVERRIDE; + virtual void SetNumericWeight(int weight) wxOVERRIDE; + virtual bool SetFaceName( const wxString& faceName ) wxOVERRIDE; + virtual void SetUnderlined( bool underlined ) wxOVERRIDE; + virtual void SetStrikethrough(bool strikethrough) wxOVERRIDE; + virtual void SetEncoding(wxFontEncoding encoding) wxOVERRIDE; + + wxDECLARE_COMMON_FONT_METHODS(); + + wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants") + wxFont(int size, + int family, + int style, + int weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); + } + + // Set Pango attributes in the specified layout. Currently only + // underlined and strike-through attributes are handled by this function. + // + // If neither of them is specified, returns false, otherwise sets up the + // attributes and returns true. + bool GTKSetPangoAttrs(PangoLayout* layout) const; + +protected: + virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info ) wxOVERRIDE; + + virtual wxGDIRefData* CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData* CloneGDIRefData(const wxGDIRefData* data) const wxOVERRIDE; + + virtual wxFontFamily DoGetFamily() const wxOVERRIDE; + +private: + void Init(); + + wxDECLARE_DYNAMIC_CLASS(wxFont); +}; + +#endif // _WX_GTK_FONT_H_ diff --git a/lib/wxWidgets/include/wx/gtk/fontdlg.h b/lib/wxWidgets/include/wx/gtk/fontdlg.h new file mode 100644 index 0000000..bab724c --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/fontdlg.h @@ -0,0 +1,35 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/fontdlg.h +// Purpose: wxFontDialog +// Author: Robert Roebling +// Created: +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_FONTDLG_H_ +#define _WX_GTK_FONTDLG_H_ + +//----------------------------------------------------------------------------- +// wxFontDialog +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFontDialog : public wxFontDialogBase +{ +public: + wxFontDialog() : wxFontDialogBase() { /* must be Create()d later */ } + wxFontDialog(wxWindow *parent) + : wxFontDialogBase(parent) { Create(parent); } + wxFontDialog(wxWindow *parent, const wxFontData& data) + : wxFontDialogBase(parent, data) { Create(parent, data); } + + virtual ~wxFontDialog(); + +protected: + // create the GTK dialog + virtual bool DoCreate(wxWindow *parent) wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxFontDialog); +}; + +#endif diff --git a/lib/wxWidgets/include/wx/gtk/fontpicker.h b/lib/wxWidgets/include/wx/gtk/fontpicker.h new file mode 100644 index 0000000..46d1304 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/fontpicker.h @@ -0,0 +1,78 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/fontpicker.h +// Purpose: wxFontButton header +// Author: Francesco Montorsi +// Modified by: +// Created: 14/4/2006 +// Copyright: (c) Francesco Montorsi +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_FONTPICKER_H_ +#define _WX_GTK_FONTPICKER_H_ + +#include "wx/button.h" + +//----------------------------------------------------------------------------- +// wxFontButton +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFontButton : public wxButton, + public wxFontPickerWidgetBase +{ +public: + wxFontButton() { Init(); } + wxFontButton(wxWindow *parent, + wxWindowID id, + const wxFont& initial = wxNullFont, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxFONTBTN_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxFontPickerWidgetNameStr)) + { + Init(); + + Create(parent, id, initial, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxFont& initial = wxNullFont, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxFONTBTN_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxFontPickerWidgetNameStr)); + + virtual wxColour GetSelectedColour() const wxOVERRIDE + { return m_selectedColour; } + + void SetSelectedColour(const wxColour &colour) wxOVERRIDE + { m_selectedColour = colour; } + + virtual ~wxFontButton(); + +protected: + void UpdateFont() wxOVERRIDE; + + +public: // used by the GTK callback only + void SetNativeFontInfo(const char* gtkdescription); + +private: + // Common part of both ctors. + void Init() + { + m_selectedColour = *wxBLACK; + } + + // This can't be changed by the user, but is provided to + // satisfy the wxFontPickerWidgetBase interface. + wxColour m_selectedColour; + + wxDECLARE_DYNAMIC_CLASS(wxFontButton); +}; + +#endif // _WX_GTK_FONTPICKER_H_ + diff --git a/lib/wxWidgets/include/wx/gtk/frame.h b/lib/wxWidgets/include/wx/gtk/frame.h new file mode 100644 index 0000000..dce878b --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/frame.h @@ -0,0 +1,75 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/frame.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling, Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_FRAME_H_ +#define _WX_GTK_FRAME_H_ + +//----------------------------------------------------------------------------- +// wxFrame +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFrame : public wxFrameBase +{ +public: + // construction + wxFrame() { Init(); } + wxFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Init(); + + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + +#if wxUSE_STATUSBAR + void SetStatusBar(wxStatusBar *statbar) wxOVERRIDE; +#endif // wxUSE_STATUSBAR + +#if wxUSE_TOOLBAR + void SetToolBar(wxToolBar *toolbar) wxOVERRIDE; +#endif // wxUSE_TOOLBAR + + virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) wxOVERRIDE; + wxPoint GetClientAreaOrigin() const wxOVERRIDE { return wxPoint(0, 0); } + + // implementation from now on + // -------------------------- + + virtual bool SendIdleEvents(wxIdleEvent& event) wxOVERRIDE; + +protected: + // override wxWindow methods to take into account tool/menu/statusbars + virtual void DoGetClientSize( int *width, int *height ) const wxOVERRIDE; + +#if wxUSE_MENUS_NATIVE + virtual void DetachMenuBar() wxOVERRIDE; + virtual void AttachMenuBar(wxMenuBar *menubar) wxOVERRIDE; +#endif // wxUSE_MENUS_NATIVE + +private: + void Init(); + + long m_fsSaveFlag; + + wxDECLARE_DYNAMIC_CLASS(wxFrame); +}; + +#endif // _WX_GTK_FRAME_H_ diff --git a/lib/wxWidgets/include/wx/gtk/gauge.h b/lib/wxWidgets/include/wx/gtk/gauge.h new file mode 100644 index 0000000..cad2bc6 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/gauge.h @@ -0,0 +1,75 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/gauge.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_GAUGE_H_ +#define _WX_GTK_GAUGE_H_ + +//----------------------------------------------------------------------------- +// wxGauge +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGauge: public wxGaugeBase +{ +public: + wxGauge() { Init(); } + + wxGauge( wxWindow *parent, + wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxGaugeNameStr) ) + { + Init(); + + Create(parent, id, range, pos, size, style, validator, name); + } + + bool Create( wxWindow *parent, + wxWindowID id, int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxGaugeNameStr) ); + + // implement base class virtual methods + void SetRange(int range) wxOVERRIDE; + int GetRange() const wxOVERRIDE; + + void SetValue(int pos) wxOVERRIDE; + int GetValue() const wxOVERRIDE; + + virtual void Pulse() wxOVERRIDE; + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE; + + // implementation + // ------------- + + // the max and current gauge values + int m_rangeMax, + m_gaugePos; + +protected: + // set the gauge value to the value of m_gaugePos + void DoSetGauge(); + +private: + void Init() { m_rangeMax = m_gaugePos = 0; } + + wxDECLARE_DYNAMIC_CLASS(wxGauge); +}; + +#endif + // _WX_GTK_GAUGE_H_ diff --git a/lib/wxWidgets/include/wx/gtk/glcanvas.h b/lib/wxWidgets/include/wx/gtk/glcanvas.h new file mode 100644 index 0000000..a4aaffb --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/glcanvas.h @@ -0,0 +1,137 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/glcanvas.h +// Purpose: wxGLCanvas, for using OpenGL/Mesa with wxWidgets and GTK +// Author: Robert Roebling +// Modified by: +// Created: 17/8/98 +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GLCANVAS_H_ +#define _WX_GLCANVAS_H_ + +#include "wx/setup.h" + +#if wxUSE_GLCANVAS_EGL + #include "wx/unix/glegl.h" + typedef wxGLCanvasEGL wxGLCanvasImpl; +#else + #include "wx/unix/glx11.h" + typedef wxGLCanvasX11 wxGLCanvasImpl; +#endif + +//--------------------------------------------------------------------------- +// wxGLCanvas +//--------------------------------------------------------------------------- + +class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasImpl +{ + typedef wxGLCanvasImpl BaseType; +public: + wxGLCanvas(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + + explicit // avoid implicitly converting a wxWindow* to wxGLCanvas + wxGLCanvas(wxWindow *parent, + wxWindowID id = wxID_ANY, + const int *attribList = NULL, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + + bool Create(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const int *attribList = NULL, + const wxPalette& palette = wxNullPalette); + + virtual bool SetBackgroundStyle(wxBackgroundStyle style) wxOVERRIDE; + + // implement wxGLCanvasX11 methods + // -------------------------------- + + virtual unsigned long GetXWindow() const wxOVERRIDE; + void* GetNativeWindow() const; + + // deprecated methods + // ------------------ + +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED( + wxGLCanvas(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const int *attribList = NULL, + const wxPalette& palette = wxNullPalette) + ); + + wxDEPRECATED( + wxGLCanvas(wxWindow *parent, + const wxGLContext *shared, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const int *attribList = NULL, + const wxPalette& palette = wxNullPalette) + ); + + wxDEPRECATED( + wxGLCanvas(wxWindow *parent, + const wxGLCanvas *shared, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const int *attribList = NULL, + const wxPalette& palette = wxNullPalette) + ); + + // called from "realized" callback to create the implicit context if needed + void GTKInitImplicitContext(); +#endif // WXWIN_COMPATIBILITY_2_8 + + // implementation from now on + virtual void GTKHandleRealized() wxOVERRIDE; + +#ifdef __WXGTK3__ + wxSize m_size; +#endif +#if WXWIN_COMPATIBILITY_2_8 + wxGLContext *m_sharedContext; + wxGLCanvas *m_sharedContextOf; + const bool m_createImplicitContext; +#endif // WXWIN_COMPATIBILITY_2_8 + +private: + wxDECLARE_CLASS(wxGLCanvas); +}; + +#endif // _WX_GLCANVAS_H_ + diff --git a/lib/wxWidgets/include/wx/gtk/gnome/gvfs.h b/lib/wxWidgets/include/wx/gtk/gnome/gvfs.h new file mode 100644 index 0000000..559f14f --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/gnome/gvfs.h @@ -0,0 +1,52 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/gnome/gvfs.h +// Author: Robert Roebling +// Purpose: GNOME VFS support +// Created: 17/03/06 +// Copyright: Robert Roebling +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_GVFS_H_ +#define _WX_GTK_GVFS_H_ + +#include "wx/defs.h" + +#if wxUSE_MIMETYPE && wxUSE_LIBGNOMEVFS + +#include "wx/string.h" +#include "wx/unix/mimetype.h" + +//---------------------------------------------------------------------------- +// wxGnomeVFSMimeTypesManagerImpl +//---------------------------------------------------------------------------- + +class wxGnomeVFSMimeTypesManagerImpl: public wxMimeTypesManagerImpl +{ +public: + wxGnomeVFSMimeTypesManagerImpl() { } + +protected: + virtual bool DoAssociation(const wxString& strType, + const wxString& strIcon, + wxMimeTypeCommands *entry, + const wxArrayString& strExtensions, + const wxString& strDesc); +}; + +//---------------------------------------------------------------------------- +// wxGnomeVFSMimeTypesManagerFactory +//---------------------------------------------------------------------------- + +class wxGnomeVFSMimeTypesManagerFactory: public wxMimeTypesManagerFactory +{ +public: + wxGnomeVFSMimeTypesManagerFactory() {} + + virtual wxMimeTypesManagerImpl *CreateMimeTypesManagerImpl(); +}; + +#endif + // wxUSE_MIMETYPE + +#endif diff --git a/lib/wxWidgets/include/wx/gtk/hyperlink.h b/lib/wxWidgets/include/wx/gtk/hyperlink.h new file mode 100644 index 0000000..b8776e1 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/hyperlink.h @@ -0,0 +1,72 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/hyperlink.h +// Purpose: Hyperlink control +// Author: Francesco Montorsi +// Modified by: +// Created: 14/2/2007 +// Copyright: (c) 2007 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTKHYPERLINKCTRL_H_ +#define _WX_GTKHYPERLINKCTRL_H_ + +#include "wx/generic/hyperlink.h" + +// ---------------------------------------------------------------------------- +// wxHyperlinkCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxHyperlinkCtrl : public wxGenericHyperlinkCtrl +{ + typedef wxGenericHyperlinkCtrl base_type; +public: + wxHyperlinkCtrl(); + wxHyperlinkCtrl(wxWindow *parent, + wxWindowID id, + const wxString& label, const wxString& url, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxHL_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxHyperlinkCtrlNameStr)); + + virtual ~wxHyperlinkCtrl(); + + // Creation function (for two-step construction). + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, const wxString& url, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxHL_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxHyperlinkCtrlNameStr)); + + + // get/set + virtual wxColour GetHoverColour() const wxOVERRIDE; + virtual void SetHoverColour(const wxColour &colour) wxOVERRIDE; + + virtual wxColour GetNormalColour() const wxOVERRIDE; + virtual void SetNormalColour(const wxColour &colour) wxOVERRIDE; + + virtual wxColour GetVisitedColour() const wxOVERRIDE; + virtual void SetVisitedColour(const wxColour &colour) wxOVERRIDE; + + virtual wxString GetURL() const wxOVERRIDE; + virtual void SetURL(const wxString &url) wxOVERRIDE; + + virtual void SetVisited(bool visited = true) wxOVERRIDE; + virtual bool GetVisited() const wxOVERRIDE; + + virtual void SetLabel(const wxString &label) wxOVERRIDE; + +protected: + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxHyperlinkCtrl); +}; + +#endif // _WX_GTKHYPERLINKCTRL_H_ diff --git a/lib/wxWidgets/include/wx/gtk/infobar.h b/lib/wxWidgets/include/wx/gtk/infobar.h new file mode 100644 index 0000000..26653df --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/infobar.h @@ -0,0 +1,77 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/infobar.h +// Purpose: native implementation of wxInfoBar for GTK+ 2.18 and later +// Author: Vadim Zeitlin +// Created: 2009-09-26 +// Copyright: (c) 2009 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_INFOBAR_H_ +#define _WX_GTK_INFOBAR_H_ + +#include "wx/generic/infobar.h" + +// ---------------------------------------------------------------------------- +// wxInfoBar for GTK+ +// ---------------------------------------------------------------------------- + +// notice that the native GTK+ implementation is only available since +// (relatively recent) 2.18 so we inherit from the generic one to be able to +// fall back to it if GTK+ version is determined to be too old during run-time +class WXDLLIMPEXP_CORE wxInfoBar : public wxInfoBarGeneric +{ +public: + wxInfoBar() { Init(); } + + wxInfoBar(wxWindow *parent, wxWindowID winid = wxID_ANY) + { + Init(); + Create(parent, winid); + } + + bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY); + + virtual ~wxInfoBar(); + + // implement base class methods + // ---------------------------- + + virtual void ShowMessage(const wxString& msg, + int flags = wxICON_INFORMATION) wxOVERRIDE; + + virtual void Dismiss() wxOVERRIDE; + + virtual void AddButton(wxWindowID btnid, + const wxString& label = wxString()) wxOVERRIDE; + + virtual void RemoveButton(wxWindowID btnid) wxOVERRIDE; + + virtual size_t GetButtonCount() const wxOVERRIDE; + virtual wxWindowID GetButtonId(size_t idx) const wxOVERRIDE; + virtual bool HasButtonId(wxWindowID btnid) const wxOVERRIDE; + + // implementation only + // ------------------- + + void GTKResponse(int btnid); + +protected: + virtual void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE; + +private: + void Init() { m_impl = NULL; } + + // add a button with the given id/label and return its widget + GtkWidget *GTKAddButton(wxWindowID btnid, + const wxString& label = wxString()); + + + // only used when the native implementation is really being used + class wxInfoBarGTKImpl *m_impl; + + wxDECLARE_NO_COPY_CLASS(wxInfoBar); +}; + +#endif // _WX_GTK_INFOBAR_H_ + diff --git a/lib/wxWidgets/include/wx/gtk/listbox.h b/lib/wxWidgets/include/wx/gtk/listbox.h new file mode 100644 index 0000000..e597bd2 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/listbox.h @@ -0,0 +1,138 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/listbox.h +// Purpose: wxListBox class declaration +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_LISTBOX_H_ +#define _WX_GTK_LISTBOX_H_ + +struct _wxTreeEntry; +struct _GtkTreeIter; + +//----------------------------------------------------------------------------- +// wxListBox +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase +{ +public: + // ctors and such + wxListBox() + { + Init(); + } + wxListBox( wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = (const wxString *) NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr) ) + { + Init(); + Create(parent, id, pos, size, n, choices, style, validator, name); + } + wxListBox( wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr) ) + { + Init(); + Create(parent, id, pos, size, choices, style, validator, name); + } + virtual ~wxListBox(); + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = (const wxString *) NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + + virtual unsigned int GetCount() const wxOVERRIDE; + virtual wxString GetString(unsigned int n) const wxOVERRIDE; + virtual void SetString(unsigned int n, const wxString& s) wxOVERRIDE; + virtual int FindString(const wxString& s, bool bCase = false) const wxOVERRIDE; + + virtual bool IsSelected(int n) const wxOVERRIDE; + virtual int GetSelection() const wxOVERRIDE; + virtual int GetSelections(wxArrayInt& aSelections) const wxOVERRIDE; + + virtual void EnsureVisible(int n) wxOVERRIDE; + + virtual int GetTopItem() const wxOVERRIDE; + virtual int GetCountPerPage() const wxOVERRIDE; + + virtual void Update() wxOVERRIDE; + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // implementation from now on + + virtual GtkWidget *GetConnectWidget() wxOVERRIDE; + + struct _GtkTreeView *m_treeview; + struct _GtkListStore *m_liststore; + +#if wxUSE_CHECKLISTBOX + bool m_hasCheckBoxes; +#endif // wxUSE_CHECKLISTBOX + + struct _wxTreeEntry* GTKGetEntry(unsigned pos) const; + + void GTKDisableEvents(); + void GTKEnableEvents(); + + void GTKOnSelectionChanged(); + void GTKOnActivated(int item); + +protected: + virtual void DoClear() wxOVERRIDE; + virtual void DoDeleteOneItem(unsigned int n) wxOVERRIDE; + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE; + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; + + virtual void DoSetSelection(int n, bool select) wxOVERRIDE; + + virtual int DoInsertItems(const wxArrayStringsAdapter& items, + unsigned int pos, + void **clientData, wxClientDataType type) wxOVERRIDE; + virtual int DoInsertOneItem(const wxString& item, unsigned int pos) wxOVERRIDE; + + virtual void DoSetFirstItem(int n) wxOVERRIDE; + virtual void DoSetItemClientData(unsigned int n, void* clientData) wxOVERRIDE; + virtual void* DoGetItemClientData(unsigned int n) const wxOVERRIDE; + virtual int DoListHitTest(const wxPoint& point) const wxOVERRIDE; + + // get the iterator for the given index, returns false if invalid + bool GTKGetIteratorFor(unsigned pos, _GtkTreeIter *iter) const; + + // get the index for the given iterator, return wxNOT_FOUND on failure + int GTKGetIndexFor(_GtkTreeIter& iter) const; + + // common part of DoSetFirstItem() and EnsureVisible() + void DoScrollToCell(int n, float alignY, float alignX); + +private: + void Init(); //common construction + + wxDECLARE_DYNAMIC_CLASS(wxListBox); +}; + +#endif // _WX_GTK_LISTBOX_H_ diff --git a/lib/wxWidgets/include/wx/gtk/mdi.h b/lib/wxWidgets/include/wx/gtk/mdi.h new file mode 100644 index 0000000..69f372c --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/mdi.h @@ -0,0 +1,156 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/mdi.h +// Purpose: TDI-based MDI implementation for wxGTK +// Author: Robert Roebling +// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes +// Copyright: (c) 1998 Robert Roebling +// (c) 2008 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_MDI_H_ +#define _WX_GTK_MDI_H_ + +#include "wx/frame.h" + +class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; +class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow; + +typedef struct _GtkNotebook GtkNotebook; + +//----------------------------------------------------------------------------- +// wxMDIParentFrame +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase +{ +public: + wxMDIParentFrame() { Init(); } + wxMDIParentFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Init(); + + (void)Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + // we don't store the active child in m_currentChild unlike the base class + // version so override this method to find it dynamically + virtual wxMDIChildFrame *GetActiveChild() const wxOVERRIDE; + + // implement base class pure virtuals + // ---------------------------------- + + virtual void ActivateNext() wxOVERRIDE; + virtual void ActivatePrevious() wxOVERRIDE; + + static bool IsTDI() { return true; } + + // implementation + + bool m_justInserted; + + virtual void OnInternalIdle() wxOVERRIDE; + +protected: + virtual void DoGetClientSize(int* width, int* height) const wxOVERRIDE; + +private: + friend class wxMDIChildFrame; + void Init(); + + wxDECLARE_DYNAMIC_CLASS(wxMDIParentFrame); +}; + +//----------------------------------------------------------------------------- +// wxMDIChildFrame +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxTDIChildFrame +{ +public: + wxMDIChildFrame() { Init(); } + wxMDIChildFrame(wxMDIParentFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Init(); + + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxMDIParentFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + virtual ~wxMDIChildFrame(); + + virtual void SetMenuBar( wxMenuBar *menu_bar ) wxOVERRIDE; + virtual wxMenuBar *GetMenuBar() const wxOVERRIDE; + + virtual void Activate() wxOVERRIDE; + + virtual void SetTitle(const wxString& title) wxOVERRIDE; + + // implementation + + void OnActivate( wxActivateEvent& event ); + void OnMenuHighlight( wxMenuEvent& event ); + virtual void GTKHandleRealized() wxOVERRIDE; + + wxMenuBar *m_menuBar; + bool m_justInserted; + +protected: + virtual void DoGetPosition(int *x, int *y) const wxOVERRIDE; + +private: + void Init(); + + GtkNotebook *GTKGetNotebook() const; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxMDIChildFrame); +}; + +//----------------------------------------------------------------------------- +// wxMDIClientWindow +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase +{ +public: + wxMDIClientWindow() { } + ~wxMDIClientWindow(); + + virtual bool CreateClient(wxMDIParentFrame *parent, + long style = wxVSCROLL | wxHSCROLL) wxOVERRIDE; + +private: + virtual void AddChildGTK(wxWindowGTK* child) wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxMDIClientWindow); +}; + +#endif // _WX_GTK_MDI_H_ diff --git a/lib/wxWidgets/include/wx/gtk/menu.h b/lib/wxWidgets/include/wx/gtk/menu.h new file mode 100644 index 0000000..0b2f4a3 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/menu.h @@ -0,0 +1,112 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/menu.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling, Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTKMENU_H_ +#define _WX_GTKMENU_H_ + +//----------------------------------------------------------------------------- +// wxMenuBar +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMenuBar : public wxMenuBarBase +{ +public: + // ctors + wxMenuBar(); + wxMenuBar(long style); + wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0); + ~wxMenuBar(); + + // implement base class (pure) virtuals + virtual bool Append( wxMenu *menu, const wxString &title ) wxOVERRIDE; + virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title) wxOVERRIDE; + virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title) wxOVERRIDE; + virtual wxMenu *Remove(size_t pos) wxOVERRIDE; + + virtual int FindMenuItem(const wxString& menuString, + const wxString& itemString) const wxOVERRIDE; + virtual wxMenuItem* FindItem( int id, wxMenu **menu = NULL ) const wxOVERRIDE; + + virtual void EnableTop( size_t pos, bool flag ) wxOVERRIDE; + virtual bool IsEnabledTop(size_t pos) const wxOVERRIDE; + virtual void SetMenuLabel( size_t pos, const wxString& label ) wxOVERRIDE; + virtual wxString GetMenuLabel( size_t pos ) const wxOVERRIDE; + + void SetLayoutDirection(wxLayoutDirection dir) wxOVERRIDE; + wxLayoutDirection GetLayoutDirection() const wxOVERRIDE; + + virtual void Attach(wxFrame *frame) wxOVERRIDE; + virtual void Detach() wxOVERRIDE; + +private: + // common part of Append and Insert + void GtkAppend(wxMenu* menu, const wxString& title, int pos = -1); + + void Init(size_t n, wxMenu *menus[], const wxString titles[], long style); + + // wxMenuBar is not a top level window but it still doesn't need a parent + // window + virtual bool GTKNeedsParent() const wxOVERRIDE { return false; } + + GtkWidget* m_menubar; + + wxDECLARE_DYNAMIC_CLASS(wxMenuBar); +}; + +//----------------------------------------------------------------------------- +// wxMenu +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMenu : public wxMenuBase +{ +public: + // ctors & dtor + wxMenu(const wxString& title, long style = 0) + : wxMenuBase(title, style) { Init(); } + + wxMenu(long style = 0) : wxMenuBase(style) { Init(); } + + virtual ~wxMenu(); + + void Attach(wxMenuBarBase *menubar) wxOVERRIDE; + + void SetupBitmaps(wxWindow *win); + + void SetLayoutDirection(wxLayoutDirection dir); + wxLayoutDirection GetLayoutDirection() const; + + // Returns the title, with mnemonics translated to wx format + wxString GetTitle() const; + + // Sets the title, with mnemonics translated to gtk format + virtual void SetTitle(const wxString& title) wxOVERRIDE; + + // implementation GTK only + GtkWidget *m_menu; // GtkMenu + GtkWidget *m_owner; + GtkAccelGroup *m_accel; + bool m_popupShown; + +protected: + virtual wxMenuItem* DoAppend(wxMenuItem *item) wxOVERRIDE; + virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item) wxOVERRIDE; + virtual wxMenuItem* DoRemove(wxMenuItem *item) wxOVERRIDE; + +private: + // common code for all constructors: + void Init(); + + // common part of Append (if pos == -1) and Insert + void GtkAppend(wxMenuItem* item, int pos = -1); + + + wxDECLARE_DYNAMIC_CLASS(wxMenu); +}; + +#endif + // _WX_GTKMENU_H_ diff --git a/lib/wxWidgets/include/wx/gtk/menuitem.h b/lib/wxWidgets/include/wx/gtk/menuitem.h new file mode 100644 index 0000000..2b2d3be --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/menuitem.h @@ -0,0 +1,66 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/menuitem.h +// Purpose: wxMenuItem class +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTKMENUITEM_H_ +#define _WX_GTKMENUITEM_H_ + +//----------------------------------------------------------------------------- +// wxMenuItem +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMenuItem : public wxMenuItemBase +{ +public: + wxMenuItem(wxMenu *parentMenu = NULL, + int id = wxID_SEPARATOR, + const wxString& text = wxEmptyString, + const wxString& help = wxEmptyString, + wxItemKind kind = wxITEM_NORMAL, + wxMenu *subMenu = NULL); + virtual ~wxMenuItem(); + + // implement base class virtuals + virtual void SetItemLabel( const wxString& str ) wxOVERRIDE; + virtual void Enable( bool enable = true ) wxOVERRIDE; + virtual void Check( bool check = true ) wxOVERRIDE; + virtual bool IsChecked() const wxOVERRIDE; + void SetupBitmaps(wxWindow *win); + +#if wxUSE_ACCEL + virtual void AddExtraAccel(const wxAcceleratorEntry& accel) wxOVERRIDE; + virtual void ClearExtraAccels() wxOVERRIDE; +#endif // wxUSE_ACCEL + + // implementation + void SetMenuItem(GtkWidget *menuItem); + GtkWidget *GetMenuItem() const { return m_menuItem; } + void SetGtkLabel(); + +#if wxUSE_ACCEL + void GTKSetExtraAccels(); +#endif // wxUSE_ACCEL + +#if WXWIN_COMPATIBILITY_2_8 + // compatibility only, don't use in new code + wxDEPRECATED_CONSTRUCTOR( + wxMenuItem(wxMenu *parentMenu, + int id, + const wxString& text, + const wxString& help, + bool isCheckable, + wxMenu *subMenu = NULL) + ); +#endif + +private: + GtkWidget *m_menuItem; // GtkMenuItem + + wxDECLARE_DYNAMIC_CLASS(wxMenuItem); +}; + +#endif // _WX_GTKMENUITEM_H_ diff --git a/lib/wxWidgets/include/wx/gtk/mimetype.h b/lib/wxWidgets/include/wx/gtk/mimetype.h new file mode 100644 index 0000000..ed645c6 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/mimetype.h @@ -0,0 +1,40 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/mimetype.h +// Purpose: classes and functions to manage MIME types +// Author: Hans Mackowiak +// Created: 2016-06-05 +// Copyright: (c) 2016 Hans Mackowiak +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_MIMETYPE_IMPL_H +#define _WX_GTK_MIMETYPE_IMPL_H + +#include "wx/defs.h" + +#if defined(__UNIX__) +#include "wx/unix/mimetype.h" +#elif defined(__WINDOWS__) +#include "wx/msw/mimetype.h" +#endif + +#if wxUSE_MIMETYPE + +class WXDLLIMPEXP_CORE wxGTKMimeTypesManagerImpl : public wxMimeTypesManagerImpl +{ +protected: +#if defined(__UNIX__) + wxString GetIconFromMimeType(const wxString& mime) wxOVERRIDE; +#endif +}; + + +class WXDLLIMPEXP_CORE wxGTKMimeTypesManagerFactory : public wxMimeTypesManagerFactory +{ +public: + wxMimeTypesManagerImpl *CreateMimeTypesManagerImpl() wxOVERRIDE; +}; + +#endif // wxUSE_MIMETYPE + +#endif // _WX_GTK_MIMETYPE_IMPL_H diff --git a/lib/wxWidgets/include/wx/gtk/minifram.h b/lib/wxWidgets/include/wx/gtk/minifram.h new file mode 100644 index 0000000..318af56 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/minifram.h @@ -0,0 +1,64 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/minifram.h +// Purpose: wxMiniFrame class +// Author: Robert Roebling +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_MINIFRAME_H_ +#define _WX_GTK_MINIFRAME_H_ + +#include "wx/bitmap.h" +#include "wx/frame.h" + +//----------------------------------------------------------------------------- +// wxMiniFrame +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMiniFrame: public wxFrame +{ + wxDECLARE_DYNAMIC_CLASS(wxMiniFrame); + +public: + wxMiniFrame() {} + wxMiniFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCAPTION | wxRESIZE_BORDER, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Create(parent, id, title, pos, size, style, name); + } + ~wxMiniFrame(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCAPTION | wxRESIZE_BORDER, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + virtual void SetTitle( const wxString &title ) wxOVERRIDE; + +protected: + virtual void DoSetSizeHints( int minW, int minH, + int maxW, int maxH, + int incW, int incH ) wxOVERRIDE; + virtual void DoGetClientSize(int* width, int* height) const wxOVERRIDE; + + // implementation +public: +#ifndef __WXGTK4__ + bool m_isDragMove; + wxSize m_dragOffset; +#endif + wxBitmap m_closeButton; + int m_miniEdge; + int m_miniTitle; +}; + +#endif // _WX_GTK_MINIFRAME_H_ diff --git a/lib/wxWidgets/include/wx/gtk/msgdlg.h b/lib/wxWidgets/include/wx/gtk/msgdlg.h new file mode 100644 index 0000000..e0ad8cc --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/msgdlg.h @@ -0,0 +1,51 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/msgdlg.h +// Purpose: wxMessageDialog for GTK+2 +// Author: Vaclav Slavik +// Modified by: +// Created: 2003/02/28 +// Copyright: (c) Vaclav Slavik, 2003 +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_MSGDLG_H_ +#define _WX_GTK_MSGDLG_H_ + +class WXDLLIMPEXP_CORE wxMessageDialog : public wxMessageDialogBase +{ +public: + wxMessageDialog(wxWindow *parent, const wxString& message, + const wxString& caption = wxASCII_STR(wxMessageBoxCaptionStr), + long style = wxOK|wxCENTRE, + const wxPoint& pos = wxDefaultPosition); + + virtual int ShowModal() wxOVERRIDE; + virtual bool Show(bool WXUNUSED(show) = true) wxOVERRIDE { return false; } + +protected: + // implement some base class methods to do nothing to avoid asserts and + // GTK warnings, since this is not a real wxDialog. + virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y), + int WXUNUSED(width), int WXUNUSED(height), + int WXUNUSED(sizeFlags) = wxSIZE_AUTO) wxOVERRIDE {} + virtual void DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), + int WXUNUSED(width), int WXUNUSED(height)) wxOVERRIDE {} + // override to convert wx mnemonics to GTK+ ones and handle stock ids + virtual void DoSetCustomLabel(wxString& var, const ButtonLabel& label) wxOVERRIDE; + +private: + // override to use stock GTK+ defaults instead of just string ones + virtual wxString GetDefaultYesLabel() const wxOVERRIDE; + virtual wxString GetDefaultNoLabel() const wxOVERRIDE; + virtual wxString GetDefaultOKLabel() const wxOVERRIDE; + virtual wxString GetDefaultCancelLabel() const wxOVERRIDE; + virtual wxString GetDefaultHelpLabel() const wxOVERRIDE; + + // create the real GTK+ dialog: this is done from ShowModal() to allow + // changing the message between constructing the dialog and showing it + void GTKCreateMsgDialog(); + + wxDECLARE_DYNAMIC_CLASS(wxMessageDialog); +}; + +#endif // _WX_GTK_MSGDLG_H_ diff --git a/lib/wxWidgets/include/wx/gtk/nonownedwnd.h b/lib/wxWidgets/include/wx/gtk/nonownedwnd.h new file mode 100644 index 0000000..bc4687b --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/nonownedwnd.h @@ -0,0 +1,43 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/nonownedwnd.h +// Purpose: wxGTK-specific wxNonOwnedWindow declaration. +// Author: Vadim Zeitlin +// Created: 2011-10-12 +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_NONOWNEDWND_H_ +#define _WX_GTK_NONOWNEDWND_H_ + +class wxNonOwnedWindowShapeImpl; + +// ---------------------------------------------------------------------------- +// wxNonOwnedWindow contains code common to wx{Popup,TopLevel}Window in wxGTK. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxNonOwnedWindowBase +{ +public: + wxNonOwnedWindow() { m_shapeImpl = NULL; } + virtual ~wxNonOwnedWindow(); + + // Overridden to actually set the shape when the window becomes realized. + virtual void GTKHandleRealized() wxOVERRIDE; + +protected: + virtual bool DoClearShape() wxOVERRIDE; + virtual bool DoSetRegionShape(const wxRegion& region) wxOVERRIDE; +#if wxUSE_GRAPHICS_CONTEXT + virtual bool DoSetPathShape(const wxGraphicsPath& path) wxOVERRIDE; +#endif // wxUSE_GRAPHICS_CONTEXT + + +private: + // If non-NULL, contains information about custom window shape. + wxNonOwnedWindowShapeImpl* m_shapeImpl; + + wxDECLARE_NO_COPY_CLASS(wxNonOwnedWindow); +}; + +#endif // _WX_GTK_NONOWNEDWND_H_ diff --git a/lib/wxWidgets/include/wx/gtk/notebook.h b/lib/wxWidgets/include/wx/gtk/notebook.h new file mode 100644 index 0000000..65cecbc --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/notebook.h @@ -0,0 +1,144 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/notebook.h +// Purpose: wxNotebook class +// Author: Robert Roebling +// Modified by: +// Copyright: (c) Julian Smart and Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTKNOTEBOOK_H_ +#define _WX_GTKNOTEBOOK_H_ + +//----------------------------------------------------------------------------- +// internal class +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxGtkNotebookPage; + +#include "wx/list.h" +WX_DECLARE_LIST(wxGtkNotebookPage, wxGtkNotebookPagesList); + +//----------------------------------------------------------------------------- +// wxNotebook +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase +{ +public: + // default for dynamic class + wxNotebook(); + // the same arguments as for wxControl + wxNotebook(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxNotebookNameStr)); + // Create() function + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxNotebookNameStr)); + // dtor + virtual ~wxNotebook(); + + // accessors + // --------- + + // set the currently selected page, return the index of the previously + // selected one (or wxNOT_FOUND on error) + // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events + int SetSelection(size_t nPage) wxOVERRIDE { return DoSetSelection(nPage, SetSelection_SendEvent); } + // get the currently selected page + int GetSelection() const wxOVERRIDE; + + // changes selected page without sending events + int ChangeSelection(size_t nPage) wxOVERRIDE { return DoSetSelection(nPage); } + + // set/get the title of a page + bool SetPageText(size_t nPage, const wxString& strText) wxOVERRIDE; + wxString GetPageText(size_t nPage) const wxOVERRIDE; + + // sets/returns item's image index in the current image list + int GetPageImage(size_t nPage) const wxOVERRIDE; + bool SetPageImage(size_t nPage, int nImage) wxOVERRIDE; + + // control the appearance of the notebook pages + // set the padding between tabs (in pixels) + void SetPadding(const wxSize& padding) wxOVERRIDE; + // sets the size of the tabs (assumes all tabs are the same size) + void SetTabSize(const wxSize& sz) wxOVERRIDE; + + // geometry + virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const wxOVERRIDE; + virtual int HitTest(const wxPoint& pt, long *flags = NULL) const wxOVERRIDE; + + // operations + // ---------- + // remove all pages + bool DeleteAllPages() wxOVERRIDE; + + // adds a new page to the notebook (it will be deleted by the notebook, + // don't delete it yourself). If bSelect, this page becomes active. + // the same as AddPage(), but adds it at the specified position + bool InsertPage( size_t position, + wxNotebookPage *win, + const wxString& strText, + bool bSelect = false, + int imageId = NO_IMAGE ) wxOVERRIDE; + + // handler for tab navigation + // -------------------------- + void OnNavigationKey(wxNavigationKeyEvent& event); + + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // implementation + // -------------- + +#if wxUSE_CONSTRAINTS + void SetConstraintSizes(bool recurse) wxOVERRIDE; + bool DoPhase(int phase) wxOVERRIDE; +#endif + + // Called by GTK event handler when the current page is definitely changed. + void GTKOnPageChanged(); + + // helper function + wxGtkNotebookPage* GetNotebookPage(int page) const; + + // the additional page data (the pages themselves are in m_pages array) + wxGtkNotebookPagesList m_pagesData; + + // we need to store the old selection since there + // is no other way to know about it at the time + // of the change selection event + int m_oldSelection; + +protected: + // set all page's attributes + virtual void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE; + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; + + // remove one page from the notebook but do not destroy it + virtual wxNotebookPage *DoRemovePage(size_t nPage) wxOVERRIDE; + + int DoSetSelection(size_t nPage, int flags = 0) wxOVERRIDE; + +private: + // the padding set by SetPadding() + int m_padding; + + void Init(); + virtual void AddChildGTK(wxWindowGTK* child) wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxNotebook); + wxDECLARE_EVENT_TABLE(); +}; + +#endif // _WX_GTKNOTEBOOK_H_ diff --git a/lib/wxWidgets/include/wx/gtk/pen.h b/lib/wxWidgets/include/wx/gtk/pen.h new file mode 100644 index 0000000..579f2fc --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/pen.h @@ -0,0 +1,65 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/pen.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PEN_H_ +#define _WX_GTK_PEN_H_ + +//----------------------------------------------------------------------------- +// wxPen +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPen: public wxPenBase +{ +public: + wxPen() { } + + wxPen( const wxColour &colour, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID ); + + wxPen( const wxPenInfo& info ); + + wxDECLARE_DEFAULT_COPY(wxPen) + + virtual ~wxPen(); + + bool operator==(const wxPen& pen) const; + bool operator!=(const wxPen& pen) const { return !(*this == pen); } + + void SetColour( const wxColour &colour ) wxOVERRIDE; + void SetColour( unsigned char red, unsigned char green, unsigned char blue ) wxOVERRIDE; + void SetCap( wxPenCap capStyle ) wxOVERRIDE; + void SetJoin( wxPenJoin joinStyle ) wxOVERRIDE; + void SetStyle( wxPenStyle style ) wxOVERRIDE; + void SetWidth( int width ) wxOVERRIDE; + void SetDashes( int number_of_dashes, const wxDash *dash ) wxOVERRIDE; + void SetStipple(const wxBitmap& stipple) wxOVERRIDE; + + wxColour GetColour() const wxOVERRIDE; + wxPenCap GetCap() const wxOVERRIDE; + wxPenJoin GetJoin() const wxOVERRIDE; + wxPenStyle GetStyle() const wxOVERRIDE; + int GetWidth() const wxOVERRIDE; + int GetDashes(wxDash **ptr) const wxOVERRIDE; + int GetDashCount() const; + wxDash* GetDash() const; + wxBitmap *GetStipple() const wxOVERRIDE; + + + wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") + wxPen(const wxColour& col, int width, int style); + + wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") + void SetStyle(int style) { SetStyle((wxPenStyle)style); } + +protected: + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxPen); +}; + +#endif // _WX_GTK_PEN_H_ diff --git a/lib/wxWidgets/include/wx/gtk/popupwin.h b/lib/wxWidgets/include/wx/gtk/popupwin.h new file mode 100644 index 0000000..566a7c0 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/popupwin.h @@ -0,0 +1,50 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/popupwin.h +// Purpose: +// Author: Robert Roebling +// Created: +// Copyright: (c) 2001 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_POPUPWIN_H_ +#define _WX_GTK_POPUPWIN_H_ + +//----------------------------------------------------------------------------- +// wxPopUpWindow +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPopupWindow: public wxPopupWindowBase +{ +public: + wxPopupWindow() { } + virtual ~wxPopupWindow(); + + wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE) + { (void)Create(parent, flags); } + bool Create(wxWindow *parent, int flags = wxBORDER_NONE); + + virtual bool Show(bool show = true) wxOVERRIDE; + + virtual void SetFocus() wxOVERRIDE; + + // implementation + // -------------- + + // GTK time when connecting to button_press signal + wxUint32 m_time; + +protected: + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; + + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; + +#ifdef __WXUNIVERSAL__ + wxDECLARE_EVENT_TABLE(); +#endif + wxDECLARE_DYNAMIC_CLASS(wxPopupWindow); +}; + +#endif // _WX_GTK_POPUPWIN_H_ diff --git a/lib/wxWidgets/include/wx/gtk/print.h b/lib/wxWidgets/include/wx/gtk/print.h new file mode 100644 index 0000000..22b2b86 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/print.h @@ -0,0 +1,351 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/print.h +// Author: Anthony Bretaudeau +// Purpose: GTK printing support +// Created: 2007-08-25 +// Copyright: (c) Anthony Bretaudeau +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRINT_H_ +#define _WX_GTK_PRINT_H_ + +#include "wx/defs.h" + +#if wxUSE_GTKPRINT + +#include "wx/print.h" +#include "wx/printdlg.h" +#include "wx/prntbase.h" +#include "wx/dc.h" + +typedef struct _GtkPrintOperation GtkPrintOperation; +typedef struct _GtkPrintContext GtkPrintContext; +typedef struct _GtkPrintSettings GtkPrintSettings; +typedef struct _GtkPageSetup GtkPageSetup; + +typedef struct _cairo cairo_t; + +//---------------------------------------------------------------------------- +// wxGtkPrintFactory +//---------------------------------------------------------------------------- + +class wxGtkPrintFactory: public wxPrintFactory +{ +public: + virtual wxPrinterBase *CreatePrinter( wxPrintDialogData *data ) wxOVERRIDE; + + virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, + wxPrintout *printout = NULL, + wxPrintDialogData *data = NULL ) wxOVERRIDE; + virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, + wxPrintout *printout, + wxPrintData *data ) wxOVERRIDE; + + virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, + wxPrintDialogData *data = NULL ) wxOVERRIDE; + virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, + wxPrintData *data ) wxOVERRIDE; + + virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent, + wxPageSetupDialogData * data = NULL ) wxOVERRIDE; + + virtual wxDCImpl* CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data ) wxOVERRIDE; + + virtual bool HasPrintSetupDialog() wxOVERRIDE; + virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data ) wxOVERRIDE; + virtual bool HasOwnPrintToFile() wxOVERRIDE; + virtual bool HasPrinterLine() wxOVERRIDE; + virtual wxString CreatePrinterLine() wxOVERRIDE; + virtual bool HasStatusLine() wxOVERRIDE; + virtual wxString CreateStatusLine() wxOVERRIDE; + + virtual wxPrintNativeDataBase *CreatePrintNativeData() wxOVERRIDE; +}; + +//---------------------------------------------------------------------------- +// wxGtkPrintDialog +//---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGtkPrintDialog: public wxPrintDialogBase +{ +public: + wxGtkPrintDialog( wxWindow *parent, + wxPrintDialogData* data = NULL ); + wxGtkPrintDialog( wxWindow *parent, wxPrintData* data); + virtual ~wxGtkPrintDialog(); + + wxPrintData& GetPrintData() wxOVERRIDE + { return m_printDialogData.GetPrintData(); } + wxPrintDialogData& GetPrintDialogData() wxOVERRIDE + { return m_printDialogData; } + + wxDC *GetPrintDC() wxOVERRIDE; + + virtual int ShowModal() wxOVERRIDE; + + virtual bool Validate() wxOVERRIDE { return true; } + virtual bool TransferDataToWindow() wxOVERRIDE { return true; } + virtual bool TransferDataFromWindow() wxOVERRIDE { return true; } + + void SetShowDialog(bool show) { m_showDialog = show; } + bool GetShowDialog() { return m_showDialog; } + +protected: + // Implement some base class methods to do nothing to avoid asserts and + // GTK warnings, since this is not a real wxDialog. + virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y), + int WXUNUSED(width), int WXUNUSED(height), + int WXUNUSED(sizeFlags) = wxSIZE_AUTO) wxOVERRIDE {} + virtual void DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), + int WXUNUSED(width), int WXUNUSED(height)) wxOVERRIDE {} + +private: + wxPrintDialogData m_printDialogData; + wxWindow *m_parent; + bool m_showDialog; + + wxDECLARE_DYNAMIC_CLASS(wxGtkPrintDialog); +}; + +//---------------------------------------------------------------------------- +// wxGtkPageSetupDialog +//---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGtkPageSetupDialog: public wxPageSetupDialogBase +{ +public: + wxGtkPageSetupDialog( wxWindow *parent, + wxPageSetupDialogData* data = NULL ); + virtual ~wxGtkPageSetupDialog(); + + virtual wxPageSetupDialogData& GetPageSetupDialogData() wxOVERRIDE { return m_pageDialogData; } + + virtual int ShowModal() wxOVERRIDE; + + virtual bool Validate() wxOVERRIDE { return true; } + virtual bool TransferDataToWindow() wxOVERRIDE { return true; } + virtual bool TransferDataFromWindow() wxOVERRIDE { return true; } + +protected: + // Implement some base class methods to do nothing to avoid asserts and + // GTK warnings, since this is not a real wxDialog. + virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y), + int WXUNUSED(width), int WXUNUSED(height), + int WXUNUSED(sizeFlags) = wxSIZE_AUTO) wxOVERRIDE {} + virtual void DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), + int WXUNUSED(width), int WXUNUSED(height)) wxOVERRIDE {} + +private: + wxPageSetupDialogData m_pageDialogData; + wxWindow *m_parent; + + wxDECLARE_DYNAMIC_CLASS(wxGtkPageSetupDialog); +}; + +//---------------------------------------------------------------------------- +// wxGtkPrinter +//---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGtkPrinter : public wxPrinterBase +{ +public: + wxGtkPrinter(wxPrintDialogData *data = NULL); + virtual ~wxGtkPrinter(); + + virtual bool Print(wxWindow *parent, + wxPrintout *printout, + bool prompt = true) wxOVERRIDE; + virtual wxDC* PrintDialog(wxWindow *parent) wxOVERRIDE; + virtual bool Setup(wxWindow *parent) wxOVERRIDE; + + GtkPrintContext *GetPrintContext() { return m_gpc; } + void SetPrintContext(GtkPrintContext *context) {m_gpc = context;} + void BeginPrint(wxPrintout *printout, GtkPrintOperation *operation, GtkPrintContext *context); + void DrawPage(wxPrintout *printout, GtkPrintOperation *operation, GtkPrintContext *context, int page_nr); + +private: + GtkPrintContext *m_gpc; + wxDC *m_dc; + + wxDECLARE_DYNAMIC_CLASS(wxGtkPrinter); + wxDECLARE_NO_COPY_CLASS(wxGtkPrinter); +}; + +//---------------------------------------------------------------------------- +// wxGtkPrintNativeData +//---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGtkPrintNativeData : public wxPrintNativeDataBase +{ +public: + wxGtkPrintNativeData(); + virtual ~wxGtkPrintNativeData(); + + virtual bool TransferTo( wxPrintData &data ) wxOVERRIDE; + virtual bool TransferFrom( const wxPrintData &data ) wxOVERRIDE; + + virtual bool Ok() const wxOVERRIDE { return IsOk(); } + virtual bool IsOk() const wxOVERRIDE { return true; } + + GtkPrintSettings* GetPrintConfig() { return m_config; } + void SetPrintConfig( GtkPrintSettings * config ); + + GtkPrintOperation* GetPrintJob() { return m_job; } + void SetPrintJob(GtkPrintOperation *job); + + GtkPrintContext *GetPrintContext() { return m_context; } + void SetPrintContext(GtkPrintContext *context) {m_context = context; } + +private: + // NB: m_config is created and owned by us, but the other objects are not + // and their accessors don't change their ref count. + GtkPrintSettings *m_config; + GtkPrintOperation *m_job; + GtkPrintContext *m_context; + + wxDECLARE_DYNAMIC_CLASS(wxGtkPrintNativeData); +}; + +//----------------------------------------------------------------------------- +// wxGtkPrinterDC +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGtkPrinterDCImpl : public wxDCImpl +{ +public: + wxGtkPrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data ); + virtual ~wxGtkPrinterDCImpl(); + + bool Ok() const { return IsOk(); } + bool IsOk() const wxOVERRIDE; + + virtual void* GetCairoContext() const wxOVERRIDE; + virtual void* GetHandle() const wxOVERRIDE; + + bool CanDrawBitmap() const wxOVERRIDE { return true; } + void Clear() wxOVERRIDE; + void SetFont( const wxFont& font ) wxOVERRIDE; + void SetPen( const wxPen& pen ) wxOVERRIDE; + void SetBrush( const wxBrush& brush ) wxOVERRIDE; + void SetLogicalFunction( wxRasterOperationMode function ) wxOVERRIDE; + void SetBackground( const wxBrush& brush ) wxOVERRIDE; + void DestroyClippingRegion() wxOVERRIDE; + bool StartDoc(const wxString& message) wxOVERRIDE; + void EndDoc() wxOVERRIDE; + void StartPage() wxOVERRIDE; + void EndPage() wxOVERRIDE; + wxCoord GetCharHeight() const wxOVERRIDE; + wxCoord GetCharWidth() const wxOVERRIDE; + bool CanGetTextExtent() const wxOVERRIDE { return true; } + wxSize GetPPI() const wxOVERRIDE; + virtual int GetDepth() const wxOVERRIDE { return 24; } + void SetBackgroundMode(int mode) wxOVERRIDE; +#if wxUSE_PALETTE + void SetPalette(const wxPalette& WXUNUSED(palette)) wxOVERRIDE { } +#endif + void SetResolution(int ppi); + + // overridden for wxPrinterDC Impl + virtual int GetResolution() const wxOVERRIDE; + virtual wxRect GetPaperRect() const wxOVERRIDE; + +protected: + bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, + wxFloodFillStyle style=wxFLOOD_SURFACE ) wxOVERRIDE; + void DoGradientFillConcentric(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, const wxPoint& circleCenter) wxOVERRIDE; + void DoGradientFillLinear(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, wxDirection nDirection = wxEAST) wxOVERRIDE; + bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const wxOVERRIDE; + void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) wxOVERRIDE; + void DoCrossHair(wxCoord x, wxCoord y) wxOVERRIDE; + void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc) wxOVERRIDE; + void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea) wxOVERRIDE; + void DoDrawPoint(wxCoord x, wxCoord y) wxOVERRIDE; + void DoDrawLines(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0) wxOVERRIDE; + void DoDrawPolygon(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, wxPolygonFillMode fillStyle=wxODDEVEN_RULE) wxOVERRIDE; + void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, wxPolygonFillMode fillStyle=wxODDEVEN_RULE) wxOVERRIDE; + void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE; + void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0) wxOVERRIDE; + void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE; +#if wxUSE_SPLINES + void DoDrawSpline(const wxPointList *points) wxOVERRIDE; +#endif + bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, + wxDC *source, wxCoord xsrc, wxCoord ysrc, + wxRasterOperationMode rop = wxCOPY, bool useMask = false, + wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) wxOVERRIDE; + void DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y ) wxOVERRIDE; + void DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false ) wxOVERRIDE; + void DoDrawText(const wxString& text, wxCoord x, wxCoord y ) wxOVERRIDE; + void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle) wxOVERRIDE; + void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE; + void DoSetDeviceClippingRegion( const wxRegion &WXUNUSED(clip) ) wxOVERRIDE + { + wxFAIL_MSG( "not implemented" ); + } + void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + const wxFont *theFont = NULL ) const wxOVERRIDE; + bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const wxOVERRIDE; + void DoGetSize(int* width, int* height) const wxOVERRIDE; + void DoGetSizeMM(int *width, int *height) const wxOVERRIDE; + + wxPrintData& GetPrintData() { return m_printData; } + void SetPrintData(const wxPrintData& data); + +private: + wxPrintData m_printData; + PangoContext *m_context; + PangoLayout *m_layout; + PangoFontDescription *m_fontdesc; + cairo_t *m_cairo; + + unsigned char m_currentRed; + unsigned char m_currentGreen; + unsigned char m_currentBlue; + unsigned char m_currentAlpha; + + GtkPrintContext *m_gpc; + int m_resolution; + double m_PS2DEV; + double m_DEV2PS; + + wxDECLARE_DYNAMIC_CLASS(wxGtkPrinterDCImpl); + wxDECLARE_NO_COPY_CLASS(wxGtkPrinterDCImpl); +}; + +// ---------------------------------------------------------------------------- +// wxGtkPrintPreview: programmer creates an object of this class to preview a +// wxPrintout. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGtkPrintPreview : public wxPrintPreviewBase +{ +public: + wxGtkPrintPreview(wxPrintout *printout, + wxPrintout *printoutForPrinting = NULL, + wxPrintDialogData *data = NULL); + wxGtkPrintPreview(wxPrintout *printout, + wxPrintout *printoutForPrinting, + wxPrintData *data); + + virtual ~wxGtkPrintPreview(); + + virtual bool Print(bool interactive) wxOVERRIDE; + virtual void DetermineScaling() wxOVERRIDE; + +private: + void Init(wxPrintout *printout, + wxPrintout *printoutForPrinting, + wxPrintData *data); + + // resolution to use in DPI + int m_resolution; + + wxDECLARE_CLASS(wxGtkPrintPreview); +}; + +#endif // wxUSE_GTKPRINT + +#endif // _WX_GTK_PRINT_H_ diff --git a/lib/wxWidgets/include/wx/gtk/private.h b/lib/wxWidgets/include/wx/gtk/private.h new file mode 100644 index 0000000..ce6efd5 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private.h @@ -0,0 +1,131 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private.h +// Purpose: wxGTK private macros, functions &c +// Author: Vadim Zeitlin +// Modified by: +// Created: 12.03.02 +// Copyright: (c) 2002 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRIVATE_H_ +#define _WX_GTK_PRIVATE_H_ + +#include "wx/gtk/private/wrapgtk.h" + +#include "wx/gtk/private/string.h" + +#ifndef G_VALUE_INIT + // introduced in GLib 2.30 + #define G_VALUE_INIT { 0, { { 0 } } } +#endif + +// pango_version_check symbol is quite recent ATM (4/2007)... so we +// use our own wrapper which implements a smart trick. +// Use this function as you'd use pango_version_check: +// +// if (!wx_pango_version_check(1,18,0)) +// ... call to a function available only in pango >= 1.18 ... +// +// and use it only to test for pango versions >= 1.16.0 +extern const gchar *wx_pango_version_check(int major, int minor, int micro); + +#if wxUSE_UNICODE + #define wxGTK_CONV(s) (s).utf8_str() + #define wxGTK_CONV_ENC(s, enc) wxGTK_CONV((s)) + #define wxGTK_CONV_FONT(s, font) wxGTK_CONV((s)) + #define wxGTK_CONV_SYS(s) wxGTK_CONV((s)) + + #define wxGTK_CONV_BACK(s) wxString::FromUTF8Unchecked(s) + #define wxGTK_CONV_BACK_ENC(s, enc) wxGTK_CONV_BACK(s) + #define wxGTK_CONV_BACK_FONT(s, font) wxGTK_CONV_BACK(s) + #define wxGTK_CONV_BACK_SYS(s) wxGTK_CONV_BACK(s) +#else + #include "wx/font.h" + + // convert the text between the given encoding and UTF-8 used by wxGTK + extern WXDLLIMPEXP_CORE wxCharBuffer + wxConvertToGTK(const wxString& s, + wxFontEncoding enc = wxFONTENCODING_SYSTEM); + + extern WXDLLIMPEXP_CORE wxCharBuffer + wxConvertFromGTK(const wxString& s, + wxFontEncoding enc = wxFONTENCODING_SYSTEM); + + // helper: use the encoding of the given font if it's valid + inline wxCharBuffer wxConvertToGTK(const wxString& s, const wxFont& font) + { + return wxConvertToGTK(s, font.IsOk() ? font.GetEncoding() + : wxFONTENCODING_SYSTEM); + } + + inline wxCharBuffer wxConvertFromGTK(const wxString& s, const wxFont& font) + { + return wxConvertFromGTK(s, font.IsOk() ? font.GetEncoding() + : wxFONTENCODING_SYSTEM); + } + + // more helpers: allow passing GTK+ strings directly + inline wxCharBuffer + wxConvertFromGTK(const wxGtkString& gs, + wxFontEncoding enc = wxFONTENCODING_SYSTEM) + { + return wxConvertFromGTK(gs.c_str(), enc); + } + + inline wxCharBuffer + wxConvertFromGTK(const wxGtkString& gs, const wxFont& font) + { + return wxConvertFromGTK(gs.c_str(), font); + } + + #define wxGTK_CONV(s) wxGTK_CONV_FONT((s), m_font) + #define wxGTK_CONV_ENC(s, enc) wxConvertToGTK((s), (enc)) + #define wxGTK_CONV_FONT(s, font) wxConvertToGTK((s), (font)) + #define wxGTK_CONV_SYS(s) wxConvertToGTK((s)) + + #define wxGTK_CONV_BACK(s) wxConvertFromGTK((s), m_font) + #define wxGTK_CONV_BACK_ENC(s, enc) wxConvertFromGTK((s), (enc)) + #define wxGTK_CONV_BACK_FONT(s, font) wxConvertFromGTK((s), (font)) + #define wxGTK_CONV_BACK_SYS(s) wxConvertFromGTK((s)) +#endif + +// Define a macro for converting wxString to char* in appropriate encoding for +// the file names. +#ifdef G_OS_WIN32 + // Under MSW, UTF-8 file name encodings are always used. + #define wxGTK_CONV_FN(s) (s).utf8_str() +#else + // Under Unix use GLib file name encoding (which is also UTF-8 by default + // but may be different from it). + #define wxGTK_CONV_FN(s) (s).fn_str() +#endif + +// ---------------------------------------------------------------------------- +// various private helper functions +// ---------------------------------------------------------------------------- + +namespace wxGTKPrivate +{ + +// these functions create the GTK widgets of the specified types which can then +// used to retrieve their styles, pass them to drawing functions &c +// +// the returned widgets shouldn't be destroyed, this is done automatically on +// shutdown +WXDLLIMPEXP_CORE GtkWidget *GetButtonWidget(); +WXDLLIMPEXP_CORE GtkWidget *GetCheckButtonWidget(); +WXDLLIMPEXP_CORE GtkWidget *GetComboBoxWidget(); +WXDLLIMPEXP_CORE GtkWidget *GetEntryWidget(); +WXDLLIMPEXP_CORE GtkWidget *GetHeaderButtonWidgetFirst(); +WXDLLIMPEXP_CORE GtkWidget *GetHeaderButtonWidgetLast(); +WXDLLIMPEXP_CORE GtkWidget *GetHeaderButtonWidget(); +WXDLLIMPEXP_CORE GtkWidget *GetNotebookWidget(); +WXDLLIMPEXP_CORE GtkWidget *GetRadioButtonWidget(); +WXDLLIMPEXP_CORE GtkWidget *GetSplitterWidget(wxOrientation orient = wxHORIZONTAL); +WXDLLIMPEXP_CORE GtkWidget *GetTextEntryWidget(); +WXDLLIMPEXP_CORE GtkWidget *GetTreeWidget(); + +} // wxGTKPrivate + +#endif // _WX_GTK_PRIVATE_H_ diff --git a/lib/wxWidgets/include/wx/gtk/private/addremovectrl.h b/lib/wxWidgets/include/wx/gtk/private/addremovectrl.h new file mode 100644 index 0000000..fe5c511 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/addremovectrl.h @@ -0,0 +1,80 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/addremovectrl.h +// Purpose: GTK specific wxAddRemoveImpl implementation +// Author: Vadim Zeitlin +// Created: 2015-02-05 +// Copyright: (c) 2015 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRIVATE_ADDREMOVECTRL_H_ +#define _WX_GTK_PRIVATE_ADDREMOVECTRL_H_ + +#include "wx/artprov.h" +#include "wx/bmpbuttn.h" +#include "wx/toolbar.h" + +#include "wx/gtk/private/wrapgtk.h" + +// ---------------------------------------------------------------------------- +// wxAddRemoveImpl +// ---------------------------------------------------------------------------- + +class wxAddRemoveImpl : public wxAddRemoveImplBase +{ +public: + wxAddRemoveImpl(wxAddRemoveAdaptor* adaptor, + wxAddRemoveCtrl* parent, + wxWindow* ctrlItems) + : wxAddRemoveImplBase(adaptor, parent, ctrlItems), + m_tbar(new wxToolBar(parent, wxID_ANY)) + { + m_tbar->AddTool(wxID_ADD, wxString(), GetNamedBitmap("list-add")); + m_tbar->AddTool(wxID_REMOVE, wxString(), GetNamedBitmap("list-remove")); + +#if defined(__WXGTK3__) && !defined(__WXUNIVERSAL__) + // Tweak the toolbar appearance to correspond to how the toolbars used + // in other GNOME applications for similar purposes look. + GtkToolbar* const toolbar = m_tbar->GTKGetToolbar(); + GtkStyleContext* context = gtk_widget_get_style_context(GTK_WIDGET(toolbar)); + gtk_style_context_add_class(context, GTK_STYLE_CLASS_INLINE_TOOLBAR); + gtk_style_context_set_junction_sides(context, GTK_JUNCTION_TOP); +#endif // GTK+3 + + wxSizer* const sizerTop = new wxBoxSizer(wxVERTICAL); + sizerTop->Add(ctrlItems, wxSizerFlags(1).Expand()); + sizerTop->Add(m_tbar, wxSizerFlags().Expand()); + parent->SetSizer(sizerTop); + + m_tbar->Bind(wxEVT_UPDATE_UI, + &wxAddRemoveImplBase::OnUpdateUIAdd, this, wxID_ADD); + m_tbar->Bind(wxEVT_UPDATE_UI, + &wxAddRemoveImplBase::OnUpdateUIRemove, this, wxID_REMOVE); + + m_tbar->Bind(wxEVT_TOOL, &wxAddRemoveImplBase::OnAdd, this, wxID_ADD); + m_tbar->Bind(wxEVT_TOOL, &wxAddRemoveImplBase::OnRemove, this, wxID_REMOVE); + } + + virtual void SetButtonsToolTips(const wxString& addtip, + const wxString& removetip) wxOVERRIDE + { + m_tbar->SetToolShortHelp(wxID_ADD, addtip); + m_tbar->SetToolShortHelp(wxID_REMOVE, removetip); + } + +private: + static wxBitmapBundle GetNamedBitmap(const wxString& name) + { + // GTK UI guidelines recommend using "symbolic" versions of the icons + // for these buttons, so try them first but fall back to the normal + // ones if symbolic theme is not installed. + wxBitmap bmp = wxArtProvider::GetBitmap(name + wxASCII_STR("-symbolic"), wxART_MENU); + if ( !bmp.IsOk() ) + bmp = wxArtProvider::GetBitmap(name, wxART_MENU); + return bmp; + } + + wxToolBar* const m_tbar; +}; + +#endif // _WX_GTK_PRIVATE_ADDREMOVECTRL_H_ diff --git a/lib/wxWidgets/include/wx/gtk/private/animate.h b/lib/wxWidgets/include/wx/gtk/private/animate.h new file mode 100644 index 0000000..214ae7d --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/animate.h @@ -0,0 +1,69 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/animate.h +// Purpose: Animation classes +// 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_GTK_PRIVATE_ANIMATEH__ +#define _WX_GTK_PRIVATE_ANIMATEH__ + +#include "wx/private/animate.h" + +typedef struct _GdkPixbufAnimation GdkPixbufAnimation; +typedef struct _GdkPixbufAnimationIter GdkPixbufAnimationIter; + +// ---------------------------------------------------------------------------- +// wxAnimationGTKImpl +// Unlike the generic wxAnimation object we won't use directly +// wxAnimationDecoders as gdk-pixbuf already provides the concept of decoder and +// will automatically use the available handlers. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxAnimationGTKImpl : public wxAnimationImpl +{ +public: + wxAnimationGTKImpl() + : m_pixbuf(NULL) {} + ~wxAnimationGTKImpl() { UnRef(); } + + virtual bool IsOk() const wxOVERRIDE + { return m_pixbuf != NULL; } + virtual bool IsCompatibleWith(wxClassInfo* ci) const wxOVERRIDE; + + + // unfortunately GdkPixbufAnimation does not expose these info: + + virtual unsigned int GetFrameCount() const wxOVERRIDE { return 0; } + virtual wxImage GetFrame(unsigned int frame) const wxOVERRIDE; + + // we can retrieve the delay for a frame only after building + // a GdkPixbufAnimationIter... + virtual int GetDelay(unsigned int WXUNUSED(frame)) const wxOVERRIDE { return 0; } + virtual wxSize GetSize() const wxOVERRIDE; + + virtual bool LoadFile(const wxString &name, wxAnimationType type = wxANIMATION_TYPE_ANY) wxOVERRIDE; + virtual bool Load(wxInputStream &stream, wxAnimationType type = wxANIMATION_TYPE_ANY) wxOVERRIDE; + + // Implementation +public: // used by GTK callbacks + + GdkPixbufAnimation *GetPixbuf() const + { return m_pixbuf; } + void SetPixbuf(GdkPixbufAnimation* p); + +protected: + GdkPixbufAnimation *m_pixbuf; + +private: + void UnRef(); + + typedef wxAnimationImpl base_type; + wxDECLARE_NO_COPY_CLASS(wxAnimationGTKImpl); +}; + + +#endif // _WX_GTK_PRIVATE_ANIMATEH__ diff --git a/lib/wxWidgets/include/wx/gtk/private/backend.h b/lib/wxWidgets/include/wx/gtk/private/backend.h new file mode 100644 index 0000000..229c7ce --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/backend.h @@ -0,0 +1,14 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/backend.h +// Author: Paul Cornett +// Copyright: (c) 2022 Paul Cornett +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifdef __WXGTK3__ +namespace wxGTKImpl +{ + WXDLLIMPEXP_CORE bool IsWayland(void* instance); + WXDLLIMPEXP_CORE bool IsX11(void* instance); +} +#endif diff --git a/lib/wxWidgets/include/wx/gtk/private/dialogcount.h b/lib/wxWidgets/include/wx/gtk/private/dialogcount.h new file mode 100644 index 0000000..b282e99 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/dialogcount.h @@ -0,0 +1,48 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/dialogcount.h +// Purpose: Helper for temporarily changing wxOpenModalDialogsCount global. +// Author: Vadim Zeitlin +// Created: 2013-03-21 +// Copyright: (c) 2013 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRIVATE_DIALOGCOUNT_H_ +#define _WX_GTK_PRIVATE_DIALOGCOUNT_H_ + +#include "wx/defs.h" + +// This global variable contains the number of currently opened modal dialogs. +// When it is non null, the global menu used in Ubuntu Unity needs to be +// explicitly disabled as this doesn't currently happen on its own due to a bug +// in Unity, see https://bugs.launchpad.net/indicator-appmenu/+bug/674605 +// +// For this to work, all modal dialogs must use wxOpenModalDialogLocker class +// below to increment this variable while they are indeed being modally shown. +// +// This variable is defined in src/gtk/toplevel.cpp +extern int wxOpenModalDialogsCount; + +// ---------------------------------------------------------------------------- +// wxOpenModalDialogLocker: Create an object of this class to increment +// wxOpenModalDialogsCount during its lifetime. +// ---------------------------------------------------------------------------- + +class wxOpenModalDialogLocker +{ +public: + wxOpenModalDialogLocker() + { + wxOpenModalDialogsCount++; + } + + ~wxOpenModalDialogLocker() + { + wxOpenModalDialogsCount--; + } + +private: + wxDECLARE_NO_COPY_CLASS(wxOpenModalDialogLocker); +}; + +#endif // _WX_GTK_PRIVATE_DIALOGCOUNT_H_ diff --git a/lib/wxWidgets/include/wx/gtk/private/error.h b/lib/wxWidgets/include/wx/gtk/private/error.h new file mode 100644 index 0000000..25802dd --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/error.h @@ -0,0 +1,57 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: gtk/private/error.h +// Purpose: Wrapper around GError. +// Author: Vadim Zeitlin +// Created: 2012-07-25 +// Copyright: (c) 2012 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRIVATE_ERROR_H_ +#define _WX_GTK_PRIVATE_ERROR_H_ + +// ---------------------------------------------------------------------------- +// wxGtkError wraps GError and releases it automatically. +// ---------------------------------------------------------------------------- + +// Create an object of this class and pass the result of its Out() method to a +// function taking "GError**", then use GetMessage() if the function returned +// false. +class wxGtkError +{ +public: + wxGtkError() { m_error = NULL; } + explicit wxGtkError(GError* error) { m_error = error; } + ~wxGtkError() { if ( m_error ) g_error_free(m_error); } + + GError** Out() + { + // This would result in a GError leak. + wxASSERT_MSG( !m_error, wxS("Can't reuse the same object.") ); + + return &m_error; + } + + // Check if any error actually occurred. + operator bool() const + { + return m_error != NULL; + } + + operator GError*() const + { + return m_error; + } + + wxString GetMessage() const + { + return wxString::FromUTF8(m_error->message); + } + +private: + GError* m_error; + + wxDECLARE_NO_COPY_CLASS(wxGtkError); +}; + +#endif // _WX_GTK_PRIVATE_ERROR_H_ diff --git a/lib/wxWidgets/include/wx/gtk/private/event.h b/lib/wxWidgets/include/wx/gtk/private/event.h new file mode 100644 index 0000000..851fd93 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/event.h @@ -0,0 +1,94 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/event.h +// Purpose: Helper functions for working with GDK and wx events +// Author: Vaclav Slavik +// Created: 2011-10-14 +// Copyright: (c) 2011 Vaclav Slavik +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _GTK_PRIVATE_EVENT_H_ +#define _GTK_PRIVATE_EVENT_H_ + +#if !GTK_CHECK_VERSION(2,10,0) + // GTK+ can reliably detect Meta key state only since 2.10 when + // GDK_META_MASK was introduced -- there wasn't any way to detect it + // in older versions. wxGTK used GDK_MOD2_MASK for this purpose, but + // GDK_MOD2_MASK is documented as: + // + // the fifth modifier key (it depends on the modifier mapping of the X + // server which key is interpreted as this modifier) + // + // In other words, it isn't guaranteed to map to Meta. This is a real + // problem: it is common to map NumLock to it (in fact, it's an exception + // if the X server _doesn't_ use it for NumLock). So the old code caused + // wxKeyEvent::MetaDown() to always return true as long as NumLock was + // on many systems, which broke all applications using + // wxKeyEvent::GetModifiers() to check modifiers state (see e.g. here: + // http://tinyurl.com/56lsk2). + // + // Because of this, it's better to not detect Meta key state at all than + // to detect it incorrectly. Hence the following #define, which causes + // m_metaDown to be always set to false. + #define GDK_META_MASK 0 +#endif + +namespace wxGTKImpl +{ + +// init wxMouseEvent with the info from GdkEventXXX struct +template void InitMouseEvent(wxWindowGTK *win, + wxMouseEvent& event, + T *gdk_event) +{ + event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK) != 0; + event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK) != 0; + event.m_altDown = (gdk_event->state & GDK_MOD1_MASK) != 0; + event.m_metaDown = (gdk_event->state & GDK_META_MASK) != 0; + event.m_leftDown = (gdk_event->state & GDK_BUTTON1_MASK) != 0; + event.m_middleDown = (gdk_event->state & GDK_BUTTON2_MASK) != 0; + event.m_rightDown = (gdk_event->state & GDK_BUTTON3_MASK) != 0; + + // In gdk/win32 VK_XBUTTON1 is translated to GDK_BUTTON4_MASK + // and VK_XBUTTON2 to GDK_BUTTON5_MASK. In x11/gdk buttons 4/5 + // are wheel rotation and buttons 8/9 don't change the state. + event.m_aux1Down = (gdk_event->state & GDK_BUTTON4_MASK) != 0; + event.m_aux2Down = (gdk_event->state & GDK_BUTTON5_MASK) != 0; + + wxPoint pt = win->GetClientAreaOrigin(); + event.m_x = (wxCoord)gdk_event->x - pt.x; + event.m_y = (wxCoord)gdk_event->y - pt.y; + + // Some no-window widgets, notably GtkEntry on GTK3, have a GdkWindow + // covering part of their area. Event coordinates from that window are + // not relative to the widget, so do the conversion here. + if (!gtk_widget_get_has_window(win->m_widget) && + gtk_widget_get_window(win->m_widget) == gdk_window_get_parent(gdk_event->window)) + { + GtkAllocation a; + gtk_widget_get_allocation(win->m_widget, &a); + int posX, posY; + gdk_window_get_position(gdk_event->window, &posX, &posY); + + event.m_x += posX - a.x; + event.m_y += posY - a.y; + } + + if ((win->m_wxwindow) && (win->GetLayoutDirection() == wxLayout_RightToLeft)) + { + // origin in the upper right corner + GtkAllocation a; + gtk_widget_get_allocation(win->m_wxwindow, &a); + int window_width = a.width; + event.m_x = window_width - event.m_x; + } + + event.SetEventObject( win ); + event.SetId( win->GetId() ); + event.SetTimestamp( gdk_event->time ); +} + +} // namespace wxGTKImpl + +#endif // _GTK_PRIVATE_EVENT_H_ + diff --git a/lib/wxWidgets/include/wx/gtk/private/eventsdisabler.h b/lib/wxWidgets/include/wx/gtk/private/eventsdisabler.h new file mode 100644 index 0000000..5ca9c7b --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/eventsdisabler.h @@ -0,0 +1,41 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/eventsdisabler.h +// Purpose: Helper for temporarily disabling events. +// Author: Vadim Zeitlin +// Created: 2016-02-06 +// Copyright: (c) 2016 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _GTK_PRIVATE_EVENTSDISABLER_H_ +#define _GTK_PRIVATE_EVENTSDISABLER_H_ + +// ---------------------------------------------------------------------------- +// wxGtkEventsDisabler: calls GTKDisableEvents() and GTKEnableEvents() in dtor. +// ---------------------------------------------------------------------------- + +// Template parameter T must be a wxGTK class providing the required methods, +// e.g. wxCheckBox, wxChoice, ... +template +class wxGtkEventsDisabler +{ +public: + // Disable the events for the specified (non-NULL, having lifetime greater + // than ours) window for the lifetime of this object. + explicit wxGtkEventsDisabler(T* win) : m_win(win) + { + m_win->GTKDisableEvents(); + } + + ~wxGtkEventsDisabler() + { + m_win->GTKEnableEvents(); + } + +private: + T* const m_win; + + wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxGtkEventsDisabler, T); +}; + +#endif // _GTK_PRIVATE_EVENTSDISABLER_H_ diff --git a/lib/wxWidgets/include/wx/gtk/private/gdkconv.h b/lib/wxWidgets/include/wx/gtk/private/gdkconv.h new file mode 100644 index 0000000..b63b0c7 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/gdkconv.h @@ -0,0 +1,32 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/gdkconv.h +// Purpose: Helper functions for converting between GDK and wx types +// Author: Vadim Zeitlin +// Created: 2009-11-10 +// Copyright: (c) 2009 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _GTK_PRIVATE_GDKCONV_H_ +#define _GTK_PRIVATE_GDKCONV_H_ + +namespace wxGTKImpl +{ + +inline wxRect wxRectFromGDKRect(const GdkRectangle *r) +{ + return wxRect(r->x, r->y, r->width, r->height); +} + +inline void wxRectToGDKRect(const wxRect& rect, GdkRectangle& r) +{ + r.x = rect.x; + r.y = rect.y; + r.width = rect.width; + r.height = rect.height; +} + +} // namespace wxGTKImpl + +#endif // _GTK_PRIVATE_GDKCONV_H_ + diff --git a/lib/wxWidgets/include/wx/gtk/private/gtk2-compat.h b/lib/wxWidgets/include/wx/gtk/private/gtk2-compat.h new file mode 100644 index 0000000..141dc94 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/gtk2-compat.h @@ -0,0 +1,699 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/compat.h +// Purpose: Compatibility code for older GTK+ versions +// Author: Vaclav Slavik +// Created: 2011-03-25 +// Copyright: (c) 2011 Vaclav Slavik +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRIVATE_COMPAT_H_ +#define _WX_GTK_PRIVATE_COMPAT_H_ + +// ---------------------------------------------------------------------------- +// Implementations of new accessors for older GTK+ versions +// ---------------------------------------------------------------------------- + +// GTK+ deprecated direct access to struct members and some other stuff, +// replacing them with simple accessor functions. These aren't available in +// older versions, though, so we have to provide them for compatibility. +// +// Note: wx_ prefix is used to avoid symbol conflicts at runtime +// +// Note 2: We support building against newer GTK+ version and using an older +// one at runtime, so we must provide our implementations of these +// functions even if GTK_CHECK_VERSION would indicate the function is +// already available in GTK+. + +#ifndef __WXGTK3__ + +// ---------------------------------------------------------------------------- +// the following were introduced in GTK+ 2.8 + +static inline GtkWidget* wx_gtk_scrolled_window_get_hscrollbar(GtkScrolledWindow* scrolled_window) +{ + return scrolled_window->hscrollbar; +} +#define gtk_scrolled_window_get_hscrollbar wx_gtk_scrolled_window_get_hscrollbar + +static inline GtkWidget* wx_gtk_scrolled_window_get_vscrollbar(GtkScrolledWindow* scrolled_window) +{ + return scrolled_window->vscrollbar; +} +#define gtk_scrolled_window_get_vscrollbar wx_gtk_scrolled_window_get_vscrollbar + +// ---------------------------------------------------------------------------- +// the following were introduced in GLib 2.10 + +static inline gpointer wx_g_object_ref_sink(gpointer object) +{ + g_object_ref(object); + gtk_object_sink(GTK_OBJECT(object)); + return object; +} +#undef g_object_ref_sink +#define g_object_ref_sink wx_g_object_ref_sink + +// ---------------------------------------------------------------------------- +// the following were introduced in GTK+ 2.12 + +static inline void wx_gtk_about_dialog_set_program_name(GtkAboutDialog* about, const gchar* name) +{ + gtk_about_dialog_set_name(about, name); +} +#define gtk_about_dialog_set_program_name wx_gtk_about_dialog_set_program_name + +// ---------------------------------------------------------------------------- +// the following were introduced in GTK+ 2.14 + +static inline gdouble wx_gtk_adjustment_get_lower(GtkAdjustment* adjustment) +{ + return adjustment->lower; +} +#define gtk_adjustment_get_lower wx_gtk_adjustment_get_lower + +static inline gdouble wx_gtk_adjustment_get_page_increment(GtkAdjustment* adjustment) +{ + return adjustment->page_increment; +} +#define gtk_adjustment_get_page_increment wx_gtk_adjustment_get_page_increment + +static inline gdouble wx_gtk_adjustment_get_page_size(GtkAdjustment* adjustment) +{ + return adjustment->page_size; +} +#define gtk_adjustment_get_page_size wx_gtk_adjustment_get_page_size + +static inline gdouble wx_gtk_adjustment_get_step_increment(GtkAdjustment* adjustment) +{ + return adjustment->step_increment; +} +#define gtk_adjustment_get_step_increment wx_gtk_adjustment_get_step_increment + +static inline gdouble wx_gtk_adjustment_get_upper(GtkAdjustment* adjustment) +{ + return adjustment->upper; +} +#define gtk_adjustment_get_upper wx_gtk_adjustment_get_upper + +static inline void wx_gtk_adjustment_set_step_increment(GtkAdjustment* adjustment, gdouble step_increment) +{ + adjustment->step_increment = step_increment; + gtk_adjustment_changed(adjustment); +} +#define gtk_adjustment_set_step_increment wx_gtk_adjustment_set_step_increment + +static inline void wx_gtk_adjustment_set_page_increment(GtkAdjustment* adjustment, gdouble page_increment) +{ + adjustment->page_increment = page_increment; + gtk_adjustment_changed(adjustment); +} +#define gtk_adjustment_set_page_increment wx_gtk_adjustment_set_page_increment + +static inline void wx_gtk_adjustment_set_page_size(GtkAdjustment* adjustment, gdouble page_size) +{ + adjustment->page_size = page_size; +} +#define gtk_adjustment_set_page_size wx_gtk_adjustment_set_page_size + +static inline GtkWidget* wx_gtk_color_selection_dialog_get_color_selection(GtkColorSelectionDialog* csd) +{ + return csd->colorsel; +} +#define gtk_color_selection_dialog_get_color_selection wx_gtk_color_selection_dialog_get_color_selection + +static inline GtkWidget* wx_gtk_dialog_get_content_area(GtkDialog* dialog) +{ + return dialog->vbox; +} +#define gtk_dialog_get_content_area wx_gtk_dialog_get_content_area + +static inline GtkWidget* wx_gtk_dialog_get_action_area(GtkDialog* dialog) +{ + return dialog->action_area; +} +#define gtk_dialog_get_action_area wx_gtk_dialog_get_action_area + +static inline guint16 wx_gtk_entry_get_text_length(GtkEntry* entry) +{ + return entry->text_length; +} +#define gtk_entry_get_text_length wx_gtk_entry_get_text_length + +static inline const guchar* wx_gtk_selection_data_get_data(GtkSelectionData* selection_data) +{ + return selection_data->data; +} +#define gtk_selection_data_get_data wx_gtk_selection_data_get_data + +static inline GdkAtom wx_gtk_selection_data_get_data_type(GtkSelectionData* selection_data) +{ + return selection_data->type; +} +#define gtk_selection_data_get_data_type wx_gtk_selection_data_get_data_type + +static inline gint wx_gtk_selection_data_get_format(GtkSelectionData* selection_data) +{ + return selection_data->format; +} +#define gtk_selection_data_get_format wx_gtk_selection_data_get_format + +static inline gint wx_gtk_selection_data_get_length(GtkSelectionData* selection_data) +{ + return selection_data->length; +} +#define gtk_selection_data_get_length wx_gtk_selection_data_get_length + +static inline GdkAtom wx_gtk_selection_data_get_target(GtkSelectionData* selection_data) +{ + return selection_data->target; +} +#define gtk_selection_data_get_target wx_gtk_selection_data_get_target + +static inline GdkWindow* wx_gtk_widget_get_window(GtkWidget* widget) +{ + return widget->window; +} +#define gtk_widget_get_window wx_gtk_widget_get_window + +static inline GtkWidget* wx_gtk_window_get_default_widget(GtkWindow* window) +{ + return window->default_widget; +} +#define gtk_window_get_default_widget wx_gtk_window_get_default_widget + +// ---------------------------------------------------------------------------- +// the following were introduced in GTK+ 2.16 + +static inline GdkAtom wx_gtk_selection_data_get_selection(GtkSelectionData* selection_data) +{ + return selection_data->selection; +} +#define gtk_selection_data_get_selection wx_gtk_selection_data_get_selection + +// ---------------------------------------------------------------------------- +// the following were introduced in GTK+ 2.18 + +static inline void wx_gtk_cell_renderer_get_alignment(GtkCellRenderer* cell, gfloat* xalign, gfloat* yalign) +{ + *xalign = cell->xalign; + *yalign = cell->yalign; +} +#define gtk_cell_renderer_get_alignment wx_gtk_cell_renderer_get_alignment + +static inline void wx_gtk_cell_renderer_get_padding(GtkCellRenderer* cell, gint* xpad, gint* ypad) +{ + *xpad = cell->xpad; + *ypad = cell->ypad; +} +#define gtk_cell_renderer_get_padding wx_gtk_cell_renderer_get_padding + +static inline void wx_gtk_cell_renderer_set_padding(GtkCellRenderer* cell, gint xpad, gint ypad) +{ + cell->xpad = xpad; + cell->ypad = ypad; +} +#define gtk_cell_renderer_set_padding wx_gtk_cell_renderer_set_padding + +static inline void wx_gtk_widget_get_allocation(GtkWidget* widget, GtkAllocation* allocation) +{ + *allocation = widget->allocation; +} +#define gtk_widget_get_allocation wx_gtk_widget_get_allocation + +inline gboolean wx_gtk_widget_get_has_window(GtkWidget *widget) +{ + return !GTK_WIDGET_NO_WINDOW(widget); +} +#define gtk_widget_get_has_window wx_gtk_widget_get_has_window + + +inline gboolean wx_gtk_widget_get_has_grab(GtkWidget *widget) +{ + return GTK_WIDGET_HAS_GRAB(widget); +} +#define gtk_widget_get_has_grab wx_gtk_widget_get_has_grab + + +inline gboolean wx_gtk_widget_get_visible(GtkWidget *widget) +{ + return GTK_WIDGET_VISIBLE(widget); +} +#define gtk_widget_get_visible wx_gtk_widget_get_visible + + +inline gboolean wx_gtk_widget_get_sensitive(GtkWidget *widget) +{ + return GTK_WIDGET_SENSITIVE(widget); +} +#define gtk_widget_get_sensitive wx_gtk_widget_get_sensitive + + +inline gboolean wx_gtk_widget_is_drawable(GtkWidget *widget) +{ + return GTK_WIDGET_DRAWABLE(widget); +} +#define gtk_widget_is_drawable wx_gtk_widget_is_drawable + + +inline gboolean wx_gtk_widget_get_can_focus(GtkWidget *widget) +{ + return GTK_WIDGET_CAN_FOCUS(widget); +} +#define gtk_widget_get_can_focus wx_gtk_widget_get_can_focus + +inline void wx_gtk_widget_set_can_focus(GtkWidget *widget, gboolean can) +{ + if ( can ) + GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_FOCUS); + else + GTK_WIDGET_UNSET_FLAGS(widget, GTK_CAN_FOCUS); +} +#define gtk_widget_set_can_focus wx_gtk_widget_set_can_focus + +static inline gboolean wx_gtk_widget_has_focus(GtkWidget* widget) +{ + return GTK_WIDGET_HAS_FOCUS(widget); +} +#define gtk_widget_has_focus wx_gtk_widget_has_focus + +inline gboolean wx_gtk_widget_get_can_default(GtkWidget *widget) +{ + return GTK_WIDGET_CAN_DEFAULT(widget); +} +#define gtk_widget_get_can_default wx_gtk_widget_get_can_default + +inline void wx_gtk_widget_set_can_default(GtkWidget *widget, gboolean can) +{ + if ( can ) + GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_DEFAULT); + else + GTK_WIDGET_UNSET_FLAGS(widget, GTK_CAN_DEFAULT); +} +#define gtk_widget_set_can_default wx_gtk_widget_set_can_default + + +inline gboolean wx_gtk_widget_has_default(GtkWidget *widget) +{ + return GTK_WIDGET_HAS_DEFAULT(widget); +} +#define gtk_widget_has_default wx_gtk_widget_has_default + + +inline GtkStateType wx_gtk_widget_get_state(GtkWidget *widget) +{ + return (GtkStateType)GTK_WIDGET_STATE(widget); +} +#define gtk_widget_get_state wx_gtk_widget_get_state + + +inline gboolean wx_gtk_widget_get_double_buffered(GtkWidget *widget) +{ + return GTK_WIDGET_DOUBLE_BUFFERED(widget); +} +#define gtk_widget_get_double_buffered wx_gtk_widget_get_double_buffered + +static inline gboolean wx_gtk_widget_has_grab(GtkWidget* widget) +{ + return GTK_WIDGET_HAS_GRAB(widget); +} +#define gtk_widget_has_grab wx_gtk_widget_has_grab + +static inline void wx_gtk_widget_set_allocation(GtkWidget* widget, const GtkAllocation* allocation) +{ + widget->allocation = *allocation; +} +#define gtk_widget_set_allocation wx_gtk_widget_set_allocation + +static inline gboolean wx_gtk_widget_is_toplevel(GtkWidget* widget) +{ + return GTK_WIDGET_TOPLEVEL(widget); +} +#define gtk_widget_is_toplevel wx_gtk_widget_is_toplevel + +// ---------------------------------------------------------------------------- +// the following were introduced in GTK+ 2.20 + +inline gboolean wx_gtk_widget_get_realized(GtkWidget *widget) +{ + return GTK_WIDGET_REALIZED(widget); +} +#define gtk_widget_get_realized wx_gtk_widget_get_realized + + +inline gboolean wx_gtk_widget_get_mapped(GtkWidget *widget) +{ + return GTK_WIDGET_MAPPED(widget); +} +#define gtk_widget_get_mapped wx_gtk_widget_get_mapped + +static inline void wx_gtk_widget_get_requisition(GtkWidget* widget, GtkRequisition* requisition) +{ + *requisition = widget->requisition; +} +#define gtk_widget_get_requisition wx_gtk_widget_get_requisition + +static inline GdkWindow* wx_gtk_entry_get_text_window(GtkEntry* entry) +{ + return entry->text_area; +} +#define gtk_entry_get_text_window wx_gtk_entry_get_text_window + +// ---------------------------------------------------------------------------- +// the following were introduced in GTK+ 2.22 + +static inline GdkWindow* wx_gtk_button_get_event_window(GtkButton* button) +{ + return button->event_window; +} +#define gtk_button_get_event_window wx_gtk_button_get_event_window + +static inline GdkDragAction wx_gdk_drag_context_get_actions(GdkDragContext* context) +{ + return context->actions; +} +#define gdk_drag_context_get_actions wx_gdk_drag_context_get_actions + +static inline GdkDragAction wx_gdk_drag_context_get_selected_action(GdkDragContext* context) +{ + return context->action; +} +#define gdk_drag_context_get_selected_action wx_gdk_drag_context_get_selected_action + +static inline GdkDragAction wx_gdk_drag_context_get_suggested_action(GdkDragContext* context) +{ + return context->suggested_action; +} +#define gdk_drag_context_get_suggested_action wx_gdk_drag_context_get_suggested_action + +static inline GList* wx_gdk_drag_context_list_targets(GdkDragContext* context) +{ + return context->targets; +} +#define gdk_drag_context_list_targets wx_gdk_drag_context_list_targets + +static inline gint wx_gdk_visual_get_depth(GdkVisual* visual) +{ + return visual->depth; +} +#define gdk_visual_get_depth wx_gdk_visual_get_depth + +static inline gboolean wx_gtk_window_has_group(GtkWindow* window) +{ + return window->group != NULL; +} +#define gtk_window_has_group wx_gtk_window_has_group + +// ---------------------------------------------------------------------------- +// the following were introduced in GTK+ 2.24 + +#define gdk_window_get_visual gdk_drawable_get_visual + +static inline GdkDisplay* wx_gdk_window_get_display(GdkWindow* window) +{ + return gdk_drawable_get_display(window); +} +#define gdk_window_get_display wx_gdk_window_get_display + +static inline GdkScreen* wx_gdk_window_get_screen(GdkWindow* window) +{ + return gdk_drawable_get_screen(window); +} +#define gdk_window_get_screen wx_gdk_window_get_screen + +static inline gint wx_gdk_window_get_height(GdkWindow* window) +{ + int h; + gdk_drawable_get_size(window, NULL, &h); + return h; +} +#define gdk_window_get_height wx_gdk_window_get_height + +static inline gint wx_gdk_window_get_width(GdkWindow* window) +{ + int w; + gdk_drawable_get_size(window, &w, NULL); + return w; +} +#define gdk_window_get_width wx_gdk_window_get_width + +#if GTK_CHECK_VERSION(2,10,0) +static inline void wx_gdk_cairo_set_source_window(cairo_t* cr, GdkWindow* window, gdouble x, gdouble y) +{ + gdk_cairo_set_source_pixmap(cr, window, x, y); +} +#define gdk_cairo_set_source_window wx_gdk_cairo_set_source_window +#endif + +// ---------------------------------------------------------------------------- +// the following were introduced in Glib 2.32 + +#ifndef g_signal_handlers_disconnect_by_data +#define g_signal_handlers_disconnect_by_data(instance, data) \ + g_signal_handlers_disconnect_matched ((instance), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, (data)) +#endif + +// ---------------------------------------------------------------------------- +// the following were introduced in GTK+ 3.0 + +static inline void wx_gdk_window_get_geometry(GdkWindow* window, gint* x, gint* y, gint* width, gint* height) +{ + gdk_window_get_geometry(window, x, y, width, height, NULL); +} +#define gdk_window_get_geometry wx_gdk_window_get_geometry + +static inline GtkWidget* wx_gtk_tree_view_column_get_button(GtkTreeViewColumn* tree_column) +{ + return tree_column->button; +} +#define gtk_tree_view_column_get_button wx_gtk_tree_view_column_get_button + +static inline GtkWidget* wx_gtk_box_new(GtkOrientation orientation, gint spacing) +{ + GtkWidget* widget; + if (orientation == GTK_ORIENTATION_HORIZONTAL) + widget = gtk_hbox_new(false, spacing); + else + widget = gtk_vbox_new(false, spacing); + return widget; +} +#define gtk_box_new wx_gtk_box_new + +static inline GtkWidget* wx_gtk_button_box_new(GtkOrientation orientation) +{ + GtkWidget* widget; + if (orientation == GTK_ORIENTATION_HORIZONTAL) + widget = gtk_hbutton_box_new(); + else + widget = gtk_vbutton_box_new(); + return widget; +} +#define gtk_button_box_new wx_gtk_button_box_new + +static inline GtkWidget* wx_gtk_scale_new(GtkOrientation orientation, GtkAdjustment* adjustment) +{ + GtkWidget* widget; + if (orientation == GTK_ORIENTATION_HORIZONTAL) + widget = gtk_hscale_new(adjustment); + else + widget = gtk_vscale_new(adjustment); + return widget; +} +#define gtk_scale_new wx_gtk_scale_new + +static inline GtkWidget* wx_gtk_scrollbar_new(GtkOrientation orientation, GtkAdjustment* adjustment) +{ + GtkWidget* widget; + if (orientation == GTK_ORIENTATION_HORIZONTAL) + widget = gtk_hscrollbar_new(adjustment); + else + widget = gtk_vscrollbar_new(adjustment); + return widget; +} +#define gtk_scrollbar_new wx_gtk_scrollbar_new + +static inline GtkWidget* wx_gtk_separator_new(GtkOrientation orientation) +{ + GtkWidget* widget; + if (orientation == GTK_ORIENTATION_HORIZONTAL) + widget = gtk_hseparator_new(); + else + widget = gtk_vseparator_new(); + return widget; +} +#define gtk_separator_new wx_gtk_separator_new + +static inline void wx_gtk_widget_get_preferred_height(GtkWidget* widget, gint* minimum, gint* natural) +{ + GtkRequisition req; + gtk_widget_size_request(widget, &req); + if (minimum) + *minimum = req.height; + if (natural) + *natural = req.height; +} +#define gtk_widget_get_preferred_height wx_gtk_widget_get_preferred_height + +static inline void wx_gtk_widget_get_preferred_width(GtkWidget* widget, gint* minimum, gint* natural) +{ + GtkRequisition req; + gtk_widget_size_request(widget, &req); + if (minimum) + *minimum = req.width; + if (natural) + *natural = req.width; +} +#define gtk_widget_get_preferred_width wx_gtk_widget_get_preferred_width + +static inline void wx_gtk_widget_get_preferred_size(GtkWidget* widget, GtkRequisition* minimum, GtkRequisition* natural) +{ + GtkRequisition* req = minimum; + if (req == NULL) + req = natural; + gtk_widget_size_request(widget, req); +} +#define gtk_widget_get_preferred_size wx_gtk_widget_get_preferred_size + +#include + +#if defined(GDK_Alt_L) && !defined(GDK_KEY_Alt_L) +#define GDK_KEY_Alt_L GDK_Alt_L +#define GDK_KEY_Alt_R GDK_Alt_R +#define GDK_KEY_AudioLowerVolume GDK_AudioLowerVolume +#define GDK_KEY_AudioMute GDK_AudioMute +#define GDK_KEY_AudioNext GDK_AudioNext +#define GDK_KEY_AudioPlay GDK_AudioPlay +#define GDK_KEY_AudioPrev GDK_AudioPrev +#define GDK_KEY_AudioRaiseVolume GDK_AudioRaiseVolume +#define GDK_KEY_AudioStop GDK_AudioStop +#define GDK_KEY_Back GDK_Back +#define GDK_KEY_BackSpace GDK_BackSpace +#define GDK_KEY_Begin GDK_Begin +#define GDK_KEY_Caps_Lock GDK_Caps_Lock +#define GDK_KEY_Clear GDK_Clear +#define GDK_KEY_Control_L GDK_Control_L +#define GDK_KEY_Control_R GDK_Control_R +#define GDK_KEY_Delete GDK_Delete +#define GDK_KEY_Down GDK_Down +#define GDK_KEY_End GDK_End +#define GDK_KEY_Escape GDK_Escape +#define GDK_KEY_Execute GDK_Execute +#define GDK_KEY_F10 GDK_F10 +#define GDK_KEY_F11 GDK_F11 +#define GDK_KEY_F12 GDK_F12 +#define GDK_KEY_F1 GDK_F1 +#define GDK_KEY_F2 GDK_F2 +#define GDK_KEY_F3 GDK_F3 +#define GDK_KEY_F4 GDK_F4 +#define GDK_KEY_F5 GDK_F5 +#define GDK_KEY_F6 GDK_F6 +#define GDK_KEY_F7 GDK_F7 +#define GDK_KEY_F8 GDK_F8 +#define GDK_KEY_F9 GDK_F9 +#define GDK_KEY_Favorites GDK_Favorites +#define GDK_KEY_Forward GDK_Forward +#define GDK_KEY_Help GDK_Help +#define GDK_KEY_Home GDK_Home +#define GDK_KEY_HomePage GDK_HomePage +#define GDK_KEY_Insert GDK_Insert +#define GDK_KEY_ISO_Enter GDK_ISO_Enter +#define GDK_KEY_ISO_Left_Tab GDK_ISO_Left_Tab +#define GDK_KEY_KP_0 GDK_KP_0 +#define GDK_KEY_KP_1 GDK_KP_1 +#define GDK_KEY_KP_2 GDK_KP_2 +#define GDK_KEY_KP_3 GDK_KP_3 +#define GDK_KEY_KP_4 GDK_KP_4 +#define GDK_KEY_KP_5 GDK_KP_5 +#define GDK_KEY_KP_6 GDK_KP_6 +#define GDK_KEY_KP_7 GDK_KP_7 +#define GDK_KEY_KP_8 GDK_KP_8 +#define GDK_KEY_KP_9 GDK_KP_9 +#define GDK_KEY_KP_Add GDK_KP_Add +#define GDK_KEY_KP_Begin GDK_KP_Begin +#define GDK_KEY_KP_Decimal GDK_KP_Decimal +#define GDK_KEY_KP_Delete GDK_KP_Delete +#define GDK_KEY_KP_Divide GDK_KP_Divide +#define GDK_KEY_KP_Down GDK_KP_Down +#define GDK_KEY_KP_End GDK_KP_End +#define GDK_KEY_KP_Enter GDK_KP_Enter +#define GDK_KEY_KP_Equal GDK_KP_Equal +#define GDK_KEY_KP_F1 GDK_KP_F1 +#define GDK_KEY_KP_F2 GDK_KP_F2 +#define GDK_KEY_KP_F3 GDK_KP_F3 +#define GDK_KEY_KP_F4 GDK_KP_F4 +#define GDK_KEY_KP_Home GDK_KP_Home +#define GDK_KEY_KP_Insert GDK_KP_Insert +#define GDK_KEY_KP_Left GDK_KP_Left +#define GDK_KEY_KP_Multiply GDK_KP_Multiply +#define GDK_KEY_KP_Next GDK_KP_Next +#define GDK_KEY_KP_Prior GDK_KP_Prior +#define GDK_KEY_KP_Right GDK_KP_Right +#define GDK_KEY_KP_Separator GDK_KP_Separator +#define GDK_KEY_KP_Space GDK_KP_Space +#define GDK_KEY_KP_Subtract GDK_KP_Subtract +#define GDK_KEY_KP_Tab GDK_KP_Tab +#define GDK_KEY_KP_Up GDK_KP_Up +#define GDK_KEY_Launch0 GDK_Launch0 +#define GDK_KEY_Launch1 GDK_Launch1 +#define GDK_KEY_Launch2 GDK_Launch2 +#define GDK_KEY_Launch3 GDK_Launch3 +#define GDK_KEY_Launch4 GDK_Launch4 +#define GDK_KEY_Launch5 GDK_Launch5 +#define GDK_KEY_Launch6 GDK_Launch6 +#define GDK_KEY_Launch7 GDK_Launch7 +#define GDK_KEY_Launch8 GDK_Launch8 +#define GDK_KEY_Launch9 GDK_Launch9 +#define GDK_KEY_LaunchA GDK_LaunchA +#define GDK_KEY_LaunchB GDK_LaunchB +#define GDK_KEY_LaunchC GDK_LaunchC +#define GDK_KEY_LaunchD GDK_LaunchD +#define GDK_KEY_LaunchE GDK_LaunchE +#define GDK_KEY_LaunchF GDK_LaunchF +#define GDK_KEY_Left GDK_Left +#define GDK_KEY_Linefeed GDK_Linefeed +#define GDK_KEY_Mail GDK_Mail +#define GDK_KEY_Menu GDK_Menu +#define GDK_KEY_Meta_L GDK_Meta_L +#define GDK_KEY_Meta_R GDK_Meta_R +#define GDK_KEY_Next GDK_Next +#define GDK_KEY_Num_Lock GDK_Num_Lock +#define GDK_KEY_Page_Down GDK_Page_Down +#define GDK_KEY_Page_Up GDK_Page_Up +#define GDK_KEY_Pause GDK_Pause +#define GDK_KEY_Print GDK_Print +#define GDK_KEY_Prior GDK_Prior +#define GDK_KEY_Refresh GDK_Refresh +#define GDK_KEY_Return GDK_Return +#define GDK_KEY_Right GDK_Right +#define GDK_KEY_Scroll_Lock GDK_Scroll_Lock +#define GDK_KEY_Search GDK_Search +#define GDK_KEY_Select GDK_Select +#define GDK_KEY_Shift_L GDK_Shift_L +#define GDK_KEY_Shift_R GDK_Shift_R +#define GDK_KEY_Stop GDK_Stop +#define GDK_KEY_Super_L GDK_Super_L +#define GDK_KEY_Super_R GDK_Super_R +#define GDK_KEY_Tab GDK_Tab +#define GDK_KEY_Up GDK_Up +#endif + +// Do perform runtime checks for GTK+ 2 version: we only take the minor version +// component here, major must be 2 and we never need to test for the micro one +// anyhow. +inline bool wx_is_at_least_gtk2(int minor) +{ + return gtk_check_version(2, minor, 0) == NULL; +} + +#else // __WXGTK3__ + +// With GTK+ 3 we don't need to check for GTK+ 2 version and +// gtk_check_version() would fail due to major version mismatch. +inline bool wx_is_at_least_gtk2(int WXUNUSED(minor)) +{ + return true; +} + +#endif // !__WXGTK3__/__WXGTK3__ + +#endif // _WX_GTK_PRIVATE_COMPAT_H_ diff --git a/lib/wxWidgets/include/wx/gtk/private/gtk3-compat.h b/lib/wxWidgets/include/wx/gtk/private/gtk3-compat.h new file mode 100644 index 0000000..56e889e --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/gtk3-compat.h @@ -0,0 +1,64 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/gtk3-compat.h +// Purpose: Compatibility code for older GTK+ 3 versions +// Author: Paul Cornett +// Created: 2015-10-10 +// Copyright: (c) 2015 Paul Cornett +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRIVATE_COMPAT3_H_ +#define _WX_GTK_PRIVATE_COMPAT3_H_ + +wxGCC_WARNING_SUPPRESS(deprecated-declarations) + +#ifndef __WXGTK4__ + +// ---------------------------------------------------------------------------- +// the following were introduced in GTK+ 3.20 + +static inline gboolean wx_gtk_text_iter_starts_tag(const GtkTextIter* iter, GtkTextTag* tag) +{ + return gtk_text_iter_begins_tag(iter, tag); +} +#define gtk_text_iter_starts_tag wx_gtk_text_iter_starts_tag + +#ifdef __WXGTK3__ + +// ---------------------------------------------------------------------------- +// the following were introduced in GTK+ 3.12 + +static inline void wx_gtk_widget_set_margin_start(GtkWidget* widget, gint margin) +{ + gtk_widget_set_margin_left(widget, margin); +} +#define gtk_widget_set_margin_start wx_gtk_widget_set_margin_start + +static inline void wx_gtk_widget_set_margin_end(GtkWidget* widget, gint margin) +{ + gtk_widget_set_margin_right(widget, margin); +} +#define gtk_widget_set_margin_end wx_gtk_widget_set_margin_end + +#endif // __WXGTK3__ +#endif // !__WXGTK4__ + +wxGCC_WARNING_RESTORE() + +#if defined(__WXGTK4__) || !defined(__WXGTK3__) +static inline bool wx_is_at_least_gtk3(int /* minor */) +{ +#ifdef __WXGTK4__ + return true; +#else + return false; +#endif +} +#else +static inline bool wx_is_at_least_gtk3(int minor) +{ + return gtk_check_version(3, minor, 0) == NULL; +} +#endif + +#endif // _WX_GTK_PRIVATE_COMPAT3_H_ diff --git a/lib/wxWidgets/include/wx/gtk/private/image.h b/lib/wxWidgets/include/wx/gtk/private/image.h new file mode 100644 index 0000000..4335a7f --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/image.h @@ -0,0 +1,48 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/image.h +// Author: Paul Cornett +// Copyright: (c) 2020 Paul Cornett +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// Class that can be used in place of GtkImage, to allow drawing of alternate +// bitmaps, such as HiDPI or disabled. + +class wxGtkImage: GtkImage +{ +public: + struct BitmapProvider + { + virtual ~BitmapProvider() { } + + virtual wxBitmap Get(int scale) const = 0; + virtual void Set(const wxBitmapBundle&) { } + + // Simple helpers used in implementation. + static wxBitmap GetAtScale(const wxBitmapBundle& b, int scale) + { + return b.GetBitmap(b.GetDefaultSize() * scale); + } + }; + + static GType Type(); + static GtkWidget* New(BitmapProvider* provider); + static GtkWidget* New(wxWindow* win = NULL); + + // Use bitmaps from the given bundle, the logical bitmap size is the + // default size of the bundle. + void Set(const wxBitmapBundle& bitmapBundle); + + // This pointer is never null and is owned by this class. + BitmapProvider* m_provider; + + wxDECLARE_NO_COPY_CLASS(wxGtkImage); + + // This class is constructed by New() and destroyed by its GObject + // finalizer, so neither its ctor nor dtor can ever be used. + wxGtkImage() wxMEMBER_DELETE; + ~wxGtkImage() wxMEMBER_DELETE; +}; + +#define WX_GTK_IMAGE(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, wxGtkImage::Type(), wxGtkImage) +#define WX_GTK_IS_IMAGE(obj) G_TYPE_CHECK_INSTANCE_TYPE(obj, wxGtkImage::Type()) diff --git a/lib/wxWidgets/include/wx/gtk/private/list.h b/lib/wxWidgets/include/wx/gtk/private/list.h new file mode 100644 index 0000000..15ddf71 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/list.h @@ -0,0 +1,32 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/list.h +// Purpose: wxGtkList class. +// Author: Vadim Zeitlin +// Created: 2011-08-21 +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRIVATE_LIST_H_ +#define _WX_GTK_PRIVATE_LIST_H_ + +// ---------------------------------------------------------------------------- +// Convenience class for calling g_list_free() automatically +// ---------------------------------------------------------------------------- + +class wxGtkList +{ +public: + explicit wxGtkList(GList* list) : m_list(list) { } + ~wxGtkList() { g_list_free(m_list); } + + operator GList *() const { return m_list; } + GList * operator->() const { return m_list; } + +protected: + GList* const m_list; + + wxDECLARE_NO_COPY_CLASS(wxGtkList); +}; + +#endif // _WX_GTK_PRIVATE_LIST_H_ diff --git a/lib/wxWidgets/include/wx/gtk/private/log.h b/lib/wxWidgets/include/wx/gtk/private/log.h new file mode 100644 index 0000000..e54677b --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/log.h @@ -0,0 +1,156 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/log.h +// Purpose: Support for filtering GTK log messages. +// Author: Vadim Zeitlin +// Created: 2022-05-11 +// Copyright: (c) 2022 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRIVATE_LOG_H_ +#define _WX_GTK_PRIVATE_LOG_H_ + +#include + +// Support for custom log writers is only available in glib 2.50 or later. +#if GLIB_CHECK_VERSION(2, 50, 0) + #define wxHAS_GLIB_LOG_WRITER +#endif + +namespace wxGTKImpl +{ + +#ifdef wxHAS_GLIB_LOG_WRITER + +// LogFilter is the base class for filtering GTK log messages +// +// Note that all members of this class are defined in src/gtk/app.cpp. +class LogFilter +{ +public: + LogFilter() + { + m_next = NULL; + } + + // Allow installing our own log writer function, we don't do it by default + // because this results in a fatal error if the application had already + // called g_log_set_writer_func() on its own. + static void Allow() { ms_allowed = true; } + + // Function to call to install this filter as the active one if we're + // allowed to do this, i.e. if Allow() had been called before. + // + // Does nothing and just returns false if run-time glib version is too old. + bool Install(); + +protected: + // Function to override in the derived class to actually filter: return + // true if the message should be suppressed or false if it should be passed + // through to the default writer (which may, or not, show it). + virtual bool Filter(GLogLevelFlags log_level, + const GLogField* fields, + gsize n_fields) const = 0; + + // Typically called from the derived class dtor to stop using this filter. + void Uninstall(); + +private: + // The function used as glib log writer. + static GLogWriterOutput + wx_log_writer(GLogLevelFlags log_level, + const GLogField *fields, + gsize n_fields, + gpointer user_data); + + // False initially, indicating that we're not allowed to install our own + // logging function. + static bool ms_allowed; + + // False initially, set to true when we install wx_log_writer() as the log + // writer. Once we do it, we never change it any more. + static bool ms_installed; + + // We maintain a simple linked list of log filters and this is the head of + // this list. + static LogFilter* ms_first; + + // Next entry in the linked list, may be null. + LogFilter* m_next; + + wxDECLARE_NO_COPY_CLASS(LogFilter); +}; + +// LogFilterByLevel filters out all the messages at the specified level. +class LogFilterByLevel : public LogFilter +{ +public: + LogFilterByLevel() { } + + void SetLevelToIgnore(int flags) + { + m_logLevelToIgnore = flags; + } + +protected: + bool Filter(GLogLevelFlags log_level, + const GLogField* WXUNUSED(fields), + gsize WXUNUSED(n_fields)) const wxOVERRIDE + { + return log_level & m_logLevelToIgnore; + } + +private: + int m_logLevelToIgnore; + + wxDECLARE_NO_COPY_CLASS(LogFilterByLevel); +}; + +// LogFilterByMessage filters out all the messages with the specified content. +class LogFilterByMessage : public LogFilter +{ +public: + // Objects of this class are supposed to be created with literal strings as + // argument, so don't bother copying the string but just use the pointer. + explicit LogFilterByMessage(const char* message) + : m_message(message) + { + // We shouldn't warn about anything if Install() failed. + m_warnNotFiltered = Install(); + } + + // Remove this filter when the object goes out of scope. + // + // The dtor also checks if we actually filtered the message and logs a + // trace message with the "gtklog" mask if we didn't: this allows checking + // if the filter is actually being used. + ~LogFilterByMessage(); + +protected: + bool Filter(GLogLevelFlags WXUNUSED(log_level), + const GLogField* fields, + gsize n_fields) const wxOVERRIDE; + +private: + const char* const m_message; + + mutable bool m_warnNotFiltered; + + wxDECLARE_NO_COPY_CLASS(LogFilterByMessage); +}; + +#else // !wxHAS_GLIB_LOG_WRITER + +// Provide stubs to avoid having to use preprocessor checks in the code using +// these classes. +class LogFilterByMessage +{ +public: + explicit LogFilterByMessage(const char* WXUNUSED(message)) { } +}; + +#endif // wxHAS_GLIB_LOG_WRITER/!wxHAS_GLIB_LOG_WRITER + +} // namespace wxGTKImpl + +#endif // _WX_GTK_PRIVATE_LOG_H_ diff --git a/lib/wxWidgets/include/wx/gtk/private/mediactrl.h b/lib/wxWidgets/include/wx/gtk/private/mediactrl.h new file mode 100644 index 0000000..1338c9a --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/mediactrl.h @@ -0,0 +1,55 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/mediactrl.h +// Purpose: Wrap runtime checks to manage GTK windows with Wayland and X11 +// Author: Pierluigi Passaro +// Created: 2021-03-18 +// Copyright: (c) 2021 Pierluigi Passaro +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRIVATE_MEDIACTRL_H_ +#define _WX_GTK_PRIVATE_MEDIACTRL_H_ + +#ifdef GDK_WINDOWING_X11 + #include +#endif +#ifdef GDK_WINDOWING_WAYLAND + #include +#endif +#include "wx/gtk/private/backend.h" + +//----------------------------------------------------------------------------- +// "wxGtkGetIdFromWidget" from widget +// +// Get the windows_id performing run-time checks If the window wasn't realized +// when Load was called, this is the callback for when it is - the purpose of +// which is to tell GStreamer to play the video in our control +//----------------------------------------------------------------------------- +extern "C" { +inline gpointer wxGtkGetIdFromWidget(GtkWidget* widget) +{ + gdk_flush(); + + GdkWindow* window = gtk_widget_get_window(widget); + wxASSERT(window); + +#ifdef GDK_WINDOWING_X11 +#ifdef __WXGTK3__ + if (wxGTKImpl::IsX11(window)) +#endif + { + return (gpointer)GDK_WINDOW_XID(window); + } +#endif +#ifdef GDK_WINDOWING_WAYLAND + if (wxGTKImpl::IsWayland(window)) + { + return (gpointer)gdk_wayland_window_get_wl_surface(window); + } +#endif + + return (gpointer)NULL; +} +} + +#endif // _WX_GTK_PRIVATE_MEDIACTRL_H_ diff --git a/lib/wxWidgets/include/wx/gtk/private/messagetype.h b/lib/wxWidgets/include/wx/gtk/private/messagetype.h new file mode 100644 index 0000000..6924baf --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/messagetype.h @@ -0,0 +1,46 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/messagetype.h +// Purpose: translate between wx and GtkMessageType +// Author: Vadim Zeitlin +// Created: 2009-09-27 +// Copyright: (c) 2009 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _GTK_PRIVATE_MSGTYPE_H_ +#define _GTK_PRIVATE_MSGTYPE_H_ + +#include + +#include "wx/gtk/private/gtk2-compat.h" + +namespace wxGTKImpl +{ + +// Convert the given wx style to GtkMessageType, return true if succeeded or +// false if failed. +inline bool ConvertMessageTypeFromWX(int style, GtkMessageType *type) +{ +#ifdef __WXGTK210__ + if ( wx_is_at_least_gtk2(10) && (style & wxICON_NONE)) + *type = GTK_MESSAGE_OTHER; + else +#endif // __WXGTK210__ + if (style & wxICON_EXCLAMATION) + *type = GTK_MESSAGE_WARNING; + else if (style & wxICON_ERROR) + *type = GTK_MESSAGE_ERROR; + else if (style & wxICON_INFORMATION) + *type = GTK_MESSAGE_INFO; + else if (style & wxICON_QUESTION) + *type = GTK_MESSAGE_QUESTION; + else + return false; + + return true; +} + +} // namespace wxGTKImpl + +#endif // _GTK_PRIVATE_MSGTYPE_H_ + diff --git a/lib/wxWidgets/include/wx/gtk/private/mnemonics.h b/lib/wxWidgets/include/wx/gtk/private/mnemonics.h new file mode 100644 index 0000000..1a4bde3 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/mnemonics.h @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/mnemonics.h +// Purpose: helper functions for dealing with GTK+ mnemonics +// Author: Vadim Zeitlin +// Created: 2007-11-12 +// Copyright: (c) 2007 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _GTK_PRIVATE_MNEMONICS_H_ +#define _GTK_PRIVATE_MNEMONICS_H_ + +#if wxUSE_CONTROLS || wxUSE_MENUS + +#include "wx/string.h" + +// ---------------------------------------------------------------------------- +// functions to convert between wxWidgets and GTK+ string containing mnemonics +// ---------------------------------------------------------------------------- + +// remove all mnemonics from a string +wxString wxGTKRemoveMnemonics(const wxString& label); + +// convert a wx string with '&' to GTK+ string with '_'s +wxString wxConvertMnemonicsToGTK(const wxString& label); + +// convert a wx string with '&' to indicate mnemonics as well as HTML entities +// to a GTK+ string with "&" used instead of '&', i.e. suitable for use +// with GTK+ functions using markup strings +wxString wxConvertMnemonicsToGTKMarkup(const wxString& label); + +// convert GTK+ string with '_'s to wx string with '&'s +wxString wxConvertMnemonicsFromGTK(const wxString& label); + +#endif // wxUSE_CONTROLS || wxUSE_MENUS + +#endif // _GTK_PRIVATE_MNEMONICS_H_ + diff --git a/lib/wxWidgets/include/wx/gtk/private/object.h b/lib/wxWidgets/include/wx/gtk/private/object.h new file mode 100644 index 0000000..05fb367 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/object.h @@ -0,0 +1,35 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/object.h +// Purpose: wxGtkObject class declaration +// Author: Vadim Zeitlin +// Created: 2008-08-27 +// Copyright: (c) 2008 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRIVATE_OBJECT_H_ +#define _WX_GTK_PRIVATE_OBJECT_H_ + +// ---------------------------------------------------------------------------- +// Convenience class for calling g_object_unref() automatically +// ---------------------------------------------------------------------------- + +template +class wxGtkObject +{ +public: + explicit wxGtkObject(T *p) : m_ptr(p) { } + ~wxGtkObject() { if ( m_ptr ) g_object_unref(m_ptr); } + + operator T *() const { return m_ptr; } + +private: + T * const m_ptr; + + // copying could be implemented by using g_object_ref() but for now there + // is no need for it so don't implement it + wxDECLARE_NO_COPY_CLASS(wxGtkObject); +}; + +#endif // _WX_GTK_PRIVATE_OBJECT_H_ + diff --git a/lib/wxWidgets/include/wx/gtk/private/string.h b/lib/wxWidgets/include/wx/gtk/private/string.h new file mode 100644 index 0000000..981bf00 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/string.h @@ -0,0 +1,120 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/string.h +// Purpose: wxGtkString class declaration +// Author: Vadim Zeitlin +// Created: 2006-10-19 +// Copyright: (c) 2006 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRIVATE_STRING_H_ +#define _WX_GTK_PRIVATE_STRING_H_ + +// ---------------------------------------------------------------------------- +// Convenience class for g_freeing a gchar* on scope exit automatically +// ---------------------------------------------------------------------------- + +class wxGtkString +{ +public: + explicit wxGtkString(gchar *s) : m_str(s) { } + ~wxGtkString() { g_free(m_str); } + + const gchar *c_str() const { return m_str; } + + operator gchar *() const { return m_str; } + +private: + gchar *m_str; + + wxDECLARE_NO_COPY_CLASS(wxGtkString); +}; + + +// ---------------------------------------------------------------------------- +// list for sorting collated strings +// ---------------------------------------------------------------------------- + +#include "wx/string.h" +#include "wx/vector.h" +#include "wx/sharedptr.h" + +class wxGtkCollatableString +{ +public: + wxGtkCollatableString( const wxString &label, gchar *key ) + : m_label(label) + { + m_key = key; + } + + ~wxGtkCollatableString() + { + if (m_key) + g_free( m_key ); + } + + wxString m_label; + gchar *m_key; +}; + +class wxGtkCollatedArrayString +{ +public: + wxGtkCollatedArrayString() { } + + int Add( const wxString &new_label ) + { + int index = 0; + + gchar *new_key_lower = g_utf8_casefold( new_label.utf8_str(), -1); + gchar *new_key = g_utf8_collate_key( new_key_lower, -1); + g_free( new_key_lower ); + + wxSharedPtr new_ptr( new wxGtkCollatableString( new_label, new_key ) ); + + wxVector< wxSharedPtr >::iterator iter; + for (iter = m_list.begin(); iter != m_list.end(); ++iter) + { + wxSharedPtr ptr = *iter; + + gchar *key = ptr->m_key; + if (strcmp(key,new_key) >= 0) + { + m_list.insert( iter, new_ptr ); + return index; + } + index ++; + } + + m_list.push_back( new_ptr ); + return index; + } + + size_t GetCount() + { + return m_list.size(); + } + + wxString At( size_t index ) + { + return m_list[index]->m_label; + } + + void Clear() + { + m_list.clear(); + } + + void RemoveAt( size_t index ) + { + m_list.erase( m_list.begin() + index ); + } + +private: + wxVector< wxSharedPtr > m_list; +}; + + +#endif // _WX_GTK_PRIVATE_STRING_H_ + diff --git a/lib/wxWidgets/include/wx/gtk/private/stylecontext.h b/lib/wxWidgets/include/wx/gtk/private/stylecontext.h new file mode 100644 index 0000000..f13cc24 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/stylecontext.h @@ -0,0 +1,49 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/stylecontext.h +// Purpose: GtkStyleContext helper class +// Author: Paul Cornett +// Created: 2018-06-04 +// Copyright: (c) 2018 Paul Cornett +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRIVATE_STYLECONTEXT_H_ +#define _WX_GTK_PRIVATE_STYLECONTEXT_H_ + +#ifdef __WXGTK3__ + +class wxGtkStyleContext +{ +public: + explicit wxGtkStyleContext(double scale = 1); + ~wxGtkStyleContext(); + wxGtkStyleContext& Add(GType type, const char* objectName, ...) G_GNUC_NULL_TERMINATED; + wxGtkStyleContext& Add(const char* objectName); + wxGtkStyleContext& AddButton(); + wxGtkStyleContext& AddCheckButton(); + wxGtkStyleContext& AddHeaderbar(); + wxGtkStyleContext& AddLabel(); + wxGtkStyleContext& AddMenu(); + wxGtkStyleContext& AddMenuItem(); + wxGtkStyleContext& AddTextview(const char* child1 = NULL, const char* child2 = NULL); + wxGtkStyleContext& AddTooltip(); + wxGtkStyleContext& AddTreeview(); +#if GTK_CHECK_VERSION(3,20,0) + wxGtkStyleContext& AddTreeviewHeaderButton(int pos); +#endif // GTK >= 3.20 + wxGtkStyleContext& AddWindow(const char* className2 = NULL); + void Bg(wxColour& color, int state = GTK_STATE_FLAG_NORMAL) const; + void Fg(wxColour& color, int state = GTK_STATE_FLAG_NORMAL) const; + void Border(wxColour& color) const; + operator GtkStyleContext*() { return m_context; } + +private: + GtkStyleContext* m_context; + GtkWidgetPath* const m_path; + const int m_scale; + + wxDECLARE_NO_COPY_CLASS(wxGtkStyleContext); +}; + +#endif // __WXGTK3__ +#endif // _WX_GTK_PRIVATE_STYLECONTEXT_H_ diff --git a/lib/wxWidgets/include/wx/gtk/private/textmeasure.h b/lib/wxWidgets/include/wx/gtk/private/textmeasure.h new file mode 100644 index 0000000..dab7a26 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/textmeasure.h @@ -0,0 +1,64 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/textmeasure.h +// Purpose: wxGTK-specific declaration of wxTextMeasure class +// Author: Manuel Martin +// Created: 2012-10-05 +// Copyright: (c) 1997-2012 wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRIVATE_TEXTMEASURE_H_ +#define _WX_GTK_PRIVATE_TEXTMEASURE_H_ + +// ---------------------------------------------------------------------------- +// wxTextMeasure +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxWindowDCImpl; + +class wxTextMeasure : public wxTextMeasureBase +{ +public: + explicit wxTextMeasure(const wxDC *dc, const wxFont *font = NULL) + : wxTextMeasureBase(dc, font) + { + Init(); + } + + explicit wxTextMeasure(const wxWindow *win, const wxFont *font = NULL) + : wxTextMeasureBase(win, font) + { + Init(); + } + +protected: + // Common part of both ctors. + void Init(); + + virtual void BeginMeasuring() wxOVERRIDE; + virtual void EndMeasuring() wxOVERRIDE; + + virtual void DoGetTextExtent(const wxString& string, + wxCoord *width, + wxCoord *height, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL) wxOVERRIDE; + + virtual bool DoGetPartialTextExtents(const wxString& text, + wxArrayInt& widths, + double scaleX) wxOVERRIDE; + + // This class is only used for DC text measuring with GTK+ 2 as GTK+ 3 uses + // Cairo and not Pango for this. However it's still used even with GTK+ 3 + // for window text measuring, so the context and the layout are still + // needed. +#ifndef __WXGTK3__ + wxWindowDCImpl *m_wdc; +#endif // GTK+ < 3 + PangoContext *m_context; + PangoLayout *m_layout; + + wxDECLARE_NO_COPY_CLASS(wxTextMeasure); +}; + +#endif // _WX_GTK_PRIVATE_TEXTMEASURE_H_ diff --git a/lib/wxWidgets/include/wx/gtk/private/timer.h b/lib/wxWidgets/include/wx/gtk/private/timer.h new file mode 100644 index 0000000..cb8d44b --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/timer.h @@ -0,0 +1,35 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/timer.h +// Purpose: wxTimerImpl for wxGTK +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRIVATE_TIMER_H_ +#define _WX_GTK_PRIVATE_TIMER_H_ + +#if wxUSE_TIMER + +#include "wx/private/timer.h" + +//----------------------------------------------------------------------------- +// wxTimer +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGTKTimerImpl : public wxTimerImpl +{ +public: + wxGTKTimerImpl(wxTimer* timer) : wxTimerImpl(timer) { m_sourceId = 0; } + + virtual bool Start( int millisecs = -1, bool oneShot = false ) wxOVERRIDE; + virtual void Stop() wxOVERRIDE; + virtual bool IsRunning() const wxOVERRIDE { return m_sourceId != 0; } + +protected: + int m_sourceId; +}; + +#endif // wxUSE_TIMER + +#endif // _WX_GTK_PRIVATE_TIMER_H_ diff --git a/lib/wxWidgets/include/wx/gtk/private/tlwgeom.h b/lib/wxWidgets/include/wx/gtk/private/tlwgeom.h new file mode 100644 index 0000000..448cc4a --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/tlwgeom.h @@ -0,0 +1,75 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/tlwgeom.h +// Purpose: wxGTK-specific wxTLWGeometry class. +// Author: Vadim Zeitlin +// Created: 2018-04-29 +// Copyright: (c) 2018 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRIVATE_TLWGEOM_H_ +#define _WX_GTK_PRIVATE_TLWGEOM_H_ + +class wxTLWGeometry : public wxTLWGeometryGeneric +{ + typedef wxTLWGeometryGeneric BaseType; +public: + virtual bool Save(const Serializer& ser) const wxOVERRIDE + { + if ( !wxTLWGeometryGeneric::Save(ser) ) + return false; + + // Don't save the decoration sizes if we don't really have any values + // for them. + if ( m_decorSize.left || m_decorSize.right || + m_decorSize.top || m_decorSize.bottom ) + { + ser.SaveField("decor_l", m_decorSize.left); + ser.SaveField("decor_r", m_decorSize.right); + ser.SaveField("decor_t", m_decorSize.top); + ser.SaveField("decor_b", m_decorSize.bottom); + } + + return true; + } + + virtual bool Restore(Serializer& ser) wxOVERRIDE + { + if ( !wxTLWGeometryGeneric::Restore(ser) ) + return false; + + ser.RestoreField("decor_l", &m_decorSize.left); + ser.RestoreField("decor_r", &m_decorSize.right); + ser.RestoreField("decor_t", &m_decorSize.top); + ser.RestoreField("decor_b", &m_decorSize.bottom); + + return true; + } + + virtual bool GetFrom(const wxTopLevelWindow* tlw) wxOVERRIDE + { + if ( !wxTLWGeometryGeneric::GetFrom(tlw) ) + return false; + + m_decorSize = tlw->m_decorSize; + + return true; + } + + virtual bool ApplyTo(wxTopLevelWindow* tlw) wxOVERRIDE + { + // Don't overwrite the current decoration size if we already have it. + if ( !tlw->m_decorSize.left && !tlw->m_decorSize.right && + !tlw->m_decorSize.top && !tlw->m_decorSize.bottom ) + { + tlw->m_decorSize = m_decorSize; + } + + return BaseType::ApplyTo(tlw); + } + +private: + wxTopLevelWindow::DecorSize m_decorSize; +}; + +#endif // _WX_GTK_PRIVATE_TLWGEOM_H_ diff --git a/lib/wxWidgets/include/wx/gtk/private/treeentry_gtk.h b/lib/wxWidgets/include/wx/gtk/private/treeentry_gtk.h new file mode 100644 index 0000000..17abe2f --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/treeentry_gtk.h @@ -0,0 +1,58 @@ +/* /////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/treeentry_gtk.h +// Purpose: GtkTreeEntry - a string/userdata combo for use with treeview +// Author: Ryan Norton +// Copyright: (c) 2006 Ryan Norton +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////// */ + +#ifndef _WX_GTK_TREE_ENTRY_H_ +#define _WX_GTK_TREE_ENTRY_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include /* for gpointer and gchar* etc. */ + +#define WX_TYPE_TREE_ENTRY wx_tree_entry_get_type() +#define WX_TREE_ENTRY(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, wx_tree_entry_get_type(), wxTreeEntry) +#define WX_IS_TREE_ENTRY(obj) G_TYPE_CHECK_INSTANCE_TYPE(obj, wx_tree_entry_get_type()) + +typedef struct _wxTreeEntry wxTreeEntry; + +typedef void (*wxTreeEntryDestroy)(wxTreeEntry* entry, void* context); + +struct _wxTreeEntry +{ + GObject parent; /* object instance */ + gchar* label; /* label - always copied by this object except on get */ + gchar* collate_key; /* collate key used for string comparisons/sorting */ + gpointer userdata; /* untouched userdata */ + wxTreeEntryDestroy destroy_func; /* called upon destruction - use for freeing userdata etc. */ + gpointer destroy_func_data; /* context passed to destroy_func */ +}; + +wxTreeEntry* wx_tree_entry_new(void); + +GType wx_tree_entry_get_type(void); + +char* wx_tree_entry_get_collate_key(wxTreeEntry* entry); + +char* wx_tree_entry_get_label(wxTreeEntry* entry); + +void* wx_tree_entry_get_userdata(wxTreeEntry* entry); + +void wx_tree_entry_set_label(wxTreeEntry* entry, const char* label); + +void wx_tree_entry_set_userdata(wxTreeEntry* entry, void* userdata); + +void wx_tree_entry_set_destroy_func(wxTreeEntry* entry, + wxTreeEntryDestroy destroy_func, + gpointer destroy_func_data); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _WX_GTK_TREE_ENTRY_H_ */ diff --git a/lib/wxWidgets/include/wx/gtk/private/treeview.h b/lib/wxWidgets/include/wx/gtk/private/treeview.h new file mode 100644 index 0000000..d029a8f --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/treeview.h @@ -0,0 +1,62 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/treeview.h +// Purpose: Private helpers for wxGTK controls using GtkTreeView +// Author: Vadim Zeitlin +// Created: 2016-02-06 (extracted from src/gtk/dataview.cpp) +// Copyright: (c) 2016 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _GTK_PRIVATE_TREEVIEW_H_ +#define _GTK_PRIVATE_TREEVIEW_H_ + +// ---------------------------------------------------------------------------- +// wxGtkTreePath: RAII wrapper for GtkTreePath +// ---------------------------------------------------------------------------- + +// Usually this object is initialized with the associated GtkTreePath +// immediately when it's constructed but it can also be changed later either by +// using Assign() or by getting the pointer to the internally stored pointer +// value using ByRef(). The latter should be avoided but is very convenient +// when using GTK functions with GtkTreePath output parameters. +class wxGtkTreePath +{ +public: + // Ctor takes ownership of the given path and will free it if non-NULL. + wxGtkTreePath(GtkTreePath *path = NULL) : m_path(path) { } + + // Creates a tree path for the given string path. + wxGtkTreePath(const gchar *strpath) + : m_path(gtk_tree_path_new_from_string(strpath)) + { + } + + // Set the stored pointer if not done by ctor. + void Assign(GtkTreePath *path) + { + wxASSERT_MSG( !m_path, "shouldn't be already initialized" ); + + m_path = path; + } + + // Return the pointer to the internally stored pointer. This should only be + // used to initialize the object by passing it to some GTK function. + GtkTreePath **ByRef() + { + wxASSERT_MSG( !m_path, "shouldn't be already initialized" ); + + return &m_path; + } + + + operator GtkTreePath *() const { return m_path; } + + ~wxGtkTreePath() { if ( m_path ) gtk_tree_path_free(m_path); } + +private: + GtkTreePath *m_path; + + wxDECLARE_NO_COPY_CLASS(wxGtkTreePath); +}; + +#endif // _GTK_PRIVATE_TREEVIEW_H_ diff --git a/lib/wxWidgets/include/wx/gtk/private/value.h b/lib/wxWidgets/include/wx/gtk/private/value.h new file mode 100644 index 0000000..0b480b4 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/value.h @@ -0,0 +1,48 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/value.h +// Purpose: Helper wrapper for working with GValue. +// Author: Vadim Zeitlin +// Created: 2015-03-05 +// Copyright: (c) 2015 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRIVATE_VALUE_H_ +#define _WX_GTK_PRIVATE_VALUE_H_ + +// ---------------------------------------------------------------------------- +// wxGtkValue: RAII wrapper for GValue +// ---------------------------------------------------------------------------- + +class wxGtkValue +{ +public: + explicit wxGtkValue() + { + memset(&m_val, 0, sizeof(m_val)); + } + + // Initialize the value of the specified type. + explicit wxGtkValue(GType gtype) + { + memset(&m_val, 0, sizeof(m_val)); + g_value_init(&m_val, gtype); + } + + ~wxGtkValue() + { + g_value_unset(&m_val); + } + + // Unsafe but convenient access to the real value for GTK+ functions. + operator GValue*() { return &m_val; } + +private: + GValue m_val; + + // For now we just don't support copying at all for simplicity, it could be + // implemented later if needed. + wxDECLARE_NO_COPY_CLASS(wxGtkValue); +}; + +#endif // _WX_GTK_PRIVATE_VALUE_H_ diff --git a/lib/wxWidgets/include/wx/gtk/private/webkit.h b/lib/wxWidgets/include/wx/gtk/private/webkit.h new file mode 100644 index 0000000..10e0fec --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/webkit.h @@ -0,0 +1,71 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/webkit.h +// Purpose: wxWebKitGtk RAII wrappers declaration +// Author: Jose Lorenzo +// Created: 2017-08-21 +// Copyright: (c) 2017 Jose Lorenzo +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRIVATE_WEBKIT_H_ +#define _WX_GTK_PRIVATE_WEBKIT_H_ + +#include "wx/buffer.h" + +#include +#include + +// ---------------------------------------------------------------------------- +// RAII wrapper of WebKitJavascriptResult taking care of freeing it +// ---------------------------------------------------------------------------- + +class wxWebKitJavascriptResult +{ +public: + explicit wxWebKitJavascriptResult(WebKitJavascriptResult *r) + : m_jsresult(r) + { + } + + ~wxWebKitJavascriptResult() + { + if ( m_jsresult != NULL ) + webkit_javascript_result_unref(m_jsresult); + } + + operator WebKitJavascriptResult *() const { return m_jsresult; } + +private: + WebKitJavascriptResult *m_jsresult; + + wxDECLARE_NO_COPY_CLASS(wxWebKitJavascriptResult); +}; + +// ---------------------------------------------------------------------------- +// RAII wrapper of JSStringRef, also providing conversion to wxString +// ---------------------------------------------------------------------------- + +class wxJSStringRef +{ +public: + explicit wxJSStringRef(JSStringRef r) : m_jssref(r) { } + ~wxJSStringRef() { JSStringRelease(m_jssref); } + + wxString ToWxString() const + { + const size_t length = JSStringGetMaximumUTF8CStringSize(m_jssref); + + wxCharBuffer str(length); + + JSStringGetUTF8CString(m_jssref, str.data(), length); + + return wxString::FromUTF8(str); + } + +private: + JSStringRef m_jssref; + + wxDECLARE_NO_COPY_CLASS(wxJSStringRef); +}; + +#endif // _WX_GTK_PRIVATE_WEBKIT_H_ diff --git a/lib/wxWidgets/include/wx/gtk/private/webview_webkit2_extension.h b/lib/wxWidgets/include/wx/gtk/private/webview_webkit2_extension.h new file mode 100644 index 0000000..0fbf1df --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/webview_webkit2_extension.h @@ -0,0 +1,15 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/gtk/private/webview_webkit2_extension.h +// Purpose: Common elements for webview webkit2 extension +// Author: Scott Talbert +// Copyright: (c) 2017 Scott Talbert +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRIVATE_WEBVIEW_WEBKIT2_EXTENSION_H_ +#define _WX_GTK_PRIVATE_WEBVIEW_WEBKIT2_EXTENSION_H_ + +#define WXGTK_WEB_EXTENSION_OBJECT_PATH "/org/wxwidgets/wxGTK/WebExtension" +#define WXGTK_WEB_EXTENSION_INTERFACE "org.wxwidgets.wxGTK.WebExtension" + +#endif // _WX_GTK_PRIVATE_WEBVIEW_WEBKIT2_EXTENSION_H_ diff --git a/lib/wxWidgets/include/wx/gtk/private/win_gtk.h b/lib/wxWidgets/include/wx/gtk/private/win_gtk.h new file mode 100644 index 0000000..8a382f3 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/win_gtk.h @@ -0,0 +1,37 @@ +/* /////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/win_gtk.h +// Purpose: native GTK+ widget for wxWindow +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////// */ + +#ifndef _WX_GTK_PIZZA_H_ +#define _WX_GTK_PIZZA_H_ + +#define WX_PIZZA(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, wxPizza::type(), wxPizza) +#define WX_IS_PIZZA(obj) G_TYPE_CHECK_INSTANCE_TYPE(obj, wxPizza::type()) + +struct WXDLLIMPEXP_CORE wxPizza +{ + // borders styles which can be used with wxPizza + enum { BORDER_STYLES = + wxBORDER_SIMPLE | wxBORDER_RAISED | wxBORDER_SUNKEN | wxBORDER_THEME }; + + static GtkWidget* New(long windowStyle = 0); + static GType type(); + void move(GtkWidget* widget, int x, int y, int width, int height); + void put(GtkWidget* widget, int x, int y, int width, int height); + void scroll(int dx, int dy); + void get_border(GtkBorder& border); + void size_allocate_child( + GtkWidget* child, int x, int y, int width, int height, int parent_width = -1); + + GtkFixed m_fixed; + GList* m_children; + int m_scroll_x; + int m_scroll_y; + int m_windowStyle; +}; + +#endif // _WX_GTK_PIZZA_H_ diff --git a/lib/wxWidgets/include/wx/gtk/private/wrapgtk.h b/lib/wxWidgets/include/wx/gtk/private/wrapgtk.h new file mode 100644 index 0000000..5867388 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/private/wrapgtk.h @@ -0,0 +1,21 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/wrapgtk.h +// Purpose: Include gtk/gtk.h without warnings and with compatibility +// Author: Vadim Zeitlin +// Created: 2018-05-20 +// Copyright: (c) 2018 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRIVATE_WRAPGTK_H_ +#define _WX_GTK_PRIVATE_WRAPGTK_H_ + +wxGCC_WARNING_SUPPRESS(deprecated-declarations) +wxGCC_WARNING_SUPPRESS(parentheses) +#include +wxGCC_WARNING_RESTORE(parentheses) +wxGCC_WARNING_RESTORE(deprecated-declarations) + +#include "wx/gtk/private/gtk2-compat.h" + +#endif // _WX_GTK_PRIVATE_WRAPGTK_H_ diff --git a/lib/wxWidgets/include/wx/gtk/radiobox.h b/lib/wxWidgets/include/wx/gtk/radiobox.h new file mode 100644 index 0000000..e915770 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/radiobox.h @@ -0,0 +1,155 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/radiobox.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_RADIOBOX_H_ +#define _WX_GTK_RADIOBOX_H_ + +#include "wx/bitmap.h" + +class WXDLLIMPEXP_FWD_CORE wxGTKRadioButtonInfo; + +#include "wx/list.h" + +WX_DECLARE_EXPORTED_LIST(wxGTKRadioButtonInfo, wxRadioBoxButtonsInfoList); + + +//----------------------------------------------------------------------------- +// wxRadioBox +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxRadioBox : public wxControl, + public wxRadioBoxBase +{ +public: + // ctors and dtor + wxRadioBox() { } + wxRadioBox(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, + const wxString choices[] = (const wxString *) NULL, + int majorDim = 0, + long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioBoxNameStr)) + { + Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name ); + } + + wxRadioBox(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, + long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioBoxNameStr)) + { + Create( parent, id, title, pos, size, choices, majorDim, style, val, name ); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, + const wxString choices[] = (const wxString *) NULL, + int majorDim = 0, + long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioBoxNameStr)); + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, + long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioBoxNameStr)); + + virtual ~wxRadioBox(); + + + // implement wxItemContainerImmutable methods + virtual unsigned int GetCount() const wxOVERRIDE; + + virtual wxString GetString(unsigned int n) const wxOVERRIDE; + virtual void SetString(unsigned int n, const wxString& s) wxOVERRIDE; + + virtual void SetSelection(int n) wxOVERRIDE; + virtual int GetSelection() const wxOVERRIDE; + + + // implement wxRadioBoxBase methods + virtual bool Show(unsigned int n, bool show = true) wxOVERRIDE; + virtual bool Enable(unsigned int n, bool enable = true) wxOVERRIDE; + + virtual bool IsItemEnabled(unsigned int n) const wxOVERRIDE; + virtual bool IsItemShown(unsigned int n) const wxOVERRIDE; + + + // override some base class methods to operate on radiobox itself too + virtual bool Show( bool show = true ) wxOVERRIDE; + virtual bool Enable( bool enable = true ) wxOVERRIDE; + + virtual void SetLabel( const wxString& label ) wxOVERRIDE; + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + virtual int GetItemFromPoint( const wxPoint& pt ) const wxOVERRIDE; +#if wxUSE_HELP + // override virtual wxWindow::GetHelpTextAtPoint to use common platform independent + // wxRadioBoxBase::DoGetHelpTextAtPoint from the platform independent + // base class-interface wxRadioBoxBase. + virtual wxString GetHelpTextAtPoint(const wxPoint & pt, wxHelpEvent::Origin origin) const wxOVERRIDE + { + return wxRadioBoxBase::DoGetHelpTextAtPoint( this, pt, origin ); + } +#endif // wxUSE_HELP + + // implementation + // -------------- + + void GtkDisableEvents(); + void GtkEnableEvents(); +#if wxUSE_TOOLTIPS + virtual void GTKApplyToolTip(const char* tip) wxOVERRIDE; +#endif // wxUSE_TOOLTIPS + + wxRadioBoxButtonsInfoList m_buttonsInfo; + +protected: + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + +#if wxUSE_TOOLTIPS + virtual void DoSetItemToolTip(unsigned int n, wxToolTip *tooltip) wxOVERRIDE; +#endif + + virtual void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE; + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; + + virtual void DoEnable(bool enable) wxOVERRIDE; + + virtual bool GTKNeedsToFilterSameWindowFocus() const wxOVERRIDE { return true; } + + virtual bool GTKWidgetNeedsMnemonic() const wxOVERRIDE; + virtual void GTKWidgetDoSetMnemonic(GtkWidget* w) wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxRadioBox); +}; + +#endif // _WX_GTK_RADIOBOX_H_ diff --git a/lib/wxWidgets/include/wx/gtk/radiobut.h b/lib/wxWidgets/include/wx/gtk/radiobut.h new file mode 100644 index 0000000..e738878 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/radiobut.h @@ -0,0 +1,64 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/radiobut.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_RADIOBUT_H_ +#define _WX_GTK_RADIOBUT_H_ + +//----------------------------------------------------------------------------- +// wxRadioButton +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxRadioButton: public wxRadioButtonBase +{ +public: + wxRadioButton() { } + wxRadioButton( wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioButtonNameStr) ) + { + Create( parent, id, label, pos, size, style, validator, name ); + } + + virtual ~wxRadioButton(); + + bool Create( wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioButtonNameStr) ); + + virtual void SetLabel(const wxString& label) wxOVERRIDE; + virtual void SetValue(bool val) wxOVERRIDE; + virtual bool GetValue() const wxOVERRIDE; + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + +protected: + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + + virtual void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE; + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; + + virtual void DoEnable(bool enable) wxOVERRIDE; + +private: + typedef wxControl base_type; + + wxDECLARE_DYNAMIC_CLASS(wxRadioButton); +}; + +#endif // _WX_GTK_RADIOBUT_H_ diff --git a/lib/wxWidgets/include/wx/gtk/region.h b/lib/wxWidgets/include/wx/gtk/region.h new file mode 100644 index 0000000..f8282c6 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/region.h @@ -0,0 +1,138 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/region.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_REGION_H_ +#define _WX_GTK_REGION_H_ + +#ifdef __WXGTK3__ +typedef struct _cairo_region cairo_region_t; +#endif + +// ---------------------------------------------------------------------------- +// wxRegion +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxRegion : public wxRegionBase +{ +public: + wxRegion() { } + + wxRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h ) + { + InitRect(x, y, w, h); + } + + wxRegion( const wxPoint& topLeft, const wxPoint& bottomRight ) + { + InitRect(topLeft.x, topLeft.y, + bottomRight.x - topLeft.x, bottomRight.y - topLeft.y); + } + + wxRegion( const wxRect& rect ) + { + InitRect(rect.x, rect.y, rect.width, rect.height); + } + + wxRegion( size_t n, const wxPoint *points, + wxPolygonFillMode fillStyle = wxODDEVEN_RULE ); + +#if wxUSE_IMAGE + wxRegion( const wxBitmap& bmp) + { + Union(bmp); + } + wxRegion( const wxBitmap& bmp, + const wxColour& transColour, int tolerance = 0) + { + Union(bmp, transColour, tolerance); + } +#endif // wxUSE_IMAGE + + virtual ~wxRegion(); + + // wxRegionBase methods + virtual void Clear() wxOVERRIDE; + virtual bool IsEmpty() const wxOVERRIDE; + +#ifdef __WXGTK3__ + cairo_region_t* GetRegion() const; +#else + wxRegion(const GdkRegion* region); + GdkRegion *GetRegion() const; +#endif + +protected: + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + + // wxRegionBase pure virtuals + virtual bool DoIsEqual(const wxRegion& region) const wxOVERRIDE; + virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const wxOVERRIDE; + virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const wxOVERRIDE; + virtual wxRegionContain DoContainsRect(const wxRect& rect) const wxOVERRIDE; + + virtual bool DoOffset(wxCoord x, wxCoord y) wxOVERRIDE; + virtual bool DoUnionWithRect(const wxRect& rect) wxOVERRIDE; + virtual bool DoUnionWithRegion(const wxRegion& region) wxOVERRIDE; + virtual bool DoIntersect(const wxRegion& region) wxOVERRIDE; + virtual bool DoSubtract(const wxRegion& region) wxOVERRIDE; + virtual bool DoXor(const wxRegion& region) wxOVERRIDE; + + // common part of ctors for a rectangle region + void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h); + +private: + wxDECLARE_DYNAMIC_CLASS(wxRegion); +}; + +// ---------------------------------------------------------------------------- +// wxRegionIterator: decomposes a region into rectangles +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxRegionIterator: public wxObject +{ +public: + wxRegionIterator(); + wxRegionIterator(const wxRegion& region); + wxRegionIterator(const wxRegionIterator& ri) : wxObject(ri) { Init(); *this = ri; } + ~wxRegionIterator(); + + wxRegionIterator& operator=(const wxRegionIterator& ri); + + void Reset() { m_current = 0u; } + void Reset(const wxRegion& region); + + bool HaveRects() const; + operator bool () const { return HaveRects(); } + + wxRegionIterator& operator ++ (); + wxRegionIterator operator ++ (int); + + wxCoord GetX() const; + wxCoord GetY() const; + wxCoord GetW() const; + wxCoord GetWidth() const { return GetW(); } + wxCoord GetH() const; + wxCoord GetHeight() const { return GetH(); } + wxRect GetRect() const; + +private: + void Init(); + void CreateRects( const wxRegion& r ); + + wxRegion m_region; + wxRect *m_rects; + int m_numRects; + int m_current; + + wxDECLARE_DYNAMIC_CLASS(wxRegionIterator); +}; + + +#endif + // _WX_GTK_REGION_H_ diff --git a/lib/wxWidgets/include/wx/gtk/scrolbar.h b/lib/wxWidgets/include/wx/gtk/scrolbar.h new file mode 100644 index 0000000..442a153 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/scrolbar.h @@ -0,0 +1,54 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/scrolbar.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_SCROLLBAR_H_ +#define _WX_GTK_SCROLLBAR_H_ + +//----------------------------------------------------------------------------- +// wxScrollBar +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxScrollBar: public wxScrollBarBase +{ +public: + wxScrollBar(); + inline wxScrollBar( wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSB_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxScrollBarNameStr) ) + { + Create( parent, id, pos, size, style, validator, name ); + } + bool Create( wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSB_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxScrollBarNameStr) ); + virtual ~wxScrollBar(); + int GetThumbPosition() const wxOVERRIDE; + int GetThumbSize() const wxOVERRIDE; + int GetPageSize() const wxOVERRIDE; + int GetRange() const wxOVERRIDE; + virtual void SetThumbPosition( int viewStart ) wxOVERRIDE; + virtual void SetScrollbar( int position, int thumbSize, int range, int pageSize, + bool refresh = true ) wxOVERRIDE; + + void SetThumbSize(int thumbSize); + void SetPageSize( int pageLength ); + void SetRange(int range); + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + wxDECLARE_DYNAMIC_CLASS(wxScrollBar); +}; + +#endif // _WX_GTK_SCROLLBAR_H_ diff --git a/lib/wxWidgets/include/wx/gtk/scrolwin.h b/lib/wxWidgets/include/wx/gtk/scrolwin.h new file mode 100644 index 0000000..5ed38a7 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/scrolwin.h @@ -0,0 +1,79 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/scrolwin.h +// Purpose: wxScrolledWindow class +// Author: Robert Roebling +// Modified by: Vadim Zeitlin (2005-10-10): wxScrolledWindow is now common +// Created: 01/02/97 +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_SCROLLWIN_H_ +#define _WX_GTK_SCROLLWIN_H_ + +// ---------------------------------------------------------------------------- +// wxScrolledWindow +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxScrollHelper : public wxScrollHelperBase +{ + typedef wxScrollHelperBase base_type; +public: + // default ctor doesn't do anything + wxScrollHelper(wxWindow *win) : wxScrollHelperBase(win) { } + + // implement the base class methods + virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, + int noUnitsX, int noUnitsY, + int xPos = 0, int yPos = 0, + bool noRefresh = false) wxOVERRIDE; + virtual void AdjustScrollbars() wxOVERRIDE; + + virtual bool IsScrollbarShown(int orient) const wxOVERRIDE; + +protected: + virtual void DoScroll(int x, int y) wxOVERRIDE; + virtual void DoShowScrollbars(wxScrollbarVisibility horz, + wxScrollbarVisibility vert) wxOVERRIDE; + +private: + // this does (each) half of AdjustScrollbars() work + void DoAdjustScrollbar(GtkRange* range, + int pixelsPerLine, + int winSize, + int virtSize, + int *pos, + int *lines, + int *linesPerPage); + + void DoAdjustHScrollbar(int winSize, int virtSize) + { + DoAdjustScrollbar + ( + m_win->m_scrollBar[wxWindow::ScrollDir_Horz], + m_xScrollPixelsPerLine, winSize, virtSize, + &m_xScrollPosition, &m_xScrollLines, &m_xScrollLinesPerPage + ); + } + + void DoAdjustVScrollbar(int winSize, int virtSize) + { + DoAdjustScrollbar + ( + m_win->m_scrollBar[wxWindow::ScrollDir_Vert], + m_yScrollPixelsPerLine, winSize, virtSize, + &m_yScrollPosition, &m_yScrollLines, &m_yScrollLinesPerPage + ); + } + + // and this does the same for Scroll() + void DoScrollOneDir(int orient, + int pos, + int pixelsPerLine, + int *posOld); + + wxDECLARE_NO_COPY_CLASS(wxScrollHelper); +}; + +#endif // _WX_GTK_SCROLLWIN_H_ + diff --git a/lib/wxWidgets/include/wx/gtk/setup.h b/lib/wxWidgets/include/wx/gtk/setup.h new file mode 100644 index 0000000..367d95e --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/setup.h @@ -0,0 +1,1844 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/setup.h +// Purpose: Configuration for the library +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SETUP_H_ +#define _WX_SETUP_H_ + +/* --- start common options --- */ +// ---------------------------------------------------------------------------- +// global settings +// ---------------------------------------------------------------------------- + +// define this to 0 when building wxBase library - this can also be done from +// makefile/project file overriding the value here +#ifndef wxUSE_GUI + #define wxUSE_GUI 1 +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// compatibility settings +// ---------------------------------------------------------------------------- + +// This setting determines the compatibility with 2.8 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_8 0 + +// This setting determines the compatibility with 3.0 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_3_0 1 + +// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when +// default system font is used for wxWindow::GetCharWidth/Height() instead of +// the current font. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxDIALOG_UNIT_COMPATIBILITY 0 + +// Provide unsafe implicit conversions in wxString to "const char*" or +// "std::string" (depending on wxUSE_STD_STRING_CONV_IN_WXSTRING value). +// +// Default is 1 but only for compatibility reasons, it is recommended to set +// this to 0 because converting wxString to a narrow (non-Unicode) string may +// fail unless a locale using UTF-8 encoding is used, which is never the case +// under MSW, for example, hence such conversions can result in silent data +// loss. +// +// Recommended setting: 0 +#define wxUSE_UNSAFE_WXSTRING_CONV 1 + +// If set to 1, enables "reproducible builds", i.e. build output should be +// exactly the same if the same build is redone again. As using __DATE__ and +// __TIME__ macros clearly makes the build irreproducible, setting this option +// to 1 disables their use in the library code. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_REPRODUCIBLE_BUILD 0 + +// ---------------------------------------------------------------------------- +// debugging settings +// ---------------------------------------------------------------------------- + +// wxDEBUG_LEVEL will be defined as 1 in wx/debug.h so normally there is no +// need to define it here. You may do it for two reasons: either completely +// disable/compile out the asserts in release version (then do it inside #ifdef +// NDEBUG) or, on the contrary, enable more asserts, including the usually +// disabled ones, in the debug build (then do it inside #ifndef NDEBUG) +// +// #ifdef NDEBUG +// #define wxDEBUG_LEVEL 0 +// #else +// #define wxDEBUG_LEVEL 2 +// #endif + +// wxHandleFatalExceptions() may be used to catch the program faults at run +// time and, instead of terminating the program with a usual GPF message box, +// call the user-defined wxApp::OnFatalException() function. If you set +// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. +// +// This setting is for Win32 only and can only be enabled if your compiler +// supports Win32 structured exception handling (currently only VC++ does) +// +// Default is 1 +// +// Recommended setting: 1 if your compiler supports it. +#define wxUSE_ON_FATAL_EXCEPTION 1 + +// Set this to 1 to be able to generate a human-readable (unlike +// machine-readable minidump created by wxCrashReport::Generate()) stack back +// trace when your program crashes using wxStackWalker +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_STACKWALKER 1 + +// Set this to 1 to compile in wxDebugReport class which allows you to create +// and optionally upload to your web site a debug report consisting of back +// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, it is compiled into a separate library so there +// is no overhead if you don't use it +#define wxUSE_DEBUGREPORT 1 + +// Generic comment about debugging settings: they are very useful if you don't +// use any other memory leak detection tools such as Purify/BoundsChecker, but +// are probably redundant otherwise. Also, Visual C++ CRT has the same features +// as wxWidgets memory debugging subsystem built in since version 5.0 and you +// may prefer to use it instead of built in memory debugging code because it is +// faster and more fool proof. +// +// Using VC++ CRT memory debugging is enabled by default in debug build (_DEBUG +// is defined) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) +// and if __NO_VC_CRTDBG__ is not defined. + +// The rest of the options in this section are obsolete and not supported, +// enable them at your own risk. + +// If 1, enables wxDebugContext, for writing error messages to file, etc. If +// __WXDEBUG__ is not defined, will still use the normal memory operators. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_CONTEXT 0 + +// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* +// __WXDEBUG__ is also defined. +// +// WARNING: this code may not work with all architectures, especially if +// alignment is an issue. This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 1 if you are not using a memory debugging tool, else 0 +#define wxUSE_MEMORY_TRACING 0 + +// In debug mode, cause new and delete to be redefined globally. +// If this causes problems (e.g. link errors which is a common problem +// especially if you use another library which also redefines the global new +// and delete), set this to 0. +// This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If +// this causes problems (e.g. link errors), set this to 0. You may need to set +// this to 0 if using templates (at least for VC++). This switch is currently +// ignored for MinGW/Cygwin. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_NEW_ALWAYS 0 + + +// ---------------------------------------------------------------------------- +// Unicode support +// ---------------------------------------------------------------------------- + +// This option is deprecated: the library should be always built in Unicode mode +// now, only set wxUSE_UNICODE to 0 to compile legacy code in ANSI mode if +// absolutely necessary -- updating it is strongly recommended as the ANSI mode +// will disappear completely in future wxWidgets releases. +#ifndef wxUSE_UNICODE + #define wxUSE_UNICODE 1 +#endif + +// ---------------------------------------------------------------------------- +// global features +// ---------------------------------------------------------------------------- + +// Compile library in exception-safe mode? If set to 1, the library will try to +// behave correctly in presence of exceptions (even though it still will not +// use the exceptions itself) and notify the user code about any unhandled +// exceptions. If set to 0, propagation of the exceptions through the library +// code will lead to undefined behaviour -- but the code itself will be +// slightly smaller and faster. +// +// Note that like wxUSE_THREADS this option is automatically set to 0 if +// wxNO_EXCEPTIONS is defined. +// +// Default is 1 +// +// Recommended setting: depends on whether you intend to use C++ exceptions +// in your own code (1 if you do, 0 if you don't) +#define wxUSE_EXCEPTIONS 1 + +// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI +// +// This feature is incomplete and experimental, please only enable it if +// you want to participate in its development. +// +// Recommended setting: 0 (unless you wish to try working on it). +#define wxUSE_EXTENDED_RTTI 0 + +// Support for message/error logging. This includes wxLogXXX() functions and +// wxLog and derived classes. Don't set this to 0 unless you really know what +// you are doing. +// +// Default is 1 +// +// Recommended setting: 1 (always) +#define wxUSE_LOG 1 + +// Recommended setting: 1 +#define wxUSE_LOGWINDOW 1 + +// Recommended setting: 1 +#define wxUSE_LOGGUI 1 + +// Recommended setting: 1 +#define wxUSE_LOG_DIALOG 1 + +// Support for command line parsing using wxCmdLineParser class. +// +// Default is 1 +// +// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) +#define wxUSE_CMDLINE_PARSER 1 + +// Support for multithreaded applications: if 1, compile in thread classes +// (thread.h) and make the library a bit more thread safe. Although thread +// support is quite stable by now, you may still consider recompiling the +// library without it if you have no use for it - this will result in a +// somewhat smaller and faster operation. +// +// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset +// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in +// build/msw/config.* file this value will have no effect. +// +// Default is 1 +// +// Recommended setting: 0 unless you do plan to develop MT applications +#define wxUSE_THREADS 1 + +// If enabled, compiles wxWidgets streams classes +// +// wx stream classes are used for image IO, process IO redirection, network +// protocols implementation and much more and so disabling this results in a +// lot of other functionality being lost. +// +// Default is 1 +// +// Recommended setting: 1 as setting it to 0 disables many other things +#define wxUSE_STREAMS 1 + +// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. +// Note that if the system's implementation does not support positional +// parameters, setting this to 1 forces the use of the wxWidgets implementation +// of wxVsnprintf. The standard vsnprintf() supports positional parameters on +// many Unix systems but usually doesn't under Windows. +// +// Positional parameters are very useful when translating a program since using +// them in formatting strings allow translators to correctly reorder the +// translated sentences. +// +// Default is 1 +// +// Recommended setting: 1 if you want to support multiple languages +#define wxUSE_PRINTF_POS_PARAMS 1 + +// Enable the use of compiler-specific thread local storage keyword, if any. +// This is used for wxTLS_XXX() macros implementation and normally should use +// the compiler-provided support as it's simpler and more efficient, but is +// disabled under Windows in wx/msw/chkconf.h as it can't be used if wxWidgets +// is used in a dynamically loaded Win32 DLL (i.e. using LoadLibrary()) under +// XP as this triggers a bug in compiler TLS support that results in crashes +// when any TLS variables are used. +// +// If you're absolutely sure that your build of wxWidgets is never going to be +// used in such situation, either because it's not going to be linked from any +// kind of plugin or because you only target Vista or later systems, you can +// set this to 2 to force the use of compiler TLS even under MSW. +// +// Default is 1 meaning that compiler TLS is used only if it's 100% safe. +// +// Recommended setting: 2 if you want to have maximal performance and don't +// care about the scenario described above. +#define wxUSE_COMPILER_TLS 1 + +// ---------------------------------------------------------------------------- +// Interoperability with the standard library. +// ---------------------------------------------------------------------------- + +// Set wxUSE_STL to 1 to enable maximal interoperability with the standard +// library, even at the cost of backwards compatibility. +// +// Default is 0 +// +// Recommended setting: 0 as the options below already provide a relatively +// good level of interoperability and changing this option arguably isn't worth +// diverging from the official builds of the library. +#define wxUSE_STL 0 + +// This is not a real option but is used as the default value for +// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS_COMPATIBLY. +// +// Set it to 0 if you want to disable the use of all standard classes +// completely for some reason. +#define wxUSE_STD_DEFAULT 1 + +// Use standard C++ containers where it can be done without breaking backwards +// compatibility. +// +// This provides better interoperability with the standard library, e.g. with +// this option on it's possible to insert std::vector<> into many wxWidgets +// containers directly. +// +// Default is 1. +// +// Recommended setting is 1 unless you want to avoid all dependencies on the +// standard library. +#define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT + +// Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<> +// and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but +// usually more limited) implementations are used which allows to avoid the +// dependency on the C++ run-time library. +// +// Default is 0 for compatibility reasons. +// +// Recommended setting: 1 unless compatibility with the official wxWidgets +// build and/or the existing code is a concern. +#define wxUSE_STD_CONTAINERS 0 + +// Use standard C++ streams if 1 instead of wx streams in some places. If +// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the +// standard streams library. +// +// Notice that enabling this does not replace wx streams with std streams +// everywhere, in a lot of places wx streams are used no matter what. +// +// Default is 1 if compiler supports it. +// +// Recommended setting: 1 if you use the standard streams anyhow and so +// dependency on the standard streams library is not a +// problem +#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT + +// Enable minimal interoperability with the standard C++ string class if 1. +// "Minimal" means that wxString can be constructed from std::string or +// std::wstring but can't be implicitly converted to them. You need to enable +// the option below for the latter. +// +// Default is 1 for most compilers. +// +// Recommended setting: 1 unless you want to ensure your program doesn't use +// the standard C++ library at all. +#define wxUSE_STD_STRING wxUSE_STD_DEFAULT + +// Make wxString as much interchangeable with std::[w]string as possible, in +// particular allow implicit conversion of wxString to either of these classes. +// This comes at a price (or a benefit, depending on your point of view) of not +// allowing implicit conversion to "const char *" and "const wchar_t *". +// +// Because a lot of existing code relies on these conversions, this option is +// disabled by default but can be enabled for your build if you don't care +// about compatibility. +// +// Default is 0 if wxUSE_STL has its default value or 1 if it is enabled. +// +// Recommended setting: 0 to remain compatible with the official builds of +// wxWidgets. +#define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL + +// ---------------------------------------------------------------------------- +// non GUI features selection +// ---------------------------------------------------------------------------- + +// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit +// integer which is implemented in terms of native 64 bit integers if any or +// uses emulation otherwise. +// +// This class is required by wxDateTime and so you should enable it if you want +// to use wxDateTime. For most modern platforms, it will use the native 64 bit +// integers in which case (almost) all of its functions are inline and it +// almost does not take any space, so there should be no reason to switch it +// off. +// +// Recommended setting: 1 +#define wxUSE_LONGLONG 1 + +// Set wxUSE_BASE64 to 1, to compile in Base64 support. This is required for +// storing binary data in wxConfig on most platforms. +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_BASE64 1 + +// Set this to 1 to be able to use wxEventLoop even in console applications +// (i.e. using base library only, without GUI). This is mostly useful for +// processing socket events but is also necessary to use timers in console +// applications +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_CONSOLE_EVENTLOOP 1 + +// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level +// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. +// +// Default is 1 +// +// Recommended setting: 1 (wxFile is highly recommended as it is required by +// i18n code, wxFileConfig and others) +#define wxUSE_FILE 1 +#define wxUSE_FFILE 1 + +// Use wxFSVolume class providing access to the configured/active mount points +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely disabled if you don't use it) +#define wxUSE_FSVOLUME 1 + +// Use wxSecretStore class for storing passwords using OS-specific facilities. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely disabled if you don't use it) +#define wxUSE_SECRETSTORE 1 + +// Allow the use of the OS built-in spell checker in wxTextCtrl. +// +// Default is 1, the corresponding wxTextCtrl functions simply won't do +// anything if the functionality is not supported by the current platform. +// +// Recommended setting: 1 unless you want to save a tiny bit of code. +#define wxUSE_SPELLCHECK 1 + +// Use wxStandardPaths class which allows to retrieve some standard locations +// in the file system +// +// Default is 1 +// +// Recommended setting: 1 (may be disabled to save space, but not much) +#define wxUSE_STDPATHS 1 + +// use wxTextBuffer class: required by wxTextFile +#define wxUSE_TEXTBUFFER 1 + +// use wxTextFile class: requires wxFile and wxTextBuffer, required by +// wxFileConfig +#define wxUSE_TEXTFILE 1 + +// i18n support: _() macro, wxLocale class. +#define wxUSE_INTL 1 + +// Provide wxFoo_l() functions similar to standard foo() functions but taking +// an extra locale parameter. +// +// Notice that this is fully implemented only for the systems providing POSIX +// xlocale support or Microsoft Visual C++ >= 8 (which provides proprietary +// almost-equivalent of xlocale functions), otherwise wxFoo_l() functions will +// only work for the current user locale and "C" locale. You can use +// wxHAS_XLOCALE_SUPPORT to test whether the full support is available. +// +// Default is 1 +// +// Recommended setting: 1 but may be disabled if you are writing programs +// running only in C locale anyhow +#define wxUSE_XLOCALE 1 + +// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which +// allow to manipulate dates, times and time intervals. +// +// Requires: wxUSE_LONGLONG +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_DATETIME 1 + +// Set wxUSE_TIMER to 1 to compile wxTimer class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_TIMER 1 + +// Use wxStopWatch class. +// +// Default is 1 +// +// Recommended setting: 1 (needed by wxSocket) +#define wxUSE_STOPWATCH 1 + +// Set wxUSE_FSWATCHER to 1 if you want to enable wxFileSystemWatcher +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_FSWATCHER 1 + +// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes +// which allow the application to store its settings in the persistent +// storage. Setting this to 1 will also enable on-demand creation of the +// global config object in wxApp. +// +// See also wxUSE_CONFIG_NATIVE below. +// +// Recommended setting: 1 +#define wxUSE_CONFIG 1 + +// If wxUSE_CONFIG is 1, you may choose to use either the native config +// classes under Windows (using the registry) or the portable text file +// format used by the config classes under Unix. +// +// Default is 1 to use native classes. Note that you may still use +// wxFileConfig even if you set this to 1 - just the config object created by +// default for the applications needs will be a wxRegConfig or wxIniConfig and +// not wxFileConfig. +// +// Recommended setting: 1 +#define wxUSE_CONFIG_NATIVE 1 + +// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows +// to connect/disconnect from the network and be notified whenever the dial-up +// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DIALUP_MANAGER 1 + +// Compile in classes for run-time DLL loading and function calling. +// Required by wxUSE_DIALUP_MANAGER. +// +// This setting is for Win32 only +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DYNLIB_CLASS 1 + +// experimental, don't use for now +#define wxUSE_DYNAMIC_LOADER 1 + +// Set to 1 to use socket classes +#define wxUSE_SOCKETS 1 + +// Set to 1 to use ipv6 socket classes (requires wxUSE_SOCKETS) +// +// Default is 1. +// +// Recommended setting: 1. +#define wxUSE_IPV6 1 + +// Set to 1 to enable virtual file systems (required by wxHTML) +#define wxUSE_FILESYSTEM 1 + +// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ZIP 1 + +// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ARCHIVE 1 + +// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_INET 1 + +// wxArchive classes for accessing archives such as zip and tar +#define wxUSE_ARCHIVE_STREAMS 1 + +// Set to 1 to compile wxZipInput/OutputStream classes. +#define wxUSE_ZIPSTREAM 1 + +// Set to 1 to compile wxTarInput/OutputStream classes. +#define wxUSE_TARSTREAM 1 + +// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by +// wxUSE_LIBPNG +#define wxUSE_ZLIB 1 + +// Set to 1 if liblzma is available to enable wxLZMA{Input,Output}Stream +// classes. +// +// Notice that if you enable this build option when not using configure or +// CMake, you need to ensure that liblzma headers and libraries are available +// (i.e. by building the library yourself or downloading its binaries) and can +// be found, either by copying them to one of the locations searched by the +// compiler/linker by default (e.g. any of the directories in the INCLUDE or +// LIB environment variables, respectively, when using MSVC) or modify the +// make- or project files to add references to these directories. +// +// Default is 0 under MSW, auto-detected by configure. +// +// Recommended setting: 1 if you need LZMA compression. +#define wxUSE_LIBLZMA 0 + +// If enabled, the code written by Apple will be used to write, in a portable +// way, float on the disk. See extended.c for the license which is different +// from wxWidgets one. +// +// Default is 1. +// +// Recommended setting: 1 unless you don't like the license terms (unlikely) +#define wxUSE_APPLE_IEEE 1 + +// Joystick support class +#define wxUSE_JOYSTICK 1 + +// wxFontEnumerator class +#define wxUSE_FONTENUM 1 + +// wxFontMapper class +#define wxUSE_FONTMAP 1 + +// wxMimeTypesManager class +#define wxUSE_MIMETYPE 1 + +// wxWebRequest allows usage of system libraries for HTTP(S) requests. +// +// Note that for wxWebRequest to be built, at least one of its backends must be +// available. Under MSW and macOS this will always be the case unless +// explicitly disabled. +// +// Default is 1 +// +// Recommended setting: 1, setting it to 0 may be useful to avoid dependencies +// on libcurl on Unix systems. +#define wxUSE_WEBREQUEST 1 + +// wxWebRequest backend based on NSURLSession +// +// Default is 1 under macOS. +// +// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, +// otherwise wxWebRequest won't be available at all under Mac. +#ifdef __APPLE__ +#define wxUSE_WEBREQUEST_URLSESSION wxUSE_WEBREQUEST +#else +#define wxUSE_WEBREQUEST_URLSESSION 0 +#endif + +// wxWebRequest backend based on libcurl, can be used under all platforms. +// +// Default is 0 for MSW and macOS, detected automatically when using configure. +// +// Recommended setting: 0 on Windows and macOS, otherwise 1 as it is required +// for wxWebRequest to be available at all. +#define wxUSE_WEBREQUEST_CURL 0 + +// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP +// or wxURL you need to set this to 1. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_PROTOCOL 1 + +// The settings for the individual URL schemes +#define wxUSE_PROTOCOL_FILE 1 +#define wxUSE_PROTOCOL_FTP 1 +#define wxUSE_PROTOCOL_HTTP 1 + +// Define this to use wxURL class. +#define wxUSE_URL 1 + +// Define this to use native platform url and protocol support. +// Currently valid only for MS-Windows. +// Note: if you set this to 1, you can open ftp/http/gopher sites +// and obtain a valid input stream for these sites +// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. +// Doing so reduces the code size. +// +// This code is experimental and subject to change. +#define wxUSE_URL_NATIVE 0 + +// Support for wxVariant class used in several places throughout the library, +// notably in wxDataViewCtrl API. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size as much as +// possible in which case setting this to 0 can gain up to 100KB. +#define wxUSE_VARIANT 1 + +// Support for wxAny class, the successor for wxVariant. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size by a small amount, +// or your compiler cannot for some reason cope with complexity of templates used. +#define wxUSE_ANY 1 + +// Support for regular expression matching via wxRegEx class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_REGEX 1 + +// wxSystemOptions class +#define wxUSE_SYSTEM_OPTIONS 1 + +// wxSound class +#define wxUSE_SOUND 1 + +// Use wxMediaCtrl +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_MEDIACTRL 1 + +// Use wxWidget's XRC XML-based resource system. Recommended. +// +// Default is 1 +// +// Recommended setting: 1 (requires wxUSE_XML) +#define wxUSE_XRC 1 + +// XML parsing classes. +// +// Default is 1 +// +// Recommended setting: 1 (required by XRC) +#define wxUSE_XML 1 + +// Use wxWidget's AUI docking system +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_AUI 1 + +// Use wxWidget's Ribbon classes for interfaces +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_RIBBON 1 + +// Use wxPropertyGrid. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_PROPGRID 1 + +// Use wxStyledTextCtrl, a wxWidgets Scintilla wrapper. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STC 1 + +// Use wxWidget's web viewing classes +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_WEBVIEW 1 + +// Use the IE wxWebView backend +// +// Default is 1 on MSW +// +// Recommended setting: 1 +#ifdef __WXMSW__ +#define wxUSE_WEBVIEW_IE 1 +#else +#define wxUSE_WEBVIEW_IE 0 +#endif + +// Use the Edge (Chromium) wxWebView backend (Requires WebView2 SDK) +// +// Default is 0 because WebView2 is not always available, set it to 1 if you do have it. +// +// Recommended setting: 1 when building for Windows with WebView2 SDK +#define wxUSE_WEBVIEW_EDGE 0 + +// Use the Edge (Chromium) wxWebView backend without loader DLL +// +// Default is 0, set it to 1 if you don't want to depend on WebView2Loader.dll. +// +// Recommended setting: 0 +#define wxUSE_WEBVIEW_EDGE_STATIC 0 + +// Use the WebKit wxWebView backend +// +// Default is 1 on GTK and OSX +// +// Recommended setting: 1 +#if (defined(__WXGTK__) && !defined(__WXGTK3__)) || defined(__WXOSX__) +#define wxUSE_WEBVIEW_WEBKIT 1 +#else +#define wxUSE_WEBVIEW_WEBKIT 0 +#endif + +// Use the WebKit2 wxWebView backend +// +// Default is 1 on GTK3 +// +// Recommended setting: 1 +#if defined(__WXGTK3__) +#define wxUSE_WEBVIEW_WEBKIT2 1 +#else +#define wxUSE_WEBVIEW_WEBKIT2 0 +#endif + +// Enable wxGraphicsContext and related classes for a modern 2D drawing API. +// +// Default is 1 except if you're using a compiler without support for GDI+ +// under MSW, i.e. gdiplus.h and related headers (MSVC and MinGW >= 4.8 are +// known to have them). For other compilers (e.g. older mingw32) you may need +// to install the headers (and just the headers) yourself. If you do, change +// the setting below manually. +// +// Recommended setting: 1 if supported by the compilation environment + +// Notice that we can't use wxCHECK_VISUALC_VERSION() nor wxCHECK_GCC_VERSION() +// here as this file is included from wx/platform.h before they're defined. +#if defined(_MSC_VER) || \ + (defined(__MINGW32__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 8)) +#define wxUSE_GRAPHICS_CONTEXT 1 +#else +// Disable support for other Windows compilers, enable it if your compiler +// comes with new enough SDK or you installed the headers manually. +// +// Notice that this will be set by configure under non-Windows platforms +// anyhow so the value there is not important. +#define wxUSE_GRAPHICS_CONTEXT 0 +#endif + +// Enable wxGraphicsContext implementation using Cairo library. +// +// This is not needed under Windows and detected automatically by configure +// under other systems, however you may set this to 1 manually if you installed +// Cairo under Windows yourself and prefer to use it instead the native GDI+ +// implementation. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_CAIRO 0 + + +// ---------------------------------------------------------------------------- +// Individual GUI controls +// ---------------------------------------------------------------------------- + +// You must set wxUSE_CONTROLS to 1 if you are using any controls at all +// (without it, wxControl class is not compiled) +// +// Default is 1 +// +// Recommended setting: 1 (don't change except for very special programs) +#define wxUSE_CONTROLS 1 + +// Support markup in control labels, i.e. provide wxControl::SetLabelMarkup(). +// Currently markup is supported only by a few controls and only some ports but +// their number will increase with time. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you want to save on code size) +#define wxUSE_MARKUP 1 + +// wxPopupWindow class is a top level transient window. It is currently used +// to implement wxTipWindow +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) +#define wxUSE_POPUPWIN 1 + +// wxTipWindow allows to implement the custom tooltips, it is used by the +// context help classes. Requires wxUSE_POPUPWIN. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0) +#define wxUSE_TIPWINDOW 1 + +// Each of the settings below corresponds to one wxWidgets control. They are +// all switched on by default but may be disabled if you are sure that your +// program (including any standard dialogs it can show!) doesn't need them and +// if you desperately want to save some space. If you use any of these you must +// set wxUSE_CONTROLS as well. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_ACTIVITYINDICATOR 1 // wxActivityIndicator +#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl +#define wxUSE_BANNERWINDOW 1 // wxBannerWindow +#define wxUSE_BUTTON 1 // wxButton +#define wxUSE_BMPBUTTON 1 // wxBitmapButton +#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl +#define wxUSE_CHECKBOX 1 // wxCheckBox +#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) +#define wxUSE_CHOICE 1 // wxChoice +#define wxUSE_COLLPANE 1 // wxCollapsiblePane +#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl +#define wxUSE_COMBOBOX 1 // wxComboBox +#define wxUSE_COMMANDLINKBUTTON 1 // wxCommandLinkButton +#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl +#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl +#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl +#define wxUSE_EDITABLELISTBOX 1 // wxEditableListBox +#define wxUSE_FILECTRL 1 // wxFileCtrl +#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl +#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl +#define wxUSE_GAUGE 1 // wxGauge +#define wxUSE_HEADERCTRL 1 // wxHeaderCtrl +#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl +#define wxUSE_LISTBOX 1 // wxListBox +#define wxUSE_LISTCTRL 1 // wxListCtrl +#define wxUSE_RADIOBOX 1 // wxRadioBox +#define wxUSE_RADIOBTN 1 // wxRadioButton +#define wxUSE_RICHMSGDLG 1 // wxRichMessageDialog +#define wxUSE_SCROLLBAR 1 // wxScrollBar +#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl +#define wxUSE_SLIDER 1 // wxSlider +#define wxUSE_SPINBTN 1 // wxSpinButton +#define wxUSE_SPINCTRL 1 // wxSpinCtrl +#define wxUSE_STATBOX 1 // wxStaticBox +#define wxUSE_STATLINE 1 // wxStaticLine +#define wxUSE_STATTEXT 1 // wxStaticText +#define wxUSE_STATBMP 1 // wxStaticBitmap +#define wxUSE_TEXTCTRL 1 // wxTextCtrl +#define wxUSE_TIMEPICKCTRL 1 // wxTimePickerCtrl +#define wxUSE_TOGGLEBTN 1 // requires wxButton +#define wxUSE_TREECTRL 1 // wxTreeCtrl +#define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl + +// Use generic version of wxDataViewCtrl even if a native one is available? +// +// Default is 1. +// +// Recommended setting: 1, but can be set to 0 if your program is affected by +// the native control limitations. +#define wxUSE_NATIVE_DATAVIEWCTRL 1 + +// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR +// below either wxStatusBar95 or a generic wxStatusBar will be used. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STATUSBAR 1 + +// Two status bar implementations are available under Win32: the generic one +// or the wrapper around native control. For native look and feel the native +// version should be used. +// +// Default is 1 for the platforms where native status bar is supported. +// +// Recommended setting: 1 (there is no advantage in using the generic one) +#define wxUSE_NATIVE_STATUSBAR 1 + +// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar +// classes at all. Otherwise, use the native toolbar class unless +// wxUSE_TOOLBAR_NATIVE is 0. +// +// Default is 1 for all settings. +// +// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. +#define wxUSE_TOOLBAR 1 +#define wxUSE_TOOLBAR_NATIVE 1 + +// wxNotebook is a control with several "tabs" located on one of its sides. It +// may be used to logically organise the data presented to the user instead of +// putting everything in one huge dialog. It replaces wxTabControl and related +// classes of wxWin 1.6x. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTEBOOK 1 + +// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_LISTBOOK 1 + +// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CHOICEBOOK 1 + +// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TREEBOOK 1 + +// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of +// tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLBOOK 1 + +// wxTaskBarIcon is a small notification icon shown in the system toolbar or +// dock. +// +// Default is 1. +// +// Recommended setting: 1 (but can be set to 0 if you don't need it) +#define wxUSE_TASKBARICON 1 + +// wxGrid class +// +// Default is 1, set to 0 to cut down compilation time and binaries size if you +// don't use it. +// +// Recommended setting: 1 +// +#define wxUSE_GRID 1 + +// wxMiniFrame class: a frame with narrow title bar +// +// Default is 1. +// +// Recommended setting: 1 (it doesn't cost almost anything) +#define wxUSE_MINIFRAME 1 + +// wxComboCtrl and related classes: combobox with custom popup window and +// not necessarily a listbox. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it +// is used by wxComboBox +#define wxUSE_COMBOCTRL 1 + +// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox +// items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0, except where it is +// needed as a base class for generic wxBitmapComboBox. +#define wxUSE_ODCOMBOBOX 1 + +// wxBitmapComboBox is a combobox that can have images in front of text items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 +#define wxUSE_BITMAPCOMBOBOX 1 + +// wxRearrangeCtrl is a wxCheckListBox with two buttons allowing to move items +// up and down in it. It is also used as part of wxRearrangeDialog. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 (currently used only by +// wxHeaderCtrl) +#define wxUSE_REARRANGECTRL 1 + +// wxAddRemoveCtrl is a composite control containing a control showing some +// items (e.g. wxListBox, wxListCtrl, wxTreeCtrl, wxDataViewCtrl, ...) and "+"/ +// "-" buttons allowing to add and remove items to/from the control. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 if you don't need it (not +// used by the library itself). +#define wxUSE_ADDREMOVECTRL 1 + +// ---------------------------------------------------------------------------- +// Miscellaneous GUI stuff +// ---------------------------------------------------------------------------- + +// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) +#define wxUSE_ACCEL 1 + +// Use the standard art provider. The icons returned by this provider are +// embedded into the library as XPMs so disabling it reduces the library size +// somewhat but this should only be done if you use your own custom art +// provider returning the icons or never use any icons not provided by the +// native art provider (which might not be implemented at all for some +// platforms) or by the Tango icons provider (if it's not itself disabled +// below). +// +// Default is 1. +// +// Recommended setting: 1 unless you use your own custom art provider. +#define wxUSE_ARTPROVIDER_STD 1 + +// Use art provider providing Tango icons: this art provider has higher quality +// icons than the default one. It uses SVG format which allows much better scaling +// then when bitmaps are used, at the expense of somewhat larger library size. +// +// Default is 1 under non-GTK ports. Under wxGTK the native art provider using +// the GTK+ stock icons replaces it so it is normally not necessary. +// +// Recommended setting: 1 but can be turned off to reduce the library size. +#define wxUSE_ARTPROVIDER_TANGO 1 + +// Hotkey support (currently Windows and macOS only) +#define wxUSE_HOTKEY 1 + +// Use wxCaret: a class implementing a "cursor" in a text control (called caret +// under Windows). +// +// Default is 1. +// +// Recommended setting: 1 (can be safely set to 0, not used by the library) +#define wxUSE_CARET 1 + +// Use wxDisplay class: it allows enumerating all displays on a system and +// their geometries as well as finding the display on which the given point or +// window lies. +// +// Default is 1. +// +// Recommended setting: 1 if you need it, can be safely set to 0 otherwise +#define wxUSE_DISPLAY 1 + +// Miscellaneous geometry code: needed for Canvas library +#define wxUSE_GEOMETRY 1 + +// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and +// wxListCtrl. +// +// Default is 1. +// +// Recommended setting: 1 (set it to 0 if you don't use any of the controls +// enumerated above, then this class is mostly useless too) +#define wxUSE_IMAGLIST 1 + +// Use wxInfoBar class. +// +// Default is 1. +// +// Recommended setting: 1 (but can be disabled without problems as nothing +// depends on it) +#define wxUSE_INFOBAR 1 + +// Use wxMenu, wxMenuItem. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUS 1 + +// Use wxMenuBar. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUBAR 1 + +// Use wxNotificationMessage. +// +// wxNotificationMessage allows to show non-intrusive messages to the user +// using balloons, banners, popups or whatever is the appropriate method for +// the current platform. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTIFICATION_MESSAGE 1 + +// wxPreferencesEditor provides a common API for different ways of presenting +// the standard "Preferences" or "Properties" dialog under different platforms +// (e.g. some use modal dialogs, some use modeless ones; some apply the changes +// immediately while others require an explicit "Apply" button). +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_PREFERENCES_EDITOR 1 + +// wxFont::AddPrivateFont() allows to use fonts not installed on the system by +// loading them from font files during run-time. +// +// Default is 1 except under Unix where it will be turned off by configure if +// the required libraries are not available or not new enough. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it and +// want to avoid extra dependencies under Linux, for example). +#define wxUSE_PRIVATE_FONTS 1 + +// wxRichToolTip is a customizable tooltip class which has more functionality +// than the stock (but native, unlike this class) wxToolTip. +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely set to 0 if you don't need it) +#define wxUSE_RICHTOOLTIP 1 + +// Use wxSashWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SASH 1 + +// Use wxSplitterWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SPLITTER 1 + +// Use wxToolTip and wxWindow::Set/GetToolTip() methods. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLTIPS 1 + +// wxValidator class and related methods +#define wxUSE_VALIDATORS 1 + +// Use reference counted ID management: this means that wxWidgets will track +// the automatically allocated ids (those used when you use wxID_ANY when +// creating a window, menu or toolbar item &c) instead of just supposing that +// the program never runs out of them. This is mostly useful only under wxMSW +// where the total ids range is limited to SHRT_MIN..SHRT_MAX and where +// long-running programs can run into problems with ids reuse without this. On +// the other platforms, where the ids have the full int range, this shouldn't +// be necessary. +#ifdef __WXMSW__ +#define wxUSE_AUTOID_MANAGEMENT 1 +#else +#define wxUSE_AUTOID_MANAGEMENT 0 +#endif + +// ---------------------------------------------------------------------------- +// common dialogs +// ---------------------------------------------------------------------------- + +// Use common dialogs (e.g. file selector, printer dialog). Switching this off +// also switches off the printing architecture and interactive wxPrinterDC. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COMMON_DIALOGS 1 + +// wxBusyInfo displays window with message when app is busy. Works in same way +// as wxBusyCursor +#define wxUSE_BUSYINFO 1 + +// Use single/multiple choice dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_CHOICEDLG 1 + +// Use colour picker dialog +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COLOURDLG 1 + +// wxDirDlg class for getting a directory name from user +#define wxUSE_DIRDLG 1 + +// Use file open/save dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in many places in the library itself) +#define wxUSE_FILEDLG 1 + +// Use find/replace dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely set to 0) +#define wxUSE_FINDREPLDLG 1 + +// Use font picker dialog +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_FONTDLG 1 + +// Use wxMessageDialog and wxMessageBox. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_MSGDLG 1 + +// progress dialog class for lengthy operations +#define wxUSE_PROGRESSDLG 1 + +// Set to 0 to disable the use of the native progress dialog (currently only +// available under MSW and suffering from some bugs there, hence this option). +#define wxUSE_NATIVE_PROGRESSDLG 1 + +// support for startup tips (wxShowTip &c) +#define wxUSE_STARTUP_TIPS 1 + +// text entry dialog and wxGetTextFromUser function +#define wxUSE_TEXTDLG 1 + +// number entry dialog +#define wxUSE_NUMBERDLG 1 + +// credential entry dialog +#define wxUSE_CREDENTIALDLG 1 + +// splash screen class +#define wxUSE_SPLASH 1 + +// wizards +#define wxUSE_WIZARDDLG 1 + +// Compile in wxAboutBox() function showing the standard "About" dialog. +// +// Default is 1 +// +// Recommended setting: 1 but can be set to 0 to save some space if you don't +// use this function +#define wxUSE_ABOUTDLG 1 + +// wxFileHistory class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_FILE_HISTORY 1 + +// ---------------------------------------------------------------------------- +// Metafiles support +// ---------------------------------------------------------------------------- + +// Windows supports the graphics format known as metafile which, though not +// portable, is widely used under Windows and so is supported by wxWidgets +// (under Windows only, of course). Both the so-called "Window MetaFiles" or +// WMFs, and "Enhanced MetaFiles" or EMFs are supported in wxWin and, by +// default, EMFs will be used. This may be changed by setting +// wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting wxUSE_ENH_METAFILE to 0. +// You may also set wxUSE_METAFILE to 0 to not compile in any metafile +// related classes at all. +// +// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. +// +// Recommended setting: default or 0 for everything for portable programs. +#define wxUSE_METAFILE 1 +#define wxUSE_ENH_METAFILE 1 +#define wxUSE_WIN_METAFILES_ALWAYS 0 + +// ---------------------------------------------------------------------------- +// Big GUI components +// ---------------------------------------------------------------------------- + +// Set to 0 to disable MDI support. +// +// Requires wxUSE_NOTEBOOK under platforms other than MSW. +// +// Default is 1. +// +// Recommended setting: 1, can be safely set to 0. +#define wxUSE_MDI 1 + +// Set to 0 to disable document/view architecture +#define wxUSE_DOC_VIEW_ARCHITECTURE 1 + +// Set to 0 to disable MDI document/view architecture +// +// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE +#define wxUSE_MDI_ARCHITECTURE 1 + +// Set to 0 to disable print/preview architecture code +#define wxUSE_PRINTING_ARCHITECTURE 1 + +// wxHTML allows displaying simple HTML. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_HTML 1 + +// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL +// headers and libraries to be able to compile the library with wxUSE_GLCANVAS +// set to 1 and, under Windows, also to add opengl32.lib and glu32.lib to the +// list of libraries used to link your application when linking to wxWidgets +// statically (although this is done implicitly for Microsoft Visual C++ users). +// +// Default is 1. +// +// Recommended setting: 1 if you intend to use OpenGL, can be safely set to 0 +// otherwise. +#define wxUSE_GLCANVAS 1 + +// Setting wxUSE_GLCANVAS_EGL to 1 enables OpenGL EGL backend. This will be +// automatically enabled if EGL support is detected. EGL support is only +// available under Unix platforms. +// +// Default is 0. +// +#define wxUSE_GLCANVAS_EGL 0 + +// wxRichTextCtrl allows editing of styled text. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 if you want compile a +// smaller library. +#define wxUSE_RICHTEXT 1 + +// ---------------------------------------------------------------------------- +// Data transfer +// ---------------------------------------------------------------------------- + +// Use wxClipboard class for clipboard copy/paste. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CLIPBOARD 1 + +// Use wxDataObject and related classes. Needed for clipboard and OLE drag and +// drop +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DATAOBJ 1 + +// Use wxDropTarget and wxDropSource classes for drag and drop (this is +// different from "built in" drag and drop in wxTreeCtrl which is always +// available). Requires wxUSE_DATAOBJ. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DRAG_AND_DROP 1 + +// Use wxAccessible for enhanced and customisable accessibility. +// Depends on wxUSE_OLE on MSW. +// +// Default is 1 on MSW, 0 elsewhere. +// +// Recommended setting (at present): 1 (MSW-only) +#ifdef __WXMSW__ +#define wxUSE_ACCESSIBILITY 1 +#else +#define wxUSE_ACCESSIBILITY 0 +#endif + +// ---------------------------------------------------------------------------- +// miscellaneous settings +// ---------------------------------------------------------------------------- + +// wxSingleInstanceChecker class allows to verify at startup if another program +// instance is running. +// +// Default is 1 +// +// Recommended setting: 1 (the class is tiny, disabling it won't save much +// space) +#define wxUSE_SNGLINST_CHECKER 1 + +#define wxUSE_DRAGIMAGE 1 + +#define wxUSE_IPC 1 + // 0 for no interprocess comms +#define wxUSE_HELP 1 + // 0 for no help facility + +// Should we use MS HTML help for wxHelpController? If disabled, neither +// wxCHMHelpController nor wxBestHelpController are available. +// +// Default is 1 under MSW, 0 is always used for the other platforms. +// +// Recommended setting: 1, only set to 0 if you have trouble compiling +// wxCHMHelpController (could be a problem with really ancient compilers) +#define wxUSE_MS_HTML_HELP 1 + + +// Use wxHTML-based help controller? +#define wxUSE_WXHTML_HELP 1 + +#define wxUSE_CONSTRAINTS 1 + // 0 for no window layout constraint system + +#define wxUSE_SPLINES 1 + // 0 for no splines + +#define wxUSE_MOUSEWHEEL 1 + // Include mouse wheel support + +// Compile wxUIActionSimulator class? +#define wxUSE_UIACTIONSIMULATOR 1 + +// ---------------------------------------------------------------------------- +// wxDC classes for various output formats +// ---------------------------------------------------------------------------- + +// Set to 1 for PostScript device context. +#define wxUSE_POSTSCRIPT 0 + +// Set to 1 to use font metric files in GetTextExtent +#define wxUSE_AFM_FOR_POSTSCRIPT 1 + +// Set to 1 to compile in support for wxSVGFileDC, a wxDC subclass which allows +// to create files in SVG (Scalable Vector Graphics) format. +#define wxUSE_SVG 1 + +// Should wxDC provide SetTransformMatrix() and related methods? +// +// Default is 1 but can be set to 0 if this functionality is not used. Notice +// that currently wxMSW, wxGTK3 support this for wxDC and all platforms support +// this for wxGCDC so setting this to 0 doesn't change much if neither of these +// is used (although it will still save a few bytes probably). +// +// Recommended setting: 1. +#define wxUSE_DC_TRANSFORM_MATRIX 1 + +// ---------------------------------------------------------------------------- +// image format support +// ---------------------------------------------------------------------------- + +// wxImage supports many different image formats which can be configured at +// compile-time. BMP is always supported, others are optional and can be safely +// disabled if you don't plan to use images in such format sometimes saving +// substantial amount of code in the final library. +// +// Some formats require an extra library (e.g. libpng) which is always included in +// wxWidgets sources but some build systems (cmake, configure) can be configured to +// to use the system or user-provided version. +// +// Set to 1 for wxImage support (recommended). +#define wxUSE_IMAGE 1 + +// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. +#define wxUSE_LIBPNG 1 + +// Set to 1 for JPEG format support (requires libjpeg) +#define wxUSE_LIBJPEG 1 + +// Set to 1 for TIFF format support (requires libtiff) +#define wxUSE_LIBTIFF 1 + +// Set to 1 for SVG rasterizing support using nanosvg +#define wxUSE_NANOSVG 1 + +// Set to 1 to use external nanosvg library when wxUSE_NANOSVG is enabled +#define wxUSE_NANOSVG_EXTERNAL 0 + +// Set to 1 for TGA format support (loading only) +#define wxUSE_TGA 1 + +// Set to 1 for GIF format support +#define wxUSE_GIF 1 + +// Set to 1 for PNM format support +#define wxUSE_PNM 1 + +// Set to 1 for PCX format support +#define wxUSE_PCX 1 + +// Set to 1 for IFF format support (Amiga format) +#define wxUSE_IFF 0 + +// Set to 1 for XPM format support +#define wxUSE_XPM 1 + +// Set to 1 for MS Icons and Cursors format support +#define wxUSE_ICO_CUR 1 + +// Set to 1 to compile in wxPalette class +#define wxUSE_PALETTE 1 + +// ---------------------------------------------------------------------------- +// wxUniversal-only options +// ---------------------------------------------------------------------------- + +// Set to 1 to enable compilation of all themes, this is the default +#define wxUSE_ALL_THEMES 1 + +// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES +// is unset, if it is set these options are not used; notice that metal theme +// uses Win32 one +#define wxUSE_THEME_GTK 0 +#define wxUSE_THEME_METAL 0 +#define wxUSE_THEME_MONO 0 +#define wxUSE_THEME_WIN32 0 + +/* --- end common options --- */ + +/* --- start MSW options --- */ +// ---------------------------------------------------------------------------- +// Windows-specific backends choices +// ---------------------------------------------------------------------------- + +// The options here are only taken into account if wxUSE_GRAPHICS_CONTEXT is 1. + +// Enable support for GDI+-based implementation of wxGraphicsContext. +// +// Default is 1. +// +// Recommended setting: 1 if you need to support XP, as Direct2D is not +// available there. +#define wxUSE_GRAPHICS_GDIPLUS wxUSE_GRAPHICS_CONTEXT + +// Enable support for Direct2D-based implementation of wxGraphicsContext. +// +// Default is 1 for compilers which support it, i.e. VC10+ currently. If you +// use an earlier MSVC version or another compiler and installed the necessary +// SDK components manually, you need to change this setting. +// +// Recommended setting: 1 for faster and better quality graphics under Windows +// 7 and later systems (if wxUSE_GRAPHICS_GDIPLUS is also enabled, earlier +// systems will fall back on using GDI+). +#if defined(_MSC_VER) && _MSC_VER >= 1600 + #define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT +#else + #define wxUSE_GRAPHICS_DIRECT2D 0 +#endif + +// wxWebRequest backend based on WinHTTP. +// +// This is only taken into account if wxUSE_WEBREQUEST==1. +// +// Default is 1 if supported by the compiler (MSVS or MinGW64). +// +// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, +// otherwise wxWebRequest won't be available at all. +#define wxUSE_WEBREQUEST_WINHTTP 1 + +// ---------------------------------------------------------------------------- +// Windows-only settings +// ---------------------------------------------------------------------------- + +// Set this to 1 for generic OLE support: this is required for drag-and-drop, +// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and +// can't compile/doesn't have the OLE headers. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_OLE 1 + +// Set this to 1 to enable wxAutomationObject class. +// +// Default is 1. +// +// Recommended setting: 1 if you need to control other applications via OLE +// Automation, can be safely set to 0 otherwise +#define wxUSE_OLE_AUTOMATION 1 + +// Set this to 1 to enable wxActiveXContainer class allowing to embed OLE +// controls in wx. +// +// Default is 1. +// +// Recommended setting: 1, required by wxMediaCtrl +#define wxUSE_ACTIVEX 1 + +// Enable WinRT support +// +// Default is 1 for compilers which support it, i.e. VS2012+ currently. If you +// use an earlier MSVC version or another compiler and installed the necessary +// SDK components manually, you need to change this setting. +// +// Recommended setting: 1 +#if defined(_MSC_VER) && _MSC_VER >= 1700 && !defined(_USING_V110_SDK71_) + #define wxUSE_WINRT 1 +#else + #define wxUSE_WINRT 0 +#endif + +// wxDC caching implementation +#define wxUSE_DC_CACHEING 1 + +// Set this to 1 to enable wxDIB class used internally for manipulating +// wxBitmap data. +// +// Default is 1, set it to 0 only if you don't use wxImage either +// +// Recommended setting: 1 (without it conversion to/from wxImage won't work) +#define wxUSE_WXDIB 1 + +// Set to 0 to disable PostScript print/preview architecture code under Windows +// (just use Windows printing). +#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1 + +// Set this to 1 to compile in wxRegKey class. +// +// Default is 1 +// +// Recommended setting: 1, this is used internally by wx in a few places +#define wxUSE_REGKEY 1 + +// Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH +// which allows to put more than ~32Kb of text in it even under Win9x (NT +// doesn't have such limitation). +// +// Default is 1 for compilers which support it +// +// Recommended setting: 1, only set it to 0 if your compiler doesn't have +// or can't compile +#define wxUSE_RICHEDIT 1 + +// Set this to 1 to use extra features of richedit v2 and later controls +// +// Default is 1 for compilers which support it +// +// Recommended setting: 1 +#define wxUSE_RICHEDIT2 1 + +// Set this to 1 to enable support for the owner-drawn menu and listboxes. This +// is required by wxUSE_CHECKLISTBOX. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 for a small library size reduction +#define wxUSE_OWNER_DRAWN 1 + +// Set this to 1 to enable MSW-specific wxTaskBarIcon::ShowBalloon() method. It +// is required by native wxNotificationMessage implementation. +// +// Default is 1 but disabled in wx/msw/chkconf.h if SDK is too old to contain +// the necessary declarations. +// +// Recommended setting: 1, set to 0 for a tiny library size reduction +#define wxUSE_TASKBARICON_BALLOONS 1 + +// Set this to 1 to enable following functionality added in Windows 7: thumbnail +// representations, thumbnail toolbars, notification and status overlays, +// progress indicators and jump lists. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 for a tiny library size reduction +#define wxUSE_TASKBARBUTTON 1 + +// Set to 1 to compile MS Windows XP theme engine support +#define wxUSE_UXTHEME 1 + +// Set to 1 to use InkEdit control (Tablet PC), if available +#define wxUSE_INKEDIT 0 + +// Set to 1 to enable .INI files based wxConfig implementation (wxIniConfig) +// +// Default is 0. +// +// Recommended setting: 0, nobody uses .INI files any more +#define wxUSE_INICONF 0 + +// Set to 0 if you need to include rather than +// +// Default is 1. +// +// Recommended setting: 1, required to be 1 if wxUSE_IPV6 is 1. +#define wxUSE_WINSOCK2 1 + +// ---------------------------------------------------------------------------- +// Generic versions of native controls +// ---------------------------------------------------------------------------- + +// Set this to 1 to be able to use wxDatePickerCtrlGeneric in addition to the +// native wxDatePickerCtrl +// +// Default is 0. +// +// Recommended setting: 0, this is mainly used for testing +#define wxUSE_DATEPICKCTRL_GENERIC 0 + +// Set this to 1 to be able to use wxTimePickerCtrlGeneric in addition to the +// native wxTimePickerCtrl for the platforms that have the latter (MSW). +// +// Default is 0. +// +// Recommended setting: 0, this is mainly used for testing +#define wxUSE_TIMEPICKCTRL_GENERIC 0 + +// ---------------------------------------------------------------------------- +// Crash debugging helpers +// ---------------------------------------------------------------------------- + +// Set this to 1 to use dbghelp.dll for providing stack traces in crash +// reports. +// +// Default is 1 if the compiler supports it, 0 for old MinGW. +// +// Recommended setting: 1, there is not much gain in disabling this +#if defined(__VISUALC__) || defined(__MINGW64_TOOLCHAIN__) + #define wxUSE_DBGHELP 1 +#else + #define wxUSE_DBGHELP 0 +#endif + +// Set this to 1 to be able to use wxCrashReport::Generate() to create mini +// dumps of your program when it crashes (or at any other moment) +// +// Default is 1 if supported by the compiler (VC++ and recent BC++ only). +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_CRASHREPORT 1 +/* --- end MSW options --- */ + +// GTK-specific options used when not using configure. As we can't test for the +// exact GTK version (without including GTK+ headers that we don't want to +// include from our own public headers), just assume a recent GTK 2.x. +#define __WXGTK20__ +#define __WXGTK210__ +#define __WXGTK218__ +//#define __WXGTK3__ + +#endif // _WX_SETUP_H_ diff --git a/lib/wxWidgets/include/wx/gtk/slider.h b/lib/wxWidgets/include/wx/gtk/slider.h new file mode 100644 index 0000000..b59afd3 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/slider.h @@ -0,0 +1,99 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/slider.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_SLIDER_H_ +#define _WX_GTK_SLIDER_H_ + +// ---------------------------------------------------------------------------- +// wxSlider +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSlider : public wxSliderBase +{ +public: + wxSlider(); + wxSlider(wxWindow *parent, + wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxSliderNameStr)) + { + Create( parent, id, value, minValue, maxValue, + pos, size, style, validator, name ); + } + ~wxSlider(); + + bool Create(wxWindow *parent, + wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxSliderNameStr)); + + // implement the base class pure virtuals + virtual int GetValue() const wxOVERRIDE; + virtual void SetValue(int value) wxOVERRIDE; + + virtual void SetRange(int minValue, int maxValue) wxOVERRIDE; + virtual int GetMin() const wxOVERRIDE; + virtual int GetMax() const wxOVERRIDE; + + virtual void SetLineSize(int lineSize) wxOVERRIDE; + virtual void SetPageSize(int pageSize) wxOVERRIDE; + virtual int GetLineSize() const wxOVERRIDE; + virtual int GetPageSize() const wxOVERRIDE; + + virtual void SetThumbLength(int lenPixels) wxOVERRIDE; + virtual int GetThumbLength() const wxOVERRIDE; + + virtual void ClearTicks() wxOVERRIDE; + virtual void SetTick(int tickPos) wxOVERRIDE; + int GetTickFreq() const wxOVERRIDE; + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // implementation + void GTKDisableEvents(); + void GTKEnableEvents(); + bool GTKEventsDisabled() const; + + double m_pos; + int m_scrollEventType; + bool m_needThumbRelease; + GtkWidget *m_scale; + +protected: + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + GtkWidget *m_minLabel,*m_maxLabel; + bool m_blockScrollEvent; + + // Note the following member is not used in GTK+2 < 2.16. + int m_tickFreq; + + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; + + // set the slider value unconditionally + void GTKSetValue(int value); + + // Platform-specific implementation of SetTickFreq + virtual void DoSetTickFreq(int freq) wxOVERRIDE; + +private: + void Init(); + + wxDECLARE_DYNAMIC_CLASS(wxSlider); +}; + +#endif // _WX_GTK_SLIDER_H_ diff --git a/lib/wxWidgets/include/wx/gtk/spinbutt.h b/lib/wxWidgets/include/wx/gtk/spinbutt.h new file mode 100644 index 0000000..4371981 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/spinbutt.h @@ -0,0 +1,65 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/spinbutt.h +// Purpose: wxSpinButton class +// Author: Robert Roebling +// Modified by: +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_SPINBUTT_H_ +#define _WX_GTK_SPINBUTT_H_ + +//----------------------------------------------------------------------------- +// wxSpinButton +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSpinButton : public wxSpinButtonBase +{ +public: + wxSpinButton(); + wxSpinButton(wxWindow *parent, + wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_VERTICAL, + const wxString& name = wxSPIN_BUTTON_NAME) + { + Create(parent, id, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_VERTICAL, + const wxString& name = wxSPIN_BUTTON_NAME); + + virtual int GetValue() const wxOVERRIDE; + virtual void SetValue( int value ) wxOVERRIDE; + virtual void SetRange( int minVal, int maxVal ) wxOVERRIDE; + virtual int GetMin() const wxOVERRIDE; + virtual int GetMax() const wxOVERRIDE; + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // implementation + int m_pos; + +protected: + void GtkDisableEvents() const; + void GtkEnableEvents() const; + + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; + + virtual void DoEnable(bool enable) wxOVERRIDE; + +private: + typedef wxSpinButtonBase base_type; + + wxDECLARE_DYNAMIC_CLASS(wxSpinButton); +}; + +#endif // _WX_GTK_SPINBUTT_H_ diff --git a/lib/wxWidgets/include/wx/gtk/spinctrl.h b/lib/wxWidgets/include/wx/gtk/spinctrl.h new file mode 100644 index 0000000..5fb19b4 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/spinctrl.h @@ -0,0 +1,262 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/spinctrl.h +// Purpose: wxSpinCtrl class +// Author: Robert Roebling +// Modified by: +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_SPINCTRL_H_ +#define _WX_GTK_SPINCTRL_H_ + +//----------------------------------------------------------------------------- +// wxSpinCtrlGTKBase - Base class for GTK versions of the wxSpinCtrl[Double] +// +// This class manages a double valued GTK spinctrl through the DoGet/SetXXX +// functions that are made public as Get/SetXXX functions for int or double +// for the wxSpinCtrl and wxSpinCtrlDouble classes respectively to avoid +// function ambiguity. +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSpinCtrlGTKBase : public wxSpinCtrlBase +{ +public: + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + long style, + double min, double max, double initial, + double inc, + const wxString& name); + + // wxSpinCtrl(Double) methods call DoXXX functions of the same name + + // accessors + virtual wxString GetTextValue() const wxOVERRIDE; + // T GetValue() const + // T GetMin() const + // T GetMax() const + // T GetIncrement() const + virtual bool GetSnapToTicks() const wxOVERRIDE; + + // operations + virtual void SetValue(const wxString& value) wxOVERRIDE; + // void SetValue(T val) + // void SetRange(T minVal, T maxVal) + // void SetIncrement(T inc) + void SetSnapToTicks( bool snap_to_ticks ) wxOVERRIDE; + + // Select text in the textctrl + void SetSelection(long from, long to) wxOVERRIDE; + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // implementation + void OnChar( wxKeyEvent &event ); + + + // These values map to the possible return values of "input" GTK signal but + // are more readable and type-safe. + enum GTKInputResult + { + GTKInput_Error = -1, + GTKInput_Default, + GTKInput_Converted + }; + + virtual GTKInputResult GTKInput(double* value) const = 0; + virtual bool GTKOutput(wxString* text) const = 0; + + virtual void GTKValueChanged() = 0; + void GTKTextChanged(); + +protected: + wxSpinCtrlGTKBase(); + ~wxSpinCtrlGTKBase(); + + double DoGetValue() const; + double DoGetMin() const; + double DoGetMax() const; + double DoGetIncrement() const; + + void DoSetValue(double val); + void DoSetValue(const wxString& strValue); + void DoSetRange(double min_val, double max_val); + void DoSetIncrement(double inc); + + void GtkDisableEvents(); + void GtkEnableEvents(); + + // Update the width of the entry field to fit the current range (and also + // base or number of digits depending on the derived class). + virtual void GtkSetEntryWidth() = 0; + + virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const wxOVERRIDE; + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; + + // Widgets that use the style->base colour for the BG colour should + // override this and return true. + virtual bool UseGTKStyleBase() const wxOVERRIDE { return true; } + + // Set m_textOverride to use the given text instead of the numeric value. + void GTKSetTextOverride(const wxString& text); + + // Reset the override and changing the value to correspond to the + // previously overridden numeric value. + void GTKResetTextOverride(); + + // Just reset the override, without touching the value, returning true if + // we did it. In most cases, the function above should be used instead. + bool GTKResetTextOverrideOnly(); + +private: + // This function does _not_ take into account m_textOverride, so it is + // private and normally shouldn't be used -- use DoGetValue() instead. + double GTKGetValue() const; + + // Non-null when the text value is different from the numeric value. + class wxSpinCtrlGTKTextOverride* m_textOverride; + + + friend class wxSpinCtrlEventDisabler; + + wxDECLARE_EVENT_TABLE(); +}; + +//----------------------------------------------------------------------------- +// wxSpinCtrl - An integer valued spin control +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSpinCtrl : public wxSpinCtrlGTKBase +{ +public: + wxSpinCtrl() { Init(); } + wxSpinCtrl(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + int min = 0, int max = 100, int initial = 0, + const wxString& name = wxS("wxSpinCtrl")) + { + Init(); + + Create(parent, id, value, pos, size, style, min, max, initial, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + int min = 0, int max = 100, int initial = 0, + const wxString& name = wxS("wxSpinCtrl")) + { + return wxSpinCtrlGTKBase::Create(parent, id, value, pos, size, + style, min, max, initial, 1, name); + } + + // accessors + int GetValue() const { return int(DoGetValue()); } + int GetMin() const { return int(DoGetMin()); } + int GetMax() const { return int(DoGetMax()); } + int GetIncrement() const { return int(DoGetIncrement()); } + + // operations + void SetValue(const wxString& value) wxOVERRIDE { wxSpinCtrlGTKBase::SetValue(value); } // visibility problem w/ gcc + void SetValue( int value ) { DoSetValue(value); } + void SetRange( int minVal, int maxVal ) { DoSetRange(minVal, maxVal); } + void SetIncrement(int inc) { DoSetIncrement(inc); } + + virtual int GetBase() const wxOVERRIDE { return m_base; } + virtual bool SetBase(int base) wxOVERRIDE; + + virtual GTKInputResult GTKInput(double* value) const wxOVERRIDE; + virtual bool GTKOutput(wxString* text) const wxOVERRIDE; + virtual void GTKValueChanged() wxOVERRIDE; + +protected: + virtual void GtkSetEntryWidth() wxOVERRIDE; + +private: + // Common part of all ctors. + void Init() + { + m_base = 10; + } + + int m_base; + + wxDECLARE_DYNAMIC_CLASS(wxSpinCtrl); +}; + +//----------------------------------------------------------------------------- +// wxSpinCtrlDouble - a double valued spin control +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSpinCtrlDouble : public wxSpinCtrlGTKBase +{ +public: + wxSpinCtrlDouble() {} + wxSpinCtrlDouble(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + double min = 0, double max = 100, double initial = 0, + double inc = 1, + const wxString& name = wxS("wxSpinCtrlDouble")) + { + Create(parent, id, value, pos, size, style, + min, max, initial, inc, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + double min = 0, double max = 100, double initial = 0, + double inc = 1, + const wxString& name = wxS("wxSpinCtrlDouble")) + { + return wxSpinCtrlGTKBase::Create(parent, id, value, pos, size, + style, min, max, initial, inc, name); + } + + // accessors + double GetValue() const { return DoGetValue(); } + double GetMin() const { return DoGetMin(); } + double GetMax() const { return DoGetMax(); } + double GetIncrement() const { return DoGetIncrement(); } + unsigned GetDigits() const; + + // operations + void SetValue(const wxString& value) wxOVERRIDE { wxSpinCtrlGTKBase::SetValue(value); } // visibility problem w/ gcc + void SetValue(double value) { DoSetValue(value); } + void SetRange(double minVal, double maxVal) { DoSetRange(minVal, maxVal); } + void SetIncrement(double inc); + void SetDigits(unsigned digits); + + virtual int GetBase() const wxOVERRIDE { return 10; } + virtual bool SetBase(int WXUNUSED(base)) wxOVERRIDE { return false; } + + virtual GTKInputResult GTKInput(double* value) const wxOVERRIDE; + virtual bool GTKOutput(wxString* text) const wxOVERRIDE; + virtual void GTKValueChanged() wxOVERRIDE; + +protected: + virtual void GtkSetEntryWidth() wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxSpinCtrlDouble); +}; + +#endif // _WX_GTK_SPINCTRL_H_ diff --git a/lib/wxWidgets/include/wx/gtk/srchctrl.h b/lib/wxWidgets/include/wx/gtk/srchctrl.h new file mode 100644 index 0000000..f4531c3 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/srchctrl.h @@ -0,0 +1,117 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/srchctrl.h +// Purpose: wxSearchCtrl class - native +// Author: Kettab Ali +// Created: 2019-12-23 +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_SEARCHCTRL_H_ +#define _WX_GTK_SEARCHCTRL_H_ + +#if wxUSE_SEARCHCTRL + +// ---------------------------------------------------------------------------- +// wxSearchCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSearchCtrl : public wxSearchCtrlBase +{ +public: + // creation + // -------- + + wxSearchCtrl() : wxSearchCtrlBase() + { + Init(); + } + + wxSearchCtrl(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxSearchCtrlNameStr)) + : wxSearchCtrlBase() + { + Init(); + Create(parent, id, value, pos, size, style, validator, name); + } + + virtual ~wxSearchCtrl(); + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxSearchCtrlNameStr)); + +#if wxUSE_MENUS + // get/set search button menu + // -------------------------- + virtual void SetMenu( wxMenu* menu ) wxOVERRIDE; + virtual wxMenu* GetMenu() wxOVERRIDE; +#endif // wxUSE_MENUS + + // get/set search options + // ---------------------- + virtual void ShowSearchButton( bool show ) wxOVERRIDE; + virtual bool IsSearchButtonVisible() const wxOVERRIDE; + + virtual void ShowCancelButton( bool show ) wxOVERRIDE; + virtual bool IsCancelButtonVisible() const wxOVERRIDE; + + virtual void SetDescriptiveText(const wxString& text) wxOVERRIDE; + virtual wxString GetDescriptiveText() const wxOVERRIDE; + + virtual void Clear() wxOVERRIDE; + +#if wxUSE_MENUS + void PopupSearchMenu(); +#endif // wxUSE_MENUS + +private: + // From wxTextEntry: + virtual GtkEditable *GetEditable() const wxOVERRIDE; + + + void Init(); + + void GTKCreateSearchEntryWidget(); + + // Event handlers + void OnChar(wxKeyEvent& event); + void OnText(wxCommandEvent& event); + void OnTextEnter(wxCommandEvent& event); + + bool HasMenu() const + { +#if wxUSE_MENUS + return m_menu != NULL; +#else // !wxUSE_MENUS + return false; +#endif // wxUSE_MENUS/!wxUSE_MENUS + } + +private: + virtual GtkEntry *GetEntry() const wxOVERRIDE + { return m_entry; } + + GtkEntry *m_entry; + +#if wxUSE_MENUS + wxMenu *m_menu; +#endif // wxUSE_MENUS + + bool m_cancelButtonVisible; + + wxDECLARE_DYNAMIC_CLASS(wxSearchCtrl); + wxDECLARE_EVENT_TABLE(); +}; + +#endif // wxUSE_SEARCHCTRL + +#endif // _WX_GTK_SEARCHCTRL_H_ diff --git a/lib/wxWidgets/include/wx/gtk/statbmp.h b/lib/wxWidgets/include/wx/gtk/statbmp.h new file mode 100644 index 0000000..c90f1ea --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/statbmp.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/statbmp.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKSTATICBITMAPH__ +#define __GTKSTATICBITMAPH__ + +#include "wx/icon.h" + +//----------------------------------------------------------------------------- +// wxStaticBitmap +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxStaticBitmap : public wxStaticBitmapBase +{ +public: + wxStaticBitmap(); + wxStaticBitmap( wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBitmapNameStr)); + bool Create( wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBitmapNameStr)); + + virtual void SetBitmap( const wxBitmapBundle& bitmap ) wxOVERRIDE; + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + +private: + wxDECLARE_DYNAMIC_CLASS(wxStaticBitmap); +}; + +#endif // __GTKSTATICBITMAPH__ diff --git a/lib/wxWidgets/include/wx/gtk/statbox.h b/lib/wxWidgets/include/wx/gtk/statbox.h new file mode 100644 index 0000000..563f1cc --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/statbox.h @@ -0,0 +1,103 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/statbox.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTKSTATICBOX_H_ +#define _WX_GTKSTATICBOX_H_ + +//----------------------------------------------------------------------------- +// wxStaticBox +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxStaticBox : public wxStaticBoxBase +{ +public: + wxStaticBox() + { + } + + wxStaticBox( wxWindow *parent, + wxWindowID id, + const wxString &label, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxString &name = wxASCII_STR(wxStaticBoxNameStr) ) + { + Create( parent, id, label, pos, size, style, name ); + } + + wxStaticBox( wxWindow *parent, + wxWindowID id, + wxWindow* label, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxString &name = wxASCII_STR(wxStaticBoxNameStr) ) + { + Create( parent, id, label, pos, size, style, name ); + } + + bool Create( wxWindow *parent, + wxWindowID id, + const wxString &label, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxString &name = wxASCII_STR(wxStaticBoxNameStr) ) + { + return DoCreate( parent, id, &label, NULL, pos, size, style, name ); + } + + bool Create( wxWindow *parent, + wxWindowID id, + wxWindow* label, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxString &name = wxASCII_STR(wxStaticBoxNameStr) ) + { + return DoCreate( parent, id, NULL, label, pos, size, style, name ); + } + + virtual void SetLabel( const wxString &label ) wxOVERRIDE; + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // implementation + + virtual bool GTKIsTransparentForMouse() const wxOVERRIDE { return true; } + + virtual void GetBordersForSizer(int *borderTop, int *borderOther) const wxOVERRIDE; + + virtual void AddChild( wxWindowBase *child ) wxOVERRIDE; + +protected: + // Common implementation of both Create() overloads: exactly one of + // labelStr and labelWin parameters must be non-null. + bool DoCreate(wxWindow *parent, + wxWindowID id, + const wxString* labelStr, + wxWindow* labelWin, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name); + + virtual bool GTKWidgetNeedsMnemonic() const wxOVERRIDE; + virtual void GTKWidgetDoSetMnemonic(GtkWidget* w) wxOVERRIDE; + + void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxStaticBox); +}; + +// Indicate that we have the ctor overload taking wxWindow as label. +#define wxHAS_WINDOW_LABEL_IN_STATIC_BOX + +#endif // _WX_GTKSTATICBOX_H_ diff --git a/lib/wxWidgets/include/wx/gtk/statline.h b/lib/wxWidgets/include/wx/gtk/statline.h new file mode 100644 index 0000000..ad28aba --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/statline.h @@ -0,0 +1,48 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/statline.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKSTATICLINEH__ +#define __GTKSTATICLINEH__ + +#include "wx/defs.h" + +#if wxUSE_STATLINE + +// ---------------------------------------------------------------------------- +// wxStaticLine +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxStaticLine : public wxStaticLineBase +{ +public: + wxStaticLine(); + wxStaticLine(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint &pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxASCII_STR(wxStaticLineNameStr)); + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxASCII_STR(wxStaticLineNameStr)); + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + +private: + wxDECLARE_DYNAMIC_CLASS(wxStaticLine); +}; + +#endif // wxUSE_STATLINE + +#endif // __GTKSTATICLINEH__ + diff --git a/lib/wxWidgets/include/wx/gtk/stattext.h b/lib/wxWidgets/include/wx/gtk/stattext.h new file mode 100644 index 0000000..6763447 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/stattext.h @@ -0,0 +1,69 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/stattext.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_STATTEXT_H_ +#define _WX_GTK_STATTEXT_H_ + +//----------------------------------------------------------------------------- +// wxStaticText +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxStaticText : public wxStaticTextBase +{ +public: + wxStaticText(); + wxStaticText(wxWindow *parent, + wxWindowID id, + const wxString &label, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxString &name = wxASCII_STR(wxStaticTextNameStr) ); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString &label, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxString &name = wxASCII_STR(wxStaticTextNameStr) ); + + void SetLabel( const wxString &label ) wxOVERRIDE; + + bool SetFont( const wxFont &font ) wxOVERRIDE; + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // implementation + // -------------- + +protected: + virtual bool GTKWidgetNeedsMnemonic() const wxOVERRIDE; + virtual void GTKWidgetDoSetMnemonic(GtkWidget* w) wxOVERRIDE; + + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + virtual wxString WXGetVisibleLabel() const wxOVERRIDE; + virtual void WXSetVisibleLabel(const wxString& str) wxOVERRIDE; +#if wxUSE_MARKUP + virtual bool DoSetLabelMarkup(const wxString& markup) wxOVERRIDE; +#endif // wxUSE_MARKUP + +private: + // Common part of SetLabel() and DoSetLabelMarkup(). + typedef void (wxStaticText::*GTKLabelSetter)(GtkLabel *, const wxString&); + + void GTKDoSetLabel(GTKLabelSetter setter, const wxString& label); + + + wxDECLARE_DYNAMIC_CLASS(wxStaticText); +}; + +#endif + // _WX_GTK_STATTEXT_H_ diff --git a/lib/wxWidgets/include/wx/gtk/taskbar.h b/lib/wxWidgets/include/wx/gtk/taskbar.h new file mode 100644 index 0000000..3b33498 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/taskbar.h @@ -0,0 +1,33 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/taskbar.h +// Purpose: wxTaskBarIcon class for GTK2 +// Author: Paul Cornett +// Created: 2009-02-08 +// Copyright: (c) 2009 Paul Cornett +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_TASKBARICON_H_ +#define _WX_GTK_TASKBARICON_H_ + +class WXDLLIMPEXP_ADV wxTaskBarIcon: public wxTaskBarIconBase +{ +public: + wxTaskBarIcon(wxTaskBarIconType iconType = wxTBI_DEFAULT_TYPE); + ~wxTaskBarIcon(); + virtual bool SetIcon(const wxBitmapBundle& icon, const wxString& tooltip = wxString()) wxOVERRIDE; + virtual bool RemoveIcon() wxOVERRIDE; + virtual bool PopupMenu(wxMenu* menu) wxOVERRIDE; + bool IsOk() const { return true; } + bool IsIconInstalled() const; + + class Private; + +private: + Private* m_priv; + + wxDECLARE_DYNAMIC_CLASS(wxTaskBarIcon); + wxDECLARE_NO_COPY_CLASS(wxTaskBarIcon); +}; + +#endif // _WX_GTK_TASKBARICON_H_ diff --git a/lib/wxWidgets/include/wx/gtk/textctrl.h b/lib/wxWidgets/include/wx/gtk/textctrl.h new file mode 100644 index 0000000..b4d6e6b --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/textctrl.h @@ -0,0 +1,238 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/textctrl.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_TEXTCTRL_H_ +#define _WX_GTK_TEXTCTRL_H_ + +typedef struct _GtkTextMark GtkTextMark; + +//----------------------------------------------------------------------------- +// wxTextCtrl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTextCtrl: public wxTextCtrlBase +{ +public: + wxTextCtrl() { Init(); } + wxTextCtrl(wxWindow *parent, + wxWindowID id, + const wxString &value = wxEmptyString, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString &name = wxASCII_STR(wxTextCtrlNameStr)); + + virtual ~wxTextCtrl(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString &value = wxEmptyString, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString &name = wxASCII_STR(wxTextCtrlNameStr)); + + // implement base class pure virtuals + // ---------------------------------- + + virtual void WriteText(const wxString& text) wxOVERRIDE; + virtual wxString GetValue() const wxOVERRIDE; + virtual bool IsEmpty() const; + + virtual int GetLineLength(long lineNo) const wxOVERRIDE; + virtual wxString GetLineText(long lineNo) const wxOVERRIDE; + virtual int GetNumberOfLines() const wxOVERRIDE; + + virtual bool IsModified() const wxOVERRIDE; + virtual bool IsEditable() const wxOVERRIDE; + + virtual void GetSelection(long* from, long* to) const wxOVERRIDE; + + virtual void Remove(long from, long to) wxOVERRIDE; + + virtual void MarkDirty() wxOVERRIDE; + virtual void DiscardEdits() wxOVERRIDE; + + virtual bool SetStyle(long start, long end, const wxTextAttr& style) wxOVERRIDE; + virtual bool GetStyle(long position, wxTextAttr& style) wxOVERRIDE; + + // translate between the position (which is just an index in the text ctrl + // considering all its contents as a single strings) and (x, y) coordinates + // which represent column and line. + virtual long XYToPosition(long x, long y) const wxOVERRIDE; + virtual bool PositionToXY(long pos, long *x, long *y) const wxOVERRIDE; + + virtual void ShowPosition(long pos) wxOVERRIDE; + + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const wxOVERRIDE; + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, + wxTextCoord *col, + wxTextCoord *row) const wxOVERRIDE + { + return wxTextCtrlBase::HitTest(pt, col, row); + } + + // Clipboard operations + virtual void Copy() wxOVERRIDE; + virtual void Cut() wxOVERRIDE; + virtual void Paste() wxOVERRIDE; + + // Insertion point + virtual void SetInsertionPoint(long pos) wxOVERRIDE; + virtual long GetInsertionPoint() const wxOVERRIDE; + virtual wxTextPos GetLastPosition() const wxOVERRIDE; + + virtual void SetSelection(long from, long to) wxOVERRIDE; + virtual void SetEditable(bool editable) wxOVERRIDE; + + // Overridden wxWindow methods + virtual void SetWindowStyleFlag( long style ) wxOVERRIDE; + +#if wxUSE_SPELLCHECK && defined(__WXGTK3__) + // Use native spelling and grammar checking functions. + virtual bool EnableProofCheck(const wxTextProofOptions& options + = wxTextProofOptions::Default()) wxOVERRIDE; + virtual wxTextProofOptions GetProofCheckOptions() const wxOVERRIDE; +#endif // wxUSE_SPELLCHECK && __WXGTK3__ + + // Implementation from now on + void OnDropFiles( wxDropFilesEvent &event ); + void OnChar( wxKeyEvent &event ); + + void OnCut(wxCommandEvent& event); + void OnCopy(wxCommandEvent& event); + void OnPaste(wxCommandEvent& event); + void OnUndo(wxCommandEvent& event); + void OnRedo(wxCommandEvent& event); + + void OnUpdateCut(wxUpdateUIEvent& event); + void OnUpdateCopy(wxUpdateUIEvent& event); + void OnUpdatePaste(wxUpdateUIEvent& event); + void OnUpdateUndo(wxUpdateUIEvent& event); + void OnUpdateRedo(wxUpdateUIEvent& event); + + bool SetFont(const wxFont& font) wxOVERRIDE; + bool SetForegroundColour(const wxColour& colour) wxOVERRIDE; + bool SetBackgroundColour(const wxColour& colour) wxOVERRIDE; + + GtkWidget* GetConnectWidget() wxOVERRIDE; + + void SetUpdateFont(bool WXUNUSED(update)) { } + + // implementation only from now on + + // tell the control to ignore next text changed signal + void IgnoreNextTextUpdate(int n = 1) { m_countUpdatesToIgnore = n; } + + // should we ignore the changed signal? always resets the flag + bool IgnoreTextUpdate(); + + // call this to indicate that the control is about to be changed + // programmatically and so m_modified flag shouldn't be set + void DontMarkDirtyOnNextChange() { m_dontMarkDirty = true; } + + // should we mark the control as dirty? always resets the flag + bool MarkDirtyOnChange(); + + // always let GTK have mouse release events for multiline controls + virtual bool GTKProcessEvent(wxEvent& event) const wxOVERRIDE; + + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + void GTKOnTextChanged() wxOVERRIDE; + void GTKAfterLayout(); + +protected: + // overridden wxWindow virtual methods + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE; + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; + + virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const wxOVERRIDE; + + virtual void DoFreeze() wxOVERRIDE; + virtual void DoThaw() wxOVERRIDE; + + virtual void DoEnable(bool enable) wxOVERRIDE; + + // Widgets that use the style->base colour for the BG colour should + // override this and return true. + virtual bool UseGTKStyleBase() const wxOVERRIDE { return true; } + + virtual wxString DoGetValue() const wxOVERRIDE; + + // Override this to use either GtkEntry or GtkTextView IME depending on the + // kind of control we are. + virtual int GTKIMFilterKeypress(GdkEventKey* event) const wxOVERRIDE; + + virtual wxPoint DoPositionToCoords(long pos) const wxOVERRIDE; + + // wrappers hiding the differences between functions doing the same thing + // for GtkTextView and GtkEntry (all of them use current window style to + // set the given characteristic) + void GTKSetEditable(); + void GTKSetVisibility(); + void GTKSetActivatesDefault(); + void GTKSetWrapMode(); + void GTKSetJustification(); + +private: + void Init(); + + // overridden wxTextEntry virtual methods + virtual GtkEditable *GetEditable() const wxOVERRIDE; + virtual GtkEntry *GetEntry() const wxOVERRIDE; + + // change the font for everything in this control + void ChangeFontGlobally(); + + // get the encoding which is used in this control: this looks at our font + // and default style but not the current style (i.e. the style for the + // current position); returns wxFONTENCODING_SYSTEM if we have no specific + // encoding + wxFontEncoding GetTextEncoding() const; + + // returns either m_text or m_buffer depending on whether the control is + // single- or multi-line; convenient for the GTK+ functions which work with + // both + void *GetTextObject() const wxOVERRIDE + { + return IsMultiLine() ? static_cast(m_buffer) + : static_cast(m_text); + } + + + // the widget used for single line controls + GtkWidget *m_text; + + bool m_modified; + bool m_dontMarkDirty; + + int m_countUpdatesToIgnore; + + // Our text buffer. Convenient, and holds the buffer while using + // a dummy one when frozen + GtkTextBuffer *m_buffer; + + GtkTextMark* m_showPositionDefer; + GSList* m_anonymousMarkList; + unsigned m_afterLayoutId; + + // For wxTE_AUTO_URL + void OnUrlMouseEvent(wxMouseEvent&); + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxTextCtrl); +}; + +#endif // _WX_GTK_TEXTCTRL_H_ diff --git a/lib/wxWidgets/include/wx/gtk/textentry.h b/lib/wxWidgets/include/wx/gtk/textentry.h new file mode 100644 index 0000000..579447f --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/textentry.h @@ -0,0 +1,153 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/textentry.h +// Purpose: wxGTK-specific wxTextEntry implementation +// Author: Vadim Zeitlin +// Created: 2007-09-24 +// Copyright: (c) 2007 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_TEXTENTRY_H_ +#define _WX_GTK_TEXTENTRY_H_ + +typedef struct _GdkEventKey GdkEventKey; +typedef struct _GtkEditable GtkEditable; +typedef struct _GtkEntry GtkEntry; + +class wxTextAutoCompleteData; // private class used only by wxTextEntry itself +class wxTextCoalesceData; // another private class + +// ---------------------------------------------------------------------------- +// wxTextEntry: roughly corresponds to GtkEditable +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTextEntry : public wxTextEntryBase +{ +public: + wxTextEntry(); + virtual ~wxTextEntry(); + + // implement wxTextEntryBase pure virtual methods + virtual void WriteText(const wxString& text) wxOVERRIDE; + virtual void Remove(long from, long to) wxOVERRIDE; + + virtual void Copy() wxOVERRIDE; + virtual void Cut() wxOVERRIDE; + virtual void Paste() wxOVERRIDE; + + virtual void Undo() wxOVERRIDE; + virtual void Redo() wxOVERRIDE; + virtual bool CanUndo() const wxOVERRIDE; + virtual bool CanRedo() const wxOVERRIDE; + + virtual void SetInsertionPoint(long pos) wxOVERRIDE; + virtual long GetInsertionPoint() const wxOVERRIDE; + virtual long GetLastPosition() const wxOVERRIDE; + + virtual void SetSelection(long from, long to) wxOVERRIDE; + virtual void GetSelection(long *from, long *to) const wxOVERRIDE; + + virtual bool IsEditable() const wxOVERRIDE; + virtual void SetEditable(bool editable) wxOVERRIDE; + + virtual void SetMaxLength(unsigned long len) wxOVERRIDE; + virtual void ForceUpper() wxOVERRIDE; + +#ifdef __WXGTK3__ + virtual bool SetHint(const wxString& hint) wxOVERRIDE; + virtual wxString GetHint() const wxOVERRIDE; +#endif + + // implementation only from now on + void SendMaxLenEvent(); + bool GTKEntryOnInsertText(const char* text); + bool GTKIsUpperCase() const { return m_isUpperCase; } + + // Called from "changed" signal handler (or, possibly, slightly later, when + // coalescing several "changed" signals into a single event) for GtkEntry. + // + // By default just generates a wxEVT_TEXT, but overridden to do more things + // in wxTextCtrl. + virtual void GTKOnTextChanged() { SendTextUpdatedEvent(); } + + // Helper functions only used internally. + wxTextCoalesceData* GTKGetCoalesceData() const { return m_coalesceData; } + +protected: + // This method must be called from the derived class Create() to connect + // the handlers for the clipboard (cut/copy/paste) events. + void GTKConnectClipboardSignals(GtkWidget* entry); + + // And this one to connect "insert-text" signal. + void GTKConnectInsertTextSignal(GtkEntry* entry); + + // Finally this one connects to the "changed" signal on the object returned + // by GetTextObject(). + void GTKConnectChangedSignal(); + + + virtual void DoSetValue(const wxString& value, int flags) wxOVERRIDE; + virtual wxString DoGetValue() const wxOVERRIDE; + + // margins functions + virtual bool DoSetMargins(const wxPoint& pt) wxOVERRIDE; + virtual wxPoint DoGetMargins() const wxOVERRIDE; + + virtual bool DoAutoCompleteStrings(const wxArrayString& choices) wxOVERRIDE; + virtual bool DoAutoCompleteCustom(wxTextCompleter *completer) wxOVERRIDE; + + // Call this from the overridden wxWindow::GTKIMFilterKeypress() to use + // GtkEntry IM context. + int GTKEntryIMFilterKeypress(GdkEventKey* event) const; + + // If GTKEntryIMFilterKeypress() is not called (as multiline wxTextCtrl + // uses its own IM), call this method instead to still notify wxTextEntry + // about the key press events in the given widget. + void GTKEntryOnKeypress(GtkWidget* widget) const; + + + static int GTKGetEntryTextLength(GtkEntry* entry); + + // Block/unblock the corresponding GTK signal. + // + // Note that we make it protected in wxGTK as it is called from wxComboBox + // currently. + virtual void EnableTextChangedEvents(bool enable) wxOVERRIDE; + + // Helper for wxTE_PROCESS_ENTER handling: activates the default button in + // the dialog containing this control if any. + bool ClickDefaultButtonIfPossible(); + +private: + // implement this to return the associated GtkEntry or another widget + // implementing GtkEditable + virtual GtkEditable *GetEditable() const = 0; + + // implement this to return the associated GtkEntry + virtual GtkEntry *GetEntry() const = 0; + + // This one exists in order to be overridden by wxTextCtrl which uses + // either GtkEditable or GtkTextBuffer depending on whether it is single- + // or multi-line. + virtual void *GetTextObject() const { return GetEntry(); } + + + // Various auto-completion-related stuff, only used if any of AutoComplete() + // methods are called. + wxTextAutoCompleteData *m_autoCompleteData; + + // It needs to call our GetEntry() method. + friend class wxTextAutoCompleteData; + + // Data used for coalescing "changed" events resulting from a single user + // action. + mutable wxTextCoalesceData* m_coalesceData; + + bool m_isUpperCase; +}; + +// We don't need the generic version. +#define wxHAS_NATIVE_TEXT_FORCEUPPER + +#endif // _WX_GTK_TEXTENTRY_H_ + diff --git a/lib/wxWidgets/include/wx/gtk/tglbtn.h b/lib/wxWidgets/include/wx/gtk/tglbtn.h new file mode 100644 index 0000000..4ce4730 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/tglbtn.h @@ -0,0 +1,120 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/tglbtn.h +// Purpose: Declaration of the wxToggleButton class, which implements a +// toggle button under wxGTK. +// Author: John Norris, minor changes by Axel Schlueter +// Modified by: +// Created: 08.02.01 +// Copyright: (c) 2000 Johnny C. Norris II +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_TOGGLEBUTTON_H_ +#define _WX_GTK_TOGGLEBUTTON_H_ + +#include "wx/bmpbndl.h" + +//----------------------------------------------------------------------------- +// wxToggleButton +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxToggleButton: public wxToggleButtonBase +{ +public: + // construction/destruction + wxToggleButton() {} + wxToggleButton(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + // Create the control + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)); + + // Get/set the value + void SetValue(bool state) wxOVERRIDE; + bool GetValue() const wxOVERRIDE; + + // Set the label + void SetLabel(const wxString& label) wxOVERRIDE; + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + void GTKDisableEvents(); + void GTKEnableEvents(); + +protected: + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE; + +#if wxUSE_MARKUP + virtual bool DoSetLabelMarkup(const wxString& markup) wxOVERRIDE; +#endif // wxUSE_MARKUP + +private: + typedef wxToggleButtonBase base_type; + + // Return the GtkLabel used by this toggle button. + GtkLabel *GTKGetLabel() const; + + wxDECLARE_DYNAMIC_CLASS(wxToggleButton); +}; + +//----------------------------------------------------------------------------- +// wxBitmapToggleButton +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButton +{ +public: + // construction/destruction + wxBitmapToggleButton() {} + wxBitmapToggleButton(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + // Create the control + bool Create(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)); + + // deprecated synonym for SetBitmapLabel() + wxDEPRECATED_INLINE( void SetLabel(const wxBitmap& bitmap), + SetBitmapLabel(bitmap); ) + // prevent virtual function hiding + virtual void SetLabel(const wxString& label) wxOVERRIDE { wxToggleButton::SetLabel(label); } + +private: + typedef wxToggleButtonBase base_type; + + wxDECLARE_DYNAMIC_CLASS(wxBitmapToggleButton); +}; + +#endif // _WX_GTK_TOGGLEBUTTON_H_ + diff --git a/lib/wxWidgets/include/wx/gtk/toolbar.h b/lib/wxWidgets/include/wx/gtk/toolbar.h new file mode 100644 index 0000000..105fea9 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/toolbar.h @@ -0,0 +1,102 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/toolbar.h +// Purpose: GTK toolbar +// Author: Robert Roebling +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_TOOLBAR_H_ +#define _WX_GTK_TOOLBAR_H_ + +typedef struct _GtkTooltips GtkTooltips; + +// ---------------------------------------------------------------------------- +// wxToolBar +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxToolBar : public wxToolBarBase +{ +public: + // construction/destruction + wxToolBar() { Init(); } + wxToolBar( wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTB_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxToolBarNameStr) ) + { + Init(); + + Create(parent, id, pos, size, style, name); + } + + bool Create( wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTB_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxToolBarNameStr) ); + + virtual ~wxToolBar(); + + virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const wxOVERRIDE; + + virtual void SetToolShortHelp(int id, const wxString& helpString) wxOVERRIDE; + + virtual void SetWindowStyleFlag( long style ) wxOVERRIDE; + + virtual void SetToolNormalBitmap(int id, const wxBitmapBundle& bitmap) wxOVERRIDE; + virtual void SetToolDisabledBitmap(int id, const wxBitmapBundle& bitmap) wxOVERRIDE; + + virtual bool Realize() wxOVERRIDE; + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + virtual wxToolBarToolBase *CreateTool(int id, + const wxString& label, + const wxBitmapBundle& bitmap1, + const wxBitmapBundle& bitmap2 = wxNullBitmap, + wxItemKind kind = wxITEM_NORMAL, + wxObject *clientData = NULL, + const wxString& shortHelpString = wxEmptyString, + const wxString& longHelpString = wxEmptyString) wxOVERRIDE; + virtual wxToolBarToolBase *CreateTool(wxControl *control, + const wxString& label) wxOVERRIDE; + + // implementation from now on + // -------------------------- + + GtkToolbar* GTKGetToolbar() const { return m_toolbar; } + +protected: + // choose the default border for this window + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_DEFAULT; } + + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; + + // implement base class pure virtuals + virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE; + virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE; + + virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable) wxOVERRIDE; + virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle) wxOVERRIDE; + virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle) wxOVERRIDE; + +private: + void Init(); + void GtkSetStyle(); + GSList* GetRadioGroup(size_t pos); + virtual void AddChildGTK(wxWindowGTK* child) wxOVERRIDE; + + GtkToolbar* m_toolbar; + GtkTooltips* m_tooltips; + + wxDECLARE_DYNAMIC_CLASS(wxToolBar); +}; + +#endif + // _WX_GTK_TOOLBAR_H_ diff --git a/lib/wxWidgets/include/wx/gtk/tooltip.h b/lib/wxWidgets/include/wx/gtk/tooltip.h new file mode 100644 index 0000000..dbed489 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/tooltip.h @@ -0,0 +1,55 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/tooltip.h +// Purpose: wxToolTip class +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTKTOOLTIP_H_ +#define _WX_GTKTOOLTIP_H_ + +#include "wx/string.h" +#include "wx/object.h" + +//----------------------------------------------------------------------------- +// forward declarations +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxWindow; + +//----------------------------------------------------------------------------- +// wxToolTip +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxToolTip : public wxObject +{ +public: + wxToolTip( const wxString &tip ); + + // globally change the tooltip parameters + static void Enable( bool flag ); + static void SetDelay( long msecs ); + // set the delay after which the tooltip disappears or how long the tooltip remains visible + static void SetAutoPop(long msecs); + // set the delay between subsequent tooltips to appear + static void SetReshow(long msecs); + + // get/set the tooltip text + void SetTip( const wxString &tip ); + wxString GetTip() const { return m_text; } + + wxWindow *GetWindow() const { return m_window; } + + // Implementation + void GTKSetWindow(wxWindow* win); + static void GTKApply(GtkWidget* widget, const char* tip); + +private: + wxString m_text; + wxWindow *m_window; + + wxDECLARE_ABSTRACT_CLASS(wxToolTip); +}; + +#endif // _WX_GTKTOOLTIP_H_ diff --git a/lib/wxWidgets/include/wx/gtk/toplevel.h b/lib/wxWidgets/include/wx/gtk/toplevel.h new file mode 100644 index 0000000..b057a4a --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/toplevel.h @@ -0,0 +1,195 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/toplevel.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling, Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_TOPLEVEL_H_ +#define _WX_GTK_TOPLEVEL_H_ + +class WXDLLIMPEXP_FWD_CORE wxGUIEventLoop; + +//----------------------------------------------------------------------------- +// wxTopLevelWindowGTK +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTopLevelWindowGTK : public wxTopLevelWindowBase +{ + typedef wxTopLevelWindowBase base_type; +public: + // construction + wxTopLevelWindowGTK() { Init(); } + wxTopLevelWindowGTK(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Init(); + + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + virtual ~wxTopLevelWindowGTK(); + + // implement base class pure virtuals + virtual void Maximize(bool maximize = true) wxOVERRIDE; + virtual bool IsMaximized() const wxOVERRIDE; + virtual void Iconize(bool iconize = true) wxOVERRIDE; + virtual bool IsIconized() const wxOVERRIDE; + virtual void SetIcons(const wxIconBundle& icons) wxOVERRIDE; + virtual void Restore() wxOVERRIDE; + + virtual bool EnableCloseButton(bool enable = true) wxOVERRIDE; + + virtual void ShowWithoutActivating() wxOVERRIDE; + virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) wxOVERRIDE; + virtual bool IsFullScreen() const wxOVERRIDE { return m_fsIsShowing; } + + virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO) wxOVERRIDE; + + virtual void SetWindowStyleFlag( long style ) wxOVERRIDE; + + virtual bool Show(bool show = true) wxOVERRIDE; + + virtual void Raise() wxOVERRIDE; + + virtual bool IsActive() wxOVERRIDE; + + virtual void SetTitle( const wxString &title ) wxOVERRIDE; + virtual wxString GetTitle() const wxOVERRIDE { return m_title; } + + virtual void SetLabel(const wxString& label) wxOVERRIDE { SetTitle( label ); } + virtual wxString GetLabel() const wxOVERRIDE { return GetTitle(); } + + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE; + + virtual bool SetTransparent(wxByte alpha) wxOVERRIDE; + virtual bool CanSetTransparent() wxOVERRIDE; + + // Experimental, to allow help windows to be + // viewable from within modal dialogs + virtual void AddGrab(); + virtual void RemoveGrab(); + virtual bool IsGrabbed() const; + + + virtual void Refresh( bool eraseBackground = true, + const wxRect *rect = (const wxRect *) NULL ) wxOVERRIDE; + + // implementation from now on + // -------------------------- + + // GTK callbacks + virtual void GTKHandleRealized() wxOVERRIDE; + + void GTKConfigureEvent(int x, int y); + + // do *not* call this to iconize the frame, this is a private function! + void SetIconizeState(bool iconic); + + GtkWidget *m_mainWidget; + + bool m_fsIsShowing; /* full screen */ + int m_fsSaveGdkFunc, m_fsSaveGdkDecor; + wxRect m_fsSaveFrame; + + // m_windowStyle translated to GDK's terms + int m_gdkFunc, + m_gdkDecor; + + // size of WM decorations + struct DecorSize + { + DecorSize() + { + left = + right = + top = + bottom = 0; + } + + int left, right, top, bottom; + }; + DecorSize m_decorSize; + + // private gtk_timeout_add result for mimicking wxUSER_ATTENTION_INFO and + // wxUSER_ATTENTION_ERROR difference, -2 for no hint, -1 for ERROR hint, rest for GtkTimeout handle. + int m_urgency_hint; + // timer for detecting WM with broken _NET_REQUEST_FRAME_EXTENTS handling + unsigned m_netFrameExtentsTimerId; + + // return the size of the window without WM decorations + void GTKDoGetSize(int *width, int *height) const; + + void GTKUpdateDecorSize(const DecorSize& decorSize); + + void GTKDoAfterShow(); + +#ifdef __WXGTK3__ + void GTKUpdateClientSizeIfNecessary(); + + virtual void SetMinSize(const wxSize& minSize) wxOVERRIDE; + + virtual void WXSetInitialFittingClientSize(int flags, wxSizer* sizer = NULL) wxOVERRIDE; + +private: + // Flags to call WXSetInitialFittingClientSize() with if != 0. + int m_pendingFittingClientSizeFlags; +#endif // __WXGTK3__ + +protected: + // give hints to the Window Manager for how the size + // of the TLW can be changed by dragging + virtual void DoSetSizeHints( int minW, int minH, + int maxW, int maxH, + int incW, int incH) wxOVERRIDE; + // move the window to the specified location and resize it + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; + + // take into account WM decorations here + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; + + virtual void DoSetClientSize(int width, int height) wxOVERRIDE; + virtual void DoGetClientSize(int *width, int *height) const wxOVERRIDE; + + // string shown in the title bar + wxString m_title; + + bool m_deferShow; + +private: + void Init(); + DecorSize& GetCachedDecorSize(); + + // size hint increments + int m_incWidth, m_incHeight; + + // position before it last changed + wxPoint m_lastPos; + + // is the frame currently iconized? + bool m_isIconized; + + // is the frame currently grabbed explicitly by the application? + wxGUIEventLoop* m_grabbedEventLoop; + + bool m_updateDecorSize; + bool m_deferShowAllowed; +}; + +#endif // _WX_GTK_TOPLEVEL_H_ diff --git a/lib/wxWidgets/include/wx/gtk/webview_webkit.h b/lib/wxWidgets/include/wx/gtk/webview_webkit.h new file mode 100644 index 0000000..941efa1 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/webview_webkit.h @@ -0,0 +1,232 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: include/gtk/wx/webview.h +// Purpose: GTK webkit backend for web view component +// Author: Robert Roebling, Marianne Gagnon +// Copyright: (c) 2010 Marianne Gagnon, 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_WEBKITCTRL_H_ +#define _WX_GTK_WEBKITCTRL_H_ + +#include "wx/defs.h" + +// NOTE: this header is used for both the WebKit1 and WebKit2 implementations +#if wxUSE_WEBVIEW && (wxUSE_WEBVIEW_WEBKIT || wxUSE_WEBVIEW_WEBKIT2) && defined(__WXGTK__) + +#include "wx/sharedptr.h" +#include "wx/webview.h" +#if wxUSE_WEBVIEW_WEBKIT2 +#include +#include +#endif + +typedef struct _WebKitWebView WebKitWebView; +typedef struct _WebKitBackForwardListItem WebKitBackForwardListItem; + +//----------------------------------------------------------------------------- +// wxWebViewWebKit +//----------------------------------------------------------------------------- + +class wxWebKitRunScriptParams; + +class WXDLLIMPEXP_WEBVIEW wxWebViewWebKit : public wxWebView +{ +public: + wxWebViewWebKit(); + + wxWebViewWebKit(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& url = wxWebViewDefaultURLStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxString& name = wxASCII_STR(wxWebViewNameStr)) + { + Create(parent, id, url, pos, size, style, name); + } + + virtual bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& url = wxWebViewDefaultURLStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxString& name = wxASCII_STR(wxWebViewNameStr)) wxOVERRIDE; + + virtual ~wxWebViewWebKit(); + + virtual bool Enable( bool enable = true ) wxOVERRIDE; + + // implementation + // -------------- + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + virtual void Stop() wxOVERRIDE; + virtual void LoadURL(const wxString& url) wxOVERRIDE; + virtual void GoBack() wxOVERRIDE; + virtual void GoForward() wxOVERRIDE; + virtual void Reload(wxWebViewReloadFlags flags = wxWEBVIEW_RELOAD_DEFAULT) wxOVERRIDE; + virtual bool CanGoBack() const wxOVERRIDE; + virtual bool CanGoForward() const wxOVERRIDE; + virtual void ClearHistory() wxOVERRIDE; + virtual void EnableContextMenu(bool enable = true) wxOVERRIDE; + virtual void EnableHistory(bool enable = true) wxOVERRIDE; + virtual wxVector > GetBackwardHistory() wxOVERRIDE; + virtual wxVector > GetForwardHistory() wxOVERRIDE; + virtual void LoadHistoryItem(wxSharedPtr item) wxOVERRIDE; + virtual wxString GetCurrentURL() const wxOVERRIDE; + virtual wxString GetCurrentTitle() const wxOVERRIDE; + virtual wxString GetPageSource() const wxOVERRIDE; + virtual wxString GetPageText() const wxOVERRIDE; + virtual void Print() wxOVERRIDE; + virtual bool IsBusy() const wxOVERRIDE; +#if wxUSE_WEBVIEW_WEBKIT2 + virtual void EnableAccessToDevTools(bool enable = true) wxOVERRIDE; + virtual bool IsAccessToDevToolsEnabled() const wxOVERRIDE; + virtual bool SetUserAgent(const wxString& userAgent) wxOVERRIDE; +#endif + + void SetZoomType(wxWebViewZoomType) wxOVERRIDE; + wxWebViewZoomType GetZoomType() const wxOVERRIDE; + bool CanSetZoomType(wxWebViewZoomType) const wxOVERRIDE; + virtual float GetZoomFactor() const wxOVERRIDE; + virtual void SetZoomFactor(float) wxOVERRIDE; + + //Clipboard functions + virtual bool CanCut() const wxOVERRIDE; + virtual bool CanCopy() const wxOVERRIDE; + virtual bool CanPaste() const wxOVERRIDE; + virtual void Cut() wxOVERRIDE; + virtual void Copy() wxOVERRIDE; + virtual void Paste() wxOVERRIDE; + + //Undo / redo functionality + virtual bool CanUndo() const wxOVERRIDE; + virtual bool CanRedo() const wxOVERRIDE; + virtual void Undo() wxOVERRIDE; + virtual void Redo() wxOVERRIDE; + + //Find function + virtual long Find(const wxString& text, int flags = wxWEBVIEW_FIND_DEFAULT) wxOVERRIDE; + + //Editing functions + virtual void SetEditable(bool enable = true) wxOVERRIDE; + virtual bool IsEditable() const wxOVERRIDE; + + //Selection + virtual void DeleteSelection() wxOVERRIDE; + virtual bool HasSelection() const wxOVERRIDE; + virtual void SelectAll() wxOVERRIDE; + virtual wxString GetSelectedText() const wxOVERRIDE; + virtual wxString GetSelectedSource() const wxOVERRIDE; + virtual void ClearSelection() wxOVERRIDE; + +#if wxUSE_WEBVIEW_WEBKIT2 + virtual void RunScriptAsync(const wxString& javascript, void* clientData = NULL) const wxOVERRIDE; + virtual bool AddScriptMessageHandler(const wxString& name) wxOVERRIDE; + virtual bool RemoveScriptMessageHandler(const wxString& name) wxOVERRIDE; + virtual bool AddUserScript(const wxString& javascript, + wxWebViewUserScriptInjectionTime injectionTime = wxWEBVIEW_INJECT_AT_DOCUMENT_START) wxOVERRIDE; + virtual void RemoveAllUserScripts() wxOVERRIDE; +#else + virtual bool RunScript(const wxString& javascript, wxString* output = NULL) const wxOVERRIDE; +#endif + + //Virtual Filesystem Support + virtual void RegisterHandler(wxSharedPtr handler) wxOVERRIDE; + virtual wxVector > GetHandlers() { return m_handlerList; } + + virtual void* GetNativeBackend() const wxOVERRIDE { return m_web_view; } + + /** TODO: check if this can be made private + * The native control has a getter to check for busy state, but except in + * very recent versions of webkit this getter doesn't say everything we need + * (namely it seems to stay indefinitely busy when loading is cancelled by + * user) + */ + bool m_busy; + + wxString m_vfsurl; + + //We use this flag to stop recursion when we load a page from the navigation + //callback, mainly when loading a VFS page + bool m_guard; + //This flag is use to indicate when a navigation event is the result of a + //create-web-view signal and so we need to send a new window event + bool m_creating; + +#if wxUSE_WEBVIEW_WEBKIT2 + // This method needs to be public to make it callable from a callback + void ProcessJavaScriptResult(GAsyncResult *res, wxWebKitRunScriptParams* params) const; +#endif + +protected: + virtual void DoSetPage(const wxString& html, const wxString& baseUrl) wxOVERRIDE; + + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; + +private: + + void ZoomIn(); + void ZoomOut(); + void SetWebkitZoom(float level); + float GetWebkitZoom() const; + + //Find helper function + void FindClear(); + + // focus event handler: calls GTKUpdateBitmap() + void GTKOnFocus(wxFocusEvent& event); + +#if wxUSE_WEBVIEW_WEBKIT2 + bool CanExecuteEditingCommand(const gchar* command) const; + void SetupWebExtensionServer(); + GDBusProxy *GetExtensionProxy() const; +#endif + + WebKitWebView *m_web_view; + wxString m_customUserAgent; + int m_historyLimit; + + wxVector > m_handlerList; + + //variables used for Find() + int m_findFlags; + wxString m_findText; + int m_findPosition; + int m_findCount; + +#if wxUSE_WEBVIEW_WEBKIT2 + //Used for webkit2 extension + GDBusServer *m_dbusServer; + GDBusProxy *m_extension; + + static wxSharedPtr + CreateHistoryItemFromWKItem(WebKitBackForwardListItem* gtkitem); +#endif + + wxDECLARE_DYNAMIC_CLASS(wxWebViewWebKit); +}; + +class WXDLLIMPEXP_WEBVIEW wxWebViewFactoryWebKit : public wxWebViewFactory +{ +public: + virtual wxWebView* Create() wxOVERRIDE { return new wxWebViewWebKit; } + virtual wxWebView* Create(wxWindow* parent, + wxWindowID id, + const wxString& url = wxWebViewDefaultURLStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxWebViewNameStr)) wxOVERRIDE + { return new wxWebViewWebKit(parent, id, url, pos, size, style, name); } +#if wxUSE_WEBVIEW_WEBKIT2 + virtual wxVersionInfo GetVersionInfo() wxOVERRIDE; +#endif +}; + + +#endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && defined(__WXGTK__) + +#endif diff --git a/lib/wxWidgets/include/wx/gtk/webviewhistoryitem_webkit.h b/lib/wxWidgets/include/wx/gtk/webviewhistoryitem_webkit.h new file mode 100644 index 0000000..3137b3a --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/webviewhistoryitem_webkit.h @@ -0,0 +1,33 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/gtk/webviewhistoryitem.h +// Purpose: wxWebViewHistoryItem header for GTK +// Author: Steven Lamerton +// Copyright: (c) 2011 Steven Lamerton +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_WEBVIEWHISTORYITEM_H_ +#define _WX_GTK_WEBVIEWHISTORYITEM_H_ + +#include "wx/setup.h" + +#if wxUSE_WEBVIEW && (wxUSE_WEBVIEW_WEBKIT || wxUSE_WEBVIEW_WEBKIT2) && defined(__WXGTK__) + +class WXDLLIMPEXP_WEBVIEW wxWebViewHistoryItem +{ +public: + wxWebViewHistoryItem(const wxString& url, const wxString& title) : + m_url(url), m_title(title) {} + wxString GetUrl() { return m_url; } + wxString GetTitle() { return m_title; } + + friend class wxWebViewWebKit; + +private: + wxString m_url, m_title; + void* m_histItem; +}; + +#endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && defined(__WXGTK__) + +#endif // _WX_GTK_WEBVIEWHISTORYITEM_H_ diff --git a/lib/wxWidgets/include/wx/gtk/window.h b/lib/wxWidgets/include/wx/gtk/window.h new file mode 100644 index 0000000..a28bec5 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk/window.h @@ -0,0 +1,504 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/window.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_WINDOW_H_ +#define _WX_GTK_WINDOW_H_ + +#include "wx/dynarray.h" + +#ifdef __WXGTK3__ + typedef struct _cairo cairo_t; + typedef struct _GtkStyleProvider GtkStyleProvider; + typedef struct _GtkCssProvider GtkCssProvider; + #define WXUNUSED_IN_GTK2(x) x + #define WXUNUSED_IN_GTK3(x) +#else + #define WXUNUSED_IN_GTK2(x) + #define WXUNUSED_IN_GTK3(x) x +#endif + +typedef struct _GdkEventKey GdkEventKey; +typedef struct _GtkIMContext GtkIMContext; + +WX_DEFINE_EXPORTED_ARRAY_PTR(GdkWindow *, wxArrayGdkWindows); + +extern "C" +{ + +typedef void (*wxGTKCallback)(); + +} + +//----------------------------------------------------------------------------- +// wxWindowGTK +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWindowGTK : public wxWindowBase +{ +public: + // creating the window + // ------------------- + wxWindowGTK(); + wxWindowGTK(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)); + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)); + virtual ~wxWindowGTK(); + + // implement base class (pure) virtual methods + // ------------------------------------------- + + virtual void Raise() wxOVERRIDE; + virtual void Lower() wxOVERRIDE; + + virtual bool Show( bool show = true ) wxOVERRIDE; + virtual bool IsShown() const wxOVERRIDE; + + virtual bool IsRetained() const wxOVERRIDE; + + virtual void SetFocus() wxOVERRIDE; + + // hint from wx to native GTK+ tab traversal code + virtual void SetCanFocus(bool canFocus) wxOVERRIDE; + + virtual bool Reparent( wxWindowBase *newParent ) wxOVERRIDE; + + virtual wxSize GetWindowBorderSize() const wxOVERRIDE; + + virtual void WarpPointer(int x, int y) wxOVERRIDE; +#ifdef __WXGTK3__ + virtual bool EnableTouchEvents(int eventsMask) wxOVERRIDE; +#endif // __WXGTK3__ + + virtual void Refresh( bool eraseBackground = true, + const wxRect *rect = (const wxRect *) NULL ) wxOVERRIDE; + virtual void Update() wxOVERRIDE; + virtual void ClearBackground() wxOVERRIDE; + + virtual bool SetBackgroundColour( const wxColour &colour ) wxOVERRIDE; + virtual bool SetForegroundColour( const wxColour &colour ) wxOVERRIDE; + virtual bool SetCursor( const wxCursor &cursor ) wxOVERRIDE; + virtual bool SetFont( const wxFont &font ) wxOVERRIDE; + + virtual bool SetBackgroundStyle(wxBackgroundStyle style) wxOVERRIDE ; + virtual bool IsTransparentBackgroundSupported(wxString* reason = NULL) const wxOVERRIDE; + + virtual int GetCharHeight() const wxOVERRIDE; + virtual int GetCharWidth() const wxOVERRIDE; + virtual double GetContentScaleFactor() const wxOVERRIDE; + virtual double GetDPIScaleFactor() const wxOVERRIDE; + + virtual void SetScrollbar( int orient, int pos, int thumbVisible, + int range, bool refresh = true ) wxOVERRIDE; + virtual void SetScrollPos( int orient, int pos, bool refresh = true ) wxOVERRIDE; + virtual int GetScrollPos( int orient ) const wxOVERRIDE; + virtual int GetScrollThumb( int orient ) const wxOVERRIDE; + virtual int GetScrollRange( int orient ) const wxOVERRIDE; + virtual void ScrollWindow( int dx, int dy, + const wxRect* rect = NULL ) wxOVERRIDE; + virtual bool ScrollLines(int lines) wxOVERRIDE; + virtual bool ScrollPages(int pages) wxOVERRIDE; + +#if wxUSE_DRAG_AND_DROP + virtual void SetDropTarget( wxDropTarget *dropTarget ) wxOVERRIDE; +#endif // wxUSE_DRAG_AND_DROP + + virtual void AddChild( wxWindowBase *child ) wxOVERRIDE; + virtual void RemoveChild( wxWindowBase *child ) wxOVERRIDE; + + virtual void SetLayoutDirection(wxLayoutDirection dir) wxOVERRIDE; + virtual wxLayoutDirection GetLayoutDirection() const wxOVERRIDE; + virtual wxCoord AdjustForLayoutDirection(wxCoord x, + wxCoord width, + wxCoord widthTotal) const wxOVERRIDE; + + virtual bool DoIsExposed( int x, int y ) const wxOVERRIDE; + virtual bool DoIsExposed( int x, int y, int w, int h ) const wxOVERRIDE; + + virtual void SetDoubleBuffered(bool on) wxOVERRIDE; + virtual bool IsDoubleBuffered() const wxOVERRIDE; + + // SetLabel(), which does nothing in wxWindow + virtual void SetLabel(const wxString& label) wxOVERRIDE { m_gtkLabel = label; } + virtual wxString GetLabel() const wxOVERRIDE { return m_gtkLabel; } + + // implementation + // -------------- + + virtual WXWidget GetHandle() const wxOVERRIDE { return m_widget; } + + // many important things are done here, this function must be called + // regularly + virtual void OnInternalIdle() wxOVERRIDE; + + // For compatibility across platforms (not in event table) + void OnIdle(wxIdleEvent& WXUNUSED(event)) {} + + // Used by all window classes in the widget creation process. + bool PreCreation( wxWindowGTK *parent, const wxPoint &pos, const wxSize &size ); + void PostCreation(); + + // Internal addition of child windows + void DoAddChild(wxWindowGTK *child); + + // This method sends wxPaintEvents to the window. + // It is also responsible for background erase events. +#ifdef __WXGTK3__ + void GTKSendPaintEvents(cairo_t* cr); +#else + void GTKSendPaintEvents(const GdkRegion* region); +#endif + + // The methods below are required because many native widgets + // are composed of several subwidgets and setting a style for + // the widget means setting it for all subwidgets as well. + // also, it is not clear which native widget is the top + // widget where (most of) the input goes. even tooltips have + // to be applied to all subwidgets. + virtual GtkWidget* GetConnectWidget(); + void ConnectWidget( GtkWidget *widget ); + + // Called from several event handlers, if it returns true or false, the + // same value should be immediately returned by the handler without doing + // anything else. If it returns -1, the handler should continue as usual + int GTKCallbackCommonPrologue(struct _GdkEventAny *event) const; + + // Simplified form of GTKCallbackCommonPrologue() which can be used from + // GTK callbacks without return value to check if the event should be + // ignored: if this returns true, the event shouldn't be handled + bool GTKShouldIgnoreEvent() const; + + + // override this if some events should never be consumed by wxWidgets + // but have to be left for the native control + // + // base version just calls HandleWindowEvent() + virtual bool GTKProcessEvent(wxEvent& event) const; + + // Map GTK widget direction of the given widget to/from wxLayoutDirection + static wxLayoutDirection GTKGetLayout(GtkWidget *widget); + static void GTKSetLayout(GtkWidget *widget, wxLayoutDirection dir); + + // This is called when capture is taken from the window. It will + // fire off capture lost events. + void GTKReleaseMouseAndNotify(); + static void GTKHandleCaptureLost(); + + GdkWindow* GTKGetDrawingWindow() const; + + bool GTKHandleFocusIn(); + virtual bool GTKHandleFocusOut(); + void GTKHandleFocusOutNoDeferring(); + void GTKHandleDeferredFocusOut(); + + // Called when m_widget becomes realized. Derived classes must call the + // base class method if they override it. + virtual void GTKHandleRealized(); + void GTKHandleUnrealize(); + + // Apply the widget style to the given window. Should normally only be + // called from the overridden DoApplyWidgetStyle() implementation in + // another window and exists solely to provide access to protected + // DoApplyWidgetStyle() when it's really needed. + static void GTKDoApplyWidgetStyle(wxWindowGTK* win, GtkRcStyle *style) + { + win->DoApplyWidgetStyle(style); + } + +protected: + // for controls composed of multiple GTK widgets, return true to eliminate + // spurious focus events if the focus changes between GTK+ children within + // the same wxWindow + virtual bool GTKNeedsToFilterSameWindowFocus() const { return false; } + + // Override GTKWidgetNeedsMnemonic and return true if your + // needs to set its mnemonic widget, such as for a + // GtkLabel for wxStaticText, then do the actual + // setting of the widget inside GTKWidgetDoSetMnemonic + virtual bool GTKWidgetNeedsMnemonic() const; + virtual void GTKWidgetDoSetMnemonic(GtkWidget* w); + + // Get the GdkWindows making part of this window: usually there will be + // only one of them in which case it should be returned directly by this + // function. If there is more than one GdkWindow (can be the case for + // composite widgets), return NULL and fill in the provided array + // + // This is not pure virtual for backwards compatibility but almost + // certainly must be overridden in any wxControl-derived class! + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; + + // Check if the given window makes part of this widget + bool GTKIsOwnWindow(GdkWindow *window) const; + +public: + // Returns the default context which usually is anti-aliased + PangoContext *GTKGetPangoDefaultContext(); + +#if wxUSE_TOOLTIPS + // applies tooltip to the widget (tip must be UTF-8 encoded) + virtual void GTKApplyToolTip(const char* tip); +#endif // wxUSE_TOOLTIPS + + // Called when a window should delay showing itself + // until idle time used in Reparent(). + void GTKShowOnIdle() { m_showOnIdle = true; } + + // This is called from the various OnInternalIdle methods + bool GTKShowFromOnIdle(); + + // is this window transparent for the mouse events (as wxStaticBox is)? + virtual bool GTKIsTransparentForMouse() const { return false; } + + // Common scroll event handling code for wxWindow and wxScrollBar + wxEventType GTKGetScrollEventType(GtkRange* range); + + // position and size of the window + int m_x, m_y; + int m_width, m_height; + int m_clientWidth, m_clientHeight; + // Whether the client size variables above are known to be correct + // (because they have been validated by a size-allocate) and should + // be used to report client size + bool m_useCachedClientSize; + // Whether the GtkAllocation and GdkWindow positions are known to be correct + bool m_isGtkPositionValid; + + // see the docs in src/gtk/window.cpp + GtkWidget *m_widget; // mostly the widget seen by the rest of GTK + GtkWidget *m_wxwindow; // mostly the client area as per wxWidgets + + // label for use with GetLabelSetLabel + wxString m_gtkLabel; + + // return true if the window is of a standard (i.e. not wxWidgets') class + bool IsOfStandardClass() const { return m_wxwindow == NULL; } + + // this widget will be queried for GTK's focus events + GtkWidget *m_focusWidget; + + void GTKDisableFocusOutEvent(); + void GTKEnableFocusOutEvent(); + + + // Input method support + + // The IM context used for generic, i.e. non-native, windows. + // + // It might be a good idea to avoid allocating it unless key events from + // this window are really needed but currently we do it unconditionally. + // + // For native widgets (i.e. those for which IsOfStandardClass() returns + // true) it is NULL. + GtkIMContext* m_imContext; + + // Pointer to the event being currently processed by the IME or NULL if not + // inside key handling. + GdkEventKey* m_imKeyEvent; + + // This method generalizes gtk_im_context_filter_keypress(): for the + // generic windows it does just that but it's overridden by the classes + // wrapping native widgets that use IM themselves and so provide specific + // methods for accessing it such gtk_entry_im_context_filter_keypress(). + virtual int GTKIMFilterKeypress(GdkEventKey* event) const; + + // This method must be called from the derived classes "insert-text" signal + // handlers to check if the text is not being inserted by the IM and, if + // this is the case, generate appropriate wxEVT_CHAR events for it. + // + // Returns true if we did generate and process events corresponding to this + // text or false if we didn't handle it. + bool GTKOnInsertText(const char* text); + + // This is just a helper of GTKOnInsertText() which is also used by GTK+ + // "commit" signal handler. + bool GTKDoInsertTextFromIM(const char* text); + + + // indices for the arrays below + enum ScrollDir { ScrollDir_Horz, ScrollDir_Vert, ScrollDir_Max }; + + // horizontal/vertical scroll bar + GtkRange* m_scrollBar[ScrollDir_Max]; + + // horizontal/vertical scroll position + double m_scrollPos[ScrollDir_Max]; + + // return the scroll direction index corresponding to the given orientation + // (which is wxVERTICAL or wxHORIZONTAL) + static ScrollDir ScrollDirFromOrient(int orient) + { + return orient == wxVERTICAL ? ScrollDir_Vert : ScrollDir_Horz; + } + + // return the orientation for the given scrolling direction + static int OrientFromScrollDir(ScrollDir dir) + { + return dir == ScrollDir_Horz ? wxHORIZONTAL : wxVERTICAL; + } + + // find the direction of the given scrollbar (must be one of ours) + ScrollDir ScrollDirFromRange(GtkRange *range) const; + + void GTKUpdateCursor( + bool isBusyOrGlobalCursor = false, + bool isRealize = false, + const wxCursor* overrideCursor = NULL); + + // extra (wxGTK-specific) flags + bool m_noExpose:1; // wxGLCanvas has its own redrawing + bool m_nativeSizeEvent:1; // wxGLCanvas sends wxSizeEvent upon "alloc_size" + bool m_isScrolling:1; // dragging scrollbar thumb? + bool m_clipPaintRegion:1; // true after ScrollWindow() + bool m_dirtyTabOrder:1; // tab order changed, GTK focus + // chain needs update + bool m_mouseButtonDown:1; + bool m_showOnIdle:1; // postpone showing the window until idle + bool m_needCursorReset:1; + + wxRegion m_nativeUpdateRegion; // not transformed for RTL + +protected: + // implement the base class pure virtuals + virtual void DoGetTextExtent(const wxString& string, + int *x, int *y, + int *descent = NULL, + int *externalLeading = NULL, + const wxFont *font = NULL) const wxOVERRIDE; + virtual void DoClientToScreen( int *x, int *y ) const wxOVERRIDE; + virtual void DoScreenToClient( int *x, int *y ) const wxOVERRIDE; + virtual void DoGetPosition( int *x, int *y ) const wxOVERRIDE; + virtual void DoGetSize( int *width, int *height ) const wxOVERRIDE; + virtual void DoGetClientSize( int *width, int *height ) const wxOVERRIDE; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; + virtual void DoSetClientSize(int width, int height) wxOVERRIDE; + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; + virtual void DoEnable(bool enable) wxOVERRIDE; + +#if wxUSE_MENUS_NATIVE + virtual bool DoPopupMenu( wxMenu *menu, int x, int y ) wxOVERRIDE; +#endif // wxUSE_MENUS_NATIVE + + virtual void DoCaptureMouse() wxOVERRIDE; + virtual void DoReleaseMouse() wxOVERRIDE; + + virtual void DoFreeze() wxOVERRIDE; + virtual void DoThaw() wxOVERRIDE; + + void GTKConnectFreezeWidget(GtkWidget* widget); + void GTKFreezeWidget(GtkWidget *w); + void GTKThawWidget(GtkWidget *w); + void GTKDisconnect(void* instance); + +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip( wxToolTip *tip ) wxOVERRIDE; +#endif // wxUSE_TOOLTIPS + + // Create a GtkScrolledWindow containing the given widget (usually + // m_wxwindow but not necessarily) and assigns it to m_widget. Also shows + // the widget passed to it. + // + // Can be only called if we have either wxHSCROLL or wxVSCROLL in our + // style. + void GTKCreateScrolledWindowWith(GtkWidget* view); + + virtual void DoMoveInTabOrder(wxWindow *win, WindowOrder move) wxOVERRIDE; + virtual bool DoNavigateIn(int flags) wxOVERRIDE; + + + // Copies m_children tab order to GTK focus chain: + void RealizeTabOrder(); + +#ifdef __WXGTK3__ + // Use the given CSS string for styling the widget. The provider must be + // allocated, and remains owned, by the caller. + void GTKApplyCssStyle(GtkCssProvider* provider, const char* style); + void GTKApplyCssStyle(const char* style); +#else // GTK+ < 3 + // Called by ApplyWidgetStyle (which is called by SetFont() and + // SetXXXColour etc to apply style changed to native widgets) to create + // modified GTK style with non-standard attributes. + GtkRcStyle* GTKCreateWidgetStyle(); +#endif + + void GTKApplyWidgetStyle(bool forceStyle = false); + + // Helper function to ease native widgets wrapping, called by + // GTKApplyWidgetStyle() and supposed to be overridden, not called. + // + // And if you actually need to call it, e.g. to propagate style change to a + // composite control, use public static GTKDoApplyWidgetStyle(). + virtual void DoApplyWidgetStyle(GtkRcStyle *style); + + void GTKApplyStyle(GtkWidget* widget, GtkRcStyle* style); + + // sets the border of a given GtkScrolledWindow from a wx style + static void GTKScrolledWindowSetBorder(GtkWidget* w, int style); + + // Connect the given function to the specified signal on m_widget. + // + // This is just a wrapper for g_signal_connect() and returns the handler id + // just as it does. + unsigned long GTKConnectWidget(const char *signal, wxGTKCallback callback); + + void ConstrainSize(); + +#ifdef __WXGTK3__ + static GdkWindow* GTKFindWindow(GtkWidget* widget); + static void GTKFindWindow(GtkWidget* widget, wxArrayGdkWindows& windows); + + bool m_needSizeEvent; +#endif + +private: + void Init(); + + // return true if this window must have a non-NULL parent, false if it can + // be created without parent (normally only top level windows but in wxGTK + // there is also the exception of wxMenuBar) + virtual bool GTKNeedsParent() const { return !IsTopLevel(); } + + enum ScrollUnit { ScrollUnit_Line, ScrollUnit_Page, ScrollUnit_Max }; + + // common part of ScrollLines() and ScrollPages() and could be used, in the + // future, for horizontal scrolling as well + // + // return true if we scrolled, false otherwise (on error or simply if we + // are already at the end) + bool DoScrollByUnits(ScrollDir dir, ScrollUnit unit, int units); + virtual void AddChildGTK(wxWindowGTK* child); + +#ifdef __WXGTK3__ + // paint context is stashed here so wxPaintDC can use it + cairo_t* m_paintContext; + // style provider for "background-image" + GtkStyleProvider* m_styleProvider; + +public: + cairo_t* GTKPaintContext() const + { + return m_paintContext; + } + void GTKSizeRevalidate(); + void GTKSendSizeEventIfNeeded(); +#endif + + wxDECLARE_DYNAMIC_CLASS(wxWindowGTK); + wxDECLARE_NO_COPY_CLASS(wxWindowGTK); +}; + +#endif // _WX_GTK_WINDOW_H_ diff --git a/lib/wxWidgets/include/wx/gtk1/accel.h b/lib/wxWidgets/include/wx/gtk1/accel.h new file mode 100644 index 0000000..36f153e --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/accel.h @@ -0,0 +1,14 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/accel.h +// Purpose: wxAcceleratorTable redirection file +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// VZ: keeping the old file just in case we're going to have a native GTK+ +// wxAcceleratorTable implementation one day, but for now use the generic +// version +#include "wx/generic/accel.h" diff --git a/lib/wxWidgets/include/wx/gtk1/app.h b/lib/wxWidgets/include/wx/gtk1/app.h new file mode 100644 index 0000000..0542f67 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/app.h @@ -0,0 +1,77 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/app.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling, Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKAPPH__ +#define __GTKAPPH__ + +#include "wx/frame.h" +#include "wx/icon.h" +#include "wx/strconv.h" + +typedef struct _GdkVisual GdkVisual; + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxApp; +class WXDLLIMPEXP_FWD_BASE wxLog; + +//----------------------------------------------------------------------------- +// wxApp +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxApp: public wxAppBase +{ +public: + wxApp(); + virtual ~wxApp(); + + /* override for altering the way wxGTK initializes the GUI + * (palette/visual/colorcube). under wxMSW, OnInitGui() does nothing by + * default. when overriding this method, the code in it is likely to be + * platform dependent, otherwise use OnInit(). */ + virtual bool OnInitGui(); + + // override base class (pure) virtuals + virtual void WakeUpIdle(); + + virtual bool Initialize(int& argc, wxChar **argv); + virtual void CleanUp(); + + static bool InitialzeVisual(); + + virtual void OnAssertFailure(const wxChar *file, + int line, + const wxChar *func, + const wxChar *cond, + const wxChar *msg); + + bool IsInAssert() const { return m_isInAssert; } + + int m_idleTag; + void RemoveIdleTag(); + + unsigned char *m_colorCube; + + // Used by the wxGLApp and wxGLCanvas class for GL-based X visual + // selection. + void *m_glVisualInfo; // this is actually an XVisualInfo* + void *m_glFBCInfo; // this is actually an GLXFBConfig* + // This returns the current visual: either that used by wxRootWindow + // or the XVisualInfo* for SGI. + GdkVisual *GetGdkVisual(); + +private: + // true if we're inside an assert modal dialog + bool m_isInAssert; + + wxDECLARE_DYNAMIC_CLASS(wxApp); +}; + +#endif // __GTKAPPH__ diff --git a/lib/wxWidgets/include/wx/gtk1/bitmap.h b/lib/wxWidgets/include/wx/gtk1/bitmap.h new file mode 100644 index 0000000..f8b1d14 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/bitmap.h @@ -0,0 +1,147 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/bitmap.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKBITMAPH__ +#define __GTKBITMAPH__ + +#include "wx/palette.h" +#include "wx/gdiobj.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxMask; +class WXDLLIMPEXP_FWD_CORE wxBitmap; +class WXDLLIMPEXP_FWD_CORE wxImage; +class WXDLLIMPEXP_FWD_CORE wxCursor; + +//----------------------------------------------------------------------------- +// wxMask +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMask: public wxObject +{ +public: + wxMask(); + wxMask( const wxBitmap& bitmap, const wxColour& colour ); +#if wxUSE_PALETTE + wxMask( const wxBitmap& bitmap, int paletteIndex ); +#endif // wxUSE_PALETTE + wxMask( const wxBitmap& bitmap ); + virtual ~wxMask(); + + bool Create( const wxBitmap& bitmap, const wxColour& colour ); +#if wxUSE_PALETTE + bool Create( const wxBitmap& bitmap, int paletteIndex ); +#endif // wxUSE_PALETTE + bool Create( const wxBitmap& bitmap ); + + // implementation + GdkBitmap *m_bitmap; + int m_width; + int m_height; + + wxBitmap GetBitmap() const; + +private: + wxDECLARE_DYNAMIC_CLASS(wxMask); +}; + +//----------------------------------------------------------------------------- +// wxBitmap +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase +{ +public: + wxBitmap() {} + wxBitmap( int width, int height, int depth = -1 ) { Create( width, height, depth ); } + wxBitmap( const wxSize& sz, int depth = -1 ) { Create( sz, depth ); } + wxBitmap( int width, int height, const wxDC& dc ) { Create(width, height, dc); } + wxBitmap( const char bits[], int width, int height, int depth = 1 ); + wxBitmap( const char* const* bits ); + wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE ); + wxBitmap( const wxImage& image, int depth = -1, double WXUNUSED(scale) = 1.0 ) { (void)CreateFromImage(image, depth); } + wxBitmap( const wxImage& image, const wxDC& WXUNUSED(dc) ) { (void)CreateFromImage(image, -1); } + explicit wxBitmap(const wxCursor& cursor); + virtual ~wxBitmap(); + + bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); + bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) + { return Create(sz.GetWidth(), sz.GetHeight(), depth); } + bool Create(int width, int height, const wxDC& WXUNUSED(dc)) + { return Create(width,height); } + + virtual int GetHeight() const; + virtual int GetWidth() const; + virtual int GetDepth() const; + + wxImage ConvertToImage() const; + + wxMask *GetMask() const; + void SetMask( wxMask *mask ); + + wxBitmap GetSubBitmap( const wxRect& rect ) const; + + bool SaveFile(const wxString &name, wxBitmapType type, + const wxPalette *palette = NULL) const; + bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); + +#if wxUSE_PALETTE + wxPalette *GetPalette() const; + void SetPalette(const wxPalette& palette); + wxPalette *GetColourMap() const { return GetPalette(); } +#endif // wxUSE_PALETTE + + static void InitStandardHandlers(); + + // implementation + // -------------- + + void SetHeight( int height ); + void SetWidth( int width ); + void SetDepth( int depth ); + void SetPixmap( GdkPixmap *pixmap ); + void SetBitmap( GdkBitmap *bitmap ); + + GdkPixmap *GetPixmap() const; + GdkBitmap *GetBitmap() const; + bool HasPixmap() const; + + // Basically, this corresponds to Win32 StretchBlt() + wxBitmap Rescale( int clipx, int clipy, int clipwidth, int clipheight, int width, int height ); + // OpenVMS needs the next statement to detect Rescale in an inherited class + using wxBitmapHelpers::Rescale; + + // raw bitmap access support functions + void *GetRawData(wxPixelDataBase& data, int bpp); + void UngetRawData(wxPixelDataBase& data); + + bool HasAlpha() const; + +protected: + bool CreateFromImage(const wxImage& image, int depth); + + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + +private: + // to be called from CreateFromImage only! + bool CreateFromImageAsBitmap(const wxImage& image); + bool CreateFromImageAsPixmap(const wxImage& image); + + friend class wxBitmapHandler; + +private: + wxDECLARE_DYNAMIC_CLASS(wxBitmap); +}; + + +#endif // __GTKBITMAPH__ diff --git a/lib/wxWidgets/include/wx/gtk1/bmpbuttn.h b/lib/wxWidgets/include/wx/gtk1/bmpbuttn.h new file mode 100644 index 0000000..9700224 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/bmpbuttn.h @@ -0,0 +1,76 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/bmpbutton.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __BMPBUTTONH__ +#define __BMPBUTTONH__ + +// ---------------------------------------------------------------------------- +// wxBitmapButton +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBitmapButton: public wxBitmapButtonBase +{ +public: + wxBitmapButton() { Init(); } + + wxBitmapButton(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)) + { + Init(); + + Create(parent, id, bitmap, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)); + + bool CreateCloseButton(wxWindow* parent, + wxWindowID winid, + const wxString& name = wxString()); + + void SetLabel( const wxString &label ); + virtual void SetLabel( const wxBitmapBundle& bitmap ) { SetBitmapLabel(bitmap); } + + virtual bool Enable(bool enable = TRUE); + + // implementation + // -------------- + + void GTKSetHasFocus(); + void GTKSetNotFocus(); + void StartSelect(); + void EndSelect(); + void DoApplyWidgetStyle(GtkRcStyle *style); + + bool m_hasFocus:1; + bool m_isSelected:1; + +protected: + virtual void OnSetBitmap(); + virtual wxSize DoGetBestSize() const; + + void Init(); + +private: + wxDECLARE_DYNAMIC_CLASS(wxBitmapButton); +}; + +#endif // __BMPBUTTONH__ diff --git a/lib/wxWidgets/include/wx/gtk1/brush.h b/lib/wxWidgets/include/wx/gtk1/brush.h new file mode 100644 index 0000000..2c6acb0 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/brush.h @@ -0,0 +1,64 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/brush.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKBRUSHH__ +#define __GTKBRUSHH__ + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/string.h" +#include "wx/gdiobj.h" +#include "wx/bitmap.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxBrush; + +//----------------------------------------------------------------------------- +// wxBrush +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBrush: public wxBrushBase +{ +public: + wxBrush() { } + + wxBrush( const wxColour &colour, wxBrushStyle style = wxBRUSHSTYLE_SOLID ); + wxBrush( const wxBitmap &stippleBitmap ); + virtual ~wxBrush(); + + bool operator==(const wxBrush& brush) const; + bool operator!=(const wxBrush& brush) const { return !(*this == brush); } + + wxBrushStyle GetStyle() const; + wxColour GetColour() const; + wxBitmap *GetStipple() const; + + void SetColour( const wxColour& col ); + void SetColour( unsigned char r, unsigned char g, unsigned char b ); + void SetStyle( wxBrushStyle style ); + void SetStipple( const wxBitmap& stipple ); + + + wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants") + wxBrush(const wxColour& col, int style); + + wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants") + void SetStyle(int style) { SetStyle((wxBrushStyle)style); } + +private: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + + wxDECLARE_DYNAMIC_CLASS(wxBrush); +}; + +#endif // __GTKBRUSHH__ diff --git a/lib/wxWidgets/include/wx/gtk1/button.h b/lib/wxWidgets/include/wx/gtk1/button.h new file mode 100644 index 0000000..fb7162e --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/button.h @@ -0,0 +1,67 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/button.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKBUTTONH__ +#define __GTKBUTTONH__ + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/list.h" + +//----------------------------------------------------------------------------- +// wxButton +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxButton: public wxButtonBase +{ +public: + wxButton(); + wxButton(wxWindow *parent, wxWindowID id, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + virtual ~wxButton(); + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)); + + virtual wxWindow *SetDefault(); + virtual void SetLabel( const wxString &label ); + virtual bool Enable( bool enable = TRUE ); + + // implementation + // -------------- + + void DoApplyWidgetStyle(GtkRcStyle *style); + bool IsOwnGtkWindow( GdkWindow *window ); + + // Since this wxButton doesn't derive from wxButtonBase (why?) we need + // to override this here too... + virtual bool ShouldInheritColours() const { return false; } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + +protected: + virtual wxSize DoGetBestSize() const; + +private: + wxDECLARE_DYNAMIC_CLASS(wxButton); +}; + +#endif // __GTKBUTTONH__ diff --git a/lib/wxWidgets/include/wx/gtk1/checkbox.h b/lib/wxWidgets/include/wx/gtk1/checkbox.h new file mode 100644 index 0000000..d0bba62 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/checkbox.h @@ -0,0 +1,65 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/checkbox.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKCHECKBOXH__ +#define __GTKCHECKBOXH__ + +// ---------------------------------------------------------------------------- +// wxCheckBox +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxCheckBox : public wxCheckBoxBase +{ +public: + wxCheckBox(); + wxCheckBox( wxWindow *parent, wxWindowID id, const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)) + { + Create(parent, id, label, pos, size, style, validator, name); + } + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr) ); + + void SetValue( bool state ); + bool GetValue() const; + + virtual void SetLabel( const wxString& label ); + virtual bool Enable( bool enable = TRUE ); + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // implementation + // -------------- + + void DoApplyWidgetStyle(GtkRcStyle *style); + bool IsOwnGtkWindow( GdkWindow *window ); + void OnInternalIdle(); + + GtkWidget *m_widgetCheckbox; + GtkWidget *m_widgetLabel; + + bool m_blockEvent; + +protected: + virtual wxSize DoGetBestSize() const; + +private: + wxDECLARE_DYNAMIC_CLASS(wxCheckBox); +}; + +#endif // __GTKCHECKBOXH__ diff --git a/lib/wxWidgets/include/wx/gtk1/checklst.h b/lib/wxWidgets/include/wx/gtk1/checklst.h new file mode 100644 index 0000000..de5f538 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/checklst.h @@ -0,0 +1,59 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/checklst.h +// Purpose: wxCheckListBox class +// Author: Robert Roebling +// Modified by: +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKCHECKLISTH__ +#define __GTKCHECKLISTH__ + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +// there is no "right" choice of the checkbox indicators, so allow the user to +// define them himself if he wants +#ifndef wxCHECKLBOX_CHECKED + #define wxCHECKLBOX_CHECKED wxT('x') + #define wxCHECKLBOX_UNCHECKED wxT(' ') + + #define wxCHECKLBOX_STRING wxT("[ ] ") +#endif + +//----------------------------------------------------------------------------- +// wxCheckListBox +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxCheckListBox : public wxCheckListBoxBase +{ +public: + wxCheckListBox(); + wxCheckListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int nStrings = 0, + const wxString *choices = (const wxString *)NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + wxCheckListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + + bool IsChecked(unsigned int index) const; + void Check(unsigned int index, bool check = true); + + int GetItemHeight() const; + +private: + wxDECLARE_DYNAMIC_CLASS(wxCheckListBox); +}; + +#endif //__GTKCHECKLISTH__ diff --git a/lib/wxWidgets/include/wx/gtk1/choice.h b/lib/wxWidgets/include/wx/gtk1/choice.h new file mode 100644 index 0000000..5703e3e --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/choice.h @@ -0,0 +1,111 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/choice.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKCHOICEH__ +#define __GTKCHOICEH__ + +class WXDLLIMPEXP_FWD_BASE wxSortedArrayString; +class WXDLLIMPEXP_FWD_BASE wxArrayString; + +//----------------------------------------------------------------------------- +// wxChoice +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxChoice : public wxChoiceBase +{ +public: + wxChoice(); + wxChoice( wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = (const wxString *) NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr) ) + { + m_strings = NULL; + + Create(parent, id, pos, size, n, choices, style, validator, name); + } + wxChoice( wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr) ) + { + m_strings = NULL; + + Create(parent, id, pos, size, choices, style, validator, name); + } + virtual ~wxChoice(); + bool Create( wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr) ); + bool Create( wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr) ); + + // implement base class pure virtuals + void DoDeleteOneItem(unsigned int n); + void DoClear(); + + int GetSelection() const; + virtual void SetSelection(int n); + + virtual unsigned int GetCount() const; + virtual int FindString(const wxString& s, bool bCase = false) const; + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& string); + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + +protected: + wxList m_clientList; // contains the client data for the items + + void DoApplyWidgetStyle(GtkRcStyle *style); + virtual int DoInsertItems(const wxArrayStringsAdapter& items, + unsigned int pos, + void **clientData, wxClientDataType type); + + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + + virtual wxSize DoGetBestSize() const; + + virtual bool IsOwnGtkWindow( GdkWindow *window ); + +private: + // DoInsertItems() helper + int GtkAddHelper(GtkWidget *menu, unsigned int pos, const wxString& item); + + // this array is only used for controls with wxCB_SORT style, so only + // allocate it if it's needed (hence using pointer) + wxSortedArrayString *m_strings; + +public: + // this circumvents a GTK+ 2.0 bug so that the selection is + // invalidated properly + int m_selection_hack; + +private: + wxDECLARE_DYNAMIC_CLASS(wxChoice); +}; + + +#endif // __GTKCHOICEH__ diff --git a/lib/wxWidgets/include/wx/gtk1/clipbrd.h b/lib/wxWidgets/include/wx/gtk1/clipbrd.h new file mode 100644 index 0000000..694e6ad --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/clipbrd.h @@ -0,0 +1,77 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/clipbrd.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKCLIPBOARDH__ +#define __GTKCLIPBOARDH__ + +#if wxUSE_CLIPBOARD + +#include "wx/object.h" +#include "wx/list.h" +#include "wx/dataobj.h" +#include "wx/control.h" +#include "wx/module.h" + +// ---------------------------------------------------------------------------- +// wxClipboard +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxClipboard : public wxClipboardBase +{ +public: + wxClipboard(); + virtual ~wxClipboard(); + + // open the clipboard before SetData() and GetData() + virtual bool Open(); + + // close the clipboard after SetData() and GetData() + virtual void Close(); + + // query whether the clipboard is opened + virtual bool IsOpened() const; + + // set the clipboard data. all other formats will be deleted. + virtual bool SetData( wxDataObject *data ); + + // add to the clipboard data. + virtual bool AddData( wxDataObject *data ); + + // ask if data in correct format is available + virtual bool IsSupported( const wxDataFormat& format ); + + // fill data with data on the clipboard (if available) + virtual bool GetData( wxDataObject& data ); + + // clears wxTheClipboard and the system's clipboard if possible + virtual void Clear(); + + // implementation from now on + bool m_open; + bool m_ownsClipboard; + bool m_ownsPrimarySelection; + wxDataObject *m_data; + + GtkWidget *m_clipboardWidget; /* for getting and offering data */ + GtkWidget *m_targetsWidget; /* for getting list of supported formats */ + bool m_waiting; /* querying data or formats is asynchronous */ + + bool m_formatSupported; + GdkAtom m_targetRequested; + wxDataObject *m_receivedData; + +private: + wxDECLARE_DYNAMIC_CLASS(wxClipboard); +}; + +#endif + // wxUSE_CLIPBOARD + +#endif + // __GTKCLIPBOARDH__ diff --git a/lib/wxWidgets/include/wx/gtk1/colordlg.h b/lib/wxWidgets/include/wx/gtk1/colordlg.h new file mode 100644 index 0000000..87d48fc --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/colordlg.h @@ -0,0 +1,51 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/colordlg.h +// Purpose: wxColourDialog +// Author: Vaclav Slavik +// Modified by: +// Created: 2004/06/04 +// Copyright: (c) Vaclav Slavik, 2004 +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __COLORDLG_H__ +#define __COLORDLG_H__ + +#include "wx/defs.h" +#include "wx/gdicmn.h" +#include "wx/dialog.h" + + +class WXDLLIMPEXP_CORE wxColourDialog : public wxDialog +{ +public: + wxColourDialog() {} + wxColourDialog(wxWindow *parent, + wxColourData *data = NULL); + virtual ~wxColourDialog() {} + + bool Create(wxWindow *parent, wxColourData *data = NULL); + + wxColourData &GetColourData() { return m_data; } + + virtual int ShowModal(); + +protected: + // implement some base class methods to do nothing to avoid asserts and + // GTK warnings, since this is not a real wxDialog. + virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y), + int WXUNUSED(width), int WXUNUSED(height), + int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {} + virtual void DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), + int WXUNUSED(width), int WXUNUSED(height)) {} + + // copy data between the dialog and m_colourData: + void ColourDataToDialog(); + void DialogToColourData(); + + wxColourData m_data; + + wxDECLARE_DYNAMIC_CLASS(wxColourDialog); +}; + +#endif diff --git a/lib/wxWidgets/include/wx/gtk1/colour.h b/lib/wxWidgets/include/wx/gtk1/colour.h new file mode 100644 index 0000000..b6deeea --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/colour.h @@ -0,0 +1,69 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/colour.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKCOLOURH__ +#define __GTKCOLOURH__ + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/string.h" +#include "wx/gdiobj.h" +#include "wx/palette.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxDC; +class WXDLLIMPEXP_FWD_CORE wxPaintDC; +class WXDLLIMPEXP_FWD_CORE wxBitmap; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +class WXDLLIMPEXP_FWD_CORE wxColour; + +//----------------------------------------------------------------------------- +// wxColour +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxColour : public wxColourBase +{ +public: + // constructors + // ------------ + DEFINE_STD_WXCOLOUR_CONSTRUCTORS + + virtual ~wxColour(); + + virtual bool FromString(const wxString& str); + + bool operator==(const wxColour& col) const; + bool operator!=(const wxColour& col) const { return !(*this == col); } + + unsigned char Red() const; + unsigned char Green() const; + unsigned char Blue() const; + + + // Implementation part + void CalcPixel( GdkColormap *cmap ); + int GetPixel() const; + GdkColor *GetColor() const; + +protected: + // ref counting code + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + + virtual void + InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a); + +private: + wxDECLARE_DYNAMIC_CLASS(wxColour); +}; + +#endif // __GTKCOLOURH__ diff --git a/lib/wxWidgets/include/wx/gtk1/combobox.h b/lib/wxWidgets/include/wx/gtk1/combobox.h new file mode 100644 index 0000000..0008c2c --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/combobox.h @@ -0,0 +1,189 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/combobox.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKCOMBOBOXH__ +#define __GTKCOMBOBOXH__ + +#include "wx/defs.h" + +#if wxUSE_COMBOBOX + +#include "wx/object.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxComboBox; + +//----------------------------------------------------------------------------- +// global data +//----------------------------------------------------------------------------- + +extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[]; +extern WXDLLIMPEXP_BASE const wxChar* wxEmptyString; + +//----------------------------------------------------------------------------- +// wxComboBox +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxComboBox : + public wxWindowWithItems +{ +public: + inline wxComboBox() {} + inline wxComboBox(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = (const wxString *) NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)) + { + Create(parent, id, value, pos, size, n, choices, style, validator, name); + } + inline wxComboBox(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)) + { + Create(parent, id, value, pos, size, choices, style, validator, name); + } + + virtual ~wxComboBox(); + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = (const wxString *) NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)); + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)); + + void DoClear(); + void DoDeleteOneItem(unsigned int n); + + virtual int FindString(const wxString& s, bool bCase = false) const; + int GetSelection() const; + int GetCurrentSelection() const; + virtual wxString GetString(unsigned int n) const; + wxString GetStringSelection() const; + virtual unsigned int GetCount() const; + virtual void SetSelection(int n); + virtual void SetString(unsigned int n, const wxString &text); + + wxString GetValue() const { return DoGetValue(); } + void SetValue(const wxString& value); + void WriteText(const wxString& value); + + void Copy(); + void Cut(); + void Paste(); + bool CanCopy() const; + bool CanCut() const; + bool CanPaste() const; + void SetInsertionPoint( long pos ); + void SetInsertionPointEnd() { SetInsertionPoint( -1 ); } + long GetInsertionPoint() const; + virtual wxTextPos GetLastPosition() const; + void Remove(long from, long to) { Replace(from, to, wxEmptyString); } + void Replace( long from, long to, const wxString& value ); + void SetSelection( long from, long to ); + void GetSelection( long* from, long* to ) const; + void SetEditable( bool editable ); + void Undo() ; + void Redo() ; + bool CanUndo() const; + bool CanRedo() const; + void SelectAll(); + bool IsEditable() const ; + bool HasSelection() const ; + + // implementation + + virtual void SetFocus(); + + void OnSize( wxSizeEvent &event ); + void OnChar( wxKeyEvent &event ); + + // Standard event handling + void OnCut(wxCommandEvent& event); + void OnCopy(wxCommandEvent& event); + void OnPaste(wxCommandEvent& event); + void OnUndo(wxCommandEvent& event); + void OnRedo(wxCommandEvent& event); + void OnDelete(wxCommandEvent& event); + void OnSelectAll(wxCommandEvent& event); + + void OnUpdateCut(wxUpdateUIEvent& event); + void OnUpdateCopy(wxUpdateUIEvent& event); + void OnUpdatePaste(wxUpdateUIEvent& event); + void OnUpdateUndo(wxUpdateUIEvent& event); + void OnUpdateRedo(wxUpdateUIEvent& event); + void OnUpdateDelete(wxUpdateUIEvent& event); + void OnUpdateSelectAll(wxUpdateUIEvent& event); + + bool m_ignoreNextUpdate:1; + wxList m_clientDataList; + wxList m_clientObjectList; + int m_prevSelection; + + void DisableEvents(); + void EnableEvents(); + GtkWidget* GetConnectWidget(); + bool IsOwnGtkWindow( GdkWindow *window ); + void DoApplyWidgetStyle(GtkRcStyle *style); + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + virtual const wxTextEntry* WXGetTextEntry() const { return this; } + +protected: + virtual int DoInsertItems(const wxArrayStringsAdapter& items, + unsigned int pos, + void **clientData, wxClientDataType type); + + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + + virtual wxSize DoGetBestSize() const; + + // implement wxTextEntry pure virtual methods + virtual wxString DoGetValue() const; + virtual wxWindow *GetEditableWindow() { return this; } + + // Widgets that use the style->base colour for the BG colour should + // override this and return true. + virtual bool UseGTKStyleBase() const { return true; } + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox); + wxDECLARE_EVENT_TABLE(); +}; + +#endif + +#endif + + // __GTKCOMBOBOXH__ diff --git a/lib/wxWidgets/include/wx/gtk1/control.h b/lib/wxWidgets/include/wx/gtk1/control.h new file mode 100644 index 0000000..1cf85a2 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/control.h @@ -0,0 +1,104 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/control.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling, Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKCONTROLH__ +#define __GTKCONTROLH__ + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/list.h" +#include "wx/window.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxControl; + +typedef struct _GtkLabel GtkLabel; +typedef struct _GtkFrame GtkFrame; + +//----------------------------------------------------------------------------- +// wxControl +//----------------------------------------------------------------------------- + +// C-linkage function pointer types for GetDefaultAttributesFromGTKWidget +extern "C" { + typedef GtkWidget* (*wxGtkWidgetNew_t)(void); + typedef GtkWidget* (*wxGtkWidgetNewFromStr_t)(const char*); + typedef GtkWidget* (*wxGtkWidgetNewFromAdj_t)(GtkAdjustment*); +} + +class WXDLLIMPEXP_CORE wxControl : public wxControlBase +{ +public: + wxControl(); + wxControl(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxControlNameStr)) + { + Create(parent, id, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxControlNameStr)); + + virtual void SetLabel( const wxString &label ); + virtual wxString GetLabel() const; + + virtual wxVisualAttributes GetDefaultAttributes() const; + +protected: + virtual wxSize DoGetBestSize() const; + void PostCreation(const wxSize& size); + + // sets the label to the given string and also sets it for the given widget + void GTKSetLabelForLabel(GtkLabel *w, const wxString& label); + + // as GTKSetLabelForLabel() but for a GtkFrame widget + void GTKSetLabelForFrame(GtkFrame *w, const wxString& label); + + // remove mnemonics ("&"s) from the label + static wxString GTKRemoveMnemonics(const wxString& label); + + // These are used by GetDefaultAttributes + static wxVisualAttributes + GetDefaultAttributesFromGTKWidget(GtkWidget* widget, + bool useBase = false, + int state = -1); + static wxVisualAttributes + GetDefaultAttributesFromGTKWidget(wxGtkWidgetNew_t, + bool useBase = false, + int state = -1); + static wxVisualAttributes + GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromStr_t, + bool useBase = false, + int state = -1); + + static wxVisualAttributes + GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromAdj_t, + bool useBase = false, + int state = -1); + + // Widgets that use the style->base colour for the BG colour should + // override this and return true. + virtual bool UseGTKStyleBase() const { return false; } + + // this field contains the label in wx format, i.e. with "&" mnemonics + wxString m_label; + +private: + wxDECLARE_DYNAMIC_CLASS(wxControl); +}; + +#endif // __GTKCONTROLH__ diff --git a/lib/wxWidgets/include/wx/gtk1/cursor.h b/lib/wxWidgets/include/wx/gtk1/cursor.h new file mode 100644 index 0000000..b1632ec --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/cursor.h @@ -0,0 +1,61 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/cursor.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKCURSORH__ +#define __GTKCURSORH__ + +#include "wx/gdicmn.h" + +#if wxUSE_IMAGE +#include "wx/image.h" +#endif + +//----------------------------------------------------------------------------- +// wxCursor +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxCursor : public wxCursorBase +{ +public: + wxCursor(); + wxCursor(wxStockCursor id) { InitFromStock(id); } +#if WXWIN_COMPATIBILITY_2_8 + wxCursor(int id) { InitFromStock((wxStockCursor)id); } +#endif +#if wxUSE_IMAGE + wxCursor( const wxImage & image ); + wxCursor(const char* const* xpmData); +#endif + wxCursor(const wxString& name, + wxBitmapType type = wxCURSOR_DEFAULT_TYPE, + int hotSpotX = 0, int hotSpotY = 0); + wxCursor( const char bits[], int width, int height, + int hotSpotX=-1, int hotSpotY=-1, + const char maskBits[] = NULL, + const wxColour* fg = NULL, const wxColour* bg = NULL); + + virtual ~wxCursor(); + + // implementation + + GdkCursor *GetCursor() const; + +protected: + void InitFromStock(wxStockCursor); +#if wxUSE_IMAGE + void InitFromImage(const wxImage& image); +#endif + + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + +private: + wxDECLARE_DYNAMIC_CLASS(wxCursor); +}; + +#endif // __GTKCURSORH__ diff --git a/lib/wxWidgets/include/wx/gtk1/dataform.h b/lib/wxWidgets/include/wx/gtk1/dataform.h new file mode 100644 index 0000000..bfdab5e --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/dataform.h @@ -0,0 +1,74 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/dataform.h +// Purpose: declaration of the wxDataFormat class +// Author: Vadim Zeitlin +// Modified by: +// Created: 19.10.99 (extracted from gtk/dataobj.h) +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_DATAFORM_H +#define _WX_GTK_DATAFORM_H + +class WXDLLIMPEXP_CORE wxDataFormat +{ +public: + // the clipboard formats under GDK are GdkAtoms + typedef GdkAtom NativeFormat; + + wxDataFormat(); + wxDataFormat( wxDataFormatId type ); + wxDataFormat( NativeFormat format ); + + // we have to provide all the overloads to allow using strings instead of + // data formats (as a lot of existing code does) + wxDataFormat( const wxString& id ) { InitFromString(id); } + wxDataFormat( const char *id ) { InitFromString(id); } + wxDataFormat( const wchar_t *id ) { InitFromString(id); } + wxDataFormat( const wxCStrData& id ) { InitFromString(id); } + + + wxDataFormat& operator=(const wxDataFormat& format) + { m_type = format.m_type; m_format = format.m_format; return *this; } + wxDataFormat& operator=(NativeFormat format) + { SetId(format); return *this; } + + // comparison (must have both versions) + bool operator==(NativeFormat format) const + { return m_format == (NativeFormat)format; } + bool operator!=(NativeFormat format) const + { return m_format != (NativeFormat)format; } + bool operator==(wxDataFormatId format) const + { return m_type == (wxDataFormatId)format; } + bool operator!=(wxDataFormatId format) const + { return m_type != (wxDataFormatId)format; } + + // explicit and implicit conversions to NativeFormat which is one of + // standard data types (implicit conversion is useful for preserving the + // compatibility with old code) + NativeFormat GetFormatId() const { return m_format; } + operator NativeFormat() const { return m_format; } + + void SetId( NativeFormat format ); + + // string ids are used for custom types - this SetId() must be used for + // application-specific formats + wxString GetId() const; + void SetId( const wxString& id ); + + // implementation + wxDataFormatId GetType() const; + void SetType( wxDataFormatId type ); + +private: + // common part of ctors from format name + void InitFromString(const wxString& id); + + wxDataFormatId m_type; + NativeFormat m_format; + + void PrepareFormats(); +}; + +#endif // _WX_GTK_DATAFORM_H diff --git a/lib/wxWidgets/include/wx/gtk1/dataobj.h b/lib/wxWidgets/include/wx/gtk1/dataobj.h new file mode 100644 index 0000000..16bfe64 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/dataobj.h @@ -0,0 +1,26 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/dataobj.h +// Purpose: declaration of the wxDataObject +// Author: Robert Roebling +// Copyright: (c) 1998, 1999 Vadim Zeitlin, Robert Roebling +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_DATAOBJ_H_ +#define _WX_GTK_DATAOBJ_H_ + +// ---------------------------------------------------------------------------- +// wxDataObject is the same as wxDataObjectBase under wxGTK +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataObject : public wxDataObjectBase +{ +public: + wxDataObject(); + virtual ~wxDataObject(); + + virtual bool IsSupportedFormat( const wxDataFormat& format, Direction dir = Get ) const; +}; + +#endif // _WX_GTK_DATAOBJ_H_ + diff --git a/lib/wxWidgets/include/wx/gtk1/dataobj2.h b/lib/wxWidgets/include/wx/gtk1/dataobj2.h new file mode 100644 index 0000000..447fd4f --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/dataobj2.h @@ -0,0 +1,84 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/dataobj2.h +// Purpose: declaration of standard wxDataObjectSimple-derived classes +// Author: Robert Roebling +// Created: 19.10.99 (extracted from gtk/dataobj.h) +// Copyright: (c) 1998, 1999 Vadim Zeitlin, Robert Roebling +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_DATAOBJ2_H_ +#define _WX_GTK_DATAOBJ2_H_ + +// ---------------------------------------------------------------------------- +// wxBitmapDataObject is a specialization of wxDataObject for bitmaps +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBitmapDataObject : public wxBitmapDataObjectBase +{ +public: + // ctors + wxBitmapDataObject(); + wxBitmapDataObject(const wxBitmap& bitmap); + + // destr + virtual ~wxBitmapDataObject(); + + // override base class virtual to update PNG data too + virtual void SetBitmap(const wxBitmap& bitmap); + + // implement base class pure virtuals + // ---------------------------------- + + virtual size_t GetDataSize() const { return m_pngSize; } + virtual bool GetDataHere(void *buf) const; + virtual bool SetData(size_t len, const void *buf); + +protected: + void Init() { m_pngData = NULL; m_pngSize = 0; } + void Clear() { free(m_pngData); } + void ClearAll() { Clear(); Init(); } + + size_t m_pngSize; + void *m_pngData; + + void DoConvertToPng(); + +private: + // virtual function hiding suppression + size_t GetDataSize(const wxDataFormat& format) const + { return(wxDataObjectSimple::GetDataSize(format)); } + bool GetDataHere(const wxDataFormat& format, void* pBuf) const + { return(wxDataObjectSimple::GetDataHere(format, pBuf)); } + bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf) + { return(wxDataObjectSimple::SetData(format, nLen, pBuf)); } +}; + +// ---------------------------------------------------------------------------- +// wxFileDataObject is a specialization of wxDataObject for file names +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFileDataObject : public wxFileDataObjectBase +{ +public: + // implement base class pure virtuals + // ---------------------------------- + + void AddFile( const wxString &filename ); + + virtual size_t GetDataSize() const; + virtual bool GetDataHere(void *buf) const; + virtual bool SetData(size_t len, const void *buf); + +private: + // virtual function hiding suppression + size_t GetDataSize(const wxDataFormat& format) const + { return(wxDataObjectSimple::GetDataSize(format)); } + bool GetDataHere(const wxDataFormat& format, void* pBuf) const + { return(wxDataObjectSimple::GetDataHere(format, pBuf)); } + bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf) + { return(wxDataObjectSimple::SetData(format, nLen, pBuf)); } +}; + +#endif // _WX_GTK_DATAOBJ2_H_ + diff --git a/lib/wxWidgets/include/wx/gtk1/dc.h b/lib/wxWidgets/include/wx/gtk1/dc.h new file mode 100644 index 0000000..3f90757 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/dc.h @@ -0,0 +1,64 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/dc.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKDCH__ +#define __GTKDCH__ + +#include "wx/dc.h" + +//----------------------------------------------------------------------------- +// wxDC +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGTKDCImpl : public wxDCImpl +{ +public: + wxGTKDCImpl(wxDC *owner); + virtual ~wxGTKDCImpl() { } + +#if wxUSE_PALETTE + void SetColourMap( const wxPalette& palette ) { SetPalette(palette); } +#endif // wxUSE_PALETTE + + // Resolution in pixels per logical inch + virtual wxSize GetPPI() const; + + virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return true; } + virtual void EndDoc() { } + virtual void StartPage() { } + virtual void EndPage() { } + + virtual GdkWindow* GetGDKWindow() const { return NULL; } + +public: + // implementation + wxCoord XDEV2LOG(wxCoord x) const { return DeviceToLogicalX(x); } + wxCoord XDEV2LOGREL(wxCoord x) const { return DeviceToLogicalXRel(x); } + wxCoord YDEV2LOG(wxCoord y) const { return DeviceToLogicalY(y); } + wxCoord YDEV2LOGREL(wxCoord y) const { return DeviceToLogicalYRel(y); } + wxCoord XLOG2DEV(wxCoord x) const { return LogicalToDeviceX(x); } + wxCoord XLOG2DEVREL(wxCoord x) const { return LogicalToDeviceXRel(x); } + wxCoord YLOG2DEV(wxCoord y) const { return LogicalToDeviceY(y); } + wxCoord YLOG2DEVREL(wxCoord y) const { return LogicalToDeviceYRel(y); } + + // base class pure virtuals implemented here + virtual void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + virtual void DoGetSizeMM(int* width, int* height) const; + +private: + wxDECLARE_ABSTRACT_CLASS(wxDC); +}; + +// this must be defined when wxDC::Blit() honours the DC origin and needed to +// allow wxUniv code in univ/winuniv.cpp to work with versions of wxGTK +// 2.3.[23] +#ifndef wxHAS_WORKING_GTK_DC_BLIT + #define wxHAS_WORKING_GTK_DC_BLIT +#endif + +#endif // __GTKDCH__ diff --git a/lib/wxWidgets/include/wx/gtk1/dcclient.h b/lib/wxWidgets/include/wx/gtk1/dcclient.h new file mode 100644 index 0000000..bf9a8da --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/dcclient.h @@ -0,0 +1,161 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/dcclient.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKDCCLIENTH__ +#define __GTKDCCLIENTH__ + +#include "wx/gtk1/dc.h" +#include "wx/window.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxWindowDCImpl; +class WXDLLIMPEXP_FWD_CORE wxPaintDCImpl; +class WXDLLIMPEXP_FWD_CORE wxClientDCImpl; + +//----------------------------------------------------------------------------- +// wxWindowDCImpl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWindowDCImpl : public wxGTKDCImpl +{ +public: + wxWindowDCImpl(wxDC *owner); + wxWindowDCImpl(wxDC *owner, wxWindow *win); + + virtual ~wxWindowDCImpl(); + + virtual bool CanDrawBitmap() const { return true; } + virtual bool CanGetTextExtent() const { return true; } + +protected: + virtual void DoGetSize(int *width, int *height) const; + virtual bool DoFloodFill( wxCoord x, wxCoord y, const wxColour& col, wxFloodFillStyle style=wxFLOOD_SURFACE ); + virtual bool DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const; + + virtual void DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ); + virtual void DoCrossHair( wxCoord x, wxCoord y ); + virtual void DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, + wxCoord xc, wxCoord yc ); + virtual void DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord height, + double sa, double ea ); + virtual void DoDrawPoint( wxCoord x, wxCoord y ); + + virtual void DoDrawLines(int n, const wxPoint points[], + wxCoord xoffset, wxCoord yoffset); + virtual void DoDrawPolygon(int n, const wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + wxPolygonFillMode fillStyle = wxODDEVEN_RULE); + + virtual void DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height ); + virtual void DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0 ); + virtual void DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height ); + + virtual void DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ); + virtual void DoDrawBitmap( const wxBitmap &bitmap, wxCoord x, wxCoord y, + bool useMask = false ); + + virtual bool DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, + wxDC *source, wxCoord xsrc, wxCoord ysrc, + wxRasterOperationMode logical_func = wxCOPY, bool useMask = false, + wxCoord xsrcMask = -1, wxCoord ysrcMask = -1 ); + + virtual void DoDrawText( const wxString &text, wxCoord x, wxCoord y ); + virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, + double angle); + virtual void DoGetTextExtent( const wxString &string, + wxCoord *width, wxCoord *height, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + const wxFont *theFont = NULL) const; + +public: + virtual wxCoord GetCharWidth() const; + virtual wxCoord GetCharHeight() const; + + virtual void Clear(); + + virtual void SetFont( const wxFont &font ); + virtual void SetPen( const wxPen &pen ); + virtual void SetBrush( const wxBrush &brush ); + virtual void SetBackground( const wxBrush &brush ); + virtual void SetLogicalFunction( wxRasterOperationMode function ); + virtual void SetTextForeground( const wxColour &col ); + virtual void SetTextBackground( const wxColour &col ); + virtual void SetBackgroundMode( int mode ); + virtual void SetPalette( const wxPalette& palette ); + + virtual void DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height ); + virtual void DestroyClippingRegion(); + virtual void DoSetDeviceClippingRegion( const wxRegion ®ion ); + + // Resolution in pixels per logical inch + virtual wxSize GetPPI() const; + virtual int GetDepth() const; + + virtual GdkWindow* GetGDKWindow() const { return m_window; } + + // implementation + // -------------- + + GdkWindow *m_window; + GdkGC *m_penGC; + GdkGC *m_brushGC; + GdkGC *m_textGC; + GdkGC *m_bgGC; + GdkColormap *m_cmap; + bool m_isMemDC; + bool m_isScreenDC; + wxWindow *m_owner; + wxRegion m_currentClippingRegion; + wxRegion m_paintClippingRegion; + + void SetUpDC(); + void Destroy(); + virtual void ComputeScaleAndOrigin(); + + GdkWindow *GetWindow() { return m_window; } + +private: + wxDECLARE_DYNAMIC_CLASS(wxWindowDCImpl); +}; + +//----------------------------------------------------------------------------- +// wxClientDCImpl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxClientDCImpl : public wxWindowDCImpl +{ +public: + wxClientDCImpl(wxDC *owner) : wxWindowDCImpl(owner) { } + wxClientDCImpl(wxDC *owner, wxWindow *win); + +protected: + virtual void DoGetSize(int *width, int *height) const; + +private: + wxDECLARE_DYNAMIC_CLASS(wxClientDCImpl); +}; + +//----------------------------------------------------------------------------- +// wxPaintDCImpl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPaintDCImpl : public wxClientDCImpl +{ +public: + wxPaintDCImpl(wxDC *owner) : wxClientDCImpl(owner) { } + wxPaintDCImpl(wxDC *owner, wxWindow *win); + +private: + wxDECLARE_DYNAMIC_CLASS(wxPaintDCImpl); +}; + +#endif // __GTKDCCLIENTH__ diff --git a/lib/wxWidgets/include/wx/gtk1/dcmemory.h b/lib/wxWidgets/include/wx/gtk1/dcmemory.h new file mode 100644 index 0000000..88705f9 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/dcmemory.h @@ -0,0 +1,68 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/dcmemory.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKDCMEMORYH__ +#define __GTKDCMEMORYH__ + +#include "wx/dcmemory.h" +#include "wx/gtk1/dcclient.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxMemoryDCImpl; + +//----------------------------------------------------------------------------- +// wxMemoryDCImpl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMemoryDCImpl : public wxWindowDCImpl +{ +public: + wxMemoryDCImpl(wxMemoryDC *owner) + : wxWindowDCImpl(owner) + { + Init(); + } + + wxMemoryDCImpl(wxMemoryDC *owner, wxBitmap& bitmap) + : wxWindowDCImpl(owner) + { + Init(); + + DoSelect(bitmap); + } + + wxMemoryDCImpl(wxMemoryDC *owner, wxDC *dc); + virtual ~wxMemoryDCImpl(); + + virtual void DoSelect(const wxBitmap& bitmap); + virtual void DoGetSize( int *width, int *height ) const; + + // these get reimplemented for mono-bitmaps to behave + // more like their Win32 couterparts. They now interpret + // wxWHITE, wxWHITE_BRUSH and wxWHITE_PEN as drawing 0 + // and everything else as drawing 1. + virtual void SetPen( const wxPen &pen ); + virtual void SetBrush( const wxBrush &brush ); + virtual void SetBackground( const wxBrush &brush ); + virtual void SetTextForeground( const wxColour &col ); + virtual void SetTextBackground( const wxColour &col ); + + // implementation + wxBitmap m_selected; + +private: + void Init(); + + wxDECLARE_DYNAMIC_CLASS(wxMemoryDCImpl); +}; + +#endif // __GTKDCMEMORYH__ + diff --git a/lib/wxWidgets/include/wx/gtk1/dcscreen.h b/lib/wxWidgets/include/wx/gtk1/dcscreen.h new file mode 100644 index 0000000..e8610e1 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/dcscreen.h @@ -0,0 +1,38 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/dcscreen.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKDCSCREENH__ +#define __GTKDCSCREENH__ + +#include "wx/gtk1/dcclient.h" + +//----------------------------------------------------------------------------- +// wxScreenDCImpl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxScreenDCImpl : public wxPaintDCImpl +{ +public: + wxScreenDCImpl(wxScreenDC *owner); + virtual ~wxScreenDCImpl(); + + // implementation + + static GdkWindow *sm_overlayWindow; + static int sm_overlayWindowX; + static int sm_overlayWindowY; + +protected: + virtual void DoGetSize(int *width, int *height) const; + +private: + wxDECLARE_DYNAMIC_CLASS(wxScreenDCImpl); +}; + +#endif // __GTKDCSCREENH__ + diff --git a/lib/wxWidgets/include/wx/gtk1/dialog.h b/lib/wxWidgets/include/wx/gtk1/dialog.h new file mode 100644 index 0000000..153c9e2 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/dialog.h @@ -0,0 +1,64 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/dialog.h +// Purpose: +// Author: Robert Roebling +// Created: +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKDIALOGH__ +#define __GTKDIALOGH__ + +//----------------------------------------------------------------------------- +// wxDialog +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDialog: public wxDialogBase +{ +public: + wxDialog() { Init(); } + wxDialog( wxWindow *parent, wxWindowID id, + const wxString &title, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString &name = wxASCII_STR(wxDialogNameStr) ); + bool Create( wxWindow *parent, wxWindowID id, + const wxString &title, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString &name = wxASCII_STR(wxDialogNameStr) ); + virtual ~wxDialog() {} + + void OnApply( wxCommandEvent &event ); + void OnCancel( wxCommandEvent &event ); + void OnOK( wxCommandEvent &event ); + void OnPaint( wxPaintEvent& event ); + void OnCloseWindow( wxCloseEvent& event ); + /* + void OnCharHook( wxKeyEvent& event ); + */ + + virtual bool Show( bool show = TRUE ); + virtual int ShowModal(); + virtual void EndModal( int retCode ); + virtual bool IsModal() const; + void SetModal( bool modal ); + + // implementation + // -------------- + + bool m_modalShowing; + +protected: + // common part of all ctors + void Init(); + +private: + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxDialog); +}; + +#endif // __GTKDIALOGH__ diff --git a/lib/wxWidgets/include/wx/gtk1/dnd.h b/lib/wxWidgets/include/wx/gtk1/dnd.h new file mode 100644 index 0000000..11832ed --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/dnd.h @@ -0,0 +1,129 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/dnd.h +// Purpose: declaration of the wxDropTarget class +// Author: Robert Roebling +// Copyright: (c) 1998 Vadim Zeitlin, Robert Roebling +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKDNDH__ +#define __GTKDNDH__ + +#if wxUSE_DRAG_AND_DROP + +#include "wx/object.h" +#include "wx/string.h" +#include "wx/dataobj.h" +#include "wx/cursor.h" +#include "wx/icon.h" +#include "wx/gdicmn.h" + +//------------------------------------------------------------------------- +// classes +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxWindow; + +class WXDLLIMPEXP_FWD_CORE wxDropTarget; +class WXDLLIMPEXP_FWD_CORE wxTextDropTarget; +class WXDLLIMPEXP_FWD_CORE wxFileDropTarget; + +class WXDLLIMPEXP_FWD_CORE wxDropSource; + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +// this macro may be used instead for wxDropSource ctor arguments: it will use +// the icon 'name' from an XPM file under GTK, but will expand to something +// else under MSW. If you don't use it, you will have to use #ifdef in the +// application code. +#define wxDROP_ICON(name) wxICON(name) + +//------------------------------------------------------------------------- +// wxDropTarget +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDropTarget: public wxDropTargetBase +{ +public: + wxDropTarget(wxDataObject *dataObject = NULL ); + + virtual wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def); + virtual bool OnDrop(wxCoord x, wxCoord y); + virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def); + virtual bool GetData(); + + // implementation + + GdkAtom GetMatchingPair(bool quiet = false); + + void RegisterWidget( GtkWidget *widget ); + void UnregisterWidget( GtkWidget *widget ); + + GdkDragContext *m_dragContext; + GtkWidget *m_dragWidget; + GtkSelectionData *m_dragData; + unsigned m_dragTime; + bool m_firstMotion; // gdk has no "gdk_drag_enter" event + + void SetDragContext( GdkDragContext *dc ) { m_dragContext = dc; } + void SetDragWidget( GtkWidget *w ) { m_dragWidget = w; } + void SetDragData( GtkSelectionData *sd ) { m_dragData = sd; } + void SetDragTime(unsigned time) { m_dragTime = time; } +}; + +//------------------------------------------------------------------------- +// wxDropSource +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDropSource: public wxDropSourceBase +{ +public: + // constructor. set data later with SetData() + wxDropSource( wxWindow *win = NULL, + const wxIcon © = wxNullIcon, + const wxIcon &move = wxNullIcon, + const wxIcon &none = wxNullIcon); + + // constructor for setting one data object + wxDropSource( wxDataObject& data, + wxWindow *win, + const wxIcon © = wxNullIcon, + const wxIcon &move = wxNullIcon, + const wxIcon &none = wxNullIcon); + + virtual ~wxDropSource(); + + // start drag action + virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly); + + // GTK implementation + void RegisterWindow(); + void UnregisterWindow(); + + void PrepareIcon( int action, GdkDragContext *context ); + + GtkWidget *m_widget; + GtkWidget *m_iconWindow; + GdkDragContext *m_dragContext; + wxWindow *m_window; + + wxDragResult m_retValue; + wxIcon m_iconCopy, + m_iconMove, + m_iconNone; + + bool m_waiting; + +private: + // common part of both ctors + void SetIcons(const wxIcon& copy, + const wxIcon& move, + const wxIcon& none); +}; + +#endif // wxUSE_DRAG_AND_DROP + +#endif //__GTKDNDH__ + diff --git a/lib/wxWidgets/include/wx/gtk1/filedlg.h b/lib/wxWidgets/include/wx/gtk1/filedlg.h new file mode 100644 index 0000000..8a13d84 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/filedlg.h @@ -0,0 +1,68 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/filedlg.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKFILEDLGH__ +#define __GTKFILEDLGH__ + +#include "wx/generic/filedlgg.h" + +//------------------------------------------------------------------------- +// wxFileDialog +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFileDialog: public wxGenericFileDialog +{ +public: + wxFileDialog() { } + + wxFileDialog(wxWindow *parent, + const wxString& message = wxASCII_STR(wxFileSelectorPromptStr), + const wxString& defaultDir = wxEmptyString, + const wxString& defaultFile = wxEmptyString, + const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + long style = wxFD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + const wxString& name = wxASCII_STR(wxFileDialogNameStr)); + + virtual ~wxFileDialog(); + + virtual wxString GetPath() const; + virtual void GetPaths(wxArrayString& paths) const; + virtual wxString GetDirectory() const; + virtual wxString GetFilename() const; + virtual void GetFilenames(wxArrayString& files) const; + virtual int GetFilterIndex() const; + + virtual void SetMessage(const wxString& message); + virtual void SetPath(const wxString& path); + virtual void SetDirectory(const wxString& dir); + virtual void SetFilename(const wxString& name); + virtual void SetWildcard(const wxString& wildCard); + virtual void SetFilterIndex(int filterIndex); + + virtual int ShowModal(); + virtual bool Show( bool show = true ); + +//private: + bool m_destroyed_by_delete; + + // override this from wxTLW since the native + // form doesn't have any m_wxwindow + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + + +private: + wxDECLARE_DYNAMIC_CLASS(wxFileDialog); + wxDECLARE_EVENT_TABLE(); + void OnFakeOk( wxCommandEvent &event ); +}; + +#endif // __GTKFILEDLGH__ diff --git a/lib/wxWidgets/include/wx/gtk1/font.h b/lib/wxWidgets/include/wx/gtk1/font.h new file mode 100644 index 0000000..45dd5f1 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/font.h @@ -0,0 +1,140 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/font.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKFONTH__ +#define __GTKFONTH__ + +#include "wx/hash.h" + +// ---------------------------------------------------------------------------- +// classes +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxDC; +class WXDLLIMPEXP_FWD_CORE wxPaintDC; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +class WXDLLIMPEXP_FWD_CORE wxFont; + +// ---------------------------------------------------------------------------- +// wxFont +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFont : public wxFontBase +{ +public: + // ctors and such + wxFont() { } + + wxFont(const wxFontInfo& info) + { + Create(info.GetPointSize(), + info.GetFamily(), + info.GetStyle(), + info.GetWeight(), + info.IsUnderlined(), + info.GetFaceName(), + info.GetEncoding()); + + if ( info.IsUsingSizeInPixels() ) + SetPixelSize(info.GetPixelSize()); + } + + wxFont(const wxString& fontname) + { + Create(fontname); + } + + wxFont(const wxNativeFontInfo& info); + + wxFont(int size, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + Create(size, family, style, weight, underlined, face, encoding); + } + + wxFont(const wxSize& pixelSize, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + Create(10, family, style, weight, underlined, face, encoding); + SetPixelSize(pixelSize); + } + + bool Create(int size, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + + + // wxGTK-specific + bool Create(const wxString& fontname); + + virtual ~wxFont(); + + // implement base class pure virtuals + virtual double GetFractionalPointSize() const; + virtual wxFontStyle GetStyle() const; + virtual int GetNumericWeight() const; + virtual wxString GetFaceName() const; + virtual bool GetUnderlined() const; + virtual wxFontEncoding GetEncoding() const; + virtual const wxNativeFontInfo *GetNativeFontInfo() const; + virtual bool IsFixedWidth() const; + + virtual void SetFractionalPointSize(double pointSize); + virtual void SetFamily(wxFontFamily family); + virtual void SetStyle(wxFontStyle style); + virtual void SetNumericWeight(int weight); + virtual bool SetFaceName( const wxString& faceName ); + virtual void SetUnderlined( bool underlined ); + virtual void SetEncoding(wxFontEncoding encoding); + + wxDECLARE_COMMON_FONT_METHODS(); + + wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants") + wxFont(int size, + int family, + int style, + int weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); + } + + // implementation from now on + void Unshare(); + + GdkFont* GetInternalFont(float scale = 1.0) const; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + + virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info ); + virtual wxFontFamily DoGetFamily() const; + +private: + wxDECLARE_DYNAMIC_CLASS(wxFont); +}; + +#endif // __GTKFONTH__ diff --git a/lib/wxWidgets/include/wx/gtk1/fontdlg.h b/lib/wxWidgets/include/wx/gtk1/fontdlg.h new file mode 100644 index 0000000..bf0af76 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/fontdlg.h @@ -0,0 +1,39 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/fontdlg.h +// Purpose: wxFontDialog +// Author: Robert Roebling +// Created: +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTK_FONTDLGH__ +#define __GTK_FONTDLGH__ + +//----------------------------------------------------------------------------- +// wxFontDialog +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFontDialog : public wxFontDialogBase +{ +public: + wxFontDialog() : wxFontDialogBase() { /* must be Create()d later */ } + wxFontDialog(wxWindow *parent) + : wxFontDialogBase(parent) { Create(parent); } + wxFontDialog(wxWindow *parent, const wxFontData& data) + : wxFontDialogBase(parent, data) { Create(parent, data); } + + virtual ~wxFontDialog(); + + // implementation only + void SetChosenFont(const char *name); + +protected: + // create the GTK dialog + virtual bool DoCreate(wxWindow *parent); + +private: + wxDECLARE_DYNAMIC_CLASS(wxFontDialog); +}; + +#endif diff --git a/lib/wxWidgets/include/wx/gtk1/frame.h b/lib/wxWidgets/include/wx/gtk1/frame.h new file mode 100644 index 0000000..94787f8 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/frame.h @@ -0,0 +1,106 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/frame.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling, Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKFRAMEH__ +#define __GTKFRAMEH__ + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; +class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow; +class WXDLLIMPEXP_FWD_CORE wxMenu; +class WXDLLIMPEXP_FWD_CORE wxMenuBar; +class WXDLLIMPEXP_FWD_CORE wxToolBar; +class WXDLLIMPEXP_FWD_CORE wxStatusBar; + +//----------------------------------------------------------------------------- +// wxFrame +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFrame : public wxFrameBase +{ +public: + // construction + wxFrame() { Init(); } + wxFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Init(); + + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + +#if wxUSE_STATUSBAR + virtual void PositionStatusBar(); + + virtual wxStatusBar* CreateStatusBar(int number = 1, + long style = wxSTB_DEFAULT_STYLE, + wxWindowID id = 0, + const wxString& name = wxASCII_STR(wxStatusLineNameStr)); + + void SetStatusBar(wxStatusBar *statbar); +#endif // wxUSE_STATUSBAR + +#if wxUSE_TOOLBAR + virtual wxToolBar* CreateToolBar(long style = -1, + wxWindowID id = -1, + const wxString& name = wxASCII_STR(wxToolBarNameStr)); + void SetToolBar(wxToolBar *toolbar); +#endif // wxUSE_TOOLBAR + + wxPoint GetClientAreaOrigin() const { return wxPoint(0, 0); } + + // implementation from now on + // -------------------------- + + // GTK callbacks + virtual void GtkOnSize( int x, int y, int width, int height ); + virtual void OnInternalIdle(); + + bool m_menuBarDetached; + int m_menuBarHeight; + bool m_toolBarDetached; + +protected: + // common part of all ctors + void Init(); + + // override wxWindow methods to take into account tool/menu/statusbars + virtual void DoSetClientSize(int width, int height); + virtual void DoGetClientSize( int *width, int *height ) const; + +#if wxUSE_MENUS_NATIVE + + virtual void DetachMenuBar(); + virtual void AttachMenuBar(wxMenuBar *menubar); + +public: + // Menu size is dynamic now, call this whenever it might change. + void UpdateMenuBarSize(); + +#endif // wxUSE_MENUS_NATIVE + + wxDECLARE_DYNAMIC_CLASS(wxFrame); +}; + +#endif // __GTKFRAMEH__ diff --git a/lib/wxWidgets/include/wx/gtk1/gauge.h b/lib/wxWidgets/include/wx/gtk1/gauge.h new file mode 100644 index 0000000..2f0cf90 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/gauge.h @@ -0,0 +1,76 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/gauge.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKGAUGEH__ +#define __GTKGAUGEH__ + +//----------------------------------------------------------------------------- +// wxGaugeBox +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGauge: public wxGaugeBase +{ +public: + wxGauge() { Init(); } + + wxGauge( wxWindow *parent, + wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxGaugeNameStr) ) + { + Init(); + + Create(parent, id, range, pos, size, style, validator, name); + } + + bool Create( wxWindow *parent, + wxWindowID id, int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxGaugeNameStr) ); + + void SetRange( int r ); + void SetValue( int pos ); + int GetRange() const; + int GetValue() const; + + bool IsVertical() const { return HasFlag(wxGA_VERTICAL); } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // implementation + // ------------- + + // the max and current gauge values + int m_rangeMax, + m_gaugePos; + +protected: + // common part of all ctors + void Init() { m_rangeMax = m_gaugePos = 0; } + + // set the gauge value to the value of m_gaugePos + void DoSetGauge(); + + virtual wxSize DoGetBestSize() const; + + virtual wxVisualAttributes GetDefaultAttributes() const; + +private: + wxDECLARE_DYNAMIC_CLASS(wxGauge); +}; + +#endif + // __GTKGAUGEH__ diff --git a/lib/wxWidgets/include/wx/gtk1/glcanvas.h b/lib/wxWidgets/include/wx/gtk1/glcanvas.h new file mode 100644 index 0000000..96f956b --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/glcanvas.h @@ -0,0 +1,127 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/glcanvas.h +// Purpose: wxGLCanvas, for using OpenGL/Mesa with wxWidgets and GTK +// Author: Robert Roebling +// Modified by: +// Created: 17/8/98 +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GLCANVAS_H_ +#define _WX_GLCANVAS_H_ + +#include "wx/unix/glx11.h" + +//--------------------------------------------------------------------------- +// wxGLCanvas +//--------------------------------------------------------------------------- + +class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasX11 +{ +public: + wxGLCanvas(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + + explicit // avoid implicitly converting a wxWindow* to wxGLCanvas + wxGLCanvas(wxWindow *parent, + wxWindowID id = wxID_ANY, + const int *attribList = NULL, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + + bool Create(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const int *attribList = NULL, + const wxPalette& palette = wxNullPalette); + + + // implement wxGLCanvasX11 methods + // ------------------------------- + + virtual unsigned long GetXWindow() const; + + + // deprecated methods + // ------------------ + +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED_CONSTRUCTOR( + wxGLCanvas(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const int *attribList = NULL, + const wxPalette& palette = wxNullPalette) + ); + + wxDEPRECATED_CONSTRUCTOR( + wxGLCanvas(wxWindow *parent, + const wxGLContext *shared, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const int *attribList = NULL, + const wxPalette& palette = wxNullPalette) + ); + + wxDEPRECATED_CONSTRUCTOR( + wxGLCanvas(wxWindow *parent, + const wxGLCanvas *shared, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const int *attribList = NULL, + const wxPalette& palette = wxNullPalette) + ); + + // called from "realized" callback to create the implicit context if needed + void GTKInitImplicitContext(); +#endif // WXWIN_COMPATIBILITY_2_8 + + // implementation from now on + virtual void OnInternalIdle(); + + + GtkWidget *m_glWidget; + +#if WXWIN_COMPATIBILITY_2_8 + wxGLContext *m_sharedContext; + wxGLCanvas *m_sharedContextOf; + const bool m_createImplicitContext; +#endif // WXWIN_COMPATIBILITY_2_8 + +private: + wxDECLARE_CLASS(wxGLCanvas); +}; + +#endif // _WX_GLCANVAS_H_ + diff --git a/lib/wxWidgets/include/wx/gtk1/listbox.h b/lib/wxWidgets/include/wx/gtk1/listbox.h new file mode 100644 index 0000000..7428d95 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/listbox.h @@ -0,0 +1,139 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/listbox.h +// Purpose: wxListBox class declaration +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKLISTBOXH__ +#define __GTKLISTBOXH__ + +#include "wx/list.h" + +typedef struct _GtkList GtkList; + +class WXDLLIMPEXP_FWD_BASE wxSortedArrayString; + +//----------------------------------------------------------------------------- +// wxListBox +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase +{ +public: + // ctors and such + wxListBox(); + wxListBox( wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = (const wxString *) NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr) ) + { +#if wxUSE_CHECKLISTBOX + m_hasCheckBoxes = false; +#endif // wxUSE_CHECKLISTBOX + Create(parent, id, pos, size, n, choices, style, validator, name); + } + wxListBox( wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr) ) + { +#if wxUSE_CHECKLISTBOX + m_hasCheckBoxes = false; +#endif // wxUSE_CHECKLISTBOX + Create(parent, id, pos, size, choices, style, validator, name); + } + virtual ~wxListBox(); + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = (const wxString *) NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + + // implement base class pure virtuals + virtual void DoClear(); + virtual void DoDeleteOneItem(unsigned int n); + + virtual unsigned int GetCount() const; + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& s); + virtual int FindString(const wxString& s, bool bCase = false) const; + + virtual bool IsSelected(int n) const; + virtual void DoSetSelection(int n, bool select); + virtual int GetSelection() const; + virtual int GetSelections(wxArrayInt& aSelections) const; + + virtual int DoInsertItems(const wxArrayStringsAdapter& items, + unsigned int pos, + void **clientData, wxClientDataType type); + + virtual void DoSetFirstItem(int n); + + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // implementation from now on + + void GtkAddItem( const wxString &item, int pos=-1 ); + int GtkGetIndex( GtkWidget *item ) const; + GtkWidget *GetConnectWidget(); + bool IsOwnGtkWindow( GdkWindow *window ); + void DoApplyWidgetStyle(GtkRcStyle *style); + void OnInternalIdle(); + +#if wxUSE_TOOLTIPS + void ApplyToolTip( GtkTooltips *tips, const wxChar *tip ); +#endif // wxUSE_TOOLTIPS + + GtkList *m_list; + wxList m_clientList; + +#if wxUSE_CHECKLISTBOX + bool m_hasCheckBoxes; +#endif // wxUSE_CHECKLISTBOX + + int m_prevSelection; + bool m_blockEvent; + + virtual void FixUpMouseEvent(GtkWidget *widget, wxCoord& x, wxCoord& y); + +protected: + virtual wxSize DoGetBestSize() const; + + // return the string label for the given item + wxString GetRealLabel(struct _GList *item) const; + + // Widgets that use the style->base colour for the BG colour should + // override this and return true. + virtual bool UseGTKStyleBase() const { return true; } + +private: + // this array is only used for controls with wxCB_SORT style, so only + // allocate it if it's needed (hence using pointer) + wxSortedArrayString *m_strings; + + wxDECLARE_DYNAMIC_CLASS(wxListBox); +}; + +#endif // __GTKLISTBOXH__ diff --git a/lib/wxWidgets/include/wx/gtk1/mdi.h b/lib/wxWidgets/include/wx/gtk1/mdi.h new file mode 100644 index 0000000..e752b65 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/mdi.h @@ -0,0 +1,147 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/mdi.h +// Purpose: TDI-based MDI implementation for wxGTK1 +// Author: Robert Roebling +// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes +// Copyright: (c) 1998 Robert Roebling +// (c) 2008 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK1_MDI_H_ +#define _WX_GTK1_MDI_H_ + +#include "wx/frame.h" + +class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; +class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow; + +typedef struct _GtkNotebook GtkNotebook; + +//----------------------------------------------------------------------------- +// wxMDIParentFrame +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase +{ +public: + wxMDIParentFrame() { Init(); } + wxMDIParentFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Init(); + + (void)Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + // we don't store the active child in m_currentChild unlike the base class + // version so override this method to find it dynamically + virtual wxMDIChildFrame *GetActiveChild() const; + + // implement base class pure virtuals + // ---------------------------------- + + virtual void ActivateNext(); + virtual void ActivatePrevious(); + + static bool IsTDI() { return true; } + + // implementation + + bool m_justInserted; + + virtual void GtkOnSize( int x, int y, int width, int height ); + virtual void OnInternalIdle(); + +private: + void Init(); + + wxDECLARE_DYNAMIC_CLASS(wxMDIParentFrame); +}; + +//----------------------------------------------------------------------------- +// wxMDIChildFrame +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxTDIChildFrame +{ +public: + wxMDIChildFrame() { Init(); } + wxMDIChildFrame(wxMDIParentFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Init(); + + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxMDIParentFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + virtual ~wxMDIChildFrame(); + + virtual void SetMenuBar( wxMenuBar *menu_bar ); + virtual wxMenuBar *GetMenuBar() const; + + virtual void Activate(); + + virtual void SetTitle(const wxString& title); + + // implementation + + void OnActivate( wxActivateEvent& event ); + void OnMenuHighlight( wxMenuEvent& event ); + + wxMenuBar *m_menuBar; + GtkNotebookPage *m_page; + bool m_justInserted; + +private: + void Init(); + + GtkNotebook *GTKGetNotebook() const; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxMDIChildFrame); +}; + +//----------------------------------------------------------------------------- +// wxMDIClientWindow +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase +{ +public: + wxMDIClientWindow() { } + + virtual bool CreateClient(wxMDIParentFrame *parent, + long style = wxVSCROLL | wxHSCROLL); + +private: + wxDECLARE_DYNAMIC_CLASS(wxMDIClientWindow); +}; + +#endif // _WX_GTK1_MDI_H_ diff --git a/lib/wxWidgets/include/wx/gtk1/menu.h b/lib/wxWidgets/include/wx/gtk1/menu.h new file mode 100644 index 0000000..410a601 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/menu.h @@ -0,0 +1,101 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/menu.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling, Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKMENUH__ +#define __GTKMENUH__ + +//----------------------------------------------------------------------------- +// wxMenuBar +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMenuBar : public wxMenuBarBase +{ +public: + // ctors + wxMenuBar(); + wxMenuBar(long style); + wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0); + virtual ~wxMenuBar(); + + // implement base class (pure) virtuals + virtual bool Append( wxMenu *menu, const wxString &title ); + virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title); + virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title); + virtual wxMenu *Remove(size_t pos); + + virtual int FindMenuItem(const wxString& menuString, + const wxString& itemString) const; + virtual wxMenuItem* FindItem( int id, wxMenu **menu = NULL ) const; + + virtual void EnableTop( size_t pos, bool flag ); + virtual void SetMenuLabel( size_t pos, const wxString& label ); + virtual wxString GetMenuLabel( size_t pos ) const; + + // common part of Append and Insert + bool GtkAppend(wxMenu *menu, const wxString& title, int pos=-1); + + virtual void Attach(wxFrame *frame); + virtual void Detach(); + + GtkAccelGroup *m_accel; + GtkWidget *m_menubar; + long m_style; + +private: + void Init(size_t n, wxMenu *menus[], const wxString titles[], long style); + + wxDECLARE_DYNAMIC_CLASS(wxMenuBar); +}; + +//----------------------------------------------------------------------------- +// wxMenu +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMenu : public wxMenuBase +{ +public: + // ctors & dtor + wxMenu(const wxString& title, long style = 0) + : wxMenuBase(title, style) { Init(); } + + wxMenu(long style = 0) : wxMenuBase(style) { Init(); } + + virtual ~wxMenu(); + + // implement base class virtuals + virtual wxMenuItem* DoAppend(wxMenuItem *item); + virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item); + virtual wxMenuItem* DoRemove(wxMenuItem *item); + + // Returns the title, with mnemonics translated to wx format + wxString GetTitle() const; + + // TODO: virtual void SetTitle(const wxString& title); + + // implementation + int FindMenuIdByMenuItem( GtkWidget *menuItem ) const; + + // implementation GTK only + GtkWidget *m_menu; // GtkMenu + GtkWidget *m_owner; + GtkAccelGroup *m_accel; + +private: + // common code for all constructors: + void Init(); + + // common part of Append (if pos == -1) and Insert + bool GtkAppend(wxMenuItem *item, int pos=-1); + + GtkWidget *m_prevRadio; + + wxDECLARE_DYNAMIC_CLASS(wxMenu); +}; + +#endif + // __GTKMENUH__ diff --git a/lib/wxWidgets/include/wx/gtk1/menuitem.h b/lib/wxWidgets/include/wx/gtk1/menuitem.h new file mode 100644 index 0000000..d5ef403 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/menuitem.h @@ -0,0 +1,74 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/menuitem.h +// Purpose: wxMenuItem class +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKMENUITEMH__ +#define __GTKMENUITEMH__ + +#include "wx/bitmap.h" + +//----------------------------------------------------------------------------- +// wxMenuItem +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMenuItem : public wxMenuItemBase +{ +public: + wxMenuItem(wxMenu *parentMenu = NULL, + int id = wxID_SEPARATOR, + const wxString& text = wxEmptyString, + const wxString& help = wxEmptyString, + wxItemKind kind = wxITEM_NORMAL, + wxMenu *subMenu = NULL); + virtual ~wxMenuItem(); + + // implement base class virtuals + virtual void SetItemLabel( const wxString& str ); + virtual wxString GetItemLabel() const; + virtual void Enable( bool enable = TRUE ); + virtual void Check( bool check = TRUE ); + virtual bool IsChecked() const; + +#if wxUSE_ACCEL + virtual wxAcceleratorEntry *GetAccel() const; +#endif // wxUSE_ACCEL + + // implementation + void SetMenuItem(GtkWidget *menuItem) { m_menuItem = menuItem; } + GtkWidget *GetMenuItem() const { return m_menuItem; } + GtkWidget *GetLabelWidget() const { return m_labelWidget; } + void SetLabelWidget(GtkWidget *labelWidget) { m_labelWidget = labelWidget; } + wxString GetFactoryPath() const; + + wxString GetHotKey() const { return m_hotKey; } + + // compatibility only, don't use in new code + wxMenuItem(wxMenu *parentMenu, + int id, + const wxString& text, + const wxString& help, + bool isCheckable, + wxMenu *subMenu = NULL); + +private: + // common part of all ctors + void Init(); + + // DoSetText() transforms the accel mnemonics in our label from MSW/wxWin + // style to GTK+ and is called from ctor and SetText() + void DoSetText(const wxString& text); + + wxString m_hotKey; + + GtkWidget *m_menuItem; // GtkMenuItem + GtkWidget* m_labelWidget; // Label widget + + wxDECLARE_DYNAMIC_CLASS(wxMenuItem); +}; + +#endif + //__GTKMENUITEMH__ diff --git a/lib/wxWidgets/include/wx/gtk1/minifram.h b/lib/wxWidgets/include/wx/gtk1/minifram.h new file mode 100644 index 0000000..bfc31fe --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/minifram.h @@ -0,0 +1,65 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/minifram.h +// Purpose: wxMiniFrame class +// Author: Robert Roebling +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKMINIFRAMEH__ +#define __GTKMINIFRAMEH__ + +#include "wx/defs.h" + +#if wxUSE_MINIFRAME + +#include "wx/object.h" +#include "wx/frame.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxMiniFrame; + +//----------------------------------------------------------------------------- +// wxMiniFrame +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMiniFrame: public wxFrame +{ + wxDECLARE_DYNAMIC_CLASS(wxMiniFrame); + +public: + wxMiniFrame() {} + wxMiniFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxTINY_CAPTION, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxTINY_CAPTION, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + virtual void SetTitle( const wxString &title ); + // implementation + + bool m_isDragging; + int m_oldX,m_oldY; + int m_diffX,m_diffY; +}; + +#endif + +#endif + // __GTKMINIFRAMEH__ diff --git a/lib/wxWidgets/include/wx/gtk1/msgdlg.h b/lib/wxWidgets/include/wx/gtk1/msgdlg.h new file mode 100644 index 0000000..a2bd717 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/msgdlg.h @@ -0,0 +1,50 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/msgdlg.h +// Purpose: wxMessageDialog for GTK+2 +// Author: Vaclav Slavik +// Modified by: +// Created: 2003/02/28 +// Copyright: (c) Vaclav Slavik, 2003 +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __MSGDLG_H__ +#define __MSGDLG_H__ + +#include "wx/defs.h" +#include "wx/dialog.h" + +// type is an 'or' (|) of wxOK, wxCANCEL, wxYES_NO +// Returns wxYES/NO/OK/CANCEL + +extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxMessageBoxCaptionStr[]; + +class WXDLLIMPEXP_CORE wxMessageDialog: public wxDialog, public wxMessageDialogBase +{ +public: + wxMessageDialog(wxWindow *parent, const wxString& message, + const wxString& caption = wxMessageBoxCaptionStr, + long style = wxOK|wxCENTRE, + const wxPoint& pos = wxDefaultPosition); + virtual ~wxMessageDialog(); + + int ShowModal(); + virtual bool Show( bool WXUNUSED(show) = true ) { return false; } + +protected: + // implement some base class methods to do nothing to avoid asserts and + // GTK warnings, since this is not a real wxDialog. + virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y), + int WXUNUSED(width), int WXUNUSED(height), + int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {} + virtual void DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), + int WXUNUSED(width), int WXUNUSED(height)) {} + +private: + wxString m_caption; + wxString m_message; + + wxDECLARE_DYNAMIC_CLASS(wxMessageDialog); +}; + +#endif diff --git a/lib/wxWidgets/include/wx/gtk1/notebook.h b/lib/wxWidgets/include/wx/gtk1/notebook.h new file mode 100644 index 0000000..35696bd --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/notebook.h @@ -0,0 +1,149 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/notebook.h +// Purpose: wxNotebook class +// Author: Robert Roebling +// Modified by: +// Copyright: (c) Julian Smart and Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKNOTEBOOKH__ +#define __GTKNOTEBOOKH__ + +//----------------------------------------------------------------------------- +// internal class +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxGtkNotebookPage; + +#include "wx/list.h" +WX_DECLARE_LIST(wxGtkNotebookPage, wxGtkNotebookPagesList); + +//----------------------------------------------------------------------------- +// wxNotebook +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase +{ +public: + // default for dynamic class + wxNotebook(); + // the same arguments as for wxControl + wxNotebook(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxNotebookNameStr)); + // Create() function + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxNotebookNameStr)); + // dtor + virtual ~wxNotebook(); + + // accessors + // --------- + + // set the currently selected page, return the index of the previously + // selected one (or wxNOT_FOUND on error) + // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events + int SetSelection(size_t nPage) { return DoSetSelection(nPage, SetSelection_SendEvent); } + // get the currently selected page + int GetSelection() const; + + // changes selected page without sending events + int ChangeSelection(size_t nPage) { return DoSetSelection(nPage); } + + // set/get the title of a page + bool SetPageText(size_t nPage, const wxString& strText); + wxString GetPageText(size_t nPage) const; + + // sets/returns item's image index in the current image list + int GetPageImage(size_t nPage) const; + bool SetPageImage(size_t nPage, int nImage); + + // control the appearance of the notebook pages + // set the size (the same for all pages) + void SetPageSize(const wxSize& size); + // set the padding between tabs (in pixels) + void SetPadding(const wxSize& padding); + // sets the size of the tabs (assumes all tabs are the same size) + void SetTabSize(const wxSize& sz); + + virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; + + // operations + // ---------- + // remove all pages + bool DeleteAllPages(); + + // adds a new page to the notebook (it will be deleted by the notebook, + // don't delete it yourself). If bSelect, this page becomes active. + // the same as AddPage(), but adds it at the specified position + bool InsertPage( size_t position, + wxNotebookPage *win, + const wxString& strText, + bool bSelect = false, + int imageId = NO_IMAGE ); + + // handler for tab navigation + // -------------------------- + void OnNavigationKey(wxNavigationKeyEvent& event); + + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // implementation + // -------------- + +#if wxUSE_CONSTRAINTS + void SetConstraintSizes(bool recurse); + bool DoPhase(int phase); +#endif + + // set all page's attributes + void DoApplyWidgetStyle(GtkRcStyle *style); + + // report if window belongs to notebook + bool IsOwnGtkWindow( GdkWindow *window ); + + // common part of all ctors + void Init(); + + // helper function + wxGtkNotebookPage* GetNotebookPage(int page) const; + + // the additional page data (the pages themselves are in m_pages array) + wxGtkNotebookPagesList m_pagesData; + + // for reasons explained in gtk/notebook.cpp we store the current + // selection internally instead of querying the notebook for it + int m_selection; + + // flag set to true while we're inside "switch_page" callback + bool m_inSwitchPage; + + // flag set to true when the switch-page signal has been programmatically generated + bool m_skipNextPageChangeEvent; + +protected: + // remove one page from the notebook but do not destroy it + virtual wxNotebookPage *DoRemovePage(size_t nPage); + + int DoSetSelection(size_t nPage, int flags = 0); + +private: + // the padding set by SetPadding() + int m_padding; + + wxDECLARE_DYNAMIC_CLASS(wxNotebook); + wxDECLARE_EVENT_TABLE(); +}; + +#endif + // __GTKNOTEBOOKH__ diff --git a/lib/wxWidgets/include/wx/gtk1/pen.h b/lib/wxWidgets/include/wx/gtk1/pen.h new file mode 100644 index 0000000..b3124dc --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/pen.h @@ -0,0 +1,79 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/pen.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKPENH__ +#define __GTKPENH__ + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/string.h" +#include "wx/gdiobj.h" +#include "wx/gdicmn.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxPen; + +#if defined(__WXGTK127__) +typedef signed char wxGTKDash; +#else +typedef char wxGTKDash; +#endif + +//----------------------------------------------------------------------------- +// wxPen +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPen: public wxPenBase +{ +public: + wxPen() { } + + wxPen( const wxColour &colour, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID ); + + wxPen( const wxPenInfo& info ); + + bool operator==(const wxPen& pen) const; + bool operator!=(const wxPen& pen) const { return !(*this == pen); } + + void SetColour( const wxColour &colour ); + void SetColour( unsigned char red, unsigned char green, unsigned char blue ); + void SetCap( wxPenCap capStyle ); + void SetJoin( wxPenJoin joinStyle ); + void SetStyle( wxPenStyle style ); + void SetWidth( int width ); + void SetDashes( int number_of_dashes, const wxDash *dash ); + void SetStipple(const wxBitmap& stipple); + + wxColour GetColour() const; + wxPenCap GetCap() const; + wxPenJoin GetJoin() const; + wxPenStyle GetStyle() const; + int GetWidth() const; + int GetDashes(wxDash **ptr) const; + int GetDashCount() const; + wxDash* GetDash() const; + wxBitmap *GetStipple() const; + + + wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") + wxPen(const wxColour& col, int width, int style); + + wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") + void SetStyle(int style) { SetStyle((wxPenStyle)style); } + +private: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + + wxDECLARE_DYNAMIC_CLASS(wxPen); +}; + +#endif // __GTKPENH__ diff --git a/lib/wxWidgets/include/wx/gtk1/popupwin.h b/lib/wxWidgets/include/wx/gtk1/popupwin.h new file mode 100644 index 0000000..7863507 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/popupwin.h @@ -0,0 +1,53 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/popupwin.h +// Purpose: +// Author: Robert Roebling +// Created: +// Copyright: (c) 2001 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKPOPUPWINH__ +#define __GTKPOPUPWINH__ + +#include "wx/defs.h" +#include "wx/panel.h" +#include "wx/icon.h" + +//----------------------------------------------------------------------------- +// wxPopUpWindow +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPopupWindow: public wxPopupWindowBase +{ +public: + wxPopupWindow() { } + virtual ~wxPopupWindow(); + + wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE) + { (void)Create(parent, flags); } + bool Create(wxWindow *parent, int flags = wxBORDER_NONE); + + virtual bool Show( bool show = TRUE ); + + // implementation + // -------------- + + virtual void DoMoveWindow(int x, int y, int width, int height); + + virtual void OnInternalIdle(); + + +protected: + void GtkOnSize( int x, int y, int width, int height ); + + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + +private: + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxPopupWindow); +}; + +#endif // __GTKPOPUPWINDOWH__ diff --git a/lib/wxWidgets/include/wx/gtk1/private.h b/lib/wxWidgets/include/wx/gtk1/private.h new file mode 100644 index 0000000..e684e9e --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/private.h @@ -0,0 +1,95 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/private.h +// Purpose: wxGTK private macros, functions &c +// Author: Vadim Zeitlin +// Modified by: +// Created: 12.03.02 +// Copyright: (c) 2002 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRIVATE_H_ +#define _WX_GTK_PRIVATE_H_ + +#include +#include + +#include "wx/event.h" + +// fail all version tests if the GTK+ version is so ancient that it doesn't +// even have GTK_CHECK_VERSION +#ifndef GTK_CHECK_VERSION + #define GTK_CHECK_VERSION(a, b, c) 0 +#endif + +#define wxGTK_CONV(s) s.c_str() +#define wxGTK_CONV_BACK(s) s + + +// child is not a member of GTK_BUTTON() any more in GTK+ 2.0 +#define BUTTON_CHILD(w) GTK_BUTTON((w))->child + +// event_window has disappeared from GtkToggleButton in GTK+ 2.0 +#define TOGGLE_BUTTON_EVENT_WIN(w) GTK_TOGGLE_BUTTON((w))->event_window + +// gtk_editable_{copy|cut|paste}_clipboard() had an extra argument under +// previous GTK+ versions but no more +#if defined(__WXGTK20__) || (GTK_MINOR_VERSION > 0) + #define DUMMY_CLIPBOARD_ARG +#else + #define DUMMY_CLIPBOARD_ARG ,0 +#endif + +// _GtkEditable is private in GTK2 +#define GET_EDITABLE_POS(w) GTK_EDITABLE((w))->current_pos +#define SET_EDITABLE_POS(w, pos) \ + GTK_EDITABLE((w))->current_pos = (pos) + +// this GtkNotebook struct field has been renamed in GTK2 +#define NOTEBOOK_PANEL(nb) GTK_NOTEBOOK(nb)->panel + +#define SCROLLBAR_CBACK_ARG +#define GET_SCROLL_TYPE(w) GTK_RANGE((w))->scroll_type + +// translate a GTK+ scroll type to a wxEventType +inline wxEventType GtkScrollTypeToWx(guint scrollType) +{ + wxEventType command; + switch ( scrollType ) + { + case GTK_SCROLL_STEP_BACKWARD: + command = wxEVT_SCROLL_LINEUP; + break; + + case GTK_SCROLL_STEP_FORWARD: + command = wxEVT_SCROLL_LINEDOWN; + break; + + case GTK_SCROLL_PAGE_BACKWARD: + command = wxEVT_SCROLL_PAGEUP; + break; + + case GTK_SCROLL_PAGE_FORWARD: + command = wxEVT_SCROLL_PAGEDOWN; + break; + + default: + command = wxEVT_SCROLL_THUMBTRACK; + } + + return command; +} + +inline wxEventType GtkScrollWinTypeToWx(guint scrollType) +{ + // GtkScrollTypeToWx() returns SCROLL_XXX, not SCROLLWIN_XXX as we need + return GtkScrollTypeToWx(scrollType) + + wxEVT_SCROLLWIN_TOP - wxEVT_SCROLL_TOP; +} + +// Needed for implementing e.g. combobox on wxGTK within a modal dialog. +void wxAddGrab(wxWindow* window); +void wxRemoveGrab(wxWindow* window); + +#endif // _WX_GTK_PRIVATE_H_ + diff --git a/lib/wxWidgets/include/wx/gtk1/private/addremovectrl.h b/lib/wxWidgets/include/wx/gtk1/private/addremovectrl.h new file mode 100644 index 0000000..3e25f6e --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/private/addremovectrl.h @@ -0,0 +1,80 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/addremovectrl.h +// Purpose: GTK specific wxAddRemoveImpl implementation +// Author: Vadim Zeitlin +// Created: 2015-02-05 +// Copyright: (c) 2015 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRIVATE_ADDREMOVECTRL_H_ +#define _WX_GTK_PRIVATE_ADDREMOVECTRL_H_ + +#include "wx/artprov.h" +#include "wx/bmpbuttn.h" +#include "wx/toolbar.h" + +#include + +// ---------------------------------------------------------------------------- +// wxAddRemoveImpl +// ---------------------------------------------------------------------------- + +class wxAddRemoveImpl : public wxAddRemoveImplBase +{ +public: + wxAddRemoveImpl(wxAddRemoveAdaptor* adaptor, + wxAddRemoveCtrl* parent, + wxWindow* ctrlItems) + : wxAddRemoveImplBase(adaptor, parent, ctrlItems), + m_tbar(new wxToolBar(parent, wxID_ANY)) + { + m_tbar->AddTool(wxID_ADD, wxString(), GetNamedBitmap("list-add")); + m_tbar->AddTool(wxID_REMOVE, wxString(), GetNamedBitmap("list-remove")); + +#if defined(__WXGTK3__) && !defined(__WXUNIVERSAL__) + // Tweak the toolbar appearance to correspond to how the toolbars used + // in other GNOME applications for similar purposes look. + GtkToolbar* const toolbar = m_tbar->GTKGetToolbar(); + GtkStyleContext* context = gtk_widget_get_style_context(GTK_WIDGET(toolbar)); + gtk_style_context_add_class(context, GTK_STYLE_CLASS_INLINE_TOOLBAR); + gtk_style_context_set_junction_sides(context, GTK_JUNCTION_TOP); +#endif // GTK+3 + + wxSizer* const sizerTop = new wxBoxSizer(wxVERTICAL); + sizerTop->Add(ctrlItems, wxSizerFlags(1).Expand()); + sizerTop->Add(m_tbar, wxSizerFlags().Expand()); + parent->SetSizer(sizerTop); + + m_tbar->Bind(wxEVT_UPDATE_UI, + &wxAddRemoveImplBase::OnUpdateUIAdd, this, wxID_ADD); + m_tbar->Bind(wxEVT_UPDATE_UI, + &wxAddRemoveImplBase::OnUpdateUIRemove, this, wxID_REMOVE); + + m_tbar->Bind(wxEVT_TOOL, &wxAddRemoveImplBase::OnAdd, this, wxID_ADD); + m_tbar->Bind(wxEVT_TOOL, &wxAddRemoveImplBase::OnRemove, this, wxID_REMOVE); + } + + virtual void SetButtonsToolTips(const wxString& addtip, + const wxString& removetip) wxOVERRIDE + { + m_tbar->SetToolShortHelp(wxID_ADD, addtip); + m_tbar->SetToolShortHelp(wxID_REMOVE, removetip); + } + +private: + static wxBitmap GetNamedBitmap(const wxString& name) + { + // GTK UI guidelines recommend using "symbolic" versions of the icons + // for these buttons, so try them first but fall back to the normal + // ones if symbolic theme is not installed. + wxBitmap bmp = wxArtProvider::GetBitmap(name + wxASCII_STR("-symbolic"), wxART_MENU); + if ( !bmp.IsOk() ) + bmp = wxArtProvider::GetBitmap(name, wxART_MENU); + return bmp; + } + + wxToolBar* const m_tbar; +}; + +#endif // _WX_GTK_PRIVATE_ADDREMOVECTRL_H_ diff --git a/lib/wxWidgets/include/wx/gtk1/private/mnemonics.h b/lib/wxWidgets/include/wx/gtk1/private/mnemonics.h new file mode 100644 index 0000000..8caa81e --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/private/mnemonics.h @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/private/mnemonics.h +// Purpose: helper functions for dealing with GTK+ mnemonics +// Author: Vadim Zeitlin +// Created: 2007-11-12 +// Copyright: (c) 2007 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _GTK_PRIVATE_MNEMONICS_H_ +#define _GTK_PRIVATE_MNEMONICS_H_ + +#if wxUSE_CONTROLS || wxUSE_MENUS + +#include "wx/string.h" + +// ---------------------------------------------------------------------------- +// functions to convert between wxWidgets and GTK+ string containing mnemonics +// ---------------------------------------------------------------------------- + +// remove all mnemonics from a string +wxString wxGTKRemoveMnemonics(const wxString& label); + +// convert a wx string with '&' to GTK+ string with '_'s +wxString wxConvertMnemonicsToGTK(const wxString& label); + +// convert a wx string with '&' to indicate mnemonics as well as HTML entities +// to a GTK+ string with "&" used instead of '&', i.e. suitable for use +// with GTK+ functions using markup strings +wxString wxConvertMnemonicsToGTKMarkup(const wxString& label); + +// convert GTK+ string with '_'s to wx string with '&'s +wxString wxConvertMnemonicsFromGTK(const wxString& label); + +#endif // wxUSE_CONTROLS || wxUSE_MENUS + +#endif // _GTK_PRIVATE_MNEMONICS_H_ + diff --git a/lib/wxWidgets/include/wx/gtk1/private/timer.h b/lib/wxWidgets/include/wx/gtk1/private/timer.h new file mode 100644 index 0000000..add461e --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/private/timer.h @@ -0,0 +1,33 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/private/timer.h +// Purpose: wxTimerImpl for wxGTK +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK1_PRIVATE_TIMER_H_ +#define _WX_GTK1_PRIVATE_TIMER_H_ + +#include "wx/private/timer.h" + +//----------------------------------------------------------------------------- +// wxTimer +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGTKTimerImpl : public wxTimerImpl +{ +public: + wxGTKTimerImpl(wxTimer *timer) : wxTimerImpl(timer) { m_tag = -1; } + + virtual bool Start(int millisecs = -1, bool oneShot = FALSE); + virtual void Stop(); + + virtual bool IsRunning() const { return m_tag != -1; } + +private: + // registered timeout id, -1 if the timer isn't running + int m_tag; +}; + +#endif // _WX_GTK1_PRIVATE_TIMER_H_ diff --git a/lib/wxWidgets/include/wx/gtk1/radiobox.h b/lib/wxWidgets/include/wx/gtk1/radiobox.h new file mode 100644 index 0000000..5198e41 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/radiobox.h @@ -0,0 +1,135 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/radiobox.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_RADIOBOX_H_ +#define _WX_GTK_RADIOBOX_H_ + +#include "wx/bitmap.h" + +//----------------------------------------------------------------------------- +// wxRadioBox +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxRadioBox : public wxControl, + public wxRadioBoxBase +{ +public: + // ctors and dtor + wxRadioBox() { Init(); } + wxRadioBox(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, + const wxString choices[] = (const wxString *) NULL, + int majorDim = 1, + long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioBoxNameStr)) + { + Init(); + + Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name ); + } + + wxRadioBox(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 1, + long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioBoxNameStr)) + { + Init(); + + Create( parent, id, title, pos, size, choices, majorDim, style, val, name ); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, + const wxString choices[] = (const wxString *) NULL, + int majorDim = 0, + long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioBoxNameStr)); + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, + long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioBoxNameStr)); + + virtual ~wxRadioBox(); + + + // implement wxItemContainerImmutable methods + virtual unsigned int GetCount() const; + + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& s); + + virtual void SetSelection(int n); + virtual int GetSelection() const; + + + // implement wxRadioBoxBase methods + virtual bool Show(unsigned int n, bool show = true); + virtual bool Enable(unsigned int n, bool enable = true); + + virtual bool IsItemEnabled(unsigned int n) const; + virtual bool IsItemShown(unsigned int n) const; + + + // override some base class methods to operate on radiobox itself too + virtual bool Show( bool show = true ); + virtual bool Enable( bool enable = true ); + + virtual void SetLabel( const wxString& label ); + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // implementation + // -------------- + + void SetFocus(); + void GtkDisableEvents(); + void GtkEnableEvents(); + bool IsOwnGtkWindow( GdkWindow *window ); + void DoApplyWidgetStyle(GtkRcStyle *style); +#if wxUSE_TOOLTIPS + void ApplyToolTip( GtkTooltips *tips, const wxChar *tip ); +#endif // wxUSE_TOOLTIPS + + virtual void OnInternalIdle(); + + bool m_hasFocus, + m_lostFocus; + wxList m_boxes; + +protected: + // common part of all ctors + void Init(); + +private: + wxDECLARE_DYNAMIC_CLASS(wxRadioBox); +}; + +#endif // _WX_GTK_RADIOBOX_H_ diff --git a/lib/wxWidgets/include/wx/gtk1/radiobut.h b/lib/wxWidgets/include/wx/gtk1/radiobut.h new file mode 100644 index 0000000..d467f71 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/radiobut.h @@ -0,0 +1,66 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/radiobut.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKRADIOBUTTONH__ +#define __GTKRADIOBUTTONH__ + +//----------------------------------------------------------------------------- +// wxRadioButton +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxRadioButton: public wxRadioButtonBase +{ +public: + wxRadioButton() { } + wxRadioButton( wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioButtonNameStr) ) + { + Create( parent, id, label, pos, size, style, validator, name ); + } + + bool Create( wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioButtonNameStr) ); + + virtual void SetLabel(const wxString& label); + virtual void SetValue(bool val); + virtual bool GetValue() const; + virtual bool Enable( bool enable = TRUE ); + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // implementation + + virtual bool IsRadioButton() const { return TRUE; } + + void DoApplyWidgetStyle(GtkRcStyle *style); + bool IsOwnGtkWindow( GdkWindow *window ); + void OnInternalIdle(); + + bool m_blockEvent; + +protected: + virtual wxSize DoGetBestSize() const; + +private: + wxDECLARE_DYNAMIC_CLASS(wxRadioButton); +}; + +#endif // __GTKRADIOBUTTONH__ diff --git a/lib/wxWidgets/include/wx/gtk1/region.h b/lib/wxWidgets/include/wx/gtk1/region.h new file mode 100644 index 0000000..3a2acb7 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/region.h @@ -0,0 +1,125 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/region.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_REGION_H_ +#define _WX_GTK_REGION_H_ + +#include "wx/list.h" + +// ---------------------------------------------------------------------------- +// wxRegion +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxRegion : public wxRegionBase +{ +public: + wxRegion() { } + + wxRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h ) + { + InitRect(x, y, w, h); + } + + wxRegion( const wxPoint& topLeft, const wxPoint& bottomRight ) + { + InitRect(topLeft.x, topLeft.y, + bottomRight.x - topLeft.x, bottomRight.y - topLeft.y); + } + + wxRegion( const wxRect& rect ) + { + InitRect(rect.x, rect.y, rect.width, rect.height); + } + + wxRegion( size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE ); + + wxRegion( const wxBitmap& bmp) + { + Union(bmp); + } + wxRegion( const wxBitmap& bmp, + const wxColour& transColour, int tolerance = 0) + { + Union(bmp, transColour, tolerance); + } + + virtual ~wxRegion(); + + // wxRegionBase methods + virtual void Clear(); + virtual bool IsEmpty() const; + +public: + // Init with GdkRegion, set ref count to 2 so that + // the C++ class will not destroy the region! + wxRegion( GdkRegion *region ); + + GdkRegion *GetRegion() const; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + + // wxRegionBase pure virtuals + virtual bool DoIsEqual(const wxRegion& region) const; + virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const; + virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const; + virtual wxRegionContain DoContainsRect(const wxRect& rect) const; + + virtual bool DoOffset(wxCoord x, wxCoord y); + virtual bool DoUnionWithRect(const wxRect& rect); + virtual bool DoUnionWithRegion(const wxRegion& region); + virtual bool DoIntersect(const wxRegion& region); + virtual bool DoSubtract(const wxRegion& region); + virtual bool DoXor(const wxRegion& region); + + // common part of ctors for a rectangle region + void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h); + +private: + wxDECLARE_DYNAMIC_CLASS(wxRegion); +}; + +// ---------------------------------------------------------------------------- +// wxRegionIterator: decomposes a region into rectangles +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxRegionIterator: public wxObject +{ +public: + wxRegionIterator(); + wxRegionIterator(const wxRegion& region); + + void Reset() { m_current = 0u; } + void Reset(const wxRegion& region); + + bool HaveRects() const; + operator bool () const { return HaveRects(); } + + wxRegionIterator& operator ++ (); + wxRegionIterator operator ++ (int); + + wxCoord GetX() const; + wxCoord GetY() const; + wxCoord GetW() const; + wxCoord GetWidth() const { return GetW(); } + wxCoord GetH() const; + wxCoord GetHeight() const { return GetH(); } + wxRect GetRect() const; + +private: + size_t m_current; + wxRegion m_region; + +private: + wxDECLARE_DYNAMIC_CLASS(wxRegionIterator); +}; + + +#endif + // _WX_GTK_REGION_H_ diff --git a/lib/wxWidgets/include/wx/gtk1/scrolbar.h b/lib/wxWidgets/include/wx/gtk1/scrolbar.h new file mode 100644 index 0000000..fb22b34 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/scrolbar.h @@ -0,0 +1,84 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/scrolbar.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKSCROLLBARH__ +#define __GTKSCROLLBARH__ + +#include "wx/defs.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxScrollBar; + +//----------------------------------------------------------------------------- +// wxScrollBar +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxScrollBar: public wxScrollBarBase +{ +public: + wxScrollBar() + { m_adjust = NULL; m_oldPos = 0.0; } + inline wxScrollBar( wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSB_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxScrollBarNameStr) ) + { + Create( parent, id, pos, size, style, validator, name ); + } + bool Create( wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSB_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxScrollBarNameStr) ); + virtual ~wxScrollBar(); + int GetThumbPosition() const; + int GetThumbSize() const; + int GetPageSize() const; + int GetRange() const; + virtual void SetThumbPosition( int viewStart ); + virtual void SetScrollbar( int position, int thumbSize, int range, int pageSize, + bool refresh = TRUE ); + + // Backward compatibility + // ---------------------- + + int GetValue(void) const; + void SetValue( int viewStart ); + void GetValues( int *viewStart, int *viewLength, int *objectLength, int *pageLength) const; + int GetViewLength() const; + int GetObjectLength() const; + void SetPageSize( int pageLength ); + void SetObjectLength( int objectLength ); + void SetViewLength( int viewLength ); + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // implementation + // -------------- + + bool IsOwnGtkWindow( GdkWindow *window ); + + GtkAdjustment *m_adjust; + float m_oldPos; + +protected: + virtual wxSize DoGetBestSize() const; + +private: + wxDECLARE_DYNAMIC_CLASS(wxScrollBar); +}; + +#endif + // __GTKSCROLLBARH__ diff --git a/lib/wxWidgets/include/wx/gtk1/scrolwin.h b/lib/wxWidgets/include/wx/gtk1/scrolwin.h new file mode 100644 index 0000000..28fe926 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/scrolwin.h @@ -0,0 +1,57 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/scrolwin.h +// Purpose: wxScrolledWindow class +// Author: Robert Roebling +// Modified by: Vadim Zeitlin (2005-10-10): wxScrolledWindow is now common +// Created: 01/02/97 +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_SCROLLWIN_H_ +#define _WX_GTK_SCROLLWIN_H_ + +// ---------------------------------------------------------------------------- +// wxScrolledWindow +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxScrollHelper : public wxScrollHelperBase +{ +public: + wxScrollHelper(wxWindow *win) : wxScrollHelperBase(win) { } + + // implement base class pure virtuals + virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, + int noUnitsX, int noUnitsY, + int xPos = 0, int yPos = 0, + bool noRefresh = false); + virtual bool IsScrollbarShown(int orient) const; + virtual void AdjustScrollbars(); + +protected: + virtual void DoScroll(int x, int y); + virtual void DoShowScrollbars(wxScrollbarVisibility horz, + wxScrollbarVisibility vert); + + // this does (each) half of AdjustScrollbars() work + void DoAdjustScrollbar(GtkAdjustment *adj, + int pixelsPerLine, + int winSize, + int virtSize, + int *pos, + int *lines, + int *linesPerPage); + + // and this does the same for Scroll() + void DoScrollOneDir(int orient, + GtkAdjustment *adj, + int pos, + int pixelsPerLine, + int *posOld); + +private: + wxDECLARE_NO_COPY_CLASS(wxScrollHelper); +}; + +#endif // _WX_GTK_SCROLLWIN_H_ + diff --git a/lib/wxWidgets/include/wx/gtk1/slider.h b/lib/wxWidgets/include/wx/gtk1/slider.h new file mode 100644 index 0000000..4fb4e50 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/slider.h @@ -0,0 +1,73 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/slider.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKSLIDERH__ +#define __GTKSLIDERH__ + +// ---------------------------------------------------------------------------- +// wxSlider +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSlider : public wxSliderBase +{ +public: + wxSlider() { } + wxSlider(wxWindow *parent, + wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxSliderNameStr)) + { + Create( parent, id, value, minValue, maxValue, + pos, size, style, validator, name ); + } + + bool Create(wxWindow *parent, + wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxSliderNameStr)); + + // implement the base class pure virtuals + virtual int GetValue() const; + virtual void SetValue(int value); + + virtual void SetRange(int minValue, int maxValue); + virtual int GetMin() const; + virtual int GetMax() const; + + virtual void SetLineSize(int lineSize); + virtual void SetPageSize(int pageSize); + virtual int GetLineSize() const; + virtual int GetPageSize() const; + + virtual void SetThumbLength(int lenPixels); + virtual int GetThumbLength() const; + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // implementation + bool IsOwnGtkWindow( GdkWindow *window ); + void GtkDisableEvents(); + void GtkEnableEvents(); + + GtkAdjustment *m_adjust; + float m_oldPos; + +private: + wxDECLARE_DYNAMIC_CLASS(wxSlider); +}; + +#endif // __GTKSLIDERH__ diff --git a/lib/wxWidgets/include/wx/gtk1/spinbutt.h b/lib/wxWidgets/include/wx/gtk1/spinbutt.h new file mode 100644 index 0000000..f59970b --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/spinbutt.h @@ -0,0 +1,64 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/spinbutt.h +// Purpose: wxSpinButton class +// Author: Robert Roebling +// Modified by: +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_SPINBUTT_H_ +#define _WX_GTK_SPINBUTT_H_ + +//----------------------------------------------------------------------------- +// wxSpinButton +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSpinButton : public wxSpinButtonBase +{ +public: + wxSpinButton() { } + wxSpinButton(wxWindow *parent, + wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_VERTICAL, + const wxString& name = wxSPIN_BUTTON_NAME) + { + Create(parent, id, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_VERTICAL, + const wxString& name = wxSPIN_BUTTON_NAME); + + virtual int GetValue() const; + virtual void SetValue( int value ); + virtual void SetRange( int minVal, int maxVal ); + virtual int GetMin() const; + virtual int GetMax() const; + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // implementation + void OnSize( wxSizeEvent &event ); + + bool IsOwnGtkWindow( GdkWindow *window ); + + GtkAdjustment *m_adjust; + float m_oldPos; + +protected: + virtual wxSize DoGetBestSize() const; + +private: + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxSpinButton); +}; + +#endif + // _WX_GTK_SPINBUTT_H_ diff --git a/lib/wxWidgets/include/wx/gtk1/spinctrl.h b/lib/wxWidgets/include/wx/gtk1/spinctrl.h new file mode 100644 index 0000000..521ac96 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/spinctrl.h @@ -0,0 +1,103 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/spinctrl.h +// Purpose: wxSpinCtrl class +// Author: Robert Roebling +// Modified by: +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKSPINCTRLH__ +#define __GTKSPINCTRLH__ + +#include "wx/defs.h" + +#if wxUSE_SPINCTRL + +#include "wx/control.h" + +//----------------------------------------------------------------------------- +// wxSpinCtrl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSpinCtrl : public wxControl +{ +public: + wxSpinCtrl() {} + wxSpinCtrl(wxWindow *parent, + wxWindowID id = -1, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + int min = 0, int max = 100, int initial = 0, + const wxString& name = wxT("wxSpinCtrl")) + { + Create(parent, id, value, pos, size, style, min, max, initial, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = -1, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + int min = 0, int max = 100, int initial = 0, + const wxString& name = wxT("wxSpinCtrl")); + + void SetValue(const wxString& text); + void SetSelection(long from, long to); + + virtual wxString GetTextValue() const; + virtual int GetValue() const; + virtual void SetValue( int value ); + virtual void SetRange( int minVal, int maxVal ); + virtual int GetMin() const; + virtual int GetMax() const; + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // implementation + void OnChar( wxKeyEvent &event ); + + bool IsOwnGtkWindow( GdkWindow *window ); + void GtkDisableEvents(); + void GtkEnableEvents(); + + void SetIncrement(int inc) { DoSetIncrement(inc); } + int GetIncrement() const { return int(DoGetIncrement()); } + + GtkAdjustment *m_adjust; + float m_oldPos; + + virtual int GetBase() const { return m_base; } + virtual bool SetBase(int base); + + protected: + virtual wxSize DoGetBestSize() const; + void DoSetIncrement(double inc); + double DoGetIncrement() const; + + // Widgets that use the style->base colour for the BG colour should + // override this and return true. + virtual bool UseGTKStyleBase() const { return true; } + +private: + // Common part of all ctors. + void Init() + { + m_base = 10; + } + + int m_base; + + wxDECLARE_DYNAMIC_CLASS(wxSpinCtrl); + wxDECLARE_EVENT_TABLE(); +}; + +#endif + // wxUSE_SPINCTRL + +#endif + // __GTKSPINCTRLH__ diff --git a/lib/wxWidgets/include/wx/gtk1/statbmp.h b/lib/wxWidgets/include/wx/gtk1/statbmp.h new file mode 100644 index 0000000..6763b95 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/statbmp.h @@ -0,0 +1,48 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/statbmp.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKSTATICBITMAPH__ +#define __GTKSTATICBITMAPH__ + +#include "wx/icon.h" + +//----------------------------------------------------------------------------- +// wxStaticBitmap +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxStaticBitmap : public wxStaticBitmapBase +{ +public: + wxStaticBitmap(); + wxStaticBitmap( wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBitmapNameStr) ); + bool Create( wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBitmapNameStr)); + + virtual void SetBitmap( const wxBitmapBundle& bitmap ); + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + +private: + wxBitmap m_bitmap; + + wxDECLARE_DYNAMIC_CLASS(wxStaticBitmap); +}; + +#endif // __GTKSTATICBITMAPH__ diff --git a/lib/wxWidgets/include/wx/gtk1/statbox.h b/lib/wxWidgets/include/wx/gtk1/statbox.h new file mode 100644 index 0000000..c3e881a --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/statbox.h @@ -0,0 +1,51 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/statbox.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKSTATICBOXH__ +#define __GTKSTATICBOXH__ + +//----------------------------------------------------------------------------- +// wxStaticBox +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxStaticBox : public wxStaticBoxBase +{ +public: + wxStaticBox(); + wxStaticBox( wxWindow *parent, + wxWindowID id, + const wxString &label, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxString &name = wxASCII_STR(wxStaticBoxNameStr) ); + bool Create( wxWindow *parent, + wxWindowID id, + const wxString &label, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxString &name = wxASCII_STR(wxStaticBoxNameStr) ); + + virtual void SetLabel( const wxString &label ); + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // implementation + + virtual bool IsTransparentForMouse() const { return TRUE; } + +protected: + void DoApplyWidgetStyle(GtkRcStyle *style); + +private: + wxDECLARE_DYNAMIC_CLASS(wxStaticBox); +}; + +#endif // __GTKSTATICBOXH__ diff --git a/lib/wxWidgets/include/wx/gtk1/statline.h b/lib/wxWidgets/include/wx/gtk1/statline.h new file mode 100644 index 0000000..29e8b7f --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/statline.h @@ -0,0 +1,48 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/statline.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKSTATICLINEH__ +#define __GTKSTATICLINEH__ + +#include "wx/defs.h" + +#if wxUSE_STATLINE + +// ---------------------------------------------------------------------------- +// wxStaticLine +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxStaticLine : public wxStaticLineBase +{ +public: + wxStaticLine(); + wxStaticLine(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint &pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxASCII_STR(wxStaticLineNameStr)); + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxASCII_STR(wxStaticLineNameStr)); + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + +private: + wxDECLARE_DYNAMIC_CLASS(wxStaticLine); +}; + +#endif // wxUSE_STATLINE + +#endif // __GTKSTATICLINEH__ + diff --git a/lib/wxWidgets/include/wx/gtk1/stattext.h b/lib/wxWidgets/include/wx/gtk1/stattext.h new file mode 100644 index 0000000..66941c6 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/stattext.h @@ -0,0 +1,57 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/stattext.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKSTATICTEXTH__ +#define __GTKSTATICTEXTH__ + +//----------------------------------------------------------------------------- +// wxStaticText +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxStaticText : public wxStaticTextBase +{ +public: + wxStaticText(); + wxStaticText(wxWindow *parent, + wxWindowID id, + const wxString &label, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxString &name = wxASCII_STR(wxStaticTextNameStr) ); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString &label, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxString &name = wxASCII_STR(wxStaticTextNameStr) ); + + virtual wxString GetLabel() const; + virtual void SetLabel( const wxString &label ); + + virtual bool SetFont( const wxFont &font ); + virtual bool SetForegroundColour( const wxColour& colour ); + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + +protected: + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + + virtual wxSize DoGetBestSize() const; + virtual wxString WXGetVisibleLabel() const wxOVERRIDE; + virtual void WXSetVisibleLabel(const wxString& str) wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxStaticText); +}; + +#endif // __GTKSTATICTEXTH__ diff --git a/lib/wxWidgets/include/wx/gtk1/textctrl.h b/lib/wxWidgets/include/wx/gtk1/textctrl.h new file mode 100644 index 0000000..e7b6300 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/textctrl.h @@ -0,0 +1,195 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/textctrl.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKTEXTCTRLH__ +#define __GTKTEXTCTRLH__ + +//----------------------------------------------------------------------------- +// wxTextCtrl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTextCtrl: public wxTextCtrlBase +{ +public: + wxTextCtrl() { Init(); } + wxTextCtrl(wxWindow *parent, + wxWindowID id, + const wxString &value = wxEmptyString, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString &name = wxASCII_STR(wxTextCtrlNameStr)); + + virtual ~wxTextCtrl(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString &value = wxEmptyString, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString &name = wxASCII_STR(wxTextCtrlNameStr)); + + // implement base class pure virtuals + // ---------------------------------- + + virtual int GetLineLength(long lineNo) const; + virtual wxString GetLineText(long lineNo) const; + virtual int GetNumberOfLines() const; + + virtual bool IsModified() const; + virtual bool IsEditable() const; + + // If the return values from and to are the same, there is no selection. + virtual void GetSelection(long* from, long* to) const; + + // operations + // ---------- + + // editing + virtual void Clear(); + virtual void Replace(long from, long to, const wxString& value); + virtual void Remove(long from, long to); + + // sets/clears the dirty flag + virtual void MarkDirty(); + virtual void DiscardEdits(); + + virtual void SetMaxLength(unsigned long len); + + // writing text inserts it at the current position, appending always + // inserts it at the end + virtual void WriteText(const wxString& text); + virtual void AppendText(const wxString& text); + + // apply text attribute to the range of text (only works with richedit + // controls) + virtual bool SetStyle(long start, long end, const wxTextAttr& style); + + // translate between the position (which is just an index in the text ctrl + // considering all its contents as a single strings) and (x, y) coordinates + // which represent column and line. + virtual long XYToPosition(long x, long y) const; + virtual bool PositionToXY(long pos, long *x, long *y) const; + + virtual void ShowPosition(long pos); + + // Clipboard operations + virtual void Copy(); + virtual void Cut(); + virtual void Paste(); + + // Undo/redo + virtual void Undo(); + virtual void Redo(); + + virtual bool CanUndo() const; + virtual bool CanRedo() const; + + // Insertion point + virtual void SetInsertionPoint(long pos); + virtual void SetInsertionPointEnd(); + virtual long GetInsertionPoint() const; + virtual wxTextPos GetLastPosition() const; + + virtual void SetSelection(long from, long to); + virtual void SetEditable(bool editable); + + virtual void DoEnable( bool enable ); + + // Implementation from now on + void OnDropFiles( wxDropFilesEvent &event ); + void OnChar( wxKeyEvent &event ); + + void OnCut(wxCommandEvent& event); + void OnCopy(wxCommandEvent& event); + void OnPaste(wxCommandEvent& event); + void OnUndo(wxCommandEvent& event); + void OnRedo(wxCommandEvent& event); + + void OnUpdateCut(wxUpdateUIEvent& event); + void OnUpdateCopy(wxUpdateUIEvent& event); + void OnUpdatePaste(wxUpdateUIEvent& event); + void OnUpdateUndo(wxUpdateUIEvent& event); + void OnUpdateRedo(wxUpdateUIEvent& event); + + bool SetFont(const wxFont& font); + bool SetForegroundColour(const wxColour& colour); + bool SetBackgroundColour(const wxColour& colour); + + GtkWidget* GetConnectWidget(); + bool IsOwnGtkWindow( GdkWindow *window ); + void DoApplyWidgetStyle(GtkRcStyle *style); + void CalculateScrollbar(); + void OnInternalIdle(); + + void SetUpdateFont(bool update) { m_updateFont = update; } + void UpdateFontIfNeeded(); + + void SetModified() { m_modified = true; } + + // textctrl specific scrolling + virtual bool ScrollLines(int lines); + virtual bool ScrollPages(int pages); + + // implementation only from now on + + // tell the control to ignore next text changed signal + void IgnoreNextTextUpdate(); + + // should we ignore the changed signal? always resets the flag + bool IgnoreTextUpdate(); + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + +protected: + virtual wxSize DoGetBestSize() const; + + // common part of all ctors + void Init(); + + // overridden wxWindow methods + virtual void DoFreeze(); + virtual void DoThaw(); + + // get the vertical adjustment, if any, NULL otherwise + GtkAdjustment *GetVAdj() const; + + // scroll the control by the given number of pixels, return true if the + // scroll position changed + bool DoScroll(GtkAdjustment *adj, int diff); + + // Widgets that use the style->base colour for the BG colour should + // override this and return true. + virtual bool UseGTKStyleBase() const { return true; } + + virtual void DoSetValue(const wxString &value, int flags = 0); + virtual wxString DoGetValue() const; + +private: + // change the font for everything in this control + void ChangeFontGlobally(); + + GtkWidget *m_text; + GtkWidget *m_vScrollbar; + + bool m_modified:1; + bool m_vScrollbarVisible:1; + bool m_updateFont:1; + bool m_ignoreNextUpdate:1; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxTextCtrl); +}; + +#endif // __GTKTEXTCTRLH__ + diff --git a/lib/wxWidgets/include/wx/gtk1/tglbtn.h b/lib/wxWidgets/include/wx/gtk1/tglbtn.h new file mode 100644 index 0000000..4e243dd --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/tglbtn.h @@ -0,0 +1,136 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/tglbtn.h +// Purpose: Declaration of the wxToggleButton class, which implements a +// toggle button under wxGTK. +// Author: John Norris, minor changes by Axel Schlueter +// Modified by: +// Created: 08.02.01 +// Copyright: (c) 2000 Johnny C. Norris II +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_TOGGLEBUTTON_H_ +#define _WX_GTK_TOGGLEBUTTON_H_ + +#include "wx/bitmap.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxToggleButton; +class WXDLLIMPEXP_FWD_CORE wxToggleBitmapButton; + +//----------------------------------------------------------------------------- +// wxToggleBitmapButton +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxToggleBitmapButton: public wxToggleButtonBase +{ +public: + // construction/destruction + wxToggleBitmapButton() {} + wxToggleBitmapButton(wxWindow *parent, + wxWindowID id, + const wxBitmap& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + // Create the control + bool Create(wxWindow *parent, + wxWindowID id, + const wxBitmap& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)); + + // Get/set the value + void SetValue(bool state); + bool GetValue() const; + + // Set the label + virtual void SetLabel(const wxString& label) { wxControl::SetLabel(label); } + virtual void SetLabel(const wxBitmap& label); + bool Enable(bool enable = TRUE); + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // implementation + bool m_blockEvent; + wxBitmap m_bitmap; + + void OnSetBitmap(); + void DoApplyWidgetStyle(GtkRcStyle *style); + bool IsOwnGtkWindow(GdkWindow *window); + + virtual void OnInternalIdle(); + virtual wxSize DoGetBestSize() const; + +private: + wxDECLARE_DYNAMIC_CLASS(wxToggleBitmapButton); +}; + +//----------------------------------------------------------------------------- +// wxToggleButton +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxToggleButton: public wxControl +{ +public: + // construction/destruction + wxToggleButton() {} + wxToggleButton(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + // Create the control + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)); + + // Get/set the value + void SetValue(bool state); + bool GetValue() const; + + // Set the label + void SetLabel(const wxString& label); + bool Enable(bool enable = TRUE); + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // implementation + bool m_blockEvent; + + void DoApplyWidgetStyle(GtkRcStyle *style); + bool IsOwnGtkWindow(GdkWindow *window); + + virtual void OnInternalIdle(); + virtual wxSize DoGetBestSize() const; + +private: + wxDECLARE_DYNAMIC_CLASS(wxToggleButton); +}; + +#endif // _WX_GTK_TOGGLEBUTTON_H_ + diff --git a/lib/wxWidgets/include/wx/gtk1/toolbar.h b/lib/wxWidgets/include/wx/gtk1/toolbar.h new file mode 100644 index 0000000..fdaf1b7 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/toolbar.h @@ -0,0 +1,102 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/toolbar.h +// Purpose: GTK toolbar +// Author: Robert Roebling +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_TOOLBAR_H_ +#define _WX_GTK_TOOLBAR_H_ + +#if wxUSE_TOOLBAR + +// ---------------------------------------------------------------------------- +// wxToolBar +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxToolBar : public wxToolBarBase +{ +public: + // construction/destruction + wxToolBar() { Init(); } + wxToolBar( wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxToolBarNameStr) ) + { + Init(); + + Create(parent, id, pos, size, style, name); + } + + bool Create( wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxToolBarNameStr) ); + + virtual ~wxToolBar(); + + // override base class virtuals + virtual void SetMargins(int x, int y); + virtual void SetToolSeparation(int separation); + + virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; + + virtual void SetToolShortHelp(int id, const wxString& helpString); + + virtual void SetWindowStyleFlag( long style ); + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // implementation from now on + // -------------------------- + + GtkToolbar *m_toolbar; + + bool m_blockEvent; + + void OnInternalIdle(); + +protected: + // common part of all ctors + void Init(); + + // choose the default border for this window + virtual wxBorder GetDefaultBorder() const { return wxBORDER_DEFAULT; } + + // set the GTK toolbar style and orientation + void GtkSetStyle(); + + // implement base class pure virtuals + virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); + virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); + + virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); + virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); + virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); + + virtual wxToolBarToolBase *CreateTool(int id, + const wxString& label, + const wxBitmapBundle& bitmap1, + const wxBitmapBundle& bitmap2, + wxItemKind kind, + wxObject *clientData, + const wxString& shortHelpString, + const wxString& longHelpString); + virtual wxToolBarToolBase *CreateTool(wxControl *control, + const wxString& label); + +private: + wxDECLARE_DYNAMIC_CLASS(wxToolBar); +}; + +#endif // wxUSE_TOOLBAR + +#endif + // _WX_GTK_TOOLBAR_H_ diff --git a/lib/wxWidgets/include/wx/gtk1/tooltip.h b/lib/wxWidgets/include/wx/gtk1/tooltip.h new file mode 100644 index 0000000..77ced7e --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/tooltip.h @@ -0,0 +1,57 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/tooltip.h +// Purpose: wxToolTip class +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKTOOLTIPH__ +#define __GTKTOOLTIPH__ + +#include "wx/defs.h" +#include "wx/string.h" +#include "wx/object.h" + +//----------------------------------------------------------------------------- +// forward declarations +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxToolTip; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +//----------------------------------------------------------------------------- +// wxToolTip +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxToolTip : public wxObject +{ +public: + // globally change the tooltip parameters + static void Enable( bool flag ); + static void SetDelay( long msecs ); + // set the delay after which the tooltip disappears or how long the tooltip remains visible + static void SetAutoPop(long msecs); + // set the delay between subsequent tooltips to appear + static void SetReshow(long msecs); + + wxToolTip( const wxString &tip ); + + // get/set the tooltip text + void SetTip( const wxString &tip ); + wxString GetTip() const { return m_text; } + + wxWindow *GetWindow() const { return m_window; } + bool IsOk() const { return m_window != NULL; } + + // implementation + void Apply( wxWindow *win ); + +private: + wxString m_text; + wxWindow *m_window; + + wxDECLARE_ABSTRACT_CLASS(wxToolTip); +}; + +#endif // __GTKTOOLTIPH__ diff --git a/lib/wxWidgets/include/wx/gtk1/toplevel.h b/lib/wxWidgets/include/wx/gtk1/toplevel.h new file mode 100644 index 0000000..df43ae9 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/toplevel.h @@ -0,0 +1,129 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/toplevel.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling, Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKTOPLEVELH__ +#define __GTKTOPLEVELH__ + +//----------------------------------------------------------------------------- +// wxTopLevelWindowGTK +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTopLevelWindowGTK : public wxTopLevelWindowBase +{ +public: + // construction + wxTopLevelWindowGTK() { Init(); } + wxTopLevelWindowGTK(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Init(); + + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + virtual ~wxTopLevelWindowGTK(); + + // implement base class pure virtuals + virtual void Maximize(bool maximize = true); + virtual bool IsMaximized() const; + virtual void Iconize(bool iconize = true); + virtual bool IsIconized() const; + virtual void SetIcons(const wxIconBundle& icons); + virtual void Restore(); + + virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); + virtual bool IsFullScreen() const { return m_fsIsShowing; } + + virtual bool SetShape(const wxRegion& region); + + virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO); + + virtual void SetWindowStyleFlag( long style ); + + virtual bool Show(bool show = true); + + virtual void Raise(); + + virtual bool IsActive(); + + virtual void SetTitle( const wxString &title ); + virtual wxString GetTitle() const { return m_title; } + + // Experimental, to allow help windows to be + // viewable from within modal dialogs + virtual void AddGrab(); + virtual void RemoveGrab(); + virtual bool IsGrabbed() const { return m_grabbed; } + + // implementation from now on + // -------------------------- + + // move the window to the specified location and resize it: this is called + // from both DoSetSize() and DoSetClientSize() + virtual void DoMoveWindow(int x, int y, int width, int height); + + // GTK callbacks + virtual void GtkOnSize( int x, int y, int width, int height ); + virtual void OnInternalIdle(); + + // do *not* call this to iconize the frame, this is a private function! + void SetIconizeState(bool iconic); + + int m_miniEdge, + m_miniTitle; + GtkWidget *m_mainWidget; + bool m_insertInClientArea; /* not from within OnCreateXXX */ + + bool m_fsIsShowing; /* full screen */ + long m_fsSaveGdkFunc, m_fsSaveGdkDecor; + long m_fsSaveFlag; + wxRect m_fsSaveFrame; + + // m_windowStyle translated to GDK's terms + long m_gdkFunc, + m_gdkDecor; + + // private gtk_timeout_add result for mimicking wxUSER_ATTENTION_INFO and + // wxUSER_ATTENTION_ERROR difference, -2 for no hint, -1 for ERROR hint, rest for GtkTimeout handle. + int m_urgency_hint; + +protected: + // common part of all ctors + void Init(); + + // override wxWindow methods to take into account tool/menu/statusbars + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + + virtual void DoSetClientSize(int width, int height); + virtual void DoGetClientSize( int *width, int *height ) const; + + wxString m_title; + + // is the frame currently iconized? + bool m_isIconized; + // is the frame currently grabbed explicitly + // by the application? + bool m_grabbed; +}; + +#endif // __GTKTOPLEVELH__ diff --git a/lib/wxWidgets/include/wx/gtk1/treectrl.h b/lib/wxWidgets/include/wx/gtk1/treectrl.h new file mode 100644 index 0000000..d584333 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/treectrl.h @@ -0,0 +1,364 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/treectrl.h +// Purpose: wxTreeCtrl class +// Author: Denis Pershin +// Modified by: +// Created: 08/08/98 +// Copyright: (c) Denis Pershin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TREECTRL_H_ +#define _WX_TREECTRL_H_ + +#include "wx/textctrl.h" +#include "wx/imaglist.h" + +#include + +// the type for "untyped" data +typedef long wxDataType; + +// fwd decl +class WXDLLIMPEXP_CORE wxImageList; +struct wxTreeViewItem; + +// a callback function used for sorting tree items, it should return -1 if the +// first item precedes the second, +1 if the second precedes the first or 0 if +// they're equivalent +class WXDLLIMPEXP_FWD_CORE wxTreeItemData; +typedef int (*wxTreeItemCmpFunc)(wxTreeItemData *item1, wxTreeItemData *item2); + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// values for the `flags' parameter of wxTreeCtrl::HitTest() which determine +// where exactly the specified point is situated: + // above the client area. +static const int wxTREE_HITTEST_ABOVE = 0x0001; + // below the client area. +static const int wxTREE_HITTEST_BELOW = 0x0002; + // in the client area but below the last item. +static const int wxTREE_HITTEST_NOWHERE = 0x0004; + // on the button associated with an item. +static const int wxTREE_HITTEST_ONITEMBUTTON = 0x0010; + // on the bitmap associated with an item. +static const int wxTREE_HITTEST_ONITEMICON = 0x0020; + // in the indentation associated with an item. +static const int wxTREE_HITTEST_ONITEMINDENT = 0x0040; + // on the label (string) associated with an item. +static const int wxTREE_HITTEST_ONITEMLABEL = 0x0080; + // in the area to the right of an item. +static const int wxTREE_HITTEST_ONITEMRIGHT = 0x0100; + // on the state icon for a tree view item that is in a user-defined state. +static const int wxTREE_HITTEST_ONITEMSTATEICON = 0x0200; + // to the right of the client area. +static const int wxTREE_HITTEST_TOLEFT = 0x0400; + // to the left of the client area. +static const int wxTREE_HITTEST_TORIGHT = 0x0800; + // anywhere on the item +static const int wxTREE_HITTEST_ONITEM = wxTREE_HITTEST_ONITEMICON | + wxTREE_HITTEST_ONITEMLABEL | + wxTREE_HITTEST_ONITEMSTATEICON; + +// ---------------------------------------------------------------------------- +// wxTreeItemId identifies an element of the tree. In this implementation, it's +// just a trivial wrapper around GTK GtkTreeItem *. It's opaque for the +// application. +// ---------------------------------------------------------------------------- +class WXDLLIMPEXP_CORE wxTreeItemId { +public: + // ctors + wxTreeItemId() { m_itemId = NULL; } + + // default copy ctor/assignment operator are ok for us + + // accessors + // is this a valid tree item? + bool IsOk() const { return m_itemId != NULL; } + + // conversion to/from either real (system-dependent) tree item id or + // to "long" which used to be the type for tree item ids in previous + // versions of wxWidgets + + // for wxTreeCtrl usage only + wxTreeItemId(GtkTreeItem *itemId) { m_itemId = itemId; } + operator GtkTreeItem *() const { return m_itemId; } + void operator =(GtkTreeItem *item) { m_itemId = item; } + +protected: + GtkTreeItem *m_itemId; +}; + +// ---------------------------------------------------------------------------- +// wxTreeItemData is some (arbitrary) user class associated with some item. The +// main advantage of having this class (compared to old untyped interface) is +// that wxTreeItemData's are destroyed automatically by the tree and, as this +// class has virtual dtor, it means that the memory will be automatically +// freed. OTOH, we don't just use wxObject instead of wxTreeItemData because +// the size of this class is critical: in any real application, each tree leaf +// will have wxTreeItemData associated with it and number of leaves may be +// quite big. +// +// Because the objects of this class are deleted by the tree, they should +// always be allocated on the heap! +// ---------------------------------------------------------------------------- +class WXDLLIMPEXP_CORE wxTreeItemData : private wxTreeItemId { +public: + // default ctor/copy ctor/assignment operator are ok + + // dtor is virtual and all the items are deleted by the tree control when + // it's deleted, so you normally don't have to care about freeing memory + // allocated in your wxTreeItemData-derived class + virtual ~wxTreeItemData() { } + + // accessors: set/get the item associated with this node + void SetId(const wxTreeItemId& id) { m_itemId = id; } + const wxTreeItemId& GetId() const { return (wxTreeItemId&) m_itemId; } +}; + +class WXDLLIMPEXP_CORE wxTreeCtrl: public wxControl { +public: + // creation + // -------- + wxTreeCtrl() { Init(); } + + wxTreeCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR("wxTreeCtrl")) { + Create(parent, id, pos, size, style, validator, name); + } + + virtual ~wxTreeCtrl(); + + bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR("wxTreeCtrl")); + + // accessors + // --------- + + // get the total number of items in the control + virtual unsigned int GetCount() const; + + // indent is the number of pixels the children are indented relative to + // the parents position. SetIndent() also redraws the control + // immediately. + unsigned int GetIndent() const; + void SetIndent(unsigned int indent); + + // image list: these functions allow to associate an image list with + // the control and retrieve it. Note that the control does _not_ delete + // the associated image list when it's deleted in order to allow image + // lists to be shared between different controls. + // + // The normal image list is for the icons which correspond to the + // normal tree item state (whether it is selected or not). + // Additionally, the application might choose to show a state icon + // which corresponds to an app-defined item state (for example, + // checked/unchecked) which are taken from the state image list. + wxImageList *GetImageList() const; + wxImageList *GetStateImageList() const; + + void SetImageList(wxImageList *imageList); + void SetStateImageList(wxImageList *imageList); + + // Functions to work with tree ctrl items. Unfortunately, they can _not_ be + // member functions of wxTreeItem because they must know the tree the item + // belongs to for Windows implementation and storing the pointer to + // wxTreeCtrl in each wxTreeItem is just too much waste. + + // accessors + // --------- + + // retrieve items label + wxString GetItemText(const wxTreeItemId& item) const; + // get the normal item image + int GetItemImage(const wxTreeItemId& item) const; + // get the data associated with the item + wxTreeItemData *GetItemData(const wxTreeItemId& item) const; + + // modifiers + // --------- + + // set items label + void SetItemText(const wxTreeItemId& item, const wxString& text); + // set the normal item image + void SetItemImage(const wxTreeItemId& item, int image); + // associate some data with the item + void SetItemData(const wxTreeItemId& item, wxTreeItemData *data); + + // item status inquiries + // --------------------- + + // is the item visible (it might be outside the view or not expanded)? + bool IsVisible(const wxTreeItemId& item) const; + // does the item has any children? + bool ItemHasChildren(const wxTreeItemId& item) const; + // is the item expanded (only makes sense if HasChildren())? + bool IsExpanded(const wxTreeItemId& item) const; + // is this item currently selected (the same as has focus)? + bool IsSelected(const wxTreeItemId& item) const; + + // number of children + // ------------------ + + // if 'recursively' is false, only immediate children count, otherwise + // the returned number is the number of all items in this branch + size_t GetChildrenCount(const wxTreeItemId& item, bool recursively = true); + + // navigation + // ---------- + + // wxTreeItemId.IsOk() will return false if there is no such item + + // get the root tree item + wxTreeItemId GetRootItem() const; + + // get the item currently selected (may return NULL if no selection) + wxTreeItemId GetSelection() const; + + // get the parent of this item (may return NULL if root) + wxTreeItemId GetItemParent(const wxTreeItemId& item) const; + + // for this enumeration function you must pass in a "cookie" parameter + // which is opaque for the application but is necessary for the library + // to make these functions reentrant (i.e. allow more than one + // enumeration on one and the same object simultaneously). Of course, + // the "cookie" passed to GetFirstChild() and GetNextChild() should be + // the same! + + // get the last child of this item - this method doesn't use cookies + wxTreeItemId GetLastChild(const wxTreeItemId& item) const; + + // get the next sibling of this item + wxTreeItemId GetNextSibling(const wxTreeItemId& item) const; + // get the previous sibling + wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const; + + // get first visible item + wxTreeItemId GetFirstVisibleItem() const; + // get the next visible item: item must be visible itself! + // see IsVisible() and wxTreeCtrl::GetFirstVisibleItem() + wxTreeItemId GetNextVisible(const wxTreeItemId& item) const; + // get the previous visible item: item must be visible itself! + wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const; + + // operations + // ---------- + + // add the root node to the tree + wxTreeItemId AddRoot(const wxString& text, + int image = -1, int selectedImage = -1, + wxTreeItemData *data = NULL); + + // insert a new item in as the first child of the parent + wxTreeItemId PrependItem(const wxTreeItemId& parent, + const wxString& text, + int image = -1, int selectedImage = -1, + wxTreeItemData *data = NULL); + + // insert a new item after a given one + wxTreeItemId InsertItem(const wxTreeItemId& parent, + const wxTreeItemId& idPrevious, + const wxString& text, + int image = -1, int selectedImage = -1, + wxTreeItemData *data = NULL); + + // insert a new item in as the last child of the parent + wxTreeItemId AppendItem(const wxTreeItemId& parent, + const wxString& text, + int image = -1, int selectedImage = -1, + wxTreeItemData *data = NULL); + + // delete this item and associated data if any + void Delete(const wxTreeItemId& item); + // delete all items from the tree + void DeleteAllItems(); + + // expand this item + void Expand(const wxTreeItemId& item); + // collapse the item without removing its children + void Collapse(const wxTreeItemId& item); + // collapse the item and remove all children + void CollapseAndReset(const wxTreeItemId& item); + // toggles the current state + void Toggle(const wxTreeItemId& item); + + // remove the selection from currently selected item (if any) + void Unselect(); + // select this item + void SelectItem(const wxTreeItemId& item); + // make sure this item is visible (expanding the parent item and/or + // scrolling to this item if necessary) + void EnsureVisible(const wxTreeItemId& item); + // scroll to this item (but don't expand its parent) + void ScrollTo(const wxTreeItemId& item); + + // start editing the item label: this (temporarily) replaces the item + // with a one line edit control. The item will be selected if it hadn't + // been before. textCtrlClass parameter allows you to create an edit + // control of arbitrary user-defined class deriving from wxTextCtrl. + wxTextCtrl* EditLabel(const wxTreeItemId& item, + wxClassInfo* textCtrlClass = wxCLASSINFO(wxTextCtrl)); + // returns the same pointer as StartEdit() if the item is being edited, + // NULL otherwise (it's assumed that no more than one item may be + // edited simultaneously) + wxTextCtrl* GetEditControl() const; + // end editing and accept or discard the changes to item label + void EndEditLabel(const wxTreeItemId& item, bool discardChanges = false); + + // sort the children of this item using the specified callback function + // (it should return -1, 0 or +1 as usual), if it's not specified + // alphabetical comparison is performed. + // + // NB: this function is not reentrant! + void SortChildren(const wxTreeItemId& item, + wxTreeItemCmpFunc *cmpFunction = NULL); + + // use Set/GetImageList and Set/GetStateImageList + wxImageList *GetImageList(int) const + { return GetImageList(); } + + void SendExpanding(const wxTreeItemId& item); + void SendExpanded(const wxTreeItemId& item); + void SendCollapsing(const wxTreeItemId& item); + void SendCollapsed(const wxTreeItemId& item); + void SendSelChanging(const wxTreeItemId& item); + void SendSelChanged(const wxTreeItemId& item); + +protected: + + wxTreeItemId m_editItem; + GtkTree *m_tree; + GtkTreeItem *m_anchor; + wxTextCtrl* m_textCtrl; + wxImageList* m_imageListNormal; + wxImageList* m_imageListState; + + long m_curitemId; + + void SendMessage(wxEventType command, const wxTreeItemId& item); +// GtkTreeItem *findGtkTreeItem(wxTreeCtrlId &id) const; + + // the common part of all ctors + void Init(); + // insert a new item in as the last child of the parent + wxTreeItemId p_InsertItem(GtkTreeItem *p, + const wxString& text, + int image, int selectedImage, + wxTreeItemData *data); + + + wxDECLARE_DYNAMIC_CLASS(wxTreeCtrl); +}; + +#endif + // _WX_TREECTRL_H_ diff --git a/lib/wxWidgets/include/wx/gtk1/win_gtk.h b/lib/wxWidgets/include/wx/gtk1/win_gtk.h new file mode 100644 index 0000000..09f23c5 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/win_gtk.h @@ -0,0 +1,146 @@ +/* /////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/win_gtk.h +// Purpose: wxWidgets's GTK base widget = GtkPizza +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////// */ + + +#ifndef __GTK_PIZZA_H__ +#define __GTK_PIZZA_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include +#include +#include +#include + +#include "wx/dlimpexp.h" + +#define GTK_PIZZA(obj) GTK_CHECK_CAST (obj, gtk_pizza_get_type (), GtkPizza) +#define GTK_PIZZA_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_pizza_get_type (), GtkPizzaClass) +#define GTK_IS_PIZZA(obj) GTK_CHECK_TYPE (obj, gtk_pizza_get_type ()) + +/* Shadow types */ +typedef enum +{ + GTK_MYSHADOW_NONE, + GTK_MYSHADOW_THIN, + GTK_MYSHADOW_IN, + GTK_MYSHADOW_OUT +} GtkMyShadowType; + +typedef struct _GtkPizzaChild GtkPizzaChild; +typedef struct _GtkPizza GtkPizza; +typedef struct _GtkPizzaClass GtkPizzaClass; + +struct _GtkPizzaChild +{ + GtkWidget *widget; + gint x; + gint y; + gint width; + gint height; +}; + +struct _GtkPizza +{ + GtkContainer container; + GList *children; + GtkMyShadowType shadow_type; + + guint width; + guint height; + + guint xoffset; + guint yoffset; + + GdkWindow *bin_window; + + GdkVisibilityState visibility; + gulong configure_serial; + gint scroll_x; + gint scroll_y; + + gboolean clear_on_draw; + gboolean use_filter; + gboolean external_expose; +}; + +struct _GtkPizzaClass +{ + GtkContainerClass parent_class; + + void (*set_scroll_adjustments) (GtkPizza *pizza, + GtkAdjustment *hadjustment, + GtkAdjustment *vadjustment); +}; + +WXDLLIMPEXP_CORE +GtkType gtk_pizza_get_type (void); +WXDLLIMPEXP_CORE +GtkWidget* gtk_pizza_new (void); + +WXDLLIMPEXP_CORE +void gtk_pizza_set_shadow_type (GtkPizza *pizza, + GtkMyShadowType type); + +WXDLLIMPEXP_CORE +void gtk_pizza_set_clear (GtkPizza *pizza, + gboolean clear); + +WXDLLIMPEXP_CORE +void gtk_pizza_set_filter (GtkPizza *pizza, + gboolean use); + +WXDLLIMPEXP_CORE +void gtk_pizza_set_external (GtkPizza *pizza, + gboolean expose); + +WXDLLIMPEXP_CORE +void gtk_pizza_scroll (GtkPizza *pizza, + gint dx, + gint dy); + +WXDLLIMPEXP_CORE +gint gtk_pizza_child_resized (GtkPizza *pizza, + GtkWidget *widget); + +WXDLLIMPEXP_CORE +void gtk_pizza_put (GtkPizza *pizza, + GtkWidget *widget, + gint x, + gint y, + gint width, + gint height); + +WXDLLIMPEXP_CORE +void gtk_pizza_move (GtkPizza *pizza, + GtkWidget *widget, + gint x, + gint y ); + +WXDLLIMPEXP_CORE +void gtk_pizza_resize (GtkPizza *pizza, + GtkWidget *widget, + gint width, + gint height ); + +WXDLLIMPEXP_CORE +void gtk_pizza_set_size (GtkPizza *pizza, + GtkWidget *widget, + gint x, + gint y, + gint width, + gint height); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __GTK_PIZZA_H__ */ diff --git a/lib/wxWidgets/include/wx/gtk1/window.h b/lib/wxWidgets/include/wx/gtk1/window.h new file mode 100644 index 0000000..c945cc2 --- /dev/null +++ b/lib/wxWidgets/include/wx/gtk1/window.h @@ -0,0 +1,273 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk1/window.h +// Purpose: +// Author: Robert Roebling +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKWINDOWH__ +#define __GTKWINDOWH__ + +typedef struct _GtkTooltips GtkTooltips; +#ifdef HAVE_XIM +typedef struct _GdkIC GdkIC; +typedef struct _GdkICAttr GdkICAttr; +#endif + +//----------------------------------------------------------------------------- +// callback definition for inserting a window (internal) +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxWindowGTK; +typedef void (*wxInsertChildFunction)( wxWindowGTK*, wxWindowGTK* ); + +//----------------------------------------------------------------------------- +// wxWindowGTK +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWindowGTK : public wxWindowBase +{ +public: + // creating the window + // ------------------- + wxWindowGTK(); + wxWindowGTK(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)); + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)); + virtual ~wxWindowGTK(); + + // implement base class (pure) virtual methods + // ------------------------------------------- + + virtual void SetLabel(const wxString& WXUNUSED(label)) { } + virtual wxString GetLabel() const { return wxEmptyString; } + + virtual bool Destroy(); + + virtual void Raise(); + virtual void Lower(); + + virtual bool Show( bool show = true ); + virtual void DoEnable( bool enable ); + + virtual void SetWindowStyleFlag( long style ); + + virtual bool IsRetained() const; + + virtual void SetFocus(); + virtual bool AcceptsFocus() const; + + virtual bool Reparent( wxWindowBase *newParent ); + + virtual void WarpPointer(int x, int y); + + virtual void Refresh( bool eraseBackground = true, + const wxRect *rect = (const wxRect *) NULL ); + virtual void Update(); + virtual void ClearBackground(); + + virtual bool SetBackgroundColour( const wxColour &colour ); + virtual bool SetForegroundColour( const wxColour &colour ); + virtual bool SetCursor( const wxCursor &cursor ); + virtual bool SetFont( const wxFont &font ); + + virtual bool SetBackgroundStyle(wxBackgroundStyle style) ; + + virtual int GetCharHeight() const; + virtual int GetCharWidth() const; + + virtual void SetScrollbar( int orient, int pos, int thumbVisible, + int range, bool refresh = true ); + virtual void SetScrollPos( int orient, int pos, bool refresh = true ); + virtual int GetScrollPos( int orient ) const; + virtual int GetScrollThumb( int orient ) const; + virtual int GetScrollRange( int orient ) const; + virtual void ScrollWindow( int dx, int dy, + const wxRect* rect = NULL ); + +#if wxUSE_DRAG_AND_DROP + virtual void SetDropTarget( wxDropTarget *dropTarget ); +#endif // wxUSE_DRAG_AND_DROP + + virtual bool IsDoubleBuffered() const { return false; } + + GdkWindow* GTKGetDrawingWindow() const; + + // implementation + // -------------- + + virtual WXWidget GetHandle() const { return m_widget; } + + // I don't want users to override what's done in idle so everything that + // has to be done in idle time in order for wxGTK to work is done in + // OnInternalIdle + virtual void OnInternalIdle(); + + // Internal representation of Update() + void GtkUpdate(); + + // For compatibility across platforms (not in event table) + void OnIdle(wxIdleEvent& WXUNUSED(event)) {} + + // Used by all window classes in the widget creation process. + bool PreCreation( wxWindowGTK *parent, const wxPoint &pos, const wxSize &size ); + void PostCreation(); + + // Internal addition of child windows. differs from class + // to class not by using virtual functions but by using + // the m_insertCallback. + void DoAddChild(wxWindowGTK *child); + + // This methods sends wxPaintEvents to the window. It reads the + // update region, breaks it up into rects and sends an event + // for each rect. It is also responsible for background erase + // events and NC paint events. It is called from "draw" and + // "expose" handlers as well as from ::Update() + void GtkSendPaintEvents(); + + // The methods below are required because many native widgets + // are composed of several subwidgets and setting a style for + // the widget means setting it for all subwidgets as well. + // also, it is not clear which native widget is the top + // widget where (most of) the input goes. even tooltips have + // to be applied to all subwidgets. + virtual GtkWidget* GetConnectWidget(); + virtual bool IsOwnGtkWindow( GdkWindow *window ); + void ConnectWidget( GtkWidget *widget ); + +#if wxUSE_TOOLTIPS + virtual void ApplyToolTip( GtkTooltips *tips, const wxChar *tip ); +#endif // wxUSE_TOOLTIPS + + // Call after modifying the value of m_hAdjust or m_vAdjust to bring the + // scrollbar in sync (this does not generate any wx events) + void GtkUpdateScrollbar(int orient); + + // Called from GTK signal handlers. it indicates that + // the layout functions have to be called later on + // (i.e. in idle time, implemented in OnInternalIdle() ). + void GtkUpdateSize() { m_sizeSet = false; } + + // fix up the mouse event coords, used by wxListBox only so far + virtual void FixUpMouseEvent(GtkWidget * WXUNUSED(widget), + wxCoord& WXUNUSED(x), + wxCoord& WXUNUSED(y)) { } + + // is this window transparent for the mouse events (as wxStaticBox is)? + virtual bool IsTransparentForMouse() const { return false; } + + // is this a radiobutton (used by radiobutton code itself only)? + virtual bool IsRadioButton() const { return false; } + + // position and size of the window + int m_x, m_y; + int m_width, m_height; + int m_oldClientWidth,m_oldClientHeight; + + // see the docs in src/gtk/window.cpp + GtkWidget *m_widget; // mostly the widget seen by the rest of GTK + GtkWidget *m_wxwindow; // mostly the client area as per wxWidgets + + // this widget will be queried for GTK's focus events + GtkWidget *m_focusWidget; + +#ifdef HAVE_XIM + // XIM support for wxWidgets + GdkIC *m_ic; + GdkICAttr *m_icattr; +#endif // HAVE_XIM + + // The area to be cleared (and not just refreshed) + // We cannot make this distinction under GTK 2.0. + wxRegion m_clearRegion; + + // scrolling stuff + GtkAdjustment *m_hAdjust,*m_vAdjust; + float m_oldHorizontalPos; + float m_oldVerticalPos; + + // extra (wxGTK-specific) flags + bool m_needParent:1; // ! wxFrame, wxDialog, wxNotebookPage ? + bool m_noExpose:1; // wxGLCanvas has its own redrawing + bool m_nativeSizeEvent:1; // wxGLCanvas sends wxSizeEvent upon "alloc_size" + bool m_hasScrolling:1; + bool m_hasVMT:1; + bool m_sizeSet:1; + bool m_resizing:1; + bool m_acceptsFocus:1; // true if not static + bool m_hasFocus:1; // true if == FindFocus() + bool m_isScrolling:1; // dragging scrollbar thumb? + bool m_clipPaintRegion:1; // true after ScrollWindow() + bool m_needsStyleChange:1; // May not be able to change + // background style until OnIdle + + // C++ has no virtual methods in the constructor of any class but we need + // different methods of inserting a child window into a wxFrame, + // wxMDIFrame, wxNotebook etc. this is the callback that will get used. + wxInsertChildFunction m_insertCallback; + + // implement the base class pure virtuals + virtual void DoGetTextExtent(const wxString& string, + int *x, int *y, + int *descent = NULL, + int *externalLeading = NULL, + const wxFont *theFont = NULL) const; + +#if wxUSE_MENUS_NATIVE + virtual bool DoPopupMenu( wxMenu *menu, int x, int y ); +#endif // wxUSE_MENUS_NATIVE + + virtual void DoClientToScreen( int *x, int *y ) const; + virtual void DoScreenToClient( int *x, int *y ) const; + virtual void DoGetPosition( int *x, int *y ) const; + virtual void DoGetSize( int *width, int *height ) const; + virtual void DoGetClientSize( int *width, int *height ) const; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + virtual void DoSetClientSize(int width, int height); + virtual void DoMoveWindow(int x, int y, int width, int height); + + virtual void DoCaptureMouse(); + virtual void DoReleaseMouse(); + +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip( wxToolTip *tip ); +#endif // wxUSE_TOOLTIPS + +protected: + // common part of all ctors (not virtual because called from ctor) + void Init(); + + // Called by ApplyWidgetStyle (which is called by SetFont() and + // SetXXXColour etc to apply style changed to native widgets) to create + // modified GTK style with non-standard attributes. If forceStyle=true, + // creates empty GtkRcStyle if there are no modifications, otherwise + // returns NULL in such case. + GtkRcStyle *CreateWidgetStyle(bool forceStyle = false); + + // Overridden in many GTK widgets who have to handle subwidgets + virtual void ApplyWidgetStyle(bool forceStyle = false); + + // helper function to ease native widgets wrapping, called by + // ApplyWidgetStyle -- override this, not ApplyWidgetStyle + virtual void DoApplyWidgetStyle(GtkRcStyle *style); + +private: + wxDECLARE_DYNAMIC_CLASS(wxWindowGTK); + wxDECLARE_NO_COPY_CLASS(wxWindowGTK); +}; + +extern WXDLLIMPEXP_CORE wxWindow *wxFindFocusedChild(wxWindowGTK *win); + +#endif // __GTKWINDOWH__ diff --git a/lib/wxWidgets/include/wx/hash.h b/lib/wxWidgets/include/wx/hash.h new file mode 100644 index 0000000..b28738b --- /dev/null +++ b/lib/wxWidgets/include/wx/hash.h @@ -0,0 +1,315 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/hash.h +// Purpose: wxHashTable class +// Author: Julian Smart +// Modified by: VZ at 25.02.00: type safe hashes with WX_DECLARE_HASH() +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HASH_H__ +#define _WX_HASH_H__ + +#include "wx/defs.h" +#include "wx/string.h" + +#if !wxUSE_STD_CONTAINERS + #include "wx/object.h" +#else + class WXDLLIMPEXP_FWD_BASE wxObject; +#endif + +// the default size of the hash +#define wxHASH_SIZE_DEFAULT (1000) + +/* + * A hash table is an array of user-definable size with lists + * of data items hanging off the array positions. Usually there'll + * be a hit, so no search is required; otherwise we'll have to run down + * the list to find the desired item. +*/ + +union wxHashKeyValue +{ + long integer; + wxString *string; +}; + +// for some compilers (AIX xlC), defining it as friend inside the class is not +// enough, so provide a real forward declaration +class WXDLLIMPEXP_FWD_BASE wxHashTableBase; + +// and clang doesn't like using WXDLLIMPEXP_FWD_BASE inside a typedef. +class WXDLLIMPEXP_FWD_BASE wxHashTableBase_Node; + +class WXDLLIMPEXP_BASE wxHashTableBase_Node +{ + friend class wxHashTableBase; + typedef class wxHashTableBase_Node _Node; +public: + wxHashTableBase_Node( long key, void* value, + wxHashTableBase* table ); + wxHashTableBase_Node( const wxString& key, void* value, + wxHashTableBase* table ); + ~wxHashTableBase_Node(); + + long GetKeyInteger() const { return m_key.integer; } + const wxString& GetKeyString() const { return *m_key.string; } + + void* GetData() const { return m_value; } + void SetData( void* data ) { m_value = data; } + +protected: + _Node* GetNext() const { return m_next; } + +protected: + // next node in the chain + wxHashTableBase_Node* m_next; + + // key + wxHashKeyValue m_key; + + // value + void* m_value; + + // pointer to the hash containing the node, used to remove the + // node from the hash when the user deletes the node iterating + // through it + // TODO: move it to wxHashTable_Node (only wxHashTable supports + // iteration) + wxHashTableBase* m_hashPtr; +}; + +class WXDLLIMPEXP_BASE wxHashTableBase +#if !wxUSE_STD_CONTAINERS + : public wxObject +#endif +{ + friend class WXDLLIMPEXP_FWD_BASE wxHashTableBase_Node; +public: + typedef wxHashTableBase_Node Node; + + wxHashTableBase(); + virtual ~wxHashTableBase() { } + + void Create( wxKeyType keyType = wxKEY_INTEGER, + size_t size = wxHASH_SIZE_DEFAULT ); + void Clear(); + void Destroy(); + + size_t GetSize() const { return m_size; } + size_t GetCount() const { return m_count; } + + void DeleteContents( bool flag ) { m_deleteContents = flag; } + + static long MakeKey(const wxString& string); + +protected: + void DoPut( long key, long hash, void* data ); + void DoPut( const wxString& key, long hash, void* data ); + void* DoGet( long key, long hash ) const; + void* DoGet( const wxString& key, long hash ) const; + void* DoDelete( long key, long hash ); + void* DoDelete( const wxString& key, long hash ); + +private: + // Remove the node from the hash, *only called from + // ~wxHashTable*_Node destructor + void DoRemoveNode( wxHashTableBase_Node* node ); + + // destroys data contained in the node if appropriate: + // deletes the key if it is a string and destroys + // the value if m_deleteContents is true + void DoDestroyNode( wxHashTableBase_Node* node ); + + // inserts a node in the table (at the end of the chain) + void DoInsertNode( size_t bucket, wxHashTableBase_Node* node ); + + // removes a node from the table (fiven a pointer to the previous + // but does not delete it (only deletes its contents) + void DoUnlinkNode( size_t bucket, wxHashTableBase_Node* node, + wxHashTableBase_Node* prev ); + + // unconditionally deletes node value (invoking the + // correct destructor) + virtual void DoDeleteContents( wxHashTableBase_Node* node ) = 0; + +protected: + // number of buckets + size_t m_size; + + // number of nodes (key/value pairs) + size_t m_count; + + // table + Node** m_table; + + // key typ (INTEGER/STRING) + wxKeyType m_keyType; + + // delete contents when hash is cleared + bool m_deleteContents; + +private: + wxDECLARE_NO_COPY_CLASS(wxHashTableBase); +}; + +// ---------------------------------------------------------------------------- +// for compatibility only +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxHashTable_Node : public wxHashTableBase_Node +{ + friend class WXDLLIMPEXP_FWD_BASE wxHashTable; +public: + wxHashTable_Node( long key, void* value, + wxHashTableBase* table ) + : wxHashTableBase_Node( key, value, table ) { } + wxHashTable_Node( const wxString& key, void* value, + wxHashTableBase* table ) + : wxHashTableBase_Node( key, value, table ) { } + + wxObject* GetData() const + { return (wxObject*)wxHashTableBase_Node::GetData(); } + void SetData( wxObject* data ) + { wxHashTableBase_Node::SetData( data ); } + + wxHashTable_Node* GetNext() const + { return (wxHashTable_Node*)wxHashTableBase_Node::GetNext(); } +}; + +// should inherit protectedly, but it is public for compatibility in +// order to publicly inherit from wxObject +class WXDLLIMPEXP_BASE wxHashTable : public wxHashTableBase +{ + typedef wxHashTableBase hash; +public: + typedef wxHashTable_Node Node; + typedef wxHashTable_Node* compatibility_iterator; +public: + wxHashTable( wxKeyType keyType = wxKEY_INTEGER, + size_t size = wxHASH_SIZE_DEFAULT ) + : wxHashTableBase() { Create( keyType, size ); BeginFind(); } + wxHashTable( const wxHashTable& table ); + + virtual ~wxHashTable() { Destroy(); } + + const wxHashTable& operator=( const wxHashTable& ); + + // key and value are the same + void Put(long value, wxObject *object) + { DoPut( value, value, object ); } + void Put(long lhash, long value, wxObject *object) + { DoPut( value, lhash, object ); } + void Put(const wxString& value, wxObject *object) + { DoPut( value, MakeKey( value ), object ); } + void Put(long lhash, const wxString& value, wxObject *object) + { DoPut( value, lhash, object ); } + + // key and value are the same + wxObject *Get(long value) const + { return (wxObject*)DoGet( value, value ); } + wxObject *Get(long lhash, long value) const + { return (wxObject*)DoGet( value, lhash ); } + wxObject *Get(const wxString& value) const + { return (wxObject*)DoGet( value, MakeKey( value ) ); } + wxObject *Get(long lhash, const wxString& value) const + { return (wxObject*)DoGet( value, lhash ); } + + // Deletes entry and returns data if found + wxObject *Delete(long key) + { return (wxObject*)DoDelete( key, key ); } + wxObject *Delete(long lhash, long key) + { return (wxObject*)DoDelete( key, lhash ); } + wxObject *Delete(const wxString& key) + { return (wxObject*)DoDelete( key, MakeKey( key ) ); } + wxObject *Delete(long lhash, const wxString& key) + { return (wxObject*)DoDelete( key, lhash ); } + + // Way of iterating through whole hash table (e.g. to delete everything) + // Not necessary, of course, if you're only storing pointers to + // objects maintained separately + void BeginFind() { m_curr = NULL; m_currBucket = 0; } + Node* Next(); + + void Clear() { wxHashTableBase::Clear(); } + + size_t GetCount() const { return wxHashTableBase::GetCount(); } +protected: + // copy helper + void DoCopy( const wxHashTable& copy ); + + // searches the next node starting from bucket bucketStart and sets + // m_curr to it and m_currBucket to its bucket + void GetNextNode( size_t bucketStart ); +private: + virtual void DoDeleteContents( wxHashTableBase_Node* node ) wxOVERRIDE; + + // current node + Node* m_curr; + + // bucket the current node belongs to + size_t m_currBucket; +}; + +// defines a new type safe hash table which stores the elements of type eltype +// in lists of class listclass +#define _WX_DECLARE_HASH(eltype, dummy, hashclass, classexp) \ + classexp hashclass : public wxHashTableBase \ + { \ + public: \ + hashclass(wxKeyType keyType = wxKEY_INTEGER, \ + size_t size = wxHASH_SIZE_DEFAULT) \ + : wxHashTableBase() { Create(keyType, size); } \ + \ + virtual ~hashclass() { Destroy(); } \ + \ + void Put(long key, eltype *data) { DoPut(key, key, (void*)data); } \ + void Put(long lhash, long key, eltype *data) \ + { DoPut(key, lhash, (void*)data); } \ + eltype *Get(long key) const { return (eltype*)DoGet(key, key); } \ + eltype *Get(long lhash, long key) const \ + { return (eltype*)DoGet(key, lhash); } \ + eltype *Delete(long key) { return (eltype*)DoDelete(key, key); } \ + eltype *Delete(long lhash, long key) \ + { return (eltype*)DoDelete(key, lhash); } \ + private: \ + virtual void DoDeleteContents( wxHashTableBase_Node* node ) wxOVERRIDE\ + { delete (eltype*)node->GetData(); } \ + \ + wxDECLARE_NO_COPY_CLASS(hashclass); \ + } + + +// this macro is to be used in the user code +#define WX_DECLARE_HASH(el, list, hash) \ + _WX_DECLARE_HASH(el, list, hash, class) + +// and this one does exactly the same thing but should be used inside the +// library +#define WX_DECLARE_EXPORTED_HASH(el, list, hash) \ + _WX_DECLARE_HASH(el, list, hash, class WXDLLIMPEXP_CORE) + +#define WX_DECLARE_USER_EXPORTED_HASH(el, list, hash, usergoo) \ + _WX_DECLARE_HASH(el, list, hash, class usergoo) + +// delete all hash elements +// +// NB: the class declaration of the hash elements must be visible from the +// place where you use this macro, otherwise the proper destructor may not +// be called (a decent compiler should give a warning about it, but don't +// count on it)! +#define WX_CLEAR_HASH_TABLE(hash) \ + { \ + (hash).BeginFind(); \ + wxHashTable::compatibility_iterator it = (hash).Next(); \ + while( it ) \ + { \ + delete it->GetData(); \ + it = (hash).Next(); \ + } \ + (hash).Clear(); \ + } + +#endif // _WX_HASH_H__ diff --git a/lib/wxWidgets/include/wx/hashmap.h b/lib/wxWidgets/include/wx/hashmap.h new file mode 100644 index 0000000..d9058b3 --- /dev/null +++ b/lib/wxWidgets/include/wx/hashmap.h @@ -0,0 +1,732 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/hashmap.h +// Purpose: wxHashMap class +// Author: Mattia Barbon +// Modified by: +// Created: 29/01/2002 +// Copyright: (c) Mattia Barbon +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HASHMAP_H_ +#define _WX_HASHMAP_H_ + +#include "wx/string.h" +#include "wx/wxcrt.h" + +// In wxUSE_STD_CONTAINERS build we prefer to use the standard hash map class +// but it can be either in non-standard hash_map header (old g++ and some other +// STL implementations) or in C++0x standard unordered_map which can in turn be +// available either in std::tr1 or std namespace itself +// +// To summarize: if std::unordered_map is available use it, otherwise use tr1 +// and finally fall back to non-standard hash_map + +#if (defined(HAVE_EXT_HASH_MAP) || defined(HAVE_HASH_MAP)) \ + && (defined(HAVE_GNU_CXX_HASH_MAP) || defined(HAVE_STD_HASH_MAP)) + #define HAVE_STL_HASH_MAP +#endif + +#if wxUSE_STD_CONTAINERS && \ + (defined(HAVE_STD_UNORDERED_MAP) || defined(HAVE_TR1_UNORDERED_MAP)) + +#if defined(HAVE_STD_UNORDERED_MAP) + #include + #define WX_HASH_MAP_NAMESPACE std +#elif defined(HAVE_TR1_UNORDERED_MAP) + #include + #define WX_HASH_MAP_NAMESPACE std::tr1 +#endif + +#define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \ + typedef WX_HASH_MAP_NAMESPACE::unordered_map< KEY_T, VALUE_T, HASH_T, KEY_EQ_T > CLASSNAME + +#elif wxUSE_STD_CONTAINERS && defined(HAVE_STL_HASH_MAP) + +#if defined(HAVE_EXT_HASH_MAP) + #include +#elif defined(HAVE_HASH_MAP) + #include +#endif + +#if defined(HAVE_GNU_CXX_HASH_MAP) + #define WX_HASH_MAP_NAMESPACE __gnu_cxx +#elif defined(HAVE_STD_HASH_MAP) + #define WX_HASH_MAP_NAMESPACE std +#endif + +#define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \ + typedef WX_HASH_MAP_NAMESPACE::hash_map< KEY_T, VALUE_T, HASH_T, KEY_EQ_T > CLASSNAME + +#else // !wxUSE_STD_CONTAINERS || no std::{hash,unordered}_map class available + +#define wxNEEDS_WX_HASH_MAP + +#include // for ptrdiff_t + +// private +struct WXDLLIMPEXP_BASE _wxHashTable_NodeBase +{ + _wxHashTable_NodeBase() : m_next(NULL) {} + + _wxHashTable_NodeBase* m_next; + +// Cannot do this: +// wxDECLARE_NO_COPY_CLASS(_wxHashTable_NodeBase); +// without rewriting the macros, which require a public copy constructor. +}; + +// private +class WXDLLIMPEXP_BASE _wxHashTableBase2 +{ +public: + typedef void (*NodeDtor)(_wxHashTable_NodeBase*); + typedef size_t (*BucketFromNode)(_wxHashTableBase2*,_wxHashTable_NodeBase*); + typedef _wxHashTable_NodeBase* (*ProcessNode)(_wxHashTable_NodeBase*); +protected: + static _wxHashTable_NodeBase* DummyProcessNode(_wxHashTable_NodeBase* node); + static void DeleteNodes( size_t buckets, _wxHashTable_NodeBase** table, + NodeDtor dtor ); + static _wxHashTable_NodeBase* GetFirstNode( size_t buckets, + _wxHashTable_NodeBase** table ) + { + for( size_t i = 0; i < buckets; ++i ) + if( table[i] ) + return table[i]; + return NULL; + } + + // as static const unsigned prime_count = 31 but works with all compilers + enum { prime_count = 31 }; + static const unsigned long ms_primes[prime_count]; + + // returns the first prime in ms_primes greater than n + static unsigned long GetNextPrime( unsigned long n ); + + // returns the first prime in ms_primes smaller than n + // ( or ms_primes[0] if n is very small ) + static unsigned long GetPreviousPrime( unsigned long n ); + + static void CopyHashTable( _wxHashTable_NodeBase** srcTable, + size_t srcBuckets, _wxHashTableBase2* dst, + _wxHashTable_NodeBase** dstTable, + BucketFromNode func, ProcessNode proc ); + + static void** AllocTable( size_t sz ) + { + return (void **)calloc(sz, sizeof(void*)); + } + static void FreeTable(void *table) + { + free(table); + } +}; + +#define _WX_DECLARE_HASHTABLE( VALUE_T, KEY_T, HASH_T, KEY_EX_T, KEY_EQ_T,\ + PTROPERATOR, CLASSNAME, CLASSEXP, \ + SHOULD_GROW, SHOULD_SHRINK ) \ +CLASSEXP CLASSNAME : protected _wxHashTableBase2 \ +{ \ +public: \ + typedef KEY_T key_type; \ + typedef VALUE_T value_type; \ + typedef HASH_T hasher; \ + typedef KEY_EQ_T key_equal; \ + \ + typedef size_t size_type; \ + typedef ptrdiff_t difference_type; \ + typedef value_type* pointer; \ + typedef const value_type* const_pointer; \ + typedef value_type& reference; \ + typedef const value_type& const_reference; \ + /* should these be protected? */ \ + typedef const KEY_T const_key_type; \ + typedef const VALUE_T const_mapped_type; \ +public: \ + typedef KEY_EX_T key_extractor; \ + typedef CLASSNAME Self; \ +protected: \ + _wxHashTable_NodeBase** m_table; \ + size_t m_tableBuckets; \ + size_t m_items; \ + hasher m_hasher; \ + key_equal m_equals; \ + key_extractor m_getKey; \ +public: \ + struct Node:public _wxHashTable_NodeBase \ + { \ + public: \ + Node( const value_type& value ) \ + : m_value( value ) {} \ + Node* next() { return static_cast(m_next); } \ + \ + value_type m_value; \ + }; \ + \ +protected: \ + static void DeleteNode( _wxHashTable_NodeBase* node ) \ + { \ + delete static_cast(node); \ + } \ +public: \ + /* */ \ + /* forward iterator */ \ + /* */ \ + CLASSEXP Iterator \ + { \ + public: \ + Node* m_node; \ + Self* m_ht; \ + \ + Iterator() : m_node(NULL), m_ht(NULL) {} \ + Iterator( Node* node, const Self* ht ) \ + : m_node(node), m_ht(const_cast(ht)) {} \ + bool operator ==( const Iterator& it ) const \ + { return m_node == it.m_node; } \ + bool operator !=( const Iterator& it ) const \ + { return m_node != it.m_node; } \ + protected: \ + Node* GetNextNode() \ + { \ + size_type bucket = GetBucketForNode(m_ht,m_node); \ + for( size_type i = bucket + 1; i < m_ht->m_tableBuckets; ++i ) \ + { \ + if( m_ht->m_table[i] ) \ + return static_cast(m_ht->m_table[i]); \ + } \ + return NULL; \ + } \ + \ + void PlusPlus() \ + { \ + Node* next = m_node->next(); \ + m_node = next ? next : GetNextNode(); \ + } \ + }; \ + friend class Iterator; \ + \ +public: \ + CLASSEXP iterator : public Iterator \ + { \ + public: \ + iterator() : Iterator() {} \ + iterator( Node* node, Self* ht ) : Iterator( node, ht ) {} \ + iterator& operator++() { PlusPlus(); return *this; } \ + iterator operator++(int) { iterator it=*this;PlusPlus();return it; } \ + reference operator *() const { return m_node->m_value; } \ + PTROPERATOR(pointer) \ + }; \ + \ + CLASSEXP const_iterator : public Iterator \ + { \ + public: \ + const_iterator() : Iterator() {} \ + const_iterator(iterator i) : Iterator(i) {} \ + const_iterator( Node* node, const Self* ht ) \ + : Iterator(node, const_cast(ht)) {} \ + const_iterator& operator++() { PlusPlus();return *this; } \ + const_iterator operator++(int) { const_iterator it=*this;PlusPlus();return it; } \ + const_reference operator *() const { return m_node->m_value; } \ + PTROPERATOR(const_pointer) \ + }; \ + \ + CLASSNAME( size_type sz = 10, const hasher& hfun = hasher(), \ + const key_equal& k_eq = key_equal(), \ + const key_extractor& k_ex = key_extractor() ) \ + : m_tableBuckets( GetNextPrime( (unsigned long) sz ) ), \ + m_items( 0 ), \ + m_hasher( hfun ), \ + m_equals( k_eq ), \ + m_getKey( k_ex ) \ + { \ + m_table = (_wxHashTable_NodeBase**)AllocTable(m_tableBuckets); \ + } \ + \ + CLASSNAME( const Self& ht ) \ + : m_table(NULL), \ + m_tableBuckets( 0 ), \ + m_items( ht.m_items ), \ + m_hasher( ht.m_hasher ), \ + m_equals( ht.m_equals ), \ + m_getKey( ht.m_getKey ) \ + { \ + HashCopy( ht ); \ + } \ + \ + const Self& operator=( const Self& ht ) \ + { \ + if (&ht != this) \ + { \ + clear(); \ + m_hasher = ht.m_hasher; \ + m_equals = ht.m_equals; \ + m_getKey = ht.m_getKey; \ + m_items = ht.m_items; \ + HashCopy( ht ); \ + } \ + return *this; \ + } \ + \ + ~CLASSNAME() \ + { \ + clear(); \ + \ + FreeTable(m_table); \ + } \ + \ + hasher hash_funct() { return m_hasher; } \ + key_equal key_eq() { return m_equals; } \ + \ + /* removes all elements from the hash table, but does not */ \ + /* shrink it ( perhaps it should ) */ \ + void clear() \ + { \ + DeleteNodes(m_tableBuckets, m_table, DeleteNode); \ + m_items = 0; \ + } \ + \ + size_type size() const { return m_items; } \ + size_type max_size() const { return size_type(-1); } \ + bool empty() const { return size() == 0; } \ + \ + const_iterator end() const { return const_iterator(NULL, this); } \ + iterator end() { return iterator(NULL, this); } \ + const_iterator begin() const \ + { return const_iterator(static_cast(GetFirstNode(m_tableBuckets, m_table)), this); } \ + iterator begin() \ + { return iterator(static_cast(GetFirstNode(m_tableBuckets, m_table)), this); } \ + \ + size_type erase( const const_key_type& key ) \ + { \ + _wxHashTable_NodeBase** node = GetNodePtr(key); \ + \ + if( !node ) \ + return 0; \ + \ + --m_items; \ + _wxHashTable_NodeBase* temp = (*node)->m_next; \ + delete static_cast(*node); \ + (*node) = temp; \ + if( SHOULD_SHRINK( m_tableBuckets, m_items ) ) \ + ResizeTable( GetPreviousPrime( (unsigned long) m_tableBuckets ) - 1 ); \ + return 1; \ + } \ + \ +protected: \ + static size_type GetBucketForNode( Self* ht, Node* node ) \ + { \ + return ht->m_hasher( ht->m_getKey( node->m_value ) ) \ + % ht->m_tableBuckets; \ + } \ + static Node* CopyNode( Node* node ) { return new Node( *node ); } \ + \ + Node* GetOrCreateNode( const value_type& value, bool& created ) \ + { \ + const const_key_type& key = m_getKey( value ); \ + size_t bucket = m_hasher( key ) % m_tableBuckets; \ + Node* node = static_cast(m_table[bucket]); \ + \ + while( node ) \ + { \ + if( m_equals( m_getKey( node->m_value ), key ) ) \ + { \ + created = false; \ + return node; \ + } \ + node = node->next(); \ + } \ + created = true; \ + return CreateNode( value, bucket); \ + }\ + Node * CreateNode( const value_type& value, size_t bucket ) \ + {\ + Node* node = new Node( value ); \ + node->m_next = m_table[bucket]; \ + m_table[bucket] = node; \ + \ + /* must be after the node is inserted */ \ + ++m_items; \ + if( SHOULD_GROW( m_tableBuckets, m_items ) ) \ + ResizeTable( m_tableBuckets ); \ + \ + return node; \ + } \ + void CreateNode( const value_type& value ) \ + {\ + CreateNode(value, m_hasher( m_getKey(value) ) % m_tableBuckets ); \ + }\ + \ + /* returns NULL if not found */ \ + _wxHashTable_NodeBase** GetNodePtr(const const_key_type& key) const \ + { \ + size_t bucket = m_hasher( key ) % m_tableBuckets; \ + _wxHashTable_NodeBase** node = &m_table[bucket]; \ + \ + while( *node ) \ + { \ + if (m_equals(m_getKey(static_cast(*node)->m_value), key)) \ + return node; \ + node = &(*node)->m_next; \ + } \ + \ + return NULL; \ + } \ + \ + /* returns NULL if not found */ \ + /* expressing it in terms of GetNodePtr is 5-8% slower :-( */ \ + Node* GetNode( const const_key_type& key ) const \ + { \ + size_t bucket = m_hasher( key ) % m_tableBuckets; \ + Node* node = static_cast(m_table[bucket]); \ + \ + while( node ) \ + { \ + if( m_equals( m_getKey( node->m_value ), key ) ) \ + return node; \ + node = node->next(); \ + } \ + \ + return NULL; \ + } \ + \ + void ResizeTable( size_t newSize ) \ + { \ + newSize = GetNextPrime( (unsigned long)newSize ); \ + _wxHashTable_NodeBase** srcTable = m_table; \ + size_t srcBuckets = m_tableBuckets; \ + m_table = (_wxHashTable_NodeBase**)AllocTable( newSize ); \ + m_tableBuckets = newSize; \ + \ + CopyHashTable( srcTable, srcBuckets, \ + this, m_table, \ + (BucketFromNode)GetBucketForNode,\ + (ProcessNode)&DummyProcessNode ); \ + FreeTable(srcTable); \ + } \ + \ + /* this must be called _after_ m_table has been cleaned */ \ + void HashCopy( const Self& ht ) \ + { \ + ResizeTable( ht.size() ); \ + CopyHashTable( ht.m_table, ht.m_tableBuckets, \ + (_wxHashTableBase2*)this, \ + m_table, \ + (BucketFromNode)GetBucketForNode, \ + (ProcessNode)CopyNode ); \ + } \ +}; + +// defines an STL-like pair class CLASSNAME storing two fields: first of type +// KEY_T and second of type VALUE_T +#define _WX_DECLARE_PAIR( KEY_T, VALUE_T, CLASSNAME, CLASSEXP ) \ +CLASSEXP CLASSNAME \ +{ \ +public: \ + typedef KEY_T first_type; \ + typedef VALUE_T second_type; \ + typedef KEY_T t1; \ + typedef VALUE_T t2; \ + typedef const KEY_T const_t1; \ + typedef const VALUE_T const_t2; \ + \ + CLASSNAME(const const_t1& f, const const_t2& s) \ + : first(const_cast(f)), second(const_cast(s)) {} \ + \ + t1 first; \ + t2 second; \ +}; + +// defines the class CLASSNAME returning the key part (of type KEY_T) from a +// pair of type PAIR_T +#define _WX_DECLARE_HASH_MAP_KEY_EX( KEY_T, PAIR_T, CLASSNAME, CLASSEXP ) \ +CLASSEXP CLASSNAME \ +{ \ + typedef KEY_T key_type; \ + typedef PAIR_T pair_type; \ + typedef const key_type const_key_type; \ + typedef const pair_type const_pair_type; \ + typedef const_key_type& const_key_reference; \ + typedef const_pair_type& const_pair_reference; \ +public: \ + CLASSNAME() { } \ + const_key_reference operator()( const_pair_reference pair ) const { return pair.first; }\ +}; + +// grow/shrink predicates +inline bool never_grow( size_t, size_t ) { return false; } +inline bool never_shrink( size_t, size_t ) { return false; } +inline bool grow_lf70( size_t buckets, size_t items ) +{ + return float(items)/float(buckets) >= 0.85f; +} + +#endif // various hash map implementations + +// ---------------------------------------------------------------------------- +// hashing and comparison functors +// ---------------------------------------------------------------------------- + +#ifndef wxNEEDS_WX_HASH_MAP + +// integer types +struct WXDLLIMPEXP_BASE wxIntegerHash +{ +private: + WX_HASH_MAP_NAMESPACE::hash longHash; + WX_HASH_MAP_NAMESPACE::hash ulongHash; + WX_HASH_MAP_NAMESPACE::hash intHash; + WX_HASH_MAP_NAMESPACE::hash uintHash; + WX_HASH_MAP_NAMESPACE::hash shortHash; + WX_HASH_MAP_NAMESPACE::hash ushortHash; + +#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG + // hash ought to work but doesn't on some compilers + #if (!defined SIZEOF_LONG_LONG && SIZEOF_LONG == 4) \ + || (defined SIZEOF_LONG_LONG && SIZEOF_LONG_LONG == SIZEOF_LONG * 2) + size_t longlongHash( wxLongLong_t x ) const + { + return longHash( wx_truncate_cast(long, x) ) ^ + longHash( wx_truncate_cast(long, x >> (sizeof(long) * 8)) ); + } + #elif defined SIZEOF_LONG_LONG && SIZEOF_LONG_LONG == SIZEOF_LONG + WX_HASH_MAP_NAMESPACE::hash longlongHash; + #else + WX_HASH_MAP_NAMESPACE::hash longlongHash; + #endif +#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG + +public: + wxIntegerHash() wxNOEXCEPT { } + size_t operator()( long x ) const wxNOEXCEPT { return longHash( x ); } + size_t operator()( unsigned long x ) const wxNOEXCEPT { return ulongHash( x ); } + size_t operator()( int x ) const wxNOEXCEPT { return intHash( x ); } + size_t operator()( unsigned int x ) const wxNOEXCEPT { return uintHash( x ); } + size_t operator()( short x ) const wxNOEXCEPT { return shortHash( x ); } + size_t operator()( unsigned short x ) const wxNOEXCEPT { return ushortHash( x ); } +#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG + size_t operator()( wxLongLong_t x ) const wxNOEXCEPT { return longlongHash(x); } + size_t operator()( wxULongLong_t x ) const wxNOEXCEPT { return longlongHash(x); } +#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG +}; + +#else // wxNEEDS_WX_HASH_MAP + +// integer types +struct WXDLLIMPEXP_BASE wxIntegerHash +{ + wxIntegerHash() wxNOEXCEPT { } + unsigned long operator()( long x ) const wxNOEXCEPT { return (unsigned long)x; } + unsigned long operator()( unsigned long x ) const wxNOEXCEPT { return x; } + unsigned long operator()( int x ) const wxNOEXCEPT { return (unsigned long)x; } + unsigned long operator()( unsigned int x ) const wxNOEXCEPT { return x; } + unsigned long operator()( short x ) const wxNOEXCEPT { return (unsigned long)x; } + unsigned long operator()( unsigned short x ) const wxNOEXCEPT { return x; } +#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG + wxULongLong_t operator()( wxLongLong_t x ) const wxNOEXCEPT { return static_cast(x); } + wxULongLong_t operator()( wxULongLong_t x ) const wxNOEXCEPT { return x; } +#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG +}; + +#endif // !wxNEEDS_WX_HASH_MAP/wxNEEDS_WX_HASH_MAP + +struct WXDLLIMPEXP_BASE wxIntegerEqual +{ + wxIntegerEqual() wxNOEXCEPT { } + bool operator()( long a, long b ) const wxNOEXCEPT { return a == b; } + bool operator()( unsigned long a, unsigned long b ) const wxNOEXCEPT { return a == b; } + bool operator()( int a, int b ) const wxNOEXCEPT { return a == b; } + bool operator()( unsigned int a, unsigned int b ) const wxNOEXCEPT { return a == b; } + bool operator()( short a, short b ) const wxNOEXCEPT { return a == b; } + bool operator()( unsigned short a, unsigned short b ) const wxNOEXCEPT { return a == b; } +#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG + bool operator()( wxLongLong_t a, wxLongLong_t b ) const wxNOEXCEPT { return a == b; } + bool operator()( wxULongLong_t a, wxULongLong_t b ) const wxNOEXCEPT { return a == b; } +#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG +}; + +// pointers +struct WXDLLIMPEXP_BASE wxPointerHash +{ + wxPointerHash() wxNOEXCEPT { } + +#ifdef wxNEEDS_WX_HASH_MAP + wxUIntPtr operator()( const void* k ) const wxNOEXCEPT { return wxPtrToUInt(k); } +#else + size_t operator()( const void* k ) const wxNOEXCEPT { return (size_t)k; } +#endif +}; + +struct WXDLLIMPEXP_BASE wxPointerEqual +{ + wxPointerEqual() wxNOEXCEPT { } + bool operator()( const void* a, const void* b ) const wxNOEXCEPT { return a == b; } +}; + +// wxString, char*, wchar_t* +struct WXDLLIMPEXP_BASE wxStringHash +{ + wxStringHash() wxNOEXCEPT {} + unsigned long operator()( const wxString& x ) const wxNOEXCEPT + { return stringHash( x.wx_str() ); } + unsigned long operator()( const wchar_t* x ) const wxNOEXCEPT + { return stringHash( x ); } + unsigned long operator()( const char* x ) const wxNOEXCEPT + { return stringHash( x ); } + +#if WXWIN_COMPATIBILITY_2_8 + static unsigned long wxCharStringHash( const wxChar* x ) + { return stringHash(x); } + #if wxUSE_UNICODE + static unsigned long charStringHash( const char* x ) + { return stringHash(x); } + #endif +#endif // WXWIN_COMPATIBILITY_2_8 + + static unsigned long stringHash( const wchar_t* ); + static unsigned long stringHash( const char* ); +}; + +struct WXDLLIMPEXP_BASE wxStringEqual +{ + wxStringEqual() wxNOEXCEPT {} + bool operator()( const wxString& a, const wxString& b ) const wxNOEXCEPT + { return a == b; } + bool operator()( const wxChar* a, const wxChar* b ) const wxNOEXCEPT + { return wxStrcmp( a, b ) == 0; } +#if wxUSE_UNICODE + bool operator()( const char* a, const char* b ) const wxNOEXCEPT + { return strcmp( a, b ) == 0; } +#endif // wxUSE_UNICODE +}; + +#ifdef wxNEEDS_WX_HASH_MAP + +#define wxPTROP_NORMAL(pointer) \ + pointer operator ->() const { return &(m_node->m_value); } +#define wxPTROP_NOP(pointer) + +#define _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, CLASSEXP ) \ +_WX_DECLARE_PAIR( KEY_T, VALUE_T, CLASSNAME##_wxImplementation_Pair, CLASSEXP ) \ +_WX_DECLARE_HASH_MAP_KEY_EX( KEY_T, CLASSNAME##_wxImplementation_Pair, CLASSNAME##_wxImplementation_KeyEx, CLASSEXP ) \ +_WX_DECLARE_HASHTABLE( CLASSNAME##_wxImplementation_Pair, KEY_T, HASH_T, \ + CLASSNAME##_wxImplementation_KeyEx, KEY_EQ_T, wxPTROP_NORMAL, \ + CLASSNAME##_wxImplementation_HashTable, CLASSEXP, grow_lf70, never_shrink ) \ +CLASSEXP CLASSNAME:public CLASSNAME##_wxImplementation_HashTable \ +{ \ +public: \ + typedef VALUE_T mapped_type; \ + _WX_DECLARE_PAIR( iterator, bool, Insert_Result, CLASSEXP ) \ + \ + explicit CLASSNAME( size_type hint = 100, hasher hf = hasher(), \ + key_equal eq = key_equal() ) \ + : CLASSNAME##_wxImplementation_HashTable( hint, hf, eq, \ + CLASSNAME##_wxImplementation_KeyEx() ) {} \ + \ + mapped_type& operator[]( const const_key_type& key ) \ + { \ + bool created; \ + return GetOrCreateNode( \ + CLASSNAME##_wxImplementation_Pair( key, mapped_type() ), \ + created)->m_value.second; \ + } \ + \ + const_iterator find( const const_key_type& key ) const \ + { \ + return const_iterator( GetNode( key ), this ); \ + } \ + \ + iterator find( const const_key_type& key ) \ + { \ + return iterator( GetNode( key ), this ); \ + } \ + \ + Insert_Result insert( const value_type& v ) \ + { \ + bool created; \ + Node *node = GetOrCreateNode( \ + CLASSNAME##_wxImplementation_Pair( v.first, v.second ), \ + created); \ + return Insert_Result(iterator(node, this), created); \ + } \ + \ + size_type erase( const key_type& k ) \ + { return CLASSNAME##_wxImplementation_HashTable::erase( k ); } \ + void erase( const iterator& it ) { erase( (*it).first ); } \ + \ + /* count() == 0 | 1 */ \ + size_type count( const const_key_type& key ) \ + { \ + return GetNode( key ) ? 1u : 0u; \ + } \ +} + +#endif // wxNEEDS_WX_HASH_MAP + +// these macros are to be used in the user code +#define WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME) \ + _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, class ) + +#define WX_DECLARE_STRING_HASH_MAP( VALUE_T, CLASSNAME ) \ + _WX_DECLARE_HASH_MAP( wxString, VALUE_T, wxStringHash, wxStringEqual, \ + CLASSNAME, class ) + +#define WX_DECLARE_VOIDPTR_HASH_MAP( VALUE_T, CLASSNAME ) \ + _WX_DECLARE_HASH_MAP( void*, VALUE_T, wxPointerHash, wxPointerEqual, \ + CLASSNAME, class ) + +// and these do exactly the same thing but should be used inside the +// library +// note: DECL is not used since the class is inline +#define WX_DECLARE_HASH_MAP_WITH_DECL( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL) \ + _WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, class ) + +#define WX_DECLARE_EXPORTED_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME) \ + WX_DECLARE_HASH_MAP_WITH_DECL( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, \ + CLASSNAME, class WXDLLIMPEXP_CORE ) + +// note: DECL is not used since the class is inline +#define WX_DECLARE_STRING_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, DECL ) \ + _WX_DECLARE_HASH_MAP( wxString, VALUE_T, wxStringHash, wxStringEqual, \ + CLASSNAME, class ) + +#define WX_DECLARE_EXPORTED_STRING_HASH_MAP( VALUE_T, CLASSNAME ) \ + WX_DECLARE_STRING_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, \ + class WXDLLIMPEXP_CORE ) + +// note: DECL is not used since the class is inline +#define WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, DECL ) \ + _WX_DECLARE_HASH_MAP( void*, VALUE_T, wxPointerHash, wxPointerEqual, \ + CLASSNAME, class ) + +#define WX_DECLARE_EXPORTED_VOIDPTR_HASH_MAP( VALUE_T, CLASSNAME ) \ + WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, \ + class WXDLLIMPEXP_CORE ) + +// delete all hash elements +// +// NB: the class declaration of the hash elements must be visible from the +// place where you use this macro, otherwise the proper destructor may not +// be called (a decent compiler should give a warning about it, but don't +// count on it)! +#define WX_CLEAR_HASH_MAP(type, hashmap) \ + { \ + type::iterator it, en; \ + for( it = (hashmap).begin(), en = (hashmap).end(); it != en; ++it ) \ + delete it->second; \ + (hashmap).clear(); \ + } + +//--------------------------------------------------------------------------- +// Declarations of common hashmap classes + +WX_DECLARE_HASH_MAP_WITH_DECL( long, long, wxIntegerHash, wxIntegerEqual, + wxLongToLongHashMap, class WXDLLIMPEXP_BASE ); + +WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxString, wxStringToStringHashMap, + class WXDLLIMPEXP_BASE ); + +WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxUIntPtr, wxStringToNumHashMap, + class WXDLLIMPEXP_BASE ); + + +#endif // _WX_HASHMAP_H_ diff --git a/lib/wxWidgets/include/wx/hashset.h b/lib/wxWidgets/include/wx/hashset.h new file mode 100644 index 0000000..311aeca --- /dev/null +++ b/lib/wxWidgets/include/wx/hashset.h @@ -0,0 +1,195 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/hashset.h +// Purpose: wxHashSet class +// Author: Mattia Barbon +// Modified by: +// Created: 11/08/2003 +// Copyright: (c) Mattia Barbon +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HASHSET_H_ +#define _WX_HASHSET_H_ + +#include "wx/hashmap.h" + +// see comment in wx/hashmap.h which also applies to different standard hash +// set classes + +#if wxUSE_STD_CONTAINERS && \ + (defined(HAVE_STD_UNORDERED_SET) || defined(HAVE_TR1_UNORDERED_SET)) + +#if defined(HAVE_STD_UNORDERED_SET) + #include + #define WX_HASH_SET_BASE_TEMPLATE std::unordered_set +#elif defined(HAVE_TR1_UNORDERED_SET) + #include + #define WX_HASH_SET_BASE_TEMPLATE std::tr1::unordered_set +#else + #error Update this code: unordered_set is available, but I do not know where. +#endif + +#elif wxUSE_STD_CONTAINERS && defined(HAVE_STL_HASH_MAP) + +#if defined(HAVE_EXT_HASH_MAP) + #include +#elif defined(HAVE_HASH_MAP) + #include +#endif + +#define WX_HASH_SET_BASE_TEMPLATE WX_HASH_MAP_NAMESPACE::hash_set + +#endif // different hash_set/unordered_set possibilities + +#ifdef WX_HASH_SET_BASE_TEMPLATE + +// we need to define the class declared by _WX_DECLARE_HASH_SET as a class and +// not a typedef to allow forward declaring it +#define _WX_DECLARE_HASH_SET_IMPL( KEY_T, HASH_T, KEY_EQ_T, PTROP, CLASSNAME, CLASSEXP ) \ +CLASSEXP CLASSNAME \ + : public WX_HASH_SET_BASE_TEMPLATE< KEY_T, HASH_T, KEY_EQ_T > \ +{ \ +public: \ + explicit CLASSNAME(size_type n = 3, \ + const hasher& h = hasher(), \ + const key_equal& ke = key_equal(), \ + const allocator_type& a = allocator_type()) \ + : WX_HASH_SET_BASE_TEMPLATE< KEY_T, HASH_T, KEY_EQ_T >(n, h, ke, a) \ + {} \ + template \ + CLASSNAME(InputIterator f, InputIterator l, \ + const hasher& h = hasher(), \ + const key_equal& ke = key_equal(), \ + const allocator_type& a = allocator_type()) \ + : WX_HASH_SET_BASE_TEMPLATE< KEY_T, HASH_T, KEY_EQ_T >(f, l, h, ke, a)\ + {} \ + CLASSNAME(const WX_HASH_SET_BASE_TEMPLATE< KEY_T, HASH_T, KEY_EQ_T >& s) \ + : WX_HASH_SET_BASE_TEMPLATE< KEY_T, HASH_T, KEY_EQ_T >(s) \ + {} \ +} + +// In some standard library implementations (in particular, the libstdc++ that +// ships with g++ 4.7), std::unordered_set inherits privately from its hasher +// and comparator template arguments for purposes of empty base optimization. +// As a result, in the declaration of a class deriving from std::unordered_set +// the names of the hasher and comparator classes are interpreted as naming +// the base class which is inaccessible. +// The workaround is to prefix the class names with 'struct'; however, don't +// do this unconditionally, as with other compilers (both MSVC and clang) +// doing it causes a warning if the class was declared as a 'class' rather than +// a 'struct'. +#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 7) +#define WX_MAYBE_PREFIX_WITH_STRUCT(STRUCTNAME) struct STRUCTNAME +#else +#define WX_MAYBE_PREFIX_WITH_STRUCT(STRUCTNAME) STRUCTNAME +#endif + +#define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, PTROP, CLASSNAME, CLASSEXP ) \ + _WX_DECLARE_HASH_SET_IMPL( \ + KEY_T, \ + WX_MAYBE_PREFIX_WITH_STRUCT(HASH_T), \ + WX_MAYBE_PREFIX_WITH_STRUCT(KEY_EQ_T), \ + PTROP, \ + CLASSNAME, \ + CLASSEXP) + +#else // no appropriate STL class, use our own implementation + +// this is a complex way of defining an easily inlineable identity function... +#define _WX_DECLARE_HASH_SET_KEY_EX( KEY_T, CLASSNAME, CLASSEXP ) \ +CLASSEXP CLASSNAME \ +{ \ + typedef KEY_T key_type; \ + typedef const key_type const_key_type; \ + typedef const_key_type& const_key_reference; \ +public: \ + CLASSNAME() { } \ + const_key_reference operator()( const_key_reference key ) const \ + { return key; } \ +}; + +#define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, PTROP, CLASSNAME, CLASSEXP )\ +_WX_DECLARE_HASH_SET_KEY_EX( KEY_T, CLASSNAME##_wxImplementation_KeyEx, CLASSEXP ) \ +_WX_DECLARE_HASHTABLE( KEY_T, KEY_T, HASH_T, \ + CLASSNAME##_wxImplementation_KeyEx, KEY_EQ_T, PTROP, \ + CLASSNAME##_wxImplementation_HashTable, CLASSEXP, grow_lf70, never_shrink ) \ +CLASSEXP CLASSNAME:public CLASSNAME##_wxImplementation_HashTable \ +{ \ +public: \ + _WX_DECLARE_PAIR( iterator, bool, Insert_Result, CLASSEXP ) \ + \ + explicit CLASSNAME( size_type hint = 100, hasher hf = hasher(), \ + key_equal eq = key_equal() ) \ + : CLASSNAME##_wxImplementation_HashTable( hint, hf, eq, \ + CLASSNAME##_wxImplementation_KeyEx() ) {} \ + \ + Insert_Result insert( const key_type& key ) \ + { \ + bool created; \ + Node *node = GetOrCreateNode( key, created ); \ + return Insert_Result( iterator( node, this ), created ); \ + } \ + \ + const_iterator find( const const_key_type& key ) const \ + { \ + return const_iterator( GetNode( key ), this ); \ + } \ + \ + iterator find( const const_key_type& key ) \ + { \ + return iterator( GetNode( key ), this ); \ + } \ + \ + size_type erase( const key_type& k ) \ + { return CLASSNAME##_wxImplementation_HashTable::erase( k ); } \ + void erase( const iterator& it ) { erase( *it ); } \ + void erase( const const_iterator& it ) { erase( *it ); } \ + \ + /* count() == 0 | 1 */ \ + size_type count( const const_key_type& key ) const \ + { return GetNode( key ) ? 1 : 0; } \ +} + +#endif // STL/wx implementations + + +// these macros are to be used in the user code +#define WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME) \ + _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, wxPTROP_NORMAL, CLASSNAME, class ) + +// and these do exactly the same thing but should be used inside the +// library +// note: DECL is not used since the class is inline +#define WX_DECLARE_HASH_SET_WITH_DECL( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL) \ + _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, wxPTROP_NORMAL, CLASSNAME, class ) + +#define WX_DECLARE_EXPORTED_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME) \ + WX_DECLARE_HASH_SET_WITH_DECL( KEY_T, HASH_T, KEY_EQ_T, \ + CLASSNAME, class WXDLLIMPEXP_CORE ) + +// Finally these versions allow to define hash sets of non-objects (including +// pointers, hence the confusing but wxArray-compatible name) without +// operator->() which can't be used for them. This is mostly used inside the +// library itself to avoid warnings when using such hash sets with some less +// common compilers (notably Sun CC). +#define WX_DECLARE_HASH_SET_PTR( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME) \ + _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, wxPTROP_NOP, CLASSNAME, class ) +// note: DECL is not used since the class is inline +#define WX_DECLARE_HASH_SET_WITH_DECL_PTR( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL) \ + _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, wxPTROP_NOP, CLASSNAME, class ) + +// delete all hash elements +// +// NB: the class declaration of the hash elements must be visible from the +// place where you use this macro, otherwise the proper destructor may not +// be called (a decent compiler should give a warning about it, but don't +// count on it)! +#define WX_CLEAR_HASH_SET(type, hashset) \ + { \ + type::iterator it, en; \ + for( it = (hashset).begin(), en = (hashset).end(); it != en; ++it ) \ + delete *it; \ + (hashset).clear(); \ + } + +#endif // _WX_HASHSET_H_ diff --git a/lib/wxWidgets/include/wx/headercol.h b/lib/wxWidgets/include/wx/headercol.h new file mode 100644 index 0000000..9397b14 --- /dev/null +++ b/lib/wxWidgets/include/wx/headercol.h @@ -0,0 +1,296 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/headercol.h +// Purpose: declaration of wxHeaderColumn class +// Author: Vadim Zeitlin +// Created: 2008-12-02 +// Copyright: (c) 2008 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HEADERCOL_H_ +#define _WX_HEADERCOL_H_ + +#include "wx/bmpbndl.h" + +#if wxUSE_HEADERCTRL + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +enum +{ + // special value for column width meaning unspecified/default + wxCOL_WIDTH_DEFAULT = -1, + + // size the column automatically to fit all values + wxCOL_WIDTH_AUTOSIZE = -2 +}; + +// bit masks for the various column attributes +enum +{ + // column can be resized (included in default flags) + wxCOL_RESIZABLE = 1, + + // column can be clicked to toggle the sort order by its contents + wxCOL_SORTABLE = 2, + + // column can be dragged to change its order (included in default) + wxCOL_REORDERABLE = 4, + + // column is not shown at all + wxCOL_HIDDEN = 8, + + // default flags for wxHeaderColumn ctor + wxCOL_DEFAULT_FLAGS = wxCOL_RESIZABLE | wxCOL_REORDERABLE +}; + +// ---------------------------------------------------------------------------- +// wxHeaderColumn: interface for a column in a header of controls such as +// wxListCtrl, wxDataViewCtrl or wxGrid +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxHeaderColumn +{ +public: + // ctors and dtor + // -------------- + + /* + Derived classes must provide ctors with the following signatures + (notice that they shouldn't be explicit to allow passing strings/bitmaps + directly to methods such wxHeaderCtrl::AppendColumn()): + wxHeaderColumn(const wxString& title, + int width = wxCOL_WIDTH_DEFAULT, + wxAlignment align = wxALIGN_NOT, + int flags = wxCOL_DEFAULT_FLAGS); + wxHeaderColumn(const wxBitmap &bitmap, + int width = wxDVC_DEFAULT_WIDTH, + wxAlignment align = wxALIGN_CENTER, + int flags = wxCOL_DEFAULT_FLAGS); + */ + + // virtual dtor for the base class to avoid gcc warnings even though we + // don't normally delete the objects of this class via a pointer to + // wxHeaderColumn so it's not necessary, strictly speaking + virtual ~wxHeaderColumn() { } + + // getters for various attributes + // ------------------------------ + + // notice that wxHeaderColumn only provides getters as this is all the + // wxHeaderCtrl needs, various derived class must also provide some way to + // change these attributes but this can be done either at the column level + // (in which case they should inherit from wxSettableHeaderColumn) or via + // the methods of the main control in which case you don't need setters in + // the column class at all + + // title is the string shown for this column + virtual wxString GetTitle() const = 0; + + // This function exists only for backwards compatibility, it's recommended to override + // GetBitmapBundle() in the new code and override this one to do nothing, as it will + // never be called if GetBitmapBundle() is overridden. + virtual wxBitmap GetBitmap() const = 0; + + // Override this function to return the bundle containing the bitmap to show in the + // column header. By default delegates to GetBitmap() but should be overridden if + // the bitmaps are used. + virtual wxBitmapBundle GetBitmapBundle() const { return GetBitmap(); } + + // width of the column in pixels, can be set to wxCOL_WIDTH_DEFAULT meaning + // unspecified/default + virtual int GetWidth() const = 0; + + // minimal width can be set for resizable columns to forbid resizing them + // below the specified size (set to 0 to remove) + virtual int GetMinWidth() const = 0; + + // alignment of the text: wxALIGN_CENTRE, wxALIGN_LEFT or wxALIGN_RIGHT + virtual wxAlignment GetAlignment() const = 0; + + + // flags manipulations: + // -------------------- + + // notice that while we make GetFlags() pure virtual here and implement the + // individual flags access in terms of it, for some derived classes it is + // more natural to implement access to each flag individually, in which + // case they can use our GetFromIndividualFlags() helper below to implement + // GetFlags() + + // retrieve all column flags at once: combination of wxCOL_XXX values above + virtual int GetFlags() const = 0; + + bool HasFlag(int flag) const { return (GetFlags() & flag) != 0; } + + + // wxCOL_RESIZABLE + virtual bool IsResizeable() const + { return HasFlag(wxCOL_RESIZABLE); } + + // wxCOL_SORTABLE + virtual bool IsSortable() const + { return HasFlag(wxCOL_SORTABLE); } + + // wxCOL_REORDERABLE + virtual bool IsReorderable() const + { return HasFlag(wxCOL_REORDERABLE); } + + // wxCOL_HIDDEN + virtual bool IsHidden() const + { return HasFlag(wxCOL_HIDDEN); } + bool IsShown() const + { return !IsHidden(); } + + + // sorting + // ------- + + // return true if the column is the one currently used for sorting + virtual bool IsSortKey() const = 0; + + // for sortable columns indicate whether we should sort in ascending or + // descending order (this should only be taken into account if IsSortKey()) + virtual bool IsSortOrderAscending() const = 0; + +protected: + // helper for the class overriding IsXXX() + int GetFromIndividualFlags() const; +}; + +// ---------------------------------------------------------------------------- +// wxSettableHeaderColumn: column which allows to change its fields too +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSettableHeaderColumn : public wxHeaderColumn +{ +public: + virtual void SetTitle(const wxString& title) = 0; + virtual void SetBitmap(const wxBitmapBundle& bitmap) = 0; + virtual void SetWidth(int width) = 0; + virtual void SetMinWidth(int minWidth) = 0; + virtual void SetAlignment(wxAlignment align) = 0; + + // see comment for wxHeaderColumn::GetFlags() about the relationship + // between SetFlags() and Set{Sortable,Reorderable,...} + + // change, set, clear, toggle or test for any individual flag + virtual void SetFlags(int flags) = 0; + void ChangeFlag(int flag, bool set); + void SetFlag(int flag); + void ClearFlag(int flag); + void ToggleFlag(int flag); + + virtual void SetResizeable(bool resizable) + { ChangeFlag(wxCOL_RESIZABLE, resizable); } + virtual void SetSortable(bool sortable) + { ChangeFlag(wxCOL_SORTABLE, sortable); } + virtual void SetReorderable(bool reorderable) + { ChangeFlag(wxCOL_REORDERABLE, reorderable); } + virtual void SetHidden(bool hidden) + { ChangeFlag(wxCOL_HIDDEN, hidden); } + + // This function can be called to indicate that this column is not used for + // sorting any more. Under some platforms it's not necessary to do anything + // in this case as just setting another column as a sort key takes care of + // everything but under MSW we currently need to call this explicitly to + // reset the sort indicator displayed on the column. + virtual void UnsetAsSortKey() { } + + virtual void SetSortOrder(bool ascending) = 0; + void ToggleSortOrder() { SetSortOrder(!IsSortOrderAscending()); } + +protected: + // helper for the class overriding individual SetXXX() methods instead of + // overriding SetFlags() + void SetIndividualFlags(int flags); +}; + +// ---------------------------------------------------------------------------- +// wxHeaderColumnSimple: trivial generic implementation of wxHeaderColumn +// ---------------------------------------------------------------------------- + +class wxHeaderColumnSimple : public wxSettableHeaderColumn +{ +public: + // ctors and dtor + wxHeaderColumnSimple(const wxString& title, + int width = wxCOL_WIDTH_DEFAULT, + wxAlignment align = wxALIGN_NOT, + int flags = wxCOL_DEFAULT_FLAGS) + : m_title(title), + m_width(width), + m_align(align), + m_flags(flags) + { + Init(); + } + + wxHeaderColumnSimple(const wxBitmapBundle& bitmap, + int width = wxCOL_WIDTH_DEFAULT, + wxAlignment align = wxALIGN_CENTER, + int flags = wxCOL_DEFAULT_FLAGS) + : m_bitmap(bitmap), + m_width(width), + m_align(align), + m_flags(flags) + { + Init(); + } + + // implement base class pure virtuals + virtual void SetTitle(const wxString& title) wxOVERRIDE { m_title = title; } + virtual wxString GetTitle() const wxOVERRIDE { return m_title; } + + virtual void SetBitmap(const wxBitmapBundle& bitmap) wxOVERRIDE { m_bitmap = bitmap; } + wxBitmap GetBitmap() const wxOVERRIDE { wxFAIL_MSG("unreachable"); return wxNullBitmap; } + wxBitmapBundle GetBitmapBundle() const wxOVERRIDE { return m_bitmap; } + + virtual void SetWidth(int width) wxOVERRIDE { m_width = width; } + virtual int GetWidth() const wxOVERRIDE { return m_width; } + + virtual void SetMinWidth(int minWidth) wxOVERRIDE { m_minWidth = minWidth; } + virtual int GetMinWidth() const wxOVERRIDE { return m_minWidth; } + + virtual void SetAlignment(wxAlignment align) wxOVERRIDE { m_align = align; } + virtual wxAlignment GetAlignment() const wxOVERRIDE { return m_align; } + + virtual void SetFlags(int flags) wxOVERRIDE { m_flags = flags; } + virtual int GetFlags() const wxOVERRIDE { return m_flags; } + + virtual bool IsSortKey() const wxOVERRIDE { return m_sort; } + virtual void UnsetAsSortKey() wxOVERRIDE { m_sort = false; } + + virtual void SetSortOrder(bool ascending) wxOVERRIDE + { + m_sort = true; + m_sortAscending = ascending; + } + + virtual bool IsSortOrderAscending() const wxOVERRIDE { return m_sortAscending; } + +private: + // common part of all ctors + void Init() + { + m_minWidth = 0; + m_sort = false; + m_sortAscending = true; + } + + wxString m_title; + wxBitmapBundle m_bitmap; + int m_width, + m_minWidth; + wxAlignment m_align; + int m_flags; + bool m_sort, + m_sortAscending; +}; + +#endif // wxUSE_HEADERCTRL + +#endif // _WX_HEADERCOL_H_ + diff --git a/lib/wxWidgets/include/wx/headerctrl.h b/lib/wxWidgets/include/wx/headerctrl.h new file mode 100644 index 0000000..3216890 --- /dev/null +++ b/lib/wxWidgets/include/wx/headerctrl.h @@ -0,0 +1,500 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/headerctrl.h +// Purpose: wxHeaderCtrlBase class: interface of wxHeaderCtrl +// Author: Vadim Zeitlin +// Created: 2008-12-01 +// Copyright: (c) 2008 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HEADERCTRL_H_ +#define _WX_HEADERCTRL_H_ + +#include "wx/control.h" + +#if wxUSE_HEADERCTRL + +#include "wx/dynarray.h" +#include "wx/vector.h" + +#include "wx/headercol.h" + +// notice that the classes in this header are defined in the core library even +// although currently they're only used by wxGrid which is in wxAdv because we +// plan to use it in wxListCtrl which is in core too in the future +class WXDLLIMPEXP_FWD_CORE wxHeaderCtrlEvent; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +enum +{ + // allow column drag and drop + wxHD_ALLOW_REORDER = 0x0001, + + // allow hiding (and showing back) the columns using the menu shown by + // right clicking the header + wxHD_ALLOW_HIDE = 0x0002, + + // force putting column images on right + wxHD_BITMAP_ON_RIGHT = 0x0004, + + // style used by default when creating the control + wxHD_DEFAULT_STYLE = wxHD_ALLOW_REORDER +}; + +extern WXDLLIMPEXP_DATA_CORE(const char) wxHeaderCtrlNameStr[]; + +// ---------------------------------------------------------------------------- +// wxHeaderCtrlBase defines the interface of a header control +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxHeaderCtrlBase : public wxControl +{ +public: + /* + Derived classes must provide default ctor as well as a ctor and + Create() function with the following signatures: + + wxHeaderCtrl(wxWindow *parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxHD_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxHeaderCtrlNameStr)); + + bool Create(wxWindow *parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxHD_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxHeaderCtrlNameStr)); + */ + + // column-related methods + // ---------------------- + + // set the number of columns in the control + // + // this also calls UpdateColumn() for all columns + void SetColumnCount(unsigned int count); + + // return the number of columns in the control as set by SetColumnCount() + unsigned int GetColumnCount() const { return DoGetCount(); } + + // return whether the control has any columns + bool IsEmpty() const { return DoGetCount() == 0; } + + // update the column with the given index + void UpdateColumn(unsigned int idx) + { + wxCHECK_RET( idx < GetColumnCount(), "invalid column index" ); + + DoUpdate(idx); + } + + + // columns order + // ------------- + + // set the columns order: the array defines the column index which appears + // the given position, it must have GetColumnCount() elements and contain + // all indices exactly once + void SetColumnsOrder(const wxArrayInt& order); + wxArrayInt GetColumnsOrder() const; + + // get the index of the column at the given display position + unsigned int GetColumnAt(unsigned int pos) const; + + // get the position at which this column is currently displayed + unsigned int GetColumnPos(unsigned int idx) const; + + // reset the columns order to the natural one + void ResetColumnsOrder(); + + // helper function used by the generic version of this control and also + // wxGrid: reshuffles the array of column indices indexed by positions + // (i.e. using the same convention as for SetColumnsOrder()) so that the + // column with the given index is found at the specified position + static void MoveColumnInOrderArray(wxArrayInt& order, + unsigned int idx, + unsigned int pos); + + + // UI helpers + // ---------- + +#if wxUSE_MENUS + // show the popup menu containing all columns with check marks for the ones + // which are currently shown and return true if something was done using it + // (in this case UpdateColumnVisibility() will have been called) or false + // if the menu was cancelled + // + // this is called from the default right click handler for the controls + // with wxHD_ALLOW_HIDE style + bool ShowColumnsMenu(const wxPoint& pt, const wxString& title = wxString()); + + // append the entries for all our columns to the given menu, with the + // currently visible columns being checked + // + // this is used by ShowColumnsMenu() but can also be used if you use your + // own custom columns menu but nevertheless want to show all the columns in + // it + // + // the ids of the items corresponding to the columns are consecutive and + // start from idColumnsBase + void AddColumnsItems(wxMenu& menu, int idColumnsBase = 0); +#endif // wxUSE_MENUS + + // show the columns customization dialog and return true if something was + // changed using it (in which case UpdateColumnVisibility() and/or + // UpdateColumnsOrder() will have been called) + // + // this is called by the control itself from ShowColumnsMenu() (which in + // turn is only called by the control if wxHD_ALLOW_HIDE style was + // specified) and if the control has wxHD_ALLOW_REORDER style as well + bool ShowCustomizeDialog(); + + // compute column title width + int GetColumnTitleWidth(const wxHeaderColumn& col); + + // compute column title width for the column with the given index + int GetColumnTitleWidth(unsigned int idx) + { + return GetColumnTitleWidth(GetColumn(idx)); + } + + // implementation only from now on + // ------------------------------- + + // the user doesn't need to TAB to this control + virtual bool AcceptsFocusFromKeyboard() const wxOVERRIDE { return false; } + + // this method is only overridden in order to synchronize the control with + // the main window when it is scrolled, the derived class must implement + // DoScrollHorz() + virtual void ScrollWindow(int dx, int dy, const wxRect *rect = NULL) wxOVERRIDE; + +protected: + // this method must be implemented by the derived classes to return the + // information for the given column + virtual const wxHeaderColumn& GetColumn(unsigned int idx) const = 0; + + // this method is called from the default EVT_HEADER_SEPARATOR_DCLICK + // handler to update the fitting column width of the given column, it + // should return true if the width was really updated + virtual bool UpdateColumnWidthToFit(unsigned int WXUNUSED(idx), + int WXUNUSED(widthTitle)) + { + return false; + } + + // this method is called from ShowColumnsMenu() and must be overridden to + // update the internal column visibility (there is no need to call + // UpdateColumn() from here, this will be done internally) + virtual void UpdateColumnVisibility(unsigned int WXUNUSED(idx), + bool WXUNUSED(show)) + { + wxFAIL_MSG( "must be overridden if called" ); + } + + // this method is called from ShowCustomizeDialog() to reorder all columns + // at once and should be implemented for controls using wxHD_ALLOW_REORDER + // style (there is no need to call SetColumnsOrder() from here, this is + // done by the control itself) + virtual void UpdateColumnsOrder(const wxArrayInt& WXUNUSED(order)) + { + wxFAIL_MSG( "must be overridden if called" ); + } + + // this method can be overridden in the derived classes to do something + // (e.g. update/resize some internal data structures) before the number of + // columns in the control changes + virtual void OnColumnCountChanging(unsigned int WXUNUSED(count)) { } + + + // helper function for the derived classes: update the array of column + // indices after the number of columns changed + void DoResizeColumnIndices(wxArrayInt& colIndices, unsigned int count); + +protected: + // this window doesn't look nice with the border so don't use it by default + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + +private: + // methods implementing our public API and defined in platform-specific + // implementations + virtual void DoSetCount(unsigned int count) = 0; + virtual unsigned int DoGetCount() const = 0; + virtual void DoUpdate(unsigned int idx) = 0; + + virtual void DoScrollHorz(int dx) = 0; + + virtual void DoSetColumnsOrder(const wxArrayInt& order) = 0; + virtual wxArrayInt DoGetColumnsOrder() const = 0; + + + // event handlers + void OnSeparatorDClick(wxHeaderCtrlEvent& event); +#if wxUSE_MENUS + void OnRClick(wxHeaderCtrlEvent& event); +#endif // wxUSE_MENUS + + wxDECLARE_EVENT_TABLE(); +}; + +// ---------------------------------------------------------------------------- +// wxHeaderCtrl: port-specific header control implementation, notice that this +// is still an ABC which is meant to be used as part of another +// control, see wxHeaderCtrlSimple for a standalone version +// ---------------------------------------------------------------------------- + +#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) + #include "wx/msw/headerctrl.h" +#else + #define wxHAS_GENERIC_HEADERCTRL + #include "wx/generic/headerctrlg.h" +#endif // platform + +// ---------------------------------------------------------------------------- +// wxHeaderCtrlSimple: concrete header control which can be used standalone +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxHeaderCtrlSimple : public wxHeaderCtrl +{ +public: + // control creation + // ---------------- + + wxHeaderCtrlSimple() { Init(); } + wxHeaderCtrlSimple(wxWindow *parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxHD_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxHeaderCtrlNameStr)) + { + Init(); + + Create(parent, winid, pos, size, style, name); + } + + // managing the columns + // -------------------- + + // insert the column at the given position, using GetColumnCount() as + // position appends it at the end + void InsertColumn(const wxHeaderColumnSimple& col, unsigned int idx) + { + wxCHECK_RET( idx <= GetColumnCount(), "invalid column index" ); + + DoInsert(col, idx); + } + + // append the column to the end of the control + void AppendColumn(const wxHeaderColumnSimple& col) + { + DoInsert(col, GetColumnCount()); + } + + // delete the column at the given index + void DeleteColumn(unsigned int idx) + { + wxCHECK_RET( idx < GetColumnCount(), "invalid column index" ); + + DoDelete(idx); + } + + // delete all the existing columns + void DeleteAllColumns(); + + + // modifying columns + // ----------------- + + // show or hide the column, notice that even when a column is hidden we + // still account for it when using indices + void ShowColumn(unsigned int idx, bool show = true) + { + wxCHECK_RET( idx < GetColumnCount(), "invalid column index" ); + + DoShowColumn(idx, show); + } + + void HideColumn(unsigned int idx) + { + ShowColumn(idx, false); + } + + // indicate that the column is used for sorting + void ShowSortIndicator(unsigned int idx, bool ascending = true) + { + wxCHECK_RET( idx < GetColumnCount(), "invalid column index" ); + + DoShowSortIndicator(idx, ascending); + } + + // remove the sort indicator completely + void RemoveSortIndicator(); + +protected: + // implement/override base class methods + virtual const wxHeaderColumn& GetColumn(unsigned int idx) const wxOVERRIDE; + virtual bool UpdateColumnWidthToFit(unsigned int idx, int widthTitle) wxOVERRIDE; + + // and define another one to be overridden in the derived classes: it + // should return the best width for the given column contents or -1 if not + // implemented, we use it to implement UpdateColumnWidthToFit() + virtual int GetBestFittingWidth(unsigned int WXUNUSED(idx)) const + { + return -1; + } + + void OnHeaderResizing(wxHeaderCtrlEvent& evt); + +private: + // functions implementing our public API + void DoInsert(const wxHeaderColumnSimple& col, unsigned int idx); + void DoDelete(unsigned int idx); + void DoShowColumn(unsigned int idx, bool show); + void DoShowSortIndicator(unsigned int idx, bool ascending); + + // common part of all ctors + void Init(); + + // bring the column count in sync with the number of columns we store + void UpdateColumnCount() + { + SetColumnCount(static_cast(m_cols.size())); + } + + + // all our current columns + typedef wxVector Columns; + Columns m_cols; + + // the column currently used for sorting or -1 if none + unsigned int m_sortKey; + + + wxDECLARE_NO_COPY_CLASS(wxHeaderCtrlSimple); + wxDECLARE_EVENT_TABLE(); +}; + +// ---------------------------------------------------------------------------- +// wxHeaderCtrl events +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxHeaderCtrlEvent : public wxNotifyEvent +{ +public: + wxHeaderCtrlEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) + : wxNotifyEvent(commandType, winid), + m_col(-1), + m_width(0), + m_order(static_cast(-1)) + { + } + + wxHeaderCtrlEvent(const wxHeaderCtrlEvent& event) + : wxNotifyEvent(event), + m_col(event.m_col), + m_width(event.m_width), + m_order(event.m_order) + { + } + + // the column which this event pertains to: valid for all header events + int GetColumn() const { return m_col; } + void SetColumn(int col) { m_col = col; } + + // the width of the column: valid for column resizing/dragging events only + int GetWidth() const { return m_width; } + void SetWidth(int width) { m_width = width; } + + // the new position of the column: for end reorder events only + unsigned int GetNewOrder() const { return m_order; } + void SetNewOrder(unsigned int order) { m_order = order; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxHeaderCtrlEvent(*this); } + +protected: + // the column affected by the event + int m_col; + + // the current width for the dragging events + int m_width; + + // the new column position for end reorder event + unsigned int m_order; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHeaderCtrlEvent); +}; + + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_CLICK, wxHeaderCtrlEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_RIGHT_CLICK, wxHeaderCtrlEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_MIDDLE_CLICK, wxHeaderCtrlEvent ); + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_DCLICK, wxHeaderCtrlEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_RIGHT_DCLICK, wxHeaderCtrlEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_MIDDLE_DCLICK, wxHeaderCtrlEvent ); + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_SEPARATOR_DCLICK, wxHeaderCtrlEvent ); + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_BEGIN_RESIZE, wxHeaderCtrlEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_RESIZING, wxHeaderCtrlEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_END_RESIZE, wxHeaderCtrlEvent ); + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_BEGIN_REORDER, wxHeaderCtrlEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_END_REORDER, wxHeaderCtrlEvent ); + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_DRAGGING_CANCELLED, wxHeaderCtrlEvent ); + +typedef void (wxEvtHandler::*wxHeaderCtrlEventFunction)(wxHeaderCtrlEvent&); + +#define wxHeaderCtrlEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxHeaderCtrlEventFunction, func) + +#define wx__DECLARE_HEADER_EVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_HEADER_ ## evt, id, wxHeaderCtrlEventHandler(fn)) + +#define EVT_HEADER_CLICK(id, fn) wx__DECLARE_HEADER_EVT(CLICK, id, fn) +#define EVT_HEADER_RIGHT_CLICK(id, fn) wx__DECLARE_HEADER_EVT(RIGHT_CLICK, id, fn) +#define EVT_HEADER_MIDDLE_CLICK(id, fn) wx__DECLARE_HEADER_EVT(MIDDLE_CLICK, id, fn) + +#define EVT_HEADER_DCLICK(id, fn) wx__DECLARE_HEADER_EVT(DCLICK, id, fn) +#define EVT_HEADER_RIGHT_DCLICK(id, fn) wx__DECLARE_HEADER_EVT(RIGHT_DCLICK, id, fn) +#define EVT_HEADER_MIDDLE_DCLICK(id, fn) wx__DECLARE_HEADER_EVT(MIDDLE_DCLICK, id, fn) + +#define EVT_HEADER_SEPARATOR_DCLICK(id, fn) wx__DECLARE_HEADER_EVT(SEPARATOR_DCLICK, id, fn) + +#define EVT_HEADER_BEGIN_RESIZE(id, fn) wx__DECLARE_HEADER_EVT(BEGIN_RESIZE, id, fn) +#define EVT_HEADER_RESIZING(id, fn) wx__DECLARE_HEADER_EVT(RESIZING, id, fn) +#define EVT_HEADER_END_RESIZE(id, fn) wx__DECLARE_HEADER_EVT(END_RESIZE, id, fn) + +#define EVT_HEADER_BEGIN_REORDER(id, fn) wx__DECLARE_HEADER_EVT(BEGIN_REORDER, id, fn) +#define EVT_HEADER_END_REORDER(id, fn) wx__DECLARE_HEADER_EVT(END_REORDER, id, fn) + +#define EVT_HEADER_DRAGGING_CANCELLED(id, fn) wx__DECLARE_HEADER_EVT(DRAGGING_CANCELLED, id, fn) + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_HEADER_CLICK wxEVT_HEADER_CLICK +#define wxEVT_COMMAND_HEADER_RIGHT_CLICK wxEVT_HEADER_RIGHT_CLICK +#define wxEVT_COMMAND_HEADER_MIDDLE_CLICK wxEVT_HEADER_MIDDLE_CLICK +#define wxEVT_COMMAND_HEADER_DCLICK wxEVT_HEADER_DCLICK +#define wxEVT_COMMAND_HEADER_RIGHT_DCLICK wxEVT_HEADER_RIGHT_DCLICK +#define wxEVT_COMMAND_HEADER_MIDDLE_DCLICK wxEVT_HEADER_MIDDLE_DCLICK +#define wxEVT_COMMAND_HEADER_SEPARATOR_DCLICK wxEVT_HEADER_SEPARATOR_DCLICK +#define wxEVT_COMMAND_HEADER_BEGIN_RESIZE wxEVT_HEADER_BEGIN_RESIZE +#define wxEVT_COMMAND_HEADER_RESIZING wxEVT_HEADER_RESIZING +#define wxEVT_COMMAND_HEADER_END_RESIZE wxEVT_HEADER_END_RESIZE +#define wxEVT_COMMAND_HEADER_BEGIN_REORDER wxEVT_HEADER_BEGIN_REORDER +#define wxEVT_COMMAND_HEADER_END_REORDER wxEVT_HEADER_END_REORDER +#define wxEVT_COMMAND_HEADER_DRAGGING_CANCELLED wxEVT_HEADER_DRAGGING_CANCELLED + +#endif // wxUSE_HEADERCTRL + +#endif // _WX_HEADERCTRL_H_ diff --git a/lib/wxWidgets/include/wx/help.h b/lib/wxWidgets/include/wx/help.h new file mode 100644 index 0000000..e38bc87 --- /dev/null +++ b/lib/wxWidgets/include/wx/help.h @@ -0,0 +1,39 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/help.h +// Purpose: wxHelpController base header +// Author: wxWidgets Team +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HELP_H_BASE_ +#define _WX_HELP_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_HELP + +#include "wx/helpbase.h" + +#if defined(__WXMSW__) + #include "wx/msw/helpchm.h" + + #define wxHelpController wxCHMHelpController +#else // !MSW + +#if wxUSE_WXHTML_HELP + #include "wx/html/helpctrl.h" + #define wxHelpController wxHtmlHelpController +#else + #include "wx/generic/helpext.h" + #define wxHelpController wxExtHelpController +#endif + +#endif // MSW/!MSW + +#endif // wxUSE_HELP + +#endif + // _WX_HELP_H_BASE_ diff --git a/lib/wxWidgets/include/wx/helpbase.h b/lib/wxWidgets/include/wx/helpbase.h new file mode 100644 index 0000000..4ff7aa7 --- /dev/null +++ b/lib/wxWidgets/include/wx/helpbase.h @@ -0,0 +1,105 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/helpbase.h +// Purpose: Help system base classes +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HELPBASEH__ +#define _WX_HELPBASEH__ + +#include "wx/defs.h" + +#if wxUSE_HELP + +#include "wx/object.h" +#include "wx/string.h" +#include "wx/gdicmn.h" +#include "wx/frame.h" + +// Flags for SetViewer +#define wxHELP_NETSCAPE 1 + +// Search modes: +enum wxHelpSearchMode +{ + wxHELP_SEARCH_INDEX, + wxHELP_SEARCH_ALL +}; + +// Defines the API for help controllers +class WXDLLIMPEXP_CORE wxHelpControllerBase: public wxObject +{ +public: + inline wxHelpControllerBase(wxWindow* parentWindow = NULL) { m_parentWindow = parentWindow; } + inline ~wxHelpControllerBase() {} + + // Must call this to set the filename and server name. + // server is only required when implementing TCP/IP-based + // help controllers. + virtual bool Initialize(const wxString& WXUNUSED(file), int WXUNUSED(server) ) { return false; } + virtual bool Initialize(const wxString& WXUNUSED(file)) { return false; } + + // Set viewer: only relevant to some kinds of controller + virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {} + + // If file is "", reloads file given in Initialize + virtual bool LoadFile(const wxString& file = wxEmptyString) = 0; + + // Displays the contents + virtual bool DisplayContents() = 0; + + // Display the given section + virtual bool DisplaySection(int sectionNo) = 0; + + // Display the section using a context id + virtual bool DisplayContextPopup(int WXUNUSED(contextId)) { return false; } + + // Display the text in a popup, if possible + virtual bool DisplayTextPopup(const wxString& WXUNUSED(text), const wxPoint& WXUNUSED(pos)) { return false; } + + // By default, uses KeywordSection to display a topic. Implementations + // may override this for more specific behaviour. + virtual bool DisplaySection(const wxString& section) { return KeywordSearch(section); } + virtual bool DisplayBlock(long blockNo) = 0; + virtual bool KeywordSearch(const wxString& k, + wxHelpSearchMode mode = wxHELP_SEARCH_ALL) = 0; + /// Allows one to override the default settings for the help frame. + virtual void SetFrameParameters(const wxString& WXUNUSED(title), + const wxSize& WXUNUSED(size), + const wxPoint& WXUNUSED(pos) = wxDefaultPosition, + bool WXUNUSED(newFrameEachTime) = false) + { + // does nothing by default + } + /// Obtains the latest settings used by the help frame and the help + /// frame. + virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL, + wxPoint *WXUNUSED(pos) = NULL, + bool *WXUNUSED(newFrameEachTime) = NULL) + { + return NULL; // does nothing by default + } + + virtual bool Quit() = 0; + virtual void OnQuit() {} + + /// Set the window that can optionally be used for the help window's parent. + virtual void SetParentWindow(wxWindow* win) { m_parentWindow = win; } + + /// Get the window that can optionally be used for the help window's parent. + virtual wxWindow* GetParentWindow() const { return m_parentWindow; } + +protected: + wxWindow* m_parentWindow; +private: + wxDECLARE_CLASS(wxHelpControllerBase); +}; + +#endif // wxUSE_HELP + +#endif +// _WX_HELPBASEH__ diff --git a/lib/wxWidgets/include/wx/helphtml.h b/lib/wxWidgets/include/wx/helphtml.h new file mode 100644 index 0000000..87bc81d --- /dev/null +++ b/lib/wxWidgets/include/wx/helphtml.h @@ -0,0 +1,19 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/helphtml.h +// Purpose: Includes wx/html/helpctrl.h, for wxHtmlHelpController. +// Author: Julian Smart +// Modified by: +// Created: 2003-05-24 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __WX_HELPHTML_H_ +#define __WX_HELPHTML_H_ + +#if wxUSE_WXHTML_HELP +#include "wx/html/helpctrl.h" +#endif + +#endif // __WX_HELPHTML_H_ + diff --git a/lib/wxWidgets/include/wx/helpwin.h b/lib/wxWidgets/include/wx/helpwin.h new file mode 100644 index 0000000..0d79b85 --- /dev/null +++ b/lib/wxWidgets/include/wx/helpwin.h @@ -0,0 +1,19 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/helpwin.h +// Purpose: Includes Windows help +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HELPWIN_H_BASE_ +#define _WX_HELPWIN_H_BASE_ + +#if defined(__WXMSW__) +#include "wx/msw/helpwin.h" +#endif + +#endif + // _WX_HELPWIN_H_BASE_ diff --git a/lib/wxWidgets/include/wx/html/forcelnk.h b/lib/wxWidgets/include/wx/html/forcelnk.h new file mode 100644 index 0000000..8d3631c --- /dev/null +++ b/lib/wxWidgets/include/wx/html/forcelnk.h @@ -0,0 +1,62 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/html/forcelnk.h +// Purpose: macros which force the linker to link apparently unused code +// Author: Vaclav Slavik +// Copyright: (c) Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +/* + +DESCRPITON: + +mod_*.cpp files contain handlers for tags. These files are modules - they contain +one wxTagModule class and it's OnInit() method is called from wxApp's init method. +The module is called even if you only link it into the executable, so everything +seems wonderful. + +The problem is that we have these modules in LIBRARY and mod_*.cpp files contain +no method nor class which is known out of the module. So the linker won't +link these .o/.obj files into executable because it detected that it is not used +by the program. + +To workaround this I introduced set of macros FORCE_LINK_ME and FORCE_LINK. These +macros are generic and are not limited to mod_*.cpp files. You may find them quite +useful somewhere else... + +How to use them: +let's suppose you want to always link file foo.cpp and that you have module +always.cpp that is certainly always linked (e.g. the one with main() function +or htmlwin.cpp in wxHtml library). + +Place FORCE_LINK_ME(foo) somewhere in foo.cpp and FORCE_LINK(foo) somewhere +in always.cpp +See mod_*.cpp and htmlwin.cpp for example :-) + +*/ + + +#ifndef _WX_FORCELNK_H_ +#define _WX_FORCELNK_H_ + +#include "wx/link.h" + +// compatibility defines +#define FORCE_LINK wxFORCE_LINK_MODULE +#define FORCE_LINK_ME wxFORCE_LINK_THIS_MODULE + +#define FORCE_WXHTML_MODULES() \ + FORCE_LINK(m_layout) \ + FORCE_LINK(m_fonts) \ + FORCE_LINK(m_image) \ + FORCE_LINK(m_list) \ + FORCE_LINK(m_dflist) \ + FORCE_LINK(m_pre) \ + FORCE_LINK(m_hline) \ + FORCE_LINK(m_links) \ + FORCE_LINK(m_tables) \ + FORCE_LINK(m_span) \ + FORCE_LINK(m_style) + + +#endif // _WX_FORCELNK_H_ diff --git a/lib/wxWidgets/include/wx/html/helpctrl.h b/lib/wxWidgets/include/wx/html/helpctrl.h new file mode 100644 index 0000000..069320d --- /dev/null +++ b/lib/wxWidgets/include/wx/html/helpctrl.h @@ -0,0 +1,164 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/html/helpctrl.h +// Purpose: wxHtmlHelpController +// Notes: Based on htmlhelp.cpp, implementing a monolithic +// HTML Help controller class, by Vaclav Slavik +// Author: Harm van der Heijden and Vaclav Slavik +// Copyright: (c) Harm van der Heijden and Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HELPCTRL_H_ +#define _WX_HELPCTRL_H_ + +#include "wx/defs.h" + +#if wxUSE_WXHTML_HELP + +#include "wx/helpbase.h" +#include "wx/html/helpfrm.h" + +#define wxID_HTML_HELPFRAME (wxID_HIGHEST + 1) + +// This style indicates that the window is +// embedded in the application and must not be +// destroyed by the help controller. +#define wxHF_EMBEDDED 0x00008000 + +// Create a dialog for the help window. +#define wxHF_DIALOG 0x00010000 + +// Create a frame for the help window. +#define wxHF_FRAME 0x00020000 + +// Make the dialog modal when displaying help. +#define wxHF_MODAL 0x00040000 + +class WXDLLIMPEXP_FWD_HTML wxHtmlHelpDialog; +class WXDLLIMPEXP_FWD_HTML wxHtmlHelpWindow; +class WXDLLIMPEXP_FWD_HTML wxHtmlHelpFrame; +class WXDLLIMPEXP_FWD_HTML wxHtmlHelpDialog; + +class WXDLLIMPEXP_HTML wxHtmlHelpController : public wxHelpControllerBase // wxEvtHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxHtmlHelpController); + +public: + wxHtmlHelpController(int style = wxHF_DEFAULT_STYLE, wxWindow* parentWindow = NULL); + wxHtmlHelpController(wxWindow* parentWindow, int style = wxHF_DEFAULT_STYLE); + + virtual ~wxHtmlHelpController(); + + void SetShouldPreventAppExit(bool enable); + + void SetTitleFormat(const wxString& format); + void SetTempDir(const wxString& path) { m_helpData.SetTempDir(path); } + bool AddBook(const wxString& book_url, bool show_wait_msg = false); + bool AddBook(const wxFileName& book_file, bool show_wait_msg = false); + + bool Display(const wxString& x); + bool Display(int id); + bool DisplayContents() wxOVERRIDE; + bool DisplayIndex(); + bool KeywordSearch(const wxString& keyword, + wxHelpSearchMode mode = wxHELP_SEARCH_ALL) wxOVERRIDE; + + wxHtmlHelpWindow* GetHelpWindow() { return m_helpWindow; } + void SetHelpWindow(wxHtmlHelpWindow* helpWindow); + + wxHtmlHelpFrame* GetFrame() { return m_helpFrame; } + wxHtmlHelpDialog* GetDialog() { return m_helpDialog; } + +#if wxUSE_CONFIG + void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString); + + // Assigns config object to the Ctrl. This config is then + // used in subsequent calls to Read/WriteCustomization of both help + // Ctrl and it's wxHtmlWindow + virtual void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString); + virtual void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString); +#endif // wxUSE_CONFIG + + //// Backward compatibility with wxHelpController API + + virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) wxOVERRIDE { return Initialize(file); } + virtual bool Initialize(const wxString& file) wxOVERRIDE; + virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) wxOVERRIDE {} + virtual bool LoadFile(const wxString& file = wxT("")) wxOVERRIDE; + virtual bool DisplaySection(int sectionNo) wxOVERRIDE; + virtual bool DisplaySection(const wxString& section) wxOVERRIDE { return Display(section); } + virtual bool DisplayBlock(long blockNo) wxOVERRIDE { return DisplaySection(static_cast(blockNo)); } + virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos) wxOVERRIDE; + + virtual void SetFrameParameters(const wxString& titleFormat, + const wxSize& size, + const wxPoint& pos = wxDefaultPosition, + bool newFrameEachTime = false) wxOVERRIDE; + /// Obtains the latest settings used by the help frame and the help + /// frame. + virtual wxFrame *GetFrameParameters(wxSize *size = NULL, + wxPoint *pos = NULL, + bool *newFrameEachTime = NULL) wxOVERRIDE; + + // Get direct access to help data: + wxHtmlHelpData *GetHelpData() { return &m_helpData; } + + virtual bool Quit() wxOVERRIDE ; + virtual void OnQuit() wxOVERRIDE {} + + void OnCloseFrame(wxCloseEvent& evt); + + // Make the help controller's frame 'modal' if + // needed + void MakeModalIfNeeded(); + + // Find the top-most parent window + wxWindow* FindTopLevelWindow(); + +protected: + void Init(int style); + + virtual wxWindow* CreateHelpWindow(); + virtual wxHtmlHelpFrame* CreateHelpFrame(wxHtmlHelpData *data); + virtual wxHtmlHelpDialog* CreateHelpDialog(wxHtmlHelpData *data); + virtual void DestroyHelpWindow(); + + wxHtmlHelpData m_helpData; + wxHtmlHelpWindow* m_helpWindow; +#if wxUSE_CONFIG + wxConfigBase * m_Config; + wxString m_ConfigRoot; +#endif // wxUSE_CONFIG + wxString m_titleFormat; + int m_FrameStyle; + wxHtmlHelpFrame* m_helpFrame; + wxHtmlHelpDialog* m_helpDialog; + + bool m_shouldPreventAppExit; + + wxDECLARE_NO_COPY_CLASS(wxHtmlHelpController); +}; + +/* + * wxHtmlModalHelp + * A convenience class particularly for use on wxMac, + * where you can only show modal dialogs from a modal + * dialog. + * + * Use like this: + * + * wxHtmlModalHelp help(parent, filename, topic); + * + * If topic is empty, the help contents is displayed. + */ + +class WXDLLIMPEXP_HTML wxHtmlModalHelp +{ +public: + wxHtmlModalHelp(wxWindow* parent, const wxString& helpFile, const wxString& topic = wxEmptyString, + int style = wxHF_DEFAULT_STYLE | wxHF_DIALOG | wxHF_MODAL); +}; + +#endif // wxUSE_WXHTML_HELP + +#endif // _WX_HELPCTRL_H_ diff --git a/lib/wxWidgets/include/wx/html/helpdata.h b/lib/wxWidgets/include/wx/html/helpdata.h new file mode 100644 index 0000000..8e54cd7 --- /dev/null +++ b/lib/wxWidgets/include/wx/html/helpdata.h @@ -0,0 +1,222 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/html/helpdata.h +// Purpose: wxHtmlHelpData +// Notes: Based on htmlhelp.cpp, implementing a monolithic +// HTML Help controller class, by Vaclav Slavik +// Author: Harm van der Heijden and Vaclav Slavik +// Copyright: (c) Harm van der Heijden and Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HELPDATA_H_ +#define _WX_HELPDATA_H_ + +#include "wx/defs.h" + +#if wxUSE_HTML + +#include "wx/object.h" +#include "wx/string.h" +#include "wx/filesys.h" +#include "wx/dynarray.h" +#include "wx/font.h" + +class WXDLLIMPEXP_FWD_HTML wxHtmlHelpData; + +//-------------------------------------------------------------------------------- +// helper classes & structs +//-------------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlBookRecord +{ +public: + wxHtmlBookRecord(const wxString& bookfile, const wxString& basepath, + const wxString& title, const wxString& start) + : m_BookFile(bookfile) + , m_BasePath(basepath) + , m_Title(title) + , m_Start(start) + { + // for debugging, give the contents index obvious default values + m_ContentsStart = m_ContentsEnd = -1; + } + wxString GetBookFile() const { return m_BookFile; } + wxString GetTitle() const { return m_Title; } + wxString GetStart() const { return m_Start; } + wxString GetBasePath() const { return m_BasePath; } + /* SetContentsRange: store in the bookrecord where in the index/contents lists the + * book's records are stored. This to facilitate searching in a specific book. + * This code will have to be revised when loading/removing books becomes dynamic. + * (as opposed to appending only) + * Note that storing index range is pointless, because the index is alphab. sorted. */ + void SetContentsRange(int start, int end) { m_ContentsStart = start; m_ContentsEnd = end; } + int GetContentsStart() const { return m_ContentsStart; } + int GetContentsEnd() const { return m_ContentsEnd; } + + void SetTitle(const wxString& title) { m_Title = title; } + void SetBasePath(const wxString& path) { m_BasePath = path; } + void SetStart(const wxString& start) { m_Start = start; } + + // returns full filename of page (which is part of the book), + // i.e. with book's basePath prepended. If page is already absolute + // path, basePath is _not_ prepended. + wxString GetFullPath(const wxString &page) const; + +protected: + wxString m_BookFile; + wxString m_BasePath; + wxString m_Title; + wxString m_Start; + int m_ContentsStart; + int m_ContentsEnd; +}; + + +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxHtmlBookRecord, wxHtmlBookRecArray, + WXDLLIMPEXP_HTML); + +struct WXDLLIMPEXP_HTML wxHtmlHelpDataItem +{ + wxHtmlHelpDataItem() : level(0), parent(NULL), id(wxID_ANY), book(NULL) {} + + int level; + wxHtmlHelpDataItem *parent; + int id; + wxString name; + wxString page; + wxHtmlBookRecord *book; + + // returns full filename of m_Page, i.e. with book's basePath prepended + wxString GetFullPath() const { return book->GetFullPath(page); } + + // returns item indented with spaces if it has level>1: + wxString GetIndentedName() const; +}; + +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxHtmlHelpDataItem, wxHtmlHelpDataItems, + WXDLLIMPEXP_HTML); + + +//------------------------------------------------------------------------------ +// wxHtmlSearchEngine +// This class takes input streams and scans them for occurrence +// of keyword(s) +//------------------------------------------------------------------------------ + +class WXDLLIMPEXP_HTML wxHtmlSearchEngine : public wxObject +{ +public: + wxHtmlSearchEngine() : wxObject() {} + virtual ~wxHtmlSearchEngine() {} + + // Sets the keyword we will be searching for + virtual void LookFor(const wxString& keyword, bool case_sensitive, bool whole_words_only); + + // Scans the stream for the keyword. + // Returns true if the stream contains keyword, fALSE otherwise + virtual bool Scan(const wxFSFile& file); + +private: + wxString m_Keyword; + bool m_CaseSensitive; + bool m_WholeWords; + + wxDECLARE_NO_COPY_CLASS(wxHtmlSearchEngine); +}; + + +// State information of a search action. I'd have preferred to make this a +// nested class inside wxHtmlHelpData, but that's against coding standards :-( +// Never construct this class yourself, obtain a copy from +// wxHtmlHelpData::PrepareKeywordSearch(const wxString& key) +class WXDLLIMPEXP_HTML wxHtmlSearchStatus +{ +public: + // constructor; supply wxHtmlHelpData ptr, the keyword and (optionally) the + // title of the book to search. By default, all books are searched. + wxHtmlSearchStatus(wxHtmlHelpData* base, const wxString& keyword, + bool case_sensitive, bool whole_words_only, + const wxString& book = wxEmptyString); + bool Search(); // do the next iteration + bool IsActive() const { return m_Active; } + int GetCurIndex() const { return m_CurIndex; } + int GetMaxIndex() const { return m_MaxIndex; } + const wxString& GetName() const { return m_Name; } + + const wxHtmlHelpDataItem *GetCurItem() const { return m_CurItem; } + +private: + wxHtmlHelpData* m_Data; + wxHtmlSearchEngine m_Engine; + wxString m_Keyword, m_Name; + wxString m_LastPage; + wxHtmlHelpDataItem* m_CurItem; + bool m_Active; // search is not finished + int m_CurIndex; // where we are now + int m_MaxIndex; // number of files we search + // For progress bar: 100*curindex/maxindex = % complete + + wxDECLARE_NO_COPY_CLASS(wxHtmlSearchStatus); +}; + +class WXDLLIMPEXP_HTML wxHtmlHelpData : public wxObject +{ + wxDECLARE_DYNAMIC_CLASS(wxHtmlHelpData); + friend class wxHtmlSearchStatus; + +public: + wxHtmlHelpData(); + virtual ~wxHtmlHelpData(); + + // Sets directory where temporary files are stored. + // These temp files are index & contents file in binary (much faster to read) + // form. These files are NOT deleted on program's exit. + void SetTempDir(const wxString& path); + + // Adds new book. 'book' is location of .htb file (stands for "html book"). + // See documentation for details on its format. + // Returns success. + bool AddBook(const wxString& book); + bool AddBookParam(const wxFSFile& bookfile, + wxFontEncoding encoding, + const wxString& title, const wxString& contfile, + const wxString& indexfile = wxEmptyString, + const wxString& deftopic = wxEmptyString, + const wxString& path = wxEmptyString); + + // Some accessing stuff: + + // returns URL of page on basis of (file)name + wxString FindPageByName(const wxString& page); + // returns URL of page on basis of MS id + wxString FindPageById(int id); + + const wxHtmlBookRecArray& GetBookRecArray() const { return m_bookRecords; } + + const wxHtmlHelpDataItems& GetContentsArray() const { return m_contents; } + const wxHtmlHelpDataItems& GetIndexArray() const { return m_index; } + +protected: + wxString m_tempPath; + + // each book has one record in this array: + wxHtmlBookRecArray m_bookRecords; + + wxHtmlHelpDataItems m_contents; // list of all available books and pages + wxHtmlHelpDataItems m_index; // list of index items + +protected: + // Imports .hhp files (MS HTML Help Workshop) + bool LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys, + const wxString& indexfile, const wxString& contentsfile); + // Reads binary book + bool LoadCachedBook(wxHtmlBookRecord *book, wxInputStream *f); + // Writes binary book + bool SaveCachedBook(wxHtmlBookRecord *book, wxOutputStream *f); + + wxDECLARE_NO_COPY_CLASS(wxHtmlHelpData); +}; + +#endif + +#endif diff --git a/lib/wxWidgets/include/wx/html/helpdlg.h b/lib/wxWidgets/include/wx/html/helpdlg.h new file mode 100644 index 0000000..ef0ccf2 --- /dev/null +++ b/lib/wxWidgets/include/wx/html/helpdlg.h @@ -0,0 +1,89 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/html/helpdlg.h +// Purpose: wxHtmlHelpDialog +// Notes: Based on htmlhelp.cpp, implementing a monolithic +// HTML Help controller class, by Vaclav Slavik +// Author: Harm van der Heijden, Vaclav Slavik, Julian Smart +// Copyright: (c) Harm van der Heijden, Vaclav Slavik, Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HELPDLG_H_ +#define _WX_HELPDLG_H_ + +#include "wx/defs.h" + +#if wxUSE_WXHTML_HELP + +#include "wx/html/helpdata.h" +#include "wx/window.h" +#include "wx/dialog.h" +#include "wx/frame.h" +#include "wx/config.h" +#include "wx/splitter.h" +#include "wx/notebook.h" +#include "wx/listbox.h" +#include "wx/choice.h" +#include "wx/combobox.h" +#include "wx/checkbox.h" +#include "wx/stattext.h" +#include "wx/html/htmlwin.h" +#include "wx/html/helpwnd.h" +#include "wx/html/htmprint.h" + +class WXDLLIMPEXP_FWD_HTML wxHtmlHelpController; +class WXDLLIMPEXP_FWD_HTML wxHtmlHelpWindow; + +class WXDLLIMPEXP_HTML wxHtmlHelpDialog : public wxDialog +{ + wxDECLARE_DYNAMIC_CLASS(wxHtmlHelpDialog); + +public: + wxHtmlHelpDialog(wxHtmlHelpData* data = NULL) { Init(data); } + wxHtmlHelpDialog(wxWindow* parent, wxWindowID id, + const wxString& title = wxEmptyString, + int style = wxHF_DEFAULT_STYLE, wxHtmlHelpData* data = NULL); + virtual ~wxHtmlHelpDialog(); + + bool Create(wxWindow* parent, wxWindowID id, const wxString& title = wxEmptyString, + int style = wxHF_DEFAULT_STYLE); + + /// Returns the data associated with this dialog. + wxHtmlHelpData* GetData() { return m_Data; } + + /// Returns the controller that created this dialog. + wxHtmlHelpController* GetController() const { return m_helpController; } + + /// Sets the controller associated with this dialog. + void SetController(wxHtmlHelpController* controller) { m_helpController = controller; } + + /// Returns the help window. + wxHtmlHelpWindow* GetHelpWindow() const { return m_HtmlHelpWin; } + + // Sets format of title of the frame. Must contain exactly one "%s" + // (for title of displayed HTML page) + void SetTitleFormat(const wxString& format); + + // Override to add custom buttons to the toolbar + virtual void AddToolbarButtons(wxToolBar* WXUNUSED(toolBar), int WXUNUSED(style)) {} + +protected: + void Init(wxHtmlHelpData* data = NULL); + + void OnCloseWindow(wxCloseEvent& event); + +protected: + // Temporary pointer to pass to window + wxHtmlHelpData* m_Data; + wxString m_TitleFormat; // title of the help frame + wxHtmlHelpWindow *m_HtmlHelpWin; + wxHtmlHelpController* m_helpController; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxHtmlHelpDialog); +}; + +#endif + // wxUSE_WXHTML_HELP + +#endif diff --git a/lib/wxWidgets/include/wx/html/helpfrm.h b/lib/wxWidgets/include/wx/html/helpfrm.h new file mode 100644 index 0000000..ac25907 --- /dev/null +++ b/lib/wxWidgets/include/wx/html/helpfrm.h @@ -0,0 +1,152 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/html/helpfrm.h +// Purpose: wxHtmlHelpFrame +// Notes: Based on htmlhelp.cpp, implementing a monolithic +// HTML Help controller class, by Vaclav Slavik +// Author: Harm van der Heijden and Vaclav Slavik +// Copyright: (c) Harm van der Heijden and Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HELPFRM_H_ +#define _WX_HELPFRM_H_ + +#include "wx/defs.h" + +#if wxUSE_WXHTML_HELP + +#include "wx/helpbase.h" +#include "wx/html/helpdata.h" +#include "wx/window.h" +#include "wx/frame.h" +#include "wx/config.h" +#include "wx/splitter.h" +#include "wx/notebook.h" +#include "wx/listbox.h" +#include "wx/choice.h" +#include "wx/combobox.h" +#include "wx/checkbox.h" +#include "wx/stattext.h" +#include "wx/html/htmlwin.h" +#include "wx/html/helpwnd.h" +#include "wx/html/htmprint.h" + +class WXDLLIMPEXP_FWD_CORE wxButton; +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; +class WXDLLIMPEXP_FWD_CORE wxTreeEvent; +class WXDLLIMPEXP_FWD_CORE wxTreeCtrl; + + +// style flags for the Help Frame +#define wxHF_TOOLBAR 0x0001 +#define wxHF_CONTENTS 0x0002 +#define wxHF_INDEX 0x0004 +#define wxHF_SEARCH 0x0008 +#define wxHF_BOOKMARKS 0x0010 +#define wxHF_OPEN_FILES 0x0020 +#define wxHF_PRINT 0x0040 +#define wxHF_FLAT_TOOLBAR 0x0080 +#define wxHF_MERGE_BOOKS 0x0100 +#define wxHF_ICONS_BOOK 0x0200 +#define wxHF_ICONS_BOOK_CHAPTER 0x0400 +#define wxHF_ICONS_FOLDER 0x0000 // this is 0 since it is default +#define wxHF_DEFAULT_STYLE (wxHF_TOOLBAR | wxHF_CONTENTS | \ + wxHF_INDEX | wxHF_SEARCH | \ + wxHF_BOOKMARKS | wxHF_PRINT) +//compatibility: +#define wxHF_OPENFILES wxHF_OPEN_FILES +#define wxHF_FLATTOOLBAR wxHF_FLAT_TOOLBAR +#define wxHF_DEFAULTSTYLE wxHF_DEFAULT_STYLE + +struct wxHtmlHelpMergedIndexItem; +class wxHtmlHelpMergedIndex; + +class WXDLLIMPEXP_FWD_CORE wxHelpControllerBase; +class WXDLLIMPEXP_FWD_HTML wxHtmlHelpController; +class WXDLLIMPEXP_FWD_HTML wxHtmlHelpWindow; + +class WXDLLIMPEXP_HTML wxHtmlHelpFrame : public wxFrame +{ + wxDECLARE_DYNAMIC_CLASS(wxHtmlHelpFrame); + +public: + wxHtmlHelpFrame(wxHtmlHelpData* data = NULL) { Init(data); } + wxHtmlHelpFrame(wxWindow* parent, wxWindowID id, + const wxString& title = wxEmptyString, + int style = wxHF_DEFAULT_STYLE, wxHtmlHelpData* data = NULL +#if wxUSE_CONFIG + , wxConfigBase *config=NULL, const wxString& rootpath = wxEmptyString +#endif // wxUSE_CONFIG + ); + bool Create(wxWindow* parent, wxWindowID id, const wxString& title = wxEmptyString, + int style = wxHF_DEFAULT_STYLE +#if wxUSE_CONFIG + , wxConfigBase *config=NULL, const wxString& rootpath = wxEmptyString +#endif // wxUSE_CONFIG + ); + virtual ~wxHtmlHelpFrame(); + + /// Returns the data associated with the window. + wxHtmlHelpData* GetData() { return m_Data; } + + /// Returns the help controller associated with the window. + wxHtmlHelpController* GetController() const { return m_helpController; } + + /// Sets the help controller associated with the window. + void SetController(wxHtmlHelpController* controller); + + /// Returns the help window. + wxHtmlHelpWindow* GetHelpWindow() const { return m_HtmlHelpWin; } + + // Sets format of title of the frame. Must contain exactly one "%s" + // (for title of displayed HTML page) + void SetTitleFormat(const wxString& format); + +#if wxUSE_CONFIG + // For compatibility + void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString); +#endif // wxUSE_CONFIG + + // Make the help controller's frame 'modal' if + // needed + void AddGrabIfNeeded(); + + // Override to add custom buttons to the toolbar + virtual void AddToolbarButtons(wxToolBar* WXUNUSED(toolBar), int WXUNUSED(style)) {} + + void SetShouldPreventAppExit(bool enable); + + // we don't want to prevent the app from closing just because a help window + // remains opened + virtual bool ShouldPreventAppExit() const wxOVERRIDE { return m_shouldPreventAppExit; } + +protected: + void Init(wxHtmlHelpData* data = NULL); + + void OnCloseWindow(wxCloseEvent& event); + void OnActivate(wxActivateEvent& event); + + // Images: + enum { + IMG_Book = 0, + IMG_Folder, + IMG_Page + }; + +protected: + wxHtmlHelpData* m_Data; + bool m_DataCreated; // m_Data created by frame, or supplied? + wxString m_TitleFormat; // title of the help frame + wxHtmlHelpWindow *m_HtmlHelpWin; + wxHtmlHelpController* m_helpController; + bool m_shouldPreventAppExit; + +private: + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxHtmlHelpFrame); +}; + +#endif // wxUSE_WXHTML_HELP + +#endif diff --git a/lib/wxWidgets/include/wx/html/helpwnd.h b/lib/wxWidgets/include/wx/html/helpwnd.h new file mode 100644 index 0000000..ffa8369 --- /dev/null +++ b/lib/wxWidgets/include/wx/html/helpwnd.h @@ -0,0 +1,304 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/html/helpwnd.h +// Purpose: wxHtmlHelpWindow +// Notes: Based on htmlhelp.cpp, implementing a monolithic +// HTML Help controller class, by Vaclav Slavik +// Author: Harm van der Heijden and Vaclav Slavik +// Copyright: (c) Harm van der Heijden and Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HELPWND_H_ +#define _WX_HELPWND_H_ + +#include "wx/defs.h" + +#if wxUSE_WXHTML_HELP + +#include "wx/helpbase.h" +#include "wx/html/helpdata.h" +#include "wx/window.h" +#include "wx/frame.h" +#include "wx/config.h" +#include "wx/splitter.h" +#include "wx/notebook.h" +#include "wx/listbox.h" +#include "wx/choice.h" +#include "wx/combobox.h" +#include "wx/checkbox.h" +#include "wx/stattext.h" +#include "wx/hash.h" +#include "wx/html/htmlwin.h" +#include "wx/html/htmprint.h" + +class WXDLLIMPEXP_FWD_CORE wxButton; +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; +class WXDLLIMPEXP_FWD_CORE wxTreeEvent; +class WXDLLIMPEXP_FWD_CORE wxTreeCtrl; + +// style flags for the Help Frame +#define wxHF_TOOLBAR 0x0001 +#define wxHF_CONTENTS 0x0002 +#define wxHF_INDEX 0x0004 +#define wxHF_SEARCH 0x0008 +#define wxHF_BOOKMARKS 0x0010 +#define wxHF_OPEN_FILES 0x0020 +#define wxHF_PRINT 0x0040 +#define wxHF_FLAT_TOOLBAR 0x0080 +#define wxHF_MERGE_BOOKS 0x0100 +#define wxHF_ICONS_BOOK 0x0200 +#define wxHF_ICONS_BOOK_CHAPTER 0x0400 +#define wxHF_ICONS_FOLDER 0x0000 // this is 0 since it is default +#define wxHF_DEFAULT_STYLE (wxHF_TOOLBAR | wxHF_CONTENTS | \ + wxHF_INDEX | wxHF_SEARCH | \ + wxHF_BOOKMARKS | wxHF_PRINT) +//compatibility: +#define wxHF_OPENFILES wxHF_OPEN_FILES +#define wxHF_FLATTOOLBAR wxHF_FLAT_TOOLBAR +#define wxHF_DEFAULTSTYLE wxHF_DEFAULT_STYLE + +struct wxHtmlHelpFrameCfg +{ + int x, y, w, h; + long sashpos; + bool navig_on; +}; + +struct wxHtmlHelpMergedIndexItem; +class wxHtmlHelpMergedIndex; + +class WXDLLIMPEXP_FWD_CORE wxHelpControllerBase; +class WXDLLIMPEXP_FWD_HTML wxHtmlHelpController; + +/*! + * Help window + */ + +class WXDLLIMPEXP_HTML wxHtmlHelpWindow : public wxWindow +{ + wxDECLARE_DYNAMIC_CLASS(wxHtmlHelpWindow); + +public: + wxHtmlHelpWindow(wxHtmlHelpData* data = NULL) { Init(data); } + wxHtmlHelpWindow(wxWindow* parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int style = wxTAB_TRAVERSAL|wxNO_BORDER, + int helpStyle = wxHF_DEFAULT_STYLE, + wxHtmlHelpData* data = NULL); + bool Create(wxWindow* parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int style = wxTAB_TRAVERSAL|wxNO_BORDER, + int helpStyle = wxHF_DEFAULT_STYLE); + virtual ~wxHtmlHelpWindow(); + + wxHtmlHelpData* GetData() { return m_Data; } + wxHtmlHelpController* GetController() const { return m_helpController; } + void SetController(wxHtmlHelpController* controller); + + // Displays page x. If not found it will offect the user a choice of + // searching books. + // Looking for the page runs in these steps: + // 1. try to locate file named x (if x is for example "doc/howto.htm") + // 2. try to open starting page of book x + // 3. try to find x in contents (if x is for example "How To ...") + // 4. try to find x in index (if x is for example "How To ...") + bool Display(const wxString& x); + + // Alternative version that works with numeric ID. + // (uses extension to MS format, , see docs) + bool Display(int id); + + // Displays help window and focuses contents. + bool DisplayContents(); + + // Displays help window and focuses index. + bool DisplayIndex(); + + // Searches for keyword. Returns true and display page if found, return + // false otherwise + // Syntax of keyword is Altavista-like: + // * words are separated by spaces + // (but "\"hello world\"" is only one world "hello world") + // * word may be pretended by + or - + // (+ : page must contain the word ; - : page can't contain the word) + // * if there is no + or - before the word, + is default + bool KeywordSearch(const wxString& keyword, + wxHelpSearchMode mode = wxHELP_SEARCH_ALL); + +#if wxUSE_CONFIG + void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString) + { + m_Config = config; + m_ConfigRoot = rootpath; + ReadCustomization(config, rootpath); + } + + // Saves custom settings into cfg config. it will use the path 'path' + // if given, otherwise it will save info into currently selected path. + // saved values : things set by SetFonts, SetBorders. + void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString); + void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString); +#endif // wxUSE_CONFIG + + // call this to let wxHtmlHelpWindow know page changed + void NotifyPageChanged(); + + // Refreshes Contents and Index tabs + void RefreshLists(); + + // Gets the HTML window + wxHtmlWindow* GetHtmlWindow() const { return m_HtmlWin; } + + // Gets the splitter window + wxSplitterWindow* GetSplitterWindow() const { return m_Splitter; } + + // Gets the toolbar + wxToolBar* GetToolBar() const { return m_toolBar; } + + // Gets the configuration data + wxHtmlHelpFrameCfg& GetCfgData() { return m_Cfg; } + + // Gets the tree control + wxTreeCtrl *GetTreeCtrl() const { return m_ContentsBox; } + +protected: + void Init(wxHtmlHelpData* data = NULL); + + // Adds items to m_Contents tree control + void CreateContents(); + + // Adds items to m_IndexList + void CreateIndex(); + + // Add books to search choice panel + void CreateSearch(); + + // Updates "merged index" structure that combines indexes of all books + // into better searchable structure + void UpdateMergedIndex(); + + // Add custom buttons to toolbar + virtual void AddToolbarButtons(wxToolBar *toolBar, int style); + + // Displays options dialog (fonts etc.) + virtual void OptionsDialog(); + + void OnToolbar(wxCommandEvent& event); + void OnContentsSel(wxTreeEvent& event); + void OnIndexSel(wxCommandEvent& event); + void OnIndexFind(wxCommandEvent& event); + void OnIndexAll(wxCommandEvent& event); + void OnSearchSel(wxCommandEvent& event); + void OnSearch(wxCommandEvent& event); + void OnBookmarksSel(wxCommandEvent& event); + void OnSize(wxSizeEvent& event); + + // Images: + enum { + IMG_Book = 0, + IMG_Folder, + IMG_Page + }; + +protected: + wxHtmlHelpData* m_Data; + bool m_DataCreated; // m_Data created by frame, or supplied? + wxString m_TitleFormat; // title of the help frame + // below are various pointers to GUI components + wxHtmlWindow *m_HtmlWin; + wxSplitterWindow *m_Splitter; + wxPanel *m_NavigPan; + wxNotebook *m_NavigNotebook; + wxTreeCtrl *m_ContentsBox; + wxTextCtrl *m_IndexText; + wxButton *m_IndexButton; + wxButton *m_IndexButtonAll; + wxListBox *m_IndexList; + wxTextCtrl *m_SearchText; + wxButton *m_SearchButton; + wxListBox *m_SearchList; + wxChoice *m_SearchChoice; + wxStaticText *m_IndexCountInfo; + wxCheckBox *m_SearchCaseSensitive; + wxCheckBox *m_SearchWholeWords; + wxToolBar* m_toolBar; + + wxComboBox *m_Bookmarks; + wxArrayString m_BookmarksNames, m_BookmarksPages; + + wxHtmlHelpFrameCfg m_Cfg; + +#if wxUSE_CONFIG + wxConfigBase *m_Config; + wxString m_ConfigRoot; +#endif // wxUSE_CONFIG + + // pagenumbers of controls in notebook (usually 0,1,2) + int m_ContentsPage; + int m_IndexPage; + int m_SearchPage; + + // lists of available fonts (used in options dialog) + wxArrayString *m_NormalFonts, *m_FixedFonts; + int m_FontSize; // 0,1,2 = small,medium,big + wxString m_NormalFace, m_FixedFace; + + bool m_UpdateContents; + +#if wxUSE_PRINTING_ARCHITECTURE + wxHtmlEasyPrinting *m_Printer; +#endif + wxHashTable *m_PagesHash; + wxHtmlHelpController* m_helpController; + + int m_hfStyle; + +private: + void DoIndexFind(); + void DoIndexAll(); + void DisplayIndexItem(const wxHtmlHelpMergedIndexItem *it); + wxHtmlHelpMergedIndex *m_mergedIndex; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxHtmlHelpWindow); +}; + +/*! + * Command IDs + */ + +enum +{ + //wxID_HTML_HELPFRAME = wxID_HIGHEST + 1, + wxID_HTML_PANEL = wxID_HIGHEST + 10, + wxID_HTML_BACK, + wxID_HTML_FORWARD, + wxID_HTML_UPNODE, + wxID_HTML_UP, + wxID_HTML_DOWN, + wxID_HTML_PRINT, + wxID_HTML_OPENFILE, + wxID_HTML_OPTIONS, + wxID_HTML_BOOKMARKSLIST, + wxID_HTML_BOOKMARKSADD, + wxID_HTML_BOOKMARKSREMOVE, + wxID_HTML_TREECTRL, + wxID_HTML_INDEXPAGE, + wxID_HTML_INDEXLIST, + wxID_HTML_INDEXTEXT, + wxID_HTML_INDEXBUTTON, + wxID_HTML_INDEXBUTTONALL, + wxID_HTML_NOTEBOOK, + wxID_HTML_SEARCHPAGE, + wxID_HTML_SEARCHTEXT, + wxID_HTML_SEARCHLIST, + wxID_HTML_SEARCHBUTTON, + wxID_HTML_SEARCHCHOICE, + wxID_HTML_COUNTINFO +}; + +#endif // wxUSE_WXHTML_HELP + +#endif diff --git a/lib/wxWidgets/include/wx/html/htmlcell.h b/lib/wxWidgets/include/wx/html/htmlcell.h new file mode 100644 index 0000000..d164406 --- /dev/null +++ b/lib/wxWidgets/include/wx/html/htmlcell.h @@ -0,0 +1,748 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/html/htmlcell.h +// Purpose: wxHtmlCell class is used by wxHtmlWindow/wxHtmlWinParser +// as a basic visual element of HTML page +// Author: Vaclav Slavik +// Copyright: (c) 1999-2003 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HTMLCELL_H_ +#define _WX_HTMLCELL_H_ + +#include "wx/defs.h" + +#if wxUSE_HTML + +#include "wx/html/htmltag.h" +#include "wx/html/htmldefs.h" +#include "wx/window.h" +#include "wx/brush.h" + + +class WXDLLIMPEXP_FWD_HTML wxHtmlWindowInterface; +class WXDLLIMPEXP_FWD_HTML wxHtmlLinkInfo; +class WXDLLIMPEXP_FWD_HTML wxHtmlCell; +class WXDLLIMPEXP_FWD_HTML wxHtmlContainerCell; + + +// wxHtmlSelection is data holder with information about text selection. +// Selection is defined by two positions (beginning and end of the selection) +// and two leaf(!) cells at these positions. +class WXDLLIMPEXP_HTML wxHtmlSelection +{ +public: + wxHtmlSelection() + : m_fromPos(wxDefaultPosition), m_toPos(wxDefaultPosition), + m_fromCharacterPos(-1), m_toCharacterPos(-1), + m_fromCell(NULL), m_toCell(NULL), + m_extBeforeSel(0), m_extBeforeSelEnd(0) {} + + // this version is used for the user selection defined with the mouse + void Set(const wxPoint& fromPos, const wxHtmlCell *fromCell, + const wxPoint& toPos, const wxHtmlCell *toCell); + void Set(const wxHtmlCell *fromCell, const wxHtmlCell *toCell); + + const wxHtmlCell *GetFromCell() const { return m_fromCell; } + const wxHtmlCell *GetToCell() const { return m_toCell; } + + // these values are in absolute coordinates: + const wxPoint& GetFromPos() const { return m_fromPos; } + const wxPoint& GetToPos() const { return m_toPos; } + + // these are From/ToCell's private data + void ClearFromToCharacterPos() { m_toCharacterPos = m_fromCharacterPos = -1; } + bool AreFromToCharacterPosSet() const { return m_toCharacterPos != -1 && m_fromCharacterPos != -1; } + + void SetFromCharacterPos (wxCoord pos) { m_fromCharacterPos = pos; } + void SetToCharacterPos (wxCoord pos) { m_toCharacterPos = pos; } + wxCoord GetFromCharacterPos () const { return m_fromCharacterPos; } + wxCoord GetToCharacterPos () const { return m_toCharacterPos; } + + void SetExtentBeforeSelection(unsigned ext) { m_extBeforeSel = ext; } + void SetExtentBeforeSelectionEnd(unsigned ext) { m_extBeforeSelEnd = ext; } + unsigned GetExtentBeforeSelection() const { return m_extBeforeSel; } + unsigned GetExtentBeforeSelectionEnd() const { return m_extBeforeSelEnd; } + + bool IsEmpty() const + { return m_fromPos == wxDefaultPosition && + m_toPos == wxDefaultPosition; } + +private: + wxPoint m_fromPos, m_toPos; + wxCoord m_fromCharacterPos, m_toCharacterPos; + const wxHtmlCell *m_fromCell, *m_toCell; + + // Extent of the text before selection start. + unsigned m_extBeforeSel; + + // Extent of the text from the beginning to the selection end. + unsigned m_extBeforeSelEnd; +}; + + + +enum wxHtmlSelectionState +{ + wxHTML_SEL_OUT, // currently rendered cell is outside the selection + wxHTML_SEL_IN, // ... is inside selection + wxHTML_SEL_CHANGING // ... is the cell on which selection state changes +}; + +// Selection state is passed to wxHtmlCell::Draw so that it can render itself +// differently e.g. when inside text selection or outside it. +class WXDLLIMPEXP_HTML wxHtmlRenderingState +{ +public: + wxHtmlRenderingState() : m_selState(wxHTML_SEL_OUT) { m_bgMode = wxBRUSHSTYLE_SOLID; } + + void SetSelectionState(wxHtmlSelectionState s) { m_selState = s; } + wxHtmlSelectionState GetSelectionState() const { return m_selState; } + + void SetFgColour(const wxColour& c) { m_fgColour = c; } + const wxColour& GetFgColour() const { return m_fgColour; } + void SetBgColour(const wxColour& c) { m_bgColour = c; } + const wxColour& GetBgColour() const { return m_bgColour; } + void SetBgMode(int m) { m_bgMode = m; } + int GetBgMode() const { return m_bgMode; } + +private: + wxHtmlSelectionState m_selState; + wxColour m_fgColour, m_bgColour; + int m_bgMode; +}; + + +// HTML rendering customization. This class is used when rendering wxHtmlCells +// as a callback: +class WXDLLIMPEXP_HTML wxHtmlRenderingStyle +{ +public: + virtual ~wxHtmlRenderingStyle() {} + virtual wxColour GetSelectedTextColour(const wxColour& clr) = 0; + virtual wxColour GetSelectedTextBgColour(const wxColour& clr) = 0; +}; + +// Standard style: +class WXDLLIMPEXP_HTML wxDefaultHtmlRenderingStyle : public wxHtmlRenderingStyle +{ +public: + explicit wxDefaultHtmlRenderingStyle(const wxWindowBase* wnd = NULL) + : m_wnd(wnd) + {} + + virtual wxColour GetSelectedTextColour(const wxColour& clr) wxOVERRIDE; + virtual wxColour GetSelectedTextBgColour(const wxColour& clr) wxOVERRIDE; + +private: + const wxWindowBase* const m_wnd; + + wxDECLARE_NO_COPY_CLASS(wxDefaultHtmlRenderingStyle); +}; + + +// Information given to cells when drawing them. Contains rendering state, +// selection information and rendering style object that can be used to +// customize the output. +class WXDLLIMPEXP_HTML wxHtmlRenderingInfo +{ +public: + wxHtmlRenderingInfo() + : m_selection(NULL), + m_style(NULL), + m_prevUnderlined(false) + { + } + + void SetSelection(wxHtmlSelection *s) { m_selection = s; } + wxHtmlSelection *GetSelection() const { return m_selection; } + + void SetStyle(wxHtmlRenderingStyle *style) { m_style = style; } + wxHtmlRenderingStyle& GetStyle() { return *m_style; } + + void SetCurrentUnderlined(bool u) { m_prevUnderlined = u; } + bool WasPreviousUnderlined() const { return m_prevUnderlined; } + + wxHtmlRenderingState& GetState() { return m_state; } + +protected: + wxHtmlSelection *m_selection; + wxHtmlRenderingStyle *m_style; + wxHtmlRenderingState m_state; + bool m_prevUnderlined; +}; + + +// Flags for wxHtmlCell::FindCellByPos +enum +{ + wxHTML_FIND_EXACT = 1, + wxHTML_FIND_NEAREST_BEFORE = 2, + wxHTML_FIND_NEAREST_AFTER = 4 +}; + + +// Superscript/subscript/normal script mode of a cell +enum wxHtmlScriptMode +{ + wxHTML_SCRIPT_NORMAL, + wxHTML_SCRIPT_SUB, + wxHTML_SCRIPT_SUP +}; + + +// --------------------------------------------------------------------------- +// wxHtmlCell +// Internal data structure. It represents fragments of parsed +// HTML page - a word, picture, table, horizontal line and so +// on. It is used by wxHtmlWindow to represent HTML page in +// memory. +// --------------------------------------------------------------------------- + + +class WXDLLIMPEXP_HTML wxHtmlCell : public wxObject +{ +public: + wxHtmlCell(); + virtual ~wxHtmlCell(); + + void SetParent(wxHtmlContainerCell *p) {m_Parent = p;} + wxHtmlContainerCell *GetParent() const {return m_Parent;} + + int GetPosX() const {return m_PosX;} + int GetPosY() const {return m_PosY;} + int GetWidth() const {return m_Width;} + + // Returns the maximum possible length of the cell. + // Call Layout at least once before using GetMaxTotalWidth() + virtual int GetMaxTotalWidth() const { return m_Width; } + + int GetHeight() const {return m_Height;} + int GetDescent() const {return m_Descent;} + + void SetScriptMode(wxHtmlScriptMode mode, long previousBase); + wxHtmlScriptMode GetScriptMode() const { return m_ScriptMode; } + long GetScriptBaseline() const { return m_ScriptBaseline; } + + // Formatting cells are not visible on the screen, they only alter + // renderer's state. + bool IsFormattingCell() const { return m_Width == 0 && m_Height == 0; } + + const wxString& GetId() const { return m_id; } + void SetId(const wxString& id) { m_id = id; } + + // returns the link associated with this cell. The position is position + // within the cell so it varies from 0 to m_Width, from 0 to m_Height + virtual wxHtmlLinkInfo* GetLink(int WXUNUSED(x) = 0, + int WXUNUSED(y) = 0) const + { return m_Link; } + + // Returns cursor to be used when mouse is over the cell, can be + // overridden by the derived classes to use a different cursor whenever the + // mouse is over this cell. + virtual wxCursor GetMouseCursor(wxHtmlWindowInterface *window) const; + + // Returns cursor to be used when mouse is over the given point, can be + // overridden if the cursor should change depending on where exactly inside + // the cell the mouse is. + virtual wxCursor GetMouseCursorAt(wxHtmlWindowInterface *window, + const wxPoint& relPos) const; + + // return next cell among parent's cells + wxHtmlCell *GetNext() const {return m_Next;} + // returns first child cell (if there are any, i.e. if this is container): + virtual wxHtmlCell* GetFirstChild() const { return NULL; } + + // members writing methods + virtual void SetPos(int x, int y) {m_PosX = x; m_PosY = y;} + void SetLink(const wxHtmlLinkInfo& link); + void SetNext(wxHtmlCell *cell) {m_Next = cell;} + + // 1. adjust cell's width according to the fact that maximal possible width + // is w. (this has sense when working with horizontal lines, tables + // etc.) + // 2. prepare layout (=fill-in m_PosX, m_PosY (and sometime m_Height) + // members) = place items to fit window, according to the width w + virtual void Layout(int w); + + // renders the cell + virtual void Draw(wxDC& WXUNUSED(dc), + int WXUNUSED(x), int WXUNUSED(y), + int WXUNUSED(view_y1), int WXUNUSED(view_y2), + wxHtmlRenderingInfo& WXUNUSED(info)) {} + + // proceed drawing actions in case the cell is not visible (scrolled out of + // screen). This is needed to change fonts, colors and so on. + virtual void DrawInvisible(wxDC& WXUNUSED(dc), + int WXUNUSED(x), int WXUNUSED(y), + wxHtmlRenderingInfo& WXUNUSED(info)) {} + + // This method returns pointer to the FIRST cell for that + // the condition + // is true. It first checks if the condition is true for this + // cell and then calls m_Next->Find(). (Note: it checks + // all subcells if the cell is container) + // Condition is unique condition identifier (see htmldefs.h) + // (user-defined condition IDs should start from 10000) + // and param is optional parameter + // Example : m_Cell->Find(wxHTML_COND_ISANCHOR, "news"); + // returns pointer to anchor news + virtual const wxHtmlCell* Find(int condition, const void* param) const; + + + // This function is called when mouse button is clicked over the cell. + // Returns true if a link is clicked, false otherwise. + // + // 'window' is pointer to wxHtmlWindowInterface of the window which + // generated the event. + // HINT: if this handling is not enough for you should use + // wxHtmlWidgetCell + virtual bool ProcessMouseClick(wxHtmlWindowInterface *window, + const wxPoint& pos, + const wxMouseEvent& event); + + // This method is called when paginating HTML, e.g. when printing. + // + // On input, pagebreak contains y-coordinate of page break (i.e. the + // horizontal line that should not be crossed by words, images etc.) + // relative to the parent cell on entry and may be modified to request a + // page break at a position before it if this cell cannot be divided into + // two pieces (each one on its own page). + // + // Note that page break must still happen on the current page, i.e. the + // returned value must be strictly greater than "*pagebreak - pageHeight" + // and less or equal to "*pagebreak" for the value of pagebreak on input. + // + // Returned value : true if pagebreak was modified, false otherwise + virtual bool AdjustPagebreak(int *pagebreak, int pageHeight) const; + + // Sets cell's behaviour on pagebreaks (see AdjustPagebreak). Default + // is true - the cell can be split on two pages + // If there is no way to fit a cell in the current page size, the cell + // is always split, ignoring this setting. + void SetCanLiveOnPagebreak(bool can) { m_CanLiveOnPagebreak = can; } + + // Can the line be broken before this cell? + virtual bool IsLinebreakAllowed() const + { return !IsFormattingCell(); } + + // Returns true for simple == terminal cells, i.e. not composite ones. + // This if for internal usage only and may disappear in future versions! + virtual bool IsTerminalCell() const { return true; } + + // Find a cell inside this cell positioned at the given coordinates + // (relative to this's positions). Returns NULL if no such cell exists. + // The flag can be used to specify whether to look for terminal or + // nonterminal cells or both. In either case, returned cell is deepest + // cell in cells tree that contains [x,y]. + virtual wxHtmlCell *FindCellByPos(wxCoord x, wxCoord y, + unsigned flags = wxHTML_FIND_EXACT) const; + + // Returns absolute position of the cell on HTML canvas. + // If rootCell is provided, then it's considered to be the root of the + // hierarchy and the returned value is relative to it. + wxPoint GetAbsPos(const wxHtmlCell *rootCell = NULL) const; + + // Returns minimum bounding rectangle of this cell in coordinates, relative + // to the rootCell, if it is provided, or relative to the result of + // GetRootCell() if the rootCell is NULL. + wxRect GetRect(const wxHtmlCell *rootCell = NULL) const; + + // Returns root cell of the hierarchy (i.e. grand-grand-...-parent that + // doesn't have a parent itself) + wxHtmlCell *GetRootCell() const; + + // Returns first (last) terminal cell inside this cell. It may return NULL, + // but it is rare -- only if there are no terminals in the tree. + virtual wxHtmlCell *GetFirstTerminal() const + { return wxConstCast(this, wxHtmlCell); } + virtual wxHtmlCell *GetLastTerminal() const + { return wxConstCast(this, wxHtmlCell); } + + // Returns cell's depth, i.e. how far under the root cell it is + // (if it is the root, depth is 0) + unsigned GetDepth() const; + + // Returns true if the cell appears before 'cell' in natural order of + // cells (= as they are read). If cell A is (grand)parent of cell B, + // then both A.IsBefore(B) and B.IsBefore(A) always return true. + bool IsBefore(wxHtmlCell *cell) const; + + // Converts the cell into text representation. If sel != NULL then + // only part of the cell inside the selection is converted. + virtual wxString ConvertToText(wxHtmlSelection *WXUNUSED(sel)) const + { return wxEmptyString; } + + // This method is useful for debugging, to customize it for particular cell + // type, override GetDescription() and not this function itself. + virtual wxString Dump(int indent = 0) const; + +protected: + // Return the description used by Dump(). + virtual wxString GetDescription() const; + + + // pointer to the next cell + wxHtmlCell *m_Next; + // pointer to parent cell + wxHtmlContainerCell *m_Parent; + + // dimensions of fragment (m_Descent is used to position text & images) + int m_Width, m_Height, m_Descent; + // position where the fragment is drawn: + int m_PosX, m_PosY; + + // superscript/subscript/normal: + wxHtmlScriptMode m_ScriptMode; + long m_ScriptBaseline; + + // destination address if this fragment is hypertext link, NULL otherwise + wxHtmlLinkInfo *m_Link; + // true if this cell can be placed on pagebreak, false otherwise + bool m_CanLiveOnPagebreak; + // unique identifier of the cell, generated from "id" property of tags + wxString m_id; + + wxDECLARE_ABSTRACT_CLASS(wxHtmlCell); + wxDECLARE_NO_COPY_CLASS(wxHtmlCell); +}; + + + + +// ---------------------------------------------------------------------------- +// Inherited cells: +// ---------------------------------------------------------------------------- + + +// ---------------------------------------------------------------------------- +// wxHtmlWordCell +// Single word in input stream. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlWordCell : public wxHtmlCell +{ +public: + wxHtmlWordCell(const wxString& word, const wxDC& dc); + void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2, + wxHtmlRenderingInfo& info) wxOVERRIDE; + virtual wxCursor GetMouseCursor(wxHtmlWindowInterface *window) const wxOVERRIDE; + virtual wxString ConvertToText(wxHtmlSelection *sel) const wxOVERRIDE; + bool IsLinebreakAllowed() const wxOVERRIDE { return m_allowLinebreak; } + + void SetPreviousWord(wxHtmlWordCell *cell); + +protected: + virtual wxString GetDescription() const wxOVERRIDE; + + virtual wxString GetAllAsText() const + { return m_Word; } + virtual wxString GetPartAsText(int begin, int end) const + { return m_Word.Mid(begin, end - begin); } + + void SetSelectionPrivPos(const wxDC& dc, wxHtmlSelection *s) const; + void Split(const wxDC& dc, + const wxPoint& selFrom, const wxPoint& selTo, + unsigned& pos1, unsigned& pos2, + unsigned& ext1, unsigned& ext2) const; + + wxString m_Word; + bool m_allowLinebreak; + + wxDECLARE_ABSTRACT_CLASS(wxHtmlWordCell); + wxDECLARE_NO_COPY_CLASS(wxHtmlWordCell); +}; + + +// wxHtmlWordCell specialization for storing text fragments with embedded +// '\t's; these differ from normal words in that the displayed text is +// different from the text copied to clipboard +class WXDLLIMPEXP_HTML wxHtmlWordWithTabsCell : public wxHtmlWordCell +{ +public: + wxHtmlWordWithTabsCell(const wxString& word, + const wxString& wordOrig, + size_t linepos, + const wxDC& dc) + : wxHtmlWordCell(word, dc), + m_wordOrig(wordOrig), + m_linepos(linepos) + {} + +protected: + virtual wxString GetAllAsText() const wxOVERRIDE; + virtual wxString GetPartAsText(int begin, int end) const wxOVERRIDE; + + wxString m_wordOrig; + size_t m_linepos; +}; + + +// Container contains other cells, thus forming tree structure of rendering +// elements. Basic code of layout algorithm is contained in this class. +class WXDLLIMPEXP_HTML wxHtmlContainerCell : public wxHtmlCell +{ +public: + explicit wxHtmlContainerCell(wxHtmlContainerCell *parent); + virtual ~wxHtmlContainerCell(); + + virtual void Layout(int w) wxOVERRIDE; + virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2, + wxHtmlRenderingInfo& info) wxOVERRIDE; + virtual void DrawInvisible(wxDC& dc, int x, int y, + wxHtmlRenderingInfo& info) wxOVERRIDE; + + virtual bool AdjustPagebreak(int *pagebreak, int pageHeight) const wxOVERRIDE; + + // insert cell at the end of m_Cells list + void InsertCell(wxHtmlCell *cell); + + // Detach a child cell. After calling this method, it's the caller + // responsibility to destroy this cell (possibly by calling InsertCell() + // with it to attach it elsewhere). + void Detach(wxHtmlCell *cell); + + // sets horizontal/vertical alignment + void SetAlignHor(int al) {m_AlignHor = al; m_LastLayout = -1;} + int GetAlignHor() const {return m_AlignHor;} + void SetAlignVer(int al) {m_AlignVer = al; m_LastLayout = -1;} + int GetAlignVer() const {return m_AlignVer;} + + // sets left-border indentation. units is one of wxHTML_UNITS_* constants + // what is combination of wxHTML_INDENT_* + void SetIndent(int i, int what, int units = wxHTML_UNITS_PIXELS); + // returns the indentation. ind is one of wxHTML_INDENT_* constants + int GetIndent(int ind) const; + // returns type of value returned by GetIndent(ind) + int GetIndentUnits(int ind) const; + + // sets alignment info based on given tag's params + void SetAlign(const wxHtmlTag& tag); + // sets floating width adjustment + // (examples : 32 percent of parent container, + // -15 pixels percent (this means 100 % - 15 pixels) + void SetWidthFloat(int w, int units) {m_WidthFloat = w; m_WidthFloatUnits = units; m_LastLayout = -1;} + void SetWidthFloat(const wxHtmlTag& tag, double pixel_scale = 1.0); + // sets minimal height of this container. + void SetMinHeight(int h, int align = wxHTML_ALIGN_TOP) {m_MinHeight = h; m_MinHeightAlign = align; m_LastLayout = -1;} + + void SetBackgroundColour(const wxColour& clr) {m_BkColour = clr;} + // returns background colour (of wxNullColour if none set), so that widgets can + // adapt to it: + wxColour GetBackgroundColour(); + void SetBorder(const wxColour& clr1, const wxColour& clr2, int border = 1) {m_Border = border; m_BorderColour1 = clr1; m_BorderColour2 = clr2;} + virtual wxHtmlLinkInfo* GetLink(int x = 0, int y = 0) const wxOVERRIDE; + virtual const wxHtmlCell* Find(int condition, const void* param) const wxOVERRIDE; + + virtual bool ProcessMouseClick(wxHtmlWindowInterface *window, + const wxPoint& pos, + const wxMouseEvent& event) wxOVERRIDE; + + virtual wxHtmlCell* GetFirstChild() const wxOVERRIDE { return m_Cells; } + + // returns last child cell: + wxHtmlCell* GetLastChild() const { return m_LastCell; } + + // see comment in wxHtmlCell about this method + virtual bool IsTerminalCell() const wxOVERRIDE { return false; } + + virtual wxHtmlCell *FindCellByPos(wxCoord x, wxCoord y, + unsigned flags = wxHTML_FIND_EXACT) const wxOVERRIDE; + + virtual wxHtmlCell *GetFirstTerminal() const wxOVERRIDE; + virtual wxHtmlCell *GetLastTerminal() const wxOVERRIDE; + + + // Removes indentation on top or bottom of the container (i.e. above or + // below first/last terminal cell). For internal use only. + virtual void RemoveExtraSpacing(bool top, bool bottom); + + // Returns the maximum possible length of the container. + // Call Layout at least once before using GetMaxTotalWidth() + virtual int GetMaxTotalWidth() const wxOVERRIDE { return m_MaxTotalWidth; } + + virtual wxString Dump(int indent = 0) const wxOVERRIDE; + +protected: + void UpdateRenderingStatePre(wxHtmlRenderingInfo& info, + wxHtmlCell *cell) const; + void UpdateRenderingStatePost(wxHtmlRenderingInfo& info, + wxHtmlCell *cell) const; + +protected: + int m_IndentLeft, m_IndentRight, m_IndentTop, m_IndentBottom; + // indentation of subcells. There is always m_Indent pixels + // big space between given border of the container and the subcells + // it m_Indent < 0 it is in PERCENTS, otherwise it is in pixels + int m_MinHeight, m_MinHeightAlign; + // minimal height. + wxHtmlCell *m_Cells, *m_LastCell; + // internal cells, m_Cells points to the first of them, m_LastCell to the last one. + // (LastCell is needed only to speed-up InsertCell) + int m_AlignHor, m_AlignVer; + // alignment horizontal and vertical (left, center, right) + int m_WidthFloat, m_WidthFloatUnits; + // width float is used in adjustWidth + wxColour m_BkColour; + // background color of this container + int m_Border; + // border size. Draw only if m_Border > 0 + wxColour m_BorderColour1, m_BorderColour2; + // borders color of this container + int m_LastLayout; + // if != -1 then call to Layout may be no-op + // if previous call to Layout has same argument + int m_MaxTotalWidth; + // Maximum possible length if ignoring line wrap + + + wxDECLARE_ABSTRACT_CLASS(wxHtmlContainerCell); + wxDECLARE_NO_COPY_CLASS(wxHtmlContainerCell); +}; + + + +// --------------------------------------------------------------------------- +// wxHtmlColourCell +// Color changer. +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlColourCell : public wxHtmlCell +{ +public: + wxHtmlColourCell(const wxColour& clr, int flags = wxHTML_CLR_FOREGROUND) : wxHtmlCell(), m_Colour(clr) { m_Flags = flags;} + virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2, + wxHtmlRenderingInfo& info) wxOVERRIDE; + virtual void DrawInvisible(wxDC& dc, int x, int y, + wxHtmlRenderingInfo& info) wxOVERRIDE; + + virtual wxString GetDescription() const wxOVERRIDE; + +protected: + wxColour m_Colour; + unsigned m_Flags; + + wxDECLARE_ABSTRACT_CLASS(wxHtmlColourCell); + wxDECLARE_NO_COPY_CLASS(wxHtmlColourCell); +}; + + + + +//-------------------------------------------------------------------------------- +// wxHtmlFontCell +// Sets actual font used for text rendering +//-------------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlFontCell : public wxHtmlCell +{ +public: + wxHtmlFontCell(wxFont *font) : wxHtmlCell(), m_Font(*font) { } + virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2, + wxHtmlRenderingInfo& info) wxOVERRIDE; + virtual void DrawInvisible(wxDC& dc, int x, int y, + wxHtmlRenderingInfo& info) wxOVERRIDE; + + virtual wxString GetDescription() const wxOVERRIDE; + +protected: + wxFont m_Font; + + wxDECLARE_ABSTRACT_CLASS(wxHtmlFontCell); + wxDECLARE_NO_COPY_CLASS(wxHtmlFontCell); +}; + + + + + + +//-------------------------------------------------------------------------------- +// wxHtmlwidgetCell +// This cell is connected with wxWindow object +// You can use it to insert windows into HTML page +// (buttons, input boxes etc.) +//-------------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlWidgetCell : public wxHtmlCell +{ +public: + // !!! wnd must have correct parent! + // if w != 0 then the m_Wnd has 'floating' width - it adjust + // it's width according to parent container's width + // (w is percent of parent's width) + wxHtmlWidgetCell(wxWindow *wnd, int w = 0); + virtual ~wxHtmlWidgetCell() { m_Wnd->Destroy(); } + virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2, + wxHtmlRenderingInfo& info) wxOVERRIDE; + virtual void DrawInvisible(wxDC& dc, int x, int y, + wxHtmlRenderingInfo& info) wxOVERRIDE; + virtual void Layout(int w) wxOVERRIDE; + +protected: + wxWindow* m_Wnd; + int m_WidthFloat; + // width float is used in adjustWidth (it is in percents) + + wxDECLARE_ABSTRACT_CLASS(wxHtmlWidgetCell); + wxDECLARE_NO_COPY_CLASS(wxHtmlWidgetCell); +}; + + + +//-------------------------------------------------------------------------------- +// wxHtmlLinkInfo +// Internal data structure. It represents hypertext link +//-------------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlLinkInfo : public wxObject +{ +public: + wxHtmlLinkInfo() + { m_Event = NULL; m_Cell = NULL; } + wxHtmlLinkInfo(const wxString& href, const wxString& target = wxString()) + : m_Href(href) + , m_Target(target) + { m_Event = NULL; m_Cell = NULL; } + + void SetEvent(const wxMouseEvent *e) { m_Event = e; } + void SetHtmlCell(const wxHtmlCell *e) { m_Cell = e; } + + wxString GetHref() const { return m_Href; } + wxString GetTarget() const { return m_Target; } + const wxMouseEvent* GetEvent() const { return m_Event; } + const wxHtmlCell* GetHtmlCell() const { return m_Cell; } + +private: + wxString m_Href, m_Target; + const wxMouseEvent *m_Event; + const wxHtmlCell *m_Cell; +}; + + + +// ---------------------------------------------------------------------------- +// wxHtmlTerminalCellsInterator +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlTerminalCellsInterator +{ +public: + wxHtmlTerminalCellsInterator(const wxHtmlCell *from, const wxHtmlCell *to) + : m_to(to), m_pos(from) {} + + operator bool() const { return m_pos != NULL; } + const wxHtmlCell* operator++(); + const wxHtmlCell* operator->() const { return m_pos; } + const wxHtmlCell* operator*() const { return m_pos; } + +private: + const wxHtmlCell *m_to, *m_pos; +}; + + + +#endif // wxUSE_HTML + +#endif // _WX_HTMLCELL_H_ + diff --git a/lib/wxWidgets/include/wx/html/htmldefs.h b/lib/wxWidgets/include/wx/html/htmldefs.h new file mode 100644 index 0000000..9de190c --- /dev/null +++ b/lib/wxWidgets/include/wx/html/htmldefs.h @@ -0,0 +1,101 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/html/htmldefs.h +// Purpose: constants for wxhtml library +// Author: Vaclav Slavik +// Copyright: (c) 1999 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef _WX_HTMLDEFS_H_ +#define _WX_HTMLDEFS_H_ + +#include "wx/defs.h" + +#if wxUSE_HTML + +//-------------------------------------------------------------------------------- +// ALIGNMENTS +// Describes alignment of text etc. in containers +//-------------------------------------------------------------------------------- + +#define wxHTML_ALIGN_LEFT 0x0000 +#define wxHTML_ALIGN_RIGHT 0x0002 +#define wxHTML_ALIGN_JUSTIFY 0x0010 + +#define wxHTML_ALIGN_TOP 0x0004 +#define wxHTML_ALIGN_BOTTOM 0x0008 + +#define wxHTML_ALIGN_CENTER 0x0001 + + + +//-------------------------------------------------------------------------------- +// COLOR MODES +// Used by wxHtmlColourCell to determine clr of what is changing +//-------------------------------------------------------------------------------- + +#define wxHTML_CLR_FOREGROUND 0x0001 +#define wxHTML_CLR_BACKGROUND 0x0002 +#define wxHTML_CLR_TRANSPARENT_BACKGROUND 0x0004 + + + +//-------------------------------------------------------------------------------- +// UNITS +// Used to specify units +//-------------------------------------------------------------------------------- + +#define wxHTML_UNITS_PIXELS 0x0001 +#define wxHTML_UNITS_PERCENT 0x0002 + + + +//-------------------------------------------------------------------------------- +// INDENTS +// Used to specify indetation relatives +//-------------------------------------------------------------------------------- + +#define wxHTML_INDENT_LEFT 0x0010 +#define wxHTML_INDENT_RIGHT 0x0020 +#define wxHTML_INDENT_TOP 0x0040 +#define wxHTML_INDENT_BOTTOM 0x0080 + +#define wxHTML_INDENT_HORIZONTAL (wxHTML_INDENT_LEFT | wxHTML_INDENT_RIGHT) +#define wxHTML_INDENT_VERTICAL (wxHTML_INDENT_TOP | wxHTML_INDENT_BOTTOM) +#define wxHTML_INDENT_ALL (wxHTML_INDENT_VERTICAL | wxHTML_INDENT_HORIZONTAL) + + + + +//-------------------------------------------------------------------------------- +// FIND CONDITIONS +// Identifiers of wxHtmlCell's Find() conditions +//-------------------------------------------------------------------------------- + +#define wxHTML_COND_ISANCHOR 1 + // Finds the anchor of 'param' name (pointer to wxString). + +#define wxHTML_COND_ISIMAGEMAP 2 + // Finds imagemap of 'param' name (pointer to wxString). + // (used exclusively by m_image.cpp) + +#define wxHTML_COND_USER 10000 + // User-defined conditions should start from this number + + +//-------------------------------------------------------------------------------- +// INTERNALS +// wxHTML internal constants +//-------------------------------------------------------------------------------- + + /* size of one scroll step of wxHtmlWindow in pixels */ +#define wxHTML_SCROLL_STEP 16 + + /* size of temporary buffer used during parsing */ +#define wxHTML_BUFLEN 1024 + +#endif // wxUSE_HTML + +#endif // _WX_HTMLDEFS_H_ + diff --git a/lib/wxWidgets/include/wx/html/htmlfilt.h b/lib/wxWidgets/include/wx/html/htmlfilt.h new file mode 100644 index 0000000..4340fd3 --- /dev/null +++ b/lib/wxWidgets/include/wx/html/htmlfilt.h @@ -0,0 +1,81 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/html/htmlfilt.h +// Purpose: filters +// Author: Vaclav Slavik +// Copyright: (c) 1999 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HTMLFILT_H_ +#define _WX_HTMLFILT_H_ + +#include "wx/defs.h" + +#if wxUSE_HTML + +#include "wx/filesys.h" + + +//-------------------------------------------------------------------------------- +// wxHtmlFilter +// This class is input filter. It can "translate" files +// in non-HTML format to HTML format +// interface to access certain +// kinds of files (HTPP, FTP, local, tar.gz etc..) +//-------------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlFilter : public wxObject +{ + wxDECLARE_ABSTRACT_CLASS(wxHtmlFilter); + +public: + wxHtmlFilter() : wxObject() {} + virtual ~wxHtmlFilter() {} + + // returns true if this filter is able to open&read given file + virtual bool CanRead(const wxFSFile& file) const = 0; + + // Reads given file and returns HTML document. + // Returns empty string if opening failed + virtual wxString ReadFile(const wxFSFile& file) const = 0; +}; + + + +//-------------------------------------------------------------------------------- +// wxHtmlFilterPlainText +// This filter is used as default filter if no other can +// be used (= unknown type of file). It is used by +// wxHtmlWindow itself. +//-------------------------------------------------------------------------------- + + +class WXDLLIMPEXP_HTML wxHtmlFilterPlainText : public wxHtmlFilter +{ + wxDECLARE_DYNAMIC_CLASS(wxHtmlFilterPlainText); + +public: + virtual bool CanRead(const wxFSFile& file) const wxOVERRIDE; + virtual wxString ReadFile(const wxFSFile& file) const wxOVERRIDE; +}; + +//-------------------------------------------------------------------------------- +// wxHtmlFilterHTML +// filter for text/html +//-------------------------------------------------------------------------------- + +class wxHtmlFilterHTML : public wxHtmlFilter +{ + wxDECLARE_DYNAMIC_CLASS(wxHtmlFilterHTML); + + public: + virtual bool CanRead(const wxFSFile& file) const wxOVERRIDE; + virtual wxString ReadFile(const wxFSFile& file) const wxOVERRIDE; +}; + + + +#endif // wxUSE_HTML + +#endif // _WX_HTMLFILT_H_ + diff --git a/lib/wxWidgets/include/wx/html/htmlpars.h b/lib/wxWidgets/include/wx/html/htmlpars.h new file mode 100644 index 0000000..c3f271a --- /dev/null +++ b/lib/wxWidgets/include/wx/html/htmlpars.h @@ -0,0 +1,307 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/html/htmlpars.h +// Purpose: wxHtmlParser class (generic parser) +// Author: Vaclav Slavik +// Copyright: (c) 1999 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HTMLPARS_H_ +#define _WX_HTMLPARS_H_ + +#include "wx/defs.h" +#if wxUSE_HTML + +#include "wx/html/htmltag.h" +#include "wx/filesys.h" +#include "wx/hashmap.h" +#include "wx/hashset.h" +#include "wx/vector.h" +#include "wx/fontenc.h" + +class WXDLLIMPEXP_FWD_BASE wxMBConv; +class WXDLLIMPEXP_FWD_HTML wxHtmlParser; +class WXDLLIMPEXP_FWD_HTML wxHtmlTagHandler; +class WXDLLIMPEXP_FWD_HTML wxHtmlEntitiesParser; + +class wxHtmlTextPieces; +class wxHtmlParserState; + +WX_DECLARE_HASH_SET_WITH_DECL_PTR(wxHtmlTagHandler*, + wxPointerHash, wxPointerEqual, + wxHtmlTagHandlersSet, + class WXDLLIMPEXP_HTML); +WX_DECLARE_STRING_HASH_MAP_WITH_DECL(wxHtmlTagHandler*, + wxHtmlTagHandlersHash, + class WXDLLIMPEXP_HTML); + + +enum wxHtmlURLType +{ + wxHTML_URL_PAGE, + wxHTML_URL_IMAGE, + wxHTML_URL_OTHER +}; + +// This class handles generic parsing of HTML document : it scans +// the document and divides it into blocks of tags (where one block +// consists of starting and ending tag and of text between these +// 2 tags. +class WXDLLIMPEXP_HTML wxHtmlParser : public wxObject +{ + wxDECLARE_ABSTRACT_CLASS(wxHtmlParser); + +public: + wxHtmlParser(); + virtual ~wxHtmlParser(); + + // Sets the class which will be used for opening files + void SetFS(wxFileSystem *fs) { m_FS = fs; } + + wxFileSystem* GetFS() const { return m_FS; } + + // Opens file if the parser is allowed to open given URL (may be forbidden + // for security reasons) + virtual wxFSFile *OpenURL(wxHtmlURLType type, const wxString& url) const; + + // You can simply call this method when you need parsed output. + // This method does these things: + // 1. call InitParser(source); + // 2. call DoParsing(); + // 3. call GetProduct(); (its return value is then returned) + // 4. call DoneParser(); + wxObject* Parse(const wxString& source); + + // Sets the source. This must be called before running Parse() method. + virtual void InitParser(const wxString& source); + // This must be called after Parse(). + virtual void DoneParser(); + + // May be called during parsing to immediately return from Parse(). + virtual void StopParsing() { m_stopParsing = true; } + + // Parses the m_Source from begin_pos to end_pos-1. + // (in noparams version it parses whole m_Source) + void DoParsing(const wxString::const_iterator& begin_pos, + const wxString::const_iterator& end_pos); + void DoParsing(); + + // Returns pointer to the tag at parser's current position + wxHtmlTag *GetCurrentTag() const { return m_CurTag; } + + // Returns product of parsing + // Returned value is result of parsing of the part. The type of this result + // depends on internal representation in derived parser + // (see wxHtmlWinParser for details). + virtual wxObject* GetProduct() = 0; + + // adds handler to the list & hash table of handlers. + virtual void AddTagHandler(wxHtmlTagHandler *handler); + + // Forces the handler to handle additional tags (not returned by GetSupportedTags). + // The handler should already be in use by this parser. + // Example: you want to parse following pseudo-html structure: + // + // + // + // + // This last it has different meaning, we don't want it to be parsed by myitems handler! + // handler can handle only 'myitems' (e.g. its GetSupportedTags returns "MYITEMS") + // you can call PushTagHandler(handler, "IT") when you find + // and call PopTagHandler() when you find + void PushTagHandler(wxHtmlTagHandler *handler, const wxString& tags); + + // Restores state before last call to PushTagHandler + void PopTagHandler(); + + const wxString* GetSource() {return m_Source;} + void SetSource(const wxString& src); + + // Sets HTML source and remembers current parser's state so that it can + // later be restored. This is useful for on-line modifications of + // HTML source (for example,
 handler replaces spaces with  
+    // and newlines with 
) + virtual void SetSourceAndSaveState(const wxString& src); + // Restores parser's state from stack or returns false if the stack is + // empty + virtual bool RestoreState(); + + // Returns HTML source inside the element (i.e. between the starting + // and ending tag) + wxString GetInnerSource(const wxHtmlTag& tag); + + // Parses HTML string 'markup' and extracts charset info from tag + // if present. Returns empty string if the tag is missing. + // For wxHTML's internal use. + static wxString ExtractCharsetInformation(const wxString& markup); + + // Returns entity parser object, used to substitute HTML &entities; + wxHtmlEntitiesParser *GetEntitiesParser() const { return m_entitiesParser; } + + // Returns true if the tag starting at the given position is a comment tag + // + // p should point to '<' character and is modified to point to the closing + // '>' of the end comment tag if this is indeed a comment + static bool + SkipCommentTag(wxString::const_iterator& p, wxString::const_iterator end); + +protected: + // DOM structure + void CreateDOMTree(); + void DestroyDOMTree(); + void CreateDOMSubTree(wxHtmlTag *cur, + const wxString::const_iterator& begin_pos, + const wxString::const_iterator& end_pos, + wxHtmlTagsCache *cache); + + // Adds text to the output. + // This is called from Parse() and must be overridden in derived classes. + // txt is not guaranteed to be only one word. It is largest continuous part + // of text (= not broken by tags) + virtual void AddText(const wxString& txt) = 0; + + // Adds tag and proceeds it. Parse() may (and usually is) called from this method. + // This is called from Parse() and may be overridden. + // Default behaviour is that it looks for proper handler in m_Handlers. The tag is + // ignored if no handler is found. + // Derived class is *responsible* for filling in m_Handlers table. + virtual void AddTag(const wxHtmlTag& tag); + +protected: + // DOM tree: + wxHtmlTag *m_CurTag; + wxHtmlTag *m_Tags; + wxHtmlTextPieces *m_TextPieces; + size_t m_CurTextPiece; + + const wxString *m_Source; + + wxHtmlParserState *m_SavedStates; + + // handlers that handle particular tags. The table is accessed by + // key = tag's name. + // This attribute MUST be filled by derived class otherwise it would + // be empty and no tags would be recognized + // (see wxHtmlWinParser for details about filling it) + // m_HandlersHash is for random access based on knowledge of tag name (BR, P, etc.) + // it may (and often does) contain more references to one object + // m_HandlersList is list of all handlers and it is guaranteed to contain + // only one reference to each handler instance. + wxHtmlTagHandlersSet m_HandlersSet; + wxHtmlTagHandlersHash m_HandlersHash; + + wxDECLARE_NO_COPY_CLASS(wxHtmlParser); + + // class for opening files (file system) + wxFileSystem *m_FS; + // handlers stack used by PushTagHandler and PopTagHandler + wxVector m_HandlersStack; + + // entity parse + wxHtmlEntitiesParser *m_entitiesParser; + + // flag indicating that the parser should stop + bool m_stopParsing; +}; + + + +// This class (and derived classes) cooperates with wxHtmlParser. +// Each recognized tag is passed to handler which is capable +// of handling it. Each tag is handled in 3 steps: +// 1. Handler will modifies state of parser +// (using its public methods) +// 2. Parser parses source between starting and ending tag +// 3. Handler restores original state of the parser +class WXDLLIMPEXP_HTML wxHtmlTagHandler : public wxObject +{ + wxDECLARE_ABSTRACT_CLASS(wxHtmlTagHandler); + +public: + wxHtmlTagHandler() : wxObject () { m_Parser = NULL; } + + // Sets the parser. + // NOTE : each _instance_ of handler is guaranteed to be called + // only by one parser. This means you don't have to care about + // reentrancy. + virtual void SetParser(wxHtmlParser *parser) + { m_Parser = parser; } + + // Get the parser associated with this tag handler. + wxHtmlParser* GetParser() const { return m_Parser; } + + // Returns list of supported tags. The list is in uppercase and + // tags are delimited by ','. + // Example : "I,B,FONT,P" + // is capable of handling italic, bold, font and paragraph tags + virtual wxString GetSupportedTags() = 0; + + // This is handling core method. It does all the Steps 1-3. + // To process step 2, you can call ParseInner() + // returned value : true if it called ParseInner(), + // false etherwise + virtual bool HandleTag(const wxHtmlTag& tag) = 0; + +protected: + // parses input between beginning and ending tag. + // m_Parser must be set. + void ParseInner(const wxHtmlTag& tag) + { m_Parser->DoParsing(tag.GetBeginIter(), tag.GetEndIter1()); } + + // Parses given source as if it was tag's inner code (see + // wxHtmlParser::GetInnerSource). Unlike ParseInner(), this method lets + // you specify the source code to parse. This is useful when you need to + // modify the inner text before parsing. + void ParseInnerSource(const wxString& source); + + wxHtmlParser *m_Parser; + + wxDECLARE_NO_COPY_CLASS(wxHtmlTagHandler); +}; + + +// This class is used to parse HTML entities in strings. It can handle +// both named entities and &#xxxx entries where xxxx is Unicode code. +class WXDLLIMPEXP_HTML wxHtmlEntitiesParser : public wxObject +{ + wxDECLARE_DYNAMIC_CLASS(wxHtmlEntitiesParser); + +public: + wxHtmlEntitiesParser(); + virtual ~wxHtmlEntitiesParser(); + + // Sets encoding of output string. + // Has no effect if wxUSE_UNICODE==1 +#if wxUSE_UNICODE + void SetEncoding(wxFontEncoding WXUNUSED(encoding)) {} +#else + void SetEncoding(wxFontEncoding encoding); +#endif + + // Parses entities in input and replaces them with respective characters + // (with respect to output encoding) + wxString Parse(const wxString& input) const; + + // Returns character for given entity or 0 if the entity is unknown + wxChar GetEntityChar(const wxString& entity) const; + + // Returns character that represents given Unicode code +#if wxUSE_UNICODE + wxChar GetCharForCode(unsigned code) const { return (wxChar)code; } +#else + wxChar GetCharForCode(unsigned code) const; +#endif + +protected: +#if !wxUSE_UNICODE + wxMBConv *m_conv; + wxFontEncoding m_encoding; +#endif + + wxDECLARE_NO_COPY_CLASS(wxHtmlEntitiesParser); +}; + + +#endif + +#endif // _WX_HTMLPARS_H_ diff --git a/lib/wxWidgets/include/wx/html/htmlproc.h b/lib/wxWidgets/include/wx/html/htmlproc.h new file mode 100644 index 0000000..73e2245 --- /dev/null +++ b/lib/wxWidgets/include/wx/html/htmlproc.h @@ -0,0 +1,57 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/html/htmlprep.h +// Purpose: HTML processor +// Author: Vaclav Slavik +// Copyright: (c) 2001 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HTMLPREP_H_ +#define _WX_HTMLPREP_H_ + +#include "wx/defs.h" + +#if wxUSE_HTML + +#include "wx/string.h" + +// Priority of preprocessor in the chain. The higher, the earlier it is used +enum +{ + wxHTML_PRIORITY_DONTCARE = 128, // if the order doesn't matter, use this + // priority + wxHTML_PRIORITY_SYSTEM = 256 // >=256 is only for wxHTML's internals +}; + +// Classes derived from this class serve as simple text processors for +// wxHtmlWindow. wxHtmlWindow runs HTML markup through all registered +// processors before displaying it, thus allowing for on-the-fly +// modifications of the markup. + +class WXDLLIMPEXP_HTML wxHtmlProcessor : public wxObject +{ + wxDECLARE_ABSTRACT_CLASS(wxHtmlProcessor); + +public: + wxHtmlProcessor() : wxObject(), m_enabled(true) {} + virtual ~wxHtmlProcessor() {} + + // Process input text and return processed result + virtual wxString Process(const wxString& text) const = 0; + + // Return priority value of this processor. The higher, the sooner + // is the processor applied to the text. + virtual int GetPriority() const { return wxHTML_PRIORITY_DONTCARE; } + + // Enable/disable the processor. wxHtmlWindow won't use a disabled + // processor even if it is in its processors queue. + virtual void Enable(bool enable = true) { m_enabled = enable; } + bool IsEnabled() const { return m_enabled; } + +protected: + bool m_enabled; +}; + +#endif // wxUSE_HTML + +#endif // _WX_HTMLPROC_H_ diff --git a/lib/wxWidgets/include/wx/html/htmltag.h b/lib/wxWidgets/include/wx/html/htmltag.h new file mode 100644 index 0000000..9fd14c1 --- /dev/null +++ b/lib/wxWidgets/include/wx/html/htmltag.h @@ -0,0 +1,179 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/html/htmltag.h +// Purpose: wxHtmlTag class (represents single tag) +// Author: Vaclav Slavik +// Copyright: (c) 1999 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HTMLTAG_H_ +#define _WX_HTMLTAG_H_ + +#include "wx/defs.h" + +#if wxUSE_HTML + +#include "wx/object.h" +#include "wx/arrstr.h" + +class WXDLLIMPEXP_FWD_CORE wxColour; +class WXDLLIMPEXP_FWD_HTML wxHtmlEntitiesParser; + +//----------------------------------------------------------------------------- +// wxHtmlTagsCache +// - internal wxHTML class, do not use! +//----------------------------------------------------------------------------- + +class wxHtmlTagsCacheData; + +class WXDLLIMPEXP_HTML wxHtmlTagsCache +{ +private: + wxHtmlTagsCacheData *m_Cache; + int m_CachePos; + + wxHtmlTagsCacheData& Cache() { return *m_Cache; } + +public: + wxHtmlTagsCache() {m_Cache = NULL;} + wxHtmlTagsCache(const wxString& source); + virtual ~wxHtmlTagsCache(); + + // Finds parameters for tag starting at and fills the variables + void QueryTag(const wxString::const_iterator& at, + const wxString::const_iterator& inputEnd, + wxString::const_iterator *end1, + wxString::const_iterator *end2, + bool *hasEnding); + + wxDECLARE_NO_COPY_CLASS(wxHtmlTagsCache); +}; + + +//-------------------------------------------------------------------------------- +// wxHtmlTag +// This represents single tag. It is used as internal structure +// by wxHtmlParser. +//-------------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlTag +{ +protected: + // constructs wxHtmlTag object based on HTML tag. + // The tag begins (with '<' character) at position pos in source + // end_pos is position where parsing ends (usually end of document) + wxHtmlTag(wxHtmlTag *parent, + const wxString *source, + const wxString::const_iterator& pos, + const wxString::const_iterator& end_pos, + wxHtmlTagsCache *cache, + wxHtmlEntitiesParser *entParser); + friend class wxHtmlParser; +public: + ~wxHtmlTag(); + + wxHtmlTag *GetParent() const {return m_Parent;} + wxHtmlTag *GetFirstSibling() const; + wxHtmlTag *GetLastSibling() const; + wxHtmlTag *GetChildren() const { return m_FirstChild; } + wxHtmlTag *GetPreviousSibling() const { return m_Prev; } + wxHtmlTag *GetNextSibling() const {return m_Next; } + // Return next tag, as if tree had been flattened + wxHtmlTag *GetNextTag() const; + + // Returns tag's name in uppercase. + inline wxString GetName() const {return m_Name;} + + // Returns true if the tag has given parameter. Parameter + // should always be in uppercase. + // Example : HasParam("SRC") returns true + bool HasParam(const wxString& par) const; + + // Returns value of the param. Value is in uppercase unless it is + // enclosed with " + // Example :

GetParam("ALIGN") returns (RIGHT) + //

GetParam("SRC") returns (WhaT.jpg) + // (or ("WhaT.jpg") if with_quotes == true) + wxString GetParam(const wxString& par, bool with_quotes = false) const; + + // Return true if the string could be parsed as an HTML colour and false + // otherwise. + static bool ParseAsColour(const wxString& str, wxColour *clr); + + // Convenience functions: + bool GetParamAsString(const wxString& par, wxString *str) const; + bool GetParamAsColour(const wxString& par, wxColour *clr) const; + bool GetParamAsInt(const wxString& par, int *clr) const; + bool GetParamAsIntOrPercent(const wxString& param, + int* value, bool& isPercent) const; + + // Scans param like scanf() functions family does. + // Example : ScanParam("COLOR", "\"#%X\"", &clr); + // This is always with with_quotes=false + // Returns number of scanned values + // (like sscanf() does) + // NOTE: unlike scanf family, this function only accepts + // *one* parameter ! + int ScanParam(const wxString& par, const char *format, void *param) const; + int ScanParam(const wxString& par, const wchar_t *format, void *param) const; + + // Returns string containing all params. + wxString GetAllParams() const; + + // return true if there is matching ending tag + inline bool HasEnding() const {return m_hasEnding;} + + // returns beginning position of _internal_ block of text as iterator + // into parser's source string (see wxHtmlParser::GetSource()) + // See explanation (returned value is marked with *): + // bla bla bla * bla bla intenal text bla bla + wxString::const_iterator GetBeginIter() const + { return m_Begin; } + // returns ending position of _internal_ block of text as iterator + // into parser's source string (see wxHtmlParser::GetSource()): + // bla bla bla bla bla intenal text* bla bla + wxString::const_iterator GetEndIter1() const { return m_End1; } + // returns end position 2 as iterator + // into parser's source string (see wxHtmlParser::GetSource()): + // bla bla bla bla bla internal text* bla bla + wxString::const_iterator GetEndIter2() const { return m_End2; } + +#if WXWIN_COMPATIBILITY_2_8 + // use GetBeginIter(), GetEndIter1() and GetEndIter2() instead + wxDEPRECATED( inline int GetBeginPos() const ); + wxDEPRECATED( inline int GetEndPos1() const ); + wxDEPRECATED( inline int GetEndPos2() const ); +#endif // WXWIN_COMPATIBILITY_2_8 + +private: + wxString m_Name; + bool m_hasEnding; + wxString::const_iterator m_Begin, m_End1, m_End2; + wxArrayString m_ParamNames, m_ParamValues; +#if WXWIN_COMPATIBILITY_2_8 + wxString::const_iterator m_sourceStart; +#endif + + // DOM tree relations: + wxHtmlTag *m_Next; + wxHtmlTag *m_Prev; + wxHtmlTag *m_FirstChild, *m_LastChild; + wxHtmlTag *m_Parent; + + wxDECLARE_NO_COPY_CLASS(wxHtmlTag); +}; + + +#if WXWIN_COMPATIBILITY_2_8 +inline int wxHtmlTag::GetBeginPos() const { return int(m_Begin - m_sourceStart); } +inline int wxHtmlTag::GetEndPos1() const { return int(m_End1 - m_sourceStart); } +inline int wxHtmlTag::GetEndPos2() const { return int(m_End2 - m_sourceStart); } +#endif // WXWIN_COMPATIBILITY_2_8 + + + + +#endif // wxUSE_HTML + +#endif // _WX_HTMLTAG_H_ + diff --git a/lib/wxWidgets/include/wx/html/htmlwin.h b/lib/wxWidgets/include/wx/html/htmlwin.h new file mode 100644 index 0000000..ebc5695 --- /dev/null +++ b/lib/wxWidgets/include/wx/html/htmlwin.h @@ -0,0 +1,662 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/html/htmlwin.h +// Purpose: wxHtmlWindow class for parsing & displaying HTML +// Author: Vaclav Slavik +// Copyright: (c) 1999 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HTMLWIN_H_ +#define _WX_HTMLWIN_H_ + +#include "wx/defs.h" +#if wxUSE_HTML + +#include "wx/window.h" +#include "wx/scrolwin.h" +#include "wx/config.h" +#include "wx/stopwatch.h" +#include "wx/html/winpars.h" +#include "wx/html/htmlcell.h" +#include "wx/filesys.h" +#include "wx/html/htmlfilt.h" +#include "wx/filename.h" +#include "wx/bmpbndl.h" + +class wxHtmlProcessor; +class wxHtmlWinModule; +class wxHtmlHistoryArray; +class wxHtmlProcessorList; +class WXDLLIMPEXP_FWD_HTML wxHtmlWinAutoScrollTimer; +class WXDLLIMPEXP_FWD_HTML wxHtmlCellEvent; +class WXDLLIMPEXP_FWD_HTML wxHtmlLinkEvent; +class WXDLLIMPEXP_FWD_CORE wxStatusBar; + +// wxHtmlWindow flags: +#define wxHW_SCROLLBAR_NEVER 0x0002 +#define wxHW_SCROLLBAR_AUTO 0x0004 +#define wxHW_NO_SELECTION 0x0008 + +#define wxHW_DEFAULT_STYLE wxHW_SCROLLBAR_AUTO + +/// Enum for wxHtmlWindow::OnOpeningURL and wxHtmlWindowInterface::OnOpeningURL +enum wxHtmlOpeningStatus +{ + /// Open the requested URL + wxHTML_OPEN, + /// Do not open the URL + wxHTML_BLOCK, + /// Redirect to another URL (returned from OnOpeningURL) + wxHTML_REDIRECT +}; + +/** + Abstract interface to a HTML rendering window (such as wxHtmlWindow or + wxHtmlListBox) that is passed to wxHtmlWinParser. It encapsulates all + communication from the parser to the window. + */ +class WXDLLIMPEXP_HTML wxHtmlWindowInterface +{ +public: + /// Ctor + wxHtmlWindowInterface() {} + virtual ~wxHtmlWindowInterface() {} + + /** + Called by the parser to set window's title to given text. + */ + virtual void SetHTMLWindowTitle(const wxString& title) = 0; + + /** + Called when a link is clicked. + + @param link information about the clicked link + */ + virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link) = 0; + + /** + Called when the parser needs to open another URL (e.g. an image). + + @param type Type of the URL request (e.g. image) + @param url URL the parser wants to open + @param redirect If the return value is wxHTML_REDIRECT, then the + URL to redirect to will be stored in this variable + (the pointer must never be NULL) + + @return indicator of how to treat the request + */ + virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type, + const wxString& url, + wxString *redirect) const = 0; + + /** + Converts coordinates @a pos relative to given @a cell to + physical coordinates in the window. + */ + virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell, + const wxPoint& pos) const = 0; + + /// Returns the window used for rendering (may be NULL). + virtual wxWindow* GetHTMLWindow() = 0; + + /// Returns background colour to use by default. + virtual wxColour GetHTMLBackgroundColour() const = 0; + + /// Sets window's background to colour @a clr. + virtual void SetHTMLBackgroundColour(const wxColour& clr) = 0; + + /// Sets window's background to given bitmap. + virtual void SetHTMLBackgroundImage(const wxBitmapBundle& bmpBg) = 0; + + /// Sets status bar text. + virtual void SetHTMLStatusText(const wxString& text) = 0; + + /// Type of mouse cursor + enum HTMLCursor + { + /// Standard mouse cursor (typically an arrow) + HTMLCursor_Default, + /// Cursor shown over links + HTMLCursor_Link, + /// Cursor shown over selectable text + HTMLCursor_Text + }; + + /** + Returns mouse cursor of given @a type. + */ + virtual wxCursor GetHTMLCursor(HTMLCursor type) const = 0; +}; + +/** + Helper class that implements part of mouse handling for wxHtmlWindow and + wxHtmlListBox. Cursor changes and clicking on links are handled, text + selection is not. + */ +class WXDLLIMPEXP_HTML wxHtmlWindowMouseHelper +{ +protected: + /** + Ctor. + + @param iface Interface to the owner window. + */ + wxHtmlWindowMouseHelper(wxHtmlWindowInterface *iface); + + /** + Virtual dtor. + + It is not really needed in this case, but at least it prevents gcc from + complaining about its absence. + */ + virtual ~wxHtmlWindowMouseHelper() { } + + /// Returns true if the mouse moved since the last call to HandleIdle + bool DidMouseMove() const { return m_tmpMouseMoved; } + + /// Call this from EVT_MOTION event handler + void HandleMouseMoved(); + + /** + Call this from EVT_LEFT_UP handler (or, alternatively, EVT_LEFT_DOWN). + + @param rootCell HTML cell inside which the click occurred. This doesn't + have to be the leaf cell, it can be e.g. toplevel + container, but the mouse must be inside the container's + area, otherwise the event would be ignored. + @param pos Mouse position in coordinates relative to @a cell + @param event The event that triggered the call + */ + bool HandleMouseClick(wxHtmlCell *rootCell, + const wxPoint& pos, const wxMouseEvent& event); + + /** + Call this from OnInternalIdle of the HTML displaying window. Handles + mouse movements and must be used together with HandleMouseMoved. + + @param rootCell HTML cell inside which the click occurred. This doesn't + have to be the leaf cell, it can be e.g. toplevel + container, but the mouse must be inside the container's + area, otherwise the event would be ignored. + @param pos Current mouse position in coordinates relative to + @a cell + */ + void HandleIdle(wxHtmlCell *rootCell, const wxPoint& pos); + + /** + Called by HandleIdle when the mouse hovers over a cell. Default + behaviour is to do nothing. + + @param cell the cell the mouse is over + @param x, y coordinates of mouse relative to the cell + */ + virtual void OnCellMouseHover(wxHtmlCell *cell, wxCoord x, wxCoord y); + + /** + Called by HandleMouseClick when the user clicks on a cell. + Default behaviour is to call wxHtmlWindowInterface::OnLinkClicked() + if this cell corresponds to a hypertext link. + + @param cell the cell the mouse is over + @param x, y coordinates of mouse relative to the cell + @param event The event that triggered the call + + + @return true if a link was clicked, false otherwise. + */ + virtual bool OnCellClicked(wxHtmlCell *cell, + wxCoord x, wxCoord y, + const wxMouseEvent& event); + +protected: + // this flag indicates if the mouse moved (used by HandleIdle) + bool m_tmpMouseMoved; + // contains last link name + wxHtmlLinkInfo *m_tmpLastLink; + // contains the last (terminal) cell which contained the mouse + wxHtmlCell *m_tmpLastCell; + +private: + wxHtmlWindowInterface *m_interface; +}; + +// ---------------------------------------------------------------------------- +// wxHtmlWindow +// (This is probably the only class you will directly use.) +// Purpose of this class is to display HTML page (either local +// file or downloaded via HTTP protocol) in a window. Width of +// window is constant - given in constructor - virtual height +// is changed dynamically depending on page size. Once the +// window is created you can set its content by calling +// SetPage(text) or LoadPage(filename). +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlWindow : public wxScrolledWindow, + public wxHtmlWindowInterface, + public wxHtmlWindowMouseHelper +{ + wxDECLARE_DYNAMIC_CLASS(wxHtmlWindow); + friend class wxHtmlWinModule; + +public: + wxHtmlWindow() : wxHtmlWindowMouseHelper(this) { Init(); } + wxHtmlWindow(wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxHW_DEFAULT_STYLE, + const wxString& name = wxT("htmlWindow")) + : wxHtmlWindowMouseHelper(this) + { + Init(); + Create(parent, id, pos, size, style, name); + } + virtual ~wxHtmlWindow(); + + bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxHW_SCROLLBAR_AUTO, + const wxString& name = wxT("htmlWindow")); + + // Set HTML page and display it. !! source is HTML document itself, + // it is NOT address/filename of HTML document. If you want to + // specify document location, use LoadPage() instead + // Return value : false if an error occurred, true otherwise + virtual bool SetPage(const wxString& source); + + // Append to current page + bool AppendToPage(const wxString& source); + + // Load HTML page from given location. Location can be either + // a) /usr/wxGTK2/docs/html/wx.htm + // b) http://www.somewhere.uk/document.htm + // c) ftp://ftp.somesite.cz/pub/something.htm + // In case there is no prefix (http:,ftp:), the method + // will try to find it itself (1. local file, then http or ftp) + // After the page is loaded, the method calls SetPage() to display it. + // Note : you can also use path relative to previously loaded page + // Return value : same as SetPage + virtual bool LoadPage(const wxString& location); + + // Loads HTML page from file + bool LoadFile(const wxFileName& filename); + + // Returns full location of opened page + wxString GetOpenedPage() const {return m_OpenedPage;} + // Returns anchor within opened page + wxString GetOpenedAnchor() const {return m_OpenedAnchor;} + // Returns of opened page or empty string otherwise + wxString GetOpenedPageTitle() const {return m_OpenedPageTitle;} + + // Sets frame in which page title will be displayed. Format is format of + // frame title, e.g. "HtmlHelp : %s". It must contain exactly one %s + void SetRelatedFrame(wxFrame* frame, const wxString& format); + wxFrame* GetRelatedFrame() const {return m_RelatedFrame;} + +#if wxUSE_STATUSBAR + // After(!) calling SetRelatedFrame, this sets statusbar slot where messages + // will be displayed. Default is -1 = no messages. + void SetRelatedStatusBar(int index); + void SetRelatedStatusBar(wxStatusBar*, int index = 0); +#endif // wxUSE_STATUSBAR + + // Sets fonts to be used when displaying HTML page. + void SetFonts(const wxString& normal_face, const wxString& fixed_face, + const int *sizes = NULL); + + // Sets font sizes to be relative to the given size or the system + // default size; use either specified or default font + void SetStandardFonts(int size = -1, + const wxString& normal_face = wxEmptyString, + const wxString& fixed_face = wxEmptyString); + + // Sets space between text and window borders. + void SetBorders(int b) {m_Borders = b;} + + // Sets the bitmap to use for background (currnetly it will be tiled, + // when/if we have CSS support we could add other possibilities...) + void SetBackgroundImage(const wxBitmapBundle& bmpBg) { m_bmpBg = bmpBg; } + +#if wxUSE_CONFIG + // Saves custom settings into cfg config. it will use the path 'path' + // if given, otherwise it will save info into currently selected path. + // saved values : things set by SetFonts, SetBorders. + virtual void ReadCustomization(wxConfigBase *cfg, wxString path = wxEmptyString); + // ... + virtual void WriteCustomization(wxConfigBase *cfg, wxString path = wxEmptyString); +#endif // wxUSE_CONFIG + + // Goes to previous/next page (in browsing history) + // Returns true if successful, false otherwise + bool HistoryBack(); + bool HistoryForward(); + bool HistoryCanBack(); + bool HistoryCanForward(); + // Resets history + void HistoryClear(); + + // Returns pointer to conteiners/cells structure. + // It should be used ONLY when printing + wxHtmlContainerCell* GetInternalRepresentation() const {return m_Cell;} + + // Adds input filter + static void AddFilter(wxHtmlFilter *filter); + + // Returns a pointer to the parser. + wxHtmlWinParser *GetParser() const { return m_Parser; } + + // Adds HTML processor to this instance of wxHtmlWindow: + void AddProcessor(wxHtmlProcessor *processor); + // Adds HTML processor to wxHtmlWindow class as whole: + static void AddGlobalProcessor(wxHtmlProcessor *processor); + + + // -- Callbacks -- + + // Sets the title of the window + // (depending on the information passed to SetRelatedFrame() method) + virtual void OnSetTitle(const wxString& title); + + // Called when user clicked on hypertext link. Default behaviour is to + // call LoadPage(loc) + virtual void OnLinkClicked(const wxHtmlLinkInfo& link); + + // Called when wxHtmlWindow wants to fetch data from an URL (e.g. when + // loading a page or loading an image). The data are downloaded if and only if + // OnOpeningURL returns true. If OnOpeningURL returns wxHTML_REDIRECT, + // it must set *redirect to the new URL + virtual wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType WXUNUSED(type), + const wxString& WXUNUSED(url), + wxString *WXUNUSED(redirect)) const + { return wxHTML_OPEN; } + +#if wxUSE_CLIPBOARD + // Helper functions to select parts of page: + void SelectWord(const wxPoint& pos); + void SelectLine(const wxPoint& pos); + void SelectAll(); + + // Convert selection to text: + wxString SelectionToText() { return DoSelectionToText(m_selection); } + + // Converts current page to text: + wxString ToText(); +#endif // wxUSE_CLIPBOARD + + virtual void OnInternalIdle() wxOVERRIDE; + + /// Returns standard HTML cursor as used by wxHtmlWindow + static wxCursor GetDefaultHTMLCursor(HTMLCursor type); + static void SetDefaultHTMLCursor(HTMLCursor type, const wxCursor& cursor); + +protected: + void Init(); + + // Scrolls to anchor of this name. (Anchor is #news + // or #features etc. it is part of address sometimes: + // http://www.ms.mff.cuni.cz/~vsla8348/wxhtml/index.html#news) + // Return value : true if anchor exists, false otherwise + bool ScrollToAnchor(const wxString& anchor); + + // Prepares layout (= fill m_PosX, m_PosY for fragments) based on + // actual size of window. This method also setup scrollbars + void CreateLayout(); + + void OnPaint(wxPaintEvent& event); + void OnEraseBackground(wxEraseEvent& event); + void OnSize(wxSizeEvent& event); + void OnDPIChanged(wxDPIChangedEvent& event); + void OnMouseMove(wxMouseEvent& event); + void OnMouseDown(wxMouseEvent& event); + void OnMouseUp(wxMouseEvent& event); + void OnFocusEvent(wxFocusEvent& event); +#if wxUSE_CLIPBOARD + void OnKeyUp(wxKeyEvent& event); + void OnDoubleClick(wxMouseEvent& event); + void OnCopy(wxCommandEvent& event); + void OnClipboardEvent(wxClipboardTextEvent& event); + void OnMouseEnter(wxMouseEvent& event); + void OnMouseLeave(wxMouseEvent& event); + void OnMouseCaptureLost(wxMouseCaptureLostEvent& event); +#endif // wxUSE_CLIPBOARD + + // Returns new filter (will be stored into m_DefaultFilter variable) + virtual wxHtmlFilter *GetDefaultFilter() {return new wxHtmlFilterPlainText;} + + // cleans static variables + static void CleanUpStatics(); + + // Returns true if text selection is enabled (wxClipboard must be available + // and wxHW_NO_SELECTION not used) + bool IsSelectionEnabled() const; + + enum ClipboardType + { + Primary, + Secondary + }; + + // Copies selection to clipboard if the clipboard support is available + // + // returns true if anything was copied to clipboard, false otherwise + bool CopySelection(ClipboardType t = Secondary); + +#if wxUSE_CLIPBOARD + // Automatic scrolling during selection: + void StopAutoScrolling(); +#endif // wxUSE_CLIPBOARD + + wxString DoSelectionToText(wxHtmlSelection *sel); + +public: + // wxHtmlWindowInterface methods: + virtual void SetHTMLWindowTitle(const wxString& title) wxOVERRIDE; + virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link) wxOVERRIDE; + virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type, + const wxString& url, + wxString *redirect) const wxOVERRIDE; + virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell, + const wxPoint& pos) const wxOVERRIDE; + virtual wxWindow* GetHTMLWindow() wxOVERRIDE; + virtual wxColour GetHTMLBackgroundColour() const wxOVERRIDE; + virtual void SetHTMLBackgroundColour(const wxColour& clr) wxOVERRIDE; + virtual void SetHTMLBackgroundImage(const wxBitmapBundle& bmpBg) wxOVERRIDE; + virtual void SetHTMLStatusText(const wxString& text) wxOVERRIDE; + virtual wxCursor GetHTMLCursor(HTMLCursor type) const wxOVERRIDE; + + // implementation of SetPage() + bool DoSetPage(const wxString& source); + +protected: + // This is pointer to the first cell in parsed data. (Note: the first cell + // is usually top one = all other cells are sub-cells of this one) + wxHtmlContainerCell *m_Cell; + // parser which is used to parse HTML input. + // Each wxHtmlWindow has its own parser because sharing one global + // parser would be problematic (because of reentrancy) + wxHtmlWinParser *m_Parser; + // contains name of actually opened page or empty string if no page opened + wxString m_OpenedPage; + // contains name of current anchor within m_OpenedPage + wxString m_OpenedAnchor; + // contains title of actually opened page or empty string if no <TITLE> tag + wxString m_OpenedPageTitle; + // class for opening files (file system) + wxFileSystem* m_FS; + + // frame in which page title should be displayed & number of its statusbar + // reserved for usage with this html window + wxFrame *m_RelatedFrame; +#if wxUSE_STATUSBAR + int m_RelatedStatusBarIndex; + wxStatusBar* m_RelatedStatusBar; +#endif // wxUSE_STATUSBAR + wxString m_TitleFormat; + + // borders (free space between text and window borders) + // defaults to 10 pixels. + int m_Borders; + + // current text selection or NULL + wxHtmlSelection *m_selection; + + // true if the user is dragging mouse to select text + bool m_makingSelection; + +#if wxUSE_CLIPBOARD + // time of the last double-click event, used to detect triple clicks + // (triple clicks are used to select whole line): + wxMilliClock_t m_lastDoubleClick; + + // helper class to automatically scroll the window if the user is selecting + // text and the mouse leaves wxHtmlWindow: + wxHtmlWinAutoScrollTimer *m_timerAutoScroll; +#endif // wxUSE_CLIPBOARD + +private: + // erase the window background using m_bmpBg or just solid colour if we + // don't have any background image + void DoEraseBackground(wxDC& dc); + + // window content for double buffered rendering, may be invalid until it is + // really initialized in OnPaint() + wxBitmap m_backBuffer; + + // background image, may be invalid + wxBitmapBundle m_bmpBg; + + // variables used when user is selecting text + wxPoint m_tmpSelFromPos; + wxHtmlCell *m_tmpSelFromCell; + + // if >0 contents of the window is not redrawn + // (in order to avoid ugly blinking) + int m_tmpCanDrawLocks; + + // list of HTML filters + static wxList m_Filters; + // this filter is used when no filter is able to read some file + static wxHtmlFilter *m_DefaultFilter; + + // html processors array: + wxHtmlProcessorList *m_Processors; + static wxHtmlProcessorList *m_GlobalProcessors; + + // browser history + wxHtmlHistoryArray *m_History; + int m_HistoryPos; + // if this FLAG is false, items are not added to history + bool m_HistoryOn; + + // Flag used to communicate between OnPaint() and OnEraseBackground(), see + // the comments near its use. + bool m_isBgReallyErased; + + // standard mouse cursors + static wxCursor *ms_cursorLink; + static wxCursor *ms_cursorText; + static wxCursor *ms_cursorDefault; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxHtmlWindow); +}; + +class WXDLLIMPEXP_FWD_HTML wxHtmlCellEvent; + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_HTML, wxEVT_HTML_CELL_CLICKED, wxHtmlCellEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_HTML, wxEVT_HTML_CELL_HOVER, wxHtmlCellEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_HTML, wxEVT_HTML_LINK_CLICKED, wxHtmlLinkEvent ); + + +/*! + * Html cell window event + */ + +class WXDLLIMPEXP_HTML wxHtmlCellEvent : public wxCommandEvent +{ +public: + wxHtmlCellEvent() {} + wxHtmlCellEvent(wxEventType commandType, int id, + wxHtmlCell *cell, const wxPoint &pt, + const wxMouseEvent &ev) + : wxCommandEvent(commandType, id) + , m_mouseEvent(ev) + , m_pt(pt) + { + m_cell = cell; + m_bLinkWasClicked = false; + } + + wxHtmlCell* GetCell() const { return m_cell; } + wxPoint GetPoint() const { return m_pt; } + wxMouseEvent GetMouseEvent() const { return m_mouseEvent; } + + void SetLinkClicked(bool linkclicked) { m_bLinkWasClicked=linkclicked; } + bool GetLinkClicked() const { return m_bLinkWasClicked; } + + // default copy ctor, assignment operator and dtor are ok + virtual wxEvent *Clone() const wxOVERRIDE { return new wxHtmlCellEvent(*this); } + +private: + wxHtmlCell *m_cell; + wxMouseEvent m_mouseEvent; + wxPoint m_pt; + + bool m_bLinkWasClicked; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxHtmlCellEvent); +}; + + + +/*! + * Html link event + */ + +class WXDLLIMPEXP_HTML wxHtmlLinkEvent : public wxCommandEvent +{ +public: + wxHtmlLinkEvent() {} + wxHtmlLinkEvent(int id, const wxHtmlLinkInfo &linkinfo) + : wxCommandEvent(wxEVT_HTML_LINK_CLICKED, id) + , m_linkInfo(linkinfo) + { + } + + const wxHtmlLinkInfo &GetLinkInfo() const { return m_linkInfo; } + + // default copy ctor, assignment operator and dtor are ok + virtual wxEvent *Clone() const wxOVERRIDE { return new wxHtmlLinkEvent(*this); } + +private: + wxHtmlLinkInfo m_linkInfo; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxHtmlLinkEvent); +}; + + +typedef void (wxEvtHandler::*wxHtmlCellEventFunction)(wxHtmlCellEvent&); +typedef void (wxEvtHandler::*wxHtmlLinkEventFunction)(wxHtmlLinkEvent&); + +#define wxHtmlCellEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxHtmlCellEventFunction, func) +#define wxHtmlLinkEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxHtmlLinkEventFunction, func) + +#define EVT_HTML_CELL_CLICKED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_HTML_CELL_CLICKED, id, wxHtmlCellEventHandler(fn)) +#define EVT_HTML_CELL_HOVER(id, fn) \ + wx__DECLARE_EVT1(wxEVT_HTML_CELL_HOVER, id, wxHtmlCellEventHandler(fn)) +#define EVT_HTML_LINK_CLICKED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_HTML_LINK_CLICKED, id, wxHtmlLinkEventHandler(fn)) + + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_HTML_CELL_CLICKED wxEVT_HTML_CELL_CLICKED +#define wxEVT_COMMAND_HTML_CELL_HOVER wxEVT_HTML_CELL_HOVER +#define wxEVT_COMMAND_HTML_LINK_CLICKED wxEVT_HTML_LINK_CLICKED + +#endif // wxUSE_HTML + +#endif // _WX_HTMLWIN_H_ + diff --git a/lib/wxWidgets/include/wx/html/htmprint.h b/lib/wxWidgets/include/wx/html/htmprint.h new file mode 100644 index 0000000..00a3189 --- /dev/null +++ b/lib/wxWidgets/include/wx/html/htmprint.h @@ -0,0 +1,328 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/html/htmprint.h +// Purpose: html printing classes +// Author: Vaclav Slavik +// Created: 25/09/99 +// Copyright: (c) Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HTMPRINT_H_ +#define _WX_HTMPRINT_H_ + +#include "wx/defs.h" + +#if wxUSE_HTML & wxUSE_PRINTING_ARCHITECTURE + +#include "wx/html/htmlcell.h" +#include "wx/html/winpars.h" +#include "wx/html/htmlfilt.h" + +#include "wx/print.h" +#include "wx/printdlg.h" +#include "wx/vector.h" + +#include <limits.h> // INT_MAX + +//-------------------------------------------------------------------------------- +// wxHtmlDCRenderer +// This class is capable of rendering HTML into specified +// portion of DC +//-------------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlDCRenderer : public wxObject +{ +public: + wxHtmlDCRenderer(); + virtual ~wxHtmlDCRenderer(); + + // Following 3 methods *must* be called before any call to Render: + + // Assign DC to this render + void SetDC(wxDC *dc, double pixel_scale = 1.0) + { SetDC(dc, pixel_scale, pixel_scale); } + void SetDC(wxDC *dc, double pixel_scale, double font_scale); + + // Sets size of output rectangle, in pixels. Note that you *can't* change + // width of the rectangle between calls to Render! (You can freely change height.) + void SetSize(int width, int height); + + // Sets the text to be displayed. + // Basepath is base directory (html string would be stored there if it was in + // file). It is used to determine path for loading images, for example. + // isdir is false if basepath is filename, true if it is directory name + // (see wxFileSystem for detailed explanation) + void SetHtmlText(const wxString& html, const wxString& basepath = wxEmptyString, bool isdir = true); + + // Sets the HTML cell that will be rendered: this is more efficient than + // using text as it allows to parse it only once. Note that the cell will + // be modified by this call. + void SetHtmlCell(wxHtmlContainerCell& cell); + + // Sets fonts to be used when displaying HTML page. (if size null then default sizes used). + void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes = NULL); + + // Sets font sizes to be relative to the given size or the system + // default size; use either specified or default font + void SetStandardFonts(int size = -1, + const wxString& normal_face = wxEmptyString, + const wxString& fixed_face = wxEmptyString); + + // Finds the next page break after the specified (vertical) position. + // Returns wxNOT_FOUND if passed in position is the last page break. + int FindNextPageBreak(int pos) const; + + // [x,y] is position of upper-left corner of printing rectangle (see SetSize) + // from is y-coordinate of the very first visible cell + // to is y-coordinate of the next following page break, if any + void Render(int x, int y, int from = 0, int to = INT_MAX); + + // returns total width of the html document + int GetTotalWidth() const; + + // returns total height of the html document + int GetTotalHeight() const; + +private: + void DoSetHtmlCell(wxHtmlContainerCell* cell); + + wxDC *m_DC; + wxFileSystem m_FS; + wxHtmlWinParser m_Parser; + wxHtmlContainerCell *m_Cells; + int m_Width, m_Height; + bool m_ownsCells; + + wxDECLARE_NO_COPY_CLASS(wxHtmlDCRenderer); +}; + + + + + +enum { + wxPAGE_ODD, + wxPAGE_EVEN, + wxPAGE_ALL +}; + + + +//-------------------------------------------------------------------------------- +// wxHtmlPrintout +// This class is derived from standard wxWidgets printout class +// and is used to print HTML documents. +//-------------------------------------------------------------------------------- + + +class WXDLLIMPEXP_HTML wxHtmlPrintout : public wxPrintout +{ +public: + wxHtmlPrintout(const wxString& title = wxT("Printout")); + + void SetHtmlText(const wxString& html, const wxString &basepath = wxEmptyString, bool isdir = true); + // prepares the class for printing this html document. + // Must be called before using the class, in fact just after constructor + // + // basepath is base directory (html string would be stored there if it was in + // file). It is used to determine path for loading images, for example. + // isdir is false if basepath is filename, true if it is directory name + // (see wxFileSystem for detailed explanation) + + void SetHtmlFile(const wxString &htmlfile); + // same as SetHtmlText except that it takes regular file as the parameter + + void SetHeader(const wxString& header, int pg = wxPAGE_ALL); + void SetFooter(const wxString& footer, int pg = wxPAGE_ALL); + // sets header/footer for the document. The argument is interpreted as HTML document. + // You can use macros in it: + // @PAGENUM@ is replaced by page number + // @PAGESCNT@ is replaced by total number of pages + // + // pg is one of wxPAGE_ODD, wxPAGE_EVEN and wx_PAGE_ALL constants. + // You can set different header/footer for odd and even pages + + // Sets fonts to be used when displaying HTML page. (if size null then default sizes used). + void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes = NULL); + + // Sets font sizes to be relative to the given size or the system + // default size; use either specified or default font + void SetStandardFonts(int size = -1, + const wxString& normal_face = wxEmptyString, + const wxString& fixed_face = wxEmptyString); + + void SetMargins(float top = 25.2f, float bottom = 25.2f, float left = 25.2f, float right = 25.2f, + float spaces = 5); + // sets margins in millimeters. Defaults to 1 inch for margins and 0.5cm for space + // between text and header and/or footer + + void SetMargins(const wxPageSetupDialogData& pageSetupData); + + // wxPrintout stuff: + bool OnPrintPage(int page) wxOVERRIDE; + bool HasPage(int page) wxOVERRIDE; + void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo) wxOVERRIDE; + bool OnBeginDocument(int startPage, int endPage) wxOVERRIDE; + void OnPreparePrinting() wxOVERRIDE; + + // Adds input filter + static void AddFilter(wxHtmlFilter *filter); + + // Cleanup + static void CleanUpStatics(); + +private: + // this function is called by the base class OnPreparePrinting() + // implementation and by default checks whether the document fits into + // pageArea horizontally and warns the user if it does not and, if we're + // going to print and not just to preview the document, giving him the + // possibility to cancel printing + // + // you may override it to either suppress this check if truncation of the + // HTML being printed is acceptable or, on the contrary, add more checks to + // it, e.g. for the fit in the vertical direction if the document should + // always appear on a single page + // + // return true if printing should go ahead or false to cancel it (the + // return value is ignored when previewing) + virtual bool CheckFit(const wxSize& pageArea, const wxSize& docArea) const; + + void RenderPage(wxDC *dc, int page); + // renders one page into dc + wxString TranslateHeader(const wxString& instr, int page); + // substitute @PAGENUM@ and @PAGESCNT@ by real values + void CountPages(); + // fills m_PageBreaks, which indirectly gives the number of pages + + +private: + wxVector<int> m_PageBreaks; + + wxString m_Document, m_BasePath; + bool m_BasePathIsDir; + wxString m_Headers[2], m_Footers[2]; + + int m_HeaderHeight, m_FooterHeight; + wxHtmlDCRenderer m_Renderer, m_RendererHdr; + float m_MarginTop, m_MarginBottom, m_MarginLeft, m_MarginRight, m_MarginSpace; + + // list of HTML filters + static wxVector<wxHtmlFilter*> m_Filters; + + wxDECLARE_NO_COPY_CLASS(wxHtmlPrintout); +}; + + + + + +//-------------------------------------------------------------------------------- +// wxHtmlEasyPrinting +// This class provides very simple interface to printing +// architecture. It allows you to print HTML documents only +// with very few commands. +// +// Note : do not create this class on stack only. +// You should create an instance on app startup and +// use this instance for all printing. Why? The class +// stores page&printer settings in it. +//-------------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlEasyPrinting : public wxObject +{ +public: + wxHtmlEasyPrinting(const wxString& name = wxT("Printing"), wxWindow *parentWindow = NULL); + virtual ~wxHtmlEasyPrinting(); + + bool PreviewFile(const wxString &htmlfile); + bool PreviewText(const wxString &htmltext, const wxString& basepath = wxEmptyString); + // Preview file / html-text for printing + // (and offers printing) + // basepath is base directory for opening subsequent files (e.g. from <img> tag) + + bool PrintFile(const wxString &htmlfile); + bool PrintText(const wxString &htmltext, const wxString& basepath = wxEmptyString); + // Print file / html-text w/o preview + + void PageSetup(); + // pop up printer or page setup dialog + + void SetHeader(const wxString& header, int pg = wxPAGE_ALL); + void SetFooter(const wxString& footer, int pg = wxPAGE_ALL); + // sets header/footer for the document. The argument is interpreted as HTML document. + // You can use macros in it: + // @PAGENUM@ is replaced by page number + // @PAGESCNT@ is replaced by total number of pages + // + // pg is one of wxPAGE_ODD, wxPAGE_EVEN and wx_PAGE_ALL constants. + // You can set different header/footer for odd and even pages + + void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int* sizes = NULL); + // Sets fonts to be used when displaying HTML page. (if size null then default sizes used) + + // Sets font sizes to be relative to the given size or the system + // default size; use either specified or default font + void SetStandardFonts(int size = -1, + const wxString& normal_face = wxEmptyString, + const wxString& fixed_face = wxEmptyString); + + wxPrintData *GetPrintData(); + wxPageSetupDialogData *GetPageSetupData() {return m_PageSetupData;} + // return page setting data objects. + // (You can set their parameters.) + + wxWindow* GetParentWindow() const { return m_ParentWindow; } + // get the parent window + void SetParentWindow(wxWindow* window) { m_ParentWindow = window; } + // set the parent window + + const wxString& GetName() const { return m_Name; } + // get the printout name + void SetName(const wxString& name) { m_Name = name; } + // set the printout name + + // Controls showing the dialog when printing: by default, always shown. + enum PromptMode + { + Prompt_Never, + Prompt_Once, + Prompt_Always + }; + + void SetPromptMode(PromptMode promptMode) { m_promptMode = promptMode; } + +protected: + virtual wxHtmlPrintout *CreatePrintout(); + virtual bool DoPreview(wxHtmlPrintout *printout1, wxHtmlPrintout *printout2); + virtual bool DoPrint(wxHtmlPrintout *printout); + +private: + wxPrintData *m_PrintData; + wxPageSetupDialogData *m_PageSetupData; + wxString m_Name; + int m_FontsSizesArr[7]; + int *m_FontsSizes; + wxString m_FontFaceFixed, m_FontFaceNormal; + + enum FontMode + { + FontMode_Explicit, + FontMode_Standard + }; + FontMode m_fontMode; + + wxString m_Headers[2], m_Footers[2]; + wxWindow *m_ParentWindow; + + PromptMode m_promptMode; + + wxDECLARE_NO_COPY_CLASS(wxHtmlEasyPrinting); +}; + + + + +#endif // wxUSE_HTML & wxUSE_PRINTING_ARCHITECTURE + +#endif // _WX_HTMPRINT_H_ + diff --git a/lib/wxWidgets/include/wx/html/m_templ.h b/lib/wxWidgets/include/wx/html/m_templ.h new file mode 100644 index 0000000..8001c86 --- /dev/null +++ b/lib/wxWidgets/include/wx/html/m_templ.h @@ -0,0 +1,83 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/html/m_templ.h +// Purpose: Modules template file +// Author: Vaclav Slavik +// Copyright: (c) Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +/* + +DESCRIPTION: +This is set of macros for easier writing of tag handlers. How to use it? +See mod_fonts.cpp for example... + +Attention! This is quite strange C++ bastard. Before using it, +I STRONGLY recommend reading and understanding these macros!! + +*/ + + +#ifndef _WX_M_TEMPL_H_ +#define _WX_M_TEMPL_H_ + +#include "wx/defs.h" + +#if wxUSE_HTML + +#include "wx/html/winpars.h" + +#define TAG_HANDLER_BEGIN(name,tags) \ + class wxHTML_Handler_##name : public wxHtmlWinTagHandler \ + { \ + public: \ + wxString GetSupportedTags() wxOVERRIDE {return wxT(tags);} + + + +#define TAG_HANDLER_VARS \ + private: + +#define TAG_HANDLER_CONSTR(name) \ + public: \ + wxHTML_Handler_##name () : wxHtmlWinTagHandler() + + +#define TAG_HANDLER_PROC(varib) \ + public: \ + bool HandleTag(const wxHtmlTag& varib) wxOVERRIDE + + + +#define TAG_HANDLER_END(name) \ + }; + + + + +#define TAGS_MODULE_BEGIN(name) \ + class wxHTML_Module##name : public wxHtmlTagsModule \ + { \ + wxDECLARE_DYNAMIC_CLASS(wxHTML_Module##name ); \ + public: \ + void FillHandlersTable(wxHtmlWinParser *parser) wxOVERRIDE \ + { + + + + +#define TAGS_MODULE_ADD(handler) \ + parser->AddTagHandler(new wxHTML_Handler_##handler); + + + + +#define TAGS_MODULE_END(name) \ + } \ + }; \ + wxIMPLEMENT_DYNAMIC_CLASS(wxHTML_Module##name , wxHtmlTagsModule) + + + +#endif +#endif diff --git a/lib/wxWidgets/include/wx/html/styleparams.h b/lib/wxWidgets/include/wx/html/styleparams.h new file mode 100644 index 0000000..8269c12 --- /dev/null +++ b/lib/wxWidgets/include/wx/html/styleparams.h @@ -0,0 +1,52 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/html/styleparams.h +// Purpose: wxHtml helper code for extracting style parameters +// Author: Nigel Paton +// Copyright: wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HTML_STYLEPARAMS_H_ +#define _WX_HTML_STYLEPARAMS_H_ + +#include "wx/defs.h" + +#if wxUSE_HTML + +#include "wx/arrstr.h" + +class WXDLLIMPEXP_FWD_HTML wxHtmlTag; + +// This is a private class used by wxHTML to parse "style" attributes of HTML +// elements. Currently both parsing and support for the parsed values is pretty +// trivial. +class WXDLLIMPEXP_HTML wxHtmlStyleParams +{ +public: + // Construct a style parameters object corresponding to the style attribute + // of the given HTML tag. + wxHtmlStyleParams(const wxHtmlTag& tag); + + // Check whether the named parameter is present or not. + bool HasParam(const wxString& par) const + { + return m_names.Index(par, false /* ignore case */) != wxNOT_FOUND; + } + + // Get the value of the named parameter, return empty string if none. + wxString GetParam(const wxString& par) const + { + int index = m_names.Index(par, false); + return index == wxNOT_FOUND ? wxString() : m_values[index]; + } + +private: + // Arrays if names and values of the parameters + wxArrayString + m_names, + m_values; +}; + +#endif // wxUSE_HTML + +#endif // _WX_HTML_STYLEPARAMS_H_ diff --git a/lib/wxWidgets/include/wx/html/winpars.h b/lib/wxWidgets/include/wx/html/winpars.h new file mode 100644 index 0000000..97d5a87 --- /dev/null +++ b/lib/wxWidgets/include/wx/html/winpars.h @@ -0,0 +1,308 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/html/winpars.h +// Purpose: wxHtmlWinParser class (parser to be used with wxHtmlWindow) +// Author: Vaclav Slavik +// Copyright: (c) 1999 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WINPARS_H_ +#define _WX_WINPARS_H_ + +#include "wx/defs.h" +#if wxUSE_HTML + +#include "wx/module.h" +#include "wx/font.h" +#include "wx/html/htmlpars.h" +#include "wx/html/htmlcell.h" +#include "wx/encconv.h" + +class WXDLLIMPEXP_FWD_HTML wxHtmlWindow; +class WXDLLIMPEXP_FWD_HTML wxHtmlWindowInterface; +class WXDLLIMPEXP_FWD_HTML wxHtmlWinParser; +class WXDLLIMPEXP_FWD_HTML wxHtmlWinTagHandler; +class WXDLLIMPEXP_FWD_HTML wxHtmlTagsModule; + + +//-------------------------------------------------------------------------------- +// wxHtmlWinParser +// This class is derived from wxHtmlParser and its mail goal +// is to parse HTML input so that it can be displayed in +// wxHtmlWindow. It uses special wxHtmlWinTagHandler. +//-------------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlWinParser : public wxHtmlParser +{ + wxDECLARE_ABSTRACT_CLASS(wxHtmlWinParser); + friend class wxHtmlWindow; + +public: + wxHtmlWinParser(wxHtmlWindowInterface *wndIface = NULL); + + virtual ~wxHtmlWinParser(); + + virtual void InitParser(const wxString& source) wxOVERRIDE; + virtual void DoneParser() wxOVERRIDE; + virtual wxObject* GetProduct() wxOVERRIDE; + + virtual wxFSFile *OpenURL(wxHtmlURLType type, const wxString& url) const wxOVERRIDE; + + // Set's the DC used for parsing. If SetDC() is not called, + // parsing won't proceed + virtual void SetDC(wxDC *dc, double pixel_scale = 1.0) + { SetDC(dc, pixel_scale, pixel_scale); } + void SetDC(wxDC *dc, double pixel_scale, double font_scale); + + wxDC *GetDC() {return m_DC;} + double GetPixelScale() const { return m_PixelScale; } + int GetCharHeight() const {return m_CharHeight;} + int GetCharWidth() const {return m_CharWidth;} + + // NOTE : these functions do _not_ return _actual_ + // height/width. They return h/w of default font + // for this DC. If you want actual values, call + // GetDC()->GetChar...() + + // returns interface to the rendering window + wxHtmlWindowInterface *GetWindowInterface() {return m_windowInterface;} + + // Sets fonts to be used when displaying HTML page. (if size null then default sizes used). + void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes = NULL); + + // Sets font sizes to be relative to the given size or the system + // default size; use either specified or default font + void SetStandardFonts(int size = -1, + const wxString& normal_face = wxEmptyString, + const wxString& fixed_face = wxEmptyString); + + // Adds tags module. see wxHtmlTagsModule for details. + static void AddModule(wxHtmlTagsModule *module); + + static void RemoveModule(wxHtmlTagsModule *module); + + // parsing-related methods. These methods are called by tag handlers: + + // Returns pointer to actual container. Common use in tag handler is : + // m_WParser->GetContainer()->InsertCell(new ...); + wxHtmlContainerCell *GetContainer() const {return m_Container;} + + // opens new container. This container is sub-container of opened + // container. Sets GetContainer to newly created container + // and returns it. + wxHtmlContainerCell *OpenContainer(); + + // works like OpenContainer except that new container is not created + // but c is used. You can use this to directly set actual container + wxHtmlContainerCell *SetContainer(wxHtmlContainerCell *c); + + // closes the container and sets actual Container to upper-level + // container + wxHtmlContainerCell *CloseContainer(); + + int GetFontSize() const {return m_FontSize;} + void SetFontSize(int s); + // Try to map a font size in points to the HTML 1-7 font size range. + void SetFontPointSize(int pt); + int GetFontBold() const {return m_FontBold;} + void SetFontBold(int x) {m_FontBold = x;} + int GetFontItalic() const {return m_FontItalic;} + void SetFontItalic(int x) {m_FontItalic = x;} + int GetFontUnderlined() const {return m_FontUnderlined;} + void SetFontUnderlined(int x) {m_FontUnderlined = x;} + int GetFontFixed() const {return m_FontFixed;} + void SetFontFixed(int x) {m_FontFixed = x;} + wxString GetFontFace() const {return GetFontFixed() ? m_FontFaceFixed : m_FontFaceNormal;} + void SetFontFace(const wxString& face); + + int GetAlign() const {return m_Align;} + void SetAlign(int a) {m_Align = a;} + + wxHtmlScriptMode GetScriptMode() const { return m_ScriptMode; } + void SetScriptMode(wxHtmlScriptMode mode) { m_ScriptMode = mode; } + long GetScriptBaseline() const { return m_ScriptBaseline; } + void SetScriptBaseline(long base) { m_ScriptBaseline = base; } + + const wxColour& GetLinkColor() const { return m_LinkColor; } + void SetLinkColor(const wxColour& clr) { m_LinkColor = clr; } + const wxColour& GetActualColor() const { return m_ActualColor; } + void SetActualColor(const wxColour& clr) { m_ActualColor = clr ;} + const wxColour& GetActualBackgroundColor() const { return m_ActualBackgroundColor; } + void SetActualBackgroundColor(const wxColour& clr) { m_ActualBackgroundColor = clr;} + int GetActualBackgroundMode() const { return m_ActualBackgroundMode; } + void SetActualBackgroundMode(int mode) { m_ActualBackgroundMode = mode;} + const wxHtmlLinkInfo& GetLink() const { return m_Link; } + void SetLink(const wxHtmlLinkInfo& link); + + // applies current parser state (link, sub/supscript, ...) to given cell + void ApplyStateToCell(wxHtmlCell *cell); + + // Needs to be called after inserting a cell that interrupts the flow of + // the text like e.g. <img> and tells us to not consider any of the + // following space as being part of the same space run as before. + void StopCollapsingSpaces() { m_tmpLastWasSpace = false; } + +#if !wxUSE_UNICODE + void SetInputEncoding(wxFontEncoding enc); + wxFontEncoding GetInputEncoding() const { return m_InputEnc; } + wxFontEncoding GetOutputEncoding() const { return m_OutputEnc; } + wxEncodingConverter *GetEncodingConverter() const { return m_EncConv; } +#endif + + // creates font depending on m_Font* members. + virtual wxFont* CreateCurrentFont(); + + enum WhitespaceMode + { + Whitespace_Normal, // normal mode, collapse whitespace + Whitespace_Pre // inside <pre>, keep whitespace as-is + }; + + // change the current whitespace handling mode + void SetWhitespaceMode(WhitespaceMode mode) { m_whitespaceMode = mode; } + WhitespaceMode GetWhitespaceMode() const { return m_whitespaceMode; } + +protected: + virtual void AddText(const wxString& txt) wxOVERRIDE; + +private: + void FlushWordBuf(wxChar *temp, int& len); + void AddWord(wxHtmlWordCell *word); + void AddWord(const wxString& word) + { AddWord(new wxHtmlWordCell(word, *(GetDC()))); } + void AddPreBlock(const wxString& text); + + bool m_tmpLastWasSpace; + wxChar *m_tmpStrBuf; + size_t m_tmpStrBufSize; + // temporary variables used by AddText + wxHtmlWindowInterface *m_windowInterface; + // window we're parsing for + double m_PixelScale, m_FontScale; + wxDC *m_DC; + // Device Context we're parsing for + static wxList m_Modules; + // list of tags modules (see wxHtmlTagsModule for details) + // This list is used to initialize m_Handlers member. + + wxHtmlContainerCell *m_Container; + // current container. See Open/CloseContainer for details. + + int m_FontBold, m_FontItalic, m_FontUnderlined, m_FontFixed; // this is not true,false but 1,0, we need it for indexing + int m_FontSize; // From 1 (smallest) to 7, default is 3. + wxColour m_LinkColor; + wxColour m_ActualColor; + wxColour m_ActualBackgroundColor; + int m_ActualBackgroundMode; + // basic font parameters. + wxHtmlLinkInfo m_Link; + // actual hypertext link or empty string + bool m_UseLink; + // true if m_Link is not empty + int m_CharHeight, m_CharWidth; + // average height of normal-sized text + int m_Align; + // actual alignment + wxHtmlScriptMode m_ScriptMode; + // current script mode (sub/sup/normal) + long m_ScriptBaseline; + // current sub/supscript base + + wxFont* m_FontsTable[2][2][2][2][7]; + wxString m_FontsFacesTable[2][2][2][2][7]; +#if !wxUSE_UNICODE + wxFontEncoding m_FontsEncTable[2][2][2][2][7]; +#endif + // table of loaded fonts. 1st four indexes are 0 or 1, depending on on/off + // state of these flags (from left to right): + // [bold][italic][underlined][fixed_size] + // last index is font size : from 0 to 6 (remapped from html sizes 1 to 7) + // Note : this table covers all possible combinations of fonts, but not + // all of them are used, so many items in table are usually NULL. + int m_FontsSizes[7]; + wxString m_FontFaceFixed, m_FontFaceNormal; + // html font sizes and faces of fixed and proportional fonts + +#if !wxUSE_UNICODE + wxChar m_nbsp; + wxFontEncoding m_InputEnc, m_OutputEnc; + // I/O font encodings + wxEncodingConverter *m_EncConv; +#endif + + // current whitespace handling mode + WhitespaceMode m_whitespaceMode; + + wxHtmlWordCell *m_lastWordCell; + + // current position on line, in num. of characters; used to properly + // expand TABs; only updated while inside <pre> + int m_posColumn; + + wxDECLARE_NO_COPY_CLASS(wxHtmlWinParser); +}; + + + + + + +//----------------------------------------------------------------------------- +// wxHtmlWinTagHandler +// This is basically wxHtmlTagHandler except +// it is extended with protected member m_Parser pointing to +// the wxHtmlWinParser object +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_HTML wxHtmlStyleParams; + +class WXDLLIMPEXP_HTML wxHtmlWinTagHandler : public wxHtmlTagHandler +{ + wxDECLARE_ABSTRACT_CLASS(wxHtmlWinTagHandler); + +public: + wxHtmlWinTagHandler() : wxHtmlTagHandler() {} + + virtual void SetParser(wxHtmlParser *parser) wxOVERRIDE {wxHtmlTagHandler::SetParser(parser); m_WParser = (wxHtmlWinParser*) parser;} + +protected: + wxHtmlWinParser *m_WParser; // same as m_Parser, but overcasted + + void ApplyStyle(const wxHtmlStyleParams &styleParams); + + wxDECLARE_NO_COPY_CLASS(wxHtmlWinTagHandler); +}; + + + + + + +//---------------------------------------------------------------------------- +// wxHtmlTagsModule +// This is basic of dynamic tag handlers binding. +// The class provides methods for filling parser's handlers +// hash table. +// (See documentation for details) +//---------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlTagsModule : public wxModule +{ + wxDECLARE_DYNAMIC_CLASS(wxHtmlTagsModule); + +public: + wxHtmlTagsModule() : wxModule() {} + + virtual bool OnInit() wxOVERRIDE; + virtual void OnExit() wxOVERRIDE; + + // This is called by wxHtmlWinParser. + // The method must simply call parser->AddTagHandler(new + // <handler_class_name>); for each handler + virtual void FillHandlersTable(wxHtmlWinParser * WXUNUSED(parser)) { } +}; + + +#endif + +#endif // _WX_WINPARS_H_ diff --git a/lib/wxWidgets/include/wx/htmllbox.h b/lib/wxWidgets/include/wx/htmllbox.h new file mode 100644 index 0000000..9705a83 --- /dev/null +++ b/lib/wxWidgets/include/wx/htmllbox.h @@ -0,0 +1,330 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/htmllbox.h +// Purpose: wxHtmlListBox is a listbox whose items are wxHtmlCells +// Author: Vadim Zeitlin +// Modified by: +// Created: 31.05.03 +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HTMLLBOX_H_ +#define _WX_HTMLLBOX_H_ + +#include "wx/defs.h" + +#if wxUSE_HTML + +#include "wx/vlbox.h" // base class +#include "wx/html/htmlwin.h" +#include "wx/ctrlsub.h" + +#if wxUSE_FILESYSTEM + #include "wx/filesys.h" +#endif // wxUSE_FILESYSTEM + +class WXDLLIMPEXP_FWD_HTML wxHtmlCell; +class WXDLLIMPEXP_FWD_HTML wxHtmlWinParser; +class WXDLLIMPEXP_FWD_HTML wxHtmlListBoxCache; +class WXDLLIMPEXP_FWD_HTML wxHtmlListBoxStyle; + +extern WXDLLIMPEXP_DATA_HTML(const char) wxHtmlListBoxNameStr[]; +extern WXDLLIMPEXP_DATA_HTML(const char) wxSimpleHtmlListBoxNameStr[]; + +// ---------------------------------------------------------------------------- +// wxHtmlListBox +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_HTML wxHtmlListBox : public wxVListBox, + public wxHtmlWindowInterface, + public wxHtmlWindowMouseHelper +{ + wxDECLARE_ABSTRACT_CLASS(wxHtmlListBox); +public: + // constructors and such + // --------------------- + + // default constructor, you must call Create() later + wxHtmlListBox(); + + // normal constructor which calls Create() internally + wxHtmlListBox(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxHtmlListBoxNameStr)); + + // really creates the control and sets the initial number of items in it + // (which may be changed later with SetItemCount()) + // + // the only special style which may be specified here is wxLB_MULTIPLE + // + // returns true on success or false if the control couldn't be created + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxHtmlListBoxNameStr)); + + // destructor cleans up whatever resources we use + virtual ~wxHtmlListBox(); + + // override some base class virtuals + virtual void RefreshRow(size_t line) wxOVERRIDE; + virtual void RefreshRows(size_t from, size_t to) wxOVERRIDE; + virtual void RefreshAll() wxOVERRIDE; + virtual void SetItemCount(size_t count) wxOVERRIDE; + +#if wxUSE_FILESYSTEM + // retrieve the file system used by the wxHtmlWinParser: if you use + // relative paths in your HTML, you should use its ChangePathTo() method + wxFileSystem& GetFileSystem() { return m_filesystem; } + const wxFileSystem& GetFileSystem() const { return m_filesystem; } +#endif // wxUSE_FILESYSTEM + + virtual void OnInternalIdle() wxOVERRIDE; + +protected: + // this method must be implemented in the derived class and should return + // the body (i.e. without <html>) of the HTML for the given item + virtual wxString OnGetItem(size_t n) const = 0; + + // this function may be overridden to decorate HTML returned by OnGetItem() + virtual wxString OnGetItemMarkup(size_t n) const; + + + // this method allows to customize the selection appearance: it may be used + // to specify the colour of the text which normally has the given colour + // colFg when it is inside the selection + // + // by default, the original colour is not used at all and all text has the + // same (default for this system) colour inside selection + virtual wxColour GetSelectedTextColour(const wxColour& colFg) const; + + // this is the same as GetSelectedTextColour() but allows to customize the + // background colour -- this is even more rarely used as you can change it + // globally using SetSelectionBackground() + virtual wxColour GetSelectedTextBgColour(const wxColour& colBg) const; + + + // we implement both of these functions in terms of OnGetItem(), they are + // not supposed to be overridden by our descendants + virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const wxOVERRIDE; + virtual wxCoord OnMeasureItem(size_t n) const wxOVERRIDE; + + // override this one to draw custom background for selected items correctly + virtual void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const wxOVERRIDE; + + // this method may be overridden to handle clicking on a link in the + // listbox (by default, clicks on links are simply ignored) + virtual void OnLinkClicked(size_t n, const wxHtmlLinkInfo& link); + + // event handlers + void OnSize(wxSizeEvent& event); + void OnMouseMove(wxMouseEvent& event); + void OnLeftDown(wxMouseEvent& event); + + + // common part of all ctors + void Init(); + + // ensure that the given item is cached + void CacheItem(size_t n) const; + +private: + // wxHtmlWindowInterface methods: + virtual void SetHTMLWindowTitle(const wxString& title) wxOVERRIDE; + virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link) wxOVERRIDE; + virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type, + const wxString& url, + wxString *redirect) const wxOVERRIDE; + virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell, + const wxPoint& pos) const wxOVERRIDE; + virtual wxWindow* GetHTMLWindow() wxOVERRIDE; + virtual wxColour GetHTMLBackgroundColour() const wxOVERRIDE; + virtual void SetHTMLBackgroundColour(const wxColour& clr) wxOVERRIDE; + virtual void SetHTMLBackgroundImage(const wxBitmapBundle& bmpBg) wxOVERRIDE; + virtual void SetHTMLStatusText(const wxString& text) wxOVERRIDE; + virtual wxCursor GetHTMLCursor(HTMLCursor type) const wxOVERRIDE; + + // returns index of item that contains given HTML cell + size_t GetItemForCell(const wxHtmlCell *cell) const; + + // Create the cell for the given item, caller is responsible for freeing it. + wxHtmlCell* CreateCellForItem(size_t n) const; + + // return physical coordinates of root wxHtmlCell of n-th item + wxPoint GetRootCellCoords(size_t n) const; + + // Converts physical coordinates stored in @a pos into coordinates + // relative to the root cell of the item under mouse cursor, if any. If no + // cell is found under the cursor, returns false. Otherwise stores the new + // coordinates back into @a pos and pointer to the cell under cursor into + // @a cell and returns true. + bool PhysicalCoordsToCell(wxPoint& pos, wxHtmlCell*& cell) const; + + // The opposite of PhysicalCoordsToCell: converts coordinates relative to + // given cell to physical coordinates in the window + wxPoint CellCoordsToPhysical(const wxPoint& pos, wxHtmlCell *cell) const; + +private: + // this class caches the pre-parsed HTML to speed up display + wxHtmlListBoxCache *m_cache; + + // HTML parser we use + wxHtmlWinParser *m_htmlParser; + +#if wxUSE_FILESYSTEM + // file system used by m_htmlParser + wxFileSystem m_filesystem; +#endif // wxUSE_FILESYSTEM + + // rendering style for the parser which allows us to customize our colours + wxHtmlListBoxStyle *m_htmlRendStyle; + + + // it calls our GetSelectedTextColour() and GetSelectedTextBgColour() + friend class wxHtmlListBoxStyle; + friend class wxHtmlListBoxWinInterface; + + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxHtmlListBox); +}; + + +// ---------------------------------------------------------------------------- +// wxSimpleHtmlListBox +// ---------------------------------------------------------------------------- + +#define wxHLB_DEFAULT_STYLE wxBORDER_SUNKEN +#define wxHLB_MULTIPLE wxLB_MULTIPLE + +class WXDLLIMPEXP_HTML wxSimpleHtmlListBox : + public wxWindowWithItems<wxHtmlListBox, wxItemContainer> +{ + wxDECLARE_ABSTRACT_CLASS(wxSimpleHtmlListBox); +public: + // wxListbox-compatible constructors + // --------------------------------- + + wxSimpleHtmlListBox() { } + + wxSimpleHtmlListBox(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = wxHLB_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxSimpleHtmlListBoxNameStr)) + { + Create(parent, id, pos, size, n, choices, style, validator, name); + } + + wxSimpleHtmlListBox(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = wxHLB_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxSimpleHtmlListBoxNameStr)) + { + Create(parent, id, pos, size, choices, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = wxHLB_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxSimpleHtmlListBoxNameStr)); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = wxHLB_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxSimpleHtmlListBoxNameStr)); + + virtual ~wxSimpleHtmlListBox(); + + // these must be overloaded otherwise the compiler will complain + // about wxItemContainerImmutable::[G|S]etSelection being pure virtuals... + void SetSelection(int n) wxOVERRIDE + { wxVListBox::SetSelection(n); } + int GetSelection() const wxOVERRIDE + { return wxVListBox::GetSelection(); } + + + // accessing strings + // ----------------- + + virtual unsigned int GetCount() const wxOVERRIDE + { return static_cast<unsigned int>(m_items.GetCount()); } + + virtual wxString GetString(unsigned int n) const wxOVERRIDE; + + // override default unoptimized wxItemContainer::GetStrings() function + wxArrayString GetStrings() const + { return m_items; } + + virtual void SetString(unsigned int n, const wxString& s) wxOVERRIDE; + + // resolve ambiguity between wxItemContainer and wxVListBox versions + void Clear() wxOVERRIDE; + +protected: + virtual int DoInsertItems(const wxArrayStringsAdapter & items, + unsigned int pos, + void **clientData, wxClientDataType type) wxOVERRIDE; + + virtual void DoSetItemClientData(unsigned int n, void *clientData) wxOVERRIDE + { m_HTMLclientData[n] = clientData; } + + virtual void *DoGetItemClientData(unsigned int n) const wxOVERRIDE + { return m_HTMLclientData[n]; } + + // wxItemContainer methods + virtual void DoClear() wxOVERRIDE; + virtual void DoDeleteOneItem(unsigned int n) wxOVERRIDE; + + // calls wxHtmlListBox::SetItemCount() and RefreshAll() + void UpdateCount(); + + // override these functions just to change their visibility: users of + // wxSimpleHtmlListBox shouldn't be allowed to call them directly! + virtual void SetItemCount(size_t count) wxOVERRIDE + { wxHtmlListBox::SetItemCount(count); } + virtual void SetRowCount(size_t count) + { wxHtmlListBox::SetRowCount(count); } + + virtual wxString OnGetItem(size_t n) const wxOVERRIDE + { return m_items[n]; } + + virtual void InitEvent(wxCommandEvent& event, int n) wxOVERRIDE + { + // we're not a virtual control and we can include the string + // of the item which was clicked: + event.SetString(m_items[n]); + wxVListBox::InitEvent(event, n); + } + + wxArrayString m_items; + wxArrayPtrVoid m_HTMLclientData; + + // Note: For the benefit of old compilers (like gcc-2.8) this should + // not be named m_clientdata as that clashes with the name of an + // anonymous struct member in wxEvtHandler, which we derive from. + + wxDECLARE_NO_COPY_CLASS(wxSimpleHtmlListBox); +}; + +#endif // wxUSE_HTML + +#endif // _WX_HTMLLBOX_H_ + diff --git a/lib/wxWidgets/include/wx/hyperlink.h b/lib/wxWidgets/include/wx/hyperlink.h new file mode 100644 index 0000000..d635f03 --- /dev/null +++ b/lib/wxWidgets/include/wx/hyperlink.h @@ -0,0 +1,176 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/hyperlink.h +// Purpose: Hyperlink control +// Author: David Norris <danorris@gmail.com>, Otto Wyss +// Modified by: Ryan Norton, Francesco Montorsi +// Created: 04/02/2005 +// Copyright: (c) 2005 David Norris +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HYPERLINK_H_ +#define _WX_HYPERLINK_H_ + +#include "wx/defs.h" + +#if wxUSE_HYPERLINKCTRL + +#include "wx/control.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +#define wxHL_CONTEXTMENU 0x0001 +#define wxHL_ALIGN_LEFT 0x0002 +#define wxHL_ALIGN_RIGHT 0x0004 +#define wxHL_ALIGN_CENTRE 0x0008 +#define wxHL_DEFAULT_STYLE (wxHL_CONTEXTMENU|wxNO_BORDER|wxHL_ALIGN_CENTRE) + +extern WXDLLIMPEXP_DATA_CORE(const char) wxHyperlinkCtrlNameStr[]; + + +// ---------------------------------------------------------------------------- +// wxHyperlinkCtrl +// ---------------------------------------------------------------------------- + +// A static text control that emulates a hyperlink. The link is displayed +// in an appropriate text style, derived from the control's normal font. +// When the mouse rolls over the link, the cursor changes to a hand and the +// link's color changes to the active color. +// +// Clicking on the link does not launch a web browser; instead, a +// HyperlinkEvent is fired. The event propagates upward until it is caught, +// just like a wxCommandEvent. +// +// Use the EVT_HYPERLINK() to catch link events. +class WXDLLIMPEXP_CORE wxHyperlinkCtrlBase : public wxControl +{ +public: + + // get/set + virtual wxColour GetHoverColour() const = 0; + virtual void SetHoverColour(const wxColour &colour) = 0; + + virtual wxColour GetNormalColour() const = 0; + virtual void SetNormalColour(const wxColour &colour) = 0; + + virtual wxColour GetVisitedColour() const = 0; + virtual void SetVisitedColour(const wxColour &colour) = 0; + + virtual wxString GetURL() const = 0; + virtual void SetURL (const wxString &url) = 0; + + virtual void SetVisited(bool visited = true) = 0; + virtual bool GetVisited() const = 0; + + // NOTE: also wxWindow::Set/GetLabel, wxWindow::Set/GetBackgroundColour, + // wxWindow::Get/SetFont, wxWindow::Get/SetCursor are important ! + + virtual bool HasTransparentBackground() wxOVERRIDE { return true; } + +protected: + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + + // checks for validity some of the ctor/Create() function parameters + void CheckParams(const wxString& label, const wxString& url, long style); + +public: + // Send wxHyperlinkEvent and open our link in the default browser if it + // wasn't handled. + // + // not part of the public API but needs to be public as used by + // GTK+ callbacks: + void SendEvent(); +}; + +// ---------------------------------------------------------------------------- +// wxHyperlinkEvent +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxHyperlinkEvent; + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HYPERLINK, wxHyperlinkEvent ); + +// +// An event fired when the user clicks on the label in a hyperlink control. +// See HyperlinkControl for details. +// +class WXDLLIMPEXP_CORE wxHyperlinkEvent : public wxCommandEvent +{ +public: + wxHyperlinkEvent() {} + wxHyperlinkEvent(wxObject *generator, wxWindowID id, const wxString& url) + : wxCommandEvent(wxEVT_HYPERLINK, id), + m_url(url) + { + SetEventObject(generator); + } + + // Returns the URL associated with the hyperlink control + // that the user clicked on. + wxString GetURL() const { return m_url; } + void SetURL(const wxString &url) { m_url=url; } + + // default copy ctor, assignment operator and dtor are ok + virtual wxEvent *Clone() const wxOVERRIDE { return new wxHyperlinkEvent(*this); } + +private: + + // URL associated with the hyperlink control that the used clicked on. + wxString m_url; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxHyperlinkEvent); +}; + + +// ---------------------------------------------------------------------------- +// event types and macros +// ---------------------------------------------------------------------------- + +typedef void (wxEvtHandler::*wxHyperlinkEventFunction)(wxHyperlinkEvent&); + +#define wxHyperlinkEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxHyperlinkEventFunction, func) + +#define EVT_HYPERLINK(id, fn) \ + wx__DECLARE_EVT1(wxEVT_HYPERLINK, id, wxHyperlinkEventHandler(fn)) + + +#if defined(__WXGTK210__) && !defined(__WXUNIVERSAL__) + #include "wx/gtk/hyperlink.h" +// Note that the native control is only available in Unicode version under MSW. +#elif defined(__WXMSW__) && wxUSE_UNICODE && !defined(__WXUNIVERSAL__) + #include "wx/msw/hyperlink.h" +#else + #include "wx/generic/hyperlink.h" + + class WXDLLIMPEXP_CORE wxHyperlinkCtrl : public wxGenericHyperlinkCtrl + { + public: + wxHyperlinkCtrl() { } + + wxHyperlinkCtrl(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxString& url, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxHL_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxHyperlinkCtrlNameStr)) + : wxGenericHyperlinkCtrl(parent, id, label, url, pos, size, + style, name) + { + } + + private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY( wxHyperlinkCtrl ); + }; +#endif + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_HYPERLINK wxEVT_HYPERLINK + +#endif // wxUSE_HYPERLINKCTRL + +#endif // _WX_HYPERLINK_H_ diff --git a/lib/wxWidgets/include/wx/icon.h b/lib/wxWidgets/include/wx/icon.h new file mode 100644 index 0000000..27dc369 --- /dev/null +++ b/lib/wxWidgets/include/wx/icon.h @@ -0,0 +1,78 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/icon.h +// Purpose: wxIcon base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ICON_H_BASE_ +#define _WX_ICON_H_BASE_ + +#include "wx/iconloc.h" + + +// a more readable way to tell +#define wxICON_SCREEN_DEPTH (-1) + + +// the wxICON_DEFAULT_TYPE (the wxIcon equivalent of wxBITMAP_DEFAULT_TYPE) +// constant defines the default argument value for wxIcon ctor and wxIcon::LoadFile() +// functions. + +#if defined(__WXMSW__) + #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_ICO_RESOURCE + #include "wx/msw/icon.h" + + #define wxICON_DIFFERENT_FROM_BITMAP +#elif defined(__WXMOTIF__) + #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_XPM + #include "wx/motif/icon.h" +#elif defined(__WXGTK20__) + #ifdef __WINDOWS__ + #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_ICO_RESOURCE + #else + #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_XPM + #endif + #include "wx/generic/icon.h" +#elif defined(__WXGTK__) + #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_XPM + #include "wx/generic/icon.h" +#elif defined(__WXX11__) + #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_XPM + #include "wx/generic/icon.h" +#elif defined(__WXDFB__) + #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_XPM + #include "wx/generic/icon.h" +#elif defined(__WXMAC__) +#if wxOSX_USE_COCOA_OR_CARBON + #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_ICON_RESOURCE + #include "wx/generic/icon.h" +#else + // iOS and others + #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_PNG_RESOURCE + #include "wx/generic/icon.h" +#endif +#elif defined(__WXQT__) + #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_XPM + #include "wx/generic/icon.h" +#endif + +#ifndef wxICON_DIFFERENT_FROM_BITMAP + #define wxICON_IS_BITMAP +#endif + +//----------------------------------------------------------------------------- +// wxVariant support +//----------------------------------------------------------------------------- + +#if wxUSE_VARIANT +#include "wx/variant.h" +DECLARE_VARIANT_OBJECT_EXPORTED(wxIcon,WXDLLIMPEXP_CORE) +#endif + + +#endif + // _WX_ICON_H_BASE_ diff --git a/lib/wxWidgets/include/wx/iconbndl.h b/lib/wxWidgets/include/wx/iconbndl.h new file mode 100644 index 0000000..8db2046 --- /dev/null +++ b/lib/wxWidgets/include/wx/iconbndl.h @@ -0,0 +1,140 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/iconbndl.h +// Purpose: wxIconBundle +// Author: Mattia barbon +// Modified by: +// Created: 23.03.02 +// Copyright: (c) Mattia Barbon +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ICONBNDL_H_ +#define _WX_ICONBNDL_H_ + +#include "wx/gdiobj.h" +#include "wx/gdicmn.h" // for wxSize +#include "wx/icon.h" + +#include "wx/dynarray.h" + +class WXDLLIMPEXP_FWD_BASE wxInputStream; + +WX_DECLARE_EXPORTED_OBJARRAY(wxIcon, wxIconArray); + +// Load icons of multiple sizes from files or resources (MSW-only). +class WXDLLIMPEXP_CORE wxIconBundle : public wxGDIObject +{ +public: + // Flags that determine what happens if GetIcon() doesn't find the icon of + // exactly the requested size. + enum + { + // Return invalid icon if exact size is not found. + FALLBACK_NONE = 0, + + // Return the icon of the system icon size if exact size is not found. + // May be combined with other non-NONE enum elements to determine what + // happens if the system icon size is not found either. + FALLBACK_SYSTEM = 1, + + // Return the icon of closest larger size or, if there is no icon of + // larger size in the bundle, the closest icon of smaller size. + FALLBACK_NEAREST_LARGER = 2 + }; + + // default constructor + wxIconBundle(); + + // initializes the bundle with the icon(s) found in the file +#if wxUSE_STREAMS && wxUSE_IMAGE +#if wxUSE_FFILE || wxUSE_FILE + wxIconBundle(const wxString& file, wxBitmapType type = wxBITMAP_TYPE_ANY); +#endif // wxUSE_FFILE || wxUSE_FILE + wxIconBundle(wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY); +#endif // wxUSE_STREAMS && wxUSE_IMAGE + + // initializes the bundle with a single icon + wxIconBundle(const wxIcon& icon); + +#if defined(__WINDOWS__) && wxUSE_ICO_CUR + // initializes the bundle with the icons from a group icon stored as an MS Windows resource + wxIconBundle(const wxString& resourceName, WXHINSTANCE module); +#endif + + // default copy ctor and assignment operator are OK + + // adds all the icons contained in the file to the collection, + // if the collection already contains icons with the same + // width and height, they are replaced +#if wxUSE_STREAMS && wxUSE_IMAGE +#if wxUSE_FFILE || wxUSE_FILE + void AddIcon(const wxString& file, wxBitmapType type = wxBITMAP_TYPE_ANY); +#endif // wxUSE_FFILE || wxUSE_FILE + void AddIcon(wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY); +#endif // wxUSE_STREAMS && wxUSE_IMAGE + +#if defined(__WINDOWS__) && wxUSE_ICO_CUR + // loads all the icons from a group icon stored in an MS Windows resource + void AddIcon(const wxString& resourceName, WXHINSTANCE module); +#endif + + // adds the icon to the collection, if the collection already + // contains an icon with the same width and height, it is + // replaced + void AddIcon(const wxIcon& icon); + + // returns the icon with the given size; if no such icon exists, + // behavior is specified by the flags. + wxIcon GetIcon(const wxSize& size, int flags = FALLBACK_SYSTEM) const; + + // equivalent to GetIcon(wxSize(size, size)) + wxIcon GetIcon(wxCoord size = wxDefaultCoord, + int flags = FALLBACK_SYSTEM) const + { return GetIcon(wxSize(size, size), flags); } + + // returns the icon exactly of the specified size or wxNullIcon if no icon + // of exactly given size are available + wxIcon GetIconOfExactSize(const wxSize& size) const; + wxIcon GetIconOfExactSize(wxCoord size) const + { return GetIconOfExactSize(wxSize(size, size)); } + + // enumerate all icons in the bundle: don't use these functions if ti can + // be avoided, using GetIcon() directly is better + + // return the number of available icons + size_t GetIconCount() const; + + // return the icon at index (must be < GetIconCount()) + wxIcon GetIconByIndex(size_t n) const; + + // check if we have any icons at all + bool IsEmpty() const { return GetIconCount() == 0; } + +#if WXWIN_COMPATIBILITY_2_8 +#if wxUSE_STREAMS && wxUSE_IMAGE && (wxUSE_FFILE || wxUSE_FILE) + wxDEPRECATED( void AddIcon(const wxString& file, long type) + { + AddIcon(file, (wxBitmapType)type); + } + ) + + wxDEPRECATED_CONSTRUCTOR( wxIconBundle (const wxString& file, long type) + { + AddIcon(file, (wxBitmapType)type); + } + ) +#endif // wxUSE_STREAMS && wxUSE_IMAGE && (wxUSE_FFILE || wxUSE_FILE) +#endif // WXWIN_COMPATIBILITY_2_8 + +protected: + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + +private: + // delete all icons + void DeleteIcons(); + + wxDECLARE_DYNAMIC_CLASS(wxIconBundle); +}; + +#endif // _WX_ICONBNDL_H_ diff --git a/lib/wxWidgets/include/wx/iconloc.h b/lib/wxWidgets/include/wx/iconloc.h new file mode 100644 index 0000000..bce75aa --- /dev/null +++ b/lib/wxWidgets/include/wx/iconloc.h @@ -0,0 +1,80 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/iconloc.h +// Purpose: declaration of wxIconLocation class +// Author: Vadim Zeitlin +// Modified by: +// Created: 21.06.2003 +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ICONLOC_H_ +#define _WX_ICONLOC_H_ + +#include "wx/string.h" + +// ---------------------------------------------------------------------------- +// wxIconLocation: describes the location of an icon +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxIconLocationBase +{ +public: + // ctor takes the name of the file where the icon is + explicit wxIconLocationBase(const wxString& filename = wxEmptyString) + : m_filename(filename) { } + + // default copy ctor, assignment operator and dtor are ok + + + // returns true if this object is valid/initialized + bool IsOk() const { return !m_filename.empty(); } + + // set/get the icon file name + void SetFileName(const wxString& filename) { m_filename = filename; } + const wxString& GetFileName() const { return m_filename; } + +private: + wxString m_filename; +}; + +// under Windows the same file may contain several icons so we also store the +// index of the icon +#if defined(__WINDOWS__) + +class WXDLLIMPEXP_BASE wxIconLocation : public wxIconLocationBase +{ +public: + // ctor takes the name of the file where the icon is and the icons index in + // the file + explicit wxIconLocation(const wxString& file = wxEmptyString, int num = 0); + + // set/get the icon index + void SetIndex(int num) { m_index = num; } + int GetIndex() const { return m_index; } + +private: + int m_index; +}; + +inline +wxIconLocation::wxIconLocation(const wxString& file, int num) + : wxIconLocationBase(file) +{ + SetIndex(num); +} + +#else // !__WINDOWS__ + +// must be a class because we forward declare it as class +class WXDLLIMPEXP_BASE wxIconLocation : public wxIconLocationBase +{ +public: + explicit wxIconLocation(const wxString& filename = wxEmptyString) + : wxIconLocationBase(filename) { } +}; + +#endif // platform + +#endif // _WX_ICONLOC_H_ + diff --git a/lib/wxWidgets/include/wx/imagbmp.h b/lib/wxWidgets/include/wx/imagbmp.h new file mode 100644 index 0000000..3184cf5 --- /dev/null +++ b/lib/wxWidgets/include/wx/imagbmp.h @@ -0,0 +1,156 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/imagbmp.h +// Purpose: wxImage BMP, ICO, CUR and ANI handlers +// Author: Robert Roebling, Chris Elliott +// Copyright: (c) Robert Roebling, Chris Elliott +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGBMP_H_ +#define _WX_IMAGBMP_H_ + +#include "wx/image.h" + +// defines for saving the BMP file in different formats, Bits Per Pixel +// USE: wximage.SetOption( wxIMAGE_OPTION_BMP_FORMAT, wxBMP_xBPP ); +#define wxIMAGE_OPTION_BMP_FORMAT wxString(wxT("wxBMP_FORMAT")) + +// These two options are filled in upon reading CUR file and can (should) be +// specified when saving a CUR file - they define the hotspot of the cursor: +#define wxIMAGE_OPTION_CUR_HOTSPOT_X wxT("HotSpotX") +#define wxIMAGE_OPTION_CUR_HOTSPOT_Y wxT("HotSpotY") + + +enum +{ + wxBMP_24BPP = 24, // default, do not need to set + //wxBMP_16BPP = 16, // wxQuantize can only do 236 colors? + wxBMP_8BPP = 8, // 8bpp, quantized colors + wxBMP_8BPP_GREY = 9, // 8bpp, rgb averaged to greys + wxBMP_8BPP_GRAY = wxBMP_8BPP_GREY, + wxBMP_8BPP_RED = 10, // 8bpp, red used as greyscale + wxBMP_8BPP_PALETTE = 11, // 8bpp, use the wxImage's palette + wxBMP_4BPP = 4, // 4bpp, quantized colors + wxBMP_1BPP = 1, // 1bpp, quantized "colors" + wxBMP_1BPP_BW = 2 // 1bpp, black & white from red +}; + +// ---------------------------------------------------------------------------- +// wxBMPHandler +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBMPHandler : public wxImageHandler +{ +public: + wxBMPHandler() + { + m_name = wxT("Windows bitmap file"); + m_extension = wxT("bmp"); + m_type = wxBITMAP_TYPE_BMP; + m_mime = wxT("image/x-bmp"); + } + +#if wxUSE_STREAMS + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ) wxOVERRIDE; + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ) wxOVERRIDE; + +protected: + virtual bool DoCanRead( wxInputStream& stream ) wxOVERRIDE; + bool SaveDib(wxImage *image, wxOutputStream& stream, bool verbose, + bool IsBmp, bool IsMask); + bool LoadDib(wxImage *image, wxInputStream& stream, bool verbose, bool IsBmp); +#endif // wxUSE_STREAMS + +private: + wxDECLARE_DYNAMIC_CLASS(wxBMPHandler); +}; + +#if wxUSE_ICO_CUR +// ---------------------------------------------------------------------------- +// wxICOHandler +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxICOHandler : public wxBMPHandler +{ +public: + wxICOHandler() + { + m_name = wxT("Windows icon file"); + m_extension = wxT("ico"); + m_type = wxBITMAP_TYPE_ICO; + m_mime = wxT("image/x-ico"); + } + +#if wxUSE_STREAMS + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ) wxOVERRIDE; + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ) wxOVERRIDE; + virtual bool DoLoadFile( wxImage *image, wxInputStream& stream, bool verbose, int index ); + +protected: + virtual int DoGetImageCount( wxInputStream& stream ) wxOVERRIDE; + virtual bool DoCanRead( wxInputStream& stream ) wxOVERRIDE; +#endif // wxUSE_STREAMS + +private: + wxDECLARE_DYNAMIC_CLASS(wxICOHandler); +}; + + +// ---------------------------------------------------------------------------- +// wxCURHandler +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxCURHandler : public wxICOHandler +{ +public: + wxCURHandler() + { + m_name = wxT("Windows cursor file"); + m_extension = wxT("cur"); + m_type = wxBITMAP_TYPE_CUR; + m_mime = wxT("image/x-cur"); + } + + // VS: This handler's meat is implemented inside wxICOHandler (the two + // formats are almost identical), but we hide this fact at + // the API level, since it is a mere implementation detail. + +protected: +#if wxUSE_STREAMS + virtual bool DoCanRead( wxInputStream& stream ) wxOVERRIDE; +#endif // wxUSE_STREAMS + +private: + wxDECLARE_DYNAMIC_CLASS(wxCURHandler); +}; +// ---------------------------------------------------------------------------- +// wxANIHandler +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxANIHandler : public wxCURHandler +{ +public: + wxANIHandler() + { + m_name = wxT("Windows animated cursor file"); + m_extension = wxT("ani"); + m_type = wxBITMAP_TYPE_ANI; + m_mime = wxT("image/x-ani"); + } + + +#if wxUSE_STREAMS + virtual bool SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream), bool WXUNUSED(verbose=true) ) wxOVERRIDE{return false ;} + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ) wxOVERRIDE; + +protected: + virtual int DoGetImageCount( wxInputStream& stream ) wxOVERRIDE; + virtual bool DoCanRead( wxInputStream& stream ) wxOVERRIDE; +#endif // wxUSE_STREAMS + +private: + wxDECLARE_DYNAMIC_CLASS(wxANIHandler); +}; + +#endif // wxUSE_ICO_CUR +#endif // _WX_IMAGBMP_H_ diff --git a/lib/wxWidgets/include/wx/image.h b/lib/wxWidgets/include/wx/image.h new file mode 100644 index 0000000..35fd263 --- /dev/null +++ b/lib/wxWidgets/include/wx/image.h @@ -0,0 +1,736 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/image.h +// Purpose: wxImage class +// Author: Robert Roebling +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGE_H_ +#define _WX_IMAGE_H_ + +#include "wx/defs.h" + +#if wxUSE_IMAGE + +#include "wx/object.h" +#include "wx/string.h" +#include "wx/gdicmn.h" +#include "wx/hashmap.h" +#include "wx/arrstr.h" + +#if wxUSE_STREAMS +# include "wx/stream.h" +#endif + +// on some systems (Unixware 7.x) index is defined as a macro in the headers +// which breaks the compilation below +#undef index + +#define wxIMAGE_OPTION_QUALITY wxString(wxS("quality")) +#define wxIMAGE_OPTION_FILENAME wxString(wxS("FileName")) + +#define wxIMAGE_OPTION_RESOLUTION wxString(wxS("Resolution")) +#define wxIMAGE_OPTION_RESOLUTIONX wxString(wxS("ResolutionX")) +#define wxIMAGE_OPTION_RESOLUTIONY wxString(wxS("ResolutionY")) + +#define wxIMAGE_OPTION_RESOLUTIONUNIT wxString(wxS("ResolutionUnit")) + +#define wxIMAGE_OPTION_MAX_WIDTH wxString(wxS("MaxWidth")) +#define wxIMAGE_OPTION_MAX_HEIGHT wxString(wxS("MaxHeight")) + +#define wxIMAGE_OPTION_ORIGINAL_WIDTH wxString(wxS("OriginalWidth")) +#define wxIMAGE_OPTION_ORIGINAL_HEIGHT wxString(wxS("OriginalHeight")) + +// constants used with wxIMAGE_OPTION_RESOLUTIONUNIT +// +// NB: don't change these values, they correspond to libjpeg constants +enum wxImageResolution +{ + // Resolution not specified + wxIMAGE_RESOLUTION_NONE = 0, + + // Resolution specified in inches + wxIMAGE_RESOLUTION_INCHES = 1, + + // Resolution specified in centimeters + wxIMAGE_RESOLUTION_CM = 2 +}; + +// Constants for wxImage::Scale() for determining the level of quality +enum wxImageResizeQuality +{ + // different image resizing algorithms used by Scale() and Rescale() + wxIMAGE_QUALITY_NEAREST = 0, + wxIMAGE_QUALITY_BILINEAR = 1, + wxIMAGE_QUALITY_BICUBIC = 2, + wxIMAGE_QUALITY_BOX_AVERAGE = 3, + + // default quality is low (but fast) + wxIMAGE_QUALITY_NORMAL = wxIMAGE_QUALITY_NEAREST, + + // highest (but best) quality + wxIMAGE_QUALITY_HIGH = 4 +}; + +// Constants for wxImage::Paste() for specifying alpha blending option. +enum wxImageAlphaBlendMode +{ + // Overwrite the original alpha values with the ones being pasted. + wxIMAGE_ALPHA_BLEND_OVER = 0, + + // Compose the original alpha values with the ones being pasted. + wxIMAGE_ALPHA_BLEND_COMPOSE = 1 +}; + +// alpha channel values: fully transparent, default threshold separating +// transparent pixels from opaque for a few functions dealing with alpha and +// fully opaque +const unsigned char wxIMAGE_ALPHA_TRANSPARENT = 0; +const unsigned char wxIMAGE_ALPHA_THRESHOLD = 0x80; +const unsigned char wxIMAGE_ALPHA_OPAQUE = 0xff; + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxImageHandler; +class WXDLLIMPEXP_FWD_CORE wxImage; +class WXDLLIMPEXP_FWD_CORE wxPalette; + +//----------------------------------------------------------------------------- +// wxVariant support +//----------------------------------------------------------------------------- + +#if wxUSE_VARIANT +#include "wx/variant.h" +DECLARE_VARIANT_OBJECT_EXPORTED(wxImage,WXDLLIMPEXP_CORE) +#endif + +//----------------------------------------------------------------------------- +// wxImageHandler +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxImageHandler: public wxObject +{ +public: + wxImageHandler() + : m_name(wxEmptyString), m_extension(wxEmptyString), m_mime(), m_type(wxBITMAP_TYPE_INVALID) + { } + +#if wxUSE_STREAMS + // NOTE: LoadFile and SaveFile are not pure virtuals to allow derived classes + // to implement only one of the two + virtual bool LoadFile( wxImage *WXUNUSED(image), wxInputStream& WXUNUSED(stream), + bool WXUNUSED(verbose)=true, int WXUNUSED(index)=-1 ) + { return false; } + virtual bool SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream), + bool WXUNUSED(verbose)=true ) + { return false; } + + int GetImageCount( wxInputStream& stream ); + // save the stream position, call DoGetImageCount() and restore the position + + bool CanRead( wxInputStream& stream ) { return CallDoCanRead(stream); } + bool CanRead( const wxString& name ); +#endif // wxUSE_STREAMS + + void SetName(const wxString& name) { m_name = name; } + void SetExtension(const wxString& ext) { m_extension = ext; } + void SetAltExtensions(const wxArrayString& exts) { m_altExtensions = exts; } + void SetType(wxBitmapType type) { m_type = type; } + void SetMimeType(const wxString& type) { m_mime = type; } + const wxString& GetName() const { return m_name; } + const wxString& GetExtension() const { return m_extension; } + const wxArrayString& GetAltExtensions() const { return m_altExtensions; } + wxBitmapType GetType() const { return m_type; } + const wxString& GetMimeType() const { return m_mime; } + +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED( + void SetType(long type) { SetType((wxBitmapType)type); } + ) +#endif // WXWIN_COMPATIBILITY_2_8 + +protected: +#if wxUSE_STREAMS + // NOTE: this function is allowed to change the current stream position + // since GetImageCount() will take care of restoring it later + virtual int DoGetImageCount( wxInputStream& WXUNUSED(stream) ) + { return 1; } // default return value is 1 image + + // NOTE: this function is allowed to change the current stream position + // since CallDoCanRead() will take care of restoring it later + virtual bool DoCanRead( wxInputStream& stream ) = 0; + + // save the stream position, call DoCanRead() and restore the position + bool CallDoCanRead(wxInputStream& stream); +#endif // wxUSE_STREAMS + + // helper for the derived classes SaveFile() implementations: returns the + // values of x- and y-resolution options specified as the image options if + // any + static wxImageResolution + GetResolutionFromOptions(const wxImage& image, int *x, int *y); + + + wxString m_name; + wxString m_extension; + wxArrayString m_altExtensions; + wxString m_mime; + wxBitmapType m_type; + +private: + wxDECLARE_CLASS(wxImageHandler); +}; + +//----------------------------------------------------------------------------- +// wxImageHistogram +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxImageHistogramEntry +{ +public: + wxImageHistogramEntry() { index = value = 0; } + unsigned long index; + unsigned long value; +}; + +WX_DECLARE_EXPORTED_HASH_MAP(unsigned long, wxImageHistogramEntry, + wxIntegerHash, wxIntegerEqual, + wxImageHistogramBase); + +class wxImageHistogram : public wxImageHistogramBase +{ +public: + wxImageHistogram() : wxImageHistogramBase(256) { } + + // get the key in the histogram for the given RGB values + static unsigned long MakeKey(unsigned char r, + unsigned char g, + unsigned char b) + { + return ((unsigned)r << 16) | ((unsigned)g << 8) | (unsigned)b; + } + + // find first colour that is not used in the image and has higher + // RGB values than RGB(startR, startG, startB) + // + // returns true and puts this colour in r, g, b (each of which may be NULL) + // on success or returns false if there are no more free colours + bool FindFirstUnusedColour(unsigned char *r, + unsigned char *g, + unsigned char *b, + unsigned char r2 = 1, + unsigned char g2 = 0, + unsigned char b2 = 0 ) const + { + unsigned long key = MakeKey(r2, g2, b2); + + while ( find(key) != end() ) + { + // color already used + r2++; + if ( r2 >= 255 ) + { + r2 = 0; + g2++; + if ( g2 >= 255 ) + { + g2 = 0; + b2++; + if ( b2 >= 255 ) + { + return false; + } + } + } + + key = MakeKey(r2, g2, b2); + } + + if ( r ) + *r = r2; + if ( g ) + *g = g2; + if ( b ) + *b = b2; + + return true; + } +}; + +//----------------------------------------------------------------------------- +// wxImage +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxImage: public wxObject +{ +public: + // red, green and blue are 8 bit unsigned integers in the range of 0..255 + // We use the identifier RGBValue instead of RGB, since RGB is #defined + class RGBValue + { + public: + RGBValue(unsigned char r=0, unsigned char g=0, unsigned char b=0) + : red(r), green(g), blue(b) {} + unsigned char red; + unsigned char green; + unsigned char blue; + }; + + // hue, saturation and value are doubles in the range 0.0..1.0 + class HSVValue + { + public: + HSVValue(double h=0.0, double s=0.0, double v=0.0) + : hue(h), saturation(s), value(v) {} + double hue; + double saturation; + double value; + }; + + wxImage() {} + wxImage( int width, int height, bool clear = true ) + { Create( width, height, clear ); } + wxImage( int width, int height, unsigned char* data, bool static_data = false ) + { Create( width, height, data, static_data ); } + wxImage( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data = false ) + { Create( width, height, data, alpha, static_data ); } + + // ctor variants using wxSize: + wxImage( const wxSize& sz, bool clear = true ) + { Create( sz, clear ); } + wxImage( const wxSize& sz, unsigned char* data, bool static_data = false ) + { Create( sz, data, static_data ); } + wxImage( const wxSize& sz, unsigned char* data, unsigned char* alpha, bool static_data = false ) + { Create( sz, data, alpha, static_data ); } + + wxImage( const wxString& name, wxBitmapType type = wxBITMAP_TYPE_ANY, int index = -1 ) + { LoadFile( name, type, index ); } + wxImage( const wxString& name, const wxString& mimetype, int index = -1 ) + { LoadFile( name, mimetype, index ); } + explicit wxImage( const char* const* xpmData ) + { Create(xpmData); } + +#if wxUSE_STREAMS + wxImage( wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY, int index = -1 ) + { LoadFile( stream, type, index ); } + wxImage( wxInputStream& stream, const wxString& mimetype, int index = -1 ) + { LoadFile( stream, mimetype, index ); } +#endif // wxUSE_STREAMS + + bool Create( const char* const* xpmData ); + + bool Create( int width, int height, bool clear = true ); + bool Create( int width, int height, unsigned char* data, bool static_data = false ); + bool Create( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data = false ); + + // Create() variants using wxSize: + bool Create( const wxSize& sz, bool clear = true ) + { return Create(sz.GetWidth(), sz.GetHeight(), clear); } + bool Create( const wxSize& sz, unsigned char* data, bool static_data = false ) + { return Create(sz.GetWidth(), sz.GetHeight(), data, static_data); } + bool Create( const wxSize& sz, unsigned char* data, unsigned char* alpha, bool static_data = false ) + { return Create(sz.GetWidth(), sz.GetHeight(), data, alpha, static_data); } + + void Destroy(); + + // initialize the image data with zeroes + void Clear(unsigned char value = 0); + + // creates an identical copy of the image (the = operator + // just raises the ref count) + wxImage Copy() const; + + // return the new image with size width*height + wxImage GetSubImage( const wxRect& rect) const; + + // Paste the image or part of this image into an image of the given size at the pos + // any newly exposed areas will be filled with the rgb colour + // by default if r = g = b = -1 then fill with this image's mask colour or find and + // set a suitable mask colour + wxImage Size( const wxSize& size, const wxPoint& pos, + int r = -1, int g = -1, int b = -1 ) const; + + // Copy the data of the given image to the specified position of this one + // taking care of the out of bounds problems. Mask is respected, but alpha + // is simply replaced by default, use wxIMAGE_ALPHA_BLEND_COMPOSE to + // combine it with the original image alpha values if needed. + void Paste(const wxImage& image, int x, int y, + wxImageAlphaBlendMode alphaBlend = wxIMAGE_ALPHA_BLEND_OVER); + + // return the new image with size width*height + wxImage Scale( int width, int height, + wxImageResizeQuality quality = wxIMAGE_QUALITY_NORMAL ) const; + + // box averager and bicubic filters for up/down sampling + wxImage ResampleNearest(int width, int height) const; + wxImage ResampleBox(int width, int height) const; + wxImage ResampleBilinear(int width, int height) const; + wxImage ResampleBicubic(int width, int height) const; + + // blur the image according to the specified pixel radius + wxImage Blur(int radius) const; + wxImage BlurHorizontal(int radius) const; + wxImage BlurVertical(int radius) const; + + wxImage ShrinkBy( int xFactor , int yFactor ) const ; + + // rescales the image in place + wxImage& Rescale( int width, int height, + wxImageResizeQuality quality = wxIMAGE_QUALITY_NORMAL ) + { return *this = Scale(width, height, quality); } + + // resizes the image in place + wxImage& Resize( const wxSize& size, const wxPoint& pos, + int r = -1, int g = -1, int b = -1 ) { return *this = Size(size, pos, r, g, b); } + + // Rotates the image about the given point, 'angle' radians. + // Returns the rotated image, leaving this image intact. + wxImage Rotate(double angle, const wxPoint & centre_of_rotation, + bool interpolating = true, wxPoint * offset_after_rotation = NULL) const; + + wxImage Rotate90( bool clockwise = true ) const; + wxImage Rotate180() const; + wxImage Mirror( bool horizontally = true ) const; + + // replace one colour with another + void Replace( unsigned char r1, unsigned char g1, unsigned char b1, + unsigned char r2, unsigned char g2, unsigned char b2 ); + + // Convert to greyscale image. Uses the luminance component (Y) of the image. + // The luma value (YUV) is calculated using (R * weight_r) + (G * weight_g) + (B * weight_b), defaults to ITU-T BT.601 + wxImage ConvertToGreyscale(double weight_r, double weight_g, double weight_b) const; + wxImage ConvertToGreyscale() const; + + // convert to monochrome image (<r,g,b> will be replaced by white, + // everything else by black) + wxImage ConvertToMono( unsigned char r, unsigned char g, unsigned char b ) const; + + // Convert to disabled (dimmed) image. + wxImage ConvertToDisabled(unsigned char brightness = 255) const; + + // Convert the image based on the given lightness. + wxImage ChangeLightness(int alpha) const; + + // these routines are slow but safe + void SetRGB( int x, int y, unsigned char r, unsigned char g, unsigned char b ); + void SetRGB( const wxRect& rect, unsigned char r, unsigned char g, unsigned char b ); + unsigned char GetRed( int x, int y ) const; + unsigned char GetGreen( int x, int y ) const; + unsigned char GetBlue( int x, int y ) const; + + void SetAlpha(int x, int y, unsigned char alpha); + unsigned char GetAlpha(int x, int y) const; + + // find first colour that is not used in the image and has higher + // RGB values than <startR,startG,startB> + bool FindFirstUnusedColour( unsigned char *r, unsigned char *g, unsigned char *b, + unsigned char startR = 1, unsigned char startG = 0, + unsigned char startB = 0 ) const; + // Set image's mask to the area of 'mask' that has <r,g,b> colour + bool SetMaskFromImage(const wxImage & mask, + unsigned char mr, unsigned char mg, unsigned char mb); + + // converts image's alpha channel to mask (choosing mask colour + // automatically or using the specified colour for the mask), if it has + // any, does nothing otherwise: + bool ConvertAlphaToMask(unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD); + bool ConvertAlphaToMask(unsigned char mr, unsigned char mg, unsigned char mb, + unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD); + + + // This method converts an image where the original alpha + // information is only available as a shades of a colour + // (actually shades of grey) typically when you draw anti- + // aliased text into a bitmap. The DC drawinf routines + // draw grey values on the black background although they + // actually mean to draw white with different alpha values. + // This method reverses it, assuming a black (!) background + // and white text (actually only the red channel is read). + // The method will then fill up the whole image with the + // colour given. + bool ConvertColourToAlpha( unsigned char r, unsigned char g, unsigned char b ); + + // Methods for controlling LoadFile() behaviour. Currently they allow to + // specify whether the function should log warnings if there are any + // problems with the image file not completely preventing it from being + // loaded. By default the warnings are logged, but this can be disabled + // either globally or for a particular image object. + enum + { + Load_Verbose = 1 + }; + + static void SetDefaultLoadFlags(int flags); + static int GetDefaultLoadFlags(); + + void SetLoadFlags(int flags); + int GetLoadFlags() const; + + static bool CanRead( const wxString& name ); + static int GetImageCount( const wxString& name, wxBitmapType type = wxBITMAP_TYPE_ANY ); + virtual bool LoadFile( const wxString& name, wxBitmapType type = wxBITMAP_TYPE_ANY, int index = -1 ); + virtual bool LoadFile( const wxString& name, const wxString& mimetype, int index = -1 ); + +#if wxUSE_STREAMS + static bool CanRead( wxInputStream& stream ); + static int GetImageCount( wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY ); + virtual bool LoadFile( wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY, int index = -1 ); + virtual bool LoadFile( wxInputStream& stream, const wxString& mimetype, int index = -1 ); +#endif + + virtual bool SaveFile( const wxString& name ) const; + virtual bool SaveFile( const wxString& name, wxBitmapType type ) const; + virtual bool SaveFile( const wxString& name, const wxString& mimetype ) const; + +#if wxUSE_STREAMS + virtual bool SaveFile( wxOutputStream& stream, wxBitmapType type ) const; + virtual bool SaveFile( wxOutputStream& stream, const wxString& mimetype ) const; +#endif + + bool Ok() const { return IsOk(); } + bool IsOk() const; + int GetWidth() const; + int GetHeight() const; + + wxSize GetSize() const + { return wxSize(GetWidth(), GetHeight()); } + + // Gets the type of image found by LoadFile or specified with SaveFile + wxBitmapType GetType() const; + + // Set the image type, this is normally only called if the image is being + // created from data in the given format but not using LoadFile() (e.g. + // wxGIFDecoder uses this) + void SetType(wxBitmapType type); + + // these functions provide fastest access to wxImage data but should be + // used carefully as no checks are done + unsigned char *GetData() const; + void SetData( unsigned char *data, bool static_data=false ); + void SetData( unsigned char *data, int new_width, int new_height, bool static_data=false ); + + unsigned char *GetAlpha() const; // may return NULL! + bool HasAlpha() const { return GetAlpha() != NULL; } + void SetAlpha(unsigned char *alpha = NULL, bool static_data=false); + void InitAlpha(); + void ClearAlpha(); + + // return true if this pixel is masked or has alpha less than specified + // threshold + bool IsTransparent(int x, int y, + unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD) const; + + // Mask functions + void SetMaskColour( unsigned char r, unsigned char g, unsigned char b ); + // Get the current mask colour or find a suitable colour + // returns true if using current mask colour + bool GetOrFindMaskColour( unsigned char *r, unsigned char *g, unsigned char *b ) const; + unsigned char GetMaskRed() const; + unsigned char GetMaskGreen() const; + unsigned char GetMaskBlue() const; + void SetMask( bool mask = true ); + bool HasMask() const; + +#if wxUSE_PALETTE + // Palette functions + bool HasPalette() const; + const wxPalette& GetPalette() const; + void SetPalette(const wxPalette& palette); +#endif // wxUSE_PALETTE + + // Option functions (arbitrary name/value mapping) + void SetOption(const wxString& name, const wxString& value); + void SetOption(const wxString& name, int value); + wxString GetOption(const wxString& name) const; + int GetOptionInt(const wxString& name) const; + bool HasOption(const wxString& name) const; + + unsigned long CountColours( unsigned long stopafter = (unsigned long) -1 ) const; + + // Computes the histogram of the image and fills a hash table, indexed + // with integer keys built as 0xRRGGBB, containing wxImageHistogramEntry + // objects. Each of them contains an 'index' (useful to build a palette + // with the image colours) and a 'value', which is the number of pixels + // in the image with that colour. + // Returned value: # of entries in the histogram + unsigned long ComputeHistogram( wxImageHistogram &h ) const; + + // Rotates the hue of each pixel in the image by angle, which is a double in + // the range [-1.0..+1.0], where -1.0 corresponds to -360 degrees and +1.0 + // corresponds to +360 degrees. + void RotateHue(double angle); + + // Changes the saturation of each pixel in the image. factor is a double in + // the range [-1.0..+1.0], where -1.0 corresponds to -100 percent and +1.0 + // corresponds to +100 percent. + void ChangeSaturation(double factor); + + // Changes the brightness (value) of each pixel in the image. factor is a + // double in the range [-1.0..+1.0], where -1.0 corresponds to -100 percent + // and +1.0 corresponds to +100 percent. + void ChangeBrightness(double factor); + + // Changes the hue, the saturation and the brightness (value) of each pixel + // in the image. angleH is a double in the range [-1.0..+1.0], where -1.0 + // corresponds to -360 degrees and +1.0 corresponds to +360 degrees, factorS + // is a double in the range [-1.0..+1.0], where -1.0 corresponds to -100 + // percent and +1.0 corresponds to +100 percent and factorV is a double in + // the range [-1.0..+1.0], where -1.0 corresponds to -100 percent and +1.0 + // corresponds to +100 percent. + void ChangeHSV(double angleH, double factorS, double factorV); + + static wxList& GetHandlers() { return sm_handlers; } + static void AddHandler( wxImageHandler *handler ); + static void InsertHandler( wxImageHandler *handler ); + static bool RemoveHandler( const wxString& name ); + static wxImageHandler *FindHandler( const wxString& name ); + static wxImageHandler *FindHandler( const wxString& extension, wxBitmapType imageType ); + static wxImageHandler *FindHandler( wxBitmapType imageType ); + + static wxImageHandler *FindHandlerMime( const wxString& mimetype ); + + static wxString GetImageExtWildcard(); + + static void CleanUpHandlers(); + static void InitStandardHandlers(); + + static HSVValue RGBtoHSV(const RGBValue& rgb); + static RGBValue HSVtoRGB(const HSVValue& hsv); + +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED_CONSTRUCTOR( + wxImage(const wxString& name, long type, int index = -1) + { + LoadFile(name, (wxBitmapType)type, index); + } + ) + +#if wxUSE_STREAMS + wxDEPRECATED_CONSTRUCTOR( + wxImage(wxInputStream& stream, long type, int index = -1) + { + LoadFile(stream, (wxBitmapType)type, index); + } + ) + + wxDEPRECATED( + bool LoadFile(wxInputStream& stream, long type, int index = -1) + { + return LoadFile(stream, (wxBitmapType)type, index); + } + ) + + wxDEPRECATED( + bool SaveFile(wxOutputStream& stream, long type) const + { + return SaveFile(stream, (wxBitmapType)type); + } + ) +#endif // wxUSE_STREAMS + + wxDEPRECATED( + bool LoadFile(const wxString& name, long type, int index = -1) + { + return LoadFile(name, (wxBitmapType)type, index); + } + ) + + wxDEPRECATED( + bool SaveFile(const wxString& name, long type) const + { + return SaveFile(name, (wxBitmapType)type); + } + ) + + wxDEPRECATED(static + wxImageHandler *FindHandler(const wxString& ext, long type) + { + return FindHandler(ext, (wxBitmapType)type); + } + ) + + wxDEPRECATED(static + wxImageHandler *FindHandler(long imageType) + { + return FindHandler((wxBitmapType)imageType); + } + ) +#endif // WXWIN_COMPATIBILITY_2_8 + +protected: + static wxList sm_handlers; + + // return the index of the point with the given coordinates or -1 if the + // image is invalid of the coordinates are out of range + // + // note that index must be multiplied by 3 when using it with RGB array + long XYToIndex(int x, int y) const; + + virtual wxObjectRefData* CreateRefData() const wxOVERRIDE; + virtual wxObjectRefData* CloneRefData(const wxObjectRefData* data) const wxOVERRIDE; + + // Helper function used internally by wxImage class only. + template <typename T> + void ApplyToAllPixels(void (*filter)(wxImage *, unsigned char *, T), T value); + +private: + friend class WXDLLIMPEXP_FWD_CORE wxImageHandler; + + // Possible values for MakeEmptyClone() flags. + enum + { + // Create an image with the same orientation as this one. This is the + // default and only exists for symmetry with SwapOrientation. + Clone_SameOrientation = 0, + + // Create an image with the same height as this image width and the + // same width as this image height. + Clone_SwapOrientation = 1 + }; + + // Returns a new blank image with the same dimensions (or with width and + // height swapped if Clone_SwapOrientation flag is given), alpha, and mask + // as this image itself. This is used by several functions creating + // modified versions of this image. + wxImage MakeEmptyClone(int flags = Clone_SameOrientation) const; + +#if wxUSE_STREAMS + // read the image from the specified stream updating image type if + // successful + bool DoLoad(wxImageHandler& handler, wxInputStream& stream, int index); + + // write the image to the specified stream and also update the image type + // if successful + bool DoSave(wxImageHandler& handler, wxOutputStream& stream) const; +#endif // wxUSE_STREAMS + + wxDECLARE_DYNAMIC_CLASS(wxImage); +}; + + +extern void WXDLLIMPEXP_CORE wxInitAllImageHandlers(); + +extern WXDLLIMPEXP_DATA_CORE(wxImage) wxNullImage; + +//----------------------------------------------------------------------------- +// wxImage handlers +//----------------------------------------------------------------------------- + +#include "wx/imagbmp.h" +#include "wx/imagpng.h" +#include "wx/imaggif.h" +#include "wx/imagpcx.h" +#include "wx/imagjpeg.h" +#include "wx/imagtga.h" +#include "wx/imagtiff.h" +#include "wx/imagpnm.h" +#include "wx/imagxpm.h" +#include "wx/imagiff.h" + +#endif // wxUSE_IMAGE + +#endif + // _WX_IMAGE_H_ diff --git a/lib/wxWidgets/include/wx/imaggif.h b/lib/wxWidgets/include/wx/imaggif.h new file mode 100644 index 0000000..48b07dc --- /dev/null +++ b/lib/wxWidgets/include/wx/imaggif.h @@ -0,0 +1,97 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/imaggif.h +// Purpose: wxImage GIF handler +// Author: Vaclav Slavik, Guillermo Rodriguez Garcia, Gershon Elber, Troels K +// Copyright: (c) 1999-2011 Vaclav Slavik, Guillermo Rodriguez Garcia, Gershon Elber, Troels K +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGGIF_H_ +#define _WX_IMAGGIF_H_ + +#include "wx/image.h" + + +//----------------------------------------------------------------------------- +// wxGIFHandler +//----------------------------------------------------------------------------- + +#if wxUSE_GIF + +#define wxIMAGE_OPTION_GIF_COMMENT wxT("GifComment") + +#define wxIMAGE_OPTION_GIF_TRANSPARENCY wxS("Transparency") +#define wxIMAGE_OPTION_GIF_TRANSPARENCY_HIGHLIGHT wxS("Highlight") +#define wxIMAGE_OPTION_GIF_TRANSPARENCY_UNCHANGED wxS("Unchanged") + +struct wxRGB; +struct GifHashTableType; +class WXDLLIMPEXP_FWD_CORE wxImageArray; // anidecod.h + +class WXDLLIMPEXP_CORE wxGIFHandler : public wxImageHandler +{ +public: + inline wxGIFHandler() + { + m_name = wxT("GIF file"); + m_extension = wxT("gif"); + m_type = wxBITMAP_TYPE_GIF; + m_mime = wxT("image/gif"); + m_hashTable = NULL; + } + +#if wxUSE_STREAMS + virtual bool LoadFile(wxImage *image, wxInputStream& stream, + bool verbose = true, int index = -1) wxOVERRIDE; + virtual bool SaveFile(wxImage *image, wxOutputStream& stream, + bool verbose=true) wxOVERRIDE; + + // Save animated gif + bool SaveAnimation(const wxImageArray& images, wxOutputStream *stream, + bool verbose = true, int delayMilliSecs = 1000); + +protected: + virtual int DoGetImageCount(wxInputStream& stream) wxOVERRIDE; + virtual bool DoCanRead(wxInputStream& stream) wxOVERRIDE; + + bool DoSaveFile(const wxImage&, wxOutputStream *, bool verbose, + bool first, int delayMilliSecs, bool loop, + const wxRGB *pal, int palCount, + int mask_index); +#endif // wxUSE_STREAMS +protected: + + // Declarations for saving + + unsigned long m_crntShiftDWord; /* For bytes decomposition into codes. */ + int m_pixelCount; + struct GifHashTableType *m_hashTable; + wxInt16 + m_EOFCode, /* The EOF LZ code. */ + m_clearCode, /* The CLEAR LZ code. */ + m_runningCode, /* The next code algorithm can generate. */ + m_runningBits, /* The number of bits required to represent RunningCode. */ + m_maxCode1, /* 1 bigger than max. possible code, in RunningBits bits. */ + m_crntCode, /* Current algorithm code. */ + m_crntShiftState; /* Number of bits in CrntShiftDWord. */ + wxUint8 m_LZBuf[256]; /* Compressed input is buffered here. */ + + bool InitHashTable(); + void ClearHashTable(); + void InsertHashTable(unsigned long key, int code); + int ExistsHashTable(unsigned long key); + +#if wxUSE_STREAMS + bool CompressOutput(wxOutputStream *, int code); + bool SetupCompress(wxOutputStream *, int bpp); + bool CompressLine(wxOutputStream *, const wxUint8 *line, int lineLen); +#endif + +private: + wxDECLARE_DYNAMIC_CLASS(wxGIFHandler); +}; + +#endif // wxUSE_GIF + +#endif // _WX_IMAGGIF_H_ + diff --git a/lib/wxWidgets/include/wx/imagiff.h b/lib/wxWidgets/include/wx/imagiff.h new file mode 100644 index 0000000..78c6561 --- /dev/null +++ b/lib/wxWidgets/include/wx/imagiff.h @@ -0,0 +1,43 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/imagiff.h +// Purpose: wxImage handler for Amiga IFF images +// Author: Steffen Gutmann +// Copyright: (c) Steffen Gutmann, 2002 +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGE_IFF_H_ +#define _WX_IMAGE_IFF_H_ + +#include "wx/image.h" + +//----------------------------------------------------------------------------- +// wxIFFHandler +//----------------------------------------------------------------------------- + +#if wxUSE_IMAGE && wxUSE_IFF + +class WXDLLIMPEXP_CORE wxIFFHandler : public wxImageHandler +{ +public: + wxIFFHandler() + { + m_name = wxT("IFF file"); + m_extension = wxT("iff"); + m_type = wxBITMAP_TYPE_IFF; + m_mime = wxT("image/x-iff"); + } + +#if wxUSE_STREAMS + virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1) wxOVERRIDE; + virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true) wxOVERRIDE; +protected: + virtual bool DoCanRead(wxInputStream& stream) wxOVERRIDE; +#endif + + wxDECLARE_DYNAMIC_CLASS(wxIFFHandler); +}; + +#endif // wxUSE_IMAGE && wxUSE_IFF + +#endif // _WX_IMAGE_IFF_H_ diff --git a/lib/wxWidgets/include/wx/imagjpeg.h b/lib/wxWidgets/include/wx/imagjpeg.h new file mode 100644 index 0000000..342aa7e --- /dev/null +++ b/lib/wxWidgets/include/wx/imagjpeg.h @@ -0,0 +1,52 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/imagjpeg.h +// Purpose: wxImage JPEG handler +// Author: Vaclav Slavik +// Copyright: (c) Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGJPEG_H_ +#define _WX_IMAGJPEG_H_ + +#include "wx/defs.h" + +//----------------------------------------------------------------------------- +// wxJPEGHandler +//----------------------------------------------------------------------------- + +#if wxUSE_LIBJPEG + +#include "wx/image.h" +#include "wx/versioninfo.h" + +class WXDLLIMPEXP_CORE wxJPEGHandler: public wxImageHandler +{ +public: + inline wxJPEGHandler() + { + m_name = wxT("JPEG file"); + m_extension = wxT("jpg"); + m_altExtensions.Add(wxT("jpeg")); + m_altExtensions.Add(wxT("jpe")); + m_type = wxBITMAP_TYPE_JPEG; + m_mime = wxT("image/jpeg"); + } + + static wxVersionInfo GetLibraryVersionInfo(); + +#if wxUSE_STREAMS + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ) wxOVERRIDE; + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ) wxOVERRIDE; +protected: + virtual bool DoCanRead( wxInputStream& stream ) wxOVERRIDE; +#endif + +private: + wxDECLARE_DYNAMIC_CLASS(wxJPEGHandler); +}; + +#endif // wxUSE_LIBJPEG + +#endif // _WX_IMAGJPEG_H_ + diff --git a/lib/wxWidgets/include/wx/imaglist.h b/lib/wxWidgets/include/wx/imaglist.h new file mode 100644 index 0000000..5fd6a9f --- /dev/null +++ b/lib/wxWidgets/include/wx/imaglist.h @@ -0,0 +1,51 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/imaglist.h +// Purpose: wxImageList base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGLIST_H_BASE_ +#define _WX_IMAGLIST_H_BASE_ + +#include "wx/defs.h" + +/* + * wxImageList is used for wxListCtrl, wxTreeCtrl. These controls refer to + * images for their items by an index into an image list. + * A wxImageList is capable of creating images with optional masks from + * a variety of sources - a single bitmap plus a colour to indicate the mask, + * two bitmaps, or an icon. + * + * Image lists can also create and draw images used for drag and drop functionality. + * This is not yet implemented in wxImageList. We need to discuss a generic API + * for doing drag and drop. + * See below for candidate functions and an explanation of how they might be + * used. + */ + +// Flag values for Set/GetImageList +enum +{ + wxIMAGE_LIST_NORMAL, // Normal icons + wxIMAGE_LIST_SMALL, // Small icons + wxIMAGE_LIST_STATE // State icons: unimplemented (see WIN32 documentation) +}; + +// Flags for Draw +#define wxIMAGELIST_DRAW_NORMAL 0x0001 +#define wxIMAGELIST_DRAW_TRANSPARENT 0x0002 +#define wxIMAGELIST_DRAW_SELECTED 0x0004 +#define wxIMAGELIST_DRAW_FOCUSED 0x0008 + +#if defined(__WXMSW__) + #include "wx/msw/imaglist.h" + #define wxHAS_NATIVE_IMAGELIST +#else + #include "wx/generic/imaglist.h" +#endif + +#endif // _WX_IMAGLIST_H_BASE_ diff --git a/lib/wxWidgets/include/wx/imagpcx.h b/lib/wxWidgets/include/wx/imagpcx.h new file mode 100644 index 0000000..210bbb3 --- /dev/null +++ b/lib/wxWidgets/include/wx/imagpcx.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/imagpcx.h +// Purpose: wxImage PCX handler +// Author: Guillermo Rodriguez Garcia <guille@iies.es> +// Copyright: (c) 1999 Guillermo Rodriguez Garcia +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGPCX_H_ +#define _WX_IMAGPCX_H_ + +#include "wx/image.h" + + +//----------------------------------------------------------------------------- +// wxPCXHandler +//----------------------------------------------------------------------------- + +#if wxUSE_PCX +class WXDLLIMPEXP_CORE wxPCXHandler : public wxImageHandler +{ +public: + inline wxPCXHandler() + { + m_name = wxT("PCX file"); + m_extension = wxT("pcx"); + m_type = wxBITMAP_TYPE_PCX; + m_mime = wxT("image/pcx"); + } + +#if wxUSE_STREAMS + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ) wxOVERRIDE; + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ) wxOVERRIDE; +protected: + virtual bool DoCanRead( wxInputStream& stream ) wxOVERRIDE; +#endif // wxUSE_STREAMS + +private: + wxDECLARE_DYNAMIC_CLASS(wxPCXHandler); +}; +#endif // wxUSE_PCX + + +#endif + // _WX_IMAGPCX_H_ + diff --git a/lib/wxWidgets/include/wx/imagpng.h b/lib/wxWidgets/include/wx/imagpng.h new file mode 100644 index 0000000..e30cf73 --- /dev/null +++ b/lib/wxWidgets/include/wx/imagpng.h @@ -0,0 +1,68 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/imagpng.h +// Purpose: wxImage PNG handler +// Author: Robert Roebling +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGPNG_H_ +#define _WX_IMAGPNG_H_ + +#include "wx/defs.h" + +//----------------------------------------------------------------------------- +// wxPNGHandler +//----------------------------------------------------------------------------- + +#if wxUSE_LIBPNG + +#include "wx/image.h" +#include "wx/versioninfo.h" + +#define wxIMAGE_OPTION_PNG_FORMAT wxT("PngFormat") +#define wxIMAGE_OPTION_PNG_BITDEPTH wxT("PngBitDepth") +#define wxIMAGE_OPTION_PNG_FILTER wxT("PngF") +#define wxIMAGE_OPTION_PNG_COMPRESSION_LEVEL wxT("PngZL") +#define wxIMAGE_OPTION_PNG_COMPRESSION_MEM_LEVEL wxT("PngZM") +#define wxIMAGE_OPTION_PNG_COMPRESSION_STRATEGY wxT("PngZS") +#define wxIMAGE_OPTION_PNG_COMPRESSION_BUFFER_SIZE wxT("PngZB") + +enum +{ + wxPNG_TYPE_COLOUR = 0, + wxPNG_TYPE_GREY = 2, + wxPNG_TYPE_GREY_RED = 3, + wxPNG_TYPE_PALETTE = 4 +}; + +class WXDLLIMPEXP_CORE wxPNGHandler: public wxImageHandler +{ +public: + inline wxPNGHandler() + { + m_name = wxT("PNG file"); + m_extension = wxT("png"); + m_type = wxBITMAP_TYPE_PNG; + m_mime = wxT("image/png"); + } + + static wxVersionInfo GetLibraryVersionInfo(); + +#if wxUSE_STREAMS + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ) wxOVERRIDE; + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ) wxOVERRIDE; +protected: + virtual bool DoCanRead( wxInputStream& stream ) wxOVERRIDE; +#endif + +private: + wxDECLARE_DYNAMIC_CLASS(wxPNGHandler); +}; + +#endif + // wxUSE_LIBPNG + +#endif + // _WX_IMAGPNG_H_ + diff --git a/lib/wxWidgets/include/wx/imagpnm.h b/lib/wxWidgets/include/wx/imagpnm.h new file mode 100644 index 0000000..0f3f460 --- /dev/null +++ b/lib/wxWidgets/include/wx/imagpnm.h @@ -0,0 +1,48 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/imagpnm.h +// Purpose: wxImage PNM handler +// Author: Sylvain Bougnoux +// Copyright: (c) Sylvain Bougnoux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGPNM_H_ +#define _WX_IMAGPNM_H_ + +#include "wx/image.h" + +//----------------------------------------------------------------------------- +// wxPNMHandler +//----------------------------------------------------------------------------- + +#if wxUSE_PNM +class WXDLLIMPEXP_CORE wxPNMHandler : public wxImageHandler +{ +public: + inline wxPNMHandler() + { + m_name = wxT("PNM file"); + m_extension = wxT("pnm"); + m_altExtensions.Add(wxT("ppm")); + m_altExtensions.Add(wxT("pgm")); + m_altExtensions.Add(wxT("pbm")); + m_type = wxBITMAP_TYPE_PNM; + m_mime = wxT("image/pnm"); + } + +#if wxUSE_STREAMS + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ) wxOVERRIDE; + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ) wxOVERRIDE; +protected: + virtual bool DoCanRead( wxInputStream& stream ) wxOVERRIDE; +#endif + +private: + wxDECLARE_DYNAMIC_CLASS(wxPNMHandler); +}; +#endif + + +#endif + // _WX_IMAGPNM_H_ + diff --git a/lib/wxWidgets/include/wx/imagtga.h b/lib/wxWidgets/include/wx/imagtga.h new file mode 100644 index 0000000..0c2c7d0 --- /dev/null +++ b/lib/wxWidgets/include/wx/imagtga.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/imagtga.h +// Purpose: wxImage TGA handler +// Author: Seth Jackson +// Copyright: (c) 2005 Seth Jackson +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGTGA_H_ +#define _WX_IMAGTGA_H_ + +#include "wx/image.h" + +//----------------------------------------------------------------------------- +// wxTGAHandler +//----------------------------------------------------------------------------- + +#if wxUSE_TGA + +class WXDLLIMPEXP_CORE wxTGAHandler : public wxImageHandler +{ +public: + wxTGAHandler() + { + m_name = wxT("TGA file"); + m_extension = wxT("tga"); + m_altExtensions.Add(wxT("tpic")); + m_type = wxBITMAP_TYPE_TGA; + m_mime = wxT("image/tga"); + } + +#if wxUSE_STREAMS + virtual bool LoadFile(wxImage* image, wxInputStream& stream, + bool verbose = true, int index = -1) wxOVERRIDE; + virtual bool SaveFile(wxImage* image, wxOutputStream& stream, + bool verbose = true) wxOVERRIDE; +protected: + virtual bool DoCanRead(wxInputStream& stream) wxOVERRIDE; +#endif // wxUSE_STREAMS + + wxDECLARE_DYNAMIC_CLASS(wxTGAHandler); +}; + +#endif // wxUSE_TGA + +#endif // _WX_IMAGTGA_H_ diff --git a/lib/wxWidgets/include/wx/imagtiff.h b/lib/wxWidgets/include/wx/imagtiff.h new file mode 100644 index 0000000..0c7be88 --- /dev/null +++ b/lib/wxWidgets/include/wx/imagtiff.h @@ -0,0 +1,59 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/imagtiff.h +// Purpose: wxImage TIFF handler +// Author: Robert Roebling +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGTIFF_H_ +#define _WX_IMAGTIFF_H_ + +#include "wx/defs.h" + +//----------------------------------------------------------------------------- +// wxTIFFHandler +//----------------------------------------------------------------------------- + +#if wxUSE_LIBTIFF + +#include "wx/image.h" +#include "wx/versioninfo.h" + +// defines for wxImage::SetOption +#define wxIMAGE_OPTION_TIFF_BITSPERSAMPLE wxString(wxT("BitsPerSample")) +#define wxIMAGE_OPTION_TIFF_SAMPLESPERPIXEL wxString(wxT("SamplesPerPixel")) +#define wxIMAGE_OPTION_TIFF_COMPRESSION wxString(wxT("Compression")) +#define wxIMAGE_OPTION_TIFF_PHOTOMETRIC wxString(wxT("Photometric")) +#define wxIMAGE_OPTION_TIFF_IMAGEDESCRIPTOR wxString(wxT("ImageDescriptor")) + +// for backwards compatibility +#define wxIMAGE_OPTION_BITSPERSAMPLE wxIMAGE_OPTION_TIFF_BITSPERSAMPLE +#define wxIMAGE_OPTION_SAMPLESPERPIXEL wxIMAGE_OPTION_TIFF_SAMPLESPERPIXEL +#define wxIMAGE_OPTION_COMPRESSION wxIMAGE_OPTION_TIFF_COMPRESSION +#define wxIMAGE_OPTION_IMAGEDESCRIPTOR wxIMAGE_OPTION_TIFF_IMAGEDESCRIPTOR + +class WXDLLIMPEXP_CORE wxTIFFHandler: public wxImageHandler +{ +public: + wxTIFFHandler(); + + static wxVersionInfo GetLibraryVersionInfo(); + +#if wxUSE_STREAMS + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ) wxOVERRIDE; + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ) wxOVERRIDE; + +protected: + virtual int DoGetImageCount( wxInputStream& stream ) wxOVERRIDE; + virtual bool DoCanRead( wxInputStream& stream ) wxOVERRIDE; +#endif + +private: + wxDECLARE_DYNAMIC_CLASS(wxTIFFHandler); +}; + +#endif // wxUSE_LIBTIFF + +#endif // _WX_IMAGTIFF_H_ + diff --git a/lib/wxWidgets/include/wx/imagxpm.h b/lib/wxWidgets/include/wx/imagxpm.h new file mode 100644 index 0000000..1af3487 --- /dev/null +++ b/lib/wxWidgets/include/wx/imagxpm.h @@ -0,0 +1,44 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/imagxpm.h +// Purpose: wxImage XPM handler +// Author: Vaclav Slavik +// Copyright: (c) 2001 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGXPM_H_ +#define _WX_IMAGXPM_H_ + +#include "wx/image.h" + +#if wxUSE_XPM + +//----------------------------------------------------------------------------- +// wxXPMHandler +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxXPMHandler : public wxImageHandler +{ +public: + inline wxXPMHandler() + { + m_name = wxT("XPM file"); + m_extension = wxT("xpm"); + m_type = wxBITMAP_TYPE_XPM; + m_mime = wxT("image/xpm"); + } + +#if wxUSE_STREAMS + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ) wxOVERRIDE; + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ) wxOVERRIDE; +protected: + virtual bool DoCanRead( wxInputStream& stream ) wxOVERRIDE; +#endif + +private: + wxDECLARE_DYNAMIC_CLASS(wxXPMHandler); +}; + +#endif // wxUSE_XPM + +#endif // _WX_IMAGXPM_H_ diff --git a/lib/wxWidgets/include/wx/infobar.h b/lib/wxWidgets/include/wx/infobar.h new file mode 100644 index 0000000..ebda4f6 --- /dev/null +++ b/lib/wxWidgets/include/wx/infobar.h @@ -0,0 +1,72 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/infobar.h +// Purpose: declaration of wxInfoBarBase defining common API of wxInfoBar +// Author: Vadim Zeitlin +// Created: 2009-07-28 +// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_INFOBAR_H_ +#define _WX_INFOBAR_H_ + +#include "wx/defs.h" + +#if wxUSE_INFOBAR + +#include "wx/control.h" + +// ---------------------------------------------------------------------------- +// wxInfoBar shows non-critical but important information to the user +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxInfoBarBase : public wxControl +{ +public: + // real ctors are provided by the derived classes, just notice that unlike + // most of the other windows, info bar is created hidden and must be + // explicitly shown when it is needed (this is done because it is supposed + // to be shown only intermittently and hiding it after creating it from the + // user code would result in flicker) + wxInfoBarBase() { } + + + // show the info bar with the given message and optionally an icon + virtual void ShowMessage(const wxString& msg, + int flags = wxICON_INFORMATION) = 0; + + // hide the info bar + virtual void Dismiss() = 0; + + // add an extra button to the bar, near the message (replacing the default + // close button which is only shown if no extra buttons are used) + virtual void AddButton(wxWindowID btnid, + const wxString& label = wxString()) = 0; + + // remove a button previously added by AddButton() + virtual void RemoveButton(wxWindowID btnid) = 0; + + // get information about the currently shown buttons + virtual size_t GetButtonCount() const = 0; + virtual wxWindowID GetButtonId(size_t idx) const = 0; + virtual bool HasButtonId(wxWindowID btnid) const = 0; + +private: + wxDECLARE_NO_COPY_CLASS(wxInfoBarBase); +}; + +// currently only GTK+ has a native implementation +#if defined(__WXGTK218__) && !defined(__WXUNIVERSAL__) + #include "wx/gtk/infobar.h" + #define wxHAS_NATIVE_INFOBAR +#endif // wxGTK2 + +// if the generic version is the only one we have, use it +#ifndef wxHAS_NATIVE_INFOBAR + #include "wx/generic/infobar.h" + #define wxInfoBar wxInfoBarGeneric +#endif + +#endif // wxUSE_INFOBAR + +#endif // _WX_INFOBAR_H_ diff --git a/lib/wxWidgets/include/wx/init.h b/lib/wxWidgets/include/wx/init.h new file mode 100644 index 0000000..ea542ae --- /dev/null +++ b/lib/wxWidgets/include/wx/init.h @@ -0,0 +1,116 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/init.h +// Purpose: wxWidgets initialization and finalization functions +// Author: Vadim Zeitlin +// Modified by: +// Created: 29.06.2003 +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_INIT_H_ +#define _WX_INIT_H_ + +#include "wx/defs.h" +#include "wx/chartype.h" + +// ---------------------------------------------------------------------------- +// wxEntry helper functions which allow to have more fine grained control +// ---------------------------------------------------------------------------- + +// do common initialization, return true if ok (in this case wxEntryCleanup +// must be called later), otherwise the program can't use wxWidgets at all +// +// this function also creates wxTheApp as a side effect, if wxIMPLEMENT_APP +// hadn't been used a dummy default application object is created +// +// note that the parameters may be modified, this is why we pass them by +// reference! +extern bool WXDLLIMPEXP_BASE wxEntryStart(int& argc, wxChar **argv); + +// free the resources allocated by the library in wxEntryStart() and shut it +// down (wxEntryStart() may be called again afterwards if necessary) +extern void WXDLLIMPEXP_BASE wxEntryCleanup(); + + +// ---------------------------------------------------------------------------- +// wxEntry: this function initializes the library, runs the main event loop +// and cleans it up +// ---------------------------------------------------------------------------- + +// note that other, platform-specific, overloads of wxEntry may exist as well +// but this one always exists under all platforms +// +// returns the program exit code +extern int WXDLLIMPEXP_BASE wxEntry(int& argc, wxChar **argv); + +// we overload wxEntry[Start]() to take "char **" pointers too +#if wxUSE_UNICODE + +extern bool WXDLLIMPEXP_BASE wxEntryStart(int& argc, char **argv); +extern int WXDLLIMPEXP_BASE wxEntry(int& argc, char **argv); + +#endif// wxUSE_UNICODE + +// Under Windows we define additional wxEntry() overloads with signature +// compatible with WinMain() and not the traditional main(). +#ifdef __WINDOWS__ + #include "wx/msw/init.h" +#endif + +// ---------------------------------------------------------------------------- +// Using the library without (explicit) application object: you may avoid using +// wxDECLARE_APP and wxIMPLEMENT_APP macros and call the functions below instead at +// the program startup and termination +// ---------------------------------------------------------------------------- + +// initialize the library (may be called as many times as needed, but each +// call to wxInitialize() must be matched by wxUninitialize()) +extern bool WXDLLIMPEXP_BASE wxInitialize(); +extern bool WXDLLIMPEXP_BASE wxInitialize(int& argc, wxChar **argv); +#if wxUSE_UNICODE +extern bool WXDLLIMPEXP_BASE wxInitialize(int& argc, char **argv); +#endif + +// clean up -- the library can't be used any more after the last call to +// wxUninitialize() +extern void WXDLLIMPEXP_BASE wxUninitialize(); + +// create an object of this class on stack to initialize/cleanup the library +// automatically +class WXDLLIMPEXP_BASE wxInitializer +{ +public: + // initialize the library + wxInitializer() + { + m_ok = wxInitialize(); + } + + wxInitializer(int& argc, wxChar **argv) + { + m_ok = wxInitialize(argc, argv); + } + +#if wxUSE_UNICODE + wxInitializer(int& argc, char **argv) + { + m_ok = wxInitialize(argc, argv); + } +#endif // wxUSE_UNICODE + + // has the initialization been successful? (explicit test) + bool IsOk() const { return m_ok; } + + // has the initialization been successful? (implicit test) + operator bool() const { return m_ok; } + + // dtor only does clean up if we initialized the library properly + ~wxInitializer() { if ( m_ok ) wxUninitialize(); } + +private: + bool m_ok; +}; + +#endif // _WX_INIT_H_ + diff --git a/lib/wxWidgets/include/wx/intl.h b/lib/wxWidgets/include/wx/intl.h new file mode 100644 index 0000000..4b7614e --- /dev/null +++ b/lib/wxWidgets/include/wx/intl.h @@ -0,0 +1,296 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/intl.h +// Purpose: Internationalization and localisation for wxWidgets +// Author: Vadim Zeitlin +// Modified by: Michael N. Filippov <michael@idisys.iae.nsk.su> +// (2003/09/30 - plural forms support) +// Created: 29/01/98 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_INTL_H_ +#define _WX_INTL_H_ + +#include "wx/defs.h" +#include "wx/localedefs.h" +#include "wx/string.h" +#include "wx/translation.h" + +#if wxUSE_INTL + +#include "wx/fontenc.h" +#include "wx/language.h" + +// ============================================================================ +// global decls +// ============================================================================ + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// forward decls +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_BASE wxLocale; + +// ============================================================================ +// locale support +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxLocale: encapsulates all language dependent settings, including current +// message catalogs, date, time and currency formats (TODO) &c +// ---------------------------------------------------------------------------- + +enum wxLocaleInitFlags +{ + wxLOCALE_DONT_LOAD_DEFAULT = 0x0000, // don't load wxwin.mo + wxLOCALE_LOAD_DEFAULT = 0x0001 // load wxwin.mo? +#if WXWIN_COMPATIBILITY_2_8 + ,wxLOCALE_CONV_ENCODING = 0x0002 // no longer used, simply remove + // it from the existing code +#endif +}; + +// NOTE: This class is deprecated, use wxUILocale and wxTranslations instead. + +class WXDLLIMPEXP_BASE wxLocale +{ +public: + // ctor & dtor + // ----------- + + // call Init() if you use this ctor + wxLocale() { DoCommonInit(); } + + // the ctor has a side effect of changing current locale + wxLocale(const wxString& name, // name (for messages) + const wxString& shortName = wxEmptyString, // dir prefix (for msg files) + const wxString& locale = wxEmptyString, // locale (for setlocale) + bool bLoadDefault = true // preload wxstd.mo? +#if WXWIN_COMPATIBILITY_2_8 + ,bool bConvertEncoding = true // convert Win<->Unix if necessary? +#endif + ) + { + DoCommonInit(); + +#if WXWIN_COMPATIBILITY_2_8 + Init(name, shortName, locale, bLoadDefault, bConvertEncoding); +#else + Init(name, shortName, locale, bLoadDefault); +#endif + } + + wxLocale(int language, // wxLanguage id or custom language + int flags = wxLOCALE_LOAD_DEFAULT) + { + DoCommonInit(); + + Init(language, flags); + } + + // the same as a function (returns true on success) + bool Init(const wxString& name, + const wxString& shortName = wxEmptyString, + const wxString& locale = wxEmptyString, + bool bLoadDefault = true +#if WXWIN_COMPATIBILITY_2_8 + ,bool bConvertEncoding = true +#endif + ); + + // same as second ctor (returns true on success) + bool Init(int language = wxLANGUAGE_DEFAULT, + int flags = wxLOCALE_LOAD_DEFAULT); + + // restores old locale + virtual ~wxLocale(); + + // Try to get user's (or OS's) preferred language setting. + // Return wxLANGUAGE_UNKNOWN if language-guessing algorithm failed + static int GetSystemLanguage(); + + // get the encoding used by default for text on this system, returns + // wxFONTENCODING_SYSTEM if it couldn't be determined + static wxFontEncoding GetSystemEncoding(); + + // get the string describing the system encoding, return empty string if + // couldn't be determined + static wxString GetSystemEncodingName(); + + // get the values of the given locale-dependent datum: the current locale + // is used, the US default value is returned if everything else fails + static wxString GetInfo(wxLocaleInfo index, + wxLocaleCategory cat = wxLOCALE_CAT_DEFAULT); + + // Same as GetInfo() but uses current locale at the OS level to retrieve + // the information. Normally it should be the same as the one used by + // GetInfo() but there are two exceptions: the most important one is that + // if no locale had been set, GetInfo() would fall back to "C" locale, + // while this one uses the default OS locale. Another, more rare, one is + // that some locales might not supported by the OS. + // + // Currently this is the same as GetInfo() under non-MSW platforms. + static wxString GetOSInfo(wxLocaleInfo index, + wxLocaleCategory cat = wxLOCALE_CAT_DEFAULT); + + // return true if the locale was set successfully + bool IsOk() const { return m_pszOldLocale != NULL; } + + // returns locale name + const wxString& GetLocale() const { return m_strLocale; } + + // return current locale wxLanguage value + int GetLanguage() const { return m_language; } + + // return locale name to be passed to setlocale() + wxString GetSysName() const; + + // return 'canonical' name, i.e. in the form of xx[_YY], where xx is + // language code according to ISO 639 and YY is country name + // as specified by ISO 3166. + wxString GetCanonicalName() const { return m_strShort; } + + // add a prefix to the catalog lookup path: the message catalog files will be + // looked up under prefix/<lang>/LC_MESSAGES, prefix/LC_MESSAGES and prefix + // (in this order). + // + // This only applies to subsequent invocations of AddCatalog()! + static void AddCatalogLookupPathPrefix(const wxString& prefix) + { wxFileTranslationsLoader::AddCatalogLookupPathPrefix(prefix); } + + // add a catalog: it's searched for in standard places (current directory + // first, system one after), but the you may prepend additional directories to + // the search path with AddCatalogLookupPathPrefix(). + // + // The loaded catalog will be used for message lookup by GetString(). + // + // Returns 'true' if it was successfully loaded + bool AddCatalog(const wxString& domain); + bool AddCatalog(const wxString& domain, wxLanguage msgIdLanguage); + bool AddCatalog(const wxString& domain, + wxLanguage msgIdLanguage, const wxString& msgIdCharset); + + // check if the given locale is provided by OS and C run time + static bool IsAvailable(int lang); + + // check if the given catalog is loaded + bool IsLoaded(const wxString& domain) const; + + // Retrieve the language info struct for the given language + // + // Returns NULL if no info found, pointer must *not* be deleted by caller + static const wxLanguageInfo *GetLanguageInfo(int lang); + + // Returns language name in English or empty string if the language + // is not in database + static wxString GetLanguageName(int lang); + + // Returns ISO code ("canonical name") of language or empty string if the + // language is not in database + static wxString GetLanguageCanonicalName(int lang); + + // Find the language for the given locale string which may be either a + // canonical ISO 2 letter language code ("xx"), a language code followed by + // the country code ("xx_XX") or a Windows full language name ("Xxxxx...") + // + // Returns NULL if no info found, pointer must *not* be deleted by caller + static const wxLanguageInfo *FindLanguageInfo(const wxString& locale); + + // Add custom language to the list of known languages. + // Notes: 1) wxLanguageInfo contains platform-specific data + // 2) must be called before Init to have effect + static void AddLanguage(const wxLanguageInfo& info); + + // retrieve the translation for a string in all loaded domains unless + // the szDomain parameter is specified (and then only this domain is + // searched) + // n - additional parameter for PluralFormsParser + // + // return original string if translation is not available + // (in this case an error message is generated the first time + // a string is not found; use wxLogNull to suppress it) + // + // domains are searched in the last to first order, i.e. catalogs + // added later override those added before. + const wxString& GetString(const wxString& origString, + const wxString& domain = wxEmptyString) const + { + return wxGetTranslation(origString, domain); + } + // plural form version of the same: + const wxString& GetString(const wxString& origString, + const wxString& origString2, + unsigned n, + const wxString& domain = wxEmptyString) const + { + return wxGetTranslation(origString, origString2, n, domain); + } + + // Returns the current short name for the locale + const wxString& GetName() const { return m_strShort; } + + // return the contents of .po file header + wxString GetHeaderValue(const wxString& header, + const wxString& domain = wxEmptyString) const; + + // These two methods are for internal use only. First one creates the + // global language database if it doesn't already exist, second one destroys + // it. + static void CreateLanguagesDB(); + static void DestroyLanguagesDB(); + +private: + // This method updates the member fields when this locale is actually set + // as active. + void DoInit(const wxString& name, + const wxString& shortName, + int language); + + // This method is trivial and just initializes the member fields to default + // values. + void DoCommonInit(); + + // After trying to set locale, call this method to give the appropriate + // error if it couldn't be set (success == false) and to load the + // translations for the given language, if necessary. + // + // The return value is the same as "success" parameter. + bool DoCommonPostInit(bool success, + const wxString& name, + const wxString& shortName, + bool bLoadDefault); + + + wxString m_strLocale, // this locale name + m_strShort; // short name for the locale + int m_language; // this locale wxLanguage value + + wxString m_oldUILocale; // previous wxUILocale name + const char *m_pszOldLocale; // previous locale from setlocale() + wxLocale *m_pOldLocale; // previous wxLocale +#ifdef __WIN32__ + wxUint32 m_oldLCID; +#endif + + bool m_initialized; + + wxTranslations m_translations; + + wxDECLARE_NO_COPY_CLASS(wxLocale); +}; + +// ---------------------------------------------------------------------------- +// global functions +// ---------------------------------------------------------------------------- + +// get the current locale object (note that it may be NULL!) +extern WXDLLIMPEXP_BASE wxLocale* wxGetLocale(); + +#endif // wxUSE_INTL + +#endif // _WX_INTL_H_ diff --git a/lib/wxWidgets/include/wx/iosfwrap.h b/lib/wxWidgets/include/wx/iosfwrap.h new file mode 100644 index 0000000..7379e75 --- /dev/null +++ b/lib/wxWidgets/include/wx/iosfwrap.h @@ -0,0 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/iosfwrap.h +// Purpose: This file is obsolete, include <iosfwd> directly instead +// Author: Jan van Dijk <jan@etpmod.phys.tue.nl> +// Modified by: +// Created: 18.12.2002 +// Copyright: wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#if wxUSE_STD_IOSTREAM + +#include <iosfwd> + +#ifdef __WINDOWS__ +# include "wx/msw/winundef.h" +#endif + +#endif // wxUSE_STD_IOSTREAM + diff --git a/lib/wxWidgets/include/wx/ioswrap.h b/lib/wxWidgets/include/wx/ioswrap.h new file mode 100644 index 0000000..7fad3b3 --- /dev/null +++ b/lib/wxWidgets/include/wx/ioswrap.h @@ -0,0 +1,25 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/ioswrap.h +// Purpose: This file is obsolete, include <iostream> directly instead. +// Author: Vadim Zeitlin +// Modified by: +// Created: 03.02.99 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#if wxUSE_STD_IOSTREAM + +#include "wx/beforestd.h" + +#include <iostream> + +#include "wx/afterstd.h" + +#ifdef __WINDOWS__ +# include "wx/msw/winundef.h" +#endif + +#endif + // wxUSE_STD_IOSTREAM + diff --git a/lib/wxWidgets/include/wx/ipc.h b/lib/wxWidgets/include/wx/ipc.h new file mode 100644 index 0000000..36542e5 --- /dev/null +++ b/lib/wxWidgets/include/wx/ipc.h @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/ipc.h +// Purpose: wrapper around different wxIPC classes implementations +// Author: Vadim Zeitlin +// Modified by: +// Created: 15.04.02 +// Copyright: (c) 2002 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IPC_H_ +#define _WX_IPC_H_ + +// Set wxUSE_DDE_FOR_IPC to 1 to use DDE for IPC under Windows. If it is set to +// 0, or if the platform is not Windows, use TCP/IP for IPC implementation + +#if !defined(wxUSE_DDE_FOR_IPC) + #ifdef __WINDOWS__ + #define wxUSE_DDE_FOR_IPC 1 + #else + #define wxUSE_DDE_FOR_IPC 0 + #endif +#endif // !defined(wxUSE_DDE_FOR_IPC) + +#if !defined(__WINDOWS__) + #undef wxUSE_DDE_FOR_IPC + #define wxUSE_DDE_FOR_IPC 0 +#endif + +#if wxUSE_DDE_FOR_IPC + #define wxConnection wxDDEConnection + #define wxServer wxDDEServer + #define wxClient wxDDEClient + + #include "wx/dde.h" +#else // !wxUSE_DDE_FOR_IPC + #define wxConnection wxTCPConnection + #define wxServer wxTCPServer + #define wxClient wxTCPClient + + #include "wx/sckipc.h" +#endif // wxUSE_DDE_FOR_IPC/!wxUSE_DDE_FOR_IPC + +#endif // _WX_IPC_H_ diff --git a/lib/wxWidgets/include/wx/ipcbase.h b/lib/wxWidgets/include/wx/ipcbase.h new file mode 100644 index 0000000..9d13867 --- /dev/null +++ b/lib/wxWidgets/include/wx/ipcbase.h @@ -0,0 +1,263 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/ipcbase.h +// Purpose: Base classes for IPC +// Author: Julian Smart +// Modified by: +// Created: 4/1/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IPCBASEH__ +#define _WX_IPCBASEH__ + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/string.h" + +enum wxIPCFormat +{ + wxIPC_INVALID = 0, + wxIPC_TEXT = 1, /* CF_TEXT */ + wxIPC_BITMAP = 2, /* CF_BITMAP */ + wxIPC_METAFILE = 3, /* CF_METAFILEPICT */ + wxIPC_SYLK = 4, + wxIPC_DIF = 5, + wxIPC_TIFF = 6, + wxIPC_OEMTEXT = 7, /* CF_OEMTEXT */ + wxIPC_DIB = 8, /* CF_DIB */ + wxIPC_PALETTE = 9, + wxIPC_PENDATA = 10, + wxIPC_RIFF = 11, + wxIPC_WAVE = 12, + wxIPC_UTF16TEXT = 13, /* CF_UNICODE */ + wxIPC_ENHMETAFILE = 14, + wxIPC_FILENAME = 15, /* CF_HDROP */ + wxIPC_LOCALE = 16, + wxIPC_UTF8TEXT = 17, + wxIPC_UTF32TEXT = 18, +#if SIZEOF_WCHAR_T == 2 + wxIPC_UNICODETEXT = wxIPC_UTF16TEXT, +#elif SIZEOF_WCHAR_T == 4 + wxIPC_UNICODETEXT = wxIPC_UTF32TEXT, +#else +# error "Unknown wchar_t size" +#endif + wxIPC_PRIVATE = 20 +}; + +class WXDLLIMPEXP_FWD_BASE wxServerBase; +class WXDLLIMPEXP_FWD_BASE wxClientBase; + +class WXDLLIMPEXP_BASE wxConnectionBase: public wxObject +{ +public: + wxConnectionBase(void *buffer, size_t size); // use external buffer + wxConnectionBase(); // use internal, adaptive buffer + wxConnectionBase(const wxConnectionBase& copy); + virtual ~wxConnectionBase(); + + void SetConnected( bool c ) { m_connected = c; } + bool GetConnected() const { return m_connected; } + + // Calls that CLIENT can make + bool Execute(const void *data, size_t size, wxIPCFormat fmt = wxIPC_PRIVATE) + { return DoExecute(data, size, fmt); } + bool Execute(const char *s, size_t size = wxNO_LEN) + { return DoExecute(s, size == wxNO_LEN ? strlen(s) + 1 + : size, wxIPC_TEXT); } + bool Execute(const wchar_t *ws, size_t size = wxNO_LEN) + { return DoExecute(ws, size == wxNO_LEN ? (wcslen(ws) + 1)*sizeof(wchar_t) + : size, wxIPC_UNICODETEXT); } + bool Execute(const wxString& s) + { + const wxScopedCharBuffer buf = s.utf8_str(); + return DoExecute(buf, strlen(buf) + 1, wxIPC_UTF8TEXT); + } + bool Execute(const wxCStrData& cs) + { return Execute(cs.AsString()); } + + virtual const void *Request(const wxString& item, + size_t *size = NULL, + wxIPCFormat format = wxIPC_TEXT) = 0; + + bool Poke(const wxString& item, const void *data, size_t size, + wxIPCFormat fmt = wxIPC_PRIVATE) + { return DoPoke(item, data, size, fmt); } + bool Poke(const wxString& item, const char *s, size_t size = wxNO_LEN) + { return DoPoke(item, s, size == wxNO_LEN ? strlen(s) + 1 + : size, wxIPC_TEXT); } + bool Poke(const wxString& item, const wchar_t *ws, size_t size = wxNO_LEN) + { return DoPoke(item, ws, + size == wxNO_LEN ? (wcslen(ws) + 1)*sizeof(wchar_t) + : size, wxIPC_UNICODETEXT); } + bool Poke(const wxString& item, const wxString& s) + { + const wxScopedCharBuffer buf = s.utf8_str(); + return DoPoke(item, buf, strlen(buf) + 1, wxIPC_UTF8TEXT); + } + bool Poke(const wxString& item, const wxCStrData& cs) + { return Poke(item, cs.AsString()); } + + virtual bool StartAdvise(const wxString& item) = 0; + virtual bool StopAdvise(const wxString& item) = 0; + + // Calls that SERVER can make + bool Advise(const wxString& item, const void *data, size_t size, + wxIPCFormat fmt = wxIPC_PRIVATE) + { return DoAdvise(item, data, size, fmt); } + bool Advise(const wxString& item, const char *s, size_t size = wxNO_LEN) + { return DoAdvise(item, s, size == wxNO_LEN ? strlen(s) + 1 + : size, wxIPC_TEXT); } + bool Advise(const wxString& item, const wchar_t *ws, size_t size = wxNO_LEN) + { return DoAdvise(item, ws, + size == wxNO_LEN ? (wcslen(ws) + 1)*sizeof(wchar_t) + : size, wxIPC_UNICODETEXT); } + bool Advise(const wxString& item, const wxString& s) + { + const wxScopedCharBuffer buf = s.utf8_str(); + return DoAdvise(item, buf, strlen(buf) + 1, wxIPC_UTF8TEXT); + } + bool Advise(const wxString& item, const wxCStrData& cs) + { return Advise(item, cs.AsString()); } + + // Calls that both can make + virtual bool Disconnect() = 0; + + + // Callbacks to SERVER - override at will + virtual bool OnExec(const wxString& WXUNUSED(topic), + const wxString& WXUNUSED(data)) + { + wxFAIL_MSG( "This method shouldn't be called, if it is, it probably " + "means that you didn't update your old code overriding " + "OnExecute() to use the new parameter types (\"const void *\" " + "instead of \"wxChar *\" and \"size_t\" instead of \"int\"), " + "you must do it or your code wouldn't be executed at all!" ); + return false; + } + + // deprecated function kept for backwards compatibility: usually you will + // want to override OnExec() above instead which receives its data in a more + // convenient format + virtual bool OnExecute(const wxString& topic, + const void *data, + size_t size, + wxIPCFormat format) + { return OnExec(topic, GetTextFromData(data, size, format)); } + + virtual const void *OnRequest(const wxString& WXUNUSED(topic), + const wxString& WXUNUSED(item), + size_t *size, + wxIPCFormat WXUNUSED(format)) + { *size = 0; return NULL; } + + virtual bool OnPoke(const wxString& WXUNUSED(topic), + const wxString& WXUNUSED(item), + const void *WXUNUSED(data), + size_t WXUNUSED(size), + wxIPCFormat WXUNUSED(format)) + { return false; } + + virtual bool OnStartAdvise(const wxString& WXUNUSED(topic), + const wxString& WXUNUSED(item)) + { return false; } + + virtual bool OnStopAdvise(const wxString& WXUNUSED(topic), + const wxString& WXUNUSED(item)) + { return false; } + + // Callbacks to CLIENT - override at will + virtual bool OnAdvise(const wxString& WXUNUSED(topic), + const wxString& WXUNUSED(item), + const void *WXUNUSED(data), + size_t WXUNUSED(size), + wxIPCFormat WXUNUSED(format)) + { return false; } + + // Callbacks to BOTH + virtual bool OnDisconnect() { delete this; return true; } + + + // return true if this is one of the formats used for textual data + // transmission + static bool IsTextFormat(wxIPCFormat format) + { + return format == wxIPC_TEXT || + format == wxIPC_UTF8TEXT || + format == wxIPC_UTF16TEXT || + format == wxIPC_UTF32TEXT; + } + + // converts from the data and format into a wxString automatically + // + // this function accepts data in all of wxIPC_TEXT, wxIPC_UNICODETEXT, and + // wxIPC_UTF8TEXT formats but asserts if the format is anything else (i.e. + // such that IsTextFormat(format) doesn't return true) + // + // notice that the size parameter here contains the total size of the data, + // including the terminating '\0' or L'\0' + static + wxString GetTextFromData(const void *data, size_t size, wxIPCFormat format); + + + // return a buffer at least this size, reallocating buffer if needed + // returns NULL if using an inadequate user buffer which can't be resized + void *GetBufferAtLeast(size_t bytes); + +protected: + virtual bool DoExecute(const void *data, size_t size, wxIPCFormat format) = 0; + virtual bool DoPoke(const wxString& item, const void *data, size_t size, + wxIPCFormat format) = 0; + virtual bool DoAdvise(const wxString& item, const void *data, size_t size, + wxIPCFormat format) = 0; + + +private: + char *m_buffer; + size_t m_buffersize; + bool m_deletebufferwhendone; + +protected: + bool m_connected; + + wxDECLARE_NO_ASSIGN_CLASS(wxConnectionBase); + wxDECLARE_CLASS(wxConnectionBase); +}; + + +class WXDLLIMPEXP_BASE wxServerBase : public wxObject +{ +public: + wxServerBase() { } + virtual ~wxServerBase() { } + + // Returns false on error (e.g. port number is already in use) + virtual bool Create(const wxString& serverName) = 0; + + // Callbacks to SERVER - override at will + virtual wxConnectionBase *OnAcceptConnection(const wxString& topic) = 0; + + wxDECLARE_CLASS(wxServerBase); +}; + +class WXDLLIMPEXP_BASE wxClientBase : public wxObject +{ +public: + wxClientBase() { } + virtual ~wxClientBase() { } + + virtual bool ValidHost(const wxString& host) = 0; + + // Call this to make a connection. Returns NULL if cannot. + virtual wxConnectionBase *MakeConnection(const wxString& host, + const wxString& server, + const wxString& topic) = 0; + + // Callbacks to CLIENT - override at will + virtual wxConnectionBase *OnMakeConnection() = 0; + + wxDECLARE_CLASS(wxClientBase); +}; + +#endif // _WX_IPCBASEH__ diff --git a/lib/wxWidgets/include/wx/itemattr.h b/lib/wxWidgets/include/wx/itemattr.h new file mode 100644 index 0000000..596cb2b --- /dev/null +++ b/lib/wxWidgets/include/wx/itemattr.h @@ -0,0 +1,79 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/itemattr.h +// Purpose: wxItemAttr class declaration +// Author: Vadim Zeitlin +// Created: 2016-04-16 (extracted from wx/listctrl.h) +// Copyright: (c) 2016 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ITEMATTR_H_ +#define _WX_ITEMATTR_H_ + +// ---------------------------------------------------------------------------- +// wxItemAttr: a structure containing the visual attributes of an item +// ---------------------------------------------------------------------------- + +class wxItemAttr +{ +public: + // ctors + wxItemAttr() { } + wxItemAttr(const wxColour& colText, + const wxColour& colBack, + const wxFont& font) + : m_colText(colText), m_colBack(colBack), m_font(font) + { + } + + // default copy ctor, assignment operator and dtor are ok + + bool operator==(const wxItemAttr& other) const + { + return m_colText == other.m_colText && + m_colBack == other.m_colBack && + m_font == other.m_font; + } + + bool operator!=(const wxItemAttr& other) const + { + return !(*this == other); + } + + // setters + void SetTextColour(const wxColour& colText) { m_colText = colText; } + void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; } + void SetFont(const wxFont& font) { m_font = font; } + + // accessors + bool HasTextColour() const { return m_colText.IsOk(); } + bool HasBackgroundColour() const { return m_colBack.IsOk(); } + bool HasFont() const { return m_font.IsOk(); } + + bool HasColours() const { return HasTextColour() || HasBackgroundColour(); } + bool IsDefault() const { return !HasColours() && !HasFont(); } + + const wxColour& GetTextColour() const { return m_colText; } + const wxColour& GetBackgroundColour() const { return m_colBack; } + const wxFont& GetFont() const { return m_font; } + + + // this is almost like assignment operator except it doesn't overwrite the + // fields unset in the source attribute + void AssignFrom(const wxItemAttr& source) + { + if ( source.HasTextColour() ) + SetTextColour(source.GetTextColour()); + if ( source.HasBackgroundColour() ) + SetBackgroundColour(source.GetBackgroundColour()); + if ( source.HasFont() ) + SetFont(source.GetFont()); + } + +private: + wxColour m_colText, + m_colBack; + wxFont m_font; +}; + +#endif // _WX_ITEMATTR_H_ diff --git a/lib/wxWidgets/include/wx/itemid.h b/lib/wxWidgets/include/wx/itemid.h new file mode 100644 index 0000000..9bd2a83 --- /dev/null +++ b/lib/wxWidgets/include/wx/itemid.h @@ -0,0 +1,61 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/itemid.h +// Purpose: wxItemId class declaration. +// Author: Vadim Zeitlin +// Created: 2011-08-17 +// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ITEMID_H_ +#define _WX_ITEMID_H_ + +// ---------------------------------------------------------------------------- +// wxItemId: an opaque item identifier used with wx{Tree,TreeList,DataView}Ctrl. +// ---------------------------------------------------------------------------- + +// The template argument T is typically a pointer to some opaque type. While +// wxTreeItemId and wxDataViewItem use a pointer to void, this is dangerous and +// not recommended for the new item id classes. +template <typename T> +class wxItemId +{ +public: + typedef T Type; + + // This ctor is implicit which is fine for non-void* types, but if you use + // this class with void* you're strongly advised to make the derived class + // ctor explicit as implicitly converting from any pointer is simply too + // dangerous. + wxItemId(Type item = NULL) : m_pItem(item) { } + + // Default copy ctor, assignment operator and dtor are ok. + + bool IsOk() const { return m_pItem != NULL; } + Type GetID() const { return m_pItem; } + operator Type() const { return m_pItem; } + + // This is used for implementation purposes only. + Type operator->() const { return m_pItem; } + + void Unset() { m_pItem = NULL; } + + // This field is public *only* for compatibility with the old wxTreeItemId + // implementation and must not be used in any new code. +//private: + Type m_pItem; +}; + +template <typename T> +bool operator==(const wxItemId<T>& left, const wxItemId<T>& right) +{ + return left.GetID() == right.GetID(); +} + +template <typename T> +bool operator!=(const wxItemId<T>& left, const wxItemId<T>& right) +{ + return !(left == right); +} + +#endif // _WX_ITEMID_H_ diff --git a/lib/wxWidgets/include/wx/joystick.h b/lib/wxWidgets/include/wx/joystick.h new file mode 100644 index 0000000..4a93a25 --- /dev/null +++ b/lib/wxWidgets/include/wx/joystick.h @@ -0,0 +1,37 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/joystick.h +// Purpose: wxJoystick base header +// Author: wxWidgets Team +// Modified by: +// Created: +// Copyright: (c) wxWidgets Team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_JOYSTICK_H_BASE_ +#define _WX_JOYSTICK_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_JOYSTICK + +#if defined(__WINDOWS__) +#include "wx/msw/joystick.h" +#elif defined(__WXMOTIF__) +#include "wx/unix/joystick.h" +#elif defined(__WXGTK__) +#include "wx/unix/joystick.h" +#elif defined(__WXX11__) +#include "wx/unix/joystick.h" +#elif defined(__DARWIN__) +#include "wx/osx/core/joystick.h" +#elif defined(__WXMAC__) +#include "wx/osx/joystick.h" +#elif defined(__WXQT__) +#include "wx/unix/joystick.h" +#endif + +#endif // wxUSE_JOYSTICK + +#endif + // _WX_JOYSTICK_H_BASE_ diff --git a/lib/wxWidgets/include/wx/kbdstate.h b/lib/wxWidgets/include/wx/kbdstate.h new file mode 100644 index 0000000..4344426 --- /dev/null +++ b/lib/wxWidgets/include/wx/kbdstate.h @@ -0,0 +1,122 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/kbdstate.h +// Purpose: Declaration of wxKeyboardState class +// Author: Vadim Zeitlin +// Created: 2008-09-19 +// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_KBDSTATE_H_ +#define _WX_KBDSTATE_H_ + +#include "wx/defs.h" + +// ---------------------------------------------------------------------------- +// wxKeyboardState stores the state of the keyboard modifier keys +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxKeyboardState +{ +public: + explicit + wxKeyboardState(bool controlDown = false, + bool shiftDown = false, + bool altDown = false, + bool metaDown = false) + : m_controlDown(controlDown), + m_shiftDown(shiftDown), + m_altDown(altDown), + m_metaDown(metaDown) +#ifdef __WXOSX__ + ,m_rawControlDown(false) +#endif + { + } + + // default copy ctor, assignment operator and dtor are ok + + + // accessors for the various modifier keys + // --------------------------------------- + + // should be used check if the key event has exactly the given modifiers: + // "GetModifiers() = wxMOD_CONTROL" is easier to write than "ControlDown() + // && !MetaDown() && !AltDown() && !ShiftDown()" + int GetModifiers() const + { + return (m_controlDown ? wxMOD_CONTROL : 0) | + (m_shiftDown ? wxMOD_SHIFT : 0) | + (m_metaDown ? wxMOD_META : 0) | +#ifdef __WXOSX__ + (m_rawControlDown ? wxMOD_RAW_CONTROL : 0) | +#endif + (m_altDown ? wxMOD_ALT : 0); + } + + // returns true if any modifiers at all are pressed + bool HasAnyModifiers() const { return GetModifiers() != wxMOD_NONE; } + + // returns true if any modifiers changing the usual key interpretation are + // pressed, notably excluding Shift + bool HasModifiers() const + { + return ControlDown() || RawControlDown() || AltDown(); + } + + // accessors for individual modifier keys + bool ControlDown() const { return m_controlDown; } + bool RawControlDown() const + { +#ifdef __WXOSX__ + return m_rawControlDown; +#else + return m_controlDown; +#endif + } + bool ShiftDown() const { return m_shiftDown; } + bool MetaDown() const { return m_metaDown; } + bool AltDown() const { return m_altDown; } + + // "Cmd" is a pseudo key which is Control for PC and Unix platforms but + // Apple ("Command") key under Macs: it makes often sense to use it instead + // of, say, ControlDown() because Cmd key is used for the same thing under + // Mac as Ctrl elsewhere (but Ctrl still exists, just not used for this + // purpose under Mac) + bool CmdDown() const + { + return ControlDown(); + } + + // these functions are mostly used by wxWidgets itself + // --------------------------------------------------- + + void SetControlDown(bool down) { m_controlDown = down; } + void SetRawControlDown(bool down) + { +#ifdef __WXOSX__ + m_rawControlDown = down; +#else + m_controlDown = down; +#endif + } + void SetShiftDown(bool down) { m_shiftDown = down; } + void SetAltDown(bool down) { m_altDown = down; } + void SetMetaDown(bool down) { m_metaDown = down; } + + + // for backwards compatibility with the existing code accessing these + // members of wxKeyEvent directly, these variables are public, however you + // should not use them in any new code, please use the accessors instead +public: + bool m_controlDown : 1; + bool m_shiftDown : 1; + bool m_altDown : 1; + bool m_metaDown : 1; +#ifdef __WXOSX__ + bool m_rawControlDown : 1; +#endif +}; + +#endif // _WX_KBDSTATE_H_ + diff --git a/lib/wxWidgets/include/wx/language.h b/lib/wxWidgets/include/wx/language.h new file mode 100644 index 0000000..3785c22 --- /dev/null +++ b/lib/wxWidgets/include/wx/language.h @@ -0,0 +1,946 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/language.h +// Purpose: wxLanguage enum +// Author: Vadim Zeitlin +// Created: 2010-04-23 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// WARNING: Parts of this file are generated. See misc/languages/README for +// details. + +#ifndef _WX_LANGUAGE_H_ +#define _WX_LANGUAGE_H_ + +#include "wx/defs.h" + +#if wxUSE_INTL + +// ---------------------------------------------------------------------------- +// wxLanguage: defines all supported languages +// ---------------------------------------------------------------------------- + +// --- --- --- generated code begins here --- --- --- + +/** + The languages supported by wxLocale. + + This enum is generated by misc/languages/genlang.py + When making changes, please put them into misc/languages/langtabl.txt +*/ +enum wxLanguage +{ + /// User's default/preferred language as got from OS. + wxLANGUAGE_DEFAULT, + + /// Unknown language, returned if wxLocale::GetSystemLanguage fails. + wxLANGUAGE_UNKNOWN, + + wxLANGUAGE_ABKHAZIAN, + wxLANGUAGE_AFAR, + wxLANGUAGE_AFAR_DJIBOUTI, + wxLANGUAGE_AFAR_ERITREA, + wxLANGUAGE_AFAR_ETHIOPIA, + wxLANGUAGE_AFRIKAANS, + wxLANGUAGE_AFRIKAANS_NAMIBIA, + wxLANGUAGE_AFRIKAANS_SOUTH_AFRICA, + wxLANGUAGE_AGHEM, + wxLANGUAGE_AGHEM_CAMEROON, + wxLANGUAGE_AKAN, + wxLANGUAGE_AKAN_GHANA, + wxLANGUAGE_ALBANIAN, + wxLANGUAGE_ALBANIAN_ALBANIA, + wxLANGUAGE_ALBANIAN_KOSOVO, + wxLANGUAGE_ALBANIAN_NORTH_MACEDONIA, + wxLANGUAGE_ALSATIAN_FRANCE, + wxLANGUAGE_AMHARIC, + wxLANGUAGE_AMHARIC_ETHIOPIA, + wxLANGUAGE_ARABIC, + wxLANGUAGE_ARABIC_ALGERIA, + wxLANGUAGE_ARABIC_BAHRAIN, + wxLANGUAGE_ARABIC_CHAD, + wxLANGUAGE_ARABIC_COMOROS, + wxLANGUAGE_ARABIC_DJIBOUTI, + wxLANGUAGE_ARABIC_EGYPT, + wxLANGUAGE_ARABIC_ERITREA, + wxLANGUAGE_ARABIC_IRAQ, + wxLANGUAGE_ARABIC_ISRAEL, + wxLANGUAGE_ARABIC_JORDAN, + wxLANGUAGE_ARABIC_KUWAIT, + wxLANGUAGE_ARABIC_LEBANON, + wxLANGUAGE_ARABIC_LIBYA, + wxLANGUAGE_ARABIC_MAURITANIA, + wxLANGUAGE_ARABIC_MOROCCO, + wxLANGUAGE_ARABIC_OMAN, + wxLANGUAGE_ARABIC_PALESTINIAN_AUTHORITY, + wxLANGUAGE_ARABIC_QATAR, + wxLANGUAGE_ARABIC_SAUDI_ARABIA, + wxLANGUAGE_ARABIC_SOMALIA, + wxLANGUAGE_ARABIC_SOUTH_SUDAN, + wxLANGUAGE_ARABIC_SUDAN, + wxLANGUAGE_ARABIC_SYRIA, + wxLANGUAGE_ARABIC_TUNISIA, + wxLANGUAGE_ARABIC_UAE, + wxLANGUAGE_ARABIC_WORLD, + wxLANGUAGE_ARABIC_YEMEN, + wxLANGUAGE_ARMENIAN, + wxLANGUAGE_ARMENIAN_ARMENIA, + wxLANGUAGE_ASSAMESE, + wxLANGUAGE_ASSAMESE_INDIA, + wxLANGUAGE_ASTURIAN, + wxLANGUAGE_ASTURIAN_SPAIN, + wxLANGUAGE_ASU, + wxLANGUAGE_ASU_TANZANIA, + wxLANGUAGE_AYMARA, + wxLANGUAGE_AZERBAIJANI, + wxLANGUAGE_AZERBAIJANI_CYRILLIC, + wxLANGUAGE_AZERBAIJANI_CYRILLIC_AZERBAIJAN, + wxLANGUAGE_AZERBAIJANI_LATIN, + wxLANGUAGE_AZERBAIJANI_LATIN_AZERBAIJAN, + wxLANGUAGE_BAFIA, + wxLANGUAGE_BAFIA_CAMEROON, + wxLANGUAGE_BAMANANKAN, + wxLANGUAGE_BAMANANKAN_LATIN, + wxLANGUAGE_BAMANANKAN_LATIN_MALI, + wxLANGUAGE_BANGLA, + wxLANGUAGE_BANGLA_BANGLADESH, + wxLANGUAGE_BANGLA_INDIA, + wxLANGUAGE_BASAA, + wxLANGUAGE_BASAA_CAMEROON, + wxLANGUAGE_BASHKIR, + wxLANGUAGE_BASHKIR_RUSSIA, + wxLANGUAGE_BASQUE, + wxLANGUAGE_BASQUE_SPAIN, + wxLANGUAGE_BELARUSIAN, + wxLANGUAGE_BELARUSIAN_BELARUS, + wxLANGUAGE_BEMBA, + wxLANGUAGE_BEMBA_ZAMBIA, + wxLANGUAGE_BENA, + wxLANGUAGE_BENA_TANZANIA, + wxLANGUAGE_BIHARI, + wxLANGUAGE_BISLAMA, + wxLANGUAGE_BLIN, + wxLANGUAGE_BLIN_ERITREA, + wxLANGUAGE_BODO, + wxLANGUAGE_BODO_INDIA, + wxLANGUAGE_BOSNIAN, + wxLANGUAGE_BOSNIAN_CYRILLIC, + wxLANGUAGE_BOSNIAN_CYRILLIC_BOSNIA_AND_HERZEGOVINA, + wxLANGUAGE_BOSNIAN_LATIN, + wxLANGUAGE_BOSNIAN_LATIN_BOSNIA_AND_HERZEGOVINA, + wxLANGUAGE_BRETON, + wxLANGUAGE_BRETON_FRANCE, + wxLANGUAGE_BULGARIAN, + wxLANGUAGE_BULGARIAN_BULGARIA, + wxLANGUAGE_BURMESE, + wxLANGUAGE_BURMESE_MYANMAR, + wxLANGUAGE_CATALAN, + wxLANGUAGE_CATALAN_ANDORRA, + wxLANGUAGE_CATALAN_FRANCE, + wxLANGUAGE_CATALAN_ITALY, + wxLANGUAGE_CATALAN_SPAIN, + wxLANGUAGE_CEBUANO, + wxLANGUAGE_CEBUANO_LATIN, + wxLANGUAGE_CEBUANO_LATIN_PHILIPPINES, + wxLANGUAGE_CENTRAL_ATLAS_TAMAZIGHT, + wxLANGUAGE_CENTRAL_ATLAS_TAMAZIGHT_ARABIC, + wxLANGUAGE_CENTRAL_ATLAS_TAMAZIGHT_ARABIC_MOROCCO, + wxLANGUAGE_CENTRAL_ATLAS_TAMAZIGHT_LATIN, + wxLANGUAGE_CENTRAL_ATLAS_TAMAZIGHT_LATIN_ALGERIA, + wxLANGUAGE_CENTRAL_ATLAS_TAMAZIGHT_LATIN_MOROCCO, + wxLANGUAGE_CENTRAL_ATLAS_TAMAZIGHT_TIFINAGH, + wxLANGUAGE_CENTRAL_ATLAS_TAMAZIGHT_TIFINAGH_MOROCCO, + wxLANGUAGE_CENTRAL_KURDISH, + wxLANGUAGE_CENTRAL_KURDISH_IRAQ, + wxLANGUAGE_CHAKMA, + wxLANGUAGE_CHAKMA_CHAKMA, + wxLANGUAGE_CHAKMA_CHAKMA_BANGLADESH, + wxLANGUAGE_CHAKMA_CHAKMA_INDIA, + wxLANGUAGE_CHECHEN, + wxLANGUAGE_CHECHEN_RUSSIA, + wxLANGUAGE_CHEROKEE, + wxLANGUAGE_CHEROKEE_CHEROKEE, + wxLANGUAGE_CHEROKEE_US, + wxLANGUAGE_CHIGA, + wxLANGUAGE_CHIGA_UGANDA, + wxLANGUAGE_CHINESE, + wxLANGUAGE_CHINESE_CHINA, + wxLANGUAGE_CHINESE_HONGKONG, + wxLANGUAGE_CHINESE_MACAO, + wxLANGUAGE_CHINESE_SIMPLIFIED_EXPLICIT, + wxLANGUAGE_CHINESE_SIMPLIFIED_HONGKONG, + wxLANGUAGE_CHINESE_SIMPLIFIED_MACAO, + wxLANGUAGE_CHINESE_SINGAPORE, + wxLANGUAGE_CHINESE_TAIWAN, + wxLANGUAGE_CHINESE_TRADITIONAL_EXPLICIT, + wxLANGUAGE_CHURCH_SLAVIC, + wxLANGUAGE_CHURCH_SLAVIC_RUSSIA, + wxLANGUAGE_COLOGNIAN, + wxLANGUAGE_COLOGNIAN_GERMANY, + wxLANGUAGE_CORNISH, + wxLANGUAGE_CORNISH_UK, + wxLANGUAGE_CORSICAN, + wxLANGUAGE_CORSICAN_FRANCE, + wxLANGUAGE_CROATIAN, + wxLANGUAGE_CROATIAN_BOSNIA_AND_HERZEGOVINA, + wxLANGUAGE_CROATIAN_CROATIA, + wxLANGUAGE_CZECH, + wxLANGUAGE_CZECH_CZECHIA, + wxLANGUAGE_DANISH, + wxLANGUAGE_DANISH_DENMARK, + wxLANGUAGE_DANISH_GREENLAND, + wxLANGUAGE_DARI, + wxLANGUAGE_DARI_AFGHANISTAN, + wxLANGUAGE_DIVEHI, + wxLANGUAGE_DIVEHI_MALDIVES, + wxLANGUAGE_DUALA, + wxLANGUAGE_DUALA_CAMEROON, + wxLANGUAGE_DUTCH, + wxLANGUAGE_DUTCH_ARUBA, + wxLANGUAGE_DUTCH_BELGIAN, + wxLANGUAGE_DUTCH_BONAIRE_SINT_EUSTATIUS_AND_SABA, + wxLANGUAGE_DUTCH_CURACAO, + wxLANGUAGE_DUTCH_NETHERLANDS, + wxLANGUAGE_DUTCH_SINT_MAARTEN, + wxLANGUAGE_DUTCH_SURINAME, + wxLANGUAGE_DZONGKHA, + wxLANGUAGE_DZONGKHA_BHUTAN, + wxLANGUAGE_EDO, + wxLANGUAGE_EDO_NIGERIA, + wxLANGUAGE_EMBU, + wxLANGUAGE_EMBU_KENYA, + wxLANGUAGE_ENGLISH, + wxLANGUAGE_ENGLISH_AMERICAN_SAMOA, + wxLANGUAGE_ENGLISH_ANGUILLA, + wxLANGUAGE_ENGLISH_ANTIGUA_AND_BARBUDA, + wxLANGUAGE_ENGLISH_AUSTRALIA, + wxLANGUAGE_ENGLISH_AUSTRIA, + wxLANGUAGE_ENGLISH_BAHAMAS, + wxLANGUAGE_ENGLISH_BARBADOS, + wxLANGUAGE_ENGLISH_BELGIUM, + wxLANGUAGE_ENGLISH_BELIZE, + wxLANGUAGE_ENGLISH_BERMUDA, + wxLANGUAGE_ENGLISH_BOTSWANA, + wxLANGUAGE_ENGLISH_BRITISH_INDIAN_OCEAN_TERRITORY, + wxLANGUAGE_ENGLISH_BRITISH_VIRGIN_ISLANDS, + wxLANGUAGE_ENGLISH_BURUNDI, + wxLANGUAGE_ENGLISH_CAMEROON, + wxLANGUAGE_ENGLISH_CANADA, + wxLANGUAGE_ENGLISH_CARIBBEAN, + wxLANGUAGE_ENGLISH_CARIBBEAN_CB, + wxLANGUAGE_ENGLISH_CAYMAN_ISLANDS, + wxLANGUAGE_ENGLISH_CHRISTMAS_ISLAND, + wxLANGUAGE_ENGLISH_COCOS_KEELING_ISLANDS, + wxLANGUAGE_ENGLISH_COOK_ISLANDS, + wxLANGUAGE_ENGLISH_CYPRUS, + wxLANGUAGE_ENGLISH_DENMARK, + wxLANGUAGE_ENGLISH_DOMINICA, + wxLANGUAGE_ENGLISH_EIRE, + wxLANGUAGE_ENGLISH_ERITREA, + wxLANGUAGE_ENGLISH_ESWATINI, + wxLANGUAGE_ENGLISH_EUROPE, + wxLANGUAGE_ENGLISH_FALKLAND_ISLANDS, + wxLANGUAGE_ENGLISH_FIJI, + wxLANGUAGE_ENGLISH_FINLAND, + wxLANGUAGE_ENGLISH_GAMBIA, + wxLANGUAGE_ENGLISH_GERMANY, + wxLANGUAGE_ENGLISH_GHANA, + wxLANGUAGE_ENGLISH_GIBRALTAR, + wxLANGUAGE_ENGLISH_GRENADA, + wxLANGUAGE_ENGLISH_GUAM, + wxLANGUAGE_ENGLISH_GUERNSEY, + wxLANGUAGE_ENGLISH_GUYANA, + wxLANGUAGE_ENGLISH_HONG_KONG_SAR, + wxLANGUAGE_ENGLISH_INDIA, + wxLANGUAGE_ENGLISH_INDONESIA, + wxLANGUAGE_ENGLISH_ISLE_OF_MAN, + wxLANGUAGE_ENGLISH_ISRAEL, + wxLANGUAGE_ENGLISH_JAMAICA, + wxLANGUAGE_ENGLISH_JERSEY, + wxLANGUAGE_ENGLISH_KENYA, + wxLANGUAGE_ENGLISH_KIRIBATI, + wxLANGUAGE_ENGLISH_LESOTHO, + wxLANGUAGE_ENGLISH_LIBERIA, + wxLANGUAGE_ENGLISH_MACAO_SAR, + wxLANGUAGE_ENGLISH_MADAGASCAR, + wxLANGUAGE_ENGLISH_MALAWI, + wxLANGUAGE_ENGLISH_MALAYSIA, + wxLANGUAGE_ENGLISH_MALTA, + wxLANGUAGE_ENGLISH_MARSHALL_ISLANDS, + wxLANGUAGE_ENGLISH_MAURITIUS, + wxLANGUAGE_ENGLISH_MICRONESIA, + wxLANGUAGE_ENGLISH_MONTSERRAT, + wxLANGUAGE_ENGLISH_NAMIBIA, + wxLANGUAGE_ENGLISH_NAURU, + wxLANGUAGE_ENGLISH_NETHERLANDS, + wxLANGUAGE_ENGLISH_NEW_ZEALAND, + wxLANGUAGE_ENGLISH_NIGERIA, + wxLANGUAGE_ENGLISH_NIUE, + wxLANGUAGE_ENGLISH_NORFOLK_ISLAND, + wxLANGUAGE_ENGLISH_NORTHERN_MARIANA_ISLANDS, + wxLANGUAGE_ENGLISH_PAKISTAN, + wxLANGUAGE_ENGLISH_PALAU, + wxLANGUAGE_ENGLISH_PAPUA_NEW_GUINEA, + wxLANGUAGE_ENGLISH_PHILIPPINES, + wxLANGUAGE_ENGLISH_PITCAIRN_ISLANDS, + wxLANGUAGE_ENGLISH_PUERTO_RICO, + wxLANGUAGE_ENGLISH_RWANDA, + wxLANGUAGE_ENGLISH_SAMOA, + wxLANGUAGE_ENGLISH_SEYCHELLES, + wxLANGUAGE_ENGLISH_SIERRA_LEONE, + wxLANGUAGE_ENGLISH_SINGAPORE, + wxLANGUAGE_ENGLISH_SINT_MAARTEN, + wxLANGUAGE_ENGLISH_SLOVENIA, + wxLANGUAGE_ENGLISH_SOLOMON_ISLANDS, + wxLANGUAGE_ENGLISH_SOUTH_AFRICA, + wxLANGUAGE_ENGLISH_SOUTH_SUDAN, + wxLANGUAGE_ENGLISH_ST_HELENA_ASCENSION_TRISTAN_DA_CUNHA, + wxLANGUAGE_ENGLISH_ST_KITTS_AND_NEVIS, + wxLANGUAGE_ENGLISH_ST_LUCIA, + wxLANGUAGE_ENGLISH_ST_VINCENT_AND_GRENADINES, + wxLANGUAGE_ENGLISH_SUDAN, + wxLANGUAGE_ENGLISH_SWEDEN, + wxLANGUAGE_ENGLISH_SWITZERLAND, + wxLANGUAGE_ENGLISH_TANZANIA, + wxLANGUAGE_ENGLISH_TOKELAU, + wxLANGUAGE_ENGLISH_TONGA, + wxLANGUAGE_ENGLISH_TRINIDAD, + wxLANGUAGE_ENGLISH_TURKS_AND_CAICOS_ISLANDS, + wxLANGUAGE_ENGLISH_TUVALU, + wxLANGUAGE_ENGLISH_UGANDA, + wxLANGUAGE_ENGLISH_UK, + wxLANGUAGE_ENGLISH_UNITED_ARAB_EMIRATES, + wxLANGUAGE_ENGLISH_US, + wxLANGUAGE_ENGLISH_US_OUTLYING_ISLANDS, + wxLANGUAGE_ENGLISH_US_VIRGIN_ISLANDS, + wxLANGUAGE_ENGLISH_VANUATU, + wxLANGUAGE_ENGLISH_WORLD, + wxLANGUAGE_ENGLISH_ZAMBIA, + wxLANGUAGE_ENGLISH_ZIMBABWE, + wxLANGUAGE_ESPERANTO, + wxLANGUAGE_ESPERANTO_WORLD, + wxLANGUAGE_ESTONIAN, + wxLANGUAGE_ESTONIAN_ESTONIA, + wxLANGUAGE_EWE, + wxLANGUAGE_EWE_GHANA, + wxLANGUAGE_EWE_TOGO, + wxLANGUAGE_EWONDO, + wxLANGUAGE_EWONDO_CAMEROON, + wxLANGUAGE_FAEROESE, + wxLANGUAGE_FAEROESE_DENMARK, + wxLANGUAGE_FAEROESE_FAROE_ISLANDS, + wxLANGUAGE_FARSI, + wxLANGUAGE_FIJI, + wxLANGUAGE_FILIPINO, + wxLANGUAGE_FILIPINO_PHILIPPINES, + wxLANGUAGE_FINNISH, + wxLANGUAGE_FINNISH_FINLAND, + wxLANGUAGE_FRENCH, + wxLANGUAGE_FRENCH_ALGERIA, + wxLANGUAGE_FRENCH_BELGIAN, + wxLANGUAGE_FRENCH_BENIN, + wxLANGUAGE_FRENCH_BURKINA_FASO, + wxLANGUAGE_FRENCH_BURUNDI, + wxLANGUAGE_FRENCH_CAMEROON, + wxLANGUAGE_FRENCH_CANADIAN, + wxLANGUAGE_FRENCH_CARIBBEAN, + wxLANGUAGE_FRENCH_CENTRAL_AFRICAN_REPUBLIC, + wxLANGUAGE_FRENCH_CHAD, + wxLANGUAGE_FRENCH_COMOROS, + wxLANGUAGE_FRENCH_CONGO, + wxLANGUAGE_FRENCH_CONGO_DRC, + wxLANGUAGE_FRENCH_COTE_DIVOIRE, + wxLANGUAGE_FRENCH_DJIBOUTI, + wxLANGUAGE_FRENCH_EQUATORIAL_GUINEA, + wxLANGUAGE_FRENCH_FRANCE, + wxLANGUAGE_FRENCH_FRENCH_GUIANA, + wxLANGUAGE_FRENCH_FRENCH_POLYNESIA, + wxLANGUAGE_FRENCH_GABON, + wxLANGUAGE_FRENCH_GUADELOUPE, + wxLANGUAGE_FRENCH_GUINEA, + wxLANGUAGE_FRENCH_HAITI, + wxLANGUAGE_FRENCH_LUXEMBOURG, + wxLANGUAGE_FRENCH_MADAGASCAR, + wxLANGUAGE_FRENCH_MALI, + wxLANGUAGE_FRENCH_MARTINIQUE, + wxLANGUAGE_FRENCH_MAURITANIA, + wxLANGUAGE_FRENCH_MAURITIUS, + wxLANGUAGE_FRENCH_MAYOTTE, + wxLANGUAGE_FRENCH_MONACO, + wxLANGUAGE_FRENCH_MOROCCO, + wxLANGUAGE_FRENCH_NEW_CALEDONIA, + wxLANGUAGE_FRENCH_NIGER, + wxLANGUAGE_FRENCH_REUNION, + wxLANGUAGE_FRENCH_RWANDA, + wxLANGUAGE_FRENCH_SENEGAL, + wxLANGUAGE_FRENCH_SEYCHELLES, + wxLANGUAGE_FRENCH_ST_BARTHELEMY, + wxLANGUAGE_FRENCH_ST_MARTIN, + wxLANGUAGE_FRENCH_ST_PIERRE_AND_MIQUELON, + wxLANGUAGE_FRENCH_SWISS, + wxLANGUAGE_FRENCH_SYRIA, + wxLANGUAGE_FRENCH_TOGO, + wxLANGUAGE_FRENCH_TUNISIA, + wxLANGUAGE_FRENCH_VANUATU, + wxLANGUAGE_FRENCH_WALLIS_AND_FUTUNA, + wxLANGUAGE_FRISIAN, + wxLANGUAGE_FRISIAN_NETHERLANDS, + wxLANGUAGE_FRIULIAN, + wxLANGUAGE_FRIULIAN_ITALY, + wxLANGUAGE_FULAH, + wxLANGUAGE_FULAH_LATIN, + wxLANGUAGE_FULAH_LATIN_BURKINA_FASO, + wxLANGUAGE_FULAH_LATIN_CAMEROON, + wxLANGUAGE_FULAH_LATIN_GAMBIA, + wxLANGUAGE_FULAH_LATIN_GHANA, + wxLANGUAGE_FULAH_LATIN_GUINEA, + wxLANGUAGE_FULAH_LATIN_GUINEA_BISSAU, + wxLANGUAGE_FULAH_LATIN_LIBERIA, + wxLANGUAGE_FULAH_LATIN_MAURITANIA, + wxLANGUAGE_FULAH_LATIN_NIGER, + wxLANGUAGE_FULAH_LATIN_NIGERIA, + wxLANGUAGE_FULAH_LATIN_SENEGAL, + wxLANGUAGE_FULAH_LATIN_SIERRA_LEONE, + wxLANGUAGE_GALICIAN, + wxLANGUAGE_GALICIAN_SPAIN, + wxLANGUAGE_GANDA, + wxLANGUAGE_GANDA_UGANDA, + wxLANGUAGE_GEORGIAN, + wxLANGUAGE_GEORGIAN_GEORGIA, + wxLANGUAGE_GERMAN, + wxLANGUAGE_GERMAN_AUSTRIAN, + wxLANGUAGE_GERMAN_BELGIUM, + wxLANGUAGE_GERMAN_GERMANY, + wxLANGUAGE_GERMAN_ITALY, + wxLANGUAGE_GERMAN_LIECHTENSTEIN, + wxLANGUAGE_GERMAN_LUXEMBOURG, + wxLANGUAGE_GERMAN_SWISS, + wxLANGUAGE_GREEK, + wxLANGUAGE_GREEK_CYPRUS, + wxLANGUAGE_GREEK_GREECE, + wxLANGUAGE_GREENLANDIC, + wxLANGUAGE_GUARANI, + wxLANGUAGE_GUARANI_PARAGUAY, + wxLANGUAGE_GUJARATI, + wxLANGUAGE_GUJARATI_INDIA, + wxLANGUAGE_GUSII, + wxLANGUAGE_GUSII_KENYA, + wxLANGUAGE_HAUSA, + wxLANGUAGE_HAUSA_LATIN, + wxLANGUAGE_HAUSA_LATIN_GHANA, + wxLANGUAGE_HAUSA_LATIN_NIGER, + wxLANGUAGE_HAUSA_LATIN_NIGERIA, + wxLANGUAGE_HAWAIIAN, + wxLANGUAGE_HAWAIIAN_US, + wxLANGUAGE_HEBREW, + wxLANGUAGE_HEBREW_ISRAEL, + wxLANGUAGE_HINDI, + wxLANGUAGE_HINDI_INDIA, + wxLANGUAGE_HUNGARIAN, + wxLANGUAGE_HUNGARIAN_HUNGARY, + wxLANGUAGE_IBIBIO, + wxLANGUAGE_IBIBIO_NIGERIA, + wxLANGUAGE_ICELANDIC, + wxLANGUAGE_ICELANDIC_ICELAND, + wxLANGUAGE_IGBO, + wxLANGUAGE_IGBO_NIGERIA, + wxLANGUAGE_INDONESIAN, + wxLANGUAGE_INDONESIAN_INDONESIA, + wxLANGUAGE_INTERLINGUA, + wxLANGUAGE_INTERLINGUA_WORLD, + wxLANGUAGE_INTERLINGUE, + wxLANGUAGE_INUKTITUT, + wxLANGUAGE_INUKTITUT_LATIN, + wxLANGUAGE_INUKTITUT_LATIN_CANADA, + wxLANGUAGE_INUKTITUT_SYLLABICS, + wxLANGUAGE_INUKTITUT_SYLLABICS_CANADA, + wxLANGUAGE_INUPIAK, + wxLANGUAGE_IRISH, + wxLANGUAGE_IRISH_IRELAND, + wxLANGUAGE_ITALIAN, + wxLANGUAGE_ITALIAN_ITALY, + wxLANGUAGE_ITALIAN_SAN_MARINO, + wxLANGUAGE_ITALIAN_SWISS, + wxLANGUAGE_ITALIAN_VATICAN_CITY, + wxLANGUAGE_JAPANESE, + wxLANGUAGE_JAPANESE_JAPAN, + wxLANGUAGE_JAVANESE, + wxLANGUAGE_JAVANESE_INDONESIA, + wxLANGUAGE_JAVANESE_JAVANESE, + wxLANGUAGE_JAVANESE_JAVANESE_INDONESIA, + wxLANGUAGE_JOLA_FONYI, + wxLANGUAGE_JOLA_FONYI_SENEGAL, + wxLANGUAGE_KABUVERDIANU, + wxLANGUAGE_KABUVERDIANU_CABO_VERDE, + wxLANGUAGE_KABYLE, + wxLANGUAGE_KABYLE_ALGERIA, + wxLANGUAGE_KAKO, + wxLANGUAGE_KAKO_CAMEROON, + wxLANGUAGE_KALAALLISUT, + wxLANGUAGE_KALENJIN, + wxLANGUAGE_KALENJIN_KENYA, + wxLANGUAGE_KAMBA, + wxLANGUAGE_KAMBA_KENYA, + wxLANGUAGE_KANNADA, + wxLANGUAGE_KANNADA_INDIA, + wxLANGUAGE_KANURI, + wxLANGUAGE_KANURI_LATIN, + wxLANGUAGE_KANURI_NIGERIA, + wxLANGUAGE_KASHMIRI, + wxLANGUAGE_KASHMIRI_DEVANAGARI, + wxLANGUAGE_KASHMIRI_DEVANAGARI_INDIA, + wxLANGUAGE_KASHMIRI_INDIA, + wxLANGUAGE_KASHMIRI_PERSO_ARABIC, + wxLANGUAGE_KASHMIRI_PERSO_ARABIC_INDIA, + wxLANGUAGE_KAZAKH, + wxLANGUAGE_KAZAKH_KAZAKHSTAN, + wxLANGUAGE_KHMER, + wxLANGUAGE_KHMER_CAMBODIA, + wxLANGUAGE_KICHE, + wxLANGUAGE_KICHE_GUATEMALA, + wxLANGUAGE_KICHE_LATIN, + wxLANGUAGE_KIKUYU, + wxLANGUAGE_KIKUYU_KENYA, + wxLANGUAGE_KINYARWANDA, + wxLANGUAGE_KINYARWANDA_RWANDA, + wxLANGUAGE_KIRGHIZ, + wxLANGUAGE_KIRGHIZ_KYRGYZSTAN, + wxLANGUAGE_KIRUNDI, + wxLANGUAGE_KIRUNDI_BURUNDI, + wxLANGUAGE_KONKANI, + wxLANGUAGE_KONKANI_INDIA, + wxLANGUAGE_KOREAN, + wxLANGUAGE_KOREAN_KOREA, + wxLANGUAGE_KOREAN_NORTH_KOREA, + wxLANGUAGE_KOYRABORO_SENNI, + wxLANGUAGE_KOYRABORO_SENNI_MALI, + wxLANGUAGE_KOYRA_CHIINI, + wxLANGUAGE_KOYRA_CHIINI_MALI, + wxLANGUAGE_KURDISH, + wxLANGUAGE_KURDISH_PERSO_ARABIC_IRAN, + wxLANGUAGE_KWASIO, + wxLANGUAGE_KWASIO_CAMEROON, + wxLANGUAGE_LAKOTA, + wxLANGUAGE_LAKOTA_US, + wxLANGUAGE_LANGI, + wxLANGUAGE_LANGI_TANZANIA, + wxLANGUAGE_LAOTHIAN, + wxLANGUAGE_LAOTHIAN_LAOS, + wxLANGUAGE_LATIN, + wxLANGUAGE_LATIN_WORLD, + wxLANGUAGE_LATVIAN, + wxLANGUAGE_LATVIAN_LATVIA, + wxLANGUAGE_LINGALA, + wxLANGUAGE_LINGALA_ANGOLA, + wxLANGUAGE_LINGALA_CENTRAL_AFRICAN_REPUBLIC, + wxLANGUAGE_LINGALA_CONGO, + wxLANGUAGE_LINGALA_CONGO_DRC, + wxLANGUAGE_LITHUANIAN, + wxLANGUAGE_LITHUANIAN_LITHUANIA, + wxLANGUAGE_LOWER_SORBIAN, + wxLANGUAGE_LOWER_SORBIAN_GERMANY, + wxLANGUAGE_LOW_GERMAN, + wxLANGUAGE_LOW_GERMAN_GERMANY, + wxLANGUAGE_LOW_GERMAN_NETHERLANDS, + wxLANGUAGE_LUBA_KATANGA, + wxLANGUAGE_LUBA_KATANGA_CONGO_DRC, + wxLANGUAGE_LUO, + wxLANGUAGE_LUO_KENYA, + wxLANGUAGE_LUXEMBOURGISH, + wxLANGUAGE_LUXEMBOURGISH_LUXEMBOURG, + wxLANGUAGE_LUYIA, + wxLANGUAGE_LUYIA_KENYA, + wxLANGUAGE_MACEDONIAN, + wxLANGUAGE_MACEDONIAN_NORTH_MACEDONIA, + wxLANGUAGE_MACHAME, + wxLANGUAGE_MACHAME_TANZANIA, + wxLANGUAGE_MAKHUWA_MEETTO, + wxLANGUAGE_MAKHUWA_MEETTO_MOZAMBIQUE, + wxLANGUAGE_MAKONDE, + wxLANGUAGE_MAKONDE_TANZANIA, + wxLANGUAGE_MALAGASY, + wxLANGUAGE_MALAGASY_MADAGASCAR, + wxLANGUAGE_MALAY, + wxLANGUAGE_MALAYALAM, + wxLANGUAGE_MALAYALAM_INDIA, + wxLANGUAGE_MALAY_BRUNEI, + wxLANGUAGE_MALAY_MALAYSIA, + wxLANGUAGE_MALAY_SINGAPORE, + wxLANGUAGE_MALTESE, + wxLANGUAGE_MALTESE_MALTA, + wxLANGUAGE_MANIPURI, + wxLANGUAGE_MANIPURI_INDIA, + wxLANGUAGE_MANX, + wxLANGUAGE_MANX_ISLE_OF_MAN, + wxLANGUAGE_MAORI, + wxLANGUAGE_MAORI_NEW_ZEALAND, + wxLANGUAGE_MAPUCHE, + wxLANGUAGE_MAPUCHE_CHILE, + wxLANGUAGE_MARATHI, + wxLANGUAGE_MARATHI_INDIA, + wxLANGUAGE_MASAI, + wxLANGUAGE_MASAI_KENYA, + wxLANGUAGE_MASAI_TANZANIA, + wxLANGUAGE_MAZANDERANI, + wxLANGUAGE_MAZANDERANI_IRAN, + wxLANGUAGE_MERU, + wxLANGUAGE_MERU_KENYA, + wxLANGUAGE_META, + wxLANGUAGE_META_CAMEROON, + wxLANGUAGE_MOHAWK, + wxLANGUAGE_MOHAWK_CANADA, + wxLANGUAGE_MOLDAVIAN, + wxLANGUAGE_MONGOLIAN, + wxLANGUAGE_MONGOLIAN_CYRILLIC, + wxLANGUAGE_MONGOLIAN_MONGOLIA, + wxLANGUAGE_MONGOLIAN_TRADITIONAL, + wxLANGUAGE_MONGOLIAN_TRADITIONAL_CHINA, + wxLANGUAGE_MONGOLIAN_TRADITIONAL_MONGOLIA, + wxLANGUAGE_MORISYEN, + wxLANGUAGE_MORISYEN_MAURITIUS, + wxLANGUAGE_MUNDANG, + wxLANGUAGE_MUNDANG_CAMEROON, + wxLANGUAGE_NAMA, + wxLANGUAGE_NAMA_NAMIBIA, + wxLANGUAGE_NAURU, + wxLANGUAGE_NEPALI, + wxLANGUAGE_NEPALI_INDIA, + wxLANGUAGE_NEPALI_NEPAL, + wxLANGUAGE_NGIEMBOON, + wxLANGUAGE_NGIEMBOON_CAMEROON, + wxLANGUAGE_NGOMBA, + wxLANGUAGE_NGOMBA_CAMEROON, + wxLANGUAGE_NKO, + wxLANGUAGE_NKO_GUINEA, + wxLANGUAGE_NORTHERN_LURI, + wxLANGUAGE_NORTHERN_LURI_IRAN, + wxLANGUAGE_NORTHERN_LURI_IRAQ, + wxLANGUAGE_NORTH_NDEBELE, + wxLANGUAGE_NORTH_NDEBELE_ZIMBABWE, + wxLANGUAGE_NORWEGIAN, + wxLANGUAGE_NORWEGIAN_BOKMAL, + wxLANGUAGE_NORWEGIAN_BOKMAL_NORWAY, + wxLANGUAGE_NORWEGIAN_BOKMAL_SVALBARD_AND_JAN_MAYEN, + wxLANGUAGE_NORWEGIAN_NYNORSK, + wxLANGUAGE_NORWEGIAN_NYNORSK_NORWAY, + wxLANGUAGE_NUER, + wxLANGUAGE_NUER_SOUTH_SUDAN, + wxLANGUAGE_NYANKOLE, + wxLANGUAGE_NYANKOLE_UGANDA, + wxLANGUAGE_OCCITAN, + wxLANGUAGE_OCCITAN_FRANCE, + wxLANGUAGE_ODIA, + wxLANGUAGE_ODIA_INDIA, + wxLANGUAGE_OROMO, + wxLANGUAGE_OROMO_ETHIOPIA, + wxLANGUAGE_OROMO_KENYA, + wxLANGUAGE_OSSETIC, + wxLANGUAGE_OSSETIC_GEORGIA, + wxLANGUAGE_OSSETIC_RUSSIA, + wxLANGUAGE_PAPIAMENTO, + wxLANGUAGE_PAPIAMENTO_CARIBBEAN, + wxLANGUAGE_PASHTO, + wxLANGUAGE_PASHTO_AFGHANISTAN, + wxLANGUAGE_PASHTO_PAKISTAN, + wxLANGUAGE_PERSIAN_IRAN, + wxLANGUAGE_POLISH, + wxLANGUAGE_POLISH_POLAND, + wxLANGUAGE_PORTUGUESE, + wxLANGUAGE_PORTUGUESE_ANGOLA, + wxLANGUAGE_PORTUGUESE_BRAZILIAN, + wxLANGUAGE_PORTUGUESE_CABO_VERDE, + wxLANGUAGE_PORTUGUESE_EQUATORIAL_GUINEA, + wxLANGUAGE_PORTUGUESE_GUINEA_BISSAU, + wxLANGUAGE_PORTUGUESE_LUXEMBOURG, + wxLANGUAGE_PORTUGUESE_MACAO_SAR, + wxLANGUAGE_PORTUGUESE_MOZAMBIQUE, + wxLANGUAGE_PORTUGUESE_PORTUGAL, + wxLANGUAGE_PORTUGUESE_SAO_TOME_AND_PRINCIPE, + wxLANGUAGE_PORTUGUESE_SWITZERLAND, + wxLANGUAGE_PORTUGUESE_TIMOR_LESTE, + wxLANGUAGE_PRUSSIAN, + wxLANGUAGE_PRUSSIAN_WORLD, + wxLANGUAGE_PUNJABI, + wxLANGUAGE_PUNJABI_ARABIC, + wxLANGUAGE_PUNJABI_GURMUKHI, + wxLANGUAGE_PUNJABI_INDIA, + wxLANGUAGE_PUNJABI_PAKISTAN, + wxLANGUAGE_QUECHUA, + wxLANGUAGE_QUECHUA_BOLIVIA, + wxLANGUAGE_QUECHUA_ECUADOR, + wxLANGUAGE_QUECHUA_MACRO, + wxLANGUAGE_QUECHUA_PERU, + wxLANGUAGE_RHAETO_ROMANCE, + wxLANGUAGE_RHAETO_ROMANCE_SWITZERLAND, + wxLANGUAGE_ROMANIAN, + wxLANGUAGE_ROMANIAN_MOLDOVA, + wxLANGUAGE_ROMANIAN_ROMANIA, + wxLANGUAGE_ROMBO, + wxLANGUAGE_ROMBO_TANZANIA, + wxLANGUAGE_RUSSIAN, + wxLANGUAGE_RUSSIAN_BELARUS, + wxLANGUAGE_RUSSIAN_KAZAKHSTAN, + wxLANGUAGE_RUSSIAN_KYRGYZSTAN, + wxLANGUAGE_RUSSIAN_MOLDOVA, + wxLANGUAGE_RUSSIAN_RUSSIA, + wxLANGUAGE_RUSSIAN_UKRAINE, + wxLANGUAGE_RWA, + wxLANGUAGE_RWA_TANZANIA, + wxLANGUAGE_SAHO, + wxLANGUAGE_SAHO_ERITREA, + wxLANGUAGE_SAKHA, + wxLANGUAGE_SAKHA_RUSSIA, + wxLANGUAGE_SAMBURU, + wxLANGUAGE_SAMBURU_KENYA, + wxLANGUAGE_SAMI, + wxLANGUAGE_SAMI_FINLAND, + wxLANGUAGE_SAMI_INARI, + wxLANGUAGE_SAMI_INARI_FINLAND, + wxLANGUAGE_SAMI_LULE, + wxLANGUAGE_SAMI_LULE_NORWAY, + wxLANGUAGE_SAMI_LULE_SWEDEN, + wxLANGUAGE_SAMI_NORWAY, + wxLANGUAGE_SAMI_SKOLT, + wxLANGUAGE_SAMI_SKOLT_FINLAND, + wxLANGUAGE_SAMI_SOUTHERN, + wxLANGUAGE_SAMI_SOUTHERN_NORWAY, + wxLANGUAGE_SAMI_SOUTHERN_SWEDEN, + wxLANGUAGE_SAMI_SWEDEN, + wxLANGUAGE_SAMOAN, + wxLANGUAGE_SANGHO, + wxLANGUAGE_SANGHO_CENTRAL_AFRICAN_REPUBLIC, + wxLANGUAGE_SANGU, + wxLANGUAGE_SANGU_TANZANIA, + wxLANGUAGE_SANSKRIT, + wxLANGUAGE_SANSKRIT_INDIA, + wxLANGUAGE_SCOTS_GAELIC, + wxLANGUAGE_SCOTS_GAELIC_UK, + wxLANGUAGE_SENA, + wxLANGUAGE_SENA_MOZAMBIQUE, + wxLANGUAGE_SERBIAN, + wxLANGUAGE_SERBIAN_CYRILLIC, + wxLANGUAGE_SERBIAN_CYRILLIC_BOSNIA_AND_HERZEGOVINA, + wxLANGUAGE_SERBIAN_CYRILLIC_KOSOVO, + wxLANGUAGE_SERBIAN_CYRILLIC_MONTENEGRO, + wxLANGUAGE_SERBIAN_CYRILLIC_SERBIA, + wxLANGUAGE_SERBIAN_CYRILLIC_YU, + wxLANGUAGE_SERBIAN_LATIN, + wxLANGUAGE_SERBIAN_LATIN_BOSNIA_AND_HERZEGOVINA, + wxLANGUAGE_SERBIAN_LATIN_KOSOVO, + wxLANGUAGE_SERBIAN_LATIN_MONTENEGRO, + wxLANGUAGE_SERBIAN_LATIN_SERBIA, + wxLANGUAGE_SERBIAN_LATIN_YU, + wxLANGUAGE_SERBIAN_SERBIA, + wxLANGUAGE_SERBIAN_YU, + wxLANGUAGE_SERBO_CROATIAN, + wxLANGUAGE_SESOTHO, + wxLANGUAGE_SESOTHO_LESOTHO, + wxLANGUAGE_SESOTHO_SA_LEBOA, + wxLANGUAGE_SESOTHO_SA_LEBOA_SOUTH_AFRICA, + wxLANGUAGE_SESOTHO_SOUTH_AFRICA, + wxLANGUAGE_SETSWANA, + wxLANGUAGE_SETSWANA_BOTSWANA, + wxLANGUAGE_SETSWANA_SOUTH_AFRICA, + wxLANGUAGE_SHAMBALA, + wxLANGUAGE_SHAMBALA_TANZANIA, + wxLANGUAGE_SHONA, + wxLANGUAGE_SHONA_LATIN, + wxLANGUAGE_SHONA_LATIN_ZIMBABWE, + wxLANGUAGE_SINDHI, + wxLANGUAGE_SINDHI_ARABIC, + wxLANGUAGE_SINDHI_DEVANAGARI, + wxLANGUAGE_SINDHI_DEVANAGARI_INDIA, + wxLANGUAGE_SINDHI_PAKISTAN, + wxLANGUAGE_SINHALESE, + wxLANGUAGE_SINHALESE_SRI_LANKA, + wxLANGUAGE_SISWATI, + wxLANGUAGE_SISWATI_ESWATINI, + wxLANGUAGE_SISWATI_SOUTH_AFRICA, + wxLANGUAGE_SLOVAK, + wxLANGUAGE_SLOVAK_SLOVAKIA, + wxLANGUAGE_SLOVENIAN, + wxLANGUAGE_SLOVENIAN_SLOVENIA, + wxLANGUAGE_SOGA, + wxLANGUAGE_SOGA_UGANDA, + wxLANGUAGE_SOMALI, + wxLANGUAGE_SOMALI_DJIBOUTI, + wxLANGUAGE_SOMALI_ETHIOPIA, + wxLANGUAGE_SOMALI_KENYA, + wxLANGUAGE_SOMALI_SOMALIA, + wxLANGUAGE_SOUTH_NDEBELE, + wxLANGUAGE_SOUTH_NDEBELE_SOUTH_AFRICA, + wxLANGUAGE_SPANISH, + wxLANGUAGE_SPANISH_ARGENTINA, + wxLANGUAGE_SPANISH_BELIZE, + wxLANGUAGE_SPANISH_BOLIVIA, + wxLANGUAGE_SPANISH_BRAZIL, + wxLANGUAGE_SPANISH_CHILE, + wxLANGUAGE_SPANISH_COLOMBIA, + wxLANGUAGE_SPANISH_COSTA_RICA, + wxLANGUAGE_SPANISH_CUBA, + wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC, + wxLANGUAGE_SPANISH_ECUADOR, + wxLANGUAGE_SPANISH_EL_SALVADOR, + wxLANGUAGE_SPANISH_EQUATORIAL_GUINEA, + wxLANGUAGE_SPANISH_GUATEMALA, + wxLANGUAGE_SPANISH_HONDURAS, + wxLANGUAGE_SPANISH_LATIN_AMERICA, + wxLANGUAGE_SPANISH_MEXICAN, + wxLANGUAGE_SPANISH_NICARAGUA, + wxLANGUAGE_SPANISH_PANAMA, + wxLANGUAGE_SPANISH_PARAGUAY, + wxLANGUAGE_SPANISH_PERU, + wxLANGUAGE_SPANISH_PHILIPPINES, + wxLANGUAGE_SPANISH_PUERTO_RICO, + wxLANGUAGE_SPANISH_SPAIN, + wxLANGUAGE_SPANISH_URUGUAY, + wxLANGUAGE_SPANISH_US, + wxLANGUAGE_SPANISH_VENEZUELA, + wxLANGUAGE_STANDARD_MOROCCAN_TAMAZIGHT, + wxLANGUAGE_STANDARD_MOROCCAN_TAMAZIGHT_TIFINAGH, + wxLANGUAGE_STANDARD_MOROCCAN_TAMAZIGHT_TIFINAGH_MOROCCO, + wxLANGUAGE_SUNDANESE, + wxLANGUAGE_SWAHILI, + wxLANGUAGE_SWAHILI_CONGO_DRC, + wxLANGUAGE_SWAHILI_KENYA, + wxLANGUAGE_SWAHILI_TANZANIA, + wxLANGUAGE_SWAHILI_UGANDA, + wxLANGUAGE_SWEDISH, + wxLANGUAGE_SWEDISH_ALAND_ISLANDS, + wxLANGUAGE_SWEDISH_FINLAND, + wxLANGUAGE_SWEDISH_SWEDEN, + wxLANGUAGE_SWISS_GERMAN, + wxLANGUAGE_SWISS_GERMAN_LIECHTENSTEIN, + wxLANGUAGE_SWISS_GERMAN_SWITZERLAND, + wxLANGUAGE_SYRIAC, + wxLANGUAGE_SYRIAC_SYRIA, + wxLANGUAGE_TACHELHIT, + wxLANGUAGE_TACHELHIT_LATIN, + wxLANGUAGE_TACHELHIT_LATIN_MOROCCO, + wxLANGUAGE_TACHELHIT_TIFINAGH, + wxLANGUAGE_TACHELHIT_TIFINAGH_MOROCCO, + wxLANGUAGE_TAGALOG, + wxLANGUAGE_TAITA, + wxLANGUAGE_TAITA_KENYA, + wxLANGUAGE_TAJIK, + wxLANGUAGE_TAJIK_CYRILLIC, + wxLANGUAGE_TAJIK_CYRILLIC_TAJIKISTAN, + wxLANGUAGE_TAMIL, + wxLANGUAGE_TAMIL_INDIA, + wxLANGUAGE_TAMIL_MALAYSIA, + wxLANGUAGE_TAMIL_SINGAPORE, + wxLANGUAGE_TAMIL_SRI_LANKA, + wxLANGUAGE_TASAWAQ, + wxLANGUAGE_TASAWAQ_NIGER, + wxLANGUAGE_TATAR, + wxLANGUAGE_TATAR_RUSSIA, + wxLANGUAGE_TELUGU, + wxLANGUAGE_TELUGU_INDIA, + wxLANGUAGE_TESO, + wxLANGUAGE_TESO_KENYA, + wxLANGUAGE_TESO_UGANDA, + wxLANGUAGE_THAI, + wxLANGUAGE_THAI_THAILAND, + wxLANGUAGE_TIBETAN, + wxLANGUAGE_TIBETAN_CHINA, + wxLANGUAGE_TIBETAN_INDIA, + wxLANGUAGE_TIGRE, + wxLANGUAGE_TIGRE_ERITREA, + wxLANGUAGE_TIGRINYA, + wxLANGUAGE_TIGRINYA_ERITREA, + wxLANGUAGE_TIGRINYA_ETHIOPIA, + wxLANGUAGE_TONGA, + wxLANGUAGE_TONGA_TONGA, + wxLANGUAGE_TSONGA, + wxLANGUAGE_TSONGA_SOUTH_AFRICA, + wxLANGUAGE_TURKISH, + wxLANGUAGE_TURKISH_CYPRUS, + wxLANGUAGE_TURKISH_TURKEY, + wxLANGUAGE_TURKMEN, + wxLANGUAGE_TURKMEN_TURKMENISTAN, + wxLANGUAGE_TWI, + wxLANGUAGE_UIGHUR, + wxLANGUAGE_UIGHUR_CHINA, + wxLANGUAGE_UKRAINIAN, + wxLANGUAGE_UKRAINIAN_UKRAINE, + wxLANGUAGE_UPPER_SORBIAN, + wxLANGUAGE_UPPER_SORBIAN_GERMANY, + wxLANGUAGE_URDU, + wxLANGUAGE_URDU_INDIA, + wxLANGUAGE_URDU_PAKISTAN, + wxLANGUAGE_UZBEK, + wxLANGUAGE_UZBEK_CYRILLIC, + wxLANGUAGE_UZBEK_CYRILLIC_UZBEKISTAN, + wxLANGUAGE_UZBEK_LATIN, + wxLANGUAGE_UZBEK_LATIN_UZBEKISTAN, + wxLANGUAGE_UZBEK_PERSO_ARABIC, + wxLANGUAGE_UZBEK_PERSO_ARABIC_AFGHANISTAN, + wxLANGUAGE_VAI, + wxLANGUAGE_VAI_LATIN, + wxLANGUAGE_VAI_LATIN_LIBERIA, + wxLANGUAGE_VAI_VAI, + wxLANGUAGE_VAI_VAI_LIBERIA, + wxLANGUAGE_VALENCIAN, + wxLANGUAGE_VENDA, + wxLANGUAGE_VENDA_SOUTH_AFRICA, + wxLANGUAGE_VIETNAMESE, + wxLANGUAGE_VIETNAMESE_VIETNAM, + wxLANGUAGE_VOLAPUK, + wxLANGUAGE_VOLAPUK_WORLD, + wxLANGUAGE_VUNJO, + wxLANGUAGE_VUNJO_TANZANIA, + wxLANGUAGE_WALSER, + wxLANGUAGE_WALSER_SWITZERLAND, + wxLANGUAGE_WELSH, + wxLANGUAGE_WELSH_UK, + wxLANGUAGE_WOLAYTTA, + wxLANGUAGE_WOLAYTTA_ETHIOPIA, + wxLANGUAGE_WOLOF, + wxLANGUAGE_WOLOF_SENEGAL, + wxLANGUAGE_XHOSA, + wxLANGUAGE_XHOSA_SOUTH_AFRICA, + wxLANGUAGE_YANGBEN, + wxLANGUAGE_YANGBEN_CAMEROON, + wxLANGUAGE_YI, + wxLANGUAGE_YIDDISH, + wxLANGUAGE_YIDDISH_WORLD, + wxLANGUAGE_YI_CHINA, + wxLANGUAGE_YORUBA, + wxLANGUAGE_YORUBA_BENIN, + wxLANGUAGE_YORUBA_NIGERIA, + wxLANGUAGE_ZARMA, + wxLANGUAGE_ZARMA_NIGER, + wxLANGUAGE_ZHUANG, + wxLANGUAGE_ZULU, + wxLANGUAGE_ZULU_SOUTH_AFRICA, + + /// For custom, user-defined languages. + wxLANGUAGE_USER_DEFINED, + + /// Synonyms. + wxLANGUAGE_AZERI = wxLANGUAGE_AZERBAIJANI, + wxLANGUAGE_AZERI_CYRILLIC = wxLANGUAGE_AZERBAIJANI_CYRILLIC, + wxLANGUAGE_AZERI_LATIN = wxLANGUAGE_AZERBAIJANI_LATIN, + wxLANGUAGE_BENGALI = wxLANGUAGE_BANGLA, + wxLANGUAGE_BENGALI_BANGLADESH = wxLANGUAGE_BANGLA_BANGLADESH, + wxLANGUAGE_BENGALI_INDIA = wxLANGUAGE_BANGLA_INDIA, + wxLANGUAGE_BHUTANI = wxLANGUAGE_DZONGKHA, + wxLANGUAGE_CHINESE_SIMPLIFIED = wxLANGUAGE_CHINESE_CHINA, + wxLANGUAGE_CHINESE_TRADITIONAL = wxLANGUAGE_CHINESE_TAIWAN, + wxLANGUAGE_CHINESE_MACAU = wxLANGUAGE_CHINESE_MACAO, + wxLANGUAGE_KERNEWEK = wxLANGUAGE_CORNISH, + wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM = wxLANGUAGE_MALAY_BRUNEI, + wxLANGUAGE_ORIYA = wxLANGUAGE_ODIA, + wxLANGUAGE_ORIYA_INDIA = wxLANGUAGE_ODIA_INDIA, + wxLANGUAGE_SPANISH_MODERN = wxLANGUAGE_SPANISH, + + /// Obsolete synonym. + wxLANGUAGE_CAMBODIAN = wxLANGUAGE_KHMER +}; + +// --- --- --- generated code ends here --- --- --- + +#endif // wxUSE_INTL + +#endif // _WX_LANGUAGE_H_ diff --git a/lib/wxWidgets/include/wx/layout.h b/lib/wxWidgets/include/wx/layout.h new file mode 100644 index 0000000..504ee35 --- /dev/null +++ b/lib/wxWidgets/include/wx/layout.h @@ -0,0 +1,190 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/layout.h +// Purpose: OBSOLETE layout constraint classes, use sizers instead +// Author: Julian Smart +// Modified by: +// Created: 29/01/98 +// Copyright: (c) 1998 Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LAYOUT_H_ +#define _WX_LAYOUT_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/object.h" + +// X stupidly defines these in X.h +#ifdef Above + #undef Above +#endif +#ifdef Below + #undef Below +#endif + +#if wxUSE_CONSTRAINTS + +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxWindowBase; +class WXDLLIMPEXP_FWD_CORE wxLayoutConstraints; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +#define wxLAYOUT_DEFAULT_MARGIN 0 + +enum wxEdge +{ + wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight, + wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY +}; + +enum wxRelationship +{ + wxUnconstrained = 0, + wxAsIs, + wxPercentOf, + wxAbove, + wxBelow, + wxLeftOf, + wxRightOf, + wxSameAs, + wxAbsolute +}; + +// ---------------------------------------------------------------------------- +// wxIndividualLayoutConstraint: a constraint on window position +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxIndividualLayoutConstraint : public wxObject +{ +public: + wxIndividualLayoutConstraint(); + + // note that default copy ctor and assignment operators are ok + + virtual ~wxIndividualLayoutConstraint(){} + + void Set(wxRelationship rel, wxWindowBase *otherW, wxEdge otherE, int val = 0, int marg = wxLAYOUT_DEFAULT_MARGIN); + + // + // Sibling relationships + // + void LeftOf(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN); + void RightOf(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN); + void Above(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN); + void Below(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN); + + // + // 'Same edge' alignment + // + void SameAs(wxWindowBase *otherW, wxEdge edge, int marg = wxLAYOUT_DEFAULT_MARGIN); + + // The edge is a percentage of the other window's edge + void PercentOf(wxWindowBase *otherW, wxEdge wh, int per); + + // + // Edge has absolute value + // + void Absolute(int val); + + // + // Dimension is unconstrained + // + void Unconstrained() { relationship = wxUnconstrained; } + + // + // Dimension is 'as is' (use current size settings) + // + void AsIs() { relationship = wxAsIs; } + + // + // Accessors + // + wxWindowBase *GetOtherWindow() { return otherWin; } + wxEdge GetMyEdge() const { return myEdge; } + void SetEdge(wxEdge which) { myEdge = which; } + void SetValue(int v) { value = v; } + int GetMargin() const { return margin; } + void SetMargin(int m) { margin = m; } + int GetValue() const { return value; } + int GetPercent() const { return percent; } + int GetOtherEdge() const { return otherEdge; } + bool GetDone() const { return done; } + void SetDone(bool d) { done = d; } + wxRelationship GetRelationship() const { return relationship; } + void SetRelationship(wxRelationship r) { relationship = r; } + + // Reset constraint if it mentions otherWin + bool ResetIfWin(wxWindowBase *otherW); + + // Try to satisfy constraint + bool SatisfyConstraint(wxLayoutConstraints *constraints, wxWindowBase *win); + + // Get the value of this edge or dimension, or if this + // is not determinable, -1. + int GetEdge(wxEdge which, wxWindowBase *thisWin, wxWindowBase *other) const; + +protected: + // To be allowed to modify the internal variables + friend class wxIndividualLayoutConstraint_Serialize; + + // 'This' window is the parent or sibling of otherWin + wxWindowBase *otherWin; + + wxEdge myEdge; + wxRelationship relationship; + int margin; + int value; + int percent; + wxEdge otherEdge; + bool done; + + wxDECLARE_DYNAMIC_CLASS(wxIndividualLayoutConstraint); +}; + +// ---------------------------------------------------------------------------- +// wxLayoutConstraints: the complete set of constraints for a window +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxLayoutConstraints : public wxObject +{ +public: + // Edge constraints + wxIndividualLayoutConstraint left; + wxIndividualLayoutConstraint top; + wxIndividualLayoutConstraint right; + wxIndividualLayoutConstraint bottom; + // Size constraints + wxIndividualLayoutConstraint width; + wxIndividualLayoutConstraint height; + // Centre constraints + wxIndividualLayoutConstraint centreX; + wxIndividualLayoutConstraint centreY; + + wxLayoutConstraints(); + + // note that default copy ctor and assignment operators are ok + + virtual ~wxLayoutConstraints(){} + + bool SatisfyConstraints(wxWindowBase *win, int *noChanges); + bool AreSatisfied() const + { + return left.GetDone() && top.GetDone() && + width.GetDone() && height.GetDone(); + } + + wxDECLARE_DYNAMIC_CLASS(wxLayoutConstraints); +}; + +#endif // wxUSE_CONSTRAINTS + +#endif // _WX_LAYOUT_H_ diff --git a/lib/wxWidgets/include/wx/laywin.h b/lib/wxWidgets/include/wx/laywin.h new file mode 100644 index 0000000..e3f6b6e --- /dev/null +++ b/lib/wxWidgets/include/wx/laywin.h @@ -0,0 +1,17 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/laywin.h +// Purpose: wxSashLayoutWindow base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LAYWIN_H_BASE_ +#define _WX_LAYWIN_H_BASE_ + +#include "wx/generic/laywin.h" + +#endif + // _WX_LAYWIN_H_BASE_ diff --git a/lib/wxWidgets/include/wx/link.h b/lib/wxWidgets/include/wx/link.h new file mode 100644 index 0000000..c422fc1 --- /dev/null +++ b/lib/wxWidgets/include/wx/link.h @@ -0,0 +1,31 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/link.h +// Purpose: macros to force linking modules which might otherwise be +// discarded by the linker +// Author: Vaclav Slavik +// Copyright: (c) Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LINK_H_ +#define _WX_LINK_H_ + +// This must be part of the module you want to force: +#define wxFORCE_LINK_THIS_MODULE(module_name) \ + extern void _wx_link_dummy_func_##module_name (); \ + void _wx_link_dummy_func_##module_name () { } + + +// And this must be somewhere where it certainly will be linked: +#define wxFORCE_LINK_MODULE(module_name) \ + extern void _wx_link_dummy_func_##module_name (); \ + static struct wxForceLink##module_name \ + { \ + wxForceLink##module_name() \ + { \ + _wx_link_dummy_func_##module_name (); \ + } \ + } _wx_link_dummy_var_##module_name; + + +#endif // _WX_LINK_H_ diff --git a/lib/wxWidgets/include/wx/list.h b/lib/wxWidgets/include/wx/list.h new file mode 100644 index 0000000..b11d170 --- /dev/null +++ b/lib/wxWidgets/include/wx/list.h @@ -0,0 +1,1312 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/list.h +// Purpose: wxList, wxStringList classes +// Author: Julian Smart +// Modified by: VZ at 16/11/98: WX_DECLARE_LIST() and typesafe lists added +// Created: 29/01/98 +// Copyright: (c) 1998 Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +/* + All this is quite ugly but serves two purposes: + 1. Be almost 100% compatible with old, untyped, wxList class + 2. Ensure compile-time type checking for the linked lists + + The idea is to have one base class (wxListBase) working with "void *" data, + but to hide these untyped functions - i.e. make them protected, so they + can only be used from derived classes which have inline member functions + working with right types. This achieves the 2nd goal. As for the first one, + we provide a special derivation of wxListBase called wxList which looks just + like the old class. +*/ + +#ifndef _WX_LIST_H_ +#define _WX_LIST_H_ + +// ----------------------------------------------------------------------------- +// headers +// ----------------------------------------------------------------------------- + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/string.h" +#include "wx/vector.h" + +#if wxUSE_STD_CONTAINERS + #include "wx/beforestd.h" + #include <algorithm> + #include <iterator> + #include <list> + #include "wx/afterstd.h" +#endif + +// ---------------------------------------------------------------------------- +// types +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_BASE wxObjectListNode; +typedef wxObjectListNode wxNode; + +#if wxUSE_STD_CONTAINERS + +#define wxLIST_COMPATIBILITY + +#define WX_DECLARE_LIST_WITH_DECL(elT, liT, decl) \ + WX_DECLARE_LIST_3(elT, elT, liT, dummy, decl) + +#define WX_DECLARE_LIST_PTR_3(elT, baseT, liT, dummy, decl) \ + WX_DECLARE_LIST_3(elT, baseT, liT, dummy, decl) + +#define WX_DECLARE_LIST_2(elT, liT, dummy, decl) \ + WX_DECLARE_LIST_WITH_DECL(elT, liT, decl) +#define WX_DECLARE_LIST_PTR_2(elT, liT, dummy, decl) \ + WX_DECLARE_LIST_2(elT, liT, dummy, decl) + +#define WX_DECLARE_LIST_3(elT, baseT, liT, dummy, decl) \ + WX_DECLARE_LIST_XO(elT*, baseT*, liT, decl) + +template<class T> +class wxList_SortFunction +{ +public: + wxList_SortFunction(wxSortCompareFunction f) : m_f(f) { } + bool operator()(const T& i1, const T& i2) + { return m_f(&i1, &i2) < 0; } +private: + wxSortCompareFunction m_f; +}; + +/* + Note 1: the outer helper class _WX_LIST_HELPER_##liT below is a workaround + for mingw 3.2.3 compiler bug that prevents a static function of liT class + from being exported into dll. A minimal code snippet reproducing the bug: + + struct WXDLLIMPEXP_CORE Foo + { + static void Bar(); + struct SomeInnerClass + { + friend class Foo; // comment this out to make it link + }; + ~Foo() + { + Bar(); + } + }; + + The program does not link under mingw_gcc 3.2.3 producing undefined + reference to Foo::Bar() function + + + Note 2: the EmptyList is needed to allow having a NULL pointer-like + invalid iterator. We used to use just an uninitialized iterator object + instead but this fails with some debug/checked versions of STL, notably the + glibc version activated with _GLIBCXX_DEBUG, so we need to have a separate + invalid iterator. + */ + +// the real wxList-class declaration +#define WX_DECLARE_LIST_XO(elT, baseT, liT, decl) \ + decl _WX_LIST_HELPER_##liT \ + { \ + typedef elT _WX_LIST_ITEM_TYPE_##liT; \ + typedef std::list<elT> BaseListType; \ + public: \ + static BaseListType EmptyList; \ + static void DeleteFunction( _WX_LIST_ITEM_TYPE_##liT X ); \ + }; \ + \ + class liT : public std::list<elT> \ + { \ + private: \ + typedef std::list<elT> BaseListType; \ + \ + bool m_destroy; \ + \ + public: \ + class compatibility_iterator \ + { \ + private: \ + friend class liT; \ + \ + iterator m_iter; \ + liT * m_list; \ + \ + public: \ + compatibility_iterator() \ + : m_iter(_WX_LIST_HELPER_##liT::EmptyList.end()), m_list( NULL ) {} \ + compatibility_iterator( liT* li, iterator i ) \ + : m_iter( i ), m_list( li ) {} \ + compatibility_iterator( const liT* li, iterator i ) \ + : m_iter( i ), m_list( const_cast< liT* >( li ) ) {} \ + \ + compatibility_iterator* operator->() { return this; } \ + const compatibility_iterator* operator->() const { return this; } \ + \ + bool operator==(const compatibility_iterator& i) const \ + { \ + wxASSERT_MSG( m_list && i.m_list, \ + wxT("comparing invalid iterators is illegal") ); \ + return (m_list == i.m_list) && (m_iter == i.m_iter); \ + } \ + bool operator!=(const compatibility_iterator& i) const \ + { return !( operator==( i ) ); } \ + operator bool() const \ + { return m_list ? m_iter != m_list->end() : false; } \ + bool operator !() const \ + { return !( operator bool() ); } \ + \ + elT GetData() const \ + { return *m_iter; } \ + void SetData( elT e ) \ + { *m_iter = e; } \ + \ + compatibility_iterator GetNext() const \ + { \ + iterator i = m_iter; \ + return compatibility_iterator( m_list, ++i ); \ + } \ + compatibility_iterator GetPrevious() const \ + { \ + if ( m_iter == m_list->begin() ) \ + return compatibility_iterator(); \ + \ + iterator i = m_iter; \ + return compatibility_iterator( m_list, --i ); \ + } \ + int IndexOf() const \ + { \ + return *this ? (int)std::distance( m_list->begin(), m_iter ) \ + : wxNOT_FOUND; \ + } \ + }; \ + public: \ + liT() : m_destroy( false ) {} \ + \ + compatibility_iterator Find( const baseT e ) const \ + { \ + liT* _this = const_cast< liT* >( this ); \ + return compatibility_iterator( _this, \ + std::find( _this->begin(), _this->end(), (const elT)e ));\ + } \ + \ + bool IsEmpty() const \ + { return empty(); } \ + size_t GetCount() const \ + { return size(); } \ + int Number() const \ + { return static_cast< int >( GetCount() ); } \ + \ + compatibility_iterator Item( size_t idx ) const \ + { \ + iterator i = const_cast< liT* >(this)->begin(); \ + std::advance( i, idx ); \ + return compatibility_iterator( this, i ); \ + } \ + elT operator[](size_t idx) const \ + { \ + return Item(idx).GetData(); \ + } \ + \ + compatibility_iterator GetFirst() const \ + { \ + return compatibility_iterator( this, \ + const_cast< liT* >(this)->begin() ); \ + } \ + compatibility_iterator GetLast() const \ + { \ + iterator i = const_cast< liT* >(this)->end(); \ + return compatibility_iterator( this, !empty() ? --i : i ); \ + } \ + bool Member( baseT e ) const \ + { return Find( e ); } \ + compatibility_iterator Nth( int n ) const \ + { return Item( n ); } \ + int IndexOf( baseT e ) const \ + { return Find( e ).IndexOf(); } \ + \ + compatibility_iterator Append( elT e ) \ + { \ + push_back( e ); \ + return GetLast(); \ + } \ + compatibility_iterator Insert( elT e ) \ + { \ + push_front( e ); \ + return compatibility_iterator( this, begin() ); \ + } \ + compatibility_iterator Insert(const compatibility_iterator & i, elT e)\ + { \ + return compatibility_iterator( this, insert( i.m_iter, e ) ); \ + } \ + compatibility_iterator Insert( size_t idx, elT e ) \ + { \ + return compatibility_iterator( this, \ + insert( Item( idx ).m_iter, e ) ); \ + } \ + \ + void DeleteContents( bool destroy ) \ + { m_destroy = destroy; } \ + bool GetDeleteContents() const \ + { return m_destroy; } \ + void Erase( const compatibility_iterator& i ) \ + { \ + if ( m_destroy ) \ + _WX_LIST_HELPER_##liT::DeleteFunction( i->GetData() ); \ + erase( i.m_iter ); \ + } \ + bool DeleteNode( const compatibility_iterator& i ) \ + { \ + if( i ) \ + { \ + Erase( i ); \ + return true; \ + } \ + return false; \ + } \ + bool DeleteObject( baseT e ) \ + { \ + return DeleteNode( Find( e ) ); \ + } \ + void Clear() \ + { \ + if ( m_destroy ) \ + std::for_each( begin(), end(), \ + _WX_LIST_HELPER_##liT::DeleteFunction ); \ + clear(); \ + } \ + /* Workaround for broken VC6 std::list::sort() see above */ \ + void Sort( wxSortCompareFunction compfunc ) \ + { sort( wxList_SortFunction<elT>(compfunc ) ); } \ + ~liT() { Clear(); } \ + \ + /* It needs access to our EmptyList */ \ + friend class compatibility_iterator; \ + } + +#define WX_DECLARE_LIST(elementtype, listname) \ + WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class) +#define WX_DECLARE_LIST_PTR(elementtype, listname) \ + WX_DECLARE_LIST(elementtype, listname) + +#define WX_DECLARE_EXPORTED_LIST(elementtype, listname) \ + WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class WXDLLIMPEXP_CORE) +#define WX_DECLARE_EXPORTED_LIST_PTR(elementtype, listname) \ + WX_DECLARE_EXPORTED_LIST(elementtype, listname) + +#define WX_DECLARE_USER_EXPORTED_LIST(elementtype, listname, usergoo) \ + WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class usergoo) +#define WX_DECLARE_USER_EXPORTED_LIST_PTR(elementtype, listname, usergoo) \ + WX_DECLARE_USER_EXPORTED_LIST(elementtype, listname, usergoo) + +// this macro must be inserted in your program after +// #include "wx/listimpl.cpp" +#define WX_DEFINE_LIST(name) "don't forget to include listimpl.cpp!" + +#define WX_DEFINE_EXPORTED_LIST(name) WX_DEFINE_LIST(name) +#define WX_DEFINE_USER_EXPORTED_LIST(name) WX_DEFINE_LIST(name) + +#else // if !wxUSE_STD_CONTAINERS + + +// undef it to get rid of old, deprecated functions +#define wxLIST_COMPATIBILITY + +// ----------------------------------------------------------------------------- +// key stuff: a list may be optionally keyed on integer or string key +// ----------------------------------------------------------------------------- + +union wxListKeyValue +{ + long integer; + wxString *string; +}; + +// a struct which may contain both types of keys +// +// implementation note: on one hand, this class allows to have only one function +// for any keyed operation instead of 2 almost equivalent. OTOH, it's needed to +// resolve ambiguity which we would otherwise have with wxStringList::Find() and +// wxList::Find(const char *). +class WXDLLIMPEXP_BASE wxListKey +{ +public: + // implicit ctors + wxListKey() : m_keyType(wxKEY_NONE) + { m_key.integer = 0; } + wxListKey(long i) : m_keyType(wxKEY_INTEGER) + { m_key.integer = i; } + wxListKey(const wxString& s) : m_keyType(wxKEY_STRING) + { m_key.string = new wxString(s); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxListKey(const char *s) : m_keyType(wxKEY_STRING) + { m_key.string = new wxString(s); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + wxListKey(const wchar_t *s) : m_keyType(wxKEY_STRING) + { m_key.string = new wxString(s); } + + // accessors + wxKeyType GetKeyType() const { return m_keyType; } + const wxString GetString() const + { wxASSERT( m_keyType == wxKEY_STRING ); return *m_key.string; } + long GetNumber() const + { wxASSERT( m_keyType == wxKEY_INTEGER ); return m_key.integer; } + + // comparison + // Note: implementation moved to list.cpp to prevent BC++ inline + // expansion warning. + bool operator==(wxListKeyValue value) const ; + + // dtor + ~wxListKey() + { + if ( m_keyType == wxKEY_STRING ) + delete m_key.string; + } + +private: + wxKeyType m_keyType; + wxListKeyValue m_key; +}; + +// ----------------------------------------------------------------------------- +// wxNodeBase class is a (base for) node in a double linked list +// ----------------------------------------------------------------------------- + +extern WXDLLIMPEXP_DATA_BASE(wxListKey) wxDefaultListKey; + +class WXDLLIMPEXP_FWD_BASE wxListBase; + +class WXDLLIMPEXP_BASE wxNodeBase +{ +friend class wxListBase; +public: + // ctor + wxNodeBase(wxListBase *list = NULL, + wxNodeBase *previous = NULL, + wxNodeBase *next = NULL, + void *data = NULL, + const wxListKey& key = wxDefaultListKey); + + virtual ~wxNodeBase(); + + // FIXME no check is done that the list is really keyed on strings + wxString GetKeyString() const { return *m_key.string; } + long GetKeyInteger() const { return m_key.integer; } + + // Necessary for some existing code + void SetKeyString(const wxString& s) { m_key.string = new wxString(s); } + void SetKeyInteger(long i) { m_key.integer = i; } + +#ifdef wxLIST_COMPATIBILITY + // compatibility methods, use Get* instead. + wxDEPRECATED( wxNode *Next() const ); + wxDEPRECATED( wxNode *Previous() const ); + wxDEPRECATED( wxObject *Data() const ); +#endif // wxLIST_COMPATIBILITY + +protected: + // all these are going to be "overloaded" in the derived classes + wxNodeBase *GetNext() const { return m_next; } + wxNodeBase *GetPrevious() const { return m_previous; } + + void *GetData() const { return m_data; } + void SetData(void *data) { m_data = data; } + + // get 0-based index of this node within the list or wxNOT_FOUND + int IndexOf() const; + + virtual void DeleteData() { } +public: + // for wxList::iterator + void** GetDataPtr() const { return &(const_cast<wxNodeBase*>(this)->m_data); } +private: + // optional key stuff + wxListKeyValue m_key; + + void *m_data; // user data + wxNodeBase *m_next, // next and previous nodes in the list + *m_previous; + + wxListBase *m_list; // list we belong to + + wxDECLARE_NO_COPY_CLASS(wxNodeBase); +}; + +// ----------------------------------------------------------------------------- +// a double-linked list class +// ----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_BASE wxList; + +class WXDLLIMPEXP_BASE wxListBase +{ +friend class wxNodeBase; // should be able to call DetachNode() +friend class wxHashTableBase; // should be able to call untyped Find() + +public: + // default ctor & dtor + wxListBase(wxKeyType keyType = wxKEY_NONE) + { Init(keyType); } + virtual ~wxListBase(); + + // accessors + // count of items in the list + size_t GetCount() const { return m_count; } + + // return true if this list is empty + bool IsEmpty() const { return m_count == 0; } + + // operations + + // delete all nodes + void Clear(); + + // instruct it to destroy user data when deleting nodes + void DeleteContents(bool destroy) { m_destroy = destroy; } + + // query if to delete + bool GetDeleteContents() const + { return m_destroy; } + + // get the keytype + wxKeyType GetKeyType() const + { return m_keyType; } + + // set the keytype (required by the serial code) + void SetKeyType(wxKeyType keyType) + { wxASSERT( m_count==0 ); m_keyType = keyType; } + +#ifdef wxLIST_COMPATIBILITY + // compatibility methods from old wxList + wxDEPRECATED( int Number() const ); // use GetCount instead. + wxDEPRECATED( wxNode *First() const ); // use GetFirst + wxDEPRECATED( wxNode *Last() const ); // use GetLast + wxDEPRECATED( wxNode *Nth(size_t n) const ); // use Item + + // kludge for typesafe list migration in core classes. + wxDEPRECATED( operator wxList&() ); + wxDEPRECATED( operator const wxList&() const ); +#endif // wxLIST_COMPATIBILITY + +protected: + + // all methods here are "overloaded" in derived classes to provide compile + // time type checking + + // create a node for the list of this type + virtual wxNodeBase *CreateNode(wxNodeBase *prev, wxNodeBase *next, + void *data, + const wxListKey& key = wxDefaultListKey) = 0; + + void Assign(const wxListBase& list) + { Clear(); DoCopy(list); } + + // get list head/tail + wxNodeBase *GetFirst() const { return m_nodeFirst; } + wxNodeBase *GetLast() const { return m_nodeLast; } + + // by (0-based) index + wxNodeBase *Item(size_t index) const; + + // get the list item's data + void *operator[](size_t n) const + { + wxNodeBase *node = Item(n); + + return node ? node->GetData() : NULL; + } + + // operations + // append to end of list + wxNodeBase *Prepend(void *object) + { return (wxNodeBase *)wxListBase::Insert(object); } + // append to beginning of list + wxNodeBase *Append(void *object); + // insert a new item at the beginning of the list + wxNodeBase *Insert(void *object) + { return Insert(static_cast<wxNodeBase *>(NULL), object); } + // insert a new item at the given position + wxNodeBase *Insert(size_t pos, void *object) + { return pos == GetCount() ? Append(object) + : Insert(Item(pos), object); } + // insert before given node or at front of list if prev == NULL + wxNodeBase *Insert(wxNodeBase *prev, void *object); + + // keyed append + wxNodeBase *Append(long key, void *object); + wxNodeBase *Append(const wxString& key, void *object); + + // removes node from the list but doesn't delete it (returns pointer + // to the node or NULL if it wasn't found in the list) + wxNodeBase *DetachNode(wxNodeBase *node); + // delete element from list, returns false if node not found + bool DeleteNode(wxNodeBase *node); + // finds object pointer and deletes node (and object if DeleteContents + // is on), returns false if object not found + bool DeleteObject(void *object); + + // search (all return NULL if item not found) + // by data + wxNodeBase *Find(const void *object) const; + + // by key + wxNodeBase *Find(const wxListKey& key) const; + + // get 0-based index of object or wxNOT_FOUND + int IndexOf( void *object ) const; + + // this function allows the sorting of arbitrary lists by giving + // a function to compare two list elements. The list is sorted in place. + void Sort(const wxSortCompareFunction compfunc); + + // functions for iterating over the list + void *FirstThat(wxListIterateFunction func); + void ForEach(wxListIterateFunction func); + void *LastThat(wxListIterateFunction func); + + // for STL interface, "last" points to one after the last node + // of the controlled sequence (NULL for the end of the list) + void Reverse(); + void DeleteNodes(wxNodeBase* first, wxNodeBase* last); +private: + + // common part of all ctors + void Init(wxKeyType keyType = wxKEY_NONE); + + // helpers + // common part of copy ctor and assignment operator + void DoCopy(const wxListBase& list); + // common part of all Append()s + wxNodeBase *AppendCommon(wxNodeBase *node); + // free node's data and node itself + void DoDeleteNode(wxNodeBase *node); + + size_t m_count; // number of elements in the list + bool m_destroy; // destroy user data when deleting list items? + wxNodeBase *m_nodeFirst, // pointers to the head and tail of the list + *m_nodeLast; + + wxKeyType m_keyType; // type of our keys (may be wxKEY_NONE) +}; + +// ----------------------------------------------------------------------------- +// macros for definition of "template" list type +// ----------------------------------------------------------------------------- + +// Helper macro defining common iterator typedefs +#if wxUSE_STD_CONTAINERS_COMPATIBLY + #include <iterator> + + #define WX_DECLARE_LIST_ITER_DIFF_AND_CATEGORY() \ + typedef std::ptrdiff_t difference_type; \ + typedef std::bidirectional_iterator_tag iterator_category; +#else + #define WX_DECLARE_LIST_ITER_DIFF_AND_CATEGORY() +#endif + +// and now some heavy magic... + +// declare a list type named 'name' and containing elements of type 'T *' +// (as a by product of macro expansion you also get wx##name##Node +// wxNode-derived type) +// +// implementation details: +// 1. We define _WX_LIST_ITEM_TYPE_##name typedef to save in it the item type +// for the list of given type - this allows us to pass only the list name +// to WX_DEFINE_LIST() even if it needs both the name and the type +// +// 2. We redefine all non-type-safe wxList functions with type-safe versions +// which don't take any space (everything is inline), but bring compile +// time error checking. +// +// 3. The macro which is usually used (WX_DECLARE_LIST) is defined in terms of +// a more generic WX_DECLARE_LIST_2 macro which, in turn, uses the most +// generic WX_DECLARE_LIST_3 one. The last macro adds a sometimes +// interesting capability to store polymorphic objects in the list and is +// particularly useful with, for example, "wxWindow *" list where the +// wxWindowBase pointers are put into the list, but wxWindow pointers are +// retrieved from it. +// +// 4. final hack is that WX_DECLARE_LIST_3 is defined in terms of +// WX_DECLARE_LIST_4 to allow defining classes without operator->() as +// it results in compiler warnings when this operator doesn't make sense +// (i.e. stored elements are not pointers) + +// common part of WX_DECLARE_LIST_3 and WX_DECLARE_LIST_PTR_3 +#define WX_DECLARE_LIST_4(T, Tbase, name, nodetype, classexp, ptrop) \ + typedef int (*wxSortFuncFor_##name)(const T **, const T **); \ + \ + classexp nodetype : public wxNodeBase \ + { \ + public: \ + nodetype(wxListBase *list = NULL, \ + nodetype *previous = NULL, \ + nodetype *next = NULL, \ + T *data = NULL, \ + const wxListKey& key = wxDefaultListKey) \ + : wxNodeBase(list, previous, next, data, key) { } \ + \ + nodetype *GetNext() const \ + { return (nodetype *)wxNodeBase::GetNext(); } \ + nodetype *GetPrevious() const \ + { return (nodetype *)wxNodeBase::GetPrevious(); } \ + \ + T *GetData() const \ + { return (T *)wxNodeBase::GetData(); } \ + void SetData(T *data) \ + { wxNodeBase::SetData(data); } \ + \ + protected: \ + virtual void DeleteData() wxOVERRIDE; \ + \ + wxDECLARE_NO_COPY_CLASS(nodetype); \ + }; \ + \ + classexp name : public wxListBase \ + { \ + public: \ + typedef nodetype Node; \ + classexp compatibility_iterator \ + { \ + public: \ + compatibility_iterator(Node *ptr = NULL) : m_ptr(ptr) { } \ + \ + Node *operator->() const { return m_ptr; } \ + operator Node *() const { return m_ptr; } \ + \ + private: \ + Node *m_ptr; \ + }; \ + \ + name(wxKeyType keyType = wxKEY_NONE) : wxListBase(keyType) \ + { } \ + name(const name& list) : wxListBase(list.GetKeyType()) \ + { Assign(list); } \ + \ + name& operator=(const name& list) \ + { if (&list != this) Assign(list); return *this; } \ + \ + nodetype *GetFirst() const \ + { return (nodetype *)wxListBase::GetFirst(); } \ + nodetype *GetLast() const \ + { return (nodetype *)wxListBase::GetLast(); } \ + \ + nodetype *Item(size_t index) const \ + { return (nodetype *)wxListBase::Item(index); } \ + \ + T *operator[](size_t index) const \ + { \ + nodetype *node = Item(index); \ + return node ? (T*)(node->GetData()) : NULL; \ + } \ + \ + nodetype *Append(Tbase *object) \ + { return (nodetype *)wxListBase::Append(object); } \ + nodetype *Insert(Tbase *object) \ + { return (nodetype *)Insert(static_cast<nodetype *>(NULL), \ + object); } \ + nodetype *Insert(size_t pos, Tbase *object) \ + { return (nodetype *)wxListBase::Insert(pos, object); } \ + nodetype *Insert(nodetype *prev, Tbase *object) \ + { return (nodetype *)wxListBase::Insert(prev, object); } \ + \ + nodetype *Append(long key, void *object) \ + { return (nodetype *)wxListBase::Append(key, object); } \ + nodetype *Append(const wxChar *key, void *object) \ + { return (nodetype *)wxListBase::Append(key, object); } \ + \ + nodetype *DetachNode(nodetype *node) \ + { return (nodetype *)wxListBase::DetachNode(node); } \ + bool DeleteNode(nodetype *node) \ + { return wxListBase::DeleteNode(node); } \ + bool DeleteObject(Tbase *object) \ + { return wxListBase::DeleteObject(object); } \ + void Erase(nodetype *it) \ + { DeleteNode(it); } \ + \ + nodetype *Find(const Tbase *object) const \ + { return (nodetype *)wxListBase::Find(object); } \ + \ + virtual nodetype *Find(const wxListKey& key) const \ + { return (nodetype *)wxListBase::Find(key); } \ + \ + bool Member(const Tbase *object) const \ + { return Find(object) != NULL; } \ + \ + int IndexOf(Tbase *object) const \ + { return wxListBase::IndexOf(object); } \ + \ + void Sort(wxSortCompareFunction func) \ + { wxListBase::Sort(func); } \ + void Sort(wxSortFuncFor_##name func) \ + { Sort((wxSortCompareFunction)func); } \ + \ + protected: \ + virtual wxNodeBase *CreateNode(wxNodeBase *prev, wxNodeBase *next, \ + void *data, \ + const wxListKey& key = wxDefaultListKey) \ + wxOVERRIDE \ + { \ + return new nodetype(this, \ + (nodetype *)prev, (nodetype *)next, \ + (T *)data, key); \ + } \ + /* STL interface */ \ + public: \ + typedef size_t size_type; \ + typedef int difference_type; \ + typedef T* value_type; \ + typedef Tbase* base_value_type; \ + typedef value_type& reference; \ + typedef const value_type& const_reference; \ + typedef base_value_type& base_reference; \ + typedef const base_value_type& const_base_reference; \ + \ + classexp iterator \ + { \ + public: \ + WX_DECLARE_LIST_ITER_DIFF_AND_CATEGORY() \ + typedef T* value_type; \ + typedef value_type* pointer; \ + typedef value_type& reference; \ + \ + typedef nodetype Node; \ + typedef iterator itor; \ + \ + Node* m_node; \ + Node* m_init; \ + public: \ + /* Compatibility typedefs, don't use */ \ + typedef reference reference_type; \ + typedef pointer pointer_type; \ + \ + iterator(Node* node, Node* init) : m_node(node), m_init(init) {}\ + iterator() : m_node(NULL), m_init(NULL) { } \ + reference_type operator*() const \ + { return *(pointer_type)m_node->GetDataPtr(); } \ + ptrop \ + itor& operator++() \ + { \ + wxASSERT_MSG( m_node, wxT("uninitialized iterator") ); \ + m_node = m_node->GetNext(); \ + return *this; \ + } \ + const itor operator++(int) \ + { \ + itor tmp = *this; \ + wxASSERT_MSG( m_node, wxT("uninitialized iterator") ); \ + m_node = m_node->GetNext(); \ + return tmp; \ + } \ + itor& operator--() \ + { \ + m_node = m_node ? m_node->GetPrevious() : m_init; \ + return *this; \ + } \ + const itor operator--(int) \ + { \ + itor tmp = *this; \ + m_node = m_node ? m_node->GetPrevious() : m_init; \ + return tmp; \ + } \ + bool operator!=(const itor& it) const \ + { return it.m_node != m_node; } \ + bool operator==(const itor& it) const \ + { return it.m_node == m_node; } \ + }; \ + classexp const_iterator \ + { \ + public: \ + WX_DECLARE_LIST_ITER_DIFF_AND_CATEGORY() \ + typedef T* value_type; \ + typedef const value_type* pointer; \ + typedef const value_type& reference; \ + \ + typedef nodetype Node; \ + typedef const_iterator itor; \ + \ + Node* m_node; \ + Node* m_init; \ + public: \ + typedef reference reference_type; \ + typedef pointer pointer_type; \ + \ + const_iterator(Node* node, Node* init) \ + : m_node(node), m_init(init) { } \ + const_iterator() : m_node(NULL), m_init(NULL) { } \ + const_iterator(const iterator& it) \ + : m_node(it.m_node), m_init(it.m_init) { } \ + reference_type operator*() const \ + { return *(pointer_type)m_node->GetDataPtr(); } \ + ptrop \ + itor& operator++() \ + { \ + wxASSERT_MSG( m_node, wxT("uninitialized iterator") ); \ + m_node = m_node->GetNext(); \ + return *this; \ + } \ + const itor operator++(int) \ + { \ + itor tmp = *this; \ + wxASSERT_MSG( m_node, wxT("uninitialized iterator") ); \ + m_node = m_node->GetNext(); \ + return tmp; \ + } \ + itor& operator--() \ + { \ + m_node = m_node ? m_node->GetPrevious() : m_init; \ + return *this; \ + } \ + const itor operator--(int) \ + { \ + itor tmp = *this; \ + m_node = m_node ? m_node->GetPrevious() : m_init; \ + return tmp; \ + } \ + bool operator!=(const itor& it) const \ + { return it.m_node != m_node; } \ + bool operator==(const itor& it) const \ + { return it.m_node == m_node; } \ + }; \ + classexp reverse_iterator \ + { \ + public: \ + WX_DECLARE_LIST_ITER_DIFF_AND_CATEGORY() \ + typedef T* value_type; \ + typedef value_type* pointer; \ + typedef value_type& reference; \ + \ + typedef nodetype Node; \ + typedef reverse_iterator itor; \ + \ + Node* m_node; \ + Node* m_init; \ + public: \ + typedef reference reference_type; \ + typedef pointer pointer_type; \ + \ + reverse_iterator(Node* node, Node* init) \ + : m_node(node), m_init(init) { } \ + reverse_iterator() : m_node(NULL), m_init(NULL) { } \ + reference_type operator*() const \ + { return *(pointer_type)m_node->GetDataPtr(); } \ + ptrop \ + itor& operator++() \ + { m_node = m_node->GetPrevious(); return *this; } \ + const itor operator++(int) \ + { itor tmp = *this; m_node = m_node->GetPrevious(); return tmp; }\ + itor& operator--() \ + { m_node = m_node ? m_node->GetNext() : m_init; return *this; } \ + const itor operator--(int) \ + { \ + itor tmp = *this; \ + m_node = m_node ? m_node->GetNext() : m_init; \ + return tmp; \ + } \ + bool operator!=(const itor& it) const \ + { return it.m_node != m_node; } \ + bool operator==(const itor& it) const \ + { return it.m_node == m_node; } \ + }; \ + classexp const_reverse_iterator \ + { \ + public: \ + WX_DECLARE_LIST_ITER_DIFF_AND_CATEGORY() \ + typedef T* value_type; \ + typedef const value_type* pointer; \ + typedef const value_type& reference; \ + \ + typedef nodetype Node; \ + typedef const_reverse_iterator itor; \ + \ + Node* m_node; \ + Node* m_init; \ + public: \ + typedef reference reference_type; \ + typedef pointer pointer_type; \ + \ + const_reverse_iterator(Node* node, Node* init) \ + : m_node(node), m_init(init) { } \ + const_reverse_iterator() : m_node(NULL), m_init(NULL) { } \ + const_reverse_iterator(const reverse_iterator& it) \ + : m_node(it.m_node), m_init(it.m_init) { } \ + reference_type operator*() const \ + { return *(pointer_type)m_node->GetDataPtr(); } \ + ptrop \ + itor& operator++() \ + { m_node = m_node->GetPrevious(); return *this; } \ + const itor operator++(int) \ + { itor tmp = *this; m_node = m_node->GetPrevious(); return tmp; }\ + itor& operator--() \ + { m_node = m_node ? m_node->GetNext() : m_init; return *this;}\ + const itor operator--(int) \ + { \ + itor tmp = *this; \ + m_node = m_node ? m_node->GetNext() : m_init; \ + return tmp; \ + } \ + bool operator!=(const itor& it) const \ + { return it.m_node != m_node; } \ + bool operator==(const itor& it) const \ + { return it.m_node == m_node; } \ + }; \ + \ + explicit name(size_type n, const_reference v = value_type()) \ + { assign(n, v); } \ + name(const const_iterator& first, const const_iterator& last) \ + { assign(first, last); } \ + iterator begin() { return iterator(GetFirst(), GetLast()); } \ + const_iterator begin() const \ + { return const_iterator(GetFirst(), GetLast()); } \ + iterator end() { return iterator(NULL, GetLast()); } \ + const_iterator end() const { return const_iterator(NULL, GetLast()); }\ + reverse_iterator rbegin() \ + { return reverse_iterator(GetLast(), GetFirst()); } \ + const_reverse_iterator rbegin() const \ + { return const_reverse_iterator(GetLast(), GetFirst()); } \ + reverse_iterator rend() { return reverse_iterator(NULL, GetFirst()); }\ + const_reverse_iterator rend() const \ + { return const_reverse_iterator(NULL, GetFirst()); } \ + void resize(size_type n, value_type v = value_type()) \ + { \ + while (n < size()) \ + pop_back(); \ + while (n > size()) \ + push_back(v); \ + } \ + size_type size() const { return GetCount(); } \ + size_type max_size() const { return INT_MAX; } \ + bool empty() const { return IsEmpty(); } \ + reference front() { return *begin(); } \ + const_reference front() const { return *begin(); } \ + reference back() { iterator tmp = end(); return *--tmp; } \ + const_reference back() const { const_iterator tmp = end(); return *--tmp; }\ + void push_front(const_reference v = value_type()) \ + { Insert(GetFirst(), (const_base_reference)v); } \ + void pop_front() { DeleteNode(GetFirst()); } \ + void push_back(const_reference v = value_type()) \ + { Append((const_base_reference)v); } \ + void pop_back() { DeleteNode(GetLast()); } \ + void assign(const_iterator first, const const_iterator& last) \ + { \ + clear(); \ + for(; first != last; ++first) \ + Append((const_base_reference)*first); \ + } \ + void assign(size_type n, const_reference v = value_type()) \ + { \ + clear(); \ + for(size_type i = 0; i < n; ++i) \ + Append((const_base_reference)v); \ + } \ + iterator insert(const iterator& it, const_reference v) \ + { \ + if ( it == end() ) \ + { \ + Append((const_base_reference)v); \ + /* \ + note that this is the new end(), the old one was \ + invalidated by the Append() call, and this is why we \ + can't use the same code as in the normal case below \ + */ \ + iterator itins(end()); \ + return --itins; \ + } \ + else \ + { \ + Insert(it.m_node, (const_base_reference)v); \ + iterator itins(it); \ + return --itins; \ + } \ + } \ + void insert(const iterator& it, size_type n, const_reference v) \ + { \ + for(size_type i = 0; i < n; ++i) \ + insert(it, v); \ + } \ + void insert(const iterator& it, \ + const_iterator first, const const_iterator& last) \ + { \ + for(; first != last; ++first) \ + insert(it, *first); \ + } \ + iterator erase(const iterator& it) \ + { \ + iterator next = iterator(it.m_node->GetNext(), GetLast()); \ + DeleteNode(it.m_node); return next; \ + } \ + iterator erase(const iterator& first, const iterator& last) \ + { \ + iterator next = last; \ + if ( next != end() ) \ + ++next; \ + DeleteNodes(first.m_node, last.m_node); \ + return next; \ + } \ + void clear() { Clear(); } \ + void splice(const iterator& it, name& l, const iterator& first, const iterator& last)\ + { insert(it, first, last); l.erase(first, last); } \ + void splice(const iterator& it, name& l) \ + { splice(it, l, l.begin(), l.end() ); } \ + void splice(const iterator& it, name& l, const iterator& first) \ + { \ + if ( it != first ) \ + { \ + insert(it, *first); \ + l.erase(first); \ + } \ + } \ + void remove(const_reference v) \ + { DeleteObject((const_base_reference)v); } \ + void reverse() \ + { Reverse(); } \ + /* void swap(name& l) \ + { \ + { size_t t = m_count; m_count = l.m_count; l.m_count = t; } \ + { bool t = m_destroy; m_destroy = l.m_destroy; l.m_destroy = t; }\ + { wxNodeBase* t = m_nodeFirst; m_nodeFirst = l.m_nodeFirst; l.m_nodeFirst = t; }\ + { wxNodeBase* t = m_nodeLast; m_nodeLast = l.m_nodeLast; l.m_nodeLast = t; }\ + { wxKeyType t = m_keyType; m_keyType = l.m_keyType; l.m_keyType = t; }\ + } */ \ + } + +#define WX_LIST_PTROP \ + pointer_type operator->() const \ + { return (pointer_type)m_node->GetDataPtr(); } +#define WX_LIST_PTROP_NONE + +#define WX_DECLARE_LIST_3(T, Tbase, name, nodetype, classexp) \ + WX_DECLARE_LIST_4(T, Tbase, name, nodetype, classexp, WX_LIST_PTROP_NONE) +#define WX_DECLARE_LIST_PTR_3(T, Tbase, name, nodetype, classexp) \ + WX_DECLARE_LIST_4(T, Tbase, name, nodetype, classexp, WX_LIST_PTROP) + +#define WX_DECLARE_LIST_2(elementtype, listname, nodename, classexp) \ + WX_DECLARE_LIST_3(elementtype, elementtype, listname, nodename, classexp) +#define WX_DECLARE_LIST_PTR_2(elementtype, listname, nodename, classexp) \ + WX_DECLARE_LIST_PTR_3(elementtype, elementtype, listname, nodename, classexp) + +#define WX_DECLARE_LIST(elementtype, listname) \ + typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ + WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, class) +#define WX_DECLARE_LIST_PTR(elementtype, listname) \ + typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ + WX_DECLARE_LIST_PTR_2(elementtype, listname, wx##listname##Node, class) + +#define WX_DECLARE_LIST_WITH_DECL(elementtype, listname, decl) \ + typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ + WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, decl) + +#define WX_DECLARE_EXPORTED_LIST(elementtype, listname) \ + WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class WXDLLIMPEXP_CORE) + +#define WX_DECLARE_EXPORTED_LIST_PTR(elementtype, listname) \ + typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ + WX_DECLARE_LIST_PTR_2(elementtype, listname, wx##listname##Node, class WXDLLIMPEXP_CORE) + +#define WX_DECLARE_USER_EXPORTED_LIST(elementtype, listname, usergoo) \ + typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ + WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, class usergoo) +#define WX_DECLARE_USER_EXPORTED_LIST_PTR(elementtype, listname, usergoo) \ + typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ + WX_DECLARE_LIST_PTR_2(elementtype, listname, wx##listname##Node, class usergoo) + +// this macro must be inserted in your program after +// #include "wx/listimpl.cpp" +#define WX_DEFINE_LIST(name) "don't forget to include listimpl.cpp!" + +#define WX_DEFINE_EXPORTED_LIST(name) WX_DEFINE_LIST(name) +#define WX_DEFINE_USER_EXPORTED_LIST(name) WX_DEFINE_LIST(name) + +#endif // !wxUSE_STD_CONTAINERS + +// ============================================================================ +// now we can define classes 100% compatible with the old ones +// ============================================================================ + +// ---------------------------------------------------------------------------- +// commonly used list classes +// ---------------------------------------------------------------------------- + +#if defined(wxLIST_COMPATIBILITY) + +// inline compatibility functions + +#if !wxUSE_STD_CONTAINERS + +// ---------------------------------------------------------------------------- +// wxNodeBase deprecated methods +// ---------------------------------------------------------------------------- + +inline wxNode *wxNodeBase::Next() const { return (wxNode *)GetNext(); } +inline wxNode *wxNodeBase::Previous() const { return (wxNode *)GetPrevious(); } +inline wxObject *wxNodeBase::Data() const { return (wxObject *)GetData(); } + +// ---------------------------------------------------------------------------- +// wxListBase deprecated methods +// ---------------------------------------------------------------------------- + +inline int wxListBase::Number() const { return (int)GetCount(); } +inline wxNode *wxListBase::First() const { return (wxNode *)GetFirst(); } +inline wxNode *wxListBase::Last() const { return (wxNode *)GetLast(); } +inline wxNode *wxListBase::Nth(size_t n) const { return (wxNode *)Item(n); } + +#endif + +// define this to make a lot of noise about use of the old wxList classes. +//#define wxWARN_COMPAT_LIST_USE + +// ---------------------------------------------------------------------------- +// wxList compatibility class: in fact, it's a list of wxObjects +// ---------------------------------------------------------------------------- + +WX_DECLARE_LIST_2(wxObject, wxObjectList, wxObjectListNode, + class WXDLLIMPEXP_BASE); + +class WXDLLIMPEXP_BASE wxList : public wxObjectList +{ +public: +#if defined(wxWARN_COMPAT_LIST_USE) && !wxUSE_STD_CONTAINERS + wxList() { } + wxDEPRECATED( wxList(int key_type) ); +#elif !wxUSE_STD_CONTAINERS + wxList(int key_type = wxKEY_NONE); +#endif + + // this destructor is required for Darwin + ~wxList() { } + +#if !wxUSE_STD_CONTAINERS + wxList& operator=(const wxList& list) + { if (&list != this) Assign(list); return *this; } + + // compatibility methods + void Sort(wxSortCompareFunction compfunc) { wxListBase::Sort(compfunc); } +#endif // !wxUSE_STD_CONTAINERS + + template<typename T> + wxVector<T> AsVector() const + { + wxVector<T> vector(size()); + size_t i = 0; + + for ( const_iterator it = begin(); it != end(); ++it ) + { + vector[i++] = static_cast<T>(*it); + } + + return vector; + } + +}; + +#if !wxUSE_STD_CONTAINERS + +// wxListBase deprecated methods +inline wxListBase::operator wxList&() { return *static_cast<wxList*>(this); } +inline wxListBase::operator const wxList&() const { return *static_cast<const wxList*>(this); } + +// ----------------------------------------------------------------------------- +// wxStringList class for compatibility with the old code +// ----------------------------------------------------------------------------- +WX_DECLARE_LIST_2(wxChar, wxStringListBase, wxStringListNode, class WXDLLIMPEXP_BASE); + +class WXDLLIMPEXP_BASE wxStringList : public wxStringListBase +{ +public: + // ctors and such + // default +#ifdef wxWARN_COMPAT_LIST_USE + wxStringList(); + wxDEPRECATED( wxStringList(const wxChar *first ...) ); // FIXME-UTF8 +#else + wxStringList(); + wxStringList(const wxChar *first ...); // FIXME-UTF8 +#endif + + // copying the string list: the strings are copied, too (extremely + // inefficient!) + wxStringList(const wxStringList& other) : wxStringListBase() { DeleteContents(true); DoCopy(other); } + wxStringList& operator=(const wxStringList& other) + { + if (&other != this) + { + Clear(); + DoCopy(other); + } + return *this; + } + + // operations + // makes a copy of the string + wxNode *Add(const wxChar *s); + + // Append to beginning of list + wxNode *Prepend(const wxChar *s); + + bool Delete(const wxChar *s); + + wxChar **ListToArray(bool new_copies = false) const; + bool Member(const wxChar *s) const; + + // alphabetic sort + void Sort(); + +private: + void DoCopy(const wxStringList&); // common part of copy ctor and operator= +}; + +#else // if wxUSE_STD_CONTAINERS + +WX_DECLARE_LIST_XO(wxString, wxString, wxStringListBase, class WXDLLIMPEXP_BASE); + +class WXDLLIMPEXP_BASE wxStringList : public wxStringListBase +{ +public: + compatibility_iterator Append(wxChar* s) + { wxString tmp = s; delete[] s; return wxStringListBase::Append(tmp); } + compatibility_iterator Insert(wxChar* s) + { wxString tmp = s; delete[] s; return wxStringListBase::Insert(tmp); } + compatibility_iterator Insert(size_t pos, wxChar* s) + { + wxString tmp = s; + delete[] s; + return wxStringListBase::Insert(pos, tmp); + } + compatibility_iterator Add(const wxChar* s) + { push_back(s); return GetLast(); } + compatibility_iterator Prepend(const wxChar* s) + { push_front(s); return GetFirst(); } +}; + +#endif // wxUSE_STD_CONTAINERS + +#endif // wxLIST_COMPATIBILITY + +// delete all list elements +// +// NB: the class declaration of the list elements must be visible from the +// place where you use this macro, otherwise the proper destructor may not +// be called (a decent compiler should give a warning about it, but don't +// count on it)! +#define WX_CLEAR_LIST(type, list) \ + { \ + type::iterator it, en; \ + for( it = (list).begin(), en = (list).end(); it != en; ++it ) \ + delete *it; \ + (list).clear(); \ + } + +// append all element of one list to another one +#define WX_APPEND_LIST(list, other) \ + { \ + wxList::compatibility_iterator node = other->GetFirst(); \ + while ( node ) \ + { \ + (list)->push_back(node->GetData()); \ + node = node->GetNext(); \ + } \ + } + +#endif // _WX_LISTH__ diff --git a/lib/wxWidgets/include/wx/listbase.h b/lib/wxWidgets/include/wx/listbase.h new file mode 100644 index 0000000..9b200d1 --- /dev/null +++ b/lib/wxWidgets/include/wx/listbase.h @@ -0,0 +1,669 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/listbase.h +// Purpose: wxListCtrl class +// Author: Vadim Zeitlin +// Modified by: +// Created: 04.12.99 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LISTBASE_H_BASE_ +#define _WX_LISTBASE_H_BASE_ + +#include "wx/colour.h" +#include "wx/font.h" +#include "wx/gdicmn.h" +#include "wx/event.h" +#include "wx/control.h" +#include "wx/itemattr.h" +#include "wx/systhemectrl.h" +#include "wx/withimages.h" + +// ---------------------------------------------------------------------------- +// types +// ---------------------------------------------------------------------------- + +// type of compare function for wxListCtrl sort operation +typedef +int (wxCALLBACK *wxListCtrlCompare)(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData); + +// ---------------------------------------------------------------------------- +// wxListCtrl constants +// ---------------------------------------------------------------------------- + +// style flags +#define wxLC_VRULES 0x0001 +#define wxLC_HRULES 0x0002 + +#define wxLC_ICON 0x0004 +#define wxLC_SMALL_ICON 0x0008 +#define wxLC_LIST 0x0010 +#define wxLC_REPORT 0x0020 + +#define wxLC_ALIGN_TOP 0x0040 +#define wxLC_ALIGN_LEFT 0x0080 +#define wxLC_AUTOARRANGE 0x0100 +#define wxLC_VIRTUAL 0x0200 +#define wxLC_EDIT_LABELS 0x0400 +#define wxLC_NO_HEADER 0x0800 +#define wxLC_NO_SORT_HEADER 0x1000 +#define wxLC_SINGLE_SEL 0x2000 +#define wxLC_SORT_ASCENDING 0x4000 +#define wxLC_SORT_DESCENDING 0x8000 + +#define wxLC_MASK_TYPE (wxLC_ICON | wxLC_SMALL_ICON | wxLC_LIST | wxLC_REPORT) +#define wxLC_MASK_ALIGN (wxLC_ALIGN_TOP | wxLC_ALIGN_LEFT) +#define wxLC_MASK_SORT (wxLC_SORT_ASCENDING | wxLC_SORT_DESCENDING) + +// for compatibility only +#define wxLC_USER_TEXT wxLC_VIRTUAL + +// Omitted because +// (a) too much detail +// (b) not enough style flags +// (c) not implemented anyhow in the generic version +// +// #define wxLC_NO_SCROLL +// #define wxLC_NO_LABEL_WRAP +// #define wxLC_OWNERDRAW_FIXED +// #define wxLC_SHOW_SEL_ALWAYS + +// Mask flags to tell app/GUI what fields of wxListItem are valid +#define wxLIST_MASK_STATE 0x0001 +#define wxLIST_MASK_TEXT 0x0002 +#define wxLIST_MASK_IMAGE 0x0004 +#define wxLIST_MASK_DATA 0x0008 +#define wxLIST_SET_ITEM 0x0010 +#define wxLIST_MASK_WIDTH 0x0020 +#define wxLIST_MASK_FORMAT 0x0040 + +// State flags for indicating the state of an item +#define wxLIST_STATE_DONTCARE 0x0000 +#define wxLIST_STATE_DROPHILITED 0x0001 // MSW only +#define wxLIST_STATE_FOCUSED 0x0002 +#define wxLIST_STATE_SELECTED 0x0004 +#define wxLIST_STATE_CUT 0x0008 // MSW only +#define wxLIST_STATE_DISABLED 0x0010 // Not used +#define wxLIST_STATE_FILTERED 0x0020 // Not used +#define wxLIST_STATE_INUSE 0x0040 // Not used +#define wxLIST_STATE_PICKED 0x0080 // Not used +#define wxLIST_STATE_SOURCE 0x0100 // Not used + +// Hit test flags, used in HitTest +#define wxLIST_HITTEST_ABOVE 0x0001 // Above the control's client area. +#define wxLIST_HITTEST_BELOW 0x0002 // Below the control's client area. +#define wxLIST_HITTEST_NOWHERE 0x0004 // Inside the control's client area but not over an item. +#define wxLIST_HITTEST_ONITEMICON 0x0020 // Over an item's icon. +#define wxLIST_HITTEST_ONITEMLABEL 0x0080 // Over an item's text. +#define wxLIST_HITTEST_ONITEMRIGHT 0x0100 // Not used +#define wxLIST_HITTEST_ONITEMSTATEICON 0x0200 // Over the checkbox of an item. +#define wxLIST_HITTEST_TOLEFT 0x0400 // To the left of the control's client area. +#define wxLIST_HITTEST_TORIGHT 0x0800 // To the right of the control's client area. + +#define wxLIST_HITTEST_ONITEM (wxLIST_HITTEST_ONITEMICON | wxLIST_HITTEST_ONITEMLABEL | wxLIST_HITTEST_ONITEMSTATEICON) + +// GetSubItemRect constants +#define wxLIST_GETSUBITEMRECT_WHOLEITEM -1l + +// Flags for GetNextItem (MSW only except wxLIST_NEXT_ALL) +enum +{ + wxLIST_NEXT_ABOVE, // Searches for an item above the specified item + wxLIST_NEXT_ALL, // Searches for subsequent item by index + wxLIST_NEXT_BELOW, // Searches for an item below the specified item + wxLIST_NEXT_LEFT, // Searches for an item to the left of the specified item + wxLIST_NEXT_RIGHT // Searches for an item to the right of the specified item +}; + +// Alignment flags for Arrange (MSW only except wxLIST_ALIGN_LEFT) +enum +{ + wxLIST_ALIGN_DEFAULT, + wxLIST_ALIGN_LEFT, + wxLIST_ALIGN_TOP, + wxLIST_ALIGN_SNAP_TO_GRID +}; + +// Column format (MSW only except wxLIST_FORMAT_LEFT) +enum wxListColumnFormat +{ + wxLIST_FORMAT_LEFT, + wxLIST_FORMAT_RIGHT, + wxLIST_FORMAT_CENTRE, + wxLIST_FORMAT_CENTER = wxLIST_FORMAT_CENTRE +}; + +// Values for SetColumnWidth() +enum +{ + wxLIST_AUTOSIZE = -1, + wxLIST_AUTOSIZE_USEHEADER = -2, // partly supported by generic version + wxLIST_DEFAULT_COL_WIDTH = 80 +}; + +// Flag values for GetItemRect +enum +{ + wxLIST_RECT_BOUNDS, + wxLIST_RECT_ICON, + wxLIST_RECT_LABEL +}; + +// Flag values for FindItem (MSW only) +enum +{ + wxLIST_FIND_UP, + wxLIST_FIND_DOWN, + wxLIST_FIND_LEFT, + wxLIST_FIND_RIGHT +}; + +// For compatibility, define the old name for this class. There is no need to +// deprecate it as it doesn't cost us anything to keep this typedef, but the +// new code should prefer to use the new wxItemAttr name. +typedef wxItemAttr wxListItemAttr; + +// ---------------------------------------------------------------------------- +// wxListItem: the item or column info, used to exchange data with wxListCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxListItem : public wxObject +{ +public: + wxListItem() { Init(); m_attr = NULL; } + wxListItem(const wxListItem& item) + : wxObject(), + m_mask(item.m_mask), + m_itemId(item.m_itemId), + m_col(item.m_col), + m_state(item.m_state), + m_stateMask(item.m_stateMask), + m_text(item.m_text), + m_image(item.m_image), + m_data(item.m_data), + m_format(item.m_format), + m_width(item.m_width), + m_attr(NULL) + { + // copy list item attributes + if ( item.HasAttributes() ) + m_attr = new wxItemAttr(*item.GetAttributes()); + } + + wxListItem& operator=(const wxListItem& item) + { + if ( &item != this ) + { + m_mask = item.m_mask; + m_itemId = item.m_itemId; + m_col = item.m_col; + m_state = item.m_state; + m_stateMask = item.m_stateMask; + m_text = item.m_text; + m_image = item.m_image; + m_data = item.m_data; + m_format = item.m_format; + m_width = item.m_width; + m_attr = item.m_attr ? new wxItemAttr(*item.m_attr) : NULL; + } + + return *this; + } + + virtual ~wxListItem() { delete m_attr; } + + // resetting + void Clear() { Init(); m_text.clear(); ClearAttributes(); } + void ClearAttributes() { if ( m_attr ) { delete m_attr; m_attr = NULL; } } + + // setters + void SetMask(long mask) + { m_mask = mask; } + void SetId(long id) + { m_itemId = id; } + void SetColumn(int col) + { m_col = col; } + void SetState(long state) + { m_mask |= wxLIST_MASK_STATE; m_state = state; m_stateMask |= state; } + void SetStateMask(long stateMask) + { m_stateMask = stateMask; } + void SetText(const wxString& text) + { m_mask |= wxLIST_MASK_TEXT; m_text = text; } + void SetImage(int image) + { m_mask |= wxLIST_MASK_IMAGE; m_image = image; } + void SetData(long data) + { m_mask |= wxLIST_MASK_DATA; m_data = data; } + void SetData(void *data) + { m_mask |= wxLIST_MASK_DATA; m_data = wxPtrToUInt(data); } + + void SetWidth(int width) + { m_mask |= wxLIST_MASK_WIDTH; m_width = width; } + void SetAlign(wxListColumnFormat align) + { m_mask |= wxLIST_MASK_FORMAT; m_format = align; } + + void SetTextColour(const wxColour& colText) + { Attributes().SetTextColour(colText); } + void SetBackgroundColour(const wxColour& colBack) + { Attributes().SetBackgroundColour(colBack); } + void SetFont(const wxFont& font) + { Attributes().SetFont(font); } + + // accessors + long GetMask() const { return m_mask; } + long GetId() const { return m_itemId; } + int GetColumn() const { return m_col; } + long GetState() const { return m_state & m_stateMask; } + const wxString& GetText() const { return m_text; } + int GetImage() const { return m_image; } + wxUIntPtr GetData() const { return m_data; } + + int GetWidth() const { return m_width; } + wxListColumnFormat GetAlign() const { return (wxListColumnFormat)m_format; } + + wxItemAttr *GetAttributes() const { return m_attr; } + bool HasAttributes() const { return m_attr != NULL; } + + wxColour GetTextColour() const + { return HasAttributes() ? m_attr->GetTextColour() : wxNullColour; } + wxColour GetBackgroundColour() const + { return HasAttributes() ? m_attr->GetBackgroundColour() + : wxNullColour; } + wxFont GetFont() const + { return HasAttributes() ? m_attr->GetFont() : wxNullFont; } + + // this conversion is necessary to make old code using GetItem() to + // compile + operator long() const { return m_itemId; } + + // these members are public for compatibility + + long m_mask; // Indicates what fields are valid + long m_itemId; // The zero-based item position + int m_col; // Zero-based column, if in report mode + long m_state; // The state of the item + long m_stateMask;// Which flags of m_state are valid (uses same flags) + wxString m_text; // The label/header text + int m_image; // The zero-based index into an image list + wxUIntPtr m_data; // App-defined data + + // For columns only + int m_format; // left, right, centre + int m_width; // width of column + +protected: + // creates m_attr if we don't have it yet + wxItemAttr& Attributes() + { + if ( !m_attr ) + m_attr = new wxItemAttr; + + return *m_attr; + } + + void Init() + { + m_mask = 0; + m_itemId = -1; + m_col = 0; + m_state = 0; + m_stateMask = 0; + m_image = -1; + m_data = 0; + + m_format = wxLIST_FORMAT_CENTRE; + m_width = 0; + } + + wxItemAttr *m_attr; // optional pointer to the items style + +private: + wxDECLARE_DYNAMIC_CLASS(wxListItem); +}; + +// ---------------------------------------------------------------------------- +// wxListCtrlBase: the base class for the main control itself. +// ---------------------------------------------------------------------------- + +// Unlike other base classes, this class doesn't currently define the API of +// the real control class but is just used for implementation convenience. We +// should define the public class functions as pure virtual here in the future +// however. +class WXDLLIMPEXP_CORE wxListCtrlBase : public wxSystemThemedControl<wxControl> +{ +public: + wxListCtrlBase() { } + + // Image-related methods. + // ---------------------- + + // Preferred way of specifying the images is by using the SetXXXImages(), + // methods using wxImageList below still work, but don't allow specifying + // images in different resolutions, which is necessary for good appearance + // on high DPI displays. + + // "Normal" images are used only in icon view, the "report" view uses + // "small" images. + void SetNormalImages(const wxVector<wxBitmapBundle>& images); + void SetSmallImages(const wxVector<wxBitmapBundle>& images); + + // Associate the given (possibly NULL to indicate that no images will be + // used) image list with the control. The ownership of the image list + // passes to the control, i.e. it will be deleted when the control itself + // is destroyed. + // + // The value of "which" must be one of wxIMAGE_LIST_{NORMAL,SMALL,STATE}. + virtual void AssignImageList(wxImageList* imageList, int which); + + // Same as AssignImageList() but the control does not delete the image list + // so it can be shared among several controls. + virtual void SetImageList(wxImageList* imageList, int which); + + // Return the currently used image list, may be NULL. + virtual wxImageList* GetImageList(int which) const; + + + // Column-related methods. + // ----------------------- + + // All these methods can only be used in report view mode. + + // Appends a new column. + // + // Returns the index of the newly inserted column or -1 on error. + long AppendColumn(const wxString& heading, + wxListColumnFormat format = wxLIST_FORMAT_LEFT, + int width = -1); + + // Add a new column to the control at the position "col". + // + // Returns the index of the newly inserted column or -1 on error. + long InsertColumn(long col, const wxListItem& info); + long InsertColumn(long col, + const wxString& heading, + int format = wxLIST_FORMAT_LEFT, + int width = wxLIST_AUTOSIZE); + + // Delete the given or all columns. + virtual bool DeleteColumn(int col) = 0; + virtual bool DeleteAllColumns() = 0; + + // Return the current number of items. + virtual int GetItemCount() const = 0; + + // Check if the control is empty, i.e. doesn't contain any items. + bool IsEmpty() const { return GetItemCount() == 0; } + + // Return the current number of columns. + virtual int GetColumnCount() const = 0; + + // Get or update information about the given column. Set item mask to + // indicate the fields to retrieve or change. + // + // Returns false on error, e.g. if the column index is invalid. + virtual bool GetColumn(int col, wxListItem& item) const = 0; + virtual bool SetColumn(int col, const wxListItem& item) = 0; + + // Convenient wrappers for the above methods which get or update just the + // column width. + virtual int GetColumnWidth(int col) const = 0; + virtual bool SetColumnWidth(int col, int width) = 0; + + // Column ordering functions + virtual int GetColumnOrder(int col) const = 0; + virtual int GetColumnIndexFromOrder(int order) const = 0; + + virtual wxArrayInt GetColumnsOrder() const = 0; + virtual bool SetColumnsOrder(const wxArrayInt& orders) = 0; + + + // Other miscellaneous accessors. + // ------------------------------ + + // Convenient functions for testing the list control mode: + bool InReportView() const { return HasFlag(wxLC_REPORT); } + bool IsVirtual() const { return HasFlag(wxLC_VIRTUAL); } + + // Check if the item is visible + virtual bool IsVisible(long WXUNUSED(item)) const { return false; } + + // Enable or disable beep when incremental match doesn't find any item. + // Only implemented in the generic version currently. + virtual void EnableBellOnNoMatch(bool WXUNUSED(on) = true) { } + + void EnableAlternateRowColours(bool enable = true); + void SetAlternateRowColour(const wxColour& colour); + wxColour GetAlternateRowColour() const { return m_alternateRowColour.GetBackgroundColour(); } + + virtual void ExtendRulesAndAlternateColour(bool WXUNUSED(extend) = true) { } + + // Header attributes support: only implemented in wxMSW currently. + virtual bool SetHeaderAttr(const wxItemAttr& WXUNUSED(attr)) { return false; } + + // Checkboxes support. + virtual bool HasCheckBoxes() const { return false; } + virtual bool EnableCheckBoxes(bool WXUNUSED(enable) = true) { return false; } + virtual bool IsItemChecked(long WXUNUSED(item)) const { return false; } + virtual void CheckItem(long WXUNUSED(item), bool WXUNUSED(check)) { } + + // Sort indicator in header. + virtual void ShowSortIndicator(int WXUNUSED(col), bool WXUNUSED(ascending) = true) { } + void RemoveSortIndicator() { ShowSortIndicator(-1); } + virtual int GetSortIndicator() const { return -1; } + virtual bool IsAscendingSortIndicator() const { return true; } + bool GetUpdatedAscendingSortIndicator(int col) const + { + // If clicking on the same column by which we already sort, toggle the sort + // direction, otherwise use ascending sort by default. + return col == GetSortIndicator() ? !IsAscendingSortIndicator() : true; + } + +protected: + // Return pointer to the corresponding m_imagesXXX. + const wxWithImages* GetImages(int which) const; + wxWithImages* GetImages(int which); + + // Helper updating or creating the image list, if necessary, unlike + // GetImageList() which just returns the previously set image list. + wxImageList* GetUpdatedImageList(int which); + + // Real implementations methods to which our public forwards. + virtual long DoInsertColumn(long col, const wxListItem& info) = 0; + virtual void DoUpdateImages(int which) = 0; + + // Overridden methods of the base class. + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + + // these functions are only used for virtual list view controls, i.e. the + // ones with wxLC_VIRTUAL style + + // return the attribute for the item (may return NULL if none) + virtual wxItemAttr* OnGetItemAttr(long item) const; + + // return the text for the given column of the given item + virtual wxString OnGetItemText(long item, long column) const; + + // return whether the given item is checked + virtual bool OnGetItemIsChecked(long item) const; + + // return the icon for the given item. In report view, OnGetItemImage will + // only be called for the first column. See OnGetItemColumnImage for + // details. + virtual int OnGetItemImage(long item) const; + + // return the icon for the given item and column. + virtual int OnGetItemColumnImage(long item, long column) const; + + // return the attribute for the given item and column (may return NULL if none) + virtual wxItemAttr* OnGetItemColumnAttr(long item, long column) const; + +private: + wxWithImages m_imagesNormal, + m_imagesSmall, + m_imagesState; + + // user defined color to draw row lines, may be invalid + wxItemAttr m_alternateRowColour; +}; + +// ---------------------------------------------------------------------------- +// wxListEvent - the event class for the wxListCtrl notifications +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxListEvent : public wxNotifyEvent +{ +public: + wxListEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) + : wxNotifyEvent(commandType, winid) + , m_code(-1) + , m_oldItemIndex(-1) + , m_itemIndex(-1) + , m_col(-1) + , m_pointDrag() + , m_item() + , m_editCancelled(false) + { } + + wxListEvent(const wxListEvent& event) + : wxNotifyEvent(event) + , m_code(event.m_code) + , m_oldItemIndex(event.m_oldItemIndex) + , m_itemIndex(event.m_itemIndex) + , m_col(event.m_col) + , m_pointDrag(event.m_pointDrag) + , m_item(event.m_item) + , m_editCancelled(event.m_editCancelled) + { } + + int GetKeyCode() const { return m_code; } + long GetIndex() const { return m_itemIndex; } + int GetColumn() const { return m_col; } + wxPoint GetPoint() const { return m_pointDrag; } + const wxString& GetLabel() const { return m_item.m_text; } + const wxString& GetText() const { return m_item.m_text; } + int GetImage() const { return m_item.m_image; } + wxUIntPtr GetData() const { return m_item.m_data; } + long GetMask() const { return m_item.m_mask; } + const wxListItem& GetItem() const { return m_item; } + + void SetKeyCode(int code) { m_code = code; } + void SetIndex(long index) { m_itemIndex = index; } + void SetColumn(int col) { m_col = col; } + void SetPoint(const wxPoint& point) { m_pointDrag = point; } + void SetItem(const wxListItem& item) { m_item = item; } + + // for wxEVT_LIST_CACHE_HINT only + long GetCacheFrom() const { return m_oldItemIndex; } + long GetCacheTo() const { return m_itemIndex; } + void SetCacheFrom(long cacheFrom) { m_oldItemIndex = cacheFrom; } + void SetCacheTo(long cacheTo) { m_itemIndex = cacheTo; } + + // was label editing canceled? (for wxEVT_LIST_END_LABEL_EDIT only) + bool IsEditCancelled() const { return m_editCancelled; } + void SetEditCanceled(bool editCancelled) { m_editCancelled = editCancelled; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxListEvent(*this); } + +//protected: -- not for backwards compatibility + int m_code; + long m_oldItemIndex; // only for wxEVT_LIST_CACHE_HINT + long m_itemIndex; + int m_col; + wxPoint m_pointDrag; + + wxListItem m_item; + +protected: + bool m_editCancelled; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxListEvent); +}; + +// ---------------------------------------------------------------------------- +// wxListCtrl event macros +// ---------------------------------------------------------------------------- + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_BEGIN_DRAG, wxListEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_BEGIN_RDRAG, wxListEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_BEGIN_LABEL_EDIT, wxListEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_END_LABEL_EDIT, wxListEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_DELETE_ITEM, wxListEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_DELETE_ALL_ITEMS, wxListEvent ); + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_ITEM_SELECTED, wxListEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_ITEM_DESELECTED, wxListEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_KEY_DOWN, wxListEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_INSERT_ITEM, wxListEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_COL_CLICK, wxListEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_ITEM_RIGHT_CLICK, wxListEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_ITEM_MIDDLE_CLICK, wxListEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_ITEM_ACTIVATED, wxListEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_CACHE_HINT, wxListEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_COL_RIGHT_CLICK, wxListEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_COL_BEGIN_DRAG, wxListEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_COL_DRAGGING, wxListEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_COL_END_DRAG, wxListEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_ITEM_FOCUSED, wxListEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_ITEM_CHECKED, wxListEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_ITEM_UNCHECKED, wxListEvent ); + +typedef void (wxEvtHandler::*wxListEventFunction)(wxListEvent&); + +#define wxListEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxListEventFunction, func) + +#define wx__DECLARE_LISTEVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_LIST_ ## evt, id, wxListEventHandler(fn)) + +#define EVT_LIST_BEGIN_DRAG(id, fn) wx__DECLARE_LISTEVT(BEGIN_DRAG, id, fn) +#define EVT_LIST_BEGIN_RDRAG(id, fn) wx__DECLARE_LISTEVT(BEGIN_RDRAG, id, fn) +#define EVT_LIST_BEGIN_LABEL_EDIT(id, fn) wx__DECLARE_LISTEVT(BEGIN_LABEL_EDIT, id, fn) +#define EVT_LIST_END_LABEL_EDIT(id, fn) wx__DECLARE_LISTEVT(END_LABEL_EDIT, id, fn) +#define EVT_LIST_DELETE_ITEM(id, fn) wx__DECLARE_LISTEVT(DELETE_ITEM, id, fn) +#define EVT_LIST_DELETE_ALL_ITEMS(id, fn) wx__DECLARE_LISTEVT(DELETE_ALL_ITEMS, id, fn) +#define EVT_LIST_KEY_DOWN(id, fn) wx__DECLARE_LISTEVT(KEY_DOWN, id, fn) +#define EVT_LIST_INSERT_ITEM(id, fn) wx__DECLARE_LISTEVT(INSERT_ITEM, id, fn) + +#define EVT_LIST_COL_CLICK(id, fn) wx__DECLARE_LISTEVT(COL_CLICK, id, fn) +#define EVT_LIST_COL_RIGHT_CLICK(id, fn) wx__DECLARE_LISTEVT(COL_RIGHT_CLICK, id, fn) +#define EVT_LIST_COL_BEGIN_DRAG(id, fn) wx__DECLARE_LISTEVT(COL_BEGIN_DRAG, id, fn) +#define EVT_LIST_COL_DRAGGING(id, fn) wx__DECLARE_LISTEVT(COL_DRAGGING, id, fn) +#define EVT_LIST_COL_END_DRAG(id, fn) wx__DECLARE_LISTEVT(COL_END_DRAG, id, fn) + +#define EVT_LIST_ITEM_SELECTED(id, fn) wx__DECLARE_LISTEVT(ITEM_SELECTED, id, fn) +#define EVT_LIST_ITEM_DESELECTED(id, fn) wx__DECLARE_LISTEVT(ITEM_DESELECTED, id, fn) +#define EVT_LIST_ITEM_RIGHT_CLICK(id, fn) wx__DECLARE_LISTEVT(ITEM_RIGHT_CLICK, id, fn) +#define EVT_LIST_ITEM_MIDDLE_CLICK(id, fn) wx__DECLARE_LISTEVT(ITEM_MIDDLE_CLICK, id, fn) +#define EVT_LIST_ITEM_ACTIVATED(id, fn) wx__DECLARE_LISTEVT(ITEM_ACTIVATED, id, fn) +#define EVT_LIST_ITEM_FOCUSED(id, fn) wx__DECLARE_LISTEVT(ITEM_FOCUSED, id, fn) +#define EVT_LIST_ITEM_CHECKED(id, fn) wx__DECLARE_LISTEVT(ITEM_CHECKED, id, fn) +#define EVT_LIST_ITEM_UNCHECKED(id, fn) wx__DECLARE_LISTEVT(ITEM_UNCHECKED, id, fn) + +#define EVT_LIST_CACHE_HINT(id, fn) wx__DECLARE_LISTEVT(CACHE_HINT, id, fn) + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_LIST_BEGIN_DRAG wxEVT_LIST_BEGIN_DRAG +#define wxEVT_COMMAND_LIST_BEGIN_RDRAG wxEVT_LIST_BEGIN_RDRAG +#define wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT wxEVT_LIST_BEGIN_LABEL_EDIT +#define wxEVT_COMMAND_LIST_END_LABEL_EDIT wxEVT_LIST_END_LABEL_EDIT +#define wxEVT_COMMAND_LIST_DELETE_ITEM wxEVT_LIST_DELETE_ITEM +#define wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS wxEVT_LIST_DELETE_ALL_ITEMS +#define wxEVT_COMMAND_LIST_ITEM_SELECTED wxEVT_LIST_ITEM_SELECTED +#define wxEVT_COMMAND_LIST_ITEM_DESELECTED wxEVT_LIST_ITEM_DESELECTED +#define wxEVT_COMMAND_LIST_KEY_DOWN wxEVT_LIST_KEY_DOWN +#define wxEVT_COMMAND_LIST_INSERT_ITEM wxEVT_LIST_INSERT_ITEM +#define wxEVT_COMMAND_LIST_COL_CLICK wxEVT_LIST_COL_CLICK +#define wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK wxEVT_LIST_ITEM_RIGHT_CLICK +#define wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK wxEVT_LIST_ITEM_MIDDLE_CLICK +#define wxEVT_COMMAND_LIST_ITEM_ACTIVATED wxEVT_LIST_ITEM_ACTIVATED +#define wxEVT_COMMAND_LIST_CACHE_HINT wxEVT_LIST_CACHE_HINT +#define wxEVT_COMMAND_LIST_COL_RIGHT_CLICK wxEVT_LIST_COL_RIGHT_CLICK +#define wxEVT_COMMAND_LIST_COL_BEGIN_DRAG wxEVT_LIST_COL_BEGIN_DRAG +#define wxEVT_COMMAND_LIST_COL_DRAGGING wxEVT_LIST_COL_DRAGGING +#define wxEVT_COMMAND_LIST_COL_END_DRAG wxEVT_LIST_COL_END_DRAG +#define wxEVT_COMMAND_LIST_ITEM_FOCUSED wxEVT_LIST_ITEM_FOCUSED + + +#endif + // _WX_LISTCTRL_H_BASE_ diff --git a/lib/wxWidgets/include/wx/listbook.h b/lib/wxWidgets/include/wx/listbook.h new file mode 100644 index 0000000..4a4d7a6 --- /dev/null +++ b/lib/wxWidgets/include/wx/listbook.h @@ -0,0 +1,133 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/listbook.h +// Purpose: wxListbook: wxListCtrl and wxNotebook combination +// Author: Vadim Zeitlin +// Modified by: +// Created: 19.08.03 +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LISTBOOK_H_ +#define _WX_LISTBOOK_H_ + +#include "wx/defs.h" + +#if wxUSE_LISTBOOK + +#include "wx/bookctrl.h" +#include "wx/containr.h" + +class WXDLLIMPEXP_FWD_CORE wxListView; +class WXDLLIMPEXP_FWD_CORE wxListEvent; + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LISTBOOK_PAGE_CHANGED, wxBookCtrlEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LISTBOOK_PAGE_CHANGING, wxBookCtrlEvent ); + +// wxListbook flags +#define wxLB_DEFAULT wxBK_DEFAULT +#define wxLB_TOP wxBK_TOP +#define wxLB_BOTTOM wxBK_BOTTOM +#define wxLB_LEFT wxBK_LEFT +#define wxLB_RIGHT wxBK_RIGHT +#define wxLB_ALIGN_MASK wxBK_ALIGN_MASK + +// ---------------------------------------------------------------------------- +// wxListbook +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxListbook : public wxNavigationEnabled<wxBookCtrlBase> +{ +public: + wxListbook() { } + + wxListbook(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxEmptyString) + { + (void)Create(parent, id, pos, size, style, name); + } + + // quasi ctor + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxEmptyString); + + + // overridden base class methods + virtual bool SetPageText(size_t n, const wxString& strText) wxOVERRIDE; + virtual wxString GetPageText(size_t n) const wxOVERRIDE; + virtual int GetPageImage(size_t n) const wxOVERRIDE; + virtual bool SetPageImage(size_t n, int imageId) wxOVERRIDE; + virtual bool InsertPage(size_t n, + wxWindow *page, + const wxString& text, + bool bSelect = false, + int imageId = NO_IMAGE) wxOVERRIDE; + virtual int SetSelection(size_t n) wxOVERRIDE { return DoSetSelection(n, SetSelection_SendEvent); } + virtual int ChangeSelection(size_t n) wxOVERRIDE { return DoSetSelection(n); } + virtual int HitTest(const wxPoint& pt, long *flags = NULL) const wxOVERRIDE; + + virtual bool DeleteAllPages() wxOVERRIDE; + + wxListView* GetListView() const { return (wxListView*)m_bookctrl; } + +protected: + virtual wxWindow *DoRemovePage(size_t page) wxOVERRIDE; + + virtual void OnImagesChanged() wxOVERRIDE; + + void UpdateSelectedPage(size_t newsel) wxOVERRIDE; + + wxBookCtrlEvent* CreatePageChangingEvent() const wxOVERRIDE; + void MakeChangedEvent(wxBookCtrlEvent &event) wxOVERRIDE; + + // event handlers + void OnListSelected(wxListEvent& event); + void OnSize(wxSizeEvent& event); + +private: + // this should be called when we need to be relaid out + void UpdateSize(); + + // Get the correct wxListCtrl flags to use depending on our own flags. + long GetListCtrlFlags(bool hasImages) const; + + // Update list control wxLC_ICON flag depending on whether we have images. + void SyncListCtrlIconFlag(bool hasImages); + + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxListbook); +}; + +// ---------------------------------------------------------------------------- +// listbook event class and related stuff +// ---------------------------------------------------------------------------- + +// wxListbookEvent is obsolete and defined for compatibility only (notice that +// we use #define and not typedef to also keep compatibility with the existing +// code which forward declares it) +#define wxListbookEvent wxBookCtrlEvent +typedef wxBookCtrlEventFunction wxListbookEventFunction; +#define wxListbookEventHandler(func) wxBookCtrlEventHandler(func) + +#define EVT_LISTBOOK_PAGE_CHANGED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_LISTBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn)) + +#define EVT_LISTBOOK_PAGE_CHANGING(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_LISTBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn)) + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED wxEVT_LISTBOOK_PAGE_CHANGED +#define wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING wxEVT_LISTBOOK_PAGE_CHANGING + +#endif // wxUSE_LISTBOOK + +#endif // _WX_LISTBOOK_H_ diff --git a/lib/wxWidgets/include/wx/listbox.h b/lib/wxWidgets/include/wx/listbox.h new file mode 100644 index 0000000..69525e2 --- /dev/null +++ b/lib/wxWidgets/include/wx/listbox.h @@ -0,0 +1,166 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/listbox.h +// Purpose: wxListBox class interface +// Author: Vadim Zeitlin +// Modified by: +// Created: 22.10.99 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LISTBOX_H_BASE_ +#define _WX_LISTBOX_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_LISTBOX + +#include "wx/ctrlsub.h" // base class + +// forward declarations are enough here +class WXDLLIMPEXP_FWD_BASE wxArrayInt; +class WXDLLIMPEXP_FWD_BASE wxArrayString; + +// ---------------------------------------------------------------------------- +// global data +// ---------------------------------------------------------------------------- + +extern WXDLLIMPEXP_DATA_CORE(const char) wxListBoxNameStr[]; + +// ---------------------------------------------------------------------------- +// wxListBox interface is defined by the class wxListBoxBase +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxListBoxBase : public wxControlWithItems +{ +public: + wxListBoxBase() { } + virtual ~wxListBoxBase(); + + void InsertItems(unsigned int nItems, const wxString *items, unsigned int pos) + { Insert(nItems, items, pos); } + void InsertItems(const wxArrayString& items, unsigned int pos) + { Insert(items, pos); } + + // multiple selection logic + virtual bool IsSelected(int n) const = 0; + virtual void SetSelection(int n) wxOVERRIDE; + void SetSelection(int n, bool select) { DoSetSelection(n, select); } + void Deselect(int n) { DoSetSelection(n, false); } + void DeselectAll(int itemToLeaveSelected = -1); + + virtual bool SetStringSelection(const wxString& s, bool select); + virtual bool SetStringSelection(const wxString& s) + { + return SetStringSelection(s, true); + } + + // works for single as well as multiple selection listboxes (unlike + // GetSelection which only works for listboxes with single selection) + virtual int GetSelections(wxArrayInt& aSelections) const = 0; + + // set the specified item at the first visible item or scroll to max + // range. + void SetFirstItem(int n) { DoSetFirstItem(n); } + void SetFirstItem(const wxString& s); + + // ensures that the given item is visible scrolling the listbox if + // necessary + virtual void EnsureVisible(int n); + + virtual int GetTopItem() const { return wxNOT_FOUND; } + virtual int GetCountPerPage() const { return -1; } + + // a combination of Append() and EnsureVisible(): appends the item to the + // listbox and ensures that it is visible i.e. not scrolled out of view + void AppendAndEnsureVisible(const wxString& s); + + // return true if the listbox allows multiple selection + bool HasMultipleSelection() const + { + return (m_windowStyle & wxLB_MULTIPLE) || + (m_windowStyle & wxLB_EXTENDED); + } + + // override wxItemContainer::IsSorted + virtual bool IsSorted() const wxOVERRIDE { return HasFlag( wxLB_SORT ); } + + // emulate selecting or deselecting the item event.GetInt() (depending on + // event.GetExtraLong()) + void Command(wxCommandEvent& event) wxOVERRIDE; + + // return the index of the item at this position or wxNOT_FOUND + int HitTest(const wxPoint& point) const { return DoListHitTest(point); } + int HitTest(int x, int y) const { return DoListHitTest(wxPoint(x, y)); } + + +protected: + virtual void DoSetFirstItem(int n) = 0; + + virtual void DoSetSelection(int n, bool select) = 0; + + // there is already wxWindow::DoHitTest() so call this one differently + virtual int DoListHitTest(const wxPoint& WXUNUSED(point)) const + { return wxNOT_FOUND; } + + // Helper for the code generating events in single selection mode: updates + // m_oldSelections and return true if the selection really changed. + // Otherwise just returns false. + bool DoChangeSingleSelection(int item); + + // Helper for generating events in multiple and extended mode: compare the + // current selections with the previously recorded ones (in + // m_oldSelections) and send the appropriate event if they differ, + // otherwise just return false. + bool CalcAndSendEvent(); + + // Send a listbox (de)selection or double click event. + // + // Returns true if the event was processed. + bool SendEvent(wxEventType evtType, int item, bool selected); + + // Array storing the indices of all selected items that we already notified + // the user code about for multi selection list boxes. + // + // For single selection list boxes, we reuse this array to store the single + // currently selected item, this is used by DoChangeSingleSelection(). + // + // TODO-OPT: wxSelectionStore would be more efficient for big list boxes. + wxArrayInt m_oldSelections; + + // Update m_oldSelections with currently selected items (does nothing in + // single selection mode on platforms other than MSW). + void UpdateOldSelections(); + +private: + wxDECLARE_NO_COPY_CLASS(wxListBoxBase); +}; + +// ---------------------------------------------------------------------------- +// include the platform-specific class declaration +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/listbox.h" +#elif defined(__WXMSW__) + #include "wx/msw/listbox.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/listbox.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/listbox.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/listbox.h" +#elif defined(__WXMAC__) + #include "wx/osx/listbox.h" +#elif defined(__WXQT__) + #include "wx/qt/listbox.h" +#endif + +#endif // wxUSE_LISTBOX + +#endif + // _WX_LISTBOX_H_BASE_ diff --git a/lib/wxWidgets/include/wx/listctrl.h b/lib/wxWidgets/include/wx/listctrl.h new file mode 100644 index 0000000..09a713c --- /dev/null +++ b/lib/wxWidgets/include/wx/listctrl.h @@ -0,0 +1,109 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/listctrl.h +// Purpose: wxListCtrl class +// Author: Vadim Zeitlin +// Modified by: +// Created: 04.12.99 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LISTCTRL_H_BASE_ +#define _WX_LISTCTRL_H_BASE_ + +#include "wx/defs.h" // headers should include this before first wxUSE_XXX check + +#if wxUSE_LISTCTRL + +#include "wx/listbase.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +extern WXDLLIMPEXP_DATA_CORE(const char) wxListCtrlNameStr[]; + +// ---------------------------------------------------------------------------- +// include the wxListCtrl class declaration +// ---------------------------------------------------------------------------- + +#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) + #include "wx/msw/listctrl.h" +#elif defined(__WXQT__) && !defined(__WXUNIVERSAL__) + #include "wx/qt/listctrl.h" +#else + #include "wx/generic/listctrl.h" +#endif + +// ---------------------------------------------------------------------------- +// wxListView: a class which provides a better API for list control +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxListView : public wxListCtrl +{ +public: + wxListView() { } + wxListView( wxWindow *parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxLC_REPORT, + const wxValidator& validator = wxDefaultValidator, + const wxString &name = wxASCII_STR(wxListCtrlNameStr)) + { + Create(parent, winid, pos, size, style, validator, name); + } + + // focus/selection stuff + // --------------------- + + // [de]select an item + void Select(long n, bool on = true) + { + SetItemState(n, on ? wxLIST_STATE_SELECTED : 0, wxLIST_STATE_SELECTED); + } + + // focus and show the given item + void Focus(long index) + { + SetItemState(index, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED); + EnsureVisible(index); + } + + // get the currently focused item or -1 if none + long GetFocusedItem() const + { + return GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED); + } + + // get first and subsequent selected items, return -1 when no more + long GetNextSelected(long item) const + { return GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); } + long GetFirstSelected() const + { return GetNextSelected(-1); } + + // return true if the item is selected + bool IsSelected(long index) const + { return GetItemState(index, wxLIST_STATE_SELECTED) != 0; } + + // columns + // ------- + + void SetColumnImage(int col, int image) + { + wxListItem item; + item.SetMask(wxLIST_MASK_IMAGE); + item.SetImage(image); + SetColumn(col, item); + } + + void ClearColumnImage(int col) { SetColumnImage(col, -1); } + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxListView); +}; + +#endif // wxUSE_LISTCTRL + +#endif + // _WX_LISTCTRL_H_BASE_ diff --git a/lib/wxWidgets/include/wx/listimpl.cpp b/lib/wxWidgets/include/wx/listimpl.cpp new file mode 100644 index 0000000..f3a4a1b --- /dev/null +++ b/lib/wxWidgets/include/wx/listimpl.cpp @@ -0,0 +1,35 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/listimpl.cpp +// Purpose: second-part of macro based implementation of template lists +// Author: Vadim Zeitlin +// Modified by: +// Created: 16/11/98 +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if wxUSE_STD_CONTAINERS + +#undef WX_DEFINE_LIST +#define WX_DEFINE_LIST(name) \ + void _WX_LIST_HELPER_##name::DeleteFunction( _WX_LIST_ITEM_TYPE_##name X )\ + { \ + delete X; \ + } \ + _WX_LIST_HELPER_##name::BaseListType _WX_LIST_HELPER_##name::EmptyList; + +#else // !wxUSE_STD_CONTAINERS + #undef WX_DEFINE_LIST_2 + #define WX_DEFINE_LIST_2(T, name) \ + void wx##name##Node::DeleteData() \ + { \ + delete (T *)GetData(); \ + } + + // redefine the macro so that now it will generate the class implementation + // old value would provoke a compile-time error if this file is not included + #undef WX_DEFINE_LIST + #define WX_DEFINE_LIST(name) WX_DEFINE_LIST_2(_WX_LIST_ITEM_TYPE_##name, name) + +#endif // wxUSE_STD_CONTAINERS/!wxUSE_STD_CONTAINERS + diff --git a/lib/wxWidgets/include/wx/localedefs.h b/lib/wxWidgets/include/wx/localedefs.h new file mode 100644 index 0000000..4656f36 --- /dev/null +++ b/lib/wxWidgets/include/wx/localedefs.h @@ -0,0 +1,167 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/localedefs.h +// Purpose: Definitions of common locale-related constants and structs. +// Author: Vadim Zeitlin +// Created: 2021-07-31 (extracted from wx/intl.h) +// Copyright: (c) 2021 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LOCALEDEFS_H_ +#define _WX_LOCALEDEFS_H_ + +// ---------------------------------------------------------------------------- +// wxLayoutDirection: used by wxWindow, wxDC etc +// ---------------------------------------------------------------------------- + +// Note that this one must be available even when wxUSE_INTL == 0 as it's used +// outside of locale code too. + +enum wxLayoutDirection +{ + wxLayout_Default, + wxLayout_LeftToRight, + wxLayout_RightToLeft +}; + +#if wxUSE_INTL + +#include "wx/string.h" + +// ---------------------------------------------------------------------------- +// wxLocaleCategory: the category of locale settings +// ---------------------------------------------------------------------------- + +enum wxLocaleTagType +{ + // Default (tag as given or else same as wxLOCALE_TAGTYPE_SYSTEM) + wxLOCALE_TAGTYPE_DEFAULT, + + // Default type of the system (platform-dependent) + wxLOCALE_TAGTYPE_SYSTEM, + + // BCP47-like type: <language>[-<script>][-<region>][-<modifier>] + wxLOCALE_TAGTYPE_BCP47, + + // macOS type: <language>[-<script>][_<region>] + wxLOCALE_TAGTYPE_MACOS, + + // POSIX type: <language>_<region>[.<charset>][@{<scriptalias>|<modifier>}] + wxLOCALE_TAGTYPE_POSIX, + + // Windows type: <language>[-<script>][-<region>][-<extension>][_<sortorder>] + wxLOCALE_TAGTYPE_WINDOWS +}; + +// ---------------------------------------------------------------------------- +// wxLocaleCategory: the category of locale settings +// ---------------------------------------------------------------------------- + +enum wxLocaleCategory +{ + // (any) numbers + wxLOCALE_CAT_NUMBER, + + // date/time + wxLOCALE_CAT_DATE, + + // monetary value + wxLOCALE_CAT_MONEY, + + // default category for wxLocaleInfo values which only apply to a single + // category (e.g. wxLOCALE_SHORT_DATE_FMT) + wxLOCALE_CAT_DEFAULT, + + wxLOCALE_CAT_MAX +}; + +// ---------------------------------------------------------------------------- +// wxLocaleInfo: the items understood by wxLocale::GetInfo() +// ---------------------------------------------------------------------------- + +enum wxLocaleInfo +{ + // the thousands separator (for wxLOCALE_CAT_NUMBER or MONEY) + wxLOCALE_THOUSANDS_SEP, + + // the character used as decimal point (for wxLOCALE_CAT_NUMBER or MONEY) + wxLOCALE_DECIMAL_POINT, + + // the stftime()-formats used for short/long date and time representations + // (under some platforms short and long date formats are the same) + // + // NB: these elements should appear in this order, code in GetInfo() relies + // on it + wxLOCALE_SHORT_DATE_FMT, + wxLOCALE_LONG_DATE_FMT, + wxLOCALE_DATE_TIME_FMT, + wxLOCALE_TIME_FMT + +}; + +// ---------------------------------------------------------------------------- +// wxLocaleName: the items understood by wxLocale::GetLocalizedName() +// ---------------------------------------------------------------------------- + +enum wxLocaleName +{ + wxLOCALE_NAME_LOCALE, + wxLOCALE_NAME_LANGUAGE, + wxLOCALE_NAME_COUNTRY +}; + +// ---------------------------------------------------------------------------- +// wxLocaleForm: the forms of names understood by wxLocale::GetLocalizedName() +// ---------------------------------------------------------------------------- + +enum wxLocaleForm +{ + wxLOCALE_FORM_NATIVE, + wxLOCALE_FORM_ENGLISH +}; + +// ---------------------------------------------------------------------------- +// wxLanguageInfo: encapsulates wxLanguage to OS native lang.desc. +// translation information +// ---------------------------------------------------------------------------- + +struct WXDLLIMPEXP_BASE wxLanguageInfo +{ + int Language; // wxLanguage id + wxString LocaleTag; // Tag of locale in BCP 47-like notation + wxString CanonicalName; // Canonical name, e.g. fr_FR + wxString CanonicalRef; // Canonical reference including region, + // if the name specifies the language only, e.g. fr_FR for fr; + // empty, if region is unknown or already part of the name. +#ifdef __WINDOWS__ + wxUint32 WinLang, // Win32 language identifiers + WinSublang; +#endif // __WINDOWS__ + wxString Description; // human-readable name of the language in English + wxString DescriptionNative; // human-readable name of the language in native language + wxLayoutDirection LayoutDirection; + +#ifdef __WINDOWS__ + // return the LCID corresponding to this language + wxUint32 GetLCID() const; +#endif // __WINDOWS__ + + // return the locale name corresponding to this language usable with + // setlocale() on the current system or empty string if this locale is not + // supported + wxString GetLocaleName() const; + + // returns CanonicalRef if set, otherwise CanonicalName + wxString GetCanonicalWithRegion() const; + + // Call setlocale() and return non-null value if it works for this language. + // + // This function is mostly for internal use, as changing locale involves + // more than just calling setlocale() on some platforms, use wxLocale to + // do everything that needs to be done instead of calling this method. + const char* TrySetLocale() const; +}; + +#endif // wxUSE_INTL + +#endif // _WX_LOCALEDEFS_H_ diff --git a/lib/wxWidgets/include/wx/log.h b/lib/wxWidgets/include/wx/log.h new file mode 100644 index 0000000..97d901b --- /dev/null +++ b/lib/wxWidgets/include/wx/log.h @@ -0,0 +1,1502 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/log.h +// Purpose: Assorted wxLogXXX functions, and wxLog (sink for logs) +// Author: Vadim Zeitlin +// Modified by: +// Created: 29/01/98 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LOG_H_ +#define _WX_LOG_H_ + +#include "wx/defs.h" +#include "wx/cpp.h" + +// ---------------------------------------------------------------------------- +// types +// ---------------------------------------------------------------------------- + +// NB: this is needed even if wxUSE_LOG == 0 +typedef unsigned long wxLogLevel; + +// the trace masks have been superseded by symbolic trace constants, they're +// for compatibility only and will be removed soon - do NOT use them +#if WXWIN_COMPATIBILITY_2_8 + #define wxTraceMemAlloc 0x0001 // trace memory allocation (new/delete) + #define wxTraceMessages 0x0002 // trace window messages/X callbacks + #define wxTraceResAlloc 0x0004 // trace GDI resource allocation + #define wxTraceRefCount 0x0008 // trace various ref counting operations + + #ifdef __WINDOWS__ + #define wxTraceOleCalls 0x0100 // OLE interface calls + #endif + + typedef unsigned long wxTraceMask; +#endif // WXWIN_COMPATIBILITY_2_8 + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/string.h" +#include "wx/strvararg.h" + +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_BASE wxObject; + +#if wxUSE_GUI + class WXDLLIMPEXP_FWD_CORE wxFrame; +#endif // wxUSE_GUI + +#if wxUSE_LOG + +#include "wx/arrstr.h" + +#include <time.h> // for time_t + +#include "wx/dynarray.h" +#include "wx/hashmap.h" +#include "wx/msgout.h" +#include "wx/time.h" + +#if wxUSE_THREADS + #include "wx/thread.h" +#endif // wxUSE_THREADS + +// wxUSE_LOG_DEBUG enables the debug log messages +#ifndef wxUSE_LOG_DEBUG + #if wxDEBUG_LEVEL + #define wxUSE_LOG_DEBUG 1 + #else // !wxDEBUG_LEVEL + #define wxUSE_LOG_DEBUG 0 + #endif +#endif + +// wxUSE_LOG_TRACE enables the trace messages, they are disabled by default +#ifndef wxUSE_LOG_TRACE + #if wxDEBUG_LEVEL + #define wxUSE_LOG_TRACE 1 + #else // !wxDEBUG_LEVEL + #define wxUSE_LOG_TRACE 0 + #endif +#endif // wxUSE_LOG_TRACE + +// wxLOG_COMPONENT identifies the component which generated the log record and +// can be #define'd to a user-defined value (ASCII only) when compiling the +// user code to use component-based filtering (see wxLog::SetComponentLevel()) +#ifndef wxLOG_COMPONENT + // this is a variable and not a macro in order to allow the user code to + // just #define wxLOG_COMPONENT without #undef'ining it first + extern WXDLLIMPEXP_DATA_BASE(const char *) wxLOG_COMPONENT; + + #ifdef WXBUILDING + #define wxLOG_COMPONENT "wx" + #endif +#endif + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// different standard log levels (you may also define your own) +enum wxLogLevelValues +{ + wxLOG_FatalError, // program can't continue, abort immediately + wxLOG_Error, // a serious error, user must be informed about it + wxLOG_Warning, // user is normally informed about it but may be ignored + wxLOG_Message, // normal message (i.e. normal output of a non GUI app) + wxLOG_Status, // informational: might go to the status line of GUI app + wxLOG_Info, // informational message (a.k.a. 'Verbose') + wxLOG_Debug, // never shown to the user, disabled in release mode + wxLOG_Trace, // trace messages are also only enabled in debug mode + wxLOG_Progress, // used for progress indicator (not yet) + wxLOG_User = 100, // user defined levels start here + wxLOG_Max = 10000 +}; + +// symbolic trace masks - wxLogTrace("foo", "some trace message...") will be +// discarded unless the string "foo" has been added to the list of allowed +// ones with AddTraceMask() + +#define wxTRACE_MemAlloc wxT("memalloc") // trace memory allocation (new/delete) +#define wxTRACE_Messages wxT("messages") // trace window messages/X callbacks +#define wxTRACE_ResAlloc wxT("resalloc") // trace GDI resource allocation +#define wxTRACE_RefCount wxT("refcount") // trace various ref counting operations + +#ifdef __WINDOWS__ + #define wxTRACE_OleCalls wxT("ole") // OLE interface calls +#endif + +#include "wx/iosfwrap.h" + +// ---------------------------------------------------------------------------- +// information about a log record, i.e. unit of log output +// ---------------------------------------------------------------------------- + +class wxLogRecordInfo +{ +public: + // default ctor creates an uninitialized object + wxLogRecordInfo() + { + memset(this, 0, sizeof(*this)); + } + + // normal ctor, used by wxLogger specifies the location of the log + // statement; its time stamp and thread id are set up here + wxLogRecordInfo(const char *filename_, + int line_, + const char *func_, + const char *component_) + { + filename = filename_; + func = func_; + line = line_; + component = component_; + + // don't initialize the timestamp yet, we might not need it at all if + // the message doesn't end up being logged and otherwise we'll fill it + // just before logging it, which won't change it by much + timestampMS = 0; +#if WXWIN_COMPATIBILITY_3_0 + timestamp = 0; +#endif // WXWIN_COMPATIBILITY_3_0 + +#if wxUSE_THREADS + threadId = wxThread::GetCurrentId(); +#endif // wxUSE_THREADS + + m_data = NULL; + } + + // we need to define copy ctor and assignment operator because of m_data + wxLogRecordInfo(const wxLogRecordInfo& other) + { + Copy(other); + } + + wxLogRecordInfo& operator=(const wxLogRecordInfo& other) + { + if ( &other != this ) + { + delete m_data; + Copy(other); + } + + return *this; + } + + // dtor is non-virtual, this class is not meant to be derived from + ~wxLogRecordInfo() + { + delete m_data; + } + + + // the file name and line number of the file where the log record was + // generated, if available or NULL and 0 otherwise + const char *filename; + int line; + + // the name of the function where the log record was generated (may be NULL + // if the compiler doesn't support __FUNCTION__) + const char *func; + + // the name of the component which generated this message, may be NULL if + // not set (i.e. wxLOG_COMPONENT not defined). It must be in ASCII. + const char *component; + + // time of record generation in milliseconds since Epoch + wxLongLong_t timestampMS; + +#if WXWIN_COMPATIBILITY_3_0 + // preserved for compatibility only, use timestampMS instead now + time_t timestamp; +#endif // WXWIN_COMPATIBILITY_3_0 + +#if wxUSE_THREADS + // id of the thread which logged this record + wxThreadIdType threadId; +#endif // wxUSE_THREADS + + + // store an arbitrary value in this record context + // + // wxWidgets always uses keys starting with "wx.", e.g. "wx.sys_error" + void StoreValue(const wxString& key, wxUIntPtr val) + { + if ( !m_data ) + m_data = new ExtraData; + + m_data->numValues[key] = val; + } + + void StoreValue(const wxString& key, const wxString& val) + { + if ( !m_data ) + m_data = new ExtraData; + + m_data->strValues[key] = val; + } + + + // these functions retrieve the value of either numeric or string key, + // return false if not found + bool GetNumValue(const wxString& key, wxUIntPtr *val) const + { + if ( !m_data ) + return false; + + const wxStringToNumHashMap::const_iterator it = m_data->numValues.find(key); + if ( it == m_data->numValues.end() ) + return false; + + *val = it->second; + + return true; + } + + bool GetStrValue(const wxString& key, wxString *val) const + { + if ( !m_data ) + return false; + + const wxStringToStringHashMap::const_iterator it = m_data->strValues.find(key); + if ( it == m_data->strValues.end() ) + return false; + + *val = it->second; + + return true; + } + +private: + void Copy(const wxLogRecordInfo& other) + { + memcpy(this, &other, sizeof(*this)); + if ( other.m_data ) + m_data = new ExtraData(*other.m_data); + } + + // extra data associated with the log record: this is completely optional + // and can be used to pass information from the log function to the log + // sink (e.g. wxLogSysError() uses this to pass the error code) + struct ExtraData + { + wxStringToNumHashMap numValues; + wxStringToStringHashMap strValues; + }; + + // NULL if not used + ExtraData *m_data; +}; + +#define wxLOG_KEY_TRACE_MASK wxASCII_STR("wx.trace_mask") + +// ---------------------------------------------------------------------------- +// log record: a unit of log output +// ---------------------------------------------------------------------------- + +struct wxLogRecord +{ + wxLogRecord(wxLogLevel level_, + const wxString& msg_, + const wxLogRecordInfo& info_) + : level(level_), + msg(msg_), + info(info_) + { + } + + wxLogLevel level; + wxString msg; + wxLogRecordInfo info; +}; + +// ---------------------------------------------------------------------------- +// Derive from this class to customize format of log messages. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxLogFormatter +{ +public: + // Default constructor. + wxLogFormatter() { } + + // Trivial but virtual destructor for the base class. + virtual ~wxLogFormatter() { } + + + // Override this method to implement custom formatting of the given log + // record. The default implementation simply prepends a level-dependent + // prefix to the message and optionally adds a time stamp. + virtual wxString Format(wxLogLevel level, + const wxString& msg, + const wxLogRecordInfo& info) const; + +protected: + // Override this method to change just the time stamp formatting. It is + // called by default Format() implementation. + virtual wxString FormatTimeMS(wxLongLong_t msec) const; + +#if WXWIN_COMPATIBILITY_3_0 + // Old function which only worked at second resolution. + virtual wxString FormatTime(time_t t) const; +#endif // WXWIN_COMPATIBILITY_3_0 +}; + + +// ---------------------------------------------------------------------------- +// derive from this class to redirect (or suppress, or ...) log messages +// normally, only a single instance of this class exists but it's not enforced +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxLog +{ +public: + // ctor + wxLog() : m_formatter(new wxLogFormatter) { } + + // make dtor virtual for all derived classes + virtual ~wxLog(); + + + // log messages selection + // ---------------------- + + // these functions allow to completely disable all log messages or disable + // log messages at level less important than specified for the current + // thread + + // is logging enabled at all now? + static bool IsEnabled() + { +#if wxUSE_THREADS + if ( !wxThread::IsMain() ) + return IsThreadLoggingEnabled(); +#endif // wxUSE_THREADS + + return ms_doLog; + } + + // change the flag state, return the previous one + static bool EnableLogging(bool enable = true) + { +#if wxUSE_THREADS + if ( !wxThread::IsMain() ) + return EnableThreadLogging(enable); +#endif // wxUSE_THREADS + + const bool doLogOld = ms_doLog; + ms_doLog = enable; + return doLogOld; + } + + // return the current global log level + static wxLogLevel GetLogLevel() { return ms_logLevel; } + + // set global log level: messages with level > logLevel will not be logged + static void SetLogLevel(wxLogLevel logLevel) { ms_logLevel = logLevel; } + + // set the log level for the given component + static void SetComponentLevel(const wxString& component, wxLogLevel level); + + // return the effective log level for this component, falling back to + // parent component and to the default global log level if necessary + static wxLogLevel GetComponentLevel(const wxString& component); + + + // is logging of messages from this component enabled at this level? + // + // usually always called with wxLOG_COMPONENT as second argument + static bool IsLevelEnabled(wxLogLevel level, const wxString& component) + { + return IsEnabled() && level <= GetComponentLevel(component); + } + + + // enable/disable messages at wxLOG_Verbose level (only relevant if the + // current log level is greater or equal to it) + // + // notice that verbose mode can be activated by the standard command-line + // '--verbose' option + static void SetVerbose(bool bVerbose = true) { ms_bVerbose = bVerbose; } + + // check if verbose messages are enabled + static bool GetVerbose() { return ms_bVerbose; } + + + // message buffering + // ----------------- + + // flush shows all messages if they're not logged immediately (FILE + // and iostream logs don't need it, but wxLogGui does to avoid showing + // 17 modal dialogs one after another) + virtual void Flush(); + + // flush the active target if any and also output any pending messages from + // background threads + static void FlushActive(); + + // only one sink is active at each moment get current log target, will call + // wxAppTraits::CreateLogTarget() to create one if none exists + static wxLog *GetActiveTarget(); + + // change log target, logger may be NULL + static wxLog *SetActiveTarget(wxLog *logger); + +#if wxUSE_THREADS + // change log target for the current thread only, shouldn't be called from + // the main thread as it doesn't use thread-specific log target + static wxLog *SetThreadActiveTarget(wxLog *logger); +#endif // wxUSE_THREADS + + // suspend the message flushing of the main target until the next call + // to Resume() - this is mainly for internal use (to prevent wxYield() + // from flashing the messages) + static void Suspend() { ms_suspendCount++; } + + // must be called for each Suspend()! + static void Resume() { ms_suspendCount--; } + + // should GetActiveTarget() try to create a new log object if the + // current is NULL? + static void DontCreateOnDemand(); + + // Make GetActiveTarget() create a new log object again. + static void DoCreateOnDemand(); + + // log the count of repeating messages instead of logging the messages + // multiple times + static void SetRepetitionCounting(bool bRepetCounting = true) + { ms_bRepetCounting = bRepetCounting; } + + // gets duplicate counting status + static bool GetRepetitionCounting() { return ms_bRepetCounting; } + + // add string trace mask + static void AddTraceMask(const wxString& str); + + // add string trace mask + static void RemoveTraceMask(const wxString& str); + + // remove all string trace masks + static void ClearTraceMasks(); + + // get string trace masks: note that this is MT-unsafe if other threads can + // call AddTraceMask() concurrently + static const wxArrayString& GetTraceMasks(); + + // is this trace mask in the list? + static bool IsAllowedTraceMask(const wxString& mask); + + + // log formatting + // ----------------- + + // Change wxLogFormatter object used by wxLog to format the log messages. + // + // wxLog takes ownership of the pointer passed in but the caller is + // responsible for deleting the returned pointer. + wxLogFormatter* SetFormatter(wxLogFormatter* formatter); + + + // All the time stamp related functions below only work when the default + // wxLogFormatter is being used. Defining a custom formatter overrides them + // as it could use its own time stamp format or format messages without + // using time stamp at all. + + + // sets the time stamp string format: this is used as strftime() format + // string for the log targets which add time stamps to the messages; set + // it to empty string to disable time stamping completely. + static void SetTimestamp(const wxString& ts) { ms_timestamp = ts; } + + // disable time stamping of log messages + static void DisableTimestamp() { SetTimestamp(wxEmptyString); } + + + // get the current timestamp format string (maybe empty) + static const wxString& GetTimestamp() { return ms_timestamp; } + + + + // helpers: all functions in this section are mostly for internal use only, + // don't call them from your code even if they are not formally deprecated + + // put the time stamp into the string if ms_timestamp is not empty (don't + // change it otherwise); the first overload uses the current time. + static void TimeStamp(wxString *str); + static void TimeStamp(wxString *str, time_t t); + static void TimeStampMS(wxString *str, wxLongLong_t msec); + + // these methods should only be called from derived classes DoLogRecord(), + // DoLogTextAtLevel() and DoLogText() implementations respectively and + // shouldn't be called directly, use logging functions instead + void LogRecord(wxLogLevel level, + const wxString& msg, + const wxLogRecordInfo& info) + { + DoLogRecord(level, msg, info); + } + + void LogTextAtLevel(wxLogLevel level, const wxString& msg) + { + DoLogTextAtLevel(level, msg); + } + + void LogText(const wxString& msg) + { + DoLogText(msg); + } + + // this is a helper used by wxLogXXX() functions, don't call it directly + // and see DoLog() for function to overload in the derived classes + static void OnLog(wxLogLevel level, + const wxString& msg, + const wxLogRecordInfo& info); + + // version called when no information about the location of the log record + // generation is available (but the time stamp is), it mainly exists for + // backwards compatibility, don't use it in new code + static void OnLog(wxLogLevel level, const wxString& msg, time_t t); + + // a helper calling the above overload with current time + static void OnLog(wxLogLevel level, const wxString& msg) + { + OnLog(level, msg, time(NULL)); + } + + + // this method exists for backwards compatibility only, don't use + bool HasPendingMessages() const { return true; } + + // don't use integer masks any more, use string trace masks instead +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED_INLINE( static void SetTraceMask(wxTraceMask ulMask), + ms_ulTraceMask = ulMask; ) + + // this one can't be marked deprecated as it's used in our own wxLogger + // below but it still is deprecated and shouldn't be used + static wxTraceMask GetTraceMask() { return ms_ulTraceMask; } +#endif // WXWIN_COMPATIBILITY_2_8 + +protected: + // the logging functions that can be overridden: DoLogRecord() is called + // for every "record", i.e. a unit of log output, to be logged and by + // default formats the message and passes it to DoLogTextAtLevel() which in + // turn passes it to DoLogText() by default + + // override this method if you want to change message formatting or do + // dynamic filtering + virtual void DoLogRecord(wxLogLevel level, + const wxString& msg, + const wxLogRecordInfo& info); + + // override this method to redirect output to different channels depending + // on its level only; if even the level doesn't matter, override + // DoLogText() instead + virtual void DoLogTextAtLevel(wxLogLevel level, const wxString& msg); + + // this function is not pure virtual as it might not be needed if you do + // the logging in overridden DoLogRecord() or DoLogTextAtLevel() directly + // but if you do not override them in your derived class you must override + // this one as the default implementation of it simply asserts + virtual void DoLogText(const wxString& msg); + + + // the rest of the functions are for backwards compatibility only, don't + // use them in new code; if you're updating your existing code you need to + // switch to overriding DoLogRecord/Text() above (although as long as these + // functions exist, log classes using them will continue to work) +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED_BUT_USED_INTERNALLY( + virtual void DoLog(wxLogLevel level, const char *szString, time_t t) + ); + + wxDEPRECATED_BUT_USED_INTERNALLY( + virtual void DoLog(wxLogLevel level, const wchar_t *wzString, time_t t) + ); + + // these shouldn't be used by new code + wxDEPRECATED_BUT_USED_INTERNALLY_INLINE( + virtual void DoLogString(const char *WXUNUSED(szString), + time_t WXUNUSED(t)), + wxEMPTY_PARAMETER_VALUE + ) + + wxDEPRECATED_BUT_USED_INTERNALLY_INLINE( + virtual void DoLogString(const wchar_t *WXUNUSED(wzString), + time_t WXUNUSED(t)), + wxEMPTY_PARAMETER_VALUE + ) +#endif // WXWIN_COMPATIBILITY_2_8 + + + // log a message indicating the number of times the previous message was + // repeated if previous repetition counter is strictly positive, does + // nothing otherwise; return the old value of repetition counter + unsigned LogLastRepeatIfNeeded(); + +private: +#if wxUSE_THREADS + // called from FlushActive() to really log any buffered messages logged + // from the other threads + void FlushThreadMessages(); + + // these functions are called for non-main thread only by IsEnabled() and + // EnableLogging() respectively + static bool IsThreadLoggingEnabled(); + static bool EnableThreadLogging(bool enable = true); +#endif // wxUSE_THREADS + + // get the active log target for the main thread, auto-creating it if + // necessary + // + // this is called from GetActiveTarget() and OnLog() when they're called + // from the main thread + static wxLog *GetMainThreadActiveTarget(); + + // called from OnLog() if it's called from the main thread or if we have a + // (presumably MT-safe) thread-specific logger and by FlushThreadMessages() + // when it plays back the buffered messages logged from the other threads + void CallDoLogNow(wxLogLevel level, + const wxString& msg, + const wxLogRecordInfo& info); + + + // variables + // ---------------- + + wxLogFormatter *m_formatter; // We own this pointer. + + + // static variables + // ---------------- + + // if true, don't log the same message multiple times, only log it once + // with the number of times it was repeated + static bool ms_bRepetCounting; + + static wxLog *ms_pLogger; // currently active log sink + static bool ms_doLog; // false => all logging disabled + static bool ms_bAutoCreate; // create new log targets on demand? + static bool ms_bVerbose; // false => ignore LogInfo messages + + static wxLogLevel ms_logLevel; // limit logging to levels <= ms_logLevel + + static size_t ms_suspendCount; // if positive, logs are not flushed + + // format string for strftime(), if empty, time stamping log messages is + // disabled + static wxString ms_timestamp; + +#if WXWIN_COMPATIBILITY_2_8 + static wxTraceMask ms_ulTraceMask; // controls wxLogTrace behaviour +#endif // WXWIN_COMPATIBILITY_2_8 + + wxDECLARE_NO_COPY_CLASS(wxLog); +}; + +// ---------------------------------------------------------------------------- +// "trivial" derivations of wxLog +// ---------------------------------------------------------------------------- + +// log everything except for the debug/trace messages (which are passed to +// wxMessageOutputDebug) to a buffer +class WXDLLIMPEXP_BASE wxLogBuffer : public wxLog +{ +public: + wxLogBuffer() { } + + // get the string contents with all messages logged + const wxString& GetBuffer() const { return m_str; } + + // show the buffer contents to the user in the best possible way (this uses + // wxMessageOutputMessageBox) and clear it + virtual void Flush() wxOVERRIDE; + +protected: + virtual void DoLogTextAtLevel(wxLogLevel level, const wxString& msg) wxOVERRIDE; + +private: + wxString m_str; + + wxDECLARE_NO_COPY_CLASS(wxLogBuffer); +}; + + +// log everything to a "FILE *", stderr by default +class WXDLLIMPEXP_BASE wxLogStderr : public wxLog, + protected wxMessageOutputStderr +{ +public: + // redirect log output to a FILE + wxLogStderr(FILE *fp = NULL, + const wxMBConv &conv = wxConvWhateverWorks); + +protected: + // implement sink function + virtual void DoLogText(const wxString& msg) wxOVERRIDE; + + wxDECLARE_NO_COPY_CLASS(wxLogStderr); +}; + +#if wxUSE_STD_IOSTREAM + +// log everything to an "ostream", cerr by default +class WXDLLIMPEXP_BASE wxLogStream : public wxLog, + private wxMessageOutputWithConv +{ +public: + // redirect log output to an ostream + wxLogStream(wxSTD ostream *ostr = (wxSTD ostream *) NULL, + const wxMBConv& conv = wxConvWhateverWorks); + +protected: + // implement sink function + virtual void DoLogText(const wxString& msg) wxOVERRIDE; + + // using ptr here to avoid including <iostream.h> from this file + wxSTD ostream *m_ostr; + + wxDECLARE_NO_COPY_CLASS(wxLogStream); +}; + +#endif // wxUSE_STD_IOSTREAM + +// ---------------------------------------------------------------------------- +// /dev/null log target: suppress logging until this object goes out of scope +// ---------------------------------------------------------------------------- + +// example of usage: +/* + void Foo() + { + wxFile file; + + // wxFile.Open() normally complains if file can't be opened, we don't + // want it + wxLogNull logNo; + + if ( !file.Open("bar") ) + ... process error ourselves ... + + // ~wxLogNull called, old log sink restored + } + */ +class WXDLLIMPEXP_BASE wxLogNull +{ +public: + wxLogNull() : m_flagOld(wxLog::EnableLogging(false)) { } + ~wxLogNull() { (void)wxLog::EnableLogging(m_flagOld); } + +private: + bool m_flagOld; // the previous value of the wxLog::ms_doLog +}; + +// ---------------------------------------------------------------------------- +// chaining log target: installs itself as a log target and passes all +// messages to the real log target given to it in the ctor but also forwards +// them to the previously active one +// +// note that you don't have to call SetActiveTarget() with this class, it +// does it itself in its ctor +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxLogChain : public wxLog +{ +public: + wxLogChain(wxLog *logger); + virtual ~wxLogChain(); + + // change the new log target + void SetLog(wxLog *logger); + + // this can be used to temporarily disable (and then re-enable) passing + // messages to the old logger (by default we do pass them) + void PassMessages(bool bDoPass) { m_bPassMessages = bDoPass; } + + // are we passing the messages to the previous log target? + bool IsPassingMessages() const { return m_bPassMessages; } + + // return the previous log target (may be NULL) + wxLog *GetOldLog() const { return m_logOld; } + + // override base class version to flush the old logger as well + virtual void Flush() wxOVERRIDE; + + // call to avoid destroying the old log target + void DetachOldLog() { m_logOld = NULL; } + +protected: + // pass the record to the old logger if needed + virtual void DoLogRecord(wxLogLevel level, + const wxString& msg, + const wxLogRecordInfo& info) wxOVERRIDE; + +private: + // the current log target + wxLog *m_logNew; + + // the previous log target + wxLog *m_logOld; + + // do we pass the messages to the old logger? + bool m_bPassMessages; + + wxDECLARE_NO_COPY_CLASS(wxLogChain); +}; + +// a chain log target which uses itself as the new logger + +#define wxLogPassThrough wxLogInterposer + +class WXDLLIMPEXP_BASE wxLogInterposer : public wxLogChain +{ +public: + wxLogInterposer(); + +private: + wxDECLARE_NO_COPY_CLASS(wxLogInterposer); +}; + +// a temporary interposer which doesn't destroy the old log target +// (calls DetachOldLog) + +class WXDLLIMPEXP_BASE wxLogInterposerTemp : public wxLogChain +{ +public: + wxLogInterposerTemp(); + +private: + wxDECLARE_NO_COPY_CLASS(wxLogInterposerTemp); +}; + +#if wxUSE_GUI + // include GUI log targets: + #include "wx/generic/logg.h" +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// wxLogger +// ---------------------------------------------------------------------------- + +// wxLogger is a helper class used by wxLogXXX() functions implementation, +// don't use it directly as it's experimental and subject to change (OTOH it +// might become public in the future if it's deemed to be useful enough) + +// contains information about the context from which a log message originates +// and provides Log() vararg method which forwards to wxLog::OnLog() and passes +// this context to it +class wxLogger +{ +public: + // ctor takes the basic information about the log record + wxLogger(wxLogLevel level, + const char *filename, + int line, + const char *func, + const char *component) + : m_level(level), + m_info(filename, line, func, component) + { + } + + // store extra data in our log record and return this object itself (so + // that further calls to its functions could be chained) + template <typename T> + wxLogger& Store(const wxString& key, T val) + { + m_info.StoreValue(key, val); + return *this; + } + + // hack for "overloaded" wxLogXXX() functions: calling this method + // indicates that we may have an extra first argument preceding the format + // string and that if we do have it, we should store it in m_info using the + // given key (while by default 0 value will be used) + wxLogger& MaybeStore(const wxString& key, wxUIntPtr value = 0) + { + wxASSERT_MSG( m_optKey.empty(), "can only have one optional value" ); + m_optKey = key; + + m_info.StoreValue(key, value); + return *this; + } + + + // non-vararg function used by wxVLogXXX(): + + // log the message at the level specified in the ctor if this log message + // is enabled + void LogV(const wxString& format, va_list argptr) + { + // remember that fatal errors can't be disabled + if ( m_level == wxLOG_FatalError || + wxLog::IsLevelEnabled(m_level, wxASCII_STR(m_info.component)) ) + DoCallOnLog(format, argptr); + } + + // overloads used by functions with optional leading arguments (whose + // values are stored in the key passed to MaybeStore()) + void LogV(long num, const wxString& format, va_list argptr) + { + Store(m_optKey, num); + + LogV(format, argptr); + } + + void LogV(void *ptr, const wxString& format, va_list argptr) + { + Store(m_optKey, wxPtrToUInt(ptr)); + + LogV(format, argptr); + } + + void LogVTrace(const wxString& mask, const wxString& format, va_list argptr) + { + if ( !wxLog::IsAllowedTraceMask(mask) ) + return; + + Store(wxLOG_KEY_TRACE_MASK, mask); + + LogV(format, argptr); + } + + + // vararg functions used by wxLogXXX(): + + // will log the message at the level specified in the ctor + // + // notice that this function supposes that the caller already checked that + // the level was enabled and does no checks itself + WX_DEFINE_VARARG_FUNC_VOID + ( + Log, + 1, (const wxFormatString&), + DoLog, DoLogUtf8 + ) + + // same as Log() but with an extra numeric or pointer parameters: this is + // used to pass an optional value by storing it in m_info under the name + // passed to MaybeStore() and is required to support "overloaded" versions + // of wxLogStatus() and wxLogSysError() + WX_DEFINE_VARARG_FUNC_VOID + ( + Log, + 2, (long, const wxFormatString&), + DoLogWithNum, DoLogWithNumUtf8 + ) + + // unfortunately we can't use "void *" here as we get overload ambiguities + // with Log(wxFormatString, ...) when the first argument is a "char *" or + // "wchar_t *" then -- so we only allow passing wxObject here, which is + // ugly but fine in practice as this overload is only used by wxLogStatus() + // whose first argument is a wxFrame + WX_DEFINE_VARARG_FUNC_VOID + ( + Log, + 2, (wxObject *, const wxFormatString&), + DoLogWithPtr, DoLogWithPtrUtf8 + ) + + // log the message at the level specified as its first argument + // + // as the macros don't have access to the level argument in this case, this + // function does check that the level is enabled itself + WX_DEFINE_VARARG_FUNC_VOID + ( + LogAtLevel, + 2, (wxLogLevel, const wxFormatString&), + DoLogAtLevel, DoLogAtLevelUtf8 + ) + + // special versions for wxLogTrace() which is passed either string or + // integer mask as first argument determining whether the message should be + // logged or not + WX_DEFINE_VARARG_FUNC_VOID + ( + LogTrace, + 2, (const wxString&, const wxFormatString&), + DoLogTrace, DoLogTraceUtf8 + ) + +#if WXWIN_COMPATIBILITY_2_8 + WX_DEFINE_VARARG_FUNC_VOID + ( + LogTrace, + 2, (wxTraceMask, const wxFormatString&), + DoLogTraceMask, DoLogTraceMaskUtf8 + ) +#endif // WXWIN_COMPATIBILITY_2_8 + +private: +#if !wxUSE_UTF8_LOCALE_ONLY + void DoLog(const wxChar *format, ...) + { + va_list argptr; + va_start(argptr, format); + DoCallOnLog(format, argptr); + va_end(argptr); + } + + void DoLogWithNum(long num, const wxChar *format, ...) + { + Store(m_optKey, num); + + va_list argptr; + va_start(argptr, format); + DoCallOnLog(format, argptr); + va_end(argptr); + } + + void DoLogWithPtr(void *ptr, const wxChar *format, ...) + { + Store(m_optKey, wxPtrToUInt(ptr)); + + va_list argptr; + va_start(argptr, format); + DoCallOnLog(format, argptr); + va_end(argptr); + } + + void DoLogAtLevel(wxLogLevel level, const wxChar *format, ...) + { + if ( !wxLog::IsLevelEnabled(level, wxASCII_STR(m_info.component)) ) + return; + + va_list argptr; + va_start(argptr, format); + DoCallOnLog(level, format, argptr); + va_end(argptr); + } + + void DoLogTrace(const wxString& mask, const wxChar *format, ...) + { + if ( !wxLog::IsAllowedTraceMask(mask) ) + return; + + Store(wxLOG_KEY_TRACE_MASK, mask); + + va_list argptr; + va_start(argptr, format); + DoCallOnLog(format, argptr); + va_end(argptr); + } + +#if WXWIN_COMPATIBILITY_2_8 + void DoLogTraceMask(wxTraceMask mask, const wxChar *format, ...) + { + if ( (wxLog::GetTraceMask() & mask) != mask ) + return; + + Store(wxLOG_KEY_TRACE_MASK, mask); + + va_list argptr; + va_start(argptr, format); + DoCallOnLog(format, argptr); + va_end(argptr); + } +#endif // WXWIN_COMPATIBILITY_2_8 +#endif // !wxUSE_UTF8_LOCALE_ONLY + +#if wxUSE_UNICODE_UTF8 + void DoLogUtf8(const char *format, ...) + { + va_list argptr; + va_start(argptr, format); + DoCallOnLog(format, argptr); + va_end(argptr); + } + + void DoLogWithNumUtf8(long num, const char *format, ...) + { + Store(m_optKey, num); + + va_list argptr; + va_start(argptr, format); + DoCallOnLog(format, argptr); + va_end(argptr); + } + + void DoLogWithPtrUtf8(void *ptr, const char *format, ...) + { + Store(m_optKey, wxPtrToUInt(ptr)); + + va_list argptr; + va_start(argptr, format); + DoCallOnLog(format, argptr); + va_end(argptr); + } + + void DoLogAtLevelUtf8(wxLogLevel level, const char *format, ...) + { + if ( !wxLog::IsLevelEnabled(level, wxASCII_STR(m_info.component)) ) + return; + + va_list argptr; + va_start(argptr, format); + DoCallOnLog(level, format, argptr); + va_end(argptr); + } + + void DoLogTraceUtf8(const wxString& mask, const char *format, ...) + { + if ( !wxLog::IsAllowedTraceMask(mask) ) + return; + + Store(wxLOG_KEY_TRACE_MASK, mask); + + va_list argptr; + va_start(argptr, format); + DoCallOnLog(format, argptr); + va_end(argptr); + } + +#if WXWIN_COMPATIBILITY_2_8 + void DoLogTraceMaskUtf8(wxTraceMask mask, const char *format, ...) + { + if ( (wxLog::GetTraceMask() & mask) != mask ) + return; + + Store(wxLOG_KEY_TRACE_MASK, mask); + + va_list argptr; + va_start(argptr, format); + DoCallOnLog(format, argptr); + va_end(argptr); + } +#endif // WXWIN_COMPATIBILITY_2_8 +#endif // wxUSE_UNICODE_UTF8 + + void DoCallOnLog(wxLogLevel level, const wxString& format, va_list argptr) + { + // As explained in wxLogRecordInfo ctor, we don't initialize its + // timestamp to avoid calling time() unnecessary, but now that we are + // about to log the message, we do need to do it. + m_info.timestampMS = wxGetUTCTimeMillis().GetValue(); + +#if WXWIN_COMPATIBILITY_3_0 + m_info.timestamp = m_info.timestampMS / 1000; +#endif // WXWIN_COMPATIBILITY_3_0 + + wxLog::OnLog(level, wxString::FormatV(format, argptr), m_info); + } + + void DoCallOnLog(const wxString& format, va_list argptr) + { + DoCallOnLog(m_level, format, argptr); + } + + + const wxLogLevel m_level; + wxLogRecordInfo m_info; + + wxString m_optKey; + + wxDECLARE_NO_COPY_CLASS(wxLogger); +}; + +// ============================================================================ +// global functions +// ============================================================================ + +// ---------------------------------------------------------------------------- +// get error code/error message from system in a portable way +// ---------------------------------------------------------------------------- + +// return the last system error code +WXDLLIMPEXP_BASE unsigned long wxSysErrorCode(); + +// return the error message for given (or last if 0) error code +WXDLLIMPEXP_BASE const wxChar* wxSysErrorMsg(unsigned long nErrCode = 0); + +// return the error message for given (or last if 0) error code +WXDLLIMPEXP_BASE wxString wxSysErrorMsgStr(unsigned long nErrCode = 0); + +// ---------------------------------------------------------------------------- +// define wxLog<level>() functions which can be used by application instead of +// stdio, iostream &c for log messages for easy redirection +// ---------------------------------------------------------------------------- + +/* + The code below is unreadable because it (unfortunately unavoidably) + contains a lot of macro magic but all it does is to define wxLogXXX() such + that you can call them as vararg functions to log a message at the + corresponding level. + + More precisely, it defines: + + - wxLog{FatalError,Error,Warning,Message,Verbose,Debug}() functions + taking the format string and additional vararg arguments if needed. + - wxLogGeneric(wxLogLevel level, const wxString& format, ...) which + takes the log level explicitly. + - wxLogSysError(const wxString& format, ...) and wxLogSysError(long + err, const wxString& format, ...) which log a wxLOG_Error severity + message with the error message corresponding to the system error code + err or the last error. + - wxLogStatus(const wxString& format, ...) which logs the message into + the status bar of the main application window and its overload + wxLogStatus(wxFrame *frame, const wxString& format, ...) which logs it + into the status bar of the specified frame. + - wxLogTrace(Mask mask, const wxString& format, ...) which only logs + the message is the specified mask is enabled. This comes in two kinds: + Mask can be a wxString or a long. Both are deprecated. + + In addition, wxVLogXXX() versions of all the functions above are also + defined. They take a va_list argument instead of "...". + */ + +// creates wxLogger object for the current location +#define wxMAKE_LOGGER(level) \ + wxLogger(wxLOG_##level, __FILE__, __LINE__, __WXFUNCTION__, wxLOG_COMPONENT) + +// this macro generates the expression which logs whatever follows it in +// parentheses at the level specified as argument +#define wxDO_LOG(level) wxDO_LOG_WITH_FUNC(level, Log) + +// generalization of the macro above that uses the given function of wxLogger +// object rather than the default "Log" +#define wxDO_LOG_WITH_FUNC(level, func) wxMAKE_LOGGER(level).func + +// this is the non-vararg equivalent +#define wxDO_LOGV(level, format, argptr) \ + wxMAKE_LOGGER(level).LogV(format, argptr) + +// Macro evaluating to true if logging at the given level is enabled. +#define wxLOG_IS_ENABLED(level) \ + wxLog::IsLevelEnabled(wxLOG_##level, wxASCII_STR(wxLOG_COMPONENT)) + +// Macro used to define most of the actual wxLogXXX() macros: just calls +// wxLogger::Log(), if logging at the specified level is enabled. +#define wxDO_LOG_IF_ENABLED(level) \ + wxDO_IF(wxLOG_IS_ENABLED(level)) \ + wxDO_LOG(level) + +// Similar to above, but calls the given function instead of Log(). +#define wxDO_LOG_IF_ENABLED_WITH_FUNC(level, func) \ + wxDO_IF(wxLOG_IS_ENABLED(level)) \ + wxDO_LOG_WITH_FUNC(level, func) + +// wxLogFatalError() is special as it can't be disabled +#define wxLogFatalError wxDO_LOG(FatalError) +#define wxVLogFatalError(format, argptr) wxDO_LOGV(FatalError, format, argptr) + +#define wxLogError wxDO_LOG_IF_ENABLED(Error) +#define wxVLogError(format, argptr) wxDO_LOGV(Error, format, argptr) + +#define wxLogWarning wxDO_LOG_IF_ENABLED(Warning) +#define wxVLogWarning(format, argptr) wxDO_LOGV(Warning, format, argptr) + +#define wxLogMessage wxDO_LOG_IF_ENABLED(Message) +#define wxVLogMessage(format, argptr) wxDO_LOGV(Message, format, argptr) + +#define wxLogInfo wxDO_LOG_IF_ENABLED(Info) +#define wxVLogInfo(format, argptr) wxDO_LOGV(Info, format, argptr) + + +// this one is special as it only logs if we're in verbose mode +#define wxLogVerbose \ + wxDO_IF(wxLOG_IS_ENABLED(Info) && wxLog::GetVerbose()) \ + wxDO_LOG(Info) + +#define wxVLogVerbose(format, argptr) \ + wxDO_IF(wxLOG_IS_ENABLED(Info) && wxLog::GetVerbose()) \ + wxDO_LOGV(Info, format, argptr) + +// another special case: the level is passed as first argument of the function +// and so is not available to the macro +// +// notice that because of this, arguments of wxLogGeneric() are currently +// always evaluated, unlike for the other log functions +#define wxLogGeneric wxMAKE_LOGGER(Max).LogAtLevel +#define wxVLogGeneric(level, format, argptr) \ + wxDO_IF(wxLOG_IS_ENABLED(level)) \ + wxDO_LOGV(level, format, argptr) + + +// wxLogSysError() needs to stash the error code value in the log record info +// so it needs special handling too; additional complications arise because the +// error code may or not be present as the first argument +// +// notice that we unfortunately can't avoid the call to wxSysErrorCode() even +// though it may be unneeded if an explicit error code is passed to us because +// the message might not be logged immediately (e.g. it could be queued for +// logging from the main thread later) and so we can't to wait until it is +// logged to determine whether we have last error or not as it will be too late +// and it will have changed already by then (in fact it even changes when +// wxString::Format() is called because of vsnprintf() inside it so it can +// change even much sooner) +#define wxLOG_KEY_SYS_ERROR_CODE wxASCII_STR("wx.sys_error") + +#define wxLogSysError \ + wxDO_LOG_IF_ENABLED_WITH_FUNC(Error, MaybeStore(wxLOG_KEY_SYS_ERROR_CODE, \ + wxSysErrorCode()).Log) + +// unfortunately we can't have overloaded macros so we can't define versions +// both with and without error code argument and have to rely on LogV() +// overloads in wxLogger to select between them +#define wxVLogSysError \ + wxMAKE_LOGGER(Error).MaybeStore(wxLOG_KEY_SYS_ERROR_CODE, \ + wxSysErrorCode()).LogV + +#if wxUSE_GUI + // wxLogStatus() is similar to wxLogSysError() as it allows to optionally + // specify the frame to which the message should go + #define wxLOG_KEY_FRAME wxASCII_STR("wx.frame") + + #define wxLogStatus \ + wxDO_LOG_IF_ENABLED_WITH_FUNC(Status, MaybeStore(wxLOG_KEY_FRAME).Log) + + #define wxVLogStatus \ + wxMAKE_LOGGER(Status).MaybeStore(wxLOG_KEY_FRAME).LogV +#endif // wxUSE_GUI + + +#else // !wxUSE_LOG + +#undef wxUSE_LOG_DEBUG +#define wxUSE_LOG_DEBUG 0 + +#undef wxUSE_LOG_TRACE +#define wxUSE_LOG_TRACE 0 + +// define macros for defining log functions which do nothing at all +#define wxDEFINE_EMPTY_LOG_FUNCTION(level) \ + WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 1, (const wxFormatString&)) \ + inline void wxVLog##level(const wxFormatString& WXUNUSED(format), \ + va_list WXUNUSED(argptr)) { } \ + +#define wxDEFINE_EMPTY_LOG_FUNCTION2(level, argclass) \ + WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 2, (argclass, const wxFormatString&)) \ + inline void wxVLog##level(argclass WXUNUSED(arg), \ + const wxFormatString& WXUNUSED(format), \ + va_list WXUNUSED(argptr)) {} + +wxDEFINE_EMPTY_LOG_FUNCTION(FatalError); +wxDEFINE_EMPTY_LOG_FUNCTION(Error); +wxDEFINE_EMPTY_LOG_FUNCTION(SysError); +wxDEFINE_EMPTY_LOG_FUNCTION2(SysError, long); +wxDEFINE_EMPTY_LOG_FUNCTION(Warning); +wxDEFINE_EMPTY_LOG_FUNCTION(Message); +wxDEFINE_EMPTY_LOG_FUNCTION(Info); +wxDEFINE_EMPTY_LOG_FUNCTION(Verbose); + +wxDEFINE_EMPTY_LOG_FUNCTION2(Generic, wxLogLevel); + +#if wxUSE_GUI + wxDEFINE_EMPTY_LOG_FUNCTION(Status); + wxDEFINE_EMPTY_LOG_FUNCTION2(Status, wxFrame *); +#endif // wxUSE_GUI + +// Empty Class to fake wxLogNull +class WXDLLIMPEXP_BASE wxLogNull +{ +public: + wxLogNull() { } +}; + +// Dummy macros to replace some functions. +#define wxSysErrorCode() (unsigned long)0 +#define wxSysErrorMsg( X ) (const wxChar*)NULL +#define wxSysErrorMsgStr( X ) wxEmptyString + +// Fake symbolic trace masks... for those that are used frequently +#define wxTRACE_OleCalls wxEmptyString // OLE interface calls + +#endif // wxUSE_LOG/!wxUSE_LOG + + +// debug functions can be completely disabled in optimized builds + +// if these log functions are disabled, we prefer to define them as (empty) +// variadic macros as this completely removes them and their argument +// evaluation from the object code but if this is not supported by compiler we +// use empty inline functions instead (defining them as nothing would result in +// compiler warnings) +// +// note that making wxVLogDebug/Trace() themselves (empty inline) functions is +// a bad idea as some compilers are stupid enough to not inline even empty +// functions if their parameters are complicated enough, but by defining them +// as an empty inline function we ensure that even dumbest compilers optimise +// them away +inline void wxLogNop() { } + +#if wxUSE_LOG_DEBUG + #define wxLogDebug wxDO_LOG_IF_ENABLED(Debug) + #define wxVLogDebug(format, argptr) wxDO_LOGV(Debug, format, argptr) +#else // !wxUSE_LOG_DEBUG + #define wxVLogDebug(fmt, valist) wxLogNop() + + #ifdef HAVE_VARIADIC_MACROS + #define wxLogDebug(fmt, ...) wxLogNop() + #else // !HAVE_VARIADIC_MACROS + WX_DEFINE_VARARG_FUNC_NOP(wxLogDebug, 1, (const wxFormatString&)) + #endif +#endif // wxUSE_LOG_DEBUG/!wxUSE_LOG_DEBUG + +#if wxUSE_LOG_TRACE + #define wxLogTrace wxDO_LOG_IF_ENABLED_WITH_FUNC(Trace, LogTrace) + #define wxVLogTrace wxDO_LOG_IF_ENABLED_WITH_FUNC(Trace, LogVTrace) +#else // !wxUSE_LOG_TRACE + #define wxVLogTrace(mask, fmt, valist) wxLogNop() + + #ifdef HAVE_VARIADIC_MACROS + #define wxLogTrace(mask, fmt, ...) wxLogNop() + #else // !HAVE_VARIADIC_MACROS + #if WXWIN_COMPATIBILITY_2_8 + WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (wxTraceMask, const wxFormatString&)) + #endif + WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (const wxString&, const wxFormatString&)) + #endif // HAVE_VARIADIC_MACROS/!HAVE_VARIADIC_MACROS +#endif // wxUSE_LOG_TRACE/!wxUSE_LOG_TRACE + +// wxLogFatalError helper: show the (fatal) error to the user in a safe way, +// i.e. without using wxMessageBox() for example because it could crash +bool WXDLLIMPEXP_BASE +wxSafeShowMessage(const wxString& title, const wxString& text); + +// ---------------------------------------------------------------------------- +// debug only logging functions: use them with API name and error code +// ---------------------------------------------------------------------------- + +#if wxUSE_LOG_DEBUG + // make life easier for people using VC++ IDE: clicking on the message + // will take us immediately to the place of the failed API +#ifdef __VISUALC__ + #define wxLogApiError(api, rc) \ + wxLogDebug(wxT("%s(%d): '%s' failed with error 0x%08lx (%s)."), \ + __FILE__, __LINE__, api, \ + (long)rc, wxSysErrorMsgStr(rc)) +#else // !VC++ + #define wxLogApiError(api, rc) \ + wxLogDebug(wxT("In file %s at line %d: '%s' failed with ") \ + wxT("error 0x%08lx (%s)."), \ + __FILE__, __LINE__, api, \ + (long)rc, wxSysErrorMsgStr(rc)) +#endif // VC++/!VC++ + + #define wxLogLastError(api) wxLogApiError(api, wxSysErrorCode()) + +#else // !wxUSE_LOG_DEBUG + #define wxLogApiError(api, err) wxLogNop() + #define wxLogLastError(api) wxLogNop() +#endif // wxUSE_LOG_DEBUG/!wxUSE_LOG_DEBUG + +// macro which disables debug logging in release builds: this is done by +// default by wxIMPLEMENT_APP() so usually it doesn't need to be used explicitly +#if defined(NDEBUG) && wxUSE_LOG_DEBUG + #define wxDISABLE_DEBUG_LOGGING_IN_RELEASE_BUILD() \ + wxLog::SetLogLevel(wxLOG_Info) +#else // !NDEBUG + #define wxDISABLE_DEBUG_LOGGING_IN_RELEASE_BUILD() +#endif // NDEBUG/!NDEBUG + +#endif // _WX_LOG_H_ + diff --git a/lib/wxWidgets/include/wx/longlong.h b/lib/wxWidgets/include/wx/longlong.h new file mode 100644 index 0000000..fdc7387 --- /dev/null +++ b/lib/wxWidgets/include/wx/longlong.h @@ -0,0 +1,1131 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/longlong.h +// Purpose: declaration of wxLongLong class - best implementation of a 64 +// bit integer for the current platform. +// Author: Jeffrey C. Ollie <jeff@ollie.clive.ia.us>, Vadim Zeitlin +// Modified by: +// Created: 10.02.99 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LONGLONG_H +#define _WX_LONGLONG_H + +#include "wx/defs.h" + +#if wxUSE_LONGLONG + +#include "wx/string.h" + +#include <limits.h> // for LONG_MAX + +// define this to compile wxLongLongWx in "test" mode: the results of all +// calculations will be compared with the real results taken from +// wxLongLongNative -- this is extremely useful to find the bugs in +// wxLongLongWx class! + +// #define wxLONGLONG_TEST_MODE + +#ifdef wxLONGLONG_TEST_MODE + #define wxUSE_LONGLONG_WX 1 + #define wxUSE_LONGLONG_NATIVE 1 +#endif // wxLONGLONG_TEST_MODE + +// ---------------------------------------------------------------------------- +// decide upon which class we will use +// ---------------------------------------------------------------------------- + +#ifndef wxLongLong_t + // both warning and pragma warning are not portable, but at least an + // unknown pragma should never be an error -- except that, actually, some + // broken compilers don't like it, so we have to disable it in this case + // <sigh> + #ifdef __GNUC__ + #warning "Your compiler does not appear to support 64 bit "\ + "integers, using emulation class instead.\n" \ + "Please report your compiler version to " \ + "wx-dev@googlegroups.com!" + #else + #pragma warning "Your compiler does not appear to support 64 bit "\ + "integers, using emulation class instead.\n" \ + "Please report your compiler version to " \ + "wx-dev@googlegroups.com!" + #endif + + #define wxUSE_LONGLONG_WX 1 +#endif // compiler + +// the user may predefine wxUSE_LONGLONG_NATIVE and/or wxUSE_LONGLONG_NATIVE +// to disable automatic testing (useful for the test program which defines +// both classes) but by default we only use one class +#if (defined(wxUSE_LONGLONG_WX) && wxUSE_LONGLONG_WX) || !defined(wxLongLong_t) + // don't use both classes unless wxUSE_LONGLONG_NATIVE was explicitly set: + // this is useful in test programs and only there + #ifndef wxUSE_LONGLONG_NATIVE + #define wxUSE_LONGLONG_NATIVE 0 + #endif + + class WXDLLIMPEXP_FWD_BASE wxLongLongWx; + class WXDLLIMPEXP_FWD_BASE wxULongLongWx; +#if defined(__VISUALC__) && !defined(__WIN32__) + #define wxLongLong wxLongLongWx + #define wxULongLong wxULongLongWx +#else + typedef wxLongLongWx wxLongLong; + typedef wxULongLongWx wxULongLong; +#endif + +#else + // if nothing is defined, use native implementation by default, of course + #ifndef wxUSE_LONGLONG_NATIVE + #define wxUSE_LONGLONG_NATIVE 1 + #endif +#endif + +#ifndef wxUSE_LONGLONG_WX + #define wxUSE_LONGLONG_WX 0 + class WXDLLIMPEXP_FWD_BASE wxLongLongNative; + class WXDLLIMPEXP_FWD_BASE wxULongLongNative; + typedef wxLongLongNative wxLongLong; + typedef wxULongLongNative wxULongLong; +#endif + +// NB: if both wxUSE_LONGLONG_WX and NATIVE are defined, the user code should +// typedef wxLongLong as it wants, we don't do it + +// ---------------------------------------------------------------------------- +// choose the appropriate class +// ---------------------------------------------------------------------------- + +// we use iostream for wxLongLong output +#include "wx/iosfwrap.h" + +#if wxUSE_LONGLONG_NATIVE + +class WXDLLIMPEXP_BASE wxLongLongNative +{ +public: + // ctors + // default ctor initializes to 0 + wxLongLongNative() : m_ll(0) { } + // from long long + wxLongLongNative(wxLongLong_t ll) : m_ll(ll) { } + // from 2 longs + wxLongLongNative(wxInt32 hi, wxUint32 lo) + { + // cast to wxLongLong_t first to avoid precision loss! + m_ll = ((wxLongLong_t) hi) << 32; + m_ll |= (wxLongLong_t) lo; + } +#if wxUSE_LONGLONG_WX + wxLongLongNative(wxLongLongWx ll); +#endif + + // default copy ctor is ok + + // no dtor + + // assignment operators + // from native 64 bit integer +#ifndef wxLongLongIsLong + wxLongLongNative& operator=(wxLongLong_t ll) + { m_ll = ll; return *this; } + wxLongLongNative& operator=(wxULongLong_t ll) + { m_ll = ll; return *this; } +#endif // !wxLongLongNative + wxLongLongNative& operator=(const wxULongLongNative &ll); + wxLongLongNative& operator=(int l) + { m_ll = l; return *this; } + wxLongLongNative& operator=(long l) + { m_ll = l; return *this; } + wxLongLongNative& operator=(unsigned int l) + { m_ll = l; return *this; } + wxLongLongNative& operator=(unsigned long l) + { m_ll = l; return *this; } +#if wxUSE_LONGLONG_WX + wxLongLongNative& operator=(wxLongLongWx ll); + wxLongLongNative& operator=(const class wxULongLongWx &ll); +#endif + + + // from double: this one has an explicit name because otherwise we + // would have ambiguity with "ll = int" and also because we don't want + // to have implicit conversions between doubles and wxLongLongs + wxLongLongNative& Assign(double d) + { m_ll = (wxLongLong_t)d; return *this; } + + // assignment operators from wxLongLongNative is ok + + // accessors + // get high part + wxInt32 GetHi() const + { return wx_truncate_cast(wxInt32, m_ll >> 32); } + // get low part + wxUint32 GetLo() const + { return wx_truncate_cast(wxUint32, m_ll); } + + // get absolute value + wxLongLongNative Abs() const { return wxLongLongNative(*this).Abs(); } + wxLongLongNative& Abs() { if ( m_ll < 0 ) m_ll = -m_ll; return *this; } + + // convert to native long long + wxLongLong_t GetValue() const { return m_ll; } + + // convert to long with range checking in debug mode (only!) + long ToLong() const + { + // This assert is useless if long long is the same as long (which is + // the case under the standard Unix LP64 model). +#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG + wxASSERT_MSG( (m_ll >= LONG_MIN) && (m_ll <= LONG_MAX), + wxT("wxLongLong to long conversion loss of precision") ); +#endif + + return wx_truncate_cast(long, m_ll); + } + + // convert to double + double ToDouble() const { return wx_truncate_cast(double, m_ll); } + + // don't provide implicit conversion to wxLongLong_t or we will have an + // ambiguity for all arithmetic operations + //operator wxLongLong_t() const { return m_ll; } + + // operations + // addition + wxLongLongNative operator+(const wxLongLongNative& ll) const + { return wxLongLongNative(m_ll + ll.m_ll); } + wxLongLongNative& operator+=(const wxLongLongNative& ll) + { m_ll += ll.m_ll; return *this; } + + wxLongLongNative operator+(const wxLongLong_t ll) const + { return wxLongLongNative(m_ll + ll); } + wxLongLongNative& operator+=(const wxLongLong_t ll) + { m_ll += ll; return *this; } + + // pre increment + wxLongLongNative& operator++() + { m_ll++; return *this; } + + // post increment + wxLongLongNative operator++(int) + { wxLongLongNative value(*this); m_ll++; return value; } + + // negation operator + wxLongLongNative operator-() const + { return wxLongLongNative(-m_ll); } + wxLongLongNative& Negate() { m_ll = -m_ll; return *this; } + + // subtraction + wxLongLongNative operator-(const wxLongLongNative& ll) const + { return wxLongLongNative(m_ll - ll.m_ll); } + wxLongLongNative& operator-=(const wxLongLongNative& ll) + { m_ll -= ll.m_ll; return *this; } + + wxLongLongNative operator-(const wxLongLong_t ll) const + { return wxLongLongNative(m_ll - ll); } + wxLongLongNative& operator-=(const wxLongLong_t ll) + { m_ll -= ll; return *this; } + + // pre decrement + wxLongLongNative& operator--() + { m_ll--; return *this; } + + // post decrement + wxLongLongNative operator--(int) + { wxLongLongNative value(*this); m_ll--; return value; } + + // shifts + // left shift + wxLongLongNative operator<<(int shift) const + { return wxLongLongNative(m_ll << shift); } + wxLongLongNative& operator<<=(int shift) + { m_ll <<= shift; return *this; } + + // right shift + wxLongLongNative operator>>(int shift) const + { return wxLongLongNative(m_ll >> shift); } + wxLongLongNative& operator>>=(int shift) + { m_ll >>= shift; return *this; } + + // bitwise operators + wxLongLongNative operator&(const wxLongLongNative& ll) const + { return wxLongLongNative(m_ll & ll.m_ll); } + wxLongLongNative& operator&=(const wxLongLongNative& ll) + { m_ll &= ll.m_ll; return *this; } + + wxLongLongNative operator|(const wxLongLongNative& ll) const + { return wxLongLongNative(m_ll | ll.m_ll); } + wxLongLongNative& operator|=(const wxLongLongNative& ll) + { m_ll |= ll.m_ll; return *this; } + + wxLongLongNative operator^(const wxLongLongNative& ll) const + { return wxLongLongNative(m_ll ^ ll.m_ll); } + wxLongLongNative& operator^=(const wxLongLongNative& ll) + { m_ll ^= ll.m_ll; return *this; } + + // multiplication/division + wxLongLongNative operator*(const wxLongLongNative& ll) const + { return wxLongLongNative(m_ll * ll.m_ll); } + wxLongLongNative operator*(long l) const + { return wxLongLongNative(m_ll * l); } + wxLongLongNative& operator*=(const wxLongLongNative& ll) + { m_ll *= ll.m_ll; return *this; } + wxLongLongNative& operator*=(long l) + { m_ll *= l; return *this; } + + wxLongLongNative operator/(const wxLongLongNative& ll) const + { return wxLongLongNative(m_ll / ll.m_ll); } + wxLongLongNative operator/(long l) const + { return wxLongLongNative(m_ll / l); } + wxLongLongNative& operator/=(const wxLongLongNative& ll) + { m_ll /= ll.m_ll; return *this; } + wxLongLongNative& operator/=(long l) + { m_ll /= l; return *this; } + + wxLongLongNative operator%(const wxLongLongNative& ll) const + { return wxLongLongNative(m_ll % ll.m_ll); } + wxLongLongNative operator%(long l) const + { return wxLongLongNative(m_ll % l); } + + // comparison + bool operator==(const wxLongLongNative& ll) const + { return m_ll == ll.m_ll; } + bool operator==(long l) const + { return m_ll == l; } + bool operator!=(const wxLongLongNative& ll) const + { return m_ll != ll.m_ll; } + bool operator!=(long l) const + { return m_ll != l; } + bool operator<(const wxLongLongNative& ll) const + { return m_ll < ll.m_ll; } + bool operator<(long l) const + { return m_ll < l; } + bool operator>(const wxLongLongNative& ll) const + { return m_ll > ll.m_ll; } + bool operator>(long l) const + { return m_ll > l; } + bool operator<=(const wxLongLongNative& ll) const + { return m_ll <= ll.m_ll; } + bool operator<=(long l) const + { return m_ll <= l; } + bool operator>=(const wxLongLongNative& ll) const + { return m_ll >= ll.m_ll; } + bool operator>=(long l) const + { return m_ll >= l; } + + // miscellaneous + + // return the string representation of this number + wxString ToString() const; + + // conversion to byte array: returns a pointer to static buffer! + void *asArray() const; + +#if wxUSE_STD_IOSTREAM + // input/output + friend WXDLLIMPEXP_BASE + wxSTD ostream& operator<<(wxSTD ostream&, const wxLongLongNative&); +#endif + + friend WXDLLIMPEXP_BASE + wxString& operator<<(wxString&, const wxLongLongNative&); + +#if wxUSE_STREAMS + friend WXDLLIMPEXP_BASE + class wxTextOutputStream& operator<<(class wxTextOutputStream&, const wxLongLongNative&); + friend WXDLLIMPEXP_BASE + class wxTextInputStream& operator>>(class wxTextInputStream&, wxLongLongNative&); +#endif + +private: + wxLongLong_t m_ll; +}; + + +class WXDLLIMPEXP_BASE wxULongLongNative +{ +public: + // ctors + // default ctor initializes to 0 + wxULongLongNative() : m_ll(0) { } + // from long long + wxULongLongNative(wxULongLong_t ll) : m_ll(ll) { } + // from 2 longs + wxULongLongNative(wxUint32 hi, wxUint32 lo) : m_ll(0) + { + // cast to wxLongLong_t first to avoid precision loss! + m_ll = ((wxULongLong_t) hi) << 32; + m_ll |= (wxULongLong_t) lo; + } + +#if wxUSE_LONGLONG_WX + wxULongLongNative(const class wxULongLongWx &ll); +#endif + + // default copy ctor is ok + + // no dtor + + // assignment operators + // from native 64 bit integer +#ifndef wxLongLongIsLong + wxULongLongNative& operator=(wxULongLong_t ll) + { m_ll = ll; return *this; } + wxULongLongNative& operator=(wxLongLong_t ll) + { m_ll = ll; return *this; } +#endif // !wxLongLongNative + wxULongLongNative& operator=(int l) + { m_ll = l; return *this; } + wxULongLongNative& operator=(long l) + { m_ll = l; return *this; } + wxULongLongNative& operator=(unsigned int l) + { m_ll = l; return *this; } + wxULongLongNative& operator=(unsigned long l) + { m_ll = l; return *this; } + wxULongLongNative& operator=(const wxLongLongNative &ll) + { m_ll = ll.GetValue(); return *this; } +#if wxUSE_LONGLONG_WX + wxULongLongNative& operator=(wxLongLongWx ll); + wxULongLongNative& operator=(const class wxULongLongWx &ll); +#endif + + // assignment operators from wxULongLongNative is ok + + // accessors + // get high part + wxUint32 GetHi() const + { return wx_truncate_cast(wxUint32, m_ll >> 32); } + // get low part + wxUint32 GetLo() const + { return wx_truncate_cast(wxUint32, m_ll); } + + // convert to native ulong long + wxULongLong_t GetValue() const { return m_ll; } + + // convert to ulong with range checking in debug mode (only!) + unsigned long ToULong() const + { + wxASSERT_MSG( m_ll <= ULONG_MAX, + wxT("wxULongLong to long conversion loss of precision") ); + + return wx_truncate_cast(unsigned long, m_ll); + } + + // convert to double + double ToDouble() const { return wx_truncate_cast(double, m_ll); } + + // operations + // addition + wxULongLongNative operator+(const wxULongLongNative& ll) const + { return wxULongLongNative(m_ll + ll.m_ll); } + wxULongLongNative& operator+=(const wxULongLongNative& ll) + { m_ll += ll.m_ll; return *this; } + + wxULongLongNative operator+(const wxULongLong_t ll) const + { return wxULongLongNative(m_ll + ll); } + wxULongLongNative& operator+=(const wxULongLong_t ll) + { m_ll += ll; return *this; } + + // pre increment + wxULongLongNative& operator++() + { m_ll++; return *this; } + + // post increment + wxULongLongNative operator++(int) + { wxULongLongNative value(*this); m_ll++; return value; } + + // subtraction + wxULongLongNative operator-(const wxULongLongNative& ll) const + { return wxULongLongNative(m_ll - ll.m_ll); } + wxULongLongNative& operator-=(const wxULongLongNative& ll) + { m_ll -= ll.m_ll; return *this; } + + wxULongLongNative operator-(const wxULongLong_t ll) const + { return wxULongLongNative(m_ll - ll); } + wxULongLongNative& operator-=(const wxULongLong_t ll) + { m_ll -= ll; return *this; } + + // pre decrement + wxULongLongNative& operator--() + { m_ll--; return *this; } + + // post decrement + wxULongLongNative operator--(int) + { wxULongLongNative value(*this); m_ll--; return value; } + + // shifts + // left shift + wxULongLongNative operator<<(int shift) const + { return wxULongLongNative(m_ll << shift); } + wxULongLongNative& operator<<=(int shift) + { m_ll <<= shift; return *this; } + + // right shift + wxULongLongNative operator>>(int shift) const + { return wxULongLongNative(m_ll >> shift); } + wxULongLongNative& operator>>=(int shift) + { m_ll >>= shift; return *this; } + + // bitwise operators + wxULongLongNative operator&(const wxULongLongNative& ll) const + { return wxULongLongNative(m_ll & ll.m_ll); } + wxULongLongNative& operator&=(const wxULongLongNative& ll) + { m_ll &= ll.m_ll; return *this; } + + wxULongLongNative operator|(const wxULongLongNative& ll) const + { return wxULongLongNative(m_ll | ll.m_ll); } + wxULongLongNative& operator|=(const wxULongLongNative& ll) + { m_ll |= ll.m_ll; return *this; } + + wxULongLongNative operator^(const wxULongLongNative& ll) const + { return wxULongLongNative(m_ll ^ ll.m_ll); } + wxULongLongNative& operator^=(const wxULongLongNative& ll) + { m_ll ^= ll.m_ll; return *this; } + + // multiplication/division + wxULongLongNative operator*(const wxULongLongNative& ll) const + { return wxULongLongNative(m_ll * ll.m_ll); } + wxULongLongNative operator*(unsigned long l) const + { return wxULongLongNative(m_ll * l); } + wxULongLongNative& operator*=(const wxULongLongNative& ll) + { m_ll *= ll.m_ll; return *this; } + wxULongLongNative& operator*=(unsigned long l) + { m_ll *= l; return *this; } + + wxULongLongNative operator/(const wxULongLongNative& ll) const + { return wxULongLongNative(m_ll / ll.m_ll); } + wxULongLongNative operator/(unsigned long l) const + { return wxULongLongNative(m_ll / l); } + wxULongLongNative& operator/=(const wxULongLongNative& ll) + { m_ll /= ll.m_ll; return *this; } + wxULongLongNative& operator/=(unsigned long l) + { m_ll /= l; return *this; } + + wxULongLongNative operator%(const wxULongLongNative& ll) const + { return wxULongLongNative(m_ll % ll.m_ll); } + wxULongLongNative operator%(unsigned long l) const + { return wxULongLongNative(m_ll % l); } + + // comparison + bool operator==(const wxULongLongNative& ll) const + { return m_ll == ll.m_ll; } + bool operator==(unsigned long l) const + { return m_ll == l; } + bool operator!=(const wxULongLongNative& ll) const + { return m_ll != ll.m_ll; } + bool operator!=(unsigned long l) const + { return m_ll != l; } + bool operator<(const wxULongLongNative& ll) const + { return m_ll < ll.m_ll; } + bool operator<(unsigned long l) const + { return m_ll < l; } + bool operator>(const wxULongLongNative& ll) const + { return m_ll > ll.m_ll; } + bool operator>(unsigned long l) const + { return m_ll > l; } + bool operator<=(const wxULongLongNative& ll) const + { return m_ll <= ll.m_ll; } + bool operator<=(unsigned long l) const + { return m_ll <= l; } + bool operator>=(const wxULongLongNative& ll) const + { return m_ll >= ll.m_ll; } + bool operator>=(unsigned long l) const + { return m_ll >= l; } + + // miscellaneous + + // return the string representation of this number + wxString ToString() const; + + // conversion to byte array: returns a pointer to static buffer! + void *asArray() const; + +#if wxUSE_STD_IOSTREAM + // input/output + friend WXDLLIMPEXP_BASE + wxSTD ostream& operator<<(wxSTD ostream&, const wxULongLongNative&); +#endif + + friend WXDLLIMPEXP_BASE + wxString& operator<<(wxString&, const wxULongLongNative&); + +#if wxUSE_STREAMS + friend WXDLLIMPEXP_BASE + class wxTextOutputStream& operator<<(class wxTextOutputStream&, const wxULongLongNative&); + friend WXDLLIMPEXP_BASE + class wxTextInputStream& operator>>(class wxTextInputStream&, wxULongLongNative&); +#endif + +private: + wxULongLong_t m_ll; +}; + +inline +wxLongLongNative& wxLongLongNative::operator=(const wxULongLongNative &ll) +{ + m_ll = ll.GetValue(); + return *this; +} + +#endif // wxUSE_LONGLONG_NATIVE + +#if wxUSE_LONGLONG_WX + +class WXDLLIMPEXP_BASE wxLongLongWx +{ +public: + // ctors + // default ctor initializes to 0 + wxLongLongWx() + { + m_lo = m_hi = 0; + +#ifdef wxLONGLONG_TEST_MODE + m_ll = 0; + + Check(); +#endif // wxLONGLONG_TEST_MODE + } + // from long + wxLongLongWx(long l) { *this = l; } + // from 2 longs + wxLongLongWx(long hi, unsigned long lo) + { + m_hi = hi; + m_lo = lo; + +#ifdef wxLONGLONG_TEST_MODE + m_ll = hi; + m_ll <<= 32; + m_ll |= lo; + + Check(); +#endif // wxLONGLONG_TEST_MODE + } + + // default copy ctor is ok in both cases + + // no dtor + + // assignment operators + // from long + wxLongLongWx& operator=(long l) + { + m_lo = l; + m_hi = (l < 0 ? -1l : 0l); + +#ifdef wxLONGLONG_TEST_MODE + m_ll = l; + + Check(); +#endif // wxLONGLONG_TEST_MODE + + return *this; + } + // from int + wxLongLongWx& operator=(int l) + { + return operator=((long)l); + } + + wxLongLongWx& operator=(unsigned long l) + { + m_lo = l; + m_hi = 0; + +#ifdef wxLONGLONG_TEST_MODE + m_ll = l; + + Check(); +#endif // wxLONGLONG_TEST_MODE + + return *this; + } + + wxLongLongWx& operator=(unsigned int l) + { + return operator=((unsigned long)l); + } + + wxLongLongWx& operator=(const class wxULongLongWx &ll); + + // from double + wxLongLongWx& Assign(double d); + // can't have assignment operator from 2 longs + + // accessors + // get high part + long GetHi() const { return m_hi; } + // get low part + unsigned long GetLo() const { return m_lo; } + + // get absolute value + wxLongLongWx Abs() const { return wxLongLongWx(*this).Abs(); } + wxLongLongWx& Abs() + { + if ( m_hi < 0 ) + m_hi = -m_hi; + +#ifdef wxLONGLONG_TEST_MODE + if ( m_ll < 0 ) + m_ll = -m_ll; + + Check(); +#endif // wxLONGLONG_TEST_MODE + + return *this; + } + + // convert to long with range checking in debug mode (only!) + long ToLong() const + { + wxASSERT_MSG( (m_hi == 0l) || (m_hi == -1l), + wxT("wxLongLong to long conversion loss of precision") ); + + return (long)m_lo; + } + + // convert to double + double ToDouble() const; + + // operations + // addition + wxLongLongWx operator+(const wxLongLongWx& ll) const; + wxLongLongWx& operator+=(const wxLongLongWx& ll); + wxLongLongWx operator+(long l) const; + wxLongLongWx& operator+=(long l); + + // pre increment operator + wxLongLongWx& operator++(); + + // post increment operator + wxLongLongWx& operator++(int) { return ++(*this); } + + // negation operator + wxLongLongWx operator-() const; + wxLongLongWx& Negate(); + + // subtraction + wxLongLongWx operator-(const wxLongLongWx& ll) const; + wxLongLongWx& operator-=(const wxLongLongWx& ll); + + // pre decrement operator + wxLongLongWx& operator--(); + + // post decrement operator + wxLongLongWx& operator--(int) { return --(*this); } + + // shifts + // left shift + wxLongLongWx operator<<(int shift) const; + wxLongLongWx& operator<<=(int shift); + + // right shift + wxLongLongWx operator>>(int shift) const; + wxLongLongWx& operator>>=(int shift); + + // bitwise operators + wxLongLongWx operator&(const wxLongLongWx& ll) const; + wxLongLongWx& operator&=(const wxLongLongWx& ll); + wxLongLongWx operator|(const wxLongLongWx& ll) const; + wxLongLongWx& operator|=(const wxLongLongWx& ll); + wxLongLongWx operator^(const wxLongLongWx& ll) const; + wxLongLongWx& operator^=(const wxLongLongWx& ll); + wxLongLongWx operator~() const; + + // comparison + bool operator==(const wxLongLongWx& ll) const + { return m_lo == ll.m_lo && m_hi == ll.m_hi; } +#if wxUSE_LONGLONG_NATIVE + bool operator==(const wxLongLongNative& ll) const + { return m_lo == ll.GetLo() && m_hi == ll.GetHi(); } +#endif + bool operator!=(const wxLongLongWx& ll) const + { return !(*this == ll); } + bool operator<(const wxLongLongWx& ll) const; + bool operator>(const wxLongLongWx& ll) const; + bool operator<=(const wxLongLongWx& ll) const + { return *this < ll || *this == ll; } + bool operator>=(const wxLongLongWx& ll) const + { return *this > ll || *this == ll; } + + bool operator<(long l) const { return *this < wxLongLongWx(l); } + bool operator>(long l) const { return *this > wxLongLongWx(l); } + bool operator==(long l) const + { + return l >= 0 ? (m_hi == 0 && m_lo == (unsigned long)l) + : (m_hi == -1 && m_lo == (unsigned long)l); + } + + bool operator<=(long l) const { return *this < l || *this == l; } + bool operator>=(long l) const { return *this > l || *this == l; } + + // multiplication + wxLongLongWx operator*(const wxLongLongWx& ll) const; + wxLongLongWx& operator*=(const wxLongLongWx& ll); + + // division + wxLongLongWx operator/(const wxLongLongWx& ll) const; + wxLongLongWx& operator/=(const wxLongLongWx& ll); + + wxLongLongWx operator%(const wxLongLongWx& ll) const; + + void Divide(const wxLongLongWx& divisor, + wxLongLongWx& quotient, + wxLongLongWx& remainder) const; + + // input/output + + // return the string representation of this number + wxString ToString() const; + + void *asArray() const; + +#if wxUSE_STD_IOSTREAM + friend WXDLLIMPEXP_BASE + wxSTD ostream& operator<<(wxSTD ostream&, const wxLongLongWx&); +#endif // wxUSE_STD_IOSTREAM + + friend WXDLLIMPEXP_BASE + wxString& operator<<(wxString&, const wxLongLongWx&); + +#if wxUSE_STREAMS + friend WXDLLIMPEXP_BASE + class wxTextOutputStream& operator<<(class wxTextOutputStream&, const wxLongLongWx&); + friend WXDLLIMPEXP_BASE + class wxTextInputStream& operator>>(class wxTextInputStream&, wxLongLongWx&); +#endif + +private: + // long is at least 32 bits, so represent our 64bit number as 2 longs + + long m_hi; // signed bit is in the high part + unsigned long m_lo; + +#ifdef wxLONGLONG_TEST_MODE + void Check() + { + wxASSERT( (m_ll >> 32) == m_hi && (unsigned long)m_ll == m_lo ); + } + + wxLongLong_t m_ll; +#endif // wxLONGLONG_TEST_MODE +}; + + +class WXDLLIMPEXP_BASE wxULongLongWx +{ +public: + // ctors + // default ctor initializes to 0 + wxULongLongWx() + { + m_lo = m_hi = 0; + +#ifdef wxLONGLONG_TEST_MODE + m_ll = 0; + + Check(); +#endif // wxLONGLONG_TEST_MODE + } + // from ulong + wxULongLongWx(unsigned long l) { *this = l; } + // from 2 ulongs + wxULongLongWx(unsigned long hi, unsigned long lo) + { + m_hi = hi; + m_lo = lo; + +#ifdef wxLONGLONG_TEST_MODE + m_ll = hi; + m_ll <<= 32; + m_ll |= lo; + + Check(); +#endif // wxLONGLONG_TEST_MODE + } + + // from signed to unsigned + wxULongLongWx(wxLongLongWx ll) + { + wxASSERT(ll.GetHi() >= 0); + m_hi = (unsigned long)ll.GetHi(); + m_lo = ll.GetLo(); + } + + // default copy ctor is ok in both cases + + // no dtor + + // assignment operators + // from long + wxULongLongWx& operator=(unsigned long l) + { + m_lo = l; + m_hi = 0; + +#ifdef wxLONGLONG_TEST_MODE + m_ll = l; + + Check(); +#endif // wxLONGLONG_TEST_MODE + + return *this; + } + wxULongLongWx& operator=(long l) + { + m_lo = l; + m_hi = (unsigned long) ((l<0) ? -1l : 0); + +#ifdef wxLONGLONG_TEST_MODE + m_ll = (wxULongLong_t) (wxLongLong_t) l; + + Check(); +#endif // wxLONGLONG_TEST_MODE + + return *this; + } + wxULongLongWx& operator=(const class wxLongLongWx &ll) { + // Should we use an assert like it was before in the constructor? + // wxASSERT(ll.GetHi() >= 0); + m_hi = (unsigned long)ll.GetHi(); + m_lo = ll.GetLo(); + return *this; + } + + // can't have assignment operator from 2 longs + + // accessors + // get high part + unsigned long GetHi() const { return m_hi; } + // get low part + unsigned long GetLo() const { return m_lo; } + + // convert to long with range checking in debug mode (only!) + unsigned long ToULong() const + { + wxASSERT_MSG( m_hi == 0ul, + wxT("wxULongLong to long conversion loss of precision") ); + + return (unsigned long)m_lo; + } + + // convert to double + double ToDouble() const; + + // operations + // addition + wxULongLongWx operator+(const wxULongLongWx& ll) const; + wxULongLongWx& operator+=(const wxULongLongWx& ll); + wxULongLongWx operator+(unsigned long l) const; + wxULongLongWx& operator+=(unsigned long l); + + // pre increment operator + wxULongLongWx& operator++(); + + // post increment operator + wxULongLongWx& operator++(int) { return ++(*this); } + + // subtraction + wxLongLongWx operator-(const wxULongLongWx& ll) const; + wxULongLongWx& operator-=(const wxULongLongWx& ll); + + // pre decrement operator + wxULongLongWx& operator--(); + + // post decrement operator + wxULongLongWx& operator--(int) { return --(*this); } + + // shifts + // left shift + wxULongLongWx operator<<(int shift) const; + wxULongLongWx& operator<<=(int shift); + + // right shift + wxULongLongWx operator>>(int shift) const; + wxULongLongWx& operator>>=(int shift); + + // bitwise operators + wxULongLongWx operator&(const wxULongLongWx& ll) const; + wxULongLongWx& operator&=(const wxULongLongWx& ll); + wxULongLongWx operator|(const wxULongLongWx& ll) const; + wxULongLongWx& operator|=(const wxULongLongWx& ll); + wxULongLongWx operator^(const wxULongLongWx& ll) const; + wxULongLongWx& operator^=(const wxULongLongWx& ll); + wxULongLongWx operator~() const; + + // comparison + bool operator==(const wxULongLongWx& ll) const + { return m_lo == ll.m_lo && m_hi == ll.m_hi; } + bool operator!=(const wxULongLongWx& ll) const + { return !(*this == ll); } + bool operator<(const wxULongLongWx& ll) const; + bool operator>(const wxULongLongWx& ll) const; + bool operator<=(const wxULongLongWx& ll) const + { return *this < ll || *this == ll; } + bool operator>=(const wxULongLongWx& ll) const + { return *this > ll || *this == ll; } + + bool operator<(unsigned long l) const { return *this < wxULongLongWx(l); } + bool operator>(unsigned long l) const { return *this > wxULongLongWx(l); } + bool operator==(unsigned long l) const + { + return (m_hi == 0 && m_lo == (unsigned long)l); + } + + bool operator<=(unsigned long l) const { return *this < l || *this == l; } + bool operator>=(unsigned long l) const { return *this > l || *this == l; } + + // multiplication + wxULongLongWx operator*(const wxULongLongWx& ll) const; + wxULongLongWx& operator*=(const wxULongLongWx& ll); + + // division + wxULongLongWx operator/(const wxULongLongWx& ll) const; + wxULongLongWx& operator/=(const wxULongLongWx& ll); + + wxULongLongWx operator%(const wxULongLongWx& ll) const; + + void Divide(const wxULongLongWx& divisor, + wxULongLongWx& quotient, + wxULongLongWx& remainder) const; + + // input/output + + // return the string representation of this number + wxString ToString() const; + + void *asArray() const; + +#if wxUSE_STD_IOSTREAM + friend WXDLLIMPEXP_BASE + wxSTD ostream& operator<<(wxSTD ostream&, const wxULongLongWx&); +#endif // wxUSE_STD_IOSTREAM + + friend WXDLLIMPEXP_BASE + wxString& operator<<(wxString&, const wxULongLongWx&); + +#if wxUSE_STREAMS + friend WXDLLIMPEXP_BASE + class wxTextOutputStream& operator<<(class wxTextOutputStream&, const wxULongLongWx&); + friend WXDLLIMPEXP_BASE + class wxTextInputStream& operator>>(class wxTextInputStream&, wxULongLongWx&); +#endif + +private: + // long is at least 32 bits, so represent our 64bit number as 2 longs + + unsigned long m_hi; + unsigned long m_lo; + +#ifdef wxLONGLONG_TEST_MODE + void Check() + { + wxASSERT( (m_ll >> 32) == m_hi && (unsigned long)m_ll == m_lo ); + } + + wxULongLong_t m_ll; +#endif // wxLONGLONG_TEST_MODE +}; + +#endif // wxUSE_LONGLONG_WX + +// ---------------------------------------------------------------------------- +// binary operators +// ---------------------------------------------------------------------------- + +inline bool operator<(long l, const wxLongLong& ll) { return ll > l; } +inline bool operator>(long l, const wxLongLong& ll) { return ll < l; } +inline bool operator<=(long l, const wxLongLong& ll) { return ll >= l; } +inline bool operator>=(long l, const wxLongLong& ll) { return ll <= l; } +inline bool operator==(long l, const wxLongLong& ll) { return ll == l; } +inline bool operator!=(long l, const wxLongLong& ll) { return ll != l; } + +inline wxLongLong operator+(long l, const wxLongLong& ll) { return ll + l; } +inline wxLongLong operator-(long l, const wxLongLong& ll) +{ + return wxLongLong(l) - ll; +} + +inline bool operator<(unsigned long l, const wxULongLong& ull) { return ull > l; } +inline bool operator>(unsigned long l, const wxULongLong& ull) { return ull < l; } +inline bool operator<=(unsigned long l, const wxULongLong& ull) { return ull >= l; } +inline bool operator>=(unsigned long l, const wxULongLong& ull) { return ull <= l; } +inline bool operator==(unsigned long l, const wxULongLong& ull) { return ull == l; } +inline bool operator!=(unsigned long l, const wxULongLong& ull) { return ull != l; } + +inline wxULongLong operator+(unsigned long l, const wxULongLong& ull) { return ull + l; } + +inline wxLongLong operator-(unsigned long l, const wxULongLong& ull) +{ + const wxULongLong ret = wxULongLong(l) - ull; + return wxLongLong((wxInt32)ret.GetHi(),ret.GetLo()); +} + +#if wxUSE_LONGLONG_NATIVE && wxUSE_STREAMS + +WXDLLIMPEXP_BASE class wxTextOutputStream &operator<<(class wxTextOutputStream &stream, wxULongLong_t value); +WXDLLIMPEXP_BASE class wxTextOutputStream &operator<<(class wxTextOutputStream &stream, wxLongLong_t value); + +WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &stream, wxULongLong_t &value); +WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &stream, wxLongLong_t &value); + +#endif + +// ---------------------------------------------------------------------------- +// Specialize numeric_limits<> for our long long wrapper classes. +// ---------------------------------------------------------------------------- + +#if wxUSE_LONGLONG_NATIVE + +#include <limits> + +namespace std +{ + +#ifdef __clang__ + // libstdc++ (used by Clang) uses struct for numeric_limits; unlike gcc, clang + // warns about this + template<> struct numeric_limits<wxLongLong> : public numeric_limits<wxLongLong_t> {}; + template<> struct numeric_limits<wxULongLong> : public numeric_limits<wxULongLong_t> {}; +#else + template<> class numeric_limits<wxLongLong> : public numeric_limits<wxLongLong_t> {}; + template<> class numeric_limits<wxULongLong> : public numeric_limits<wxULongLong_t> {}; +#endif + +} // namespace std + +#endif // wxUSE_LONGLONG_NATIVE + +// ---------------------------------------------------------------------------- +// Specialize wxArgNormalizer to allow using wxLongLong directly with wx pseudo +// vararg functions. +// ---------------------------------------------------------------------------- + +// Notice that this must be done here and not in wx/strvararg.h itself because +// we can't include wx/longlong.h from there as this header itself includes +// wx/string.h which includes wx/strvararg.h too, so to avoid the circular +// dependencies we can only do it here (or add another header just for this but +// it doesn't seem necessary). +#include "wx/strvararg.h" + +template<> +struct WXDLLIMPEXP_BASE wxArgNormalizer<wxLongLong> +{ + wxArgNormalizer(wxLongLong value, + const wxFormatString *fmt, unsigned index) + : m_value(value) + { + wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_LongLongInt ); + } + + wxLongLong_t get() const { return m_value.GetValue(); } + + wxLongLong m_value; +}; + +#endif // wxUSE_LONGLONG + +#endif // _WX_LONGLONG_H diff --git a/lib/wxWidgets/include/wx/lzmastream.h b/lib/wxWidgets/include/wx/lzmastream.h new file mode 100644 index 0000000..9bd2ab1 --- /dev/null +++ b/lib/wxWidgets/include/wx/lzmastream.h @@ -0,0 +1,149 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/lzmastream.h +// Purpose: Filters streams using LZMA(2) compression +// Author: Vadim Zeitlin +// Created: 2018-03-29 +// Copyright: (c) 2018 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LZMASTREAM_H_ +#define _WX_LZMASTREAM_H_ + +#include "wx/defs.h" + +#if wxUSE_LIBLZMA && wxUSE_STREAMS + +#include "wx/stream.h" +#include "wx/versioninfo.h" + +namespace wxPrivate +{ + +// Private wrapper for lzma_stream struct. +struct wxLZMAStream; + +// Common part of input and output LZMA streams: this is just an implementation +// detail and is not part of the public API. +class WXDLLIMPEXP_BASE wxLZMAData +{ +protected: + wxLZMAData(); + ~wxLZMAData(); + + wxLZMAStream* m_stream; + wxUint8* m_streamBuf; + wxFileOffset m_pos; + + wxDECLARE_NO_COPY_CLASS(wxLZMAData); +}; + +} // namespace wxPrivate + +// ---------------------------------------------------------------------------- +// Filter for decompressing data compressed using LZMA +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxLZMAInputStream : public wxFilterInputStream, + private wxPrivate::wxLZMAData +{ +public: + explicit wxLZMAInputStream(wxInputStream& stream) + : wxFilterInputStream(stream) + { + Init(); + } + + explicit wxLZMAInputStream(wxInputStream* stream) + : wxFilterInputStream(stream) + { + Init(); + } + + char Peek() wxOVERRIDE { return wxInputStream::Peek(); } + wxFileOffset GetLength() const wxOVERRIDE { return wxInputStream::GetLength(); } + +protected: + size_t OnSysRead(void *buffer, size_t size) wxOVERRIDE; + wxFileOffset OnSysTell() const wxOVERRIDE { return m_pos; } + +private: + void Init(); +}; + +// ---------------------------------------------------------------------------- +// Filter for compressing data using LZMA(2) algorithm +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxLZMAOutputStream : public wxFilterOutputStream, + private wxPrivate::wxLZMAData +{ +public: + explicit wxLZMAOutputStream(wxOutputStream& stream, int level = -1) + : wxFilterOutputStream(stream) + { + Init(level); + } + + explicit wxLZMAOutputStream(wxOutputStream* stream, int level = -1) + : wxFilterOutputStream(stream) + { + Init(level); + } + + virtual ~wxLZMAOutputStream() { Close(); } + + void Sync() wxOVERRIDE { DoFlush(false); } + bool Close() wxOVERRIDE; + wxFileOffset GetLength() const wxOVERRIDE { return m_pos; } + +protected: + size_t OnSysWrite(const void *buffer, size_t size) wxOVERRIDE; + wxFileOffset OnSysTell() const wxOVERRIDE { return m_pos; } + +private: + void Init(int level); + + // Write the contents of the internal buffer to the output stream. + bool UpdateOutput(); + + // Write out the current buffer if necessary, i.e. if no space remains in + // it, and reinitialize m_stream to point to it. Returns false on success + // or false on error, in which case m_lasterror is updated. + bool UpdateOutputIfNecessary(); + + // Run LZMA_FINISH (if argument is true) or LZMA_FULL_FLUSH, return true on + // success or false on error. + bool DoFlush(bool finish); +}; + +// ---------------------------------------------------------------------------- +// Support for creating LZMA streams from extension/MIME type +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxLZMAClassFactory: public wxFilterClassFactory +{ +public: + wxLZMAClassFactory(); + + wxFilterInputStream *NewStream(wxInputStream& stream) const wxOVERRIDE + { return new wxLZMAInputStream(stream); } + wxFilterOutputStream *NewStream(wxOutputStream& stream) const wxOVERRIDE + { return new wxLZMAOutputStream(stream, -1); } + wxFilterInputStream *NewStream(wxInputStream *stream) const wxOVERRIDE + { return new wxLZMAInputStream(stream); } + wxFilterOutputStream *NewStream(wxOutputStream *stream) const wxOVERRIDE + { return new wxLZMAOutputStream(stream, -1); } + + const wxChar * const *GetProtocols(wxStreamProtocolType type + = wxSTREAM_PROTOCOL) const wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxLZMAClassFactory); +}; + +WXDLLIMPEXP_BASE wxVersionInfo wxGetLibLZMAVersionInfo(); + +#endif // wxUSE_LIBLZMA && wxUSE_STREAMS + +#endif // _WX_LZMASTREAM_H_ diff --git a/lib/wxWidgets/include/wx/math.h b/lib/wxWidgets/include/wx/math.h new file mode 100644 index 0000000..fd76129 --- /dev/null +++ b/lib/wxWidgets/include/wx/math.h @@ -0,0 +1,228 @@ +/** +* Name: wx/math.h +* Purpose: Declarations/definitions of common math functions +* Author: John Labenski and others +* Modified by: +* Created: 02/02/03 +* Copyright: (c) John Labenski +* Licence: wxWindows licence +*/ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#ifndef _WX_MATH_H_ +#define _WX_MATH_H_ + +#include "wx/defs.h" + +#include <math.h> + +#ifndef M_PI + #define M_PI 3.1415926535897932384626433832795 +#endif + +/* Scaling factors for various unit conversions: 1 inch = 2.54 cm */ +#ifndef METRIC_CONVERSION_CONSTANT + #define METRIC_CONVERSION_CONSTANT (1/25.4) +#endif + +#ifndef mm2inches + #define mm2inches (METRIC_CONVERSION_CONSTANT) +#endif + +#ifndef inches2mm + #define inches2mm (1/(mm2inches)) +#endif + +#ifndef mm2twips + #define mm2twips (METRIC_CONVERSION_CONSTANT*1440) +#endif + +#ifndef twips2mm + #define twips2mm (1/(mm2twips)) +#endif + +#ifndef mm2pt + #define mm2pt (METRIC_CONVERSION_CONSTANT*72) +#endif + +#ifndef pt2mm + #define pt2mm (1/(mm2pt)) +#endif + + +#ifdef __cplusplus + +#include <cmath> + +/* + Things are simple with C++11: we have everything we need in std. + Eventually we will only have this section and not the legacy stuff below. + */ +#if wxCHECK_CXX_STD(201103) + #define wxFinite(x) std::isfinite(x) + #define wxIsNaN(x) std::isnan(x) +#else /* C++98 */ + +#if defined(__VISUALC__) + #include <float.h> + #define wxFinite(x) _finite(x) +#elif defined(__MINGW64_TOOLCHAIN__) || defined(__clang__) + /* + add more compilers with C99 support here: using C99 isfinite() is + preferable to using BSD-ish finite() + */ + #if defined(_GLIBCXX_CMATH) || defined(_LIBCPP_CMATH) + // these <cmath> headers #undef isfinite + #define wxFinite(x) std::isfinite(x) + #else + #define wxFinite(x) isfinite(x) + #endif +#elif defined(wxNEEDS_STRICT_ANSI_WORKAROUNDS) + wxDECL_FOR_STRICT_MINGW32(int, _finite, (double)) + + #define wxFinite(x) _finite(x) +#elif ( defined(__GNUG__)||defined(__GNUWIN32__)|| \ + defined(__SGI_CC__)||defined(__SUNCC__)||defined(__XLC__)|| \ + defined(__HPUX__) ) && ( !defined(wxOSX_USE_IPHONE) || wxOSX_USE_IPHONE == 0 ) +#ifdef __SOLARIS__ +#include <ieeefp.h> +#endif + #define wxFinite(x) finite(x) +#else + #define wxFinite(x) ((x) == (x)) +#endif + + +#if defined(__VISUALC__) + #define wxIsNaN(x) _isnan(x) +#elif defined(__GNUG__)||defined(__GNUWIN32__)|| \ + defined(__SGI_CC__)||defined(__SUNCC__)||defined(__XLC__)|| \ + defined(__HPUX__) + #define wxIsNaN(x) isnan(x) +#else + #define wxIsNaN(x) ((x) != (x)) +#endif + +#endif /* C++11/C++98 */ + +#ifdef __INTELC__ + + inline bool wxIsSameDouble(double x, double y) + { + // VZ: this warning, given for operators==() and !=() is not wrong, as == + // shouldn't be used with doubles, but we get too many of them and + // removing these operators is probably not a good idea + // + // Maybe we should always compare doubles up to some "epsilon" precision + #pragma warning(push) + + // floating-point equality and inequality comparisons are unreliable + #pragma warning(disable: 1572) + + return x == y; + + #pragma warning(pop) + } + +#else /* !__INTELC__ */ + wxGCC_WARNING_SUPPRESS(float-equal) + inline bool wxIsSameDouble(double x, double y) { return x == y; } + wxGCC_WARNING_RESTORE(float-equal) + +#endif /* __INTELC__/!__INTELC__ */ + +inline bool wxIsNullDouble(double x) { return wxIsSameDouble(x, 0.); } + +inline int wxRound(double x) +{ + wxASSERT_MSG(x > double(INT_MIN) - 0.5 && x < double(INT_MAX) + 0.5, + "argument out of supported range"); + + #if wxCHECK_CXX_STD(201103) + return int(std::lround(x)); + #elif defined(HAVE_ROUND) || wxCHECK_VISUALC_VERSION(12) + return int(lround(x)); + #else + return int(x < 0 ? x - 0.5 : x + 0.5); + #endif +} + +inline int wxRound(float x) +{ + wxASSERT_MSG(x > float(INT_MIN) && x < float(INT_MAX), + "argument out of supported range"); + + #if wxCHECK_CXX_STD(201103) + return int(std::lround(x)); + #elif defined(HAVE_ROUND) || wxCHECK_VISUALC_VERSION(12) + return int(lroundf(x)); + #else + return int(x < 0.0f ? x - 0.5f : x + 0.5f); + #endif +} + +inline int wxRound(long double x) { return wxRound(double(x)); } + +// For compatibility purposes, make wxRound() work with integer types too, as +// this used to compile with wx 3.0. +#if WXWIN_COMPATIBILITY_3_0 + +template <typename T> +wxDEPRECATED_MSG("rounding an integer is useless") +inline int wxRound(T x) +{ + // We have to disable this warning for the unsigned types. We do handle + // them correctly in this comparison due to "x > 0" below (removing it + // would make this fail for them!). + wxGCC_WARNING_SUPPRESS(sign-compare) + + wxASSERT_MSG((x > 0 || x > INT_MIN) && x < INT_MAX, + "argument out of supported range"); + + wxGCC_WARNING_RESTORE(sign-compare) + + return int(x); +} + +#endif // WXWIN_COMPATIBILITY_3_0 + +// Convert between degrees and radians. +inline double wxDegToRad(double deg) { return (deg * M_PI) / 180.0; } +inline double wxRadToDeg(double rad) { return (rad * 180.0) / M_PI; } + +// Count trailing zeros. +WXDLLIMPEXP_BASE unsigned int wxCTZ(wxUint32 x); + +#endif /* __cplusplus */ + + +#if defined(__WINDOWS__) + #define wxMulDivInt32( a , b , c ) ::MulDiv( a , b , c ) +#else + #define wxMulDivInt32( a , b , c ) (wxRound((a)*(((wxDouble)b)/((wxDouble)c)))) +#endif + +#if wxUSE_APPLE_IEEE +#ifdef __cplusplus + extern "C" { +#endif + /* functions from common/extended.c */ + WXDLLIMPEXP_BASE wxFloat64 wxConvertFromIeeeExtended(const wxInt8 *bytes); + WXDLLIMPEXP_BASE void wxConvertToIeeeExtended(wxFloat64 num, wxInt8 *bytes); + + /* use wxConvertFromIeeeExtended() and wxConvertToIeeeExtended() instead */ +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED( WXDLLIMPEXP_BASE wxFloat64 ConvertFromIeeeExtended(const wxInt8 *bytes) ); + wxDEPRECATED( WXDLLIMPEXP_BASE void ConvertToIeeeExtended(wxFloat64 num, wxInt8 *bytes) ); +#endif + +#ifdef __cplusplus + } +#endif +#endif /* wxUSE_APPLE_IEEE */ + +/* Compute the greatest common divisor of two positive integers */ +WXDLLIMPEXP_BASE unsigned int wxGCD(unsigned int u, unsigned int v); + +#endif /* _WX_MATH_H_ */ diff --git a/lib/wxWidgets/include/wx/matrix.h b/lib/wxWidgets/include/wx/matrix.h new file mode 100644 index 0000000..3b3225d --- /dev/null +++ b/lib/wxWidgets/include/wx/matrix.h @@ -0,0 +1,244 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/matrix.h +// Purpose: wxTransformMatrix class. NOT YET USED +// Author: Chris Breeze, Julian Smart +// Modified by: Klaas Holwerda +// Created: 01/02/97 +// Copyright: (c) Julian Smart, Chris Breeze +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MATRIXH__ +#define _WX_MATRIXH__ + +#include "wx/defs.h" + +// Contents of this file is deprecated and shouldn't be used in the new code, +// please see wxAffineMatrix2D instead. + +#if WXWIN_COMPATIBILITY_3_0 + +#include "wx/object.h" +#include "wx/math.h" + +//! codefiles="matrix.cpp" + +// A simple 3x3 matrix. This may be replaced by a more general matrix +// class some day. +// +// Note: this is intended to be used in wxDC at some point to replace +// the current system of scaling/translation. It is not yet used. + +//:definition +// A 3x3 matrix to do 2D transformations. +// It can be used to map data to window coordinates, +// and also for manipulating your own data. +// For example drawing a picture (composed of several primitives) +// at a certain coordinate and angle within another parent picture. +// At all times m_isIdentity is set if the matrix itself is an Identity matrix. +// It is used where possible to optimize calculations. +class +wxDEPRECATED_EXPORT_CORE("use wxAffineMatrix2D instead") +wxTransformMatrix: public wxObject +{ +public: + wxTransformMatrix(); + wxTransformMatrix(const wxTransformMatrix& mat); + + //get the value in the matrix at col,row + //rows are horizontal (second index of m_matrix member) + //columns are vertical (first index of m_matrix member) + double GetValue(int col, int row) const; + + //set the value in the matrix at col,row + //rows are horizontal (second index of m_matrix member) + //columns are vertical (first index of m_matrix member) + void SetValue(int col, int row, double value); + + void operator = (const wxTransformMatrix& mat); + bool operator == (const wxTransformMatrix& mat) const; + bool operator != (const wxTransformMatrix& mat) const; + + //multiply every element by t + wxTransformMatrix& operator*=(const double& t); + //divide every element by t + wxTransformMatrix& operator/=(const double& t); + //add matrix m to this t + wxTransformMatrix& operator+=(const wxTransformMatrix& m); + //subtract matrix m from this + wxTransformMatrix& operator-=(const wxTransformMatrix& m); + //multiply matrix m with this + wxTransformMatrix& operator*=(const wxTransformMatrix& m); + + // constant operators + + //multiply every element by t and return result + wxTransformMatrix operator*(const double& t) const; + //divide this matrix by t and return result + wxTransformMatrix operator/(const double& t) const; + //add matrix m to this and return result + wxTransformMatrix operator+(const wxTransformMatrix& m) const; + //subtract matrix m from this and return result + wxTransformMatrix operator-(const wxTransformMatrix& m) const; + //multiply this by matrix m and return result + wxTransformMatrix operator*(const wxTransformMatrix& m) const; + wxTransformMatrix operator-() const; + + //rows are horizontal (second index of m_matrix member) + //columns are vertical (first index of m_matrix member) + double& operator()(int col, int row); + + //rows are horizontal (second index of m_matrix member) + //columns are vertical (first index of m_matrix member) + double operator()(int col, int row) const; + + // Invert matrix + bool Invert(); + + // Make into identity matrix + bool Identity(); + + // Is the matrix the identity matrix? + // Only returns a flag, which is set whenever an operation + // is done. + inline bool IsIdentity() const { return m_isIdentity; } + + // This does an actual check. + inline bool IsIdentity1() const ; + + //Scale by scale (isotropic scaling i.e. the same in x and y): + //!ex: + //!code: | scale 0 0 | + //!code: matrix' = | 0 scale 0 | x matrix + //!code: | 0 0 scale | + bool Scale(double scale); + + //Scale with center point and x/y scale + // + //!ex: + //!code: | xs 0 xc(1-xs) | + //!code: matrix' = | 0 ys yc(1-ys) | x matrix + //!code: | 0 0 1 | + wxTransformMatrix& Scale(const double &xs, const double &ys,const double &xc, const double &yc); + + // mirror a matrix in x, y + //!ex: + //!code: | -1 0 0 | + //!code: matrix' = | 0 -1 0 | x matrix + //!code: | 0 0 1 | + wxTransformMatrix& Mirror(bool x=true, bool y=false); + // Translate by dx, dy: + //!ex: + //!code: | 1 0 dx | + //!code: matrix' = | 0 1 dy | x matrix + //!code: | 0 0 1 | + bool Translate(double x, double y); + + // Rotate clockwise by the given number of degrees: + //!ex: + //!code: | cos sin 0 | + //!code: matrix' = | -sin cos 0 | x matrix + //!code: | 0 0 1 | + bool Rotate(double angle); + + //Rotate counter clockwise with point of rotation + // + //!ex: + //!code: | cos(r) -sin(r) x(1-cos(r))+y(sin(r)| + //!code: matrix' = | sin(r) cos(r) y(1-cos(r))-x(sin(r)| x matrix + //!code: | 0 0 1 | + wxTransformMatrix& Rotate(const double &r, const double &x, const double &y); + + // Transform X value from logical to device + inline double TransformX(double x) const; + + // Transform Y value from logical to device + inline double TransformY(double y) const; + + // Transform a point from logical to device coordinates + bool TransformPoint(double x, double y, double& tx, double& ty) const; + + // Transform a point from device to logical coordinates. + // Example of use: + // wxTransformMatrix mat = dc.GetTransformation(); + // mat.Invert(); + // mat.InverseTransformPoint(x, y, x1, y1); + // OR (shorthand:) + // dc.LogicalToDevice(x, y, x1, y1); + // The latter is slightly less efficient if we're doing several + // conversions, since the matrix is inverted several times. + // N.B. 'this' matrix is the inverse at this point + bool InverseTransformPoint(double x, double y, double& tx, double& ty) const; + + double Get_scaleX(); + double Get_scaleY(); + double GetRotation(); + void SetRotation(double rotation); + + +public: + double m_matrix[3][3]; + bool m_isIdentity; +}; + + +/* +Chris Breeze reported, that +some functions of wxTransformMatrix cannot work because it is not +known if he matrix has been inverted. Be careful when using it. +*/ + +// Transform X value from logical to device +// warning: this function can only be used for this purpose +// because no rotation is involved when mapping logical to device coordinates +// mirror and scaling for x and y will be part of the matrix +// if you have a matrix that is rotated, eg a shape containing a matrix to place +// it in the logical coordinate system, use TransformPoint +inline double wxTransformMatrix::TransformX(double x) const +{ + //normally like this, but since no rotation is involved (only mirror and scale) + //we can do without Y -> m_matrix[1]{0] is -sin(rotation angle) and therefore zero + //(x * m_matrix[0][0] + y * m_matrix[1][0] + m_matrix[2][0])) + return (m_isIdentity ? x : (x * m_matrix[0][0] + m_matrix[2][0])); +} + +// Transform Y value from logical to device +// warning: this function can only be used for this purpose +// because no rotation is involved when mapping logical to device coordinates +// mirror and scaling for x and y will be part of the matrix +// if you have a matrix that is rotated, eg a shape containing a matrix to place +// it in the logical coordinate system, use TransformPoint +inline double wxTransformMatrix::TransformY(double y) const +{ + //normally like this, but since no rotation is involved (only mirror and scale) + //we can do without X -> m_matrix[0]{1] is sin(rotation angle) and therefore zero + //(x * m_matrix[0][1] + y * m_matrix[1][1] + m_matrix[2][1])) + return (m_isIdentity ? y : (y * m_matrix[1][1] + m_matrix[2][1])); +} + + +// Is the matrix the identity matrix? +// Each operation checks whether the result is still the identity matrix and sets a flag. +inline bool wxTransformMatrix::IsIdentity1() const +{ + return + ( wxIsSameDouble(m_matrix[0][0], 1.0) && + wxIsSameDouble(m_matrix[1][1], 1.0) && + wxIsSameDouble(m_matrix[2][2], 1.0) && + wxIsSameDouble(m_matrix[1][0], 0.0) && + wxIsSameDouble(m_matrix[2][0], 0.0) && + wxIsSameDouble(m_matrix[0][1], 0.0) && + wxIsSameDouble(m_matrix[2][1], 0.0) && + wxIsSameDouble(m_matrix[0][2], 0.0) && + wxIsSameDouble(m_matrix[1][2], 0.0) ); +} + +// Calculates the determinant of a 2 x 2 matrix +wxDEPRECATED_BUT_USED_INTERNALLY_INLINE( + inline double wxCalculateDet(double a11, double a21, double a12, double a22), + return a11 * a22 - a12 * a21; +) + +#endif // WXWIN_COMPATIBILITY_3_0 + +#endif // _WX_MATRIXH__ diff --git a/lib/wxWidgets/include/wx/mdi.h b/lib/wxWidgets/include/wx/mdi.h new file mode 100644 index 0000000..75eeaf4 --- /dev/null +++ b/lib/wxWidgets/include/wx/mdi.h @@ -0,0 +1,424 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mdi.h +// Purpose: wxMDI base header +// Author: Julian Smart (original) +// Vadim Zeitlin (base MDI classes refactoring) +// Copyright: (c) 1998 Julian Smart +// (c) 2008 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MDI_H_BASE_ +#define _WX_MDI_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_MDI + +#include "wx/frame.h" +#include "wx/menu.h" + +// forward declarations +class WXDLLIMPEXP_FWD_CORE wxMDIParentFrame; +class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; +class WXDLLIMPEXP_FWD_CORE wxMDIClientWindowBase; +class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow; + +// ---------------------------------------------------------------------------- +// wxMDIParentFrameBase: base class for parent frame for MDI children +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMDIParentFrameBase : public wxFrame +{ +public: + wxMDIParentFrameBase() + { + m_clientWindow = NULL; + m_currentChild = NULL; +#if wxUSE_MENUS + m_windowMenu = NULL; +#endif // wxUSE_MENUS + } + + /* + Derived classes should provide ctor and Create() with the following + declaration: + + bool Create(wxWindow *parent, + wxWindowID winid, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + */ + +#if wxUSE_MENUS + virtual ~wxMDIParentFrameBase() + { + delete m_windowMenu; + } +#endif // wxUSE_MENUS + + // accessors + // --------- + + // Get or change the active MDI child window + virtual wxMDIChildFrame *GetActiveChild() const + { return m_currentChild; } + virtual void SetActiveChild(wxMDIChildFrame *child) + { m_currentChild = child; } + + + // Get the client window + wxMDIClientWindowBase *GetClientWindow() const { return m_clientWindow; } + + + // MDI windows menu functions + // -------------------------- + +#if wxUSE_MENUS + // return the pointer to the current window menu or NULL if we don't have + // because of wxFRAME_NO_WINDOW_MENU style + wxMenu* GetWindowMenu() const { return m_windowMenu; } + + // use the given menu instead of the default window menu + // + // menu can be NULL to disable the window menu completely + virtual void SetWindowMenu(wxMenu *menu) + { + if ( menu != m_windowMenu ) + { + delete m_windowMenu; + m_windowMenu = menu; + } + } +#endif // wxUSE_MENUS + + + // standard MDI window management functions + // ---------------------------------------- + + virtual void Cascade() { } + virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL) { } + virtual void ArrangeIcons() { } + virtual void ActivateNext() = 0; + virtual void ActivatePrevious() = 0; + + /* + Derived classes must provide the following function: + + static bool IsTDI(); + */ + + // Create the client window class (don't Create() the window here, just + // return a new object of a wxMDIClientWindow-derived class) + // + // Notice that if you override this method you should use the default + // constructor and Create() and not the constructor creating the window + // when creating the frame or your overridden version is not going to be + // called (as the call to a virtual function from ctor will be dispatched + // to this class version) + virtual wxMDIClientWindow *OnCreateClient(); + +protected: + // Override to pass menu/toolbar events to the active child first. + virtual bool TryBefore(wxEvent& event) wxOVERRIDE; + + + // This is wxMDIClientWindow for all the native implementations but not for + // the generic MDI version which has its own wxGenericMDIClientWindow and + // so we store it as just a base class pointer because we don't need its + // exact type anyhow + wxMDIClientWindowBase *m_clientWindow; + wxMDIChildFrame *m_currentChild; + +#if wxUSE_MENUS + // the current window menu or NULL if we are not using it + wxMenu *m_windowMenu; +#endif // wxUSE_MENUS +}; + +// ---------------------------------------------------------------------------- +// wxMDIChildFrameBase: child frame managed by wxMDIParentFrame +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMDIChildFrameBase : public wxFrame +{ +public: + wxMDIChildFrameBase() { m_mdiParent = NULL; } + + /* + Derived classes should provide Create() with the following signature: + + bool Create(wxMDIParentFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + And setting m_mdiParent to parent parameter. + */ + + // MDI children specific methods + virtual void Activate() = 0; + + // Return the MDI parent frame: notice that it may not be the same as + // GetParent() (our parent may be the client window or even its subwindow + // in some implementations) + wxMDIParentFrame *GetMDIParent() const { return m_mdiParent; } + + // Synonym for GetMDIParent(), was used in some other ports + wxMDIParentFrame *GetMDIParentFrame() const { return GetMDIParent(); } + + + // in most ports MDI children frames are not really top-level, the only + // exception are the Mac ports in which MDI children are just normal top + // level windows too + virtual bool IsTopLevel() const wxOVERRIDE { return false; } + + // In all ports keyboard navigation must stop at MDI child frame level and + // can't cross its boundary. Indicate this by overriding this function to + // return true. + virtual bool IsTopNavigationDomain(NavigationKind kind) const wxOVERRIDE + { + switch ( kind ) + { + case Navigation_Tab: + return true; + + case Navigation_Accel: + // Parent frame accelerators should work inside MDI child, so + // don't block their processing by returning true for them. + break; + } + + return false; + } + + // Raising any frame is supposed to show it but wxFrame Raise() + // implementation doesn't work for MDI child frames in most forms so + // forward this to Activate() which serves the same purpose by default. + virtual void Raise() wxOVERRIDE { Activate(); } + +protected: + wxMDIParentFrame *m_mdiParent; +}; + +// ---------------------------------------------------------------------------- +// wxTDIChildFrame: child frame used by TDI implementations +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTDIChildFrame : public wxMDIChildFrameBase +{ +public: + // override wxFrame methods for this non top-level window + +#if wxUSE_STATUSBAR + // no status bars + // + // TODO: MDI children should have their own status bars, why not? + virtual wxStatusBar* CreateStatusBar(int WXUNUSED(number) = 1, + long WXUNUSED(style) = 1, + wxWindowID WXUNUSED(id) = 1, + const wxString& WXUNUSED(name) + = wxEmptyString) wxOVERRIDE + { return NULL; } + + virtual wxStatusBar *GetStatusBar() const wxOVERRIDE + { return NULL; } + virtual void SetStatusText(const wxString &WXUNUSED(text), + int WXUNUSED(number)=0) wxOVERRIDE + { } + virtual void SetStatusWidths(int WXUNUSED(n), + const int WXUNUSED(widths)[]) wxOVERRIDE + { } +#endif // wxUSE_STATUSBAR + +#if wxUSE_TOOLBAR + // no toolbar + // + // TODO: again, it should be possible to have tool bars + virtual wxToolBar *CreateToolBar(long WXUNUSED(style), + wxWindowID WXUNUSED(id), + const wxString& WXUNUSED(name)) wxOVERRIDE + { return NULL; } + virtual wxToolBar *GetToolBar() const wxOVERRIDE { return NULL; } +#endif // wxUSE_TOOLBAR + + // no icon + virtual void SetIcons(const wxIconBundle& WXUNUSED(icons)) wxOVERRIDE { } + + // title is used as the tab label + virtual wxString GetTitle() const wxOVERRIDE { return m_title; } + virtual void SetTitle(const wxString& title) wxOVERRIDE = 0; + + // no maximize etc + virtual void Maximize(bool WXUNUSED(maximize) = true) wxOVERRIDE { } + virtual bool IsMaximized() const wxOVERRIDE { return true; } + virtual bool IsAlwaysMaximized() const wxOVERRIDE { return true; } + virtual void Iconize(bool WXUNUSED(iconize) = true) wxOVERRIDE { } + virtual bool IsIconized() const wxOVERRIDE { return false; } + virtual void Restore() wxOVERRIDE { } + + virtual bool ShowFullScreen(bool WXUNUSED(show), + long WXUNUSED(style)) wxOVERRIDE { return false; } + virtual bool IsFullScreen() const wxOVERRIDE { return false; } + + + // we need to override these functions to ensure that a child window is + // created even though we derive from wxFrame -- basically we make it + // behave as just a wxWindow by short-circuiting wxTLW changes to the base + // class behaviour + + virtual void AddChild(wxWindowBase *child) wxOVERRIDE { wxWindow::AddChild(child); } + + virtual bool Destroy() wxOVERRIDE { return wxWindow::Destroy(); } + + // extra platform-specific hacks +#ifdef __WXMSW__ + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const wxOVERRIDE + { + return wxWindow::MSWGetStyle(flags, exstyle); + } + + virtual WXHWND MSWGetParent() const wxOVERRIDE + { + return wxWindow::MSWGetParent(); + } + + WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) wxOVERRIDE + { + return wxWindow::MSWWindowProc(message, wParam, lParam); + } +#endif // __WXMSW__ + +protected: + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE + { + wxWindow::DoGetSize(width, height); + } + + virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags) wxOVERRIDE + { + wxWindow::DoSetSize(x, y, width, height, sizeFlags); + } + + virtual void DoGetClientSize(int *width, int *height) const wxOVERRIDE + { + wxWindow::DoGetClientSize(width, height); + } + + virtual void DoSetClientSize(int width, int height) wxOVERRIDE + { + wxWindow::DoSetClientSize(width, height); + } + + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE + { + wxWindow::DoMoveWindow(x, y, width, height); + } + + virtual void DoGetScreenPosition(int *x, int *y) const wxOVERRIDE + { + wxWindow::DoGetScreenPosition(x, y); + } + + // no size hints + virtual void DoSetSizeHints(int WXUNUSED(minW), int WXUNUSED(minH), + int WXUNUSED(maxW), int WXUNUSED(maxH), + int WXUNUSED(incW), int WXUNUSED(incH)) wxOVERRIDE { } + + wxString m_title; +}; + +// ---------------------------------------------------------------------------- +// wxMDIClientWindowBase: child of parent frame, parent of children frames +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMDIClientWindowBase : public wxWindow +{ +public: + /* + The derived class must provide the default ctor only (CreateClient() + will be called later). + */ + + // Can be overridden in the derived classes but the base class version must + // be usually called first to really create the client window. + virtual bool CreateClient(wxMDIParentFrame *parent, + long style = wxVSCROLL | wxHSCROLL) = 0; +}; + +// ---------------------------------------------------------------------------- +// Include the port-specific implementation of the base classes defined above +// ---------------------------------------------------------------------------- + +// wxUSE_GENERIC_MDI_AS_NATIVE may be predefined to force the generic MDI +// implementation use even on the platforms which usually don't use it +// +// notice that generic MDI can still be used without this, but you would need +// to explicitly use wxGenericMDIXXX classes in your code (and currently also +// add src/generic/mdig.cpp to your build as it's not compiled in if generic +// MDI is not used by default -- but this may change later...) +#ifndef wxUSE_GENERIC_MDI_AS_NATIVE + // wxUniv always uses the generic MDI implementation and so do the ports + // without native version (although wxCocoa seems to have one -- but it's + // probably not functional?) + #if defined(__WXMOTIF__) || \ + defined(__WXUNIVERSAL__) + #define wxUSE_GENERIC_MDI_AS_NATIVE 1 + #else + #define wxUSE_GENERIC_MDI_AS_NATIVE 0 + #endif +#endif // wxUSE_GENERIC_MDI_AS_NATIVE + +#if wxUSE_GENERIC_MDI_AS_NATIVE + #include "wx/generic/mdig.h" +#elif defined(__WXMSW__) + #include "wx/msw/mdi.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/mdi.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/mdi.h" +#elif defined(__WXMAC__) + #include "wx/osx/mdi.h" +#elif defined(__WXQT__) + #include "wx/qt/mdi.h" +#endif + +inline wxMDIClientWindow *wxMDIParentFrameBase::OnCreateClient() +{ + return new wxMDIClientWindow; +} + +inline bool wxMDIParentFrameBase::TryBefore(wxEvent& event) +{ + // Menu (and toolbar) events should be sent to the active child frame + // first, if any. + if ( event.GetEventType() == wxEVT_MENU || + event.GetEventType() == wxEVT_UPDATE_UI ) + { + wxMDIChildFrame * const child = GetActiveChild(); + if ( child ) + { + // However avoid sending the event back to the child if it's + // currently being propagated to us from it. + wxWindow* const + from = static_cast<wxWindow*>(event.GetPropagatedFrom()); + if ( !from || !from->IsDescendant(child) ) + { + if ( child->ProcessWindowEventLocally(event) ) + return true; + } + } + } + + return wxFrame::TryBefore(event); +} + +#endif // wxUSE_MDI + +#endif // _WX_MDI_H_BASE_ diff --git a/lib/wxWidgets/include/wx/mediactrl.h b/lib/wxWidgets/include/wx/mediactrl.h new file mode 100644 index 0000000..ff15981 --- /dev/null +++ b/lib/wxWidgets/include/wx/mediactrl.h @@ -0,0 +1,397 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/mediactrl.h +// Purpose: wxMediaCtrl class +// Author: Ryan Norton <wxprojects@comcast.net> +// Modified by: +// Created: 11/07/04 +// Copyright: (c) Ryan Norton +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// Definitions +// ============================================================================ + +// ---------------------------------------------------------------------------- +// Header guard +// ---------------------------------------------------------------------------- +#ifndef _WX_MEDIACTRL_H_ +#define _WX_MEDIACTRL_H_ + +// ---------------------------------------------------------------------------- +// Pre-compiled header stuff +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +// ---------------------------------------------------------------------------- +// Compilation guard +// ---------------------------------------------------------------------------- + +#if wxUSE_MEDIACTRL + +// ---------------------------------------------------------------------------- +// Includes +// ---------------------------------------------------------------------------- + +#include "wx/control.h" +#include "wx/uri.h" + +#define wxMC_NO_AUTORESIZE 0x0001 + +// ============================================================================ +// Declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// +// Enumerations +// +// ---------------------------------------------------------------------------- + +enum wxMediaState +{ + wxMEDIASTATE_STOPPED, + wxMEDIASTATE_PAUSED, + wxMEDIASTATE_PLAYING +}; + +enum wxMediaCtrlPlayerControls +{ + wxMEDIACTRLPLAYERCONTROLS_NONE = 0, + //Step controls like fastforward, step one frame etc. + wxMEDIACTRLPLAYERCONTROLS_STEP = 1 << 0, + //Volume controls like the speaker icon, volume slider, etc. + wxMEDIACTRLPLAYERCONTROLS_VOLUME = 1 << 1, + wxMEDIACTRLPLAYERCONTROLS_DEFAULT = + wxMEDIACTRLPLAYERCONTROLS_STEP | + wxMEDIACTRLPLAYERCONTROLS_VOLUME +}; + +#define wxMEDIABACKEND_DIRECTSHOW wxT("wxAMMediaBackend") +#define wxMEDIABACKEND_MCI wxT("wxMCIMediaBackend") +#define wxMEDIABACKEND_QUICKTIME wxT("wxQTMediaBackend") +#define wxMEDIABACKEND_GSTREAMER wxT("wxGStreamerMediaBackend") +#define wxMEDIABACKEND_REALPLAYER wxT("wxRealPlayerMediaBackend") +#define wxMEDIABACKEND_WMP10 wxT("wxWMP10MediaBackend") + +// ---------------------------------------------------------------------------- +// +// wxMediaEvent +// +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_MEDIA wxMediaEvent : public wxNotifyEvent +{ +public: + // ------------------------------------------------------------------------ + // wxMediaEvent Constructor + // + // Normal constructor, much the same as wxNotifyEvent + // ------------------------------------------------------------------------ + wxMediaEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) + : wxNotifyEvent(commandType, winid) + { } + + // ------------------------------------------------------------------------ + // wxMediaEvent Copy Constructor + // + // Normal copy constructor, much the same as wxNotifyEvent + // ------------------------------------------------------------------------ + wxMediaEvent(const wxMediaEvent &clone) + : wxNotifyEvent(clone) + { } + + // ------------------------------------------------------------------------ + // wxMediaEvent::Clone + // + // Allocates a copy of this object. + // Required for wxEvtHandler::AddPendingEvent + // ------------------------------------------------------------------------ + virtual wxEvent *Clone() const wxOVERRIDE + { return new wxMediaEvent(*this); } + + + // Put this class on wxWidget's RTTI table + wxDECLARE_DYNAMIC_CLASS(wxMediaEvent); +}; + +// ---------------------------------------------------------------------------- +// +// wxMediaCtrl +// +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_MEDIA wxMediaCtrl : public wxControl +{ +public: + wxMediaCtrl() : m_imp(NULL), m_bLoaded(false) + { } + + wxMediaCtrl(wxWindow* parent, wxWindowID winid, + const wxString& fileName = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& szBackend = wxEmptyString, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxT("mediaCtrl")) + : m_imp(NULL), m_bLoaded(false) + { Create(parent, winid, fileName, pos, size, style, + szBackend, validator, name); } + + wxMediaCtrl(wxWindow* parent, wxWindowID winid, + const wxURI& location, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& szBackend = wxEmptyString, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxT("mediaCtrl")) + : m_imp(NULL), m_bLoaded(false) + { Create(parent, winid, location, pos, size, style, + szBackend, validator, name); } + + virtual ~wxMediaCtrl(); + + bool Create(wxWindow* parent, wxWindowID winid, + const wxString& fileName = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& szBackend = wxEmptyString, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxT("mediaCtrl")); + + bool Create(wxWindow* parent, wxWindowID winid, + const wxURI& location, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& szBackend = wxEmptyString, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxT("mediaCtrl")); + + bool DoCreate(const wxClassInfo* instance, + wxWindow* parent, wxWindowID winid, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxT("mediaCtrl")); + + bool Play(); + bool Pause(); + bool Stop(); + + bool Load(const wxString& fileName); + + wxMediaState GetState(); + + wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart); + wxFileOffset Tell(); //FIXME: This should be const + wxFileOffset Length(); //FIXME: This should be const + + double GetPlaybackRate(); //All but MCI & GStreamer + bool SetPlaybackRate(double dRate); //All but MCI & GStreamer + + bool Load(const wxURI& location); + bool Load(const wxURI& location, const wxURI& proxy); + + wxFileOffset GetDownloadProgress(); // DirectShow only + wxFileOffset GetDownloadTotal(); // DirectShow only + + double GetVolume(); + bool SetVolume(double dVolume); + + bool ShowPlayerControls( + wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT); + + //helpers for the wxPython people + bool LoadURI(const wxString& fileName) + { return Load(wxURI(fileName)); } + bool LoadURIWithProxy(const wxString& fileName, const wxString& proxy) + { return Load(wxURI(fileName), wxURI(proxy)); } + +protected: + static const wxClassInfo* NextBackend(wxClassInfo::const_iterator* it); + + void OnMediaFinished(wxMediaEvent& evt); + virtual void DoMoveWindow(int x, int y, int w, int h) wxOVERRIDE; + wxSize DoGetBestSize() const wxOVERRIDE; + + class wxMediaBackend* m_imp; + bool m_bLoaded; + + wxDECLARE_DYNAMIC_CLASS(wxMediaCtrl); +}; + +// ---------------------------------------------------------------------------- +// +// wxMediaBackend +// +// Derive from this and use standard wxWidgets RTTI +// (wxDECLARE_DYNAMIC_CLASS and wxIMPLEMENT_CLASS) to make a backend +// for wxMediaCtrl. Backends are searched alphabetically - +// the one with the earliest letter is tried first. +// +// Note that this is currently not API or ABI compatible - +// so statically link or make the client compile on-site. +// +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_MEDIA wxMediaBackend : public wxObject +{ +public: + wxMediaBackend() + { } + + virtual ~wxMediaBackend(); + + virtual bool CreateControl(wxControl* WXUNUSED(ctrl), + wxWindow* WXUNUSED(parent), + wxWindowID WXUNUSED(winid), + const wxPoint& WXUNUSED(pos), + const wxSize& WXUNUSED(size), + long WXUNUSED(style), + const wxValidator& WXUNUSED(validator), + const wxString& WXUNUSED(name)) + { return false; } + + virtual bool Play() + { return false; } + virtual bool Pause() + { return false; } + virtual bool Stop() + { return false; } + + virtual bool Load(const wxString& WXUNUSED(fileName)) + { return false; } + virtual bool Load(const wxURI& WXUNUSED(location)) + { return false; } + + virtual bool SetPosition(wxLongLong WXUNUSED(where)) + { return 0; } + virtual wxLongLong GetPosition() + { return 0; } + virtual wxLongLong GetDuration() + { return 0; } + + virtual void Move(int WXUNUSED(x), int WXUNUSED(y), + int WXUNUSED(w), int WXUNUSED(h)) + { } + virtual wxSize GetVideoSize() const + { return wxSize(0,0); } + + virtual double GetPlaybackRate() + { return 0.0; } + virtual bool SetPlaybackRate(double WXUNUSED(dRate)) + { return false; } + + virtual wxMediaState GetState() + { return wxMEDIASTATE_STOPPED; } + + virtual double GetVolume() + { return 0.0; } + virtual bool SetVolume(double WXUNUSED(dVolume)) + { return false; } + + virtual bool Load(const wxURI& WXUNUSED(location), + const wxURI& WXUNUSED(proxy)) + { return false; } + + virtual bool ShowPlayerControls( + wxMediaCtrlPlayerControls WXUNUSED(flags)) + { return false; } + virtual bool IsInterfaceShown() + { return false; } + + virtual wxLongLong GetDownloadProgress() + { return 0; } + virtual wxLongLong GetDownloadTotal() + { return 0; } + + virtual void MacVisibilityChanged() + { } + virtual void RESERVED9() {} + + wxDECLARE_DYNAMIC_CLASS(wxMediaBackend); +}; + + +//Our events +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_FINISHED, wxMediaEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_STOP, wxMediaEvent ); + +//Function type(s) our events need +typedef void (wxEvtHandler::*wxMediaEventFunction)(wxMediaEvent&); + +#define wxMediaEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxMediaEventFunction, func) + +//Macro for usage with message maps +#define EVT_MEDIA_FINISHED(winid, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_FINISHED, winid, wxID_ANY, wxMediaEventHandler(fn), NULL ), +#define EVT_MEDIA_STOP(winid, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_STOP, winid, wxID_ANY, wxMediaEventHandler(fn), NULL ), + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_LOADED, wxMediaEvent ); +#define EVT_MEDIA_LOADED(winid, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_LOADED, winid, wxID_ANY, wxMediaEventHandler(fn), NULL ), + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_STATECHANGED, wxMediaEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_PLAY, wxMediaEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_PAUSE, wxMediaEvent ); +#define EVT_MEDIA_STATECHANGED(winid, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_STATECHANGED, winid, wxID_ANY, wxMediaEventHandler(fn), NULL ), +#define EVT_MEDIA_PLAY(winid, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_PLAY, winid, wxID_ANY, wxMediaEventHandler(fn), NULL ), +#define EVT_MEDIA_PAUSE(winid, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_PAUSE, winid, wxID_ANY, wxMediaEventHandler(fn), NULL ), + +// ---------------------------------------------------------------------------- +// common backend base class used by many other backends +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_MEDIA wxMediaBackendCommonBase : public wxMediaBackend +{ +public: + // add a pending wxMediaEvent of the given type + void QueueEvent(wxEventType evtType); + + // notify that the movie playback is finished + void QueueFinishEvent() + { + QueueEvent(wxEVT_MEDIA_STATECHANGED); + QueueEvent(wxEVT_MEDIA_FINISHED); + } + + // send the stop event and return true if it hasn't been vetoed + bool SendStopEvent(); + + // Queue pause event + void QueuePlayEvent(); + + // Queue pause event + void QueuePauseEvent(); + + // Queue stop event (no veto) + void QueueStopEvent(); + +protected: + // call this when the movie size has changed but not because it has just + // been loaded (in this case, call NotifyMovieLoaded() below) + void NotifyMovieSizeChanged(); + + // call this when the movie is fully loaded + void NotifyMovieLoaded(); + + + wxMediaCtrl *m_ctrl; // parent control +}; + +// ---------------------------------------------------------------------------- +// End compilation guard +// ---------------------------------------------------------------------------- +#endif // wxUSE_MEDIACTRL + +// ---------------------------------------------------------------------------- +// End header guard and header itself +// ---------------------------------------------------------------------------- +#endif // _WX_MEDIACTRL_H_ + + diff --git a/lib/wxWidgets/include/wx/memconf.h b/lib/wxWidgets/include/wx/memconf.h new file mode 100644 index 0000000..3dbec63 --- /dev/null +++ b/lib/wxWidgets/include/wx/memconf.h @@ -0,0 +1,53 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/memconf.h +// Purpose: wxMemoryConfig class: a wxConfigBase implementation which only +// stores the settings in memory (thus they are lost when the +// program terminates) +// Author: Vadim Zeitlin +// Modified by: +// Created: 22.01.00 +// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +/* + * NB: I don't see how this class may possibly be useful to the application + * program (as the settings are lost on program termination), but it is + * handy to have it inside wxWidgets. So for now let's say that this class + * is private and should only be used by wxWidgets itself - this might + * change in the future. + */ + +#ifndef _WX_MEMCONF_H_ +#define _WX_MEMCONF_H_ + +#if wxUSE_CONFIG + +#include "wx/fileconf.h" // the base class + +// ---------------------------------------------------------------------------- +// wxMemoryConfig: a config class which stores settings in non-persistent way +// ---------------------------------------------------------------------------- + +// notice that we inherit from wxFileConfig which already stores its data in +// memory and just disable file reading/writing - this is probably not optimal +// and might be changed in future as well (this class will always deriev from +// wxConfigBase though) +class wxMemoryConfig : public wxFileConfig +{ +public: + // default (and only) ctor + wxMemoryConfig() : wxFileConfig(wxEmptyString, // default app name + wxEmptyString, // default vendor name + wxEmptyString, // no local config file + wxEmptyString, // no system config file + 0) // don't use any files + { + } + + wxDECLARE_NO_COPY_CLASS(wxMemoryConfig); +}; + +#endif // wxUSE_CONFIG + +#endif // _WX_MEMCONF_H_ diff --git a/lib/wxWidgets/include/wx/memory.h b/lib/wxWidgets/include/wx/memory.h new file mode 100644 index 0000000..6749798 --- /dev/null +++ b/lib/wxWidgets/include/wx/memory.h @@ -0,0 +1,357 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/memory.h +// Purpose: Memory operations +// Author: Arthur Seaton, Julian Smart +// Modified by: +// Created: 29/01/98 +// Copyright: (c) 1998 Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MEMORY_H_ +#define _WX_MEMORY_H_ + +#include "wx/defs.h" +#include "wx/string.h" +#include "wx/msgout.h" + +#if wxUSE_MEMORY_TRACING || wxUSE_DEBUG_CONTEXT + +#include <stddef.h> + +WXDLLIMPEXP_BASE void * wxDebugAlloc(size_t size, wxChar * fileName, int lineNum, bool isObject, bool isVect = false); +WXDLLIMPEXP_BASE void wxDebugFree(void * buf, bool isVect = false); + +//********************************************************************************** +/* + The global operator new used for everything apart from getting + dynamic storage within this function itself. +*/ + +// We'll only do malloc and free for the moment: leave the interesting +// stuff for the wxObject versions. + + +#if wxUSE_GLOBAL_MEMORY_OPERATORS + +// Undefine temporarily (new is #defined in object.h) because we want to +// declare some new operators. +#ifdef new + #undef new +#endif + +#if defined(__SUNCC__) + #define wxUSE_ARRAY_MEMORY_OPERATORS 0 +#elif defined (__SGI_CC_) + // only supported by -n32 compilers + #ifndef __EDG_ABI_COMPATIBILITY_VERSION + #define wxUSE_ARRAY_MEMORY_OPERATORS 0 + #endif +#else + #define wxUSE_ARRAY_MEMORY_OPERATORS 1 +#endif + +// devik 2000-8-29: All new/delete ops are now inline because they can't +// be marked as dllexport/dllimport. It then leads to weird bugs when +// used on MSW as DLL +#if defined(__WINDOWS__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE)) +inline void * operator new (size_t size, wxChar * fileName, int lineNum) +{ + return wxDebugAlloc(size, fileName, lineNum, false, false); +} + +inline void * operator new (size_t size) +{ + return wxDebugAlloc(size, NULL, 0, false); +} + +inline void operator delete (void * buf) +{ + wxDebugFree(buf, false); +} + +#if wxUSE_ARRAY_MEMORY_OPERATORS +inline void * operator new[] (size_t size) +{ + return wxDebugAlloc(size, NULL, 0, false, true); +} + +inline void * operator new[] (size_t size, wxChar * fileName, int lineNum) +{ + return wxDebugAlloc(size, fileName, lineNum, false, true); +} + +inline void operator delete[] (void * buf) +{ + wxDebugFree(buf, true); +} +#endif // wxUSE_ARRAY_MEMORY_OPERATORS + +#else + +void * operator new (size_t size, wxChar * fileName, int lineNum); + +void * operator new (size_t size); + +void operator delete (void * buf); + +#if wxUSE_ARRAY_MEMORY_OPERATORS +void * operator new[] (size_t size); + +void * operator new[] (size_t size, wxChar * fileName, int lineNum); + +void operator delete[] (void * buf); +#endif // wxUSE_ARRAY_MEMORY_OPERATORS +#endif // defined(__WINDOWS__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE)) + +#if defined(__VISUALC__) +inline void operator delete(void* pData, wxChar* /* fileName */, int /* lineNum */) +{ + wxDebugFree(pData, false); +} +inline void operator delete[](void* pData, wxChar* /* fileName */, int /* lineNum */) +{ + wxDebugFree(pData, true); +} +#endif // __VISUALC__ +#endif // wxUSE_GLOBAL_MEMORY_OPERATORS + +//********************************************************************************** + +typedef unsigned int wxMarkerType; + +/* + Define the struct which will be placed at the start of all dynamically + allocated memory. +*/ + +class WXDLLIMPEXP_BASE wxMemStruct { + +friend class WXDLLIMPEXP_FWD_BASE wxDebugContext; // access to the m_next pointer for list traversal. + +public: +public: + int AssertList (); + + size_t RequestSize () { return m_reqSize; } + wxMarkerType Marker () { return m_firstMarker; } + + // When an object is deleted we set the id slot to a specific value. + inline void SetDeleted (); + inline int IsDeleted (); + + int Append (); + int Unlink (); + + // Used to determine if the object is really a wxMemStruct. + // Not a foolproof test by any means, but better than none I hope! + int AssertIt (); + + // Do all validation on a node. + int ValidateNode (); + + // Check the integrity of a node and of the list, node by node. + int CheckBlock (); + int CheckAllPrevious (); + + // Print a single node. + void PrintNode (); + + // Called when the memory linking functions get an error. + void ErrorMsg (const char *); + void ErrorMsg (); + + inline void *GetActualData(void) const { return m_actualData; } + + void Dump(void); + +public: + // Check for underwriting. There are 2 of these checks. This one + // inside the struct and another right after the struct. + wxMarkerType m_firstMarker; + + // File name and line number are from cpp. + wxChar* m_fileName; + int m_lineNum; + + // The amount of memory requested by the caller. + size_t m_reqSize; + + // Used to try to verify that we really are dealing with an object + // of the required class. Can be 1 of 2 values these indicating a valid + // wxMemStruct object, or a deleted wxMemStruct object. + wxMarkerType m_id; + + wxMemStruct * m_prev; + wxMemStruct * m_next; + + void * m_actualData; + bool m_isObject; +}; + + +typedef void (wxMemStruct::*PmSFV) (); + +// Type of the app function that can be installed and called at wxWidgets shutdown +// (after all other registered files with global destructors have been closed down). +typedef void (*wxShutdownNotifyFunction)(); + +/* + Debugging class. This will only have a single instance, but it's + a reasonable way to keep everything together and to make this + available for change if needed by someone else. + A lot of this stuff would be better off within the wxMemStruct class, but + it's stuff which we need to access at times when there is no wxMemStruct + object so we use this class instead. Think of it as a collection of + globals which have to do with the wxMemStruct class. +*/ + +class WXDLLIMPEXP_BASE wxDebugContext { + +protected: + // Used to set alignment for markers. + static size_t CalcAlignment (); + + // Returns the amount of padding needed after something of the given + // size. This is so that when we cast pointers backwards and forwards + // the pointer value will be valid for a wxMarkerType. + static size_t GetPadding (size_t size) ; + + // Traverse the list. + static void TraverseList (PmSFV, wxMemStruct *from = NULL); + + static int debugLevel; + static bool debugOn; + + static int m_balign; // byte alignment + static int m_balignmask; // mask for performing byte alignment +public: + // Set a checkpoint to dump only the memory from + // a given point + static wxMemStruct *checkPoint; + + wxDebugContext(void); + ~wxDebugContext(void); + + static int GetLevel(void) { return debugLevel; } + static void SetLevel(int level) { debugLevel = level; } + + static bool GetDebugMode(void) { return debugOn; } + static void SetDebugMode(bool flag) { debugOn = flag; } + + static void SetCheckpoint(bool all = false); + static wxMemStruct *GetCheckpoint(void) { return checkPoint; } + + // Calculated from the request size and any padding needed + // before the final marker. + static size_t PaddedSize (size_t reqSize); + + // Calc the total amount of space we need from the system + // to satisfy a caller request. This includes all padding. + static size_t TotSize (size_t reqSize); + + // Return valid pointers to offsets within the allocated memory. + static char * StructPos (const char * buf); + static char * MidMarkerPos (const char * buf); + static char * CallerMemPos (const char * buf); + static char * EndMarkerPos (const char * buf, size_t size); + + // Given a pointer to the start of the caller requested area + // return a pointer to the start of the entire alloc\'d buffer. + static char * StartPos (const char * caller); + + // Access to the list. + static wxMemStruct * GetHead () { return m_head; } + static wxMemStruct * GetTail () { return m_tail; } + + // Set the list sentinels. + static wxMemStruct * SetHead (wxMemStruct * st) { return (m_head = st); } + static wxMemStruct * SetTail (wxMemStruct * st) { return (m_tail = st); } + + // If this is set then every new operation checks the validity + // of the all previous nodes in the list. + static bool GetCheckPrevious () { return m_checkPrevious; } + static void SetCheckPrevious (bool value) { m_checkPrevious = value; } + + // Checks all nodes, or all nodes if checkAll is true + static int Check(bool checkAll = false); + + // Print out the list of wxMemStruct nodes. + static bool PrintList(void); + + // Dump objects + static bool Dump(void); + + // Print statistics + static bool PrintStatistics(bool detailed = true); + + // Print out the classes in the application. + static bool PrintClasses(void); + + // Count the number of non-wxDebugContext-related objects + // that are outstanding + static int CountObjectsLeft(bool sinceCheckpoint = false); + + // This function is used to output the dump + static void OutputDumpLine(const wxChar *szFormat, ...); + + static void SetShutdownNotifyFunction(wxShutdownNotifyFunction shutdownFn); + +private: + // Store these here to allow access to the list without + // needing to have a wxMemStruct object. + static wxMemStruct* m_head; + static wxMemStruct* m_tail; + + // Set to false if we're not checking all previous nodes when + // we do a new. Set to true when we are. + static bool m_checkPrevious; + + // Holds a pointer to an optional application function to call at shutdown. + static wxShutdownNotifyFunction sm_shutdownFn; + + // Have to access our shutdown hook + friend class wxDebugContextDumpDelayCounter; +}; + +// Final cleanup (e.g. deleting the log object and doing memory leak checking) +// will be delayed until all wxDebugContextDumpDelayCounter objects have been +// destructed. Adding one wxDebugContextDumpDelayCounter per file will delay +// memory leak checking until after destructing all global objects. + +class WXDLLIMPEXP_BASE wxDebugContextDumpDelayCounter +{ +public: + wxDebugContextDumpDelayCounter(); + ~wxDebugContextDumpDelayCounter(); + +private: + void DoDump(); + static int sm_count; +}; + +// make leak dump after all globals have been destructed +static wxDebugContextDumpDelayCounter wxDebugContextDumpDelayCounter_File; +#define WXDEBUG_DUMPDELAYCOUNTER \ + static wxDebugContextDumpDelayCounter wxDebugContextDumpDelayCounter_Extra; + +// Output a debug message, in a system dependent fashion. +void WXDLLIMPEXP_BASE wxTrace(const wxChar *fmt ...) WX_ATTRIBUTE_PRINTF_1; +void WXDLLIMPEXP_BASE wxTraceLevel(int level, const wxChar *fmt ...) WX_ATTRIBUTE_PRINTF_2; + +#define WXTRACE wxTrace +#define WXTRACELEVEL wxTraceLevel + +#else // wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT + +#define WXDEBUG_DUMPDELAYCOUNTER + +#define wxTrace(fmt) +#define wxTraceLevel(l, fmt) + +#define WXTRACE true ? (void)0 : wxTrace +#define WXTRACELEVEL true ? (void)0 : wxTraceLevel + +#endif // wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT + +#endif // _WX_MEMORY_H_ diff --git a/lib/wxWidgets/include/wx/memtext.h b/lib/wxWidgets/include/wx/memtext.h new file mode 100644 index 0000000..86ff776 --- /dev/null +++ b/lib/wxWidgets/include/wx/memtext.h @@ -0,0 +1,54 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/memtext.h +// Purpose: wxMemoryText allows to use wxTextBuffer without a file +// Created: 14.11.01 +// Author: Morten Hanssen +// Copyright: (c) 2001 Morten Hanssen +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MEMTEXT_H +#define _WX_MEMTEXT_H + +#include "wx/defs.h" + +// there is no separate setting for wxMemoryText, it's smallish anyhow +#if wxUSE_TEXTBUFFER + +// ---------------------------------------------------------------------------- +// wxMemoryText +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMemoryText : public wxTextBuffer +{ +public: + // Constructors. + wxMemoryText() { } + wxMemoryText(const wxString& name) : wxTextBuffer(name) { } + +protected: + virtual bool OnExists() const wxOVERRIDE + { return false; } + + virtual bool OnOpen(const wxString & WXUNUSED(strBufferName), + wxTextBufferOpenMode WXUNUSED(OpenMode)) wxOVERRIDE + { return true; } + + virtual bool OnClose() wxOVERRIDE + { return true; } + + virtual bool OnRead(const wxMBConv& WXUNUSED(conv)) wxOVERRIDE + { return true; } + + virtual bool OnWrite(wxTextFileType WXUNUSED(typeNew), + const wxMBConv& WXUNUSED(conv) = wxMBConvUTF8()) wxOVERRIDE + { return true; } + +private: + wxDECLARE_NO_COPY_CLASS(wxMemoryText); +}; + +#endif // wxUSE_TEXTBUFFER + +#endif // _WX_MEMTEXT_H + diff --git a/lib/wxWidgets/include/wx/menu.h b/lib/wxWidgets/include/wx/menu.h new file mode 100644 index 0000000..2236049 --- /dev/null +++ b/lib/wxWidgets/include/wx/menu.h @@ -0,0 +1,648 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/menu.h +// Purpose: wxMenu and wxMenuBar classes +// Author: Vadim Zeitlin +// Modified by: +// Created: 26.10.99 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MENU_H_BASE_ +#define _WX_MENU_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_MENUS + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/list.h" // for "template" list classes +#include "wx/window.h" // base class for wxMenuBar + +// also include this one to ensure compatibility with old code which only +// included wx/menu.h +#include "wx/menuitem.h" + +class WXDLLIMPEXP_FWD_CORE wxFrame; +class WXDLLIMPEXP_FWD_CORE wxMenu; +class WXDLLIMPEXP_FWD_CORE wxMenuBarBase; +class WXDLLIMPEXP_FWD_CORE wxMenuBar; +class WXDLLIMPEXP_FWD_CORE wxMenuItem; + +// pseudo template list classes +WX_DECLARE_EXPORTED_LIST(wxMenu, wxMenuList); +WX_DECLARE_EXPORTED_LIST(wxMenuItem, wxMenuItemList); + +// ---------------------------------------------------------------------------- +// wxMenu +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMenuBase : public wxEvtHandler +{ +public: + // create a menu + static wxMenu *New(const wxString& title = wxEmptyString, long style = 0); + + // ctors + wxMenuBase(const wxString& title, long style = 0) : m_title(title) + { Init(style); } + wxMenuBase(long style = 0) + { Init(style); } + + // dtor deletes all the menu items we own + virtual ~wxMenuBase(); + + // menu construction + // ----------------- + + // append any kind of item (normal/check/radio/separator) + wxMenuItem* Append(int itemid, + const wxString& text = wxEmptyString, + const wxString& help = wxEmptyString, + wxItemKind kind = wxITEM_NORMAL) + { + return DoAppend(wxMenuItem::New((wxMenu *)this, itemid, text, help, kind)); + } + + // append a separator to the menu + wxMenuItem* AppendSeparator() { return Append(wxID_SEPARATOR); } + + // append a check item + wxMenuItem* AppendCheckItem(int itemid, + const wxString& text, + const wxString& help = wxEmptyString) + { + return Append(itemid, text, help, wxITEM_CHECK); + } + + // append a radio item + wxMenuItem* AppendRadioItem(int itemid, + const wxString& text, + const wxString& help = wxEmptyString) + { + return Append(itemid, text, help, wxITEM_RADIO); + } + + // append a submenu + wxMenuItem* AppendSubMenu(wxMenu *submenu, + const wxString& text, + const wxString& help = wxEmptyString) + { + return DoAppend(wxMenuItem::New((wxMenu *)this, wxID_ANY, text, help, + wxITEM_NORMAL, submenu)); + } + + // the most generic form of Append() - append anything + wxMenuItem* Append(wxMenuItem *item) { return DoAppend(item); } + + // insert a break in the menu (only works when appending the items, not + // inserting them) + virtual void Break() { } + + // insert an item before given position + wxMenuItem* Insert(size_t pos, wxMenuItem *item); + + // insert an item before given position + wxMenuItem* Insert(size_t pos, + int itemid, + const wxString& text = wxEmptyString, + const wxString& help = wxEmptyString, + wxItemKind kind = wxITEM_NORMAL) + { + return Insert(pos, wxMenuItem::New((wxMenu *)this, itemid, text, help, kind)); + } + + // insert a separator + wxMenuItem* InsertSeparator(size_t pos) + { + return Insert(pos, wxMenuItem::New((wxMenu *)this, wxID_SEPARATOR)); + } + + // insert a check item + wxMenuItem* InsertCheckItem(size_t pos, + int itemid, + const wxString& text, + const wxString& help = wxEmptyString) + { + return Insert(pos, itemid, text, help, wxITEM_CHECK); + } + + // insert a radio item + wxMenuItem* InsertRadioItem(size_t pos, + int itemid, + const wxString& text, + const wxString& help = wxEmptyString) + { + return Insert(pos, itemid, text, help, wxITEM_RADIO); + } + + // insert a submenu + wxMenuItem* Insert(size_t pos, + int itemid, + const wxString& text, + wxMenu *submenu, + const wxString& help = wxEmptyString) + { + return Insert(pos, wxMenuItem::New((wxMenu *)this, itemid, text, help, + wxITEM_NORMAL, submenu)); + } + + // prepend an item to the menu + wxMenuItem* Prepend(wxMenuItem *item) + { + return Insert(0u, item); + } + + // prepend any item to the menu + wxMenuItem* Prepend(int itemid, + const wxString& text = wxEmptyString, + const wxString& help = wxEmptyString, + wxItemKind kind = wxITEM_NORMAL) + { + return Insert(0u, itemid, text, help, kind); + } + + // prepend a separator + wxMenuItem* PrependSeparator() + { + return InsertSeparator(0u); + } + + // prepend a check item + wxMenuItem* PrependCheckItem(int itemid, + const wxString& text, + const wxString& help = wxEmptyString) + { + return InsertCheckItem(0u, itemid, text, help); + } + + // prepend a radio item + wxMenuItem* PrependRadioItem(int itemid, + const wxString& text, + const wxString& help = wxEmptyString) + { + return InsertRadioItem(0u, itemid, text, help); + } + + // prepend a submenu + wxMenuItem* Prepend(int itemid, + const wxString& text, + wxMenu *submenu, + const wxString& help = wxEmptyString) + { + return Insert(0u, itemid, text, submenu, help); + } + + // detach an item from the menu, but don't delete it so that it can be + // added back later (but if it's not, the caller is responsible for + // deleting it!) + wxMenuItem *Remove(int itemid) { return Remove(FindChildItem(itemid)); } + wxMenuItem *Remove(wxMenuItem *item); + + // delete an item from the menu (submenus are not destroyed by this + // function, see Destroy) + bool Delete(int itemid) { return Delete(FindChildItem(itemid)); } + bool Delete(wxMenuItem *item); + + // delete the item from menu and destroy it (if it's a submenu) + bool Destroy(int itemid) { return Destroy(FindChildItem(itemid)); } + bool Destroy(wxMenuItem *item); + + // menu items access + // ----------------- + + // get the items + size_t GetMenuItemCount() const { return m_items.GetCount(); } + + const wxMenuItemList& GetMenuItems() const { return m_items; } + wxMenuItemList& GetMenuItems() { return m_items; } + + // search + virtual int FindItem(const wxString& item) const; + wxMenuItem* FindItem(int itemid, wxMenu **menu = NULL) const; + + // find by position + wxMenuItem* FindItemByPosition(size_t position) const; + + // get/set items attributes + void Enable(int itemid, bool enable); + bool IsEnabled(int itemid) const; + + void Check(int itemid, bool check); + bool IsChecked(int itemid) const; + + void SetLabel(int itemid, const wxString& label); + wxString GetLabel(int itemid) const; + + // Returns the stripped label + wxString GetLabelText(int itemid) const { return wxMenuItem::GetLabelText(GetLabel(itemid)); } + + virtual void SetHelpString(int itemid, const wxString& helpString); + virtual wxString GetHelpString(int itemid) const; + + // misc accessors + // -------------- + + // the title + virtual void SetTitle(const wxString& title) { m_title = title; } + const wxString& GetTitle() const { return m_title; } + + // event handler + void SetEventHandler(wxEvtHandler *handler) { m_eventHandler = handler; } + wxEvtHandler *GetEventHandler() const { return m_eventHandler; } + + // Invoking window: this is set by wxWindow::PopupMenu() before showing a + // popup menu and reset after it's hidden. Notice that you probably want to + // use GetWindow() below instead of GetInvokingWindow() as the latter only + // returns non-NULL for the top level menus + // + // NB: avoid calling SetInvokingWindow() directly if possible, use + // wxMenuInvokingWindowSetter class below instead + virtual void SetInvokingWindow(wxWindow *win); + wxWindow *GetInvokingWindow() const { return m_invokingWindow; } + + // the window associated with this menu: this is the invoking window for + // popup menus or the top level window to which the menu bar is attached + // for menus which are part of a menu bar + wxWindow *GetWindow() const; + + // style + long GetStyle() const { return m_style; } + + // implementation helpers + // ---------------------- + + // Updates the UI for a menu and all submenus recursively by generating + // wxEVT_UPDATE_UI for all the items. + // + // Do not use the "source" argument, it allows to override the event + // handler to use for these events, but this should never be needed. + void UpdateUI(wxEvtHandler* source = NULL); + +#if wxUSE_MENUBAR + // get the menu bar this menu is attached to (may be NULL, always NULL for + // popup menus). Traverse up the menu hierarchy to find it. + wxMenuBar *GetMenuBar() const; + + // called when the menu is attached/detached to/from a menu bar + virtual void Attach(wxMenuBarBase *menubar); + virtual void Detach(); + + // is the menu attached to a menu bar (or is it a popup one)? + bool IsAttached() const { return GetMenuBar() != NULL; } +#endif + + // set/get the parent of this menu + void SetParent(wxMenu *parent) { m_menuParent = parent; } + wxMenu *GetParent() const { return m_menuParent; } + + // implementation only from now on + // ------------------------------- + + // unlike FindItem(), this function doesn't recurse but only looks through + // our direct children and also may return the index of the found child if + // pos != NULL + wxMenuItem *FindChildItem(int itemid, size_t *pos = NULL) const; + + // called to generate a wxCommandEvent, return true if it was processed, + // false otherwise + // + // the checked parameter may have boolean value or -1 for uncheckable items + bool SendEvent(int itemid, int checked = -1); + + // called to dispatch a wxMenuEvent to the right recipients, menu pointer + // can be NULL if we failed to find the associated menu (this happens at + // least in wxMSW for the events from the system menus) + static + bool ProcessMenuEvent(wxMenu* menu, wxMenuEvent& event, wxWindow* win); + + + // compatibility: these functions are deprecated, use the new ones instead + // ----------------------------------------------------------------------- + + // use the versions taking wxItem_XXX now instead, they're more readable + // and allow adding the radio items as well + void Append(int itemid, + const wxString& text, + const wxString& help, + bool isCheckable) + { + Append(itemid, text, help, isCheckable ? wxITEM_CHECK : wxITEM_NORMAL); + } + + // use more readable and not requiring unused itemid AppendSubMenu() instead + wxMenuItem* Append(int itemid, + const wxString& text, + wxMenu *submenu, + const wxString& help = wxEmptyString) + { + return DoAppend(wxMenuItem::New((wxMenu *)this, itemid, text, help, + wxITEM_NORMAL, submenu)); + } + + void Insert(size_t pos, + int itemid, + const wxString& text, + const wxString& help, + bool isCheckable) + { + Insert(pos, itemid, text, help, isCheckable ? wxITEM_CHECK : wxITEM_NORMAL); + } + + void Prepend(int itemid, + const wxString& text, + const wxString& help, + bool isCheckable) + { + Insert(0u, itemid, text, help, isCheckable); + } + + static void LockAccels(bool locked) + { + ms_locked = locked; + } + +protected: + // virtuals to override in derived classes + // --------------------------------------- + + virtual wxMenuItem* DoAppend(wxMenuItem *item); + virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item); + + virtual wxMenuItem *DoRemove(wxMenuItem *item); + virtual bool DoDelete(wxMenuItem *item); + virtual bool DoDestroy(wxMenuItem *item); + + // helpers + // ------- + + // common part of all ctors + void Init(long style); + + // associate the submenu with this menu + void AddSubMenu(wxMenu *submenu); + + wxMenuBar *m_menuBar; // menubar we belong to or NULL + wxMenu *m_menuParent; // parent menu or NULL + + wxString m_title; // the menu title or label + wxMenuItemList m_items; // the list of menu items + + wxWindow *m_invokingWindow; // for popup menus + + long m_style; // combination of wxMENU_XXX flags + + wxEvtHandler *m_eventHandler; // a pluggable in event handler + + static bool ms_locked; + + +protected: + // Common part of SendEvent() and ProcessMenuEvent(): sends the event to + // its intended recipients, returns true if it was processed. + static bool DoProcessEvent(wxMenuBase* menu, wxEvent& event, wxWindow* win); + + wxDECLARE_NO_COPY_CLASS(wxMenuBase); +}; + +#if wxUSE_EXTENDED_RTTI + +// ---------------------------------------------------------------------------- +// XTI accessor +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxMenuInfoHelper : public wxObject +{ +public: + wxMenuInfoHelper() { m_menu = NULL; } + virtual ~wxMenuInfoHelper() { } + + bool Create( wxMenu *menu, const wxString &title ) + { + m_menu = menu; + m_title = title; + return true; + } + + wxMenu* GetMenu() const { return m_menu; } + wxString GetTitle() const { return m_title; } + +private: + wxMenu *m_menu; + wxString m_title; + + wxDECLARE_DYNAMIC_CLASS(wxMenuInfoHelper); +}; + +WX_DECLARE_EXPORTED_LIST(wxMenuInfoHelper, wxMenuInfoHelperList ); + +#endif + +// ---------------------------------------------------------------------------- +// wxMenuBar +// ---------------------------------------------------------------------------- + +#if wxUSE_MENUBAR + +class WXDLLIMPEXP_CORE wxMenuBarBase : public wxWindow +{ +public: + // default ctor + wxMenuBarBase(); + + // dtor will delete all menus we own + virtual ~wxMenuBarBase(); + + // menu bar construction + // --------------------- + + // append a menu to the end of menubar, return true if ok + virtual bool Append(wxMenu *menu, const wxString& title); + + // insert a menu before the given position into the menubar, return true + // if inserted ok + virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title); + + // menu bar items access + // --------------------- + + // get the number of menus in the menu bar + size_t GetMenuCount() const { return m_menus.GetCount(); } + + // get the menu at given position + wxMenu *GetMenu(size_t pos) const; + + // replace the menu at given position with another one, returns the + // previous menu (which should be deleted by the caller) + virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title); + + // delete the menu at given position from the menu bar, return the pointer + // to the menu (which should be deleted by the caller) + virtual wxMenu *Remove(size_t pos); + + // enable or disable a submenu + virtual void EnableTop(size_t pos, bool enable) = 0; + + // is the menu enabled? + virtual bool IsEnabledTop(size_t WXUNUSED(pos)) const { return true; } + + // get or change the label of the menu at given position + virtual void SetMenuLabel(size_t pos, const wxString& label) = 0; + virtual wxString GetMenuLabel(size_t pos) const = 0; + + // get the stripped label of the menu at given position + virtual wxString GetMenuLabelText(size_t pos) const { return wxMenuItem::GetLabelText(GetMenuLabel(pos)); } + + // item search + // ----------- + + // by menu and item names, returns wxNOT_FOUND if not found or id of the + // found item + virtual int FindMenuItem(const wxString& menu, const wxString& item) const; + + // find item by id (in any menu), returns NULL if not found + // + // if menu is !NULL, it will be filled with wxMenu this item belongs to + virtual wxMenuItem* FindItem(int itemid, wxMenu **menu = NULL) const; + + // find menu by its caption, return wxNOT_FOUND on failure + int FindMenu(const wxString& title) const; + + // item access + // ----------- + + // all these functions just use FindItem() and then call an appropriate + // method on it + // + // NB: under MSW, these methods can only be used after the menubar had + // been attached to the frame + + void Enable(int itemid, bool enable); + void Check(int itemid, bool check); + bool IsChecked(int itemid) const; + bool IsEnabled(int itemid) const; + virtual bool IsEnabled() const { return wxWindow::IsEnabled(); } + + void SetLabel(int itemid, const wxString &label); + wxString GetLabel(int itemid) const; + + void SetHelpString(int itemid, const wxString& helpString); + wxString GetHelpString(int itemid) const; + + // implementation helpers + + // get the frame we are attached to (may return NULL) + wxFrame *GetFrame() const { return m_menuBarFrame; } + + // returns true if we're attached to a frame + bool IsAttached() const { return GetFrame() != NULL; } + + // associate the menubar with the frame + virtual void Attach(wxFrame *frame); + + // called before deleting the menubar normally + virtual void Detach(); + + // need to override these ones to avoid virtual function hiding + virtual bool Enable(bool enable = true) wxOVERRIDE { return wxWindow::Enable(enable); } + virtual void SetLabel(const wxString& s) wxOVERRIDE { wxWindow::SetLabel(s); } + virtual wxString GetLabel() const wxOVERRIDE { return wxWindow::GetLabel(); } + + // don't want menu bars to accept the focus by tabbing to them + virtual bool AcceptsFocusFromKeyboard() const wxOVERRIDE { return false; } + + // update all menu item states in all menus + virtual void UpdateMenus(); + + virtual bool CanBeOutsideClientArea() const wxOVERRIDE { return true; } + +#if wxUSE_EXTENDED_RTTI + // XTI helpers: + bool AppendMenuInfo( const wxMenuInfoHelper *info ) + { return Append( info->GetMenu(), info->GetTitle() ); } + const wxMenuInfoHelperList& GetMenuInfos() const; +#endif + +#if WXWIN_COMPATIBILITY_2_8 + // get or change the label of the menu at given position + // Deprecated in favour of SetMenuLabel + wxDEPRECATED( void SetLabelTop(size_t pos, const wxString& label) ); + // Deprecated in favour of GetMenuLabelText + wxDEPRECATED( wxString GetLabelTop(size_t pos) const ); +#endif + +protected: + // the list of all our menus + wxMenuList m_menus; + +#if wxUSE_EXTENDED_RTTI + // used by XTI + wxMenuInfoHelperList m_menuInfos; +#endif + + // the frame we are attached to (may be NULL) + wxFrame *m_menuBarFrame; + + wxDECLARE_NO_COPY_CLASS(wxMenuBarBase); +}; +#endif + +// ---------------------------------------------------------------------------- +// include the real class declaration +// ---------------------------------------------------------------------------- + +#ifdef wxUSE_BASE_CLASSES_ONLY + #define wxMenuItem wxMenuItemBase +#else // !wxUSE_BASE_CLASSES_ONLY +#if defined(__WXUNIVERSAL__) + #include "wx/univ/menu.h" +#elif defined(__WXMSW__) + #include "wx/msw/menu.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/menu.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/menu.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/menu.h" +#elif defined(__WXMAC__) + #include "wx/osx/menu.h" +#elif defined(__WXQT__) + #include "wx/qt/menu.h" +#endif +#endif // wxUSE_BASE_CLASSES_ONLY/!wxUSE_BASE_CLASSES_ONLY + +// ---------------------------------------------------------------------------- +// Helper class used in the implementation only: sets the invoking window of +// the given menu in its ctor and resets it in dtor. +// ---------------------------------------------------------------------------- + +class wxMenuInvokingWindowSetter +{ +public: + // Ctor sets the invoking window for the given menu. + // + // The menu lifetime must be greater than that of this class. + wxMenuInvokingWindowSetter(wxMenu& menu, wxWindow *win) + : m_menu(menu) + { + menu.SetInvokingWindow(win); + } + + // Dtor resets the invoking window. + ~wxMenuInvokingWindowSetter() + { + m_menu.SetInvokingWindow(NULL); + } + +private: + wxMenu& m_menu; + + wxDECLARE_NO_COPY_CLASS(wxMenuInvokingWindowSetter); +}; + +#endif // wxUSE_MENUS + +#endif // _WX_MENU_H_BASE_ diff --git a/lib/wxWidgets/include/wx/menuitem.h b/lib/wxWidgets/include/wx/menuitem.h new file mode 100644 index 0000000..2a66087 --- /dev/null +++ b/lib/wxWidgets/include/wx/menuitem.h @@ -0,0 +1,249 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/menuitem.h +// Purpose: wxMenuItem class +// Author: Vadim Zeitlin +// Modified by: +// Created: 25.10.99 +// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MENUITEM_H_BASE_ +#define _WX_MENUITEM_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_MENUS + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/object.h" // base class + +#include "wx/bmpbndl.h" + +#include "wx/windowid.h" + +#include "wx/vector.h" + +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- + +#if wxUSE_ACCEL +class WXDLLIMPEXP_FWD_CORE wxAcceleratorEntry; +#endif // wxUSE_ACCEL +class WXDLLIMPEXP_FWD_CORE wxMenuItem; +class WXDLLIMPEXP_FWD_CORE wxMenu; + +// ---------------------------------------------------------------------------- +// wxMenuItem is an item in the menu which may be either a normal item, a sub +// menu or a separator +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMenuItemBase : public wxObject +{ +public: + // creation + static wxMenuItem *New(wxMenu *parentMenu = NULL, + int itemid = wxID_SEPARATOR, + const wxString& text = wxEmptyString, + const wxString& help = wxEmptyString, + wxItemKind kind = wxITEM_NORMAL, + wxMenu *subMenu = NULL); + + // destruction: wxMenuItem will delete its submenu + virtual ~wxMenuItemBase(); + + // the menu we're in + wxMenu *GetMenu() const { return m_parentMenu; } + void SetMenu(wxMenu* menu) { m_parentMenu = menu; } + + // get/set id + void SetId(int itemid) { m_id = itemid; } + int GetId() const { return m_id; } + + // the item's text (or name) + // + // NB: the item's label includes the accelerators and mnemonics info (if + // any), i.e. it may contain '&' or '_' or "\t..." and thus is + // different from the item's text which only contains the text shown + // in the menu. This used to be called SetText. + virtual void SetItemLabel(const wxString& str); + + // return the item label including any mnemonics and accelerators. + // This used to be called GetText. + virtual wxString GetItemLabel() const { return m_text; } + + // return just the text of the item label, without any mnemonics + // This used to be called GetLabel. + virtual wxString GetItemLabelText() const { return GetLabelText(m_text); } + + // return just the text part of the given label (implemented in platform-specific code) + // This used to be called GetLabelFromText. + static wxString GetLabelText(const wxString& label); + + // what kind of menu item we are + wxItemKind GetKind() const { return m_kind; } + void SetKind(wxItemKind kind) { m_kind = kind; } + bool IsSeparator() const { return m_kind == wxITEM_SEPARATOR; } + + bool IsCheck() const { return m_kind == wxITEM_CHECK; } + bool IsRadio() const { return m_kind == wxITEM_RADIO; } + + virtual void SetCheckable(bool checkable) + { m_kind = checkable ? wxITEM_CHECK : wxITEM_NORMAL; } + + // Notice that this doesn't quite match SetCheckable(). + bool IsCheckable() const + { return m_kind == wxITEM_CHECK || m_kind == wxITEM_RADIO; } + + bool IsSubMenu() const { return m_subMenu != NULL; } + void SetSubMenu(wxMenu *menu) { m_subMenu = menu; } + wxMenu *GetSubMenu() const { return m_subMenu; } + + // state + virtual void Enable(bool enable = true) { m_isEnabled = enable; } + virtual bool IsEnabled() const { return m_isEnabled; } + + virtual void Check(bool check = true) { m_isChecked = check; } + virtual bool IsChecked() const { return m_isChecked; } + void Toggle() { Check(!m_isChecked); } + + // help string (displayed in the status bar by default) + void SetHelp(const wxString& str); + const wxString& GetHelp() const { return m_help; } + + // bitmap-related functions + + virtual void SetBitmap(const wxBitmapBundle& bmp); + wxBitmapBundle GetBitmapBundle() const { return m_bitmap; } + + // This method only exists for compatibility, prefer using + // GetBitmapBundle() in the new code. + virtual wxBitmap GetBitmap() const; + +#if wxUSE_ACCEL + // extract the accelerator from the given menu string, return NULL if none + // found + static wxAcceleratorEntry *GetAccelFromString(const wxString& label); + + // get our accelerator or NULL (caller must delete the pointer) + virtual wxAcceleratorEntry *GetAccel() const; + + // set the accel for this item - this may also be done indirectly with + // SetText() + virtual void SetAccel(wxAcceleratorEntry *accel); + + // add the accel to extra accels list + virtual void AddExtraAccel(const wxAcceleratorEntry& accel); + + // return vector of extra accels. Implementation only. + const wxVector<wxAcceleratorEntry>& GetExtraAccels() const { return m_extraAccels; } + + virtual void ClearExtraAccels(); +#endif // wxUSE_ACCEL + +#if WXWIN_COMPATIBILITY_2_8 + // compatibility only, use new functions in the new code + wxDEPRECATED( void SetName(const wxString& str) ); + wxDEPRECATED( wxString GetName() const ); + + // Now use GetItemLabelText + wxDEPRECATED( wxString GetLabel() const ) ; + + // Now use GetItemLabel + wxDEPRECATED( const wxString& GetText() const ); + + // Now use GetLabelText to strip the accelerators + wxDEPRECATED( static wxString GetLabelFromText(const wxString& text) ); + + // Now use SetItemLabel + wxDEPRECATED( virtual void SetText(const wxString& str) ); +#endif // WXWIN_COMPATIBILITY_2_8 + + static wxMenuItem *New(wxMenu *parentMenu, + int itemid, + const wxString& text, + const wxString& help, + bool isCheckable, + wxMenu *subMenu = NULL) + { + return New(parentMenu, itemid, text, help, + isCheckable ? wxITEM_CHECK : wxITEM_NORMAL, subMenu); + } + +protected: + // Helper function returning the appropriate bitmap from the given bundle + // (which may be invalid, in which case invalid bitmap is returned). + wxBitmap GetBitmapFromBundle(const wxBitmapBundle& bundle) const; + + wxWindowIDRef m_id; // numeric id of the item >= 0 or wxID_ANY or wxID_SEPARATOR + wxMenu *m_parentMenu, // the menu we belong to + *m_subMenu; // our sub menu or NULL + wxString m_text, // label of the item + m_help; // the help string for the item + wxBitmapBundle m_bitmap; // item bitmap, may be invalid + wxItemKind m_kind; // separator/normal/check/radio item? + bool m_isChecked; // is checked? + bool m_isEnabled; // is enabled? + +#if wxUSE_ACCEL + wxVector<wxAcceleratorEntry> m_extraAccels; // extra accels will work, but won't be shown in wxMenuItem title +#endif // wxUSE_ACCEL + + // this ctor is for the derived classes only, we're never created directly + wxMenuItemBase(wxMenu *parentMenu = NULL, + int itemid = wxID_SEPARATOR, + const wxString& text = wxEmptyString, + const wxString& help = wxEmptyString, + wxItemKind kind = wxITEM_NORMAL, + wxMenu *subMenu = NULL); + +private: + // and, if we have one ctor, compiler won't generate a default copy one, so + // declare them ourselves - but don't implement as they shouldn't be used + wxMenuItemBase(const wxMenuItemBase& item); + wxMenuItemBase& operator=(const wxMenuItemBase& item); +}; + +#if WXWIN_COMPATIBILITY_2_8 +inline void wxMenuItemBase::SetName(const wxString &str) + { SetItemLabel(str); } +inline wxString wxMenuItemBase::GetName() const + { return GetItemLabel(); } +inline wxString wxMenuItemBase::GetLabel() const + { return GetLabelText(m_text); } +inline const wxString& wxMenuItemBase::GetText() const { return m_text; } +inline void wxMenuItemBase::SetText(const wxString& text) { SetItemLabel(text); } +#endif // WXWIN_COMPATIBILITY_2_8 + +// ---------------------------------------------------------------------------- +// include the real class declaration +// ---------------------------------------------------------------------------- + +#ifdef wxUSE_BASE_CLASSES_ONLY + #define wxMenuItem wxMenuItemBase +#else // !wxUSE_BASE_CLASSES_ONLY +#if defined(__WXUNIVERSAL__) + #include "wx/univ/menuitem.h" +#elif defined(__WXMSW__) + #include "wx/msw/menuitem.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/menuitem.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/menuitem.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/menuitem.h" +#elif defined(__WXMAC__) + #include "wx/osx/menuitem.h" +#elif defined(__WXQT__) + #include "wx/qt/menuitem.h" +#endif +#endif // wxUSE_BASE_CLASSES_ONLY/!wxUSE_BASE_CLASSES_ONLY + +#endif // wxUSE_MENUS + +#endif + // _WX_MENUITEM_H_BASE_ diff --git a/lib/wxWidgets/include/wx/meta/convertible.h b/lib/wxWidgets/include/wx/meta/convertible.h new file mode 100644 index 0000000..a58d5f2 --- /dev/null +++ b/lib/wxWidgets/include/wx/meta/convertible.h @@ -0,0 +1,60 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/meta/convertible.h +// Purpose: Test if types are convertible +// Author: Arne Steinarson +// Created: 2008-01-10 +// Copyright: (c) 2008 Arne Steinarson +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_META_CONVERTIBLE_H_ +#define _WX_META_CONVERTIBLE_H_ + +// +// Introduce an extra class to make this header compilable with g++3.2 +// +template <class D, class B> +struct wxConvertibleTo_SizeHelper +{ + static char Match(B* pb); + static int Match(...); +}; + +// Helper to decide if an object of type D is convertible to type B (the test +// succeeds in particular when D derives from B) +template <class D, class B> +struct wxConvertibleTo +{ + enum + { + value = + sizeof(wxConvertibleTo_SizeHelper<D,B>::Match(static_cast<D*>(NULL))) + == + sizeof(char) + }; +}; + +// This is similar to wxConvertibleTo, except that when using a C++11 compiler, +// the case of D deriving from B non-publicly will be detected and the correct +// value (false) will be deduced instead of getting a compile-time error as +// with wxConvertibleTo. For pre-C++11 compilers there is no difference between +// this helper and wxConvertibleTo. +template <class D, class B> +struct wxIsPubliclyDerived +{ + enum + { +#if __cplusplus >= 201103 || (defined(_MSC_VER) && _MSC_VER >= 1600) + // If C++11 is available we use this, as on most compilers it's a + // built-in and will be evaluated at compile-time. + value = std::is_base_of<B, D>::value && std::is_convertible<D*, B*>::value +#else + // When not using C++11, we fall back to wxConvertibleTo, which fails + // at compile-time if D doesn't publicly derive from B. + value = wxConvertibleTo<D, B>::value +#endif + }; +}; + +#endif // _WX_META_CONVERTIBLE_H_ + diff --git a/lib/wxWidgets/include/wx/meta/if.h b/lib/wxWidgets/include/wx/meta/if.h new file mode 100644 index 0000000..0d93e81 --- /dev/null +++ b/lib/wxWidgets/include/wx/meta/if.h @@ -0,0 +1,56 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/meta/if.h +// Purpose: declares wxIf<> metaprogramming construct +// Author: Vaclav Slavik +// Created: 2008-01-22 +// Copyright: (c) 2008 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_META_IF_H_ +#define _WX_META_IF_H_ + +#include "wx/defs.h" + +namespace wxPrivate +{ + +template <bool Cond> +struct wxIfImpl; + +// specialization for true: +template <> +struct wxIfImpl<true> +{ + template<typename TTrue, typename TFalse> struct Result + { + typedef TTrue value; + }; +}; + +// specialization for false: +template<> +struct wxIfImpl<false> +{ + template<typename TTrue, typename TFalse> struct Result + { + typedef TFalse value; + }; +}; + +} // namespace wxPrivate + +// wxIf<> template defines nested type "value" which is the same as +// TTrue if the condition Cond (boolean compile-time constant) was met and +// TFalse if it wasn't. +// +// See wxVector<T> in vector.h for usage example +template<bool Cond, typename TTrue, typename TFalse> +struct wxIf +{ + typedef typename wxPrivate::wxIfImpl<Cond> + ::template Result<TTrue, TFalse>::value + value; +}; + +#endif // _WX_META_IF_H_ diff --git a/lib/wxWidgets/include/wx/meta/implicitconversion.h b/lib/wxWidgets/include/wx/meta/implicitconversion.h new file mode 100644 index 0000000..2207cb1 --- /dev/null +++ b/lib/wxWidgets/include/wx/meta/implicitconversion.h @@ -0,0 +1,102 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/meta/implicitconversion.h +// Purpose: Determine resulting type from implicit conversion +// Author: Vaclav Slavik +// Created: 2010-10-22 +// Copyright: (c) 2010 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_META_IMPLICITCONVERSION_H_ +#define _WX_META_IMPLICITCONVERSION_H_ + +#include "wx/defs.h" +#include "wx/meta/if.h" + +// C++ hierarchy of data types is: +// +// Long double (highest) +// Double +// Float +// Unsigned long int +// Long int +// Unsigned int +// Int (lowest) +// +// Types lower in the hierarchy are converted into ones higher up if both are +// involved e.g. in arithmetic expressions. + +namespace wxPrivate +{ + +template<typename T> +struct TypeHierarchy +{ + // consider unknown types (e.g. objects, pointers) to be of highest + // level, always convert to them if they occur + static const int level = 9999; +}; + +#define WX_TYPE_HIERARCHY_LEVEL(level_num, type) \ + template<> struct TypeHierarchy<type> \ + { \ + static const int level = level_num; \ + } + +WX_TYPE_HIERARCHY_LEVEL( 1, char); +WX_TYPE_HIERARCHY_LEVEL( 2, unsigned char); +WX_TYPE_HIERARCHY_LEVEL( 3, short); +WX_TYPE_HIERARCHY_LEVEL( 4, unsigned short); +WX_TYPE_HIERARCHY_LEVEL( 5, int); +WX_TYPE_HIERARCHY_LEVEL( 6, unsigned int); +WX_TYPE_HIERARCHY_LEVEL( 7, long); +WX_TYPE_HIERARCHY_LEVEL( 8, unsigned long); +#ifdef wxLongLong_t +WX_TYPE_HIERARCHY_LEVEL( 9, wxLongLong_t); +WX_TYPE_HIERARCHY_LEVEL(10, wxULongLong_t); +#endif +WX_TYPE_HIERARCHY_LEVEL(11, float); +WX_TYPE_HIERARCHY_LEVEL(12, double); +WX_TYPE_HIERARCHY_LEVEL(13, long double); + +#if wxWCHAR_T_IS_REAL_TYPE + #if SIZEOF_WCHAR_T == SIZEOF_SHORT + template<> struct TypeHierarchy<wchar_t> : public TypeHierarchy<short> {}; + #elif SIZEOF_WCHAR_T == SIZEOF_INT + template<> struct TypeHierarchy<wchar_t> : public TypeHierarchy<int> {}; + #elif SIZEOF_WCHAR_T == SIZEOF_LONG + template<> struct TypeHierarchy<wchar_t> : public TypeHierarchy<long> {}; + #else + #error "weird wchar_t size, please update this code" + #endif +#endif + +#undef WX_TYPE_HIERARCHY_LEVEL + +} // namespace wxPrivate + +// Helper to determine resulting type of implicit conversion in +// an expression with two arithmetic types. +template<typename T1, typename T2> +struct wxImplicitConversionType +{ + typedef typename wxIf + < + // if T2 is "higher" type, convert to it + (int)(wxPrivate::TypeHierarchy<T1>::level) < (int)(wxPrivate::TypeHierarchy<T2>::level), + T2, + // otherwise use T1 + T1 + >::value + value; +}; + + +template<typename T1, typename T2, typename T3> +struct wxImplicitConversionType3 : public wxImplicitConversionType< + T1, + typename wxImplicitConversionType<T2,T3>::value> +{ +}; + +#endif // _WX_META_IMPLICITCONVERSION_H_ diff --git a/lib/wxWidgets/include/wx/meta/int2type.h b/lib/wxWidgets/include/wx/meta/int2type.h new file mode 100644 index 0000000..7b8d5dc --- /dev/null +++ b/lib/wxWidgets/include/wx/meta/int2type.h @@ -0,0 +1,16 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/meta/int2type.h +// Purpose: Generate a unique type from a constant integer +// Author: Arne Steinarson +// Created: 2008-01-10 +// Copyright: (c) 2008 Arne Steinarson +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_META_INT2TYPE_H_ +#define _WX_META_INT2TYPE_H_ + +template <int N> +struct wxInt2Type { enum { value=N }; }; + +#endif // _WX_META_INT2TYPE_H_ diff --git a/lib/wxWidgets/include/wx/meta/movable.h b/lib/wxWidgets/include/wx/meta/movable.h new file mode 100644 index 0000000..aa34ad7 --- /dev/null +++ b/lib/wxWidgets/include/wx/meta/movable.h @@ -0,0 +1,44 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/meta/movable.h +// Purpose: Test if a type is movable using memmove() etc. +// Author: Vaclav Slavik +// Created: 2008-01-21 +// Copyright: (c) 2008 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_META_MOVABLE_H_ +#define _WX_META_MOVABLE_H_ + +#include "wx/meta/pod.h" +#include "wx/string.h" // for wxIsMovable<wxString> specialization + +// Helper to decide if an object of type T is "movable", i.e. if it can be +// copied to another memory location using memmove() or realloc() C functions. +// C++ only guarantees that POD types (including primitive types) are +// movable. +template<typename T> +struct wxIsMovable +{ + static const bool value = wxIsPod<T>::value; +}; + +// Macro to add wxIsMovable<T> specialization for given type that marks it +// as movable: +#define WX_DECLARE_TYPE_MOVABLE(type) \ + template<> struct wxIsMovable<type> \ + { \ + static const bool value = true; \ + }; + +// Our implementation of wxString is written in such way that it's safe to move +// it around (unless position cache is used which unfortunately breaks this). +// OTOH, we don't know anything about std::string. +// (NB: we don't put this into string.h and choose to include wx/string.h from +// here instead so that rarely-used wxIsMovable<T> code isn't included by +// everything) +#if !wxUSE_STD_STRING && !wxUSE_STRING_POS_CACHE +WX_DECLARE_TYPE_MOVABLE(wxString) +#endif + +#endif // _WX_META_MOVABLE_H_ diff --git a/lib/wxWidgets/include/wx/meta/pod.h b/lib/wxWidgets/include/wx/meta/pod.h new file mode 100644 index 0000000..fa4395c --- /dev/null +++ b/lib/wxWidgets/include/wx/meta/pod.h @@ -0,0 +1,69 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/meta/pod.h +// Purpose: Test if a type is POD +// Author: Vaclav Slavik, Jaakko Salli +// Created: 2010-06-14 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_META_POD_H_ +#define _WX_META_POD_H_ + +#include "wx/defs.h" + +// +// TODO: Use TR1 is_pod<> implementation where available. VC9 SP1 has it +// in tr1 namespace, VC10 has it in std namespace. GCC 4.2 has it in +// <tr1/type_traits>, while GCC 4.3 and later have it in <type_traits>. +// + +// Helper to decide if an object of type T is POD (Plain Old Data) +template<typename T> +struct wxIsPod +{ + static const bool value = false; +}; + +// Macro to add wxIsPod<T> specialization for given type that marks it +// as Plain Old Data: +#define WX_DECLARE_TYPE_POD(type) \ + template<> struct wxIsPod<type> \ + { \ + static const bool value = true; \ + }; + +WX_DECLARE_TYPE_POD(bool) +WX_DECLARE_TYPE_POD(unsigned char) +WX_DECLARE_TYPE_POD(signed char) +WX_DECLARE_TYPE_POD(unsigned int) +WX_DECLARE_TYPE_POD(signed int) +WX_DECLARE_TYPE_POD(unsigned short int) +WX_DECLARE_TYPE_POD(signed short int) +WX_DECLARE_TYPE_POD(signed long int) +WX_DECLARE_TYPE_POD(unsigned long int) +WX_DECLARE_TYPE_POD(float) +WX_DECLARE_TYPE_POD(double) +WX_DECLARE_TYPE_POD(long double) +#if wxWCHAR_T_IS_REAL_TYPE +WX_DECLARE_TYPE_POD(wchar_t) +#endif +#ifdef wxLongLong_t +WX_DECLARE_TYPE_POD(wxLongLong_t) +WX_DECLARE_TYPE_POD(wxULongLong_t) +#endif + +// pointers are Plain Old Data: +template<typename T> +struct wxIsPod<T*> +{ + static const bool value = true; +}; + +template<typename T> +struct wxIsPod<const T*> +{ + static const bool value = true; +}; + +#endif // _WX_META_POD_H_ diff --git a/lib/wxWidgets/include/wx/meta/removeref.h b/lib/wxWidgets/include/wx/meta/removeref.h new file mode 100644 index 0000000..efef170 --- /dev/null +++ b/lib/wxWidgets/include/wx/meta/removeref.h @@ -0,0 +1,33 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/meta/removeref.h +// Purpose: Allows to remove a reference from a type. +// Author: Vadim Zeitlin +// Created: 2012-10-21 +// Copyright: (c) 2012 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_META_REMOVEREF_H_ +#define _WX_META_REMOVEREF_H_ + +// wxRemoveRef<> is similar to C++11 std::remove_reference<> but works with all +// compilers (but, to compensate for this, doesn't work with rvalue references). + +template <typename T> +struct wxRemoveRef +{ + typedef T type; +}; + +template <typename T> +struct wxRemoveRef<T&> +{ + typedef T type; +}; + +// Define this for compatibility with the previous versions in which +// wxRemoveRef() wasn't always defined as we supported MSVC6 for which it +// couldn't be implemented. +#define wxHAS_REMOVEREF + +#endif // _WX_META_REMOVEREF_H_ diff --git a/lib/wxWidgets/include/wx/metafile.h b/lib/wxWidgets/include/wx/metafile.h new file mode 100644 index 0000000..dce7793 --- /dev/null +++ b/lib/wxWidgets/include/wx/metafile.h @@ -0,0 +1,51 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/metafile.h +// Purpose: wxMetaFile class declaration +// Author: wxWidgets team +// Modified by: +// Created: 13.01.00 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_METAFILE_H_BASE_ +#define _WX_METAFILE_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_METAFILE + +// provide synonyms for all metafile classes +#define wxMetaFile wxMetafile +#define wxMetaFileDC wxMetafileDC +#define wxMetaFileDataObject wxMetafileDataObject + +#define wxMakeMetaFilePlaceable wxMakeMetafilePlaceable + +#if defined(__WXMSW__) + #if wxUSE_ENH_METAFILE + #include "wx/msw/enhmeta.h" + + #if wxUSE_WIN_METAFILES_ALWAYS + // use normal metafiles as well + #include "wx/msw/metafile.h" + #else // also map all metafile classes to enh metafile + typedef wxEnhMetaFile wxMetafile; + typedef wxEnhMetaFileDC wxMetafileDC; + #if wxUSE_DATAOBJ + typedef wxEnhMetaFileDataObject wxMetafileDataObject; + #endif + + // this flag will be set if wxMetafile class is wxEnhMetaFile + #define wxMETAFILE_IS_ENH + #endif // wxUSE_WIN_METAFILES_ALWAYS + #else // !wxUSE_ENH_METAFILE + #include "wx/msw/metafile.h" + #endif +#elif defined(__WXMAC__) + #include "wx/osx/metafile.h" +#endif + +#endif // wxUSE_METAFILE + +#endif // _WX_METAFILE_H_BASE_ diff --git a/lib/wxWidgets/include/wx/mimetype.h b/lib/wxWidgets/include/wx/mimetype.h new file mode 100644 index 0000000..efa807d --- /dev/null +++ b/lib/wxWidgets/include/wx/mimetype.h @@ -0,0 +1,500 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mimetype.h +// Purpose: classes and functions to manage MIME types +// Author: Vadim Zeitlin +// Modified by: +// Chris Elliott (biol75@york.ac.uk) 5 Dec 00: write support for Win32 +// Created: 23.09.98 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence (part of wxExtra library) +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MIMETYPE_H_ +#define _WX_MIMETYPE_H_ + +// ---------------------------------------------------------------------------- +// headers and such +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_MIMETYPE + +// the things we really need +#include "wx/string.h" +#include "wx/dynarray.h" +#include "wx/arrstr.h" + +#include <stdarg.h> + +// fwd decls +class WXDLLIMPEXP_FWD_BASE wxIconLocation; +class WXDLLIMPEXP_FWD_BASE wxFileTypeImpl; +class WXDLLIMPEXP_FWD_BASE wxMimeTypesManagerImpl; + +// these constants define the MIME information source under UNIX and are used +// by wxMimeTypesManager::Initialize() +enum wxMailcapStyle +{ + wxMAILCAP_STANDARD = 1, + wxMAILCAP_NETSCAPE = 2, + wxMAILCAP_KDE = 4, + wxMAILCAP_GNOME = 8, + + wxMAILCAP_ALL = 15 +}; + +/* + TODO: would it be more convenient to have this class? + +class WXDLLIMPEXP_BASE wxMimeType : public wxString +{ +public: + // all string ctors here + + wxString GetType() const { return BeforeFirst(wxT('/')); } + wxString GetSubType() const { return AfterFirst(wxT('/')); } + + void SetSubType(const wxString& subtype) + { + *this = GetType() + wxT('/') + subtype; + } + + bool Matches(const wxMimeType& wildcard) + { + // implement using wxMimeTypesManager::IsOfType() + } +}; + +*/ + +// wxMimeTypeCommands stores the verbs defined for the given MIME type with +// their values +class WXDLLIMPEXP_BASE wxMimeTypeCommands +{ +public: + wxMimeTypeCommands() {} + + wxMimeTypeCommands(const wxArrayString& verbs, + const wxArrayString& commands) + : m_verbs(verbs), + m_commands(commands) + { + } + + // add a new verb with the command or replace the old value + void AddOrReplaceVerb(const wxString& verb, const wxString& cmd); + void Add(const wxString& s) + { + m_verbs.Add(s.BeforeFirst(wxT('='))); + m_commands.Add(s.AfterFirst(wxT('='))); + } + + // access the commands + size_t GetCount() const { return m_verbs.GetCount(); } + const wxString& GetVerb(size_t n) const { return m_verbs[n]; } + const wxString& GetCmd(size_t n) const { return m_commands[n]; } + + bool HasVerb(const wxString& verb) const + { return m_verbs.Index(verb) != wxNOT_FOUND; } + + // returns empty string and wxNOT_FOUND in idx if no such verb + wxString GetCommandForVerb(const wxString& verb, size_t *idx = NULL) const; + + // get a "verb=command" string + wxString GetVerbCmd(size_t n) const; + +private: + wxArrayString m_verbs; + wxArrayString m_commands; +}; + +// ---------------------------------------------------------------------------- +// wxFileTypeInfo: static container of information accessed via wxFileType. +// +// This class is used with wxMimeTypesManager::AddFallbacks() and Associate() +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFileTypeInfo +{ +private: + void DoVarArgInit(const wxString& mimeType, + const wxString& openCmd, + const wxString& printCmd, + const wxString& desc, + va_list argptr); + + void VarArgInit(const wxString *mimeType, + const wxString *openCmd, + const wxString *printCmd, + const wxString *desc, + // the other parameters form a NULL terminated list of + // extensions + ...); + +public: + // NB: This is a helper to get implicit conversion of variadic ctor's + // fixed arguments into something that can be passed to VarArgInit(). + // Do not use, it's used by the ctor only. + struct CtorString + { +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + CtorString(const char *str) : m_str(str) {} +#endif + CtorString(const wchar_t *str) : m_str(str) {} + CtorString(const wxString& str) : m_str(str) {} + CtorString(const wxCStrData& str) : m_str(str) {} +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + CtorString(const wxScopedCharBuffer& str) : m_str(str) {} +#endif + CtorString(const wxScopedWCharBuffer& str) : m_str(str) {} + + operator const wxString*() const { return &m_str; } + + wxString m_str; + }; + + // ctors + + // Ctor specifying just the MIME type (which is mandatory), the other + // fields can be set later if needed. + wxFileTypeInfo(const wxString& mimeType) + : m_mimeType(mimeType) + { + } + + // Ctor allowing to specify the values of all fields at once: + // + // wxFileTypeInfo(const wxString& mimeType, + // const wxString& openCmd, + // const wxString& printCmd, + // const wxString& desc, + // // the other parameters form a list of extensions for this + // // file type and should be terminated with wxNullPtr (not + // // just NULL!) + // ...); + WX_DEFINE_VARARG_FUNC_CTOR(wxFileTypeInfo, + 4, (const CtorString&, + const CtorString&, + const CtorString&, + const CtorString&), + VarArgInit, VarArgInit) + + // the array elements correspond to the parameters of the ctor above in + // the same order + wxFileTypeInfo(const wxArrayString& sArray); + + // invalid item - use this to terminate the array passed to + // wxMimeTypesManager::AddFallbacks + wxFileTypeInfo() { } + + // test if this object can be used + bool IsValid() const { return !m_mimeType.empty(); } + + // setters + // set the open/print commands + void SetOpenCommand(const wxString& command) { m_openCmd = command; } + void SetPrintCommand(const wxString& command) { m_printCmd = command; } + + // set the description + void SetDescription(const wxString& desc) { m_desc = desc; } + + // add another extension corresponding to this file type + void AddExtension(const wxString& ext) { m_exts.push_back(ext); } + + // set the icon info + void SetIcon(const wxString& iconFile, int iconIndex = 0) + { + m_iconFile = iconFile; + m_iconIndex = iconIndex; + } + // set the short desc + void SetShortDesc(const wxString& shortDesc) { m_shortDesc = shortDesc; } + + // accessors + // get the MIME type + const wxString& GetMimeType() const { return m_mimeType; } + // get the open command + const wxString& GetOpenCommand() const { return m_openCmd; } + // get the print command + const wxString& GetPrintCommand() const { return m_printCmd; } + // get the short description (only used under Win32 so far) + const wxString& GetShortDesc() const { return m_shortDesc; } + // get the long, user visible description + const wxString& GetDescription() const { return m_desc; } + // get the array of all extensions + const wxArrayString& GetExtensions() const { return m_exts; } + size_t GetExtensionsCount() const {return m_exts.GetCount(); } + // get the icon info + const wxString& GetIconFile() const { return m_iconFile; } + int GetIconIndex() const { return m_iconIndex; } + +private: + wxString m_mimeType, // the MIME type in "type/subtype" form + m_openCmd, // command to use for opening the file (%s allowed) + m_printCmd, // command to use for printing the file (%s allowed) + m_shortDesc, // a short string used in the registry + m_desc; // a free form description of this file type + + // icon stuff + wxString m_iconFile; // the file containing the icon + int m_iconIndex; // icon index in this file + + wxArrayString m_exts; // the extensions which are mapped on this filetype + + +#if 0 // TODO + // the additional (except "open" and "print") command names and values + wxArrayString m_commandNames, + m_commandValues; +#endif // 0 +}; + +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxFileTypeInfo, wxArrayFileTypeInfo, + WXDLLIMPEXP_BASE); + +// ---------------------------------------------------------------------------- +// wxFileType: gives access to all information about the files of given type. +// +// This class holds information about a given "file type". File type is the +// same as MIME type under Unix, but under Windows it corresponds more to an +// extension than to MIME type (in fact, several extensions may correspond to a +// file type). This object may be created in many different ways and depending +// on how it was created some fields may be unknown so the return value of all +// the accessors *must* be checked! +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFileType +{ +friend class WXDLLIMPEXP_FWD_BASE wxMimeTypesManagerImpl; // it has access to m_impl + +public: + // An object of this class must be passed to Get{Open|Print}Command. The + // default implementation is trivial and doesn't know anything at all about + // parameters, only filename and MIME type are used (so it's probably ok for + // Windows where %{param} is not used anyhow) + class MessageParameters + { + public: + // ctors + MessageParameters() { } + MessageParameters(const wxString& filename, + const wxString& mimetype = wxEmptyString) + : m_filename(filename), m_mimetype(mimetype) { } + + // accessors (called by GetOpenCommand) + // filename + const wxString& GetFileName() const { return m_filename; } + // mime type + const wxString& GetMimeType() const { return m_mimetype; } + + // override this function in derived class + virtual wxString GetParamValue(const wxString& WXUNUSED(name)) const + { return wxEmptyString; } + + // virtual dtor as in any base class + virtual ~MessageParameters() { } + + protected: + wxString m_filename, m_mimetype; + }; + + // ctor from static data + wxFileType(const wxFileTypeInfo& ftInfo); + + // accessors: all of them return true if the corresponding information + // could be retrieved/found, false otherwise (and in this case all [out] + // parameters are unchanged) + // return the MIME type for this file type + bool GetMimeType(wxString *mimeType) const; + bool GetMimeTypes(wxArrayString& mimeTypes) const; + // fill passed in array with all extensions associated with this file + // type + bool GetExtensions(wxArrayString& extensions); + // get the icon corresponding to this file type and of the given size + bool GetIcon(wxIconLocation *iconloc) const; + bool GetIcon(wxIconLocation *iconloc, + const MessageParameters& params) const; + // get a brief file type description ("*.txt" => "text document") + bool GetDescription(wxString *desc) const; + + // get the command to be used to open/print the given file. + // get the command to execute the file of given type + bool GetOpenCommand(wxString *openCmd, + const MessageParameters& params) const; + // a simpler to use version of GetOpenCommand() -- it only takes the + // filename and returns an empty string on failure + wxString GetOpenCommand(const wxString& filename) const; + // get the command to print the file of given type + bool GetPrintCommand(wxString *printCmd, + const MessageParameters& params) const; + + + // return the number of commands defined for this file type, 0 if none + size_t GetAllCommands(wxArrayString *verbs, wxArrayString *commands, + const wxFileType::MessageParameters& params) const; + + // set an arbitrary command, ask confirmation if it already exists and + // overwriteprompt is true + bool SetCommand(const wxString& cmd, const wxString& verb, + bool overwriteprompt = true); + + bool SetDefaultIcon(const wxString& cmd = wxEmptyString, int index = 0); + + + // remove the association for this filetype from the system MIME database: + // notice that it will only work if the association is defined in the user + // file/registry part, we will never modify the system-wide settings + bool Unassociate(); + + // operations + // expand a string in the format of GetOpenCommand (which may contain + // '%s' and '%t' format specifiers for the file name and mime type + // and %{param} constructions). + static wxString ExpandCommand(const wxString& command, + const MessageParameters& params); + + // dtor (not virtual, shouldn't be derived from) + ~wxFileType(); + + wxString + GetExpandedCommand(const wxString& verb, + const wxFileType::MessageParameters& params) const; +private: + // default ctor is private because the user code never creates us + wxFileType(); + + // no copy ctor/assignment operator + wxFileType(const wxFileType&); + wxFileType& operator=(const wxFileType&); + + // the static container of wxFileType data: if it's not NULL, it means that + // this object is used as fallback only + const wxFileTypeInfo *m_info; + + // the object which implements the real stuff like reading and writing + // to/from system MIME database + wxFileTypeImpl *m_impl; +}; + +//---------------------------------------------------------------------------- +// wxMimeTypesManagerFactory +//---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMimeTypesManagerFactory +{ +public: + wxMimeTypesManagerFactory() {} + virtual ~wxMimeTypesManagerFactory() {} + + virtual wxMimeTypesManagerImpl *CreateMimeTypesManagerImpl(); + + static void Set( wxMimeTypesManagerFactory *factory ); + static wxMimeTypesManagerFactory *Get(); + +private: + static wxMimeTypesManagerFactory *m_factory; +}; + +// ---------------------------------------------------------------------------- +// wxMimeTypesManager: interface to system MIME database. +// +// This class accesses the information about all known MIME types and allows +// the application to retrieve information (including how to handle data of +// given type) about them. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMimeTypesManager +{ +public: + // static helper functions + // ----------------------- + + // check if the given MIME type is the same as the other one: the + // second argument may contain wildcards ('*'), but not the first. If + // the types are equal or if the mimeType matches wildcard the function + // returns true, otherwise it returns false + static bool IsOfType(const wxString& mimeType, const wxString& wildcard); + + // ctor + wxMimeTypesManager(); + + // NB: the following 2 functions are for Unix only and don't do anything + // elsewhere + + // loads data from standard files according to the mailcap styles + // specified: this is a bitwise OR of wxMailcapStyle values + // + // use the extraDir parameter if you want to look for files in another + // directory + void Initialize(int mailcapStyle = wxMAILCAP_ALL, + const wxString& extraDir = wxEmptyString); + + // and this function clears all the data from the manager + void ClearData(); + + // Database lookup: all functions return a pointer to wxFileType object + // whose methods may be used to query it for the information you're + // interested in. If the return value is !NULL, caller is responsible for + // deleting it. + // get file type from file extension + wxFileType *GetFileTypeFromExtension(const wxString& ext); + // get file type from MIME type (in format <category>/<format>) + wxFileType *GetFileTypeFromMimeType(const wxString& mimeType); + + // enumerate all known MIME types + // + // returns the number of retrieved file types + size_t EnumAllFileTypes(wxArrayString& mimetypes); + + // these functions can be used to provide default values for some of the + // MIME types inside the program itself + // + // The filetypes array should be terminated by either NULL entry or an + // invalid wxFileTypeInfo (i.e. the one created with default ctor) + void AddFallbacks(const wxFileTypeInfo *filetypes); + void AddFallback(const wxFileTypeInfo& ft) { m_fallbacks.Add(ft); } + + // create or remove associations + + // create a new association using the fields of wxFileTypeInfo (at least + // the MIME type and the extension should be set) + // if the other fields are empty, the existing values should be left alone + wxFileType *Associate(const wxFileTypeInfo& ftInfo); + + // undo Associate() + bool Unassociate(wxFileType *ft) ; + + // dtor (not virtual, shouldn't be derived from) + ~wxMimeTypesManager(); + +private: + // no copy ctor/assignment operator + wxMimeTypesManager(const wxMimeTypesManager&); + wxMimeTypesManager& operator=(const wxMimeTypesManager&); + + // the fallback info which is used if the information is not found in the + // real system database + wxArrayFileTypeInfo m_fallbacks; + + // the object working with the system MIME database + wxMimeTypesManagerImpl *m_impl; + + // if m_impl is NULL, create one + void EnsureImpl(); + + friend class wxMimeTypeCmnModule; +}; + + +// ---------------------------------------------------------------------------- +// global variables +// ---------------------------------------------------------------------------- + +// the default mime manager for wxWidgets programs +extern WXDLLIMPEXP_DATA_BASE(wxMimeTypesManager *) wxTheMimeTypesManager; + +#endif // wxUSE_MIMETYPE + +#endif + //_WX_MIMETYPE_H_ diff --git a/lib/wxWidgets/include/wx/minifram.h b/lib/wxWidgets/include/wx/minifram.h new file mode 100644 index 0000000..bd03bbc --- /dev/null +++ b/lib/wxWidgets/include/wx/minifram.h @@ -0,0 +1,40 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/minifram.h +// Purpose: wxMiniFrame base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Copyright: (c) 2014 wxWidgets dev team +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MINIFRAM_H_BASE_ +#define _WX_MINIFRAM_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_MINIFRAME + +#if defined(__WXMSW__) +#include "wx/msw/minifram.h" +#elif defined(__WXMOTIF__) +#include "wx/motif/minifram.h" +#elif defined(__WXGTK20__) +#include "wx/gtk/minifram.h" +#elif defined(__WXGTK__) +#include "wx/gtk1/minifram.h" +#elif defined(__WXX11__) +#include "wx/x11/minifram.h" +#elif defined(__WXMAC__) +#include "wx/osx/minifram.h" +#elif defined(__WXQT__) +#include "wx/qt/minifram.h" +#else +// TODO: it seems that wxMiniFrame could be just defined here generically +// instead of having all the above port-specific headers +#include "wx/frame.h" +typedef wxFrame wxMiniFrame; +#endif + +#endif // wxUSE_MINIFRAME +#endif // _WX_MINIFRAM_H_BASE_ diff --git a/lib/wxWidgets/include/wx/modalhook.h b/lib/wxWidgets/include/wx/modalhook.h new file mode 100644 index 0000000..a60b77e --- /dev/null +++ b/lib/wxWidgets/include/wx/modalhook.h @@ -0,0 +1,104 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/modalhook.h +// Purpose: Allows to hook into showing modal dialogs. +// Author: Vadim Zeitlin +// Created: 2013-05-19 +// Copyright: (c) 2013 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MODALHOOK_H_ +#define _WX_MODALHOOK_H_ + +#include "wx/vector.h" + +class WXDLLIMPEXP_FWD_CORE wxDialog; + +// ---------------------------------------------------------------------------- +// Class allowing to be notified about any modal dialog calls. +// ---------------------------------------------------------------------------- + +// To be notified about entering and exiting modal dialogs and possibly to +// replace them with something else (e.g. just return a predefined value for +// testing), define an object of this class, override its Enter() and +// possibly Exit() methods and call Register() on it. +class WXDLLIMPEXP_CORE wxModalDialogHook +{ +public: + // Default ctor doesn't do anything, call Register() to activate the hook. + wxModalDialogHook() { } + + // Dtor unregisters the hook if it had been registered. + virtual ~wxModalDialogHook() { DoUnregister(); } + + // Register this hook as being active, i.e. its Enter() and Exit() methods + // will be called. + // + // Notice that the order of registration matters: the last hook registered + // is called first, and if its Enter() returns something != wxID_NONE, the + // subsequent hooks are skipped. + void Register(); + + // Unregister this hook. Notice that is done automatically from the dtor. + void Unregister(); + + // Called from wxWidgets code before showing any modal dialogs and calls + // Enter() for every registered hook. + static int CallEnter(wxDialog* dialog); + + // Called from wxWidgets code after dismissing the dialog and calls Exit() + // for every registered hook. + static void CallExit(wxDialog* dialog); + +protected: + // Called by wxWidgets before showing any modal dialogs, override this to + // be notified about this and return anything but wxID_NONE to skip showing + // the modal dialog entirely and just return the specified result. + virtual int Enter(wxDialog* dialog) = 0; + + // Called by wxWidgets after dismissing the modal dialog. Notice that it + // won't be called if Enter() hadn't been. + virtual void Exit(wxDialog* WXUNUSED(dialog)) { } + +private: + // Unregister the given hook, return true if it was done or false if the + // hook wasn't found. + bool DoUnregister(); + + // All the hooks in reverse registration order (i.e. in call order). + typedef wxVector<wxModalDialogHook*> Hooks; + static Hooks ms_hooks; + + wxDECLARE_NO_COPY_CLASS(wxModalDialogHook); +}; + +// Helper object used by WX_MODAL_DIALOG_HOOK below to ensure that CallExit() +// is called on scope exit. +class wxModalDialogHookExitGuard +{ +public: + explicit wxModalDialogHookExitGuard(wxDialog* dialog) + : m_dialog(dialog) + { + } + + ~wxModalDialogHookExitGuard() + { + wxModalDialogHook::CallExit(m_dialog); + } + +private: + wxDialog* const m_dialog; + + wxDECLARE_NO_COPY_CLASS(wxModalDialogHookExitGuard); +}; + +// This macro needs to be used at the top of every implementation of +// ShowModal() in order for wxModalDialogHook to work. +#define WX_HOOK_MODAL_DIALOG() \ + const int modalDialogHookRC = wxModalDialogHook::CallEnter(this); \ + if ( modalDialogHookRC != wxID_NONE ) \ + return modalDialogHookRC; \ + wxModalDialogHookExitGuard modalDialogHookExit(this) + +#endif // _WX_MODALHOOK_H_ diff --git a/lib/wxWidgets/include/wx/module.h b/lib/wxWidgets/include/wx/module.h new file mode 100644 index 0000000..1f10702 --- /dev/null +++ b/lib/wxWidgets/include/wx/module.h @@ -0,0 +1,116 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/module.h +// Purpose: Modules handling +// Author: Wolfram Gloger/adapted by Guilhem Lavaux +// Modified by: +// Created: 04/11/98 +// Copyright: (c) Wolfram Gloger and Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MODULE_H_ +#define _WX_MODULE_H_ + +#include "wx/object.h" +#include "wx/vector.h" + +class wxModule; + +typedef wxVector<wxModule*> wxModuleList; + +// declaring a class derived from wxModule will automatically create an +// instance of this class on program startup, call its OnInit() method and call +// OnExit() on program termination (but only if OnInit() succeeded) +class WXDLLIMPEXP_BASE wxModule : public wxObject +{ +public: + wxModule() {} + virtual ~wxModule() {} + + // if module init routine returns false the application + // will fail to startup + + bool Init() { return OnInit(); } + void Exit() { OnExit(); } + + // Override both of these + + // called on program startup + + virtual bool OnInit() = 0; + + // called just before program termination, but only if OnInit() + // succeeded + + virtual void OnExit() = 0; + + static void RegisterModule(wxModule *module); + static void RegisterModules(); + static bool InitializeModules(); + static void CleanUpModules(); + static bool AreInitialized() { return ms_areInitialized; } + + // used by wxObjectLoader when unloading shared libs's + + static void UnregisterModule(wxModule *module); + +protected: + static wxModuleList ms_modules; + + static bool ms_areInitialized; + + // the function to call from constructor of a deriving class add module + // dependency which will be initialized before the module and unloaded + // after that + void AddDependency(wxClassInfo *dep) + { + wxCHECK_RET( dep, wxT("NULL module dependency") ); + + m_dependencies.push_back(dep); + } + + // same as the version above except it will look up wxClassInfo by name on + // its own. Note that className must be ASCII + void AddDependency(const char *className) + { + m_namedDependencies.push_back(wxASCII_STR(className)); + } + + +private: + // initialize module and Append it to initializedModules list recursively + // calling itself to satisfy module dependencies if needed + static bool + DoInitializeModule(wxModule *module, wxModuleList &initializedModules); + + // cleanup the modules in the specified list (which may not contain all + // modules if we're called during initialization because not all modules + // could be initialized) and also empty ms_modules itself + static void DoCleanUpModules(const wxModuleList& modules); + + // resolve all named dependencies and add them to the normal m_dependencies + bool ResolveNamedDependencies(); + + + // module dependencies: contains wxClassInfo pointers for all modules which + // must be initialized before this one + typedef wxVector<wxClassInfo*> wxArrayClassInfo; + wxArrayClassInfo m_dependencies; + + // and the named dependencies: those will be resolved during run-time and + // added to m_dependencies + wxVector<wxString> m_namedDependencies; + + // used internally while initializing/cleaning up modules + enum + { + State_Registered, // module registered but not initialized yet + State_Initializing, // we're initializing this module but not done yet + State_Initialized // module initialized successfully + } m_state; + + + wxDECLARE_CLASS(wxModule); +}; + +#endif // _WX_MODULE_H_ diff --git a/lib/wxWidgets/include/wx/motif/accel.h b/lib/wxWidgets/include/wx/motif/accel.h new file mode 100644 index 0000000..4daba48 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/accel.h @@ -0,0 +1,39 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/accel.h +// Purpose: wxAcceleratorTable class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ACCEL_H_ +#define _WX_ACCEL_H_ + +#include "wx/object.h" +#include "wx/string.h" +#include "wx/event.h" + +class WXDLLIMPEXP_CORE wxAcceleratorTable: public wxObject +{ + wxDECLARE_DYNAMIC_CLASS(wxAcceleratorTable); +public: + wxAcceleratorTable(); + wxAcceleratorTable(const wxString& resource); // Load from .rc resource + wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]); // Load from array + + virtual ~wxAcceleratorTable(); + + bool Ok() const { return IsOk(); } + bool IsOk() const; + + // Implementation only + int GetCount() const; + wxAcceleratorEntry* GetEntries() const; +}; + +extern WXDLLIMPEXP_DATA_CORE(wxAcceleratorTable) wxNullAcceleratorTable; + +#endif +// _WX_ACCEL_H_ diff --git a/lib/wxWidgets/include/wx/motif/app.h b/lib/wxWidgets/include/wx/motif/app.h new file mode 100644 index 0000000..9b8f4ce --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/app.h @@ -0,0 +1,94 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/app.h +// Purpose: wxApp class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_APP_H_ +#define _WX_APP_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/event.h" +#include "wx/hashmap.h" + +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxFrame; +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxApp; +class WXDLLIMPEXP_FWD_CORE wxKeyEvent; +class WXDLLIMPEXP_FWD_BASE wxLog; +class WXDLLIMPEXP_FWD_CORE wxEventLoop; +class WXDLLIMPEXP_FWD_CORE wxXVisualInfo; +class WXDLLIMPEXP_FWD_CORE wxPerDisplayData; + +// ---------------------------------------------------------------------------- +// the wxApp class for Motif - see wxAppBase for more details +// ---------------------------------------------------------------------------- + +WX_DECLARE_VOIDPTR_HASH_MAP( wxPerDisplayData*, wxPerDisplayDataMap ); + +class WXDLLIMPEXP_CORE wxApp : public wxAppBase +{ + wxDECLARE_DYNAMIC_CLASS(wxApp); + +public: + wxApp(); + virtual ~wxApp(); + + // override base class (pure) virtuals + // ----------------------------------- + + virtual int MainLoop(); + + virtual void Exit(); + + virtual void WakeUpIdle(); // implemented in motif/evtloop.cpp + + // implementation from now on + // -------------------------- + +protected: + bool m_showOnInit; + +public: + // Implementation + virtual bool Initialize(int& argc, wxChar **argv); + virtual void CleanUp(); + + // Motif-specific + WXAppContext GetAppContext() const { return m_appContext; } + WXWidget GetTopLevelWidget(); + WXWidget GetTopLevelRealizedWidget(); + WXColormap GetMainColormap(WXDisplay* display); + WXDisplay* GetInitialDisplay() const { return m_initialDisplay; } + + void SetTopLevelWidget(WXDisplay* display, WXWidget widget); + void SetTopLevelRealizedWidget(WXDisplay* display, + WXWidget widget); + + // This handler is called when a property change event occurs + virtual void HandlePropertyChange(WXEvent *event); + + wxXVisualInfo* GetVisualInfo(WXDisplay* display); + virtual void* GetXVisualInfo() { return NULL; } + +private: + // Motif-specific + WXAppContext m_appContext; + WXColormap m_mainColormap; + WXDisplay* m_initialDisplay; + wxPerDisplayDataMap* m_perDisplayData; +}; + +#endif +// _WX_APP_H_ diff --git a/lib/wxWidgets/include/wx/motif/bmpbuttn.h b/lib/wxWidgets/include/wx/motif/bmpbuttn.h new file mode 100644 index 0000000..8f8bb57 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/bmpbuttn.h @@ -0,0 +1,63 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/bmpbuttn.h +// Purpose: wxBitmapButton class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BMPBUTTN_H_ +#define _WX_BMPBUTTN_H_ + +#include "wx/motif/bmpmotif.h" + +#define wxDEFAULT_BUTTON_MARGIN 4 + +class WXDLLIMPEXP_CORE wxBitmapButton: public wxBitmapButtonBase +{ +public: + wxBitmapButton(); + virtual ~wxBitmapButton(); + wxBitmapButton(wxWindow *parent, wxWindowID id, + const wxBitmapBundle& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)) + { + Create(parent, id, bitmap, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxBitmapBundle& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)); + + bool CreateCloseButton(wxWindow* parent, + wxWindowID winid, + const wxString& name = wxString()); + // Implementation + virtual void ChangeBackgroundColour(); + +protected: + virtual wxSize DoGetBestSize() const; + + virtual void DoSetBitmap(const wxBitmapBundle& bitmap, State which); + virtual void OnSetBitmap(); + + // original bitmaps may be different from the ones we were initialized with + // if they were changed to reflect button background colour + wxBitmapBundle m_bitmapsOriginal[State_Max]; + + wxBitmapCache m_bitmapCache; + + WXPixmap m_insensPixmap; + + wxDECLARE_DYNAMIC_CLASS(wxBitmapButton); +}; + +#endif // _WX_BMPBUTTN_H_ diff --git a/lib/wxWidgets/include/wx/motif/bmpmotif.h b/lib/wxWidgets/include/wx/motif/bmpmotif.h new file mode 100644 index 0000000..ada8ae1 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/bmpmotif.h @@ -0,0 +1,56 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/bmpmotif.h +// Purpose: Motif-specific bitmap routines +// Author: Julian Smart, originally in bitmap.h +// Modified by: +// Created: 25/03/2003 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BMPMOTIF_H_ +#define _WX_BMPMOTIF_H_ + +#include "wx/defs.h" +#include "wx/bitmap.h" + +class WXDLLIMPEXP_CORE wxBitmapCache +{ +public: + wxBitmapCache() + { + m_labelPixmap = (WXPixmap)NULL; + m_armPixmap = (WXPixmap)NULL; + m_insensPixmap = (WXPixmap)NULL; + m_image = (WXImage)NULL; + m_display = NULL; + SetColoursChanged(); + } + + ~wxBitmapCache(); + + void SetColoursChanged(); + void SetBitmap( const wxBitmap& bitmap ); + + WXPixmap GetLabelPixmap( WXWidget w ); + WXPixmap GetInsensPixmap( WXWidget w = (WXWidget)NULL ); + WXPixmap GetArmPixmap( WXWidget w ); +private: + void InvalidateCache(); + void CreateImageIfNeeded( WXWidget w ); + + WXPixmap GetPixmapFromCache(WXWidget w); + + struct + { + bool label : 1; + bool arm : 1; + bool insens : 1; + } m_recalcPixmaps; + wxBitmap m_bitmap; + WXDisplay* m_display; + WXPixmap m_labelPixmap, m_armPixmap, m_insensPixmap; + WXImage m_image; +}; + +#endif // _WX_BMPMOTIF_H_ diff --git a/lib/wxWidgets/include/wx/motif/button.h b/lib/wxWidgets/include/wx/motif/button.h new file mode 100644 index 0000000..aacd066 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/button.h @@ -0,0 +1,56 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/button.h +// Purpose: wxButton class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BUTTON_H_ +#define _WX_BUTTON_H_ + +// Pushbutton +class WXDLLIMPEXP_CORE wxButton: public wxButtonBase +{ +public: + wxButton() { } + wxButton(wxWindow *parent, + wxWindowID id, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)); + + virtual wxWindow *SetDefault(); + virtual void Command(wxCommandEvent& event); + + static wxSize GetDefaultSize(); + + // Implementation + virtual wxSize GetMinSize() const; + +protected: + virtual wxSize DoGetBestSize() const; + +private: + wxSize OldGetBestSize() const; + wxSize OldGetMinSize() const; + void SetDefaultShadowThicknessAndResize(); + + wxDECLARE_DYNAMIC_CLASS(wxButton); +}; + +#endif // _WX_BUTTON_H_ diff --git a/lib/wxWidgets/include/wx/motif/checkbox.h b/lib/wxWidgets/include/wx/motif/checkbox.h new file mode 100644 index 0000000..c951c68 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/checkbox.h @@ -0,0 +1,61 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/checkbox.h +// Purpose: wxCheckBox class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CHECKBOX_H_ +#define _WX_CHECKBOX_H_ + +// Checkbox item (single checkbox) +class WXDLLIMPEXP_CORE wxCheckBox: public wxCheckBoxBase +{ + wxDECLARE_DYNAMIC_CLASS(wxCheckBox); + +public: + inline wxCheckBox() { Init(); } + inline wxCheckBox(wxWindow *parent, wxWindowID id, const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)) + { + Init(); + + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)); + virtual void SetValue(bool); + virtual bool GetValue() const ; + virtual void Command(wxCommandEvent& event); + + // Implementation + virtual void ChangeBackgroundColour(); +private: + // common part of all constructors + void Init() + { + m_evtType = wxEVT_CHECKBOX; + } + + virtual void DoSet3StateValue(wxCheckBoxState state); + + virtual wxCheckBoxState DoGet3StateValue() const; + + // public for the callback +public: + // either wxEVT_CHECKBOX or ..._TOGGLEBUTTON + wxEventType m_evtType; +}; + +#endif +// _WX_CHECKBOX_H_ diff --git a/lib/wxWidgets/include/wx/motif/checklst.h b/lib/wxWidgets/include/wx/motif/checklst.h new file mode 100644 index 0000000..34323c3 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/checklst.h @@ -0,0 +1,76 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/checklst.h +// Purpose: wxCheckListBox class - a listbox with checkable items +// Note: this is an optional class. +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CHECKLST_H_ +#define _WX_CHECKLST_H_ + +#include "wx/listbox.h" + +class WXDLLIMPEXP_CORE wxCheckListBox : public wxCheckListBoxBase +{ + wxDECLARE_DYNAMIC_CLASS(wxCheckListBox); + +public: + // ctors + wxCheckListBox(); + wxCheckListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int nStrings = 0, + const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + + wxCheckListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + + // items may be checked + bool IsChecked(unsigned int uiIndex) const; + void Check(unsigned int uiIndex, bool bCheck = true); + + // override base class functions + virtual int DoInsertItems(const wxArrayStringsAdapter& items, + unsigned int pos, + void **clientData, wxClientDataType type); + virtual int FindString(const wxString& s, bool bCase = false) const; + virtual void SetString(unsigned int n, const wxString& s); + virtual wxString GetString(unsigned int n) const; + +private: + void DoToggleItem( int item, int x ); +private: + wxDECLARE_EVENT_TABLE(); +}; + +#endif +// _WX_CHECKLST_H_ diff --git a/lib/wxWidgets/include/wx/motif/chkconf.h b/lib/wxWidgets/include/wx/motif/chkconf.h new file mode 100644 index 0000000..4bde656 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/chkconf.h @@ -0,0 +1,21 @@ +/* + * Name: wx/motif/chkconf.h + * Purpose: Motif-specific config settings checks + * Author: Vadim Zeitlin + * Modified by: + * Created: 2005-04-05 (extracted from wx/chkconf.h) + * Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwidgets.org> + * Licence: wxWindows licence + */ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#if !defined(wxUSE_GADGETS) +# define wxUSE_GADGETS 0 +#endif + +/* wxGraphicsContext is not implemented in wxMotif */ +#if wxUSE_GRAPHICS_CONTEXT +# undef wxUSE_GRAPHICS_CONTEXT +# define wxUSE_GRAPHICS_CONTEXT 0 +#endif diff --git a/lib/wxWidgets/include/wx/motif/choice.h b/lib/wxWidgets/include/wx/motif/choice.h new file mode 100644 index 0000000..305ff0e --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/choice.h @@ -0,0 +1,124 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/choice.h +// Purpose: wxChoice class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CHOICE_H_ +#define _WX_CHOICE_H_ + +#include "wx/clntdata.h" + +#ifndef wxWIDGET_ARRAY_DEFINED + #define wxWIDGET_ARRAY_DEFINED + + #include "wx/dynarray.h" + WX_DEFINE_ARRAY_PTR(WXWidget, wxWidgetArray); +#endif + +// Choice item +class WXDLLIMPEXP_CORE wxChoice: public wxChoiceBase +{ + wxDECLARE_DYNAMIC_CLASS(wxChoice); + +public: + wxChoice(); + virtual ~wxChoice(); + + wxChoice(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr)) + { + Init(); + Create(parent, id, pos, size, n, choices, style, validator, name); + } + + wxChoice(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr)) + { + Init(); + Create(parent, id, pos, size, choices, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr)); + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr)); + + // implementation of wxControlWithItems + virtual unsigned int GetCount() const; + virtual int GetSelection() const; + virtual void DoDeleteOneItem(unsigned int n); + virtual void DoClear(); + virtual void SetString(unsigned int n, const wxString& s); + virtual wxString GetString(unsigned int n) const; + + // implementation of wxChoiceBase + virtual void SetSelection(int n); + virtual void SetColumns(int n = 1 ); + virtual int GetColumns() const ; + + // Original API + virtual void Command(wxCommandEvent& event); + + void SetFocus(); + + // Implementation + virtual void ChangeFont(bool keepOriginalSize = true); + virtual void ChangeBackgroundColour(); + virtual void ChangeForegroundColour(); + WXWidget GetTopWidget() const { return m_formWidget; } + WXWidget GetMainWidget() const { return m_buttonWidget; } + + virtual wxSize DoGetBestSize() const; + + // implementation, for wxChoiceCallback + const wxWidgetArray& GetWidgets() const { return m_widgetArray; } + const wxArrayString& GetStrings() const { return m_stringArray; } +protected: + // minimum size for the text ctrl + wxSize GetItemsSize() const; + // common part of all constructors + void Init(); + + WXWidget m_menuWidget; + WXWidget m_buttonWidget; + wxWidgetArray m_widgetArray; + WXWidget m_formWidget; + wxArrayString m_stringArray; + + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + + // implementation of wxControlWithItems + virtual int DoInsertItems(const wxArrayStringsAdapter& items, + unsigned int pos, + void **clientData, wxClientDataType type); +}; + +#endif // _WX_CHOICE_H_ diff --git a/lib/wxWidgets/include/wx/motif/clipbrd.h b/lib/wxWidgets/include/wx/motif/clipbrd.h new file mode 100644 index 0000000..6da55bd --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/clipbrd.h @@ -0,0 +1,80 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/clipbrd.h +// Purpose: Clipboard functionality. +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CLIPBRD_H_ +#define _WX_CLIPBRD_H_ + +#if wxUSE_CLIPBOARD + +class WXDLLIMPEXP_FWD_CORE wxDataObject; +struct wxDataIdToDataObject; + +#include "wx/list.h" + +WX_DECLARE_LIST(wxDataObject, wxDataObjectList); +WX_DECLARE_LIST(wxDataIdToDataObject, wxDataIdToDataObjectList); + +WXDLLIMPEXP_CORE bool wxOpenClipboard(); +WXDLLIMPEXP_CORE bool wxClipboardOpen(); +WXDLLIMPEXP_CORE bool wxCloseClipboard(); +WXDLLIMPEXP_CORE bool wxEmptyClipboard(); +WXDLLIMPEXP_CORE bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat); +WXDLLIMPEXP_CORE bool wxSetClipboardData(wxDataFormat dataFormat, wxObject *obj, int width = 0, int height = 0); +WXDLLIMPEXP_CORE wxObject* wxGetClipboardData(wxDataFormat dataFormat, long *len = NULL); +WXDLLIMPEXP_CORE wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat); +WXDLLIMPEXP_CORE wxDataFormat wxRegisterClipboardFormat(char *formatName); +WXDLLIMPEXP_CORE bool wxGetClipboardFormatName(wxDataFormat dataFormat, char *formatName, int maxCount); + +//----------------------------------------------------------------------------- +// wxClipboard +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxClipboard : public wxClipboardBase +{ +public: + wxClipboard(); + virtual ~wxClipboard(); + + // open the clipboard before SetData() and GetData() + virtual bool Open(); + + // close the clipboard after SetData() and GetData() + virtual void Close(); + + // opened? + virtual bool IsOpened() const { return m_open; } + + // replaces the data on the clipboard with data + virtual bool SetData( wxDataObject *data ); + + // adds data to the clipboard + virtual bool AddData( wxDataObject *data ); + + // format available on the clipboard ? + virtual bool IsSupported( const wxDataFormat& format ); + + // fill data with data on the clipboard (if available) + virtual bool GetData( wxDataObject& data ); + + // clears wxTheClipboard and the system's clipboard if possible + virtual void Clear(); + + // implementation from now on + bool m_open; + wxDataObjectList m_data; + wxDataIdToDataObjectList m_idToObject; + +private: + wxDECLARE_DYNAMIC_CLASS(wxClipboard); +}; + +#endif // wxUSE_CLIPBOARD + +#endif // _WX_CLIPBRD_H_ diff --git a/lib/wxWidgets/include/wx/motif/colour.h b/lib/wxWidgets/include/wx/motif/colour.h new file mode 100644 index 0000000..1721614 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/colour.h @@ -0,0 +1,75 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/colour.h +// Purpose: wxColour class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COLOUR_H_ +#define _WX_COLOUR_H_ + +#include "wx/object.h" +#include "wx/string.h" + +// Colour +class WXDLLIMPEXP_CORE wxColour : public wxColourBase +{ + wxDECLARE_DYNAMIC_CLASS(wxColour); +public: + // constructors + // ------------ + DEFINE_STD_WXCOLOUR_CONSTRUCTORS + + // copy ctors and assignment operators + wxColour( const wxColour& col ); + wxColour& operator = ( const wxColour& col ); + + // dtor + virtual ~wxColour(); + + + // accessors + virtual bool IsOk() const {return m_isInit; } + unsigned char Red() const { return m_red; } + unsigned char Green() const { return m_green; } + unsigned char Blue() const { return m_blue; } + + WXPixel GetPixel() const { return m_pixel; } + void SetPixel(WXPixel pixel) { m_pixel = pixel; m_isInit = true; } + + inline bool operator == (const wxColour& colour) const { return (m_red == colour.m_red && m_green == colour.m_green && m_blue == colour.m_blue); } + + inline bool operator != (const wxColour& colour) const { return (!(m_red == colour.m_red && m_green == colour.m_green && m_blue == colour.m_blue)); } + + // Allocate a colour, or nearest colour, using the given display. + // If realloc is true, ignore the existing pixel, otherwise just return + // the existing one. + // Returns the allocated pixel. + + // TODO: can this handle mono displays? If not, we should have an extra + // flag to specify whether this should be black or white by default. + + WXPixel AllocColour(WXDisplay* display, bool realloc = false); + +protected: + // Helper function + void Init(); + + virtual void + InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a); + +private: + bool m_isInit; + unsigned char m_red; + unsigned char m_blue; + unsigned char m_green; + +public: + WXPixel m_pixel; +}; + +#endif +// _WX_COLOUR_H_ diff --git a/lib/wxWidgets/include/wx/motif/combobox.h b/lib/wxWidgets/include/wx/motif/combobox.h new file mode 100644 index 0000000..cae4d10 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/combobox.h @@ -0,0 +1,134 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/combobox.h +// Purpose: wxComboBox class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COMBOBOX_H_ +#define _WX_COMBOBOX_H_ + +#include "wx/choice.h" +#include "wx/textentry.h" + +// Combobox item +class WXDLLIMPEXP_CORE wxComboBox : public wxChoice, + public wxTextEntry +{ +public: + wxComboBox() { m_inSetSelection = false; } + virtual ~wxComboBox(); + + inline wxComboBox(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)) + { + m_inSetSelection = false; + Create(parent, id, value, pos, size, n, choices, + style, validator, name); + } + + inline wxComboBox(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)) + { + m_inSetSelection = false; + Create(parent, id, value, pos, size, choices, + style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)); + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)); + + // See wxComboBoxBase discussion of IsEmpty(). + bool IsListEmpty() const { return wxItemContainer::IsEmpty(); } + bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); } + + // resolve ambiguities among virtual functions inherited from both base + // classes + virtual void Clear(); + virtual wxString GetValue() const { return wxTextEntry::GetValue(); } + virtual void SetValue(const wxString& value); + virtual wxString GetStringSelection() const + { return wxChoice::GetStringSelection(); } + + virtual void SetSelection(long from, long to) + { wxTextEntry::SetSelection(from, to); } + virtual void GetSelection(long *from, long *to) const + { wxTextEntry::GetSelection(from, to); } + + + // implementation of wxControlWithItems + virtual int DoInsertItems(const wxArrayStringsAdapter& items, + unsigned int pos, + void **clientData, wxClientDataType type); + virtual void DoDeleteOneItem(unsigned int n); + virtual int GetSelection() const ; + virtual void SetSelection(int n); + virtual int FindString(const wxString& s, bool bCase = false) const; + virtual wxString GetString(unsigned int n) const ; + virtual void SetString(unsigned int n, const wxString& s); + + // Implementation + virtual void ChangeFont(bool keepOriginalSize = true); + virtual void ChangeBackgroundColour(); + virtual void ChangeForegroundColour(); + WXWidget GetTopWidget() const { return m_mainWidget; } + WXWidget GetMainWidget() const { return m_mainWidget; } + + //Copied from wxComboBoxBase because for wxMOTIF wxComboBox does not inherit from it. + virtual void Popup() { wxFAIL_MSG( wxT("Not implemented") ); } + virtual void Dismiss() { wxFAIL_MSG( wxT("Not implemented") ); } + + virtual const wxTextEntry* WXGetTextEntry() const { return this; } + +protected: + virtual wxSize DoGetBestSize() const; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + + // implement wxTextEntry pure virtual methods + virtual wxWindow *GetEditableWindow() { return this; } + virtual WXWidget GetTextWidget() const; + +private: + // only implemented for native combo box + void AdjustDropDownListSize(); + + // implementation detail, should really be private +public: + bool m_inSetSelection; + + wxDECLARE_DYNAMIC_CLASS(wxComboBox); +}; + +#endif // _WX_COMBOBOX_H_ diff --git a/lib/wxWidgets/include/wx/motif/control.h b/lib/wxWidgets/include/wx/motif/control.h new file mode 100644 index 0000000..4ad4979 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/control.h @@ -0,0 +1,74 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/control.h +// Purpose: wxControl class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CONTROL_H_ +#define _WX_CONTROL_H_ + +#include "wx/window.h" +#include "wx/list.h" +#include "wx/validate.h" + +// General item class +class WXDLLIMPEXP_CORE wxControl: public wxControlBase +{ + wxDECLARE_ABSTRACT_CLASS(wxControl); + +public: + wxControl(); + wxControl( wxWindow *parent, + wxWindowID id, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString &name = wxASCII_STR(wxControlNameStr) ) + { + Create(parent, id, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxControlNameStr)); + + // simulates the event, returns true if the event was processed + virtual void Command(wxCommandEvent& WXUNUSED(event)) { } + + // calls the callback and appropriate event handlers, returns true if + // event was processed + virtual bool ProcessCommand(wxCommandEvent& event); + + virtual void SetLabel(const wxString& label); + virtual wxString GetLabel() const ; + + bool InSetValue() const { return m_inSetValue; } + +protected: + // calls wxControlBase::CreateControl, also sets foreground, background and + // font to parent's values + bool CreateControl(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name); + + // native implementation using XtQueryGeometry + virtual wxSize DoGetBestSize() const; + + // Motif: prevent callbacks being called while in SetValue + bool m_inSetValue; + + wxDECLARE_EVENT_TABLE(); +}; + +#endif // _WX_CONTROL_H_ diff --git a/lib/wxWidgets/include/wx/motif/ctrlsub.h b/lib/wxWidgets/include/wx/motif/ctrlsub.h new file mode 100644 index 0000000..f6104cc --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/ctrlsub.h @@ -0,0 +1,39 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/ctrlsub.h +// Purpose: common functionality of wxItemContainer-derived controls +// Author: Vadim Zeitlin +// Created: 2007-07-25 +// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MOTIF_CTRLSUB_H_ +#define _WX_MOTIF_CTRLSUB_H_ + +#include "wx/dynarray.h" +#include "wx/generic/ctrlsub.h" + +// ---------------------------------------------------------------------------- +// wxControlWithItems +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxControlWithItems : public wxControlWithItemsGeneric +{ +public: + wxControlWithItems() { } + +protected: + // Motif functions inserting items in the control interpret positions + // differently from wx: they're 1-based and 0 means to append + unsigned int GetMotifPosition(unsigned int pos) const + { + return pos == GetCount() ? 0 : pos + 1; + } + +private: + wxDECLARE_ABSTRACT_CLASS(wxControlWithItems); + wxDECLARE_NO_COPY_CLASS(wxControlWithItems); +}; + +#endif // _WX_MOTIF_CTRLSUB_H_ + diff --git a/lib/wxWidgets/include/wx/motif/cursor.h b/lib/wxWidgets/include/wx/motif/cursor.h new file mode 100644 index 0000000..6fdf541 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/cursor.h @@ -0,0 +1,72 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/cursor.h +// Purpose: wxCursor class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CURSOR_H_ +#define _WX_CURSOR_H_ + +#include "wx/gdicmn.h" + +class WXDLLIMPEXP_FWD_CORE wxImage; + +// Cursor +class WXDLLIMPEXP_CORE wxCursor : public wxCursorBase +{ +public: + wxCursor(); + + wxCursor(const char bits[], int width, int height, + int hotSpotX = -1, int hotSpotY = -1, + const char maskBits[] = NULL, + const wxColour* fg = NULL, const wxColour* bg = NULL); + + wxCursor(const wxString& name, + wxBitmapType type = wxCURSOR_DEFAULT_TYPE, + int hotSpotX = 0, int hotSpotY = 0); + +#if wxUSE_IMAGE + wxCursor(const wxImage& image); + wxCursor(const char* const* xpmData); +#endif + + wxCursor(wxStockCursor id) { InitFromStock(id); } +#if WXWIN_COMPATIBILITY_2_8 + wxCursor(int id) { InitFromStock((wxStockCursor)id); } +#endif + + virtual ~wxCursor(); + + // Motif-specific. + // Create/get a cursor for the current display + WXCursor GetXCursor(WXDisplay* display) const; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + +private: + void InitFromStock(wxStockCursor); + +#if wxUSE_IMAGE + void InitFromImage(const wxImage& image); +#endif + + void Create(const char bits[], int width, int height, + int hotSpotX = -1, int hotSpotY = -1, + const char maskBits[] = NULL); + void Create(WXPixmap cursor, WXPixmap mask, int hotSpotX, int hotSpotY); + + // Make a cursor from standard id + WXCursor MakeCursor(WXDisplay* display, wxStockCursor id) const; + + wxDECLARE_DYNAMIC_CLASS(wxCursor); +}; + +#endif +// _WX_CURSOR_H_ diff --git a/lib/wxWidgets/include/wx/motif/dataform.h b/lib/wxWidgets/include/wx/motif/dataform.h new file mode 100644 index 0000000..e1cc2d6 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/dataform.h @@ -0,0 +1,63 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/dataform.h +// Purpose: declaration of the wxDataFormat class +// Author: Robert Roebling +// Modified by: +// Created: 19.10.99 (extracted from motif/dataobj.h) +// Copyright: (c) 1999 Robert Roebling +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MOTIF_DATAFORM_H +#define _WX_MOTIF_DATAFORM_H + +class WXDLLIMPEXP_CORE wxDataFormat +{ +public: + // the clipboard formats under Xt are Atoms + typedef Atom NativeFormat; + + wxDataFormat(); + wxDataFormat( wxDataFormatId type ); + wxDataFormat( const wxString &id ); + wxDataFormat( NativeFormat format ); + + wxDataFormat& operator=(NativeFormat format) + { SetId(format); return *this; } + + // comparison (must have both versions) + bool operator==(NativeFormat format) const + { return m_format == (NativeFormat)format; } + bool operator!=(NativeFormat format) const + { return m_format != (NativeFormat)format; } + bool operator==(wxDataFormatId format) const + { return m_type == (wxDataFormatId)format; } + bool operator!=(wxDataFormatId format) const + { return m_type != (wxDataFormatId)format; } + + // explicit and implicit conversions to NativeFormat which is one of + // standard data types (implicit conversion is useful for preserving the + // compatibility with old code) + NativeFormat GetFormatId() const { return m_format; } + operator NativeFormat() const { return m_format; } + + void SetId( NativeFormat format ); + + // string ids are used for custom types - this SetId() must be used for + // application-specific formats + wxString GetId() const; + void SetId( const wxString& id ); + + // implementation + wxDataFormatId GetType() const; + +private: + wxDataFormatId m_type; + NativeFormat m_format; + + void PrepareFormats(); + void SetType( wxDataFormatId type ); +}; + + +#endif // _WX_MOTIF_DATAFORM_H diff --git a/lib/wxWidgets/include/wx/motif/dataobj.h b/lib/wxWidgets/include/wx/motif/dataobj.h new file mode 100644 index 0000000..e88284f --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/dataobj.h @@ -0,0 +1,23 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/dataobj.h +// Purpose: declaration of the wxDataObject class for Motif +// Author: Julian Smart +// Copyright: (c) 1998 Julian Smart +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MOTIF_DATAOBJ_H_ +#define _WX_MOTIF_DATAOBJ_H_ + +// ---------------------------------------------------------------------------- +// wxDataObject is the same as wxDataObjectBase under wxMotif +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataObject : public wxDataObjectBase +{ +public: + virtual ~wxDataObject(); +}; + +#endif //_WX_MOTIF_DATAOBJ_H_ + diff --git a/lib/wxWidgets/include/wx/motif/dataobj2.h b/lib/wxWidgets/include/wx/motif/dataobj2.h new file mode 100644 index 0000000..d3f274b --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/dataobj2.h @@ -0,0 +1,43 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/dataobj2.h +// Purpose: declaration of standard wxDataObjectSimple-derived classes +// Author: Mattia Barbon +// Created: 27.04.03 +// Copyright: (c) 2003 Mattia Barbon +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MOTIF_DATAOBJ2_H_ +#define _WX_MOTIF_DATAOBJ2_H_ + +// ---------------------------------------------------------------------------- +// wxBitmapDataObject is a specialization of wxDataObject for bitmaps +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBitmapDataObject : public wxBitmapDataObjectBase +{ +public: + // ctors + wxBitmapDataObject() + : wxBitmapDataObjectBase() { } + wxBitmapDataObject(const wxBitmap& bitmap) + : wxBitmapDataObjectBase(bitmap) { } + + // implement base class pure virtuals + // ---------------------------------- + virtual size_t GetDataSize() const; + virtual bool GetDataHere(void *buf) const; + virtual bool SetData(size_t len, const void *buf); + + // unhide base class virtual functions + virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const + { return GetDataSize(); } + virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), + void *buf) const + { return GetDataHere(buf); } + virtual bool SetData(const wxDataFormat& WXUNUSED(format), + size_t len, const void *buf) + { return SetData(len, buf); } +}; + +#endif // _WX_MOTIF_DATAOBJ2_H_ diff --git a/lib/wxWidgets/include/wx/motif/dc.h b/lib/wxWidgets/include/wx/motif/dc.h new file mode 100644 index 0000000..159145f --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/dc.h @@ -0,0 +1,61 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/dc.h +// Purpose: wxMotifDCImpl class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DC_H_ +#define _WX_DC_H_ + +#include "wx/dc.h" + +// ---------------------------------------------------------------------------- +// wxMotifDCImpl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMotifDCImpl : public wxDCImpl +{ +public: + wxMotifDCImpl(wxDC *owner); + + virtual wxSize GetPPI() const; + +protected: + virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); + virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, + bool useMask = false); + + virtual void DoSetClippingRegion(wxCoord x, wxCoord y, + wxCoord width, wxCoord height); + virtual void DoGetSize(int *width, int *height) const; + virtual void DoGetSizeMM(int* width, int* height) const; + +public: + // implementation + wxCoord XDEV2LOG(wxCoord x) const { return DeviceToLogicalX(x); } + wxCoord XDEV2LOGREL(wxCoord x) const { return DeviceToLogicalXRel(x); } + wxCoord YDEV2LOG(wxCoord y) const { return DeviceToLogicalY(y); } + wxCoord YDEV2LOGREL(wxCoord y) const { return DeviceToLogicalYRel(y); } + wxCoord XLOG2DEV(wxCoord x) const { return LogicalToDeviceX(x); } + wxCoord XLOG2DEVREL(wxCoord x) const { return LogicalToDeviceXRel(x); } + wxCoord YLOG2DEV(wxCoord y) const { return LogicalToDeviceY(y); } + wxCoord YLOG2DEVREL(wxCoord y) const { return LogicalToDeviceYRel(y); } + + // Without device translation, for backing pixmap purposes + wxCoord XLOG2DEV_2(wxCoord x) const + { + return wxRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX; + } + wxCoord YLOG2DEV_2(wxCoord y) const + { + return wxRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY; + } + + wxDECLARE_DYNAMIC_CLASS(wxMotifDCImpl); +}; + +#endif // _WX_DC_H_ diff --git a/lib/wxWidgets/include/wx/motif/dcclient.h b/lib/wxWidgets/include/wx/motif/dcclient.h new file mode 100644 index 0000000..2aaa4ac --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/dcclient.h @@ -0,0 +1,181 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/dcclient.h +// Purpose: wxClientDCImpl, wxPaintDCImpl and wxWindowDCImpl classes +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCCLIENT_H_ +#define _WX_DCCLIENT_H_ + +#include "wx/motif/dc.h" + +class WXDLLIMPEXP_FWD_CORE wxWindow; + +//----------------------------------------------------------------------------- +// wxWindowDCImpl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWindowDCImpl : public wxMotifDCImpl +{ +public: + wxWindowDCImpl(wxDC *owner); + wxWindowDCImpl(wxDC *owner, wxWindow *win); + + virtual ~wxWindowDCImpl(); + + // TODO this function is Motif-only for now - should it go into base class? + void Clear(const wxRect& rect); + + // implement base class pure virtuals + // ---------------------------------- + + virtual void Clear(); + + virtual void SetFont(const wxFont& font); + virtual void SetPen(const wxPen& pen); + virtual void SetBrush(const wxBrush& brush); + virtual void SetBackground(const wxBrush& brush); + virtual void SetBackgroundMode(int mode); + virtual void SetPalette(const wxPalette& palette); + virtual void SetLogicalFunction( wxRasterOperationMode function ); + + virtual void SetTextForeground(const wxColour& colour); + virtual void SetTextBackground(const wxColour& colour); + + virtual wxCoord GetCharHeight() const; + virtual wxCoord GetCharWidth() const; + virtual void DoGetTextExtent(const wxString& string, + wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + const wxFont *theFont = NULL) const; + + virtual bool CanDrawBitmap() const; + virtual bool CanGetTextExtent() const; + + virtual int GetDepth() const; + virtual wxSize GetPPI() const; + + virtual void DestroyClippingRegion(); + + // Helper function for setting clipping + void SetDCClipping(WXRegion region); + + // implementation from now on + // -------------------------- + + WXGC GetGC() const { return m_gc; } + WXGC GetBackingGC() const { return m_gcBacking; } + WXDisplay* GetDisplay() const { return m_display; } + bool GetAutoSetting() const { return (m_autoSetting != 0); } // See comment in dcclient.cpp + void SetAutoSetting(bool flag) { m_autoSetting = flag; } + +protected: + // note that this function will call colour.SetPixel, + // and will do one of curCol = colour, curCol = wxWHITE, curCol = wxBLACK + // roundToWhite has an effect for monochrome display only + // if roundToWhite == true then the colour will be set to white unless + // it is RGB 0x000000;if roundToWhite == true the colour wull be set to + // black unless it id RGB 0xffffff + WXPixel CalculatePixel(wxColour& colour, wxColour& curCol, + bool roundToWhite) const; + // sets the foreground pixel taking into account the + // currently selected logical operation + void SetForegroundPixelWithLogicalFunction(WXPixel pixel); + + virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, + wxFloodFillStyle style = wxFLOOD_SURFACE); + + virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const; + + virtual void DoDrawPoint(wxCoord x, wxCoord y); + virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); + + virtual void DoDrawArc(wxCoord x1, wxCoord y1, + wxCoord x2, wxCoord y2, + wxCoord xc, wxCoord yc); + virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, + double sa, double ea); + + virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, + wxCoord width, wxCoord height, + double radius); + virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + + virtual void DoCrossHair(wxCoord x, wxCoord y); + + virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); + virtual void DoDrawRotatedText(const wxString &text, wxCoord x, wxCoord y, double angle); + + virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, + wxDC *source, wxCoord xsrc, wxCoord ysrc, + wxRasterOperationMode rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); + + virtual void DoSetClippingRegion(wxCoord x, wxCoord y, + wxCoord width, wxCoord height); + virtual void DoSetDeviceClippingRegion(const wxRegion& region); + + virtual void DoDrawLines(int n, const wxPoint points[], + wxCoord xoffset, wxCoord yoffset); + virtual void DoDrawPolygon(int n, const wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + wxPolygonFillMode fillStyle = wxODDEVEN_RULE); + + void DoGetSize( int *width, int *height ) const; + + // common part of constructors + void Init(); + + WXGC m_gc; + WXGC m_gcBacking; + WXDisplay* m_display; + wxWindow* m_window; + // Pixmap for drawing on + WXPixmap m_pixmap; + // Last clipping region set on th GC, this is the combination + // of paint clipping region and all user-defined clipping regions + WXRegion m_clipRegion; + + // Not sure if we'll need all of these + WXPixel m_backgroundPixel; + wxColour m_currentColour; + int m_currentPenWidth ; + int m_currentPenJoin ; + int m_currentPenCap ; + int m_currentPenDashCount ; + wxX11Dash* m_currentPenDash ; + wxBitmap m_currentStipple ; + int m_currentStyle ; + int m_currentFill ; + int m_autoSetting ; // See comment in dcclient.cpp + + wxDECLARE_DYNAMIC_CLASS(wxWindowDCImpl); +}; + +class WXDLLIMPEXP_CORE wxPaintDCImpl: public wxWindowDCImpl +{ +public: + wxPaintDCImpl(wxDC *owner) : wxWindowDCImpl(owner) { } + wxPaintDCImpl(wxDC *owner, wxWindow* win); + + virtual ~wxPaintDCImpl(); + + wxDECLARE_DYNAMIC_CLASS(wxPaintDCImpl); +}; + +class WXDLLIMPEXP_CORE wxClientDCImpl: public wxWindowDCImpl +{ +public: + wxClientDCImpl(wxDC *owner) : wxWindowDCImpl(owner) { } + wxClientDCImpl(wxDC *owner, wxWindow* win) + : wxWindowDCImpl(owner, win) { } + + wxDECLARE_DYNAMIC_CLASS(wxClientDCImpl); +}; + +#endif // _WX_DCCLIENT_H_ diff --git a/lib/wxWidgets/include/wx/motif/dcmemory.h b/lib/wxWidgets/include/wx/motif/dcmemory.h new file mode 100644 index 0000000..2a56d8d --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/dcmemory.h @@ -0,0 +1,44 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/dcmemory.h +// Purpose: wxMemoryDCImpl class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCMEMORY_H_ +#define _WX_DCMEMORY_H_ + +#include "wx/motif/dcclient.h" + +class WXDLLIMPEXP_CORE wxMemoryDCImpl : public wxWindowDCImpl +{ +public: + wxMemoryDCImpl(wxMemoryDC *owner) : wxWindowDCImpl(owner) { Init(); } + wxMemoryDCImpl(wxMemoryDC *owner, wxBitmap& bitmap) + : wxWindowDCImpl(owner) + { + Init(); + DoSelect(bitmap); + } + + wxMemoryDCImpl(wxMemoryDC *owner, wxDC *dc); + virtual ~wxMemoryDCImpl(); + + virtual void DoGetSize( int *width, int *height ) const; + virtual void DoSelect(const wxBitmap& bitmap); + +private: + friend class wxPaintDC; + + void Init(); + + wxBitmap m_bitmap; + + wxDECLARE_DYNAMIC_CLASS(wxMemoryDCImpl); +}; + +#endif +// _WX_DCMEMORY_H_ diff --git a/lib/wxWidgets/include/wx/motif/dcprint.h b/lib/wxWidgets/include/wx/motif/dcprint.h new file mode 100644 index 0000000..7e0a9f2 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/dcprint.h @@ -0,0 +1,31 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/dcprint.h +// Purpose: wxPrinterDC class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCPRINT_H_ +#define _WX_DCPRINT_H_ + +#include "wx/motif/dc.h" + +class WXDLLIMPEXP_CORE wxPrinterDC : public wxMotifDCImpl +{ +public: + // Create a printer DC + wxPrinterDCImpl(const wxString& driver, const wxString& device, + const wxString& output, + bool interactive = true, + wxPrintOrientation orientation = wxPORTRAIT); + virtual ~wxPrinterDC(); + + wxRect GetPaperRect() const; + + wxDECLARE_CLASS(wxPrinterDCImpl); +}; + +#endif // _WX_DCPRINT_H_ diff --git a/lib/wxWidgets/include/wx/motif/dcscreen.h b/lib/wxWidgets/include/wx/motif/dcscreen.h new file mode 100644 index 0000000..1b53041 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/dcscreen.h @@ -0,0 +1,41 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/dcscreen.h +// Purpose: wxScreenDCImpl class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCSCREEN_H_ +#define _WX_DCSCREEN_H_ + +#include "wx/motif/dcclient.h" + +class WXDLLIMPEXP_CORE wxScreenDCImpl : public wxWindowDCImpl +{ +public: + // Create a DC representing the whole screen + wxScreenDCImpl(wxScreenDC *owner); + virtual ~wxScreenDCImpl(); + + // Compatibility with X's requirements for + // drawing on top of all windows + static bool StartDrawingOnTop(wxWindow* window); + static bool StartDrawingOnTop(wxRect* rect = NULL); + static bool EndDrawingOnTop(); + +private: + static WXWindow sm_overlayWindow; + + // If we have started transparent drawing at a non-(0,0) point + // then we will have to adjust the device origin in the + // constructor. + static int sm_overlayWindowX; + static int sm_overlayWindowY; + + wxDECLARE_DYNAMIC_CLASS(wxScreenDCImpl); +}; + +#endif // _WX_DCSCREEN_H_ diff --git a/lib/wxWidgets/include/wx/motif/dialog.h b/lib/wxWidgets/include/wx/motif/dialog.h new file mode 100644 index 0000000..2895525 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/dialog.h @@ -0,0 +1,88 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/dialog.h +// Purpose: wxDialog class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DIALOG_H_ +#define _WX_DIALOG_H_ + +class WXDLLIMPEXP_FWD_CORE wxEventLoop; + +// Dialog boxes +class WXDLLIMPEXP_CORE wxDialog : public wxDialogBase +{ +public: + wxDialog(); + + wxDialog(wxWindow *parent, wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxASCII_STR(wxDialogNameStr)) + { + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxASCII_STR(wxDialogNameStr)); + + virtual ~wxDialog(); + + virtual bool Destroy(); + + virtual bool Show(bool show = true); + + void SetTitle(const wxString& title); + + void SetModal(bool flag); + + virtual bool IsModal() const + { return m_modalShowing; } + + virtual int ShowModal(); + virtual void EndModal(int retCode); + + // Implementation + virtual void ChangeFont(bool keepOriginalSize = true); + virtual void ChangeBackgroundColour(); + virtual void ChangeForegroundColour(); + WXWidget GetTopWidget() const { return m_mainWidget; } + WXWidget GetClientWidget() const { return m_mainWidget; } + +private: + virtual bool XmDoCreateTLW(wxWindow* parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name); + + + //// Motif-specific + bool m_modalShowing; + wxEventLoop* m_eventLoop; + +protected: + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + + virtual void DoSetClientSize(int width, int height); + + +private: + wxDECLARE_DYNAMIC_CLASS(wxDialog); +}; + +#endif // _WX_DIALOG_H_ diff --git a/lib/wxWidgets/include/wx/motif/dnd.h b/lib/wxWidgets/include/wx/motif/dnd.h new file mode 100644 index 0000000..bc6baaa --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/dnd.h @@ -0,0 +1,171 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/dnd.h +// Purpose: declaration of wxDropTarget, wxDropSource classes +// Author: Julian Smart +// Copyright: (c) 1998 Vadim Zeitlin, Robert Roebling, Julian Smart +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DND_H_ +#define _WX_DND_H_ + +#include "wx/defs.h" + +#if wxUSE_DRAG_AND_DROP + +#include "wx/object.h" +#include "wx/string.h" +#include "wx/dataobj.h" +#include "wx/cursor.h" + +//------------------------------------------------------------------------- +// classes +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxWindow; + +class WXDLLIMPEXP_FWD_CORE wxDropTarget; +class WXDLLIMPEXP_FWD_CORE wxTextDropTarget; +class WXDLLIMPEXP_FWD_CORE wxFileDropTarget; +class WXDLLIMPEXP_FWD_CORE wxPrivateDropTarget; + +class WXDLLIMPEXP_FWD_CORE wxDropSource; + +//------------------------------------------------------------------------- +// wxDropTarget +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDropTarget: public wxObject +{ +public: + + wxDropTarget(); + virtual ~wxDropTarget(); + + virtual void OnEnter() { } + virtual void OnLeave() { } + virtual bool OnDrop( long x, long y, const void *data, size_t size ) = 0; + + // Override these to indicate what kind of data you support: + + virtual size_t GetFormatCount() const = 0; + virtual wxDataFormat GetFormat(size_t n) const = 0; + + // implementation +}; + +//------------------------------------------------------------------------- +// wxTextDropTarget +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTextDropTarget: public wxDropTarget +{ +public: + + wxTextDropTarget() {} + virtual bool OnDrop( long x, long y, const void *data, size_t size ); + virtual bool OnDropText( long x, long y, const char *psz ); + +protected: + + virtual size_t GetFormatCount() const; + virtual wxDataFormat GetFormat(size_t n) const; +}; + +//------------------------------------------------------------------------- +// wxPrivateDropTarget +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPrivateDropTarget: public wxDropTarget +{ +public: + + wxPrivateDropTarget(); + + // you have to override OnDrop to get at the data + + // the string ID identifies the format of clipboard or DnD data. a word + // processor would e.g. add a wxTextDataObject and a wxPrivateDataObject + // to the clipboard - the latter with the Id "WXWORD_FORMAT". + + void SetId( const wxString& id ) + { m_id = id; } + + wxString GetId() + { return m_id; } + +private: + + virtual size_t GetFormatCount() const; + virtual wxDataFormat GetFormat(size_t n) const; + + wxString m_id; +}; + +// ---------------------------------------------------------------------------- +// A drop target which accepts files (dragged from File Manager or Explorer) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFileDropTarget: public wxDropTarget +{ +public: + + wxFileDropTarget() {} + + virtual bool OnDrop( long x, long y, const void *data, size_t size ); + virtual bool OnDropFiles( long x, long y, + size_t nFiles, const char * const aszFiles[] ); + +protected: + + virtual size_t GetFormatCount() const; + virtual wxDataFormat GetFormat(size_t n) const; +}; + +//------------------------------------------------------------------------- +// wxDropSource +//------------------------------------------------------------------------- + +enum wxDragResult +{ + wxDragError, // error prevented the d&d operation from completing + wxDragNone, // drag target didn't accept the data + wxDragCopy, // the data was successfully copied + wxDragMove, // the data was successfully moved + wxDragCancel // the operation was cancelled by user (not an error) +}; + +class WXDLLIMPEXP_CORE wxDropSource: public wxObject +{ +public: + + wxDropSource( wxWindow *win ); + wxDropSource( wxDataObject &data, wxWindow *win ); + + virtual ~wxDropSource(void); + + void SetData( wxDataObject &data ); + wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly); + + virtual bool GiveFeedback( wxDragResult WXUNUSED(effect), bool WXUNUSED(bScrolling) ) { return true; } + + // implementation +#if 0 + void RegisterWindow(void); + void UnregisterWindow(void); + + wxWindow *m_window; + wxDragResult m_retValue; + wxDataObject *m_data; + + wxCursor m_defaultCursor; + wxCursor m_goaheadCursor; +#endif +}; + +#endif + +// wxUSE_DRAG_AND_DROP + +#endif +//_WX_DND_H_ diff --git a/lib/wxWidgets/include/wx/motif/filedlg.h b/lib/wxWidgets/include/wx/motif/filedlg.h new file mode 100644 index 0000000..6cc86bf --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/filedlg.h @@ -0,0 +1,41 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/filedlg.h +// Purpose: wxFileDialog class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FILEDLG_H_ +#define _WX_FILEDLG_H_ + +//------------------------------------------------------------------------- +// wxFileDialog +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFileDialog: public wxFileDialogBase +{ + wxDECLARE_DYNAMIC_CLASS(wxFileDialog); +public: + + // For Motif + static wxString m_fileSelectorAnswer; + static bool m_fileSelectorReturned; + +public: + wxFileDialog(wxWindow *parent, + const wxString& message = wxASCII_STR(wxFileSelectorPromptStr), + const wxString& defaultDir = wxEmptyString, + const wxString& defaultFile = wxEmptyString, + const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + long style = wxFD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + const wxString& name = wxASCII_STR(wxFileDialogNameStr)); + + virtual int ShowModal(); +}; + +#endif // _WX_FILEDLG_H_ diff --git a/lib/wxWidgets/include/wx/motif/font.h b/lib/wxWidgets/include/wx/motif/font.h new file mode 100644 index 0000000..6dccfcc --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/font.h @@ -0,0 +1,153 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/font.h +// Purpose: wxFont class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONT_H_ +#define _WX_FONT_H_ + +#if __WXMOTIF20__ && !__WXLESSTIF__ + #define wxMOTIF_USE_RENDER_TABLE 1 +#else + #define wxMOTIF_USE_RENDER_TABLE 0 +#endif +#define wxMOTIF_NEW_FONT_HANDLING wxMOTIF_USE_RENDER_TABLE + +class wxXFont; + +// Font +class WXDLLIMPEXP_CORE wxFont : public wxFontBase +{ +public: + // ctors and such + wxFont() { } + + wxFont(const wxFontInfo& info); + + wxFont(const wxString& nativeFontInfoString); + + wxFont(const wxNativeFontInfo& info); + + wxFont(int size, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + Create(size, family, style, weight, underlined, face, encoding); + } + + wxFont(const wxSize& pixelSize, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + Create(10, family, style, weight, underlined, face, encoding); + SetPixelSize(pixelSize); + } + + bool Create(int size, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + + // wxMOTIF-specific + bool Create(const wxString& fontname, + wxFontEncoding fontenc = wxFONTENCODING_DEFAULT); + bool Create(const wxNativeFontInfo& fontinfo); + + virtual ~wxFont(); + + // implement base class pure virtuals + virtual double GetFractionalPointSize() const; + virtual wxFontStyle GetStyle() const; + virtual int GetNumericWeight() const; + virtual bool GetUnderlined() const; + virtual wxString GetFaceName() const; + virtual wxFontEncoding GetEncoding() const; + virtual const wxNativeFontInfo *GetNativeFontInfo() const; + + virtual void SetFractionalPointSize(double pointSize); + virtual void SetFamily(wxFontFamily family); + virtual void SetStyle(wxFontStyle style); + virtual void SetNumericWeight(int weight); + virtual bool SetFaceName(const wxString& faceName); + virtual void SetUnderlined(bool underlined); + virtual void SetEncoding(wxFontEncoding encoding); + + wxDECLARE_COMMON_FONT_METHODS(); + + wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants") + wxFont(int size, + int family, + int style, + int weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); + } + + + // Implementation + + // Find an existing, or create a new, XFontStruct + // based on this wxFont and the given scale. Append the + // font to list in the private data for future reference. + + // TODO This is a fairly basic implementation, that doesn't + // allow for different facenames, and also doesn't do a mapping + // between 'standard' facenames (e.g. Arial, Helvetica, Times Roman etc.) + // and the fonts that are available on a particular system. + // Maybe we need to scan the user's machine to build up a profile + // of the fonts and a mapping file. + + // Return font struct, and optionally the Motif font list + wxXFont *GetInternalFont(double scale = 1.0, + WXDisplay* display = NULL) const; + + // These two are helper functions for convenient access of the above. +#if wxMOTIF_USE_RENDER_TABLE + WXFontSet GetFontSet(double scale, WXDisplay* display = NULL) const; + WXRenderTable GetRenderTable(WXDisplay* display) const; +#else // if !wxMOTIF_USE_RENDER_TABLE + WXFontStructPtr GetFontStruct(double scale = 1.0, + WXDisplay* display = NULL) const; + WXFontList GetFontList(double scale = 1.0, + WXDisplay* display = NULL) const; +#endif // !wxMOTIF_USE_RENDER_TABLE + // returns either a XmFontList or XmRenderTable, depending + // on Motif version + WXFontType GetFontType(WXDisplay* display) const; + // like the function above but does a copy for XmFontList + WXFontType GetFontTypeC(WXDisplay* display) const; + static WXString GetFontTag(); + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + + virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info ); + virtual wxFontFamily DoGetFamily() const; + + void Unshare(); + +private: + wxDECLARE_DYNAMIC_CLASS(wxFont); +}; + +#endif // _WX_FONT_H_ diff --git a/lib/wxWidgets/include/wx/motif/frame.h b/lib/wxWidgets/include/wx/motif/frame.h new file mode 100644 index 0000000..a002647 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/frame.h @@ -0,0 +1,128 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/frame.h +// Purpose: wxFrame class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MOTIF_FRAME_H_ +#define _WX_MOTIF_FRAME_H_ + +class WXDLLIMPEXP_CORE wxFrame : public wxFrameBase +{ +public: + wxFrame() { Init(); } + wxFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Init(); + + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + virtual ~wxFrame(); + + virtual bool Show(bool show = true); + + // Set menu bar + void SetMenuBar(wxMenuBar *menu_bar); + + // Set title + void SetTitle(const wxString& title); + + // Set icon + virtual void SetIcons(const wxIconBundle& icons); + +#if wxUSE_STATUSBAR + virtual void PositionStatusBar(); +#endif // wxUSE_STATUSBAR + + // Create toolbar +#if wxUSE_TOOLBAR + virtual wxToolBar* CreateToolBar(long style = -1, + wxWindowID id = wxID_ANY, + const wxString& name = wxASCII_STR(wxToolBarNameStr)); + virtual void SetToolBar(wxToolBar *toolbar); + virtual void PositionToolBar(); +#endif // wxUSE_TOOLBAR + + // Implementation only from now on + // ------------------------------- + + void OnSysColourChanged(wxSysColourChangedEvent& event); + void OnActivate(wxActivateEvent& event); + + virtual void ChangeFont(bool keepOriginalSize = true); + virtual void ChangeBackgroundColour(); + virtual void ChangeForegroundColour(); + WXWidget GetMenuBarWidget() const; + WXWidget GetShellWidget() const { return m_frameShell; } + WXWidget GetWorkAreaWidget() const { return m_workArea; } + WXWidget GetClientAreaWidget() const { return m_clientArea; } + WXWidget GetTopWidget() const { return m_frameShell; } + + virtual WXWidget GetMainWidget() const { return m_mainWidget; } + + // The widget that can have children on it + WXWidget GetClientWidget() const; + bool GetVisibleStatus() const { return m_visibleStatus; } + void SetVisibleStatus( bool status ) { m_visibleStatus = status; } + + bool PreResize(); + + // for generic/mdig.h + virtual void DoGetClientSize(int *width, int *height) const; + +private: + // common part of all ctors + void Init(); + + // set a single icon for the frame + void DoSetIcon( const wxIcon& icon ); + + //// Motif-specific + WXWidget m_frameShell; + WXWidget m_workArea; + WXWidget m_clientArea; + bool m_visibleStatus; + bool m_iconized; + + virtual void DoGetSize(int *width, int *height) const; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + virtual void DoSetClientSize(int width, int height); + +private: + virtual bool XmDoCreateTLW(wxWindow* parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name); + + + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxFrame); +}; + +#endif // _WX_MOTIF_FRAME_H_ + diff --git a/lib/wxWidgets/include/wx/motif/gauge.h b/lib/wxWidgets/include/wx/motif/gauge.h new file mode 100644 index 0000000..2a23b51 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/gauge.h @@ -0,0 +1,55 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/gauge.h +// Purpose: wxGauge class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GAUGE_H_ +#define _WX_GAUGE_H_ + +// Group box +class WXDLLIMPEXP_CORE wxGauge : public wxGaugeBase +{ + wxDECLARE_DYNAMIC_CLASS(wxGauge); + +public: + inline wxGauge() { m_rangeMax = 0; m_gaugePos = 0; } + + inline wxGauge(wxWindow *parent, wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxGaugeNameStr)) + { + Create(parent, id, range, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxGaugeNameStr)); + + void SetRange(int r); + void SetValue(int pos); + + int GetRange() const ; + int GetValue() const ; + + virtual void Command(wxCommandEvent& WXUNUSED(event)) {} ; + +private: + virtual wxSize DoGetBestSize() const; + virtual void DoMoveWindow(int x, int y, int width, int height); +}; + +#endif +// _WX_GAUGE_H_ diff --git a/lib/wxWidgets/include/wx/motif/icon.h b/lib/wxWidgets/include/wx/motif/icon.h new file mode 100644 index 0000000..898da90 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/icon.h @@ -0,0 +1,58 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/icon.h +// Purpose: wxIcon class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ICON_H_ +#define _WX_ICON_H_ + +#include "wx/bitmap.h" + +// Icon +class WXDLLIMPEXP_CORE wxIcon : public wxBitmap +{ +public: + wxIcon(); + + // Initialize with XBM data + wxIcon(const char bits[], int width, int height); + + // Initialize with XPM data + wxIcon(const char* const* data); + + wxIcon(const wxString& name, wxBitmapType type = wxICON_DEFAULT_TYPE, + int desiredWidth = -1, int desiredHeight = -1) + { + LoadFile(name, type, desiredWidth, desiredHeight); + } + + wxIcon(const wxIconLocation& loc) + { + LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ANY); + } + + virtual ~wxIcon(); + + bool LoadFile(const wxString& name, wxBitmapType type, + int desiredWidth, int desiredHeight); + + // unhide the base class version + virtual bool LoadFile(const wxString& name, + wxBitmapType flags = wxICON_DEFAULT_TYPE) + { return LoadFile(name, flags); } + + // create from bitmap (which should have a mask unless it's monochrome): + // there shouldn't be any implicit bitmap -> icon conversion (i.e. no + // ctors, assignment operators...), but it's ok to have such function + void CopyFromBitmap(const wxBitmap& bmp); + + + wxDECLARE_DYNAMIC_CLASS(wxIcon); +}; + +#endif // _WX_ICON_H_ diff --git a/lib/wxWidgets/include/wx/motif/listbox.h b/lib/wxWidgets/include/wx/motif/listbox.h new file mode 100644 index 0000000..a14075a --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/listbox.h @@ -0,0 +1,104 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/listbox.h +// Purpose: wxListBox class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LISTBOX_H_ +#define _WX_LISTBOX_H_ + +#include "wx/ctrlsub.h" +#include "wx/clntdata.h" + +// forward decl for GetSelections() +class WXDLLIMPEXP_FWD_BASE wxArrayInt; + +// List box item +class WXDLLIMPEXP_CORE wxListBox: public wxListBoxBase +{ + wxDECLARE_DYNAMIC_CLASS(wxListBox); + +public: + wxListBox(); + wxListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)) + { + Create(parent, id, pos, size, n, choices, style, validator, name); + } + + wxListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)) + { + Create(parent, id, pos, size, choices, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + + // implementation of wxControlWithItems + virtual unsigned int GetCount() const; + virtual int DoInsertItems(const wxArrayStringsAdapter& items, + unsigned int pos, + void **clientData, wxClientDataType type); + virtual int GetSelection() const; + virtual void DoDeleteOneItem(unsigned int n); + virtual int FindString(const wxString& s, bool bCase = false) const; + virtual void DoClear(); + virtual void SetString(unsigned int n, const wxString& s); + virtual wxString GetString(unsigned int n) const; + + // implementation of wxListBoxbase + virtual void DoSetSelection(int n, bool select); + virtual void DoSetFirstItem(int n); + virtual int GetSelections(wxArrayInt& aSelections) const; + virtual bool IsSelected(int n) const; + + // For single or multiple choice list item + void Command(wxCommandEvent& event); + + // Implementation + virtual void ChangeBackgroundColour(); + virtual void ChangeForegroundColour(); + WXWidget GetTopWidget() const; + +#if wxUSE_CHECKLISTBOX + virtual void DoToggleItem(int WXUNUSED(item), int WXUNUSED(x)) {} +#endif +protected: + virtual wxSize DoGetBestSize() const; + + unsigned int m_noItems; + +private: + void SetSelectionPolicy(); +}; + +#endif +// _WX_LISTBOX_H_ diff --git a/lib/wxWidgets/include/wx/motif/menu.h b/lib/wxWidgets/include/wx/motif/menu.h new file mode 100644 index 0000000..388bd80 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/menu.h @@ -0,0 +1,174 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/menu.h +// Purpose: wxMenu, wxMenuBar classes +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MOTIF_MENU_H_ +#define _WX_MOTIF_MENU_H_ + +#include "wx/colour.h" +#include "wx/font.h" +#include "wx/arrstr.h" + +class WXDLLIMPEXP_FWD_CORE wxFrame; + +// ---------------------------------------------------------------------------- +// Menu +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMenu : public wxMenuBase +{ +public: + // ctors & dtor + wxMenu(const wxString& title, long style = 0) + : wxMenuBase(title, style) { Init(); } + + wxMenu(long style = 0) : wxMenuBase(style) { Init(); } + + virtual ~wxMenu(); + + // implement base class virtuals + virtual wxMenuItem* DoAppend(wxMenuItem *item); + virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item); + virtual wxMenuItem* DoRemove(wxMenuItem *item); + + virtual void Break(); + + virtual void SetTitle(const wxString& title); + + bool ProcessCommand(wxCommandEvent& event); + + //// Motif-specific + WXWidget GetButtonWidget() const { return m_buttonWidget; } + void SetButtonWidget(WXWidget buttonWidget) { m_buttonWidget = buttonWidget; } + + WXWidget GetMainWidget() const { return m_menuWidget; } + + int GetId() const { return m_menuId; } + void SetId(int id) { m_menuId = id; } + + void SetMenuBar(wxMenuBar* menuBar) { m_menuBar = menuBar; } + wxMenuBar* GetMenuBar() const { return m_menuBar; } + + void CreatePopup(WXWidget logicalParent, int x, int y); + void DestroyPopup(); + void ShowPopup(int x, int y); + void HidePopup(); + + WXWidget CreateMenu(wxMenuBar *menuBar, WXWidget parent, wxMenu *topMenu, + size_t index, const wxString& title = wxEmptyString, + bool isPulldown = false); + + // For popups, need to destroy, then recreate menu for a different (or + // possibly same) window, since the parent may change. + void DestroyMenu(bool full); + WXWidget FindMenuItem(int id, wxMenuItem **it = NULL) const; + + const wxColour& GetBackgroundColour() const { return m_backgroundColour; } + const wxColour& GetForegroundColour() const { return m_foregroundColour; } + const wxFont& GetFont() const { return m_font; } + + void SetBackgroundColour(const wxColour& colour); + void SetForegroundColour(const wxColour& colour); + void SetFont(const wxFont& colour); + void ChangeFont(bool keepOriginalSize = false); + + WXWidget GetHandle() const { return m_menuWidget; } + + bool IsTearOff() const { return (m_style & wxMENU_TEAROFF) != 0; } + + void DestroyWidgetAndDetach(); +public: + // Motif-specific data + int m_numColumns; + WXWidget m_menuWidget; + WXWidget m_popupShell; // For holding the popup shell widget + WXWidget m_buttonWidget; // The actual string, so we can grey it etc. + int m_menuId; + wxMenu* m_topLevelMenu ; + bool m_ownedByMenuBar; + wxColour m_foregroundColour; + wxColour m_backgroundColour; + wxFont m_font; + +private: + // common code for both constructors: + void Init(); + + wxDECLARE_DYNAMIC_CLASS(wxMenu); +}; + +// ---------------------------------------------------------------------------- +// Menu Bar +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMenuBar : public wxMenuBarBase +{ +public: + wxMenuBar() { Init(); } + wxMenuBar(long WXUNUSED(style)) { Init(); } + wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0); + wxMenuBar(size_t n, wxMenu *menus[], const wxArrayString& titles, long style = 0); + virtual ~wxMenuBar(); + + // implement base class (pure) virtuals + // ------------------------------------ + + virtual bool Append( wxMenu *menu, const wxString &title ); + virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title); + virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title); + virtual wxMenu *Remove(size_t pos); + + virtual int FindMenuItem(const wxString& menuString, + const wxString& itemString) const; + virtual wxMenuItem* FindItem( int id, wxMenu **menu = NULL ) const; + + virtual void EnableTop( size_t pos, bool flag ); + virtual void SetMenuLabel( size_t pos, const wxString& label ); + virtual wxString GetMenuLabel( size_t pos ) const; + + // implementation only from now on + // ------------------------------- + + wxFrame* GetMenuBarFrame() const { return m_menuBarFrame; } + void SetMenuBarFrame(wxFrame* frame) { m_menuBarFrame = frame; } + WXWidget GetMainWidget() const { return m_mainWidget; } + void SetMainWidget(WXWidget widget) { m_mainWidget = widget; } + + // Create menubar + bool CreateMenuBar(wxFrame* frame); + + // Destroy menubar, but keep data structures intact so we can recreate it. + bool DestroyMenuBar(); + + const wxColour& GetBackgroundColour() const { return m_backgroundColour; } + const wxColour& GetForegroundColour() const { return m_foregroundColour; } + const wxFont& GetFont() const { return m_font; } + + virtual bool SetBackgroundColour(const wxColour& colour); + virtual bool SetForegroundColour(const wxColour& colour); + virtual bool SetFont(const wxFont& colour); + void ChangeFont(bool keepOriginalSize = false); + +public: + // common part of all ctors + void Init(); + + wxArrayString m_titles; + wxFrame *m_menuBarFrame; + + WXWidget m_mainWidget; + + wxColour m_foregroundColour; + wxColour m_backgroundColour; + wxFont m_font; + + wxDECLARE_DYNAMIC_CLASS(wxMenuBar); +}; + +#endif // _WX_MOTIF_MENU_H_ diff --git a/lib/wxWidgets/include/wx/motif/menuitem.h b/lib/wxWidgets/include/wx/motif/menuitem.h new file mode 100644 index 0000000..664ad64 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/menuitem.h @@ -0,0 +1,60 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/menuitem.h +// Purpose: wxMenuItem class +// Author: Vadim Zeitlin +// Modified by: +// Created: 11.11.97 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MOTIF_MENUITEM_H +#define _WX_MOTIF_MENUITEM_H + +#include "wx/bitmap.h" + +class WXDLLIMPEXP_FWD_CORE wxMenuBar; + +// ---------------------------------------------------------------------------- +// wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMenuItem : public wxMenuItemBase +{ +public: + // ctor & dtor + wxMenuItem(wxMenu *parentMenu = NULL, + int id = wxID_SEPARATOR, + const wxString& text = wxEmptyString, + const wxString& help = wxEmptyString, + wxItemKind kind = wxITEM_NORMAL, + wxMenu *subMenu = NULL); + virtual ~wxMenuItem(); + + // accessors (some more are inherited from wxOwnerDrawn or are below) + virtual void SetItemLabel(const wxString& label); + virtual void Enable(bool enable = true); + virtual void Check(bool check = true); + + // implementation from now on + void CreateItem (WXWidget menu, wxMenuBar * menuBar, wxMenu * topMenu, + size_t index); + void DestroyItem(bool full); + + WXWidget GetButtonWidget() const { return m_buttonWidget; } + + wxMenuBar* GetMenuBar() const { return m_menuBar; } + void SetMenuBar(wxMenuBar* menuBar) { m_menuBar = menuBar; } + + wxMenu* GetTopMenu() const { return m_topMenu; } + void SetTopMenu(wxMenu* menu) { m_topMenu = menu; } + +private: + WXWidget m_buttonWidget; + wxMenuBar* m_menuBar; + wxMenu* m_topMenu; // Top-level menu e.g. popup-menu + + wxDECLARE_DYNAMIC_CLASS(wxMenuItem); +}; + +#endif // _WX_MOTIF_MENUITEM_H diff --git a/lib/wxWidgets/include/wx/motif/minifram.h b/lib/wxWidgets/include/wx/motif/minifram.h new file mode 100644 index 0000000..6cc31c6 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/minifram.h @@ -0,0 +1,41 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/minifram.h +// Purpose: wxMiniFrame class. A small frame for e.g. floating toolbars. +// If there is no equivalent on your platform, just make it a +// normal frame. +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MINIFRAM_H_ +#define _WX_MINIFRAM_H_ + +#include "wx/frame.h" + +class WXDLLIMPEXP_CORE wxMiniFrame: public wxFrame { + + wxDECLARE_DYNAMIC_CLASS(wxMiniFrame); + +public: + inline wxMiniFrame() {} + inline wxMiniFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE|wxTINY_CAPTION, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + // Use wxFrame constructor in absence of more specific code. + Create(parent, id, title, pos, size, style, name); + } + + virtual ~wxMiniFrame() {} +protected: +}; + +#endif +// _WX_MINIFRAM_H_ diff --git a/lib/wxWidgets/include/wx/motif/msgdlg.h b/lib/wxWidgets/include/wx/motif/msgdlg.h new file mode 100644 index 0000000..e6774cc --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/msgdlg.h @@ -0,0 +1,43 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/msgdlg.h +// Purpose: wxMessageDialog class. Use generic version if no +// platform-specific implementation. +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSGBOXDLG_H_ +#define _WX_MSGBOXDLG_H_ + +// ---------------------------------------------------------------------------- +// Message box dialog +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMessageDialog : public wxMessageDialogBase +{ +public: + wxMessageDialog(wxWindow *parent, + const wxString& message, + const wxString& caption = wxASCII_STR(wxMessageBoxCaptionStr), + long style = wxOK | wxCENTRE, + const wxPoint& WXUNUSED(pos) = wxDefaultPosition) + : wxMessageDialogBase(parent, message, caption, style) + { + } + + virtual int ShowModal(); + + // implementation only from now on + // called by the Motif callback + void SetResult(long result) { m_result = result; } + +protected: + long m_result; + + wxDECLARE_DYNAMIC_CLASS(wxMessageDialog); +}; + +#endif // _WX_MSGBOXDLG_H_ diff --git a/lib/wxWidgets/include/wx/motif/popupwin.h b/lib/wxWidgets/include/wx/motif/popupwin.h new file mode 100644 index 0000000..8c08fdb --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/popupwin.h @@ -0,0 +1,35 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/popupwin.h +// Purpose: wxPopupWindow class for wxMotif +// Author: Mattia Barbon +// Modified by: +// Created: 28.08.03 +// Copyright: (c) 2003 Mattia Barbon +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MOTIF_POPUPWIN_H_ +#define _WX_MOTIF_POPUPWIN_H_ + +// ---------------------------------------------------------------------------- +// wxPopupWindow +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPopupWindow : public wxPopupWindowBase +{ +public: + wxPopupWindow() { Init(); } + + wxPopupWindow( wxWindow *parent, int flags = wxBORDER_NONE ) + { Init(); (void)Create( parent, flags ); } + + bool Create( wxWindow *parent, int flags = wxBORDER_NONE ); + + virtual bool Show( bool show = true ); +private: + void Init() { m_isShown = false; } + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxPopupWindow); +}; + +#endif // _WX_MOTIF_POPUPWIN_H_ diff --git a/lib/wxWidgets/include/wx/motif/print.h b/lib/wxWidgets/include/wx/motif/print.h new file mode 100644 index 0000000..5217f10 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/print.h @@ -0,0 +1,51 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/print.h +// Purpose: wxPrinter, wxPrintPreview classes +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRINT_H_ +#define _WX_PRINT_H_ + +#include "wx/prntbase.h" + +/* +* Represents the printer: manages printing a wxPrintout object +*/ + +class WXDLLIMPEXP_CORE wxPrinter: public wxPrinterBase +{ + wxDECLARE_DYNAMIC_CLASS(wxPrinter); + +public: + wxPrinter(wxPrintData *data = NULL); + virtual ~wxPrinter(); + + virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true); + virtual bool PrintDialog(wxWindow *parent); + virtual bool Setup(wxWindow *parent); +}; + +/* +* wxPrintPreview +* Programmer creates an object of this class to preview a wxPrintout. +*/ + +class WXDLLIMPEXP_CORE wxPrintPreview: public wxPrintPreviewBase +{ + wxDECLARE_CLASS(wxPrintPreview); + +public: + wxPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting = NULL, wxPrintData *data = NULL); + virtual ~wxPrintPreview(); + + virtual bool Print(bool interactive); + virtual void DetermineScaling(); +}; + +#endif +// _WX_PRINT_H_ diff --git a/lib/wxWidgets/include/wx/motif/private.h b/lib/wxWidgets/include/wx/motif/private.h new file mode 100644 index 0000000..f36fd8d --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/private.h @@ -0,0 +1,222 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/private.h +// Purpose: Private declarations for wxMotif port +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_H_ +#define _WX_PRIVATE_H_ + +#include "wx/defs.h" +#include <X11/Xlib.h> +#include <Xm/Xm.h> +#include "wx/evtloop.h" + +class WXDLLIMPEXP_FWD_CORE wxFont; +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxSize; +class WXDLLIMPEXP_FWD_CORE wxBitmap; +class WXDLLIMPEXP_FWD_CORE wxColour; + +#include "wx/x11/privx.h" + +// Put any private declarations here: native Motif types may be used because +// this header is included after Xm/Xm.h + +// ---------------------------------------------------------------------------- +// convenience macros +// ---------------------------------------------------------------------------- + +#define wxCHECK_MOTIF_VERSION( major, minor ) \ + ( XmVersion >= (major) * 1000 + (minor) ) + +#define wxCHECK_LESSTIF_VERSION( major, minor ) \ + ( LesstifVersion >= (major) * 1000 + (minor) ) + +#define wxCHECK_LESSTIF() ( __WXLESSTIF__ ) + +// some compilers (e.g. Sun CC) give warnings when treating string literals as +// (non const) "char *" but many Motif functions take "char *" parameters which +// are really "const char *" so use this macro to suppress the warnings when we +// know it's ok +#define wxMOTIF_STR(x) const_cast<char *>(x) + +// ---------------------------------------------------------------------------- +// Miscellaneous functions +// ---------------------------------------------------------------------------- + +WXWidget wxCreateBorderWidget( WXWidget parent, long style ); + +// ---------------------------------------------------------------------------- +// common callbacks +// ---------------------------------------------------------------------------- + +// All widgets should have this as their resize proc. +extern void wxWidgetResizeProc(Widget w, XConfigureEvent *event, + String args[], int *num_args); + +// For repainting arbitrary windows +void wxUniversalRepaintProc(Widget w, XtPointer WXUNUSED(c_data), + XEvent *event, char *); + +// ---------------------------------------------------------------------------- +// we maintain a hash table which contains the mapping from Widget to wxWindow +// corresponding to the window for this widget +// ---------------------------------------------------------------------------- + +extern void wxDeleteWindowFromTable(Widget w); +extern wxWindow *wxGetWindowFromTable(Widget w); +extern bool wxAddWindowToTable(Widget w, wxWindow *win); + +// ---------------------------------------------------------------------------- +// wxBitmap related functions +// ---------------------------------------------------------------------------- + +// Creates a bitmap with transparent areas drawn in the given colour. +wxBitmap wxCreateMaskedBitmap(const wxBitmap& bitmap, const wxColour& colour); + +// ---------------------------------------------------------------------------- +// key events related functions +// ---------------------------------------------------------------------------- + +extern char wxFindMnemonic(const char* s); + +extern char * wxFindAccelerator (const char *s); +extern XmString wxFindAcceleratorText (const char *s); + +// ---------------------------------------------------------------------------- +// TranslateXXXEvent() functions - translate Motif event to wxWindow one +// ---------------------------------------------------------------------------- + +extern bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, + Widget widget, const XEvent *xevent); +extern bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, + Widget widget, const XEvent *xevent); + +extern void wxDoChangeForegroundColour(WXWidget widget, + wxColour& foregroundColour); +extern void wxDoChangeBackgroundColour(WXWidget widget, + const wxColour& backgroundColour, + bool changeArmColour = false); +extern void wxDoChangeFont(WXWidget widget, const wxFont& font); +extern void wxGetTextExtent(WXDisplay* display, const wxFont& font, + double scale, + const wxString& string, int* width, int* height, + int* ascent, int* descent); +extern void wxGetTextExtent(const wxWindow* window, const wxString& str, + int* width, int* height, + int* ascent, int* descent); + +#define wxNO_COLORS 0x00 +#define wxBACK_COLORS 0x01 +#define wxFORE_COLORS 0x02 + +extern XColor itemColors[5] ; + +#define wxBACK_INDEX 0 +#define wxFORE_INDEX 1 +#define wxSELE_INDEX 2 +#define wxTOPS_INDEX 3 +#define wxBOTS_INDEX 4 + +// ---------------------------------------------------------------------------- +// XmString/wxString conversion utilities +// ---------------------------------------------------------------------------- + +wxString wxXmStringToString( const XmString& xmString ); +XmString wxStringToXmString( const char* string ); +inline XmString wxStringToXmString( const wxScopedCharBuffer& string ) + { return wxStringToXmString(string.data()); } +inline XmString wxStringToXmString( const wxString& string ) + { return wxStringToXmString((const char*)string.mb_str()); } + +// XmString made easy to use in wxWidgets (and has an added benefit of +// cleaning up automatically) +class wxXmString +{ + void Init(const char *str) + { + m_string = XmStringCreateLtoR + ( + const_cast<char *>(str), + const_cast<char *>(XmSTRING_DEFAULT_CHARSET) + ); + } + +public: + wxXmString(const char* str) + { + Init(str); + } + + wxXmString(const wchar_t* str) + { + Init(wxConvLibc.cWC2MB(str)); + } + + wxXmString(const wxString& str) + { + Init(str.mb_str()); + } + + wxXmString(const wxCStrData& str) + { + Init(str); + } + + // just to avoid calling XmStringFree() + wxXmString(const XmString& string) { m_string = string; } + + ~wxXmString() { XmStringFree(m_string); } + + // semi-implicit conversion to XmString (shouldn't rely on implicit + // conversion because many of Motif functions are macros) + XmString operator()() const { return m_string; } + +private: + XmString m_string; +}; + +// ---------------------------------------------------------------------------- +// Routines used in both wxTextCtrl/wxListBox and nativa wxComboBox +// (defined in src/motif/listbox.cpp or src/motif/textctrl.cpp +// ---------------------------------------------------------------------------- + +int wxDoFindStringInList( Widget listWidget, const wxString& str ); +int wxDoGetSelectionInList( Widget listWidget ); +wxString wxDoGetStringInList( Widget listWidget, int n ); +wxSize wxDoGetListBoxBestSize( Widget listWidget, const wxWindow* window ); + +wxSize wxDoGetSingleTextCtrlBestSize( Widget textWidget, + const wxWindow* window ); + +// ---------------------------------------------------------------------------- +// event-related functions +// ---------------------------------------------------------------------------- + +// executes one main loop iteration (implemented in src/motif/evtloop.cpp) +// returns true if the loop should be exited +bool wxDoEventLoopIteration( wxGUIEventLoop& evtLoop ); + +// Consume all events until no more left +void wxFlushEvents(WXDisplay* display); + +// ---------------------------------------------------------------------------- +// macros to avoid casting WXFOO to Foo all the time +// ---------------------------------------------------------------------------- + +// argument is of type "wxWindow *" +#define GetWidget(w) ((Widget)(w)->GetHandle()) + +// ---------------------------------------------------------------------------- +// accessors for C modules +// ---------------------------------------------------------------------------- + +extern "C" XtAppContext wxGetAppContext(); + +#endif +// _WX_PRIVATE_H_ diff --git a/lib/wxWidgets/include/wx/motif/private/timer.h b/lib/wxWidgets/include/wx/motif/private/timer.h new file mode 100644 index 0000000..65a60f8 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/private/timer.h @@ -0,0 +1,36 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/private/timer.h +// Purpose: wxTimer class +// Author: Julian Smart +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MOTIF_PRIVATE_TIMER_H_ +#define _WX_MOTIF_PRIVATE_TIMER_H_ + +#include "wx/private/timer.h" + +class WXDLLIMPEXP_CORE wxMotifTimerImpl : public wxTimerImpl +{ +public: + wxMotifTimerImpl(wxTimer* timer) : wxTimerImpl(timer) { m_id = 0; } + virtual ~wxMotifTimerImpl(); + + virtual bool Start(int milliseconds = -1, bool oneShot = false); + virtual void Stop(); + virtual bool IsRunning() const { return m_id != 0; } + + // override this to rearm the timer if necessary (i.e. if not one shot) as + // X timeouts are removed automatically when they expire + virtual void Notify(); + +protected: + // common part of Start() and Notify() + void DoStart(); + + long m_id; +}; + +#endif // _WX_MOTIF_PRIVATE_TIMER_H_ diff --git a/lib/wxWidgets/include/wx/motif/radiobox.h b/lib/wxWidgets/include/wx/motif/radiobox.h new file mode 100644 index 0000000..79cb25f --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/radiobox.h @@ -0,0 +1,134 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/radiobox.h +// Purpose: wxRadioBox class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MOTIF_RADIOBOX_H_ +#define _WX_MOTIF_RADIOBOX_H_ + +#ifndef wxWIDGET_ARRAY_DEFINED + #define wxWIDGET_ARRAY_DEFINED + + #include "wx/dynarray.h" + WX_DEFINE_ARRAY_PTR(WXWidget, wxWidgetArray); +#endif // wxWIDGET_ARRAY_DEFINED + +#include "wx/arrstr.h" + +class WXDLLIMPEXP_CORE wxRadioBox : public wxControl, public wxRadioBoxBase +{ +public: + wxRadioBox() { Init(); } + + wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + int majorDim = 0, long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioBoxNameStr)) + { + Init(); + + Create(parent, id, title, pos, size, n, choices, + majorDim, style, val, name); + } + + wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioBoxNameStr)) + { + Init(); + + Create(parent, id, title, pos, size, choices, + majorDim, style, val, name); + } + + virtual ~wxRadioBox(); + + bool Create(wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + int majorDim = 0, long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioBoxNameStr)); + + bool Create(wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioBoxNameStr)); + + // Enabling + virtual bool Enable(bool enable = true); + virtual bool Enable(unsigned int item, bool enable = true); + virtual bool IsItemEnabled(unsigned int WXUNUSED(n)) const + { + /* TODO */ + return true; + } + + // Showing + virtual bool Show(bool show = true); + virtual bool Show(unsigned int item, bool show = true); + virtual bool IsItemShown(unsigned int WXUNUSED(n)) const + { + /* TODO */ + return true; + } + + virtual void SetSelection(int n); + int GetSelection() const; + + virtual void SetString(unsigned int item, const wxString& label); + virtual wxString GetString(unsigned int item) const; + + virtual wxString GetStringSelection() const; + virtual bool SetStringSelection(const wxString& s); + virtual unsigned int GetCount() const { return m_noItems; } ; + void Command(wxCommandEvent& event); + + int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; } + void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; } + + // Implementation + virtual void ChangeFont(bool keepOriginalSize = true); + virtual void ChangeBackgroundColour(); + virtual void ChangeForegroundColour(); + const wxWidgetArray& GetRadioButtons() const { return m_radioButtons; } + void SetSel(int i) { m_selectedButton = i; } + virtual WXWidget GetLabelWidget() const { return m_labelWidget; } + +protected: + virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + + unsigned int m_noItems; + int m_noRowsOrCols; + int m_selectedButton; + + wxWidgetArray m_radioButtons; + WXWidget m_labelWidget; + wxArrayString m_radioButtonLabels; + +private: + void Init(); + + wxDECLARE_DYNAMIC_CLASS(wxRadioBox); +}; + +#endif // _WX_MOTIF_RADIOBOX_H_ diff --git a/lib/wxWidgets/include/wx/motif/radiobut.h b/lib/wxWidgets/include/wx/motif/radiobut.h new file mode 100644 index 0000000..0233364 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/radiobut.h @@ -0,0 +1,61 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/radiobut.h +// Purpose: wxRadioButton class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RADIOBUT_H_ +#define _WX_RADIOBUT_H_ + +class WXDLLIMPEXP_CORE wxRadioButton: public wxRadioButtonBase +{ + wxDECLARE_DYNAMIC_CLASS(wxRadioButton); +public: + wxRadioButton(); + virtual ~wxRadioButton() { RemoveFromCycle(); } + + inline wxRadioButton(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioButtonNameStr)) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioButtonNameStr)); + + virtual void SetValue(bool val); + virtual bool GetValue() const ; + + void Command(wxCommandEvent& event); + + // Implementation + virtual void ChangeBackgroundColour(); + + // *this function is an implementation detail* + // clears the selection in the radiobuttons in the cycle + // and returns the old selection (if any) + wxRadioButton* ClearSelections(); +protected: + virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } +private: + wxRadioButton* AddInCycle(wxRadioButton* cycle); + void RemoveFromCycle(); + wxRadioButton* NextInCycle() { return m_cycle; } + + wxRadioButton *m_cycle; +}; + +#endif +// _WX_RADIOBUT_H_ diff --git a/lib/wxWidgets/include/wx/motif/scrolbar.h b/lib/wxWidgets/include/wx/motif/scrolbar.h new file mode 100644 index 0000000..69ee968 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/scrolbar.h @@ -0,0 +1,61 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/scrolbar.h +// Purpose: wxScrollBar class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SCROLBAR_H_ +#define _WX_SCROLBAR_H_ + +// Scrollbar item +class WXDLLIMPEXP_CORE wxScrollBar: public wxScrollBarBase +{ + wxDECLARE_DYNAMIC_CLASS(wxScrollBar); + +public: + inline wxScrollBar() { m_pageSize = 0; m_viewSize = 0; m_objectSize = 0; } + virtual ~wxScrollBar(); + + inline wxScrollBar(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSB_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxScrollBarNameStr)) + { + Create(parent, id, pos, size, style, validator, name); + } + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSB_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxScrollBarNameStr)); + + int GetThumbPosition() const ; + inline int GetThumbSize() const { return m_pageSize; } + inline int GetPageSize() const { return m_viewSize; } + inline int GetRange() const { return m_objectSize; } + + virtual void SetThumbPosition(int viewStart); + virtual void SetScrollbar(int position, int thumbSize, int range, int pageSize, + bool refresh = true); + + void Command(wxCommandEvent& event); + + // Implementation + virtual void ChangeFont(bool keepOriginalSize = true); + virtual void ChangeBackgroundColour(); + +protected: + int m_pageSize; + int m_viewSize; + int m_objectSize; +}; + +#endif +// _WX_SCROLBAR_H_ diff --git a/lib/wxWidgets/include/wx/motif/setup.h b/lib/wxWidgets/include/wx/motif/setup.h new file mode 100644 index 0000000..e3ab139 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/setup.h @@ -0,0 +1,1624 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/setup.h +// Purpose: Configuration for the library +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SETUP_H_ +#define _WX_SETUP_H_ + +/* --- start common options --- */ +// ---------------------------------------------------------------------------- +// global settings +// ---------------------------------------------------------------------------- + +// define this to 0 when building wxBase library - this can also be done from +// makefile/project file overriding the value here +#ifndef wxUSE_GUI + #define wxUSE_GUI 1 +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// compatibility settings +// ---------------------------------------------------------------------------- + +// This setting determines the compatibility with 2.8 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_8 0 + +// This setting determines the compatibility with 3.0 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_3_0 1 + +// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when +// default system font is used for wxWindow::GetCharWidth/Height() instead of +// the current font. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxDIALOG_UNIT_COMPATIBILITY 0 + +// Provide unsafe implicit conversions in wxString to "const char*" or +// "std::string" (depending on wxUSE_STD_STRING_CONV_IN_WXSTRING value). +// +// Default is 1 but only for compatibility reasons, it is recommended to set +// this to 0 because converting wxString to a narrow (non-Unicode) string may +// fail unless a locale using UTF-8 encoding is used, which is never the case +// under MSW, for example, hence such conversions can result in silent data +// loss. +// +// Recommended setting: 0 +#define wxUSE_UNSAFE_WXSTRING_CONV 1 + +// If set to 1, enables "reproducible builds", i.e. build output should be +// exactly the same if the same build is redone again. As using __DATE__ and +// __TIME__ macros clearly makes the build irreproducible, setting this option +// to 1 disables their use in the library code. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_REPRODUCIBLE_BUILD 0 + +// ---------------------------------------------------------------------------- +// debugging settings +// ---------------------------------------------------------------------------- + +// wxDEBUG_LEVEL will be defined as 1 in wx/debug.h so normally there is no +// need to define it here. You may do it for two reasons: either completely +// disable/compile out the asserts in release version (then do it inside #ifdef +// NDEBUG) or, on the contrary, enable more asserts, including the usually +// disabled ones, in the debug build (then do it inside #ifndef NDEBUG) +// +// #ifdef NDEBUG +// #define wxDEBUG_LEVEL 0 +// #else +// #define wxDEBUG_LEVEL 2 +// #endif + +// wxHandleFatalExceptions() may be used to catch the program faults at run +// time and, instead of terminating the program with a usual GPF message box, +// call the user-defined wxApp::OnFatalException() function. If you set +// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. +// +// This setting is for Win32 only and can only be enabled if your compiler +// supports Win32 structured exception handling (currently only VC++ does) +// +// Default is 1 +// +// Recommended setting: 1 if your compiler supports it. +#define wxUSE_ON_FATAL_EXCEPTION 1 + +// Set this to 1 to be able to generate a human-readable (unlike +// machine-readable minidump created by wxCrashReport::Generate()) stack back +// trace when your program crashes using wxStackWalker +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_STACKWALKER 1 + +// Set this to 1 to compile in wxDebugReport class which allows you to create +// and optionally upload to your web site a debug report consisting of back +// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, it is compiled into a separate library so there +// is no overhead if you don't use it +#define wxUSE_DEBUGREPORT 1 + +// Generic comment about debugging settings: they are very useful if you don't +// use any other memory leak detection tools such as Purify/BoundsChecker, but +// are probably redundant otherwise. Also, Visual C++ CRT has the same features +// as wxWidgets memory debugging subsystem built in since version 5.0 and you +// may prefer to use it instead of built in memory debugging code because it is +// faster and more fool proof. +// +// Using VC++ CRT memory debugging is enabled by default in debug build (_DEBUG +// is defined) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) +// and if __NO_VC_CRTDBG__ is not defined. + +// The rest of the options in this section are obsolete and not supported, +// enable them at your own risk. + +// If 1, enables wxDebugContext, for writing error messages to file, etc. If +// __WXDEBUG__ is not defined, will still use the normal memory operators. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_CONTEXT 0 + +// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* +// __WXDEBUG__ is also defined. +// +// WARNING: this code may not work with all architectures, especially if +// alignment is an issue. This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 1 if you are not using a memory debugging tool, else 0 +#define wxUSE_MEMORY_TRACING 0 + +// In debug mode, cause new and delete to be redefined globally. +// If this causes problems (e.g. link errors which is a common problem +// especially if you use another library which also redefines the global new +// and delete), set this to 0. +// This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If +// this causes problems (e.g. link errors), set this to 0. You may need to set +// this to 0 if using templates (at least for VC++). This switch is currently +// ignored for MinGW/Cygwin. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_NEW_ALWAYS 0 + + +// ---------------------------------------------------------------------------- +// Unicode support +// ---------------------------------------------------------------------------- + +// This option is deprecated: the library should be always built in Unicode mode +// now, only set wxUSE_UNICODE to 0 to compile legacy code in ANSI mode if +// absolutely necessary -- updating it is strongly recommended as the ANSI mode +// will disappear completely in future wxWidgets releases. +#ifndef wxUSE_UNICODE + #define wxUSE_UNICODE 1 +#endif + +// ---------------------------------------------------------------------------- +// global features +// ---------------------------------------------------------------------------- + +// Compile library in exception-safe mode? If set to 1, the library will try to +// behave correctly in presence of exceptions (even though it still will not +// use the exceptions itself) and notify the user code about any unhandled +// exceptions. If set to 0, propagation of the exceptions through the library +// code will lead to undefined behaviour -- but the code itself will be +// slightly smaller and faster. +// +// Note that like wxUSE_THREADS this option is automatically set to 0 if +// wxNO_EXCEPTIONS is defined. +// +// Default is 1 +// +// Recommended setting: depends on whether you intend to use C++ exceptions +// in your own code (1 if you do, 0 if you don't) +#define wxUSE_EXCEPTIONS 1 + +// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI +// +// This feature is incomplete and experimental, please only enable it if +// you want to participate in its development. +// +// Recommended setting: 0 (unless you wish to try working on it). +#define wxUSE_EXTENDED_RTTI 0 + +// Support for message/error logging. This includes wxLogXXX() functions and +// wxLog and derived classes. Don't set this to 0 unless you really know what +// you are doing. +// +// Default is 1 +// +// Recommended setting: 1 (always) +#define wxUSE_LOG 1 + +// Recommended setting: 1 +#define wxUSE_LOGWINDOW 1 + +// Recommended setting: 1 +#define wxUSE_LOGGUI 1 + +// Recommended setting: 1 +#define wxUSE_LOG_DIALOG 1 + +// Support for command line parsing using wxCmdLineParser class. +// +// Default is 1 +// +// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) +#define wxUSE_CMDLINE_PARSER 1 + +// Support for multithreaded applications: if 1, compile in thread classes +// (thread.h) and make the library a bit more thread safe. Although thread +// support is quite stable by now, you may still consider recompiling the +// library without it if you have no use for it - this will result in a +// somewhat smaller and faster operation. +// +// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset +// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in +// build/msw/config.* file this value will have no effect. +// +// Default is 1 +// +// Recommended setting: 0 unless you do plan to develop MT applications +#define wxUSE_THREADS 1 + +// If enabled, compiles wxWidgets streams classes +// +// wx stream classes are used for image IO, process IO redirection, network +// protocols implementation and much more and so disabling this results in a +// lot of other functionality being lost. +// +// Default is 1 +// +// Recommended setting: 1 as setting it to 0 disables many other things +#define wxUSE_STREAMS 1 + +// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. +// Note that if the system's implementation does not support positional +// parameters, setting this to 1 forces the use of the wxWidgets implementation +// of wxVsnprintf. The standard vsnprintf() supports positional parameters on +// many Unix systems but usually doesn't under Windows. +// +// Positional parameters are very useful when translating a program since using +// them in formatting strings allow translators to correctly reorder the +// translated sentences. +// +// Default is 1 +// +// Recommended setting: 1 if you want to support multiple languages +#define wxUSE_PRINTF_POS_PARAMS 1 + +// Enable the use of compiler-specific thread local storage keyword, if any. +// This is used for wxTLS_XXX() macros implementation and normally should use +// the compiler-provided support as it's simpler and more efficient, but is +// disabled under Windows in wx/msw/chkconf.h as it can't be used if wxWidgets +// is used in a dynamically loaded Win32 DLL (i.e. using LoadLibrary()) under +// XP as this triggers a bug in compiler TLS support that results in crashes +// when any TLS variables are used. +// +// If you're absolutely sure that your build of wxWidgets is never going to be +// used in such situation, either because it's not going to be linked from any +// kind of plugin or because you only target Vista or later systems, you can +// set this to 2 to force the use of compiler TLS even under MSW. +// +// Default is 1 meaning that compiler TLS is used only if it's 100% safe. +// +// Recommended setting: 2 if you want to have maximal performance and don't +// care about the scenario described above. +#define wxUSE_COMPILER_TLS 1 + +// ---------------------------------------------------------------------------- +// Interoperability with the standard library. +// ---------------------------------------------------------------------------- + +// Set wxUSE_STL to 1 to enable maximal interoperability with the standard +// library, even at the cost of backwards compatibility. +// +// Default is 0 +// +// Recommended setting: 0 as the options below already provide a relatively +// good level of interoperability and changing this option arguably isn't worth +// diverging from the official builds of the library. +#define wxUSE_STL 0 + +// This is not a real option but is used as the default value for +// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS_COMPATIBLY. +// +// Set it to 0 if you want to disable the use of all standard classes +// completely for some reason. +#define wxUSE_STD_DEFAULT 1 + +// Use standard C++ containers where it can be done without breaking backwards +// compatibility. +// +// This provides better interoperability with the standard library, e.g. with +// this option on it's possible to insert std::vector<> into many wxWidgets +// containers directly. +// +// Default is 1. +// +// Recommended setting is 1 unless you want to avoid all dependencies on the +// standard library. +#define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT + +// Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<> +// and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but +// usually more limited) implementations are used which allows to avoid the +// dependency on the C++ run-time library. +// +// Default is 0 for compatibility reasons. +// +// Recommended setting: 1 unless compatibility with the official wxWidgets +// build and/or the existing code is a concern. +#define wxUSE_STD_CONTAINERS 0 + +// Use standard C++ streams if 1 instead of wx streams in some places. If +// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the +// standard streams library. +// +// Notice that enabling this does not replace wx streams with std streams +// everywhere, in a lot of places wx streams are used no matter what. +// +// Default is 1 if compiler supports it. +// +// Recommended setting: 1 if you use the standard streams anyhow and so +// dependency on the standard streams library is not a +// problem +#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT + +// Enable minimal interoperability with the standard C++ string class if 1. +// "Minimal" means that wxString can be constructed from std::string or +// std::wstring but can't be implicitly converted to them. You need to enable +// the option below for the latter. +// +// Default is 1 for most compilers. +// +// Recommended setting: 1 unless you want to ensure your program doesn't use +// the standard C++ library at all. +#define wxUSE_STD_STRING wxUSE_STD_DEFAULT + +// Make wxString as much interchangeable with std::[w]string as possible, in +// particular allow implicit conversion of wxString to either of these classes. +// This comes at a price (or a benefit, depending on your point of view) of not +// allowing implicit conversion to "const char *" and "const wchar_t *". +// +// Because a lot of existing code relies on these conversions, this option is +// disabled by default but can be enabled for your build if you don't care +// about compatibility. +// +// Default is 0 if wxUSE_STL has its default value or 1 if it is enabled. +// +// Recommended setting: 0 to remain compatible with the official builds of +// wxWidgets. +#define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL + +// ---------------------------------------------------------------------------- +// non GUI features selection +// ---------------------------------------------------------------------------- + +// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit +// integer which is implemented in terms of native 64 bit integers if any or +// uses emulation otherwise. +// +// This class is required by wxDateTime and so you should enable it if you want +// to use wxDateTime. For most modern platforms, it will use the native 64 bit +// integers in which case (almost) all of its functions are inline and it +// almost does not take any space, so there should be no reason to switch it +// off. +// +// Recommended setting: 1 +#define wxUSE_LONGLONG 1 + +// Set wxUSE_BASE64 to 1, to compile in Base64 support. This is required for +// storing binary data in wxConfig on most platforms. +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_BASE64 1 + +// Set this to 1 to be able to use wxEventLoop even in console applications +// (i.e. using base library only, without GUI). This is mostly useful for +// processing socket events but is also necessary to use timers in console +// applications +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_CONSOLE_EVENTLOOP 1 + +// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level +// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. +// +// Default is 1 +// +// Recommended setting: 1 (wxFile is highly recommended as it is required by +// i18n code, wxFileConfig and others) +#define wxUSE_FILE 1 +#define wxUSE_FFILE 1 + +// Use wxFSVolume class providing access to the configured/active mount points +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely disabled if you don't use it) +#define wxUSE_FSVOLUME 1 + +// Use wxSecretStore class for storing passwords using OS-specific facilities. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely disabled if you don't use it) +#define wxUSE_SECRETSTORE 1 + +// Allow the use of the OS built-in spell checker in wxTextCtrl. +// +// Default is 1, the corresponding wxTextCtrl functions simply won't do +// anything if the functionality is not supported by the current platform. +// +// Recommended setting: 1 unless you want to save a tiny bit of code. +#define wxUSE_SPELLCHECK 1 + +// Use wxStandardPaths class which allows to retrieve some standard locations +// in the file system +// +// Default is 1 +// +// Recommended setting: 1 (may be disabled to save space, but not much) +#define wxUSE_STDPATHS 1 + +// use wxTextBuffer class: required by wxTextFile +#define wxUSE_TEXTBUFFER 1 + +// use wxTextFile class: requires wxFile and wxTextBuffer, required by +// wxFileConfig +#define wxUSE_TEXTFILE 1 + +// i18n support: _() macro, wxLocale class. +#define wxUSE_INTL 1 + +// Provide wxFoo_l() functions similar to standard foo() functions but taking +// an extra locale parameter. +// +// Notice that this is fully implemented only for the systems providing POSIX +// xlocale support or Microsoft Visual C++ >= 8 (which provides proprietary +// almost-equivalent of xlocale functions), otherwise wxFoo_l() functions will +// only work for the current user locale and "C" locale. You can use +// wxHAS_XLOCALE_SUPPORT to test whether the full support is available. +// +// Default is 1 +// +// Recommended setting: 1 but may be disabled if you are writing programs +// running only in C locale anyhow +#define wxUSE_XLOCALE 1 + +// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which +// allow to manipulate dates, times and time intervals. +// +// Requires: wxUSE_LONGLONG +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_DATETIME 1 + +// Set wxUSE_TIMER to 1 to compile wxTimer class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_TIMER 1 + +// Use wxStopWatch class. +// +// Default is 1 +// +// Recommended setting: 1 (needed by wxSocket) +#define wxUSE_STOPWATCH 1 + +// Set wxUSE_FSWATCHER to 1 if you want to enable wxFileSystemWatcher +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_FSWATCHER 1 + +// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes +// which allow the application to store its settings in the persistent +// storage. Setting this to 1 will also enable on-demand creation of the +// global config object in wxApp. +// +// See also wxUSE_CONFIG_NATIVE below. +// +// Recommended setting: 1 +#define wxUSE_CONFIG 1 + +// If wxUSE_CONFIG is 1, you may choose to use either the native config +// classes under Windows (using the registry) or the portable text file +// format used by the config classes under Unix. +// +// Default is 1 to use native classes. Note that you may still use +// wxFileConfig even if you set this to 1 - just the config object created by +// default for the applications needs will be a wxRegConfig or wxIniConfig and +// not wxFileConfig. +// +// Recommended setting: 1 +#define wxUSE_CONFIG_NATIVE 1 + +// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows +// to connect/disconnect from the network and be notified whenever the dial-up +// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DIALUP_MANAGER 1 + +// Compile in classes for run-time DLL loading and function calling. +// Required by wxUSE_DIALUP_MANAGER. +// +// This setting is for Win32 only +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DYNLIB_CLASS 1 + +// experimental, don't use for now +#define wxUSE_DYNAMIC_LOADER 1 + +// Set to 1 to use socket classes +#define wxUSE_SOCKETS 1 + +// Set to 1 to use ipv6 socket classes (requires wxUSE_SOCKETS) +// +// Default is 1. +// +// Recommended setting: 1. +#define wxUSE_IPV6 1 + +// Set to 1 to enable virtual file systems (required by wxHTML) +#define wxUSE_FILESYSTEM 1 + +// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ZIP 1 + +// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ARCHIVE 1 + +// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_INET 1 + +// wxArchive classes for accessing archives such as zip and tar +#define wxUSE_ARCHIVE_STREAMS 1 + +// Set to 1 to compile wxZipInput/OutputStream classes. +#define wxUSE_ZIPSTREAM 1 + +// Set to 1 to compile wxTarInput/OutputStream classes. +#define wxUSE_TARSTREAM 1 + +// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by +// wxUSE_LIBPNG +#define wxUSE_ZLIB 1 + +// Set to 1 if liblzma is available to enable wxLZMA{Input,Output}Stream +// classes. +// +// Notice that if you enable this build option when not using configure or +// CMake, you need to ensure that liblzma headers and libraries are available +// (i.e. by building the library yourself or downloading its binaries) and can +// be found, either by copying them to one of the locations searched by the +// compiler/linker by default (e.g. any of the directories in the INCLUDE or +// LIB environment variables, respectively, when using MSVC) or modify the +// make- or project files to add references to these directories. +// +// Default is 0 under MSW, auto-detected by configure. +// +// Recommended setting: 1 if you need LZMA compression. +#define wxUSE_LIBLZMA 0 + +// If enabled, the code written by Apple will be used to write, in a portable +// way, float on the disk. See extended.c for the license which is different +// from wxWidgets one. +// +// Default is 1. +// +// Recommended setting: 1 unless you don't like the license terms (unlikely) +#define wxUSE_APPLE_IEEE 1 + +// Joystick support class +#define wxUSE_JOYSTICK 1 + +// wxFontEnumerator class +#define wxUSE_FONTENUM 1 + +// wxFontMapper class +#define wxUSE_FONTMAP 1 + +// wxMimeTypesManager class +#define wxUSE_MIMETYPE 1 + +// wxWebRequest allows usage of system libraries for HTTP(S) requests. +// +// Note that for wxWebRequest to be built, at least one of its backends must be +// available. Under MSW and macOS this will always be the case unless +// explicitly disabled. +// +// Default is 1 +// +// Recommended setting: 1, setting it to 0 may be useful to avoid dependencies +// on libcurl on Unix systems. +#define wxUSE_WEBREQUEST 1 + +// wxWebRequest backend based on NSURLSession +// +// Default is 1 under macOS. +// +// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, +// otherwise wxWebRequest won't be available at all under Mac. +#ifdef __APPLE__ +#define wxUSE_WEBREQUEST_URLSESSION wxUSE_WEBREQUEST +#else +#define wxUSE_WEBREQUEST_URLSESSION 0 +#endif + +// wxWebRequest backend based on libcurl, can be used under all platforms. +// +// Default is 0 for MSW and macOS, detected automatically when using configure. +// +// Recommended setting: 0 on Windows and macOS, otherwise 1 as it is required +// for wxWebRequest to be available at all. +#define wxUSE_WEBREQUEST_CURL 0 + +// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP +// or wxURL you need to set this to 1. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_PROTOCOL 1 + +// The settings for the individual URL schemes +#define wxUSE_PROTOCOL_FILE 1 +#define wxUSE_PROTOCOL_FTP 1 +#define wxUSE_PROTOCOL_HTTP 1 + +// Define this to use wxURL class. +#define wxUSE_URL 1 + +// Define this to use native platform url and protocol support. +// Currently valid only for MS-Windows. +// Note: if you set this to 1, you can open ftp/http/gopher sites +// and obtain a valid input stream for these sites +// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. +// Doing so reduces the code size. +// +// This code is experimental and subject to change. +#define wxUSE_URL_NATIVE 0 + +// Support for wxVariant class used in several places throughout the library, +// notably in wxDataViewCtrl API. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size as much as +// possible in which case setting this to 0 can gain up to 100KB. +#define wxUSE_VARIANT 1 + +// Support for wxAny class, the successor for wxVariant. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size by a small amount, +// or your compiler cannot for some reason cope with complexity of templates used. +#define wxUSE_ANY 1 + +// Support for regular expression matching via wxRegEx class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_REGEX 1 + +// wxSystemOptions class +#define wxUSE_SYSTEM_OPTIONS 1 + +// wxSound class +#define wxUSE_SOUND 1 + +// Use wxMediaCtrl +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_MEDIACTRL 1 + +// Use wxWidget's XRC XML-based resource system. Recommended. +// +// Default is 1 +// +// Recommended setting: 1 (requires wxUSE_XML) +#define wxUSE_XRC 1 + +// XML parsing classes. +// +// Default is 1 +// +// Recommended setting: 1 (required by XRC) +#define wxUSE_XML 1 + +// Use wxWidget's AUI docking system +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_AUI 1 + +// Use wxWidget's Ribbon classes for interfaces +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_RIBBON 1 + +// Use wxPropertyGrid. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_PROPGRID 1 + +// Use wxStyledTextCtrl, a wxWidgets Scintilla wrapper. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STC 1 + +// Use wxWidget's web viewing classes +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_WEBVIEW 1 + +// Use the IE wxWebView backend +// +// Default is 1 on MSW +// +// Recommended setting: 1 +#ifdef __WXMSW__ +#define wxUSE_WEBVIEW_IE 1 +#else +#define wxUSE_WEBVIEW_IE 0 +#endif + +// Use the Edge (Chromium) wxWebView backend (Requires WebView2 SDK) +// +// Default is 0 because WebView2 is not always available, set it to 1 if you do have it. +// +// Recommended setting: 1 when building for Windows with WebView2 SDK +#define wxUSE_WEBVIEW_EDGE 0 + +// Use the Edge (Chromium) wxWebView backend without loader DLL +// +// Default is 0, set it to 1 if you don't want to depend on WebView2Loader.dll. +// +// Recommended setting: 0 +#define wxUSE_WEBVIEW_EDGE_STATIC 0 + +// Use the WebKit wxWebView backend +// +// Default is 1 on GTK and OSX +// +// Recommended setting: 1 +#if (defined(__WXGTK__) && !defined(__WXGTK3__)) || defined(__WXOSX__) +#define wxUSE_WEBVIEW_WEBKIT 1 +#else +#define wxUSE_WEBVIEW_WEBKIT 0 +#endif + +// Use the WebKit2 wxWebView backend +// +// Default is 1 on GTK3 +// +// Recommended setting: 1 +#if defined(__WXGTK3__) +#define wxUSE_WEBVIEW_WEBKIT2 1 +#else +#define wxUSE_WEBVIEW_WEBKIT2 0 +#endif + +// Enable wxGraphicsContext and related classes for a modern 2D drawing API. +// +// Default is 1 except if you're using a compiler without support for GDI+ +// under MSW, i.e. gdiplus.h and related headers (MSVC and MinGW >= 4.8 are +// known to have them). For other compilers (e.g. older mingw32) you may need +// to install the headers (and just the headers) yourself. If you do, change +// the setting below manually. +// +// Recommended setting: 1 if supported by the compilation environment + +// Notice that we can't use wxCHECK_VISUALC_VERSION() nor wxCHECK_GCC_VERSION() +// here as this file is included from wx/platform.h before they're defined. +#if defined(_MSC_VER) || \ + (defined(__MINGW32__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 8)) +#define wxUSE_GRAPHICS_CONTEXT 1 +#else +// Disable support for other Windows compilers, enable it if your compiler +// comes with new enough SDK or you installed the headers manually. +// +// Notice that this will be set by configure under non-Windows platforms +// anyhow so the value there is not important. +#define wxUSE_GRAPHICS_CONTEXT 0 +#endif + +// Enable wxGraphicsContext implementation using Cairo library. +// +// This is not needed under Windows and detected automatically by configure +// under other systems, however you may set this to 1 manually if you installed +// Cairo under Windows yourself and prefer to use it instead the native GDI+ +// implementation. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_CAIRO 0 + + +// ---------------------------------------------------------------------------- +// Individual GUI controls +// ---------------------------------------------------------------------------- + +// You must set wxUSE_CONTROLS to 1 if you are using any controls at all +// (without it, wxControl class is not compiled) +// +// Default is 1 +// +// Recommended setting: 1 (don't change except for very special programs) +#define wxUSE_CONTROLS 1 + +// Support markup in control labels, i.e. provide wxControl::SetLabelMarkup(). +// Currently markup is supported only by a few controls and only some ports but +// their number will increase with time. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you want to save on code size) +#define wxUSE_MARKUP 1 + +// wxPopupWindow class is a top level transient window. It is currently used +// to implement wxTipWindow +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) +#define wxUSE_POPUPWIN 1 + +// wxTipWindow allows to implement the custom tooltips, it is used by the +// context help classes. Requires wxUSE_POPUPWIN. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0) +#define wxUSE_TIPWINDOW 1 + +// Each of the settings below corresponds to one wxWidgets control. They are +// all switched on by default but may be disabled if you are sure that your +// program (including any standard dialogs it can show!) doesn't need them and +// if you desperately want to save some space. If you use any of these you must +// set wxUSE_CONTROLS as well. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_ACTIVITYINDICATOR 1 // wxActivityIndicator +#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl +#define wxUSE_BANNERWINDOW 1 // wxBannerWindow +#define wxUSE_BUTTON 1 // wxButton +#define wxUSE_BMPBUTTON 1 // wxBitmapButton +#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl +#define wxUSE_CHECKBOX 1 // wxCheckBox +#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) +#define wxUSE_CHOICE 1 // wxChoice +#define wxUSE_COLLPANE 1 // wxCollapsiblePane +#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl +#define wxUSE_COMBOBOX 1 // wxComboBox +#define wxUSE_COMMANDLINKBUTTON 1 // wxCommandLinkButton +#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl +#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl +#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl +#define wxUSE_EDITABLELISTBOX 1 // wxEditableListBox +#define wxUSE_FILECTRL 1 // wxFileCtrl +#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl +#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl +#define wxUSE_GAUGE 1 // wxGauge +#define wxUSE_HEADERCTRL 1 // wxHeaderCtrl +#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl +#define wxUSE_LISTBOX 1 // wxListBox +#define wxUSE_LISTCTRL 1 // wxListCtrl +#define wxUSE_RADIOBOX 1 // wxRadioBox +#define wxUSE_RADIOBTN 1 // wxRadioButton +#define wxUSE_RICHMSGDLG 1 // wxRichMessageDialog +#define wxUSE_SCROLLBAR 1 // wxScrollBar +#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl +#define wxUSE_SLIDER 1 // wxSlider +#define wxUSE_SPINBTN 1 // wxSpinButton +#define wxUSE_SPINCTRL 1 // wxSpinCtrl +#define wxUSE_STATBOX 1 // wxStaticBox +#define wxUSE_STATLINE 1 // wxStaticLine +#define wxUSE_STATTEXT 1 // wxStaticText +#define wxUSE_STATBMP 1 // wxStaticBitmap +#define wxUSE_TEXTCTRL 1 // wxTextCtrl +#define wxUSE_TIMEPICKCTRL 1 // wxTimePickerCtrl +#define wxUSE_TOGGLEBTN 1 // requires wxButton +#define wxUSE_TREECTRL 1 // wxTreeCtrl +#define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl + +// Use generic version of wxDataViewCtrl even if a native one is available? +// +// Default is 1. +// +// Recommended setting: 1, but can be set to 0 if your program is affected by +// the native control limitations. +#define wxUSE_NATIVE_DATAVIEWCTRL 1 + +// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR +// below either wxStatusBar95 or a generic wxStatusBar will be used. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STATUSBAR 1 + +// Two status bar implementations are available under Win32: the generic one +// or the wrapper around native control. For native look and feel the native +// version should be used. +// +// Default is 1 for the platforms where native status bar is supported. +// +// Recommended setting: 1 (there is no advantage in using the generic one) +#define wxUSE_NATIVE_STATUSBAR 1 + +// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar +// classes at all. Otherwise, use the native toolbar class unless +// wxUSE_TOOLBAR_NATIVE is 0. +// +// Default is 1 for all settings. +// +// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. +#define wxUSE_TOOLBAR 1 +#define wxUSE_TOOLBAR_NATIVE 1 + +// wxNotebook is a control with several "tabs" located on one of its sides. It +// may be used to logically organise the data presented to the user instead of +// putting everything in one huge dialog. It replaces wxTabControl and related +// classes of wxWin 1.6x. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTEBOOK 1 + +// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_LISTBOOK 1 + +// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CHOICEBOOK 1 + +// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TREEBOOK 1 + +// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of +// tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLBOOK 1 + +// wxTaskBarIcon is a small notification icon shown in the system toolbar or +// dock. +// +// Default is 1. +// +// Recommended setting: 1 (but can be set to 0 if you don't need it) +#define wxUSE_TASKBARICON 1 + +// wxGrid class +// +// Default is 1, set to 0 to cut down compilation time and binaries size if you +// don't use it. +// +// Recommended setting: 1 +// +#define wxUSE_GRID 1 + +// wxMiniFrame class: a frame with narrow title bar +// +// Default is 1. +// +// Recommended setting: 1 (it doesn't cost almost anything) +#define wxUSE_MINIFRAME 1 + +// wxComboCtrl and related classes: combobox with custom popup window and +// not necessarily a listbox. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it +// is used by wxComboBox +#define wxUSE_COMBOCTRL 1 + +// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox +// items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0, except where it is +// needed as a base class for generic wxBitmapComboBox. +#define wxUSE_ODCOMBOBOX 1 + +// wxBitmapComboBox is a combobox that can have images in front of text items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 +#define wxUSE_BITMAPCOMBOBOX 1 + +// wxRearrangeCtrl is a wxCheckListBox with two buttons allowing to move items +// up and down in it. It is also used as part of wxRearrangeDialog. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 (currently used only by +// wxHeaderCtrl) +#define wxUSE_REARRANGECTRL 1 + +// wxAddRemoveCtrl is a composite control containing a control showing some +// items (e.g. wxListBox, wxListCtrl, wxTreeCtrl, wxDataViewCtrl, ...) and "+"/ +// "-" buttons allowing to add and remove items to/from the control. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 if you don't need it (not +// used by the library itself). +#define wxUSE_ADDREMOVECTRL 1 + +// ---------------------------------------------------------------------------- +// Miscellaneous GUI stuff +// ---------------------------------------------------------------------------- + +// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) +#define wxUSE_ACCEL 1 + +// Use the standard art provider. The icons returned by this provider are +// embedded into the library as XPMs so disabling it reduces the library size +// somewhat but this should only be done if you use your own custom art +// provider returning the icons or never use any icons not provided by the +// native art provider (which might not be implemented at all for some +// platforms) or by the Tango icons provider (if it's not itself disabled +// below). +// +// Default is 1. +// +// Recommended setting: 1 unless you use your own custom art provider. +#define wxUSE_ARTPROVIDER_STD 1 + +// Use art provider providing Tango icons: this art provider has higher quality +// icons than the default one. It uses SVG format which allows much better scaling +// then when bitmaps are used, at the expense of somewhat larger library size. +// +// Default is 1 under non-GTK ports. Under wxGTK the native art provider using +// the GTK+ stock icons replaces it so it is normally not necessary. +// +// Recommended setting: 1 but can be turned off to reduce the library size. +#define wxUSE_ARTPROVIDER_TANGO 1 + +// Hotkey support (currently Windows and macOS only) +#define wxUSE_HOTKEY 1 + +// Use wxCaret: a class implementing a "cursor" in a text control (called caret +// under Windows). +// +// Default is 1. +// +// Recommended setting: 1 (can be safely set to 0, not used by the library) +#define wxUSE_CARET 1 + +// Use wxDisplay class: it allows enumerating all displays on a system and +// their geometries as well as finding the display on which the given point or +// window lies. +// +// Default is 1. +// +// Recommended setting: 1 if you need it, can be safely set to 0 otherwise +#define wxUSE_DISPLAY 1 + +// Miscellaneous geometry code: needed for Canvas library +#define wxUSE_GEOMETRY 1 + +// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and +// wxListCtrl. +// +// Default is 1. +// +// Recommended setting: 1 (set it to 0 if you don't use any of the controls +// enumerated above, then this class is mostly useless too) +#define wxUSE_IMAGLIST 1 + +// Use wxInfoBar class. +// +// Default is 1. +// +// Recommended setting: 1 (but can be disabled without problems as nothing +// depends on it) +#define wxUSE_INFOBAR 1 + +// Use wxMenu, wxMenuItem. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUS 1 + +// Use wxMenuBar. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUBAR 1 + +// Use wxNotificationMessage. +// +// wxNotificationMessage allows to show non-intrusive messages to the user +// using balloons, banners, popups or whatever is the appropriate method for +// the current platform. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTIFICATION_MESSAGE 1 + +// wxPreferencesEditor provides a common API for different ways of presenting +// the standard "Preferences" or "Properties" dialog under different platforms +// (e.g. some use modal dialogs, some use modeless ones; some apply the changes +// immediately while others require an explicit "Apply" button). +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_PREFERENCES_EDITOR 1 + +// wxFont::AddPrivateFont() allows to use fonts not installed on the system by +// loading them from font files during run-time. +// +// Default is 1 except under Unix where it will be turned off by configure if +// the required libraries are not available or not new enough. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it and +// want to avoid extra dependencies under Linux, for example). +#define wxUSE_PRIVATE_FONTS 1 + +// wxRichToolTip is a customizable tooltip class which has more functionality +// than the stock (but native, unlike this class) wxToolTip. +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely set to 0 if you don't need it) +#define wxUSE_RICHTOOLTIP 1 + +// Use wxSashWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SASH 1 + +// Use wxSplitterWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SPLITTER 1 + +// Use wxToolTip and wxWindow::Set/GetToolTip() methods. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLTIPS 1 + +// wxValidator class and related methods +#define wxUSE_VALIDATORS 1 + +// Use reference counted ID management: this means that wxWidgets will track +// the automatically allocated ids (those used when you use wxID_ANY when +// creating a window, menu or toolbar item &c) instead of just supposing that +// the program never runs out of them. This is mostly useful only under wxMSW +// where the total ids range is limited to SHRT_MIN..SHRT_MAX and where +// long-running programs can run into problems with ids reuse without this. On +// the other platforms, where the ids have the full int range, this shouldn't +// be necessary. +#ifdef __WXMSW__ +#define wxUSE_AUTOID_MANAGEMENT 1 +#else +#define wxUSE_AUTOID_MANAGEMENT 0 +#endif + +// ---------------------------------------------------------------------------- +// common dialogs +// ---------------------------------------------------------------------------- + +// Use common dialogs (e.g. file selector, printer dialog). Switching this off +// also switches off the printing architecture and interactive wxPrinterDC. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COMMON_DIALOGS 1 + +// wxBusyInfo displays window with message when app is busy. Works in same way +// as wxBusyCursor +#define wxUSE_BUSYINFO 1 + +// Use single/multiple choice dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_CHOICEDLG 1 + +// Use colour picker dialog +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COLOURDLG 1 + +// wxDirDlg class for getting a directory name from user +#define wxUSE_DIRDLG 1 + +// Use file open/save dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in many places in the library itself) +#define wxUSE_FILEDLG 1 + +// Use find/replace dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely set to 0) +#define wxUSE_FINDREPLDLG 1 + +// Use font picker dialog +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_FONTDLG 1 + +// Use wxMessageDialog and wxMessageBox. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_MSGDLG 1 + +// progress dialog class for lengthy operations +#define wxUSE_PROGRESSDLG 1 + +// Set to 0 to disable the use of the native progress dialog (currently only +// available under MSW and suffering from some bugs there, hence this option). +#define wxUSE_NATIVE_PROGRESSDLG 1 + +// support for startup tips (wxShowTip &c) +#define wxUSE_STARTUP_TIPS 1 + +// text entry dialog and wxGetTextFromUser function +#define wxUSE_TEXTDLG 1 + +// number entry dialog +#define wxUSE_NUMBERDLG 1 + +// credential entry dialog +#define wxUSE_CREDENTIALDLG 1 + +// splash screen class +#define wxUSE_SPLASH 1 + +// wizards +#define wxUSE_WIZARDDLG 1 + +// Compile in wxAboutBox() function showing the standard "About" dialog. +// +// Default is 1 +// +// Recommended setting: 1 but can be set to 0 to save some space if you don't +// use this function +#define wxUSE_ABOUTDLG 1 + +// wxFileHistory class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_FILE_HISTORY 1 + +// ---------------------------------------------------------------------------- +// Metafiles support +// ---------------------------------------------------------------------------- + +// Windows supports the graphics format known as metafile which, though not +// portable, is widely used under Windows and so is supported by wxWidgets +// (under Windows only, of course). Both the so-called "Window MetaFiles" or +// WMFs, and "Enhanced MetaFiles" or EMFs are supported in wxWin and, by +// default, EMFs will be used. This may be changed by setting +// wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting wxUSE_ENH_METAFILE to 0. +// You may also set wxUSE_METAFILE to 0 to not compile in any metafile +// related classes at all. +// +// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. +// +// Recommended setting: default or 0 for everything for portable programs. +#define wxUSE_METAFILE 1 +#define wxUSE_ENH_METAFILE 1 +#define wxUSE_WIN_METAFILES_ALWAYS 0 + +// ---------------------------------------------------------------------------- +// Big GUI components +// ---------------------------------------------------------------------------- + +// Set to 0 to disable MDI support. +// +// Requires wxUSE_NOTEBOOK under platforms other than MSW. +// +// Default is 1. +// +// Recommended setting: 1, can be safely set to 0. +#define wxUSE_MDI 1 + +// Set to 0 to disable document/view architecture +#define wxUSE_DOC_VIEW_ARCHITECTURE 1 + +// Set to 0 to disable MDI document/view architecture +// +// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE +#define wxUSE_MDI_ARCHITECTURE 1 + +// Set to 0 to disable print/preview architecture code +#define wxUSE_PRINTING_ARCHITECTURE 1 + +// wxHTML allows displaying simple HTML. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_HTML 1 + +// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL +// headers and libraries to be able to compile the library with wxUSE_GLCANVAS +// set to 1 and, under Windows, also to add opengl32.lib and glu32.lib to the +// list of libraries used to link your application when linking to wxWidgets +// statically (although this is done implicitly for Microsoft Visual C++ users). +// +// Default is 1. +// +// Recommended setting: 1 if you intend to use OpenGL, can be safely set to 0 +// otherwise. +#define wxUSE_GLCANVAS 1 + +// Setting wxUSE_GLCANVAS_EGL to 1 enables OpenGL EGL backend. This will be +// automatically enabled if EGL support is detected. EGL support is only +// available under Unix platforms. +// +// Default is 0. +// +#define wxUSE_GLCANVAS_EGL 0 + +// wxRichTextCtrl allows editing of styled text. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 if you want compile a +// smaller library. +#define wxUSE_RICHTEXT 1 + +// ---------------------------------------------------------------------------- +// Data transfer +// ---------------------------------------------------------------------------- + +// Use wxClipboard class for clipboard copy/paste. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CLIPBOARD 1 + +// Use wxDataObject and related classes. Needed for clipboard and OLE drag and +// drop +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DATAOBJ 1 + +// Use wxDropTarget and wxDropSource classes for drag and drop (this is +// different from "built in" drag and drop in wxTreeCtrl which is always +// available). Requires wxUSE_DATAOBJ. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DRAG_AND_DROP 1 + +// Use wxAccessible for enhanced and customisable accessibility. +// Depends on wxUSE_OLE on MSW. +// +// Default is 1 on MSW, 0 elsewhere. +// +// Recommended setting (at present): 1 (MSW-only) +#ifdef __WXMSW__ +#define wxUSE_ACCESSIBILITY 1 +#else +#define wxUSE_ACCESSIBILITY 0 +#endif + +// ---------------------------------------------------------------------------- +// miscellaneous settings +// ---------------------------------------------------------------------------- + +// wxSingleInstanceChecker class allows to verify at startup if another program +// instance is running. +// +// Default is 1 +// +// Recommended setting: 1 (the class is tiny, disabling it won't save much +// space) +#define wxUSE_SNGLINST_CHECKER 1 + +#define wxUSE_DRAGIMAGE 1 + +#define wxUSE_IPC 1 + // 0 for no interprocess comms +#define wxUSE_HELP 1 + // 0 for no help facility + +// Should we use MS HTML help for wxHelpController? If disabled, neither +// wxCHMHelpController nor wxBestHelpController are available. +// +// Default is 1 under MSW, 0 is always used for the other platforms. +// +// Recommended setting: 1, only set to 0 if you have trouble compiling +// wxCHMHelpController (could be a problem with really ancient compilers) +#define wxUSE_MS_HTML_HELP 1 + + +// Use wxHTML-based help controller? +#define wxUSE_WXHTML_HELP 1 + +#define wxUSE_CONSTRAINTS 1 + // 0 for no window layout constraint system + +#define wxUSE_SPLINES 1 + // 0 for no splines + +#define wxUSE_MOUSEWHEEL 1 + // Include mouse wheel support + +// Compile wxUIActionSimulator class? +#define wxUSE_UIACTIONSIMULATOR 1 + +// ---------------------------------------------------------------------------- +// wxDC classes for various output formats +// ---------------------------------------------------------------------------- + +// Set to 1 for PostScript device context. +#define wxUSE_POSTSCRIPT 0 + +// Set to 1 to use font metric files in GetTextExtent +#define wxUSE_AFM_FOR_POSTSCRIPT 1 + +// Set to 1 to compile in support for wxSVGFileDC, a wxDC subclass which allows +// to create files in SVG (Scalable Vector Graphics) format. +#define wxUSE_SVG 1 + +// Should wxDC provide SetTransformMatrix() and related methods? +// +// Default is 1 but can be set to 0 if this functionality is not used. Notice +// that currently wxMSW, wxGTK3 support this for wxDC and all platforms support +// this for wxGCDC so setting this to 0 doesn't change much if neither of these +// is used (although it will still save a few bytes probably). +// +// Recommended setting: 1. +#define wxUSE_DC_TRANSFORM_MATRIX 1 + +// ---------------------------------------------------------------------------- +// image format support +// ---------------------------------------------------------------------------- + +// wxImage supports many different image formats which can be configured at +// compile-time. BMP is always supported, others are optional and can be safely +// disabled if you don't plan to use images in such format sometimes saving +// substantial amount of code in the final library. +// +// Some formats require an extra library (e.g. libpng) which is always included in +// wxWidgets sources but some build systems (cmake, configure) can be configured to +// to use the system or user-provided version. +// +// Set to 1 for wxImage support (recommended). +#define wxUSE_IMAGE 1 + +// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. +#define wxUSE_LIBPNG 1 + +// Set to 1 for JPEG format support (requires libjpeg) +#define wxUSE_LIBJPEG 1 + +// Set to 1 for TIFF format support (requires libtiff) +#define wxUSE_LIBTIFF 1 + +// Set to 1 for SVG rasterizing support using nanosvg +#define wxUSE_NANOSVG 1 + +// Set to 1 to use external nanosvg library when wxUSE_NANOSVG is enabled +#define wxUSE_NANOSVG_EXTERNAL 0 + +// Set to 1 for TGA format support (loading only) +#define wxUSE_TGA 1 + +// Set to 1 for GIF format support +#define wxUSE_GIF 1 + +// Set to 1 for PNM format support +#define wxUSE_PNM 1 + +// Set to 1 for PCX format support +#define wxUSE_PCX 1 + +// Set to 1 for IFF format support (Amiga format) +#define wxUSE_IFF 0 + +// Set to 1 for XPM format support +#define wxUSE_XPM 1 + +// Set to 1 for MS Icons and Cursors format support +#define wxUSE_ICO_CUR 1 + +// Set to 1 to compile in wxPalette class +#define wxUSE_PALETTE 1 + +// ---------------------------------------------------------------------------- +// wxUniversal-only options +// ---------------------------------------------------------------------------- + +// Set to 1 to enable compilation of all themes, this is the default +#define wxUSE_ALL_THEMES 1 + +// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES +// is unset, if it is set these options are not used; notice that metal theme +// uses Win32 one +#define wxUSE_THEME_GTK 0 +#define wxUSE_THEME_METAL 0 +#define wxUSE_THEME_MONO 0 +#define wxUSE_THEME_WIN32 0 + +/* --- end common options --- */ + +#endif // _WX_SETUP_H_ diff --git a/lib/wxWidgets/include/wx/motif/slider.h b/lib/wxWidgets/include/wx/motif/slider.h new file mode 100644 index 0000000..75cd3f4 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/slider.h @@ -0,0 +1,78 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/slider.h +// Purpose: wxSlider class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SLIDER_H_ +#define _WX_SLIDER_H_ + +#include "wx/control.h" + +// Slider +class WXDLLIMPEXP_CORE wxSlider: public wxSliderBase +{ + wxDECLARE_DYNAMIC_CLASS(wxSlider); + +public: + wxSlider(); + + wxSlider(wxWindow *parent, wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxSliderNameStr)) + { + Create(parent, id, value, minValue, maxValue, pos, size, style, validator, name); + } + + virtual ~wxSlider(); + + bool Create(wxWindow *parent, wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxSliderNameStr)); + + virtual int GetValue() const ; + virtual void SetValue(int); + + void SetRange(int minValue, int maxValue); + + inline int GetMin() const { return m_rangeMin; } + inline int GetMax() const { return m_rangeMax; } + + // For trackbars only + void SetPageSize(int pageSize); + int GetPageSize() const ; + void SetLineSize(int lineSize); + int GetLineSize() const ; + void SetThumbLength(int len) ; + int GetThumbLength() const ; + + void Command(wxCommandEvent& event); + +protected: + int m_rangeMin; + int m_rangeMax; + int m_pageSize; + int m_lineSize; + + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + +private: + wxDECLARE_EVENT_TABLE(); +}; + +#endif +// _WX_SLIDER_H_ diff --git a/lib/wxWidgets/include/wx/motif/spinbutt.h b/lib/wxWidgets/include/wx/motif/spinbutt.h new file mode 100644 index 0000000..02268e7 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/spinbutt.h @@ -0,0 +1,75 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/spinbutt.h +// Purpose: wxSpinButton class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SPINBUTT_H_ +#define _WX_SPINBUTT_H_ + +class WXDLLIMPEXP_FWD_CORE wxArrowButton; // internal + +class WXDLLIMPEXP_CORE wxSpinButton : public wxSpinButtonBase +{ + wxDECLARE_DYNAMIC_CLASS(wxSpinButton); + +public: + wxSpinButton() : m_up( 0 ), m_down( 0 ), m_pos( 0 ) { } + + wxSpinButton(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_VERTICAL, + const wxString& name = wxASCII_STR("wxSpinButton")) + : m_up( 0 ), + m_down( 0 ), + m_pos( 0 ) + { + Create(parent, id, pos, size, style, name); + } + virtual ~wxSpinButton(); + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_VERTICAL, + const wxString& name = wxASCII_STR("wxSpinButton")); + + // accessors + int GetValue() const; + int GetMin() const { return m_min; } + int GetMax() const { return m_max; } + + // operations + void SetValue(int val); + void SetRange(int minVal, int maxVal); + + // Implementation + virtual void Command(wxCommandEvent& event) + { (void)ProcessCommand(event); } + virtual void ChangeFont(bool keepOriginalSize = true); + virtual void ChangeBackgroundColour(); + virtual void ChangeForegroundColour(); +public: + // implementation detail + void Increment( int delta ); + +private: + virtual void DoSetSize(int x, int y, int width, int height, + int sizeFlags = wxSIZE_AUTO); + virtual void DoMoveWindow(int x, int y, int width, int height); + virtual wxSize DoGetBestSize() const; + + wxArrowButton* m_up; + wxArrowButton* m_down; + int m_pos; +}; + +#endif +// _WX_SPINBUTT_H_ diff --git a/lib/wxWidgets/include/wx/motif/statbmp.h b/lib/wxWidgets/include/wx/motif/statbmp.h new file mode 100644 index 0000000..542f29d --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/statbmp.h @@ -0,0 +1,63 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/statbmp.h +// Purpose: wxStaticBitmap class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATBMP_H_ +#define _WX_STATBMP_H_ + +#include "wx/motif/bmpmotif.h" +#include "wx/icon.h" + +class WXDLLIMPEXP_CORE wxStaticBitmap : public wxStaticBitmapBase +{ + wxDECLARE_DYNAMIC_CLASS(wxStaticBitmap); + +public: + wxStaticBitmap() { } + virtual ~wxStaticBitmap(); + + wxStaticBitmap(wxWindow *parent, wxWindowID id, + const wxBitmapBundle& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBitmapNameStr)) + { + Create(parent, id, label, pos, size, style, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxBitmapBundle& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBitmapNameStr)); + + virtual void SetBitmap(const wxBitmapBundle& bitmap); + + virtual bool ProcessCommand(wxCommandEvent& WXUNUSED(event)) + { + return false; + } + + // Implementation + virtual void ChangeBackgroundColour(); + virtual void ChangeForegroundColour(); + +protected: + void DoSetBitmap(); + +protected: + wxBitmap m_messageBitmap; + wxBitmapBundle m_messageBitmapOriginal; + wxBitmapCache m_bitmapCache; +}; + +#endif +// _WX_STATBMP_H_ diff --git a/lib/wxWidgets/include/wx/motif/statbox.h b/lib/wxWidgets/include/wx/motif/statbox.h new file mode 100644 index 0000000..accc15c --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/statbox.h @@ -0,0 +1,58 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/statbox.h +// Purpose: wxStaticBox class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATBOX_H_ +#define _WX_STATBOX_H_ + +// Group box +class WXDLLIMPEXP_CORE wxStaticBox: public wxStaticBoxBase +{ + wxDECLARE_DYNAMIC_CLASS(wxStaticBox); + +public: + wxStaticBox(); + wxStaticBox(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBoxNameStr)) + { + Create(parent, id, label, pos, size, style, name); + } + + virtual ~wxStaticBox(); + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBoxNameStr)); + + virtual bool ProcessCommand(wxCommandEvent& WXUNUSED(event)) + { + return false; + } + + virtual WXWidget GetLabelWidget() const { return m_labelWidget; } + + virtual void SetLabel(const wxString& label); + virtual void GetBordersForSizer(int *borderTop, int *borderOther) const; + +private: + WXWidget m_labelWidget; + +private: + wxDECLARE_EVENT_TABLE(); +}; + +#endif +// _WX_STATBOX_H_ diff --git a/lib/wxWidgets/include/wx/motif/stattext.h b/lib/wxWidgets/include/wx/motif/stattext.h new file mode 100644 index 0000000..e8255a2 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/stattext.h @@ -0,0 +1,63 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/stattext.h +// Purpose: wxStaticText class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATTEXT_H_ +#define _WX_STATTEXT_H_ + +class WXDLLIMPEXP_CORE wxStaticText: public wxStaticTextBase +{ + wxDECLARE_DYNAMIC_CLASS(wxStaticText); + +public: + wxStaticText() { } + + wxStaticText(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticTextNameStr)) + { + Create(parent, id, label, pos, size, style, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticTextNameStr)); + + // implementation + // -------------- + + // operations + virtual bool ProcessCommand(wxCommandEvent& WXUNUSED(event)) + { + return false; + } + + virtual void SetLabel(const wxString& label); + + // Get the widget that corresponds to the label + // (for font setting, label setting etc.) + virtual WXWidget GetLabelWidget() const + { return m_labelWidget; } + + virtual void WXSetVisibleLabel(const wxString& str); + virtual wxString WXGetVisibleLabel() const; + + virtual wxSize DoGetBestSize() const; +protected: + WXWidget m_labelWidget; +}; + +#endif +// _WX_STATTEXT_H_ diff --git a/lib/wxWidgets/include/wx/motif/textctrl.h b/lib/wxWidgets/include/wx/motif/textctrl.h new file mode 100644 index 0000000..cc51621 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/textctrl.h @@ -0,0 +1,114 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/textctrl.h +// Purpose: wxTextCtrl class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TEXTCTRL_H_ +#define _WX_TEXTCTRL_H_ + +// Single-line text item +class WXDLLIMPEXP_CORE wxTextCtrl : public wxTextCtrlBase +{ +public: + // creation + // -------- + + wxTextCtrl(); + wxTextCtrl(wxWindow *parent, + wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxTextCtrlNameStr)) + { + Create(parent, id, value, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxTextCtrlNameStr)); + + // accessors + // --------- + virtual wxString GetValue() const; + + virtual int GetLineLength(long lineNo) const; + virtual wxString GetLineText(long lineNo) const; + virtual int GetNumberOfLines() const; + + // operations + // ---------- + + virtual void MarkDirty(); + virtual void DiscardEdits(); + virtual bool IsModified() const; + + virtual long XYToPosition(long x, long y) const; + virtual bool PositionToXY(long pos, long *x, long *y) const; + virtual void ShowPosition(long pos); + + // callbacks + // --------- + void OnDropFiles(wxDropFilesEvent& event); + void OnChar(wxKeyEvent& event); + // void OnEraseBackground(wxEraseEvent& event); + + void OnCut(wxCommandEvent& event); + void OnCopy(wxCommandEvent& event); + void OnPaste(wxCommandEvent& event); + void OnUndo(wxCommandEvent& event); + void OnRedo(wxCommandEvent& event); + + void OnUpdateCut(wxUpdateUIEvent& event); + void OnUpdateCopy(wxUpdateUIEvent& event); + void OnUpdatePaste(wxUpdateUIEvent& event); + void OnUpdateUndo(wxUpdateUIEvent& event); + void OnUpdateRedo(wxUpdateUIEvent& event); + + virtual void Command(wxCommandEvent& event); + + // implementation from here to the end + // ----------------------------------- + virtual void ChangeFont(bool keepOriginalSize = true); + virtual void ChangeBackgroundColour(); + virtual void ChangeForegroundColour(); + void SetModified(bool mod) { m_modified = mod; } + virtual WXWidget GetTopWidget() const; + + // send the CHAR and TEXT_UPDATED events + void DoSendEvents(void /* XmTextVerifyCallbackStruct */ *cbs, + long keycode); + +protected: + virtual wxSize DoGetBestSize() const; + + virtual void DoSetValue(const wxString& value, int flags = 0); + + virtual WXWidget GetTextWidget() const { return m_mainWidget; } + +public: + // Motif-specific + void* m_tempCallbackStruct; + bool m_modified; + wxString m_value; // Required for password text controls + + // Did we call wxTextCtrl::OnChar? If so, generate a command event. + bool m_processedDefault; + +private: + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxTextCtrl); +}; + +#endif +// _WX_TEXTCTRL_H_ diff --git a/lib/wxWidgets/include/wx/motif/textentry.h b/lib/wxWidgets/include/wx/motif/textentry.h new file mode 100644 index 0000000..bbea334 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/textentry.h @@ -0,0 +1,59 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/textentry.h +// Purpose: wxMotif-specific wxTextEntry implementation +// Author: Vadim Zeitlin +// Created: 2007-11-05 +// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MOTIF_TEXTENTRY_H_ +#define _WX_MOTIF_TEXTENTRY_H_ + +// ---------------------------------------------------------------------------- +// wxTextEntry wraps XmTextXXX() methods suitable for single-line controls +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTextEntry : public wxTextEntryBase +{ +public: + wxTextEntry() { } + + // implement wxTextEntryBase pure virtual methods + virtual void WriteText(const wxString& text); + 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 long GetInsertionPoint() const; + virtual long GetLastPosition() const; + + virtual void SetSelection(long from, long to); + virtual void GetSelection(long *from, long *to) const; + + virtual bool IsEditable() const; + virtual void SetEditable(bool editable); + +protected: + virtual wxString DoGetValue() const; + + // translate wx text position (which may be -1 meaning "last one") to a + // valid Motif text position + long GetMotifPos(long pos) const; + +private: + // implement this to return the associated xmTextWidgetClass widget + virtual WXWidget GetTextWidget() const = 0; +}; + +#endif // _WX_MOTIF_TEXTENTRY_H_ + diff --git a/lib/wxWidgets/include/wx/motif/tglbtn.h b/lib/wxWidgets/include/wx/motif/tglbtn.h new file mode 100644 index 0000000..2dcf2e8 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/tglbtn.h @@ -0,0 +1,53 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/tglbtn.h +// Purpose: Declaration of the wxToggleButton class, which implements a +// toggle button under wxMotif. +// Author: Mattia Barbon +// Modified by: +// Created: 10.02.03 +// Copyright: (c) 2003 Mattia Barbon +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TOGGLEBUTTON_H_ +#define _WX_TOGGLEBUTTON_H_ + +#include "wx/checkbox.h" + +class WXDLLIMPEXP_CORE wxToggleButton : public wxCheckBox +{ +public: + wxToggleButton() { Init(); } + wxToggleButton( wxWindow* parent, wxWindowID id, const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr) ) + { + Init(); + + Create( parent, id, label, pos, size, style, val, name ); + } + + bool Create( wxWindow* parent, wxWindowID id, const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& val = wxDefaultValidator, + const wxString &name = wxASCII_STR(wxCheckBoxNameStr) ); + +protected: + virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + +private: + wxDECLARE_DYNAMIC_CLASS(wxToggleButton); + + // common part of all constructors + void Init() + { + m_evtType = wxEVT_TOGGLEBUTTON; + } +}; + +#endif // _WX_TOGGLEBUTTON_H_ diff --git a/lib/wxWidgets/include/wx/motif/toolbar.h b/lib/wxWidgets/include/wx/motif/toolbar.h new file mode 100644 index 0000000..1374745 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/toolbar.h @@ -0,0 +1,82 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/toolbar.h +// Purpose: wxToolBar class +// Author: Julian Smart +// Modified by: 13.12.99 by VZ during toolbar classes reorganization +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TOOLBAR_H_ +#define _WX_TOOLBAR_H_ + +class WXDLLIMPEXP_CORE wxToolBar : public wxToolBarBase +{ +public: + // ctors and dtor + wxToolBar() { Init(); } + + wxToolBar(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTB_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxToolBarNameStr)) + { + Init(); + + Create(parent, id, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTB_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxToolBarNameStr)); + + virtual ~wxToolBar(); + + // override/implement base class virtuals + virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; + + virtual bool Realize(); + + // implementation from now on + + // find tool by widget + wxToolBarToolBase *FindToolByWidget(WXWidget w) const; + +private: + // common part of all ctors + void Init(); + + // implement base class pure virtuals + virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); + virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); + + virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); + virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); + virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); + + virtual wxToolBarToolBase *CreateTool(int id, + const wxString& label, + const wxBitmapBundle& bmpNormal, + const wxBitmapBundle& bmpDisabled, + wxItemKind kind, + wxObject *clientData, + const wxString& shortHelp, + const wxString& longHelp); + virtual wxToolBarToolBase *CreateTool(wxControl *control, + const wxString& label); + + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); +private: + wxDECLARE_DYNAMIC_CLASS(wxToolBar); +}; + +#endif + // _WX_TOOLBAR_H_ diff --git a/lib/wxWidgets/include/wx/motif/toplevel.h b/lib/wxWidgets/include/wx/motif/toplevel.h new file mode 100644 index 0000000..f8cbc68 --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/toplevel.h @@ -0,0 +1,82 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/toplevel.h +// Purpose: wxTopLevelWindow Motif implementation +// Author: Mattia Barbon +// Modified by: +// Created: 12/10/2002 +// Copyright: (c) Mattia Barbon +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __MOTIFTOPLEVELH__ +#define __MOTIFTOPLEVELH__ + +class WXDLLIMPEXP_CORE wxTopLevelWindowMotif : public wxTopLevelWindowBase +{ +public: + wxTopLevelWindowMotif() { Init(); } + wxTopLevelWindowMotif( wxWindow* parent, wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr) ) + { + Init(); + + Create( parent, id, title, pos, size, style, name ); + } + + bool Create( wxWindow* parent, wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr) ); + + virtual ~wxTopLevelWindowMotif(); + + virtual bool ShowFullScreen( bool show, long style = wxFULLSCREEN_ALL ); + virtual bool IsFullScreen() const; + + virtual void Maximize(bool maximize = true); + virtual void Restore(); + virtual void Iconize(bool iconize = true); + virtual bool IsMaximized() const; + virtual bool IsIconized() const; + + virtual void Raise(); + virtual void Lower(); + + virtual wxString GetTitle() const { return m_title; } + virtual void SetTitle( const wxString& title ) { m_title = title; } + + virtual bool SetShape( const wxRegion& region ); + + WXWidget GetShellWidget() const; +protected: + // common part of all constructors + void Init(); + // common part of wxDialog/wxFrame destructors + void PreDestroy(); + + virtual void DoGetPosition(int* x, int* y) const; + virtual void DoSetSizeHints(int minW, int minH, + int maxW, int maxH, + int incW, int incH); + +private: + // really create the Motif widget for TLW + virtual bool XmDoCreateTLW(wxWindow* parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) = 0; + + + wxString m_title; +}; + +#endif // __MOTIFTOPLEVELH__ diff --git a/lib/wxWidgets/include/wx/motif/window.h b/lib/wxWidgets/include/wx/motif/window.h new file mode 100644 index 0000000..d8cf29d --- /dev/null +++ b/lib/wxWidgets/include/wx/motif/window.h @@ -0,0 +1,329 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/motif/window.h +// Purpose: wxWindow class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WINDOW_H_ +#define _WX_WINDOW_H_ + +#include "wx/region.h" + +// ---------------------------------------------------------------------------- +// wxWindow class for Motif - see also wxWindowBase +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWindow : public wxWindowBase +{ + friend class WXDLLIMPEXP_FWD_CORE wxDC; + friend class WXDLLIMPEXP_FWD_CORE wxWindowDC; + +public: + wxWindow() { Init(); } + + wxWindow(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)) + { + Init(); + Create(parent, id, pos, size, style, name); + } + + virtual ~wxWindow(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)); + + // implement base class pure virtuals + virtual void SetLabel(const wxString& label); + virtual wxString GetLabel() const; + + virtual void Raise(); + virtual void Lower(); + + virtual bool Show( bool show = true ); + virtual bool Enable( bool enable = true ); + + virtual void SetFocus(); + + virtual void WarpPointer(int x, int y); + + virtual void Refresh( bool eraseBackground = true, + const wxRect *rect = (const wxRect *) NULL ); + + virtual bool SetBackgroundColour( const wxColour &colour ); + virtual bool SetForegroundColour( const wxColour &colour ); + + virtual bool SetCursor( const wxCursor &cursor ); + virtual bool SetFont( const wxFont &font ); + + virtual int GetCharHeight() const; + virtual int GetCharWidth() const; + + virtual void SetScrollbar( int orient, int pos, int thumbVisible, + int range, bool refresh = true ); + virtual void SetScrollPos( int orient, int pos, bool refresh = true ); + virtual int GetScrollPos( int orient ) const; + virtual int GetScrollThumb( int orient ) const; + virtual int GetScrollRange( int orient ) const; + virtual void ScrollWindow( int dx, int dy, + const wxRect* rect = NULL ); + +#if wxUSE_DRAG_AND_DROP + virtual void SetDropTarget( wxDropTarget *dropTarget ); +#endif // wxUSE_DRAG_AND_DROP + + // Accept files for dragging + virtual void DragAcceptFiles(bool accept); + + // Get the unique identifier of a window + virtual WXWidget GetHandle() const { return GetMainWidget(); } + + // implementation from now on + // -------------------------- + + // accessors + // --------- + + // Get main widget for this window, e.g. a text widget + virtual WXWidget GetMainWidget() const; + // Get the widget that corresponds to the label (for font setting, + // label setting etc.) + virtual WXWidget GetLabelWidget() const; + // Get the client widget for this window (something we can create other + // windows on) + virtual WXWidget GetClientWidget() const; + // Get the top widget for this window, e.g. the scrolled widget parent of a + // multi-line text widget. Top means, top in the window hierarchy that + // implements this window. + virtual WXWidget GetTopWidget() const; + + // Get the underlying X window and display + WXWindow GetClientXWindow() const; + WXWindow GetXWindow() const; + WXDisplay *GetXDisplay() const; + + void SetLastClick(int button, long timestamp) + { m_lastButton = button; m_lastTS = timestamp; } + + int GetLastClickedButton() const { return m_lastButton; } + long GetLastClickTime() const { return m_lastTS; } + + // Gives window a chance to do something in response to a size message, + // e.g. arrange status bar, toolbar etc. + virtual bool PreResize(); + + // Generates a paint event + virtual void DoPaint(); + + // update rectangle/region manipulation + // (for wxWindowDC and Motif callbacks only) + // ----------------------------------------- + + // Adds a rectangle to the updates list + void AddUpdateRect(int x, int y, int w, int h); + + void ClearUpdateRegion() { m_updateRegion.Clear(); } + void SetUpdateRegion(const wxRegion& region) { m_updateRegion = region; } + + // post-creation activities + void PostCreation(); + + // pre-creation activities + void PreCreation(); + +protected: + // Responds to colour changes: passes event on to children. + void OnSysColourChanged(wxSysColourChangedEvent& event); + + // Motif-specific + + void SetMainWidget(WXWidget w) { m_mainWidget = w; } + + // See src/motif/window.cpp, near the top, for an explanation + // why this is necessary + void CanvasSetSizeIntr(int x, int y, int width, int height, + int sizeFlags, bool fromCtor); + void DoSetSizeIntr(int x, int y, + int width, int height, + int sizeFlags, bool fromCtor); + + // for DoMoveWindowIntr flags + enum + { + wxMOVE_X = 1, + wxMOVE_Y = 2, + wxMOVE_WIDTH = 4, + wxMOVE_HEIGHT = 8 + }; + + void DoMoveWindowIntr(int x, int y, int width, int height, + int flags); + + // helper function, to remove duplicate code, used in wxScrollBar + WXWidget DoCreateScrollBar(WXWidget parent, wxOrientation orientation, + void (*callback)()); +public: + WXPixmap GetBackingPixmap() const { return m_backingPixmap; } + void SetBackingPixmap(WXPixmap pixmap) { m_backingPixmap = pixmap; } + int GetPixmapWidth() const { return m_pixmapWidth; } + int GetPixmapHeight() const { return m_pixmapHeight; } + void SetPixmapWidth(int w) { m_pixmapWidth = w; } + void SetPixmapHeight(int h) { m_pixmapHeight = h; } + + // Change properties + // Change to the current font (often overridden) + virtual void ChangeFont(bool keepOriginalSize = true); + + // Change background and foreground colour using current background colour + // setting (Motif generates foreground based on background) + virtual void ChangeBackgroundColour(); + // Change foreground colour using current foreground colour setting + virtual void ChangeForegroundColour(); + +protected: + // Adds the widget to the hash table and adds event handlers. + bool AttachWidget(wxWindow* parent, WXWidget mainWidget, + WXWidget formWidget, int x, int y, int width, int height); + bool DetachWidget(WXWidget widget); + + // How to implement accelerators. If we find a key event, translate to + // wxWidgets wxKeyEvent form. Find a widget for the window. Now find a + // wxWindow for the widget. If there isn't one, go up the widget hierarchy + // trying to find one. Once one is found, call ProcessAccelerator for the + // window. If it returns true (processed the event), skip the X event, + // otherwise carry on up the wxWidgets window hierarchy calling + // ProcessAccelerator. If all return false, process the X event as normal. + // Eventually we can implement OnCharHook the same way, but concentrate on + // accelerators for now. ProcessAccelerator must look at the current + // accelerator table, and try to find what menu id or window (beneath it) + // has this ID. Then construct an appropriate command + // event and send it. +public: + virtual bool ProcessAccelerator(wxKeyEvent& event); + +protected: + // unmanage and destroy an X widget f it's !NULL (passing NULL is ok) + void UnmanageAndDestroy(WXWidget widget); + + // map or unmap an X widget (passing NULL is ok), + // returns true if widget was mapped/unmapped + bool MapOrUnmap(WXWidget widget, bool map); + + // scrolling stuff + // --------------- + + // create/destroy window scrollbars + void CreateScrollbar(wxOrientation orientation); + void DestroyScrollbar(wxOrientation orientation); + + // get either hor or vert scrollbar widget + WXWidget GetScrollbar(wxOrientation orient) const + { return orient == wxHORIZONTAL ? m_hScrollBar : m_vScrollBar; } + + // set the scroll pos + void SetInternalScrollPos(wxOrientation orient, int pos) + { + if ( orient == wxHORIZONTAL ) + m_scrollPosX = pos; + else + m_scrollPosY = pos; + } + + // Motif-specific flags + // -------------------- + + bool m_needsRefresh:1; // repaint backing store? + + // For double-click detection + long m_lastTS; // last timestamp + unsigned m_lastButton:2; // last pressed button + +protected: + WXWidget m_mainWidget; + WXWidget m_hScrollBar; + WXWidget m_vScrollBar; + WXWidget m_borderWidget; + WXWidget m_scrolledWindow; + WXWidget m_drawingArea; + bool m_winCaptured:1; + WXPixmap m_backingPixmap; + int m_pixmapWidth; + int m_pixmapHeight; + int m_pixmapOffsetX; + int m_pixmapOffsetY; + + // Store the last scroll pos, since in wxWin the pos isn't set + // automatically by system + int m_scrollPosX; + int m_scrollPosY; + + // implement the base class pure virtuals + virtual void DoGetTextExtent(const wxString& string, + int *x, int *y, + int *descent = NULL, + int *externalLeading = NULL, + const wxFont *font = NULL) const; + virtual void DoClientToScreen( int *x, int *y ) const; + virtual void DoScreenToClient( int *x, int *y ) const; + virtual void DoGetPosition( int *x, int *y ) const; + virtual void DoGetSize( int *width, int *height ) const; + virtual void DoGetClientSize( int *width, int *height ) const; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + virtual void DoSetClientSize(int width, int height); + virtual void DoMoveWindow(int x, int y, int width, int height); + virtual bool DoPopupMenu(wxMenu *menu, int x, int y); + virtual void DoCaptureMouse(); + virtual void DoReleaseMouse(); + +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip( wxToolTip *tip ); +#endif // wxUSE_TOOLTIPS + +private: + // common part of all ctors + void Init(); + + wxDECLARE_DYNAMIC_CLASS(wxWindow); + wxDECLARE_NO_COPY_CLASS(wxWindow); + wxDECLARE_EVENT_TABLE(); +}; + +// ---------------------------------------------------------------------------- +// A little class to switch off `size optimization' while an instance of the +// object exists: this may be useful to temporarily disable the optimisation +// which consists to do nothing when the new size is equal to the old size - +// although quite useful usually to avoid flicker, sometimes it leads to +// undesired effects. +// +// Usage: create an instance of this class on the stack to disable the size +// optimisation, it will be re-enabled as soon as the object goes out +// from scope. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxNoOptimize +{ +public: + wxNoOptimize() { ms_count++; } + ~wxNoOptimize() { ms_count--; } + + static bool CanOptimize() { return ms_count == 0; } + +protected: + static int ms_count; +}; + +#endif // _WX_WINDOW_H_ diff --git a/lib/wxWidgets/include/wx/mousemanager.h b/lib/wxWidgets/include/wx/mousemanager.h new file mode 100644 index 0000000..997bee0 --- /dev/null +++ b/lib/wxWidgets/include/wx/mousemanager.h @@ -0,0 +1,153 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/mousemanager.h +// Purpose: wxMouseEventsManager class declaration +// Author: Vadim Zeitlin +// Created: 2009-04-20 +// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MOUSEMANAGER_H_ +#define _WX_MOUSEMANAGER_H_ + +#include "wx/event.h" + +// ---------------------------------------------------------------------------- +// wxMouseEventsManager +// ---------------------------------------------------------------------------- + +/* + This class handles mouse events and synthesizes high-level notifications + such as clicks and drag events from low level mouse button presses and + mouse movement events. It is useful because handling the mouse events is + less obvious than might seem at a first glance: for example, clicks on an + object should only be generated if the mouse was both pressed and released + over it and not just released (so it requires storing the previous state) + and dragging shouldn't start before the mouse moves away far enough. + + This class encapsulates all these dull details for controls containing + multiple items which can be identified by a positive integer index and you + just need to implement its pure virtual functions to use it. + */ +class WXDLLIMPEXP_CORE wxMouseEventsManager : public wxEvtHandler +{ +public: + // a mouse event manager is always associated with a window and must be + // deleted by the window when it is destroyed so if it is created using the + // default ctor Create() must be called later + wxMouseEventsManager() { Init(); } + wxMouseEventsManager(wxWindow *win) { Init(); Create(win); } + bool Create(wxWindow *win); + + virtual ~wxMouseEventsManager(); + +protected: + // called to find the item at the given position: return wxNOT_FOUND (-1) + // if there is no item here + virtual int MouseHitTest(const wxPoint& pos) = 0; + + // called when the user clicked (i.e. pressed and released mouse over the + // same item), should normally generate a notification about this click and + // return true if it was handled or false otherwise, determining whether + // the original mouse event is skipped or not + virtual bool MouseClicked(int item) = 0; + + // called to start dragging the given item, should generate the appropriate + // BEGIN_DRAG event and return false if dragging this item was forbidden + virtual bool MouseDragBegin(int item, const wxPoint& pos) = 0; + + // called while the item is being dragged, should normally update the + // feedback on screen (usually using wxOverlay) + virtual void MouseDragging(int item, const wxPoint& pos) = 0; + + // called when the mouse is released after dragging the item + virtual void MouseDragEnd(int item, const wxPoint& pos) = 0; + + // called when mouse capture is lost while dragging the item, should remove + // the visual feedback drawn by MouseDragging() + virtual void MouseDragCancelled(int item) = 0; + + + // you don't need to override those but you will want to do if it your + // control renders pressed items differently + + // called when the item is becomes pressed, can be used to change its + // appearance + virtual void MouseClickBegin(int WXUNUSED(item)) { } + + // called if the mouse capture was lost while the item was pressed, can be + // used to restore the default item appearance if it was changed in + // MouseClickBegin() + virtual void MouseClickCancelled(int WXUNUSED(item)) { } + +private: + /* + Here is a small diagram explaining the switches between different + states: + + + /---------->NORMAL<--------------- Drag end + / / / | event + / / | | ^ + / / | | | + Click / N | | mouse | mouse up + event / | | down | + | / | | DRAGGING + | / | | ^ + Y|/ N \ v |Y + +-------------+ +--------+ N +-----------+ + |On same item?| |On item?| -----------|Begin drag?| + +-------------+ +--------+ / +-----------+ + ^ | / ^ + | | / | + \ mouse | / mouse moved | + \ up v v far enough / + \--------PRESSED-------------------/ + + + There are also transitions from PRESSED and DRAGGING to NORMAL in case + the mouse capture is lost or Escape key is pressed which are not shown. + */ + enum State + { + State_Normal, // initial, default state + State_Pressed, // mouse was pressed over an item + State_Dragging // the item is being dragged + }; + + // common part of both ctors + void Init(); + + // various event handlers + void OnCaptureLost(wxMouseCaptureLostEvent& event); + void OnLeftDown(wxMouseEvent& event); + void OnLeftUp(wxMouseEvent& event); + void OnMove(wxMouseEvent& event); + + + // the associated window, never NULL except between the calls to the + // default ctor and Create() + wxWindow *m_win; + + // the current state + State m_state; + + // the details of the operation currently in progress, only valid if + // m_state is not normal + + // the item being pressed or dragged (always valid, i.e. != wxNOT_FOUND if + // m_state != State_Normal) + int m_item; + + // the position of the last mouse event of interest: either mouse press in + // State_Pressed or last movement event in State_Dragging + wxPoint m_posLast; + + + wxDECLARE_EVENT_TABLE(); + + wxDECLARE_NO_COPY_CLASS(wxMouseEventsManager); +}; + +#endif // _WX_MOUSEMANAGER_H_ + diff --git a/lib/wxWidgets/include/wx/mousestate.h b/lib/wxWidgets/include/wx/mousestate.h new file mode 100644 index 0000000..9e36837 --- /dev/null +++ b/lib/wxWidgets/include/wx/mousestate.h @@ -0,0 +1,149 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/mousestate.h +// Purpose: Declaration of wxMouseState class +// Author: Vadim Zeitlin +// Created: 2008-09-19 (extracted from wx/utils.h) +// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MOUSESTATE_H_ +#define _WX_MOUSESTATE_H_ + +#include "wx/gdicmn.h" // for wxPoint +#include "wx/kbdstate.h" + +// the symbolic names for the mouse buttons +enum wxMouseButton +{ + wxMOUSE_BTN_ANY = -1, + wxMOUSE_BTN_NONE = 0, + wxMOUSE_BTN_LEFT = 1, + wxMOUSE_BTN_MIDDLE = 2, + wxMOUSE_BTN_RIGHT = 3, + wxMOUSE_BTN_AUX1 = 4, + wxMOUSE_BTN_AUX2 = 5, + wxMOUSE_BTN_MAX +}; + +// ---------------------------------------------------------------------------- +// wxMouseState contains the information about mouse position, buttons and also +// key modifiers +// ---------------------------------------------------------------------------- + +// wxMouseState is used to hold information about button and modifier state +// and is what is returned from wxGetMouseState. +class WXDLLIMPEXP_CORE wxMouseState : public wxKeyboardState +{ +public: + wxMouseState() + : m_leftDown(false), m_middleDown(false), m_rightDown(false), + m_aux1Down(false), m_aux2Down(false), + m_x(0), m_y(0) + { + } + + // default copy ctor, assignment operator and dtor are ok + + + // accessors for the mouse position + wxCoord GetX() const { return m_x; } + wxCoord GetY() const { return m_y; } + wxPoint GetPosition() const { return wxPoint(m_x, m_y); } + void GetPosition(wxCoord *x, wxCoord *y) const + { + if ( x ) + *x = m_x; + if ( y ) + *y = m_y; + } + + // this overload is for compatibility only + void GetPosition(long *x, long *y) const + { + if ( x ) + *x = m_x; + if ( y ) + *y = m_y; + } + + // accessors for the pressed buttons + bool LeftIsDown() const { return m_leftDown; } + bool MiddleIsDown() const { return m_middleDown; } + bool RightIsDown() const { return m_rightDown; } + bool Aux1IsDown() const { return m_aux1Down; } + bool Aux2IsDown() const { return m_aux2Down; } + + bool ButtonIsDown(wxMouseButton but) const + { + switch ( but ) + { + case wxMOUSE_BTN_ANY: + return LeftIsDown() || MiddleIsDown() || RightIsDown() || + Aux1IsDown() || Aux2IsDown(); + + case wxMOUSE_BTN_LEFT: + return LeftIsDown(); + + case wxMOUSE_BTN_MIDDLE: + return MiddleIsDown(); + + case wxMOUSE_BTN_RIGHT: + return RightIsDown(); + + case wxMOUSE_BTN_AUX1: + return Aux1IsDown(); + + case wxMOUSE_BTN_AUX2: + return Aux2IsDown(); + + case wxMOUSE_BTN_NONE: + case wxMOUSE_BTN_MAX: + break; + } + + wxFAIL_MSG(wxS("invalid parameter")); + return false; + } + + + // these functions are mostly used by wxWidgets itself + void SetX(wxCoord x) { m_x = x; } + void SetY(wxCoord y) { m_y = y; } + void SetPosition(const wxPoint& pos) { m_x = pos.x; m_y = pos.y; } + + void SetLeftDown(bool down) { m_leftDown = down; } + void SetMiddleDown(bool down) { m_middleDown = down; } + void SetRightDown(bool down) { m_rightDown = down; } + void SetAux1Down(bool down) { m_aux1Down = down; } + void SetAux2Down(bool down) { m_aux2Down = down; } + + // this mostly makes sense in the derived classes such as wxMouseEvent + void SetState(const wxMouseState& state) { *this = state; } + + // these functions are for compatibility only, they were used in 2.8 + // version of wxMouseState but their names are confusing as wxMouseEvent + // has methods with the same names which do something quite different so + // don't use them any more +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED_INLINE(bool LeftDown() const, return LeftIsDown(); ) + wxDEPRECATED_INLINE(bool MiddleDown() const, return MiddleIsDown(); ) + wxDEPRECATED_INLINE(bool RightDown() const, return RightIsDown(); ) +#endif // WXWIN_COMPATIBILITY_2_8 + + // for compatibility reasons these variables are public as the code using + // wxMouseEvent often uses them directly -- however they should not be + // accessed directly in this class, use the accessors above instead +// private: + bool m_leftDown : 1; + bool m_middleDown : 1; + bool m_rightDown : 1; + bool m_aux1Down : 1; + bool m_aux2Down : 1; + + wxCoord m_x, + m_y; +}; + +#endif // _WX_MOUSESTATE_H_ + diff --git a/lib/wxWidgets/include/wx/msgdlg.h b/lib/wxWidgets/include/wx/msgdlg.h new file mode 100644 index 0000000..3606e0e --- /dev/null +++ b/lib/wxWidgets/include/wx/msgdlg.h @@ -0,0 +1,326 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msgdlg.h +// Purpose: common header and base class for wxMessageDialog +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSGDLG_H_BASE_ +#define _WX_MSGDLG_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_MSGDLG + +#include "wx/dialog.h" +#include "wx/stockitem.h" + +extern WXDLLIMPEXP_DATA_CORE(const char) wxMessageBoxCaptionStr[]; + +// ---------------------------------------------------------------------------- +// wxMessageDialogBase: base class defining wxMessageDialog interface +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMessageDialogBase : public wxDialog +{ +public: + // helper class for SetXXXLabels() methods: it makes it possible to pass + // either a stock id (wxID_CLOSE) or a string ("&Close") to them + class ButtonLabel + { + public: + // ctors are not explicit, objects of this class can be implicitly + // constructed from either stock ids or strings + ButtonLabel(int stockId) + : m_stockId(stockId) + { + wxASSERT_MSG( wxIsStockID(stockId), "invalid stock id" ); + } + + ButtonLabel(const wxString& label) + : m_label(label), m_stockId(wxID_NONE) + { + } + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + ButtonLabel(const char *label) + : m_label(label), m_stockId(wxID_NONE) + { + } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + + ButtonLabel(const wchar_t *label) + : m_label(label), m_stockId(wxID_NONE) + { + } + + ButtonLabel(const wxCStrData& label) + : m_label(label), m_stockId(wxID_NONE) + { + } + + // default copy ctor and dtor are ok + + // get the string label, whether it was originally specified directly + // or as a stock id -- this is only useful for platforms without native + // stock items id support + wxString GetAsString() const + { + return m_stockId == wxID_NONE + ? m_label + : wxGetStockLabel(m_stockId, wxSTOCK_FOR_BUTTON); + } + + // return the stock id or wxID_NONE if this is not a stock label + int GetStockId() const { return m_stockId; } + + private: + // the label if explicitly given or empty if this is a stock item + const wxString m_label; + + // the stock item id or wxID_NONE if m_label should be used + const int m_stockId; + }; + + // ctors + wxMessageDialogBase() { m_dialogStyle = 0; } + wxMessageDialogBase(wxWindow *parent, + const wxString& message, + const wxString& caption, + long style) + : m_message(message), + m_caption(caption) + { + m_parent = GetParentForModalDialog(parent, style); + SetMessageDialogStyle(style); + } + + // virtual dtor for the base class + virtual ~wxMessageDialogBase() { } + + wxString GetCaption() const { return m_caption; } + + // Title and caption are the same thing, GetCaption() mostly exists just + // for compatibility. + virtual void SetTitle(const wxString& title) wxOVERRIDE { m_caption = title; } + virtual wxString GetTitle() const wxOVERRIDE { return m_caption; } + + + virtual void SetMessage(const wxString& message) + { + m_message = message; + } + + wxString GetMessage() const { return m_message; } + + void SetExtendedMessage(const wxString& extendedMessage) + { + m_extendedMessage = extendedMessage; + } + + wxString GetExtendedMessage() const { return m_extendedMessage; } + + // change the dialog style flag + void SetMessageDialogStyle(long style) + { + wxASSERT_MSG( ((style & wxYES_NO) == wxYES_NO) || !(style & wxYES_NO), + "wxYES and wxNO may only be used together" ); + + wxASSERT_MSG( !(style & wxYES) || !(style & wxOK), + "wxOK and wxYES/wxNO can't be used together" ); + + // It is common to specify just the icon, without wxOK, in the existing + // code, especially one written by Windows programmers as MB_OK is 0 + // and so they're used to omitting wxOK. Don't complain about it but + // just add wxOK implicitly for compatibility. + if ( !(style & wxYES) && !(style & wxOK) ) + style |= wxOK; + + wxASSERT_MSG( (style & wxID_OK) != wxID_OK, + "wxMessageBox: Did you mean wxOK (and not wxID_OK)?" ); + + wxASSERT_MSG( !(style & wxNO_DEFAULT) || (style & wxNO), + "wxNO_DEFAULT is invalid without wxNO" ); + + wxASSERT_MSG( !(style & wxCANCEL_DEFAULT) || (style & wxCANCEL), + "wxCANCEL_DEFAULT is invalid without wxCANCEL" ); + + wxASSERT_MSG( !(style & wxCANCEL_DEFAULT) || !(style & wxNO_DEFAULT), + "only one default button can be specified" ); + + m_dialogStyle = style; + } + + long GetMessageDialogStyle() const { return m_dialogStyle; } + + // customization of the message box buttons + virtual bool SetYesNoLabels(const ButtonLabel& yes,const ButtonLabel& no) + { + DoSetCustomLabel(m_yes, yes); + DoSetCustomLabel(m_no, no); + return true; + } + + virtual bool SetYesNoCancelLabels(const ButtonLabel& yes, + const ButtonLabel& no, + const ButtonLabel& cancel) + { + DoSetCustomLabel(m_yes, yes); + DoSetCustomLabel(m_no, no); + DoSetCustomLabel(m_cancel, cancel); + return true; + } + + virtual bool SetOKLabel(const ButtonLabel& ok) + { + DoSetCustomLabel(m_ok, ok); + return true; + } + + virtual bool SetOKCancelLabels(const ButtonLabel& ok, + const ButtonLabel& cancel) + { + DoSetCustomLabel(m_ok, ok); + DoSetCustomLabel(m_cancel, cancel); + return true; + } + + virtual bool SetHelpLabel(const ButtonLabel& help) + { + DoSetCustomLabel(m_help, help); + return true; + } + // test if any custom labels were set + bool HasCustomLabels() const + { + return !(m_ok.empty() && m_cancel.empty() && m_help.empty() && + m_yes.empty() && m_no.empty()); + } + + // these functions return the label to be used for the button which is + // either a custom label explicitly set by the user or the default label, + // i.e. they always return a valid string + wxString GetYesLabel() const + { return m_yes.empty() ? GetDefaultYesLabel() : m_yes; } + wxString GetNoLabel() const + { return m_no.empty() ? GetDefaultNoLabel() : m_no; } + wxString GetOKLabel() const + { return m_ok.empty() ? GetDefaultOKLabel() : m_ok; } + wxString GetCancelLabel() const + { return m_cancel.empty() ? GetDefaultCancelLabel() : m_cancel; } + wxString GetHelpLabel() const + { return m_help.empty() ? GetDefaultHelpLabel() : m_help; } + + // based on message dialog style, returns exactly one of: wxICON_NONE, + // wxICON_ERROR, wxICON_WARNING, wxICON_QUESTION, wxICON_INFORMATION, + // wxICON_AUTH_NEEDED + virtual long GetEffectiveIcon() const + { + if ( m_dialogStyle & wxICON_NONE ) + return wxICON_NONE; + else if ( m_dialogStyle & wxICON_ERROR ) + return wxICON_ERROR; + else if ( m_dialogStyle & wxICON_WARNING ) + return wxICON_WARNING; + else if ( m_dialogStyle & wxICON_QUESTION ) + return wxICON_QUESTION; + else if ( m_dialogStyle & wxICON_INFORMATION ) + return wxICON_INFORMATION; + else if ( m_dialogStyle & wxYES ) + return wxICON_QUESTION; + else + return wxICON_INFORMATION; + } + +protected: + // for the platforms not supporting separate main and extended messages + // this function should be used to combine both of them in a single string + wxString GetFullMessage() const + { + wxString msg = m_message; + if ( !m_extendedMessage.empty() ) + msg << wxASCII_STR("\n\n") << m_extendedMessage; + + return msg; + } + + wxString m_message, + m_extendedMessage, + m_caption; + long m_dialogStyle; + + // this function is called by our public SetXXXLabels() and should assign + // the value to var with possibly some transformation (e.g. Cocoa version + // currently uses this to remove any accelerators from the button strings + // while GTK+ one handles stock items specifically here) + virtual void DoSetCustomLabel(wxString& var, const ButtonLabel& label) + { + var = label.GetAsString(); + } + + // these functions return the custom label or empty string and should be + // used only in specific circumstances such as creating the buttons with + // these labels (in which case it makes sense to only use a custom label if + // it was really given and fall back on stock label otherwise), use the + // Get{Yes,No,OK,Cancel}Label() methods above otherwise + const wxString& GetCustomYesLabel() const { return m_yes; } + const wxString& GetCustomNoLabel() const { return m_no; } + const wxString& GetCustomOKLabel() const { return m_ok; } + const wxString& GetCustomHelpLabel() const { return m_help; } + const wxString& GetCustomCancelLabel() const { return m_cancel; } + +private: + // these functions may be overridden to provide different defaults for the + // default button labels (this is used by wxGTK) + virtual wxString GetDefaultYesLabel() const { return wxGetTranslation("Yes"); } + virtual wxString GetDefaultNoLabel() const { return wxGetTranslation("No"); } + virtual wxString GetDefaultOKLabel() const { return wxGetTranslation("OK"); } + virtual wxString GetDefaultCancelLabel() const { return wxGetTranslation("Cancel"); } + virtual wxString GetDefaultHelpLabel() const { return wxGetTranslation("Help"); } + + // labels for the buttons, initially empty meaning that the defaults should + // be used, use GetYes/No/OK/CancelLabel() to access them + wxString m_yes, + m_no, + m_ok, + m_cancel, + m_help; + + wxDECLARE_NO_COPY_CLASS(wxMessageDialogBase); +}; + +#include "wx/generic/msgdlgg.h" + +#if defined(__WX_COMPILING_MSGDLGG_CPP__) || \ + defined(__WXUNIVERSAL__) || defined(__WXGPE__) || \ + (defined(__WXGTK__) && !defined(__WXGTK20__)) + + #define wxMessageDialog wxGenericMessageDialog +#elif defined(__WXMSW__) + #include "wx/msw/msgdlg.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/msgdlg.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/msgdlg.h" +#elif defined(__WXMAC__) + #include "wx/osx/msgdlg.h" +#elif defined(__WXQT__) + #include "wx/qt/msgdlg.h" +#endif + +// ---------------------------------------------------------------------------- +// wxMessageBox: the simplest way to use wxMessageDialog +// ---------------------------------------------------------------------------- + +int WXDLLIMPEXP_CORE wxMessageBox(const wxString& message, + const wxString& caption = wxASCII_STR(wxMessageBoxCaptionStr), + long style = wxOK | wxCENTRE, + wxWindow *parent = NULL, + int x = wxDefaultCoord, int y = wxDefaultCoord); + +#endif // wxUSE_MSGDLG + +#endif // _WX_MSGDLG_H_BASE_ diff --git a/lib/wxWidgets/include/wx/msgout.h b/lib/wxWidgets/include/wx/msgout.h new file mode 100644 index 0000000..c687661 --- /dev/null +++ b/lib/wxWidgets/include/wx/msgout.h @@ -0,0 +1,171 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msgout.h +// Purpose: wxMessageOutput class. Shows a message to the user +// Author: Mattia Barbon +// Modified by: +// Created: 17.07.02 +// Copyright: (c) Mattia Barbon +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSGOUT_H_ +#define _WX_MSGOUT_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" +#include "wx/chartype.h" +#include "wx/strvararg.h" + +// ---------------------------------------------------------------------------- +// wxMessageOutput is a class abstracting formatted output target, i.e. +// something you can printf() to +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMessageOutput +{ +public: + virtual ~wxMessageOutput() { } + + // gets the current wxMessageOutput object (may be NULL during + // initialization or shutdown) + static wxMessageOutput* Get(); + + // sets the global wxMessageOutput instance; returns the previous one + static wxMessageOutput* Set(wxMessageOutput* msgout); + + // show a message to the user + // void Printf(const wxString& format, ...) = 0; + WX_DEFINE_VARARG_FUNC_VOID(Printf, 1, (const wxFormatString&), + DoPrintfWchar, DoPrintfUtf8) + + // called by DoPrintf() to output formatted string but can also be called + // directly if no formatting is needed + virtual void Output(const wxString& str) = 0; + +protected: +#if !wxUSE_UTF8_LOCALE_ONLY + void DoPrintfWchar(const wxChar *format, ...); +#endif +#if wxUSE_UNICODE_UTF8 + void DoPrintfUtf8(const char *format, ...); +#endif + +private: + static wxMessageOutput* ms_msgOut; +}; + +// ---------------------------------------------------------------------------- +// helper mix-in for output targets that can use difference encodings +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMessageOutputWithConv +{ +protected: + explicit wxMessageOutputWithConv(const wxMBConv& conv) + : m_conv(conv.Clone()) + { + } + + ~wxMessageOutputWithConv() + { + delete m_conv; + } + + // return the string with "\n" appended if it doesn't already terminate + // with it (in which case it's returned unchanged) + wxString AppendLineFeedIfNeeded(const wxString& str); + + // Prepare the given string for output by appending a new line to it, if + // necessary, and converting it to a narrow string using our conversion + // object. + wxCharBuffer PrepareForOutput(const wxString& str); + + const wxMBConv* const m_conv; +}; + +// ---------------------------------------------------------------------------- +// implementation which sends output to stderr or specified file +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMessageOutputStderr : public wxMessageOutput, + protected wxMessageOutputWithConv +{ +public: + wxMessageOutputStderr(FILE *fp = stderr, + const wxMBConv &conv = wxConvWhateverWorks); + + virtual void Output(const wxString& str) wxOVERRIDE; + +protected: + FILE *m_fp; + + wxDECLARE_NO_COPY_CLASS(wxMessageOutputStderr); +}; + +// ---------------------------------------------------------------------------- +// implementation showing the message to the user in "best" possible way: +// uses stderr or message box if available according to the flag given to ctor. +// ---------------------------------------------------------------------------- + +enum wxMessageOutputFlags +{ + wxMSGOUT_PREFER_STDERR = 0, // use stderr if available (this is the default) + wxMSGOUT_PREFER_MSGBOX = 1 // always use message box if available +}; + +class WXDLLIMPEXP_BASE wxMessageOutputBest : public wxMessageOutputStderr +{ +public: + wxMessageOutputBest(wxMessageOutputFlags flags = wxMSGOUT_PREFER_STDERR) + : m_flags(flags) { } + + virtual void Output(const wxString& str) wxOVERRIDE; + +private: + wxMessageOutputFlags m_flags; +}; + +// ---------------------------------------------------------------------------- +// implementation which shows output in a message box +// ---------------------------------------------------------------------------- + +#if wxUSE_GUI && wxUSE_MSGDLG + +class WXDLLIMPEXP_CORE wxMessageOutputMessageBox : public wxMessageOutput +{ +public: + wxMessageOutputMessageBox() { } + + virtual void Output(const wxString& str) wxOVERRIDE; +}; + +#endif // wxUSE_GUI && wxUSE_MSGDLG + +// ---------------------------------------------------------------------------- +// implementation using the native way of outputting debug messages +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMessageOutputDebug : public wxMessageOutputStderr +{ +public: + wxMessageOutputDebug() { } + + virtual void Output(const wxString& str) wxOVERRIDE; +}; + +// ---------------------------------------------------------------------------- +// implementation using wxLog (mainly for backwards compatibility) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMessageOutputLog : public wxMessageOutput +{ +public: + wxMessageOutputLog() { } + + virtual void Output(const wxString& str) wxOVERRIDE; +}; + +#endif // _WX_MSGOUT_H_ diff --git a/lib/wxWidgets/include/wx/msgqueue.h b/lib/wxWidgets/include/wx/msgqueue.h new file mode 100644 index 0000000..8b8da87 --- /dev/null +++ b/lib/wxWidgets/include/wx/msgqueue.h @@ -0,0 +1,168 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msqqueue.h +// Purpose: Message queues for inter-thread communication +// Author: Evgeniy Tarassov +// Created: 2007-10-31 +// Copyright: (C) 2007 TT-Solutions SARL +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSGQUEUE_H_ +#define _WX_MSGQUEUE_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/thread.h" + +#if wxUSE_THREADS + +#include "wx/stopwatch.h" + +#include "wx/beforestd.h" +#include <queue> +#include "wx/afterstd.h" + +enum wxMessageQueueError +{ + wxMSGQUEUE_NO_ERROR = 0, // operation completed successfully + wxMSGQUEUE_TIMEOUT, // no messages received before timeout expired + wxMSGQUEUE_MISC_ERROR // some unexpected (and fatal) error has occurred +}; + +// --------------------------------------------------------------------------- +// Message queue allows passing message between threads. +// +// This class is typically used for communicating between the main and worker +// threads. The main thread calls Post() and the worker thread calls Receive(). +// +// For this class a message is an object of arbitrary type T. Notice that +// typically there must be some special message indicating that the thread +// should terminate as there is no other way to gracefully shutdown a thread +// waiting on the message queue. +// --------------------------------------------------------------------------- +template <typename T> +class wxMessageQueue +{ +public: + // The type of the messages transported by this queue + typedef T Message; + + // Default ctor creates an initially empty queue + wxMessageQueue() + : m_conditionNotEmpty(m_mutex) + { + } + + // Add a message to this queue and signal the threads waiting for messages. + // + // This method is safe to call from multiple threads in parallel. + wxMessageQueueError Post(const Message& msg) + { + wxMutexLocker locker(m_mutex); + + wxCHECK( locker.IsOk(), wxMSGQUEUE_MISC_ERROR ); + + m_messages.push(msg); + + m_conditionNotEmpty.Signal(); + + return wxMSGQUEUE_NO_ERROR; + } + + // Remove all messages from the queue. + // + // This method is meant to be called from the same thread(s) that call + // Post() to discard any still pending requests if they became unnecessary. + wxMessageQueueError Clear() + { + wxCHECK( IsOk(), wxMSGQUEUE_MISC_ERROR ); + + wxMutexLocker locker(m_mutex); + + std::queue<T> empty; + std::swap(m_messages, empty); + + return wxMSGQUEUE_NO_ERROR; + } + + // Wait no more than timeout milliseconds until a message becomes available. + // + // Setting timeout to 0 is equivalent to an infinite timeout. See Receive(). + wxMessageQueueError ReceiveTimeout(long timeout, T& msg) + { + wxCHECK( IsOk(), wxMSGQUEUE_MISC_ERROR ); + + wxMutexLocker locker(m_mutex); + + wxCHECK( locker.IsOk(), wxMSGQUEUE_MISC_ERROR ); + + const wxMilliClock_t waitUntil = wxGetLocalTimeMillis() + timeout; + while ( m_messages.empty() ) + { + wxCondError result = m_conditionNotEmpty.WaitTimeout(timeout); + + if ( result == wxCOND_NO_ERROR ) + continue; + + wxCHECK( result == wxCOND_TIMEOUT, wxMSGQUEUE_MISC_ERROR ); + + const wxMilliClock_t now = wxGetLocalTimeMillis(); + + if ( now >= waitUntil ) + return wxMSGQUEUE_TIMEOUT; + + timeout = (waitUntil - now).ToLong(); + wxASSERT(timeout > 0); + } + + msg = m_messages.front(); + m_messages.pop(); + + return wxMSGQUEUE_NO_ERROR; + } + + // Same as ReceiveTimeout() but waits for as long as it takes for a message + // to become available (so it can't return wxMSGQUEUE_TIMEOUT) + wxMessageQueueError Receive(T& msg) + { + wxCHECK( IsOk(), wxMSGQUEUE_MISC_ERROR ); + + wxMutexLocker locker(m_mutex); + + wxCHECK( locker.IsOk(), wxMSGQUEUE_MISC_ERROR ); + + while ( m_messages.empty() ) + { + wxCondError result = m_conditionNotEmpty.Wait(); + + wxCHECK( result == wxCOND_NO_ERROR, wxMSGQUEUE_MISC_ERROR ); + } + + msg = m_messages.front(); + m_messages.pop(); + + return wxMSGQUEUE_NO_ERROR; + } + + // Return false only if there was a fatal error in ctor + bool IsOk() const + { + return m_conditionNotEmpty.IsOk(); + } + +private: + // Disable copy ctor and assignment operator + wxMessageQueue(const wxMessageQueue<T>& rhs); + wxMessageQueue<T>& operator=(const wxMessageQueue<T>& rhs); + + mutable wxMutex m_mutex; + wxCondition m_conditionNotEmpty; + + std::queue<T> m_messages; +}; + +#endif // wxUSE_THREADS + +#endif // _WX_MSGQUEUE_H_ diff --git a/lib/wxWidgets/include/wx/mstream.h b/lib/wxWidgets/include/wx/mstream.h new file mode 100644 index 0000000..b4e7303 --- /dev/null +++ b/lib/wxWidgets/include/wx/mstream.h @@ -0,0 +1,94 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mstream.h +// Purpose: Memory stream classes +// Author: Guilhem Lavaux +// Modified by: +// Created: 11/07/98 +// Copyright: (c) Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WXMMSTREAM_H__ +#define _WX_WXMMSTREAM_H__ + +#include "wx/defs.h" + +#if wxUSE_STREAMS + +#include "wx/stream.h" + +class WXDLLIMPEXP_FWD_BASE wxMemoryOutputStream; + +class WXDLLIMPEXP_BASE wxMemoryInputStream : public wxInputStream +{ +public: + wxMemoryInputStream(const void *data, size_t length); + wxMemoryInputStream(const wxMemoryOutputStream& stream); + wxMemoryInputStream(wxInputStream& stream, + wxFileOffset lenFile = wxInvalidOffset) + { + InitFromStream(stream, lenFile); + } + wxMemoryInputStream(wxMemoryInputStream& stream) + : wxInputStream() + { + InitFromStream(stream, wxInvalidOffset); + } + + virtual ~wxMemoryInputStream(); + virtual wxFileOffset GetLength() const wxOVERRIDE { return m_length; } + virtual bool IsSeekable() const wxOVERRIDE { return true; } + + virtual char Peek() wxOVERRIDE; + virtual bool CanRead() const wxOVERRIDE; + + wxStreamBuffer *GetInputStreamBuffer() const { return m_i_streambuf; } + +protected: + wxStreamBuffer *m_i_streambuf; + + size_t OnSysRead(void *buffer, size_t nbytes) wxOVERRIDE; + wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE; + wxFileOffset OnSysTell() const wxOVERRIDE; + +private: + // common part of ctors taking wxInputStream + void InitFromStream(wxInputStream& stream, wxFileOffset lenFile); + + size_t m_length; + + // copy ctor is implemented above: it copies the other stream in this one + wxDECLARE_ABSTRACT_CLASS(wxMemoryInputStream); + wxDECLARE_NO_ASSIGN_CLASS(wxMemoryInputStream); +}; + +class WXDLLIMPEXP_BASE wxMemoryOutputStream : public wxOutputStream +{ +public: + // if data is !NULL it must be allocated with malloc() + wxMemoryOutputStream(void *data = NULL, size_t length = 0); + virtual ~wxMemoryOutputStream(); + virtual wxFileOffset GetLength() const wxOVERRIDE { return m_o_streambuf->GetLastAccess(); } + virtual bool IsSeekable() const wxOVERRIDE { return true; } + + size_t CopyTo(void *buffer, size_t len) const; + + wxStreamBuffer *GetOutputStreamBuffer() const { return m_o_streambuf; } + +protected: + wxStreamBuffer *m_o_streambuf; + +protected: + size_t OnSysWrite(const void *buffer, size_t nbytes) wxOVERRIDE; + wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE; + wxFileOffset OnSysTell() const wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxMemoryOutputStream); + wxDECLARE_NO_COPY_CLASS(wxMemoryOutputStream); +}; + +#endif + // wxUSE_STREAMS + +#endif + // _WX_WXMMSTREAM_H__ diff --git a/lib/wxWidgets/include/wx/msw/accel.h b/lib/wxWidgets/include/wx/msw/accel.h new file mode 100644 index 0000000..3257557 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/accel.h @@ -0,0 +1,45 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/accel.h +// Purpose: wxAcceleratorTable class +// Author: Julian Smart +// Modified by: +// Created: 31/7/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ACCEL_H_ +#define _WX_ACCEL_H_ + +class WXDLLIMPEXP_FWD_CORE wxWindow; + +// ---------------------------------------------------------------------------- +// the accel table has all accelerators for a given window or menu +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxAcceleratorTable : public wxObject +{ +public: + // default ctor + wxAcceleratorTable() { } + + // load from .rc resource (Windows specific) + wxAcceleratorTable(const wxString& resource); + + // initialize from array + wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]); + + bool Ok() const { return IsOk(); } + bool IsOk() const; + void SetHACCEL(WXHACCEL hAccel); + WXHACCEL GetHACCEL() const; + + // translate the accelerator, return true if done + bool Translate(wxWindow *window, WXMSG *msg) const; + +private: + wxDECLARE_DYNAMIC_CLASS(wxAcceleratorTable); +}; + +#endif + // _WX_ACCEL_H_ diff --git a/lib/wxWidgets/include/wx/msw/anybutton.h b/lib/wxWidgets/include/wx/msw/anybutton.h new file mode 100644 index 0000000..be548f4 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/anybutton.h @@ -0,0 +1,81 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/anybutton.h +// Purpose: wxAnyButton class +// Author: Julian Smart +// Created: 1997-02-01 (extracted from button.h) +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_ANYBUTTON_H_ +#define _WX_MSW_ANYBUTTON_H_ + +// ---------------------------------------------------------------------------- +// Common button functionality +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxAnyButton : public wxAnyButtonBase +{ +public: + wxAnyButton() + { + m_imageData = NULL; +#if wxUSE_MARKUP + m_markupText = NULL; +#endif // wxUSE_MARKUP + } + + virtual ~wxAnyButton(); + + // overridden base class methods + virtual void SetLabel(const wxString& label) wxOVERRIDE; + virtual bool SetBackgroundColour(const wxColour &colour) wxOVERRIDE; + virtual bool SetForegroundColour(const wxColour &colour) wxOVERRIDE; + + // implementation from now on + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) wxOVERRIDE; + + virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item) wxOVERRIDE; + + // returns true if the platform should explicitly apply a theme border + virtual bool CanApplyThemeBorder() const wxOVERRIDE { return false; } + +protected: + // usually overridden base class virtuals + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + virtual wxBitmap DoGetBitmap(State which) const wxOVERRIDE; + virtual void DoSetBitmap(const wxBitmapBundle& bitmap, State which) wxOVERRIDE; + virtual wxSize DoGetBitmapMargins() const wxOVERRIDE; + virtual void DoSetBitmapMargins(wxCoord x, wxCoord y) wxOVERRIDE; + virtual void DoSetBitmapPosition(wxDirection dir) wxOVERRIDE; + +#if wxUSE_MARKUP + virtual bool DoSetLabelMarkup(const wxString& markup) wxOVERRIDE; +#endif // wxUSE_MARKUP + + // Increases the passed in size to account for the button image. + // + // Should only be called if we do have a button, i.e. if m_imageData is + // non-NULL. + void AdjustForBitmapSize(wxSize& size) const; + + class wxButtonImageData *m_imageData; + +#if wxUSE_MARKUP + class wxMarkupText *m_markupText; +#endif // wxUSE_MARKUP + + // Switches button into owner-drawn mode: this is used if we need to draw + // something not supported by the native control, such as using non default + // colours or a bitmap on pre-XP systems. + void MakeOwnerDrawn(); + bool IsOwnerDrawn() const; + + virtual bool MSWIsPushed() const; + +private: + wxDECLARE_NO_COPY_CLASS(wxAnyButton); +}; + +#endif // _WX_MSW_ANYBUTTON_H_ diff --git a/lib/wxWidgets/include/wx/msw/app.h b/lib/wxWidgets/include/wx/msw/app.h new file mode 100644 index 0000000..6a8c8ba --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/app.h @@ -0,0 +1,138 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/app.h +// Purpose: wxApp class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_APP_H_ +#define _WX_APP_H_ + +#include "wx/event.h" +#include "wx/icon.h" + +class WXDLLIMPEXP_FWD_CORE wxFrame; +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxApp; +class WXDLLIMPEXP_FWD_CORE wxKeyEvent; +class WXDLLIMPEXP_FWD_BASE wxLog; + +// Represents the application. Derive OnInit and declare +// a new App object to start application +class WXDLLIMPEXP_CORE wxApp : public wxAppBase +{ +public: + wxApp(); + virtual ~wxApp(); + + // override base class (pure) virtuals + virtual bool Initialize(int& argc, wxChar **argv) wxOVERRIDE; + virtual void CleanUp() wxOVERRIDE; + + virtual void WakeUpIdle() wxOVERRIDE; + + virtual void SetPrintMode(int mode) wxOVERRIDE { m_printMode = mode; } + virtual int GetPrintMode() const { return m_printMode; } + + // implementation only + void OnIdle(wxIdleEvent& event); + void OnEndSession(wxCloseEvent& event); + void OnQueryEndSession(wxCloseEvent& event); + +#if wxUSE_EXCEPTIONS + virtual bool OnExceptionInMainLoop() wxOVERRIDE; +#endif // wxUSE_EXCEPTIONS + + // MSW-specific from now on + // ------------------------ + + // this suffix should be appended to all our Win32 class names to obtain a + // variant registered without CS_[HV]REDRAW styles + static const wxChar *GetNoRedrawClassSuffix() { return wxT("NR"); } + + // Flags for GetRegisteredClassName() + enum + { + // Just a symbolic name indicating absence of any special flags. + RegClass_Default = 0, + + // Return the name with the GetNoRedrawClassSuffix() appended to it. + RegClass_ReturnNR = 1, + + // Don't register the class with CS_[HV]REDRAW styles. This is useful + // for internal windows for which we can guarantee that they will be + // never created with wxFULL_REPAINT_ON_RESIZE flag. + // + // Notice that this implies RegClass_ReturnNR. + RegClass_OnlyNR = 3 + }; + + // get the name of the registered Win32 class with the given (unique) base + // name: this function constructs the unique class name using this name as + // prefix, checks if the class is already registered and registers it if it + // isn't and returns the name it was registered under (or NULL if it failed) + // + // the registered class will always have CS_[HV]REDRAW and CS_DBLCLKS + // styles as well as any additional styles specified as arguments here; and + // there will be also a companion registered class identical to this one + // but without CS_[HV]REDRAW whose name will be the same one but with + // GetNoRedrawClassSuffix() + // + // the background brush argument must be either a COLOR_XXX standard value + // or (default) -1 meaning that the class paints its background itself + static const wxChar *GetRegisteredClassName(const wxChar *name, + int bgBrushCol = -1, + int extraStyles = 0, + int flags = RegClass_Default); + + // return true if this name corresponds to one of the classes we registered + // in the previous GetRegisteredClassName() calls + static bool IsRegisteredClassName(const wxString& name); + + // Return the layout direction to use for a window by default. + // + // If the parent is specified, use the same layout direction as it uses. + // Otherwise use the default global layout, either from wxTheApp, if it + // exists, or Windows itself. + // + // Notice that this normally should not be used for the child windows as + // they already inherit, just dialogs such as wxMessageDialog may want to + // use it. + static wxLayoutDirection MSWGetDefaultLayout(wxWindow* parent = NULL); + + // Call ProcessPendingEvents() but only if we need to do it, i.e. there was + // a recent call to WakeUpIdle(). + void MSWProcessPendingEventsIfNeeded(); + +protected: + int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT + +public: + // unregister any window classes registered by GetRegisteredClassName() + static void UnregisterWindowClasses(); + +#if wxUSE_RICHEDIT + // initialize the richedit DLL of (at least) given version, return true if + // ok + static bool InitRichEdit(int version = 2); +#endif // wxUSE_RICHEDIT + + // returns 400, 470, 471 for comctl32.dll 4.00, 4.70, 4.71 or 0 if it + // wasn't found at all + static int GetComCtl32Version(); + + // the SW_XXX value to be used for the frames opened by the application + // (currently seems unused which is a bug -- TODO) + static int m_nCmdShow; + +protected: + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxApp); + wxDECLARE_DYNAMIC_CLASS(wxApp); +}; + +#endif // _WX_APP_H_ + diff --git a/lib/wxWidgets/include/wx/msw/appprogress.h b/lib/wxWidgets/include/wx/msw/appprogress.h new file mode 100644 index 0000000..0840c07 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/appprogress.h @@ -0,0 +1,39 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/appprogress.h +// Purpose: wxAppProgressIndicator interface. +// Author: Chaobin Zhang <zhchbin@gmail.com> +// Created: 2014-09-05 +// Copyright: (c) 2014 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_APPPROG_H_ +#define _WX_MSW_APPPROG_H_ + +#include "wx/vector.h" + +class WXDLLIMPEXP_FWD_CORE wxTaskBarButton; + +class WXDLLIMPEXP_CORE wxAppProgressIndicator + : public wxAppProgressIndicatorBase +{ +public: + wxAppProgressIndicator(wxWindow* parent = NULL, int maxValue = 100); + virtual ~wxAppProgressIndicator(); + + virtual bool IsAvailable() const wxOVERRIDE; + + virtual void SetValue(int value) wxOVERRIDE; + virtual void SetRange(int range) wxOVERRIDE; + virtual void Pulse() wxOVERRIDE; + virtual void Reset() wxOVERRIDE; + +private: + int m_maxValue; + + wxVector<wxTaskBarButton*> m_taskBarButtons; + + wxDECLARE_NO_COPY_CLASS(wxAppProgressIndicator); +}; + +#endif // _WX_MSW_APPPROG_H_ diff --git a/lib/wxWidgets/include/wx/msw/apptbase.h b/lib/wxWidgets/include/wx/msw/apptbase.h new file mode 100644 index 0000000..2dea2f5 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/apptbase.h @@ -0,0 +1,77 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/apptbase.h +// Purpose: declaration of wxAppTraits for MSW +// Author: Vadim Zeitlin +// Modified by: +// Created: 22.06.2003 +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_APPTBASE_H_ +#define _WX_MSW_APPTBASE_H_ + +// ---------------------------------------------------------------------------- +// wxAppTraits: the MSW version adds extra hooks needed by MSW-only code +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxAppTraits : public wxAppTraitsBase +{ +public: + // wxExecute() support methods + // --------------------------- + + // called before starting to wait for the child termination, may return + // some opaque data which will be passed later to AfterChildWaitLoop() + virtual void *BeforeChildWaitLoop() = 0; + + // called after starting to wait for the child termination, the parameter + // is the return value of BeforeChildWaitLoop() + virtual void AfterChildWaitLoop(void *data) = 0; + + +#if wxUSE_THREADS + // wxThread helpers + // ---------------- + + // process a message while waiting for a(nother) thread, should return + // false if and only if we have to exit the application + virtual bool DoMessageFromThreadWait() = 0; + + // wait for the handle to be signaled, return WAIT_OBJECT_0 if it is or, in + // the GUI code, WAIT_OBJECT_0 + 1 if a Windows message arrived + virtual WXDWORD WaitForThread(WXHANDLE hThread, int flags) = 0; +#endif // wxUSE_THREADS + + + // console helpers + // --------------- + + // this method can be overridden by a derived class to always return true + // or false to force [not] using the console for output to stderr + // + // by default console applications always return true from here while the + // GUI ones only return true if they're being run from console and there is + // no other activity happening in this console + virtual bool CanUseStderr() = 0; + + // write text to the console, return true if ok or false on error + virtual bool WriteToStderr(const wxString& text) = 0; + + // return the main application window or 0 if none + virtual WXHWND GetMainHWND() const = 0; + + // implement this base class function for both console and GUI applications + virtual bool SafeMessageBox(const wxString& text, + const wxString& title) wxOVERRIDE; + +protected: +#if wxUSE_THREADS + // implementation of WaitForThread() for the console applications which is + // also used by the GUI code if it doesn't [yet|already] dispatch events + WXDWORD DoSimpleWaitForThread(WXHANDLE hThread); +#endif // wxUSE_THREADS +}; + +#endif // _WX_MSW_APPTBASE_H_ + diff --git a/lib/wxWidgets/include/wx/msw/apptrait.h b/lib/wxWidgets/include/wx/msw/apptrait.h new file mode 100644 index 0000000..4f96bfb --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/apptrait.h @@ -0,0 +1,124 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/apptrait.h +// Purpose: class implementing wxAppTraits for MSW +// Author: Vadim Zeitlin +// Modified by: +// Created: 21.06.2003 +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_APPTRAIT_H_ +#define _WX_MSW_APPTRAIT_H_ + +// ---------------------------------------------------------------------------- +// wxGUI/ConsoleAppTraits: must derive from wxAppTraits, not wxAppTraitsBase +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxConsoleAppTraits : public wxConsoleAppTraitsBase +{ +public: + virtual wxEventLoopBase *CreateEventLoop() wxOVERRIDE; + virtual void *BeforeChildWaitLoop() wxOVERRIDE; + virtual void AfterChildWaitLoop(void *data) wxOVERRIDE; +#if wxUSE_TIMER + virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer) wxOVERRIDE; +#endif // wxUSE_TIMER +#if wxUSE_THREADS + virtual bool DoMessageFromThreadWait() wxOVERRIDE; + virtual WXDWORD WaitForThread(WXHANDLE hThread, int flags) wxOVERRIDE; +#endif // wxUSE_THREADS + virtual bool CanUseStderr() wxOVERRIDE { return true; } + virtual bool WriteToStderr(const wxString& text) wxOVERRIDE; + virtual WXHWND GetMainHWND() const wxOVERRIDE { return NULL; } +}; + +#if wxUSE_GUI + +#if defined(__WXMSW__) + +class WXDLLIMPEXP_CORE wxGUIAppTraits : public wxGUIAppTraitsBase +{ +public: + virtual wxEventLoopBase *CreateEventLoop() wxOVERRIDE; + virtual void *BeforeChildWaitLoop() wxOVERRIDE; + virtual void AfterChildWaitLoop(void *data) wxOVERRIDE; +#if wxUSE_TIMER + virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer) wxOVERRIDE; +#endif // wxUSE_TIMER +#if wxUSE_THREADS + virtual bool DoMessageFromThreadWait() wxOVERRIDE; + virtual WXDWORD WaitForThread(WXHANDLE hThread, int flags) wxOVERRIDE; +#endif // wxUSE_THREADS + wxPortId GetToolkitVersion(int *majVer = NULL, + int *minVer = NULL, + int *microVer = NULL) const wxOVERRIDE; + + virtual bool CanUseStderr() wxOVERRIDE; + virtual bool WriteToStderr(const wxString& text) wxOVERRIDE; + virtual WXHWND GetMainHWND() const wxOVERRIDE; +}; + +#elif defined(__WXGTK__) + +class WXDLLIMPEXP_CORE wxGUIAppTraits : public wxGUIAppTraitsBase +{ +public: + virtual wxEventLoopBase *CreateEventLoop() wxOVERRIDE; + virtual void *BeforeChildWaitLoop() wxOVERRIDE { return NULL; } + virtual void AfterChildWaitLoop(void *WXUNUSED(data)) wxOVERRIDE { } +#if wxUSE_TIMER + virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer) wxOVERRIDE; +#endif + +#if wxUSE_THREADS && defined(__WXGTK20__) + virtual void MutexGuiEnter() wxOVERRIDE; + virtual void MutexGuiLeave() wxOVERRIDE; +#endif + +#if wxUSE_THREADS + virtual bool DoMessageFromThreadWait() wxOVERRIDE { return true; } + virtual WXDWORD WaitForThread(WXHANDLE hThread, int WXUNUSED(flags)) wxOVERRIDE + { return DoSimpleWaitForThread(hThread); } +#endif // wxUSE_THREADS + virtual wxPortId GetToolkitVersion(int *majVer = NULL, + int *minVer = NULL, + int *microVer = NULL) const wxOVERRIDE; + + virtual bool CanUseStderr() wxOVERRIDE { return false; } + virtual bool WriteToStderr(const wxString& WXUNUSED(text)) wxOVERRIDE + { return false; } + virtual WXHWND GetMainHWND() const wxOVERRIDE { return NULL; } +}; + +#elif defined(__WXQT__) + +class WXDLLIMPEXP_CORE wxGUIAppTraits : public wxGUIAppTraitsBase +{ +public: + virtual wxEventLoopBase *CreateEventLoop() wxOVERRIDE; + virtual void *BeforeChildWaitLoop() wxOVERRIDE { return NULL; } + virtual void AfterChildWaitLoop(void*) wxOVERRIDE { } +#if wxUSE_TIMER + virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer) wxOVERRIDE; +#endif + +#if wxUSE_THREADS + virtual bool DoMessageFromThreadWait() wxOVERRIDE { return true; } + virtual WXDWORD WaitForThread(WXHANDLE hThread, int WXUNUSED(flags)) wxOVERRIDE + { return DoSimpleWaitForThread(hThread); } +#endif // wxUSE_THREADS + virtual wxPortId GetToolkitVersion(int *majVer = NULL, + int *minVer = NULL, + int *microVer = NULL) const wxOVERRIDE; + + virtual bool CanUseStderr() wxOVERRIDE { return false; } + virtual bool WriteToStderr(const wxString&) wxOVERRIDE { return false; } + virtual WXHWND GetMainHWND() const wxOVERRIDE { return NULL; } +}; + +#endif + +#endif // wxUSE_GUI + +#endif // _WX_MSW_APPTRAIT_H_ diff --git a/lib/wxWidgets/include/wx/msw/bitmap.h b/lib/wxWidgets/include/wx/msw/bitmap.h new file mode 100644 index 0000000..a49b2e6 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/bitmap.h @@ -0,0 +1,336 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/bitmap.h +// Purpose: wxBitmap class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BITMAP_H_ +#define _WX_BITMAP_H_ + +#include "wx/msw/gdiimage.h" +#include "wx/math.h" +#include "wx/palette.h" + +class WXDLLIMPEXP_FWD_CORE wxBitmapRefData; +#if wxUSE_WXDIB +class WXDLLIMPEXP_FWD_CORE wxDIB; +#endif + +// What kind of transparency should a bitmap copied from an icon or cursor +// have? +enum wxBitmapTransparency +{ + wxBitmapTransparency_Auto, // default: copy alpha if the source has it + wxBitmapTransparency_None, // never create alpha + wxBitmapTransparency_Always // always use alpha +}; + +// ---------------------------------------------------------------------------- +// wxBitmap: a mono or colour bitmap +// NOTE: for wxMSW we don't use the wxBitmapBase base class declared in bitmap.h! +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBitmap : public wxGDIImage, + public wxBitmapHelpers +{ +public: + // default ctor creates an invalid bitmap, you must Create() it later + wxBitmap() { } + + // Initialize with raw data + wxBitmap(const char bits[], int width, int height, int depth = 1); + + // Initialize with XPM data + wxBitmap(const char* const* data); + + // Load a file or resource + wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); + + // New constructor for generalised creation from data + wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth = 1); + + // Create a new, uninitialized bitmap of the given size and depth (if it + // is omitted, will create a bitmap compatible with the display) + // + // NB: this ctor will create a DIB for 24 and 32bpp bitmaps, use ctor + // taking a DC argument if you want to force using DDB in this case + wxBitmap(int width, int height, int depth = -1) { (void)Create(width, height, depth); } + wxBitmap(const wxSize& sz, int depth = -1) { (void)Create(sz, depth); } + + // Create a bitmap compatible with the given DC + wxBitmap(int width, int height, const wxDC& dc); + +#if wxUSE_IMAGE + // Convert from wxImage + wxBitmap(const wxImage& image, int depth = -1, double WXUNUSED(scale) = 1.0) + { (void)CreateFromImage(image, depth); } + + // Create a DDB compatible with the given DC from wxImage + wxBitmap(const wxImage& image, const wxDC& dc) + { (void)CreateFromImage(image, dc); } +#endif // wxUSE_IMAGE + + // we must have this, otherwise icons are silently copied into bitmaps using + // the copy ctor but the resulting bitmap is invalid! + wxBitmap(const wxIcon& icon, + wxBitmapTransparency transp = wxBitmapTransparency_Auto) + { + CopyFromIcon(icon, transp); + } + + // Convert from wxCursor + explicit wxBitmap(const wxCursor& cursor) + { + (void)CopyFromCursor(cursor, wxBitmapTransparency_Auto); + } + +#if wxUSE_IMAGE + wxBitmap& operator=(const wxImage& image) + { + return *this = wxBitmap(image); + } +#endif // wxUSE_IMAGE + + wxBitmap& operator=(const wxIcon& icon) + { + (void)CopyFromIcon(icon); + + return *this; + } + +#if WXWIN_COMPATIBILITY_3_0 + // This assignment operator is not portable as it is not implemented in any + // other ports. + wxDEPRECATED_MSG("Don't assign wxCursor to an existing wxBitmap, create a new wxBitmap from wxCursor instead.") + wxBitmap& operator=(const wxCursor& cursor) + { + (void)CopyFromCursor(cursor); + + return *this; + } +#endif // WXWIN_COMPATIBILITY_3_0 + + virtual ~wxBitmap(); + +#if wxUSE_IMAGE + wxImage ConvertToImage() const; + wxBitmap ConvertToDisabled(unsigned char brightness = 255) const; +#endif // wxUSE_IMAGE + + // get the given part of bitmap + wxBitmap GetSubBitmap( const wxRect& rect ) const; + + // NB: This should not be called from user code. It is for wx internal + // use only. + wxBitmap GetSubBitmapOfHDC( const wxRect& rect, WXHDC hdc ) const; + + // copies the contents and mask of the given (colour) icon to the bitmap + bool CopyFromIcon(const wxIcon& icon, + wxBitmapTransparency transp = wxBitmapTransparency_Auto); + + // copies the contents and mask of the given cursor to the bitmap + bool CopyFromCursor(const wxCursor& cursor, + wxBitmapTransparency transp = wxBitmapTransparency_Auto); + +#if wxUSE_WXDIB + // copies from a device independent bitmap + bool CopyFromDIB(const wxDIB& dib); + bool IsDIB() const; + bool ConvertToDIB(); +#endif + + virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); + virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) + { return Create(sz.GetWidth(), sz.GetHeight(), depth); } + + virtual bool Create(int width, int height, const wxDC& dc); + virtual bool Create(const void* data, wxBitmapType type, int width, int height, int depth = 1); + + bool CreateWithDIPSize(const wxSize& sz, + double scale, + int depth = wxBITMAP_SCREEN_DEPTH); + bool CreateWithDIPSize(int width, int height, + double scale, + int depth = wxBITMAP_SCREEN_DEPTH) + { return CreateWithDIPSize(wxSize(width, height), scale, depth); } + + virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); + virtual bool SaveFile(const wxString& name, wxBitmapType type, const wxPalette *cmap = NULL) const; + + wxBitmapRefData *GetBitmapData() const + { return (wxBitmapRefData *)m_refData; } + + // raw bitmap access support functions + void *GetRawData(wxPixelDataBase& data, int bpp); + void UngetRawData(wxPixelDataBase& data); + +#if wxUSE_PALETTE + wxPalette* GetPalette() const; + void SetPalette(const wxPalette& palette); +#endif // wxUSE_PALETTE + + wxMask *GetMask() const; + void SetMask(wxMask *mask); + + bool HasAlpha() const; + void UseAlpha(bool use = true); + void ResetAlpha() { UseAlpha(false); } + + // old synonyms for CreateWithDIPSize() and GetLogicalXXX() functions + bool CreateScaled(int w, int h, int d, double logicalScale) + { return CreateWithDIPSize(wxSize(w, h), logicalScale, d); } + double GetScaledWidth() const { return GetLogicalWidth(); } + double GetScaledHeight() const { return GetLogicalHeight(); } + wxSize GetScaledSize() const { return GetLogicalSize(); } + + // implementation only from now on + // ------------------------------- + + // Set alpha flag to true if this is a 32bpp bitmap which has any non-0 + // values in its alpha channel. + void MSWUpdateAlpha(); + + // Blend mask with alpha channel and remove the mask + void MSWBlendMaskWithAlpha(); + +public: +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_INLINE(void SetHBITMAP(WXHBITMAP bmp), SetHandle((WXHANDLE)bmp); ) +#endif // WXWIN_COMPATIBILITY_3_0 + WXHBITMAP GetHBITMAP() const { return (WXHBITMAP)GetHandle(); } + bool InitFromHBITMAP(WXHBITMAP bmp, int width, int height, int depth); + void ResetHBITMAP() { InitFromHBITMAP(NULL, 0, 0, 0); } + + void SetSelectedInto(wxDC *dc); + wxDC *GetSelectedInto() const; + +protected: + virtual wxGDIImageRefData *CreateData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + + // creates an uninitialized bitmap, called from Create()s above + bool DoCreate(int w, int h, int depth, WXHDC hdc); + +#if wxUSE_IMAGE + // creates the bitmap from wxImage, supposed to be called from ctor + bool CreateFromImage(const wxImage& image, int depth); + + // creates a DDB from wxImage, supposed to be called from ctor + bool CreateFromImage(const wxImage& image, const wxDC& dc); + + // common part of the 2 methods above (hdc may be 0) + bool CreateFromImage(const wxImage& image, int depth, WXHDC hdc); +#endif // wxUSE_IMAGE + +private: + // common part of CopyFromIcon/CopyFromCursor for Win32 + bool + CopyFromIconOrCursor(const wxGDIImage& icon, + wxBitmapTransparency transp = wxBitmapTransparency_Auto); + + + wxDECLARE_DYNAMIC_CLASS(wxBitmap); +}; + +// ---------------------------------------------------------------------------- +// wxMask: a mono bitmap used for drawing bitmaps transparently. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMask : public wxObject +{ +public: + wxMask(); + + // Copy constructor + wxMask(const wxMask &mask); + + // Construct a mask from a bitmap and a colour indicating the transparent + // area + wxMask(const wxBitmap& bitmap, const wxColour& colour); + + // Construct a mask from a bitmap and a palette index indicating the + // transparent area + wxMask(const wxBitmap& bitmap, int paletteIndex); + + // Construct a mask from a mono bitmap (copies the bitmap). + wxMask(const wxBitmap& bitmap); + + // construct a mask from the givne bitmap handle + wxMask(WXHBITMAP hbmp) { m_maskBitmap = hbmp; } + + virtual ~wxMask(); + + bool Create(const wxBitmap& bitmap, const wxColour& colour); + bool Create(const wxBitmap& bitmap, int paletteIndex); + bool Create(const wxBitmap& bitmap); + + wxBitmap GetBitmap() const; + + // Implementation + WXHBITMAP GetMaskBitmap() const { return m_maskBitmap; } + void SetMaskBitmap(WXHBITMAP bmp) { m_maskBitmap = bmp; } + +#if wxUSE_IMAGE + bool MSWCreateFromImageMask(const wxImage& image); +#endif // wxUSE_IMAGE + +protected: + WXHBITMAP m_maskBitmap; + + wxDECLARE_DYNAMIC_CLASS(wxMask); +}; + + +// ---------------------------------------------------------------------------- +// wxBitmapHandler is a class which knows how to load/save bitmaps to/from file +// NOTE: for wxMSW we don't use the wxBitmapHandler class declared in bitmap.h! +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBitmapHandler : public wxGDIImageHandler +{ +public: + wxBitmapHandler() { } + wxBitmapHandler(const wxString& name, const wxString& ext, wxBitmapType type) + : wxGDIImageHandler(name, ext, type) { } + + // implement wxGDIImageHandler's pure virtuals: + + virtual bool Create(wxGDIImage *image, + const void* data, + wxBitmapType type, + int width, int height, int depth = 1) wxOVERRIDE; + virtual bool Load(wxGDIImage *image, + const wxString& name, + wxBitmapType type, + int desiredWidth, int desiredHeight) wxOVERRIDE; + virtual bool Save(const wxGDIImage *image, + const wxString& name, + wxBitmapType type) const wxOVERRIDE; + + + // make wxBitmapHandler compatible with the wxBitmapHandler interface + // declared in bitmap.h, even if it's derived from wxGDIImageHandler: + + virtual bool Create(wxBitmap *bitmap, + const void* data, + wxBitmapType type, + int width, int height, int depth = 1); + virtual bool LoadFile(wxBitmap *bitmap, + const wxString& name, + wxBitmapType type, + int desiredWidth, int desiredHeight); + virtual bool SaveFile(const wxBitmap *bitmap, + const wxString& name, + wxBitmapType type, + const wxPalette *palette = NULL) const; + +private: + wxDECLARE_DYNAMIC_CLASS(wxBitmapHandler); +}; + +#endif + // _WX_BITMAP_H_ diff --git a/lib/wxWidgets/include/wx/msw/blank.cur b/lib/wxWidgets/include/wx/msw/blank.cur new file mode 100644 index 0000000..048f06b --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/blank.cur Binary files differ diff --git a/lib/wxWidgets/include/wx/msw/bmpbuttn.h b/lib/wxWidgets/include/wx/msw/bmpbuttn.h new file mode 100644 index 0000000..f4fbcd6 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/bmpbuttn.h @@ -0,0 +1,51 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/bmpbuttn.h +// Purpose: wxBitmapButton class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BMPBUTTN_H_ +#define _WX_BMPBUTTN_H_ + +#include "wx/button.h" +#include "wx/bitmap.h" +#include "wx/brush.h" + +class WXDLLIMPEXP_CORE wxBitmapButton : public wxBitmapButtonBase +{ +public: + wxBitmapButton() {} + + wxBitmapButton(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)) + { + Create(parent, id, bitmap, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)); + + bool CreateCloseButton(wxWindow* parent, + wxWindowID winid, + const wxString& name = wxString()); +protected: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxBitmapButton); +}; + +#endif // _WX_BMPBUTTN_H_ diff --git a/lib/wxWidgets/include/wx/msw/bmpcbox.h b/lib/wxWidgets/include/wx/msw/bmpcbox.h new file mode 100644 index 0000000..2a62858 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/bmpcbox.h @@ -0,0 +1,136 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/bmpcbox.h +// Purpose: wxBitmapComboBox +// Author: Jaakko Salli +// Created: 2008-04-06 +// Copyright: (c) 2008 Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_BMPCBOX_H_ +#define _WX_MSW_BMPCBOX_H_ + + +#include "wx/combobox.h" + + +// ---------------------------------------------------------------------------- +// wxBitmapComboBox: a wxComboBox that allows images to be shown +// in front of string items. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxBitmapComboBox : public wxComboBox, + public wxBitmapComboBoxBase +{ +public: + // ctors and such + wxBitmapComboBox() : wxComboBox(), wxBitmapComboBoxBase() + { + Init(); + } + + wxBitmapComboBox(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, + const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr)) + : wxComboBox(), + wxBitmapComboBoxBase() + { + Init(); + + (void)Create(parent, id, value, pos, size, n, + choices, style, validator, name); + } + + wxBitmapComboBox(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + int n, + const wxString choices[], + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr)); + + virtual ~wxBitmapComboBox(); + + // Sets the image for the given item. + virtual void SetItemBitmap(unsigned int n, const wxBitmapBundle& bitmap) wxOVERRIDE; + + virtual bool SetFont(const wxFont& font) wxOVERRIDE; + + // Adds item with image to the end of the combo box. + int Append(const wxString& item, const wxBitmapBundle& bitmap = wxBitmapBundle()); + int Append(const wxString& item, const wxBitmapBundle& bitmap, void *clientData); + int Append(const wxString& item, const wxBitmapBundle& bitmap, wxClientData *clientData); + + // Inserts item with image into the list before pos. Not valid for wxCB_SORT + // styles, use Append instead. + int Insert(const wxString& item, const wxBitmapBundle& bitmap, unsigned int pos); + int Insert(const wxString& item, const wxBitmapBundle& bitmap, + unsigned int pos, void *clientData); + int Insert(const wxString& item, const wxBitmapBundle& bitmap, + unsigned int pos, wxClientData *clientData); + +protected: + + WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const wxOVERRIDE; + virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item) wxOVERRIDE; + virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item) wxOVERRIDE; + virtual void MSWUpdateFontOnDPIChange(const wxSize& newDPI) wxOVERRIDE; + + // Event handlers + void OnSize(wxSizeEvent& event); + + virtual wxItemContainer* GetItemContainer() wxOVERRIDE { return this; } + virtual wxWindow* GetControl() wxOVERRIDE { return this; } + + // wxItemContainer implementation + virtual int DoInsertItems(const wxArrayStringsAdapter & items, + unsigned int pos, + void **clientData, wxClientDataType type) wxOVERRIDE; + virtual void DoClear() wxOVERRIDE; + virtual void DoDeleteOneItem(unsigned int n) wxOVERRIDE; + + virtual bool OnAddBitmap(const wxBitmapBundle& bitmap) wxOVERRIDE; + virtual wxSize DoGetBestSize() const wxOVERRIDE; + void RecreateControl(); + +private: + void Init(); + + bool m_inResize; + + wxDECLARE_EVENT_TABLE(); + + wxDECLARE_DYNAMIC_CLASS(wxBitmapComboBox); +}; + +#endif // _WX_MSW_BMPCBOX_H_ diff --git a/lib/wxWidgets/include/wx/msw/brush.h b/lib/wxWidgets/include/wx/msw/brush.h new file mode 100644 index 0000000..3b38824 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/brush.h @@ -0,0 +1,60 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/brush.h +// Purpose: wxBrush class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BRUSH_H_ +#define _WX_BRUSH_H_ + +class WXDLLIMPEXP_FWD_CORE wxBrush; +class WXDLLIMPEXP_FWD_CORE wxColour; +class WXDLLIMPEXP_FWD_CORE wxBitmap; + +// ---------------------------------------------------------------------------- +// wxBrush +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBrush : public wxBrushBase +{ +public: + wxBrush(); + wxBrush(const wxColour& col, wxBrushStyle style = wxBRUSHSTYLE_SOLID); + wxBrush(const wxBitmap& stipple); + virtual ~wxBrush(); + + virtual void SetColour(const wxColour& col) wxOVERRIDE; + virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) wxOVERRIDE; + virtual void SetStyle(wxBrushStyle style) wxOVERRIDE; + virtual void SetStipple(const wxBitmap& stipple) wxOVERRIDE; + + bool operator==(const wxBrush& brush) const; + bool operator!=(const wxBrush& brush) const { return !(*this == brush); } + + wxColour GetColour() const wxOVERRIDE; + wxBrushStyle GetStyle() const wxOVERRIDE; + wxBitmap *GetStipple() const wxOVERRIDE; + + + wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants") + wxBrush(const wxColour& col, int style); + + wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants") + void SetStyle(int style) { SetStyle((wxBrushStyle)style); } + + // return the HBRUSH for this brush + virtual WXHANDLE GetResourceHandle() const wxOVERRIDE; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxBrush); +}; + +#endif // _WX_BRUSH_H_ diff --git a/lib/wxWidgets/include/wx/msw/bullseye.cur b/lib/wxWidgets/include/wx/msw/bullseye.cur new file mode 100644 index 0000000..359f6e0 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/bullseye.cur Binary files differ diff --git a/lib/wxWidgets/include/wx/msw/button.h b/lib/wxWidgets/include/wx/msw/button.h new file mode 100644 index 0000000..20d62b7 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/button.h @@ -0,0 +1,85 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/button.h +// Purpose: wxButton class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_BUTTON_H_ +#define _WX_MSW_BUTTON_H_ + +// ---------------------------------------------------------------------------- +// Pushbutton +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxButton : public wxButtonBase +{ +public: + wxButton() { Init(); } + wxButton(wxWindow *parent, + wxWindowID id, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)) + { + Init(); + + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)); + + virtual ~wxButton(); + + virtual wxWindow *SetDefault() wxOVERRIDE; + + // implementation from now on + virtual void Command(wxCommandEvent& event) wxOVERRIDE; + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) wxOVERRIDE; + virtual bool MSWCommand(WXUINT param, WXWORD id) wxOVERRIDE; + + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const wxOVERRIDE; + +protected: + // send a notification event, return true if processed + bool SendClickEvent(); + + // default button handling + void SetTmpDefault(); + void UnsetTmpDefault(); + + // set or unset BS_DEFPUSHBUTTON style + static void SetDefaultStyle(wxButton *btn, bool on); + + virtual bool DoGetAuthNeeded() const wxOVERRIDE; + virtual void DoSetAuthNeeded(bool show) wxOVERRIDE; + + // true if the UAC symbol is shown + bool m_authNeeded; + +private: + void Init() + { + m_authNeeded = false; + } + + void OnCharHook(wxKeyEvent& event); + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxButton); +}; + +#endif // _WX_MSW_BUTTON_H_ diff --git a/lib/wxWidgets/include/wx/msw/calctrl.h b/lib/wxWidgets/include/wx/msw/calctrl.h new file mode 100644 index 0000000..1f15b1b --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/calctrl.h @@ -0,0 +1,98 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/calctrl.h +// Purpose: wxCalendarCtrl control implementation for MSW +// Author: Vadim Zeitlin +// Copyright: (C) 2008 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_CALCTRL_H_ +#define _WX_MSW_CALCTRL_H_ + +class WXDLLIMPEXP_ADV wxCalendarCtrl : public wxCalendarCtrlBase +{ +public: + wxCalendarCtrl() { Init(); } + wxCalendarCtrl(wxWindow *parent, + wxWindowID id, + const wxDateTime& date = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCAL_SHOW_HOLIDAYS, + const wxString& name = wxASCII_STR(wxCalendarNameStr)) + { + Init(); + + Create(parent, id, date, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxDateTime& date = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCAL_SHOW_HOLIDAYS, + const wxString& name = wxASCII_STR(wxCalendarNameStr)); + + virtual bool SetDate(const wxDateTime& date) wxOVERRIDE; + virtual wxDateTime GetDate() const wxOVERRIDE; + + virtual bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime, + const wxDateTime& upperdate = wxDefaultDateTime) wxOVERRIDE; + virtual bool GetDateRange(wxDateTime *lowerdate, wxDateTime *upperdate) const wxOVERRIDE; + + virtual bool EnableMonthChange(bool enable = true) wxOVERRIDE; + + virtual void Mark(size_t day, bool mark) wxOVERRIDE; + virtual void SetHoliday(size_t day) wxOVERRIDE; + + virtual wxCalendarHitTestResult HitTest(const wxPoint& pos, + wxDateTime *date = NULL, + wxDateTime::WeekDay *wd = NULL) wxOVERRIDE; + + virtual void SetWindowStyleFlag(long style) wxOVERRIDE; + +protected: + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const wxOVERRIDE; + + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) wxOVERRIDE; + + void MSWOnClick(wxMouseEvent& event); + void MSWOnDoubleClick(wxMouseEvent& event); + +private: + void Init(); + + // bring the control in sync with m_marks + void UpdateMarks(); + + // set first day of week in the control to correspond to our + // wxCAL_MONDAY_FIRST flag + void UpdateFirstDayOfWeek(); + + // reset holiday information + virtual void ResetHolidayAttrs() wxOVERRIDE { m_holidays = 0; } + + // redisplay holidays + virtual void RefreshHolidays() wxOVERRIDE { UpdateMarks(); } + + + // current date, we need to store it instead of simply retrieving it from + // the control as needed in order to be able to generate the correct events + // from MSWOnNotify() + wxDateTime m_date; + + // bit field containing the state (marked or not) of all days in the month + wxUint32 m_marks; + + // the same but indicating whether a day is a holiday or not + wxUint32 m_holidays; + + + wxDECLARE_DYNAMIC_CLASS(wxCalendarCtrl); + wxDECLARE_NO_COPY_CLASS(wxCalendarCtrl); +}; + +#endif // _WX_MSW_CALCTRL_H_ diff --git a/lib/wxWidgets/include/wx/msw/caret.h b/lib/wxWidgets/include/wx/msw/caret.h new file mode 100644 index 0000000..60fd79f --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/caret.h @@ -0,0 +1,61 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/caret.h +// Purpose: wxCaret class - the MSW implementation of wxCaret +// Author: Vadim Zeitlin +// Modified by: +// Created: 23.05.99 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CARET_H_ +#define _WX_CARET_H_ + +class WXDLLIMPEXP_CORE wxCaret : public wxCaretBase +{ +public: + wxCaret() { Init(); } + // create the caret of given (in pixels) width and height and associate + // with the given window + wxCaret(wxWindow *window, int width, int height) + { + Init(); + + (void)Create(window, width, height); + } + // same as above + wxCaret(wxWindowBase *window, const wxSize& size) + { + Init(); + + (void)Create(window, size); + } + + // process wxWindow notifications + virtual void OnSetFocus() wxOVERRIDE; + virtual void OnKillFocus() wxOVERRIDE; + +protected: + // override base class virtuals + virtual void DoMove() wxOVERRIDE; + virtual void DoShow() wxOVERRIDE; + virtual void DoHide() wxOVERRIDE; + virtual void DoSize() wxOVERRIDE; + + // helper function which creates the system caret + bool MSWCreateCaret(); + +private: + void Init() + { + m_hasCaret = false; + } + + bool m_hasCaret; + + wxDECLARE_NO_COPY_CLASS(wxCaret); +}; + +#endif // _WX_CARET_H_ + + diff --git a/lib/wxWidgets/include/wx/msw/cdrom.ico b/lib/wxWidgets/include/wx/msw/cdrom.ico new file mode 100644 index 0000000..f3fa3a9 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/cdrom.ico Binary files differ diff --git a/lib/wxWidgets/include/wx/msw/checkbox.h b/lib/wxWidgets/include/wx/msw/checkbox.h new file mode 100644 index 0000000..b4cc0bf --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/checkbox.h @@ -0,0 +1,85 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/checkbox.h +// Purpose: wxCheckBox class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CHECKBOX_H_ +#define _WX_CHECKBOX_H_ + +#include "wx/msw/ownerdrawnbutton.h" + +// Checkbox item (single checkbox) +class WXDLLIMPEXP_CORE wxCheckBox : public wxMSWOwnerDrawnButton<wxCheckBoxBase> +{ +public: + wxCheckBox() : m_state(wxCHK_UNCHECKED) { } + wxCheckBox(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)); + + virtual void SetValue(bool value) wxOVERRIDE; + virtual bool GetValue() const wxOVERRIDE; + + // override some base class virtuals + virtual void SetLabel(const wxString& label) wxOVERRIDE; + + virtual void SetTransparentPartColour(const wxColour& col) wxOVERRIDE + { + SetBackgroundColour(col); + } + + virtual bool MSWCommand(WXUINT param, WXWORD id) wxOVERRIDE; + virtual void Command(wxCommandEvent& event) wxOVERRIDE; + + // returns true if the platform should explicitly apply a theme border + virtual bool CanApplyThemeBorder() const wxOVERRIDE { return false; } + + // implementation only from now on + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const wxOVERRIDE; + +protected: + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + + virtual void DoSet3StateValue(wxCheckBoxState value) wxOVERRIDE; + virtual wxCheckBoxState DoGet3StateValue() const wxOVERRIDE; + + // Implement wxMSWOwnerDrawnButtonBase methods. + virtual int MSWGetButtonStyle() const wxOVERRIDE; + virtual void MSWOnButtonResetOwnerDrawn() wxOVERRIDE; + virtual int MSWGetButtonCheckedFlag() const wxOVERRIDE; + virtual void + MSWDrawButtonBitmap(wxDC& dc, const wxRect& rect, int flags) wxOVERRIDE; + +private: + // common part of all ctors + void Init(); + + // current state of the checkbox + wxCheckBoxState m_state; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckBox); +}; + +#endif // _WX_CHECKBOX_H_ diff --git a/lib/wxWidgets/include/wx/msw/checklst.h b/lib/wxWidgets/include/wx/msw/checklst.h new file mode 100644 index 0000000..e007977 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/checklst.h @@ -0,0 +1,92 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/checklst.h +// Purpose: wxCheckListBox class - a listbox with checkable items +// Author: Vadim Zeitlin +// Modified by: +// Created: 16.11.97 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef __CHECKLST__H_ +#define __CHECKLST__H_ + +#if !wxUSE_OWNER_DRAWN + #error "wxCheckListBox class requires owner-drawn functionality." +#endif + +class WXDLLIMPEXP_FWD_CORE wxOwnerDrawn; +class WXDLLIMPEXP_FWD_CORE wxCheckListBoxItem; // fwd decl, defined in checklst.cpp + +class WXDLLIMPEXP_CORE wxCheckListBox : public wxCheckListBoxBase +{ +public: + // ctors + wxCheckListBox(); + wxCheckListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int nStrings = 0, + const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + wxCheckListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + + // items may be checked + virtual bool IsChecked(unsigned int uiIndex) const wxOVERRIDE; + virtual void Check(unsigned int uiIndex, bool bCheck = true) wxOVERRIDE; + virtual void Toggle(unsigned int uiIndex); + + // we create our items ourselves and they have non-standard size, + // so we need to override these functions + virtual wxOwnerDrawn *CreateLboxItem(size_t n) wxOVERRIDE; + virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item) wxOVERRIDE; + +protected: + virtual wxSize MSWGetFullItemSize(int w, int h) const wxOVERRIDE; + + // pressing space or clicking the check box toggles the item + void OnKeyDown(wxKeyEvent& event); + void OnLeftClick(wxMouseEvent& event); + + // send an "item checked" event + void SendEvent(unsigned int uiIndex) + { + wxCommandEvent event(wxEVT_CHECKLISTBOX, GetId()); + event.SetInt(uiIndex); + event.SetEventObject(this); + event.SetString(GetString(uiIndex)); + ProcessCommand(event); + } + + virtual void MSWUpdateFontOnDPIChange(const wxSize& newDPI) wxOVERRIDE; + + wxSize DoGetBestClientSize() const wxOVERRIDE; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckListBox); +}; + +#endif //_CHECKLST_H diff --git a/lib/wxWidgets/include/wx/msw/chkconf.h b/lib/wxWidgets/include/wx/msw/chkconf.h new file mode 100644 index 0000000..1af43a6 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/chkconf.h @@ -0,0 +1,485 @@ +/* + * Name: wx/msw/chkconf.h + * Purpose: Compiler-specific configuration checking + * Author: Julian Smart + * Modified by: + * Created: 01/02/97 + * Copyright: (c) Julian Smart + * Licence: wxWindows licence + */ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#ifndef _WX_MSW_CHKCONF_H_ +#define _WX_MSW_CHKCONF_H_ + +/* ensure that CPU parameter is specified (only nmake .vc makefile) */ +#ifdef _MSC_VER + #if defined(_WIN64) && defined(TARGET_CPU_COMPFLAG) && (TARGET_CPU_COMPFLAG == 0) + #error CPU must be defined + #endif +#endif + +/* ensure that MSW-specific settings are defined */ +#ifndef wxUSE_ACTIVEX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ACTIVEX must be defined." +# else +# define wxUSE_ACTIVEX 0 +# endif +#endif /* !defined(wxUSE_ACTIVEX) */ + +#ifndef wxUSE_WINRT +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_WINRT must be defined." +# else +# define wxUSE_WINRT 0 +# endif +#endif /* !defined(wxUSE_ACTIVEX) */ + +#ifndef wxUSE_CRASHREPORT +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_CRASHREPORT must be defined." +# else +# define wxUSE_CRASHREPORT 0 +# endif +#endif /* !defined(wxUSE_CRASHREPORT) */ + +#ifndef wxUSE_DBGHELP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DBGHELP must be defined" +# else +# define wxUSE_DBGHELP 1 +# endif +#endif /* wxUSE_DBGHELP */ + +#ifndef wxUSE_DC_CACHEING +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DC_CACHEING must be defined" +# else +# define wxUSE_DC_CACHEING 1 +# endif +#endif /* wxUSE_DC_CACHEING */ + +#ifndef wxUSE_DIALUP_MANAGER +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DIALUP_MANAGER must be defined." +# else +# define wxUSE_DIALUP_MANAGER 0 +# endif +#endif /* !defined(wxUSE_DIALUP_MANAGER) */ + +#ifndef wxUSE_MS_HTML_HELP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_MS_HTML_HELP must be defined." +# else +# define wxUSE_MS_HTML_HELP 0 +# endif +#endif /* !defined(wxUSE_MS_HTML_HELP) */ + +#ifndef wxUSE_INICONF +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_INICONF must be defined." +# else +# define wxUSE_INICONF 0 +# endif +#endif /* !defined(wxUSE_INICONF) */ + +#ifndef wxUSE_OLE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_OLE must be defined." +# else +# define wxUSE_OLE 0 +# endif +#endif /* !defined(wxUSE_OLE) */ + +#ifndef wxUSE_OLE_AUTOMATION +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_OLE_AUTOMATION must be defined." +# else +# define wxUSE_OLE_AUTOMATION 0 +# endif +#endif /* !defined(wxUSE_OLE_AUTOMATION) */ + +#ifndef wxUSE_TASKBARICON_BALLOONS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TASKBARICON_BALLOONS must be defined." +# else +# define wxUSE_TASKBARICON_BALLOONS 0 +# endif +#endif /* wxUSE_TASKBARICON_BALLOONS */ + +#ifndef wxUSE_TASKBARBUTTON +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TASKBARBUTTON must be defined." +# else +# define wxUSE_TASKBARBUTTON 0 +# endif +#endif /* wxUSE_TASKBARBUTTON */ + +#ifndef wxUSE_UXTHEME +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_UXTHEME must be defined." +# else +# define wxUSE_UXTHEME 0 +# endif +#endif /* wxUSE_UXTHEME */ + +#ifndef wxUSE_WINSOCK2 +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_WINSOCK2 must be defined." +# else +# define wxUSE_WINSOCK2 0 +# endif +#endif /* wxUSE_WINSOCK2 */ + +/* + * Unfortunately we can't use compiler TLS support if the library can be used + * inside a dynamically loaded DLL under Windows XP, as this can result in hard + * to diagnose crashes due to the bugs in Windows TLS support, see #13116. + * + * So we disable it unless we can be certain that the code will never run under + * XP, as is the case if we're using a compiler which doesn't support XP such + * as MSVC 11+, unless it's used with the special "_xp" toolset, in which case + * _USING_V110_SDK71_ is defined. + * + * However defining wxUSE_COMPILER_TLS as 2 overrides this safety check, see + * the comments in wx/setup.h. + */ +#if wxUSE_COMPILER_TLS == 1 + #if !wxCHECK_VISUALC_VERSION(11) || defined(_USING_V110_SDK71_) + #undef wxUSE_COMPILER_TLS + #define wxUSE_COMPILER_TLS 0 + #endif +#endif + + +/* + * disable the settings which don't work for some compilers + */ + +/* + * All of the settings below require SEH support (__try/__catch) and can't work + * without it. + */ +#if !defined(_MSC_VER) +# undef wxUSE_ON_FATAL_EXCEPTION +# define wxUSE_ON_FATAL_EXCEPTION 0 + +# undef wxUSE_CRASHREPORT +# define wxUSE_CRASHREPORT 0 +#endif /* compiler doesn't support SEH */ + +#if defined(__GNUWIN32__) + /* These don't work as expected for mingw32 and cygwin32 */ +# undef wxUSE_MEMORY_TRACING +# define wxUSE_MEMORY_TRACING 0 + +# undef wxUSE_GLOBAL_MEMORY_OPERATORS +# define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +# undef wxUSE_DEBUG_NEW_ALWAYS +# define wxUSE_DEBUG_NEW_ALWAYS 0 + +#endif /* __GNUWIN32__ */ + +/* MinGW32 doesn't provide wincred.h defining the API needed by this */ +#ifdef __MINGW32_TOOLCHAIN__ + #undef wxUSE_SECRETSTORE + #define wxUSE_SECRETSTORE 0 +#endif + +#if wxUSE_SPINCTRL +# if !wxUSE_SPINBTN +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxSpinCtrl requires wxSpinButton on MSW" +# else +# undef wxUSE_SPINBTN +# define wxUSE_SPINBTN 1 +# endif +# endif +#endif + +/* wxMSW-specific checks: notice that this file is also used with wxUniv + and can even be used with wxGTK, when building it under Windows. + */ +#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) +# if !wxUSE_OWNER_DRAWN +# undef wxUSE_CHECKLISTBOX +# define wxUSE_CHECKLISTBOX 0 +# endif +# if !wxUSE_CHECKLISTBOX +# undef wxUSE_REARRANGECTRL +# define wxUSE_REARRANGECTRL 0 +# endif +#endif + +/* + un/redefine the options which we can't compile (after checking that they're + defined + */ +#ifdef __WINE__ +# if wxUSE_ACTIVEX +# undef wxUSE_ACTIVEX +# define wxUSE_ACTIVEX 0 +# endif /* wxUSE_ACTIVEX */ +#endif /* __WINE__ */ + +/* + Currently wxUSE_GRAPHICS_CONTEXT is only enabled with MSVC by default, so + only check for wxUSE_ACTIVITYINDICATOR dependency on it if it can be + enabled, otherwise turn the latter off to allow the library to compile. + */ +#if !wxUSE_GRAPHICS_CONTEXT && !defined(_MSC_VER) +# undef wxUSE_ACTIVITYINDICATOR +# define wxUSE_ACTIVITYINDICATOR 0 +#endif /* !wxUSE_ACTIVITYINDICATOR && !_MSC_VER */ + +/* MinGW-w64 (32 and 64 bit) has winhttp.h available, legacy MinGW does not. */ +#if (!defined(_MSC_VER) && !defined(__MINGW64_VERSION_MAJOR)) || !wxUSE_DYNLIB_CLASS + #undef wxUSE_WEBREQUEST_WINHTTP + #define wxUSE_WEBREQUEST_WINHTTP 0 +#endif +/* + Similarly, turn off wxUSE_WEBREQUEST if we can't enable it because we don't + have any of its backends to allow the library to compile with the default + options when using MinGW32 which doesn't come with winhttp.h and so for + which we have to disable wxUSE_WEBREQUEST_WINHTTP. + */ +#if wxUSE_WEBREQUEST && !wxUSE_WEBREQUEST_CURL && !wxUSE_WEBREQUEST_WINHTTP +# undef wxUSE_WEBREQUEST +# define wxUSE_WEBREQUEST 0 +#endif /* wxUSE_WEBREQUEST */ + +/* check settings consistency for MSW-specific ones */ +#if wxUSE_CRASHREPORT && !wxUSE_ON_FATAL_EXCEPTION +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_CRASHREPORT requires wxUSE_ON_FATAL_EXCEPTION" +# else +# undef wxUSE_CRASHREPORT +# define wxUSE_CRASHREPORT 0 +# endif +#endif /* wxUSE_CRASHREPORT */ + +#if !wxUSE_VARIANT +# if wxUSE_ACTIVEX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxActiveXContainer requires wxVariant" +# else +# undef wxUSE_ACTIVEX +# define wxUSE_ACTIVEX 0 +# endif +# endif + +# if wxUSE_OLE_AUTOMATION +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxAutomationObject requires wxVariant" +# else +# undef wxUSE_OLE_AUTOMATION +# define wxUSE_OLE_AUTOMATION 0 +# endif +# endif +#endif /* !wxUSE_VARIANT */ + +#if !wxUSE_DATAOBJ +# if wxUSE_OLE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_OLE requires wxDataObject" +# else +# undef wxUSE_OLE +# define wxUSE_OLE 0 +# endif +# endif +#endif /* !wxUSE_DATAOBJ */ + +#if !wxUSE_DYNAMIC_LOADER +# if wxUSE_MS_HTML_HELP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_MS_HTML_HELP requires wxUSE_DYNAMIC_LOADER." +# else +# undef wxUSE_MS_HTML_HELP +# define wxUSE_MS_HTML_HELP 0 +# endif +# endif +# if wxUSE_DIALUP_MANAGER +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DIALUP_MANAGER requires wxUSE_DYNAMIC_LOADER." +# else +# undef wxUSE_DIALUP_MANAGER +# define wxUSE_DIALUP_MANAGER 0 +# endif +# endif +#endif /* !wxUSE_DYNAMIC_LOADER */ + +#if !wxUSE_DYNLIB_CLASS +# if wxUSE_DBGHELP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DBGHELP requires wxUSE_DYNLIB_CLASS" +# else +# undef wxUSE_DBGHELP +# define wxUSE_DBGHELP 0 +# endif +# endif +# if wxUSE_DC_TRANSFORM_MATRIX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DC_TRANSFORM_MATRIX requires wxUSE_DYNLIB_CLASS" +# else +# undef wxUSE_DC_TRANSFORM_MATRIX +# define wxUSE_DC_TRANSFORM_MATRIX 0 +# endif +# endif +# if wxUSE_UXTHEME +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_UXTHEME requires wxUSE_DYNLIB_CLASS" +# else +# undef wxUSE_UXTHEME +# define wxUSE_UXTHEME 0 +# endif +# endif +# if wxUSE_MEDIACTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_MEDIACTRL requires wxUSE_DYNLIB_CLASS" +# else +# undef wxUSE_MEDIACTRL +# define wxUSE_MEDIACTRL 0 +# endif +# endif +# if wxUSE_INKEDIT +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_INKEDIT requires wxUSE_DYNLIB_CLASS" +# else +# undef wxUSE_INKEDIT +# define wxUSE_INKEDIT 0 +# endif +# endif +#endif /* !wxUSE_DYNLIB_CLASS */ + +#if !wxUSE_OLE +# if wxUSE_ACTIVEX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxActiveXContainer requires wxUSE_OLE" +# else +# undef wxUSE_ACTIVEX +# define wxUSE_ACTIVEX 0 +# endif +# endif + +# if wxUSE_OLE_AUTOMATION +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxAutomationObject requires wxUSE_OLE" +# else +# undef wxUSE_OLE_AUTOMATION +# define wxUSE_OLE_AUTOMATION 0 +# endif +# endif + +# if wxUSE_DRAG_AND_DROP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_DRAG_AND_DROP requires wxUSE_OLE" +# else +# undef wxUSE_DRAG_AND_DROP +# define wxUSE_DRAG_AND_DROP 0 +# endif +# endif + +# if wxUSE_ACCESSIBILITY +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ACCESSIBILITY requires wxUSE_OLE" +# else +# undef wxUSE_ACCESSIBILITY +# define wxUSE_ACCESSIBILITY 0 +# endif +# endif +#endif /* !wxUSE_OLE */ + +#if !wxUSE_ACTIVEX +# if wxUSE_MEDIACTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxMediaCtl requires wxActiveXContainer" +# else +# undef wxUSE_MEDIACTRL +# define wxUSE_MEDIACTRL 0 +# endif +# endif +# if wxUSE_WEBVIEW +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxWebView requires wxActiveXContainer under MSW" +# else +# undef wxUSE_WEBVIEW +# define wxUSE_WEBVIEW 0 +# endif +# endif +#endif /* !wxUSE_ACTIVEX */ + +#if wxUSE_ACTIVITYINDICATOR && !wxUSE_GRAPHICS_CONTEXT +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ACTIVITYINDICATOR requires wxGraphicsContext" +# else +# undef wxUSE_ACTIVITYINDICATOR +# define wxUSE_ACTIVITYINDICATOR 0 +# endif +#endif /* wxUSE_ACTIVITYINDICATOR */ + +#if wxUSE_STACKWALKER && !wxUSE_DBGHELP + /* + Don't give an error in this case because wxUSE_DBGHELP could be 0 + because the compiler just doesn't support it, there is really no other + choice than to disable wxUSE_STACKWALKER too in this case. + + Unfortunately we can't distinguish between the missing compiler support + and explicitly disabling wxUSE_DBGHELP (which would ideally result in + an error if wxUSE_STACKWALKER is not disabled too), but it's better to + avoid giving a compiler error in the former case even if it means not + giving it either in the latter one. + */ + #undef wxUSE_STACKWALKER + #define wxUSE_STACKWALKER 0 +#endif /* wxUSE_STACKWALKER && !wxUSE_DBGHELP */ + +#if !wxUSE_THREADS +# if wxUSE_FSWATCHER +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxFileSystemWatcher requires wxThread under MSW" +# else +# undef wxUSE_FSWATCHER +# define wxUSE_FSWATCHER 0 +# endif +# endif +# if wxUSE_JOYSTICK +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxJoystick requires wxThread under MSW" +# else +# undef wxUSE_JOYSTICK +# define wxUSE_JOYSTICK 0 +# endif +# endif +#endif /* !wxUSE_THREADS */ + + +#if !wxUSE_OLE_AUTOMATION +# if wxUSE_WEBVIEW +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxWebView requires wxUSE_OLE_AUTOMATION under MSW" +# else +# undef wxUSE_WEBVIEW +# define wxUSE_WEBVIEW 0 +# endif +# endif +#endif /* !wxUSE_OLE_AUTOMATION */ + +#if defined(__WXUNIVERSAL__) && wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW && !wxUSE_POSTSCRIPT +# undef wxUSE_POSTSCRIPT +# define wxUSE_POSTSCRIPT 1 +#endif + +/* + IPv6 support requires winsock2.h, but the default of wxUSE_WINSOCK2 is 0. + Don't require changing it explicitly and just turn it on automatically if + wxUSE_IPV6 is on. + */ +#if wxUSE_IPV6 && !wxUSE_WINSOCK2 + #undef wxUSE_WINSOCK2 + #define wxUSE_WINSOCK2 1 +#endif + +#endif /* _WX_MSW_CHKCONF_H_ */ diff --git a/lib/wxWidgets/include/wx/msw/choice.h b/lib/wxWidgets/include/wx/msw/choice.h new file mode 100644 index 0000000..6c8badd --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/choice.h @@ -0,0 +1,176 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/choice.h +// Purpose: wxChoice class +// Author: Julian Smart +// Modified by: Vadim Zeitlin to derive from wxChoiceBase +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CHOICE_H_ +#define _WX_CHOICE_H_ + +struct tagCOMBOBOXINFO; + +// ---------------------------------------------------------------------------- +// Choice item +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxChoice : public wxChoiceBase +{ +public: + // ctors + wxChoice() { Init(); } + virtual ~wxChoice(); + + wxChoice(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr)) + { + Init(); + Create(parent, id, pos, size, n, choices, style, validator, name); + } + + wxChoice(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr)) + { + Init(); + Create(parent, id, pos, size, choices, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr)); + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr)); + + virtual bool Show(bool show = true) wxOVERRIDE; + + virtual void SetLabel(const wxString& label) wxOVERRIDE; + + virtual unsigned int GetCount() const wxOVERRIDE; + virtual int GetSelection() const wxOVERRIDE; + virtual int GetCurrentSelection() const wxOVERRIDE; + virtual void SetSelection(int n) wxOVERRIDE; + + virtual int FindString(const wxString& s, bool bCase = false) const wxOVERRIDE; + virtual wxString GetString(unsigned int n) const wxOVERRIDE; + virtual void SetString(unsigned int n, const wxString& s) wxOVERRIDE; + + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // MSW only + virtual bool MSWCommand(WXUINT param, WXWORD id) wxOVERRIDE; + WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) wxOVERRIDE; + virtual WXHBRUSH MSWControlColor(WXHDC hDC, WXHWND hWnd) wxOVERRIDE; + virtual bool MSWShouldPreProcessMessage(WXMSG *pMsg) wxOVERRIDE; + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const wxOVERRIDE; + + // returns true if the platform should explicitly apply a theme border + virtual bool CanApplyThemeBorder() const wxOVERRIDE { return false; } + +protected: + // choose the default border for this window + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + + // common part of all ctors + void Init() + { + m_lastAcceptedSelection = + m_pendingSelection = wxID_NONE; + m_heightOwn = wxDefaultCoord; + } + + virtual void DoDeleteOneItem(unsigned int n) wxOVERRIDE; + virtual void DoClear() wxOVERRIDE; + + virtual int DoInsertItems(const wxArrayStringsAdapter& items, + unsigned int pos, + void **clientData, wxClientDataType type) wxOVERRIDE; + + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; + virtual void DoSetItemClientData(unsigned int n, void* clientData) wxOVERRIDE; + virtual void* DoGetItemClientData(unsigned int n) const wxOVERRIDE; + + // MSW implementation + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual void DoGetSize(int *w, int *h) const wxOVERRIDE; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; + virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const wxOVERRIDE; + + // Show or hide the popup part of the control. + void MSWDoPopupOrDismiss(bool show); + + // update the height of the drop down list to fit the number of items we + // have (without changing the visible height) + void MSWUpdateDropDownHeight(); + + // set the height of the visible part of the control to m_heightOwn + void MSWUpdateVisibleHeight(); + + // create and initialize the control + bool CreateAndInit(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + int n, const wxString choices[], + long style, + const wxValidator& validator, + const wxString& name); + + // free all memory we have (used by Clear() and dtor) + void Free(); + + // set the height for simple combo box + int SetHeightSimpleComboBox(int nItems) const; + +#if wxUSE_DEFERRED_SIZING + virtual void MSWEndDeferWindowPos() wxOVERRIDE; +#endif // wxUSE_DEFERRED_SIZING + + // These variables are only used while the drop down is opened. + // + // The first one contains the item that had been originally selected before + // the drop down was opened and the second one the item we should select + // when the drop down is closed again. + int m_lastAcceptedSelection, + m_pendingSelection; + + // the height of the control itself if it was set explicitly or + // wxDefaultCoord if it hadn't + int m_heightOwn; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice); +}; + +#endif // _WX_CHOICE_H_ diff --git a/lib/wxWidgets/include/wx/msw/clipbrd.h b/lib/wxWidgets/include/wx/msw/clipbrd.h new file mode 100644 index 0000000..1e4a8af --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/clipbrd.h @@ -0,0 +1,89 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/clipbrd.h +// Purpose: wxClipboad class and clipboard functions for MSW +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CLIPBRD_H_ +#define _WX_CLIPBRD_H_ + +#if wxUSE_CLIPBOARD + +// These functions superseded by wxClipboard, but retained in order to +// implement wxClipboard, and for compatibility. + +// open/close the clipboard +WXDLLIMPEXP_CORE bool wxOpenClipboard(); +WXDLLIMPEXP_CORE bool wxIsClipboardOpened(); +#define wxClipboardOpen wxIsClipboardOpened +WXDLLIMPEXP_CORE bool wxCloseClipboard(); + +// get/set data +WXDLLIMPEXP_CORE bool wxEmptyClipboard(); +#if !wxUSE_OLE +WXDLLIMPEXP_CORE bool wxSetClipboardData(wxDataFormat dataFormat, + const void *data, + int width = 0, int height = 0); +#endif // !wxUSE_OLE + +// clipboard formats +WXDLLIMPEXP_CORE bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat); +WXDLLIMPEXP_CORE wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat); +WXDLLIMPEXP_CORE int wxRegisterClipboardFormat(wxChar *formatName); +WXDLLIMPEXP_CORE bool wxGetClipboardFormatName(wxDataFormat dataFormat, + wxChar *formatName, + int maxCount); + +//----------------------------------------------------------------------------- +// wxClipboard +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxClipboard : public wxClipboardBase +{ +public: + wxClipboard(); + virtual ~wxClipboard(); + + // open the clipboard before SetData() and GetData() + virtual bool Open() wxOVERRIDE; + + // close the clipboard after SetData() and GetData() + virtual void Close() wxOVERRIDE; + + // query whether the clipboard is opened + virtual bool IsOpened() const wxOVERRIDE; + + // set the clipboard data. all other formats will be deleted. + virtual bool SetData( wxDataObject *data ) wxOVERRIDE; + + // add to the clipboard data. + virtual bool AddData( wxDataObject *data ) wxOVERRIDE; + + // ask if data in correct format is available + virtual bool IsSupported( const wxDataFormat& format ) wxOVERRIDE; + + // fill data with data on the clipboard (if available) + virtual bool GetData( wxDataObject& data ) wxOVERRIDE; + + // clears wxTheClipboard and the system's clipboard if possible + virtual void Clear() wxOVERRIDE; + + // flushes the clipboard: this means that the data which is currently on + // clipboard will stay available even after the application exits (possibly + // eating memory), otherwise the clipboard will be emptied on exit + virtual bool Flush() wxOVERRIDE; + +private: + IDataObject *m_lastDataObject; + bool m_isOpened; + + wxDECLARE_DYNAMIC_CLASS(wxClipboard); +}; + +#endif // wxUSE_CLIPBOARD + +#endif // _WX_CLIPBRD_H_ diff --git a/lib/wxWidgets/include/wx/msw/colordlg.h b/lib/wxWidgets/include/wx/msw/colordlg.h new file mode 100644 index 0000000..27a021f --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/colordlg.h @@ -0,0 +1,77 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/colordlg.h +// Purpose: wxColourDialog class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COLORDLG_H_ +#define _WX_COLORDLG_H_ + +#include "wx/dialog.h" + +// ---------------------------------------------------------------------------- +// wxColourDialog: dialog for choosing a colours +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxColourDialog : public wxDialog +{ +public: + wxColourDialog() { Init(); } + wxColourDialog(wxWindow *parent, const wxColourData *data = NULL) + { + Init(); + + Create(parent, data); + } + + bool Create(wxWindow *parent, const wxColourData *data = NULL); + + wxColourData& GetColourData() { return m_colourData; } + + // override some base class virtuals + virtual void SetTitle(const wxString& title) wxOVERRIDE; + virtual wxString GetTitle() const wxOVERRIDE; + + virtual int ShowModal() wxOVERRIDE; + + // wxMSW-specific implementation from now on + // ----------------------------------------- + + // called from the hook procedure on WM_INITDIALOG reception + virtual void MSWOnInitDone(WXHWND hDlg); + + // called from the hook procedure + void MSWCheckIfCurrentChanged(WXCOLORREF currentCol); + +protected: + // common part of all ctors + void Init(); + + virtual void DoGetPosition( int *x, int *y ) const wxOVERRIDE; + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; + virtual void DoGetClientSize(int *width, int *height) const wxOVERRIDE; + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; + virtual void DoCentre(int dir) wxOVERRIDE; + + wxColourData m_colourData; + wxString m_title; + + // Currently selected colour, used while the dialog is being shown. + WXCOLORREF m_currentCol; + + // indicates that the dialog should be centered in this direction if non 0 + // (set by DoCentre(), used by MSWOnInitDone()) + int m_centreDir; + + // true if DoMoveWindow() had been called + bool m_movedWindow; + + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxColourDialog); +}; + +#endif // _WX_COLORDLG_H_ diff --git a/lib/wxWidgets/include/wx/msw/colour.h b/lib/wxWidgets/include/wx/msw/colour.h new file mode 100644 index 0000000..afb5401 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/colour.h @@ -0,0 +1,72 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/colour.h +// Purpose: wxColour class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COLOUR_H_ +#define _WX_COLOUR_H_ + +#include "wx/object.h" + +// ---------------------------------------------------------------------------- +// Colour +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxColour : public wxColourBase +{ +public: + // constructors + // ------------ + DEFINE_STD_WXCOLOUR_CONSTRUCTORS + + // accessors + // --------- + + virtual bool IsOk() const wxOVERRIDE { return m_isInit; } + + unsigned char Red() const wxOVERRIDE { return m_red; } + unsigned char Green() const wxOVERRIDE { return m_green; } + unsigned char Blue() const wxOVERRIDE { return m_blue; } + unsigned char Alpha() const wxOVERRIDE { return m_alpha ; } + + // comparison + bool operator==(const wxColour& colour) const + { + return m_isInit == colour.m_isInit + && m_red == colour.m_red + && m_green == colour.m_green + && m_blue == colour.m_blue + && m_alpha == colour.m_alpha; + } + + bool operator!=(const wxColour& colour) const { return !(*this == colour); } + + WXCOLORREF GetPixel() const { return m_pixel; } + +public: + WXCOLORREF m_pixel; + +protected: + // Helper function + void Init(); + + virtual void + InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a) wxOVERRIDE; + +private: + bool m_isInit; + unsigned char m_red; + unsigned char m_blue; + unsigned char m_green; + unsigned char m_alpha; + +private: + wxDECLARE_DYNAMIC_CLASS(wxColour); +}; + +#endif // _WX_COLOUR_H_ diff --git a/lib/wxWidgets/include/wx/msw/colours.bmp b/lib/wxWidgets/include/wx/msw/colours.bmp new file mode 100644 index 0000000..7d391ad --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/colours.bmp Binary files differ diff --git a/lib/wxWidgets/include/wx/msw/combo.h b/lib/wxWidgets/include/wx/msw/combo.h new file mode 100644 index 0000000..f96222f --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/combo.h @@ -0,0 +1,115 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/combo.h +// Purpose: wxComboCtrl class +// Author: Jaakko Salli +// Modified by: +// Created: Apr-30-2006 +// Copyright: (c) Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COMBOCONTROL_H_ +#define _WX_COMBOCONTROL_H_ + +// NB: Definition of _WX_COMBOCONTROL_H_ is used in wx/generic/combo.h to +// determine whether there is native wxComboCtrl, so make sure you +// use it in all native wxComboCtrls. + +#if wxUSE_COMBOCTRL + +#if wxUSE_TIMER + #include "wx/timer.h" + #define wxUSE_COMBOCTRL_POPUP_ANIMATION 1 +#endif + + +// ---------------------------------------------------------------------------- +// Native wxComboCtrl +// ---------------------------------------------------------------------------- + +// Define this only if native implementation includes all features +#define wxCOMBOCONTROL_FULLY_FEATURED + +extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[]; + +class WXDLLIMPEXP_CORE wxComboCtrl : public wxComboCtrlBase +{ +public: + // ctors and such + wxComboCtrl() : wxComboCtrlBase() { Init(); } + + wxComboCtrl(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)) + : wxComboCtrlBase() + { + Init(); + + (void)Create(parent, id, value, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)); + + virtual ~wxComboCtrl(); + + virtual void PrepareBackground( wxDC& dc, const wxRect& rect, int flags ) const wxOVERRIDE; + virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const wxOVERRIDE; + + static int GetFeatures() { return wxComboCtrlFeatures::All; } + +#if wxUSE_COMBOCTRL_POPUP_ANIMATION + void OnTimerEvent(wxTimerEvent& WXUNUSED(event)) { DoTimerEvent(); } + +protected: + void DoTimerEvent(); + + virtual bool AnimateShow( const wxRect& rect, int flags ) wxOVERRIDE; +#endif // wxUSE_COMBOCTRL_POPUP_ANIMATION + +protected: + + // Dummy method - we override all functions that call this + virtual WXHWND GetEditHWND() const wxOVERRIDE { return NULL; } + + // customization + virtual void OnResize() wxOVERRIDE; + virtual wxCoord GetNativeTextIndent() const wxOVERRIDE; + + // event handlers + void OnPaintEvent( wxPaintEvent& event ); + void OnMouseEvent( wxMouseEvent& event ); + + virtual bool HasTransparentBackground() wxOVERRIDE { return IsDoubleBuffered(); } + +private: + void Init(); + +#if wxUSE_COMBOCTRL_POPUP_ANIMATION + // Popup animation related + wxMilliClock_t m_animStart; + wxTimer m_animTimer; + wxRect m_animRect; + int m_animFlags; +#endif + + wxDECLARE_EVENT_TABLE(); + + wxDECLARE_DYNAMIC_CLASS(wxComboCtrl); +}; + + +#endif // wxUSE_COMBOCTRL +#endif + // _WX_COMBOCONTROL_H_ diff --git a/lib/wxWidgets/include/wx/msw/combobox.h b/lib/wxWidgets/include/wx/msw/combobox.h new file mode 100644 index 0000000..2274e21 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/combobox.h @@ -0,0 +1,194 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/combobox.h +// Purpose: wxComboBox class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COMBOBOX_H_ +#define _WX_COMBOBOX_H_ + +#include "wx/choice.h" +#include "wx/textentry.h" + +#if wxUSE_COMBOBOX + +// ---------------------------------------------------------------------------- +// Combobox control +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxComboBox : public wxChoice, + public wxTextEntry +{ +public: + wxComboBox() { Init(); } + + wxComboBox(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)) + { + Init(); + Create(parent, id, value, pos, size, n, choices, style, validator, name); + + } + + wxComboBox(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)) + { + Init(); + + Create(parent, id, value, pos, size, choices, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, + const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)); + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)); + + // See wxComboBoxBase discussion of IsEmpty(). + bool IsListEmpty() const { return wxItemContainer::IsEmpty(); } + bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); } + + // resolve ambiguities among virtual functions inherited from both base + // classes + virtual void Clear() wxOVERRIDE; + virtual wxString GetValue() const wxOVERRIDE; + virtual void SetValue(const wxString& value) wxOVERRIDE; + virtual wxString GetStringSelection() const wxOVERRIDE + { return wxChoice::GetStringSelection(); } + virtual void Popup() { MSWDoPopupOrDismiss(true); } + virtual void Dismiss() { MSWDoPopupOrDismiss(false); } + virtual void SetSelection(int n) wxOVERRIDE { wxChoice::SetSelection(n); } + virtual void SetSelection(long from, long to) wxOVERRIDE + { wxTextEntry::SetSelection(from, to); } + virtual int GetSelection() const wxOVERRIDE { return wxChoice::GetSelection(); } + virtual bool ContainsHWND(WXHWND hWnd) const wxOVERRIDE; + virtual void GetSelection(long *from, long *to) const wxOVERRIDE; + + virtual bool IsEditable() const wxOVERRIDE; + + // implementation only from now on + virtual bool MSWCommand(WXUINT param, WXWORD id) wxOVERRIDE; + bool MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam); + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) wxOVERRIDE; + bool MSWShouldPreProcessMessage(WXMSG *pMsg) wxOVERRIDE; + + // Standard event handling + void OnCut(wxCommandEvent& event); + void OnCopy(wxCommandEvent& event); + void OnPaste(wxCommandEvent& event); + void OnUndo(wxCommandEvent& event); + void OnRedo(wxCommandEvent& event); + void OnDelete(wxCommandEvent& event); + void OnSelectAll(wxCommandEvent& event); + + void OnUpdateCut(wxUpdateUIEvent& event); + void OnUpdateCopy(wxUpdateUIEvent& event); + void OnUpdatePaste(wxUpdateUIEvent& event); + void OnUpdateUndo(wxUpdateUIEvent& event); + void OnUpdateRedo(wxUpdateUIEvent& event); + void OnUpdateDelete(wxUpdateUIEvent& event); + void OnUpdateSelectAll(wxUpdateUIEvent& event); + + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const wxOVERRIDE; + +#if wxUSE_UXTHEME + // override wxTextEntry method to work around Windows bug + virtual bool SetHint(const wxString& hint) wxOVERRIDE; +#endif // wxUSE_UXTHEME + + virtual void SetLayoutDirection(wxLayoutDirection dir) wxOVERRIDE; + + virtual const wxTextEntry* WXGetTextEntry() const wxOVERRIDE { return this; } + +protected: +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip(wxToolTip *tip) wxOVERRIDE; +#endif + + virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const wxOVERRIDE; + + // Override this one to avoid eating events from our popup listbox. + virtual wxWindow *MSWFindItem(long id, WXHWND hWnd) const wxOVERRIDE; + + // this is the implementation of GetEditHWND() which can also be used when + // we don't have the edit control, it simply returns NULL then + // + // try not to use this function unless absolutely necessary (as in the + // message handling code where the edit control might not be created yet + // for the messages we receive during the control creation) as normally + // just testing for IsEditable() and using GetEditHWND() should be enough + WXHWND GetEditHWNDIfAvailable() const; + + virtual void EnableTextChangedEvents(bool enable) wxOVERRIDE + { + m_allowTextEvents = enable; + } + +#if wxABI_VERSION >= 30202 + // Recreate the native control entirely while preserving its initial + // contents and attributes: this is useful if the height of the items must + // be changed as the native control doesn't seem to support doing this once + // it had been already determined. + void MSWRecreate(); +#endif // wxABI_VERSION >= 3.2.2 + +private: + // there are the overridden wxTextEntry methods which should only be called + // when we do have an edit control so they assert if this is not the case + virtual wxWindow *GetEditableWindow() wxOVERRIDE; + virtual WXHWND GetEditHWND() const wxOVERRIDE; + + // Common part of MSWProcessEditMsg() and MSWProcessSpecialKey(), return + // true if the key was processed. + bool MSWProcessEditSpecialKey(WXWPARAM vkey); + +#if wxUSE_OLE + virtual void MSWProcessSpecialKey(wxKeyEvent& event) wxOVERRIDE; +#endif // wxUSE_OLE + + // common part of all ctors + void Init() + { + m_allowTextEvents = true; + } + + // normally true, false if text events are currently disabled + bool m_allowTextEvents; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox); + wxDECLARE_EVENT_TABLE(); +}; + +#endif // wxUSE_COMBOBOX + +#endif // _WX_COMBOBOX_H_ diff --git a/lib/wxWidgets/include/wx/msw/commandlinkbutton.h b/lib/wxWidgets/include/wx/msw/commandlinkbutton.h new file mode 100644 index 0000000..8930e33 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/commandlinkbutton.h @@ -0,0 +1,73 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/commandlinkbutton.h +// Purpose: wxCommandLinkButton class +// Author: Rickard Westerlund +// Created: 2010-06-11 +// Copyright: (c) 2010 wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_COMMANDLINKBUTTON_H_ +#define _WX_MSW_COMMANDLINKBUTTON_H_ + +// ---------------------------------------------------------------------------- +// Command link button for wxMSW +// ---------------------------------------------------------------------------- + +// Derive from the generic version to be able to fall back to it during +// run-time if the command link buttons are not supported by the system we're +// running under. + +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 = wxASCII_STR(wxButtonNameStr)) + : wxGenericCommandLinkButton() + { + 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 = wxASCII_STR(wxButtonNameStr)); + + // overridden base class methods + // ----------------------------- + + // do the same thing as in the generic case here + virtual void SetLabel(const wxString& label) wxOVERRIDE + { + SetMainLabelAndNote(label.BeforeFirst('\n'), label.AfterFirst('\n')); + } + + virtual void SetMainLabelAndNote(const wxString& mainLabel, + const wxString& note) wxOVERRIDE; + + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const wxOVERRIDE; + +protected: + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + virtual bool HasNativeBitmap() const wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxCommandLinkButton); +}; + +#endif // _WX_MSW_COMMANDLINKBUTTON_H_ diff --git a/lib/wxWidgets/include/wx/msw/computer.ico b/lib/wxWidgets/include/wx/msw/computer.ico new file mode 100644 index 0000000..f36237b --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/computer.ico Binary files differ diff --git a/lib/wxWidgets/include/wx/msw/control.h b/lib/wxWidgets/include/wx/msw/control.h new file mode 100644 index 0000000..346c217 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/control.h @@ -0,0 +1,136 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/control.h +// Purpose: wxControl class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CONTROL_H_ +#define _WX_CONTROL_H_ + +#include "wx/dynarray.h" + +// General item class +class WXDLLIMPEXP_CORE wxControl : public wxControlBase +{ +public: + wxControl() { } + + wxControl(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxControlNameStr)) + { + Create(parent, id, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxControlNameStr)); + + + // Simulates an event + virtual void Command(wxCommandEvent& event) wxOVERRIDE { ProcessCommand(event); } + + + // implementation from now on + // -------------------------- + + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // Calls the callback and appropriate event handlers + bool ProcessCommand(wxCommandEvent& event); + + // MSW-specific + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) wxOVERRIDE; + + // For ownerdraw items + virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *WXUNUSED(item)) { return false; } + virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *WXUNUSED(item)) { return false; } + + const wxArrayLong& GetSubcontrols() const { return m_subControls; } + + // default handling of WM_CTLCOLORxxx: this is public so that wxWindow + // could call it + virtual WXHBRUSH MSWControlColor(WXHDC pDC, WXHWND hWnd); + + // default style for the control include WS_TABSTOP if it AcceptsFocus() + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const wxOVERRIDE; + +protected: + // Hook for common controls for which we don't want to set the default font + // as if we do set it, the controls don't update their font size + // automatically in response to WM_SETTINGCHANGE if it's changed in the + // display properties in the control panel, so avoid doing this for them. + virtual bool MSWShouldSetDefaultFont() const { return true; } + + // choose the default border for this window + virtual wxBorder GetDefaultBorder() const wxOVERRIDE; + + // return default best size (doesn't really make any sense, override this) + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + // create the control of the given Windows class: this is typically called + // from Create() method of the derived class passing its label, pos and + // size parameter (style parameter is not needed because m_windowStyle is + // supposed to had been already set and so is used instead when this + // function is called) + bool MSWCreateControl(const wxChar *classname, + const wxString& label, + const wxPoint& pos, + const wxSize& size); + + // NB: the method below is deprecated now, with MSWGetStyle() the method + // above should be used instead! Once all the controls are updated to + // implement MSWGetStyle() this version will disappear. + // + // create the control of the given class with the given style (combination + // of WS_XXX flags, i.e. Windows style, not wxWidgets one), returns + // false if creation failed + // + // All parameters except classname and style are optional, if the + // size/position are not given, they should be set later with SetSize() + // and, label (the title of the window), of course, is left empty. The + // extended style is determined from the style and the app 3D settings + // automatically if it's not specified explicitly. + bool MSWCreateControl(const wxChar *classname, + WXDWORD style, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxString& label = wxEmptyString, + WXDWORD exstyle = (WXDWORD)-1); + + // call this from the derived class MSWControlColor() if you want to show + // the control greyed out (and opaque) + WXHBRUSH MSWControlColorDisabled(WXHDC pDC); + + // common part of the 3 functions above: pass wxNullColour to use the + // appropriate background colour (meaning ours or our parents) or a fixed + // one + virtual WXHBRUSH DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd); + + // Look in our GetSubcontrols() for the windows with the given ID. + virtual wxWindow *MSWFindItem(long id, WXHWND hWnd) const wxOVERRIDE; + + + // for controls like radiobuttons which are really composite this array + // holds the ids (not HWNDs!) of the sub controls + wxArrayLong m_subControls; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxControl); +}; + +#endif // _WX_CONTROL_H_ diff --git a/lib/wxWidgets/include/wx/msw/crashrpt.h b/lib/wxWidgets/include/wx/msw/crashrpt.h new file mode 100644 index 0000000..f354b48 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/crashrpt.h @@ -0,0 +1,119 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/crashrpt.h +// Purpose: helpers for the structured exception handling (SEH) under Win32 +// Author: Vadim Zeitlin +// Modified by: +// Created: 13.07.2003 +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_CRASHRPT_H_ +#define _WX_MSW_CRASHRPT_H_ + +#include "wx/defs.h" + +#if wxUSE_CRASHREPORT + +struct _EXCEPTION_POINTERS; + +// ---------------------------------------------------------------------------- +// crash report generation flags +// ---------------------------------------------------------------------------- + +enum +{ + // we always report where the crash occurred + wxCRASH_REPORT_LOCATION = 0, + + // if this flag is given, the call stack is dumped + // + // this results in dump/crash report as small as possible, this is the + // default flag + wxCRASH_REPORT_STACK = 1, + + // if this flag is given, the values of the local variables are dumped + // + // note that with the current implementation it requires dumping the full + // process address space and so this will result in huge dump file and will + // take some time to generate + // + // it's probably not a good idea to use this by default, start with default + // mini dump and ask your users to set WX_CRASH_FLAGS environment variable + // to 2 or 4 if you need more information in the dump + wxCRASH_REPORT_LOCALS = 2, + + // if this flag is given, the values of all global variables are dumped + // + // this creates a much larger mini dump than just wxCRASH_REPORT_STACK but + // still much smaller than wxCRASH_REPORT_LOCALS one + wxCRASH_REPORT_GLOBALS = 4, + + // default is to create the smallest possible crash report + wxCRASH_REPORT_DEFAULT = wxCRASH_REPORT_LOCATION | wxCRASH_REPORT_STACK +}; + +// ---------------------------------------------------------------------------- +// wxCrashContext: information about the crash context +// ---------------------------------------------------------------------------- + +struct WXDLLIMPEXP_BASE wxCrashContext +{ + // initialize this object with the given information or from the current + // global exception info which is only valid inside wxApp::OnFatalException + wxCrashContext(_EXCEPTION_POINTERS *ep = NULL); + + // get the name for this exception code + wxString GetExceptionString() const; + + + // exception code + size_t code; + + // exception address + void *addr; + + // machine-specific registers vaues + struct + { +#ifdef __INTEL__ + wxInt32 eax, ebx, ecx, edx, esi, edi, + ebp, esp, eip, + cs, ds, es, fs, gs, ss, + flags; +#endif // __INTEL__ + } regs; +}; + +// ---------------------------------------------------------------------------- +// wxCrashReport: this class is used to create crash reports +// ---------------------------------------------------------------------------- + +struct WXDLLIMPEXP_BASE wxCrashReport +{ + // set the name of the file to which the report is written, it is + // constructed from the .exe name by default + static void SetFileName(const wxString& filename); + + // return the current file name + static wxString GetFileName(); + + // write the exception report to the file, return true if it could be done + // or false otherwise + // + // if ep pointer is NULL, the global exception info which is valid only + // inside wxApp::OnFatalException() is used + static bool Generate(int flags = wxCRASH_REPORT_DEFAULT, + _EXCEPTION_POINTERS *ep = NULL); + + + // generate a crash report from outside of wxApp::OnFatalException(), this + // can be used to take "snapshots" of the program in wxApp::OnAssert() for + // example + static bool GenerateNow(int flags = wxCRASH_REPORT_DEFAULT); +}; + +#endif // wxUSE_CRASHREPORT + +#endif // _WX_MSW_CRASHRPT_H_ + diff --git a/lib/wxWidgets/include/wx/msw/cross.cur b/lib/wxWidgets/include/wx/msw/cross.cur new file mode 100644 index 0000000..5b8f463 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/cross.cur Binary files differ diff --git a/lib/wxWidgets/include/wx/msw/csquery.bmp b/lib/wxWidgets/include/wx/msw/csquery.bmp new file mode 100644 index 0000000..4e7bcdc --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/csquery.bmp Binary files differ diff --git a/lib/wxWidgets/include/wx/msw/ctrlsub.h b/lib/wxWidgets/include/wx/msw/ctrlsub.h new file mode 100644 index 0000000..3c658bc --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/ctrlsub.h @@ -0,0 +1,42 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/ctrlsub.h +// Purpose: common functionality of wxItemContainer-derived controls +// Author: Vadim Zeitlin +// Created: 2007-07-25 +// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_CTRLSUB_H_ +#define _WX_MSW_CTRLSUB_H_ + +// ---------------------------------------------------------------------------- +// wxControlWithItems +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxControlWithItems : public wxControlWithItemsBase +{ +public: + wxControlWithItems() { } + +protected: + // preallocate memory for inserting the given new items into the control + // using the wm message (normally either LB_INITSTORAGE or CB_INITSTORAGE) + void MSWAllocStorage(const wxArrayStringsAdapter& items, unsigned wm); + + // insert or append a string to the controls using the given message + // (one of {CB,LB}_{ADD,INSERT}STRING, pos must be 0 when appending) + int MSWInsertOrAppendItem(unsigned pos, const wxString& item, unsigned wm); + + // normally the control containing the items is this window itself but if + // the derived control is composed of several windows, this method can be + // overridden to return the real list/combobox control + virtual WXHWND MSWGetItemsHWND() const { return GetHWND(); } + +private: + wxDECLARE_ABSTRACT_CLASS(wxControlWithItems); + wxDECLARE_NO_COPY_CLASS(wxControlWithItems); +}; + +#endif // _WX_MSW_CTRLSUB_H_ + diff --git a/lib/wxWidgets/include/wx/msw/cursor.h b/lib/wxWidgets/include/wx/msw/cursor.h new file mode 100644 index 0000000..93fc83c --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/cursor.h @@ -0,0 +1,56 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/cursor.h +// Purpose: wxCursor class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CURSOR_H_ +#define _WX_CURSOR_H_ + +class WXDLLIMPEXP_FWD_CORE wxImage; + +// Cursor +class WXDLLIMPEXP_CORE wxCursor : public wxCursorBase +{ +public: + // constructors + wxCursor(); +#if wxUSE_IMAGE + wxCursor(const wxImage& image); + wxCursor(const char* const* xpmData); +#endif // wxUSE_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 wxPoint GetHotSpot() const wxOVERRIDE; + + virtual ~wxCursor(); + + // implementation only + void SetHCURSOR(WXHCURSOR cursor) { SetHandle((WXHANDLE)cursor); } + WXHCURSOR GetHCURSOR() const { return (WXHCURSOR)GetHandle(); } + +protected: + void InitFromStock(wxStockCursor); + + virtual wxGDIImageRefData *CreateData() const wxOVERRIDE; + +private: +#if wxUSE_IMAGE + void InitFromImage(const wxImage& image); +#endif // wxUSE_IMAGE + + wxDECLARE_DYNAMIC_CLASS(wxCursor); +}; + +#endif + // _WX_CURSOR_H_ diff --git a/lib/wxWidgets/include/wx/msw/custombgwin.h b/lib/wxWidgets/include/wx/msw/custombgwin.h new file mode 100644 index 0000000..027e2b7 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/custombgwin.h @@ -0,0 +1,57 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/custombgwin.h +// Purpose: wxMSW implementation of wxCustomBackgroundWindow +// Author: Vadim Zeitlin +// Created: 2011-10-10 +// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_CUSTOMBGWIN_H_ +#define _WX_MSW_CUSTOMBGWIN_H_ + +#include "wx/bitmap.h" +#include "wx/brush.h" + +// ---------------------------------------------------------------------------- +// wxCustomBackgroundWindow +// ---------------------------------------------------------------------------- + +template <class W> +class wxCustomBackgroundWindow : public W, + public wxCustomBackgroundWindowBase +{ +public: + typedef W BaseWindowClass; + + wxCustomBackgroundWindow() { m_backgroundBrush = NULL; } + + virtual ~wxCustomBackgroundWindow() { delete m_backgroundBrush; } + +protected: + virtual void DoSetBackgroundBitmap(const wxBitmap& bmp) wxOVERRIDE + { + delete m_backgroundBrush; + m_backgroundBrush = bmp.IsOk() ? new wxBrush(bmp) : NULL; + + // Our transparent children should use our background if we have it, + // otherwise try to restore m_inheritBgCol to some reasonable value: true + // if we also have non-default background colour or false otherwise. + BaseWindowClass::m_inheritBgCol = bmp.IsOk() + || BaseWindowClass::UseBgCol(); + } + + virtual WXHBRUSH MSWGetCustomBgBrush() wxOVERRIDE + { + if ( m_backgroundBrush ) + return (WXHBRUSH)m_backgroundBrush->GetResourceHandle(); + + return BaseWindowClass::MSWGetCustomBgBrush(); + } + + wxBrush *m_backgroundBrush; + + wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxCustomBackgroundWindow, W); +}; + +#endif // _WX_MSW_CUSTOMBGWIN_H_ diff --git a/lib/wxWidgets/include/wx/msw/datectrl.h b/lib/wxWidgets/include/wx/msw/datectrl.h new file mode 100644 index 0000000..b78b28f --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/datectrl.h @@ -0,0 +1,69 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/datectrl.h +// Purpose: wxDatePickerCtrl for Windows +// Author: Vadim Zeitlin +// Modified by: +// Created: 2005-01-09 +// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_DATECTRL_H_ +#define _WX_MSW_DATECTRL_H_ + +// ---------------------------------------------------------------------------- +// wxDatePickerCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDatePickerCtrl : public wxDatePickerCtrlBase +{ +public: + // ctors + wxDatePickerCtrl() { } + + wxDatePickerCtrl(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) + { + Create(parent, id, dt, pos, size, style, validator, name); + } + + 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); + + // Override this one to add date-specific (and time-ignoring) checks. + virtual void SetValue(const wxDateTime& dt) wxOVERRIDE; + virtual wxDateTime GetValue() const wxOVERRIDE; + + // Implement the base class pure virtuals. + virtual void SetRange(const wxDateTime& dt1, const wxDateTime& dt2) wxOVERRIDE; + virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const wxOVERRIDE; + + // Override MSW-specific functions used during control creation. + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const wxOVERRIDE; + +protected: +#if wxUSE_INTL + virtual wxLocaleInfo MSWGetFormat() const wxOVERRIDE; +#endif // wxUSE_INTL + virtual bool MSWAllowsNone() const wxOVERRIDE { return HasFlag(wxDP_ALLOWNONE); } + virtual bool MSWOnDateTimeChange(const tagNMDATETIMECHANGE& dtch) wxOVERRIDE; + +private: + wxDateTime MSWGetControlValue() const; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl); +}; + +#endif // _WX_MSW_DATECTRL_H_ diff --git a/lib/wxWidgets/include/wx/msw/datetimectrl.h b/lib/wxWidgets/include/wx/msw/datetimectrl.h new file mode 100644 index 0000000..a56c87d --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/datetimectrl.h @@ -0,0 +1,81 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/datetimectrl.h +// Purpose: wxDateTimePickerCtrl for Windows. +// Author: Vadim Zeitlin +// Created: 2011-09-22 (extracted from wx/msw/datectrl.h). +// Copyright: (c) 2005-2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_DATETIMECTRL_H_ +#define _WX_MSW_DATETIMECTRL_H_ + +#include "wx/intl.h" + +// Forward declare a struct from Platform SDK. +struct tagNMDATETIMECHANGE; + +// ---------------------------------------------------------------------------- +// wxDateTimePickerCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDateTimePickerCtrl : public wxDateTimePickerCtrlBase +{ +public: + // set/get the date + virtual void SetValue(const wxDateTime& dt) wxOVERRIDE; + virtual wxDateTime GetValue() const wxOVERRIDE; + + virtual void SetNullText(const wxString& text) wxOVERRIDE; + + // returns true if the platform should explicitly apply a theme border + virtual bool CanApplyThemeBorder() const wxOVERRIDE { return false; } + + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) wxOVERRIDE; + +protected: + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + // Helper for the derived classes Create(): creates a native control with + // the specified attributes. + bool MSWCreateDateTimePicker(wxWindow *parent, + wxWindowID id, + const wxDateTime& dt, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name); + +#if wxUSE_INTL + // Override to return the date/time format used by this control. + virtual wxLocaleInfo MSWGetFormat() const = 0; +#endif // wxUSE_INTL + + // Override to indicate whether we can have no date at all. + virtual bool MSWAllowsNone() const = 0; + + // Override to update m_date and send the event when the control contents + // changes, return true if the event was handled. + virtual bool MSWOnDateTimeChange(const tagNMDATETIMECHANGE& dtch) = 0; + + + // the date currently shown by the control, may be invalid + wxDateTime m_date; + +private: + // Helper setting the appropriate format depending on the passed in state. + void MSWUpdateFormat(bool valid); + + // Same thing, but only doing if the validity differs from the date + // validity, i.e. avoiding useless work if nothing needs to be done. + void MSWUpdateFormatIfNeeded(bool valid); + + + // shown when there is no valid value (so only used with wxDP_ALLOWNONE), + // always non-empty if SetNullText() was called, see the comments there + wxString m_nullText; +}; + +#endif // _WX_MSW_DATETIMECTRL_H_ diff --git a/lib/wxWidgets/include/wx/msw/dc.h b/lib/wxWidgets/include/wx/msw/dc.h new file mode 100644 index 0000000..6af3637 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/dc.h @@ -0,0 +1,384 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/dc.h +// Purpose: wxDC class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_DC_H_ +#define _WX_MSW_DC_H_ + +#include "wx/defs.h" +#include "wx/dc.h" + +// --------------------------------------------------------------------------- +// macros +// --------------------------------------------------------------------------- + +#if wxUSE_DC_CACHEING +/* + * Cached blitting, maintaining a cache + * of bitmaps required for transparent blitting + * instead of constant creation/deletion + */ + +class wxDCCacheEntry: public wxObject +{ +public: + wxDCCacheEntry(WXHBITMAP hBitmap, int w, int h, int depth); + wxDCCacheEntry(WXHDC hDC, int depth); + virtual ~wxDCCacheEntry(); + + WXHBITMAP m_bitmap; + WXHDC m_dc; + int m_width; + int m_height; + int m_depth; +}; +#endif + +// this is an ABC: use one of the derived classes to create a DC associated +// with a window, screen, printer and so on +class WXDLLIMPEXP_CORE wxMSWDCImpl: public wxDCImpl +{ +public: + wxMSWDCImpl(wxDC *owner, WXHDC hDC); + virtual ~wxMSWDCImpl(); + + // implement base class pure virtuals + // ---------------------------------- + + virtual void Clear() wxOVERRIDE; + + virtual bool StartDoc(const wxString& message) wxOVERRIDE; + virtual void EndDoc() wxOVERRIDE; + + virtual void StartPage() wxOVERRIDE; + virtual void EndPage() wxOVERRIDE; + + virtual void SetFont(const wxFont& font) wxOVERRIDE; + virtual void SetPen(const wxPen& pen) wxOVERRIDE; + virtual void SetBrush(const wxBrush& brush) wxOVERRIDE; + virtual void SetBackground(const wxBrush& brush) wxOVERRIDE; + virtual void SetBackgroundMode(int mode) wxOVERRIDE; +#if wxUSE_PALETTE + virtual void SetPalette(const wxPalette& palette) wxOVERRIDE; +#endif // wxUSE_PALETTE + + virtual void DestroyClippingRegion() wxOVERRIDE; + + virtual wxCoord GetCharHeight() const wxOVERRIDE; + virtual wxCoord GetCharWidth() const wxOVERRIDE; + + virtual bool CanDrawBitmap() const wxOVERRIDE; + virtual bool CanGetTextExtent() const wxOVERRIDE; + virtual int GetDepth() const wxOVERRIDE; + virtual wxSize GetPPI() const wxOVERRIDE; + + virtual void SetMapMode(wxMappingMode mode) wxOVERRIDE; + virtual void SetUserScale(double x, double y) wxOVERRIDE; + virtual void SetLogicalScale(double x, double y) wxOVERRIDE; + virtual void SetLogicalOrigin(wxCoord x, wxCoord y) wxOVERRIDE; + virtual void SetDeviceOrigin(wxCoord x, wxCoord y) wxOVERRIDE; + virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp) wxOVERRIDE; + + virtual wxPoint DeviceToLogical(wxCoord x, wxCoord y) const wxOVERRIDE; + virtual wxPoint LogicalToDevice(wxCoord x, wxCoord y) const wxOVERRIDE; + virtual wxSize DeviceToLogicalRel(int x, int y) const wxOVERRIDE; + virtual wxSize LogicalToDeviceRel(int x, int y) const wxOVERRIDE; + +#if wxUSE_DC_TRANSFORM_MATRIX + virtual bool CanUseTransformMatrix() const wxOVERRIDE; + virtual bool SetTransformMatrix(const wxAffineMatrix2D& matrix) wxOVERRIDE; + virtual wxAffineMatrix2D GetTransformMatrix() const wxOVERRIDE; + virtual void ResetTransformMatrix() wxOVERRIDE; +#endif // wxUSE_DC_TRANSFORM_MATRIX + + virtual void SetLogicalFunction(wxRasterOperationMode function) wxOVERRIDE; + + // implementation from now on + // -------------------------- + + virtual void SetRop(WXHDC cdc); + virtual void SelectOldObjects(WXHDC dc); + + void SetWindow(wxWindow *win) + { + m_window = win; + +#if wxUSE_PALETTE + // if we have palettes use the correct one for this window + InitializePalette(); +#endif // wxUSE_PALETTE + } + + WXHDC GetHDC() const { return m_hDC; } + void SetHDC(WXHDC dc, bool bOwnsDC = false) + { + m_hDC = dc; + m_bOwnsDC = bOwnsDC; + + // we might have a pre existing clipping region, make sure that we + // return it if asked -- but avoid calling ::GetClipBox() right now as + // it could be unnecessary wasteful + m_clipping = true; + m_isClipBoxValid = false; + } + + void* GetHandle() const wxOVERRIDE { return (void*)GetHDC(); } + + const wxBitmap& GetSelectedBitmap() const wxOVERRIDE { return m_selectedBitmap; } + wxBitmap& GetSelectedBitmap() wxOVERRIDE { return m_selectedBitmap; } + + // update the internal clip box variables + void UpdateClipBox(); + +#if wxUSE_DC_CACHEING + static wxDCCacheEntry* FindBitmapInCache(WXHDC hDC, int w, int h); + static wxDCCacheEntry* FindDCInCache(wxDCCacheEntry* notThis, WXHDC hDC); + + static void AddToBitmapCache(wxDCCacheEntry* entry); + static void AddToDCCache(wxDCCacheEntry* entry); + static void ClearCache(); +#endif + + // RTL related functions + // --------------------- + + // get or change the layout direction (LTR or RTL) for this dc, + // wxLayout_Default is returned if layout direction is not supported + virtual wxLayoutDirection GetLayoutDirection() const wxOVERRIDE; + virtual void SetLayoutDirection(wxLayoutDirection dir) wxOVERRIDE; + +protected: + void Init() + { + m_bOwnsDC = false; + m_hDC = NULL; + + m_oldBitmap = NULL; + m_oldPen = NULL; + m_oldBrush = NULL; + m_oldFont = NULL; + +#if wxUSE_PALETTE + m_oldPalette = NULL; +#endif // wxUSE_PALETTE + m_isClipBoxValid = false; + } + + // Unlike the public SetWindow(), this one doesn't call InitializePalette(). + void InitWindow(wxWindow* window); + + // create an uninitialized DC: this should be only used by the derived + // classes + wxMSWDCImpl( wxDC *owner ) : wxDCImpl( owner ) { Init(); } + + void RealizeScaleAndOrigin(); + +public: + virtual void DoGetFontMetrics(int *height, + int *ascent, + int *descent, + int *internalLeading, + int *externalLeading, + int *averageWidth) const wxOVERRIDE; + virtual void DoGetTextExtent(const wxString& string, + wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + const wxFont *theFont = NULL) const wxOVERRIDE; + virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const wxOVERRIDE; + + virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, + wxFloodFillStyle style = wxFLOOD_SURFACE) wxOVERRIDE; + + virtual void DoGradientFillLinear(const wxRect& rect, + const wxColour& initialColour, + const wxColour& destColour, + wxDirection nDirection = wxEAST) wxOVERRIDE; + + virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const wxOVERRIDE; + + virtual void DoDrawPoint(wxCoord x, wxCoord y) wxOVERRIDE; + virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) wxOVERRIDE; + + virtual void DoDrawArc(wxCoord x1, wxCoord y1, + wxCoord x2, wxCoord y2, + wxCoord xc, wxCoord yc) wxOVERRIDE; + virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, + double sa, double ea) wxOVERRIDE; + + virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE; + virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, + wxCoord width, wxCoord height, + double radius) wxOVERRIDE; + virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE; + +#if wxUSE_SPLINES + virtual void DoDrawSpline(const wxPointList *points) wxOVERRIDE; +#endif + + virtual void DoCrossHair(wxCoord x, wxCoord y) wxOVERRIDE; + + virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) wxOVERRIDE; + virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, + bool useMask = false) wxOVERRIDE; + + virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) wxOVERRIDE; + virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, + double angle) wxOVERRIDE; + + virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, + wxDC *source, wxCoord xsrc, wxCoord ysrc, + wxRasterOperationMode rop = wxCOPY, bool useMask = false, + wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) wxOVERRIDE; + + virtual bool DoStretchBlit(wxCoord xdest, wxCoord ydest, + wxCoord dstWidth, wxCoord dstHeight, + wxDC *source, + wxCoord xsrc, wxCoord ysrc, + wxCoord srcWidth, wxCoord srcHeight, + wxRasterOperationMode rop = wxCOPY, bool useMask = false, + wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) wxOVERRIDE; + + virtual void DoSetClippingRegion(wxCoord x, wxCoord y, + wxCoord width, wxCoord height) wxOVERRIDE; + virtual void DoSetDeviceClippingRegion(const wxRegion& region) wxOVERRIDE; + virtual bool DoGetClippingRect(wxRect& rect) const wxOVERRIDE; + + virtual void DoGetSizeMM(int* width, int* height) const wxOVERRIDE; + + virtual void DoDrawLines(int n, const wxPoint points[], + wxCoord xoffset, wxCoord yoffset) wxOVERRIDE; + virtual void DoDrawPolygon(int n, const wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + wxPolygonFillMode fillStyle = wxODDEVEN_RULE) wxOVERRIDE; + virtual void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + wxPolygonFillMode fillStyle = wxODDEVEN_RULE) wxOVERRIDE; + virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const wxOVERRIDE + { + return subrect == NULL ? GetSelectedBitmap() + : GetSelectedBitmap().GetSubBitmap(*subrect); + } + + +#if wxUSE_PALETTE + // MSW specific, select a logical palette into the HDC + // (tell windows to translate pixel from other palettes to our custom one + // and vice versa) + // Realize tells it to also reset the system palette to this one. + void DoSelectPalette(bool realize = false); + + // Find out what palette our parent window has, then select it into the dc + void InitializePalette(); +#endif // wxUSE_PALETTE + +protected: + // common part of DoDrawText() and DoDrawRotatedText() + void DrawAnyText(const wxString& text, wxCoord x, wxCoord y); + + // common part of DoSetClippingRegion() and DoSetDeviceClippingRegion() + void SetClippingHrgn(WXHRGN hrgn, bool doRtlOffset = false); + + // implementation of DoGetSize() for wxScreen/PrinterDC: this simply + // returns the size of the entire device this DC is associated with + // + // notice that we intentionally put it in a separate function instead of + // DoGetSize() itself because we want it to remain pure virtual both + // because each derived class should take care to define it as needed (this + // implementation is not at all always appropriate) and because we want + // wxDC to be an ABC to prevent it from being created directly + void GetDeviceSize(int *width, int *height) const; + + + // MSW-specific member variables + // ----------------------------- + + wxBitmap m_selectedBitmap; + + // TRUE => DeleteDC() in dtor, FALSE => only ReleaseDC() it + bool m_bOwnsDC:1; + + // our HDC + WXHDC m_hDC; + + // Store all old GDI objects when do a SelectObject, so we can select them + // back in (this unselecting user's objects) so we can safely delete the + // DC. + WXHBITMAP m_oldBitmap; + WXHPEN m_oldPen; + WXHBRUSH m_oldBrush; + WXHFONT m_oldFont; + +#if wxUSE_PALETTE + WXHPALETTE m_oldPalette; +#endif // wxUSE_PALETTE + +#if wxUSE_DC_CACHEING + static wxObjectList sm_bitmapCache; + static wxObjectList sm_dcCache; +#endif + + bool m_isClipBoxValid; + + wxDECLARE_CLASS(wxMSWDCImpl); + wxDECLARE_NO_COPY_CLASS(wxMSWDCImpl); +}; + +// ---------------------------------------------------------------------------- +// wxDCTemp: a wxDC which doesn't free the given HDC (used by wxWidgets +// only/mainly) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDCTempImpl : public wxMSWDCImpl +{ +public: + // construct a temporary DC with the specified HDC and size (it should be + // specified whenever we know it for this HDC) + wxDCTempImpl(wxDC *owner, WXHDC hdc, const wxSize& size ) + : wxMSWDCImpl( owner, hdc ), + m_size(size) + { + } + + virtual ~wxDCTempImpl() + { + // prevent base class dtor from freeing it + SetHDC((WXHDC)NULL); + } + + virtual void DoGetSize(int *w, int *h) const wxOVERRIDE + { + wxASSERT_MSG( m_size.IsFullySpecified(), + wxT("size of this DC hadn't been set and is unknown") ); + + if ( w ) + *w = m_size.x; + if ( h ) + *h = m_size.y; + } + +private: + // size of this DC must be explicitly set by SetSize() as we have no way to + // find it ourselves + const wxSize m_size; + + wxDECLARE_NO_COPY_CLASS(wxDCTempImpl); +}; + +class WXDLLIMPEXP_CORE wxDCTemp : public wxDC +{ +public: + wxDCTemp(WXHDC hdc, const wxSize& size = wxDefaultSize) + : wxDC(new wxDCTempImpl(this, hdc, size)) + { + } +}; + +#endif // _WX_MSW_DC_H_ + diff --git a/lib/wxWidgets/include/wx/msw/dcclient.h b/lib/wxWidgets/include/wx/msw/dcclient.h new file mode 100644 index 0000000..0f31890 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/dcclient.h @@ -0,0 +1,108 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/dcclient.h +// Purpose: wxClientDC class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCCLIENT_H_ +#define _WX_DCCLIENT_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/dc.h" +#include "wx/msw/dc.h" +#include "wx/dcclient.h" + +class wxPaintDCInfo; + +// ---------------------------------------------------------------------------- +// DC classes +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWindowDCImpl : public wxMSWDCImpl +{ +public: + // default ctor + wxWindowDCImpl( wxDC *owner ); + + // Create a DC corresponding to the whole window + wxWindowDCImpl( wxDC *owner, wxWindow *win ); + + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; + +protected: + // initialize the newly created DC + void InitDC(); + + wxDECLARE_CLASS(wxWindowDCImpl); + wxDECLARE_NO_COPY_CLASS(wxWindowDCImpl); +}; + +class WXDLLIMPEXP_CORE wxClientDCImpl : public wxWindowDCImpl +{ +public: + // default ctor + wxClientDCImpl( wxDC *owner ); + + // Create a DC corresponding to the client area of the window + wxClientDCImpl( wxDC *owner, wxWindow *win ); + + virtual ~wxClientDCImpl(); + + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; + +protected: + void InitDC(); + + wxDECLARE_CLASS(wxClientDCImpl); + wxDECLARE_NO_COPY_CLASS(wxClientDCImpl); +}; + +class WXDLLIMPEXP_CORE wxPaintDCImpl : public wxClientDCImpl +{ +public: + wxPaintDCImpl( wxDC *owner ); + + // Create a DC corresponding for painting the window in OnPaint() + wxPaintDCImpl( wxDC *owner, wxWindow *win ); + + virtual ~wxPaintDCImpl(); + + // find the entry for this DC in the cache (keyed by the window) + static WXHDC FindDCInCache(wxWindow* win); + + // This must be called by the code handling WM_PAINT to remove the DC + // cached for this window for the duration of this message processing. + static void EndPaint(wxWindow *win); + +protected: + // Find the DC for this window in the cache, return NULL if not found. + static wxPaintDCInfo *FindInCache(wxWindow* win); + + wxDECLARE_CLASS(wxPaintDCImpl); + wxDECLARE_NO_COPY_CLASS(wxPaintDCImpl); +}; + +/* + * wxPaintDCEx + * This class is used when an application sends an HDC with the WM_PAINT + * message. It is used in HandlePaint and need not be used by an application. + */ + +class WXDLLIMPEXP_CORE wxPaintDCEx : public wxPaintDC +{ +public: + wxPaintDCEx(wxWindow *canvas, WXHDC dc); + + wxDECLARE_CLASS(wxPaintDCEx); + wxDECLARE_NO_COPY_CLASS(wxPaintDCEx); +}; + +#endif + // _WX_DCCLIENT_H_ diff --git a/lib/wxWidgets/include/wx/msw/dcmemory.h b/lib/wxWidgets/include/wx/msw/dcmemory.h new file mode 100644 index 0000000..2fe0fad --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/dcmemory.h @@ -0,0 +1,47 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/dcmemory.h +// Purpose: wxMemoryDC class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCMEMORY_H_ +#define _WX_DCMEMORY_H_ + +#include "wx/dcmemory.h" +#include "wx/msw/dc.h" + +class WXDLLIMPEXP_CORE wxMemoryDCImpl: public wxMSWDCImpl +{ +public: + wxMemoryDCImpl( wxMemoryDC *owner ); + wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap ); + wxMemoryDCImpl( wxMemoryDC *owner, wxDC *dc ); // Create compatible DC + + // override some base class virtuals + virtual wxSize GetPPI() const wxOVERRIDE; + virtual void SetFont(const wxFont& font) wxOVERRIDE; + + virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE; + virtual void DoGetSize(int* width, int* height) const wxOVERRIDE; + virtual void DoSelect(const wxBitmap& bitmap) wxOVERRIDE; + + virtual wxBitmap DoGetAsBitmap(const wxRect* subrect) const wxOVERRIDE + { return subrect == NULL ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmapOfHDC(*subrect, GetHDC() );} + +protected: + // create DC compatible with the given one or screen if dc == NULL + bool CreateCompatible(wxDC *dc); + + // initialize the newly created DC + void Init(); + + wxDECLARE_CLASS(wxMemoryDCImpl); + wxDECLARE_NO_COPY_CLASS(wxMemoryDCImpl); +}; + +#endif + // _WX_DCMEMORY_H_ diff --git a/lib/wxWidgets/include/wx/msw/dcprint.h b/lib/wxWidgets/include/wx/msw/dcprint.h new file mode 100644 index 0000000..845c0d6 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/dcprint.h @@ -0,0 +1,88 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/dcprint.h +// Purpose: wxPrinterDC class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_DCPRINT_H_ +#define _WX_MSW_DCPRINT_H_ + +#if wxUSE_PRINTING_ARCHITECTURE + +#include "wx/dcprint.h" +#include "wx/cmndata.h" +#include "wx/msw/dc.h" + +// ------------------------------------------------------------------------ +// wxPrinterDCImpl +// + +class WXDLLIMPEXP_CORE wxPrinterDCImpl : public wxMSWDCImpl +{ +public: + // Create from print data + wxPrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data ); + wxPrinterDCImpl( wxPrinterDC *owner, WXHDC theDC ); + + // override some base class virtuals + virtual bool StartDoc(const wxString& message) wxOVERRIDE; + virtual void EndDoc() wxOVERRIDE; + virtual void StartPage() wxOVERRIDE; + virtual void EndPage() wxOVERRIDE; + + virtual wxRect GetPaperRect() const wxOVERRIDE; + + virtual wxSize FromDIP(const wxSize& sz) const wxOVERRIDE; + + virtual wxSize ToDIP(const wxSize& sz) const wxOVERRIDE; + + void SetFont(const wxFont& font) wxOVERRIDE; + +protected: + virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, + bool useMask = false) wxOVERRIDE; + virtual bool DoBlit(wxCoord xdest, wxCoord ydest, + wxCoord width, wxCoord height, + wxDC *source, wxCoord xsrc, wxCoord ysrc, + wxRasterOperationMode rop = wxCOPY, bool useMask = false, + wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) wxOVERRIDE; + virtual void DoGetSize(int *w, int *h) const wxOVERRIDE + { + GetDeviceSize(w, h); + } + + + // init the dc + void Init(); + + wxPrintData m_printData; + +private: + wxDECLARE_CLASS(wxPrinterDCImpl); + wxDECLARE_NO_COPY_CLASS(wxPrinterDCImpl); +}; + +// Gets an HDC for the specified printer configuration +WXHDC WXDLLIMPEXP_CORE wxGetPrinterDC(const wxPrintData& data); + +// ------------------------------------------------------------------------ +// wxPrinterDCromHDC +// + +class WXDLLIMPEXP_CORE wxPrinterDCFromHDC: public wxPrinterDC +{ +public: + wxPrinterDCFromHDC( WXHDC theDC ) + : wxPrinterDC(new wxPrinterDCImpl(this, theDC)) + { + } +}; + +#endif // wxUSE_PRINTING_ARCHITECTURE + +#endif // _WX_MSW_DCPRINT_H_ + diff --git a/lib/wxWidgets/include/wx/msw/dcscreen.h b/lib/wxWidgets/include/wx/msw/dcscreen.h new file mode 100644 index 0000000..e7918c4 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/dcscreen.h @@ -0,0 +1,31 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/dcscreen.h +// Purpose: wxScreenDC class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_DCSCREEN_H_ +#define _WX_MSW_DCSCREEN_H_ + +#include "wx/dcscreen.h" +#include "wx/msw/dc.h" + +class WXDLLIMPEXP_CORE wxScreenDCImpl : public wxMSWDCImpl +{ +public: + // Create a DC representing the whole virtual screen (all monitors) + wxScreenDCImpl( wxScreenDC *owner ); + + // Return the size of the whole virtual screen (all monitors) + virtual void DoGetSize(int *w, int *h) const wxOVERRIDE; + + wxDECLARE_CLASS(wxScreenDCImpl); + wxDECLARE_NO_COPY_CLASS(wxScreenDCImpl); +}; + +#endif // _WX_MSW_DCSCREEN_H_ + diff --git a/lib/wxWidgets/include/wx/msw/dde.h b/lib/wxWidgets/include/wx/msw/dde.h new file mode 100644 index 0000000..64ec556 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/dde.h @@ -0,0 +1,137 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/dde.h +// Purpose: DDE class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DDE_H_ +#define _WX_DDE_H_ + +#include "wx/ipcbase.h" + +/* + * Mini-DDE implementation + + Most transactions involve a topic name and an item name (choose these + as befits your application). + + A client can: + + - ask the server to execute commands (data) associated with a topic + - request data from server by topic and item + - poke data into the server + - ask the server to start an advice loop on topic/item + - ask the server to stop an advice loop + + A server can: + + - respond to execute, request, poke and advice start/stop + - send advise data to client + + Note that this limits the server in the ways it can send data to the + client, i.e. it can't send unsolicited information. + * + */ + +class WXDLLIMPEXP_FWD_BASE wxDDEServer; +class WXDLLIMPEXP_FWD_BASE wxDDEClient; + +class WXDLLIMPEXP_BASE wxDDEConnection : public wxConnectionBase +{ +public: + wxDDEConnection(void *buffer, size_t size); // use external buffer + wxDDEConnection(); // use internal buffer + virtual ~wxDDEConnection(); + + // implement base class pure virtual methods + virtual const void *Request(const wxString& item, + size_t *size = NULL, + wxIPCFormat format = wxIPC_TEXT) wxOVERRIDE; + virtual bool StartAdvise(const wxString& item) wxOVERRIDE; + virtual bool StopAdvise(const wxString& item) wxOVERRIDE; + virtual bool Disconnect() wxOVERRIDE; + +protected: + virtual bool DoExecute(const void *data, size_t size, wxIPCFormat format) wxOVERRIDE; + virtual bool DoPoke(const wxString& item, const void *data, size_t size, + wxIPCFormat format) wxOVERRIDE; + virtual bool DoAdvise(const wxString& item, const void *data, size_t size, + wxIPCFormat format) wxOVERRIDE; + +public: + wxString m_topicName; + wxDDEServer* m_server; + wxDDEClient* m_client; + + WXHCONV m_hConv; + const void* m_sendingData; + int m_dataSize; + + wxDECLARE_NO_COPY_CLASS(wxDDEConnection); + wxDECLARE_DYNAMIC_CLASS(wxDDEConnection); +}; + +class WXDLLIMPEXP_BASE wxDDEServer : public wxServerBase +{ +public: + wxDDEServer(); + bool Create(const wxString& server_name) wxOVERRIDE; + virtual ~wxDDEServer(); + + virtual wxConnectionBase *OnAcceptConnection(const wxString& topic) wxOVERRIDE; + + // Find/delete wxDDEConnection corresponding to the HCONV + wxDDEConnection *FindConnection(WXHCONV conv); + bool DeleteConnection(WXHCONV conv); + wxString& GetServiceName() { return m_serviceName; } + const wxString& GetServiceName() const { return m_serviceName; } + + wxDDEConnectionList& GetConnections() { return m_connections; } + const wxDDEConnectionList& GetConnections() const { return m_connections; } + +protected: + int m_lastError; + wxString m_serviceName; + wxDDEConnectionList m_connections; + + wxDECLARE_DYNAMIC_CLASS(wxDDEServer); +}; + +class WXDLLIMPEXP_BASE wxDDEClient: public wxClientBase +{ +public: + wxDDEClient(); + virtual ~wxDDEClient(); + + bool ValidHost(const wxString& host) wxOVERRIDE; + + // Call this to make a connection. Returns NULL if cannot. + virtual wxConnectionBase *MakeConnection(const wxString& host, + const wxString& server, + const wxString& topic) wxOVERRIDE; + + // Tailor this to return own connection. + virtual wxConnectionBase *OnMakeConnection() wxOVERRIDE; + + // Find/delete wxDDEConnection corresponding to the HCONV + wxDDEConnection *FindConnection(WXHCONV conv); + bool DeleteConnection(WXHCONV conv); + + wxDDEConnectionList& GetConnections() { return m_connections; } + const wxDDEConnectionList& GetConnections() const { return m_connections; } + +protected: + int m_lastError; + wxDDEConnectionList m_connections; + + wxDECLARE_DYNAMIC_CLASS(wxDDEClient); +}; + +void WXDLLIMPEXP_BASE wxDDEInitialize(); +void WXDLLIMPEXP_BASE wxDDECleanUp(); + +#endif // _WX_DDE_H_ diff --git a/lib/wxWidgets/include/wx/msw/debughlp.h b/lib/wxWidgets/include/wx/msw/debughlp.h new file mode 100644 index 0000000..94a399c --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/debughlp.h @@ -0,0 +1,417 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/debughlp.h +// Purpose: wraps dbghelp.h standard file +// Author: Vadim Zeitlin, Suzumizaki-kimitaka +// Created: 2005-01-08 (extracted from msw/crashrpt.cpp) +// Copyright: (c) 2003-2005 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_DEBUGHLPH_H_ +#define _WX_MSW_DEBUGHLPH_H_ + +#include "wx/defs.h" + +#if wxUSE_DBGHELP + +#include "wx/dynlib.h" +#include "wx/msw/wrapwin.h" + +#ifdef __VISUALC__ + // Disable a warning that we can do nothing about: we get it at least for + // imagehlp.h from 8.1 Windows kit when using VC14. + #pragma warning(push) + + // 'typedef ': ignored on left of '' when no variable is declared + #pragma warning(disable:4091) +#endif + +#include <imagehlp.h> + +#ifdef __VISUALC__ + #pragma warning(pop) +#endif + +#include "wx/msw/private.h" + +/* + +The table below shows which functions are exported by dbghelp.dll. + +On 64 bit Windows, there seems to be no difference between 32bit dll and 64bit +one. Vista-64 and Win8-64 look the same, but "Ex" and "ExW" versions exist only +in Windows 8. + +Note that SymGetLineFromAddrW and EnumerateLoadedModulesW DON'T exist at all. + +function | Windows | XP-32 Vista-64 Win8-64 +SymEnumSymbolsW n/a v v +SymFromAddrW n/a v v +SymInitializeW n/a v v + +SymEnumSymbols v v v +SymFromAddr v v v +SymInitialize v v v + +SymGetLineFromAddrW64 n/a v v +SymGetLineFromAddr64 v v v +SymGetLineFromAddrW n/a n/a n/a +SymGetLineFromAddr v v v + +EnumerateLoadedModulesW64 n/a v v +EnumerateLoadedModules64 v v v +EnumerateLoadedModulesW n/a n/a n/a +EnumerateLoadedModules v v v + +*/ + +// It's not really clear whether API v10 is used by anything as VC8 still used +// v9, just as MSVC7.1, while VC9 already used v11, but provide support for it +// just in case. +#if API_VERSION_NUMBER < 10/*{{{*/ + +typedef BOOL +(CALLBACK *PENUMLOADED_MODULES_CALLBACKW64)(PWSTR ModuleName, + DWORD64 ModuleBase, + ULONG ModuleSize, + PVOID UserContext); + +typedef struct _IMAGEHLP_LINEW64 +{ + DWORD SizeOfStruct; + PVOID Key; + DWORD LineNumber; + PWSTR FileName; + DWORD64 Address; +} IMAGEHLP_LINEW64, *PIMAGEHLP_LINEW64; + +typedef struct _SYMBOL_INFOW +{ + ULONG SizeOfStruct; + ULONG TypeIndex; + ULONG64 Reserved[2]; + ULONG Index; + ULONG Size; + ULONG64 ModBase; + ULONG Flags; + ULONG64 Value; + ULONG64 Address; + ULONG Register; + ULONG Scope; + ULONG Tag; + ULONG NameLen; + ULONG MaxNameLen; + WCHAR Name[1]; +} SYMBOL_INFOW, *PSYMBOL_INFOW; + +typedef BOOL +(CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACKW)(PSYMBOL_INFOW pSymInfo, + ULONG SymbolSize, + PVOID UserContext); + +typedef BOOL +(CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACK)(PSYMBOL_INFO pSymInfo, + ULONG SymbolSize, + PVOID UserContext); + +#endif // API_VERSION_NUMBER < 10/*}}}*/ + +// wx-prefixed types map to either the ANSI or Unicode ("W") version depending +// on the build of wx itself. +#ifdef UNICODE + #define wxPSYM_ENUMERATESYMBOLS_CALLBACK PSYM_ENUMERATESYMBOLS_CALLBACKW +#else // !UNICODE + #define wxPSYM_ENUMERATESYMBOLS_CALLBACK PSYM_ENUMERATESYMBOLS_CALLBACK +#endif // UNICODE/!UNICODE + +// This one could be already defined by wx/msw/stackwalk.h +#ifndef wxSYMBOL_INFO + #ifdef UNICODE + #define wxSYMBOL_INFO SYMBOL_INFOW + #else // !UNICODE + #define wxSYMBOL_INFO SYMBOL_INFO + #endif // UNICODE/!UNICODE +#endif // !defined(wxSYMBOL_INFO) + +typedef wxSYMBOL_INFO* wxPSYMBOL_INFO; + +// This differs from PENUMLOADED_MODULES_CALLBACK[W]64 in that it always uses +// "const" for its first argument when the SDK used to pass a non-const string +// here until API_VERSION_NUMBER==11, so we can't just define it as an existing +// typedef. +typedef BOOL +(CALLBACK *wxPENUMLOADED_MODULES_CALLBACK)(const wxChar* moduleName, + DWORD64 moduleBase, + ULONG moduleSize, + void *userContext); + +// ---------------------------------------------------------------------------- +// wxDbgHelpDLL: dynamically load dbghelp.dll functions +// ---------------------------------------------------------------------------- + +// wrapper for some functions from dbghelp.dll +// +// MT note: this class is not MT safe and should be only used from a single +// thread at a time (this is so because dbghelp.dll is not MT-safe +// itself anyhow) +class wxDbgHelpDLL +{ +public: + // some useful constants not present in debughlp.h (stolen from DIA SDK) + enum BasicType + { + BASICTYPE_NOTYPE = 0, + BASICTYPE_VOID = 1, + BASICTYPE_CHAR = 2, + BASICTYPE_WCHAR = 3, + BASICTYPE_INT = 6, + BASICTYPE_UINT = 7, + BASICTYPE_FLOAT = 8, + BASICTYPE_BCD = 9, + BASICTYPE_BOOL = 10, + BASICTYPE_LONG = 13, + BASICTYPE_ULONG = 14, + BASICTYPE_CURRENCY = 25, + BASICTYPE_DATE = 26, + BASICTYPE_VARIANT = 27, + BASICTYPE_COMPLEX = 28, + BASICTYPE_BIT = 29, + BASICTYPE_BSTR = 30, + BASICTYPE_HRESULT = 31, + BASICTYPE_MAX + }; + + enum SymbolTag + { + SYMBOL_TAG_NULL, + SYMBOL_TAG_EXE, + SYMBOL_TAG_COMPILAND, + SYMBOL_TAG_COMPILAND_DETAILS, + SYMBOL_TAG_COMPILAND_ENV, + SYMBOL_TAG_FUNCTION, + SYMBOL_TAG_BLOCK, + SYMBOL_TAG_DATA, + SYMBOL_TAG_ANNOTATION, + SYMBOL_TAG_LABEL, + SYMBOL_TAG_PUBLIC_SYMBOL, + SYMBOL_TAG_UDT, + SYMBOL_TAG_ENUM, + SYMBOL_TAG_FUNCTION_TYPE, + SYMBOL_TAG_POINTER_TYPE, + SYMBOL_TAG_ARRAY_TYPE, + SYMBOL_TAG_BASE_TYPE, + SYMBOL_TAG_TYPEDEF, + SYMBOL_TAG_BASE_CLASS, + SYMBOL_TAG_FRIEND, + SYMBOL_TAG_FUNCTION_ARG_TYPE, + SYMBOL_TAG_FUNC_DEBUG_START, + SYMBOL_TAG_FUNC_DEBUG_END, + SYMBOL_TAG_USING_NAMESPACE, + SYMBOL_TAG_VTABLE_SHAPE, + SYMBOL_TAG_VTABLE, + SYMBOL_TAG_CUSTOM, + SYMBOL_TAG_THUNK, + SYMBOL_TAG_CUSTOM_TYPE, + SYMBOL_TAG_MANAGED_TYPE, + SYMBOL_TAG_DIMENSION, + SYMBOL_TAG_MAX + }; + + enum DataKind + { + DATA_UNKNOWN, + DATA_LOCAL, + DATA_STATIC_LOCAL, + DATA_PARAM, + DATA_OBJECT_PTR, // "this" pointer + DATA_FILE_STATIC, + DATA_GLOBAL, + DATA_MEMBER, + DATA_STATIC_MEMBER, + DATA_CONSTANT, + DATA_MAX + }; + + enum UdtKind + { + UDT_STRUCT, + UDT_CLASS, + UDT_UNION, + UDT_MAX + }; + + + // function types + typedef DWORD (WINAPI *SymGetOptions_t)(); + typedef DWORD (WINAPI *SymSetOptions_t)(DWORD); + typedef BOOL (WINAPI *SymInitialize_t)(HANDLE, LPCSTR, BOOL); + typedef BOOL (WINAPI *SymInitializeW_t)(HANDLE, LPCWSTR, BOOL); + typedef BOOL (WINAPI *StackWalk_t)(DWORD, HANDLE, HANDLE, LPSTACKFRAME, + LPVOID, PREAD_PROCESS_MEMORY_ROUTINE, + PFUNCTION_TABLE_ACCESS_ROUTINE, + PGET_MODULE_BASE_ROUTINE, + PTRANSLATE_ADDRESS_ROUTINE); + typedef BOOL (WINAPI *SymFromAddr_t)(HANDLE, DWORD64, PDWORD64, PSYMBOL_INFO); + typedef BOOL (WINAPI *SymFromAddrW_t)(HANDLE, DWORD64, PDWORD64, PSYMBOL_INFOW); + typedef LPVOID (WINAPI *SymFunctionTableAccess_t)(HANDLE, DWORD_PTR); + typedef DWORD_PTR (WINAPI *SymGetModuleBase_t)(HANDLE, DWORD_PTR); + typedef BOOL (WINAPI *SymGetLineFromAddr_t)(HANDLE, DWORD, + PDWORD, PIMAGEHLP_LINE); + typedef BOOL (WINAPI *SymGetLineFromAddr64_t)(HANDLE, DWORD64, + PDWORD, PIMAGEHLP_LINE64); + typedef BOOL (WINAPI *SymGetLineFromAddrW64_t)(HANDLE, DWORD64, + PDWORD, PIMAGEHLP_LINEW64); + typedef BOOL (WINAPI *SymSetContext_t)(HANDLE, PIMAGEHLP_STACK_FRAME, + PIMAGEHLP_CONTEXT); + typedef BOOL (WINAPI *SymEnumSymbols_t)(HANDLE, ULONG64, PCSTR, + PSYM_ENUMERATESYMBOLS_CALLBACK, + const PVOID); + typedef BOOL (WINAPI *SymEnumSymbolsW_t)(HANDLE, ULONG64, PCWSTR, + PSYM_ENUMERATESYMBOLS_CALLBACKW, + const PVOID); + typedef BOOL (WINAPI *SymGetTypeInfo_t)(HANDLE, DWORD64, ULONG, + IMAGEHLP_SYMBOL_TYPE_INFO, PVOID); + typedef BOOL (WINAPI *SymCleanup_t)(HANDLE); + typedef BOOL (WINAPI *EnumerateLoadedModules_t)(HANDLE, PENUMLOADED_MODULES_CALLBACK, PVOID); + typedef BOOL (WINAPI *EnumerateLoadedModules64_t)(HANDLE, PENUMLOADED_MODULES_CALLBACK64, PVOID); + typedef BOOL (WINAPI *EnumerateLoadedModulesW64_t)(HANDLE, PENUMLOADED_MODULES_CALLBACKW64, PVOID); + typedef BOOL (WINAPI *MiniDumpWriteDump_t)(HANDLE, DWORD, HANDLE, + MINIDUMP_TYPE, + CONST PMINIDUMP_EXCEPTION_INFORMATION, + CONST PMINIDUMP_USER_STREAM_INFORMATION, + CONST PMINIDUMP_CALLBACK_INFORMATION); + + // Higher level functions selecting the right debug help library function + // to call: for CallFoo(), it can be Foo(), Foo64(), FooW() or FooW64() + // depending on the build options and function availability. + // + // They also provide more convenient to use wx-specific API, e.g. work with + // wxString instead of char/wchar_t pointers and omit the arguments we + // don't need. + static BOOL CallSymInitialize(HANDLE, BOOL); + static BOOL CallEnumerateLoadedModules(HANDLE, wxPENUMLOADED_MODULES_CALLBACK, PVOID); + static BOOL CallSymFromAddr(HANDLE, DWORD64, + size_t* offset, wxString* name); + static BOOL CallSymGetLineFromAddr(HANDLE, DWORD64, + wxString* fileName, size_t* line); + static BOOL CallSymEnumSymbols(HANDLE hProcess, + ULONG64 baseOfDll, + wxPSYM_ENUMERATESYMBOLS_CALLBACK callback, + const PVOID callbackParam); + + // The macro called by wxDO_FOR_ALL_SYM_FUNCS() below takes 2 arguments: + // the name of the function in the program code, which never has "64" + // suffix, and the name of the function in the DLL which can have "64" + // suffix in some cases. These 2 helper macros call the macro with the + // correct arguments in both cases. + #define wxSYM_CALL(what, name) what(name, name) +#if defined(_M_AMD64) || defined(_M_ARM64) + #define wxSYM_CALL_64(what, name) what(name, name ## 64) + + // Also undo all the "helpful" definitions done by imagehlp.h that map 32 + // bit functions to 64 bit ones, we don't need this as we do it ourselves. + #undef StackWalk + #undef SymFunctionTableAccess + #undef SymGetModuleBase + #undef SymGetLineFromAddr + #undef EnumerateLoadedModules +#else + #define wxSYM_CALL_64(what, name) what(name, name) +#endif + + #define wxSYM_CALL_ALWAYS_W(what, name) what(name ## W, name ## W) + + #define wxSYM_CALL_ALTERNATIVES(what, name) \ + what(name, name); \ + what(name ## 64, name ## 64); \ + what(name ## W64, name ## W64) + + #define wxDO_FOR_ALL_SYM_FUNCS_REQUIRED_PUBLIC(what) \ + wxSYM_CALL_64(what, StackWalk); \ + wxSYM_CALL_64(what, SymFunctionTableAccess); \ + wxSYM_CALL_64(what, SymGetModuleBase); \ + \ + wxSYM_CALL(what, SymGetOptions); \ + wxSYM_CALL(what, SymSetOptions); \ + wxSYM_CALL(what, SymSetContext); \ + wxSYM_CALL(what, SymGetTypeInfo); \ + wxSYM_CALL(what, SymCleanup); \ + wxSYM_CALL(what, MiniDumpWriteDump) + + #define wxDO_FOR_ALL_SYM_FUNCS_REQUIRED_PRIVATE(what) \ + wxSYM_CALL(what, SymInitialize); \ + wxSYM_CALL(what, SymFromAddr); \ + wxSYM_CALL(what, SymEnumSymbols) + + #define wxDO_FOR_ALL_SYM_FUNCS_REQUIRED(what) \ + wxDO_FOR_ALL_SYM_FUNCS_REQUIRED_PRIVATE(what); \ + wxDO_FOR_ALL_SYM_FUNCS_REQUIRED_PUBLIC(what) + + // Alternation will work when the following functions are not found, + // therefore they are not included in REQUIRED version. + #define wxDO_FOR_ALL_SYM_FUNCS_OPTIONAL(what) \ + wxSYM_CALL_ALTERNATIVES(what, SymGetLineFromAddr); \ + wxSYM_CALL_ALTERNATIVES(what, EnumerateLoadedModules); \ + wxSYM_CALL_ALWAYS_W(what, SymInitialize); \ + wxSYM_CALL_ALWAYS_W(what, SymFromAddr); \ + wxSYM_CALL_ALWAYS_W(what, SymEnumSymbols) + + #define wxDO_FOR_ALL_SYM_FUNCS(what) \ + wxDO_FOR_ALL_SYM_FUNCS_REQUIRED(what); \ + wxDO_FOR_ALL_SYM_FUNCS_OPTIONAL(what) + + #define wxDECLARE_SYM_FUNCTION(func, name) static func ## _t func + + wxDO_FOR_ALL_SYM_FUNCS_REQUIRED_PUBLIC(wxDECLARE_SYM_FUNCTION); + +private: + wxDO_FOR_ALL_SYM_FUNCS_REQUIRED_PRIVATE(wxDECLARE_SYM_FUNCTION); + wxDO_FOR_ALL_SYM_FUNCS_OPTIONAL(wxDECLARE_SYM_FUNCTION); + +public: + + #undef wxDECLARE_SYM_FUNCTION + + // load all functions from DLL, return true if ok + static bool Init(); + + // return the string with the error message explaining why Init() failed + static const wxString& GetErrorMessage(); + + // log error returned by the given function to debug output + static void LogError(const wxChar *func); + + // return textual representation of the value of given symbol + static wxString DumpSymbol(wxPSYMBOL_INFO pSymInfo, void *pVariable); + + // return the name of the symbol with given type index + static wxString GetSymbolName(wxPSYMBOL_INFO pSymInfo); + +private: + // dereference the given symbol, i.e. return symbol which is not a + // pointer/reference any more + // + // if ppData != NULL, dereference the pointer as many times as we + // dereferenced the symbol + // + // return the tag of the dereferenced symbol + static SymbolTag DereferenceSymbol(wxPSYMBOL_INFO pSymInfo, void **ppData); + + static wxString DumpField(wxPSYMBOL_INFO pSymInfo, + void *pVariable, + unsigned level); + + static wxString DumpBaseType(BasicType bt, DWORD64 length, void *pVariable); + + static wxString DumpUDT(wxPSYMBOL_INFO pSymInfo, + void *pVariable, + unsigned level = 0); + + static bool BindDbgHelpFunctions(const wxDynamicLibrary& dllDbgHelp); + static bool DoInit(); +}; + +#endif // wxUSE_DBGHELP + +#endif // _WX_MSW_DEBUGHLPH_H_ + diff --git a/lib/wxWidgets/include/wx/msw/dialog.h b/lib/wxWidgets/include/wx/msw/dialog.h new file mode 100644 index 0000000..ce9e534 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/dialog.h @@ -0,0 +1,95 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/dialog.h +// Purpose: wxDialog class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DIALOG_H_ +#define _WX_DIALOG_H_ + +#include "wx/panel.h" + +extern WXDLLIMPEXP_DATA_CORE(const char) wxDialogNameStr[]; + +class WXDLLIMPEXP_FWD_CORE wxDialogModalData; + +// Dialog boxes +class WXDLLIMPEXP_CORE wxDialog : public wxDialogBase +{ +public: + wxDialog() { Init(); } + + // full ctor + wxDialog(wxWindow *parent, wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxASCII_STR(wxDialogNameStr)) + { + Init(); + + (void)Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxASCII_STR(wxDialogNameStr)); + + virtual ~wxDialog(); + + // return true if we're showing the dialog modally + virtual bool IsModal() const wxOVERRIDE { return m_modalData != NULL; } + + // show the dialog modally and return the value passed to EndModal() + virtual int ShowModal() wxOVERRIDE; + + // may be called to terminate the dialog with the given return code + virtual void EndModal(int retCode) wxOVERRIDE; + + + // implementation only from now on + // ------------------------------- + + // override some base class virtuals + virtual bool Show(bool show = true) wxOVERRIDE; + virtual void SetWindowStyleFlag(long style) wxOVERRIDE; + + // Windows callbacks + WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) wxOVERRIDE; + +protected: + // common part of all ctors + void Init(); + +private: + // these functions deal with the gripper window shown in the corner of + // resizable dialogs + void CreateGripper(); + void DestroyGripper(); + void ShowGripper(bool show); + void ResizeGripper(); + + // this function is used to adjust Z-order of new children relative to the + // gripper if we have one + void OnWindowCreate(wxWindowCreateEvent& event); + + // gripper window for a resizable dialog, NULL if we're not resizable + WXHWND m_hGripper; + + // this pointer is non-NULL only while the modal event loop is running + wxDialogModalData *m_modalData; + + wxDECLARE_DYNAMIC_CLASS(wxDialog); + wxDECLARE_NO_COPY_CLASS(wxDialog); +}; + +#endif + // _WX_DIALOG_H_ diff --git a/lib/wxWidgets/include/wx/msw/dib.h b/lib/wxWidgets/include/wx/msw/dib.h new file mode 100644 index 0000000..7ca20c4 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/dib.h @@ -0,0 +1,278 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/dib.h +// Purpose: wxDIB class representing Win32 device independent bitmaps +// Author: Vadim Zeitlin +// Modified by: +// Created: 03.03.03 (replaces the old file with the same name) +// Copyright: (c) 1997-2003 wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_DIB_H_ +#define _WX_MSW_DIB_H_ + +class WXDLLIMPEXP_FWD_CORE wxPalette; + +#include "wx/msw/private.h" + +#if wxUSE_WXDIB + +#ifdef __WXMSW__ + #include "wx/bitmap.h" +#endif // __WXMSW__ + +// ---------------------------------------------------------------------------- +// wxDIB: represents a DIB section +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDIB +{ +public: + // ctors and such + // -------------- + + // create an uninitialized DIB with the given width, height and depth (only + // 24 and 32 bpp DIBs are currently supported) + // + // after using this ctor, GetData() and GetHandle() may be used if IsOk() + // returns true + wxDIB(int width, int height, int depth) + { Init(); (void)Create(width, height, depth); } + +#ifdef __WXMSW__ + // create a DIB from the DDB + wxDIB(const wxBitmap& bmp, int depth = -1) + { Init(); (void)Create(bmp, depth); } +#endif // __WXMSW__ + + // create a DIB from the Windows DDB + wxDIB(HBITMAP hbmp) + { Init(); (void)Create(hbmp); } + + // load a DIB from file (any depth is supported here unlike above) + // + // as above, use IsOk() to see if the bitmap was loaded successfully + wxDIB(const wxString& filename) + { Init(); (void)Load(filename); } + + // same as the corresponding ctors but with return value + bool Create(int width, int height, int depth); +#ifdef __WXMSW__ + bool Create(const wxBitmap& bmp, int depth = -1) { return Create(GetHbitmapOf(bmp), depth); } +#endif + bool Create(HBITMAP hbmp, int depth = -1); + bool Load(const wxString& filename); + + // dtor is not virtual, this class is not meant to be used polymorphically + ~wxDIB(); + + + // operations + // ---------- + + // create a bitmap compatible with the given HDC (or screen by default) and + // return its handle, the caller is responsible for freeing it (using + // DeleteObject()) + HBITMAP CreateDDB(HDC hdc = NULL) const; + + // get the handle from the DIB and reset it, i.e. this object won't destroy + // the DIB after this (but the caller should do it) + HBITMAP Detach() { HBITMAP hbmp = m_handle; m_handle = NULL; return hbmp; } + +#if defined(__WXMSW__) && wxUSE_PALETTE + // create a palette for this DIB (always a trivial/default one for 24bpp) + wxPalette *CreatePalette() const; +#endif // defined(__WXMSW__) && wxUSE_PALETTE + + // save the DIB as a .BMP file to the file with the given name + bool Save(const wxString& filename); + + + // accessors + // --------- + + // return true if DIB was successfully created, false otherwise + bool IsOk() const { return m_handle != NULL; } + + // get the bitmap size + wxSize GetSize() const { DoGetObject(); return wxSize(m_width, m_height); } + int GetWidth() const { DoGetObject(); return m_width; } + int GetHeight() const { DoGetObject(); return m_height; } + + // get the number of bits per pixel, or depth + int GetDepth() const { DoGetObject(); return m_depth; } + + // get the DIB handle + HBITMAP GetHandle() const { return m_handle; } + + // get raw pointer to bitmap bits, you should know what you do if you + // decide to use it + unsigned char *GetData() const + { DoGetObject(); return (unsigned char *)m_data; } + + + // HBITMAP conversion + // ------------------ + + // these functions are only used by wxWidgets internally right now, please + // don't use them directly if possible as they're subject to change + + // creates a DDB compatible with the given (or screen) DC from either + // a plain DIB or a DIB section (in which case the last parameter must be + // non NULL) + static HBITMAP ConvertToBitmap(const BITMAPINFO *pbi, + HDC hdc = NULL, + const void *bits = NULL); + + // create a plain DIB (not a DIB section) from a DDB, the caller is + // responsible for freeing it using ::GlobalFree() + static HGLOBAL ConvertFromBitmap(HBITMAP hbmp); + + // creates a DIB from the given DDB or calculates the space needed by it: + // if pbi is NULL, only the space is calculated, otherwise pbi is supposed + // to point at BITMAPINFO of the correct size which is filled by this + // function (this overload is needed for wxBitmapDataObject code in + // src/msw/ole/dataobj.cpp) + static size_t ConvertFromBitmap(BITMAPINFO *pbi, HBITMAP hbmp); + + + // wxImage conversion + // ------------------ + +#if wxUSE_IMAGE + // Possible formats for DIBs created by the functions below. + enum PixelFormat + { + PixelFormat_PreMultiplied = 0, + PixelFormat_NotPreMultiplied = 1 + }; + + // Create a DIB from the given image, the DIB will be either 24 or 32 (if + // the image has alpha channel) bpp. + // + // By default the DIB stores pixel data in pre-multiplied format so that it + // can be used with ::AlphaBlend() but it is also possible to disable + // pre-multiplication for the DIB to be usable with ImageList_Draw() which + // does pre-multiplication internally. + wxDIB(const wxImage& image, PixelFormat pf = PixelFormat_PreMultiplied, int depth = -1) + { + Init(); + (void)Create(image, pf, depth); + } + + // same as the above ctor but with the return code + bool Create(const wxImage& image, PixelFormat pf = PixelFormat_PreMultiplied, int depth = -1); + + // create wxImage having the same data as this DIB + + // Possible options of conversion to wxImage + enum ConversionFlags + { + // Determine whether 32bpp DIB contains real alpha channel + // and return wxImage with or without alpha channel values. + Convert_AlphaAuto, + // Assume that 32bpp DIB contains valid alpha channel and always + // return wxImage with alpha channel values in this case. + Convert_AlphaAlwaysIf32bpp + }; + wxImage ConvertToImage(ConversionFlags flags = Convert_AlphaAuto) const; +#endif // wxUSE_IMAGE + + + // helper functions + // ---------------- + + // return the size of one line in a DIB with given width and depth: the + // point here is that as the scan lines need to be DWORD aligned so we may + // need to add some padding + static unsigned long GetLineSize(int width, int depth) + { + return ((width*depth + 31) & ~31) >> 3; + } + +private: + // common part of all ctors + void Init(); + + // free resources + void Free(); + + // initialize the contents from the provided DDB (Create() must have been + // already called) + bool CopyFromDDB(HBITMAP hbmp); + + + // the DIB section handle, 0 if invalid + HBITMAP m_handle; + + // NB: we could store only m_handle and not any of the other fields as + // we may always retrieve them from it using ::GetObject(), but we + // decide to still store them for efficiency concerns -- however if we + // don't have them from the very beginning (e.g. DIB constructed from a + // bitmap), we only retrieve them when necessary and so these fields + // should *never* be accessed directly, even from inside wxDIB code + + // function which must be called before accessing any members and which + // gets their values from m_handle, if not done yet + void DoGetObject() const; + + // pointer to DIB bits, may be NULL + void *m_data; + + // size and depth of the image + int m_width, + m_height, + m_depth; + + // in some cases we could be using a handle which we didn't create and in + // this case we shouldn't free it either -- this flag tell us if this is + // the case + bool m_ownsHandle; + + + // DIBs can't be copied + wxDIB(const wxDIB&); + wxDIB& operator=(const wxDIB&); +}; + +// ---------------------------------------------------------------------------- +// inline functions implementation +// ---------------------------------------------------------------------------- + +inline +void wxDIB::Init() +{ + m_handle = NULL; + m_ownsHandle = true; + + m_data = NULL; + + m_width = + m_height = + m_depth = 0; +} + +inline +void wxDIB::Free() +{ + if ( m_handle && m_ownsHandle ) + { + if ( !::DeleteObject(m_handle) ) + { + wxLogLastError(wxT("DeleteObject(hDIB)")); + } + + Init(); + } +} + +inline wxDIB::~wxDIB() +{ + Free(); +} + +#endif + // wxUSE_WXDIB + +#endif // _WX_MSW_DIB_H_ + diff --git a/lib/wxWidgets/include/wx/msw/dirdlg.h b/lib/wxWidgets/include/wx/msw/dirdlg.h new file mode 100644 index 0000000..e17af4b --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/dirdlg.h @@ -0,0 +1,39 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/dirdlg.h +// Purpose: wxDirDialog class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DIRDLG_H_ +#define _WX_DIRDLG_H_ + +class WXDLLIMPEXP_CORE wxDirDialog : public wxDirDialogBase +{ +public: + wxDirDialog(wxWindow *parent, + const wxString& message = wxASCII_STR(wxDirSelectorPromptStr), + const wxString& defaultPath = wxEmptyString, + long style = wxDD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxString& name = wxASCII_STR(wxDirDialogNameStr)); + + void SetPath(const wxString& path) wxOVERRIDE; + + virtual int ShowModal() wxOVERRIDE; + +private: + // The real implementations of ShowModal(), used for Windows versions + // before and since Vista. + int ShowSHBrowseForFolder(WXHWND owner); + int ShowIFileOpenDialog(WXHWND owner); + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDirDialog); +}; + +#endif + // _WX_DIRDLG_H_ diff --git a/lib/wxWidgets/include/wx/msw/dragimag.h b/lib/wxWidgets/include/wx/msw/dragimag.h new file mode 100644 index 0000000..28671c0 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/dragimag.h @@ -0,0 +1,244 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/dragimag.h +// Purpose: wxDragImage class: a kind of a cursor, that can cope +// with more sophisticated images +// Author: Julian Smart +// Modified by: +// Created: 08/04/99 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DRAGIMAG_H_ +#define _WX_DRAGIMAG_H_ + +#if wxUSE_DRAGIMAGE + +#include "wx/bitmap.h" +#include "wx/icon.h" +#include "wx/cursor.h" +#include "wx/treectrl.h" +#include "wx/listctrl.h" + +// If 1, use a simple wxCursor instead of ImageList_SetDragCursorImage +#define wxUSE_SIMPLER_DRAGIMAGE 0 + +/* + To use this class, create a wxDragImage when you start dragging, for example: + + void MyTreeCtrl::OnBeginDrag(wxTreeEvent& event) + { +#ifdef __WXMSW__ + ::UpdateWindow((HWND) GetHWND()); // We need to implement this in wxWidgets +#endif + + CaptureMouse(); + + m_dragImage = new wxDragImage(* this, itemId); + m_dragImage->BeginDrag(wxPoint(0, 0), this); + m_dragImage->Move(pt, this); + m_dragImage->Show(this); + ... + } + + In your OnMouseMove function, hide the image, do any display updating required, + then move and show the image again: + + void MyTreeCtrl::OnMouseMove(wxMouseEvent& event) + { + if (m_dragMode == MY_TREE_DRAG_NONE) + { + event.Skip(); + return; + } + + // Prevent screen corruption by hiding the image + if (m_dragImage) + m_dragImage->Hide(this); + + // Do some updating of the window, such as highlighting the drop target + ... + +#ifdef __WXMSW__ + if (updateWindow) + ::UpdateWindow((HWND) GetHWND()); +#endif + + // Move and show the image again + m_dragImage->Move(event.GetPosition(), this); + m_dragImage->Show(this); + } + + Eventually we end the drag and delete the drag image. + + void MyTreeCtrl::OnLeftUp(wxMouseEvent& event) + { + ... + + // End the drag and delete the drag image + if (m_dragImage) + { + m_dragImage->EndDrag(this); + delete m_dragImage; + m_dragImage = NULL; + } + ReleaseMouse(); + } +*/ + +/* + Notes for Unix version: + Can we simply use cursors instead, creating a cursor dynamically, setting it into the window + in BeginDrag, and restoring the old cursor in EndDrag? + For a really bog-standard implementation, we could simply use a normal dragging cursor + and ignore the image. +*/ + +/* + * wxDragImage + */ + +class WXDLLIMPEXP_CORE wxDragImage: public wxObject +{ +public: + + // Ctors & dtor + //////////////////////////////////////////////////////////////////////////// + + wxDragImage(); + wxDragImage(const wxBitmap& image, const wxCursor& cursor = wxNullCursor) + { + Init(); + + Create(image, cursor); + } + + wxDragImage(const wxIcon& image, const wxCursor& cursor = wxNullCursor) + { + Init(); + + Create(image, cursor); + } + + wxDragImage(const wxString& str, const wxCursor& cursor = wxNullCursor) + { + Init(); + + Create(str, cursor); + } + +#if wxUSE_TREECTRL + wxDragImage(const wxTreeCtrl& treeCtrl, wxTreeItemId& id) + { + Init(); + + Create(treeCtrl, id); + } +#endif + +#if wxUSE_LISTCTRL + wxDragImage(const wxListCtrl& listCtrl, long id) + { + Init(); + + Create(listCtrl, id); + } +#endif + + virtual ~wxDragImage(); + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + // Operations + //////////////////////////////////////////////////////////////////////////// + + // Create a drag image from a bitmap and optional cursor + bool Create(const wxBitmap& image, const wxCursor& cursor = wxNullCursor); + + // Create a drag image from an icon and optional cursor + bool Create(const wxIcon& image, const wxCursor& cursor = wxNullCursor); + + // Create a drag image from a string and optional cursor + bool Create(const wxString& str, const wxCursor& cursor = wxNullCursor); + +#if wxUSE_TREECTRL + // Create a drag image for the given tree control item + bool Create(const wxTreeCtrl& treeCtrl, wxTreeItemId& id); +#endif + +#if wxUSE_LISTCTRL + // Create a drag image for the given list control item + bool Create(const wxListCtrl& listCtrl, long id); +#endif + + // Begin drag. hotspot is the location of the drag position relative to the upper-left + // corner of the image. + bool BeginDrag(const wxPoint& hotspot, wxWindow* window, bool fullScreen = false, wxRect* rect = NULL); + + // Begin drag. hotspot is the location of the drag position relative to the upper-left + // corner of the image. This is full screen only. fullScreenRect gives the + // position of the window on the screen, to restrict the drag to. + bool BeginDrag(const wxPoint& hotspot, wxWindow* window, wxWindow* fullScreenRect); + + // End drag + bool EndDrag(); + + // Move the image: call from OnMouseMove. Pt is in window client coordinates if window + // is non-NULL, or in screen coordinates if NULL. + bool Move(const wxPoint& pt); + + // Show the image + bool Show(); + + // Hide the image + bool Hide(); + + // Implementation + //////////////////////////////////////////////////////////////////////////// + + // Initialize variables + void Init(); + + // Returns the native image list handle + WXHIMAGELIST GetHIMAGELIST() const { return m_hImageList; } + +#if !wxUSE_SIMPLER_DRAGIMAGE + // Returns the native image list handle for the cursor + WXHIMAGELIST GetCursorHIMAGELIST() const { return m_hCursorImageList; } +#endif + + // don't use in new code, use versions without hot spot parameter +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED_CONSTRUCTOR( wxDragImage(const wxBitmap& image, const wxCursor& cursor, const wxPoint& cursorHotspot) ); + wxDEPRECATED_CONSTRUCTOR( wxDragImage(const wxString& str, const wxCursor& cursor, const wxPoint& cursorHotspot) ); + wxDEPRECATED_CONSTRUCTOR( wxDragImage(const wxIcon& image, const wxCursor& cursor, const wxPoint& cursorHotspot) ); + wxDEPRECATED( bool Create(const wxBitmap& image, const wxCursor& cursor, const wxPoint& cursorHotspot) ); + wxDEPRECATED( bool Create(const wxIcon& image, const wxCursor& cursor, const wxPoint& cursorHotspot) ); + wxDEPRECATED( bool Create(const wxString& str, const wxCursor& cursor, const wxPoint& cursorHotspot) ); +#endif // WXWIN_COMPATIBILITY_2_8 + +protected: + WXHIMAGELIST m_hImageList; + +#if wxUSE_SIMPLER_DRAGIMAGE + wxCursor m_oldCursor; +#else + WXHIMAGELIST m_hCursorImageList; +#endif + + wxCursor m_cursor; +// wxPoint m_cursorHotspot; // Obsolete + wxPoint m_position; + wxWindow* m_window; + wxRect m_boundingRect; + bool m_fullScreen; + +private: + wxDECLARE_DYNAMIC_CLASS(wxDragImage); + wxDECLARE_NO_COPY_CLASS(wxDragImage); +}; + +#endif // wxUSE_DRAGIMAGE +#endif + // _WX_DRAGIMAG_H_ diff --git a/lib/wxWidgets/include/wx/msw/drive.ico b/lib/wxWidgets/include/wx/msw/drive.ico new file mode 100644 index 0000000..cac9011 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/drive.ico Binary files differ diff --git a/lib/wxWidgets/include/wx/msw/enhmeta.h b/lib/wxWidgets/include/wx/msw/enhmeta.h new file mode 100644 index 0000000..7b5934e --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/enhmeta.h @@ -0,0 +1,201 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/enhmeta.h +// Purpose: wxEnhMetaFile class for Win32 +// Author: Vadim Zeitlin +// Modified by: +// Created: 13.01.00 +// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_ENHMETA_H_ +#define _WX_MSW_ENHMETA_H_ + +#include "wx/defs.h" + +#if wxUSE_ENH_METAFILE + +#include "wx/dc.h" +#include "wx/gdiobj.h" + +#if wxUSE_DATAOBJ + #include "wx/dataobj.h" +#endif + +// ---------------------------------------------------------------------------- +// wxEnhMetaFile: encapsulation of Win32 HENHMETAFILE +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxEnhMetaFile : public wxGDIObject +{ +public: + wxEnhMetaFile(const wxString& file = wxEmptyString) : m_filename(file) + { Init(); } + wxEnhMetaFile(const wxEnhMetaFile& metafile) : wxGDIObject() + { Init(); Assign(metafile); } + wxEnhMetaFile& operator=(const wxEnhMetaFile& metafile) + { Free(); Assign(metafile); return *this; } + + virtual ~wxEnhMetaFile() + { Free(); } + + // display the picture stored in the metafile on the given DC + bool Play(wxDC *dc, wxRect *rectBound = NULL); + + // accessors + virtual bool IsOk() const wxOVERRIDE { return m_hMF != NULL; } + + wxSize GetSize() const; + int GetWidth() const { return GetSize().x; } + int GetHeight() const { return GetSize().y; } + + const wxString& GetFileName() const { return m_filename; } + + // copy the metafile to the clipboard: the width and height parameters are + // for backwards compatibility (with wxMetaFile) only, they are ignored by + // this method + bool SetClipboard(int width = 0, int height = 0); + + // Detach the HENHMETAFILE from this object, i.e. don't delete the handle + // in the dtor -- the caller is now responsible for doing this, e.g. using + // Free() method below. + WXHANDLE Detach() { WXHANDLE h = m_hMF; m_hMF = NULL; return h; } + + // Destroy the given HENHMETAFILE object. + static void Free(WXHANDLE handle); + + // implementation + WXHANDLE GetHENHMETAFILE() const { return m_hMF; } + void SetHENHMETAFILE(WXHANDLE hMF) { Free(); m_hMF = hMF; } + +protected: + void Init(); + void Free() { Free(m_hMF); } + void Assign(const wxEnhMetaFile& mf); + + // we don't use these functions (but probably should) but have to implement + // them as they're pure virtual in the base class + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + +private: + wxString m_filename; + WXHANDLE m_hMF; + + wxDECLARE_DYNAMIC_CLASS(wxEnhMetaFile); +}; + +// ---------------------------------------------------------------------------- +// wxEnhMetaFileDC: allows to create a wxEnhMetaFile +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxEnhMetaFileDC : public wxDC +{ +public: + // the ctor parameters specify the filename (empty for memory metafiles), + // the metafile picture size and the optional description/comment + wxEnhMetaFileDC(const wxString& filename = wxEmptyString, + int width = 0, int height = 0, + const wxString& description = wxEmptyString); + + // as above, but takes reference DC as first argument to take resolution, + // size, font metrics etc. from + explicit + wxEnhMetaFileDC(const wxDC& referenceDC, + const wxString& filename = wxEmptyString, + int width = 0, int height = 0, + const wxString& description = wxEmptyString); + + // obtain a pointer to the new metafile (caller should delete it) + wxEnhMetaFile *Close(); + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxEnhMetaFileDC); +}; + +#if wxUSE_DATAOBJ + +// ---------------------------------------------------------------------------- +// wxEnhMetaFileDataObject is a specialization of wxDataObject for enh metafile +// ---------------------------------------------------------------------------- + +// notice that we want to support both CF_METAFILEPICT and CF_ENHMETAFILE and +// so we derive from wxDataObject and not from wxDataObjectSimple +class WXDLLIMPEXP_CORE wxEnhMetaFileDataObject : public wxDataObject +{ +public: + // ctors + wxEnhMetaFileDataObject() { } + wxEnhMetaFileDataObject(const wxEnhMetaFile& metafile) + : m_metafile(metafile) { } + + // virtual functions which you may override if you want to provide data on + // demand only - otherwise, the trivial default versions will be used + virtual void SetMetafile(const wxEnhMetaFile& metafile) + { m_metafile = metafile; } + virtual wxEnhMetaFile GetMetafile() const + { return m_metafile; } + + // implement base class pure virtuals + virtual wxDataFormat GetPreferredFormat(Direction dir) const wxOVERRIDE; + virtual size_t GetFormatCount(Direction dir) const wxOVERRIDE; + virtual void GetAllFormats(wxDataFormat *formats, Direction dir) const wxOVERRIDE; + virtual size_t GetDataSize(const wxDataFormat& format) const wxOVERRIDE; + virtual bool GetDataHere(const wxDataFormat& format, void *buf) const wxOVERRIDE; + virtual bool SetData(const wxDataFormat& format, size_t len, + const void *buf) wxOVERRIDE; + +protected: + wxEnhMetaFile m_metafile; + + wxDECLARE_NO_COPY_CLASS(wxEnhMetaFileDataObject); +}; + + +// ---------------------------------------------------------------------------- +// wxEnhMetaFileSimpleDataObject does derive from wxDataObjectSimple which +// makes it more convenient to use (it can be used with wxDataObjectComposite) +// at the price of not supporting any more CF_METAFILEPICT but only +// CF_ENHMETAFILE +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxEnhMetaFileSimpleDataObject : public wxDataObjectSimple +{ +public: + // ctors + wxEnhMetaFileSimpleDataObject() : wxDataObjectSimple(wxDF_ENHMETAFILE) { } + wxEnhMetaFileSimpleDataObject(const wxEnhMetaFile& metafile) + : wxDataObjectSimple(wxDF_ENHMETAFILE), m_metafile(metafile) { } + + // virtual functions which you may override if you want to provide data on + // demand only - otherwise, the trivial default versions will be used + virtual void SetEnhMetafile(const wxEnhMetaFile& metafile) + { m_metafile = metafile; } + virtual wxEnhMetaFile GetEnhMetafile() const + { return m_metafile; } + + // implement base class pure virtuals + virtual size_t GetDataSize() const wxOVERRIDE; + virtual bool GetDataHere(void *buf) const wxOVERRIDE; + virtual bool SetData(size_t len, const void *buf) wxOVERRIDE; + + virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const wxOVERRIDE + { return GetDataSize(); } + virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), + void *buf) const wxOVERRIDE + { return GetDataHere(buf); } + virtual bool SetData(const wxDataFormat& WXUNUSED(format), + size_t len, const void *buf) wxOVERRIDE + { return SetData(len, buf); } + +protected: + wxEnhMetaFile m_metafile; + + wxDECLARE_NO_COPY_CLASS(wxEnhMetaFileSimpleDataObject); +}; + +#endif // wxUSE_DATAOBJ + +#endif // wxUSE_ENH_METAFILE + +#endif // _WX_MSW_ENHMETA_H_ diff --git a/lib/wxWidgets/include/wx/msw/evtloop.h b/lib/wxWidgets/include/wx/msw/evtloop.h new file mode 100644 index 0000000..5616631 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/evtloop.h @@ -0,0 +1,73 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/evtloop.h +// Purpose: wxEventLoop class for wxMSW port +// Author: Vadim Zeitlin +// Modified by: +// Created: 2004-07-31 +// Copyright: (c) 2003-2004 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_EVTLOOP_H_ +#define _WX_MSW_EVTLOOP_H_ + +#include "wx/dynarray.h" +#include "wx/msw/wrapwin.h" +#include "wx/window.h" +#include "wx/msw/evtloopconsole.h" // for wxMSWEventLoopBase + +// ---------------------------------------------------------------------------- +// wxEventLoop +// ---------------------------------------------------------------------------- + +WX_DECLARE_EXPORTED_OBJARRAY(MSG, wxMSGArray); + +class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxMSWEventLoopBase +{ +public: + wxGUIEventLoop() { } + + // process a single message: calls PreProcessMessage() before dispatching + // it + virtual void ProcessMessage(WXMSG *msg); + + // preprocess a message, return true if processed (i.e. no further + // dispatching required) + virtual bool PreProcessMessage(WXMSG *msg); + + // set the critical window: this is the window such that all the events + // except those to this window (and its children) stop to be processed + // (typical examples: assert or crash report dialog) + // + // calling this function with NULL argument restores the normal event + // handling + static void SetCriticalWindow(wxWindowMSW *win) { ms_winCritical = win; } + + // return true if there is no critical window or if this window is [a child + // of] the critical one + static bool AllowProcessing(wxWindowMSW *win) + { + return !ms_winCritical || IsChildOfCriticalWindow(win); + } + + // override/implement base class virtuals + virtual bool Dispatch() wxOVERRIDE; + virtual int DispatchTimeout(unsigned long timeout) wxOVERRIDE; + +protected: + virtual void OnNextIteration() wxOVERRIDE; + virtual void DoYieldFor(long eventsToProcess) wxOVERRIDE; + +private: + // check if the given window is a child of ms_winCritical (which must be + // non NULL) + static bool IsChildOfCriticalWindow(wxWindowMSW *win); + + // array of messages used for temporary storage by YieldFor() + wxMSGArray m_arrMSG; + + // critical window or NULL + static wxWindowMSW *ms_winCritical; +}; + +#endif // _WX_MSW_EVTLOOP_H_ diff --git a/lib/wxWidgets/include/wx/msw/evtloopconsole.h b/lib/wxWidgets/include/wx/msw/evtloopconsole.h new file mode 100644 index 0000000..a552225 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/evtloopconsole.h @@ -0,0 +1,72 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/evtloopconsole.h +// Purpose: wxConsoleEventLoop class for Windows +// Author: Vadim Zeitlin +// Modified by: +// Created: 2004-07-31 +// Copyright: (c) 2003-2004 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_EVTLOOPCONSOLE_H_ +#define _WX_MSW_EVTLOOPCONSOLE_H_ + +class WXDLLIMPEXP_BASE wxMSWEventLoopBase : public wxEventLoopManual +{ +public: + wxMSWEventLoopBase(); + virtual ~wxMSWEventLoopBase(); + + // implement base class pure virtuals + virtual bool Pending() const wxOVERRIDE; + virtual void WakeUp() wxOVERRIDE; + +#if wxUSE_THREADS + // MSW-specific method to wait for the termination of the specified (by its + // native handle) thread or any input message arriving (in GUI case). + // + // Return value is WAIT_OBJECT_0 if the thread terminated, WAIT_OBJECT_0+1 + // if a message arrived with anything else indicating an error. + WXDWORD MSWWaitForThread(WXHANDLE hThread); +#endif // wxUSE_THREADS + + // Return true if wake up was requested and not handled yet, i.e. if + // m_heventWake is signaled. + bool MSWIsWakeUpRequested(); + +protected: + // get the next message from queue and return true or return false if we + // got WM_QUIT or an error occurred + bool GetNextMessage(WXMSG *msg); + + // same as above but with a timeout and return value can be -1 meaning that + // time out expired in addition to true/false + int GetNextMessageTimeout(WXMSG *msg, unsigned long timeout); + +private: + // An auto-reset Win32 event which is signalled when we need to wake up the + // main thread waiting in GetNextMessage[Timeout](). + WXHANDLE m_heventWake; +}; + +#if wxUSE_CONSOLE_EVENTLOOP + +class WXDLLIMPEXP_BASE wxConsoleEventLoop : public wxMSWEventLoopBase +{ +public: + wxConsoleEventLoop() { } + + // override/implement base class virtuals + virtual bool Dispatch() wxOVERRIDE; + virtual int DispatchTimeout(unsigned long timeout) wxOVERRIDE; + + // Windows-specific function to process a single message + virtual void ProcessMessage(WXMSG *msg); + +protected: + virtual void DoYieldFor(long eventsToProcess) wxOVERRIDE; +}; + +#endif // wxUSE_CONSOLE_EVENTLOOP + +#endif // _WX_MSW_EVTLOOPCONSOLE_H_ diff --git a/lib/wxWidgets/include/wx/msw/fdrepdlg.h b/lib/wxWidgets/include/wx/msw/fdrepdlg.h new file mode 100644 index 0000000..e8d6eb4 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/fdrepdlg.h @@ -0,0 +1,61 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/fdrepdlg.h +// Purpose: wxFindReplaceDialog class +// Author: Markus Greither +// Modified by: 31.07.01: VZ: integrated into wxWidgets +// Created: 23/03/2001 +// Copyright: (c) Markus Greither +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_FDREPDLG_H_ +#define _WX_MSW_FDREPDLG_H_ + +// ---------------------------------------------------------------------------- +// wxFindReplaceDialog: dialog for searching / replacing text +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFindReplaceDialog : public wxFindReplaceDialogBase +{ +public: + // ctors and such + wxFindReplaceDialog() { Init(); } + wxFindReplaceDialog(wxWindow *parent, + wxFindReplaceData *data, + const wxString &title, + int style = 0); + + bool Create(wxWindow *parent, + wxFindReplaceData *data, + const wxString &title, + int style = 0); + + virtual ~wxFindReplaceDialog(); + + // implementation only from now on + + wxFindReplaceDialogImpl *GetImpl() const { return m_impl; } + + // override some base class virtuals + virtual bool Show(bool show = true) wxOVERRIDE; + virtual void SetTitle( const wxString& title) wxOVERRIDE; + virtual wxString GetTitle() const wxOVERRIDE; + +protected: + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; + virtual void DoGetClientSize(int *width, int *height) const wxOVERRIDE; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; + + void Init(); + + wxString m_title; + + wxFindReplaceDialogImpl *m_impl; + + wxDECLARE_DYNAMIC_CLASS(wxFindReplaceDialog); + wxDECLARE_NO_COPY_CLASS(wxFindReplaceDialog); +}; + +#endif // _WX_MSW_FDREPDLG_H_ diff --git a/lib/wxWidgets/include/wx/msw/file1.ico b/lib/wxWidgets/include/wx/msw/file1.ico new file mode 100644 index 0000000..f0a80d3 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/file1.ico Binary files differ diff --git a/lib/wxWidgets/include/wx/msw/filedlg.h b/lib/wxWidgets/include/wx/msw/filedlg.h new file mode 100644 index 0000000..b5eb76d --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/filedlg.h @@ -0,0 +1,93 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/filedlg.h +// Purpose: wxFileDialog class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FILEDLG_H_ +#define _WX_FILEDLG_H_ + +class wxFileDialogMSWData; + +//------------------------------------------------------------------------- +// wxFileDialog +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFileDialog: public wxFileDialogBase +{ +public: + wxFileDialog() { m_data = NULL; } + wxFileDialog(wxWindow *parent, + const wxString& message = wxASCII_STR(wxFileSelectorPromptStr), + const wxString& defaultDir = wxEmptyString, + const wxString& defaultFile = wxEmptyString, + const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + long style = wxFD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + const wxString& name = wxASCII_STR(wxFileDialogNameStr)); + virtual ~wxFileDialog(); + + virtual void GetPaths(wxArrayString& paths) const wxOVERRIDE; + virtual void GetFilenames(wxArrayString& files) const wxOVERRIDE; +#if wxABI_VERSION >= 30201 + bool AddShortcut(const wxString& directory, int flags = 0); +#endif // wxABI_VERSION >= 3.2.1 + virtual bool SupportsExtraControl() const wxOVERRIDE { return true; } + + virtual int ShowModal() wxOVERRIDE; + +protected: + + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; + virtual void DoCentre(int dir) wxOVERRIDE; + virtual void DoGetSize( int *width, int *height ) const wxOVERRIDE; + virtual void DoGetPosition( int *x, int *y ) const wxOVERRIDE; + +private: + // Allow it to call MSWOnXXX() functions below. + friend class wxFileDialogMSWData; + + // called when the dialog is created + void MSWOnInitDialogHook(WXHWND hwnd); + + // called when the dialog initialization is fully done + void MSWOnInitDone(WXHWND hDlg); + + // called when the currently selected file changes in the dialog + void MSWOnSelChange(const wxString& selectedFilename); + + // called when the currently selected type of files changes in the dialog + void MSWOnTypeChange(int nFilterIndex); + + // called when the dialog is accepted, i.e. a file is chosen in it + void MSWOnFileOK(); + + // The real implementation of ShowModal() using traditional common dialog + // functions. + int ShowCommFileDialog(WXHWND owner); + + // And another one using IFileDialog. + int ShowIFileDialog(WXHWND owner); + + // Get the data object, allocating it if necessary. + wxFileDialogMSWData& MSWData(); + + + wxArrayString m_fileNames; + + // Extra data, possibly null if not needed, use MSWData() to access it if + // it should be created on demand. + wxFileDialogMSWData* m_data; + + + wxDECLARE_DYNAMIC_CLASS(wxFileDialog); + wxDECLARE_NO_COPY_CLASS(wxFileDialog); +}; + +#endif // _WX_FILEDLG_H_ + diff --git a/lib/wxWidgets/include/wx/msw/floppy.ico b/lib/wxWidgets/include/wx/msw/floppy.ico new file mode 100644 index 0000000..4453a75 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/floppy.ico Binary files differ diff --git a/lib/wxWidgets/include/wx/msw/folder1.ico b/lib/wxWidgets/include/wx/msw/folder1.ico new file mode 100644 index 0000000..2994019 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/folder1.ico Binary files differ diff --git a/lib/wxWidgets/include/wx/msw/folder2.ico b/lib/wxWidgets/include/wx/msw/folder2.ico new file mode 100644 index 0000000..9a595b9 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/folder2.ico Binary files differ diff --git a/lib/wxWidgets/include/wx/msw/font.h b/lib/wxWidgets/include/wx/msw/font.h new file mode 100644 index 0000000..0f9768b --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/font.h @@ -0,0 +1,180 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/font.h +// Purpose: wxFont class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONT_H_ +#define _WX_FONT_H_ + +#include "wx/gdicmn.h" + +// ---------------------------------------------------------------------------- +// wxFont +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFont : public wxFontBase +{ +public: + // ctors and such + wxFont() { } + + wxFont(const wxFontInfo& info); + + wxFont(int size, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + Create(size, family, style, weight, underlined, face, encoding); + } + + bool Create(int size, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + return DoCreate(InfoFromLegacyParams(size, + family, + style, + weight, + underlined, + face, + encoding)); + } + + wxFont(const wxSize& pixelSize, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + (void)Create(pixelSize, family, style, weight, + underlined, face, encoding); + } + + wxFont(const wxNativeFontInfo& info, WXHFONT hFont = NULL) + { + Create(info, hFont); + } + + wxFont(const wxString& fontDesc); + + + bool Create(const wxSize& pixelSize, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + return DoCreate(InfoFromLegacyParams(pixelSize, + family, + style, + weight, + underlined, + face, + encoding)); + } + + bool Create(const wxNativeFontInfo& info, WXHFONT hFont = NULL); + + virtual ~wxFont(); + + // implement base class pure virtuals + virtual double GetFractionalPointSize() const wxOVERRIDE; + virtual wxSize GetPixelSize() const wxOVERRIDE; + virtual bool IsUsingSizeInPixels() const wxOVERRIDE; + virtual wxFontStyle GetStyle() const wxOVERRIDE; + virtual int GetNumericWeight() const wxOVERRIDE; + virtual bool GetUnderlined() const wxOVERRIDE; + virtual bool GetStrikethrough() const wxOVERRIDE; + virtual wxString GetFaceName() const wxOVERRIDE; + virtual wxFontEncoding GetEncoding() const wxOVERRIDE; + virtual const wxNativeFontInfo *GetNativeFontInfo() const wxOVERRIDE; + + virtual void SetFractionalPointSize(double pointSize) wxOVERRIDE; + virtual void SetPixelSize(const wxSize& pixelSize) wxOVERRIDE; + virtual void SetFamily(wxFontFamily family) wxOVERRIDE; + virtual void SetStyle(wxFontStyle style) wxOVERRIDE; + virtual void SetNumericWeight(int weight) wxOVERRIDE; + virtual bool SetFaceName(const wxString& faceName) wxOVERRIDE; + virtual void SetUnderlined(bool underlined) wxOVERRIDE; + virtual void SetStrikethrough(bool strikethrough) wxOVERRIDE; + virtual void SetEncoding(wxFontEncoding encoding) wxOVERRIDE; + + wxDECLARE_COMMON_FONT_METHODS(); + + virtual bool IsFixedWidth() const wxOVERRIDE; + + // MSW needs to modify the font object when the DPI of the window it + // is used with changes, this function can be used to do it. + // + // This method is not considered to be part of wxWidgets public API. + void WXAdjustToPPI(const wxSize& ppi); + + wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants ie: wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD") + wxFont(int size, + int family, + int style, + int weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); + } + + wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants ie: wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD") + wxFont(const wxSize& pixelSize, + int family, + int style, + int weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + (void)Create(pixelSize, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, + underlined, face, encoding); + } + + // implementation only from now on + // ------------------------------- + + virtual bool IsFree() const wxOVERRIDE; + virtual bool RealizeResource() wxOVERRIDE; + virtual WXHANDLE GetResourceHandle() const wxOVERRIDE; + virtual bool FreeResource(bool force = false) wxOVERRIDE; + + // for consistency with other wxMSW classes + WXHFONT GetHFONT() const; + +protected: + // Common helper of overloaded Create() methods. + bool DoCreate(const wxFontInfo& info); + + virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info) wxOVERRIDE; + virtual wxFontFamily DoGetFamily() const wxOVERRIDE; + + // implement wxObject virtuals which are used by AllocExclusive() + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxFont); +}; + +#endif // _WX_FONT_H_ diff --git a/lib/wxWidgets/include/wx/msw/fontdlg.h b/lib/wxWidgets/include/wx/msw/fontdlg.h new file mode 100644 index 0000000..38d0d46 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/fontdlg.h @@ -0,0 +1,38 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/fontdlg.h +// Purpose: wxFontDialog class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_FONTDLG_H_ +#define _WX_MSW_FONTDLG_H_ + +// ---------------------------------------------------------------------------- +// wxFontDialog +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFontDialog : public wxFontDialogBase +{ +public: + wxFontDialog() : wxFontDialogBase() { /* must be Create()d later */ } + wxFontDialog(wxWindow *parent) + : wxFontDialogBase(parent) { Create(parent); } + wxFontDialog(wxWindow *parent, const wxFontData& data) + : wxFontDialogBase(parent, data) { Create(parent, data); } + + virtual int ShowModal() wxOVERRIDE; + virtual void SetTitle(const wxString& title) wxOVERRIDE; + virtual wxString GetTitle() const wxOVERRIDE; + +protected: + wxString m_title; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxFontDialog); +}; + +#endif + // _WX_MSW_FONTDLG_H_ diff --git a/lib/wxWidgets/include/wx/msw/frame.h b/lib/wxWidgets/include/wx/msw/frame.h new file mode 100644 index 0000000..afee10d --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/frame.h @@ -0,0 +1,191 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/frame.h +// Purpose: wxFrame class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FRAME_H_ +#define _WX_FRAME_H_ + +#if wxUSE_TASKBARBUTTON +class WXDLLIMPEXP_FWD_CORE wxTaskBarButton; +#endif + +class WXDLLIMPEXP_CORE wxFrame : public wxFrameBase +{ +public: + // construction + wxFrame() { Init(); } + wxFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Init(); + + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + virtual ~wxFrame(); + + // implement base class pure virtuals + virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) wxOVERRIDE; + + // implementation only from now on + // ------------------------------- + + // event handlers + void OnSysColourChanged(wxSysColourChangedEvent& event); + + // Toolbar +#if wxUSE_TOOLBAR + virtual wxToolBar* CreateToolBar(long style = -1, + wxWindowID id = wxID_ANY, + const wxString& name = wxASCII_STR(wxToolBarNameStr)) wxOVERRIDE; +#endif // wxUSE_TOOLBAR + + // Status bar +#if wxUSE_STATUSBAR + virtual wxStatusBar* OnCreateStatusBar(int number = 1, + long style = wxSTB_DEFAULT_STYLE, + wxWindowID id = 0, + const wxString& name = wxASCII_STR(wxStatusLineNameStr)) wxOVERRIDE; + + // Hint to tell framework which status bar to use: the default is to use + // native one for the platforms which support it (Win32), the generic one + // otherwise + + // TODO: should this go into a wxFrameworkSettings class perhaps? + static void UseNativeStatusBar(bool useNative) + { m_useNativeStatusBar = useNative; } + static bool UsesNativeStatusBar() + { return m_useNativeStatusBar; } +#endif // wxUSE_STATUSBAR + + // event handlers + bool HandleSize(int x, int y, WXUINT flag); + bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); + + // tooltip management +#if wxUSE_TOOLTIPS + WXHWND GetToolTipCtrl() const { return m_hwndToolTip; } + void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; } +#endif // tooltips + + // override the base class function to handle iconized/maximized frames + virtual void SendSizeEvent(int flags = 0) wxOVERRIDE; + + virtual wxPoint GetClientAreaOrigin() const wxOVERRIDE; + + // override base class version to add menu bar accel processing + virtual bool MSWTranslateMessage(WXMSG *msg) wxOVERRIDE + { + return MSWDoTranslateMessage(this, msg); + } + + // window proc for the frames + virtual WXLRESULT MSWWindowProc(WXUINT message, + WXWPARAM wParam, + WXLPARAM lParam) wxOVERRIDE; + +#if wxUSE_MENUS + // get the currently active menu: this is the same as the frame menu for + // normal frames but is overridden by wxMDIParentFrame + virtual WXHMENU MSWGetActiveMenu() const { return m_hMenu; } + + virtual bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu) wxOVERRIDE; + virtual bool DoSendMenuOpenCloseEvent(wxEventType evtType, wxMenu* menu) wxOVERRIDE; + + // Look up the menu in the menu bar. + virtual wxMenu* MSWFindMenuFromHMENU(WXHMENU hMenu) wxOVERRIDE; +#endif // wxUSE_MENUS + +#if wxUSE_TASKBARBUTTON + // Return the taskbar button of the window. + // + // The pointer returned by this method belongs to the window and will be + // deleted when the window itself is, do not delete it yourself. May return + // NULL if the initialization of taskbar button failed. + wxTaskBarButton* MSWGetTaskBarButton(); +#endif // wxUSE_TASKBARBUTTON + +protected: + // common part of all ctors + void Init(); + + // override base class virtuals + virtual void DoGetClientSize(int *width, int *height) const wxOVERRIDE; + virtual void DoSetClientSize(int width, int height) wxOVERRIDE; + +#if wxUSE_MENUS_NATIVE + // perform MSW-specific action when menubar is changed + virtual void AttachMenuBar(wxMenuBar *menubar) wxOVERRIDE; + + // a plug in for MDI frame classes which need to do something special when + // the menubar is set + virtual void InternalSetMenuBar(); +#endif // wxUSE_MENUS_NATIVE + + // propagate our state change to all child frames + void IconizeChildFrames(bool bIconize); + + // the real implementation of MSWTranslateMessage(), also used by + // wxMDIChildFrame + bool MSWDoTranslateMessage(wxFrame *frame, WXMSG *msg); + + virtual bool IsMDIChild() const { return false; } + + // get default (wxWidgets) icon for the frame + virtual WXHICON GetDefaultIcon() const; + +#if wxUSE_TOOLBAR + virtual void PositionToolBar() wxOVERRIDE; +#endif // wxUSE_TOOLBAR + +#if wxUSE_STATUSBAR + virtual void PositionStatusBar() wxOVERRIDE; + + static bool m_useNativeStatusBar; +#endif // wxUSE_STATUSBAR + +#if wxUSE_MENUS + // frame menu, NULL if none + WXHMENU m_hMenu; + + // The number of currently opened menus: 0 initially, 1 when a top level + // menu is opened, 2 when its submenu is opened and so on. + int m_menuDepth; +#endif // wxUSE_MENUS + +private: +#if wxUSE_TOOLTIPS + WXHWND m_hwndToolTip; +#endif // tooltips + + // used by IconizeChildFrames(), see comments there + bool m_wasMinimized; + +#if wxUSE_TASKBARBUTTON + wxTaskBarButton* m_taskBarButton; +#endif + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxFrame); +}; + +#endif + // _WX_FRAME_H_ diff --git a/lib/wxWidgets/include/wx/msw/fswatcher.h b/lib/wxWidgets/include/wx/msw/fswatcher.h new file mode 100644 index 0000000..e41bee0 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/fswatcher.h @@ -0,0 +1,37 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/fswatcher.h +// Purpose: wxMSWFileSystemWatcher +// Author: Bartosz Bekier +// Created: 2009-05-26 +// Copyright: (c) 2009 Bartosz Bekier <bartosz.bekier@gmail.com> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FSWATCHER_MSW_H_ +#define _WX_FSWATCHER_MSW_H_ + +#include "wx/defs.h" + +#if wxUSE_FSWATCHER + +class WXDLLIMPEXP_BASE wxMSWFileSystemWatcher : public wxFileSystemWatcherBase +{ +public: + wxMSWFileSystemWatcher(); + + wxMSWFileSystemWatcher(const wxFileName& path, + int events = wxFSW_EVENT_ALL); + + // Override the base class function to provide a much more efficient + // implementation for it using the platform native support for watching the + // entire directory trees. + virtual bool AddTree(const wxFileName& path, int events = wxFSW_EVENT_ALL, + const wxString& filter = wxEmptyString) wxOVERRIDE; + +protected: + bool Init(); +}; + +#endif // wxUSE_FSWATCHER + +#endif /* _WX_FSWATCHER_MSW_H_ */ diff --git a/lib/wxWidgets/include/wx/msw/gauge.h b/lib/wxWidgets/include/wx/msw/gauge.h new file mode 100644 index 0000000..bd12b01 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/gauge.h @@ -0,0 +1,79 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/gauge.h +// Purpose: wxGauge implementation for MSW +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_GAUGE_H_ +#define _WX_MSW_GAUGE_H_ + +#if wxUSE_GAUGE + +extern WXDLLIMPEXP_DATA_CORE(const char) wxGaugeNameStr[]; + +// Group box +class WXDLLIMPEXP_CORE wxGauge : public wxGaugeBase +{ +public: + wxGauge() { } + + wxGauge(wxWindow *parent, + wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxGaugeNameStr)) + { + (void)Create(parent, id, range, pos, size, style, validator, name); + } + + virtual ~wxGauge(); + + bool Create(wxWindow *parent, + wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxGaugeNameStr)); + + // set gauge range/value + virtual void SetRange(int range) wxOVERRIDE; + virtual void SetValue(int pos) wxOVERRIDE; + + // overridden base class virtuals + virtual bool SetForegroundColour(const wxColour& col) wxOVERRIDE; + virtual bool SetBackgroundColour(const wxColour& col) wxOVERRIDE; + + virtual void Pulse() wxOVERRIDE; + + WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const wxOVERRIDE; + + // returns true if the platform should explicitly apply a theme border + virtual bool CanApplyThemeBorder() const wxOVERRIDE { return false; } + +protected: + virtual wxSize DoGetBestSize() const wxOVERRIDE; + +private: + // returns true if the control is currently in indeterminate (a.k.a. + // "marquee") mode + bool IsInIndeterminateMode() const; + + // switch to/from indeterminate mode + void SetIndeterminateMode(); + void SetDeterminateMode(); + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxGauge); +}; + +#endif // wxUSE_GAUGE + +#endif // _WX_MSW_GAUGE_H_ diff --git a/lib/wxWidgets/include/wx/msw/gccpriv.h b/lib/wxWidgets/include/wx/msw/gccpriv.h new file mode 100644 index 0000000..26f68d1 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/gccpriv.h @@ -0,0 +1,142 @@ +/* + Name: wx/msw/gccpriv.h + Purpose: MinGW/Cygwin definitions + Author: Vadim Zeitlin + Modified by: + Created: + Copyright: (c) Vadim Zeitlin + Licence: wxWindows Licence +*/ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#ifndef _WX_MSW_GCCPRIV_H_ +#define _WX_MSW_GCCPRIV_H_ + +#if defined(__MINGW32__) && !defined(__GNUWIN32__) + #define __GNUWIN32__ +#endif + +#if defined(__MINGW32__) + /* + Include the header defining __MINGW32_{MAJ,MIN}OR_VERSION but check + that UNICODE or _UNICODE is already defined, as _mingw.h relies on them + being set and we'd get weird compilation errors later if it is included + without them being defined, better give a clearer error right now. + */ + #if !defined(UNICODE) + #ifndef wxUSE_UNICODE + #error "wxUSE_UNICODE must be defined before including this header." + #endif + #if wxUSE_UNICODE + #error "UNICODE must be defined before including this header." + #endif + #endif + + /* + MinGW 5.3.0 (and presumably later) predefines _WIN32_WINNT and WINVER + in sdkddkver.h included from _mingw.h to very low (Windows 2000!) + values. We really want to predefine them ourselves instead, so do it + before including _mingw.h. + */ + #include "wx/msw/winver.h" + + #include <_mingw.h> + + /* + MinGW-w64 project provides compilers for both Win32 and Win64 but only + defines the same __MINGW32__ symbol for the former as MinGW32 toolchain + which is quite different (notably doesn't provide many SDK headers that + MinGW-w64 does include). So we define a separate symbol which, unlike + the predefined __MINGW64__, can be used to detect this toolchain in + both 32 and 64 bit builds. + + And define __MINGW32_TOOLCHAIN__ for consistency and also because it's + convenient as we often want to have some workarounds only for the (old) + MinGW32 but not (newer) MinGW-w64, which still predefines __MINGW32__. + */ + #ifdef __MINGW64_VERSION_MAJOR + #ifndef __MINGW64_TOOLCHAIN__ + #define __MINGW64_TOOLCHAIN__ + #endif + #else + #ifndef __MINGW32_TOOLCHAIN__ + #define __MINGW32_TOOLCHAIN__ + #endif + #endif + + #define wxCHECK_MINGW32_VERSION( major, minor ) \ + ( ( ( __MINGW32_MAJOR_VERSION > (major) ) \ + || ( __MINGW32_MAJOR_VERSION == (major) && __MINGW32_MINOR_VERSION >= (minor) ) ) ) +#else + #define wxCHECK_MINGW32_VERSION( major, minor ) (0) +#endif + +/* check for MinGW/Cygwin w32api version ( releases >= 0.5, only ) */ +#include <w32api.h> + +#if defined(__W32API_MAJOR_VERSION) && defined(__W32API_MINOR_VERSION) + #define wxCHECK_W32API_VERSION( major, minor ) \ + ( ( ( __W32API_MAJOR_VERSION > (major) ) \ + || ( __W32API_MAJOR_VERSION == (major) && __W32API_MINOR_VERSION >= (minor) ) ) ) +#else + #define wxCHECK_W32API_VERSION( major, minor ) (0) +#endif + +/* Cygwin 1.0 */ +#if defined(__CYGWIN__) && ((__GNUC__==2) && (__GNUC_MINOR__==9)) + #define __CYGWIN10__ +#endif + +/* + Traditional MinGW (but not MinGW-w64 nor TDM-GCC) omits many POSIX + functions from their headers when compiled with __STRICT_ANSI__ defined. + Unfortunately this means that they are not available when using -std=c++98 + (not very common) or -std=c++11 (much more so), but we still need them even + in this case. As the intention behind using -std=c++11 is probably to get + the new C++11 features and not disable the use of POSIX functions, we just + manually declare the functions we need in this case if necessary. + */ +#ifdef __MINGW32_TOOLCHAIN__ + /* + The macro below is used in wx/wxcrtbase.h included from C regex library + code, so make sure it compiles in non-C++ code too. + */ + #ifdef __cplusplus + #define wxEXTERNC extern "C" + #else + #define wxEXTERNC + #endif + + /* + This macro is somewhat unusual as it takes the list of parameters + inside parentheses and includes semicolon inside it as putting the + semicolon outside wouldn't do the right thing when this macro is empty. + */ + #define wxDECL_FOR_MINGW32_ALWAYS(rettype, func, params) \ + wxEXTERNC _CRTIMP rettype __cdecl __MINGW_NOTHROW func params ; + + #ifdef __STRICT_ANSI__ + #define wxNEEDS_STRICT_ANSI_WORKAROUNDS + + #define wxDECL_FOR_STRICT_MINGW32(rettype, func, params) \ + wxDECL_FOR_MINGW32_ALWAYS(rettype, func, params) + + /* + There is a bug resulting in a compilation error in MinGW standard + math.h header, see https://sourceforge.net/p/mingw/bugs/2250/, work + around it here because math.h is also included from several other + standard headers (e.g. <algorithm>) and we don't want to duplicate this + hack everywhere this happens. + */ + wxDECL_FOR_STRICT_MINGW32(double, _hypot, (double, double)) + #else + #define wxDECL_FOR_STRICT_MINGW32(rettype, func, params) + #endif +#else + #define wxDECL_FOR_MINGW32_ALWAYS(rettype, func, params) + #define wxDECL_FOR_STRICT_MINGW32(rettype, func, params) +#endif + +#endif + /* _WX_MSW_GCCPRIV_H_ */ diff --git a/lib/wxWidgets/include/wx/msw/gdiimage.h b/lib/wxWidgets/include/wx/msw/gdiimage.h new file mode 100644 index 0000000..2424b93 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/gdiimage.h @@ -0,0 +1,215 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/gdiimage.h +// Purpose: wxGDIImage class: base class for wxBitmap, wxIcon, wxCursor +// under MSW +// Author: Vadim Zeitlin +// Modified by: +// Created: 20.11.99 +// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// NB: this is a private header, it is not intended to be directly included by +// user code (but may be included from other, public, wxWin headers + +#ifndef _WX_MSW_GDIIMAGE_H_ +#define _WX_MSW_GDIIMAGE_H_ + +#include "wx/gdiobj.h" // base class +#include "wx/gdicmn.h" // wxBITMAP_TYPE_INVALID +#include "wx/list.h" + +class WXDLLIMPEXP_FWD_CORE wxGDIImageRefData; +class WXDLLIMPEXP_FWD_CORE wxGDIImageHandler; +class WXDLLIMPEXP_FWD_CORE wxGDIImage; + +WX_DECLARE_EXPORTED_LIST(wxGDIImageHandler, wxGDIImageHandlerList); + +// ---------------------------------------------------------------------------- +// wxGDIImageRefData: common data fields for all derived classes +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGDIImageRefData : public wxGDIRefData +{ +public: + wxGDIImageRefData() + { + m_width = m_height = m_depth = 0; + + m_scaleFactor = 1.0; + + m_handle = NULL; + } + + wxGDIImageRefData(const wxGDIImageRefData& data) : wxGDIRefData() + { + m_width = data.m_width; + m_height = data.m_height; + m_depth = data.m_depth; + + m_scaleFactor = data.m_scaleFactor; + + // can't copy handles like this, derived class copy ctor must do it! + m_handle = NULL; + } + + // accessors + virtual bool IsOk() const wxOVERRIDE { return m_handle != NULL; } + + void SetSize(int w, int h) { m_width = w; m_height = h; } + + // free the resources we allocated + virtual void Free() = 0; + + // for compatibility, the member fields are public + + // the size of the image + int m_width, m_height; + + // the depth of the image + int m_depth; + + // scale factor of the image + double m_scaleFactor; + + // the handle to it + union + { + WXHANDLE m_handle; // for untyped access + WXHBITMAP m_hBitmap; + WXHICON m_hIcon; + WXHCURSOR m_hCursor; + }; +}; + +// ---------------------------------------------------------------------------- +// wxGDIImage: this class supports GDI image handlers which may be registered +// dynamically and will be used for loading/saving the images in the specified +// format. It also falls back to wxImage if no appropriate image is found. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGDIImage : public wxGDIObject +{ +public: + // handlers list interface + static wxGDIImageHandlerList& GetHandlers() { return ms_handlers; } + + static void AddHandler(wxGDIImageHandler *handler); + static void InsertHandler(wxGDIImageHandler *handler); + static bool RemoveHandler(const wxString& name); + + static wxGDIImageHandler *FindHandler(const wxString& name); + static wxGDIImageHandler *FindHandler(const wxString& extension, long type); + static wxGDIImageHandler *FindHandler(long type); + + static void InitStandardHandlers(); + static void CleanUpHandlers(); + + // access to the ref data casted to the right type + wxGDIImageRefData *GetGDIImageData() const + { return (wxGDIImageRefData *)m_refData; } + + // accessors + WXHANDLE GetHandle() const + { return IsNull() ? NULL : GetGDIImageData()->m_handle; } + void SetHandle(WXHANDLE handle) + { AllocExclusive(); GetGDIImageData()->m_handle = handle; } + + int GetWidth() const { return IsNull() ? 0 : GetGDIImageData()->m_width; } + int GetHeight() const { return IsNull() ? 0 : GetGDIImageData()->m_height; } + int GetDepth() const { return IsNull() ? 0 : GetGDIImageData()->m_depth; } + + // allow setting and storing the scale factor + void SetScaleFactor(double scale); + double GetScaleFactor() const; + + // return the size divided by scale factor + wxSize GetDIPSize() const; + + // logical metrics accessors return the same thing as physical ones, just + // as in all the other ports without wxHAS_DPI_INDEPENDENT_PIXELS. + double GetLogicalWidth() const; + double GetLogicalHeight() const; + wxSize GetLogicalSize() const; + + wxSize GetSize() const + { + return IsNull() ? wxSize(0,0) : + wxSize(GetGDIImageData()->m_width, GetGDIImageData()->m_height); + } + +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_INLINE(void SetWidth(int w), AllocExclusive(); GetGDIImageData()->m_width = w; ) + wxDEPRECATED_INLINE(void SetHeight(int h), AllocExclusive(); GetGDIImageData()->m_height = h; ) + wxDEPRECATED_INLINE(void SetDepth(int d), AllocExclusive(); GetGDIImageData()->m_depth = d; ) + + wxDEPRECATED_INLINE(void SetSize(int w, int h), AllocExclusive(); GetGDIImageData()->SetSize(w, h); ) + wxDEPRECATED_INLINE(void SetSize(const wxSize& size), AllocExclusive(); GetGDIImageData()->SetSize(size.x, size.y); ) +#endif // WXWIN_COMPATIBILITY_3_0 + + // forward some of base class virtuals to wxGDIImageRefData + bool FreeResource(bool force = false) wxOVERRIDE; + virtual WXHANDLE GetResourceHandle() const wxOVERRIDE; + +protected: + // create the data for the derived class here + virtual wxGDIImageRefData *CreateData() const = 0; + + // implement the wxGDIObject method in terms of our, more specific, one + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE { return CreateData(); } + + // we can't [efficiently] clone objects of this class + virtual wxGDIRefData * + CloneGDIRefData(const wxGDIRefData *WXUNUSED(data)) const wxOVERRIDE + { + wxFAIL_MSG( wxT("must be implemented if used") ); + + return NULL; + } + + static wxGDIImageHandlerList ms_handlers; +}; + +// ---------------------------------------------------------------------------- +// wxGDIImageHandler: a class which knows how to load/save wxGDIImages. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGDIImageHandler : public wxObject +{ +public: + // ctor + wxGDIImageHandler() { m_type = wxBITMAP_TYPE_INVALID; } + wxGDIImageHandler(const wxString& name, + const wxString& ext, + wxBitmapType type) + : m_name(name), m_extension(ext), m_type(type) { } + + // accessors + void SetName(const wxString& name) { m_name = name; } + void SetExtension(const wxString& ext) { m_extension = ext; } + void SetType(wxBitmapType type) { m_type = type; } + + const wxString& GetName() const { return m_name; } + const wxString& GetExtension() const { return m_extension; } + wxBitmapType GetType() const { return m_type; } + + // real handler operations: to implement in derived classes + virtual bool Create(wxGDIImage *image, + const void* data, + wxBitmapType flags, + int width, int height, int depth = 1) = 0; + virtual bool Load(wxGDIImage *image, + const wxString& name, + wxBitmapType flags, + int desiredWidth, int desiredHeight) = 0; + virtual bool Save(const wxGDIImage *image, + const wxString& name, + wxBitmapType type) const = 0; + +protected: + wxString m_name; + wxString m_extension; + wxBitmapType m_type; +}; + +#endif // _WX_MSW_GDIIMAGE_H_ diff --git a/lib/wxWidgets/include/wx/msw/genrcdefs.h b/lib/wxWidgets/include/wx/msw/genrcdefs.h new file mode 100644 index 0000000..50ce8d7 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/genrcdefs.h @@ -0,0 +1,50 @@ +/* + * Name: wx/msw/genrcdefs.h + * Purpose: Emit preprocessor symbols into rcdefs.h for resource compiler + * Author: Mike Wetherell + * Copyright: (c) 2005 Mike Wetherell + * Licence: wxWindows licence + */ + +#define EMIT(line) line + +EMIT(#ifndef _WX_RCDEFS_H) +EMIT(#define _WX_RCDEFS_H) + +#ifdef _MSC_FULL_VER +#if _MSC_FULL_VER < 140040130 +EMIT(#define wxUSE_RC_MANIFEST 1) +#endif +#else +EMIT(#define wxUSE_RC_MANIFEST 1) +#endif + +#if defined _M_AMD64 || defined __x86_64__ +EMIT(#define WX_CPU_AMD64) +#endif + +#if defined _M_ARM || defined __arm__ +EMIT(#define WX_CPU_ARM) +#endif + +#if defined _M_ARM64 || defined __aarch64__ +EMIT(#define WX_CPU_ARM64) +#endif + +#if defined _M_IA64 || defined __ia64__ +EMIT(#define WX_CPU_IA64) +#endif + +#if defined _M_IX86 || defined _X86_ +EMIT(#define WX_CPU_X86) +#endif + +#ifdef _M_PPC +EMIT(#define WX_CPU_PPC) +#endif + +#ifdef _M_SH +EMIT(#define WX_CPU_SH) +#endif + +EMIT(#endif) diff --git a/lib/wxWidgets/include/wx/msw/glcanvas.h b/lib/wxWidgets/include/wx/msw/glcanvas.h new file mode 100644 index 0000000..35d5f18 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/glcanvas.h @@ -0,0 +1,182 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/glcanvas.h +// Purpose: wxGLCanvas, for using OpenGL with wxWidgets under Windows +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GLCANVAS_H_ +#define _WX_GLCANVAS_H_ + +#include "wx/palette.h" + +#include "wx/msw/wrapwin.h" + +#include <GL/gl.h> + +// ---------------------------------------------------------------------------- +// wxGLContext: OpenGL rendering context +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase +{ +public: + wxGLContext(wxGLCanvas *win, + const wxGLContext *other = NULL, + const wxGLContextAttrs *ctxAttrs = NULL); + virtual ~wxGLContext(); + + virtual bool SetCurrent(const wxGLCanvas& win) const wxOVERRIDE; + + HGLRC GetGLRC() const { return m_glContext; } + +protected: + HGLRC m_glContext; + +private: + wxDECLARE_CLASS(wxGLContext); +}; + +// ---------------------------------------------------------------------------- +// wxGLCanvas: OpenGL output window +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasBase +{ +public: + explicit // avoid implicitly converting a wxWindow* to wxGLCanvas + wxGLCanvas(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + + explicit + wxGLCanvas(wxWindow *parent, + wxWindowID id = wxID_ANY, + const int *attribList = NULL, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + + bool Create(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const int *attribList = NULL, + const wxPalette& palette = wxNullPalette); + + virtual ~wxGLCanvas(); + + // implement wxGLCanvasBase methods + virtual bool SwapBuffers() wxOVERRIDE; + + + // MSW-specific helpers + // -------------------- + + // get the HDC used for OpenGL rendering + HDC GetHDC() const { return m_hDC; } + + // Try to find pixel format matching the given attributes list for the + // specified HDC, return 0 on error, otherwise ppfd is filled in with the + // information from dispAttrs + static int FindMatchingPixelFormat(const wxGLAttributes& dispAttrs, + PIXELFORMATDESCRIPTOR* ppfd = NULL); + // Same as FindMatchingPixelFormat + static int ChooseMatchingPixelFormat(HDC hdc, const int *attribList, + PIXELFORMATDESCRIPTOR *pfd = NULL); + +#if wxUSE_PALETTE + // palette stuff + bool SetupPalette(const wxPalette& palette); + virtual wxPalette CreateDefaultPalette() wxOVERRIDE; + void OnQueryNewPalette(wxQueryNewPaletteEvent& event); + void OnPaletteChanged(wxPaletteChangedEvent& event); +#endif // wxUSE_PALETTE + + // deprecated methods using the implicit wxGLContext, associate the context + // explicitly with the window instead +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED( + wxGLCanvas(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const int *attribList = NULL, + const wxPalette& palette = wxNullPalette) + ); + + wxDEPRECATED( + wxGLCanvas(wxWindow *parent, + const wxGLContext *shared, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const int *attribList = NULL, + const wxPalette& palette = wxNullPalette) + ); + + wxDEPRECATED( + wxGLCanvas(wxWindow *parent, + const wxGLCanvas *shared, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const int *attribList = NULL, + const wxPalette& palette = wxNullPalette) + ); +#endif // WXWIN_COMPATIBILITY_2_8 + +protected: + // common part of all ctors + void Init(); + + // the real window creation function, Create() may reuse it twice as we may + // need to create an OpenGL window to query the available extensions and + // then potentially delete and recreate it with another pixel format + bool CreateWindow(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName); + + // set up the pixel format using the given attributes and palette + int DoSetup(PIXELFORMATDESCRIPTOR &pfd, const int *attribList); + + + // HDC for this window, we keep it all the time + HDC m_hDC; + +private: + wxDECLARE_EVENT_TABLE(); + wxDECLARE_CLASS(wxGLCanvas); +}; + +#endif // _WX_GLCANVAS_H_ diff --git a/lib/wxWidgets/include/wx/msw/hand.cur b/lib/wxWidgets/include/wx/msw/hand.cur new file mode 100644 index 0000000..e5a1fe7 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/hand.cur Binary files differ diff --git a/lib/wxWidgets/include/wx/msw/headerctrl.h b/lib/wxWidgets/include/wx/msw/headerctrl.h new file mode 100644 index 0000000..b099ccd --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/headerctrl.h @@ -0,0 +1,83 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/headerctrl.h +// Purpose: wxMSW native wxHeaderCtrl +// Author: Vadim Zeitlin +// Created: 2008-12-01 +// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_HEADERCTRL_H_ +#define _WX_MSW_HEADERCTRL_H_ + +#include "wx/compositewin.h" + +class wxMSWHeaderCtrl; + +// ---------------------------------------------------------------------------- +// wxHeaderCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxHeaderCtrl : public wxCompositeWindow<wxHeaderCtrlBase> +{ +public: + wxHeaderCtrl() + { + Init(); + } + + wxHeaderCtrl(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxHD_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxHeaderCtrlNameStr)) + { + Init(); + + Create(parent, id, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxHD_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxHeaderCtrlNameStr)); + + // Window style handling. + virtual void SetWindowStyleFlag(long style) wxOVERRIDE; + +protected: + // Override wxWindow methods which must be implemented by a new control. + virtual wxSize DoGetBestSize() const wxOVERRIDE; + +private: + // Implement base class pure virtuals. + virtual void DoSetCount(unsigned int count) wxOVERRIDE; + virtual unsigned int DoGetCount() const wxOVERRIDE; + virtual void DoUpdate(unsigned int idx) wxOVERRIDE; + + virtual void DoScrollHorz(int dx) wxOVERRIDE; + + virtual void DoSetColumnsOrder(const wxArrayInt& order) wxOVERRIDE; + virtual wxArrayInt DoGetColumnsOrder() const wxOVERRIDE; + + // Pure virtual method inherited from wxCompositeWindow. + virtual wxWindowList GetCompositeWindowParts() const wxOVERRIDE; + + // Common part of all ctors. + void Init(); + + // Events. + void OnSize(wxSizeEvent& event); + + // The native header control. + wxMSWHeaderCtrl* m_nativeControl; + friend class wxMSWHeaderCtrl; + + wxDECLARE_NO_COPY_CLASS(wxHeaderCtrl); +}; + +#endif // _WX_MSW_HEADERCTRL_H_ + diff --git a/lib/wxWidgets/include/wx/msw/helpbest.h b/lib/wxWidgets/include/wx/msw/helpbest.h new file mode 100644 index 0000000..394a2a4 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/helpbest.h @@ -0,0 +1,128 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/helpbest.h +// Purpose: Tries to load MS HTML Help, falls back to wxHTML upon failure +// Author: Mattia Barbon +// Modified by: +// Created: 02/04/2001 +// Copyright: (c) Mattia Barbon +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HELPBEST_H_ +#define _WX_HELPBEST_H_ + +#if wxUSE_HELP && wxUSE_MS_HTML_HELP \ + && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__) + +#include "wx/helpbase.h" +#include "wx/html/helpfrm.h" // for wxHF_DEFAULT_STYLE + +class WXDLLIMPEXP_HTML wxBestHelpController: public wxHelpControllerBase +{ +public: + wxBestHelpController(wxWindow* parentWindow = NULL, + int style = wxHF_DEFAULT_STYLE) + : wxHelpControllerBase(parentWindow), + m_helpControllerType(wxUseNone), + m_helpController(NULL), + m_style(style) + { + } + + virtual ~wxBestHelpController() { delete m_helpController; } + + // Must call this to set the filename + virtual bool Initialize(const wxString& file) wxOVERRIDE; + virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) wxOVERRIDE { return Initialize( file ); } + + // If file is "", reloads file given in Initialize + virtual bool LoadFile(const wxString& file = wxEmptyString) wxOVERRIDE + { + return m_helpController->LoadFile( GetValidFilename( file ) ); + } + + virtual bool DisplayContents() wxOVERRIDE + { + return m_helpController->DisplayContents(); + } + + virtual bool DisplaySection(int sectionNo) wxOVERRIDE + { + return m_helpController->DisplaySection( sectionNo ); + } + + virtual bool DisplaySection(const wxString& section) wxOVERRIDE + { + return m_helpController->DisplaySection( section ); + } + + virtual bool DisplayBlock(long blockNo) wxOVERRIDE + { + return m_helpController->DisplayBlock( blockNo ); + } + + virtual bool DisplayContextPopup(int contextId) wxOVERRIDE + { + return m_helpController->DisplayContextPopup( contextId ); + } + + virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos) wxOVERRIDE + { + return m_helpController->DisplayTextPopup( text, pos ); + } + + virtual bool KeywordSearch(const wxString& k, + wxHelpSearchMode mode = wxHELP_SEARCH_ALL) wxOVERRIDE + { + return m_helpController->KeywordSearch( k, mode ); + } + + virtual bool Quit() wxOVERRIDE + { + return m_helpController->Quit(); + } + + // Allows one to override the default settings for the help frame. + virtual void SetFrameParameters(const wxString& title, + const wxSize& size, + const wxPoint& pos = wxDefaultPosition, + bool newFrameEachTime = false) wxOVERRIDE + { + m_helpController->SetFrameParameters( title, size, pos, + newFrameEachTime ); + } + + // Obtains the latest settings used by the help frame and the help frame. + virtual wxFrame *GetFrameParameters(wxSize *size = NULL, + wxPoint *pos = NULL, + bool *newFrameEachTime = NULL) wxOVERRIDE + { + return m_helpController->GetFrameParameters( size, pos, + newFrameEachTime ); + } + + /// Set the window that can optionally be used for the help window's parent. + virtual void SetParentWindow(wxWindow* win) wxOVERRIDE { m_helpController->SetParentWindow(win); } + + /// Get the window that can optionally be used for the help window's parent. + virtual wxWindow* GetParentWindow() const wxOVERRIDE { return m_helpController->GetParentWindow(); } + +protected: + // Append/change extension if necessary. + wxString GetValidFilename(const wxString& file) const; + +protected: + enum HelpControllerType { wxUseNone, wxUseHtmlHelp, wxUseChmHelp }; + + HelpControllerType m_helpControllerType; + wxHelpControllerBase* m_helpController; + int m_style; + + wxDECLARE_DYNAMIC_CLASS(wxBestHelpController); + wxDECLARE_NO_COPY_CLASS(wxBestHelpController); +}; + +#endif // wxUSE_HELP && wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP + +#endif + // _WX_HELPBEST_H_ diff --git a/lib/wxWidgets/include/wx/msw/helpchm.h b/lib/wxWidgets/include/wx/msw/helpchm.h new file mode 100644 index 0000000..4db165d --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/helpchm.h @@ -0,0 +1,89 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/helpchm.h +// Purpose: Help system: MS HTML Help implementation +// Author: Julian Smart +// Modified by: +// Created: 16/04/2000 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_HELPCHM_H_ +#define _WX_MSW_HELPCHM_H_ + +#if wxUSE_MS_HTML_HELP + +#include "wx/helpbase.h" + +class WXDLLIMPEXP_CORE wxCHMHelpController : public wxHelpControllerBase +{ +public: + wxCHMHelpController(wxWindow* parentWindow = NULL): wxHelpControllerBase(parentWindow) { } + + // Must call this to set the filename + virtual bool Initialize(const wxString& file) wxOVERRIDE; + virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) wxOVERRIDE { return Initialize( file ); } + + // If file is "", reloads file given in Initialize + virtual bool LoadFile(const wxString& file = wxEmptyString) wxOVERRIDE; + virtual bool DisplayContents() wxOVERRIDE; + virtual bool DisplaySection(int sectionNo) wxOVERRIDE; + virtual bool DisplaySection(const wxString& section) wxOVERRIDE; + virtual bool DisplayBlock(long blockNo) wxOVERRIDE; + virtual bool DisplayContextPopup(int contextId) wxOVERRIDE; + virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos) wxOVERRIDE; + virtual bool KeywordSearch(const wxString& k, + wxHelpSearchMode mode = wxHELP_SEARCH_ALL) wxOVERRIDE; + virtual bool Quit() wxOVERRIDE; + + wxString GetHelpFile() const { return m_helpFile; } + + // helper of DisplayTextPopup(), also used in wxSimpleHelpProvider::ShowHelp + static bool ShowContextHelpPopup(const wxString& text, + const wxPoint& pos, + wxWindow *window); + +protected: + // get the name of the CHM file we use from our m_helpFile + wxString GetValidFilename() const; + + // Call HtmlHelp() with the provided parameters (both overloads do the same + // thing but allow to avoid casts in the calling code) and return false + // (but don't crash) if HTML help is unavailable + static bool CallHtmlHelp(wxWindow *win, const wxChar *str, + unsigned cmd, WXWPARAM param); + static bool CallHtmlHelp(wxWindow *win, const wxChar *str, + unsigned cmd, const void *param = NULL) + { + return CallHtmlHelp(win, str, cmd, reinterpret_cast<WXWPARAM>(param)); + } + + // even simpler wrappers using GetParentWindow() and GetValidFilename() as + // the first 2 HtmlHelp() parameters + bool CallHtmlHelp(unsigned cmd, WXWPARAM param) + { + return CallHtmlHelp(GetParentWindow(), GetValidFilename().t_str(), + cmd, param); + } + + bool CallHtmlHelp(unsigned cmd, const void *param = NULL) + { + return CallHtmlHelp(cmd, reinterpret_cast<WXWPARAM>(param)); + } + + // wrapper around CallHtmlHelp(HH_DISPLAY_TEXT_POPUP): only one of text and + // contextId parameters can be non-NULL/non-zero + static bool DoDisplayTextPopup(const wxChar *text, + const wxPoint& pos, + int contextId, + wxWindow *window); + + + wxString m_helpFile; + + wxDECLARE_DYNAMIC_CLASS(wxCHMHelpController); +}; + +#endif // wxUSE_MS_HTML_HELP + +#endif // _WX_MSW_HELPCHM_H_ diff --git a/lib/wxWidgets/include/wx/msw/helpwin.h b/lib/wxWidgets/include/wx/msw/helpwin.h new file mode 100644 index 0000000..82bd694 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/helpwin.h @@ -0,0 +1,55 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/helpwin.h +// Purpose: Help system: WinHelp implementation +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HELPWIN_H_ +#define _WX_HELPWIN_H_ + +#include "wx/wx.h" + +#if wxUSE_HELP + +#include "wx/helpbase.h" + +class WXDLLIMPEXP_CORE wxWinHelpController: public wxHelpControllerBase +{ + wxDECLARE_DYNAMIC_CLASS(wxWinHelpController); + +public: + wxWinHelpController(wxWindow* parentWindow = NULL): wxHelpControllerBase(parentWindow) {} + virtual ~wxWinHelpController() {} + + // Must call this to set the filename + virtual bool Initialize(const wxString& file) wxOVERRIDE; + virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) wxOVERRIDE { return Initialize( file ); } + + // If file is "", reloads file given in Initialize + virtual bool LoadFile(const wxString& file = wxEmptyString) wxOVERRIDE; + virtual bool DisplayContents() wxOVERRIDE; + virtual bool DisplaySection(int sectionNo) wxOVERRIDE; + virtual bool DisplaySection(const wxString& section) wxOVERRIDE { return KeywordSearch(section); } + virtual bool DisplayBlock(long blockNo) wxOVERRIDE; + virtual bool DisplayContextPopup(int contextId) wxOVERRIDE; + virtual bool KeywordSearch(const wxString& k, + wxHelpSearchMode mode = wxHELP_SEARCH_ALL) wxOVERRIDE; + virtual bool Quit() wxOVERRIDE; + + inline wxString GetHelpFile() const { return m_helpFile; } + +protected: + // Append extension if necessary. + wxString GetValidFilename(const wxString& file) const; + +private: + wxString m_helpFile; +}; + +#endif // wxUSE_HELP +#endif +// _WX_HELPWIN_H_ diff --git a/lib/wxWidgets/include/wx/msw/htmlhelp.h b/lib/wxWidgets/include/wx/msw/htmlhelp.h new file mode 100644 index 0000000..3e8a7ca --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/htmlhelp.h @@ -0,0 +1,465 @@ +/* + * wx/msw/htmlhelp.h + * Copyright 2004 Jacek Caban + * + * Originally written for the Wine project, and issued under + * the wxWindows licence by kind permission of the author. + * + * Licence: wxWindows licence + */ + +#ifndef __HTMLHELP_H__ +#define __HTMLHELP_H__ + +#define HH_DISPLAY_TOPIC 0x00 +#define HH_HELP_FINDER 0x00 +#define HH_DISPLAY_TOC 0x01 +#define HH_DISPLAY_INDEX 0x02 +#define HH_DISPLAY_SEARCH 0x03 +#define HH_SET_WIN_TYPE 0x04 +#define HH_GET_WIN_TYPE 0x05 +#define HH_GET_WIN_HANDLE 0x06 +#define HH_ENUM_INFO_TYPE 0x07 +#define HH_SET_INFO_TYPE 0x08 +#define HH_SYNC 0x09 +#define HH_RESERVED1 0x0A +#define HH_RESERVED2 0x0B +#define HH_RESERVED3 0x0C +#define HH_KEYWORD_LOOKUP 0x0D +#define HH_DISPLAY_TEXT_POPUP 0x0E +#define HH_HELP_CONTEXT 0x0F +#define HH_TP_HELP_CONTEXTMENU 0x10 +#define HH_TP_HELP_WM_HELP 0x11 +#define HH_CLOSE_ALL 0x12 +#define HH_ALINK_LOOKUP 0x13 +#define HH_GET_LAST_ERROR 0x14 +#define HH_ENUM_CATEGORY 0x15 +#define HH_ENUM_CATEGORY_IT 0x16 +#define HH_RESET_IT_FILTER 0x17 +#define HH_SET_INCLUSIVE_FILTER 0x18 +#define HH_SET_EXCLUSIVE_FILTER 0x19 +#define HH_INITIALIZE 0x1C +#define HH_UNINITIALIZE 0x1D +#define HH_PRETRANSLATEMESSAGE 0xFD +#define HH_SET_GLOBAL_PROPERTY 0xFC + +#define HHWIN_PROP_TAB_AUTOHIDESHOW 0x00000001 +#define HHWIN_PROP_ONTOP 0x00000002 +#define HHWIN_PROP_NOTITLEBAR 0x00000004 +#define HHWIN_PROP_NODEF_STYLES 0x00000008 +#define HHWIN_PROP_NODEF_EXSTYLES 0x00000010 +#define HHWIN_PROP_TRI_PANE 0x00000020 +#define HHWIN_PROP_NOTB_TEXT 0x00000040 +#define HHWIN_PROP_POST_QUIT 0x00000080 +#define HHWIN_PROP_AUTO_SYNC 0x00000100 +#define HHWIN_PROP_TRACKING 0x00000200 +#define HHWIN_PROP_TAB_SEARCH 0x00000400 +#define HHWIN_PROP_TAB_HISTORY 0x00000800 +#define HHWIN_PROP_TAB_FAVORITES 0x00001000 +#define HHWIN_PROP_CHANGE_TITLE 0x00002000 +#define HHWIN_PROP_NAV_ONLY_WIN 0x00004000 +#define HHWIN_PROP_NO_TOOLBAR 0x00008000 +#define HHWIN_PROP_MENU 0x00010000 +#define HHWIN_PROP_TAB_ADVSEARCH 0x00020000 +#define HHWIN_PROP_USER_POS 0x00040000 +#define HHWIN_PROP_TAB_CUSTOM1 0x00080000 +#define HHWIN_PROP_TAB_CUSTOM2 0x00100000 +#define HHWIN_PROP_TAB_CUSTOM3 0x00200000 +#define HHWIN_PROP_TAB_CUSTOM4 0x00400000 +#define HHWIN_PROP_TAB_CUSTOM5 0x00800000 +#define HHWIN_PROP_TAB_CUSTOM6 0x01000000 +#define HHWIN_PROP_TAB_CUSTOM7 0x02000000 +#define HHWIN_PROP_TAB_CUSTOM8 0x04000000 +#define HHWIN_PROP_TAB_CUSTOM9 0x08000000 +#define HHWIN_TB_MARGIN 0x10000000 + +#define HHWIN_PARAM_PROPERTIES 0x00000002 +#define HHWIN_PARAM_STYLES 0x00000004 +#define HHWIN_PARAM_EXSTYLES 0x00000008 +#define HHWIN_PARAM_RECT 0x00000010 +#define HHWIN_PARAM_NAV_WIDTH 0x00000020 +#define HHWIN_PARAM_SHOWSTATE 0x00000040 +#define HHWIN_PARAM_INFOTYPES 0x00000080 +#define HHWIN_PARAM_TB_FLAGS 0x00000100 +#define HHWIN_PARAM_EXPANSION 0x00000200 +#define HHWIN_PARAM_TABPOS 0x00000400 +#define HHWIN_PARAM_TABORDER 0x00000800 +#define HHWIN_PARAM_HISTORY_COUNT 0x00001000 +#define HHWIN_PARAM_CUR_TAB 0x00002000 + +#define HHWIN_BUTTON_EXPAND 0x00000002 +#define HHWIN_BUTTON_BACK 0x00000004 +#define HHWIN_BUTTON_FORWARD 0x00000008 +#define HHWIN_BUTTON_STOP 0x00000010 +#define HHWIN_BUTTON_REFRESH 0x00000020 +#define HHWIN_BUTTON_HOME 0x00000040 +#define HHWIN_BUTTON_BROWSE_FWD 0x00000080 +#define HHWIN_BUTTON_BROWSE_BCK 0x00000100 +#define HHWIN_BUTTON_NOTES 0x00000200 +#define HHWIN_BUTTON_CONTENTS 0x00000400 +#define HHWIN_BUTTON_SYNC 0x00000800 +#define HHWIN_BUTTON_OPTIONS 0x00001000 +#define HHWIN_BUTTON_PRINT 0x00002000 +#define HHWIN_BUTTON_INDEX 0x00004000 +#define HHWIN_BUTTON_SEARCH 0x00008000 +#define HHWIN_BUTTON_HISTORY 0x00010000 +#define HHWIN_BUTTON_FAVORITES 0x00020000 +#define HHWIN_BUTTON_JUMP1 0x00040000 +#define HHWIN_BUTTON_JUMP2 0x00080000 +#define HHWIN_BUTTON_ZOOM 0x00100000 +#define HHWIN_BUTTON_TOC_NEXT 0x00200000 +#define HHWIN_BUTTON_TOC_PREV 0x00400000 + +#define HHWIN_DEF_BUTTONS \ + (HHWIN_BUTTON_EXPAND | HHWIN_BUTTON_BACK | HHWIN_BUTTON_OPTIONS | HHWIN_BUTTON_PRINT) + +#define IDTB_EXPAND 200 +#define IDTB_CONTRACT 201 +#define IDTB_STOP 202 +#define IDTB_REFRESH 203 +#define IDTB_BACK 204 +#define IDTB_HOME 205 +#define IDTB_SYNC 206 +#define IDTB_PRINT 207 +#define IDTB_OPTIONS 208 +#define IDTB_FORWARD 209 +#define IDTB_NOTES 210 +#define IDTB_BROWSE_FWD 211 +#define IDTB_BROWSE_BACK 212 +#define IDTB_CONTENTS 213 +#define IDTB_INDEX 214 +#define IDTB_SEARCH 215 +#define IDTB_HISTORY 216 +#define IDTB_FAVORITES 217 +#define IDTB_JUMP1 218 +#define IDTB_JUMP2 219 +#define IDTB_CUSTOMIZE 221 +#define IDTB_ZOOM 222 +#define IDTB_TOC_NEXT 223 +#define IDTB_TOC_PREV 224 + +#define HHN_FIRST (0U-860U) +#define HHN_LAST (0U-879U) +#define HHN_NAVCOMPLETE HHN_FIRST +#define HHN_TRACK (HHN_FIRST-1) +#define HHN_WINDOW_CREATE (HHN_FIRST-2) + + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct tagHH_NOTIFY { + NMHDR hdr; + PCSTR pszurl; +} HH_NOTIFY; + +typedef struct tagHH_POPUPA { + int cbStruct; + HINSTANCE hinst; + UINT idString; + LPCSTR pszText; + POINT pt; + COLORREF clrForeground; + COLORREF clrBackground; + RECT rcMargins; + LPCSTR pszFont; +} HH_POPUPA; + +typedef struct tagHH_POPUPW { + int cbStruct; + HINSTANCE hinst; + UINT idString; + LPCWSTR pszText; + POINT pt; + COLORREF clrForeground; + COLORREF clrBackground; + RECT rcMargins; + LPCWSTR pszFont; +} HH_POPUPW; + +#ifdef _UNICODE +typedef HH_POPUPW HH_POPUP; +#else +typedef HH_POPUPA HH_POPUP; +#endif + +typedef struct tagHH_ALINKA { + int cbStruct; + BOOL fReserved; + LPCSTR pszKeywords; + LPCSTR pszUrl; + LPCSTR pszMsgText; + LPCSTR pszMsgTitle; + LPCSTR pszWindow; + BOOL fIndexOnFail; +} HH_ALINKA; + +typedef struct tagHH_ALINKW { + int cbStruct; + BOOL fReserved; + LPCWSTR pszKeywords; + LPCWSTR pszUrl; + LPCWSTR pszMsgText; + LPCWSTR pszMsgTitle; + LPCWSTR pszWindow; + BOOL fIndexOnFail; +} HH_ALINKW; + +#ifdef _UNICODE +typedef HH_ALINKW HH_ALINK; +typedef HH_ALINKW HH_AKLINK; +#else +typedef HH_ALINKA HH_ALINK; +typedef HH_ALINKA HH_AKLINK; +#endif + +enum { + HHWIN_NAVTYPE_TOC, + HHWIN_NAVTYPE_INDEX, + HHWIN_NAVTYPE_SEARCH, + HHWIN_NAVTYPE_FAVORITES, + HHWIN_NAVTYPE_HISTORY, + HHWIN_NAVTYPE_AUTHOR, + HHWIN_NAVTYPE_CUSTOM_FIRST = 11 +}; + +enum { + IT_INCLUSIVE, + IT_EXCLUSIVE, + IT_HIDDEN +}; + +typedef struct tagHH_ENUM_IT { + int cbStruct; + int iType; + LPCSTR pszCatName; + LPCSTR pszITName; + LPCSTR pszITDescription; +} HH_ENUM_IT, *PHH_ENUM_IT; + +typedef struct tagHH_ENUM_CAT { + int cbStruct; + LPCSTR pszCatName; + LPCSTR pszCatDescription; +} HH_ENUM_CAT, *PHH_ENUM_CAT; + +typedef struct tagHH_SET_INFOTYPE { + int cbStruct; + LPCSTR pszCatName; + LPCSTR pszInfoTypeName; +} HH_SET_INFOTYPE; + +typedef DWORD HH_INFOTYPE, *PHH_INFOTYPE; + +enum { + HHWIN_NAVTAB_TOP, + HHWIN_NAVTAB_LEFT, + HHWIN_NAVTAB_BOTTOM +}; + +#define HH_MAX_TABS 19 + +enum { + HH_TAB_CONTENTS, + HH_TAB_INDEX, + HH_TAB_SEARCH, + HH_TAB_FAVORITES, + HH_TAB_HISTORY, + HH_TAB_AUTHOR, + HH_TAB_CUSTOM_FIRST = 11, + HH_TAB_CUSTOM_LAST = HH_MAX_TABS +}; + +#define HH_MAX_TABS_CUSTOM (HH_TAB_CUSTOM_LAST-HH_TAB_CUSTOM_FIRST+1) +#define HH_FTS_DEFAULT_PROXIMITY -1 + +typedef struct tagHH_FTS_QUERYA { + int cbStruct; + BOOL fUniCodeStrings; + LPCSTR pszSearchQuery; + LONG iProximity; + BOOL fStemmedSearch; + BOOL fTitleOnly; + BOOL fExecute; + LPCSTR pszWindow; +} HH_FTS_QUERYA; + +typedef struct tagHH_FTS_QUERYW { + int cbStruct; + BOOL fUniCodeStrings; + LPCWSTR pszSearchQuery; + LONG iProximity; + BOOL fStemmedSearch; + BOOL fTitleOnly; + BOOL fExecute; + LPCWSTR pszWindow; +} HH_FTS_QUERYW; + +#ifdef _UNICODE +typedef HH_FTS_QUERYW HH_FTS_QUERY; +#else +typedef HH_FTS_QUERYA HH_FTS_QUERY; +#endif + +typedef struct tagHH_WINTYPEA { + int cbStruct; + BOOL fUniCodeStrings; + LPCSTR pszType; + DWORD fsValidMembers; + DWORD fsWinProperties; + LPCSTR pszCaption; + DWORD dwStyles; + DWORD dwExStyles; + RECT rcWindowPos; + int nShowState; + HWND hwndHelp; + HWND hwndCaller; + PHH_INFOTYPE paInfoTypes; + HWND hwndToolBar; + HWND hwndNavigation; + HWND hwndHTML; + int iNavWidth; + RECT rcHTML; + LPCSTR pszToc; + LPCSTR pszIndex; + LPCSTR pszFile; + LPCSTR pszHome; + DWORD fsToolBarFlags; + BOOL fNotExpanded; + int curNavType; + int tabpos; + int idNotify; + BYTE tabOrder[HH_MAX_TABS+1]; + int cHistory; + LPCSTR pszJump1; + LPCSTR pszJump2; + LPCSTR pszUrlJump1; + LPCSTR pszUrlJump2; + RECT rcMinSize; + int cbInfoTypes; + LPCSTR pszCustomTabs; +} HH_WINTYPEA, *PHH_WINTYPEA; + +typedef struct tagHH_WINTYPEW { + int cbStruct; + BOOL fUniCodeStrings; + LPCWSTR pszType; + DWORD fsValidMembers; + DWORD fsWinProperties; + LPCWSTR pszCaption; + DWORD dwStyles; + DWORD dwExStyles; + RECT rcWindowPos; + int nShowState; + HWND hwndHelp; + HWND hwndCaller; + PHH_INFOTYPE paInfoTypes; + HWND hwndToolBar; + HWND hwndNavigation; + HWND hwndHTML; + int iNavWidth; + RECT rcHTML; + LPCWSTR pszToc; + LPCWSTR pszIndex; + LPCWSTR pszFile; + LPCWSTR pszHome; + DWORD fsToolBarFlags; + BOOL fNotExpanded; + int curNavType; + int tabpos; + int idNotify; + BYTE tabOrder[HH_MAX_TABS+1]; + int cHistory; + LPCWSTR pszJump1; + LPCWSTR pszJump2; + LPCWSTR pszUrlJump1; + LPCWSTR pszUrlJump2; + RECT rcMinSize; + int cbInfoTypes; + LPCWSTR pszCustomTabs; +} HH_WINTYPEW, *PHH_WINTYPEW; + +#ifdef _UNICODE +typedef HH_WINTYPEW HH_WINTYPE; +#else +typedef HH_WINTYPEA HH_WINTYPE; +#endif + +enum { + HHACT_TAB_CONTENTS, + HHACT_TAB_INDEX, + HHACT_TAB_SEARCH, + HHACT_TAB_HISTORY, + HHACT_TAB_FAVORITES, + HHACT_EXPAND, + HHACT_CONTRACT, + HHACT_BACK, + HHACT_FORWARD, + HHACT_STOP, + HHACT_REFRESH, + HHACT_HOME, + HHACT_SYNC, + HHACT_OPTIONS, + HHACT_PRINT, + HHACT_HIGHLIGHT, + HHACT_CUSTOMIZE, + HHACT_JUMP1, + HHACT_JUMP2, + HHACT_ZOOM, + HHACT_TOC_NEXT, + HHACT_TOC_PREV, + HHACT_NOTES, + HHACT_LAST_ENUM +}; + +typedef struct tagHH_NTRACKA { + NMHDR hdr; + PCSTR pszCurUrl; + int idAction; + PHH_WINTYPEA phhWinType; +} HH_NTRACKA; + +typedef struct tagHH_NTRACKW { + NMHDR hdr; + PCSTR pszCurUrl; + int idAction; + PHH_WINTYPEW phhWinType; +} HH_NTRACKW; + +#ifdef _UNICODE +typedef HH_NTRACKW HH_NTRACK; +#else +typedef HH_NTRACKA HH_NTRACK; +#endif + +HWND WINAPI HtmlHelpA(HWND,LPCSTR,UINT,DWORD); +HWND WINAPI HtmlHelpA(HWND,LPCSTR,UINT,DWORD); +#define HtmlHelp WINELIB_NAME_AW(HtmlHelp) + +#define ATOM_HTMLHELP_API_ANSI (LPTSTR)14 +#define ATOM_HTMLHELP_API_UNICODE (LPTSTR)15 + +typedef enum tagHH_GPROPID { + HH_GPROPID_SINGLETHREAD = 1, + HH_GPROPID_TOOLBAR_MARGIN = 2, + HH_GPROPID_UI_LANGUAGE = 3, + HH_GPROPID_CURRENT_SUBSET = 4, + HH_GPROPID_CONTENT_LANGUAGE = 5 +} HH_GPROPID; + +#ifdef __WIDL_OAIDL_H + +typedef struct tagHH_GLOBAL_PROPERTY +{ + HH_GPROPID id; + VARIANT var; +} HH_GLOBAL_PROPERTY ; + +#endif /* __WIDL_OAIDL_H */ + +#ifdef __cplusplus +} +#endif + +#endif /* __HTMLHELP_H__ */ diff --git a/lib/wxWidgets/include/wx/msw/hyperlink.h b/lib/wxWidgets/include/wx/msw/hyperlink.h new file mode 100644 index 0000000..fe54820 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/hyperlink.h @@ -0,0 +1,64 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/hyperlink.h +// Purpose: Hyperlink control +// Author: Rickard Westerlund +// Created: 2010-08-04 +// Copyright: (c) 2010 wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_HYPERLINK_H_ +#define _WX_MSW_HYPERLINK_H_ + +#include "wx/generic/hyperlink.h" + +// ---------------------------------------------------------------------------- +// wxHyperlinkCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxHyperlinkCtrl : public wxGenericHyperlinkCtrl +{ +public: + // Default constructor (for two-step construction). + wxHyperlinkCtrl() { } + + // Constructor. + wxHyperlinkCtrl(wxWindow *parent, + wxWindowID id, + const wxString& label, const wxString& url, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxHL_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxHyperlinkCtrlNameStr)) + { + (void)Create(parent, id, label, url, pos, size, style, name); + } + + // Creation function (for two-step construction). + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, const wxString& url, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxHL_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxHyperlinkCtrlNameStr)); + + + // overridden base class methods + // ----------------------------- + + virtual void SetURL(const wxString &url) wxOVERRIDE; + + virtual void SetLabel(const wxString &label) wxOVERRIDE; + +protected: + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const wxOVERRIDE; + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + +private: + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS( wxHyperlinkCtrl ); +}; + +#endif // _WX_MSW_HYPERLINK_H_ diff --git a/lib/wxWidgets/include/wx/msw/icon.h b/lib/wxWidgets/include/wx/msw/icon.h new file mode 100644 index 0000000..294e457 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/icon.h @@ -0,0 +1,97 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/icon.h +// Purpose: wxIcon class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ICON_H_ +#define _WX_ICON_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/msw/gdiimage.h" + +// --------------------------------------------------------------------------- +// icon data +// --------------------------------------------------------------------------- + +// notice that although wxIconRefData inherits from wxBitmapRefData, it is not +// a valid wxBitmapRefData +class WXDLLIMPEXP_CORE wxIconRefData : public wxGDIImageRefData +{ +public: + wxIconRefData() { } + virtual ~wxIconRefData() { Free(); } + + virtual void Free() wxOVERRIDE; +}; + +// --------------------------------------------------------------------------- +// Icon +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxIcon : public wxGDIImage +{ +public: + // ctors + // default + wxIcon() { } + + // from raw data + wxIcon(const char bits[], int width, int height); + + // from XPM data + wxIcon(const char* const* data) { CreateIconFromXpm(data); } + // from resource/file + wxIcon(const wxString& name, + wxBitmapType type = wxICON_DEFAULT_TYPE, + int desiredWidth = -1, int desiredHeight = -1); + + wxIcon(const wxIconLocation& loc); + + virtual ~wxIcon(); + + virtual bool LoadFile(const wxString& name, + wxBitmapType type = wxICON_DEFAULT_TYPE, + int desiredWidth = -1, int desiredHeight = -1); + + bool CreateFromHICON(WXHICON icon); + + // implementation only from now on + wxIconRefData *GetIconData() const { return (wxIconRefData *)m_refData; } + +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_INLINE(void SetHICON(WXHICON icon), SetHandle((WXHANDLE)icon); ) +#endif // WXWIN_COMPATIBILITY_3_0 + + WXHICON GetHICON() const { return (WXHICON)GetHandle(); } + bool InitFromHICON(WXHICON icon, int width, int height, double scale = 1.0); + + // create from bitmap (which should have a mask unless it's monochrome): + // there shouldn't be any implicit bitmap -> icon conversion (i.e. no + // ctors, assignment operators...), but it's ok to have such function + void CopyFromBitmap(const wxBitmap& bmp); + +protected: + virtual wxGDIImageRefData *CreateData() const wxOVERRIDE + { + return new wxIconRefData; + } + + virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const wxOVERRIDE; + + // create from XPM data + void CreateIconFromXpm(const char* const* data); + +private: + wxDECLARE_DYNAMIC_CLASS(wxIcon); +}; + +#endif + // _WX_ICON_H_ diff --git a/lib/wxWidgets/include/wx/msw/imaglist.h b/lib/wxWidgets/include/wx/msw/imaglist.h new file mode 100644 index 0000000..4300609 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/imaglist.h @@ -0,0 +1,223 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/imaglist.h +// Purpose: wxImageList class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGLIST_H_ +#define _WX_IMAGLIST_H_ + +#include "wx/bitmap.h" + +// Eventually we'll make this a reference-counted wxGDIObject. For +// now, the app must take care of ownership issues. That is, the +// image lists must be explicitly deleted after the control(s) that uses them +// is (are) deleted, or when the app exits. +class WXDLLIMPEXP_CORE wxImageList : public wxObject +{ +public: + /* + * Public interface + */ + + wxImageList() { Init(); } + + // Creates an image list. + // Specify the width and height of the images in the list, + // whether there are masks associated with them (e.g. if creating images + // from icons), and the initial size of the list. + wxImageList(int width, int height, bool mask = true, int initialCount = 1) + { + Init(); + Create(width, height, mask, initialCount); + } + virtual ~wxImageList(); + + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + // Returns the number of images in the image list. + int GetImageCount() const; + + // Returns the size (same for all images) of the images in the list + bool GetSize(int index, int &width, int &height) const; + + // Returns the overall size + wxSize GetSize() const { return m_size; } + + // Operations + //////////////////////////////////////////////////////////////////////////// + + // Creates an image list + // width, height specify the size of the images in the list (all the same). + // mask specifies whether the images have masks or not. + // initialNumber is the initial number of images to reserve. + bool Create(int width, int height, bool mask = true, int initialNumber = 1); + + // Destroys the image list, Create() may then be called again later. + void Destroy(); + + // Adds a bitmap, and optionally a mask bitmap. + // Note that wxImageList creates *new* bitmaps, so you may delete + // 'bitmap' and 'mask' after calling Add. + int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap); + + // Adds a bitmap, using the specified colour to create the mask bitmap + // Note that wxImageList creates *new* bitmaps, so you may delete + // 'bitmap' after calling Add. + int Add(const wxBitmap& bitmap, const wxColour& maskColour); + + // Adds a bitmap and mask from an icon. + int Add(const wxIcon& icon); + + // Replaces a bitmap, optionally passing a mask bitmap. + // Note that wxImageList creates new bitmaps, so you may delete + // 'bitmap' and 'mask' after calling Replace. + bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap); + + // Replaces a bitmap and mask from an icon. + // You can delete 'icon' after calling Replace. + bool Replace(int index, const wxIcon& icon); + + // Removes the image at the given index. + bool Remove(int index); + + // Remove all images + bool RemoveAll(); + + // Draws the given image on a dc at the specified position. + // If 'solidBackground' is true, Draw sets the image list background + // colour to the background colour of the wxDC, to speed up + // drawing by eliminating masked drawing where possible. + bool Draw(int index, wxDC& dc, int x, int y, + int flags = wxIMAGELIST_DRAW_NORMAL, + bool solidBackground = false); + + // Get a bitmap + wxBitmap GetBitmap(int index) const; + + // Get an icon + wxIcon GetIcon(int index) const; + + // TODO: miscellaneous functionality +/* + wxIcon *MakeIcon(int index); + bool SetOverlayImage(int index, int overlayMask); + +*/ + + // TODO: Drag-and-drop related functionality. + +#if 0 + // Creates a new drag image by combining the given image (typically a mouse cursor image) + // with the current drag image. + bool SetDragCursorImage(int index, const wxPoint& hotSpot); + + // If successful, returns a pointer to the temporary image list that is used for dragging; + // otherwise, NULL. + // dragPos: receives the current drag position. + // hotSpot: receives the offset of the drag image relative to the drag position. + static wxImageList *GetDragImageList(wxPoint& dragPos, wxPoint& hotSpot); + + // Call this function to begin dragging an image. This function creates a temporary image list + // that is used for dragging. The image combines the specified image and its mask with the + // current cursor. In response to subsequent mouse move messages, you can move the drag image + // by using the DragMove member function. To end the drag operation, you can use the EndDrag + // member function. + bool BeginDrag(int index, const wxPoint& hotSpot); + + // Ends a drag operation. + bool EndDrag(); + + // Call this function to move the image that is being dragged during a drag-and-drop operation. + // This function is typically called in response to a mouse move message. To begin a drag + // operation, use the BeginDrag member function. + static bool DragMove(const wxPoint& point); + + // During a drag operation, locks updates to the window specified by lockWindow and displays + // the drag image at the position specified by point. + // The coordinates are relative to the window's upper left corner, so you must compensate + // for the widths of window elements, such as the border, title bar, and menu bar, when + // specifying the coordinates. + // If lockWindow is NULL, this function draws the image in the display context associated + // with the desktop window, and coordinates are relative to the upper left corner of the screen. + // This function locks all other updates to the given window during the drag operation. + // If you need to do any drawing during a drag operation, such as highlighting the target + // of a drag-and-drop operation, you can temporarily hide the dragged image by using the + // wxImageList::DragLeave function. + + // lockWindow: pointer to the window that owns the drag image. + // point: position at which to display the drag image. Coordinates are relative to the + // upper left corner of the window (not the client area). + + static bool DragEnter( wxWindow *lockWindow, const wxPoint& point ); + + // Unlocks the window specified by pWndLock and hides the drag image, allowing the + // window to be updated. + static bool DragLeave( wxWindow *lockWindow ); + + /* Here's roughly how you'd use these functions: + + 1) Starting to drag: + + wxImageList *dragImageList = new wxImageList(16, 16, true); + dragImageList->Add(myDragImage); // Provide an image to combine with the current cursor + dragImageList->BeginDrag(0, wxPoint(0, 0)); + wxShowCursor(false); // wxShowCursor not yet implemented in wxWin + myWindow->CaptureMouse(); + + 2) Dragging: + + // Called within mouse move event. Could also use dragImageList instead of assuming + // these are static functions. + // These two functions could possibly be combined into one, since DragEnter is + // a bit obscure. + wxImageList::DragMove(wxPoint(x, y)); // x, y are current cursor position + wxImageList::DragEnter(NULL, wxPoint(x, y)); // NULL assumes dragging across whole screen + + 3) Finishing dragging: + + dragImageList->EndDrag(); + myWindow->ReleaseMouse(); + wxShowCursor(true); +*/ + +#endif + + // Implementation + //////////////////////////////////////////////////////////////////////////// + + // Returns the native image list handle + WXHIMAGELIST GetHIMAGELIST() const { return m_hImageList; } + +protected: + WXHIMAGELIST m_hImageList; + wxSize m_size; + +private: + // Private helper used by GetImageListBitmaps(). + class wxMSWBitmaps; + + // Fills the provided output "bitmaps" object with the actual bitmaps we need + // to use with the native control. + void GetImageListBitmaps(wxMSWBitmaps& bitmaps, + const wxBitmap& bitmap, const wxBitmap& mask); + + bool m_useMask; + + void Init() + { + m_hImageList = NULL; + m_useMask = false; + } + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxImageList); +}; + +#endif + // _WX_IMAGLIST_H_ diff --git a/lib/wxWidgets/include/wx/msw/iniconf.h b/lib/wxWidgets/include/wx/msw/iniconf.h new file mode 100644 index 0000000..5f3f343 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/iniconf.h @@ -0,0 +1,109 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/iniconf.h +// Purpose: INI-file based wxConfigBase implementation +// Author: Vadim Zeitlin +// Modified by: +// Created: 27.07.98 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_INICONF_H_ +#define _WX_MSW_INICONF_H_ + +#include "wx/defs.h" + +#if wxUSE_CONFIG && wxUSE_INICONF + +// ---------------------------------------------------------------------------- +// wxIniConfig is a wxConfig implementation which uses MS Windows INI files to +// store the data. Because INI files don't really support arbitrary nesting of +// groups, we do the following: +// (1) in win.ini file we store all entries in the [vendor] section and +// the value group1/group2/key is mapped to the value group1_group2_key +// in this section, i.e. all path separators are replaced with underscore +// (2) in appname.ini file we map group1/group2/group3/key to the entry +// group2_group3_key in [group1] +// +// Of course, it might lead to indesirable results if '_' is also used in key +// names (i.e. group/key is the same as group_key) and also GetPath() result +// may be not what you would expect it to be. +// +// Another limitation: the keys and section names are never case-sensitive +// which might differ from wxFileConfig it it was compiled with +// wxCONFIG_CASE_SENSITIVE option. +// ---------------------------------------------------------------------------- + +// for this class, "local" file is the file appname.ini and the global file +// is the [vendor] subsection of win.ini (default for "vendor" is to be the +// same as appname). The file name (strAppName parameter) may, in fact, +// contain the full path to the file. If it doesn't, the file is searched for +// in the Windows directory. +class WXDLLIMPEXP_CORE wxIniConfig : public wxConfigBase +{ +public: + // ctor & dtor + // if strAppName doesn't contain the extension and is not an absolute path, + // ".ini" is appended to it. if strVendor is empty, it's taken to be the + // same as strAppName. + wxIniConfig(const wxString& strAppName = wxEmptyString, const wxString& strVendor = wxEmptyString, + const wxString& localFilename = wxEmptyString, const wxString& globalFilename = wxEmptyString, long style = wxCONFIG_USE_LOCAL_FILE); + virtual ~wxIniConfig(); + + // implement inherited pure virtual functions + virtual void SetPath(const wxString& strPath) wxOVERRIDE; + virtual const wxString& GetPath() const wxOVERRIDE; + + virtual bool GetFirstGroup(wxString& str, long& lIndex) const wxOVERRIDE; + virtual bool GetNextGroup (wxString& str, long& lIndex) const wxOVERRIDE; + virtual bool GetFirstEntry(wxString& str, long& lIndex) const wxOVERRIDE; + virtual bool GetNextEntry (wxString& str, long& lIndex) const wxOVERRIDE; + + virtual size_t GetNumberOfEntries(bool bRecursive = false) const wxOVERRIDE; + virtual size_t GetNumberOfGroups(bool bRecursive = false) const wxOVERRIDE; + + virtual bool HasGroup(const wxString& strName) const wxOVERRIDE; + virtual bool HasEntry(const wxString& strName) const wxOVERRIDE; + + // return true if the current group is empty + bool IsEmpty() const; + + virtual bool Flush(bool bCurrentOnly = false) wxOVERRIDE; + + virtual bool RenameEntry(const wxString& oldName, const wxString& newName) wxOVERRIDE; + virtual bool RenameGroup(const wxString& oldName, const wxString& newName) wxOVERRIDE; + + virtual bool DeleteEntry(const wxString& Key, bool bGroupIfEmptyAlso = true) wxOVERRIDE; + virtual bool DeleteGroup(const wxString& szKey) wxOVERRIDE; + virtual bool DeleteAll() wxOVERRIDE; + +protected: + // read/write + bool DoReadString(const wxString& key, wxString *pStr) const wxOVERRIDE; + bool DoReadLong(const wxString& key, long *plResult) const wxOVERRIDE; +#if wxUSE_BASE64 + bool DoReadBinary(const wxString& key, wxMemoryBuffer *buf) const wxOVERRIDE; +#endif // wxUSE_BASE64 + + bool DoWriteString(const wxString& key, const wxString& szValue) wxOVERRIDE; + bool DoWriteLong(const wxString& key, long lValue) wxOVERRIDE; +#if wxUSE_BASE64 + bool DoWriteBinary(const wxString& key, const wxMemoryBuffer& buf) wxOVERRIDE; +#endif // wxUSE_BASE64 + +private: + // helpers + wxString GetPrivateKeyName(const wxString& szKey) const; + wxString GetKeyName(const wxString& szKey) const; + + wxString m_strLocalFilename; // name of the private INI file + wxString m_strGroup, // current group in appname.ini file + m_strPath; // the rest of the path (no trailing '_'!) + + wxDECLARE_NO_COPY_CLASS(wxIniConfig); + wxDECLARE_ABSTRACT_CLASS(wxIniConfig); +}; + +#endif // wxUSE_CONFIG && wxUSE_INICONF + +#endif // _WX_MSW_INICONF_H_ diff --git a/lib/wxWidgets/include/wx/msw/init.h b/lib/wxWidgets/include/wx/msw/init.h new file mode 100644 index 0000000..ed136f6 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/init.h @@ -0,0 +1,63 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/init.h +// Purpose: Windows-specific wxEntry() overload +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_INIT_H_ +#define _WX_MSW_INIT_H_ + +// ---------------------------------------------------------------------------- +// Windows-specific wxEntry() overload and wxIMPLEMENT_WXWIN_MAIN definition +// ---------------------------------------------------------------------------- + +// wxEntry() overload using the command line for the current process, instead +// of argc/argv provided by the CRT. This is only really useful when using +// Unicode with a compiler not providing wmain() or similar entry point, but is +// always provided for consistency. +extern int WXDLLIMPEXP_BASE wxEntry(); + +#if wxUSE_GUI + +// we need HINSTANCE declaration to define WinMain() +#include "wx/msw/wrapwin.h" + +#ifndef SW_SHOWNORMAL + #define SW_SHOWNORMAL 1 +#endif + +// WinMain() is always ANSI, even in Unicode build. +typedef char *wxCmdLineArgType; + +// Windows-only overloads of wxEntry() and wxEntryStart() which take the +// parameters passed to WinMain() instead of those passed to main() +extern WXDLLIMPEXP_CORE bool + wxEntryStart(HINSTANCE hInstance, + HINSTANCE hPrevInstance = NULL, + wxCmdLineArgType pCmdLine = NULL, + int nCmdShow = SW_SHOWNORMAL); + +extern WXDLLIMPEXP_CORE int + wxEntry(HINSTANCE hInstance, + HINSTANCE hPrevInstance = NULL, + wxCmdLineArgType pCmdLine = NULL, + int nCmdShow = SW_SHOWNORMAL); + +#define wxIMPLEMENT_WXWIN_MAIN \ + extern "C" int WINAPI WinMain(HINSTANCE hInstance, \ + HINSTANCE hPrevInstance, \ + wxCmdLineArgType lpCmdLine, \ + int nCmdShow) \ + { \ + wxDISABLE_DEBUG_SUPPORT(); \ + \ + return wxEntry(hInstance, hPrevInstance, lpCmdLine, nCmdShow); \ + } + +#endif // wxUSE_GUI + +#endif // _WX_MSW_INIT_H_ diff --git a/lib/wxWidgets/include/wx/msw/joystick.h b/lib/wxWidgets/include/wx/msw/joystick.h new file mode 100644 index 0000000..6bcfa7b --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/joystick.h @@ -0,0 +1,95 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/joystick.h +// Purpose: wxJoystick class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_JOYSTICK_H_ +#define _WX_JOYSTICK_H_ + +#include "wx/event.h" + +class wxJoystickThread; + +class WXDLLIMPEXP_ADV wxJoystick: public wxObject +{ + wxDECLARE_DYNAMIC_CLASS(wxJoystick); +public: + /* + * Public interface + */ + + wxJoystick(int joystick = wxJOYSTICK1); + virtual ~wxJoystick(); + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + wxPoint GetPosition() const; + int GetPosition(unsigned axis) const; + bool GetButtonState(unsigned button) const; + int GetZPosition() const; + int GetButtonState() const; + int GetPOVPosition() const; + int GetPOVCTSPosition() const; + int GetRudderPosition() const; + int GetUPosition() const; + int GetVPosition() const; + int GetMovementThreshold() const; + void SetMovementThreshold(int threshold) ; + + // Capabilities + //////////////////////////////////////////////////////////////////////////// + + static int GetNumberJoysticks(); + + bool IsOk() const; // Checks that the joystick is functioning + int GetManufacturerId() const ; + int GetProductId() const ; + wxString GetProductName() const ; + int GetXMin() const; + int GetYMin() const; + int GetZMin() const; + int GetXMax() const; + int GetYMax() const; + int GetZMax() const; + int GetNumberButtons() const; + int GetNumberAxes() const; + int GetMaxButtons() const; + int GetMaxAxes() const; + int GetPollingMin() const; + int GetPollingMax() const; + int GetRudderMin() const; + int GetRudderMax() const; + int GetUMin() const; + int GetUMax() const; + int GetVMin() const; + int GetVMax() const; + + bool HasRudder() const; + bool HasZ() const; + bool HasU() const; + bool HasV() const; + bool HasPOV() const; + bool HasPOV4Dir() const; + bool HasPOVCTS() const; + + // Operations + //////////////////////////////////////////////////////////////////////////// + + // pollingFreq = 0 means that movement events are sent when above the threshold. + // If pollingFreq > 0, events are received every this many milliseconds. + bool SetCapture(wxWindow* win, int pollingFreq = 0); + bool ReleaseCapture(); + +protected: + int m_joystick; + wxJoystickThread* m_thread; +}; + +#endif + // _WX_JOYSTICK_H_ diff --git a/lib/wxWidgets/include/wx/msw/libraries.h b/lib/wxWidgets/include/wx/msw/libraries.h new file mode 100644 index 0000000..50282ce --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/libraries.h @@ -0,0 +1,30 @@ +/* + * Name: wx/msw/libraries.h + * Purpose: Pragmas for linking libs conditionally + * Author: Michael Wetherell + * Modified by: + * Copyright: (c) 2005 Michael Wetherell + * Licence: wxWindows licence + */ + +#ifndef _WX_MSW_LIBRARIES_H_ +#define _WX_MSW_LIBRARIES_H_ + +/* + * Notes: + * + * In general the preferred place to add libs is in the bakefiles. This file + * can be used where libs must be added conditionally, for those compilers that + * support a way to do that. + */ + +#if defined __VISUALC__ && wxUSE_ACCESSIBILITY +#pragma comment(lib, "oleacc") +#endif + +#if defined __VISUALC__ && wxUSE_UXTHEME +#pragma comment(lib, "uxtheme") +#endif + + +#endif /* _WX_MSW_LIBRARIES_H_ */ diff --git a/lib/wxWidgets/include/wx/msw/listbox.h b/lib/wxWidgets/include/wx/msw/listbox.h new file mode 100644 index 0000000..88eff30 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/listbox.h @@ -0,0 +1,219 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/listbox.h +// Purpose: wxListBox class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LISTBOX_H_ +#define _WX_LISTBOX_H_ + +#if wxUSE_LISTBOX + +// ---------------------------------------------------------------------------- +// simple types +// ---------------------------------------------------------------------------- + +#if wxUSE_OWNER_DRAWN + class WXDLLIMPEXP_FWD_CORE wxOwnerDrawn; + + // define the array of list box items + #include "wx/dynarray.h" + + WX_DEFINE_EXPORTED_ARRAY_PTR(wxOwnerDrawn *, wxListBoxItemsArray); +#endif // wxUSE_OWNER_DRAWN + +// forward declaration for GetSelections() +class WXDLLIMPEXP_FWD_BASE wxArrayInt; + +// ---------------------------------------------------------------------------- +// List box control +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase +{ +public: + // ctors and such + wxListBox() { Init(); } + wxListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)) + { + Init(); + + Create(parent, id, pos, size, n, choices, style, validator, name); + } + wxListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)) + { + Init(); + + Create(parent, id, pos, size, choices, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + + virtual ~wxListBox(); + + virtual unsigned int GetCount() const wxOVERRIDE; + virtual wxString GetString(unsigned int n) const wxOVERRIDE; + virtual void SetString(unsigned int n, const wxString& s) wxOVERRIDE; + virtual int FindString(const wxString& s, bool bCase = false) const wxOVERRIDE; + + virtual bool IsSelected(int n) const wxOVERRIDE; + virtual int GetSelection() const wxOVERRIDE; + virtual int GetSelections(wxArrayInt& aSelections) const wxOVERRIDE; + + // return the index of the item at this position or wxNOT_FOUND + int HitTest(const wxPoint& pt) const { return DoHitTestList(pt); } + int HitTest(wxCoord x, wxCoord y) const { return DoHitTestList(wxPoint(x, y)); } + + virtual void EnsureVisible(int n) wxOVERRIDE; + + virtual int GetTopItem() const wxOVERRIDE; + virtual int GetCountPerPage() const wxOVERRIDE; + + // ownerdrawn wxListBox and wxCheckListBox support +#if wxUSE_OWNER_DRAWN + // override base class virtuals + virtual bool SetFont(const wxFont &font) wxOVERRIDE; + + bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item) wxOVERRIDE; + bool MSWOnDraw(WXDRAWITEMSTRUCT *item) wxOVERRIDE; + + // plug-in for derived classes + virtual wxOwnerDrawn *CreateLboxItem(size_t n); + + // allows to get the item and use SetXXX functions to set it's appearance + wxOwnerDrawn *GetItem(size_t n) const { return m_aItems[n]; } + + // get the index of the given item + int GetItemIndex(wxOwnerDrawn *item) const { return m_aItems.Index(item); } + + // get rect of the given item index + bool GetItemRect(size_t n, wxRect& rect) const; + + // redraw the given item + bool RefreshItem(size_t n); +#endif // wxUSE_OWNER_DRAWN + + // Windows-specific code to update the horizontal extent of the listbox, if + // necessary. If s is non-empty, the horizontal extent is increased to the + // length of this string if it's currently too short, otherwise the maximum + // extent of all strings is used. In any case calls InvalidateBestSize() + virtual void SetHorizontalExtent(const wxString& s = wxEmptyString); + + // This is a wrapper for LB_SETTABSTOPS message and takes tab stops in + // dialog units, with the same conventions as LB_SETTABSTOPS uses. + virtual bool MSWSetTabStops(const wxVector<int>& tabStops); + + // Windows callbacks + bool MSWCommand(WXUINT param, WXWORD id) wxOVERRIDE; + WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const wxOVERRIDE; + + // under XP when using "transition effect for menus and tooltips" if we + // return true for WM_PRINTCLIENT here then it causes noticeable slowdown + virtual bool MSWShouldPropagatePrintChild() wxOVERRIDE + { + return false; + } + + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL) + { + return GetCompositeControlsDefaultAttributes(variant); + } + + // returns true if the platform should explicitly apply a theme border + virtual bool CanApplyThemeBorder() const wxOVERRIDE { return false; } + + virtual void OnInternalIdle() wxOVERRIDE; + +protected: + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + + virtual void DoClear() wxOVERRIDE; + virtual void DoDeleteOneItem(unsigned int n) wxOVERRIDE; + + virtual void DoSetSelection(int n, bool select) wxOVERRIDE; + + virtual int DoInsertItems(const wxArrayStringsAdapter& items, + unsigned int pos, + void **clientData, wxClientDataType type) wxOVERRIDE; + + virtual void DoSetFirstItem(int n) wxOVERRIDE; + virtual void DoSetItemClientData(unsigned int n, void* clientData) wxOVERRIDE; + virtual void* DoGetItemClientData(unsigned int n) const wxOVERRIDE; + + // this can't be called DoHitTest() because wxWindow already has this method + virtual int DoHitTestList(const wxPoint& point) const; + + // This is a hook for wxCheckListBox, which uses it to add the checkbox + // width to the item width and to make it at least as tall as the checkbox. + virtual wxSize MSWGetFullItemSize(int w, int h) const + { + return wxSize(w, h); + } + + virtual void MSWUpdateFontOnDPIChange(const wxSize& newDPI) wxOVERRIDE; + + // free memory (common part of Clear() and dtor) + void Free(); + + unsigned int m_noItems; + +#if wxUSE_OWNER_DRAWN + // control items + wxListBoxItemsArray m_aItems; +#endif + +private: + // common part of all ctors + void Init(); + + // call this when items are added to or deleted from the listbox or an + // items text changes + void MSWOnItemsChanged(); + + // flag indicating whether the max horizontal extent should be updated, + // i.e. if we need to call SetHorizontalExtent() from OnInternalIdle() + bool m_updateHorizontalExtent; + + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxListBox); +}; + +#endif // wxUSE_LISTBOX + +#endif + // _WX_LISTBOX_H_ diff --git a/lib/wxWidgets/include/wx/msw/listctrl.h b/lib/wxWidgets/include/wx/msw/listctrl.h new file mode 100644 index 0000000..f796132 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/listctrl.h @@ -0,0 +1,469 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/listctrl.h +// Purpose: wxListCtrl class +// Author: Julian Smart +// Modified by: Agron Selimaj +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LISTCTRL_H_ +#define _WX_LISTCTRL_H_ + +#include "wx/textctrl.h" +#include "wx/dynarray.h" +#include "wx/vector.h" + +class wxMSWListItemData; +class wxMSWListHeaderCustomDraw; + +// define this symbol to indicate the availability of SetColumnsOrder() and +// related functions +#define wxHAS_LISTCTRL_COLUMN_ORDER + +/* + The wxListCtrl can show lists of items in four different modes: + wxLC_LIST: multicolumn list view, with optional small icons (icons could be + optional for some platforms). Columns are computed automatically, + i.e. you don't set columns as in wxLC_REPORT. In other words, + the list wraps, unlike a wxListBox. + wxLC_REPORT: single or multicolumn report view (with optional header) + wxLC_ICON: large icon view, with optional labels + wxLC_SMALL_ICON: small icon view, with optional labels + + You can change the style dynamically, either with SetSingleStyle or + SetWindowStyleFlag. + + Further window styles: + + wxLC_ALIGN_TOP icons align to the top (default) + wxLC_ALIGN_LEFT icons align to the left + wxLC_AUTOARRANGE icons arrange themselves + wxLC_USER_TEXT the app provides label text on demand, except for column headers + wxLC_EDIT_LABELS labels are editable: app will be notified. + wxLC_NO_HEADER no header in report mode + wxLC_NO_SORT_HEADER can't click on header + wxLC_SINGLE_SEL single selection + wxLC_SORT_ASCENDING sort ascending (must still supply a comparison callback in SortItems) + wxLC_SORT_DESCENDING sort descending (ditto) + + Items are referred to by their index (position in the list starting from zero). + + Label text is supplied via insertion/setting functions and is stored by the + control, unless the wxLC_USER_TEXT style has been specified, in which case + the app will be notified when text is required (see sample). + + Images are dealt with by (optionally) associating 3 image lists with the control. + Zero-based indexes into these image lists indicate which image is to be used for + which item. Each image in an image list can contain a mask, and can be made out + of either a bitmap, two bitmaps or an icon. See ImagList.h for more details. + + Notifications are passed via the event system. + + See the sample wxListCtrl app for API usage. + + TODO: + - addition of further convenience functions + to avoid use of wxListItem in some functions + - state/overlay images: probably not needed. + - testing of whole API, extending current sample. + + + */ + +class WXDLLIMPEXP_CORE wxListCtrl: public wxListCtrlBase +{ +public: + /* + * Public interface + */ + + wxListCtrl() { Init(); } + + wxListCtrl(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxLC_ICON, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListCtrlNameStr)) + { + Init(); + + Create(parent, id, pos, size, style, validator, name); + } + + virtual ~wxListCtrl(); + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxLC_ICON, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListCtrlNameStr)); + + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + // Set the control colours + bool SetForegroundColour(const wxColour& col) wxOVERRIDE; + bool SetBackgroundColour(const wxColour& col) wxOVERRIDE; + + // Header attributes + virtual bool SetHeaderAttr(const wxItemAttr& attr) wxOVERRIDE; + + // Gets information about this column + bool GetColumn(int col, wxListItem& item) const wxOVERRIDE; + + // Sets information about this column + bool SetColumn(int col, const wxListItem& item) wxOVERRIDE; + + // Gets the column width + int GetColumnWidth(int col) const wxOVERRIDE; + + // Sets the column width + bool SetColumnWidth(int col, int width) wxOVERRIDE; + + + // Gets the column order from its index or index from its order + int GetColumnOrder(int col) const wxOVERRIDE; + int GetColumnIndexFromOrder(int order) const wxOVERRIDE; + + // Gets the column order for all columns + wxArrayInt GetColumnsOrder() const wxOVERRIDE; + + // Sets the column order for all columns + bool SetColumnsOrder(const wxArrayInt& orders) wxOVERRIDE; + + + // Gets the number of items that can fit vertically in the + // visible area of the list control (list or report view) + // or the total number of items in the list control (icon + // or small icon view) + int GetCountPerPage() const; + + // return the total area occupied by all the items (icon/small icon only) + wxRect GetViewRect() const; + + // Gets the edit control for editing labels. + wxTextCtrl* GetEditControl() const; + + // Gets information about the item + bool GetItem(wxListItem& info) const; + + // Check if the item is visible + bool IsVisible(long item) const wxOVERRIDE; + + // Sets information about the item + bool SetItem(wxListItem& info); + + // Sets a string field at a particular column + bool SetItem(long index, int col, const wxString& label, int imageId = -1); + + // Gets the item state + int GetItemState(long item, long stateMask) const; + + // Sets the item state + bool SetItemState(long item, long state, long stateMask); + + // Sets the item image + bool SetItemImage(long item, int image, int selImage = -1); + bool SetItemColumnImage(long item, long column, int image); + + // Gets the item text + wxString GetItemText(long item, int col = 0) const; + + // Sets the item text + void SetItemText(long item, const wxString& str); + + // Gets the item data + wxUIntPtr GetItemData(long item) const; + + // Sets the item data + bool SetItemPtrData(long item, wxUIntPtr data); + bool SetItemData(long item, long data) { return SetItemPtrData(item, data); } + + // Gets the item rectangle + bool GetItemRect(long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const; + + // Gets the subitem rectangle in report mode + bool GetSubItemRect(long item, long subItem, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const; + + // Gets the item position + bool GetItemPosition(long item, wxPoint& pos) const; + + // Sets the item position + bool SetItemPosition(long item, const wxPoint& pos); + + // Gets the number of items in the list control + int GetItemCount() const wxOVERRIDE; + + // Gets the number of columns in the list control + int GetColumnCount() const wxOVERRIDE { return m_colCount; } + + // get the horizontal and vertical components of the item spacing + wxSize GetItemSpacing() const; + + // Foreground colour of an item. + void SetItemTextColour( long item, const wxColour& col); + wxColour GetItemTextColour( long item ) const; + + // Background colour of an item. + void SetItemBackgroundColour( long item, const wxColour &col); + wxColour GetItemBackgroundColour( long item ) const; + + // Font of an item. + void SetItemFont( long item, const wxFont &f); + wxFont GetItemFont( long item ) const; + + // Checkbox state of an item + bool HasCheckBoxes() const wxOVERRIDE; + bool EnableCheckBoxes(bool enable = true) wxOVERRIDE; + bool IsItemChecked(long item) const wxOVERRIDE; + void CheckItem(long item, bool check) wxOVERRIDE; + + // Sort indicator in header + void ShowSortIndicator(int idx, bool ascending = true) wxOVERRIDE; + int GetSortIndicator() const wxOVERRIDE; + bool IsAscendingSortIndicator() const wxOVERRIDE; + + // Gets the number of selected items in the list control + int GetSelectedItemCount() const; + + // Gets the text colour of the listview + wxColour GetTextColour() const; + + // Sets the text colour of the listview + void SetTextColour(const wxColour& col); + + // Gets the index of the topmost visible item when in + // list or report view + long GetTopItem() const; + + // Add or remove a single window style + void SetSingleStyle(long style, bool add = true); + + // Set the whole window style + void SetWindowStyleFlag(long style) wxOVERRIDE; + + // Searches for an item, starting from 'item'. + // item can be -1 to find the first item that matches the + // specified flags. + // Returns the item or -1 if unsuccessful. + long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE) const; + + // refresh items selectively (only useful for virtual list controls) + void RefreshItem(long item); + void RefreshItems(long itemFrom, long itemTo); + + // Operations + //////////////////////////////////////////////////////////////////////////// + + // Arranges the items + bool Arrange(int flag = wxLIST_ALIGN_DEFAULT); + + // Deletes an item + bool DeleteItem(long item); + + // Deletes all items + bool DeleteAllItems(); + + // Deletes a column + bool DeleteColumn(int col) wxOVERRIDE; + + // Deletes all columns + bool DeleteAllColumns() wxOVERRIDE; + + // Clears items, and columns if there are any. + void ClearAll(); + + // Edit the label + wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = wxCLASSINFO(wxTextCtrl)); + + // End label editing, optionally cancelling the edit + bool EndEditLabel(bool cancel); + + // Ensures this item is visible + bool EnsureVisible(long item); + + // Find an item whose label matches this string, starting from the item after 'start' + // or the beginning if 'start' is -1. + long FindItem(long start, const wxString& str, bool partial = false); + + // Find an item whose data matches this data, starting from the item after 'start' + // or the beginning if 'start' is -1. + long FindItem(long start, wxUIntPtr data); + + // Find an item nearest this position in the specified direction, starting from + // the item after 'start' or the beginning if 'start' is -1. + long FindItem(long start, const wxPoint& pt, int direction); + + // Determines which item (if any) is at the specified point, + // giving details in 'flags' (see wxLIST_HITTEST_... flags above) + // Request the subitem number as well at the given coordinate. + long HitTest(const wxPoint& point, int& flags, long* ptrSubItem = NULL) const; + + // Inserts an item, returning the index of the new item if successful, + // -1 otherwise. + long InsertItem(const wxListItem& info); + + // Insert a string item + long InsertItem(long index, const wxString& label); + + // Insert an image item + long InsertItem(long index, int imageIndex); + + // Insert an image/string item + long InsertItem(long index, const wxString& label, int imageIndex); + + // set the number of items in a virtual list control + void SetItemCount(long count); + + // Scrolls the list control. If in icon, small icon or report view mode, + // x specifies the number of pixels to scroll. If in list view mode, x + // specifies the number of columns to scroll. + // If in icon, small icon or list view mode, y specifies the number of pixels + // to scroll. If in report view mode, y specifies the number of lines to scroll. + bool ScrollList(int dx, int dy); + + // Sort items. + + // fn is a function which takes 3 long arguments: item1, item2, data. + // item1 is the long data associated with a first item (NOT the index). + // item2 is the long data associated with a second item (NOT the index). + // data is the same value as passed to SortItems. + // The return value is a negative number if the first item should precede the second + // item, a positive number of the second item should precede the first, + // or zero if the two items are equivalent. + + // data is arbitrary data to be passed to the sort function. + bool SortItems(wxListCtrlCompare fn, wxIntPtr data); + + // IMPLEMENTATION + virtual bool MSWCommand(WXUINT param, WXWORD id) wxOVERRIDE; + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) wxOVERRIDE; + virtual bool MSWShouldPreProcessMessage(WXMSG* msg) wxOVERRIDE; + +#if WXWIN_COMPATIBILITY_3_0 + // bring the control in sync with current m_windowStyle value + wxDEPRECATED_MSG("useless and will be removed in the future, use SetWindowStyleFlag() instead") + void UpdateStyle(); +#endif // WXWIN_COMPATIBILITY_3_0 + + // Event handlers + //////////////////////////////////////////////////////////////////////////// + // Necessary for drawing hrules and vrules, if specified + void OnPaint(wxPaintEvent& event); + + // Override SetDoubleBuffered() to do nothing, its implementation in the + // base class is incompatible with the double buffering done by this native + // control. + virtual bool IsDoubleBuffered() const wxOVERRIDE; + virtual void SetDoubleBuffered(bool on) wxOVERRIDE; + + virtual bool ShouldInheritColours() const wxOVERRIDE { return false; } + + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // convert our styles to Windows + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const wxOVERRIDE; + + // special Windows message handling + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, + WXWPARAM wParam, + WXLPARAM lParam) wxOVERRIDE; + +protected: + // common part of all ctors + void Init(); + + virtual bool MSWShouldSetDefaultFont() const wxOVERRIDE { return false; } + + // Implement constrained best size calculation. + virtual int DoGetBestClientHeight(int width) const wxOVERRIDE + { return MSWGetBestViewRect(width, -1).y; } + virtual int DoGetBestClientWidth(int height) const wxOVERRIDE + { return MSWGetBestViewRect(-1, height).x; } +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip(wxToolTip *tip) wxOVERRIDE; +#endif // wxUSE_TOOLTIPS + + virtual void MSWUpdateFontOnDPIChange(const wxSize& newDPI) wxOVERRIDE; + + void OnDPIChanged(wxDPIChangedEvent& event); + + wxSize MSWGetBestViewRect(int x, int y) const; + + // Implement base class pure virtual methods. + long DoInsertColumn(long col, const wxListItem& info) wxOVERRIDE; + void DoUpdateImages(int which) wxOVERRIDE; + + // free memory taken by all internal data + void FreeAllInternalData(); + + // get the internal data object for this item (may return NULL) + wxMSWListItemData *MSWGetItemData(long item) const; + + // get the item attribute, either by querying it for virtual control, or by + // returning the one previously set using setter methods for a normal one + wxItemAttr *DoGetItemColumnAttr(long item, long column) const; + + + wxTextCtrl* m_textCtrl; // The control used for editing a label + + int m_colCount; // Windows doesn't have GetColumnCount so must + // keep track of inserted/deleted columns + + // all wxMSWListItemData objects we use + wxVector<wxMSWListItemData *> m_internalData; + + // true if we have any items with custom attributes + bool m_hasAnyAttr; + + // m_sortAsc is only used if m_sortCol != -1 + bool m_sortAsc; + int m_sortCol; + +private: + // process NM_CUSTOMDRAW notification message + WXLPARAM OnCustomDraw(WXLPARAM lParam); + + // set the extended styles for the control (used by Create() and + // UpdateStyle()), only should be called if InReportView() + void MSWSetExListStyles(); + + // initialize the (already created) m_textCtrl with the associated HWND + void InitEditControl(WXHWND hWnd); + + // destroy m_textCtrl if it's currently valid and reset it to NULL + void DeleteEditControl(); + + // Update all image lists that we have. + void UpdateAllImageLists(); + + // Intercept Escape and Enter keys to avoid them being stolen from our + // in-place editor control. + void OnCharHook(wxKeyEvent& event); + + // Draw the sort arrow in the header. + void DrawSortArrow(); + + // Object using for header custom drawing if necessary, may be NULL. + wxMSWListHeaderCustomDraw* m_headerCustomDraw; + + + wxDECLARE_DYNAMIC_CLASS(wxListCtrl); + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxListCtrl); +}; + +#endif // _WX_LISTCTRL_H_ diff --git a/lib/wxWidgets/include/wx/msw/magnif1.cur b/lib/wxWidgets/include/wx/msw/magnif1.cur new file mode 100644 index 0000000..15d1a77 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/magnif1.cur Binary files differ diff --git a/lib/wxWidgets/include/wx/msw/mdi.h b/lib/wxWidgets/include/wx/msw/mdi.h new file mode 100644 index 0000000..209fdd5 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/mdi.h @@ -0,0 +1,280 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/mdi.h +// Purpose: MDI (Multiple Document Interface) classes +// Author: Julian Smart +// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes +// Created: 01/02/97 +// Copyright: (c) 1997 Julian Smart +// (c) 2008 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_MDI_H_ +#define _WX_MSW_MDI_H_ + +#include "wx/frame.h" + +class WXDLLIMPEXP_FWD_CORE wxAcceleratorTable; + +// --------------------------------------------------------------------------- +// wxMDIParentFrame +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase +{ +public: + wxMDIParentFrame() { Init(); } + wxMDIParentFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Init(); + + Create(parent, id, title, pos, size, style, name); + } + + virtual ~wxMDIParentFrame(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + // override/implement base class [pure] virtual methods + // ---------------------------------------------------- + + static bool IsTDI() { return false; } + + // we don't store the active child in m_currentChild so override this + // function to find it dynamically + virtual wxMDIChildFrame *GetActiveChild() const wxOVERRIDE; + + virtual void Cascade() wxOVERRIDE; + virtual void Tile(wxOrientation orient = wxHORIZONTAL) wxOVERRIDE; + virtual void ArrangeIcons() wxOVERRIDE; + virtual void ActivateNext() wxOVERRIDE; + virtual void ActivatePrevious() wxOVERRIDE; + +#if wxUSE_MENUS + virtual void SetWindowMenu(wxMenu* menu) wxOVERRIDE; + + virtual void DoMenuUpdates(wxMenu* menu = NULL) wxOVERRIDE; + + // return the active child menu, if any + virtual WXHMENU MSWGetActiveMenu() const wxOVERRIDE; +#endif // wxUSE_MENUS + + + // implementation only from now on + + // MDI helpers + // ----------- + +#if wxUSE_MENUS + // called by wxMDIChildFrame after it was successfully created + virtual void AddMDIChild(wxMDIChildFrame *child); + + // called by wxMDIChildFrame just before it is destroyed + virtual void RemoveMDIChild(wxMDIChildFrame *child); +#endif // wxUSE_MENUS + + // Retrieve the current window menu label: it can be different from + // "Window" when using non-English translations and can also be different + // from wxGetTranslation("Window") if the locale has changed since the + // "Window" menu was added. + const wxString& MSWGetCurrentWindowMenuLabel() const + { return m_currentWindowMenuLabel; } + + // handlers + // -------- + + // Responds to colour changes + void OnSysColourChanged(wxSysColourChangedEvent& event); + + void OnActivate(wxActivateEvent& event); + void OnSize(wxSizeEvent& event); + void OnIconized(wxIconizeEvent& event); + + bool HandleActivate(int state, bool minimized, WXHWND activate); + + // override window proc for MDI-specific message processing + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) wxOVERRIDE; + + virtual WXLRESULT MSWDefWindowProc(WXUINT, WXWPARAM, WXLPARAM) wxOVERRIDE; + virtual bool MSWTranslateMessage(WXMSG* msg) wxOVERRIDE; + +#if wxUSE_MENUS + // override the menu-relayed methods to also look in the active child menu + // bar and the "Window" menu + virtual wxMenuItem *FindItemInMenuBar(int menuId) const wxOVERRIDE; + virtual wxMenu* MSWFindMenuFromHMENU(WXHMENU hMenu) wxOVERRIDE; +#endif // wxUSE_MENUS + +protected: +#if wxUSE_MENUS_NATIVE + virtual void InternalSetMenuBar() wxOVERRIDE; +#endif // wxUSE_MENUS_NATIVE + + virtual WXHICON GetDefaultIcon() const wxOVERRIDE; + + // set the size of the MDI client window to match the frame size + void UpdateClientSize(); + +private: + // common part of all ctors + void Init(); + +#if wxUSE_MENUS + // "Window" menu commands event handlers + void OnMDICommand(wxCommandEvent& event); + void OnMDIChild(wxCommandEvent& event); + + + // add/remove window menu if we have it (i.e. m_windowMenu != NULL) + void AddWindowMenu(); + void RemoveWindowMenu(); + + // update the window menu (if we have it) to enable or disable the commands + // which only make sense when we have more than one child + void UpdateWindowMenu(bool enable); + +#if wxUSE_ACCEL + wxAcceleratorTable *m_accelWindowMenu; +#endif // wxUSE_ACCEL +#endif // wxUSE_MENUS + + // return the number of child frames we currently have (maybe 0) + int GetChildFramesCount() const; + + // if true, indicates whether the event wasn't really processed even though + // it was "handled", see OnActivate() and HandleActivate() + bool m_activationNotHandled; + + // holds the current translation for the window menu label + wxString m_currentWindowMenuLabel; + + + friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxMDIParentFrame); + wxDECLARE_NO_COPY_CLASS(wxMDIParentFrame); +}; + +// --------------------------------------------------------------------------- +// wxMDIChildFrame +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxMDIChildFrameBase +{ +public: + wxMDIChildFrame() { Init(); } + wxMDIChildFrame(wxMDIParentFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Init(); + + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxMDIParentFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + virtual ~wxMDIChildFrame(); + + // implement MDI operations + virtual void Activate() wxOVERRIDE; + + // Override some frame operations too + virtual void Maximize(bool maximize = true) wxOVERRIDE; + virtual void Restore() wxOVERRIDE; + + virtual bool Show(bool show = true) wxOVERRIDE; + + // Implementation only from now on + // ------------------------------- + + // Handlers + bool HandleMDIActivate(long bActivate, WXHWND, WXHWND); + bool HandleWindowPosChanging(void *lpPos); + bool HandleGetMinMaxInfo(void *mmInfo); + + virtual WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) wxOVERRIDE; + virtual WXLRESULT MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) wxOVERRIDE; + virtual bool MSWTranslateMessage(WXMSG *msg) wxOVERRIDE; + + virtual void MSWDestroyWindow() wxOVERRIDE; + + bool ResetWindowStyle(void *vrect); + + void OnIdle(wxIdleEvent& event); + +protected: + virtual void DoGetScreenPosition(int *x, int *y) const wxOVERRIDE; + virtual void DoGetPosition(int *x, int *y) const wxOVERRIDE; + virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags) wxOVERRIDE; + virtual void DoSetClientSize(int width, int height) wxOVERRIDE; + virtual void InternalSetMenuBar() wxOVERRIDE; + virtual bool IsMDIChild() const wxOVERRIDE { return true; } + virtual void DetachMenuBar() wxOVERRIDE; + + virtual WXHICON GetDefaultIcon() const wxOVERRIDE; + + // common part of all ctors + void Init(); + +private: + bool m_needsResize; // flag which tells us to artificially resize the frame + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIChildFrame); +}; + +// --------------------------------------------------------------------------- +// wxMDIClientWindow +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase +{ +public: + wxMDIClientWindow() { Init(); } + + // Note: this is virtual, to allow overridden behaviour. + virtual bool CreateClient(wxMDIParentFrame *parent, + long style = wxVSCROLL | wxHSCROLL) wxOVERRIDE; + + // Explicitly call default scroll behaviour + void OnScroll(wxScrollEvent& event); + +protected: + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; + + void Init() { m_scrollX = m_scrollY = 0; } + + int m_scrollX, m_scrollY; + +private: + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIClientWindow); +}; + +#endif // _WX_MSW_MDI_H_ diff --git a/lib/wxWidgets/include/wx/msw/menu.h b/lib/wxWidgets/include/wx/msw/menu.h new file mode 100644 index 0000000..9a7635a --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/menu.h @@ -0,0 +1,235 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/menu.h +// Purpose: wxMenu, wxMenuBar classes +// Author: Julian Smart +// Modified by: Vadim Zeitlin (wxMenuItem is now in separate file) +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MENU_H_ +#define _WX_MENU_H_ + +#if wxUSE_ACCEL + #include "wx/accel.h" + #include "wx/dynarray.h" + + WX_DEFINE_EXPORTED_ARRAY_PTR(wxAcceleratorEntry *, wxAcceleratorArray); +#endif // wxUSE_ACCEL + +class WXDLLIMPEXP_FWD_CORE wxFrame; + +class wxMenuRadioItemsData; + + +#include "wx/arrstr.h" + +// ---------------------------------------------------------------------------- +// Menu +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMenu : public wxMenuBase +{ +public: + // ctors & dtor + wxMenu(const wxString& title, long style = 0) + : wxMenuBase(title, style) { Init(); } + + wxMenu(long style = 0) : wxMenuBase(style) { Init(); } + + virtual ~wxMenu(); + + virtual void Break() wxOVERRIDE; + + virtual void SetTitle(const wxString& title) wxOVERRIDE; + + // MSW-only methods + // ---------------- + + // Create a new menu from the given native HMENU. Takes ownership of the + // menu handle and will delete it when this object is destroyed. + static wxMenu *MSWNewFromHMENU(WXHMENU hMenu) { return new wxMenu(hMenu); } + + // Detaches HMENU so that it isn't deleted when this object is destroyed. + // Don't use this object after calling this method. + WXHMENU MSWDetachHMENU() { WXHMENU m = m_hMenu; m_hMenu = NULL; return m; } + + // Process WM_COMMAND. + virtual bool MSWCommand(WXUINT param, WXWORD id); + + // implementation only from now on + // ------------------------------- + + // get the native menu handle + WXHMENU GetHMenu() const { return m_hMenu; } + + // Return the start and end position of the radio group to which the item + // at the given position belongs. Returns false if there is no radio group + // containing this position. + bool MSWGetRadioGroupRange(int pos, int *start, int *end) const; + + void SetupBitmaps(); + +#if wxUSE_ACCEL + // called by wxMenuBar to build its accel table from the accels of all menus + bool HasAccels() const { return !m_accels.empty(); } + size_t GetAccelCount() const { return m_accels.size(); } + size_t CopyAccels(wxAcceleratorEntry *accels) const; + + // called by wxMenuItem when its accels changes + void UpdateAccel(wxMenuItem *item); + void RemoveAccel(wxMenuItem *item); + + // helper used by wxMenu itself (returns the index in m_accels) + int FindAccel(int id) const; + + // used only by wxMDIParentFrame currently but could be useful elsewhere: + // returns a new accelerator table with accelerators for just this menu + // (shouldn't be called if we don't have any accelerators) + wxAcceleratorTable *CreateAccelTable() const; +#endif // wxUSE_ACCEL + + // get the menu with given handle (recursively) + wxMenu* MSWGetMenu(WXHMENU hMenu); + +#if wxUSE_OWNER_DRAWN + + int GetMaxAccelWidth() + { + if (m_maxAccelWidth == -1) + CalculateMaxAccelWidth(); + return m_maxAccelWidth; + } + + void ResetMaxAccelWidth() + { + m_maxAccelWidth = -1; + } + +private: + void CalculateMaxAccelWidth(); + +#endif // wxUSE_OWNER_DRAWN + +protected: + virtual wxMenuItem* DoAppend(wxMenuItem *item) wxOVERRIDE; + virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item) wxOVERRIDE; + virtual wxMenuItem* DoRemove(wxMenuItem *item) wxOVERRIDE; + +private: + // This constructor is private, use MSWNewFromHMENU() to use it. + wxMenu(WXHMENU hMenu); + + // Common part of all ctors, it doesn't create a new HMENU. + void InitNoCreate(); + + // Common part of all ctors except of the one above taking a native menu + // handler: calls InitNoCreate() and also creates a new menu. + void Init(); + + // common part of Append/Insert (behaves as Append is pos == (size_t)-1) + bool DoInsertOrAppend(wxMenuItem *item, size_t pos = (size_t)-1); + + + // This variable contains the description of the radio item groups and + // allows to find whether an item at the given position is part of the + // group and also where its group starts and ends. + // + // It is initially NULL and only allocated if we have any radio items. + wxMenuRadioItemsData *m_radioData; + + // if true, insert a break before appending the next item + bool m_doBreak; + + // the menu handle of this menu + WXHMENU m_hMenu; + +#if wxUSE_ACCEL + // the accelerators for our menu items + wxAcceleratorArray m_accels; +#endif // wxUSE_ACCEL + +#if wxUSE_OWNER_DRAWN + // true if the menu has any ownerdrawn items + bool m_ownerDrawn; + + // the max width of menu items bitmaps + int m_maxBitmapWidth; + + // the max width of menu items accels + int m_maxAccelWidth; +#endif // wxUSE_OWNER_DRAWN + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMenu); +}; + +// ---------------------------------------------------------------------------- +// Menu Bar (a la Windows) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMenuBar : public wxMenuBarBase +{ +public: + // ctors & dtor + // default constructor + wxMenuBar(); + // unused under MSW + wxMenuBar(long style); + // menubar takes ownership of the menus arrays but copies the titles + wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0); + virtual ~wxMenuBar(); + + // menubar construction + virtual bool Append( wxMenu *menu, const wxString &title ) wxOVERRIDE; + virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title) wxOVERRIDE; + virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title) wxOVERRIDE; + virtual wxMenu *Remove(size_t pos) wxOVERRIDE; + + virtual void EnableTop( size_t pos, bool flag ) wxOVERRIDE; + virtual bool IsEnabledTop(size_t pos) const wxOVERRIDE; + virtual void SetMenuLabel( size_t pos, const wxString& label ) wxOVERRIDE; + virtual wxString GetMenuLabel( size_t pos ) const wxOVERRIDE; + + // implementation from now on + WXHMENU Create(); + virtual void Detach() wxOVERRIDE; + virtual void Attach(wxFrame *frame) wxOVERRIDE; + +#if wxUSE_ACCEL + // update the accel table (must be called after adding/deleting a menu) + void RebuildAccelTable(); +#endif // wxUSE_ACCEL + + // get the menu handle + WXHMENU GetHMenu() const { return m_hMenu; } + + // if the menubar is modified, the display is not updated automatically, + // call this function to update it (m_menuBarFrame should be !NULL) + void Refresh(); + + // To avoid compile warning + void Refresh( bool eraseBackground, + const wxRect *rect = (const wxRect *) NULL ) wxOVERRIDE { wxWindow::Refresh(eraseBackground, rect); } + + // Get a top level menu position or wxNOT_FOUND from its handle. + int MSWGetTopMenuPos(WXHMENU hMenu) const; + + // Get a top level or sub menu with given handle (recursively). + wxMenu* MSWGetMenu(WXHMENU hMenu) const; + +protected: + // common part of all ctors + void Init(); + + WXHMENU m_hMenu; + + // Return the MSW position for a wxMenu which is sometimes different from + // the wxWidgets position. + int MSWPositionForWxMenu(wxMenu *menu, int wxpos); + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuBar); +}; + +#endif // _WX_MENU_H_ diff --git a/lib/wxWidgets/include/wx/msw/menuitem.h b/lib/wxWidgets/include/wx/msw/menuitem.h new file mode 100644 index 0000000..a765236 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/menuitem.h @@ -0,0 +1,173 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/menuitem.h +// Purpose: wxMenuItem class +// Author: Vadim Zeitlin +// Modified by: +// Created: 11.11.97 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _MENUITEM_H +#define _MENUITEM_H + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if wxUSE_OWNER_DRAWN + #include "wx/ownerdrw.h" + + struct tagRECT; +#endif + +// ---------------------------------------------------------------------------- +// wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMenuItem : public wxMenuItemBase +#if wxUSE_OWNER_DRAWN + , public wxOwnerDrawn +#endif +{ +public: + // ctor & dtor + wxMenuItem(wxMenu *parentMenu = NULL, + int id = wxID_SEPARATOR, + const wxString& name = wxEmptyString, + const wxString& help = wxEmptyString, + wxItemKind kind = wxITEM_NORMAL, + wxMenu *subMenu = NULL); + virtual ~wxMenuItem(); + + // override base class virtuals + virtual void SetItemLabel(const wxString& strName) wxOVERRIDE; + + virtual void Enable(bool bDoEnable = true) wxOVERRIDE; + virtual void Check(bool bDoCheck = true) wxOVERRIDE; + virtual bool IsChecked() const wxOVERRIDE; + + // unfortunately needed to resolve ambiguity between + // wxMenuItemBase::IsCheckable() and wxOwnerDrawn::IsCheckable() + bool IsCheckable() const { return wxMenuItemBase::IsCheckable(); } + + // the id for a popup menu is really its menu handle (as required by + // ::AppendMenu() API), so this function will return either the id or the + // menu handle depending on what we are + // + // notice that it also returns the id as an unsigned int, as required by + // Win32 API + WXWPARAM GetMSWId() const; + +#if WXWIN_COMPATIBILITY_2_8 + // compatibility only, don't use in new code + wxDEPRECATED( + wxMenuItem(wxMenu *parentMenu, + int id, + const wxString& text, + const wxString& help, + bool isCheckable, + wxMenu *subMenu = NULL) + ); +#endif + + void SetBitmaps(const wxBitmapBundle& bmpChecked, + const wxBitmapBundle& bmpUnchecked = wxNullBitmap) + { + DoSetBitmap(bmpChecked, true); + DoSetBitmap(bmpUnchecked, false); + } + + virtual void SetBitmap(const wxBitmapBundle& bmp) wxOVERRIDE + { + DoSetBitmap(bmp, true); + } + + virtual wxBitmap GetBitmap() const wxOVERRIDE + { + return GetBitmap(true); + } + + void SetupBitmaps(); + + // The functions taking bChecked are wxMSW-specific. + void SetBitmap(const wxBitmapBundle& bmp, bool bChecked) + { + DoSetBitmap(bmp, bChecked); + } + + wxBitmap GetBitmap(bool bChecked) const; + +#if wxUSE_OWNER_DRAWN + void SetDisabledBitmap(const wxBitmapBundle& bmpDisabled) + { + m_bmpDisabled = bmpDisabled; + SetOwnerDrawn(true); + } + + wxBitmap GetDisabledBitmap() const; + + int MeasureAccelWidth() const; + + // override wxOwnerDrawn base class virtuals + virtual wxString GetName() const wxOVERRIDE; + virtual bool OnMeasureItem(size_t *pwidth, size_t *pheight) wxOVERRIDE; + virtual bool OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODStatus stat) wxOVERRIDE; + +protected: + virtual void GetFontToUse(wxFont& font) const wxOVERRIDE; + virtual void GetColourToUse(wxODStatus stat, wxColour& colText, wxColour& colBack) const wxOVERRIDE; + +private: + // helper function for draw std menu check mark + void DrawStdCheckMark(WXHDC hdc, const tagRECT* rc, wxODStatus stat); + + // helper function to determine if the item must be owner-drawn + bool MSWMustUseOwnerDrawn(); +#endif // wxUSE_OWNER_DRAWN + + enum BitmapKind + { + Normal, + Checked, + Unchecked + }; + + // helper function to get a handle for bitmap associated with item + WXHBITMAP GetHBitmapForMenu(BitmapKind kind) const; + + // helper function to set/change the bitmap + void DoSetBitmap(const wxBitmapBundle& bmp, bool bChecked); + +private: + // common part of all ctors + void Init(); + + // Return the item position in the menu containing it. + // + // Returns -1 if the item is not attached to a menu or if we can't find its + // position (which is not really supposed to ever happen). + int MSGetMenuItemPos() const; + + // Get the extent of the given text using the correct font. + wxSize GetMenuTextExtent(const wxString& text) const; + + // item bitmaps + wxBitmapBundle m_bmpUnchecked; // (used only for checkable items) +#if wxUSE_OWNER_DRAWN + wxBitmapBundle m_bmpDisabled; +#endif // wxUSE_OWNER_DRAWN + + // Bitmaps being currently used: we must store them separately from the + // bundle itself because their HBITMAPs must remain valid as long as + // they're used by Windows. + wxBitmap m_bmpCheckedCurrent, + m_bmpUncheckedCurrent; + + // Give wxMenu access to our MSWMustUseOwnerDrawn() and GetHBitmapForMenu(). + friend class wxMenu; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuItem); +}; + +#endif //_MENUITEM_H diff --git a/lib/wxWidgets/include/wx/msw/metafile.h b/lib/wxWidgets/include/wx/msw/metafile.h new file mode 100644 index 0000000..961f466 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/metafile.h @@ -0,0 +1,189 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/metafile.h +// Purpose: wxMetaFile, wxMetaFileDC and wxMetaFileDataObject classes +// Author: Julian Smart +// Modified by: VZ 07.01.00: implemented wxMetaFileDataObject +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_METAFIILE_H_ +#define _WX_METAFIILE_H_ + +#include "wx/dc.h" +#include "wx/gdiobj.h" + +#if wxUSE_DATAOBJ + #include "wx/dataobj.h" +#endif + +// ---------------------------------------------------------------------------- +// Metafile and metafile device context classes +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxMetafile; + +class WXDLLIMPEXP_CORE wxMetafileRefData: public wxGDIRefData +{ +public: + wxMetafileRefData(); + virtual ~wxMetafileRefData(); + + virtual bool IsOk() const wxOVERRIDE { return m_metafile != 0; } + +public: + WXHANDLE m_metafile; + int m_windowsMappingMode; + int m_width, m_height; + + friend class WXDLLIMPEXP_FWD_CORE wxMetafile; +}; + +#define M_METAFILEDATA ((wxMetafileRefData *)m_refData) + +class WXDLLIMPEXP_CORE wxMetafile: public wxGDIObject +{ +public: + wxMetafile(const wxString& file = wxEmptyString); + virtual ~wxMetafile(); + + // After this is called, the metafile cannot be used for anything + // since it is now owned by the clipboard. + virtual bool SetClipboard(int width = 0, int height = 0); + + virtual bool Play(wxDC *dc); + + // set/get the size of metafile for clipboard operations + wxSize GetSize() const { return wxSize(GetWidth(), GetHeight()); } + int GetWidth() const { return M_METAFILEDATA->m_width; } + int GetHeight() const { return M_METAFILEDATA->m_height; } + + void SetWidth(int width) { M_METAFILEDATA->m_width = width; } + void SetHeight(int height) { M_METAFILEDATA->m_height = height; } + + // Implementation + WXHANDLE GetHMETAFILE() const { return M_METAFILEDATA->m_metafile; } + void SetHMETAFILE(WXHANDLE mf) ; + int GetWindowsMappingMode() const { return M_METAFILEDATA->m_windowsMappingMode; } + void SetWindowsMappingMode(int mm); + +protected: + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxMetafile); +}; + +class WXDLLIMPEXP_CORE wxMetafileDCImpl: public wxMSWDCImpl +{ +public: + wxMetafileDCImpl(wxDC *owner, const wxString& file = wxEmptyString); + wxMetafileDCImpl(wxDC *owner, const wxString& file, + int xext, int yext, int xorg, int yorg); + virtual ~wxMetafileDCImpl(); + + virtual wxMetafile *Close(); + virtual void SetMapMode(wxMappingMode mode) wxOVERRIDE; + virtual void DoGetTextExtent(const wxString& string, + wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + const wxFont *theFont = NULL) const wxOVERRIDE; + + // Implementation + wxMetafile *GetMetaFile() const { return m_metaFile; } + void SetMetaFile(wxMetafile *mf) { m_metaFile = mf; } + int GetWindowsMappingMode() const { return m_windowsMappingMode; } + void SetWindowsMappingMode(int mm) { m_windowsMappingMode = mm; } + +protected: + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; + + int m_windowsMappingMode; + wxMetafile* m_metaFile; + +private: + wxDECLARE_CLASS(wxMetafileDCImpl); + wxDECLARE_NO_COPY_CLASS(wxMetafileDCImpl); +}; + +class WXDLLIMPEXP_CORE wxMetafileDC: public wxDC +{ +public: + // Don't supply origin and extent + // Supply them to wxMakeMetaFilePlaceable instead. + wxMetafileDC(const wxString& file) + : wxDC(new wxMetafileDCImpl( this, file )) + { } + + // Supply origin and extent (recommended). + // Then don't need to supply them to wxMakeMetaFilePlaceable. + wxMetafileDC(const wxString& file, int xext, int yext, int xorg, int yorg) + : wxDC(new wxMetafileDCImpl( this, file, xext, yext, xorg, yorg )) + { } + + wxMetafile *GetMetafile() const + { return ((wxMetafileDCImpl*)m_pimpl)->GetMetaFile(); } + + wxMetafile *Close() + { return ((wxMetafileDCImpl*)m_pimpl)->Close(); } + +private: + wxDECLARE_CLASS(wxMetafileDC); + wxDECLARE_NO_COPY_CLASS(wxMetafileDC); +}; + + + + +/* + * Pass filename of existing non-placeable metafile, and bounding box. + * Adds a placeable metafile header, sets the mapping mode to anisotropic, + * and sets the window origin and extent to mimic the wxMM_TEXT mapping mode. + * + */ + +// No origin or extent +bool WXDLLIMPEXP_CORE wxMakeMetafilePlaceable(const wxString& filename, float scale = 1.0f); + +// Optional origin and extent +bool WXDLLIMPEXP_CORE wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale = 1.0f, bool useOriginAndExtent = true); + +// ---------------------------------------------------------------------------- +// wxMetafileDataObject is a specialization of wxDataObject for metafile data +// ---------------------------------------------------------------------------- + +#if wxUSE_DATAOBJ + +class WXDLLIMPEXP_CORE wxMetafileDataObject : public wxDataObjectSimple +{ +public: + // ctors + wxMetafileDataObject() : wxDataObjectSimple(wxDF_METAFILE) + { } + wxMetafileDataObject(const wxMetafile& metafile) + : wxDataObjectSimple(wxDF_METAFILE), m_metafile(metafile) { } + + // virtual functions which you may override if you want to provide data on + // demand only - otherwise, the trivial default versions will be used + virtual void SetMetafile(const wxMetafile& metafile) + { m_metafile = metafile; } + virtual wxMetafile GetMetafile() const + { return m_metafile; } + + // implement base class pure virtuals + virtual size_t GetDataSize() const wxOVERRIDE; + virtual bool GetDataHere(void *buf) const wxOVERRIDE; + virtual bool SetData(size_t len, const void *buf) wxOVERRIDE; + +protected: + wxMetafile m_metafile; +}; + +#endif // wxUSE_DATAOBJ + +#endif + // _WX_METAFIILE_H_ + diff --git a/lib/wxWidgets/include/wx/msw/mfc.h b/lib/wxWidgets/include/wx/msw/mfc.h new file mode 100644 index 0000000..39c9ed4 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/mfc.h @@ -0,0 +1,193 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/mfc.h +// Purpose: Helpers for applications using both wxWidgets and MFC +// Author: Julian Smart, Vadim Zeitlin +// Created: 2017-12-01 (mostly extracted from samples/mfc) +// Copyright: (c) 2017 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_MFC_H_ +#define _WX_MSW_MFC_H_ + +#ifndef __AFXWIN_H__ + #error "MFC headers must be included before including this file." +#endif + +#include "wx/app.h" +#include "wx/evtloop.h" +#include "wx/window.h" +#include "wx/msw/winundef.h" + +// ---------------------------------------------------------------------------- +// MFC window class wrapping a window created by wxWidgets +// ---------------------------------------------------------------------------- + +class wxMFCWnd : public CWnd +{ +public: + // If default ctor is used, Attach() must be called later. + wxMFCWnd() + { + } + + // Combines default ctor and Attach(). + explicit wxMFCWnd(wxWindow* w) + { + Attach(w); + } + + void Attach(wxWindow* w) + { + CWnd::Attach(w->GetHWND()); + } + + ~wxMFCWnd() + { + // Prevent MFC from destroying the wxWindow. + Detach(); + } +}; + +// ---------------------------------------------------------------------------- +// MFC application class forwarding everything to wxApp +// ---------------------------------------------------------------------------- + +// The template parameter here is an existing class deriving from CWinApp or, +// if there is no such class, just CWinApp itself. +template <typename T> +class wxMFCApp : public T +{ +public: + typedef T BaseApp; + + BOOL InitInstance() wxOVERRIDE + { + if ( !BaseApp::InitInstance() ) + return FALSE; + + if ( !wxEntryStart(BaseApp::m_hInstance) ) + return FALSE; + + if ( !wxTheApp || !wxTheApp->CallOnInit() ) + return FALSE; + + if ( !InitMainWnd() ) + return FALSE; + + return TRUE; + } + + int ExitInstance() wxOVERRIDE + { + delete BaseApp::m_pMainWnd; + BaseApp::m_pMainWnd = NULL; + + if ( wxTheApp ) + wxTheApp->OnExit(); + + wxEntryCleanup(); + + return BaseApp::ExitInstance(); + } + + // Override this to provide messages pre-processing for wxWidgets windows. + BOOL PreTranslateMessage(MSG *msg) wxOVERRIDE + { + // Use the current event loop if there is one, or just fall back to the + // standard one otherwise, but make sure we pre-process messages in any + // case as otherwise many things would break (e.g. keyboard + // accelerators). + wxGUIEventLoop* + evtLoop = static_cast<wxGUIEventLoop *>(wxEventLoop::GetActive()); + wxGUIEventLoop evtLoopStd; + if ( !evtLoop ) + evtLoop = &evtLoopStd; + if ( evtLoop->PreProcessMessage(msg) ) + return TRUE; + + return BaseApp::PreTranslateMessage(msg); + } + + BOOL OnIdle(LONG lCount) wxOVERRIDE + { + BOOL moreIdle = BaseApp::OnIdle(lCount); + + if ( wxTheApp ) + { + wxTheApp->ProcessPendingEvents(); + + if ( wxTheApp->ProcessIdle() ) + moreIdle = TRUE; + } + + return moreIdle; + } + +protected: + // This virtual method can be overridden to create the main window using + // MFC code. The default implementation relies on wxApp::OnInit() creating + // a top level window which is then wrapped in an MFC window and used as + // the main window. + virtual BOOL InitMainWnd() + { + wxWindow* const w = wxTheApp->GetTopWindow(); + if ( !w ) + return FALSE; + + // We need to initialize the main window to let the program continue + // running. + BaseApp::m_pMainWnd = new wxMFCWnd(w); + + // We also need to reset m_pMainWnd when this window will be destroyed + // to prevent MFC from using an invalid HWND, which is probably not + // fatal but can result in at least asserts failures. + w->Bind(wxEVT_DESTROY, &wxMFCApp::OnMainWindowDestroyed, this); + + // And we need to let wxWidgets know that it should exit the + // application when this window is closed, as OnRun(), which does this + // by default, won't be called when using MFC main message loop. + wxTheApp->SetExitOnFrameDelete(true); + + return TRUE; + } + +private: + void OnMainWindowDestroyed(wxWindowDestroyEvent& event) + { + event.Skip(); + + delete BaseApp::m_pMainWnd; + BaseApp::m_pMainWnd = NULL; + } +}; + +typedef wxMFCApp<CWinApp> wxMFCWinApp; + +// ---------------------------------------------------------------------------- +// wxWidgets application class to be used in MFC applications +// ---------------------------------------------------------------------------- + +class wxAppWithMFC : public wxApp +{ +public: + void ExitMainLoop() wxOVERRIDE + { + // There is no wxEventLoop to exit, tell MFC to stop pumping messages + // instead. + ::PostQuitMessage(0); + } + + void WakeUpIdle() wxOVERRIDE + { + // As above, we can't wake up any wx event loop, so try to wake up the + // MFC one instead. + CWinApp* const mfcApp = AfxGetApp(); + if ( mfcApp && mfcApp->m_pMainWnd ) + { + ::PostMessage(mfcApp->m_pMainWnd->m_hWnd, WM_NULL, 0, 0); + } + } +}; + +#endif // _WX_MSW_MFC_H_ diff --git a/lib/wxWidgets/include/wx/msw/mimetype.h b/lib/wxWidgets/include/wx/msw/mimetype.h new file mode 100644 index 0000000..0b329e9 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/mimetype.h @@ -0,0 +1,142 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/mimetype.h +// Purpose: classes and functions to manage MIME types +// Author: Vadim Zeitlin +// Modified by: +// Created: 23.09.98 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWidgets licence (part of base library) +///////////////////////////////////////////////////////////////////////////// + +#ifndef _MIMETYPE_IMPL_H +#define _MIMETYPE_IMPL_H + +#include "wx/defs.h" + +#if wxUSE_MIMETYPE + +#include "wx/mimetype.h" + +// ---------------------------------------------------------------------------- +// wxFileTypeImpl is the MSW version of wxFileType, this is a private class +// and is never used directly by the application +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFileTypeImpl +{ +public: + // ctor + wxFileTypeImpl() { } + + // one of these Init() function must be called (ctor can't take any + // arguments because it's common) + + // initialize us with our file type name and extension - in this case + // we will read all other data from the registry + void Init(const wxString& strFileType, const wxString& ext); + + // implement accessor functions + bool GetExtensions(wxArrayString& extensions); + bool GetMimeType(wxString *mimeType) const; + bool GetMimeTypes(wxArrayString& mimeTypes) const; + bool GetIcon(wxIconLocation *iconLoc) const; + bool GetDescription(wxString *desc) const; + bool GetOpenCommand(wxString *openCmd, + const wxFileType::MessageParameters& params) const + { + *openCmd = GetExpandedCommand(wxS("open"), params); + return !openCmd->empty(); + } + + bool GetPrintCommand(wxString *printCmd, + const wxFileType::MessageParameters& params) const + { + *printCmd = GetExpandedCommand(wxS("print"), params); + return !printCmd->empty(); + } + + size_t GetAllCommands(wxArrayString * verbs, wxArrayString * commands, + const wxFileType::MessageParameters& params) const; + + bool Unassociate(); + + // set an arbitrary command, ask confirmation if it already exists and + // overwriteprompt is true + bool SetCommand(const wxString& cmd, + const wxString& verb, + bool overwriteprompt = true); + + bool SetDefaultIcon(const wxString& cmd = wxEmptyString, int index = 0); + + // this is called by Associate + bool SetDescription (const wxString& desc); + + // This is called by all our own methods modifying the registry to let the + // Windows Shell know about the changes. + // + // It is also called from Associate() and Unassociate() which suppress the + // internally generated notifications using the method below, which is why + // it has to be public. + void MSWNotifyShell(); + + // Call before/after performing several registry changes in a row to + // temporarily suppress multiple notifications that would be generated for + // them and generate a single one at the end using MSWNotifyShell() + // explicitly. + void MSWSuppressNotifications(bool suppress); + + wxString + GetExpandedCommand(const wxString& verb, + const wxFileType::MessageParameters& params) const; +private: + // helper function: reads the command corresponding to the specified verb + // from the registry (returns an empty string if not found) + wxString GetCommand(const wxString& verb) const; + + // get the registry path for the given verb + wxString GetVerbPath(const wxString& verb) const; + + // check that the registry key for our extension exists, create it if it + // doesn't, return false if this failed + bool EnsureExtKeyExists(); + + wxString m_strFileType, // may be empty + m_ext; + bool m_suppressNotify; + + // these methods are not publicly accessible (as wxMimeTypesManager + // doesn't know about them), and should only be called by Unassociate + + bool RemoveOpenCommand(); + bool RemoveCommand(const wxString& verb); + bool RemoveMimeType(); + bool RemoveDefaultIcon(); + bool RemoveDescription(); +}; + +class WXDLLIMPEXP_BASE wxMimeTypesManagerImpl +{ +public: + // nothing to do here, we don't load any data but just go and fetch it from + // the registry when asked for + wxMimeTypesManagerImpl() { } + + // implement containing class functions + wxFileType *GetFileTypeFromExtension(const wxString& ext); + wxFileType *GetOrAllocateFileTypeFromExtension(const wxString& ext); + wxFileType *GetFileTypeFromMimeType(const wxString& mimeType); + + size_t EnumAllFileTypes(wxArrayString& mimetypes); + + // create a new filetype association + wxFileType *Associate(const wxFileTypeInfo& ftInfo); + + // create a new filetype with the given name and extension + wxFileType *CreateFileType(const wxString& filetype, const wxString& ext); +}; + +#endif // wxUSE_MIMETYPE + +#endif + //_MIMETYPE_IMPL_H + diff --git a/lib/wxWidgets/include/wx/msw/minifram.h b/lib/wxWidgets/include/wx/msw/minifram.h new file mode 100644 index 0000000..fe72023 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/minifram.h @@ -0,0 +1,51 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/minifram.h +// Purpose: wxMiniFrame class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MINIFRAM_H_ +#define _WX_MINIFRAM_H_ + +#include "wx/frame.h" + +class WXDLLIMPEXP_CORE wxMiniFrame : public wxFrame +{ +public: + wxMiniFrame() { } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + return wxFrame::Create(parent, id, title, pos, size, + style | + wxFRAME_TOOL_WINDOW | + (parent ? wxFRAME_FLOAT_ON_PARENT : 0), name); + } + + wxMiniFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Create(parent, id, title, pos, size, style, name); + } + +protected: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMiniFrame); +}; + +#endif + // _WX_MINIFRAM_H_ diff --git a/lib/wxWidgets/include/wx/msw/missing.h b/lib/wxWidgets/include/wx/msw/missing.h new file mode 100644 index 0000000..1cb4036 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/missing.h @@ -0,0 +1,437 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/missing.h +// Purpose: Declarations for parts of the Win32 SDK that are missing in +// the versions that come with some compilers +// Created: 2002/04/23 +// Copyright: (c) 2002 Mattia Barbon +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MISSING_H_ +#define _WX_MISSING_H_ + +#ifndef WM_CHANGEUISTATE + #define WM_CHANGEUISTATE 0x0127 +#endif + +#ifndef WM_UPDATEUISTATE + #define WM_UPDATEUISTATE 0x0128 +#endif + +#ifndef WM_QUERYUISTATE + #define WM_QUERYUISTATE 0x0129 +#endif + +#ifndef WM_PRINTCLIENT + #define WM_PRINTCLIENT 0x0318 +#endif + +#ifndef WM_DPICHANGED + #define WM_DPICHANGED 0x02E0 +#endif + +#ifndef DT_HIDEPREFIX + #define DT_HIDEPREFIX 0x00100000 +#endif + +#ifndef DSS_HIDEPREFIX + #define DSS_HIDEPREFIX 0x0200 +#endif + +// Needed by toplevel.cpp +#ifndef UIS_SET + #define UIS_SET 1 + #define UIS_CLEAR 2 + #define UIS_INITIALIZE 3 +#endif + +#ifndef UISF_HIDEFOCUS + #define UISF_HIDEFOCUS 1 +#endif + +#ifndef UISF_HIDEACCEL + #define UISF_HIDEACCEL 2 +#endif + +#ifndef OFN_EXPLORER + #define OFN_EXPLORER 0x00080000 +#endif + +#ifndef OFN_ENABLESIZING + #define OFN_ENABLESIZING 0x00800000 +#endif + +// Needed by window.cpp +#if wxUSE_MOUSEWHEEL + #ifndef WM_MOUSEWHEEL + #define WM_MOUSEWHEEL 0x020A + #endif + #ifndef WM_MOUSEHWHEEL + #define WM_MOUSEHWHEEL 0x020E + #endif + #ifndef WHEEL_DELTA + #define WHEEL_DELTA 120 + #endif + #ifndef SPI_GETWHEELSCROLLLINES + #define SPI_GETWHEELSCROLLLINES 104 + #endif + #ifndef SPI_GETWHEELSCROLLCHARS + #define SPI_GETWHEELSCROLLCHARS 108 + #endif +#endif // wxUSE_MOUSEWHEEL + +// Needed by window.cpp +#ifndef VK_OEM_1 + #define VK_OEM_1 0xBA + #define VK_OEM_2 0xBF + #define VK_OEM_3 0xC0 + #define VK_OEM_4 0xDB + #define VK_OEM_5 0xDC + #define VK_OEM_6 0xDD + #define VK_OEM_7 0xDE + #define VK_OEM_102 0xE2 +#endif + +#ifndef VK_OEM_COMMA + #define VK_OEM_PLUS 0xBB + #define VK_OEM_COMMA 0xBC + #define VK_OEM_MINUS 0xBD + #define VK_OEM_PERIOD 0xBE +#endif + +#ifndef SM_TABLETPC + #define SM_TABLETPC 86 +#endif + +#ifndef INKEDIT_CLASS +# define INKEDIT_CLASSW L"INKEDIT" +# ifdef UNICODE +# define INKEDIT_CLASS INKEDIT_CLASSW +# else +# define INKEDIT_CLASS "INKEDIT" +# endif +#endif + +#ifndef EM_SETINKINSERTMODE +# define EM_SETINKINSERTMODE (WM_USER + 0x0204) +#endif + +#ifndef EM_SETUSEMOUSEFORINPUT +#define EM_SETUSEMOUSEFORINPUT (WM_USER + 0x224) +#endif + +#ifndef TPM_RECURSE +#define TPM_RECURSE 1 +#endif + + +#ifndef WS_EX_LAYOUTRTL +#define WS_EX_LAYOUTRTL 0x00400000 +#endif + +#ifndef WS_EX_COMPOSITED +#define WS_EX_COMPOSITED 0x02000000L +#endif + +#ifndef WS_EX_LAYERED +#define WS_EX_LAYERED 0x00080000 +#endif + +#ifndef LWA_ALPHA +#define LWA_ALPHA 2 +#endif + +#ifndef QS_ALLPOSTMESSAGE +#define QS_ALLPOSTMESSAGE 0 +#endif + +// Missing from MinGW 4.8 SDK headers. +#ifndef BS_TYPEMASK +#define BS_TYPEMASK 0xf +#endif + +// ---------------------------------------------------------------------------- +// menu stuff +// ---------------------------------------------------------------------------- + +#ifndef MIIM_BITMAP + #define MIIM_STRING 0x00000040 + #define MIIM_BITMAP 0x00000080 + #define MIIM_FTYPE 0x00000100 + #define HBMMENU_CALLBACK ((HBITMAP) -1) + + typedef struct tagMENUINFO + { + DWORD cbSize; + DWORD fMask; + DWORD dwStyle; + UINT cyMax; + HBRUSH hbrBack; + DWORD dwContextHelpID; + DWORD dwMenuData; + } MENUINFO, FAR *LPMENUINFO; +#endif // MIIM_BITMAP &c + +// ---------------------------------------------------------------------------- +// definitions related to ListView and Header common controls, needed by +// msw/listctrl.cpp and msw/headerctrl.cpp +// ---------------------------------------------------------------------------- + +#ifndef I_IMAGENONE + #define I_IMAGENONE (-2) +#endif + +#ifndef LVS_EX_FULLROWSELECT + #define LVS_EX_FULLROWSELECT 0x00000020 +#endif + +#if !defined(LVS_EX_LABELTIP) + #define LVS_EX_LABELTIP 0x00004000 +#endif + +#ifndef LVS_EX_SUBITEMIMAGES + #define LVS_EX_SUBITEMIMAGES 0x00000002 +#endif + +#ifndef LVS_EX_DOUBLEBUFFER + #define LVS_EX_DOUBLEBUFFER 0x00010000 +#endif + +#ifndef HDN_GETDISPINFOW + #define HDN_GETDISPINFOW (HDN_FIRST-29) +#endif + +#ifndef HDS_HOTTRACK + #define HDS_HOTTRACK 4 +#endif +#ifndef HDS_FLAT + #define HDS_FLAT 0x0200 +#endif +#ifndef HDS_NOSIZING + #define HDS_NOSIZING 0x0800 +#endif + +#ifndef HDF_SORTUP + #define HDF_SORTUP 0x0400 + #define HDF_SORTDOWN 0x0200 +#endif + + /* + * In addition to the above, the following are required for several compilers. + */ + +#if !defined(CCS_VERT) +#define CCS_VERT 0x00000080L +#endif + +#if !defined(CCS_RIGHT) +#define CCS_RIGHT (CCS_VERT|CCS_BOTTOM) +#endif + +#if !defined(TB_SETDISABLEDIMAGELIST) + #define TB_SETDISABLEDIMAGELIST (WM_USER + 54) +#endif // !defined(TB_SETDISABLEDIMAGELIST) + +#ifndef HANGUL_CHARSET + #define HANGUL_CHARSET 129 +#endif + +#ifndef CCM_SETUNICODEFORMAT + #define CCM_SETUNICODEFORMAT 8197 +#endif + +// ---------------------------------------------------------------------------- +// Tree control +// ---------------------------------------------------------------------------- + +#ifndef TV_FIRST + #define TV_FIRST 0x1100 +#endif + +#ifndef TVS_EX_DOUBLEBUFFER + #define TVS_EX_DOUBLEBUFFER 0x0004 +#endif + +#ifndef TVS_FULLROWSELECT + #define TVS_FULLROWSELECT 0x1000 +#endif + +#ifndef TVM_SETBKCOLOR + #define TVM_SETBKCOLOR (TV_FIRST + 29) + #define TVM_SETTEXTCOLOR (TV_FIRST + 30) +#endif + +#ifndef TVM_SETEXTENDEDSTYLE + #define TVM_SETEXTENDEDSTYLE (TV_FIRST + 44) + #define TVM_GETEXTENDEDSTYLE (TV_FIRST + 45) +#endif + +// Various defines used by the webview library that are needed by mingw + +#ifndef DISPID_COMMANDSTATECHANGE +#define DISPID_COMMANDSTATECHANGE 105 +#endif + +#ifndef DISPID_NAVIGATECOMPLETE2 +#define DISPID_NAVIGATECOMPLETE2 252 +#endif + +#ifndef DISPID_NAVIGATEERROR +#define DISPID_NAVIGATEERROR 271 +#endif + +#ifndef DISPID_NEWWINDOW3 +#define DISPID_NEWWINDOW3 273 +#endif + +#ifndef INET_E_ERROR_FIRST +#define INET_E_ERROR_FIRST ((long)0x800C0002L) +#endif + +#ifndef INET_E_INVALID_URL +#define INET_E_INVALID_URL ((long)0x800C0002L) +#endif + +#ifndef INET_E_NO_SESSION +#define INET_E_NO_SESSION ((long)0x800C0003L) +#endif + +#ifndef INET_E_CANNOT_CONNECT +#define INET_E_CANNOT_CONNECT ((long)0x800C0004L) +#endif + +#ifndef INET_E_RESOURCE_NOT_FOUND +#define INET_E_RESOURCE_NOT_FOUND ((long)0x800C0005L) +#endif + +#ifndef INET_E_OBJECT_NOT_FOUND +#define INET_E_OBJECT_NOT_FOUND ((long)0x800C0006L) +#endif + +#ifndef INET_E_DATA_NOT_AVAILABLE +#define INET_E_DATA_NOT_AVAILABLE ((long)0x800C0007L) +#endif + +#ifndef INET_E_DOWNLOAD_FAILURE +#define INET_E_DOWNLOAD_FAILURE ((long)0x800C0008L) +#endif + +#ifndef INET_E_AUTHENTICATION_REQUIRED +#define INET_E_AUTHENTICATION_REQUIRED ((long)0x800C0009L) +#endif + +#ifndef INET_E_NO_VALID_MEDIA +#define INET_E_NO_VALID_MEDIA ((long)0x800C000AL) +#endif + +#ifndef INET_E_CONNECTION_TIMEOUT +#define INET_E_CONNECTION_TIMEOUT ((long)0x800C000BL) +#endif + +#ifndef INET_E_INVALID_REQUEST +#define INET_E_INVALID_REQUEST ((long)0x800C000CL) +#endif + +#ifndef INET_E_UNKNOWN_PROTOCOL +#define INET_E_UNKNOWN_PROTOCOL ((long)0x800C000DL) +#endif + +#ifndef INET_E_SECURITY_PROBLEM +#define INET_E_SECURITY_PROBLEM ((long)0x800C000EL) +#endif + +#ifndef INET_E_CANNOT_LOAD_DATA +#define INET_E_CANNOT_LOAD_DATA ((long)0x800C000FL) +#endif + +#ifndef INET_E_CANNOT_INSTANTIATE_OBJECT +#define INET_E_CANNOT_INSTANTIATE_OBJECT ((long)0x800C0010L) +#endif + +#ifndef INET_E_QUERYOPTION_UNKNOWN +#define INET_E_QUERYOPTION_UNKNOWN ((long)0x800C0013L) +#endif + +#ifndef INET_E_REDIRECT_FAILED +#define INET_E_REDIRECT_FAILED ((long)0x800C0014L) +#endif + +#ifndef INET_E_REDIRECT_TO_DIR +#define INET_E_REDIRECT_TO_DIR ((long)0x800C0015L) +#endif + +#ifndef INET_E_CANNOT_LOCK_REQUEST +#define INET_E_CANNOT_LOCK_REQUEST ((long)0x800C0016L) +#endif + +#ifndef INET_E_USE_EXTEND_BINDING +#define INET_E_USE_EXTEND_BINDING ((long)0x800C0017L) +#endif + +#ifndef INET_E_TERMINATED_BIND +#define INET_E_TERMINATED_BIND ((long)0x800C0018L) +#endif + +#ifndef INET_E_INVALID_CERTIFICATE +#define INET_E_INVALID_CERTIFICATE ((long)0x800C0019L) +#endif + +#ifndef INET_E_CODE_DOWNLOAD_DECLINED +#define INET_E_CODE_DOWNLOAD_DECLINED ((long)0x800C0100L) +#endif + +#ifndef INET_E_RESULT_DISPATCHED +#define INET_E_RESULT_DISPATCHED ((long)0x800C0200L) +#endif + +#ifndef INET_E_CANNOT_REPLACE_SFP_FILE +#define INET_E_CANNOT_REPLACE_SFP_FILE ((long)0x800C0300L) +#endif + +#ifndef INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY +#define INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY ((long)0x800C0500L) +#endif + +#ifndef INET_E_CODE_INSTALL_SUPPRESSED +#define INET_E_CODE_INSTALL_SUPPRESSED ((long)0x800C0400L) +#endif + +#ifndef MUI_LANGUAGE_NAME +#define MUI_LANGUAGE_NAME 0x8 +#endif + +#ifndef WDA_NONE +#define WDA_NONE 0x0 +#endif + +#ifndef WDA_MONITOR +#define WDA_MONITOR 0x1 +#endif + +#ifndef WDA_EXCLUDEFROMCAPTURE +#define WDA_EXCLUDEFROMCAPTURE 0x11 +#endif + + /* + * The following are specifically required for Wine + */ + +#ifdef __WINE__ + #ifndef ENUM_CURRENT_SETTINGS + #define ENUM_CURRENT_SETTINGS ((DWORD)-1) + #endif + #ifndef BROADCAST_QUERY_DENY + #define BROADCAST_QUERY_DENY 1112363332 + #endif +#endif // defined __WINE__ + +#ifndef INVALID_FILE_ATTRIBUTES + #define INVALID_FILE_ATTRIBUTES ((DWORD)-1) +#endif + +#ifndef OFN_FORCESHOWHIDDEN + #define OFN_FORCESHOWHIDDEN 0x10000000 +#endif + +#endif + // _WX_MISSING_H_ diff --git a/lib/wxWidgets/include/wx/msw/msgdlg.h b/lib/wxWidgets/include/wx/msw/msgdlg.h new file mode 100644 index 0000000..8996ee9 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/msgdlg.h @@ -0,0 +1,74 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/msgdlg.h +// Purpose: wxMessageDialog class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSGBOXDLG_H_ +#define _WX_MSGBOXDLG_H_ + +class WXDLLIMPEXP_CORE wxMessageDialog : public wxMessageDialogBase +{ +public: + wxMessageDialog(wxWindow *parent, + const wxString& message, + const wxString& caption = wxASCII_STR(wxMessageBoxCaptionStr), + long style = wxOK|wxCENTRE, + const wxPoint& WXUNUSED(pos) = wxDefaultPosition) + : wxMessageDialogBase(parent, message, caption, style) + { + m_hook = NULL; + } + + virtual int ShowModal() wxOVERRIDE; + + virtual long GetEffectiveIcon() const wxOVERRIDE; + + // implementation-specific + + // return the font used for the text in the message box + static wxFont GetMessageFont(); + +protected: + // Override this as task dialogs are always centered on parent. + virtual void DoCentre(int dir) wxOVERRIDE; + +private: + // hook procedure used to adjust the message box beyond what the standard + // MessageBox() function can do for us + static WXLRESULT wxCALLBACK HookFunction(int code, WXWPARAM, WXLPARAM); + + static const struct ButtonAccessors + { + int id; + wxString (wxMessageDialog::*getter)() const; + } ms_buttons[]; + + // replace the static text control with a text control in order to show + // scrollbar (and also, incidentally, allow text selection) + void ReplaceStaticWithEdit(); + + // adjust the button labels + // + // this is called from HookFunction() and our HWND is valid at this moment + void AdjustButtonLabels(); + + // offset all buttons starting from the first one given by dx to the right + void OffsetButtonsStartingFrom(int first, int dx); + + // used by ShowModal() to display a message box when task dialogs + // aren't available. + int ShowMessageBox(); + + + WXHANDLE m_hook; // HHOOK used to position the message box + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMessageDialog); +}; + + +#endif // _WX_MSGBOXDLG_H_ diff --git a/lib/wxWidgets/include/wx/msw/msvcrt.h b/lib/wxWidgets/include/wx/msw/msvcrt.h new file mode 100644 index 0000000..c58f505 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/msvcrt.h @@ -0,0 +1,78 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/msvcrt.h +// Purpose: macros to use some non-standard features of MS Visual C++ +// C run-time library +// Author: Vadim Zeitlin +// Modified by: +// Created: 31.01.1999 +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// Note that this file globally redefines "new" keyword breaking the use of +// placement new in any code parsed after it. If you run into this problem, the +// solutions are, in order of preference: +// +// 1. Don't include this header at all. Use better tools for memory debugging. +// 2. Predefine __NO_VC_CRTDBG__ before including it (basically the same as 1). +// 3. Do "#undef new" before and "#define new WXDEBUG_NEW" in your own code +// before/after using placement new or before/after including third part +// headers using it. + +// the goal of this file is to define wxCrtSetDbgFlag() macro which may be +// used like this: +// wxCrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF); +// to turn on memory leak checks for programs compiled with Microsoft Visual +// C++ (5.0+). The macro will not be defined under other compilers or if it +// can't be used with MSVC for whatever reason. + +#ifndef _MSW_MSVCRT_H_ +#define _MSW_MSVCRT_H_ + +// use debug CRT functions for memory leak detections in VC++ 5.0+ in debug +// builds +#undef wxUSE_VC_CRTDBG +#if defined(_DEBUG) && defined(__VISUALC__) + // it doesn't combine well with wxWin own memory debugging methods + #if !wxUSE_GLOBAL_MEMORY_OPERATORS && !wxUSE_MEMORY_TRACING && !defined(__NO_VC_CRTDBG__) + #define wxUSE_VC_CRTDBG + #endif +#endif + +#ifdef wxUSE_VC_CRTDBG + // Need to undef new if including crtdbg.h which may redefine new itself + #ifdef new + #undef new + #endif + + #include <stdlib.h> + + // Defining _CRTBLD should never be necessary at all, but keep it for now + // as there is no time to retest all the compilers before 3.0 release. + // Definitely do not use it with MSVS 2013 as defining it results in errors + // if the standard <assert.h> is included afterwards. + #if !defined(_CRTBLD) && !wxCHECK_VISUALC_VERSION(12) + // Needed when building with pure MS SDK + #define _CRTBLD + #endif + + #include <crtdbg.h> + + #undef WXDEBUG_NEW + #define WXDEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) + + // this define works around a bug with inline declarations of new, see + // + // http://support.microsoft.com/kb/q140858/ + // + // for the details + #define new WXDEBUG_NEW + + #define wxCrtSetDbgFlag(flag) \ + _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | (flag)) +#else // !using VC CRT + #define wxCrtSetDbgFlag(flag) +#endif // wxUSE_VC_CRTDBG + +#endif // _MSW_MSVCRT_H_ + diff --git a/lib/wxWidgets/include/wx/msw/nonownedwnd.h b/lib/wxWidgets/include/wx/msw/nonownedwnd.h new file mode 100644 index 0000000..1074928 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/nonownedwnd.h @@ -0,0 +1,56 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/nonownedwnd.h +// Purpose: wxNonOwnedWindow declaration for wxMSW. +// Author: Vadim Zeitlin +// Created: 2011-10-09 +// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_NONOWNEDWND_H_ +#define _WX_MSW_NONOWNEDWND_H_ + +class wxNonOwnedWindowShapeImpl; + +// ---------------------------------------------------------------------------- +// wxNonOwnedWindow +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxNonOwnedWindowBase +{ +public: + wxNonOwnedWindow(); + virtual ~wxNonOwnedWindow(); + + virtual bool Reparent(wxWindowBase* newParent) wxOVERRIDE; + virtual bool IsThisEnabled() const wxOVERRIDE; + +protected: + virtual bool DoClearShape() wxOVERRIDE; + virtual bool DoSetRegionShape(const wxRegion& region) wxOVERRIDE; +#if wxUSE_GRAPHICS_CONTEXT + virtual bool DoSetPathShape(const wxGraphicsPath& path) wxOVERRIDE; +#endif // wxUSE_GRAPHICS_CONTEXT + + virtual WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) wxOVERRIDE; + +private: + bool HandleDPIChange(const wxSize& newDPI, const wxRect& newRect); + +#if wxUSE_GRAPHICS_CONTEXT + wxNonOwnedWindowShapeImpl* m_shapeImpl; +#endif // wxUSE_GRAPHICS_CONTEXT + + // Keep track of the DPI used in this window. So when per-monitor dpi + // awareness is enabled, both old and new DPI are known for + // wxDPIChangedEvent and wxWindow::MSWUpdateOnDPIChange. + wxSize m_activeDPI; + + // This window supports handling per-monitor DPI awareness when the + // application manifest contains <dpiAwareness>PerMonitorV2</dpiAwareness>. + bool m_perMonitorDPIaware; + + wxDECLARE_NO_COPY_CLASS(wxNonOwnedWindow); +}; + +#endif // _WX_MSW_NONOWNEDWND_H_ diff --git a/lib/wxWidgets/include/wx/msw/notebook.h b/lib/wxWidgets/include/wx/msw/notebook.h new file mode 100644 index 0000000..12bf1ac --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/notebook.h @@ -0,0 +1,199 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/notebook.h +// Purpose: MSW/GTK compatible notebook (a.k.a. property sheet) +// Author: Robert Roebling +// Modified by: Vadim Zeitlin for Windows version +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _NOTEBOOK_H +#define _NOTEBOOK_H + +#if wxUSE_NOTEBOOK + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/control.h" + +// ---------------------------------------------------------------------------- +// wxNotebook +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase +{ +public: + // ctors + // ----- + // default for dynamic class + wxNotebook(); + // the same arguments as for wxControl (@@@ any special styles?) + wxNotebook(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxNotebookNameStr)); + // Create() function + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxNotebookNameStr)); + virtual ~wxNotebook(); + + // accessors + // --------- + // get number of pages in the dialog + virtual size_t GetPageCount() const wxOVERRIDE; + + // set the currently selected page, return the index of the previously + // selected one (or wxNOT_FOUND on error) + // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events + int SetSelection(size_t nPage) wxOVERRIDE; + + // changes selected page without sending events + int ChangeSelection(size_t nPage) wxOVERRIDE; + + // set/get the title of a page + bool SetPageText(size_t nPage, const wxString& strText) wxOVERRIDE; + wxString GetPageText(size_t nPage) const wxOVERRIDE; + + // sets/returns item's image index in the current image list + int GetPageImage(size_t nPage) const wxOVERRIDE; + bool SetPageImage(size_t nPage, int nImage) wxOVERRIDE; + + // currently it's always 1 because wxGTK doesn't support multi-row + // tab controls + int GetRowCount() const wxOVERRIDE; + + // control the appearance of the notebook pages + // set the size (the same for all pages) + void SetPageSize(const wxSize& size) wxOVERRIDE; + // set the padding between tabs (in pixels) + void SetPadding(const wxSize& padding) wxOVERRIDE; + + // operations + // ---------- + // remove all pages + bool DeleteAllPages() wxOVERRIDE; + + // inserts a new page to the notebook (it will be deleted ny the notebook, + // don't delete it yourself). If bSelect, this page becomes active. + bool InsertPage(size_t nPage, + wxNotebookPage *pPage, + const wxString& strText, + bool bSelect = false, + int imageId = NO_IMAGE) wxOVERRIDE; + + // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH + // style. + void SetTabSize(const wxSize& sz) wxOVERRIDE; + + // hit test + virtual int HitTest(const wxPoint& pt, long *flags = NULL) const wxOVERRIDE; + + // calculate the size of the notebook from the size of its page + virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const wxOVERRIDE; + + // callbacks + // --------- + void OnSize(wxSizeEvent& event); + void OnNavigationKey(wxNavigationKeyEvent& event); + + // base class virtuals + // ------------------- + + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) wxOVERRIDE; + virtual bool MSWOnScroll(int orientation, WXWORD nSBCode, + WXWORD pos, WXHWND control) wxOVERRIDE; + +#if wxUSE_CONSTRAINTS + virtual void SetConstraintSizes(bool recurse = true) wxOVERRIDE; + virtual bool DoPhase(int nPhase) wxOVERRIDE; +#endif // wxUSE_CONSTRAINTS + + // Attempts to get colour for UX theme page background + wxColour GetThemeBackgroundColour() const wxOVERRIDE; + + // implementation only + // ------------------- + + virtual bool SetBackgroundColour(const wxColour& colour) wxOVERRIDE; + +#if wxUSE_UXTHEME + // draw child background + virtual bool MSWPrintChild(WXHDC hDC, wxWindow *win) wxOVERRIDE; + + virtual bool MSWHasInheritableBackground() const wxOVERRIDE { return true; } +#endif // wxUSE_UXTHEME + + // translate wxWin styles to the Windows ones + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const wxOVERRIDE; + +protected: + // common part of all ctors + void Init(); + + // hides the currently shown page and shows the given one (if not -1) and + // updates m_selection accordingly + void UpdateSelection(int selNew); + + // remove one page from the notebook, without deleting + virtual wxNotebookPage *DoRemovePage(size_t nPage) wxOVERRIDE; + + // update the image list used by the native control + virtual void OnImagesChanged() wxOVERRIDE; + + // get the page rectangle for the current notebook size + // + // returns empty rectangle if an error occurs, do test for it + wxRect GetPageSize() const; + + // set the size of the given page to fit in the notebook + void AdjustPageSize(wxNotebookPage *page); + +#if wxUSE_UXTHEME + virtual void MSWAdjustBrushOrg(int *xOrg, int* yOrg) const wxOVERRIDE + { + *xOrg -= m_bgBrushAdj.x; + *yOrg -= m_bgBrushAdj.y; + } + + // return the themed brush for painting our children + virtual WXHBRUSH MSWGetCustomBgBrush() wxOVERRIDE { return m_hbrBackground; } + + // gets the bitmap of notebook background and returns a brush from it and + // sets m_bgBrushAdj + WXHBRUSH QueryBgBitmap(); + + // creates the brush to be used for drawing the tab control background + void UpdateBgBrush(); +#endif // wxUSE_UXTHEME + + // these function are used for reducing flicker on notebook resize + void OnEraseBackground(wxEraseEvent& event); + void OnPaint(wxPaintEvent& event); + + // true if we have already subclassed our updown control + bool m_hasSubclassedUpdown; + +#if wxUSE_UXTHEME + // background brush used to paint the tab control + WXHBRUSH m_hbrBackground; + + // offset for MSWAdjustBrushOrg() + wxPoint m_bgBrushAdj; +#endif // wxUSE_UXTHEME + + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxNotebook); + wxDECLARE_EVENT_TABLE(); +}; + +#endif // wxUSE_NOTEBOOK + +#endif // _NOTEBOOK_H diff --git a/lib/wxWidgets/include/wx/msw/ole/access.h b/lib/wxWidgets/include/wx/msw/ole/access.h new file mode 100644 index 0000000..a7dcda4 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/ole/access.h @@ -0,0 +1,68 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/ole/access.h +// Purpose: declaration of the wxAccessible class +// Author: Julian Smart +// Modified by: +// Created: 2003-02-12 +// Copyright: (c) 2003 Julian Smart +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ACCESS_H_ +#define _WX_ACCESS_H_ + +#if wxUSE_ACCESSIBILITY + +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- + +struct IAccessible; +class wxIAccessible; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// wxAccessible implements accessibility behaviour. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxAccessible : public wxAccessibleBase +{ +public: + wxAccessible(wxWindow *win = NULL); + virtual ~wxAccessible(); + +// Overridables + +// Accessors + + // Returns the wxIAccessible pointer + wxIAccessible* GetIAccessible() { return m_pIAccessible; } + + // Returns the IAccessible standard interface pointer + IAccessible* GetIAccessibleStd(); + +// Operations + + // Sends an event when something changes in an accessible object. + static void NotifyEvent(int eventType, wxWindow* window, wxAccObject objectType, + int objectId); + +protected: + void Init(); + +private: + wxIAccessible * m_pIAccessible; // the pointer to COM interface + IAccessible* m_pIAccessibleStd; // the pointer to the standard COM interface, + // for default processing + + wxDECLARE_NO_COPY_CLASS(wxAccessible); +}; + +#endif //wxUSE_ACCESSIBILITY + +#endif //_WX_ACCESS_H_ + diff --git a/lib/wxWidgets/include/wx/msw/ole/activex.h b/lib/wxWidgets/include/wx/msw/ole/activex.h new file mode 100644 index 0000000..1518671 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/ole/activex.h @@ -0,0 +1,261 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/ole/activex.h +// Purpose: wxActiveXContainer class +// Author: Ryan Norton <wxprojects@comcast.net> +// Modified by: +// Created: 8/18/05 +// Copyright: (c) Ryan Norton +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// Definitions +// ============================================================================ + +#ifndef _WX_MSW_OLE_ACTIVEXCONTAINER_H_ +#define _WX_MSW_OLE_ACTIVEXCONTAINER_H_ + +#if wxUSE_ACTIVEX + +//--------------------------------------------------------------------------- +// wx includes +//--------------------------------------------------------------------------- + +#include "wx/msw/ole/oleutils.h" // wxBasicString &c +#include "wx/msw/ole/uuid.h" +#include "wx/window.h" +#include "wx/variant.h" + +class FrameSite; + +//--------------------------------------------------------------------------- +// MSW COM includes +//--------------------------------------------------------------------------- +#include <oleidl.h> +#include <olectl.h> + +#include <exdisp.h> + +#include <docobj.h> + +#ifndef STDMETHOD + #define STDMETHOD(funcname) virtual HRESULT wxSTDCALL funcname +#endif + +// +// These defines are from another ole header - but its not in the +// latest sdk. Also the ifndef DISPID_READYSTATE is here because at +// least on my machine with the latest sdk olectl.h defines these 3 +// +#ifndef DISPID_READYSTATE + #define DISPID_READYSTATE (-525) + #define DISPID_READYSTATECHANGE (-609) + #define DISPID_AMBIENT_TRANSFERPRIORITY (-728) +#endif + +#define DISPID_AMBIENT_OFFLINEIFNOTCONNECTED (-5501) +#define DISPID_AMBIENT_SILENT (-5502) + +#ifndef DISPID_AMBIENT_CODEPAGE + #define DISPID_AMBIENT_CODEPAGE (-725) + #define DISPID_AMBIENT_CHARSET (-727) +#endif + + +//--------------------------------------------------------------------------- +// +// wxActiveXContainer +// +//--------------------------------------------------------------------------- + +template<typename I> +class wxAutoOleInterface +{ +public: + typedef I Interface; + + explicit wxAutoOleInterface(I *pInterface = NULL) : m_interface(pInterface) + {} + wxAutoOleInterface(REFIID riid, IUnknown *pUnk) : m_interface(NULL) + { QueryInterface(riid, pUnk); } + wxAutoOleInterface(REFIID riid, IDispatch *pDispatch) : m_interface(NULL) + { QueryInterface(riid, pDispatch); } + wxAutoOleInterface(REFCLSID clsid, REFIID riid) : m_interface(NULL) + { CreateInstance(clsid, riid); } + wxAutoOleInterface(const wxAutoOleInterface& ti) : m_interface(NULL) + { operator=(ti); } + + wxAutoOleInterface& operator=(const wxAutoOleInterface& ti) + { + if ( ti.m_interface ) + ti.m_interface->AddRef(); + Free(); + m_interface = ti.m_interface; + return *this; + } + + wxAutoOleInterface& operator=(I*& ti) + { + Free(); + m_interface = ti; + return *this; + } + + ~wxAutoOleInterface() { Free(); } + + void Free() + { + if ( m_interface ) + m_interface->Release(); + m_interface = NULL; + } + + HRESULT QueryInterface(REFIID riid, IUnknown *pUnk) + { + Free(); + wxASSERT(pUnk != NULL); + return pUnk->QueryInterface(riid, (void **)&m_interface); + } + + HRESULT CreateInstance(REFCLSID clsid, REFIID riid) + { + Free(); + return CoCreateInstance + ( + clsid, + NULL, + CLSCTX_ALL, + riid, + (void **)&m_interface + ); + } + + operator I*() const {return m_interface; } + I* operator->() {return m_interface; } + I** GetRef() {return &m_interface; } + bool Ok() const { return IsOk(); } + bool IsOk() const { return m_interface != NULL; } + +protected: + I *m_interface; +}; + +#if WXWIN_COMPATIBILITY_2_8 +// this macro is kept for compatibility with older wx versions +#define WX_DECLARE_AUTOOLE(wxAutoOleInterfaceType, I) \ + typedef wxAutoOleInterface<I> wxAutoOleInterfaceType; +#endif // WXWIN_COMPATIBILITY_2_8 + +typedef wxAutoOleInterface<IDispatch> wxAutoIDispatch; +typedef wxAutoOleInterface<IOleClientSite> wxAutoIOleClientSite; +typedef wxAutoOleInterface<IUnknown> wxAutoIUnknown; +typedef wxAutoOleInterface<IOleObject> wxAutoIOleObject; +typedef wxAutoOleInterface<IOleInPlaceObject> wxAutoIOleInPlaceObject; +typedef wxAutoOleInterface<IOleInPlaceActiveObject> wxAutoIOleInPlaceActiveObject; +typedef wxAutoOleInterface<IOleDocumentView> wxAutoIOleDocumentView; +typedef wxAutoOleInterface<IViewObject> wxAutoIViewObject; + +class WXDLLIMPEXP_CORE wxActiveXContainer : public wxWindow +{ +public: + wxActiveXContainer(wxWindow * parent, REFIID iid, IUnknown* pUnk); + virtual ~wxActiveXContainer(); + + void OnSize(wxSizeEvent&); + void OnPaint(wxPaintEvent&); + void OnSetFocus(wxFocusEvent&); + void OnKillFocus(wxFocusEvent&); + virtual bool MSWTranslateMessage(WXMSG* pMsg) wxOVERRIDE; + virtual bool QueryClientSiteInterface(REFIID iid, void **_interface, const char *&desc); + +protected: + friend class FrameSite; + friend class wxActiveXEvents; + + FrameSite *m_frameSite; + wxAutoIDispatch m_Dispatch; + wxAutoIOleClientSite m_clientSite; + wxAutoIUnknown m_ActiveX; + wxAutoIOleObject m_oleObject; + wxAutoIOleInPlaceObject m_oleInPlaceObject; + wxAutoIOleInPlaceActiveObject m_oleInPlaceActiveObject; + wxAutoIOleDocumentView m_docView; + wxAutoIViewObject m_viewObject; + HWND m_oleObjectHWND; + bool m_bAmbientUserMode; + DWORD m_docAdviseCookie; + wxWindow* m_realparent; + + void CreateActiveX(REFIID, IUnknown*); +}; + +///\brief Store native event parameters. +///\detail Store OLE 'Invoke' parameters for event handlers that need to access them. +/// These are the exact values for the event as they are passed to the wxActiveXContainer. +struct wxActiveXEventNativeMSW +{ + DISPID dispIdMember; + REFIID riid; + LCID lcid; + WORD wFlags; + DISPPARAMS *pDispParams; + VARIANT *pVarResult; + EXCEPINFO *pExcepInfo; + unsigned int *puArgErr; + + wxActiveXEventNativeMSW + (DISPID a_dispIdMember, REFIID a_riid, LCID a_lcid, WORD a_wFlags, DISPPARAMS *a_pDispParams, + VARIANT *a_pVarResult, EXCEPINFO *a_pExcepInfo, unsigned int *a_puArgErr) + :dispIdMember(a_dispIdMember), riid(a_riid), lcid(a_lcid), wFlags(a_wFlags), pDispParams(a_pDispParams), + pVarResult(a_pVarResult), pExcepInfo(a_pExcepInfo), puArgErr(a_puArgErr) + { } +}; + +// Events +class WXDLLIMPEXP_CORE wxActiveXEvent : public wxCommandEvent +{ +private: + friend class wxActiveXEvents; + wxVariant m_params; + DISPID m_dispid; + +public: + virtual wxEvent *Clone() const wxOVERRIDE + { return new wxActiveXEvent(*this); } + + size_t ParamCount() const; + + wxString ParamType(size_t idx) const + { + wxASSERT(idx < ParamCount()); + return m_params[idx].GetType(); + } + + wxString ParamName(size_t idx) const + { + wxASSERT(idx < ParamCount()); + return m_params[idx].GetName(); + } + + wxVariant& operator[] (size_t idx); + + DISPID GetDispatchId() const + { return m_dispid; } + + wxActiveXEventNativeMSW *GetNativeParameters() const + { return (wxActiveXEventNativeMSW*)GetClientData(); } +}; + +// #define wxACTIVEX_ID 14001 +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_ACTIVEX, wxActiveXEvent ); + +typedef void (wxEvtHandler::*wxActiveXEventFunction)(wxActiveXEvent&); + +#define wxActiveXEventHandler(func) \ + wxEVENT_HANDLER_CAST( wxActiveXEventFunction, func ) + +#define EVT_ACTIVEX(id, fn) wxDECLARE_EVENT_TABLE_ENTRY(wxEVT_ACTIVEX, id, -1, wxActiveXEventHandler( fn ), NULL ), + +#endif // wxUSE_ACTIVEX + +#endif // _WX_MSW_OLE_ACTIVEXCONTAINER_H_ diff --git a/lib/wxWidgets/include/wx/msw/ole/automtn.h b/lib/wxWidgets/include/wx/msw/ole/automtn.h new file mode 100644 index 0000000..250aaef --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/ole/automtn.h @@ -0,0 +1,140 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/ole/automtn.h +// Purpose: OLE automation utilities +// Author: Julian Smart +// Modified by: +// Created: 11/6/98 +// Copyright: (c) 1998, Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_AUTOMTN_H_ +#define _WX_AUTOMTN_H_ + +#include "wx/defs.h" + +#if wxUSE_OLE_AUTOMATION + +#include "wx/object.h" +#include "wx/variant.h" + +typedef void WXIDISPATCH; +typedef unsigned short* WXBSTR; +typedef unsigned long WXLCID; + +#ifdef GetObject +#undef GetObject +#endif + +// Flags used with wxAutomationObject::GetInstance() +enum wxAutomationInstanceFlags +{ + // Only use the existing instance, never create a new one. + wxAutomationInstance_UseExistingOnly = 0, + + // Create a new instance if there are no existing ones. + wxAutomationInstance_CreateIfNeeded = 1, + + // Do not log errors if we failed to get the existing instance because none + // is available. + wxAutomationInstance_SilentIfNone = 2 +}; + +/* + * wxAutomationObject + * Wraps up an IDispatch pointer and invocation; does variant conversion. + */ + +class WXDLLIMPEXP_CORE wxAutomationObject: public wxObject +{ +public: + wxAutomationObject(WXIDISPATCH* dispatchPtr = NULL); + virtual ~wxAutomationObject(); + + // Set/get dispatch pointer + void SetDispatchPtr(WXIDISPATCH* dispatchPtr) { m_dispatchPtr = dispatchPtr; } + WXIDISPATCH* GetDispatchPtr() const { return m_dispatchPtr; } + bool IsOk() const { return m_dispatchPtr != NULL; } + + // Get a dispatch pointer from the current object associated + // with a ProgID, such as "Excel.Application" + bool GetInstance(const wxString& progId, + int flags = wxAutomationInstance_CreateIfNeeded) const; + + // Get a dispatch pointer from a new instance of the class + bool CreateInstance(const wxString& progId) const; + + // Low-level invocation function. Pass either an array of variants, + // or an array of pointers to variants. + bool Invoke(const wxString& member, int action, + wxVariant& retValue, int noArgs, wxVariant args[], const wxVariant* ptrArgs[] = NULL) const; + + // Invoke a member function + wxVariant CallMethod(const wxString& method, int noArgs, wxVariant args[]); + wxVariant CallMethodArray(const wxString& method, int noArgs, const wxVariant **args); + + // Convenience function + wxVariant CallMethod(const wxString& method, + const wxVariant& arg1 = wxNullVariant, const wxVariant& arg2 = wxNullVariant, + const wxVariant& arg3 = wxNullVariant, const wxVariant& arg4 = wxNullVariant, + const wxVariant& arg5 = wxNullVariant, const wxVariant& arg6 = wxNullVariant); + + // Get/Put property + wxVariant GetProperty(const wxString& property, int noArgs = 0, wxVariant args[] = NULL) const; + wxVariant GetPropertyArray(const wxString& property, int noArgs, const wxVariant **args) const; + wxVariant GetProperty(const wxString& property, + const wxVariant& arg1, const wxVariant& arg2 = wxNullVariant, + const wxVariant& arg3 = wxNullVariant, const wxVariant& arg4 = wxNullVariant, + const wxVariant& arg5 = wxNullVariant, const wxVariant& arg6 = wxNullVariant); + + bool PutPropertyArray(const wxString& property, int noArgs, const wxVariant **args); + bool PutProperty(const wxString& property, int noArgs, wxVariant args[]) ; + bool PutProperty(const wxString& property, + const wxVariant& arg1, const wxVariant& arg2 = wxNullVariant, + const wxVariant& arg3 = wxNullVariant, const wxVariant& arg4 = wxNullVariant, + const wxVariant& arg5 = wxNullVariant, const wxVariant& arg6 = wxNullVariant); + + // Uses DISPATCH_PROPERTYGET + // and returns a dispatch pointer. The calling code should call Release + // on the pointer, though this could be implicit by constructing a wxAutomationObject + // with it and letting the destructor call Release. + WXIDISPATCH* GetDispatchProperty(const wxString& property, int noArgs, wxVariant args[]) const; + WXIDISPATCH* GetDispatchProperty(const wxString& property, int noArgs, const wxVariant **args) const; + + // A way of initialising another wxAutomationObject with a dispatch object, + // without having to deal with nasty IDispatch pointers. + bool GetObject(wxAutomationObject& obj, const wxString& property, int noArgs = 0, wxVariant args[] = NULL) const; + bool GetObject(wxAutomationObject& obj, const wxString& property, int noArgs, const wxVariant **args) const; + + // Returns the locale identifier used in automation calls. The default is + // LOCALE_SYSTEM_DEFAULT. Objects obtained by GetObject() inherit the + // locale identifier from the one that created them. + WXLCID GetLCID() const; + + // Sets the locale identifier to be used in automation calls performed by + // this object. The default is LOCALE_SYSTEM_DEFAULT. + void SetLCID(WXLCID lcid); + + // Returns the flags used for conversions between wxVariant and OLE + // VARIANT, see wxOleConvertVariantFlags. The default value is + // wxOleConvertVariant_Default but all the objects obtained by GetObject() + // inherit the flags from the one that created them. + long GetConvertVariantFlags() const; + + // Sets the flags used for conversions between wxVariant and OLE VARIANT, + // see wxOleConvertVariantFlags (default is wxOleConvertVariant_Default. + void SetConvertVariantFlags(long flags); + +public: // public for compatibility only, don't use m_dispatchPtr directly. + WXIDISPATCH* m_dispatchPtr; + +private: + WXLCID m_lcid; + long m_convertVariantFlags; + + wxDECLARE_NO_COPY_CLASS(wxAutomationObject); +}; + +#endif // wxUSE_OLE_AUTOMATION + +#endif // _WX_AUTOMTN_H_ diff --git a/lib/wxWidgets/include/wx/msw/ole/comimpl.h b/lib/wxWidgets/include/wx/msw/ole/comimpl.h new file mode 100644 index 0000000..3f8b1c7 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/ole/comimpl.h @@ -0,0 +1,166 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/ole/comimpl.h +// Purpose: COM helper routines, COM debugging support &c +// Author: Vadim Zeitlin +// Modified by: +// Created: 19.02.1998 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef WX_COMIMPL_H +#define WX_COMIMPL_H + +#include "wx/defs.h" + +#include "wx/msw/wrapwin.h" +// get IUnknown, REFIID &c +#include <objbase.h> + +// ============================================================================ +// General purpose functions and macros +// ============================================================================ + +// release the interface pointer (if !NULL) +inline void ReleaseInterface(IUnknown *pIUnk) +{ + if ( pIUnk != NULL ) + pIUnk->Release(); +} + +// release the interface pointer (if !NULL) and make it NULL +#define RELEASE_AND_NULL(p) if ( (p) != NULL ) { p->Release(); p = NULL; }; + +// return true if the iid is in the array +extern WXDLLIMPEXP_CORE bool IsIidFromList(REFIID riid, const IID *aIids[], size_t nCount); + +// ============================================================================ +// IUnknown implementation helpers +// ============================================================================ + +/* + WARNING: This does NOT work with multiple inheritance, so multiple + interfaces can only be supported when they inherit from each other. + + The most dumb implementation of IUnknown methods. We don't support + aggregation nor containment, but for 99% of cases this simple + implementation is quite enough. + + Usage is trivial: here is all you should have + 1) DECLARE_IUNKNOWN_METHODS in your (IUnknown derived!) class declaration + 2) BEGIN/END_IID_TABLE with ADD_IID in between for all interfaces you + support (at least all for which you intent to return 'this' from QI, + i.e. you should derive from IFoo if you have ADD_IID(Foo)) somewhere else + 3) IMPLEMENT_IUNKNOWN_METHODS somewhere also + + These macros are quite simple: AddRef and Release are trivial and QI does + lookup in a static member array of IIDs and returns 'this' if it founds + the requested interface in it or E_NOINTERFACE if not. + */ + +/* + wxAutoULong: this class is used for automatically initialising m_cRef to 0 +*/ +class wxAutoULong +{ +public: + wxAutoULong(ULONG value = 0) : m_Value(value) { } + + operator ULONG&() { return m_Value; } + ULONG& operator=(ULONG value) { m_Value = value; return m_Value; } + + wxAutoULong& operator++() { ++m_Value; return *this; } + const wxAutoULong operator++( int ) { wxAutoULong temp = *this; ++m_Value; return temp; } + + wxAutoULong& operator--() { --m_Value; return *this; } + const wxAutoULong operator--( int ) { wxAutoULong temp = *this; --m_Value; return temp; } + +private: + ULONG m_Value; +}; + +// declare the methods and the member variable containing reference count +// you must also define the ms_aIids array somewhere with BEGIN_IID_TABLE +// and friends (see below) + +#define DECLARE_IUNKNOWN_METHODS \ + public: \ + STDMETHODIMP QueryInterface(REFIID, void **) wxOVERRIDE; \ + STDMETHODIMP_(ULONG) AddRef() wxOVERRIDE; \ + STDMETHODIMP_(ULONG) Release() wxOVERRIDE; \ + private: \ + static const IID *ms_aIids[]; \ + wxAutoULong m_cRef + +// macros for declaring supported interfaces +// NB: ADD_IID prepends IID_I whereas ADD_RAW_IID does not +#define BEGIN_IID_TABLE(cname) const IID *cname::ms_aIids[] = { +#define ADD_IID(iid) &IID_I##iid, +#define ADD_RAW_IID(iid) &iid, +#define END_IID_TABLE } + +// implementation is as straightforward as possible +// Parameter: classname - the name of the class +#define IMPLEMENT_IUNKNOWN_METHODS(classname) \ + STDMETHODIMP classname::QueryInterface(REFIID riid, void **ppv) \ + { \ + wxLogQueryInterface(wxT(#classname), riid); \ + \ + if ( IsIidFromList(riid, ms_aIids, WXSIZEOF(ms_aIids)) ) { \ + *ppv = this; \ + AddRef(); \ + \ + return S_OK; \ + } \ + else { \ + *ppv = NULL; \ + \ + return (HRESULT) E_NOINTERFACE; \ + } \ + } \ + \ + STDMETHODIMP_(ULONG) classname::AddRef() \ + { \ + wxLogAddRef(wxT(#classname), m_cRef); \ + \ + return ++m_cRef; \ + } \ + \ + STDMETHODIMP_(ULONG) classname::Release() \ + { \ + wxLogRelease(wxT(#classname), m_cRef); \ + \ + if ( --m_cRef == wxAutoULong(0) ) { \ + delete this; \ + return 0; \ + } \ + else \ + return m_cRef; \ + } + +// ============================================================================ +// Debugging support +// ============================================================================ + +// VZ: I don't know it's not done for compilers other than VC++ but I leave it +// as is. Please note, though, that tracing COM interface calls may be +// incredibly useful when debugging COM programs. +#if defined(__WXDEBUG__) && defined(__VISUALC__) +// ---------------------------------------------------------------------------- +// All COM specific log functions have DebugTrace level (as LogTrace) +// ---------------------------------------------------------------------------- + +// tries to translate riid into a symbolic name, if possible +WXDLLIMPEXP_CORE void wxLogQueryInterface(const wxChar *szInterface, REFIID riid); + +// these functions print out the new value of reference counter +WXDLLIMPEXP_CORE void wxLogAddRef (const wxChar *szInterface, ULONG cRef); +WXDLLIMPEXP_CORE void wxLogRelease(const wxChar *szInterface, ULONG cRef); + +#else //!__WXDEBUG__ + #define wxLogQueryInterface(szInterface, riid) + #define wxLogAddRef(szInterface, cRef) + #define wxLogRelease(szInterface, cRef) +#endif //__WXDEBUG__ + +#endif // WX_COMIMPL_H diff --git a/lib/wxWidgets/include/wx/msw/ole/dataform.h b/lib/wxWidgets/include/wx/msw/ole/dataform.h new file mode 100644 index 0000000..af239eb --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/ole/dataform.h @@ -0,0 +1,72 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/ole/dataform.h +// Purpose: declaration of the wxDataFormat class +// Author: Vadim Zeitlin +// Modified by: +// Created: 19.10.99 (extracted from msw/ole/dataobj.h) +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_OLE_DATAFORM_H +#define _WX_MSW_OLE_DATAFORM_H + +// ---------------------------------------------------------------------------- +// wxDataFormat identifies the single format of data +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataFormat +{ +public: + // the clipboard formats under Win32 are WORD's + typedef unsigned short NativeFormat; + + wxDataFormat(NativeFormat format = wxDF_INVALID) { m_format = format; } + + // we need constructors from all string types as implicit conversions to + // wxString don't apply when we already rely on implicit conversion of a, + // for example, "char *" string to wxDataFormat, and existing code does it + wxDataFormat(const wxString& format) { SetId(format); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxDataFormat(const char *format) { SetId(format); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + wxDataFormat(const wchar_t *format) { SetId(format); } + wxDataFormat(const wxCStrData& format) { SetId(format); } + + wxDataFormat& operator=(NativeFormat format) + { m_format = format; return *this; } + + // default copy ctor/assignment operators ok + + // comparison (must have both versions) + bool operator==(wxDataFormatId format) const; + bool operator!=(wxDataFormatId format) const; + bool operator==(const wxDataFormat& format) const; + bool operator!=(const wxDataFormat& format) const; + bool operator==(NativeFormat format) const; + bool operator!=(NativeFormat format) const; + + // explicit and implicit conversions to NativeFormat which is one of + // standard data types (implicit conversion is useful for preserving the + // compatibility with old code) + NativeFormat GetFormatId() const { return m_format; } + operator NativeFormat() const { return m_format; } + + // this works with standard as well as custom ids + void SetType(NativeFormat format) { m_format = format; } + NativeFormat GetType() const { return m_format; } + + // string ids are used for custom types - this SetId() must be used for + // application-specific formats + wxString GetId() const; + void SetId(const wxString& format); + + // returns true if the format is one of those defined in wxDataFormatId + bool IsStandard() const { return m_format > 0 && m_format < wxDF_PRIVATE; } + +private: + NativeFormat m_format; +}; + +#endif // _WX_MSW_OLE_DATAFORM_H + diff --git a/lib/wxWidgets/include/wx/msw/ole/dataobj.h b/lib/wxWidgets/include/wx/msw/ole/dataobj.h new file mode 100644 index 0000000..cc10027 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/ole/dataobj.h @@ -0,0 +1,78 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/ole/dataobj.h +// Purpose: declaration of the wxDataObject class +// Author: Vadim Zeitlin +// Modified by: +// Created: 10.05.98 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_OLE_DATAOBJ_H +#define _WX_MSW_OLE_DATAOBJ_H + +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- + +struct IDataObject; + +// ---------------------------------------------------------------------------- +// wxDataObject is a "smart" and polymorphic piece of data. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataObject : public wxDataObjectBase +{ +public: + // ctor & dtor + wxDataObject(); + virtual ~wxDataObject(); + + // retrieve IDataObject interface (for other OLE related classes) + IDataObject *GetInterface() const { return m_pIDataObject; } + + // tell the object that it should be now owned by IDataObject - i.e. when + // it is deleted, it should delete us as well + void SetAutoDelete(); + + // return true if we support this format in "Get" direction + bool IsSupportedFormat(const wxDataFormat& format) const + { return wxDataObjectBase::IsSupported(format, Get); } + + // if this method returns false, this wxDataObject will be copied to + // the clipboard with its size prepended to it, which is compatible with + // older wx versions + // + // if returns true, then this wxDataObject will be copied to the clipboard + // without any additional information and ::HeapSize() function will be used + // to get the size of that data + virtual bool NeedsVerbatimData(const wxDataFormat& WXUNUSED(format)) const + { + // return false from here only for compatibility with earlier wx versions + return true; + } + + // function to return symbolic name of clipboard format (for debug messages) +#ifdef __WXDEBUG__ + static const wxChar *GetFormatName(wxDataFormat format); + + #define wxGetFormatName(format) wxDataObject::GetFormatName(format) +#else // !Debug + #define wxGetFormatName(format) wxT("") +#endif // Debug/!Debug + // they need to be accessed from wxIDataObject, so made them public, + // or wxIDataObject friend +public: + virtual const void* GetSizeFromBuffer( const void* buffer, size_t* size, + const wxDataFormat& format ); + virtual void* SetSizeInBuffer( void* buffer, size_t size, + const wxDataFormat& format ); + virtual size_t GetBufferOffset( const wxDataFormat& format ); + +private: + IDataObject *m_pIDataObject; // pointer to the COM interface + + wxDECLARE_NO_COPY_CLASS(wxDataObject); +}; + +#endif //_WX_MSW_OLE_DATAOBJ_H diff --git a/lib/wxWidgets/include/wx/msw/ole/dataobj2.h b/lib/wxWidgets/include/wx/msw/ole/dataobj2.h new file mode 100644 index 0000000..3f881c6 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/ole/dataobj2.h @@ -0,0 +1,145 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/ole/dataobj2.h +// Purpose: second part of platform specific wxDataObject header - +// declarations of predefined wxDataObjectSimple-derived classes +// Author: Vadim Zeitlin +// Modified by: +// Created: 21.10.99 +// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_OLE_DATAOBJ2_H +#define _WX_MSW_OLE_DATAOBJ2_H + +// ---------------------------------------------------------------------------- +// wxBitmapDataObject is a specialization of wxDataObject for bitmap data +// +// NB: in fact, under MSW we support CF_DIB (and not CF_BITMAP) clipboard +// format and we also provide wxBitmapDataObject2 for CF_BITMAP (which is +// rarely used). This is ugly, but I haven't found a solution for it yet. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBitmapDataObject : public wxBitmapDataObjectBase +{ +public: + // ctors + wxBitmapDataObject(const wxBitmap& bitmap = wxNullBitmap) + : wxBitmapDataObjectBase(bitmap) + { + SetFormat(wxDF_DIB); + + m_data = NULL; + } + + // implement base class pure virtuals + virtual size_t GetDataSize() const wxOVERRIDE; + virtual bool GetDataHere(void *buf) const wxOVERRIDE; + virtual bool SetData(size_t len, const void *buf) wxOVERRIDE; + + virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const wxOVERRIDE + { return GetDataSize(); } + virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), + void *buf) const wxOVERRIDE + { return GetDataHere(buf); } + virtual bool SetData(const wxDataFormat& WXUNUSED(format), + size_t len, const void *buf) wxOVERRIDE + { return SetData(len, buf); } + +private: + // the DIB data + void /* BITMAPINFO */ *m_data; + + wxDECLARE_NO_COPY_CLASS(wxBitmapDataObject); +}; + +// ---------------------------------------------------------------------------- +// wxBitmapDataObject2 - a data object for CF_BITMAP +// +// FIXME did I already mention it was ugly? +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBitmapDataObject2 : public wxBitmapDataObjectBase +{ +public: + // ctors + wxBitmapDataObject2(const wxBitmap& bitmap = wxNullBitmap) + : wxBitmapDataObjectBase(bitmap) + { + } + + // implement base class pure virtuals + virtual size_t GetDataSize() const wxOVERRIDE; + virtual bool GetDataHere(void *buf) const wxOVERRIDE; + virtual bool SetData(size_t len, const void *buf) wxOVERRIDE; + + virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const wxOVERRIDE + { return GetDataSize(); } + virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), + void *buf) const wxOVERRIDE + { return GetDataHere(buf); } + virtual bool SetData(const wxDataFormat& WXUNUSED(format), + size_t len, const void *buf) wxOVERRIDE + { return SetData(len, buf); } + +private: + wxDECLARE_NO_COPY_CLASS(wxBitmapDataObject2); +}; + +// ---------------------------------------------------------------------------- +// wxFileDataObject - data object for CF_HDROP +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFileDataObject : public wxFileDataObjectBase +{ +public: + wxFileDataObject() { } + + // implement base class pure virtuals + virtual bool SetData(size_t len, const void *buf) wxOVERRIDE; + virtual size_t GetDataSize() const wxOVERRIDE; + virtual bool GetDataHere(void *pData) const wxOVERRIDE; + virtual void AddFile(const wxString& file); + + virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const wxOVERRIDE + { return GetDataSize(); } + virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), + void *buf) const wxOVERRIDE + { return GetDataHere(buf); } + virtual bool SetData(const wxDataFormat& WXUNUSED(format), + size_t len, const void *buf) wxOVERRIDE + { return SetData(len, buf); } + +private: + wxDECLARE_NO_COPY_CLASS(wxFileDataObject); +}; + +// ---------------------------------------------------------------------------- +// wxURLDataObject: data object for URLs +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxURLDataObject : public wxDataObjectComposite +{ +public: + // initialize with URL in ctor or use SetURL later + wxURLDataObject(const wxString& url = wxEmptyString); + + // return the URL as string + wxString GetURL() const; + + // Set a string as the URL in the data object + void SetURL(const wxString& url); + + // override to set m_textFormat + virtual bool SetData(const wxDataFormat& format, + size_t len, + const void *buf) wxOVERRIDE; + +private: + // last data object we got data in + wxDataObjectSimple *m_dataObjectLast; + + wxDECLARE_NO_COPY_CLASS(wxURLDataObject); +}; + +#endif // _WX_MSW_OLE_DATAOBJ2_H diff --git a/lib/wxWidgets/include/wx/msw/ole/dropsrc.h b/lib/wxWidgets/include/wx/msw/ole/dropsrc.h new file mode 100644 index 0000000..3fcfe9b --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/ole/dropsrc.h @@ -0,0 +1,78 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/ole/dropsrc.h +// Purpose: declaration of the wxDropSource class +// Author: Vadim Zeitlin +// Modified by: +// Created: 06.03.98 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OLEDROPSRC_H +#define _WX_OLEDROPSRC_H + +#if wxUSE_DRAG_AND_DROP + +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- + +class wxIDropSource; +class WXDLLIMPEXP_FWD_CORE wxDataObject; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +// this macro may be used instead for wxDropSource ctor arguments: it will use +// the cursor 'name' from the resources under MSW, but will expand to +// something else under GTK. If you don't use it, you will have to use #ifdef +// in the application code. +#define wxDROP_ICON(name) wxCursor(wxT(#name)) + +// ---------------------------------------------------------------------------- +// wxDropSource is used to start the drag-&-drop operation on associated +// wxDataObject object. It's responsible for giving UI feedback while dragging. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDropSource : public wxDropSourceBase +{ +public: + // ctors: if you use default ctor you must call SetData() later! + // + // NB: the "wxWindow *win" parameter is unused and is here only for wxGTK + // compatibility, as well as both icon parameters + wxDropSource(wxWindow *win = NULL, + const wxCursor &cursorCopy = wxNullCursor, + const wxCursor &cursorMove = wxNullCursor, + const wxCursor &cursorStop = wxNullCursor); + wxDropSource(wxDataObject& data, + wxWindow *win = NULL, + const wxCursor &cursorCopy = wxNullCursor, + const wxCursor &cursorMove = wxNullCursor, + const wxCursor &cursorStop = wxNullCursor); + + virtual ~wxDropSource(); + + // do it (call this in response to a mouse button press, for example) + // params: if bAllowMove is false, data can be only copied + virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly) wxOVERRIDE; + + // overridable: you may give some custom UI feedback during d&d operation + // in this function (it's called on each mouse move, so it shouldn't be + // too slow). Just return false if you want default feedback. + virtual bool GiveFeedback(wxDragResult effect) wxOVERRIDE; + +protected: + void Init(); + +private: + wxIDropSource *m_pIDropSource; // the pointer to COM interface + + wxDECLARE_NO_COPY_CLASS(wxDropSource); +}; + +#endif //wxUSE_DRAG_AND_DROP + +#endif //_WX_OLEDROPSRC_H diff --git a/lib/wxWidgets/include/wx/msw/ole/droptgt.h b/lib/wxWidgets/include/wx/msw/ole/droptgt.h new file mode 100644 index 0000000..2602e05 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/ole/droptgt.h @@ -0,0 +1,89 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/ole/droptgt.h +// Purpose: declaration of the wxDropTarget class +// Author: Vadim Zeitlin +// Modified by: +// Created: 06.03.98 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OLEDROPTGT_H +#define _WX_OLEDROPTGT_H + +#if wxUSE_DRAG_AND_DROP + +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- + +class wxIDropTarget; +struct wxIDropTargetHelper; +struct IDataObject; + +// ---------------------------------------------------------------------------- +// An instance of the class wxDropTarget may be associated with any wxWindow +// derived object via SetDropTarget() function. If this is done, the virtual +// methods of wxDropTarget are called when something is dropped on the window. +// +// Note that wxDropTarget is an abstract base class (ABC) and you should derive +// your own class from it implementing pure virtual function in order to use it +// (all of them, including protected ones which are called by the class itself) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDropTarget : public wxDropTargetBase +{ +public: + // ctor & dtor + wxDropTarget(wxDataObject *dataObject = NULL); + virtual ~wxDropTarget(); + + // normally called by wxWindow on window creation/destruction, but might be + // called `manually' as well. Register() returns true on success. + bool Register(WXHWND hwnd); + void Revoke(WXHWND hwnd); + + // provide default implementation for base class pure virtuals + virtual bool OnDrop(wxCoord x, wxCoord y) wxOVERRIDE; + virtual bool GetData() wxOVERRIDE; + + // Can only be called during OnXXX methods. + wxDataFormat GetMatchingPair(); + + // implementation only from now on + // ------------------------------- + + // do we accept this kind of data? + bool MSWIsAcceptedData(IDataObject *pIDataSource) const; + + // give us the data source from IDropTarget::Drop() - this is later used by + // GetData() when it's called from inside OnData() + void MSWSetDataSource(IDataObject *pIDataSource); + + // These functions take care of all things necessary to support native drag + // images. + // + // {Init,End}DragImageSupport() are called during Register/Revoke, + // UpdateDragImageOnXXX() functions are called on the corresponding drop + // target events. + void MSWInitDragImageSupport(); + void MSWEndDragImageSupport(); + void MSWUpdateDragImageOnData(wxCoord x, wxCoord y, wxDragResult res); + void MSWUpdateDragImageOnDragOver(wxCoord x, wxCoord y, wxDragResult res); + void MSWUpdateDragImageOnEnter(wxCoord x, wxCoord y, wxDragResult res); + void MSWUpdateDragImageOnLeave(); + +private: + // helper used by IsAcceptedData() and GetData() + wxDataFormat MSWGetSupportedFormat(IDataObject *pIDataSource) const; + + wxIDropTarget *m_pIDropTarget; // the pointer to our COM interface + IDataObject *m_pIDataSource; // the pointer to the source data object + wxIDropTargetHelper *m_dropTargetHelper; // the drop target helper + + wxDECLARE_NO_COPY_CLASS(wxDropTarget); +}; + +#endif //wxUSE_DRAG_AND_DROP + +#endif //_WX_OLEDROPTGT_H diff --git a/lib/wxWidgets/include/wx/msw/ole/oleutils.h b/lib/wxWidgets/include/wx/msw/ole/oleutils.h new file mode 100644 index 0000000..ed45e59 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/ole/oleutils.h @@ -0,0 +1,259 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/ole/oleutils.h +// Purpose: OLE helper routines, OLE debugging support &c +// Author: Vadim Zeitlin +// Modified by: +// Created: 19.02.1998 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OLEUTILS_H +#define _WX_OLEUTILS_H + +#include "wx/defs.h" + +#if wxUSE_OLE + +// ole2.h includes windows.h, so include wrapwin.h first +#include "wx/msw/wrapwin.h" +// get IUnknown, REFIID &c +#include <ole2.h> +#include "wx/intl.h" +#include "wx/log.h" +#include "wx/variant.h" + +#include "wx/msw/ole/comimpl.h" + +// ============================================================================ +// General purpose functions and macros +// ============================================================================ + +// ---------------------------------------------------------------------------- +// initialize/cleanup OLE +// ---------------------------------------------------------------------------- + +// call OleInitialize() or CoInitialize[Ex]() depending on the platform +// +// return true if ok, false otherwise +inline bool wxOleInitialize() +{ + const HRESULT + hr = ::OleInitialize(NULL); + + // RPC_E_CHANGED_MODE indicates that OLE had been already initialized + // before, albeit with different mode. Don't consider it to be an error as + // we don't actually care ourselves about the mode used so this allows the + // main application to call OleInitialize() on its own before we do if it + // needs non-default mode. + if ( hr != RPC_E_CHANGED_MODE && FAILED(hr) ) + { + wxLogError(wxGetTranslation("Cannot initialize OLE")); + + return false; + } + + return true; +} + +inline void wxOleUninitialize() +{ + ::OleUninitialize(); +} + +// wrapper around BSTR type (by Vadim Zeitlin) + +class WXDLLIMPEXP_CORE wxBasicString +{ +public: + // Constructs with the owned BSTR set to NULL + wxBasicString() : m_bstrBuf(NULL) {} + + // Constructs with the owned BSTR created from a wxString + wxBasicString(const wxString& str) + : m_bstrBuf(SysAllocString(str.wc_str(*wxConvCurrent))) {} + + // Constructs with the owned BSTR as a copy of the BSTR owned by bstr + wxBasicString(const wxBasicString& bstr) : m_bstrBuf(bstr.Copy()) {} + + // Frees the owned BSTR + ~wxBasicString() { SysFreeString(m_bstrBuf); } + + // Creates the owned BSTR from a wxString + void AssignFromString(const wxString& str); + + // Returns the owned BSTR and gives up its ownership, + // the caller is responsible for freeing it + BSTR Detach(); + + // Returns a copy of the owned BSTR, + // the caller is responsible for freeing it + BSTR Copy() const { return SysAllocString(m_bstrBuf); } + + // Returns the address of the owned BSTR, not to be called + // when wxBasicString already contains a non-NULL BSTR + BSTR* ByRef(); + + // Sets its BSTR to a copy of the BSTR owned by bstr + wxBasicString& operator=(const wxBasicString& bstr); + + /// Returns the owned BSTR while keeping its ownership + operator BSTR() const { return m_bstrBuf; } + + // retrieve a copy of our string - caller must SysFreeString() it later! + wxDEPRECATED_MSG("use Copy() instead") + BSTR Get() const { return Copy(); } +private: + // actual string + BSTR m_bstrBuf; +}; + +#if wxUSE_VARIANT +// Convert variants +class WXDLLIMPEXP_FWD_BASE wxVariant; + +// wrapper for CURRENCY type used in VARIANT (VARIANT.vt == VT_CY) +class WXDLLIMPEXP_CORE wxVariantDataCurrency : public wxVariantData +{ +public: + wxVariantDataCurrency() { VarCyFromR8(0.0, &m_value); } + wxVariantDataCurrency(CURRENCY value) { m_value = value; } + + CURRENCY GetValue() const { return m_value; } + void SetValue(CURRENCY value) { m_value = value; } + + virtual bool Eq(wxVariantData& data) const wxOVERRIDE; + +#if wxUSE_STD_IOSTREAM + virtual bool Write(wxSTD ostream& str) const wxOVERRIDE; +#endif + virtual bool Write(wxString& str) const wxOVERRIDE; + + wxVariantData* Clone() const wxOVERRIDE { return new wxVariantDataCurrency(m_value); } + virtual wxString GetType() const wxOVERRIDE { return wxS("currency"); } + + DECLARE_WXANY_CONVERSION() + +private: + CURRENCY m_value; +}; + + +// wrapper for SCODE type used in VARIANT (VARIANT.vt == VT_ERROR) +class WXDLLIMPEXP_CORE wxVariantDataErrorCode : public wxVariantData +{ +public: + wxVariantDataErrorCode(SCODE value = S_OK) { m_value = value; } + + SCODE GetValue() const { return m_value; } + void SetValue(SCODE value) { m_value = value; } + + virtual bool Eq(wxVariantData& data) const wxOVERRIDE; + +#if wxUSE_STD_IOSTREAM + virtual bool Write(wxSTD ostream& str) const wxOVERRIDE; +#endif + virtual bool Write(wxString& str) const wxOVERRIDE; + + wxVariantData* Clone() const wxOVERRIDE { return new wxVariantDataErrorCode(m_value); } + virtual wxString GetType() const wxOVERRIDE { return wxS("errorcode"); } + + DECLARE_WXANY_CONVERSION() + +private: + SCODE m_value; +}; + +// wrapper for SAFEARRAY, used for passing multidimensional arrays in wxVariant +class WXDLLIMPEXP_CORE wxVariantDataSafeArray : public wxVariantData +{ +public: + explicit wxVariantDataSafeArray(SAFEARRAY* value = NULL) + { + m_value = value; + } + + SAFEARRAY* GetValue() const { return m_value; } + void SetValue(SAFEARRAY* value) { m_value = value; } + + virtual bool Eq(wxVariantData& data) const wxOVERRIDE; + +#if wxUSE_STD_IOSTREAM + virtual bool Write(wxSTD ostream& str) const wxOVERRIDE; +#endif + virtual bool Write(wxString& str) const wxOVERRIDE; + + wxVariantData* Clone() const wxOVERRIDE { return new wxVariantDataSafeArray(m_value); } + virtual wxString GetType() const wxOVERRIDE { return wxS("safearray"); } + + DECLARE_WXANY_CONVERSION() + +private: + SAFEARRAY* m_value; +}; + +// Used by wxAutomationObject for its wxConvertOleToVariant() calls. +enum wxOleConvertVariantFlags +{ + wxOleConvertVariant_Default = 0, + + // If wxOleConvertVariant_ReturnSafeArrays flag is set, SAFEARRAYs + // contained in OLE VARIANTs will be returned as wxVariants + // with wxVariantDataSafeArray type instead of wxVariants + // with the list type containing the (flattened) SAFEARRAY's elements. + wxOleConvertVariant_ReturnSafeArrays = 1 +}; + +WXDLLIMPEXP_CORE +bool wxConvertVariantToOle(const wxVariant& variant, VARIANTARG& oleVariant); + +WXDLLIMPEXP_CORE +bool wxConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant, + long flags = wxOleConvertVariant_Default); + +#endif // wxUSE_VARIANT + +// Convert string to Unicode +WXDLLIMPEXP_CORE BSTR wxConvertStringToOle(const wxString& str); + +// Convert string from BSTR to wxString +WXDLLIMPEXP_CORE wxString wxConvertStringFromOle(BSTR bStr); + +#else // !wxUSE_OLE + +// ---------------------------------------------------------------------------- +// stub functions to avoid #if wxUSE_OLE in the main code +// ---------------------------------------------------------------------------- + +inline bool wxOleInitialize() { return false; } +inline void wxOleUninitialize() { } + +#endif // wxUSE_OLE/!wxUSE_OLE + +// RAII class initializing OLE in its ctor and undoing it in its dtor. +class wxOleInitializer +{ +public: + wxOleInitializer() + : m_ok(wxOleInitialize()) + { + } + + bool IsOk() const + { + return m_ok; + } + + ~wxOleInitializer() + { + if ( m_ok ) + wxOleUninitialize(); + } + +private: + const bool m_ok; + + wxDECLARE_NO_COPY_CLASS(wxOleInitializer); +}; + +#endif //_WX_OLEUTILS_H diff --git a/lib/wxWidgets/include/wx/msw/ole/safearray.h b/lib/wxWidgets/include/wx/msw/ole/safearray.h new file mode 100644 index 0000000..02d052d --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/ole/safearray.h @@ -0,0 +1,394 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: msw/ole/safearray.h +// Purpose: Helpers for working with OLE SAFEARRAYs. +// Author: PB +// Created: 2012-09-23 +// Copyright: (c) 2012 wxWidgets development team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _MSW_OLE_SAFEARRAY_H_ +#define _MSW_OLE_SAFEARRAY_H_ + +#include "wx/msw/ole/oleutils.h" + +#if wxUSE_OLE && wxUSE_VARIANT + +/* + wxSafeArray is wxWidgets wrapper for working with MS Windows SAFEARRAYs. + It also has convenience functions for converting between SAFEARRAY + and wxVariant with list type or wxArrayString. +*/ + +// The base class with type-independent methods. It exists solely in order to +// reduce the template bloat. +class WXDLLIMPEXP_CORE wxSafeArrayBase +{ +public: + // If owns a SAFEARRAY, it's unlocked and destroyed. + virtual ~wxSafeArrayBase() { Destroy(); } + + // Unlocks and destroys the owned SAFEARRAY. + void Destroy(); + + // Unlocks the owned SAFEARRAY, returns it and gives up its ownership. + SAFEARRAY* Detach(); + + // Returns true if has a valid SAFEARRAY. + bool HasArray() const { return m_array != NULL; } + + // Returns the number of dimensions. + size_t GetDim() const; + + // Returns lower bound for dimension dim in bound. Dimensions start at 1. + bool GetLBound(size_t dim, long& bound) const; + + // Returns upper bound for dimension dim in bound. Dimensions start at 1. + bool GetUBound(size_t dim, long& bound) const; + + // Returns element count for dimension dim. Dimensions start at 1. + size_t GetCount(size_t dim) const; + +protected: + // Default constructor, protected so the class can't be used on its own, + // it's only used as a base class of wxSafeArray<>. + wxSafeArrayBase() + { + m_array = NULL; + } + + bool Lock(); + bool Unlock(); + + SAFEARRAY* m_array; +}; + +// wxSafeArrayConvertor<> must be specialized for the type in order to allow +// using it with wxSafeArray<>. +// +// We specialize it below for the standard types. +template <VARTYPE varType> +struct wxSafeArrayConvertor {}; + +/** + Macro for specializing wxSafeArrayConvertor for simple types. + + The template parameters are: + - externType: basic C data type, e.g. wxFloat64 or wxInt32 + - varType: corresponding VARIANT type constant, e.g. VT_R8 or VT_I4. +*/ +#define wxSPECIALIZE_WXSAFEARRAY_CONVERTOR_SIMPLE(externType, varType) \ +template <> \ +struct wxSafeArrayConvertor<varType> \ +{ \ + typedef externType externT; \ + typedef externT internT; \ + static bool ToArray(const externT& from, internT& to) \ + { \ + to = from; \ + return true; \ + } \ + static bool FromArray(const internT& from, externT& to) \ + { \ + to = from; \ + return true; \ + } \ +} + +wxSPECIALIZE_WXSAFEARRAY_CONVERTOR_SIMPLE(wxInt16, VT_I2); +wxSPECIALIZE_WXSAFEARRAY_CONVERTOR_SIMPLE(wxInt32, VT_I4); +wxSPECIALIZE_WXSAFEARRAY_CONVERTOR_SIMPLE(wxFloat32, VT_R4); +wxSPECIALIZE_WXSAFEARRAY_CONVERTOR_SIMPLE(wxFloat64, VT_R8); + +// Specialization for VT_BSTR using wxString. +template <> +struct wxSafeArrayConvertor<VT_BSTR> +{ + typedef wxString externT; + typedef BSTR internT; + + static bool ToArray(const wxString& from, BSTR& to) + { + BSTR bstr = wxConvertStringToOle(from); + + if ( !bstr && !from.empty() ) + { + // BSTR can be NULL for empty strings but if the string was + // not empty, it means we failed to allocate memory for it. + return false; + } + to = bstr; + return true; + } + + static bool FromArray(const BSTR from, wxString& to) + { + to = wxConvertStringFromOle(from); + return true; + } +}; + +// Specialization for VT_VARIANT using wxVariant. +template <> +struct wxSafeArrayConvertor<VT_VARIANT> +{ + typedef wxVariant externT; + typedef VARIANT internT; + + static bool ToArray(const wxVariant& from, VARIANT& to) + { + return wxConvertVariantToOle(from, to); + } + + static bool FromArray(const VARIANT& from, wxVariant& to) + { + return wxConvertOleToVariant(from, to); + } +}; + + +template <VARTYPE varType> +class wxSafeArray : public wxSafeArrayBase +{ +public: + typedef wxSafeArrayConvertor<varType> Convertor; + typedef typename Convertor::internT internT; + typedef typename Convertor::externT externT; + + // Default constructor. + wxSafeArray() + { + m_array = NULL; + } + + // Creates and locks a zero-based one-dimensional SAFEARRAY with the given + // number of elements. + bool Create(size_t count) + { + SAFEARRAYBOUND bound; + + bound.lLbound = 0; + bound.cElements = count; + return Create(&bound, 1); + } + + // Creates and locks a SAFEARRAY. See SafeArrayCreate() in MSDN + // documentation for more information. + bool Create(SAFEARRAYBOUND* bound, size_t dimensions) + { + wxCHECK_MSG( !m_array, false, wxS("Can't be created twice") ); + + m_array = SafeArrayCreate(varType, dimensions, bound); + if ( !m_array ) + return false; + + return Lock(); + } + + /** + Creates a 0-based one-dimensional SAFEARRAY from wxVariant with the + list type. + + Can be called only for wxSafeArray<VT_VARIANT>. + */ + bool CreateFromListVariant(const wxVariant& variant) + { + wxCHECK(varType == VT_VARIANT, false); + wxCHECK(variant.GetType() == wxS("list"), false); + + if ( !Create(variant.GetCount()) ) + return false; + + VARIANT* data = static_cast<VARIANT*>(m_array->pvData); + + for ( size_t i = 0; i < variant.GetCount(); i++) + { + if ( !Convertor::ToArray(variant[i], data[i]) ) + return false; + } + return true; + } + + /** + Creates a 0-based one-dimensional SAFEARRAY from wxArrayString. + + Can be called only for wxSafeArray<VT_BSTR>. + */ + bool CreateFromArrayString(const wxArrayString& strings) + { + wxCHECK(varType == VT_BSTR, false); + + if ( !Create(strings.size()) ) + return false; + + BSTR* data = static_cast<BSTR*>(m_array->pvData); + + for ( size_t i = 0; i < strings.size(); i++ ) + { + if ( !Convertor::ToArray(strings[i], data[i]) ) + return false; + } + return true; + } + + /** + Attaches and locks an existing SAFEARRAY. + The array must have the same VARTYPE as this wxSafeArray was + instantiated with. + */ + bool Attach(SAFEARRAY* array) + { + wxCHECK_MSG(!m_array && array, false, + wxS("Can only attach a valid array to an uninitialized one") ); + + VARTYPE vt; + HRESULT hr = SafeArrayGetVartype(array, &vt); + if ( FAILED(hr) ) + { + wxLogApiError(wxS("SafeArrayGetVarType()"), hr); + return false; + } + + wxCHECK_MSG(vt == varType, false, + wxS("Attaching array of invalid type")); + + m_array = array; + return Lock(); + } + + /** + Indices have the same row-column order as rgIndices in + SafeArrayPutElement(), i.e. they follow BASIC rules, NOT C ones. + */ + bool SetElement(long* indices, const externT& element) + { + wxCHECK_MSG( m_array, false, wxS("Uninitialized array") ); + wxCHECK_MSG( indices, false, wxS("Invalid index") ); + + internT* data; + + if ( FAILED( SafeArrayPtrOfIndex(m_array, (LONG *)indices, (void**)&data) ) ) + return false; + + return Convertor::ToArray(element, *data); + } + + /** + Indices have the same row-column order as rgIndices in + SafeArrayPutElement(), i.e. they follow BASIC rules, NOT C ones. + */ + bool GetElement(long* indices, externT& element) const + { + wxCHECK_MSG( m_array, false, wxS("Uninitialized array") ); + wxCHECK_MSG( indices, false, wxS("Invalid index") ); + + internT* data; + + if ( FAILED( SafeArrayPtrOfIndex(m_array, (LONG *)indices, (void**)&data) ) ) + return false; + + return Convertor::FromArray(*data, element); + } + + /** + Converts the array to a wxVariant with the list type, regardless of the + underlying SAFEARRAY type. + + If the array is multidimensional, it is flattened using the algorithm + originally employed in wxConvertOleToVariant(). + */ + bool ConvertToVariant(wxVariant& variant) const + { + wxCHECK_MSG( m_array, false, wxS("Uninitialized array") ); + + size_t dims = m_array->cDims; + size_t count = 1; + + for ( size_t i = 0; i < dims; i++ ) + count *= m_array->rgsabound[i].cElements; + + const internT* data = static_cast<const internT*>(m_array->pvData); + externT element; + + variant.ClearList(); + for ( size_t i1 = 0; i1 < count; i1++ ) + { + if ( !Convertor::FromArray(data[i1], element) ) + { + variant.ClearList(); + return false; + } + variant.Append(element); + } + return true; + } + + /** + Converts an array to an ArrayString. + + Can be called only for wxSafeArray<VT_BSTR>. If the array is + multidimensional, it is flattened using the algorithm originally + employed in wxConvertOleToVariant(). + */ + bool ConvertToArrayString(wxArrayString& strings) const + { + wxCHECK_MSG( m_array, false, wxS("Uninitialized array") ); + wxCHECK(varType == VT_BSTR, false); + + size_t dims = m_array->cDims; + size_t count = 1; + + for ( size_t i = 0; i < dims; i++ ) + count *= m_array->rgsabound[i].cElements; + + const BSTR* data = static_cast<const BSTR*>(m_array->pvData); + wxString element; + + strings.clear(); + strings.reserve(count); + for ( size_t i1 = 0; i1 < count; i1++ ) + { + if ( !Convertor::FromArray(data[i1], element) ) + { + strings.clear(); + return false; + } + strings.push_back(element); + } + return true; + } + + static bool ConvertToVariant(SAFEARRAY* psa, wxVariant& variant) + { + wxSafeArray<varType> sa; + bool result = false; + + if ( sa.Attach(psa) ) + result = sa.ConvertToVariant(variant); + + if ( sa.HasArray() ) + sa.Detach(); + + return result; + } + + static bool ConvertToArrayString(SAFEARRAY* psa, wxArrayString& strings) + { + wxSafeArray<varType> sa; + bool result = false; + + if ( sa.Attach(psa) ) + result = sa.ConvertToArrayString(strings); + + if ( sa.HasArray() ) + sa.Detach(); + + return result; + } + + wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxSafeArray, varType); +}; + +#endif // wxUSE_OLE && wxUSE_VARIANT + +#endif // _MSW_OLE_SAFEARRAY_H_ diff --git a/lib/wxWidgets/include/wx/msw/ole/uuid.h b/lib/wxWidgets/include/wx/msw/ole/uuid.h new file mode 100644 index 0000000..d6b4e3a --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/ole/uuid.h @@ -0,0 +1,87 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/ole/uuid.h +// Purpose: encapsulates an UUID with some added helper functions +// Author: Vadim Zeitlin +// Modified by: +// Created: 11.07.97 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +// +// Notes: you should link your project with RPCRT4.LIB! +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OLEUUID_H +#define _WX_OLEUUID_H + +#include "wx/chartype.h" +// ------------------------------------------------------------------ +// UUID (Universally Unique IDentifier) definition +// ------------------------------------------------------------------ + +// ----- taken from RPC.H +#ifndef UUID_DEFINED // in some cases RPC.H will be already + typedef struct + { + unsigned long Data1; + unsigned short Data2; + unsigned short Data3; + unsigned char Data4[8]; + } UUID; // UUID = GUID = CLSID = LIBID = IID +#endif // UUID_DEFINED + +#ifndef GUID_DEFINED + typedef UUID GUID; + #define UUID_DEFINED // prevent redefinition +#endif // GUID_DEFINED + +typedef unsigned char uchar; + +// ------------------------------------------------------------------ +// a class to store UUID and its string representation +// ------------------------------------------------------------------ + +// uses RPC functions to create/convert Universally Unique Identifiers +class WXDLLIMPEXP_CORE Uuid +{ +private: + UUID m_uuid; + wxUChar *m_pszUuid; // this string is alloc'd and freed by RPC + wxChar *m_pszCForm; // this string is allocated in Set/Create + + void UuidToCForm(); + + // function used to set initial state by all ctors + void Init() { m_pszUuid = NULL; m_pszCForm = NULL; } + +public: + // ctors & dtor + Uuid() { Init(); } + Uuid(const wxChar *pc) { Init(); Set(pc); } + Uuid(const UUID &uuid) { Init(); Set(uuid); } + ~Uuid(); + + // copy ctor and assignment operator needed for this class + Uuid(const Uuid& uuid); + Uuid& operator=(const Uuid& uuid); + + // create a brand new UUID + void Create(); + + // set value of UUID + bool Set(const wxChar *pc); // from a string, returns true if ok + void Set(const UUID& uuid); // from another UUID (never fails) + + // comparison operators + bool operator==(const Uuid& uuid) const; + bool operator!=(const Uuid& uuid) const { return !(*this == uuid); } + + // accessors + operator const UUID*() const { return &m_uuid; } + operator const wxChar*() const { return (wxChar *)(m_pszUuid); } + + // return string representation of the UUID in the C form + // (as in DEFINE_GUID macro) + const wxChar *CForm() const { return m_pszCForm; } +}; + +#endif //_WX_OLEUUID_H diff --git a/lib/wxWidgets/include/wx/msw/ownerdrawnbutton.h b/lib/wxWidgets/include/wx/msw/ownerdrawnbutton.h new file mode 100644 index 0000000..054076e --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/ownerdrawnbutton.h @@ -0,0 +1,132 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/ownerdrawnbutton.h +// Purpose: Common base class for wxCheckBox and wxRadioButton +// Author: Vadim Zeitlin +// Created: 2014-05-04 +// Copyright: (c) 2014 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_OWNERDRAWNBUTTON_H_ +#define _WX_MSW_OWNERDRAWNBUTTON_H_ + +// ---------------------------------------------------------------------------- +// wxMSWOwnerDrawnButton: base class for any kind of Windows buttons +// ---------------------------------------------------------------------------- + +// This class contains the type-independent part of wxMSWOwnerDrawnButton and +// is implemented in src/msw/control.cpp. +// +// Notice that this class is internal implementation detail only and is +// intentionally not documented. Ideally it wouldn't be even exported from the +// DLL but this somehow breaks building of applications using wxWidgets with +// Intel compiler using LTCG, so we do export it. +class WXDLLIMPEXP_CORE wxMSWOwnerDrawnButtonBase +{ +protected: + // Ctor takes the back pointer to the real window, must be non-NULL. + wxMSWOwnerDrawnButtonBase(wxWindow* win) : + m_win(win) + { + m_isPressed = + m_isHot = false; + } + + // Explicitly define the destructor even if it's trivial to make it + // protected. This avoids compiler warnings about the fact that this class + // has virtual functions, but no virtual destructor without making the dtor + // virtual which is not needed here as objects are never deleted via + // pointers to this class (and protected dtor enforces this). + ~wxMSWOwnerDrawnButtonBase() { } + + // Make the control owner drawn if necessary to implement support for the + // given foreground colour. + void MSWMakeOwnerDrawnIfNecessary(const wxColour& colFg); + + // Return true if the control is currently owner drawn. + bool MSWIsOwnerDrawn() const; + + // Draw the button if the message information about which is provided in + // the given DRAWITEMSTRUCT asks us to do it, otherwise just return false. + bool MSWDrawButton(WXDRAWITEMSTRUCT *item); + + + // Methods which must be overridden in the derived concrete class. + + // Return the style to use for the non-owner-drawn button. + virtual int MSWGetButtonStyle() const = 0; + + // Called after reverting button to non-owner drawn state, provides a hook + // for wxCheckBox-specific hack. + virtual void MSWOnButtonResetOwnerDrawn() { } + + // Return the flags (such as wxCONTROL_CHECKED) to use for the control when + // drawing it. Notice that this class already takes care of the common + // logic and sets the other wxCONTROL_XXX flags on its own, this method + // really only needs to return the flags depending on the checked state. + virtual int MSWGetButtonCheckedFlag() const = 0; + + // Actually draw the check or radio bitmap, typically just by using the + // appropriate wxRendererNative method. + virtual void + MSWDrawButtonBitmap(wxDC& dc, const wxRect& rect, int flags) = 0; + + +private: + // Make the control owner drawn or reset it to normal style. + void MSWMakeOwnerDrawn(bool ownerDrawn); + + // Event handlers used to update the appearance of owner drawn button. + void OnMouseEnterOrLeave(wxMouseEvent& event); + void OnMouseLeft(wxMouseEvent& event); + void OnFocus(wxFocusEvent& event); + + + // The real window. + wxWindow* const m_win; + + // true if the checkbox is currently pressed + bool m_isPressed; + + // true if mouse is currently over the control + bool m_isHot; + + + wxDECLARE_NO_COPY_CLASS(wxMSWOwnerDrawnButtonBase); +}; + +// This class uses a weak version of CRTP, i.e. it's a template class taking +// the base class that the class deriving from it would normally derive from. +template <class T> +class wxMSWOwnerDrawnButton + : public T, + private wxMSWOwnerDrawnButtonBase +{ +private: + typedef T Base; + +public: + wxMSWOwnerDrawnButton() : wxMSWOwnerDrawnButtonBase(this) + { + } + + virtual bool SetForegroundColour(const wxColour& colour) wxOVERRIDE + { + if ( !Base::SetForegroundColour(colour) ) + return false; + + MSWMakeOwnerDrawnIfNecessary(colour); + + return true; + } + + virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item) wxOVERRIDE + { + return MSWDrawButton(item) || Base::MSWOnDraw(item); + } + +protected: + bool IsOwnerDrawn() const { return MSWIsOwnerDrawn(); } +}; + +#endif // _WX_MSW_OWNERDRAWNBUTTON_H_ diff --git a/lib/wxWidgets/include/wx/msw/ownerdrw.h b/lib/wxWidgets/include/wx/msw/ownerdrw.h new file mode 100644 index 0000000..5c70add --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/ownerdrw.h @@ -0,0 +1,34 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/ownerdrw.h +// Purpose: wxOwnerDrawn class +// Author: Marcin Malich +// Modified by: +// Created: 2009-09-22 +// Copyright: (c) 2009 Marcin Malich <me@malcom.pl> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OWNERDRW_H_ +#define _WX_OWNERDRW_H_ + +#if wxUSE_OWNER_DRAWN + +class WXDLLIMPEXP_CORE wxOwnerDrawn : public wxOwnerDrawnBase +{ +public: + wxOwnerDrawn() {} + virtual ~wxOwnerDrawn() {} + + virtual bool OnDrawItem(wxDC& dc, const wxRect& rc, + wxODAction act, wxODStatus stat) wxOVERRIDE; + +protected: + // get the type of the text to draw in OnDrawItem(), by default is + // DST_PREFIXTEXT but can be overridden to return DST_TEXT when not using + // mnemonics + virtual int MSWGetTextType() const; +}; + +#endif // wxUSE_OWNER_DRAWN + +#endif // _WX_OWNERDRW_H_ diff --git a/lib/wxWidgets/include/wx/msw/palette.h b/lib/wxWidgets/include/wx/msw/palette.h new file mode 100644 index 0000000..4edaa7d --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/palette.h @@ -0,0 +1,50 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/palette.h +// Purpose: wxPalette class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PALETTE_H_ +#define _WX_PALETTE_H_ + +#include "wx/gdiobj.h" + +class WXDLLIMPEXP_CORE wxPalette : public wxPaletteBase +{ +public: + wxPalette() { } + wxPalette(int n, + const unsigned char *red, const unsigned char *green, const unsigned char *blue) + { + Create(n, red, green, blue); + } + + bool Create(int n, + const unsigned char *red, const unsigned char *green, const unsigned char *blue); + + virtual int GetColoursCount() const wxOVERRIDE; + + int + GetPixel(unsigned char red, unsigned char green, unsigned char blue) const; + + bool + GetRGB(int pixel, + unsigned char *red, unsigned char *green, unsigned char *blue) const; + + // implementation + WXHPALETTE GetHPALETTE() const; + void SetHPALETTE(WXHPALETTE pal); + +protected: + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxPalette); +}; + +#endif // _WX_PALETTE_H_ diff --git a/lib/wxWidgets/include/wx/msw/panel.h b/lib/wxWidgets/include/wx/msw/panel.h new file mode 100644 index 0000000..0a1b980 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/panel.h @@ -0,0 +1,50 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/panel.h +// Purpose: wxMSW-specific wxPanel class. +// Author: Vadim Zeitlin +// Created: 2011-03-18 +// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_PANEL_H_ +#define _WX_MSW_PANEL_H_ + +class WXDLLIMPEXP_FWD_CORE wxBrush; + +// ---------------------------------------------------------------------------- +// wxPanel +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPanel : public wxPanelBase +{ +public: + wxPanel() { } + + wxPanel(wxWindow *parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTAB_TRAVERSAL | wxNO_BORDER, + const wxString& name = wxASCII_STR(wxPanelNameStr)) + { + Create(parent, winid, pos, size, style, name); + } + +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED_CONSTRUCTOR( + wxPanel(wxWindow *parent, + int x, int y, int width, int height, + long style = wxTAB_TRAVERSAL | wxNO_BORDER, + const wxString& name = wxASCII_STR(wxPanelNameStr)) + { + Create(parent, wxID_ANY, wxPoint(x, y), wxSize(width, height), style, name); + } + ) +#endif // WXWIN_COMPATIBILITY_2_8 + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxPanel); +}; + +#endif // _WX_MSW_PANEL_H_ diff --git a/lib/wxWidgets/include/wx/msw/pbrush.cur b/lib/wxWidgets/include/wx/msw/pbrush.cur new file mode 100644 index 0000000..299016a --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/pbrush.cur Binary files differ diff --git a/lib/wxWidgets/include/wx/msw/pen.h b/lib/wxWidgets/include/wx/msw/pen.h new file mode 100644 index 0000000..451da2d --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/pen.h @@ -0,0 +1,83 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/pen.h +// Purpose: wxPen class +// Author: Julian Smart +// Modified by: Vadim Zeitlin: fixed operator=(), ==(), !=() +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PEN_H_ +#define _WX_PEN_H_ + +#include "wx/gdiobj.h" +#include "wx/gdicmn.h" + +// ---------------------------------------------------------------------------- +// Pen +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPen : public wxPenBase +{ +public: + wxPen() { } + wxPen(const wxColour& col, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID); + + wxPen(const wxBitmap& stipple, int width); + + wxPen(const wxPenInfo& info); + + virtual ~wxPen() { } + + bool operator==(const wxPen& pen) const; + bool operator!=(const wxPen& pen) const { return !(*this == pen); } + + // Override in order to recreate the pen + void SetColour(const wxColour& col) wxOVERRIDE; + void SetColour(unsigned char r, unsigned char g, unsigned char b) wxOVERRIDE; + + void SetWidth(int width) wxOVERRIDE; + void SetStyle(wxPenStyle style) wxOVERRIDE; + void SetStipple(const wxBitmap& stipple) wxOVERRIDE; + void SetDashes(int nb_dashes, const wxDash *dash) wxOVERRIDE; + void SetJoin(wxPenJoin join) wxOVERRIDE; + void SetCap(wxPenCap cap) wxOVERRIDE; + void SetQuality(wxPenQuality quality) wxOVERRIDE; + + wxColour GetColour() const wxOVERRIDE; + int GetWidth() const wxOVERRIDE; + wxPenStyle GetStyle() const wxOVERRIDE; + wxPenJoin GetJoin() const wxOVERRIDE; + wxPenCap GetCap() const wxOVERRIDE; + wxPenQuality GetQuality() const wxOVERRIDE; + int GetDashes(wxDash** ptr) const wxOVERRIDE; + wxDash* GetDash() const; + int GetDashCount() const; + wxBitmap* GetStipple() const wxOVERRIDE; + + + wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") + wxPen(const wxColour& col, int width, int style); + + wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") + void SetStyle(int style) { SetStyle((wxPenStyle)style); } + + + // internal: wxGDIObject methods + virtual bool RealizeResource() wxOVERRIDE; + virtual bool FreeResource(bool force = false) wxOVERRIDE; + virtual WXHANDLE GetResourceHandle() const wxOVERRIDE; + virtual bool IsFree() const wxOVERRIDE; + +protected: + virtual wxGDIRefData* CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData* CloneGDIRefData(const wxGDIRefData* data) const wxOVERRIDE; + + // same as FreeResource() + RealizeResource() + bool Recreate(); + + wxDECLARE_DYNAMIC_CLASS(wxPen); +}; + +#endif // _WX_PEN_H_ diff --git a/lib/wxWidgets/include/wx/msw/pencil.cur b/lib/wxWidgets/include/wx/msw/pencil.cur new file mode 100644 index 0000000..afa7602 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/pencil.cur Binary files differ diff --git a/lib/wxWidgets/include/wx/msw/pntleft.cur b/lib/wxWidgets/include/wx/msw/pntleft.cur new file mode 100644 index 0000000..e7192aa --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/pntleft.cur Binary files differ diff --git a/lib/wxWidgets/include/wx/msw/pntright.cur b/lib/wxWidgets/include/wx/msw/pntright.cur new file mode 100644 index 0000000..565447b --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/pntright.cur Binary files differ diff --git a/lib/wxWidgets/include/wx/msw/popupwin.h b/lib/wxWidgets/include/wx/msw/popupwin.h new file mode 100644 index 0000000..7e48693 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/popupwin.h @@ -0,0 +1,55 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/popupwin.h +// Purpose: wxPopupWindow class for wxMSW +// Author: Vadim Zeitlin +// Modified by: +// Created: 06.01.01 +// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_POPUPWIN_H_ +#define _WX_MSW_POPUPWIN_H_ + +// ---------------------------------------------------------------------------- +// wxPopupWindow +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPopupWindow : public wxPopupWindowBase +{ +public: + wxPopupWindow() { m_owner = NULL; } + + wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE) + { (void)Create(parent, flags); } + + bool Create(wxWindow *parent, int flags = wxBORDER_NONE); + + virtual ~wxPopupWindow(); + + virtual void SetFocus() wxOVERRIDE; + virtual bool Show(bool show = true) wxOVERRIDE; + + // return the style to be used for the popup windows + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle) const wxOVERRIDE; + + // get the HWND to be used as parent of this window with CreateWindow() + virtual WXHWND MSWGetParent() const wxOVERRIDE; + + + // Implementation only from now on. + + // Return the top level window parent of this popup or null. + wxWindow* MSWGetOwner() const { return m_owner; } + + // This is a way to notify non-wxPU_CONTAINS_CONTROLS windows about the + // events that should result in their dismissal. + virtual void MSWDismissUnfocusedPopup() { } + +private: + wxWindow* m_owner; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxPopupWindow); +}; + +#endif // _WX_MSW_POPUPWIN_H_ diff --git a/lib/wxWidgets/include/wx/msw/printdlg.h b/lib/wxWidgets/include/wx/msw/printdlg.h new file mode 100644 index 0000000..bceef2a --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/printdlg.h @@ -0,0 +1,125 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/printdlg.h +// Purpose: wxPrintDialog, wxPageSetupDialog classes +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRINTDLG_H_ +#define _WX_PRINTDLG_H_ + +#if wxUSE_PRINTING_ARCHITECTURE + +#include "wx/dialog.h" +#include "wx/cmndata.h" +#include "wx/prntbase.h" +#include "wx/printdlg.h" + +class WXDLLIMPEXP_FWD_CORE wxDC; +class WinPrinter; + +//---------------------------------------------------------------------------- +// wxWindowsPrintNativeData +//---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWindowsPrintNativeData: public wxPrintNativeDataBase +{ +public: + wxWindowsPrintNativeData(); + virtual ~wxWindowsPrintNativeData(); + + virtual bool TransferTo( wxPrintData &data ) wxOVERRIDE; + virtual bool TransferFrom( const wxPrintData &data ) wxOVERRIDE; + + virtual bool Ok() const wxOVERRIDE { return IsOk(); } + virtual bool IsOk() const wxOVERRIDE; + + void InitializeDevMode(const wxString &printerName = wxEmptyString, WinPrinter* printer = NULL); + void* GetDevMode() const { return m_devMode; } + void SetDevMode(void* data) { m_devMode = data; } + void* GetDevNames() const { return m_devNames; } + void SetDevNames(void* data) { m_devNames = data; } + +private: + void* m_devMode; + void* m_devNames; + + short m_customWindowsPaperId; + +private: + wxDECLARE_DYNAMIC_CLASS(wxWindowsPrintNativeData); +}; + +// --------------------------------------------------------------------------- +// wxWindowsPrintDialog: the MSW dialog for printing +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWindowsPrintDialog : public wxPrintDialogBase +{ +public: + wxWindowsPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL); + wxWindowsPrintDialog(wxWindow *parent, wxPrintData* data); + virtual ~wxWindowsPrintDialog(); + + bool Create(wxWindow *parent, wxPrintDialogData* data = NULL); + virtual int ShowModal() wxOVERRIDE; + + wxPrintDialogData& GetPrintDialogData() wxOVERRIDE { return m_printDialogData; } + wxPrintData& GetPrintData() wxOVERRIDE { return m_printDialogData.GetPrintData(); } + + virtual wxDC *GetPrintDC() wxOVERRIDE; + +private: + wxPrintDialogData m_printDialogData; + wxPrinterDC* m_printerDC; + bool m_destroyDC; + wxWindow* m_dialogParent; + +private: + bool ConvertToNative( wxPrintDialogData &data ); + bool ConvertFromNative( wxPrintDialogData &data ); + + // holds MSW handle + void* m_printDlg; + +private: + wxDECLARE_CLASS(wxWindowsPrintDialog); + wxDECLARE_NO_COPY_CLASS(wxWindowsPrintDialog); +}; + +// --------------------------------------------------------------------------- +// wxWindowsPageSetupDialog: the MSW page setup dialog +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWindowsPageSetupDialog: public wxPageSetupDialogBase +{ +public: + wxWindowsPageSetupDialog(); + wxWindowsPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = NULL); + virtual ~wxWindowsPageSetupDialog(); + + bool Create(wxWindow *parent, wxPageSetupDialogData *data = NULL); + virtual int ShowModal() wxOVERRIDE; + bool ConvertToNative( wxPageSetupDialogData &data ); + bool ConvertFromNative( wxPageSetupDialogData &data ); + + virtual wxPageSetupDialogData& GetPageSetupDialogData() wxOVERRIDE { return m_pageSetupData; } + +private: + wxPageSetupDialogData m_pageSetupData; + wxWindow* m_dialogParent; + + // holds MSW handle + void* m_pageDlg; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxWindowsPageSetupDialog); +}; + +#endif // wxUSE_PRINTING_ARCHITECTURE + +#endif + // _WX_PRINTDLG_H_ diff --git a/lib/wxWidgets/include/wx/msw/printwin.h b/lib/wxWidgets/include/wx/msw/printwin.h new file mode 100644 index 0000000..5d3c208 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/printwin.h @@ -0,0 +1,66 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/printwin.h +// Purpose: wxWindowsPrinter, wxWindowsPrintPreview classes +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRINTWIN_H_ +#define _WX_PRINTWIN_H_ + +#include "wx/prntbase.h" + +// --------------------------------------------------------------------------- +// Represents the printer: manages printing a wxPrintout object +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWindowsPrinter : public wxPrinterBase +{ + wxDECLARE_DYNAMIC_CLASS(wxWindowsPrinter); + +public: + wxWindowsPrinter(wxPrintDialogData *data = NULL); + + virtual bool Print(wxWindow *parent, + wxPrintout *printout, + bool prompt = true) wxOVERRIDE; + + virtual wxDC *PrintDialog(wxWindow *parent) wxOVERRIDE; + virtual bool Setup(wxWindow *parent) wxOVERRIDE; + +private: + wxDECLARE_NO_COPY_CLASS(wxWindowsPrinter); +}; + +// --------------------------------------------------------------------------- +// wxPrintPreview: programmer creates an object of this class to preview a +// wxPrintout. +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWindowsPrintPreview : public wxPrintPreviewBase +{ +public: + wxWindowsPrintPreview(wxPrintout *printout, + wxPrintout *printoutForPrinting = NULL, + wxPrintDialogData *data = NULL); + wxWindowsPrintPreview(wxPrintout *printout, + wxPrintout *printoutForPrinting, + wxPrintData *data); + virtual ~wxWindowsPrintPreview(); + + virtual bool Print(bool interactive) wxOVERRIDE; + virtual void DetermineScaling() wxOVERRIDE; + +protected: +#if wxUSE_ENH_METAFILE + virtual bool RenderPageIntoBitmap(wxBitmap& bmp, int pageNum) wxOVERRIDE; +#endif + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxWindowsPrintPreview); +}; + +#endif +// _WX_PRINTWIN_H_ diff --git a/lib/wxWidgets/include/wx/msw/private.h b/lib/wxWidgets/include/wx/msw/private.h new file mode 100644 index 0000000..a1cd37e --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private.h @@ -0,0 +1,1190 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private.h +// Purpose: Private declarations: as this header is only included by +// wxWidgets itself, it may contain identifiers which don't start +// with "wx". +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_H_ +#define _WX_PRIVATE_H_ + +#include "wx/msw/wrapwin.h" + +#include "wx/log.h" + +#if wxUSE_GUI + #include "wx/window.h" +#endif // wxUSE_GUI + +class WXDLLIMPEXP_FWD_CORE wxFont; +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxWindowBase; + +// --------------------------------------------------------------------------- +// private constants +// --------------------------------------------------------------------------- + +// 260 was taken from windef.h +#ifndef MAX_PATH + #define MAX_PATH 260 +#endif + +// Many MSW functions have parameters which are "reserved". Passing them this +// constant is more clear than just using "0" or "NULL". +#define wxRESERVED_PARAM 0 + +// --------------------------------------------------------------------------- +// standard icons from the resources +// --------------------------------------------------------------------------- + +#if wxUSE_GUI + +extern WXDLLIMPEXP_DATA_CORE(HICON) wxSTD_FRAME_ICON; +extern WXDLLIMPEXP_DATA_CORE(HICON) wxSTD_MDIPARENTFRAME_ICON; +extern WXDLLIMPEXP_DATA_CORE(HICON) wxSTD_MDICHILDFRAME_ICON; +extern WXDLLIMPEXP_DATA_CORE(HICON) wxDEFAULT_FRAME_ICON; +extern WXDLLIMPEXP_DATA_CORE(HICON) wxDEFAULT_MDIPARENTFRAME_ICON; +extern WXDLLIMPEXP_DATA_CORE(HICON) wxDEFAULT_MDICHILDFRAME_ICON; +extern WXDLLIMPEXP_DATA_CORE(HFONT) wxSTATUS_LINE_FONT; + +#endif // wxUSE_GUI + +// --------------------------------------------------------------------------- +// global data +// --------------------------------------------------------------------------- + +extern WXDLLIMPEXP_DATA_BASE(HINSTANCE) wxhInstance; + +extern "C" +{ + WXDLLIMPEXP_BASE HINSTANCE wxGetInstance(); +} + +WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); + +// --------------------------------------------------------------------------- +// define things missing from some compilers' headers +// --------------------------------------------------------------------------- + +// this defines a CASTWNDPROC macro which casts a pointer to the type of a +// window proc +#if defined(STRICT) || defined(__GNUC__) + typedef WNDPROC WndProcCast; +#else + typedef FARPROC WndProcCast; +#endif + +#define CASTWNDPROC (WndProcCast) + + +// --------------------------------------------------------------------------- +// misc macros +// --------------------------------------------------------------------------- + +#if wxUSE_GUI + +#define MEANING_CHARACTER '0' +#define DEFAULT_ITEM_WIDTH 100 +#define DEFAULT_ITEM_HEIGHT 80 + +// Return the height of a native text control corresponding to the given +// character height (as returned by GetCharHeight() or wxGetCharSize()). +// +// The wxWindow parameter is currently not used but should still be valid. +inline int wxGetEditHeightFromCharHeight(int cy, const wxWindow* WXUNUSED(w)) +{ + // The value 8 here is empiric, i.e. it's not necessarily correct, but + // seems to work relatively well. + // Don't use FromDIP(8), this seems not needed. + return cy + 8; +} + +// Compatibility macro used in the existing code. It assumes that it's called +// from a method of wxWindow-derived object. +#define EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy) \ + wxGetEditHeightFromCharHeight((cy), this) + +// Generic subclass proc, for panel item moving/sizing and intercept +// EDIT control VK_RETURN messages +extern LONG APIENTRY + wxSubclassedGenericControlProc(WXHWND hWnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + +#endif // wxUSE_GUI + +// --------------------------------------------------------------------------- +// useful macros and functions +// --------------------------------------------------------------------------- + +// a wrapper macro for ZeroMemory() +#define wxZeroMemory(obj) ::ZeroMemory(&obj, sizeof(obj)) + +// This one is a macro so that it can be tested with #ifdef, it will be +// undefined if it cannot be implemented for a given compiler. +// Vc++, dmc, ow, mingw akk have _get_osfhandle() and Cygwin has +// get_osfhandle. Others are currently unknown, e.g. Salford, Intel, Visual +// Age. +#if defined(__CYGWIN__) + #define wxGetOSFHandle(fd) ((HANDLE)get_osfhandle(fd)) +#elif defined(__VISUALC__) \ + || defined(__MINGW32__) + #define wxGetOSFHandle(fd) ((HANDLE)_get_osfhandle(fd)) + #define wxOpenOSFHandle(h, flags) (_open_osfhandle(wxPtrToUInt(h), flags)) + + wxDECL_FOR_STRICT_MINGW32(FILE*, _fdopen, (int, const char*)) + #define wx_fdopen _fdopen +#endif + +// close the handle in the class dtor +template <wxUIntPtr INVALID_VALUE> +class AutoHANDLE +{ +public: + explicit AutoHANDLE(HANDLE handle = InvalidHandle()) : m_handle(handle) { } + + bool IsOk() const { return m_handle != InvalidHandle(); } + operator HANDLE() const { return m_handle; } + + ~AutoHANDLE() { if ( IsOk() ) DoClose(); } + + void Close() + { + wxCHECK_RET(IsOk(), wxT("Handle must be valid")); + + DoClose(); + + m_handle = InvalidHandle(); + } + +protected: + // We need this helper function because integer INVALID_VALUE is not + // implicitly convertible to HANDLE, which is a pointer. + static HANDLE InvalidHandle() + { + wxUIntPtr h = INVALID_VALUE; + return reinterpret_cast<HANDLE>(h); + } + + void DoClose() + { + if ( !::CloseHandle(m_handle) ) + wxLogLastError(wxT("CloseHandle")); + } + + WXHANDLE m_handle; +}; + +// a template to make initializing Windows structs less painful: it zeros all +// the struct fields and also sets cbSize member to the correct value (and so +// can be only used with structures which have this member...) +template <class T> +struct WinStruct : public T +{ + WinStruct() + { + ::ZeroMemory(this, sizeof(T)); + + // explicit qualification is required here for this to be valid C++ + this->cbSize = sizeof(T); + } +}; + + +// Macros for converting wxString to the type expected by API functions. +// +// Normally it is enough to just use wxString::t_str() which is implicitly +// convertible to LPCTSTR, but in some cases an explicit conversion is required. +// +// In such cases wxMSW_CONV_LPCTSTR() should be used. But if an API function +// takes a non-const pointer, wxMSW_CONV_LPTSTR() which casts away the +// constness (but doesn't make it possible to really modify the returned +// pointer, of course) should be used. And if a string is passed as LPARAM, use +// wxMSW_CONV_LPARAM() which does the required ugly reinterpret_cast<> too. +#define wxMSW_CONV_LPCTSTR(s) static_cast<const wxChar *>((s).t_str()) +#define wxMSW_CONV_LPTSTR(s) const_cast<wxChar *>(wxMSW_CONV_LPCTSTR(s)) +#define wxMSW_CONV_LPARAM(s) reinterpret_cast<LPARAM>(wxMSW_CONV_LPCTSTR(s)) + + +#if wxUSE_GUI + +#include "wx/gdicmn.h" +#include "wx/colour.h" + +#ifdef COM_DECLSPEC_NOTHROW + #define wxSTDMETHODIMP COM_DECLSPEC_NOTHROW STDMETHODIMP +#else + #define wxSTDMETHODIMP STDMETHODIMP +#endif + +// make conversion from wxColour and COLORREF a bit less painful +inline COLORREF wxColourToRGB(const wxColour& c) +{ + return RGB(c.Red(), c.Green(), c.Blue()); +} + +inline COLORREF wxColourToPalRGB(const wxColour& c) +{ + return PALETTERGB(c.Red(), c.Green(), c.Blue()); +} + +inline wxColour wxRGBToColour(COLORREF rgb) +{ + return wxColour(GetRValue(rgb), GetGValue(rgb), GetBValue(rgb)); +} + +inline void wxRGBToColour(wxColour& c, COLORREF rgb) +{ + c.Set(GetRValue(rgb), GetGValue(rgb), GetBValue(rgb)); +} + +// get the standard colour map for some standard colours - see comment in this +// function to understand why is it needed and when should it be used +// +// it returns a wxCOLORMAP (can't use COLORMAP itself here as comctl32.dll +// might be not included/available) array of size wxSTD_COLOUR_MAX +// +// NB: if you change these colours, update wxBITMAP_STD_COLOURS in the +// resources as well: it must have the same number of pixels! +enum wxSTD_COLOUR +{ + wxSTD_COL_BTNTEXT, + wxSTD_COL_BTNSHADOW, + wxSTD_COL_BTNFACE, + wxSTD_COL_BTNHIGHLIGHT, + wxSTD_COL_MAX +}; + +struct WXDLLIMPEXP_CORE wxCOLORMAP +{ + COLORREF from, to; +}; + +// this function is implemented in src/msw/window.cpp +extern wxCOLORMAP *wxGetStdColourMap(); + +// create a wxRect from Windows RECT +inline wxRect wxRectFromRECT(const RECT& rc) +{ + return wxRect(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top); +} + +// copy Windows RECT to our wxRect +inline void wxCopyRECTToRect(const RECT& rc, wxRect& rect) +{ + rect = wxRectFromRECT(rc); +} + +// and vice versa +inline void wxCopyRectToRECT(const wxRect& rect, RECT& rc) +{ + // note that we don't use wxRect::GetRight() as it is one of compared to + // wxRectFromRECT() above + rc.top = rect.y; + rc.left = rect.x; + rc.right = rect.x + rect.width; + rc.bottom = rect.y + rect.height; +} + +// translations between HIMETRIC units (which OLE likes) and pixels (which are +// liked by all the others) - implemented in msw/utilsexc.cpp +extern void HIMETRICToPixel(LONG *x, LONG *y); +extern void HIMETRICToPixel(LONG *x, LONG *y, HDC hdcRef); +extern void PixelToHIMETRIC(LONG *x, LONG *y); +extern void PixelToHIMETRIC(LONG *x, LONG *y, HDC hdcRef); + +// Windows convention of the mask is opposed to the wxWidgets one, so we need +// to invert the mask each time we pass one/get one to/from Windows +extern HBITMAP wxInvertMask(HBITMAP hbmpMask, int w = 0, int h = 0); + +// Creates an icon or cursor depending from a bitmap +// +// The bitmap must be valid and it should have a mask. If it doesn't, a default +// mask is created using light grey as the transparent colour. +extern HICON wxBitmapToHICON(const wxBitmap& bmp); + +// Same requirements as above apply and the bitmap must also have the correct +// size. +extern +HCURSOR wxBitmapToHCURSOR(const wxBitmap& bmp, int hotSpotX, int hotSpotY); + +extern int wxGetSystemMetrics(int nIndex, const wxWindow* win); + +extern bool wxSystemParametersInfo(UINT uiAction, UINT uiParam, + PVOID pvParam, UINT fWinIni, + const wxWindow* win); + +#if wxUSE_OWNER_DRAWN + +// Draw the bitmap in specified state (this is used by owner drawn controls) +enum wxDSBStates +{ + wxDSB_NORMAL = 0, + wxDSB_SELECTED, + wxDSB_DISABLED +}; + +extern +BOOL wxDrawStateBitmap(HDC hDC, HBITMAP hBitmap, int x, int y, UINT uState); + +#endif // wxUSE_OWNER_DRAWN + +// get the current state of SHIFT/CTRL/ALT keys +inline bool wxIsModifierDown(int vk) +{ + // GetKeyState() returns different negative values on WinME and WinNT, + // so simply test for negative value. + return ::GetKeyState(vk) < 0; +} + +inline bool wxIsShiftDown() +{ + return wxIsModifierDown(VK_SHIFT); +} + +inline bool wxIsCtrlDown() +{ + return wxIsModifierDown(VK_CONTROL); +} + +inline bool wxIsAltDown() +{ + return wxIsModifierDown(VK_MENU); +} + +inline bool wxIsAnyModifierDown() +{ + return wxIsShiftDown() || wxIsCtrlDown() || wxIsAltDown(); +} + +// wrapper around GetWindowRect() and GetClientRect() APIs doing error checking +// for Win32 +inline RECT wxGetWindowRect(HWND hwnd) +{ + RECT rect; + + if ( !::GetWindowRect(hwnd, &rect) ) + { + wxLogLastError(wxT("GetWindowRect")); + } + + return rect; +} + +inline RECT wxGetClientRect(HWND hwnd) +{ + RECT rect; + + if ( !::GetClientRect(hwnd, &rect) ) + { + wxLogLastError(wxT("GetClientRect")); + } + + return rect; +} + +// --------------------------------------------------------------------------- +// small helper classes +// --------------------------------------------------------------------------- + +// This class can only be used with wxMSW wxWindow, as it doesn't have +// {Set,Get}HWND() methods in the other ports, but this file is currently +// included for wxQt/MSW too. It's not clear whether it should be, really, but +// for now allow it to compile in this port too. +#ifdef __WXMSW__ + +// Temporarily assign the given HWND to the window in ctor and unset it back to +// the original value (usually 0) in dtor. +class TempHWNDSetter +{ +public: + TempHWNDSetter(wxWindow* win, WXHWND hWnd) + : m_win(win), m_hWndOrig(m_win->GetHWND()) + { + m_win->SetHWND(hWnd); + } + + ~TempHWNDSetter() + { + m_win->SetHWND(m_hWndOrig); + } + +private: + wxWindow* const m_win; + WXHWND const m_hWndOrig; + + wxDECLARE_NO_COPY_CLASS(TempHWNDSetter); +}; + +#endif // __WXMSW__ + +// create an instance of this class and use it as the HDC for screen, will +// automatically release the DC going out of scope +class ScreenHDC +{ +public: + ScreenHDC() { m_hdc = ::GetDC(NULL); } + ~ScreenHDC() { ::ReleaseDC(NULL, m_hdc); } + + operator HDC() const { return m_hdc; } + +private: + HDC m_hdc; + + wxDECLARE_NO_COPY_CLASS(ScreenHDC); +}; + +// the same as ScreenHDC but for window DCs (and if HWND is NULL, then exactly +// the same as it) +class WindowHDC +{ +public: + WindowHDC() : m_hwnd(NULL), m_hdc(NULL) { } + WindowHDC(HWND hwnd) { m_hdc = ::GetDC(m_hwnd = hwnd); } + ~WindowHDC() { if ( m_hdc ) { ::ReleaseDC(m_hwnd, m_hdc); } } + + operator HDC() const { return m_hdc; } + +private: + HWND m_hwnd; + HDC m_hdc; + + wxDECLARE_NO_COPY_CLASS(WindowHDC); +}; + +// the same as ScreenHDC but for memory DCs: creates the HDC compatible with +// the given one (screen by default) in ctor and destroys it in dtor +class MemoryHDC +{ +public: + MemoryHDC(HDC hdc = NULL) { m_hdc = ::CreateCompatibleDC(hdc); } + ~MemoryHDC() { ::DeleteDC(m_hdc); } + + operator HDC() const { return m_hdc; } + +private: + HDC m_hdc; + + wxDECLARE_NO_COPY_CLASS(MemoryHDC); +}; + +// Helper function returning the resolution of the given HDC. +inline wxSize wxGetDPIofHDC(HDC hdc) +{ + return wxSize(::GetDeviceCaps(hdc, LOGPIXELSX), + ::GetDeviceCaps(hdc, LOGPIXELSY)); +} + +// a class which selects a GDI object into a DC in its ctor and deselects in +// dtor +class SelectInHDC +{ +private: + void DoInit(HGDIOBJ hgdiobj) { m_hgdiobj = ::SelectObject(m_hdc, hgdiobj); } + +public: + SelectInHDC() : m_hdc(NULL), m_hgdiobj(NULL) { } + SelectInHDC(HDC hdc, HGDIOBJ hgdiobj) : m_hdc(hdc) { DoInit(hgdiobj); } + + void Init(HDC hdc, HGDIOBJ hgdiobj) + { + wxASSERT_MSG( !m_hdc, wxT("initializing twice?") ); + + m_hdc = hdc; + + DoInit(hgdiobj); + } + + ~SelectInHDC() { if ( m_hdc ) ::SelectObject(m_hdc, m_hgdiobj); } + + // return true if the object was successfully selected + operator bool() const { return m_hgdiobj != NULL; } + +private: + HDC m_hdc; + HGDIOBJ m_hgdiobj; + + wxDECLARE_NO_COPY_CLASS(SelectInHDC); +}; + +// a class which cleans up any GDI object +class AutoGDIObject +{ +protected: + AutoGDIObject() { m_gdiobj = NULL; } + AutoGDIObject(HGDIOBJ gdiobj) : m_gdiobj(gdiobj) { } + ~AutoGDIObject() { if ( m_gdiobj ) ::DeleteObject(m_gdiobj); } + + void InitGdiobj(HGDIOBJ gdiobj) + { + wxASSERT_MSG( !m_gdiobj, wxT("initializing twice?") ); + + m_gdiobj = gdiobj; + } + + HGDIOBJ GetObject() const { return m_gdiobj; } + +private: + HGDIOBJ m_gdiobj; +}; + +// TODO: all this asks for using a AutoHandler<T, CreateFunc> template... + +// a class for temporary brushes +class AutoHBRUSH : private AutoGDIObject +{ +public: + AutoHBRUSH(COLORREF col) + : AutoGDIObject(::CreateSolidBrush(col)) { } + + operator HBRUSH() const { return (HBRUSH)GetObject(); } +}; + +// a class for temporary fonts +class AutoHFONT : private AutoGDIObject +{ +private: +public: + AutoHFONT() + : AutoGDIObject() { } + + AutoHFONT(const LOGFONT& lf) + : AutoGDIObject(::CreateFontIndirect(&lf)) { } + + void Init(const LOGFONT& lf) { InitGdiobj(::CreateFontIndirect(&lf)); } + + operator HFONT() const { return (HFONT)GetObject(); } +}; + +// a class for temporary pens +class AutoHPEN : private AutoGDIObject +{ +public: + AutoHPEN(COLORREF col) + : AutoGDIObject(::CreatePen(PS_SOLID, 0, col)) { } + + operator HPEN() const { return (HPEN)GetObject(); } +}; + +// classes for temporary bitmaps +class AutoHBITMAP : private AutoGDIObject +{ +public: + AutoHBITMAP() + : AutoGDIObject() { } + + AutoHBITMAP(HBITMAP hbmp) : AutoGDIObject(hbmp) { } + + void Init(HBITMAP hbmp) { InitGdiobj(hbmp); } + + operator HBITMAP() const { return (HBITMAP)GetObject(); } +}; + +class CompatibleBitmap : public AutoHBITMAP +{ +public: + CompatibleBitmap(HDC hdc, int w, int h) + : AutoHBITMAP(::CreateCompatibleBitmap(hdc, w, h)) + { + } +}; + +class MonoBitmap : public AutoHBITMAP +{ +public: + MonoBitmap(int w, int h) + : AutoHBITMAP(::CreateBitmap(w, h, 1, 1, NULL)) + { + } +}; + +// class automatically destroys the region object +class AutoHRGN : private AutoGDIObject +{ +public: + AutoHRGN(HRGN hrgn) : AutoGDIObject(hrgn) { } + + operator HRGN() const { return (HRGN)GetObject(); } +}; + +// Class automatically freeing ICONINFO struct fields after retrieving it using +// GetIconInfo(). +class AutoIconInfo : public ICONINFO +{ +public: + AutoIconInfo() { wxZeroMemory(*this); } + + bool GetFrom(HICON hIcon) + { + if ( !::GetIconInfo(hIcon, this) ) + { + wxLogLastError(wxT("GetIconInfo")); + return false; + } + + return true; + } + + ~AutoIconInfo() + { + if ( hbmColor ) + ::DeleteObject(hbmColor); + if ( hbmMask ) + ::DeleteObject(hbmMask); + } +}; + +// class sets the specified clipping region during its life time +class HDCClipper +{ +public: + HDCClipper(HDC hdc, HRGN hrgn) + : m_hdc(hdc) + { + if ( !::SelectClipRgn(hdc, hrgn) ) + { + wxLogLastError(wxT("SelectClipRgn")); + } + } + + ~HDCClipper() + { + ::SelectClipRgn(m_hdc, NULL); + } + +private: + HDC m_hdc; + + wxDECLARE_NO_COPY_CLASS(HDCClipper); +}; + +// set the given map mode for the life time of this object + class HDCMapModeChanger + { + public: + HDCMapModeChanger(HDC hdc, int mm) + : m_hdc(hdc) + { + m_modeOld = ::SetMapMode(hdc, mm); + if ( !m_modeOld ) + { + wxLogLastError(wxT("SelectClipRgn")); + } + } + + ~HDCMapModeChanger() + { + if ( m_modeOld ) + ::SetMapMode(m_hdc, m_modeOld); + } + + private: + HDC m_hdc; + int m_modeOld; + + wxDECLARE_NO_COPY_CLASS(HDCMapModeChanger); + }; + + #define wxCHANGE_HDC_MAP_MODE(hdc, mm) \ + HDCMapModeChanger wxMAKE_UNIQUE_NAME(wxHDCMapModeChanger)(hdc, mm) + +// smart pointer using GlobalAlloc/GlobalFree() +class GlobalPtr +{ +public: + // default ctor, call Init() later + GlobalPtr() + { + m_hGlobal = NULL; + } + + // allocates a block of given size + void Init(size_t size, unsigned flags = GMEM_MOVEABLE) + { + m_hGlobal = ::GlobalAlloc(flags, size); + if ( !m_hGlobal ) + { + wxLogLastError(wxT("GlobalAlloc")); + } + } + + GlobalPtr(size_t size, unsigned flags = GMEM_MOVEABLE) + { + Init(size, flags); + } + + ~GlobalPtr() + { + if ( m_hGlobal && ::GlobalFree(m_hGlobal) ) + { + wxLogLastError(wxT("GlobalFree")); + } + } + + // Give ownership of our handle to the caller. + HGLOBAL Release() + { + HGLOBAL h = m_hGlobal; + m_hGlobal = NULL; + return h; + } + + // implicit conversion + operator HGLOBAL() const { return m_hGlobal; } + +private: + HGLOBAL m_hGlobal; + + wxDECLARE_NO_COPY_CLASS(GlobalPtr); +}; + +// when working with global pointers (which is unfortunately still necessary +// sometimes, e.g. for clipboard) it is important to unlock them exactly as +// many times as we lock them which just asks for using a "smart lock" class +class GlobalPtrLock +{ +public: + // default ctor, use Init() later -- should only be used if the HGLOBAL can + // be NULL (in which case Init() shouldn't be called) + GlobalPtrLock() + { + m_hGlobal = NULL; + m_ptr = NULL; + } + + // initialize the object, may be only called if we were created using the + // default ctor; HGLOBAL must not be NULL + void Init(HGLOBAL hGlobal) + { + m_hGlobal = hGlobal; + + // NB: GlobalLock() is a macro, not a function, hence don't use the + // global scope operator with it (and neither with GlobalUnlock()) + m_ptr = GlobalLock(hGlobal); + if ( !m_ptr ) + { + wxLogLastError(wxT("GlobalLock")); + } + } + + // initialize the object, HGLOBAL must not be NULL + GlobalPtrLock(HGLOBAL hGlobal) + { + Init(hGlobal); + } + + ~GlobalPtrLock() + { + if ( m_hGlobal && !GlobalUnlock(m_hGlobal) ) + { + // this might happen simply because the block became unlocked + DWORD dwLastError = ::GetLastError(); + if ( dwLastError != NO_ERROR ) + { + wxLogApiError(wxT("GlobalUnlock"), dwLastError); + } + } + } + + void *Get() const { return m_ptr; } + operator void *() const { return m_ptr; } + + size_t GetSize() const + { + const size_t size = ::GlobalSize(m_hGlobal); + if ( !size ) + wxLogLastError(wxT("GlobalSize")); + + return size; + } + +private: + HGLOBAL m_hGlobal; + void *m_ptr; + + wxDECLARE_NO_COPY_CLASS(GlobalPtrLock); +}; + +// register the class when it is first needed and unregister it in dtor +class ClassRegistrar +{ +public: + // ctor doesn't register the class, call Initialize() for this + ClassRegistrar() { m_registered = -1; } + + // return true if the class is already registered + bool IsInitialized() const { return m_registered != -1; } + + // return true if the class had been already registered + bool IsRegistered() const { return m_registered == 1; } + + // try to register the class if not done yet, return true on success + bool Register(const WNDCLASS& wc) + { + // we should only be called if we hadn't been initialized yet + wxASSERT_MSG( m_registered == -1, + wxT("calling ClassRegistrar::Register() twice?") ); + + m_registered = ::RegisterClass(&wc) ? 1 : 0; + if ( !IsRegistered() ) + { + wxLogLastError(wxT("RegisterClassEx()")); + } + else + { + m_clsname = wc.lpszClassName; + } + + return m_registered == 1; + } + + // get the name of the registered class (returns empty string if not + // registered) + const wxString& GetName() const { return m_clsname; } + + // unregister the class if it had been registered + ~ClassRegistrar() + { + if ( IsRegistered() ) + { + if ( !::UnregisterClass(m_clsname.t_str(), wxGetInstance()) ) + { + wxLogLastError(wxT("UnregisterClass")); + } + } + } + +private: + // initial value is -1 which means that we hadn't tried registering the + // class yet, it becomes true or false (1 or 0) when Initialize() is called + int m_registered; + + // the name of the class, only non empty if it had been registered + wxString m_clsname; +}; + +// --------------------------------------------------------------------------- +// macros to make casting between WXFOO and FOO a bit easier: the GetFoo() +// returns Foo cast to the Windows type for ourselves, while GetFooOf() takes +// an argument which should be a pointer or reference to the object of the +// corresponding class (this depends on the macro) +// --------------------------------------------------------------------------- + +#define GetHwnd() ((HWND)GetHWND()) +#define GetHwndOf(win) ((HWND)((win)->GetHWND())) +// old name +#define GetWinHwnd GetHwndOf + +#define GetHdc() ((HDC)GetHDC()) +#define GetHdcOf(dc) ((HDC)(dc).GetHDC()) + +#define GetHbitmap() ((HBITMAP)GetHBITMAP()) +#define GetHbitmapOf(bmp) ((HBITMAP)(bmp).GetHBITMAP()) + +#define GetHicon() ((HICON)GetHICON()) +#define GetHiconOf(icon) ((HICON)(icon).GetHICON()) + +#define GetHaccel() ((HACCEL)GetHACCEL()) +#define GetHaccelOf(table) ((HACCEL)((table).GetHACCEL())) + +#define GetHbrush() ((HBRUSH)GetResourceHandle()) +#define GetHbrushOf(brush) ((HBRUSH)(brush).GetResourceHandle()) + +#define GetHmenu() ((HMENU)GetHMenu()) +#define GetHmenuOf(menu) ((HMENU)(menu)->GetHMenu()) + +#define GetHcursor() ((HCURSOR)GetHCURSOR()) +#define GetHcursorOf(cursor) ((HCURSOR)(cursor).GetHCURSOR()) + +#define GetHfont() ((HFONT)GetHFONT()) +#define GetHfontOf(font) ((HFONT)(font).GetHFONT()) + +#define GetHimagelist() ((HIMAGELIST)GetHIMAGELIST()) +#define GetHimagelistOf(imgl) ((HIMAGELIST)(imgl)->GetHIMAGELIST()) + +#define GetHpalette() ((HPALETTE)GetHPALETTE()) +#define GetHpaletteOf(pal) ((HPALETTE)(pal).GetHPALETTE()) + +#define GetHpen() ((HPEN)GetResourceHandle()) +#define GetHpenOf(pen) ((HPEN)(pen).GetResourceHandle()) + +#define GetHrgn() ((HRGN)GetHRGN()) +#define GetHrgnOf(rgn) ((HRGN)(rgn).GetHRGN()) + +#endif // wxUSE_GUI + +// --------------------------------------------------------------------------- +// global functions +// --------------------------------------------------------------------------- + +// return the full path of the given module +inline wxString wxGetFullModuleName(HMODULE hmod) +{ + wxString fullname; + if ( !::GetModuleFileName + ( + hmod, + wxStringBuffer(fullname, MAX_PATH), + MAX_PATH + ) ) + { + wxLogLastError(wxT("GetModuleFileName")); + } + + return fullname; +} + +// return the full path of the program file +inline wxString wxGetFullModuleName() +{ + return wxGetFullModuleName((HMODULE)wxGetInstance()); +} + +// return the run-time version of the OS in a format similar to +// WINVER/_WIN32_WINNT compile-time macros: +// +// 0x0501 Windows XP, 2003 +// 0x0502 Windows XP SP2, 2003 SP1 +// 0x0600 Windows Vista, 2008 +// 0x0601 Windows 7 +// 0x0602 Windows 8 (currently also returned for 8.1 if program does not have a manifest indicating 8.1 support) +// 0x0603 Windows 8.1 (currently only returned for 8.1 if program has a manifest indicating 8.1 support) +// 0x1000 Windows 10 (currently only returned for 10 if program has a manifest indicating 10 support) +// +// for the other Windows versions wxWinVersion_Unknown is currently returned. +enum wxWinVersion +{ + wxWinVersion_3 = 0x0300, + wxWinVersion_NT3 = wxWinVersion_3, + + wxWinVersion_4 = 0x0400, + wxWinVersion_95 = wxWinVersion_4, + wxWinVersion_NT4 = wxWinVersion_4, + wxWinVersion_98 = 0x0410, + + wxWinVersion_5 = 0x0500, + wxWinVersion_ME = wxWinVersion_5, + wxWinVersion_NT5 = wxWinVersion_5, + wxWinVersion_2000 = wxWinVersion_5, + wxWinVersion_XP = 0x0501, + wxWinVersion_2003 = 0x0501, + wxWinVersion_XP_SP2 = 0x0502, + wxWinVersion_2003_SP1 = 0x0502, + + wxWinVersion_6 = 0x0600, + wxWinVersion_Vista = wxWinVersion_6, + wxWinVersion_NT6 = wxWinVersion_6, + + wxWinVersion_7 = 0x601, + + wxWinVersion_8 = 0x602, + wxWinVersion_8_1 = 0x603, + + wxWinVersion_10 = 0x1000, + + // Any version we can't recognize will be later than the last currently + // known one, so give it a value greater than any in the known range. + wxWinVersion_Unknown = 0x7fff +}; + +WXDLLIMPEXP_BASE wxWinVersion wxGetWinVersion(); + +// This is similar to wxSysErrorMsgStr(), but takes an extra HMODULE parameter +// specific to wxMSW. +WXDLLIMPEXP_BASE wxString wxMSWFormatMessage(DWORD nErrCode, HMODULE hModule = 0); + +#if wxUSE_GUI && defined(__WXMSW__) + +// cursor stuff +extern HCURSOR wxGetCurrentBusyCursor(); // from msw/utils.cpp +extern const wxCursor *wxGetGlobalCursor(); // from msw/cursor.cpp + +// GetCursorPos can fail without populating the POINT. This falls back to GetMessagePos. +WXDLLIMPEXP_CORE void wxGetCursorPosMSW(POINT* pt); + +#if WXWIN_COMPATIBILITY_3_0 +wxDEPRECATED_MSG("Use wxNativeFontInfo::lf directly instead of this private function") +WXDLLIMPEXP_CORE void wxFillLogFont(LOGFONT *logFont, const wxFont *font); +wxDEPRECATED_MSG("Use wxNativeFontInfo(LOGFONT) ctor instead of this private function") +WXDLLIMPEXP_CORE wxFont wxCreateFontFromLogFont(const LOGFONT *logFont); +#endif // WXWIN_COMPATIBILITY_3_0 + +WXDLLIMPEXP_CORE void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont& the_font); +WXDLLIMPEXP_CORE wxFontEncoding wxGetFontEncFromCharSet(int charset); + +inline void wxSetWindowFont(HWND hwnd, const wxFont& font) +{ + ::SendMessage(hwnd, WM_SETFONT, + (WPARAM)GetHfontOf(font), MAKELPARAM(TRUE, 0)); +} + +WXDLLIMPEXP_CORE void wxSliderEvent(WXHWND control, WXWORD wParam, WXWORD pos); +WXDLLIMPEXP_CORE void wxScrollBarEvent(WXHWND hbar, WXWORD wParam, WXWORD pos); + +// Find maximum size of window/rectangle +extern WXDLLIMPEXP_CORE void wxFindMaxSize(WXHWND hwnd, RECT *rect); + +// Safely get the window text (i.e. without using fixed size buffer) +extern WXDLLIMPEXP_CORE wxString wxGetWindowText(WXHWND hWnd); + +// get the window class name +extern WXDLLIMPEXP_CORE wxString wxGetWindowClass(WXHWND hWnd); + +// get the window id (should be unsigned, hence this is not wxWindowID which +// is, for mainly historical reasons, signed) +extern WXDLLIMPEXP_CORE int wxGetWindowId(WXHWND hWnd); + +// check if hWnd's WNDPROC is wndProc. Return true if yes, false if they are +// different +// +// wndProc parameter is unused and only kept for compatibility +extern WXDLLIMPEXP_CORE +bool wxCheckWindowWndProc(WXHWND hWnd, WXWNDPROC wndProc = NULL); + +// Does this window style specify any border? +inline bool wxStyleHasBorder(long style) +{ + return (style & (wxSIMPLE_BORDER | wxRAISED_BORDER | + wxSUNKEN_BORDER | wxDOUBLE_BORDER)) != 0; +} + +inline bool wxHasWindowExStyle(const wxWindowMSW *win, long style) +{ + return (::GetWindowLong(GetHwndOf(win), GWL_EXSTYLE) & style) != 0; +} + +// Common helper of wxUpdate{,Edit}LayoutDirection() below: sets or clears the +// given flag(s) depending on wxLayoutDirection and returns true if the flags +// really changed. +inline bool +wxUpdateExStyleForLayoutDirection(WXHWND hWnd, + wxLayoutDirection dir, + LONG_PTR flagsForRTL) +{ + wxCHECK_MSG( hWnd, false, + wxS("Can't set layout direction for invalid window") ); + + const LONG_PTR styleOld = ::GetWindowLongPtr(hWnd, GWL_EXSTYLE); + + LONG_PTR styleNew = styleOld; + switch ( dir ) + { + case wxLayout_LeftToRight: + styleNew &= ~flagsForRTL; + break; + + case wxLayout_RightToLeft: + styleNew |= flagsForRTL; + break; + + case wxLayout_Default: + wxFAIL_MSG(wxS("Invalid layout direction")); + } + + if ( styleNew == styleOld ) + return false; + + ::SetWindowLongPtr(hWnd, GWL_EXSTYLE, styleNew); + + return true; +} + +// Update layout direction flag for a generic window. +// +// See below for the special version that must be used with EDIT controls. +// +// Returns true if the layout direction did change. +inline bool wxUpdateLayoutDirection(WXHWND hWnd, wxLayoutDirection dir) +{ + return wxUpdateExStyleForLayoutDirection(hWnd, dir, WS_EX_LAYOUTRTL); +} + +// Update layout direction flag for an EDIT control. +// +// Returns true if anything changed or false if the direction flag was already +// set to the desired direction (which can't be wxLayout_Default). +inline bool wxUpdateEditLayoutDirection(WXHWND hWnd, wxLayoutDirection dir) +{ + return wxUpdateExStyleForLayoutDirection(hWnd, dir, + WS_EX_RIGHT | + WS_EX_RTLREADING | + WS_EX_LEFTSCROLLBAR); +} + +// Companion of the above function checking if an EDIT control uses RTL. +inline wxLayoutDirection wxGetEditLayoutDirection(WXHWND hWnd) +{ + wxCHECK_MSG( hWnd, wxLayout_Default, wxS("invalid window") ); + + // While we set 3 style bits above, we're only really interested in one of + // them here. In particularly, don't check for WS_EX_RIGHT as it can be set + // for a right-aligned control even if it doesn't use RTL. And while we + // could test WS_EX_LEFTSCROLLBAR, this doesn't really seem useful. + const LONG_PTR style = ::GetWindowLongPtr(hWnd, GWL_EXSTYLE); + + return style & WS_EX_RTLREADING ? wxLayout_RightToLeft + : wxLayout_LeftToRight; +} + +// ---------------------------------------------------------------------------- +// functions mapping HWND to wxWindow +// ---------------------------------------------------------------------------- + +// this function simply checks whether the given hwnd corresponds to a wxWindow +// and returns either that window if it does or NULL otherwise +extern WXDLLIMPEXP_CORE wxWindow* wxFindWinFromHandle(HWND hwnd); + +// find the window for HWND which is part of some wxWindow, i.e. unlike +// wxFindWinFromHandle() above it will also work for "sub controls" of a +// wxWindow. +// +// returns the wxWindow corresponding to the given HWND or NULL. +extern WXDLLIMPEXP_CORE wxWindow *wxGetWindowFromHWND(WXHWND hwnd); + +// Get the size of an icon +extern WXDLLIMPEXP_CORE wxSize wxGetHiconSize(HICON hicon); + +WXDLLIMPEXP_CORE void wxDrawLine(HDC hdc, int x1, int y1, int x2, int y2); + +WXDLLIMPEXP_CORE void wxDrawHVLine(HDC hdc, int x1, int y1, int x2, int y2, COLORREF color, int width); + +// fill the client rect of the given window on the provided dc using this brush +inline void wxFillRect(HWND hwnd, HDC hdc, HBRUSH hbr) +{ + RECT rc; + ::GetClientRect(hwnd, &rc); + ::FillRect(hdc, &rc, hbr); +} + +// ---------------------------------------------------------------------------- +// 32/64 bit helpers +// ---------------------------------------------------------------------------- + +// note that the casts to LONG_PTR here are required even on 32-bit machines +// for the 64-bit warning mode of later versions of MSVC (C4311/4312) +inline WNDPROC wxGetWindowProc(HWND hwnd) +{ + return (WNDPROC)(LONG_PTR)::GetWindowLongPtr(hwnd, GWLP_WNDPROC); +} + +inline void *wxGetWindowUserData(HWND hwnd) +{ + return (void *)(LONG_PTR)::GetWindowLongPtr(hwnd, GWLP_USERDATA); +} + +inline WNDPROC wxSetWindowProc(HWND hwnd, WNDPROC func) +{ + return (WNDPROC)(LONG_PTR)::SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)func); +} + +inline void *wxSetWindowUserData(HWND hwnd, void *data) +{ + return (void *)(LONG_PTR)::SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)data); +} + +#endif // wxUSE_GUI && __WXMSW__ + +#endif // _WX_PRIVATE_H_ diff --git a/lib/wxWidgets/include/wx/msw/private/button.h b/lib/wxWidgets/include/wx/msw/private/button.h new file mode 100644 index 0000000..9f605c6 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/button.h @@ -0,0 +1,76 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/button.h +// Purpose: helper functions used with native BUTTON control +// Author: Vadim Zeitlin +// Created: 2008-06-07 +// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_PRIVATE_BUTTON_H_ +#define _WX_MSW_PRIVATE_BUTTON_H_ + +// define some standard button constants which may be missing in the headers +#ifndef BS_PUSHLIKE + #define BS_PUSHLIKE 0x00001000L +#endif + +#ifndef BST_UNCHECKED + #define BST_UNCHECKED 0x0000 +#endif + +#ifndef BST_CHECKED + #define BST_CHECKED 0x0001 +#endif + +#ifndef BST_INDETERMINATE + #define BST_INDETERMINATE 0x0002 +#endif + +namespace wxMSWButton +{ + +// returns BS_MULTILINE if the label contains new lines or 0 otherwise +inline int GetMultilineStyle(const wxString& label) +{ + return label.find(wxT('\n')) == wxString::npos ? 0 : BS_MULTILINE; +} + +// update the style of the specified HWND to include or exclude BS_MULTILINE +// depending on whether the label contains the new lines +void UpdateMultilineStyle(HWND hwnd, const wxString& label); + +// flags for ComputeBestSize() and GetFittingSize() +enum +{ + Size_AuthNeeded = 1, + Size_ExactFit = 2 +}; + +// NB: All the functions below are implemented in src/msw/button.cpp + +// Compute the button size (as if wxBU_EXACTFIT were specified, i.e. without +// adjusting it to be of default size if it's smaller) for the given label size +WXDLLIMPEXP_CORE wxSize +GetFittingSize(wxWindow *win, const wxSize& sizeLabel, int flags = 0); + +// Compute the button size (as if wxBU_EXACTFIT were specified) by computing +// its label size and then calling GetFittingSize(). +wxSize ComputeBestFittingSize(wxControl *btn, int flags = 0); + +// Increase the size passed as parameter to be at least the standard button +// size if the control doesn't have wxBU_EXACTFIT style and also cache it as +// the best size and return its value -- this is used in DoGetBestSize() +// implementation. +wxSize IncreaseToStdSizeAndCache(wxControl *btn, const wxSize& size); + +// helper of wxToggleButton::DoGetBestSize() +inline wxSize ComputeBestSize(wxControl *btn, int flags = 0) +{ + return IncreaseToStdSizeAndCache(btn, ComputeBestFittingSize(btn, flags)); +} + +} // namespace wxMSWButton + +#endif // _WX_MSW_PRIVATE_BUTTON_H_ + diff --git a/lib/wxWidgets/include/wx/msw/private/comptr.h b/lib/wxWidgets/include/wx/msw/private/comptr.h new file mode 100644 index 0000000..db8c9bc --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/comptr.h @@ -0,0 +1,134 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/comptr.h +// Purpose: Smart pointer for COM interfaces. +// Author: PB +// Created: 2012-04-16 +// Copyright: (c) 2012 wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_PRIVATE_COMPTR_H_ +#define _WX_MSW_PRIVATE_COMPTR_H_ + +// ---------------------------------------------------------------------------- +// wxCOMPtr: A minimalistic smart pointer for use with COM interfaces. +// ---------------------------------------------------------------------------- + +template <class T> +class wxCOMPtr +{ +public: + typedef T element_type; + + wxCOMPtr() + : m_ptr(NULL) + { + } + + explicit wxCOMPtr(T* ptr) + : m_ptr(ptr) + { + if ( m_ptr ) + m_ptr->AddRef(); + } + + wxCOMPtr(const wxCOMPtr& ptr) + : m_ptr(ptr.get()) + { + if ( m_ptr ) + m_ptr->AddRef(); + } + + ~wxCOMPtr() + { + if ( m_ptr ) + m_ptr->Release(); + } + + void reset(T* ptr = NULL) + { + if ( m_ptr != ptr) + { + if ( ptr ) + ptr->AddRef(); + if ( m_ptr ) + m_ptr->Release(); + m_ptr = ptr; + } + } + + wxCOMPtr& operator=(const wxCOMPtr& ptr) + { + reset(ptr.get()); + return *this; + } + + wxCOMPtr& operator=(T* ptr) + { + reset(ptr); + return *this; + } + + operator T*() const + { + return m_ptr; + } + + T& operator*() const + { + return *m_ptr; + } + + T* operator->() const + { + return m_ptr; + } + + // It would be better to forbid direct access completely but we do need + // for QueryInterface() and similar functions, so provide it but it can + // only be used to initialize the pointer, not to modify an existing one. + T** operator&() + { + wxASSERT_MSG(!m_ptr, + wxS("Can't get direct access to initialized pointer")); + + return &m_ptr; + } + + T* get() const + { + return m_ptr; + } + + T* Get() const + { + return m_ptr; + } + + bool operator<(T* ptr) const + { + return get() < ptr; + } + +private: + T* m_ptr; +}; + +// Define a helper for the macro below: we just need a function taking a +// pointer and not returning anything to avoid warnings about unused return +// value of the cast in the macro itself. +namespace wxPrivate { inline void PPV_ARGS_CHECK(void*) { } } + +// Takes the interface name and a pointer to a pointer of the interface type +// and expands into the IID of this interface and the same pointer but after a +// type-safety check. +// +// This is similar to the standard IID_PPV_ARGS macro but takes the pointer +// type instead of relying on the non-standard Microsoft __uuidof(). +#define wxIID_PPV_ARGS(IType, pType) \ + IID_##IType, \ + (wxPrivate::PPV_ARGS_CHECK(static_cast<IType*>(*pType)), \ + reinterpret_cast<void**>(pType)) + +#endif // _WX_MSW_PRIVATE_COMPTR_H_ + diff --git a/lib/wxWidgets/include/wx/msw/private/cotaskmemptr.h b/lib/wxWidgets/include/wx/msw/private/cotaskmemptr.h new file mode 100644 index 0000000..96d54c4 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/cotaskmemptr.h @@ -0,0 +1,85 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/cotaskmemptr.h +// Purpose: RAII class for pointers to be freed with ::CoTaskMemFree(). +// Author: PB +// Created: 2020-06-09 +// Copyright: (c) 2020 wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_PRIVATE_COTASKMEMPTR_H_ +#define _WX_MSW_PRIVATE_COTASKMEMPTR_H_ + +// needed for ::CoTaskMem{Alloc|Free}() +#include "wx/msw/wrapwin.h" + +// ---------------------------------------------------------------------------- +// wxCoTaskMemPtr: A barebone RAII class for pointers to be freed with ::CoTaskMemFree(). +// ---------------------------------------------------------------------------- + +template <class T> +class wxCoTaskMemPtr +{ +public: + typedef T element_type; + + wxCoTaskMemPtr() + : m_ptr(NULL) + {} + + explicit wxCoTaskMemPtr(T* ptr) + : m_ptr(ptr) + {} + + // Uses ::CoTaskMemAlloc() to allocate size bytes. + explicit wxCoTaskMemPtr(size_t size) + : m_ptr(static_cast<T*>(::CoTaskMemAlloc(size))) + {} + + ~wxCoTaskMemPtr() + { + ::CoTaskMemFree(m_ptr); + } + + void reset(T* ptr = NULL) + { + if ( m_ptr != ptr ) + { + ::CoTaskMemFree(m_ptr); + m_ptr = ptr; + } + } + + operator T*() const + { + return m_ptr; + } + + // It would be better to forbid direct access completely but we do need it, + // so provide it but it can only be used to initialize the pointer, + // not to modify an existing one. + T** operator&() + { + wxASSERT_MSG(!m_ptr, + wxS("Can't get direct access to initialized pointer")); + + return &m_ptr; + } + + // Gives up the ownership of the pointer, + // making the caller responsible for freeing it. + T* release() + { + T* ptr(m_ptr); + + m_ptr = NULL; + return ptr; + } + +private: + T* m_ptr; + + wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxCoTaskMemPtr, T); +}; + +#endif // _WX_MSW_PRIVATE_COTASKMEMPTR_H_ diff --git a/lib/wxWidgets/include/wx/msw/private/customdraw.h b/lib/wxWidgets/include/wx/msw/private/customdraw.h new file mode 100644 index 0000000..3d2a10f --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/customdraw.h @@ -0,0 +1,59 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/customdraw.h +// Purpose: Helper for implementing custom drawing support in wxMSW +// Author: Vadim Zeitlin +// Created: 2016-04-16 +// Copyright: (c) 2016 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_CUSTOMDRAW_H_ +#define _WX_MSW_CUSTOMDRAW_H_ + +#include "wx/itemattr.h" + +#include "wx/msw/wrapcctl.h" + +namespace wxMSWImpl +{ + +// ---------------------------------------------------------------------------- +// CustomDraw: inherit from this class and forward NM_CUSTOMDRAW to it +// ---------------------------------------------------------------------------- + +class CustomDraw +{ +public: + // Trivial default ctor needed for non-copyable class. + CustomDraw() + { + } + + // Virtual dtor for the base class. + virtual ~CustomDraw() + { + } + + // Implementation of NM_CUSTOMDRAW handler, returns one of CDRF_XXX + // constants, possibly CDRF_DODEFAULT if custom drawing is not necessary. + LPARAM HandleCustomDraw(LPARAM lParam); + +private: + // Return true if we need custom drawing at all. + virtual bool HasCustomDrawnItems() const = 0; + + // Return the attribute to use for the given item, can return NULL if this + // item doesn't need to be custom-drawn. + virtual const wxItemAttr* GetItemAttr(DWORD_PTR dwItemSpec) const = 0; + + + // Set the colours and font for the specified HDC, return CDRF_NEWFONT if + // the font was changed. + LPARAM HandleItemPrepaint(const wxItemAttr& attr, HDC hdc); + + wxDECLARE_NO_COPY_CLASS(CustomDraw); +}; + +} // namespace wxMSWImpl + +#endif // _WX_MSW_CUSTOMDRAW_H_ diff --git a/lib/wxWidgets/include/wx/msw/private/datecontrols.h b/lib/wxWidgets/include/wx/msw/private/datecontrols.h new file mode 100644 index 0000000..9794cfa --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/datecontrols.h @@ -0,0 +1,30 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/datecontrols.h +// Purpose: implementation helpers for wxDatePickerCtrl and wxCalendarCtrl +// Author: Vadim Zeitlin +// Created: 2008-04-04 +// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _MSW_PRIVATE_DATECONTROLS_H_ +#define _MSW_PRIVATE_DATECONTROLS_H_ + +#include "wx/datetime.h" + +#include "wx/msw/wrapwin.h" + +// namespace for the helper functions related to the date controls +namespace wxMSWDateControls +{ + +// do the one time only initialization of date classes of comctl32.dll, return +// true if ok or log an error and return false if we failed (this can only +// happen with a very old version of common controls DLL, i.e. before 4.70) +extern bool CheckInitialization(); + +} // namespace wxMSWDateControls + +#endif // _MSW_PRIVATE_DATECONTROLS_H_ + + diff --git a/lib/wxWidgets/include/wx/msw/private/dc.h b/lib/wxWidgets/include/wx/msw/private/dc.h new file mode 100644 index 0000000..303cd19 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/dc.h @@ -0,0 +1,147 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/dc.h +// Purpose: private wxMSW helpers for working with HDCs +// Author: Vadim Zeitlin +// Created: 2009-06-16 (extracted from src/msw/dc.cpp) +// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _MSW_PRIVATE_DC_H_ +#define _MSW_PRIVATE_DC_H_ + +#include "wx/msw/dc.h" +#include "wx/msw/wrapwin.h" + +namespace wxMSWImpl +{ + +// various classes to change some DC property temporarily + +// text background and foreground colours +class wxTextColoursChanger +{ +public: + wxTextColoursChanger(HDC hdc, const wxMSWDCImpl& dc) + : m_hdc(hdc) + { + Change(dc.GetTextForeground(), dc.GetTextBackground()); + } + + wxTextColoursChanger(HDC hdc, const wxColour& colFg, const wxColour& colBg) + : m_hdc(hdc) + { + Change(colFg, colBg); + } + + wxTextColoursChanger(HDC hdc, COLORREF colFg, COLORREF colBg) + : m_hdc(hdc) + { + Change(colFg, colBg); + } + + ~wxTextColoursChanger() + { + if ( m_oldColFg != CLR_INVALID ) + ::SetTextColor(m_hdc, m_oldColFg); + if ( m_oldColBg != CLR_INVALID ) + ::SetBkColor(m_hdc, m_oldColBg); + } + +protected: + // this ctor doesn't change mode immediately, call Change() later to do it + // only if needed + wxTextColoursChanger(HDC hdc) + : m_hdc(hdc) + { + m_oldColFg = + m_oldColBg = CLR_INVALID; + } + + void Change(const wxColour& colFg, const wxColour& colBg) + { + Change(colFg.IsOk() ? colFg.GetPixel() : CLR_INVALID, + colBg.IsOk() ? colBg.GetPixel() : CLR_INVALID); + } + + void Change(COLORREF colFg, COLORREF colBg) + { + if ( colFg != CLR_INVALID ) + { + m_oldColFg = ::SetTextColor(m_hdc, colFg); + if ( m_oldColFg == CLR_INVALID ) + { + wxLogLastError(wxT("SetTextColor")); + } + } + else + { + m_oldColFg = CLR_INVALID; + } + + if ( colBg != CLR_INVALID ) + { + m_oldColBg = ::SetBkColor(m_hdc, colBg); + if ( m_oldColBg == CLR_INVALID ) + { + wxLogLastError(wxT("SetBkColor")); + } + } + else + { + m_oldColBg = CLR_INVALID; + } + } + +private: + const HDC m_hdc; + COLORREF m_oldColFg, + m_oldColBg; + + wxDECLARE_NO_COPY_CLASS(wxTextColoursChanger); +}; + +// background mode +class wxBkModeChanger +{ +public: + // set background mode to opaque if mode != wxBRUSHSTYLE_TRANSPARENT + wxBkModeChanger(HDC hdc, int mode) + : m_hdc(hdc) + { + Change(mode); + } + + ~wxBkModeChanger() + { + if ( m_oldMode ) + ::SetBkMode(m_hdc, m_oldMode); + } + +protected: + // this ctor doesn't change mode immediately, call Change() later to do it + // only if needed + wxBkModeChanger(HDC hdc) : m_hdc(hdc) { m_oldMode = 0; } + + void Change(int mode) + { + m_oldMode = ::SetBkMode(m_hdc, mode == wxBRUSHSTYLE_TRANSPARENT + ? TRANSPARENT + : OPAQUE); + if ( !m_oldMode ) + { + wxLogLastError(wxT("SetBkMode")); + } + } + +private: + const HDC m_hdc; + int m_oldMode; + + wxDECLARE_NO_COPY_CLASS(wxBkModeChanger); +}; + +} // namespace wxMSWImpl + +#endif // _MSW_PRIVATE_DC_H_ + diff --git a/lib/wxWidgets/include/wx/msw/private/dcdynwrap.h b/lib/wxWidgets/include/wx/msw/private/dcdynwrap.h new file mode 100644 index 0000000..fe41430 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/dcdynwrap.h @@ -0,0 +1,39 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/dcdynwrap.h +// Purpose: Private dynamically loaded HDC-related functions +// Author: Vadim Zeitlin +// Created: 2016-05-26 (extracted from src/msw/dc.cpp) +// Copyright: (c) 2016 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_PRIVATE_DCDYNWRAP_H_ +#define _WX_MSW_PRIVATE_DCDYNWRAP_H_ + +#include "wx/msw/wrapwin.h" + +// Namespace for the wrapper functions, hopefully one day we'll be able to get +// rid of all of them and then it will be easy to find all occurrences of their +// use by just searching for this namespace name. +// +// All of the functions in this namespace must work *exactly* like the standard +// functions with the same name and just return an error if dynamically loading +// them failed. +// +// And they're all implemented in src/msw/dc.cpp. +namespace wxDynLoadWrappers +{ + +DWORD GetLayout(HDC hdc); +DWORD SetLayout(HDC hdc, DWORD dwLayout); + +BOOL AlphaBlend(HDC hdcDest, int xDest, int yDest, int wDest, int hDest, + HDC hdcSrc, int xSrc, int ySrc, int wSrc, int hSrc, + BLENDFUNCTION bf); + +BOOL GradientFill(HDC hdc, PTRIVERTEX pVert, ULONG numVert, + PVOID pMesh, ULONG numMesh, ULONG mode); + +} // namespace wxDynLoadWrappers + +#endif // _WX_MSW_PRIVATE_DCDYNWRAP_H_ diff --git a/lib/wxWidgets/include/wx/msw/private/dpiaware.h b/lib/wxWidgets/include/wx/msw/private/dpiaware.h new file mode 100644 index 0000000..522e0e5 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/dpiaware.h @@ -0,0 +1,103 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/dpiaware.h +// Purpose: AutoSystemDpiAware class +// Author: Maarten Bent +// Created: 2016-10-06 +// Copyright: (c) Maarten Bent +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_DPI_AWARE_H_ +#define _WX_MSW_DPI_AWARE_H_ + +#ifndef WX_PRECOMP + #include "wx/msw/missing.h" +#endif + +#include "wx/dynlib.h" +#include "wx/display.h" +#include "wx/sysopt.h" + +#if wxUSE_DYNLIB_CLASS + +namespace wxMSWImpl +{ + +// ---------------------------------------------------------------------------- +// Temporarily change the DPI Awareness context to GDIScaled or System +// ---------------------------------------------------------------------------- + +class AutoSystemDpiAware +{ + #define WXDPI_AWARENESS_CONTEXT_UNAWARE ((WXDPI_AWARENESS_CONTEXT)-1) + #define WXDPI_AWARENESS_CONTEXT_SYSTEM_AWARE ((WXDPI_AWARENESS_CONTEXT)-2) + #define WXDPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED ((WXDPI_AWARENESS_CONTEXT)-5) + typedef WXDPI_AWARENESS_CONTEXT + (WINAPI *SetThreadDpiAwarenessContext_t)(WXDPI_AWARENESS_CONTEXT); + +public: + AutoSystemDpiAware() + : m_prevContext(WXDPI_AWARENESS_CONTEXT_UNAWARE) + { + if ( !Needed() ) + return; + + if ( ms_pfnSetThreadDpiAwarenessContext == (SetThreadDpiAwarenessContext_t)-1) + { + wxLoadedDLL dllUser32("user32.dll"); + wxDL_INIT_FUNC(ms_pfn, SetThreadDpiAwarenessContext, dllUser32); + } + + if ( ms_pfnSetThreadDpiAwarenessContext ) + { + m_prevContext = ms_pfnSetThreadDpiAwarenessContext( + WXDPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED); + if ( !m_prevContext ) + { + m_prevContext = ms_pfnSetThreadDpiAwarenessContext( + WXDPI_AWARENESS_CONTEXT_SYSTEM_AWARE); + } + } + + } + + ~AutoSystemDpiAware() + { + if ( ms_pfnSetThreadDpiAwarenessContext && + ms_pfnSetThreadDpiAwarenessContext != (SetThreadDpiAwarenessContext_t)-1 ) + { + ms_pfnSetThreadDpiAwarenessContext(m_prevContext); + } + } + + static bool Needed() + { + // use system-dpi-aware context when: + // - the user did not set an option to force per-monitor context + // - there are displays with different DPI + if ( wxSystemOptions::GetOptionInt("msw.native-dialogs-pmdpi") == 1 ) + return false; + + bool diferentDPI = false; + for ( unsigned i = 1; i < wxDisplay::GetCount() && !diferentDPI; ++i ) + diferentDPI = wxDisplay(0u).GetPPI() != wxDisplay(i).GetPPI(); + return diferentDPI; + } + +private: + WXDPI_AWARENESS_CONTEXT m_prevContext; + + // This static member is defined in src/msw/window.cpp. + static SetThreadDpiAwarenessContext_t ms_pfnSetThreadDpiAwarenessContext; +}; + +#else // !wxUSE_DYNLIB_CLASS + +// Just a stub to avoid littering the code with wxUSE_DYNLIB_CLASS checks. +class AutoSystemDpiAware { }; + +#endif // wxUSE_DYNLIB_CLASS/!wxUSE_DYNLIB_CLASS + +} // namespace wxMSWImpl + +#endif // _WX_MSW_DPI_AWARE_H_ diff --git a/lib/wxWidgets/include/wx/msw/private/event.h b/lib/wxWidgets/include/wx/msw/private/event.h new file mode 100644 index 0000000..27825e4 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/event.h @@ -0,0 +1,104 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/event.h +// Purpose: Simple Windows 'event object' wrapper. +// Author: Troelsk, Vadim Zeitlin +// Created: 2014-05-07 +// Copyright: (c) 2014 wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_PRIVATE_EVENT_H_ +#define _WX_MSW_PRIVATE_EVENT_H_ + +#include "wx/msw/private.h" + +namespace wxWinAPI +{ + +class Event : public AutoHANDLE<0> +{ +public: + enum Kind + { + ManualReset, + AutomaticReset + }; + + enum InitialState + { + Signaled, + Nonsignaled + }; + + Event() + { + } + + // Wrappers around {Create,Set,Reset}Event() Windows API functions, with + // the same semantics. + bool Create(Kind kind = AutomaticReset, + InitialState initialState = Nonsignaled, + const wxChar* name = NULL); + bool Set(); + bool Reset(); + +private: + wxDECLARE_NO_COPY_CLASS(Event); +}; + +} // namespace wxWinAPI + +// ---------------------------------------------------------------------------- +// Implementations requiring windows.h; these are to moved out-of-line if +// this class is moved to a public header, or if [parts of] msw/private.h is +// changed to not depend on windows.h being included. +// ---------------------------------------------------------------------------- + +inline bool +wxWinAPI::Event::Create(wxWinAPI::Event::Kind kind, + wxWinAPI::Event::InitialState initialState, + const wxChar* name) +{ + wxCHECK_MSG( !IsOk(), false, wxS("Event can't be created twice") ); + + WXHANDLE handle = ::CreateEvent(NULL, + kind == ManualReset, + initialState == Signaled, + name); + if ( !handle ) + { + wxLogLastError(wxS("CreateEvent")); + return false; + } + + m_handle = handle; + return true; +} + +inline bool wxWinAPI::Event::Set() +{ + wxCHECK_MSG( m_handle, false, wxS("Event must be valid") ); + + if ( !::SetEvent(m_handle) ) + { + wxLogLastError(wxS("SetEvent")); + return false; + } + + return true; +} + +inline bool wxWinAPI::Event::Reset() +{ + wxCHECK_MSG( m_handle, false, wxS("Event must be valid") ); + + if ( !::ResetEvent(m_handle) ) + { + wxLogLastError(wxS("ResetEvent")); + return false; + } + + return true; +} + +#endif // _WX_MSW_PRIVATE_EVENT_H_ diff --git a/lib/wxWidgets/include/wx/msw/private/filedialog.h b/lib/wxWidgets/include/wx/msw/private/filedialog.h new file mode 100644 index 0000000..72f48a5 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/filedialog.h @@ -0,0 +1,89 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/filedialog.h +// Purpose: IFileDialog-related functions +// Author: Vadim Zeitlin +// Created: 2022-05-15 +// Copyright: (c) 2022 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_PRIVATE_FILEDIALOG_H_ +#define _WX_MSW_PRIVATE_FILEDIALOG_H_ + +#include "wx/msw/private.h" +#include "wx/msw/wrapshl.h" + +// We want to use IFileDialog if either wxDirDialog or wxFileDialog are used. +// +// IFileOpenDialog implementation needs wxDynamicLibrary for +// run-time linking SHCreateItemFromParsingName(), available +// only under Windows Vista and newer. +// It also needs a compiler providing declarations and definitions +// of interfaces available in Windows Vista. +// And it needs OLE support to actually use these interfaces. +#if (wxUSE_DIRDLG || wxUSE_FILEDLG) && wxUSE_DYNLIB_CLASS && wxUSE_OLE && \ + defined(__IFileOpenDialog_INTERFACE_DEFINED__) + #define wxUSE_IFILEOPENDIALOG 1 +#else + #define wxUSE_IFILEOPENDIALOG 0 +#endif + +#if wxUSE_IFILEOPENDIALOG + +#include "wx/msw/private/comptr.h" + +namespace wxMSWImpl +{ + +// For historical reasons, this class is defined in src/msw/dirdlg.cpp. +class wxIFileDialog +{ +public: + // Create the dialog of the specified type. + // + // CLSID must be either CLSID_FileOpenDialog or CLSID_FileSaveDialog. + // + // Use IsOk() to check if the dialog was created successfully. + explicit wxIFileDialog(const CLSID& clsid); + + // If this returns false, the dialog can't be used at all. + bool IsOk() const { return m_fileDialog.Get() != NULL; } + + // Set the dialog title. + void SetTitle(const wxString& title); + + // Set the initial path to show in the dialog. + void SetInitialPath(const wxString& path); + + // Add a shortcut. + void AddPlace(const wxString& path, FDAP fdap); + + // Show the file dialog with the given parent window and options. + // + // Returns the selected path, or paths, in the provided output parameters, + // depending on whether FOS_ALLOWMULTISELECT is part of the options. + // + // The return value is wxID_OK if any paths were returned, wxID_CANCEL if the + // dialog was cancelled. + int + Show(HWND owner, int options, wxArrayString* pathsOut, wxString* pathOut); + + // Behave as IFileDialog. + IFileDialog* Get() const { return m_fileDialog.Get(); } + IFileDialog* operator->() const { return m_fileDialog.Get(); } + +private: + wxCOMPtr<IFileDialog> m_fileDialog; +}; + +// Initialize an IShellItem object with the given path. +HRESULT InitShellItemFromPath(wxCOMPtr<IShellItem>& item, const wxString& path); + +// Extract the filesystem path corresponding to the given shell item. +HRESULT GetFSPathFromShellItem(const wxCOMPtr<IShellItem>& item, wxString& path); + +} // namespace wxMSWImpl + +#endif // wxUSE_IFILEOPENDIALOG + +#endif // _WX_MSW_PRIVATE_FILEDIALOG_H_ diff --git a/lib/wxWidgets/include/wx/msw/private/fswatcher.h b/lib/wxWidgets/include/wx/msw/private/fswatcher.h new file mode 100644 index 0000000..44b9c92 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/fswatcher.h @@ -0,0 +1,335 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/fswatcher.h +// Purpose: File system watcher impl classes +// Author: Bartosz Bekier +// Created: 2009-05-26 +// Copyright: (c) 2009 Bartosz Bekier <bartosz.bekier@gmail.com> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef WX_MSW_PRIVATE_FSWATCHER_H_ +#define WX_MSW_PRIVATE_FSWATCHER_H_ + +#include "wx/filename.h" +#include "wx/vector.h" +#include "wx/msw/private.h" + +// ============================================================================ +// wxFSWatcherEntry implementation & helper declarations +// ============================================================================ + +class wxFSWatcherImplMSW; + +class wxFSWatchEntryMSW : public wxFSWatchInfo +{ +public: + enum + { + BUFFER_SIZE = 4096 // TODO parametrize + }; + + wxFSWatchEntryMSW(const wxFSWatchInfo& winfo) : + wxFSWatchInfo(winfo) + { + // get handle for this path + m_handle = OpenDir(m_path); + m_overlapped = (OVERLAPPED*)calloc(1, sizeof(OVERLAPPED)); + wxZeroMemory(m_buffer); + } + + virtual ~wxFSWatchEntryMSW() + { + wxLogTrace(wxTRACE_FSWATCHER, "Deleting entry '%s'", m_path); + + if (m_handle != INVALID_HANDLE_VALUE) + { + if (!CloseHandle(m_handle)) + { + wxLogSysError(_("Unable to close the handle for '%s'"), + m_path); + } + } + free(m_overlapped); + } + + bool IsOk() const + { + return m_handle != INVALID_HANDLE_VALUE; + } + + HANDLE GetHandle() const + { + return m_handle; + } + + void* GetBuffer() + { + return m_buffer; + } + + OVERLAPPED* GetOverlapped() const + { + return m_overlapped; + } + +private: + // opens dir with all flags, attributes etc. necessary to be later + // asynchronous watched with ReadDirectoryChangesW + static HANDLE OpenDir(const wxString& path) + { + HANDLE handle = CreateFile(path.t_str(), + FILE_LIST_DIRECTORY, + FILE_SHARE_READ | + FILE_SHARE_WRITE | + FILE_SHARE_DELETE, + NULL, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS | + FILE_FLAG_OVERLAPPED, + NULL); + if (handle == INVALID_HANDLE_VALUE) + { + wxLogSysError(_("Failed to open directory \"%s\" for monitoring."), + path); + } + + return handle; + } + + HANDLE m_handle; // handle to opened directory + char m_buffer[BUFFER_SIZE]; // buffer for fs events + OVERLAPPED* m_overlapped; + + wxDECLARE_NO_COPY_CLASS(wxFSWatchEntryMSW); +}; + +// ============================================================================ +// wxFSWatcherImplMSW helper classes implementations +// ============================================================================ + +class wxIOCPService +{ +public: + wxIOCPService() : + m_iocp(INVALID_HANDLE_VALUE) + { + Init(); + } + + ~wxIOCPService() + { + if (m_iocp != INVALID_HANDLE_VALUE) + { + if (!CloseHandle(m_iocp)) + { + wxLogSysError(_("Unable to close I/O completion port handle")); + } + } + m_watches.clear(); + } + + // associates a wxFSWatchEntryMSW with completion port + bool Add(wxSharedPtr<wxFSWatchEntryMSW> watch) + { + wxCHECK_MSG( m_iocp != INVALID_HANDLE_VALUE, false, "IOCP not init" ); + wxCHECK_MSG( watch->IsOk(), false, "Invalid watch" ); + + // associate with IOCP + HANDLE ret = CreateIoCompletionPort(watch->GetHandle(), m_iocp, + (ULONG_PTR)watch.get(), 0); + if (ret == NULL) + { + wxLogSysError(_("Unable to associate handle with " + "I/O completion port")); + return false; + } + else if (ret != m_iocp) + { + wxFAIL_MSG(_("Unexpectedly new I/O completion port was created")); + return false; + } + + // add to watch map + wxFSWatchEntries::value_type val(watch->GetPath(), watch); + return m_watches.insert(val).second; + } + + // Removes a watch we're currently using. Notice that this doesn't happen + // immediately, CompleteRemoval() must be called later when it's really + // safe to delete the watch, i.e. after completion of the IO operation + // using it. + bool ScheduleForRemoval(const wxSharedPtr<wxFSWatchEntryMSW>& watch) + { + wxCHECK_MSG( m_iocp != INVALID_HANDLE_VALUE, false, "IOCP not init" ); + wxCHECK_MSG( watch->IsOk(), false, "Invalid watch" ); + + const wxString path = watch->GetPath(); + wxFSWatchEntries::iterator it = m_watches.find(path); + wxCHECK_MSG( it != m_watches.end(), false, + "Can't remove a watch we don't use" ); + + // We can't just delete the watch here as we can have pending events + // for it and if we destroyed it now, we could get a dangling (or, + // worse, reused to point to another object) pointer in ReadEvents() so + // just remember that this one should be removed when CompleteRemoval() + // is called later. + m_removedWatches.push_back(watch); + m_watches.erase(it); + + return true; + } + + // Really remove the watch previously passed to ScheduleForRemoval(). + // + // It's ok to call this for a watch that hadn't been removed before, in + // this case we'll just return false and do nothing. + bool CompleteRemoval(wxFSWatchEntryMSW* watch) + { + for ( Watches::iterator it = m_removedWatches.begin(); + it != m_removedWatches.end(); + ++it ) + { + if ( (*it).get() == watch ) + { + // Removing the object from here will result in deleting the + // watch itself as it's not referenced from anywhere else now. + m_removedWatches.erase(it); + return true; + } + } + + return false; + } + + // post completion packet + bool PostEmptyStatus() + { + wxCHECK_MSG( m_iocp != INVALID_HANDLE_VALUE, false, "IOCP not init" ); + + // The special values of 0 will make GetStatus() return Status_Exit. + const int ret = PostQueuedCompletionStatus(m_iocp, 0, 0, NULL); + if (!ret) + { + wxLogSysError(_("Unable to post completion status")); + } + + return ret != 0; + } + + // Possible return values of GetStatus() + enum Status + { + // Status successfully retrieved into the provided arguments. + Status_OK, + + // Special status indicating that we should exit retrieved. + Status_Exit, + + // An error occurred because the watched directory was deleted. + Status_Deleted, + + // Some other error occurred. + Status_Error + }; + + // Wait for completion status to arrive. + // This function can block forever in it's wait for completion status. + // Use PostEmptyStatus() to wake it up (and end the worker thread) + Status + GetStatus(DWORD* count, wxFSWatchEntryMSW** watch, + OVERLAPPED** overlapped) + { + wxCHECK_MSG( m_iocp != INVALID_HANDLE_VALUE, Status_Error, + "Invalid IOCP object" ); + wxCHECK_MSG( count && watch && overlapped, Status_Error, + "Output parameters can't be NULL" ); + + const int ret = GetQueuedCompletionStatus(m_iocp, count, (ULONG_PTR *)watch, + overlapped, INFINITE); + if ( ret != 0 ) + { + return *count || *watch || *overlapped ? Status_OK : Status_Exit; + } + + // An error is returned if the underlying directory has been deleted, + // but this is not really an unexpected failure, so handle it + // specially. + if ( wxSysErrorCode() == ERROR_ACCESS_DENIED && + *watch && !wxFileName::DirExists((*watch)->GetPath()) ) + return Status_Deleted; + + // Some other error, at least log it. + wxLogSysError(_("Unable to dequeue completion packet")); + + return Status_Error; + } + +protected: + bool Init() + { + m_iocp = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 0); + if (m_iocp == NULL) + { + wxLogSysError(_("Unable to create I/O completion port")); + } + return m_iocp != NULL; + } + + HANDLE m_iocp; + + // The hash containing all the wxFSWatchEntryMSW objects currently being + // watched keyed by their paths. + wxFSWatchEntries m_watches; + + // Contains the watches which had been removed but are still pending. + typedef wxVector< wxSharedPtr<wxFSWatchEntryMSW> > Watches; + Watches m_removedWatches; +}; + + +class wxIOCPThread : public wxThread +{ +public: + wxIOCPThread(wxFSWatcherImplMSW* service, wxIOCPService* iocp); + + // finishes this thread + bool Finish(); + +protected: + // structure to hold information needed to process one native event + // this is just a dummy holder, so it doesn't take ownership of its data + struct wxEventProcessingData + { + wxEventProcessingData(const FILE_NOTIFY_INFORMATION* ne, + const wxFSWatchEntryMSW* watch_) : + nativeEvent(ne), watch(watch_) + {} + + const FILE_NOTIFY_INFORMATION* nativeEvent; + const wxFSWatchEntryMSW* watch; + }; + + virtual ExitCode Entry() wxOVERRIDE; + + // wait for events to occur, read them and send to interested parties + // returns false it empty status was read, which means we would exit + // true otherwise + bool ReadEvents(); + + void ProcessNativeEvents(wxVector<wxEventProcessingData>& events); + + void SendEvent(wxFileSystemWatcherEvent& evt); + + static int Native2WatcherFlags(int flags); + + static wxString FileNotifyInformationToString( + const FILE_NOTIFY_INFORMATION& e); + + static wxFileName GetEventPath(const wxFSWatchEntryMSW& watch, + const FILE_NOTIFY_INFORMATION& e); + + wxFSWatcherImplMSW* m_service; + wxIOCPService* m_iocp; +}; + +#endif /* WX_MSW_PRIVATE_FSWATCHER_H_ */ diff --git a/lib/wxWidgets/include/wx/msw/private/graphicsd2d.h b/lib/wxWidgets/include/wx/msw/private/graphicsd2d.h new file mode 100644 index 0000000..1eb4f5f --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/graphicsd2d.h @@ -0,0 +1,31 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/graphicsd2d.h +// Purpose: Allow functions from graphicsd2d.cpp to be used in other files +// Author: New Pagodi +// Created: 2017-10-31 +// Copyright: (c) 2017 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef WX_MSW_PRIVATE_GRAPHICSD2D_H_ +#define WX_MSW_PRIVATE_GRAPHICSD2D_H_ + +#if wxUSE_GRAPHICS_DIRECT2D + +// Ensure no previous defines interfere with the Direct2D API headers +#undef GetHwnd + +// include before wincodec.h to prevent winsock/winsock2 redefinition warnings +#include "wx/msw/wrapwin.h" + +#include <d2d1.h> +#include <dwrite.h> +#include <wincodec.h> + +WXDLLIMPEXP_CORE IWICImagingFactory* wxWICImagingFactory(); +WXDLLIMPEXP_CORE ID2D1Factory* wxD2D1Factory(); +WXDLLIMPEXP_CORE IDWriteFactory* wxDWriteFactory(); + +#endif // wxUSE_GRAPHICS_DIRECT2D + +#endif // WX_MSW_PRIVATE_GRAPHICSD2D_H_ diff --git a/lib/wxWidgets/include/wx/msw/private/hiddenwin.h b/lib/wxWidgets/include/wx/msw/private/hiddenwin.h new file mode 100644 index 0000000..3b52b60 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/hiddenwin.h @@ -0,0 +1,30 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/hiddenwin.h +// Purpose: Helper for creating a hidden window used by wxMSW internally. +// Author: Vadim Zeitlin +// Created: 2011-09-16 +// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_PRIVATE_HIDDENWIN_H_ +#define _WX_MSW_PRIVATE_HIDDENWIN_H_ + +#include "wx/msw/private.h" + +/* + Creates a hidden window with supplied window proc registering the class for + it if necessary (i.e. the first time only). Caller is responsible for + destroying the window and unregistering the class (note that this must be + done because wxWidgets may be used as a DLL and so may be loaded/unloaded + multiple times into/from the same process so we can't rely on automatic + Windows class unregistration). + + pclassname is a pointer to a caller stored classname, which must initially be + NULL. classname is the desired wndclass classname. If function successfully + registers the class, pclassname will be set to classname. + */ +extern "C" WXDLLIMPEXP_BASE HWND +wxCreateHiddenWindow(LPCTSTR *pclassname, LPCTSTR classname, WNDPROC wndproc); + +#endif // _WX_MSW_PRIVATE_HIDDENWIN_H_ diff --git a/lib/wxWidgets/include/wx/msw/private/keyboard.h b/lib/wxWidgets/include/wx/msw/private/keyboard.h new file mode 100644 index 0000000..002303e --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/keyboard.h @@ -0,0 +1,41 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/keyboard.h +// Purpose: Helper keyboard-related functions. +// Author: Vadim Zeitlin +// Created: 2010-09-09 +// Copyright: (c) 2010 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_PRIVATE_KEYBOARD_H_ +#define _WX_MSW_PRIVATE_KEYBOARD_H_ + +#include "wx/defs.h" + +namespace wxMSWKeyboard +{ + +// ---------------------------------------------------------------------------- +// Functions for translating between MSW virtual keys codes and wx key codes +// +// These functions are currently implemented in src/msw/window.cpp. +// ---------------------------------------------------------------------------- + +// Translate MSW virtual key code to wx key code. lParam is used to distinguish +// between numpad and extended version of the keys, extended is assumed by +// default if lParam == 0. +// +// Returns WXK_NONE if translation couldn't be done at all (this happens e.g. +// for dead keys and in this case uc will be WXK_NONE too) or if the key +// corresponds to a non-Latin-1 character in which case uc is filled with its +// Unicode value. +WXDLLIMPEXP_CORE int VKToWX(WXWORD vk, WXLPARAM lParam = 0, wchar_t *uc = NULL); + +// Translate wxKeyCode enum element (passed as int for compatibility reasons) +// to MSW virtual key code. isExtended is set to true if the key corresponds to +// a non-numpad version of a key that exists both on numpad and outside it. +WXDLLIMPEXP_CORE WXWORD WXToVK(int id, bool *isExtended = NULL); + +} // namespace wxMSWKeyboard + +#endif // _WX_MSW_PRIVATE_KEYBOARD_H_ diff --git a/lib/wxWidgets/include/wx/msw/private/metrics.h b/lib/wxWidgets/include/wx/msw/private/metrics.h new file mode 100644 index 0000000..4516bd1 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/metrics.h @@ -0,0 +1,58 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/metrics.h +// Purpose: various helper functions to retrieve system metrics +// Author: Vadim Zeitlin +// Created: 2008-09-05 +// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_PRIVATE_METRICS_H_ +#define _WX_MSW_PRIVATE_METRICS_H_ + +#include "wx/msw/private.h" + +namespace wxMSWImpl +{ + +// return NONCLIENTMETRICS as retrieved by SystemParametersInfo() +// +// currently this is not cached as the values may change when system settings +// do and we don't react to this to invalidate the cache but it could be done +// in the future +// +// MT-safety: this function is only meant to be called from the main thread +inline const NONCLIENTMETRICS GetNonClientMetrics(const wxWindow* win) +{ + WinStruct<NONCLIENTMETRICS> nm; + if ( !wxSystemParametersInfo(SPI_GETNONCLIENTMETRICS, + sizeof(NONCLIENTMETRICS), + &nm, + 0, + win) ) + { +#if WINVER >= 0x0600 + // a new field has been added to NONCLIENTMETRICS under Vista, so + // the call to SystemParametersInfo() fails if we use the struct + // size incorporating this new value on an older system -- retry + // without it + nm.cbSize -= sizeof(int); + if ( !wxSystemParametersInfo(SPI_GETNONCLIENTMETRICS, + sizeof(NONCLIENTMETRICS), + &nm, + 0, + win) ) +#endif // WINVER >= 0x0600 + { + // maybe we should initialize the struct with some defaults? + wxLogLastError(wxT("SystemParametersInfo(SPI_GETNONCLIENTMETRICS)")); + } + } + + return nm; +} + +} // namespace wxMSWImpl + +#endif // _WX_MSW_PRIVATE_METRICS_H_ + diff --git a/lib/wxWidgets/include/wx/msw/private/msgdlg.h b/lib/wxWidgets/include/wx/msw/private/msgdlg.h new file mode 100644 index 0000000..cfd4c18 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/msgdlg.h @@ -0,0 +1,93 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/msgdlg.h +// Purpose: helper functions used with native message dialog +// Author: Rickard Westerlund +// Created: 2010-07-12 +// Copyright: (c) 2010 wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_PRIVATE_MSGDLG_H_ +#define _WX_MSW_PRIVATE_MSGDLG_H_ + +#include "wx/msw/wrapcctl.h" +#include "wx/scopedarray.h" + +// Macro to help identify if task dialogs are available: we rely on +// TD_WARNING_ICON being defined in the headers for this as this symbol is used +// by the task dialogs only. Also notice that task dialogs are available for +// Unicode applications only. +#if defined(TD_WARNING_ICON) && wxUSE_UNICODE + #define wxHAS_MSW_TASKDIALOG +#endif + +// Provides methods for creating a task dialog. +namespace wxMSWMessageDialog +{ + +#ifdef wxHAS_MSW_TASKDIALOG + class wxMSWTaskDialogConfig + { + public: + enum { MAX_BUTTONS = 4 }; + + wxMSWTaskDialogConfig() + : buttons(new TASKDIALOG_BUTTON[MAX_BUTTONS]), + parent(NULL), + iconId(0), + style(0), + useCustomLabels(false) + { } + + // initializes the object from a message dialog. + wxMSWTaskDialogConfig(const wxMessageDialogBase& dlg); + + wxScopedArray<TASKDIALOG_BUTTON> buttons; + wxWindow *parent; + wxString caption; + wxString message; + wxString extendedMessage; + long iconId; + long style; + bool useCustomLabels; + wxString btnYesLabel; + wxString btnNoLabel; + wxString btnOKLabel; + wxString btnCancelLabel; + wxString btnHelpLabel; + + // Will create a task dialog with its parameters for its creation + // stored in the provided TASKDIALOGCONFIG parameter. + // NOTE: The wxMSWTaskDialogConfig object needs to remain accessible + // during the subsequent call to TaskDialogIndirect(). + void MSWCommonTaskDialogInit(TASKDIALOGCONFIG &tdc); + + // Used by MSWCommonTaskDialogInit() to add a regular button or a + // button with a custom label if used. + void AddTaskDialogButton(TASKDIALOGCONFIG &tdc, + int btnCustomId, + int btnCommonId, + const wxString& customLabel); + }; // class wxMSWTaskDialogConfig + + + typedef HRESULT (WINAPI *TaskDialogIndirect_t)(const TASKDIALOGCONFIG *, + int *, int *, BOOL *); + + // Return the pointer to TaskDialogIndirect(). This should only be called + // if HasNativeTaskDialog() returned true and is normally guaranteed to + // succeed in this case. + TaskDialogIndirect_t GetTaskDialogIndirectFunc(); +#endif // wxHAS_MSW_TASKDIALOG + + + // Check if the task dialog is available: this simply checks the OS version + // as we know that it's only present in Vista and later. + bool HasNativeTaskDialog(); + + // Translates standard MSW button IDs like IDCANCEL into an equivalent + // wx constant such as wxCANCEL. + int MSWTranslateReturnCode(int msAns); +}; // namespace wxMSWMessageDialog + +#endif // _WX_MSW_PRIVATE_MSGDLG_H_ diff --git a/lib/wxWidgets/include/wx/msw/private/paint.h b/lib/wxWidgets/include/wx/msw/private/paint.h new file mode 100644 index 0000000..abd0c44 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/paint.h @@ -0,0 +1,39 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/paint.h +// Purpose: Helpers for handling repainting +// Author: Vadim Zeitlin +// Created: 2020-02-10 +// Copyright: (c) 2020 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_PRIVATE_PAINT_H_ +#define _WX_MSW_PRIVATE_PAINT_H_ + +#include "wx/stack.h" + +namespace wxMSWImpl +{ + +// Data used by WM_PAINT handler +struct PaintData +{ + explicit PaintData(wxWindowMSW* window_) + : window(window_), + createdPaintDC(false) + { + } + + // The window being repainted (never null). + wxWindowMSW* const window; + + // True if the user-defined paint handler created wxPaintDC. + bool createdPaintDC; +}; + +// Stack storing data for the possibly nested WM_PAINT handlers. +extern wxStack<PaintData> paintStack; + +} // namespace wxMSWImpl + +#endif // _WX_MSW_PRIVATE_PAINT_H_ diff --git a/lib/wxWidgets/include/wx/msw/private/pipestream.h b/lib/wxWidgets/include/wx/msw/private/pipestream.h new file mode 100644 index 0000000..b163ae4 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/pipestream.h @@ -0,0 +1,50 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/pipestream.h +// Purpose: MSW wxPipeInputStream and wxPipeOutputStream declarations +// Author: Vadim Zeitlin +// Created: 2013-06-08 (extracted from src/msw/utilsexc.cpp) +// Copyright: (c) 2013 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_PRIVATE_PIPESTREAM_H_ +#define _WX_MSW_PRIVATE_PIPESTREAM_H_ + +class wxPipeInputStream : public wxInputStream +{ +public: + explicit wxPipeInputStream(HANDLE hInput); + virtual ~wxPipeInputStream(); + + // returns true if the pipe is still opened + bool IsOpened() const { return m_hInput != INVALID_HANDLE_VALUE; } + + // returns true if there is any data to be read from the pipe + virtual bool CanRead() const wxOVERRIDE; + +protected: + virtual size_t OnSysRead(void *buffer, size_t len) wxOVERRIDE; + +protected: + HANDLE m_hInput; + + wxDECLARE_NO_COPY_CLASS(wxPipeInputStream); +}; + +class wxPipeOutputStream: public wxOutputStream +{ +public: + explicit wxPipeOutputStream(HANDLE hOutput); + virtual ~wxPipeOutputStream() { Close(); } + bool Close() wxOVERRIDE; + +protected: + size_t OnSysWrite(const void *buffer, size_t len) wxOVERRIDE; + +protected: + HANDLE m_hOutput; + + wxDECLARE_NO_COPY_CLASS(wxPipeOutputStream); +}; + +#endif // _WX_MSW_PRIVATE_PIPESTREAM_H_ diff --git a/lib/wxWidgets/include/wx/msw/private/sockmsw.h b/lib/wxWidgets/include/wx/msw/private/sockmsw.h new file mode 100644 index 0000000..d6010fb --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/sockmsw.h @@ -0,0 +1,96 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/gsockmsw.h +// Purpose: MSW-specific socket implementation +// Authors: Guilhem Lavaux, Guillermo Rodriguez Garcia, Vadim Zeitlin +// Created: April 1997 +// Copyright: (C) 1999-1997, Guilhem Lavaux +// (C) 1999-2000, Guillermo Rodriguez Garcia +// (C) 2008 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef _WX_MSW_GSOCKMSW_H_ +#define _WX_MSW_GSOCKMSW_H_ + +#include "wx/msw/wrapwin.h" + +#if defined(__CYGWIN__) + //CYGWIN gives annoying warning about runtime stuff if we don't do this +# define USE_SYS_TYPES_FD_SET +# include <sys/types.h> +#endif + +#if defined(__CYGWIN__) + #include <winsock.h> + #ifdef __LP64__ + // We can't use long in this case because it is 64 bits with Cygwin, so + // use their special type used for working around this instead. + #define wxIoctlSocketArg_t __ms_u_long + #endif +#endif + +#ifndef wxIoctlSocketArg_t + #define wxIoctlSocketArg_t u_long +#endif + +#define wxCloseSocket closesocket + +// ---------------------------------------------------------------------------- +// MSW-specific socket implementation +// ---------------------------------------------------------------------------- + +class wxSocketImplMSW : public wxSocketImpl +{ +public: + wxSocketImplMSW(wxSocketBase& wxsocket); + + virtual ~wxSocketImplMSW(); + + virtual wxSocketError GetLastError() const wxOVERRIDE; + + virtual void ReenableEvents(wxSocketEventFlags WXUNUSED(flags)) wxOVERRIDE + { + // notifications are never disabled in this implementation, there is no + // need for this as WSAAsyncSelect() only sends notification once when + // the new data becomes available anyhow, so there is no need to do + // anything here + } + + virtual void UpdateBlockingState() wxOVERRIDE + { + if ( GetSocketFlags() & wxSOCKET_BLOCK ) + { + // Counter-intuitively, we make the socket non-blocking even in + // this case as it is necessary e.g. for Read() to return + // immediately if there is no data available. However we must not + // install a callback for it as blocking sockets don't use any + // events and generating them would actually be harmful (and not + // just useless) as they would be dispatched by the main thread + // while this blocking socket can be used from a worker one, so it + // would result in data races and other unpleasantness. + wxIoctlSocketArg_t trueArg = 1; + ioctlsocket(m_fd, FIONBIO, &trueArg); + + // Uninstall it in case it was installed before. + wxSocketManager::Get()->Uninstall_Callback(this); + } + else + { + // No need to make the socket non-blocking, Install_Callback() will + // do it as a side effect of calling WSAAsyncSelect(). + wxSocketManager::Get()->Install_Callback(this); + } + } + +private: + virtual void DoClose() wxOVERRIDE; + + int m_msgnumber; + + friend class wxSocketMSWManager; + + wxDECLARE_NO_COPY_CLASS(wxSocketImplMSW); +}; + +#endif /* _WX_MSW_GSOCKMSW_H_ */ diff --git a/lib/wxWidgets/include/wx/msw/private/textmeasure.h b/lib/wxWidgets/include/wx/msw/private/textmeasure.h new file mode 100644 index 0000000..5ac95e2 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/textmeasure.h @@ -0,0 +1,63 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/textmeasure.h +// Purpose: wxMSW-specific declaration of wxTextMeasure class +// Author: Manuel Martin +// Created: 2012-10-05 +// Copyright: (c) 1997-2012 wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_PRIVATE_TEXTMEASURE_H_ +#define _WX_MSW_PRIVATE_TEXTMEASURE_H_ + +#include "wx/msw/wrapwin.h" + +// ---------------------------------------------------------------------------- +// wxTextMeasure for MSW. +// ---------------------------------------------------------------------------- + +class wxTextMeasure : public wxTextMeasureBase +{ +public: + explicit wxTextMeasure(const wxDC *dc, const wxFont *font = NULL) + : wxTextMeasureBase(dc, font) + { + Init(); + } + + explicit wxTextMeasure(const wxWindow *win, const wxFont *font = NULL) + : wxTextMeasureBase(win, font) + { + Init(); + } + +protected: + void Init(); + + virtual void BeginMeasuring() wxOVERRIDE; + virtual void EndMeasuring() wxOVERRIDE; + + virtual void DoGetTextExtent(const wxString& string, + wxCoord *width, + wxCoord *height, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL) wxOVERRIDE; + + virtual bool DoGetPartialTextExtents(const wxString& text, + wxArrayInt& widths, + double scaleX) wxOVERRIDE; + + + + // We use either the HDC of the provided wxDC or an HDC created for our + // window. + HDC m_hdc; + + // If we change the font in BeginMeasuring(), we restore it to the old one + // in EndMeasuring(). + HFONT m_hfontOld; + + wxDECLARE_NO_COPY_CLASS(wxTextMeasure); +}; + +#endif // _WX_MSW_PRIVATE_TEXTMEASURE_H_ diff --git a/lib/wxWidgets/include/wx/msw/private/timer.h b/lib/wxWidgets/include/wx/msw/private/timer.h new file mode 100644 index 0000000..db1da30 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/timer.h @@ -0,0 +1,36 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/timer.h +// Purpose: wxTimer class +// Author: Julian Smart +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_PRIVATE_TIMER_H_ +#define _WX_MSW_PRIVATE_TIMER_H_ + +#if wxUSE_TIMER + +#include "wx/private/timer.h" +#include "wx/msw/wrapwin.h" // for WPARAM + +class WXDLLIMPEXP_BASE wxMSWTimerImpl : public wxTimerImpl +{ +public: + wxMSWTimerImpl(wxTimer *timer) : wxTimerImpl(timer) { m_id = 0; } + + virtual bool Start(int milliseconds = -1, bool oneShot = false) wxOVERRIDE; + virtual void Stop() wxOVERRIDE; + + virtual bool IsRunning() const wxOVERRIDE { return m_id != 0; } + +protected: + // this must be 64 bit under Win64 as WPARAM (storing timer ids) is 64 bit + // there and so the ids may possibly not fit in 32 bits + WPARAM m_id; +}; + +#endif // wxUSE_TIMER + +#endif // _WX_TIMERH_ diff --git a/lib/wxWidgets/include/wx/msw/private/tlwgeom.h b/lib/wxWidgets/include/wx/msw/private/tlwgeom.h new file mode 100644 index 0000000..5b9933d --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/tlwgeom.h @@ -0,0 +1,195 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/tlwgeom.h +// Purpose: wxMSW-specific wxTLWGeometry class. +// Author: Vadim Zeitlin +// Created: 2018-04-29 +// Copyright: (c) 2018 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_PRIVATE_TLWGEOM_H_ +#define _WX_MSW_PRIVATE_TLWGEOM_H_ + +#include "wx/log.h" + +#include "wx/msw/private.h" + +// names for MSW-specific options +#define wxPERSIST_TLW_MAX_X "xmax" +#define wxPERSIST_TLW_MAX_Y "ymax" + +class wxTLWGeometry : public wxTLWGeometryBase +{ +public: + wxTLWGeometry() + { + wxZeroMemory(m_placement); + m_placement.length = sizeof(m_placement); + } + + virtual bool Save(const Serializer& ser) const wxOVERRIDE + { + // For compatibility with the existing saved positions/sizes, use the + // same keys as the generic version (which was previously used under + // MSW too). + + // Normal position and size. + const RECT& rc = m_placement.rcNormalPosition; + if ( !ser.SaveField(wxPERSIST_TLW_X, rc.left) || + !ser.SaveField(wxPERSIST_TLW_Y, rc.top) ) + return false; + + if ( !ser.SaveField(wxPERSIST_TLW_W, rc.right - rc.left) || + !ser.SaveField(wxPERSIST_TLW_H, rc.bottom - rc.top) ) + return false; + + // Maximized/minimized state. + UINT show = m_placement.showCmd; + if ( !ser.SaveField(wxPERSIST_TLW_MAXIMIZED, show == SW_SHOWMAXIMIZED) ) + return false; + + if ( !ser.SaveField(wxPERSIST_TLW_ICONIZED, show == SW_SHOWMINIMIZED) ) + return false; + + // Maximized window position. + const POINT pt = m_placement.ptMaxPosition; + if ( !ser.SaveField(wxPERSIST_TLW_MAX_X, pt.x) || + !ser.SaveField(wxPERSIST_TLW_MAX_Y, pt.y) ) + return false; + + // We don't currently save the minimized window position, it doesn't + // seem useful for anything and is probably just a left over from + // Windows 3.1 days, when icons were positioned on the desktop instead + // of being located in the taskbar. + + return true; + } + + virtual bool Restore(Serializer& ser) wxOVERRIDE + { + // Normal position and size. + wxRect r; + if ( !ser.RestoreField(wxPERSIST_TLW_X, &r.x) || + !ser.RestoreField(wxPERSIST_TLW_Y, &r.y) || + !ser.RestoreField(wxPERSIST_TLW_W, &r.width) || + !ser.RestoreField(wxPERSIST_TLW_H, &r.height) ) + return false; + wxCopyRectToRECT(r, m_placement.rcNormalPosition); + + // Maximized/minimized state. + // + // Note the special case of SW_MINIMIZE: while GetWindowPlacement() + // returns SW_SHOWMINIMIZED when the window is iconized, we restore it + // as SW_MINIMIZE as this is what the code in wxTLW checks to determine + // whether the window is supposed to be iconized or not. + // + // Just to confuse matters further, note that SW_MAXIMIZE is exactly + // the same thing as SW_SHOWMAXIMIZED. + int tmp; + UINT& show = m_placement.showCmd; + if ( ser.RestoreField(wxPERSIST_TLW_MAXIMIZED, &tmp) && tmp ) + show = SW_MAXIMIZE; + else if ( ser.RestoreField(wxPERSIST_TLW_ICONIZED, &tmp) && tmp ) + show = SW_MINIMIZE; + else + show = SW_SHOWNORMAL; + + // Maximized window position. + if ( ser.RestoreField(wxPERSIST_TLW_MAX_X, &r.x) && + ser.RestoreField(wxPERSIST_TLW_MAX_Y, &r.y) ) + { + m_placement.ptMaxPosition.x = r.x; + m_placement.ptMaxPosition.y = r.y; + } + + return true; + } + + virtual bool GetFrom(const wxTopLevelWindow* tlw) wxOVERRIDE + { + if ( !::GetWindowPlacement(GetHwndOf(tlw), &m_placement) ) + { + wxLogLastError(wxS("GetWindowPlacement")); + return false; + } + + if (m_placement.showCmd != SW_SHOWMAXIMIZED && m_placement.showCmd != SW_SHOWMINIMIZED) + { + RECT rcWindow; + ::GetWindowRect(tlw->GetHWND(), &rcWindow); + // Height and width should be the same unless the user performed + // an Aero Snap operation. + const RECT rcNormal = m_placement.rcNormalPosition; + if ((rcWindow.bottom - rcWindow.top) != (rcNormal.bottom - rcNormal.top) || + (rcWindow.right - rcWindow.left) != (rcNormal.right - rcNormal.left)) + { + WinStruct<MONITORINFO> mi; + if (!::GetMonitorInfo(::MonitorFromWindow(tlw->GetHWND(), + MONITOR_DEFAULTTONEAREST), &mi)) + { + wxLogLastError("GetMonitorInfo"); + return false; + } + + // If the tray is on the top or the left, then the rectangle needs to + // be adjusted to match what ::SetWindowPlacement expects. + if (mi.rcMonitor.top < mi.rcWork.top || + mi.rcMonitor.left < mi.rcWork.left) + { + // Negative offset to eliminate the tray width/height. + OffsetRect(&rcWindow, (mi.rcMonitor.left - mi.rcWork.left), + (mi.rcMonitor.top - mi.rcWork.top)); + } + + ::CopyRect(&m_placement.rcNormalPosition, &rcWindow); + } + } + + return true; + } + + virtual bool ApplyTo(wxTopLevelWindow* tlw) wxOVERRIDE + { + // There is a subtlety here: if the window is currently hidden, + // restoring its geometry shouldn't show it, so we must use SW_HIDE as + // show command, but showing it later should restore it to the correct + // state, so we need to remember it in wxTLW itself. And even if it's + // currently shown, we still need to update its show command, so that + // it matches the real window state after SetWindowPlacement() call. + tlw->MSWSetShowCommand(m_placement.showCmd); + if ( !tlw->IsShown() ) + { + m_placement.showCmd = SW_HIDE; + } + + const wxSize oldDPI = tlw->GetDPI(); + if ( !::SetWindowPlacement(GetHwndOf(tlw), &m_placement) ) + { + wxLogLastError(wxS("SetWindowPlacement")); + return false; + } + + // Check if a window DPI hasn't changed, as the result of being placed + // on a monitor with a different DPI from the main one because in this + // case its size is not restored properly. + const wxSize newDPI = tlw->GetDPI(); + if ( oldDPI != newDPI ) + { + // So try setting the placement again as now it will use the + // correct scaling factor, because the window is already on the + // correct monitor. + if ( !::SetWindowPlacement(GetHwndOf(tlw), &m_placement) ) + { + wxLogLastError(wxS("SetWindowPlacement (2nd time)")); + return false; + } + } + + return true; + } + +private: + WINDOWPLACEMENT m_placement; +}; + +#endif // _WX_MSW_PRIVATE_TLWGEOM_H_ diff --git a/lib/wxWidgets/include/wx/msw/private/uilocale.h b/lib/wxWidgets/include/wx/msw/private/uilocale.h new file mode 100644 index 0000000..f2e9d1f --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/uilocale.h @@ -0,0 +1,31 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/uilocale.h +// Purpose: MSW-specific locale-related helpers +// Author: Vadim Zeitlin +// Created: 2021-08-14 +// Copyright: (c) 2021 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_PRIVATE_UILOCALE_H_ +#define _WX_MSW_PRIVATE_UILOCALE_H_ + +#include "wx/msw/private.h" // Include <windows.h> to get LCID. + +#ifndef LOCALE_SNAME +#define LOCALE_SNAME 0x5c +#endif +#ifndef LOCALE_CUSTOM_UI_DEFAULT +#define LOCALE_CUSTOM_UI_DEFAULT 0x1400 +#endif + +// Use the specific LCID for the current thread. +void wxUseLCID(LCID lcid); + +// These functions are defined in src/common/intl.cpp +wxString wxGetInfoFromLCID(LCID lcid, wxLocaleInfo index, wxLocaleCategory cat); +LCTYPE wxGetLCTYPEFormatFromLocalInfo(wxLocaleInfo index); + +WXDLLIMPEXP_BASE wxString wxTranslateFromUnicodeFormat(const wxString& fmt); + +#endif // _WX_MSW_PRIVATE_UILOCALE_H_ diff --git a/lib/wxWidgets/include/wx/msw/private/webrequest_winhttp.h b/lib/wxWidgets/include/wx/msw/private/webrequest_winhttp.h new file mode 100644 index 0000000..1e961fb --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/webrequest_winhttp.h @@ -0,0 +1,178 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/webrequest_winhttp.h +// Purpose: wxWebRequest WinHTTP implementation +// Author: Tobias Taschner +// Created: 2018-10-17 +// Copyright: (c) 2018 wxWidgets development team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_WEBREQUEST_WINHTTP_H +#define _WX_MSW_WEBREQUEST_WINHTTP_H + +#include "wx/private/webrequest.h" + +#include "wx/msw/wrapwin.h" +#include <winhttp.h> +#include "wx/buffer.h" + +class wxWebSessionWinHTTP; +class wxWebRequestWinHTTP; + +class wxWebResponseWinHTTP : public wxWebResponseImpl +{ +public: + wxWebResponseWinHTTP(wxWebRequestWinHTTP& request); + + wxFileOffset GetContentLength() const wxOVERRIDE { return m_contentLength; } + + wxString GetURL() const wxOVERRIDE; + + wxString GetHeader(const wxString& name) const wxOVERRIDE; + + int GetStatus() const wxOVERRIDE; + + wxString GetStatusText() const wxOVERRIDE; + + bool ReadData(); + + bool ReportAvailableData(DWORD dataLen); + +private: + HINTERNET m_requestHandle; + wxFileOffset m_contentLength; + + wxDECLARE_NO_COPY_CLASS(wxWebResponseWinHTTP); +}; + +class wxWebAuthChallengeWinHTTP : public wxWebAuthChallengeImpl +{ +public: + wxWebAuthChallengeWinHTTP(wxWebAuthChallenge::Source source, + wxWebRequestWinHTTP& request); + + bool Init(); + + void SetCredentials(const wxWebCredentials& cred) wxOVERRIDE; + +private: + wxWebRequestWinHTTP& m_request; + DWORD m_target; + DWORD m_selectedScheme; + + wxDECLARE_NO_COPY_CLASS(wxWebAuthChallengeWinHTTP); +}; + +class wxWebRequestWinHTTP : public wxWebRequestImpl +{ +public: + wxWebRequestWinHTTP(wxWebSession& session, + wxWebSessionWinHTTP& sessionImpl, + wxEvtHandler* handler, + const wxString& url, + int id); + + ~wxWebRequestWinHTTP(); + + void Start() wxOVERRIDE; + + wxWebResponseImplPtr GetResponse() const wxOVERRIDE + { return m_response; } + + wxWebAuthChallengeImplPtr GetAuthChallenge() const wxOVERRIDE + { return m_authChallenge; } + + wxFileOffset GetBytesSent() const wxOVERRIDE { return m_dataWritten; } + + wxFileOffset GetBytesExpectedToSend() const wxOVERRIDE { return m_dataSize; } + + void HandleCallback(DWORD dwInternetStatus, LPVOID lpvStatusInformation, + DWORD dwStatusInformationLength); + + HINTERNET GetHandle() const { return m_request; } + + wxWebRequestHandle GetNativeHandle() const wxOVERRIDE + { + return (wxWebRequestHandle)GetHandle(); + } + +private: + void DoCancel() wxOVERRIDE; + + wxWebSessionWinHTTP& m_sessionImpl; + wxString m_url; + HINTERNET m_connect; + HINTERNET m_request; + wxObjectDataPtr<wxWebResponseWinHTTP> m_response; + wxObjectDataPtr<wxWebAuthChallengeWinHTTP> m_authChallenge; + wxMemoryBuffer m_dataWriteBuffer; + wxFileOffset m_dataWritten; + + void SendRequest(); + + void WriteData(); + + void CreateResponse(); + + // Set the state to State_Failed with the error string including the + // provided description of the operation and the error message for this + // error code. + void SetFailed(const wxString& operation, DWORD errorCode); + + void SetFailedWithLastError(const wxString& operation) + { + SetFailed(operation, ::GetLastError()); + } + + friend class wxWebAuthChallengeWinHTTP; + + wxDECLARE_NO_COPY_CLASS(wxWebRequestWinHTTP); +}; + +class wxWebSessionWinHTTP : public wxWebSessionImpl +{ +public: + wxWebSessionWinHTTP(); + + ~wxWebSessionWinHTTP(); + + static bool Initialize(); + + wxWebRequestImplPtr + CreateRequest(wxWebSession& session, + wxEvtHandler* handler, + const wxString& url, + int id) wxOVERRIDE; + + wxVersionInfo GetLibraryVersionInfo() wxOVERRIDE; + + HINTERNET GetHandle() const { return m_handle; } + + wxWebSessionHandle GetNativeHandle() const wxOVERRIDE + { + return (wxWebSessionHandle)GetHandle(); + } + +private: + HINTERNET m_handle; + + bool Open(); + + wxDECLARE_NO_COPY_CLASS(wxWebSessionWinHTTP); +}; + +class wxWebSessionFactoryWinHTTP : public wxWebSessionFactory +{ +public: + wxWebSessionImpl* Create() wxOVERRIDE + { + return new wxWebSessionWinHTTP(); + } + + bool Initialize() wxOVERRIDE + { + return wxWebSessionWinHTTP::Initialize(); + } +}; + +#endif // _WX_MSW_WEBREQUEST_WINHTTP_H diff --git a/lib/wxWidgets/include/wx/msw/private/webview_edge.h b/lib/wxWidgets/include/wx/msw/private/webview_edge.h new file mode 100644 index 0000000..892e4f9 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/webview_edge.h @@ -0,0 +1,116 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/msw/private/webview_edge.h +// Purpose: wxMSW Edge Chromium wxWebView backend private classes +// Author: Tobias Taschner +// Created: 2020-01-15 +// Copyright: (c) 2020 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef wxWebViewEdge_PRIVATE_H +#define wxWebViewEdge_PRIVATE_H + +#if !wxUSE_WEBVIEW_EDGE_STATIC +#include "wx/dynlib.h" +#endif +#include "wx/msw/private/comptr.h" + +#include <WebView2.h> + +#ifndef __ICoreWebView2_2_INTERFACE_DEFINED__ + #error "WebView2 SDK version 1.0.705.50 or newer is required" +#endif + +#ifndef __VISUALC__ +__CRT_UUID_DECL(ICoreWebView2_2, 0x9E8F0CF8, 0xE670, 0x4B5E, 0xB2, 0xBC, 0x73, 0xE0, 0x61, 0xE3, 0x18, 0x4C); +__CRT_UUID_DECL(ICoreWebView2AddScriptToExecuteOnDocumentCreatedCompletedHandler, 0xb99369f3, 0x9b11, 0x47b5, 0xbc,0x6f, 0x8e,0x78,0x95,0xfc,0xea,0x17); +__CRT_UUID_DECL(ICoreWebView2ContainsFullScreenElementChangedEventHandler, 0xe45d98b1, 0xafef, 0x45be, 0x8b,0xaf, 0x6c,0x77,0x28,0x86,0x7f,0x73); +__CRT_UUID_DECL(ICoreWebView2ContentLoadingEventHandler, 0x364471e7, 0xf2be, 0x4910, 0xbd,0xba, 0xd7,0x20,0x77,0xd5,0x1c,0x4b); +__CRT_UUID_DECL(ICoreWebView2CreateCoreWebView2ControllerCompletedHandler, 0x6c4819f3, 0xc9b7, 0x4260, 0x81,0x27, 0xc9,0xf5,0xbd,0xe7,0xf6,0x8c); +__CRT_UUID_DECL(ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler, 0x4e8a3389, 0xc9d8, 0x4bd2, 0xb6,0xb5, 0x12,0x4f,0xee,0x6c,0xc1,0x4d); +__CRT_UUID_DECL(ICoreWebView2DocumentTitleChangedEventHandler, 0xf5f2b923, 0x953e, 0x4042, 0x9f,0x95, 0xf3,0xa1,0x18,0xe1,0xaf,0xd4); +__CRT_UUID_DECL(ICoreWebView2DOMContentLoadedEventHandler, 0x4BAC7E9C, 0x199E, 0x49ED, 0x87, 0xED, 0x24, 0x93, 0x03, 0xAC, 0xF0, 0x19); +__CRT_UUID_DECL(ICoreWebView2Environment, 0xb96d755e, 0x0319, 0x4e92, 0xa2,0x96, 0x23,0x43,0x6f,0x46,0xa1,0xfc); +__CRT_UUID_DECL(ICoreWebView2EnvironmentOptions, 0x2fde08a8, 0x1e9a, 0x4766, 0x8c,0x05, 0x95,0xa9,0xce,0xb9,0xd1,0xc5); +__CRT_UUID_DECL(ICoreWebView2ExecuteScriptCompletedHandler, 0x49511172, 0xcc67, 0x4bca, 0x99,0x23, 0x13,0x71,0x12,0xf4,0xc4,0xcc); +__CRT_UUID_DECL(ICoreWebView2NavigationCompletedEventHandler, 0xd33a35bf, 0x1c49, 0x4f98, 0x93,0xab, 0x00,0x6e,0x05,0x33,0xfe,0x1c); +__CRT_UUID_DECL(ICoreWebView2NavigationStartingEventHandler, 0x9adbe429, 0xf36d, 0x432b, 0x9d,0xdc, 0xf8,0x88,0x1f,0xbd,0x76,0xe3); +__CRT_UUID_DECL(ICoreWebView2NewWindowRequestedEventHandler, 0xd4c185fe, 0xc81c, 0x4989, 0x97,0xaf, 0x2d,0x3f,0xa7,0xab,0x56,0x51); +__CRT_UUID_DECL(ICoreWebView2SourceChangedEventHandler, 0x3c067f9f, 0x5388, 0x4772, 0x8b,0x48, 0x79,0xf7,0xef,0x1a,0xb3,0x7c); +__CRT_UUID_DECL(ICoreWebView2WebMessageReceivedEventHandler, 0x57213f19, 0x00e6, 0x49fa, 0x8e,0x07, 0x89,0x8e,0xa0,0x1e,0xcb,0xd2); +#endif + +class wxWebViewEdgeImpl +{ +public: + explicit wxWebViewEdgeImpl(wxWebViewEdge* webview); + ~wxWebViewEdgeImpl(); + + bool Create(); + + wxWebViewEdge* m_ctrl; + + wxCOMPtr<ICoreWebView2Environment> m_webViewEnvironment; + wxCOMPtr<ICoreWebView2_2> m_webView; + wxCOMPtr<ICoreWebView2Controller> m_webViewController; + + bool m_initialized; + bool m_isBusy; + bool m_inEventCallback; + wxString m_pendingURL; + wxString m_pendingPage; + int m_pendingContextMenuEnabled; + int m_pendingAccessToDevToolsEnabled; + wxVector<wxString> m_pendingUserScripts; + wxVector<wxString> m_userScriptIds; + wxString m_scriptMsgHandlerName; + wxString m_customUserAgent; + + // WebView Events tokens + EventRegistrationToken m_navigationStartingToken = { }; + EventRegistrationToken m_sourceChangedToken = { }; + EventRegistrationToken m_navigationCompletedToken = { }; + EventRegistrationToken m_newWindowRequestedToken = { }; + EventRegistrationToken m_documentTitleChangedToken = { }; + EventRegistrationToken m_DOMContentLoadedToken = { }; + EventRegistrationToken m_containsFullScreenElementChangedToken = { }; + EventRegistrationToken m_webMessageReceivedToken = { }; + + // WebView Event handlers + HRESULT OnNavigationStarting(ICoreWebView2* sender, ICoreWebView2NavigationStartingEventArgs* args); + HRESULT OnSourceChanged(ICoreWebView2* sender, ICoreWebView2SourceChangedEventArgs* args); + HRESULT OnNavigationCompleted(ICoreWebView2* sender, ICoreWebView2NavigationCompletedEventArgs* args); + HRESULT OnNewWindowRequested(ICoreWebView2* sender, ICoreWebView2NewWindowRequestedEventArgs* args); + HRESULT OnDocumentTitleChanged(ICoreWebView2* sender, IUnknown* args); + HRESULT OnDOMContentLoaded(ICoreWebView2* sender, ICoreWebView2DOMContentLoadedEventArgs* args); + HRESULT OnContainsFullScreenElementChanged(ICoreWebView2* sender, IUnknown* args); + HRESULT OnWebMessageReceived(ICoreWebView2* sender, ICoreWebView2WebMessageReceivedEventArgs* args); + HRESULT OnAddScriptToExecuteOnDocumentedCreatedCompleted(HRESULT errorCode, LPCWSTR id); + + HRESULT OnEnvironmentCreated(HRESULT result, ICoreWebView2Environment* environment); + HRESULT OnWebViewCreated(HRESULT result, ICoreWebView2Controller* webViewController); + + wxVector<wxSharedPtr<wxWebViewHistoryItem> > m_historyList; + int m_historyPosition; + bool m_historyLoadingFromList; + bool m_historyEnabled; + + void UpdateBounds(); + + ICoreWebView2Settings* GetSettings(); + + void UpdateWebMessageHandler(); + +#if !wxUSE_WEBVIEW_EDGE_STATIC + static wxDynamicLibrary ms_loaderDll; +#endif + static wxString ms_browserExecutableDir; + + static bool Initialize(); + + static void Uninitialize(); + + friend class wxWebViewEdgeModule; +}; + +#endif // wxWebViewEdge_PRIVATE_H diff --git a/lib/wxWidgets/include/wx/msw/private/webview_ie.h b/lib/wxWidgets/include/wx/msw/private/webview_ie.h new file mode 100644 index 0000000..091167f --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/webview_ie.h @@ -0,0 +1,240 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/msw/private/webview_ie.h +// Purpose: wxMSW IE wxWebView backend private classes +// Author: Marianne Gagnon +// Copyright: (c) 2010 Marianne Gagnon, 2011 Steven Lamerton +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef wxWebViewIE_PRIVATE_H +#define wxWebViewIE_PRIVATE_H + +#include "wx/msw/ole/automtn.h" +#include "wx/msw/private/comptr.h" +#include "wx/msw/private/webview_missing.h" + +class ClassFactory; +class wxIEContainer; +class DocHostUIHandler; +class wxFindPointers; + +class wxWebViewIEImpl +{ +public: + explicit wxWebViewIEImpl(wxWebViewIE* webview); + ~wxWebViewIEImpl(); + + bool Create(); + + wxWebViewIE* m_webview; + + wxIEContainer* m_container; + wxAutomationObject m_ie; + IWebBrowser2* m_webBrowser; + wxCOMPtr<DocHostUIHandler> m_uiHandler; + + //We store the current zoom type; + wxWebViewZoomType m_zoomType; + + /** The "Busy" property of IWebBrowser2 does not always return busy when + * we'd want it to; this variable may be set to true in cases where the + * Busy property is false but should be true. + */ + bool m_isBusy; + //We manage our own history, the history list contains the history items + //which are added as documentcomplete events arrive, unless we are loading + //an item from the history. The position is stored as an int, and reflects + //where we are in the history list. + wxVector<wxSharedPtr<wxWebViewHistoryItem> > m_historyList; + wxVector<ClassFactory*> m_factories; + int m_historyPosition; + bool m_historyLoadingFromList; + bool m_historyEnabled; + + //We store find flag, results and position. + wxVector<wxFindPointers> m_findPointers; + int m_findFlags; + wxString m_findText; + int m_findPosition; + + //Generic helper functions + bool CanExecCommand(wxString command) const; + void ExecCommand(wxString command); + wxCOMPtr<IHTMLDocument2> GetDocument() const; + bool IsElementVisible(wxCOMPtr<IHTMLElement> elm); + //Find helper functions. + long Find(const wxString& text, int flags = wxWEBVIEW_FIND_DEFAULT); + void FindInternal(const wxString& text, int flags, int internal_flag); + long FindNext(int direction = 1); + void FindClear(); + //Toggles control features see INTERNETFEATURELIST for values. + bool EnableControlFeature(long flag, bool enable = true); + + wxDECLARE_NO_COPY_CLASS(wxWebViewIEImpl); +}; + +class VirtualProtocol : public wxIInternetProtocol, public wxIInternetProtocolInfo +{ +protected: + wxIInternetProtocolSink* m_protocolSink; + wxString m_html; + VOID * fileP; + + wxFSFile* m_file; + wxSharedPtr<wxWebViewHandler> m_handler; + +public: + VirtualProtocol(wxSharedPtr<wxWebViewHandler> handler); + virtual ~VirtualProtocol() {} + + //IUnknown + DECLARE_IUNKNOWN_METHODS; + + //IInternetProtocolRoot + HRESULT STDMETHODCALLTYPE Abort(HRESULT WXUNUSED(hrReason), + DWORD WXUNUSED(dwOptions)) wxOVERRIDE + { return E_NOTIMPL; } + HRESULT STDMETHODCALLTYPE Continue(wxPROTOCOLDATA *WXUNUSED(pProtocolData)) wxOVERRIDE + { return S_OK; } + HRESULT STDMETHODCALLTYPE Resume() wxOVERRIDE { return S_OK; } + HRESULT STDMETHODCALLTYPE Start(LPCWSTR szUrl, + wxIInternetProtocolSink *pOIProtSink, + wxIInternetBindInfo *pOIBindInfo, + DWORD grfPI, + HANDLE_PTR dwReserved) wxOVERRIDE; + HRESULT STDMETHODCALLTYPE Suspend() wxOVERRIDE { return S_OK; } + HRESULT STDMETHODCALLTYPE Terminate(DWORD WXUNUSED(dwOptions)) wxOVERRIDE { return S_OK; } + + //IInternetProtocol + HRESULT STDMETHODCALLTYPE LockRequest(DWORD WXUNUSED(dwOptions)) wxOVERRIDE + { return S_OK; } + HRESULT STDMETHODCALLTYPE Read(void *pv, ULONG cb, ULONG *pcbRead) wxOVERRIDE; + HRESULT STDMETHODCALLTYPE Seek(LARGE_INTEGER WXUNUSED(dlibMove), + DWORD WXUNUSED(dwOrigin), + ULARGE_INTEGER* WXUNUSED(plibNewPosition)) wxOVERRIDE + { return E_FAIL; } + HRESULT STDMETHODCALLTYPE UnlockRequest() wxOVERRIDE { return S_OK; } + + //IInternetProtocolInfo + HRESULT STDMETHODCALLTYPE CombineUrl( + LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, + DWORD dwCombineFlags, LPWSTR pwzResult, + DWORD cchResult, DWORD *pcchResult, + DWORD dwReserved) wxOVERRIDE; + HRESULT STDMETHODCALLTYPE ParseUrl( + LPCWSTR pwzUrl, wxPARSEACTION ParseAction, + DWORD dwParseFlags, LPWSTR pwzResult, + DWORD cchResult, DWORD *pcchResult, + DWORD dwReserved) wxOVERRIDE; + HRESULT STDMETHODCALLTYPE CompareUrl( + LPCWSTR pwzUrl1, + LPCWSTR pwzUrl2, + DWORD dwCompareFlags) wxOVERRIDE; + HRESULT STDMETHODCALLTYPE QueryInfo( + LPCWSTR pwzUrl, wxQUERYOPTION OueryOption, + DWORD dwQueryFlags, LPVOID pBuffer, + DWORD cbBuffer, DWORD *pcbBuf, + DWORD dwReserved) wxOVERRIDE; +}; + +class ClassFactory : public IClassFactory +{ +public: + ClassFactory(wxSharedPtr<wxWebViewHandler> handler) : m_handler(handler) + { AddRef(); } + virtual ~ClassFactory() {} + + wxString GetName() { return m_handler->GetName(); } + + //IClassFactory + HRESULT STDMETHODCALLTYPE CreateInstance(IUnknown* pUnkOuter, + REFIID riid, void** ppvObject) wxOVERRIDE; + HRESULT STDMETHODCALLTYPE LockServer(BOOL fLock) wxOVERRIDE; + + //IUnknown + DECLARE_IUNKNOWN_METHODS; + +private: + wxSharedPtr<wxWebViewHandler> m_handler; +}; + +class wxIEContainer : public wxActiveXContainer +{ +public: + wxIEContainer(wxWindow *parent, REFIID iid, IUnknown *pUnk, DocHostUIHandler* uiHandler = NULL); + virtual ~wxIEContainer(); + virtual bool QueryClientSiteInterface(REFIID iid, void **_interface, const char *&desc) wxOVERRIDE; +private: + DocHostUIHandler* m_uiHandler; +}; + +class DocHostUIHandler : public wxIDocHostUIHandler +{ +public: + DocHostUIHandler(wxWebView* browser) { m_browser = browser; } + virtual ~DocHostUIHandler() {} + + virtual HRESULT wxSTDCALL ShowContextMenu(DWORD dwID, POINT *ppt, + IUnknown *pcmdtReserved, + IDispatch *pdispReserved) wxOVERRIDE; + + virtual HRESULT wxSTDCALL GetHostInfo(DOCHOSTUIINFO *pInfo) wxOVERRIDE; + + virtual HRESULT wxSTDCALL ShowUI(DWORD dwID, + IOleInPlaceActiveObject *pActiveObject, + IOleCommandTarget *pCommandTarget, + IOleInPlaceFrame *pFrame, + IOleInPlaceUIWindow *pDoc) wxOVERRIDE; + + virtual HRESULT wxSTDCALL HideUI(void) wxOVERRIDE; + + virtual HRESULT wxSTDCALL UpdateUI(void) wxOVERRIDE; + + virtual HRESULT wxSTDCALL EnableModeless(BOOL fEnable) wxOVERRIDE; + + virtual HRESULT wxSTDCALL OnDocWindowActivate(BOOL fActivate) wxOVERRIDE; + + virtual HRESULT wxSTDCALL OnFrameWindowActivate(BOOL fActivate) wxOVERRIDE; + + virtual HRESULT wxSTDCALL ResizeBorder(LPCRECT prcBorder, + IOleInPlaceUIWindow *pUIWindow, + BOOL fRameWindow) wxOVERRIDE; + + virtual HRESULT wxSTDCALL TranslateAccelerator(LPMSG lpMsg, + const GUID *pguidCmdGroup, + DWORD nCmdID) wxOVERRIDE; + + virtual HRESULT wxSTDCALL GetOptionKeyPath(LPOLESTR *pchKey, + DWORD dw) wxOVERRIDE; + + virtual HRESULT wxSTDCALL GetDropTarget(IDropTarget *pDropTarget, + IDropTarget **ppDropTarget) wxOVERRIDE; + + virtual HRESULT wxSTDCALL GetExternal(IDispatch **ppDispatch) wxOVERRIDE; + + virtual HRESULT wxSTDCALL TranslateUrl(DWORD dwTranslate, + OLECHAR *pchURLIn, + OLECHAR **ppchURLOut) wxOVERRIDE; + + virtual HRESULT wxSTDCALL FilterDataObject(IDataObject *pDO, + IDataObject **ppDORet) wxOVERRIDE; + //IUnknown + DECLARE_IUNKNOWN_METHODS; + +private: + wxWebView* m_browser; +}; + +class wxFindPointers +{ +public: + wxFindPointers(wxIMarkupPointer *ptrBegin, wxIMarkupPointer *ptrEnd) + { + begin = ptrBegin; + end = ptrEnd; + } + //The two markup pointers. + wxIMarkupPointer *begin, *end; +}; + +#endif // wxWebViewIE_PRIVATE_H diff --git a/lib/wxWidgets/include/wx/msw/private/webview_missing.h b/lib/wxWidgets/include/wx/msw/private/webview_missing.h new file mode 100644 index 0000000..6d3196c --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/webview_missing.h @@ -0,0 +1,1021 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/msw/private/webview_missing.h +// Purpose: Definitions / classes commonly missing used by wxWebViewIE +// Author: Steven Lamerton +// Copyright: (c) 2012 Steven Lamerton +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +/* + * Classes and definitions used by wxWebViewIE vary in their + * completeness between compilers and versions of compilers. + * We implement our own versions here which should work + * for all compilers. The definitions are taken from the + * mingw-w64 headers which are public domain. +*/ + +/* urlmon.h */ + +struct IHTMLElement; +struct IHTMLDocument2; + +#ifndef REFRESH_NORMAL +#define REFRESH_NORMAL 0 +#endif + +#ifndef REFRESH_COMPLETELY +#define REFRESH_COMPLETELY 3 +#endif + +#ifndef INET_E_DEFAULT_ACTION +#define INET_E_DEFAULT_ACTION ((HRESULT)0x800C0011L) +#endif + +typedef enum __wxMIDL_IBindStatusCallback_0006 +{ + wxBSCF_FIRSTDATANOTIFICATION = 0x1, + wxBSCF_INTERMEDIATEDATANOTIFICATION = 0x2, + wxBSCF_LASTDATANOTIFICATION = 0x4, + wxBSCF_DATAFULLYAVAILABLE = 0x8, + wxBSCF_AVAILABLEDATASIZEUNKNOWN = 0x10 +} wxBSCF; + +EXTERN_C const IID CLSID_FileProtocol; + +typedef struct _tagwxBINDINFO +{ + ULONG cbSize; + LPWSTR szExtraInfo; + STGMEDIUM stgmedData; + DWORD grfBindInfoF; + DWORD dwBindVerb; + LPWSTR szCustomVerb; + DWORD cbstgmedData; + DWORD dwOptions; + DWORD dwOptionsFlags; + DWORD dwCodePage; + SECURITY_ATTRIBUTES securityAttributes; + IID iid; + IUnknown *pUnk; + DWORD dwReserved; +} wxBINDINFO; + +typedef struct _tagwxPROTOCOLDATA +{ + DWORD grfFlags; + DWORD dwState; + LPVOID pData; + ULONG cbData; +} wxPROTOCOLDATA; + +class wxIInternetBindInfo : public IUnknown +{ +public: + virtual HRESULT wxSTDCALL GetBindInfo(DWORD *grfBINDF, wxBINDINFO *pbindinfo) = 0; + virtual HRESULT wxSTDCALL GetBindString(ULONG ulStringType, LPOLESTR *ppwzStr, + ULONG cEl, ULONG *pcElFetched) = 0; +}; + +class wxIInternetProtocolSink : public IUnknown +{ +public: + virtual HRESULT wxSTDCALL Switch(wxPROTOCOLDATA *pProtocolData) = 0; + virtual HRESULT wxSTDCALL ReportProgress(ULONG ulStatusCode, + LPCWSTR szStatusText) = 0; + virtual HRESULT wxSTDCALL ReportData(DWORD grfBSCF, ULONG ulProgress, + ULONG ulProgressMax) = 0; + virtual HRESULT wxSTDCALL ReportResult(HRESULT hrResult, DWORD dwError, + LPCWSTR szResult) = 0; +}; + +class wxIInternetProtocolRoot : public IUnknown +{ +public: + virtual HRESULT wxSTDCALL Start(LPCWSTR szUrl, wxIInternetProtocolSink *pOIProtSink, + wxIInternetBindInfo *pOIBindInfo, DWORD grfPI, + HANDLE_PTR dwReserved) = 0; + virtual HRESULT wxSTDCALL Continue(wxPROTOCOLDATA *pProtocolData) = 0; + virtual HRESULT wxSTDCALL Abort(HRESULT hrReason, DWORD dwOptions) = 0; + virtual HRESULT wxSTDCALL Terminate(DWORD dwOptions) = 0; + virtual HRESULT wxSTDCALL Suspend(void) = 0; + virtual HRESULT wxSTDCALL Resume(void) = 0; +}; + + +class wxIInternetProtocol : public wxIInternetProtocolRoot +{ +public: + virtual HRESULT wxSTDCALL Read(void *pv, ULONG cb, ULONG *pcbRead) = 0; + virtual HRESULT wxSTDCALL Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, + ULARGE_INTEGER *plibNewPosition) = 0; + virtual HRESULT wxSTDCALL LockRequest(DWORD dwOptions) = 0; + virtual HRESULT wxSTDCALL UnlockRequest(void) = 0; +}; + + +class wxIInternetSession : public IUnknown +{ +public: + virtual HRESULT wxSTDCALL RegisterNameSpace(IClassFactory *pCF, REFCLSID rclsid, + LPCWSTR pwzProtocol, + ULONG cPatterns, + const LPCWSTR *ppwzPatterns, + DWORD dwReserved) = 0; + virtual HRESULT wxSTDCALL UnregisterNameSpace(IClassFactory *pCF, + LPCWSTR pszProtocol) = 0; + virtual HRESULT wxSTDCALL RegisterMimeFilter(IClassFactory *pCF, + REFCLSID rclsid, + LPCWSTR pwzType) = 0; + virtual HRESULT wxSTDCALL UnregisterMimeFilter(IClassFactory *pCF, + LPCWSTR pwzType) = 0; + virtual HRESULT wxSTDCALL CreateBinding(LPBC pBC, LPCWSTR szUrl, + IUnknown *pUnkOuter, IUnknown **ppUnk, + wxIInternetProtocol **ppOInetProt, + DWORD dwOption) = 0; + virtual HRESULT wxSTDCALL SetSessionOption(DWORD dwOption, LPVOID pBuffer, + DWORD dwBufferLength, + DWORD dwReserved) = 0; + virtual HRESULT wxSTDCALL GetSessionOption(DWORD dwOption, LPVOID pBuffer, + DWORD *pdwBufferLength, + DWORD dwReserved) = 0; +}; + +// This interface uses a couple of enums which are not defined in old MinGW +// SDK headers, but we don't have any reliable way to test if they're actually +// defined, so define our own enums, containing just the values we need: this +// compiles everywhere and is ABI-compatible with the real enums. +enum wxPARSEACTION +{ + wxPARSE_SECURITY_URL = 3, + wxPARSE_SECURITY_DOMAIN = 17 +}; + +enum wxQUERYOPTION +{ + // We don't actually need any values in this one. +}; + +class wxIInternetProtocolInfo : public IUnknown +{ +public: + virtual HRESULT STDMETHODCALLTYPE ParseUrl(LPCWSTR pwzUrl, + wxPARSEACTION ParseAction, + DWORD dwParseFlags, + LPWSTR pwzResult, + DWORD cchResult, + DWORD *pcchResult, + DWORD dwReserved) = 0; + + virtual HRESULT STDMETHODCALLTYPE CombineUrl(LPCWSTR pwzBaseUrl, + LPCWSTR pwzRelativeUrl, + DWORD dwCombineFlags, + LPWSTR pwzResult, + DWORD cchResult, + DWORD *pcchResult, + DWORD dwReserved) = 0; + + virtual HRESULT STDMETHODCALLTYPE CompareUrl(LPCWSTR pwzUrl1, + LPCWSTR pwzUrl2, + DWORD dwCompareFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE QueryInfo(LPCWSTR pwzUrl, + wxQUERYOPTION OueryOption, + DWORD dwQueryFlags, + LPVOID pBuffer, + DWORD cbBuffer, + DWORD *pcbBuf, + DWORD dwReserved) = 0; +}; + +/* end of urlmon.h */ + +/* mshtmhst.h */ + +typedef enum _tagwxDOCHOSTUIFLAG +{ + DOCHOSTUIFLAG_DIALOG = 0x1, + DOCHOSTUIFLAG_DISABLE_HELP_MENU = 0x2, + DOCHOSTUIFLAG_NO3DBORDER = 0x4, + DOCHOSTUIFLAG_SCROLL_NO = 0x8, + DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE = 0x10, + DOCHOSTUIFLAG_OPENNEWWIN = 0x20, + DOCHOSTUIFLAG_DISABLE_OFFSCREEN = 0x40, + DOCHOSTUIFLAG_FLAT_SCROLLBAR = 0x80, + DOCHOSTUIFLAG_DIV_BLOCKDEFAULT = 0x100, + DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY = 0x200, + DOCHOSTUIFLAG_OVERRIDEBEHAVIORFACTORY = 0x400, + DOCHOSTUIFLAG_CODEPAGELINKEDFONTS = 0x800, + DOCHOSTUIFLAG_URL_ENCODING_DISABLE_UTF8 = 0x1000, + DOCHOSTUIFLAG_URL_ENCODING_ENABLE_UTF8 = 0x2000, + DOCHOSTUIFLAG_ENABLE_FORMS_AUTOCOMPLETE = 0x4000, + DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION = 0x10000, + DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION = 0x20000, + DOCHOSTUIFLAG_THEME = 0x40000, + DOCHOSTUIFLAG_NOTHEME = 0x80000, + DOCHOSTUIFLAG_NOPICS = 0x100000, + DOCHOSTUIFLAG_NO3DOUTERBORDER = 0x200000, + DOCHOSTUIFLAG_DISABLE_EDIT_NS_FIXUP = 0x400000, + DOCHOSTUIFLAG_LOCAL_MACHINE_ACCESS_CHECK = 0x800000, + DOCHOSTUIFLAG_DISABLE_UNTRUSTEDPROTOCOL = 0x1000000, + DOCHOSTUIFLAG_ENABLE_REDIRECT_NOTIFICATION = 0x4000000, + DOCHOSTUIFLAG_DPI_AWARE = 0x40000000 +} DOCHOSTUIFLAG; + +typedef struct _tagwxDOCHOSTUIINFO +{ + ULONG cbSize; + DWORD dwFlags; + DWORD dwDoubleClick; + OLECHAR *pchHostCss; + OLECHAR *pchHostNS; +} DOCHOSTUIINFO; + +class wxIDocHostUIHandler : public IUnknown +{ +public: + virtual HRESULT wxSTDCALL ShowContextMenu(DWORD dwID, POINT *ppt, + IUnknown *pcmdtReserved, + IDispatch *pdispReserved) = 0; + + virtual HRESULT wxSTDCALL GetHostInfo(DOCHOSTUIINFO *pInfo) = 0; + + virtual HRESULT wxSTDCALL ShowUI(DWORD dwID, + IOleInPlaceActiveObject *pActiveObject, + IOleCommandTarget *pCommandTarget, + IOleInPlaceFrame *pFrame, + IOleInPlaceUIWindow *pDoc) = 0; + + virtual HRESULT wxSTDCALL HideUI(void) = 0; + + virtual HRESULT wxSTDCALL UpdateUI(void) = 0; + + virtual HRESULT wxSTDCALL EnableModeless(BOOL fEnable) = 0; + + virtual HRESULT wxSTDCALL OnDocWindowActivate(BOOL fActivate) = 0; + + virtual HRESULT wxSTDCALL OnFrameWindowActivate(BOOL fActivate) = 0; + + virtual HRESULT wxSTDCALL ResizeBorder(LPCRECT prcBorder, + IOleInPlaceUIWindow *pUIWindow, + BOOL fRameWindow) = 0; + + virtual HRESULT wxSTDCALL TranslateAccelerator(LPMSG lpMsg, + const GUID *pguidCmdGroup, + DWORD nCmdID) = 0; + + virtual HRESULT wxSTDCALL GetOptionKeyPath(LPOLESTR *pchKey, + DWORD dw) = 0; + + virtual HRESULT wxSTDCALL GetDropTarget(IDropTarget *pDropTarget, + IDropTarget **ppDropTarget) = 0; + + virtual HRESULT wxSTDCALL GetExternal(IDispatch **ppDispatch) = 0; + + virtual HRESULT wxSTDCALL TranslateUrl(DWORD dwTranslate, + OLECHAR *pchURLIn, + OLECHAR **ppchURLOut) = 0; + + virtual HRESULT wxSTDCALL FilterDataObject(IDataObject *pDO, + IDataObject **ppDORet) = 0; +}; + +/* end of mshtmhst.h */ + +/* mshtml.h */ + +typedef enum _tagwxPOINTER_GRAVITY +{ + wxPOINTER_GRAVITY_Left = 0, + wxPOINTER_GRAVITY_Right = 1, + wxPOINTER_GRAVITY_Max = 2147483647 +} wxPOINTER_GRAVITY; + +typedef enum _tagwxELEMENT_ADJACENCY +{ + wxELEM_ADJ_BeforeBegin = 0, + wxELEM_ADJ_AfterBegin = 1, + wxELEM_ADJ_BeforeEnd = 2, + wxELEM_ADJ_AfterEnd = 3, + wxELEMENT_ADJACENCY_Max = 2147483647 +} wxELEMENT_ADJACENCY; + +typedef enum _tagwxMARKUP_CONTEXT_TYPE +{ + wxCONTEXT_TYPE_None = 0, + wxCONTEXT_TYPE_Text = 1, + wxCONTEXT_TYPE_EnterScope = 2, + wxCONTEXT_TYPE_ExitScope = 3, + wxCONTEXT_TYPE_NoScope = 4, + wxMARKUP_CONTEXT_TYPE_Max = 2147483647 +} wxMARKUP_CONTEXT_TYPE; + +typedef enum _tagwxFINDTEXT_FLAGS +{ + wxFINDTEXT_BACKWARDS = 0x1, + wxFINDTEXT_WHOLEWORD = 0x2, + wxFINDTEXT_MATCHCASE = 0x4, + wxFINDTEXT_RAW = 0x20000, + wxFINDTEXT_MATCHDIAC = 0x20000000, + wxFINDTEXT_MATCHKASHIDA = 0x40000000, + wxFINDTEXT_MATCHALEFHAMZA = 0x80000000, + wxFINDTEXT_FLAGS_Max = 2147483647 +} wxFINDTEXT_FLAGS; + +typedef enum _tagwxMOVEUNIT_ACTION +{ + wxMOVEUNIT_PREVCHAR = 0, + wxMOVEUNIT_NEXTCHAR = 1, + wxMOVEUNIT_PREVCLUSTERBEGIN = 2, + wxMOVEUNIT_NEXTCLUSTERBEGIN = 3, + wxMOVEUNIT_PREVCLUSTEREND = 4, + wxMOVEUNIT_NEXTCLUSTEREND = 5, + wxMOVEUNIT_PREVWORDBEGIN = 6, + wxMOVEUNIT_NEXTWORDBEGIN = 7, + wxMOVEUNIT_PREVWORDEND = 8, + wxMOVEUNIT_NEXTWORDEND = 9, + wxMOVEUNIT_PREVPROOFWORD = 10, + wxMOVEUNIT_NEXTPROOFWORD = 11, + wxMOVEUNIT_NEXTURLBEGIN = 12, + wxMOVEUNIT_PREVURLBEGIN = 13, + wxMOVEUNIT_NEXTURLEND = 14, + wxMOVEUNIT_PREVURLEND = 15, + wxMOVEUNIT_PREVSENTENCE = 16, + wxMOVEUNIT_NEXTSENTENCE = 17, + wxMOVEUNIT_PREVBLOCK = 18, + wxMOVEUNIT_NEXTBLOCK = 19, + wxMOVEUNIT_ACTION_Max = 2147483647 +} wxMOVEUNIT_ACTION; + +typedef enum _tagwxELEMENT_TAG_ID +{ + wxTAGID_NULL = 0, wxTAGID_UNKNOWN = 1, wxTAGID_A = 2, wxTAGID_ACRONYM = 3, + wxTAGID_ADDRESS = 4, wxTAGID_APPLET = 5, wxTAGID_AREA = 6, wxTAGID_B = 7, + wxTAGID_BASE = 8, wxTAGID_BASEFONT = 9, wxTAGID_BDO = 10, + wxTAGID_BGSOUND = 11, wxTAGID_BIG = 12, wxTAGID_BLINK = 13, + wxTAGID_BLOCKQUOTE = 14, wxTAGID_BODY = 15, wxTAGID_BR = 16, + wxTAGID_BUTTON = 17, wxTAGID_CAPTION = 18, wxTAGID_CENTER = 19, + wxTAGID_CITE = 20, wxTAGID_CODE = 21, wxTAGID_COL = 22, + wxTAGID_COLGROUP = 23, wxTAGID_COMMENT = 24, wxTAGID_COMMENT_RAW = 25, + wxTAGID_DD = 26, wxTAGID_DEL = 27, wxTAGID_DFN = 28, wxTAGID_DIR = 29, + wxTAGID_DIV = 30, wxTAGID_DL = 31, wxTAGID_DT = 32, wxTAGID_EM = 33, + wxTAGID_EMBED = 34, wxTAGID_FIELDSET = 35, wxTAGID_FONT = 36, + wxTAGID_FORM = 37, wxTAGID_FRAME = 38, wxTAGID_FRAMESET = 39, + wxTAGID_GENERIC = 40, wxTAGID_H1 = 41, wxTAGID_H2 = 42, wxTAGID_H3 = 43, + wxTAGID_H4 = 44, wxTAGID_H5 = 45, wxTAGID_H6 = 46, wxTAGID_HEAD = 47, + wxTAGID_HR = 48, wxTAGID_HTML = 49, wxTAGID_I = 50, wxTAGID_IFRAME = 51, + wxTAGID_IMG = 52, wxTAGID_INPUT = 53, wxTAGID_INS = 54, wxTAGID_KBD = 55, + wxTAGID_LABEL = 56, wxTAGID_LEGEND = 57, wxTAGID_LI = 58, wxTAGID_LINK = 59, + wxTAGID_LISTING = 60, wxTAGID_MAP = 61, wxTAGID_MARQUEE = 62, + wxTAGID_MENU = 63, wxTAGID_META = 64, wxTAGID_NEXTID = 65, + wxTAGID_NOBR = 66, wxTAGID_NOEMBED = 67, wxTAGID_NOFRAMES = 68, + wxTAGID_NOSCRIPT = 69, wxTAGID_OBJECT = 70, wxTAGID_OL = 71, + wxTAGID_OPTION = 72, wxTAGID_P = 73, wxTAGID_PARAM = 74, + wxTAGID_PLAINTEXT = 75, wxTAGID_PRE = 76, wxTAGID_Q = 77, wxTAGID_RP = 78, + wxTAGID_RT = 79, wxTAGID_RUBY = 80, wxTAGID_S = 81, wxTAGID_SAMP = 82, + wxTAGID_SCRIPT = 83, wxTAGID_SELECT = 84, wxTAGID_SMALL = 85, + wxTAGID_SPAN = 86, wxTAGID_STRIKE = 87, wxTAGID_STRONG = 88, + wxTAGID_STYLE = 89, wxTAGID_SUB = 90, wxTAGID_SUP = 91, wxTAGID_TABLE = 92, + wxTAGID_TBODY = 93, wxTAGID_TC = 94, wxTAGID_TD = 95, wxTAGID_TEXTAREA = 96, + wxTAGID_TFOOT = 97, wxTAGID_TH = 98, wxTAGID_THEAD = 99, + wxTAGID_TITLE = 100, wxTAGID_TR = 101, wxTAGID_TT = 102, wxTAGID_U = 103, + wxTAGID_UL = 104, wxTAGID_VAR = 105, wxTAGID_WBR = 106, wxTAGID_XMP = 107, + wxTAGID_ROOT = 108, wxTAGID_OPTGROUP = 109, wxTAGID_COUNT = 110, + wxTAGID_LAST_PREDEFINED = 10000, wxELEMENT_TAG_ID_Max = 2147483647 +} wxELEMENT_TAG_ID; + +struct wxIHTMLStyle : public IDispatch +{ +public: + virtual HRESULT wxSTDCALL put_fontFamily(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_fontFamily(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_fontStyle(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_fontStyle(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_fontVariant(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_fontVariant(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_fontWeight(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_fontWeight(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_fontSize(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_fontSize(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_font(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_font(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_color(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_color(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_background(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_background(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_backgroundColor(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_backgroundColor(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_backgroundImage(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_backgroundImage(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_backgroundRepeat(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_backgroundRepeat(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_backgroundAttachment(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_backgroundAttachment(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_backgroundPosition(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_backgroundPosition(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_backgroundPositionX(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_backgroundPositionX(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_backgroundPositionY(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_backgroundPositionY(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_wordSpacing(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_wordSpacing(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_letterSpacing(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_letterSpacing(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_textDecoration(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_textDecoration(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_textDecorationNone(VARIANT_BOOL v) = 0; + virtual HRESULT wxSTDCALL get_textDecorationNone(VARIANT_BOOL *p) = 0; + virtual HRESULT wxSTDCALL put_textDecorationUnderline(VARIANT_BOOL v) = 0; + virtual HRESULT wxSTDCALL get_textDecorationUnderline(VARIANT_BOOL *p) = 0; + virtual HRESULT wxSTDCALL put_textDecorationOverline(VARIANT_BOOL v) = 0; + virtual HRESULT wxSTDCALL get_textDecorationOverline(VARIANT_BOOL *p) = 0; + virtual HRESULT wxSTDCALL put_textDecorationLineThrough(VARIANT_BOOL v) = 0; + virtual HRESULT wxSTDCALL get_textDecorationLineThrough(VARIANT_BOOL *p) = 0; + virtual HRESULT wxSTDCALL put_textDecorationBlink(VARIANT_BOOL v) = 0; + virtual HRESULT wxSTDCALL get_textDecorationBlink(VARIANT_BOOL *p) = 0; + virtual HRESULT wxSTDCALL put_verticalAlign(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_verticalAlign(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_textTransform(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_textTransform(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_textAlign(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_textAlign(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_textIndent(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_textIndent(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_lineHeight(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_lineHeight(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_marginTop(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_marginTop(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_marginRight(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_marginRight(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_marginBottom(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_marginBottom(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_marginLeft(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_marginLeft(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_margin(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_margin(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_paddingTop(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_paddingTop(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_paddingRight(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_paddingRight(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_paddingBottom(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_paddingBottom(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_paddingLeft(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_paddingLeft(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_padding(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_padding(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_border(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_border(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_borderTop(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_borderTop(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_borderRight(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_borderRight(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_borderBottom(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_borderBottom(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_borderLeft(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_borderLeft(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_borderColor(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_borderColor(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_borderTopColor(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_borderTopColor(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_borderRightColor(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_borderRightColor(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_borderBottomColor(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_borderBottomColor(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_borderLeftColor(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_borderLeftColor(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_borderWidth(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_borderWidth(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_borderTopWidth(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_borderTopWidth(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_borderRightWidth(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_borderRightWidth(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_borderBottomWidth(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_borderBottomWidth(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_borderLeftWidth(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_borderLeftWidth(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_borderStyle(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_borderStyle(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_borderTopStyle(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_borderTopStyle(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_borderRightStyle(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_borderRightStyle(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_borderBottomStyle(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_borderBottomStyle(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_borderLeftStyle(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_borderLeftStyle(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_width(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_width(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_height(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_height(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_styleFloat(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_styleFloat(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_clear(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_clear(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_display(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_display(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_visibility(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_visibility(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_listStyleType(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_listStyleType(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_listStylePosition(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_listStylePosition(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_listStyleImage(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_listStyleImage(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_listStyle(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_listStyle(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_whiteSpace(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_whiteSpace(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_top(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_top(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_left(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_left(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_position(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_zIndex(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_zIndex(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_overflow(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_overflow(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_pageBreakBefore(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_pageBreakBefore(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_pageBreakAfter(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_pageBreakAfter(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_cssText(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_cssText(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_pixelTop(long v) = 0; + virtual HRESULT wxSTDCALL get_pixelTop(long *p) = 0; + virtual HRESULT wxSTDCALL put_pixelLeft(long v) = 0; + virtual HRESULT wxSTDCALL get_pixelLeft(long *p) = 0; + virtual HRESULT wxSTDCALL put_pixelWidth(long v) = 0; + virtual HRESULT wxSTDCALL get_pixelWidth(long *p) = 0; + virtual HRESULT wxSTDCALL put_pixelHeight(long v) = 0; + virtual HRESULT wxSTDCALL get_pixelHeight(long *p) = 0; + virtual HRESULT wxSTDCALL put_posTop(float v) = 0; + virtual HRESULT wxSTDCALL get_posTop(float *p) = 0; + virtual HRESULT wxSTDCALL put_posLeft(float v) = 0; + virtual HRESULT wxSTDCALL get_posLeft(float *p) = 0; + virtual HRESULT wxSTDCALL put_posWidth(float v) = 0; + virtual HRESULT wxSTDCALL get_posWidth(float *p) = 0; + virtual HRESULT wxSTDCALL put_posHeight(float v) = 0; + virtual HRESULT wxSTDCALL get_posHeight(float *p) = 0; + virtual HRESULT wxSTDCALL put_cursor(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_cursor(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_clip(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_clip(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_filter(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_filter(BSTR *p) = 0; + virtual HRESULT wxSTDCALL setAttribute(BSTR strAttributeName, VARIANT AttributeValue, LONG lFlags = 1) = 0; + virtual HRESULT wxSTDCALL getAttribute(BSTR strAttributeName, LONG lFlags, VARIANT *AttributeValue) = 0; + virtual HRESULT wxSTDCALL removeAttribute(BSTR strAttributeName, LONG lFlags, VARIANT_BOOL *pfSuccess) = 0; + virtual HRESULT wxSTDCALL toString(BSTR *String) = 0; +}; + +struct wxIHTMLCurrentStyle : public IDispatch +{ +public: + virtual HRESULT wxSTDCALL get_position(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_styleFloat(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_color(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_backgroundColor(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_fontFamily(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_fontStyle(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_fontVariant(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_fontWeight(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_fontSize(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_backgroundImage(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_backgroundPositionX(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_backgroundPositionY(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_backgroundRepeat(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_borderLeftColor(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_borderTopColor(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_borderRightColor(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_borderBottomColor(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_borderTopStyle(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_borderRightStyle(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_borderBottomStyle(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_borderLeftStyle(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_borderTopWidth(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_borderRightWidth(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_borderBottomWidth(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_borderLeftWidth(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_left(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_top(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_width(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_height(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_paddingLeft(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_paddingTop(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_paddingRight(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_paddingBottom(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_textAlign(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_textDecoration(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_display(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_visibility(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_zIndex(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_letterSpacing(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_lineHeight(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_textIndent(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_verticalAlign(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_backgroundAttachment(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_marginTop(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_marginRight(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_marginBottom(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_marginLeft(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_clear(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_listStyleType(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_listStylePosition(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_listStyleImage(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_clipTop(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_clipRight(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_clipBottom(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_clipLeft(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_overflow(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_pageBreakBefore(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_pageBreakAfter(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_cursor(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_tableLayout(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_borderCollapse(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_direction(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_behavior(BSTR *p) = 0; + virtual HRESULT wxSTDCALL getAttribute(BSTR strAttributeName, LONG lFlags, VARIANT *AttributeValue) = 0; + virtual HRESULT wxSTDCALL get_unicodeBidi(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_right(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_bottom(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_imeMode(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_rubyAlign(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_rubyPosition(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_rubyOverhang(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_textAutospace(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_lineBreak(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_wordBreak(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_textJustify(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_textJustifyTrim(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_textKashida(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_blockDirection(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_layoutGridChar(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_layoutGridLine(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_layoutGridMode(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_layoutGridType(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_borderStyle(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_borderColor(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_borderWidth(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_padding(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_margin(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_accelerator(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_overflowX(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_overflowY(BSTR *p) = 0; + virtual HRESULT wxSTDCALL get_textTransform(BSTR *p) = 0; +}; + + +struct wxIHTMLRect : public IDispatch +{ +public: + virtual HRESULT wxSTDCALL put_left(long v) = 0; + virtual HRESULT wxSTDCALL get_left(long *p) = 0; + virtual HRESULT wxSTDCALL put_top(long v) = 0; + virtual HRESULT wxSTDCALL get_top(long *p) = 0; + virtual HRESULT wxSTDCALL put_right(long v) = 0; + virtual HRESULT wxSTDCALL get_right(long *p) = 0; + virtual HRESULT wxSTDCALL put_bottom(long v) = 0; + virtual HRESULT wxSTDCALL get_bottom(long *p) = 0; +}; + +struct wxIHTMLRectCollection : public IDispatch +{ +public: + virtual HRESULT wxSTDCALL get_length(long *p) = 0; + virtual HRESULT wxSTDCALL get__newEnum(IUnknown **p) = 0; + virtual HRESULT wxSTDCALL item(VARIANT *pvarIndex, VARIANT *pvarResult) = 0; +}; + +struct wxIHTMLFiltersCollection : public IDispatch +{ +public: + virtual HRESULT wxSTDCALL get_length(long *p) = 0; + virtual HRESULT wxSTDCALL get__newEnum(IUnknown **p) = 0; + virtual HRESULT wxSTDCALL item(VARIANT *pvarIndex, VARIANT *pvarResult) = 0; +}; + +struct wxIHTMLElementCollection : public IDispatch +{ +public: + virtual HRESULT wxSTDCALL toString(BSTR *String) = 0; + virtual HRESULT wxSTDCALL put_length(long v) = 0; + virtual HRESULT wxSTDCALL get_length(long *p) = 0; + virtual HRESULT wxSTDCALL get__newEnum(IUnknown **p) = 0; + virtual HRESULT wxSTDCALL item(VARIANT name, VARIANT index, IDispatch **pdisp) = 0; + virtual HRESULT wxSTDCALL tags(VARIANT tagName, IDispatch **pdisp) = 0; +}; + +struct wxIHTMLElement2 : public IDispatch +{ +public: + virtual HRESULT wxSTDCALL get_scopeName(BSTR *p) = 0; + virtual HRESULT wxSTDCALL setCapture(VARIANT_BOOL containerCapture = -1) = 0; + virtual HRESULT wxSTDCALL releaseCapture(void) = 0; + virtual HRESULT wxSTDCALL put_onlosecapture(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_onlosecapture(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL componentFromPoint(long x, long y, BSTR *component) = 0; + virtual HRESULT wxSTDCALL doScroll(VARIANT component) = 0; + virtual HRESULT wxSTDCALL put_onscroll(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_onscroll(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_ondrag(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_ondrag(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_ondragend(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_ondragend(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_ondragenter(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_ondragenter(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_ondragover(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_ondragover(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_ondragleave(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_ondragleave(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_ondrop(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_ondrop(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_onbeforecut(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_onbeforecut(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_oncut(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_oncut(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_onbeforecopy(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_onbeforecopy(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_oncopy(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_oncopy(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_onbeforepaste(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_onbeforepaste(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_onpaste(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_onpaste(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_currentStyle(wxIHTMLCurrentStyle **p) = 0; + virtual HRESULT wxSTDCALL put_onpropertychange(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_onpropertychange(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL getClientRects(wxIHTMLRectCollection **pRectCol) = 0; + virtual HRESULT wxSTDCALL getBoundingClientRect(wxIHTMLRect **pRect) = 0; + virtual HRESULT wxSTDCALL setExpression(BSTR propname, BSTR expression, BSTR language) = 0; + virtual HRESULT wxSTDCALL getExpression(BSTR propname, VARIANT *expression) = 0; + virtual HRESULT wxSTDCALL removeExpression(BSTR propname, VARIANT_BOOL *pfSuccess) = 0; + virtual HRESULT wxSTDCALL put_tabIndex(short v) = 0; + virtual HRESULT wxSTDCALL get_tabIndex(short *p) = 0; + virtual HRESULT wxSTDCALL focus(void) = 0; + virtual HRESULT wxSTDCALL put_accessKey(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_accessKey(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_onblur(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_onblur(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_onfocus(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_onfocus(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_onresize(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_onresize(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL blur(void) = 0; + virtual HRESULT wxSTDCALL addFilter(IUnknown *pUnk) = 0; + virtual HRESULT wxSTDCALL removeFilter(IUnknown *pUnk) = 0; + virtual HRESULT wxSTDCALL get_clientHeight(long *p) = 0; + virtual HRESULT wxSTDCALL get_clientWidth(long *p) = 0; + virtual HRESULT wxSTDCALL get_clientTop(long *p) = 0; + virtual HRESULT wxSTDCALL get_clientLeft(long *p) = 0; + virtual HRESULT wxSTDCALL attachEvent(BSTR event, IDispatch *pDisp, VARIANT_BOOL *pfResult) = 0; + virtual HRESULT wxSTDCALL detachEvent(BSTR event, IDispatch *pDisp) = 0; + virtual HRESULT wxSTDCALL get_readyState(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_onreadystatechange(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_onreadystatechange(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_onrowsdelete(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_onrowsdelete(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_onrowsinserted(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_onrowsinserted(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_oncellchange(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_oncellchange(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL put_dir(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_dir(BSTR *p) = 0; + virtual HRESULT wxSTDCALL createControlRange(IDispatch **range) = 0; + virtual HRESULT wxSTDCALL get_scrollHeight(long *p) = 0; + virtual HRESULT wxSTDCALL get_scrollWidth(long *p) = 0; + virtual HRESULT wxSTDCALL put_scrollTop(long v) = 0; + virtual HRESULT wxSTDCALL get_scrollTop(long *p) = 0; + virtual HRESULT wxSTDCALL put_scrollLeft(long v) = 0; + virtual HRESULT wxSTDCALL get_scrollLeft(long *p) = 0; + virtual HRESULT wxSTDCALL clearAttributes(void) = 0; + virtual HRESULT wxSTDCALL mergeAttributes(IHTMLElement *mergeThis) = 0; + virtual HRESULT wxSTDCALL put_oncontextmenu(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_oncontextmenu(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL insertAdjacentElement(BSTR where, IHTMLElement *insertedElement, IHTMLElement **inserted) = 0; + virtual HRESULT wxSTDCALL applyElement(IHTMLElement *apply, BSTR where, IHTMLElement **applied) = 0; + virtual HRESULT wxSTDCALL getAdjacentText(BSTR where, BSTR *text) = 0; + virtual HRESULT wxSTDCALL replaceAdjacentText(BSTR where, BSTR newText, BSTR *oldText) = 0; + virtual HRESULT wxSTDCALL get_canHaveChildren(VARIANT_BOOL *p) = 0; + virtual HRESULT wxSTDCALL addBehavior(BSTR bstrUrl, VARIANT *pvarFactory, long *pCookie) = 0; + virtual HRESULT wxSTDCALL removeBehavior(long cookie, VARIANT_BOOL *pfResult) = 0; + virtual HRESULT wxSTDCALL get_runtimeStyle(wxIHTMLStyle **p) = 0; + virtual HRESULT wxSTDCALL get_behaviorUrns(IDispatch **p) = 0; + virtual HRESULT wxSTDCALL put_tagUrn(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_tagUrn(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_onbeforeeditfocus(VARIANT v) = 0; + virtual HRESULT wxSTDCALL get_onbeforeeditfocus(VARIANT *p) = 0; + virtual HRESULT wxSTDCALL get_readyStateValue(long *p) = 0; + virtual HRESULT wxSTDCALL getElementsByTagName(BSTR v, + wxIHTMLElementCollection **pelColl) = 0; +}; + +struct wxIHTMLTxtRange : public IDispatch +{ +public: + virtual HRESULT wxSTDCALL get_htmlText(BSTR *p) = 0; + virtual HRESULT wxSTDCALL put_text(BSTR v) = 0; + virtual HRESULT wxSTDCALL get_text(BSTR *p) = 0; + virtual HRESULT wxSTDCALL parentElement(IHTMLElement **parent) = 0; + virtual HRESULT wxSTDCALL duplicate(wxIHTMLTxtRange **Duplicate) = 0; + virtual HRESULT wxSTDCALL inRange(wxIHTMLTxtRange *Range, VARIANT_BOOL *InRange) = 0; + virtual HRESULT wxSTDCALL isEqual(wxIHTMLTxtRange *Range, VARIANT_BOOL *IsEqual) = 0; + virtual HRESULT wxSTDCALL scrollIntoView(VARIANT_BOOL fStart = -1) = 0; + virtual HRESULT wxSTDCALL collapse(VARIANT_BOOL Start = -1) = 0; + virtual HRESULT wxSTDCALL expand(BSTR Unit, VARIANT_BOOL *Success) = 0; + virtual HRESULT wxSTDCALL move(BSTR Unit, long Count, long *ActualCount) = 0; + virtual HRESULT wxSTDCALL moveStart(BSTR Unit, long Count, long *ActualCount) = 0; + virtual HRESULT wxSTDCALL moveEnd(BSTR Unit, long Count, long *ActualCount) = 0; + virtual HRESULT wxSTDCALL select(void) = 0; + virtual HRESULT wxSTDCALL pasteHTML(BSTR html) = 0; + virtual HRESULT wxSTDCALL moveToElementText(IHTMLElement *element) = 0; + virtual HRESULT wxSTDCALL setEndPoint(BSTR how, wxIHTMLTxtRange *SourceRange) = 0; + virtual HRESULT wxSTDCALL compareEndPoints(BSTR how, wxIHTMLTxtRange *SourceRange, long *ret) = 0; + virtual HRESULT wxSTDCALL findText(BSTR String, long count, long Flags, VARIANT_BOOL *Success) = 0; + virtual HRESULT wxSTDCALL moveToPoint(long x, long y) = 0; + virtual HRESULT wxSTDCALL getBookmark(BSTR *Boolmark) = 0; + virtual HRESULT wxSTDCALL moveToBookmark(BSTR Bookmark, VARIANT_BOOL *Success) = 0; + virtual HRESULT wxSTDCALL queryCommandSupported(BSTR cmdID, VARIANT_BOOL *pfRet) = 0; + virtual HRESULT wxSTDCALL queryCommandEnabled(BSTR cmdID, VARIANT_BOOL *pfRet) = 0; + virtual HRESULT wxSTDCALL queryCommandState(BSTR cmdID, VARIANT_BOOL *pfRet) = 0; + virtual HRESULT wxSTDCALL queryCommandIndeterm(BSTR cmdID, VARIANT_BOOL *pfRet) = 0; + virtual HRESULT wxSTDCALL queryCommandText(BSTR cmdID, BSTR *pcmdText) = 0; + virtual HRESULT wxSTDCALL queryCommandValue(BSTR cmdID, VARIANT *pcmdValue) = 0; + virtual HRESULT wxSTDCALL execCommand(BSTR cmdID, VARIANT_BOOL showUI, VARIANT value, VARIANT_BOOL *pfRet) = 0; + virtual HRESULT wxSTDCALL execCommandShowHelp(BSTR cmdID, VARIANT_BOOL *pfRet) = 0; +}; + +struct wxIMarkupContainer : public IUnknown +{ +public: + virtual HRESULT wxSTDCALL OwningDoc(IHTMLDocument2 **ppDoc) = 0; +}; + +struct wxIMarkupPointer : public IUnknown +{ +public: + virtual HRESULT wxSTDCALL OwningDoc(IHTMLDocument2 **ppDoc) = 0; + virtual HRESULT wxSTDCALL Gravity(wxPOINTER_GRAVITY *pGravity) = 0; + virtual HRESULT wxSTDCALL SetGravity(wxPOINTER_GRAVITY Gravity) = 0; + virtual HRESULT wxSTDCALL Cling(BOOL *pfCling) = 0; + virtual HRESULT wxSTDCALL SetCling(BOOL fCLing) = 0; + virtual HRESULT wxSTDCALL Unposition(void) = 0; + virtual HRESULT wxSTDCALL IsPositioned(BOOL *pfPositioned) = 0; + virtual HRESULT wxSTDCALL GetContainer(wxIMarkupContainer **ppContainer) = 0; + virtual HRESULT wxSTDCALL MoveAdjacentToElement(IHTMLElement *pElement, wxELEMENT_ADJACENCY eAdj) = 0; + virtual HRESULT wxSTDCALL MoveToPointer(wxIMarkupPointer *pPointer) = 0; + virtual HRESULT wxSTDCALL MoveToContainer(wxIMarkupContainer *pContainer, BOOL fAtStart) = 0; + virtual HRESULT wxSTDCALL Left(BOOL fMove, wxMARKUP_CONTEXT_TYPE *pContext, IHTMLElement **ppElement, long *pcch, OLECHAR *pchText) = 0; + virtual HRESULT wxSTDCALL Right(BOOL fMove, wxMARKUP_CONTEXT_TYPE *pContext, IHTMLElement **ppElement, long *pcch, OLECHAR *pchText) = 0; + virtual HRESULT wxSTDCALL CurrentScope(IHTMLElement **ppElemCurrent) = 0; + virtual HRESULT wxSTDCALL IsLeftOf(wxIMarkupPointer *pPointerThat, BOOL *pfResult) = 0; + virtual HRESULT wxSTDCALL IsLeftOfOrEqualTo(wxIMarkupPointer *pPointerThat, BOOL *pfResult) = 0; + virtual HRESULT wxSTDCALL IsRightOf(wxIMarkupPointer *pPointerThat, BOOL *pfResult) = 0; + virtual HRESULT wxSTDCALL IsRightOfOrEqualTo(wxIMarkupPointer *pPointerThat, BOOL *pfResult) = 0; + virtual HRESULT wxSTDCALL IsEqualTo(wxIMarkupPointer *pPointerThat, BOOL *pfAreEqual) = 0; + virtual HRESULT wxSTDCALL MoveUnit(wxMOVEUNIT_ACTION muAction) = 0; + virtual HRESULT wxSTDCALL FindText(OLECHAR *pchFindText, DWORD dwFlags, wxIMarkupPointer *pIEndMatch, wxIMarkupPointer *pIEndSearch) = 0; +}; + +struct wxIMarkupServices : public IUnknown +{ +public: + virtual HRESULT wxSTDCALL CreateMarkupPointer(wxIMarkupPointer **ppPointer) = 0; + virtual HRESULT wxSTDCALL CreateMarkupContainer(wxIMarkupContainer **ppMarkupContainer) = 0; + virtual HRESULT wxSTDCALL CreateElement(wxELEMENT_TAG_ID tagID, OLECHAR *pchAttributes, IHTMLElement **ppElement) = 0; + virtual HRESULT wxSTDCALL CloneElement(IHTMLElement *pElemCloneThis, IHTMLElement **ppElementTheClone) = 0; + virtual HRESULT wxSTDCALL InsertElement(IHTMLElement *pElementInsert, wxIMarkupPointer *pPointerStart, wxIMarkupPointer *pPointerFinish) = 0; + virtual HRESULT wxSTDCALL RemoveElement(IHTMLElement *pElementRemove) = 0; + virtual HRESULT wxSTDCALL Remove(wxIMarkupPointer *pPointerStart, wxIMarkupPointer *pPointerFinish) = 0; + virtual HRESULT wxSTDCALL Copy(wxIMarkupPointer *pPointerSourceStart, wxIMarkupPointer *pPointerSourceFinish, wxIMarkupPointer *pPointerTarget) = 0; + virtual HRESULT wxSTDCALL Move(wxIMarkupPointer *pPointerSourceStart, wxIMarkupPointer *pPointerSourceFinish, wxIMarkupPointer *pPointerTarget) = 0; + virtual HRESULT wxSTDCALL InsertText(OLECHAR *pchText, long cch, wxIMarkupPointer *pPointerTarget) = 0; + virtual HRESULT wxSTDCALL ParseString(OLECHAR *pchHTML, DWORD dwFlags, wxIMarkupContainer **ppContainerResult, wxIMarkupPointer *ppPointerStart, wxIMarkupPointer *ppPointerFinish) = 0; + virtual HRESULT wxSTDCALL ParseGlobal(HGLOBAL hglobalHTML, DWORD dwFlags, wxIMarkupContainer **ppContainerResult, wxIMarkupPointer *pPointerStart, wxIMarkupPointer *pPointerFinish) = 0; + virtual HRESULT wxSTDCALL IsScopedElement(IHTMLElement *pElement, BOOL *pfScoped) = 0; + virtual HRESULT wxSTDCALL GetElementTagId(IHTMLElement *pElement, wxELEMENT_TAG_ID *ptagId) = 0; + virtual HRESULT wxSTDCALL GetTagIDForName(BSTR bstrName, wxELEMENT_TAG_ID *ptagId) = 0; + virtual HRESULT wxSTDCALL GetNameForTagID(wxELEMENT_TAG_ID tagId, BSTR *pbstrName) = 0; + virtual HRESULT wxSTDCALL MovePointersToRange(wxIHTMLTxtRange *pIRange, wxIMarkupPointer *pPointerStart, wxIMarkupPointer *pPointerFinish) = 0; + virtual HRESULT wxSTDCALL MoveRangeToPointers(wxIMarkupPointer *pPointerStart, wxIMarkupPointer *pPointerFinish, wxIHTMLTxtRange *pIRange) = 0; + virtual HRESULT wxSTDCALL BeginUndoUnit(OLECHAR *pchTitle) = 0; + virtual HRESULT wxSTDCALL EndUndoUnit(void) = 0; +}; + +/* end of mshtml.h */ + +/* WinInet.h */ + +#ifndef HTTP_STATUS_BAD_REQUEST +#define HTTP_STATUS_BAD_REQUEST 400 +#endif + +#ifndef HTTP_STATUS_DENIED +#define HTTP_STATUS_DENIED 401 +#endif + +#ifndef HTTP_STATUS_PAYMENT_REQ +#define HTTP_STATUS_PAYMENT_REQ 402 +#endif + +#ifndef HTTP_STATUS_FORBIDDEN +#define HTTP_STATUS_FORBIDDEN 403 +#endif + +#ifndef HTTP_STATUS_NOT_FOUND +#define HTTP_STATUS_NOT_FOUND 404 +#endif + +#ifndef HTTP_STATUS_BAD_METHOD +#define HTTP_STATUS_BAD_METHOD 405 +#endif + +#ifndef HTTP_STATUS_NONE_ACCEPTABLE +#define HTTP_STATUS_NONE_ACCEPTABLE 406 +#endif + +#ifndef HTTP_STATUS_PROXY_AUTH_REQ +#define HTTP_STATUS_PROXY_AUTH_REQ 407 +#endif + +#ifndef HTTP_STATUS_REQUEST_TIMEOUT +#define HTTP_STATUS_REQUEST_TIMEOUT 408 +#endif + +#ifndef HTTP_STATUS_CONFLICT +#define HTTP_STATUS_CONFLICT 409 +#endif + +#ifndef HTTP_STATUS_GONE +#define HTTP_STATUS_GONE 410 +#endif + +#ifndef HTTP_STATUS_LENGTH_REQUIRED +#define HTTP_STATUS_LENGTH_REQUIRED 411 +#endif + +#ifndef HTTP_STATUS_PRECOND_FAILED +#define HTTP_STATUS_PRECOND_FAILED 412 +#endif + +#ifndef HTTP_STATUS_REQUEST_TOO_LARGE +#define HTTP_STATUS_REQUEST_TOO_LARGE 413 +#endif + +#ifndef HTTP_STATUS_URI_TOO_LONG +#define HTTP_STATUS_URI_TOO_LONG 414 +#endif + +#ifndef HTTP_STATUS_UNSUPPORTED_MEDIA +#define HTTP_STATUS_UNSUPPORTED_MEDIA 415 +#endif + +#ifndef HTTP_STATUS_RETRY_WITH +#define HTTP_STATUS_RETRY_WITH 449 +#endif + +#ifndef HTTP_STATUS_SERVER_ERROR +#define HTTP_STATUS_SERVER_ERROR 500 +#endif + +#ifndef HTTP_STATUS_NOT_SUPPORTED +#define HTTP_STATUS_NOT_SUPPORTED 501 +#endif + +#ifndef HTTP_STATUS_BAD_GATEWAY +#define HTTP_STATUS_BAD_GATEWAY 502 +#endif + +#ifndef HTTP_STATUS_SERVICE_UNAVAIL +#define HTTP_STATUS_SERVICE_UNAVAIL 503 +#endif + +#ifndef HTTP_STATUS_GATEWAY_TIMEOUT +#define HTTP_STATUS_GATEWAY_TIMEOUT 504 +#endif + +#ifndef HTTP_STATUS_VERSION_NOT_SUP +#define HTTP_STATUS_VERSION_NOT_SUP 505 +#endif + +/* end of WinInet.h */ + +/* ShObjldl_core.h */ + +typedef enum _wxNWMF +{ + wxNWMF_UNLOADING = 0x1, + wxNWMF_USERINITED = 0x2, + wxNWMF_FIRST = 0x4, + wxNWMF_OVERRIDEKEY = 0x8, + wxNWMF_SHOWHELP = 0x10, + wxNWMF_HTMLDIALOG = 0x20, + wxNWMF_FROMDIALOGCHILD = 0x40, + wxNWMF_USERREQUESTED = 0x80, + wxNWMF_USERALLOWED = 0x100, + wxNWMF_FORCEWINDOW = 0x10000, + wxNWMF_FORCETAB = 0x20000, + wxNWMF_SUGGESTWINDOW = 0x40000, + wxNWMF_SUGGESTTAB = 0x80000, + wxNWMF_INACTIVETAB = 0x100000 +} _wxNWMF; + +/* end of ShObjldl_core.h */ diff --git a/lib/wxWidgets/include/wx/msw/private/winstyle.h b/lib/wxWidgets/include/wx/msw/private/winstyle.h new file mode 100644 index 0000000..ffb4a2e --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/private/winstyle.h @@ -0,0 +1,134 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/winstyle.h +// Purpose: Small helper class for updating MSW windows style +// Author: Vadim Zeitlin +// Created: 2017-12-09 +// Copyright: (c) 2017 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_PRIVATE_WINSTYLE_H_ +#define _WX_MSW_PRIVATE_WINSTYLE_H_ + +// ---------------------------------------------------------------------------- +// wxMSWWinLongUpdater +// ---------------------------------------------------------------------------- + +/* + This class is not used directly, but either as wxMSWWinStyleUpdater or + wxMSWWinExStyleUpdater, both of which inherit from it and can be used like + this: + + void SomeFunction() + { + wxMSWWinStyleUpdater updateStyle(GetHwndOf(m_win)); + if ( some-condition ) + updateStyle.TurnOn(XX_YYY); + + // Style update happens here implicitly -- or call Apply(). + } + */ +class wxMSWWinLongUpdater +{ +public: + // Get the current style. + LONG_PTR Get() const + { + return m_styleCurrent; + } + + // Check if the given style bit(s) is (are all) currently turned on. + bool IsOn(LONG_PTR style) const + { + return (m_styleCurrent & style) == style; + } + + // Turn on some bit(s) in the style. + wxMSWWinLongUpdater& TurnOn(LONG_PTR on) + { + m_style |= on; + return *this; + } + + // Turn off some bit(s) in the style. + wxMSWWinLongUpdater& TurnOff(LONG_PTR off) + { + m_style &= ~off; + return *this; + } + + // Turn some bit(s) on or off depending on the condition. + wxMSWWinLongUpdater& TurnOnOrOff(bool cond, LONG_PTR style) + { + return cond ? TurnOn(style) : TurnOff(style); + } + + // Perform the style update (only if necessary, i.e. if the style really + // changed). + // + // Notice that if this method is not called, it's still done from the dtor, + // so it's just a convenient way to do it sooner and avoid having to create + // a new scope for ensuring that the dtor runs at the right place, but + // otherwise is equivalent to do this. + bool Apply() + { + if ( m_style == m_styleCurrent ) + return false; + + ::SetWindowLongPtr(m_hwnd, m_gwlSlot, m_style); + + m_styleCurrent = m_style; + + return true; + } + + ~wxMSWWinLongUpdater() + { + Apply(); + } + +protected: + // Create the object for updating the style or extended style of the given + // window. + // + // Ctor is protected, this class can only be used as wxMSWWinStyleUpdater + // or wxMSWWinExStyleUpdater. + wxMSWWinLongUpdater(HWND hwnd, int gwlSlot) + : m_hwnd(hwnd), + m_gwlSlot(gwlSlot), + m_styleCurrent(::GetWindowLongPtr(hwnd, gwlSlot)), + m_style(m_styleCurrent) + { + } + +private: + const HWND m_hwnd; + const int m_gwlSlot; + + LONG_PTR m_styleCurrent; + LONG_PTR m_style; + + wxDECLARE_NO_COPY_CLASS(wxMSWWinLongUpdater); +}; + +// A variant of wxMSWWinLongUpdater which updates the extended style. +class wxMSWWinStyleUpdater : public wxMSWWinLongUpdater +{ +public: + explicit wxMSWWinStyleUpdater(HWND hwnd) + : wxMSWWinLongUpdater(hwnd, GWL_STYLE) + { + } +}; + +// A variant of wxMSWWinLongUpdater which updates the extended style. +class wxMSWWinExStyleUpdater : public wxMSWWinLongUpdater +{ +public: + explicit wxMSWWinExStyleUpdater(HWND hwnd) + : wxMSWWinLongUpdater(hwnd, GWL_EXSTYLE) + { + } +}; + +#endif // _WX_MSW_PRIVATE_WINSTYLE_H_ diff --git a/lib/wxWidgets/include/wx/msw/progdlg.h b/lib/wxWidgets/include/wx/msw/progdlg.h new file mode 100644 index 0000000..7e285bc --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/progdlg.h @@ -0,0 +1,88 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/progdlg.h +// Purpose: wxProgressDialog +// Author: Rickard Westerlund +// Created: 2010-07-22 +// Copyright: (c) 2010 wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PROGDLG_H_ +#define _WX_PROGDLG_H_ + +class wxProgressDialogTaskRunner; +class wxProgressDialogSharedData; + +class WXDLLIMPEXP_CORE wxProgressDialog : public wxGenericProgressDialog +{ +public: + wxProgressDialog(const wxString& title, const wxString& message, + int maximum = 100, + wxWindow *parent = NULL, + int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE); + + virtual ~wxProgressDialog(); + + virtual bool Update(int value, const wxString& newmsg = wxEmptyString, bool *skip = NULL) wxOVERRIDE; + virtual bool Pulse(const wxString& newmsg = wxEmptyString, bool *skip = NULL) wxOVERRIDE; + + virtual void Resume() wxOVERRIDE; + + virtual int GetValue() const wxOVERRIDE; + virtual wxString GetMessage() const wxOVERRIDE; + + virtual void SetRange(int maximum) wxOVERRIDE; + + // Return whether "Cancel" or "Skip" button was pressed, always return + // false if the corresponding button is not shown. + virtual bool WasSkipped() const wxOVERRIDE; + virtual bool WasCancelled() const wxOVERRIDE; + + virtual void SetTitle(const wxString& title) wxOVERRIDE; + virtual wxString GetTitle() const wxOVERRIDE; + + virtual void SetIcons(const wxIconBundle& icons) wxOVERRIDE; + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; + virtual void DoGetPosition(int *x, int *y) const wxOVERRIDE; + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; + virtual void Fit() wxOVERRIDE; + + virtual bool Show( bool show = true ) wxOVERRIDE; + + // Must provide overload to avoid hiding it (and warnings about it) + virtual void Update() wxOVERRIDE { wxGenericProgressDialog::Update(); } + + virtual WXWidget GetHandle() const wxOVERRIDE; + +private: + // Common part of Update() and Pulse(). + // + // Returns false if the user requested cancelling the dialog. + bool DoNativeBeforeUpdate(bool *skip); + + // Dispatch the pending events to let the windows to update, just as the + // generic version does. This is done as part of DoNativeBeforeUpdate(). + void DispatchEvents(); + + // Updates the various timing information for both determinate + // and indeterminate modes. Requires the shared object to have + // been entered. + void UpdateExpandedInformation(int value); + + // Get the task dialog geometry when using the native dialog. + wxRect GetTaskDialogRect() const; + + + wxProgressDialogTaskRunner *m_taskDialogRunner; + + wxProgressDialogSharedData *m_sharedData; + + // Store the message and title we currently use to be able to return it + // from Get{Message,Title}() + wxString m_message, + m_title; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxProgressDialog); +}; + +#endif // _WX_PROGDLG_H_ diff --git a/lib/wxWidgets/include/wx/msw/question.ico b/lib/wxWidgets/include/wx/msw/question.ico new file mode 100644 index 0000000..b34c3b8 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/question.ico Binary files differ diff --git a/lib/wxWidgets/include/wx/msw/radiobox.h b/lib/wxWidgets/include/wx/msw/radiobox.h new file mode 100644 index 0000000..6c46e7e --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/radiobox.h @@ -0,0 +1,186 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/radiobox.h +// Purpose: wxRadioBox class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RADIOBOX_H_ +#define _WX_RADIOBOX_H_ + +#include "wx/statbox.h" + +class WXDLLIMPEXP_FWD_CORE wxSubwindows; + +// ---------------------------------------------------------------------------- +// wxRadioBox +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxRadioBox : public wxStaticBox, public wxRadioBoxBase +{ +public: + wxRadioBox() { Init(); } + + wxRadioBox(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + int majorDim = 0, + long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioBoxNameStr)) + { + Init(); + + (void)Create(parent, id, title, pos, size, n, choices, majorDim, + style, val, name); + } + + wxRadioBox(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, + long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioBoxNameStr)) + { + Init(); + + (void)Create(parent, id, title, pos, size, choices, majorDim, + style, val, name); + } + + virtual ~wxRadioBox(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + int majorDim = 0, + long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioBoxNameStr)); + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, + long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioBoxNameStr)); + + // implement the radiobox interface + virtual void SetSelection(int n) wxOVERRIDE; + virtual int GetSelection() const wxOVERRIDE { return m_selectedButton; } + virtual unsigned int GetCount() const wxOVERRIDE; + virtual wxString GetString(unsigned int n) const wxOVERRIDE; + virtual void SetString(unsigned int n, const wxString& label) wxOVERRIDE; + virtual bool Enable(unsigned int n, bool enable = true) wxOVERRIDE; + virtual bool Show(unsigned int n, bool show = true) wxOVERRIDE; + virtual bool IsItemEnabled(unsigned int n) const wxOVERRIDE; + virtual bool IsItemShown(unsigned int n) const wxOVERRIDE; + virtual int GetItemFromPoint(const wxPoint& pt) const wxOVERRIDE; + + // override some base class methods + virtual bool Show(bool show = true) wxOVERRIDE; + virtual bool Enable(bool enable = true) wxOVERRIDE; + virtual bool CanBeFocused() const wxOVERRIDE; + virtual void SetFocus() wxOVERRIDE; + virtual bool SetFont(const wxFont& font) wxOVERRIDE; + virtual bool ContainsHWND(WXHWND hWnd) const wxOVERRIDE; + virtual bool SetForegroundColour(const wxColour& colour) wxOVERRIDE; + virtual bool SetBackgroundColour(const wxColour& colour) wxOVERRIDE; +#if wxUSE_TOOLTIPS + virtual bool HasToolTips() const wxOVERRIDE; +#endif // wxUSE_TOOLTIPS +#if wxUSE_HELP + // override virtual function with a platform-independent implementation + virtual wxString GetHelpTextAtPoint(const wxPoint & pt, wxHelpEvent::Origin origin) const wxOVERRIDE + { + return wxRadioBoxBase::DoGetHelpTextAtPoint( this, pt, origin ); + } +#endif // wxUSE_HELP + + virtual bool Reparent(wxWindowBase *newParent) wxOVERRIDE; + + // returns true if the platform should explicitly apply a theme border + virtual bool CanApplyThemeBorder() const wxOVERRIDE { return false; } + + void SetLabelFont(const wxFont& WXUNUSED(font)) {} + void SetButtonFont(const wxFont& font) { SetFont(font); } + + + // implementation only from now on + // ------------------------------- + + // This function can be used to check if the given radio button HWND + // belongs to one of our radio boxes. If it doesn't, NULL is returned. + static wxRadioBox *GetFromRadioButtonHWND(WXHWND hwnd); + + virtual bool MSWCommand(WXUINT param, WXWORD id) wxOVERRIDE; + void Command(wxCommandEvent& event) wxOVERRIDE; + + void SendNotificationEvent(); + +protected: + // common part of all ctors + void Init(); + + // subclass one radio button + void SubclassRadioButton(WXHWND hWndBtn); + + // get the max size of radio buttons + wxSize GetMaxButtonSize() const; + + // get the total size occupied by the radio box buttons + wxSize GetTotalButtonSize(const wxSize& sizeBtn) const; + + // Adjust all the buttons to the new window size. + void PositionAllButtons(int x, int y, int width, int height); + + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; + virtual wxSize DoGetBestSize() const wxOVERRIDE; + +#if wxUSE_TOOLTIPS + virtual void DoSetItemToolTip(unsigned int n, wxToolTip * tooltip) wxOVERRIDE; +#endif + + virtual WXHRGN MSWGetRegionWithoutChildren() wxOVERRIDE; + + virtual void MSWUpdateFontOnDPIChange(const wxSize& newDPI) wxOVERRIDE; + + // resolve ambiguity in base classes + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxRadioBoxBase::GetDefaultBorder(); } + + // the buttons we contain + wxSubwindows *m_radioButtons; + + // and the special dummy button used only as a tab group boundary + WXHWND m_dummyHwnd; + wxWindowIDRef m_dummyId; + + // currently selected button or wxNOT_FOUND if none + int m_selectedButton; + +private: + wxDECLARE_DYNAMIC_CLASS(wxRadioBox); + wxDECLARE_NO_COPY_CLASS(wxRadioBox); +}; + +#endif + // _WX_RADIOBOX_H_ diff --git a/lib/wxWidgets/include/wx/msw/radiobut.h b/lib/wxWidgets/include/wx/msw/radiobut.h new file mode 100644 index 0000000..765f6bc --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/radiobut.h @@ -0,0 +1,81 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/radiobut.h +// Purpose: wxRadioButton class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RADIOBUT_H_ +#define _WX_RADIOBUT_H_ + +#include "wx/msw/ownerdrawnbutton.h" + +class WXDLLIMPEXP_CORE wxRadioButton : public wxMSWOwnerDrawnButton<wxRadioButtonBase> +{ +public: + // ctors and creation functions + wxRadioButton() { Init(); } + + wxRadioButton(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioButtonNameStr)) + { + Init(); + + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioButtonNameStr)); + + // implement the radio button interface + virtual void SetValue(bool value) wxOVERRIDE; + virtual bool GetValue() const wxOVERRIDE; + + // implementation only from now on + virtual bool MSWCommand(WXUINT param, WXWORD id) wxOVERRIDE; + virtual void Command(wxCommandEvent& event) wxOVERRIDE; + + virtual bool HasTransparentBackground() wxOVERRIDE { return true; } + + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const wxOVERRIDE; + +protected: + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + // Implement wxMSWOwnerDrawnButtonBase methods. + virtual int MSWGetButtonStyle() const wxOVERRIDE; + virtual void MSWOnButtonResetOwnerDrawn() wxOVERRIDE; + virtual int MSWGetButtonCheckedFlag() const wxOVERRIDE; + virtual void + MSWDrawButtonBitmap(wxDC& dc, const wxRect& rect, int flags) wxOVERRIDE; + + +private: + // common part of all ctors + void Init(); + + + // we need to store the state internally as the result of GetValue() + // sometimes gets out of sync in WM_COMMAND handler + bool m_isChecked; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxRadioButton); +}; + +#endif // _WX_RADIOBUT_H_ diff --git a/lib/wxWidgets/include/wx/msw/rcdefs.h b/lib/wxWidgets/include/wx/msw/rcdefs.h new file mode 100644 index 0000000..ead5ec2 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/rcdefs.h @@ -0,0 +1,49 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/rcdefs.h +// Purpose: Fallback for the generated rcdefs.h under the lib directory +// Author: Mike Wetherell +// Copyright: (c) 2005 Mike Wetherell +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RCDEFS_H +#define _WX_RCDEFS_H + +#ifdef __GNUC__ + // We must be using windres which uses gcc as its preprocessor. We do need + // to generate the manifest then as gcc doesn't do it automatically and we + // can define the architecture macro on our own as all the usual symbols + // are available (unlike with Microsoft RC.EXE which doesn't predefine + // anything useful at all). + #ifndef wxUSE_RC_MANIFEST + #define wxUSE_RC_MANIFEST 1 + #endif + + #if defined __i386__ + #ifndef WX_CPU_X86 + #define WX_CPU_X86 + #endif + #elif defined __x86_64__ + #ifndef WX_CPU_AMD64 + #define WX_CPU_AMD64 + #endif + #elif defined __ia64__ + #ifndef WX_CPU_IA64 + #define WX_CPU_IA64 + #endif + #elif defined __arm__ + #ifndef WX_CPU_ARM + #define WX_CPU_ARM + #endif + #elif defined __aarch64__ + #ifndef WX_CPU_ARM64 + #define WX_CPU_ARM64 + #endif + #endif +#endif + +// Don't do anything here for the other compilers, in particular don't define +// WX_CPU_X86 here as we used to do. If people define wxUSE_RC_MANIFEST, they +// must also define the architecture constant correctly. + +#endif diff --git a/lib/wxWidgets/include/wx/msw/regconf.h b/lib/wxWidgets/include/wx/msw/regconf.h new file mode 100644 index 0000000..6c7c0a9 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/regconf.h @@ -0,0 +1,126 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/regconf.h +// Purpose: Registry based implementation of wxConfigBase +// Author: Vadim Zeitlin +// Modified by: +// Created: 27.04.98 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_REGCONF_H_ +#define _WX_MSW_REGCONF_H_ + +#include "wx/defs.h" + +#if wxUSE_CONFIG && wxUSE_REGKEY + +#include "wx/msw/registry.h" +#include "wx/object.h" +#include "wx/confbase.h" +#include "wx/buffer.h" + +// ---------------------------------------------------------------------------- +// wxRegConfig +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxRegConfig : public wxConfigBase +{ +public: + // ctor & dtor + // will store data in HKLM\appName and HKCU\appName + wxRegConfig(const wxString& appName = wxEmptyString, + const wxString& vendorName = wxEmptyString, + const wxString& localFilename = wxEmptyString, + const wxString& globalFilename = wxEmptyString, + long style = wxCONFIG_USE_GLOBAL_FILE); + + // dtor will save unsaved data + virtual ~wxRegConfig(){} + + // implement inherited pure virtual functions + // ------------------------------------------ + + // path management + virtual void SetPath(const wxString& strPath) wxOVERRIDE; + virtual const wxString& GetPath() const wxOVERRIDE { return m_strPath; } + + // entry/subgroup info + // enumerate all of them + virtual bool GetFirstGroup(wxString& str, long& lIndex) const wxOVERRIDE; + virtual bool GetNextGroup (wxString& str, long& lIndex) const wxOVERRIDE; + virtual bool GetFirstEntry(wxString& str, long& lIndex) const wxOVERRIDE; + virtual bool GetNextEntry (wxString& str, long& lIndex) const wxOVERRIDE; + + // tests for existence + virtual bool HasGroup(const wxString& strName) const wxOVERRIDE; + virtual bool HasEntry(const wxString& strName) const wxOVERRIDE; + virtual EntryType GetEntryType(const wxString& name) const wxOVERRIDE; + + // get number of entries/subgroups in the current group, with or without + // it's subgroups + virtual size_t GetNumberOfEntries(bool bRecursive = false) const wxOVERRIDE; + virtual size_t GetNumberOfGroups(bool bRecursive = false) const wxOVERRIDE; + + virtual bool Flush(bool WXUNUSED(bCurrentOnly) = false) wxOVERRIDE { return true; } + + // rename + virtual bool RenameEntry(const wxString& oldName, const wxString& newName) wxOVERRIDE; + virtual bool RenameGroup(const wxString& oldName, const wxString& newName) wxOVERRIDE; + + // delete + virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = true) wxOVERRIDE; + virtual bool DeleteGroup(const wxString& key) wxOVERRIDE; + virtual bool DeleteAll() wxOVERRIDE; + +protected: + // opens the local key creating it if necessary and returns it + wxRegKey& LocalKey() const // must be const to be callable from const funcs + { + wxRegConfig* self = wxConstCast(this, wxRegConfig); + + if ( !m_keyLocal.IsOpened() ) + { + // create on demand + self->m_keyLocal.Create(); + } + + return self->m_keyLocal; + } + + // Type-independent implementation of Do{Read,Write}Foo(). + template <typename T> + bool DoReadValue(const wxString& key, T* pValue) const; + template <typename T> + bool DoWriteValue(const wxString& key, const T& value); + + // implement read/write methods + virtual bool DoReadString(const wxString& key, wxString *pStr) const wxOVERRIDE; + virtual bool DoReadLong(const wxString& key, long *plResult) const wxOVERRIDE; + virtual bool DoReadLongLong(const wxString& key, wxLongLong_t *pll) const wxOVERRIDE; +#if wxUSE_BASE64 + virtual bool DoReadBinary(const wxString& key, wxMemoryBuffer* buf) const wxOVERRIDE; +#endif // wxUSE_BASE64 + + virtual bool DoWriteString(const wxString& key, const wxString& szValue) wxOVERRIDE; + virtual bool DoWriteLong(const wxString& key, long lValue) wxOVERRIDE; + virtual bool DoWriteLongLong(const wxString& key, wxLongLong_t llValue) wxOVERRIDE; +#if wxUSE_BASE64 + virtual bool DoWriteBinary(const wxString& key, const wxMemoryBuffer& buf) wxOVERRIDE; +#endif // wxUSE_BASE64 + +private: + // these keys are opened during all lifetime of wxRegConfig object + wxRegKey m_keyLocalRoot, m_keyLocal, + m_keyGlobalRoot, m_keyGlobal; + + // current path (not '/' terminated) + wxString m_strPath; + + wxDECLARE_NO_COPY_CLASS(wxRegConfig); + wxDECLARE_ABSTRACT_CLASS(wxRegConfig); +}; + +#endif // wxUSE_CONFIG && wxUSE_REGKEY + +#endif // _WX_MSW_REGCONF_H_ diff --git a/lib/wxWidgets/include/wx/msw/region.h b/lib/wxWidgets/include/wx/msw/region.h new file mode 100644 index 0000000..ff99698 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/region.h @@ -0,0 +1,103 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/region.h +// Purpose: wxRegion class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) 1997-2002 wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_REGION_H_ +#define _WX_MSW_REGION_H_ + +class WXDLLIMPEXP_CORE wxRegion : public wxRegionWithCombine +{ +public: + wxRegion(); + wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h); + wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight); + wxRegion(const wxRect& rect); + wxRegion(WXHRGN hRegion); // Hangs on to this region + wxRegion(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE ); +#if wxUSE_IMAGE + wxRegion( const wxBitmap& bmp) + { + Union(bmp); + } + wxRegion( const wxBitmap& bmp, + const wxColour& transColour, int tolerance = 0) + { + Union(bmp, transColour, tolerance); + } +#endif // wxUSE_IMAGE + + virtual ~wxRegion(); + + // wxRegionBase methods + virtual void Clear() wxOVERRIDE; + virtual bool IsEmpty() const wxOVERRIDE; + + // Get internal region handle + WXHRGN GetHRGN() const; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + + virtual bool DoIsEqual(const wxRegion& region) const wxOVERRIDE; + virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const wxOVERRIDE; + virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const wxOVERRIDE; + virtual wxRegionContain DoContainsRect(const wxRect& rect) const wxOVERRIDE; + + virtual bool DoOffset(wxCoord x, wxCoord y) wxOVERRIDE; + virtual bool DoCombine(const wxRegion& region, wxRegionOp op) wxOVERRIDE; + + friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator; + + wxDECLARE_DYNAMIC_CLASS(wxRegion); +}; + +class WXDLLIMPEXP_CORE wxRegionIterator : public wxObject +{ +public: + wxRegionIterator() { Init(); } + wxRegionIterator(const wxRegion& region); + wxRegionIterator(const wxRegionIterator& ri) : wxObject(ri) { Init(); *this = ri; } + + wxRegionIterator& operator=(const wxRegionIterator& ri); + + virtual ~wxRegionIterator(); + + void Reset() { m_current = 0; } + void Reset(const wxRegion& region); + + bool HaveRects() const { return (m_current < m_numRects); } + + operator bool () const { return HaveRects(); } + + wxRegionIterator& operator++(); + wxRegionIterator operator++(int); + + wxCoord GetX() const; + wxCoord GetY() const; + wxCoord GetW() const; + wxCoord GetWidth() const { return GetW(); } + wxCoord GetH() const; + wxCoord GetHeight() const { return GetH(); } + + wxRect GetRect() const { return wxRect(GetX(), GetY(), GetW(), GetH()); } + +private: + // common part of all ctors + void Init(); + + long m_current; + long m_numRects; + wxRegion m_region; + wxRect* m_rects; + + wxDECLARE_DYNAMIC_CLASS(wxRegionIterator); +}; + +#endif // _WX_MSW_REGION_H_ diff --git a/lib/wxWidgets/include/wx/msw/registry.h b/lib/wxWidgets/include/wx/msw/registry.h new file mode 100644 index 0000000..482f49f --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/registry.h @@ -0,0 +1,280 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/registry.h +// Purpose: Registry classes and functions +// Author: Vadim Zeitlin +// Modified by: +// Created: 03.04.1998 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_REGISTRY_H_ +#define _WX_MSW_REGISTRY_H_ + +#include "wx/defs.h" + +#if wxUSE_REGKEY + +class WXDLLIMPEXP_FWD_BASE wxOutputStream; + +// ---------------------------------------------------------------------------- +// class wxRegKey encapsulates window HKEY handle +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxRegKey +{ +public: + // NB: do _not_ change the values of elements in these enumerations! + + // registry value types (with comments from winnt.h) + enum ValueType + { + Type_None, // No value type + Type_String, // Unicode nul terminated string + Type_Expand_String, // Unicode nul terminated string + // (with environment variable references) + Type_Binary, // Free form binary + Type_Dword, // 32-bit number + Type_Dword_little_endian // 32-bit number + = Type_Dword, // (same as Type_DWORD) + Type_Dword_big_endian, // 32-bit number + Type_Link, // Symbolic Link (unicode) + Type_Multi_String, // Multiple Unicode strings + Type_Resource_list, // Resource list in the resource map + Type_Full_resource_descriptor, // Resource list in the hardware description + Type_Resource_requirements_list, // ??? + Type_Qword // 64-bit number + }; + + // predefined registry keys + enum StdKey + { + HKCR, // classes root + HKCU, // current user + HKLM, // local machine + HKUSR, // users + HKPD, // (obsolete under XP and later) + HKCC, // current config + HKDD, // (obsolete under XP and later) + HKMAX + }; + + // access mode for the key + enum AccessMode + { + Read, // read-only + Write // read and write + }; + + // Different registry views supported under WOW64. + enum WOW64ViewMode + { + // 32 bit registry for 32 bit applications, 64 bit registry + // for 64 bit ones. + WOW64ViewMode_Default, + + // Can be used in 64 bit apps to access 32 bit registry, + // has no effect (i.e. treated as default) in 32 bit apps. + WOW64ViewMode_32, + + // Can be used in 32 bit apps to access 64 bit registry, + // has no effect (i.e. treated as default) in 64 bit apps. + WOW64ViewMode_64 + }; + + // information about standard (predefined) registry keys + // number of standard keys + static const size_t nStdKeys; + // get the name of a standard key + static const wxChar *GetStdKeyName(size_t key); + // get the short name of a standard key + static const wxChar *GetStdKeyShortName(size_t key); + // get StdKey from root HKEY + static StdKey GetStdKeyFromHkey(WXHKEY hkey); + + // extracts the std key prefix from the string (return value) and + // leaves only the part after it (i.e. modifies the string passed!) + static StdKey ExtractKeyName(wxString& str); + + // ctors + // root key is set to HKCR (the only root key under Win16) + wxRegKey(WOW64ViewMode viewMode = WOW64ViewMode_Default); + + // strKey is the full name of the key (i.e. starting with HKEY_xxx...) + wxRegKey(const wxString& strKey, + WOW64ViewMode viewMode = WOW64ViewMode_Default); + + // strKey is the name of key under (standard key) keyParent + wxRegKey(StdKey keyParent, + const wxString& strKey, + WOW64ViewMode viewMode = WOW64ViewMode_Default); + + // strKey is the name of key under (previously created) keyParent + wxRegKey(const wxRegKey& keyParent, const wxString& strKey); + // dtor closes the key + ~wxRegKey(); + + // change key (closes the previously opened key if any) + // the name is absolute, i.e. should start with HKEY_xxx + void SetName(const wxString& strKey); + // the name is relative to the parent key + void SetName(StdKey keyParent, const wxString& strKey); + // the name is relative to the parent key + void SetName(const wxRegKey& keyParent, const wxString& strKey); + // hKey should be opened and will be closed in wxRegKey dtor + void SetHkey(WXHKEY hKey); + + // get information about the key + // get the (full) key name. Abbreviate std root keys if bShortPrefix. + wxString GetName(bool bShortPrefix = true) const; + // Retrieves the registry view used by this key. + WOW64ViewMode GetView() const { return m_viewMode; } + // return true if the key exists + bool Exists() const; + // get the info about key (any number of these pointers may be NULL) + bool GetKeyInfo(size_t *pnSubKeys, // number of subkeys + size_t *pnMaxKeyLen, // max length of subkey name + size_t *pnValues, // number of values + size_t *pnMaxValueLen) const; + // return true if the key is opened + bool IsOpened() const { return m_hKey != NULL; } + // for "if ( !key ) wxLogError(...)" kind of expressions + operator bool() const { return m_dwLastError == 0; } + + // operations on the key itself + // explicitly open the key (will be automatically done by all functions + // which need the key to be opened if the key is not opened yet) + bool Open(AccessMode mode = Write); + // create the key: will fail if the key already exists and !bOkIfExists + bool Create(bool bOkIfExists = true); + // rename a value from old name to new one + bool RenameValue(const wxString& szValueOld, const wxString& szValueNew); + // rename the key + bool Rename(const wxString& szNewName); + // copy value to another key possibly changing its name (by default it will + // remain the same) + bool CopyValue(const wxString& szValue, wxRegKey& keyDst, + const wxString& szNewName = wxEmptyString); + + // copy the entire contents of the key recursively to another location + bool Copy(const wxString& szNewName); + // same as Copy() but using a key and not the name + bool Copy(wxRegKey& keyDst); + // close the key (will be automatically done in dtor) + bool Close(); + + // deleting keys/values + // deletes this key and all of it's subkeys/values + bool DeleteSelf(); + // deletes the subkey with all of it's subkeys/values recursively + bool DeleteKey(const wxString& szKey); + // deletes the named value (may be empty string to remove the default value) + bool DeleteValue(const wxString& szValue); + + // access to values and subkeys + // get value type + ValueType GetValueType(const wxString& szValue) const; + // returns true if the value contains a number (else it's some string) + bool IsNumericValue(const wxString& szValue) const; + + // assignment operators set the default value of the key + wxRegKey& operator=(const wxString& strValue) + { SetValue(wxEmptyString, strValue); return *this; } + + // query the default value of the key: implicitly or explicitly + wxString QueryDefaultValue() const; + operator wxString() const { return QueryDefaultValue(); } + + // named values + + // set the string value + bool SetValue(const wxString& szValue, const wxString& strValue); + // retrieve the string value + bool QueryValue(const wxString& szValue, wxString& strValue) const + { return QueryValue(szValue, strValue, false); } + // retrieve raw string value + bool QueryRawValue(const wxString& szValue, wxString& strValue) const + { return QueryValue(szValue, strValue, true); } + // retrieve either raw or expanded string value + bool QueryValue(const wxString& szValue, wxString& strValue, bool raw) const; + + // set the 32-bit numeric value + bool SetValue(const wxString& szValue, long lValue); + // return the 32-bit numeric value + bool QueryValue(const wxString& szValue, long *plValue) const; + // set the 64-bit numeric value + bool SetValue64(const wxString& szValue, wxLongLong_t llValue); + // return the 64-bit numeric value + bool QueryValue64(const wxString& szValue, wxLongLong_t *pllValue) const; + // set the binary value + bool SetValue(const wxString& szValue, const wxMemoryBuffer& buf); + // return the binary value + bool QueryValue(const wxString& szValue, wxMemoryBuffer& buf) const; + + // query existence of a key/value + // return true if value exists + bool HasValue(const wxString& szKey) const; + // return true if given subkey exists + bool HasSubKey(const wxString& szKey) const; + // return true if any subkeys exist + bool HasSubkeys() const; + // return true if any values exist + bool HasValues() const; + // return true if the key is empty (nothing under this key) + bool IsEmpty() const { return !HasSubkeys() && !HasValues(); } + + // enumerate values and subkeys + bool GetFirstValue(wxString& strValueName, long& lIndex); + bool GetNextValue (wxString& strValueName, long& lIndex) const; + + bool GetFirstKey (wxString& strKeyName , long& lIndex); + bool GetNextKey (wxString& strKeyName , long& lIndex) const; + + // export the contents of this key and all its subkeys to the given file + // (which won't be overwritten, it's an error if it already exists) + // + // note that we export the key in REGEDIT4 format, not RegSaveKey() binary + // format nor newer REGEDIT5 one + bool Export(const wxString& filename) const; + + // same as above but write to the given (opened) stream + bool Export(wxOutputStream& ostr) const; + + + // for wxRegConfig usage only: preallocate some memory for the name + void ReserveMemoryForName(size_t bytes) { m_strKey.reserve(bytes); } + +private: + // common part of all ctors + void Init() + { + m_hKey = (WXHKEY) NULL; + m_dwLastError = 0; + } + + // recursive helper for Export() + bool DoExport(wxOutputStream& ostr) const; + + // export a single value + bool DoExportValue(wxOutputStream& ostr, const wxString& name) const; + + // return the text representation (in REGEDIT4 format) of the value with the + // given name + wxString FormatValue(const wxString& name) const; + + + WXHKEY m_hKey, // our handle + m_hRootKey; // handle of the top key (i.e. StdKey) + wxString m_strKey; // key name (relative to m_hRootKey) + WOW64ViewMode m_viewMode; // which view to select under WOW64 + AccessMode m_mode; // valid only if key is opened + mutable long m_dwLastError; // last error (0 if none) + + + wxDECLARE_NO_COPY_CLASS(wxRegKey); +}; + +#endif // wxUSE_REGKEY + +#endif // _WX_MSW_REGISTRY_H_ + diff --git a/lib/wxWidgets/include/wx/msw/removble.ico b/lib/wxWidgets/include/wx/msw/removble.ico new file mode 100644 index 0000000..f218a89 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/removble.ico Binary files differ diff --git a/lib/wxWidgets/include/wx/msw/richmsgdlg.h b/lib/wxWidgets/include/wx/msw/richmsgdlg.h new file mode 100644 index 0000000..2e24328 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/richmsgdlg.h @@ -0,0 +1,30 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/richmsgdlg.h +// Purpose: wxRichMessageDialog +// Author: Rickard Westerlund +// Created: 2010-07-04 +// Copyright: (c) 2010 wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_RICHMSGDLG_H_ +#define _WX_MSW_RICHMSGDLG_H_ + +class WXDLLIMPEXP_CORE wxRichMessageDialog : public wxGenericRichMessageDialog +{ +public: + wxRichMessageDialog(wxWindow *parent, + const wxString& message, + const wxString& caption = wxASCII_STR(wxMessageBoxCaptionStr), + long style = wxOK | wxCENTRE) + : wxGenericRichMessageDialog(parent, message, caption, style) + { } + + // overridden base class method showing the native task dialog if possible + virtual int ShowModal() wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxRichMessageDialog); +}; + +#endif // _WX_MSW_RICHMSGDLG_H_ diff --git a/lib/wxWidgets/include/wx/msw/roller.cur b/lib/wxWidgets/include/wx/msw/roller.cur new file mode 100644 index 0000000..118c37f --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/roller.cur Binary files differ diff --git a/lib/wxWidgets/include/wx/msw/rt/private/notifmsg.h b/lib/wxWidgets/include/wx/msw/rt/private/notifmsg.h new file mode 100644 index 0000000..018218e --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/rt/private/notifmsg.h @@ -0,0 +1,26 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/rt/private/notifmsg.h +// Purpose: WinRT implementation of wxNotificationMessageImpl +// Author: Tobias Taschner +// Created: 2015-09-13 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// +#ifndef _WX_MSW_RT_PRIVATE_NOTIFMSG_H_ +#define _WX_MSW_RT_PRIVATE_NOTIFMSG_H_ + +#include "wx/notifmsg.h" +#include "wx/private/notifmsg.h" + +class wxToastNotificationHelper +{ +public: + static bool UseToasts(const wxString& shortcutPath, + const wxString& appId); + + static bool IsEnabled(); + + static wxNotificationMessageImpl* CreateInstance(wxNotificationMessageBase* notification); +}; + +#endif // _WX_MSW_RT_PRIVATE_NOTIFMSG_H_ diff --git a/lib/wxWidgets/include/wx/msw/rt/utils.h b/lib/wxWidgets/include/wx/msw/rt/utils.h new file mode 100644 index 0000000..14186a8 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/rt/utils.h @@ -0,0 +1,82 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/rt/utils.h +// Purpose: Windows Runtime Objects helper functions and objects +// Author: Tobias Taschner +// Created: 2015-09-05 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_RTUTILS_H +#define _WX_MSW_RTUTILS_H + +#include "wx/defs.h" + +#if wxUSE_WINRT + +#include "wx/string.h" +#include "wx/msw/wrapwin.h" + +#include <winstring.h> + +namespace wxWinRT +{ + +bool WXDLLIMPEXP_CORE IsAvailable(); + +bool WXDLLIMPEXP_CORE Initialize(); + +void WXDLLIMPEXP_CORE Uninitialize(); + +HRESULT WXDLLIMPEXP_CORE GetActivationFactory(const wxString& activatableClassId, REFIID iid, void ** factory); + +// RAII class initializing WinRT in its ctor and undoing it in its dtor. +class WXDLLIMPEXP_CORE Initializer +{ +public: + Initializer() + : m_ok(Initialize()) + { + } + + bool IsOk() const + { + return m_ok; + } + + ~Initializer() + { + if (m_ok) + Uninitialize(); + } + +private: + const bool m_ok; + + wxDECLARE_NO_COPY_CLASS(Initializer); +}; + +// Simple class to convert wxString to HSTRING +// This just wraps a reference to the wxString object, +// which needs a life time greater than the TempStringRef object +class WXDLLIMPEXP_CORE TempStringRef +{ +public: + HSTRING Get() const { return m_hstring; } + + operator HSTRING() const { return m_hstring; }; + + TempStringRef(const wxString& str); + +private: + HSTRING m_hstring; + HSTRING_HEADER m_header; + + wxDECLARE_NO_COPY_CLASS(TempStringRef); +}; + +} // namespace wxWinRT + +#endif // wxUSE_WINRT + +#endif // _WX_MSW_RTUTILS_H diff --git a/lib/wxWidgets/include/wx/msw/scrolbar.h b/lib/wxWidgets/include/wx/msw/scrolbar.h new file mode 100644 index 0000000..2e8c9af --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/scrolbar.h @@ -0,0 +1,74 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/scrolbar.h +// Purpose: wxScrollBar class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SCROLBAR_H_ +#define _WX_SCROLBAR_H_ + +// Scrollbar item +class WXDLLIMPEXP_CORE wxScrollBar: public wxScrollBarBase +{ +public: + wxScrollBar() { m_pageSize = 0; m_viewSize = 0; m_objectSize = 0; } + virtual ~wxScrollBar(); + + wxScrollBar(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSB_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxScrollBarNameStr)) + { + Create(parent, id, pos, size, style, validator, name); + } + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSB_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxScrollBarNameStr)); + + int GetThumbPosition() const wxOVERRIDE; + int GetThumbSize() const wxOVERRIDE { return m_pageSize; } + int GetPageSize() const wxOVERRIDE { return m_viewSize; } + int GetRange() const wxOVERRIDE { return m_objectSize; } + + virtual void SetThumbPosition(int viewStart) wxOVERRIDE; + virtual void SetScrollbar(int position, int thumbSize, int range, int pageSize, + bool refresh = true) wxOVERRIDE; + + // needed for RTTI + void SetThumbSize( int s ) { SetScrollbar( GetThumbPosition() , s , GetRange() , GetPageSize() , true ) ; } + void SetPageSize( int s ) { SetScrollbar( GetThumbPosition() , GetThumbSize() , GetRange() , s , true ) ; } + void SetRange( int s ) { SetScrollbar( GetThumbPosition() , GetThumbSize() , s , GetPageSize() , true ) ; } + + void Command(wxCommandEvent& event) wxOVERRIDE; + virtual bool MSWOnScroll(int orientation, WXWORD wParam, + WXWORD pos, WXHWND control) wxOVERRIDE; + + // override wxControl version to not use solid background here + virtual WXHBRUSH MSWControlColor(WXHDC pDC, WXHWND hWnd) wxOVERRIDE; + + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const wxOVERRIDE; + + // returns true if the platform should explicitly apply a theme border + virtual bool CanApplyThemeBorder() const wxOVERRIDE { return false; } + +protected: + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + int m_pageSize; + int m_viewSize; + int m_objectSize; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxScrollBar); +}; + +#endif + // _WX_SCROLBAR_H_ diff --git a/lib/wxWidgets/include/wx/msw/seh.h b/lib/wxWidgets/include/wx/msw/seh.h new file mode 100644 index 0000000..3d22486 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/seh.h @@ -0,0 +1,67 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/seh.h +// Purpose: declarations for SEH (structured exceptions handling) support +// Author: Vadim Zeitlin +// Created: 2006-04-26 +// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_SEH_H_ +#define _WX_MSW_SEH_H_ + +#if wxUSE_ON_FATAL_EXCEPTION + + // the exception handler which should be called from the exception filter + // + // it calls wxApp::OnFatalException() if wxTheApp object exists + WXDLLIMPEXP_BASE unsigned long wxGlobalSEHandler(EXCEPTION_POINTERS *pExcPtrs); + + // helper macro for wxSEH_HANDLE + #define wxSEH_DUMMY_RETURN(rc) + + // macros which allow to avoid many #if wxUSE_ON_FATAL_EXCEPTION in the code + // which uses them + #define wxSEH_TRY __try + #define wxSEH_IGNORE __except ( EXCEPTION_EXECUTE_HANDLER ) { } + #define wxSEH_HANDLE(rc) \ + __except ( wxGlobalSEHandler(GetExceptionInformation()) ) \ + { \ + /* use the same exit code as abort() */ \ + ::ExitProcess(3); \ + \ + wxSEH_DUMMY_RETURN(rc) \ + } + +#else // wxUSE_ON_FATAL_EXCEPTION + #define wxSEH_TRY + #define wxSEH_IGNORE + #define wxSEH_HANDLE(rc) +#endif // wxUSE_ON_FATAL_EXCEPTION + +#if wxUSE_ON_FATAL_EXCEPTION && defined(__VISUALC__) + #include <eh.h> + + // C++ exception to structured exceptions translator: we need it in order + // to prevent VC++ from "helpfully" translating structured exceptions (such + // as division by 0 or access violation) to C++ pseudo-exceptions + extern void wxSETranslator(unsigned int code, EXCEPTION_POINTERS *ep); + + // This warning ("calling _set_se_translator() requires /EHa") seems to be + // harmless with all the supported MSVC versions (up to 14.2, a.k.a. MSVS + // 2019), i.e. SEH translator seems to work just fine without /EHa too, so + // suppress it here as it's easier to suppress it than deal with it at + // make/ project files level. + #if __VISUALC__ < 2000 + #pragma warning(disable: 4535) + #endif + + // note that the SE translator must be called wxSETranslator! + #define DisableAutomaticSETranslator() _set_se_translator(wxSETranslator) +#else // !__VISUALC__ + // the other compilers do nothing as stupid by default so nothing to do for + // them + #define DisableAutomaticSETranslator() +#endif // __VISUALC__/!__VISUALC__ + +#endif // _WX_MSW_SEH_H_ diff --git a/lib/wxWidgets/include/wx/msw/setup.h b/lib/wxWidgets/include/wx/msw/setup.h new file mode 100644 index 0000000..b1d20d9 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/setup.h @@ -0,0 +1,1836 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/setup.h +// Purpose: Configuration for the library +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SETUP_H_ +#define _WX_SETUP_H_ + +/* --- start common options --- */ +// ---------------------------------------------------------------------------- +// global settings +// ---------------------------------------------------------------------------- + +// define this to 0 when building wxBase library - this can also be done from +// makefile/project file overriding the value here +#ifndef wxUSE_GUI + #define wxUSE_GUI 1 +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// compatibility settings +// ---------------------------------------------------------------------------- + +// This setting determines the compatibility with 2.8 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_8 0 + +// This setting determines the compatibility with 3.0 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_3_0 1 + +// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when +// default system font is used for wxWindow::GetCharWidth/Height() instead of +// the current font. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxDIALOG_UNIT_COMPATIBILITY 0 + +// Provide unsafe implicit conversions in wxString to "const char*" or +// "std::string" (depending on wxUSE_STD_STRING_CONV_IN_WXSTRING value). +// +// Default is 1 but only for compatibility reasons, it is recommended to set +// this to 0 because converting wxString to a narrow (non-Unicode) string may +// fail unless a locale using UTF-8 encoding is used, which is never the case +// under MSW, for example, hence such conversions can result in silent data +// loss. +// +// Recommended setting: 0 +#define wxUSE_UNSAFE_WXSTRING_CONV 1 + +// If set to 1, enables "reproducible builds", i.e. build output should be +// exactly the same if the same build is redone again. As using __DATE__ and +// __TIME__ macros clearly makes the build irreproducible, setting this option +// to 1 disables their use in the library code. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_REPRODUCIBLE_BUILD 0 + +// ---------------------------------------------------------------------------- +// debugging settings +// ---------------------------------------------------------------------------- + +// wxDEBUG_LEVEL will be defined as 1 in wx/debug.h so normally there is no +// need to define it here. You may do it for two reasons: either completely +// disable/compile out the asserts in release version (then do it inside #ifdef +// NDEBUG) or, on the contrary, enable more asserts, including the usually +// disabled ones, in the debug build (then do it inside #ifndef NDEBUG) +// +// #ifdef NDEBUG +// #define wxDEBUG_LEVEL 0 +// #else +// #define wxDEBUG_LEVEL 2 +// #endif + +// wxHandleFatalExceptions() may be used to catch the program faults at run +// time and, instead of terminating the program with a usual GPF message box, +// call the user-defined wxApp::OnFatalException() function. If you set +// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. +// +// This setting is for Win32 only and can only be enabled if your compiler +// supports Win32 structured exception handling (currently only VC++ does) +// +// Default is 1 +// +// Recommended setting: 1 if your compiler supports it. +#define wxUSE_ON_FATAL_EXCEPTION 1 + +// Set this to 1 to be able to generate a human-readable (unlike +// machine-readable minidump created by wxCrashReport::Generate()) stack back +// trace when your program crashes using wxStackWalker +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_STACKWALKER 1 + +// Set this to 1 to compile in wxDebugReport class which allows you to create +// and optionally upload to your web site a debug report consisting of back +// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, it is compiled into a separate library so there +// is no overhead if you don't use it +#define wxUSE_DEBUGREPORT 1 + +// Generic comment about debugging settings: they are very useful if you don't +// use any other memory leak detection tools such as Purify/BoundsChecker, but +// are probably redundant otherwise. Also, Visual C++ CRT has the same features +// as wxWidgets memory debugging subsystem built in since version 5.0 and you +// may prefer to use it instead of built in memory debugging code because it is +// faster and more fool proof. +// +// Using VC++ CRT memory debugging is enabled by default in debug build (_DEBUG +// is defined) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) +// and if __NO_VC_CRTDBG__ is not defined. + +// The rest of the options in this section are obsolete and not supported, +// enable them at your own risk. + +// If 1, enables wxDebugContext, for writing error messages to file, etc. If +// __WXDEBUG__ is not defined, will still use the normal memory operators. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_CONTEXT 0 + +// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* +// __WXDEBUG__ is also defined. +// +// WARNING: this code may not work with all architectures, especially if +// alignment is an issue. This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 1 if you are not using a memory debugging tool, else 0 +#define wxUSE_MEMORY_TRACING 0 + +// In debug mode, cause new and delete to be redefined globally. +// If this causes problems (e.g. link errors which is a common problem +// especially if you use another library which also redefines the global new +// and delete), set this to 0. +// This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If +// this causes problems (e.g. link errors), set this to 0. You may need to set +// this to 0 if using templates (at least for VC++). This switch is currently +// ignored for MinGW/Cygwin. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_NEW_ALWAYS 0 + + +// ---------------------------------------------------------------------------- +// Unicode support +// ---------------------------------------------------------------------------- + +// This option is deprecated: the library should be always built in Unicode mode +// now, only set wxUSE_UNICODE to 0 to compile legacy code in ANSI mode if +// absolutely necessary -- updating it is strongly recommended as the ANSI mode +// will disappear completely in future wxWidgets releases. +#ifndef wxUSE_UNICODE + #define wxUSE_UNICODE 1 +#endif + +// ---------------------------------------------------------------------------- +// global features +// ---------------------------------------------------------------------------- + +// Compile library in exception-safe mode? If set to 1, the library will try to +// behave correctly in presence of exceptions (even though it still will not +// use the exceptions itself) and notify the user code about any unhandled +// exceptions. If set to 0, propagation of the exceptions through the library +// code will lead to undefined behaviour -- but the code itself will be +// slightly smaller and faster. +// +// Note that like wxUSE_THREADS this option is automatically set to 0 if +// wxNO_EXCEPTIONS is defined. +// +// Default is 1 +// +// Recommended setting: depends on whether you intend to use C++ exceptions +// in your own code (1 if you do, 0 if you don't) +#define wxUSE_EXCEPTIONS 1 + +// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI +// +// This feature is incomplete and experimental, please only enable it if +// you want to participate in its development. +// +// Recommended setting: 0 (unless you wish to try working on it). +#define wxUSE_EXTENDED_RTTI 0 + +// Support for message/error logging. This includes wxLogXXX() functions and +// wxLog and derived classes. Don't set this to 0 unless you really know what +// you are doing. +// +// Default is 1 +// +// Recommended setting: 1 (always) +#define wxUSE_LOG 1 + +// Recommended setting: 1 +#define wxUSE_LOGWINDOW 1 + +// Recommended setting: 1 +#define wxUSE_LOGGUI 1 + +// Recommended setting: 1 +#define wxUSE_LOG_DIALOG 1 + +// Support for command line parsing using wxCmdLineParser class. +// +// Default is 1 +// +// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) +#define wxUSE_CMDLINE_PARSER 1 + +// Support for multithreaded applications: if 1, compile in thread classes +// (thread.h) and make the library a bit more thread safe. Although thread +// support is quite stable by now, you may still consider recompiling the +// library without it if you have no use for it - this will result in a +// somewhat smaller and faster operation. +// +// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset +// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in +// build/msw/config.* file this value will have no effect. +// +// Default is 1 +// +// Recommended setting: 0 unless you do plan to develop MT applications +#define wxUSE_THREADS 1 + +// If enabled, compiles wxWidgets streams classes +// +// wx stream classes are used for image IO, process IO redirection, network +// protocols implementation and much more and so disabling this results in a +// lot of other functionality being lost. +// +// Default is 1 +// +// Recommended setting: 1 as setting it to 0 disables many other things +#define wxUSE_STREAMS 1 + +// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. +// Note that if the system's implementation does not support positional +// parameters, setting this to 1 forces the use of the wxWidgets implementation +// of wxVsnprintf. The standard vsnprintf() supports positional parameters on +// many Unix systems but usually doesn't under Windows. +// +// Positional parameters are very useful when translating a program since using +// them in formatting strings allow translators to correctly reorder the +// translated sentences. +// +// Default is 1 +// +// Recommended setting: 1 if you want to support multiple languages +#define wxUSE_PRINTF_POS_PARAMS 1 + +// Enable the use of compiler-specific thread local storage keyword, if any. +// This is used for wxTLS_XXX() macros implementation and normally should use +// the compiler-provided support as it's simpler and more efficient, but is +// disabled under Windows in wx/msw/chkconf.h as it can't be used if wxWidgets +// is used in a dynamically loaded Win32 DLL (i.e. using LoadLibrary()) under +// XP as this triggers a bug in compiler TLS support that results in crashes +// when any TLS variables are used. +// +// If you're absolutely sure that your build of wxWidgets is never going to be +// used in such situation, either because it's not going to be linked from any +// kind of plugin or because you only target Vista or later systems, you can +// set this to 2 to force the use of compiler TLS even under MSW. +// +// Default is 1 meaning that compiler TLS is used only if it's 100% safe. +// +// Recommended setting: 2 if you want to have maximal performance and don't +// care about the scenario described above. +#define wxUSE_COMPILER_TLS 1 + +// ---------------------------------------------------------------------------- +// Interoperability with the standard library. +// ---------------------------------------------------------------------------- + +// Set wxUSE_STL to 1 to enable maximal interoperability with the standard +// library, even at the cost of backwards compatibility. +// +// Default is 0 +// +// Recommended setting: 0 as the options below already provide a relatively +// good level of interoperability and changing this option arguably isn't worth +// diverging from the official builds of the library. +#define wxUSE_STL 0 + +// This is not a real option but is used as the default value for +// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS_COMPATIBLY. +// +// Set it to 0 if you want to disable the use of all standard classes +// completely for some reason. +#define wxUSE_STD_DEFAULT 1 + +// Use standard C++ containers where it can be done without breaking backwards +// compatibility. +// +// This provides better interoperability with the standard library, e.g. with +// this option on it's possible to insert std::vector<> into many wxWidgets +// containers directly. +// +// Default is 1. +// +// Recommended setting is 1 unless you want to avoid all dependencies on the +// standard library. +#define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT + +// Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<> +// and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but +// usually more limited) implementations are used which allows to avoid the +// dependency on the C++ run-time library. +// +// Default is 0 for compatibility reasons. +// +// Recommended setting: 1 unless compatibility with the official wxWidgets +// build and/or the existing code is a concern. +#define wxUSE_STD_CONTAINERS 0 + +// Use standard C++ streams if 1 instead of wx streams in some places. If +// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the +// standard streams library. +// +// Notice that enabling this does not replace wx streams with std streams +// everywhere, in a lot of places wx streams are used no matter what. +// +// Default is 1 if compiler supports it. +// +// Recommended setting: 1 if you use the standard streams anyhow and so +// dependency on the standard streams library is not a +// problem +#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT + +// Enable minimal interoperability with the standard C++ string class if 1. +// "Minimal" means that wxString can be constructed from std::string or +// std::wstring but can't be implicitly converted to them. You need to enable +// the option below for the latter. +// +// Default is 1 for most compilers. +// +// Recommended setting: 1 unless you want to ensure your program doesn't use +// the standard C++ library at all. +#define wxUSE_STD_STRING wxUSE_STD_DEFAULT + +// Make wxString as much interchangeable with std::[w]string as possible, in +// particular allow implicit conversion of wxString to either of these classes. +// This comes at a price (or a benefit, depending on your point of view) of not +// allowing implicit conversion to "const char *" and "const wchar_t *". +// +// Because a lot of existing code relies on these conversions, this option is +// disabled by default but can be enabled for your build if you don't care +// about compatibility. +// +// Default is 0 if wxUSE_STL has its default value or 1 if it is enabled. +// +// Recommended setting: 0 to remain compatible with the official builds of +// wxWidgets. +#define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL + +// ---------------------------------------------------------------------------- +// non GUI features selection +// ---------------------------------------------------------------------------- + +// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit +// integer which is implemented in terms of native 64 bit integers if any or +// uses emulation otherwise. +// +// This class is required by wxDateTime and so you should enable it if you want +// to use wxDateTime. For most modern platforms, it will use the native 64 bit +// integers in which case (almost) all of its functions are inline and it +// almost does not take any space, so there should be no reason to switch it +// off. +// +// Recommended setting: 1 +#define wxUSE_LONGLONG 1 + +// Set wxUSE_BASE64 to 1, to compile in Base64 support. This is required for +// storing binary data in wxConfig on most platforms. +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_BASE64 1 + +// Set this to 1 to be able to use wxEventLoop even in console applications +// (i.e. using base library only, without GUI). This is mostly useful for +// processing socket events but is also necessary to use timers in console +// applications +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_CONSOLE_EVENTLOOP 1 + +// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level +// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. +// +// Default is 1 +// +// Recommended setting: 1 (wxFile is highly recommended as it is required by +// i18n code, wxFileConfig and others) +#define wxUSE_FILE 1 +#define wxUSE_FFILE 1 + +// Use wxFSVolume class providing access to the configured/active mount points +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely disabled if you don't use it) +#define wxUSE_FSVOLUME 1 + +// Use wxSecretStore class for storing passwords using OS-specific facilities. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely disabled if you don't use it) +#define wxUSE_SECRETSTORE 1 + +// Allow the use of the OS built-in spell checker in wxTextCtrl. +// +// Default is 1, the corresponding wxTextCtrl functions simply won't do +// anything if the functionality is not supported by the current platform. +// +// Recommended setting: 1 unless you want to save a tiny bit of code. +#define wxUSE_SPELLCHECK 1 + +// Use wxStandardPaths class which allows to retrieve some standard locations +// in the file system +// +// Default is 1 +// +// Recommended setting: 1 (may be disabled to save space, but not much) +#define wxUSE_STDPATHS 1 + +// use wxTextBuffer class: required by wxTextFile +#define wxUSE_TEXTBUFFER 1 + +// use wxTextFile class: requires wxFile and wxTextBuffer, required by +// wxFileConfig +#define wxUSE_TEXTFILE 1 + +// i18n support: _() macro, wxLocale class. +#define wxUSE_INTL 1 + +// Provide wxFoo_l() functions similar to standard foo() functions but taking +// an extra locale parameter. +// +// Notice that this is fully implemented only for the systems providing POSIX +// xlocale support or Microsoft Visual C++ >= 8 (which provides proprietary +// almost-equivalent of xlocale functions), otherwise wxFoo_l() functions will +// only work for the current user locale and "C" locale. You can use +// wxHAS_XLOCALE_SUPPORT to test whether the full support is available. +// +// Default is 1 +// +// Recommended setting: 1 but may be disabled if you are writing programs +// running only in C locale anyhow +#define wxUSE_XLOCALE 1 + +// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which +// allow to manipulate dates, times and time intervals. +// +// Requires: wxUSE_LONGLONG +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_DATETIME 1 + +// Set wxUSE_TIMER to 1 to compile wxTimer class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_TIMER 1 + +// Use wxStopWatch class. +// +// Default is 1 +// +// Recommended setting: 1 (needed by wxSocket) +#define wxUSE_STOPWATCH 1 + +// Set wxUSE_FSWATCHER to 1 if you want to enable wxFileSystemWatcher +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_FSWATCHER 1 + +// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes +// which allow the application to store its settings in the persistent +// storage. Setting this to 1 will also enable on-demand creation of the +// global config object in wxApp. +// +// See also wxUSE_CONFIG_NATIVE below. +// +// Recommended setting: 1 +#define wxUSE_CONFIG 1 + +// If wxUSE_CONFIG is 1, you may choose to use either the native config +// classes under Windows (using the registry) or the portable text file +// format used by the config classes under Unix. +// +// Default is 1 to use native classes. Note that you may still use +// wxFileConfig even if you set this to 1 - just the config object created by +// default for the applications needs will be a wxRegConfig or wxIniConfig and +// not wxFileConfig. +// +// Recommended setting: 1 +#define wxUSE_CONFIG_NATIVE 1 + +// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows +// to connect/disconnect from the network and be notified whenever the dial-up +// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DIALUP_MANAGER 1 + +// Compile in classes for run-time DLL loading and function calling. +// Required by wxUSE_DIALUP_MANAGER. +// +// This setting is for Win32 only +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DYNLIB_CLASS 1 + +// experimental, don't use for now +#define wxUSE_DYNAMIC_LOADER 1 + +// Set to 1 to use socket classes +#define wxUSE_SOCKETS 1 + +// Set to 1 to use ipv6 socket classes (requires wxUSE_SOCKETS) +// +// Default is 1. +// +// Recommended setting: 1. +#define wxUSE_IPV6 1 + +// Set to 1 to enable virtual file systems (required by wxHTML) +#define wxUSE_FILESYSTEM 1 + +// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ZIP 1 + +// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ARCHIVE 1 + +// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_INET 1 + +// wxArchive classes for accessing archives such as zip and tar +#define wxUSE_ARCHIVE_STREAMS 1 + +// Set to 1 to compile wxZipInput/OutputStream classes. +#define wxUSE_ZIPSTREAM 1 + +// Set to 1 to compile wxTarInput/OutputStream classes. +#define wxUSE_TARSTREAM 1 + +// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by +// wxUSE_LIBPNG +#define wxUSE_ZLIB 1 + +// Set to 1 if liblzma is available to enable wxLZMA{Input,Output}Stream +// classes. +// +// Notice that if you enable this build option when not using configure or +// CMake, you need to ensure that liblzma headers and libraries are available +// (i.e. by building the library yourself or downloading its binaries) and can +// be found, either by copying them to one of the locations searched by the +// compiler/linker by default (e.g. any of the directories in the INCLUDE or +// LIB environment variables, respectively, when using MSVC) or modify the +// make- or project files to add references to these directories. +// +// Default is 0 under MSW, auto-detected by configure. +// +// Recommended setting: 1 if you need LZMA compression. +#define wxUSE_LIBLZMA 0 + +// If enabled, the code written by Apple will be used to write, in a portable +// way, float on the disk. See extended.c for the license which is different +// from wxWidgets one. +// +// Default is 1. +// +// Recommended setting: 1 unless you don't like the license terms (unlikely) +#define wxUSE_APPLE_IEEE 1 + +// Joystick support class +#define wxUSE_JOYSTICK 1 + +// wxFontEnumerator class +#define wxUSE_FONTENUM 1 + +// wxFontMapper class +#define wxUSE_FONTMAP 1 + +// wxMimeTypesManager class +#define wxUSE_MIMETYPE 1 + +// wxWebRequest allows usage of system libraries for HTTP(S) requests. +// +// Note that for wxWebRequest to be built, at least one of its backends must be +// available. Under MSW and macOS this will always be the case unless +// explicitly disabled. +// +// Default is 1 +// +// Recommended setting: 1, setting it to 0 may be useful to avoid dependencies +// on libcurl on Unix systems. +#define wxUSE_WEBREQUEST 1 + +// wxWebRequest backend based on NSURLSession +// +// Default is 1 under macOS. +// +// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, +// otherwise wxWebRequest won't be available at all under Mac. +#ifdef __APPLE__ +#define wxUSE_WEBREQUEST_URLSESSION wxUSE_WEBREQUEST +#else +#define wxUSE_WEBREQUEST_URLSESSION 0 +#endif + +// wxWebRequest backend based on libcurl, can be used under all platforms. +// +// Default is 0 for MSW and macOS, detected automatically when using configure. +// +// Recommended setting: 0 on Windows and macOS, otherwise 1 as it is required +// for wxWebRequest to be available at all. +#define wxUSE_WEBREQUEST_CURL 0 + +// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP +// or wxURL you need to set this to 1. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_PROTOCOL 1 + +// The settings for the individual URL schemes +#define wxUSE_PROTOCOL_FILE 1 +#define wxUSE_PROTOCOL_FTP 1 +#define wxUSE_PROTOCOL_HTTP 1 + +// Define this to use wxURL class. +#define wxUSE_URL 1 + +// Define this to use native platform url and protocol support. +// Currently valid only for MS-Windows. +// Note: if you set this to 1, you can open ftp/http/gopher sites +// and obtain a valid input stream for these sites +// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. +// Doing so reduces the code size. +// +// This code is experimental and subject to change. +#define wxUSE_URL_NATIVE 0 + +// Support for wxVariant class used in several places throughout the library, +// notably in wxDataViewCtrl API. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size as much as +// possible in which case setting this to 0 can gain up to 100KB. +#define wxUSE_VARIANT 1 + +// Support for wxAny class, the successor for wxVariant. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size by a small amount, +// or your compiler cannot for some reason cope with complexity of templates used. +#define wxUSE_ANY 1 + +// Support for regular expression matching via wxRegEx class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_REGEX 1 + +// wxSystemOptions class +#define wxUSE_SYSTEM_OPTIONS 1 + +// wxSound class +#define wxUSE_SOUND 1 + +// Use wxMediaCtrl +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_MEDIACTRL 1 + +// Use wxWidget's XRC XML-based resource system. Recommended. +// +// Default is 1 +// +// Recommended setting: 1 (requires wxUSE_XML) +#define wxUSE_XRC 1 + +// XML parsing classes. +// +// Default is 1 +// +// Recommended setting: 1 (required by XRC) +#define wxUSE_XML 1 + +// Use wxWidget's AUI docking system +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_AUI 1 + +// Use wxWidget's Ribbon classes for interfaces +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_RIBBON 1 + +// Use wxPropertyGrid. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_PROPGRID 1 + +// Use wxStyledTextCtrl, a wxWidgets Scintilla wrapper. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STC 1 + +// Use wxWidget's web viewing classes +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_WEBVIEW 1 + +// Use the IE wxWebView backend +// +// Default is 1 on MSW +// +// Recommended setting: 1 +#ifdef __WXMSW__ +#define wxUSE_WEBVIEW_IE 1 +#else +#define wxUSE_WEBVIEW_IE 0 +#endif + +// Use the Edge (Chromium) wxWebView backend (Requires WebView2 SDK) +// +// Default is 0 because WebView2 is not always available, set it to 1 if you do have it. +// +// Recommended setting: 1 when building for Windows with WebView2 SDK +#define wxUSE_WEBVIEW_EDGE 0 + +// Use the Edge (Chromium) wxWebView backend without loader DLL +// +// Default is 0, set it to 1 if you don't want to depend on WebView2Loader.dll. +// +// Recommended setting: 0 +#define wxUSE_WEBVIEW_EDGE_STATIC 0 + +// Use the WebKit wxWebView backend +// +// Default is 1 on GTK and OSX +// +// Recommended setting: 1 +#if (defined(__WXGTK__) && !defined(__WXGTK3__)) || defined(__WXOSX__) +#define wxUSE_WEBVIEW_WEBKIT 1 +#else +#define wxUSE_WEBVIEW_WEBKIT 0 +#endif + +// Use the WebKit2 wxWebView backend +// +// Default is 1 on GTK3 +// +// Recommended setting: 1 +#if defined(__WXGTK3__) +#define wxUSE_WEBVIEW_WEBKIT2 1 +#else +#define wxUSE_WEBVIEW_WEBKIT2 0 +#endif + +// Enable wxGraphicsContext and related classes for a modern 2D drawing API. +// +// Default is 1 except if you're using a compiler without support for GDI+ +// under MSW, i.e. gdiplus.h and related headers (MSVC and MinGW >= 4.8 are +// known to have them). For other compilers (e.g. older mingw32) you may need +// to install the headers (and just the headers) yourself. If you do, change +// the setting below manually. +// +// Recommended setting: 1 if supported by the compilation environment + +// Notice that we can't use wxCHECK_VISUALC_VERSION() nor wxCHECK_GCC_VERSION() +// here as this file is included from wx/platform.h before they're defined. +#if defined(_MSC_VER) || \ + (defined(__MINGW32__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 8)) +#define wxUSE_GRAPHICS_CONTEXT 1 +#else +// Disable support for other Windows compilers, enable it if your compiler +// comes with new enough SDK or you installed the headers manually. +// +// Notice that this will be set by configure under non-Windows platforms +// anyhow so the value there is not important. +#define wxUSE_GRAPHICS_CONTEXT 0 +#endif + +// Enable wxGraphicsContext implementation using Cairo library. +// +// This is not needed under Windows and detected automatically by configure +// under other systems, however you may set this to 1 manually if you installed +// Cairo under Windows yourself and prefer to use it instead the native GDI+ +// implementation. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_CAIRO 0 + + +// ---------------------------------------------------------------------------- +// Individual GUI controls +// ---------------------------------------------------------------------------- + +// You must set wxUSE_CONTROLS to 1 if you are using any controls at all +// (without it, wxControl class is not compiled) +// +// Default is 1 +// +// Recommended setting: 1 (don't change except for very special programs) +#define wxUSE_CONTROLS 1 + +// Support markup in control labels, i.e. provide wxControl::SetLabelMarkup(). +// Currently markup is supported only by a few controls and only some ports but +// their number will increase with time. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you want to save on code size) +#define wxUSE_MARKUP 1 + +// wxPopupWindow class is a top level transient window. It is currently used +// to implement wxTipWindow +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) +#define wxUSE_POPUPWIN 1 + +// wxTipWindow allows to implement the custom tooltips, it is used by the +// context help classes. Requires wxUSE_POPUPWIN. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0) +#define wxUSE_TIPWINDOW 1 + +// Each of the settings below corresponds to one wxWidgets control. They are +// all switched on by default but may be disabled if you are sure that your +// program (including any standard dialogs it can show!) doesn't need them and +// if you desperately want to save some space. If you use any of these you must +// set wxUSE_CONTROLS as well. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_ACTIVITYINDICATOR 1 // wxActivityIndicator +#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl +#define wxUSE_BANNERWINDOW 1 // wxBannerWindow +#define wxUSE_BUTTON 1 // wxButton +#define wxUSE_BMPBUTTON 1 // wxBitmapButton +#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl +#define wxUSE_CHECKBOX 1 // wxCheckBox +#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) +#define wxUSE_CHOICE 1 // wxChoice +#define wxUSE_COLLPANE 1 // wxCollapsiblePane +#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl +#define wxUSE_COMBOBOX 1 // wxComboBox +#define wxUSE_COMMANDLINKBUTTON 1 // wxCommandLinkButton +#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl +#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl +#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl +#define wxUSE_EDITABLELISTBOX 1 // wxEditableListBox +#define wxUSE_FILECTRL 1 // wxFileCtrl +#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl +#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl +#define wxUSE_GAUGE 1 // wxGauge +#define wxUSE_HEADERCTRL 1 // wxHeaderCtrl +#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl +#define wxUSE_LISTBOX 1 // wxListBox +#define wxUSE_LISTCTRL 1 // wxListCtrl +#define wxUSE_RADIOBOX 1 // wxRadioBox +#define wxUSE_RADIOBTN 1 // wxRadioButton +#define wxUSE_RICHMSGDLG 1 // wxRichMessageDialog +#define wxUSE_SCROLLBAR 1 // wxScrollBar +#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl +#define wxUSE_SLIDER 1 // wxSlider +#define wxUSE_SPINBTN 1 // wxSpinButton +#define wxUSE_SPINCTRL 1 // wxSpinCtrl +#define wxUSE_STATBOX 1 // wxStaticBox +#define wxUSE_STATLINE 1 // wxStaticLine +#define wxUSE_STATTEXT 1 // wxStaticText +#define wxUSE_STATBMP 1 // wxStaticBitmap +#define wxUSE_TEXTCTRL 1 // wxTextCtrl +#define wxUSE_TIMEPICKCTRL 1 // wxTimePickerCtrl +#define wxUSE_TOGGLEBTN 1 // requires wxButton +#define wxUSE_TREECTRL 1 // wxTreeCtrl +#define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl + +// Use generic version of wxDataViewCtrl even if a native one is available? +// +// Default is 1. +// +// Recommended setting: 1, but can be set to 0 if your program is affected by +// the native control limitations. +#define wxUSE_NATIVE_DATAVIEWCTRL 1 + +// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR +// below either wxStatusBar95 or a generic wxStatusBar will be used. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STATUSBAR 1 + +// Two status bar implementations are available under Win32: the generic one +// or the wrapper around native control. For native look and feel the native +// version should be used. +// +// Default is 1 for the platforms where native status bar is supported. +// +// Recommended setting: 1 (there is no advantage in using the generic one) +#define wxUSE_NATIVE_STATUSBAR 1 + +// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar +// classes at all. Otherwise, use the native toolbar class unless +// wxUSE_TOOLBAR_NATIVE is 0. +// +// Default is 1 for all settings. +// +// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. +#define wxUSE_TOOLBAR 1 +#define wxUSE_TOOLBAR_NATIVE 1 + +// wxNotebook is a control with several "tabs" located on one of its sides. It +// may be used to logically organise the data presented to the user instead of +// putting everything in one huge dialog. It replaces wxTabControl and related +// classes of wxWin 1.6x. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTEBOOK 1 + +// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_LISTBOOK 1 + +// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CHOICEBOOK 1 + +// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TREEBOOK 1 + +// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of +// tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLBOOK 1 + +// wxTaskBarIcon is a small notification icon shown in the system toolbar or +// dock. +// +// Default is 1. +// +// Recommended setting: 1 (but can be set to 0 if you don't need it) +#define wxUSE_TASKBARICON 1 + +// wxGrid class +// +// Default is 1, set to 0 to cut down compilation time and binaries size if you +// don't use it. +// +// Recommended setting: 1 +// +#define wxUSE_GRID 1 + +// wxMiniFrame class: a frame with narrow title bar +// +// Default is 1. +// +// Recommended setting: 1 (it doesn't cost almost anything) +#define wxUSE_MINIFRAME 1 + +// wxComboCtrl and related classes: combobox with custom popup window and +// not necessarily a listbox. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it +// is used by wxComboBox +#define wxUSE_COMBOCTRL 1 + +// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox +// items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0, except where it is +// needed as a base class for generic wxBitmapComboBox. +#define wxUSE_ODCOMBOBOX 1 + +// wxBitmapComboBox is a combobox that can have images in front of text items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 +#define wxUSE_BITMAPCOMBOBOX 1 + +// wxRearrangeCtrl is a wxCheckListBox with two buttons allowing to move items +// up and down in it. It is also used as part of wxRearrangeDialog. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 (currently used only by +// wxHeaderCtrl) +#define wxUSE_REARRANGECTRL 1 + +// wxAddRemoveCtrl is a composite control containing a control showing some +// items (e.g. wxListBox, wxListCtrl, wxTreeCtrl, wxDataViewCtrl, ...) and "+"/ +// "-" buttons allowing to add and remove items to/from the control. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 if you don't need it (not +// used by the library itself). +#define wxUSE_ADDREMOVECTRL 1 + +// ---------------------------------------------------------------------------- +// Miscellaneous GUI stuff +// ---------------------------------------------------------------------------- + +// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) +#define wxUSE_ACCEL 1 + +// Use the standard art provider. The icons returned by this provider are +// embedded into the library as XPMs so disabling it reduces the library size +// somewhat but this should only be done if you use your own custom art +// provider returning the icons or never use any icons not provided by the +// native art provider (which might not be implemented at all for some +// platforms) or by the Tango icons provider (if it's not itself disabled +// below). +// +// Default is 1. +// +// Recommended setting: 1 unless you use your own custom art provider. +#define wxUSE_ARTPROVIDER_STD 1 + +// Use art provider providing Tango icons: this art provider has higher quality +// icons than the default one. It uses SVG format which allows much better scaling +// then when bitmaps are used, at the expense of somewhat larger library size. +// +// Default is 1 under non-GTK ports. Under wxGTK the native art provider using +// the GTK+ stock icons replaces it so it is normally not necessary. +// +// Recommended setting: 1 but can be turned off to reduce the library size. +#define wxUSE_ARTPROVIDER_TANGO 1 + +// Hotkey support (currently Windows and macOS only) +#define wxUSE_HOTKEY 1 + +// Use wxCaret: a class implementing a "cursor" in a text control (called caret +// under Windows). +// +// Default is 1. +// +// Recommended setting: 1 (can be safely set to 0, not used by the library) +#define wxUSE_CARET 1 + +// Use wxDisplay class: it allows enumerating all displays on a system and +// their geometries as well as finding the display on which the given point or +// window lies. +// +// Default is 1. +// +// Recommended setting: 1 if you need it, can be safely set to 0 otherwise +#define wxUSE_DISPLAY 1 + +// Miscellaneous geometry code: needed for Canvas library +#define wxUSE_GEOMETRY 1 + +// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and +// wxListCtrl. +// +// Default is 1. +// +// Recommended setting: 1 (set it to 0 if you don't use any of the controls +// enumerated above, then this class is mostly useless too) +#define wxUSE_IMAGLIST 1 + +// Use wxInfoBar class. +// +// Default is 1. +// +// Recommended setting: 1 (but can be disabled without problems as nothing +// depends on it) +#define wxUSE_INFOBAR 1 + +// Use wxMenu, wxMenuItem. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUS 1 + +// Use wxMenuBar. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUBAR 1 + +// Use wxNotificationMessage. +// +// wxNotificationMessage allows to show non-intrusive messages to the user +// using balloons, banners, popups or whatever is the appropriate method for +// the current platform. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTIFICATION_MESSAGE 1 + +// wxPreferencesEditor provides a common API for different ways of presenting +// the standard "Preferences" or "Properties" dialog under different platforms +// (e.g. some use modal dialogs, some use modeless ones; some apply the changes +// immediately while others require an explicit "Apply" button). +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_PREFERENCES_EDITOR 1 + +// wxFont::AddPrivateFont() allows to use fonts not installed on the system by +// loading them from font files during run-time. +// +// Default is 1 except under Unix where it will be turned off by configure if +// the required libraries are not available or not new enough. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it and +// want to avoid extra dependencies under Linux, for example). +#define wxUSE_PRIVATE_FONTS 1 + +// wxRichToolTip is a customizable tooltip class which has more functionality +// than the stock (but native, unlike this class) wxToolTip. +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely set to 0 if you don't need it) +#define wxUSE_RICHTOOLTIP 1 + +// Use wxSashWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SASH 1 + +// Use wxSplitterWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SPLITTER 1 + +// Use wxToolTip and wxWindow::Set/GetToolTip() methods. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLTIPS 1 + +// wxValidator class and related methods +#define wxUSE_VALIDATORS 1 + +// Use reference counted ID management: this means that wxWidgets will track +// the automatically allocated ids (those used when you use wxID_ANY when +// creating a window, menu or toolbar item &c) instead of just supposing that +// the program never runs out of them. This is mostly useful only under wxMSW +// where the total ids range is limited to SHRT_MIN..SHRT_MAX and where +// long-running programs can run into problems with ids reuse without this. On +// the other platforms, where the ids have the full int range, this shouldn't +// be necessary. +#ifdef __WXMSW__ +#define wxUSE_AUTOID_MANAGEMENT 1 +#else +#define wxUSE_AUTOID_MANAGEMENT 0 +#endif + +// ---------------------------------------------------------------------------- +// common dialogs +// ---------------------------------------------------------------------------- + +// Use common dialogs (e.g. file selector, printer dialog). Switching this off +// also switches off the printing architecture and interactive wxPrinterDC. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COMMON_DIALOGS 1 + +// wxBusyInfo displays window with message when app is busy. Works in same way +// as wxBusyCursor +#define wxUSE_BUSYINFO 1 + +// Use single/multiple choice dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_CHOICEDLG 1 + +// Use colour picker dialog +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COLOURDLG 1 + +// wxDirDlg class for getting a directory name from user +#define wxUSE_DIRDLG 1 + +// Use file open/save dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in many places in the library itself) +#define wxUSE_FILEDLG 1 + +// Use find/replace dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely set to 0) +#define wxUSE_FINDREPLDLG 1 + +// Use font picker dialog +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_FONTDLG 1 + +// Use wxMessageDialog and wxMessageBox. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_MSGDLG 1 + +// progress dialog class for lengthy operations +#define wxUSE_PROGRESSDLG 1 + +// Set to 0 to disable the use of the native progress dialog (currently only +// available under MSW and suffering from some bugs there, hence this option). +#define wxUSE_NATIVE_PROGRESSDLG 1 + +// support for startup tips (wxShowTip &c) +#define wxUSE_STARTUP_TIPS 1 + +// text entry dialog and wxGetTextFromUser function +#define wxUSE_TEXTDLG 1 + +// number entry dialog +#define wxUSE_NUMBERDLG 1 + +// credential entry dialog +#define wxUSE_CREDENTIALDLG 1 + +// splash screen class +#define wxUSE_SPLASH 1 + +// wizards +#define wxUSE_WIZARDDLG 1 + +// Compile in wxAboutBox() function showing the standard "About" dialog. +// +// Default is 1 +// +// Recommended setting: 1 but can be set to 0 to save some space if you don't +// use this function +#define wxUSE_ABOUTDLG 1 + +// wxFileHistory class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_FILE_HISTORY 1 + +// ---------------------------------------------------------------------------- +// Metafiles support +// ---------------------------------------------------------------------------- + +// Windows supports the graphics format known as metafile which, though not +// portable, is widely used under Windows and so is supported by wxWidgets +// (under Windows only, of course). Both the so-called "Window MetaFiles" or +// WMFs, and "Enhanced MetaFiles" or EMFs are supported in wxWin and, by +// default, EMFs will be used. This may be changed by setting +// wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting wxUSE_ENH_METAFILE to 0. +// You may also set wxUSE_METAFILE to 0 to not compile in any metafile +// related classes at all. +// +// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. +// +// Recommended setting: default or 0 for everything for portable programs. +#define wxUSE_METAFILE 1 +#define wxUSE_ENH_METAFILE 1 +#define wxUSE_WIN_METAFILES_ALWAYS 0 + +// ---------------------------------------------------------------------------- +// Big GUI components +// ---------------------------------------------------------------------------- + +// Set to 0 to disable MDI support. +// +// Requires wxUSE_NOTEBOOK under platforms other than MSW. +// +// Default is 1. +// +// Recommended setting: 1, can be safely set to 0. +#define wxUSE_MDI 1 + +// Set to 0 to disable document/view architecture +#define wxUSE_DOC_VIEW_ARCHITECTURE 1 + +// Set to 0 to disable MDI document/view architecture +// +// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE +#define wxUSE_MDI_ARCHITECTURE 1 + +// Set to 0 to disable print/preview architecture code +#define wxUSE_PRINTING_ARCHITECTURE 1 + +// wxHTML allows displaying simple HTML. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_HTML 1 + +// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL +// headers and libraries to be able to compile the library with wxUSE_GLCANVAS +// set to 1 and, under Windows, also to add opengl32.lib and glu32.lib to the +// list of libraries used to link your application when linking to wxWidgets +// statically (although this is done implicitly for Microsoft Visual C++ users). +// +// Default is 1. +// +// Recommended setting: 1 if you intend to use OpenGL, can be safely set to 0 +// otherwise. +#define wxUSE_GLCANVAS 1 + +// Setting wxUSE_GLCANVAS_EGL to 1 enables OpenGL EGL backend. This will be +// automatically enabled if EGL support is detected. EGL support is only +// available under Unix platforms. +// +// Default is 0. +// +#define wxUSE_GLCANVAS_EGL 0 + +// wxRichTextCtrl allows editing of styled text. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 if you want compile a +// smaller library. +#define wxUSE_RICHTEXT 1 + +// ---------------------------------------------------------------------------- +// Data transfer +// ---------------------------------------------------------------------------- + +// Use wxClipboard class for clipboard copy/paste. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CLIPBOARD 1 + +// Use wxDataObject and related classes. Needed for clipboard and OLE drag and +// drop +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DATAOBJ 1 + +// Use wxDropTarget and wxDropSource classes for drag and drop (this is +// different from "built in" drag and drop in wxTreeCtrl which is always +// available). Requires wxUSE_DATAOBJ. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DRAG_AND_DROP 1 + +// Use wxAccessible for enhanced and customisable accessibility. +// Depends on wxUSE_OLE on MSW. +// +// Default is 1 on MSW, 0 elsewhere. +// +// Recommended setting (at present): 1 (MSW-only) +#ifdef __WXMSW__ +#define wxUSE_ACCESSIBILITY 1 +#else +#define wxUSE_ACCESSIBILITY 0 +#endif + +// ---------------------------------------------------------------------------- +// miscellaneous settings +// ---------------------------------------------------------------------------- + +// wxSingleInstanceChecker class allows to verify at startup if another program +// instance is running. +// +// Default is 1 +// +// Recommended setting: 1 (the class is tiny, disabling it won't save much +// space) +#define wxUSE_SNGLINST_CHECKER 1 + +#define wxUSE_DRAGIMAGE 1 + +#define wxUSE_IPC 1 + // 0 for no interprocess comms +#define wxUSE_HELP 1 + // 0 for no help facility + +// Should we use MS HTML help for wxHelpController? If disabled, neither +// wxCHMHelpController nor wxBestHelpController are available. +// +// Default is 1 under MSW, 0 is always used for the other platforms. +// +// Recommended setting: 1, only set to 0 if you have trouble compiling +// wxCHMHelpController (could be a problem with really ancient compilers) +#define wxUSE_MS_HTML_HELP 1 + + +// Use wxHTML-based help controller? +#define wxUSE_WXHTML_HELP 1 + +#define wxUSE_CONSTRAINTS 1 + // 0 for no window layout constraint system + +#define wxUSE_SPLINES 1 + // 0 for no splines + +#define wxUSE_MOUSEWHEEL 1 + // Include mouse wheel support + +// Compile wxUIActionSimulator class? +#define wxUSE_UIACTIONSIMULATOR 1 + +// ---------------------------------------------------------------------------- +// wxDC classes for various output formats +// ---------------------------------------------------------------------------- + +// Set to 1 for PostScript device context. +#define wxUSE_POSTSCRIPT 0 + +// Set to 1 to use font metric files in GetTextExtent +#define wxUSE_AFM_FOR_POSTSCRIPT 1 + +// Set to 1 to compile in support for wxSVGFileDC, a wxDC subclass which allows +// to create files in SVG (Scalable Vector Graphics) format. +#define wxUSE_SVG 1 + +// Should wxDC provide SetTransformMatrix() and related methods? +// +// Default is 1 but can be set to 0 if this functionality is not used. Notice +// that currently wxMSW, wxGTK3 support this for wxDC and all platforms support +// this for wxGCDC so setting this to 0 doesn't change much if neither of these +// is used (although it will still save a few bytes probably). +// +// Recommended setting: 1. +#define wxUSE_DC_TRANSFORM_MATRIX 1 + +// ---------------------------------------------------------------------------- +// image format support +// ---------------------------------------------------------------------------- + +// wxImage supports many different image formats which can be configured at +// compile-time. BMP is always supported, others are optional and can be safely +// disabled if you don't plan to use images in such format sometimes saving +// substantial amount of code in the final library. +// +// Some formats require an extra library (e.g. libpng) which is always included in +// wxWidgets sources but some build systems (cmake, configure) can be configured to +// to use the system or user-provided version. +// +// Set to 1 for wxImage support (recommended). +#define wxUSE_IMAGE 1 + +// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. +#define wxUSE_LIBPNG 1 + +// Set to 1 for JPEG format support (requires libjpeg) +#define wxUSE_LIBJPEG 1 + +// Set to 1 for TIFF format support (requires libtiff) +#define wxUSE_LIBTIFF 1 + +// Set to 1 for SVG rasterizing support using nanosvg +#define wxUSE_NANOSVG 1 + +// Set to 1 to use external nanosvg library when wxUSE_NANOSVG is enabled +#define wxUSE_NANOSVG_EXTERNAL 0 + +// Set to 1 for TGA format support (loading only) +#define wxUSE_TGA 1 + +// Set to 1 for GIF format support +#define wxUSE_GIF 1 + +// Set to 1 for PNM format support +#define wxUSE_PNM 1 + +// Set to 1 for PCX format support +#define wxUSE_PCX 1 + +// Set to 1 for IFF format support (Amiga format) +#define wxUSE_IFF 0 + +// Set to 1 for XPM format support +#define wxUSE_XPM 1 + +// Set to 1 for MS Icons and Cursors format support +#define wxUSE_ICO_CUR 1 + +// Set to 1 to compile in wxPalette class +#define wxUSE_PALETTE 1 + +// ---------------------------------------------------------------------------- +// wxUniversal-only options +// ---------------------------------------------------------------------------- + +// Set to 1 to enable compilation of all themes, this is the default +#define wxUSE_ALL_THEMES 1 + +// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES +// is unset, if it is set these options are not used; notice that metal theme +// uses Win32 one +#define wxUSE_THEME_GTK 0 +#define wxUSE_THEME_METAL 0 +#define wxUSE_THEME_MONO 0 +#define wxUSE_THEME_WIN32 0 + +/* --- end common options --- */ + +/* --- start MSW options --- */ +// ---------------------------------------------------------------------------- +// Windows-specific backends choices +// ---------------------------------------------------------------------------- + +// The options here are only taken into account if wxUSE_GRAPHICS_CONTEXT is 1. + +// Enable support for GDI+-based implementation of wxGraphicsContext. +// +// Default is 1. +// +// Recommended setting: 1 if you need to support XP, as Direct2D is not +// available there. +#define wxUSE_GRAPHICS_GDIPLUS wxUSE_GRAPHICS_CONTEXT + +// Enable support for Direct2D-based implementation of wxGraphicsContext. +// +// Default is 1 for compilers which support it, i.e. VC10+ currently. If you +// use an earlier MSVC version or another compiler and installed the necessary +// SDK components manually, you need to change this setting. +// +// Recommended setting: 1 for faster and better quality graphics under Windows +// 7 and later systems (if wxUSE_GRAPHICS_GDIPLUS is also enabled, earlier +// systems will fall back on using GDI+). +#if defined(_MSC_VER) && _MSC_VER >= 1600 + #define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT +#else + #define wxUSE_GRAPHICS_DIRECT2D 0 +#endif + +// wxWebRequest backend based on WinHTTP. +// +// This is only taken into account if wxUSE_WEBREQUEST==1. +// +// Default is 1 if supported by the compiler (MSVS or MinGW64). +// +// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, +// otherwise wxWebRequest won't be available at all. +#define wxUSE_WEBREQUEST_WINHTTP 1 + +// ---------------------------------------------------------------------------- +// Windows-only settings +// ---------------------------------------------------------------------------- + +// Set this to 1 for generic OLE support: this is required for drag-and-drop, +// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and +// can't compile/doesn't have the OLE headers. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_OLE 1 + +// Set this to 1 to enable wxAutomationObject class. +// +// Default is 1. +// +// Recommended setting: 1 if you need to control other applications via OLE +// Automation, can be safely set to 0 otherwise +#define wxUSE_OLE_AUTOMATION 1 + +// Set this to 1 to enable wxActiveXContainer class allowing to embed OLE +// controls in wx. +// +// Default is 1. +// +// Recommended setting: 1, required by wxMediaCtrl +#define wxUSE_ACTIVEX 1 + +// Enable WinRT support +// +// Default is 1 for compilers which support it, i.e. VS2012+ currently. If you +// use an earlier MSVC version or another compiler and installed the necessary +// SDK components manually, you need to change this setting. +// +// Recommended setting: 1 +#if defined(_MSC_VER) && _MSC_VER >= 1700 && !defined(_USING_V110_SDK71_) + #define wxUSE_WINRT 1 +#else + #define wxUSE_WINRT 0 +#endif + +// wxDC caching implementation +#define wxUSE_DC_CACHEING 1 + +// Set this to 1 to enable wxDIB class used internally for manipulating +// wxBitmap data. +// +// Default is 1, set it to 0 only if you don't use wxImage either +// +// Recommended setting: 1 (without it conversion to/from wxImage won't work) +#define wxUSE_WXDIB 1 + +// Set to 0 to disable PostScript print/preview architecture code under Windows +// (just use Windows printing). +#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1 + +// Set this to 1 to compile in wxRegKey class. +// +// Default is 1 +// +// Recommended setting: 1, this is used internally by wx in a few places +#define wxUSE_REGKEY 1 + +// Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH +// which allows to put more than ~32Kb of text in it even under Win9x (NT +// doesn't have such limitation). +// +// Default is 1 for compilers which support it +// +// Recommended setting: 1, only set it to 0 if your compiler doesn't have +// or can't compile <richedit.h> +#define wxUSE_RICHEDIT 1 + +// Set this to 1 to use extra features of richedit v2 and later controls +// +// Default is 1 for compilers which support it +// +// Recommended setting: 1 +#define wxUSE_RICHEDIT2 1 + +// Set this to 1 to enable support for the owner-drawn menu and listboxes. This +// is required by wxUSE_CHECKLISTBOX. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 for a small library size reduction +#define wxUSE_OWNER_DRAWN 1 + +// Set this to 1 to enable MSW-specific wxTaskBarIcon::ShowBalloon() method. It +// is required by native wxNotificationMessage implementation. +// +// Default is 1 but disabled in wx/msw/chkconf.h if SDK is too old to contain +// the necessary declarations. +// +// Recommended setting: 1, set to 0 for a tiny library size reduction +#define wxUSE_TASKBARICON_BALLOONS 1 + +// Set this to 1 to enable following functionality added in Windows 7: thumbnail +// representations, thumbnail toolbars, notification and status overlays, +// progress indicators and jump lists. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 for a tiny library size reduction +#define wxUSE_TASKBARBUTTON 1 + +// Set to 1 to compile MS Windows XP theme engine support +#define wxUSE_UXTHEME 1 + +// Set to 1 to use InkEdit control (Tablet PC), if available +#define wxUSE_INKEDIT 0 + +// Set to 1 to enable .INI files based wxConfig implementation (wxIniConfig) +// +// Default is 0. +// +// Recommended setting: 0, nobody uses .INI files any more +#define wxUSE_INICONF 0 + +// Set to 0 if you need to include <winsock.h> rather than <winsock2.h> +// +// Default is 1. +// +// Recommended setting: 1, required to be 1 if wxUSE_IPV6 is 1. +#define wxUSE_WINSOCK2 1 + +// ---------------------------------------------------------------------------- +// Generic versions of native controls +// ---------------------------------------------------------------------------- + +// Set this to 1 to be able to use wxDatePickerCtrlGeneric in addition to the +// native wxDatePickerCtrl +// +// Default is 0. +// +// Recommended setting: 0, this is mainly used for testing +#define wxUSE_DATEPICKCTRL_GENERIC 0 + +// Set this to 1 to be able to use wxTimePickerCtrlGeneric in addition to the +// native wxTimePickerCtrl for the platforms that have the latter (MSW). +// +// Default is 0. +// +// Recommended setting: 0, this is mainly used for testing +#define wxUSE_TIMEPICKCTRL_GENERIC 0 + +// ---------------------------------------------------------------------------- +// Crash debugging helpers +// ---------------------------------------------------------------------------- + +// Set this to 1 to use dbghelp.dll for providing stack traces in crash +// reports. +// +// Default is 1 if the compiler supports it, 0 for old MinGW. +// +// Recommended setting: 1, there is not much gain in disabling this +#if defined(__VISUALC__) || defined(__MINGW64_TOOLCHAIN__) + #define wxUSE_DBGHELP 1 +#else + #define wxUSE_DBGHELP 0 +#endif + +// Set this to 1 to be able to use wxCrashReport::Generate() to create mini +// dumps of your program when it crashes (or at any other moment) +// +// Default is 1 if supported by the compiler (VC++ and recent BC++ only). +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_CRASHREPORT 1 +/* --- end MSW options --- */ + +#endif // _WX_SETUP_H_ diff --git a/lib/wxWidgets/include/wx/msw/setup_inc.h b/lib/wxWidgets/include/wx/msw/setup_inc.h new file mode 100644 index 0000000..bd420c2 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/setup_inc.h @@ -0,0 +1,218 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/setup_inc.h +// Purpose: MSW-specific setup.h options +// Author: Vadim Zeitlin +// Created: 2007-07-21 (extracted from wx/msw/setup.h) +// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ---------------------------------------------------------------------------- +// Windows-specific backends choices +// ---------------------------------------------------------------------------- + +// The options here are only taken into account if wxUSE_GRAPHICS_CONTEXT is 1. + +// Enable support for GDI+-based implementation of wxGraphicsContext. +// +// Default is 1. +// +// Recommended setting: 1 if you need to support XP, as Direct2D is not +// available there. +#define wxUSE_GRAPHICS_GDIPLUS wxUSE_GRAPHICS_CONTEXT + +// Enable support for Direct2D-based implementation of wxGraphicsContext. +// +// Default is 1 for compilers which support it, i.e. VC10+ currently. If you +// use an earlier MSVC version or another compiler and installed the necessary +// SDK components manually, you need to change this setting. +// +// Recommended setting: 1 for faster and better quality graphics under Windows +// 7 and later systems (if wxUSE_GRAPHICS_GDIPLUS is also enabled, earlier +// systems will fall back on using GDI+). +#if defined(_MSC_VER) && _MSC_VER >= 1600 + #define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT +#else + #define wxUSE_GRAPHICS_DIRECT2D 0 +#endif + +// wxWebRequest backend based on WinHTTP. +// +// This is only taken into account if wxUSE_WEBREQUEST==1. +// +// Default is 1 if supported by the compiler (MSVS or MinGW64). +// +// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, +// otherwise wxWebRequest won't be available at all. +#define wxUSE_WEBREQUEST_WINHTTP 1 + +// ---------------------------------------------------------------------------- +// Windows-only settings +// ---------------------------------------------------------------------------- + +// Set this to 1 for generic OLE support: this is required for drag-and-drop, +// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and +// can't compile/doesn't have the OLE headers. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_OLE 1 + +// Set this to 1 to enable wxAutomationObject class. +// +// Default is 1. +// +// Recommended setting: 1 if you need to control other applications via OLE +// Automation, can be safely set to 0 otherwise +#define wxUSE_OLE_AUTOMATION 1 + +// Set this to 1 to enable wxActiveXContainer class allowing to embed OLE +// controls in wx. +// +// Default is 1. +// +// Recommended setting: 1, required by wxMediaCtrl +#define wxUSE_ACTIVEX 1 + +// Enable WinRT support +// +// Default is 1 for compilers which support it, i.e. VS2012+ currently. If you +// use an earlier MSVC version or another compiler and installed the necessary +// SDK components manually, you need to change this setting. +// +// Recommended setting: 1 +#if defined(_MSC_VER) && _MSC_VER >= 1700 && !defined(_USING_V110_SDK71_) + #define wxUSE_WINRT 1 +#else + #define wxUSE_WINRT 0 +#endif + +// wxDC caching implementation +#define wxUSE_DC_CACHEING 1 + +// Set this to 1 to enable wxDIB class used internally for manipulating +// wxBitmap data. +// +// Default is 1, set it to 0 only if you don't use wxImage either +// +// Recommended setting: 1 (without it conversion to/from wxImage won't work) +#define wxUSE_WXDIB 1 + +// Set to 0 to disable PostScript print/preview architecture code under Windows +// (just use Windows printing). +#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1 + +// Set this to 1 to compile in wxRegKey class. +// +// Default is 1 +// +// Recommended setting: 1, this is used internally by wx in a few places +#define wxUSE_REGKEY 1 + +// Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH +// which allows to put more than ~32Kb of text in it even under Win9x (NT +// doesn't have such limitation). +// +// Default is 1 for compilers which support it +// +// Recommended setting: 1, only set it to 0 if your compiler doesn't have +// or can't compile <richedit.h> +#define wxUSE_RICHEDIT 1 + +// Set this to 1 to use extra features of richedit v2 and later controls +// +// Default is 1 for compilers which support it +// +// Recommended setting: 1 +#define wxUSE_RICHEDIT2 1 + +// Set this to 1 to enable support for the owner-drawn menu and listboxes. This +// is required by wxUSE_CHECKLISTBOX. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 for a small library size reduction +#define wxUSE_OWNER_DRAWN 1 + +// Set this to 1 to enable MSW-specific wxTaskBarIcon::ShowBalloon() method. It +// is required by native wxNotificationMessage implementation. +// +// Default is 1 but disabled in wx/msw/chkconf.h if SDK is too old to contain +// the necessary declarations. +// +// Recommended setting: 1, set to 0 for a tiny library size reduction +#define wxUSE_TASKBARICON_BALLOONS 1 + +// Set this to 1 to enable following functionality added in Windows 7: thumbnail +// representations, thumbnail toolbars, notification and status overlays, +// progress indicators and jump lists. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 for a tiny library size reduction +#define wxUSE_TASKBARBUTTON 1 + +// Set to 1 to compile MS Windows XP theme engine support +#define wxUSE_UXTHEME 1 + +// Set to 1 to use InkEdit control (Tablet PC), if available +#define wxUSE_INKEDIT 0 + +// Set to 1 to enable .INI files based wxConfig implementation (wxIniConfig) +// +// Default is 0. +// +// Recommended setting: 0, nobody uses .INI files any more +#define wxUSE_INICONF 0 + +// Set to 0 if you need to include <winsock.h> rather than <winsock2.h> +// +// Default is 1. +// +// Recommended setting: 1, required to be 1 if wxUSE_IPV6 is 1. +#define wxUSE_WINSOCK2 1 + +// ---------------------------------------------------------------------------- +// Generic versions of native controls +// ---------------------------------------------------------------------------- + +// Set this to 1 to be able to use wxDatePickerCtrlGeneric in addition to the +// native wxDatePickerCtrl +// +// Default is 0. +// +// Recommended setting: 0, this is mainly used for testing +#define wxUSE_DATEPICKCTRL_GENERIC 0 + +// Set this to 1 to be able to use wxTimePickerCtrlGeneric in addition to the +// native wxTimePickerCtrl for the platforms that have the latter (MSW). +// +// Default is 0. +// +// Recommended setting: 0, this is mainly used for testing +#define wxUSE_TIMEPICKCTRL_GENERIC 0 + +// ---------------------------------------------------------------------------- +// Crash debugging helpers +// ---------------------------------------------------------------------------- + +// Set this to 1 to use dbghelp.dll for providing stack traces in crash +// reports. +// +// Default is 1 if the compiler supports it, 0 for old MinGW. +// +// Recommended setting: 1, there is not much gain in disabling this +#if defined(__VISUALC__) || defined(__MINGW64_TOOLCHAIN__) + #define wxUSE_DBGHELP 1 +#else + #define wxUSE_DBGHELP 0 +#endif + +// Set this to 1 to be able to use wxCrashReport::Generate() to create mini +// dumps of your program when it crashes (or at any other moment) +// +// Default is 1 if supported by the compiler (VC++ and recent BC++ only). +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_CRASHREPORT 1 diff --git a/lib/wxWidgets/include/wx/msw/slider.h b/lib/wxWidgets/include/wx/msw/slider.h new file mode 100644 index 0000000..7aaad33 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/slider.h @@ -0,0 +1,152 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/slider.h +// Purpose: wxSlider class implementation using trackbar control +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SLIDER_H_ +#define _WX_SLIDER_H_ + +class WXDLLIMPEXP_FWD_CORE wxSubwindows; + +// Slider +class WXDLLIMPEXP_CORE wxSlider : public wxSliderBase +{ +public: + wxSlider() { Init(); } + + wxSlider(wxWindow *parent, + wxWindowID id, + int value, + int minValue, + int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxSliderNameStr)) + { + Init(); + + (void)Create(parent, id, value, minValue, maxValue, + pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + int value, + int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxSliderNameStr)); + + virtual ~wxSlider(); + + // slider methods + virtual int GetValue() const wxOVERRIDE; + virtual void SetValue(int) wxOVERRIDE; + + void SetRange(int minValue, int maxValue) wxOVERRIDE; + + int GetMin() const wxOVERRIDE { return m_rangeMin; } + int GetMax() const wxOVERRIDE { return m_rangeMax; } + + // Win32-specific slider methods + int GetTickFreq() const wxOVERRIDE { return m_tickFreq; } + void SetPageSize(int pageSize) wxOVERRIDE; + int GetPageSize() const wxOVERRIDE; + void ClearSel() wxOVERRIDE; + void ClearTicks() wxOVERRIDE; + void SetLineSize(int lineSize) wxOVERRIDE; + int GetLineSize() const wxOVERRIDE; + int GetSelEnd() const wxOVERRIDE; + int GetSelStart() const wxOVERRIDE; + void SetSelection(int minPos, int maxPos) wxOVERRIDE; + void SetThumbLength(int len) wxOVERRIDE; + int GetThumbLength() const wxOVERRIDE; + void SetTick(int tickPos) wxOVERRIDE; + + // implementation only from now on + WXHWND GetStaticMin() const; + WXHWND GetStaticMax() const; + WXHWND GetEditValue() const; + virtual bool ContainsHWND(WXHWND hWnd) const wxOVERRIDE; + + // we should let background show through the slider (and its labels) + virtual bool HasTransparentBackground() wxOVERRIDE { return true; } + + // returns true if the platform should explicitly apply a theme border + virtual bool CanApplyThemeBorder() const wxOVERRIDE { return false; } + + void Command(wxCommandEvent& event) wxOVERRIDE; + virtual bool MSWOnScroll(int orientation, WXWORD wParam, + WXWORD pos, WXHWND control) wxOVERRIDE; + + virtual bool Show(bool show = true) wxOVERRIDE; + virtual bool Enable(bool show = true) wxOVERRIDE; + virtual bool SetFont(const wxFont& font) wxOVERRIDE; + virtual bool SetForegroundColour(const wxColour& colour) wxOVERRIDE; + virtual bool SetBackgroundColour(const wxColour& colour) wxOVERRIDE; + + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const wxOVERRIDE; + +protected: + // common part of all ctors + void Init(); + + // format an integer value as string + static wxString Format(int n) { return wxString::Format(wxT("%d"), n); } + + // get the boundig box for the slider and possible labels + wxRect GetBoundingBox() const; + + // Get the height and, if the pointers are non NULL, widths of both labels. + // + // Notice that the return value will be 0 if we don't have wxSL_LABELS + // style but we do fill widthMin and widthMax even if we don't have + // wxSL_MIN_MAX_LABELS style set so the caller should account for it. + int GetLabelsSize(int *widthMin = NULL, int *widthMax = NULL) const; + + + // overridden base class virtuals + virtual void DoGetPosition(int *x, int *y) const wxOVERRIDE; + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + WXHBRUSH DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd) wxOVERRIDE; + + virtual void MSWUpdateFontOnDPIChange(const wxSize& newDPI) wxOVERRIDE; + + void OnDPIChanged(wxDPIChangedEvent& event); + + // the labels windows, if any + wxSubwindows *m_labels; + + // Last background brush we returned from DoMSWControlColor(), see there. + WXHBRUSH m_hBrushBg; + + int m_rangeMin; + int m_rangeMax; + int m_pageSize; + int m_lineSize; + int m_tickFreq; + + // flag needed to detect whether we're getting THUMBRELEASE event because + // of dragging the thumb or scrolling the mouse wheel + bool m_isDragging; + + // Platform-specific implementation of SetTickFreq + virtual void DoSetTickFreq(int freq) wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxSlider); +}; + +#endif // _WX_SLIDER_H_ + diff --git a/lib/wxWidgets/include/wx/msw/sound.h b/lib/wxWidgets/include/wx/msw/sound.h new file mode 100644 index 0000000..711e066 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/sound.h @@ -0,0 +1,51 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/sound.h +// Purpose: wxSound class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SOUND_H_ +#define _WX_SOUND_H_ + +#if wxUSE_SOUND + +class WXDLLIMPEXP_ADV wxSound : public wxSoundBase +{ +public: + wxSound(); + wxSound(const wxString& fileName, bool isResource = false); + wxSound(size_t size, const void* data); + virtual ~wxSound(); + + // Create from resource or file + bool Create(const wxString& fileName, bool isResource = false); + + // Create from data + bool Create(size_t size, const void* data); + + bool IsOk() const { return m_data != NULL; } + + static void Stop(); + +protected: + void Init() { m_data = NULL; } + bool CheckCreatedOk(); + void Free(); + + virtual bool DoPlay(unsigned flags) const wxOVERRIDE; + +private: + // data of this object + class wxSoundData *m_data; + + wxDECLARE_NO_COPY_CLASS(wxSound); +}; + +#endif // wxUSE_SOUND + +#endif // _WX_SOUND_H_ + diff --git a/lib/wxWidgets/include/wx/msw/spinbutt.h b/lib/wxWidgets/include/wx/msw/spinbutt.h new file mode 100644 index 0000000..64fb1fb --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/spinbutt.h @@ -0,0 +1,76 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/spinbutt.h +// Purpose: wxSpinButton class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SPINBUTT_H_ +#define _WX_SPINBUTT_H_ + +#include "wx/control.h" +#include "wx/event.h" + +#if wxUSE_SPINBTN + +class WXDLLIMPEXP_CORE wxSpinButton : public wxSpinButtonBase +{ +public: + // construction + wxSpinButton() { } + + wxSpinButton(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_VERTICAL | wxSP_ARROW_KEYS, + const wxString& name = wxSPIN_BUTTON_NAME) + { + Create(parent, id, pos, size, style, name); + } + + virtual ~wxSpinButton(); + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_VERTICAL | wxSP_ARROW_KEYS, + const wxString& name = wxSPIN_BUTTON_NAME); + + + // accessors + virtual int GetValue() const wxOVERRIDE; + virtual void SetValue(int val) wxOVERRIDE; + virtual void SetRange(int minVal, int maxVal) wxOVERRIDE; + + // implementation + virtual bool MSWCommand(WXUINT param, WXWORD id) wxOVERRIDE; + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) wxOVERRIDE; + virtual bool MSWOnScroll(int orientation, WXWORD wParam, + WXWORD pos, WXHWND control) wxOVERRIDE; + + // a wxSpinButton can't do anything useful with focus, only wxSpinCtrl can + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } + + // returns true if the platform should explicitly apply a theme border + virtual bool CanApplyThemeBorder() const wxOVERRIDE { return false; } + virtual void SetIncrement(int value) wxOVERRIDE; + virtual int GetIncrement() const wxOVERRIDE; + +protected: + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + // ensure that the control displays a value in the current range + virtual void NormalizeValue(); + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxSpinButton); +}; + +#endif // wxUSE_SPINBTN + +#endif // _WX_SPINBUTT_H_ diff --git a/lib/wxWidgets/include/wx/msw/spinctrl.h b/lib/wxWidgets/include/wx/msw/spinctrl.h new file mode 100644 index 0000000..c350db1 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/spinctrl.h @@ -0,0 +1,189 @@ +//////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/spinctrl.h +// Purpose: wxSpinCtrl class declaration for Win32 +// Author: Vadim Zeitlin +// Modified by: +// Created: 22.07.99 +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_SPINCTRL_H_ +#define _WX_MSW_SPINCTRL_H_ + +#include "wx/spinbutt.h" // the base class + +#if wxUSE_SPINCTRL + +#include "wx/dynarray.h" + +class WXDLLIMPEXP_FWD_CORE wxSpinCtrl; +WX_DEFINE_EXPORTED_ARRAY_PTR(wxSpinCtrl *, wxArraySpins); + +// ---------------------------------------------------------------------------- +// Under Win32, wxSpinCtrl is a wxSpinButton with a buddy (as MSDN docs call +// it) text window whose contents is automatically updated when the spin +// control is clicked. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSpinCtrl : public wxSpinButton +{ +public: + wxSpinCtrl() { Init(); } + + wxSpinCtrl(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + int min = 0, int max = 100, int initial = 0, + const wxString& name = wxT("wxSpinCtrl")) + { + Init(); + + Create(parent, id, value, pos, size, style, min, max, initial, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + int min = 0, int max = 100, int initial = 0, + const wxString& name = wxT("wxSpinCtrl")); + + // a wxTextCtrl-like method (but we can't have GetValue returning wxString + // because the base class already has one returning int!) + void SetValue(const wxString& text); + + // another wxTextCtrl-like method + void SetSelection(long from, long to); + + // wxSpinCtrlBase methods + virtual wxString GetTextValue() const; + virtual int GetBase() const; + virtual bool SetBase(int base); + + virtual void Refresh( bool eraseBackground = true, + const wxRect *rect = (const wxRect *) NULL ) wxOVERRIDE; + + // implementation only from now on + // ------------------------------- + + virtual ~wxSpinCtrl(); + + virtual void SetValue(int val) wxOVERRIDE; + virtual int GetValue() const wxOVERRIDE; + virtual void SetRange(int minVal, int maxVal) wxOVERRIDE; + virtual bool SetFont(const wxFont &font) wxOVERRIDE; + + virtual bool Enable(bool enable = true) wxOVERRIDE; + virtual bool Show(bool show = true) wxOVERRIDE; + + virtual bool Reparent(wxWindowBase *newParent) wxOVERRIDE; + + // wxSpinButton doesn't accept focus, but we do + virtual bool AcceptsFocus() const wxOVERRIDE { return wxWindow::AcceptsFocus(); } + + // we're like wxTextCtrl and not (default) wxButton + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL) + { + return GetCompositeControlsDefaultAttributes(variant); + } + + // for internal use only + + // get the subclassed window proc of the buddy text + WXWNDPROC GetBuddyWndProc() const { return m_wndProcBuddy; } + + // return the spinctrl object whose buddy is the given window or NULL + static wxSpinCtrl *GetSpinForTextCtrl(WXHWND hwndBuddy); + + // process a WM_COMMAND generated by the buddy text control + bool ProcessTextCommand(WXWORD cmd, WXWORD id); + + // recognize buddy window as part of this control at wx level + virtual bool ContainsHWND(WXHWND hWnd) const wxOVERRIDE { return hWnd == m_hwndBuddy; } + + virtual void SetLayoutDirection(wxLayoutDirection dir) wxOVERRIDE; + + virtual WXHWND MSWGetFocusHWND() const wxOVERRIDE; + +protected: + virtual void DoGetPosition(int *x, int *y) const wxOVERRIDE; + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const wxOVERRIDE; + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; + virtual void DoGetClientSize(int *x, int *y) const wxOVERRIDE; + virtual void DoClientToScreen(int *x, int *y) const wxOVERRIDE; + virtual void DoScreenToClient(int *x, int *y) const wxOVERRIDE; +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip( wxToolTip *tip ) wxOVERRIDE; +#endif // wxUSE_TOOLTIPS + + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) wxOVERRIDE; + virtual bool MSWOnScroll(int orientation, WXWORD wParam, + WXWORD pos, WXHWND control) wxOVERRIDE; + virtual void MSWUpdateFontOnDPIChange(const wxSize& newDPI) wxOVERRIDE; + + // handle processing of special keys + void OnChar(wxKeyEvent& event); + void OnSetFocus(wxFocusEvent& event); + void OnKillFocus(wxFocusEvent& event); + + // returns true for special keys like "Ctrl+C" that should be handled + // by the text control + virtual bool MSWShouldPreProcessMessage(WXMSG* msg) wxOVERRIDE; + + // generate spin control update event with the given value + void SendSpinUpdate(int value); + + // called to ensure that the value is in the correct range + virtual void NormalizeValue() wxOVERRIDE; + + // the value of the control before the latest change (which might not have + // changed anything in fact -- this is why we need this field) + int m_oldValue; + + // the data for the "buddy" text ctrl + WXHWND m_hwndBuddy; + WXWNDPROC m_wndProcBuddy; + + // Block text update event after SetValue() + bool m_blockEvent; + +private: + // Common part of all ctors. + void Init(); + + // Adjust the text control style depending on whether we need to enter only + // digits or may need to enter something else (e.g. "-" sign, "x" + // hexadecimal prefix, ...) in it. + void UpdateBuddyStyle(); + + // Determine the (horizontal) pixel overlap between the spin button + // (up-down control) and the text control (buddy window). + int GetOverlap() const; + + // Calculate the best size for the number with the given number of digits. + wxSize GetBestSizeFromDigitsCount(int digitsCount) const; + + wxDECLARE_DYNAMIC_CLASS(wxSpinCtrl); + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxSpinCtrl); +}; + +#endif // wxUSE_SPINCTRL + +#endif // _WX_MSW_SPINCTRL_H_ + + diff --git a/lib/wxWidgets/include/wx/msw/stackwalk.h b/lib/wxWidgets/include/wx/msw/stackwalk.h new file mode 100644 index 0000000..f76e76f --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/stackwalk.h @@ -0,0 +1,111 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/stackwalk.h +// Purpose: wxStackWalker for MSW +// Author: Vadim Zeitlin +// Modified by: +// Created: 2005-01-08 +// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_STACKWALK_H_ +#define _WX_MSW_STACKWALK_H_ + +#include "wx/arrstr.h" + +// these structs are declared in windows headers +struct _CONTEXT; +struct _EXCEPTION_POINTERS; + +// and these in dbghelp.h +struct _SYMBOL_INFO; +struct _SYMBOL_INFOW; + +#if wxUSE_UNICODE + #define wxSYMBOL_INFO _SYMBOL_INFOW +#else // !wxUSE_UNICODE + #define wxSYMBOL_INFO _SYMBOL_INFO +#endif // wxUSE_UNICODE/!wxUSE_UNICODE + +// ---------------------------------------------------------------------------- +// wxStackFrame +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStackFrame : public wxStackFrameBase +{ +private: + wxStackFrame *ConstCast() const + { return const_cast<wxStackFrame *>(this); } + + size_t DoGetParamCount() const { return m_paramTypes.GetCount(); } + +public: + wxStackFrame(size_t level, void *address, size_t addrFrame) + : wxStackFrameBase(level, address) + { + m_hasName = + m_hasLocation = false; + + m_addrFrame = addrFrame; + } + + virtual size_t GetParamCount() const wxOVERRIDE + { + ConstCast()->OnGetParam(); + return DoGetParamCount(); + } + + virtual bool + GetParam(size_t n, wxString *type, wxString *name, wxString *value) const wxOVERRIDE; + + // callback used by OnGetParam(), don't call directly + void OnParam(wxSYMBOL_INFO *pSymInfo); + +protected: + virtual void OnGetName() wxOVERRIDE; + virtual void OnGetLocation() wxOVERRIDE; + + void OnGetParam(); + + + // helper for debug API: it wants to have addresses as DWORDs + size_t GetSymAddr() const + { + return reinterpret_cast<size_t>(m_address); + } + +private: + bool m_hasName, + m_hasLocation; + + size_t m_addrFrame; + + wxArrayString m_paramTypes, + m_paramNames, + m_paramValues; +}; + +// ---------------------------------------------------------------------------- +// wxStackWalker +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStackWalker : public wxStackWalkerBase +{ +public: + // we don't use ctor argument, it is for compatibility with Unix version + // only + wxStackWalker(const char * WXUNUSED(argv0) = NULL) { } + + virtual void Walk(size_t skip = 1, size_t maxDepth = wxSTACKWALKER_MAX_DEPTH) wxOVERRIDE; +#if wxUSE_ON_FATAL_EXCEPTION + virtual void WalkFromException(size_t maxDepth = wxSTACKWALKER_MAX_DEPTH) wxOVERRIDE; +#endif // wxUSE_ON_FATAL_EXCEPTION + + + // enumerate stack frames from the given context + void WalkFrom(const _CONTEXT *ctx, size_t skip = 1, size_t maxDepth = wxSTACKWALKER_MAX_DEPTH); + void WalkFrom(const _EXCEPTION_POINTERS *ep, size_t skip = 1, size_t maxDepth = wxSTACKWALKER_MAX_DEPTH); +}; + +#endif // _WX_MSW_STACKWALK_H_ + diff --git a/lib/wxWidgets/include/wx/msw/statbmp.h b/lib/wxWidgets/include/wx/msw/statbmp.h new file mode 100644 index 0000000..3843435 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/statbmp.h @@ -0,0 +1,147 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/statbmp.h +// Purpose: wxStaticBitmap class for wxMSW +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATBMP_H_ +#define _WX_STATBMP_H_ + +#include "wx/control.h" +#include "wx/icon.h" +#include "wx/bitmap.h" + +extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticBitmapNameStr[]; + +// a control showing an icon or a bitmap +class WXDLLIMPEXP_CORE wxStaticBitmap : public wxStaticBitmapBase +{ +public: + wxStaticBitmap() { Init(); } + + wxStaticBitmap(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBitmapNameStr)) + { + Init(); + + Create(parent, id, label, pos, size, style, name); + } + + wxStaticBitmap(wxWindow *parent, + wxWindowID id, + const wxIcon& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBitmapNameStr)) + { + Init(); + + Create(parent, id, label, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBitmapNameStr)) + { + m_bitmapBundle = label; + + return DoCreate(parent, id, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxIcon& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBitmapNameStr)) + { + m_icon = label; + + return DoCreate(parent, id, pos, size, style, name); + } + + virtual ~wxStaticBitmap() { Free(); } + + virtual void SetIcon(const wxIcon& icon) wxOVERRIDE; + virtual void SetBitmap(const wxBitmapBundle& bitmap) wxOVERRIDE; + virtual wxBitmap GetBitmap() const wxOVERRIDE; + virtual wxIcon GetIcon() const wxOVERRIDE; + + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const wxOVERRIDE; + + // returns true if the platform should explicitly apply a theme border + virtual bool CanApplyThemeBorder() const wxOVERRIDE { return false; } + +protected: + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + +private: + // ctor/dtor helpers + void Init(); + void Free(); + + // common part of both Create() overloads + bool DoCreate(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name); + + // update the image to correspond to the current m_icon or m_bitmapBundle + // value, resize the control if the new size is different from the old one + // and update its style if the new "is icon" value differs from the old one + void DoUpdateImage(const wxSize& sizeOld, bool wasIcon); + + // draw the bitmap ourselves here if the OS can't do it correctly (if it + // can we leave it to it) + void DoPaintManually(wxPaintEvent& event); + + // event handlers + void WXHandleSize(wxSizeEvent& event); + void WXHandleDPIChanged(wxDPIChangedEvent& event); + + // return the size of m_icon or the appropriate size of m_bitmapBundle at + // the current DPI scaling (may still be invalid of both of them are) + wxSize GetImageSize() const; + + + // we can have either an icon or a bitmap: if m_icon is valid, it is used, + // otherwise we use m_bitmap which is itself obtained from m_bitmapBundle + // defined in the base class + wxIcon m_icon; + wxBitmap m_bitmap; + + // handle used in last call to STM_SETIMAGE + WXHANDLE m_currentHandle; + + // Flag indicating whether we own m_currentHandle, i.e. should delete it. + bool m_ownsCurrentHandle; + + // Replace the image at the native control level with the given HBITMAP or + // HICON (which can be 0) and destroy the previous image if necessary. + void MSWReplaceImageHandle(WXHANDLE handle); + + + wxDECLARE_DYNAMIC_CLASS(wxStaticBitmap); + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxStaticBitmap); +}; + +#endif + // _WX_STATBMP_H_ diff --git a/lib/wxWidgets/include/wx/msw/statbox.h b/lib/wxWidgets/include/wx/msw/statbox.h new file mode 100644 index 0000000..1d92865 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/statbox.h @@ -0,0 +1,107 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/statbox.h +// Purpose: wxStaticBox class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_STATBOX_H_ +#define _WX_MSW_STATBOX_H_ + +#include "wx/compositewin.h" + +// Group box +class WXDLLIMPEXP_CORE wxStaticBox : public wxCompositeWindowSettersOnly<wxStaticBoxBase> +{ +public: + wxStaticBox() + : wxCompositeWindowSettersOnly<wxStaticBoxBase>() + { + } + + wxStaticBox(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBoxNameStr)) + : wxCompositeWindowSettersOnly<wxStaticBoxBase>() + { + Create(parent, id, label, pos, size, style, name); + } + + wxStaticBox(wxWindow* parent, wxWindowID id, + wxWindow* label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString &name = wxASCII_STR(wxStaticBoxNameStr)) + : wxCompositeWindowSettersOnly<wxStaticBoxBase>() + { + Create(parent, id, label, pos, size, style, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBoxNameStr)); + + bool Create(wxWindow *parent, wxWindowID id, + wxWindow* label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBoxNameStr)); + + /// Implementation only + virtual void GetBordersForSizer(int *borderTop, int *borderOther) const wxOVERRIDE; + + virtual bool SetBackgroundColour(const wxColour& colour) wxOVERRIDE; + virtual bool SetFont(const wxFont& font) wxOVERRIDE; + + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const wxOVERRIDE; + + // returns true if the platform should explicitly apply a theme border + virtual bool CanApplyThemeBorder() const wxOVERRIDE { return false; } + +protected: + virtual wxSize DoGetBestSize() const wxOVERRIDE; + +public: + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) wxOVERRIDE; + +protected: + virtual wxWindowList GetCompositeWindowParts() const wxOVERRIDE; + + // return the region with all the windows inside this static box excluded + virtual WXHRGN MSWGetRegionWithoutChildren(); + + // remove the parts which are painted by static box itself from the given + // region which is embedded in a rectangle (0, 0)-(w, h) + virtual void MSWGetRegionWithoutSelf(WXHRGN hrgn, int w, int h); + + // paint the given rectangle with our background brush/colour + virtual void PaintBackground(wxDC& dc, const struct tagRECT& rc); + // paint the foreground of the static box + virtual void PaintForeground(wxDC& dc, const struct tagRECT& rc); + + void OnPaint(wxPaintEvent& event); + +private: + void OnDPIChanged(wxDPIChangedEvent& event); + + void PositionLabelWindow(); + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticBox); +}; + +// Indicate that we have the ctor overload taking wxWindow as label. +#define wxHAS_WINDOW_LABEL_IN_STATIC_BOX + +#endif // _WX_MSW_STATBOX_H_ + diff --git a/lib/wxWidgets/include/wx/msw/statline.h b/lib/wxWidgets/include/wx/msw/statline.h new file mode 100644 index 0000000..e90dd61 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/statline.h @@ -0,0 +1,51 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/statline.h +// Purpose: MSW version of wxStaticLine class +// Author: Vadim Zeitlin +// Created: 28.06.99 +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_STATLINE_H_ +#define _WX_MSW_STATLINE_H_ + +// ---------------------------------------------------------------------------- +// wxStaticLine +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxStaticLine : public wxStaticLineBase +{ +public: + // constructors and pseudo-constructors + wxStaticLine() { } + + wxStaticLine( wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxASCII_STR(wxStaticLineNameStr) ) + { + Create(parent, id, pos, size, style, name); + } + + bool Create( wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxASCII_STR(wxStaticLineNameStr) ); + + // overridden base class virtuals + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } + + // usually overridden base class virtuals + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticLine); +}; + +#endif // _WX_MSW_STATLINE_H_ + + diff --git a/lib/wxWidgets/include/wx/msw/stattext.h b/lib/wxWidgets/include/wx/msw/stattext.h new file mode 100644 index 0000000..82687f2 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/stattext.h @@ -0,0 +1,57 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/stattext.h +// Purpose: wxStaticText class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATTEXT_H_ +#define _WX_STATTEXT_H_ + +class WXDLLIMPEXP_CORE wxStaticText : public wxStaticTextBase +{ +public: + wxStaticText() { } + + wxStaticText(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticTextNameStr)) + { + Create(parent, id, label, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticTextNameStr)); + + // override some methods to resize the window properly + virtual void SetLabel(const wxString& label) wxOVERRIDE; + virtual bool SetFont( const wxFont &font ) wxOVERRIDE; + + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const wxOVERRIDE; + +protected: + // implement/override some base class virtuals + virtual void DoSetSize(int x, int y, int w, int h, + int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + + virtual wxString WXGetVisibleLabel() const wxOVERRIDE; + virtual void WXSetVisibleLabel(const wxString& str) wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticText); +}; + +#endif + // _WX_STATTEXT_H_ diff --git a/lib/wxWidgets/include/wx/msw/statusbar.h b/lib/wxWidgets/include/wx/msw/statusbar.h new file mode 100644 index 0000000..bc554e9 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/statusbar.h @@ -0,0 +1,113 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/statusbar.h +// Purpose: native implementation of wxStatusBar +// Author: Vadim Zeitlin +// Modified by: +// Created: 04.04.98 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_STATUSBAR_H_ +#define _WX_MSW_STATUSBAR_H_ + +#if wxUSE_NATIVE_STATUSBAR + +#include "wx/vector.h" +#include "wx/tooltip.h" + +class WXDLLIMPEXP_FWD_CORE wxClientDC; + +class WXDLLIMPEXP_CORE wxStatusBar : public wxStatusBarBase +{ +public: + // ctors and such + wxStatusBar(); + wxStatusBar(wxWindow *parent, + wxWindowID id = wxID_ANY, + long style = wxSTB_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxStatusBarNameStr)) + { + m_pDC = NULL; + (void)Create(parent, id, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + long style = wxSTB_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxStatusBarNameStr)); + + virtual ~wxStatusBar(); + + // implement base class methods + virtual void SetFieldsCount(int number = 1, const int *widths = NULL) wxOVERRIDE; + virtual void SetStatusWidths(int n, const int widths_field[]) wxOVERRIDE; + virtual void SetStatusStyles(int n, const int styles[]) wxOVERRIDE; + virtual void SetMinHeight(int height) wxOVERRIDE; + virtual bool GetFieldRect(int i, wxRect& rect) const wxOVERRIDE; + + virtual int GetBorderX() const wxOVERRIDE; + virtual int GetBorderY() const wxOVERRIDE; + + // override some wxWindow virtual methods too + virtual bool SetFont(const wxFont& font) wxOVERRIDE; + + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, + WXWPARAM wParam, + WXLPARAM lParam) wxOVERRIDE; + +protected: + // implement base class pure virtual method + virtual void DoUpdateStatusText(int number) wxOVERRIDE; + + // override some base class virtuals + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const wxOVERRIDE; + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; +#if wxUSE_TOOLTIPS + virtual bool MSWProcessMessage(WXMSG* pMsg) wxOVERRIDE; + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM* result) wxOVERRIDE; +#endif + + // implementation of the public SetStatusWidths() + void MSWUpdateFieldsWidths(); + + virtual void MSWUpdateFontOnDPIChange(const wxSize& newDPI) wxOVERRIDE; + + // used by DoUpdateStatusText() + wxClientDC *m_pDC; + +#if wxUSE_TOOLTIPS + // the tooltips used when wxSTB_SHOW_TIPS is given + wxVector<wxToolTip*> m_tooltips; +#endif + +private: + struct MSWBorders + { + int horz, + vert, + between; + }; + + // retrieve all status bar borders using SB_GETBORDERS + MSWBorders MSWGetBorders() const; + + // return the size of the border between the fields + int MSWGetBorderWidth() const; + + struct MSWMetrics + { + int gripWidth, + textMargin; + }; + + // return the various status bar metrics + static const MSWMetrics& MSWGetMetrics(); + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxStatusBar); +}; + +#endif // wxUSE_NATIVE_STATUSBAR + +#endif // _WX_MSW_STATUSBAR_H_ diff --git a/lib/wxWidgets/include/wx/msw/stdpaths.h b/lib/wxWidgets/include/wx/msw/stdpaths.h new file mode 100644 index 0000000..bfddf16 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/stdpaths.h @@ -0,0 +1,102 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/stdpaths.h +// Purpose: wxStandardPaths for Win32 +// Author: Vadim Zeitlin +// Modified by: +// Created: 2004-10-19 +// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_STDPATHS_H_ +#define _WX_MSW_STDPATHS_H_ + +struct _GUID; + +// ---------------------------------------------------------------------------- +// wxStandardPaths +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStandardPaths : public wxStandardPathsBase +{ +public: + // implement base class pure virtuals + virtual wxString GetExecutablePath() const wxOVERRIDE; + virtual wxString GetConfigDir() const wxOVERRIDE; + virtual wxString GetUserConfigDir() const wxOVERRIDE; + virtual wxString GetDataDir() const wxOVERRIDE; + virtual wxString GetUserDataDir() const wxOVERRIDE; + virtual wxString GetUserLocalDataDir() const wxOVERRIDE; + virtual wxString GetPluginsDir() const wxOVERRIDE; + virtual wxString GetUserDir(Dir userDir) const wxOVERRIDE; + virtual wxString MakeConfigFileName(const wxString& basename, + ConfigFileConv conv = ConfigFileConv_Ext + ) const wxOVERRIDE; + + + // MSW-specific methods + + // This class supposes that data, plugins &c files are located under the + // program directory which is the directory containing the application + // binary itself. But sometimes this binary may be in a subdirectory of the + // main program directory, e.g. this happens in at least the following + // common cases: + // 1. The program is in "bin" subdirectory of the installation directory. + // 2. The program is in "debug" subdirectory of the directory containing + // sources and data files during development + // + // By calling this function you instruct the class to remove the last + // component of the path if it matches its argument. Notice that it may be + // called more than once, e.g. you can call both IgnoreAppSubDir("bin") and + // IgnoreAppSubDir("debug") to take care of both production and development + // cases above but that each call will only remove the last path component. + // Finally note that the argument can contain wild cards so you can also + // call IgnoreAppSubDir("vc*msw*") to ignore all build directories at once + // when using wxWidgets-inspired output directories names. + void IgnoreAppSubDir(const wxString& subdirPattern); + + // This function is used to ignore all common build directories and is + // called from the ctor -- use DontIgnoreAppSubDir() to undo this. + void IgnoreAppBuildSubDirs(); + + // Undo the effects of all preceding IgnoreAppSubDir() calls. + void DontIgnoreAppSubDir(); + + + // Returns the directory corresponding to the specified Windows shell CSIDL + static wxString MSWGetShellDir(int csidl); + +protected: + // Ctor is protected, use wxStandardPaths::Get() instead of instantiating + // objects of this class directly. + // + // It calls IgnoreAppBuildSubDirs() and also sets up the object to use + // both vendor and application name by default. + wxStandardPaths(); + + // get the path corresponding to the given standard CSIDL_XXX constant + static wxString DoGetDirectory(int csidl); + + static wxString DoGetKnownFolder(const _GUID& rfid); + + // return the directory of the application itself + wxString GetAppDir() const; + + // directory returned by GetAppDir() + mutable wxString m_appDir; +}; + +// ---------------------------------------------------------------------------- +// wxStandardPathsWin16: this class is for internal use only +// ---------------------------------------------------------------------------- + +// override config file locations to be compatible with the values used by +// wxFileConfig (dating from Win16 days which explains the class name) +class WXDLLIMPEXP_BASE wxStandardPathsWin16 : public wxStandardPaths +{ +public: + virtual wxString GetConfigDir() const wxOVERRIDE; + virtual wxString GetUserConfigDir() const wxOVERRIDE; +}; + +#endif // _WX_MSW_STDPATHS_H_ diff --git a/lib/wxWidgets/include/wx/msw/subwin.h b/lib/wxWidgets/include/wx/msw/subwin.h new file mode 100644 index 0000000..038bf30 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/subwin.h @@ -0,0 +1,250 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/subwin.h +// Purpose: helper for implementing the controls with subwindows +// Author: Vadim Zeitlin +// Modified by: +// Created: 2004-12-11 +// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_SUBWIN_H_ +#define _WX_MSW_SUBWIN_H_ + +#include "wx/msw/private.h" + +// ---------------------------------------------------------------------------- +// wxSubwindows contains all HWNDs making part of a single wx control +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSubwindows +{ +public: + // the number of subwindows can be specified either as parameter to ctor or + // later in Create() + wxSubwindows(size_t n = 0) { Init(); if ( n ) Create(n); } + + // allocate enough space for the given number of windows + void Create(size_t n) + { + wxASSERT_MSG( !m_hwnds, wxT("Create() called twice?") ); + + m_count = n; + m_hwnds = (HWND *)calloc(n, sizeof(HWND)); + m_ids = new wxWindowIDRef[n]; + } + + // non-virtual dtor, this class is not supposed to be used polymorphically + ~wxSubwindows() + { + for ( size_t n = 0; n < m_count; n++ ) + { + if ( m_hwnds[n] ) + ::DestroyWindow(m_hwnds[n]); + } + + free(m_hwnds); + delete [] m_ids; + } + + // get the number of subwindows + size_t GetCount() const { return m_count; } + + // access a given window + HWND& Get(size_t n) + { + wxASSERT_MSG( n < m_count, wxT("subwindow index out of range") ); + + return m_hwnds[n]; + } + + HWND operator[](size_t n) const + { + return const_cast<wxSubwindows *>(this)->Get(n); + } + + // initialize the given window: id will be stored in wxWindowIDRef ensuring + // that it is not reused while this object exists + void Set(size_t n, HWND hwnd, wxWindowID id) + { + wxASSERT_MSG( n < m_count, wxT("subwindow index out of range") ); + + m_hwnds[n] = hwnd; + m_ids[n] = id; + } + + // check if we have this window + bool HasWindow(HWND hwnd) + { + for ( size_t n = 0; n < m_count; n++ ) + { + if ( m_hwnds[n] == hwnd ) + return true; + } + + return false; + } + + + // methods which are forwarded to all subwindows + // --------------------------------------------- + + // show/hide everything + void Show(bool show) + { + int sw = show ? SW_SHOW : SW_HIDE; + for ( size_t n = 0; n < m_count; n++ ) + { + if ( m_hwnds[n] ) + ::ShowWindow(m_hwnds[n], sw); + } + } + + // enable/disable everything + void Enable(bool enable) + { + for ( size_t n = 0; n < m_count; n++ ) + { + if ( m_hwnds[n] ) + ::EnableWindow(m_hwnds[n], enable); + } + } + + // set font for all windows + void SetFont(const wxFont& font) + { + for ( size_t n = 0; n < m_count; n++ ) + { + if ( m_hwnds[n] ) + { + wxSetWindowFont(m_hwnds[n], font); + + // otherwise the window might not be redrawn correctly + ::InvalidateRect(m_hwnds[n], NULL, FALSE /* don't erase bg */); + } + } + } + + // add all windows to update region to force redraw + void Refresh() + { + for ( size_t n = 0; n < m_count; n++ ) + { + if ( m_hwnds[n] ) + { + ::InvalidateRect(m_hwnds[n], NULL, FALSE /* don't erase bg */); + } + } + } + + // find the bounding box for all windows + wxRect GetBoundingBox() const + { + wxRect r; + for ( size_t n = 0; n < m_count; n++ ) + { + if ( m_hwnds[n] ) + { + RECT rc; + + ::GetWindowRect(m_hwnds[n], &rc); + + r.Union(wxRectFromRECT(rc)); + } + } + + return r; + } + +private: + void Init() + { + m_count = 0; + m_hwnds = NULL; + m_ids = NULL; + } + + // number of elements in m_hwnds array + size_t m_count; + + // the HWNDs we contain + HWND *m_hwnds; + + // the IDs of the windows + wxWindowIDRef *m_ids; + + + wxDECLARE_NO_COPY_CLASS(wxSubwindows); +}; + +// convenient macro to forward a few methods which are usually propagated to +// subwindows to a wxSubwindows object +// +// parameters should be: +// - cname the name of the class implementing these methods +// - base the name of its base class +// - subwins the name of the member variable of type wxSubwindows * +#define WX_FORWARD_STD_METHODS_TO_SUBWINDOWS(cname, base, subwins) \ + bool cname::ContainsHWND(WXHWND hWnd) const \ + { \ + return subwins && subwins->HasWindow((HWND)hWnd); \ + } \ + \ + bool cname::Show(bool show) \ + { \ + if ( !base::Show(show) ) \ + return false; \ + \ + if ( subwins ) \ + subwins->Show(show); \ + \ + return true; \ + } \ + \ + bool cname::Enable(bool enable) \ + { \ + if ( !base::Enable(enable) ) \ + return false; \ + \ + if ( subwins ) \ + subwins->Enable(enable); \ + \ + return true; \ + } \ + \ + bool cname::SetFont(const wxFont& font) \ + { \ + if ( !base::SetFont(font) ) \ + return false; \ + \ + if ( subwins ) \ + subwins->SetFont(font); \ + \ + return true; \ + } \ + \ + bool cname::SetForegroundColour(const wxColour& colour) \ + { \ + if ( !base::SetForegroundColour(colour) ) \ + return false; \ + \ + if ( subwins ) \ + subwins->Refresh(); \ + \ + return true; \ + } \ + \ + bool cname::SetBackgroundColour(const wxColour& colour) \ + { \ + if ( !base::SetBackgroundColour(colour) ) \ + return false; \ + \ + if ( subwins ) \ + subwins->Refresh(); \ + \ + return true; \ + } \ + + +#endif // _WX_MSW_SUBWIN_H_ + diff --git a/lib/wxWidgets/include/wx/msw/taskbar.h b/lib/wxWidgets/include/wx/msw/taskbar.h new file mode 100644 index 0000000..0a8f2b4 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/taskbar.h @@ -0,0 +1,93 @@ +///////////////////////////////////////////////////////////////////////// +// File: wx/msw/taskbar.h +// Purpose: Defines wxTaskBarIcon class for manipulating icons on the +// Windows task bar. +// Author: Julian Smart +// Modified by: Vaclav Slavik +// Created: 24/3/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TASKBAR_H_ +#define _WX_TASKBAR_H_ + +#include "wx/bmpbndl.h" +#include "wx/icon.h" + +// private helper class: +class WXDLLIMPEXP_FWD_CORE wxTaskBarIconWindow; + +class WXDLLIMPEXP_CORE wxTaskBarIcon : public wxTaskBarIconBase +{ +public: + wxTaskBarIcon(wxTaskBarIconType iconType = wxTBI_DEFAULT_TYPE); + virtual ~wxTaskBarIcon(); + + // Accessors + bool IsOk() const { return true; } + bool IsIconInstalled() const { return m_iconAdded; } + + // Operations + bool SetIcon(const wxBitmapBundle& icon, const wxString& tooltip = wxEmptyString) wxOVERRIDE; + bool RemoveIcon() wxOVERRIDE; + bool PopupMenu(wxMenu *menu) wxOVERRIDE; + + // MSW-specific class methods + +#if wxUSE_TASKBARICON_BALLOONS + // show a balloon notification (the icon must have been already initialized + // using SetIcon) + // + // title and text are limited to 63 and 255 characters respectively, msec + // is the timeout, in milliseconds, before the balloon disappears (will be + // clamped down to the allowed 10-30s range by Windows if it's outside it) + // and flags can include wxICON_ERROR/INFO/WARNING to show a corresponding + // icon + // + // return true if balloon was shown, false on error (incorrect parameters + // or function unsupported by OS) + bool ShowBalloon(const wxString& title, + const wxString& text, + unsigned msec = 0, + int flags = 0, + const wxBitmapBundle& icon = wxBitmapBundle()); +#endif // wxUSE_TASKBARICON_BALLOONS + +protected: + friend class wxTaskBarIconWindow; + + long WindowProc(unsigned int msg, unsigned int wParam, long lParam); + void RegisterWindowMessages(); + + + wxTaskBarIconWindow *m_win; + bool m_iconAdded; + + // The resolution-independent icon specified by the application. + wxBitmapBundle m_icon; + + // The currently used icons. + wxIcon m_realIcon; + wxIcon m_balloonIcon; + + wxString m_strTooltip; + +private: + enum Operation + { + Operation_Add, + Operation_Modify, + Operation_TryBoth + }; + + // Implementation of the public SetIcon() which may also be used when we + // don't know if we should add a new icon or modify the existing one. + bool DoSetIcon(const wxBitmapBundle& icon, + const wxString& tooltip, + Operation operation); + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTaskBarIcon); +}; + +#endif // _WX_TASKBAR_H_ diff --git a/lib/wxWidgets/include/wx/msw/taskbarbutton.h b/lib/wxWidgets/include/wx/msw/taskbarbutton.h new file mode 100644 index 0000000..ed24df0 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/taskbarbutton.h @@ -0,0 +1,75 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/msw/taskbarbutton.h +// Purpose: Defines wxTaskBarButtonImpl class. +// Author: Chaobin Zhang <zhchbin@gmail.com> +// Created: 2014-06-01 +// Copyright: (c) 2014 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_TASKBARBUTTON_H_ +#define _WX_MSW_TASKBARBUTTON_H_ + +#include "wx/defs.h" + +#if wxUSE_TASKBARBUTTON + +#include "wx/vector.h" +#include "wx/taskbarbutton.h" + +class WXDLLIMPEXP_FWD_CORE wxITaskbarList3; + +class WXDLLIMPEXP_CORE wxTaskBarButtonImpl : public wxTaskBarButton +{ +public: + virtual ~wxTaskBarButtonImpl(); + + virtual void SetProgressRange(int range) wxOVERRIDE; + virtual void SetProgressValue(int value) wxOVERRIDE; + virtual void PulseProgress() wxOVERRIDE; + virtual void Show(bool show = true) wxOVERRIDE; + virtual void Hide() wxOVERRIDE; + virtual void SetThumbnailTooltip(const wxString& tooltip) wxOVERRIDE; + virtual void SetProgressState(wxTaskBarButtonState state) wxOVERRIDE; + virtual void SetOverlayIcon(const wxIcon& icon, + const wxString& description = wxString()) wxOVERRIDE; + virtual void SetThumbnailClip(const wxRect& rect) wxOVERRIDE; + virtual void SetThumbnailContents(const wxWindow *child) wxOVERRIDE; + virtual bool InsertThumbBarButton(size_t pos, + wxThumbBarButton *button) wxOVERRIDE; + virtual bool AppendThumbBarButton(wxThumbBarButton *button) wxOVERRIDE; + virtual bool AppendSeparatorInThumbBar() wxOVERRIDE; + virtual wxThumbBarButton* RemoveThumbBarButton( + wxThumbBarButton *button) wxOVERRIDE; + virtual wxThumbBarButton* RemoveThumbBarButton(int id) wxOVERRIDE; + wxThumbBarButton* GetThumbBarButtonByIndex(size_t index); + bool InitOrUpdateThumbBarButtons(); + virtual void Realize() wxOVERRIDE; + +private: + // This ctor is only used by wxTaskBarButton::New() + wxTaskBarButtonImpl(wxITaskbarList3* taskbarList, wxWindow* parent); + + wxWindow* m_parent; + wxITaskbarList3 *m_taskbarList; + + typedef wxVector<wxThumbBarButton*> wxThumbBarButtons; + wxThumbBarButtons m_thumbBarButtons; + + int m_progressRange; + int m_progressValue; + wxTaskBarButtonState m_progressState; + wxString m_thumbnailTooltip; + wxIcon m_overlayIcon; + wxString m_overlayIconDescription; + wxRect m_thumbnailClipRect; + bool m_hasInitThumbnailToolbar; + + friend wxTaskBarButton* wxTaskBarButton::New(wxWindow*); + + wxDECLARE_NO_COPY_CLASS(wxTaskBarButtonImpl); +}; + +#endif // wxUSE_TASKBARBUTTON + +#endif // _WX_MSW_TASKBARBUTTON_H_ diff --git a/lib/wxWidgets/include/wx/msw/textctrl.h b/lib/wxWidgets/include/wx/msw/textctrl.h new file mode 100644 index 0000000..690dfe0 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/textctrl.h @@ -0,0 +1,336 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/textctrl.h +// Purpose: wxTextCtrl class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TEXTCTRL_H_ +#define _WX_TEXTCTRL_H_ + +class WXDLLIMPEXP_CORE wxTextCtrl : public wxTextCtrlBase +{ +public: + // creation + // -------- + + wxTextCtrl(); + wxTextCtrl(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxTextCtrlNameStr)); + virtual ~wxTextCtrl(); + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxTextCtrlNameStr)); + + // overridden wxTextEntry methods + // ------------------------------ + + virtual wxString GetValue() const wxOVERRIDE; + virtual wxString GetRange(long from, long to) const wxOVERRIDE; + + virtual bool IsEmpty() const; + + virtual void WriteText(const wxString& text) wxOVERRIDE; + virtual void AppendText(const wxString& text) wxOVERRIDE; + virtual void Clear() wxOVERRIDE; + + virtual int GetLineLength(long lineNo) const wxOVERRIDE; + virtual wxString GetLineText(long lineNo) const wxOVERRIDE; + virtual int GetNumberOfLines() const wxOVERRIDE; + + virtual void SetMaxLength(unsigned long len) wxOVERRIDE; + + virtual void GetSelection(long *from, long *to) const wxOVERRIDE; + + virtual void Paste() wxOVERRIDE; + + virtual void Redo() wxOVERRIDE; + virtual bool CanRedo() const wxOVERRIDE; +#if wxUSE_RICHEDIT + virtual void EmptyUndoBuffer() wxOVERRIDE; +#endif // wxUSE_RICHEDIT + + virtual void SetInsertionPointEnd() wxOVERRIDE; + virtual long GetInsertionPoint() const wxOVERRIDE; + virtual wxTextPos GetLastPosition() const wxOVERRIDE; + + // implement base class pure virtuals + // ---------------------------------- + + virtual bool IsModified() const wxOVERRIDE; + virtual void MarkDirty() wxOVERRIDE; + virtual void DiscardEdits() wxOVERRIDE; + + virtual bool EmulateKeyPress(const wxKeyEvent& event) wxOVERRIDE; + +#if wxUSE_RICHEDIT + // apply text attribute to the range of text (only works with richedit + // controls) + virtual bool SetStyle(long start, long end, const wxTextAttr& style) wxOVERRIDE; + virtual bool SetDefaultStyle(const wxTextAttr& style) wxOVERRIDE; + virtual bool GetStyle(long position, wxTextAttr& style) wxOVERRIDE; +#endif // wxUSE_RICHEDIT + + // translate between the position (which is just an index in the text ctrl + // considering all its contents as a single strings) and (x, y) coordinates + // which represent column and line. + virtual long XYToPosition(long x, long y) const wxOVERRIDE; + virtual bool PositionToXY(long pos, long *x, long *y) const wxOVERRIDE; + + virtual void ShowPosition(long pos) wxOVERRIDE; + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const wxOVERRIDE; + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, + wxTextCoord *col, + wxTextCoord *row) const wxOVERRIDE + { + return wxTextCtrlBase::HitTest(pt, col, row); + } + + virtual void SetLayoutDirection(wxLayoutDirection dir) wxOVERRIDE; + virtual wxLayoutDirection GetLayoutDirection() const wxOVERRIDE; + + // Caret handling (Windows only) + bool ShowNativeCaret(bool show = true); + bool HideNativeCaret() { return ShowNativeCaret(false); } + +#if wxUSE_RICHEDIT && wxUSE_SPELLCHECK + // Use native spelling and grammar checking functions. + // This is only available in wxTE_RICH2 controls. + virtual bool EnableProofCheck(const wxTextProofOptions& options + = wxTextProofOptions::Default()) wxOVERRIDE; + virtual wxTextProofOptions GetProofCheckOptions() const wxOVERRIDE; +#endif // wxUSE_RICHEDIT && wxUSE_SPELLCHECK + + // Implementation from now on + // -------------------------- + +#if wxUSE_DRAG_AND_DROP && wxUSE_RICHEDIT + virtual void SetDropTarget(wxDropTarget *dropTarget) wxOVERRIDE; +#endif // wxUSE_DRAG_AND_DROP && wxUSE_RICHEDIT + + virtual void SetWindowStyleFlag(long style) wxOVERRIDE; + + virtual void Command(wxCommandEvent& event) wxOVERRIDE; + virtual bool MSWCommand(WXUINT param, WXWORD id) wxOVERRIDE; + virtual WXHBRUSH MSWControlColor(WXHDC hDC, WXHWND hWnd) wxOVERRIDE; + +#if wxUSE_RICHEDIT + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) wxOVERRIDE; + + int GetRichVersion() const { return m_verRichEdit; } + bool IsRich() const { return m_verRichEdit != 0; } + + // rich edit controls are not compatible with normal ones and we must set + // the colours and font for them otherwise + virtual bool SetBackgroundColour(const wxColour& colour) wxOVERRIDE; + virtual bool SetForegroundColour(const wxColour& colour) wxOVERRIDE; + virtual bool SetFont(const wxFont& font) wxOVERRIDE; +#else + bool IsRich() const { return false; } +#endif // wxUSE_RICHEDIT + +#if wxUSE_INKEDIT && wxUSE_RICHEDIT + bool IsInkEdit() const { return m_isInkEdit != 0; } +#else + bool IsInkEdit() const { return false; } +#endif + + virtual void AdoptAttributesFromHWND() wxOVERRIDE; + + virtual bool AcceptsFocusFromKeyboard() const wxOVERRIDE; + + // returns true if the platform should explicitly apply a theme border + virtual bool CanApplyThemeBorder() const wxOVERRIDE; + + // callbacks + void OnDropFiles(wxDropFilesEvent& event); + void OnChar(wxKeyEvent& event); // Process 'enter' if required + + void OnCut(wxCommandEvent& event); + void OnCopy(wxCommandEvent& event); + void OnPaste(wxCommandEvent& event); + void OnUndo(wxCommandEvent& event); + void OnRedo(wxCommandEvent& event); + void OnDelete(wxCommandEvent& event); + void OnSelectAll(wxCommandEvent& event); + + void OnUpdateCut(wxUpdateUIEvent& event); + void OnUpdateCopy(wxUpdateUIEvent& event); + void OnUpdatePaste(wxUpdateUIEvent& event); + void OnUpdateUndo(wxUpdateUIEvent& event); + void OnUpdateRedo(wxUpdateUIEvent& event); + void OnUpdateDelete(wxUpdateUIEvent& event); + void OnUpdateSelectAll(wxUpdateUIEvent& event); + + // Show a context menu for Rich Edit controls (the standard + // EDIT control has one already) + void OnContextMenu(wxContextMenuEvent& event); + +#if wxUSE_RICHEDIT + // Create context menu for RICHEDIT controls. This may be called once during + // the control's lifetime or every time the menu is shown, depending on + // implementation. + virtual wxMenu *MSWCreateContextMenu(); +#endif // wxUSE_RICHEDIT + + // be sure the caret remains invisible if the user + // called HideNativeCaret() before + void OnSetFocus(wxFocusEvent& event); + + // intercept WM_GETDLGCODE + virtual bool MSWHandleMessage(WXLRESULT *result, + WXUINT message, + WXWPARAM wParam, + WXLPARAM lParam) wxOVERRIDE; + + virtual bool MSWShouldPreProcessMessage(WXMSG* pMsg) wxOVERRIDE; + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const wxOVERRIDE; + +protected: + // common part of all ctors + void Init(); + + // creates the control of appropriate class (plain or rich edit) with the + // styles corresponding to m_windowStyle + // + // this is used by ctor/Create() and when we need to recreate the control + // later + bool MSWCreateText(const wxString& value, + const wxPoint& pos, + const wxSize& size); + + virtual void DoSetValue(const wxString &value, int flags = 0) wxOVERRIDE; + + virtual wxPoint DoPositionToCoords(long pos) const wxOVERRIDE; + + // return true if this control has a user-set limit on amount of text (i.e. + // the limit is due to a previous call to SetMaxLength() and not built in) + bool HasSpaceLimit(unsigned int *len) const; + +#if wxUSE_RICHEDIT && !wxUSE_UNICODE + // replace the selection or the entire control contents with the given text + // in the specified encoding + bool StreamIn(const wxString& value, wxFontEncoding encoding, bool selOnly); + + // get the contents of the control out as text in the given encoding + wxString StreamOut(wxFontEncoding encoding, bool selOnly = false) const; +#endif // wxUSE_RICHEDIT + + // replace the contents of the selection or of the entire control with the + // given text + void DoWriteText(const wxString& text, + int flags = SetValue_SendEvent | SetValue_SelectionOnly); + + // set the selection (possibly without scrolling the caret into view) + void DoSetSelection(long from, long to, int flags) wxOVERRIDE; + + // get the length of the line containing the character at the given + // position + long GetLengthOfLineContainingPos(long pos) const; + + // send TEXT_UPDATED event, return true if it was handled, false otherwise + bool SendUpdateEvent(); + + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const wxOVERRIDE; + + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; + +#if wxUSE_RICHEDIT + virtual void MSWUpdateFontOnDPIChange(const wxSize& newDPI) wxOVERRIDE; + + // Apply m_richDPIscale zoom to rich control. + void MSWSetRichZoom(); + + // Apply the character-related parts of wxTextAttr to the given selection + // or the entire control if start == end == -1. + // + // This function is private and should only be called for rich edit + // controls and with (from, to) already in correct order, i.e. from <= to. + bool MSWSetCharFormat(const wxTextAttr& attr, long from = -1, long to = -1); + + // Same as above for paragraph-related parts of wxTextAttr. Note that this + // can only be applied to the selection as RichEdit doesn't support setting + // the paragraph styles globally. + bool MSWSetParaFormat(const wxTextAttr& attr, long from, long to); + + // Send wxEVT_CONTEXT_MENU event from here if the control doesn't do it on + // its own. + void OnRightUp(wxMouseEvent& event); + + // we're using RICHEDIT (and not simple EDIT) control if this field is not + // 0, it also gives the version of the RICHEDIT control being used + // (although not directly: 1 is for 1.0, 2 is for either 2.0 or 3.0 as we + // can't nor really need to distinguish between them and 4 is for 4.1) + int m_verRichEdit; + + // Rich text controls need temporary scaling when they are created on a + // display with non-system DPI. + float m_richDPIscale; +#endif // wxUSE_RICHEDIT + + // number of EN_UPDATE events sent by Windows when we change the controls + // text ourselves: we want this to be exactly 1 + int m_updatesCount; + +private: + virtual void EnableTextChangedEvents(bool enable) wxOVERRIDE + { + m_updatesCount = enable ? -1 : -2; + } + + // implement wxTextEntry pure virtual: it implements all the operations for + // the simple EDIT controls + virtual WXHWND GetEditHWND() const wxOVERRIDE { return m_hWnd; } + +#if wxUSE_OLE + virtual void MSWProcessSpecialKey(wxKeyEvent& event) wxOVERRIDE; +#endif // wxUSE_OLE + + // Do we need to handle Ctrl+Backspace ourselves? + bool MSWNeedsToHandleCtrlBackspace() const; + + // Delete backwards until the start of the previous word before caret in a + // way compatible with the standard MSW Ctrl+Backspace shortcut. + void MSWDeleteWordBack(); + + void OnKeyDown(wxKeyEvent& event); + + // Used by EN_MAXTEXT handler to increase the size limit (will do nothing + // if the current limit is big enough). Should never be called directly. + // + // Returns true if we increased the limit to allow entering more text, + // false if we hit the limit set by SetMaxLength() and so didn't change it. + bool AdjustSpaceLimit(); + + // Called before pasting to ensure that the limit is at big enough to allow + // pasting the entire text on the clipboard. + void AdjustMaxLengthBeforePaste(); + + + wxMenu* m_privateContextMenu; + + bool m_isNativeCaretShown; + +#if wxUSE_INKEDIT && wxUSE_RICHEDIT + int m_isInkEdit; +#endif + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTextCtrl); +}; + +#endif // _WX_TEXTCTRL_H_ diff --git a/lib/wxWidgets/include/wx/msw/textentry.h b/lib/wxWidgets/include/wx/msw/textentry.h new file mode 100644 index 0000000..9de5182 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/textentry.h @@ -0,0 +1,131 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/textentry.h +// Purpose: wxMSW-specific wxTextEntry implementation +// Author: Vadim Zeitlin +// Created: 2007-09-26 +// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_TEXTENTRY_H_ +#define _WX_MSW_TEXTENTRY_H_ + +class wxTextAutoCompleteData; // private class used only by wxTextEntry itself + +// ---------------------------------------------------------------------------- +// wxTextEntry: common part of wxComboBox and (single line) wxTextCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTextEntry : public wxTextEntryBase +{ +public: + wxTextEntry(); + virtual ~wxTextEntry(); + + // implement wxTextEntryBase pure virtual methods + virtual void WriteText(const wxString& text) wxOVERRIDE; + virtual void Remove(long from, long to) wxOVERRIDE; + + virtual void Copy() wxOVERRIDE; + virtual void Cut() wxOVERRIDE; + virtual void Paste() wxOVERRIDE; + + virtual void Undo() wxOVERRIDE; + virtual void Redo() wxOVERRIDE; + virtual bool CanUndo() const wxOVERRIDE; + virtual bool CanRedo() const wxOVERRIDE; + + virtual void SetInsertionPoint(long pos) wxOVERRIDE; + virtual long GetInsertionPoint() const wxOVERRIDE; + virtual long GetLastPosition() const wxOVERRIDE; + + virtual void SetSelection(long from, long to) wxOVERRIDE + { DoSetSelection(from, to); } + virtual void GetSelection(long *from, long *to) const wxOVERRIDE; + + virtual bool IsEditable() const wxOVERRIDE; + virtual void SetEditable(bool editable) wxOVERRIDE; + + virtual void SetMaxLength(unsigned long len) wxOVERRIDE; + virtual void ForceUpper() wxOVERRIDE; + +#if wxUSE_UXTHEME + virtual bool SetHint(const wxString& hint) wxOVERRIDE; + virtual wxString GetHint() const wxOVERRIDE; +#endif // wxUSE_UXTHEME + +protected: + virtual wxString DoGetValue() const wxOVERRIDE; + + // this is really a hook for multiline text controls as the single line + // ones don't need to ever scroll to show the selection but having it here + // allows us to put Remove() in the base class + enum + { + SetSel_NoScroll = 0, // don't do anything special + SetSel_Scroll = 1 // default: scroll to make the selection visible + }; + virtual void DoSetSelection(long from, long to, int flags = SetSel_Scroll); + + // margins functions + virtual bool DoSetMargins(const wxPoint& pt) wxOVERRIDE; + virtual wxPoint DoGetMargins() const wxOVERRIDE; + + // auto-completion uses COM under Windows so they won't work without + // wxUSE_OLE as OleInitialize() is not called then +#if wxUSE_OLE + virtual bool DoAutoCompleteStrings(const wxArrayString& choices) wxOVERRIDE; +#if wxUSE_DYNLIB_CLASS + virtual bool DoAutoCompleteFileNames(int flags) wxOVERRIDE; +#endif // wxUSE_DYNLIB_CLASS + virtual bool DoAutoCompleteCustom(wxTextCompleter *completer) wxOVERRIDE; +#endif // wxUSE_OLE + + // Returns true if this control uses standard file names completion. + bool MSWUsesStandardAutoComplete() const; + + // Returns false if this message shouldn't be preprocessed, but is always + // handled by the EDIT control represented by this object itself. + bool MSWShouldPreProcessMessage(WXMSG* msg) const; + + // Helper for wxTE_PROCESS_ENTER handling: activates the default button in + // the dialog containing this control if any. + bool ClickDefaultButtonIfPossible(); + +private: + // implement this to return the HWND of the EDIT control + virtual WXHWND GetEditHWND() const = 0; + +#if wxUSE_OLE + // This method is called to process special keys such as Return and Tab + // before they're consumed by the auto-completer. Notice that it is only + // called if we do need to process the key, i.e. if the corresponding + // wxTE_PROCESS_XXX style is set in the associated object. + // + // It is not pure virtual because it won't get called if the derived class + // doesn't use auto-completer, but it does need to be overridden if it can + // be called and the default implementation asserts if this is not the case. + virtual void MSWProcessSpecialKey(wxKeyEvent& event); + + // Check if we really have auto-complete data. This is not the same as just + // checking if m_autoCompleteData is NULL, see the code for more details. + bool MSWHasAutoCompleteData() const; + + // Check that we have auto-complete data, creating it if necessary. Returns + // false if creating it failed. + bool MSWEnsureHasAutoCompleteData(); + + // Various auto-completion-related stuff, only used if any of AutoComplete() + // methods are called. Use the function above to access it. + wxTextAutoCompleteData *m_autoCompleteData; + + // It needs to call our GetEditableWindow() and GetEditHWND() methods. + friend class wxTextAutoCompleteData; +#endif // wxUSE_OLE +}; + +// We don't need the generic version. +#define wxHAS_NATIVE_TEXT_FORCEUPPER + +#endif // _WX_MSW_TEXTENTRY_H_ + diff --git a/lib/wxWidgets/include/wx/msw/tglbtn.h b/lib/wxWidgets/include/wx/msw/tglbtn.h new file mode 100644 index 0000000..65b4d7c --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/tglbtn.h @@ -0,0 +1,110 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/tglbtn.h +// Purpose: Declaration of the wxToggleButton class, which implements a +// toggle button under wxMSW. +// Author: John Norris, minor changes by Axel Schlueter +// Modified by: +// Created: 08.02.01 +// Copyright: (c) 2000 Johnny C. Norris II +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TOGGLEBUTTON_H_ +#define _WX_TOGGLEBUTTON_H_ + +#include "wx/bmpbndl.h" + +// Checkbox item (single checkbox) +class WXDLLIMPEXP_CORE wxToggleButton : public wxToggleButtonBase +{ +public: + wxToggleButton() { Init(); } + wxToggleButton(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)); + + virtual void SetValue(bool value) wxOVERRIDE; + virtual bool GetValue() const wxOVERRIDE; + + virtual bool MSWCommand(WXUINT param, WXWORD id) wxOVERRIDE; + virtual void Command(wxCommandEvent& event) wxOVERRIDE; + + // returns true if the platform should explicitly apply a theme border + virtual bool CanApplyThemeBorder() const wxOVERRIDE { return false; } + +protected: + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const wxOVERRIDE; + + virtual bool MSWIsPushed() const wxOVERRIDE; + + void Init(); + + // current state of the button (when owner-drawn) + bool m_state; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton); +}; + +//----------------------------------------------------------------------------- +// wxBitmapToggleButton +//----------------------------------------------------------------------------- + + +class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButton +{ +public: + // construction/destruction + wxBitmapToggleButton() {} + wxBitmapToggleButton(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + // Create the control + bool Create(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)); + + // deprecated synonym for SetBitmapLabel() + wxDEPRECATED_INLINE( void SetLabel(const wxBitmap& bitmap), + SetBitmapLabel(bitmap); ) + // prevent virtual function hiding + virtual void SetLabel(const wxString& label) wxOVERRIDE { wxToggleButton::SetLabel(label); } + +private: + wxDECLARE_DYNAMIC_CLASS(wxBitmapToggleButton); +}; + +#endif // _WX_TOGGLEBUTTON_H_ + diff --git a/lib/wxWidgets/include/wx/msw/timectrl.h b/lib/wxWidgets/include/wx/msw/timectrl.h new file mode 100644 index 0000000..3608e64 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/timectrl.h @@ -0,0 +1,62 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/timectrl.h +// Purpose: wxTimePickerCtrl for Windows. +// Author: Vadim Zeitlin +// Created: 2011-09-22 +// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_TIMECTRL_H_ +#define _WX_MSW_TIMECTRL_H_ + +// ---------------------------------------------------------------------------- +// wxTimePickerCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxTimePickerCtrl : public wxTimePickerCtrlBase +{ +public: + // ctors + wxTimePickerCtrl() { } + + wxTimePickerCtrl(wxWindow *parent, + wxWindowID id, + const wxDateTime& dt = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTP_DEFAULT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTimePickerCtrlNameStr) + { + Create(parent, id, dt, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxDateTime& dt = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTP_DEFAULT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTimePickerCtrlNameStr) + { + return MSWCreateDateTimePicker(parent, id, dt, + pos, size, style, + validator, name); + } + + // Override MSW-specific functions used during control creation. + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const wxOVERRIDE; + +protected: +#if wxUSE_INTL + virtual wxLocaleInfo MSWGetFormat() const wxOVERRIDE; +#endif // wxUSE_INTL + virtual bool MSWAllowsNone() const wxOVERRIDE { return false; } + virtual bool MSWOnDateTimeChange(const tagNMDATETIMECHANGE& dtch) wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTimePickerCtrl); +}; + +#endif // _WX_MSW_TIMECTRL_H_ diff --git a/lib/wxWidgets/include/wx/msw/tls.h b/lib/wxWidgets/include/wx/msw/tls.h new file mode 100644 index 0000000..e14fd54 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/tls.h @@ -0,0 +1,123 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/tls.h +// Purpose: Win32 implementation of wxTlsValue<> +// Author: Vadim Zeitlin +// Created: 2008-08-08 +// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_TLS_H_ +#define _WX_MSW_TLS_H_ + +#include "wx/msw/wrapwin.h" +#include "wx/thread.h" +#include "wx/vector.h" + +// ---------------------------------------------------------------------------- +// wxTlsKey is a helper class encapsulating a TLS slot +// ---------------------------------------------------------------------------- + +class wxTlsKey +{ +public: + // ctor allocates a new key + wxTlsKey(wxTlsDestructorFunction destructor) + { + m_destructor = destructor; + m_slot = ::TlsAlloc(); + } + + // return true if the key was successfully allocated + bool IsOk() const { return m_slot != TLS_OUT_OF_INDEXES; } + + // get the key value, there is no error return + void *Get() const + { + // Exceptionally, TlsGetValue() calls SetLastError() even on success + // which means it overwrites the previous value. This is undesirable + // here, so explicitly preserve the last error here. + const DWORD dwLastError = ::GetLastError(); + void* const value = ::TlsGetValue(m_slot); + if ( dwLastError ) + ::SetLastError(dwLastError); + return value; + } + + // change the key value, return true if ok + bool Set(void *value) + { + void *old = Get(); + + if ( ::TlsSetValue(m_slot, value) == 0 ) + return false; + + if ( old ) + m_destructor(old); + + // update m_allValues list of all values - remove old, add new + wxCriticalSectionLocker lock(m_csAllValues); + if ( old ) + { + for ( wxVector<void*>::iterator i = m_allValues.begin(); + i != m_allValues.end(); + ++i ) + { + if ( *i == old ) + { + if ( value ) + *i = value; + else + m_allValues.erase(i); + return true; + } + } + wxFAIL_MSG( "previous wxTlsKey value not recorded in m_allValues" ); + } + + if ( value ) + m_allValues.push_back(value); + + return true; + } + + // free the key + ~wxTlsKey() + { + if ( !IsOk() ) + return; + + // Win32 API doesn't have the equivalent of pthread's destructor, so we + // have to keep track of all allocated values and destroy them manually; + // ideally we'd do that at thread exit time, but since we could only + // do that with wxThread and not otherwise created threads, we do it + // here. + // + // TODO: We should still call destructors for wxTlsKey used in the + // thread from wxThread's thread shutdown code, *in addition* + // to doing it in ~wxTlsKey. + // + // NB: No need to lock m_csAllValues, by the time this code is called, + // no other thread can be using this key. + for ( wxVector<void*>::iterator i = m_allValues.begin(); + i != m_allValues.end(); + ++i ) + { + m_destructor(*i); + } + + ::TlsFree(m_slot); + } + +private: + wxTlsDestructorFunction m_destructor; + DWORD m_slot; + + wxVector<void*> m_allValues; + wxCriticalSection m_csAllValues; + + wxDECLARE_NO_COPY_CLASS(wxTlsKey); +}; + +#endif // _WX_MSW_TLS_H_ + diff --git a/lib/wxWidgets/include/wx/msw/toolbar.h b/lib/wxWidgets/include/wx/msw/toolbar.h new file mode 100644 index 0000000..3f8aaa4 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/toolbar.h @@ -0,0 +1,203 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/toolbar.h +// Purpose: wxToolBar class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_TBAR95_H_ +#define _WX_MSW_TBAR95_H_ + +#if wxUSE_TOOLBAR + +#include "wx/dynarray.h" +#include "wx/imaglist.h" + +class WXDLLIMPEXP_CORE wxToolBar : public wxToolBarBase +{ +public: + // ctors and dtor + wxToolBar() { Init(); } + + wxToolBar(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTB_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxToolBarNameStr)) + { + Init(); + + Create(parent, id, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTB_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxToolBarNameStr)); + + virtual ~wxToolBar(); + + // override/implement base class virtuals + virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const wxOVERRIDE; + + virtual bool Realize() wxOVERRIDE; + + virtual wxSize GetToolSize() const wxOVERRIDE; + + virtual void SetRows(int nRows) wxOVERRIDE; + + virtual void SetToolNormalBitmap(int id, const wxBitmapBundle& bitmap) wxOVERRIDE; + virtual void SetToolDisabledBitmap(int id, const wxBitmapBundle& bitmap) wxOVERRIDE; + + virtual void SetToolPacking(int packing) wxOVERRIDE; + + // implementation only from now on + // ------------------------------- + + virtual void SetWindowStyleFlag(long style) wxOVERRIDE; + + virtual bool MSWCommand(WXUINT param, WXWORD id) wxOVERRIDE; + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) wxOVERRIDE; + + void OnMouseEvent(wxMouseEvent& event); + void OnSysColourChanged(wxSysColourChangedEvent& event); + void OnEraseBackground(wxEraseEvent& event); + + void SetFocus() wxOVERRIDE {} + + static WXHBITMAP MapBitmap(WXHBITMAP bitmap, int width, int height); + + // override WndProc mainly to process WM_SIZE + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) wxOVERRIDE; + + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const wxOVERRIDE; + + // returns true if the platform should explicitly apply a theme border + virtual bool CanApplyThemeBorder() const wxOVERRIDE { return false; } + +#ifdef wxHAS_MSW_BACKGROUND_ERASE_HOOK + virtual bool MSWEraseBgHook(WXHDC hDC) wxOVERRIDE; + virtual WXHBRUSH MSWGetBgBrushForChild(WXHDC hDC, wxWindowMSW *child) wxOVERRIDE; +#endif // wxHAS_MSW_BACKGROUND_ERASE_HOOK + + virtual wxToolBarToolBase *CreateTool(int id, + const wxString& label, + const wxBitmapBundle& bmpNormal, + const wxBitmapBundle& bmpDisabled = wxNullBitmap, + wxItemKind kind = wxITEM_NORMAL, + wxObject *clientData = NULL, + const wxString& shortHelp = wxEmptyString, + const wxString& longHelp = wxEmptyString) wxOVERRIDE; + + virtual wxToolBarToolBase *CreateTool(wxControl *control, + const wxString& label) wxOVERRIDE; +protected: + // common part of all ctors + void Init(); + + // create the native toolbar control + bool MSWCreateToolbar(const wxPoint& pos, const wxSize& size); + + // recreate the control completely + void Recreate(); + + // implement base class pure virtuals + virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE; + virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE; + + virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable) wxOVERRIDE; + virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle) wxOVERRIDE; + virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle) wxOVERRIDE; + + virtual void DoSetToolBitmapSize(const wxSize& size) wxOVERRIDE; + + // return the appropriate size and flags for the toolbar control + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + // handlers for various events + bool HandleSize(WXWPARAM wParam, WXLPARAM lParam); +#ifdef wxHAS_MSW_BACKGROUND_ERASE_HOOK + bool HandlePaint(WXWPARAM wParam, WXLPARAM lParam); +#endif // wxHAS_MSW_BACKGROUND_ERASE_HOOK + void HandleMouseMove(WXWPARAM wParam, WXLPARAM lParam); + + // should be called whenever the toolbar size changes + void UpdateSize(); + + // create m_disabledImgList (but doesn't fill it), set it to NULL if it is + // unneeded + void CreateDisabledImageList(); + + // get the Windows toolbar style of this control + long GetMSWToolbarStyle() const; + + // set native toolbar padding + void MSWSetPadding(WXWORD padding); + + void RealizeHelper(); + void OnDPIChanged(wxDPIChangedEvent& event); + + // the big bitmap containing all bitmaps of the toolbar buttons + WXHBITMAP m_hBitmap; + + // the image list with disabled images, may be NULL if we use + // system-provided versions of them + wxImageList *m_disabledImgList; + + // the total number of toolbar elements + size_t m_nButtons; + + // the sum of the sizes of the fixed items (i.e. excluding stretchable + // spaces) in the toolbar direction + int m_totalFixedSize; + + // the tool the cursor is in + wxToolBarToolBase *m_pInTool; + +private: + // makes sure tool bitmap size is sufficient for all tools + void AdjustToolBitmapSize(); + + // update the sizes of stretchable spacers to consume all extra space we + // have + void UpdateStretchableSpacersSize(); + +#ifdef wxHAS_MSW_BACKGROUND_ERASE_HOOK + // do erase the toolbar background, always do it for the entire control as + // the caller sets the clipping region correctly to exclude parts which + // should not be erased + void MSWDoEraseBackground(WXHDC hDC); + + // return the brush to use for erasing the toolbar background + WXHBRUSH MSWGetToolbarBgBrush(); +#endif // wxHAS_MSW_BACKGROUND_ERASE_HOOK + + // Return true if we're showing the labels for the embedded controls: we + // only do it if text is enabled and, somewhat less expectedly, if icons + // are enabled too because showing both the control and its label when only + // text is shown for the other buttons is too inconsistent to be useful. + bool AreControlLabelsShown() const + { + return HasFlag(wxTB_TEXT) && !HasFlag(wxTB_NOICONS); + } + + // Return the size required to accommodate the given tool which must be of + // "control" type. + wxSize MSWGetFittingtSizeForControl(class wxToolBarTool* tool) const; + + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxToolBar); + wxDECLARE_NO_COPY_CLASS(wxToolBar); +}; + +#endif // wxUSE_TOOLBAR + +#endif // _WX_MSW_TBAR95_H_ + diff --git a/lib/wxWidgets/include/wx/msw/tooltip.h b/lib/wxWidgets/include/wx/msw/tooltip.h new file mode 100644 index 0000000..4c3be08 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/tooltip.h @@ -0,0 +1,121 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/tooltip.h +// Purpose: wxToolTip class - tooltip control +// Author: Vadim Zeitlin +// Modified by: +// Created: 31.01.99 +// Copyright: (c) 1999 Robert Roebling, Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_TOOLTIP_H_ +#define _WX_MSW_TOOLTIP_H_ + +#include "wx/object.h" +#include "wx/gdicmn.h" + +class WXDLLIMPEXP_FWD_CORE wxWindow; +class wxToolTipOtherWindows; + +class WXDLLIMPEXP_CORE wxToolTip : public wxObject +{ +public: + // ctor & dtor + wxToolTip(const wxString &tip); + virtual ~wxToolTip(); + + // ctor used by wxStatusBar to associate a tooltip to a portion of + // the status bar window: + wxToolTip(wxWindow* win, unsigned int id, + const wxString &tip, const wxRect& rc); + + // accessors + // tip text + void SetTip(const wxString& tip); + const wxString& GetTip() const { return m_text; } + + // the window we're associated with + void SetWindow(wxWindow *win); + wxWindow *GetWindow() const { return m_window; } + + // controlling tooltip behaviour: globally change tooltip parameters + // enable or disable the tooltips globally + static void Enable(bool flag); + // set the delay after which the tooltip appears + static void SetDelay(long milliseconds); + // set the delay after which the tooltip disappears or how long the + // tooltip remains visible + static void SetAutoPop(long milliseconds); + // set the delay between subsequent tooltips to appear + static void SetReshow(long milliseconds); + // set maximum width for the new tooltips: -1 disables wrapping + // entirely, 0 restores the default behaviour + static void SetMaxWidth(int width); + + // implementation only from now on + // ------------------------------- + + // should be called in response to WM_MOUSEMOVE + static void RelayEvent(WXMSG *msg); + + // add a window to the tooltip control + void AddOtherWindow(WXHWND hwnd); + + // remove any tooltip from the window + static void Remove(WXHWND hwnd, unsigned int id, const wxRect& rc); + + // Set the rectangle we're associated with. This rectangle is only used for + // the main window, not any sub-windows added with Add() so in general it + // makes sense to use it for tooltips associated with a single window only. + void SetRect(const wxRect& rc); + + // Called when TLW shown state is changed and hides the tooltip itself if + // the window it's associated with is hidden. + static void UpdateVisibility(); + +private: + // This module calls our DeleteToolTipCtrl(). + friend class wxToolTipModule; + + // Adds a window other than our main m_window to this tooltip. + void DoAddHWND(WXHWND hWnd); + + // Perform the specified operation for the given window only. + void DoSetTip(WXHWND hWnd); + void DoRemove(WXHWND hWnd); + + // Call the given function for all windows we're associated with. + void DoForAllWindows(void (wxToolTip::*func)(WXHWND)); + + + // the one and only one tooltip control we use - never access it directly + // but use GetToolTipCtrl() which will create it when needed + static WXHWND ms_hwndTT; + + // create the tooltip ctrl if it doesn't exist yet and return its HWND + static WXHWND GetToolTipCtrl(); + + // to be used in wxModule for deleting tooltip ctrl window when exiting mainloop + static void DeleteToolTipCtrl(); + + // new tooltip maximum width, defaults to min(display width, 400) + static int ms_maxWidth; + + // remove this tooltip from the tooltip control + void Remove(); + + // adjust tooltip max width based on current tooltip text + bool AdjustMaxWidth(); + + wxString m_text; // tooltip text + wxWindow* m_window; // main window we're associated with + wxToolTipOtherWindows *m_others; // other windows associated with it or NULL + wxRect m_rect; // the rect of the window for which this tooltip is shown + // (or a rect with width/height == 0 to show it for the entire window) + unsigned int m_id; // the id of this tooltip (ignored when m_rect width/height is 0) + + wxDECLARE_ABSTRACT_CLASS(wxToolTip); + wxDECLARE_NO_COPY_CLASS(wxToolTip); +}; + +#endif // _WX_MSW_TOOLTIP_H_ diff --git a/lib/wxWidgets/include/wx/msw/toplevel.h b/lib/wxWidgets/include/wx/msw/toplevel.h new file mode 100644 index 0000000..c319827 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/toplevel.h @@ -0,0 +1,215 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/toplevel.h +// Purpose: wxTopLevelWindowMSW is the MSW implementation of wxTLW +// Author: Vadim Zeitlin +// Modified by: +// Created: 20.09.01 +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_TOPLEVEL_H_ +#define _WX_MSW_TOPLEVEL_H_ + +#include "wx/weakref.h" + +// ---------------------------------------------------------------------------- +// wxTopLevelWindowMSW +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTopLevelWindowMSW : public wxTopLevelWindowBase +{ +public: + // constructors and such + wxTopLevelWindowMSW() { Init(); } + + wxTopLevelWindowMSW(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Init(); + + (void)Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + virtual ~wxTopLevelWindowMSW(); + + // implement base class pure virtuals + virtual void SetTitle( const wxString& title) wxOVERRIDE; + virtual wxString GetTitle() const wxOVERRIDE; + virtual void Maximize(bool maximize = true) wxOVERRIDE; + virtual bool IsMaximized() const wxOVERRIDE; + virtual void Iconize(bool iconize = true) wxOVERRIDE; + virtual bool IsIconized() const wxOVERRIDE; + virtual void SetIcons(const wxIconBundle& icons ) wxOVERRIDE; + virtual void Restore() wxOVERRIDE; + virtual bool Destroy() wxOVERRIDE; + + virtual void SetLayoutDirection(wxLayoutDirection dir) wxOVERRIDE; + + virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO) wxOVERRIDE; + + virtual bool Show(bool show = true) wxOVERRIDE; + virtual void Raise() wxOVERRIDE; + + virtual void ShowWithoutActivating() wxOVERRIDE; + virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) wxOVERRIDE; + virtual bool IsFullScreen() const wxOVERRIDE { return m_fsIsShowing; } + + virtual wxContentProtection GetContentProtection() const wxOVERRIDE; + virtual bool SetContentProtection(wxContentProtection contentProtection) wxOVERRIDE; + + // wxMSW only: EnableCloseButton(false) may be used to remove the "Close" + // button from the title bar + virtual bool EnableCloseButton(bool enable = true) wxOVERRIDE; + virtual bool EnableMaximizeButton(bool enable = true) wxOVERRIDE; + virtual bool EnableMinimizeButton(bool enable = true) wxOVERRIDE; + + // Set window transparency if the platform supports it + virtual bool SetTransparent(wxByte alpha) wxOVERRIDE; + virtual bool CanSetTransparent() wxOVERRIDE; + + + // MSW-specific methods + // -------------------- + + // Return the menu representing the "system" menu of the window. You can + // call wxMenu::AppendWhatever() methods on it but removing items from it + // is in general not a good idea. + // + // The pointer returned by this method belongs to the window and will be + // deleted when the window itself is, do not delete it yourself. May return + // NULL if getting the system menu failed. + wxMenu *MSWGetSystemMenu() const; + + // Enable or disable the close button of the specified window. + static bool MSWEnableCloseButton(WXHWND hwnd, bool enable = true); + + + // implementation from now on + // -------------------------- + + // event handlers + void OnActivate(wxActivateEvent& event); + + // called from wxWidgets code itself only when the pending focus, i.e. the + // element which should get focus when this TLW is activated again, changes + virtual void WXSetPendingFocus(wxWindow* win) wxOVERRIDE + { + m_winLastFocused = win; + } + + // translate wxWidgets flags to Windows ones + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle) const wxOVERRIDE; + + // choose the right parent to use with CreateWindow() + virtual WXHWND MSWGetParent() const wxOVERRIDE; + + // window proc for the frames + virtual WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) wxOVERRIDE; + + // returns true if the platform should explicitly apply a theme border + virtual bool CanApplyThemeBorder() const wxOVERRIDE { return false; } + + // This function is only for internal use. + void MSWSetShowCommand(WXUINT showCmd) { m_showCmd = showCmd; } + +protected: + // common part of all ctors + void Init(); + + // create a new frame, return false if it couldn't be created + bool CreateFrame(const wxString& title, + const wxPoint& pos, + const wxSize& size); + + // create a new dialog using the given dialog template from resources, + // return false if it couldn't be created + bool CreateDialog(const void *dlgTemplate, + const wxString& title, + const wxPoint& pos, + const wxSize& size); + + // Just a wrapper around MSW ShowWindow(). + void DoShowWindow(int nShowCmd); + + // Return true if the window is iconized at MSW level, ignoring m_showCmd. + bool MSWIsIconized() const; + + // override those to return the normal window coordinates even when the + // window is minimized + virtual void DoGetPosition(int *x, int *y) const wxOVERRIDE; + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; + + // Top level windows have different freeze semantics on Windows + virtual void DoFreeze() wxOVERRIDE; + virtual void DoThaw() wxOVERRIDE; + + // helper of SetIcons(): calls gets the icon with the size specified by the + // given system metrics (SM_C{X|Y}[SM]ICON) from the bundle and sets it + // using WM_SETICON with the specified wParam (ICOM_SMALL or ICON_BIG); + // returns true if the icon was set + bool DoSelectAndSetIcon(const wxIconBundle& icons, int smX, int smY, int i); + + // override wxWindow virtual method to use CW_USEDEFAULT if necessary + virtual void MSWGetCreateWindowCoords(const wxPoint& pos, + const wxSize& size, + int& x, int& y, + int& w, int& h) const wxOVERRIDE; + + // override this one to update our icon on DPI change (not quite the same + // thing as font, but close enough...) + virtual void MSWUpdateFontOnDPIChange(const wxSize& newDPI) wxOVERRIDE; + + + // This field contains the show command to use when showing the window the + // next time and also indicates whether the window should be considered + // being iconized or maximized (which may be different from whether it's + // actually iconized or maximized at MSW level). + WXUINT m_showCmd; + + // Data to save/restore when calling ShowFullScreen + long m_fsStyle; // Passed to ShowFullScreen + wxRect m_fsOldSize; + long m_fsOldWindowStyle; + bool m_fsIsMaximized; + bool m_fsIsShowing; + + // Save the current focus to m_winLastFocused if we're not iconized (the + // focus is always NULL when we're iconized). + void DoSaveLastFocus(); + + // Restore focus to m_winLastFocused if possible and needed. + void DoRestoreLastFocus(); + + // The last focused child: we remember it when we're deactivated and + // restore focus to it when we're activated (this is done here) or restored + // from iconic state (done by wxFrame). + wxWindowRef m_winLastFocused; + +private: + // Part of SetIcons() actually updating the window icons. + void DoSetIcons(); + + + // The system menu: initially NULL but can be set (once) by + // MSWGetSystemMenu(). Owned by this window. + wxMenu *m_menuSystem; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxTopLevelWindowMSW); +}; + +#endif // _WX_MSW_TOPLEVEL_H_ diff --git a/lib/wxWidgets/include/wx/msw/treectrl.h b/lib/wxWidgets/include/wx/msw/treectrl.h new file mode 100644 index 0000000..08d42f7 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/treectrl.h @@ -0,0 +1,353 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/treectrl.h +// Purpose: wxTreeCtrl class +// Author: Julian Smart +// Modified by: Vadim Zeitlin to be less MSW-specific on 10/10/98 +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_TREECTRL_H_ +#define _WX_MSW_TREECTRL_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if wxUSE_TREECTRL + +#include "wx/textctrl.h" +#include "wx/dynarray.h" +#include "wx/treebase.h" +#include "wx/hashmap.h" + +#ifdef __GNUWIN32__ + // Cygwin windows.h defines these identifiers + #undef GetFirstChild + #undef GetNextSibling +#endif // Cygwin + +// fwd decl +class WXDLLIMPEXP_FWD_CORE wxImageList; +class WXDLLIMPEXP_FWD_CORE wxDragImage; +struct WXDLLIMPEXP_FWD_CORE wxTreeViewItem; + +// hash storing attributes for our items +class wxItemAttr; +WX_DECLARE_EXPORTED_VOIDPTR_HASH_MAP(wxItemAttr *, wxMapTreeAttr); + +// ---------------------------------------------------------------------------- +// wxTreeCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTreeCtrl : public wxTreeCtrlBase +{ +public: + // creation + // -------- + wxTreeCtrl() { Init(); } + + wxTreeCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxTreeCtrlNameStr)) + { + Create(parent, id, pos, size, style, validator, name); + } + + virtual ~wxTreeCtrl(); + + bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxTreeCtrlNameStr)); + + // implement base class pure virtuals + // ---------------------------------- + + virtual unsigned int GetCount() const wxOVERRIDE; + + virtual unsigned int GetIndent() const wxOVERRIDE; + virtual void SetIndent(unsigned int indent) wxOVERRIDE; + + virtual void SetImageList(wxImageList *imageList) wxOVERRIDE; + virtual void SetStateImageList(wxImageList *imageList) wxOVERRIDE; + + virtual wxString GetItemText(const wxTreeItemId& item) const wxOVERRIDE; + virtual int GetItemImage(const wxTreeItemId& item, + wxTreeItemIcon which = wxTreeItemIcon_Normal) const wxOVERRIDE; + virtual wxTreeItemData *GetItemData(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxColour GetItemTextColour(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxColour GetItemBackgroundColour(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxFont GetItemFont(const wxTreeItemId& item) const wxOVERRIDE; + + virtual void SetItemText(const wxTreeItemId& item, const wxString& text) wxOVERRIDE; + virtual void SetItemImage(const wxTreeItemId& item, int image, + wxTreeItemIcon which = wxTreeItemIcon_Normal) wxOVERRIDE; + virtual void SetItemData(const wxTreeItemId& item, wxTreeItemData *data) wxOVERRIDE; + virtual void SetItemHasChildren(const wxTreeItemId& item, bool has = true) wxOVERRIDE; + virtual void SetItemBold(const wxTreeItemId& item, bool bold = true) wxOVERRIDE; + virtual void SetItemDropHighlight(const wxTreeItemId& item, + bool highlight = true) wxOVERRIDE; + virtual void SetItemTextColour(const wxTreeItemId& item, + const wxColour& col) wxOVERRIDE; + virtual void SetItemBackgroundColour(const wxTreeItemId& item, + const wxColour& col) wxOVERRIDE; + virtual void SetItemFont(const wxTreeItemId& item, const wxFont& font) wxOVERRIDE; + + // item status inquiries + // --------------------- + + virtual bool IsVisible(const wxTreeItemId& item) const wxOVERRIDE; + virtual bool ItemHasChildren(const wxTreeItemId& item) const wxOVERRIDE; + virtual bool IsExpanded(const wxTreeItemId& item) const wxOVERRIDE; + virtual bool IsSelected(const wxTreeItemId& item) const wxOVERRIDE; + virtual bool IsBold(const wxTreeItemId& item) const wxOVERRIDE; + + virtual size_t GetChildrenCount(const wxTreeItemId& item, + bool recursively = true) const wxOVERRIDE; + + // navigation + // ---------- + + virtual wxTreeItemId GetRootItem() const wxOVERRIDE; + virtual wxTreeItemId GetSelection() const wxOVERRIDE; + virtual size_t GetSelections(wxArrayTreeItemIds& selections) const wxOVERRIDE; + virtual wxTreeItemId GetFocusedItem() const wxOVERRIDE; + + virtual void ClearFocusedItem() wxOVERRIDE; + virtual void SetFocusedItem(const wxTreeItemId& item) wxOVERRIDE; + + + virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxTreeItemId GetFirstChild(const wxTreeItemId& item, + wxTreeItemIdValue& cookie) const wxOVERRIDE; + virtual wxTreeItemId GetNextChild(const wxTreeItemId& item, + wxTreeItemIdValue& cookie) const wxOVERRIDE; + virtual wxTreeItemId GetLastChild(const wxTreeItemId& item) const wxOVERRIDE; + + virtual wxTreeItemId GetNextSibling(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const wxOVERRIDE; + + virtual wxTreeItemId GetFirstVisibleItem() const wxOVERRIDE; + virtual wxTreeItemId GetNextVisible(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const wxOVERRIDE; + + // operations + // ---------- + + virtual wxTreeItemId AddRoot(const wxString& text, + int image = -1, int selectedImage = -1, + wxTreeItemData *data = NULL) wxOVERRIDE; + + virtual void Delete(const wxTreeItemId& item) wxOVERRIDE; + virtual void DeleteChildren(const wxTreeItemId& item) wxOVERRIDE; + virtual void DeleteAllItems() wxOVERRIDE; + + virtual void Expand(const wxTreeItemId& item) wxOVERRIDE; + virtual void Collapse(const wxTreeItemId& item) wxOVERRIDE; + virtual void CollapseAndReset(const wxTreeItemId& item) wxOVERRIDE; + virtual void Toggle(const wxTreeItemId& item) wxOVERRIDE; + + virtual void Unselect() wxOVERRIDE; + virtual void UnselectAll() wxOVERRIDE; + virtual void SelectItem(const wxTreeItemId& item, bool select = true) wxOVERRIDE; + virtual void SelectChildren(const wxTreeItemId& parent) wxOVERRIDE; + + virtual void EnsureVisible(const wxTreeItemId& item) wxOVERRIDE; + virtual void ScrollTo(const wxTreeItemId& item) wxOVERRIDE; + + virtual wxTextCtrl *EditLabel(const wxTreeItemId& item, + wxClassInfo* textCtrlClass = wxCLASSINFO(wxTextCtrl)) wxOVERRIDE; + virtual wxTextCtrl *GetEditControl() const wxOVERRIDE; + virtual void EndEditLabel(const wxTreeItemId& WXUNUSED(item), + bool discardChanges = false) wxOVERRIDE + { + DoEndEditLabel(discardChanges); + } + + virtual void SortChildren(const wxTreeItemId& item) wxOVERRIDE; + + virtual bool GetBoundingRect(const wxTreeItemId& item, + wxRect& rect, + bool textOnly = false) const wxOVERRIDE; + + // implementation + // -------------- + + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) wxOVERRIDE; + virtual WXLRESULT MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) wxOVERRIDE; + virtual bool MSWCommand(WXUINT param, WXWORD id) wxOVERRIDE; + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) wxOVERRIDE; + virtual bool MSWShouldPreProcessMessage(WXMSG* msg) wxOVERRIDE; + + // override some base class virtuals + virtual bool SetBackgroundColour(const wxColour &colour) wxOVERRIDE; + virtual bool SetForegroundColour(const wxColour &colour) wxOVERRIDE; + + // returns true if the platform should explicitly apply a theme border + virtual bool CanApplyThemeBorder() const wxOVERRIDE { return false; } + + virtual bool IsDoubleBuffered() const wxOVERRIDE; + virtual void SetDoubleBuffered(bool on) wxOVERRIDE; + +protected: + // Implement "update locking" in a custom way for this control. + virtual void DoFreeze() wxOVERRIDE; + virtual void DoThaw() wxOVERRIDE; + + virtual bool MSWShouldSetDefaultFont() const wxOVERRIDE { return false; } + + virtual void OnImagesChanged() wxOVERRIDE; + + // SetImageList helper + void SetAnyImageList(wxImageList *imageList, int which); + + // refresh a single item + void RefreshItem(const wxTreeItemId& item); + + // end edit label + void DoEndEditLabel(bool discardChanges = false); + + virtual int DoGetItemState(const wxTreeItemId& item) const wxOVERRIDE; + virtual void DoSetItemState(const wxTreeItemId& item, int state) wxOVERRIDE; + + virtual wxTreeItemId DoInsertItem(const wxTreeItemId& parent, + size_t pos, + const wxString& text, + int image, int selectedImage, + wxTreeItemData *data) wxOVERRIDE; + virtual wxTreeItemId DoInsertAfter(const wxTreeItemId& parent, + const wxTreeItemId& idPrevious, + const wxString& text, + int image = -1, int selImage = -1, + wxTreeItemData *data = NULL) wxOVERRIDE; + virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, int& flags) const wxOVERRIDE; + + // obtain the user data for the lParam member of TV_ITEM + class wxTreeItemParam *GetItemParam(const wxTreeItemId& item) const; + + // update the event to include the items client data and pass it to + // HandleWindowEvent(), return true if it processed it + bool HandleTreeEvent(wxTreeEvent& event) const; + + // pass the event to HandleTreeEvent() and return true if the event was + // either unprocessed or not vetoed + bool IsTreeEventAllowed(wxTreeEvent& event) const + { + return !HandleTreeEvent(event) || event.IsAllowed(); + } + + // generate a wxEVT_KEY_DOWN event from the specified WPARAM/LPARAM values + // having the same meaning as for WM_KEYDOWN, return true if it was + // processed + bool MSWHandleTreeKeyDownEvent(WXWPARAM wParam, WXLPARAM lParam); + + // handle a key event in a multi-selection control, should be only called + // for keys which can be used to change the selection + // + // return true if the key was processed, false otherwise + bool MSWHandleSelectionKey(unsigned vkey); + + virtual void MSWUpdateFontOnDPIChange(const wxSize& newDPI) wxOVERRIDE; + + // data used only while editing the item label: + wxTextCtrl *m_textCtrl; // text control in which it is edited + wxTreeItemId m_idEdited; // the item being edited + +private: + // the common part of all ctors + void Init(); + + // helper functions + bool DoGetItem(wxTreeViewItem *tvItem) const; + void DoSetItem(wxTreeViewItem *tvItem); + + void DoExpand(const wxTreeItemId& item, int flag); + + void DoSelectItem(const wxTreeItemId& item, bool select = true); + void DoUnselectItem(const wxTreeItemId& item); + void DoToggleItemSelection(const wxTreeItemId& item); + + void DoUnselectAll(); + void DoSelectChildren(const wxTreeItemId& parent); + + void DeleteTextCtrl(); + + // return true if the item is the hidden root one (i.e. it's the root item + // and the tree has wxTR_HIDE_ROOT style) + bool IsHiddenRoot(const wxTreeItemId& item) const; + + + // check if the given flags (taken from TV_HITTESTINFO structure) + // indicate a position "on item": this is less trivial than just checking + // for TVHT_ONITEM because we consider that points to the left and right of + // item text are also "on item" when wxTR_FULL_ROW_HIGHLIGHT is used as the + // item visually spans the entire breadth of the window then + bool MSWIsOnItem(unsigned flags) const; + + // Delete the given item from the native control. + bool MSWDeleteItem(const wxTreeItemId& item); + + + // the hash storing the items attributes (indexed by item ids) + wxMapTreeAttr m_attrs; + + // true if the hash above is not empty + bool m_hasAnyAttr; + +#if wxUSE_DRAGIMAGE + // used for dragging + wxDragImage *m_dragImage; +#endif + + // Virtual root item, if wxTR_HIDE_ROOT is set. + void* m_pVirtualRoot; + + // Item to call EnsureVisible() on when the tree is thawed, if necessary. + wxTreeItemId m_htEnsureVisibleOnThaw; + + // the starting item for selection with Shift + wxTreeItemId m_htSelStart, m_htClickedItem; + wxPoint m_ptClick; + + // whether dragging has started + bool m_dragStarted; + + // whether focus was lost between subsequent clicks of a single item + bool m_focusLost; + + // set when we are changing selection ourselves (only used in multi + // selection mode) + bool m_changingSelection; + + // whether we need to trigger a state image click event + bool m_triggerStateImageClick; + + // whether we need to deselect other items on mouse up + bool m_mouseUpDeselect; + + friend class wxTreeItemIndirectData; + friend class wxTreeSortHelper; + + wxDECLARE_DYNAMIC_CLASS(wxTreeCtrl); + wxDECLARE_NO_COPY_CLASS(wxTreeCtrl); +}; + +#endif // wxUSE_TREECTRL + +#endif // _WX_MSW_TREECTRL_H_ diff --git a/lib/wxWidgets/include/wx/msw/uxtheme.h b/lib/wxWidgets/include/wx/msw/uxtheme.h new file mode 100644 index 0000000..a0a2df4 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/uxtheme.h @@ -0,0 +1,265 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/uxtheme.h +// Purpose: wxUxThemeEngine class: support for XP themes +// Author: John Platts, Vadim Zeitlin +// Modified by: +// Created: 2003 +// Copyright: (c) 2003 John Platts, Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UXTHEME_H_ +#define _WX_UXTHEME_H_ + +#include "wx/defs.h" + +#if wxUSE_UXTHEME + +#include "wx/msw/private.h" // we use GetHwndOf() +#include <uxtheme.h> + +#if defined(DTPB_WINDOWDC) +// DTPB_WINDOWDC has been added for Vista so it's save to assume that an SDK +// including it has vssym32.h available +#define HAVE_VSSYM32 +#endif + +#if defined(HAVE_VSSYM32) +#include <vssym32.h> +#else +#include <tmschema.h> +#endif + +// ---------------------------------------------------------------------------- +// Definitions for legacy Windows SDKs +// ---------------------------------------------------------------------------- +// Some definitions introduced with Windows Vista might be missing in older SDKs +// Missing definitions are added here for compatibility + +#ifndef VSCLASS_LISTVIEW +#define LISS_NORMAL 1 +#define LISS_HOT 2 +#define LISS_SELECTED 3 +#define LISS_DISABLED 4 +#define LISS_SELECTEDNOTFOCUS 5 +#define LISS_HOTSELECTED 6 +#endif + +#ifndef DTT_TEXTCOLOR +#define DTT_TEXTCOLOR (1UL << 0) // crText has been specified +#define DTT_STATEID (1UL << 8) // IStateId has been specified +#endif + +#ifndef DSS_HIDEPREFIX +#define DSS_HIDEPREFIX 0x0200 +#define DSS_PREFIXONLY 0x0400 +#endif + +#ifndef TMT_FONT +#define TMT_FONT 210 +#endif + +#ifndef HAVE_VSSYM32 +enum EXPANDOBUTTONSTATES { + TDLGEBS_NORMAL = 1, + TDLGEBS_HOVER = 2, + TDLGEBS_PRESSED = 3, + TDLGEBS_EXPANDEDNORMAL = 4, + TDLGEBS_EXPANDEDHOVER = 5, + TDLGEBS_EXPANDEDPRESSED = 6, + TDLGEBS_NORMALDISABLED = 7, + TDLGEBS_EXPANDEDDISABLED = 8, +}; + +enum TASKDIALOGPARTS { + TDLG_PRIMARYPANEL = 1, + TDLG_MAININSTRUCTIONPANE = 2, + TDLG_MAINICON = 3, + TDLG_CONTENTPANE = 4, + TDLG_CONTENTICON = 5, + TDLG_EXPANDEDCONTENT = 6, + TDLG_COMMANDLINKPANE = 7, + TDLG_SECONDARYPANEL = 8, + TDLG_CONTROLPANE = 9, + TDLG_BUTTONSECTION = 10, + TDLG_BUTTONWRAPPER = 11, + TDLG_EXPANDOTEXT = 12, + TDLG_EXPANDOBUTTON = 13, + TDLG_VERIFICATIONTEXT = 14, + TDLG_FOOTNOTEPANE = 15, + TDLG_FOOTNOTEAREA = 16, + TDLG_FOOTNOTESEPARATOR = 17, + TDLG_EXPANDEDFOOTERAREA = 18, + TDLG_PROGRESSBAR = 19, + TDLG_IMAGEALIGNMENT = 20, + TDLG_RADIOBUTTONPANE = 21, +}; + +#define CP_BACKGROUND 2 +#define CP_TRANSPARENTBACKGROUND 3 +#define CP_BORDER 4 +#define CP_READONLY 5 +#define CP_DROPDOWNBUTTONRIGHT 6 +#define CP_DROPDOWNBUTTONLEFT 7 +#define CP_CUEBANNER 8 + +#define RP_BACKGROUND 6 +#define RP_SPLITTER 7 +#define RP_SPLITTERVERT 8 + +enum BORDERSTATES { + CBB_NORMAL = 1, + CBB_HOT = 2, + CBB_FOCUSED = 3, + CBB_DISABLED = 4, +}; + +// The MENUPARTS enum is defined in MSVS 2005 SDK, even though it doesn't have +// vssym32.h, but it doesn't define the constants we use, so still define them, +// but make the enum unnamed for compatibility. +enum /* MENUPARTS -- FIXME-VC8: uncomment this when support for it is dropped */ +{ + MENU_MENUITEM_TMSCHEMA = 1, + MENU_SEPARATOR_TMSCHEMA = 6, + MENU_POPUPBACKGROUND = 9, + MENU_POPUPBORDERS = 10, + MENU_POPUPCHECK = 11, + MENU_POPUPCHECKBACKGROUND = 12, + MENU_POPUPGUTTER = 13, + MENU_POPUPITEM = 14, + MENU_POPUPSEPARATOR = 15, + MENU_POPUPSUBMENU = 16, +}; + +enum POPUPITEMSTATES +{ + MPI_NORMAL = 1, + MPI_HOT = 2, + MPI_DISABLED = 3, + MPI_DISABLEDHOT = 4, +}; + +enum POPUPCHECKBACKGROUNDSTATES +{ + MCB_DISABLED = 1, + MCB_NORMAL = 2, + MCB_BITMAP = 3, +}; + +enum POPUPCHECKSTATES +{ + MC_CHECKMARKNORMAL = 1, + MC_CHECKMARKDISABLED = 2, + MC_BULLETNORMAL = 3, + MC_BULLETDISABLED = 4, +}; + +#endif + +// ---------------------------------------------------------------------------- +// End definitions for legacy Windows SDKs +// ---------------------------------------------------------------------------- + +// Amazingly, GetThemeFont() and GetThemeSysFont() functions use LOGFONTA under +// XP but LOGFONTW (even in non-Unicode build) under later versions of Windows. +// If we declare them as taking LOGFONT below, the code would be able to +// silently pass LOGFONTA to them in ANSI build and would crash at run-time +// under Windows Vista/7 because of a buffer overrun (LOGFONTA being smaller +// than LOGFONTW expected by these functions). If we declare them as taking +// LOGFONTW, the code wouldn't work correctly under XP. So we use a special +// wxUxThemeFont class to encapsulate this and intentionally change the LOGFONT +// output parameters of the theme functions to take it instead. + +class wxUxThemeFont +{ +public: + // Trivial default ctor. + wxUxThemeFont() { } + +#if wxUSE_UNICODE + // In Unicode build we always use LOGFONT anyhow so this class is + // completely trivial. + LPLOGFONTW GetPtr() { return &m_lfW; } + const LOGFONTW& GetLOGFONT() { return m_lfW; } +#else // !wxUSE_UNICODE + // Return either LOGFONTA or LOGFONTW pointer as required by the current + // Windows version. + LPLOGFONTW GetPtr() + { + return UseLOGFONTW() ? &m_lfW + : reinterpret_cast<LPLOGFONTW>(&m_lfA); + } + + // This method returns LOGFONT (i.e. LOGFONTA in ANSI build and LOGFONTW in + // Unicode one) which can be used with other, normal, Windows or wx + // functions. Internally it may need to transform LOGFONTW to LOGFONTA. + const LOGFONTA& GetLOGFONT() + { + if ( UseLOGFONTW() ) + { + // Most of the fields are the same in LOGFONTA and LOGFONTW so just + // copy everything by default. + memcpy(&m_lfA, &m_lfW, sizeof(m_lfA)); + + // But the face name must be converted from Unicode. + WideCharToMultiByte(CP_ACP, 0, m_lfW.lfFaceName, -1, + m_lfA.lfFaceName, sizeof(m_lfA.lfFaceName), + NULL, NULL); + } + + return m_lfA; + } + +private: + static bool UseLOGFONTW() + { + return wxGetWinVersion() >= wxWinVersion_Vista; + } + + LOGFONTA m_lfA; +#endif // wxUSE_UNICODE/!wxUSE_UNICODE + +private: + LOGFONTW m_lfW; + + wxDECLARE_NO_COPY_CLASS(wxUxThemeFont); +}; + +WXDLLIMPEXP_CORE bool wxUxThemeIsActive(); + +// ---------------------------------------------------------------------------- +// wxUxThemeHandle: encapsulates ::Open/CloseThemeData() +// ---------------------------------------------------------------------------- + +class wxUxThemeHandle +{ +public: + wxUxThemeHandle(const wxWindow *win, const wchar_t *classes) + { + m_hTheme = (HTHEME)::OpenThemeData(GetHwndOf(win), classes); + } + + operator HTHEME() const { return m_hTheme; } + + ~wxUxThemeHandle() + { + if ( m_hTheme ) + { + ::CloseThemeData(m_hTheme); + } + } + +private: + HTHEME m_hTheme; + + wxDECLARE_NO_COPY_CLASS(wxUxThemeHandle); +}; + +#else // !wxUSE_UXTHEME + +inline bool wxUxThemeIsActive() { return false; } + +#endif // wxUSE_UXTHEME/!wxUSE_UXTHEME + +#endif // _WX_UXTHEME_H_ + diff --git a/lib/wxWidgets/include/wx/msw/webview_edge.h b/lib/wxWidgets/include/wx/msw/webview_edge.h new file mode 100644 index 0000000..c3db2ca --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/webview_edge.h @@ -0,0 +1,140 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/msw/webview_edge.h +// Purpose: wxMSW Edge Chromium wxWebView backend +// Author: Markus Pingel +// Created: 2019-12-15 +// Copyright: (c) 2019 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef wxWebViewEdge_H +#define wxWebViewEdge_H + +#include "wx/setup.h" + +#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_EDGE && defined(__WXMSW__) + +#include "wx/control.h" +#include "wx/webview.h" + +class wxWebViewEdgeImpl; + +class WXDLLIMPEXP_WEBVIEW wxWebViewEdge : public wxWebView +{ +public: + + wxWebViewEdge(); + + wxWebViewEdge(wxWindow* parent, + wxWindowID id, + const wxString& url = wxWebViewDefaultURLStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxWebViewNameStr); + + ~wxWebViewEdge(); + + bool Create(wxWindow* parent, + wxWindowID id, + const wxString& url = wxWebViewDefaultURLStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxWebViewNameStr) wxOVERRIDE; + + virtual void LoadURL(const wxString& url) wxOVERRIDE; + virtual void LoadHistoryItem(wxSharedPtr<wxWebViewHistoryItem> item) wxOVERRIDE; + virtual wxVector<wxSharedPtr<wxWebViewHistoryItem> > GetBackwardHistory() wxOVERRIDE; + virtual wxVector<wxSharedPtr<wxWebViewHistoryItem> > GetForwardHistory() wxOVERRIDE; + + virtual bool CanGoForward() const wxOVERRIDE; + virtual bool CanGoBack() const wxOVERRIDE; + virtual void GoBack() wxOVERRIDE; + virtual void GoForward() wxOVERRIDE; + virtual void ClearHistory() wxOVERRIDE; + virtual void EnableHistory(bool enable = true) wxOVERRIDE; + virtual void Stop() wxOVERRIDE; + virtual void Reload(wxWebViewReloadFlags flags = wxWEBVIEW_RELOAD_DEFAULT) wxOVERRIDE; + + virtual bool IsBusy() const wxOVERRIDE; + virtual wxString GetCurrentURL() const wxOVERRIDE; + virtual wxString GetCurrentTitle() const wxOVERRIDE; + + virtual void SetZoomType(wxWebViewZoomType) wxOVERRIDE; + virtual wxWebViewZoomType GetZoomType() const wxOVERRIDE; + virtual bool CanSetZoomType(wxWebViewZoomType type) const wxOVERRIDE; + + virtual void Print() wxOVERRIDE; + + virtual float GetZoomFactor() const wxOVERRIDE; + virtual void SetZoomFactor(float zoom) wxOVERRIDE; + + //Undo / redo functionality + virtual bool CanUndo() const wxOVERRIDE; + virtual bool CanRedo() const wxOVERRIDE; + virtual void Undo() wxOVERRIDE; + virtual void Redo() wxOVERRIDE; + + //Editing functions + virtual void SetEditable(bool enable = true) wxOVERRIDE; + virtual bool IsEditable() const wxOVERRIDE; + + virtual void EnableContextMenu(bool enable = true) wxOVERRIDE; + virtual bool IsContextMenuEnabled() const wxOVERRIDE; + + virtual void EnableAccessToDevTools(bool enable = true) wxOVERRIDE; + virtual bool IsAccessToDevToolsEnabled() const wxOVERRIDE; + + virtual bool SetUserAgent(const wxString& userAgent) wxOVERRIDE; + + virtual bool RunScript(const wxString& javascript, wxString* output = NULL) const wxOVERRIDE; + virtual void RunScriptAsync(const wxString& javascript, void* clientData = NULL) const wxOVERRIDE; + virtual bool AddScriptMessageHandler(const wxString& name) wxOVERRIDE; + virtual bool RemoveScriptMessageHandler(const wxString& name) wxOVERRIDE; + virtual bool AddUserScript(const wxString& javascript, + wxWebViewUserScriptInjectionTime injectionTime = wxWEBVIEW_INJECT_AT_DOCUMENT_START) wxOVERRIDE; + virtual void RemoveAllUserScripts() wxOVERRIDE; + + virtual void RegisterHandler(wxSharedPtr<wxWebViewHandler> handler) wxOVERRIDE; + + virtual void* GetNativeBackend() const wxOVERRIDE; + + static void MSWSetBrowserExecutableDir(const wxString& path); + +protected: + virtual void DoSetPage(const wxString& html, const wxString& baseUrl) wxOVERRIDE; + +private: + wxWebViewEdgeImpl* m_impl; + + void OnSize(wxSizeEvent& event); + + void OnSetFocus(wxFocusEvent& event); + + void OnTopLevelParentIconized(wxIconizeEvent& event); + + wxDECLARE_DYNAMIC_CLASS(wxWebViewEdge); +}; + +class WXDLLIMPEXP_WEBVIEW wxWebViewFactoryEdge : public wxWebViewFactory +{ +public: + virtual wxWebView* Create() wxOVERRIDE { return new wxWebViewEdge; } + virtual wxWebView* Create(wxWindow* parent, + wxWindowID id, + const wxString& url = wxWebViewDefaultURLStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxWebViewNameStr) wxOVERRIDE + { + return new wxWebViewEdge(parent, id, url, pos, size, style, name); + } + virtual bool IsAvailable() wxOVERRIDE; + virtual wxVersionInfo GetVersionInfo() wxOVERRIDE; +}; + +#endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_EDGE && defined(__WXMSW__) + +#endif // wxWebViewEdge_H diff --git a/lib/wxWidgets/include/wx/msw/webview_ie.h b/lib/wxWidgets/include/wx/msw/webview_ie.h new file mode 100644 index 0000000..072b8ae --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/webview_ie.h @@ -0,0 +1,200 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/msw/webview_ie.h +// Purpose: wxMSW IE wxWebView backend +// Author: Marianne Gagnon +// Copyright: (c) 2010 Marianne Gagnon, 2011 Steven Lamerton +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef wxWebViewIE_H +#define wxWebViewIE_H + +#include "wx/setup.h" + +#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_IE && defined(__WXMSW__) + +#include "wx/webview.h" +#include "wx/msw/ole/activex.h" + +class wxWebViewIEImpl; + +// Note that the highest emulation level may be used even when the +// corresponding browser version is not installed. +// +// Using FORCE options is not recommended, DEFAULT can be used to reset level +// to the system default. +// +// The value of the constants were taken from +// +// https://msdn.microsoft.com/library/ee330730.aspx#browser_emulation +// +// and must not be changed. +enum wxWebViewIE_EmulationLevel +{ + wxWEBVIEWIE_EMU_DEFAULT = 0, + wxWEBVIEWIE_EMU_IE7 = 7000, + wxWEBVIEWIE_EMU_IE8 = 8000, + wxWEBVIEWIE_EMU_IE8_FORCE = 8888, + wxWEBVIEWIE_EMU_IE9 = 9000, + wxWEBVIEWIE_EMU_IE9_FORCE = 9999, + wxWEBVIEWIE_EMU_IE10 = 10000, + wxWEBVIEWIE_EMU_IE10_FORCE = 10001, + wxWEBVIEWIE_EMU_IE11 = 11000, + wxWEBVIEWIE_EMU_IE11_FORCE = 11001 +}; + +class WXDLLIMPEXP_WEBVIEW wxWebViewIE : public wxWebView +{ +public: + + wxWebViewIE() {} + + wxWebViewIE(wxWindow* parent, + wxWindowID id, + const wxString& url = wxWebViewDefaultURLStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxWebViewNameStr)) + { + Create(parent, id, url, pos, size, style, name); + } + + ~wxWebViewIE(); + + bool Create(wxWindow* parent, + wxWindowID id, + const wxString& url = wxWebViewDefaultURLStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxWebViewNameStr)) wxOVERRIDE; + + virtual void LoadURL(const wxString& url) wxOVERRIDE; + virtual void LoadHistoryItem(wxSharedPtr<wxWebViewHistoryItem> item) wxOVERRIDE; + virtual wxVector<wxSharedPtr<wxWebViewHistoryItem> > GetBackwardHistory() wxOVERRIDE; + virtual wxVector<wxSharedPtr<wxWebViewHistoryItem> > GetForwardHistory() wxOVERRIDE; + + virtual bool CanGoForward() const wxOVERRIDE; + virtual bool CanGoBack() const wxOVERRIDE; + virtual void GoBack() wxOVERRIDE; + virtual void GoForward() wxOVERRIDE; + virtual void ClearHistory() wxOVERRIDE; + virtual void EnableHistory(bool enable = true) wxOVERRIDE; + virtual void Stop() wxOVERRIDE; + virtual void Reload(wxWebViewReloadFlags flags = wxWEBVIEW_RELOAD_DEFAULT) wxOVERRIDE; + + virtual wxString GetPageSource() const wxOVERRIDE; + virtual wxString GetPageText() const wxOVERRIDE; + + virtual bool IsBusy() const wxOVERRIDE; + virtual wxString GetCurrentURL() const wxOVERRIDE; + virtual wxString GetCurrentTitle() const wxOVERRIDE; + + virtual void SetZoomType(wxWebViewZoomType) wxOVERRIDE; + virtual wxWebViewZoomType GetZoomType() const wxOVERRIDE; + virtual bool CanSetZoomType(wxWebViewZoomType) const wxOVERRIDE; + + virtual void Print() wxOVERRIDE; + + virtual wxWebViewZoom GetZoom() const wxOVERRIDE; + virtual float GetZoomFactor() const wxOVERRIDE; + virtual void SetZoom(wxWebViewZoom zoom) wxOVERRIDE; + virtual void SetZoomFactor(float zoom) wxOVERRIDE; + + //Clipboard functions + virtual bool CanCut() const wxOVERRIDE; + virtual bool CanCopy() const wxOVERRIDE; + virtual bool CanPaste() const wxOVERRIDE; + virtual void Cut() wxOVERRIDE; + virtual void Copy() wxOVERRIDE; + virtual void Paste() wxOVERRIDE; + + //Undo / redo functionality + virtual bool CanUndo() const wxOVERRIDE; + virtual bool CanRedo() const wxOVERRIDE; + virtual void Undo() wxOVERRIDE; + virtual void Redo() wxOVERRIDE; + + //Find function + virtual long Find(const wxString& text, int flags = wxWEBVIEW_FIND_DEFAULT) wxOVERRIDE; + + //Editing functions + virtual void SetEditable(bool enable = true) wxOVERRIDE; + virtual bool IsEditable() const wxOVERRIDE; + + //Selection + virtual void SelectAll() wxOVERRIDE; + virtual bool HasSelection() const wxOVERRIDE; + virtual void DeleteSelection() wxOVERRIDE; + virtual wxString GetSelectedText() const wxOVERRIDE; + virtual wxString GetSelectedSource() const wxOVERRIDE; + virtual void ClearSelection() wxOVERRIDE; + + virtual bool RunScript(const wxString& javascript, wxString* output = NULL) const wxOVERRIDE; + + //Virtual Filesystem Support + virtual void RegisterHandler(wxSharedPtr<wxWebViewHandler> handler) wxOVERRIDE; + + virtual void* GetNativeBackend() const wxOVERRIDE; + + // ---- IE-specific methods + + // FIXME: I seem to be able to access remote webpages even in offline mode... + bool IsOfflineMode(); + void SetOfflineMode(bool offline); + + wxWebViewZoom GetIETextZoom() const; + void SetIETextZoom(wxWebViewZoom level); + + wxWebViewZoom GetIEOpticalZoom() const; + int GetIEOpticalZoomFactor() const; + void SetIEOpticalZoom(wxWebViewZoom level); + void SetIEOpticalZoomFactor(int zoom); + + void onActiveXEvent(wxActiveXEvent& evt); + void onEraseBg(wxEraseEvent&) {} + + // Switch to specific emulation level for the browser control to + // ensure RunScript() and web pages work as designed and also change the + // value of User-Agent header sent to web server. + static bool + MSWSetEmulationLevel(wxWebViewIE_EmulationLevel level = wxWEBVIEWIE_EMU_IE11); + + // This function is provided only for compatibility reasons, use + // MSWSetEmulationLevel() in the new code instead. + static bool MSWSetModernEmulationLevel(bool modernLevel = true) + { + return MSWSetEmulationLevel(modernLevel ? wxWEBVIEWIE_EMU_IE8 + : wxWEBVIEWIE_EMU_DEFAULT); + } + + wxDECLARE_EVENT_TABLE(); + +protected: + virtual void DoSetPage(const wxString& html, const wxString& baseUrl) wxOVERRIDE; + +private: + wxWebViewIEImpl* m_impl; + + wxDECLARE_DYNAMIC_CLASS(wxWebViewIE); +}; + +class WXDLLIMPEXP_WEBVIEW wxWebViewFactoryIE : public wxWebViewFactory +{ +public: + virtual wxWebView* Create() wxOVERRIDE { return new wxWebViewIE; } + virtual wxWebView* Create(wxWindow* parent, + wxWindowID id, + const wxString& url = wxWebViewDefaultURLStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxWebViewNameStr)) wxOVERRIDE + { return new wxWebViewIE(parent, id, url, pos, size, style, name); } + virtual wxVersionInfo GetVersionInfo() wxOVERRIDE; +}; + +#endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_IE && defined(__WXMSW__) + +#endif // wxWebViewIE_H diff --git a/lib/wxWidgets/include/wx/msw/webviewhistoryitem_ie.h b/lib/wxWidgets/include/wx/msw/webviewhistoryitem_ie.h new file mode 100644 index 0000000..b34dd08 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/webviewhistoryitem_ie.h @@ -0,0 +1,30 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/msw/webviewhistoryitem.h +// Purpose: wxWebViewHistoryItem header for MSW +// Author: Steven Lamerton +// Copyright: (c) 2011 Steven Lamerton +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_WEBVIEWHISTORYITEM_H_ +#define _WX_MSW_WEBVIEWHISTORYITEM_H_ + +#include "wx/setup.h" + +#if wxUSE_WEBVIEW && (wxUSE_WEBVIEW_IE || wxUSE_WEBVIEW_EDGE) && defined(__WXMSW__) + +class WXDLLIMPEXP_WEBVIEW wxWebViewHistoryItem +{ +public: + wxWebViewHistoryItem(const wxString& url, const wxString& title) : + m_url(url), m_title(title) {} + wxString GetUrl() { return m_url; } + wxString GetTitle() { return m_title; } + +private: + wxString m_url, m_title; +}; + +#endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_IE && defined(__WXMSW__) + +#endif // _WX_MSW_WEBVIEWHISTORYITEM_H_ diff --git a/lib/wxWidgets/include/wx/msw/window.h b/lib/wxWidgets/include/wx/msw/window.h new file mode 100644 index 0000000..88bbc46 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/window.h @@ -0,0 +1,818 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/window.h +// Purpose: wxWindowMSW class +// Author: Julian Smart +// Modified by: Vadim Zeitlin on 13.05.99: complete refont of message handling, +// elimination of Default(), ... +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WINDOW_H_ +#define _WX_WINDOW_H_ + +#include "wx/settings.h" // solely for wxSystemColour + +class WXDLLIMPEXP_FWD_CORE wxButton; + +// if this is set to 1, we use deferred window sizing to reduce flicker when +// resizing complicated window hierarchies, but this can in theory result in +// different behaviour than the old code so we keep the possibility to use it +// by setting this to 0 (in the future this should be removed completely) +#define wxUSE_DEFERRED_SIZING 1 + +// --------------------------------------------------------------------------- +// wxWindow declaration for MSW +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWindowMSW : public wxWindowBase +{ + friend class wxSpinCtrl; + friend class wxSlider; + friend class wxRadioBox; +public: + wxWindowMSW() { Init(); } + + wxWindowMSW(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)) + { + Init(); + Create(parent, id, pos, size, style, name); + } + + virtual ~wxWindowMSW(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)) + { + return CreateUsingMSWClass(GetMSWClassName(style), + parent, id, pos, size, style, name); + } + + // Non-portable, MSW-specific Create() variant allowing to create the + // window with a custom Windows class name. This can be useful to assign a + // custom Windows class, that can be recognized from the outside of the + // application, for windows of specific type. + bool CreateUsingMSWClass(const wxChar* classname, + wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)); + + // implement base class pure virtuals + virtual void SetLabel(const wxString& label) wxOVERRIDE; + virtual wxString GetLabel() const wxOVERRIDE; + + virtual void Raise() wxOVERRIDE; + virtual void Lower() wxOVERRIDE; + +#if wxUSE_DEFERRED_SIZING + virtual bool BeginRepositioningChildren() wxOVERRIDE; + virtual void EndRepositioningChildren() wxOVERRIDE; +#endif // wxUSE_DEFERRED_SIZING + + virtual bool Show(bool show = true) wxOVERRIDE; + virtual bool ShowWithEffect(wxShowEffect effect, + unsigned timeout = 0) wxOVERRIDE + { + return MSWShowWithEffect(true, effect, timeout); + } + virtual bool HideWithEffect(wxShowEffect effect, + unsigned timeout = 0) wxOVERRIDE + { + return MSWShowWithEffect(false, effect, timeout); + } + + virtual void SetFocus() wxOVERRIDE; + virtual void SetFocusFromKbd() wxOVERRIDE; + + virtual bool Reparent(wxWindowBase *newParent) wxOVERRIDE; + + virtual wxSize GetDPI() const wxOVERRIDE; + virtual double GetDPIScaleFactor() const wxOVERRIDE; + + virtual wxSize GetWindowBorderSize() const wxOVERRIDE; + + virtual void WarpPointer(int x, int y) wxOVERRIDE; + virtual bool EnableTouchEvents(int eventsMask) wxOVERRIDE; + + virtual void Refresh( bool eraseBackground = true, + const wxRect *rect = (const wxRect *) NULL ) wxOVERRIDE; + virtual void Update() wxOVERRIDE; + + virtual void SetWindowStyleFlag(long style) wxOVERRIDE; + virtual void SetExtraStyle(long exStyle) wxOVERRIDE; + virtual bool SetCursor( const wxCursor &cursor ) wxOVERRIDE; + virtual bool SetFont( const wxFont &font ) wxOVERRIDE; + + virtual int GetCharHeight() const wxOVERRIDE; + virtual int GetCharWidth() const wxOVERRIDE; + + virtual void SetScrollbar( int orient, int pos, int thumbVisible, + int range, bool refresh = true ) wxOVERRIDE; + virtual void SetScrollPos( int orient, int pos, bool refresh = true ) wxOVERRIDE; + virtual int GetScrollPos( int orient ) const wxOVERRIDE; + virtual int GetScrollThumb( int orient ) const wxOVERRIDE; + virtual int GetScrollRange( int orient ) const wxOVERRIDE; + virtual void ScrollWindow( int dx, int dy, + const wxRect* rect = NULL ) wxOVERRIDE; + + virtual bool ScrollLines(int lines) wxOVERRIDE; + virtual bool ScrollPages(int pages) wxOVERRIDE; + + virtual void SetLayoutDirection(wxLayoutDirection dir) wxOVERRIDE; + virtual wxLayoutDirection GetLayoutDirection() const wxOVERRIDE; + virtual wxCoord AdjustForLayoutDirection(wxCoord x, + wxCoord width, + wxCoord widthTotal) const wxOVERRIDE; + + virtual void SetId(wxWindowID winid) wxOVERRIDE; + +#if wxUSE_DRAG_AND_DROP + virtual void SetDropTarget( wxDropTarget *dropTarget ) wxOVERRIDE; + + // Accept files for dragging + virtual void DragAcceptFiles(bool accept) wxOVERRIDE; +#endif // wxUSE_DRAG_AND_DROP + +#ifndef __WXUNIVERSAL__ + // Native resource loading (implemented in src/msw/nativdlg.cpp) + // FIXME: should they really be all virtual? + virtual bool LoadNativeDialog(wxWindow* parent, wxWindowID id); + virtual bool LoadNativeDialog(wxWindow* parent, const wxString& name); + wxWindow* GetWindowChild1(wxWindowID id); + wxWindow* GetWindowChild(wxWindowID id); +#endif // __WXUNIVERSAL__ + +#if wxUSE_HOTKEY + // install and deinstall a system wide hotkey + virtual bool RegisterHotKey(int hotkeyId, int modifiers, int keycode) wxOVERRIDE; + virtual bool UnregisterHotKey(int hotkeyId) wxOVERRIDE; +#endif // wxUSE_HOTKEY + + // window handle stuff + // ------------------- + + WXHWND GetHWND() const { return m_hWnd; } + void SetHWND(WXHWND hWnd) { m_hWnd = hWnd; } + virtual WXWidget GetHandle() const wxOVERRIDE { return GetHWND(); } + + void AssociateHandle(WXWidget handle) wxOVERRIDE; + void DissociateHandle() wxOVERRIDE; + + // returns the handle of the native window to focus when this wxWindow gets + // focus (i.e. in composite windows: by default, this is just the HWND for + // this window itself, but it can be overridden to return something + // different for composite controls + virtual WXHWND MSWGetFocusHWND() const { return GetHWND(); } + + // does this window have deferred position and/or size? + bool IsSizeDeferred() const; + + // these functions allow to register a global handler for the given Windows + // message: it will be called from MSWWindowProc() of any window which gets + // this event if it's not processed before (i.e. unlike a hook procedure it + // does not override the normal processing) + // + // notice that if you want to process a message for a given window only you + // should override its MSWWindowProc() instead + + // type of the handler: it is called with the message parameters (except + // that the window object is passed instead of window handle) and should + // return true if it handled the message or false if it should be passed to + // DefWindowProc() + typedef bool (*MSWMessageHandler)(wxWindowMSW *win, + WXUINT nMsg, + WXWPARAM wParam, + WXLPARAM lParam); + + // install a handler, shouldn't be called more than one for the same message + static bool MSWRegisterMessageHandler(int msg, MSWMessageHandler handler); + + // unregister a previously registered handler + static void MSWUnregisterMessageHandler(int msg, MSWMessageHandler handler); + + + // implementation from now on + // ========================== + + // event handlers + // -------------- + + void OnPaint(wxPaintEvent& event); + +public: + // Windows subclassing + void SubclassWin(WXHWND hWnd); + void UnsubclassWin(); + + WXWNDPROC MSWGetOldWndProc() const { return m_oldWndProc; } + void MSWSetOldWndProc(WXWNDPROC proc) { m_oldWndProc = proc; } + + // return true if the window is of a standard (i.e. not wxWidgets') class + // + // to understand why does it work, look at SubclassWin() code and comments + bool IsOfStandardClass() const { return m_oldWndProc != NULL; } + + wxWindow *FindItem(long id, WXHWND hWnd = NULL) const; + wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = false) const; + + // MSW only: true if this control is part of the main control + virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return false; } + +#if wxUSE_TOOLTIPS + // MSW only: true if this window or any of its children have a tooltip + virtual bool HasToolTips() const { return GetToolTip() != NULL; } +#endif // wxUSE_TOOLTIPS + + // translate wxWidgets style flags for this control into the Windows style + // and optional extended style for the corresponding native control + // + // this is the function that should be overridden in the derived classes, + // but you will mostly use MSWGetCreateWindowFlags() below + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const ; + + // get the MSW window flags corresponding to wxWidgets ones + // + // the functions returns the flags (WS_XXX) directly and puts the ext + // (WS_EX_XXX) flags into the provided pointer if not NULL + WXDWORD MSWGetCreateWindowFlags(WXDWORD *exflags = NULL) const + { return MSWGetStyle(GetWindowStyle(), exflags); } + + // update the real underlying window style flags to correspond to the + // current wxWindow object style (safe to call even if window isn't fully + // created yet) + void MSWUpdateStyle(long flagsOld, long exflagsOld); + + // get the HWND to be used as parent of this window with CreateWindow() + virtual WXHWND MSWGetParent() const; + + // Return the name of the Win32 class that should be used by this wxWindow + // object, taking into account wxFULL_REPAINT_ON_RESIZE style (if it's not + // specified, the wxApp::GetNoRedrawClassSuffix()-suffixed version of the + // class is used). + static const wxChar *GetMSWClassName(long style); + + // creates the window of specified Windows class with given style, extended + // style, title and geometry (default values + // + // returns true if the window has been created, false if creation failed + bool MSWCreate(const wxChar *wclass, + const wxChar *title = NULL, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + WXDWORD style = 0, + WXDWORD exendedStyle = 0); + + virtual bool MSWCommand(WXUINT param, WXWORD id); + +#ifndef __WXUNIVERSAL__ + // Create an appropriate wxWindow from a HWND + virtual wxWindow* CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd); + + // Make sure the window style reflects the HWND style (roughly) + virtual void AdoptAttributesFromHWND(); +#endif // __WXUNIVERSAL__ + + // Setup background and foreground colours correctly + virtual void SetupColours(); + + // ------------------------------------------------------------------------ + // helpers for message handlers: these perform the same function as the + // message crackers from <windowsx.h> - they unpack WPARAM and LPARAM into + // the correct parameters + // ------------------------------------------------------------------------ + + void UnpackCommand(WXWPARAM wParam, WXLPARAM lParam, + WXWORD *id, WXHWND *hwnd, WXWORD *cmd); + void UnpackActivate(WXWPARAM wParam, WXLPARAM lParam, + WXWORD *state, WXWORD *minimized, WXHWND *hwnd); + void UnpackScroll(WXWPARAM wParam, WXLPARAM lParam, + WXWORD *code, WXWORD *pos, WXHWND *hwnd); + void UnpackCtlColor(WXWPARAM wParam, WXLPARAM lParam, + WXHDC *hdc, WXHWND *hwnd); + void UnpackMenuSelect(WXWPARAM wParam, WXLPARAM lParam, + WXWORD *item, WXWORD *flags, WXHMENU *hmenu); + + // ------------------------------------------------------------------------ + // internal handlers for MSW messages: all handlers return a boolean value: + // true means that the handler processed the event and false that it didn't + // ------------------------------------------------------------------------ + + // there are several cases where we have virtual functions for Windows + // message processing: this is because these messages often require to be + // processed in a different manner in the derived classes. For all other + // messages, however, we do *not* have corresponding MSWOnXXX() function + // and if the derived class wants to process them, it should override + // MSWWindowProc() directly. + + // scroll event (both horizontal and vertical) + virtual bool MSWOnScroll(int orientation, WXWORD nSBCode, + WXWORD pos, WXHWND control); + + // child control notifications + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); + + // owner-drawn controls need to process these messages + virtual bool MSWOnDrawItem(int id, WXDRAWITEMSTRUCT *item); + virtual bool MSWOnMeasureItem(int id, WXMEASUREITEMSTRUCT *item); + + // the rest are not virtual + bool HandleCreate(WXLPCREATESTRUCT cs, bool *mayCreate); + bool HandleInitDialog(WXHWND hWndFocus); + bool HandleDestroy(); + + bool HandlePaint(); + bool HandlePrintClient(WXHDC hDC); + bool HandleEraseBkgnd(WXHDC hDC); + + bool HandleMinimize(); + bool HandleMaximize(); + bool HandleSize(int x, int y, WXUINT flag); + bool HandleSizing(wxRect& rect); + bool HandleGetMinMaxInfo(void *mmInfo); + bool HandleEnterSizeMove(); + bool HandleExitSizeMove(); + + bool HandleShow(bool show, int status); + bool HandleActivate(int flag, bool minimized, WXHWND activate); + + bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); + + bool HandleCtlColor(WXHBRUSH *hBrush, WXHDC hdc, WXHWND hWnd); + + bool HandlePaletteChanged(WXHWND hWndPalChange); + bool HandleQueryNewPalette(); + bool HandleSysColorChange(); + bool HandleDisplayChange(); + bool HandleCaptureChanged(WXHWND gainedCapture); + virtual bool HandleSettingChange(WXWPARAM wParam, WXLPARAM lParam); + + bool HandleQueryEndSession(long logOff, bool *mayEnd); + bool HandleEndSession(bool endSession, long logOff); + + bool HandleSetFocus(WXHWND wnd); + bool HandleKillFocus(WXHWND wnd); + + bool HandleDropFiles(WXWPARAM wParam); + + bool HandleMouseEvent(WXUINT msg, int x, int y, WXUINT flags); + bool HandleMouseMove(int x, int y, WXUINT flags); + bool HandleMouseWheel(wxMouseWheelAxis axis, + WXWPARAM wParam, WXLPARAM lParam); + + // Common gesture event initialization, returns true if it is the initial + // event (GF_BEGIN set in flags), false otherwise. + bool InitGestureEvent(wxGestureEvent& event, const wxPoint& pt, WXDWORD flags); + + bool HandlePanGesture(const wxPoint& pt, WXDWORD flags); + bool HandleZoomGesture(const wxPoint& pt, WXDWORD fingerDistance, WXDWORD flags); + bool HandleRotateGesture(const wxPoint& pt, WXDWORD angleArgument, WXDWORD flags); + bool HandleTwoFingerTap(const wxPoint& pt, WXDWORD flags); + bool HandlePressAndTap(const wxPoint& pt, WXDWORD flags); + + bool HandleChar(WXWPARAM wParam, WXLPARAM lParam); + bool HandleKeyDown(WXWPARAM wParam, WXLPARAM lParam); + bool HandleKeyUp(WXWPARAM wParam, WXLPARAM lParam); +#if wxUSE_HOTKEY + bool HandleHotKey(WXWPARAM wParam, WXLPARAM lParam); +#endif + int HandleMenuChar(int chAccel, WXLPARAM lParam); + // Create and process a clipboard event specified by type. + bool HandleClipboardEvent( WXUINT nMsg ); + + bool HandleQueryDragIcon(WXHICON *hIcon); + + bool HandleSetCursor(WXHWND hWnd, short nHitTest, int mouseMsg); + + bool HandlePower(WXWPARAM wParam, WXLPARAM lParam, bool *vetoed); + + + // The main body of common window proc for all wxWindow objects. It tries + // to handle the given message and returns true if it was handled (the + // appropriate return value is then put in result, which must be non-NULL) + // or false if it wasn't. + // + // This function should be overridden in any new code instead of + // MSWWindowProc() even if currently most of the code overrides + // MSWWindowProc() as it had been written before this function was added. + virtual bool MSWHandleMessage(WXLRESULT *result, + WXUINT message, + WXWPARAM wParam, + WXLPARAM lParam); + + // Common Window procedure for all wxWindow objects: forwards to + // MSWHandleMessage() and MSWDefWindowProc() if the message wasn't handled. + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + + // Calls an appropriate default window procedure + virtual WXLRESULT MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + + // message processing helpers + + // return false if the message shouldn't be translated/preprocessed but + // dispatched normally + virtual bool MSWShouldPreProcessMessage(WXMSG* pMsg); + + // return true if the message was preprocessed and shouldn't be dispatched + virtual bool MSWProcessMessage(WXMSG* pMsg); + + // return true if the message was translated and shouldn't be dispatched + virtual bool MSWTranslateMessage(WXMSG* pMsg); + + // called when the window is about to be destroyed + virtual void MSWDestroyWindow(); + + + // Functions dealing with painting the window background. The derived + // classes should normally only need to reimplement MSWGetBgBrush() if they + // need to use a non-solid brush for erasing their background. This + // function is called by MSWGetBgBrushForChild() which only exists for the + // weird wxToolBar case and MSWGetBgBrushForChild() itself is used by + // MSWGetBgBrush() to actually find the right brush to use. + + // Adjust the origin for the brush returned by MSWGetBgBrushForChild(). + // + // This needs to be overridden for scrolled windows to ensure that the + // scrolling of their associated DC is taken into account. + // + // Both parameters must be non-NULL. + virtual void MSWAdjustBrushOrg(int* WXUNUSED(xOrg), + int* WXUNUSED(yOrg)) const + { + } + + // The brush returned from here must remain valid at least until the next + // event loop iteration. Returning 0, as is done by default, indicates + // there is no custom background brush. + virtual WXHBRUSH MSWGetCustomBgBrush() { return NULL; } + + // this function should return the brush to paint the children controls + // background or 0 if this window doesn't impose any particular background + // on its children + // + // the hDC parameter is the DC background will be drawn on, it can be used + // to call SetBrushOrgEx() on it if the returned brush is a bitmap one + // + // child parameter is never NULL, it can be this window itself or one of + // its (grand)children + // + // the base class version returns a solid brush if we have a non default + // background colour or 0 otherwise + virtual WXHBRUSH MSWGetBgBrushForChild(WXHDC hDC, wxWindowMSW *child); + + // return the background brush to use for painting the given window by + // querying the parent windows via MSWGetBgBrushForChild() recursively + WXHBRUSH MSWGetBgBrush(WXHDC hDC); + + enum MSWThemeColour + { + ThemeColourText = 0, + ThemeColourBackground, + ThemeColourBorder + }; + + // returns a specific theme colour, or if that is not possible then + // wxSystemSettings::GetColour(fallback) + wxColour MSWGetThemeColour(const wchar_t *themeName, + int themePart, + int themeState, + MSWThemeColour themeColour, + wxSystemColour fallback) const; + + // gives the parent the possibility to draw its children background, e.g. + // this is used by wxNotebook to do it using DrawThemeBackground() + // + // return true if background was drawn, false otherwise + virtual bool MSWPrintChild(WXHDC WXUNUSED(hDC), wxWindow * WXUNUSED(child)) + { + return false; + } + + // some controls (e.g. wxListBox) need to set the return value themselves + // + // return true to let parent handle it if we don't, false otherwise + virtual bool MSWShouldPropagatePrintChild() + { + return true; + } + + // This should be overridden to return true for the controls which have + // themed background that should through their children. Currently only + // wxNotebook uses this. + // + // The base class version already returns true if we have a solid + // background colour that should be propagated to our children. + virtual bool MSWHasInheritableBackground() const + { + return InheritsBackgroundColour(); + } + +#if !defined(__WXUNIVERSAL__) + #define wxHAS_MSW_BACKGROUND_ERASE_HOOK +#endif + +#ifdef wxHAS_MSW_BACKGROUND_ERASE_HOOK + // allows the child to hook into its parent WM_ERASEBKGND processing: call + // MSWSetEraseBgHook() with a non-NULL window to make parent call + // MSWEraseBgHook() on this window (don't forget to reset it to NULL + // afterwards) + // + // this hack is used by wxToolBar, see comments there + void MSWSetEraseBgHook(wxWindow *child); + + // return true if WM_ERASEBKGND is currently hooked + bool MSWHasEraseBgHook() const; + + // called when the window on which MSWSetEraseBgHook() had been called + // receives WM_ERASEBKGND + virtual bool MSWEraseBgHook(WXHDC WXUNUSED(hDC)) { return false; } +#endif // wxHAS_MSW_BACKGROUND_ERASE_HOOK + + // common part of Show/HideWithEffect() + bool MSWShowWithEffect(bool show, + wxShowEffect effect, + unsigned timeout); + + // Responds to colour changes: passes event on to children. + void OnSysColourChanged(wxSysColourChangedEvent& event); + + // initialize various fields of wxMouseEvent (common part of MSWOnMouseXXX) + void InitMouseEvent(wxMouseEvent& event, int x, int y, WXUINT flags); + + // check if mouse is in the window + bool IsMouseInWindow() const; + + virtual void SetDoubleBuffered(bool on) wxOVERRIDE; + virtual bool IsDoubleBuffered() const wxOVERRIDE; + + // synthesize a wxEVT_LEAVE_WINDOW event and set m_mouseInWindow to false + void GenerateMouseLeave(); + + // virtual function for implementing internal idle + // behaviour + virtual void OnInternalIdle() wxOVERRIDE; + +#if wxUSE_MENUS && !defined(__WXUNIVERSAL__) + virtual bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu); + + // handle WM_(UN)INITMENUPOPUP message to generate wxEVT_MENU_OPEN/CLOSE + bool HandleMenuPopup(wxEventType evtType, WXHMENU hMenu); + + // Command part of HandleMenuPopup() and HandleExitMenuLoop(). + virtual bool DoSendMenuOpenCloseEvent(wxEventType evtType, wxMenu* menu); + + // Find the menu corresponding to the given handle. + virtual wxMenu* MSWFindMenuFromHMENU(WXHMENU hMenu); +#endif // wxUSE_MENUS && !__WXUNIVERSAL__ + + // Return the default button for the TLW containing this window or NULL if + // none. + static wxButton* MSWGetDefaultButtonFor(wxWindow* win); + + // Simulate a click on the given button if it is non-null, enabled and + // shown. + // + // Return true if the button was clicked, false otherwise. + static bool MSWClickButtonIfPossible(wxButton* btn); + + // This method is used for handling wxRadioButton-related complications, + // see wxRadioButton::SetValue(). + // + // It should be overridden by all classes storing the "last focused" + // window to avoid focusing an unset radio button when regaining focus. + virtual void WXSetPendingFocus(wxWindow* WXUNUSED(win)) {} + + // Called from WM_DPICHANGED handler for all windows to let them update + // any sizes and fonts used internally when the DPI changes and generate + // wxDPIChangedEvent to let the user code do the same thing as well. + // + // Return true if the event was processed, false otherwise. + bool MSWUpdateOnDPIChange(const wxSize& oldDPI, const wxSize& newDPI); + +protected: + virtual void WXAdjustFontToOwnPPI(wxFont& font) const wxOVERRIDE; + + // Called from MSWUpdateOnDPIChange() specifically to update the control + // font, as this may need to be done differently for some specific native + // controls. The default version updates m_font of this window. + virtual void MSWUpdateFontOnDPIChange(const wxSize& newDPI); + + // this allows you to implement standard control borders without + // repeating the code in different classes that are not derived from + // wxControl + virtual wxBorder GetDefaultBorderForControl() const wxOVERRIDE; + + // choose the default border for this window + virtual wxBorder GetDefaultBorder() const wxOVERRIDE; + + // Translate wxBORDER_THEME (and other border styles if necessary to the value + // that makes most sense for this Windows environment + virtual wxBorder TranslateBorder(wxBorder border) const; + +#if wxUSE_MENUS_NATIVE + virtual bool DoPopupMenu( wxMenu *menu, int x, int y ) wxOVERRIDE; +#endif // wxUSE_MENUS_NATIVE + + // the window handle + WXHWND m_hWnd; + + // the old window proc (we subclass all windows) + WXWNDPROC m_oldWndProc; + + // additional (MSW specific) flags + bool m_mouseInWindow:1; + bool m_lastKeydownProcessed:1; + + // the size of one page for scrolling + int m_xThumbSize; + int m_yThumbSize; + + // implement the base class pure virtuals + virtual void DoGetTextExtent(const wxString& string, + int *x, int *y, + int *descent = NULL, + int *externalLeading = NULL, + const wxFont *font = NULL) const wxOVERRIDE; + static void MSWDoClientToScreen( WXHWND hWnd, int *x, int *y ); + static void MSWDoScreenToClient( WXHWND hWnd, int *x, int *y ); + virtual void DoClientToScreen( int *x, int *y ) const wxOVERRIDE; + virtual void DoScreenToClient( int *x, int *y ) const wxOVERRIDE; + virtual void DoGetPosition( int *x, int *y ) const wxOVERRIDE; + virtual void DoGetSize( int *width, int *height ) const wxOVERRIDE; + virtual void DoGetClientSize( int *width, int *height ) const wxOVERRIDE; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; + virtual void DoSetClientSize(int width, int height) wxOVERRIDE; + + virtual void DoCaptureMouse() wxOVERRIDE; + virtual void DoReleaseMouse() wxOVERRIDE; + + virtual void DoEnable(bool enable) wxOVERRIDE; + + virtual void DoFreeze() wxOVERRIDE; + virtual void DoThaw() wxOVERRIDE; + + // this simply moves/resizes the given HWND which is supposed to be our + // sibling (this is useful for controls which are composite at MSW level + // and for which DoMoveWindow() is not enough) + // + // returns true if the window move was deferred, false if it was moved + // immediately (no error return) + bool DoMoveSibling(WXHWND hwnd, int x, int y, int width, int height); + + // move the window to the specified location and resize it: this is called + // from both DoSetSize() and DoSetClientSize() and would usually just call + // ::MoveWindow() except for composite controls which will want to arrange + // themselves inside the given rectangle + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; + +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip( wxToolTip *tip ) wxOVERRIDE; + + // process TTN_NEEDTEXT message properly (i.e. fixing the bugs in + // comctl32.dll in our code -- see the function body for more info) + bool HandleTooltipNotify(WXUINT code, + WXLPARAM lParam, + const wxString& ttip); +#endif // wxUSE_TOOLTIPS + + // This is used by CreateKeyEvent() and also for wxEVT_CHAR[_HOOK] event + // creation. Notice that this method doesn't initialize wxKeyEvent + // m_keyCode and m_uniChar fields. + void InitAnyKeyEvent(wxKeyEvent& event, + WXWPARAM wParam, + WXLPARAM lParam) const; + + // Helper functions used by HandleKeyXXX() methods and some derived + // classes, wParam and lParam have the same meaning as in WM_KEY{DOWN,UP}. + // + // NB: evType here must be wxEVT_KEY_{DOWN,UP} as wParam here contains the + // virtual key code, not character! + wxKeyEvent CreateKeyEvent(wxEventType evType, + WXWPARAM wParam, + WXLPARAM lParam = 0) const; + + // Another helper for creating wxKeyEvent for wxEVT_CHAR and related types. + // + // The wParam and lParam here must come from WM_CHAR event parameters, i.e. + // wParam must be a character and not a virtual code. + wxKeyEvent CreateCharEvent(wxEventType evType, + WXWPARAM wParam, + WXLPARAM lParam) const; + + + // default OnEraseBackground() implementation, return true if we did erase + // the background, false otherwise (i.e. the system should erase it) + bool DoEraseBackground(WXHDC hDC); + + // generate WM_CHANGEUISTATE if it's needed for the OS we're running under + // + // action should be one of the UIS_XXX constants + // state should be one or more of the UISF_XXX constants + // if action == UIS_INITIALIZE then it doesn't seem to matter what we use + // for state as the system will decide for us what needs to be set + void MSWUpdateUIState(int action, int state = 0); + + // translate wxWidgets coords into Windows ones suitable to be passed to + // ::CreateWindow(), called from MSWCreate() + virtual void MSWGetCreateWindowCoords(const wxPoint& pos, + const wxSize& size, + int& x, int& y, + int& w, int& h) const; + + bool MSWEnableHWND(WXHWND hWnd, bool enable); + + // Return the pointer to this window or one of its sub-controls if this ID + // and HWND combination belongs to one of them. + // + // This is used by FindItem() and is overridden in wxControl, see there. + virtual wxWindow* MSWFindItem(long WXUNUSED(id), WXHWND WXUNUSED(hWnd)) const + { + return NULL; + } + +private: + // common part of all ctors + void Init(); + + // the (non-virtual) handlers for the events + bool HandleMove(int x, int y); + bool HandleMoving(wxRect& rect); + bool HandleJoystickEvent(WXUINT msg, int x, int y, WXUINT flags); + bool HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); + +#ifndef __WXUNIVERSAL__ + // Call ::IsDialogMessage() if it is safe to do it (i.e. if it's not going + // to hang or do something else stupid) with the given message, return true + // if the message was handled by it. + bool MSWSafeIsDialogMessage(WXMSG* msg); +#endif // __WXUNIVERSAL__ + + static inline bool MSWIsPositionDirectlySupported(int x, int y) + { + // The supported coordinate intervals for various functions are: + // - MoveWindow, DeferWindowPos: [-32768, 32767] a.k.a. [SHRT_MIN, SHRT_MAX]; + // - CreateWindow, CreateWindowEx: [-32768, 32554]. + // CreateXXX will _sometimes_ manage to create the window at higher coordinates + // like 32580, 32684, 32710, but that was not consistent and the lowest common + // limit was 32554 (so far at least). + return (x >= SHRT_MIN && x <= 32554 && y >= SHRT_MIN && y <= 32554); + } + +protected: + WXHWND MSWCreateWindowAtAnyPosition(WXDWORD exStyle, const wxChar* clName, + const wxChar* title, WXDWORD style, + int x, int y, int width, int height, + WXHWND parent, wxWindowID id); + + void MSWMoveWindowToAnyPosition(WXHWND hwnd, int x, int y, + int width, int height, bool bRepaint); + +#if wxUSE_DEFERRED_SIZING + // this function is called after the window was resized to its new size + virtual void MSWEndDeferWindowPos() + { + m_pendingPosition = wxDefaultPosition; + m_pendingSize = wxDefaultSize; + } + + // current defer window position operation handle (may be NULL) + WXHANDLE m_hDWP; + + // When deferred positioning is done these hold the pending changes, and + // are used for the default values if another size/pos changes is done on + // this window before the group of deferred changes is completed. + wxPoint m_pendingPosition; + wxSize m_pendingSize; +#endif // wxUSE_DEFERRED_SIZING + +private: + wxDECLARE_DYNAMIC_CLASS(wxWindowMSW); + wxDECLARE_NO_COPY_CLASS(wxWindowMSW); + wxDECLARE_EVENT_TABLE(); +}; + +// window creation helper class: before creating a new HWND, instantiate an +// object of this class on stack - this allows to process the messages sent to +// the window even before CreateWindow() returns +class wxWindowCreationHook +{ +public: + wxWindowCreationHook(wxWindowMSW *winBeingCreated); + ~wxWindowCreationHook(); +}; + +#endif // _WX_WINDOW_H_ diff --git a/lib/wxWidgets/include/wx/msw/winundef.h b/lib/wxWidgets/include/wx/msw/winundef.h new file mode 100644 index 0000000..feebf2b --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/winundef.h @@ -0,0 +1,445 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: winundef.h +// Purpose: undefine the common symbols #define'd by <windows.h> +// Author: Vadim Zeitlin +// Modified by: +// Created: 16.05.99 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +/* THIS SHOULD NOT BE USED since you might include it once e.g. in window.h, + * then again _AFTER_ you've included windows.h, in which case it won't work + * a 2nd time -- JACS +#ifndef _WX_WINUNDEF_H_ +#define _WX_WINUNDEF_H_ + */ + +#ifndef wxUSE_UNICODE_WINDOWS_H + #ifdef _UNICODE + #define wxUSE_UNICODE_WINDOWS_H 1 + #else + #define wxUSE_UNICODE_WINDOWS_H 0 + #endif +#endif + +// ---------------------------------------------------------------------------- +// windows.h #defines the following identifiers which are also used in wxWin so +// we replace these symbols with the corresponding inline functions and +// undefine the macro. +// +// This looks quite ugly here but allows us to write clear (and correct!) code +// elsewhere because the functions, unlike the macros, respect the scope. +// ---------------------------------------------------------------------------- + +// CreateDialog + +#if defined(CreateDialog) + #undef CreateDialog + + inline HWND CreateDialog(HINSTANCE hInstance, + LPCTSTR pTemplate, + HWND hwndParent, + DLGPROC pDlgProc) + { + #if wxUSE_UNICODE_WINDOWS_H + return CreateDialogW(hInstance, pTemplate, hwndParent, pDlgProc); + #else + return CreateDialogA(hInstance, pTemplate, hwndParent, pDlgProc); + #endif + } +#endif + +// CreateFont + +#ifdef CreateFont + #undef CreateFont + + inline HFONT CreateFont(int height, + int width, + int escapement, + int orientation, + int weight, + DWORD italic, + DWORD underline, + DWORD strikeout, + DWORD charset, + DWORD outprecision, + DWORD clipprecision, + DWORD quality, + DWORD family, + LPCTSTR facename) + { + #if wxUSE_UNICODE_WINDOWS_H + return CreateFontW(height, width, escapement, orientation, + weight, italic, underline, strikeout, charset, + outprecision, clipprecision, quality, + family, facename); + #else + return CreateFontA(height, width, escapement, orientation, + weight, italic, underline, strikeout, charset, + outprecision, clipprecision, quality, + family, facename); + #endif + } +#endif // CreateFont + +// CreateWindow + +#if defined(CreateWindow) + #undef CreateWindow + + inline HWND CreateWindow(LPCTSTR lpClassName, + LPCTSTR lpWndClass, + DWORD dwStyle, + int x, int y, int w, int h, + HWND hWndParent, + HMENU hMenu, + HINSTANCE hInstance, + LPVOID lpParam) + { + #if wxUSE_UNICODE_WINDOWS_H + return CreateWindowW(lpClassName, lpWndClass, dwStyle, x, y, w, h, + hWndParent, hMenu, hInstance, lpParam); + #else + return CreateWindowA(lpClassName, lpWndClass, dwStyle, x, y, w, h, + hWndParent, hMenu, hInstance, lpParam); + #endif + } +#endif + +// LoadMenu + +#ifdef LoadMenu + #undef LoadMenu + + inline HMENU LoadMenu(HINSTANCE instance, LPCTSTR name) + { + #if wxUSE_UNICODE_WINDOWS_H + return LoadMenuW(instance, name); + #else + return LoadMenuA(instance, name); + #endif + } +#endif + +// FindText + +#ifdef FindText + #undef FindText + + inline HWND APIENTRY FindText(LPFINDREPLACE lpfindreplace) + { + #if wxUSE_UNICODE_WINDOWS_H + return FindTextW(lpfindreplace); + #else + return FindTextA(lpfindreplace); + #endif + } +#endif + +// GetCharWidth + +#ifdef GetCharWidth + #undef GetCharWidth + inline BOOL GetCharWidth(HDC dc, UINT first, UINT last, LPINT buffer) + { + #if wxUSE_UNICODE_WINDOWS_H + return GetCharWidthW(dc, first, last, buffer); + #else + return GetCharWidthA(dc, first, last, buffer); + #endif + } +#endif + +// FindWindow + +#ifdef FindWindow + #undef FindWindow + #if wxUSE_UNICODE_WINDOWS_H + inline HWND FindWindow(LPCWSTR classname, LPCWSTR windowname) + { + return FindWindowW(classname, windowname); + } + #else + inline HWND FindWindow(LPCSTR classname, LPCSTR windowname) + { + return FindWindowA(classname, windowname); + } + #endif +#endif + +// PlaySound + +#ifdef PlaySound + #undef PlaySound + #if wxUSE_UNICODE_WINDOWS_H + inline BOOL PlaySound(LPCWSTR pszSound, HMODULE hMod, DWORD fdwSound) + { + return PlaySoundW(pszSound, hMod, fdwSound); + } + #else + inline BOOL PlaySound(LPCSTR pszSound, HMODULE hMod, DWORD fdwSound) + { + return PlaySoundA(pszSound, hMod, fdwSound); + } + #endif +#endif + +// GetClassName + +#ifdef GetClassName + #undef GetClassName + #if wxUSE_UNICODE_WINDOWS_H + inline int GetClassName(HWND h, LPWSTR classname, int maxcount) + { + return GetClassNameW(h, classname, maxcount); + } + #else + inline int GetClassName(HWND h, LPSTR classname, int maxcount) + { + return GetClassNameA(h, classname, maxcount); + } + #endif +#endif + +// GetClassInfo + +#ifdef GetClassInfo + #undef GetClassInfo + #if wxUSE_UNICODE_WINDOWS_H + inline BOOL GetClassInfo(HINSTANCE h, LPCWSTR name, LPWNDCLASSW winclass) + { + return GetClassInfoW(h, name, winclass); + } + #else + inline BOOL GetClassInfo(HINSTANCE h, LPCSTR name, LPWNDCLASSA winclass) + { + return GetClassInfoA(h, name, winclass); + } + #endif +#endif + +// LoadAccelerators + +#ifdef LoadAccelerators + #undef LoadAccelerators + #if wxUSE_UNICODE_WINDOWS_H + inline HACCEL LoadAccelerators(HINSTANCE h, LPCWSTR name) + { + return LoadAcceleratorsW(h, name); + } + #else + inline HACCEL LoadAccelerators(HINSTANCE h, LPCSTR name) + { + return LoadAcceleratorsA(h, name); + } + #endif +#endif + +// DrawText + +#ifdef DrawText + #undef DrawText + #if wxUSE_UNICODE_WINDOWS_H + inline int DrawText(HDC h, LPCWSTR str, int count, LPRECT rect, UINT format) + { + return DrawTextW(h, str, count, rect, format); + } + #else + inline int DrawText(HDC h, LPCSTR str, int count, LPRECT rect, UINT format) + { + return DrawTextA(h, str, count, rect, format); + } + #endif +#endif + + +// StartDoc + +#ifdef StartDoc + #undef StartDoc + + #if wxUSE_UNICODE_WINDOWS_H + inline int StartDoc(HDC h, CONST DOCINFOW* info) + { + return StartDocW(h, const_cast<DOCINFOW*>(info)); + } + #else + inline int StartDoc(HDC h, CONST DOCINFOA* info) + { + return StartDocA(h, const_cast<DOCINFOA*>(info)); + } + #endif +#endif + +// GetObject + +#ifdef GetObject + #undef GetObject + inline int GetObject(HGDIOBJ h, int i, LPVOID buffer) + { + #if wxUSE_UNICODE_WINDOWS_H + return GetObjectW(h, i, buffer); + #else + return GetObjectA(h, i, buffer); + #endif + } +#endif + +// GetMessage + +#ifdef GetMessage + #undef GetMessage + inline int GetMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax) + { + #if wxUSE_UNICODE_WINDOWS_H + return GetMessageW(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax); + #else + return GetMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax); + #endif + } +#endif + +// LoadIcon +#ifdef LoadIcon + #undef LoadIcon + inline HICON LoadIcon(HINSTANCE hInstance, LPCTSTR lpIconName) + { + #if wxUSE_UNICODE_WINDOWS_H + return LoadIconW(hInstance, lpIconName); + #else // ANSI + return LoadIconA(hInstance, lpIconName); + #endif // Unicode/ANSI + } +#endif // LoadIcon + +// LoadBitmap +#ifdef LoadBitmap + #undef LoadBitmap + inline HBITMAP LoadBitmap(HINSTANCE hInstance, LPCTSTR lpBitmapName) + { + #if wxUSE_UNICODE_WINDOWS_H + return LoadBitmapW(hInstance, lpBitmapName); + #else // ANSI + return LoadBitmapA(hInstance, lpBitmapName); + #endif // Unicode/ANSI + } +#endif // LoadBitmap + +// LoadLibrary + +#ifdef LoadLibrary + #undef LoadLibrary + #if wxUSE_UNICODE_WINDOWS_H + inline HINSTANCE LoadLibrary(LPCWSTR lpLibFileName) + { + return LoadLibraryW(lpLibFileName); + } + #else + inline HINSTANCE LoadLibrary(LPCSTR lpLibFileName) + { + return LoadLibraryA(lpLibFileName); + } + #endif +#endif + +// FindResource +#ifdef FindResource + #undef FindResource + #if wxUSE_UNICODE_WINDOWS_H + inline HRSRC FindResource(HMODULE hModule, LPCWSTR lpName, LPCWSTR lpType) + { + return FindResourceW(hModule, lpName, lpType); + } + #else + inline HRSRC FindResource(HMODULE hModule, LPCSTR lpName, LPCSTR lpType) + { + return FindResourceA(hModule, lpName, lpType); + } + #endif +#endif + +// IsMaximized + +#ifdef IsMaximized + #undef IsMaximized + inline BOOL IsMaximized(HWND hwnd) + { + return IsZoomed(hwnd); + } +#endif + +// GetFirstChild + +#ifdef GetFirstChild + #undef GetFirstChild + inline HWND GetFirstChild(HWND hwnd) + { + return GetTopWindow(hwnd); + } +#endif + +// GetFirstSibling + +#ifdef GetFirstSibling + #undef GetFirstSibling + inline HWND GetFirstSibling(HWND hwnd) + { + return GetWindow(hwnd,GW_HWNDFIRST); + } +#endif + +// GetLastSibling + +#ifdef GetLastSibling + #undef GetLastSibling + inline HWND GetLastSibling(HWND hwnd) + { + return GetWindow(hwnd,GW_HWNDLAST); + } +#endif + +// GetPrevSibling + +#ifdef GetPrevSibling + #undef GetPrevSibling + inline HWND GetPrevSibling(HWND hwnd) + { + return GetWindow(hwnd,GW_HWNDPREV); + } +#endif + +// GetNextSibling + +#ifdef GetNextSibling + #undef GetNextSibling + inline HWND GetNextSibling(HWND hwnd) + { + return GetWindow(hwnd,GW_HWNDNEXT); + } +#endif + +// For WINE + +#if defined(GetWindowStyle) + #undef GetWindowStyle +#endif + +// For ming and cygwin + +#ifdef Yield + #undef Yield +#endif + + +// GetWindowProc +//ifdef GetWindowProc +// #undef GetWindowProc +//endif +//ifdef GetNextChild +// #undef GetNextChild +//endif + +// #endif // _WX_WINUNDEF_H_ + diff --git a/lib/wxWidgets/include/wx/msw/winver.h b/lib/wxWidgets/include/wx/msw/winver.h new file mode 100644 index 0000000..bd9536d --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/winver.h @@ -0,0 +1,36 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/winver.h +// Purpose: Define Windows version macros if they're not predefined. +// Author: Vadim Zeitlin +// Created: 2017-01-13 (extracted from wx/msw/wrapwin.h) +// Copyright: (c) 2017 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_WINVER_H_ +#define _WX_MSW_WINVER_H_ + +// Notice that this header must not include any other wx headers as it's +// indirectly included from wx/defs.h itself when using gcc (via wx/platform.h, +// then wx/compiler.h and wx/msw/gccpriv.h). + +// Define WINVER, _WIN32_WINNT and _WIN32_IE to the highest possible values +// because we always check for the version of installed DLLs at runtime anyway +// (see wxGetWinVersion() and wxApp::GetComCtl32Version()) unless the user +// really doesn't want to use APIs only available on later OS versions and had +// defined them to (presumably lower) values -- or, alternatively, wants to use +// even higher version of the API which will become available later. + +#ifndef WINVER + #define WINVER 0x0A00 +#endif + +#ifndef _WIN32_WINNT + #define _WIN32_WINNT 0x0A00 +#endif + +#ifndef _WIN32_IE + #define _WIN32_IE 0x0A00 +#endif + +#endif // _WX_MSW_WINVER_H_ diff --git a/lib/wxWidgets/include/wx/msw/wrapcctl.h b/lib/wxWidgets/include/wx/msw/wrapcctl.h new file mode 100644 index 0000000..e19111a --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/wrapcctl.h @@ -0,0 +1,46 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/wrapcctl.h +// Purpose: Wrapper for the standard <commctrl.h> header +// Author: Vadim Zeitlin +// Modified by: +// Created: 03.08.2003 +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_WRAPCCTL_H_ +#define _WX_MSW_WRAPCCTL_H_ + +#include "wx/msw/wrapwin.h" + +#include <commctrl.h> + +// define things which might be missing from our commctrl.h +#include "wx/msw/missing.h" + +// Set Unicode format for a common control +inline void wxSetCCUnicodeFormat(HWND hwnd) +{ + ::SendMessage(hwnd, CCM_SETUNICODEFORMAT, wxUSE_UNICODE, 0); +} + +#if wxUSE_GUI +// Return the default font for the common controls +// +// this is implemented in msw/settings.cpp +class wxFont; +extern wxFont wxGetCCDefaultFont(); + +// this is just a wrapper for HDITEM which we can't use in the public header +// because we don't want to include commctrl.h (and hence windows.h) from there +struct wxHDITEM : public HDITEM +{ + wxHDITEM() + { + ::ZeroMemory(this, sizeof(*this)); + } +}; + +#endif // wxUSE_GUI + +#endif // _WX_MSW_WRAPCCTL_H_ diff --git a/lib/wxWidgets/include/wx/msw/wrapcdlg.h b/lib/wxWidgets/include/wx/msw/wrapcdlg.h new file mode 100644 index 0000000..038a9bc --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/wrapcdlg.h @@ -0,0 +1,27 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/wrapcdlg.h +// Purpose: Wrapper for the standard <commdlg.h> header +// Author: Wlodzimierz ABX Skiba +// Modified by: +// Created: 22.03.2005 +// Copyright: (c) 2005 Wlodzimierz Skiba +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_WRAPCDLG_H_ +#define _WX_MSW_WRAPCDLG_H_ + +#include "wx/defs.h" + +#include "wx/msw/wrapwin.h" +#include "wx/msw/private.h" +#include "wx/msw/missing.h" + +#if wxUSE_COMMON_DIALOGS + #include <commdlg.h> +#endif + +#include "wx/msw/winundef.h" + +#endif // _WX_MSW_WRAPCDLG_H_ + diff --git a/lib/wxWidgets/include/wx/msw/wrapgdip.h b/lib/wxWidgets/include/wx/msw/wrapgdip.h new file mode 100644 index 0000000..b5cd721 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/wrapgdip.h @@ -0,0 +1,41 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/wrapgdip.h +// Purpose: wrapper around <gdiplus.h> header +// Author: Vadim Zeitlin +// Created: 2007-03-15 +// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_WRAPGDIP_H_ +#define _WX_MSW_WRAPGDIP_H_ + +#include "wx/msw/wrapwin.h" + +// min and max must be available for gdiplus.h but we cannot define them as +// macros because they conflict with std::numeric_limits<T>::min and max when +// compiling with mingw-w64 and -std=c++17. This happens because with c++17, +// math.h includes bessel_function which requires std::numeric_limits. + +#include <cmath> +using std::min; +using std::max; + +// There are many clashes between the names of the member fields and parameters +// in the standard gdiplus.h header and each of them results in C4458 with +// VC14, so disable this warning for this file as there is no other way to +// avoid it. +#ifdef __VISUALC__ + #pragma warning(push) + #pragma warning(disable:4458) // declaration of 'xxx' hides class member +#endif + +#include <gdiplus.h> +using namespace Gdiplus; + +#ifdef __VISUALC__ + #pragma warning(pop) +#endif + +#endif // _WX_MSW_WRAPGDIP_H_ + diff --git a/lib/wxWidgets/include/wx/msw/wrapshl.h b/lib/wxWidgets/include/wx/msw/wrapshl.h new file mode 100644 index 0000000..06ae96e --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/wrapshl.h @@ -0,0 +1,100 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/wrapshl.h +// Purpose: wrapper class for stuff from shell32.dll +// Author: Vadim Zeitlin +// Modified by: +// Created: 2004-10-19 +// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_WRAPSHL_H_ +#define _WX_MSW_WRAPSHL_H_ + +#include "wx/msw/wrapwin.h" + +#ifdef __VISUALC__ + // Disable a warning that we can do nothing about: we get it for + // shlobj.h at least from 7.1a Windows kit when using VC14. + #pragma warning(push) + + // 'typedef ': ignored on left of '' when no variable is declared + #pragma warning(disable:4091) +#endif + +#include <shlobj.h> + +#ifdef __VISUALC__ + #pragma warning(pop) +#endif + +#include "wx/msw/winundef.h" + +#include "wx/log.h" + +// ---------------------------------------------------------------------------- +// wxItemIdList implements RAII on top of ITEMIDLIST +// ---------------------------------------------------------------------------- + +class wxItemIdList +{ +public: + // ctor takes ownership of the item and will free it + wxItemIdList(LPITEMIDLIST pidl) + { + m_pidl = pidl; + } + + static void Free(LPITEMIDLIST pidl) + { + if ( pidl ) + { + LPMALLOC pMalloc; + SHGetMalloc(&pMalloc); + if ( pMalloc ) + { + pMalloc->Free(pidl); + pMalloc->Release(); + } + else + { + wxLogLastError(wxT("SHGetMalloc")); + } + } + } + + ~wxItemIdList() + { + Free(m_pidl); + } + + // implicit conversion to LPITEMIDLIST + operator LPITEMIDLIST() const { return m_pidl; } + + // get the corresponding path, returns empty string on error + wxString GetPath() const + { + wxString path; + if ( !SHGetPathFromIDList(m_pidl, wxStringBuffer(path, MAX_PATH)) ) + { + wxLogLastError(wxT("SHGetPathFromIDList")); + } + + return path; + } + +private: + LPITEMIDLIST m_pidl; + + wxDECLARE_NO_COPY_CLASS(wxItemIdList); +}; + +// enable autocompleting filenames in the text control with given HWND +// +// this only works on systems with shlwapi.dll 5.0 or later +// +// implemented in src/msw/utilsgui.cpp +extern bool wxEnableFileNameAutoComplete(HWND hwnd); + +#endif // _WX_MSW_WRAPSHL_H_ + diff --git a/lib/wxWidgets/include/wx/msw/wrapwin.h b/lib/wxWidgets/include/wx/msw/wrapwin.h new file mode 100644 index 0000000..6bda4c6 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/wrapwin.h @@ -0,0 +1,58 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/wrapwin.h +// Purpose: Wrapper around <windows.h>, to be included instead of it +// Author: Vaclav Slavik +// Created: 2003/07/22 +// Copyright: (c) 2003 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WRAPWIN_H_ +#define _WX_WRAPWIN_H_ + +#include "wx/platform.h" + +// before including windows.h, define version macros at (currently) maximal +// values because we do all our checks at run-time anyhow +#include "wx/msw/winver.h" + +// strict type checking to detect conversion from HFOO to HBAR at compile-time +#ifndef STRICT + #define STRICT 1 +#endif + +// this macro tells windows.h to not define min() and max() as macros: we need +// this as otherwise they conflict with standard C++ functions +#ifndef NOMINMAX + #define NOMINMAX +#endif // NOMINMAX + +// Disable any warnings inside Windows headers. +#ifdef __VISUALC__ + #pragma warning(push, 1) +#endif + +// When the application wants to use <winsock2.h> (this is required for IPv6 +// support, for example), we must include it before winsock.h, and as windows.h +// includes winsock.h, we have to do it before including it. +#if wxUSE_SOCKETS && wxUSE_WINSOCK2 + // Avoid warnings about Winsock 1.x functions deprecated in Winsock 2 that + // we still use (and that will certainly remain available for the + // foreseeable future anyhow). + #ifndef _WINSOCK_DEPRECATED_NO_WARNINGS + #define _WINSOCK_DEPRECATED_NO_WARNINGS + #endif + + #include <winsock2.h> +#endif + +#include <windows.h> + +#ifdef __VISUALC__ + #pragma warning(pop) +#endif + +// #undef the macros defined in windows.h which conflict with code elsewhere +#include "wx/msw/winundef.h" + +#endif // _WX_WRAPWIN_H_ diff --git a/lib/wxWidgets/include/wx/msw/wrl/EventToken.h b/lib/wxWidgets/include/wx/msw/wrl/EventToken.h new file mode 100644 index 0000000..8d178ba --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/wrl/EventToken.h @@ -0,0 +1,21 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/wrl/EventToken.h +// Purpose: WRL EventRegistrationToken implementation +// Author: Maarten Bent +// Created: 2021-02-26 +// Copyright: (c) 2021 wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// Note: this include guard uses the same name as winrt/EventToken.h in the +// Windows SDK to prevent a struct type redefinition when both headers are +// included. +#ifndef __eventtoken_h__ +#define __eventtoken_h__ + +typedef struct EventRegistrationToken +{ + __int64 value; +} EventRegistrationToken; + +#endif // __eventtoken_h__ diff --git a/lib/wxWidgets/include/wx/msw/wrl/event.h b/lib/wxWidgets/include/wx/msw/wrl/event.h new file mode 100644 index 0000000..71a2d86 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/wrl/event.h @@ -0,0 +1,104 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/wrl/event.h +// Purpose: WRL event callback implementation +// Author: nns52k +// Created: 2021-02-25 +// Copyright: (c) 2021 wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_PRIVATE_WRL_H_ +#define _WX_MSW_PRIVATE_WRL_H_ + +#include <atomic> + +template <typename baseT, typename ...argTs> +class CInvokable : public baseT +{ +public: + CInvokable() : m_nRefCount(0) {} + virtual ~CInvokable() {} + // IUnknown methods + HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObj) override + { + if (riid == __uuidof(baseT) || riid == IID_IUnknown) + { + *ppvObj = this; + AddRef(); + return S_OK; + } + + *ppvObj = NULL; + return E_NOINTERFACE; + } + ULONG STDMETHODCALLTYPE AddRef() override + { + return ++m_nRefCount; + } + ULONG STDMETHODCALLTYPE Release() override + { + size_t ret = --m_nRefCount; + if (ret == 0) + delete this; + return ret; + } +private: + std::atomic<size_t> m_nRefCount; +}; + +template <typename baseT, typename ...argTs> +class CInvokableLambda : public CInvokable<baseT, argTs...> +{ +public: + CInvokableLambda(std::function<HRESULT(argTs...)> lambda) + : m_lambda(lambda) + {} + // baseT method + HRESULT STDMETHODCALLTYPE Invoke(argTs ...args) override + { + return m_lambda(args...); + } +private: + std::function<HRESULT(argTs...)> m_lambda; +}; + +template <typename baseT, typename contextT, typename ...argTs> +class CInvokableMethod : public CInvokable<baseT, argTs...> +{ +public: + CInvokableMethod(contextT* ctx, HRESULT(contextT::* mthd)(argTs...)) + : m_ctx(ctx), m_mthd(mthd) + {} + // baseT method + HRESULT STDMETHODCALLTYPE Invoke(argTs ...args) override + { + return (m_ctx->*m_mthd)(args...); + } +private: + contextT* m_ctx; + HRESULT(contextT::* m_mthd)(argTs...); +}; + +// the function templates to generate concrete classes from above class templates +template < + typename baseT, typename lambdaT, // base type & lambda type + typename LT, typename ...argTs // for capturing argument types of lambda +> +wxCOMPtr<baseT> Callback_impl(lambdaT&& lambda, HRESULT(LT::*)(argTs...) const) +{ + return wxCOMPtr<baseT>(new CInvokableLambda<baseT, argTs...>(lambda)); +} + +template <typename baseT, typename lambdaT> +wxCOMPtr<baseT> Callback(lambdaT&& lambda) +{ + return Callback_impl<baseT>(std::move(lambda), &lambdaT::operator()); +} + +template <typename baseT, typename contextT, typename ...argTs> +wxCOMPtr<baseT> Callback(contextT* ctx, HRESULT(contextT::* mthd)(argTs...)) +{ + return wxCOMPtr<baseT>(new CInvokableMethod<baseT, contextT, argTs...>(ctx, mthd)); +} + +#endif // _WX_MSW_PRIVATE_WRL_H_ diff --git a/lib/wxWidgets/include/wx/msw/wx.manifest b/lib/wxWidgets/include/wx/msw/wx.manifest new file mode 100644 index 0000000..45bfff9 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/wx.manifest @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> +<assemblyIdentity + version="0.64.1.0" + processorArchitecture="x86" + name="Controls" + type="win32" +/> +<description>wxWidgets application</description> +<dependency> + <dependentAssembly> + <assemblyIdentity + type="win32" + name="Microsoft.Windows.Common-Controls" + version="6.0.0.0" + processorArchitecture="*" + publicKeyToken="6595b64144ccf1df" + language="*" + /> + </dependentAssembly> +</dependency> +</assembly> diff --git a/lib/wxWidgets/include/wx/msw/wx.rc b/lib/wxWidgets/include/wx/msw/wx.rc new file mode 100644 index 0000000..a375c88 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/wx.rc @@ -0,0 +1,117 @@ +///////////////////////////////////////////////////////////////////////////// +// File: wx.rc +// Purpose: wxWindows resource definitions. ALWAYS include +// this in your application resource file. +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#include <windows.h> + +#include <wx/msw/rcdefs.h> + +////////////////////////////////////////////////////////////////////////////// +// +// This is the MDI Window menu +// + +wxWindowMenu MENU DISCARDABLE +BEGIN + POPUP "&Window" + BEGIN + MENUITEM "&Cascade", 4002 + MENUITEM "Tile &Horizontally", 4001 + MENUITEM "Tile &Vertically", 4005 + MENUITEM "", -1 + MENUITEM "&Arrange Icons", 4003 + MENUITEM "&Next", 4004 + END +END + +////////////////////////////////////////////////////////////////////////////// +// +// Standard wxWindows Cursors +// + +WXCURSOR_HAND CURSOR DISCARDABLE "wx/msw/hand.cur" +WXCURSOR_BULLSEYE CURSOR DISCARDABLE "wx/msw/bullseye.cur" +WXCURSOR_PENCIL CURSOR DISCARDABLE "wx/msw/pencil.cur" +WXCURSOR_MAGNIFIER CURSOR DISCARDABLE "wx/msw/magnif1.cur" +WXCURSOR_ROLLER CURSOR DISCARDABLE "wx/msw/roller.cur" +WXCURSOR_PBRUSH CURSOR DISCARDABLE "wx/msw/pbrush.cur" +WXCURSOR_PLEFT CURSOR DISCARDABLE "wx/msw/pntleft.cur" +WXCURSOR_PRIGHT CURSOR DISCARDABLE "wx/msw/pntright.cur" +WXCURSOR_BLANK CURSOR DISCARDABLE "wx/msw/blank.cur" +WXCURSOR_CROSS CURSOR DISCARDABLE "wx/msw/cross.cur" + + +////////////////////////////////////////////////////////////////////////////// +// +// Default Icons +// + +// First wx icon in alphabetical order. +// +// Notice that it also may be used by Explorer as the application icon if the +// main program doesn't define any icons preceding this one in alphabetical +// order (i.e. any icons defined by it start with "wy", "x", "y" or "z") in +// 16*16 or 32*32 sizes. +//wxDEFAULT_FRAME ICON "wx/msw/std.ico" +//wxDEFAULT_MDIPARENTFRAME ICON "wx/msw/mdi.ico" +//wxDEFAULT_MDICHILDFRAME ICON "wx/msw/child.ico" + +// Standard small icons +wxICON_SMALL_CLOSED_FOLDER ICON "wx/msw/folder1.ico" +wxICON_SMALL_OPEN_FOLDER ICON "wx/msw/folder2.ico" +wxICON_SMALL_FILE ICON "wx/msw/file1.ico" +wxICON_SMALL_COMPUTER ICON "wx/msw/computer.ico" +wxICON_SMALL_DRIVE ICON "wx/msw/drive.ico" +wxICON_SMALL_CDROM ICON "wx/msw/cdrom.ico" +wxICON_SMALL_FLOPPY ICON "wx/msw/floppy.ico" +wxICON_SMALL_REMOVEABLE ICON "wx/msw/removble.ico" + +////////////////////////////////////////////////////////////////////////////// +// +// Bitmaps +// + +// For wxContextHelpButton +csquery BITMAP "wx/msw/csquery.bmp" + +// For obtaining the RGB values of standard colours +wxBITMAP_STD_COLOURS BITMAP "wx/msw/colours.bmp" + +////////////////////////////////////////////////////////////////////////////// +// +// Include manifest file for common controls library v6 required to use themes. +// +// Predefining wxUSE_NO_MANIFEST as 1 always disables the use of the manifest. +// Otherwise we include it only if wxUSE_RC_MANIFEST is defined as 1. +// + +#if !defined(wxUSE_NO_MANIFEST) || (wxUSE_NO_MANIFEST == 0) + +#if defined(wxUSE_RC_MANIFEST) && wxUSE_RC_MANIFEST + +// see "about isolated applications" topic in MSDN +#ifdef ISOLATION_AWARE_ENABLED + #define wxMANIFEST_ID ISOLATIONAWARE_MANIFEST_RESOURCE_ID +#else + #define wxMANIFEST_ID CREATEPROCESS_MANIFEST_RESOURCE_ID +#endif + +#if !defined(wxUSE_DPI_AWARE_MANIFEST) || wxUSE_DPI_AWARE_MANIFEST == 0 + #define wxMANIFEST_FILE "wx/msw/wx.manifest" +#elif wxUSE_DPI_AWARE_MANIFEST == 1 + #define wxMANIFEST_FILE "wx/msw/wx_dpi_aware.manifest" +#elif wxUSE_DPI_AWARE_MANIFEST == 2 + #define wxMANIFEST_FILE "wx/msw/wx_dpi_aware_pmv2.manifest" +#endif +wxMANIFEST_ID RT_MANIFEST wxMANIFEST_FILE + +#endif // wxUSE_RC_MANIFEST + +#endif // !defined(wxUSE_NO_MANIFEST) || (wxUSE_NO_MANIFEST == 0) diff --git a/lib/wxWidgets/include/wx/msw/wx_dpi_aware.manifest b/lib/wxWidgets/include/wx/msw/wx_dpi_aware.manifest new file mode 100644 index 0000000..ab04033 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/wx_dpi_aware.manifest @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"> + <dependency> + <dependentAssembly> + <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*" /> + </dependentAssembly> + </dependency> + <asmv2:trustInfo xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"> + <asmv2:security> + <asmv2:requestedPrivileges> + <asmv2:requestedExecutionLevel level="asInvoker" uiAccess="false" /> + </asmv2:requestedPrivileges> + </asmv2:security> + </asmv2:trustInfo> + <asmv3:application> + <asmv3:windowsSettings> + <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware> + </asmv3:windowsSettings> + </asmv3:application> + <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> + <application> + <!-- Windows Vista --> + <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" /> + <!-- Windows 7 --> + <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" /> + <!-- Windows 8 --> + <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" /> + <!-- Windows 8.1 --> + <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" /> + <!-- Windows 10 --> + <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" /> + </application> + </compatibility> +</assembly> diff --git a/lib/wxWidgets/include/wx/msw/wx_dpi_aware_pmv2.manifest b/lib/wxWidgets/include/wx/msw/wx_dpi_aware_pmv2.manifest new file mode 100644 index 0000000..407c991 --- /dev/null +++ b/lib/wxWidgets/include/wx/msw/wx_dpi_aware_pmv2.manifest @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"> + <dependency> + <dependentAssembly> + <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*" /> + </dependentAssembly> + </dependency> + <asmv2:trustInfo xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"> + <asmv2:security> + <asmv2:requestedPrivileges> + <asmv2:requestedExecutionLevel level="asInvoker" uiAccess="false" /> + </asmv2:requestedPrivileges> + </asmv2:security> + </asmv2:trustInfo> + <asmv3:application> + <asmv3:windowsSettings> + <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, system</dpiAwareness> + <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware> + </asmv3:windowsSettings> + </asmv3:application> + <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> + <application> + <!-- Windows Vista --> + <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" /> + <!-- Windows 7 --> + <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" /> + <!-- Windows 8 --> + <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" /> + <!-- Windows 8.1 --> + <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" /> + <!-- Windows 10 --> + <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" /> + </application> + </compatibility> +</assembly> diff --git a/lib/wxWidgets/include/wx/nativewin.h b/lib/wxWidgets/include/wx/nativewin.h new file mode 100644 index 0000000..fc10767 --- /dev/null +++ b/lib/wxWidgets/include/wx/nativewin.h @@ -0,0 +1,249 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/nativewin.h +// Purpose: classes allowing to wrap a native window handle +// Author: Vadim Zeitlin +// Created: 2008-03-05 +// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_NATIVEWIN_H_ +#define _WX_NATIVEWIN_H_ + +#include "wx/toplevel.h" + +// These symbols can be tested in the user code to see if the current wx port +// has support for creating wxNativeContainerWindow and wxNativeWindow from +// native windows. +// +// Be optimistic by default, we undefine them below if necessary. +#define wxHAS_NATIVE_CONTAINER_WINDOW +#define wxHAS_NATIVE_WINDOW + +// we define the following typedefs for each of the platform supporting native +// windows wrapping: +// +// - wxNativeContainerWindowHandle is the toolkit-level handle of the native +// window, i.e. HWND/GdkWindow*/NSWindow +// +// - wxNativeContainerWindowId is the lowest level identifier of the native +// window, i.e. HWND/GdkNativeWindow/NSWindow (so it's the same as above for +// all platforms except GTK where we also can work with Window/XID) +// +// - wxNativeWindowHandle for child windows, i.e. HWND/GtkWidget*/NSControl +#if defined(__WXMSW__) + #include "wx/msw/wrapwin.h" + + typedef HWND wxNativeContainerWindowId; + typedef HWND wxNativeContainerWindowHandle; + typedef HWND wxNativeWindowHandle; +#elif defined(__WXGTK__) + // GdkNativeWindow is guint32 under GDK/X11 and gpointer under GDK/WIN32 + #ifdef __UNIX__ + typedef unsigned long wxNativeContainerWindowId; + #else + typedef void *wxNativeContainerWindowId; + #endif + typedef GdkWindow *wxNativeContainerWindowHandle; + typedef GtkWidget *wxNativeWindowHandle; +#elif defined(__WXOSX_COCOA__) + typedef NSView *wxNativeWindowHandle; + + // no support for using native TLWs yet + #undef wxHAS_NATIVE_CONTAINER_WINDOW +#else + // no support for using native windows under this platform yet + #undef wxHAS_NATIVE_CONTAINER_WINDOW + #undef wxHAS_NATIVE_WINDOW +#endif + +#ifdef wxHAS_NATIVE_WINDOW + +// ---------------------------------------------------------------------------- +// wxNativeWindow: for using native windows inside wxWidgets windows +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxNativeWindow : public wxWindow +{ +public: + // Default ctor, Create() must be called later to really create the window. + wxNativeWindow() + { + Init(); + } + + // Create a window from an existing native window handle. + // + // Notice that this ctor doesn't take the usual pos and size parameters, + // they're taken from the window handle itself. + // + // Use GetHandle() to check if the creation was successful, it will return + // 0 if the handle was invalid. + wxNativeWindow(wxWindow* parent, wxWindowID winid, wxNativeWindowHandle handle) + { + Init(); + + Create(parent, winid, handle); + } + + // Same as non-default ctor, but with a return code. + bool Create(wxWindow* parent, wxWindowID winid, wxNativeWindowHandle handle); + + // By default the native window with which this wxWindow is associated is + // owned by the user code and needs to be destroyed by it in a platform + // specific way, however this function can be called to let wxNativeWindow + // dtor take care of destroying the native window instead of having to do + // it from the user code. + void Disown() + { + wxCHECK_RET( m_ownedByUser, wxS("Can't disown more than once") ); + + m_ownedByUser = false; + + DoDisown(); + } + +#ifdef __WXMSW__ + // Prevent the native window, not owned by us, from being destroyed by the + // base class dtor, unless Disown() had been called. + virtual ~wxNativeWindow(); +#endif // __WXMSW__ + +private: + void Init() + { + m_ownedByUser = true; + } + + // This is implemented in platform-specific code. + void DoDisown(); + + // If the native widget owned by the user code. + bool m_ownedByUser; + + wxDECLARE_NO_COPY_CLASS(wxNativeWindow); +}; + +#endif // wxHAS_NATIVE_WINDOW + +#ifdef wxHAS_NATIVE_CONTAINER_WINDOW + +// ---------------------------------------------------------------------------- +// wxNativeContainerWindow: can be used for creating other wxWindows inside it +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxNativeContainerWindow : public wxTopLevelWindow +{ +public: + // default ctor, call Create() later + wxNativeContainerWindow() { } + + // create a window from an existing native window handle + // + // use GetHandle() to check if the creation was successful, it will return + // 0 if the handle was invalid + wxNativeContainerWindow(wxNativeContainerWindowHandle handle) + { + Create(handle); + } + + // same as ctor above but with a return code + bool Create(wxNativeContainerWindowHandle handle); + +#if defined(__WXGTK__) + // this is a convenient ctor for wxGTK applications which can also create + // the objects of this class from the really native window handles and not + // only the GdkWindow objects + // + // wxNativeContainerWindowId is Window (i.e. an XID, i.e. an int) under X11 + // (when GDK_WINDOWING_X11 is defined) or HWND under Win32 + wxNativeContainerWindow(wxNativeContainerWindowId winid) { Create(winid); } + + bool Create(wxNativeContainerWindowId winid); +#endif // wxGTK + + // unlike for the normal windows, dtor will not destroy the native window + // as it normally doesn't belong to us + virtual ~wxNativeContainerWindow(); + + + // provide (trivial) implementation of the base class pure virtuals + virtual void SetTitle(const wxString& WXUNUSED(title)) wxOVERRIDE + { + wxFAIL_MSG( "not implemented for native windows" ); + } + + virtual wxString GetTitle() const wxOVERRIDE + { + wxFAIL_MSG( "not implemented for native windows" ); + + return wxString(); + } + + virtual void Maximize(bool WXUNUSED(maximize) = true) wxOVERRIDE + { + wxFAIL_MSG( "not implemented for native windows" ); + } + + virtual bool IsMaximized() const wxOVERRIDE + { + wxFAIL_MSG( "not implemented for native windows" ); + + return false; + } + + virtual void Iconize(bool WXUNUSED(iconize) = true) wxOVERRIDE + { + wxFAIL_MSG( "not implemented for native windows" ); + } + + virtual bool IsIconized() const wxOVERRIDE + { + // this is called by wxGTK implementation so don't assert + return false; + } + + virtual void Restore() wxOVERRIDE + { + wxFAIL_MSG( "not implemented for native windows" ); + } + + virtual bool ShowFullScreen(bool WXUNUSED(show), + long WXUNUSED(style) = wxFULLSCREEN_ALL) wxOVERRIDE + { + wxFAIL_MSG( "not implemented for native windows" ); + + return false; + } + + virtual bool IsFullScreen() const wxOVERRIDE + { + wxFAIL_MSG( "not implemented for native windows" ); + + return false; + } + +#ifdef __WXMSW__ + virtual bool IsShown() const wxOVERRIDE; +#endif // __WXMSW__ + + // this is an implementation detail: called when the native window is + // destroyed by an outside agency; deletes the C++ object too but can in + // principle be overridden to something else (knowing that the window + // handle of this object and all of its children is invalid any more) + virtual void OnNativeDestroyed(); + +protected: +#ifdef __WXMSW__ + virtual WXLRESULT + MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) wxOVERRIDE; +#endif // __WXMSW__ + +private: + wxDECLARE_NO_COPY_CLASS(wxNativeContainerWindow); +}; + +#endif // wxHAS_NATIVE_CONTAINER_WINDOW + +#endif // _WX_NATIVEWIN_H_ + diff --git a/lib/wxWidgets/include/wx/nonownedwnd.h b/lib/wxWidgets/include/wx/nonownedwnd.h new file mode 100644 index 0000000..0840fce --- /dev/null +++ b/lib/wxWidgets/include/wx/nonownedwnd.h @@ -0,0 +1,115 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/nonownedwnd.h +// Purpose: declares wxNonTopLevelWindow class +// Author: Vaclav Slavik +// Modified by: +// Created: 2006-12-24 +// Copyright: (c) 2006 TT-Solutions +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_NONOWNEDWND_H_ +#define _WX_NONOWNEDWND_H_ + +#include "wx/window.h" + +// Styles that can be used with any wxNonOwnedWindow: +#define wxFRAME_SHAPED 0x0010 // Create a window that is able to be shaped + +class WXDLLIMPEXP_FWD_CORE wxGraphicsPath; + +// ---------------------------------------------------------------------------- +// wxNonOwnedWindow: a window that is not a child window of another one. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxNonOwnedWindowBase : public wxWindow +{ +public: + // Set the shape of the window to the given region. + // Returns true if the platform supports this feature (and the + // operation is successful.) + bool SetShape(const wxRegion& region) + { + // This style is in fact only needed by wxOSX/Carbon so once we don't + // use this port any more, we could get rid of this requirement, but + // for now you must specify wxFRAME_SHAPED for SetShape() to work on + // all platforms. + wxCHECK_MSG + ( + HasFlag(wxFRAME_SHAPED), false, + wxS("Shaped windows must be created with the wxFRAME_SHAPED style.") + ); + + return region.IsEmpty() ? DoClearShape() : DoSetRegionShape(region); + } + +#if wxUSE_GRAPHICS_CONTEXT + // Set the shape using the specified path. + bool SetShape(const wxGraphicsPath& path) + { + wxCHECK_MSG + ( + HasFlag(wxFRAME_SHAPED), false, + wxS("Shaped windows must be created with the wxFRAME_SHAPED style.") + ); + + return DoSetPathShape(path); + } +#endif // wxUSE_GRAPHICS_CONTEXT + + + // Overridden base class methods. + // ------------------------------ + + virtual void AdjustForParentClientOrigin(int& WXUNUSED(x), int& WXUNUSED(y), + int WXUNUSED(sizeFlags) = 0) const wxOVERRIDE + { + // Non owned windows positions don't need to be adjusted for parent + // client area origin so simply do nothing here. + } + + virtual void InheritAttributes() wxOVERRIDE + { + // Non owned windows don't inherit attributes from their parent window + // (if the parent frame is red, it doesn't mean that all dialogs shown + // by it should be red as well), so don't do anything here either. + } + +protected: + virtual bool DoClearShape() + { + return false; + } + + virtual bool DoSetRegionShape(const wxRegion& WXUNUSED(region)) + { + return false; + } + +#if wxUSE_GRAPHICS_CONTEXT + virtual bool DoSetPathShape(const wxGraphicsPath& WXUNUSED(path)) + { + return false; + } +#endif // wxUSE_GRAPHICS_CONTEXT +}; + +#if defined(__WXDFB__) + #include "wx/dfb/nonownedwnd.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/nonownedwnd.h" +#elif defined(__WXMAC__) + #include "wx/osx/nonownedwnd.h" +#elif defined(__WXMSW__) + #include "wx/msw/nonownedwnd.h" +#elif defined(__WXQT__) + #include "wx/qt/nonownedwnd.h" +#else + // No special class needed in other ports, they can derive both wxTLW and + // wxPopupWindow directly from wxWindow and don't implement SetShape(). + class wxNonOwnedWindow : public wxNonOwnedWindowBase + { + }; +#endif + +#endif // _WX_NONOWNEDWND_H_ diff --git a/lib/wxWidgets/include/wx/notebook.h b/lib/wxWidgets/include/wx/notebook.h new file mode 100644 index 0000000..ee89a44 --- /dev/null +++ b/lib/wxWidgets/include/wx/notebook.h @@ -0,0 +1,202 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/notebook.h +// Purpose: wxNotebook interface +// Author: Vadim Zeitlin +// Modified by: +// Created: 01.02.01 +// Copyright: (c) 1996-2000 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_NOTEBOOK_H_BASE_ +#define _WX_NOTEBOOK_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_NOTEBOOK + +#include "wx/bookctrl.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// wxNotebook hit results, use wxBK_HITTEST so other book controls can share them +// if wxUSE_NOTEBOOK is disabled +enum +{ + wxNB_HITTEST_NOWHERE = wxBK_HITTEST_NOWHERE, + wxNB_HITTEST_ONICON = wxBK_HITTEST_ONICON, + wxNB_HITTEST_ONLABEL = wxBK_HITTEST_ONLABEL, + wxNB_HITTEST_ONITEM = wxBK_HITTEST_ONITEM, + wxNB_HITTEST_ONPAGE = wxBK_HITTEST_ONPAGE +}; + +// wxNotebook flags + +// use common book wxBK_* flags for describing alignment +#define wxNB_DEFAULT wxBK_DEFAULT +#define wxNB_TOP wxBK_TOP +#define wxNB_BOTTOM wxBK_BOTTOM +#define wxNB_LEFT wxBK_LEFT +#define wxNB_RIGHT wxBK_RIGHT + +#define wxNB_FIXEDWIDTH 0x0100 +#define wxNB_MULTILINE 0x0200 +#define wxNB_NOPAGETHEME 0x0400 + + +typedef wxWindow wxNotebookPage; // so far, any window can be a page + +extern WXDLLIMPEXP_DATA_CORE(const char) wxNotebookNameStr[]; + +#if wxUSE_EXTENDED_RTTI + +// ---------------------------------------------------------------------------- +// XTI accessor +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxNotebookPageInfo : public wxObject +{ +public: + wxNotebookPageInfo() { m_page = NULL; m_imageId = -1; m_selected = false; } + virtual ~wxNotebookPageInfo() { } + + bool Create(wxNotebookPage *page, + const wxString& text, + bool selected, + int imageId) + { + m_page = page; + m_text = text; + m_selected = selected; + m_imageId = imageId; + return true; + } + + wxNotebookPage* GetPage() const { return m_page; } + wxString GetText() const { return m_text; } + bool GetSelected() const { return m_selected; } + int GetImageId() const { return m_imageId; } + +private: + wxNotebookPage *m_page; + wxString m_text; + bool m_selected; + int m_imageId; + + wxDECLARE_DYNAMIC_CLASS(wxNotebookPageInfo); +}; + +WX_DECLARE_EXPORTED_LIST(wxNotebookPageInfo, wxNotebookPageInfoList ); + +#endif + +// ---------------------------------------------------------------------------- +// wxNotebookBase: define wxNotebook interface +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxNotebookBase : public wxBookCtrlBase +{ +public: + // ctors + // ----- + + wxNotebookBase() { } + + // wxNotebook-specific additions to wxBookCtrlBase interface + // --------------------------------------------------------- + + // get the number of rows for a control with wxNB_MULTILINE style (not all + // versions support it - they will always return 1 then) + virtual int GetRowCount() const { return 1; } + + // set the padding between tabs (in pixels) + virtual void SetPadding(const wxSize& padding) = 0; + + // set the size of the tabs for wxNB_FIXEDWIDTH controls + virtual void SetTabSize(const wxSize& sz) = 0; + + + + // implement some base class functions + virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const wxOVERRIDE; + + // On platforms that support it, get the theme page background colour, else invalid colour + virtual wxColour GetThemeBackgroundColour() const { return wxNullColour; } + + + // send wxEVT_NOTEBOOK_PAGE_CHANGING/ED events + + // returns false if the change to nPage is vetoed by the program + bool SendPageChangingEvent(int nPage); + + // sends the event about page change from old to new (or GetSelection() if + // new is wxNOT_FOUND) + void SendPageChangedEvent(int nPageOld, int nPageNew = wxNOT_FOUND); + +#if wxUSE_EXTENDED_RTTI + // XTI accessors + virtual void AddPageInfo( wxNotebookPageInfo* info ); + virtual const wxNotebookPageInfoList& GetPageInfos() const; +#endif + +protected: +#if wxUSE_EXTENDED_RTTI + wxNotebookPageInfoList m_pageInfos; +#endif + wxDECLARE_NO_COPY_CLASS(wxNotebookBase); +}; + +// ---------------------------------------------------------------------------- +// notebook event class and related stuff +// ---------------------------------------------------------------------------- + +// wxNotebookEvent is obsolete and defined for compatibility only (notice that +// we use #define and not typedef to also keep compatibility with the existing +// code which forward declares it) +#define wxNotebookEvent wxBookCtrlEvent +typedef wxBookCtrlEventFunction wxNotebookEventFunction; +#define wxNotebookEventHandler(func) wxBookCtrlEventHandler(func) + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_NOTEBOOK_PAGE_CHANGED, wxBookCtrlEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_NOTEBOOK_PAGE_CHANGING, wxBookCtrlEvent ); + +#define EVT_NOTEBOOK_PAGE_CHANGED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_NOTEBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn)) + +#define EVT_NOTEBOOK_PAGE_CHANGING(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_NOTEBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn)) + +// ---------------------------------------------------------------------------- +// wxNotebook class itself +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/notebook.h" +#elif defined(__WXMSW__) + #include "wx/msw/notebook.h" +#elif defined(__WXMOTIF__) + #include "wx/generic/notebook.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/notebook.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/notebook.h" +#elif defined(__WXMAC__) + #include "wx/osx/notebook.h" +#elif defined(__WXQT__) + #include "wx/qt/notebook.h" +#endif + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED wxEVT_NOTEBOOK_PAGE_CHANGED +#define wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING wxEVT_NOTEBOOK_PAGE_CHANGING + +#endif // wxUSE_NOTEBOOK + +#endif + // _WX_NOTEBOOK_H_BASE_ diff --git a/lib/wxWidgets/include/wx/notifmsg.h b/lib/wxWidgets/include/wx/notifmsg.h new file mode 100644 index 0000000..523af49 --- /dev/null +++ b/lib/wxWidgets/include/wx/notifmsg.h @@ -0,0 +1,182 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/notifmsg.h +// Purpose: class allowing to show notification messages to the user +// Author: Vadim Zeitlin +// Created: 2007-11-19 +// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_NOTIFMSG_H_ +#define _WX_NOTIFMSG_H_ + +#include "wx/event.h" + +#if wxUSE_NOTIFICATION_MESSAGE + +// ---------------------------------------------------------------------------- +// wxNotificationMessage: allows to show the user a message non intrusively +// ---------------------------------------------------------------------------- + +// notice that this class is not a window and so doesn't derive from wxWindow + +class WXDLLIMPEXP_CORE wxNotificationMessageBase : public wxEvtHandler +{ +public: + // ctors and initializers + // ---------------------- + + // default ctor, use setters below to initialize it later + wxNotificationMessageBase() + { + Init(); + } + + // create a notification object with the given title and message (the + // latter may be empty in which case only the title will be shown) + wxNotificationMessageBase(const wxString& title, + const wxString& message = wxEmptyString, + wxWindow *parent = NULL, + int flags = wxICON_INFORMATION) + { + Init(); + Create(title, message, parent, flags); + } + + virtual ~wxNotificationMessageBase(); + + // note that the setters must be called before Show() + + // set the title: short string, markup not allowed + void SetTitle(const wxString& title); + + // set the text of the message: this is a longer string than the title and + // some platforms allow simple HTML-like markup in it + void SetMessage(const wxString& message); + + // set the parent for this notification: we'll be associated with the top + // level parent of this window or, if this method is not called, with the + // main application window by default + void SetParent(wxWindow *parent); + + // this method can currently be used to choose a standard icon to use: the + // parameter may be one of wxICON_INFORMATION, wxICON_WARNING or + // wxICON_ERROR only (but not wxICON_QUESTION) + void SetFlags(int flags); + + // set a custom icon to use instead of the system provided specified via SetFlags + virtual void SetIcon(const wxIcon& icon); + + // Add a button to the notification, returns false if the platform does not support + // actions in notifications + virtual bool AddAction(wxWindowID actionid, const wxString &label = wxString()); + + // showing and hiding + // ------------------ + + // possible values for Show() timeout + enum + { + Timeout_Auto = -1, // notification will be hidden automatically + Timeout_Never = 0 // notification will never time out + }; + + // show the notification to the user and hides it after timeout seconds + // pass (special values Timeout_Auto and Timeout_Never can be used) + // + // returns false if an error occurred + bool Show(int timeout = Timeout_Auto); + + // hide the notification, returns true if it was hidden or false if it + // couldn't be done (e.g. on some systems automatically hidden + // notifications can't be hidden manually) + bool Close(); + +protected: + // Common part of all ctors. + void Create(const wxString& title = wxEmptyString, + const wxString& message = wxEmptyString, + wxWindow *parent = NULL, + int flags = wxICON_INFORMATION) + { + SetTitle(title); + SetMessage(message); + SetParent(parent); + SetFlags(flags); + } + + class wxNotificationMessageImpl* m_impl; + +private: + + void Init() + { + m_impl = NULL; + } + + wxDECLARE_NO_COPY_CLASS(wxNotificationMessageBase); +}; + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_NOTIFICATION_MESSAGE_CLICK, wxCommandEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_NOTIFICATION_MESSAGE_DISMISSED, wxCommandEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_NOTIFICATION_MESSAGE_ACTION, wxCommandEvent ); + +#if (defined(__WXGTK__) && wxUSE_LIBNOTIFY) || \ + (defined(__WXMSW__) && wxUSE_TASKBARICON && wxUSE_TASKBARICON_BALLOONS) || \ + defined(__WXOSX_COCOA__) + #define wxHAS_NATIVE_NOTIFICATION_MESSAGE +#endif + +// ---------------------------------------------------------------------------- +// wxNotificationMessage +// ---------------------------------------------------------------------------- + +#ifdef wxHAS_NATIVE_NOTIFICATION_MESSAGE + +#if defined(__WXMSW__) +class WXDLLIMPEXP_FWD_CORE wxTaskBarIcon; +#endif // defined(__WXMSW__) + +#else +#include "wx/generic/notifmsg.h" +#endif // wxHAS_NATIVE_NOTIFICATION_MESSAGE + +class WXDLLIMPEXP_CORE wxNotificationMessage : public +#ifdef wxHAS_NATIVE_NOTIFICATION_MESSAGE + wxNotificationMessageBase +#else + wxGenericNotificationMessage +#endif +{ +public: + wxNotificationMessage() { Init(); } + wxNotificationMessage(const wxString& title, + const wxString& message = wxString(), + wxWindow *parent = NULL, + int flags = wxICON_INFORMATION) + { + Init(); + Create(title, message, parent, flags); + } + +#if defined(__WXMSW__) && defined(wxHAS_NATIVE_NOTIFICATION_MESSAGE) + static bool MSWUseToasts( + const wxString& shortcutPath = wxString(), + const wxString& appId = wxString()); + + // returns the task bar icon which was used previously (may be NULL) + static wxTaskBarIcon *UseTaskBarIcon(wxTaskBarIcon *icon); + +#endif // defined(__WXMSW__) && defined(wxHAS_NATIVE_NOTIFICATION_MESSAGE) + +private: + // common part of all ctors + void Init(); + + wxDECLARE_NO_COPY_CLASS(wxNotificationMessage); +}; + +#endif // wxUSE_NOTIFICATION_MESSAGE + +#endif // _WX_NOTIFMSG_H_ + diff --git a/lib/wxWidgets/include/wx/numdlg.h b/lib/wxWidgets/include/wx/numdlg.h new file mode 100644 index 0000000..c1c3974 --- /dev/null +++ b/lib/wxWidgets/include/wx/numdlg.h @@ -0,0 +1,22 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/numdlg.h +// Purpose: wxNumberEntryDialog class +// Author: John Labenski +// Modified by: +// Created: 07.02.04 (extracted from wx/textdlg.h) +// Copyright: (c) John Labenski +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_NUMDLGDLG_H_BASE_ +#define _WX_NUMDLGDLG_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_NUMBERDLG + +#include "wx/generic/numdlgg.h" + +#endif // wxUSE_NUMBERDLG + +#endif // _WX_NUMDLGDLG_H_BASE_ diff --git a/lib/wxWidgets/include/wx/numformatter.h b/lib/wxWidgets/include/wx/numformatter.h new file mode 100644 index 0000000..5e0f795 --- /dev/null +++ b/lib/wxWidgets/include/wx/numformatter.h @@ -0,0 +1,88 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/numformatter.h +// Purpose: wxNumberFormatter class +// Author: Fulvio Senore, Vadim Zeitlin +// Created: 2010-11-06 +// Copyright: (c) 2010 wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_NUMFORMATTER_H_ +#define _WX_NUMFORMATTER_H_ + +#include "wx/string.h" + +// Helper class for formatting numbers with thousands separators which also +// supports parsing the numbers formatted by it. +class WXDLLIMPEXP_BASE wxNumberFormatter +{ +public: + // Bit masks for ToString() + enum Style + { + Style_None = 0x00, + Style_WithThousandsSep = 0x01, + Style_NoTrailingZeroes = 0x02 // Only for floating point numbers + }; + + // Format a number as a string. By default, the thousands separator is + // used, specify Style_None to prevent this. For floating point numbers, + // precision can also be specified. + static wxString ToString(long val, + int style = Style_WithThousandsSep); +#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG + static wxString ToString(wxLongLong_t val, + int style = Style_WithThousandsSep); +#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG + static wxString ToString(wxULongLong_t val, + int style = Style_WithThousandsSep); + static wxString ToString(double val, + int precision, + int style = Style_WithThousandsSep); + + // Format the given number using one of the floating point formats and + // ensure that the result uses the correct decimal separator. + // Prefer using ToString() if possible, i.e. if format is "%g" or "%.Nf" + // which are supported by it directly. + static wxString Format(const wxString& format, double val); + + + // Parse a string representing a number, possibly with thousands separator. + // + // Return true on success and stores the result in the provided location + // which must be a valid non-NULL pointer. + static bool FromString(wxString s, long *val); +#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG + static bool FromString(wxString s, wxLongLong_t *val); +#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG + static bool FromString(wxString s, wxULongLong_t *val); + static bool FromString(wxString s, double *val); + + + // Get the decimal separator for the current locale. It is always defined + // and we fall back to returning '.' in case of an error. + static wxChar GetDecimalSeparator(); + + // Get the thousands separator if grouping of the digits is used by the + // current locale. The value returned in sep should be only used if the + // function returns true. + static bool GetThousandsSeparatorIfUsed(wxChar *sep); + +private: + // Post-process the string representing an integer. + static wxString PostProcessIntString(wxString s, int style); + + // Add the thousands separators to a string representing a number without + // the separators. This is used by ToString(Style_WithThousandsSep). + static void AddThousandsSeparators(wxString& s); + + // Remove trailing zeroes and, if there is nothing left after it, the + // decimal separator itself from a string representing a floating point + // number. Also used by ToString(). + static void RemoveTrailingZeroes(wxString& s); + + // Remove all thousands separators from a string representing a number. + static void RemoveThousandsSeparators(wxString& s); +}; + +#endif // _WX_NUMFORMATTER_H_ diff --git a/lib/wxWidgets/include/wx/object.h b/lib/wxWidgets/include/wx/object.h new file mode 100644 index 0000000..c84d879 --- /dev/null +++ b/lib/wxWidgets/include/wx/object.h @@ -0,0 +1,521 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/object.h +// Purpose: wxObject class, plus run-time type information macros +// Author: Julian Smart +// Modified by: Ron Lee +// Created: 01/02/97 +// Copyright: (c) 1997 Julian Smart +// (c) 2001 Ron Lee <ron@debian.org> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OBJECTH__ +#define _WX_OBJECTH__ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/memory.h" + +#define wxDECLARE_CLASS_INFO_ITERATORS() \ +class WXDLLIMPEXP_BASE const_iterator \ + { \ + typedef wxHashTable_Node Node; \ + public: \ + typedef const wxClassInfo* value_type; \ + typedef const value_type& const_reference; \ + typedef const_iterator itor; \ + typedef value_type* ptr_type; \ + \ + Node* m_node; \ + wxHashTable* m_table; \ + public: \ + typedef const_reference reference_type; \ + typedef ptr_type pointer_type; \ + \ + const_iterator(Node* node, wxHashTable* table) \ + : m_node(node), m_table(table) { } \ + const_iterator() : m_node(NULL), m_table(NULL) { } \ + value_type operator*() const; \ + itor& operator++(); \ + const itor operator++(int); \ + bool operator!=(const itor& it) const \ + { return it.m_node != m_node; } \ + bool operator==(const itor& it) const \ + { return it.m_node == m_node; } \ + }; \ + \ + static const_iterator begin_classinfo(); \ + static const_iterator end_classinfo() + +// based on the value of wxUSE_EXTENDED_RTTI symbol, +// only one of the RTTI system will be compiled: +// - the "old" one (defined by rtti.h) or +// - the "new" one (defined by xti.h) +#include "wx/xti.h" +#include "wx/rtti.h" + +#define wxIMPLEMENT_CLASS(name, basename) \ + wxIMPLEMENT_ABSTRACT_CLASS(name, basename) + +#define wxIMPLEMENT_CLASS2(name, basename1, basename2) \ + wxIMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) + +// ----------------------------------- +// for pluggable classes +// ----------------------------------- + + // NOTE: this should probably be the very first statement + // in the class declaration so wxPluginSentinel is + // the first member initialised and the last destroyed. + +// _DECLARE_DL_SENTINEL(name) wxPluginSentinel m_pluginsentinel; + +#if wxUSE_NESTED_CLASSES + +#define _DECLARE_DL_SENTINEL(name, exportdecl) \ +class exportdecl name##PluginSentinel { \ +private: \ + static const wxString sm_className; \ +public: \ + name##PluginSentinel(); \ + ~name##PluginSentinel(); \ +}; \ +name##PluginSentinel m_pluginsentinel + +#define _IMPLEMENT_DL_SENTINEL(name) \ + const wxString name::name##PluginSentinel::sm_className(#name); \ + name::name##PluginSentinel::name##PluginSentinel() { \ + wxPluginLibrary *e = (wxPluginLibrary*) wxPluginLibrary::ms_classes.Get(#name); \ + if( e != 0 ) { e->RefObj(); } \ + } \ + name::name##PluginSentinel::~name##PluginSentinel() { \ + wxPluginLibrary *e = (wxPluginLibrary*) wxPluginLibrary::ms_classes.Get(#name); \ + if( e != 0 ) { e->UnrefObj(); } \ + } +#else + +#define _DECLARE_DL_SENTINEL(name) +#define _IMPLEMENT_DL_SENTINEL(name) + +#endif // wxUSE_NESTED_CLASSES + +#define wxDECLARE_PLUGGABLE_CLASS(name) \ + wxDECLARE_DYNAMIC_CLASS(name); _DECLARE_DL_SENTINEL(name, WXDLLIMPEXP_CORE) +#define wxDECLARE_ABSTRACT_PLUGGABLE_CLASS(name) \ + wxDECLARE_ABSTRACT_CLASS(name); _DECLARE_DL_SENTINEL(name, WXDLLIMPEXP_CORE) + +#define wxDECLARE_USER_EXPORTED_PLUGGABLE_CLASS(name, usergoo) \ + wxDECLARE_DYNAMIC_CLASS(name); _DECLARE_DL_SENTINEL(name, usergoo) +#define wxDECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(name, usergoo) \ + wxDECLARE_ABSTRACT_CLASS(name); _DECLARE_DL_SENTINEL(name, usergoo) + +#define wxIMPLEMENT_PLUGGABLE_CLASS(name, basename) \ + wxIMPLEMENT_DYNAMIC_CLASS(name, basename) _IMPLEMENT_DL_SENTINEL(name) +#define wxIMPLEMENT_PLUGGABLE_CLASS2(name, basename1, basename2) \ + wxIMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) _IMPLEMENT_DL_SENTINEL(name) +#define wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(name, basename) \ + wxIMPLEMENT_ABSTRACT_CLASS(name, basename) _IMPLEMENT_DL_SENTINEL(name) +#define wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) \ + wxIMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) _IMPLEMENT_DL_SENTINEL(name) + +#define wxIMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS(name, basename) \ + wxIMPLEMENT_PLUGGABLE_CLASS(name, basename) +#define wxIMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS2(name, basename1, basename2) \ + wxIMPLEMENT_PLUGGABLE_CLASS2(name, basename1, basename2) +#define wxIMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(name, basename) \ + wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(name, basename) +#define wxIMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) \ + wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) + +#define wxCLASSINFO(name) (&name::ms_classInfo) + +#define wxIS_KIND_OF(obj, className) obj->IsKindOf(&className::ms_classInfo) + +// Just seems a bit nicer-looking (pretend it's not a macro) +#define wxIsKindOf(obj, className) obj->IsKindOf(&className::ms_classInfo) + +// this cast does some more checks at compile time as it uses static_cast +// internally +// +// note that it still has different semantics from dynamic_cast<> and so can't +// be replaced by it as long as there are any compilers not supporting it +#define wxDynamicCast(obj, className) \ + ((className *) wxCheckDynamicCast( \ + const_cast<wxObject *>(static_cast<const wxObject *>(\ + const_cast<className *>(static_cast<const className *>(obj)))), \ + &className::ms_classInfo)) + +// The 'this' pointer is always true, so use this version +// to cast the this pointer and avoid compiler warnings. +#define wxDynamicCastThis(className) \ + (IsKindOf(&className::ms_classInfo) ? (className*)this : NULL) + +template <class T> +inline T *wxCheckCast(const void *ptr) +{ + wxASSERT_MSG( wxDynamicCast(ptr, T), "wxStaticCast() used incorrectly" ); + return const_cast<T *>(static_cast<const T *>(ptr)); +} + +#define wxStaticCast(obj, className) wxCheckCast<className>(obj) + +// ---------------------------------------------------------------------------- +// set up memory debugging macros +// ---------------------------------------------------------------------------- + +/* + Which new/delete operator variants do we want? + + _WX_WANT_NEW_SIZET_WXCHAR_INT = void *operator new (size_t size, wxChar *fileName = 0, int lineNum = 0) + _WX_WANT_DELETE_VOID = void operator delete (void * buf) + _WX_WANT_DELETE_VOID_WXCHAR_INT = void operator delete(void *buf, wxChar*, int) + _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT = void *operator new[] (size_t size, wxChar *fileName , int lineNum = 0) + _WX_WANT_ARRAY_DELETE_VOID = void operator delete[] (void *buf) + _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT = void operator delete[] (void* buf, wxChar*, int ) +*/ + +#if wxUSE_MEMORY_TRACING + +// All compilers get these ones +#define _WX_WANT_NEW_SIZET_WXCHAR_INT +#define _WX_WANT_DELETE_VOID + +#if defined(__VISUALC__) + #define _WX_WANT_DELETE_VOID_WXCHAR_INT +#endif + +// Now see who (if anyone) gets the array memory operators +#if wxUSE_ARRAY_MEMORY_OPERATORS + + // Everyone except Visual C++ (cause problems for VC++ - crashes) + #if !defined(__VISUALC__) + #define _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT + #endif + + // Everyone except Visual C++ (cause problems for VC++ - crashes) + #if !defined(__VISUALC__) + #define _WX_WANT_ARRAY_DELETE_VOID + #endif +#endif // wxUSE_ARRAY_MEMORY_OPERATORS + +#endif // wxUSE_MEMORY_TRACING + +// ---------------------------------------------------------------------------- +// Compatibility macro aliases DECLARE group +// ---------------------------------------------------------------------------- +// deprecated variants _not_ requiring a semicolon after them and without wx prefix. +// (note that also some wx-prefixed macro do _not_ require a semicolon because +// it's not always possible to force the compiler to require it) + +#define DECLARE_CLASS_INFO_ITERATORS() wxDECLARE_CLASS_INFO_ITERATORS(); +#define DECLARE_ABSTRACT_CLASS(n) wxDECLARE_ABSTRACT_CLASS(n); +#define DECLARE_DYNAMIC_CLASS_NO_ASSIGN(n) wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(n); +#define DECLARE_DYNAMIC_CLASS_NO_COPY(n) wxDECLARE_DYNAMIC_CLASS_NO_COPY(n); +#define DECLARE_DYNAMIC_CLASS(n) wxDECLARE_DYNAMIC_CLASS(n); +#define DECLARE_CLASS(n) wxDECLARE_CLASS(n); + +#define DECLARE_PLUGGABLE_CLASS(n) wxDECLARE_PLUGGABLE_CLASS(n); +#define DECLARE_ABSTRACT_PLUGGABLE_CLASS(n) wxDECLARE_ABSTRACT_PLUGGABLE_CLASS(n); +#define DECLARE_USER_EXPORTED_PLUGGABLE_CLASS(n,u) wxDECLARE_USER_EXPORTED_PLUGGABLE_CLASS(n,u); +#define DECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,u) wxDECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,u); + +// ---------------------------------------------------------------------------- +// wxRefCounter: ref counted data "manager" +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxRefCounter +{ +public: + wxRefCounter() { m_count = 1; } + + int GetRefCount() const { return m_count; } + + void IncRef() { m_count++; } + void DecRef(); + +protected: + // this object should never be destroyed directly but only as a + // result of a DecRef() call: + virtual ~wxRefCounter() { } + +private: + // our refcount: + int m_count; + + // It doesn't make sense to copy the reference counted objects, a new ref + // counter should be created for a new object instead and compilation + // errors in the code using wxRefCounter due to the lack of copy ctor often + // indicate a problem, e.g. a forgotten copy ctor implementation somewhere. + wxDECLARE_NO_COPY_CLASS(wxRefCounter); +}; + +// ---------------------------------------------------------------------------- +// wxObjectRefData: ref counted data meant to be stored in wxObject +// ---------------------------------------------------------------------------- + +typedef wxRefCounter wxObjectRefData; + +// ---------------------------------------------------------------------------- +// wxObjectDataPtr: helper class to avoid memleaks because of missing calls +// to wxObjectRefData::DecRef +// ---------------------------------------------------------------------------- + +template <class T> +class wxObjectDataPtr +{ +public: + typedef T element_type; + + explicit wxObjectDataPtr(T *ptr = NULL) : m_ptr(ptr) {} + + // copy ctor + wxObjectDataPtr(const wxObjectDataPtr<T> &tocopy) + : m_ptr(tocopy.m_ptr) + { + if (m_ptr) + m_ptr->IncRef(); + } + + // generalized copy ctor: U must be convertible to T + template <typename U> + wxObjectDataPtr(const wxObjectDataPtr<U> &tocopy) + : m_ptr(tocopy.get()) + { + if (m_ptr) + m_ptr->IncRef(); + } + + ~wxObjectDataPtr() + { + if (m_ptr) + m_ptr->DecRef(); + } + + T *get() const { return m_ptr; } + + // test for pointer validity: defining conversion to unspecified_bool_type + // and not more obvious bool to avoid implicit conversions to integer types + typedef T *(wxObjectDataPtr<T>::*unspecified_bool_type)() const; + operator unspecified_bool_type() const + { + return m_ptr ? &wxObjectDataPtr<T>::get : NULL; + } + + T& operator*() const + { + wxASSERT(m_ptr != NULL); + return *(m_ptr); + } + + T *operator->() const + { + wxASSERT(m_ptr != NULL); + return get(); + } + + void reset(T *ptr) + { + if (m_ptr) + m_ptr->DecRef(); + m_ptr = ptr; + } + + T* release() + { + T* const ptr = m_ptr; + m_ptr = NULL; + return ptr; + } + + wxObjectDataPtr& operator=(const wxObjectDataPtr &tocopy) + { + // Take care to increment the reference first to ensure correct + // behaviour in case of self-assignment. + T* const ptr = tocopy.m_ptr; + if (ptr) + ptr->IncRef(); + if (m_ptr) + m_ptr->DecRef(); + m_ptr = ptr; + return *this; + } + + template <typename U> + wxObjectDataPtr& operator=(const wxObjectDataPtr<U> &tocopy) + { + T* const ptr = tocopy.get(); + if (ptr) + ptr->IncRef(); + if (m_ptr) + m_ptr->DecRef(); + m_ptr = ptr; + return *this; + } + + wxObjectDataPtr& operator=(T *ptr) + { + if (m_ptr) + m_ptr->DecRef(); + m_ptr = ptr; + return *this; + } + +private: + T *m_ptr; +}; + +// ---------------------------------------------------------------------------- +// wxObject: the root class of wxWidgets object hierarchy +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxObject +{ +#if wxUSE_EXTENDED_RTTI + wxDECLARE_DYNAMIC_CLASS(wxObject); +#endif + +public: + wxObject() { m_refData = NULL; } + virtual ~wxObject() { UnRef(); } + + wxObject(const wxObject& other) + { + m_refData = other.m_refData; + if (m_refData) + m_refData->IncRef(); + } + + wxObject& operator=(const wxObject& other) + { + if ( this != &other ) + { + Ref(other); + } + return *this; + } + + bool IsKindOf(const wxClassInfo *info) const; + + // Turn on the correct set of new and delete operators + +#ifdef _WX_WANT_NEW_SIZET_WXCHAR_INT + void *operator new ( size_t size, const wxChar *fileName = NULL, int lineNum = 0 ); +#endif + +#ifdef _WX_WANT_DELETE_VOID + void operator delete ( void * buf ); +#endif + +#ifdef _WX_WANT_DELETE_VOID_WXCHAR_INT + void operator delete ( void *buf, const wxChar*, int ); +#endif + +#ifdef _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT + void *operator new[] ( size_t size, const wxChar *fileName = NULL, int lineNum = 0 ); +#endif + +#ifdef _WX_WANT_ARRAY_DELETE_VOID + void operator delete[] ( void *buf ); +#endif + +#ifdef _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT + void operator delete[] (void* buf, const wxChar*, int ); +#endif + + // ref counted data handling methods + + // get/set + wxObjectRefData *GetRefData() const { return m_refData; } + void SetRefData(wxObjectRefData *data) { m_refData = data; } + + // make a 'clone' of the object + void Ref(const wxObject& clone); + + // destroy a reference + void UnRef(); + + // Make sure this object has only one reference + void UnShare() { AllocExclusive(); } + + // check if this object references the same data as the other one + bool IsSameAs(const wxObject& o) const { return m_refData == o.m_refData; } + +#if !wxUSE_EXTENDED_RTTI + virtual wxClassInfo* GetClassInfo() const; + + // RTTI information, usually declared by wxDECLARE_DYNAMIC_CLASS() or + // similar, but done manually for the hierarchy root. Note that it's public + // for compatibility reasons, but shouldn't be accessed directly. + static wxClassInfo ms_classInfo; +#endif + +protected: + // ensure that our data is not shared with anybody else: if we have no + // data, it is created using CreateRefData() below, if we have shared data + // it is copied using CloneRefData(), otherwise nothing is done + void AllocExclusive(); + + // both methods must be implemented if AllocExclusive() is used, not pure + // virtual only because of the backwards compatibility reasons + + // create a new m_refData + virtual wxObjectRefData *CreateRefData() const; + + // create a new m_refData initialized with the given one + virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; + + wxObjectRefData *m_refData; +}; + +inline wxObject *wxCheckDynamicCast(wxObject *obj, wxClassInfo *classInfo) +{ + return obj && obj->GetClassInfo()->IsKindOf(classInfo) ? obj : NULL; +} + +#include "wx/xti2.h" + +// ---------------------------------------------------------------------------- +// more debugging macros +// ---------------------------------------------------------------------------- + +#if wxUSE_DEBUG_NEW_ALWAYS + #define WXDEBUG_NEW new(__TFILE__,__LINE__) + + #if wxUSE_GLOBAL_MEMORY_OPERATORS + #define new WXDEBUG_NEW + #elif defined(__VISUALC__) + // Including this file redefines new and allows leak reports to + // contain line numbers + #include "wx/msw/msvcrt.h" + #endif +#endif // wxUSE_DEBUG_NEW_ALWAYS + +// ---------------------------------------------------------------------------- +// Compatibility macro aliases IMPLEMENT group +// ---------------------------------------------------------------------------- + +// deprecated variants _not_ requiring a semicolon after them and without wx prefix. +// (note that also some wx-prefixed macro do _not_ require a semicolon because +// it's not always possible to force the compiler to require it) + +#define IMPLEMENT_DYNAMIC_CLASS(n,b) wxIMPLEMENT_DYNAMIC_CLASS(n,b) +#define IMPLEMENT_DYNAMIC_CLASS2(n,b1,b2) wxIMPLEMENT_DYNAMIC_CLASS2(n,b1,b2) +#define IMPLEMENT_ABSTRACT_CLASS(n,b) wxIMPLEMENT_ABSTRACT_CLASS(n,b) +#define IMPLEMENT_ABSTRACT_CLASS2(n,b1,b2) wxIMPLEMENT_ABSTRACT_CLASS2(n,b1,b2) +#define IMPLEMENT_CLASS(n,b) wxIMPLEMENT_CLASS(n,b) +#define IMPLEMENT_CLASS2(n,b1,b2) wxIMPLEMENT_CLASS2(n,b1,b2) + +#define IMPLEMENT_PLUGGABLE_CLASS(n,b) wxIMPLEMENT_PLUGGABLE_CLASS(n,b) +#define IMPLEMENT_PLUGGABLE_CLASS2(n,b,b2) wxIMPLEMENT_PLUGGABLE_CLASS2(n,b,b2) +#define IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(n,b) wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(n,b) +#define IMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(n,b,b2) wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(n,b,b2) +#define IMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS(n,b) wxIMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS(n,b) +#define IMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS2(n,b,b2) wxIMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS2(n,b,b2) +#define IMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,b) wxIMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(n,b) +#define IMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS2(n,b,b2) wxIMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS2(n,b,b2) + +#define CLASSINFO(n) wxCLASSINFO(n) + +#endif // _WX_OBJECTH__ diff --git a/lib/wxWidgets/include/wx/odcombo.h b/lib/wxWidgets/include/wx/odcombo.h new file mode 100644 index 0000000..a8ffa95 --- /dev/null +++ b/lib/wxWidgets/include/wx/odcombo.h @@ -0,0 +1,404 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/odcombo.h +// Purpose: wxOwnerDrawnComboBox and wxVListBoxPopup +// Author: Jaakko Salli +// Modified by: +// Created: Apr-30-2006 +// Copyright: (c) Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ODCOMBO_H_ +#define _WX_ODCOMBO_H_ + +#include "wx/defs.h" + +#if wxUSE_ODCOMBOBOX + +#include "wx/combo.h" +#include "wx/ctrlsub.h" +#include "wx/vlbox.h" +#include "wx/timer.h" + + +// +// New window styles for wxOwnerDrawnComboBox +// +enum +{ + // Double-clicking cycles item if wxCB_READONLY is also used. + wxODCB_DCLICK_CYCLES = wxCC_SPECIAL_DCLICK, + + // If used, control itself is not custom paint using callback. + // Even if this is not used, writable combo is never custom paint + // until SetCustomPaintWidth is called + wxODCB_STD_CONTROL_PAINT = 0x1000 +}; + + +// +// Callback flags (see wxOwnerDrawnComboBox::OnDrawItem) +// +enum wxOwnerDrawnComboBoxPaintingFlags +{ + // when set, we are painting the selected item in control, + // not in the popup + wxODCB_PAINTING_CONTROL = 0x0001, + + + // when set, we are painting an item which should have + // focus rectangle painted in the background. Text colour + // and clipping region are then appropriately set in + // the default OnDrawBackground implementation. + wxODCB_PAINTING_SELECTED = 0x0002 +}; + + +// ---------------------------------------------------------------------------- +// wxVListBoxComboPopup is a wxVListBox customized to act as a popup control. +// +// Notes: +// wxOwnerDrawnComboBox uses this as its popup. However, it always derives +// from native wxComboCtrl. If you need to use this popup with +// wxGenericComboControl, then remember that vast majority of item manipulation +// functionality is implemented in the wxVListBoxComboPopup class itself. +// +// ---------------------------------------------------------------------------- + + +class WXDLLIMPEXP_ADV wxVListBoxComboPopup : public wxVListBox, + public wxComboPopup +{ + friend class wxOwnerDrawnComboBox; +public: + + // init and dtor + wxVListBoxComboPopup() : wxVListBox(), wxComboPopup() { } + virtual ~wxVListBoxComboPopup(); + + // required virtuals + virtual void Init() wxOVERRIDE; + virtual bool Create(wxWindow* parent) wxOVERRIDE; + virtual void SetFocus() wxOVERRIDE; + virtual wxWindow *GetControl() wxOVERRIDE { return this; } + virtual void SetStringValue( const wxString& value ) wxOVERRIDE; + virtual wxString GetStringValue() const wxOVERRIDE; + + // more customization + virtual void OnPopup() wxOVERRIDE; + virtual wxSize GetAdjustedSize( int minWidth, int prefHeight, int maxHeight ) wxOVERRIDE; + virtual void PaintComboControl( wxDC& dc, const wxRect& rect ) wxOVERRIDE; + virtual void OnComboKeyEvent( wxKeyEvent& event ) wxOVERRIDE; + virtual void OnComboCharEvent( wxKeyEvent& event ) wxOVERRIDE; + virtual void OnComboDoubleClick() wxOVERRIDE; + virtual bool LazyCreate() wxOVERRIDE; + virtual bool FindItem(const wxString& item, wxString* trueItem) wxOVERRIDE; + virtual void OnDPIChanged(wxDPIChangedEvent& event); + + // Item management + void SetSelection( int item ); + void Insert( const wxString& item, int pos ); + int Append(const wxString& item); + void Clear(); + void Delete( unsigned int item ); + void SetItemClientData(unsigned int n, void* clientData, wxClientDataType clientDataItemsType); + void *GetItemClientData(unsigned int n) const; + void SetString( int item, const wxString& str ); + wxString GetString( int item ) const; + unsigned int GetCount() const; + int FindString(const wxString& s, bool bCase = false) const; + int GetSelection() const; + + //void Populate( int n, const wxString choices[] ); + void Populate( const wxArrayString& choices ); + void ClearClientDatas(); + + // helpers + int GetItemAtPosition( const wxPoint& pos ) { return HitTest(pos); } + wxCoord GetTotalHeight() const { return EstimateTotalHeight(); } + wxCoord GetLineHeight(int line) const { return OnGetRowHeight(line); } + +protected: + + // Called by OnComboDoubleClick and OnCombo{Key,Char}Event + bool HandleKey( int keycode, bool saturate, wxChar keychar = 0 ); + + // sends combobox select event from the parent combo control + void SendComboBoxEvent( int selection ); + + // gets value, sends event and dismisses + void DismissWithEvent(); + + // OnMeasureItemWidth will be called on next GetAdjustedSize. + void ItemWidthChanged(unsigned int item) + { + m_widths[item] = -1; + m_widthsDirty = true; + } + + // Callbacks for drawing and measuring items. Override in a derived class for + // owner-drawnness. Font, background and text colour have been prepared according + // to selection, focus and such. + // + // item: item index to be drawn, may be wxNOT_FOUND when painting combo control itself + // and there is no valid selection + // flags: wxODCB_PAINTING_CONTROL is set if painting to combo control instead of list + // + // NOTE: If wxVListBoxComboPopup is used with a wxComboCtrl class not derived from + // wxOwnerDrawnComboBox, this method must be overridden. + virtual void OnDrawItem( wxDC& dc, const wxRect& rect, int item, int flags) const; + + // This is same as in wxVListBox + virtual wxCoord OnMeasureItem( size_t item ) const wxOVERRIDE; + + // Return item width, or -1 for calculating from text extent (default) + virtual wxCoord OnMeasureItemWidth( size_t item ) const; + + // Draw item and combo control background. Flags are same as with OnDrawItem. + // NB: Can't use name OnDrawBackground because of virtual function hiding warnings. + virtual void OnDrawBg(wxDC& dc, const wxRect& rect, int item, int flags) const; + + // Additional wxVListBox implementation (no need to override in derived classes) + virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const wxOVERRIDE; + void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const wxOVERRIDE; + + // filter mouse move events happening outside the list box + // move selection with cursor + void OnMouseMove(wxMouseEvent& event); + void OnKey(wxKeyEvent& event); + void OnChar(wxKeyEvent& event); + void OnLeftClick(wxMouseEvent& event); + + // Return the widest item width (recalculating it if necessary) + int GetWidestItemWidth() { CalcWidths(); return m_widestWidth; } + + // Return the index of the widest item (recalculating it if necessary) + int GetWidestItem() { CalcWidths(); return m_widestItem; } + + // Stop partial completion (when some other event occurs) + void StopPartialCompletion(); + + wxArrayString m_strings; + wxVector<void*> m_clientDatas; + + wxFont m_useFont; + + //wxString m_stringValue; // displayed text (may be different from m_strings[m_value]) + int m_value; // selection + int m_itemHover; // on which item the cursor is + int m_itemHeight; // default item height (calculate from font size + // and used in the absence of callback) + wxClientDataType m_clientDataItemsType; + +private: + + // Cached item widths (in pixels). + wxVector<int> m_widths; + + // Width of currently widest item. + int m_widestWidth; + + // Index of currently widest item. + int m_widestItem; + + // Measure some items in next GetAdjustedSize? + bool m_widthsDirty; + + // Find widest item in next GetAdjustedSize? + bool m_findWidest; + + // has the mouse been released on this control? + bool m_clicked; + + // Recalculate widths if they are dirty + void CalcWidths(); + + // Partial completion string + wxString m_partialCompletionString; + + wxString m_stringValue; + +#if wxUSE_TIMER + // Partial completion timer + wxTimer m_partialCompletionTimer; +#endif // wxUSE_TIMER + + wxDECLARE_EVENT_TABLE(); +}; + + +// ---------------------------------------------------------------------------- +// wxOwnerDrawnComboBox: a generic wxComboBox that allows custom paint items +// in addition to many other types of customization already allowed by +// the wxComboCtrl. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxOwnerDrawnComboBox : + public wxWindowWithItems<wxComboCtrl, wxItemContainer> +{ + //friend class wxComboPopupWindow; + friend class wxVListBoxComboPopup; +public: + + // ctors and such + wxOwnerDrawnComboBox() { Init(); } + + wxOwnerDrawnComboBox(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + int n, + const wxString choices[], + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)) + { + Init(); + + (void)Create(parent, id, value, pos, size, n, + choices, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)); + + wxOwnerDrawnComboBox(wxWindow *parent, + wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxArrayString& choices = wxArrayString(), + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + int n, + const wxString choices[], + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)); + + virtual ~wxOwnerDrawnComboBox(); + + // Prevent app from using wxComboPopup + void SetPopupControl(wxVListBoxComboPopup* popup) + { + DoSetPopupControl(popup); + } + + // wxControlWithItems methods + virtual unsigned int GetCount() const wxOVERRIDE; + virtual wxString GetString(unsigned int n) const wxOVERRIDE; + virtual void SetString(unsigned int n, const wxString& s) wxOVERRIDE; + virtual int FindString(const wxString& s, bool bCase = false) const wxOVERRIDE; + virtual void Select(int n); + virtual int GetSelection() const wxOVERRIDE; + + // See wxComboBoxBase discussion of IsEmpty(). + bool IsListEmpty() const { return wxItemContainer::IsEmpty(); } + bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); } + + // Override these just to maintain consistency with virtual methods + // between classes. + virtual void Clear() wxOVERRIDE; + virtual void GetSelection(long *from, long *to) const wxOVERRIDE; + + virtual void SetSelection(int n) wxOVERRIDE { Select(n); } + + + // Prevent a method from being hidden + virtual void SetSelection(long from, long to) wxOVERRIDE + { + wxComboCtrl::SetSelection(from,to); + } + + // Return the widest item width (recalculating it if necessary) + virtual int GetWidestItemWidth() { EnsurePopupControl(); return GetVListBoxComboPopup()->GetWidestItemWidth(); } + + // Return the index of the widest item (recalculating it if necessary) + virtual int GetWidestItem() { EnsurePopupControl(); return GetVListBoxComboPopup()->GetWidestItem(); } + + virtual bool IsSorted() const wxOVERRIDE { return HasFlag(wxCB_SORT); } + +protected: + virtual void DoClear() wxOVERRIDE; + virtual void DoDeleteOneItem(unsigned int n) wxOVERRIDE; + + // Callback for drawing. Font, background and text colour have been + // prepared according to selection, focus and such. + // item: item index to be drawn, may be wxNOT_FOUND when painting combo control itself + // and there is no valid selection + // flags: wxODCB_PAINTING_CONTROL is set if painting to combo control instead of list + virtual void OnDrawItem( wxDC& dc, const wxRect& rect, int item, int flags ) const; + + // Callback for item height, or -1 for default + virtual wxCoord OnMeasureItem( size_t item ) const; + + // Callback for item width, or -1 for default/undetermined + virtual wxCoord OnMeasureItemWidth( size_t item ) const; + + // override base implementation so we can return the size for the + // largest item + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + // Callback for background drawing. Flags are same as with + // OnDrawItem. + virtual void OnDrawBackground( wxDC& dc, const wxRect& rect, int item, int flags ) const; + + // NULL popup can be used to indicate default interface + virtual void DoSetPopupControl(wxComboPopup* popup) wxOVERRIDE; + + // clears all allocated client data + void ClearClientDatas(); + + wxVListBoxComboPopup* GetVListBoxComboPopup() const + { + return (wxVListBoxComboPopup*) m_popupInterface; + } + + virtual int DoInsertItems(const wxArrayStringsAdapter& items, + unsigned int pos, + void **clientData, wxClientDataType type) wxOVERRIDE; + virtual void DoSetItemClientData(unsigned int n, void* clientData) wxOVERRIDE; + virtual void* DoGetItemClientData(unsigned int n) const wxOVERRIDE; + + // temporary storage for the initial choices + //const wxString* m_baseChoices; + //int m_baseChoicesCount; + wxArrayString m_initChs; + +private: + void Init(); + + wxDECLARE_EVENT_TABLE(); + + wxDECLARE_DYNAMIC_CLASS(wxOwnerDrawnComboBox); +}; + + +#endif // wxUSE_ODCOMBOBOX + +#endif + // _WX_ODCOMBO_H_ diff --git a/lib/wxWidgets/include/wx/osx/accel.h b/lib/wxWidgets/include/wx/osx/accel.h new file mode 100644 index 0000000..70ba837 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/accel.h @@ -0,0 +1,33 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/accel.h +// Purpose: wxAcceleratorTable class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ACCEL_H_ +#define _WX_ACCEL_H_ + +#include "wx/string.h" +#include "wx/event.h" + +class WXDLLIMPEXP_CORE wxAcceleratorTable: public wxObject +{ + wxDECLARE_DYNAMIC_CLASS(wxAcceleratorTable); +public: + wxAcceleratorTable(); + wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]); // Load from array + + virtual ~wxAcceleratorTable(); + + bool Ok() const { return IsOk(); } + bool IsOk() const; + + int GetCommand( wxKeyEvent &event ); +}; + +#endif + // _WX_ACCEL_H_ diff --git a/lib/wxWidgets/include/wx/osx/activityindicator.h b/lib/wxWidgets/include/wx/osx/activityindicator.h new file mode 100644 index 0000000..a6f7823 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/activityindicator.h @@ -0,0 +1,59 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/activityindicator.h +// Purpose: Declaration of wxActivityIndicator for wxOSX (Cocoa only). +// Author: Vadim Zeitlin +// Created: 2015-03-08 +// Copyright: (c) 2015 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_ACTIVITYINDICATOR_H_ +#define _WX_OSX_ACTIVITYINDICATOR_H_ + +// ---------------------------------------------------------------------------- +// wxActivityIndicator: implementation using GtkSpinner. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxActivityIndicator : public wxActivityIndicatorBase +{ +public: + wxActivityIndicator() + { + Init(); + } + + explicit + wxActivityIndicator(wxWindow* parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxActivityIndicatorNameStr) + { + Init(); + + Create(parent, winid, pos, size, style, name); + } + + bool Create(wxWindow* parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxActivityIndicatorNameStr); + + virtual void Start() wxOVERRIDE; + virtual void Stop() wxOVERRIDE; + virtual bool IsRunning() const wxOVERRIDE; + +private: + // Common part of all ctors. + void Init() { m_isRunning = false; } + + bool m_isRunning; + + wxDECLARE_DYNAMIC_CLASS(wxActivityIndicator); + wxDECLARE_NO_COPY_CLASS(wxActivityIndicator); +}; + +#endif // _WX_OSX_ACTIVITYINDICATOR_H_ diff --git a/lib/wxWidgets/include/wx/osx/anybutton.h b/lib/wxWidgets/include/wx/osx/anybutton.h new file mode 100644 index 0000000..e8d1ef0 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/anybutton.h @@ -0,0 +1,58 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: anybutton.h +// Purpose: wxAnyButton class +// Author: Stefan Csomor +// Created: 1998-01-01 (extracted from button.h) +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_ANYBUTTON_H_ +#define _WX_OSX_ANYBUTTON_H_ + +// Any button +class WXDLLIMPEXP_CORE wxAnyButton : public wxAnyButtonBase +{ +public: + wxAnyButton() {} + + static wxSize GetDefaultSize(); + + virtual void SetLabel(const wxString& label) wxOVERRIDE; + +protected: + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + void OnEnterWindow( wxMouseEvent& event); + void OnLeaveWindow( wxMouseEvent& event); + + virtual wxBitmap DoGetBitmap(State which) const wxOVERRIDE; + virtual void DoSetBitmap(const wxBitmapBundle& bitmapBundle, State which) wxOVERRIDE; + virtual void DoSetBitmapPosition(wxDirection dir) wxOVERRIDE; + + virtual void DoSetBitmapMargins(int x, int y) wxOVERRIDE + { + m_marginX = x; + m_marginY = y; + InvalidateBestSize(); + } + +#if wxUSE_MARKUP && wxOSX_USE_COCOA + virtual bool DoSetLabelMarkup(const wxString& markup) wxOVERRIDE; +#endif // wxUSE_MARKUP && wxOSX_USE_COCOA + + + // the margins around the bitmap + int m_marginX; + int m_marginY; + + // the bitmaps for the different state of the buttons, all of them may be + // invalid and the button only shows a bitmap at all if State_Normal bitmap + // is valid + wxBitmapBundle m_bitmaps[State_Max]; + + wxDECLARE_NO_COPY_CLASS(wxAnyButton); + wxDECLARE_EVENT_TABLE(); +}; + +#endif // _WX_OSX_ANYBUTTON_H_ diff --git a/lib/wxWidgets/include/wx/osx/app.h b/lib/wxWidgets/include/wx/osx/app.h new file mode 100644 index 0000000..317a0ca --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/app.h @@ -0,0 +1,177 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/app.h +// Purpose: wxApp class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_APP_H_ +#define _WX_APP_H_ + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/gdicmn.h" +#include "wx/event.h" + +class WXDLLIMPEXP_FWD_CORE wxFrame; +class WXDLLIMPEXP_FWD_CORE wxWindowMac; +class WXDLLIMPEXP_FWD_CORE wxApp ; +class WXDLLIMPEXP_FWD_CORE wxKeyEvent; +class WXDLLIMPEXP_FWD_BASE wxLog; +class WXDLLIMPEXP_FWD_CORE wxMacAutoreleasePool; + +// Force an exit from main loop +void WXDLLIMPEXP_CORE wxExit(); + +// Yield to other apps/messages +bool WXDLLIMPEXP_CORE wxYield(); + +// Represents the application. Derive OnInit and declare +// a new App object to start application +class WXDLLIMPEXP_CORE wxApp: public wxAppBase +{ + wxDECLARE_DYNAMIC_CLASS(wxApp); + + wxApp(); + virtual ~wxApp(); + + virtual void WakeUpIdle() wxOVERRIDE; + + virtual void SetPrintMode(int mode) wxOVERRIDE { m_printMode = mode; } + virtual int GetPrintMode() const { return m_printMode; } + + // calling OnInit with an auto-release pool ready ... + virtual bool CallOnInit() wxOVERRIDE; +#if wxUSE_GUI + // setting up all MacOS Specific Event-Handlers etc + virtual bool OnInitGui() wxOVERRIDE; +#endif // wxUSE_GUI + + virtual int OnRun() wxOVERRIDE; + + virtual bool ProcessIdle() wxOVERRIDE; + + // implementation only + void OnIdle(wxIdleEvent& event); + void OnEndSession(wxCloseEvent& event); + void OnQueryEndSession(wxCloseEvent& event); + +protected: + int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT + wxMacAutoreleasePool* m_macPool; + +public: + + static bool sm_isEmbedded; + // Implementation + virtual bool Initialize(int& argc, wxChar **argv) wxOVERRIDE; + virtual void CleanUp() wxOVERRIDE; + + // the installed application event handler + WXEVENTHANDLERREF MacGetEventHandler() { return m_macEventHandler ; } + WXEVENTHANDLERREF MacGetCurrentEventHandlerCallRef() { return m_macCurrentEventHandlerCallRef ; } + void MacSetCurrentEvent( WXEVENTREF event , WXEVENTHANDLERCALLREF handler ) + { m_macCurrentEvent = event ; m_macCurrentEventHandlerCallRef = handler ; } + + // adding a CFType object to be released only at the end of the current event cycle (increases the + // refcount of the object passed), needed in case we are in the middle of an event concerning an object + // we want to delete and cannot do it immediately + // TODO change semantics to be in line with cocoa (make autrelease NOT increase the count) + void MacAddToAutorelease( void* cfrefobj ); + void MacReleaseAutoreleasePool(); + +public: + static wxWindow* s_captureWindow ; + static long s_lastModifiers ; + + int m_nCmdShow; + + // mac specifics +protected: +#if wxOSX_USE_COCOA + // override for support of custom app controllers + virtual WX_NSObject OSXCreateAppController(); +#endif + +private: + virtual bool DoInitGui(); + virtual void DoCleanUp(); + + WXEVENTHANDLERREF m_macEventHandler ; + WXEVENTHANDLERCALLREF m_macCurrentEventHandlerCallRef ; + WXEVENTREF m_macCurrentEvent ; + +public: + static long s_macAboutMenuItemId ; + static long s_macPreferencesMenuItemId ; + static long s_macExitMenuItemId ; + static wxString s_macHelpMenuTitleName ; + static wxString s_macWindowMenuTitleName ; + + WXEVENTREF MacGetCurrentEvent() { return m_macCurrentEvent ; } + + // For embedded use. By default does nothing. + virtual void MacHandleUnhandledEvent( WXEVENTREF ev ); + + bool MacSendKeyDownEvent( wxWindow* focus , long keyval , long modifiers , long when , wxChar uniChar ) ; + bool MacSendKeyUpEvent( wxWindow* focus , long keyval , long modifiers , long when , wxChar uniChar ) ; + bool MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers , long when , wxChar uniChar ) ; + void MacCreateKeyEvent( wxKeyEvent& event, wxWindow* focus , long keymessage , long modifiers , long when , wxChar uniChar ) ; + // in response of an openFiles message with Cocoa and an + // open-document apple event + virtual void MacOpenFiles(const wxArrayString &fileNames) ; + // called by MacOpenFiles for each file. + virtual void MacOpenFile(const wxString &fileName) ; + // in response of a get-url apple event + virtual void MacOpenURL(const wxString &url) ; + // in response of a print-document apple event + virtual void MacPrintFiles(const wxArrayString &fileNames) ; + // called by MacPrintFiles for each file + virtual void MacPrintFile(const wxString &fileName) ; + // in response of a open-application apple event + virtual void MacNewFile() ; + // in response of a reopen-application apple event + virtual void MacReopenApp() ; + + // override this to return false from a non-bundled console app in order to stay in background ... + virtual bool OSXIsGUIApplication() { return true; } + + // Allow the user to disable the tab bar support in the application + void OSXEnableAutomaticTabbing(bool enable); + +#if wxOSX_USE_COCOA_OR_IPHONE + // immediately before the native event loop launches + virtual void OSXOnWillFinishLaunching(); + // immediately when the native event loop starts, no events have been served yet + virtual void OSXOnDidFinishLaunching(); + // OS asks to terminate app, return no to stay running + virtual bool OSXOnShouldTerminate(); + // before application terminates + virtual void OSXOnWillTerminate(); + +private: + bool m_onInitResult; + bool m_inited; + wxArrayString m_openFiles; + wxArrayString m_printFiles; + wxString m_getURL; + +public: + bool OSXInitWasCalled() { return m_inited; } + void OSXStoreOpenFiles(const wxArrayString &files ) { m_openFiles = files ; } + void OSXStorePrintFiles(const wxArrayString &files ) { m_printFiles = files ; } + void OSXStoreOpenURL(const wxString &url ) { m_getURL = url ; } +#endif + + // Hide the application windows the same as the system hide command would do it. + void MacHideApp(); + + wxDECLARE_EVENT_TABLE(); +}; + +#endif + // _WX_APP_H_ + diff --git a/lib/wxWidgets/include/wx/osx/appprogress.h b/lib/wxWidgets/include/wx/osx/appprogress.h new file mode 100644 index 0000000..a64b2cc --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/appprogress.h @@ -0,0 +1,36 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/appprogress.h +// Purpose: wxAppProgressIndicator OS X implementation +// Author: Tobias Taschner +// Created: 2014-10-22 +// Copyright: (c) 2014 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_APPPROG_H_ +#define _WX_OSX_APPPROG_H_ + +#include "wx/window.h" + +class WXDLLIMPEXP_CORE wxAppProgressIndicator + : public wxAppProgressIndicatorBase +{ +public: + wxAppProgressIndicator(wxWindow* parent = NULL, int maxValue = 100); + virtual ~wxAppProgressIndicator(); + + virtual bool IsAvailable() const wxOVERRIDE; + + virtual void SetValue(int value) wxOVERRIDE; + virtual void SetRange(int range) wxOVERRIDE; + virtual void Pulse() wxOVERRIDE; + virtual void Reset() wxOVERRIDE; + +private: + int m_maxValue; + void *m_dockIcon; + + wxDECLARE_NO_COPY_CLASS(wxAppProgressIndicator); +}; + +#endif // _WX_OSX_APPPROG_H_ diff --git a/lib/wxWidgets/include/wx/osx/bitmap.h b/lib/wxWidgets/include/wx/osx/bitmap.h new file mode 100644 index 0000000..ff5fcef --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/bitmap.h @@ -0,0 +1,243 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/bitmap.h +// Purpose: wxBitmap class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BITMAP_H_ +#define _WX_BITMAP_H_ + +#include "wx/palette.h" + +// Bitmap +class wxBitmapRefData ; + +// A mask is a bitmap used for drawing bitmaps +// Internally it is stored as a 8 bit deep memory chunk, 0 = black means the source will be drawn +// 255 = white means the source will not be drawn, no other values will be present +// 8 bit is chosen only for performance reasons, note also that this is the inverse value range +// from alpha, where 0 = invisible , 255 = fully drawn + +class WXDLLIMPEXP_CORE wxMask: public wxMaskBase +{ + wxDECLARE_DYNAMIC_CLASS(wxMask); + +public: + wxMask(); + + // Copy constructor + wxMask(const wxMask& mask); + + // Construct a mask from a bitmap and a colour indicating + // the transparent area + wxMask(const wxBitmap& bitmap, const wxColour& colour); + + // Construct a mask from a mono bitmap (black meaning show pixels, white meaning transparent) + wxMask(const wxBitmap& bitmap); + + virtual ~wxMask(); + + wxBitmap GetBitmap() const; + + // Implementation below + + void Init() ; + + // a 8 bit depth mask + void* GetRawAccess() const; + int GetBytesPerRow() const; + int GetWidth() const; + int GetHeight() const; + + // renders/updates native representation when necessary + void RealizeNative() ; + + WXHBITMAP GetHBITMAP() const ; + + // implementation helper only : construct a mask from a 8 bpp memory buffer + bool OSXCreate(const wxMemoryBuffer& buf, int width , int height , int bytesPerRow ) ; + +protected: + // this function is called from Create() to free the existing mask data + virtual void FreeData() wxOVERRIDE; + + // these functions must be overridden to implement the corresponding public + // Create() methods, they shouldn't call FreeData() as it's already called + // by the public wrappers + virtual bool InitFromColour(const wxBitmap& bitmap, + const wxColour& colour) wxOVERRIDE; + virtual bool InitFromMonoBitmap(const wxBitmap& bitmap) wxOVERRIDE; + +private: + void DoCreateMaskBitmap(int width, int height, int bytesPerRow = -1); + + wxCFRef<CGContextRef> m_maskBitmap ; + +}; + +class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase +{ + wxDECLARE_DYNAMIC_CLASS(wxBitmap); + + friend class WXDLLIMPEXP_FWD_CORE wxBitmapHandler; + +public: + wxBitmap() {} // Platform-specific + + // Initialize with raw data. + wxBitmap(const char bits[], int width, int height, int depth = 1); + + // Initialize with XPM data + wxBitmap(const char* const* bits); + + // Load a file or resource + wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); + + // Constructor for generalised creation from data + wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth = 1); + + // creates an bitmap from the native image format + wxBitmap(CGImageRef image, double scale = 1.0); + wxBitmap(WXImage image); + wxBitmap(CGContextRef bitmapcontext); + + // Create a bitmap compatible with the given DC + wxBitmap(int width, int height, const wxDC& dc); + + // If depth is omitted, will create a bitmap compatible with the display + wxBitmap(int width, int height, int depth = -1) { (void)Create(width, height, depth); } + wxBitmap(const wxSize& sz, int depth = -1) { (void)Create(sz, depth); } + + // Convert from wxImage: + wxBitmap(const wxImage& image, int depth = -1, double scale = 1.0); + wxBitmap(const wxImage& image, const wxDC& dc); + + // Convert from wxIcon + wxBitmap(const wxIcon& icon) { CopyFromIcon(icon); } + +#if wxOSX_USE_COCOA + // Convert from wxCursor + wxBitmap(const wxCursor &cursor); +#endif + + virtual ~wxBitmap() {} + + wxImage ConvertToImage() const wxOVERRIDE; + + // get the given part of bitmap + wxBitmap GetSubBitmap( const wxRect& rect ) const wxOVERRIDE; + + virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH) wxOVERRIDE; + virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) wxOVERRIDE + { return Create(sz.GetWidth(), sz.GetHeight(), depth); } + + virtual bool Create(const void* data, wxBitmapType type, int width, int height, int depth = 1); + bool Create( CGImageRef image, double scale = 1.0 ); + bool Create( WXImage image ); + bool Create( CGContextRef bitmapcontext); + + // Create a bitmap compatible with the given DC, inheriting its magnification factor + bool Create(int width, int height, const wxDC& dc); + + // virtual bool Create( WXHICON icon) ; + virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE) wxOVERRIDE; + virtual bool SaveFile(const wxString& name, wxBitmapType type, const wxPalette *cmap = NULL) const wxOVERRIDE; + + const wxBitmapRefData *GetBitmapData() const + { return (const wxBitmapRefData *)m_refData; } + + wxBitmapRefData *GetBitmapData() + { return (wxBitmapRefData *)m_refData; } + + int GetWidth() const wxOVERRIDE; + int GetHeight() const wxOVERRIDE; + int GetDepth() const wxOVERRIDE; + +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_MSG("this value is determined during creation, this method could lead to inconsistencies") + void SetWidth(int width) wxOVERRIDE; + wxDEPRECATED_MSG("this value is determined during creation, this method could lead to inconsistencies") + void SetHeight(int height) wxOVERRIDE; + wxDEPRECATED_MSG("this value is determined during creation, this method could lead to inconsistencies") + void SetDepth(int depth) wxOVERRIDE; +#endif + +#if wxUSE_PALETTE + wxPalette* GetPalette() const wxOVERRIDE; + void SetPalette(const wxPalette& palette) wxOVERRIDE; +#endif // wxUSE_PALETTE + + wxMask *GetMask() const wxOVERRIDE; + void SetMask(wxMask *mask) wxOVERRIDE; + + static void InitStandardHandlers(); + + // raw bitmap access support functions, for internal use only + void *GetRawData(wxPixelDataBase& data, int bpp); + void UngetRawData(wxPixelDataBase& data); + + bool HasAlpha() const wxOVERRIDE; + bool UseAlpha(bool use = true) wxOVERRIDE; + + // returns the 'native' implementation, a GWorldPtr for the content and one for the mask + WXHBITMAP GetHBITMAP( WXHBITMAP * mask = NULL ) const; + + // returns a CGImageRef which must released after usage with CGImageRelease + CGImageRef CreateCGImage() const ; + + // returns nil for invalid bitmap + WXImage OSXGetImage() const; +#if wxOSX_USE_COCOA + // returns an autoreleased version of the image + WX_NSImage GetNSImage() const + { return OSXGetImage(); } +#endif +#if wxOSX_USE_IPHONE + // returns an autoreleased version of the image + WX_UIImage GetUIImage() const + { return OSXGetImage(); } +#endif + +#if WXWIN_COMPATIBILITY_3_0 + +#if wxOSX_USE_ICONREF + // returns a IconRef which must be retained before and released after usage + wxDEPRECATED_MSG("IconRefs are deprecated, this will be removed in the future") + IconRef GetIconRef() const; + // returns a IconRef which must be released after usage + wxDEPRECATED_MSG("IconRefs are deprecated, this will be removed in the future") + IconRef CreateIconRef() const; +#endif + + // get read only access to the underlying buffer + wxDEPRECATED_MSG("use GetRawData for accessing the buffer") + const void *GetRawAccess() const; + // brackets to the underlying OS structure for read/write access + // makes sure that no cached images will be constructed until terminated + wxDEPRECATED_MSG("use GetRawData for accessing the buffer") + void *BeginRawAccess(); + wxDEPRECATED_MSG("use GetRawData for accessing the buffer") + void EndRawAccess(); +#endif + + void SetScaleFactor(double scale) wxOVERRIDE; + double GetScaleFactor() const wxOVERRIDE; + + void SetSelectedInto(wxDC *dc); + wxDC *GetSelectedInto() const; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + + virtual bool DoCreate(const wxSize& sz, double scale, int depth) wxOVERRIDE; + +private: + void InitFromImage(const wxImage& image, int depth, double scale); +}; + +#endif // _WX_BITMAP_H_ diff --git a/lib/wxWidgets/include/wx/osx/bmpbuttn.h b/lib/wxWidgets/include/wx/osx/bmpbuttn.h new file mode 100644 index 0000000..4fca974 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/bmpbuttn.h @@ -0,0 +1,50 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/bmpbuttn.h +// Purpose: wxBitmapButton class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_BMPBUTTN_H_ +#define _WX_OSX_BMPBUTTN_H_ + +#include "wx/button.h" + +#define wxDEFAULT_BUTTON_MARGIN 4 + +class WXDLLIMPEXP_CORE wxBitmapButton : public wxBitmapButtonBase +{ +public: + wxBitmapButton() + { + } + + wxBitmapButton(wxWindow *parent, wxWindowID id, const wxBitmapBundle& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)) + { + Create(parent, id, bitmap, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, const wxBitmapBundle& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)); + + bool CreateCloseButton(wxWindow* parent, + wxWindowID winid, + const wxString& name = wxString()); +protected: + + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxBitmapButton); +}; + +#endif // _WX_OSX_BMPBUTTN_H_ diff --git a/lib/wxWidgets/include/wx/osx/brush.h b/lib/wxWidgets/include/wx/osx/brush.h new file mode 100644 index 0000000..acb7702 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/brush.h @@ -0,0 +1,56 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/brush.h +// Purpose: wxBrush class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BRUSH_H_ +#define _WX_BRUSH_H_ + +#include "wx/gdicmn.h" +#include "wx/gdiobj.h" +#include "wx/bitmap.h" + +class WXDLLIMPEXP_FWD_CORE wxBrush; + +// Brush +class WXDLLIMPEXP_CORE wxBrush: public wxBrushBase +{ +public: + wxBrush(); + wxBrush(const wxColour& col, wxBrushStyle style = wxBRUSHSTYLE_SOLID); + wxBrush(const wxBitmap& stipple); + virtual ~wxBrush(); + + virtual void SetColour(const wxColour& col) wxOVERRIDE; + virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) wxOVERRIDE; + virtual void SetStyle(wxBrushStyle style) wxOVERRIDE; + virtual void SetStipple(const wxBitmap& stipple) wxOVERRIDE; + + bool operator==(const wxBrush& brush) const; + bool operator!=(const wxBrush& brush) const { return !(*this == brush); } + + wxColour GetColour() const wxOVERRIDE; + wxBrushStyle GetStyle() const wxOVERRIDE; + wxBitmap *GetStipple() const wxOVERRIDE; + + + wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants") + wxBrush(const wxColour& col, int style); + + wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants") + void SetStyle(int style) { SetStyle((wxBrushStyle)style); } + +protected: + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxBrush); +}; + +#endif // _WX_BRUSH_H_ diff --git a/lib/wxWidgets/include/wx/osx/button.h b/lib/wxWidgets/include/wx/osx/button.h new file mode 100644 index 0000000..162ad27 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/button.h @@ -0,0 +1,59 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/button.h +// Purpose: wxButton class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_BUTTON_H_ +#define _WX_OSX_BUTTON_H_ + +#include "wx/control.h" +#include "wx/gdicmn.h" + +// Pushbutton +class WXDLLIMPEXP_CORE wxButton : public wxButtonBase +{ +public: + wxButton() {} + wxButton(wxWindow *parent, + wxWindowID id, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)); + + virtual void SetLabel(const wxString& label) wxOVERRIDE; + virtual wxWindow *SetDefault() wxOVERRIDE; + virtual void Command(wxCommandEvent& event) wxOVERRIDE; + + // osx specific event handling common for all osx-ports + + virtual bool OSXHandleClicked(double timestampsec) wxOVERRIDE; + +#if wxOSX_USE_COCOA + void OSXUpdateAfterLabelChange(const wxString& label); +#endif + +protected: + wxDECLARE_DYNAMIC_CLASS(wxButton); +}; + +#endif // _WX_OSX_BUTTON_H_ diff --git a/lib/wxWidgets/include/wx/osx/carbon/private/print.h b/lib/wxWidgets/include/wx/osx/carbon/private/print.h new file mode 100644 index 0000000..fa1ce41 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/carbon/private/print.h @@ -0,0 +1,81 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/carbon/private/print.h +// Purpose: private implementation for printing on OS X +// Author: Stefan Csomor +// Modified by: +// Created: 03/02/99 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MAC_PRIVATE_PRINT_H_ +#define _WX_MAC_PRIVATE_PRINT_H_ + +#include "wx/cmndata.h" +#include "wx/print.h" + +// for PrintingManager +#include "ApplicationServices/ApplicationServices.h" + +class WXDLLIMPEXP_CORE wxOSXPrintData : public wxPrintNativeDataBase +{ +public: + wxOSXPrintData(); + virtual ~wxOSXPrintData(); + + virtual bool TransferTo( wxPrintData &data ) wxOVERRIDE; + virtual bool TransferFrom( const wxPrintData &data ) wxOVERRIDE; + + virtual bool IsOk() const wxOVERRIDE; + + virtual void TransferFrom( const wxPageSetupDialogData * ) wxOVERRIDE; + virtual void TransferTo( wxPageSetupDialogData * ) wxOVERRIDE; + + virtual void TransferFrom( const wxPrintDialogData * ); + virtual void TransferTo( wxPrintDialogData * ); + + PMPrintSession GetPrintSession() { return m_macPrintSession; } + PMPageFormat GetPageFormat() { return m_macPageFormat; } + PMPrintSettings GetPrintSettings() { return m_macPrintSettings; } +protected : + virtual void TransferPrinterNameFrom( const wxPrintData &data ); + virtual void TransferPaperInfoFrom( const wxPrintData &data ); + virtual void TransferResolutionFrom( const wxPrintData &data ); + + virtual void TransferPrinterNameTo( wxPrintData &data ); + virtual void TransferPaperInfoTo( wxPrintData &data ); + virtual void TransferResolutionTo( wxPrintData &data ); + + + virtual void UpdateFromPMState(); + virtual void UpdateToPMState(); + + PMPrintSession m_macPrintSession ; + PMPageFormat m_macPageFormat ; + PMPrintSettings m_macPrintSettings ; + PMPaper m_macPaper; +private: + wxDECLARE_DYNAMIC_CLASS(wxOSXPrintData); +} ; + +WXDLLIMPEXP_CORE wxPrintNativeDataBase* wxOSXCreatePrintData(); + +#if wxOSX_USE_COCOA +class WXDLLIMPEXP_CORE wxOSXCocoaPrintData : public wxOSXPrintData +{ +public: + wxOSXCocoaPrintData(); + virtual ~wxOSXCocoaPrintData(); + + WX_NSPrintInfo GetNSPrintInfo() { return m_macPrintInfo; } +protected: + virtual void UpdateFromPMState() wxOVERRIDE; + virtual void UpdateToPMState() wxOVERRIDE; + + WX_NSPrintInfo m_macPrintInfo; +private: + wxDECLARE_DYNAMIC_CLASS(wxOSXCocoaPrintData); +} ; +#endif + +#endif // _WX_MAC_PRIVATE_PRINT_H_ diff --git a/lib/wxWidgets/include/wx/osx/carbon/region.h b/lib/wxWidgets/include/wx/osx/carbon/region.h new file mode 100644 index 0000000..a5a1b87 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/carbon/region.h @@ -0,0 +1,102 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/carbon/region.h +// Purpose: wxRegion class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MAC_CARBON_REGION_H_ +#define _WX_MAC_CARBON_REGION_H_ + +#include "wx/list.h" + +class WXDLLIMPEXP_CORE wxRegion : public wxRegionWithCombine +{ +public: + wxRegion() { } + wxRegion(long x, long y, long w, long h); + wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight); + wxRegion(const wxRect& rect); + wxRegion( WXHRGN hRegion ); + wxRegion(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE ); +#if wxUSE_IMAGE + wxRegion(const wxBitmap& bmp) + { + Union(bmp); + } + wxRegion(const wxBitmap& bmp, + const wxColour& transColour, int tolerance = 0) + { + Union(bmp, transColour, tolerance); + } +#endif + + virtual ~wxRegion(); + + // wxRegionBase methods + virtual void Clear() wxOVERRIDE; + virtual bool IsEmpty() const wxOVERRIDE; + + // Internal + WXHRGN GetWXHRGN() const ; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + + virtual bool DoIsEqual(const wxRegion& region) const wxOVERRIDE; + virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const wxOVERRIDE; + virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const wxOVERRIDE; + virtual wxRegionContain DoContainsRect(const wxRect& rect) const wxOVERRIDE; + + virtual bool DoOffset(wxCoord x, wxCoord y) wxOVERRIDE; + virtual bool DoCombine(const wxRegion& region, wxRegionOp op) wxOVERRIDE; + virtual bool DoUnionWithRect(const wxRect& rect) wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxRegion); + friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator; +}; + +class WXDLLIMPEXP_CORE wxRegionIterator : public wxObject +{ +public: + wxRegionIterator(); + wxRegionIterator(const wxRegion& region); + wxRegionIterator(const wxRegionIterator& iterator); + virtual ~wxRegionIterator(); + + wxRegionIterator& operator=(const wxRegionIterator& iterator); + + void Reset() { m_current = 0; } + void Reset(const wxRegion& region); + + operator bool () const { return m_current < m_numRects; } + bool HaveRects() const { return m_current < m_numRects; } + + wxRegionIterator& operator++(); + wxRegionIterator operator++(int); + + long GetX() const; + long GetY() const; + long GetW() const; + long GetWidth() const { return GetW(); } + long GetH() const; + long GetHeight() const { return GetH(); } + wxRect GetRect() const { return wxRect((int)GetX(), (int)GetY(), (int)GetWidth(), (int)GetHeight()); } + +private: + void SetRects(long numRects, wxRect *rects); + + long m_current; + long m_numRects; + wxRegion m_region; + wxRect* m_rects; + + wxDECLARE_DYNAMIC_CLASS(wxRegionIterator); +}; + +#endif // _WX_MAC_CARBON_REGION_H_ diff --git a/lib/wxWidgets/include/wx/osx/checkbox.h b/lib/wxWidgets/include/wx/osx/checkbox.h new file mode 100644 index 0000000..87bae72 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/checkbox.h @@ -0,0 +1,81 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/checkbox.h +// Purpose: wxCheckBox class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CHECKBOX_H_ +#define _WX_CHECKBOX_H_ + +// Checkbox item (single checkbox) +class WXDLLIMPEXP_CORE wxCheckBox : public wxCheckBoxBase +{ +public: + wxCheckBox() { } + wxCheckBox(wxWindow *parent, wxWindowID id, const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)); + virtual void SetValue(bool) wxOVERRIDE; + virtual bool GetValue() const wxOVERRIDE; + + virtual void Command(wxCommandEvent& event) wxOVERRIDE; + + // osx specific event handling common for all osx-ports + + virtual bool OSXHandleClicked( double timestampsec ) wxOVERRIDE; +protected: + void DoSet3StateValue(wxCheckBoxState val) wxOVERRIDE; + virtual wxCheckBoxState DoGet3StateValue() const wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxCheckBox); +}; + +class WXDLLIMPEXP_FWD_CORE wxBitmap; +class WXDLLIMPEXP_CORE wxBitmapCheckBox: public wxCheckBox +{ +public: + int checkWidth; + int checkHeight; + + wxBitmapCheckBox() + : checkWidth(-1), checkHeight(-1) + { } + + wxBitmapCheckBox(wxWindow *parent, wxWindowID id, const wxBitmap *label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, const wxBitmap *bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)); + virtual void SetValue(bool) wxOVERRIDE; + virtual bool GetValue() const wxOVERRIDE; + virtual void SetLabel(const wxBitmap *bitmap); + virtual void SetLabel( const wxString & WXUNUSED(name) ) wxOVERRIDE {} + + wxDECLARE_DYNAMIC_CLASS(wxBitmapCheckBox); +}; +#endif + // _WX_CHECKBOX_H_ diff --git a/lib/wxWidgets/include/wx/osx/checklst.h b/lib/wxWidgets/include/wx/osx/checklst.h new file mode 100644 index 0000000..5c085c6 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/checklst.h @@ -0,0 +1,93 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/checklst.h +// Purpose: wxCheckListBox class - a listbox with checkable items +// Note: this is an optional class. +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MAC_CHECKLST_H_ +#define _WX_MAC_CHECKLST_H_ + +class WXDLLIMPEXP_CORE wxCheckListBox : public wxCheckListBoxBase +{ +public: + // ctors + wxCheckListBox() { Init(); } + wxCheckListBox(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int nStrings = 0, + const wxString *choices = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)) + { + Init(); + + Create(parent, id, pos, size, nStrings, choices, style, validator, name); + } + wxCheckListBox(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)) + { + Init(); + + Create(parent, id, pos, size, choices, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int nStrings = 0, + const wxString *choices = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + + // items may be checked + bool IsChecked(unsigned int uiIndex) const wxOVERRIDE; + void Check(unsigned int uiIndex, bool bCheck = true) wxOVERRIDE; + + // data callbacks + virtual void GetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value ) wxOVERRIDE; + virtual void SetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value ) wxOVERRIDE; + +protected: + // override all methods which add/delete items to update m_checks array as + // well + virtual void OnItemInserted(unsigned int pos) wxOVERRIDE; + virtual void DoDeleteOneItem(unsigned int n) wxOVERRIDE; + virtual void DoClear() wxOVERRIDE; + + // the array containing the checked status of the items + wxArrayInt m_checks; + + wxListWidgetColumn* m_checkColumn ; + + void Init(); + +private: + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxCheckListBox); +}; + +#endif // _WX_MAC_CHECKLST_H_ diff --git a/lib/wxWidgets/include/wx/osx/chkconf.h b/lib/wxWidgets/include/wx/osx/chkconf.h new file mode 100644 index 0000000..a3a2bc3 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/chkconf.h @@ -0,0 +1,81 @@ +/* + * Name: wx/osx/chkconf.h + * Purpose: Mac-specific config settings checks + * Author: Vadim Zeitlin + * Modified by: + * Created: 2005-04-05 (extracted from wx/chkconf.h) + * Copyright: (c) 2005 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_OSX_CHKCONF_H_ +#define _WX_OSX_CHKCONF_H_ + +/* + * check graphics context option, must be on for every os x platform + * we only use core graphics now on all builds, try to catch attempts + * to configure the build otherwise and give error messages + */ + +#if wxUSE_GUI && (!wxUSE_GRAPHICS_CONTEXT || \ + ( defined( wxMAC_USE_CORE_GRAPHICS ) && !wxMAC_USE_CORE_GRAPHICS )) +# error "OS X builds use CoreGraphics in this wx version, you cannot turn back to QuickDraw completely" +#endif + +/* + * using mixins of cocoa functionality + */ + +#ifdef __WXOSX_COCOA__ + #define wxOSX_USE_COCOA 1 +#else + #define wxOSX_USE_COCOA 0 +#endif + +#ifdef __WXOSX_CARBON__ + #define wxOSX_USE_CARBON 1 +#else + #define wxOSX_USE_CARBON 0 +#endif + +#ifdef __WXOSX_IPHONE__ + #define wxOSX_USE_IPHONE 1 +#else + #define wxOSX_USE_IPHONE 0 +#endif + +/* + * platform check + */ + +#ifndef __LP64__ + #if wxOSX_USE_COCOA + #error "wxOSX/Cocoa requires building in 64 bits" + #endif +#endif + +/* + * combination flags + */ + +#if wxOSX_USE_COCOA || wxOSX_USE_CARBON + #define wxOSX_USE_COCOA_OR_CARBON 1 +#else + #define wxOSX_USE_COCOA_OR_CARBON 0 +#endif + +#if wxOSX_USE_COCOA || wxOSX_USE_IPHONE + #define wxOSX_USE_COCOA_OR_IPHONE 1 +#else + #define wxOSX_USE_COCOA_OR_IPHONE 0 +#endif + +#if wxOSX_USE_IPHONE + #include "wx/osx/iphone/chkconf.h" +#elif wxOSX_USE_COCOA + #include "wx/osx/cocoa/chkconf.h" +#endif + +#endif /* _WX_OSX_CHKCONF_H_ */ diff --git a/lib/wxWidgets/include/wx/osx/choice.h b/lib/wxWidgets/include/wx/osx/choice.h new file mode 100644 index 0000000..37486f8 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/choice.h @@ -0,0 +1,101 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/choice.h +// Purpose: wxChoice class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CHOICE_H_ +#define _WX_CHOICE_H_ + +#include "wx/control.h" + +#include "wx/dynarray.h" +#include "wx/arrstr.h" + +WX_DEFINE_ARRAY( char * , wxChoiceDataArray ) ; + +// Choice item +class WXDLLIMPEXP_CORE wxChoice: public wxChoiceBase +{ + wxDECLARE_DYNAMIC_CLASS(wxChoice); + +public: + wxChoice() + : m_strings(), m_datas() + {} + + virtual ~wxChoice() ; + + wxChoice(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr)) + { + Create(parent, id, pos, size, n, choices, style, validator, name); + } + wxChoice(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr)) + { + Create(parent, id, pos, size, choices, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr)); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr)); + + virtual unsigned int GetCount() const wxOVERRIDE; + virtual int GetSelection() const wxOVERRIDE; + virtual void SetSelection(int n) wxOVERRIDE; + + virtual int FindString(const wxString& s, bool bCase = false) const wxOVERRIDE; + virtual wxString GetString(unsigned int n) const wxOVERRIDE; + virtual void SetString(unsigned int pos, const wxString& s) wxOVERRIDE; + // osx specific event handling common for all osx-ports + + virtual bool OSXHandleClicked(double timestampsec) wxOVERRIDE; + +protected: + virtual void DoDeleteOneItem(unsigned int n) wxOVERRIDE; + virtual void DoClear() wxOVERRIDE; + + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual int DoInsertItems(const wxArrayStringsAdapter& items, + unsigned int pos, + void **clientData, wxClientDataType type) wxOVERRIDE; + + virtual void DoSetItemClientData(unsigned int n, void* clientData) wxOVERRIDE; + virtual void* DoGetItemClientData(unsigned int n) const wxOVERRIDE; + + wxArrayString m_strings; + wxChoiceDataArray m_datas ; + +private: + // This should be called when the number of items in the control changes. + void DoAfterItemCountChange(); +}; + +#endif + // _WX_CHOICE_H_ diff --git a/lib/wxWidgets/include/wx/osx/clipbrd.h b/lib/wxWidgets/include/wx/osx/clipbrd.h new file mode 100644 index 0000000..77a78f7 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/clipbrd.h @@ -0,0 +1,67 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/clipbrd.h +// Purpose: Clipboard functionality. +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CLIPBRD_H_ +#define _WX_CLIPBRD_H_ + +#if wxUSE_CLIPBOARD + +#include "wx/osx/core/cfref.h" + +//----------------------------------------------------------------------------- +// wxClipboard +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxClipboard : public wxClipboardBase +{ +public: + wxClipboard(); + virtual ~wxClipboard(); + + // open the clipboard before SetData() and GetData() + virtual bool Open() wxOVERRIDE; + + // close the clipboard after SetData() and GetData() + virtual void Close() wxOVERRIDE; + + // query whether the clipboard is opened + virtual bool IsOpened() const wxOVERRIDE; + + // set the clipboard data. all other formats will be deleted. + virtual bool SetData( wxDataObject *data ) wxOVERRIDE; + + // add to the clipboard data. + virtual bool AddData( wxDataObject *data ) wxOVERRIDE; + + // ask if data in correct format is available + virtual bool IsSupported( const wxDataFormat& format ) wxOVERRIDE; + + // fill data with data on the clipboard (if available) + virtual bool GetData( wxDataObject& data ) wxOVERRIDE; + + // clears wxTheClipboard and the system's clipboard if possible + virtual void Clear() wxOVERRIDE; + + // flushes the clipboard: this means that the data which is currently on + // clipboard will stay available even after the application exits (possibly + // eating memory), otherwise the clipboard will be emptied on exit + virtual bool Flush() wxOVERRIDE; + +private: + wxDataObject *m_data; + bool m_open; + wxCFRef<PasteboardRef> m_pasteboard; + + wxDECLARE_DYNAMIC_CLASS(wxClipboard); +}; + +#endif // wxUSE_CLIPBOARD + +#endif // _WX_CLIPBRD_H_ diff --git a/lib/wxWidgets/include/wx/osx/cocoa/chkconf.h b/lib/wxWidgets/include/wx/osx/cocoa/chkconf.h new file mode 100644 index 0000000..f2b5f52 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/cocoa/chkconf.h @@ -0,0 +1,56 @@ +/* + * Name: wx/osx/cocoa/chkconf.h + * Purpose: Compiler-specific configuration checking + * Author: Stefan Csomor + * Modified by: + * Created: 2008-07-30 + * Copyright: (c) Stefan Csomor + * Licence: wxWindows licence + */ + +#ifndef _WX_OSX_COCOA_CHKCONF_H_ +#define _WX_OSX_COCOA_CHKCONF_H_ + +/* + * native (1) or emulated (0) toolbar + */ + +#ifndef wxOSX_USE_NATIVE_TOOLBAR + #define wxOSX_USE_NATIVE_TOOLBAR 1 +#endif + +/* + * leave is isFlipped and don't override + */ +#ifndef wxOSX_USE_NATIVE_FLIPPED + #define wxOSX_USE_NATIVE_FLIPPED 1 +#endif + +/* + * Audio System + */ + +#define wxOSX_USE_QUICKTIME 0 +#define wxOSX_USE_AUDIOTOOLBOX 1 + +/* + Use the more efficient FSEvents API instead of kqueue + events for file system watcher since that version introduced a flag that + allows watching files as well as sub directories. + */ +#define wxHAVE_FSEVENTS_FILE_NOTIFICATIONS 1 + +/* + * turn off old style icon format if not asked for + */ +#ifndef wxOSX_USE_ICONREF + #define wxOSX_USE_ICONREF 0 +#endif + +/* + * turning off capabilities that don't work under cocoa yet + */ + +#endif + /* _WX_MAC_CHKCONF_H_ */ + diff --git a/lib/wxWidgets/include/wx/osx/cocoa/dataview.h b/lib/wxWidgets/include/wx/osx/cocoa/dataview.h new file mode 100644 index 0000000..7d63ed0 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/cocoa/dataview.h @@ -0,0 +1,564 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/cocoa/dataview.h +// Purpose: wxDataViewCtrl native implementation header for carbon +// Author: +// Copyright: (c) 2009 +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DATAVIEWCTRL_COCOOA_H_ +#define _WX_DATAVIEWCTRL_COCOOA_H_ + +#include "wx/defs.h" + +#import <Cocoa/Cocoa.h> + +#include "wx/osx/core/dataview.h" +#include "wx/osx/private.h" + +// Forward declaration +class wxCocoaDataViewControl; + +/* + Dramatis personae: + + [vertical arrows indicate inheritance, horizontal -- aggregation] + + + wxWindow ---> wxWidgetCocoaImpl wxDataViewWidgetImpl NSOutlineView + | \ / | + | \ / | + | \ / | + v \/ \/ v + wxDataViewCtrl -------> wxCocoaDataViewControl <-------> wxCocoaOutlineView + + + The right most classes are Objective-C only and can't be used from (pure) + C++ code. + */ + +// ============================================================================ +// wxPointerObject: simply stores a pointer, without taking its ownership +// ============================================================================ + +// Two pointer objects are equal if the containing pointers are equal. This +// means also that the hash value of a pointer object depends only on the +// stored pointer. + +@interface wxPointerObject : NSObject +{ + void* pointer; +} + + -(id) initWithPointer:(void*)initPointer; + + -(void*) pointer; + -(void) setPointer:(void*)newPointer; +@end + +// ============================================================================ +// wxSortDescriptorObject: helper class to use native sorting facilities +// ============================================================================ + +@interface wxSortDescriptorObject : NSSortDescriptor<NSCopying> +{ + wxDataViewColumn* columnPtr; // pointer to the sorting column + + wxDataViewModel* modelPtr; // pointer to model +} + + -(id) + initWithModelPtr:(wxDataViewModel*)initModelPtr + sortingColumnPtr:(wxDataViewColumn*)initColumnPtr + ascending:(BOOL)sortAscending; + + -(wxDataViewColumn*) columnPtr; + -(wxDataViewModel*) modelPtr; + + -(void) setColumnPtr:(wxDataViewColumn*)newColumnPtr; + -(void) setModelPtr:(wxDataViewModel*)newModelPtr; +@end + +// ============================================================================ +// wxDataViewColumnNativeData: extra data for wxDataViewColumn +// ============================================================================ + +class wxDataViewColumnNativeData +{ +public: + wxDataViewColumnNativeData() : m_NativeColumnPtr(NULL) + { + } + + wxDataViewColumnNativeData(NSTableColumn* initNativeColumnPtr) + : m_NativeColumnPtr(initNativeColumnPtr) + { + } + + NSTableColumn* GetNativeColumnPtr() const + { + return m_NativeColumnPtr; + } + + void SetNativeColumnPtr(NSTableColumn* newNativeColumnPtr) + { + m_NativeColumnPtr = newNativeColumnPtr; + } + +private: + // not owned by us + NSTableColumn* m_NativeColumnPtr; +}; + +// ============================================================================ +// wxDataViewRendererNativeData: extra data for wxDataViewRenderer +// ============================================================================ + +class wxDataViewRendererNativeData +{ +public: + wxDataViewRendererNativeData() + : m_Object(NULL), m_ColumnCell(NULL), m_ItemCell(NULL) + { + Init(); + } + + wxDataViewRendererNativeData(NSCell* initColumnCell) + : m_Object(NULL), m_ColumnCell([initColumnCell retain]), m_ItemCell(NULL) + { + Init(); + } + + wxDataViewRendererNativeData(NSCell* initColumnCell, id initObject) + : m_Object([initObject retain]), m_ColumnCell([initColumnCell retain]), m_ItemCell(NULL) + { + Init(); + } + + ~wxDataViewRendererNativeData() + { + [m_ColumnCell release]; + [m_Object release]; + + [m_origFont release]; + [m_origTextColour release]; + [m_origBackgroundColour release]; + } + + NSCell* GetColumnCell() const { return m_ColumnCell; } + NSTableColumn* GetColumnPtr() const { return m_TableColumnPtr; } + id GetItem() const { return m_Item; } + NSCell* GetItemCell() const { return m_ItemCell; } + id GetObject() const { return m_Object; } + + void SetColumnCell(NSCell* newCell) + { + [newCell retain]; + [m_ColumnCell release]; + m_ColumnCell = newCell; + } + void SetColumnPtr(NSTableColumn* newColumnPtr) + { + m_TableColumnPtr = newColumnPtr; + } + void SetItem(id newItem) + { + m_Item = newItem; + } + void SetItemCell(NSCell* newCell) + { + m_ItemCell = newCell; + } + void SetObject(id newObject) + { + [newObject retain]; + [m_Object release]; + m_Object = newObject; + } + + // The original cell font and text colour stored here are NULL by default + // and are only initialized to the values retrieved from the cell when we + // change them from wxCocoaOutlineView:willDisplayCell:forTableColumn:item: + // which calls our SaveOriginalXXX() methods before changing the cell + // attributes. + // + // This allows us to avoid doing anything for the columns without any + // attributes but still be able to restore the correct attributes for the + // ones that do. + NSFont *GetOriginalFont() const { return m_origFont; } + NSColor *GetOriginalTextColour() const { return m_origTextColour; } + NSColor *GetOriginalBackgroundColour() const { return m_origBackgroundColour; } + + void SaveOriginalFont(NSFont *font) + { + m_origFont = [font retain]; + } + + void SaveOriginalTextColour(NSColor *textColour) + { + m_origTextColour = [textColour retain]; + } + + void SaveOriginalBackgroundColour(NSColor *backgroundColour) + { + m_origBackgroundColour = [backgroundColour retain]; + } + + // The ellipsization mode which we need to set for each cell being rendered. + void SetEllipsizeMode(wxEllipsizeMode mode) { m_ellipsizeMode = mode; } + wxEllipsizeMode GetEllipsizeMode() const { return m_ellipsizeMode; } + + // Set the line break mode for the given cell using our m_ellipsizeMode + void ApplyLineBreakMode(NSCell *cell); + + // Does the rendered use a font that the control can't override? + void SetHasCustomFont(bool has) { m_hasCustomFont = has; } + bool HasCustomFont() const { return m_hasCustomFont; } + +private: + // common part of all ctors + void Init(); + + id m_Item; // item NOT owned by renderer + + // object that can be used by renderer for storing special data (owned by + // renderer) + id m_Object; + + NSCell* m_ColumnCell; // column's cell is owned by renderer + NSCell* m_ItemCell; // item's cell is NOT owned by renderer + + NSTableColumn* m_TableColumnPtr; // column NOT owned by renderer + + // we own those if they're non-NULL + NSFont *m_origFont; + NSColor *m_origTextColour; + NSColor *m_origBackgroundColour; + + wxEllipsizeMode m_ellipsizeMode; + + bool m_hasCustomFont; +}; + +// ============================================================================ +// wxCocoaOutlineDataSource +// ============================================================================ + +// This class implements the data source delegate for the outline view. +// As only an informal protocol exists this class inherits from NSObject only. +// +// As mentioned in the documentation for NSOutlineView the native control does +// not own any data. Therefore, it has to be done by the data source. +// Unfortunately, wxWidget's data source is a C++ data source but +// NSOutlineDataSource requires objects as data. Therefore, the data (or better +// the native item objects) have to be stored additionally in the native data +// source. +// NSOutlineView requires quick access to the item objects and quick linear +// access to an item's children. This requires normally a hash type of storage +// for the item object itself and an array structure for each item's children. +// This means that basically two times the whole structure of wxWidget's model +// class has to be stored. +// This implementation is using a compromise: all items that are in use by the +// control are stored in a set (from there they can be easily retrieved) and +// owned by the set. Furthermore, children of the last parent are stored +// in a linear list. +// +@interface wxCocoaOutlineDataSource : NSObject <NSOutlineViewDataSource> +{ + // descriptors specifying the sorting (currently the array only holds one + // object only) + NSArray* sortDescriptors; + + NSMutableArray* children; // buffered children + + NSMutableSet* items; // stores all items that are in use by the control + + wxCocoaDataViewControl* implementation; + + wxDataViewModel* model; + + // parent of the buffered children; the object is owned + wxPointerObject* currentParentItem; +} + + // methods of informal protocol: + -(BOOL) + outlineView:(NSOutlineView*)outlineView + acceptDrop:(id<NSDraggingInfo>)info + item:(id)item + childIndex:(NSInteger)index; + + -(id) + outlineView:(NSOutlineView*)outlineView + child:(NSInteger)index + ofItem:(id)item; + + -(id) + outlineView:(NSOutlineView*)outlineView + objectValueForTableColumn:(NSTableColumn*)tableColumn + byItem:(id)item; + + -(BOOL) + outlineView:(NSOutlineView*)outlineView + isItemExpandable:(id)item; + + -(NSInteger) + outlineView:(NSOutlineView*)outlineView + numberOfChildrenOfItem:(id)item; + + -(NSDragOperation) + outlineView:(NSOutlineView*)outlineView + validateDrop:(id<NSDraggingInfo>)info + proposedItem:(id)item + proposedChildIndex:(NSInteger)index; + + -(BOOL) + outlineView:(NSOutlineView*)outlineView + writeItems:(NSArray*)items + toPasteboard:(NSPasteboard*)pasteboard; + + // buffer for items handling + -(void) addToBuffer:(wxPointerObject*)item; + -(void) clearBuffer; + // returns the item in the buffer that has got the same pointer as "item", + // if such an item does not exist nil is returned + -(wxPointerObject*) getDataViewItemFromBuffer:(const wxDataViewItem&)item; + -(wxPointerObject*) getItemFromBuffer:(wxPointerObject*)item; + -(BOOL) isInBuffer:(wxPointerObject*)item; + -(void) removeFromBuffer:(wxPointerObject*)item; + + // buffered children handling + -(void) clearChildren; + -(wxPointerObject*) getChild:(NSUInteger)index; + -(NSUInteger) getChildCount; + + // buffer handling + -(void) clearBuffers; + + // sorting + -(NSArray*) sortDescriptors; + -(void) setSortDescriptors:(NSArray*)newSortDescriptors; + + // access to wxWidgets variables + -(wxPointerObject*) currentParentItem; + -(wxCocoaDataViewControl*) implementation; + -(wxDataViewModel*) model; + -(void) setCurrentParentItem:(wxPointerObject*)newCurrentParentItem; + -(void) setImplementation:(wxCocoaDataViewControl*)newImplementation; + -(void) setModel:(wxDataViewModel*)newModel; + + // other methods + -(void) + bufferItem:(wxPointerObject*)parentItem + withChildren:(wxDataViewItemArray*)dataViewChildrenPtr; +@end + +// ============================================================================ +// wxCustomCell: used for custom renderers +// ============================================================================ + +@interface wxCustomCell : NSTextFieldCell +{ +} + + -(NSSize) cellSize; +@end + +// ============================================================================ +// wxImageCell: used for bitmap renderer +// ============================================================================ + +@interface wxImageCell : NSImageCell +{ +} + + -(NSSize) cellSize; +@end + + +// ============================================================================ +// NSTextFieldCell customized to allow vertical alignment +// ============================================================================ + +@interface wxTextFieldCell : NSTextFieldCell +{ +@private + int alignment_; + BOOL adjustRect_; +} + + -(void) setWXAlignment:(int)alignment; +@end + +// ============================================================================ +// wxImageTextCell +// ============================================================================ +// +// As the native cocoa environment does not have a cell displaying an icon/ +// image and text at the same time, it has to be implemented by the user. +// This implementation follows the implementation of Chuck Pisula in Apple's +// DragNDropOutline sample application. +// Although in wxDataViewCtrl icons are used on OSX icons do not exist for +// display. Therefore, the cell is also called wxImageTextCell. +// Instead of displaying images of any size (which is possible) this cell uses +// a fixed size for displaying the image. Larger images are scaled to fit +// into their reserved space. Smaller or not existing images use the fixed +// reserved size and are scaled if necessary. +// +@interface wxImageTextCell : wxTextFieldCell +{ +@private + CGFloat xImageShift; // shift for the image in x-direction from border + CGFloat spaceImageText; // space between image and text + + NSImage* image; // the image itself + + NSSize imageSize; // largest size of the image; default size is (16, 16) + + // the text alignment is used to align the whole cell (image and text) + NSTextAlignment cellAlignment; +} + + -(NSTextAlignment) alignment; + -(void) setAlignment:(NSTextAlignment)newAlignment; + + -(NSImage*) image; + -(void) setImage:(NSImage*)newImage; + + -(NSSize) imageSize; + -(void) setImageSize:(NSSize) newImageSize; + + -(NSSize) cellSize; +@end + +// ============================================================================ +// wxCocoaOutlineView +// ============================================================================ + +@interface wxCocoaOutlineView : NSOutlineView <NSOutlineViewDelegate> +{ +@private + // column and row of the cell being edited or -1 if none + int currentlyEditedColumn, + currentlyEditedRow; + + wxCocoaDataViewControl* implementation; +} + + -(wxCocoaDataViewControl*) implementation; + -(void) setImplementation:(wxCocoaDataViewControl*) newImplementation; +@end + +// ============================================================================ +// wxCocoaDataViewControl +// ============================================================================ + +// This is the internal interface class between wxDataViewCtrl (wxWidget) and +// the native source view (Mac OS X cocoa). +class wxCocoaDataViewControl : public wxWidgetCocoaImpl, + public wxDataViewWidgetImpl +{ +public: + // constructors / destructor + wxCocoaDataViewControl(wxWindow* peer, + const wxPoint& pos, + const wxSize& size, + long style); + virtual ~wxCocoaDataViewControl(); + + wxDataViewCtrl* GetDataViewCtrl() const + { + return static_cast<wxDataViewCtrl*>(GetWXPeer()); + } + + // column related methods (inherited from wxDataViewWidgetImpl) + virtual bool ClearColumns() wxOVERRIDE; + virtual bool DeleteColumn(wxDataViewColumn* columnPtr) wxOVERRIDE; + virtual void DoSetExpanderColumn(wxDataViewColumn const* columnPtr) wxOVERRIDE; + virtual wxDataViewColumn* GetColumn(unsigned int pos) const wxOVERRIDE; + virtual int GetColumnPosition(wxDataViewColumn const* columnPtr) const wxOVERRIDE; + virtual bool InsertColumn(unsigned int pos, wxDataViewColumn* columnPtr) wxOVERRIDE; + virtual void FitColumnWidthToContent(unsigned int pos) wxOVERRIDE; + + // item related methods (inherited from wxDataViewWidgetImpl) + virtual bool Add(const wxDataViewItem& parent, const wxDataViewItem& item) wxOVERRIDE; + virtual bool Add(const wxDataViewItem& parent, + const wxDataViewItemArray& items) wxOVERRIDE; + virtual void Collapse(const wxDataViewItem& item) wxOVERRIDE; + virtual void EnsureVisible(const wxDataViewItem& item, + wxDataViewColumn const* columnPtr) wxOVERRIDE; + virtual unsigned int GetCount() const wxOVERRIDE; + virtual int GetCountPerPage() const wxOVERRIDE; + virtual wxRect GetRectangle(const wxDataViewItem& item, + wxDataViewColumn const* columnPtr) wxOVERRIDE; + virtual wxDataViewItem GetTopItem() const wxOVERRIDE; + virtual bool IsExpanded(const wxDataViewItem& item) const wxOVERRIDE; + virtual bool Reload() wxOVERRIDE; + virtual bool Remove(const wxDataViewItem& parent) wxOVERRIDE; + virtual bool Update(const wxDataViewColumn* columnPtr) wxOVERRIDE; + virtual bool Update(const wxDataViewItem& parent, + const wxDataViewItem& item) wxOVERRIDE; + virtual bool Update(const wxDataViewItem& parent, + const wxDataViewItemArray& items) wxOVERRIDE; + + // model related methods + virtual bool AssociateModel(wxDataViewModel* model) wxOVERRIDE; + + // + // selection related methods (inherited from wxDataViewWidgetImpl) + // + virtual wxDataViewItem GetCurrentItem() const wxOVERRIDE; + virtual void SetCurrentItem(const wxDataViewItem& item) wxOVERRIDE; + virtual wxDataViewColumn *GetCurrentColumn() const wxOVERRIDE; + virtual int GetSelectedItemsCount() const wxOVERRIDE; + virtual int GetSelections(wxDataViewItemArray& sel) const wxOVERRIDE; + virtual bool IsSelected(const wxDataViewItem& item) const wxOVERRIDE; + virtual void Select(const wxDataViewItem& item) wxOVERRIDE; + virtual void Select(const wxDataViewItemArray& items) wxOVERRIDE; + virtual void SelectAll() wxOVERRIDE; + virtual void Unselect(const wxDataViewItem& item) wxOVERRIDE; + virtual void UnselectAll() wxOVERRIDE; + + // + // sorting related methods + // + virtual wxDataViewColumn* GetSortingColumn () const wxOVERRIDE; + virtual void Resort() wxOVERRIDE; + + // + // other methods (inherited from wxDataViewWidgetImpl) + // + virtual void DoSetIndent(int indent) wxOVERRIDE; + + virtual void DoExpand(const wxDataViewItem& item, bool expandChildren) wxOVERRIDE; + + virtual void HitTest(const wxPoint& point, + wxDataViewItem& item, + wxDataViewColumn*& columnPtr) const wxOVERRIDE; + virtual void SetRowHeight(int height) wxOVERRIDE; + virtual void SetRowHeight(const wxDataViewItem& item, unsigned int height) wxOVERRIDE; + virtual void OnSize() wxOVERRIDE; + + virtual void StartEditor( const wxDataViewItem & item, unsigned int column ) wxOVERRIDE; + + // Cocoa-specific helpers + id GetItemAtRow(int row) const; + + virtual void SetFont(const wxFont& font) wxOVERRIDE; + + virtual void keyEvent(WX_NSEvent event, WXWidget slf, void* _cmd) wxOVERRIDE; + virtual bool doCommandBySelector(void* sel, WXWidget slf, void* _cmd) wxOVERRIDE; + +private: + void InitOutlineView(long style); + int GetDefaultRowHeight() const; + + wxCocoaOutlineDataSource* m_DataSource; + + wxCocoaOutlineView* m_OutlineView; + + // Width of expander in pixels, computed on demand. + int m_expanderWidth; +}; + +#endif // _WX_DATAVIEWCTRL_COCOOA_H_ diff --git a/lib/wxWidgets/include/wx/osx/cocoa/evtloop.h b/lib/wxWidgets/include/wx/osx/cocoa/evtloop.h new file mode 100644 index 0000000..72998e5 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/cocoa/evtloop.h @@ -0,0 +1,48 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/cocoa/evtloop.h +// Purpose: declaration of wxGUIEventLoop for wxOSX/Cocoa +// Author: Vadim Zeitlin +// Created: 2008-12-28 +// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_COCOA_EVTLOOP_H_ +#define _WX_OSX_COCOA_EVTLOOP_H_ + +class WXDLLIMPEXP_BASE wxGUIEventLoop : public wxCFEventLoop +{ +public: + wxGUIEventLoop(); + ~wxGUIEventLoop(); + + void BeginModalSession( wxWindow* modalWindow ); + + void EndModalSession(); + + virtual void WakeUp() wxOVERRIDE; + + void OSXUseLowLevelWakeup(bool useIt) + { m_osxLowLevelWakeUp = useIt ; } + +protected: + virtual int DoDispatchTimeout(unsigned long timeout) wxOVERRIDE; + + virtual void OSXDoRun() wxOVERRIDE; + virtual void OSXDoStop() wxOVERRIDE; + + virtual CFRunLoopRef CFGetCurrentRunLoop() const wxOVERRIDE; + + void* m_modalSession; + + wxWindow* m_modalWindow; + + WXWindow m_dummyWindow; + + int m_modalNestedLevel; + + bool m_osxLowLevelWakeUp; +}; + +#endif // _WX_OSX_COCOA_EVTLOOP_H_ + diff --git a/lib/wxWidgets/include/wx/osx/cocoa/private.h b/lib/wxWidgets/include/wx/osx/cocoa/private.h new file mode 100644 index 0000000..2a98694 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/cocoa/private.h @@ -0,0 +1,601 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/cocoa/private.h +// Purpose: Private declarations: as this header is only included by +// wxWidgets itself, it may contain identifiers which don't start +// with "wx". +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_COCOA_H_ +#define _WX_PRIVATE_COCOA_H_ + +#include <ApplicationServices/ApplicationServices.h> + +#ifdef __OBJC__ + #import <Cocoa/Cocoa.h> +#endif + +// +// shared between Cocoa and Carbon +// + +#include "wx/bmpbndl.h" + +// bring in theming types without pulling in the headers + +#if wxUSE_GUI +typedef SInt16 ThemeBrush; +CGColorRef WXDLLIMPEXP_CORE wxMacCreateCGColorFromHITheme( ThemeBrush brush ) ; +OSStatus WXDLLIMPEXP_CORE wxMacDrawCGImage( + CGContextRef inContext, + const CGRect * inBounds, + CGImageRef inImage) ; + +void WXDLLIMPEXP_CORE wxOSXDrawNSImage( + CGContextRef inContext, + const CGRect * inBounds, + WX_NSImage inImage) ; + +void WXDLLIMPEXP_CORE wxOSXDrawNSImage( + CGContextRef inContext, + const CGRect * inBounds, + WX_NSImage inImage, + wxCompositionMode composition) ; +WX_NSImage WXDLLIMPEXP_CORE wxOSXGetSystemImage(const wxString& name); +WX_NSImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromCGImage( CGImageRef image, double scale = 1.0, bool isTemplate = false); +WX_NSImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromIconRef( WXHICON iconref ); +WX_NSImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromCFURL( CFURLRef urlref ); +WX_NSImage WXDLLIMPEXP_CORE wxOSXGetIconForType(OSType type ); +void WXDLLIMPEXP_CORE wxOSXSetImageSize(WX_NSImage image, CGFloat width, CGFloat height); +wxBitmapBundle WXDLLIMPEXP_CORE wxOSXCreateSystemBitmapBundle(const wxString& id, const wxString &client, const wxSize& size); +WXWindow WXDLLIMPEXP_CORE wxOSXGetMainWindow(); +WXWindow WXDLLIMPEXP_CORE wxOSXGetKeyWindow(); +WXImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromNSCursor(const WXHCURSOR cursor); + +class WXDLLIMPEXP_FWD_CORE wxDialog; + +class WXDLLIMPEXP_FWD_CORE wxWidgetCocoaImpl; + +// a class which disables sending wx keydown events useful when adding text programmatically, for wx-internal use only +class wxWidgetCocoaNativeKeyDownSuspender +{ +public: + // stops sending keydown events for text inserted into this widget + explicit wxWidgetCocoaNativeKeyDownSuspender(wxWidgetCocoaImpl *target); + + // resumes sending keydown events + ~wxWidgetCocoaNativeKeyDownSuspender(); + +private: + wxWidgetCocoaImpl *m_target; + NSEvent* m_nsevent; + bool m_wxsent; + + wxDECLARE_NO_COPY_CLASS(wxWidgetCocoaNativeKeyDownSuspender); +}; + +class WXDLLIMPEXP_CORE wxWidgetCocoaImpl : public wxWidgetImpl +{ +public : + wxWidgetCocoaImpl( wxWindowMac* peer , WXWidget w, int flags = 0 ) ; + wxWidgetCocoaImpl() ; + ~wxWidgetCocoaImpl(); + + void Init(); + + virtual bool IsVisible() const wxOVERRIDE; + virtual void SetVisibility(bool) wxOVERRIDE; + + // we provide a static function which can be reused from + // wxNonOwnedWindowCocoaImpl too + static bool ShowViewOrWindowWithEffect(wxWindow *win, + bool show, + wxShowEffect effect, + unsigned timeout); + + virtual bool ShowWithEffect(bool show, + wxShowEffect effect, + unsigned timeout) wxOVERRIDE; + + virtual void Raise() wxOVERRIDE; + + virtual void Lower() wxOVERRIDE; + + virtual void ScrollRect( const wxRect *rect, int dx, int dy ) wxOVERRIDE; + + virtual WXWidget GetWXWidget() const wxOVERRIDE { return m_osxView; } + + virtual void SetBackgroundColour(const wxColour&) wxOVERRIDE; + virtual bool SetBackgroundStyle(wxBackgroundStyle style) wxOVERRIDE; + virtual void SetForegroundColour(const wxColour& col) wxOVERRIDE; + + virtual void GetContentArea( int &left, int &top, int &width, int &height ) const wxOVERRIDE; + virtual void Move(int x, int y, int width, int height) wxOVERRIDE; + virtual void GetPosition( int &x, int &y ) const wxOVERRIDE; + virtual void GetSize( int &width, int &height ) const wxOVERRIDE; + virtual void SetControlSize( wxWindowVariant variant ) wxOVERRIDE; + virtual void GetLayoutInset(int &left , int &top , int &right, int &bottom) const wxOVERRIDE; + virtual void SetNeedsDisplay( const wxRect* where = NULL ) wxOVERRIDE; + virtual bool GetNeedsDisplay() const wxOVERRIDE; + + virtual void EnableFocusRing(bool enabled) wxOVERRIDE; + + virtual void SetDrawingEnabled(bool enabled) wxOVERRIDE; + + virtual bool CanFocus() const wxOVERRIDE; + // return true if successful + virtual bool SetFocus() wxOVERRIDE; + virtual bool HasFocus() const wxOVERRIDE; + + void RemoveFromParent() wxOVERRIDE; + void Embed( wxWidgetImpl *parent ) wxOVERRIDE; + + void SetDefaultButton( bool isDefault ) wxOVERRIDE; + void PerformClick() wxOVERRIDE; + virtual void SetLabel(const wxString& title, wxFontEncoding encoding) wxOVERRIDE; + + void SetCursor( const wxCursor & cursor ) wxOVERRIDE; + void CaptureMouse() wxOVERRIDE; + void ReleaseMouse() wxOVERRIDE; +#if wxUSE_DRAG_AND_DROP + void SetDropTarget(wxDropTarget* target) wxOVERRIDE; +#endif + wxInt32 GetValue() const wxOVERRIDE; + void SetValue( wxInt32 v ) wxOVERRIDE; + wxBitmap GetBitmap() const wxOVERRIDE; + void SetBitmap( const wxBitmapBundle& bitmap ) wxOVERRIDE; + void SetBitmapPosition( wxDirection dir ) wxOVERRIDE; + void SetupTabs( const wxNotebook ¬ebook ) wxOVERRIDE; + void GetBestRect( wxRect *r ) const wxOVERRIDE; + bool IsEnabled() const wxOVERRIDE; + void Enable( bool enable ) wxOVERRIDE; + bool ButtonClickDidStateChange() wxOVERRIDE { return true; } + void SetMinimum( wxInt32 v ) wxOVERRIDE; + void SetMaximum( wxInt32 v ) wxOVERRIDE; + void SetIncrement(int value) wxOVERRIDE; + wxInt32 GetMinimum() const wxOVERRIDE; + wxInt32 GetMaximum() const wxOVERRIDE; + int GetIncrement() const wxOVERRIDE; + void PulseGauge() wxOVERRIDE; + void SetScrollThumb( wxInt32 value, wxInt32 thumbSize ) wxOVERRIDE; + + void SetFont(const wxFont & font) wxOVERRIDE; + void SetToolTip( wxToolTip* tooltip ) wxOVERRIDE; + + void InstallEventHandler( WXWidget control = NULL ) wxOVERRIDE; + bool EnableTouchEvents(int eventsMask) wxOVERRIDE; + + virtual bool ShouldHandleKeyNavigation(const wxKeyEvent &event) const; + bool DoHandleKeyNavigation(const wxKeyEvent &event); + virtual bool DoHandleMouseEvent(NSEvent *event); + virtual bool DoHandleKeyEvent(NSEvent *event); + virtual bool DoHandleCharEvent(NSEvent *event, NSString *text); + virtual void DoNotifyFocusSet(); + virtual void DoNotifyFocusLost(); + virtual void DoNotifyFocusEvent(bool receivedFocus, wxWidgetImpl* otherWindow); + + virtual void SetupKeyEvent(wxKeyEvent &wxevent, NSEvent * nsEvent, NSString* charString = NULL); + virtual void SetupMouseEvent(wxMouseEvent &wxevent, NSEvent * nsEvent); + void SetupCoordinates(wxCoord &x, wxCoord &y, NSEvent *nsEvent); + virtual bool SetupCursor(NSEvent* event); + + virtual void PanGestureEvent(NSPanGestureRecognizer *panGestureRecognizer); + virtual void ZoomGestureEvent(NSMagnificationGestureRecognizer *magnificationGestureRecognizer); + virtual void RotateGestureEvent(NSRotationGestureRecognizer *rotationGestureRecognizer); + virtual void LongPressEvent(NSPressGestureRecognizer *pressGestureRecognizer); + virtual void TouchesBegan(NSEvent *event); + virtual void TouchesMoved(NSEvent *event); + virtual void TouchesEnded(NSEvent *event); + +#if !wxOSX_USE_NATIVE_FLIPPED + void SetFlipped(bool flipped); + virtual bool IsFlipped() const { return m_isFlipped; } +#endif + + virtual double GetContentScaleFactor() const wxOVERRIDE; + + // cocoa thunk connected calls + +#if wxUSE_DRAG_AND_DROP + virtual unsigned int draggingEntered(void* sender, WXWidget slf, void* _cmd); + virtual void draggingExited(void* sender, WXWidget slf, void* _cmd); + virtual unsigned int draggingUpdated(void* sender, WXWidget slf, void* _cmd); + virtual bool performDragOperation(void* sender, WXWidget slf, void* _cmd); +#endif + virtual void mouseEvent(WX_NSEvent event, WXWidget slf, void* _cmd); + virtual void cursorUpdate(WX_NSEvent event, WXWidget slf, void* _cmd); + virtual void keyEvent(WX_NSEvent event, WXWidget slf, void* _cmd); + virtual void insertText(NSString* text, WXWidget slf, void* _cmd); + // Returns true if the event was processed by a user-defined event handler. + virtual bool doCommandBySelector(void* sel, WXWidget slf, void* _cmd); + virtual bool acceptsFirstResponder(WXWidget slf, void* _cmd); + virtual bool becomeFirstResponder(WXWidget slf, void* _cmd); + virtual bool resignFirstResponder(WXWidget slf, void* _cmd); +#if !wxOSX_USE_NATIVE_FLIPPED + virtual bool isFlipped(WXWidget slf, void* _cmd); +#endif + virtual void drawRect(void* rect, WXWidget slf, void* _cmd); + + virtual void controlAction(WXWidget slf, void* _cmd, void* sender); + virtual void controlDoubleAction(WXWidget slf, void* _cmd, void *sender); + + // for wxTextCtrl-derived classes, put here since they don't all derive + // from the same pimpl class. + virtual void controlTextDidChange(); + + virtual void AdjustClippingView(wxScrollBar* horizontal, wxScrollBar* vertical) wxOVERRIDE; + virtual void UseClippingView(bool clip) wxOVERRIDE; + virtual WXWidget GetContainer() const wxOVERRIDE { return m_osxClipView ? m_osxClipView : m_osxView; } + +protected: + WXWidget m_osxView; + WXWidget m_osxClipView; + + // begins processing of native key down event, storing the native event for later wx event generation + void BeginNativeKeyDownEvent( NSEvent* event ); + // done with the current native key down event + void EndNativeKeyDownEvent(); + // allow executing text changes without triggering key down events + + // is currently processing a native key down event + bool IsInNativeKeyDown() const; + // the native key event + NSEvent* GetLastNativeKeyDownEvent(); + // did send the wx event for the current native key down event + void SetKeyDownSent(); + // was the wx event for the current native key down event sent + bool WasKeyDownSent() const; + + + // Return the view to apply the font/colour to. + NSView* GetViewWithText() const; + + NSEvent* m_lastKeyDownEvent; + bool m_lastKeyDownWXSent; +#if !wxOSX_USE_NATIVE_FLIPPED + bool m_isFlipped; +#endif + // if it the control has an editor, that editor will already send some + // events, don't resend them + bool m_hasEditor; + + friend class wxWidgetCocoaNativeKeyDownSuspender; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxWidgetCocoaImpl); +}; + +DECLARE_WXCOCOA_OBJC_CLASS( wxNSWindow ); + +class wxNonOwnedWindowCocoaImpl : public wxNonOwnedWindowImpl +{ +public : + wxNonOwnedWindowCocoaImpl( wxNonOwnedWindow* nonownedwnd) ; + wxNonOwnedWindowCocoaImpl(); + + virtual ~wxNonOwnedWindowCocoaImpl(); + + virtual void WillBeDestroyed() wxOVERRIDE; + void Create( wxWindow* parent, const wxPoint& pos, const wxSize& size, + long style, long extraStyle, const wxString& name ) wxOVERRIDE; + void Create( wxWindow* parent, WXWindow nativeWindow ); + + WXWindow GetWXWindow() const wxOVERRIDE; + void Raise() wxOVERRIDE; + void Lower() wxOVERRIDE; + bool Show(bool show) wxOVERRIDE; + + virtual bool ShowWithEffect(bool show, + wxShowEffect effect, + unsigned timeout) wxOVERRIDE; + + void Update() wxOVERRIDE; + bool SetTransparent(wxByte alpha) wxOVERRIDE; + bool SetBackgroundColour(const wxColour& col ) wxOVERRIDE; + void SetExtraStyle( long exStyle ) wxOVERRIDE; + void SetWindowStyleFlag( long style ) wxOVERRIDE; + bool SetBackgroundStyle(wxBackgroundStyle style) wxOVERRIDE; + bool CanSetTransparent() wxOVERRIDE; + + void MoveWindow(int x, int y, int width, int height) wxOVERRIDE; + void GetPosition( int &x, int &y ) const wxOVERRIDE; + void GetSize( int &width, int &height ) const wxOVERRIDE; + + void GetContentArea( int &left, int &top, int &width, int &height ) const wxOVERRIDE; + bool SetShape(const wxRegion& region) wxOVERRIDE; + + virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) wxOVERRIDE; + + virtual wxContentProtection GetContentProtection() const wxOVERRIDE; + virtual bool SetContentProtection(wxContentProtection contentProtection) wxOVERRIDE; + + virtual bool EnableCloseButton(bool enable) wxOVERRIDE; + virtual bool EnableMaximizeButton(bool enable) wxOVERRIDE; + virtual bool EnableMinimizeButton(bool enable) wxOVERRIDE; + + virtual bool IsMaximized() const wxOVERRIDE; + + virtual bool IsIconized() const wxOVERRIDE; + + virtual void Iconize( bool iconize ) wxOVERRIDE; + + virtual void Maximize(bool maximize) wxOVERRIDE; + + virtual bool IsFullScreen() const wxOVERRIDE; + + bool EnableFullScreenView(bool enable, long style) wxOVERRIDE; + + virtual bool ShowFullScreen(bool show, long style) wxOVERRIDE; + + virtual void ShowWithoutActivating() wxOVERRIDE; + + virtual void RequestUserAttention(int flags) wxOVERRIDE; + + virtual void ScreenToWindow( int *x, int *y ) wxOVERRIDE; + + virtual void WindowToScreen( int *x, int *y ) wxOVERRIDE; + + virtual bool IsActive() wxOVERRIDE; + + virtual void SetModified(bool modified) wxOVERRIDE; + virtual bool IsModified() const wxOVERRIDE; + + virtual void SetRepresentedFilename(const wxString& filename) wxOVERRIDE; + + virtual void SetBottomBorderThickness(int thickness) wxOVERRIDE; + + wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; } + + CGWindowLevel GetWindowLevel() const wxOVERRIDE { return m_macWindowLevel; } + void RestoreWindowLevel() wxOVERRIDE; + + bool m_macIgnoreNextFullscreenChange = false; + long m_macFullscreenStyle = wxFULLSCREEN_ALL; + + static WX_NSResponder GetNextFirstResponder() ; + static WX_NSResponder GetFormerFirstResponder() ; +protected : + CGWindowLevel m_macWindowLevel; + WXWindow m_macWindow; + void * m_macFullScreenData ; + +private: + void SetUpForModalParent(); + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxNonOwnedWindowCocoaImpl); +}; + +DECLARE_WXCOCOA_OBJC_CLASS( wxNSButton ); + +class wxButtonCocoaImpl : public wxWidgetCocoaImpl, public wxButtonImpl +{ +public: + wxButtonCocoaImpl(wxWindowMac *wxpeer, wxNSButton *v); + virtual void SetBitmap(const wxBitmapBundle& bitmap) wxOVERRIDE; +#if wxUSE_MARKUP + virtual void SetLabelMarkup(const wxString& markup) wxOVERRIDE; +#endif // wxUSE_MARKUP + + void SetPressedBitmap( const wxBitmapBundle& bitmap ) wxOVERRIDE; + void SetAcceleratorFromLabel(const wxString& label); + + NSButton *GetNSButton() const; +}; + +#ifdef __OBJC__ + + typedef NSRect WXRect; + typedef void (*wxOSX_TextEventHandlerPtr)(NSView* self, SEL _cmd, NSString *event); + typedef void (*wxOSX_EventHandlerPtr)(NSView* self, SEL _cmd, NSEvent *event); + typedef BOOL (*wxOSX_PerformKeyEventHandlerPtr)(NSView* self, SEL _cmd, NSEvent *event); + typedef void (*wxOSX_DoCommandBySelectorPtr)(NSView* self, SEL _cmd, SEL _sel); + typedef BOOL (*wxOSX_FocusHandlerPtr)(NSView* self, SEL _cmd); + typedef void (*wxOSX_DoCommandBySelectorPtr)(NSView* self, SEL _cmd, SEL _sel); + typedef NSDragOperation (*wxOSX_DraggingEnteredOrUpdatedHandlerPtr)(NSView *self, SEL _cmd, void *sender); + typedef void (*wxOSX_DraggingExitedHandlerPtr)(NSView *self, SEL _cmd, void *sender); + typedef BOOL (*wxOSX_PerformDragOperationHandlerPtr)(NSView *self, SEL _cmd, void *sender); + + WXDLLIMPEXP_CORE NSScreen* wxOSXGetMenuScreen(); + WXDLLIMPEXP_CORE NSRect wxToNSRect( NSView* parent, const wxRect& r ); + WXDLLIMPEXP_CORE wxRect wxFromNSRect( NSView* parent, const NSRect& rect ); + WXDLLIMPEXP_CORE NSPoint wxToNSPoint( NSView* parent, const wxPoint& p ); + WXDLLIMPEXP_CORE wxPoint wxFromNSPoint( NSView* parent, const NSPoint& p ); + + NSRect WXDLLIMPEXP_CORE wxOSXGetFrameForControl( wxWindowMac* window , const wxPoint& pos , const wxSize &size , + bool adjustForOrigin = true ); + + WXDLLIMPEXP_CORE NSView* wxOSXGetViewFromResponder( NSResponder* responder ); + + // used for many wxControls + + @interface wxNSButton : NSButton + { + NSTrackingRectTag rectTag; + } + + @end + + @interface wxNSBox : NSBox + { + } + + @end + + @interface wxNSTextFieldEditor : NSTextView + { + NSEvent* lastKeyDownEvent; + NSTextField* textField; + } + + - (void) setTextField:(NSTextField*) field; + @end + + @interface wxNSTextField : NSTextField <NSTextFieldDelegate> + { + wxNSTextFieldEditor* fieldEditor; + } + + - (wxNSTextFieldEditor*) fieldEditor; + - (void) setFieldEditor:(wxNSTextFieldEditor*) fieldEditor; + + @end + + @interface wxNSSecureTextField : NSSecureTextField <NSTextFieldDelegate> + { + } + + @end + + + @interface wxNSTextView : NSTextView <NSTextViewDelegate> + { + } + + - (void)textDidChange:(NSNotification *)aNotification; + - (void)changeColor:(id)sender; + + @property (retain) NSUndoManager* undoManager; + + @end + + @interface wxNSSearchField : NSSearchField + { + wxNSTextFieldEditor* fieldEditor; + BOOL m_withinTextDidChange; + } + + - (wxNSTextFieldEditor*) fieldEditor; + - (void) setFieldEditor:(wxNSTextFieldEditor*) fieldEditor; + + @end + + @interface wxNSComboBox : NSComboBox + { + wxNSTextFieldEditor* fieldEditor; + } + + - (wxNSTextFieldEditor*) fieldEditor; + - (void) setFieldEditor:(wxNSTextFieldEditor*) fieldEditor; + + @end + + + + @interface wxNSMenu : NSMenu + { + wxMenuImpl* impl; + } + + - (void) setImplementation:(wxMenuImpl*) item; + - (wxMenuImpl*) implementation; + + @end + + @interface wxNSMenuItem : NSMenuItem + { + wxMenuItemImpl* impl; + } + + - (void) setImplementation:(wxMenuItemImpl*) item; + - (wxMenuItemImpl*) implementation; + + - (void)clickedAction:(id)sender; + - (BOOL)validateMenuItem:(NSMenuItem *)menuItem; + + @end + + // this enum declares which methods should not be overridden in the native view classes + enum wxOSXSkipOverrides { + wxOSXSKIP_NONE = 0x0, + wxOSXSKIP_DRAW = 0x1, + wxOSXSKIP_DND = 0x2 + }; + + void WXDLLIMPEXP_CORE wxOSXCocoaClassAddWXMethods(Class c, wxOSXSkipOverrides skipFlags = wxOSXSKIP_NONE); + + /* + We need this for ShowModal, as the sheet just disables the parent window and + returns control to the app, whereas we don't want to return from ShowModal + until the sheet has been dismissed. + */ + @interface ModalDialogDelegate : NSObject + { + BOOL sheetFinished; + int resultCode; + wxDialog* impl; + } + + - (void)setImplementation: (wxDialog *)dialog; + - (BOOL)finished; + - (int)code; + - (void)waitForSheetToFinish; + - (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo; + @end + + WXEXPORT + @interface wxNSAppController : NSObject <NSApplicationDelegate> + { + } + + @end + +#endif // __OBJC__ + +// NSCursor + +WX_NSCursor wxMacCocoaCreateStockCursor( int cursor_type ); +WX_NSCursor wxMacCocoaCreateCursorFromCGImage( CGImageRef cgImageRef, float hotSpotX, float hotSpotY ); +void wxMacCocoaSetCursor( WX_NSCursor cursor ); +void wxMacCocoaHideCursor(); +void wxMacCocoaShowCursor(); + +typedef struct tagClassicCursor +{ + wxUint16 bits[16]; + wxUint16 mask[16]; + wxInt16 hotspot[2]; +}ClassicCursor; + +const short kwxCursorBullseye = 0; +const short kwxCursorBlank = 1; +const short kwxCursorPencil = 2; +const short kwxCursorMagnifier = 3; +const short kwxCursorNoEntry = 4; +const short kwxCursorPaintBrush = 5; +const short kwxCursorPointRight = 6; +const short kwxCursorPointLeft = 7; +const short kwxCursorQuestionArrow = 8; +const short kwxCursorRightArrow = 9; +const short kwxCursorSizeNS = 10; +const short kwxCursorSize = 11; +const short kwxCursorSizeNESW = 12; +const short kwxCursorSizeNWSE = 13; +const short kwxCursorRoller = 14; +const short kwxCursorWatch = 15; +const short kwxCursorLast = kwxCursorWatch; + +// exposing our fallback cursor map + +extern ClassicCursor gMacCursors[]; + +extern NSLayoutManager* gNSLayoutManager; + +// helper class for setting the current appearance to the +// effective appearance and restore when exiting scope + +class WXDLLIMPEXP_CORE wxOSXEffectiveAppearanceSetter +{ +public: + wxOSXEffectiveAppearanceSetter(); + ~wxOSXEffectiveAppearanceSetter(); +private: + void * formerAppearance; +}; + +#endif // wxUSE_GUI + +#endif + // _WX_PRIVATE_COCOA_H_ diff --git a/lib/wxWidgets/include/wx/osx/cocoa/private/date.h b/lib/wxWidgets/include/wx/osx/cocoa/private/date.h new file mode 100644 index 0000000..e7d9d40 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/cocoa/private/date.h @@ -0,0 +1,50 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/cocoa/private/date.h +// Purpose: NSDate-related helpers +// Author: Vadim Zeitlin +// Created: 2011-12-19 +// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_COCOA_PRIVATE_DATE_H_ +#define _WX_OSX_COCOA_PRIVATE_DATE_H_ + +#include "wx/datetime.h" + +namespace wxOSXImpl +{ + +// Functions to convert between NSDate and wxDateTime. + +// Returns an NSDate corresponding to the given wxDateTime which can be invalid +// (in which case nil is returned). +inline NSDate* NSDateFromWX(const wxDateTime& dt) +{ + if ( !dt.IsValid() ) + return nil; + + // Get the internal representation as a double used by NSDate. + double ticks = dt.GetValue().ToDouble(); + + // wxDateTime uses milliseconds while NSDate uses (fractional) seconds. + return [NSDate dateWithTimeIntervalSince1970:ticks/1000.]; +} + + +// Returns wxDateTime corresponding to the given NSDate (which may be nil). +inline wxDateTime NSDateToWX(const NSDate* d) +{ + if ( !d ) + return wxDefaultDateTime; + + // Reverse everything done above. + wxLongLong ll; + ll.Assign([d timeIntervalSince1970]*1000); + wxDateTime dt(ll); + return dt; +} + +} // namespace wxOSXImpl + +#endif // _WX_OSX_COCOA_PRIVATE_DATE_H_ diff --git a/lib/wxWidgets/include/wx/osx/cocoa/private/markuptoattr.h b/lib/wxWidgets/include/wx/osx/cocoa/private/markuptoattr.h new file mode 100644 index 0000000..2a50707 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/cocoa/private/markuptoattr.h @@ -0,0 +1,181 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/cocoa/private/markuptoattr.h +// Purpose: Class to convert markup to Cocoa attributed strings. +// Author: Vadim Zeitlin +// Created: 2011-02-22 +// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_COCOA_PRIVATE_MARKUPTOATTR_H_ +#define _WX_OSX_COCOA_PRIVATE_MARKUPTOATTR_H_ + +#include "wx/private/markupparserattr.h" + +// ---------------------------------------------------------------------------- +// wxMarkupToAttrString: create NSAttributedString from markup. +// ---------------------------------------------------------------------------- + +class wxMarkupToAttrStringBase : public wxMarkupParserAttrOutput +{ +protected: + // We don't care about the original colours because we never use them but + // we do need the correct initial font as we apply modifiers (e.g. create a + // font larger than it) to it and so it must be valid. + wxMarkupToAttrStringBase(const wxFont& font) + : wxMarkupParserAttrOutput(font, wxColour(), wxColour()), + m_attrString(NULL) + {} + + void Parse(const wxFont& font, const wxString& markup) + { + const wxCFStringRef label(PrepareText(wxMarkupParser::Strip(markup))); + m_attrString = [[NSMutableAttributedString alloc] + initWithString: label.AsNSString()]; + + m_pos = 0; + + [m_attrString beginEditing]; + + // First thing we do is change the default string font: as mentioned in + // Apple documentation, attributed strings use "Helvetica 12" font by + // default which is different from the system "Lucida Grande" font. So + // we need to explicitly change the font for the entire string. + ApplyFont(font, NSMakeRange(0, [m_attrString length])); + + // Now translate the markup tags to corresponding attributes. + wxMarkupParser parser(*this); + parser.Parse(markup); + + [m_attrString endEditing]; + } + + ~wxMarkupToAttrStringBase() + { + if ( m_attrString ) + [m_attrString release]; + } + + void ApplyFont(const wxFont& font, const NSRange& range) + { + [m_attrString addAttribute:NSFontAttributeName + value:font.OSXGetNSFont() + range:range]; + + if ( font.GetStrikethrough() ) + { + [m_attrString addAttribute:NSStrikethroughStyleAttributeName + value:@(NSUnderlineStyleSingle) + range:range]; + } + + if ( font.GetUnderlined() ) + { + [m_attrString addAttribute:NSUnderlineStyleAttributeName + value:@(NSUnderlineStyleSingle) + range:range]; + } + } + + // prepare text chunk for display, e.g. strip mnemonics from it + virtual wxString PrepareText(const wxString& text) = 0; + +public: + // Accessor for the users of this class. + // + // We keep ownership of the returned string. + NSMutableAttributedString *GetNSAttributedString() const + { + return m_attrString; + } + + + // Implement base class pure virtual methods to process markup tags. + virtual void OnText(const wxString& text) + { + m_pos += PrepareText(text).length(); + } + + virtual void OnAttrStart(const Attr& WXUNUSED(attr)) + { + // Just remember the starting position of the range, we can't really + // set the attribute until we find the end of it. + m_rangeStarts.push(m_pos); + } + + virtual void OnAttrEnd(const Attr& attr) + { + unsigned start = m_rangeStarts.top(); + m_rangeStarts.pop(); + + const NSRange range = NSMakeRange(start, m_pos - start); + + ApplyFont(attr.font, range); + + if ( attr.foreground.IsOk() ) + { + [m_attrString addAttribute:NSForegroundColorAttributeName + value:attr.foreground.OSXGetNSColor() + range:range]; + } + + if ( attr.background.IsOk() ) + { + [m_attrString addAttribute:NSBackgroundColorAttributeName + value:attr.background.OSXGetNSColor() + range:range]; + } + } + +private: + // The attributed string we're building. + NSMutableAttributedString *m_attrString; + + // The current position in the output string. + unsigned m_pos; + + // The positions of starting ranges. + wxStack<unsigned> m_rangeStarts; +}; + + +// for use with labels with mnemonics +class wxMarkupToAttrString : public wxMarkupToAttrStringBase +{ +public: + wxMarkupToAttrString(const wxFont& font, const wxString& markup) + : wxMarkupToAttrStringBase(font) + { + Parse(font, markup); + } + +protected: + virtual wxString PrepareText(const wxString& text) + { + return wxControl::RemoveMnemonics(text); + } + + wxDECLARE_NO_COPY_CLASS(wxMarkupToAttrString); +}; + + +// for raw markup with no mnemonics +class wxItemMarkupToAttrString : public wxMarkupToAttrStringBase +{ +public: + wxItemMarkupToAttrString(const wxFont& font, const wxString& markup) + : wxMarkupToAttrStringBase(font) + { + Parse(font, markup); + } + +protected: + virtual wxString PrepareText(const wxString& text) + { + return text; + } + + wxDECLARE_NO_COPY_CLASS(wxItemMarkupToAttrString); +}; + +#endif // _WX_OSX_COCOA_PRIVATE_MARKUPTOATTR_H_ diff --git a/lib/wxWidgets/include/wx/osx/cocoa/private/textimpl.h b/lib/wxWidgets/include/wx/osx/cocoa/private/textimpl.h new file mode 100644 index 0000000..a278375 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/cocoa/private/textimpl.h @@ -0,0 +1,194 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/cocoa/private/textimpl.h +// Purpose: textcontrol implementation classes that have to be exposed +// Author: Stefan Csomor +// Modified by: +// Created: 03/02/99 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_ +#define _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_ + +#include "wx/combobox.h" +#include "wx/osx/private.h" + +@class wxTextEntryFormatter; + +class wxNSTextBase : public wxWidgetCocoaImpl, public wxTextWidgetImpl +{ +public : + wxNSTextBase( wxTextCtrl *text, WXWidget w ) + : wxWidgetCocoaImpl(text, w), + wxTextWidgetImpl(text) + { + } + wxNSTextBase( wxWindow *wxPeer, wxTextEntry *entry, WXWidget w ) + : wxWidgetCocoaImpl(wxPeer, w), + wxTextWidgetImpl(entry) + { + } + virtual ~wxNSTextBase() { } + + virtual bool ShouldHandleKeyNavigation(const wxKeyEvent &event) const wxOVERRIDE; + + virtual void SetInitialLabel(const wxString& WXUNUSED(title), wxFontEncoding WXUNUSED(encoding)) wxOVERRIDE + { + // Don't do anything here, text controls don't have any label and + // setting it would overwrite the string value set when creating it. + } +}; + +// implementation exposed, so that search control can pull it + +class wxNSTextFieldControl : public wxNSTextBase +{ +public : + // wxNSTextFieldControl must always be associated with a wxTextEntry. If + // it's associated with a wxTextCtrl then we can get the associated entry + // from it but otherwise the second ctor should be used to explicitly pass + // us the entry. + wxNSTextFieldControl( wxTextCtrl *text, WXWidget w ); + wxNSTextFieldControl( wxWindow *wxPeer, wxTextEntry *entry, WXWidget w ); + virtual ~wxNSTextFieldControl(); + + virtual bool CanClipMaxLength() const wxOVERRIDE { return true; } + virtual void SetMaxLength(unsigned long len) wxOVERRIDE; + + virtual bool CanForceUpper() wxOVERRIDE { return true; } + virtual void ForceUpper() wxOVERRIDE; + + virtual wxString GetStringValue() const wxOVERRIDE ; + virtual void SetStringValue( const wxString &str) wxOVERRIDE ; + virtual void Copy() wxOVERRIDE ; + virtual void Cut() wxOVERRIDE ; + virtual void Paste() wxOVERRIDE ; + virtual bool CanPaste() const wxOVERRIDE ; + virtual void SetEditable(bool editable) wxOVERRIDE ; + virtual long GetLastPosition() const wxOVERRIDE; + virtual void GetSelection( long* from, long* to) const wxOVERRIDE ; + virtual void SetSelection( long from , long to ) wxOVERRIDE; + virtual bool PositionToXY(long pos, long *x, long *y) const wxOVERRIDE; + virtual long XYToPosition(long x, long y) const wxOVERRIDE; + virtual void ShowPosition(long pos) wxOVERRIDE; + virtual void WriteText(const wxString& str) wxOVERRIDE ; + virtual bool HasOwnContextMenu() const wxOVERRIDE { return true; } + virtual bool SetHint(const wxString& hint) wxOVERRIDE; + virtual void SetJustification() wxOVERRIDE; + + virtual void controlAction(WXWidget slf, void* _cmd, void *sender) wxOVERRIDE; + virtual bool becomeFirstResponder(WXWidget slf, void *_cmd) wxOVERRIDE; + virtual bool resignFirstResponder(WXWidget slf, void *_cmd) wxOVERRIDE; + + virtual void EnableNewLineReplacement(bool enable) wxOVERRIDE; + virtual bool GetNewLineReplacement() wxOVERRIDE; + virtual void SetInternalSelection( long from , long to ); + virtual void UpdateInternalSelectionFromEditor( wxNSTextFieldEditor* editor); + + virtual wxSize GetBestSize() const wxOVERRIDE; + +protected : + NSTextField* m_textField; + long m_selStart; + long m_selEnd; + +private: + // Common part of both ctors. + void Init(WXWidget w); + + // Get our formatter, creating it if necessary. + wxTextEntryFormatter* GetFormatter(); +}; + +class wxNSTextViewControl : public wxNSTextBase +{ +public: + wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w, long style ); + virtual ~wxNSTextViewControl(); + + virtual void insertText(NSString* text, WXWidget slf, void *_cmd) wxOVERRIDE; + + virtual wxString GetStringValue() const wxOVERRIDE ; + virtual void SetStringValue( const wxString &str) wxOVERRIDE ; + virtual void Copy() wxOVERRIDE ; + virtual void Cut() wxOVERRIDE ; + virtual void Paste() wxOVERRIDE ; + virtual bool CanPaste() const wxOVERRIDE ; + virtual void SetEditable(bool editable) wxOVERRIDE ; + virtual long GetLastPosition() const wxOVERRIDE; + virtual void GetSelection( long* from, long* to) const wxOVERRIDE ; + virtual void SetSelection( long from , long to ) wxOVERRIDE; + virtual bool PositionToXY(long pos, long *x, long *y) const wxOVERRIDE; + virtual long XYToPosition(long x, long y) const wxOVERRIDE; + virtual void ShowPosition(long pos) wxOVERRIDE; + virtual void WriteText(const wxString& str) wxOVERRIDE ; + virtual void SetFont(const wxFont & font) wxOVERRIDE; + + virtual bool GetStyle(long position, wxTextAttr& style) wxOVERRIDE; + virtual void SetStyle(long start, long end, const wxTextAttr& style) wxOVERRIDE; + + virtual bool CanFocus() const wxOVERRIDE; + + virtual bool HasOwnContextMenu() const wxOVERRIDE { return true; } + +#if wxUSE_SPELLCHECK + virtual void CheckSpelling(const wxTextProofOptions& options) wxOVERRIDE; + virtual wxTextProofOptions GetCheckingOptions() const wxOVERRIDE; +#endif // wxUSE_SPELLCHECK + virtual void EnableAutomaticQuoteSubstitution(bool enable) wxOVERRIDE; + virtual void EnableAutomaticDashSubstitution(bool enable) wxOVERRIDE; + virtual void EnableNewLineReplacement(bool enable) wxOVERRIDE; + virtual bool GetNewLineReplacement() wxOVERRIDE; + + virtual wxSize GetBestSize() const wxOVERRIDE; + virtual void SetJustification() wxOVERRIDE; + + virtual void controlTextDidChange() wxOVERRIDE; + + virtual bool CanUndo() const wxOVERRIDE; + virtual void Undo() wxOVERRIDE; + virtual bool CanRedo() const wxOVERRIDE; + virtual void Redo() wxOVERRIDE; + virtual void EmptyUndoBuffer() wxOVERRIDE; + +protected: + void DoUpdateTextStyle(); + + NSScrollView* m_scrollView; + NSTextView* m_textView; + bool m_useCharWrapping; + NSUndoManager* m_undoManager; +}; + +class wxNSComboBoxControl : public wxNSTextFieldControl, public wxComboWidgetImpl +{ +public : + wxNSComboBoxControl( wxComboBox *wxPeer, WXWidget w ); + virtual ~wxNSComboBoxControl(); + + virtual int GetSelectedItem() const; + virtual void SetSelectedItem(int item); + + virtual int GetNumberOfItems() const; + + virtual void InsertItem(int pos, const wxString& item); + virtual void RemoveItem(int pos); + + virtual void Clear(); + + virtual wxString GetStringAtIndex(int pos) const; + + virtual int FindString(const wxString& text) const; + virtual void Popup(); + virtual void Dismiss(); + + virtual void SetEditable(bool editable); + + virtual void mouseEvent(WX_NSEvent event, WXWidget slf, void *_cmd); + +private: + NSComboBox* m_comboBox; +}; + +#endif // _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_ diff --git a/lib/wxWidgets/include/wx/osx/cocoa/stdpaths.h b/lib/wxWidgets/include/wx/osx/cocoa/stdpaths.h new file mode 100644 index 0000000..1500c88 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/cocoa/stdpaths.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/cocoa/stdpaths.h +// Purpose: wxStandardPaths for Cocoa +// Author: Tobias Taschner +// Created: 2015-09-09 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COCOA_STDPATHS_H_ +#define _WX_COCOA_STDPATHS_H_ + +// ---------------------------------------------------------------------------- +// wxStandardPaths +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStandardPaths : public wxStandardPathsBase +{ +public: + virtual ~wxStandardPaths(); + + // implement base class pure virtuals + virtual wxString GetExecutablePath() const wxOVERRIDE; + virtual wxString GetConfigDir() const wxOVERRIDE; + virtual wxString GetUserConfigDir() const wxOVERRIDE; + virtual wxString GetDataDir() const wxOVERRIDE; + virtual wxString GetLocalDataDir() const wxOVERRIDE; + virtual wxString GetUserDataDir() const wxOVERRIDE; + virtual wxString GetPluginsDir() const wxOVERRIDE; + virtual wxString GetResourcesDir() const wxOVERRIDE; + virtual wxString + GetLocalizedResourcesDir(const wxString& lang, + ResourceCat category = ResourceCat_None) const wxOVERRIDE; + virtual wxString GetUserDir(Dir userDir) const wxOVERRIDE; + virtual wxString MakeConfigFileName(const wxString& basename, + ConfigFileConv conv = ConfigFileConv_Ext + ) const wxOVERRIDE; + +protected: + // Ctor is protected, use wxStandardPaths::Get() instead of instantiating + // objects of this class directly. + wxStandardPaths(); +}; + + +#endif // _WX_COCOA_STDPATHS_H_ diff --git a/lib/wxWidgets/include/wx/osx/colordlg.h b/lib/wxWidgets/include/wx/osx/colordlg.h new file mode 100644 index 0000000..978a1ac --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/colordlg.h @@ -0,0 +1,39 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/colordlg.h +// Purpose: wxColourDialog class. Use generic version if no +// platform-specific implementation. +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COLORDLG_H_ +#define _WX_COLORDLG_H_ + +#include "wx/dialog.h" + +/* + * Platform-specific colour dialog implementation + */ + +class WXDLLIMPEXP_CORE wxColourDialog: public wxDialog +{ + wxDECLARE_DYNAMIC_CLASS(wxColourDialog); +public: + wxColourDialog(); + wxColourDialog(wxWindow *parent, const wxColourData *data = NULL); + + bool Create(wxWindow *parent, const wxColourData *data = NULL); + + int ShowModal() wxOVERRIDE; + wxColourData& GetColourData() { return m_colourData; } + +protected: + wxColourData m_colourData; + wxWindow* m_dialogParent; +}; + +#endif + // _WX_COLORDLG_H_ diff --git a/lib/wxWidgets/include/wx/osx/colour.h b/lib/wxWidgets/include/wx/osx/colour.h new file mode 100644 index 0000000..4086254 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/colour.h @@ -0,0 +1 @@ +#include "wx/osx/core/colour.h" diff --git a/lib/wxWidgets/include/wx/osx/combobox.h b/lib/wxWidgets/include/wx/osx/combobox.h new file mode 100644 index 0000000..7ee424f --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/combobox.h @@ -0,0 +1,149 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/combobox.h +// Purpose: wxComboBox class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COMBOBOX_H_ +#define _WX_COMBOBOX_H_ + +#include "wx/containr.h" +#include "wx/choice.h" +#include "wx/textctrl.h" + +WX_DEFINE_ARRAY( char * , wxComboBoxDataArray ) ; + +// forward declaration of private implementation classes + +class wxComboBoxText; +class wxComboBoxChoice; +class wxComboWidgetImpl; + +// Combobox item +class WXDLLIMPEXP_CORE wxComboBox : + public wxWindowWithItems< + wxControl, + wxComboBoxBase> +{ + wxDECLARE_DYNAMIC_CLASS(wxComboBox); + + public: + virtual ~wxComboBox(); + + // callback functions + virtual void DelegateTextChanged( const wxString& value ); + virtual void DelegateChoice( const wxString& value ); + + wxComboBox() { } + + wxComboBox(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)) + { + Create(parent, id, value, pos, size, n, choices, style, validator, name); + } + + wxComboBox(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)) + { + Create(parent, id, value, pos, size, choices, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)); + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)); + + virtual int GetSelection() const wxOVERRIDE; + virtual void GetSelection(long *from, long *to) const wxOVERRIDE; + virtual void SetSelection(int n) wxOVERRIDE; + virtual void SetSelection(long from, long to) wxOVERRIDE; + virtual int FindString(const wxString& s, bool bCase = false) const wxOVERRIDE; + virtual wxString GetString(unsigned int n) const wxOVERRIDE; + virtual wxString GetStringSelection() const wxOVERRIDE; + virtual void SetString(unsigned int n, const wxString& s) wxOVERRIDE; + + virtual unsigned int GetCount() const wxOVERRIDE; + + virtual void SetValue(const wxString& value) wxOVERRIDE; +// these methods are provided by wxTextEntry for the native impl. + +#if wxOSX_USE_COCOA + virtual void Popup() wxOVERRIDE; + virtual void Dismiss() wxOVERRIDE; +#endif // wxOSX_USE_COCOA + + + virtual const wxTextEntry* WXGetTextEntry() const wxOVERRIDE { return this; } + + // osx specific event handling common for all osx-ports + + virtual bool OSXHandleClicked(double timestampsec) wxOVERRIDE; + +#if wxOSX_USE_COCOA + wxComboWidgetImpl* GetComboPeer() const; +#endif +protected: + // List functions + virtual void DoDeleteOneItem(unsigned int n) wxOVERRIDE; + virtual void DoClear() wxOVERRIDE; + + // wxTextEntry functions + virtual wxWindow *GetEditableWindow() wxOVERRIDE { return this; } + + // override the base class virtuals involved in geometry calculations + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + virtual int DoInsertItems(const wxArrayStringsAdapter& items, + unsigned int pos, + void **clientData, wxClientDataType type) wxOVERRIDE; + + virtual void DoSetItemClientData(unsigned int n, void* clientData) wxOVERRIDE; + virtual void * DoGetItemClientData(unsigned int n) const wxOVERRIDE; + + + virtual void EnableTextChangedEvents(bool enable) wxOVERRIDE; + + // callbacks + void OnChar(wxKeyEvent& event); // Process 'enter' if required + void OnKeyDown(wxKeyEvent& event); // Process clipboard shortcuts + + // the subcontrols + wxComboBoxText* m_text; + wxComboBoxChoice* m_choice; + + wxComboBoxDataArray m_datas; + +private: + wxDECLARE_EVENT_TABLE(); +}; + +#endif // _WX_COMBOBOX_H_ diff --git a/lib/wxWidgets/include/wx/osx/config_xcode.h b/lib/wxWidgets/include/wx/osx/config_xcode.h new file mode 100644 index 0000000..90324bf --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/config_xcode.h @@ -0,0 +1,146 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/config_xcode.h +// Purpose: configurations for xcode builds +// Author: Stefan Csomor +// Modified by: +// Created: 29.04.04 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// from config.log confdefs + +#define HAVE_SSIZE_T 1 +#define STDC_HEADERS 1 +#ifdef __BIG_ENDIAN__ +#define WORDS_BIGENDIAN 1 +#endif +#define wxUSE_UNIX 1 +#define __UNIX__ 1 +#define __BSD__ 1 +#define __DARWIN__ 1 +#define wx_USE_NANOX 0 + +#define HAVE_VA_COPY 1 +#define HAVE_STD_WSTRING 1 +#if __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 2 ) + #if !defined(__has_include) + #define HAVE_TR1_UNORDERED_MAP 1 + #define HAVE_TR1_UNORDERED_SET 1 + #define HAVE_TR1_TYPE_TRAITS 1 + #endif + #define HAVE_GCC_ATOMIC_BUILTINS 1 +#endif +#define HAVE_VISIBILITY 1 +#define wxHAVE_PTHREAD_CLEANUP 1 +#define CONST_COMPATIBILITY 0 +#define WX_TIMEZONE timezone +#define WX_SOCKLEN_T socklen_t +#define SOCKOPTLEN_T socklen_t +#define WX_STATFS_T struct statfs +#define wxTYPE_SA_HANDLER int +#define WX_GMTOFF_IN_TM 1 +#define HAVE_PW_GECOS 1 +#define HAVE_DLOPEN 1 +#define HAVE_CXA_DEMANGLE 1 +#define HAVE_GETTIMEOFDAY 1 +#define HAVE_FSYNC 1 +#define HAVE_ROUND 1 +#define HAVE_SCHED_YIELD 1 +#define HAVE_PTHREAD_MUTEXATTR_T 1 +#define HAVE_PTHREAD_MUTEXATTR_SETTYPE_DECL 1 +#define HAVE_PTHREAD_CANCEL 1 +#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 +#define HAVE_SNPRINTF 1 +#define HAVE_UNIX98_PRINTF 1 +#define HAVE_STATFS 1 +#define HAVE_STATFS_DECL 1 +#define HAVE_STRNLEN 1 +#define HAVE_STRPTIME 1 +#define HAVE_STRPTIME_DECL 1 +#define HAVE_STRTOULL 1 +#define HAVE_THREAD_PRIORITY_FUNCTIONS 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_VSSCANF 1 +#define HAVE_USLEEP 1 +#define HAVE_WCSCASECMP 1 +#define HAVE_WCSDUP 1 +#define HAVE_WCSLEN 1 +#define HAVE_WCSNCASECMP 1 +#define HAVE_WCSNLEN 1 +#define SIZEOF_WCHAR_T 4 +#define SIZEOF_SHORT 2 +#define SIZEOF_INT 4 +#ifdef __LP64__ +#define SIZEOF_VOID_P 8 +#define SIZEOF_LONG 8 +#define SIZEOF_SIZE_T 8 +#else +#define SIZEOF_VOID_P 4 +#define SIZEOF_LONG 4 +#define SIZEOF_SIZE_T 4 +#endif +#define SIZEOF_LONG_LONG 8 +#define wxSIZE_T_IS_ULONG 1 +#define wxWCHAR_T_IS_REAL_TYPE 1 +#define HAVE_FCNTL 1 +#define HAVE_GETHOSTBYNAME 1 +#define HAVE_GETSERVBYNAME 1 +#define HAVE_GMTIME_R 1 +#define HAVE_INET_ADDR 1 +#define HAVE_INET_ATON 1 +#define HAVE_LOCALTIME_R 1 +#define HAVE_MKSTEMP 1 +#define HAVE_SETENV 1 +/* #define HAVE_PUTENV 1 */ +#define HAVE_STRTOK_R 1 +#define HAVE_UNAME 1 +#define HAVE_USLEEP 1 +#define HAVE_X11_XKBLIB_H 1 +#define HAVE_SCHED_H 1 +#define HAVE_UNISTD_H 1 +#define HAVE_WCHAR_H 1 +/* better to use the built-in CF conversions, also avoid iconv versioning problems */ +/* #undef HAVE_ICONV */ +#define ICONV_CONST +#define HAVE_LANGINFO_H 1 +#define HAVE_WCSRTOMBS 1 +#define HAVE_FPUTWS 1 +#define HAVE_WPRINTF 1 +#define HAVE_VSWPRINTF 1 +#define HAVE_VSWSCANF 1 +#define HAVE_FSEEKO 1 +#define HAVE_SYS_SELECT_H 1 +#define HAVE_FDOPEN 1 +#define HAVE_SYSCONF 1 +#define HAVE_GETPWUID_R 1 +#define HAVE_GETGRGID_R 1 +#define HAVE_LOCALE_T 1 +#define HAVE_XLOCALE_H 1 +#define wxHAS_KQUEUE 1 + +#define PACKAGE_BUGREPORT "wx-dev@googlegroups.com" +#define PACKAGE_NAME "wxWidgets" +#define PACKAGE_STRING "wxWidgets 3.2.5" +#define PACKAGE_TARNAME "wxwidgets" +#define PACKAGE_VERSION "3.2.5" + +// for jpeg + +#define HAVE_STDLIB_H 1 + +// OBSOLETE ? + +#define HAVE_COS 1 +#define HAVE_FLOOR 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_MEMORY_H 1 + +#define HAVE_REGCOMP 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_X11_XLIB_H 1 +#define SOCKLEN_T socklen_t +#define _FILE_OFFSET_BITS 64 diff --git a/lib/wxWidgets/include/wx/osx/control.h b/lib/wxWidgets/include/wx/osx/control.h new file mode 100644 index 0000000..f520dda --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/control.h @@ -0,0 +1,51 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/control.h +// Purpose: wxControl class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CONTROL_H_ +#define _WX_CONTROL_H_ + +WXDLLIMPEXP_DATA_CORE(extern const char) wxControlNameStr[]; + +// General item class +class WXDLLIMPEXP_CORE wxControl : public wxControlBase +{ + wxDECLARE_ABSTRACT_CLASS(wxControl); + +public: + wxControl(); + wxControl(wxWindow *parent, wxWindowID winid, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxControlNameStr)) + { + Create(parent, winid, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID winid, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxControlNameStr)); + + // Simulates an event + virtual void Command(wxCommandEvent& event) wxOVERRIDE { ProcessCommand(event); } + + // implementation from now on + // -------------------------- + + // Calls the callback and appropriate event handlers + bool ProcessCommand(wxCommandEvent& event); + + void OnKeyDown( wxKeyEvent &event ) ; +}; + +#endif + // _WX_CONTROL_H_ diff --git a/lib/wxWidgets/include/wx/osx/core/cfarray.h b/lib/wxWidgets/include/wx/osx/core/cfarray.h new file mode 100644 index 0000000..2a5e215 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/core/cfarray.h @@ -0,0 +1,109 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/core/cfarrayref.h +// Purpose: wxCFArrayRef class +// Author: Stefan Csomor +// Modified by: +// Created: 2018/07/27 +// Copyright: (c) 2018 Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// +/*! @header wx/osx/core/cfarrayref.h + @abstract wxCFArrayRef class + */ + +#ifndef _WX_OSX_COREFOUNDATION_CFARRAYREF_H__ +#define _WX_OSX_COREFOUNDATION_CFARRAYREF_H__ + +#include "wx/osx/core/cfref.h" +#include "wx/osx/core/cftype.h" + +#include <CoreFoundation/CFArray.h> + +template <typename T, typename E> +class wxCFArrayRefCommon : public wxCFRef<T> +{ +public: + typedef wxCFRef<T> super_type; + typedef size_t size_type; + + wxCFArrayRefCommon(T r) + : super_type(r) + { + } + + wxCFArrayRefCommon(const wxCFArrayRefCommon& otherRef) + : super_type(otherRef) + { + } + + size_type size() const + { + return (size_type)CFArrayGetCount(this->m_ptr); + } + + bool empty() const + { + return size() == 0; + } + + wxCFRef<E> at(size_type idx) + { + wxASSERT(idx < size()); + + return wxCFRefFromGet((E)CFArrayGetValueAtIndex(this->m_ptr, idx)); + } + + operator WX_NSArray() { return (WX_NSArray) this->get(); } + + wxCFRef<E> operator[](size_type idx) { return at(idx); } + wxCFRef<E> front() { return at(0); } + wxCFRef<E> back() { return at(size() - 1); } +}; + + +template <typename E> +class wxCFArrayRef : public wxCFArrayRefCommon<CFArrayRef, E> +{ +public: + wxCFArrayRef(CFArrayRef r) + : wxCFArrayRefCommon<CFArrayRef, E>(r) + { + } + + wxCFArrayRef(const wxCFArrayRef& otherRef) + : wxCFArrayRefCommon<CFArrayRef, E>(otherRef) + { + } +}; + +template <typename E> +class wxCFMutableArrayRef : public wxCFArrayRefCommon<CFMutableArrayRef, E> +{ +public: + wxCFMutableArrayRef() + : wxCFArrayRefCommon<CFMutableArrayRef, E>(CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks)) + { + } + + wxCFMutableArrayRef(CFMutableArrayRef r) + : wxCFArrayRefCommon<CFMutableArrayRef, E>(r) + { + } + + wxCFMutableArrayRef(const wxCFMutableArrayRef& otherRef) + : wxCFArrayRefCommon<CFMutableArrayRef, E>(otherRef) + { + } + + void push_back(E v) + { + CFArrayAppendValue(this->m_ptr, v); + } + + void clear() + { + CFArrayRemoveAllValues(this->m_ptr); + } +}; + +#endif //ifndef _WX_OSX_COREFOUNDATION_CFARRAYREF_H__ diff --git a/lib/wxWidgets/include/wx/osx/core/cfdataref.h b/lib/wxWidgets/include/wx/osx/core/cfdataref.h new file mode 100644 index 0000000..8917451 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/core/cfdataref.h @@ -0,0 +1,95 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/core/cfdataref.h +// Purpose: wxCFDataRef class +// Author: Stefan Csomor +// Modified by: +// Created: 2007/05/10 +// Copyright: (c) 2007 Stefan Csomor +// Licence: wxWindows licence +// Notes: See http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFBinaryData/index.html +///////////////////////////////////////////////////////////////////////////// +/*! @header wx/osx/core/cfdataref.h + @abstract wxCFDataRef template class +*/ + +#ifndef _WX_MAC_COREFOUNDATION_CFDATAREF_H__ +#define _WX_MAC_COREFOUNDATION_CFDATAREF_H__ + +#include "wx/osx/core/cfref.h" + +#include <CoreFoundation/CFData.h> + +/*! @class wxCFDataRef + @discussion Properly retains/releases reference to CoreFoundation data objects +*/ +class wxCFDataRef : public wxCFRef< CFDataRef > +{ +public: + /*! @method wxCFDataRef + @abstract Creates a NULL data ref + */ + wxCFDataRef() + {} + + typedef wxCFRef<CFDataRef> super_type; + + /*! @method wxCFDataRef + @abstract Assumes ownership of r and creates a reference to it. + @param r The data reference to assume ownership of. May be NULL. + @discussion Like shared_ptr, it is assumed that the caller has a strong reference to r and intends + to transfer ownership of that reference to this ref holder. If the object comes from + a Create or Copy method then this is the correct behaviour. If the object comes from + a Get method then you must CFRetain it yourself before passing it to this constructor. + A handy way to do this is to use the non-member wxCFRefFromGet factory function. + This method is templated and takes an otherType *p. This prevents implicit conversion + using an operator refType() in a different ref-holding class type. + */ + explicit wxCFDataRef(CFDataRef r) + : super_type(r) + {} + + /*! @method wxCFDataRef + @abstract Copies a ref holder of the same type + @param otherRef The other ref holder to copy. + @discussion Ownership will be shared by the original ref and the newly created ref. That is, + the object will be explicitly retained by this new ref. + */ + wxCFDataRef(const wxCFDataRef& otherRef) + : super_type( otherRef ) + {} + + /*! @method wxCFDataRef + @abstract Copies raw data into a data ref + @param data The raw data. + @param length The data length. + */ + wxCFDataRef(const UInt8* data, CFIndex length) + : super_type(CFDataCreate(kCFAllocatorDefault, data, length)) + { + } + + /*! @method GetLength + @abstract returns the length in bytes of the data stored + */ + CFIndex GetLength() const + { + if ( m_ptr ) + return CFDataGetLength( *this ); + else + return 0; + } + + /*! @method GetBytes + @abstract Copies the data into an external buffer + @param range The desired range. + @param buffer The target buffer. + */ + void GetBytes( CFRange range, UInt8 *buffer ) const + { + if ( m_ptr ) + CFDataGetBytes(m_ptr, range, buffer); + } +}; + +#endif //ifndef _WX_MAC_COREFOUNDATION_CFDATAREF_H__ + diff --git a/lib/wxWidgets/include/wx/osx/core/cfdictionary.h b/lib/wxWidgets/include/wx/osx/core/cfdictionary.h new file mode 100644 index 0000000..b516240 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/core/cfdictionary.h @@ -0,0 +1,137 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/core/cfdictionaryref.h +// Purpose: wxCFDictionaryRef class +// Author: Stefan Csomor +// Modified by: +// Created: 2018/07/27 +// Copyright: (c) 2018 Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// +/*! @header wx/osx/core/cfdictionaryref.h + @abstract wxCFDictionaryRef class + */ + +#ifndef _WX_OSX_COREFOUNDATION_CFDICTIONARYREF_H__ +#define _WX_OSX_COREFOUNDATION_CFDICTIONARYREF_H__ + +#include "wx/osx/core/cfref.h" +#include "wx/osx/core/cfstring.h" +#include "wx/osx/core/cftype.h" + +#include <CoreFoundation/CFDictionary.h> + +/*! @class wxCFDictionaryRef + @discussion Properly retains/releases reference to CoreFoundation data objects + */ +template <typename T> +class wxCFDictionaryRefCommon : public wxCFRef<T> +{ +public: + typedef wxCFRef<T> super_type; + + explicit wxCFDictionaryRefCommon() + : super_type() + { + } + + /*! @method wxCFDictionaryRef + @abstract Assumes ownership of r and creates a reference to it. + @param r The dictionary reference to assume ownership of. May be NULL. + @discussion Like shared_ptr, it is assumed that the caller has a strong reference to r and intends + to transfer ownership of that reference to this ref holder. If the object comes from + a Create or Copy method then this is the correct behaviour. If the object comes from + a Get method then you must CFRetain it yourself before passing it to this constructor. + A handy way to do this is to use the non-member wxCFRefFromGet factory function. + This method is templated and takes an otherType *p. This prevents implicit conversion + using an operator refType() in a different ref-holding class type. + */ + explicit wxCFDictionaryRefCommon(T r) + : super_type(r) + { + } + + /*! @method wxCFDictionaryRef + @abstract Copies a ref holder of the same type + @param otherRef The other ref holder to copy. + @discussion Ownership will be shared by the original ref and the newly created ref. That is, + the object will be explicitly retained by this new ref. + */ + wxCFDictionaryRefCommon(const wxCFDictionaryRefCommon&) = default; + + wxCFTypeRef GetValue(const void* key) + { + CFTypeRef val = CFDictionaryGetValue(this->m_ptr, key); + if (val) + ::CFRetain(val); + return val; + } +}; + +class wxCFMutableDictionaryRef; + +class wxCFDictionaryRef : public wxCFDictionaryRefCommon<CFDictionaryRef> +{ +public: + wxCFDictionaryRef() + { + } + + wxCFDictionaryRef(CFDictionaryRef r) + : wxCFDictionaryRefCommon(r) + { + } + + wxCFDictionaryRef& operator=(const wxCFMutableDictionaryRef& other); + + CFDictionaryRef CreateCopy() const + { + return CFDictionaryCreateCopy(kCFAllocatorDefault, this->m_ptr); + } + + CFMutableDictionaryRef CreateMutableCopy() const + { + return CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, this->m_ptr); + } +}; + +class wxCFMutableDictionaryRef : public wxCFDictionaryRefCommon<CFMutableDictionaryRef> +{ +public: + wxCFMutableDictionaryRef() + : wxCFDictionaryRefCommon(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)) + { + } + + wxCFMutableDictionaryRef(CFMutableDictionaryRef r) + : wxCFDictionaryRefCommon(r) + { + } + + void SetValue(const void* key, const void* data) + { + CFDictionarySetValue(this->m_ptr, key, data); + } + + void SetValue(const void* key, CGFloat v) + { + SetValue(key, wxCFNumberRef(v)); + } + + CFMutableDictionaryRef CreateCopy() const + { + return CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, this->m_ptr); + } + + friend class wxCFDictionaryRef; +}; + +inline wxCFDictionaryRef& wxCFDictionaryRef::operator=(const wxCFMutableDictionaryRef& otherRef) +{ + wxCFRetain(otherRef.m_ptr); + wxCFRelease(m_ptr); + m_ptr = (CFDictionaryRef)otherRef.m_ptr; + + return *this; +} + +#endif //ifndef _WX_OSX_COREFOUNDATION_CFDICTIONARYREF_H__ diff --git a/lib/wxWidgets/include/wx/osx/core/cfref.h b/lib/wxWidgets/include/wx/osx/core/cfref.h new file mode 100644 index 0000000..ab2a8b4 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/core/cfref.h @@ -0,0 +1,447 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/core/cfref.h +// Purpose: wxCFRef template class +// Author: David Elliott <dfe@cox.net> +// Modified by: Stefan Csomor +// Created: 2007/05/10 +// Copyright: (c) 2007 David Elliott <dfe@cox.net>, Stefan Csomor +// Licence: wxWindows licence +// Notes: See http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/index.html +///////////////////////////////////////////////////////////////////////////// +/*! @header wx/osx/core/cfref.h + @abstract wxCFRef template class + @discussion FIXME: Convert doc tags to something less buggy with C++ +*/ + +#ifndef _WX_MAC_COREFOUNDATION_CFREF_H__ +#define _WX_MAC_COREFOUNDATION_CFREF_H__ + +// Include unistd to ensure that NULL is defined +#include <unistd.h> +// Include Availability for __AVAILABILITY_INTERNAL_DEPRECATED +#include <Availability.h> + +#if __has_feature(objc_arc) +#define WX_OSX_BRIDGE_RETAINED __bridge_retained +#define WX_OSX_BRIDGE __bridge +#else +#define WX_OSX_BRIDGE_RETAINED +#define WX_OSX_BRIDGE +#endif + +// #include <CoreFoundation/CFBase.h> +/* Don't include CFBase.h such that this header can be included from public + * headers with minimal namespace pollution. + * Note that Darwin CF uses extern for CF_EXPORT. If we need this on Win32 + * or non-Darwin Mac OS we'll need to define the appropriate __declspec. + */ + +typedef const void *CFTypeRef; +extern "C" { +extern /* CF_EXPORT */ +CFTypeRef CFRetain(CFTypeRef cf); +extern /* CF_EXPORT */ +void CFRelease(CFTypeRef cf); +extern /* CF_EXPORT */ +CFTypeRef CFAutorelease(CFTypeRef cf); +} // extern "C" + + +/*! @function wxCFRelease + @abstract A CFRelease variant that checks for NULL before releasing. + @discussion The parameter is template not for type safety but to ensure the argument + is a raw pointer and not a ref holder of any type. +*/ +template <class Type> +inline void wxCFRelease(Type *r) +{ + if ( r != NULL ) + ::CFRelease((CFTypeRef)r); +} + +/*! @function wxCFAutorelease + @abstract A CFAutorelease variant that checks for NULL before releasing. + @discussion The parameter is template not for type safety but to ensure the argument + is a raw pointer and not a ref holder of any type. +*/ +template <class Type> +inline Type* wxCFAutorelease(Type *r) +{ + if ( r != NULL ) + r = const_cast<Type*>(static_cast<const Type*>(::CFAutorelease(static_cast<CFTypeRef>(r)))); + return r; +} + +/*! @function wxCFRetain + @abstract A typesafe CFRetain variant that checks for NULL. +*/ +template <class Type> +inline Type* wxCFRetain(Type *r) +{ + // NOTE(DE): Setting r to the result of CFRetain improves efficiency on both x86 and PPC + // Casting r to CFTypeRef ensures we are calling the real C version defined in CFBase.h + // and not any possibly templated/overloaded CFRetain. + if ( r != NULL ) + r = const_cast<Type*>(static_cast<const Type*>(::CFRetain(static_cast<CFTypeRef>(r)))); + return r; +} + +template <class refType> +class wxCFRef; + +/*! @class wxCFWeakRef + @templatefield refType The CF reference type (e.g. CFStringRef, CFRunLoopRef, etc.) + It should already be a pointer. This is different from + shared_ptr where the template parameter is the pointee type. + @discussion Wraps a raw pointer without any retain or release. + Provides a way to get what amounts to a raw pointer from a wxCFRef without + using a raw pointer. Unlike a raw pointer, constructing a wxCFRef from this + class will cause it to be retained because it is assumed that a wxCFWeakRef + does not own its pointer. +*/ +template <class refType> +class wxCFWeakRef +{ + template <class refTypeA, class otherRefType> + friend wxCFWeakRef<refTypeA> static_cfref_cast(const wxCFRef<otherRefType> &otherRef); +public: + /*! @method wxCFWeakRef + @abstract Creates a NULL reference + */ + wxCFWeakRef() + : m_ptr(NULL) + {} + + // Default copy constructor is fine. + // Default destructor is fine but we'll set NULL to avoid bugs + ~wxCFWeakRef() + { m_ptr = NULL; } + + // Do not implement a raw-pointer constructor. + + /*! @method wxCFWeakRef + @abstract Copies another ref holder where its type can be converted to ours + @templatefield otherRefType Any type held by another wxCFWeakRef. + @param otherRef The other weak ref holder to copy. + @discussion This is merely a copy or implicit cast. + */ + template <class otherRefType> + wxCFWeakRef(const wxCFWeakRef<otherRefType>& otherRef) + : m_ptr(otherRef.get()) // Implicit conversion from otherRefType to refType should occur + {} + + /*! @method wxCFWeakRef + @abstract Copies a strong ref holder where its type can be converted to ours + @templatefield otherRefType Any type held by a wxCFRef. + @param otherRef The strong ref holder to copy. + @discussion This ref is merely a pointer copy, the strong ref still holds the pointer. + */ + template <class otherRefType> + wxCFWeakRef(const wxCFRef<otherRefType>& otherRef) + : m_ptr(otherRef.get()) // Implicit conversion from otherRefType to refType should occur + {} + + /*! @method get + @abstract Explicit conversion to the underlying pointer type + @discussion Allows the caller to explicitly get the underlying pointer. + */ + refType get() const + { return m_ptr; } + + /*! @method operator refType + @abstract Implicit conversion to the underlying pointer type + @discussion Allows the ref to be used in CF function calls. + */ + operator refType() const + { return m_ptr; } + +protected: + /*! @method wxCFWeakRef + @abstract Constructs a weak reference to the raw pointer + @templatefield otherType Any type. + @param p The raw pointer to assume ownership of. May be NULL. + @discussion This method is private so that the friend static_cfref_cast can use it + */ + template <class otherType> + explicit wxCFWeakRef(otherType *p) + : m_ptr(p) // Implicit conversion from otherType* to refType should occur. + {} + + /*! @var m_ptr The raw pointer. + */ + refType m_ptr; +}; + +/*! @class wxCFRef + @templatefield refType The CF reference type (e.g. CFStringRef, CFRunLoopRef, etc.) + It should already be a pointer. This is different from + shared_ptr where the template parameter is the pointee type. + @discussion Properly retains/releases reference to CoreFoundation objects +*/ +template <class refType> +class wxCFRef +{ +public: + /*! @method wxCFRef + @abstract Creates a NULL reference + */ + wxCFRef() + : m_ptr(NULL) + {} + + /*! @method wxCFRef + @abstract Assumes ownership of p and creates a reference to it. + @param p The raw core foundation reference to assume ownership of. May be NULL. + @discussion Like shared_ptr, it is assumed that the caller has a strong reference to p and intends + to transfer ownership of that reference to this ref holder. If the object comes from + a Create or Copy method then this is the correct behaviour. If the object comes from + a Get method then you must CFRetain it yourself before passing it to this constructor. + A handy way to do this is to use the non-member wxCFRefFromGet factory function. + */ + wxCFRef(refType p) : m_ptr(p) + { + + } + /*! @method wxCFRef + @abstract Assumes ownership of p and creates a reference to it. + @templatefield otherType Any type. + @param p The raw pointer to assume ownership of. May be NULL. + @discussion Like shared_ptr, it is assumed that the caller has a strong reference to p and intends + to transfer ownership of that reference to this ref holder. If the object comes from + a Create or Copy method then this is the correct behaviour. If the object comes from + a Get method then you must CFRetain it yourself before passing it to this constructor. + A handy way to do this is to use the non-member wxCFRefFromGet factory function. + This method is templated and takes an otherType *p. This prevents implicit conversion + using an operator refType() in a different ref-holding class type. + */ + + template <class otherType> + explicit wxCFRef(otherType *p) + : m_ptr(p) // Implicit conversion from otherType* to refType should occur. + {} + + /*! @method wxCFRef + @abstract Copies a ref holder of the same type + @param otherRef The other ref holder to copy. + @discussion Ownership will be shared by the original ref and the newly created ref. That is, + the object will be explicitly retained by this new ref. + */ + wxCFRef(const wxCFRef& otherRef) + : m_ptr(wxCFRetain(otherRef.m_ptr)) + {} + + /*! @method wxCFRef + @abstract Copies a ref holder where its type can be converted to ours + @templatefield otherRefType Any type held by another wxCFRef. + @param otherRef The other ref holder to copy. + @discussion Ownership will be shared by the original ref and the newly created ref. That is, + the object will be explicitly retained by this new ref. + */ + template <class otherRefType> + wxCFRef(const wxCFRef<otherRefType>& otherRef) + : m_ptr(wxCFRetain(otherRef.get())) // Implicit conversion from otherRefType to refType should occur + {} + + /*! @method wxCFRef + @abstract Copies a weak ref holder where its type can be converted to ours + @templatefield otherRefType Any type held by a wxCFWeakRef. + @param otherRef The weak ref holder to copy. + @discussion Ownership will be taken by this newly created ref. That is, + the object will be explicitly retained by this new ref. + Ownership is most likely shared with some other ref as well. + */ + template <class otherRefType> + wxCFRef(const wxCFWeakRef<otherRefType>& otherRef) + : m_ptr(wxCFRetain(otherRef.get())) // Implicit conversion from otherRefType to refType should occur + {} + + /*! @method ~wxCFRef + @abstract Releases (potentially shared) ownership of the ref. + @discussion A ref holder instance is always assumed to have ownership so ownership is always + released (CFRelease called) upon destruction. + */ + ~wxCFRef() + { reset(); } + + /*! @method operator= + @abstract Assigns the other ref's pointer to us when the otherRef is the same type. + @param otherRef The other ref holder to copy. + @discussion The incoming pointer is retained, the original pointer is released, and this object + is made to point to the new pointer. + */ + wxCFRef& operator=(const wxCFRef& otherRef) + { + if (this != &otherRef) + { + wxCFRetain(otherRef.m_ptr); + wxCFRelease(m_ptr); + m_ptr = otherRef.m_ptr; + } + return *this; + } + + /*! @method operator= + @abstract Assigns the other ref's pointer to us when the other ref can be converted to our type. + @templatefield otherRefType Any type held by another wxCFRef + @param otherRef The other ref holder to copy. + @discussion The incoming pointer is retained, the original pointer is released, and this object + is made to point to the new pointer. + */ + template <class otherRefType> + wxCFRef& operator=(const wxCFRef<otherRefType>& otherRef) + { + wxCFRetain(otherRef.get()); + wxCFRelease(m_ptr); + m_ptr = otherRef.get(); // Implicit conversion from otherRefType to refType should occur + return *this; + } + + /*! @method get + @abstract Explicit conversion to the underlying pointer type + @discussion Allows the caller to explicitly get the underlying pointer. + */ + refType get() const + { return m_ptr; } + + /*! @method operator refType + @abstract Implicit conversion to the underlying pointer type + @discussion Allows the ref to be used in CF function calls. + */ + operator refType() const + { return m_ptr; } + +#if 0 + < // HeaderDoc is retarded and thinks the GT from operator-> is part of a template param. + // So give it that < outside of a comment to fake it out. (if 0 is not a comment to HeaderDoc) +#endif + + /*! @method operator-> + @abstract Implicit conversion to the underlying pointer type + @discussion This is nearly useless for CF types which are nearly always opaque + */ + refType operator-> () const + { return m_ptr; } + + /*! @method reset + @abstract Nullifies the reference + @discussion Releases ownership (calls CFRelease) before nullifying the pointer. + */ + void reset() + { + wxCFRelease(m_ptr); + m_ptr = NULL; + } + + /*! @method reset + @abstract Sets this to a new reference + @templatefield otherType Any type. + @param p The raw pointer to assume ownership of + @discussion The existing reference is released (like destruction). It is assumed that the caller + has a strong reference to the new p and intends to transfer ownership of that reference + to this ref holder. Take care to call CFRetain if you received the object from a Get method. + This method is templated and takes an otherType *p. This prevents implicit conversion + using an operator refType() in a different ref-holding class type. + */ + template <class otherType> + void reset(otherType* p) + { + wxCFRelease(m_ptr); + m_ptr = p; // Automatic conversion should occur + } + + // Release the pointer, i.e. give up its ownership. + refType release() + { + refType p = m_ptr; + m_ptr = NULL; + return p; + } + + // Autorelease the pointer, i.e. during the next cleanup it will be released + refType autorelease() + { + refType p = m_ptr; + m_ptr = NULL; + return wxCFAutorelease(p); + } + + +protected: + /*! @var m_ptr The raw pointer. + */ + refType m_ptr; +}; + +/*! @function wxCFRefFromGet + @abstract Factory function to create wxCFRef from a raw pointer obtained from a Get-rule function + @param p The pointer to retain and create a wxCFRef from. May be NULL. + @discussion Unlike the wxCFRef raw pointer constructor, this function explicitly retains its + argument. This can be used for functions such as CFDictionaryGetValue() or + CFAttributedStringGetString() which return a temporary reference (Get-rule functions). + FIXME: Anybody got a better name? +*/ +template <typename Type> +inline wxCFRef<Type*> wxCFRefFromGet(Type *p) +{ + return wxCFRef<Type*>(wxCFRetain(p)); +} + +/*! @function static_cfref_cast + @abstract Works like static_cast but with a wxCFRef as the argument. + @param refType Template parameter. The destination raw pointer type + @param otherRef Normal parameter. The source wxCFRef<> object. + @discussion This is intended to be a clever way to make static_cast work while allowing + the return value to be converted to either a strong ref or a raw pointer + while ensuring that the retain count is updated appropriately. + + This is modeled after shared_ptr's static_pointer_cast. Just as wxCFRef is + parameterized on a pointer to an opaque type so is this class. Note that + this differs from shared_ptr which is parameterized on the pointee type. + + FIXME: Anybody got a better name? +*/ +template <class refType, class otherRefType> +inline wxCFWeakRef<refType> static_cfref_cast(const wxCFRef<otherRefType> &otherRef); + +template <class refType, class otherRefType> +inline wxCFWeakRef<refType> static_cfref_cast(const wxCFRef<otherRefType> &otherRef) +{ + return wxCFWeakRef<refType>(static_cast<refType>(otherRef.get())); +} + +/*! @function CFRelease + @abstract Overloads CFRelease so that the user is warned of bad behaviour. + @discussion It is rarely appropriate to retain or release a wxCFRef. If one absolutely + must do it he can explicitly get() the raw pointer + Normally, this function is unimplemented resulting in a linker error if used. +*/ +template <class T> +inline void CFRelease(const wxCFRef<T*> & cfref) __AVAILABILITY_INTERNAL_DEPRECATED; + +/*! @function CFRetain + @abstract Overloads CFRetain so that the user is warned of bad behaviour. + @discussion It is rarely appropriate to retain or release a wxCFRef. If one absolutely + must do it he can explicitly get() the raw pointer + Normally, this function is unimplemented resulting in a linker error if used. +*/ +template <class T> +inline void CFRetain(const wxCFRef<T*>& cfref) __AVAILABILITY_INTERNAL_DEPRECATED; + +// Change the 0 to a 1 if you want the functions to work (no link errors) +// Neither function will cause retain/release side-effects if implemented. +#if 0 +template <class T> +void CFRelease(const wxCFRef<T*> & cfref) +{ + CFRelease(cfref.get()); +} + +template <class T> +void CFRetain(const wxCFRef<T*> & cfref) +{ + CFRetain(cfref.get()); +} +#endif + +#endif //ndef _WX_MAC_COREFOUNDATION_CFREF_H__ + diff --git a/lib/wxWidgets/include/wx/osx/core/cfstring.h b/lib/wxWidgets/include/wx/osx/core/cfstring.h new file mode 100644 index 0000000..6468713 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/core/cfstring.h @@ -0,0 +1,103 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/core/cfstring.h +// Purpose: wxCFStringRef and other string functions +// Author: Stefan Csomor +// Modified by: +// Created: 2004-10-29 (from code in wx/mac/carbon/private.h) +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +// Usage: Darwin (base library) +///////////////////////////////////////////////////////////////////////////// + +#ifndef __WX_CFSTRINGHOLDER_H__ +#define __WX_CFSTRINGHOLDER_H__ + +#include "wx/dlimpexp.h" +#include "wx/fontenc.h" +#include "wx/osx/core/cfref.h" + +#ifdef WORDS_BIGENDIAN + #define kCFStringEncodingUTF32Native kCFStringEncodingUTF32BE +#else + #define kCFStringEncodingUTF32Native kCFStringEncodingUTF32LE +#endif + +class WXDLLIMPEXP_FWD_BASE wxString; + +WXDLLIMPEXP_BASE wxString wxMacConvertNewlines13To10(const wxString& data); +WXDLLIMPEXP_BASE wxString wxMacConvertNewlines10To13(const wxString& data); + +WXDLLIMPEXP_BASE wxUint32 wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding) ; +WXDLLIMPEXP_BASE wxFontEncoding wxMacGetFontEncFromSystemEnc(wxUint32 encoding) ; +WXDLLIMPEXP_BASE void wxMacWakeUp() ; + +class WXDLLIMPEXP_BASE wxCFStringRef : public wxCFRef< CFStringRef > +{ +public: + wxCFStringRef() + { + } + + wxCFStringRef(const wxString &str, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) ; + +#ifdef __OBJC__ + wxCFStringRef(WX_NSString ref) + : wxCFRef< CFStringRef >((WX_OSX_BRIDGE_RETAINED CFStringRef) ref) + { + } +#endif + + wxCFStringRef(CFStringRef ref) + : wxCFRef< CFStringRef >(ref) + { + } + + wxCFStringRef(const wxCFStringRef& otherRef ) + : wxCFRef< CFStringRef >(otherRef) + { + } + + ~wxCFStringRef() + { + } + + wxString AsString( wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) const; + + static wxString AsString( CFStringRef ref, wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ; + static wxString AsStringWithNormalizationFormC( CFStringRef ref, wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ; +#ifdef __WXMAC__ + static wxString AsString( WX_NSString ref, wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ; + static wxString AsStringWithNormalizationFormC( WX_NSString ref, wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ; +#endif +#ifdef __OBJC__ + WX_NSString AsNSString() const { return (WX_OSX_BRIDGE WX_NSString)(CFStringRef) *this; } +#endif +private: +} ; + +/*! @function wxCFStringRefFromGet + @abstract Factory function to create wxCFStringRefRef from a CFStringRef obtained from a Get-rule function + @param p The CFStringRef to retain and create a wxCFStringRefRef from. May be NULL. + @discussion Unlike the wxCFStringRef raw pointer constructor, this function explicitly retains its + argument. This can be used for functions ) which return a temporary reference (Get-rule functions). +*/ +inline wxCFStringRef wxCFStringRefFromGet(CFStringRef p) +{ + return wxCFStringRef(wxCFRetain(p)); +} + +#ifdef __WXMAC__ +/*! @function wxCFStringRefFromGet + @abstract Factory function to create wxCFStringRefRef from a NSString* obtained from a Get-rule function + @param p The NSString pointer to retain and create a wxCFStringRefRef from. May be NULL. + @discussion Unlike the wxCFStringRef raw pointer constructor, this function explicitly retains its + argument. This can be used for functions ) which return a temporary reference (Get-rule functions). +*/ +inline wxCFStringRef wxCFStringRefFromGet(NSString *p) +{ + return wxCFStringRefFromGet((WX_OSX_BRIDGE CFStringRef)p); +} +#endif + +#endif //__WXCFSTRINGHOLDER_H__ diff --git a/lib/wxWidgets/include/wx/osx/core/cftype.h b/lib/wxWidgets/include/wx/osx/core/cftype.h new file mode 100644 index 0000000..0b6fbc4 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/core/cftype.h @@ -0,0 +1,130 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/core/cftype.h +// Purpose: wxCFDictionaryRef class +// Author: Stefan Csomor +// Modified by: +// Created: 2018/07/27 +// Copyright: (c) 2018 Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// +/*! @header wx/osx/core/cftype.h + @abstract wxCFTypeRef class and derived classes + */ + +#ifndef _WX_OSX_COREFOUNDATION_CFTYPEREF_H__ +#define _WX_OSX_COREFOUNDATION_CFTYPEREF_H__ + +#include "wx/osx/core/cfref.h" +#include "wx/osx/core/cfstring.h" + +#ifndef WX_PRECOMP +#include "wx/string.h" +#endif + +class wxCFTypeRef : public wxCFRef<CFTypeRef> +{ +public: + typedef wxCFRef<CFTypeRef> super_type; + + wxCFTypeRef(CFTypeRef d) + : super_type(d) + { + } + + template <typename V> + bool GetValue(V* ptr) const; + + template <typename V> + bool GetValue(V* ptr, V defaultValue) const + { + bool hasKey = GetValue(ptr); + + if (!hasKey) + *ptr = defaultValue; + + return hasKey; + } + + template <typename V> + bool GetValue(V& ref) const + { + return GetValue(&ref); + } + + template <typename V> + bool GetValue(V& ref, V defaultValue) const + { + bool hasKey = GetValue(ref); + + if (!hasKey) + ref = defaultValue; + + return hasKey; + } + + // spezialization through overload + + bool GetValue(CGFloat* ptr) const + { + if (m_ptr) + CFNumberGetValue((CFNumberRef)m_ptr, kCFNumberCGFloatType, ptr); + + return m_ptr; + } + + bool GetValue(int32_t* ptr) const + { + if (m_ptr) + CFNumberGetValue((CFNumberRef)m_ptr, kCFNumberSInt32Type, ptr); + + return m_ptr; + } + + bool GetValue(uint32_t* ptr) const + { + if (m_ptr) + CFNumberGetValue((CFNumberRef)m_ptr, kCFNumberSInt32Type, ptr); + + return m_ptr; + } + + bool GetValue(int64_t* ptr) const + { + if (m_ptr) + CFNumberGetValue((CFNumberRef)m_ptr, kCFNumberSInt64Type, ptr); + + return m_ptr; + } + + bool GetValue(uint64_t* ptr) const + { + if (m_ptr) + CFNumberGetValue((CFNumberRef)m_ptr, kCFNumberSInt64Type, ptr); + + return m_ptr; + } + + bool GetValue(wxString* s) const + { + if (m_ptr) + *s = wxCFStringRef::AsString((CFStringRef)m_ptr); + + return m_ptr; + } +}; + +class wxCFNumberRef : public wxCFTypeRef +{ +public: + wxCFNumberRef(CGFloat v) + : wxCFTypeRef(CFNumberCreate(NULL, kCFNumberCGFloatType, &v)) + { + } + + wxCFNumberRef(int v) + : wxCFTypeRef(CFNumberCreate(NULL, kCFNumberIntType, &v)) + { + } +}; + +#endif //ifndef _WX_OSX_COREFOUNDATION_CFTYPEREF_H__ diff --git a/lib/wxWidgets/include/wx/osx/core/colour.h b/lib/wxWidgets/include/wx/osx/core/colour.h new file mode 100644 index 0000000..c77c39e --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/core/colour.h @@ -0,0 +1,109 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/core/colour.h +// Purpose: wxColour class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COLOUR_H_ +#define _WX_COLOUR_H_ + +#include "wx/object.h" +#include "wx/string.h" + +#include "wx/osx/core/cfref.h" + +struct RGBColor; + +// Colour +class WXDLLIMPEXP_CORE wxColour: public wxColourBase +{ +public: + // constructors + // ------------ + DEFINE_STD_WXCOLOUR_CONSTRUCTORS + + // default copy ctor and dtor are ok + + // accessors + virtual ChannelType Red() const wxOVERRIDE; + virtual ChannelType Green() const wxOVERRIDE; + virtual ChannelType Blue() const wxOVERRIDE; + virtual ChannelType Alpha() const wxOVERRIDE; + + virtual bool IsSolid() const wxOVERRIDE; + + // comparison + bool operator == (const wxColour& colour) const; + bool operator != (const wxColour& colour) const { return !(*this == colour); } + + // CoreGraphics CGColor + // -------------------- + + // This ctor does take ownership of the color. + wxColour( CGColorRef col ); + + // don't take ownership of the returned value + CGColorRef GetCGColor() const; + + // do take ownership of the returned value + CGColorRef CreateCGColor() const { return wxCFRetain(GetCGColor()); } + +#if wxOSX_USE_COCOA_OR_CARBON + // Quickdraw RGBColor + // ------------------ + wxColour(const RGBColor& col); + void GetRGBColor( RGBColor *col ) const; +#endif + +#if wxOSX_USE_COCOA + // NSColor Cocoa + // ------------- + + // This ctor does not take ownership of the color. + explicit wxColour(WX_NSColor color); + WX_NSColor OSXGetNSColor() const; + WX_NSImage OSXGetNSPatternImage() const; +#endif + +protected : + virtual void + InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a) wxOVERRIDE; + + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + +private: + + wxDECLARE_DYNAMIC_CLASS(wxColour); +}; + +class wxColourRefData : public wxGDIRefData +{ +public: + wxColourRefData() {} + virtual ~wxColourRefData() {} + + virtual double Red() const = 0; + virtual double Green() const = 0; + virtual double Blue() const = 0; + virtual double Alpha() const = 0; + + virtual bool IsSolid() const + { return true; } + + virtual CGColorRef GetCGColor() const = 0; + + virtual wxColourRefData* Clone() const = 0; + +#if wxOSX_USE_COCOA + virtual WX_NSColor GetNSColor() const; + virtual WX_NSImage GetNSPatternImage() const; +#endif +}; + +#endif + // _WX_COLOUR_H_ diff --git a/lib/wxWidgets/include/wx/osx/core/dataview.h b/lib/wxWidgets/include/wx/osx/core/dataview.h new file mode 100644 index 0000000..c9b7bde --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/core/dataview.h @@ -0,0 +1,117 @@ + +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/core/dataview.h +// Purpose: wxDataViewCtrl native implementation header for OSX +// Author: +// Copyright: (c) 2009 +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DATAVIEWCTRL_CORE_H_ +#define _WX_DATAVIEWCTRL_CORE_H_ + +#include "wx/dataview.h" + +typedef wxWidgetImpl wxWidgetImplType; + +// --------------------------------------------------------- +// Helper functions for dataview implementation on OSX +// --------------------------------------------------------- +wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* parent, wxWindowID id, + wxPoint const& pos, wxSize const& size, + long style, long extraStyle); +wxString ConcatenateDataViewItemValues(wxDataViewCtrl const* dataViewCtrlPtr, wxDataViewItem const& dataViewItem); // concatenates all data of the visible columns of the passed control + // and item TAB separated into a string and returns it + +// --------------------------------------------------------- +// wxDataViewWidgetImpl +// Common interface of the native dataview implementation +// for the carbon and cocoa environment. +// ATTENTION +// All methods assume that the passed column pointers are +// valid (unless a NULL pointer is explicitly allowed +// to be passed)! +// ATTENTION +// --------------------------------------------------------- +class WXDLLIMPEXP_CORE wxDataViewWidgetImpl +{ +public: + // + // constructors / destructor + // + virtual ~wxDataViewWidgetImpl() + { + } + + // + // column related methods + // + virtual bool ClearColumns() = 0; // deletes all columns in the native control + virtual bool DeleteColumn (wxDataViewColumn* columnPtr) = 0; // deletes the column in the native control + virtual void DoSetExpanderColumn(wxDataViewColumn const* columnPtr) = 0; // sets the disclosure column in the native control + virtual wxDataViewColumn* GetColumn (unsigned int pos) const = 0; // returns the column belonging to 'pos' in the native control + virtual int GetColumnPosition (wxDataViewColumn const* columnPtr) const = 0; // returns the position of the passed column in the native control + virtual bool InsertColumn (unsigned int pos, wxDataViewColumn* columnPtr) = 0; // inserts a column at pos in the native control; + // the method can assume that the column's owner is already set + virtual void FitColumnWidthToContent(unsigned int pos) = 0; // resizes column to fit its content + + // + // item related methods + // + virtual bool Add (wxDataViewItem const& parent, wxDataViewItem const& item) = 0; // adds an item to the native control + virtual bool Add (wxDataViewItem const& parent, wxDataViewItemArray const& items) = 0; // adds items to the native control + virtual void Collapse (wxDataViewItem const& item) = 0; // collapses the passed item in the native control + virtual void EnsureVisible(wxDataViewItem const& item, wxDataViewColumn const* columnPtr) = 0; // ensures that the passed item's value in the passed column is visible (column pointer can be NULL) + virtual unsigned int GetCount() const = 0; // returns the number of items in the native control + virtual int GetCountPerPage() const = 0; // get number of items that fit into a single page + virtual wxRect GetRectangle (wxDataViewItem const& item, wxDataViewColumn const* columnPtr) = 0; // returns the rectangle that is used by the passed item and column in the native control + virtual wxDataViewItem GetTopItem() const = 0; // get top-most visible item + virtual bool IsExpanded (wxDataViewItem const& item) const = 0; // checks if the passed item is expanded in the native control + virtual bool Reload() = 0; // clears the native control and reloads all data + virtual bool Remove (wxDataViewItem const& parent) = 0; // removes one or more items under the given parent from the native control + virtual bool Update (wxDataViewColumn const* columnPtr) = 0; // updates the items in the passed column of the native control + virtual bool Update (wxDataViewItem const& parent, wxDataViewItem const& item) = 0; // updates the passed item in the native control + virtual bool Update (wxDataViewItem const& parent, wxDataViewItemArray const& items) = 0; // updates the passed items in the native control + + // + // model related methods + // + virtual bool AssociateModel(wxDataViewModel* model) = 0; // informs the native control that a model is present + + // + // selection related methods + // + virtual wxDataViewItem GetCurrentItem() const = 0; + virtual void SetCurrentItem(const wxDataViewItem& item) = 0; + + virtual wxDataViewColumn *GetCurrentColumn() const = 0; + + virtual int GetSelectedItemsCount() const = 0; + virtual int GetSelections(wxDataViewItemArray& sel) const = 0; // returns all selected items in the native control + virtual bool IsSelected (wxDataViewItem const& item) const = 0; // checks if the passed item is selected in the native control + virtual void Select (wxDataViewItem const& item) = 0; // selects the passed item in the native control + virtual void Select (wxDataViewItemArray const& items) = 0; // selects the passed items in the native control + virtual void SelectAll() = 0; // selects all items in the native control + virtual void Unselect (wxDataViewItem const& item) = 0; // unselects the passed item in the native control + virtual void UnselectAll() = 0; // unselects all items in the native control + + // + // sorting related methods + // + virtual wxDataViewColumn* GetSortingColumn() const = 0; // returns the column that is primarily responsible for sorting in the native control + virtual void Resort() = 0; // asks the native control to start a resorting process + + // + // other methods + // + virtual void DoSetIndent (int indent) = 0; // sets the indentation in the native control + virtual void DoExpand (wxDataViewItem const& item, bool expandChildren) = 0; // expands the passed item in the native control + + virtual void HitTest (wxPoint const& point, wxDataViewItem& item, wxDataViewColumn*& columnPtr) const = 0; // return the item and column pointer that contains with the passed point + virtual void SetRowHeight(int height) = 0; // sets the height of all rows + virtual void SetRowHeight(wxDataViewItem const& item, unsigned int height) = 0; // sets the height of the row containing the passed item in the native control + virtual void OnSize() = 0; // updates the layout of the native control after a size event + virtual void StartEditor( const wxDataViewItem & item, unsigned int column ) = 0; // starts editing the passed in item and column +}; + +#endif // _WX_DATAVIEWCTRL_CORE_H_ diff --git a/lib/wxWidgets/include/wx/osx/core/evtloop.h b/lib/wxWidgets/include/wx/osx/core/evtloop.h new file mode 100644 index 0000000..01e1155 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/core/evtloop.h @@ -0,0 +1,118 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/core/evtloop.h +// Purpose: CoreFoundation-based event loop +// Author: Vadim Zeitlin +// Modified by: +// Created: 2006-01-12 +// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_CORE_EVTLOOP_H_ +#define _WX_OSX_CORE_EVTLOOP_H_ + +DECLARE_WXOSX_OPAQUE_CFREF( CFRunLoop ) +DECLARE_WXOSX_OPAQUE_CFREF( CFRunLoopObserver ) + +class WXDLLIMPEXP_FWD_BASE wxCFEventLoopPauseIdleEvents; + +class WXDLLIMPEXP_BASE wxCFEventLoop : public wxEventLoopBase +{ + friend class wxCFEventLoopPauseIdleEvents; +public: + wxCFEventLoop(); + virtual ~wxCFEventLoop(); + + // sets the "should exit" flag and wakes up the loop so that it terminates + // soon + virtual void ScheduleExit(int rc = 0) wxOVERRIDE; + + // return true if any events are available + virtual bool Pending() const wxOVERRIDE; + + // dispatch a single event, return false if we should exit from the loop + virtual bool Dispatch() wxOVERRIDE; + + // same as Dispatch() but doesn't wait for longer than the specified (in + // ms) timeout, return true if an event was processed, false if we should + // exit the loop or -1 if timeout expired + virtual int DispatchTimeout(unsigned long timeout) wxOVERRIDE; + + // implement this to wake up the loop: usually done by posting a dummy event + // to it (can be called from non main thread) + virtual void WakeUp() wxOVERRIDE; + + bool ShouldProcessIdleEvents() const { return m_processIdleEvents ; } + +#if wxUSE_UIACTIONSIMULATOR + // notifies Yield and Dispatch to wait for at least one event before + // returning, this is necessary, because the synthesized events need to be + // converted by the OS before being available on the native event queue + void SetShouldWaitForEvent(bool should) { m_shouldWaitForEvent = should; } +#endif +protected: + // enters a loop calling OnNextIteration(), Pending() and Dispatch() and + // terminating when Exit() is called + virtual int DoRun() wxOVERRIDE; + + // may be overridden to perform some action at the start of each new event + // loop iteration + virtual void OnNextIteration() {} + + virtual void DoYieldFor(long eventsToProcess) wxOVERRIDE; + + void CommonModeObserverCallBack(CFRunLoopObserverRef observer, int activity); + void DefaultModeObserverCallBack(CFRunLoopObserverRef observer, int activity); + + // set to false to avoid idling at unexpected moments - eg when having native message boxes + void SetProcessIdleEvents(bool process) { m_processIdleEvents = process; } + + static void OSXCommonModeObserverCallBack(CFRunLoopObserverRef observer, int activity, void *info); + static void OSXDefaultModeObserverCallBack(CFRunLoopObserverRef observer, int activity, void *info); + + // get the currently executing CFRunLoop + virtual CFRunLoopRef CFGetCurrentRunLoop() const; + + virtual int DoDispatchTimeout(unsigned long timeout); + + virtual void OSXDoRun(); + virtual void OSXDoStop(); + + // the loop exit code + int m_exitcode; + + // cfrunloop + CFRunLoopRef m_runLoop; + + // common modes runloop observer + CFRunLoopObserverRef m_commonModeRunLoopObserver; + + // default mode runloop observer + CFRunLoopObserverRef m_defaultModeRunLoopObserver; + + // set to false to avoid idling at unexpected moments - eg when having native message boxes + bool m_processIdleEvents; + +#if wxUSE_UIACTIONSIMULATOR + bool m_shouldWaitForEvent; +#endif +private: + // process all already pending events and dispatch a new one (blocking + // until it appears in the event queue if necessary) + // + // returns the return value of DoDispatchTimeout() + int DoProcessEvents(); + + wxDECLARE_NO_COPY_CLASS(wxCFEventLoop); +}; + +class WXDLLIMPEXP_BASE wxCFEventLoopPauseIdleEvents : public wxObject +{ +public: + wxCFEventLoopPauseIdleEvents(); + virtual ~wxCFEventLoopPauseIdleEvents(); +private: + bool m_formerState; +}; + +#endif // _WX_OSX_EVTLOOP_H_ diff --git a/lib/wxWidgets/include/wx/osx/core/hid.h b/lib/wxWidgets/include/wx/osx/core/hid.h new file mode 100644 index 0000000..7446b0d --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/core/hid.h @@ -0,0 +1,114 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/core/hid.h +// Purpose: DARWIN HID layer for WX +// Author: Ryan Norton +// Modified by: +// Created: 11/11/2003 +// Copyright: (c) Ryan Norton +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// =========================================================================== +// declarations +// =========================================================================== + +// --------------------------------------------------------------------------- +// headers +// --------------------------------------------------------------------------- + +#ifndef _WX_MACCARBONHID_H_ +#define _WX_MACCARBONHID_H_ + +#include "wx/defs.h" +#include "wx/string.h" + +//Mac OSX only +#ifdef __DARWIN__ + +#include <IOKit/IOKitLib.h> +#include <IOKit/IOCFPlugIn.h> +#include <IOKit/hid/IOHIDLib.h> +#include <IOKit/hid/IOHIDKeys.h> +#include <Kernel/IOKit/hidsystem/IOHIDUsageTables.h> + +//Darn apple - doesn't properly wrap their headers in extern "C"! +//http://www.macosx.com/forums/archive/index.php/t-68069.html +extern "C" { +#include <mach/mach_port.h> +} + +#include <mach/mach.h> //this actually includes mach_port.h (see above) + +// =========================================================================== +// definitions +// =========================================================================== + + +// --------------------------------------------------------------------------- +// wxHIDDevice +// +// A wrapper around OS X HID Manager procedures. +// The tutorial "Working With HID Class Device Interfaces" Is +// Quite good, as is the sample program associated with it +// (Depite the author's protests!). +// --------------------------------------------------------------------------- +class WXDLLIMPEXP_CORE wxHIDDevice +{ +public: + wxHIDDevice() : m_ppDevice(NULL), m_ppQueue(NULL), m_pCookies(NULL) {} + + bool Create (int nClass = -1, int nType = -1, int nDev = 1); + + static size_t GetCount(int nClass = -1, int nType = -1); + + void AddCookie(CFTypeRef Data, int i); + void AddCookieInQueue(CFTypeRef Data, int i); + void InitCookies(size_t dwSize, bool bQueue = false); + + //Must be implemented by derived classes + //builds the cookie array - + //first call InitCookies to initialize the cookie + //array, then AddCookie to add a cookie at a certain point in an array + virtual void BuildCookies(CFArrayRef Array) = 0; + + //checks to see whether the cookie at nIndex is active (element value != 0) + bool IsActive(int nIndex); + + //checks to see whether an element in the internal cookie array + //exists + bool HasElement(int nIndex); + + //closes the device and cleans the queue and cookies + virtual ~wxHIDDevice(); + +protected: + IOHIDDeviceInterface** m_ppDevice; //this, essentially + IOHIDQueueInterface** m_ppQueue; //queue (if we want one) + IOHIDElementCookie* m_pCookies; //cookies + + wxString m_szProductName; //product name + int m_nProductId; //product id + int m_nManufacturerId; //manufacturer id + mach_port_t m_pPort; //mach port to use +}; + +// --------------------------------------------------------------------------- +// wxHIDKeyboard +// +// Semi-simple implementation that opens a connection to the first +// keyboard of the machine. Used in wxGetKeyState. +// --------------------------------------------------------------------------- +class WXDLLIMPEXP_CORE wxHIDKeyboard : public wxHIDDevice +{ +public: + static int GetCount(); + bool Create(int nDev = 1); + void AddCookie(CFTypeRef Data, int i); + virtual void BuildCookies(CFArrayRef Array) wxOVERRIDE; + void DoBuildCookies(CFArrayRef Array); +}; + +#endif //__DARWIN__ + +#endif + // _WX_MACCARBONHID_H_ diff --git a/lib/wxWidgets/include/wx/osx/core/joystick.h b/lib/wxWidgets/include/wx/osx/core/joystick.h new file mode 100644 index 0000000..51e3738 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/core/joystick.h @@ -0,0 +1,92 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/core/joystick.h +// Purpose: wxJoystick class +// Author: Ryan Norton +// Modified by: +// Created: 2/13/2005 +// Copyright: (c) Ryan Norton +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_JOYSTICK_H_ +#define _WX_JOYSTICK_H_ + +#include "wx/event.h" + +class WXDLLIMPEXP_FWD_CORE wxJoystickThread; + +class WXDLLIMPEXP_ADV wxJoystick: public wxObject +{ + wxDECLARE_DYNAMIC_CLASS(wxJoystick); + public: + + wxJoystick(int joystick = wxJOYSTICK1); + virtual ~wxJoystick(); + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + wxPoint GetPosition() const; + int GetPosition(unsigned axis) const; + bool GetButtonState(unsigned button) const; + int GetZPosition() const; + int GetButtonState() const; + int GetPOVPosition() const; + int GetPOVCTSPosition() const; + int GetRudderPosition() const; + int GetUPosition() const; + int GetVPosition() const; + int GetMovementThreshold() const; + void SetMovementThreshold(int threshold) ; + + // Capabilities + //////////////////////////////////////////////////////////////////////////// + + bool IsOk() const; // Checks that the joystick is functioning + static int GetNumberJoysticks() ; + int GetManufacturerId() const ; + int GetProductId() const ; + wxString GetProductName() const ; + int GetXMin() const; + int GetYMin() const; + int GetZMin() const; + int GetXMax() const; + int GetYMax() const; + int GetZMax() const; + int GetNumberButtons() const; + int GetNumberAxes() const; + int GetMaxButtons() const; + int GetMaxAxes() const; + int GetPollingMin() const; + int GetPollingMax() const; + int GetRudderMin() const; + int GetRudderMax() const; + int GetUMin() const; + int GetUMax() const; + int GetVMin() const; + int GetVMax() const; + + bool HasRudder() const; + bool HasZ() const; + bool HasU() const; + bool HasV() const; + bool HasPOV() const; + bool HasPOV4Dir() const; + bool HasPOVCTS() const; + + // Operations + //////////////////////////////////////////////////////////////////////////// + + // pollingFreq = 0 means that movement events are sent when above the threshold. + // If pollingFreq > 0, events are received every this many milliseconds. + bool SetCapture(wxWindow* win, int pollingFreq = 0); + bool ReleaseCapture(); + +protected: + int m_joystick; + wxJoystickThread* m_thread; + class wxHIDJoystick* m_hid; +}; + +#endif + // _WX_JOYSTICK_H_ diff --git a/lib/wxWidgets/include/wx/osx/core/mimetype.h b/lib/wxWidgets/include/wx/osx/core/mimetype.h new file mode 100644 index 0000000..2a97b3c --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/core/mimetype.h @@ -0,0 +1,123 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/core/mimetype.h +// Purpose: Mac implementation for wx mime-related classes +// Author: Neil Perkins +// Modified by: +// Created: 2010-05-15 +// Copyright: (C) 2010 Neil Perkins +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _MIMETYPE_IMPL_H +#define _MIMETYPE_IMPL_H + +#include "wx/defs.h" + +#if wxUSE_MIMETYPE + +#include "wx/mimetype.h" +#include "wx/hashmap.h" +#include "wx/iconloc.h" + + +// This class implements mime type functionality for Mac OS X using UTIs and Launch Services +// Currently only the GetFileTypeFromXXXX public functions have been implemented +class WXDLLIMPEXP_BASE wxMimeTypesManagerImpl +{ +public: + + wxMimeTypesManagerImpl(); + virtual ~wxMimeTypesManagerImpl(); + + // These functions are not needed on Mac OS X and have no-op implementations + void Initialize(int mailcapStyles = wxMAILCAP_STANDARD, const wxString& extraDir = wxEmptyString); + void ClearData(); + + // Functions to look up types by ext, mime or UTI + wxFileType *GetFileTypeFromExtension(const wxString& ext); + wxFileType *GetFileTypeFromMimeType(const wxString& mimeType); + wxFileType *GetFileTypeFromUti(const wxString& uti); + + // These functions are only stubs on Mac OS X + size_t EnumAllFileTypes(wxArrayString& mimetypes); + wxFileType *Associate(const wxFileTypeInfo& ftInfo); + bool Unassociate(wxFileType *ft); + +private: + + // The work of querying the OS for type data is done in these two functions + void LoadTypeDataForUti(const wxString& uti); + void LoadDisplayDataForUti(const wxString& uti); + + // These functions are pass-throughs from wxFileTypeImpl + bool GetExtensions(const wxString& uti, wxArrayString& extensions); + bool GetMimeType(const wxString& uti, wxString *mimeType); + bool GetMimeTypes(const wxString& uti, wxArrayString& mimeTypes); + bool GetIcon(const wxString& uti, wxIconLocation *iconLoc); + bool GetDescription(const wxString& uti, wxString *desc); + bool GetApplication(const wxString& uti, wxString *command); + + // Structure to represent file types + typedef struct FileTypeData + { + wxArrayString extensions; + wxArrayString mimeTypes; + wxIconLocation iconLoc; + wxString application; + wxString description; + } + FileTypeInfo; + + // Map types + WX_DECLARE_STRING_HASH_MAP( wxString, TagMap ); + WX_DECLARE_STRING_HASH_MAP( FileTypeData, UtiMap ); + + // Data store + TagMap m_extMap; + TagMap m_mimeMap; + UtiMap m_utiMap; + + friend class wxFileTypeImpl; +}; + + +// This class provides the interface between wxFileType and wxMimeTypesManagerImple for Mac OS X +// Currently only extension, mimetype, description and icon information is available +// All other methods have no-op implementation +class WXDLLIMPEXP_BASE wxFileTypeImpl +{ +public: + + wxFileTypeImpl(); + virtual ~wxFileTypeImpl(); + + bool GetExtensions(wxArrayString& extensions) const ; + bool GetMimeType(wxString *mimeType) const ; + bool GetMimeTypes(wxArrayString& mimeTypes) const ; + bool GetIcon(wxIconLocation *iconLoc) const ; + bool GetDescription(wxString *desc) const ; + bool GetOpenCommand(wxString *openCmd, const wxFileType::MessageParameters& params) const; + + // These functions are only stubs on Mac OS X + bool GetPrintCommand(wxString *printCmd, const wxFileType::MessageParameters& params) const; + size_t GetAllCommands(wxArrayString *verbs, wxArrayString *commands, const wxFileType::MessageParameters& params) const; + bool SetCommand(const wxString& cmd, const wxString& verb, bool overwriteprompt = TRUE); + bool SetDefaultIcon(const wxString& strIcon = wxEmptyString, int index = 0); + bool Unassociate(wxFileType *ft); + + wxString + GetExpandedCommand(const wxString& verb, + const wxFileType::MessageParameters& params) const; +private: + + // All that is needed to query type info - UTI and pointer to the manager + wxString m_uti; + wxMimeTypesManagerImpl* m_manager; + + friend class wxMimeTypesManagerImpl; +}; + +#endif // wxUSE_MIMETYPE +#endif //_MIMETYPE_IMPL_H + + diff --git a/lib/wxWidgets/include/wx/osx/core/objcid.h b/lib/wxWidgets/include/wx/osx/core/objcid.h new file mode 100644 index 0000000..35238bb --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/core/objcid.h @@ -0,0 +1,23 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/core/objcid.h +// Purpose: Define wxObjCID working in both C++ and Objective-C. +// Author: Vadim Zeitlin +// Created: 2012-05-20 +// Copyright: (c) 2012 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_CORE_OBJCID_H_ +#define _WX_OSX_CORE_OBJCID_H_ + +// ---------------------------------------------------------------------------- +// wxObjCID: Equivalent of Objective-C "id" that works in C++ code. +// ---------------------------------------------------------------------------- + +#ifdef __OBJC__ + #define wxObjCID id +#else + typedef struct objc_object* wxObjCID; +#endif + +#endif // _WX_OSX_CORE_OBJCID_H_ diff --git a/lib/wxWidgets/include/wx/osx/core/private.h b/lib/wxWidgets/include/wx/osx/core/private.h new file mode 100644 index 0000000..cf52b8d --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/core/private.h @@ -0,0 +1,1137 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/core/private.h +// Purpose: Private declarations: as this header is only included by +// wxWidgets itself, it may contain identifiers which don't start +// with "wx". +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_CORE_H_ +#define _WX_PRIVATE_CORE_H_ + +#include "wx/defs.h" + +#include <CoreFoundation/CoreFoundation.h> +#include <CoreGraphics/CoreGraphics.h> // At least for CGFloat + +#include "wx/osx/core/cfstring.h" +#include "wx/osx/core/cfdataref.h" +#include "wx/osx/core/cfarray.h" +#include "wx/osx/core/cfdictionary.h" + +// platform specific Clang analyzer support +#ifndef NS_RETURNS_RETAINED +# if WX_HAS_CLANG_FEATURE(attribute_ns_returns_retained) +# define NS_RETURNS_RETAINED __attribute__((ns_returns_retained)) +# else +# define NS_RETURNS_RETAINED +# endif +#endif + +#ifndef CF_RETURNS_RETAINED +# if WX_HAS_CLANG_FEATURE(attribute_cf_returns_retained) +# define CF_RETURNS_RETAINED __attribute__((cf_returns_retained)) +# else +# define CF_RETURNS_RETAINED +# endif +#endif + +#if ( !wxUSE_GUI && !wxOSX_USE_IPHONE ) || wxOSX_USE_COCOA_OR_CARBON + +// Carbon functions are currently still used in wxOSX/Cocoa too (including +// wxBase part of it). +#include <Carbon/Carbon.h> + +void WXDLLIMPEXP_CORE wxMacStringToPascal( const wxString&from , unsigned char * to ); +wxString WXDLLIMPEXP_CORE wxMacMakeStringFromPascal( const unsigned char * from ); + +WXDLLIMPEXP_BASE wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathComponent = NULL ); +WXDLLIMPEXP_BASE OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef ); +WXDLLIMPEXP_BASE wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname ); + +// keycode utils from app.cpp + +WXDLLIMPEXP_BASE CGKeyCode wxCharCodeWXToOSX(wxKeyCode code); +WXDLLIMPEXP_BASE long wxMacTranslateKey(unsigned char key, unsigned char code); + +#endif + +// NSString<->wxString + +WXDLLIMPEXP_BASE wxString wxStringWithNSString(NSString *nsstring); +WXDLLIMPEXP_BASE NSString* wxNSStringWithWxString(const wxString &wxstring); + +WXDLLIMPEXP_BASE CFURLRef wxOSXCreateURLFromFileSystemPath( const wxString& path); + +#if wxUSE_GUI + +#if !wxOSX_USE_IPHONE +#include <ApplicationServices/ApplicationServices.h> +#endif + +#include "wx/bmpbndl.h" +#include "wx/window.h" +#include "wx/toplevel.h" + +class wxTextProofOptions; + +class WXDLLIMPEXP_CORE wxMacCGContextStateSaver +{ + wxDECLARE_NO_COPY_CLASS(wxMacCGContextStateSaver); + +public: + wxMacCGContextStateSaver( CGContextRef cg ) + { + m_cg = cg; + CGContextSaveGState( cg ); + } + ~wxMacCGContextStateSaver() + { + CGContextRestoreGState( m_cg ); + } +private: + CGContextRef m_cg; +}; + +class WXDLLIMPEXP_CORE wxDeferredObjectDeleter : public wxObject +{ +public : + wxDeferredObjectDeleter( wxObject* obj ) : m_obj(obj) + { + } + virtual ~wxDeferredObjectDeleter() + { + delete m_obj; + } +protected : + wxObject* m_obj ; +} ; + +// Quartz + +WXDLLIMPEXP_CORE CGDataProviderRef wxMacCGDataProviderCreateWithCFData( CFDataRef data ); +WXDLLIMPEXP_CORE CGDataConsumerRef wxMacCGDataConsumerCreateWithCFData( CFMutableDataRef data ); +WXDLLIMPEXP_CORE CGDataProviderRef wxMacCGDataProviderCreateWithMemoryBuffer( const wxMemoryBuffer& buf ); + +WXDLLIMPEXP_CORE CGColorSpaceRef wxMacGetGenericRGBColorSpace(); + +WXDLLIMPEXP_CORE double wxOSXGetMainScreenContentScaleFactor(); + +// UI + +CGSize WXDLLIMPEXP_CORE wxOSXGetImageSize(WXImage image); +CGImageRef WXDLLIMPEXP_CORE wxOSXCreateCGImageFromImage( WXImage nsimage, double *scale = NULL ); +CGImageRef WXDLLIMPEXP_CORE wxOSXGetCGImageFromImage( WXImage nsimage, CGRect* r, CGContextRef cg); +CGContextRef WXDLLIMPEXP_CORE wxOSXCreateBitmapContextFromImage( WXImage nsimage, bool *isTemplate = NULL); +WXImage WXDLLIMPEXP_CORE wxOSXGetImageFromCGImage( CGImageRef image, double scale = 1.0, bool isTemplate = false); +double WXDLLIMPEXP_CORE wxOSXGetImageScaleFactor(WXImage image); + + +class wxWindowMac; +// to +extern wxWindow* g_MacLastWindow; +class wxNonOwnedWindow; + +// temporary typedef so that no additional casts are necessary within carbon code at the moment + +class wxMacControl; +class wxWidgetImpl; +class wxComboBox; +class wxNotebook; +class wxTextCtrl; +class wxSearchCtrl; +class wxMenuItem; +class wxAcceleratorEntry; + +WXDLLIMPEXP_CORE wxWindowMac * wxFindWindowFromWXWidget(WXWidget inControl ); + +typedef wxWidgetImpl wxWidgetImplType; + +#if wxUSE_MENUS +class wxMenuItemImpl : public wxObject +{ +public : + wxMenuItemImpl( wxMenuItem* peer ) : m_peer(peer) + { + } + + virtual ~wxMenuItemImpl() ; + virtual void SetBitmap( const wxBitmap& bitmap ) = 0; + virtual void Enable( bool enable ) = 0; + virtual void Check( bool check ) = 0; + virtual void SetLabel( const wxString& text, wxAcceleratorEntry *entry ) = 0; + virtual void Hide( bool hide = true ) = 0; + virtual void SetAllowsKeyEquivalentWhenHidden( bool ) {} + + virtual void * GetHMenuItem() = 0; + + wxMenuItem* GetWXPeer() { return m_peer ; } + + static wxMenuItemImpl* Create( wxMenuItem* peer, wxMenu *pParentMenu, + int id, + const wxString& text, + wxAcceleratorEntry *entry, + const wxString& strHelp, + wxItemKind kind, + wxMenu *pSubMenu ); + + // handle OS specific menu items if they weren't handled during normal processing + virtual bool DoDefault() { return false; } +protected : + wxMenuItem* m_peer; + + wxDECLARE_ABSTRACT_CLASS(wxMenuItemImpl); +} ; + +class wxMenuImpl : public wxObject +{ +public : + wxMenuImpl( wxMenu* peer ) : m_peer(peer) + { + } + + virtual ~wxMenuImpl() ; + virtual void InsertOrAppend(wxMenuItem *pItem, size_t pos) = 0; + virtual void Remove( wxMenuItem *pItem ) = 0; + + virtual void MakeRoot() = 0; + + virtual void SetTitle( const wxString& text ) = 0; + + virtual WXHMENU GetHMenu() = 0; + + wxMenu* GetWXPeer() { return m_peer ; } + + virtual void PopUp( wxWindow *win, int x, int y ) = 0; + + virtual void GetMenuBarDimensions(int &x, int &y, int &width, int &height) const + { + x = y = width = height = -1; + } + + static wxMenuImpl* Create( wxMenu* peer, const wxString& title ); + static wxMenuImpl* CreateRootMenu( wxMenu* peer ); +protected : + wxMenu* m_peer; + + wxDECLARE_ABSTRACT_CLASS(wxMenuImpl); +} ; +#endif + + +class WXDLLIMPEXP_CORE wxWidgetImpl : public wxObject +{ +public : + enum WidgetFlags + { + Widget_IsRoot = 0x0001, + Widget_IsUserPane = 0x0002, + Widget_UserKeyEvents = 0x0004, + Widget_UserMouseEvents = 0x0008, + }; + + wxWidgetImpl( wxWindowMac* peer , bool isRootControl, bool isUserPane, bool wantsUserKey ); + wxWidgetImpl( wxWindowMac* peer , int flags = 0 ); + wxWidgetImpl(); + virtual ~wxWidgetImpl(); + + void Init(); + + bool IsRootControl() const { return m_isRootControl; } + + // is a custom control that has all events handled in wx code, no built-ins + bool IsUserPane() const { return m_isUserPane; } + + // we are doing keyboard handling in wx code, other events might be handled natively + virtual bool HasUserKeyHandling() const { return m_wantsUserKey; } + + // we are doing mouse handling in wx code, other events might be handled natively + virtual bool HasUserMouseHandling() const { return m_wantsUserMouse; } + + wxWindowMac* GetWXPeer() const { return m_wxPeer; } + + bool IsOk() const { return GetWXWidget() != NULL; } + + // not only the control itself, but also all its parents must be visible + // in order for this function to return true + virtual bool IsVisible() const = 0; + // set the visibility of this widget (maybe latent) + virtual void SetVisibility( bool visible ) = 0; + + virtual bool ShowWithEffect(bool WXUNUSED(show), + wxShowEffect WXUNUSED(effect), + unsigned WXUNUSED(timeout)) + { + return false; + } + + virtual void Raise() = 0; + + virtual void Lower() = 0; + + virtual void ScrollRect( const wxRect *rect, int dx, int dy ) = 0; + + virtual WXWidget GetWXWidget() const = 0; + + virtual void SetBackgroundColour( const wxColour& col ) = 0; + virtual bool SetBackgroundStyle(wxBackgroundStyle style) = 0; + virtual void SetForegroundColour( const wxColour& col ) = 0; + + // all coordinates in native parent widget relative coordinates + virtual void GetContentArea( int &left , int &top , int &width , int &height ) const = 0; + virtual void Move(int x, int y, int width, int height) = 0; + virtual void GetPosition( int &x, int &y ) const = 0; + virtual void GetSize( int &width, int &height ) const = 0; + virtual void SetControlSize( wxWindowVariant variant ) = 0; + virtual double GetContentScaleFactor() const + { + return 1.0; + } + + // the native coordinates may have an 'aura' for shadows etc, if this is the case the layout + // inset indicates on which insets the real control is drawn + virtual void GetLayoutInset(int &left , int &top , int &right, int &bottom) const + { + left = top = right = bottom = 0; + } + + // native view coordinates are topleft to bottom right (flipped regarding CoreGraphics origin) + virtual bool IsFlipped() const { return true; } + + virtual void SetNeedsDisplay( const wxRect* where = NULL ) = 0; + virtual bool GetNeedsDisplay() const = 0; + + virtual void EnableFocusRing(bool WXUNUSED(enabled)) {} + + virtual bool NeedsFrame() const; + virtual void SetNeedsFrame( bool needs ); + + virtual void SetDrawingEnabled(bool enabled); + + virtual bool CanFocus() const = 0; + // return true if successful + virtual bool SetFocus() = 0; + virtual bool HasFocus() const = 0; + + virtual void RemoveFromParent() = 0; + virtual void Embed( wxWidgetImpl *parent ) = 0; + + virtual void SetDefaultButton( bool isDefault ) = 0; + virtual void PerformClick() = 0; + virtual void SetLabel( const wxString& title, wxFontEncoding encoding ) = 0; +#if wxUSE_MARKUP && wxOSX_USE_COCOA + virtual void SetLabelMarkup( const wxString& WXUNUSED(markup) ) { } +#endif + virtual void SetInitialLabel( const wxString& title, wxFontEncoding encoding ) + { SetLabel(title, encoding); } + + virtual void SetCursor( const wxCursor & cursor ) = 0; + virtual void CaptureMouse() = 0; + virtual void ReleaseMouse() = 0; + + virtual void SetDropTarget( wxDropTarget * WXUNUSED(dropTarget) ) {} + + virtual wxInt32 GetValue() const = 0; + virtual void SetValue( wxInt32 v ) = 0; + virtual wxBitmap GetBitmap() const = 0; + virtual void SetBitmap( const wxBitmapBundle& bitmap ) = 0; + virtual void SetBitmapPosition( wxDirection dir ) = 0; + virtual void SetupTabs( const wxNotebook& WXUNUSED(notebook) ) {} + virtual int TabHitTest( const wxPoint & WXUNUSED(pt), long *flags ) {*flags=1; return -1;} + virtual void GetBestRect( wxRect *r ) const = 0; + virtual bool IsEnabled() const = 0; + virtual void Enable( bool enable ) = 0; + virtual void SetMinimum( wxInt32 v ) = 0; + virtual void SetMaximum( wxInt32 v ) = 0; + virtual void SetIncrement(int value) = 0; + virtual wxInt32 GetMinimum() const = 0; + virtual wxInt32 GetMaximum() const = 0; + virtual int GetIncrement() const = 0; + virtual void PulseGauge() = 0; + virtual void SetScrollThumb( wxInt32 value, wxInt32 thumbSize ) = 0; + + virtual void SetFont(const wxFont & font) = 0; + + virtual void SetToolTip(wxToolTip* WXUNUSED(tooltip)) { } + + // is the clicked event sent AFTER the state already changed, so no additional + // state changing logic is required from the outside + virtual bool ButtonClickDidStateChange() = 0; + + virtual void InstallEventHandler( WXWidget control = NULL ) = 0; + + virtual bool EnableTouchEvents(int eventsMask) = 0; + + // scrolling views need a clip subview that acts as parent for native children + // (except for the scollbars) which are children of the view itself + virtual void AdjustClippingView(wxScrollBar* horizontal, wxScrollBar* vertical); + virtual void UseClippingView(bool clip); + + // returns native view which acts as a parent for native children + virtual WXWidget GetContainer() const; + + // Mechanism used to keep track of whether a change should send an event + // Do SendEvents(false) when starting actions that would trigger programmatic events + // and SendEvents(true) at the end of the block. + virtual void SendEvents(bool shouldSendEvents) { m_shouldSendEvents = shouldSendEvents; } + virtual bool ShouldSendEvents() { return m_shouldSendEvents; } + + // static methods for associating native controls and their implementations + + // finds the impl associated with this native control + static wxWidgetImpl* + FindFromWXWidget(WXWidget control); + + // finds the impl associated with this native control, if the native control itself is not known + // also checks whether its parent is eg a registered scrollview, ie whether the control is a native subpart + // of a known control + static wxWidgetImpl* + FindBestFromWXWidget(WXWidget control); + + static void RemoveAssociations( wxWidgetImpl* impl); + static void RemoveAssociation(WXWidget control); + + static void Associate( WXWidget control, wxWidgetImpl *impl ); + + static WXWidget FindFocus(); + + // static creation methods, must be implemented by all toolkits + + static wxWidgetImplType* CreateUserPane( wxWindowMac* wxpeer, + wxWindowMac* parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + long extraStyle) ; + static wxWidgetImplType* CreateContentView( wxNonOwnedWindow* now ) ; + + static wxWidgetImplType* CreateButton( wxWindowMac* wxpeer, + wxWindowMac* parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos, + const wxSize& size, + long style, + long extraStyle) ; + + static wxWidgetImplType* CreateDisclosureTriangle( wxWindowMac* wxpeer, + wxWindowMac* parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos, + const wxSize& size, + long style, + long extraStyle) ; + + static wxWidgetImplType* CreateStaticLine( wxWindowMac* wxpeer, + wxWindowMac* parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + long extraStyle) ; + + static wxWidgetImplType* CreateGroupBox( wxWindowMac* wxpeer, + wxWindowMac* parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos, + const wxSize& size, + long style, + long extraStyle) ; + + static wxWidgetImplType* CreateStaticText( wxWindowMac* wxpeer, + wxWindowMac* parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos, + const wxSize& size, + long style, + long extraStyle) ; + + static wxWidgetImplType* CreateTextControl( wxTextCtrl* wxpeer, + wxWindowMac* parent, + wxWindowID id, + const wxString& content, + const wxPoint& pos, + const wxSize& size, + long style, + long extraStyle) ; + + static wxWidgetImplType* CreateSearchControl( wxSearchCtrl* wxpeer, + wxWindowMac* parent, + wxWindowID id, + const wxString& content, + const wxPoint& pos, + const wxSize& size, + long style, + long extraStyle) ; + + static wxWidgetImplType* CreateCheckBox( wxWindowMac* wxpeer, + wxWindowMac* parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos, + const wxSize& size, + long style, + long extraStyle); + + static wxWidgetImplType* CreateRadioButton( wxWindowMac* wxpeer, + wxWindowMac* parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos, + const wxSize& size, + long style, + long extraStyle); + + static wxWidgetImplType* CreateToggleButton( wxWindowMac* wxpeer, + wxWindowMac* parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos, + const wxSize& size, + long style, + long extraStyle); + + static wxWidgetImplType* CreateBitmapToggleButton( wxWindowMac* wxpeer, + wxWindowMac* parent, + wxWindowID id, + const wxBitmapBundle& bitmap, + const wxPoint& pos, + const wxSize& size, + long style, + long extraStyle); + + static wxWidgetImplType* CreateBitmapButton( wxWindowMac* wxpeer, + wxWindowMac* parent, + wxWindowID id, + const wxBitmapBundle& bitmap, + const wxPoint& pos, + const wxSize& size, + long style, + long extraStyle); + + static wxWidgetImplType* CreateTabView( wxWindowMac* wxpeer, + wxWindowMac* parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + long extraStyle); + + static wxWidgetImplType* CreateGauge( wxWindowMac* wxpeer, + wxWindowMac* parent, + wxWindowID id, + wxInt32 value, + wxInt32 minimum, + wxInt32 maximum, + const wxPoint& pos, + const wxSize& size, + long style, + long extraStyle); + + static wxWidgetImplType* CreateSlider( wxWindowMac* wxpeer, + wxWindowMac* parent, + wxWindowID id, + wxInt32 value, + wxInt32 minimum, + wxInt32 maximum, + const wxPoint& pos, + const wxSize& size, + long style, + long extraStyle); + + static wxWidgetImplType* CreateSpinButton( wxWindowMac* wxpeer, + wxWindowMac* parent, + wxWindowID id, + wxInt32 value, + wxInt32 minimum, + wxInt32 maximum, + const wxPoint& pos, + const wxSize& size, + long style, + long extraStyle); + + static wxWidgetImplType* CreateScrollBar( wxWindowMac* wxpeer, + wxWindowMac* parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + long extraStyle); + + static wxWidgetImplType* CreateChoice( wxWindowMac* wxpeer, + wxWindowMac* parent, + wxWindowID id, + wxMenu* menu, + const wxPoint& pos, + const wxSize& size, + long style, + long extraStyle); + + static wxWidgetImplType* CreateListBox( wxWindowMac* wxpeer, + wxWindowMac* parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + long extraStyle); + +#if wxOSX_USE_COCOA + static wxWidgetImplType* CreateComboBox( wxComboBox* wxpeer, + wxWindowMac* parent, + wxWindowID id, + wxMenu* menu, + const wxPoint& pos, + const wxSize& size, + long style, + long extraStyle); +#endif + + static wxWidgetImplType* CreateStaticBitmap( wxWindowMac* wxpeer, + wxWindowMac* parent, + wxWindowID id, + const wxBitmapBundle& bitmap, + const wxPoint& pos, + const wxSize& size, + long style, + long extraStyle); + + // converts from Toplevel-Content relative to local + static void Convert( wxPoint *pt , wxWidgetImpl *from , wxWidgetImpl *to ); +protected : + bool m_isRootControl; + bool m_isUserPane; + bool m_wantsUserKey; + bool m_wantsUserMouse; + wxWindowMac* m_wxPeer; + bool m_needsFrame; + bool m_shouldSendEvents; + + wxDECLARE_ABSTRACT_CLASS(wxWidgetImpl); +}; + +// +// the interface to be implemented eg by a listbox +// + +class WXDLLIMPEXP_CORE wxListWidgetColumn +{ +public : + virtual ~wxListWidgetColumn() {} +} ; + +class WXDLLIMPEXP_CORE wxListWidgetCellValue +{ +public : + wxListWidgetCellValue() {} + virtual ~wxListWidgetCellValue() {} + + virtual void Set( CFStringRef value ) = 0; + virtual void Set( const wxString& value ) = 0; + virtual void Set( int value ) = 0; + virtual void Check( bool check ); + + virtual bool IsChecked() const; + virtual int GetIntValue() const = 0; + virtual wxString GetStringValue() const = 0; +} ; + +class WXDLLIMPEXP_CORE wxListWidgetImpl +{ +public: + wxListWidgetImpl() {} + virtual ~wxListWidgetImpl() { } + + virtual wxListWidgetColumn* InsertTextColumn( unsigned pos, const wxString& title, bool editable = false, + wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) = 0 ; + virtual wxListWidgetColumn* InsertCheckColumn( unsigned pos , const wxString& title, bool editable = false, + wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) = 0 ; + + // add and remove + + // TODO will be replaced + virtual void ListDelete( unsigned int n ) = 0; + virtual void ListInsert( unsigned int n ) = 0; + virtual void ListClear() = 0; + + // selecting + + virtual void ListDeselectAll() = 0; + virtual void ListSetSelection( unsigned int n, bool select, bool multi ) = 0; + virtual int ListGetSelection() const = 0; + virtual int ListGetSelections( wxArrayInt& aSelections ) const = 0; + virtual bool ListIsSelected( unsigned int n ) const = 0; + + // display + + virtual void ListScrollTo( unsigned int n ) = 0; + virtual int ListGetTopItem() const = 0; + virtual int ListGetCountPerPage() const = 0; + virtual void UpdateLine( unsigned int n, wxListWidgetColumn* col = NULL ) = 0; + virtual void UpdateLineToEnd( unsigned int n) = 0; + + // accessing content + + virtual unsigned int ListGetCount() const = 0; + + virtual int DoListHitTest( const wxPoint& inpoint ) const = 0; +}; + +// +// interface to be implemented by a textcontrol +// + +class WXDLLIMPEXP_FWD_CORE wxTextAttr; +class WXDLLIMPEXP_FWD_CORE wxTextEntry; + +// common interface for all implementations +class WXDLLIMPEXP_CORE wxTextWidgetImpl + +{ +public : + // Any widgets implementing this interface must be associated with a + // wxTextEntry so instead of requiring the derived classes to implement + // another (pure) virtual function, just take the pointer to this entry in + // our ctor and implement GetTextEntry() ourselves. + wxTextWidgetImpl(wxTextEntry *entry) : m_entry(entry) {} + + virtual ~wxTextWidgetImpl() {} + + wxTextEntry *GetTextEntry() const { return m_entry; } + + virtual bool CanFocus() const { return true; } + + virtual wxString GetStringValue() const = 0 ; + virtual void SetStringValue( const wxString &val ) = 0 ; + virtual void SetSelection( long from, long to ) = 0 ; + virtual void GetSelection( long* from, long* to ) const = 0 ; + virtual void WriteText( const wxString& str ) = 0 ; + + virtual bool CanClipMaxLength() const { return false; } + virtual void SetMaxLength(unsigned long WXUNUSED(len)) {} + + virtual bool CanForceUpper() { return false; } + virtual void ForceUpper() {} + + virtual bool GetStyle( long position, wxTextAttr& style); + virtual void SetStyle( long start, long end, const wxTextAttr& style ) ; + virtual void Copy() ; + virtual void Cut() ; + virtual void Paste() ; + virtual bool CanPaste() const ; + virtual void SetEditable( bool editable ) ; + virtual long GetLastPosition() const ; + virtual void Replace( long from, long to, const wxString &str ) ; + virtual void Remove( long from, long to ) ; + + + virtual bool HasOwnContextMenu() const + { return false ; } + + virtual bool SetupCursor( const wxPoint& WXUNUSED(pt) ) + { return false ; } + + virtual void Clear() ; + virtual bool CanUndo() const; + virtual void Undo() ; + virtual bool CanRedo() const; + virtual void Redo() ; + virtual void EmptyUndoBuffer() ; + virtual int GetNumberOfLines() const ; + virtual long XYToPosition(long x, long y) const; + virtual bool PositionToXY(long pos, long *x, long *y) const ; + virtual void ShowPosition(long pos) ; + virtual int GetLineLength(long lineNo) const ; + virtual wxString GetLineText(long lineNo) const ; +#if wxUSE_SPELLCHECK + virtual void CheckSpelling(const wxTextProofOptions& WXUNUSED(options)) { } + virtual wxTextProofOptions GetCheckingOptions() const; +#endif // wxUSE_SPELLCHECK + virtual void EnableAutomaticQuoteSubstitution(bool WXUNUSED(enable)) {} + virtual void EnableAutomaticDashSubstitution(bool WXUNUSED(enable)) {} + + virtual void EnableNewLineReplacement(bool WXUNUSED(enable)) {} + virtual bool GetNewLineReplacement() { return true; } + virtual wxSize GetBestSize() const { return wxDefaultSize; } + + virtual bool SetHint(const wxString& WXUNUSED(hint)) { return false; } + virtual void SetJustification(); +private: + wxTextEntry * const m_entry; + + wxDECLARE_NO_COPY_CLASS(wxTextWidgetImpl); +}; + +// common interface for all combobox implementations +class WXDLLIMPEXP_CORE wxComboWidgetImpl + +{ +public : + wxComboWidgetImpl() {} + + virtual ~wxComboWidgetImpl() {} + + virtual int GetSelectedItem() const { return -1; } + virtual void SetSelectedItem(int WXUNUSED(item)) {} + + virtual int GetNumberOfItems() const { return -1; } + + virtual void InsertItem(int WXUNUSED(pos), const wxString& WXUNUSED(item)) {} + + virtual void RemoveItem(int WXUNUSED(pos)) {} + + virtual void Clear() {} + virtual void Popup() {} + virtual void Dismiss() {} + + virtual wxString GetStringAtIndex(int WXUNUSED(pos)) const { return wxEmptyString; } + + virtual int FindString(const wxString& WXUNUSED(text)) const { return -1; } +}; + +// +// common interface for choice +// + +class WXDLLIMPEXP_CORE wxChoiceWidgetImpl + +{ +public : + wxChoiceWidgetImpl() {} + + virtual ~wxChoiceWidgetImpl() {} + + virtual int GetSelectedItem() const { return -1; } + + virtual void SetSelectedItem(int WXUNUSED(item)) {} + + virtual size_t GetNumberOfItems() const = 0; + + virtual void InsertItem(size_t pos, int itemid, const wxString& text) = 0; + + virtual void RemoveItem(size_t pos) = 0; + + virtual void Clear() + { + size_t count = GetNumberOfItems(); + for ( size_t i = 0 ; i < count ; i++ ) + { + RemoveItem( 0 ); + } + } + + virtual void SetItem(int pos, const wxString& item) = 0; +}; + + +// +// common interface for buttons +// + +class wxButtonImpl +{ + public : + wxButtonImpl(){} + virtual ~wxButtonImpl(){} + + virtual void SetPressedBitmap( const wxBitmapBundle& bitmap ) = 0; +} ; + +// +// common interface for search controls +// + +class wxSearchWidgetImpl +{ +public : + wxSearchWidgetImpl(){} + virtual ~wxSearchWidgetImpl(){} + + // search field options + virtual void ShowSearchButton( bool show ) = 0; + virtual bool IsSearchButtonVisible() const = 0; + + virtual void ShowCancelButton( bool show ) = 0; + virtual bool IsCancelButtonVisible() const = 0; + + virtual void SetSearchMenu( wxMenu* menu ) = 0; + + virtual void SetDescriptiveText(const wxString& text) = 0; +} ; + +// +// toplevel window implementation class +// + +class wxNonOwnedWindowImpl : public wxObject +{ +public : + wxNonOwnedWindowImpl( wxNonOwnedWindow* nonownedwnd) : m_wxPeer(nonownedwnd) + { + } + wxNonOwnedWindowImpl() + { + } + virtual ~wxNonOwnedWindowImpl() + { + } + + virtual void WillBeDestroyed() + { + } + + virtual void Create( wxWindow* parent, const wxPoint& pos, const wxSize& size, + long style, long extraStyle, const wxString& name ) = 0; + + + virtual WXWindow GetWXWindow() const = 0; + + virtual void Raise() + { + } + + virtual void Lower() + { + } + + virtual bool Show(bool WXUNUSED(show)) + { + return false; + } + + virtual bool ShowWithEffect(bool show, wxShowEffect WXUNUSED(effect), unsigned WXUNUSED(timeout)) + { + return Show(show); + } + + virtual void Update() + { + } + + virtual bool SetTransparent(wxByte WXUNUSED(alpha)) + { + return false; + } + + virtual bool SetBackgroundColour(const wxColour& WXUNUSED(col) ) + { + return false; + } + + virtual void SetExtraStyle( long WXUNUSED(exStyle) ) + { + } + + virtual void SetWindowStyleFlag( long WXUNUSED(style) ) + { + } + + virtual bool SetBackgroundStyle(wxBackgroundStyle WXUNUSED(style)) + { + return false ; + } + + virtual bool CanSetTransparent() + { + return false; + } + + virtual void GetContentArea( int &left , int &top , int &width , int &height ) const = 0; + virtual void MoveWindow(int x, int y, int width, int height) = 0; + virtual void GetPosition( int &x, int &y ) const = 0; + virtual void GetSize( int &width, int &height ) const = 0; + + virtual bool SetShape(const wxRegion& WXUNUSED(region)) + { + return false; + } + + virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) = 0; + + virtual bool EnableCloseButton(bool enable) = 0; + virtual bool EnableMaximizeButton(bool enable) = 0; + virtual bool EnableMinimizeButton(bool enable) = 0; + + virtual bool IsMaximized() const = 0; + + virtual bool IsIconized() const= 0; + + virtual void Iconize( bool iconize )= 0; + + virtual void Maximize(bool maximize) = 0; + + virtual bool IsFullScreen() const= 0; + + virtual void ShowWithoutActivating() { Show(true); } + + virtual bool EnableFullScreenView(bool enable, long style) = 0; + + virtual bool ShowFullScreen(bool show, long style)= 0; + + virtual wxContentProtection GetContentProtection() const = 0; + virtual bool SetContentProtection(wxContentProtection contentProtection) = 0; + + virtual void RequestUserAttention(int flags) = 0; + + virtual void ScreenToWindow( int *x, int *y ) = 0; + + virtual void WindowToScreen( int *x, int *y ) = 0; + + virtual bool IsActive() = 0; + + wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; } + + static wxNonOwnedWindowImpl* + FindFromWXWindow(WXWindow window); + + static void RemoveAssociations( wxNonOwnedWindowImpl* impl); + + static void Associate( WXWindow window, wxNonOwnedWindowImpl *impl ); + + // static creation methods, must be implemented by all toolkits + + static wxNonOwnedWindowImpl* CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, WXWindow native) ; + + static wxNonOwnedWindowImpl* CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size, + long style, long extraStyle, const wxString& name ) ; + + virtual void SetModified(bool WXUNUSED(modified)) { } + virtual bool IsModified() const { return false; } + + virtual void SetRepresentedFilename(const wxString& WXUNUSED(filename)) { } + + virtual void SetBottomBorderThickness(int WXUNUSED(thickness)) { } + +#if wxOSX_USE_IPHONE + virtual CGFloat GetWindowLevel() const { return 0.0; } +#else + virtual CGWindowLevel GetWindowLevel() const { return kCGNormalWindowLevel; } +#endif + virtual void RestoreWindowLevel() {} +protected : + wxNonOwnedWindow* m_wxPeer; + wxDECLARE_ABSTRACT_CLASS(wxNonOwnedWindowImpl); +}; + +#endif // wxUSE_GUI + +//--------------------------------------------------------------------------- +// cocoa bridging utilities +//--------------------------------------------------------------------------- + +bool wxMacInitCocoa(); + +class WXDLLIMPEXP_CORE wxMacAutoreleasePool +{ +public : + wxMacAutoreleasePool(); + ~wxMacAutoreleasePool(); +private : + void* m_pool; +}; + +// NSObject + +void wxMacCocoaRelease( void* obj ); +void wxMacCocoaAutorelease( void* obj ); +void* wxMacCocoaRetain( void* obj ); + +// shared_ptr like API for NSObject and subclasses +template <class T> +class wxNSObjRef +{ +public: + typedef T element_type; + + wxNSObjRef() + : m_ptr(NULL) + { + } + + wxNSObjRef( T p ) + : m_ptr(p) + { + } + + wxNSObjRef( const wxNSObjRef& otherRef ) + : m_ptr(wxMacCocoaRetain(otherRef.m_ptr)) + { + } + + wxNSObjRef& operator=( const wxNSObjRef& otherRef ) + { + if (this != &otherRef) + { + wxMacCocoaRetain(otherRef.m_ptr); + wxMacCocoaRelease(m_ptr); + m_ptr = otherRef.m_ptr; + } + return *this; + } + + wxNSObjRef& operator=( T ptr ) + { + if (get() != ptr) + { + wxMacCocoaRetain(ptr); + wxMacCocoaRelease(m_ptr); + m_ptr = ptr; + } + return *this; + } + + + T get() const + { + return m_ptr; + } + + operator T() const + { + return m_ptr; + } + + T operator->() const + { + return m_ptr; + } + + void reset( T p = NULL ) + { + wxMacCocoaRelease(m_ptr); + m_ptr = p; // Automatic conversion should occur + } + + // Release the pointer, i.e. give up its ownership. + T release() + { + T p = m_ptr; + m_ptr = NULL; + return p; + } + +protected: + T m_ptr; +}; + +// This macro checks if the evaluation of cond, having a return value of +// OS Error type, is zero, ie no error occurred, and calls the assert handler +// with the provided message if it isn't. +#define wxOSX_VERIFY_NOERR(cond) \ + wxSTATEMENT_MACRO_BEGIN \ + const unsigned long evalOnce = (cond); \ + if ( evalOnce != 0 ) \ + { \ + wxFAIL_COND_MSG(#cond, GetMacOSStatusErrorString(evalOnce)); \ + } \ + wxSTATEMENT_MACRO_END + +#endif + // _WX_PRIVATE_CORE_H_ diff --git a/lib/wxWidgets/include/wx/osx/core/private/datetimectrl.h b/lib/wxWidgets/include/wx/osx/core/private/datetimectrl.h new file mode 100644 index 0000000..213e047 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/core/private/datetimectrl.h @@ -0,0 +1,64 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/core/private/datetime.h +// Purpose: +// Author: Vadim Zeitlin +// Created: 2011-12-19 +// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_CORE_PRIVATE_DATETIMECTRL_H_ +#define _WX_OSX_CORE_PRIVATE_DATETIMECTRL_H_ + +#if wxUSE_DATEPICKCTRL + +#include "wx/osx/private.h" + +#include "wx/datetime.h" + +enum wxDateTimeWidgetKind +{ + wxDateTimeWidget_YearMonthDay, + wxDateTimeWidget_HourMinuteSecond +}; + +// ---------------------------------------------------------------------------- +// wxDateTimeWidgetImpl: peer class for wxDateTimePickerCtrl. +// ---------------------------------------------------------------------------- + +class wxDateTimeWidgetImpl +#if wxOSX_USE_COCOA + : public wxWidgetCocoaImpl +#else + #error "Unsupported platform" +#endif +{ +public: + static wxDateTimeWidgetImpl* + CreateDateTimePicker(wxDateTimePickerCtrl* wxpeer, + const wxDateTime& dt, + const wxPoint& pos, + const wxSize& size, + long style, + wxDateTimeWidgetKind kind); + + virtual void SetDateTime(const wxDateTime& dt) = 0; + virtual wxDateTime GetDateTime() const = 0; + + virtual void SetDateRange(const wxDateTime& dt1, const wxDateTime& dt2) = 0; + virtual bool GetDateRange(wxDateTime* dt1, wxDateTime* dt2) = 0; + + virtual ~wxDateTimeWidgetImpl() { } + +protected: +#if wxOSX_USE_COCOA + wxDateTimeWidgetImpl(wxDateTimePickerCtrl* wxpeer, WXWidget view) + : wxWidgetCocoaImpl(wxpeer, view) + { + } +#endif +}; + +#endif // wxUSE_DATEPICKCTRL + +#endif // _WX_OSX_CORE_PRIVATE_DATETIMECTRL_H_ diff --git a/lib/wxWidgets/include/wx/osx/core/private/strconv_cf.h b/lib/wxWidgets/include/wx/osx/core/private/strconv_cf.h new file mode 100644 index 0000000..e61b5a0 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/core/private/strconv_cf.h @@ -0,0 +1,374 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/core/private/strconv_cf.h +// Purpose: Unicode conversion classes +// Author: David Elliott, Ryan Norton +// Modified by: +// Created: 2007-07-06 +// Copyright: (c) 2004 Ryan Norton +// (c) 2007 David Elliott +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include "wx/strconv.h" + +#include <CoreFoundation/CFString.h> +#include <CoreFoundation/CFStringEncodingExt.h> +#include "wx/fontmap.h" + +// ============================================================================ +// CoreFoundation conversion classes +// ============================================================================ + +inline CFStringEncoding wxCFStringEncFromFontEnc(wxFontEncoding encoding) +{ + CFStringEncoding enc = kCFStringEncodingInvalidId ; + + switch (encoding) + { + case wxFONTENCODING_DEFAULT : + enc = CFStringGetSystemEncoding(); + break ; + + case wxFONTENCODING_ISO8859_1 : + enc = kCFStringEncodingISOLatin1 ; + break ; + case wxFONTENCODING_ISO8859_2 : + enc = kCFStringEncodingISOLatin2; + break ; + case wxFONTENCODING_ISO8859_3 : + enc = kCFStringEncodingISOLatin3 ; + break ; + case wxFONTENCODING_ISO8859_4 : + enc = kCFStringEncodingISOLatin4; + break ; + case wxFONTENCODING_ISO8859_5 : + enc = kCFStringEncodingISOLatinCyrillic; + break ; + case wxFONTENCODING_ISO8859_6 : + enc = kCFStringEncodingISOLatinArabic; + break ; + case wxFONTENCODING_ISO8859_7 : + enc = kCFStringEncodingISOLatinGreek; + break ; + case wxFONTENCODING_ISO8859_8 : + enc = kCFStringEncodingISOLatinHebrew; + break ; + case wxFONTENCODING_ISO8859_9 : + enc = kCFStringEncodingISOLatin5; + break ; + case wxFONTENCODING_ISO8859_10 : + enc = kCFStringEncodingISOLatin6; + break ; + case wxFONTENCODING_ISO8859_11 : + enc = kCFStringEncodingISOLatinThai; + break ; + case wxFONTENCODING_ISO8859_13 : + enc = kCFStringEncodingISOLatin7; + break ; + case wxFONTENCODING_ISO8859_14 : + enc = kCFStringEncodingISOLatin8; + break ; + case wxFONTENCODING_ISO8859_15 : + enc = kCFStringEncodingISOLatin9; + break ; + + case wxFONTENCODING_KOI8 : + enc = kCFStringEncodingKOI8_R; + break ; + case wxFONTENCODING_ALTERNATIVE : // MS-DOS CP866 + enc = kCFStringEncodingDOSRussian; + break ; + +// case wxFONTENCODING_BULGARIAN : +// enc = ; +// break ; + + case wxFONTENCODING_CP437 : + enc = kCFStringEncodingDOSLatinUS ; + break ; + case wxFONTENCODING_CP850 : + enc = kCFStringEncodingDOSLatin1; + break ; + case wxFONTENCODING_CP852 : + enc = kCFStringEncodingDOSLatin2; + break ; + case wxFONTENCODING_CP855 : + enc = kCFStringEncodingDOSCyrillic; + break ; + case wxFONTENCODING_CP866 : + enc = kCFStringEncodingDOSRussian ; + break ; + case wxFONTENCODING_CP874 : + enc = kCFStringEncodingDOSThai; + break ; + case wxFONTENCODING_CP932 : + enc = kCFStringEncodingDOSJapanese; + break ; + case wxFONTENCODING_CP936 : + enc = kCFStringEncodingDOSChineseSimplif ; + break ; + case wxFONTENCODING_CP949 : + enc = kCFStringEncodingDOSKorean; + break ; + case wxFONTENCODING_CP950 : + enc = kCFStringEncodingDOSChineseTrad; + break ; + case wxFONTENCODING_CP1250 : + enc = kCFStringEncodingWindowsLatin2; + break ; + case wxFONTENCODING_CP1251 : + enc = kCFStringEncodingWindowsCyrillic ; + break ; + case wxFONTENCODING_CP1252 : + enc = kCFStringEncodingWindowsLatin1 ; + break ; + case wxFONTENCODING_CP1253 : + enc = kCFStringEncodingWindowsGreek; + break ; + case wxFONTENCODING_CP1254 : + enc = kCFStringEncodingWindowsLatin5; + break ; + case wxFONTENCODING_CP1255 : + enc = kCFStringEncodingWindowsHebrew ; + break ; + case wxFONTENCODING_CP1256 : + enc = kCFStringEncodingWindowsArabic ; + break ; + case wxFONTENCODING_CP1257 : + enc = kCFStringEncodingWindowsBalticRim; + break ; +// This only really encodes to UTF7 (if that) evidently +// case wxFONTENCODING_UTF7 : +// enc = kCFStringEncodingNonLossyASCII ; +// break ; + case wxFONTENCODING_UTF8 : + enc = kCFStringEncodingUTF8 ; + break ; + case wxFONTENCODING_EUC_JP : + enc = kCFStringEncodingEUC_JP; + break ; +/* Don't support conversion to/from UTF16 as wxWidgets can do this better. + * In particular, ToWChar would fail miserably using strlen on an input UTF16. + case wxFONTENCODING_UTF16 : + enc = kCFStringEncodingUnicode ; + break ; +*/ + case wxFONTENCODING_MACROMAN : + enc = kCFStringEncodingMacRoman ; + break ; + case wxFONTENCODING_MACJAPANESE : + enc = kCFStringEncodingMacJapanese ; + break ; + case wxFONTENCODING_MACCHINESETRAD : + enc = kCFStringEncodingMacChineseTrad ; + break ; + case wxFONTENCODING_MACKOREAN : + enc = kCFStringEncodingMacKorean ; + break ; + case wxFONTENCODING_MACARABIC : + enc = kCFStringEncodingMacArabic ; + break ; + case wxFONTENCODING_MACHEBREW : + enc = kCFStringEncodingMacHebrew ; + break ; + case wxFONTENCODING_MACGREEK : + enc = kCFStringEncodingMacGreek ; + break ; + case wxFONTENCODING_MACCYRILLIC : + enc = kCFStringEncodingMacCyrillic ; + break ; + case wxFONTENCODING_MACDEVANAGARI : + enc = kCFStringEncodingMacDevanagari ; + break ; + case wxFONTENCODING_MACGURMUKHI : + enc = kCFStringEncodingMacGurmukhi ; + break ; + case wxFONTENCODING_MACGUJARATI : + enc = kCFStringEncodingMacGujarati ; + break ; + case wxFONTENCODING_MACORIYA : + enc = kCFStringEncodingMacOriya ; + break ; + case wxFONTENCODING_MACBENGALI : + enc = kCFStringEncodingMacBengali ; + break ; + case wxFONTENCODING_MACTAMIL : + enc = kCFStringEncodingMacTamil ; + break ; + case wxFONTENCODING_MACTELUGU : + enc = kCFStringEncodingMacTelugu ; + break ; + case wxFONTENCODING_MACKANNADA : + enc = kCFStringEncodingMacKannada ; + break ; + case wxFONTENCODING_MACMALAJALAM : + enc = kCFStringEncodingMacMalayalam ; + break ; + case wxFONTENCODING_MACSINHALESE : + enc = kCFStringEncodingMacSinhalese ; + break ; + case wxFONTENCODING_MACBURMESE : + enc = kCFStringEncodingMacBurmese ; + break ; + case wxFONTENCODING_MACKHMER : + enc = kCFStringEncodingMacKhmer ; + break ; + case wxFONTENCODING_MACTHAI : + enc = kCFStringEncodingMacThai ; + break ; + case wxFONTENCODING_MACLAOTIAN : + enc = kCFStringEncodingMacLaotian ; + break ; + case wxFONTENCODING_MACGEORGIAN : + enc = kCFStringEncodingMacGeorgian ; + break ; + case wxFONTENCODING_MACARMENIAN : + enc = kCFStringEncodingMacArmenian ; + break ; + case wxFONTENCODING_MACCHINESESIMP : + enc = kCFStringEncodingMacChineseSimp ; + break ; + case wxFONTENCODING_MACTIBETAN : + enc = kCFStringEncodingMacTibetan ; + break ; + case wxFONTENCODING_MACMONGOLIAN : + enc = kCFStringEncodingMacMongolian ; + break ; + case wxFONTENCODING_MACETHIOPIC : + enc = kCFStringEncodingMacEthiopic ; + break ; + case wxFONTENCODING_MACCENTRALEUR : + enc = kCFStringEncodingMacCentralEurRoman ; + break ; + case wxFONTENCODING_MACVIATNAMESE : + enc = kCFStringEncodingMacVietnamese ; + break ; + case wxFONTENCODING_MACARABICEXT : + enc = kCFStringEncodingMacExtArabic ; + break ; + case wxFONTENCODING_MACSYMBOL : + enc = kCFStringEncodingMacSymbol ; + break ; + case wxFONTENCODING_MACDINGBATS : + enc = kCFStringEncodingMacDingbats ; + break ; + case wxFONTENCODING_MACTURKISH : + enc = kCFStringEncodingMacTurkish ; + break ; + case wxFONTENCODING_MACCROATIAN : + enc = kCFStringEncodingMacCroatian ; + break ; + case wxFONTENCODING_MACICELANDIC : + enc = kCFStringEncodingMacIcelandic ; + break ; + case wxFONTENCODING_MACROMANIAN : + enc = kCFStringEncodingMacRomanian ; + break ; + case wxFONTENCODING_MACCELTIC : + enc = kCFStringEncodingMacCeltic ; + break ; + case wxFONTENCODING_MACGAELIC : + enc = kCFStringEncodingMacGaelic ; + break ; + /* CFString is known to support this back to the original CarbonLib */ + /* http://developer.apple.com/samplecode/CarbonMDEF/listing2.html */ + case wxFONTENCODING_MACKEYBOARD : + /* We don't wish to pollute the namespace too much, even though we're a private header. */ + /* The constant is well-defined as 41 and is not expected to change. */ + enc = 41 /*kTextEncodingMacKeyboardGlyphs*/ ; + break ; + + default : + // because gcc is picky + break ; + } + + return enc ; +} + + +class wxMBConv_cf : public wxMBConv +{ +public: + enum NormalizationForm + { + None = 0x00, + FromWChar_D = 0x01, + ToWChar_C = 0x02 + }; + + wxMBConv_cf() + { + Init(CFStringGetSystemEncoding(), ToWChar_C) ; + } + + wxMBConv_cf(const wxMBConv_cf& conv) : wxMBConv() + { + m_encoding = conv.m_encoding; + m_normalization = conv.m_normalization; + } + +#if wxUSE_FONTMAP + wxMBConv_cf(const char* name, NormalizationForm normalization = ToWChar_C) + { + Init( wxCFStringEncFromFontEnc(wxFontMapperBase::Get()->CharsetToEncoding(name, false) ) , normalization) ; + } +#endif + + wxMBConv_cf(wxFontEncoding encoding, NormalizationForm normalization = ToWChar_C ) + { + Init( wxCFStringEncFromFontEnc(encoding) , normalization); + } + + virtual ~wxMBConv_cf() + { + } + + void Init( CFStringEncoding encoding, NormalizationForm normalization ) + { + m_encoding = encoding ; + m_normalization = normalization; + } + + virtual size_t ToWChar(wchar_t * dst, size_t dstSize, const char * src, size_t srcSize = wxNO_LEN) const wxOVERRIDE; + virtual size_t FromWChar(char *dst, size_t dstSize, const wchar_t *src, size_t srcSize = wxNO_LEN) const wxOVERRIDE; + + virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConv_cf(*this); } + + bool IsOk() const + { + return m_encoding != kCFStringEncodingInvalidId && + CFStringIsEncodingAvailable(m_encoding); + } + +private: + NormalizationForm m_normalization ; + CFStringEncoding m_encoding ; +}; + +// This "decomposing" converter is used as wxConvFileName in wxOSX. +class wxMBConvD_cf : public wxMBConv_cf +{ +public: + wxMBConvD_cf(wxFontEncoding encoding) : wxMBConv_cf(encoding, (NormalizationForm) (ToWChar_C | FromWChar_D) ) + { + } +}; + +// corresponding class for holding UniChars (native unicode characters) + +class WXDLLIMPEXP_BASE wxMacUniCharBuffer +{ + public : + wxMacUniCharBuffer( const wxString &str ) ; + + ~wxMacUniCharBuffer() ; + + UniCharPtr GetBuffer() ; + + UniCharCount GetChars() ; + + private : + UniCharPtr m_ubuf ; + UniCharCount m_chars ; +}; diff --git a/lib/wxWidgets/include/wx/osx/core/private/timer.h b/lib/wxWidgets/include/wx/osx/core/private/timer.h new file mode 100644 index 0000000..c23f955 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/core/private/timer.h @@ -0,0 +1,32 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/core/private/timer.h +// Purpose: wxTimer class based on core foundation +// Author: Stefan Csomor +// Created: 2008-07-16 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_CORE_PRIVATE_TIMER_H_ +#define _WX_OSX_CORE_PRIVATE_TIMER_H_ + +#include "wx/private/timer.h" + +struct wxOSXTimerInfo; + +class WXDLLIMPEXP_CORE wxOSXTimerImpl : public wxTimerImpl +{ +public: + wxOSXTimerImpl(wxTimer *timer); + virtual ~wxOSXTimerImpl(); + + virtual bool Start(int milliseconds = -1, bool one_shot = false) wxOVERRIDE; + virtual void Stop() wxOVERRIDE; + + virtual bool IsRunning() const wxOVERRIDE; + +private: + wxOSXTimerInfo *m_info; +}; + +#endif // _WX_OSX_CORE_PRIVATE_TIMER_H_ diff --git a/lib/wxWidgets/include/wx/osx/cursor.h b/lib/wxWidgets/include/wx/osx/cursor.h new file mode 100644 index 0000000..d01a643 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/cursor.h @@ -0,0 +1,55 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/cursor.h +// Purpose: wxCursor class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CURSOR_H_ +#define _WX_CURSOR_H_ + +#include "wx/bitmap.h" + +// Cursor +class WXDLLIMPEXP_CORE wxCursor : public wxCursorBase +{ +public: + wxCursor(); + +#if wxUSE_IMAGE + wxCursor(const wxImage & image) ; + wxCursor(const char* const* xpmData); +#endif // wxUSE_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(); + + void MacInstall() const ; + + void SetHCURSOR(WXHCURSOR cursor); + WXHCURSOR GetHCURSOR() const; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + +private: + void InitFromStock(wxStockCursor); + +#if wxUSE_IMAGE + void InitFromImage(const wxImage & image) ; +#endif // wxUSE_IMAGE + + wxDECLARE_DYNAMIC_CLASS(wxCursor); +}; + +#endif // _WX_CURSOR_H_ diff --git a/lib/wxWidgets/include/wx/osx/dataform.h b/lib/wxWidgets/include/wx/osx/dataform.h new file mode 100644 index 0000000..73f65f5 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/dataform.h @@ -0,0 +1,79 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/dataform.h +// Purpose: declaration of the wxDataFormat class +// Author: Stefan Csomor (lifted from dnd.h) +// Modified by: +// Created: 10/21/99 +// Copyright: (c) 1999 Stefan Csomor +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MAC_DATAFORM_H +#define _WX_MAC_DATAFORM_H + +#include "wx/osx/core/cfstring.h" + +class WXDLLIMPEXP_CORE wxDataFormat +{ +public: + typedef CFStringRef NativeFormat; + + wxDataFormat(); + wxDataFormat(wxDataFormatId vType); + wxDataFormat(const wxDataFormat& rFormat); + wxDataFormat(const wxString& rId); + wxDataFormat(const wxChar* pId); + wxDataFormat(NativeFormat vFormat); + ~wxDataFormat(); + + wxDataFormat& operator=(NativeFormat vFormat) + { SetId(vFormat); return *this; } + + // comparison (must have both versions) + bool operator==(const wxDataFormat& format) const ; + bool operator!=(const wxDataFormat& format) const + { return ! ( *this == format ); } + bool operator==(wxDataFormatId format) const + { return m_type == (wxDataFormatId)format; } + bool operator!=(wxDataFormatId format) const + { return m_type != (wxDataFormatId)format; } + + wxDataFormat& operator=(const wxDataFormat& format); + + // explicit and implicit conversions to NativeFormat which is one of + // standard data types (implicit conversion is useful for preserving the + // compatibility with old code) + NativeFormat GetFormatId() const { return m_format; } + operator NativeFormat() const { return m_format; } + + void SetId(NativeFormat format); + + // string ids are used for custom types - this SetId() must be used for + // application-specific formats + wxString GetId() const; + void SetId(const wxString& pId); + + // implementation + wxDataFormatId GetType() const { return m_type; } + void SetType( wxDataFormatId type ); + static NativeFormat GetFormatForType(wxDataFormatId type); + + // returns true if the format is one of those defined in wxDataFormatId + bool IsStandard() const { return m_type > 0 && m_type < wxDF_PRIVATE; } + + // adds all the native formats for this format when calling a GetData + void AddSupportedTypesForGetting(CFMutableArrayRef types) const; + + // adds all the native formats for this format when calling a SetData + void AddSupportedTypesForSetting(CFMutableArrayRef types) const; +private: + void DoAddSupportedTypes(CFMutableArrayRef types, bool forSetting) const; + + void ClearNativeFormat(); + + wxDataFormatId m_type; + wxString m_id; + wxCFStringRef m_format; +}; + +#endif // _WX_MAC_DATAFORM_H diff --git a/lib/wxWidgets/include/wx/osx/dataobj.h b/lib/wxWidgets/include/wx/osx/dataobj.h new file mode 100644 index 0000000..0ad2b4d --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/dataobj.h @@ -0,0 +1,41 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/dataobj.h +// Purpose: declaration of the wxDataObject +// Author: Stefan Csomor (adapted from Robert Roebling's gtk port) +// Modified by: +// Created: 10/21/99 +// Copyright: (c) 1998, 1999 Vadim Zeitlin, Robert Roebling +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MAC_DATAOBJ_H_ +#define _WX_MAC_DATAOBJ_H_ + +class WXDLLIMPEXP_CORE wxOSXDataSink; +class WXDLLIMPEXP_CORE wxOSXDataSource; + +class WXDLLIMPEXP_CORE wxDataObject : public wxDataObjectBase +{ +public: + wxDataObject(); + virtual ~wxDataObject() { } + + virtual bool IsSupportedFormat( const wxDataFormat& format, Direction dir = Get ) const; + + void WriteToSink(wxOSXDataSink *sink) const; + bool ReadFromSource(wxOSXDataSource *source); + bool ReadFromSource(wxDataObject *source); + bool CanReadFromSource(wxOSXDataSource *source) const; + bool CanReadFromSource(wxDataObject *source) const; + + wxDataFormat GetSupportedFormatInSource(wxOSXDataSource *source) const; + wxDataFormat GetSupportedFormatInSource(wxDataObject *source) const; + +#if wxOSX_USE_COCOA + // adds all the native formats (in descending order of preference) this data object supports + virtual void AddSupportedTypes( CFMutableArrayRef cfarray, Direction dir ) const; +#endif +}; + +#endif // _WX_MAC_DATAOBJ_H_ + diff --git a/lib/wxWidgets/include/wx/osx/dataobj2.h b/lib/wxWidgets/include/wx/osx/dataobj2.h new file mode 100644 index 0000000..46fdc48 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/dataobj2.h @@ -0,0 +1,92 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/dataobj2.h +// Purpose: declaration of standard wxDataObjectSimple-derived classes +// Author: David Webster (adapted from Robert Roebling's gtk port +// Modified by: +// Created: 10/21/99 +// Copyright: (c) 1998, 1999 Vadim Zeitlin, Robert Roebling +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MAC_DATAOBJ2_H_ +#define _WX_MAC_DATAOBJ2_H_ + +// ---------------------------------------------------------------------------- +// wxBitmapDataObject is a specialization of wxDataObject for bitmaps +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBitmapDataObject : public wxBitmapDataObjectBase +{ +public: + // ctors + wxBitmapDataObject(); + wxBitmapDataObject(const wxBitmap& bitmap); + + // destr + virtual ~wxBitmapDataObject(); + + // override base class virtual to update PNG data too + virtual void SetBitmap(const wxBitmap& bitmap) wxOVERRIDE; + + // implement base class pure virtuals + // ---------------------------------- + + virtual size_t GetDataSize() const wxOVERRIDE; + virtual bool GetDataHere(void *buf) const wxOVERRIDE; + virtual bool SetData(size_t len, const void *buf) wxOVERRIDE; + // Must provide overloads to avoid hiding them (and warnings about it) + virtual size_t GetDataSize(const wxDataFormat&) const wxOVERRIDE + { + return GetDataSize(); + } + virtual bool GetDataHere(const wxDataFormat&, void *buf) const wxOVERRIDE + { + return GetDataHere(buf); + } + virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) wxOVERRIDE + { + return SetData(len, buf); + } + +protected : + void Init() ; + void Clear() ; + + CFDataRef m_pictData ; +}; + +// ---------------------------------------------------------------------------- +// wxFileDataObject is a specialization of wxDataObject for file names +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFileDataObject : public wxFileDataObjectBase +{ +public: + // implement base class pure virtuals + // ---------------------------------- + + void AddFile( const wxString &filename ); + + virtual size_t GetDataSize() const wxOVERRIDE; + virtual bool GetDataHere(void *buf) const wxOVERRIDE; + virtual bool SetData(size_t len, const void *buf) wxOVERRIDE; + // Must provide overloads to avoid hiding them (and warnings about it) + virtual size_t GetDataSize(const wxDataFormat&) const wxOVERRIDE + { + return GetDataSize(); + } + virtual bool GetDataHere(const wxDataFormat&, void *buf) const wxOVERRIDE + { + return GetDataHere(buf); + } + virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) wxOVERRIDE + { + return SetData(len, buf); + } +protected: + // translates the filenames stored into a utf8 encoded char stream + void GetFileNames(wxCharBuffer &buf) const ; +}; + +#endif // _WX_MAC_DATAOBJ2_H_ + diff --git a/lib/wxWidgets/include/wx/osx/dataview.h b/lib/wxWidgets/include/wx/osx/dataview.h new file mode 100644 index 0000000..8651903 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/dataview.h @@ -0,0 +1,323 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/dataview.h +// Purpose: wxDataViewCtrl native implementation header for OSX +// Author: +// Copyright: (c) 2009 +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DATAVIEWCTRL_OSX_H_ +#define _WX_DATAVIEWCTRL_OSX_H_ + +#ifdef __WXMAC_CLASSIC__ +# error "Native wxDataViewCtrl for classic environment not defined. Please use generic control." +#endif + +// -------------------------------------------------------- +// Class declarations to mask native types +// -------------------------------------------------------- +class wxDataViewColumnNativeData; // class storing environment dependent data for the native implementation +class wxDataViewWidgetImpl; // class used as a common interface for carbon and cocoa implementation + +// --------------------------------------------------------- +// wxDataViewColumn +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewColumn: public wxDataViewColumnBase +{ +public: + // constructors / destructor + wxDataViewColumn(const wxString& title, + wxDataViewRenderer* renderer, + unsigned int model_column, + int width = wxDVC_DEFAULT_WIDTH, + wxAlignment align = wxALIGN_CENTER, + int flags = wxDATAVIEW_COL_RESIZABLE); + wxDataViewColumn(const wxBitmapBundle& bitmap, + wxDataViewRenderer* renderer, + unsigned int model_column, + int width = wxDVC_DEFAULT_WIDTH, + wxAlignment align = wxALIGN_CENTER, + int flags = wxDATAVIEW_COL_RESIZABLE); + virtual ~wxDataViewColumn(); + + // implement wxHeaderColumnBase pure virtual methods + virtual wxAlignment GetAlignment() const wxOVERRIDE { return m_alignment; } + virtual int GetFlags() const wxOVERRIDE { return m_flags; } + virtual int GetMaxWidth() const { return m_maxWidth; } + virtual int GetMinWidth() const wxOVERRIDE { return m_minWidth; } + virtual wxString GetTitle() const wxOVERRIDE { return m_title; } + virtual int GetWidth() const wxOVERRIDE; + virtual bool IsSortOrderAscending() const wxOVERRIDE { return m_ascending; } + virtual bool IsSortKey() const wxOVERRIDE; + virtual bool IsHidden() const wxOVERRIDE; + + virtual void SetAlignment (wxAlignment align) wxOVERRIDE; + virtual void SetBitmap (wxBitmapBundle const& bitmap) wxOVERRIDE; + virtual void SetFlags (int flags) wxOVERRIDE { m_flags = flags; /*SetIndividualFlags(flags); */ } + virtual void SetHidden (bool hidden) wxOVERRIDE; + virtual void SetMaxWidth (int maxWidth); + virtual void SetMinWidth (int minWidth) wxOVERRIDE; + virtual void SetReorderable(bool reorderable) wxOVERRIDE; + virtual void SetResizeable (bool resizable) wxOVERRIDE; + virtual void UnsetAsSortKey() wxOVERRIDE; + virtual void SetSortable (bool sortable) wxOVERRIDE; + virtual void SetSortOrder (bool ascending) wxOVERRIDE; + virtual void SetTitle (wxString const& title) wxOVERRIDE; + virtual void SetWidth (int width) wxOVERRIDE; + + // implementation only + wxDataViewColumnNativeData* GetNativeData() const + { + return m_NativeDataPtr; + } + + void SetNativeData(wxDataViewColumnNativeData* newNativeDataPtr); // class takes ownership of pointer + int GetWidthVariable() const + { + return m_width; + } + void SetWidthVariable(int NewWidth) + { + m_width = NewWidth; + } + void SetSortOrderVariable(bool NewOrder) + { + m_ascending = NewOrder; + } + +private: + // common part of all ctors + void InitCommon(int width, wxAlignment align, int flags) + { + m_ascending = true; + m_flags = flags & ~wxDATAVIEW_COL_HIDDEN; // TODO + m_maxWidth = 30000; + m_minWidth = 0; + m_alignment = align; + SetWidth(width); + } + + bool m_ascending; // sorting order + + int m_flags; // flags for the column + int m_maxWidth; // maximum width for the column + int m_minWidth; // minimum width for the column + int m_width; // column width + + wxAlignment m_alignment; // column header alignment + + wxDataViewColumnNativeData* m_NativeDataPtr; // storing environment dependent data for the native implementation + + wxString m_title; // column title +}; + +// +// type definitions related to wxDataViewColumn +// +WX_DEFINE_ARRAY(wxDataViewColumn*,wxDataViewColumnPtrArrayType); + +// --------------------------------------------------------- +// wxDataViewCtrl +// --------------------------------------------------------- +class WXDLLIMPEXP_ADV wxDataViewCtrl: public wxDataViewCtrlBase +{ +public: + // Constructors / destructor: + wxDataViewCtrl() + { + Init(); + } + wxDataViewCtrl(wxWindow *parent, + wxWindowID winid, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxDataViewCtrlNameStr) ) + { + Init(); + Create(parent, winid, pos, size, style, validator, name); + } + + ~wxDataViewCtrl(); + + bool Create(wxWindow *parent, + wxWindowID winid, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxDataViewCtrlNameStr)); + + virtual wxWindow* GetMainWindow() // not used for the native implementation + { + return this; + } + + // inherited methods from wxDataViewCtrlBase: + virtual bool AssociateModel(wxDataViewModel* model) wxOVERRIDE; + + virtual bool AppendColumn (wxDataViewColumn* columnPtr) wxOVERRIDE; + virtual bool ClearColumns () wxOVERRIDE; + virtual bool DeleteColumn (wxDataViewColumn* columnPtr) wxOVERRIDE; + virtual wxDataViewColumn* GetColumn (unsigned int pos) const wxOVERRIDE; + virtual unsigned int GetColumnCount () const wxOVERRIDE; + virtual int GetColumnPosition(const wxDataViewColumn* columnPtr) const wxOVERRIDE; + virtual wxDataViewColumn* GetSortingColumn () const wxOVERRIDE; + virtual bool InsertColumn (unsigned int pos, wxDataViewColumn *col) wxOVERRIDE; + virtual bool PrependColumn (wxDataViewColumn* columnPtr) wxOVERRIDE; + + virtual void Collapse( const wxDataViewItem& item) wxOVERRIDE; + virtual void EnsureVisible(const wxDataViewItem& item, const wxDataViewColumn* columnPtr=NULL) wxOVERRIDE; + virtual bool IsExpanded(const wxDataViewItem & item) const wxOVERRIDE; + + virtual unsigned int GetCount() const; + virtual int GetCountPerPage() const wxOVERRIDE; + virtual wxRect GetItemRect(const wxDataViewItem& item, + const wxDataViewColumn* columnPtr = NULL) const wxOVERRIDE; + virtual int GetSelectedItemsCount() const wxOVERRIDE; + virtual int GetSelections(wxDataViewItemArray& sel) const wxOVERRIDE; + + virtual wxDataViewItem GetTopItem() const wxOVERRIDE; + + virtual void HitTest(const wxPoint& point, wxDataViewItem& item, wxDataViewColumn*& columnPtr) const wxOVERRIDE; + + virtual bool SetRowHeight(int rowHeight) wxOVERRIDE; + + virtual bool IsSelected(const wxDataViewItem& item) const wxOVERRIDE; + + virtual void SelectAll() wxOVERRIDE; + virtual void Select(const wxDataViewItem& item) wxOVERRIDE; + virtual void SetSelections(const wxDataViewItemArray& sel) wxOVERRIDE; + + virtual void Unselect(const wxDataViewItem& item) wxOVERRIDE; + virtual void UnselectAll() wxOVERRIDE; + +// +// implementation +// + // returns a pointer to the native implementation + wxDataViewWidgetImpl* GetDataViewPeer() const; + + // adds all children of the passed parent to the control; if 'parentItem' is invalid the root(s) is/are added: + void AddChildren(wxDataViewItem const& parentItem); + + // finishes editing of custom items; if no custom item is currently edited the method does nothing + void FinishCustomItemEditing(); + + virtual void EditItem(const wxDataViewItem& item, const wxDataViewColumn *column) wxOVERRIDE; + +#if wxUSE_DRAG_AND_DROP + virtual bool DoEnableDropTarget( const wxVector<wxDataFormat>& formats ) wxOVERRIDE; +#endif // wxUSE_DRAG_AND_DROP + + // returns the n-th pointer to a column; + // this method is different from GetColumn(unsigned int pos) because here 'n' is not a position in the control but the n-th + // position in the internal list/array of column pointers + wxDataViewColumn* GetColumnPtr(size_t n) const + { + return m_ColumnPtrs[n]; + } + // returns the current being rendered item of the customized renderer (this item is only valid during editing) + wxDataViewItem const& GetCustomRendererItem() const + { + return m_CustomRendererItem; + } + // returns a pointer to a customized renderer (this pointer is only valid during editing) + wxDataViewCustomRenderer* GetCustomRendererPtr() const + { + return m_CustomRendererPtr; + } + + // checks if a single item or all items are being deleted + bool IsDeleting() const; + bool IsClearing() const; + + // with CG, we need to get the context from an kEventControlDraw event + // unfortunately, the DataBrowser callbacks don't provide the context + // and we need it, so we need to set/remove it before and after draw + // events so we can access it in the callbacks. + void MacSetDrawingContext(void* context) + { + m_cgContext = context; + } + void* MacGetDrawingContext() const + { + return m_cgContext; + } + + // sets the currently being edited item of the custom renderer + void SetCustomRendererItem(wxDataViewItem const& NewItem) + { + m_CustomRendererItem = NewItem; + } + // sets the custom renderer + void SetCustomRendererPtr(wxDataViewCustomRenderer* NewCustomRendererPtr) + { + m_CustomRendererPtr = NewCustomRendererPtr; + } + + void AdjustAutosizedColumns() const; + + virtual wxDataViewColumn *GetCurrentColumn() const wxOVERRIDE; + + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + +protected: + // inherited methods from wxDataViewCtrlBase + virtual void DoSetExpanderColumn() wxOVERRIDE; + virtual void DoSetIndent() wxOVERRIDE; + + virtual void DoExpand(const wxDataViewItem& item, bool expandChildren) wxOVERRIDE; + + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + // event handling + void OnSize(wxSizeEvent &event); + + virtual void DoThaw() wxOVERRIDE; + +private: + // initializing of local variables: + void Init(); + + virtual wxDataViewItem DoGetCurrentItem() const wxOVERRIDE; + virtual void DoSetCurrentItem(const wxDataViewItem& item) wxOVERRIDE; + + // + // variables + // + + // If non-null, describes the item(s) being deleted. This is necessary to + // allow avoiding referencing already deleted items from the native + // callbacks/delegates. + struct wxOSXDVCDeleting* m_Deleting; + + // This class can set (and reset) m_Deleting. + friend class wxOSXDVCScopedDeleter; + + void* m_cgContext; // pointer to core graphics context + + wxDataViewCustomRenderer* m_CustomRendererPtr; // pointer to a valid custom renderer while editing; this class does NOT own the pointer + + wxDataViewItem m_CustomRendererItem; // currently edited item by the customrenderer; it is invalid while not editing a custom item + + wxDataViewColumnPtrArrayType m_ColumnPtrs; // all column pointers are stored in an array + + class wxOSXDataViewModelNotifier* m_ModelNotifier; // stores the model notifier for the control (does not own the notifier) + + // wxWidget internal stuff: + wxDECLARE_DYNAMIC_CLASS(wxDataViewCtrl); + wxDECLARE_NO_COPY_CLASS(wxDataViewCtrl); + wxDECLARE_EVENT_TABLE(); +}; + +#endif // _WX_DATAVIEWCTRL_OSX_H_ + diff --git a/lib/wxWidgets/include/wx/osx/datectrl.h b/lib/wxWidgets/include/wx/osx/datectrl.h new file mode 100644 index 0000000..6d37c20 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/datectrl.h @@ -0,0 +1,54 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/datectrl.h +// Purpose: Declaration of wxOSX-specific wxDatePickerCtrl class. +// Author: Vadim Zeitlin +// Created: 2011-12-18 +// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_DATECTRL_H_ +#define _WX_OSX_DATECTRL_H_ + +// ---------------------------------------------------------------------------- +// wxDatePickerCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDatePickerCtrl : public wxDatePickerCtrlBase +{ +public: + // Constructors. + wxDatePickerCtrl() { } + + wxDatePickerCtrl(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) + { + Create(parent, id, dt, pos, size, style, validator, name); + } + + 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); + + // Implement the base class pure virtuals. + virtual void SetRange(const wxDateTime& dt1, const wxDateTime& dt2) wxOVERRIDE; + virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const wxOVERRIDE; + + virtual void OSXGenerateEvent(const wxDateTime& dt) wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl); +}; + +#endif // _WX_OSX_DATECTRL_H_ diff --git a/lib/wxWidgets/include/wx/osx/datetimectrl.h b/lib/wxWidgets/include/wx/osx/datetimectrl.h new file mode 100644 index 0000000..9117c70 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/datetimectrl.h @@ -0,0 +1,33 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/datetimectrl.h +// Purpose: Declaration of wxOSX-specific wxDateTimePickerCtrl class. +// Author: Vadim Zeitlin +// Created: 2011-12-18 +// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_DATETIMECTRL_H_ +#define _WX_OSX_DATETIMECTRL_H_ + +class wxDateTimeWidgetImpl; + +// ---------------------------------------------------------------------------- +// wxDateTimePickerCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDateTimePickerCtrl : public wxDateTimePickerCtrlBase +{ +public: + // Implement the base class pure virtuals. + virtual void SetValue(const wxDateTime& dt) wxOVERRIDE; + virtual wxDateTime GetValue() const wxOVERRIDE; + + // Implementation only. + virtual void OSXGenerateEvent(const wxDateTime& dt) = 0; + +protected: + wxDateTimeWidgetImpl* GetDateTimePeer() const; +}; + +#endif // _WX_OSX_DATETIMECTRL_H_ diff --git a/lib/wxWidgets/include/wx/osx/dc.h b/lib/wxWidgets/include/wx/osx/dc.h new file mode 100644 index 0000000..84bb59c --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/dc.h @@ -0,0 +1,14 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/dc.h +// Purpose: wxDC class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DC_H_ +#define _WX_DC_H_ + +#endif // _WX_DC_H_ diff --git a/lib/wxWidgets/include/wx/osx/dcclient.h b/lib/wxWidgets/include/wx/osx/dcclient.h new file mode 100644 index 0000000..7f0ead5 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/dcclient.h @@ -0,0 +1,74 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/dcclient.h +// Purpose: wxClientDC, wxPaintDC and wxWindowDC classes +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCCLIENT_H_ +#define _WX_DCCLIENT_H_ + +#include "wx/dc.h" +#include "wx/dcgraph.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxPaintDC; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +class WXDLLIMPEXP_CORE wxWindowDCImpl: public wxGCDCImpl +{ +public: + wxWindowDCImpl( wxDC *owner ); + wxWindowDCImpl( wxDC *owner, wxWindow *window ); + virtual ~wxWindowDCImpl(); + + virtual void DoGetSize( int *width, int *height ) const wxOVERRIDE; + virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const wxOVERRIDE; + +protected: + virtual wxPoint OSXGetOrigin() const wxOVERRIDE; + + bool m_release; + int m_width; + int m_height; + wxPoint m_origin; + + wxDECLARE_CLASS(wxWindowDCImpl); + wxDECLARE_NO_COPY_CLASS(wxWindowDCImpl); +}; + + +class WXDLLIMPEXP_CORE wxClientDCImpl: public wxWindowDCImpl +{ +public: + wxClientDCImpl( wxDC *owner ); + wxClientDCImpl( wxDC *owner, wxWindow *window ); + virtual ~wxClientDCImpl(); + +private: + wxDECLARE_CLASS(wxClientDCImpl); + wxDECLARE_NO_COPY_CLASS(wxClientDCImpl); +}; + + +class WXDLLIMPEXP_CORE wxPaintDCImpl: public wxWindowDCImpl +{ +public: + wxPaintDCImpl( wxDC *owner ); + wxPaintDCImpl( wxDC *owner, wxWindow *win ); + virtual ~wxPaintDCImpl(); + +protected: + wxDECLARE_CLASS(wxPaintDCImpl); + wxDECLARE_NO_COPY_CLASS(wxPaintDCImpl); +}; + + +#endif + // _WX_DCCLIENT_H_ diff --git a/lib/wxWidgets/include/wx/osx/dcmemory.h b/lib/wxWidgets/include/wx/osx/dcmemory.h new file mode 100644 index 0000000..787e2a6 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/dcmemory.h @@ -0,0 +1,45 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/dcmemory.h +// Purpose: wxMemoryDC class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCMEMORY_H_ +#define _WX_DCMEMORY_H_ + +#include "wx/osx/dcclient.h" + +class WXDLLIMPEXP_CORE wxMemoryDCImpl: public wxPaintDCImpl +{ +public: + wxMemoryDCImpl( wxMemoryDC *owner ); + wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap ); + wxMemoryDCImpl( wxMemoryDC *owner, wxDC *dc ); + + virtual ~wxMemoryDCImpl(); + + virtual void DoGetSize( int *width, int *height ) const wxOVERRIDE; + virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const wxOVERRIDE + { return subrect == NULL ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmap(*subrect); } + virtual void DoSelect(const wxBitmap& bitmap) wxOVERRIDE; + + virtual const wxBitmap& GetSelectedBitmap() const wxOVERRIDE + { return m_selected; } + virtual wxBitmap& GetSelectedBitmap() wxOVERRIDE + { return m_selected; } + +private: + void Init(); + + wxBitmap m_selected; + + wxDECLARE_CLASS(wxMemoryDCImpl); + wxDECLARE_NO_COPY_CLASS(wxMemoryDCImpl); +}; + +#endif + // _WX_DCMEMORY_H_ diff --git a/lib/wxWidgets/include/wx/osx/dcprint.h b/lib/wxWidgets/include/wx/osx/dcprint.h new file mode 100644 index 0000000..d846492 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/dcprint.h @@ -0,0 +1,51 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/dcprint.h +// Purpose: wxPrinterDC class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCPRINT_H_ +#define _WX_DCPRINT_H_ + +#include "wx/dc.h" +#include "wx/dcgraph.h" +#include "wx/cmndata.h" + +class wxNativePrinterDC ; + +class WXDLLIMPEXP_CORE wxPrinterDCImpl: public wxGCDCImpl +{ +public: +#if wxUSE_PRINTING_ARCHITECTURE + + wxPrinterDCImpl( wxPrinterDC *owner, const wxPrintData& printdata ); + virtual ~wxPrinterDCImpl(); + + virtual bool StartDoc( const wxString& WXUNUSED(message) ) wxOVERRIDE; + virtual void EndDoc() wxOVERRIDE; + virtual void StartPage() wxOVERRIDE; + virtual void EndPage() wxOVERRIDE; + + wxRect GetPaperRect() const wxOVERRIDE; + + wxPrintData& GetPrintData() { return m_printData; } + virtual wxSize GetPPI() const wxOVERRIDE; + +protected: + virtual void DoGetSize( int *width, int *height ) const wxOVERRIDE; + + wxPrintData m_printData ; + wxNativePrinterDC* m_nativePrinterDC ; + +private: + wxDECLARE_CLASS(wxPrinterDC); +#endif // wxUSE_PRINTING_ARCHITECTURE +}; + +#endif + // _WX_DCPRINT_H_ + diff --git a/lib/wxWidgets/include/wx/osx/dcscreen.h b/lib/wxWidgets/include/wx/osx/dcscreen.h new file mode 100644 index 0000000..1ebcc5e --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/dcscreen.h @@ -0,0 +1,32 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/dcscreen.h +// Purpose: wxScreenDC class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCSCREEN_H_ +#define _WX_DCSCREEN_H_ + +#include "wx/dcclient.h" +#include "wx/osx/dcclient.h" + +class WXDLLIMPEXP_CORE wxScreenDCImpl: public wxWindowDCImpl +{ +public: + wxScreenDCImpl( wxDC *owner ); + virtual ~wxScreenDCImpl(); + + virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const wxOVERRIDE; + +private: + wxDECLARE_CLASS(wxScreenDCImpl); + wxDECLARE_NO_COPY_CLASS(wxScreenDCImpl); +}; + +#endif + // _WX_DCSCREEN_H_ + diff --git a/lib/wxWidgets/include/wx/osx/dialog.h b/lib/wxWidgets/include/wx/osx/dialog.h new file mode 100644 index 0000000..7abbc74 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/dialog.h @@ -0,0 +1,105 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/dialog.h +// Purpose: wxDialog class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DIALOG_H_ +#define _WX_DIALOG_H_ + +#include "wx/panel.h" + +class WXDLLIMPEXP_FWD_CORE wxMacToolTip ; +class WXDLLIMPEXP_FWD_CORE wxModalEventLoop ; + +// Dialog boxes +class WXDLLIMPEXP_CORE wxDialog : public wxDialogBase +{ + wxDECLARE_DYNAMIC_CLASS(wxDialog); + +public: + wxDialog() { Init(); } + + // Constructor with no modal flag - the new convention. + wxDialog(wxWindow *parent, wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxASCII_STR(wxDialogNameStr)) + { + Init(); + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxASCII_STR(wxDialogNameStr)); + + virtual ~wxDialog(); + +// virtual bool Destroy(); + virtual bool Show(bool show = true) wxOVERRIDE; + + // return true if we're showing the dialog modally + virtual bool IsModal() const wxOVERRIDE; + + // show the dialog modally and return the value passed to EndModal() + virtual int ShowModal() wxOVERRIDE; + + virtual void ShowWindowModal() wxOVERRIDE; + + // may be called to terminate the dialog with the given return code + virtual void EndModal(int retCode) wxOVERRIDE; + + static bool OSXHasModalDialogsOpen(); + void OSXBeginModalDialog(); + void OSXEndModalDialog(); + +#if wxOSX_USE_COCOA + bool OSXGetWorksWhenModal(); + void OSXSetWorksWhenModal(bool worksWhenModal); +#endif + + // implementation + // -------------- + + wxDialogModality GetModality() const wxOVERRIDE; + +#if wxOSX_USE_COCOA + virtual void ModalFinishedCallback(void* WXUNUSED(panel), int WXUNUSED(returnCode)) {} +#endif + +protected: + // show window modal dialog + void DoShowWindowModal(); + + // end window modal dialog. + void EndWindowModal(); + + // mac also takes command-period as cancel + virtual bool IsEscapeKey(const wxKeyEvent& event) wxOVERRIDE; + + + wxDialogModality m_modality; + + wxModalEventLoop* m_eventLoop; + +private: + void Init(); + + static wxVector<wxDialog*> s_modalStack; +#if wxOSX_USE_COCOA + static wxVector<bool> s_modalWorksStack; +#endif +}; + +#endif + // _WX_DIALOG_H_ diff --git a/lib/wxWidgets/include/wx/osx/dirdlg.h b/lib/wxWidgets/include/wx/osx/dirdlg.h new file mode 100644 index 0000000..f8ab611 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/dirdlg.h @@ -0,0 +1,74 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/dirdlg.h +// Purpose: wxDirDialog class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DIRDLG_H_ +#define _WX_DIRDLG_H_ + +#if wxOSX_USE_COCOA + DECLARE_WXCOCOA_OBJC_CLASS(NSOpenPanel); +#endif + +class WXDLLIMPEXP_CORE wxDirDialog : public wxDirDialogBase +{ +public: + wxDirDialog() { Init(); } + + wxDirDialog(wxWindow *parent, + const wxString& message = wxASCII_STR(wxDirSelectorPromptStr), + const wxString& defaultPath = wxT(""), + long style = wxDD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxString& name = wxASCII_STR(wxDirDialogNameStr)) + { + Init(); + + Create(parent,message,defaultPath,style,pos,size,name); + } + + void Create(wxWindow *parent, + const wxString& message = wxASCII_STR(wxDirSelectorPromptStr), + const wxString& defaultPath = wxT(""), + long style = wxDD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxString& name = wxASCII_STR(wxDirDialogNameStr)); + +#if wxOSX_USE_COCOA + ~wxDirDialog(); +#endif + + virtual int ShowModal() wxOVERRIDE; + + // MacOS 10.11 has removed the titlebar from the dialog, so this is provided + // only for compatibility with older versions + virtual void SetTitle(const wxString& title) wxOVERRIDE; + +#if wxOSX_USE_COCOA + virtual void ShowWindowModal() wxOVERRIDE; + virtual void ModalFinishedCallback(void* panel, int returnCode) wxOVERRIDE; +#endif + +private: +#if wxOSX_USE_COCOA + // Create and initialize NSOpenPanel that we use in both ShowModal() and + // ShowWindowModal(). + WX_NSOpenPanel OSXCreatePanel() const; +#endif + + // Common part of all ctors. + void Init(); + + wxString m_title; + + wxDECLARE_DYNAMIC_CLASS(wxDirDialog); +}; + +#endif // _WX_DIRDLG_H_ diff --git a/lib/wxWidgets/include/wx/osx/dnd.h b/lib/wxWidgets/include/wx/osx/dnd.h new file mode 100644 index 0000000..c3a26af --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/dnd.h @@ -0,0 +1,111 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/dnd.h +// Purpose: Declaration of the wxDropTarget, wxDropSource class etc. +// Author: Stefan Csomor +// Copyright: (c) 1998 Stefan Csomor +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DND_H_ +#define _WX_DND_H_ + +#if wxUSE_DRAG_AND_DROP + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/string.h" +#include "wx/string.h" +#include "wx/dataobj.h" +#include "wx/cursor.h" + +//------------------------------------------------------------------------- +// classes +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxWindow; + +class WXDLLIMPEXP_FWD_CORE wxDropTarget; +class WXDLLIMPEXP_FWD_CORE wxTextDropTarget; +class WXDLLIMPEXP_FWD_CORE wxFileDropTarget; + +class WXDLLIMPEXP_FWD_CORE wxDropSource; + +class WXDLLIMPEXP_FWD_CORE wxOSXDataSource; + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +// this macro may be used instead for wxDropSource ctor arguments: it will use +// the icon 'name' from an XPM file under GTK, but will expand to something +// else under MSW. If you don't use it, you will have to use #ifdef in the +// application code. +#define wxDROP_ICON(X) wxCursor(X##_xpm) + +//------------------------------------------------------------------------- +// wxDropTarget +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDropTarget: public wxDropTargetBase +{ + public: + + wxDropTarget(wxDataObject *dataObject = NULL ); + + virtual wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def) wxOVERRIDE; + virtual bool OnDrop(wxCoord x, wxCoord y) wxOVERRIDE; + virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def) wxOVERRIDE; + virtual bool GetData() wxOVERRIDE; + // NOTE: This is needed by the generic wxDataViewCtrl, not sure how to implement. + virtual wxDataFormat GetMatchingPair(); + + bool CurrentDragHasSupportedFormat() ; + + void SetCurrentDragSource( wxOSXDataSource* dragpasteboard ) { m_currentDragPasteboard = dragpasteboard ; } + protected : + wxOSXDataSource* m_currentDragPasteboard ; +}; + +//------------------------------------------------------------------------- +// wxDropSource +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDropSource: public wxDropSourceBase +{ +public: + // ctors: if you use default ctor you must call SetData() later! + // + // NB: the "wxWindow *win" parameter is unused and is here only for wxGTK + // compatibility, as well as both icon parameters + wxDropSource( wxWindow *win = NULL, + const wxCursor &cursorCopy = wxNullCursor, + const wxCursor &cursorMove = wxNullCursor, + const wxCursor &cursorStop = wxNullCursor); + + /* constructor for setting one data object */ + wxDropSource( wxDataObject& data, + wxWindow *win, + const wxCursor &cursorCopy = wxNullCursor, + const wxCursor &cursorMove = wxNullCursor, + const wxCursor &cursorStop = wxNullCursor); + + virtual ~wxDropSource(); + + // do it (call this in response to a mouse button press, for example) + // params: if bAllowMove is false, data can be only copied + virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly) wxOVERRIDE; + + wxWindow* GetWindow() { return m_window ; } + void SetCurrentDragPasteboard( void* dragpasteboard ) { m_currentDragPasteboard = dragpasteboard ; } + bool MacInstallDefaultCursor(wxDragResult effect) ; + static wxDropSource* GetCurrentDropSource(); + protected : + + wxWindow *m_window; + void* m_currentDragPasteboard ; +}; + +#endif // wxUSE_DRAG_AND_DROP + +#endif + //_WX_DND_H_ diff --git a/lib/wxWidgets/include/wx/osx/dvrenderer.h b/lib/wxWidgets/include/wx/osx/dvrenderer.h new file mode 100644 index 0000000..67116f1 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/dvrenderer.h @@ -0,0 +1,115 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/dvrenderer.h +// Purpose: wxDataViewRenderer for OS X wxDataViewCtrl implementations +// Author: Vadim Zeitlin +// Created: 2009-11-07 (extracted from wx/osx/dataview.h) +// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_DVRENDERER_H_ +#define _WX_OSX_DVRENDERER_H_ + +class wxDataViewRendererNativeData; + +// ---------------------------------------------------------------------------- +// wxDataViewRenderer +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewRenderer : public wxDataViewRendererBase +{ +public: + // constructors / destructor + // ------------------------- + + wxDataViewRenderer(const wxString& varianttype, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT); + + virtual ~wxDataViewRenderer(); + + // inherited methods from wxDataViewRendererBase + // --------------------------------------------- + + virtual int GetAlignment() const wxOVERRIDE + { + return m_alignment; + } + virtual wxDataViewCellMode GetMode() const wxOVERRIDE + { + return m_mode; + } + virtual bool GetValue(wxVariant& value) const wxOVERRIDE + { + value = m_value; + return true; + } + + // NB: in Carbon this is always identical to the header alignment + virtual void SetAlignment(int align) wxOVERRIDE; + virtual void SetMode(wxDataViewCellMode mode) wxOVERRIDE; + virtual bool SetValue(const wxVariant& newValue) wxOVERRIDE + { + m_value = newValue; + return true; + } + + virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE) wxOVERRIDE; + virtual wxEllipsizeMode GetEllipsizeMode() const wxOVERRIDE; + + // implementation + // -------------- + + const wxVariant& GetValue() const + { + return m_value; + } + + wxDataViewRendererNativeData* GetNativeData() const + { + return m_NativeDataPtr; + } + + // a call to the native data browser function to render the data; + // returns true if the data value could be rendered, false otherwise + virtual bool MacRender() = 0; + + void SetNativeData(wxDataViewRendererNativeData* newNativeDataPtr); + + void OSXUpdateAlignment(); + +#if wxOSX_USE_COCOA + // called when a value was edited by user + virtual void OSXOnCellChanged(NSObject *value, + const wxDataViewItem& item, + unsigned col); + +protected: + virtual void SetAttr(const wxDataViewItemAttr& attr) wxOVERRIDE; + virtual void SetEnabled(bool enabled) wxOVERRIDE; +#else +protected: + void SetAttr(const wxDataViewItemAttr& WXUNUSED(attr)) wxOVERRIDE { }; + void SetEnabled(bool WXUNUSED(enabled)) wxOVERRIDE { }; +#endif + + virtual bool IsHighlighted() const wxOVERRIDE; + +private: + // contains the alignment flags + int m_alignment; + + // storing the mode that determines how the cell is going to be shown + wxDataViewCellMode m_mode; + + // data used by implementation of the native renderer + wxDataViewRendererNativeData* m_NativeDataPtr; + + // value that is going to be rendered + wxVariant m_value; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer); +}; + +#endif // _WX_OSX_DVRENDERER_H_ + diff --git a/lib/wxWidgets/include/wx/osx/dvrenderers.h b/lib/wxWidgets/include/wx/osx/dvrenderers.h new file mode 100644 index 0000000..218ce08 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/dvrenderers.h @@ -0,0 +1,300 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/dvrenderers.h +// Purpose: All OS X wxDataViewCtrl renderer classes +// Author: Vadim Zeitlin +// Created: 2009-11-07 (extracted from wx/osx/dataview.h) +// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_DVRENDERERS_H_ +#define _WX_OSX_DVRENDERERS_H_ + +// --------------------------------------------------------- +// wxDataViewCustomRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewCustomRenderer : public wxDataViewCustomRendererBase +{ +public: + static wxString GetDefaultType() { return wxS("string"); } + + wxDataViewCustomRenderer(const wxString& varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT); + + virtual ~wxDataViewCustomRenderer(); + + + // implementation only + // ------------------- + + virtual bool MacRender() wxOVERRIDE; + + virtual wxDC* GetDC() wxOVERRIDE; // creates a device context and keeps it + void SetDC(wxDC* newDCPtr); // this method takes ownership of the pointer + +private: + wxControl* m_editorCtrlPtr; // pointer to an in-place editor control + + wxDC* m_DCPtr; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer); +}; + +// --------------------------------------------------------------------------- +// This is a Mac-specific class that should be used as the base class for the +// renderers that should be disabled when they're inert, to prevent the user +// from editing them. +// --------------------------------------------------------------------------- + +class wxOSXDataViewDisabledInertRenderer : public wxDataViewRenderer +{ +protected: + wxOSXDataViewDisabledInertRenderer(const wxString& varianttype, + wxDataViewCellMode mode, + int alignment) + : wxDataViewRenderer(varianttype, mode, alignment) + { + } + + virtual void SetEnabled(bool enabled) wxOVERRIDE + { + wxDataViewRenderer::SetEnabled(enabled && + GetMode() != wxDATAVIEW_CELL_INERT); + } +}; + +// --------------------------------------------------------- +// wxDataViewTextRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer +{ +public: + static wxString GetDefaultType() { return wxS("string"); } + + wxDataViewTextRenderer(const wxString& varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT); + +#if wxUSE_MARKUP && wxOSX_USE_COCOA + void EnableMarkup(bool enable = true); +#endif // wxUSE_MARKUP && Cocoa + + virtual bool MacRender() wxOVERRIDE; + + virtual void OSXOnCellChanged(NSObject *value, + const wxDataViewItem& item, + unsigned col) wxOVERRIDE; + +private: +#if wxUSE_MARKUP && wxOSX_USE_COCOA + // True if we should interpret markup in our text. + bool m_useMarkup; +#endif // wxUSE_MARKUP && Cocoa + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer); +}; + +// --------------------------------------------------------- +// wxDataViewBitmapRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer +{ +public: + static wxString GetDefaultType() { return wxS("wxBitmapBundle"); } + + wxDataViewBitmapRenderer(const wxString& varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT); + + virtual + bool IsCompatibleVariantType(const wxString& variantType) const wxOVERRIDE; + + virtual bool MacRender() wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer); +}; + +// ------------------------------------- +// wxDataViewChoiceRenderer +// ------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewChoiceRenderer + : public wxOSXDataViewDisabledInertRenderer +{ +public: + wxDataViewChoiceRenderer(const wxArrayString& choices, + wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, + int alignment = wxDVR_DEFAULT_ALIGNMENT ); + + virtual bool MacRender() wxOVERRIDE; + + wxString GetChoice(size_t index) const { return m_choices[index]; } + const wxArrayString& GetChoices() const { return m_choices; } + + virtual void OSXOnCellChanged(NSObject *value, + const wxDataViewItem& item, + unsigned col) wxOVERRIDE; + +private: + wxArrayString m_choices; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewChoiceRenderer); +}; + +// ---------------------------------------------------------------------------- +// wxDataViewChoiceByIndexRenderer +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewChoiceByIndexRenderer: public wxDataViewChoiceRenderer +{ +public: + wxDataViewChoiceByIndexRenderer(const wxArrayString& choices, + wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, + int alignment = wxDVR_DEFAULT_ALIGNMENT); + + virtual bool SetValue(const wxVariant& value) wxOVERRIDE; + virtual bool GetValue(wxVariant& value) const wxOVERRIDE; + + virtual void OSXOnCellChanged(NSObject *value, + const wxDataViewItem& item, + unsigned col) wxOVERRIDE; +}; + +// --------------------------------------------------------- +// wxDataViewIconTextRenderer +// --------------------------------------------------------- +class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewRenderer +{ +public: + static wxString GetDefaultType() { return wxS("wxDataViewIconText"); } + + wxDataViewIconTextRenderer(const wxString& varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT); + + virtual bool MacRender() wxOVERRIDE; + + virtual void OSXOnCellChanged(NSObject *value, + const wxDataViewItem& item, + unsigned col) wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer); +}; + +// --------------------------------------------------------- +// wxDataViewIconTextRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataViewCheckIconTextRenderer + : public wxDataViewRenderer +{ +public: + static wxString GetDefaultType() { return wxS("wxDataViewCheckIconText"); } + + explicit wxDataViewCheckIconTextRenderer + ( + wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, + int align = wxDVR_DEFAULT_ALIGNMENT + ); + + // This renderer can always display the 3rd ("indeterminate") checkbox + // state if the model contains cells with wxCHK_UNDETERMINED value, but it + // doesn't allow the user to set it by default. Call this method to allow + // this to happen. + void Allow3rdStateForUser(bool allow = true); + + virtual bool MacRender() wxOVERRIDE; + + virtual void OSXOnCellChanged(NSObject *value, + const wxDataViewItem& item, + unsigned col) wxOVERRIDE; + +private: + bool m_allow3rdStateForUser; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCheckIconTextRenderer); +}; + +// --------------------------------------------------------- +// wxDataViewToggleRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewToggleRenderer + : public wxOSXDataViewDisabledInertRenderer +{ +public: + static wxString GetDefaultType() { return wxS("bool"); } + + wxDataViewToggleRenderer(const wxString& varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT); + + void ShowAsRadio(); + + virtual bool MacRender() wxOVERRIDE; + + virtual void OSXOnCellChanged(NSObject *value, + const wxDataViewItem& item, + unsigned col) wxOVERRIDE; + +private: + void DoInitButtonCell(int buttonType); + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer); +}; + +// --------------------------------------------------------- +// wxDataViewProgressRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewRenderer +{ +public: + static wxString GetDefaultType() { return wxS("long"); } + + wxDataViewProgressRenderer(const wxString& label = wxEmptyString, + const wxString& varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT); + + virtual bool MacRender() wxOVERRIDE; + + virtual void OSXOnCellChanged(NSObject *value, + const wxDataViewItem& item, + unsigned col) wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer); +}; + +// --------------------------------------------------------- +// wxDataViewDateRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewRenderer +{ +public: + static wxString GetDefaultType() { return wxS("datetime"); } + + wxDataViewDateRenderer(const wxString& varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, + int align = wxDVR_DEFAULT_ALIGNMENT); + + virtual bool MacRender() wxOVERRIDE; + + virtual void OSXOnCellChanged(NSObject *value, + const wxDataViewItem& item, + unsigned col) wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer); +}; + +#endif // _WX_OSX_DVRENDERERS_H_ + diff --git a/lib/wxWidgets/include/wx/osx/evtloop.h b/lib/wxWidgets/include/wx/osx/evtloop.h new file mode 100644 index 0000000..af53115 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/evtloop.h @@ -0,0 +1,40 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/evtloop.h +// Purpose: simply forwards to wx/osx/carbon/evtloop.h or +// wx/osx/cocoa/evtloop.h for consistency with the other Mac +// headers +// Author: Vadim Zeitlin +// Modified by: +// Created: 2006-01-12 +// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_EVTLOOP_H_ +#define _WX_OSX_EVTLOOP_H_ + +#include "wx/osx/cocoa/evtloop.h" + +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxNonOwnedWindow; + +class WXDLLIMPEXP_CORE wxModalEventLoop : public wxGUIEventLoop +{ +public: + wxModalEventLoop(wxWindow *modalWindow); + wxModalEventLoop(WXWindow modalNativeWindow); + +#ifdef __WXOSX_COCOA__ + // skip wxGUIEventLoop to avoid missing Enter/Exit notifications + virtual int Run() wxOVERRIDE { return wxCFEventLoop::Run(); } +#endif +protected: + virtual void OSXDoRun() wxOVERRIDE; + virtual void OSXDoStop() wxOVERRIDE; + + // (in case) the modal window for this event loop + wxNonOwnedWindow* m_modalWindow; + WXWindow m_modalNativeWindow; +}; + +#endif // _WX_OSX_EVTLOOP_H_ diff --git a/lib/wxWidgets/include/wx/osx/evtloopsrc.h b/lib/wxWidgets/include/wx/osx/evtloopsrc.h new file mode 100644 index 0000000..291ce0f --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/evtloopsrc.h @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/evtloopsrc.h +// Purpose: wxCFEventLoopSource class +// Author: Vadim Zeitlin +// Created: 2009-10-21 +// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_EVTLOOPSRC_H_ +#define _WX_OSX_EVTLOOPSRC_H_ + +typedef struct __CFSocket* CFSocketRef; + +// ---------------------------------------------------------------------------- +// wxCFEventLoopSource: CoreFoundation-based wxEventLoopSource for OS X +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxCFEventLoopSource : public wxEventLoopSource +{ +public: + // Create a new source in uninitialized state, call InitSocketRef() later + // to associate it with the socket it is going to use. + wxCFEventLoopSource(wxEventLoopSourceHandler *handler, int flags) + : wxEventLoopSource(handler, flags) + { + m_cfSocket = NULL; + } + + // Finish initialization of the event loop source by providing the + // associated socket. This object takes ownership of it and will release it. + void InitSourceSocket(CFSocketRef cfSocket); + + // Destructor deletes the associated socket. + virtual ~wxCFEventLoopSource(); + +private: + CFSocketRef m_cfSocket; + + wxDECLARE_NO_COPY_CLASS(wxCFEventLoopSource); +}; + +#endif // _WX_OSX_EVTLOOPSRC_H_ + diff --git a/lib/wxWidgets/include/wx/osx/filedlg.h b/lib/wxWidgets/include/wx/osx/filedlg.h new file mode 100644 index 0000000..6dd887e --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/filedlg.h @@ -0,0 +1,106 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/filedlg.h +// Purpose: wxFileDialog class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FILEDLG_H_ +#define _WX_FILEDLG_H_ + +class WXDLLIMPEXP_FWD_CORE wxChoice; + +//------------------------------------------------------------------------- +// wxFileDialog +//------------------------------------------------------------------------- + +// set this system option to 1 in order to always show the filetypes popup in +// file open dialogs if possible + +#define wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES wxT("osx.openfiledialog.always-show-types") + +class WXDLLIMPEXP_CORE wxFileDialog: public wxFileDialogBase +{ + wxDECLARE_DYNAMIC_CLASS(wxFileDialog); +protected: + wxArrayString m_fileNames; + wxArrayString m_paths; + +public: + wxFileDialog() { Init(); } + wxFileDialog(wxWindow *parent, + const wxString& message = wxASCII_STR(wxFileSelectorPromptStr), + const wxString& defaultDir = wxEmptyString, + const wxString& defaultFile = wxEmptyString, + const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + long style = wxFD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + const wxString& name = wxASCII_STR(wxFileDialogNameStr)) + { + Init(); + + Create(parent,message,defaultDir,defaultFile,wildCard,style,pos,sz,name); + } + + void Create(wxWindow *parent, + const wxString& message = wxASCII_STR(wxFileSelectorPromptStr), + const wxString& defaultDir = wxEmptyString, + const wxString& defaultFile = wxEmptyString, + const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + long style = wxFD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + const wxString& name = wxASCII_STR(wxFileDialogNameStr)); + +#if wxOSX_USE_COCOA + ~wxFileDialog(); +#endif + + virtual void GetPaths(wxArrayString& paths) const wxOVERRIDE { paths = m_paths; } + virtual void GetFilenames(wxArrayString& files) const wxOVERRIDE { files = m_fileNames ; } + + virtual int ShowModal() wxOVERRIDE; + +#if wxOSX_USE_COCOA + virtual void ShowWindowModal() wxOVERRIDE; + virtual void ModalFinishedCallback(void* panel, int resultCode) wxOVERRIDE; +#endif + + virtual bool SupportsExtraControl() const wxOVERRIDE; + + // implementation only + +protected: + // not supported for file dialog, RR + virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y), + int WXUNUSED(width), int WXUNUSED(height), + int WXUNUSED(sizeFlags) = wxSIZE_AUTO) wxOVERRIDE {} + + void SetupExtraControls(WXWindow nativeWindow); + +#if wxOSX_USE_COCOA + virtual wxWindow* CreateFilterPanel(wxWindow *extracontrol); + void DoOnFilterSelected(int index); + virtual void OnFilterSelected(wxCommandEvent &event); + int GetMatchingFilterExtension(const wxString& filename); + + wxArrayString m_filterExtensions; + wxArrayString m_filterNames; + wxChoice* m_filterChoice; + wxWindow* m_filterPanel; + bool m_useFileTypeFilter; + int m_firstFileTypeFilter; + wxArrayString m_currentExtensions; + WX_NSObject m_delegate; +#endif + +private: + // Common part of all ctors. + void Init(); +}; + +#endif // _WX_FILEDLG_H_ diff --git a/lib/wxWidgets/include/wx/osx/font.h b/lib/wxWidgets/include/wx/osx/font.h new file mode 100644 index 0000000..52b260e --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/font.h @@ -0,0 +1,159 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/font.h +// Purpose: wxFont class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONT_H_ +#define _WX_FONT_H_ + +// ---------------------------------------------------------------------------- +// wxFont +// ---------------------------------------------------------------------------- + +// font styles +enum wxOSXSystemFont +{ + wxOSX_SYSTEM_FONT_NONE = 0, + wxOSX_SYSTEM_FONT_NORMAL, + wxOSX_SYSTEM_FONT_BOLD, + wxOSX_SYSTEM_FONT_SMALL, + wxOSX_SYSTEM_FONT_SMALL_BOLD, + wxOSX_SYSTEM_FONT_MINI, + wxOSX_SYSTEM_FONT_MINI_BOLD, + wxOSX_SYSTEM_FONT_LABELS, + wxOSX_SYSTEM_FONT_VIEWS, + wxOSX_SYSTEM_FONT_FIXED +}; + + +class WXDLLIMPEXP_CORE wxFont : public wxFontBase +{ +public: + // ctors and such + wxFont() { } + + wxFont(const wxFontInfo& info); + + wxFont( wxOSXSystemFont systemFont ); + wxFont(CTFontRef font); + +#if wxOSX_USE_COCOA + wxFont(WX_NSFont nsfont); +#endif + + wxFont(int size, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + Create(size, family, style, weight, underlined, face, encoding); + } + + wxFont(const wxSize& pixelSize, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + Create(10, family, style, weight, underlined, face, encoding); + SetPixelSize(pixelSize); + } + + bool Create(int size, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + + wxFont(const wxNativeFontInfo& info) + { + (void)Create(info); + } + + wxFont(const wxString& fontDesc); + + bool Create(const wxNativeFontInfo& info); + + virtual ~wxFont(); + + // implement base class pure virtuals + virtual double GetFractionalPointSize() const wxOVERRIDE; + virtual wxSize GetPixelSize() const wxOVERRIDE; + virtual wxFontStyle GetStyle() const wxOVERRIDE; + virtual int GetNumericWeight() const wxOVERRIDE; + virtual bool GetUnderlined() const wxOVERRIDE; + virtual bool GetStrikethrough() const wxOVERRIDE; + virtual wxString GetFaceName() const wxOVERRIDE; + virtual wxFontEncoding GetEncoding() const wxOVERRIDE; + virtual const wxNativeFontInfo *GetNativeFontInfo() const wxOVERRIDE; + + virtual bool IsFixedWidth() const wxOVERRIDE; + + virtual void SetFractionalPointSize(double pointSize) wxOVERRIDE; + virtual void SetFamily(wxFontFamily family) wxOVERRIDE; + virtual void SetStyle(wxFontStyle style) wxOVERRIDE; + virtual void SetNumericWeight(int weight) wxOVERRIDE; + virtual bool SetFaceName(const wxString& faceName) wxOVERRIDE; + virtual void SetUnderlined(bool underlined) wxOVERRIDE; + virtual void SetStrikethrough(bool strikethrough) wxOVERRIDE; + virtual void SetEncoding(wxFontEncoding encoding) wxOVERRIDE; + + wxDECLARE_COMMON_FONT_METHODS(); + + wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants") + wxFont(int size, + int family, + int style, + int weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + + + // implementation only from now on + // ------------------------------- + + virtual bool RealizeResource(); + + // Mac-specific, risks to change, don't use in portable code + +#if wxOSX_USE_COCOA_OR_CARBON + CGFontRef OSXGetCGFont() const; +#endif + + CTFontRef OSXGetCTFont() const; + CFDictionaryRef OSXGetCTFontAttributes() const; + +#if wxOSX_USE_COCOA + WX_NSFont OSXGetNSFont() const; +#endif + +#if wxOSX_USE_IPHONE + WX_UIFont OSXGetUIFont() const; +#endif + +protected: + virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info) wxOVERRIDE; + virtual wxFontFamily DoGetFamily() const wxOVERRIDE; + + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + +private: + + wxDECLARE_DYNAMIC_CLASS(wxFont); +}; + +#endif // _WX_FONT_H_ diff --git a/lib/wxWidgets/include/wx/osx/fontdlg.h b/lib/wxWidgets/include/wx/osx/fontdlg.h new file mode 100644 index 0000000..1ac7112 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/fontdlg.h @@ -0,0 +1,173 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/fontdlg.h +// Purpose: wxFontDialog class using fonts window services (10.2+). +// Author: Ryan Norton +// Modified by: +// Created: 2004-09-25 +// Copyright: (c) Ryan Norton +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONTDLG_H_ +#define _WX_FONTDLG_H_ + +#include "wx/dialog.h" + +/* + * Font dialog + */ + +/* + * support old notation + */ +#ifdef wxMAC_USE_EXPERIMENTAL_FONTDIALOG +#define wxOSX_USE_EXPERIMENTAL_FONTDIALOG wxMAC_USE_EXPERIMENTAL_FONTDIALOG +#endif + +#ifndef wxOSX_USE_EXPERIMENTAL_FONTDIALOG +#define wxOSX_USE_EXPERIMENTAL_FONTDIALOG 1 +#endif + +#if wxOSX_USE_EXPERIMENTAL_FONTDIALOG + +class WXDLLIMPEXP_CORE wxFontDialog : public wxDialog +{ +public: + wxFontDialog(); + wxFontDialog(wxWindow *parent); + wxFontDialog(wxWindow *parent, const wxFontData& data); + virtual ~wxFontDialog(); + + bool Create(wxWindow *parent); + bool Create(wxWindow *parent, const wxFontData& data); + + int ShowModal() wxOVERRIDE; + wxFontData& GetFontData() { return m_fontData; } + +protected: + wxFontData m_fontData; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxFontDialog); +}; + +extern "C" int RunMixedFontDialog(wxFontDialog* dialog) ; + +#else // wxOSX_USE_EXPERIMENTAL_FONTDIALOG + +#if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX + +/*! + * Forward declarations + */ + +class wxFontColourSwatchCtrl; +class wxFontPreviewCtrl; +class WXDLLIMPEXP_FWD_CORE wxSpinCtrl; +class WXDLLIMPEXP_FWD_CORE wxSpinEvent; +class WXDLLIMPEXP_FWD_CORE wxListBox; +class WXDLLIMPEXP_FWD_CORE wxChoice; +class WXDLLIMPEXP_FWD_CORE wxButton; +class WXDLLIMPEXP_FWD_CORE wxStaticText; +class WXDLLIMPEXP_FWD_CORE wxCheckBox; + +/*! + * Control identifiers + */ + +#define wxID_FONTDIALOG_FACENAME 20001 +#define wxID_FONTDIALOG_FONTSIZE 20002 +#define wxID_FONTDIALOG_BOLD 20003 +#define wxID_FONTDIALOG_ITALIC 20004 +#define wxID_FONTDIALOG_UNDERLINED 20005 +#define wxID_FONTDIALOG_COLOUR 20006 +#define wxID_FONTDIALOG_PREVIEW 20007 + +#endif + // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX + +class WXDLLIMPEXP_CORE wxFontDialog: public wxDialog +{ + wxDECLARE_DYNAMIC_CLASS(wxFontDialog); + +#if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX + wxDECLARE_EVENT_TABLE(); +#endif + +public: + wxFontDialog(); + wxFontDialog(wxWindow *parent, const wxFontData& data); + virtual ~wxFontDialog(); + + bool Create(wxWindow *parent, const wxFontData& data); + + int ShowModal(); + wxFontData& GetFontData() { return m_fontData; } + bool IsShown() const; + void OnPanelClose(); + void SetData(const wxFontData& data); + +#if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX + + /// Creates the controls and sizers + void CreateControls(); + + /// Initialize font + void InitializeFont(); + + /// Set controls according to current font + void InitializeControls(); + + /// Respond to font change + void ChangeFont(); + + /// Respond to colour change + void OnColourChanged(wxCommandEvent& event); + + /// wxEVT_LISTBOX event handler for wxID_FONTDIALOG_FACENAME + void OnFontdialogFacenameSelected( wxCommandEvent& event ); + + /// wxEVT_SPINCTRL event handler for wxID_FONTDIALOG_FONTSIZE + void OnFontdialogFontsizeUpdated( wxSpinEvent& event ); + + /// wxEVT_TEXT event handler for wxID_FONTDIALOG_FONTSIZE + void OnFontdialogFontsizeTextUpdated( wxCommandEvent& event ); + + /// wxEVT_CHECKBOX event handler for wxID_FONTDIALOG_BOLD + void OnFontdialogBoldClick( wxCommandEvent& event ); + + /// wxEVT_CHECKBOX event handler for wxID_FONTDIALOG_ITALIC + void OnFontdialogItalicClick( wxCommandEvent& event ); + + /// wxEVT_CHECKBOX event handler for wxID_FONTDIALOG_UNDERLINED + void OnFontdialogUnderlinedClick( wxCommandEvent& event ); + + /// wxEVT_BUTTON event handler for wxID_OK + void OnOkClick( wxCommandEvent& event ); + + /// Should we show tooltips? + static bool ShowToolTips(); + + wxListBox* m_facenameCtrl; + wxSpinCtrl* m_sizeCtrl; + wxCheckBox* m_boldCtrl; + wxCheckBox* m_italicCtrl; + wxCheckBox* m_underlinedCtrl; + wxFontColourSwatchCtrl* m_colourCtrl; + wxFontPreviewCtrl* m_previewCtrl; + + wxFont m_dialogFont; + bool m_suppressUpdates; + +#endif + // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX + +protected: + wxWindow* m_dialogParent; + wxFontData m_fontData; + void* m_pEventHandlerRef; +}; + +#endif + +#endif + // _WX_FONTDLG_H_ diff --git a/lib/wxWidgets/include/wx/osx/frame.h b/lib/wxWidgets/include/wx/osx/frame.h new file mode 100644 index 0000000..9fef19f --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/frame.h @@ -0,0 +1,107 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/frame.h +// Purpose: wxFrame class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FRAME_H_ +#define _WX_FRAME_H_ + +#include "wx/toolbar.h" +#include "wx/accel.h" +#include "wx/icon.h" + +class WXDLLIMPEXP_FWD_CORE wxMacToolTip ; + +class WXDLLIMPEXP_CORE wxFrame: public wxFrameBase +{ +public: + // construction + wxFrame() { } + wxFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + // implementation only from now on + // ------------------------------- + + // get the origin of the client area (which may be different from (0, 0) + // if the frame has a toolbar) in client coordinates + virtual wxPoint GetClientAreaOrigin() const wxOVERRIDE; + + // override some more virtuals + virtual bool Show(bool show = true) wxOVERRIDE; + virtual bool Enable(bool enable = true) wxOVERRIDE; + + // event handlers + void OnActivate(wxActivateEvent& event); + void OnSysColourChanged(wxSysColourChangedEvent& event); + + // Toolbar +#if wxUSE_TOOLBAR + virtual wxToolBar* CreateToolBar(long style = -1, + wxWindowID id = -1, + const wxString& name = wxASCII_STR(wxToolBarNameStr)) wxOVERRIDE; + + virtual void SetToolBar(wxToolBar *toolbar) wxOVERRIDE; +#endif // wxUSE_TOOLBAR + + // Status bar +#if wxUSE_STATUSBAR + virtual wxStatusBar* OnCreateStatusBar(int number = 1, + long style = wxSTB_DEFAULT_STYLE, + wxWindowID id = 0, + const wxString& name = wxASCII_STR(wxStatusLineNameStr)) wxOVERRIDE; + + virtual void SetStatusBar(wxStatusBar *statbar) wxOVERRIDE; +#endif // wxUSE_STATUSBAR + + void PositionBars(); + + // internal response to size events + virtual void MacOnInternalSize() wxOVERRIDE { PositionBars(); } + +protected: +#if wxUSE_TOOLBAR + virtual void PositionToolBar() wxOVERRIDE; +#endif +#if wxUSE_STATUSBAR + virtual void PositionStatusBar() wxOVERRIDE; +#endif + + // override base class virtuals + virtual void DoGetClientSize(int *width, int *height) const wxOVERRIDE; + virtual void DoSetClientSize(int width, int height) wxOVERRIDE; + +#if wxUSE_MENUBAR + virtual void DetachMenuBar() wxOVERRIDE; + virtual void AttachMenuBar(wxMenuBar *menubar) wxOVERRIDE; +#endif + + virtual bool MacIsChildOfClientArea( const wxWindow* child ) const wxOVERRIDE; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxFrame); +}; + +#endif + // _WX_FRAME_H_ diff --git a/lib/wxWidgets/include/wx/osx/fswatcher_fsevents.h b/lib/wxWidgets/include/wx/osx/fswatcher_fsevents.h new file mode 100644 index 0000000..6988951 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/fswatcher_fsevents.h @@ -0,0 +1,87 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/fswatcher_fsevents.h +// Purpose: File System watcher that uses the FSEvents API +// of OS X to efficiently watch trees +// Author: Roberto Perpuly +// Created: 2015-04-24 +// Copyright: (c) 2015 Roberto Perpuly <robertop2004@gmail.com> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FSWATCHER_FSEVENTS_H_ +#define _WX_FSWATCHER_FSEVENTS_H_ + +#include "wx/defs.h" + +#if wxUSE_FSWATCHER + +#include "wx/unix/fswatcher_kqueue.h" + +/* + The FSEvents watcher uses the newer FSEvents service + that is available in OS X, the service allows for + efficient watching of entire directory hierarchies. + Note that adding a single file watch (or directory + watch) still use kqueue events. + + We take care to only use this on OS X >= 10.7, as that + version introduced the ability to get file-level notifications. + + See the following docs that outline the FSEvents API + + https://developer.apple.com/library/mac/documentation/Darwin/Conceptual/FSEvents_ProgGuide/UsingtheFSEventsFramework/UsingtheFSEventsFramework.html + + https://developer.apple.com/library/mac/documentation/Darwin/Reference/FSEvents_Ref/index.html +*/ +class WXDLLIMPEXP_BASE wxFsEventsFileSystemWatcher : + public wxKqueueFileSystemWatcher +{ +public: + wxFsEventsFileSystemWatcher(); + + wxFsEventsFileSystemWatcher(const wxFileName& path, + int events = wxFSW_EVENT_ALL); + + ~wxFsEventsFileSystemWatcher(); + + // reimplement adding a tree so that it does not use + // kqueue at all + bool AddTree(const wxFileName& path, int events = wxFSW_EVENT_ALL, + const wxString& filespec = wxEmptyString) wxOVERRIDE; + + // reimplement removing a tree so that we + // cleanup the opened fs streams + bool RemoveTree(const wxFileName& path) wxOVERRIDE; + + // reimplement remove all so that we cleanup + // watches from kqeueue and from FSEvents + bool RemoveAll() wxOVERRIDE; + + // post a file change event to the owner + void PostChange(const wxFileName& oldFileName, + const wxFileName& newFileName, int event); + + // post a warning event to the owner + void PostWarning(wxFSWWarningType warning, const wxString& msg); + + // post an error event to the owner + void PostError(const wxString& msg); + + // reimplement count to include the FS stream watches + int GetWatchedPathsCount() const; + + // reimplement to include paths from FS stream watches + int GetWatchedPaths(wxArrayString* paths) const; + +private: + + // use the pImpl idiom to eliminate this header's dependency + // on CoreServices.h (and ultimately AssertMacros.h) + struct PrivateData; + PrivateData *m_pImpl; + +}; + +#endif /* wxUSE_FSWATCHER */ + +#endif /* _WX_FSWATCHER_FSEVENTS_H_ */ diff --git a/lib/wxWidgets/include/wx/osx/gauge.h b/lib/wxWidgets/include/wx/osx/gauge.h new file mode 100644 index 0000000..fe012ad --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/gauge.h @@ -0,0 +1,53 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/gauge.h +// Purpose: wxGauge class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GAUGE_H_ +#define _WX_GAUGE_H_ + +#include "wx/control.h" + +// Group box +class WXDLLIMPEXP_CORE wxGauge: public wxGaugeBase +{ + public: + wxGauge() { } + + wxGauge(wxWindow *parent, wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxGaugeNameStr)) + { + Create(parent, id, range, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxGaugeNameStr)); + + // set gauge range/value + virtual void SetRange(int range) wxOVERRIDE; + virtual void SetValue(int pos) wxOVERRIDE; + virtual int GetValue() const wxOVERRIDE; + + void Pulse() wxOVERRIDE; + + protected: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxGauge); +}; + +#endif + // _WX_GAUGE_H_ diff --git a/lib/wxWidgets/include/wx/osx/glcanvas.h b/lib/wxWidgets/include/wx/osx/glcanvas.h new file mode 100644 index 0000000..1c28015 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/glcanvas.h @@ -0,0 +1,177 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/glcanvas.h +// Purpose: wxGLCanvas, for using OpenGL with wxWidgets under Macintosh +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GLCANVAS_H_ +#define _WX_GLCANVAS_H_ + +#ifdef __WXOSX_IPHONE__ +#import <OpenGLES/ES1/gl.h> +#import <OpenGLES/ES1/glext.h> +#define wxUSE_OPENGL_EMULATION 1 +#else +#ifndef GL_SILENCE_DEPRECATION + #define GL_SILENCE_DEPRECATION +#endif +#include <OpenGL/gl.h> +#endif + +#include "wx/vector.h" + +// low level calls + +WXDLLIMPEXP_GL WXGLContext WXGLCreateContext( WXGLPixelFormat pixelFormat, WXGLContext shareContext ); +WXDLLIMPEXP_GL void WXGLDestroyContext( WXGLContext context ); + +WXDLLIMPEXP_GL WXGLContext WXGLGetCurrentContext(); +WXDLLIMPEXP_GL bool WXGLSetCurrentContext(WXGLContext context); + +WXDLLIMPEXP_GL WXGLPixelFormat WXGLChoosePixelFormat(const int *GLAttrs = NULL, + int n1 = 0, + const int *ctxAttrs = NULL, + int n2 = 0); +WXDLLIMPEXP_GL void WXGLDestroyPixelFormat( WXGLPixelFormat pixelFormat ); + +class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase +{ +public: + wxGLContext(wxGLCanvas *win, + const wxGLContext *other = NULL, + const wxGLContextAttrs *ctxAttrs = NULL); + virtual ~wxGLContext(); + + virtual bool SetCurrent(const wxGLCanvas& win) const wxOVERRIDE; + + // Mac-specific + WXGLContext GetWXGLContext() const { return m_glContext; } + +private: + WXGLContext m_glContext; + + wxDECLARE_NO_COPY_CLASS(wxGLContext); +}; + +class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasBase +{ +public: + wxGLCanvas(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + + wxGLCanvas(wxWindow *parent, + wxWindowID id = wxID_ANY, + const int *attribList = NULL, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + + bool Create(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const int *attribList = NULL, + const wxPalette& palette = wxNullPalette); + + virtual ~wxGLCanvas(); + + // implement wxGLCanvasBase methods + virtual bool SwapBuffers() wxOVERRIDE; + + // Mac-specific functions + // ---------------------- + + // return true if multisample extension is supported + static bool IsAGLMultiSampleAvailable(); + + // return the pixel format used by this window + WXGLPixelFormat GetWXGLPixelFormat() const { return m_glFormat; } + + // Return the copy of attributes passed at ctor + wxGLAttributes& GetGLDispAttrs() { return m_GLAttrs; } + + // update the view port of the current context to match this window + void SetViewport(); + + + // deprecated methods + // ------------------ + +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED( + wxGLCanvas(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const int *attribList = NULL, + const wxPalette& palette = wxNullPalette) + ); + + wxDEPRECATED( + wxGLCanvas(wxWindow *parent, + const wxGLContext *shared, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const int *attribList = NULL, + const wxPalette& palette = wxNullPalette) + ); + + wxDEPRECATED( + wxGLCanvas(wxWindow *parent, + const wxGLCanvas *shared, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const int *attribList = NULL, + const wxPalette& palette = wxNullPalette) + ); +#endif // WXWIN_COMPATIBILITY_2_8 + + // implementation-only from now on + +protected: + bool DoCreate(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name); + + WXGLPixelFormat m_glFormat; + wxGLAttributes m_GLAttrs; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_CLASS(wxGLCanvas); +}; + +#endif // _WX_GLCANVAS_H_ diff --git a/lib/wxWidgets/include/wx/osx/iphone/chkconf.h b/lib/wxWidgets/include/wx/osx/iphone/chkconf.h new file mode 100644 index 0000000..815507b --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/iphone/chkconf.h @@ -0,0 +1,399 @@ +/* + * Name: wx/osx/iphone/chkconf.h + * Purpose: Compiler-specific configuration checking + * Author: Stefan Csomor + * Modified by: + * Created: 2008-07-30 + * Copyright: (c) Stefan Csomor + * Licence: wxWindows licence + */ + +#ifndef _WX_OSX_IPHONE_CHKCONF_H_ +#define _WX_OSX_IPHONE_CHKCONF_H_ + +/* + * text rendering system + */ + +/* we have different options and we turn on all that make sense + * under a certain platform + */ + +#define wxHAS_OPENGL_ES + +#define wxOSX_USE_QUICKTIME 0 +#define wxOSX_USE_AUDIOTOOLBOX 1 + +/* + * turning off capabilities that don't work under iphone yet + */ + +#if wxUSE_MIMETYPE +#undef wxUSE_MIMETYPE +#define wxUSE_MIMETYPE 0 +#endif + +#if wxUSE_MDI +#undef wxUSE_MDI +#define wxUSE_MDI 0 +#endif + +#if wxUSE_MDI_ARCHITECTURE +#undef wxUSE_MDI_ARCHITECTURE +#define wxUSE_MDI_ARCHITECTURE 0 +#endif + +#if wxUSE_DRAG_AND_DROP +#undef wxUSE_DRAG_AND_DROP +#define wxUSE_DRAG_AND_DROP 0 +#endif + +#if wxUSE_TASKBARICON +#undef wxUSE_TASKBARICON +#define wxUSE_TASKBARICON 0 +#endif + +#if wxUSE_TOOLTIPS +#undef wxUSE_TOOLTIPS +#define wxUSE_TOOLTIPS 0 +#endif + +#if wxUSE_DATAVIEWCTRL +#undef wxUSE_DATAVIEWCTRL +#define wxUSE_DATAVIEWCTRL 0 +#endif + +#if wxUSE_TREELISTCTRL +#undef wxUSE_TREELISTCTRL +#define wxUSE_TREELISTCTRL 0 +#endif + +#if wxUSE_DRAG_AND_DROP +#undef wxUSE_DRAG_AND_DROP +#define wxUSE_DRAG_AND_DROP 0 +#endif + +#if wxUSE_TASKBARICON +#undef wxUSE_TASKBARICON +#define wxUSE_TASKBARICON 0 +#endif + +#define wxUSE_BUTTON 1 + +#if wxUSE_CARET +#undef wxUSE_CARET +#define wxUSE_CARET 0 +#endif + +#if wxUSE_CHOICE +#undef wxUSE_CHOICE +#define wxUSE_CHOICE 0 +#endif + +#if wxUSE_COMBOBOX +#undef wxUSE_COMBOBOX +#define wxUSE_COMBOBOX 0 +#endif + +#ifndef __WXUNIVERSAL__ +#undef wxUSE_SCROLLBAR +#define wxUSE_SCROLLBAR 0 +#endif + +#undef wxUSE_STATUSBAR +#undef wxUSE_NATIVE_STATUSBAR +#undef wxUSE_ABOUTDLG +#undef wxUSE_STATLINE +#undef wxUSE_COLLPANE +#undef wxUSE_STATBMP +#undef wxUSE_STATBOX +#undef wxUSE_RADIOBTN +#undef wxUSE_RADIOBOX +#undef wxUSE_TOGGLEBTN + + +#define wxUSE_STATUSBAR 0 +#define wxUSE_NATIVE_STATUSBAR 0 +#define wxUSE_ABOUTDLG 0 +#define wxUSE_STATLINE 0 +#define wxUSE_COLLPANE 0 +#define wxUSE_STATBMP 0 +#define wxUSE_STATBOX 0 +#define wxUSE_RADIOBTN 0 +#define wxUSE_RADIOBOX 0 +#define wxUSE_TOGGLEBTN 0 + +#undef wxUSE_HTML + +#define wxUSE_HTML 0 + +#undef wxUSE_RICHTEXT +#define wxUSE_RICHTEXT 0 + +#undef wxUSE_ACTIVITYINDICATOR +#undef wxUSE_ADDREMOVECTRL +#undef wxUSE_ANIMATIONCTRL +#undef wxUSE_CALENDARCTRL +#undef wxUSE_COMBOCTRL +#undef wxUSE_ODCOMBOBOX +#undef wxUSE_BITMAPCOMBOBOX +#undef wxUSE_BMPBUTTON +#undef wxUSE_CHECKLISTBOX +#undef wxUSE_GRID +#undef wxUSE_LISTBOX +#undef wxUSE_LISTCTRL +#undef wxUSE_NOTEBOOK +#undef wxUSE_SPINBTN +#undef wxUSE_SPINCTRL +#undef wxUSE_TREECTRL +#undef wxUSE_DATEPICKCTRL +#undef wxUSE_DATAVIEWCTRL +#undef wxUSE_EDITABLELISTBOX +#undef wxUSE_FILEPICKERCTRL +#undef wxUSE_DIRPICKERCTRL +#undef wxUSE_FILECTRL +#undef wxUSE_COLOURPICKERCTRL +#undef wxUSE_FONTPICKERCTRL +#undef wxUSE_DEBUGREPORT +#undef wxUSE_HYPERLINKCTRL +#undef wxUSE_STC +#undef wxUSE_AUI +#undef wxUSE_BUSYINFO +#undef wxUSE_SEARCHCTRL + +#define wxUSE_ACTIVITYINDICATOR 0 +#define wxUSE_ADDREMOVECTRL 0 +#define wxUSE_ANIMATIONCTRL 0 +#define wxUSE_CALENDARCTRL 0 +#define wxUSE_COMBOCTRL 0 +#define wxUSE_ODCOMBOBOX 0 +#define wxUSE_BITMAPCOMBOBOX 0 +#define wxUSE_BMPBUTTON 0 +#define wxUSE_CHECKLISTBOX 0 +#define wxUSE_GRID 0 +#define wxUSE_LISTBOX 0 +#define wxUSE_LISTCTRL 0 +#define wxUSE_NOTEBOOK 0 +#define wxUSE_SPINBTN 0 +#define wxUSE_SPINCTRL 0 +#define wxUSE_TREECTRL 0 +#define wxUSE_DATEPICKCTRL 0 +#define wxUSE_DATAVIEWCTRL 0 +#define wxUSE_EDITABLELISTBOX 0 +#define wxUSE_FILEPICKERCTRL 0 +#define wxUSE_DIRPICKERCTRL 0 +#define wxUSE_FILECTRL 0 +#define wxUSE_COLOURPICKERCTRL 0 +#define wxUSE_FONTPICKERCTRL 0 +#define wxUSE_DEBUGREPORT 0 +#define wxUSE_HYPERLINKCTRL 0 +#define wxUSE_STC 0 +#define wxUSE_AUI 0 +#define wxUSE_BUSYINFO 0 +#define wxUSE_SEARCHCTRL 0 + +#undef wxUSE_LOGWINDOW +#undef wxUSE_LOG_DIALOG +#undef wxUSE_LISTBOOK +#undef wxUSE_CHOICEBOOK +#undef wxUSE_TREEBOOK +#undef wxUSE_TOOLBOOK +#undef wxUSE_CHOICEDLG +#undef wxUSE_HELP +#undef wxUSE_PROGRESSDLG +#undef wxUSE_FONTDLG +#undef wxUSE_FILEDLG +#undef wxUSE_CHOICEDLG +#undef wxUSE_NUMBERDLG +#undef wxUSE_TEXTDLG +#undef wxUSE_DIRDLG +#undef wxUSE_STARTUP_TIPS +#undef wxUSE_WIZARDDLG +#undef wxUSE_TOOLBAR_NATIVE +#undef wxUSE_FINDREPLDLG +#undef wxUSE_TASKBARICON +#undef wxUSE_REARRANGECTRL +#undef wxUSE_NATIVE_DATAVIEWCTRL + +#define wxUSE_LOGWINDOW 0 +#define wxUSE_LOG_DIALOG 0 +#define wxUSE_LISTBOOK 0 +#define wxUSE_CHOICEBOOK 0 +#define wxUSE_TREEBOOK 0 +#define wxUSE_TOOLBOOK 0 +#define wxUSE_CHOICEDLG 0 +#define wxUSE_HELP 0 +#define wxUSE_PROGRESSDLG 0 +#define wxUSE_FONTDLG 0 +#define wxUSE_FILEDLG 0 +#define wxUSE_CHOICEDLG 0 +#define wxUSE_NUMBERDLG 0 +#define wxUSE_TEXTDLG 0 +#define wxUSE_DIRDLG 0 +#define wxUSE_STARTUP_TIPS 0 +#define wxUSE_WIZARDDLG 0 +#define wxUSE_TOOLBAR_NATIVE 0 +#define wxUSE_FINDREPLDLG 0 +#define wxUSE_TASKBARICON 0 +#define wxUSE_REARRANGECTRL 0 +#define wxUSE_NATIVE_DATAVIEWCTRL 0 + +#if wxUSE_WXHTML_HELP +#undef wxUSE_WXHTML_HELP +#define wxUSE_WXHTML_HELP 0 +#endif + +#if wxUSE_DOC_VIEW_ARCHITECTURE +#undef wxUSE_DOC_VIEW_ARCHITECTURE +#define wxUSE_DOC_VIEW_ARCHITECTURE 0 +#endif + +#if wxUSE_PRINTING_ARCHITECTURE +#undef wxUSE_PRINTING_ARCHITECTURE +#define wxUSE_PRINTING_ARCHITECTURE 0 +#endif + +#if wxUSE_MENUS +#undef wxUSE_MENUS +// we are basing our implementatino on UIMenuElement +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 +#define wxUSE_MENUS 1 +#else +#define wxUSE_MENUS 0 +#endif +#endif + +#if wxUSE_MENUBAR +#undef wxUSE_MENUBAR +#define wxUSE_MENUBAR 0 +#endif + +/* +#if wxUSE_POPUPWIN +#undef wxUSE_POPUPWIN +#define wxUSE_POPUPWIN 0 +#endif + +#if wxUSE_COMBOBOX +#undef wxUSE_COMBOBOX +#define wxUSE_COMBOBOX 0 +#endif + + + +#if wxUSE_CALENDARCTRL +#undef wxUSE_CALENDARCTRL +#define wxUSE_CALENDARCTRL 0 +#endif + +*/ + +#if wxUSE_CLIPBOARD +#undef wxUSE_CLIPBOARD +#define wxUSE_CLIPBOARD 0 +#endif // wxUSE_CLIPBOARD + +/* +#if wxUSE_GLCANVAS +#undef wxUSE_GLCANVAS +#define wxUSE_GLCANVAS 0 +#endif // wxUSE_GLCANVAS +*/ + +#if wxUSE_COLOURDLG +#undef wxUSE_COLOURDLG +#define wxUSE_COLOURDLG 0 +#endif // wxUSE_COLOURDLG + +// iphone has a toolbar that is a regular UIView + +#ifdef wxOSX_USE_NATIVE_TOOLBAR +#if wxOSX_USE_NATIVE_TOOLBAR +#undef wxOSX_USE_NATIVE_TOOLBAR +#define wxOSX_USE_NATIVE_TOOLBAR 0 +#endif +#else +#define wxOSX_USE_NATIVE_TOOLBAR 0 +#endif + +#if wxUSE_RIBBON +#undef wxUSE_RIBBON +#define wxUSE_RIBBON 0 +#endif + +#if wxUSE_INFOBAR +#undef wxUSE_INFOBAR +#define wxUSE_INFOBAR 0 +#endif + +#if wxUSE_FILE_HISTORY +#undef wxUSE_FILE_HISTORY +#define wxUSE_FILE_HISTORY 0 +#endif + +#if wxUSE_NOTIFICATION_MESSAGE +#undef wxUSE_NOTIFICATION_MESSAGE +#define wxUSE_NOTIFICATION_MESSAGE 0 +#endif + +#undef wxUSE_PREFERENCES_EDITOR +#define wxUSE_PREFERENCES_EDITOR 0 + +#if wxUSE_PROPGRID +#undef wxUSE_PROPGRID +#define wxUSE_PROPGRID 0 +#endif + +#if wxUSE_WEBKIT +#undef wxUSE_WEBKIT +#define wxUSE_WEBKIT 0 +#endif + +#if wxUSE_DATAOBJ +#undef wxUSE_DATAOBJ +#define wxUSE_DATAOBJ 0 +#endif + +#if wxUSE_UIACTIONSIMULATOR +#undef wxUSE_UIACTIONSIMULATOR +#define wxUSE_UIACTIONSIMULATOR 0 +#endif + +#if wxUSE_RICHMSGDLG +#undef wxUSE_RICHMSGDLG +#define wxUSE_RICHMSGDLG 0 +#endif + +#if wxUSE_RICHTEXT +#undef wxUSE_RICHTEXT +#define wxUSE_RICHTEXT 0 +#endif + +#if wxUSE_TIMEPICKCTRL +#undef wxUSE_TIMEPICKCTRL +#define wxUSE_TIMEPICKCTRL 0 +#endif + +#if wxUSE_RICHTOOLTIP +#undef wxUSE_RICHTOOLTIP +#define wxUSE_RICHTOOLTIP 0 +#endif + +#if wxUSE_WEBVIEW +#undef wxUSE_WEBVIEW +#define wxUSE_WEBVIEW 0 +#endif + +#if wxUSE_SECRETSTORE + #undef wxUSE_SECRETSTORE + #define wxUSE_SECRETSTORE 0 +#endif + +// IconRef datatype does not exist on iOS + +#undef wxOSX_USE_ICONREF +#define wxOSX_USE_ICONREF 0 + +#endif + /* _WX_OSX_IPHONE_CHKCONF_H_ */ + diff --git a/lib/wxWidgets/include/wx/osx/iphone/private.h b/lib/wxWidgets/include/wx/osx/iphone/private.h new file mode 100644 index 0000000..902b98f --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/iphone/private.h @@ -0,0 +1,241 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/iphone/private.h +// Purpose: Private declarations: as this header is only included by +// wxWidgets itself, it may contain identifiers which don't start +// with "wx". +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_IPHONE_H_ +#define _WX_PRIVATE_IPHONE_H_ + +#ifdef __OBJC__ + #import <UIKit/UIKit.h> +#endif + +#include <CoreText/CTFont.h> +#include <CoreText/CTStringAttributes.h> +#include <CoreText/CTLine.h> + + +#if wxUSE_GUI + +#include "wx/bmpbndl.h" + +typedef CGRect WXRect; + +OSStatus WXDLLIMPEXP_CORE wxMacDrawCGImage( + CGContextRef inContext, + const CGRect * inBounds, + CGImageRef inImage) ; + +WX_UIImage WXDLLIMPEXP_CORE wxOSXGetUIImageFromCGImage( CGImageRef image ); +wxBitmapBundle WXDLLIMPEXP_CORE wxOSXCreateSystemBitmapBundle(const wxString& id, const wxString &client, const wxSize& size); + +class WXDLLIMPEXP_CORE wxWidgetIPhoneImpl : public wxWidgetImpl +{ +public : + wxWidgetIPhoneImpl( wxWindowMac* peer , WXWidget w, int flags = 0 ) ; + wxWidgetIPhoneImpl() ; + ~wxWidgetIPhoneImpl(); + + void Init(); + + virtual bool IsVisible() const ; + virtual void SetVisibility( bool visible ); + + virtual void Raise(); + + virtual void Lower(); + + virtual void ScrollRect( const wxRect *rect, int dx, int dy ); + + virtual WXWidget GetWXWidget() const { return m_osxView; } + + virtual void SetBackgroundColour( const wxColour& col ) ; + virtual bool SetBackgroundStyle(wxBackgroundStyle style) ; + virtual void SetForegroundColour( const wxColour& col ) ; + + virtual void GetContentArea( int &left , int &top , int &width , int &height ) const; + virtual void Move(int x, int y, int width, int height); + virtual void GetPosition( int &x, int &y ) const; + virtual void GetSize( int &width, int &height ) const; + virtual void SetControlSize( wxWindowVariant variant ); + virtual double GetContentScaleFactor() const ; + + virtual void SetNeedsDisplay( const wxRect* where = NULL ); + virtual bool GetNeedsDisplay() const; + + virtual bool CanFocus() const; + // return true if successful + virtual bool SetFocus(); + virtual bool HasFocus() const; + + void RemoveFromParent(); + void Embed( wxWidgetImpl *parent ); + + void SetDefaultButton( bool isDefault ); + void PerformClick(); + virtual void SetLabel(const wxString& title, wxFontEncoding encoding); + + void SetCursor( const wxCursor & cursor ); + void CaptureMouse(); + void ReleaseMouse(); + + wxInt32 GetValue() const; + void SetValue( wxInt32 v ); + + virtual wxBitmap GetBitmap() const; + virtual void SetBitmap( const wxBitmapBundle& bitmap ); + virtual void SetBitmapPosition( wxDirection dir ); + + void SetupTabs( const wxNotebook ¬ebook ); + void GetBestRect( wxRect *r ) const; + bool IsEnabled() const; + void Enable( bool enable ); + bool ButtonClickDidStateChange() { return true ;} + void SetMinimum( wxInt32 v ); + void SetMaximum( wxInt32 v ); + void SetIncrement(int WXUNUSED(value)) { } + wxInt32 GetMinimum() const; + wxInt32 GetMaximum() const; + int GetIncrement() const { return 1; } + void PulseGauge(); + void SetScrollThumb( wxInt32 value, wxInt32 thumbSize ); + + void SetFont(const wxFont & font); + + void InstallEventHandler( WXWidget control = NULL ); + bool EnableTouchEvents(int WXUNUSED(eventsMask)) { return false; } + + virtual void DoNotifyFocusEvent(bool receivedFocus, wxWidgetImpl* otherWindow); + + // thunk connected calls + + virtual void drawRect(CGRect* rect, WXWidget slf, void* _cmd); + virtual void touchEvent(WX_NSSet touches, WX_UIEvent event, WXWidget slf, void* _cmd); + virtual bool becomeFirstResponder(WXWidget slf, void* _cmd); + virtual bool resignFirstResponder(WXWidget slf, void* _cmd); + + // action + + virtual void controlAction(void* sender, wxUint32 controlEvent, WX_UIEvent rawEvent); + virtual void controlTextDidChange(); +protected: + WXWidget m_osxView; + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxWidgetIPhoneImpl); +}; + +class wxNonOwnedWindowIPhoneImpl : public wxNonOwnedWindowImpl +{ +public : + wxNonOwnedWindowIPhoneImpl( wxNonOwnedWindow* nonownedwnd) ; + wxNonOwnedWindowIPhoneImpl(); + + virtual ~wxNonOwnedWindowIPhoneImpl(); + + virtual void WillBeDestroyed() ; + void Create( wxWindow* parent, const wxPoint& pos, const wxSize& size, + long style, long extraStyle, const wxString& name ) ; + void Create( wxWindow* parent, WXWindow nativeWindow ); + + WXWindow GetWXWindow() const; + void Raise(); + void Lower(); + bool Show(bool show); + bool ShowWithEffect(bool show, wxShowEffect effect, unsigned timeout); + + void Update(); + bool SetTransparent(wxByte alpha); + bool SetBackgroundColour(const wxColour& col ); + void SetExtraStyle( long exStyle ); + bool SetBackgroundStyle(wxBackgroundStyle style); + bool CanSetTransparent(); + + void MoveWindow(int x, int y, int width, int height); + void GetPosition( int &x, int &y ) const; + void GetSize( int &width, int &height ) const; + + void GetContentArea( int &left , int &top , int &width , int &height ) const; + bool SetShape(const wxRegion& region); + + virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) ; + + // Title bar buttons don't exist in iOS. + virtual bool EnableCloseButton(bool WXUNUSED(enable)) { return false; } + virtual bool EnableMaximizeButton(bool WXUNUSED(enable)) { return false; } + virtual bool EnableMinimizeButton(bool WXUNUSED(enable)) { return false; } + + virtual bool IsMaximized() const; + + virtual bool IsIconized() const; + + virtual void Iconize( bool iconize ); + + virtual void Maximize(bool maximize); + + virtual bool IsFullScreen() const; + + virtual bool EnableFullScreenView(bool enable, long style); + + virtual bool ShowFullScreen(bool show, long style); + + virtual wxContentProtection GetContentProtection() const wxOVERRIDE + { return wxCONTENT_PROTECTION_NONE; } + virtual bool SetContentProtection(wxContentProtection contentProtection) wxOVERRIDE + { return false; } + + virtual void RequestUserAttention(int flags); + + virtual void ScreenToWindow( int *x, int *y ); + + virtual void WindowToScreen( int *x, int *y ); + + // FIXME: Does iPhone have a concept of inactive windows? + virtual bool IsActive() { return true; } + + wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; } + + virtual bool InitialShowEventSent() { return m_initialShowSent; } +protected : + WX_UIWindow m_macWindow; + void * m_macFullScreenData ; + bool m_initialShowSent; + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxNonOwnedWindowIPhoneImpl); +}; + +#ifdef __OBJC__ + + WXDLLIMPEXP_CORE CGRect wxToNSRect( UIView* parent, const wxRect& r ); + WXDLLIMPEXP_CORE wxRect wxFromNSRect( UIView* parent, const CGRect& rect ); + WXDLLIMPEXP_CORE CGPoint wxToNSPoint( UIView* parent, const wxPoint& p ); + WXDLLIMPEXP_CORE wxPoint wxFromNSPoint( UIView* parent, const CGPoint& p ); + + CGRect WXDLLIMPEXP_CORE wxOSXGetFrameForControl( wxWindowMac* window , const wxPoint& pos , const wxSize &size , + bool adjustForOrigin = true ); + + @interface wxUIButton : UIButton + { + } + + @end + + @interface wxUIView : UIView + { + } + + @end // wxUIView + + + void WXDLLIMPEXP_CORE wxOSXIPhoneClassAddWXMethods(Class c); + +#endif + +#endif // wxUSE_GUI + +#endif + // _WX_PRIVATE_IPHONE_H_ diff --git a/lib/wxWidgets/include/wx/osx/iphone/private/textimpl.h b/lib/wxWidgets/include/wx/osx/iphone/private/textimpl.h new file mode 100644 index 0000000..bdaa6c0 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/iphone/private/textimpl.h @@ -0,0 +1,106 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/iphone/private/textimpl.h +// Purpose: textcontrol implementation classes that have to be exposed +// Author: Stefan Csomor +// Modified by: +// Created: 03/02/99 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_ +#define _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_ + +#include "wx/combobox.h" +#include "wx/osx/private.h" + +// implementation exposed, so that search control can pull it + +class wxUITextFieldControl : public wxWidgetIPhoneImpl, public wxTextWidgetImpl +{ +public : + wxUITextFieldControl( wxTextCtrl *wxPeer, UITextField* w ); + virtual ~wxUITextFieldControl(); + + virtual wxString GetStringValue() const ; + virtual void SetStringValue( const wxString &str) ; + virtual void Copy() ; + virtual void Cut() ; + virtual void Paste() ; + virtual bool CanPaste() const ; + virtual void SetEditable(bool editable) ; + virtual void GetSelection( long* from, long* to) const ; + virtual void SetSelection( long from , long to ); + virtual void WriteText(const wxString& str) ; + virtual bool HasOwnContextMenu() const { return true; } + + virtual wxSize GetBestSize() const; + + virtual bool SetHint(const wxString& hint); + + virtual void controlAction(WXWidget slf, void* _cmd, void *sender); +protected : + UITextField* m_textField; + NSObject<UITextFieldDelegate>* m_delegate; + long m_selStart; + long m_selEnd; +}; + +class wxUITextViewControl : public wxWidgetIPhoneImpl, public wxTextWidgetImpl +{ +public: + wxUITextViewControl( wxTextCtrl *wxPeer, UITextView* w ); + virtual ~wxUITextViewControl(); + + virtual wxString GetStringValue() const ; + virtual void SetStringValue( const wxString &str) ; + virtual void Copy() ; + virtual void Cut() ; + virtual void Paste() ; + virtual bool CanPaste() const ; + virtual void SetEditable(bool editable) ; + virtual void GetSelection( long* from, long* to) const ; + virtual void SetSelection( long from , long to ); + virtual void WriteText(const wxString& str) ; + virtual void SetFont(const wxFont & font); + + virtual bool GetStyle(long position, wxTextAttr& style); + virtual void SetStyle(long start, long end, const wxTextAttr& style); + + virtual bool CanFocus() const; + + virtual bool HasOwnContextMenu() const { return true; } + + virtual wxSize GetBestSize() const; + +protected: + NSObject<UITextViewDelegate>* m_delegate; + UITextView* m_textView; +}; + +#if 0 +class wxNSComboBoxControl : public wxUITextFieldControl, public wxComboWidgetImpl +{ +public : + wxNSComboBoxControl( wxWindow *wxPeer, WXWidget w ); + virtual ~wxNSComboBoxControl(); + + virtual int GetSelectedItem() const; + virtual void SetSelectedItem(int item); + + virtual int GetNumberOfItems() const; + + virtual void InsertItem(int pos, const wxString& item); + virtual void RemoveItem(int pos); + + virtual void Clear(); + + virtual wxString GetStringAtIndex(int pos) const; + + virtual int FindString(const wxString& text) const; +private: + NSComboBox* m_comboBox; +}; +#endif + +#endif // _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_ diff --git a/lib/wxWidgets/include/wx/osx/joystick.h b/lib/wxWidgets/include/wx/osx/joystick.h new file mode 100644 index 0000000..310cb6d --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/joystick.h @@ -0,0 +1,90 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/joystick.h +// Purpose: wxJoystick class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_JOYSTICK_H_ +#define _WX_JOYSTICK_H_ + +#include "wx/event.h" + +class WXDLLIMPEXP_ADV wxJoystick: public wxObject +{ + wxDECLARE_DYNAMIC_CLASS(wxJoystick); +public: + /* + * Public interface + */ + + wxJoystick(int joystick = wxJOYSTICK1) { m_joystick = joystick; } + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + wxPoint GetPosition() const; + int GetPosition(unsigned axis) const; + bool GetButtonState(unsigned button) const; + int GetZPosition() const; + int GetButtonState() const; + int GetPOVPosition() const; + int GetPOVCTSPosition() const; + int GetRudderPosition() const; + int GetUPosition() const; + int GetVPosition() const; + int GetMovementThreshold() const; + void SetMovementThreshold(int threshold) ; + + // Capabilities + //////////////////////////////////////////////////////////////////////////// + + bool IsOk() const; // Checks that the joystick is functioning + static int GetNumberJoysticks() ; + int GetManufacturerId() const ; + int GetProductId() const ; + wxString GetProductName() const ; + int GetXMin() const; + int GetYMin() const; + int GetZMin() const; + int GetXMax() const; + int GetYMax() const; + int GetZMax() const; + int GetNumberButtons() const; + int GetNumberAxes() const; + int GetMaxButtons() const; + int GetMaxAxes() const; + int GetPollingMin() const; + int GetPollingMax() const; + int GetRudderMin() const; + int GetRudderMax() const; + int GetUMin() const; + int GetUMax() const; + int GetVMin() const; + int GetVMax() const; + + bool HasRudder() const; + bool HasZ() const; + bool HasU() const; + bool HasV() const; + bool HasPOV() const; + bool HasPOV4Dir() const; + bool HasPOVCTS() const; + + // Operations + //////////////////////////////////////////////////////////////////////////// + + // pollingFreq = 0 means that movement events are sent when above the threshold. + // If pollingFreq > 0, events are received every this many milliseconds. + bool SetCapture(wxWindow* win, int pollingFreq = 0); + bool ReleaseCapture(); + +protected: + int m_joystick; +}; + +#endif + // _WX_JOYSTICK_H_ diff --git a/lib/wxWidgets/include/wx/osx/listbox.h b/lib/wxWidgets/include/wx/osx/listbox.h new file mode 100644 index 0000000..ed86f5c --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/listbox.h @@ -0,0 +1,180 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/listbox.h +// Purpose: wxListBox class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LISTBOX_H_ +#define _WX_LISTBOX_H_ + +// ---------------------------------------------------------------------------- +// simple types +// ---------------------------------------------------------------------------- +#include "wx/dynarray.h" +#include "wx/arrstr.h" + +// forward decl for GetSelections() +class wxArrayInt; + +// forward decl for wxListWidgetImpl implementation type. +class wxListWidgetImpl; + +// List box item + +WX_DEFINE_ARRAY( char* , wxListDataArray ); + +// ---------------------------------------------------------------------------- +// List box control +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxListWidgetColumn; + +class WXDLLIMPEXP_FWD_CORE wxListWidgetCellValue; + +class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase +{ +public: + // ctors and such + wxListBox(); + + wxListBox( + wxWindow *parent, + wxWindowID winid, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)) + { + Create(parent, winid, pos, size, n, choices, style, validator, name); + } + + wxListBox( + wxWindow *parent, + wxWindowID winid, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)) + { + Create(parent, winid, pos, size, choices, style, validator, name); + } + + bool Create( + wxWindow *parent, + wxWindowID winid, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, + const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + + bool Create( + wxWindow *parent, + wxWindowID winid, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + + virtual ~wxListBox(); + + // implement base class pure virtuals + virtual unsigned int GetCount() const wxOVERRIDE; + virtual wxString GetString(unsigned int n) const wxOVERRIDE; + virtual void SetString(unsigned int n, const wxString& s) wxOVERRIDE; + virtual int FindString(const wxString& s, bool bCase = false) const wxOVERRIDE; + + // data callbacks + virtual void GetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value ); + virtual void SetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value ); + + virtual bool IsSelected(int n) const wxOVERRIDE; + virtual int GetSelection() const wxOVERRIDE; + virtual int GetSelections(wxArrayInt& aSelections) const wxOVERRIDE; + + virtual void EnsureVisible(int n) wxOVERRIDE; + + virtual int GetTopItem() const wxOVERRIDE; + virtual int GetCountPerPage() const wxOVERRIDE; + + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + // wxCheckListBox support + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + wxListWidgetImpl* GetListPeer() const; + + virtual void HandleLineEvent( unsigned int n, bool doubleClick ); + + // This is called by wxNSTableView + void MacHandleSelectionChange(int row); + +protected: + // callback for derived classes which may have to insert additional data + // at a certain line - which cannot be predetermined for sorted list data + virtual void OnItemInserted(unsigned int pos); + + virtual void DoClear() wxOVERRIDE; + virtual void DoDeleteOneItem(unsigned int n) wxOVERRIDE; + + // from wxItemContainer + virtual int DoInsertItems(const wxArrayStringsAdapter& items, + unsigned int pos, + void **clientData, wxClientDataType type) wxOVERRIDE; + + virtual void DoSetItemClientData(unsigned int n, void* clientData) wxOVERRIDE; + virtual void* DoGetItemClientData(unsigned int n) const wxOVERRIDE; + + // from wxListBoxBase + virtual void DoSetSelection(int n, bool select) wxOVERRIDE; + virtual void DoSetFirstItem(int n) wxOVERRIDE; + virtual int DoListHitTest(const wxPoint& point) const wxOVERRIDE; + + // free memory (common part of Clear() and dtor) + // prevent collision with some BSD definitions of macro Free() + void FreeData(); + + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + bool m_blockEvents; + + wxListWidgetColumn* m_textColumn; + + // data storage (copied from univ) + + // the array containing all items (it is sorted if the listbox has + // wxLB_SORT style) + union + { + wxArrayString *unsorted; + wxSortedArrayString *sorted; + } m_strings; + + // and this one the client data (either void or wxClientData) + wxArrayPtrVoid m_itemsClientData; + +private: + // Mostly the same as DoSetSelection() but doesn't call EnsureVisible(). + void DoSetSelectionWithoutEnsureVisible(int n, bool select); + + wxDECLARE_DYNAMIC_CLASS(wxListBox); + wxDECLARE_EVENT_TABLE(); +}; + +#endif // _WX_LISTBOX_H_ diff --git a/lib/wxWidgets/include/wx/osx/mdi.h b/lib/wxWidgets/include/wx/osx/mdi.h new file mode 100644 index 0000000..9557380 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/mdi.h @@ -0,0 +1,153 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/mdi.h +// Purpose: MDI (Multiple Document Interface) classes. +// Author: Stefan Csomor +// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// (c) 2008 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_CARBON_MDI_H_ +#define _WX_OSX_CARBON_MDI_H_ + +class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase +{ +public: + wxMDIParentFrame() { Init(); } + wxMDIParentFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Init(); + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + virtual ~wxMDIParentFrame(); + + // implement/override base class [pure] virtuals + // --------------------------------------------- + + static bool IsTDI() { return false; } + + virtual void AddChild(wxWindowBase *child) wxOVERRIDE; + virtual void RemoveChild(wxWindowBase *child) wxOVERRIDE; + + virtual void ActivateNext() wxOVERRIDE { /* TODO */ } + virtual void ActivatePrevious() wxOVERRIDE { /* TODO */ } + + virtual bool Show(bool show = true) wxOVERRIDE; + + + // Mac-specific implementation from now on + // --------------------------------------- + + // Mac OS activate event + virtual void MacActivate(long timestamp, bool activating) wxOVERRIDE; + + // wxWidgets activate event + void OnActivate(wxActivateEvent& event); + void OnSysColourChanged(wxSysColourChangedEvent& event); + + void SetMenuBar(wxMenuBar *menu_bar) wxOVERRIDE; + + // Get rect to be used to center top-level children + virtual void GetRectForTopLevelChildren(int *x, int *y, int *w, int *h) wxOVERRIDE; + +protected: + // common part of all ctors + void Init(); + + // returns true if this frame has some contents and so should be visible, + // false if it's used solely as container for its children + bool ShouldBeVisible() const; + + + wxMenu *m_windowMenu; + + // true if MDI Frame is intercepting commands, not child + bool m_parentFrameActive; + + // true if the frame should be shown but is not because it is empty and + // useless otherwise than a container for its children + bool m_shouldBeShown; + +private: + friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxMDIParentFrame); +}; + +class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxMDIChildFrameBase +{ +public: + wxMDIChildFrame() { Init(); } + wxMDIChildFrame(wxMDIParentFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Init() ; + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxMDIParentFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + virtual ~wxMDIChildFrame(); + + // un-override the base class override + virtual bool IsTopLevel() const wxOVERRIDE { return true; } + + // implement MDI operations + virtual void Activate() wxOVERRIDE; + + + // Mac OS activate event + virtual void MacActivate(long timestamp, bool activating) wxOVERRIDE; + +protected: + // common part of all ctors + void Init(); + + wxDECLARE_DYNAMIC_CLASS(wxMDIChildFrame); +}; + +class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase +{ +public: + wxMDIClientWindow() { } + virtual ~wxMDIClientWindow(); + + virtual bool CreateClient(wxMDIParentFrame *parent, + long style = wxVSCROLL | wxHSCROLL) wxOVERRIDE; + +protected: + virtual void DoGetClientSize(int *width, int *height) const wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxMDIClientWindow); +}; + +#endif // _WX_OSX_CARBON_MDI_H_ diff --git a/lib/wxWidgets/include/wx/osx/menu.h b/lib/wxWidgets/include/wx/osx/menu.h new file mode 100644 index 0000000..96e3515 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/menu.h @@ -0,0 +1,203 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/menu.h +// Purpose: wxMenu, wxMenuBar classes +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MENU_H_ +#define _WX_MENU_H_ + +class WXDLLIMPEXP_FWD_CORE wxFrame; + +#include "wx/arrstr.h" + +class wxMenuRadioItemsData; + +// ---------------------------------------------------------------------------- +// Menu +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxMenuImpl ; + +class WXDLLIMPEXP_CORE wxMenu : public wxMenuBase +{ +public: + // ctors & dtor + wxMenu(const wxString& title, long style = 0) + : wxMenuBase(title, style) { Init(); } + + wxMenu(long style = 0) : wxMenuBase(style) { Init(); } + + virtual ~wxMenu(); + + virtual void SetTitle(const wxString& title) wxOVERRIDE; + + virtual void SetInvokingWindow(wxWindow* win) wxOVERRIDE; + + bool ProcessCommand(wxCommandEvent& event); + + // get the menu handle + WXHMENU GetHMenu() const ; + + // implementation only from now on + // ------------------------------- + + bool HandleCommandUpdateStatus( wxMenuItem* menuItem ); + bool HandleCommandProcess( wxMenuItem* menuItem ); + void HandleMenuItemHighlighted( wxMenuItem* menuItem ); + void HandleMenuOpened(); + void HandleMenuClosed(); + + wxMenuImpl* GetPeer() { return m_peer; } + + // make sure we can veto + void SetAllowRearrange( bool allow ); + bool AllowRearrange() const { return m_allowRearrange; } + + // if a menu is used purely for internal implementation reasons (eg wxChoice) + // we don't want native menu events being triggered + void SetNoEventsMode( bool noEvents ); + bool GetNoEventsMode() const { return m_noEventsMode; } + + // Returns the start and end position of the radio group to which the item + // at given position belongs. Return false if there is no radio group + // containing this position. + bool OSXGetRadioGroupRange(int pos, int *start, int *end) const; + +#if wxUSE_MENUBAR + virtual void Attach(wxMenuBarBase *menubar) wxOVERRIDE; +#endif + + void SetupBitmaps(); + +protected: + // hide special menu items like exit, preferences etc + // that are expected in the app menu + void DoRearrange() ; + + virtual wxMenuItem* DoAppend(wxMenuItem *item) wxOVERRIDE; + virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item) wxOVERRIDE; + virtual wxMenuItem* DoRemove(wxMenuItem *item) wxOVERRIDE; + +private: + // common part of all ctors + void Init(); + + // common part of Do{Append,Insert}(): behaves as Append if pos == -1 + bool DoInsertOrAppend(wxMenuItem *item, size_t pos = (size_t)-1); + + // Common part of HandleMenu{Opened,Closed}(). + void DoHandleMenuOpenedOrClosed(wxEventType evtType); + + + // if TRUE, insert a break before appending the next item + bool m_doBreak; + + // in this menu rearranging of menu items (esp hiding) is allowed + bool m_allowRearrange; + + // don't trigger native events + bool m_noEventsMode; + + wxMenuRadioItemsData* m_radioData; + + wxMenuImpl* m_peer; + + wxDECLARE_DYNAMIC_CLASS(wxMenu); +}; + +#if wxUSE_MENUBAR + +// the iphone only has popup-menus + +// ---------------------------------------------------------------------------- +// Menu Bar (a la Windows) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMenuBar : public wxMenuBarBase +{ +public: + // ctors & dtor + // default constructor + wxMenuBar(); + // unused under MSW + wxMenuBar(long style); + // menubar takes ownership of the menus arrays but copies the titles + wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0); + virtual ~wxMenuBar(); + + // menubar construction + virtual bool Append( wxMenu *menu, const wxString &title ) wxOVERRIDE; + virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title) wxOVERRIDE; + virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title) wxOVERRIDE; + virtual wxMenu *Remove(size_t pos) wxOVERRIDE; + + virtual void EnableTop( size_t pos, bool flag ) wxOVERRIDE; + virtual bool IsEnabledTop(size_t pos) const wxOVERRIDE; + virtual void SetMenuLabel( size_t pos, const wxString& label ) wxOVERRIDE; + virtual wxString GetMenuLabel( size_t pos ) const wxOVERRIDE; + virtual bool Enable( bool enable = true ) wxOVERRIDE; + // for virtual function hiding + virtual void Enable( int itemid, bool enable ) + { + wxMenuBarBase::Enable( itemid, enable ); + } + + // implementation from now on + + // returns TRUE if we're attached to a frame + bool IsAttached() const { return m_menuBarFrame != NULL; } + // get the frame we live in + wxFrame *GetFrame() const { return m_menuBarFrame; } + + // if the menubar is modified, the display is not updated automatically, + // call this function to update it (m_menuBarFrame should be !NULL) + void Refresh(bool eraseBackground = true, const wxRect *rect = NULL) wxOVERRIDE; + +#if wxABI_VERSION >= 30001 + wxMenu *OSXGetAppleMenu() const { return m_appleMenu; } +#endif + + static void SetAutoWindowMenu( bool enable ) { s_macAutoWindowMenu = enable ; } + static bool GetAutoWindowMenu() { return s_macAutoWindowMenu ; } + + void MacUninstallMenuBar() ; + void MacInstallMenuBar() ; + static wxMenuBar* MacGetInstalledMenuBar() { return s_macInstalledMenuBar ; } + static void MacSetCommonMenuBar(wxMenuBar* menubar) { s_macCommonMenuBar=menubar; } + static wxMenuBar* MacGetCommonMenuBar() { return s_macCommonMenuBar; } + + virtual void Attach(wxFrame *frame) wxOVERRIDE; + void SetupBitmaps(); + + + static WXHMENU MacGetWindowMenuHMenu() { return s_macWindowMenuHandle ; } + + virtual void DoGetPosition(int *x, int *y) const wxOVERRIDE; + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; + virtual void DoGetClientSize(int *width, int *height) const wxOVERRIDE; + +protected: + // common part of all ctors + void Init(); + + static bool s_macAutoWindowMenu ; + static WXHMENU s_macWindowMenuHandle ; + +private: + static wxMenuBar* s_macInstalledMenuBar ; + static wxMenuBar* s_macCommonMenuBar ; + + wxMenu* m_rootMenu; + wxMenu* m_appleMenu; + + wxDECLARE_DYNAMIC_CLASS(wxMenuBar); +}; + +#endif + +#endif // _WX_MENU_H_ diff --git a/lib/wxWidgets/include/wx/osx/menuitem.h b/lib/wxWidgets/include/wx/osx/menuitem.h new file mode 100644 index 0000000..7b29f95 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/menuitem.h @@ -0,0 +1,72 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/menuitem.h +// Purpose: wxMenuItem class +// Author: Vadim Zeitlin +// Modified by: +// Created: 11.11.97 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _MENUITEM_H +#define _MENUITEM_H + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" +#include "wx/vector.h" + +// ---------------------------------------------------------------------------- +// wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxMenuItemImpl ; + +class WXDLLIMPEXP_CORE wxMenuItem: public wxMenuItemBase +{ +public: + // ctor & dtor + wxMenuItem(wxMenu *parentMenu = NULL, + int id = wxID_SEPARATOR, + const wxString& name = wxEmptyString, + const wxString& help = wxEmptyString, + wxItemKind kind = wxITEM_NORMAL, + wxMenu *subMenu = NULL); + virtual ~wxMenuItem(); + + // override base class virtuals + virtual void SetItemLabel(const wxString& strName) wxOVERRIDE; + + virtual void Enable(bool bDoEnable = true) wxOVERRIDE; + virtual void Check(bool bDoCheck = true) wxOVERRIDE; + +#if wxUSE_ACCEL + virtual void AddExtraAccel(const wxAcceleratorEntry& accel) wxOVERRIDE; + virtual void ClearExtraAccels() wxOVERRIDE; + void RemoveHiddenItems(); +#endif // wxUSE_ACCEL + + + // Implementation only from now on. + + // update the os specific representation + void UpdateItemBitmap() ; + void UpdateItemText() ; + void UpdateItemStatus() ; + + wxMenuItemImpl* GetPeer() { return m_peer; } +private: + void UncheckRadio() ; + + wxMenuItemImpl* m_peer; + +#if wxUSE_ACCEL + wxVector<wxMenuItem*> m_hiddenMenuItems; +#endif // wxUSE_ACCEL + + wxDECLARE_DYNAMIC_CLASS(wxMenuItem); +}; + +#endif //_MENUITEM_H diff --git a/lib/wxWidgets/include/wx/osx/metafile.h b/lib/wxWidgets/include/wx/osx/metafile.h new file mode 100644 index 0000000..0b6ac86 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/metafile.h @@ -0,0 +1,170 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/metafile.h +// Purpose: wxMetaFile, wxMetaFileDC classes. +// This probably should be restricted to Windows platforms, +// but if there is an equivalent on your platform, great. +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef _WX_METAFIILE_H_ +#define _WX_METAFIILE_H_ + +#include "wx/dc.h" +#include "wx/gdiobj.h" + +#if wxUSE_DATAOBJ +#include "wx/dataobj.h" +#endif + +#include "wx/osx/dcclient.h" + +/* + * Metafile and metafile device context classes + * + */ + +#define wxMetaFile wxMetafile +#define wxMetaFileDC wxMetafileDC + +class WXDLLIMPEXP_FWD_CORE wxMetafile; +class wxMetafileRefData ; + +#define M_METAFILEDATA ((wxMetafileRefData *)m_refData) + +class WXDLLIMPEXP_CORE wxMetafile : public wxGDIObject +{ +public: + wxMetafile(const wxString& file = wxEmptyString); + virtual ~wxMetafile(); + + // After this is called, the metafile cannot be used for anything + // since it is now owned by the clipboard. + virtual bool SetClipboard(int width = 0, int height = 0); + + virtual bool Play(wxDC *dc); + + wxSize GetSize() const; + int GetWidth() const { return GetSize().x; } + int GetHeight() const { return GetSize().y; } + + // Implementation + WXHMETAFILE GetHMETAFILE() const ; + void SetHMETAFILE(WXHMETAFILE mf) ; +protected: + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxMetafile); +}; + + +class WXDLLIMPEXP_CORE wxMetafileDCImpl: public wxGCDCImpl +{ +public: + wxMetafileDCImpl( wxDC *owner, + const wxString& filename, + int width, int height, + const wxString& description ); + + virtual ~wxMetafileDCImpl(); + + // Should be called at end of drawing + virtual wxMetafile *Close(); + + // Implementation + wxMetafile *GetMetaFile() const { return m_metaFile; } + void SetMetaFile(wxMetafile *mf) { m_metaFile = mf; } + +protected: + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; + + wxMetafile* m_metaFile; + +private: + wxDECLARE_CLASS(wxMetafileDCImpl); + wxDECLARE_NO_COPY_CLASS(wxMetafileDCImpl); +}; + +class WXDLLIMPEXP_CORE wxMetafileDC: public wxDC +{ + public: + // the ctor parameters specify the filename (empty for memory metafiles), + // the metafile picture size and the optional description/comment + wxMetafileDC( const wxString& filename = wxEmptyString, + int width = 0, int height = 0, + const wxString& description = wxEmptyString ) : + wxDC( new wxMetafileDCImpl( this, filename, width, height, description) ) + { } + + wxMetafile *GetMetafile() const + { return ((wxMetafileDCImpl*)m_pimpl)->GetMetaFile(); } + + wxMetafile *Close() + { return ((wxMetafileDCImpl*)m_pimpl)->Close(); } + +private: + wxDECLARE_CLASS(wxMetafileDC); + wxDECLARE_NO_COPY_CLASS(wxMetafileDC); +}; + + +/* + * Pass filename of existing non-placeable metafile, and bounding box. + * Adds a placeable metafile header, sets the mapping mode to anisotropic, + * and sets the window origin and extent to mimic the wxMM_TEXT mapping mode. + * + */ + +// No origin or extent +#define wxMakeMetaFilePlaceable wxMakeMetafilePlaceable +bool WXDLLIMPEXP_CORE wxMakeMetafilePlaceable(const wxString& filename, float scale = 1.0f); + +// Optional origin and extent +bool WXDLLIMPEXP_CORE wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale = 1.0f, bool useOriginAndExtent = true); + +// ---------------------------------------------------------------------------- +// wxMetafileDataObject is a specialization of wxDataObject for metafile data +// ---------------------------------------------------------------------------- + +#if wxUSE_DATAOBJ +class WXDLLIMPEXP_CORE wxMetafileDataObject : public wxDataObjectSimple +{ +public: + // ctors + wxMetafileDataObject() + : wxDataObjectSimple(wxDF_METAFILE) { } + wxMetafileDataObject(const wxMetafile& metafile) + : wxDataObjectSimple(wxDF_METAFILE), m_metafile(metafile) { } + + // virtual functions which you may override if you want to provide data on + // demand only - otherwise, the trivial default versions will be used + virtual void SetMetafile(const wxMetafile& metafile) + { m_metafile = metafile; } + virtual wxMetafile GetMetafile() const + { return m_metafile; } + + // implement base class pure virtuals + virtual size_t GetDataSize() const wxOVERRIDE; + virtual bool GetDataHere(void *buf) const wxOVERRIDE; + virtual bool SetData(size_t len, const void *buf) wxOVERRIDE; + + virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const wxOVERRIDE + { return GetDataSize(); } + virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), + void *buf) const wxOVERRIDE + { return GetDataHere(buf); } + virtual bool SetData(const wxDataFormat& WXUNUSED(format), + size_t len, const void *buf) wxOVERRIDE + { return SetData(len, buf); } +protected: + wxMetafile m_metafile; +}; +#endif + +#endif + // _WX_METAFIILE_H_ diff --git a/lib/wxWidgets/include/wx/osx/mimetype.h b/lib/wxWidgets/include/wx/osx/mimetype.h new file mode 100644 index 0000000..e6e6eb0 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/mimetype.h @@ -0,0 +1 @@ +#include "wx/osx/core/mimetype.h" diff --git a/lib/wxWidgets/include/wx/osx/minifram.h b/lib/wxWidgets/include/wx/osx/minifram.h new file mode 100644 index 0000000..5b06f33 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/minifram.h @@ -0,0 +1,41 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/minifram.h +// Purpose: wxMiniFrame class. A small frame for e.g. floating toolbars. +// If there is no equivalent on your platform, just make it a +// normal frame. +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MINIFRAM_H_ +#define _WX_MINIFRAM_H_ + +#include "wx/frame.h" + +class WXDLLIMPEXP_CORE wxMiniFrame: public wxFrame { + + wxDECLARE_DYNAMIC_CLASS(wxMiniFrame); + +public: + wxMiniFrame() {} + wxMiniFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCAPTION | wxRESIZE_BORDER | wxTINY_CAPTION, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + // Use wxFrame constructor in absence of more specific code. + Create(parent, id, title, pos, size, style | wxFRAME_TOOL_WINDOW | wxFRAME_FLOAT_ON_PARENT , name); + } + + virtual ~wxMiniFrame() {} +protected: +}; + +#endif + // _WX_MINIFRAM_H_ diff --git a/lib/wxWidgets/include/wx/osx/msgdlg.h b/lib/wxWidgets/include/wx/osx/msgdlg.h new file mode 100644 index 0000000..e82e1c8 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/msgdlg.h @@ -0,0 +1,47 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/msgdlg.h +// Purpose: wxMessageDialog class. Use generic version if no +// platform-specific implementation. +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSGBOXDLG_H_ +#define _WX_MSGBOXDLG_H_ + +class WXDLLIMPEXP_CORE wxMessageDialog : public wxMessageDialogBase +{ +public: + wxMessageDialog(wxWindow *parent, + const wxString& message, + const wxString& caption = wxASCII_STR(wxMessageBoxCaptionStr), + long style = wxOK|wxCENTRE, + const wxPoint& pos = wxDefaultPosition); + + virtual int ShowModal() wxOVERRIDE; + +#if wxOSX_USE_COCOA + virtual void ShowWindowModal() wxOVERRIDE; + virtual void ModalFinishedCallback(void* panel, int resultCode) wxOVERRIDE; +#endif + +protected: + // not supported for message dialog + virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y), + int WXUNUSED(width), int WXUNUSED(height), + int WXUNUSED(sizeFlags) = wxSIZE_AUTO) wxOVERRIDE {} + +#if wxOSX_USE_COCOA + void* ConstructNSAlert(); +#endif + + int m_buttonId[4]; + int m_buttonCount; + + wxDECLARE_DYNAMIC_CLASS(wxMessageDialog); +}; + +#endif // _WX_MSGBOXDLG_H_ diff --git a/lib/wxWidgets/include/wx/osx/nonownedwnd.h b/lib/wxWidgets/include/wx/osx/nonownedwnd.h new file mode 100644 index 0000000..48dc9fa --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/nonownedwnd.h @@ -0,0 +1,166 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/nonownedwnd.h +// Purpose: declares wxNonOwnedWindow class +// Author: Stefan Csomor +// Modified by: +// Created: 2008-03-24 +// Copyright: (c) 2008 Stefan Csomor +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MAC_NONOWNEDWND_H_ +#define _WX_MAC_NONOWNEDWND_H_ + +#include "wx/window.h" + +#include "wx/graphics.h" + +#if wxUSE_SYSTEM_OPTIONS + #define wxMAC_WINDOW_PLAIN_TRANSITION wxT("mac.window-plain-transition") +#endif + +//----------------------------------------------------------------------------- +// wxNonOwnedWindow +//----------------------------------------------------------------------------- + +// This class represents "non-owned" window. A window is owned by another +// window if it has a parent and is positioned within the parent. For example, +// wxFrame is non-owned, because even though it can have a parent, it's +// location is independent of it. This class is for internal use only, it's +// the base class for wxTopLevelWindow and wxPopupWindow. + +class wxNonOwnedWindowImpl; + +class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxNonOwnedWindowBase +{ +public: + // constructors and such + wxNonOwnedWindow() { Init(); } + + wxNonOwnedWindow(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)) + { + Init(); + + (void)Create(parent, id, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)); + + bool Create(wxWindow *parent, WXWindow nativeWindow); + + virtual ~wxNonOwnedWindow(); + + virtual void SubclassWin(WXWindow nativeWindow); + virtual void UnsubclassWin(); + + virtual wxPoint GetClientAreaOrigin() const wxOVERRIDE; + + // implement base class pure virtuals + + virtual bool SetTransparent(wxByte alpha) wxOVERRIDE; + virtual bool CanSetTransparent() wxOVERRIDE; + + virtual bool SetBackgroundStyle(wxBackgroundStyle style) wxOVERRIDE; + + virtual void Update() wxOVERRIDE; + + WXWindow GetWXWindow() const ; + static wxNonOwnedWindow* GetFromWXWindow( WXWindow win ); + + // implementation from now on + // -------------------------- + + // These accessors are Mac-specific and don't exist in other ports. + const wxRegion& GetShape() const { return m_shape; } +#if wxUSE_GRAPHICS_CONTEXT + const wxGraphicsPath& GetShapePath() { return m_shapePath; } +#endif // wxUSE_GRAPHICS_CONTEXT + + // activation hooks only necessary for MDI Implementation + static void MacDelayedDeactivation(long timestamp); + virtual void MacActivate( long timestamp , bool inIsActivating ) ; + + virtual void SetWindowStyleFlag(long flags) wxOVERRIDE; + + virtual void Raise() wxOVERRIDE; + virtual void Lower() wxOVERRIDE; + virtual bool Show( bool show = true ) wxOVERRIDE; + + virtual void SetExtraStyle(long exStyle) wxOVERRIDE; + + virtual bool SetBackgroundColour( const wxColour &colour ) wxOVERRIDE; + + wxNonOwnedWindowImpl* GetNonOwnedPeer() const { return m_nowpeer; } + +#if wxOSX_USE_COCOA_OR_IPHONE + // override the base class method to return an NSWindow instead of NSView + virtual void *OSXGetViewOrWindow() const wxOVERRIDE; +#endif // Cocoa + + // osx specific event handling common for all osx-ports + + virtual void HandleActivated( double timestampsec, bool didActivate ); + virtual void HandleResized( double timestampsec ); + virtual void HandleMoved( double timestampsec ); + virtual void HandleResizing( double timestampsec, wxRect* rect ); + + void OSXHandleMiniaturize(double WXUNUSED(timestampsec), bool miniaturized); + + void OSXSetIgnoreResizing(bool value) { m_ignoreResizing = value; } + + void WindowWasPainted(); + + virtual bool Destroy() wxOVERRIDE; + +protected: + // common part of all ctors + void Init(); + + virtual void DoGetPosition( int *x, int *y ) const wxOVERRIDE; + virtual void DoGetSize( int *width, int *height ) const wxOVERRIDE; + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; + virtual void DoGetClientSize(int *width, int *height) const wxOVERRIDE; + + virtual bool OSXShowWithEffect(bool show, + wxShowEffect effect, + unsigned timeout) wxOVERRIDE; + + virtual bool DoClearShape() wxOVERRIDE; + virtual bool DoSetRegionShape(const wxRegion& region) wxOVERRIDE; +#if wxUSE_GRAPHICS_CONTEXT + virtual bool DoSetPathShape(const wxGraphicsPath& path) wxOVERRIDE; +#endif // wxUSE_GRAPHICS_CONTEXT + + virtual void WillBeDestroyed(); + + wxNonOwnedWindowImpl* m_nowpeer ; + +// wxWindowMac* m_macFocus ; + + static wxNonOwnedWindow *s_macDeactivateWindow; + +private : + static clock_t s_lastFlush; + + wxRegion m_shape; +#if wxUSE_GRAPHICS_CONTEXT + wxGraphicsPath m_shapePath; +#endif // wxUSE_GRAPHICS_CONTEXT + bool m_ignoreResizing; +}; + +// list of all frames and modeless dialogs +extern WXDLLIMPEXP_DATA_CORE(wxWindowList) wxModelessWindows; + + +#endif // _WX_MAC_NONOWNEDWND_H_ diff --git a/lib/wxWidgets/include/wx/osx/notebook.h b/lib/wxWidgets/include/wx/osx/notebook.h new file mode 100644 index 0000000..13eca44 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/notebook.h @@ -0,0 +1,140 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/notebook.h +// Purpose: MSW/GTK compatible notebook (a.k.a. property sheet) +// Author: Stefan Csomor +// Modified by: +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_NOTEBOOK_H_ +#define _WX_NOTEBOOK_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- +#include "wx/event.h" + +// ---------------------------------------------------------------------------- +// types +// ---------------------------------------------------------------------------- + +// fwd declarations +class WXDLLIMPEXP_FWD_CORE wxImageList; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +// ---------------------------------------------------------------------------- +// wxNotebook +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase +{ +public: + // ctors + // ----- + // default for dynamic class + wxNotebook() { } + // the same arguments as for wxControl (@@@ any special styles?) + wxNotebook(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxNotebookNameStr)) + { Create( parent, id, pos, size, style, name ); } + // Create() function + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxNotebookNameStr)); + // dtor + virtual ~wxNotebook(); + + // accessors + // --------- + // set the currently selected page, return the index of the previously + // selected one (or wxNOT_FOUND on error) + // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events + int SetSelection(size_t nPage) wxOVERRIDE { return DoSetSelection(nPage, SetSelection_SendEvent); } + + // changes selected page without sending events + int ChangeSelection(size_t nPage) wxOVERRIDE { return DoSetSelection(nPage); } + + // set/get the title of a page + bool SetPageText(size_t nPage, const wxString& strText) wxOVERRIDE; + wxString GetPageText(size_t nPage) const wxOVERRIDE; + + // sets/returns item's image index in the current image list + int GetPageImage(size_t nPage) const wxOVERRIDE; + bool SetPageImage(size_t nPage, int nImage) wxOVERRIDE; + + // control the appearance of the notebook pages + // set the size (the same for all pages) + virtual void SetPageSize(const wxSize& size) wxOVERRIDE; + // set the padding between tabs (in pixels) + virtual void SetPadding(const wxSize& padding) wxOVERRIDE; + // sets the size of the tabs (assumes all tabs are the same size) + virtual void SetTabSize(const wxSize& sz) wxOVERRIDE; + + // hit test + virtual int HitTest(const wxPoint& pt, long *flags = NULL) const wxOVERRIDE; + + // calculate size for wxNotebookSizer + wxSize CalcSizeFromPage(const wxSize& sizePage) const wxOVERRIDE; + wxRect GetPageRect() const wxOVERRIDE; + + // operations + // ---------- + // remove all pages + bool DeleteAllPages() wxOVERRIDE; + // the same as AddPage(), but adds it at the specified position + bool InsertPage(size_t nPage, + wxNotebookPage *pPage, + const wxString& strText, + bool bSelect = false, + int imageId = NO_IMAGE) wxOVERRIDE; + + // callbacks + // --------- + void OnSize(wxSizeEvent& event); + void OnSetFocus(wxFocusEvent& event); + void OnNavigationKey(wxNavigationKeyEvent& event); + + // implementation + // -------------- + +#if wxUSE_CONSTRAINTS + virtual void SetConstraintSizes(bool recurse = true) wxOVERRIDE; + virtual bool DoPhase(int nPhase) wxOVERRIDE; + +#endif + + // base class virtuals + // ------------------- + virtual void Command(wxCommandEvent& event) wxOVERRIDE; + // osx specific event handling common for all osx-ports + + virtual bool OSXHandleClicked( double timestampsec ) wxOVERRIDE; + +protected: + virtual wxNotebookPage *DoRemovePage(size_t page) wxOVERRIDE; + // common part of all ctors + void Init(); + + // helper functions + void ChangePage(int nOldSel, int nSel); // change pages + void MacSetupTabs(); + + int DoSetSelection(size_t nPage, int flags = 0) wxOVERRIDE; + + // the icon indices + wxArrayInt m_images; + + wxDECLARE_DYNAMIC_CLASS(wxNotebook); + wxDECLARE_EVENT_TABLE(); +}; + + +#endif // _WX_NOTEBOOK_H_ diff --git a/lib/wxWidgets/include/wx/osx/palette.h b/lib/wxWidgets/include/wx/osx/palette.h new file mode 100644 index 0000000..982d881 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/palette.h @@ -0,0 +1,40 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/palette.h +// Purpose: wxPalette class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PALETTE_H_ +#define _WX_PALETTE_H_ + +#include "wx/gdiobj.h" + +#define M_PALETTEDATA ((wxPaletteRefData *)m_refData) + +class WXDLLIMPEXP_CORE wxPalette : public wxPaletteBase +{ +public: + wxPalette(); + + wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); + virtual ~wxPalette(); + bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); + + int GetPixel(unsigned char red, unsigned char green, unsigned char blue) const; + bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const; + + virtual int GetColoursCount() const wxOVERRIDE; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxPalette); +}; + +#endif // _WX_PALETTE_H_ diff --git a/lib/wxWidgets/include/wx/osx/pen.h b/lib/wxWidgets/include/wx/osx/pen.h new file mode 100644 index 0000000..9136793 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/pen.h @@ -0,0 +1,78 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/pen.h +// Purpose: wxPen class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PEN_H_ +#define _WX_PEN_H_ + +#include "wx/gdiobj.h" +#include "wx/colour.h" +#include "wx/bitmap.h" + +// Pen +class WXDLLIMPEXP_CORE wxPen : public wxPenBase +{ +public: + wxPen(); + wxPen(const wxColour& col, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID); + + wxPen(const wxBitmap& stipple, int width); + + wxPen(const wxPenInfo& info); + + virtual ~wxPen(); + + bool operator==(const wxPen& pen) const; + bool operator!=(const wxPen& pen) const { return !(*this == pen); } + + // Override in order to recreate the pen + void SetColour(const wxColour& col) wxOVERRIDE; + void SetColour(unsigned char r, unsigned char g, unsigned char b) wxOVERRIDE; + + void SetWidth(int width) wxOVERRIDE; + void SetStyle(wxPenStyle style) wxOVERRIDE; + void SetStipple(const wxBitmap& stipple) wxOVERRIDE; + void SetDashes(int nb_dashes, const wxDash *dash) wxOVERRIDE; + void SetJoin(wxPenJoin join) wxOVERRIDE; + void SetCap(wxPenCap cap) wxOVERRIDE; + + wxColour GetColour() const wxOVERRIDE; + int GetWidth() const wxOVERRIDE; + wxPenStyle GetStyle() const wxOVERRIDE; + wxPenJoin GetJoin() const wxOVERRIDE; + wxPenCap GetCap() const wxOVERRIDE; + int GetDashes(wxDash **ptr) const wxOVERRIDE; + int GetDashCount() const; + + wxBitmap *GetStipple() const wxOVERRIDE; + + + wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") + wxPen(const wxColour& col, int width, int style); + + wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") + void SetStyle(int style) { SetStyle((wxPenStyle)style); } + + // Implementation + + // Useful helper: create the brush resource + bool RealizeResource(); + +protected: + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + +private: + void Unshare(); + + wxDECLARE_DYNAMIC_CLASS(wxPen); +}; + +#endif + // _WX_PEN_H_ diff --git a/lib/wxWidgets/include/wx/osx/popupwin.h b/lib/wxWidgets/include/wx/osx/popupwin.h new file mode 100644 index 0000000..4bed655 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/popupwin.h @@ -0,0 +1,35 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/popupwin.h +// Purpose: wxPopupWindow class for wxMac +// Author: Stefan Csomor +// Modified by: +// Created: +// Copyright: (c) 2006 Stefan Csomor +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MAC_POPUPWIN_H_ +#define _WX_MAC_POPUPWIN_H_ + +// ---------------------------------------------------------------------------- +// wxPopupWindow +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPopupWindow : public wxPopupWindowBase +{ +public: + wxPopupWindow() { } + ~wxPopupWindow(); + + wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE) + { (void)Create(parent, flags); } + + bool Create(wxWindow *parent, int flags = wxBORDER_NONE); + + virtual bool Show(bool show = true) wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxPopupWindow); +}; + +#endif // _WX_MAC_POPUPWIN_H_ + diff --git a/lib/wxWidgets/include/wx/osx/printdlg.h b/lib/wxWidgets/include/wx/osx/printdlg.h new file mode 100644 index 0000000..ffaf775 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/printdlg.h @@ -0,0 +1,111 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/printdlg.h +// Purpose: wxPrintDialog, wxPageSetupDialog classes. +// Use generic, PostScript version if no +// platform-specific implementation. +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRINTDLG_H_ +#define _WX_PRINTDLG_H_ + +#include "wx/dialog.h" +#include "wx/cmndata.h" +#include "wx/printdlg.h" +#include "wx/prntbase.h" + +/* + * wxMacPrintDialog + * The Mac dialog for printing + */ + +class WXDLLIMPEXP_FWD_CORE wxDC; +class WXDLLIMPEXP_CORE wxMacPrintDialog: public wxPrintDialogBase +{ +public: + wxMacPrintDialog(); + wxMacPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL); + wxMacPrintDialog(wxWindow *parent, wxPrintData* data ); + virtual ~wxMacPrintDialog(); + + bool Create(wxWindow *parent, wxPrintDialogData* data = NULL); + virtual int ShowModal() wxOVERRIDE; + + virtual wxPrintDialogData& GetPrintDialogData() wxOVERRIDE { return m_printDialogData; } + virtual wxPrintData& GetPrintData() wxOVERRIDE { return m_printDialogData.GetPrintData(); } + virtual wxDC *GetPrintDC() wxOVERRIDE; + +private: + wxPrintDialogData m_printDialogData; + wxDC* m_printerDC; + bool m_destroyDC; + wxWindow* m_dialogParent; + +private: + wxDECLARE_DYNAMIC_CLASS(wxPrintDialog); +}; + +/* + * wxMacPageSetupDialog + * The Mac page setup dialog + */ + +class WXDLLIMPEXP_CORE wxMacPageSetupDialog: public wxPageSetupDialogBase +{ +public: + wxMacPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = NULL); + virtual ~wxMacPageSetupDialog(); + + virtual wxPageSetupDialogData& GetPageSetupDialogData() wxOVERRIDE; + + bool Create(wxWindow *parent, wxPageSetupDialogData *data = NULL); + virtual int ShowModal() wxOVERRIDE; + +private: + wxPageSetupDialogData m_pageSetupData; + wxWindow* m_dialogParent; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMacPageSetupDialog); +}; + +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; + +/* +* wxMacPageMarginsDialog +* A Mac dialog for setting the page margins separately from page setup since +* (native) wxMacPageSetupDialog doesn't let you set margins. +*/ + +class WXDLLIMPEXP_CORE wxMacPageMarginsDialog : public wxDialog +{ +public: + wxMacPageMarginsDialog(wxFrame* parent, wxPageSetupDialogData* data); + bool TransferToWindow(); + bool TransferDataFromWindow() wxOVERRIDE; + + virtual wxPageSetupDialogData& GetPageSetupDialogData() { return *m_pageSetupDialogData; } + +private: + wxPageSetupDialogData* m_pageSetupDialogData; + + wxPoint m_MinMarginTopLeft; + wxPoint m_MinMarginBottomRight; + wxTextCtrl *m_LeftMargin; + wxTextCtrl *m_TopMargin; + wxTextCtrl *m_RightMargin; + wxTextCtrl *m_BottomMargin; + + void GetMinMargins(); + bool CheckValue(wxTextCtrl* textCtrl, int *value, int minValue, const wxString& name); + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMacPageMarginsDialog); +}; + + +#endif // _WX_PRINTDLG_H_ diff --git a/lib/wxWidgets/include/wx/osx/printmac.h b/lib/wxWidgets/include/wx/osx/printmac.h new file mode 100644 index 0000000..403e6fa --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/printmac.h @@ -0,0 +1,59 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/printmac.h +// Purpose: wxWindowsPrinter, wxWindowsPrintPreview classes +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRINTWIN_H_ +#define _WX_PRINTWIN_H_ + +#include "wx/prntbase.h" + +/* + * Represents the printer: manages printing a wxPrintout object + */ + +class WXDLLIMPEXP_CORE wxMacPrinter: public wxPrinterBase +{ + wxDECLARE_DYNAMIC_CLASS(wxMacPrinter); + +public: + wxMacPrinter(wxPrintDialogData *data = NULL); + virtual ~wxMacPrinter(); + + virtual bool Print(wxWindow *parent, + wxPrintout *printout, + bool prompt = true) wxOVERRIDE; + virtual wxDC* PrintDialog(wxWindow *parent) wxOVERRIDE; + virtual bool Setup(wxWindow *parent) wxOVERRIDE; + +}; + +/* + * wxPrintPreview + * Programmer creates an object of this class to preview a wxPrintout. + */ + +class WXDLLIMPEXP_CORE wxMacPrintPreview: public wxPrintPreviewBase +{ + wxDECLARE_CLASS(wxMacPrintPreview); + +public: + wxMacPrintPreview(wxPrintout *printout, + wxPrintout *printoutForPrinting = NULL, + wxPrintDialogData *data = NULL); + wxMacPrintPreview(wxPrintout *printout, + wxPrintout *printoutForPrinting, + wxPrintData *data); + virtual ~wxMacPrintPreview(); + + virtual bool Print(bool interactive) wxOVERRIDE; + virtual void DetermineScaling() wxOVERRIDE; +}; + +#endif + // _WX_PRINTWIN_H_ diff --git a/lib/wxWidgets/include/wx/osx/private.h b/lib/wxWidgets/include/wx/osx/private.h new file mode 100644 index 0000000..23fd002 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/private.h @@ -0,0 +1,14 @@ +#ifndef _WX_PRIVATE_OSX_H_ +#define _WX_PRIVATE_OSX_H_ + +#include "wx/osx/core/private.h" + +#if wxOSX_USE_IPHONE + #include "wx/osx/iphone/private.h" +#elif wxOSX_USE_COCOA + #include "wx/osx/cocoa/private.h" +#elif wxUSE_GUI + #error "Must include wx/defs.h first" +#endif + +#endif diff --git a/lib/wxWidgets/include/wx/osx/private/addremovectrl.h b/lib/wxWidgets/include/wx/osx/private/addremovectrl.h new file mode 100644 index 0000000..a5b342a --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/private/addremovectrl.h @@ -0,0 +1,117 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/private/addremovectrl.h +// Purpose: OS X specific wxAddRemoveImpl implementation +// Author: Vadim Zeitlin +// Created: 2015-02-05 +// Copyright: (c) 2015 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_PRIVATE_ADDREMOVECTRL_H_ +#define _WX_OSX_PRIVATE_ADDREMOVECTRL_H_ + +#include "wx/artprov.h" +#include "wx/bmpbuttn.h" +#include "wx/panel.h" + +#include "wx/osx/private.h" + +// ---------------------------------------------------------------------------- +// wxAddRemoveImpl itself +// ---------------------------------------------------------------------------- + +class wxAddRemoveImpl : public wxAddRemoveImplWithButtons +{ +public: + wxAddRemoveImpl(wxAddRemoveAdaptor* adaptor, + wxAddRemoveCtrl* parent, + wxWindow* ctrlItems) + : wxAddRemoveImplWithButtons(adaptor, parent, ctrlItems), + m_ctrlItems(ctrlItems) + { + // This size is hard coded for now as this is what the system dialogs + // themselves (e.g. the buttons under the lists in the "Users" or + // "Network" panes of the "System Preferences") use under OS X 10.8. + const wxSize sizeBtn(25, 23); + + m_btnAdd = new wxBitmapButton(parent, wxID_ADD, + wxArtProvider::GetBitmap("NSAddTemplate"), + wxDefaultPosition, + sizeBtn, + wxBORDER_SIMPLE); + + m_btnRemove = new wxBitmapButton(parent, wxID_REMOVE, + wxArtProvider::GetBitmap("NSRemoveTemplate"), + wxDefaultPosition, + sizeBtn, + wxBORDER_SIMPLE); + + // Under OS X the space to the right of the buttons is actually + // occupied by an inactive gradient button, so create one. + m_btnPlaceholder = new wxButton(parent, wxID_ANY, "", + wxDefaultPosition, + sizeBtn, + wxBORDER_SIMPLE); + m_btnPlaceholder->Disable(); + + + // We need to lay out our windows manually under OS X as it is the only + // way to achieve the required, for the correct look, overlap between + // their borders -- sizers would never allow this. + parent->Bind(wxEVT_SIZE, &wxAddRemoveImpl::OnSize, this); + + // We also have to ensure that the window with the items doesn't have + // any border as it wouldn't look correctly if it did. + long style = ctrlItems->GetWindowStyle(); + style &= ~wxBORDER_MASK; + style |= wxBORDER_SIMPLE; + ctrlItems->SetWindowStyle(style); + + + SetUpEvents(); + } + + // As we don't use sizers, we also need to compute our best size ourselves. + virtual wxSize GetBestClientSize() const wxOVERRIDE + { + wxSize size = m_ctrlItems->GetBestSize(); + + const wxSize sizeBtn = m_btnAdd->GetSize(); + + size.y += sizeBtn.y; + size.IncTo(wxSize(3*sizeBtn.x, -1)); + + return size; + } + +private: + void OnSize(wxSizeEvent& event) + { + const wxSize size = event.GetSize(); + + const wxSize sizeBtn = m_btnAdd->GetSize(); + + const int yBtn = size.y - sizeBtn.y; + + // There is a vertical overlap which hides the items control bottom + // border. + m_ctrlItems->SetSize(0, 0, size.x, yBtn + 2); + + // And there is also a horizontal 1px overlap between the buttons + // themselves, so subtract 1 from the next button position. + int x = 0; + m_btnAdd->Move(x, yBtn); + x += sizeBtn.x - 1; + + m_btnRemove->Move(x, yBtn); + x += sizeBtn.x - 1; + + // The last one needs to be resized to take up all the remaining space. + m_btnPlaceholder->SetSize(x, yBtn, size.x - x, sizeBtn.y); + } + + wxWindow* m_ctrlItems; + wxButton* /* const */ m_btnPlaceholder; +}; + +#endif // _WX_OSX_PRIVATE_ADDREMOVECTRL_H_ diff --git a/lib/wxWidgets/include/wx/osx/private/available.h b/lib/wxWidgets/include/wx/osx/private/available.h new file mode 100644 index 0000000..a9e7cf8 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/private/available.h @@ -0,0 +1,51 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/private/available.h +// Purpose: Helper for checking API availability under macOS. +// Author: Vadim Zeitlin +// Created: 2019-04-17 +// Copyright: (c) 2019 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_PRIVATE_AVAILABLE_H_ +#define _WX_OSX_PRIVATE_AVAILABLE_H_ + +// Xcode 9 adds new @available keyword and the corresponding __builtin_available +// builtin which should be used instead of manual checks for API availability +// as using this builtin suppresses the compiler -Wunguarded-availability +// warnings, so use it if possible for the implementation of our own macro. +#if defined(__clang__) && __has_builtin(__builtin_available) + #define WX_IS_MACOS_AVAILABLE(major, minor) \ + __builtin_available(macOS major ## . ## minor, *) + + #define WX_IS_MACOS_OR_IOS_AVAILABLE(macmajor, macminor, imajor, iminor) \ + __builtin_available(macOS macmajor ## . ## macminor, iOS imajor ##. ## iminor, *) + + #define WX_IS_MACOS_AVAILABLE_FULL(major, minor, micro) \ + __builtin_available(macOS major ## . ## minor ## . ## micro, *) + + // Note that we can't easily forward to API_AVAILABLE macro here, so go + // directly to its expansion instead. + #define WX_API_AVAILABLE_MACOS(major, minor) \ + __attribute__((availability(macos,introduced=major ## . ## minor))) +#else // Not clang or old clang version without __builtin_available + #include "wx/platinfo.h" + + #define WX_IS_MACOS_AVAILABLE(major, minor) \ + wxPlatformInfo::Get().CheckOSVersion(major, minor) + +#ifdef wxOSX_USE_IPHONE + #define WX_IS_MACOS_OR_IOS_AVAILABLE(macmajor, macminor, imajor, iminor) \ + wxPlatformInfo::Get().CheckOSVersion(imajor, iminor) +#else + #define WX_IS_MACOS_OR_IOS_AVAILABLE(macmajor, macminor, imajor, iminor) \ + wxPlatformInfo::Get().CheckOSVersion(macmajor, macminor) +#endif + + #define WX_IS_MACOS_AVAILABLE_FULL(major, minor, micro) \ + wxPlatformInfo::Get().CheckOSVersion(major, minor, micro) + + #define WX_API_AVAILABLE_MACOS(major, minor) +#endif + +#endif // _WX_OSX_PRIVATE_AVAILABLE_H_ diff --git a/lib/wxWidgets/include/wx/osx/private/datatransfer.h b/lib/wxWidgets/include/wx/osx/private/datatransfer.h new file mode 100644 index 0000000..281164f --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/private/datatransfer.h @@ -0,0 +1,113 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/private/datatransfer.h +// Purpose: OS X specific data transfer implementation +// Author: Stefan Csomor +// Created: 2019-03-29 +// Copyright: (c) 2019 Stefan Csomor <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_PRIVATE_DATATRANSFER_H_ +#define _WX_OSX_PRIVATE_DATATRANSFER_H_ + +#include "wx/osx/private.h" +#include "wx/osx/dataform.h" + +class WXDLLIMPEXP_FWD_CORE wxDataObject; + +class WXDLLIMPEXP_CORE wxOSXDataSourceItem +{ +public: + virtual ~wxOSXDataSourceItem(); + + virtual wxDataFormat::NativeFormat AvailableType(CFArrayRef types) const = 0; + + virtual bool GetData( const wxDataFormat& dataFormat, wxMemoryBuffer& target) = 0; + + virtual bool GetData( wxDataFormat::NativeFormat type, wxMemoryBuffer& target) = 0; + + virtual CFDataRef DoGetData(wxDataFormat::NativeFormat type) const = 0; +}; + +class WXDLLIMPEXP_CORE wxOSXDataSource +{ +public: + // the number of source items + virtual size_t GetItemCount() const = 0; + + // get source item by index, needs to be deleted after use + virtual const wxOSXDataSourceItem* GetItem(size_t pos) const = 0; + + // returns true if there is any data in this source conforming to dataFormat + virtual bool IsSupported(const wxDataFormat &dataFormat); + + // returns true if there is any data in this source supported by dataobj + virtual bool IsSupported(const wxDataObject &dataobj); + + // returns true if there is any data in this source of types + virtual bool HasData(CFArrayRef types) const = 0; + +}; + +class WXDLLIMPEXP_CORE wxOSXDataSinkItem +{ +public: + virtual ~wxOSXDataSinkItem(); + + virtual void SetFilename(const wxString& filename); + + // translating from wx into native representation + virtual void SetData(const wxDataFormat& format, const void *buf, size_t size) = 0; + + // translating from wx into native representation + virtual void SetData(wxDataFormat::NativeFormat format, const void *buf, size_t size) = 0; + + // native implementation for setting data + virtual void DoSetData(wxDataFormat::NativeFormat format, CFDataRef data) = 0; +}; + + +class WXDLLIMPEXP_CORE wxOSXDataSink +{ +public: + // delete all created sink items + virtual void Clear() = 0; + + // create a new sink item + virtual wxOSXDataSinkItem* CreateItem() = 0; + + // flush the created sink items into the system sink representation + virtual void Flush() = 0 ; +}; + +class WXDLLIMPEXP_CORE wxOSXPasteboard : public wxOSXDataSink, public wxOSXDataSource +{ +public: + wxOSXPasteboard(OSXPasteboard native); + ~wxOSXPasteboard(); + + // sink methods + + virtual wxOSXDataSinkItem* CreateItem() wxOVERRIDE; + + void Clear() wxOVERRIDE; + + void Flush() wxOVERRIDE; + + // source methods + + virtual size_t GetItemCount() const wxOVERRIDE; + + virtual const wxOSXDataSourceItem* GetItem(size_t pos) const wxOVERRIDE; + + virtual bool HasData(CFArrayRef types) const wxOVERRIDE; + + static wxOSXPasteboard* GetGeneralClipboard(); +private: + void DeleteSinkItems(); + + OSXPasteboard m_pasteboard; + wxVector<wxOSXDataSinkItem*> m_sinkItems; +}; + +#endif diff --git a/lib/wxWidgets/include/wx/osx/private/print.h b/lib/wxWidgets/include/wx/osx/private/print.h new file mode 100644 index 0000000..13c3d5c --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/private/print.h @@ -0,0 +1 @@ +#include "wx/osx/carbon/private/print.h" diff --git a/lib/wxWidgets/include/wx/osx/private/timer.h b/lib/wxWidgets/include/wx/osx/private/timer.h new file mode 100644 index 0000000..1eb8dd8 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/private/timer.h @@ -0,0 +1,3 @@ +#if 1 // revert to wxOSX_USE_COCOA_OR_IPHONE in case of problems + #include "wx/osx/core/private/timer.h" +#endif diff --git a/lib/wxWidgets/include/wx/osx/private/webrequest_urlsession.h b/lib/wxWidgets/include/wx/osx/private/webrequest_urlsession.h new file mode 100644 index 0000000..dad1697 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/private/webrequest_urlsession.h @@ -0,0 +1,172 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/webrequest_urlsession.h +// Purpose: wxWebRequest implementation using URLSession +// Author: Tobias Taschner +// Created: 2018-10-25 +// Copyright: (c) 2018 wxWidgets development team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_WEBREQUEST_URLSESSION_H +#define _WX_OSX_WEBREQUEST_URLSESSION_H + +#if wxUSE_WEBREQUEST_URLSESSION + +#include "wx/private/webrequest.h" + +DECLARE_WXCOCOA_OBJC_CLASS(NSURLCredential); +DECLARE_WXCOCOA_OBJC_CLASS(NSURLSession); +DECLARE_WXCOCOA_OBJC_CLASS(NSURLSessionTask); +DECLARE_WXCOCOA_OBJC_CLASS(wxWebSessionDelegate); + +class wxWebSessionURLSession; +class wxWebRequestURLSession; +class wxWebResponseURLSession; + +class wxWebAuthChallengeURLSession : public wxWebAuthChallengeImpl +{ +public: + wxWebAuthChallengeURLSession(wxWebAuthChallenge::Source source, + wxWebRequestURLSession& request) + : wxWebAuthChallengeImpl(source), + m_request(request) + { + } + + ~wxWebAuthChallengeURLSession(); + + void SetCredentials(const wxWebCredentials& cred) wxOVERRIDE; + + WX_NSURLCredential GetURLCredential() const { return m_cred; } + +private: + wxWebRequestURLSession& m_request; + WX_NSURLCredential m_cred = NULL; + + wxDECLARE_NO_COPY_CLASS(wxWebAuthChallengeURLSession); +}; + +class wxWebResponseURLSession : public wxWebResponseImpl +{ +public: + wxWebResponseURLSession(wxWebRequestURLSession& request, WX_NSURLSessionTask task); + + ~wxWebResponseURLSession(); + + wxFileOffset GetContentLength() const wxOVERRIDE; + + wxString GetURL() const wxOVERRIDE; + + wxString GetHeader(const wxString& name) const wxOVERRIDE; + + int GetStatus() const wxOVERRIDE; + + wxString GetStatusText() const wxOVERRIDE; + + wxString GetSuggestedFileName() const wxOVERRIDE; + + void HandleData(WX_NSData data); + +private: + WX_NSURLSessionTask m_task; + + wxDECLARE_NO_COPY_CLASS(wxWebResponseURLSession); +}; + +class wxWebRequestURLSession : public wxWebRequestImpl +{ +public: + wxWebRequestURLSession(wxWebSession& session, + wxWebSessionURLSession& sessionImpl, + wxEvtHandler* handler, + const wxString& url, + int winid); + + ~wxWebRequestURLSession(); + + void Start() wxOVERRIDE; + + wxWebResponseImplPtr GetResponse() const wxOVERRIDE + { return m_response; } + + wxWebAuthChallengeImplPtr GetAuthChallenge() const wxOVERRIDE + { return m_authChallenge; } + + wxFileOffset GetBytesSent() const wxOVERRIDE; + + wxFileOffset GetBytesExpectedToSend() const wxOVERRIDE; + + wxFileOffset GetBytesReceived() const wxOVERRIDE; + + wxFileOffset GetBytesExpectedToReceive() const wxOVERRIDE; + + wxWebRequestHandle GetNativeHandle() const wxOVERRIDE + { + return (wxWebRequestHandle)m_task; + } + + void HandleCompletion(); + + void HandleChallenge(wxWebAuthChallengeURLSession* challenge); + + void OnSetCredentials(const wxWebCredentials& cred); + + wxWebResponseURLSession* GetResponseImplPtr() const + { return m_response.get(); } + + wxWebAuthChallengeURLSession* GetAuthChallengeImplPtr() const + { return m_authChallenge.get(); } + +private: + void DoCancel() wxOVERRIDE; + + wxWebSessionURLSession& m_sessionImpl; + wxString m_url; + WX_NSURLSessionTask m_task; + wxObjectDataPtr<wxWebResponseURLSession> m_response; + wxObjectDataPtr<wxWebAuthChallengeURLSession> m_authChallenge; + + wxDECLARE_NO_COPY_CLASS(wxWebRequestURLSession); +}; + +class wxWebSessionURLSession : public wxWebSessionImpl +{ +public: + wxWebSessionURLSession(); + + ~wxWebSessionURLSession(); + + wxWebRequestImplPtr + CreateRequest(wxWebSession& session, + wxEvtHandler* handler, + const wxString& url, + int winid = wxID_ANY) wxOVERRIDE; + + wxVersionInfo GetLibraryVersionInfo() wxOVERRIDE; + + wxWebSessionHandle GetNativeHandle() const wxOVERRIDE + { + return (wxWebSessionHandle)m_session; + } + + WX_NSURLSession GetSession() { return m_session; } + + WX_wxWebSessionDelegate GetDelegate() { return m_delegate; } + +private: + WX_NSURLSession m_session; + WX_wxWebSessionDelegate m_delegate; + + wxDECLARE_NO_COPY_CLASS(wxWebSessionURLSession); +}; + +class wxWebSessionFactoryURLSession : public wxWebSessionFactory +{ +public: + wxWebSessionImpl* Create() wxOVERRIDE + { return new wxWebSessionURLSession(); } +}; + +#endif // wxUSE_WEBREQUEST_URLSESSION + +#endif // _WX_OSX_WEBREQUEST_URLSESSION_H diff --git a/lib/wxWidgets/include/wx/osx/radiobox.h b/lib/wxWidgets/include/wx/osx/radiobox.h new file mode 100644 index 0000000..9f710cc --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/radiobox.h @@ -0,0 +1,108 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/radiobox.h +// Purpose: wxRadioBox class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RADIOBOX_H_ +#define _WX_RADIOBOX_H_ + +#include "wx/containr.h" + +// List box item +class WXDLLIMPEXP_FWD_CORE wxBitmap ; + +class WXDLLIMPEXP_FWD_CORE wxRadioButton ; + +class WXDLLIMPEXP_CORE wxRadioBox: public wxNavigationEnabled<wxControl>, public wxRadioBoxBase +{ + wxDECLARE_DYNAMIC_CLASS(wxRadioBox); +public: +// Constructors & destructor + wxRadioBox(); + wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + int majorDim = 0, long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, const wxString& name = wxASCII_STR(wxRadioBoxNameStr)) + { + Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name); + } + wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint& pos, const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioBoxNameStr)) + { + Create(parent, id, title, pos, size, choices, + majorDim, style, val, name); + } + virtual ~wxRadioBox(); + bool Create(wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + int majorDim = 0, long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, const wxString& name = wxASCII_STR(wxRadioBoxNameStr)); + bool Create(wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint& pos, const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioBoxNameStr)); + + // Enabling + virtual bool Enable(bool enable = true) wxOVERRIDE; + virtual bool Enable(unsigned int item, bool enable = true) wxOVERRIDE; + virtual bool IsItemEnabled(unsigned int item) const wxOVERRIDE; + + // Showing + virtual bool Show(bool show = true) wxOVERRIDE; + virtual bool Show(unsigned int item, bool show = true) wxOVERRIDE; + virtual bool IsItemShown(unsigned int item) const wxOVERRIDE; + + // Specific functions (in wxWidgets2 reference) + virtual void SetSelection(int item) wxOVERRIDE; + virtual int GetSelection() const wxOVERRIDE; + + virtual unsigned int GetCount() const wxOVERRIDE { return m_noItems; } + + virtual wxString GetString(unsigned int item) const wxOVERRIDE; + virtual void SetString(unsigned int item, const wxString& label) wxOVERRIDE; + + // protect native font of box + virtual bool SetFont( const wxFont &font ) wxOVERRIDE; +// Other external functions + void Command(wxCommandEvent& event) wxOVERRIDE; + void SetFocus() wxOVERRIDE; + +// Other variable access functions + int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; } + void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; } + + void OnRadioButton( wxCommandEvent& event ) ; + +protected: + // resolve ambiguity in base classes + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxRadioBoxBase::GetDefaultBorder(); } + + wxRadioButton *m_radioButtonCycle; + + unsigned int m_noItems; + int m_noRowsOrCols; + +// Internal functions + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; + + wxDECLARE_EVENT_TABLE(); +}; + +#endif + // _WX_RADIOBOX_H_ diff --git a/lib/wxWidgets/include/wx/osx/radiobut.h b/lib/wxWidgets/include/wx/osx/radiobut.h new file mode 100644 index 0000000..3934f83 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/radiobut.h @@ -0,0 +1,93 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/radiobut.h +// Purpose: wxRadioButton class +// Author: Stefan Csomor +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RADIOBUT_H_ +#define _WX_RADIOBUT_H_ + +class WXDLLIMPEXP_CORE wxRadioButton: public wxRadioButtonBase +{ + wxDECLARE_DYNAMIC_CLASS(wxRadioButton); + +public: + wxRadioButton() {} + wxRadioButton(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioButtonNameStr)) + { + Create(parent, id, label, pos, size, style, validator, name); + } + virtual ~wxRadioButton(); + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioButtonNameStr)); + + virtual void SetValue(bool val) wxOVERRIDE; + virtual bool GetValue() const wxOVERRIDE; + + // implementation + + void Command(wxCommandEvent& event) wxOVERRIDE; + wxRadioButton *AddInCycle(wxRadioButton *cycle); + void RemoveFromCycle(); + wxRadioButton *NextInCycle() {return m_cycle;} + + // osx specific event handling common for all osx-ports + + virtual bool OSXHandleClicked(double timestampsec) wxOVERRIDE; + protected: + + wxRadioButton *m_cycle; +}; + +// Not implemented +#if 0 +class WXDLLIMPEXP_FWD_CORE wxBitmap ; + +WXDLLIMPEXP_DATA_CORE(extern const wxChar) wxBitmapRadioButtonNameStr[]; + +class WXDLLIMPEXP_CORE wxBitmapRadioButton: public wxRadioButton +{ + wxDECLARE_DYNAMIC_CLASS(wxBitmapRadioButton); +protected: + wxBitmap *theButtonBitmap; +public: + wxBitmapRadioButton() { theButtonBitmap = NULL; } + wxBitmapRadioButton(wxWindow *parent, wxWindowID id, + const wxBitmap *label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxBitmapRadioButtonNameStr) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxBitmap *label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxBitmapRadioButtonNameStr); + + virtual void SetLabel(const wxBitmap *label); + virtual void SetValue(bool val) ; + virtual bool GetValue() const ; +}; +#endif + +#endif + // _WX_RADIOBUT_H_ diff --git a/lib/wxWidgets/include/wx/osx/region.h b/lib/wxWidgets/include/wx/osx/region.h new file mode 100644 index 0000000..e085282 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/region.h @@ -0,0 +1,8 @@ +#if wxOSX_USE_COCOA_OR_CARBON +#include "wx/osx/carbon/region.h" +#else +#define wxRegionGeneric wxRegion +#define wxRegionIteratorGeneric wxRegionIterator + +#include "wx/generic/region.h" +#endif diff --git a/lib/wxWidgets/include/wx/osx/scrolbar.h b/lib/wxWidgets/include/wx/osx/scrolbar.h new file mode 100644 index 0000000..1142ec0 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/scrolbar.h @@ -0,0 +1,68 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/scrolbar.h +// Purpose: wxScrollBar class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SCROLBAR_H_ +#define _WX_SCROLBAR_H_ + +// Scrollbar item +class WXDLLIMPEXP_CORE wxScrollBar : public wxScrollBarBase +{ +public: + wxScrollBar() { m_pageSize = 0; m_viewSize = 0; m_objectSize = 0; } + virtual ~wxScrollBar(); + + wxScrollBar(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSB_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxScrollBarNameStr)) + { + Create(parent, id, pos, size, style, validator, name); + } + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSB_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxScrollBarNameStr)); + + virtual int GetThumbPosition() const wxOVERRIDE; + virtual int GetThumbSize() const wxOVERRIDE { return m_viewSize; } + virtual int GetPageSize() const wxOVERRIDE { return m_pageSize; } + virtual int GetRange() const wxOVERRIDE { return m_objectSize; } + + virtual void SetThumbPosition(int viewStart) wxOVERRIDE; + virtual void SetScrollbar(int position, int thumbSize, int range, + int pageSize, bool refresh = true) wxOVERRIDE; + + // needed for RTTI + void SetThumbSize( int s ) { SetScrollbar( GetThumbPosition() , s , GetRange() , GetPageSize() , true ) ; } + void SetPageSize( int s ) { SetScrollbar( GetThumbPosition() , GetThumbSize() , GetRange() , s , true ) ; } + void SetRange( int s ) { SetScrollbar( GetThumbPosition() , GetThumbSize() , s , GetPageSize() , true ) ; } + + // implementation only from now on + void Command(wxCommandEvent& event) wxOVERRIDE; + virtual void TriggerScrollEvent( wxEventType scrollEvent ) wxOVERRIDE; + virtual bool OSXHandleClicked( double timestampsec ) wxOVERRIDE; +protected: + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + int m_pageSize; + int m_viewSize; + int m_objectSize; + + wxDECLARE_DYNAMIC_CLASS(wxScrollBar); + wxDECLARE_EVENT_TABLE(); +}; + +#endif // _WX_SCROLBAR_H_ diff --git a/lib/wxWidgets/include/wx/osx/setup.h b/lib/wxWidgets/include/wx/osx/setup.h new file mode 100644 index 0000000..3afbc02 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/setup.h @@ -0,0 +1,1693 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/setup.h +// Purpose: Configuration for the library +// Author: Stefan Csomor +// Modified by: Stefan Csomor +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SETUP_H_ +#define _WX_SETUP_H_ + +#ifdef __WXMAC_XCODE__ +// while configure based builds have the flags prepended, we must do this here +// for xcode based builds +#include "wx/osx/config_xcode.h" +#endif + +/* --- start common options --- */ +// ---------------------------------------------------------------------------- +// global settings +// ---------------------------------------------------------------------------- + +// define this to 0 when building wxBase library - this can also be done from +// makefile/project file overriding the value here +#ifndef wxUSE_GUI + #define wxUSE_GUI 1 +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// compatibility settings +// ---------------------------------------------------------------------------- + +// This setting determines the compatibility with 2.8 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_8 0 + +// This setting determines the compatibility with 3.0 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_3_0 1 + +// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when +// default system font is used for wxWindow::GetCharWidth/Height() instead of +// the current font. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxDIALOG_UNIT_COMPATIBILITY 0 + +// Provide unsafe implicit conversions in wxString to "const char*" or +// "std::string" (depending on wxUSE_STD_STRING_CONV_IN_WXSTRING value). +// +// Default is 1 but only for compatibility reasons, it is recommended to set +// this to 0 because converting wxString to a narrow (non-Unicode) string may +// fail unless a locale using UTF-8 encoding is used, which is never the case +// under MSW, for example, hence such conversions can result in silent data +// loss. +// +// Recommended setting: 0 +#define wxUSE_UNSAFE_WXSTRING_CONV 1 + +// If set to 1, enables "reproducible builds", i.e. build output should be +// exactly the same if the same build is redone again. As using __DATE__ and +// __TIME__ macros clearly makes the build irreproducible, setting this option +// to 1 disables their use in the library code. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_REPRODUCIBLE_BUILD 0 + +// ---------------------------------------------------------------------------- +// debugging settings +// ---------------------------------------------------------------------------- + +// wxDEBUG_LEVEL will be defined as 1 in wx/debug.h so normally there is no +// need to define it here. You may do it for two reasons: either completely +// disable/compile out the asserts in release version (then do it inside #ifdef +// NDEBUG) or, on the contrary, enable more asserts, including the usually +// disabled ones, in the debug build (then do it inside #ifndef NDEBUG) +// +// #ifdef NDEBUG +// #define wxDEBUG_LEVEL 0 +// #else +// #define wxDEBUG_LEVEL 2 +// #endif + +// wxHandleFatalExceptions() may be used to catch the program faults at run +// time and, instead of terminating the program with a usual GPF message box, +// call the user-defined wxApp::OnFatalException() function. If you set +// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. +// +// This setting is for Win32 only and can only be enabled if your compiler +// supports Win32 structured exception handling (currently only VC++ does) +// +// Default is 1 +// +// Recommended setting: 1 if your compiler supports it. +#define wxUSE_ON_FATAL_EXCEPTION 1 + +// Set this to 1 to be able to generate a human-readable (unlike +// machine-readable minidump created by wxCrashReport::Generate()) stack back +// trace when your program crashes using wxStackWalker +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_STACKWALKER 1 + +// Set this to 1 to compile in wxDebugReport class which allows you to create +// and optionally upload to your web site a debug report consisting of back +// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, it is compiled into a separate library so there +// is no overhead if you don't use it +#define wxUSE_DEBUGREPORT 1 + +// Generic comment about debugging settings: they are very useful if you don't +// use any other memory leak detection tools such as Purify/BoundsChecker, but +// are probably redundant otherwise. Also, Visual C++ CRT has the same features +// as wxWidgets memory debugging subsystem built in since version 5.0 and you +// may prefer to use it instead of built in memory debugging code because it is +// faster and more fool proof. +// +// Using VC++ CRT memory debugging is enabled by default in debug build (_DEBUG +// is defined) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) +// and if __NO_VC_CRTDBG__ is not defined. + +// The rest of the options in this section are obsolete and not supported, +// enable them at your own risk. + +// If 1, enables wxDebugContext, for writing error messages to file, etc. If +// __WXDEBUG__ is not defined, will still use the normal memory operators. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_CONTEXT 0 + +// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* +// __WXDEBUG__ is also defined. +// +// WARNING: this code may not work with all architectures, especially if +// alignment is an issue. This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 1 if you are not using a memory debugging tool, else 0 +#define wxUSE_MEMORY_TRACING 0 + +// In debug mode, cause new and delete to be redefined globally. +// If this causes problems (e.g. link errors which is a common problem +// especially if you use another library which also redefines the global new +// and delete), set this to 0. +// This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If +// this causes problems (e.g. link errors), set this to 0. You may need to set +// this to 0 if using templates (at least for VC++). This switch is currently +// ignored for MinGW/Cygwin. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_NEW_ALWAYS 0 + + +// ---------------------------------------------------------------------------- +// Unicode support +// ---------------------------------------------------------------------------- + +// This option is deprecated: the library should be always built in Unicode mode +// now, only set wxUSE_UNICODE to 0 to compile legacy code in ANSI mode if +// absolutely necessary -- updating it is strongly recommended as the ANSI mode +// will disappear completely in future wxWidgets releases. +#ifndef wxUSE_UNICODE + #define wxUSE_UNICODE 1 +#endif + +// ---------------------------------------------------------------------------- +// global features +// ---------------------------------------------------------------------------- + +// Compile library in exception-safe mode? If set to 1, the library will try to +// behave correctly in presence of exceptions (even though it still will not +// use the exceptions itself) and notify the user code about any unhandled +// exceptions. If set to 0, propagation of the exceptions through the library +// code will lead to undefined behaviour -- but the code itself will be +// slightly smaller and faster. +// +// Note that like wxUSE_THREADS this option is automatically set to 0 if +// wxNO_EXCEPTIONS is defined. +// +// Default is 1 +// +// Recommended setting: depends on whether you intend to use C++ exceptions +// in your own code (1 if you do, 0 if you don't) +#define wxUSE_EXCEPTIONS 1 + +// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI +// +// This feature is incomplete and experimental, please only enable it if +// you want to participate in its development. +// +// Recommended setting: 0 (unless you wish to try working on it). +#define wxUSE_EXTENDED_RTTI 0 + +// Support for message/error logging. This includes wxLogXXX() functions and +// wxLog and derived classes. Don't set this to 0 unless you really know what +// you are doing. +// +// Default is 1 +// +// Recommended setting: 1 (always) +#define wxUSE_LOG 1 + +// Recommended setting: 1 +#define wxUSE_LOGWINDOW 1 + +// Recommended setting: 1 +#define wxUSE_LOGGUI 1 + +// Recommended setting: 1 +#define wxUSE_LOG_DIALOG 1 + +// Support for command line parsing using wxCmdLineParser class. +// +// Default is 1 +// +// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) +#define wxUSE_CMDLINE_PARSER 1 + +// Support for multithreaded applications: if 1, compile in thread classes +// (thread.h) and make the library a bit more thread safe. Although thread +// support is quite stable by now, you may still consider recompiling the +// library without it if you have no use for it - this will result in a +// somewhat smaller and faster operation. +// +// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset +// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in +// build/msw/config.* file this value will have no effect. +// +// Default is 1 +// +// Recommended setting: 0 unless you do plan to develop MT applications +#define wxUSE_THREADS 1 + +// If enabled, compiles wxWidgets streams classes +// +// wx stream classes are used for image IO, process IO redirection, network +// protocols implementation and much more and so disabling this results in a +// lot of other functionality being lost. +// +// Default is 1 +// +// Recommended setting: 1 as setting it to 0 disables many other things +#define wxUSE_STREAMS 1 + +// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. +// Note that if the system's implementation does not support positional +// parameters, setting this to 1 forces the use of the wxWidgets implementation +// of wxVsnprintf. The standard vsnprintf() supports positional parameters on +// many Unix systems but usually doesn't under Windows. +// +// Positional parameters are very useful when translating a program since using +// them in formatting strings allow translators to correctly reorder the +// translated sentences. +// +// Default is 1 +// +// Recommended setting: 1 if you want to support multiple languages +#define wxUSE_PRINTF_POS_PARAMS 1 + +// Enable the use of compiler-specific thread local storage keyword, if any. +// This is used for wxTLS_XXX() macros implementation and normally should use +// the compiler-provided support as it's simpler and more efficient, but is +// disabled under Windows in wx/msw/chkconf.h as it can't be used if wxWidgets +// is used in a dynamically loaded Win32 DLL (i.e. using LoadLibrary()) under +// XP as this triggers a bug in compiler TLS support that results in crashes +// when any TLS variables are used. +// +// If you're absolutely sure that your build of wxWidgets is never going to be +// used in such situation, either because it's not going to be linked from any +// kind of plugin or because you only target Vista or later systems, you can +// set this to 2 to force the use of compiler TLS even under MSW. +// +// Default is 1 meaning that compiler TLS is used only if it's 100% safe. +// +// Recommended setting: 2 if you want to have maximal performance and don't +// care about the scenario described above. +#define wxUSE_COMPILER_TLS 1 + +// ---------------------------------------------------------------------------- +// Interoperability with the standard library. +// ---------------------------------------------------------------------------- + +// Set wxUSE_STL to 1 to enable maximal interoperability with the standard +// library, even at the cost of backwards compatibility. +// +// Default is 0 +// +// Recommended setting: 0 as the options below already provide a relatively +// good level of interoperability and changing this option arguably isn't worth +// diverging from the official builds of the library. +#define wxUSE_STL 0 + +// This is not a real option but is used as the default value for +// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS_COMPATIBLY. +// +// Set it to 0 if you want to disable the use of all standard classes +// completely for some reason. +#define wxUSE_STD_DEFAULT 1 + +// Use standard C++ containers where it can be done without breaking backwards +// compatibility. +// +// This provides better interoperability with the standard library, e.g. with +// this option on it's possible to insert std::vector<> into many wxWidgets +// containers directly. +// +// Default is 1. +// +// Recommended setting is 1 unless you want to avoid all dependencies on the +// standard library. +#define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT + +// Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<> +// and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but +// usually more limited) implementations are used which allows to avoid the +// dependency on the C++ run-time library. +// +// Default is 0 for compatibility reasons. +// +// Recommended setting: 1 unless compatibility with the official wxWidgets +// build and/or the existing code is a concern. +#define wxUSE_STD_CONTAINERS 0 + +// Use standard C++ streams if 1 instead of wx streams in some places. If +// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the +// standard streams library. +// +// Notice that enabling this does not replace wx streams with std streams +// everywhere, in a lot of places wx streams are used no matter what. +// +// Default is 1 if compiler supports it. +// +// Recommended setting: 1 if you use the standard streams anyhow and so +// dependency on the standard streams library is not a +// problem +#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT + +// Enable minimal interoperability with the standard C++ string class if 1. +// "Minimal" means that wxString can be constructed from std::string or +// std::wstring but can't be implicitly converted to them. You need to enable +// the option below for the latter. +// +// Default is 1 for most compilers. +// +// Recommended setting: 1 unless you want to ensure your program doesn't use +// the standard C++ library at all. +#define wxUSE_STD_STRING wxUSE_STD_DEFAULT + +// Make wxString as much interchangeable with std::[w]string as possible, in +// particular allow implicit conversion of wxString to either of these classes. +// This comes at a price (or a benefit, depending on your point of view) of not +// allowing implicit conversion to "const char *" and "const wchar_t *". +// +// Because a lot of existing code relies on these conversions, this option is +// disabled by default but can be enabled for your build if you don't care +// about compatibility. +// +// Default is 0 if wxUSE_STL has its default value or 1 if it is enabled. +// +// Recommended setting: 0 to remain compatible with the official builds of +// wxWidgets. +#define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL + +// ---------------------------------------------------------------------------- +// non GUI features selection +// ---------------------------------------------------------------------------- + +// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit +// integer which is implemented in terms of native 64 bit integers if any or +// uses emulation otherwise. +// +// This class is required by wxDateTime and so you should enable it if you want +// to use wxDateTime. For most modern platforms, it will use the native 64 bit +// integers in which case (almost) all of its functions are inline and it +// almost does not take any space, so there should be no reason to switch it +// off. +// +// Recommended setting: 1 +#define wxUSE_LONGLONG 1 + +// Set wxUSE_BASE64 to 1, to compile in Base64 support. This is required for +// storing binary data in wxConfig on most platforms. +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_BASE64 1 + +// Set this to 1 to be able to use wxEventLoop even in console applications +// (i.e. using base library only, without GUI). This is mostly useful for +// processing socket events but is also necessary to use timers in console +// applications +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_CONSOLE_EVENTLOOP 1 + +// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level +// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. +// +// Default is 1 +// +// Recommended setting: 1 (wxFile is highly recommended as it is required by +// i18n code, wxFileConfig and others) +#define wxUSE_FILE 1 +#define wxUSE_FFILE 1 + +// Use wxFSVolume class providing access to the configured/active mount points +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely disabled if you don't use it) +#define wxUSE_FSVOLUME 1 + +// Use wxSecretStore class for storing passwords using OS-specific facilities. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely disabled if you don't use it) +#define wxUSE_SECRETSTORE 1 + +// Allow the use of the OS built-in spell checker in wxTextCtrl. +// +// Default is 1, the corresponding wxTextCtrl functions simply won't do +// anything if the functionality is not supported by the current platform. +// +// Recommended setting: 1 unless you want to save a tiny bit of code. +#define wxUSE_SPELLCHECK 1 + +// Use wxStandardPaths class which allows to retrieve some standard locations +// in the file system +// +// Default is 1 +// +// Recommended setting: 1 (may be disabled to save space, but not much) +#define wxUSE_STDPATHS 1 + +// use wxTextBuffer class: required by wxTextFile +#define wxUSE_TEXTBUFFER 1 + +// use wxTextFile class: requires wxFile and wxTextBuffer, required by +// wxFileConfig +#define wxUSE_TEXTFILE 1 + +// i18n support: _() macro, wxLocale class. +#define wxUSE_INTL 1 + +// Provide wxFoo_l() functions similar to standard foo() functions but taking +// an extra locale parameter. +// +// Notice that this is fully implemented only for the systems providing POSIX +// xlocale support or Microsoft Visual C++ >= 8 (which provides proprietary +// almost-equivalent of xlocale functions), otherwise wxFoo_l() functions will +// only work for the current user locale and "C" locale. You can use +// wxHAS_XLOCALE_SUPPORT to test whether the full support is available. +// +// Default is 1 +// +// Recommended setting: 1 but may be disabled if you are writing programs +// running only in C locale anyhow +#define wxUSE_XLOCALE 1 + +// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which +// allow to manipulate dates, times and time intervals. +// +// Requires: wxUSE_LONGLONG +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_DATETIME 1 + +// Set wxUSE_TIMER to 1 to compile wxTimer class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_TIMER 1 + +// Use wxStopWatch class. +// +// Default is 1 +// +// Recommended setting: 1 (needed by wxSocket) +#define wxUSE_STOPWATCH 1 + +// Set wxUSE_FSWATCHER to 1 if you want to enable wxFileSystemWatcher +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_FSWATCHER 1 + +// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes +// which allow the application to store its settings in the persistent +// storage. Setting this to 1 will also enable on-demand creation of the +// global config object in wxApp. +// +// See also wxUSE_CONFIG_NATIVE below. +// +// Recommended setting: 1 +#define wxUSE_CONFIG 1 + +// If wxUSE_CONFIG is 1, you may choose to use either the native config +// classes under Windows (using the registry) or the portable text file +// format used by the config classes under Unix. +// +// Default is 1 to use native classes. Note that you may still use +// wxFileConfig even if you set this to 1 - just the config object created by +// default for the applications needs will be a wxRegConfig or wxIniConfig and +// not wxFileConfig. +// +// Recommended setting: 1 +#define wxUSE_CONFIG_NATIVE 1 + +// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows +// to connect/disconnect from the network and be notified whenever the dial-up +// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DIALUP_MANAGER 1 + +// Compile in classes for run-time DLL loading and function calling. +// Required by wxUSE_DIALUP_MANAGER. +// +// This setting is for Win32 only +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DYNLIB_CLASS 1 + +// experimental, don't use for now +#define wxUSE_DYNAMIC_LOADER 1 + +// Set to 1 to use socket classes +#define wxUSE_SOCKETS 1 + +// Set to 1 to use ipv6 socket classes (requires wxUSE_SOCKETS) +// +// Default is 1. +// +// Recommended setting: 1. +#define wxUSE_IPV6 1 + +// Set to 1 to enable virtual file systems (required by wxHTML) +#define wxUSE_FILESYSTEM 1 + +// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ZIP 1 + +// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ARCHIVE 1 + +// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_INET 1 + +// wxArchive classes for accessing archives such as zip and tar +#define wxUSE_ARCHIVE_STREAMS 1 + +// Set to 1 to compile wxZipInput/OutputStream classes. +#define wxUSE_ZIPSTREAM 1 + +// Set to 1 to compile wxTarInput/OutputStream classes. +#define wxUSE_TARSTREAM 1 + +// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by +// wxUSE_LIBPNG +#define wxUSE_ZLIB 1 + +// Set to 1 if liblzma is available to enable wxLZMA{Input,Output}Stream +// classes. +// +// Notice that if you enable this build option when not using configure or +// CMake, you need to ensure that liblzma headers and libraries are available +// (i.e. by building the library yourself or downloading its binaries) and can +// be found, either by copying them to one of the locations searched by the +// compiler/linker by default (e.g. any of the directories in the INCLUDE or +// LIB environment variables, respectively, when using MSVC) or modify the +// make- or project files to add references to these directories. +// +// Default is 0 under MSW, auto-detected by configure. +// +// Recommended setting: 1 if you need LZMA compression. +#define wxUSE_LIBLZMA 0 + +// If enabled, the code written by Apple will be used to write, in a portable +// way, float on the disk. See extended.c for the license which is different +// from wxWidgets one. +// +// Default is 1. +// +// Recommended setting: 1 unless you don't like the license terms (unlikely) +#define wxUSE_APPLE_IEEE 1 + +// Joystick support class +#define wxUSE_JOYSTICK 1 + +// wxFontEnumerator class +#define wxUSE_FONTENUM 1 + +// wxFontMapper class +#define wxUSE_FONTMAP 1 + +// wxMimeTypesManager class +#define wxUSE_MIMETYPE 1 + +// wxWebRequest allows usage of system libraries for HTTP(S) requests. +// +// Note that for wxWebRequest to be built, at least one of its backends must be +// available. Under MSW and macOS this will always be the case unless +// explicitly disabled. +// +// Default is 1 +// +// Recommended setting: 1, setting it to 0 may be useful to avoid dependencies +// on libcurl on Unix systems. +#define wxUSE_WEBREQUEST 1 + +// wxWebRequest backend based on NSURLSession +// +// Default is 1 under macOS. +// +// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, +// otherwise wxWebRequest won't be available at all under Mac. +#ifdef __APPLE__ +#define wxUSE_WEBREQUEST_URLSESSION wxUSE_WEBREQUEST +#else +#define wxUSE_WEBREQUEST_URLSESSION 0 +#endif + +// wxWebRequest backend based on libcurl, can be used under all platforms. +// +// Default is 0 for MSW and macOS, detected automatically when using configure. +// +// Recommended setting: 0 on Windows and macOS, otherwise 1 as it is required +// for wxWebRequest to be available at all. +#define wxUSE_WEBREQUEST_CURL 0 + +// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP +// or wxURL you need to set this to 1. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_PROTOCOL 1 + +// The settings for the individual URL schemes +#define wxUSE_PROTOCOL_FILE 1 +#define wxUSE_PROTOCOL_FTP 1 +#define wxUSE_PROTOCOL_HTTP 1 + +// Define this to use wxURL class. +#define wxUSE_URL 1 + +// Define this to use native platform url and protocol support. +// Currently valid only for MS-Windows. +// Note: if you set this to 1, you can open ftp/http/gopher sites +// and obtain a valid input stream for these sites +// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. +// Doing so reduces the code size. +// +// This code is experimental and subject to change. +#define wxUSE_URL_NATIVE 0 + +// Support for wxVariant class used in several places throughout the library, +// notably in wxDataViewCtrl API. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size as much as +// possible in which case setting this to 0 can gain up to 100KB. +#define wxUSE_VARIANT 1 + +// Support for wxAny class, the successor for wxVariant. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size by a small amount, +// or your compiler cannot for some reason cope with complexity of templates used. +#define wxUSE_ANY 1 + +// Support for regular expression matching via wxRegEx class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_REGEX 1 + +// wxSystemOptions class +#define wxUSE_SYSTEM_OPTIONS 1 + +// wxSound class +#define wxUSE_SOUND 1 + +// Use wxMediaCtrl +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_MEDIACTRL 1 + +// Use wxWidget's XRC XML-based resource system. Recommended. +// +// Default is 1 +// +// Recommended setting: 1 (requires wxUSE_XML) +#define wxUSE_XRC 1 + +// XML parsing classes. +// +// Default is 1 +// +// Recommended setting: 1 (required by XRC) +#define wxUSE_XML 1 + +// Use wxWidget's AUI docking system +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_AUI 1 + +// Use wxWidget's Ribbon classes for interfaces +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_RIBBON 1 + +// Use wxPropertyGrid. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_PROPGRID 1 + +// Use wxStyledTextCtrl, a wxWidgets Scintilla wrapper. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STC 1 + +// Use wxWidget's web viewing classes +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_WEBVIEW 1 + +// Use the IE wxWebView backend +// +// Default is 1 on MSW +// +// Recommended setting: 1 +#ifdef __WXMSW__ +#define wxUSE_WEBVIEW_IE 1 +#else +#define wxUSE_WEBVIEW_IE 0 +#endif + +// Use the Edge (Chromium) wxWebView backend (Requires WebView2 SDK) +// +// Default is 0 because WebView2 is not always available, set it to 1 if you do have it. +// +// Recommended setting: 1 when building for Windows with WebView2 SDK +#define wxUSE_WEBVIEW_EDGE 0 + +// Use the Edge (Chromium) wxWebView backend without loader DLL +// +// Default is 0, set it to 1 if you don't want to depend on WebView2Loader.dll. +// +// Recommended setting: 0 +#define wxUSE_WEBVIEW_EDGE_STATIC 0 + +// Use the WebKit wxWebView backend +// +// Default is 1 on GTK and OSX +// +// Recommended setting: 1 +#if (defined(__WXGTK__) && !defined(__WXGTK3__)) || defined(__WXOSX__) +#define wxUSE_WEBVIEW_WEBKIT 1 +#else +#define wxUSE_WEBVIEW_WEBKIT 0 +#endif + +// Use the WebKit2 wxWebView backend +// +// Default is 1 on GTK3 +// +// Recommended setting: 1 +#if defined(__WXGTK3__) +#define wxUSE_WEBVIEW_WEBKIT2 1 +#else +#define wxUSE_WEBVIEW_WEBKIT2 0 +#endif + +// Enable wxGraphicsContext and related classes for a modern 2D drawing API. +// +// Default is 1 except if you're using a compiler without support for GDI+ +// under MSW, i.e. gdiplus.h and related headers (MSVC and MinGW >= 4.8 are +// known to have them). For other compilers (e.g. older mingw32) you may need +// to install the headers (and just the headers) yourself. If you do, change +// the setting below manually. +// +// Recommended setting: 1 if supported by the compilation environment + +// Notice that we can't use wxCHECK_VISUALC_VERSION() nor wxCHECK_GCC_VERSION() +// here as this file is included from wx/platform.h before they're defined. +#if defined(_MSC_VER) || \ + (defined(__MINGW32__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 8)) +#define wxUSE_GRAPHICS_CONTEXT 1 +#else +// Disable support for other Windows compilers, enable it if your compiler +// comes with new enough SDK or you installed the headers manually. +// +// Notice that this will be set by configure under non-Windows platforms +// anyhow so the value there is not important. +#define wxUSE_GRAPHICS_CONTEXT 0 +#endif + +// Enable wxGraphicsContext implementation using Cairo library. +// +// This is not needed under Windows and detected automatically by configure +// under other systems, however you may set this to 1 manually if you installed +// Cairo under Windows yourself and prefer to use it instead the native GDI+ +// implementation. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_CAIRO 0 + + +// ---------------------------------------------------------------------------- +// Individual GUI controls +// ---------------------------------------------------------------------------- + +// You must set wxUSE_CONTROLS to 1 if you are using any controls at all +// (without it, wxControl class is not compiled) +// +// Default is 1 +// +// Recommended setting: 1 (don't change except for very special programs) +#define wxUSE_CONTROLS 1 + +// Support markup in control labels, i.e. provide wxControl::SetLabelMarkup(). +// Currently markup is supported only by a few controls and only some ports but +// their number will increase with time. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you want to save on code size) +#define wxUSE_MARKUP 1 + +// wxPopupWindow class is a top level transient window. It is currently used +// to implement wxTipWindow +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) +#define wxUSE_POPUPWIN 1 + +// wxTipWindow allows to implement the custom tooltips, it is used by the +// context help classes. Requires wxUSE_POPUPWIN. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0) +#define wxUSE_TIPWINDOW 1 + +// Each of the settings below corresponds to one wxWidgets control. They are +// all switched on by default but may be disabled if you are sure that your +// program (including any standard dialogs it can show!) doesn't need them and +// if you desperately want to save some space. If you use any of these you must +// set wxUSE_CONTROLS as well. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_ACTIVITYINDICATOR 1 // wxActivityIndicator +#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl +#define wxUSE_BANNERWINDOW 1 // wxBannerWindow +#define wxUSE_BUTTON 1 // wxButton +#define wxUSE_BMPBUTTON 1 // wxBitmapButton +#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl +#define wxUSE_CHECKBOX 1 // wxCheckBox +#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) +#define wxUSE_CHOICE 1 // wxChoice +#define wxUSE_COLLPANE 1 // wxCollapsiblePane +#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl +#define wxUSE_COMBOBOX 1 // wxComboBox +#define wxUSE_COMMANDLINKBUTTON 1 // wxCommandLinkButton +#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl +#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl +#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl +#define wxUSE_EDITABLELISTBOX 1 // wxEditableListBox +#define wxUSE_FILECTRL 1 // wxFileCtrl +#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl +#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl +#define wxUSE_GAUGE 1 // wxGauge +#define wxUSE_HEADERCTRL 1 // wxHeaderCtrl +#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl +#define wxUSE_LISTBOX 1 // wxListBox +#define wxUSE_LISTCTRL 1 // wxListCtrl +#define wxUSE_RADIOBOX 1 // wxRadioBox +#define wxUSE_RADIOBTN 1 // wxRadioButton +#define wxUSE_RICHMSGDLG 1 // wxRichMessageDialog +#define wxUSE_SCROLLBAR 1 // wxScrollBar +#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl +#define wxUSE_SLIDER 1 // wxSlider +#define wxUSE_SPINBTN 1 // wxSpinButton +#define wxUSE_SPINCTRL 1 // wxSpinCtrl +#define wxUSE_STATBOX 1 // wxStaticBox +#define wxUSE_STATLINE 1 // wxStaticLine +#define wxUSE_STATTEXT 1 // wxStaticText +#define wxUSE_STATBMP 1 // wxStaticBitmap +#define wxUSE_TEXTCTRL 1 // wxTextCtrl +#define wxUSE_TIMEPICKCTRL 1 // wxTimePickerCtrl +#define wxUSE_TOGGLEBTN 1 // requires wxButton +#define wxUSE_TREECTRL 1 // wxTreeCtrl +#define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl + +// Use generic version of wxDataViewCtrl even if a native one is available? +// +// Default is 1. +// +// Recommended setting: 1, but can be set to 0 if your program is affected by +// the native control limitations. +#define wxUSE_NATIVE_DATAVIEWCTRL 1 + +// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR +// below either wxStatusBar95 or a generic wxStatusBar will be used. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STATUSBAR 1 + +// Two status bar implementations are available under Win32: the generic one +// or the wrapper around native control. For native look and feel the native +// version should be used. +// +// Default is 1 for the platforms where native status bar is supported. +// +// Recommended setting: 1 (there is no advantage in using the generic one) +#define wxUSE_NATIVE_STATUSBAR 1 + +// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar +// classes at all. Otherwise, use the native toolbar class unless +// wxUSE_TOOLBAR_NATIVE is 0. +// +// Default is 1 for all settings. +// +// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. +#define wxUSE_TOOLBAR 1 +#define wxUSE_TOOLBAR_NATIVE 1 + +// wxNotebook is a control with several "tabs" located on one of its sides. It +// may be used to logically organise the data presented to the user instead of +// putting everything in one huge dialog. It replaces wxTabControl and related +// classes of wxWin 1.6x. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTEBOOK 1 + +// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_LISTBOOK 1 + +// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CHOICEBOOK 1 + +// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TREEBOOK 1 + +// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of +// tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLBOOK 1 + +// wxTaskBarIcon is a small notification icon shown in the system toolbar or +// dock. +// +// Default is 1. +// +// Recommended setting: 1 (but can be set to 0 if you don't need it) +#define wxUSE_TASKBARICON 1 + +// wxGrid class +// +// Default is 1, set to 0 to cut down compilation time and binaries size if you +// don't use it. +// +// Recommended setting: 1 +// +#define wxUSE_GRID 1 + +// wxMiniFrame class: a frame with narrow title bar +// +// Default is 1. +// +// Recommended setting: 1 (it doesn't cost almost anything) +#define wxUSE_MINIFRAME 1 + +// wxComboCtrl and related classes: combobox with custom popup window and +// not necessarily a listbox. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it +// is used by wxComboBox +#define wxUSE_COMBOCTRL 1 + +// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox +// items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0, except where it is +// needed as a base class for generic wxBitmapComboBox. +#define wxUSE_ODCOMBOBOX 1 + +// wxBitmapComboBox is a combobox that can have images in front of text items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 +#define wxUSE_BITMAPCOMBOBOX 1 + +// wxRearrangeCtrl is a wxCheckListBox with two buttons allowing to move items +// up and down in it. It is also used as part of wxRearrangeDialog. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 (currently used only by +// wxHeaderCtrl) +#define wxUSE_REARRANGECTRL 1 + +// wxAddRemoveCtrl is a composite control containing a control showing some +// items (e.g. wxListBox, wxListCtrl, wxTreeCtrl, wxDataViewCtrl, ...) and "+"/ +// "-" buttons allowing to add and remove items to/from the control. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 if you don't need it (not +// used by the library itself). +#define wxUSE_ADDREMOVECTRL 1 + +// ---------------------------------------------------------------------------- +// Miscellaneous GUI stuff +// ---------------------------------------------------------------------------- + +// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) +#define wxUSE_ACCEL 1 + +// Use the standard art provider. The icons returned by this provider are +// embedded into the library as XPMs so disabling it reduces the library size +// somewhat but this should only be done if you use your own custom art +// provider returning the icons or never use any icons not provided by the +// native art provider (which might not be implemented at all for some +// platforms) or by the Tango icons provider (if it's not itself disabled +// below). +// +// Default is 1. +// +// Recommended setting: 1 unless you use your own custom art provider. +#define wxUSE_ARTPROVIDER_STD 1 + +// Use art provider providing Tango icons: this art provider has higher quality +// icons than the default one. It uses SVG format which allows much better scaling +// then when bitmaps are used, at the expense of somewhat larger library size. +// +// Default is 1 under non-GTK ports. Under wxGTK the native art provider using +// the GTK+ stock icons replaces it so it is normally not necessary. +// +// Recommended setting: 1 but can be turned off to reduce the library size. +#define wxUSE_ARTPROVIDER_TANGO 1 + +// Hotkey support (currently Windows and macOS only) +#define wxUSE_HOTKEY 1 + +// Use wxCaret: a class implementing a "cursor" in a text control (called caret +// under Windows). +// +// Default is 1. +// +// Recommended setting: 1 (can be safely set to 0, not used by the library) +#define wxUSE_CARET 1 + +// Use wxDisplay class: it allows enumerating all displays on a system and +// their geometries as well as finding the display on which the given point or +// window lies. +// +// Default is 1. +// +// Recommended setting: 1 if you need it, can be safely set to 0 otherwise +#define wxUSE_DISPLAY 1 + +// Miscellaneous geometry code: needed for Canvas library +#define wxUSE_GEOMETRY 1 + +// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and +// wxListCtrl. +// +// Default is 1. +// +// Recommended setting: 1 (set it to 0 if you don't use any of the controls +// enumerated above, then this class is mostly useless too) +#define wxUSE_IMAGLIST 1 + +// Use wxInfoBar class. +// +// Default is 1. +// +// Recommended setting: 1 (but can be disabled without problems as nothing +// depends on it) +#define wxUSE_INFOBAR 1 + +// Use wxMenu, wxMenuItem. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUS 1 + +// Use wxMenuBar. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUBAR 1 + +// Use wxNotificationMessage. +// +// wxNotificationMessage allows to show non-intrusive messages to the user +// using balloons, banners, popups or whatever is the appropriate method for +// the current platform. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTIFICATION_MESSAGE 1 + +// wxPreferencesEditor provides a common API for different ways of presenting +// the standard "Preferences" or "Properties" dialog under different platforms +// (e.g. some use modal dialogs, some use modeless ones; some apply the changes +// immediately while others require an explicit "Apply" button). +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_PREFERENCES_EDITOR 1 + +// wxFont::AddPrivateFont() allows to use fonts not installed on the system by +// loading them from font files during run-time. +// +// Default is 1 except under Unix where it will be turned off by configure if +// the required libraries are not available or not new enough. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it and +// want to avoid extra dependencies under Linux, for example). +#define wxUSE_PRIVATE_FONTS 1 + +// wxRichToolTip is a customizable tooltip class which has more functionality +// than the stock (but native, unlike this class) wxToolTip. +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely set to 0 if you don't need it) +#define wxUSE_RICHTOOLTIP 1 + +// Use wxSashWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SASH 1 + +// Use wxSplitterWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SPLITTER 1 + +// Use wxToolTip and wxWindow::Set/GetToolTip() methods. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLTIPS 1 + +// wxValidator class and related methods +#define wxUSE_VALIDATORS 1 + +// Use reference counted ID management: this means that wxWidgets will track +// the automatically allocated ids (those used when you use wxID_ANY when +// creating a window, menu or toolbar item &c) instead of just supposing that +// the program never runs out of them. This is mostly useful only under wxMSW +// where the total ids range is limited to SHRT_MIN..SHRT_MAX and where +// long-running programs can run into problems with ids reuse without this. On +// the other platforms, where the ids have the full int range, this shouldn't +// be necessary. +#ifdef __WXMSW__ +#define wxUSE_AUTOID_MANAGEMENT 1 +#else +#define wxUSE_AUTOID_MANAGEMENT 0 +#endif + +// ---------------------------------------------------------------------------- +// common dialogs +// ---------------------------------------------------------------------------- + +// Use common dialogs (e.g. file selector, printer dialog). Switching this off +// also switches off the printing architecture and interactive wxPrinterDC. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COMMON_DIALOGS 1 + +// wxBusyInfo displays window with message when app is busy. Works in same way +// as wxBusyCursor +#define wxUSE_BUSYINFO 1 + +// Use single/multiple choice dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_CHOICEDLG 1 + +// Use colour picker dialog +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COLOURDLG 1 + +// wxDirDlg class for getting a directory name from user +#define wxUSE_DIRDLG 1 + +// Use file open/save dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in many places in the library itself) +#define wxUSE_FILEDLG 1 + +// Use find/replace dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely set to 0) +#define wxUSE_FINDREPLDLG 1 + +// Use font picker dialog +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_FONTDLG 1 + +// Use wxMessageDialog and wxMessageBox. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_MSGDLG 1 + +// progress dialog class for lengthy operations +#define wxUSE_PROGRESSDLG 1 + +// Set to 0 to disable the use of the native progress dialog (currently only +// available under MSW and suffering from some bugs there, hence this option). +#define wxUSE_NATIVE_PROGRESSDLG 1 + +// support for startup tips (wxShowTip &c) +#define wxUSE_STARTUP_TIPS 1 + +// text entry dialog and wxGetTextFromUser function +#define wxUSE_TEXTDLG 1 + +// number entry dialog +#define wxUSE_NUMBERDLG 1 + +// credential entry dialog +#define wxUSE_CREDENTIALDLG 1 + +// splash screen class +#define wxUSE_SPLASH 1 + +// wizards +#define wxUSE_WIZARDDLG 1 + +// Compile in wxAboutBox() function showing the standard "About" dialog. +// +// Default is 1 +// +// Recommended setting: 1 but can be set to 0 to save some space if you don't +// use this function +#define wxUSE_ABOUTDLG 1 + +// wxFileHistory class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_FILE_HISTORY 1 + +// ---------------------------------------------------------------------------- +// Metafiles support +// ---------------------------------------------------------------------------- + +// Windows supports the graphics format known as metafile which, though not +// portable, is widely used under Windows and so is supported by wxWidgets +// (under Windows only, of course). Both the so-called "Window MetaFiles" or +// WMFs, and "Enhanced MetaFiles" or EMFs are supported in wxWin and, by +// default, EMFs will be used. This may be changed by setting +// wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting wxUSE_ENH_METAFILE to 0. +// You may also set wxUSE_METAFILE to 0 to not compile in any metafile +// related classes at all. +// +// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. +// +// Recommended setting: default or 0 for everything for portable programs. +#define wxUSE_METAFILE 1 +#define wxUSE_ENH_METAFILE 1 +#define wxUSE_WIN_METAFILES_ALWAYS 0 + +// ---------------------------------------------------------------------------- +// Big GUI components +// ---------------------------------------------------------------------------- + +// Set to 0 to disable MDI support. +// +// Requires wxUSE_NOTEBOOK under platforms other than MSW. +// +// Default is 1. +// +// Recommended setting: 1, can be safely set to 0. +#define wxUSE_MDI 1 + +// Set to 0 to disable document/view architecture +#define wxUSE_DOC_VIEW_ARCHITECTURE 1 + +// Set to 0 to disable MDI document/view architecture +// +// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE +#define wxUSE_MDI_ARCHITECTURE 1 + +// Set to 0 to disable print/preview architecture code +#define wxUSE_PRINTING_ARCHITECTURE 1 + +// wxHTML allows displaying simple HTML. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_HTML 1 + +// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL +// headers and libraries to be able to compile the library with wxUSE_GLCANVAS +// set to 1 and, under Windows, also to add opengl32.lib and glu32.lib to the +// list of libraries used to link your application when linking to wxWidgets +// statically (although this is done implicitly for Microsoft Visual C++ users). +// +// Default is 1. +// +// Recommended setting: 1 if you intend to use OpenGL, can be safely set to 0 +// otherwise. +#define wxUSE_GLCANVAS 1 + +// Setting wxUSE_GLCANVAS_EGL to 1 enables OpenGL EGL backend. This will be +// automatically enabled if EGL support is detected. EGL support is only +// available under Unix platforms. +// +// Default is 0. +// +#define wxUSE_GLCANVAS_EGL 0 + +// wxRichTextCtrl allows editing of styled text. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 if you want compile a +// smaller library. +#define wxUSE_RICHTEXT 1 + +// ---------------------------------------------------------------------------- +// Data transfer +// ---------------------------------------------------------------------------- + +// Use wxClipboard class for clipboard copy/paste. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CLIPBOARD 1 + +// Use wxDataObject and related classes. Needed for clipboard and OLE drag and +// drop +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DATAOBJ 1 + +// Use wxDropTarget and wxDropSource classes for drag and drop (this is +// different from "built in" drag and drop in wxTreeCtrl which is always +// available). Requires wxUSE_DATAOBJ. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DRAG_AND_DROP 1 + +// Use wxAccessible for enhanced and customisable accessibility. +// Depends on wxUSE_OLE on MSW. +// +// Default is 1 on MSW, 0 elsewhere. +// +// Recommended setting (at present): 1 (MSW-only) +#ifdef __WXMSW__ +#define wxUSE_ACCESSIBILITY 1 +#else +#define wxUSE_ACCESSIBILITY 0 +#endif + +// ---------------------------------------------------------------------------- +// miscellaneous settings +// ---------------------------------------------------------------------------- + +// wxSingleInstanceChecker class allows to verify at startup if another program +// instance is running. +// +// Default is 1 +// +// Recommended setting: 1 (the class is tiny, disabling it won't save much +// space) +#define wxUSE_SNGLINST_CHECKER 1 + +#define wxUSE_DRAGIMAGE 1 + +#define wxUSE_IPC 1 + // 0 for no interprocess comms +#define wxUSE_HELP 1 + // 0 for no help facility + +// Should we use MS HTML help for wxHelpController? If disabled, neither +// wxCHMHelpController nor wxBestHelpController are available. +// +// Default is 1 under MSW, 0 is always used for the other platforms. +// +// Recommended setting: 1, only set to 0 if you have trouble compiling +// wxCHMHelpController (could be a problem with really ancient compilers) +#define wxUSE_MS_HTML_HELP 1 + + +// Use wxHTML-based help controller? +#define wxUSE_WXHTML_HELP 1 + +#define wxUSE_CONSTRAINTS 1 + // 0 for no window layout constraint system + +#define wxUSE_SPLINES 1 + // 0 for no splines + +#define wxUSE_MOUSEWHEEL 1 + // Include mouse wheel support + +// Compile wxUIActionSimulator class? +#define wxUSE_UIACTIONSIMULATOR 1 + +// ---------------------------------------------------------------------------- +// wxDC classes for various output formats +// ---------------------------------------------------------------------------- + +// Set to 1 for PostScript device context. +#define wxUSE_POSTSCRIPT 0 + +// Set to 1 to use font metric files in GetTextExtent +#define wxUSE_AFM_FOR_POSTSCRIPT 1 + +// Set to 1 to compile in support for wxSVGFileDC, a wxDC subclass which allows +// to create files in SVG (Scalable Vector Graphics) format. +#define wxUSE_SVG 1 + +// Should wxDC provide SetTransformMatrix() and related methods? +// +// Default is 1 but can be set to 0 if this functionality is not used. Notice +// that currently wxMSW, wxGTK3 support this for wxDC and all platforms support +// this for wxGCDC so setting this to 0 doesn't change much if neither of these +// is used (although it will still save a few bytes probably). +// +// Recommended setting: 1. +#define wxUSE_DC_TRANSFORM_MATRIX 1 + +// ---------------------------------------------------------------------------- +// image format support +// ---------------------------------------------------------------------------- + +// wxImage supports many different image formats which can be configured at +// compile-time. BMP is always supported, others are optional and can be safely +// disabled if you don't plan to use images in such format sometimes saving +// substantial amount of code in the final library. +// +// Some formats require an extra library (e.g. libpng) which is always included in +// wxWidgets sources but some build systems (cmake, configure) can be configured to +// to use the system or user-provided version. +// +// Set to 1 for wxImage support (recommended). +#define wxUSE_IMAGE 1 + +// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. +#define wxUSE_LIBPNG 1 + +// Set to 1 for JPEG format support (requires libjpeg) +#define wxUSE_LIBJPEG 1 + +// Set to 1 for TIFF format support (requires libtiff) +#define wxUSE_LIBTIFF 1 + +// Set to 1 for SVG rasterizing support using nanosvg +#define wxUSE_NANOSVG 1 + +// Set to 1 to use external nanosvg library when wxUSE_NANOSVG is enabled +#define wxUSE_NANOSVG_EXTERNAL 0 + +// Set to 1 for TGA format support (loading only) +#define wxUSE_TGA 1 + +// Set to 1 for GIF format support +#define wxUSE_GIF 1 + +// Set to 1 for PNM format support +#define wxUSE_PNM 1 + +// Set to 1 for PCX format support +#define wxUSE_PCX 1 + +// Set to 1 for IFF format support (Amiga format) +#define wxUSE_IFF 0 + +// Set to 1 for XPM format support +#define wxUSE_XPM 1 + +// Set to 1 for MS Icons and Cursors format support +#define wxUSE_ICO_CUR 1 + +// Set to 1 to compile in wxPalette class +#define wxUSE_PALETTE 1 + +// ---------------------------------------------------------------------------- +// wxUniversal-only options +// ---------------------------------------------------------------------------- + +// Set to 1 to enable compilation of all themes, this is the default +#define wxUSE_ALL_THEMES 1 + +// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES +// is unset, if it is set these options are not used; notice that metal theme +// uses Win32 one +#define wxUSE_THEME_GTK 0 +#define wxUSE_THEME_METAL 0 +#define wxUSE_THEME_MONO 0 +#define wxUSE_THEME_WIN32 0 + +/* --- end common options --- */ + +/* --- start OSX options --- */ +// ---------------------------------------------------------------------------- +// Unix-specific options settings +// ---------------------------------------------------------------------------- + +// use wxSelectDispatcher class +#define wxUSE_SELECT_DISPATCHER 1 + +// use wxEpollDispatcher class (Linux only) +#define wxUSE_EPOLL_DISPATCHER 0 + +/* + Use GStreamer for Unix. + + Default is 0 as this requires a lot of dependencies which might not be + available. + + Recommended setting: 1 (wxMediaCtrl won't work by default without it). + */ +#define wxUSE_GSTREAMER 0 + +// This is only used under Unix, but needs to be defined here as it's checked +// by wx/unix/chkconf.h. +#define wxUSE_XTEST 0 + +// ---------------------------------------------------------------------------- +// Mac-specific settings +// ---------------------------------------------------------------------------- + +#undef wxUSE_GRAPHICS_CONTEXT +#define wxUSE_GRAPHICS_CONTEXT 1 + + +// things not implemented under Mac + +#undef wxUSE_STACKWALKER +#define wxUSE_STACKWALKER 0 + +// wxWebKit is a wrapper for Apple's WebKit framework, use it if you want to +// embed the Safari browser control +// 0 by default because of Jaguar compatibility problems +#define wxUSE_WEBKIT 1 + + +// Set to 0 for no libmspack +#define wxUSE_LIBMSPACK 0 + +// native toolbar does support embedding controls, but not complex panels, please test +#define wxOSX_USE_NATIVE_TOOLBAR 1 + +// make sure we have the proper dispatcher for the console event loop +#define wxUSE_SELECT_DISPATCHER 1 +#define wxUSE_EPOLL_DISPATCHER 0 + +// set to 1 if you have older code that still needs icon refs +#define wxOSX_USE_ICONREF 0 + +// set to 0 if you have code that has problems with the new bitmap implementation +#define wxOSX_BITMAP_NATIVE_ACCESS 1 + +/* --- end OSX options --- */ + +#endif + // _WX_SETUP_H_ diff --git a/lib/wxWidgets/include/wx/osx/setup_inc.h b/lib/wxWidgets/include/wx/osx/setup_inc.h new file mode 100644 index 0000000..f1ad88d --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/setup_inc.h @@ -0,0 +1,69 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/setup_inc.h +// Purpose: OSX-specific setup.h options +// Author: Stefan Csomor +// Modified by: Stefan Csomor +// Created: 2017-11-09 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ---------------------------------------------------------------------------- +// Unix-specific options settings +// ---------------------------------------------------------------------------- + +// use wxSelectDispatcher class +#define wxUSE_SELECT_DISPATCHER 1 + +// use wxEpollDispatcher class (Linux only) +#define wxUSE_EPOLL_DISPATCHER 0 + +/* + Use GStreamer for Unix. + + Default is 0 as this requires a lot of dependencies which might not be + available. + + Recommended setting: 1 (wxMediaCtrl won't work by default without it). + */ +#define wxUSE_GSTREAMER 0 + +// This is only used under Unix, but needs to be defined here as it's checked +// by wx/unix/chkconf.h. +#define wxUSE_XTEST 0 + +// ---------------------------------------------------------------------------- +// Mac-specific settings +// ---------------------------------------------------------------------------- + +#undef wxUSE_GRAPHICS_CONTEXT +#define wxUSE_GRAPHICS_CONTEXT 1 + + +// things not implemented under Mac + +#undef wxUSE_STACKWALKER +#define wxUSE_STACKWALKER 0 + +// wxWebKit is a wrapper for Apple's WebKit framework, use it if you want to +// embed the Safari browser control +// 0 by default because of Jaguar compatibility problems +#define wxUSE_WEBKIT 1 + + +// Set to 0 for no libmspack +#define wxUSE_LIBMSPACK 0 + +// native toolbar does support embedding controls, but not complex panels, please test +#define wxOSX_USE_NATIVE_TOOLBAR 1 + +// make sure we have the proper dispatcher for the console event loop +#define wxUSE_SELECT_DISPATCHER 1 +#define wxUSE_EPOLL_DISPATCHER 0 + +// set to 1 if you have older code that still needs icon refs +#define wxOSX_USE_ICONREF 0 + +// set to 0 if you have code that has problems with the new bitmap implementation +#define wxOSX_BITMAP_NATIVE_ACCESS 1 + diff --git a/lib/wxWidgets/include/wx/osx/slider.h b/lib/wxWidgets/include/wx/osx/slider.h new file mode 100644 index 0000000..70915e4 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/slider.h @@ -0,0 +1,116 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/slider.h +// Purpose: wxSlider class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SLIDER_H_ +#define _WX_SLIDER_H_ + +#include "wx/compositewin.h" +#include "wx/stattext.h" + +// Slider +class WXDLLIMPEXP_CORE wxSlider: public wxCompositeWindow<wxSliderBase> +{ + wxDECLARE_DYNAMIC_CLASS(wxSlider); + +public: + wxSlider(); + + wxSlider(wxWindow *parent, wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxSliderNameStr)) + { + Create(parent, id, value, minValue, maxValue, pos, size, style, validator, name); + } + + virtual ~wxSlider(); + + bool Create(wxWindow *parent, wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxSliderNameStr)); + + virtual int GetValue() const wxOVERRIDE; + virtual void SetValue(int) wxOVERRIDE; + + void SetRange(int minValue, int maxValue) wxOVERRIDE; + + int GetMin() const wxOVERRIDE { return m_rangeMin; } + int GetMax() const wxOVERRIDE { return m_rangeMax; } + + void SetMin(int minValue) { SetRange(minValue, m_rangeMax); } + void SetMax(int maxValue) { SetRange(m_rangeMin, maxValue); } + + // For trackbars only + int GetTickFreq() const wxOVERRIDE { return m_tickFreq; } + void SetPageSize(int pageSize) wxOVERRIDE; + int GetPageSize() const wxOVERRIDE; + void ClearSel() wxOVERRIDE; + void ClearTicks() wxOVERRIDE; + void SetLineSize(int lineSize) wxOVERRIDE; + int GetLineSize() const wxOVERRIDE; + int GetSelEnd() const wxOVERRIDE; + int GetSelStart() const wxOVERRIDE; + void SetSelection(int minPos, int maxPos) wxOVERRIDE; + void SetThumbLength(int len) wxOVERRIDE; + int GetThumbLength() const wxOVERRIDE; + void SetTick(int tickPos) wxOVERRIDE; + + void Command(wxCommandEvent& event) wxOVERRIDE; + // osx specific event handling common for all osx-ports + + virtual bool OSXHandleClicked( double timestampsec ) wxOVERRIDE; + virtual void TriggerScrollEvent( wxEventType scrollEvent ) wxOVERRIDE; + +protected: + // Platform-specific implementation of SetTickFreq + virtual void DoSetTickFreq(int freq) wxOVERRIDE; + + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual void DoSetSize(int x, int y, int w, int h, int sizeFlags) wxOVERRIDE; + + // set min/max size of the slider + virtual void DoSetSizeHints( int minW, int minH, + int maxW, int maxH, + int incW, int incH) wxOVERRIDE; + + // Common processing to invert slider values based on wxSL_INVERSE + virtual int ValueInvertOrNot(int value) const wxOVERRIDE; + + wxStaticText* m_macMinimumStatic ; + wxStaticText* m_macMaximumStatic ; + wxStaticText* m_macValueStatic ; + + int m_rangeMin; + int m_rangeMax; + int m_pageSize; + int m_lineSize; + int m_tickFreq; +private : + virtual wxWindowList GetCompositeWindowParts() const wxOVERRIDE + { + wxWindowList parts; + parts.push_back(m_macMinimumStatic); + parts.push_back(m_macMaximumStatic); + parts.push_back(m_macValueStatic); + return parts; + } + + wxDECLARE_EVENT_TABLE(); +}; + +#endif + // _WX_SLIDER_H_ diff --git a/lib/wxWidgets/include/wx/osx/sound.h b/lib/wxWidgets/include/wx/osx/sound.h new file mode 100644 index 0000000..e9b9c27 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/sound.h @@ -0,0 +1,79 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/sound.h +// Purpose: wxSound class (loads and plays short Windows .wav files). +// Optional on non-Windows platforms. +// Author: Ryan Norton, Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Ryan Norton, Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SOUND_H_ +#define _WX_SOUND_H_ + +#if wxUSE_SOUND + +#include "wx/object.h" + +class WXDLLIMPEXP_FWD_CORE wxSoundTimer; + +class WXDLLIMPEXP_CORE wxSoundData +{ +public : + wxSoundData(); + virtual ~wxSoundData(); + + virtual bool Play(unsigned int flags) = 0; + // stops the sound and deletes the optional timer + virtual void Stop(); + // mark this to be deleted + virtual void MarkForDeletion(); + virtual bool IsMarkedForDeletion() const { return m_markedForDeletion; } + + // does the true work of stopping and cleaning up + virtual void DoStop() = 0; + +protected: + unsigned int m_flags; + bool m_markedForDeletion; +} ; + +class WXDLLIMPEXP_CORE wxSound : public wxSoundBase +{ +public: + wxSound(); + wxSound(const wxString& fileName, bool isResource = false); + wxSound(size_t size, const void* data); + virtual ~wxSound(); + + // Create from resource or file + bool Create(const wxString& fileName, bool isResource = false); + // Create from data + bool Create(size_t size, const void* data); + + bool IsOk() const { return m_data != NULL; } + + // Stop playing any sound + static void Stop(); + + // Returns true if a sound is being played + static bool IsPlaying(); + + // Notification when a sound has stopped + static void SoundStopped(const wxSoundData* data); + +protected: + bool DoPlay(unsigned flags) const wxOVERRIDE; + void Init(); + +private: + // data of this object + class wxSoundData *m_data; + + wxDECLARE_NO_COPY_CLASS(wxSound); +}; + +#endif +#endif + // _WX_SOUND_H_ diff --git a/lib/wxWidgets/include/wx/osx/spinbutt.h b/lib/wxWidgets/include/wx/osx/spinbutt.h new file mode 100644 index 0000000..645f52f --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/spinbutt.h @@ -0,0 +1,78 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/spinbutt.h +// Purpose: wxSpinButton class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SPINBUTT_H_ +#define _WX_SPINBUTT_H_ + +#include "wx/control.h" +#include "wx/event.h" + +/* + The wxSpinButton is like a small scrollbar than is often placed next + to a text control. + + wxSP_HORIZONTAL: horizontal spin button + wxSP_VERTICAL: vertical spin button (the default) + wxSP_ARROW_KEYS: arrow keys increment/decrement value + wxSP_WRAP: value wraps at either end + */ + +class WXDLLIMPEXP_CORE wxSpinButton : public wxSpinButtonBase +{ +public: + // construction + wxSpinButton(); + + wxSpinButton(wxWindow *parent, + wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_VERTICAL | wxSP_ARROW_KEYS, + const wxString& name = wxT("wxSpinButton")) + { + Create(parent, id, pos, size, style, name); + } + + virtual ~wxSpinButton(); + + bool Create(wxWindow *parent, + wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_VERTICAL | wxSP_ARROW_KEYS, + const wxString& name = wxT("wxSpinButton")); + + + // accessors + virtual void SetRange(int minVal, int maxVal) wxOVERRIDE; + virtual int GetValue() const wxOVERRIDE; + virtual void SetValue(int val) wxOVERRIDE; + virtual void SetIncrement(int value) wxOVERRIDE; + virtual int GetIncrement() const wxOVERRIDE; + + // implementation + + virtual void TriggerScrollEvent( wxEventType scrollEvent ) wxOVERRIDE; + + // osx specific event handling common for all osx-ports + + virtual bool OSXHandleClicked( double timestampsec ) wxOVERRIDE; + +protected: + void SendThumbTrackEvent() ; + + virtual wxSize DoGetBestSize() const wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxSpinButton); +}; + +#endif + // _WX_SPINBUTT_H_ diff --git a/lib/wxWidgets/include/wx/osx/srchctrl.h b/lib/wxWidgets/include/wx/osx/srchctrl.h new file mode 100644 index 0000000..62cea42 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/srchctrl.h @@ -0,0 +1,90 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/srchctrl.h +// Purpose: mac carbon wxSearchCtrl class +// Author: Vince Harron +// Created: 2006-02-19 +// Copyright: Vince Harron +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SEARCHCTRL_H_ +#define _WX_SEARCHCTRL_H_ + +#if wxUSE_SEARCHCTRL + +class wxSearchWidgetImpl; + +class WXDLLIMPEXP_CORE wxSearchCtrl : public wxSearchCtrlBase +{ +public: + // creation + // -------- + + wxSearchCtrl(); + wxSearchCtrl(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxSearchCtrlNameStr)); + + virtual ~wxSearchCtrl(); + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxSearchCtrlNameStr)); + +#if wxUSE_MENUS + // get/set search button menu + // -------------------------- + virtual void SetMenu( wxMenu* menu ) wxOVERRIDE; + virtual wxMenu* GetMenu() wxOVERRIDE; +#endif // wxUSE_MENUS + + // get/set search options + // ---------------------- + virtual void ShowSearchButton( bool show ) wxOVERRIDE; + virtual bool IsSearchButtonVisible() const wxOVERRIDE; + + virtual void ShowCancelButton( bool show ) wxOVERRIDE; + virtual bool IsCancelButtonVisible() const wxOVERRIDE; + + virtual void SetDescriptiveText(const wxString& text) wxOVERRIDE; + virtual wxString GetDescriptiveText() const wxOVERRIDE; + + virtual bool HandleSearchFieldSearchHit() ; + virtual bool HandleSearchFieldCancelHit() ; + + wxSearchWidgetImpl * GetSearchPeer() const; + +#if wxUSE_MENUS + virtual void OSXAfterMenuEvent() wxOVERRIDE; +#endif // wxUSE_MENUS + +protected: + + wxSize DoGetBestSize() const wxOVERRIDE; + + void Init(); + +#if wxUSE_MENUS + wxMenu *m_menu; +#endif // wxUSE_MENUS + + wxString m_descriptiveText; + +private: + wxDECLARE_DYNAMIC_CLASS(wxSearchCtrl); + + wxDECLARE_EVENT_TABLE(); +}; + +#endif // wxUSE_SEARCHCTRL + +#endif // _WX_SEARCHCTRL_H_ + diff --git a/lib/wxWidgets/include/wx/osx/statbmp.h b/lib/wxWidgets/include/wx/osx/statbmp.h new file mode 100644 index 0000000..a89c4cd --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/statbmp.h @@ -0,0 +1,43 @@ +#ifndef _WX_STATBMP_H_ +#define _WX_STATBMP_H_ + +#include "wx/statbmp.h" + +class WXDLLIMPEXP_CORE wxStaticBitmap : public wxStaticBitmapBase +{ +public: + wxStaticBitmap() {} + wxStaticBitmap(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBitmapNameStr)) + { + Create(parent, id, bitmap, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBitmapNameStr)); + + virtual void SetBitmap(const wxBitmapBundle& bitmap) wxOVERRIDE; + + virtual void SetScaleMode(ScaleMode scaleMode) wxOVERRIDE; + + virtual ScaleMode GetScaleMode() const wxOVERRIDE { return m_scaleMode; } + +private: + void OnPaint(wxPaintEvent& event); + + ScaleMode m_scaleMode; + + wxDECLARE_DYNAMIC_CLASS(wxStaticBitmap); +}; + +#endif diff --git a/lib/wxWidgets/include/wx/osx/statbox.h b/lib/wxWidgets/include/wx/osx/statbox.h new file mode 100644 index 0000000..6c0422b --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/statbox.h @@ -0,0 +1,49 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/statbox.h +// Purpose: wxStaticBox class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATBOX_H_ +#define _WX_STATBOX_H_ + +class WXDLLIMPEXP_CORE wxStaticBox : public wxStaticBoxBase +{ + wxDECLARE_DYNAMIC_CLASS(wxStaticBox); + +public: + wxStaticBox() {} + wxStaticBox(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBoxNameStr)) + { + Create(parent, id, label, pos, size, style, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBoxNameStr)); + + virtual void Command(wxCommandEvent& WXUNUSED(event)) wxOVERRIDE {} + virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {} + + virtual void GetBordersForSizer(int *borderTop, int *borderOther) const wxOVERRIDE; + + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } + + // protect native font of box + virtual bool SetFont( const wxFont &font ) wxOVERRIDE; +}; + +#endif + // _WX_STATBOX_H_ diff --git a/lib/wxWidgets/include/wx/osx/statline.h b/lib/wxWidgets/include/wx/osx/statline.h new file mode 100644 index 0000000..6401a77 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/statline.h @@ -0,0 +1,56 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/statline.h +// Purpose: a generic wxStaticLine class used for mac before adaptation +// Author: Vadim Zeitlin +// Created: 28.06.99 +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_STATLINE_H_ +#define _WX_GENERIC_STATLINE_H_ + +class wxStaticBox; + +// ---------------------------------------------------------------------------- +// wxStaticLine +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxStaticLine : public wxStaticLineBase +{ +public: + // constructors and pseudo-constructors + wxStaticLine() : m_statbox(NULL) { } + + wxStaticLine( wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxASCII_STR(wxStaticLineNameStr) ) + : m_statbox(NULL) + { + Create(parent, id, pos, size, style, name); + } + + bool Create( wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxASCII_STR(wxStaticLineNameStr) ); + + // it's necessary to override this wxWindow function because we + // will want to return the main widget for m_statbox + // + WXWidget GetMainWidget() const; + +protected: + // we implement the static line using a static box + wxStaticBox *m_statbox; + + wxDECLARE_DYNAMIC_CLASS(wxStaticLine); +}; + +#endif // _WX_GENERIC_STATLINE_H_ + diff --git a/lib/wxWidgets/include/wx/osx/stattext.h b/lib/wxWidgets/include/wx/osx/stattext.h new file mode 100644 index 0000000..89146a1 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/stattext.h @@ -0,0 +1,57 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/stattext.h +// Purpose: wxStaticText class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATTEXT_H_ +#define _WX_STATTEXT_H_ + +class WXDLLIMPEXP_CORE wxStaticText: public wxStaticTextBase +{ +public: + wxStaticText() { } + + wxStaticText(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticTextNameStr)) + { + Create(parent, id, label, pos, size, style, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticTextNameStr)); + + // accessors + void SetLabel( const wxString &str ) wxOVERRIDE; + bool SetFont( const wxFont &font ) wxOVERRIDE; + + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } + +protected : + + virtual wxString WXGetVisibleLabel() const wxOVERRIDE; + virtual void WXSetVisibleLabel(const wxString& str) wxOVERRIDE; + + virtual wxSize DoGetBestSize() const wxOVERRIDE; + +#if wxUSE_MARKUP && wxOSX_USE_COCOA + virtual bool DoSetLabelMarkup(const wxString& markup) wxOVERRIDE; +#endif // wxUSE_MARKUP && wxOSX_USE_COCOA + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticText); +}; + +#endif + // _WX_STATTEXT_H_ diff --git a/lib/wxWidgets/include/wx/osx/statusbr.h b/lib/wxWidgets/include/wx/osx/statusbr.h new file mode 100644 index 0000000..d80d5a9 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/statusbr.h @@ -0,0 +1,45 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/statusbr.h +// Purpose: native implementation of wxStatusBar. +// Optional: can use generic version instead. +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATBAR_H_ +#define _WX_STATBAR_H_ + +class WXDLLIMPEXP_CORE wxStatusBarMac : public wxStatusBarGeneric +{ +public: + wxStatusBarMac(); + wxStatusBarMac(wxWindow *parent, wxWindowID id = wxID_ANY, + long style = wxSTB_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxStatusBarNameStr)); + + virtual ~wxStatusBarMac(); + + bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, + long style = wxSTB_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxStatusBarNameStr)); + + // Implementation + virtual void MacHiliteChanged() wxOVERRIDE; + void OnPaint(wxPaintEvent& event); + +protected: + virtual int GetEffectiveFieldStyle(int WXUNUSED(i)) const wxOVERRIDE { return wxSB_NORMAL; } + + virtual void InitColours() wxOVERRIDE; + +private: + wxColour m_textActive, m_textInactive; + + wxDECLARE_DYNAMIC_CLASS(wxStatusBarMac); + wxDECLARE_EVENT_TABLE(); +}; + +#endif // _WX_STATBAR_H_ diff --git a/lib/wxWidgets/include/wx/osx/taskbarosx.h b/lib/wxWidgets/include/wx/osx/taskbarosx.h new file mode 100644 index 0000000..5062a7c --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/taskbarosx.h @@ -0,0 +1,43 @@ +///////////////////////////////////////////////////////////////////////// +// File: wx/mac/taskbarosx.h +// Purpose: Defines wxTaskBarIcon class for OSX +// Author: Ryan Norton +// Modified by: +// Created: 04/04/2003 +// Copyright: (c) Ryan Norton, 2003 +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////// + +#ifndef _TASKBAR_H_ +#define _TASKBAR_H_ + +class WXDLLIMPEXP_FWD_CORE wxIcon; +class WXDLLIMPEXP_FWD_CORE wxMenu; + +class WXDLLIMPEXP_ADV wxTaskBarIcon : public wxTaskBarIconBase +{ + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTaskBarIcon); +public: + wxTaskBarIcon(wxTaskBarIconType iconType = wxTBI_DEFAULT_TYPE); + virtual ~wxTaskBarIcon(); + + // returns true if the taskbaricon is in the global menubar +#if wxOSX_USE_COCOA + bool OSXIsStatusItem(); +#else + bool OSXIsStatusItem() { return false; } +#endif + bool IsOk() const { return true; } + + bool IsIconInstalled() const; + bool SetIcon(const wxBitmapBundle& icon, const wxString& tooltip = wxEmptyString); + bool RemoveIcon(); + bool PopupMenu(wxMenu *menu); + +protected: + wxTaskBarIconType m_type; + class wxTaskBarIconImpl* m_impl; + friend class wxTaskBarIconImpl; +}; +#endif + // _TASKBAR_H_ diff --git a/lib/wxWidgets/include/wx/osx/textctrl.h b/lib/wxWidgets/include/wx/osx/textctrl.h new file mode 100644 index 0000000..bde361a --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/textctrl.h @@ -0,0 +1,173 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/textctrl.h +// Purpose: wxTextCtrl class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TEXTCTRL_H_ +#define _WX_TEXTCTRL_H_ + +#if wxUSE_SYSTEM_OPTIONS + // set this to 'true' if you want to use the 'classic' MLTE-based implementation + // instead of the HIView-based implementation in 10.3 and upwards, the former + // has more features (backgrounds etc.), but may show redraw artefacts and other + // problems depending on your usage; hence, the default is 'false'. + #define wxMAC_TEXTCONTROL_USE_MLTE wxT("mac.textcontrol-use-mlte") + // set this to 'true' if you want editable text controls to have spell checking turned + // on by default, you can change this setting individually on a control using MacCheckSpelling + #define wxMAC_TEXTCONTROL_USE_SPELL_CHECKER wxT("mac.textcontrol-use-spell-checker") +#endif + +#include "wx/control.h" +#include "wx/textctrl.h" + +class WXDLLIMPEXP_CORE wxTextCtrl: public wxTextCtrlBase +{ + wxDECLARE_DYNAMIC_CLASS(wxTextCtrl); + +public: + wxTextCtrl() + { Init(); } + + wxTextCtrl(wxWindow *parent, + wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxTextCtrlNameStr)) + { + Init(); + Create(parent, id, value, pos, size, style, validator, name); + } + + virtual ~wxTextCtrl(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxTextCtrlNameStr)); + + // accessors + // --------- + + virtual int GetLineLength(long lineNo) const wxOVERRIDE; + virtual wxString GetLineText(long lineNo) const wxOVERRIDE; + virtual int GetNumberOfLines() const wxOVERRIDE; + + virtual bool IsModified() const wxOVERRIDE; + + // operations + // ---------- + + + // sets/clears the dirty flag + virtual void MarkDirty() wxOVERRIDE; + virtual void DiscardEdits() wxOVERRIDE; + + virtual void EmptyUndoBuffer() wxOVERRIDE; + + // text control under some platforms supports the text styles: these + // methods apply the given text style to the given selection or to + // set/get the style which will be used for all appended text + virtual bool SetFont( const wxFont &font ) wxOVERRIDE; + virtual bool GetStyle(long position, wxTextAttr& style) wxOVERRIDE; + virtual bool SetStyle(long start, long end, const wxTextAttr& style) wxOVERRIDE; + virtual bool SetDefaultStyle(const wxTextAttr& style) wxOVERRIDE; + + // translate between the position (which is just an index into the textctrl + // considering all its contents as a single strings) and (x, y) coordinates + // which represent column and line. + virtual long XYToPosition(long x, long y) const wxOVERRIDE; + virtual bool PositionToXY(long pos, long *x, long *y) const wxOVERRIDE; + + virtual void ShowPosition(long pos) wxOVERRIDE; + + // overrides so that we can send text updated events + virtual void Copy() wxOVERRIDE; + virtual void Cut() wxOVERRIDE; + virtual void Paste() wxOVERRIDE; + +#if wxUSE_SPELLCHECK + // Use native spelling and grammar checking functions (multiline only). + virtual bool EnableProofCheck(const wxTextProofOptions& options + = wxTextProofOptions::Default()) wxOVERRIDE; + virtual wxTextProofOptions GetProofCheckOptions() const wxOVERRIDE; +#endif // wxUSE_SPELLCHECK + + // Implementation + // -------------- + virtual void Command(wxCommandEvent& event) wxOVERRIDE; + + virtual void SetWindowStyleFlag(long style) wxOVERRIDE; + + // callbacks + void OnDropFiles(wxDropFilesEvent& event); + void OnChar(wxKeyEvent& event); // Process 'enter' if required + void OnKeyDown(wxKeyEvent& event); // Process clipboard shortcuts + + void OnCut(wxCommandEvent& event); + void OnCopy(wxCommandEvent& event); + void OnPaste(wxCommandEvent& event); + void OnUndo(wxCommandEvent& event); + void OnRedo(wxCommandEvent& event); + void OnDelete(wxCommandEvent& event); + void OnSelectAll(wxCommandEvent& event); + + void OnUpdateCut(wxUpdateUIEvent& event); + void OnUpdateCopy(wxUpdateUIEvent& event); + void OnUpdatePaste(wxUpdateUIEvent& event); + void OnUpdateUndo(wxUpdateUIEvent& event); + void OnUpdateRedo(wxUpdateUIEvent& event); + void OnUpdateDelete(wxUpdateUIEvent& event); + void OnUpdateSelectAll(wxUpdateUIEvent& event); + + void OnContextMenu(wxContextMenuEvent& event); + + virtual bool MacSetupCursor( const wxPoint& pt ) wxOVERRIDE; + + virtual void MacVisibilityChanged() wxOVERRIDE; + virtual void MacSuperChangedPosition() wxOVERRIDE; + + // Use portable EnableProofCheck() instead now. +#if WXWIN_COMPATIBILITY_3_0 && wxUSE_SPELLCHECK + wxDEPRECATED( virtual void MacCheckSpelling(bool check) ); +#endif // WXWIN_COMPATIBILITY_3_0 && wxUSE_SPELLCHECK + + void OSXEnableNewLineReplacement(bool enable); + void OSXEnableAutomaticQuoteSubstitution(bool enable); + void OSXEnableAutomaticDashSubstitution(bool enable); + void OSXDisableAllSmartSubstitutions(); + +protected: + // common part of all ctors + void Init(); + + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen) const wxOVERRIDE; + + // flag is set to true when the user edits the controls contents + bool m_dirty; + + virtual void EnableTextChangedEvents(bool WXUNUSED(enable)) wxOVERRIDE + { + // nothing to do here as the events are never generated when we change + // the controls value programmatically anyhow + } + +private : + wxMenu *m_privateContextMenu; + + wxDECLARE_EVENT_TABLE(); +}; + +#endif // _WX_TEXTCTRL_H_ diff --git a/lib/wxWidgets/include/wx/osx/textentry.h b/lib/wxWidgets/include/wx/osx/textentry.h new file mode 100644 index 0000000..4a563a2 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/textentry.h @@ -0,0 +1,115 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/textentry.h +// Purpose: wxTextEntry class +// Author: Stefan Csomor +// Modified by: Kevin Ollivier +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_TEXTENTRY_H_ +#define _WX_OSX_TEXTENTRY_H_ + +#if wxUSE_SYSTEM_OPTIONS + // set this to 'true' if you want to use the 'classic' MLTE-based implementation + // instead of the HIView-based implementation in 10.3 and upwards, the former + // has more features (backgrounds etc.), but may show redraw artefacts and other + // problems depending on your usage; hence, the default is 'false'. + #define wxMAC_TEXTCONTROL_USE_MLTE wxT("mac.textcontrol-use-mlte") + // set this to 'true' if you want editable text controls to have spell checking turned + // on by default, you can change this setting individually on a control using MacCheckSpelling + #define wxMAC_TEXTCONTROL_USE_SPELL_CHECKER wxT("mac.textcontrol-use-spell-checker") +#endif + +#include "wx/control.h" + +// forward decl for wxListWidgetImpl implementation type. +class WXDLLIMPEXP_FWD_CORE wxTextWidgetImpl; + +class WXDLLIMPEXP_CORE wxTextEntry: public wxTextEntryBase +{ + +public: + wxTextEntry(); + virtual ~wxTextEntry(); + + virtual bool IsEditable() const wxOVERRIDE; + + // If the return values from and to are the same, there is no selection. + virtual void GetSelection(long* from, long* to) const wxOVERRIDE; + + // operations + // ---------- + + // editing + virtual void Clear() wxOVERRIDE; + virtual void Remove(long from, long to) wxOVERRIDE; + + // set the max number of characters which may be entered + // in a single line text control + virtual void SetMaxLength(unsigned long len) wxOVERRIDE; + + virtual void ForceUpper() wxOVERRIDE; + + // writing text inserts it at the current position; + // appending always inserts it at the end + virtual void WriteText(const wxString& text) wxOVERRIDE; + + // Clipboard operations + virtual void Copy() wxOVERRIDE; + virtual void Cut() wxOVERRIDE; + virtual void Paste() wxOVERRIDE; + + virtual bool CanCopy() const wxOVERRIDE; + virtual bool CanCut() const wxOVERRIDE; + virtual bool CanPaste() const wxOVERRIDE; + + // Undo/redo + virtual void Undo() wxOVERRIDE; + virtual void Redo() wxOVERRIDE; + + virtual bool CanUndo() const wxOVERRIDE; + virtual bool CanRedo() const wxOVERRIDE; + + // Insertion point + virtual void SetInsertionPoint(long pos) wxOVERRIDE; + virtual void SetInsertionPointEnd() wxOVERRIDE; + virtual long GetInsertionPoint() const wxOVERRIDE; + virtual wxTextPos GetLastPosition() const wxOVERRIDE; + + virtual void SetSelection(long from, long to) wxOVERRIDE; + virtual void SetEditable(bool editable) wxOVERRIDE; + + virtual bool SendMaxLenEvent(); + + // set the grayed out hint text + virtual bool SetHint(const wxString& hint) wxOVERRIDE; + virtual wxString GetHint() const wxOVERRIDE; + + // Implementation + // -------------- + + virtual wxTextWidgetImpl * GetTextPeer() const; + wxTextCompleter *OSXGetCompleter() const { return m_completer; } + +protected: + + virtual wxString DoGetValue() const wxOVERRIDE; + + virtual bool DoAutoCompleteStrings(const wxArrayString& choices) wxOVERRIDE; + virtual bool DoAutoCompleteCustom(wxTextCompleter *completer) wxOVERRIDE; + + // The object providing auto-completions or NULL if none. + wxTextCompleter *m_completer; + + bool m_editable; + + // need to make this public because of the current implementation via callbacks + unsigned long m_maxLength; + +private: + wxString m_hintString; +}; + +#endif // _WX_OSX_TEXTENTRY_H_ diff --git a/lib/wxWidgets/include/wx/osx/tglbtn.h b/lib/wxWidgets/include/wx/osx/tglbtn.h new file mode 100644 index 0000000..cd856e7 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/tglbtn.h @@ -0,0 +1,85 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/tglbtn.h +// Purpose: Declaration of the wxToggleButton class, which implements a +// toggle button under wxMac. +// Author: Stefan Csomor +// Modified by: +// Created: 08.02.01 +// Copyright: (c) 2004 Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TOGGLEBUTTON_H_ +#define _WX_TOGGLEBUTTON_H_ + +class WXDLLIMPEXP_CORE wxToggleButton : public wxToggleButtonBase +{ +public: + wxToggleButton() {} + wxToggleButton(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)); + + virtual void SetValue(bool value) wxOVERRIDE; + virtual bool GetValue() const wxOVERRIDE; + + virtual bool OSXHandleClicked( double timestampsec ) wxOVERRIDE; + + virtual void Command(wxCommandEvent& event) wxOVERRIDE; + +protected: + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton); +}; + + +class WXDLLIMPEXP_CORE wxBitmapToggleButton : public wxToggleButton +{ +public: + wxBitmapToggleButton() {} + wxBitmapToggleButton(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)); + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxBitmapToggleButton); +}; + +#endif // _WX_TOGGLEBUTTON_H_ + diff --git a/lib/wxWidgets/include/wx/osx/timectrl.h b/lib/wxWidgets/include/wx/osx/timectrl.h new file mode 100644 index 0000000..4cce4e9 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/timectrl.h @@ -0,0 +1,50 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/timectrl.h +// Purpose: Declaration of wxOSX-specific wxTimePickerCtrl class. +// Author: Vadim Zeitlin +// Created: 2011-12-18 +// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_TIMECTRL_H_ +#define _WX_OSX_TIMECTRL_H_ + +// ---------------------------------------------------------------------------- +// wxTimePickerCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxTimePickerCtrl : public wxTimePickerCtrlBase +{ +public: + // Constructors. + wxTimePickerCtrl() { } + + wxTimePickerCtrl(wxWindow *parent, + wxWindowID id, + const wxDateTime& dt = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTP_DEFAULT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTimePickerCtrlNameStr) + { + Create(parent, id, dt, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxDateTime& dt = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTP_DEFAULT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTimePickerCtrlNameStr); + + virtual void OSXGenerateEvent(const wxDateTime& dt) wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTimePickerCtrl); +}; + +#endif // _WX_OSX_TIMECTRL_H_ diff --git a/lib/wxWidgets/include/wx/osx/toolbar.h b/lib/wxWidgets/include/wx/osx/toolbar.h new file mode 100644 index 0000000..521454f --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/toolbar.h @@ -0,0 +1,132 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/toolbar.h +// Purpose: wxToolBar class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TOOLBAR_H_ +#define _WX_TOOLBAR_H_ + +#if wxUSE_TOOLBAR + +#include "wx/tbarbase.h" +#include "wx/dynarray.h" + +class WXDLLIMPEXP_CORE wxToolBar: public wxToolBarBase +{ + wxDECLARE_DYNAMIC_CLASS(wxToolBar); +public: + /* + * Public interface + */ + + wxToolBar() { Init(); } + + wxToolBar(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = wxTB_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxToolBarNameStr)) + { + Init(); + Create(parent, id, pos, size, style, name); + } + virtual ~wxToolBar(); + + bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = wxTB_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxToolBarNameStr)); + + virtual void SetWindowStyleFlag(long style) wxOVERRIDE; + + virtual bool Destroy() wxOVERRIDE; + + // override/implement base class virtuals + virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const wxOVERRIDE; + +#ifndef __WXOSX_IPHONE__ + virtual bool Show(bool show = true) wxOVERRIDE; + virtual bool IsShown() const wxOVERRIDE; +#endif + virtual bool Realize() wxOVERRIDE; + + virtual wxSize GetToolSize() const wxOVERRIDE; + + virtual void SetRows(int nRows) wxOVERRIDE; + + + virtual void SetToolNormalBitmap(int id, const wxBitmapBundle& bitmap) wxOVERRIDE; + virtual void SetToolDisabledBitmap(int id, const wxBitmapBundle& bitmap) wxOVERRIDE; + +#ifndef __WXOSX_IPHONE__ + // Add all the buttons + + virtual wxString MacGetToolTipString( wxPoint &where ) wxOVERRIDE; + void OnPaint(wxPaintEvent& event) ; + void OnMouse(wxMouseEvent& event) ; + virtual void MacSuperChangedPosition() wxOVERRIDE; +#endif + +#if wxOSX_USE_NATIVE_TOOLBAR + // make all tools selectable + void OSXSetSelectableTools(bool set); + void OSXSelectTool(int toolId); + + bool MacInstallNativeToolbar(bool usesNative); + void MacUninstallNativeToolbar(); + bool MacWantsNativeToolbar(); + bool MacTopLevelHasNativeToolbar(bool *ownToolbarInstalled) const; +#endif + + virtual wxToolBarToolBase *CreateTool(int id, + const wxString& label, + const wxBitmapBundle& bmpNormal, + const wxBitmapBundle& bmpDisabled = wxNullBitmap, + wxItemKind kind = wxITEM_NORMAL, + wxObject *clientData = NULL, + const wxString& shortHelp = wxEmptyString, + const wxString& longHelp = wxEmptyString) wxOVERRIDE; + virtual wxToolBarToolBase *CreateTool(wxControl *control, + const wxString& label) wxOVERRIDE; + +protected: + // common part of all ctors + void Init(); + + void DoLayout(); + + void DoSetSize(int x, int y, int width, int height, int sizeFlags) wxOVERRIDE; + +#ifndef __WXOSX_IPHONE__ + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; + virtual wxSize DoGetBestSize() const wxOVERRIDE; +#endif +#ifdef __WXOSX_COCOA__ + virtual void DoGetPosition(int*x, int *y) const wxOVERRIDE; +#endif + virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE; + virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE; + + virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable) wxOVERRIDE; + virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle) wxOVERRIDE; + virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle) wxOVERRIDE; + + virtual void DoSetToolBitmapSize(const wxSize& size) wxOVERRIDE; + + wxDECLARE_EVENT_TABLE(); +#if wxOSX_USE_NATIVE_TOOLBAR + bool m_macUsesNativeToolbar ; + void* m_macToolbar ; +#endif +#ifdef __WXOSX_IPHONE__ + WX_UIView m_macToolbar; +#endif +}; + +#endif // wxUSE_TOOLBAR + +#endif + // _WX_TOOLBAR_H_ diff --git a/lib/wxWidgets/include/wx/osx/tooltip.h b/lib/wxWidgets/include/wx/osx/tooltip.h new file mode 100644 index 0000000..c229555 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/tooltip.h @@ -0,0 +1,57 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/tooltip.h +// Purpose: wxToolTip class - tooltip control +// Author: Stefan Csomor +// Modified by: +// Created: 31.01.99 +// Copyright: (c) 1999 Robert Roebling, Vadim Zeitlin, Stefan Csomor +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MAC_TOOLTIP_H_ +#define _WX_MAC_TOOLTIP_H_ + +#include "wx/string.h" +#include "wx/event.h" + +class WXDLLIMPEXP_CORE wxToolTip : public wxObject +{ +public: + // ctor & dtor + wxToolTip(const wxString &tip); + virtual ~wxToolTip(); + + // accessors + // tip text + void SetTip(const wxString& tip); + const wxString& GetTip() const { return m_text; } + + // the window we're associated with + void SetWindow(wxWindow *win); + wxWindow *GetWindow() const { return m_window; } + + // controlling tooltip behaviour: globally change tooltip parameters + // enable or disable the tooltips globally + static void Enable(bool flag); + // set the delay after which the tooltip appears + static void SetDelay(long milliseconds); + // set the delay after which the tooltip disappears or how long the tooltip remains visible + static void SetAutoPop(long milliseconds); + // set the delay between subsequent tooltips to appear + static void SetReshow(long milliseconds); + static void NotifyWindowDelete( WXHWND win ) ; + + // implementation only from now on + // ------------------------------- + + // should be called in response to mouse events + static void RelayEvent(wxWindow *win , wxMouseEvent &event); + static void RemoveToolTips(); + +private: + wxString m_text; // tooltip text + wxWindow *m_window; // window we're associated with + wxDECLARE_ABSTRACT_CLASS(wxToolTip); +}; + +#endif // _WX_MAC_TOOLTIP_H_ diff --git a/lib/wxWidgets/include/wx/osx/toplevel.h b/lib/wxWidgets/include/wx/osx/toplevel.h new file mode 100644 index 0000000..1935ae2 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/toplevel.h @@ -0,0 +1,112 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/toplevel.h +// Purpose: wxTopLevelWindowMac is the Mac implementation of wxTLW +// Author: Stefan Csomor +// Modified by: +// Created: 20.09.01 +// Copyright: (c) 2001 Stefan Csomor +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_TOPLEVEL_H_ +#define _WX_MSW_TOPLEVEL_H_ + +// ---------------------------------------------------------------------------- +// wxTopLevelWindowMac +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTopLevelWindowMac : public wxTopLevelWindowBase +{ +public: + // constructors and such + wxTopLevelWindowMac() { Init(); } + + wxTopLevelWindowMac(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Init(); + + (void)Create(parent, id, title, pos, size, style, name); + } + + virtual ~wxTopLevelWindowMac(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + bool Create(wxWindow *parent, WXWindow nativeWindow); + + virtual bool Destroy() wxOVERRIDE; + + virtual wxPoint GetClientAreaOrigin() const wxOVERRIDE; + + // Attracts the users attention to this window if the application is + // inactive (should be called when a background event occurs) + virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO) wxOVERRIDE; + + // implement base class pure virtuals + virtual void Maximize(bool maximize = true) wxOVERRIDE; + virtual bool IsMaximized() const wxOVERRIDE; + virtual void Iconize(bool iconize = true) wxOVERRIDE; + virtual bool IsIconized() const wxOVERRIDE; + virtual void Restore() wxOVERRIDE; + + virtual bool IsActive() wxOVERRIDE; + + virtual void ShowWithoutActivating() wxOVERRIDE; + bool EnableFullScreenView(bool enable = true, long style = wxFULLSCREEN_ALL) wxOVERRIDE; + virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) wxOVERRIDE; + virtual bool IsFullScreen() const wxOVERRIDE; + + virtual wxContentProtection GetContentProtection() const wxOVERRIDE; + virtual bool SetContentProtection(wxContentProtection contentProtection) wxOVERRIDE; + + // implementation from now on + // -------------------------- + + virtual void SetTitle( const wxString& title) wxOVERRIDE; + virtual wxString GetTitle() const wxOVERRIDE; + + // EnableCloseButton(false) used to disable the "Close" + // button on the title bar + virtual bool EnableCloseButton(bool enable = true) wxOVERRIDE; + virtual bool EnableMaximizeButton(bool enable = true) wxOVERRIDE; + virtual bool EnableMinimizeButton(bool enable = true) wxOVERRIDE; + + virtual void SetLabel(const wxString& label) wxOVERRIDE { SetTitle( label ); } + virtual wxString GetLabel() const wxOVERRIDE { return GetTitle(); } + + virtual void OSXSetModified(bool modified) wxOVERRIDE; + virtual bool OSXIsModified() const wxOVERRIDE; + + virtual void SetRepresentedFilename(const wxString& filename) wxOVERRIDE; + + // do *not* call this to iconize the frame, this is a private function! + void OSXSetIconizeState(bool iconic); + +protected: + // common part of all ctors + void Init(); + + // is the frame currently iconized? + bool m_iconized; + + // should the frame be maximized when it will be shown? set by Maximize() + // when it is called while the frame is hidden + bool m_maximizeOnShow; + +private : + wxDECLARE_EVENT_TABLE(); +}; + +#endif // _WX_MSW_TOPLEVEL_H_ diff --git a/lib/wxWidgets/include/wx/osx/uma.h b/lib/wxWidgets/include/wx/osx/uma.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/uma.h diff --git a/lib/wxWidgets/include/wx/osx/webview_webkit.h b/lib/wxWidgets/include/wx/osx/webview_webkit.h new file mode 100644 index 0000000..420b8f6 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/webview_webkit.h @@ -0,0 +1,140 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/osx/webkit.h +// Purpose: wxWebViewWebKit - embeddable web kit control, +// OS X implementation of web view component +// Author: Jethro Grassie / Kevin Ollivier / Marianne Gagnon +// Modified by: +// Created: 2004-4-16 +// Copyright: (c) Jethro Grassie / Kevin Ollivier / Marianne Gagnon +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WEBKIT_H +#define _WX_WEBKIT_H + +#include "wx/defs.h" + +#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && defined(__WXOSX__) + +#include "wx/control.h" +#include "wx/webview.h" + +#include "wx/osx/core/objcid.h" + +// ---------------------------------------------------------------------------- +// Web Kit Control +// ---------------------------------------------------------------------------- + +WX_DECLARE_STRING_HASH_MAP(wxSharedPtr<wxWebViewHandler>, wxStringToWebHandlerMap); + +class WXDLLIMPEXP_WEBVIEW wxWebViewWebKit : public wxWebView +{ +public: + wxDECLARE_DYNAMIC_CLASS(wxWebViewWebKit); + + wxWebViewWebKit() {} + wxWebViewWebKit(wxWindow *parent, + wxWindowID winID = wxID_ANY, + const wxString& strURL = wxASCII_STR(wxWebViewDefaultURLStr), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxString& name = wxASCII_STR(wxWebViewNameStr)) + { + Create(parent, winID, strURL, pos, size, style, name); + } + bool Create(wxWindow *parent, + wxWindowID winID = wxID_ANY, + const wxString& strURL = wxASCII_STR(wxWebViewDefaultURLStr), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxString& name = wxASCII_STR(wxWebViewNameStr)) wxOVERRIDE; + virtual ~wxWebViewWebKit(); + + virtual bool CanGoBack() const wxOVERRIDE; + virtual bool CanGoForward() const wxOVERRIDE; + virtual void GoBack() wxOVERRIDE; + virtual void GoForward() wxOVERRIDE; + virtual void Reload(wxWebViewReloadFlags flags = wxWEBVIEW_RELOAD_DEFAULT) wxOVERRIDE; + virtual void Stop() wxOVERRIDE; + + virtual void Print() wxOVERRIDE; + + virtual void LoadURL(const wxString& url) wxOVERRIDE; + virtual wxString GetCurrentURL() const wxOVERRIDE; + virtual wxString GetCurrentTitle() const wxOVERRIDE; + virtual float GetZoomFactor() const wxOVERRIDE; + virtual void SetZoomFactor(float zoom) wxOVERRIDE; + + virtual void SetZoomType(wxWebViewZoomType zoomType) wxOVERRIDE; + virtual wxWebViewZoomType GetZoomType() const wxOVERRIDE; + virtual bool CanSetZoomType(wxWebViewZoomType type) const wxOVERRIDE; + + virtual bool IsBusy() const wxOVERRIDE; + + virtual bool IsAccessToDevToolsEnabled() const wxOVERRIDE; + virtual void EnableAccessToDevTools(bool enable = true) wxOVERRIDE; + virtual bool SetUserAgent(const wxString& userAgent) wxOVERRIDE; + + //History functions + virtual void ClearHistory() wxOVERRIDE; + virtual void EnableHistory(bool enable = true) wxOVERRIDE; + virtual wxVector<wxSharedPtr<wxWebViewHistoryItem> > GetBackwardHistory() wxOVERRIDE; + virtual wxVector<wxSharedPtr<wxWebViewHistoryItem> > GetForwardHistory() wxOVERRIDE; + virtual void LoadHistoryItem(wxSharedPtr<wxWebViewHistoryItem> item) wxOVERRIDE; + + virtual void Paste() wxOVERRIDE; + + //Undo / redo functionality + virtual bool CanUndo() const wxOVERRIDE; + virtual bool CanRedo() const wxOVERRIDE; + virtual void Undo() wxOVERRIDE; + virtual void Redo() wxOVERRIDE; + + //Editing functions + virtual void SetEditable(bool enable = true) wxOVERRIDE; + virtual bool IsEditable() const wxOVERRIDE; + + virtual void RunScriptAsync(const wxString& javascript, void* clientData = NULL) const wxOVERRIDE; + virtual bool AddScriptMessageHandler(const wxString& name) wxOVERRIDE; + virtual bool RemoveScriptMessageHandler(const wxString& name) wxOVERRIDE; + virtual bool AddUserScript(const wxString& javascript, + wxWebViewUserScriptInjectionTime injectionTime = wxWEBVIEW_INJECT_AT_DOCUMENT_START) wxOVERRIDE; + virtual void RemoveAllUserScripts() wxOVERRIDE; + + //Virtual Filesystem Support + virtual void RegisterHandler(wxSharedPtr<wxWebViewHandler> handler) wxOVERRIDE; + + virtual void* GetNativeBackend() const wxOVERRIDE { return m_webView; } + +protected: + virtual void DoSetPage(const wxString& html, const wxString& baseUrl) wxOVERRIDE; + + wxDECLARE_EVENT_TABLE(); + +private: + OSXWebViewPtr m_webView; + wxStringToWebHandlerMap m_handlers; + wxString m_customUserAgent; + + WX_NSObject m_navigationDelegate; + WX_NSObject m_UIDelegate; +}; + +class WXDLLIMPEXP_WEBVIEW wxWebViewFactoryWebKit : public wxWebViewFactory +{ +public: + virtual wxWebView* Create() wxOVERRIDE { return new wxWebViewWebKit; } + virtual wxWebView* Create(wxWindow* parent, + wxWindowID id, + const wxString& url = wxWebViewDefaultURLStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxWebViewNameStr)) wxOVERRIDE + { return new wxWebViewWebKit(parent, id, url, pos, size, style, name); } + virtual wxVersionInfo GetVersionInfo() wxOVERRIDE; +}; + +#endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT + +#endif // _WX_WEBKIT_H_ diff --git a/lib/wxWidgets/include/wx/osx/webviewhistoryitem_webkit.h b/lib/wxWidgets/include/wx/osx/webviewhistoryitem_webkit.h new file mode 100644 index 0000000..6a15e46 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/webviewhistoryitem_webkit.h @@ -0,0 +1,35 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/osx/webviewhistoryitem.h +// Purpose: wxWebViewHistoryItem header for OSX +// Author: Steven Lamerton +// Copyright: (c) 2011 Steven Lamerton +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_WEBVIEWHISTORYITEM_H_ +#define _WX_OSX_WEBVIEWHISTORYITEM_H_ + +#include "wx/defs.h" + +#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && defined(__WXOSX__) + +#include "wx/osx/core/objcid.h" + +class WXDLLIMPEXP_WEBVIEW wxWebViewHistoryItem +{ +public: + wxWebViewHistoryItem(const wxString& url, const wxString& title) : + m_url(url), m_title(title) {} + wxString GetUrl() { return m_url; } + wxString GetTitle() { return m_title; } + + friend class wxWebViewWebKit; + +private: + wxString m_url, m_title; + wxObjCID m_histItem; +}; + +#endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT + +#endif // _WX_OSX_WEBVIEWHISTORYITEM_H_ diff --git a/lib/wxWidgets/include/wx/osx/window.h b/lib/wxWidgets/include/wx/osx/window.h new file mode 100644 index 0000000..3a161a5 --- /dev/null +++ b/lib/wxWidgets/include/wx/osx/window.h @@ -0,0 +1,410 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/window.h +// Purpose: wxWindowMac class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WINDOW_H_ +#define _WX_WINDOW_H_ + +#include "wx/brush.h" +#include "wx/dc.h" + +class WXDLLIMPEXP_FWD_CORE wxButton; +class WXDLLIMPEXP_FWD_CORE wxScrollBar; +class WXDLLIMPEXP_FWD_CORE wxPanel; +class WXDLLIMPEXP_FWD_CORE wxNonOwnedWindow; + +#if wxOSX_USE_COCOA_OR_IPHONE + class WXDLLIMPEXP_FWD_CORE wxWidgetImpl ; + typedef wxWidgetImpl wxOSXWidgetImpl; +#endif + + +class WXDLLIMPEXP_CORE wxWindowMac: public wxWindowBase +{ + wxDECLARE_DYNAMIC_CLASS(wxWindowMac); + + friend class wxDC; + friend class wxPaintDC; + +public: + wxWindowMac(); + + wxWindowMac( wxWindowMac *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr) ); + + virtual ~wxWindowMac(); + + bool Create( wxWindowMac *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr) ); + + virtual void SendSizeEvent(int flags = 0) wxOVERRIDE; + + // implement base class pure virtuals + virtual void SetLabel( const wxString& label ) wxOVERRIDE; + virtual wxString GetLabel() const wxOVERRIDE; + + virtual void Raise() wxOVERRIDE; + virtual void Lower() wxOVERRIDE; + + virtual bool Show( bool show = true ) wxOVERRIDE; + virtual bool ShowWithEffect(wxShowEffect effect, + unsigned timeout = 0) wxOVERRIDE + { + return OSXShowWithEffect(true, effect, timeout); + } + virtual bool HideWithEffect(wxShowEffect effect, + unsigned timeout = 0) wxOVERRIDE + { + return OSXShowWithEffect(false, effect, timeout); + } + + virtual void SetFocus() wxOVERRIDE; + + virtual void WarpPointer( int x, int y ) wxOVERRIDE; + virtual bool EnableTouchEvents(int eventsMask) wxOVERRIDE; + + virtual void Refresh( bool eraseBackground = true, + const wxRect *rect = NULL ) wxOVERRIDE; + + virtual void Update() wxOVERRIDE; + virtual void ClearBackground() wxOVERRIDE; + + virtual bool SetCursor( const wxCursor &cursor ) wxOVERRIDE; + virtual bool SetFont( const wxFont &font ) wxOVERRIDE; + virtual bool SetBackgroundColour( const wxColour &colour ) wxOVERRIDE; + virtual bool SetForegroundColour( const wxColour &colour ) wxOVERRIDE; + + virtual bool SetBackgroundStyle(wxBackgroundStyle style) wxOVERRIDE; + virtual bool IsTransparentBackgroundSupported(wxString* reason = NULL) const wxOVERRIDE; + + virtual int GetCharHeight() const wxOVERRIDE; + virtual int GetCharWidth() const wxOVERRIDE; + +public: + virtual void SetScrollbar( int orient, int pos, int thumbVisible, + int range, bool refresh = true ) wxOVERRIDE; + virtual void SetScrollPos( int orient, int pos, bool refresh = true ) wxOVERRIDE; + virtual int GetScrollPos( int orient ) const wxOVERRIDE; + virtual int GetScrollThumb( int orient ) const wxOVERRIDE; + virtual int GetScrollRange( int orient ) const wxOVERRIDE; + virtual void ScrollWindow( int dx, int dy, + const wxRect* rect = NULL ) wxOVERRIDE; + virtual void AlwaysShowScrollbars(bool horz = true, bool vert = true) wxOVERRIDE; + virtual bool IsScrollbarAlwaysShown(int orient) const wxOVERRIDE + { + return orient == wxHORIZONTAL ? m_hScrollBarAlwaysShown + : m_vScrollBarAlwaysShown; + } + + virtual bool Reparent( wxWindowBase *newParent ) wxOVERRIDE; + +#if wxUSE_HOTKEY && wxOSX_USE_COCOA_OR_CARBON + // hot keys (system wide accelerators) + // ----------------------------------- + + virtual bool RegisterHotKey(int hotkeyId, int modifiers, int keycode) wxOVERRIDE; + virtual bool UnregisterHotKey(int hotkeyId) wxOVERRIDE; +#endif // wxUSE_HOTKEY + + virtual wxSize GetDPI() const wxOVERRIDE; + virtual double GetDPIScaleFactor() const wxOVERRIDE; + +#if wxUSE_DRAG_AND_DROP + virtual void SetDropTarget( wxDropTarget *dropTarget ) wxOVERRIDE; + +#endif + + // implementation from now on + // -------------------------- + + void MacClientToRootWindow( int *x , int *y ) const; + + void MacWindowToRootWindow( int *x , int *y ) const; + + void MacRootWindowToWindow( int *x , int *y ) const; + + virtual wxString MacGetToolTipString( wxPoint &where ); + + // simple accessors + // ---------------- + + virtual WXWidget GetHandle() const wxOVERRIDE; + + virtual bool SetTransparent(wxByte alpha) wxOVERRIDE; + virtual bool CanSetTransparent() wxOVERRIDE; + virtual wxByte GetTransparent() const; + + // event handlers + // -------------- + + void OnMouseEvent( wxMouseEvent &event ); + void OnDPIChanged( wxDPIChangedEvent& event ); + + void MacOnScroll( wxScrollEvent&event ); + + virtual bool AcceptsFocus() const wxOVERRIDE; + virtual void EnableVisibleFocus(bool enabled) wxOVERRIDE; + + virtual bool IsDoubleBuffered() const wxOVERRIDE { return true; } + +public: + static long MacRemoveBordersFromStyle( long style ); + +public: + // For implementation purposes: + // sometimes decorations make the client area smaller + virtual wxPoint GetClientAreaOrigin() const wxOVERRIDE; + + wxWindowMac *FindItem(long id) const; + wxWindowMac *FindItemByHWND(WXHWND hWnd, bool controlOnly = false) const; + + virtual void TriggerScrollEvent( wxEventType scrollEvent ) ; + // this should not be overridden in classes above wxWindowMac + // because it is called from its destructor via DeleteChildren + virtual void RemoveChild( wxWindowBase *child ) wxOVERRIDE; + + virtual bool MacDoRedraw( long time ) ; + virtual void MacPaintChildrenBorders(); + virtual void MacPaintBorders( int left , int top ) ; + void MacPaintGrowBox(); + + // invalidates the borders and focus area around the control; + // must not be virtual as it will be called during destruction + void MacInvalidateBorders() ; + + WXWindow MacGetTopLevelWindowRef() const ; + wxNonOwnedWindow* MacGetTopLevelWindow() const ; + + virtual long MacGetWXBorderSize() const; + virtual long MacGetLeftBorderSize() const ; + virtual long MacGetRightBorderSize() const ; + virtual long MacGetTopBorderSize() const ; + virtual long MacGetBottomBorderSize() const ; + + virtual void MacSuperChangedPosition() ; + + // absolute coordinates of this window's root have changed + virtual void MacTopLevelWindowChangedPosition() ; + + virtual void MacChildAdded() ; + virtual void MacVisibilityChanged() ; + virtual void MacEnabledStateChanged() ; + virtual void MacHiliteChanged() ; + virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ; + + bool MacIsReallyEnabled() ; + bool MacIsReallyHilited() ; + +#if WXWIN_COMPATIBILITY_2_8 + bool MacIsUserPane(); +#endif + bool MacIsUserPane() const; + + virtual bool MacSetupCursor( const wxPoint& pt ) ; + + // return the rectangle that would be visible of this control, + // regardless whether controls are hidden + // only taking into account clipping by parent windows + const wxRect& MacGetClippedClientRect() const ; + const wxRect& MacGetClippedRect() const ; + const wxRect& MacGetClippedRectWithOuterStructure() const ; + + // returns the visible region of this control in window ie non-client coordinates + const wxRegion& MacGetVisibleRegion( bool includeOuterStructures = false ) ; + + // returns true if children have to clipped to the content area + // (e.g., scrolled windows) + bool MacClipChildren() const { return m_clipChildren ; } + void MacSetClipChildren( bool clip ); + + // returns true if the grandchildren need to be clipped to the children's content area + // (e.g., splitter windows) + virtual bool MacClipGrandChildren() const { return false ; } + bool MacIsWindowScrollbar( const wxWindow* sb ) const + { return ((wxWindow*)m_hScrollBar == sb || (wxWindow*)m_vScrollBar == sb) ; } + virtual bool IsClientAreaChild(const wxWindow *child) const wxOVERRIDE + { + return !MacIsWindowScrollbar(child) && !((wxWindow*)m_growBox==child) && + wxWindowBase::IsClientAreaChild(child); + } + + void MacPostControlCreate(const wxPoint& pos, const wxSize& size) ; + wxList& GetSubcontrols() { return m_subControls; } + + // translate wxWidgets coords into ones suitable + // to be passed to CreateControl calls + // + // returns true if non-default coords are returned, false otherwise + bool MacGetBoundsForControl(const wxPoint& pos, + const wxSize& size, + int& x, int& y, + int& w, int& h , bool adjustForOrigin ) const ; + + // the 'true' OS level control for this wxWindow + wxOSXWidgetImpl* GetPeer() const; + + // optimization to avoid creating a user pane in wxWindow::Create if we already know + // we will replace it with our own peer + void DontCreatePeer(); + + // return true unless DontCreatePeer() had been called + bool ShouldCreatePeer() const; + + // sets the native implementation wrapper, can replace an existing peer, use peer = NULL to + // release existing peer + void SetPeer(wxOSXWidgetImpl* peer); + + // wraps the already existing peer with the wrapper + void SetWrappingPeer(wxOSXWidgetImpl* wrapper); + +#if wxOSX_USE_COCOA_OR_IPHONE + // the NSView or NSWindow of this window: can be used for both child and + // non-owned windows + // + // this is useful for a few Cocoa function which can work with either views + // or windows indiscriminately, e.g. for setting NSViewAnimationTargetKey + virtual void *OSXGetViewOrWindow() const; +#endif // Cocoa + + void * MacGetCGContextRef() { return m_cgContextRef ; } + void MacSetCGContextRef(void * cg) { m_cgContextRef = cg ; } + + // osx specific event handling common for all osx-ports + + virtual bool OSXHandleClicked( double timestampsec ); + virtual bool OSXHandleKeyEvent( wxKeyEvent& event ); + virtual void OSXSimulateFocusEvents(); + + bool IsNativeWindowWrapper() const { return m_isNativeWindowWrapper; } + + double GetContentScaleFactor() const wxOVERRIDE; + + // internal response to size events + virtual void MacOnInternalSize() {} + + // Return the DPI corresponding to the given scale factor. + static wxSize OSXMakeDPIFromScaleFactor(double scaleFactor); + +#if wxUSE_MENUS + // Called on the invoking window after handling the menu event. + virtual void OSXAfterMenuEvent() { } +#endif // wxUSE_MENUS + +protected: + // For controls like radio buttons which are genuinely composite + wxList m_subControls; + + // the peer object, allowing for cleaner API support + + void * m_cgContextRef ; + + // cache the clipped rectangles within the window hierarchy + void MacUpdateClippedRects() const ; + + mutable bool m_cachedClippedRectValid ; + mutable wxRect m_cachedClippedRectWithOuterStructure ; + mutable wxRect m_cachedClippedRect ; + mutable wxRect m_cachedClippedClientRect ; + mutable wxRegion m_cachedClippedRegionWithOuterStructure ; + mutable wxRegion m_cachedClippedRegion ; + mutable wxRegion m_cachedClippedClientRegion ; + + // insets of the mac control from the wx top left corner + wxPoint m_macTopLeftInset ; + wxPoint m_macBottomRightInset ; + wxByte m_macAlpha ; + + wxScrollBar* m_hScrollBar ; + wxScrollBar* m_vScrollBar ; + bool m_hScrollBarAlwaysShown; + bool m_vScrollBarAlwaysShown; + wxWindow* m_growBox ; + wxString m_label ; + + bool m_isNativeWindowWrapper; + + // set to true if we do a sharp clip at the content area of this window + // must be dynamic as eg a panel normally is not clipping precisely, but if + // it becomes the target window of a scrolled window it has to... + bool m_clipChildren ; + + virtual bool MacIsChildOfClientArea( const wxWindow* child ) const ; + + bool MacHasScrollBarCorner() const; + void MacCreateScrollBars( long style ) ; + void MacRepositionScrollBars() ; + + // implement the base class pure virtuals + virtual void DoGetTextExtent(const wxString& string, + int *x, int *y, + int *descent = NULL, + int *externalLeading = NULL, + const wxFont *theFont = NULL ) const wxOVERRIDE; + + virtual void DoEnable( bool enable ) wxOVERRIDE; +#if wxUSE_MENUS + virtual bool DoPopupMenu( wxMenu *menu, int x, int y ) wxOVERRIDE; +#endif + + virtual void DoFreeze() wxOVERRIDE; + virtual void DoThaw() wxOVERRIDE; + + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual wxSize DoGetSizeFromClientSize( const wxSize & size ) const; + virtual void DoClientToScreen( int *x, int *y ) const wxOVERRIDE; + virtual void DoScreenToClient( int *x, int *y ) const wxOVERRIDE; + virtual void DoGetPosition( int *x, int *y ) const wxOVERRIDE; + virtual void DoGetSize( int *width, int *height ) const wxOVERRIDE; + virtual void DoGetClientSize( int *width, int *height ) const wxOVERRIDE; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; + virtual void DoSetClientSize(int width, int height) wxOVERRIDE; + + virtual void DoCaptureMouse() wxOVERRIDE; + virtual void DoReleaseMouse() wxOVERRIDE; + + // move the window to the specified location and resize it: this is called + // from both DoSetSize() and DoSetClientSize() and would usually just call + // ::MoveWindow() except for composite controls which will want to arrange + // themselves inside the given rectangle + virtual void DoMoveWindow( int x, int y, int width, int height ) wxOVERRIDE; + virtual void DoSetWindowVariant( wxWindowVariant variant ) wxOVERRIDE; + +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip( wxToolTip *tip ) wxOVERRIDE; +#endif + + // common part of Show/HideWithEffect() + virtual bool OSXShowWithEffect(bool show, + wxShowEffect effect, + unsigned timeout); + +private: + wxOSXWidgetImpl * m_peer ; + // common part of all ctors + void Init(); + + // show/hide scrollbars as needed, common part of SetScrollbar() and + // AlwaysShowScrollbars() + void DoUpdateScrollbarVisibility(); + + wxDECLARE_NO_COPY_CLASS(wxWindowMac); + wxDECLARE_EVENT_TABLE(); +}; + +#endif // _WX_WINDOW_H_ diff --git a/lib/wxWidgets/include/wx/overlay.h b/lib/wxWidgets/include/wx/overlay.h new file mode 100644 index 0000000..0fc2089 --- /dev/null +++ b/lib/wxWidgets/include/wx/overlay.h @@ -0,0 +1,90 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/overlay.h +// Purpose: wxOverlay class +// Author: Stefan Csomor +// Modified by: +// Created: 2006-10-20 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OVERLAY_H_ +#define _WX_OVERLAY_H_ + +#include "wx/defs.h" + +// ---------------------------------------------------------------------------- +// creates an overlay over an existing window, allowing for manipulations like +// rubberbanding etc. This API is not stable yet, not to be used outside wx +// internal code +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxDC; + +class WXDLLIMPEXP_CORE wxOverlay +{ +public: + class Impl; + + wxOverlay(); + ~wxOverlay(); + + // clears the overlay without restoring the former state + // to be done eg when the window content has been changed and repainted + void Reset(); + + bool IsNative() const; + +private: + friend class WXDLLIMPEXP_FWD_CORE wxDCOverlay; + + static Impl* Create(); + + // returns true if it has been setup + bool IsOk(); + + void Init(wxDC* dc, int x , int y , int width , int height); + + void BeginDrawing(wxDC* dc); + + void EndDrawing(wxDC* dc); + + void Clear(wxDC* dc); + + Impl* m_impl; + + bool m_inDrawing; + + + wxDECLARE_NO_COPY_CLASS(wxOverlay); +}; + + +class WXDLLIMPEXP_CORE wxDCOverlay +{ +public: + // connects this overlay to the corresponding drawing dc, if the overlay is + // not initialized yet this call will do so + wxDCOverlay(wxOverlay &overlay, wxDC *dc, int x , int y , int width , int height); + + // convenience wrapper that behaves the same using the entire area of the dc + wxDCOverlay(wxOverlay &overlay, wxDC *dc); + + // removes the connection between the overlay and the dc + virtual ~wxDCOverlay(); + + // clears the layer, restoring the state at the last init + void Clear(); + +private: + void Init(wxDC *dc, int x , int y , int width , int height); + + wxOverlay& m_overlay; + + wxDC* m_dc; + + + wxDECLARE_NO_COPY_CLASS(wxDCOverlay); +}; + +#endif // _WX_OVERLAY_H_ diff --git a/lib/wxWidgets/include/wx/ownerdrw.h b/lib/wxWidgets/include/wx/ownerdrw.h new file mode 100644 index 0000000..4dfc30b --- /dev/null +++ b/lib/wxWidgets/include/wx/ownerdrw.h @@ -0,0 +1,142 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/ownerdrw.h +// Purpose: interface for owner-drawn GUI elements +// Author: Vadim Zeitlin +// Modified by: Marcin Malich +// Created: 11.11.97 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OWNERDRW_H_BASE +#define _WX_OWNERDRW_H_BASE + +#include "wx/defs.h" + +#if wxUSE_OWNER_DRAWN + +#include "wx/font.h" +#include "wx/colour.h" + +class WXDLLIMPEXP_FWD_CORE wxDC; + +// ---------------------------------------------------------------------------- +// wxOwnerDrawn - a mix-in base class, derive from it to implement owner-drawn +// behaviour +// +// wxOwnerDrawn supports drawing of an item with non standard font, color and +// also supports 3 bitmaps: either a checked/unchecked bitmap for a checkable +// element or one unchangeable bitmap otherwise. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxOwnerDrawnBase +{ +public: + wxOwnerDrawnBase() + { + m_ownerDrawn = false; + m_margin = ms_defaultMargin; + } + + virtual ~wxOwnerDrawnBase() {} + + void SetFont(const wxFont& font) + { m_font = font; m_ownerDrawn = true; } + + wxFont& GetFont() { return m_font; } + const wxFont& GetFont() const { return m_font; } + + + void SetTextColour(const wxColour& colText) + { m_colText = colText; m_ownerDrawn = true; } + + wxColour& GetTextColour() { return m_colText; } + const wxColour& GetTextColour() const { return m_colText; } + + void SetBackgroundColour(const wxColour& colBack) + { m_colBack = colBack; m_ownerDrawn = true; } + + wxColour& GetBackgroundColour() { return m_colBack; } + const wxColour& GetBackgroundColour() const { return m_colBack ; } + + + void SetMarginWidth(int width) + { m_margin = width; } + + int GetMarginWidth() const + { return m_margin; } + + static int GetDefaultMarginWidth() + { return ms_defaultMargin; } + + + // get item name (with mnemonics if exist) + virtual wxString GetName() const = 0; + + + // this function might seem strange, but if it returns false it means that + // no non-standard attribute are set, so there is no need for this control + // to be owner-drawn. Moreover, you can force owner-drawn to false if you + // want to change, say, the color for the item but only if it is owner-drawn + // (see wxMenuItem::wxMenuItem for example) + bool IsOwnerDrawn() const + { return m_ownerDrawn; } + + // switch on/off owner-drawing the item + void SetOwnerDrawn(bool ownerDrawn = true) + { m_ownerDrawn = ownerDrawn; } + + + // constants used in OnDrawItem + // (they have the same values as corresponding Win32 constants) + enum wxODAction + { + wxODDrawAll = 0x0001, // redraw entire control + wxODSelectChanged = 0x0002, // selection changed (see Status.Select) + wxODFocusChanged = 0x0004 // keyboard focus changed (see Status.Focus) + }; + + enum wxODStatus + { + wxODSelected = 0x0001, // control is currently selected + wxODGrayed = 0x0002, // item is to be grayed + wxODDisabled = 0x0004, // item is to be drawn as disabled + wxODChecked = 0x0008, // item is to be checked + wxODHasFocus = 0x0010, // item has the keyboard focus + wxODDefault = 0x0020, // item is the default item + wxODHidePrefix= 0x0100 // hide keyboard cues (w2k and xp only) + }; + + // virtual functions to implement drawing (return true if processed) + virtual bool OnMeasureItem(size_t *width, size_t *height); + virtual bool OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODStatus stat) = 0; + +protected: + + // get the font and colour to use, whether it is set or not + virtual void GetFontToUse(wxFont& font) const; + virtual void GetColourToUse(wxODStatus stat, wxColour& colText, wxColour& colBack) const; + +private: + bool m_ownerDrawn; // true if something is non standard + + wxFont m_font; // font to use for drawing + wxColour m_colText, // color ----"---"---"---- + m_colBack; // background color + + int m_margin; // space occupied by bitmap to the left of the item + + static int ms_defaultMargin; +}; + +// ---------------------------------------------------------------------------- +// include the platform-specific class declaration +// ---------------------------------------------------------------------------- + +#if defined(__WXMSW__) + #include "wx/msw/ownerdrw.h" +#endif + +#endif // wxUSE_OWNER_DRAWN + +#endif // _WX_OWNERDRW_H_BASE diff --git a/lib/wxWidgets/include/wx/palette.h b/lib/wxWidgets/include/wx/palette.h new file mode 100644 index 0000000..dd5d4ce --- /dev/null +++ b/lib/wxWidgets/include/wx/palette.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palette.h +// Purpose: Common header and base class for wxPalette +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PALETTE_H_BASE_ +#define _WX_PALETTE_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_PALETTE + +#include "wx/object.h" +#include "wx/gdiobj.h" + +// wxPaletteBase +class WXDLLIMPEXP_CORE wxPaletteBase: public wxGDIObject +{ +public: + wxDECLARE_DEFAULT_COPY_AND_DEF(wxPaletteBase) + + virtual ~wxPaletteBase() { } + + virtual int GetColoursCount() const { wxFAIL_MSG( wxT("not implemented") ); return 0; } +}; + +#if defined(__WXMSW__) + #include "wx/msw/palette.h" +#elif defined(__WXX11__) || defined(__WXMOTIF__) + #include "wx/x11/palette.h" +#elif defined(__WXGTK__) + #include "wx/generic/paletteg.h" +#elif defined(__WXMAC__) + #include "wx/osx/palette.h" +#elif defined(__WXQT__) + #include "wx/qt/palette.h" +#endif + +#endif // wxUSE_PALETTE + +#endif // _WX_PALETTE_H_BASE_ diff --git a/lib/wxWidgets/include/wx/panel.h b/lib/wxWidgets/include/wx/panel.h new file mode 100644 index 0000000..d07724a --- /dev/null +++ b/lib/wxWidgets/include/wx/panel.h @@ -0,0 +1,72 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/panel.h +// Purpose: Base header for wxPanel +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PANEL_H_BASE_ +#define _WX_PANEL_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers and forward declarations +// ---------------------------------------------------------------------------- + +#include "wx/window.h" +#include "wx/containr.h" + +class WXDLLIMPEXP_FWD_CORE wxControlContainer; + +extern WXDLLIMPEXP_DATA_CORE(const char) wxPanelNameStr[]; + +// ---------------------------------------------------------------------------- +// wxPanel contains other controls and implements TAB traversal between them +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPanelBase : public wxNavigationEnabled<wxWindow> +{ +public: + wxPanelBase() { } + + // Derived classes should also provide this constructor: + /* + wxPanelBase(wxWindow *parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTAB_TRAVERSAL | wxNO_BORDER, + const wxString& name = wxASCII_STR(wxPanelNameStr)); + */ + + // Pseudo ctor + bool Create(wxWindow *parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTAB_TRAVERSAL | wxNO_BORDER, + const wxString& name = wxASCII_STR(wxPanelNameStr)); + + + // implementation from now on + // -------------------------- + + virtual void InitDialog() wxOVERRIDE; + +private: + wxDECLARE_NO_COPY_CLASS(wxPanelBase); +}; + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/panel.h" +#elif defined(__WXMSW__) + #include "wx/msw/panel.h" +#else + #define wxHAS_GENERIC_PANEL + #include "wx/generic/panelg.h" +#endif + +#endif // _WX_PANELH_BASE_ diff --git a/lib/wxWidgets/include/wx/paper.h b/lib/wxWidgets/include/wx/paper.h new file mode 100644 index 0000000..a86b7aa --- /dev/null +++ b/lib/wxWidgets/include/wx/paper.h @@ -0,0 +1,121 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/paper.h +// Purpose: Paper database types and classes +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PAPERH__ +#define _WX_PAPERH__ + +#include "wx/defs.h" +#include "wx/event.h" +#include "wx/cmndata.h" +#include "wx/intl.h" +#include "wx/hashmap.h" + +/* + * Paper type: see defs.h for wxPaperSize enum. + * A wxPrintPaperType can have an id and a name, or just a name and wxPAPER_NONE, + * so you can add further paper types without needing new ids. + */ + +#ifdef __WXMSW__ +#define WXADDPAPER(paperId, platformId, name, w, h) AddPaperType(paperId, platformId, name, w, h) +#else +#define WXADDPAPER(paperId, platformId, name, w, h) AddPaperType(paperId, 0, name, w, h) +#endif + +class WXDLLIMPEXP_CORE wxPrintPaperType: public wxObject +{ +public: + wxPrintPaperType(); + + // platformId is a platform-specific id, such as in Windows, DMPAPER_... + wxPrintPaperType(wxPaperSize paperId, int platformId, const wxString& name, int w, int h); + + inline wxString GetName() const { return wxGetTranslation(m_paperName); } + inline wxPaperSize GetId() const { return m_paperId; } + inline int GetPlatformId() const { return m_platformId; } + + // Get width and height in tenths of a millimetre + inline int GetWidth() const { return m_width; } + inline int GetHeight() const { return m_height; } + + // Get size in tenths of a millimetre + inline wxSize GetSize() const { return wxSize(m_width, m_height); } + + // Get size in a millimetres + inline wxSize GetSizeMM() const { return wxSize(m_width/10, m_height/10); } + + // Get width and height in device units (1/72th of an inch) + wxSize GetSizeDeviceUnits() const ; + +public: + wxPaperSize m_paperId; + int m_platformId; + int m_width; // In tenths of a millimetre + int m_height; // In tenths of a millimetre + wxString m_paperName; + +private: + wxDECLARE_DYNAMIC_CLASS(wxPrintPaperType); +}; + +WX_DECLARE_STRING_HASH_MAP(wxPrintPaperType*, wxStringToPrintPaperTypeHashMap); + +class WXDLLIMPEXP_FWD_CORE wxPrintPaperTypeList; + +class WXDLLIMPEXP_CORE wxPrintPaperDatabase +{ +public: + wxPrintPaperDatabase(); + ~wxPrintPaperDatabase(); + + void CreateDatabase(); + void ClearDatabase(); + + void AddPaperType(wxPaperSize paperId, const wxString& name, int w, int h); + void AddPaperType(wxPaperSize paperId, int platformId, const wxString& name, int w, int h); + + // Find by name + wxPrintPaperType *FindPaperType(const wxString& name) const; + + // Find by size id + wxPrintPaperType *FindPaperType(wxPaperSize id) const; + + // Find by platform id + wxPrintPaperType *FindPaperTypeByPlatformId(int id) const; + + // Find by size + wxPrintPaperType *FindPaperType(const wxSize& size) const; + + // Convert name to size id + wxPaperSize ConvertNameToId(const wxString& name) const; + + // Convert size id to name + wxString ConvertIdToName(wxPaperSize paperId) const; + + // Get the paper size + wxSize GetSize(wxPaperSize paperId) const; + + // Get the paper size + wxPaperSize GetSize(const wxSize& size) const; + + // + wxPrintPaperType* Item(size_t index) const; + size_t GetCount() const; +private: + wxStringToPrintPaperTypeHashMap* m_map; + wxPrintPaperTypeList* m_list; + //wxDECLARE_DYNAMIC_CLASS(wxPrintPaperDatabase); +}; + +extern WXDLLIMPEXP_DATA_CORE(wxPrintPaperDatabase*) wxThePrintPaperDatabase; + + +#endif + // _WX_PAPERH__ diff --git a/lib/wxWidgets/include/wx/pen.h b/lib/wxWidgets/include/wx/pen.h new file mode 100644 index 0000000..c5c751d --- /dev/null +++ b/lib/wxWidgets/include/wx/pen.h @@ -0,0 +1,152 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/pen.h +// Purpose: Base header for wxPen +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PEN_H_BASE_ +#define _WX_PEN_H_BASE_ + +#include "wx/gdiobj.h" +#include "wx/peninfobase.h" + +// Possible values for pen quality. +enum wxPenQuality +{ + wxPEN_QUALITY_DEFAULT, // Select the appropriate quality automatically. + wxPEN_QUALITY_LOW, // Less good looking but faster. + wxPEN_QUALITY_HIGH // Best looking, at the expense of speed. +}; + +// ---------------------------------------------------------------------------- +// wxPenInfo contains all parameters describing a wxPen +// ---------------------------------------------------------------------------- + +class wxPenInfo : public wxPenInfoBase<wxPenInfo> +{ +public: + explicit wxPenInfo(const wxColour& colour = wxColour(), + int width = 1, + wxPenStyle style = wxPENSTYLE_SOLID) + : wxPenInfoBase<wxPenInfo>(colour, style) + { + m_width = width; + m_quality = wxPEN_QUALITY_DEFAULT; + } + + // Setters + + wxPenInfo& Width(int width) + { m_width = width; return *this; } + + wxPenInfo& Quality(wxPenQuality quality) + { m_quality = quality; return *this; } + wxPenInfo& LowQuality() { return Quality(wxPEN_QUALITY_LOW); } + wxPenInfo& HighQuality() { return Quality(wxPEN_QUALITY_HIGH); } + + // Accessors + + int GetWidth() const { return m_width; } + + wxPenQuality GetQuality() const { return m_quality; } + +private: + int m_width; + wxPenQuality m_quality; +}; + + +class WXDLLIMPEXP_CORE wxPenBase : public wxGDIObject +{ +public: + wxDECLARE_DEFAULT_COPY_AND_DEF(wxPenBase) + virtual ~wxPenBase() { } + + virtual void SetColour(const wxColour& col) = 0; + virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) = 0; + + virtual void SetWidth(int width) = 0; + virtual void SetStyle(wxPenStyle style) = 0; + virtual void SetStipple(const wxBitmap& stipple) = 0; + virtual void SetDashes(int nb_dashes, const wxDash *dash) = 0; + virtual void SetJoin(wxPenJoin join) = 0; + virtual void SetCap(wxPenCap cap) = 0; + virtual void SetQuality(wxPenQuality quality) { wxUnusedVar(quality); } + + virtual wxColour GetColour() const = 0; + virtual wxBitmap *GetStipple() const = 0; + virtual wxPenStyle GetStyle() const = 0; + virtual wxPenJoin GetJoin() const = 0; + virtual wxPenCap GetCap() const = 0; + virtual wxPenQuality GetQuality() const { return wxPEN_QUALITY_DEFAULT; } + virtual int GetWidth() const = 0; + virtual int GetDashes(wxDash **ptr) const = 0; + + // Convenient helpers for testing whether the pen is a transparent one: + // unlike GetStyle() == wxPENSTYLE_TRANSPARENT, they work correctly even if + // the pen is invalid (they both return false in this case). + bool IsTransparent() const + { + return IsOk() && GetStyle() == wxPENSTYLE_TRANSPARENT; + } + + bool IsNonTransparent() const + { + return IsOk() && GetStyle() != wxPENSTYLE_TRANSPARENT; + } +}; + +#if defined(__WXMSW__) + #include "wx/msw/pen.h" +#elif defined(__WXMOTIF__) || defined(__WXX11__) + #include "wx/x11/pen.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/pen.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/pen.h" +#elif defined(__WXDFB__) + #include "wx/dfb/pen.h" +#elif defined(__WXMAC__) + #include "wx/osx/pen.h" +#elif defined(__WXQT__) + #include "wx/qt/pen.h" +#endif + +class WXDLLIMPEXP_CORE wxPenList: public wxGDIObjListBase +{ +public: + wxPen *FindOrCreatePen(const wxColour& colour, + int width = 1, + wxPenStyle style = wxPENSTYLE_SOLID); + + wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") + wxPen *FindOrCreatePen(const wxColour& colour, int width, int style) + { return FindOrCreatePen(colour, width, (wxPenStyle)style); } +}; + +extern WXDLLIMPEXP_DATA_CORE(wxPenList*) wxThePenList; + +// provide comparison operators to allow code such as +// +// if ( pen.GetStyle() == wxTRANSPARENT ) +// +// to compile without warnings which it would otherwise provoke from some +// compilers as it compares elements of different enums + +wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") +inline bool operator==(wxPenStyle s, wxDeprecatedGUIConstants t) +{ + return static_cast<int>(s) == static_cast<int>(t); +} + +wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") +inline bool operator!=(wxPenStyle s, wxDeprecatedGUIConstants t) +{ + return static_cast<int>(s) != static_cast<int>(t); +} + +#endif // _WX_PEN_H_BASE_ diff --git a/lib/wxWidgets/include/wx/peninfobase.h b/lib/wxWidgets/include/wx/peninfobase.h new file mode 100644 index 0000000..f66bb14 --- /dev/null +++ b/lib/wxWidgets/include/wx/peninfobase.h @@ -0,0 +1,129 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/peninfobase.h +// Purpose: Declaration of wxPenInfoBase class and related constants +// Author: Adrien Tétar, Vadim Zeitlin +// Created: 2017-09-10 +// Copyright: (c) 2017 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PENINFOBASE_H_ +#define _WX_PENINFOBASE_H_ + +#include "wx/bitmap.h" +#include "wx/colour.h" +#include "wx/gdicmn.h" // for wxDash + +enum wxPenStyle +{ + wxPENSTYLE_INVALID = -1, + + wxPENSTYLE_SOLID = wxSOLID, + wxPENSTYLE_DOT = wxDOT, + wxPENSTYLE_LONG_DASH = wxLONG_DASH, + wxPENSTYLE_SHORT_DASH = wxSHORT_DASH, + wxPENSTYLE_DOT_DASH = wxDOT_DASH, + wxPENSTYLE_USER_DASH = wxUSER_DASH, + + wxPENSTYLE_TRANSPARENT = wxTRANSPARENT, + + wxPENSTYLE_STIPPLE_MASK_OPAQUE = wxSTIPPLE_MASK_OPAQUE, + wxPENSTYLE_STIPPLE_MASK = wxSTIPPLE_MASK, + wxPENSTYLE_STIPPLE = wxSTIPPLE, + + wxPENSTYLE_BDIAGONAL_HATCH = wxHATCHSTYLE_BDIAGONAL, + wxPENSTYLE_CROSSDIAG_HATCH = wxHATCHSTYLE_CROSSDIAG, + wxPENSTYLE_FDIAGONAL_HATCH = wxHATCHSTYLE_FDIAGONAL, + wxPENSTYLE_CROSS_HATCH = wxHATCHSTYLE_CROSS, + wxPENSTYLE_HORIZONTAL_HATCH = wxHATCHSTYLE_HORIZONTAL, + wxPENSTYLE_VERTICAL_HATCH = wxHATCHSTYLE_VERTICAL, + wxPENSTYLE_FIRST_HATCH = wxHATCHSTYLE_FIRST, + wxPENSTYLE_LAST_HATCH = wxHATCHSTYLE_LAST +}; + +enum wxPenJoin +{ + wxJOIN_INVALID = -1, + + wxJOIN_BEVEL = 120, + wxJOIN_MITER, + wxJOIN_ROUND +}; + +enum wxPenCap +{ + wxCAP_INVALID = -1, + + wxCAP_ROUND = 130, + wxCAP_PROJECTING, + wxCAP_BUTT +}; + +// ---------------------------------------------------------------------------- +// wxPenInfoBase is a common base for wxPenInfo and wxGraphicsPenInfo +// ---------------------------------------------------------------------------- + +// This class uses CRTP, the template parameter is the derived class itself. +template <class T> +class wxPenInfoBase +{ +public: + // Setters for the various attributes. All of them return the object itself + // so that the calls to them could be chained. + + T& Colour(const wxColour& colour) + { m_colour = colour; return This(); } + + T& Style(wxPenStyle style) + { m_style = style; return This(); } + T& Stipple(const wxBitmap& stipple) + { m_stipple = stipple; m_style = wxPENSTYLE_STIPPLE; return This(); } + T& Dashes(int nb_dashes, const wxDash *dash) + { m_nb_dashes = nb_dashes; m_dash = const_cast<wxDash*>(dash); return This(); } + T& Join(wxPenJoin join) + { m_join = join; return This(); } + T& Cap(wxPenCap cap) + { m_cap = cap; return This(); } + + // Accessors are mostly meant to be used by wxWidgets itself. + + wxColour GetColour() const { return m_colour; } + wxBitmap GetStipple() const { return m_stipple; } + wxPenStyle GetStyle() const { return m_style; } + wxPenJoin GetJoin() const { return m_join; } + wxPenCap GetCap() const { return m_cap; } + int GetDashes(wxDash **ptr) const { *ptr = m_dash; return m_nb_dashes; } + + int GetDashCount() const { return m_nb_dashes; } + wxDash* GetDash() const { return m_dash; } + + // Convenience + + bool IsTransparent() const { return m_style == wxPENSTYLE_TRANSPARENT; } + +protected: + wxPenInfoBase(const wxColour& colour, wxPenStyle style) + : m_colour(colour) + { + m_nb_dashes = 0; + m_dash = NULL; + m_join = wxJOIN_ROUND; + m_cap = wxCAP_ROUND; + m_style = style; + } + +private: + // Helper to return this object itself cast to its real type T. + T& This() { return static_cast<T&>(*this); } + + wxColour m_colour; + wxBitmap m_stipple; + wxPenStyle m_style; + wxPenJoin m_join; + wxPenCap m_cap; + + int m_nb_dashes; + wxDash* m_dash; +}; + +#endif // _WX_PENINFOBASE_H_ diff --git a/lib/wxWidgets/include/wx/persist.h b/lib/wxWidgets/include/wx/persist.h new file mode 100644 index 0000000..757fad0 --- /dev/null +++ b/lib/wxWidgets/include/wx/persist.h @@ -0,0 +1,254 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/persist.h +// Purpose: common classes for persistence support +// Author: Vadim Zeitlin +// Created: 2009-01-18 +// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PERSIST_H_ +#define _WX_PERSIST_H_ + +#include "wx/string.h" +#include "wx/hashmap.h" +#include "wx/confbase.h" + +class wxPersistentObject; + +WX_DECLARE_VOIDPTR_HASH_MAP(wxPersistentObject *, wxPersistentObjectsMap); + +// ---------------------------------------------------------------------------- +// global functions +// ---------------------------------------------------------------------------- + +/* + We do _not_ declare this function as doing this would force us to specialize + it for the user classes deriving from the standard persistent classes. + However we do define overloads of wxCreatePersistentObject() for all the wx + classes which means that template wxPersistentObject::Restore() picks up the + right overload to use provided that the header defining the correct overload + is included before calling it. And a compilation error happens if this is + not done. + +template <class T> +wxPersistentObject *wxCreatePersistentObject(T *obj); + + */ + +// ---------------------------------------------------------------------------- +// wxPersistenceManager: global aspects of persistent windows +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPersistenceManager +{ +public: + // Call this method to specify a non-default persistence manager to use. + // This function should usually be called very early to affect creation of + // all persistent controls and the object passed to it must have a lifetime + // long enough to be still alive when the persistent controls are destroyed + // and need it to save their state so typically this would be a global or a + // wxApp member. + static void Set(wxPersistenceManager& manager); + + // accessor to the unique persistence manager object + static wxPersistenceManager& Get(); + + // trivial but virtual dtor + virtual ~wxPersistenceManager(); + + + // globally disable restoring or saving the persistent properties (both are + // enabled by default) + void DisableSaving() { m_doSave = false; } + void DisableRestoring() { m_doRestore = false; } + + + // register an object with the manager: when using the first overload, + // wxCreatePersistentObject() must be specialized for this object class; + // with the second one the persistent adapter is created by the caller + // + // the object shouldn't be already registered with us + template <class T> + wxPersistentObject *Register(T *obj) + { + return Register(obj, wxCreatePersistentObject(obj)); + } + + wxPersistentObject *Register(void *obj, wxPersistentObject *po); + + // check if the object is registered and return the associated + // wxPersistentObject if it is or NULL otherwise + wxPersistentObject *Find(void *obj) const; + + // unregister the object, this is called by wxPersistentObject itself so + // there is usually no need to do it explicitly + // + // deletes the associated wxPersistentObject + void Unregister(void *obj); + + + // save/restore the state of an object + // + // these methods do nothing if DisableSaving/Restoring() was called + // + // Restore() returns true if the object state was really restored + void Save(void *obj); + bool Restore(void *obj); + + // combines both Save() and Unregister() calls + void SaveAndUnregister(void *obj) + { + Save(obj); + Unregister(obj); + } + + // combines both Register() and Restore() calls + template <class T> + bool RegisterAndRestore(T *obj) + { + return Register(obj) && Restore(obj); + } + + bool RegisterAndRestore(void *obj, wxPersistentObject *po) + { + return Register(obj, po) && Restore(obj); + } + + + // methods used by the persistent objects to save and restore the data + // + // currently these methods simply use wxConfig::Get() but they may be + // overridden in the derived class (once we allow creating custom + // persistent managers) +#define wxPERSIST_DECLARE_SAVE_RESTORE_FOR(Type) \ + virtual bool SaveValue(const wxPersistentObject& who, \ + const wxString& name, \ + Type value); \ + \ + virtual bool \ + RestoreValue(const wxPersistentObject& who, \ + const wxString& name, \ + Type *value) + + wxPERSIST_DECLARE_SAVE_RESTORE_FOR(bool); + wxPERSIST_DECLARE_SAVE_RESTORE_FOR(int); + wxPERSIST_DECLARE_SAVE_RESTORE_FOR(long); + wxPERSIST_DECLARE_SAVE_RESTORE_FOR(wxString); + +#undef wxPERSIST_DECLARE_SAVE_RESTORE_FOR + +protected: + // ctor is private, use Get() + wxPersistenceManager() + { + m_doSave = + m_doRestore = true; + } + + + // Return the config object to use, by default just the global one but a + // different one could be used by the derived class if needed. + virtual wxConfigBase *GetConfig() const { return wxConfigBase::Get(); } + + // Return the path to use for saving the setting with the given name for + // the specified object (notice that the name is the name of the setting, + // not the name of the object itself which can be retrieved with GetName()). + virtual wxString GetKey(const wxPersistentObject& who, + const wxString& name) const; + + +private: + // map with the registered objects as keys and associated + // wxPersistentObjects as values + wxPersistentObjectsMap m_persistentObjects; + + // true if we should restore/save the settings (it doesn't make much sense + // to use this class when both of them are false but setting one of them to + // false may make sense in some situations) + bool m_doSave, + m_doRestore; + + wxDECLARE_NO_COPY_CLASS(wxPersistenceManager); +}; + +// ---------------------------------------------------------------------------- +// wxPersistentObject: ABC for anything persistent +// ---------------------------------------------------------------------------- + +class wxPersistentObject +{ +public: + // ctor associates us with the object whose options we save/restore + wxPersistentObject(void *obj) : m_obj(obj) { } + + // trivial but virtual dtor + virtual ~wxPersistentObject() { } + + + // methods used by wxPersistenceManager + // ------------------------------------ + + // save/restore the corresponding objects settings + // + // these methods shouldn't be used directly as they don't respect the + // global wxPersistenceManager::DisableSaving/Restoring() settings, use + // wxPersistenceManager methods with the same name instead + virtual void Save() const = 0; + virtual bool Restore() = 0; + + + // get the kind of the objects we correspond to, e.g. "Frame" + virtual wxString GetKind() const = 0; + + // get the name of the object we correspond to, e.g. "Main" + virtual wxString GetName() const = 0; + + + // return the associated object + void *GetObject() const { return m_obj; } + +protected: + // wrappers for wxPersistenceManager methods which don't require passing + // "this" as the first parameter all the time + template <typename T> + bool SaveValue(const wxString& name, T value) const + { + return wxPersistenceManager::Get().SaveValue(*this, name, value); + } + + template <typename T> + bool RestoreValue(const wxString& name, T *value) + { + return wxPersistenceManager::Get().RestoreValue(*this, name, value); + } + +private: + void * const m_obj; + + wxDECLARE_NO_COPY_CLASS(wxPersistentObject); +}; + +// Helper function calling RegisterAndRestore() on the global persistence +// manager object. +template <typename T> +inline bool wxPersistentRegisterAndRestore(T *obj) +{ + wxPersistentObject * const pers = wxCreatePersistentObject(obj); + + return wxPersistenceManager::Get().RegisterAndRestore(obj, pers); + +} + +// A helper function which also sets the name for the (wxWindow-derived) object +// before registering and restoring it. +template <typename T> +inline bool wxPersistentRegisterAndRestore(T *obj, const wxString& name) +{ + obj->SetName(name); + + return wxPersistentRegisterAndRestore(obj); +} + +#endif // _WX_PERSIST_H_ + diff --git a/lib/wxWidgets/include/wx/persist/bookctrl.h b/lib/wxWidgets/include/wx/persist/bookctrl.h new file mode 100644 index 0000000..f6370cc --- /dev/null +++ b/lib/wxWidgets/include/wx/persist/bookctrl.h @@ -0,0 +1,70 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/persist/bookctrl.h +// Purpose: persistence support for wxBookCtrl +// Author: Vadim Zeitlin +// Created: 2009-01-19 +// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PERSIST_BOOKCTRL_H_ +#define _WX_PERSIST_BOOKCTRL_H_ + +#include "wx/persist/window.h" + +#if wxUSE_BOOKCTRL + +#include "wx/bookctrl.h" + +// ---------------------------------------------------------------------------- +// string constants used by wxPersistentBookCtrl +// ---------------------------------------------------------------------------- + +#define wxPERSIST_BOOK_KIND wxASCII_STR("Book") + +#define wxPERSIST_BOOK_SELECTION wxASCII_STR("Selection") + +// ---------------------------------------------------------------------------- +// wxPersistentBookCtrl: supports saving/restoring book control selection +// ---------------------------------------------------------------------------- + +class wxPersistentBookCtrl : public wxPersistentWindow<wxBookCtrlBase> +{ +public: + wxPersistentBookCtrl(wxBookCtrlBase *book) + : wxPersistentWindow<wxBookCtrlBase>(book) + { + } + + virtual void Save() const wxOVERRIDE + { + SaveValue(wxPERSIST_BOOK_SELECTION, Get()->GetSelection()); + } + + virtual bool Restore() wxOVERRIDE + { + long sel; + if ( RestoreValue(wxPERSIST_BOOK_SELECTION, &sel) ) + { + wxBookCtrlBase * const book = Get(); + if ( sel >= 0 && (unsigned)sel < book->GetPageCount() ) + { + book->SetSelection(sel); + return true; + } + } + + return false; + } + + virtual wxString GetKind() const wxOVERRIDE { return wxPERSIST_BOOK_KIND; } +}; + +inline wxPersistentObject *wxCreatePersistentObject(wxBookCtrlBase *book) +{ + return new wxPersistentBookCtrl(book); +} + +#endif // wxUSE_BOOKCTRL + +#endif // _WX_PERSIST_BOOKCTRL_H_ diff --git a/lib/wxWidgets/include/wx/persist/combobox.h b/lib/wxWidgets/include/wx/persist/combobox.h new file mode 100644 index 0000000..1f69d1f --- /dev/null +++ b/lib/wxWidgets/include/wx/persist/combobox.h @@ -0,0 +1,103 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/persist/combobox.h +// Purpose: Persistence adapter for wxComboBox +// Author: Vadim Zeitlin +// Created: 2020-11-19 +// Copyright: (c) 2020 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PERSIST_COMBOBOX_H_ +#define _WX_PERSIST_COMBOBOX_H_ + +#include "wx/persist/window.h" + +#if wxUSE_COMBOBOX + +#include "wx/combobox.h" + +#define wxPERSIST_COMBOBOX_KIND wxASCII_STR("Combobox") + +// Stores semicolon-separated list of combobox entries (real semicolons are +// escaped using backslash), i.e. "first;second;...". +#define wxPERSIST_COMBOBOX_ITEMS wxASCII_STR("Items") + +#define wxPERSIST_COMBOBOX_ITEMS_SEP ';' + +// ---------------------------------------------------------------------------- +// wxPersistentComboBox: supports saving/restoring combobox items +// ---------------------------------------------------------------------------- + +class wxPersistentComboBox : public wxPersistentWindow<wxComboBox> +{ +public: + // The maximum number of items to save is currently hard-coded. + // + // Notice that we must have some limit, as otherwise the length of the + // items string in the config would be unbounded, which certainly wouldn't + // be a good idea. + enum { MaxSavedItemsCount = 10 }; + + explicit wxPersistentComboBox(wxComboBox* combobox) + : wxPersistentWindow<wxComboBox>(combobox) + { + } + + virtual void Save() const wxOVERRIDE + { + const wxComboBox* const combobox = Get(); + + wxArrayString items = combobox->GetStrings(); + + const wxString value = combobox->GetValue(); + if ( !value.empty() ) + { + wxArrayString::iterator it; + for ( it = items.begin(); it != items.end(); ++it ) + { + if ( *it == value ) + { + // There is no need to add the text of an item already + // present in the combobox again, but do move it to the top + // of it to indicate that it was the last one used. + wxSwap(*items.begin(), *it); + break; + } + } + + if ( it == items.end() ) + { + // This is a genuinely new item, so just insert it front. + items.insert(items.begin(), value); + + if ( items.size() > MaxSavedItemsCount ) + items.erase(items.begin() + MaxSavedItemsCount, items.end()); + } + } + + SaveValue(wxPERSIST_COMBOBOX_ITEMS, + wxJoin(items, wxPERSIST_COMBOBOX_ITEMS_SEP)); + } + + virtual bool Restore() wxOVERRIDE + { + wxString items; + if ( !RestoreValue(wxPERSIST_COMBOBOX_ITEMS, &items) ) + return false; + + Get()->Set(wxSplit(items, wxPERSIST_COMBOBOX_ITEMS_SEP)); + + return true; + } + + virtual wxString GetKind() const wxOVERRIDE { return wxPERSIST_COMBOBOX_KIND; } +}; + +inline wxPersistentObject *wxCreatePersistentObject(wxComboBox* combobox) +{ + return new wxPersistentComboBox(combobox); +} + +#endif // wxUSE_COMBOBOX + +#endif // _WX_PERSIST_COMBOBOX_H_ diff --git a/lib/wxWidgets/include/wx/persist/dataview.h b/lib/wxWidgets/include/wx/persist/dataview.h new file mode 100644 index 0000000..fe6dac1 --- /dev/null +++ b/lib/wxWidgets/include/wx/persist/dataview.h @@ -0,0 +1,175 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/persist/dataview.h +// Purpose: Persistence support for wxDataViewCtrl and its derivatives +// Author: wxWidgets Team +// Created: 2017-08-21 +// Copyright: (c) 2017 wxWidgets.org +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PERSIST_DATAVIEW_H_ +#define _WX_PERSIST_DATAVIEW_H_ + +#include "wx/persist/window.h" + +#if wxUSE_DATAVIEWCTRL + +#include "wx/dataview.h" + +// ---------------------------------------------------------------------------- +// String constants used by wxPersistentDataViewCtrl. +// ---------------------------------------------------------------------------- + +#define wxPERSIST_DVC_KIND "DataView" + +#define wxPERSIST_DVC_HIDDEN "Hidden" +#define wxPERSIST_DVC_POS "Position" +#define wxPERSIST_DVC_TITLE "Title" +#define wxPERSIST_DVC_WIDTH "Width" + +#define wxPERSIST_DVC_SORT_KEY "Sorting/Column" +#define wxPERSIST_DVC_SORT_ASC "Sorting/Asc" + +// ---------------------------------------------------------------------------- +// wxPersistentDataViewCtrl: Saves and restores user modified column widths +// and single column sort order. +// +// Future improvements could be to save and restore column order if the user +// has changed it and multicolumn sorts. +// ---------------------------------------------------------------------------- + +class wxPersistentDataViewCtrl : public wxPersistentWindow<wxDataViewCtrl> +{ +public: + wxPersistentDataViewCtrl(wxDataViewCtrl* control) + : wxPersistentWindow<wxDataViewCtrl>(control) + { + } + + virtual void Save() const wxOVERRIDE + { + wxDataViewCtrl* const control = Get(); + + const wxDataViewColumn* sortColumn = NULL; + + for ( unsigned int col = 0; col < control->GetColumnCount(); col++ ) + { + const wxDataViewColumn* const column = control->GetColumn(col); + + // Create a prefix string to identify each column. + const wxString columnPrefix = MakeColumnPrefix(column); + + // Save the column attributes. + SaveValue(columnPrefix + wxASCII_STR(wxPERSIST_DVC_HIDDEN), column->IsHidden()); + SaveValue(columnPrefix + wxASCII_STR(wxPERSIST_DVC_POS), + control->GetColumnPosition(column)); + + // We take special care to save only the specified width instead of + // the currently used one. Usually they're one and the same, but + // they can be different for the last column, whose size can be + // greater than specified, as it's always expanded to fill the + // entire control width. + const int width = column->WXGetSpecifiedWidth(); + if ( width > 0 ) + SaveValue(columnPrefix + wxASCII_STR(wxPERSIST_DVC_WIDTH), width); + + // Check if this column is the current sort key. + if ( column->IsSortKey() ) + sortColumn = column; + } + + // Note: The current implementation does not save and restore multi- + // column sort keys. + if ( control->IsMultiColumnSortAllowed() ) + return; + + // Save the sort key and direction if there is a valid sort. + if ( sortColumn ) + { + SaveValue(wxASCII_STR(wxPERSIST_DVC_SORT_KEY), sortColumn->GetTitle()); + SaveValue(wxASCII_STR(wxPERSIST_DVC_SORT_ASC), + sortColumn->IsSortOrderAscending()); + } + } + + virtual bool Restore() wxOVERRIDE + { + wxDataViewCtrl* const control = Get(); + + for ( unsigned int col = 0; col < control->GetColumnCount(); col++ ) + { + wxDataViewColumn* const column = control->GetColumn(col); + + // Create a prefix string to identify each column within the + // persistence store (columns are stored by title). The persistence + // store benignly handles cases where the title is not found. + const wxString columnPrefix = MakeColumnPrefix(column); + + // Restore column hidden status. + bool hidden; + if ( RestoreValue(columnPrefix + wxASCII_STR(wxPERSIST_DVC_HIDDEN), &hidden) ) + column->SetHidden(hidden); + + // Restore the column width. + int width; + if ( RestoreValue(columnPrefix + wxASCII_STR(wxPERSIST_DVC_WIDTH), &width) ) + column->SetWidth(width); + + // TODO: Set the column's view position. + } + + // Restore the sort key and order if there is a valid model and sort + // criteria. + wxString sortColumn; + if ( control->GetModel() && + RestoreValue(wxASCII_STR(wxPERSIST_DVC_SORT_KEY), &sortColumn) && + !sortColumn.empty() ) + { + bool sortAsc = true; + if ( wxDataViewColumn* column = GetColumnByTitle(control, sortColumn) ) + { + RestoreValue(wxASCII_STR(wxPERSIST_DVC_SORT_ASC), &sortAsc); + column->SetSortOrder(sortAsc); + + // Resort the control based on the new sort criteria. + control->GetModel()->Resort(); + } + } + + return true; + } + + virtual wxString GetKind() const wxOVERRIDE + { + return wxASCII_STR(wxPERSIST_DVC_KIND); + } + +private: + // Return a (slash-terminated) prefix for the column-specific entries. + static wxString MakeColumnPrefix(const wxDataViewColumn* column) + { + return wxString::Format(wxASCII_STR("/Columns/%s/"), column->GetTitle()); + } + + // Return the column with the given title or NULL. + static wxDataViewColumn* + GetColumnByTitle(wxDataViewCtrl* control, const wxString& title) + { + for ( unsigned int col = 0; col < control->GetColumnCount(); col++ ) + { + if ( control->GetColumn(col)->GetTitle() == title ) + return control->GetColumn(col); + } + + return NULL; + } +}; + +inline wxPersistentObject *wxCreatePersistentObject(wxDataViewCtrl* control) +{ + return new wxPersistentDataViewCtrl(control); +} + +#endif // wxUSE_DATAVIEWCTRL + +#endif // _WX_PERSIST_DATAVIEW_H_ diff --git a/lib/wxWidgets/include/wx/persist/splitter.h b/lib/wxWidgets/include/wx/persist/splitter.h new file mode 100644 index 0000000..7c9e658 --- /dev/null +++ b/lib/wxWidgets/include/wx/persist/splitter.h @@ -0,0 +1,68 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/persist/splitter.h +// Purpose: Persistence support for wxSplitterWindow. +// Author: Vadim Zeitlin +// Created: 2011-08-31 +// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PERSIST_SPLITTER_H_ +#define _WX_PERSIST_SPLITTER_H_ + +#include "wx/persist/window.h" + +#include "wx/splitter.h" + +// ---------------------------------------------------------------------------- +// string constants used by wxPersistentSplitter +// ---------------------------------------------------------------------------- + +#define wxPERSIST_SPLITTER_KIND wxASCII_STR("Splitter") + +// Special position value of -1 means the splitter is not split at all. +#define wxPERSIST_SPLITTER_POSITION wxASCII_STR("Position") + +// ---------------------------------------------------------------------------- +// wxPersistentSplitter: supports saving/restoring splitter position +// ---------------------------------------------------------------------------- + +class wxPersistentSplitter : public wxPersistentWindow<wxSplitterWindow> +{ +public: + wxPersistentSplitter(wxSplitterWindow* splitter) + : wxPersistentWindow<wxSplitterWindow>(splitter) + { + } + + virtual void Save() const wxOVERRIDE + { + wxSplitterWindow* const splitter = Get(); + + int pos = splitter->IsSplit() ? splitter->GetSashPosition() : -1; + SaveValue(wxPERSIST_SPLITTER_POSITION, pos); + } + + virtual bool Restore() wxOVERRIDE + { + int pos; + if ( !RestoreValue(wxPERSIST_SPLITTER_POSITION, &pos) ) + return false; + + if ( pos == -1 ) + Get()->Unsplit(); + else + Get()->SetSashPosition(pos); + + return true; + } + + virtual wxString GetKind() const wxOVERRIDE { return wxPERSIST_SPLITTER_KIND; } +}; + +inline wxPersistentObject *wxCreatePersistentObject(wxSplitterWindow* splitter) +{ + return new wxPersistentSplitter(splitter); +} + +#endif // _WX_PERSIST_SPLITTER_H_ diff --git a/lib/wxWidgets/include/wx/persist/toplevel.h b/lib/wxWidgets/include/wx/persist/toplevel.h new file mode 100644 index 0000000..5fd78c2 --- /dev/null +++ b/lib/wxWidgets/include/wx/persist/toplevel.h @@ -0,0 +1,73 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/persist/toplevel.h +// Purpose: persistence support for wxTLW +// Author: Vadim Zeitlin +// Created: 2009-01-19 +// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PERSIST_TOPLEVEL_H_ +#define _WX_PERSIST_TOPLEVEL_H_ + +#include "wx/persist/window.h" + +#include "wx/toplevel.h" + +// ---------------------------------------------------------------------------- +// string constants used by wxPersistentTLW +// ---------------------------------------------------------------------------- + +// we use just "Window" to keep configuration files and such short, there +// should be no confusion with wxWindow itself as we don't have persistent +// windows, just persistent controls which have their own specific kind strings +#define wxPERSIST_TLW_KIND "Window" + +// ---------------------------------------------------------------------------- +// wxPersistentTLW: supports saving/restoring window position and size as well +// as maximized/iconized/restore state +// ---------------------------------------------------------------------------- + +class wxPersistentTLW : public wxPersistentWindow<wxTopLevelWindow>, + private wxTopLevelWindow::GeometrySerializer +{ +public: + wxPersistentTLW(wxTopLevelWindow *tlw) + : wxPersistentWindow<wxTopLevelWindow>(tlw) + { + } + + virtual void Save() const wxOVERRIDE + { + const wxTopLevelWindow * const tlw = Get(); + + tlw->SaveGeometry(*this); + } + + virtual bool Restore() wxOVERRIDE + { + wxTopLevelWindow * const tlw = Get(); + + return tlw->RestoreToGeometry(*this); + } + + virtual wxString GetKind() const wxOVERRIDE { return wxASCII_STR(wxPERSIST_TLW_KIND); } + +private: + virtual bool SaveField(const wxString& name, int value) const wxOVERRIDE + { + return SaveValue(name, value); + } + + virtual bool RestoreField(const wxString& name, int* value) wxOVERRIDE + { + return RestoreValue(name, value); + } +}; + +inline wxPersistentObject *wxCreatePersistentObject(wxTopLevelWindow *tlw) +{ + return new wxPersistentTLW(tlw); +} + +#endif // _WX_PERSIST_TOPLEVEL_H_ diff --git a/lib/wxWidgets/include/wx/persist/treebook.h b/lib/wxWidgets/include/wx/persist/treebook.h new file mode 100644 index 0000000..c7b4cf0 --- /dev/null +++ b/lib/wxWidgets/include/wx/persist/treebook.h @@ -0,0 +1,100 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/persist/treebook.h +// Purpose: persistence support for wxBookCtrl +// Author: Vadim Zeitlin +// Created: 2009-01-19 +// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PERSIST_TREEBOOK_H_ +#define _WX_PERSIST_TREEBOOK_H_ + +#include "wx/persist/bookctrl.h" + +#if wxUSE_TREEBOOK + +#include "wx/arrstr.h" +#include "wx/treebook.h" + +// ---------------------------------------------------------------------------- +// string constants used by wxPersistentTreeBookCtrl +// ---------------------------------------------------------------------------- + +#define wxPERSIST_TREEBOOK_KIND wxASCII_STR("TreeBook") + +// this key contains the indices of all expanded nodes in the tree book +// separated by wxPERSIST_TREEBOOK_EXPANDED_SEP +#define wxPERSIST_TREEBOOK_EXPANDED_BRANCHES wxASCII_STR("Expanded") +#define wxPERSIST_TREEBOOK_EXPANDED_SEP ',' + +// ---------------------------------------------------------------------------- +// wxPersistentTreeBookCtrl: supports saving/restoring open tree branches +// ---------------------------------------------------------------------------- + +class wxPersistentTreeBookCtrl : public wxPersistentBookCtrl +{ +public: + wxPersistentTreeBookCtrl(wxTreebook *book) + : wxPersistentBookCtrl(book) + { + } + + virtual void Save() const wxOVERRIDE + { + const wxTreebook * const book = GetTreeBook(); + + wxString expanded; + const size_t count = book->GetPageCount(); + for ( size_t n = 0; n < count; n++ ) + { + if ( book->IsNodeExpanded(n) ) + { + if ( !expanded.empty() ) + expanded += wxPERSIST_TREEBOOK_EXPANDED_SEP; + + expanded += wxString::Format(wxASCII_STR("%u"), static_cast<unsigned>(n)); + } + } + + SaveValue(wxPERSIST_TREEBOOK_EXPANDED_BRANCHES, expanded); + + wxPersistentBookCtrl::Save(); + } + + virtual bool Restore() wxOVERRIDE + { + wxTreebook * const book = GetTreeBook(); + + wxString expanded; + if ( RestoreValue(wxPERSIST_TREEBOOK_EXPANDED_BRANCHES, &expanded) ) + { + const wxArrayString + indices(wxSplit(expanded, wxPERSIST_TREEBOOK_EXPANDED_SEP)); + + const size_t pageCount = book->GetPageCount(); + const size_t count = indices.size(); + for ( size_t n = 0; n < count; n++ ) + { + unsigned long idx; + if ( indices[n].ToULong(&idx) && idx < pageCount ) + book->ExpandNode(idx); + } + } + + return wxPersistentBookCtrl::Restore(); + } + + virtual wxString GetKind() const wxOVERRIDE { return wxPERSIST_TREEBOOK_KIND; } + + wxTreebook *GetTreeBook() const { return static_cast<wxTreebook *>(Get()); } +}; + +inline wxPersistentObject *wxCreatePersistentObject(wxTreebook *book) +{ + return new wxPersistentTreeBookCtrl(book); +} + +#endif // wxUSE_TREEBOOK + +#endif // _WX_PERSIST_TREEBOOK_H_ diff --git a/lib/wxWidgets/include/wx/persist/window.h b/lib/wxWidgets/include/wx/persist/window.h new file mode 100644 index 0000000..db163a2 --- /dev/null +++ b/lib/wxWidgets/include/wx/persist/window.h @@ -0,0 +1,76 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/persist/window.h +// Purpose: wxPersistentWindow declaration +// Author: Vadim Zeitlin +// Created: 2009-01-23 +// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PERSIST_WINDOW_H_ +#define _WX_PERSIST_WINDOW_H_ + +#include "wx/persist.h" + +#include "wx/window.h" + +// ---------------------------------------------------------------------------- +// wxPersistentWindow: base class for persistent windows, uses the window name +// as persistent name by default and automatically reacts +// to the window destruction +// ---------------------------------------------------------------------------- + +// type-independent part of wxPersistentWindow +class wxPersistentWindowBase : public wxPersistentObject +{ +public: + wxPersistentWindowBase(wxWindow *win) + : wxPersistentObject(win) + { + win->Bind(wxEVT_DESTROY, &wxPersistentWindowBase::HandleDestroy, this); + } + + virtual wxString GetName() const wxOVERRIDE + { + const wxString name = GetWindow()->GetName(); + wxASSERT_MSG( !name.empty(), "persistent windows should be named!" ); + + return name; + } + +protected: + wxWindow *GetWindow() const { return static_cast<wxWindow *>(GetObject()); } + +private: + void HandleDestroy(wxWindowDestroyEvent& event) + { + event.Skip(); + + // only react to the destruction of this object itself, not of any of + // its children + if ( event.GetEventObject() == GetObject() ) + { + // this will delete this object itself + wxPersistenceManager::Get().SaveAndUnregister(GetWindow()); + } + } + + wxDECLARE_NO_COPY_CLASS(wxPersistentWindowBase); +}; + +template <class T> +class wxPersistentWindow : public wxPersistentWindowBase +{ +public: + typedef T WindowType; + + wxPersistentWindow(WindowType *win) + : wxPersistentWindowBase(win) + { + } + + WindowType *Get() const { return static_cast<WindowType *>(GetWindow()); } +}; + +#endif // _WX_PERSIST_WINDOW_H_ + diff --git a/lib/wxWidgets/include/wx/pickerbase.h b/lib/wxWidgets/include/wx/pickerbase.h new file mode 100644 index 0000000..5966cab --- /dev/null +++ b/lib/wxWidgets/include/wx/pickerbase.h @@ -0,0 +1,171 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/pickerbase.h +// Purpose: wxPickerBase definition +// Author: Francesco Montorsi (based on Vadim Zeitlin's code) +// Modified by: +// Created: 14/4/2006 +// Copyright: (c) Vadim Zeitlin, Francesco Montorsi +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PICKERBASE_H_BASE_ +#define _WX_PICKERBASE_H_BASE_ + +#include "wx/control.h" +#include "wx/sizer.h" +#include "wx/containr.h" + +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; +class WXDLLIMPEXP_FWD_CORE wxToolTip; + +extern WXDLLIMPEXP_DATA_CORE(const char) wxButtonNameStr[]; + +// ---------------------------------------------------------------------------- +// wxPickerBase is the base class for the picker controls which support +// a wxPB_USE_TEXTCTRL style; i.e. for those pickers which can use an auxiliary +// text control next to the 'real' picker. +// +// The wxTextPickerHelper class manages enabled/disabled state of the text control, +// its sizing and positioning. +// ---------------------------------------------------------------------------- + +#define wxPB_USE_TEXTCTRL 0x0002 +#define wxPB_SMALL 0x8000 + +class WXDLLIMPEXP_CORE wxPickerBase : public wxNavigationEnabled<wxControl> +{ +public: + // ctor: text is the associated text control + wxPickerBase() : m_text(NULL), m_picker(NULL), m_sizer(NULL) + { } + virtual ~wxPickerBase() {} + + + // if present, intercepts wxPB_USE_TEXTCTRL style and creates the text control + // The 3rd argument is the initial wxString to display in the text control + bool CreateBase(wxWindow *parent, + wxWindowID id, + const wxString& text = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)); + +public: // public API + + // margin between the text control and the picker + void SetInternalMargin(int newmargin) + { GetTextCtrlItem()->SetBorder(newmargin); m_sizer->Layout(); } + int GetInternalMargin() const + { return GetTextCtrlItem()->GetBorder(); } + + // proportion of the text control + void SetTextCtrlProportion(int prop) + { GetTextCtrlItem()->SetProportion(prop); m_sizer->Layout(); } + int GetTextCtrlProportion() const + { return GetTextCtrlItem()->GetProportion(); } + + // proportion of the picker control + void SetPickerCtrlProportion(int prop) + { GetPickerCtrlItem()->SetProportion(prop); m_sizer->Layout(); } + int GetPickerCtrlProportion() const + { return GetPickerCtrlItem()->GetProportion(); } + + bool IsTextCtrlGrowable() const + { return (GetTextCtrlItem()->GetFlag() & wxGROW) != 0; } + void SetTextCtrlGrowable(bool grow = true) + { + DoSetGrowableFlagFor(GetTextCtrlItem(), grow); + } + + bool IsPickerCtrlGrowable() const + { return (GetPickerCtrlItem()->GetFlag() & wxGROW) != 0; } + void SetPickerCtrlGrowable(bool grow = true) + { + DoSetGrowableFlagFor(GetPickerCtrlItem(), grow); + } + + bool HasTextCtrl() const + { return m_text != NULL; } + wxTextCtrl *GetTextCtrl() + { return m_text; } + wxControl *GetPickerCtrl() + { return m_picker; } + + void SetTextCtrl(wxTextCtrl* text) + { m_text = text; } + void SetPickerCtrl(wxControl* picker) + { m_picker = picker; } + + // methods that derived class must/may override + virtual void UpdatePickerFromTextCtrl() = 0; + virtual void UpdateTextCtrlFromPicker() = 0; + +protected: + // overridden base class methods +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip(wxToolTip *tip) wxOVERRIDE; +#endif // wxUSE_TOOLTIPS + + + // event handlers + void OnTextCtrlDelete(wxWindowDestroyEvent &); + void OnTextCtrlUpdate(wxCommandEvent &); + void OnTextCtrlKillFocus(wxFocusEvent &); + + // returns the set of styles for the attached wxTextCtrl + // from given wxPickerBase's styles + virtual long GetTextCtrlStyle(long style) const + { return (style & wxWINDOW_STYLE_MASK); } + + // returns the set of styles for the m_picker + virtual long GetPickerStyle(long style) const + { return (style & wxWINDOW_STYLE_MASK); } + + + wxSizerItem *GetPickerCtrlItem() const + { + if (this->HasTextCtrl()) + return m_sizer->GetItem((size_t)1); + return m_sizer->GetItem((size_t)0); + } + + wxSizerItem *GetTextCtrlItem() const + { + wxASSERT(this->HasTextCtrl()); + return m_sizer->GetItem((size_t)0); + } + +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_MSG("useless and will be removed in the future") + int GetDefaultPickerCtrlFlag() const + { + return wxALIGN_CENTER_VERTICAL; + } + + wxDEPRECATED_MSG("useless and will be removed in the future") + int GetDefaultTextCtrlFlag() const + { + // Cast to avoid warnings about mixing elements of different enums. + return wxALIGN_CENTER_VERTICAL | static_cast<int>(wxRIGHT); + } +#endif // WXWIN_COMPATIBILITY_3_0 + + void PostCreation(); + +protected: + wxTextCtrl *m_text; // can be NULL + wxControl *m_picker; + wxBoxSizer *m_sizer; + +private: + // Common implementation of Set{Text,Picker}CtrlGrowable(). + void DoSetGrowableFlagFor(wxSizerItem* item, bool grow); + + wxDECLARE_ABSTRACT_CLASS(wxPickerBase); +}; + + +#endif + // _WX_PICKERBASE_H_BASE_ diff --git a/lib/wxWidgets/include/wx/platform.h b/lib/wxWidgets/include/wx/platform.h new file mode 100644 index 0000000..bc240a3 --- /dev/null +++ b/lib/wxWidgets/include/wx/platform.h @@ -0,0 +1,592 @@ +/** +* Name: wx/platform.h +* Purpose: define the OS and compiler identification macros +* Author: Vadim Zeitlin +* Modified by: +* Created: 29.10.01 (extracted from wx/defs.h) +* Copyright: (c) 1997-2001 Vadim Zeitlin +* Licence: wxWindows licence +*/ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#ifndef _WX_PLATFORM_H_ +#define _WX_PLATFORM_H_ + +#ifdef __WXMAC_XCODE__ +# include <unistd.h> +# include <TargetConditionals.h> +# include <Availability.h> +# ifndef MAC_OS_X_VERSION_10_4 +# define MAC_OS_X_VERSION_10_4 1040 +# endif +# ifndef MAC_OS_X_VERSION_10_5 +# define MAC_OS_X_VERSION_10_5 1050 +# endif +# ifndef MAC_OS_X_VERSION_10_6 +# define MAC_OS_X_VERSION_10_6 1060 +# endif +# ifndef MAC_OS_X_VERSION_10_7 +# define MAC_OS_X_VERSION_10_7 1070 +# endif +# ifndef MAC_OS_X_VERSION_10_8 +# define MAC_OS_X_VERSION_10_8 1080 +# endif +# ifndef MAC_OS_X_VERSION_10_9 +# define MAC_OS_X_VERSION_10_9 1090 +# endif +# ifndef MAC_OS_X_VERSION_10_10 +# define MAC_OS_X_VERSION_10_10 101000 +# endif +# ifndef MAC_OS_X_VERSION_10_11 +# define MAC_OS_X_VERSION_10_11 101100 +# endif +# ifndef MAC_OS_X_VERSION_10_12 +# define MAC_OS_X_VERSION_10_12 101200 +# endif +# ifndef MAC_OS_X_VERSION_10_13 +# define MAC_OS_X_VERSION_10_13 101300 +# endif +# ifndef MAC_OS_X_VERSION_10_14 +# define MAC_OS_X_VERSION_10_14 101400 +# endif +# ifndef MAC_OS_X_VERSION_10_15 +# define MAC_OS_X_VERSION_10_15 101500 +# endif +# ifndef MAC_OS_X_VERSION_10_16 +# define MAC_OS_X_VERSION_10_16 101600 +# endif +# ifndef MAC_OS_VERSION_11_0 +# define MAC_OS_VERSION_11_0 110000 +# endif +# if __MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_13 +# ifndef NSAppKitVersionNumber10_10 +# define NSAppKitVersionNumber10_10 1343 +# endif +# ifndef NSAppKitVersionNumber10_11 +# define NSAppKitVersionNumber10_11 1404 +# endif +# endif +# ifndef __WXOSX__ +# define __WXOSX__ 1 +# endif +# ifndef __WXMAC__ +# define __WXMAC__ 1 +# endif +#endif + +/* + We use __WINDOWS__ as our main identification symbol for Microsoft Windows + but it's actually not predefined directly by any commonly used compilers + (only Watcom defines it itself and it's not supported any longer), so we + define it ourselves if any of the following macros is defined: + + - MSVC _WIN32 (notice that this is also defined under Win64) + - Our __WXMSW__ which selects Windows as platform automatically + */ +#if defined(_WIN32) || defined(__WIN32__) || defined(__WXMSW__) +# ifndef __WINDOWS__ +# define __WINDOWS__ +# endif /* !__WINDOWS__ */ +#endif /* Any standard symbol indicating Windows */ + +#if defined(__WINDOWS__) + /* Select wxMSW under Windows if no other port is specified. */ +# if !defined(__WXMSW__) && !defined(__WXMOTIF__) && !defined(__WXGTK__) && !defined(__WXX11__) && !defined(__WXQT__) +# define __WXMSW__ +# endif + +# ifndef _WIN32 +# define _WIN32 +# endif + +# ifndef WIN32 +# define WIN32 +# endif + +# ifndef __WIN32__ +# define __WIN32__ +# endif + + /* MSVC predefines _WIN64 for 64 bit builds, for gcc we use generic + architecture definitions. */ +# if defined(_WIN64) || defined(__x86_64__) +# ifndef __WIN64__ +# define __WIN64__ +# endif /* !__WIN64__ */ +# endif /* _WIN64 */ + +#endif /* __WINDOWS__ */ + +/* + Don't use widget toolkit specific code in non-GUI code in the library + itself to ensure that the same base library is used for both MSW and GTK + ports. But keep __WXMSW__ defined for (console) applications using + wxWidgets for compatibility. + */ +#if defined(WXBUILDING) && defined(wxUSE_GUI) && !wxUSE_GUI +# ifdef __WXMSW__ +# undef __WXMSW__ +# endif +# ifdef __WXGTK__ +# undef __WXGTK__ +# endif +#endif + +#if (defined(__WXGTK__) || defined(__WXQT__)) && defined(__WINDOWS__) + +# ifdef __WXMSW__ +# undef __WXMSW__ +# endif + +#endif /* (__WXGTK__ || __WXQT__) && __WINDOWS__ */ + +#ifdef __ANDROID__ +# define __WXANDROID__ +# include "wx/android/config_android.h" +#endif + +#include "wx/compiler.h" + +/* + Include wx/setup.h for the Unix platform defines generated by configure and + the library compilation options + + Note that it must be included before defining hardware symbols below as they + could be already defined by configure but it must be included after defining + the compiler macros above as msvc/wx/setup.h relies on them under Windows. + */ +#include "wx/setup.h" + +/* + Convenience for any optional classes that use the wxAnyButton base class. + */ +#if wxUSE_TOGGLEBTN || wxUSE_BUTTON + #define wxHAS_ANY_BUTTON +#endif + + +/* + Hardware platform detection. + + VC++ defines _M_xxx symbols. + */ +#if defined(_M_IX86) || defined(i386) || defined(__i386) || defined(__i386__) + #ifndef __INTEL__ + #define __INTEL__ + #endif +#endif /* x86 */ + +#if defined(_M_IA64) + #ifndef __IA64__ + #define __IA64__ + #endif +#endif /* ia64 */ + +#if defined(_M_MPPC) || defined(__PPC__) || defined(__ppc__) + #ifndef __POWERPC__ + #define __POWERPC__ + #endif +#endif /* alpha */ + +#if defined(_M_ALPHA) || defined(__AXP__) + #ifndef __ALPHA__ + #define __ALPHA__ + #endif +#endif /* alpha */ + + +/* + adjust the Unicode setting: wxUSE_UNICODE should be defined as 0 or 1 + and is used by wxWidgets, _UNICODE and/or UNICODE may be defined or used by + the system headers so bring these settings in sync + */ + +/* set wxUSE_UNICODE to 1 if UNICODE or _UNICODE is defined */ +#if defined(_UNICODE) || defined(UNICODE) +# undef wxUSE_UNICODE +# define wxUSE_UNICODE 1 +#else /* !UNICODE */ +# ifndef wxUSE_UNICODE +# define wxUSE_UNICODE 0 +# endif +#endif /* UNICODE/!UNICODE */ + +/* and vice versa: define UNICODE and _UNICODE if wxUSE_UNICODE is 1 */ +#if wxUSE_UNICODE +# ifndef _UNICODE +# define _UNICODE +# endif +# ifndef UNICODE +# define UNICODE +# endif +#endif /* wxUSE_UNICODE */ + + + +/* + OS: then test for generic Unix defines, then for particular flavours and + finally for Unix-like systems + Mac OS X matches this case (__MACH__), prior Mac OS do not. + */ +#if defined(__UNIX__) || defined(__unix) || defined(__unix__) || \ + defined(____SVR4____) || defined(__LINUX__) || defined(__sgi) || \ + defined(__hpux) || defined(__sun) || defined(__SUN__) || defined(_AIX) || \ + defined(__VMS) || defined(__BEOS__) || defined(__MACH__) + +# define __UNIX_LIKE__ + +# ifdef __SGI__ +# ifdef __GNUG__ +# else /* !gcc */ + /* + Note I use the term __SGI_CC__ for both cc and CC, its not a good + idea to mix gcc and cc/CC, the name mangling is different + */ +# define __SGI_CC__ +# endif /* gcc/!gcc */ + + /* system headers use this symbol and not __cplusplus in some places */ +# ifndef _LANGUAGE_C_PLUS_PLUS +# define _LANGUAGE_C_PLUS_PLUS +# endif +# endif /* SGI */ + +# if defined(__INNOTEK_LIBC__) && !defined(_GNU_SOURCE) + /* Ensure visibility of strnlen declaration */ +# define _GNU_SOURCE +# endif + +# if defined(__CYGWIN__) && !defined(_GNU_SOURCE) + /* Ensure visibility of Dl_info and pthread_setconcurrency declarations */ +# define _GNU_SOURCE +# endif + + /* define __HPUX__ for HP-UX where standard macro is __hpux */ +# if defined(__hpux) && !defined(__HPUX__) +# define __HPUX__ +# endif /* HP-UX */ + + /* All of these should already be defined by including configure- + generated setup.h but we wish to support Xcode compilation without + requiring the user to define these himself. + */ +# if defined(__APPLE__) && defined(__MACH__) +# ifndef __UNIX__ +# define __UNIX__ 1 +# endif +# ifndef __BSD__ +# define __BSD__ 1 +# endif + /* __DARWIN__ is our own define to mean OS X or pure Darwin */ +# ifndef __DARWIN__ +# define __DARWIN__ 1 +# endif + /* OS X uses unsigned long size_t for both ILP32 and LP64 modes. */ +# if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG) +# define wxSIZE_T_IS_ULONG +# endif +# endif + +/* + OS: Windows + */ +#elif defined(__WINDOWS__) + + /* to be changed for Win64! */ +# ifndef __WIN32__ +# error "__WIN32__ should be defined for Win32 and Win64, Win16 is not supported" +# endif + + /* size_t is the same as unsigned int for all Windows compilers we know, */ + /* so define it if it hadn't been done by configure yet */ +# if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG) && !defined(__WIN64__) +# define wxSIZE_T_IS_UINT +# endif +#else +# error "Unknown platform." +#endif /* OS */ + +/* + if we're on a Unix system but didn't use configure (so that setup.h didn't + define __UNIX__), do define __UNIX__ now + */ +#if !defined(__UNIX__) && defined(__UNIX_LIKE__) +# define __UNIX__ +#endif /* Unix */ + +#if defined(__WXMOTIF__) || defined(__WXX11__) +# define __X__ +#endif + +/* + We get "Large Files (ILP32) not supported in strict ANSI mode." #error + from HP-UX standard headers when compiling with g++ without this: + */ +#if defined(__HPUX__) && !defined(__STDC_EXT__) +# define __STDC_EXT__ 1 +#endif + +/* Force linking against required libraries under Windows: */ +#if defined __WINDOWS__ +# include "wx/msw/libraries.h" +#endif + +/* + Note that wx/msw/gccpriv.h must be included after defining UNICODE and + _UNICODE macros as it includes _mingw.h which relies on them being set. + */ +#if ( defined( __GNUWIN32__ ) || defined( __MINGW32__ ) || \ + ( defined( __CYGWIN__ ) && defined( __WINDOWS__ ) ) ) && \ + !defined(__WXMOTIF__) && \ + !defined(__WXX11__) +# include "wx/msw/gccpriv.h" +#else +# undef wxCHECK_W32API_VERSION +# define wxCHECK_W32API_VERSION(maj, min) (0) +# undef wxCHECK_MINGW32_VERSION +# define wxCHECK_MINGW32_VERSION( major, minor ) (0) +# define wxDECL_FOR_MINGW32_ALWAYS(rettype, func, params) +# define wxDECL_FOR_STRICT_MINGW32(rettype, func, params) +#endif + + +/* + Handle Darwin gcc universal compilation. Don't do this in an Apple- + specific case since no sane compiler should be defining either + __BIG_ENDIAN__ or __LITTLE_ENDIAN__ unless it really is generating + code that will be hosted on a machine with the appropriate endianness. + If a compiler defines neither, assume the user or configure set + WORDS_BIGENDIAN appropriately. + */ +#if defined(__BIG_ENDIAN__) +# undef WORDS_BIGENDIAN +# define WORDS_BIGENDIAN 1 +#elif defined(__LITTLE_ENDIAN__) +# undef WORDS_BIGENDIAN +#elif defined(__WXMAC__) && !defined(WORDS_BIGENDIAN) +/* According to Stefan even ancient Mac compilers defined __BIG_ENDIAN__ */ +# warning "Compiling wxMac with probably wrong endianness" +#endif +/* also the 32/64 bit universal builds must be handled accordingly */ +#ifdef __DARWIN__ +# ifdef __LP64__ +# undef SIZEOF_VOID_P +# undef SIZEOF_LONG +# undef SIZEOF_SIZE_T +# define SIZEOF_VOID_P 8 +# define SIZEOF_LONG 8 +# define SIZEOF_SIZE_T 8 +# else +# undef SIZEOF_VOID_P +# undef SIZEOF_LONG +# undef SIZEOF_SIZE_T +# define SIZEOF_VOID_P 4 +# define SIZEOF_LONG 4 +# define SIZEOF_SIZE_T 4 +# endif +#endif + +/* + Define various OS X symbols before including wx/chkconf.h which uses them. + + __WXOSX_MAC__ means Mac OS X, non embedded + __WXOSX_IPHONE__ means OS X iPhone + */ + +/* + Normally all of __WXOSX_XXX__, __WXOSX__ and __WXMAC__ are defined by + configure but ensure that we also define them if configure was not used for + whatever reason. + + The primary symbol remains __WXOSX_XXX__ one, __WXOSX__ exists to allow + checking for any OS X port (Cocoa) and __WXMAC__ is an old name + for it. + */ +#if defined(__WXOSX_COCOA__) || defined(__WXOSX_IPHONE__) +# ifndef __WXOSX__ +# define __WXOSX__ 1 +# endif +# ifndef __WXMAC__ +# define __WXMAC__ 1 +# endif +#endif + +#ifdef __WXOSX__ +/* setup precise defines according to sdk used */ +# include <TargetConditionals.h> +# include <Availability.h> +# if defined(__WXOSX_IPHONE__) +# if !( defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE ) +# error "incorrect SDK for an iPhone build" +# endif +# else +# if wxUSE_GUI && !defined(__WXOSX_COCOA__) +# error "one of __WXOSX_IPHONE__ or __WXOSX_COCOA__ must be defined for the GUI build" +# endif +# if !( defined(TARGET_OS_MAC) && TARGET_OS_MAC ) +# error "incorrect SDK for a Mac OS X build" +# endif +# define __WXOSX_MAC__ 1 +# endif +#endif + +#ifdef __WXOSX_MAC__ +# if defined(__MACH__) +# include <Availability.h> +# ifndef MAC_OS_X_VERSION_10_4 +# define MAC_OS_X_VERSION_10_4 1040 +# endif +# ifndef MAC_OS_X_VERSION_10_5 +# define MAC_OS_X_VERSION_10_5 1050 +# endif +# ifndef MAC_OS_X_VERSION_10_6 +# define MAC_OS_X_VERSION_10_6 1060 +# endif +# ifndef MAC_OS_X_VERSION_10_7 +# define MAC_OS_X_VERSION_10_7 1070 +# endif +# ifndef MAC_OS_X_VERSION_10_8 +# define MAC_OS_X_VERSION_10_8 1080 +# endif +# ifndef MAC_OS_X_VERSION_10_9 +# define MAC_OS_X_VERSION_10_9 1090 +# endif +# ifndef MAC_OS_X_VERSION_10_10 +# define MAC_OS_X_VERSION_10_10 101000 +# endif +# ifndef MAC_OS_X_VERSION_10_11 +# define MAC_OS_X_VERSION_10_11 101100 +# endif +# ifndef MAC_OS_X_VERSION_10_12 +# define MAC_OS_X_VERSION_10_12 101200 +# endif +# ifndef MAC_OS_X_VERSION_10_13 +# define MAC_OS_X_VERSION_10_13 101300 +# endif +# ifndef MAC_OS_X_VERSION_10_14 +# define MAC_OS_X_VERSION_10_14 101400 +# endif +# ifndef MAC_OS_X_VERSION_10_15 +# define MAC_OS_X_VERSION_10_15 101500 +# endif +# ifndef MAC_OS_X_VERSION_10_16 +# define MAC_OS_X_VERSION_10_16 101600 +# endif +# ifndef MAC_OS_VERSION_11_0 +# define MAC_OS_VERSION_11_0 110000 +# endif +# if __MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_13 +# ifndef NSAppKitVersionNumber10_10 +# define NSAppKitVersionNumber10_10 1343 +# endif +# ifndef NSAppKitVersionNumber10_11 +# define NSAppKitVersionNumber10_11 1404 +# endif +# endif +# else +# error "only mach-o configurations are supported" +# endif +#endif + +/* + This is obsolete and kept for backwards compatibility only. + */ +#if defined(__WXOSX__) +# define __WXOSX_OR_COCOA__ 1 +#endif + +/* + check the consistency of the settings in setup.h: note that this must be + done after setting wxUSE_UNICODE correctly as it is used in wx/chkconf.h + and after defining the compiler macros which are used in it too + */ +#include "wx/chkconf.h" + + +/* These macros exist only for compatibility, don't use them in the new code */ +#define wxUSE_IOSTREAMH 0 +#define wxSTD std:: + +/* On OpenVMS with the most recent HP C++ compiler some function (i.e. wscanf) + * are only available in the std-namespace. (BUG???) + */ +#if defined( __VMS ) && (__DECCXX_VER >= 70100000) && !defined(__STD_CFRONT) && !defined( __NONAMESPACE_STD ) +# define wxVMS_USE_STD std:: +#else +# define wxVMS_USE_STD +#endif + +#ifdef __VMS +#define XtDisplay XTDISPLAY +#ifdef __WXMOTIF__ +#define XtParent XTPARENT +#define XtScreen XTSCREEN +#define XtWindow XTWINDOW +#endif +#endif + +/* Choose which method we will use for updating menus + * - in OnIdle, or when we receive a wxEVT_MENU_OPEN event. + * Presently, only Windows, OS X and GTK+ support wxEVT_MENU_OPEN. + */ +#ifndef wxUSE_IDLEMENUUPDATES +# if (defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXOSX__)) && !defined(__WXUNIVERSAL__) +# define wxUSE_IDLEMENUUPDATES 0 +# else +# define wxUSE_IDLEMENUUPDATES 1 +# endif +#endif + +/* + * Define symbols that are not yet in + * configure or possibly some setup.h files. + * They will need to be added. + */ + +#ifndef wxUSE_FILECONFIG +# if wxUSE_CONFIG && wxUSE_TEXTFILE +# define wxUSE_FILECONFIG 1 +# else +# define wxUSE_FILECONFIG 0 +# endif +#endif + +#ifndef wxUSE_HOTKEY +# define wxUSE_HOTKEY 0 +#endif + +#if !defined(wxUSE_WXDIB) && defined(__WXMSW__) +# define wxUSE_WXDIB 1 +#endif + +/* + Optionally supported C++ features. + */ + +/* + RTTI: if it is disabled in build/msw/makefile.* then this symbol will + already be defined but it's also possible to do it from configure (with + g++) or by editing project files with MSVC so test for it here too. + */ +#ifndef wxNO_RTTI + /* + Only 4.3 defines __GXX_RTTI by default so its absence is not an + indication of disabled RTTI with the previous versions. + */ +# if defined(__clang__) +# if !__has_feature(cxx_rtti) +# define wxNO_RTTI +# endif +# elif wxCHECK_GCC_VERSION(4, 3) +# ifndef __GXX_RTTI +# define wxNO_RTTI +# endif +# elif defined(_MSC_VER) +# ifndef _CPPRTTI +# define wxNO_RTTI +# endif +# endif +#endif /* wxNO_RTTI */ + +#endif /* _WX_PLATFORM_H_ */ diff --git a/lib/wxWidgets/include/wx/platinfo.h b/lib/wxWidgets/include/wx/platinfo.h new file mode 100644 index 0000000..a256aa0 --- /dev/null +++ b/lib/wxWidgets/include/wx/platinfo.h @@ -0,0 +1,446 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/platinfo.h +// Purpose: declaration of the wxPlatformInfo class +// Author: Francesco Montorsi +// Modified by: +// Created: 07.07.2006 (based on wxToolkitInfo) +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PLATINFO_H_ +#define _WX_PLATINFO_H_ + +#include "wx/string.h" + +// ---------------------------------------------------------------------------- +// wxPlatformInfo enums & structs +// ---------------------------------------------------------------------------- + +// VERY IMPORTANT: when changing these enum values, also change the relative +// string tables in src/common/platinfo.cpp + + +// families & sub-families of operating systems +enum wxOperatingSystemId +{ + wxOS_UNKNOWN = 0, // returned on error + + wxOS_MAC_OS = 1 << 0, // Apple Mac OS 8/9/X with Mac paths + wxOS_MAC_OSX_DARWIN = 1 << 1, // Apple Mac OS X with Unix paths + wxOS_MAC = wxOS_MAC_OS|wxOS_MAC_OSX_DARWIN, + + wxOS_WINDOWS_9X = 1 << 2, // obsolete + wxOS_WINDOWS_NT = 1 << 3, // obsolete + wxOS_WINDOWS_MICRO = 1 << 4, // obsolete + wxOS_WINDOWS_CE = 1 << 5, // obsolete + wxOS_WINDOWS = wxOS_WINDOWS_9X | + wxOS_WINDOWS_NT | + wxOS_WINDOWS_MICRO | + wxOS_WINDOWS_CE, + + wxOS_UNIX_LINUX = 1 << 6, // Linux + wxOS_UNIX_FREEBSD = 1 << 7, // FreeBSD + wxOS_UNIX_OPENBSD = 1 << 8, // OpenBSD + wxOS_UNIX_NETBSD = 1 << 9, // NetBSD + wxOS_UNIX_SOLARIS = 1 << 10, // SunOS + wxOS_UNIX_AIX = 1 << 11, // AIX + wxOS_UNIX_HPUX = 1 << 12, // HP/UX + wxOS_UNIX = wxOS_UNIX_LINUX | + wxOS_UNIX_FREEBSD | + wxOS_UNIX_OPENBSD | + wxOS_UNIX_NETBSD | + wxOS_UNIX_SOLARIS | + wxOS_UNIX_AIX | + wxOS_UNIX_HPUX, + + // 1<<13 and 1<<14 available for other Unix flavours + + wxOS_DOS = 1 << 15, // obsolete + wxOS_OS2 = 1 << 16 // obsolete +}; + +// list of wxWidgets ports - some of them can be used with more than +// a single toolkit. +enum wxPortId +{ + wxPORT_UNKNOWN = 0, // returned on error + + wxPORT_BASE = 1 << 0, // wxBase, no native toolkit used + + wxPORT_MSW = 1 << 1, // wxMSW, native toolkit is Windows API + wxPORT_MOTIF = 1 << 2, // wxMotif, using [Open]Motif or Lesstif + wxPORT_GTK = 1 << 3, // wxGTK, using GTK+ 1.x, 2.x, 3.x + wxPORT_DFB = 1 << 4, // wxDFB, using wxUniversal + wxPORT_X11 = 1 << 5, // wxX11, using wxUniversal + wxPORT_PM = 1 << 6, // obsolete + wxPORT_OS2 = wxPORT_PM, // obsolete + wxPORT_MAC = 1 << 7, // wxOSX (former wxMac), using Cocoa or iPhone API + wxPORT_OSX = wxPORT_MAC, // wxOSX, using Cocoa or iPhone API + wxPORT_COCOA = 1 << 8, // wxCocoa, using Cocoa NextStep/Mac API + wxPORT_WINCE = 1 << 9, // obsolete + wxPORT_QT = 1 << 10 // wxQT, using Qt 5+ +}; + +// architecture bitness of the operating system +// (regardless of the build environment of wxWidgets library - see +// wxIsPlatform64bit documentation for more info) + +enum wxBitness +{ + wxBITNESS_INVALID = -1, // returned on error + + wxBITNESS_32, + wxBITNESS_64, + + wxBITNESS_MAX +}; + +typedef wxBitness wxArchitecture; + +const wxArchitecture + wxARCH_INVALID = wxBITNESS_INVALID, + wxARCH_32 = wxBITNESS_32, + wxARCH_64 = wxBITNESS_64, + wxARCH_MAX = wxBITNESS_MAX; + + +// endian-ness of the machine +enum wxEndianness +{ + wxENDIAN_INVALID = -1, // returned on error + + wxENDIAN_BIG, // 4321 + wxENDIAN_LITTLE, // 1234 + wxENDIAN_PDP, // 3412 + + wxENDIAN_MAX +}; + +// information about a linux distro returned by the lsb_release utility +struct wxLinuxDistributionInfo +{ + wxString Id; + wxString Release; + wxString CodeName; + wxString Description; + + bool operator==(const wxLinuxDistributionInfo& ldi) const + { + return Id == ldi.Id && + Release == ldi.Release && + CodeName == ldi.CodeName && + Description == ldi.Description; + } + + bool operator!=(const wxLinuxDistributionInfo& ldi) const + { return !(*this == ldi); } +}; + +// Platform ID is a very broad platform categorization used in external files +// (e.g. XRC), so the values here must remain stable and cannot be changed. +class wxPlatformId +{ +public: + // Returns the preferred current platform name, use MatchesCurrent() to + // check if the name is one of the possibly several names corresponding to + // the current platform. + static wxString GetCurrent() + { +#ifdef __WINDOWS__ + return wxASCII_STR("msw"); +#elif defined(__APPLE__) + return wxASCII_STR("mac"); +#elif defined(__UNIX__) + return wxASCII_STR("unix"); +#else + return wxString(); +#endif + } + + // Returns true if the given string matches the current platform. + static bool MatchesCurrent(const wxString& s) + { + // Under MSW we also support "win" platform name for compatibility with + // the existing XRC files using it. +#ifdef __WINDOWS__ + if (s == wxASCII_STR("win")) + return true; +#endif // __WINDOWS__ + + return s == GetCurrent(); + } +}; + +// ---------------------------------------------------------------------------- +// wxPlatformInfo +// ---------------------------------------------------------------------------- + +// Information about the toolkit that the app is running under and some basic +// platform and architecture bitness info +class WXDLLIMPEXP_BASE wxPlatformInfo +{ +public: + wxPlatformInfo(); + wxPlatformInfo(wxPortId pid, + int tkMajor = -1, int tkMinor = -1, + wxOperatingSystemId id = wxOS_UNKNOWN, + int osMajor = -1, int osMinor = -1, + wxBitness bitness = wxBITNESS_INVALID, + wxEndianness endian = wxENDIAN_INVALID, + bool usingUniversal = false); + + // default copy ctor, assignment operator and dtor are ok + + bool operator==(const wxPlatformInfo &t) const; + + bool operator!=(const wxPlatformInfo &t) const + { return !(*this == t); } + + // Gets a wxPlatformInfo already initialized with the values for + // the currently running platform. + static const wxPlatformInfo& Get(); + + + + // string -> enum conversions + // --------------------------------- + + static wxOperatingSystemId GetOperatingSystemId(const wxString &name); + static wxPortId GetPortId(const wxString &portname); + + static wxBitness GetBitness(const wxString &bitness); + wxDEPRECATED_MSG("Use GetBitness() instead") + static wxArchitecture GetArch(const wxString &arch); + static wxEndianness GetEndianness(const wxString &end); + + // enum -> string conversions + // --------------------------------- + + static wxString GetOperatingSystemFamilyName(wxOperatingSystemId os); + static wxString GetOperatingSystemIdName(wxOperatingSystemId os); + static wxString GetPortIdName(wxPortId port, bool usingUniversal); + static wxString GetPortIdShortName(wxPortId port, bool usingUniversal); + + static wxString GetBitnessName(wxBitness bitness); + wxDEPRECATED_MSG("Use GetBitnessName() instead") + static wxString GetArchName(wxArchitecture arch); + static wxString GetEndiannessName(wxEndianness end); + + + // getters + // ----------------- + + int GetOSMajorVersion() const + { return m_osVersionMajor; } + int GetOSMinorVersion() const + { return m_osVersionMinor; } + int GetOSMicroVersion() const + { return m_osVersionMicro; } + + // return true if the OS version >= major.minor + bool CheckOSVersion(int major, int minor, int micro = 0) const; + + int GetToolkitMajorVersion() const + { return m_tkVersionMajor; } + int GetToolkitMinorVersion() const + { return m_tkVersionMinor; } + int GetToolkitMicroVersion() const + { return m_tkVersionMicro; } + + bool CheckToolkitVersion(int major, int minor, int micro = 0) const + { + return DoCheckVersion(GetToolkitMajorVersion(), + GetToolkitMinorVersion(), + GetToolkitMicroVersion(), + major, + minor, + micro); + } + + bool IsUsingUniversalWidgets() const + { return m_usingUniversal; } + + wxOperatingSystemId GetOperatingSystemId() const + { return m_os; } + wxLinuxDistributionInfo GetLinuxDistributionInfo() const + { return m_ldi; } + wxPortId GetPortId() const + { return m_port; } + wxBitness GetBitness() const + { return m_bitness; } + wxDEPRECATED_MSG("Use GetBitness() instead") + wxArchitecture GetArchitecture() const + { return GetBitness(); } + wxEndianness GetEndianness() const + { return m_endian; } + + + // string getters + // ----------------- + + wxString GetOperatingSystemFamilyName() const + { return GetOperatingSystemFamilyName(m_os); } + wxString GetOperatingSystemIdName() const + { return GetOperatingSystemIdName(m_os); } + wxString GetPortIdName() const + { return GetPortIdName(m_port, m_usingUniversal); } + wxString GetPortIdShortName() const + { return GetPortIdShortName(m_port, m_usingUniversal); } + wxString GetBitnessName() const + { return GetBitnessName(m_bitness); } + wxDEPRECATED_MSG("Use GetBitnessName() instead") + wxString GetArchName() const + { return GetBitnessName(); } + wxString GetEndiannessName() const + { return GetEndiannessName(m_endian); } + wxString GetCpuArchitectureName() const + { return m_cpuArch; } + wxString GetNativeCpuArchitectureName() const + { return m_nativeCpuArch; } + wxString GetOperatingSystemDescription() const + { return m_osDesc; } + wxString GetDesktopEnvironment() const + { return m_desktopEnv; } + + static wxString GetOperatingSystemDirectory(); + // doesn't make sense to store inside wxPlatformInfo the OS directory, + // thus this function is static; note that this function simply calls + // wxGetOSDirectory() and is here just to make it easier for the user to + // find it that feature (global functions can be difficult to find in the docs) + + // setters + // ----------------- + + void SetOSVersion(int major, int minor, int micro = 0) + { + m_osVersionMajor = major; + m_osVersionMinor = minor; + m_osVersionMicro = micro; + } + + void SetToolkitVersion(int major, int minor, int micro = 0) + { + m_tkVersionMajor = major; + m_tkVersionMinor = minor; + m_tkVersionMicro = micro; + } + + void SetOperatingSystemId(wxOperatingSystemId n) + { m_os = n; } + void SetOperatingSystemDescription(const wxString& desc) + { m_osDesc = desc; } + void SetPortId(wxPortId n) + { m_port = n; } + void SetBitness(wxBitness n) + { m_bitness = n; } + wxDEPRECATED_MSG("Use SetBitness() instead") + void SetArchitecture(wxBitness n) + { SetBitness(n); } + void SetEndianness(wxEndianness n) + { m_endian = n; } + void SetCpuArchitectureName(const wxString& cpuArch) + { m_cpuArch = cpuArch; } + void SetNativeCpuArchitectureName(const wxString& cpuArch) + { m_nativeCpuArch = cpuArch; } + + void SetDesktopEnvironment(const wxString& de) + { m_desktopEnv = de; } + void SetLinuxDistributionInfo(const wxLinuxDistributionInfo& di) + { m_ldi = di; } + + + // miscellaneous + // ----------------- + + bool IsOk() const + { + return m_osVersionMajor != -1 && m_osVersionMinor != -1 && + m_osVersionMicro != -1 && + m_os != wxOS_UNKNOWN && + !m_osDesc.IsEmpty() && + m_tkVersionMajor != -1 && m_tkVersionMinor != -1 && + m_tkVersionMicro != -1 && + m_port != wxPORT_UNKNOWN && + m_bitness != wxBITNESS_INVALID && + m_endian != wxENDIAN_INVALID; + + // do not check linux-specific info; it's ok to have them empty + } + + +protected: + static bool DoCheckVersion(int majorCur, int minorCur, int microCur, + int major, int minor, int micro) + { + return majorCur > major + || (majorCur == major && minorCur > minor) + || (majorCur == major && minorCur == minor && microCur >= micro); + } + + bool m_initializedForCurrentPlatform; + + void InitForCurrentPlatform(); + + + // OS stuff + // ----------------- + + // Version of the OS; valid if m_os != wxOS_UNKNOWN + // (-1 means not initialized yet). + int m_osVersionMajor, + m_osVersionMinor, + m_osVersionMicro; + + // Operating system ID. + wxOperatingSystemId m_os; + + // Operating system description. + wxString m_osDesc; + + + // linux-specific + // ----------------- + + wxString m_desktopEnv; + wxLinuxDistributionInfo m_ldi; + + + // toolkit + // ----------------- + + // Version of the underlying toolkit + // (-1 means not initialized yet; zero means no toolkit). + int m_tkVersionMajor, m_tkVersionMinor, m_tkVersionMicro; + + // name of the wxWidgets port + wxPortId m_port; + + // is using wxUniversal widgets? + bool m_usingUniversal; + + + // others + // ----------------- + + // architecture bitness of the OS/machine + wxBitness m_bitness; + + // endianness of the machine + wxEndianness m_endian; + + // CPU architecture family name, possibly empty if unknown + wxString m_cpuArch; + + // native CPU architecture family name, possibly empty if unknown + wxString m_nativeCpuArch; +}; + +// Returns true only for MSW programs running under Wine. +#ifdef __WINDOWS__ +WXDLLIMPEXP_BASE bool wxIsRunningUnderWine(); +#else // !__WINDOWS__ +inline bool wxIsRunningUnderWine() { return false; } +#endif // __WINDOWS__/!__WINDOWS__ + +#endif // _WX_PLATINFO_H_ diff --git a/lib/wxWidgets/include/wx/popupwin.h b/lib/wxWidgets/include/wx/popupwin.h new file mode 100644 index 0000000..c396409 --- /dev/null +++ b/lib/wxWidgets/include/wx/popupwin.h @@ -0,0 +1,253 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/popupwin.h +// Purpose: wxPopupWindow interface declaration +// Author: Vadim Zeitlin +// Modified by: +// Created: 06.01.01 +// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_POPUPWIN_H_BASE_ +#define _WX_POPUPWIN_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_POPUPWIN + +// ---------------------------------------------------------------------------- +// wxPopupWindow specific flags +// ---------------------------------------------------------------------------- + +// This flag can be used in MSW if some controls are not working with the +// default popup style. +#define wxPU_CONTAINS_CONTROLS 0x0001 + + +#include "wx/nonownedwnd.h" + +// ---------------------------------------------------------------------------- +// wxPopupWindow: a special kind of top level window used for popup menus, +// combobox popups and such. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPopupWindowBase : public wxNonOwnedWindow +{ +public: + wxPopupWindowBase() { } + virtual ~wxPopupWindowBase(); + + // create the popup window + // + // style may only contain border flags + bool Create(wxWindow *parent, int style = wxBORDER_NONE); + + // move the popup window to the right position, i.e. such that it is + // entirely visible + // + // the popup is positioned at ptOrigin + size if it opens below and to the + // right (default), at ptOrigin - sizePopup if it opens above and to the + // left &c + // + // the point must be given in screen coordinates! + virtual void Position(const wxPoint& ptOrigin, + const wxSize& size); + + virtual bool IsTopLevel() const wxOVERRIDE { return true; } + + wxDECLARE_NO_COPY_CLASS(wxPopupWindowBase); +}; + + +// include the real class declaration +#if defined(__WXMSW__) + #include "wx/msw/popupwin.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/popupwin.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/popupwin.h" +#elif defined(__WXX11__) + #include "wx/x11/popupwin.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/popupwin.h" +#elif defined(__WXDFB__) + #include "wx/dfb/popupwin.h" +#elif defined(__WXMAC__) + #include "wx/osx/popupwin.h" +#elif defined(__WXQT__) + #include "wx/qt/popupwin.h" +#else + #error "wxPopupWindow is not supported under this platform." +#endif + +// ---------------------------------------------------------------------------- +// wxPopupTransientWindow: a wxPopupWindow which disappears automatically +// when the user clicks mouse outside it or if it loses focus in any other way +// ---------------------------------------------------------------------------- + +// Define the public API of wxPopupTransientWindow: +class WXDLLIMPEXP_CORE wxPopupTransientWindowBase : public wxPopupWindow +{ +public: + // popup the window (this will show it too) and keep focus at winFocus + // (or itself if it's NULL), dismiss the popup if we lose focus + virtual void Popup(wxWindow *focus = NULL) = 0; + + // hide the window + virtual void Dismiss() = 0; + + // can the window be dismissed now? + // + // VZ: where is this used?? + virtual bool CanDismiss() + { return true; } + + // called when a mouse is pressed while the popup is shown: return true + // from here to prevent its normal processing by the popup (which consists + // in dismissing it if the mouse is clicked outside it) + virtual bool ProcessLeftDown(wxMouseEvent& WXUNUSED(event)) + { return false; } + + // Override to implement delayed destruction of this window. + virtual bool Destroy() wxOVERRIDE; + +protected: + // this is called when the popup is disappeared because of anything + // else but direct call to Dismiss() + virtual void OnDismiss() { } + + // dismiss and notify the derived class + void DismissAndNotify() + { + Dismiss(); + OnDismiss(); + } +}; + +#ifdef __WXMSW__ + +class WXDLLIMPEXP_CORE wxPopupTransientWindow : public wxPopupTransientWindowBase +{ +public: + // ctors + wxPopupTransientWindow() { } + wxPopupTransientWindow(wxWindow *parent, int style = wxBORDER_NONE) + { Create(parent, style); } + + // Implement base class pure virtuals. + virtual void Popup(wxWindow *focus = NULL) wxOVERRIDE; + virtual void Dismiss() wxOVERRIDE; + + // Override to handle WM_NCACTIVATE. + virtual bool MSWHandleMessage(WXLRESULT *result, + WXUINT message, + WXWPARAM wParam, + WXLPARAM lParam) wxOVERRIDE; + + // Override to dismiss the popup. + virtual void MSWDismissUnfocusedPopup() wxOVERRIDE; + +private: + void DismissOnDeactivate(); + + wxDECLARE_DYNAMIC_CLASS(wxPopupTransientWindow); + wxDECLARE_NO_COPY_CLASS(wxPopupTransientWindow); +}; + +#else // !__WXMSW__ + +class WXDLLIMPEXP_FWD_CORE wxPopupWindowHandler; +class WXDLLIMPEXP_FWD_CORE wxPopupFocusHandler; + +class WXDLLIMPEXP_CORE wxPopupTransientWindow : public wxPopupTransientWindowBase +{ +public: + // ctors + wxPopupTransientWindow() { Init(); } + wxPopupTransientWindow(wxWindow *parent, int style = wxBORDER_NONE); + + virtual ~wxPopupTransientWindow(); + + // Implement base class pure virtuals. + virtual void Popup(wxWindow *focus = NULL) wxOVERRIDE; + virtual void Dismiss() wxOVERRIDE; + + // Overridden to grab the input on some platforms + virtual bool Show( bool show = true ) wxOVERRIDE; + +protected: + // common part of all ctors + void Init(); + + // remove our event handlers + void PopHandlers(); + + // get alerted when child gets deleted from under us + void OnDestroy(wxWindowDestroyEvent& event); + +#if defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON + // Check if the mouse needs to be captured or released: we must release + // when it's inside our window if we want the embedded controls to work. + void OnIdle(wxIdleEvent& event); +#endif + + // the child of this popup if any + wxWindow *m_child; + + // the window which has the focus while we're shown + wxWindow *m_focus; + + // these classes may call our DismissAndNotify() + friend class wxPopupWindowHandler; + friend class wxPopupFocusHandler; + + // the handlers we created, may be NULL (if not, must be deleted) + wxPopupWindowHandler *m_handlerPopup; + wxPopupFocusHandler *m_handlerFocus; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxPopupTransientWindow); + wxDECLARE_NO_COPY_CLASS(wxPopupTransientWindow); +}; + +#endif // __WXMSW__/!__WXMSW__ + +#if wxUSE_COMBOBOX && defined(__WXUNIVERSAL__) + +// ---------------------------------------------------------------------------- +// wxPopupComboWindow: wxPopupTransientWindow used by wxComboBox +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxComboBox; +class WXDLLIMPEXP_FWD_CORE wxComboCtrl; + +class WXDLLIMPEXP_CORE wxPopupComboWindow : public wxPopupTransientWindow +{ +public: + wxPopupComboWindow() { m_combo = NULL; } + wxPopupComboWindow(wxComboCtrl *parent); + + bool Create(wxComboCtrl *parent); + + // position the window correctly relatively to the combo + void PositionNearCombo(); + +protected: + // notify the combo here + virtual void OnDismiss(); + + // forward the key presses to the combobox + void OnKeyDown(wxKeyEvent& event); + + // the parent combobox + wxComboCtrl *m_combo; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxPopupComboWindow); +}; + +#endif // wxUSE_COMBOBOX && defined(__WXUNIVERSAL__) + +#endif // wxUSE_POPUPWIN + +#endif // _WX_POPUPWIN_H_BASE_ diff --git a/lib/wxWidgets/include/wx/position.h b/lib/wxWidgets/include/wx/position.h new file mode 100644 index 0000000..bd324e2 --- /dev/null +++ b/lib/wxWidgets/include/wx/position.h @@ -0,0 +1,59 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/position.h +// Purpose: Common structure and methods for positional information. +// Author: Vadim Zeitlin, Robin Dunn, Brad Anderson, Bryan Petty +// Created: 2007-03-13 +// Copyright: (c) 2007 The wxWidgets Team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_POSITION_H_ +#define _WX_POSITION_H_ + +#include "wx/gdicmn.h" + +class WXDLLIMPEXP_CORE wxPosition +{ +public: + wxPosition() : m_row(0), m_column(0) {} + wxPosition(int row, int col) : m_row(row), m_column(col) {} + + // default copy ctor and assignment operator are okay. + + int GetRow() const { return m_row; } + int GetColumn() const { return m_column; } + int GetCol() const { return GetColumn(); } + void SetRow(int row) { m_row = row; } + void SetColumn(int column) { m_column = column; } + void SetCol(int column) { SetColumn(column); } + + bool operator==(const wxPosition& p) const + { return m_row == p.m_row && m_column == p.m_column; } + bool operator!=(const wxPosition& p) const + { return !(*this == p); } + + wxPosition& operator+=(const wxPosition& p) + { m_row += p.m_row; m_column += p.m_column; return *this; } + wxPosition& operator-=(const wxPosition& p) + { m_row -= p.m_row; m_column -= p.m_column; return *this; } + wxPosition& operator+=(const wxSize& s) + { m_row += s.y; m_column += s.x; return *this; } + wxPosition& operator-=(const wxSize& s) + { m_row -= s.y; m_column -= s.x; return *this; } + + wxPosition operator+(const wxPosition& p) const + { return wxPosition(m_row + p.m_row, m_column + p.m_column); } + wxPosition operator-(const wxPosition& p) const + { return wxPosition(m_row - p.m_row, m_column - p.m_column); } + wxPosition operator+(const wxSize& s) const + { return wxPosition(m_row + s.y, m_column + s.x); } + wxPosition operator-(const wxSize& s) const + { return wxPosition(m_row - s.y, m_column - s.x); } + +private: + int m_row; + int m_column; +}; + +#endif // _WX_POSITION_H_ + diff --git a/lib/wxWidgets/include/wx/power.h b/lib/wxWidgets/include/wx/power.h new file mode 100644 index 0000000..eba94b9 --- /dev/null +++ b/lib/wxWidgets/include/wx/power.h @@ -0,0 +1,151 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/power.h +// Purpose: functions and classes for system power management +// Author: Vadim Zeitlin +// Modified by: +// Created: 2006-05-27 +// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_POWER_H_ +#define _WX_POWER_H_ + +#include "wx/event.h" + +// ---------------------------------------------------------------------------- +// power management constants +// ---------------------------------------------------------------------------- + +enum wxPowerType +{ + wxPOWER_SOCKET, + wxPOWER_BATTERY, + wxPOWER_UNKNOWN +}; + +enum wxBatteryState +{ + wxBATTERY_NORMAL_STATE, // system is fully usable + wxBATTERY_LOW_STATE, // start to worry + wxBATTERY_CRITICAL_STATE, // save quickly + wxBATTERY_SHUTDOWN_STATE, // too late + wxBATTERY_UNKNOWN_STATE +}; + +// ---------------------------------------------------------------------------- +// wxPowerEvent is generated when the system online status changes +// ---------------------------------------------------------------------------- + +// currently the power events are only available under Windows, to avoid +// compiling in the code for handling them which is never going to be invoked +// under the other platforms, we define wxHAS_POWER_EVENTS symbol if this event +// is available, it should be used to guard all code using wxPowerEvent +#ifdef __WINDOWS__ + +#define wxHAS_POWER_EVENTS + +class WXDLLIMPEXP_BASE wxPowerEvent : public wxEvent +{ +public: + wxPowerEvent() // just for use by wxRTTI + : m_veto(false) { } + + wxPowerEvent(wxEventType evtType) : wxEvent(wxID_NONE, evtType) + { + m_veto = false; + } + + // Veto the operation (only makes sense with EVT_POWER_SUSPENDING) + void Veto() { m_veto = true; } + + bool IsVetoed() const { return m_veto; } + + + // default copy ctor, assignment operator and dtor are ok + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxPowerEvent(*this); } + +private: + bool m_veto; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxPowerEvent); +}; + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPENDING, wxPowerEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPENDED, wxPowerEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPEND_CANCEL, wxPowerEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_BASE, wxEVT_POWER_RESUME, wxPowerEvent ); + +typedef void (wxEvtHandler::*wxPowerEventFunction)(wxPowerEvent&); + +#define wxPowerEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxPowerEventFunction, func) + +#define EVT_POWER_SUSPENDING(func) \ + wx__DECLARE_EVT0(wxEVT_POWER_SUSPENDING, wxPowerEventHandler(func)) +#define EVT_POWER_SUSPENDED(func) \ + wx__DECLARE_EVT0(wxEVT_POWER_SUSPENDED, wxPowerEventHandler(func)) +#define EVT_POWER_SUSPEND_CANCEL(func) \ + wx__DECLARE_EVT0(wxEVT_POWER_SUSPEND_CANCEL, wxPowerEventHandler(func)) +#define EVT_POWER_RESUME(func) \ + wx__DECLARE_EVT0(wxEVT_POWER_RESUME, wxPowerEventHandler(func)) + +#else // no support for power events + #undef wxHAS_POWER_EVENTS +#endif // support for power events/no support + +// ---------------------------------------------------------------------------- +// wxPowerResourceBlocker +// ---------------------------------------------------------------------------- + +enum wxPowerResourceKind +{ + wxPOWER_RESOURCE_SCREEN, + wxPOWER_RESOURCE_SYSTEM +}; + +class WXDLLIMPEXP_BASE wxPowerResource +{ +public: + static bool Acquire(wxPowerResourceKind kind, + const wxString& reason = wxString()); + static void Release(wxPowerResourceKind kind); +}; + +class wxPowerResourceBlocker +{ +public: + explicit wxPowerResourceBlocker(wxPowerResourceKind kind, + const wxString& reason = wxString()) + : m_kind(kind), + m_acquired(wxPowerResource::Acquire(kind, reason)) + { + } + + bool IsInEffect() const { return m_acquired; } + + ~wxPowerResourceBlocker() + { + if ( m_acquired ) + wxPowerResource::Release(m_kind); + } + +private: + const wxPowerResourceKind m_kind; + const bool m_acquired; + + wxDECLARE_NO_COPY_CLASS(wxPowerResourceBlocker); +}; + +// ---------------------------------------------------------------------------- +// power management functions +// ---------------------------------------------------------------------------- + +// return the current system power state: online or offline +WXDLLIMPEXP_BASE wxPowerType wxGetPowerType(); + +// return approximate battery state +WXDLLIMPEXP_BASE wxBatteryState wxGetBatteryState(); + +#endif // _WX_POWER_H_ diff --git a/lib/wxWidgets/include/wx/preferences.h b/lib/wxWidgets/include/wx/preferences.h new file mode 100644 index 0000000..3461604 --- /dev/null +++ b/lib/wxWidgets/include/wx/preferences.h @@ -0,0 +1,147 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/preferences.h +// Purpose: Declaration of wxPreferencesEditor class. +// Author: Vaclav Slavik +// Created: 2013-02-19 +// Copyright: (c) 2013 Vaclav Slavik <vslavik@fastmail.fm> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PREFERENCES_H_ +#define _WX_PREFERENCES_H_ + +#include "wx/defs.h" + +#if wxUSE_PREFERENCES_EDITOR + +#include "wx/bitmap.h" +#include "wx/bmpbndl.h" +#include "wx/vector.h" + +class WXDLLIMPEXP_FWD_CORE wxWindow; + +class wxPreferencesEditorImpl; + +#if defined(__WXOSX_COCOA__) + // GetLargeIcon() is used + #define wxHAS_PREF_EDITOR_ICONS + // Changes should be applied immediately + #define wxHAS_PREF_EDITOR_APPLY_IMMEDIATELY + // The dialog is shown non-modally. + #define wxHAS_PREF_EDITOR_MODELESS +#elif defined(__WXGTK__) + // Changes should be applied immediately + #define wxHAS_PREF_EDITOR_APPLY_IMMEDIATELY + // The dialog is shown non-modally. + #define wxHAS_PREF_EDITOR_MODELESS +#endif + +// ---------------------------------------------------------------------------- +// wxPreferencesEditor: Native preferences editing +// ---------------------------------------------------------------------------- + +// One page of a preferences window +class WXDLLIMPEXP_CORE wxPreferencesPage +{ +public: + wxPreferencesPage() {} + virtual ~wxPreferencesPage() {} + + // Name of the page, used e.g. for tabs + virtual wxString GetName() const = 0; + + // Return the icon to use for the page. Currently only used on OS X, where + // implementation is required; unused on other platforms. Because of this, + // these methods are not pure virtual but must be implemented if OS X is + // supported. + // + // New code should override GetIcon(), GetLargeIcon() only exists for + // backwards compatibility. + virtual wxBitmapBundle GetIcon() const { return GetLargeIcon(); } + virtual wxBitmap GetLargeIcon() const { return wxBitmap(); } + + // Create a window (usually a wxPanel) for this page. The caller takes + // ownership of the returned window. + virtual wxWindow *CreateWindow(wxWindow *parent) = 0; + + wxDECLARE_NO_COPY_CLASS(wxPreferencesPage); +}; + + +// Helper for implementing some common pages (General, Advanced) +class WXDLLIMPEXP_CORE wxStockPreferencesPage : public wxPreferencesPage +{ +public: + enum Kind + { + Kind_General, + Kind_Advanced + }; + + wxStockPreferencesPage(Kind kind) : m_kind(kind) {} + Kind GetKind() const { return m_kind; } + + virtual wxString GetName() const wxOVERRIDE; +#ifdef __WXOSX_COCOA__ + virtual wxBitmapBundle GetIcon() const wxOVERRIDE; +#endif + +private: + Kind m_kind; +}; + + +// Notice that this class does not inherit from wxWindow. +class WXDLLIMPEXP_CORE wxPreferencesEditor +{ +public: + // Ctor creates an empty editor, use AddPage() to add controls to it. + wxPreferencesEditor(const wxString& title = wxString()); + + // Dtor destroys the dialog if still shown. + virtual ~wxPreferencesEditor(); + + // Add a new page to the editor. The editor takes ownership of the page + // and won't delete it until it is destroyed itself. + void AddPage(wxPreferencesPage *page); + + // Show the preferences dialog or bring it to the top if it's already + // shown. Notice that this method may or may not block depending on the + // platform, i.e. depending on whether the dialog is modal or not. + virtual void Show(wxWindow* parent); + + // Hide the currently shown dialog, if any. This is typically used to + // dismiss the dialog if the object whose preferences it is editing was + // closed. + void Dismiss(); + + // Whether changes to values in the pages should be applied immediately + // (OS X, GTK+) or only when the user clicks OK/Apply (Windows) + static bool ShouldApplyChangesImmediately() + { +#ifdef wxHAS_PREF_EDITOR_APPLY_IMMEDIATELY + return true; +#else + return false; +#endif + } + + // Whether the dialog is shown modally, i.e. Show() blocks, or not. + static bool ShownModally() + { +#ifdef wxHAS_PREF_EDITOR_MODELESS + return false; +#else + return true; +#endif + } + +private: + wxPreferencesEditorImpl* m_impl; + + wxDECLARE_NO_COPY_CLASS(wxPreferencesEditor); +}; + +#endif // wxUSE_PREFERENCES_EDITOR + +#endif // _WX_PREFERENCES_H_ diff --git a/lib/wxWidgets/include/wx/print.h b/lib/wxWidgets/include/wx/print.h new file mode 100644 index 0000000..269f55c --- /dev/null +++ b/lib/wxWidgets/include/wx/print.h @@ -0,0 +1,38 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/print.h +// Purpose: Base header for printer classes +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRINT_H_BASE_ +#define _WX_PRINT_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_PRINTING_ARCHITECTURE + +#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) + +#include "wx/msw/printwin.h" + +#elif defined(__WXMAC__) + +#include "wx/osx/printmac.h" + + +#elif defined(__WXQT__) + +#include "wx/qt/printqt.h" +#else + +#include "wx/generic/printps.h" + +#endif + +#endif // wxUSE_PRINTING_ARCHITECTURE +#endif + // _WX_PRINT_H_BASE_ diff --git a/lib/wxWidgets/include/wx/printdlg.h b/lib/wxWidgets/include/wx/printdlg.h new file mode 100644 index 0000000..ecb2ce8 --- /dev/null +++ b/lib/wxWidgets/include/wx/printdlg.h @@ -0,0 +1,121 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/printdlg.h +// Purpose: Base header and class for print dialogs +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRINTDLG_H_BASE_ +#define _WX_PRINTDLG_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_PRINTING_ARCHITECTURE + +#include "wx/event.h" +#include "wx/dialog.h" +#include "wx/intl.h" +#include "wx/cmndata.h" + + +// --------------------------------------------------------------------------- +// wxPrintDialogBase: interface for the dialog for printing +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPrintDialogBase : public wxDialog +{ +public: + wxPrintDialogBase() { } + wxPrintDialogBase(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString &title = wxEmptyString, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE); + + virtual wxPrintDialogData& GetPrintDialogData() = 0; + virtual wxPrintData& GetPrintData() = 0; + virtual wxDC *GetPrintDC() = 0; + +private: + wxDECLARE_ABSTRACT_CLASS(wxPrintDialogBase); + wxDECLARE_NO_COPY_CLASS(wxPrintDialogBase); +}; + +// --------------------------------------------------------------------------- +// wxPrintDialog: the dialog for printing. +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPrintDialog : public wxObject +{ +public: + wxPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL); + wxPrintDialog(wxWindow *parent, wxPrintData* data); + virtual ~wxPrintDialog(); + + virtual int ShowModal(); + + virtual wxPrintDialogData& GetPrintDialogData(); + virtual wxPrintData& GetPrintData(); + virtual wxDC *GetPrintDC(); + +private: + wxPrintDialogBase *m_pimpl; + +private: + wxDECLARE_DYNAMIC_CLASS(wxPrintDialog); + wxDECLARE_NO_COPY_CLASS(wxPrintDialog); +}; + +// --------------------------------------------------------------------------- +// wxPageSetupDialogBase: interface for the page setup dialog +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPageSetupDialogBase: public wxDialog +{ +public: + wxPageSetupDialogBase() { } + wxPageSetupDialogBase(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString &title = wxEmptyString, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE); + + virtual wxPageSetupDialogData& GetPageSetupDialogData() = 0; + +private: + wxDECLARE_ABSTRACT_CLASS(wxPageSetupDialogBase); + wxDECLARE_NO_COPY_CLASS(wxPageSetupDialogBase); +}; + +// --------------------------------------------------------------------------- +// wxPageSetupDialog: the page setup dialog +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPageSetupDialog: public wxObject +{ +public: + wxPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = NULL); + virtual ~wxPageSetupDialog(); + + int ShowModal(); + wxPageSetupDialogData& GetPageSetupDialogData(); + // old name + wxPageSetupDialogData& GetPageSetupData(); + +private: + wxPageSetupDialogBase *m_pimpl; + +private: + wxDECLARE_DYNAMIC_CLASS(wxPageSetupDialog); + wxDECLARE_NO_COPY_CLASS(wxPageSetupDialog); +}; + +#endif + +#endif + // _WX_PRINTDLG_H_BASE_ diff --git a/lib/wxWidgets/include/wx/private/addremovectrl.h b/lib/wxWidgets/include/wx/private/addremovectrl.h new file mode 100644 index 0000000..13a10ad --- /dev/null +++ b/lib/wxWidgets/include/wx/private/addremovectrl.h @@ -0,0 +1,156 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/addremovectrl.h +// Purpose: wxAddRemoveImpl helper class declaration +// Author: Vadim Zeitlin +// Created: 2015-02-04 +// Copyright: (c) 2015 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_ADDREMOVECTRL_H_ +#define _WX_PRIVATE_ADDREMOVECTRL_H_ + +#include "wx/button.h" +#include "wx/sizer.h" + +// ---------------------------------------------------------------------------- +// wxAddRemoveImplBase: implementation-only part of wxAddRemoveCtrl, base part +// ---------------------------------------------------------------------------- + +class wxAddRemoveImplBase +{ +public: + // Base class ctor just initializes the associated adaptor, the derived + // class is supposed to create the buttons and layout everything. + // + // Takes ownership of the adaptor pointer. + explicit wxAddRemoveImplBase(wxAddRemoveAdaptor* adaptor, + wxAddRemoveCtrl* WXUNUSED(parent), + wxWindow* ctrlItems) + : m_adaptor(adaptor) + { + ctrlItems->Bind(wxEVT_CHAR, &wxAddRemoveImplBase::OnChar, this); + } + + // wxOSX implementation needs to override this as it doesn't use sizers, + // for the others it is not necessary. + virtual wxSize GetBestClientSize() const { return wxDefaultSize; } + + virtual void SetButtonsToolTips(const wxString& addtip, + const wxString& removetip) = 0; + + virtual ~wxAddRemoveImplBase() + { + delete m_adaptor; + } + + // Event handlers which must be connected to the appropriate sources by the + // derived classes. + + void OnUpdateUIAdd(wxUpdateUIEvent& event) + { + event.Enable( m_adaptor->CanAdd() ); + } + + void OnUpdateUIRemove(wxUpdateUIEvent& event) + { + event.Enable( m_adaptor->CanRemove() ); + } + + void OnAdd(wxCommandEvent& WXUNUSED(event)) + { + m_adaptor->OnAdd(); + } + + void OnRemove(wxCommandEvent& WXUNUSED(event)) + { + m_adaptor->OnRemove(); + } + +private: + // This event handler is connected by this class itself and doesn't need to + // be accessible to the derived classes. + + void OnChar(wxKeyEvent& event) + { + switch ( event.GetKeyCode() ) + { + case '+': + case WXK_INSERT: + case WXK_NUMPAD_INSERT: + if ( m_adaptor->CanAdd() ) + m_adaptor->OnAdd(); + return; + + case '-': + case WXK_DELETE: + case WXK_NUMPAD_DELETE: + if ( m_adaptor->CanRemove() ) + m_adaptor->OnRemove(); + return; + } + + event.Skip(); + } + + wxAddRemoveAdaptor* const m_adaptor; + + wxDECLARE_NO_COPY_CLASS(wxAddRemoveImplBase); +}; + +// GTK+ uses a wxToolBar-based implementation and so doesn't need this class. +#ifndef __WXGTK__ + +// Base class for the ports using actual wxButtons for the "+"/"-" buttons. +class wxAddRemoveImplWithButtons : public wxAddRemoveImplBase +{ +public: + explicit wxAddRemoveImplWithButtons(wxAddRemoveAdaptor* adaptor, + wxAddRemoveCtrl* parent, + wxWindow* ctrlItems) + : wxAddRemoveImplBase(adaptor, parent, ctrlItems) + { + m_btnAdd = + m_btnRemove = NULL; + } + + virtual void SetButtonsToolTips(const wxString& addtip, + const wxString& removetip) wxOVERRIDE + { + m_btnAdd->SetToolTip(addtip); + m_btnRemove->SetToolTip(removetip); + } + +protected: + // Must be called by the derived class ctor after creating the buttons to + // set up the event handlers. + void SetUpEvents() + { + m_btnAdd->Bind(wxEVT_UPDATE_UI, + &wxAddRemoveImplBase::OnUpdateUIAdd, this); + m_btnRemove->Bind(wxEVT_UPDATE_UI, + &wxAddRemoveImplBase::OnUpdateUIRemove, this); + + m_btnAdd->Bind(wxEVT_BUTTON, &wxAddRemoveImplBase::OnAdd, this); + m_btnRemove->Bind(wxEVT_BUTTON, &wxAddRemoveImplBase::OnRemove, this); + } + + wxButton *m_btnAdd, + *m_btnRemove; + + wxDECLARE_NO_COPY_CLASS(wxAddRemoveImplWithButtons); +}; + +#endif // !wxGTK + +#ifdef __WXOSX__ + #include "wx/osx/private/addremovectrl.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/private/addremovectrl.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/private/addremovectrl.h" +#else + #include "wx/generic/private/addremovectrl.h" +#endif + +#endif // _WX_PRIVATE_ADDREMOVECTRL_H_ diff --git a/lib/wxWidgets/include/wx/private/animate.h b/lib/wxWidgets/include/wx/private/animate.h new file mode 100644 index 0000000..3e85dd8 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/animate.h @@ -0,0 +1,44 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/private/animate.h +// Purpose: wxAnimationImpl declaration +// Author: Robin Dunn, Vadim Zeitlin +// Created: 2020-04-06 +// Copyright: (c) 2020 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_ANIMATEH__ +#define _WX_PRIVATE_ANIMATEH__ + +// ---------------------------------------------------------------------------- +// wxAnimationImpl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxAnimationImpl : public wxRefCounter +{ +public: + wxAnimationImpl() {} + virtual ~wxAnimationImpl() {} + + virtual bool IsOk() const = 0; + virtual bool IsCompatibleWith(wxClassInfo* ci) 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; + + // This function creates the default implementation for this platform: + // currently it's wxAnimationGTKImpl under wxGTK and wxAnimationGenericImpl + // under all the other platforms. + static wxAnimationImpl *CreateDefault(); +}; + +#endif // _WX_PRIVATE_ANIMATEH__ diff --git a/lib/wxWidgets/include/wx/private/bmpbndl.h b/lib/wxWidgets/include/wx/private/bmpbndl.h new file mode 100644 index 0000000..53bd2f3 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/bmpbndl.h @@ -0,0 +1,34 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/bmpbndl.h +// Purpose: wxBitmapBundleImpl declaration. +// Author: Vadim Zeitlin +// Created: 2021-09-22 +// Copyright: (c) 2021 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_BMPBNDL_H_ +#define _WX_PRIVATE_BMPBNDL_H_ + +#include "wx/bmpbndl.h" + +#ifdef __WXOSX__ + +// this methods are wx-private, may change in the future + +WXImage WXDLLIMPEXP_CORE wxOSXGetImageFromBundle(const wxBitmapBundle& bundle); +wxBitmapBundle WXDLLIMPEXP_CORE wxOSXMakeBundleFromImage(WXImage image); +WXImage WXDLLIMPEXP_CORE wxOSXImageFromBitmap(const wxBitmap& bmp); +#if wxOSX_USE_COCOA +void WXDLLIMPEXP_CORE wxOSXAddBitmapToImage(WXImage image, const wxBitmap& bmp); +#endif + +// for hiding the storage of the NSImage with wxBitmapBundleImpls from public API + +WXImage WXDLLIMPEXP_CORE wxOSXGetImageFromBundleImpl(const wxBitmapBundleImpl* impl); +void WXDLLIMPEXP_CORE wxOSXSetImageForBundleImpl(const wxBitmapBundleImpl* impl, WXImage image); +void WXDLLIMPEXP_CORE wxOSXBundleImplDestroyed(const wxBitmapBundleImpl* impl); + +#endif + +#endif // _WX_PRIVATE_BMPBNDL_H_ diff --git a/lib/wxWidgets/include/wx/private/display.h b/lib/wxWidgets/include/wx/private/display.h new file mode 100644 index 0000000..b45bfed --- /dev/null +++ b/lib/wxWidgets/include/wx/private/display.h @@ -0,0 +1,214 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/private/display.h +// Purpose: wxDisplayImpl class declaration +// Author: Vadim Zeitlin +// Created: 2006-03-15 +// Copyright: (c) 2002-2006 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_DISPLAY_H_ +#define _WX_PRIVATE_DISPLAY_H_ + +#include "wx/display.h" +#include "wx/gdicmn.h" // for wxRect +#include "wx/vector.h" + +// ---------------------------------------------------------------------------- +// wxDisplayFactory: allows to create wxDisplay objects +// ---------------------------------------------------------------------------- + +class wxDisplayFactory +{ +public: + wxDisplayFactory() { } + virtual ~wxDisplayFactory() { ClearImpls(); } + + // Create the display if necessary using CreateDisplay(), otherwise just + // get it from cache. + wxDisplayImpl* GetDisplay(unsigned n) + { + // Normally, m_impls should be cleared if the number of displays in the + // system changes because InvalidateCache() must be called. However in + // some ports (e.g. Mac right now, see #18318), cache invalidation never + // happens, so we can end up with m_impls size being out of sync with + // the actual number of monitors. Compensate for this here by checking + // if the index is invalid and invalidating the cache at least in this + // case. + // + // Note that this is still incorrect because we continue using outdated + // information if the first monitor is disconnected, for example. The + // only real solution is to ensure that InvalidateCache() is called, + // but for now this at least avoids crashes when a new display is + // connected. + if ( n >= m_impls.size() ) + { + // This strange two-step resize is done to clear all the existing + // elements: they may not be valid any longer if the number of + // displays has changed. + m_impls.resize(0); + m_impls.resize(GetCount()); + } + else if ( m_impls[n] ) + { + // Just return the existing display if we have it. + return m_impls[n]; + } + + m_impls[n] = CreateDisplay(n); + return m_impls[n]; + } + + // Return the primary display object, creating it if necessary. + wxDisplayImpl* GetPrimaryDisplay(); + + // get the total number of displays + virtual unsigned GetCount() = 0; + + // return the display for the given point or wxNOT_FOUND + virtual int GetFromPoint(const wxPoint& pt) = 0; + + // return the display for the given window or wxNOT_FOUND + // + // the window pointer must not be NULL (i.e. caller should check it) + virtual int GetFromWindow(const wxWindow *window); + + // Trigger recreation of wxDisplayImpl when they're needed the next time. + virtual void InvalidateCache() { ClearImpls(); } + +protected: + // create a new display object + // + // it can return a NULL pointer if the display creation failed + virtual wxDisplayImpl *CreateDisplay(unsigned n) = 0; + +private: + // Delete all the elements of m_impls vector and clear it. + void ClearImpls(); + + // On-demand populated vector of wxDisplayImpl objects. + wxVector<wxDisplayImpl*> m_impls; + + wxDECLARE_NO_COPY_CLASS(wxDisplayFactory); +}; + +// ---------------------------------------------------------------------------- +// wxDisplayImpl: base class for all wxDisplay implementations +// ---------------------------------------------------------------------------- + +class wxDisplayImpl +{ +public: + // virtual dtor for this base class + virtual ~wxDisplayImpl() { } + + + // return the full area of this display + virtual wxRect GetGeometry() const = 0; + + // return the area of the display available for normal windows + virtual wxRect GetClientArea() const { return GetGeometry(); } + + // return the depth or 0 if unknown + virtual int GetDepth() const = 0; + + // return the scale factor used to convert logical pixels to physical ones + virtual double GetScaleFactor() const { return 1.0; } + + // return the resolution of the display, by default uses GetScaleFactor(), + // but can be also overridden directly, as is done in wxMSW + virtual wxSize GetPPI() const { return wxDisplay::GetStdPPI()*GetScaleFactor(); } + + // return the name (may be empty) + virtual wxString GetName() const { return wxString(); } + + // return the index of this display + unsigned GetIndex() const { return m_index; } + + // return true if this is the primary monitor (usually one with index 0) + virtual bool IsPrimary() const { return GetIndex() == 0; } + + +#if wxUSE_DISPLAY + // implements wxDisplay::GetModes() + virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const = 0; + + // get current video mode + virtual wxVideoMode GetCurrentMode() const = 0; + + // change current mode, return true if succeeded, false otherwise + virtual bool ChangeMode(const wxVideoMode& mode) = 0; +#endif // wxUSE_DISPLAY + +protected: + // create the object providing access to the display with the given index + wxDisplayImpl(unsigned n) : m_index(n) { } + + + // the index of this display (0 is always the primary one) + const unsigned m_index; + + + friend class wxDisplayFactory; + + wxDECLARE_NO_COPY_CLASS(wxDisplayImpl); +}; + +// ---------------------------------------------------------------------------- +// wxDisplayImplSingle: the simplest possible impl for the main display only +// ---------------------------------------------------------------------------- + +// Note that this is still an ABC and GetGeometry() and GetClientArea() methods +// must be implemented in the derived classes. + +class WXDLLEXPORT wxDisplayImplSingle : public wxDisplayImpl +{ +public: + wxDisplayImplSingle() : wxDisplayImpl(0) { } + +#if wxUSE_DISPLAY + // no video modes support for us, provide just the stubs + virtual wxArrayVideoModes + GetModes(const wxVideoMode& WXUNUSED(mode)) const wxOVERRIDE + { + return wxArrayVideoModes(); + } + + virtual wxVideoMode GetCurrentMode() const wxOVERRIDE + { + return wxVideoMode(); + } + + virtual bool ChangeMode(const wxVideoMode& WXUNUSED(mode)) wxOVERRIDE + { + return false; + } +#endif // wxUSE_DISPLAY + + wxDECLARE_NO_COPY_CLASS(wxDisplayImplSingle); +}; + +// ---------------------------------------------------------------------------- +// wxDisplayFactorySingle +// ---------------------------------------------------------------------------- + +// This is the simplest implementation of wxDisplayFactory using single/main +// display only. It is used when wxUSE_DISPLAY == 0 because getting the size of +// the main display is always needed. +// +// Note that this is still an ABC and derived classes must implement +// CreateSingleDisplay(). + +class wxDisplayFactorySingle : public wxDisplayFactory +{ +public: + virtual unsigned GetCount() wxOVERRIDE { return 1; } + virtual int GetFromPoint(const wxPoint& pt) wxOVERRIDE; + +protected: + virtual wxDisplayImpl *CreateDisplay(unsigned n) wxOVERRIDE; + + virtual wxDisplayImpl *CreateSingleDisplay() = 0; +}; + +#endif // _WX_PRIVATE_DISPLAY_H_ diff --git a/lib/wxWidgets/include/wx/private/eventloopsourcesmanager.h b/lib/wxWidgets/include/wx/private/eventloopsourcesmanager.h new file mode 100644 index 0000000..430a2f7 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/eventloopsourcesmanager.h @@ -0,0 +1,29 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/eventloopsourcesmanager.h +// Purpose: declares wxEventLoopSourcesManagerBase class +// Author: Rob Bresalier +// Created: 2013-06-19 +// Copyright: (c) 2013 Rob Bresalier +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_EVENTLOOPSOURCESMANAGER_H_ +#define _WX_PRIVATE_EVENTLOOPSOURCESMANAGER_H_ + +// For pulling in the value of wxUSE_EVENTLOOP_SOURCE +#include "wx/evtloop.h" + +#if wxUSE_EVENTLOOP_SOURCE + +class WXDLLIMPEXP_BASE wxEventLoopSourcesManagerBase +{ +public: + virtual wxEventLoopSource* + AddSourceForFD(int fd, wxEventLoopSourceHandler *handler, int flags) = 0; + + virtual ~wxEventLoopSourcesManagerBase() { } +}; + +#endif // wxUSE_EVENTLOOP_SOURCE + +#endif // _WX_PRIVATE_EVENTLOOPSOURCESMANAGER_H_ diff --git a/lib/wxWidgets/include/wx/private/extfield.h b/lib/wxWidgets/include/wx/private/extfield.h new file mode 100644 index 0000000..01451e8 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/extfield.h @@ -0,0 +1,84 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/extfield.h +// Purpose: Declare wxExternalField helper +// Author: Vadim Zeitlin +// Created: 2017-11-21 +// Copyright: (c) 2017 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_EXTFIELD_H_ +#define _WX_PRIVATE_EXTFIELD_H_ + +// ---------------------------------------------------------------------------- +// wxExternalField: store object data outside of it +// ---------------------------------------------------------------------------- + +// This class allows to store some data without consuming space for the objects +// that don't need it and can be useful for avoiding to add rarely used fields +// to the classes that are used by many objects, e.g. wxWindow. +// +// Note that using this class costs in speed and convenience of access to the +// field, which requires a hash lookup instead of accessing it directly. It +// also only currently works for heap-allocated fields as it's probably never +// worth using it for fields of simple types. +// +// Template parameter Object is the class that "contains" the field, Field is +// the type of the field itself and FieldMap is the hash map, defined +// separately using WX_DECLARE_HASH_MAP(), with Object* as the key and Field* +// as the value type. +template <typename Object, typename Field, typename FieldMap> +class wxExternalField +{ +public: + typedef Object ObjectType; + typedef Field FieldType; + typedef FieldMap MapType; + + // Store the field object to be used for the given object, replacing the + // existing one, if any. + // + // This method takes ownership of the field pointer which will be destroyed + // by EraseForObject(). + static void StoreForObject(ObjectType* obj, FieldType* field) + { + const typename MapType::iterator it = ms_map.find(obj); + if ( it != ms_map.end() ) + { + delete it->second; + it->second = field; + } + else + { + ms_map.insert(typename MapType::value_type(obj, field)); + } + } + + // Find the object for the corresponding window. + static FieldType* FromObject(ObjectType* obj) + { + const typename MapType::const_iterator it = ms_map.find(obj); + return it == ms_map.end() ? NULL : it->second; + } + + // Erase the object used for the corresponding window, return true if there + // was one or false otherwise. + static bool EraseForObject(ObjectType* obj) + { + const typename MapType::iterator it = ms_map.find(obj); + if ( it == ms_map.end() ) + return false; + + delete it->second; + ms_map.erase(it); + return true; + } + +private: + static FieldMap ms_map; +}; + +template <typename O, typename F, typename M> +M wxExternalField<O, F, M>::ms_map; + +#endif // _WX_PRIVATE_EXTFIELD_H_ diff --git a/lib/wxWidgets/include/wx/private/fd.h b/lib/wxWidgets/include/wx/private/fd.h new file mode 100644 index 0000000..3f4a604 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/fd.h @@ -0,0 +1,53 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/fd.h +// Purpose: private stuff for working with file descriptors +// Author: Vadim Zeitlin +// Created: 2008-11-23 (moved from wx/unix/private.h) +// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_FD_H_ +#define _WX_PRIVATE_FD_H_ + +// standard Linux headers produce many warnings when used with icc so define +// our own replacements for FD_XXX macros +#if defined(__INTELC__) && defined(__LINUX__) + inline void wxFD_ZERO(fd_set *fds) + { + #pragma warning(push) + #pragma warning(disable:593) + FD_ZERO(fds); + #pragma warning(pop) + } + + inline void wxFD_SET(int fd, fd_set *fds) + { + #pragma warning(push, 1) + #pragma warning(disable:1469) + FD_SET(fd, fds); + #pragma warning(pop) + } + + inline bool wxFD_ISSET(int fd, fd_set *fds) + { + #pragma warning(push, 1) + #pragma warning(disable:1469) + return FD_ISSET(fd, fds); + #pragma warning(pop) + } + inline void wxFD_CLR(int fd, fd_set *fds) + { + #pragma warning(push, 1) + #pragma warning(disable:1469) + FD_CLR(fd, fds); + #pragma warning(pop) + } +#else // !__INTELC__ + #define wxFD_ZERO(fds) FD_ZERO(fds) + #define wxFD_SET(fd, fds) FD_SET(fd, fds) + #define wxFD_ISSET(fd, fds) FD_ISSET(fd, fds) + #define wxFD_CLR(fd, fds) FD_CLR(fd, fds) +#endif // __INTELC__/!__INTELC__ + +#endif // _WX_PRIVATE_FD_H_ diff --git a/lib/wxWidgets/include/wx/private/fdiodispatcher.h b/lib/wxWidgets/include/wx/private/fdiodispatcher.h new file mode 100644 index 0000000..704bd46 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/fdiodispatcher.h @@ -0,0 +1,118 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/private/fdiodispatcher.h +// Purpose: classes for dispatching IO notifications for file descriptors +// Authors: Lukasz Michalski +// Created: December 2006 +// Copyright: (c) Lukasz Michalski +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_FDIODISPATCHER_H_ +#define _WX_PRIVATE_FDIODISPATCHER_H_ + +#include "wx/hashmap.h" +#include "wx/private/fdiohandler.h" + +// those flags describes sets where descriptor should be added +enum wxFDIODispatcherEntryFlags +{ + wxFDIO_INPUT = 1, + wxFDIO_OUTPUT = 2, + wxFDIO_EXCEPTION = 4, + wxFDIO_ALL = wxFDIO_INPUT | wxFDIO_OUTPUT | wxFDIO_EXCEPTION +}; + +// base class for wxSelectDispatcher and wxEpollDispatcher +class WXDLLIMPEXP_BASE wxFDIODispatcher +{ +public: + enum { TIMEOUT_INFINITE = -1 }; + + // return the global dispatcher to be used for IO events, can be NULL only + // if wxSelectDispatcher wasn't compiled into the library at all as + // creating it never fails + // + // don't delete the returned pointer + static wxFDIODispatcher *Get(); + + // if we have any registered handlers, check for any pending events to them + // and dispatch them -- this is used from wxX11 and wxDFB event loops + // implementation + static void DispatchPending(); + + // register handler for the given descriptor with the dispatcher, return + // true on success or false on error + virtual bool RegisterFD(int fd, wxFDIOHandler *handler, int flags) = 0; + + // modify descriptor flags or handler, return true on success + virtual bool ModifyFD(int fd, wxFDIOHandler *handler, int flags) = 0; + + // unregister descriptor previously registered with RegisterFD() + virtual bool UnregisterFD(int fd) = 0; + + // check if any events are currently available without dispatching them + virtual bool HasPending() const = 0; + + // wait for an event for at most timeout milliseconds and process it; + // return the number of events processed (possibly 0 if timeout expired) or + // -1 if an error occurred + virtual int Dispatch(int timeout = TIMEOUT_INFINITE) = 0; + + virtual ~wxFDIODispatcher() { } +}; + +//entry for wxFDIOHandlerMap +struct wxFDIOHandlerEntry +{ + wxFDIOHandlerEntry() + { + } + + wxFDIOHandlerEntry(wxFDIOHandler *handler_, int flags_) + : handler(handler_), + flags(flags_) + { + } + + wxFDIOHandler *handler; + int flags; +}; + +// this hash is used to map file descriptors to their handlers +WX_DECLARE_HASH_MAP( + int, + wxFDIOHandlerEntry, + wxIntegerHash, + wxIntegerEqual, + wxFDIOHandlerMap +); + +// FDIODispatcher that holds map fd <-> FDIOHandler, this should be used if +// this map isn't maintained elsewhere already as it is usually needed anyhow +// +// notice that all functions for FD management have implementation +// in the base class and should be called from the derived classes +class WXDLLIMPEXP_BASE wxMappedFDIODispatcher : public wxFDIODispatcher +{ +public: + // find the handler for the given fd, return NULL if none + wxFDIOHandler *FindHandler(int fd) const; + + // register handler for the given descriptor with the dispatcher, return + // true on success or false on error + virtual bool RegisterFD(int fd, wxFDIOHandler *handler, int flags) wxOVERRIDE; + + // modify descriptor flags or handler, return true on success + virtual bool ModifyFD(int fd, wxFDIOHandler *handler, int flags) wxOVERRIDE; + + // unregister descriptor previously registered with RegisterFD() + virtual bool UnregisterFD(int fd) wxOVERRIDE; + + virtual ~wxMappedFDIODispatcher() { } + +protected: + // the fd -> handler map containing all the registered handlers + wxFDIOHandlerMap m_handlers; +}; + +#endif // _WX_PRIVATE_FDIODISPATCHER_H_ diff --git a/lib/wxWidgets/include/wx/private/fdioeventloopsourcehandler.h b/lib/wxWidgets/include/wx/private/fdioeventloopsourcehandler.h new file mode 100644 index 0000000..fcf6762 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/fdioeventloopsourcehandler.h @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/fdioeventloopsourcehandler.h +// Purpose: declares wxFDIOEventLoopSourceHandler class +// Author: Rob Bresalier, Vadim Zeitlin +// Created: 2013-06-13 (extracted from src/unix/evtloopunix.cpp) +// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org> +// (c) 2013 Rob Bresalier +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_FDIO_EVENT_LOOP_SOURCE_HANDLER_H +#define _WX_PRIVATE_FDIO_EVENT_LOOP_SOURCE_HANDLER_H + +#include "wx/evtloopsrc.h" + +// This class is a temporary bridge between event loop sources and +// FDIODispatcher. It is going to be removed soon, when all subject interfaces +// are modified +class wxFDIOEventLoopSourceHandler : public wxFDIOHandler +{ +public: + explicit wxFDIOEventLoopSourceHandler(wxEventLoopSourceHandler* handler) + : m_handler(handler) + { + } + + // Just forward to the real handler. + virtual void OnReadWaiting() wxOVERRIDE { m_handler->OnReadWaiting(); } + virtual void OnWriteWaiting() wxOVERRIDE { m_handler->OnWriteWaiting(); } + virtual void OnExceptionWaiting() wxOVERRIDE { m_handler->OnExceptionWaiting(); } + +protected: + wxEventLoopSourceHandler* const m_handler; + + wxDECLARE_NO_COPY_CLASS(wxFDIOEventLoopSourceHandler); +}; + +#endif // _WX_PRIVATE_FDIO_EVENT_LOOP_SOURCE_HANDLER_H diff --git a/lib/wxWidgets/include/wx/private/fdiohandler.h b/lib/wxWidgets/include/wx/private/fdiohandler.h new file mode 100644 index 0000000..94e3649 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/fdiohandler.h @@ -0,0 +1,53 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/fdiohandler.h +// Purpose: declares wxFDIOHandler class +// Author: Vadim Zeitlin +// Created: 2009-08-17 +// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_FDIOHANDLER_H_ +#define _WX_PRIVATE_FDIOHANDLER_H_ + +// ---------------------------------------------------------------------------- +// wxFDIOHandler: interface used to process events on file descriptors +// ---------------------------------------------------------------------------- + +class wxFDIOHandler +{ +public: + wxFDIOHandler() { m_regmask = 0; } + + // called when descriptor is available for non-blocking read + virtual void OnReadWaiting() = 0; + + // called when descriptor is available for non-blocking write + virtual void OnWriteWaiting() = 0; + + // called when there is exception on descriptor + virtual void OnExceptionWaiting() = 0; + + // called to check if the handler is still valid, only used by + // wxSocketImplUnix currently + virtual bool IsOk() const { return true; } + + + // get/set the mask of events for which we're currently registered for: + // it's a combination of wxFDIO_{INPUT,OUTPUT,EXCEPTION} + int GetRegisteredEvents() const { return m_regmask; } + void SetRegisteredEvent(int flag) { m_regmask |= flag; } + void ClearRegisteredEvent(int flag) { m_regmask &= ~flag; } + + + // virtual dtor for the base class + virtual ~wxFDIOHandler() { } + +private: + int m_regmask; + + wxDECLARE_NO_COPY_CLASS(wxFDIOHandler); +}; + +#endif // _WX_PRIVATE_FDIOHANDLER_H_ + diff --git a/lib/wxWidgets/include/wx/private/fdiomanager.h b/lib/wxWidgets/include/wx/private/fdiomanager.h new file mode 100644 index 0000000..0721886 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/fdiomanager.h @@ -0,0 +1,42 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/fdiomanager.h +// Purpose: declaration of wxFDIOManager +// Author: Vadim Zeitlin +// Created: 2009-08-17 +// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_FDIOMANAGER_H_ +#define _WX_PRIVATE_FDIOMANAGER_H_ + +#include "wx/private/fdiohandler.h" + +// ---------------------------------------------------------------------------- +// wxFDIOManager: register or unregister wxFDIOHandlers +// ---------------------------------------------------------------------------- + +// currently only used in wxGTK and wxMotif, see wx/unix/apptrait.h + +class wxFDIOManager +{ +public: + // identifies either input or output direction + // + // NB: the values of this enum shouldn't change + enum Direction + { + INPUT, + OUTPUT + }; + + // start or stop monitoring the events on the given file descriptor + virtual int AddInput(wxFDIOHandler *handler, int fd, Direction d) = 0; + virtual void RemoveInput(wxFDIOHandler *handler, int fd, Direction d) = 0; + + // empty but virtual dtor for the base class + virtual ~wxFDIOManager() { } +}; + +#endif // _WX_PRIVATE_FDIOMANAGER_H_ + diff --git a/lib/wxWidgets/include/wx/private/fileback.h b/lib/wxWidgets/include/wx/private/fileback.h new file mode 100644 index 0000000..a4ca08a --- /dev/null +++ b/lib/wxWidgets/include/wx/private/fileback.h @@ -0,0 +1,82 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/private/fileback.h +// Purpose: Back an input stream with memory or a file +// Author: Mike Wetherell +// Copyright: (c) 2006 Mike Wetherell +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FILEBACK_H__ +#define _WX_FILEBACK_H__ + +#include "wx/defs.h" + +#if wxUSE_FILESYSTEM + +#include "wx/stream.h" + +// ---------------------------------------------------------------------------- +// Backs an input stream with memory or a file to make it seekable. +// +// One or more wxBackedInputStreams can be used to read it's data. The data is +// reference counted, so stays alive until the last wxBackingFile or +// wxBackedInputStream using it is destroyed. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxBackingFile +{ +public: + enum { DefaultBufSize = 16384 }; + + // Takes ownership of stream. If the stream is smaller than bufsize, the + // backing file is never created and the backing is done with memory. + wxBackingFile(wxInputStream *stream, + size_t bufsize = DefaultBufSize, + const wxString& prefix = wxT("wxbf")); + + wxBackingFile() : m_impl(NULL) { } + ~wxBackingFile(); + + wxBackingFile(const wxBackingFile& backer); + wxBackingFile& operator=(const wxBackingFile& backer); + + operator bool() const { return m_impl != NULL; } + +private: + class wxBackingFileImpl *m_impl; + friend class wxBackedInputStream; +}; + +// ---------------------------------------------------------------------------- +// An input stream to read from a wxBackingFile. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxBackedInputStream : public wxInputStream +{ +public: + wxBackedInputStream(const wxBackingFile& backer); + + // If the length of the backer's parent stream is unknown then GetLength() + // returns wxInvalidOffset until the parent has been read to the end. + wxFileOffset GetLength() const wxOVERRIDE; + + // Returns the length, reading the parent stream to the end if necessary. + wxFileOffset FindLength() const; + + bool IsSeekable() const wxOVERRIDE { return true; } + +protected: + size_t OnSysRead(void *buffer, size_t size) wxOVERRIDE; + wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE; + wxFileOffset OnSysTell() const wxOVERRIDE; + +private: + wxBackingFile m_backer; + wxFileOffset m_pos; + + wxDECLARE_NO_COPY_CLASS(wxBackedInputStream); +}; + +#endif // wxUSE_FILESYSTEM + +#endif // _WX_FILEBACK_H__ diff --git a/lib/wxWidgets/include/wx/private/filedlgcustomize.h b/lib/wxWidgets/include/wx/private/filedlgcustomize.h new file mode 100644 index 0000000..ffa8ec3 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/filedlgcustomize.h @@ -0,0 +1,85 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/filedlgcustomize.h +// Purpose: Private helpers used for wxFileDialog customization +// Author: Vadim Zeitlin +// Created: 2022-05-26 +// Copyright: (c) 2022 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_FILEDLGCUSTOMIZE_H_ +#define _WX_PRIVATE_FILEDLGCUSTOMIZE_H_ + +// ---------------------------------------------------------------------------- +// wxFileDialogCustomControlImpl: interface for all custom controls +// ---------------------------------------------------------------------------- + +class wxFileDialogCustomControlImpl +{ +public: + virtual void Show(bool show) = 0; + virtual void Enable(bool enable) = 0; + + virtual bool DoBind(wxEvtHandler* handler); + + virtual ~wxFileDialogCustomControlImpl(); +}; + +// This class is defined for symmetry with the other ones, but there are no +// button-specific methods so far. +class wxFileDialogButtonImpl : public wxFileDialogCustomControlImpl +{ +}; + +class wxFileDialogCheckBoxImpl : public wxFileDialogCustomControlImpl +{ +public: + virtual bool GetValue() = 0; + virtual void SetValue(bool value) = 0; +}; + +class wxFileDialogRadioButtonImpl : public wxFileDialogCustomControlImpl +{ +public: + virtual bool GetValue() = 0; + virtual void SetValue(bool value) = 0; +}; + +class wxFileDialogChoiceImpl : public wxFileDialogCustomControlImpl +{ +public: + virtual int GetSelection() = 0; + virtual void SetSelection(int n) = 0; +}; + +class wxFileDialogTextCtrlImpl : public wxFileDialogCustomControlImpl +{ +public: + virtual wxString GetValue() = 0; + virtual void SetValue(const wxString& value) = 0; +}; + +class wxFileDialogStaticTextImpl : public wxFileDialogCustomControlImpl +{ +public: + virtual void SetLabelText(const wxString& text) = 0; +}; + +// ---------------------------------------------------------------------------- +// wxFileDialogCustomizeImpl: interface for actual customizers +// ---------------------------------------------------------------------------- + +class wxFileDialogCustomizeImpl +{ +public: + virtual wxFileDialogButtonImpl* AddButton(const wxString& label) = 0; + virtual wxFileDialogCheckBoxImpl* AddCheckBox(const wxString& label) = 0; + virtual wxFileDialogRadioButtonImpl* AddRadioButton(const wxString& label) = 0; + virtual wxFileDialogChoiceImpl* AddChoice(size_t n, const wxString* strings) = 0; + virtual wxFileDialogTextCtrlImpl* AddTextCtrl(const wxString& label) = 0; + virtual wxFileDialogStaticTextImpl* AddStaticText(const wxString& label) = 0; + + virtual ~wxFileDialogCustomizeImpl(); +}; + +#endif // _WX_PRIVATE_FILEDLGCUSTOMIZE_H_ diff --git a/lib/wxWidgets/include/wx/private/filename.h b/lib/wxWidgets/include/wx/private/filename.h new file mode 100644 index 0000000..a4ed481 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/filename.h @@ -0,0 +1,55 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/private/filename.h +// Purpose: Internal declarations for src/common/filename.cpp +// Author: Mike Wetherell +// Modified by: +// Created: 2006-10-22 +// Copyright: (c) 2006 Mike Wetherell +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_FILENAME_H_ +#define _WX_PRIVATE_FILENAME_H_ + +#include "wx/file.h" +#include "wx/ffile.h" + +// Self deleting temp files aren't supported on all platforms. Therefore +// rather than let these be in the API, they can be used internally to +// implement classes (e.g. wxTempFileStream), that will do the clean up when +// the OS doesn't support it. + +// Same usage as wxFileName::CreateTempFileName() with the extra parameter +// deleteOnClose. *deleteOnClose true on entry requests a file created with a +// delete on close flag, on exit the value of *deleteOnClose indicates whether +// available. + +#if wxUSE_FILE +wxString wxCreateTempFileName(const wxString& prefix, + wxFile *fileTemp, + bool *deleteOnClose = NULL); +#endif + +#if wxUSE_FFILE +wxString wxCreateTempFileName(const wxString& prefix, + wxFFile *fileTemp, + bool *deleteOnClose = NULL); +#endif + +// Returns an open temp file, if possible either an unlinked open file or one +// that will delete on close. Only returns the filename if neither was +// possible, so that the caller can delete the file when done. + +#if wxUSE_FILE +bool wxCreateTempFile(const wxString& prefix, + wxFile *fileTemp, + wxString *name); +#endif + +#if wxUSE_FFILE +bool wxCreateTempFile(const wxString& prefix, + wxFFile *fileTemp, + wxString *name); +#endif + +#endif // _WX_PRIVATE_FILENAME_H_ diff --git a/lib/wxWidgets/include/wx/private/flagscheck.h b/lib/wxWidgets/include/wx/private/flagscheck.h new file mode 100644 index 0000000..3e3d9fb --- /dev/null +++ b/lib/wxWidgets/include/wx/private/flagscheck.h @@ -0,0 +1,116 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/private/flagscheck.h +// Purpose: helpers for checking that (bit)flags don't overlap +// Author: Vaclav Slavik +// Created: 2008-02-21 +// Copyright: (c) 2008 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_FLAGSCHECK_H_ +#define _WX_PRIVATE_FLAGSCHECK_H_ + +#include "wx/debug.h" + +// IBM xlC 8 can't parse the template syntax +#if !defined(__IBMCPP__) + +#include "wx/meta/if.h" + +namespace wxPrivate +{ + +// These templates are used to implement wxADD_FLAG macro below. +// +// The idea is that we want to trigger *compilation* error if the flags +// overlap, not just runtime assert failure. We can't implement the check +// using just a simple logical operation, we need checks equivalent to this +// code: +// +// mask = wxFLAG_1; +// assert( (mask & wxFLAG_2) == 0 ); // no overlap +// mask |= wxFLAG_3; +// assert( (mask & wxFLAG_3) == 0 ); // no overlap +// mask |= wxFLAG_3; +// ... +// +// This can be done at compilation time by using templates metaprogramming +// technique that makes the compiler carry on the computation. +// +// NB: If any of this doesn't compile with your compiler and would be too +// hard to make work, it's probably best to disable this code and replace +// the macros below with empty stubs, this isn't anything critical. + +template<int val> struct FlagsHaveConflictingValues +{ + // no value here - triggers compilation error +}; + +template<int val> struct FlagValue +{ + enum { value = val }; +}; + +// This template adds its template parameter integer 'add' to another integer +// 'all' and produces their OR-combination (all | add). The result is "stored" +// as constant SafelyAddToMask<>::value. Combination of many flags is achieved +// by chaining parameter lists: the 'add' parameter is value member of +// another (different) SafelyAddToMask<> instantiation. +template<int all, int add> struct SafelyAddToMask +{ + // This typedefs ensures that no flags in the list conflict. If there's + // any overlap between the already constructed part of the mask ('all') + // and the value being added to it ('add'), the test that is wxIf<>'s + // first parameter will be non-zero and so Added value will be + // FlagsHaveConflictingValues<add>. The next statement will try to use + // AddedValue::value, but there's no such thing in + // FlagsHaveConflictingValues<> and so compilation will fail. + typedef typename wxIf<(all & add) == 0, + FlagValue<add>, + FlagsHaveConflictingValues<add> >::value + AddedValue; + + enum { value = all | AddedValue::value }; +}; + +} // wxPrivate namespace + + + +// This macro is used to ensure that no two flags that can be combined in +// the same integer value have overlapping bits. This is sometimes not entirely +// trivial to ensure, for example in wxWindow styles or flags for wxSizerItem +// that span several enums, some of them used for multiple purposes. +// +// By constructing allowed flags mask using wxADD_FLAG macro and then using +// this mask to check flags passed as arguments, you can ensure that +// +// a) if any of the allowed flags overlap, you will get compilation error +// b) if invalid flag is used, there will be an assert at runtime +// +// Example usage: +// +// static const int SIZER_FLAGS_MASK = +// wxADD_FLAG(wxCENTRE, +// wxADD_FLAG(wxHORIZONTAL, +// wxADD_FLAG(wxVERTICAL, +// ... +// 0))...); +// +// And wherever flags are used: +// +// wxASSERT_VALID_FLAG( m_flag, SIZER_FLAGS_MASK ); + +#define wxADD_FLAG(f, others) \ + ::wxPrivate::SafelyAddToMask<f, others>::value + +#else + #define wxADD_FLAG(f, others) (f | others) +#endif + +// Checks if flags value 'f' is within the mask of allowed values +#define wxASSERT_VALID_FLAGS(f, mask) \ + wxASSERT_MSG( (f & mask) == f, \ + "invalid flag: not within " #mask ) + +#endif // _WX_PRIVATE_FLAGSCHECK_H_ diff --git a/lib/wxWidgets/include/wx/private/fontmgr.h b/lib/wxWidgets/include/wx/private/fontmgr.h new file mode 100644 index 0000000..2d603ac --- /dev/null +++ b/lib/wxWidgets/include/wx/private/fontmgr.h @@ -0,0 +1,247 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/private/fontmgr.h +// Purpose: font management for ports that don't have their own +// Author: Vaclav Slavik +// Created: 2006-11-18 +// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com) +// (c) 2006 REA Elektronik GmbH +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_FONTMGR_H_ +#define _WX_PRIVATE_FONTMGR_H_ + +#include "wx/list.h" +#include "wx/fontutil.h" + +class wxFontsManager; +class wxFontInstance; +class wxFontInstanceList; +class wxFontFace; +class wxFontBundle; +class wxFontBundleHash; +class wxFontMgrFontRefData; + +WX_DECLARE_LIST(wxFontBundle, wxFontBundleList); + +/** + This class represents single font face with set parameters (point size, + antialiasing). + */ +class wxFontInstanceBase +{ +protected: + wxFontInstanceBase(float ptSize, bool aa) : m_ptSize(ptSize), m_aa(aa) {} + virtual ~wxFontInstanceBase() {} + +public: + float GetPointSize() const { return m_ptSize; } + bool IsAntiAliased() const { return m_aa; } + +protected: + float m_ptSize; + bool m_aa; +}; + + +/// This class represents loaded font face (bundle+weight+italics). +class wxFontFaceBase +{ +protected: + /// Ctor. Creates object with reference count = 0, Acquire() must be + /// called after the object is created. + wxFontFaceBase(); + virtual ~wxFontFaceBase(); + +public: + /// Increases reference count of the face + virtual void Acquire(); + + /** + Decreases reference count of the face. Call this when you no longer + use the object returned by wxFontBundle. Note that this doesn't destroy + the object, but only optionally shuts it down, so it's possible to + call Acquire() and Release() more than once. + */ + virtual void Release(); + + /** + Returns instance of the font at given size. + + @param ptSize point size of the font to create; note that this is + a float and not integer, it should be wxFont's point + size multiplied by wxDC's scale factor + @param aa should the font be antialiased? + */ + virtual wxFontInstance *GetFontInstance(float ptSize, bool aa); + +protected: + /// Called to create a new instance of the font by GetFontInstance() if + /// it wasn't found it cache. + virtual wxFontInstance *CreateFontInstance(float ptSize, bool aa) = 0; + +protected: + unsigned m_refCnt; + wxFontInstanceList *m_instances; +}; + +/** + This class represents font bundle. Font bundle is set of faces that have + the same name, but differ in weight and italics. + */ +class wxFontBundleBase +{ +public: + wxFontBundleBase(); + virtual ~wxFontBundleBase(); + + /// Returns name of the bundle + virtual wxString GetName() const = 0; + + /// Returns true if the font is fixed-width + virtual bool IsFixed() const = 0; + + /// Type of faces in the bundle + enum FaceType + { + // NB: values of these constants are set so that it's possible to + // make OR-combinations of them and still get valid enum element + FaceType_Regular = 0, + FaceType_Italic = 1, + FaceType_Bold = 2, + FaceType_BoldItalic = FaceType_Italic | FaceType_Bold, + + FaceType_Max + }; + + /// Returns true if the given face is available + bool HasFace(FaceType type) const { return m_faces[type] != NULL; } + + /** + Returns font face object that can be used to render font of given type. + + Note that this method can only be called if HasFace(type) returns true. + + Acquire() was called on the returned object, you must call Release() + when you stop using it. + */ + wxFontFace *GetFace(FaceType type) const; + + /** + Returns font face object that can be used to render given font. + + Acquire() was called on the returned object, you must call Release() + when you stop using it. + */ + wxFontFace *GetFaceForFont(const wxFontMgrFontRefData& font) const; + +protected: + wxFontFace *m_faces[FaceType_Max]; +}; + + +/** + Base class for wxFontsManager class, which manages the list of all + available fonts and their loaded instances. + */ +class wxFontsManagerBase +{ +protected: + wxFontsManagerBase(); + virtual ~wxFontsManagerBase(); + +public: + /// Returns the font manager singleton, creating it if it doesn't exist + static wxFontsManager *Get(); + + /// Called by wxApp to shut down the manager + static void CleanUp(); + + /// Returns list of all available font bundles + const wxFontBundleList& GetBundles() const { return *m_list; } + + /** + Returns object representing font bundle with the given name. + + The returned object is owned by wxFontsManager, you must not delete it. + */ + wxFontBundle *GetBundle(const wxString& name) const; + + /** + Returns object representing font bundle that can be used to render + given font. + + The returned object is owned by wxFontsManager, you must not delete it. + */ + wxFontBundle *GetBundleForFont(const wxFontMgrFontRefData& font) const; + + /// This method must be called by derived + void AddBundle(wxFontBundle *bundle); + + /// Returns default facename for given wxFont family + virtual wxString GetDefaultFacename(wxFontFamily family) const = 0; + +private: + wxFontBundleHash *m_hash; + wxFontBundleList *m_list; + +protected: + static wxFontsManager *ms_instance; +}; + + + +#if defined(__WXDFB__) + #include "wx/dfb/private/fontmgr.h" +#endif + + + +/// wxFontMgrFontRefData implementation using wxFontsManager classes +class wxFontMgrFontRefData : public wxGDIRefData +{ +public: + wxFontMgrFontRefData(int size = wxDEFAULT, + wxFontFamily family = wxFONTFAMILY_DEFAULT, + wxFontStyle style = wxFONTSTYLE_NORMAL, + int weight = wxFONTWEIGHT_NORMAL, + bool underlined = false, + const wxString& faceName = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + wxFontMgrFontRefData(const wxFontMgrFontRefData& data); + ~wxFontMgrFontRefData(); + + wxFontBundle *GetFontBundle() const; + wxFontInstance *GetFontInstance(float scale, bool antialiased) const; + + bool IsFixedWidth() const { return GetFontBundle()->IsFixed(); } + + const wxNativeFontInfo *GetNativeFontInfo() const { return &m_info; } + + double GetFractionalPointSize() const { return m_info.pointSize; } + wxString GetFaceName() const { return m_info.faceName; } + wxFontFamily GetFamily() const { return m_info.family; } + wxFontStyle GetStyle() const { return m_info.style; } + int GetNumericWeight() const { return m_info.weight; } + bool GetUnderlined() const { return m_info.underlined; } + wxFontEncoding GetEncoding() const { return m_info.encoding; } + + void SetFractionalPointSize(double pointSize); + void SetFamily(wxFontFamily family); + void SetStyle(wxFontStyle style); + void SetNumericWeight(int weight); + void SetFaceName(const wxString& faceName); + void SetUnderlined(bool underlined); + void SetEncoding(wxFontEncoding encoding); + +private: + void EnsureValidFont(); + + wxNativeFontInfo m_info; + + wxFontFace *m_fontFace; + wxFontBundle *m_fontBundle; + bool m_fontValid; +}; + +#endif // _WX_PRIVATE_FONTMGR_H_ diff --git a/lib/wxWidgets/include/wx/private/fswatcher.h b/lib/wxWidgets/include/wx/private/fswatcher.h new file mode 100644 index 0000000..d3602f7 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/fswatcher.h @@ -0,0 +1,115 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/private/fswatcher.h +// Purpose: File system watcher impl classes +// Author: Bartosz Bekier +// Created: 2009-05-26 +// Copyright: (c) 2009 Bartosz Bekier <bartosz.bekier@gmail.com> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef WX_PRIVATE_FSWATCHER_H_ +#define WX_PRIVATE_FSWATCHER_H_ + +#include "wx/sharedptr.h" + +#ifdef wxHAS_INOTIFY + class wxFSWatchEntryUnix; + #define wxFSWatchEntry wxFSWatchEntryUnix + WX_DECLARE_STRING_HASH_MAP(wxSharedPtr<wxFSWatchEntry>,wxFSWatchEntries); + #include "wx/unix/private/fswatcher_inotify.h" +#elif defined(wxHAS_KQUEUE) + class wxFSWatchEntryKq; + #define wxFSWatchEntry wxFSWatchEntryKq + WX_DECLARE_STRING_HASH_MAP(wxSharedPtr<wxFSWatchEntry>,wxFSWatchEntries); + #include "wx/unix/private/fswatcher_kqueue.h" +#elif defined(__WINDOWS__) + class wxFSWatchEntryMSW; + #define wxFSWatchEntry wxFSWatchEntryMSW + WX_DECLARE_STRING_HASH_MAP(wxSharedPtr<wxFSWatchEntry>,wxFSWatchEntries); + #include "wx/msw/private/fswatcher.h" +#else + #define wxFSWatchEntry wxFSWatchEntryPolling +#endif + +class wxFSWatcherImpl +{ +public: + wxFSWatcherImpl(wxFileSystemWatcherBase* watcher) : + m_watcher(watcher) + { + } + + virtual ~wxFSWatcherImpl() + { + (void) RemoveAll(); + } + + virtual bool Init() = 0; + + virtual bool Add(const wxFSWatchInfo& winfo) + { + if ( m_watches.find(winfo.GetPath()) != m_watches.end() ) + { + wxLogTrace(wxTRACE_FSWATCHER, + "Path '%s' is already watched", winfo.GetPath()); + // This can happen if a dir is watched, then a parent tree added + return true; + } + + // construct watch entry + wxSharedPtr<wxFSWatchEntry> watch(new wxFSWatchEntry(winfo)); + + if (!DoAdd(watch)) + return false; + + // add watch to our map (always succeeds, checked above) + wxFSWatchEntries::value_type val(watch->GetPath(), watch); + return m_watches.insert(val).second; + } + + virtual bool Remove(const wxFSWatchInfo& winfo) + { + wxFSWatchEntries::iterator it = m_watches.find(winfo.GetPath()); + if ( it == m_watches.end() ) + { + wxLogTrace(wxTRACE_FSWATCHER, + "Path '%s' is not watched", winfo.GetPath()); + // This can happen if a dir is watched, then a parent tree added + return true; + } + wxSharedPtr<wxFSWatchEntry> watch = it->second; + m_watches.erase(it); + return DoRemove(watch); + } + + virtual bool RemoveAll() + { + bool ret = true; + for ( wxFSWatchEntries::iterator it = m_watches.begin(); + it != m_watches.end(); + ++it ) + { + if ( !DoRemove(it->second) ) + ret = false; + } + m_watches.clear(); + return ret; + } + + // Check whether any filespec matches the file's ext (if present) + bool MatchesFilespec(const wxFileName& fn, const wxString& filespec) const + { + return filespec.empty() || wxMatchWild(filespec, fn.GetFullName()); + } + +protected: + virtual bool DoAdd(wxSharedPtr<wxFSWatchEntry> watch) = 0; + + virtual bool DoRemove(wxSharedPtr<wxFSWatchEntry> watch) = 0; + + wxFSWatchEntries m_watches; + wxFileSystemWatcherBase* m_watcher; +}; + + +#endif /* WX_PRIVATE_FSWATCHER_H_ */ diff --git a/lib/wxWidgets/include/wx/private/glibc.h b/lib/wxWidgets/include/wx/private/glibc.h new file mode 100644 index 0000000..94b8526 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/glibc.h @@ -0,0 +1,25 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/glibc.h +// Purpose: glibc-specific private wx header +// Author: Vadim Zeitlin +// Created: 2022-06-23 +// Copyright: (c) 2022 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_GLIBC_H_ +#define _WX_PRIVATE_GLIBC_H_ + +// Ensure that a header include __GLIBC__ is defined. +#include <string.h> + +// Macro for testing glibc version similar to wxCHECK_GCC_VERSION(). +#if defined(__GLIBC__) && defined(__GLIBC_MINOR__) + #define wxCHECK_GLIBC_VERSION( major, minor ) \ + ( ( __GLIBC__ > (major) ) \ + || ( __GLIBC__ == (major) && __GLIBC_MINOR__ >= (minor) ) ) +#else + #define wxCHECK_GLIBC_VERSION( major, minor ) 0 +#endif + +#endif // _WX_PRIVATE_GLIBC_H_ diff --git a/lib/wxWidgets/include/wx/private/graphics.h b/lib/wxWidgets/include/wx/private/graphics.h new file mode 100644 index 0000000..363311e --- /dev/null +++ b/lib/wxWidgets/include/wx/private/graphics.h @@ -0,0 +1,168 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/private/graphics.h +// Purpose: private graphics context header +// Author: Stefan Csomor +// Modified by: +// Created: +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GRAPHICS_PRIVATE_H_ +#define _WX_GRAPHICS_PRIVATE_H_ + +#if wxUSE_GRAPHICS_CONTEXT + +#include "wx/graphics.h" + +class WXDLLIMPEXP_CORE wxGraphicsObjectRefData : public wxObjectRefData +{ + public : + wxGraphicsObjectRefData( wxGraphicsRenderer* renderer ); + wxGraphicsObjectRefData( const wxGraphicsObjectRefData* data ); + wxGraphicsRenderer* GetRenderer() const ; + virtual wxGraphicsObjectRefData* Clone() const ; + + protected : + wxGraphicsRenderer* m_renderer; +} ; + +class WXDLLIMPEXP_CORE wxGraphicsBitmapData : public wxGraphicsObjectRefData +{ +public : + wxGraphicsBitmapData( wxGraphicsRenderer* renderer) : + wxGraphicsObjectRefData(renderer) {} + + virtual ~wxGraphicsBitmapData() {} + + // returns the native representation + virtual void * GetNativeBitmap() const = 0; +} ; + +class WXDLLIMPEXP_CORE wxGraphicsMatrixData : public wxGraphicsObjectRefData +{ +public : + wxGraphicsMatrixData( wxGraphicsRenderer* renderer) : + wxGraphicsObjectRefData(renderer) {} + + virtual ~wxGraphicsMatrixData() {} + + // concatenates the matrix + virtual void Concat( const wxGraphicsMatrixData *t ) = 0; + + // sets the matrix to the respective values + virtual void Set(wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, + wxDouble tx=0.0, wxDouble ty=0.0) = 0; + + // gets the component values of the matrix + virtual void Get(wxDouble* a=NULL, wxDouble* b=NULL, wxDouble* c=NULL, + wxDouble* d=NULL, wxDouble* tx=NULL, wxDouble* ty=NULL) const = 0; + + // makes this the inverse matrix + virtual void Invert() = 0; + + // returns true if the elements of the transformation matrix are equal ? + virtual bool IsEqual( const wxGraphicsMatrixData* t) const = 0; + + // return true if this is the identity matrix + virtual bool IsIdentity() const = 0; + + // + // transformation + // + + // 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 (radians) + virtual void Rotate( wxDouble angle ) = 0; + + // + // apply the transforms + // + + // applies that matrix to the point + virtual void TransformPoint( wxDouble *x, wxDouble *y ) const = 0; + + // applies the matrix except for translations + virtual void TransformDistance( wxDouble *dx, wxDouble *dy ) const =0; + + // returns the native representation + virtual void * GetNativeMatrix() const = 0; +} ; + +class WXDLLIMPEXP_CORE wxGraphicsPathData : public wxGraphicsObjectRefData +{ +public : + wxGraphicsPathData(wxGraphicsRenderer* renderer) : wxGraphicsObjectRefData(renderer) {} + virtual ~wxGraphicsPathData() {} + + // + // These are the path primitives from which everything else can be constructed + // + + // begins a new subpath at (x,y) + virtual void MoveToPoint( wxDouble x, wxDouble y ) = 0; + + // adds a straight line from the current point to (x,y) + virtual void AddLineToPoint( wxDouble x, wxDouble y ) = 0; + + // adds a cubic Bezier curve from the current point, using two control points and an end point + virtual void AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y ) = 0; + + // adds another path + virtual void AddPath( const wxGraphicsPathData* path ) =0; + + // closes the current sub-path + virtual void CloseSubpath() = 0; + + // gets the last point of the current path, (0,0) if not yet set + virtual void GetCurrentPoint( wxDouble* x, wxDouble* y) const = 0; + + // adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle + virtual void AddArc( wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise ) = 0; + + // + // These are convenience functions which - if not available natively will be assembled + // using the primitives from above + // + + // adds a quadratic Bezier curve from the current point, using a control point and an end point + virtual void AddQuadCurveToPoint( wxDouble cx, wxDouble cy, wxDouble x, wxDouble y ); + + // appends a rectangle as a new closed subpath + virtual void AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h ); + + // appends an ellipsis as a new closed subpath fitting the passed rectangle + virtual void AddCircle( wxDouble x, wxDouble y, wxDouble r ); + + // appends a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1) + virtual void AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ) ; + + // appends an ellipse + virtual void AddEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h); + + // appends a rounded rectangle + virtual void AddRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius); + + // returns the native path + virtual void * GetNativePath() const = 0; + + // give the native path returned by GetNativePath() back (there might be some deallocations necessary) + virtual void UnGetNativePath(void *p) const= 0; + + // transforms each point of this path by the matrix + virtual void Transform( const wxGraphicsMatrixData* matrix ) =0; + + // gets the bounding box enclosing all points (possibly including control points) + virtual void GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) const=0; + + virtual bool Contains( wxDouble x, wxDouble y, wxPolygonFillMode fillStyle = wxODDEVEN_RULE) const=0; +}; + +#endif + +#endif // _WX_GRAPHICS_PRIVATE_H_ diff --git a/lib/wxWidgets/include/wx/private/icondir.h b/lib/wxWidgets/include/wx/private/icondir.h new file mode 100644 index 0000000..30cba3a --- /dev/null +++ b/lib/wxWidgets/include/wx/private/icondir.h @@ -0,0 +1,91 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/icondir.h +// Purpose: Declarations of structs used for loading MS icons +// Author: wxWidgets team +// Created: 2017-05-19 +// Copyright: (c) 2017 wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_ICONDIR_H_ +#define _WX_PRIVATE_ICONDIR_H_ + +#include "wx/defs.h" // wxUint* declarations + + +// Structs declared here are used for loading group icons from +// .ICO files or MS Windows resources. +// Icon entry and directory structs for .ICO files and +// MS Windows resources are very similar but not identical. + +#if wxUSE_ICO_CUR + +#if wxUSE_STREAMS + +// icon entry in .ICO files +struct ICONDIRENTRY +{ + wxUint8 bWidth; // Width of the image + wxUint8 bHeight; // Height of the image (times 2) + wxUint8 bColorCount; // Number of colors in image (0 if >=8bpp) + wxUint8 bReserved; // Reserved + + // these two are different in icons and cursors: + // icon or cursor + wxUint16 wPlanes; // Color Planes or XHotSpot + wxUint16 wBitCount; // Bits per pixel or YHotSpot + + wxUint32 dwBytesInRes; // how many bytes in this resource? + wxUint32 dwImageOffset; // where in the file is this image +}; + +// icon directory in .ICO files +struct ICONDIR +{ + wxUint16 idReserved; // Reserved + wxUint16 idType; // resource type (1 for icons, 2 for cursors) + wxUint16 idCount; // how many images? +}; + +#endif // wxUSE_STREAMS + + +#ifdef __WINDOWS__ + +#pragma pack(push) +#pragma pack(2) + +// icon entry in MS Windows resources +struct GRPICONDIRENTRY +{ + wxUint8 bWidth; // Width of the image + wxUint8 bHeight; // Height of the image (times 2) + wxUint8 bColorCount; // Number of colors in image (0 if >=8bpp) + wxUint8 bReserved; // Reserved + + // these two are different in icons and cursors: + // icon or cursor + wxUint16 wPlanes; // Color Planes or XHotSpot + wxUint16 wBitCount; // Bits per pixel or YHotSpot + + wxUint32 dwBytesInRes; // how many bytes in this resource? + + wxUint16 nID; // actual icon resource ID +}; + +// icon directory in MS Windows resources +struct GRPICONDIR +{ + wxUint16 idReserved; // Reserved + wxUint16 idType; // resource type (1 for icons, 2 for cursors) + wxUint16 idCount; // how many images? + GRPICONDIRENTRY idEntries[1]; // The entries for each image +}; + +#pragma pack(pop) + +#endif // __WINDOWS__ + +#endif // wxUSE_ICO_CUR + +#endif // _WX_PRIVATE_ICONDIR_H_ diff --git a/lib/wxWidgets/include/wx/private/json.h b/lib/wxWidgets/include/wx/private/json.h new file mode 100644 index 0000000..8e93b7d --- /dev/null +++ b/lib/wxWidgets/include/wx/private/json.h @@ -0,0 +1,88 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/json.h +// Purpose: Helper functions to handle JSON data +// Author: Tobias Taschner +// Created: 2020-01-17 +// Copyright: (c) 2020 wxWidgets development team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_JSON_H_ +#define _WX_PRIVATE_JSON_H_ + +namespace wxJSON +{ + +// Decode a string literal including escape sequences +// Returns false if the input string is not a valid JSON string +bool DecodeString(const wxString& in, wxString* out) +{ + const wxWCharBuffer buf = in.wc_str(); + const wchar_t* ch = buf.data(); + // String has to chart with a quote + if (*(ch++) != '"') + return false; + out->clear(); + out->reserve(buf.length()); + const wchar_t* end = buf.data() + buf.length() - 1; + for (; ch < end; ++ch) + { + if (*ch == '\\') + { + switch (*(++ch)) + { + case 'b': + out->append('\b'); + break; + case 'n': + out->append('\n'); + break; + case 'r': + out->append('\r'); + break; + case 't': + out->append('\t'); + break; + case 'f': + out->append('\f'); + break; + case '/': + out->append('/'); + break; + case '"': + out->append('"'); + break; + case '\\': + out->append('\\'); + break; + case 'u': +#if SIZEOF_WCHAR_T == 2 + // In this case, we handle surrogates without doing anything special was wchar_t strings use UTF-17 encoding. + if (wxIsxdigit(ch[1]) && wxIsxdigit(ch[2]) && + wxIsxdigit(ch[3]) && wxIsxdigit(ch[4])) + { + wchar_t uchar = wxHexToDec(wxString(&ch[3], 2)) | + wxHexToDec(wxString(&ch[1], 2)) >> 8; + out->append(uchar); + ch += 4; + } +#else + #error Implement correct surrogate handling. +#endif + break; + default: + return false; + break; + } + } + else + out->append(*ch); + } + + // String has to end with a quote + return (*ch) == '"'; +} + +} // namespace JSON + +#endif // _WX_PRIVATE_JSON_H_ diff --git a/lib/wxWidgets/include/wx/private/jsscriptwrapper.h b/lib/wxWidgets/include/wx/private/jsscriptwrapper.h new file mode 100644 index 0000000..6e9bb18 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/jsscriptwrapper.h @@ -0,0 +1,212 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/jsscriptwrapper.h +// Purpose: JS Script Wrapper for wxWebView +// Author: Jose Lorenzo +// Created: 2017-08-12 +// Copyright: (c) 2017 Jose Lorenzo <josee.loren@gmail.com> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_JSSCRIPTWRAPPER_H_ +#define _WX_PRIVATE_JSSCRIPTWRAPPER_H_ + +#include "wx/regex.h" + +// ---------------------------------------------------------------------------- +// Helper for wxWebView::RunScript() +// ---------------------------------------------------------------------------- + +// This class provides GetWrappedCode(), GetOutputCode() and GetCleanUpCode() +// functions that should be executed in the backend-appropriate way by each +// wxWebView implementation in order to actually execute the user-provided +// JavaScript code, retrieve its result (if it executed successfully) and +// perform the cleanup at the end. +class wxJSScriptWrapper +{ +public: + enum OutputType + { + JS_OUTPUT_STRING, // All return types are converted to a string + JS_OUTPUT_WEBKIT, // Some return types will be processed + JS_OUTPUT_IE, // Most return types will be processed + JS_OUTPUT_RAW // The return types is returned as is + }; + + wxJSScriptWrapper(const wxString& js, OutputType outputType) + : m_outputType(outputType) + { + // Adds one escape level. + const char *charsNeededToBeEscaped = "\\\"\n\r\v\t\b\f"; + m_escapedCode.reserve(js.size()); + for (wxString::const_iterator it = js.begin(); it != js.end(); ++it) + { + if (wxStrchr(charsNeededToBeEscaped, *it)) + { + m_escapedCode += '\\'; + switch ((wxChar) *it) + { + case 0x0A: // '\n' + m_escapedCode += 'n'; + break; + case 0x0D: // '\r' + m_escapedCode += 'r'; + break; + case 0x0B: // '\v' + m_escapedCode += 'v'; + break; + case 0x09: // '\t' + m_escapedCode += 't'; + break; + case 0x08: // '\b' + m_escapedCode += 'b'; + break; + case 0x0C: // '\f' + m_escapedCode += 'f'; + break; + default: + m_escapedCode += *it; + } + } + else + m_escapedCode += *it; + } + } + + // Get the code to execute, its returned value will be either the value, + // if it executed successfully, or the exception message prefixed with + // "__wxexc:" if an error occurred. + // + // Either use SetOutput() to specify the script result or access it directly + // Using GetOutputRef() + // + // Execute ExtractOutput() later to get the real output after successful + // execution of this code or the proper error message. + wxString GetWrappedCode() const + { + wxString code = wxString::Format( + wxASCII_STR("(function () { try { var res = eval(\"%s\"); "), + m_escapedCode); + + switch (m_outputType) + { + case JS_OUTPUT_STRING: + code += wxASCII_STR( + "if (typeof res == 'object') return JSON.stringify(res);" + "else if (typeof res == 'undefined') return 'undefined';" + "else return String(res);" + ); + break; + case JS_OUTPUT_WEBKIT: + code += wxASCII_STR( + "if (typeof res == 'object') return JSON.stringify(res);" + "else if (typeof res == 'undefined') return 'undefined';" + "else return res;" + ); + break; + case JS_OUTPUT_IE: + code += wxASCII_STR( + "try {" + "return (res == null || typeof res != 'object') ? String(res)" + ": JSON.stringify(res);" + "}" + "catch (e) {" + "try {" + "function __wx$stringifyJSON(obj) {" + "if (!(obj instanceof Object))" + "return typeof obj === \"string\"" + "? \'\"\' + obj + \'\"\'" + ": \'\' + obj;" + "else if (obj instanceof Array) {" + "if (obj[0] === undefined)" + "return \'[]\';" + "else {" + "var arr = [];" + "for (var i = 0; i < obj.length; i++)" + "arr.push(__wx$stringifyJSON(obj[i]));" + "return \'[\' + arr + \']\';" + "}" + "}" + "else if (typeof obj === \"object\") {" + "if (obj instanceof Date) {" + "if (!Date.prototype.toISOString) {" + "(function() {" + "function pad(number) {" + "return number < 10" + "? '0' + number" + ": number;" + "}" + "Date.prototype.toISOString = function() {" + "return this.getUTCFullYear() +" + "'-' + pad(this.getUTCMonth() + 1) +" + "'-' + pad(this.getUTCDate()) +" + "'T' + pad(this.getUTCHours()) +" + "':' + pad(this.getUTCMinutes()) +" + "':' + pad(this.getUTCSeconds()) +" + "'.' + (this.getUTCMilliseconds() / 1000)" + ".toFixed(3).slice(2, 5) + 'Z\"';" + "};" + "}());" + "}" + "return '\"' + obj.toISOString(); + '\"'" + "}" + "var objElements = [];" + "for (var key in obj)" + "{" + "if (typeof obj[key] === \"function\")" + "return \'{}\';" + "else {" + "objElements.push(\'\"\'" + "+ key + \'\":\' +" + "__wx$stringifyJSON(obj[key]));" + "}" + "}" + "return \'{\' + objElements + \'}\';" + "}" + "}" + "return __wx$stringifyJSON(res);" + "}" + "catch (e) { return \"__wxexc:\" + e.name + \": \" + e.message; }" + "}"); + break; + case JS_OUTPUT_RAW: + code += wxASCII_STR("return res;"); + break; + } + + code += + wxASCII_STR("} catch (e) { return \"__wxexc:\" + e.name + \": \" + e.message; }" + "})()"); + return code; + } + + // Extract the output value + // + // Returns true if executed successfully + // string of the result will be put into output + // Returns false when an exception occurred + // string will be the exception message + static bool ExtractOutput(const wxString& result, wxString* output) + { + if (output) + *output = result; + + if (result.starts_with(wxASCII_STR("__wxexc:"))) + { + if (output) + output->Remove(0, 8); + return false; + } + else + { + return true; + } + } + +private: + wxString m_escapedCode; + OutputType m_outputType; + + wxDECLARE_NO_COPY_CLASS(wxJSScriptWrapper); +}; + +#endif // _WX_PRIVATE_JSSCRIPTWRAPPER_H_ diff --git a/lib/wxWidgets/include/wx/private/launchbrowser.h b/lib/wxWidgets/include/wx/private/launchbrowser.h new file mode 100644 index 0000000..984df89 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/launchbrowser.h @@ -0,0 +1,43 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/launchbrowser.h +// Purpose: Helpers for wxLaunchDefaultBrowser() implementation. +// Author: Vadim Zeitlin +// Created: 2016-02-07 +// Copyright: (c) 2016 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_LAUNCHBROWSER_H_ +#define _WX_PRIVATE_LAUNCHBROWSER_H_ + +// ---------------------------------------------------------------------------- +// wxLaunchBrowserParams: passed to wxDoLaunchDefaultBrowser() +// ---------------------------------------------------------------------------- + +struct wxLaunchBrowserParams +{ + explicit wxLaunchBrowserParams(int f) : flags(f) { } + + // Return either the URL or the file depending on our scheme. + const wxString& GetPathOrURL() const + { + return scheme == wxS("file") ? path : url; + } + + + // The URL is always specified and is the real URL, always with the scheme + // part, which can be "file://". + wxString url; + + // The path is a local path which is only non-empty if the URL uses the + // "file://" scheme. + wxString path; + + // The scheme of the URL, e.g. "file" or "http". + wxString scheme; + + // The flags passed to wxLaunchDefaultBrowser(). + int flags; +}; + +#endif // _WX_PRIVATE_LAUNCHBROWSER_H_ diff --git a/lib/wxWidgets/include/wx/private/localeset.h b/lib/wxWidgets/include/wx/private/localeset.h new file mode 100644 index 0000000..ac8a8a4 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/localeset.h @@ -0,0 +1,67 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/localeset.h +// Purpose: Define helper wxLocaleSetter class. +// Author: Vadim Zeitlin +// Created: 2021-08-03 (extracted from tests/testprec.h) +// Copyright: (c) 2021 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_LOCALESET_H_ +#define _WX_PRIVATE_LOCALESET_H_ + +#include "wx/crt.h" // wxStrdupA() + +#include <locale.h> + +// Helper class setting the locale to the given one for its lifetime. +class wxLocaleSetter +{ +public: + wxLocaleSetter(const char *loc) + : m_locOld(wxStrdupA(setlocale(LC_ALL, NULL))) + { + setlocale(LC_ALL, loc); + } + + ~wxLocaleSetter() + { + setlocale(LC_ALL, m_locOld); + free(m_locOld); + } + +private: + char * const m_locOld; + + wxDECLARE_NO_COPY_CLASS(wxLocaleSetter); +}; + +// An even simpler helper for setting the locale to "C" one during its lifetime. +class wxCLocaleSetter : private wxLocaleSetter +{ +public: + wxCLocaleSetter() : wxLocaleSetter("C") { } + +private: + wxDECLARE_NO_COPY_CLASS(wxCLocaleSetter); +}; + +// This function must be called on program startup and after changing +// locale to ensure LC_CTYPE is set correctly under macOS (it does nothing +// under the other platforms currently). +inline void wxEnsureLocaleIsCompatibleWithCRT() +{ +#if wxUSE_UNICODE && defined(__DARWIN__) + // In OS X and iOS, wchar_t CRT functions convert to char* and fail under + // some locales. The safest fix is to set LC_CTYPE to UTF-8 to ensure that + // they can handle any input. + // + // Note that this must be done for any app, Cocoa or console, whether or + // not it uses wxLocale. + // + // See https://stackoverflow.com/questions/11713745/why-does-the-printf-family-of-functions-care-about-locale + setlocale(LC_CTYPE, "UTF-8"); +#endif // wxUSE_UNICODE && defined(__DARWIN__) +} + +#endif // _WX_PRIVATE_LOCALESET_H_ diff --git a/lib/wxWidgets/include/wx/private/markupparser.h b/lib/wxWidgets/include/wx/private/markupparser.h new file mode 100644 index 0000000..855d92a --- /dev/null +++ b/lib/wxWidgets/include/wx/private/markupparser.h @@ -0,0 +1,176 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/markupparser.h +// Purpose: Classes for parsing simple markup. +// Author: Vadim Zeitlin +// Created: 2011-02-16 +// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_MARKUPPARSER_H_ +#define _WX_PRIVATE_MARKUPPARSER_H_ + +#include "wx/string.h" + +// ---------------------------------------------------------------------------- +// wxMarkupSpanAttributes: information about attributes for a markup span. +// ---------------------------------------------------------------------------- + +struct wxMarkupSpanAttributes +{ + enum OptionalBool + { + Unspecified = -1, + No, + Yes + }; + + wxMarkupSpanAttributes() + { + m_sizeKind = Size_Unspecified; + + m_isBold = + m_isItalic = + m_isUnderlined = + m_isStrikethrough = Unspecified; + } + + // If a string is empty, it means that the corresponding attribute is not + // set. + wxString m_fgCol, + m_bgCol, + m_fontFace; + + // There are many ways of specifying the size. First of all, the size may + // be relative in which case m_fontSize is either -1 or +1 meaning that + // it's one step smaller or larger than the current font. Second, it may be + // absolute in which case m_fontSize contains either the size in 1024th of + // a point (Pango convention) or its values are in [-3, 3] interval and map + // to [xx-small, xx-large] CSS-like font size specification. And finally it + // may be not specified at all, of course, in which case the value of + // m_fontSize doesn't matter and it shouldn't be used. + enum + { + Size_Unspecified, + Size_Relative, + Size_Symbolic, + Size_PointParts + } m_sizeKind; + int m_fontSize; + + // If the value is Unspecified, the attribute wasn't given. + OptionalBool m_isBold, + m_isItalic, + m_isUnderlined, + m_isStrikethrough; +}; + +// ---------------------------------------------------------------------------- +// wxMarkupParserOutput: gathers the results of parsing markup. +// ---------------------------------------------------------------------------- + +// A class deriving directly from this one needs to implement all the pure +// virtual functions below but as the handling of all simple tags (bold, italic +// &c) is often very similar, it is usually more convenient to inherit from +// wxMarkupParserFontOutput defined in wx/private/markupparserfont.h instead. +class wxMarkupParserOutput +{ +public: + wxMarkupParserOutput() { } + virtual ~wxMarkupParserOutput() { } + + // Virtual functions called by wxMarkupParser while parsing the markup. + + // Called for a run of normal text. + virtual void OnText(const wxString& text) = 0; + + // These functions correspond to the simple tags without parameters. + virtual void OnBoldStart() = 0; + virtual void OnBoldEnd() = 0; + + virtual void OnItalicStart() = 0; + virtual void OnItalicEnd() = 0; + + virtual void OnUnderlinedStart() = 0; + virtual void OnUnderlinedEnd() = 0; + + virtual void OnStrikethroughStart() = 0; + virtual void OnStrikethroughEnd() = 0; + + virtual void OnBigStart() = 0; + virtual void OnBigEnd() = 0; + + virtual void OnSmallStart() = 0; + virtual void OnSmallEnd() = 0; + + virtual void OnTeletypeStart() = 0; + virtual void OnTeletypeEnd() = 0; + + // The generic span start and end functions. + virtual void OnSpanStart(const wxMarkupSpanAttributes& attrs) = 0; + virtual void OnSpanEnd(const wxMarkupSpanAttributes& attrs) = 0; + +private: + wxDECLARE_NO_COPY_CLASS(wxMarkupParserOutput); +}; + +// ---------------------------------------------------------------------------- +// wxMarkupParser: parses the given markup text into wxMarkupParserOutput. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMarkupParser +{ +public: + // Initialize the parser with the object that will receive parsing results. + // This object lifetime must be greater than ours. + explicit wxMarkupParser(wxMarkupParserOutput& output) + : m_output(output) + { + } + + // Parse the entire string and call wxMarkupParserOutput methods. + // + // Return true if the string was successfully parsed or false if it failed + // (presumably because of syntax errors in the markup). + bool Parse(const wxString& text); + + // Quote a normal string, not meant to be interpreted as markup, so that it + // produces the same string when parsed as markup. This means, for example, + // replacing '<' in the input string with "<" to prevent them from being + // interpreted as tag opening characters. + static wxString Quote(const wxString& text); + + // Strip markup from a string, i.e. simply remove all tags and replace + // XML entities with their values (or with "&&" in case of "&" to + // prevent it from being interpreted as mnemonic marker). + static wxString Strip(const wxString& text); + +private: + // Simple struct combining the name of a tag and its attributes. + struct TagAndAttrs + { + TagAndAttrs(const wxString& name_) : name(name_) { } + + wxString name; + wxMarkupSpanAttributes attrs; + }; + + // Call the wxMarkupParserOutput method corresponding to the given tag. + // + // Return false if the tag doesn't match any of the known ones. + bool OutputTag(const TagAndAttrs& tagAndAttrs, bool start); + + // Parse the attributes and fill the provided TagAndAttrs object with the + // information about them. Does nothing if attrs string is empty. + // + // Returns empty string on success of a [fragment of an] error message if + // we failed to parse the attributes. + wxString ParseAttrs(wxString attrs, TagAndAttrs& tagAndAttrs); + + + wxMarkupParserOutput& m_output; + + wxDECLARE_NO_COPY_CLASS(wxMarkupParser); +}; + +#endif // _WX_PRIVATE_MARKUPPARSER_H_ diff --git a/lib/wxWidgets/include/wx/private/markupparserattr.h b/lib/wxWidgets/include/wx/private/markupparserattr.h new file mode 100644 index 0000000..75d8749 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/markupparserattr.h @@ -0,0 +1,256 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/markupparserattr.h +// Purpose: Classes mapping markup attributes to wxFont/wxColour. +// Author: Vadim Zeitlin +// Created: 2011-02-18 +// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_MARKUPPARSERATTR_H_ +#define _WX_PRIVATE_MARKUPPARSERATTR_H_ + +#include "wx/private/markupparser.h" + +#include "wx/stack.h" + +#include "wx/colour.h" +#include "wx/font.h" + +// ---------------------------------------------------------------------------- +// wxMarkupParserAttrOutput: simplified wxFont-using version of the above. +// ---------------------------------------------------------------------------- + +// This class assumes that wxFont and wxColour are used to perform all the +// markup tags and implements the base class virtual functions in terms of +// OnAttr{Start,End}() only. +// +// Notice that you still must implement OnText() inherited from the base class +// when deriving from this one. +class wxMarkupParserAttrOutput : public wxMarkupParserOutput +{ +public: + // A container of font and colours with inheritance support. It holds two + // sets of attributes: + // 1. The currently specified ones from parsed tags that contain + // information on what should change in the output; some of them + // may be invalid if only the others are affected by a change. + // 2. The _effective_ attributes that are always valid and accumulate + // all past changes as the markup is being parser; these are used + // to restore state when unwinding nested attributes. + struct Attr + { + Attr(const Attr *attrInEffect, + const wxFont& font_, + const wxColour& foreground_ = wxColour(), + const wxColour& background_ = wxColour()) + : font(font_), foreground(foreground_), background(background_) + { + if (attrInEffect) + { + effectiveFont = font.IsOk() ? font : attrInEffect->effectiveFont; + effectiveForeground = foreground_.IsOk() ? foreground_ : attrInEffect->effectiveForeground; + effectiveBackground = background.IsOk() ? background : attrInEffect->effectiveBackground; + } + else + { + effectiveFont = font; + effectiveForeground = foreground; + effectiveBackground = background; + } + } + + wxFont font; + wxColour foreground, + background; + wxFont effectiveFont; + wxColour effectiveForeground, + effectiveBackground; + }; + + + // This object must be initialized with the font and colours to use + // initially, i.e. the ones used before any tags in the string. + wxMarkupParserAttrOutput(const wxFont& font, + const wxColour& foreground, + const wxColour& background) + { + m_attrs.push(Attr(NULL, font, foreground, background)); + } + + // Indicates the change of the font and/or colours used. Any of the + // fields of the argument may be invalid indicating that the corresponding + // attribute didn't actually change. + virtual void OnAttrStart(const Attr& attr) = 0; + + // Indicates the end of the region affected by the given attributes + // (the same ones that were passed to the matching OnAttrStart(), use + // GetAttr() to get the ones that will be used from now on). + virtual void OnAttrEnd(const Attr& attr) = 0; + + + // Implement all pure virtual methods inherited from the base class in + // terms of our own ones. + virtual void OnBoldStart() wxOVERRIDE { DoChangeFont(&wxFont::Bold); } + virtual void OnBoldEnd() wxOVERRIDE { DoEndAttr(); } + + virtual void OnItalicStart() wxOVERRIDE { DoChangeFont(&wxFont::Italic); } + virtual void OnItalicEnd() wxOVERRIDE { DoEndAttr(); } + + virtual void OnUnderlinedStart() wxOVERRIDE { DoChangeFont(&wxFont::Underlined); } + virtual void OnUnderlinedEnd() wxOVERRIDE { DoEndAttr(); } + + virtual void OnStrikethroughStart() wxOVERRIDE { DoChangeFont(&wxFont::Strikethrough); } + virtual void OnStrikethroughEnd() wxOVERRIDE { DoEndAttr(); } + + virtual void OnBigStart() wxOVERRIDE { DoChangeFont(&wxFont::Larger); } + virtual void OnBigEnd() wxOVERRIDE { DoEndAttr(); } + + virtual void OnSmallStart() wxOVERRIDE { DoChangeFont(&wxFont::Smaller); } + virtual void OnSmallEnd() wxOVERRIDE { DoEndAttr(); } + + virtual void OnTeletypeStart() wxOVERRIDE + { + wxFont font(GetFont()); + font.SetFamily(wxFONTFAMILY_TELETYPE); + DoSetFont(font); + } + virtual void OnTeletypeEnd() wxOVERRIDE { DoEndAttr(); } + + virtual void OnSpanStart(const wxMarkupSpanAttributes& spanAttr) wxOVERRIDE + { + wxFont font(GetFont()); + if ( !spanAttr.m_fontFace.empty() ) + font.SetFaceName(spanAttr.m_fontFace); + + FontModifier<wxFontWeight>()(spanAttr.m_isBold, + font, &wxFont::SetWeight, + wxFONTWEIGHT_NORMAL, wxFONTWEIGHT_BOLD); + + FontModifier<wxFontStyle>()(spanAttr.m_isItalic, + font, &wxFont::SetStyle, + wxFONTSTYLE_NORMAL, wxFONTSTYLE_ITALIC); + + FontModifier<bool>()(spanAttr.m_isUnderlined, + font, &wxFont::SetUnderlined, + false, true); + + FontModifier<bool>()(spanAttr.m_isStrikethrough, + font, &wxFont::SetStrikethrough, + false, true); + + switch ( spanAttr.m_sizeKind ) + { + case wxMarkupSpanAttributes::Size_Unspecified: + break; + + case wxMarkupSpanAttributes::Size_Relative: + if ( spanAttr.m_fontSize > 0 ) + font.MakeLarger(); + else + font.MakeSmaller(); + break; + + case wxMarkupSpanAttributes::Size_Symbolic: + // The values of font size intentionally coincide with the + // values of wxFontSymbolicSize enum elements so simply cast + // one to the other. + font.SetSymbolicSize( + static_cast<wxFontSymbolicSize>(spanAttr.m_fontSize) + ); + break; + + case wxMarkupSpanAttributes::Size_PointParts: + font.SetFractionalPointSize(spanAttr.m_fontSize/1024.); + break; + } + + + const Attr attr(&m_attrs.top(), font, spanAttr.m_fgCol, spanAttr.m_bgCol); + OnAttrStart(attr); + + m_attrs.push(attr); + } + + virtual void OnSpanEnd(const wxMarkupSpanAttributes& WXUNUSED(spanAttr)) wxOVERRIDE + { + DoEndAttr(); + } + +protected: + // Get the current attributes, i.e. the ones that should be used for + // rendering (or measuring or whatever) the text at the current position in + // the string. + // + // It may be called from OnAttrStart() to get the old attributes used + // before and from OnAttrEnd() to get the new attributes that will be used + // from now on but is mostly meant to be used from overridden OnText() + // implementations. + const Attr& GetAttr() const { return m_attrs.top(); } + + // A shortcut for accessing the font of the current attribute. + const wxFont& GetFont() const { return GetAttr().font; } + +private: + // Change only the font to the given one. Call OnAttrStart() to notify + // about the change and update the attributes stack. + void DoSetFont(const wxFont& font) + { + const Attr attr(&m_attrs.top(), font); + + OnAttrStart(attr); + + m_attrs.push(attr); + } + + // Apply the given function to the font currently on top of the font stack, + // push the new font on the stack and call OnAttrStart() with it. + void DoChangeFont(wxFont (wxFont::*func)() const) + { + DoSetFont((GetFont().*func)()); + } + + void DoEndAttr() + { + const Attr attr(m_attrs.top()); + m_attrs.pop(); + + OnAttrEnd(attr); + } + + // A helper class used to apply the given function to a wxFont object + // depending on the value of an OptionalBool. + template <typename T> + struct FontModifier + { + FontModifier() { } + + void operator()(wxMarkupSpanAttributes::OptionalBool isIt, + wxFont& font, + void (wxFont::*func)(T), + T noValue, + T yesValue) + { + switch ( isIt ) + { + case wxMarkupSpanAttributes::Unspecified: + break; + + case wxMarkupSpanAttributes::No: + (font.*func)(noValue); + break; + + case wxMarkupSpanAttributes::Yes: + (font.*func)(yesValue); + break; + } + } + }; + + + wxStack<Attr> m_attrs; + + wxDECLARE_NO_COPY_CLASS(wxMarkupParserAttrOutput); +}; + +#endif // _WX_PRIVATE_MARKUPPARSERATTR_H_ diff --git a/lib/wxWidgets/include/wx/private/menuradio.h b/lib/wxWidgets/include/wx/private/menuradio.h new file mode 100644 index 0000000..dbbb091 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/menuradio.h @@ -0,0 +1,216 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/private/menuradio.h +// Purpose: wxMenuRadioItemsData implementation +// Author: Vadim Zeitlin +// Modified: Artur Wieczorek: added UpdateOnInsertNonRadio() +// Created: 2017-08-12 +// Copyright: (c) 2011 Vadim Zeitlin et al +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef WX_PRIVATE_MENURADIO_H_ +#define WX_PRIVATE_MENURADIO_H_ + +#include "wx/vector.h" + +// Contains the data about the radio items groups in the given menu. +class wxMenuRadioItemsData +{ +public: + wxMenuRadioItemsData() { } + + // Default copy ctor, assignment operator and dtor are all ok. + + // Find the start and end of the group containing the given position or + // return false if it's not inside any range. + bool GetGroupRange(int pos, int *start, int *end) const + { + // We use a simple linear search here because there are not that many + // items in a menu and hence even fewer radio items ranges anyhow, so + // normally there is no need to do anything fancy (like keeping the + // array sorted and using binary search). + for ( Ranges::const_iterator it = m_ranges.begin(); + it != m_ranges.end(); + ++it ) + { + const Range& r = *it; + + if ( r.start <= pos && pos <= r.end ) + { + if ( start ) + *start = r.start; + if ( end ) + *end = r.end; + + return true; + } + } + + return false; + } + + // Take into account the new radio item about to be added at the given + // position. The are two cases to handle: + // - If item precedes the range, the range indices have to be updated. + // - If item falls inside the range, this range is extended to include + // the item. + // Returns true if this item starts a new radio group, false if it extends + // an existing one. + bool UpdateOnInsertRadio(int pos) + { + bool inExistingGroup = false; + + for ( Ranges::iterator it = m_ranges.begin(); + it != m_ranges.end(); + ++it ) + { + Range& r = *it; + + if ( pos < r.start ) + { + // Item is inserted before this range, update its indices. + r.start++; + r.end++; + } + else if ( pos <= r.end + 1 ) + { + wxASSERT_MSG(!inExistingGroup, + wxS("Item already inserted inside another range")); + // Item is inserted in the middle of this range or immediately + // after it in which case it extends this range so make it span + // one more item in any case. + r.end++; + + inExistingGroup = true; + } + //else: Item is inserted after this range, nothing to do for it. + } + + if ( inExistingGroup ) + return false; + + // Make a new range for the group this item will belong to. + Range r; + r.start = pos; + r.end = pos; + m_ranges.push_back(r); + + return true; + } + + // Take into account the new non-radio item about to be added at the given + // position. The are two cases to handle: + // - If item precedes the range, the range indices have to be updated. + // - If item falls inside the range, this range has to be split into + // two new ranges. + // Returns true if existing group has been split into two subgroups. + bool UpdateOnInsertNonRadio(int pos) + { + bool wasSplit = false; + Range newRange; + + for ( Ranges::iterator it = m_ranges.begin(); + it != m_ranges.end(); + ++it ) + { + Range& r = *it; + + if ( pos <= r.start ) + { + // Item is inserted before this range or just at its start, + // update its indices. + r.start++; + r.end++; + } + else if ( pos <= r.end ) + { + wxASSERT_MSG(!wasSplit, + wxS("Item already inserted inside another range")); + // Item is inserted inside this range in which case + // it breaks the range into two parts: one ending before + // the item and one started after it. + + // The new range after the item has to be stored and added to the list + // after finishing the iteration through the ranges. + newRange.start = pos + 1; // start after the item + newRange.end = r.end + 1; // inherits current end "moved up" by one item + wasSplit = true; + // Current range ends just before the item position. + r.end = pos - 1; + } + //else: Item is inserted after this range, nothing to do for it. + } + + if ( !wasSplit ) + return false; + + // Add a split range to the list. + m_ranges.push_back(newRange); + + return true; + } + + // Update the ranges of the existing radio groups after removing the menu + // item at the given position. + // + // The item being removed can be the item of any kind, not only the radio + // button belonging to the radio group, and this function checks for it + // and, as a side effect, returns true if this item was found inside an + // existing radio group. + bool UpdateOnRemoveItem(int pos) + { + bool inExistingGroup = false; + + // Pointer to (necessarily unique) empty group which could be left + // after removing the last radio button from it. + Ranges::iterator itEmptyGroup = m_ranges.end(); + + for ( Ranges::iterator it = m_ranges.begin(); + it != m_ranges.end(); + ++it ) + { + Range& r = *it; + + if ( pos < r.start ) + { + // Removed item was positioned before this range, update its + // indices. + r.start--; + r.end--; + } + else if ( pos <= r.end ) + { + // Removed item belongs to this radio group (it is a radio + // button), update index of its end. + r.end--; + + // Check if empty group left after removal. + // If so, it will be deleted later on. + if ( r.end < r.start ) + itEmptyGroup = it; + + inExistingGroup = true; + } + //else: Removed item was after this range, nothing to do for it. + } + + // Remove empty group from the list. + if ( itEmptyGroup != m_ranges.end() ) + m_ranges.erase(itEmptyGroup); + + return inExistingGroup; + } + +private: + // Contains the inclusive positions of the range start and end. + struct Range + { + int start; + int end; + }; + + typedef wxVector<Range> Ranges; + Ranges m_ranges; +}; + +#endif // WX_PRIVATE_MENURADIO_H_ diff --git a/lib/wxWidgets/include/wx/private/notifmsg.h b/lib/wxWidgets/include/wx/private/notifmsg.h new file mode 100644 index 0000000..3f02a29 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/notifmsg.h @@ -0,0 +1,76 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/notifmsg.h +// Purpose: wxNotificationMessage declarations +// Author: Tobias Taschner +// Created: 2015-08-04 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_NOTIFMSG_H_ +#define _WX_PRIVATE_NOTIFMSG_H_ + +class wxNotificationMessageImpl +{ +public: + wxNotificationMessageImpl(wxNotificationMessageBase* notification): + m_notification(notification), + m_active(false) + { + + } + + virtual ~wxNotificationMessageImpl() { } + + virtual bool Show(int timeout) = 0; + + virtual bool Close() = 0; + + virtual void SetTitle(const wxString& title) = 0; + + virtual void SetMessage(const wxString& message) = 0; + + virtual void SetParent(wxWindow *parent) = 0; + + virtual void SetFlags(int flags) = 0; + + virtual void SetIcon(const wxIcon& icon) = 0; + + virtual bool AddAction(wxWindowID actionid, const wxString &label) = 0; + + virtual void Detach() + { + if (m_active) + m_notification = NULL; + else + delete this; + } + + bool ProcessNotificationEvent(wxEvent& event) + { + if (m_notification) + return m_notification->ProcessEvent(event); + else + return false; + } + + wxNotificationMessageBase* GetNotification() const + { + return m_notification; + } + +protected: + wxNotificationMessageBase* m_notification; + bool m_active; + + void SetActive(bool active) + { + m_active = active; + + // Delete the implementation if the notification is detached + if (!m_notification && !active) + delete this; + } +}; + +#endif // _WX_PRIVATE_NOTIFMSG_H_ diff --git a/lib/wxWidgets/include/wx/private/overlay.h b/lib/wxWidgets/include/wx/private/overlay.h new file mode 100644 index 0000000..60f272f --- /dev/null +++ b/lib/wxWidgets/include/wx/private/overlay.h @@ -0,0 +1,40 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/private/overlay.h +// Purpose: wxOverlayImpl declaration +// Author: Stefan Csomor +// Modified by: +// Created: 2006-10-20 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_OVERLAY_H_ +#define _WX_PRIVATE_OVERLAY_H_ + +#include "wx/overlay.h" + +#if defined(__WXDFB__) + #define wxHAS_NATIVE_OVERLAY 1 +#elif defined(__WXOSX__) && wxOSX_USE_COCOA + #define wxHAS_NATIVE_OVERLAY 1 +#elif defined(__WXGTK3__) + #define wxHAS_NATIVE_OVERLAY 1 + #define wxHAS_GENERIC_OVERLAY 1 +#else + #define wxHAS_GENERIC_OVERLAY 1 +#endif + +class wxOverlay::Impl +{ +public: + virtual ~Impl(); + virtual bool IsNative() const; + virtual bool IsOk() = 0; + virtual void Init(wxDC* dc, int x, int y, int width, int height) = 0; + virtual void BeginDrawing(wxDC* dc) = 0; + virtual void EndDrawing(wxDC* dc) = 0; + virtual void Clear(wxDC* dc) = 0; + virtual void Reset() = 0; +}; + +#endif // _WX_PRIVATE_OVERLAY_H_ diff --git a/lib/wxWidgets/include/wx/private/pipestream.h b/lib/wxWidgets/include/wx/private/pipestream.h new file mode 100644 index 0000000..d4020b3 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/pipestream.h @@ -0,0 +1,29 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/pipestream.h +// Purpose: Declares wxPipeInputStream and wxPipeOutputStream. +// Author: Vadim Zeitlin +// Modified by: Rob Bresalier +// Created: 2013-04-27 +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// (c) 2013 Rob Bresalier +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_PIPESTREAM_H_ +#define _WX_PRIVATE_PIPESTREAM_H_ + +#include "wx/platform.h" + +// wxPipeInputStream is a platform-dependent input stream class (i.e. deriving, +// possible indirectly, from wxInputStream) for reading from a pipe, i.e. a +// pipe FD under Unix or a pipe HANDLE under MSW. It provides a single extra +// IsOpened() method. +// +// wxPipeOutputStream is similar but has no additional methods at all. +#if defined(__UNIX__) && !defined(__WINDOWS__) + #include "wx/unix/private/pipestream.h" +#elif defined(__WINDOWS__) + #include "wx/msw/private/pipestream.h" +#endif + +#endif // _WX_PRIVATE_PIPESTREAM_H_ diff --git a/lib/wxWidgets/include/wx/private/preferences.h b/lib/wxWidgets/include/wx/private/preferences.h new file mode 100644 index 0000000..8b92645 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/preferences.h @@ -0,0 +1,40 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/preferences.h +// Purpose: wxPreferencesEditorImpl declaration. +// Author: Vaclav Slavik +// Created: 2013-02-19 +// Copyright: (c) 2013 Vaclav Slavik <vslavik@fastmail.fm> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_PREFERENCES_H_ +#define _WX_PRIVATE_PREFERENCES_H_ + +#include "wx/preferences.h" + +#if wxUSE_TOOLBAR && defined(__WXOSX_COCOA__) && wxOSX_USE_NATIVE_TOOLBAR + #define wxHAS_PREF_EDITOR_NATIVE +#endif + +// ---------------------------------------------------------------------------- +// wxPreferencesEditorImpl: defines wxPreferencesEditor implementation. +// ---------------------------------------------------------------------------- + +class wxPreferencesEditorImpl +{ +public: + // This is implemented in a platform-specific way. + static wxPreferencesEditorImpl* Create(const wxString& title); + + // These methods simply mirror the public wxPreferencesEditor ones. + virtual void AddPage(wxPreferencesPage* page) = 0; + virtual void Show(wxWindow* parent) = 0; + virtual void Dismiss() = 0; + + virtual ~wxPreferencesEditorImpl() {} + +protected: + wxPreferencesEditorImpl() {} +}; + +#endif // _WX_PRIVATE_PREFERENCES_H_ diff --git a/lib/wxWidgets/include/wx/private/refcountermt.h b/lib/wxWidgets/include/wx/private/refcountermt.h new file mode 100644 index 0000000..c40a326 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/refcountermt.h @@ -0,0 +1,42 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/refcountermt.h +// Purpose: wxRefCounterMT class: MT-safe version of wxRefCounter +// Author: Vadim Zeitlin +// Created: 2021-01-11 +// Copyright: (c) 2021 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_REFCOUNTERMT_H_ +#define _WX_PRIVATE_REFCOUNTERMT_H_ + +#include "wx/atomic.h" + +// ---------------------------------------------------------------------------- +// Version of wxRefCounter with MT-safe count +// ---------------------------------------------------------------------------- + +class wxRefCounterMT +{ +public: + wxRefCounterMT() { m_count = 1; } + + void IncRef() { wxAtomicInc(m_count); } + void DecRef() + { + if ( wxAtomicDec(m_count) == 0 ) + delete this; + } + +protected: + virtual ~wxRefCounterMT() { } + +private: + // Ref count is atomic to allow IncRef() and DecRef() to be concurrently + // called from different threads. + wxAtomicInt m_count; + + wxDECLARE_NO_COPY_CLASS(wxRefCounterMT); +}; + +#endif // _WX_PRIVATE_REFCOUNTERMT_H_ diff --git a/lib/wxWidgets/include/wx/private/rescale.h b/lib/wxWidgets/include/wx/private/rescale.h new file mode 100644 index 0000000..969e758 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/rescale.h @@ -0,0 +1,146 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/rescale.h +// Purpose: Helpers for rescaling coordinates +// Author: Vadim Zeitlin +// Created: 2021-07-13 +// Copyright: (c) 2021 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_RESCALE_H_ +#define _WX_PRIVATE_RESCALE_H_ + +#include "wx/gdicmn.h" +#include "wx/math.h" + +#ifdef __WINDOWS__ + // Required in order to use wxMulDivInt32(). + #include "wx/msw/wrapwin.h" +#endif + +// wxRescaleCoord is used to scale the components of the given wxSize by the +// ratio between 2 scales, with rounding. It doesn't scale the components +// if they're set to -1 (wxDefaultCoord), as this value is special in wxSize. +// +// The way it's used is special because we want to ensure there is no confusion +// between the scale being converted from and the scale being converted to, so +// instead of just using a single function, we use an intermediate object, +// which is not supposed to be used directly, but is only returned by From() in +// order to allow calling To() on it. +// +// Another complication is that we want this to work for both wxSize and +// wxPoint, as well as for just plain coordinate values, so wxRescaleCoord() is +// an overloaded function and the helper classes are templates, with their +// template parameter being either wxSize, wxPoint or int. + +namespace wxPrivate +{ + +template <typename T> class wxRescaleCoordWithValue; + +template <typename T> +class wxRescaleCoordWithFrom +{ +public: + T To(wxSize newScale) const + { + T value(m_value); + + if ( value.x != wxDefaultCoord ) + value.x = wxMulDivInt32(value.x, newScale.x, m_oldScale.x); + + if ( value.y != wxDefaultCoord ) + value.y = wxMulDivInt32(value.y, newScale.y, m_oldScale.y); + + return value; + } + + T To(int newScaleX, int newScaleY) const + { + return To(wxSize(newScaleX, newScaleY)); + } + +private: + wxRescaleCoordWithFrom(T value, wxSize oldScale) + : m_value(value), m_oldScale(oldScale) + { + } + + const T m_value; + const wxSize m_oldScale; + + // Only it can create objects of this class. + friend class wxRescaleCoordWithValue<T>; +}; + +// Specialization for just a single value. +template <> +class wxRescaleCoordWithFrom<int> +{ +public: + int To(wxSize newScale) const + { + return m_value == wxDefaultCoord + ? wxDefaultCoord + : wxMulDivInt32(m_value, newScale.x, m_oldScale.x); + } + +private: + wxRescaleCoordWithFrom(int value, wxSize oldScale) + : m_value(value), m_oldScale(oldScale) + { + } + + const int m_value; + const wxSize m_oldScale; + + // Only it can create objects of this class. + friend class wxRescaleCoordWithValue<int>; +}; + +template <typename T> +class wxRescaleCoordWithValue +{ +public: + explicit wxRescaleCoordWithValue(T value) + : m_value(value) + { + } + + wxRescaleCoordWithFrom<T> From(wxSize oldScale) + { + return wxRescaleCoordWithFrom<T>(m_value, oldScale); + } + + wxRescaleCoordWithFrom<T> From(int oldScaleX, int oldScaleY) + { + return From(wxSize(oldScaleX, oldScaleY)); + } + +private: + const T m_value; +}; + +} // namespace wxPrivate + +inline wxPrivate::wxRescaleCoordWithValue<int> wxRescaleCoord(int coord) +{ + return wxPrivate::wxRescaleCoordWithValue<int>(coord); +} + +inline wxPrivate::wxRescaleCoordWithValue<wxSize> wxRescaleCoord(wxSize sz) +{ + return wxPrivate::wxRescaleCoordWithValue<wxSize>(sz); +} + +inline wxPrivate::wxRescaleCoordWithValue<wxSize> wxRescaleCoord(int x, int y) +{ + return wxPrivate::wxRescaleCoordWithValue<wxSize>(wxSize(x, y)); +} + +inline wxPrivate::wxRescaleCoordWithValue<wxPoint> wxRescaleCoord(wxPoint pt) +{ + return wxPrivate::wxRescaleCoordWithValue<wxPoint>(pt); +} + +#endif // _WX_PRIVATE_RESCALE_H_ diff --git a/lib/wxWidgets/include/wx/private/richtooltip.h b/lib/wxWidgets/include/wx/private/richtooltip.h new file mode 100644 index 0000000..eae0f56 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/richtooltip.h @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/richtooltip.h +// Purpose: wxRichToolTipImpl declaration. +// Author: Vadim Zeitlin +// Created: 2011-10-18 +// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_RICHTOOLTIP_H_ +#define _WX_PRIVATE_RICHTOOLTIP_H_ + +#include "wx/richtooltip.h" + +// ---------------------------------------------------------------------------- +// wxRichToolTipImpl: defines wxRichToolTip implementation. +// ---------------------------------------------------------------------------- + +class wxRichToolTipImpl +{ +public: + // This is implemented in a platform-specific way. + static wxRichToolTipImpl* Create(const wxString& title, + const wxString& message); + + // These methods simply mirror the public wxRichToolTip ones. + virtual void SetBackgroundColour(const wxColour& col, + const wxColour& colEnd) = 0; + virtual void SetCustomIcon(const wxBitmapBundle& icon) = 0; + virtual void SetStandardIcon(int icon) = 0; + virtual void SetTimeout(unsigned milliseconds, + unsigned millisecondsShowdelay = 0) = 0; + virtual void SetTipKind(wxTipKind tipKind) = 0; + virtual void SetTitleFont(const wxFont& font) = 0; + + virtual void ShowFor(wxWindow* win, const wxRect* rect = NULL) = 0; + + virtual ~wxRichToolTipImpl() { } + +protected: + wxRichToolTipImpl() { } +}; + +#endif // _WX_PRIVATE_RICHTOOLTIP_H_ diff --git a/lib/wxWidgets/include/wx/private/sckaddr.h b/lib/wxWidgets/include/wx/private/sckaddr.h new file mode 100644 index 0000000..376812d --- /dev/null +++ b/lib/wxWidgets/include/wx/private/sckaddr.h @@ -0,0 +1,316 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/sckaddr.h +// Purpose: wxSockAddressImpl +// Author: Vadim Zeitlin +// Created: 2008-12-28 +// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_SOCKADDR_H_ +#define _WX_PRIVATE_SOCKADDR_H_ + +#ifdef __WINDOWS__ + #include "wx/msw/wrapwin.h" + + #if wxUSE_IPV6 + #include <ws2tcpip.h> + #endif +#elif defined(__VMS__) + #include <socket.h> + + struct sockaddr_un + { + u_char sun_len; /* sockaddr len including null */ + u_char sun_family; /* AF_UNIX */ + char sun_path[108]; /* path name (gag) */ + }; + #include <in.h> +#else // generic Unix + #include <sys/types.h> + #include <sys/socket.h> + #include <netinet/in.h> + #include <sys/un.h> +#endif // platform + +#include <stdlib.h> // for calloc() + +// this is a wrapper for sockaddr_storage if it's available or just sockaddr +// otherwise +union wxSockAddressStorage +{ +#if wxUSE_IPV6 + sockaddr_storage addr_storage; +#endif + sockaddr addr; +}; + +// ---------------------------------------------------------------------------- +// helpers for wxSockAddressImpl +// ---------------------------------------------------------------------------- + +// helper class mapping sockaddr_xxx types to corresponding AF_XXX values +template <class T> struct AddressFamily; + +template <> struct AddressFamily<sockaddr_in> { enum { value = AF_INET }; }; + +#if wxUSE_IPV6 +template <> struct AddressFamily<sockaddr_in6> { enum { value = AF_INET6 }; }; +#endif // wxUSE_IPV6 + +#ifdef wxHAS_UNIX_DOMAIN_SOCKETS +template <> struct AddressFamily<sockaddr_un> { enum { value = AF_UNIX }; }; +#endif // wxHAS_UNIX_DOMAIN_SOCKETS + +// ---------------------------------------------------------------------------- +// wxSockAddressImpl +// ---------------------------------------------------------------------------- + +// Represents a socket endpoint, e.g. an (address, port) pair for PF_INET +// sockets. It can be initialized from an existing sockaddr struct and also +// provides access to sockaddr stored internally so that it can be easily used +// with e.g. connect(2). +// +// This class also performs (synchronous, hence potentially long) name lookups +// if necessary, i.e. if the host name strings don't contain addresses in +// numerical form (quad dotted for IPv4 or standard hexadecimal for IPv6). +// Notice that internally the potentially Unicode host names are encoded as +// UTF-8 before being passed to the lookup function but the host names should +// really be ASCII anyhow. +class wxSockAddressImpl +{ +public: + // as this is passed to socket() it should be a PF_XXX and not AF_XXX (even + // though they're the same in practice) + enum Family + { + FAMILY_INET = PF_INET, +#if wxUSE_IPV6 + FAMILY_INET6 = PF_INET6, +#endif +#ifdef wxHAS_UNIX_DOMAIN_SOCKETS + FAMILY_UNIX = PF_UNIX, +#endif + FAMILY_UNSPEC = PF_UNSPEC + }; + + // default ctor creates uninitialized object, use one of CreateXXX() below + wxSockAddressImpl() + { + InitUnspec(); + } + + // ctor from an existing sockaddr + wxSockAddressImpl(const sockaddr& addr, int len) + { + switch ( addr.sa_family ) + { + case PF_INET: +#if wxUSE_IPV6 + case PF_INET6: +#endif +#ifdef wxHAS_UNIX_DOMAIN_SOCKETS + case PF_UNIX: +#endif + m_family = static_cast<Family>(addr.sa_family); + break; + + default: + wxFAIL_MSG( "unsupported socket address family" ); + InitUnspec(); + return; + } + + InitFromSockaddr(addr, len); + } + + // copy ctor and assignment operators + wxSockAddressImpl(const wxSockAddressImpl& other) + { + InitFromOther(other); + } + + wxSockAddressImpl& operator=(const wxSockAddressImpl& other) + { + if (this != &other) + { + free(m_addr); + InitFromOther(other); + } + return *this; + } + + // dtor frees the memory used by m_addr + ~wxSockAddressImpl() + { + free(m_addr); + } + + + // reset the address to the initial uninitialized state + void Clear() + { + free(m_addr); + + InitUnspec(); + } + + // initialize the address to be of specific address family, it must be + // currently uninitialized (you may call Clear() to achieve this) + void CreateINET(); + void CreateINET6(); +#ifdef wxHAS_UNIX_DOMAIN_SOCKETS + void CreateUnix(); +#endif // wxHAS_UNIX_DOMAIN_SOCKETS + void Create(Family family) + { + switch ( family ) + { + case FAMILY_INET: + CreateINET(); + break; + +#if wxUSE_IPV6 + case FAMILY_INET6: + CreateINET6(); + break; +#endif // wxUSE_IPV6 + +#ifdef wxHAS_UNIX_DOMAIN_SOCKETS + case FAMILY_UNIX: + CreateUnix(); + break; +#endif // wxHAS_UNIX_DOMAIN_SOCKETS + + default: + wxFAIL_MSG( "unsupported socket address family" ); + } + } + + // simple accessors + Family GetFamily() const { return m_family; } + bool Is(Family family) const { return m_family == family; } + bool IsOk() const { return m_family != FAMILY_UNSPEC; } + const sockaddr *GetAddr() const { return m_addr; } + sockaddr *GetWritableAddr() { return m_addr; } + int GetLen() const { return m_len; } + + // accessors for INET or INET6 address families +#if wxUSE_IPV6 + #define CALL_IPV4_OR_6(func, args) \ + Is(FAMILY_INET6) ? func##6(args) : func##4(args) + #define CALL_IPV4_OR_6_VOID(func) \ + Is(FAMILY_INET6) ? func##6() : func##4() +#else + #define CALL_IPV4_OR_6(func, args) func##4(args) + #define CALL_IPV4_OR_6_VOID(func) func##4() +#endif // IPv6 support on/off + + wxString GetHostName() const; + bool SetHostName(const wxString& name) + { + return CALL_IPV4_OR_6(SetHostName, (name)); + } + + wxUint16 GetPort() const { return CALL_IPV4_OR_6_VOID(GetPort); } + bool SetPort(wxUint16 port) { return CALL_IPV4_OR_6(SetPort, (port)); } + bool SetPortName(const wxString& name, const char *protocol); + + bool SetToAnyAddress() { return CALL_IPV4_OR_6_VOID(SetToAnyAddress); } + +#undef CALL_IPV4_OR_6 + + // accessors for INET addresses only + bool GetHostAddress(wxUint32 *address) const; + bool SetHostAddress(wxUint32 address); + + bool SetToBroadcastAddress() { return SetHostAddress(INADDR_BROADCAST); } + + // accessors for INET6 addresses only +#if wxUSE_IPV6 + bool GetHostAddress(in6_addr *address) const; + bool SetHostAddress(const in6_addr& address); +#endif // wxUSE_IPV6 + +#ifdef wxHAS_UNIX_DOMAIN_SOCKETS + // methods valid for Unix address family addresses only + bool SetPath(const wxString& path); + wxString GetPath() const; +#endif // wxHAS_UNIX_DOMAIN_SOCKETS + +private: + void DoAlloc(int len) + { + m_addr = static_cast<sockaddr *>(calloc(1, len)); + m_len = len; + } + + template <class T> + T *Alloc() + { + DoAlloc(sizeof(T)); + + return reinterpret_cast<T *>(m_addr); + } + + template <class T> + T *Get() const + { + wxCHECK_MSG( static_cast<int>(m_family) == AddressFamily<T>::value, + NULL, + "socket address family mismatch" ); + + return reinterpret_cast<T *>(m_addr); + } + + void InitUnspec() + { + m_family = FAMILY_UNSPEC; + m_addr = NULL; + m_len = 0; + } + + void InitFromSockaddr(const sockaddr& addr, int len) + { + DoAlloc(len); + memcpy(m_addr, &addr, len); + } + + void InitFromOther(const wxSockAddressImpl& other) + { + m_family = other.m_family; + + if ( other.m_addr ) + { + InitFromSockaddr(*other.m_addr, other.m_len); + } + else // no address to copy + { + m_addr = NULL; + m_len = 0; + } + } + + // IPv4/6 implementations of public functions + bool SetHostName4(const wxString& name); + + bool SetPort4(wxUint16 port); + wxUint16 GetPort4() const; + + bool SetToAnyAddress4() { return SetHostAddress(INADDR_ANY); } + +#if wxUSE_IPV6 + bool SetHostName6(const wxString& name); + + bool SetPort6(wxUint16 port); + wxUint16 GetPort6() const; + + bool SetToAnyAddress6(); +#endif // wxUSE_IPV6 + + Family m_family; + sockaddr *m_addr; + int m_len; +}; + +#endif // _WX_PRIVATE_SOCKADDR_H_ diff --git a/lib/wxWidgets/include/wx/private/secretstore.h b/lib/wxWidgets/include/wx/private/secretstore.h new file mode 100644 index 0000000..443273d --- /dev/null +++ b/lib/wxWidgets/include/wx/private/secretstore.h @@ -0,0 +1,95 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/secretstore.h +// Purpose: Classes used in wxSecretStore implementation only. +// Author: Vadim Zeitlin +// Created: 2016-05-27 +// Copyright: (c) 2016 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_SECRETSTORE_H_ +#define _WX_PRIVATE_SECRETSTORE_H_ + +#include "wx/object.h" // wxRefCounter + +// Both of the implementation classes here are ref-counted so that the +// corresponding public objects could be copied cheaply and, in the case of +// wxSecretValue, also to avoid having the secret in more than one place in +// memory at a time. + +// ---------------------------------------------------------------------------- +// Class holding wxSecretValue data +// ---------------------------------------------------------------------------- + +// This is a common base class for our own and libsecret-based implementations. +class wxSecretValueImpl : public wxRefCounter +{ +public: + wxSecretValueImpl() + { + } + + virtual size_t GetSize() const = 0; + virtual const void *GetData() const = 0; +}; + +// Trivial common implementation of wxSecretValueImpl used under MSW and OS X. +#if defined(__WINDOWS__) || defined(__DARWIN__) + +class wxSecretValueGenericImpl : public wxSecretValueImpl +{ +public: + wxSecretValueGenericImpl(size_t size, const void *data) + : m_size(size), + m_data(new char[size]) + { + memcpy(m_data, data, size); + } + + virtual ~wxSecretValueGenericImpl() + { + if ( m_data ) + { + wxSecretValue::Wipe(m_size, m_data); + delete [] m_data; + } + } + + virtual size_t GetSize() const wxOVERRIDE { return m_size; } + virtual const void *GetData() const wxOVERRIDE { return m_data; } + +private: + const size_t m_size; + char* const m_data; +}; + +#endif // MSW or OSX + +// ---------------------------------------------------------------------------- +// Base class for wxSecretStore implementations +// ---------------------------------------------------------------------------- + +// All its methods are similar to the methods of the public class except that +// they work with the implementation rather than public objects and they all +// take an extra "wxString&" output parameter which is filled with the low +// level error message in case of an error. This message will be logged by +// wxSecretStore itself, wxSecretStoreImpl methods shouldn't do any logging on +// their own. +class wxSecretStoreImpl : public wxRefCounter +{ +public: + virtual bool IsOk(wxString* WXUNUSED(errmsg)) const { return true; } + + virtual bool Save(const wxString& service, + const wxString& username, + const wxSecretValueImpl& password, + wxString& errmsg) = 0; + virtual bool Load(const wxString& service, + wxString* username, + wxSecretValueImpl** password, + wxString& errmsg) const = 0; + virtual bool Delete(const wxString& service, + wxString& errmsg) = 0; +}; + +#endif // _WX_PRIVATE_SECRETSTORE_H_ diff --git a/lib/wxWidgets/include/wx/private/selectdispatcher.h b/lib/wxWidgets/include/wx/private/selectdispatcher.h new file mode 100644 index 0000000..ba7a59a --- /dev/null +++ b/lib/wxWidgets/include/wx/private/selectdispatcher.h @@ -0,0 +1,125 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/private/selectdispatcher.h +// Purpose: wxSelectDispatcher class +// Authors: Lukasz Michalski and Vadim Zeitlin +// Created: December 2006 +// Copyright: (c) Lukasz Michalski +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_SELECTDISPATCHER_H_ +#define _WX_PRIVATE_SELECTDISPATCHER_H_ + +#include "wx/defs.h" + +#if wxUSE_SELECT_DISPATCHER + +#if defined(HAVE_SYS_SELECT_H) + #include <sys/time.h> + #include <sys/select.h> +#endif + +#include <sys/types.h> + +#include "wx/thread.h" +#include "wx/private/fdiodispatcher.h" + +// helper class storing all the select() fd sets +class WXDLLIMPEXP_BASE wxSelectSets +{ +public: + // ctor zeroes out all fd_sets + wxSelectSets(); + + // default copy ctor, assignment operator and dtor are ok + + + // return true if fd appears in any of the sets + bool HasFD(int fd) const; + + // add or remove FD to our sets depending on whether flags contains + // wxFDIO_INPUT/OUTPUT/EXCEPTION bits + bool SetFD(int fd, int flags); + + // same as SetFD() except it unsets the bits set in the flags for the given + // fd + bool ClearFD(int fd) + { + return SetFD(fd, 0); + } + + + // call select() with our sets: the other parameters are the same as for + // select() itself + int Select(int nfds, struct timeval *tv); + + // call the handler methods corresponding to the sets having this fd if it + // is present in any set and return true if it is + bool Handle(int fd, wxFDIOHandler& handler) const; + +private: + typedef void (wxFDIOHandler::*Callback)(); + + // the FD sets indices + enum + { + Read, + Write, + Except, + Max + }; + + // the sets used with select() + fd_set m_fds[Max]; + + // the wxFDIO_XXX flags, functions and names (used for debug messages only) + // corresponding to the FD sets above + static int ms_flags[Max]; + static const char *ms_names[Max]; + static Callback ms_handlers[Max]; +}; + +class WXDLLIMPEXP_BASE wxSelectDispatcher : public wxMappedFDIODispatcher +{ +public: + // default ctor + wxSelectDispatcher() { m_maxFD = -1; } + + // implement pure virtual methods of the base class + virtual bool RegisterFD(int fd, wxFDIOHandler *handler, int flags = wxFDIO_ALL) wxOVERRIDE; + virtual bool ModifyFD(int fd, wxFDIOHandler *handler, int flags = wxFDIO_ALL) wxOVERRIDE; + virtual bool UnregisterFD(int fd) wxOVERRIDE; + virtual bool HasPending() const wxOVERRIDE; + virtual int Dispatch(int timeout = TIMEOUT_INFINITE) wxOVERRIDE; + +private: + // common part of RegisterFD() and ModifyFD() + bool DoUpdateFDAndHandler(int fd, wxFDIOHandler *handler, int flags); + + // call the handlers for the fds present in the given sets, return the + // number of handlers we called + int ProcessSets(const wxSelectSets& sets); + + // helper of ProcessSets(): call the handler if its fd is in the set + void DoProcessFD(int fd, const fd_set& fds, wxFDIOHandler *handler, + const char *name); + + // common part of HasPending() and Dispatch(): calls select() with the + // specified timeout + int DoSelect(wxSelectSets& sets, int timeout) const; + + +#if wxUSE_THREADS + wxCriticalSection m_cs; +#endif // wxUSE_THREADS + + // the select sets containing all the registered fds + wxSelectSets m_sets; + + // the highest registered fd value or -1 if none + int m_maxFD; +}; + +#endif // wxUSE_SELECT_DISPATCHER + +#endif // _WX_PRIVATE_SOCKETEVTDISPATCH_H_ diff --git a/lib/wxWidgets/include/wx/private/socket.h b/lib/wxWidgets/include/wx/private/socket.h new file mode 100644 index 0000000..d9d4ac6 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/socket.h @@ -0,0 +1,383 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/private/socket.h +// Purpose: wxSocketImpl and related declarations +// Authors: Guilhem Lavaux, Vadim Zeitlin +// Created: April 1997 +// Copyright: (c) 1997 Guilhem Lavaux +// (c) 2008 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +/* + Brief overview of different socket classes: + + - wxSocketBase is the public class representing a socket ("Base" here + refers to the fact that wxSocketClient and wxSocketServer are derived + from it and predates the convention of using "Base" for common base + classes for platform-specific classes in wxWidgets) with implementation + common to all platforms and forwarding methods whose implementation + differs between platforms to wxSocketImpl which it contains. + + - wxSocketImpl is actually just an abstract base class having only code + common to all platforms, the concrete implementation classes derive from + it and are created by wxSocketImpl::Create(). + + - Some socket operations have different implementations in console-mode and + GUI applications. wxSocketManager class exists to abstract this in such + way that console applications (using wxBase) don't depend on wxNet. An + object of this class is made available via wxApp and GUI applications set + up a different kind of global socket manager from console ones. + + TODO: it looks like wxSocketManager could be eliminated by providing + methods for registering/unregistering sockets directly in + wxEventLoop. + */ + +#ifndef _WX_PRIVATE_SOCKET_H_ +#define _WX_PRIVATE_SOCKET_H_ + +#include "wx/defs.h" + +#if wxUSE_SOCKETS + +#include "wx/socket.h" +#include "wx/private/sckaddr.h" + +#include <stddef.h> + +/* + Including sys/types.h under Cygwin results in the warnings about "fd_set + having been defined in sys/types.h" when winsock.h is included later and + doesn't seem to be necessary anyhow. It's not needed under Mac either. + */ +#if !defined(__WXMAC__) && !defined(__WXMSW__) +#include <sys/types.h> +#endif + +// include the header defining timeval: under Windows this struct is used only +// with sockets so we need to include winsock.h which we do via windows.h +#ifdef __WINDOWS__ + #include "wx/msw/wrapwin.h" +#else + #include <sys/time.h> // for timeval +#endif + +// 64 bit Cygwin can't use the standard struct timeval because it has long +// fields, which are supposed to be 32 bits in Win64 API, but long is 64 bits +// in 64 bit Cygwin, so we need to use its special __ms_timeval instead. +#if defined(__CYGWIN__) && defined(__LP64__) && defined(__WINDOWS__) + typedef __ms_timeval wxTimeVal_t; +#else + typedef timeval wxTimeVal_t; +#endif + +// these definitions are for MSW when we don't use configure, otherwise these +// symbols are defined by configure +#ifndef WX_SOCKLEN_T + #define WX_SOCKLEN_T int +#endif + +#ifndef SOCKOPTLEN_T + #define SOCKOPTLEN_T int +#endif + +// define some symbols which winsock.h defines but traditional BSD headers +// don't +#ifndef INVALID_SOCKET + #define INVALID_SOCKET (-1) +#endif + +#ifndef SOCKET_ERROR + #define SOCKET_ERROR (-1) +#endif + +typedef int wxSocketEventFlags; + +class wxSocketImpl; + +/* + Class providing hooks abstracting the differences between console and GUI + applications for socket code. + + We also have different implementations of this class for different platforms + allowing us to keep more things in the common code but the main reason for + its existence is that we want the same socket code work differently + depending on whether it's used from a console or a GUI program. This is + achieved by implementing the virtual methods of this class differently in + the objects returned by wxConsoleAppTraits::GetSocketManager() and the same + method in wxGUIAppTraits. + */ +class wxSocketManager +{ +public: + // set the manager to use, we don't take ownership of it + // + // this should be called before creating the first wxSocket object, + // otherwise the manager returned by wxAppTraits::GetSocketManager() will + // be used + static void Set(wxSocketManager *manager); + + // return the manager to use + // + // this initializes the manager at first use + static wxSocketManager *Get() + { + if ( !ms_manager ) + Init(); + + return ms_manager; + } + + // called before the first wxSocket is created and should do the + // initializations needed in order to use the network + // + // return true if initialized successfully; if this returns false sockets + // can't be used at all + virtual bool OnInit() = 0; + + // undo the initializations of OnInit() + virtual void OnExit() = 0; + + + // create the socket implementation object matching this manager + virtual wxSocketImpl *CreateSocket(wxSocketBase& wxsocket) = 0; + + // these functions enable or disable monitoring of the given socket for the + // specified events inside the currently running event loop (but notice + // that both BSD and Winsock implementations actually use socket->m_server + // value to determine what exactly should be monitored so it needs to be + // set before calling these functions) + // + // the default event value is used just for the convenience of wxMSW + // implementation which doesn't use this parameter anyhow, it doesn't make + // sense to pass wxSOCKET_LOST for the Unix implementation which does use + // this parameter + virtual void Install_Callback(wxSocketImpl *socket, + wxSocketNotify event = wxSOCKET_LOST) = 0; + virtual void Uninstall_Callback(wxSocketImpl *socket, + wxSocketNotify event = wxSOCKET_LOST) = 0; + + virtual ~wxSocketManager() { } + +private: + // get the manager to use if we don't have it yet + static void Init(); + + static wxSocketManager *ms_manager; +}; + +/* + Base class for all socket implementations providing functionality common to + BSD and Winsock sockets. + + Objects of this class are not created directly but only via the factory + function wxSocketManager::CreateSocket(). + */ +class wxSocketImpl +{ +public: + virtual ~wxSocketImpl(); + + // set various socket properties: all of those can only be called before + // creating the socket + void SetTimeout(unsigned long millisec); + void SetReusable() { m_reusable = true; } + void SetBroadcast() { m_broadcast = true; } + void DontDoBind() { m_dobind = false; } + void SetInitialSocketBuffers(int recv, int send) + { + m_initialRecvBufferSize = recv; + m_initialSendBufferSize = send; + } + + wxSocketError SetLocal(const wxSockAddressImpl& address); + wxSocketError SetPeer(const wxSockAddressImpl& address); + + // accessors + // --------- + + bool IsServer() const { return m_server; } + + const wxSockAddressImpl& GetLocal(); // non const as may update m_local + const wxSockAddressImpl& GetPeer() const { return m_peer; } + + wxSocketError GetError() const { return m_error; } + bool IsOk() const { return m_error == wxSOCKET_NOERROR; } + + // get the error code corresponding to the last operation + virtual wxSocketError GetLastError() const = 0; + + + // creating/closing the socket + // -------------------------- + + // notice that SetLocal() must be called before creating the socket using + // any of the functions below + // + // all of Create() functions return wxSOCKET_NOERROR if the operation + // completed successfully or one of: + // wxSOCKET_INVSOCK - the socket is in use. + // wxSOCKET_INVADDR - the local (server) or peer (client) address has not + // been set. + // wxSOCKET_IOERR - any other error. + + // create a socket listening on the local address specified by SetLocal() + // (notice that DontDoBind() is ignored by this function) + wxSocketError CreateServer(); + + // create a socket connected to the peer address specified by SetPeer() + // (notice that DontDoBind() is ignored by this function) + // + // this function may return wxSOCKET_WOULDBLOCK in addition to the return + // values listed above if wait is false + wxSocketError CreateClient(bool wait); + + // create (and bind unless DontDoBind() had been called) an UDP socket + // associated with the given local address + wxSocketError CreateUDP(); + + // may be called whether the socket was created or not, calls DoClose() if + // it was indeed created + void Close(); + + // shuts down the writing end of the socket and closes it, this is a more + // graceful way to close + // + // does nothing if the socket wasn't created + void Shutdown(); + + + // IO operations + // ------------- + + // basic IO, work for both TCP and UDP sockets + // + // return the number of bytes read/written (possibly 0) or -1 on error + int Read(void *buffer, int size); + int Write(const void *buffer, int size); + + // basically a wrapper for select(): returns the condition of the socket, + // blocking for not longer than timeout if it is specified (otherwise just + // poll without blocking at all) + // + // flags defines what kind of conditions we're interested in, the return + // value is composed of a (possibly empty) subset of the bits set in flags + wxSocketEventFlags Select(wxSocketEventFlags flags, + wxTimeVal_t *timeout = NULL); + + // convenient wrapper calling Select() with our default timeout + wxSocketEventFlags SelectWithTimeout(wxSocketEventFlags flags) + { + return Select(flags, &m_timeout); + } + + // just a wrapper for accept(): it is called to create a new wxSocketImpl + // corresponding to a new server connection represented by the given + // wxSocketBase, returns NULL on error (including immediately if there are + // no pending connections as our sockets are non-blocking) + wxSocketImpl *Accept(wxSocketBase& wxsocket); + + + // notifications + // ------------- + + // Update the socket depending on the presence or absence of wxSOCKET_BLOCK + // in GetSocketFlags(): if it's present, make the socket blocking and + // ensure that we don't get any asynchronous event for it, otherwise put + // it into non-blocking mode and enable monitoring it in the event loop. + virtual void UpdateBlockingState() = 0; + + // notify m_wxsocket about the given socket event by calling its (inaptly + // named) OnRequest() method + void NotifyOnStateChange(wxSocketNotify event); + + // called after reading/writing the data from/to the socket and should + // enable back the wxSOCKET_INPUT/OUTPUT_FLAG notifications if they were + // turned off when this data was first detected + virtual void ReenableEvents(wxSocketEventFlags flags) = 0; + + // TODO: make these fields protected and provide accessors for those of + // them that wxSocketBase really needs +//protected: + wxSOCKET_T m_fd; + + int m_initialRecvBufferSize; + int m_initialSendBufferSize; + + wxSockAddressImpl m_local, + m_peer; + wxSocketError m_error; + + bool m_stream; + bool m_establishing; + bool m_reusable; + bool m_broadcast; + bool m_dobind; + + wxTimeVal_t m_timeout; + +protected: + wxSocketImpl(wxSocketBase& wxsocket); + + // get the associated socket flags + wxSocketFlags GetSocketFlags() const { return m_wxsocket->GetFlags(); } + + // true if we're a listening stream socket + bool m_server; + +private: + // called by Close() if we have a valid m_fd + virtual void DoClose() = 0; + + // check that the socket wasn't created yet and that the given address + // (either m_local or m_peer depending on the socket kind) is valid and + // set m_error and return false if this is not the case + bool PreCreateCheck(const wxSockAddressImpl& addr); + + // set the given socket option: this just wraps setsockopt(SOL_SOCKET) + int SetSocketOption(int optname, int optval) + { + // although modern Unix systems use "const void *" for the 4th + // parameter here, old systems and Winsock still use "const char *" + return setsockopt(m_fd, SOL_SOCKET, optname, + reinterpret_cast<const char *>(&optval), + sizeof(optval)); + } + + // set the given socket option to true value: this is an even simpler + // wrapper for setsockopt(SOL_SOCKET) for boolean options + int EnableSocketOption(int optname) + { + return SetSocketOption(optname, 1); + } + + // apply the options to the (just created) socket and register it with the + // event loop by calling UpdateBlockingState() + void PostCreation(); + + // update local address after binding/connecting + wxSocketError UpdateLocalAddress(); + + // functions used to implement Read/Write() + int RecvStream(void *buffer, int size); + int RecvDgram(void *buffer, int size); + int SendStream(const void *buffer, int size); + int SendDgram(const void *buffer, int size); + + + // set in ctor and never changed except that it's reset to NULL when the + // socket is shut down + wxSocketBase *m_wxsocket; + + wxDECLARE_NO_COPY_CLASS(wxSocketImpl); +}; + +#if defined(__WINDOWS__) + #include "wx/msw/private/sockmsw.h" +#else + #include "wx/unix/private/sockunix.h" +#endif + +#endif /* wxUSE_SOCKETS */ + +#endif /* _WX_PRIVATE_SOCKET_H_ */ diff --git a/lib/wxWidgets/include/wx/private/spinctrl.h b/lib/wxWidgets/include/wx/private/spinctrl.h new file mode 100644 index 0000000..66fdfb6 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/spinctrl.h @@ -0,0 +1,41 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/spinctrl.h +// Purpose: Private functions used in wxSpinCtrl implementation. +// Author: Vadim Zeitlin +// Created: 2019-11-13 +// Copyright: (c) 2019 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_SPINCTRL_H_ +#define _WX_PRIVATE_SPINCTRL_H_ + +namespace wxSpinCtrlImpl +{ + +// This is an internal helper function currently used by all ports: return the +// string containing hexadecimal representation of the given number. +extern wxString FormatAsHex(long val, long maxVal); + +// Another helper returning the maximum length of a string representing a value +// valid in the given control. +extern int GetMaxValueLength(int minVal, int maxVal, int base); + +// The helper function to determine the best size for the given control. +// We can't implement this function in the wxSpinCtrlBase because MSW implementation +// of wxSpinCtrl is derived from wxSpinButton but uses the same algorithm. +extern wxSize GetBestSize(const wxControl* spin, int minVal, int maxVal, int base); + +// Helper function to check if given combination of range and base is valid. +extern bool IsBaseCompatibleWithRange(int minVal, int maxVal, int base); + +// Maximum number of digits returned by DetermineDigits(). +const unsigned SPINCTRLDBL_MAX_DIGITS = 20; + +// Return the number of digits required to show the numbers using the +// specified increment without loss of precision. +extern unsigned DetermineDigits(double inc); + +} // namespace wxSpinCtrlImpl + +#endif // _WX_PRIVATE_SPINCTRL_H_ diff --git a/lib/wxWidgets/include/wx/private/streamtempinput.h b/lib/wxWidgets/include/wx/private/streamtempinput.h new file mode 100644 index 0000000..8a0401c --- /dev/null +++ b/lib/wxWidgets/include/wx/private/streamtempinput.h @@ -0,0 +1,134 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/streamtempinput.h +// Purpose: defines wxStreamTempInputBuffer which is used by Unix and MSW +// implementations of wxExecute; this file is only used by the +// library and never by the user code +// Author: Vadim Zeitlin +// Modified by: Rob Bresalier +// Created: 2013-05-04 +// Copyright: (c) 2002 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_STREAMTEMPINPUT_H +#define _WX_PRIVATE_STREAMTEMPINPUT_H + +#include "wx/private/pipestream.h" + +// ---------------------------------------------------------------------------- +// wxStreamTempInputBuffer +// ---------------------------------------------------------------------------- + +/* + wxStreamTempInputBuffer is a hack which we need to solve the problem of + executing a child process synchronously with IO redirecting: when we do + this, the child writes to a pipe we open to it but when the pipe buffer + (which has finite capacity, e.g. commonly just 4Kb) becomes full we have to + read data from it because the child blocks in its write() until then and if + it blocks we are never going to return from wxExecute() so we dead lock. + + So here is the fix: we now read the output as soon as it appears into a temp + buffer (wxStreamTempInputBuffer object) and later just stuff it back into + the stream when the process terminates. See supporting code in wxExecute() + itself as well. + + Note that this is horribly inefficient for large amounts of output (count + the number of times we copy the data around) and so a better API is badly + needed! However it's not easy to devise a way to do this keeping backwards + compatibility with the existing wxExecute(wxEXEC_SYNC)... +*/ +class wxStreamTempInputBuffer +{ +public: + wxStreamTempInputBuffer() + { + m_stream = NULL; + m_buffer = NULL; + m_size = 0; + } + + // call to associate a stream with this buffer, otherwise nothing happens + // at all + void Init(wxPipeInputStream *stream) + { + wxASSERT_MSG( !m_stream, wxS("Can only initialize once") ); + + m_stream = stream; + } + + // check for input on our stream and cache it in our buffer if any + // + // return true if anything was done + bool Update() + { + if ( !m_stream || !m_stream->CanRead() ) + return false; + + // realloc in blocks of 4Kb: this is the default (and minimal) buffer + // size of the Unix pipes so it should be the optimal step + // + // NB: don't use "static int" in this inline function, some compilers + // (e.g. IBM xlC) don't like it + enum { incSize = 4096 }; + + void *buf = realloc(m_buffer, m_size + incSize); + if ( !buf ) + return false; + + m_buffer = buf; + m_stream->Read((char *)m_buffer + m_size, incSize); + m_size += m_stream->LastRead(); + + return true; + } + + // check if can continue reading from the stream, this is used to disable + // the callback once we can't read anything more + bool Eof() const + { + // If we have no stream, always return true as we can't read any more. + return !m_stream || m_stream->Eof(); + } + + // read everything remaining until the EOF, this should only be called once + // the child process terminates and we know that no more data is coming + bool ReadAll() + { + while ( !Eof() ) + { + if ( !Update() ) + return false; + } + + return true; + } + + // dtor puts the data buffered during this object lifetime into the + // associated stream + ~wxStreamTempInputBuffer() + { + if ( m_buffer ) + { + m_stream->Ungetch(m_buffer, m_size); + free(m_buffer); + } + } + + const void *GetBuffer() const { return m_buffer; } + + size_t GetSize() const { return m_size; } + +private: + // the stream we're buffering, if NULL we don't do anything at all + wxPipeInputStream *m_stream; + + // the buffer of size m_size (NULL if m_size == 0) + void *m_buffer; + + // the size of the buffer + size_t m_size; + + wxDECLARE_NO_COPY_CLASS(wxStreamTempInputBuffer); +}; + +#endif // _WX_PRIVATE_STREAMTEMPINPUT_H diff --git a/lib/wxWidgets/include/wx/private/textmeasure.h b/lib/wxWidgets/include/wx/private/textmeasure.h new file mode 100644 index 0000000..3671a87 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/textmeasure.h @@ -0,0 +1,176 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/textmeasure.h +// Purpose: declaration of wxTextMeasure class +// Author: Manuel Martin +// Created: 2012-10-05 +// Copyright: (c) 1997-2012 wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_TEXTMEASURE_H_ +#define _WX_PRIVATE_TEXTMEASURE_H_ + +class WXDLLIMPEXP_FWD_CORE wxDC; +class WXDLLIMPEXP_FWD_CORE wxFont; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +// ---------------------------------------------------------------------------- +// wxTextMeasure: class used to measure text extent. +// ---------------------------------------------------------------------------- + +class wxTextMeasureBase +{ +public: + // The first ctor argument must be non-NULL, i.e. each object of this class + // is associated with either a valid wxDC or a valid wxWindow. The font can + // be NULL to use the current DC/window font or can be specified explicitly. + wxTextMeasureBase(const wxDC *dc, const wxFont *theFont); + wxTextMeasureBase(const wxWindow *win, const wxFont *theFont); + + // Even though this class is not supposed to be used polymorphically, give + // it a virtual dtor to avoid compiler warnings. + virtual ~wxTextMeasureBase() { } + + + // Return the extent of a single line string. + void GetTextExtent(const wxString& string, + wxCoord *width, + wxCoord *height, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL); + + // The same for a multiline (with '\n') string. + void GetMultiLineTextExtent(const wxString& text, + wxCoord *width, + wxCoord *height, + wxCoord *heightOneLine = NULL); + + // Find the dimensions of the largest string. + wxSize GetLargestStringExtent(size_t n, const wxString* strings); + wxSize GetLargestStringExtent(const wxArrayString& strings) + { + return GetLargestStringExtent(strings.size(), &strings[0]); + } + + // Fill the array with the widths for each "0..N" substrings for N from 1 + // to text.length(). + // + // The scaleX argument is the horizontal scale used by wxDC and is only + // used in the generic implementation. + bool GetPartialTextExtents(const wxString& text, + wxArrayInt& widths, + double scaleX); + + + // This is another method which is only used by MeasuringGuard. + bool IsUsingDCImpl() const { return m_useDCImpl; } + +protected: + // RAII wrapper for the two methods above. + class MeasuringGuard + { + public: + MeasuringGuard(wxTextMeasureBase& tm) : m_tm(tm) + { + // BeginMeasuring() should only be called if we have a native DC, + // so don't call it if we delegate to a DC of unknown type. + if ( !m_tm.IsUsingDCImpl() ) + m_tm.BeginMeasuring(); + } + + ~MeasuringGuard() + { + if ( !m_tm.IsUsingDCImpl() ) + m_tm.EndMeasuring(); + } + + private: + wxTextMeasureBase& m_tm; + }; + + + // These functions are called by our public methods before and after each + // call to DoGetTextExtent(). Derived classes may override them to prepare + // for -- possibly several -- subsequent calls to DoGetTextExtent(). + // + // As these calls must be always paired, they're never called directly but + // only by our friend MeasuringGuard class. + virtual void BeginMeasuring() { } + virtual void EndMeasuring() { } + + + // The main function of this class, to be implemented in platform-specific + // way used by all our public methods. + // + // The width and height pointers here are never NULL and the input string + // is not empty. + virtual void DoGetTextExtent(const wxString& string, + wxCoord *width, + wxCoord *height, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL) = 0; + + // The real implementation of GetPartialTextExtents(). + // + // On input, widths array contains text.length() zero elements and the text + // is guaranteed to be non-empty. + virtual bool DoGetPartialTextExtents(const wxString& text, + wxArrayInt& widths, + double scaleX) = 0; + + // Call either DoGetTextExtent() or wxDC::GetTextExtent() depending on the + // value of m_useDCImpl. + // + // This must be always used instead of calling DoGetTextExtent() directly! + void CallGetTextExtent(const wxString& string, + wxCoord *width, + wxCoord *height, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL); + + // Get line height: used when the line is empty because CallGetTextExtent() + // would just return (0, 0) in this case. + int GetEmptyLineHeight(); + + // Return a valid font: if one was given to us in the ctor, use this one, + // otherwise use the current font of the associated wxDC or wxWindow. + wxFont GetFont() const; + + + // Exactly one of m_dc and m_win is non-NULL for any given object of this + // class. + const wxDC* const m_dc; + const wxWindow* const m_win; + + // If this is true, simply forward to wxDC::GetTextExtent() from our + // CallGetTextExtent() instead of calling our own DoGetTextExtent(). + // + // We need this because our DoGetTextExtent() typically only works with + // native DCs, i.e. those having an HDC under Windows or using Pango under + // GTK+. However wxTextMeasure object can be constructed for any wxDC, not + // necessarily a native one and in this case we must call back into the DC + // implementation of text measuring itself. + bool m_useDCImpl; + + // This one can be NULL or not. + const wxFont* const m_font; + + wxDECLARE_NO_COPY_CLASS(wxTextMeasureBase); +}; + +// Include the platform dependent class declaration, if any. +#if defined(__WXGTK20__) + #include "wx/gtk/private/textmeasure.h" +#elif defined(__WXMSW__) + #include "wx/msw/private/textmeasure.h" +#else // no platform-specific implementation of wxTextMeasure yet + #include "wx/generic/private/textmeasure.h" + + #define wxUSE_GENERIC_TEXTMEASURE 1 +#endif + +#ifndef wxUSE_GENERIC_TEXTMEASURE + #define wxUSE_GENERIC_TEXTMEASURE 0 +#endif + +#endif // _WX_PRIVATE_TEXTMEASURE_H_ diff --git a/lib/wxWidgets/include/wx/private/threadinfo.h b/lib/wxWidgets/include/wx/private/threadinfo.h new file mode 100644 index 0000000..1ff241b --- /dev/null +++ b/lib/wxWidgets/include/wx/private/threadinfo.h @@ -0,0 +1,62 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/threadinfo.h +// Purpose: declaration of wxThreadSpecificInfo: thread-specific information +// Author: Vadim Zeitlin +// Created: 2009-07-13 +// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_THREADINFO_H_ +#define _WX_PRIVATE_THREADINFO_H_ + +#include "wx/defs.h" + +class WXDLLIMPEXP_FWD_BASE wxLog; + +#if wxUSE_INTL +#include "wx/hashset.h" +WX_DECLARE_HASH_SET(wxString, wxStringHash, wxStringEqual, + wxLocaleUntranslatedStrings); +#endif + + +// ---------------------------------------------------------------------------- +// wxThreadSpecificInfo: contains all thread-specific information used by wx +// ---------------------------------------------------------------------------- + +// Group all thread-specific information we use (e.g. the active wxLog target) +// a in this class to avoid consuming more TLS slots than necessary as there is +// only a limited number of them. +class wxThreadSpecificInfo +{ +public: + // Return this thread's instance. + static wxThreadSpecificInfo& Get(); + + // the thread-specific logger or NULL if the thread is using the global one + // (this is not used for the main thread which always uses the global + // logger) + wxLog *logger; + + // true if logging is currently disabled for this thread (this is also not + // used for the main thread which uses wxLog::ms_doLog) + // + // NB: we use a counter-intuitive "disabled" flag instead of "enabled" one + // because the default, for 0-initialized struct, should be to enable + // logging + bool loggingDisabled; + +#if wxUSE_INTL + // Storage for wxTranslations::GetUntranslatedString() + wxLocaleUntranslatedStrings untranslatedStrings; +#endif + +private: + wxThreadSpecificInfo() : logger(NULL), loggingDisabled(false) {} +}; + +#define wxThreadInfo wxThreadSpecificInfo::Get() + +#endif // _WX_PRIVATE_THREADINFO_H_ + diff --git a/lib/wxWidgets/include/wx/private/timer.h b/lib/wxWidgets/include/wx/private/timer.h new file mode 100644 index 0000000..5f4ce0d --- /dev/null +++ b/lib/wxWidgets/include/wx/private/timer.h @@ -0,0 +1,72 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/private/timer.h +// Purpose: Base class for wxTimer implementations +// Author: Lukasz Michalski <lmichalski@sf.net> +// Created: 31.10.2006 +// Copyright: (c) 2006-2007 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TIMERIMPL_H_BASE_ +#define _WX_TIMERIMPL_H_BASE_ + +#include "wx/defs.h" +#include "wx/event.h" +#include "wx/timer.h" + +// ---------------------------------------------------------------------------- +// wxTimerImpl: abstract base class for wxTimer implementations +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxTimerImpl +{ +public: + // default ctor, SetOwner() must be called after it (wxTimer does it) + wxTimerImpl(wxTimer *owner); + + // this must be called initially but may be also called later + void SetOwner(wxEvtHandler *owner, int timerid); + + // empty but virtual base class dtor, the caller is responsible for + // stopping the timer before it's destroyed (it can't be done from here as + // it's too late) + virtual ~wxTimerImpl() { } + + + // start the timer. When overriding call base version first. + virtual bool Start(int milliseconds = -1, bool oneShot = false); + + // stop the timer, only called if the timer is really running (unlike + // wxTimer::Stop()) + virtual void Stop() = 0; + + // return true if the timer is running + virtual bool IsRunning() const = 0; + + // this should be called by the port-specific code when the timer expires + virtual void Notify() { m_timer->Notify(); } + + // the default implementation of wxTimer::Notify(): generate a wxEVT_TIMER + void SendEvent(); + + + // accessors for wxTimer: + wxEvtHandler *GetOwner() const { return m_owner; } + int GetId() const { return m_idTimer; } + int GetInterval() const { return m_milli; } + bool IsOneShot() const { return m_oneShot; } + +protected: + wxTimer *m_timer; + + wxEvtHandler *m_owner; + + int m_idTimer; // id passed to wxTimerEvent + int m_milli; // the timer interval + bool m_oneShot; // true if one shot + + + wxDECLARE_NO_COPY_CLASS(wxTimerImpl); +}; + +#endif // _WX_TIMERIMPL_H_BASE_ diff --git a/lib/wxWidgets/include/wx/private/tlwgeom.h b/lib/wxWidgets/include/wx/private/tlwgeom.h new file mode 100644 index 0000000..0a273b8 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/tlwgeom.h @@ -0,0 +1,184 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/tlwgeom.h +// Purpose: Declaration of platform-specific and private wxTLWGeometry. +// Author: Vadim Zeitlin +// Created: 2018-04-29 +// Copyright: (c) 2018 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_TLWGEOM_H_ +#define _WX_PRIVATE_TLWGEOM_H_ + +#include "wx/display.h" +#include "wx/toplevel.h" + +// ---------------------------------------------------------------------------- +// wxTLWGeometryBase: abstract base class for platform-specific classes +// ---------------------------------------------------------------------------- + +// wxTLWGeometry contains full information about the window geometry, which may +// include things other than the obvious ones like its current position and +// size (e.g. under MSW it also stores the position of the maximized window, +// under GTK the size of non-client decorations etc). It is private to wx and +// is only used indirectly, via wxTopLevelWindow::SaveGeometry() and +// RestoreToGeometry() methods, in the public API. + +class wxTLWGeometryBase +{ +public: + typedef wxTopLevelWindow::GeometrySerializer Serializer; + + wxTLWGeometryBase() {} + virtual ~wxTLWGeometryBase() {} + + // Initialize from the given window. + virtual bool GetFrom(const wxTopLevelWindow* tlw) = 0; + + // Resize the window to use this geometry. + virtual bool ApplyTo(wxTopLevelWindow* tlw) = 0; + + // Serialize or deserialize the object by using the provided object for + // writing/reading the values of the different fields of this object. + virtual bool Save(const Serializer& ser) const = 0; + virtual bool Restore(Serializer& ser) = 0; +}; + +// ---------------------------------------------------------------------------- +// wxTLWGeometryGeneric: simplest possible generic implementation +// ---------------------------------------------------------------------------- + +// names for various persistent options +#define wxPERSIST_TLW_X "x" +#define wxPERSIST_TLW_Y "y" +#define wxPERSIST_TLW_W "w" +#define wxPERSIST_TLW_H "h" + +#define wxPERSIST_TLW_MAXIMIZED "Maximized" +#define wxPERSIST_TLW_ICONIZED "Iconized" + +// MSW has its own native implementation and doesn't use this class. +#ifndef __WXMSW__ + +class wxTLWGeometryGeneric : public wxTLWGeometryBase +{ +public: + wxTLWGeometryGeneric() + { + m_hasPos = + m_hasSize = + m_iconized = + m_maximized = false; + } + + virtual bool Save(const Serializer& ser) const wxOVERRIDE + { + if ( !ser.SaveField(wxPERSIST_TLW_X, m_rectScreen.x) || + !ser.SaveField(wxPERSIST_TLW_Y, m_rectScreen.y) ) + return false; + + if ( !ser.SaveField(wxPERSIST_TLW_W, m_rectScreen.width) || + !ser.SaveField(wxPERSIST_TLW_H, m_rectScreen.height) ) + return false; + + if ( !ser.SaveField(wxPERSIST_TLW_MAXIMIZED, m_maximized) ) + return false; + + if ( !ser.SaveField(wxPERSIST_TLW_ICONIZED, m_iconized) ) + return false; + + return true; + } + + virtual bool Restore(Serializer& ser) wxOVERRIDE + { + m_hasPos = ser.RestoreField(wxPERSIST_TLW_X, &m_rectScreen.x) && + ser.RestoreField(wxPERSIST_TLW_Y, &m_rectScreen.y); + + m_hasSize = ser.RestoreField(wxPERSIST_TLW_W, &m_rectScreen.width) && + ser.RestoreField(wxPERSIST_TLW_H, &m_rectScreen.height); + + int tmp; + if ( ser.RestoreField(wxPERSIST_TLW_MAXIMIZED, &tmp) ) + m_maximized = tmp != 0; + + if ( ser.RestoreField(wxPERSIST_TLW_ICONIZED, &tmp) ) + m_iconized = tmp != 0; + + // If we restored at least something, return true. + return m_hasPos || m_hasSize || m_maximized || m_iconized; + } + + virtual bool GetFrom(const wxTopLevelWindow* tlw) wxOVERRIDE + { + m_rectScreen = tlw->GetScreenRect(); + m_hasPos = + m_hasSize = true; + m_iconized = tlw->IsIconized(); + m_maximized = tlw->IsMaximized(); + + return true; + } + + virtual bool ApplyTo(wxTopLevelWindow* tlw) wxOVERRIDE + { + if ( m_hasPos ) + { + // to avoid making the window completely invisible if it had been + // shown on a monitor which was disconnected since the last run + // (this is pretty common for notebook with external displays) + // + // NB: we should allow window position to be (slightly) off screen, + // it's not uncommon to position the window so that its upper + // left corner has slightly negative coordinate + if ( wxDisplay::GetFromPoint(m_rectScreen.GetTopLeft()) != wxNOT_FOUND || + (m_hasSize && + wxDisplay::GetFromPoint(m_rectScreen.GetBottomRight()) != wxNOT_FOUND) ) + { + tlw->Move(m_rectScreen.GetTopLeft(), wxSIZE_ALLOW_MINUS_ONE); + } + //else: should we try to adjust position/size somehow? + } + + if ( m_hasSize ) + { + // a previous version of the program could have saved the window + // size which used to be big enough, but which is not big enough + // any more for the new version, so check that the size we restore + // doesn't cut off parts of the window + wxSize size = m_rectScreen.GetSize(); + size.IncTo(tlw->GetBestSize()); + tlw->SetSize(size); + } + + // note that the window can be both maximized and iconized + if ( m_maximized ) + tlw->Maximize(); + + if ( m_iconized ) + tlw->Iconize(); + + return true; + } + +private: + wxRect m_rectScreen; + bool m_hasPos; + bool m_hasSize; + bool m_iconized; + bool m_maximized; +}; + +#endif // !__WXMSW__ + +#ifdef __WXGTK20__ + #include "wx/gtk/private/tlwgeom.h" +#elif defined(__WXMSW__) + #include "wx/msw/private/tlwgeom.h" +#else + class wxTLWGeometry : public wxTLWGeometryGeneric + { + }; +#endif + +#endif // _WX_PRIVATE_TLWGEOM_H_ diff --git a/lib/wxWidgets/include/wx/private/uiaction.h b/lib/wxWidgets/include/wx/private/uiaction.h new file mode 100644 index 0000000..ed6417a --- /dev/null +++ b/lib/wxWidgets/include/wx/private/uiaction.h @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/uiaction.h +// Purpose: wxUIActionSimulatorImpl declaration +// Author: Vadim Zeitlin +// Created: 2016-05-21 +// Copyright: (c) 2016 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_UIACTION_H_ +#define _WX_PRIVATE_UIACTION_H_ + +// ---------------------------------------------------------------------------- +// Platform-specific implementation of wxUIActionSimulator +// ---------------------------------------------------------------------------- + +class wxUIActionSimulatorImpl +{ +public: + wxUIActionSimulatorImpl() { } + virtual ~wxUIActionSimulatorImpl() { } + + // Low level mouse methods which must be implemented in the derived class. + virtual bool MouseMove(long x, long y) = 0; + virtual bool MouseDown(int button = wxMOUSE_BTN_LEFT) = 0; + virtual bool MouseUp(int button = wxMOUSE_BTN_LEFT) = 0; + + // Higher level mouse methods which have default implementation in the base + // class but can be overridden if necessary. + virtual bool MouseClick(int button = wxMOUSE_BTN_LEFT); + virtual bool MouseDblClick(int button = wxMOUSE_BTN_LEFT); + virtual bool MouseDragDrop(long x1, long y1, long x2, long y2, + int button = wxMOUSE_BTN_LEFT); + + // The low-level port-specific function which really generates the key + // presses. It should generate exactly one key event with the given + // parameters. + virtual bool DoKey(int keycode, int modifiers, bool isDown) = 0; + +private: + wxDECLARE_NO_COPY_CLASS(wxUIActionSimulatorImpl); +}; + +#endif // _WX_PRIVATE_UIACTION_H_ diff --git a/lib/wxWidgets/include/wx/private/uilocale.h b/lib/wxWidgets/include/wx/private/uilocale.h new file mode 100644 index 0000000..8a1f0ac --- /dev/null +++ b/lib/wxWidgets/include/wx/private/uilocale.h @@ -0,0 +1,108 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/uilocale.h +// Purpose: wxUILocaleImpl class declaration +// Author: Vadim Zeitlin +// Created: 2021-08-01 +// Copyright: (c) 2021 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_UILOCALE_H_ +#define _WX_PRIVATE_UILOCALE_H_ + +#include "wx/localedefs.h" +#include "wx/object.h" +#include "wx/string.h" +#include "wx/vector.h" + +typedef wxVector<wxLanguageInfo> wxLanguageInfos; + +// Return the vector of all languages known to wx. +const wxLanguageInfos& wxGetLanguageInfos(); + +// Function returning hard-coded values for the "C" locale. +wxString wxGetStdCLocaleInfo(wxLocaleInfo index, wxLocaleCategory cat); + +// ---------------------------------------------------------------------------- +// wxUILocaleImpl provides the implementation of public wxUILocale functions +// ---------------------------------------------------------------------------- + +class wxUILocaleImpl : public wxRefCounter +{ +public: + // This function is implemented in platform-specific code and returns the + // object used by default, i.e. if wxUILocale::UseDefault() is not called. + // This object corresponds to the traditional "C" locale. + // + // It should never return NULL. + static wxUILocaleImpl* CreateStdC(); + + // Similarly, this one returns the object corresponding to the default user + // locale settings which is used if wxUILocale::UseDefault() was called. + // + // It may return NULL in case of failure. + static wxUILocaleImpl* CreateUserDefault(); + + // Create locale object for the given locale. + // + // It may return NULL in case of failure. + static wxUILocaleImpl* CreateForLocale(const wxLocaleIdent& locId); + + // This function exists only for wxLocale compatibility and creates the + // locale corresponding to the given language. It shouldn't be used + // anywhere else. + // + // It is implemented in terms of CreateForLocale() for non-MSW platforms, + // but under MSW it is different for compatibility reasons. + // + // The language passed to this function is a valid language, i.e. neither + // wxLANGUAGE_UNKNOWN nor wxLANGUAGE_DEFAULT. + // + // It may return NULL in case of failure, but never does so for English + // languages because wxLocale(wxLANGUAGE_ENGLISH) is always supposed to + // work, so it just falls back on CreateStdC() if it fails to create it. + static wxUILocaleImpl* CreateForLanguage(const wxLanguageInfo& info); + + // This function retrieves a list of preferred UI languages. + // The list is in the order of preference, if it has more than one entry. + // The entries contain platform-dependent identifiers. + static wxVector<wxString> GetPreferredUILanguages(); + +#if wxUSE_DATETIME + // Helper function used by GetMonthName/GetWeekDayName(): returns 0 if flags is + // wxDateTime::Name_Full and 1 if it is wxDateTime::Name_Abbr + // or -1 if the flags is incorrect (and asserts in this case) + // + // the return value of this function is used as an index into 2D array + // containing full names in its first row and abbreviated ones in the 2nd one + static int ArrayIndexFromFlag(wxDateTime::NameFlags flags); +#endif // wxUSE_DATETIME + + // Use this locale in the UI. + // + // This is not implemented for all platforms, notably not for Mac where the + // UI locale is determined at application startup, but we can't do anything + // about it anyhow, so we don't even bother returning an error code from it. + virtual void Use() = 0; + + // Functions corresponding to wxUILocale ones. + virtual wxString GetName() const = 0; + virtual wxLocaleIdent GetLocaleId() const = 0; + virtual wxString GetInfo(wxLocaleInfo index, wxLocaleCategory cat) const = 0; + virtual wxString GetLocalizedName(wxLocaleName name, wxLocaleForm form) const = 0; + virtual wxLayoutDirection GetLayoutDirection() const = 0; + virtual int CompareStrings(const wxString& lhs, const wxString& rhs, + int flags) const = 0; + +#if wxUSE_DATETIME + // These functions ought to be (pure) virtual, but aren't for + // ABI-compatibility reasons. Instead they are implemented in + // platform-specific concrete classes. + wxString GetMonthName(wxDateTime::Month month, wxDateTime::NameFlags flags) const; + wxString GetWeekDayName(wxDateTime::WeekDay weekday, wxDateTime::NameFlags flags) const; +#endif // wxUSE_DATETIME + + virtual ~wxUILocaleImpl() { } +}; + +#endif // _WX_PRIVATE_UILOCALE_H_ diff --git a/lib/wxWidgets/include/wx/private/unicode.h b/lib/wxWidgets/include/wx/private/unicode.h new file mode 100644 index 0000000..6c81c23 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/unicode.h @@ -0,0 +1,16 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/private/unicode.h +// Purpose: Unicode private declsrations +// Author: Pavel Tyunin +// Created: 2020-10-06 +// Copyright: (c) 2020 Pavel Tyunin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_UNICODEH__ +#define _WX_PRIVATE_UNICODEH__ + +// this table gives the length of the UTF-8 encoding from its first character: +extern const unsigned char tableUtf8Lengths[256]; + +#endif // _WX_PRIVATE_UNICODEH__ diff --git a/lib/wxWidgets/include/wx/private/webrequest.h b/lib/wxWidgets/include/wx/private/webrequest.h new file mode 100644 index 0000000..4f502b9 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/webrequest.h @@ -0,0 +1,268 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/webrequest.h +// Purpose: wxWebRequest implementation classes +// Author: Vadim Zeitlin +// Created: 2020-12-26 +// Copyright: (c) 2020 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_WEBREQUEST_H_ +#define _WX_PRIVATE_WEBREQUEST_H_ + +#include "wx/ffile.h" +#include "wx/hashmap.h" +#include "wx/scopedptr.h" + +#include "wx/private/refcountermt.h" + +WX_DECLARE_STRING_HASH_MAP(wxString, wxWebRequestHeaderMap); + +// Default buffer size when a fixed-size buffer must be used. +const int wxWEBREQUEST_BUFFER_SIZE = 64 * 1024; + +// Trace mask used for the messages in wxWebRequest code. +#define wxTRACE_WEBREQUEST "webrequest" + +// ---------------------------------------------------------------------------- +// wxWebAuthChallengeImpl +// ---------------------------------------------------------------------------- + +class wxWebAuthChallengeImpl : public wxRefCounterMT +{ +public: + virtual ~wxWebAuthChallengeImpl() { } + + wxWebAuthChallenge::Source GetSource() const { return m_source; } + + virtual void SetCredentials(const wxWebCredentials& cred) = 0; + +protected: + explicit wxWebAuthChallengeImpl(wxWebAuthChallenge::Source source) + : m_source(source) { } + +private: + const wxWebAuthChallenge::Source m_source; + + wxDECLARE_NO_COPY_CLASS(wxWebAuthChallengeImpl); +}; + +// ---------------------------------------------------------------------------- +// wxWebRequestImpl +// ---------------------------------------------------------------------------- + +class wxWebRequestImpl : public wxRefCounterMT +{ +public: + virtual ~wxWebRequestImpl() { } + + void SetHeader(const wxString& name, const wxString& value) + { m_headers[name] = value; } + + void SetMethod(const wxString& method) { m_method = method; } + + void SetData(const wxString& text, const wxString& contentType, const wxMBConv& conv = wxConvUTF8); + + bool SetData(wxScopedPtr<wxInputStream>& dataStream, const wxString& contentType, wxFileOffset dataSize = wxInvalidOffset); + + void SetStorage(wxWebRequest::Storage storage) { m_storage = storage; } + + wxWebRequest::Storage GetStorage() const { return m_storage; } + + // Precondition for this method checked by caller: current state is idle. + virtual void Start() = 0; + + // Precondition for this method checked by caller: not idle and not already + // cancelled. + void Cancel(); + + virtual wxWebResponseImplPtr GetResponse() const = 0; + + virtual wxWebAuthChallengeImplPtr GetAuthChallenge() const = 0; + + int GetId() const { return m_id; } + + wxWebSession& GetSession() const { return m_session; } + + wxWebRequest::State GetState() const { return m_state; } + + virtual wxFileOffset GetBytesSent() const = 0; + + virtual wxFileOffset GetBytesExpectedToSend() const = 0; + + virtual wxFileOffset GetBytesReceived() const; + + virtual wxFileOffset GetBytesExpectedToReceive() const; + + virtual wxWebRequestHandle GetNativeHandle() const = 0; + + void DisablePeerVerify(bool disable) { m_peerVerifyDisabled = disable; } + + bool IsPeerVerifyDisabled() const { return m_peerVerifyDisabled; } + + void SetState(wxWebRequest::State state, const wxString& failMsg = wxString()); + + void ReportDataReceived(size_t sizeReceived); + + wxEvtHandler* GetHandler() const { return m_handler; } + + // Called to notify about the state change in the main thread by SetState() + // (which can itself be called from a different one). + // + // It also releases a reference added when switching to the active state by + // SetState() when leaving it. + // + // TODO-C++11: make private when we don't need StateEventProcessor any more. + void ProcessStateEvent(wxWebRequest::State state, const wxString& failMsg); + +protected: + wxString m_method; + wxWebRequest::Storage m_storage; + wxWebRequestHeaderMap m_headers; + wxFileOffset m_dataSize; + wxScopedPtr<wxInputStream> m_dataStream; + bool m_peerVerifyDisabled; + + wxWebRequestImpl(wxWebSession& session, + wxWebSessionImpl& sessionImpl, + wxEvtHandler* handler, + int id); + + bool WasCancelled() const { return m_cancelled; } + + // Call SetState() with either State_Failed or State_Completed appropriate + // for the response status. + void SetFinalStateFromStatus(); + +private: + // Called from public Cancel() at most once per object. + virtual void DoCancel() = 0; + + wxWebSession& m_session; + wxEvtHandler* const m_handler; + const int m_id; + wxWebRequest::State m_state; + wxFileOffset m_bytesReceived; + wxCharBuffer m_dataText; + + // Initially false, set to true after the first call to Cancel(). + bool m_cancelled; + + wxDECLARE_NO_COPY_CLASS(wxWebRequestImpl); +}; + +// ---------------------------------------------------------------------------- +// wxWebResponseImpl +// ---------------------------------------------------------------------------- + +class wxWebResponseImpl : public wxRefCounterMT +{ +public: + virtual ~wxWebResponseImpl(); + + virtual wxFileOffset GetContentLength() const = 0; + + virtual wxString GetURL() const = 0; + + virtual wxString GetHeader(const wxString& name) const = 0; + + virtual wxString GetMimeType() const; + + virtual int GetStatus() const = 0; + + virtual wxString GetStatusText() const = 0; + + virtual wxInputStream* GetStream() const; + + virtual wxString GetSuggestedFileName() const; + + wxString AsString() const; + + virtual wxString GetDataFile() const; + +protected: + wxWebRequestImpl& m_request; + size_t m_readSize; + + explicit wxWebResponseImpl(wxWebRequestImpl& request); + + // Called from derived class ctor to finish initialization which can't be + // performed in ctor itself as it needs to use pure virtual method. + void Init(); + + void* GetDataBuffer(size_t sizeNeeded); + + void ReportDataReceived(size_t sizeReceived); + + // This function can optionally be called to preallocate the read buffer, + // if the total amount of data to be downloaded is known in advance. + void PreAllocBuffer(size_t sizeNeeded); + +private: + // Called by wxWebRequestImpl only. + friend class wxWebRequestImpl; + void Finalize(); + + wxMemoryBuffer m_readBuffer; + mutable wxFFile m_file; + mutable wxScopedPtr<wxInputStream> m_stream; + + wxDECLARE_NO_COPY_CLASS(wxWebResponseImpl); +}; + +// ---------------------------------------------------------------------------- +// wxWebSessionFactory +// ---------------------------------------------------------------------------- + +class wxWebSessionFactory +{ +public: + virtual wxWebSessionImpl* Create() = 0; + + virtual bool Initialize() { return true; } + + virtual ~wxWebSessionFactory() { } +}; + +// ---------------------------------------------------------------------------- +// wxWebSessionImpl +// ---------------------------------------------------------------------------- + +class wxWebSessionImpl : public wxRefCounterMT +{ +public: + virtual ~wxWebSessionImpl() { } + + virtual wxWebRequestImplPtr + CreateRequest(wxWebSession& session, + wxEvtHandler* handler, + const wxString& url, + int id) = 0; + + virtual wxVersionInfo GetLibraryVersionInfo() = 0; + + void AddCommonHeader(const wxString& name, const wxString& value) + { m_headers[name] = value; } + + void SetTempDir(const wxString& dir) { m_tempDir = dir; } + + wxString GetTempDir() const; + + const wxWebRequestHeaderMap& GetHeaders() const { return m_headers; } + + virtual wxWebSessionHandle GetNativeHandle() const = 0; + +protected: + wxWebSessionImpl(); + +private: + // Make it a friend to allow accessing our m_headers. + friend class wxWebRequest; + + wxWebRequestHeaderMap m_headers; + wxString m_tempDir; + + wxDECLARE_NO_COPY_CLASS(wxWebSessionImpl); +}; + +#endif // _WX_PRIVATE_WEBREQUEST_H_ diff --git a/lib/wxWidgets/include/wx/private/webrequest_curl.h b/lib/wxWidgets/include/wx/private/webrequest_curl.h new file mode 100644 index 0000000..81b7aec --- /dev/null +++ b/lib/wxWidgets/include/wx/private/webrequest_curl.h @@ -0,0 +1,202 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/webrequest_curl.h +// Purpose: wxWebRequest implementation using libcurl +// Author: Tobias Taschner +// Created: 2018-10-25 +// Copyright: (c) 2018 wxWidgets development team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WEBREQUEST_CURL_H +#define _WX_WEBREQUEST_CURL_H + +#if wxUSE_WEBREQUEST_CURL + +#include "wx/private/webrequest.h" + +#include "wx/thread.h" +#include "wx/vector.h" +#include "wx/timer.h" +#include "wx/hashmap.h" + +#include "curl/curl.h" + +class wxWebRequestCURL; +class wxWebResponseCURL; +class wxWebSessionCURL; +class SocketPoller; + +class wxWebAuthChallengeCURL : public wxWebAuthChallengeImpl +{ +public: + wxWebAuthChallengeCURL(wxWebAuthChallenge::Source source, + wxWebRequestCURL& request); + + void SetCredentials(const wxWebCredentials& cred) wxOVERRIDE; + +private: + wxWebRequestCURL& m_request; + + wxDECLARE_NO_COPY_CLASS(wxWebAuthChallengeCURL); +}; + +class wxWebRequestCURL : public wxWebRequestImpl +{ +public: + wxWebRequestCURL(wxWebSession& session, + wxWebSessionCURL& sessionImpl, + wxEvtHandler* handler, + const wxString& url, + int id); + + ~wxWebRequestCURL(); + + void Start() wxOVERRIDE; + + wxWebResponseImplPtr GetResponse() const wxOVERRIDE + { return m_response; } + + wxWebAuthChallengeImplPtr GetAuthChallenge() const wxOVERRIDE + { return m_authChallenge; } + + wxFileOffset GetBytesSent() const wxOVERRIDE; + + wxFileOffset GetBytesExpectedToSend() const wxOVERRIDE; + + CURL* GetHandle() const { return m_handle; } + + wxWebRequestHandle GetNativeHandle() const wxOVERRIDE + { + return (wxWebRequestHandle)GetHandle(); + } + + bool StartRequest(); + + void HandleCompletion(); + + wxString GetError() const; + + // Method called from libcurl callback + size_t CURLOnRead(char* buffer, size_t size); + +private: + void DoCancel() wxOVERRIDE; + + wxWebSessionCURL& m_sessionImpl; + + CURL* m_handle; + char m_errorBuffer[CURL_ERROR_SIZE]; + struct curl_slist *m_headerList; + wxObjectDataPtr<wxWebResponseCURL> m_response; + wxObjectDataPtr<wxWebAuthChallengeCURL> m_authChallenge; + wxFileOffset m_bytesSent; + + void DestroyHeaderList(); + + wxDECLARE_NO_COPY_CLASS(wxWebRequestCURL); +}; + +class wxWebResponseCURL : public wxWebResponseImpl +{ +public: + explicit wxWebResponseCURL(wxWebRequestCURL& request); + + wxFileOffset GetContentLength() const wxOVERRIDE; + + wxString GetURL() const wxOVERRIDE; + + wxString GetHeader(const wxString& name) const wxOVERRIDE; + + int GetStatus() const wxOVERRIDE; + + wxString GetStatusText() const wxOVERRIDE { return m_statusText; } + + + // Methods called from libcurl callbacks + size_t CURLOnWrite(void *buffer, size_t size); + size_t CURLOnHeader(const char* buffer, size_t size); + int CURLOnProgress(curl_off_t); + +private: + wxWebRequestHeaderMap m_headers; + wxString m_statusText; + wxFileOffset m_knownDownloadSize; + + CURL* GetHandle() const + { return static_cast<wxWebRequestCURL&>(m_request).GetHandle(); } + + wxDECLARE_NO_COPY_CLASS(wxWebResponseCURL); +}; + +class wxWebSessionCURL : public wxWebSessionImpl, public wxEvtHandler +{ +public: + wxWebSessionCURL(); + + ~wxWebSessionCURL(); + + wxWebRequestImplPtr + CreateRequest(wxWebSession& session, + wxEvtHandler* handler, + const wxString& url, + int id = wxID_ANY) wxOVERRIDE; + + wxVersionInfo GetLibraryVersionInfo() wxOVERRIDE; + + wxWebSessionHandle GetNativeHandle() const wxOVERRIDE + { + return (wxWebSessionHandle)m_handle; + } + + bool StartRequest(wxWebRequestCURL& request); + + void CancelRequest(wxWebRequestCURL* request); + + void RequestHasTerminated(wxWebRequestCURL* request); + + static bool CurlRuntimeAtLeastVersion(unsigned int, unsigned int, + unsigned int); + +private: + static int TimerCallback(CURLM*, long, void*); + static int SocketCallback(CURL*, curl_socket_t, int, void*, void*); + + void ProcessTimerCallback(long); + void TimeoutNotification(wxTimerEvent&); + void ProcessTimeoutNotification(); + void ProcessSocketCallback(CURL*, curl_socket_t, int); + void ProcessSocketPollerResult(wxThreadEvent&); + void CheckForCompletedTransfers(); + void FailRequest(CURL*, const wxString&); + void StopActiveTransfer(CURL*); + void RemoveActiveSocket(CURL*); + + WX_DECLARE_HASH_MAP(CURL*, wxWebRequestCURL*, wxPointerHash, \ + wxPointerEqual, TransferSet); + + WX_DECLARE_HASH_MAP(CURL*, curl_socket_t, wxPointerHash, \ + wxPointerEqual, CurlSocketMap); + + TransferSet m_activeTransfers; + CurlSocketMap m_activeSockets; + + SocketPoller* m_socketPoller; + wxTimer m_timeoutTimer; + CURLM* m_handle; + + static int ms_activeSessions; + static unsigned int ms_runtimeVersion; + + wxDECLARE_NO_COPY_CLASS(wxWebSessionCURL); +}; + +class wxWebSessionFactoryCURL : public wxWebSessionFactory +{ +public: + wxWebSessionImpl* Create() wxOVERRIDE + { return new wxWebSessionCURL(); } +}; + +#endif // wxUSE_WEBREQUEST_CURL + +#endif diff --git a/lib/wxWidgets/include/wx/private/window.h b/lib/wxWidgets/include/wx/private/window.h new file mode 100644 index 0000000..4f5f7f4 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/window.h @@ -0,0 +1,100 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/private/window.h +// Purpose: misc wxWindow helpers +// Author: Vaclav Slavik +// Created: 2010-01-21 +// Copyright: (c) 2010 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_WINDOW_H_ +#define _WX_PRIVATE_WINDOW_H_ + +#include "wx/gdicmn.h" +#include "wx/dynlib.h" + +namespace wxPrivate +{ + +// Windows' computes dialog units using average character width over upper- +// and lower-case ASCII alphabet and not using the average character width +// metadata stored in the font; see +// http://support.microsoft.com/default.aspx/kb/145994 for detailed discussion. +// +// This helper function computes font dimensions in the same way. It works with +// either wxDC or wxWindow argument. +template<typename T> +inline wxSize GetAverageASCIILetterSize(const T& of_what) +{ + const wxStringCharType *TEXT_TO_MEASURE = + wxS("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"); + + wxSize s = of_what.GetTextExtent(TEXT_TO_MEASURE); + s.x = (s.x / 26 + 1) / 2; + return s; +} + +namespace +{ + +inline bool SupportsPerMonitorDPI() +{ + static bool s_checkDPI = +#if defined(__WXMSW__) && wxUSE_DYNLIB_CLASS + // Only check the DPI when GetDpiForWindow is available because the old + // method (GetDeviceCaps) is a lot slower (about 1500 times). + // And when GetDpiForWindow is not available (for example older Windows + // versions), per-monitor DPI (V2) is also not available. + wxLoadedDLL("user32.dll").HasSymbol("GetDpiForWindow"); +#else + false; +#endif + return s_checkDPI; +} + +} + +template <typename T> +class DpiDependentValue +{ +public: + // Explicit initialization is needed if T is a primitive type. + DpiDependentValue() + : m_value(), m_dpi() + { } + + bool HasChanged(const wxWindowBase* win) + { + if ( win && SupportsPerMonitorDPI() ) + { + const wxSize dpi = win->GetDPI(); + if ( dpi != m_dpi ) + { + m_dpi = dpi; + return true; + } + } + + // Ensure that we return true the first time we're called, + // assuming that the value will always be set to a non-default value. + return m_value == T(); + } + + void SetAtNewDPI(const T& value) + { + m_value = value; + } + + T& Get() + { + return m_value; + } + +private: + T m_value; + wxSize m_dpi; +}; + +} // namespace wxPrivate + +#endif // _WX_PRIVATE_WINDOW_H_ diff --git a/lib/wxWidgets/include/wx/private/wxprintf.h b/lib/wxWidgets/include/wx/private/wxprintf.h new file mode 100644 index 0000000..05be414 --- /dev/null +++ b/lib/wxWidgets/include/wx/private/wxprintf.h @@ -0,0 +1,968 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/private/wxprintf.h +// Purpose: wxWidgets wxPrintf() implementation +// Author: Ove Kaven +// Modified by: Ron Lee, Francesco Montorsi +// Created: 09/04/99 +// Copyright: (c) wxWidgets copyright +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_WXPRINTF_H_ +#define _WX_PRIVATE_WXPRINTF_H_ + +// --------------------------------------------------------------------------- +// headers and macros +// --------------------------------------------------------------------------- + +#include "wx/crt.h" +#include "wx/log.h" +#include "wx/utils.h" + +#include <limits.h> +#include <string.h> + +// prefer snprintf over sprintf +#if defined(__VISUALC__) + #define system_sprintf(buff, max, flags, data) \ + ::_snprintf(buff, max, flags, data) +#elif defined(HAVE_SNPRINTF) + #define system_sprintf(buff, max, flags, data) \ + ::snprintf(buff, max, flags, data) +#else // NB: at least sprintf() should always be available + // since 'max' is not used in this case, wxVsnprintf() should always + // ensure that 'buff' is big enough for all common needs + // (see wxMAX_SVNPRINTF_FLAGBUFFER_LEN and wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN) + #define system_sprintf(buff, max, flags, data) \ + ::sprintf(buff, flags, data) + + #define SYSTEM_SPRINTF_IS_UNSAFE +#endif + +// --------------------------------------------------------------------------- +// printf format string parsing +// --------------------------------------------------------------------------- + +// some limits of our implementation +#define wxMAX_SVNPRINTF_ARGUMENTS 64 +#define wxMAX_SVNPRINTF_FLAGBUFFER_LEN 32 +#define wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN 512 + + +// the conversion specifiers accepted by wxCRT_VsnprintfW +enum wxPrintfArgType +{ + wxPAT_INVALID = -1, + + wxPAT_INT, // %d, %i, %o, %u, %x, %X + wxPAT_LONGINT, // %ld, etc +#ifdef wxLongLong_t + wxPAT_LONGLONGINT, // %Ld, etc +#endif + wxPAT_SIZET, // %zd, etc + + wxPAT_DOUBLE, // %e, %E, %f, %g, %G + wxPAT_LONGDOUBLE, // %le, etc + + wxPAT_POINTER, // %p + + wxPAT_CHAR, // %hc (in ANSI mode: %c, too) + wxPAT_WCHAR, // %lc (in Unicode mode: %c, too) + + wxPAT_PCHAR, // %s (related to a char *) + wxPAT_PWCHAR, // %s (related to a wchar_t *) + + wxPAT_NINT, // %n + wxPAT_NSHORTINT, // %hn + wxPAT_NLONGINT, // %ln + + wxPAT_STAR // '*' used for width or precision +}; + +// an argument passed to wxCRT_VsnprintfW +union wxPrintfArg +{ + int pad_int; // %d, %i, %o, %u, %x, %X + long int pad_longint; // %ld, etc +#ifdef wxLongLong_t + wxLongLong_t pad_longlongint; // %Ld, etc +#endif + size_t pad_sizet; // %zd, etc + + double pad_double; // %e, %E, %f, %g, %G + long double pad_longdouble; // %le, etc + + void *pad_pointer; // %p + + char pad_char; // %hc (in ANSI mode: %c, too) + wchar_t pad_wchar; // %lc (in Unicode mode: %c, too) + + void *pad_str; // %s + + int *pad_nint; // %n + short int *pad_nshortint; // %hn + long int *pad_nlongint; // %ln +}; + +// helper for converting string into either char* or wchar_t* depending +// on the type of wxPrintfConvSpec<T> instantiation: +template<typename CharType> struct wxPrintfStringHelper {}; + +template<> struct wxPrintfStringHelper<char> +{ + typedef const wxWX2MBbuf ConvertedType; + static ConvertedType Convert(const wxString& s) { return s.mb_str(); } +}; + +template<> struct wxPrintfStringHelper<wchar_t> +{ + typedef const wxWX2WCbuf ConvertedType; + static ConvertedType Convert(const wxString& s) { return s.wc_str(); } +}; + + +// Contains parsed data relative to a conversion specifier given to +// wxCRT_VsnprintfW and parsed from the format string +// NOTE: in C++ there is almost no difference between struct & classes thus +// there is no performance gain by using a struct here... +template<typename CharType> +class wxPrintfConvSpec +{ +public: + + // the position of the argument relative to this conversion specifier + size_t m_pos; + + // the type of this conversion specifier + wxPrintfArgType m_type; + + // the minimum and maximum width + // when one of this var is set to -1 it means: use the following argument + // in the stack as minimum/maximum width for this conversion specifier + int m_nMinWidth, m_nMaxWidth; + + // does the argument need to the be aligned to left ? + bool m_bAlignLeft; + + // pointer to the '%' of this conversion specifier in the format string + // NOTE: this points somewhere in the string given to the Parse() function - + // it's task of the caller ensure that memory is still valid ! + const CharType *m_pArgPos; + + // pointer to the last character of this conversion specifier in the + // format string + // NOTE: this points somewhere in the string given to the Parse() function - + // it's task of the caller ensure that memory is still valid ! + const CharType *m_pArgEnd; + + // a little buffer where formatting flags like #+\.hlqLz are stored by Parse() + // for use in Process() + char m_szFlags[wxMAX_SVNPRINTF_FLAGBUFFER_LEN]; + + +public: + + // we don't declare this as a constructor otherwise it would be called + // automatically and we don't want this: to be optimized, wxCRT_VsnprintfW + // calls this function only on really-used instances of this class. + void Init(); + + // Parses the first conversion specifier in the given string, which must + // begin with a '%'. Returns false if the first '%' does not introduce a + // (valid) conversion specifier and thus should be ignored. + bool Parse(const CharType *format); + + // Process this conversion specifier and puts the result in the given + // buffer. Returns the number of characters written in 'buf' or -1 if + // there's not enough space. + int Process(CharType *buf, size_t lenMax, wxPrintfArg *p, size_t written); + + // Loads the argument of this conversion specifier from given va_list. + bool LoadArg(wxPrintfArg *p, va_list &argptr); + +private: + // A helper function of LoadArg() which is used to handle the '*' flag + void ReplaceAsteriskWith(int w); +}; + +template<typename CharType> +void wxPrintfConvSpec<CharType>::Init() +{ + m_nMinWidth = 0; + m_nMaxWidth = INT_MAX; + m_pos = 0; + m_bAlignLeft = false; + m_pArgPos = m_pArgEnd = NULL; + m_type = wxPAT_INVALID; + + memset(m_szFlags, 0, sizeof(m_szFlags)); + // this character will never be removed from m_szFlags array and + // is important when calling sprintf() in wxPrintfConvSpec::Process() ! + m_szFlags[0] = '%'; +} + +template<typename CharType> +bool wxPrintfConvSpec<CharType>::Parse(const CharType *format) +{ + bool done = false; + + // temporary parse data + size_t flagofs = 1; + bool in_prec, // true if we found the dot in some previous iteration + prec_dot; // true if the dot has been already added to m_szFlags + int ilen = 0; + + m_bAlignLeft = in_prec = prec_dot = false; + m_pArgPos = m_pArgEnd = format; + do + { +#define CHECK_PREC \ + if (in_prec && !prec_dot) \ + { \ + m_szFlags[flagofs++] = '.'; \ + prec_dot = true; \ + } + + // what follows '%'? + const CharType ch = *(++m_pArgEnd); + switch ( ch ) + { + case wxT('\0'): + return false; // not really an argument + + case wxT('%'): + return false; // not really an argument + + case wxT('#'): + case wxT('0'): + case wxT(' '): + case wxT('+'): + case wxT('\''): + CHECK_PREC + m_szFlags[flagofs++] = char(ch); + break; + + case wxT('-'): + CHECK_PREC + m_bAlignLeft = true; + m_szFlags[flagofs++] = char(ch); + break; + + case wxT('.'): + // don't use CHECK_PREC here to avoid warning about the value + // assigned to prec_dot inside it being never used (because + // overwritten just below) + if (in_prec && !prec_dot) + m_szFlags[flagofs++] = '.'; + in_prec = true; + prec_dot = false; + m_nMaxWidth = 0; + // dot will be auto-added to m_szFlags if non-negative + // number follows + break; + + case wxT('h'): + ilen = -1; + CHECK_PREC + m_szFlags[flagofs++] = char(ch); + break; + + case wxT('l'): + // NB: it's safe to use flagofs-1 as flagofs always start from 1 + if (m_szFlags[flagofs-1] == 'l') // 'll' modifier is the same as 'L' or 'q' + ilen = 2; + else + ilen = 1; + CHECK_PREC + m_szFlags[flagofs++] = char(ch); + break; + + case wxT('q'): + case wxT('L'): + ilen = 2; + CHECK_PREC + m_szFlags[flagofs++] = char(ch); + break; +#ifdef __WINDOWS__ + // under Windows we support the special '%I64' notation as longlong + // integer conversion specifier for MSVC compatibility + // (it behaves exactly as '%lli' or '%Li' or '%qi') + case wxT('I'): + if (*(m_pArgEnd+1) == wxT('6') && + *(m_pArgEnd+2) == wxT('4')) + { + m_pArgEnd++; + m_pArgEnd++; + + ilen = 2; + CHECK_PREC + m_szFlags[flagofs++] = char(ch); + m_szFlags[flagofs++] = '6'; + m_szFlags[flagofs++] = '4'; + break; + } + // else: fall-through, 'I' is MSVC equivalent of C99 'z' + wxFALLTHROUGH; +#endif // __WINDOWS__ + + case wxT('z'): + case wxT('Z'): + // 'z' is C99 standard for size_t and ptrdiff_t, 'Z' was used + // for this purpose in libc5 and by wx <= 2.8 + ilen = 3; + CHECK_PREC + m_szFlags[flagofs++] = char(ch); + break; + + case wxT('*'): + if (in_prec) + { + CHECK_PREC + + // tell Process() to use the next argument + // in the stack as maxwidth... + m_nMaxWidth = -1; + } + else + { + // tell Process() to use the next argument + // in the stack as minwidth... + m_nMinWidth = -1; + } + + // save the * in our formatting buffer... + // will be replaced later by Process() + m_szFlags[flagofs++] = char(ch); + break; + + case wxT('1'): case wxT('2'): case wxT('3'): + case wxT('4'): case wxT('5'): case wxT('6'): + case wxT('7'): case wxT('8'): case wxT('9'): + { + int len = 0; + CHECK_PREC + while ( (*m_pArgEnd >= CharType('0')) && + (*m_pArgEnd <= CharType('9')) ) + { + m_szFlags[flagofs++] = char(*m_pArgEnd); + len = len*10 + (*m_pArgEnd - wxT('0')); + m_pArgEnd++; + } + + if (in_prec) + m_nMaxWidth = len; + else + m_nMinWidth = len; + + m_pArgEnd--; // the main loop pre-increments n again + } + break; + + case wxT('$'): // a positional parameter (e.g. %2$s) ? + { + if (m_nMinWidth <= 0) + break; // ignore this formatting flag as no + // numbers are preceding it + + // remove from m_szFlags all digits previously added + do { + flagofs--; + } while (m_szFlags[flagofs] >= '1' && + m_szFlags[flagofs] <= '9'); + + // re-adjust the offset making it point to the + // next free char of m_szFlags + flagofs++; + + m_pos = m_nMinWidth; + m_nMinWidth = 0; + } + break; + + case wxT('d'): + case wxT('i'): + case wxT('o'): + case wxT('u'): + case wxT('x'): + case wxT('X'): + CHECK_PREC + m_szFlags[flagofs++] = char(ch); + if (ilen == 0) + m_type = wxPAT_INT; + else if (ilen == -1) + // NB: 'short int' value passed through '...' + // is promoted to 'int', so we have to get + // an int from stack even if we need a short + m_type = wxPAT_INT; + else if (ilen == 1) + m_type = wxPAT_LONGINT; + else if (ilen == 2) +#ifdef wxLongLong_t + m_type = wxPAT_LONGLONGINT; +#else // !wxLongLong_t + m_type = wxPAT_LONGINT; +#endif // wxLongLong_t/!wxLongLong_t + else if (ilen == 3) + m_type = wxPAT_SIZET; + done = true; + break; + + case wxT('e'): + case wxT('E'): + case wxT('f'): + case wxT('g'): + case wxT('G'): + CHECK_PREC + m_szFlags[flagofs++] = char(ch); + if (ilen == 2) + m_type = wxPAT_LONGDOUBLE; + else + m_type = wxPAT_DOUBLE; + done = true; + break; + + case wxT('p'): + m_type = wxPAT_POINTER; + m_szFlags[flagofs++] = char(ch); + done = true; + break; + + case wxT('c'): +#if wxUSE_UNICODE + if (ilen == -1) + { + // %hc == ANSI character + m_type = wxPAT_CHAR; + } + else + { + // %lc == %c == Unicode character + m_type = wxPAT_WCHAR; + } +#else + if (ilen == 1) + { + // %lc == Unicode character + m_type = wxPAT_WCHAR; + } + else + { + // %hc == %c == ANSI character + m_type = wxPAT_CHAR; + } +#endif + done = true; + break; + + case wxT('s'): +#if wxUSE_UNICODE + if (ilen == -1) + { + // wx extension: we'll let %hs mean non-Unicode strings + m_type = wxPAT_PCHAR; + } + else + { + // %ls == %s == Unicode string + m_type = wxPAT_PWCHAR; + } +#else + if (ilen == 1) + { + // %ls == Unicode string + m_type = wxPAT_PWCHAR; + } + else + { + // %s == %hs == ANSI string + m_type = wxPAT_PCHAR; + } +#endif + done = true; + break; + + case wxT('n'): + if (ilen == 0) + m_type = wxPAT_NINT; + else if (ilen == -1) + m_type = wxPAT_NSHORTINT; + else if (ilen >= 1) + m_type = wxPAT_NLONGINT; + done = true; + break; + + default: + // bad format, don't consider this an argument; + // leave it unchanged + return false; + } + + if (flagofs == wxMAX_SVNPRINTF_FLAGBUFFER_LEN) + { + wxLogDebug(wxT("Too many flags specified for a single conversion specifier!")); + return false; + } + } + while (!done); + + return true; // parsing was successful +} + +template<typename CharType> +void wxPrintfConvSpec<CharType>::ReplaceAsteriskWith(int width) +{ + char temp[wxMAX_SVNPRINTF_FLAGBUFFER_LEN]; + + // find the first * in our flag buffer + char *pwidth = strchr(m_szFlags, '*'); + wxCHECK_RET(pwidth, wxT("field width must be specified")); + + // save what follows the * (the +1 is to skip the asterisk itself!) + strcpy(temp, pwidth+1); + if (width < 0) + { + pwidth[0] = wxT('-'); + pwidth++; + } + + // replace * with the actual integer given as width +#ifndef SYSTEM_SPRINTF_IS_UNSAFE + int maxlen = (m_szFlags + wxMAX_SVNPRINTF_FLAGBUFFER_LEN - pwidth) / + sizeof(*m_szFlags); +#endif + int offset = system_sprintf(pwidth, maxlen, "%d", abs(width)); + + // restore after the expanded * what was following it + strcpy(pwidth+offset, temp); +} + +template<typename CharType> +bool wxPrintfConvSpec<CharType>::LoadArg(wxPrintfArg *p, va_list &argptr) +{ + // did the '*' width/precision specifier was used ? + if (m_nMaxWidth == -1) + { + // take the maxwidth specifier from the stack + m_nMaxWidth = va_arg(argptr, int); + if (m_nMaxWidth < 0) + m_nMaxWidth = 0; + else + ReplaceAsteriskWith(m_nMaxWidth); + } + + if (m_nMinWidth == -1) + { + // take the minwidth specifier from the stack + m_nMinWidth = va_arg(argptr, int); + + ReplaceAsteriskWith(m_nMinWidth); + if (m_nMinWidth < 0) + { + m_bAlignLeft = !m_bAlignLeft; + m_nMinWidth = -m_nMinWidth; + } + } + + switch (m_type) { + case wxPAT_INT: + p->pad_int = va_arg(argptr, int); + break; + case wxPAT_LONGINT: + p->pad_longint = va_arg(argptr, long int); + break; +#ifdef wxLongLong_t + case wxPAT_LONGLONGINT: + p->pad_longlongint = va_arg(argptr, wxLongLong_t); + break; +#endif // wxLongLong_t + case wxPAT_SIZET: + p->pad_sizet = va_arg(argptr, size_t); + break; + case wxPAT_DOUBLE: + p->pad_double = va_arg(argptr, double); + break; + case wxPAT_LONGDOUBLE: + p->pad_longdouble = va_arg(argptr, long double); + break; + case wxPAT_POINTER: + p->pad_pointer = va_arg(argptr, void *); + break; + + case wxPAT_CHAR: + p->pad_char = (char)va_arg(argptr, int); // char is promoted to int when passed through '...' + break; + case wxPAT_WCHAR: + p->pad_wchar = (wchar_t)va_arg(argptr, int); // char is promoted to int when passed through '...' + break; + + case wxPAT_PCHAR: + case wxPAT_PWCHAR: + p->pad_str = va_arg(argptr, void *); + break; + + case wxPAT_NINT: + p->pad_nint = va_arg(argptr, int *); + break; + case wxPAT_NSHORTINT: + p->pad_nshortint = va_arg(argptr, short int *); + break; + case wxPAT_NLONGINT: + p->pad_nlongint = va_arg(argptr, long int *); + break; + + case wxPAT_STAR: + // this will be handled as part of the next argument + return true; + + case wxPAT_INVALID: + default: + return false; + } + + return true; // loading was successful +} + +template<typename CharType> +int wxPrintfConvSpec<CharType>::Process(CharType *buf, size_t lenMax, wxPrintfArg *p, size_t written) +{ + // buffer to avoid dynamic memory allocation each time for small strings; + // note that this buffer is used only to hold results of number formatting, + // %s directly writes user's string in buf, without using szScratch + char szScratch[wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN]; + size_t lenScratch = 0, lenCur = 0; + +#define APPEND_CH(ch) \ + { \ + if ( lenCur == lenMax ) \ + return -1; \ + \ + buf[lenCur++] = ch; \ + } + + switch ( m_type ) + { + case wxPAT_INT: + lenScratch = system_sprintf(szScratch, wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN, m_szFlags, p->pad_int); + break; + + case wxPAT_LONGINT: + lenScratch = system_sprintf(szScratch, wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN, m_szFlags, p->pad_longint); + break; + +#ifdef wxLongLong_t + case wxPAT_LONGLONGINT: + lenScratch = system_sprintf(szScratch, wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN, m_szFlags, p->pad_longlongint); + break; +#endif // SIZEOF_LONG_LONG + + case wxPAT_SIZET: + lenScratch = system_sprintf(szScratch, wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN, m_szFlags, p->pad_sizet); + break; + + case wxPAT_LONGDOUBLE: + lenScratch = system_sprintf(szScratch, wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN, m_szFlags, p->pad_longdouble); + break; + + case wxPAT_DOUBLE: + lenScratch = system_sprintf(szScratch, wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN, m_szFlags, p->pad_double); + break; + + case wxPAT_POINTER: + lenScratch = system_sprintf(szScratch, wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN, m_szFlags, p->pad_pointer); + break; + + case wxPAT_CHAR: + case wxPAT_WCHAR: + { + wxUniChar ch; + if (m_type == wxPAT_CHAR) + ch = p->pad_char; + else // m_type == wxPAT_WCHAR + ch = p->pad_wchar; + + CharType val = ch; + + size_t i; + + if (!m_bAlignLeft) + for (i = 1; i < (size_t)m_nMinWidth; i++) + APPEND_CH(wxT(' ')); + + APPEND_CH(val); + + if (m_bAlignLeft) + for (i = 1; i < (size_t)m_nMinWidth; i++) + APPEND_CH(wxT(' ')); + } + break; + + case wxPAT_PCHAR: + case wxPAT_PWCHAR: + { + wxString s; + if ( !p->pad_str ) + { + if ( m_nMaxWidth >= 6 ) + s = wxT("(null)"); + } + else if (m_type == wxPAT_PCHAR) + s.assign(static_cast<const char *>(p->pad_str)); + else // m_type == wxPAT_PWCHAR + s.assign(static_cast<const wchar_t *>(p->pad_str)); + + typename wxPrintfStringHelper<CharType>::ConvertedType strbuf( + wxPrintfStringHelper<CharType>::Convert(s)); + + // at this point we are sure that m_nMaxWidth is positive or + // null (see top of wxPrintfConvSpec::LoadArg) + int len = wxMin((unsigned int)m_nMaxWidth, wxStrlen(strbuf)); + + int i; + + if (!m_bAlignLeft) + { + for (i = len; i < m_nMinWidth; i++) + APPEND_CH(wxT(' ')); + } + + len = wxMin((unsigned int)len, lenMax-lenCur); + wxStrncpy(buf+lenCur, strbuf, len); + lenCur += len; + + if (m_bAlignLeft) + { + for (i = len; i < m_nMinWidth; i++) + APPEND_CH(wxT(' ')); + } + } + break; + + case wxPAT_NINT: + *p->pad_nint = written; + break; + + case wxPAT_NSHORTINT: + *p->pad_nshortint = (short int)written; + break; + + case wxPAT_NLONGINT: + *p->pad_nlongint = written; + break; + + case wxPAT_INVALID: + default: + return -1; + } + + // if we used system's sprintf() then we now need to append the s_szScratch + // buffer to the given one... + switch (m_type) + { + case wxPAT_INT: + case wxPAT_LONGINT: +#ifdef wxLongLong_t + case wxPAT_LONGLONGINT: +#endif + case wxPAT_SIZET: + case wxPAT_LONGDOUBLE: + case wxPAT_DOUBLE: + case wxPAT_POINTER: + wxASSERT(lenScratch < wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN); + // NB: 1) we can compare lenMax (for CharType*, i.e. possibly + // wchar_t*) with lenScratch (char*) because this code is + // formatting integers and that will have the same length + // even in UTF-8 (the only case when char* length may be + // more than wchar_t* length of the same string) + // 2) wxStrncpy converts the 2nd argument to 1st argument's + // type transparently if their types differ, so this code + // works for both instantiations + if (lenMax < lenScratch) + { + // fill output buffer and then return -1 + wxStrncpy(buf, szScratch, lenMax); + return -1; + } + wxStrncpy(buf, szScratch, lenScratch); + lenCur += lenScratch; + break; + + default: + break; // all other cases were completed previously + } + + return lenCur; +} + + +// helper that parses format string +template<typename CharType> +struct wxPrintfConvSpecParser +{ + typedef wxPrintfConvSpec<CharType> ConvSpec; + + wxPrintfConvSpecParser(const CharType *fmt) + { + nspecs = + nargs = 0; + posarg_present = + nonposarg_present = false; + + memset(pspec, 0, sizeof(pspec)); + + // parse the format string + for ( const CharType *toparse = fmt; *toparse != wxT('\0'); toparse++ ) + { + // skip everything except format specifications + if ( *toparse != '%' ) + continue; + + // also skip escaped percent signs + if ( toparse[1] == '%' ) + { + toparse++; + continue; + } + + ConvSpec *spec = &specs[nspecs]; + spec->Init(); + + // attempt to parse this format specification + if ( !spec->Parse(toparse) ) + continue; + + // advance to the end of this specifier + toparse = spec->m_pArgEnd; + + // special handling for specifications including asterisks: we need + // to reserve an extra slot (or two if asterisks were used for both + // width and precision) in specs array in this case + if ( const char *f = strchr(spec->m_szFlags, '*') ) + { + unsigned numAsterisks = 1; + if ( strchr(++f, '*') ) + numAsterisks++; + + for ( unsigned n = 0; n < numAsterisks; n++ ) + { + if ( ++nspecs == wxMAX_SVNPRINTF_ARGUMENTS ) + break; + + // TODO: we need to support specifiers of the form "%2$*1$s" + // (this is the same as "%*s") as if any positional arguments + // are used all asterisks must be positional as well but this + // requires a lot of changes in this code (basically we'd need + // to rewrite Parse() to return "*" and conversion itself as + // separate entries) + if ( posarg_present ) + { + wxFAIL_MSG + ( + wxString::Format + (wxASCII_STR( + "Format string \"%s\" uses both positional " + "parameters and '*' but this is not currently " + "supported by this implementation, sorry."), + fmt + ) + ); + } + + specs[nspecs] = *spec; + + // make an entry for '*' and point to it from pspec + spec->Init(); + spec->m_type = wxPAT_STAR; + pspec[nargs++] = spec; + + spec = &specs[nspecs]; + } + + // If we hit the maximal number of arguments inside the inner + // loop, break out of the outer one as well. + if ( nspecs == wxMAX_SVNPRINTF_ARGUMENTS ) + break; + } + + + // check if this is a positional or normal argument + if ( spec->m_pos > 0 ) + { + // the positional arguments start from number 1 so we need + // to adjust the index + spec->m_pos--; + + // We could be reusing an already existing argument, only + // increment their number if it's really a new one. + if ( spec->m_pos >= nargs ) + { + nargs = spec->m_pos + 1; + } + else if ( pspec[spec->m_pos] ) // Had we seen it before? + { + // Check that the type specified this time is compatible + // with the previously-specified type. + wxASSERT_MSG + ( + pspec[spec->m_pos]->m_type == spec->m_type, + "Positional parameter specified multiple times " + "with incompatible types." + ); + } + + posarg_present = true; + } + else // not a positional argument... + { + spec->m_pos = nargs++; + nonposarg_present = true; + } + + // this conversion specifier is tied to the pos-th argument... + pspec[spec->m_pos] = spec; + + if ( ++nspecs == wxMAX_SVNPRINTF_ARGUMENTS ) + break; + } + + + // warn if we lost any arguments (the program probably will crash + // anyhow because of stack corruption...) + if ( nspecs == wxMAX_SVNPRINTF_ARGUMENTS ) + { + wxFAIL_MSG + ( + wxString::Format + (wxASCII_STR( + "wxVsnprintf() currently supports only %d arguments, " + "but format string \"%s\" defines more of them.\n" + "You need to change wxMAX_SVNPRINTF_ARGUMENTS and " + "recompile if more are really needed."), + fmt, wxMAX_SVNPRINTF_ARGUMENTS + ) + ); + } + } + + // total number of valid elements in specs + unsigned nspecs; + + // total number of arguments, also number of valid elements in pspec, and + // always less than or (usually) equal to nspecs + unsigned nargs; + + // all format specifications in this format string in order of their + // appearance (which may be different from arguments order) + ConvSpec specs[wxMAX_SVNPRINTF_ARGUMENTS]; + + // pointer to specs array element for the N-th argument + ConvSpec *pspec[wxMAX_SVNPRINTF_ARGUMENTS]; + + // true if any positional/non-positional parameters are used + bool posarg_present, + nonposarg_present; +}; + +#undef APPEND_CH +#undef CHECK_PREC + +#endif // _WX_PRIVATE_WXPRINTF_H_ diff --git a/lib/wxWidgets/include/wx/prntbase.h b/lib/wxWidgets/include/wx/prntbase.h new file mode 100644 index 0000000..c674156 --- /dev/null +++ b/lib/wxWidgets/include/wx/prntbase.h @@ -0,0 +1,768 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/prntbase.h +// Purpose: Base classes for printing framework +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRNTBASEH__ +#define _WX_PRNTBASEH__ + +#include "wx/defs.h" + +#if wxUSE_PRINTING_ARCHITECTURE + +#include "wx/event.h" +#include "wx/cmndata.h" +#include "wx/panel.h" +#include "wx/scrolwin.h" +#include "wx/dialog.h" +#include "wx/frame.h" +#include "wx/dc.h" + +class WXDLLIMPEXP_FWD_CORE wxDC; +class WXDLLIMPEXP_FWD_CORE wxButton; +class WXDLLIMPEXP_FWD_CORE wxChoice; +class WXDLLIMPEXP_FWD_CORE wxPrintout; +class WXDLLIMPEXP_FWD_CORE wxPrinterBase; +class WXDLLIMPEXP_FWD_CORE wxPrintDialogBase; +class WXDLLIMPEXP_FWD_CORE wxPrintDialog; +class WXDLLIMPEXP_FWD_CORE wxPageSetupDialogBase; +class WXDLLIMPEXP_FWD_CORE wxPageSetupDialog; +class WXDLLIMPEXP_FWD_CORE wxPrintPreviewBase; +class WXDLLIMPEXP_FWD_CORE wxPreviewCanvas; +class WXDLLIMPEXP_FWD_CORE wxPreviewControlBar; +class WXDLLIMPEXP_FWD_CORE wxPreviewFrame; +class WXDLLIMPEXP_FWD_CORE wxPrintFactory; +class WXDLLIMPEXP_FWD_CORE wxPrintNativeDataBase; +class WXDLLIMPEXP_FWD_CORE wxPrintPreview; +class WXDLLIMPEXP_FWD_CORE wxPrintAbortDialog; +class WXDLLIMPEXP_FWD_CORE wxStaticText; +class wxPrintPageMaxCtrl; +class wxPrintPageTextCtrl; + +//---------------------------------------------------------------------------- +// error consts +//---------------------------------------------------------------------------- + +enum wxPrinterError +{ + wxPRINTER_NO_ERROR = 0, + wxPRINTER_CANCELLED, + wxPRINTER_ERROR +}; + +// Preview frame modality kind used with wxPreviewFrame::Initialize() +enum wxPreviewFrameModalityKind +{ + // Disable all the other top level windows while the preview is shown. + wxPreviewFrame_AppModal, + + // Disable only the parent window while the preview is shown. + wxPreviewFrame_WindowModal, + + // Don't disable any windows. + wxPreviewFrame_NonModal +}; + +//---------------------------------------------------------------------------- +// wxPrintFactory +//---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPrintFactory +{ +public: + wxPrintFactory() {} + virtual ~wxPrintFactory() {} + + virtual wxPrinterBase *CreatePrinter( wxPrintDialogData* data ) = 0; + + virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, + wxPrintout *printout = NULL, + wxPrintDialogData *data = NULL ) = 0; + virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, + wxPrintout *printout, + wxPrintData *data ) = 0; + + virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, + wxPrintDialogData *data = NULL ) = 0; + virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, + wxPrintData *data ) = 0; + + virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent, + wxPageSetupDialogData * data = NULL ) = 0; + + virtual wxDCImpl* CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data ) = 0; + + // What to do and what to show in the wxPrintDialog + // a) Use the generic print setup dialog or a native one? + virtual bool HasPrintSetupDialog() = 0; + virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data ) = 0; + // b) Provide the "print to file" option ourselves or via print setup? + virtual bool HasOwnPrintToFile() = 0; + // c) Show current printer + virtual bool HasPrinterLine() = 0; + virtual wxString CreatePrinterLine() = 0; + // d) Show Status line for current printer? + virtual bool HasStatusLine() = 0; + virtual wxString CreateStatusLine() = 0; + + + virtual wxPrintNativeDataBase *CreatePrintNativeData() = 0; + + static void SetPrintFactory( wxPrintFactory *factory ); + static wxPrintFactory *GetFactory(); +private: + static wxPrintFactory *m_factory; +}; + +class WXDLLIMPEXP_CORE wxNativePrintFactory: public wxPrintFactory +{ +public: + virtual wxPrinterBase *CreatePrinter( wxPrintDialogData *data ) wxOVERRIDE; + + virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, + wxPrintout *printout = NULL, + wxPrintDialogData *data = NULL ) wxOVERRIDE; + virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, + wxPrintout *printout, + wxPrintData *data ) wxOVERRIDE; + + virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, + wxPrintDialogData *data = NULL ) wxOVERRIDE; + virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, + wxPrintData *data ) wxOVERRIDE; + + virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent, + wxPageSetupDialogData * data = NULL ) wxOVERRIDE; + + virtual wxDCImpl* CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data ) wxOVERRIDE; + + virtual bool HasPrintSetupDialog() wxOVERRIDE; + virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data ) wxOVERRIDE; + virtual bool HasOwnPrintToFile() wxOVERRIDE; + virtual bool HasPrinterLine() wxOVERRIDE; + virtual wxString CreatePrinterLine() wxOVERRIDE; + virtual bool HasStatusLine() wxOVERRIDE; + virtual wxString CreateStatusLine() wxOVERRIDE; + + virtual wxPrintNativeDataBase *CreatePrintNativeData() wxOVERRIDE; +}; + +//---------------------------------------------------------------------------- +// wxPrintNativeDataBase +//---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPrintNativeDataBase: public wxObject +{ +public: + wxPrintNativeDataBase(); + virtual ~wxPrintNativeDataBase() {} + + virtual bool TransferTo( wxPrintData &data ) = 0; + virtual bool TransferFrom( const wxPrintData &data ) = 0; +#ifdef __WXOSX__ + // in order to expose functionality already to the result type of the ..PrintData->GetNativeData() + virtual void TransferFrom( const wxPageSetupDialogData * ) = 0; + virtual void TransferTo( wxPageSetupDialogData * ) = 0; +#endif + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk() const = 0; + + int m_ref; + +private: + wxDECLARE_CLASS(wxPrintNativeDataBase); + wxDECLARE_NO_COPY_CLASS(wxPrintNativeDataBase); +}; + +//---------------------------------------------------------------------------- +// wxPrinterBase +//---------------------------------------------------------------------------- + +/* + * Represents the printer: manages printing a wxPrintout object + */ + +class WXDLLIMPEXP_CORE wxPrinterBase: public wxObject +{ +public: + wxPrinterBase(wxPrintDialogData *data = NULL); + virtual ~wxPrinterBase(); + + virtual wxPrintAbortDialog *CreateAbortWindow(wxWindow *parent, wxPrintout *printout); + virtual void ReportError(wxWindow *parent, wxPrintout *printout, const wxString& message); + + virtual wxPrintDialogData& GetPrintDialogData() const; + bool GetAbort() const { return sm_abortIt; } + + static wxPrinterError GetLastError() { return sm_lastError; } + + /////////////////////////////////////////////////////////////////////////// + // OVERRIDES + + virtual bool Setup(wxWindow *parent) = 0; + virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true) = 0; + virtual wxDC* PrintDialog(wxWindow *parent) = 0; + +protected: + wxPrintDialogData m_printDialogData; + wxPrintout* m_currentPrintout; + + static wxPrinterError sm_lastError; + +public: + static wxWindow* sm_abortWindow; + static bool sm_abortIt; + +private: + wxDECLARE_CLASS(wxPrinterBase); + wxDECLARE_NO_COPY_CLASS(wxPrinterBase); +}; + +//---------------------------------------------------------------------------- +// wxPrinter +//---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPrinter: public wxPrinterBase +{ +public: + wxPrinter(wxPrintDialogData *data = NULL); + virtual ~wxPrinter(); + + virtual wxPrintAbortDialog *CreateAbortWindow(wxWindow *parent, wxPrintout *printout) wxOVERRIDE; + virtual void ReportError(wxWindow *parent, wxPrintout *printout, const wxString& message) wxOVERRIDE; + + virtual bool Setup(wxWindow *parent) wxOVERRIDE; + virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true) wxOVERRIDE; + virtual wxDC* PrintDialog(wxWindow *parent) wxOVERRIDE; + + virtual wxPrintDialogData& GetPrintDialogData() const wxOVERRIDE; + +protected: + wxPrinterBase *m_pimpl; + +private: + wxDECLARE_CLASS(wxPrinter); + wxDECLARE_NO_COPY_CLASS(wxPrinter); +}; + +//---------------------------------------------------------------------------- +// wxPrintout +//---------------------------------------------------------------------------- + +/* + * Represents an object via which a document may be printed. + * The programmer derives from this, overrides (at least) OnPrintPage, + * and passes it to a wxPrinter object for printing, or a wxPrintPreview + * object for previewing. + */ + +class WXDLLIMPEXP_CORE wxPrintout: public wxObject +{ +public: + wxPrintout(const wxString& title = wxGetTranslation("Printout")); + virtual ~wxPrintout(); + + virtual bool OnBeginDocument(int startPage, int endPage); + virtual void OnEndDocument(); + virtual void OnBeginPrinting(); + virtual void OnEndPrinting(); + + // Guaranteed to be before any other functions are called + virtual void OnPreparePrinting() { } + + virtual bool HasPage(int page); + virtual bool OnPrintPage(int page) = 0; + virtual void GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo); + + virtual wxString GetTitle() const { return m_printoutTitle; } + + // Port-specific code should call this function to initialize this object + // with everything it needs, instead of using individual accessors below. + bool SetUp(wxDC& dc); + + wxDC *GetDC() const { return m_printoutDC; } + void SetDC(wxDC *dc) { m_printoutDC = dc; } + + void FitThisSizeToPaper(const wxSize& imageSize); + void FitThisSizeToPage(const wxSize& imageSize); + void FitThisSizeToPageMargins(const wxSize& imageSize, const wxPageSetupDialogData& pageSetupData); + void MapScreenSizeToPaper(); + void MapScreenSizeToPage(); + void MapScreenSizeToPageMargins(const wxPageSetupDialogData& pageSetupData); + void MapScreenSizeToDevice(); + + wxRect GetLogicalPaperRect() const; + wxRect GetLogicalPageRect() const; + wxRect GetLogicalPageMarginsRect(const wxPageSetupDialogData& pageSetupData) const; + + void SetLogicalOrigin(wxCoord x, wxCoord y); + void OffsetLogicalOrigin(wxCoord xoff, wxCoord yoff); + + void SetPageSizePixels(int w, int h) { m_pageWidthPixels = w; m_pageHeightPixels = h; } + void GetPageSizePixels(int *w, int *h) const { *w = m_pageWidthPixels; *h = m_pageHeightPixels; } + void SetPageSizeMM(int w, int h) { m_pageWidthMM = w; m_pageHeightMM = h; } + void GetPageSizeMM(int *w, int *h) const { *w = m_pageWidthMM; *h = m_pageHeightMM; } + + void SetPPIScreen(int x, int y) { m_PPIScreenX = x; m_PPIScreenY = y; } + void SetPPIScreen(const wxSize& ppi) { SetPPIScreen(ppi.x, ppi.y); } + void GetPPIScreen(int *x, int *y) const { *x = m_PPIScreenX; *y = m_PPIScreenY; } + void SetPPIPrinter(int x, int y) { m_PPIPrinterX = x; m_PPIPrinterY = y; } + void SetPPIPrinter(const wxSize& ppi) { SetPPIPrinter(ppi.x, ppi.y); } + void GetPPIPrinter(int *x, int *y) const { *x = m_PPIPrinterX; *y = m_PPIPrinterY; } + + void SetPaperRectPixels(const wxRect& paperRectPixels) { m_paperRectPixels = paperRectPixels; } + wxRect GetPaperRectPixels() const { return m_paperRectPixels; } + + // This must be called by wxPrintPreview to associate itself with the + // printout it uses. + virtual void SetPreview(wxPrintPreview *preview) { m_preview = preview; } + + wxPrintPreview *GetPreview() const { return m_preview; } + virtual bool IsPreview() const { return GetPreview() != NULL; } + +private: + wxString m_printoutTitle; + wxDC* m_printoutDC; + wxPrintPreview *m_preview; + + int m_pageWidthPixels; + int m_pageHeightPixels; + + int m_pageWidthMM; + int m_pageHeightMM; + + int m_PPIScreenX; + int m_PPIScreenY; + int m_PPIPrinterX; + int m_PPIPrinterY; + + wxRect m_paperRectPixels; + +private: + wxDECLARE_ABSTRACT_CLASS(wxPrintout); + wxDECLARE_NO_COPY_CLASS(wxPrintout); +}; + +//---------------------------------------------------------------------------- +// wxPreviewCanvas +//---------------------------------------------------------------------------- + +/* + * Canvas upon which a preview is drawn. + */ + +class WXDLLIMPEXP_CORE wxPreviewCanvas: public wxScrolledWindow +{ +public: + wxPreviewCanvas(wxPrintPreviewBase *preview, + wxWindow *parent, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxT("canvas")); + virtual ~wxPreviewCanvas(); + + void SetPreview(wxPrintPreviewBase *preview) { m_printPreview = preview; } + + void OnPaint(wxPaintEvent& event); + void OnChar(wxKeyEvent &event); + // Responds to colour changes + void OnSysColourChanged(wxSysColourChangedEvent& event); + +private: +#if wxUSE_MOUSEWHEEL + void OnMouseWheel(wxMouseEvent& event); +#endif // wxUSE_MOUSEWHEEL + void OnIdle(wxIdleEvent& event); + + wxPrintPreviewBase* m_printPreview; + + wxDECLARE_CLASS(wxPreviewCanvas); + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxPreviewCanvas); +}; + +//---------------------------------------------------------------------------- +// wxPreviewFrame +//---------------------------------------------------------------------------- + +/* + * Default frame for showing preview. + */ + +class WXDLLIMPEXP_CORE wxPreviewFrame: public wxFrame +{ +public: + wxPreviewFrame(wxPrintPreviewBase *preview, + wxWindow *parent, + const wxString& title = wxGetTranslation(wxASCII_STR("Print Preview")), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxFRAME_FLOAT_ON_PARENT, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + virtual ~wxPreviewFrame(); + + // Either Initialize() or InitializeWithModality() must be called before + // showing the preview frame, the former being just a particular case of + // the latter initializing the frame for being showing app-modally. + + // Notice that we must keep Initialize() with its existing signature to + // avoid breaking the old code that overrides it and we can't reuse the + // same name for the other functions to avoid virtual function hiding + // problem and the associated warnings given by some compilers (e.g. from + // g++ with -Woverloaded-virtual). + virtual void Initialize() + { + InitializeWithModality(wxPreviewFrame_AppModal); + } + + // Also note that this method is not virtual as it doesn't need to be + // overridden: it's never called by wxWidgets (of course, the same is true + // for Initialize() but, again, it must remain virtual for compatibility). + void InitializeWithModality(wxPreviewFrameModalityKind kind); + + void OnCloseWindow(wxCloseEvent& event); + virtual void CreateCanvas(); + virtual void CreateControlBar(); + + inline wxPreviewControlBar* GetControlBar() const { return m_controlBar; } + +protected: + wxPreviewCanvas* m_previewCanvas; + wxPreviewControlBar* m_controlBar; + wxPrintPreviewBase* m_printPreview; + wxWindowDisabler* m_windowDisabler; + + wxPreviewFrameModalityKind m_modalityKind; + + +private: + void OnChar(wxKeyEvent& event); + + const wxSize m_initialSize; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_CLASS(wxPreviewFrame); + wxDECLARE_NO_COPY_CLASS(wxPreviewFrame); +}; + +//---------------------------------------------------------------------------- +// wxPreviewControlBar +//---------------------------------------------------------------------------- + +/* + * A panel with buttons for controlling a print preview. + * The programmer may wish to use other means for controlling + * the print preview. + */ + +#define wxPREVIEW_PRINT 1 +#define wxPREVIEW_PREVIOUS 2 +#define wxPREVIEW_NEXT 4 +#define wxPREVIEW_ZOOM 8 +#define wxPREVIEW_FIRST 16 +#define wxPREVIEW_LAST 32 +#define wxPREVIEW_GOTO 64 + +#define wxPREVIEW_DEFAULT (wxPREVIEW_PREVIOUS|wxPREVIEW_NEXT|wxPREVIEW_ZOOM\ + |wxPREVIEW_FIRST|wxPREVIEW_GOTO|wxPREVIEW_LAST) + +// Ids for controls +#define wxID_PREVIEW_CLOSE 1 +#define wxID_PREVIEW_NEXT 2 +#define wxID_PREVIEW_PREVIOUS 3 +#define wxID_PREVIEW_PRINT 4 +#define wxID_PREVIEW_ZOOM 5 +#define wxID_PREVIEW_FIRST 6 +#define wxID_PREVIEW_LAST 7 +#define wxID_PREVIEW_GOTO 8 +#define wxID_PREVIEW_ZOOM_IN 9 +#define wxID_PREVIEW_ZOOM_OUT 10 + +class WXDLLIMPEXP_CORE wxPreviewControlBar: public wxPanel +{ + wxDECLARE_CLASS(wxPreviewControlBar); + +public: + wxPreviewControlBar(wxPrintPreviewBase *preview, + long buttons, + wxWindow *parent, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTAB_TRAVERSAL, + const wxString& name = wxT("panel")); + virtual ~wxPreviewControlBar(); + + virtual void CreateButtons(); + virtual void SetPageInfo(int minPage, int maxPage); + virtual void SetZoomControl(int zoom); + virtual int GetZoomControl(); + virtual wxPrintPreviewBase *GetPrintPreview() const + { return m_printPreview; } + + + // Implementation only from now on. + void OnWindowClose(wxCommandEvent& event); + void OnNext(); + void OnPrevious(); + void OnFirst(); + void OnLast(); + void OnGotoPage(); + void OnPrint(); + + void OnPrintButton(wxCommandEvent& WXUNUSED(event)) { OnPrint(); } + void OnNextButton(wxCommandEvent & WXUNUSED(event)) { OnNext(); } + void OnPreviousButton(wxCommandEvent & WXUNUSED(event)) { OnPrevious(); } + void OnFirstButton(wxCommandEvent & WXUNUSED(event)) { OnFirst(); } + void OnLastButton(wxCommandEvent & WXUNUSED(event)) { OnLast(); } + void OnPaint(wxPaintEvent& event); + + void OnUpdateNextButton(wxUpdateUIEvent& event) + { event.Enable(IsNextEnabled()); } + void OnUpdatePreviousButton(wxUpdateUIEvent& event) + { event.Enable(IsPreviousEnabled()); } + void OnUpdateFirstButton(wxUpdateUIEvent& event) + { event.Enable(IsFirstEnabled()); } + void OnUpdateLastButton(wxUpdateUIEvent& event) + { event.Enable(IsLastEnabled()); } + void OnUpdateZoomInButton(wxUpdateUIEvent& event) + { event.Enable(IsZoomInEnabled()); } + void OnUpdateZoomOutButton(wxUpdateUIEvent& event) + { event.Enable(IsZoomOutEnabled()); } + + // These methods are not private because they are called by wxPreviewCanvas. + void DoZoomIn(); + void DoZoomOut(); + +protected: + wxPrintPreviewBase* m_printPreview; + wxButton* m_closeButton; + wxChoice* m_zoomControl; + wxPrintPageTextCtrl* m_currentPageText; + wxPrintPageMaxCtrl* m_maxPageText; + + long m_buttonFlags; + +private: + void DoGotoPage(int page); + + void DoZoom(); + + bool IsNextEnabled() const; + bool IsPreviousEnabled() const; + bool IsFirstEnabled() const; + bool IsLastEnabled() const; + bool IsZoomInEnabled() const; + bool IsZoomOutEnabled() const; + + void OnZoomInButton(wxCommandEvent & WXUNUSED(event)) { DoZoomIn(); } + void OnZoomOutButton(wxCommandEvent & WXUNUSED(event)) { DoZoomOut(); } + void OnZoomChoice(wxCommandEvent& WXUNUSED(event)) { DoZoom(); } + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxPreviewControlBar); +}; + +//---------------------------------------------------------------------------- +// wxPrintPreviewBase +//---------------------------------------------------------------------------- + +/* + * Programmer creates an object of this class to preview a wxPrintout. + */ + +class WXDLLIMPEXP_CORE wxPrintPreviewBase: public wxObject +{ +public: + wxPrintPreviewBase(wxPrintout *printout, + wxPrintout *printoutForPrinting = NULL, + wxPrintDialogData *data = NULL); + wxPrintPreviewBase(wxPrintout *printout, + wxPrintout *printoutForPrinting, + wxPrintData *data); + virtual ~wxPrintPreviewBase(); + + virtual bool SetCurrentPage(int pageNum); + virtual int GetCurrentPage() const; + + virtual void SetPrintout(wxPrintout *printout); + virtual wxPrintout *GetPrintout() const; + virtual wxPrintout *GetPrintoutForPrinting() const; + + virtual void SetFrame(wxFrame *frame); + virtual void SetCanvas(wxPreviewCanvas *canvas); + + virtual wxFrame *GetFrame() const; + virtual wxPreviewCanvas *GetCanvas() const; + + // This is a helper routine, used by the next 4 routines. + + virtual void CalcRects(wxPreviewCanvas *canvas, wxRect& printableAreaRect, wxRect& paperRect); + + // The preview canvas should call this from OnPaint + virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc); + + // Updates rendered page by calling RenderPage() if needed, returns true + // if there was some change. Preview canvas should call it at idle time + virtual bool UpdatePageRendering(); + + // This draws a blank page onto the preview canvas + virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc); + + // Adjusts the scrollbars for the current scale + virtual void AdjustScrollbars(wxPreviewCanvas *canvas); + + // This is called by wxPrintPreview to render a page into a wxMemoryDC. + virtual bool RenderPage(int pageNum); + + + virtual void SetZoom(int percent); + virtual int GetZoom() const; + + virtual wxPrintDialogData& GetPrintDialogData(); + + virtual int GetMaxPage() const; + virtual int GetMinPage() const; + + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk() const; + virtual void SetOk(bool ok); + + /////////////////////////////////////////////////////////////////////////// + // OVERRIDES + + // If we own a wxPrintout that can be used for printing, this + // will invoke the actual printing procedure. Called + // by the wxPreviewControlBar. + virtual bool Print(bool interactive) = 0; + + // Calculate scaling that needs to be done to get roughly + // the right scaling for the screen pretending to be + // the currently selected printer. + virtual void DetermineScaling() = 0; + +protected: + // helpers for RenderPage(): + virtual bool RenderPageIntoDC(wxDC& dc, int pageNum); + // renders preview into m_previewBitmap + virtual bool RenderPageIntoBitmap(wxBitmap& bmp, int pageNum); + + void InvalidatePreviewBitmap(); + +protected: + wxPrintDialogData m_printDialogData; + wxPreviewCanvas* m_previewCanvas; + wxFrame* m_previewFrame; + wxBitmap* m_previewBitmap; + bool m_previewFailed; + wxPrintout* m_previewPrintout; + wxPrintout* m_printPrintout; + int m_currentPage; + int m_currentZoom; + float m_previewScaleX; + float m_previewScaleY; + int m_topMargin; + int m_leftMargin; + int m_pageWidth; + int m_pageHeight; + int m_minPage; + int m_maxPage; + + bool m_isOk; + bool m_printingPrepared; // Called OnPreparePrinting? + +private: + void Init(wxPrintout *printout, wxPrintout *printoutForPrinting); + + wxDECLARE_NO_COPY_CLASS(wxPrintPreviewBase); + wxDECLARE_CLASS(wxPrintPreviewBase); +}; + +//---------------------------------------------------------------------------- +// wxPrintPreview +//---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPrintPreview: public wxPrintPreviewBase +{ +public: + wxPrintPreview(wxPrintout *printout, + wxPrintout *printoutForPrinting = NULL, + wxPrintDialogData *data = NULL); + wxPrintPreview(wxPrintout *printout, + wxPrintout *printoutForPrinting, + wxPrintData *data); + virtual ~wxPrintPreview(); + + virtual bool SetCurrentPage(int pageNum) wxOVERRIDE; + virtual int GetCurrentPage() const wxOVERRIDE; + virtual void SetPrintout(wxPrintout *printout) wxOVERRIDE; + virtual wxPrintout *GetPrintout() const wxOVERRIDE; + virtual wxPrintout *GetPrintoutForPrinting() const wxOVERRIDE; + virtual void SetFrame(wxFrame *frame) wxOVERRIDE; + virtual void SetCanvas(wxPreviewCanvas *canvas) wxOVERRIDE; + + virtual wxFrame *GetFrame() const wxOVERRIDE; + virtual wxPreviewCanvas *GetCanvas() const wxOVERRIDE; + virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc) wxOVERRIDE; + virtual bool UpdatePageRendering() wxOVERRIDE; + virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc) wxOVERRIDE; + virtual void AdjustScrollbars(wxPreviewCanvas *canvas) wxOVERRIDE; + virtual bool RenderPage(int pageNum) wxOVERRIDE; + virtual void SetZoom(int percent) wxOVERRIDE; + virtual int GetZoom() const wxOVERRIDE; + + virtual bool Print(bool interactive) wxOVERRIDE; + virtual void DetermineScaling() wxOVERRIDE; + + virtual wxPrintDialogData& GetPrintDialogData() wxOVERRIDE; + + virtual int GetMaxPage() const wxOVERRIDE; + virtual int GetMinPage() const wxOVERRIDE; + + virtual bool Ok() const wxOVERRIDE { return IsOk(); } + virtual bool IsOk() const wxOVERRIDE; + virtual void SetOk(bool ok) wxOVERRIDE; + +private: + wxPrintPreviewBase *m_pimpl; + +private: + wxDECLARE_CLASS(wxPrintPreview); + wxDECLARE_NO_COPY_CLASS(wxPrintPreview); +}; + +//---------------------------------------------------------------------------- +// wxPrintAbortDialog +//---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPrintAbortDialog: public wxDialog +{ +public: + wxPrintAbortDialog(wxWindow *parent, + const wxString& documentTitle, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxT("dialog")); + + void SetProgress(int currentPage, int totalPages, + int currentCopy, int totalCopies); + + void OnCancel(wxCommandEvent& event); + +private: + wxStaticText *m_progress; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxPrintAbortDialog); +}; + +#endif // wxUSE_PRINTING_ARCHITECTURE + +#endif + // _WX_PRNTBASEH__ diff --git a/lib/wxWidgets/include/wx/process.h b/lib/wxWidgets/include/wx/process.h new file mode 100644 index 0000000..21a1ccc --- /dev/null +++ b/lib/wxWidgets/include/wx/process.h @@ -0,0 +1,193 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/process.h +// Purpose: wxProcess class +// Author: Guilhem Lavaux +// Modified by: Vadim Zeitlin to check error codes, added Detach() method +// Created: 24/06/98 +// Copyright: (c) 1998 Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PROCESSH__ +#define _WX_PROCESSH__ + +#include "wx/event.h" + +#if wxUSE_STREAMS + #include "wx/stream.h" +#endif + +#include "wx/utils.h" // for wxSignal + +// the wxProcess creation flags +enum +{ + // no redirection + wxPROCESS_DEFAULT = 0, + + // redirect the IO of the child process + wxPROCESS_REDIRECT = 1 +}; + +// ---------------------------------------------------------------------------- +// A wxProcess object should be passed to wxExecute - than its OnTerminate() +// function will be called when the process terminates. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxProcess : public wxEvtHandler +{ +public: + // kill the process with the given PID + static wxKillError Kill(int pid, wxSignal sig = wxSIGTERM, int flags = wxKILL_NOCHILDREN); + + // test if the given process exists + static bool Exists(int pid); + + // this function replaces the standard popen() one: it launches a process + // asynchronously and allows the caller to get the streams connected to its + // std{in|out|err} + // + // on error NULL is returned, in any case the process object will be + // deleted automatically when the process terminates and should *not* be + // deleted by the caller + static wxProcess *Open(const wxString& cmd, int flags = wxEXEC_ASYNC); + + + // ctors + wxProcess(wxEvtHandler *parent = NULL, int nId = wxID_ANY) + { Init(parent, nId, wxPROCESS_DEFAULT); } + + wxProcess(int flags) { Init(NULL, wxID_ANY, flags); } + + virtual ~wxProcess(); + + // get the process ID of the process executed by Open() + long GetPid() const { return m_pid; } + + // may be overridden to be notified about process termination + virtual void OnTerminate(int pid, int status); + + // call this before passing the object to wxExecute() to redirect the + // launched process stdin/stdout, then use GetInputStream() and + // GetOutputStream() to get access to them + void Redirect() { m_redirect = true; } + bool IsRedirected() const { return m_redirect; } + + // detach from the parent - should be called by the parent if it's deleted + // before the process it started terminates + void Detach(); + + // Activates a GUI process by bringing its (main) window to the front. + // + // Currently only implemented in wxMSW, simply returns false under the + // other platforms. + bool Activate() const; + +#if wxUSE_STREAMS + // Pipe handling + wxInputStream *GetInputStream() const { return m_inputStream; } + wxInputStream *GetErrorStream() const { return m_errorStream; } + wxOutputStream *GetOutputStream() const { return m_outputStream; } + + // close the output stream indicating that nothing more will be written + void CloseOutput() { delete m_outputStream; m_outputStream = NULL; } + + // return true if the child process stdout is not closed + bool IsInputOpened() const; + + // return true if any input is available on the child process stdout/err + bool IsInputAvailable() const; + bool IsErrorAvailable() const; + + // implementation only (for wxExecute) + // + // NB: the streams passed here should correspond to the child process + // stdout, stdin and stderr and here the normal naming convention is + // used unlike elsewhere in this class + void SetPipeStreams(wxInputStream *outStream, + wxOutputStream *inStream, + wxInputStream *errStream); +#endif // wxUSE_STREAMS + + // priority + // Sets the priority to the given value: see wxPRIORITY_XXX constants. + // + // NB: the priority can only be set before the process is created + void SetPriority(unsigned priority); + + // Get the current priority. + unsigned GetPriority() const { return m_priority; } + + // implementation only - don't use! + // -------------------------------- + + // needs to be public since it needs to be used from wxExecute() global func + void SetPid(long pid) { m_pid = pid; } + +protected: + void Init(wxEvtHandler *parent, int id, int flags); + + int m_id; + long m_pid; + + unsigned m_priority; + +#if wxUSE_STREAMS + // these streams are connected to stdout, stderr and stdin of the child + // process respectively (yes, m_inputStream corresponds to stdout -- very + // confusing but too late to change now) + wxInputStream *m_inputStream, + *m_errorStream; + wxOutputStream *m_outputStream; +#endif // wxUSE_STREAMS + + bool m_redirect; + + wxDECLARE_DYNAMIC_CLASS(wxProcess); + wxDECLARE_NO_COPY_CLASS(wxProcess); +}; + +// ---------------------------------------------------------------------------- +// wxProcess events +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_BASE wxProcessEvent; + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_BASE, wxEVT_END_PROCESS, wxProcessEvent ); + +class WXDLLIMPEXP_BASE wxProcessEvent : public wxEvent +{ +public: + wxProcessEvent(int nId = 0, int pid = 0, int exitcode = 0) : wxEvent(nId) + { + m_eventType = wxEVT_END_PROCESS; + m_pid = pid; + m_exitcode = exitcode; + } + + // accessors + // PID of process which terminated + int GetPid() const { return m_pid; } + + // the exit code + int GetExitCode() const { return m_exitcode; } + + // implement the base class pure virtual + virtual wxEvent *Clone() const wxOVERRIDE { return new wxProcessEvent(*this); } + +public: + int m_pid, + m_exitcode; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxProcessEvent); +}; + +typedef void (wxEvtHandler::*wxProcessEventFunction)(wxProcessEvent&); + +#define wxProcessEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxProcessEventFunction, func) + +#define EVT_END_PROCESS(id, func) \ + wx__DECLARE_EVT1(wxEVT_END_PROCESS, id, wxProcessEventHandler(func)) + +#endif // _WX_PROCESSH__ diff --git a/lib/wxWidgets/include/wx/progdlg.h b/lib/wxWidgets/include/wx/progdlg.h new file mode 100644 index 0000000..087c75a --- /dev/null +++ b/lib/wxWidgets/include/wx/progdlg.h @@ -0,0 +1,63 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/progdlg.h +// Purpose: Base header for wxProgressDialog +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PROGDLG_H_BASE_ +#define _WX_PROGDLG_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_PROGRESSDLG + +/* + * wxProgressDialog flags + */ +#define wxPD_CAN_ABORT 0x0001 +#define wxPD_APP_MODAL 0x0002 +#define wxPD_AUTO_HIDE 0x0004 +#define wxPD_ELAPSED_TIME 0x0008 +#define wxPD_ESTIMATED_TIME 0x0010 +#define wxPD_SMOOTH 0x0020 +#define wxPD_REMAINING_TIME 0x0040 +#define wxPD_CAN_SKIP 0x0080 + + +#include "wx/generic/progdlgg.h" + +#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) + // The native implementation requires the use of threads and still has some + // problems, so it can be explicitly disabled. + #if wxUSE_THREADS && wxUSE_NATIVE_PROGRESSDLG + #define wxHAS_NATIVE_PROGRESSDIALOG + #include "wx/msw/progdlg.h" + #endif +#endif + +// If there is no native one, just use the generic version. +#ifndef wxHAS_NATIVE_PROGRESSDIALOG + class WXDLLIMPEXP_CORE wxProgressDialog + : public wxGenericProgressDialog + { + public: + wxProgressDialog( const wxString& title, const wxString& message, + int maximum = 100, + wxWindow *parent = NULL, + int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE ) + : wxGenericProgressDialog( title, message, maximum, + parent, style ) + { } + + private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY( wxProgressDialog ); + }; +#endif // !wxHAS_NATIVE_PROGRESSDIALOG + +#endif // wxUSE_PROGRESSDLG + +#endif // _WX_PROGDLG_H_BASE_ diff --git a/lib/wxWidgets/include/wx/propdlg.h b/lib/wxWidgets/include/wx/propdlg.h new file mode 100644 index 0000000..1f91c6f --- /dev/null +++ b/lib/wxWidgets/include/wx/propdlg.h @@ -0,0 +1,18 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/propdlg.h +// Purpose: wxPropertySheetDialog base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PROPDLG_H_BASE_ +#define _WX_PROPDLG_H_BASE_ + +#include "wx/generic/propdlg.h" + +#endif + // _WX_PROPDLG_H_BASE_ + diff --git a/lib/wxWidgets/include/wx/propgrid/advprops.h b/lib/wxWidgets/include/wx/propgrid/advprops.h new file mode 100644 index 0000000..bbfa363 --- /dev/null +++ b/lib/wxWidgets/include/wx/propgrid/advprops.h @@ -0,0 +1,480 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/propgrid/advprops.h +// Purpose: wxPropertyGrid Advanced Properties (font, colour, etc.) +// Author: Jaakko Salli +// Modified by: +// Created: 2004-09-25 +// Copyright: (c) Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PROPGRID_ADVPROPS_H_ +#define _WX_PROPGRID_ADVPROPS_H_ + +#include "wx/defs.h" + +#if wxUSE_PROPGRID + +#include "wx/propgrid/props.h" + +// ----------------------------------------------------------------------- + +// +// Additional Value Type Handlers +// +bool WXDLLIMPEXP_PROPGRID +operator==(const wxArrayInt& array1, const wxArrayInt& array2); + +// +// Additional Property Editors +// +#if wxUSE_SPINBTN +WX_PG_DECLARE_EDITOR_WITH_DECL(SpinCtrl,WXDLLIMPEXP_PROPGRID) +#endif + +#if wxUSE_DATEPICKCTRL +WX_PG_DECLARE_EDITOR_WITH_DECL(DatePickerCtrl,WXDLLIMPEXP_PROPGRID) +#endif + +// ----------------------------------------------------------------------- + + +// Web colour is currently unsupported +#define wxPG_COLOUR_WEB_BASE 0x10000 +//#define wxPG_TO_WEB_COLOUR(A) ((wxUint32)(A+wxPG_COLOUR_WEB_BASE)) + + +#define wxPG_COLOUR_CUSTOM 0xFFFFFF +#define wxPG_COLOUR_UNSPECIFIED (wxPG_COLOUR_CUSTOM+1) + +// Because text, background and other colours tend to differ between +// platforms, wxSystemColourProperty must be able to select between system +// colour and, when necessary, to pick a custom one. wxSystemColourProperty +// value makes this possible. +class WXDLLIMPEXP_PROPGRID wxColourPropertyValue : public wxObject +{ +public: + // An integer value relating to the colour, and which exact + // meaning depends on the property with which it is used. + // For wxSystemColourProperty: + // Any of wxSYS_COLOUR_XXX, or any web-colour ( use wxPG_TO_WEB_COLOUR + // macro - (currently unsupported) ), or wxPG_COLOUR_CUSTOM. + // + // For custom colour properties without values array specified: + // index or wxPG_COLOUR_CUSTOM + // For custom colour properties with values array specified: + // m_arrValues[index] or wxPG_COLOUR_CUSTOM + wxUint32 m_type; + + // Resulting colour. Should be correct regardless of type. + wxColour m_colour; + + wxColourPropertyValue() + : wxObject() + , m_type(0) + { + } + + virtual ~wxColourPropertyValue() + { + } + + wxColourPropertyValue( const wxColourPropertyValue& v ) + : wxObject() + , m_type(v.m_type) + , m_colour(v.m_colour) + { + } + + void Init( wxUint32 type, const wxColour& colour ) + { + m_type = type; + m_colour = colour; + } + + wxColourPropertyValue( const wxColour& colour ) + : wxObject() + , m_type(wxPG_COLOUR_CUSTOM) + , m_colour(colour) + { + } + + wxColourPropertyValue( wxUint32 type ) + : wxObject() + , m_type(type) + { + } + + wxColourPropertyValue( wxUint32 type, const wxColour& colour ) + : wxObject() + { + Init( type, colour ); + } + + void operator=(const wxColourPropertyValue& cpv) + { + if (this != &cpv) + Init( cpv.m_type, cpv.m_colour ); + } + +private: + wxDECLARE_DYNAMIC_CLASS(wxColourPropertyValue); +}; + + +bool WXDLLIMPEXP_PROPGRID +operator==(const wxColourPropertyValue&, const wxColourPropertyValue&); + +DECLARE_VARIANT_OBJECT_EXPORTED(wxColourPropertyValue, WXDLLIMPEXP_PROPGRID) + +// ----------------------------------------------------------------------- + +// Property representing wxFont. +class WXDLLIMPEXP_PROPGRID wxFontProperty : public wxEditorDialogProperty +{ + WX_PG_DECLARE_PROPERTY_CLASS(wxFontProperty) +public: + + wxFontProperty(const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxFont& value = wxFont()); + virtual ~wxFontProperty(); + virtual void OnSetValue() wxOVERRIDE; + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const wxOVERRIDE; + virtual wxVariant ChildChanged( wxVariant& thisValue, + int childIndex, + wxVariant& childValue ) const wxOVERRIDE; + virtual void RefreshChildren() wxOVERRIDE; + +protected: + virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value) wxOVERRIDE; +}; + +// ----------------------------------------------------------------------- + + +// If set, then match from list is searched for a custom colour. +#define wxPG_PROP_TRANSLATE_CUSTOM wxPG_PROP_CLASS_SPECIFIC_1 + + +// Has dropdown list of wxWidgets system colours. Value used is +// of wxColourPropertyValue type. +class WXDLLIMPEXP_PROPGRID wxSystemColourProperty : public wxEnumProperty +{ + WX_PG_DECLARE_PROPERTY_CLASS(wxSystemColourProperty) +public: + + wxSystemColourProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxColourPropertyValue& + value = wxColourPropertyValue() ); + virtual ~wxSystemColourProperty(); + + virtual void OnSetValue() wxOVERRIDE; + virtual bool IntToValue(wxVariant& variant, + int number, + int argFlags = 0) const wxOVERRIDE; + + // Override in derived class to customize how colours are printed as + // strings. + virtual wxString ColourToString( const wxColour& col, int index, + int argFlags = 0 ) const; + + // Returns index of entry that triggers colour picker dialog + // (default is last). + virtual int GetCustomColourIndex() const; + + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const wxOVERRIDE; + virtual bool StringToValue( wxVariant& variant, + const wxString& text, + int argFlags = 0 ) const wxOVERRIDE; + virtual bool OnEvent( wxPropertyGrid* propgrid, + wxWindow* primary, wxEvent& event ) wxOVERRIDE; + virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) wxOVERRIDE; + virtual wxSize OnMeasureImage( int item ) const wxOVERRIDE; + virtual void OnCustomPaint( wxDC& dc, + const wxRect& rect, wxPGPaintData& paintdata ) wxOVERRIDE; + + // Helper function to show the colour dialog + bool QueryColourFromUser( wxVariant& variant ) const; + + // Default is to use wxSystemSettings::GetColour(index). Override to use + // custom colour tables etc. + virtual wxColour GetColour( int index ) const; + + wxColourPropertyValue GetVal( const wxVariant* pVariant = NULL ) const; + +protected: + + // Special constructors to be used by derived classes. + wxSystemColourProperty( const wxString& label, const wxString& name, + const char* const* labels, const long* values, wxPGChoices* choicesCache, + const wxColourPropertyValue& value ); + wxSystemColourProperty( const wxString& label, const wxString& name, + const char* const* labels, const long* values, wxPGChoices* choicesCache, + const wxColour& value ); + + void Init( int type, const wxColour& colour ); + + // Utility functions for internal use + virtual wxVariant DoTranslateVal( wxColourPropertyValue& v ) const; + wxVariant TranslateVal( wxColourPropertyValue& v ) const + { + return DoTranslateVal( v ); + } + wxVariant TranslateVal( int type, const wxColour& colour ) const + { + wxColourPropertyValue v(type, colour); + return DoTranslateVal( v ); + } + + // Translates colour to a int value, return wxNOT_FOUND if no match. + int ColToInd( const wxColour& colour ) const; +}; + +// ----------------------------------------------------------------------- + +class WXDLLIMPEXP_PROPGRID wxColourProperty : public wxSystemColourProperty +{ + WX_PG_DECLARE_PROPERTY_CLASS(wxColourProperty) +public: + wxColourProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxColour& value = *wxWHITE ); + virtual ~wxColourProperty(); + + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const wxOVERRIDE; + virtual wxColour GetColour( int index ) const wxOVERRIDE; + +protected: + virtual wxVariant DoTranslateVal( wxColourPropertyValue& v ) const wxOVERRIDE; + +private: + void Init( wxColour colour ); +}; + +// ----------------------------------------------------------------------- + +// Property representing wxCursor. +class WXDLLIMPEXP_PROPGRID wxCursorProperty : public wxEnumProperty +{ + wxDECLARE_DYNAMIC_CLASS(wxCursorProperty); + + wxCursorProperty( const wxString& label= wxPG_LABEL, + const wxString& name= wxPG_LABEL, + int value = 0 ); + virtual ~wxCursorProperty(); + + virtual wxString ValueToString(wxVariant& value, int argFlags = 0) const wxOVERRIDE; + virtual wxSize OnMeasureImage( int item ) const wxOVERRIDE; + virtual void OnCustomPaint( wxDC& dc, + const wxRect& rect, wxPGPaintData& paintdata ) wxOVERRIDE; +}; + +// ----------------------------------------------------------------------- + +#if wxUSE_IMAGE + +WXDLLIMPEXP_PROPGRID const wxString& wxPGGetDefaultImageWildcard(); +class WXDLLIMPEXP_FWD_CORE wxBitmap; +class WXDLLIMPEXP_FWD_CORE wxImage; + +// Property representing image file(name). +class WXDLLIMPEXP_PROPGRID wxImageFileProperty : public wxFileProperty +{ + wxDECLARE_DYNAMIC_CLASS(wxImageFileProperty); +public: + + wxImageFileProperty( const wxString& label= wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxString& value = wxEmptyString); + virtual ~wxImageFileProperty(); + + virtual void OnSetValue() wxOVERRIDE; + + virtual wxSize OnMeasureImage( int item ) const wxOVERRIDE; + virtual void OnCustomPaint( wxDC& dc, + const wxRect& rect, wxPGPaintData& paintdata ) wxOVERRIDE; + +protected: + void SetImage(const wxImage& img); + wxImage m_image; // original thumbnail area + +private: + // Initialize m_image using the current file name. + void LoadImageFromFile(); + + wxBitmap m_bitmap; // final thumbnail area +}; + +#endif + +#if wxUSE_CHOICEDLG + +// Property that manages a value resulting from wxMultiChoiceDialog. Value is +// array of strings. You can get value as array of choice values/indices by +// calling wxMultiChoiceProperty::GetValueAsArrayInt(). +class WXDLLIMPEXP_PROPGRID wxMultiChoiceProperty : public wxEditorDialogProperty +{ + WX_PG_DECLARE_PROPERTY_CLASS(wxMultiChoiceProperty) +public: + + wxMultiChoiceProperty( const wxString& label, + const wxString& name, + const wxArrayString& strings, + const wxArrayString& value ); + wxMultiChoiceProperty( const wxString& label, + const wxString& name, + const wxPGChoices& choices, + const wxArrayString& value = wxArrayString() ); + + wxMultiChoiceProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxArrayString& value = wxArrayString() ); + + virtual ~wxMultiChoiceProperty(); + + virtual void OnSetValue() wxOVERRIDE; + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const wxOVERRIDE; + virtual bool StringToValue(wxVariant& variant, + const wxString& text, + int argFlags = 0) const wxOVERRIDE; + virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) wxOVERRIDE; + + wxArrayInt GetValueAsArrayInt() const + { + return m_choices.GetValuesForStrings(m_value.GetArrayString()); + } + +protected: + virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value) wxOVERRIDE; + +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_MSG("use function GenerateValueAsString(val) returning wxString") + void GenerateValueAsString( wxVariant& value, wxString* target ) const + { + *target = GenerateValueAsString(value); + } +#endif // WXWIN_COMPATIBILITY_3_0 + wxString GenerateValueAsString(const wxVariant& value) const; + + // Returns translation of values into string indices. + wxArrayInt GetValueAsIndices() const; + + // Cache displayed text since generating it is relatively complicated. + wxString m_display; + // How to handle user strings + int m_userStringMode; +}; + +#endif // wxUSE_CHOICEDLG + +// ----------------------------------------------------------------------- + +#if wxUSE_DATETIME + +// Property representing wxDateTime. +class WXDLLIMPEXP_PROPGRID wxDateProperty : public wxPGProperty +{ + WX_PG_DECLARE_PROPERTY_CLASS(wxDateProperty) +public: + + wxDateProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxDateTime& value = wxDateTime() ); + virtual ~wxDateProperty(); + + virtual void OnSetValue() wxOVERRIDE; + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const wxOVERRIDE; + virtual bool StringToValue(wxVariant& variant, + const wxString& text, + int argFlags = 0) const wxOVERRIDE; + + virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) wxOVERRIDE; + + void SetFormat( const wxString& format ) + { + m_format = format; + } + + const wxString& GetFormat() const + { + return m_format; + } + + void SetDateValue( const wxDateTime& dt ) + { + //m_valueDateTime = dt; + m_value = dt; + } + + wxDateTime GetDateValue() const + { + //return m_valueDateTime; + return m_value; + } + + long GetDatePickerStyle() const + { + return m_dpStyle; + } + +protected: + wxString m_format; + long m_dpStyle; // DatePicker style + + static wxString ms_defaultDateFormat; + static wxString DetermineDefaultDateFormat( bool showCentury ); +}; + +#endif // wxUSE_DATETIME + +// ----------------------------------------------------------------------- + +#if wxUSE_SPINBTN + +// +// Implement an editor control that allows using wxSpinCtrl (actually, a +// combination of wxTextCtrl and wxSpinButton) to edit value of wxIntProperty +// and wxFloatProperty (and similar). +// +// Note that new editor classes needs to be registered before use. This can be +// accomplished using wxPGRegisterEditorClass macro, which is used for SpinCtrl +// in wxPropertyGridInterface::RegisterAdditionalEditors (see below). +// Registration can also be performed in a constructor of a property that is +// likely to require the editor in question. +// + + +#include "wx/spinbutt.h" +#include "wx/propgrid/editors.h" + + +// NOTE: Regardless that this class inherits from a working editor, it has +// all necessary methods to work independently. wxTextCtrl stuff is only +// used for event handling here. +class WXDLLIMPEXP_PROPGRID wxPGSpinCtrlEditor : public wxPGTextCtrlEditor +{ + wxDECLARE_DYNAMIC_CLASS(wxPGSpinCtrlEditor); +public: + virtual ~wxPGSpinCtrlEditor(); + + wxString GetName() const wxOVERRIDE; + virtual wxPGWindowList CreateControls(wxPropertyGrid* propgrid, + wxPGProperty* property, + const wxPoint& pos, + const wxSize& size) const wxOVERRIDE; + virtual bool OnEvent( wxPropertyGrid* propgrid, wxPGProperty* property, + wxWindow* wnd, wxEvent& event ) const wxOVERRIDE; + +private: + mutable wxString m_tempString; +}; + +#endif // wxUSE_SPINBTN + +// ----------------------------------------------------------------------- + +#endif // wxUSE_PROPGRID + +#endif // _WX_PROPGRID_ADVPROPS_H_ diff --git a/lib/wxWidgets/include/wx/propgrid/editors.h b/lib/wxWidgets/include/wx/propgrid/editors.h new file mode 100644 index 0000000..88ee6c9 --- /dev/null +++ b/lib/wxWidgets/include/wx/propgrid/editors.h @@ -0,0 +1,500 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/propgrid/editors.h +// Purpose: wxPropertyGrid editors +// Author: Jaakko Salli +// Modified by: +// Created: 2007-04-14 +// Copyright: (c) Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PROPGRID_EDITORS_H_ +#define _WX_PROPGRID_EDITORS_H_ + +#include "wx/defs.h" + +#if wxUSE_PROPGRID + +#include "wx/window.h" + +class WXDLLIMPEXP_FWD_CORE wxBitmapBundle; +class WXDLLIMPEXP_FWD_PROPGRID wxPGCell; +class WXDLLIMPEXP_FWD_PROPGRID wxPGProperty; +class WXDLLIMPEXP_FWD_PROPGRID wxPropertyGrid; + +// ----------------------------------------------------------------------- +// wxPGWindowList contains list of editor windows returned by CreateControls. + +class wxPGWindowList +{ +public: + wxPGWindowList(wxWindow* primary, wxWindow* secondary = NULL) + : m_primary(primary) + , m_secondary(secondary) + { + } + + void SetSecondary(wxWindow* secondary) { m_secondary = secondary; } + + wxWindow* GetPrimary() const { return m_primary; } + wxWindow* GetSecondary() const { return m_secondary; } + + wxWindow* m_primary; + wxWindow* m_secondary; +}; + +// ----------------------------------------------------------------------- + +// Base class for custom wxPropertyGrid editors. +// - Names of builtin property editors are: TextCtrl, Choice, +// ComboBox, CheckBox, TextCtrlAndButton, and ChoiceAndButton. Additional +// editors include SpinCtrl and DatePickerCtrl, but using them requires +// calling wxPropertyGrid::RegisterAdditionalEditors() prior use. +// - Pointer to builtin editor is available as wxPGEditor_EditorName +// (e.g. wxPGEditor_TextCtrl). +// - To add new editor you need to register it first using static function +// wxPropertyGrid::RegisterEditorClass(), with code like this: +// wxPGEditor *editorPointer = wxPropertyGrid::RegisterEditorClass( +// new MyEditorClass(), "MyEditor"); +// After that, wxPropertyGrid will take ownership of the given object, but +// you should still store editorPointer somewhere, so you can pass it to +// wxPGProperty::SetEditor(), or return it from +// wxPGEditor::DoGetEditorClass(). +class WXDLLIMPEXP_PROPGRID wxPGEditor : public wxObject +{ + wxDECLARE_ABSTRACT_CLASS(wxPGEditor); +public: + + // Constructor. + wxPGEditor() + : wxObject() + , m_clientData(NULL) + { + } + + // Destructor. + virtual ~wxPGEditor(); + + // Returns pointer to the name of the editor. For example, + // wxPGEditor_TextCtrl has name "TextCtrl". If you don't need to access + // your custom editor by string name, then you do not need to implement + // this function. + virtual wxString GetName() const; + + // Instantiates editor controls. + // propgrid- wxPropertyGrid to which the property belongs + // (use as parent for control). + // property - Property for which this method is called. + // pos - Position, inside wxPropertyGrid, to create control(s) to. + // size - Initial size for control(s). + // Unlike in previous version of wxPropertyGrid, it is no longer + // necessary to call wxEvtHandler::Connect() for interesting editor + // events. Instead, all events from control are now automatically + // forwarded to wxPGEditor::OnEvent() and wxPGProperty::OnEvent(). + virtual wxPGWindowList CreateControls(wxPropertyGrid* propgrid, + wxPGProperty* property, + const wxPoint& pos, + const wxSize& size) const = 0; + + // Loads value from property to the control. + virtual void UpdateControl( wxPGProperty* property, + wxWindow* ctrl ) const = 0; + + // Used to get the renderer to draw the value with when the control is + // hidden. + // Default implementation returns g_wxPGDefaultRenderer. + //virtual wxPGCellRenderer* GetCellRenderer() const; + + // Draws value for given property. + virtual void DrawValue( wxDC& dc, + const wxRect& rect, + wxPGProperty* property, + const wxString& text ) const; + + // Handles events. Returns true if value in control was modified + // (see wxPGProperty::OnEvent for more information). + // wxPropertyGrid will automatically unfocus the editor when + // wxEVT_TEXT_ENTER is received and when it results in + // property value being modified. This happens regardless of + // editor type (i.e. behaviour is same for any wxTextCtrl and + // wxComboBox based editor). + virtual bool OnEvent( wxPropertyGrid* propgrid, wxPGProperty* property, + wxWindow* wnd_primary, wxEvent& event ) const = 0; + + // Returns value from control, via parameter 'variant'. + // Usually ends up calling property's StringToValue or IntToValue. + // Returns true if value was different. + virtual bool GetValueFromControl( wxVariant& variant, + wxPGProperty* property, + wxWindow* ctrl ) const; + + // Sets new appearance for the control. Default implementation + // sets foreground colour, background colour, font, plus text + // for wxTextCtrl and wxComboCtrl. + // appearance - New appearance to be applied. + // oldAppearance - Previously applied appearance. Used to detect + // which control attributes need to be changed (e.g. so we only + // change background colour if really needed). + // unspecified - true if the new appearance represents an unspecified + // property value. + virtual void SetControlAppearance( wxPropertyGrid* pg, + wxPGProperty* property, + wxWindow* ctrl, + const wxPGCell& appearance, + const wxPGCell& oldAppearance, + bool unspecified ) const; + + // Sets value in control to unspecified. + virtual void SetValueToUnspecified( wxPGProperty* property, + wxWindow* ctrl ) const; + + // Sets control's value specifically from string. + virtual void SetControlStringValue( wxPGProperty* property, + wxWindow* ctrl, + const wxString& txt ) const; + + // Sets control's value specifically from int (applies to choice etc.). + virtual void SetControlIntValue( wxPGProperty* property, + wxWindow* ctrl, + int value ) const; + + // Inserts item to existing control. Index -1 means appending. + // Default implementation does nothing. Returns index of item added. + virtual int InsertItem( wxWindow* ctrl, + const wxString& label, + int index ) const; + + // Deletes item from existing control. + // Default implementation does nothing. + virtual void DeleteItem( wxWindow* ctrl, int index ) const; + + // Sets items of existing control. + // Default implementation does nothing. + virtual void SetItems(wxWindow* ctrl, const wxArrayString& labels) const; + + // Extra processing when control gains focus. For example, wxTextCtrl + // based controls should select all text. + virtual void OnFocus( wxPGProperty* property, wxWindow* wnd ) const; + + // Returns true if control itself can contain the custom image. Default is + // to return false. + virtual bool CanContainCustomImage() const; + + // + // This member is public so scripting language bindings + // wrapper code can access it freely. + void* m_clientData; +}; + + +#define WX_PG_IMPLEMENT_INTERNAL_EDITOR_CLASS(EDITOR,CLASSNAME,BASECLASS) \ +wxIMPLEMENT_DYNAMIC_CLASS(CLASSNAME, BASECLASS); \ +wxString CLASSNAME::GetName() const \ +{ \ + return wxS(#EDITOR); \ +} \ +wxPGEditor* wxPGEditor_##EDITOR = NULL; + + +// +// Following are the built-in editor classes. +// + +class WXDLLIMPEXP_PROPGRID wxPGTextCtrlEditor : public wxPGEditor +{ + wxDECLARE_DYNAMIC_CLASS(wxPGTextCtrlEditor); +public: + wxPGTextCtrlEditor() {} + virtual ~wxPGTextCtrlEditor(); + + virtual wxPGWindowList CreateControls(wxPropertyGrid* propgrid, + wxPGProperty* property, + const wxPoint& pos, + const wxSize& size) const wxOVERRIDE; + virtual void UpdateControl( wxPGProperty* property, + wxWindow* ctrl ) const wxOVERRIDE; + virtual bool OnEvent( wxPropertyGrid* propgrid, + wxPGProperty* property, + wxWindow* primaryCtrl, + wxEvent& event ) const wxOVERRIDE; + virtual bool GetValueFromControl( wxVariant& variant, + wxPGProperty* property, + wxWindow* ctrl ) const wxOVERRIDE; + + virtual wxString GetName() const wxOVERRIDE; + + //virtual wxPGCellRenderer* GetCellRenderer() const; + virtual void SetControlStringValue( wxPGProperty* property, + wxWindow* ctrl, + const wxString& txt ) const wxOVERRIDE; + virtual void OnFocus( wxPGProperty* property, wxWindow* wnd ) const wxOVERRIDE; + + // Provided so that, for example, ComboBox editor can use the same code + // (multiple inheritance would get way too messy). + static bool OnTextCtrlEvent( wxPropertyGrid* propgrid, + wxPGProperty* property, + wxWindow* ctrl, + wxEvent& event ); + + static bool GetTextCtrlValueFromControl( wxVariant& variant, + wxPGProperty* property, + wxWindow* ctrl ); + +}; + + +class WXDLLIMPEXP_PROPGRID wxPGChoiceEditor : public wxPGEditor +{ + wxDECLARE_DYNAMIC_CLASS(wxPGChoiceEditor); +public: + wxPGChoiceEditor() {} + virtual ~wxPGChoiceEditor(); + + virtual wxPGWindowList CreateControls(wxPropertyGrid* propgrid, + wxPGProperty* property, + const wxPoint& pos, + const wxSize& size) const wxOVERRIDE; + virtual void UpdateControl( wxPGProperty* property, + wxWindow* ctrl ) const wxOVERRIDE; + virtual bool OnEvent( wxPropertyGrid* propgrid, + wxPGProperty* property, + wxWindow* primaryCtrl, + wxEvent& event ) const wxOVERRIDE; + virtual bool GetValueFromControl( wxVariant& variant, + wxPGProperty* property, + wxWindow* ctrl ) const wxOVERRIDE; + virtual void SetValueToUnspecified( wxPGProperty* property, + wxWindow* ctrl ) const wxOVERRIDE; + virtual wxString GetName() const wxOVERRIDE; + + virtual void SetControlIntValue( wxPGProperty* property, + wxWindow* ctrl, + int value ) const wxOVERRIDE; + virtual void SetControlStringValue( wxPGProperty* property, + wxWindow* ctrl, + const wxString& txt ) const wxOVERRIDE; + + virtual int InsertItem( wxWindow* ctrl, + const wxString& label, + int index ) const wxOVERRIDE; + virtual void DeleteItem( wxWindow* ctrl, int index ) const wxOVERRIDE; + virtual void SetItems(wxWindow* ctrl, const wxArrayString& labels) const wxOVERRIDE; + + virtual bool CanContainCustomImage() const wxOVERRIDE; + + // CreateControls calls this with CB_READONLY in extraStyle + wxWindow* CreateControlsBase( wxPropertyGrid* propgrid, + wxPGProperty* property, + const wxPoint& pos, + const wxSize& sz, + long extraStyle ) const; + +}; + + +class WXDLLIMPEXP_PROPGRID wxPGComboBoxEditor : public wxPGChoiceEditor +{ + wxDECLARE_DYNAMIC_CLASS(wxPGComboBoxEditor); +public: + wxPGComboBoxEditor() {} + virtual ~wxPGComboBoxEditor(); + + virtual wxPGWindowList CreateControls(wxPropertyGrid* propgrid, + wxPGProperty* property, + const wxPoint& pos, + const wxSize& size) const wxOVERRIDE; + + virtual wxString GetName() const wxOVERRIDE; + + virtual void UpdateControl( wxPGProperty* property, wxWindow* ctrl ) const wxOVERRIDE; + + virtual bool OnEvent( wxPropertyGrid* propgrid, wxPGProperty* property, + wxWindow* ctrl, wxEvent& event ) const wxOVERRIDE; + + virtual bool GetValueFromControl( wxVariant& variant, + wxPGProperty* property, + wxWindow* ctrl ) const wxOVERRIDE; + + virtual void OnFocus( wxPGProperty* property, wxWindow* wnd ) const wxOVERRIDE; + +}; + + +class WXDLLIMPEXP_PROPGRID wxPGChoiceAndButtonEditor : public wxPGChoiceEditor +{ +public: + wxPGChoiceAndButtonEditor() {} + virtual ~wxPGChoiceAndButtonEditor(); + virtual wxString GetName() const wxOVERRIDE; + + virtual wxPGWindowList CreateControls(wxPropertyGrid* propgrid, + wxPGProperty* property, + const wxPoint& pos, + const wxSize& size) const wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxPGChoiceAndButtonEditor); +}; + +class WXDLLIMPEXP_PROPGRID +wxPGTextCtrlAndButtonEditor : public wxPGTextCtrlEditor +{ +public: + wxPGTextCtrlAndButtonEditor() {} + virtual ~wxPGTextCtrlAndButtonEditor(); + virtual wxString GetName() const wxOVERRIDE; + + virtual wxPGWindowList CreateControls(wxPropertyGrid* propgrid, + wxPGProperty* property, + const wxPoint& pos, + const wxSize& size) const wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxPGTextCtrlAndButtonEditor); +}; + + +#if wxPG_INCLUDE_CHECKBOX + +// +// Use custom check box code instead of native control +// for cleaner (i.e. more integrated) look. +// +class WXDLLIMPEXP_PROPGRID wxPGCheckBoxEditor : public wxPGEditor +{ + wxDECLARE_DYNAMIC_CLASS(wxPGCheckBoxEditor); +public: + wxPGCheckBoxEditor() {} + virtual ~wxPGCheckBoxEditor(); + + virtual wxString GetName() const wxOVERRIDE; + virtual wxPGWindowList CreateControls(wxPropertyGrid* propgrid, + wxPGProperty* property, + const wxPoint& pos, + const wxSize& size) const wxOVERRIDE; + virtual void UpdateControl( wxPGProperty* property, + wxWindow* ctrl ) const wxOVERRIDE; + virtual bool OnEvent( wxPropertyGrid* propgrid, + wxPGProperty* property, + wxWindow* primaryCtrl, + wxEvent& event ) const wxOVERRIDE; + virtual bool GetValueFromControl( wxVariant& variant, + wxPGProperty* property, + wxWindow* ctrl ) const wxOVERRIDE; + virtual void SetValueToUnspecified( wxPGProperty* property, + wxWindow* ctrl ) const wxOVERRIDE; + + virtual void DrawValue( wxDC& dc, + const wxRect& rect, + wxPGProperty* property, + const wxString& text ) const wxOVERRIDE; + //virtual wxPGCellRenderer* GetCellRenderer() const; + + virtual void SetControlIntValue( wxPGProperty* property, + wxWindow* ctrl, + int value ) const wxOVERRIDE; +}; + +#endif + + +// ----------------------------------------------------------------------- +// Editor class registration macro (mostly for internal use) + +#define wxPGRegisterEditorClass(EDITOR) \ + if ( wxPGEditor_##EDITOR == NULL ) \ + { \ + wxPGEditor_##EDITOR = wxPropertyGrid::RegisterEditorClass( \ + new wxPG##EDITOR##Editor ); \ + } + +// ----------------------------------------------------------------------- + +// Derive a class from this to adapt an existing editor dialog or function to +// be used when editor button of a property is pushed. +// You only need to derive class and implement DoShowDialog() to create and +// show the dialog, and finally submit the value returned by the dialog +// via SetValue(). +class WXDLLIMPEXP_PROPGRID wxPGEditorDialogAdapter : public wxObject +{ + wxDECLARE_ABSTRACT_CLASS(wxPGEditorDialogAdapter); +public: + wxPGEditorDialogAdapter() + : wxObject() + , m_clientData(NULL) + { + } + + virtual ~wxPGEditorDialogAdapter() { } + + bool ShowDialog( wxPropertyGrid* propGrid, wxPGProperty* property ); + + virtual bool DoShowDialog( wxPropertyGrid* propGrid, + wxPGProperty* property ) = 0; + + void SetValue( const wxVariant& value ) + { + m_value = value; + } + + // This method is typically only used if deriving class from existing + // adapter with value conversion purposes. + wxVariant& GetValue() { return m_value; } + + // This member is public so scripting language bindings + // wrapper code can access it freely. + void* m_clientData; + +private: + wxVariant m_value; +}; + +// ----------------------------------------------------------------------- + + +// This class can be used to have multiple buttons in a property editor. +// You will need to create a new property editor class, override +// CreateControls, and have it return wxPGMultiButton instance in +// wxPGWindowList::SetSecondary(). +class WXDLLIMPEXP_PROPGRID wxPGMultiButton : public wxWindow +{ +public: + wxPGMultiButton( wxPropertyGrid* pg, const wxSize& sz ); + virtual ~wxPGMultiButton() {} + + wxWindow* GetButton( unsigned int i ) { return m_buttons[i]; } + const wxWindow* GetButton( unsigned int i ) const + { return m_buttons[i]; } + + // Utility function to be used in event handlers. + int GetButtonId( unsigned int i ) const { return GetButton(i)->GetId(); } + + // Returns number of buttons. + unsigned int GetCount() const { return (unsigned int) m_buttons.size(); } + + void Add( const wxString& label, int id = -2 ); +#if wxUSE_BMPBUTTON + void Add( const wxBitmapBundle& bitmap, int id = -2 ); +#endif + + wxSize GetPrimarySize() const + { + return wxSize(m_fullEditorSize.x - m_buttonsWidth, m_fullEditorSize.y); + } + + void Finalize( wxPropertyGrid* propGrid, const wxPoint& pos ); + +protected: + + void DoAddButton( wxWindow* button, const wxSize& sz ); + + int GenId( int id ) const; + + wxVector<wxWindow*> m_buttons; + wxSize m_fullEditorSize; + int m_buttonsWidth; +}; + +// ----------------------------------------------------------------------- + +#endif // wxUSE_PROPGRID + +#endif // _WX_PROPGRID_EDITORS_H_ diff --git a/lib/wxWidgets/include/wx/propgrid/manager.h b/lib/wxWidgets/include/wx/propgrid/manager.h new file mode 100644 index 0000000..5f76f03 --- /dev/null +++ b/lib/wxWidgets/include/wx/propgrid/manager.h @@ -0,0 +1,637 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/propgrid/manager.h +// Purpose: wxPropertyGridManager +// Author: Jaakko Salli +// Modified by: +// Created: 2005-01-14 +// Copyright: (c) Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PROPGRID_MANAGER_H_ +#define _WX_PROPGRID_MANAGER_H_ + +#include "wx/defs.h" + +#if wxUSE_PROPGRID + +#include "wx/propgrid/propgrid.h" + +// ----------------------------------------------------------------------- + +#ifndef SWIG +extern WXDLLIMPEXP_DATA_PROPGRID(const char) wxPropertyGridManagerNameStr[]; +#endif + +// Holder of property grid page information. You can subclass this and +// give instance in wxPropertyGridManager::AddPage. It inherits from +// wxEvtHandler and can be used to process events specific to this +// page (id of events will still be same as manager's). If you don't +// want to use it to process all events of the page, you need to +// return false in the derived wxPropertyGridPage::IsHandlingAllEvents. +// +// Please note that wxPropertyGridPage lacks many non-const property +// manipulation functions found in wxPropertyGridManager. Please use +// parent manager (m_manager member variable) when needed. +// +// Please note that most member functions are inherited and as such not +// documented on this page. This means you will probably also want to read +// wxPropertyGridInterface class reference. +// +// wxPropertyGridPage receives events emitted by its wxPropertyGridManager, but +// only those events that are specific to that page. If +// wxPropertyGridPage::IsHandlingAllEvents returns false, then unhandled +// events are sent to the manager's parent, as usual. +class WXDLLIMPEXP_PROPGRID wxPropertyGridPage : public wxEvtHandler, + public wxPropertyGridInterface, + public wxPropertyGridPageState +{ + friend class wxPropertyGridManager; + wxDECLARE_CLASS(wxPropertyGridPage); +public: + + wxPropertyGridPage(); + virtual ~wxPropertyGridPage(); + + // Deletes all properties on page. + virtual void Clear() wxOVERRIDE; + + // Reduces column sizes to minimum possible that contents are still + // visibly (naturally some margin space will be applied as well). + // Returns minimum size for the page to still display everything. + // This function only works properly if size of containing grid was + // already fairly large. + // Note that you can also get calculated column widths by calling + // GetColumnWidth() immediately after this function returns. + wxSize FitColumns(); + + // Returns page index in manager; + inline int GetIndex() const; + + // Returns x-coordinate position of splitter on a page. + int GetSplitterPosition( int col = 0 ) const + { return GetStatePtr()->DoGetSplitterPosition(col); } + + // Returns "root property". It does not have name, etc. and it is not + // visible. It is only useful for accessing its children. + wxPGProperty* GetRoot() const { return GetStatePtr()->DoGetRoot(); } + + // Returns pointer to contained property grid state. + wxPropertyGridPageState* GetStatePtr() + { + return this; + } + + // Returns pointer to contained property grid state. + const wxPropertyGridPageState* GetStatePtr() const + { + return this; + } + + // Returns id of the tool bar item that represents this page on + // wxPropertyGridManager's wxToolBar. + int GetToolId() const + { + return m_toolId; + } + + // Do any member initialization in this method. + // Notes: + // - Called every time the page is added into a manager. + // - You can add properties to the page here. + virtual void Init() {} + + // Return false here to indicate unhandled events should be + // propagated to manager's parent, as normal. + virtual bool IsHandlingAllEvents() const { return true; } + + // Called every time page is about to be shown. + // Useful, for instance, creating properties just-in-time. + virtual void OnShow(); + + // Refreshes given property on page. + virtual void RefreshProperty( wxPGProperty* p ) wxOVERRIDE; + + // Sets splitter position on page. + // Splitter position cannot exceed grid size, and therefore setting it + // during form creation may fail as initial grid size is often smaller + // than desired splitter position, especially when sizers are being used. + void SetSplitterPosition( int splitterPos, int col = 0 ); + +#if WXWIN_COMPATIBILITY_3_0 + // To avoid ambiguity between functions inherited + // from both wxPropertyGridInterface and wxPropertyGridPageState + using wxPropertyGridInterface::GetPropertyByLabel; +#endif // WXWIN_COMPATIBILITY_3_0 + +protected: + + // Propagate to other pages. + virtual void DoSetSplitterPosition( int pos, + int splitterColumn = 0, + int flags = wxPG_SPLITTER_REFRESH ) wxOVERRIDE; + + // Page label (may be referred as name in some parts of documentation). + // Can be set in constructor, or passed in + // wxPropertyGridManager::AddPage(), but *not* in both. + wxString m_label; + + //virtual bool ProcessEvent( wxEvent& event ); + + wxPropertyGridManager* m_manager; + + // Toolbar tool id. Note that this is only valid when the tool bar + // exists. + int m_toolId; + +private: + bool m_isDefault; // is this base page object? + + wxDECLARE_EVENT_TABLE(); +}; + +// ----------------------------------------------------------------------- + +#if wxUSE_TOOLBAR +class WXDLLIMPEXP_FWD_CORE wxToolBar; +#endif +#if wxUSE_HEADERCTRL +class wxPGHeaderCtrl; +#endif +class WXDLLIMPEXP_FWD_CORE wxStaticText; + +// wxPropertyGridManager is an efficient multi-page version of wxPropertyGrid, +// which can optionally have toolbar for mode and page selection, and help +// text box. +// Use window flags to select components to include. +class WXDLLIMPEXP_PROPGRID + wxPropertyGridManager : public wxPanel, public wxPropertyGridInterface +{ + wxDECLARE_CLASS(wxPropertyGridManager); +public: + +#ifndef SWIG + // Two step constructor. + // Call Create when this constructor is called to build up the + // wxPropertyGridManager. + wxPropertyGridManager(); +#endif + + // The default constructor. The styles to be used are styles valid for + // the wxWindow. + wxPropertyGridManager( wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxPGMAN_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxPropertyGridManagerNameStr) ); + + // Destructor. + virtual ~wxPropertyGridManager(); + + // Creates new property page. Note that the first page is not created + // automatically. + // label - A label for the page. This may be shown as a toolbar tooltip etc. + // bmp - Bitmap bundle image for toolbar. If it's null then a built-in + // default bitmap bundle is used. + // pageObj - wxPropertyGridPage instance. Manager will take ownership of this object. + // NULL indicates that a default page instance should be created. + // Returns pointer to created page. + // If toolbar is used, it is highly recommended that the pages are + // added when the toolbar is not turned off using window style flag + // switching. + wxPropertyGridPage* AddPage( const wxString& label = wxEmptyString, + const wxBitmapBundle& bmp = wxBitmapBundle(), + wxPropertyGridPage* pageObj = NULL ) + { + return InsertPage(-1, label, bmp, pageObj); + } + + // Deletes all properties and all pages. + virtual void Clear() wxOVERRIDE; + + // Deletes all properties on given page. + void ClearPage( int page ); + + // Forces updating the value of property from the editor control. + // Returns true if DoPropertyChanged was actually called. + bool CommitChangesFromEditor( wxUint32 flags = 0 ) + { + return m_pPropGrid->CommitChangesFromEditor(flags); + } + + // Two step creation. + // Whenever the control is created without any parameters, use Create to + // actually create it. Don't access the control's public methods before + // this is called. + bool Create( wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxPGMAN_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxPropertyGridManagerNameStr) ); + + // Enables or disables (shows/hides) categories according to parameter + // enable. + // Calling this may not properly update toolbar buttons. + bool EnableCategories( bool enable ) + { + long fl = m_windowStyle | wxPG_HIDE_CATEGORIES; + if ( enable ) fl = m_windowStyle & ~(wxPG_HIDE_CATEGORIES); + SetWindowStyleFlag(fl); + return true; + } + + // Selects page, scrolls and/or expands items to ensure that the + // given item is visible. Returns true if something was actually done. + bool EnsureVisible( wxPGPropArg id ); + + // Returns number of columns on given page. By the default, + // returns number of columns on current page. + int GetColumnCount( int page = -1 ) const; + + // Returns height of the description text box. + int GetDescBoxHeight() const; + + // Returns pointer to the contained wxPropertyGrid. This does not change + // after wxPropertyGridManager has been created, so you can safely obtain + // pointer once and use it for the entire lifetime of the manager instance. + wxPropertyGrid* GetGrid() + { + wxASSERT(m_pPropGrid); + return m_pPropGrid; + } + + const wxPropertyGrid* GetGrid() const + { + wxASSERT(m_pPropGrid); + return m_pPropGrid; + } + + // Returns iterator class instance. + // Calling this method in wxPropertyGridManager causes run-time assertion + // failure. Please only iterate through individual pages or use + // CreateVIterator(). + wxPropertyGridIterator GetIterator( int flags = wxPG_ITERATE_DEFAULT, + wxPGProperty* firstProp = NULL ) + { + wxFAIL_MSG( wxS("Please only iterate through individual pages ") + wxS("or use CreateVIterator()") ); + return wxPropertyGridInterface::GetIterator( flags, firstProp ); + } + + wxPropertyGridConstIterator + GetIterator(int flags = wxPG_ITERATE_DEFAULT, + wxPGProperty* firstProp = NULL) const + { + wxFAIL_MSG( wxS("Please only iterate through individual pages ") + wxS("or use CreateVIterator()") ); + return wxPropertyGridInterface::GetIterator( flags, firstProp ); + } + + // Returns iterator class instance. + // Calling this method in wxPropertyGridManager causes run-time assertion + // failure. Please only iterate through individual pages or use + // CreateVIterator(). + wxPropertyGridIterator GetIterator( int flags, int startPos ) + { + wxFAIL_MSG( wxS("Please only iterate through individual pages ") + wxS("or use CreateVIterator()") ); + + return wxPropertyGridInterface::GetIterator( flags, startPos ); + } + + wxPropertyGridConstIterator GetIterator( int flags, int startPos ) const + { + wxFAIL_MSG( wxS("Please only iterate through individual pages ") + wxS("or use CreateVIterator()") ); + return wxPropertyGridInterface::GetIterator( flags, startPos ); + } + + // Similar to GetIterator, but instead returns wxPGVIterator instance, + // which can be useful for forward-iterating through arbitrary property + // containers. + virtual wxPGVIterator GetVIterator( int flags ) const wxOVERRIDE; + + // Returns currently selected page. + wxPropertyGridPage* GetCurrentPage() const + { + return GetPage(m_selPage); + } + + // Returns page object for given page index. + wxPropertyGridPage* GetPage( unsigned int ind ) const + { + return m_arrPages[ind]; + } + + // Returns page object for given page name. + wxPropertyGridPage* GetPage( const wxString& name ) const + { + return GetPage(GetPageByName(name)); + } + + // Returns index for a page name. + // If no match is found, wxNOT_FOUND is returned. + int GetPageByName( const wxString& name ) const; + + // Returns index for a relevant propertygrid state. + // If no match is found, wxNOT_FOUND is returned. + int GetPageByState( const wxPropertyGridPageState* pstate ) const; + +protected: + // Returns wxPropertyGridPageState of given page, current page's for -1. + virtual wxPropertyGridPageState* GetPageState( int page ) const wxOVERRIDE; + +public: + // Returns number of managed pages. + size_t GetPageCount() const; + + // Returns name of given page. + const wxString& GetPageName( int index ) const; + + // Returns "root property" of the given page. It does not have name, etc. + // and it is not visible. It is only useful for accessing its children. + wxPGProperty* GetPageRoot( int index ) const; + + // Returns index to currently selected page. + int GetSelectedPage() const { return m_selPage; } + + // Alias for GetSelection(). + wxPGProperty* GetSelectedProperty() const + { + return GetSelection(); + } + + // Shortcut for GetGrid()->GetSelection(). + wxPGProperty* GetSelection() const + { + return m_pPropGrid->GetSelection(); + } + +#if wxUSE_TOOLBAR + // Returns a pointer to the toolbar currently associated with the + // wxPropertyGridManager (if any). + wxToolBar* GetToolBar() const { return m_pToolbar; } +#endif // wxUSE_TOOLBAR + + // Creates new property page. Note that the first page is not created + // automatically. + // index - Add to this position. -1 will add as the last item. + // label - A label for the page. This may be shown as a toolbar tooltip etc. + // bmp - Bitmap bundle for toolbar. If it's null, then a built-in + // default bitmap bundle is used. + // pageObj - wxPropertyGridPage instance. Manager will take ownership of this object. + // If NULL, default page object is constructed. + // Returns pointer to created page. + virtual wxPropertyGridPage* InsertPage( int index, + const wxString& label, + const wxBitmapBundle& bmp = wxBitmapBundle(), + wxPropertyGridPage* pageObj = NULL ); + + // Returns true if any property on any page has been modified by the user. + bool IsAnyModified() const; + + // Returns true if any property on given page has been modified by the + // user. + bool IsPageModified( size_t index ) const; + + // Returns true if property is selected. Since selection is page + // based, this function checks every page in the manager. + virtual bool IsPropertySelected( wxPGPropArg id ) const; + + // Removes a page. + // Returns false if it was not possible to remove page in question. + virtual bool RemovePage( int page ); + + // Select and displays a given page. + // index - Index of page being selected. Can be -1 to select nothing. + void SelectPage( int index ); + + // Select and displays a given page (by label). + void SelectPage( const wxString& label ) + { + int index = GetPageByName(label); + wxCHECK_RET( index >= 0, wxS("No page with such name") ); + SelectPage( index ); + } + + // Select and displays a given page. + void SelectPage( wxPropertyGridPage* ptr ) + { + SelectPage( GetPageByState(ptr) ); + } + + // Select a property. + bool SelectProperty( wxPGPropArg id, bool focus = false ) + { + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false) + unsigned int flags = wxPG_SEL_DONT_SEND_EVENT; + if ( focus ) + flags |= wxPG_SEL_FOCUS; + + return p->GetParentState()->DoSelectProperty(p, flags); + } + +#if wxUSE_HEADERCTRL + // Sets a column title. Default title for column 0 is "Property", + // and "Value" for column 1. + // If header is not shown yet, then calling this + // member function will make it visible. + void SetColumnTitle( int idx, const wxString& title ); +#endif // wxUSE_HEADERCTRL + + // Sets number of columns on given page (default is current page). + // If you use header, then you should always use this + // member function to set the column count, instead of + // ones present in wxPropertyGrid or wxPropertyGridPage. + void SetColumnCount( int colCount, int page = -1 ); + + // Sets label and text in description box. + void SetDescription( const wxString& label, const wxString& content ); + + // Sets y coordinate of the description box splitter. + void SetDescBoxHeight( int ht, bool refresh = true ); + + // Moves splitter as left as possible, while still allowing all + // labels to be shown in full. + // subProps - If false, will still allow sub-properties (ie. properties which + // parent is not root or category) to be cropped. + // allPages - If true, takes labels on all pages into account. + void SetSplitterLeft( bool subProps = false, bool allPages = true ); + + // Moves splitter as left as possible on an individual page, while still allowing all + // labels to be shown in full. + void SetPageSplitterLeft(int page, bool subProps = false); + + // Sets splitter position on individual page. + // If you use header, then you should always use this + // member function to set the splitter position, instead of + // ones present in wxPropertyGrid or wxPropertyGridPage. + void SetPageSplitterPosition( int page, int pos, int column = 0 ); + + // Sets splitter position for all pages. + // Splitter position cannot exceed grid size, and therefore + // setting it during form creation may fail as initial grid + // size is often smaller than desired splitter position, + // especially when sizers are being used. + // If you use header, then you should always use this + // member function to set the splitter position, instead of + // ones present in wxPropertyGrid or wxPropertyGridPage. + void SetSplitterPosition( int pos, int column = 0 ); + +#if wxUSE_HEADERCTRL + // Show or hide the property grid header control. It is hidden + // by the default. + // Grid may look better if you use wxPG_NO_INTERNAL_BORDER + // window style when showing a header. + void ShowHeader(bool show = true); +#endif + +protected: + + // + // Subclassing helpers + // + + // Creates property grid for the manager. Reimplement in derived class to + // use subclassed wxPropertyGrid. However, if you do this then you + // must also use the two-step construction (i.e. default constructor and + // Create() instead of constructor with arguments) when creating the + // manager. + virtual wxPropertyGrid* CreatePropertyGrid() const; + +public: + virtual void RefreshProperty( wxPGProperty* p ) wxOVERRIDE; + + // + // Overridden functions - no documentation required. + // + + void SetId( wxWindowID winid ) wxOVERRIDE; + virtual void SetExtraStyle ( long exStyle ) wxOVERRIDE; + virtual bool SetFont ( const wxFont& font ) wxOVERRIDE; + virtual void SetWindowStyleFlag ( long style ) wxOVERRIDE; + virtual bool Reparent( wxWindowBase *newParent ) wxOVERRIDE; + +protected: + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + // + // Event handlers + // + void OnMouseMove( wxMouseEvent &event ); + void OnMouseClick( wxMouseEvent &event ); + void OnMouseUp( wxMouseEvent &event ); + void OnMouseEntry( wxMouseEvent &event ); + + void OnPaint( wxPaintEvent &event ); + +#if wxUSE_TOOLBAR + void OnToolbarClick( wxCommandEvent &event ); +#endif + void OnResize( wxSizeEvent& event ); + void OnPropertyGridSelect( wxPropertyGridEvent& event ); + void OnPGScrollH(wxPropertyGridEvent& evt); + void OnColWidthsChanged(wxPropertyGridEvent& evt); + + + wxPropertyGrid* m_pPropGrid; + + wxVector<wxPropertyGridPage*> m_arrPages; + +#if wxUSE_TOOLBAR + wxToolBar* m_pToolbar; +#endif +#if wxUSE_HEADERCTRL + wxPGHeaderCtrl* m_pHeaderCtrl; +#endif + wxStaticText* m_pTxtHelpCaption; + wxStaticText* m_pTxtHelpContent; + + wxPropertyGridPage* m_emptyPage; + + long m_iFlags; + + // Selected page index. + int m_selPage; + + int m_width; + + int m_height; + + int m_extraHeight; + + int m_splitterY; + + int m_splitterHeight; + + int m_dragOffset; + + wxCursor m_cursorSizeNS; + + int m_nextDescBoxSize; + + // Toolbar tool ids for categorized and alphabetic mode selectors. + int m_categorizedModeToolId; + int m_alphabeticModeToolId; + + unsigned char m_dragStatus; + + bool m_onSplitter; + + bool m_showHeader; + + virtual wxPGProperty* DoGetPropertyByName( const wxString& name ) const wxOVERRIDE; + + // Select and displays a given page. + virtual bool DoSelectPage( int index ) wxOVERRIDE; + + // Sets some members to defaults. + void Init1(); + + // Initializes some members. + void Init2( int style ); + +/*#ifdef __WXMSW__ + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle) const; +#endif*/ + + virtual bool ProcessEvent( wxEvent& event ) wxOVERRIDE; + + // Recalculates new positions for components, according to the + // given size. + void RecalculatePositions( int width, int height ); + + // (Re)creates/destroys controls, according to the window style bits. + void RecreateControls(); + + void UpdateDescriptionBox( int new_splittery, int new_width, int new_height ); + + void RepaintDescBoxDecorations( wxDC& dc, + int newSplitterY, + int newWidth, + int newHeight ); + + void SetDescribedProperty( wxPGProperty* p ); + + // Reimplement these to handle "descboxheight" state item + virtual bool SetEditableStateItem( const wxString& name, wxVariant value ) wxOVERRIDE; + virtual wxVariant GetEditableStateItem( const wxString& name ) const wxOVERRIDE; + + // Reconnect propgrid event handlers. + void ReconnectEventHandlers(wxWindowID oldId, wxWindowID newId); +private: + wxDECLARE_EVENT_TABLE(); +}; + +// ----------------------------------------------------------------------- + +inline int wxPropertyGridPage::GetIndex() const +{ + return m_manager ? m_manager->GetPageByState(this) : wxNOT_FOUND; +} + +// ----------------------------------------------------------------------- + +#endif // wxUSE_PROPGRID + +#endif // _WX_PROPGRID_MANAGER_H_ diff --git a/lib/wxWidgets/include/wx/propgrid/property.h b/lib/wxWidgets/include/wx/propgrid/property.h new file mode 100644 index 0000000..e66445b --- /dev/null +++ b/lib/wxWidgets/include/wx/propgrid/property.h @@ -0,0 +1,2180 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/propgrid/property.h +// Purpose: wxPGProperty and related support classes +// Author: Jaakko Salli +// Modified by: +// Created: 2008-08-23 +// Copyright: (c) Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PROPGRID_PROPERTY_H_ +#define _WX_PROPGRID_PROPERTY_H_ + +#include "wx/defs.h" + +#if wxUSE_PROPGRID + +#include "wx/propgrid/propgriddefs.h" +#include "wx/bitmap.h" +#include "wx/bmpbndl.h" +#include "wx/font.h" +#include "wx/validate.h" + +// ----------------------------------------------------------------------- + +#define wxNullProperty ((wxPGProperty*)NULL) + + +// Contains information relayed to property's OnCustomPaint. +struct wxPGPaintData +{ + // wxPropertyGrid + const wxPropertyGrid* m_parent; + + // Normally -1, otherwise index to drop-down list item + // that has to be drawn. + int m_choiceItem; + + // Set to drawn width in OnCustomPaint (optional). + int m_drawnWidth; + + // In a measure item call, set this to the height of item + // at m_choiceItem index. + int m_drawnHeight; +}; + + +// space between vertical sides of a custom image +#define wxPG_CUSTOM_IMAGE_SPACINGY 1 + +// space between caption and selection rectangle, +#define wxPG_CAPRECTXMARGIN 2 + +// horizontally and vertically +#define wxPG_CAPRECTYMARGIN 1 + + +// Base class for wxPropertyGrid cell renderers. +class WXDLLIMPEXP_PROPGRID wxPGCellRenderer : public wxObjectRefData +{ +public: + + wxPGCellRenderer() + : wxObjectRefData() { } + virtual ~wxPGCellRenderer() { } + + // Render flags + enum + { + // We are painting selected item + Selected = 0x00010000, + + // We are painting item in choice popup + ChoicePopup = 0x00020000, + + // We are rendering wxOwnerDrawnComboBox control + // (or other owner drawn control, but that is only + // officially supported one ATM). + Control = 0x00040000, + + // We are painting a disable property + Disabled = 0x00080000, + + // We are painting selected, disabled, or similar + // item that dictates fore- and background colours, + // overriding any cell values. + DontUseCellFgCol = 0x00100000, + DontUseCellBgCol = 0x00200000, + DontUseCellColours = DontUseCellFgCol | + DontUseCellBgCol + }; + + // Returns true if rendered something in the foreground + // (text or bitmap). + virtual bool Render( wxDC& dc, + const wxRect& rect, + const wxPropertyGrid* propertyGrid, + wxPGProperty* property, + int column, + int item, + int flags ) const = 0; + + // Returns size of the image in front of the editable area. + // If property is NULL, then this call is for a custom value. + // In that case the item is index to wxPropertyGrid's custom values. + virtual wxSize GetImageSize( const wxPGProperty* property, + int column, + int item ) const; + + // Paints property category selection rectangle. +#if WXWIN_COMPATIBILITY_3_0 + virtual void DrawCaptionSelectionRect( wxDC& dc, + int x, int y, + int w, int h ) const; +#else + virtual void DrawCaptionSelectionRect(wxWindow *win, wxDC& dc, + int x, int y, int w, int h) const; +#endif // WXWIN_COMPATIBILITY_3_0 + + // Utility to draw vertically centered text. + void DrawText( wxDC& dc, + const wxRect& rect, + int imageWidth, + const wxString& text ) const; + + // Utility to draw editor's value, or vertically + // aligned text if editor is NULL. + void DrawEditorValue( wxDC& dc, const wxRect& rect, + int xOffset, const wxString& text, + wxPGProperty* property, + const wxPGEditor* editor ) const; + + // Utility to render cell bitmap and set text + // colour plus bg brush colour. + // Returns image width, which, for instance, + // can be passed to DrawText. + int PreDrawCell( wxDC& dc, + const wxRect& rect, + const wxPropertyGrid* propGrid, + const wxPGCell& cell, + int flags ) const; + + // Utility to be called after drawing is done, to revert + // whatever changes PreDrawCell() did. + // Flags are the same as those passed to PreDrawCell(). + void PostDrawCell( wxDC& dc, + const wxPropertyGrid* propGrid, + const wxPGCell& cell, + int flags ) const; +}; + + +// Default cell renderer, that can handles the common +// scenarios. +class WXDLLIMPEXP_PROPGRID wxPGDefaultRenderer : public wxPGCellRenderer +{ +public: + virtual bool Render( wxDC& dc, + const wxRect& rect, + const wxPropertyGrid* propertyGrid, + wxPGProperty* property, + int column, + int item, + int flags ) const wxOVERRIDE; + + virtual wxSize GetImageSize( const wxPGProperty* property, + int column, + int item ) const wxOVERRIDE; + +protected: +}; + + +class WXDLLIMPEXP_PROPGRID wxPGCellData : public wxObjectRefData +{ + friend class wxPGCell; +public: + wxPGCellData(); + + void SetText( const wxString& text ) + { + m_text = text; + m_hasValidText = true; + } + void SetBitmap( const wxBitmapBundle& bitmap ) { m_bitmapBundle = bitmap; } + void SetFgCol( const wxColour& col ) { m_fgCol = col; } + void SetBgCol( const wxColour& col ) { m_bgCol = col; } + void SetFont( const wxFont& font ) { m_font = font; } + +protected: + virtual ~wxPGCellData() { } + + wxString m_text; + wxBitmapBundle m_bitmapBundle; + wxColour m_fgCol; + wxColour m_bgCol; + wxFont m_font; + + // True if m_text is valid and specified + bool m_hasValidText; +}; + + +// Base class for wxPropertyGrid cell information. +class WXDLLIMPEXP_PROPGRID wxPGCell : public wxObject +{ +public: + wxPGCell(); + wxPGCell(const wxPGCell& other) + : wxObject(other) + { + } + + wxPGCell( const wxString& text, + const wxBitmapBundle& bitmap = wxBitmapBundle(), + const wxColour& fgCol = wxNullColour, + const wxColour& bgCol = wxNullColour ); + + virtual ~wxPGCell() { } + + wxPGCellData* GetData() + { + return (wxPGCellData*) m_refData; + } + + const wxPGCellData* GetData() const + { + return (const wxPGCellData*) m_refData; + } + + bool HasText() const + { + return (m_refData && GetData()->m_hasValidText); + } + + // Sets empty but valid data to this cell object. + void SetEmptyData(); + + // Merges valid data from srcCell into this. + void MergeFrom( const wxPGCell& srcCell ); + + void SetText( const wxString& text ); + void SetBitmap( const wxBitmapBundle& bitmap ); + void SetFgCol( const wxColour& col ); + + // Sets font of the cell. + // Because wxPropertyGrid does not support rows of + // different height, it makes little sense to change + // size of the font. Therefore it is recommended + // to use return value of wxPropertyGrid::GetFont() + // or wxPropertyGrid::GetCaptionFont() as a basis + // for the font that, after modifications, is passed + // to this member function. + void SetFont( const wxFont& font ); + + void SetBgCol( const wxColour& col ); + + const wxString& GetText() const { return GetData()->m_text; } + const wxBitmapBundle& GetBitmap() const { return GetData()->m_bitmapBundle; } + const wxColour& GetFgCol() const { return GetData()->m_fgCol; } + + // Returns font of the cell. If no specific font is set for this + // cell, then the font will be invalid. + const wxFont& GetFont() const { return GetData()->m_font; } + + const wxColour& GetBgCol() const { return GetData()->m_bgCol; } + + wxPGCell& operator=( const wxPGCell& other ) + { + if ( this != &other ) + { + Ref(other); + } + return *this; + } + + // Used mostly internally to figure out if this cell is supposed + // to have default values when attached to a grid. + bool IsInvalid() const + { + return ( m_refData == NULL ); + } + +private: + virtual wxObjectRefData *CreateRefData() const wxOVERRIDE + { return new wxPGCellData(); } + + virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const wxOVERRIDE; +}; + +// ----------------------------------------------------------------------- + +// wxPGAttributeStorage is somewhat optimized storage for +// key=variant pairs (ie. a map). +class WXDLLIMPEXP_PROPGRID wxPGAttributeStorage +{ +public: + wxPGAttributeStorage(); + wxPGAttributeStorage(const wxPGAttributeStorage& other); + ~wxPGAttributeStorage(); + + wxPGAttributeStorage& operator=(const wxPGAttributeStorage& rhs); + + void Set( const wxString& name, const wxVariant& value ); + unsigned int GetCount() const { return (unsigned int) m_map.size(); } + wxVariant FindValue( const wxString& name ) const + { + wxPGHashMapS2P::const_iterator it = m_map.find(name); + if ( it != m_map.end() ) + { + wxVariantData* data = (wxVariantData*) it->second; + data->IncRef(); + return wxVariant(data, it->first); + } + return wxVariant(); + } + + typedef wxPGHashMapS2P::const_iterator const_iterator; + const_iterator StartIteration() const + { + return m_map.begin(); + } + bool GetNext( const_iterator& it, wxVariant& variant ) const + { + if ( it == m_map.end() ) + return false; + + wxVariantData* data = (wxVariantData*) it->second; + data->IncRef(); + variant.SetData(data); + variant.SetName(it->first); + ++it; + return true; + } + +protected: + wxPGHashMapS2P m_map; +}; + + +// ----------------------------------------------------------------------- + +enum wxPGPropertyFlags +{ + +// Indicates bold font. +wxPG_PROP_MODIFIED = 0x0001, + +// Disables ('greyed' text and editor does not activate) property. +wxPG_PROP_DISABLED = 0x0002, + +// Hider button will hide this property. +wxPG_PROP_HIDDEN = 0x0004, + +// This property has custom paint image just in front of its value. +// If property only draws custom images into a popup list, then this +// flag should not be set. +wxPG_PROP_CUSTOMIMAGE = 0x0008, + +// Do not create text based editor for this property (but button-triggered +// dialog and choice are ok). +wxPG_PROP_NOEDITOR = 0x0010, + +// Property is collapsed, ie. its children are hidden. +wxPG_PROP_COLLAPSED = 0x0020, + +// If property is selected, then indicates that validation failed for pending +// value. +// If property is not selected, that indicates that the actual property +// value has failed validation (NB: this behaviour is not currently supported, +// but may be used in future). +wxPG_PROP_INVALID_VALUE = 0x0040, + +// 0x0080, + +// Switched via SetWasModified(). Temporary flag - only used when +// setting/changing property value. +wxPG_PROP_WAS_MODIFIED = 0x0200, + +// If set, then child properties (if any) are private, and should be +// "invisible" to the application. +wxPG_PROP_AGGREGATE = 0x0400, + +// If set, then child properties (if any) are copies and should not +// be deleted in dtor. +wxPG_PROP_CHILDREN_ARE_COPIES = 0x0800, + +// Classifies this item as a non-category. +// Used for faster item type identification. +wxPG_PROP_PROPERTY = 0x1000, + +// Classifies this item as a category. +// Used for faster item type identification. +wxPG_PROP_CATEGORY = 0x2000, + +// Classifies this item as a property that has children, +//but is not aggregate (i.e. children are not private). +wxPG_PROP_MISC_PARENT = 0x4000, + +// Property is read-only. Editor is still created for wxTextCtrl-based +// property editors. For others, editor is not usually created because +// they do implement wxTE_READONLY style or equivalent. +wxPG_PROP_READONLY = 0x8000, + +// +// NB: FLAGS ABOVE 0x8000 CANNOT BE USED WITH PROPERTY ITERATORS +// + +// Property's value is composed from values of child properties. +// This flag cannot be used with property iterators. +wxPG_PROP_COMPOSED_VALUE = 0x00010000, + +// Common value of property is selectable in editor. +// This flag cannot be used with property iterators. +wxPG_PROP_USES_COMMON_VALUE = 0x00020000, + +// Property can be set to unspecified value via editor. +// Currently, this applies to following properties: +// - wxIntProperty, wxUIntProperty, wxFloatProperty, wxEditEnumProperty: +// Clear the text field +// This flag cannot be used with property iterators. +// See wxPGProperty::SetAutoUnspecified(). +wxPG_PROP_AUTO_UNSPECIFIED = 0x00040000, + +// Indicates the bit usable by derived properties. +wxPG_PROP_CLASS_SPECIFIC_1 = 0x00080000, + +// Indicates the bit usable by derived properties. +wxPG_PROP_CLASS_SPECIFIC_2 = 0x00100000, + +// Indicates that the property is being deleted and should be ignored. +wxPG_PROP_BEING_DELETED = 0x00200000, + +// Indicates the bit usable by derived properties. +wxPG_PROP_CLASS_SPECIFIC_3 = 0x00400000 + +}; + +// Topmost flag. +#define wxPG_PROP_MAX wxPG_PROP_AUTO_UNSPECIFIED + +// Property with children must have one of these set, otherwise iterators +// will not work correctly. +// Code should automatically take care of this, however. +#define wxPG_PROP_PARENTAL_FLAGS \ + ((wxPGPropertyFlags)(wxPG_PROP_AGGREGATE | \ + wxPG_PROP_CATEGORY | \ + wxPG_PROP_MISC_PARENT)) + +// Combination of flags that can be stored by GetFlagsAsString +#define wxPG_STRING_STORED_FLAGS \ + (wxPG_PROP_DISABLED|wxPG_PROP_HIDDEN|wxPG_PROP_NOEDITOR|wxPG_PROP_COLLAPSED) + +// ----------------------------------------------------------------------- + +// Helpers to mark macros as deprecated +#if (defined(__clang__) || wxCHECK_GCC_VERSION(4, 5)) && !defined(WXBUILDING) +#define wxPG_STRINGIFY(X) #X +#define wxPG_DEPRECATED_MACRO_VALUE(value, msg) \ + _Pragma(wxPG_STRINGIFY(GCC warning msg)) value +#else +#define wxPG_DEPRECATED_MACRO_VALUE(value, msg) value +#endif // clang || GCC + +#if wxCHECK_VISUALC_VERSION(10) && !defined(WXBUILDING) +#define wxPG_MUST_DEPRECATE_MACRO_NAME +#endif + +// wxPGProperty::SetAttribute() and +// wxPropertyGridInterface::SetPropertyAttribute() accept one of these as +// attribute name argument. +// You can use strings instead of constants. However, some of these +// constants are redefined to use cached strings which may reduce +// your binary size by some amount. + +// Set default value for property. +#define wxPG_ATTR_DEFAULT_VALUE wxS("DefaultValue") + +// Universal, int or double. Minimum value for numeric properties. +#define wxPG_ATTR_MIN wxS("Min") + +// Universal, int or double. Maximum value for numeric properties. +#define wxPG_ATTR_MAX wxS("Max") + +// Universal, string. When set, will be shown as text after the displayed +// text value. Alternatively, if third column is enabled, text will be shown +// there (for any type of property). +#define wxPG_ATTR_UNITS wxS("Units") + +// When set, will be shown as 'greyed' text in property's value cell when +// the actual displayed value is blank. +#define wxPG_ATTR_HINT wxS("Hint") + +#if wxPG_COMPATIBILITY_1_4 +// Ddeprecated. Use "Hint" (wxPG_ATTR_HINT) instead. +#define wxPG_ATTR_INLINE_HELP wxS("InlineHelp") +#endif + +// Universal, wxArrayString. Set to enable auto-completion in any +// wxTextCtrl-based property editor. +#define wxPG_ATTR_AUTOCOMPLETE wxS("AutoComplete") + +// wxBoolProperty and wxFlagsProperty specific. Value type is bool. +// Default value is False. +// When set to True, bool property will use check box instead of a +// combo box as its editor control. If you set this attribute +// for a wxFlagsProperty, it is automatically applied to child +// bool properties. +#define wxPG_BOOL_USE_CHECKBOX wxS("UseCheckbox") + +// wxBoolProperty and wxFlagsProperty specific. Value type is bool. +// Default value is False. +// Set to True for the bool property to cycle value on double click +// (instead of showing the popup listbox). If you set this attribute +// for a wxFlagsProperty, it is automatically applied to child +// bool properties. +#define wxPG_BOOL_USE_DOUBLE_CLICK_CYCLING wxS("UseDClickCycling") + +// wxFloatProperty (and similar) specific, int, default -1. +// Sets the (max) precision used when floating point value is rendered as +// text. The default -1 means infinite precision. +#define wxPG_FLOAT_PRECISION wxS("Precision") + +// The text will be echoed as asterisks (wxTE_PASSWORD will be passed +// to textctrl etc.). +#define wxPG_STRING_PASSWORD wxS("Password") + +// Define base used by a wxUIntProperty. Valid constants are +// wxPG_BASE_OCT, wxPG_BASE_DEC, wxPG_BASE_HEX and wxPG_BASE_HEXL +// (lowercase characters). +#define wxPG_UINT_BASE wxS("Base") + +// Define prefix rendered to wxUIntProperty. Accepted constants +// wxPG_PREFIX_NONE, wxPG_PREFIX_0x, and wxPG_PREFIX_DOLLAR_SIGN. +// Note: +// Only wxPG_PREFIX_NONE works with Decimal and Octal numbers. +#define wxPG_UINT_PREFIX wxS("Prefix") + +// Specific to wxEditorDialogProperty and derivatives, wxString, default is empty. +// Sets a specific title for the editor dialog. +#define wxPG_DIALOG_TITLE wxS("DialogTitle") + +// wxFileProperty/wxImageFileProperty specific, wxChar*, default is +// detected/varies. +// Sets the wildcard used in the triggered wxFileDialog. Format is the same. +#define wxPG_FILE_WILDCARD wxS("Wildcard") + +// wxFileProperty/wxImageFileProperty specific, int, default 1. +// When 0, only the file name is shown (i.e. drive and directory are hidden). +#define wxPG_FILE_SHOW_FULL_PATH wxS("ShowFullPath") + +// Specific to wxFileProperty and derived properties, wxString, default empty. +// If set, then the filename is shown relative to the given path string. +#define wxPG_FILE_SHOW_RELATIVE_PATH wxS("ShowRelativePath") + +// Specific to wxFileProperty and derived properties, wxString, +// default is empty. +// Sets the initial path of where to look for files. +#define wxPG_FILE_INITIAL_PATH wxS("InitialPath") + +#if WXWIN_COMPATIBILITY_3_0 +#ifdef wxPG_MUST_DEPRECATE_MACRO_NAME +#pragma deprecated(wxPG_FILE_DIALOG_TITLE) +#endif +// Specific to wxFileProperty and derivatives, wxString, default is empty. +// Sets a specific title for the dir dialog. +#define wxPG_FILE_DIALOG_TITLE wxPG_DEPRECATED_MACRO_VALUE(wxS("DialogTitle"),\ + "wxPG_FILE_DIALOG_TITLE is deprecated. Use wxPG_DIALOG_TITLE instead.") +#endif // WXWIN_COMPATIBILITY_3_0 + +// Specific to wxFileProperty and derivatives, long, default is 0. +// Sets a specific wxFileDialog style for the file dialog, e.g. ::wxFD_SAVE. +#define wxPG_FILE_DIALOG_STYLE wxS("DialogStyle") + +#if WXWIN_COMPATIBILITY_3_0 +#ifdef wxPG_MUST_DEPRECATE_MACRO_NAME +#pragma deprecated(wxPG_DIR_DIALOG_MESSAGE) +#endif +// Specific to wxDirProperty, wxString, default is empty. +// Sets a specific message for the dir dialog. +#define wxPG_DIR_DIALOG_MESSAGE wxPG_DEPRECATED_MACRO_VALUE(wxS("DialogMessage"),\ + "wxPG_DIR_DIALOG_MESSAGE is deprecated. Use wxPG_DIALOG_TITLE instead.") +#endif // WXWIN_COMPATIBILITY_3_0 + +// wxArrayStringProperty's string delimiter character. If this is +// a quotation mark or hyphen, then strings will be quoted instead +// (with given character). +// Default delimiter is quotation mark. +#define wxPG_ARRAY_DELIMITER wxS("Delimiter") + +// Sets displayed date format for wxDateProperty. +#define wxPG_DATE_FORMAT wxS("DateFormat") + +// Sets wxDatePickerCtrl window style used with wxDateProperty. Default +// is wxDP_DEFAULT | wxDP_SHOWCENTURY. Using wxDP_ALLOWNONE will enable +// better unspecified value support in the editor +#define wxPG_DATE_PICKER_STYLE wxS("PickerStyle") + +#if wxUSE_SPINBTN +// SpinCtrl editor, int or double. How much number changes when button is +// pressed (or up/down on keyboard). +#define wxPG_ATTR_SPINCTRL_STEP wxS("Step") + +// SpinCtrl editor, bool. If true, value wraps at Min/Max. +#define wxPG_ATTR_SPINCTRL_WRAP wxS("Wrap") + +// SpinCtrl editor, bool. If true, moving mouse when one of the spin +// buttons is depressed rapidly changing "spin" value. +#define wxPG_ATTR_SPINCTRL_MOTION wxS("MotionSpin") +#endif // wxUSE_SPINBTN + +// wxMultiChoiceProperty, int. +// If 0, no user strings allowed. If 1, user strings appear before list +// strings. If 2, user strings appear after list string. +#define wxPG_ATTR_MULTICHOICE_USERSTRINGMODE wxS("UserStringMode") + +// wxColourProperty and its kind, int, default 1. +// Setting this attribute to 0 hides custom colour from property's list of +// choices. +#define wxPG_COLOUR_ALLOW_CUSTOM wxS("AllowCustom") + +// wxColourProperty and its kind: Set to True in order to support editing +// alpha colour component. +#define wxPG_COLOUR_HAS_ALPHA wxS("HasAlpha") + +// Redefine attribute macros to use cached strings +#undef wxPG_ATTR_DEFAULT_VALUE +#define wxPG_ATTR_DEFAULT_VALUE wxPGGlobalVars->m_strDefaultValue +#undef wxPG_ATTR_MIN +#define wxPG_ATTR_MIN wxPGGlobalVars->m_strMin +#undef wxPG_ATTR_MAX +#define wxPG_ATTR_MAX wxPGGlobalVars->m_strMax +#undef wxPG_ATTR_UNITS +#define wxPG_ATTR_UNITS wxPGGlobalVars->m_strUnits +#undef wxPG_ATTR_HINT +#define wxPG_ATTR_HINT wxPGGlobalVars->m_strHint +#if wxPG_COMPATIBILITY_1_4 +#undef wxPG_ATTR_INLINE_HELP +#define wxPG_ATTR_INLINE_HELP wxPGGlobalVars->m_strInlineHelp +#endif + +// ----------------------------------------------------------------------- + +// Data of a single wxPGChoices choice. +class WXDLLIMPEXP_PROPGRID wxPGChoiceEntry : public wxPGCell +{ +public: + wxPGChoiceEntry(); + wxPGChoiceEntry(const wxPGChoiceEntry& other) + : wxPGCell(other) + , m_value(other.m_value) + { + } + wxPGChoiceEntry( const wxString& label, + int value = wxPG_INVALID_VALUE ) + : wxPGCell() + , m_value(value) + { + SetText(label); + } + + virtual ~wxPGChoiceEntry() { } + + void SetValue( int value ) { m_value = value; } + int GetValue() const { return m_value; } + + wxPGChoiceEntry& operator=( const wxPGChoiceEntry& other ) + { + if ( this != &other ) + { + Ref(other); + } + m_value = other.m_value; + return *this; + } + +protected: + int m_value; +}; + + +typedef void* wxPGChoicesId; + +class WXDLLIMPEXP_PROPGRID wxPGChoicesData : public wxObjectRefData +{ + friend class wxPGChoices; +public: + // Constructor sets m_refCount to 1. + wxPGChoicesData(); + + void CopyDataFrom( wxPGChoicesData* data ); + + wxPGChoiceEntry& Insert( int index, const wxPGChoiceEntry& item ); + + // Delete all entries + void Clear(); + + unsigned int GetCount() const + { + return (unsigned int) m_items.size(); + } + + const wxPGChoiceEntry& Item( unsigned int i ) const + { + wxASSERT_MSG( i < GetCount(), wxS("invalid index") ); + return m_items[i]; + } + + wxPGChoiceEntry& Item( unsigned int i ) + { + wxASSERT_MSG( i < GetCount(), wxS("invalid index") ); + return m_items[i]; + } + +private: + wxVector<wxPGChoiceEntry> m_items; + +protected: + virtual ~wxPGChoicesData(); +}; + +#define wxPGChoicesEmptyData ((wxPGChoicesData*)NULL) + + +// Helper class for managing choices of wxPropertyGrid properties. +// Each entry can have label, value, bitmap, text colour, and background +// colour. +// wxPGChoices uses reference counting, similar to other wxWidgets classes. +// This means that assignment operator and copy constructor only copy the +// reference and not the actual data. Use Copy() member function to create +// a real copy. +// If you do not specify value for entry, index is used. +class WXDLLIMPEXP_PROPGRID wxPGChoices +{ +public: + typedef long ValArrItem; + + // Default constructor. + wxPGChoices() + { + Init(); + } + + // Copy constructor, uses reference counting. To create a real copy, + // use Copy() member function instead. + wxPGChoices( const wxPGChoices& a ) + { + if ( a.m_data != wxPGChoicesEmptyData ) + { + m_data = a.m_data; + m_data->IncRef(); + } + else + { + Init(); + } + } + + // Constructor. + // count - Number of labels. + // labels - Labels themselves. + // values - Values for choices. If NULL, indexes are used. + wxPGChoices(size_t count, const wxString* labels, const long* values = NULL) + { + Init(); + Add(count, labels, values); + } + + // Constructor overload taking wxChar strings, provided mostly for + // compatibility. + // labels - Labels for choices, NULL-terminated. + // values - Values for choices. If NULL, indexes are used. + wxPGChoices( const wxChar* const* labels, const long* values = NULL ) + { + Init(); + Add(labels,values); + } + + // Constructor. + // labels - Labels for choices. + // values - Values for choices. If empty, indexes are used. + wxPGChoices( const wxArrayString& labels, + const wxArrayInt& values = wxArrayInt() ) + { + Init(); + Add(labels,values); + } + + // Simple interface constructor. + wxPGChoices( wxPGChoicesData* data ) + { + wxASSERT(data); + m_data = data; + data->IncRef(); + } + + // Destructor. + ~wxPGChoices() + { + Free(); + } + + // Adds to current. + // If did not have own copies, creates them now. If was empty, identical + // to set except that creates copies. + void Add(size_t count, const wxString* labels, const long* values = NULL); + + // Overload taking wxChar strings, provided mostly for compatibility. + // labels - Labels for added choices, NULL-terminated. + // values - Values for added choices. If empty, relevant entry indexes are used. + void Add( const wxChar* const* labels, const ValArrItem* values = NULL ); + + // Version that works with wxArrayString and wxArrayInt. + void Add( const wxArrayString& arr, const wxArrayInt& arrint = wxArrayInt() ); + + // Adds a single choice. + // label - Label for added choice. + // value - Value for added choice. If unspecified, index is used. + wxPGChoiceEntry& Add( const wxString& label, + int value = wxPG_INVALID_VALUE ); + + // Adds a single item, with bitmap. + wxPGChoiceEntry& Add( const wxString& label, + const wxBitmapBundle& bitmap, + int value = wxPG_INVALID_VALUE ); + + // Adds a single item with full entry information. + wxPGChoiceEntry& Add( const wxPGChoiceEntry& entry ) + { + return Insert(entry, -1); + } + + // Adds a single item, sorted. + wxPGChoiceEntry& AddAsSorted( const wxString& label, + int value = wxPG_INVALID_VALUE ); + + // Assigns choices data, using reference counting. To create a real copy, + // use Copy() member function instead. + void Assign( const wxPGChoices& a ) + { + AssignData(a.m_data); + } + + // Assigns data from another set of choices. + void AssignData( wxPGChoicesData* data ); + + // Delete all choices. + void Clear(); + + // Returns a real copy of the choices. + wxPGChoices Copy() const + { + wxPGChoices dst; + dst.EnsureData(); + dst.m_data->CopyDataFrom(m_data); + return dst; + } + + void EnsureData() + { + if ( m_data == wxPGChoicesEmptyData ) + m_data = new wxPGChoicesData(); + } + + // Gets a unsigned number identifying this list. + wxPGChoicesId GetId() const { return (wxPGChoicesId) m_data; } + + // Returns label of item. + const wxString& GetLabel( unsigned int ind ) const + { + return Item(ind).GetText(); + } + + // Returns number of items. + unsigned int GetCount () const + { + if ( !m_data ) + return 0; + + return m_data->GetCount(); + } + + // Returns value of item. + int GetValue( unsigned int ind ) const { return Item(ind).GetValue(); } + + // Returns array of values matching the given strings. Unmatching strings + // result in wxPG_INVALID_VALUE entry in array. + wxArrayInt GetValuesForStrings( const wxArrayString& strings ) const; + + // Returns array of indices matching given strings. Unmatching strings + // are added to 'unmatched', if not NULL. + wxArrayInt GetIndicesForStrings( const wxArrayString& strings, + wxArrayString* unmatched = NULL ) const; + + // Returns index of item with given label. + int Index( const wxString& str ) const; + // Returns index of item with given value. + int Index( int val ) const; + + // Inserts a single item. + wxPGChoiceEntry& Insert( const wxString& label, + int index, + int value = wxPG_INVALID_VALUE ); + + // Inserts a single item with full entry information. + wxPGChoiceEntry& Insert( const wxPGChoiceEntry& entry, int index ); + + // Returns false if this is a constant empty set of choices, + // which should not be modified. + bool IsOk() const + { + return ( m_data != wxPGChoicesEmptyData ); + } + + const wxPGChoiceEntry& Item( unsigned int i ) const + { + wxASSERT( IsOk() ); + return m_data->Item(i); + } + + // Returns item at given index. + wxPGChoiceEntry& Item( unsigned int i ) + { + wxASSERT( IsOk() ); + return m_data->Item(i); + } + + // Removes count items starting at position nIndex. + void RemoveAt(size_t nIndex, size_t count = 1); + + // Sets contents from lists of strings and values. + // Does not create copies for itself. + // TODO: Deprecate. + void Set(size_t count, const wxString* labels, const long* values = NULL) + { + Free(); + Add(count, labels, values); + } + + void Set( const wxChar* const* labels, const long* values = NULL ) + { + Free(); + Add(labels,values); + } + + // Sets contents from lists of strings and values. + // Version that works with wxArrayString and wxArrayInt. + void Set( const wxArrayString& labels, + const wxArrayInt& values = wxArrayInt() ) + { + Free(); + Add(labels,values); + } + + // Creates exclusive copy of current choices + void AllocExclusive(); + + // Returns data, increases refcount. + wxPGChoicesData* GetData() + { + wxASSERT( m_data->GetRefCount() != -1 ); + m_data->IncRef(); + return m_data; + } + + // Returns plain data ptr - no refcounting stuff is done. + wxPGChoicesData* GetDataPtr() const { return m_data; } + + // Changes ownership of data to you. + wxPGChoicesData* ExtractData() + { + wxPGChoicesData* data = m_data; + m_data = wxPGChoicesEmptyData; + return data; + } + + // Returns array of choice labels. + wxArrayString GetLabels() const; + + void operator= (const wxPGChoices& a) + { + if (this != &a) + AssignData(a.m_data); + } + + wxPGChoiceEntry& operator[](unsigned int i) + { + return Item(i); + } + + const wxPGChoiceEntry& operator[](unsigned int i) const + { + return Item(i); + } + +protected: + wxPGChoicesData* m_data; + + void Init(); + void Free(); +}; + +// ----------------------------------------------------------------------- + +// wxPGProperty is base class for all wxPropertyGrid properties. +class WXDLLIMPEXP_PROPGRID wxPGProperty : public wxObject +{ + friend class wxPropertyGrid; + friend class wxPropertyGridInterface; + friend class wxPropertyGridPageState; + friend class wxPropertyGridPopulator; + + wxDECLARE_ABSTRACT_CLASS(wxPGProperty); +public: + typedef wxUint32 FlagType; + + // Virtual destructor. + // It is customary for derived properties to implement this. + virtual ~wxPGProperty(); + + // This virtual function is called after m_value has been set. + // Remarks: + // - If m_value was set to Null variant (i.e. unspecified value), + // OnSetValue() will not be called. + // - m_value may be of any variant type. Typically properties internally + // support only one variant type, and as such OnSetValue() provides a + // good opportunity to convert + // supported values into internal type. + // - Default implementation does nothing. + virtual void OnSetValue(); + + // Override this to return something else than m_value as the value. + virtual wxVariant DoGetValue() const { return m_value; } + + // Implement this function in derived class to check the value. + // Return true if it is ok. Returning false prevents property change + // events from occurring. + // Remark: Default implementation always returns true. + virtual bool ValidateValue( wxVariant& value, + wxPGValidationInfo& validationInfo ) const; + + // Converts text into wxVariant value appropriate for this property. + // Parameters: + // variant - On function entry this is the old value (should not be + // wxNullVariant in normal cases). Translated value must be assigned + // back to it. + // text - Text to be translated into variant. + // argFlags - If wxPG_FULL_VALUE is set, returns complete, storable value instead + // of displayable one (they may be different). + // If wxPG_COMPOSITE_FRAGMENT is set, text is interpreted as a part of + // composite property string value (as generated by ValueToString() + // called with this same flag). + // Returns true if resulting wxVariant value was different. + // Default implementation converts semicolon delimited tokens into + // child values. Only works for properties with children. + // You might want to take into account that m_value is Null variant + // if property value is unspecified (which is usually only case if + // you explicitly enabled that sort behaviour). + virtual bool StringToValue( wxVariant& variant, + const wxString& text, + int argFlags = 0 ) const; + + // Converts integer (possibly a choice selection) into wxVariant value + // appropriate for this property. + // Parameters: + // variant - On function entry this is the old value (should not be wxNullVariant + // in normal cases). Translated value must be assigned back to it. + // number - Integer to be translated into variant. + // argFlags - If wxPG_FULL_VALUE is set, returns complete, storable value + // instead of displayable one. + // Returns true if resulting wxVariant value was different. + // Remarks + // - If property is not supposed to use choice or spinctrl or other editor + // with int-based value, it is not necessary to implement this method. + // - Default implementation simply assign given int to m_value. + // - If property uses choice control, and displays a dialog on some choice + // items, then it is preferred to display that dialog in IntToValue + // instead of OnEvent. + // - You might want to take into account that m_value is Null variant + // if property value is unspecified (which is usually only case if + // you explicitly enabled that sort behaviour). + virtual bool IntToValue( wxVariant& value, + int number, + int argFlags = 0 ) const; + + // Converts property value into a text representation. + // Parameters: + // value - Value to be converted. + // argFlags - If 0 (default value), then displayed string is returned. + // If wxPG_FULL_VALUE is set, returns complete, storable string value + // instead of displayable. If wxPG_EDITABLE_VALUE is set, returns + // string value that must be editable in textctrl. If + // wxPG_COMPOSITE_FRAGMENT is set, returns text that is appropriate to + // display as a part of string property's composite text + // representation. + // Default implementation calls GenerateComposedValue(). + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; + + // Converts string to a value, and if successful, calls SetValue() on it. + // Default behaviour is to do nothing. + // Returns true if value was changed. + bool SetValueFromString( const wxString& text, int flags = wxPG_PROGRAMMATIC_VALUE ); + + // Converts integer to a value, and if successful, calls SetValue() on it. + // Default behaviour is to do nothing. + // Parameters: + // value - Int to get the value from. + // flags - If has wxPG_FULL_VALUE, then the value given is a actual value + // and not an index. + // Returns true if value was changed. + bool SetValueFromInt( long value, int flags = 0 ); + + // Returns size of the custom painted image in front of property. + // This method must be overridden to return non-default value if + // OnCustomPaint is to be called. + // item - Normally -1, but can be an index to the property's list of items. + // Remarks: + // - Default behaviour is to return wxSize(0,0), which means no image. + // - Default image width or height is indicated with dimension -1. + // - You can also return wxPG_DEFAULT_IMAGE_SIZE, i.e. wxDefaultSize. + virtual wxSize OnMeasureImage( int item = -1 ) const; + + // Events received by editor widgets are processed here. + // Note that editor class usually processes most events. Some, such as + // button press events of TextCtrlAndButton class, can be handled here. + // Also, if custom handling for regular events is desired, then that can + // also be done (for example, wxSystemColourProperty custom handles + // wxEVT_CHOICE to display colour picker dialog when + // 'custom' selection is made). + // If the event causes value to be changed, SetValueInEvent() + // should be called to set the new value. + // event - Associated wxEvent. + // Should return true if any changes in value should be reported. + // If property uses choice control, and displays a dialog on some choice + // items, then it is preferred to display that dialog in IntToValue + // instead of OnEvent. + virtual bool OnEvent( wxPropertyGrid* propgrid, + wxWindow* wnd_primary, + wxEvent& event ); + + // Called after value of a child property has been altered. Must return + // new value of the whole property (after any alterations warranted by + // child's new value). + // Note that this function is usually called at the time that value of + // this property, or given child property, is still pending for change, + // and as such, result of GetValue() or m_value should not be relied + // on. + // Parameters: + // thisValue - Value of this property. Changed value should be returned + // (in previous versions of wxPropertyGrid it was only necessary to + // write value back to this argument). + // childIndex - Index of child changed (you can use Item(childIndex) + // to get child property). + // childValue - (Pending) value of the child property. + // Returns modified value of the whole property. + virtual wxVariant ChildChanged( wxVariant& thisValue, + int childIndex, + wxVariant& childValue ) const; + + // Returns pointer to an instance of used editor. + virtual const wxPGEditor* DoGetEditorClass() const; + + // Returns pointer to the wxValidator that should be used + // with the editor of this property (NULL for no validator). + // Setting validator explicitly via SetPropertyValidator + // will override this. + // You can get common filename validator by returning + // wxFileProperty::GetClassValidator(). wxDirProperty, + // for example, uses it. + virtual wxValidator* DoGetValidator () const; + + // Override to paint an image in front of the property value text or + // drop-down list item (but only if wxPGProperty::OnMeasureImage is + // overridden as well). + // If property's OnMeasureImage() returns size that has height != 0 but + // less than row height ( < 0 has special meanings), wxPropertyGrid calls + // this method to draw a custom image in a limited area in front of the + // editor control or value text/graphics, and if control has drop-down + // list, then the image is drawn there as well (even in the case + // OnMeasureImage() returned higher height than row height). + // NOTE: Following applies when OnMeasureImage() returns a "flexible" + // height ( using wxPG_FLEXIBLE_SIZE(W,H) macro), which implies variable + // height items: If rect.x is < 0, then this is a measure item call, which + // means that dc is invalid and only thing that should be done is to set + // paintdata.m_drawnHeight to the height of the image of item at index + // paintdata.m_choiceItem. This call may be done even as often as once + // every drop-down popup show. + // Parameters: + // dc - wxDC to paint on. + // rect - Box reserved for custom graphics. Includes surrounding rectangle, + // if any. If x is < 0, then this is a measure item call (see above). + // paintdata - wxPGPaintData structure with much useful data. + // Remarks: + // - You can actually exceed rect width, but if you do so then + // paintdata.m_drawnWidth must be set to the full width drawn in + // pixels. + // - Due to technical reasons, rect's height will be default even if + // custom height was reported during measure call. + // - Brush is guaranteed to be default background colour. It has been + // already used to clear the background of area being painted. It + // can be modified. + // - Pen is guaranteed to be 1-wide 'black' (or whatever is the proper + // colour) pen for drawing framing rectangle. It can be changed as + // well. + // See ValueToString() + virtual void OnCustomPaint( wxDC& dc, + const wxRect& rect, + wxPGPaintData& paintdata ); + + // Returns used wxPGCellRenderer instance for given property column + // (label=0, value=1). + // Default implementation returns editor's renderer for all columns. + virtual wxPGCellRenderer* GetCellRenderer( int column ) const; + + // Returns which choice is currently selected. Only applies to properties + // which have choices. + // Needs to be reimplemented in derived class if property value does not + // map directly to a choice. Integer as index, bool, and string usually do. + virtual int GetChoiceSelection() const; + + // Refresh values of child properties. + // Automatically called after value is set. + virtual void RefreshChildren(); + + // Reimplement this member function to add special handling for + // attributes of this property. + // Return false to have the attribute automatically stored in + // m_attributes. Default implementation simply does that and + // nothing else. + // To actually set property attribute values from the + // application, use wxPGProperty::SetAttribute() instead. + virtual bool DoSetAttribute( const wxString& name, wxVariant& value ); + + // Returns value of an attribute. + // Override if custom handling of attributes is needed. + // Default implementation simply return NULL variant. + virtual wxVariant DoGetAttribute( const wxString& name ) const; + + // Returns instance of a new wxPGEditorDialogAdapter instance, which is + // used when user presses the (optional) button next to the editor control; + // Default implementation returns NULL (ie. no action is generated when + // button is pressed). + virtual wxPGEditorDialogAdapter* GetEditorDialog() const; + + // Called whenever validation has failed with given pending value. + // If you implement this in your custom property class, please + // remember to call the baser implementation as well, since they + // may use it to revert property into pre-change state. + virtual void OnValidationFailure( wxVariant& pendingValue ); + + // Append a new choice to property's list of choices. + int AddChoice( const wxString& label, int value = wxPG_INVALID_VALUE ) + { + return InsertChoice(label, wxNOT_FOUND, value); + } + + // Returns true if children of this property are component values (for + // instance, points size, face name, and is_underlined are component + // values of a font). + bool AreChildrenComponents() const + { + return (m_flags & (wxPG_PROP_COMPOSED_VALUE|wxPG_PROP_AGGREGATE)) != 0; + } + + // Deletes children of the property. + void DeleteChildren(); + + // Removes entry from property's wxPGChoices and editor control (if it is + // active). + // If selected item is deleted, then the value is set to unspecified. + void DeleteChoice( int index ); + + // Enables or disables the property. Disabled property usually appears + // as having grey text. + // See wxPropertyGridInterface::EnableProperty() + void Enable( bool enable = true ); + + // Call to enable or disable usage of common value (integer value that can + // be selected for properties instead of their normal values) for this + // property. + // Common values are disabled by the default for all properties. + void EnableCommonValue( bool enable = true ) + { + ChangeFlag(wxPG_PROP_USES_COMMON_VALUE, enable); + } + + // Composes text from values of child properties. + wxString GenerateComposedValue() const + { + wxString s; + DoGenerateComposedValue(s); + return s; + } + + // Returns property's label. + const wxString& GetLabel() const { return m_label; } + + // Returns property's name with all (non-category, non-root) parents. + wxString GetName() const; + + // Returns property's base name (i.e. parent's name is not added + // in any case). + const wxString& GetBaseName() const { return m_name; } + + // Returns read-only reference to property's list of choices. + const wxPGChoices& GetChoices() const + { + return m_choices; + } + + // Returns coordinate to the top y of the property. Note that the + // position of scrollbars is not taken into account. + int GetY() const; + + // Returns property's value. + wxVariant GetValue() const + { + return DoGetValue(); + } + + // Returns reference to the internal stored value. GetValue is preferred + // way to get the actual value, since GetValueRef ignores DoGetValue, + // which may override stored value. + wxVariant& GetValueRef() + { + return m_value; + } + + const wxVariant& GetValueRef() const + { + return m_value; + } + + // Helper function (for wxPython bindings and such) for settings protected + // m_value. + wxVariant GetValuePlain() const + { + return m_value; + } + + // Returns text representation of property's value. + // argFlags - If 0 (default value), then displayed string is returned. + // If wxPG_FULL_VALUE is set, returns complete, storable string value + // instead of displayable. If wxPG_EDITABLE_VALUE is set, returns + // string value that must be editable in textctrl. If + // wxPG_COMPOSITE_FRAGMENT is set, returns text that is appropriate to + // display as a part of string property's composite text + // representation. + // In older versions, this function used to be overridden to convert + // property's value into a string representation. This function is + // now handled by ValueToString(), and overriding this function now + // will result in run-time assertion failure. + virtual wxString GetValueAsString( int argFlags = 0 ) const; + +#if wxPG_COMPATIBILITY_1_4 + // Synonymous to GetValueAsString(). + wxDEPRECATED( wxString GetValueString( int argFlags = 0 ) const ); +#endif + + // Returns wxPGCell of given column. + // Const version of this member function returns 'default' + // wxPGCell object if the property itself didn't hold + // cell data. + const wxPGCell& GetCell( unsigned int column ) const; + + // Returns wxPGCell of given column, creating one if necessary. + wxPGCell& GetCell( unsigned int column ) + { + return GetOrCreateCell(column); + } + + // Returns wxPGCell of given column, creating one if necessary. + wxPGCell& GetOrCreateCell( unsigned int column ); + + // Return number of displayed common values for this property. + int GetDisplayedCommonValueCount() const; + + // Returns property's displayed text. + wxString GetDisplayedString() const + { + return GetValueAsString(0); + } + + // Returns property's hint text (shown in empty value cell). + wxString GetHintText() const; + + // Returns property grid where property lies. + wxPropertyGrid* GetGrid() const; + + // Returns owner wxPropertyGrid, but only if one is currently + // on a page displaying this property. + wxPropertyGrid* GetGridIfDisplayed() const; + + // Returns highest level non-category, non-root parent. Useful when you + // have nested properties with children. + // Thus, if immediate parent is root or category, this will return the + // property itself. + wxPGProperty* GetMainParent() const; + + // Return parent of property. + wxPGProperty* GetParent() const { return m_parent; } + + // Returns true if property has editable wxTextCtrl when selected. + // Although disabled properties do not displayed editor, they still + // Returns true here as being disabled is considered a temporary + // condition (unlike being read-only or having limited editing enabled). + bool IsTextEditable() const; + + // Returns true if property's value is considered unspecified. + // This usually means that value is Null variant. + bool IsValueUnspecified() const + { + return m_value.IsNull(); + } + +#if WXWIN_COMPATIBILITY_3_0 + // Returns non-zero if property has given flag set. + FlagType HasFlag( wxPGPropertyFlags flag ) const + { + return ( m_flags & flag ); + } +#else + // Returns true if property has given flag set. + bool HasFlag(wxPGPropertyFlags flag) const + { + return (m_flags & flag) != 0; + } +#endif + // Returns true if property has given flag set. + bool HasFlag(FlagType flag) const + { + return (m_flags & flag) != 0; + } + + // Returns true if property has all given flags set. + bool HasFlagsExact(FlagType flags) const + { + return (m_flags & flags) == flags; + } + + // Returns comma-delimited string of property attributes. + const wxPGAttributeStorage& GetAttributes() const + { + return m_attributes; + } + + // Returns m_attributes as list wxVariant. + wxVariant GetAttributesAsList() const; + +#if WXWIN_COMPATIBILITY_3_0 + // Returns property flags. + wxDEPRECATED_MSG("Use HasFlag or HasFlagsExact functions instead.") + FlagType GetFlags() const + { + return m_flags; + } +#endif + + // Returns wxPGEditor that will be used and created when + // property becomes selected. Returns more accurate value + // than DoGetEditorClass(). + const wxPGEditor* GetEditorClass() const; + + // Returns value type used by this property. + wxString GetValueType() const + { + return m_value.GetType(); + } + + // Returns editor used for given column. NULL for no editor. + const wxPGEditor* GetColumnEditor( int column ) const + { + return column == 1 ? GetEditorClass() : NULL; + } + + // Returns common value selected for this property. -1 for none. + int GetCommonValue() const + { + return m_commonValue; + } + + // Returns true if property has even one visible child. + bool HasVisibleChildren() const; + + // Use this member function to add independent (i.e. regular) children to + // a property. + // Returns inserted childProperty. + // wxPropertyGrid is not automatically refreshed by this function. + wxPGProperty* InsertChild( int index, wxPGProperty* childProperty ); + + // Inserts a new choice to property's list of choices. + int InsertChoice( const wxString& label, int index, int value = wxPG_INVALID_VALUE ); + + // Returns true if this property is actually a wxPropertyCategory. + bool IsCategory() const { return (m_flags & wxPG_PROP_CATEGORY) != 0; } + + // Returns true if this property is actually a wxRootProperty. + bool IsRoot() const { return (m_parent == NULL); } + + // Returns true if this is a sub-property. + bool IsSubProperty() const + { + wxPGProperty* parent = m_parent; + if ( parent && !parent->IsCategory() ) + return true; + return false; + } + + // Returns last visible sub-property, recursively. + const wxPGProperty* GetLastVisibleSubItem() const; + + // Returns property's default value. If property's value type is not + // a built-in one, and "DefaultValue" attribute is not defined, then + // this function usually returns Null variant. + wxVariant GetDefaultValue() const; + + // Returns maximum allowed length of the text the user can enter in + // the property text editor. + int GetMaxLength() const + { + return m_maxLen; + } + + // Determines, recursively, if all children are not unspecified. + // pendingList - Assumes members in this wxVariant list as pending + // replacement values. + bool AreAllChildrenSpecified( const wxVariant* pendingList = NULL ) const; + + // Updates composed values of parent non-category properties, recursively. + // Returns topmost property updated. + // Must not call SetValue() (as can be called in it). + wxPGProperty* UpdateParentValues(); + + // Returns true if containing grid uses wxPG_EX_AUTO_UNSPECIFIED_VALUES. + bool UsesAutoUnspecified() const + { + return (m_flags & wxPG_PROP_AUTO_UNSPECIFIED) != 0; + } + + // Returns bitmap that appears next to value text. Only returns non-@NULL + // bitmap if one was set with SetValueImage(). + wxBitmap* GetValueImage() const; + + // Returns property attribute value, null variant if not found. + wxVariant GetAttribute( const wxString& name ) const; + + // Returns named attribute, as string, if found. + // Otherwise defVal is returned. + wxString GetAttribute( const wxString& name, const wxString& defVal ) const; + + // Returns named attribute, as long, if found. + // Otherwise defVal is returned. + long GetAttributeAsLong( const wxString& name, long defVal ) const; + + // Returns named attribute, as double, if found. + // Otherwise defVal is returned. + double GetAttributeAsDouble( const wxString& name, double defVal ) const; + + unsigned int GetDepth() const { return (unsigned int)m_depth; } + + // Gets flags as a'|' delimited string. Note that flag names are not + // prepended with 'wxPG_PROP_'. + // flagmask - String will only be made to include flags combined by this parameter. + wxString GetFlagsAsString( FlagType flagsMask ) const; + + // Returns position in parent's array. + unsigned int GetIndexInParent() const + { + return m_arrIndex; + } + + // Hides or reveals the property. + // hide - true for hide, false for reveal. + // flags - By default changes are applied recursively. Set this + // parameter to wxPG_DONT_RECURSE to prevent this. + bool Hide( bool hide, int flags = wxPG_RECURSE ); + + // Returns true if property has visible children. + bool IsExpanded() const + { return (!(m_flags & wxPG_PROP_COLLAPSED) && GetChildCount()); } + + // Returns true if all parents expanded. + bool IsVisible() const; + + // Returns true if property is enabled. + bool IsEnabled() const { return !(m_flags & wxPG_PROP_DISABLED); } + + // If property's editor is created this forces its recreation. + // Useful in SetAttribute etc. Returns true if actually did anything. + bool RecreateEditor(); + + // If property's editor is active, then update its value. + void RefreshEditor(); + + // Sets an attribute for this property. + // name - Text identifier of attribute. See @ref propgrid_property_attributes. + // value - Value of attribute. + // Setting attribute's value to Null variant will simply remove it + // from property's set of attributes. + void SetAttribute( const wxString& name, wxVariant value ); + + void SetAttributes( const wxPGAttributeStorage& attributes ); + + // Set if user can change the property's value to unspecified by + // modifying the value of the editor control (usually by clearing + // it). Currently, this can work with following properties: + // wxIntProperty, wxUIntProperty, wxFloatProperty, wxEditEnumProperty. + // enable - Whether to enable or disable this behaviour (it is disabled + // by default). + void SetAutoUnspecified( bool enable = true ) + { + ChangeFlag(wxPG_PROP_AUTO_UNSPECIFIED, enable); + } + + // Sets property's background colour. + // colour - Background colour to use. + // flags - Default is wxPG_RECURSE which causes colour to be set recursively. + // Omit this flag to only set colour for the property in question + // and not any of its children. + void SetBackgroundColour( const wxColour& colour, + int flags = wxPG_RECURSE ); + + // Sets property's text colour. + // colour - Text colour to use. + // flags - Default is wxPG_RECURSE which causes colour to be set recursively. + // Omit this flag to only set colour for the property in question + // and not any of its children. + void SetTextColour( const wxColour& colour, + int flags = wxPG_RECURSE ); + + // Sets property's default text and background colours. + // flags - Default is wxPG_RECURSE which causes colours to be set recursively. + // Omit this flag to only set colours for the property in question + // and not any of its children. + void SetDefaultColours(int flags = wxPG_RECURSE); + + // Set default value of a property. Synonymous to + // SetAttribute("DefaultValue", value); + void SetDefaultValue( wxVariant& value ); + + // Sets editor for a property. + // editor - For builtin editors, use wxPGEditor_X, where X is builtin editor's + // name (TextCtrl, Choice, etc. see wxPGEditor documentation for full + // list). + // For custom editors, use pointer you received from + // wxPropertyGrid::RegisterEditorClass(). + void SetEditor( const wxPGEditor* editor ) + { + m_customEditor = editor; + } + + // Sets editor for a property, , by editor name. + void SetEditor( const wxString& editorName ); + + // Sets cell information for given column. + void SetCell( int column, const wxPGCell& cell ); + + // Sets common value selected for this property. -1 for none. + void SetCommonValue( int commonValue ) + { + m_commonValue = commonValue; + } + + // Sets flags from a '|' delimited string. Note that flag names are not + // prepended with 'wxPG_PROP_'. + void SetFlagsFromString( const wxString& str ); + + // Sets property's "is it modified?" flag. Affects children recursively. + void SetModifiedStatus( bool modified ) + { + SetFlagRecursively(wxPG_PROP_MODIFIED, modified); + } + + // Call in OnEvent(), OnButtonClick() etc. to change the property value + // based on user input. + // This method is const since it doesn't actually modify value, but posts + // given variant as pending value, stored in wxPropertyGrid. + void SetValueInEvent( const wxVariant& value ) const; + + // Call this to set value of the property. + // Unlike methods in wxPropertyGrid, this does not automatically update + // the display. + // Use wxPropertyGrid::ChangePropertyValue() instead if you need to run + // through validation process and send property change event. + // If you need to change property value in event, based on user input, use + // SetValueInEvent() instead. + // pList - Pointer to list variant that contains child values. Used to + // indicate which children should be marked as modified. + // flags - Various flags (for instance, wxPG_SETVAL_REFRESH_EDITOR, which + // is enabled by default). + void SetValue( wxVariant value, wxVariant* pList = NULL, + int flags = wxPG_SETVAL_REFRESH_EDITOR ); + + // Set wxBitmap in front of the value. This bitmap may be ignored + // by custom cell renderers. + void SetValueImage( const wxBitmapBundle& bmp ); + + // Sets selected choice and changes property value. + // Tries to retain value type, although currently if it is not string, + // then it is forced to integer. + void SetChoiceSelection( int newValue ); + + void SetExpanded( bool expanded ) + { + ChangeFlag(wxPG_PROP_COLLAPSED, !expanded); + } + + // Sets or clears given property flag. Mainly for internal use. + // Setting a property flag never has any side-effect, and is + // intended almost exclusively for internal use. So, for + // example, if you want to disable a property, call + // Enable(false) instead of setting wxPG_PROP_DISABLED flag. + void ChangeFlag( wxPGPropertyFlags flag, bool set ) + { + if ( set ) + m_flags |= flag; + else + m_flags &= ~flag; + } + + // Sets or clears given property flag, recursively. This function is + // primarily intended for internal use. + void SetFlagRecursively( wxPGPropertyFlags flag, bool set ); + + // Sets property's help string, which is shown, for example, in + // wxPropertyGridManager's description text box. + void SetHelpString( const wxString& helpString ) + { + m_helpString = helpString; + } + + // Sets property's label. + // Properties under same parent may have same labels. However, + // property names must still remain unique. + void SetLabel( const wxString& label ); + + // Sets new (base) name for property. + void SetName( const wxString& newName ); + + // Changes what sort of parent this property is for its children. + // flag - Use one of the following values: wxPG_PROP_MISC_PARENT (for + // generic parents), wxPG_PROP_CATEGORY (for categories), or + // wxPG_PROP_AGGREGATE (for derived property classes with private + // children). + // You generally do not need to call this function. + void SetParentalType( int flag ) + { + m_flags &= ~(wxPG_PROP_PROPERTY|wxPG_PROP_PARENTAL_FLAGS); + m_flags |= flag; + } + + // Sets property's value to unspecified (i.e. Null variant). + void SetValueToUnspecified() + { + wxVariant val; // Create NULL variant + SetValue(val, NULL, wxPG_SETVAL_REFRESH_EDITOR); + } + + // Helper function (for wxPython bindings and such) for settings protected + // m_value. + void SetValuePlain( const wxVariant& value ) + { + m_value = value; + } + +#if wxUSE_VALIDATORS + // Sets wxValidator for a property. + void SetValidator( const wxValidator& validator ) + { + m_validator = wxDynamicCast(validator.Clone(),wxValidator); + } + + // Gets assignable version of property's validator. + wxValidator* GetValidator() const + { + return m_validator ? m_validator : DoGetValidator(); + } +#endif // wxUSE_VALIDATORS + + // Returns client data (void*) of a property. + void* GetClientData() const + { + return m_clientData; + } + + // Sets client data (void*) of a property. + // This untyped client data has to be deleted manually. + void SetClientData( void* clientData ) + { + m_clientData = clientData; + } + + // Sets client object of a property. + void SetClientObject(wxClientData* clientObject) + { + delete m_clientObject; + m_clientObject = clientObject; + } + + // Gets managed client object of a property. + wxClientData *GetClientObject() const { return m_clientObject; } + + // Sets new set of choices for the property. + // This operation deselects the property and clears its + // value. + bool SetChoices( const wxPGChoices& choices ); + + // Set max length of text in text editor. + bool SetMaxLength( int maxLen ); + + // Call with 'false' in OnSetValue to cancel value changes after all + // (i.e. cancel 'true' returned by StringToValue() or IntToValue()). + void SetWasModified( bool set = true ) + { + ChangeFlag(wxPG_PROP_WAS_MODIFIED, set); + } + + // Returns property's help or description text. + const wxString& GetHelpString() const + { + return m_helpString; + } + + // Returns true if candidateParent is some parent of this property. + // Use, for example, to detect if item is inside collapsed section. + bool IsSomeParent( wxPGProperty* candidate_parent ) const; + + // Adapts list variant into proper value using consecutive + // ChildChanged-calls. + void AdaptListToValue( wxVariant& list, wxVariant* value ) const; + +#if wxPG_COMPATIBILITY_1_4 + // Adds a private child property. + // Use AddPrivateChild() instead. + wxDEPRECATED( void AddChild( wxPGProperty* prop ) ); +#endif + + // Adds a private child property. If you use this instead of + // wxPropertyGridInterface::Insert() or + // wxPropertyGridInterface::AppendIn(), then property's parental + // type will automatically be set up to wxPG_PROP_AGGREGATE. In other + // words, all properties of this property will become private. + void AddPrivateChild( wxPGProperty* prop ); + + // Use this member function to add independent (i.e. regular) children to + // a property. + // wxPropertyGrid is not automatically refreshed by this function. + wxPGProperty* AppendChild( wxPGProperty* prop ) + { + return InsertChild(-1, prop); + } + + // Returns height of children, recursively, and + // by taking expanded/collapsed status into account. + // lh - Line height. Pass result of GetGrid()->GetRowHeight() here. + // iMax - Only used (internally) when finding property y-positions. + int GetChildrenHeight( int lh, int iMax = -1 ) const; + + // Returns number of child properties. + unsigned int GetChildCount() const + { + return (unsigned int) m_children.size(); + } + + // Returns sub-property at index i. + wxPGProperty* Item( unsigned int i ) const + { return m_children[i]; } + + // Returns last sub-property. + wxPGProperty* Last() const { return m_children.back(); } + + // Returns index of given child property. wxNOT_FOUND if + // given property is not child of this. + int Index( const wxPGProperty* p ) const; + + // Puts correct indexes to children + void FixIndicesOfChildren( unsigned int starthere = 0 ); + + // Converts image width into full image offset, with margins. + int GetImageOffset( int imageWidth ) const; + + // Returns wxPropertyGridPageState in which this property resides. + wxPropertyGridPageState* GetParentState() const { return m_parentState; } + + wxPGProperty* GetItemAtY( unsigned int y, + unsigned int lh, + unsigned int* nextItemY ) const; + + // Returns property at given virtual y coordinate. + wxPGProperty* GetItemAtY( unsigned int y ) const; + + // Returns (direct) child property with given name (or NULL if not found). + wxPGProperty* GetPropertyByName( const wxString& name ) const; + + // Returns various display-related information for given column +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_MSG("don't use GetDisplayInfo function with argument of 'const wxPGCell**' type. Use 'wxPGCell*' argument instead") + void GetDisplayInfo( unsigned int column, + int choiceIndex, + int flags, + wxString* pString, + const wxPGCell** pCell ); +#endif // WXWIN_COMPATIBILITY_3_0 + // This function can return modified (customized) cell object. + void GetDisplayInfo( unsigned int column, + int choiceIndex, + int flags, + wxString* pString, + wxPGCell* pCell ); + + static wxString* sm_wxPG_LABEL; + + // This member is public so scripting language bindings + // wrapper code can access it freely. + void* m_clientData; + +protected: + + // Ctors are ptotected because wxPGProperty is only a base class + // for all property classes and shouldn't be instantiated directly. + wxPGProperty(); + // All non-abstract property classes should have a constructor with + // the same first two arguments as this one. + wxPGProperty(const wxString& label, const wxString& name); + + // Sets property cell in fashion that reduces number of exclusive + // copies of cell data. Used when setting, for instance, same + // background colour for a number of properties. + // firstCol - First column to affect. + // lastCol- Last column to affect. + // preparedCell - Pre-prepared cell that is used for those which cell data + // before this matched unmodCellData. + // srcData - If unmodCellData did not match, valid cell data from this + // is merged into cell (usually generating new exclusive copy + // of cell's data). + // unmodCellData - If cell's cell data matches this, its cell is now set to + // preparedCell. + // ignoreWithFlags - Properties with any one of these flags are skipped. + // recursively - If true, apply this operation recursively in child properties. + void AdaptiveSetCell( unsigned int firstCol, + unsigned int lastCol, + const wxPGCell& preparedCell, + const wxPGCell& srcData, + wxPGCellData* unmodCellData, + FlagType ignoreWithFlags, + bool recursively ); + + // Clear cells associated with property. + // recursively - If true, apply this operation recursively in child properties. + void ClearCells(FlagType ignoreWithFlags, bool recursively); + + // Makes sure m_cells has size of column+1 (or more). + void EnsureCells( unsigned int column ); + + // Returns (direct) child property with given name (or NULL if not found), + // with hint index. + // hintIndex - Start looking for the child at this index. + // Does not support scope (i.e. Parent.Child notation). + wxPGProperty* GetPropertyByNameWH( const wxString& name, + unsigned int hintIndex ) const; + + // This is used by Insert etc. + void DoAddChild( wxPGProperty* prop, + int index = -1, + bool correct_mode = true ); + + void DoGenerateComposedValue( wxString& text, + int argFlags = wxPG_VALUE_IS_CURRENT, + const wxVariantList* valueOverrides = NULL, + wxPGHashMapS2S* childResults = NULL ) const; + + bool DoHide( bool hide, int flags ); + + void DoSetName(const wxString& str) { m_name = str; } + + // Deletes all sub-properties. + void Empty(); + + bool HasCell( unsigned int column ) const + { + return m_cells.size() > column; + } + + void InitAfterAdded( wxPropertyGridPageState* pageState, + wxPropertyGrid* propgrid ); + + // Returns true if child property is selected. + bool IsChildSelected( bool recursive = false ) const; + + // Removes child property with given pointer. Does not delete it. + void RemoveChild( wxPGProperty* p ); + + // Removes child property at given index. Does not delete it. + void RemoveChild(unsigned int index); + + // Sorts children using specified comparison function. + void SortChildren(int (*fCmp)(wxPGProperty**, wxPGProperty**)); + + void DoEnable( bool enable ); + + void DoPreAddChild( int index, wxPGProperty* prop ); + + void SetParentState( wxPropertyGridPageState* pstate ) + { m_parentState = pstate; } + + void SetFlag( wxPGPropertyFlags flag ) + { + // + // NB: While using wxPGPropertyFlags here makes it difficult to + // combine different flags, it usefully prevents user from + // using incorrect flags (say, wxWindow styles). + m_flags |= flag; + } + + void ClearFlag( FlagType flag ) { m_flags &= ~(flag); } + + // Called when the property is being removed from the grid and/or + // page state (but *not* when it is also deleted). + void OnDetached(wxPropertyGridPageState* state, + wxPropertyGrid* propgrid); + + // Call after fixed sub-properties added/removed after creation. + // if oldSelInd >= 0 and < new max items, then selection is + // moved to it. + void SubPropsChanged( int oldSelInd = -1 ); + + int GetY2( int lh ) const; + + wxString m_label; + wxString m_name; + wxPGProperty* m_parent; + wxPropertyGridPageState* m_parentState; + + wxClientData* m_clientObject; + + // Overrides editor returned by property class + const wxPGEditor* m_customEditor; +#if wxUSE_VALIDATORS + // Editor is going to get this validator + wxValidator* m_validator; +#endif + // Show this in front of the value + // + // TODO: Can bitmap be implemented with wxPGCell? + wxBitmapBundle m_valueBitmapBundle; + mutable wxBitmap m_valueBitmap; + + wxVariant m_value; + wxPGAttributeStorage m_attributes; + wxVector<wxPGProperty*> m_children; + + // Extended cell information + wxVector<wxPGCell> m_cells; + + // Choices shown in drop-down list of editor control. + wxPGChoices m_choices; + + // Help shown in statusbar or help box. + wxString m_helpString; + + // Index in parent's property array. + unsigned int m_arrIndex; + + // If not -1, then overrides m_value + int m_commonValue; + + FlagType m_flags; + + // Maximum length (for string properties). Could be in some sort of + // wxBaseStringProperty, but currently, for maximum flexibility and + // compatibility, we'll stick it here. + int m_maxLen; + + // Root has 0, categories etc. at that level 1, etc. + unsigned char m_depth; + + // m_depthBgCol indicates width of background colour between margin and item + // (essentially this is category's depth, if none then equals m_depth). + unsigned char m_depthBgCol; + +private: + // Called in constructors. + void Init(); + void Init( const wxString& label, const wxString& name ); +}; + +// ----------------------------------------------------------------------- + +// +// Property class declaration helper macros +// (wxPGRootPropertyClass and wxPropertyCategory require this). +// + +#define WX_PG_DECLARE_DOGETEDITORCLASS \ + virtual const wxPGEditor* DoGetEditorClass() const wxOVERRIDE; + +#ifndef WX_PG_DECLARE_PROPERTY_CLASS + #define WX_PG_DECLARE_PROPERTY_CLASS(CLASSNAME) \ + public: \ + wxDECLARE_DYNAMIC_CLASS(CLASSNAME); \ + WX_PG_DECLARE_DOGETEDITORCLASS \ + private: +#endif + +// Implements sans constructor function. Also, first arg is class name, not +// property name. +#define wxPG_IMPLEMENT_PROPERTY_CLASS_PLAIN(PROPNAME, EDITOR) \ +const wxPGEditor* PROPNAME::DoGetEditorClass() const \ +{ \ + return wxPGEditor_##EDITOR; \ +} + +#if WXWIN_COMPATIBILITY_3_0 +// This macro is deprecated. Use wxPG_IMPLEMENT_PROPERTY_CLASS_PLAIN instead. +#define WX_PG_IMPLEMENT_PROPERTY_CLASS_PLAIN(PROPNAME,T,EDITOR) \ +wxPG_IMPLEMENT_PROPERTY_CLASS_PLAIN(PROPNAME, EDITOR) +#endif // WXWIN_COMPATIBILITY_3_0 + +// ----------------------------------------------------------------------- + +// Root parent property. +class WXDLLIMPEXP_PROPGRID wxPGRootProperty : public wxPGProperty +{ +public: + WX_PG_DECLARE_PROPERTY_CLASS(wxPGRootProperty) +public: + + // Constructor. + wxPGRootProperty( const wxString& name = wxS("<Root>") ); + virtual ~wxPGRootProperty(); + + virtual bool StringToValue( wxVariant&, const wxString&, int ) const wxOVERRIDE + { + return false; + } + +protected: +}; + +// ----------------------------------------------------------------------- + +// Category (caption) property. +class WXDLLIMPEXP_PROPGRID wxPropertyCategory : public wxPGProperty +{ + friend class wxPropertyGridPageState; + WX_PG_DECLARE_PROPERTY_CLASS(wxPropertyCategory) +public: + + // Default constructor is only used in special cases. + wxPropertyCategory(); + + wxPropertyCategory( const wxString& label, + const wxString& name = wxPG_LABEL ); + ~wxPropertyCategory(); + + int GetTextExtent( const wxWindow* wnd, const wxFont& font ) const; + + virtual wxString ValueToString( wxVariant& value, int argFlags ) const wxOVERRIDE; + virtual wxString GetValueAsString( int argFlags = 0 ) const wxOVERRIDE; + +protected: + void SetTextColIndex( unsigned int colInd ) + { m_capFgColIndex = (wxByte) colInd; } + unsigned int GetTextColIndex() const + { return (unsigned int) m_capFgColIndex; } + + void CalculateTextExtent(const wxWindow* wnd, const wxFont& font); + + int m_textExtent; // pre-calculated length of text + wxByte m_capFgColIndex; // caption text colour index + +private: + void Init(); +}; + +// ----------------------------------------------------------------------- + +#endif // wxUSE_PROPGRID + +#endif // _WX_PROPGRID_PROPERTY_H_ diff --git a/lib/wxWidgets/include/wx/propgrid/propgrid.h b/lib/wxWidgets/include/wx/propgrid/propgrid.h new file mode 100644 index 0000000..b828131 --- /dev/null +++ b/lib/wxWidgets/include/wx/propgrid/propgrid.h @@ -0,0 +1,2278 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/propgrid/propgrid.h +// Purpose: wxPropertyGrid +// Author: Jaakko Salli +// Modified by: +// Created: 2004-09-25 +// Copyright: (c) Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PROPGRID_PROPGRID_H_ +#define _WX_PROPGRID_PROPGRID_H_ + +#include "wx/defs.h" + +#if wxUSE_PROPGRID + +#include "wx/scrolwin.h" +#include "wx/recguard.h" +#include "wx/time.h" // needed for wxMilliClock_t + +#include "wx/propgrid/property.h" +#include "wx/propgrid/propgridiface.h" + + +#ifndef SWIG +extern WXDLLIMPEXP_DATA_PROPGRID(const char) wxPropertyGridNameStr[]; +#endif + +class wxPGComboBox; + +#if wxUSE_STATUSBAR +class WXDLLIMPEXP_FWD_CORE wxStatusBar; +#endif + +// ----------------------------------------------------------------------- +// Global variables +// ----------------------------------------------------------------------- + +// This is required for sharing common global variables. +class WXDLLIMPEXP_PROPGRID wxPGGlobalVarsClass +{ +public: + + wxPGGlobalVarsClass(); + ~wxPGGlobalVarsClass(); + +#if wxUSE_THREADS + // Critical section for handling the globals. Generally it is not needed + // since GUI code is supposed to be in single thread. However, + // we do want the user to be able to convey wxPropertyGridEvents to other + // threads. + wxCriticalSection m_critSect; +#endif + + // Used by advprops, but here to make things easier. + wxString m_pDefaultImageWildcard; + + // Map of editor class instances (keys are name string). + wxPGHashMapS2P m_mapEditorClasses; + +#if wxUSE_VALIDATORS + wxVector<wxValidator*> m_arrValidators; // These wxValidators need to be freed +#endif + + wxPGHashMapS2P m_dictPropertyClassInfo; // PropertyName -> ClassInfo + + wxPGChoices* m_fontFamilyChoices; + + // Replace with your own to affect all properties using default renderer. + wxPGCellRenderer* m_defaultRenderer; + + wxPGChoices m_boolChoices; + + // Some shared variants +#if WXWIN_COMPATIBILITY_3_0 + wxVariant m_vEmptyString; + wxVariant m_vZero; + wxVariant m_vMinusOne; + wxVariant m_vTrue; + wxVariant m_vFalse; +#else + const wxVariant m_vEmptyString; + const wxVariant m_vZero; + const wxVariant m_vMinusOne; + const wxVariant m_vTrue; + const wxVariant m_vFalse; +#endif // WXWIN_COMPATIBILITY_3_0 + + // Cached constant strings +#if WXWIN_COMPATIBILITY_3_0 + wxPGCachedString m_strstring; + wxPGCachedString m_strlong; + wxPGCachedString m_strbool; + wxPGCachedString m_strlist; + + wxPGCachedString m_strDefaultValue; + wxPGCachedString m_strMin; + wxPGCachedString m_strMax; + wxPGCachedString m_strUnits; + wxPGCachedString m_strHint; +#else + const wxString m_strstring; + const wxString m_strlong; + const wxString m_strbool; + const wxString m_strlist; + + const wxString m_strDefaultValue; + const wxString m_strMin; + const wxString m_strMax; + const wxString m_strUnits; + const wxString m_strHint; +#endif // WXWIN_COMPATIBILITY_3_0 + +#if wxPG_COMPATIBILITY_1_4 + wxPGCachedString m_strInlineHelp; +#endif + + // If true then some things are automatically translated + bool m_autoGetTranslation; + + // > 0 if errors cannot or should not be shown in statusbar etc. + int m_offline; + + int m_extraStyle; // global extra style + + int m_warnings; + + int HasExtraStyle( int style ) const { return (m_extraStyle & style); } +}; + +extern WXDLLIMPEXP_DATA_PROPGRID(wxPGGlobalVarsClass*) wxPGGlobalVars; + +#define wxPGVariant_EmptyString (wxPGGlobalVars->m_vEmptyString) +#define wxPGVariant_Zero (wxPGGlobalVars->m_vZero) +#define wxPGVariant_MinusOne (wxPGGlobalVars->m_vMinusOne) +#define wxPGVariant_True (wxPGGlobalVars->m_vTrue) +#define wxPGVariant_False (wxPGGlobalVars->m_vFalse) + +#define wxPGVariant_Bool(A) (A?wxPGVariant_True:wxPGVariant_False) + +// When wxPG is loaded dynamically after the application is already running +// then the built-in module system won't pick this one up. Add it manually. +WXDLLIMPEXP_PROPGRID void wxPGInitResourceModule(); + +// ----------------------------------------------------------------------- + +// SetWindowStyleFlag method can be used to modify some of these at run-time. +enum wxPG_WINDOW_STYLES +{ + +// This will cause Sort() automatically after an item is added. +// When inserting a lot of items in this mode, it may make sense to +// use Freeze() before operations and Thaw() afterwards to increase +// performance. +wxPG_AUTO_SORT = 0x00000010, + +// Categories are not initially shown (even if added). +// IMPORTANT NOTE: If you do not plan to use categories, then this +// style will waste resources. +// This flag can also be changed using wxPropertyGrid::EnableCategories method. +wxPG_HIDE_CATEGORIES = 0x00000020, + +// This style combines non-categoric mode and automatic sorting. +wxPG_ALPHABETIC_MODE = (wxPG_HIDE_CATEGORIES|wxPG_AUTO_SORT), + +// Modified values are shown in bold font. Changing this requires Refresh() +// to show changes. +wxPG_BOLD_MODIFIED = 0x00000040, + +// When wxPropertyGrid is resized, splitter moves to the center. This +// behaviour stops once the user manually moves the splitter. +wxPG_SPLITTER_AUTO_CENTER = 0x00000080, + +// Display tooltips for cell text that cannot be shown completely. If +// wxUSE_TOOLTIPS is 0, then this doesn't have any effect. +wxPG_TOOLTIPS = 0x00000100, + +// Disables margin and hides all expand/collapse buttons that would appear +// outside the margin (for sub-properties). Toggling this style automatically +// expands all collapsed items. +wxPG_HIDE_MARGIN = 0x00000200, + +// This style prevents user from moving the splitter. +wxPG_STATIC_SPLITTER = 0x00000400, + +// Combination of other styles that make it impossible for user to modify +// the layout. +wxPG_STATIC_LAYOUT = (wxPG_HIDE_MARGIN|wxPG_STATIC_SPLITTER), + +// Disables wxTextCtrl based editors for properties which +// can be edited in another way. +// Equals calling wxPropertyGrid::LimitPropertyEditing for all added +// properties. +wxPG_LIMITED_EDITING = 0x00000800, + +// wxPropertyGridManager only: Show toolbar for mode and page selection. +wxPG_TOOLBAR = 0x00001000, + +// wxPropertyGridManager only: Show adjustable text box showing description +// or help text, if available, for currently selected property. +wxPG_DESCRIPTION = 0x00002000, + +// wxPropertyGridManager only: don't show an internal border around the +// property grid. Recommended if you use a header. +wxPG_NO_INTERNAL_BORDER = 0x00004000, + +// A mask which can be used to filter (out) all styles. +wxPG_WINDOW_STYLE_MASK = wxPG_AUTO_SORT|wxPG_HIDE_CATEGORIES|wxPG_BOLD_MODIFIED| + wxPG_SPLITTER_AUTO_CENTER|wxPG_TOOLTIPS|wxPG_HIDE_MARGIN| + wxPG_STATIC_SPLITTER|wxPG_LIMITED_EDITING|wxPG_TOOLBAR| + wxPG_DESCRIPTION|wxPG_NO_INTERNAL_BORDER +}; + +#if wxPG_COMPATIBILITY_1_4 + // In wxPG 1.4 this was used to enable now-default theme border support + // in wxPropertyGridManager. + #define wxPG_THEME_BORDER 0x00000000 +#endif + + +// NOTE: wxPG_EX_xxx are extra window styles and must be set using +// SetExtraStyle() member function. +enum wxPG_EX_WINDOW_STYLES +{ +// Speeds up switching to wxPG_HIDE_CATEGORIES mode. Initially, if +// wxPG_HIDE_CATEGORIES is not defined, the non-categorized data storage is +// not activated, and switching the mode first time becomes somewhat slower. +// wxPG_EX_INIT_NOCAT activates the non-categorized data storage right away. +// NOTE: If you do plan not switching to non-categoric mode, or if +// you don't plan to use categories at all, then using this style will result +// in waste of resources. +wxPG_EX_INIT_NOCAT = 0x00001000, + +// Extended window style that sets wxPropertyGridManager toolbar to not +// use flat style. +wxPG_EX_NO_FLAT_TOOLBAR = 0x00002000, + +// Shows alphabetic/categoric mode buttons from toolbar. +wxPG_EX_MODE_BUTTONS = 0x00008000, + +// Show property help strings as tool tips instead as text on the status bar. +// You can set the help strings using SetPropertyHelpString member function. +wxPG_EX_HELP_AS_TOOLTIPS = 0x00010000, + +// Prevent TAB from focusing to wxButtons. This behaviour was default +// in version 1.2.0 and earlier. +// NOTE! Tabbing to button doesn't work yet. Problem seems to be that on wxMSW +// at least the button doesn't properly propagate key events (yes, I'm using +// wxWANTS_CHARS). +//wxPG_EX_NO_TAB_TO_BUTTON = 0x00020000, + +// Allows relying on native double-buffering. +wxPG_EX_NATIVE_DOUBLE_BUFFERING = 0x00080000, + +// Set this style to let user have ability to set values of properties to +// unspecified state. Same as setting wxPG_PROP_AUTO_UNSPECIFIED for +// all properties. +wxPG_EX_AUTO_UNSPECIFIED_VALUES = 0x00200000, + +// If this style is used, built-in attributes (such as wxPG_FLOAT_PRECISION +// and wxPG_STRING_PASSWORD) are not stored into property's attribute storage +// (thus they are not readable). +// Note that this option is global, and applies to all wxPG property +// containers. +wxPG_EX_WRITEONLY_BUILTIN_ATTRIBUTES = 0x00400000, + +// Hides page selection buttons from toolbar. +wxPG_EX_HIDE_PAGE_BUTTONS = 0x01000000, + +// Allows multiple properties to be selected by user (by pressing SHIFT +// when clicking on a property, or by dragging with left mouse button +// down). +// You can get array of selected properties with +// wxPropertyGridInterface::GetSelectedProperties(). In multiple selection +// mode wxPropertyGridInterface::GetSelection() returns +// property which has editor active (usually the first one +// selected). Other useful member functions are ClearSelection(), +// AddToSelection() and RemoveFromSelection(). +wxPG_EX_MULTIPLE_SELECTION = 0x02000000, + +// This enables top-level window tracking which allows wxPropertyGrid to +// notify the application of last-minute property value changes by user. +// This style is not enabled by default because it may cause crashes when +// wxPropertyGrid is used in with wxAUI or similar system. +// Note: If you are not in fact using any system that may change +// wxPropertyGrid's top-level parent window on its own, then you +// are recommended to enable this style. +wxPG_EX_ENABLE_TLP_TRACKING = 0x04000000, + +// Don't show divider above toolbar, on Windows. +wxPG_EX_NO_TOOLBAR_DIVIDER = 0x08000000, + +// Show a separator below the toolbar. +wxPG_EX_TOOLBAR_SEPARATOR = 0x10000000, + +// Allows to take focus on the entire area (on canvas) +// even if wxPropertyGrid is not a standalone control. +wxPG_EX_ALWAYS_ALLOW_FOCUS = 0x00100000, + + +// A mask which can be used to filter (out) all extra styles applicable to wxPropertyGrid. +wxPG_EX_WINDOW_PG_STYLE_MASK = wxPG_EX_INIT_NOCAT|wxPG_EX_HELP_AS_TOOLTIPS|wxPG_EX_NATIVE_DOUBLE_BUFFERING| + wxPG_EX_AUTO_UNSPECIFIED_VALUES|wxPG_EX_WRITEONLY_BUILTIN_ATTRIBUTES| + wxPG_EX_MULTIPLE_SELECTION|wxPG_EX_ENABLE_TLP_TRACKING|wxPG_EX_ALWAYS_ALLOW_FOCUS, + +// A mask which can be used to filter (out) all extra styles applicable to wxPropertyGridManager. +wxPG_EX_WINDOW_PGMAN_STYLE_MASK = wxPG_EX_NO_FLAT_TOOLBAR|wxPG_EX_MODE_BUTTONS|wxPG_EX_HIDE_PAGE_BUTTONS| + wxPG_EX_NO_TOOLBAR_DIVIDER|wxPG_EX_TOOLBAR_SEPARATOR, + +// A mask which can be used to filter (out) all extra styles. +wxPG_EX_WINDOW_STYLE_MASK = wxPG_EX_WINDOW_PG_STYLE_MASK|wxPG_EX_WINDOW_PGMAN_STYLE_MASK +}; + +#if wxPG_COMPATIBILITY_1_4 + #define wxPG_EX_DISABLE_TLP_TRACKING 0x00000000 +#endif + +// Combines various styles. +#define wxPG_DEFAULT_STYLE (0) + +// Combines various styles. +#define wxPGMAN_DEFAULT_STYLE (0) + +// ----------------------------------------------------------------------- + +// wxPropertyGrid stores information about common values in these +// records. +// NB: Common value feature is not complete, and thus not mentioned in +// documentation. +class WXDLLIMPEXP_PROPGRID wxPGCommonValue +{ +public: + + wxPGCommonValue( const wxString& label, wxPGCellRenderer* renderer ) + : m_label(label) + , m_renderer(renderer) + { + renderer->IncRef(); + } + virtual ~wxPGCommonValue() + { + m_renderer->DecRef(); + } + + virtual wxString GetEditableText() const { return m_label; } + const wxString& GetLabel() const { return m_label; } + wxPGCellRenderer* GetRenderer() const { return m_renderer; } + +protected: + wxString m_label; + wxPGCellRenderer* m_renderer; +}; + +// ----------------------------------------------------------------------- + +// wxPropertyGrid Validation Failure behaviour Flags +enum wxPG_VALIDATION_FAILURE_BEHAVIOR_FLAGS +{ + +// Prevents user from leaving property unless value is valid. If this +// behaviour flag is not used, then value change is instead cancelled. +wxPG_VFB_STAY_IN_PROPERTY = 0x01, + +// Calls wxBell() on validation failure. +wxPG_VFB_BEEP = 0x02, + +// Cell with invalid value will be marked (with red colour). +wxPG_VFB_MARK_CELL = 0x04, + +// Display a text message explaining the situation. +// To customize the way the message is displayed, you need to +// reimplement wxPropertyGrid::DoShowPropertyError() in a +// derived class. Default behaviour is to display the text on +// the top-level frame's status bar, if present, and otherwise +// using wxMessageBox. +wxPG_VFB_SHOW_MESSAGE = 0x08, + +// Similar to wxPG_VFB_SHOW_MESSAGE, except always displays the +// message using wxMessageBox. +wxPG_VFB_SHOW_MESSAGEBOX = 0x10, + +// Similar to wxPG_VFB_SHOW_MESSAGE, except always displays the +// message on the status bar (when present - you can reimplement +// wxPropertyGrid::GetStatusBar() in a derived class to specify +// this yourself). +wxPG_VFB_SHOW_MESSAGE_ON_STATUSBAR = 0x20, + +// Defaults. +wxPG_VFB_DEFAULT = wxPG_VFB_MARK_CELL | + wxPG_VFB_SHOW_MESSAGEBOX, + +// Only used internally. +wxPG_VFB_UNDEFINED = 0x80 + +}; + +// Having this as define instead of wxByte typedef makes things easier for +// wxPython bindings (ignoring and redefining it in SWIG interface file +// seemed rather tricky) +#define wxPGVFBFlags unsigned char + +// Used to convey validation information to and from functions that +// actually perform validation. Mostly used in custom property +// classes. +class WXDLLIMPEXP_PROPGRID wxPGValidationInfo +{ + friend class wxPropertyGrid; +public: + wxPGValidationInfo() + : m_failureBehavior(0) + , m_isFailing(false) + { + } + + ~wxPGValidationInfo() + { + } + + // Returns failure behaviour which is a combination of + // wxPG_VFB_XXX flags. + wxPGVFBFlags GetFailureBehavior() const + { return m_failureBehavior; } + + // Returns current failure message. + const wxString& GetFailureMessage() const + { return m_failureMessage; } + + // Returns reference to pending value. + wxVariant& GetValue() + { + wxASSERT(m_pValue); + return *m_pValue; + } + + // Set validation failure behaviour + // failureBehavior - Mixture of wxPG_VFB_XXX flags. + void SetFailureBehavior(wxPGVFBFlags failureBehavior) + { m_failureBehavior = failureBehavior; } + + // Set current failure message. + void SetFailureMessage(const wxString& message) + { m_failureMessage = message; } + +private: + // Value to be validated. + wxVariant* m_pValue; + + // Message displayed on validation failure. + wxString m_failureMessage; + + // Validation failure behaviour. Use wxPG_VFB_XXX flags. + wxPGVFBFlags m_failureBehavior; + + // True when validation is currently failing. + bool m_isFailing; +}; + +// ----------------------------------------------------------------------- + +// These are used with wxPropertyGrid::AddActionTrigger() and +// wxPropertyGrid::ClearActionTriggers(). +enum wxPG_KEYBOARD_ACTIONS +{ + wxPG_ACTION_INVALID = 0, + + // Select the next property. + wxPG_ACTION_NEXT_PROPERTY, + + // Select the previous property. + wxPG_ACTION_PREV_PROPERTY, + + // Expand the selected property, if it has child items. + wxPG_ACTION_EXPAND_PROPERTY, + + // Collapse the selected property, if it has child items. + wxPG_ACTION_COLLAPSE_PROPERTY, + + // Cancel and undo any editing done in the currently active property + // editor. + wxPG_ACTION_CANCEL_EDIT, + + // Move focus to the editor control of the currently selected + // property. + wxPG_ACTION_EDIT, + + // Causes editor's button (if any) to be pressed. + wxPG_ACTION_PRESS_BUTTON, + + wxPG_ACTION_MAX +}; + +// ----------------------------------------------------------------------- + +// wxPropertyGrid::DoSelectProperty flags (selFlags) +enum wxPG_SELECT_PROPERTY_FLAGS +{ + // Focuses to created editor + wxPG_SEL_FOCUS = 0x0001, + // Forces deletion and recreation of editor + wxPG_SEL_FORCE = 0x0002, + // For example, doesn't cause EnsureVisible + wxPG_SEL_NONVISIBLE = 0x0004, + // Do not validate editor's value before selecting + wxPG_SEL_NOVALIDATE = 0x0008, + // Property being deselected is about to be deleted + wxPG_SEL_DELETING = 0x0010, + // Property's values was set to unspecified by the user + wxPG_SEL_SETUNSPEC = 0x0020, + // Property's event handler changed the value + wxPG_SEL_DIALOGVAL = 0x0040, + // Set to disable sending of wxEVT_PG_SELECTED event + wxPG_SEL_DONT_SEND_EVENT = 0x0080, + // Don't make any graphics updates + wxPG_SEL_NO_REFRESH = 0x0100 +}; + +// ----------------------------------------------------------------------- + +// DoSetSplitterPosition() flags + +enum wxPG_SET_SPLITTER_POSITION_SPLITTER_FLAGS +{ + wxPG_SPLITTER_REFRESH = 0x0001, + wxPG_SPLITTER_ALL_PAGES = 0x0002, + wxPG_SPLITTER_FROM_EVENT = 0x0004, + wxPG_SPLITTER_FROM_AUTO_CENTER = 0x0008 +}; + + +// ----------------------------------------------------------------------- + +// Internal flags +enum wxPG_INTERNAL_FLAGS +{ + wxPG_FL_INITIALIZED = 0x0001, + // Set when creating editor controls if it was clicked on. + wxPG_FL_ACTIVATION_BY_CLICK = 0x0002, + wxPG_FL_DONT_CENTER_SPLITTER = 0x0004, + wxPG_FL_FOCUSED = 0x0008, + wxPG_FL_MOUSE_CAPTURED = 0x0010, + wxPG_FL_MOUSE_INSIDE = 0x0020, + wxPG_FL_VALUE_MODIFIED = 0x0040, + // don't clear background of m_wndEditor + wxPG_FL_PRIMARY_FILLS_ENTIRE = 0x0080, + // currently active editor uses custom image + wxPG_FL_CUR_USES_CUSTOM_IMAGE = 0x0100, + // cell colours override selection colours for selected cell + wxPG_FL_CELL_OVERRIDES_SEL = 0x0200, + wxPG_FL_SCROLLED = 0x0400, + // set when all added/inserted properties get hideable flag + wxPG_FL_ADDING_HIDEABLES = 0x0800, + // Disables showing help strings on statusbar. + wxPG_FL_NOSTATUSBARHELP = 0x1000, + // Marks that we created the state, so we have to destroy it too. + wxPG_FL_CREATEDSTATE = 0x2000, + // Set if wxPGMan requires redrawing of description text box. + wxPG_FL_DESC_REFRESH_REQUIRED = 0x8000, + // Set if contained in wxPropertyGridManager + wxPG_FL_IN_MANAGER = 0x00020000, + // Set after wxPropertyGrid is shown in its initial good size + wxPG_FL_GOOD_SIZE_SET = 0x00040000, + // Set when in SelectProperty. + wxPG_FL_IN_SELECT_PROPERTY = 0x00100000, + // Set when help string is shown in status bar + wxPG_FL_STRING_IN_STATUSBAR = 0x00200000, + // Auto sort is enabled (for categorized mode) + wxPG_FL_CATMODE_AUTO_SORT = 0x01000000, + // Set after page has been inserted to manager + wxPG_MAN_FL_PAGE_INSERTED = 0x02000000, + // Active editor control is abnormally large + wxPG_FL_ABNORMAL_EDITOR = 0x04000000, + // Recursion guard for HandleCustomEditorEvent + wxPG_FL_IN_HANDLECUSTOMEDITOREVENT = 0x08000000, + wxPG_FL_VALUE_CHANGE_IN_EVENT = 0x10000000, + // Editor control width should not change on resize + wxPG_FL_FIXED_WIDTH_EDITOR = 0x20000000, + // Width of panel can be different from width of grid + wxPG_FL_HAS_VIRTUAL_WIDTH = 0x40000000, + // Prevents RecalculateVirtualSize re-entrancy + wxPG_FL_RECALCULATING_VIRTUAL_SIZE = 0x80000000 +}; + +#if !defined(__wxPG_SOURCE_FILE__) + // Reduce compile time, but still include in user app + #include "wx/propgrid/props.h" +#endif + +// ----------------------------------------------------------------------- + +// wxPropertyGrid is a specialized grid for editing properties +// such as strings, numbers, flagsets, fonts, and colours. wxPropertySheet +// used to do the very same thing, but it hasn't been updated for a while +// and it is currently deprecated. +// Please note that most member functions are inherited and as such not +// documented here. This means you will probably also want to read +// wxPropertyGridInterface class reference. +// To process input from a propertygrid control, use these event handler +// macros to direct input to member functions that take a wxPropertyGridEvent +// argument. +// EVT_PG_SELECTED (id, func) +// Respond to wxEVT_PG_SELECTED event, generated when a property selection +// has been changed, either by user action or by indirect program +// function. For instance, collapsing a parent property programmatically +// causes any selected child property to become unselected, and may +// therefore cause this event to be generated. +// EVT_PG_CHANGING(id, func) +// Respond to wxEVT_PG_CHANGING event, generated when property value +// is about to be changed by user. Use wxPropertyGridEvent::GetValue() +// to take a peek at the pending value, and wxPropertyGridEvent::Veto() +// to prevent change from taking place, if necessary. +// EVT_PG_HIGHLIGHTED(id, func) +// Respond to wxEVT_PG_HIGHLIGHTED event, which occurs when mouse +// moves over a property. Event's property is NULL if hovered area does +// not belong to any property. +// EVT_PG_RIGHT_CLICK(id, func) +// Respond to wxEVT_PG_RIGHT_CLICK event, which occurs when property is +// clicked on with right mouse button. +// EVT_PG_DOUBLE_CLICK(id, func) +// Respond to wxEVT_PG_DOUBLE_CLICK event, which occurs when property is +// double-clicked onwith left mouse button. +// EVT_PG_ITEM_COLLAPSED(id, func) +// Respond to wxEVT_PG_ITEM_COLLAPSED event, generated when user collapses +// a property or category.. +// EVT_PG_ITEM_EXPANDED(id, func) +// Respond to wxEVT_PG_ITEM_EXPANDED event, generated when user expands +// a property or category.. +// EVT_PG_LABEL_EDIT_BEGIN(id, func) +// Respond to wxEVT_PG_LABEL_EDIT_BEGIN event, generated when is about to +// begin editing a property label. You can veto this event to prevent the +// action. +// EVT_PG_LABEL_EDIT_ENDING(id, func) +// Respond to wxEVT_PG_LABEL_EDIT_ENDING event, generated when is about to +// end editing of a property label. You can veto this event to prevent the +// action. +// EVT_PG_COL_BEGIN_DRAG(id, func) +// Respond to wxEVT_PG_COL_BEGIN_DRAG event, generated when user +// starts resizing a column - can be vetoed. +// EVT_PG_COL_DRAGGING,(id, func) +// Respond to wxEVT_PG_COL_DRAGGING, event, generated when a +// column resize by user is in progress. This event is also generated +// when user double-clicks the splitter in order to recenter +// it. +// EVT_PG_COL_END_DRAG(id, func) +// Respond to wxEVT_PG_COL_END_DRAG event, generated after column +// resize by user has finished. +// Use Freeze() and Thaw() respectively to disable and enable drawing. This +// will also delay sorting etc. miscellaneous calculations to the last +// possible moment. +class WXDLLIMPEXP_PROPGRID wxPropertyGrid : public wxScrolled<wxControl>, + public wxPropertyGridInterface +{ + friend class wxPropertyGridEvent; + friend class wxPropertyGridPageState; + friend class wxPropertyGridInterface; + friend class wxPropertyGridManager; + friend class wxPGHeaderCtrl; + + wxDECLARE_DYNAMIC_CLASS(wxPropertyGrid); +public: + +#ifndef SWIG + // Two step constructor. + // Call Create when this constructor is called to build up the + // wxPropertyGrid + wxPropertyGrid(); +#endif + + // The default constructor. The styles to be used are styles valid for + // the wxWindow. + wxPropertyGrid( wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxPG_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxPropertyGridNameStr) ); + + // Destructor + virtual ~wxPropertyGrid(); + + // Adds given key combination to trigger given action. + // Here is a sample code to make Enter key press move focus to + // the next property. + // propGrid->AddActionTrigger(wxPG_ACTION_NEXT_PROPERTY, WXK_RETURN); + // propGrid->DedicateKey(WXK_RETURN); + // action - Which action to trigger. See @ref propgrid_keyboard_actions. + // keycode - Which keycode triggers the action. + // modifiers - Which key event modifiers, in addition to keycode, are needed to + // trigger the action. + void AddActionTrigger( int action, int keycode, int modifiers = 0 ); + + // Dedicates a specific keycode to wxPropertyGrid. This means that such + // key presses will not be redirected to editor controls. + // Using this function allows, for example, navigation between + // properties using arrow keys even when the focus is in the editor + // control. + void DedicateKey( int keycode ) + { +#if WXWIN_COMPATIBILITY_3_0 + // Deprecated: use a hash set instead. + m_dedicatedKeys.push_back(keycode); +#else + m_dedicatedKeys.insert(keycode); +#endif + } + + // This static function enables or disables automatic use of + // wxGetTranslation for following strings: wxEnumProperty list labels, + // wxFlagsProperty child property labels. + // Default is false. + static void AutoGetTranslation( bool enable ); + + // Changes value of a property, as if from an editor. + // Use this instead of SetPropertyValue() if you need the value to run + // through validation process, and also send the property change event. + // Returns true if value was successfully changed. + bool ChangePropertyValue( wxPGPropArg id, wxVariant newValue ); + + // Centers the splitter. + // enableAutoResizing - If true, automatic column resizing is enabled + // (only applicable if window style wxPG_SPLITTER_AUTO_CENTER is used). + void CenterSplitter( bool enableAutoResizing = false ); + + // Deletes all properties. + virtual void Clear() wxOVERRIDE; + + // Clears action triggers for given action. + // action - Which action to trigger. + void ClearActionTriggers( int action ); + + // Forces updating the value of property from the editor control. + // Note that wxEVT_PG_CHANGING and wxEVT_PG_CHANGED are dispatched using + // ProcessEvent, meaning your event handlers will be called immediately. + // Returns true if anything was changed. + virtual bool CommitChangesFromEditor( wxUint32 flags = 0 ); + + // Two step creation. + // Whenever the control is created without any parameters, use Create to + // actually create it. Don't access the control's public methods before + // this is called @see @link wndflags Additional Window Styles@endlink + bool Create( wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxPG_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxPropertyGridNameStr) ); + + // Call when editor widget's contents is modified. + // For example, this is called when changes text in wxTextCtrl (used in + // wxStringProperty and wxIntProperty). + // This function should only be called by custom properties. + void EditorsValueWasModified() { m_iFlags |= wxPG_FL_VALUE_MODIFIED; } + + // Reverse of EditorsValueWasModified(). + // This function should only be called by custom properties. + void EditorsValueWasNotModified() + { + m_iFlags &= ~(wxPG_FL_VALUE_MODIFIED); + } + + // Enables or disables (shows/hides) categories according to parameter + // enable. + bool EnableCategories( bool enable ); + + // Scrolls and/or expands items to ensure that the given item is visible. + // Returns true if something was actually done. + bool EnsureVisible( wxPGPropArg id ); + + // Reduces column sizes to minimum possible that contents are still + // visibly (naturally some margin space will be applied as well). + // Returns minimum size for the grid to still display everything. + // Does not work well with wxPG_SPLITTER_AUTO_CENTER window style. + // This function only works properly if grid size prior to call was already + // fairly large. + // Note that you can also get calculated column widths by calling + // GetState->GetColumnWidth() immediately after this function returns. + wxSize FitColumns() + { + wxSize sz = m_pState->DoFitColumns(); + return sz; + } + + // Returns wxWindow that the properties are painted on, and which should + // be used as the parent for editor controls. + wxWindow* GetPanel() + { + return this; + } + + // Returns current category caption background colour. + wxColour GetCaptionBackgroundColour() const { return m_colCapBack; } + + wxFont& GetCaptionFont() { return m_captionFont; } + + // Returns current category caption font. + const wxFont& GetCaptionFont() const { return m_captionFont; } + + // Returns current category caption text colour. + wxColour GetCaptionForegroundColour() const { return m_colCapFore; } + + // Returns current cell background colour. + wxColour GetCellBackgroundColour() const { return m_colPropBack; } + + // Returns current cell text colour when disabled. + wxColour GetCellDisabledTextColour() const { return m_colDisPropFore; } + + // Returns current cell text colour. + wxColour GetCellTextColour() const { return m_colPropFore; } + + // Returns number of columns currently on grid. + unsigned int GetColumnCount() const + { + return m_pState->GetColumnCount(); + } + + // Returns colour of empty space below properties. + wxColour GetEmptySpaceColour() const { return m_colEmptySpace; } + + // Returns height of highest characters of used font. + int GetFontHeight() const { return m_fontHeight; } + + // Returns pointer to itself. Dummy function that enables same kind + // of code to use wxPropertyGrid and wxPropertyGridManager. + wxPropertyGrid* GetGrid() { return this; } + + // Returns rectangle of custom paint image. + wxRect GetImageRect( wxPGProperty* p, int item ) const; + + // Returns size of the custom paint image in front of property. + // If no argument is given (p is NULL), returns preferred size. + wxSize GetImageSize( wxPGProperty* p = NULL, int item = -1 ) const; + + // Returns last item which could be iterated using given flags. + wxPGProperty* GetLastItem( int flags = wxPG_ITERATE_DEFAULT ) + { + return m_pState->GetLastItem(flags); + } + + const wxPGProperty* GetLastItem( int flags = wxPG_ITERATE_DEFAULT ) const + { + return m_pState->GetLastItem(flags); + } + + // Returns colour of lines between cells. + wxColour GetLineColour() const { return m_colLine; } + + // Returns background colour of margin. + wxColour GetMarginColour() const { return m_colMargin; } + + // Returns margin width. + int GetMarginWidth() const { return m_marginWidth; } + + // Returns most up-to-date value of selected property. This will return + // value different from GetSelectedProperty()->GetValue() only when text + // editor is activate and string edited by user represents valid, + // uncommitted property value. + wxVariant GetUncommittedPropertyValue(); + + // Returns "root property". It does not have name, etc. and it is not + // visible. It is only useful for accessing its children. + wxPGProperty* GetRoot() const { return m_pState->m_properties; } + + // Returns height of a single grid row (in pixels). + int GetRowHeight() const { return m_lineHeight; } + + // Returns currently selected property. + wxPGProperty* GetSelectedProperty() const { return GetSelection(); } + + // Returns current selection background colour. + wxColour GetSelectionBackgroundColour() const { return m_colSelBack; } + + // Returns current selection text colour. + wxColour GetSelectionForegroundColour() const { return m_colSelFore; } + + // Returns current splitter x position. + int GetSplitterPosition( unsigned int splitterIndex = 0 ) const + { + return m_pState->DoGetSplitterPosition(splitterIndex); + } + + // Returns wxTextCtrl active in currently selected property, if any. Takes + // into account wxOwnerDrawnComboBox. + wxTextCtrl* GetEditorTextCtrl() const; + + wxPGValidationInfo& GetValidationInfo() + { + return m_validationInfo; + } + + // Returns current vertical spacing. + int GetVerticalSpacing() const { return (int)m_vspacing; } + + // Returns true if a property editor control has focus. + bool IsEditorFocused() const; + + // Returns true if editor's value was marked modified. + bool IsEditorsValueModified() const + { return ( m_iFlags & wxPG_FL_VALUE_MODIFIED ) ? true : false; } + + // Returns information about arbitrary position in the grid. + // pt - Coordinates in the virtual grid space. You may need to use + // wxScrolled<T>::CalcScrolledPosition() for translating + // wxPropertyGrid client coordinates into something this member + // function can use. + wxPropertyGridHitTestResult HitTest( const wxPoint& pt ) const; + + // Returns true if any property has been modified by the user. + bool IsAnyModified() const +#if WXWIN_COMPATIBILITY_3_0 + { return m_pState->m_anyModified != (unsigned char)false; } +#else + { return m_pState->m_anyModified; } +#endif + + // It is recommended that you call this function any time your code causes + // wxPropertyGrid's top-level parent to change. wxPropertyGrid's OnIdle() + // handler should be able to detect most changes, but it is not perfect. + // newTLP - New top-level parent that is about to be set. Old top-level parent + // window should still exist as the current one. + // This function is automatically called from wxPropertyGrid:: + // Reparent() and wxPropertyGridManager::Reparent(). You only + // need to use it if you reparent wxPropertyGrid indirectly. + void OnTLPChanging( wxWindow* newTLP ); + + // Redraws given property. + virtual void RefreshProperty( wxPGProperty* p ) wxOVERRIDE; + + // Registers a new editor class. + // Returns pointer to the editor class instance that should be used. + static wxPGEditor* RegisterEditorClass( wxPGEditor* editor, + bool noDefCheck = false ) + { + return DoRegisterEditorClass(editor, wxEmptyString, noDefCheck); + } + + static wxPGEditor* DoRegisterEditorClass( wxPGEditor* editorClass, + const wxString& editorName, + bool noDefCheck = false ); + + // Resets all colours to the original system values. + void ResetColours(); + + // Resets column sizes and splitter positions, based on proportions. + // enableAutoResizing - If true, automatic column resizing is enabled + // (only applicable if window style wxPG_SPLITTER_AUTO_CENTER is used). + void ResetColumnSizes( bool enableAutoResizing = false ); + + // Selects a property. + // Editor widget is automatically created, but not focused unless focus is + // true. + // id - Property to select. + // Returns true if selection finished successfully. Usually only fails if + // current value in editor is not valid. + // This function clears any previous selection. + bool SelectProperty( wxPGPropArg id, bool focus = false ); + + // Set entire new selection from given list of properties. + void SetSelection( const wxArrayPGProperty& newSelection ) + { + DoSetSelection( newSelection, wxPG_SEL_DONT_SEND_EVENT ); + } + + // Adds given property into selection. If wxPG_EX_MULTIPLE_SELECTION + // extra style is not used, then this has same effect as + // calling SelectProperty(). + // Multiple selection is not supported for categories. This + // means that if you have properties selected, you cannot + // add category to selection, and also if you have category + // selected, you cannot add other properties to selection. + // This member function will fail silently in these cases, + // even returning true. + bool AddToSelection( wxPGPropArg id ) + { + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false) + return DoAddToSelection(p, wxPG_SEL_DONT_SEND_EVENT); + } + + // Removes given property from selection. If property is not selected, + // an assertion failure will occur. + bool RemoveFromSelection( wxPGPropArg id ) + { + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false) + return DoRemoveFromSelection(p, wxPG_SEL_DONT_SEND_EVENT); + } + + // Makes given column editable by user. + // editable - Using false here will disable column from being editable. + void MakeColumnEditable( unsigned int column, bool editable = true ); + + // Creates label editor wxTextCtrl for given column, for property + // that is currently selected. When multiple selection is + // enabled, this applies to whatever property GetSelection() + // returns. + // colIndex - Which column's label to edit. Note that you should not + // use value 1, which is reserved for property value + // column. + void BeginLabelEdit( unsigned int column = 0 ) + { + DoBeginLabelEdit(column, wxPG_SEL_DONT_SEND_EVENT); + } + + // Destroys label editor wxTextCtrl, if any. + // commit - Use true (default) to store edited label text in + // property cell data. + void EndLabelEdit( bool commit = true ) + { + DoEndLabelEdit(commit, wxPG_SEL_DONT_SEND_EVENT); + } + + // Returns currently active label editor, NULL if none. + wxTextCtrl* GetLabelEditor() const + { + return m_labelEditor; + } + + // Sets category caption background colour. + void SetCaptionBackgroundColour(const wxColour& col); + + // Sets category caption text colour. + void SetCaptionTextColour(const wxColour& col); + + // Sets default cell background colour - applies to property cells. + // Note that appearance of editor widgets may not be affected. + void SetCellBackgroundColour(const wxColour& col); + + // Sets cell text colour for disabled properties. + void SetCellDisabledTextColour(const wxColour& col); + + // Sets default cell text colour - applies to property name and value text. + // Note that appearance of editor widgets may not be affected. + void SetCellTextColour(const wxColour& col); + + // Set number of columns (2 or more). + void SetColumnCount( int colCount ) + { + m_pState->SetColumnCount(colCount); + Refresh(); + } + + // Sets the 'current' category - Append will add non-category properties + // under it. + void SetCurrentCategory( wxPGPropArg id ) + { + wxPG_PROP_ARG_CALL_PROLOG() + wxPropertyCategory* pc = wxDynamicCast(p, wxPropertyCategory); + wxASSERT(pc); + m_pState->m_currentCategory = pc; + } + + // Sets colour of empty space below properties. + void SetEmptySpaceColour(const wxColour& col); + + // Sets colour of lines between cells. + void SetLineColour(const wxColour& col); + + // Sets background colour of margin. + void SetMarginColour(const wxColour& col); + + // Sets selection background colour - applies to selected property name + // background. + void SetSelectionBackgroundColour(const wxColour& col); + + // Sets selection foreground colour - applies to selected property name + // text. + void SetSelectionTextColour(const wxColour& col); + + // Sets x coordinate of the splitter. + // Splitter position cannot exceed grid size, and therefore setting it + // during form creation may fail as initial grid size is often smaller + // than desired splitter position, especially when sizers are being used. + void SetSplitterPosition( int newXPos, int col = 0 ) + { + DoSetSplitterPosition(newXPos, col, wxPG_SPLITTER_REFRESH); + } + + // Sets the property sorting function. + // sortFunction - The sorting function to be used. It should return a value greater + // than 0 if position of p1 is after p2. So, for instance, when + // comparing property names, you can use following implementation: + // int MyPropertySortFunction(wxPropertyGrid* propGrid, + // wxPGProperty* p1, + // wxPGProperty* p2) + // { + // return p1->GetBaseName().compare( p2->GetBaseName() ); + // } + // Default property sort function sorts properties by their labels + // (case-insensitively). + void SetSortFunction( wxPGSortCallback sortFunction ) + { + m_sortFunction = sortFunction; + } + + // Returns the property sort function (default is NULL). + wxPGSortCallback GetSortFunction() const + { + return m_sortFunction; + } + + // Sets appearance of value cells representing an unspecified property + // value. Default appearance is blank. + // If you set the unspecified value to have any + // textual representation, then that will override + // "InlineHelp" attribute. + void SetUnspecifiedValueAppearance( const wxPGCell& cell ) + { + m_unspecifiedAppearance = m_propertyDefaultCell; + m_unspecifiedAppearance.MergeFrom(cell); + } + + // Returns current appearance of unspecified value cells. + const wxPGCell& GetUnspecifiedValueAppearance() const + { + return m_unspecifiedAppearance; + } + + // Returns (visual) text representation of the unspecified + // property value. + // argFlags - For internal use only. + wxString GetUnspecifiedValueText( int argFlags = 0 ) const; + + // Set virtual width for this particular page. Width -1 indicates that the + // virtual width should be disabled. + void SetVirtualWidth( int width ); + + // Moves splitter as left as possible, while still allowing all + // labels to be shown in full. + // privateChildrenToo - If false, will still allow private children to be cropped. + void SetSplitterLeft( bool privateChildrenToo = false ) + { + m_pState->SetSplitterLeft(privateChildrenToo); + } + + // Sets vertical spacing. Can be 1, 2, or 3 - a value relative to font + // height. Value of 2 should be default on most platforms. + void SetVerticalSpacing( int vspacing ) + { + m_vspacing = (unsigned char)vspacing; + CalculateFontAndBitmapStuff( vspacing ); + if ( !m_pState->m_itemsAdded ) Refresh(); + } + + // Shows an brief error message that is related to a property. + void ShowPropertyError( wxPGPropArg id, const wxString& msg ) + { + wxPG_PROP_ARG_CALL_PROLOG() + DoShowPropertyError(p, msg); + } + + ///////////////////////////////////////////////////////////////// + // + // Following methods do not need to be (currently) documented + // + ///////////////////////////////////////////////////////////////// + + bool HasVirtualWidth() const + { return (m_iFlags & wxPG_FL_HAS_VIRTUAL_WIDTH) ? true : false; } + + const wxPGCommonValue* GetCommonValue( unsigned int i ) const + { + wxCHECK_MSG( i < m_commonValues.size(), NULL, "Invalid item index" ); + return m_commonValues[i]; + } + + // Returns number of common values. + unsigned int GetCommonValueCount() const + { + return (unsigned int) m_commonValues.size(); + } + + // Returns label of given common value. + wxString GetCommonValueLabel( unsigned int i ) const + { + wxCHECK_MSG( i < m_commonValues.size(), wxString(), "Invalid item index" ); + return GetCommonValue(i)->GetLabel(); + } + + // Returns index of common value that will truly change value to + // unspecified. + int GetUnspecifiedCommonValue() const { return m_cvUnspecified; } + + // Set index of common value that will truly change value to unspecified. + // Using -1 will set none to have such effect. + // Default is 0. + void SetUnspecifiedCommonValue( int index ) { m_cvUnspecified = index; } + + // Shortcut for creating dialog-caller button. Used, for example, by + // wxFontProperty. + // This should only be called by properties. + wxWindow* GenerateEditorButton( const wxPoint& pos, const wxSize& sz ); + + // Fixes position of wxTextCtrl-like control (wxSpinCtrl usually + // fits as one). Call after control has been created (but before + // shown). + void FixPosForTextCtrl( wxWindow* ctrl, + unsigned int forColumn = 1, + const wxPoint& offset = wxPoint(0, 0) ); + + // Shortcut for creating text editor widget. + // pos - Same as pos given for CreateEditor. + // sz - Same as sz given for CreateEditor. + // value - Initial text for wxTextCtrl. + // secondary - If right-side control, such as button, also created, + // then create it first and pass it as this parameter. + // extraStyle - Extra style flags to pass for wxTextCtrl. + // Note that this should generally be called only by new classes derived + // from wxPGProperty. + wxWindow* GenerateEditorTextCtrl( const wxPoint& pos, + const wxSize& sz, + const wxString& value, + wxWindow* secondary, + int extraStyle = 0, + int maxLen = 0, + unsigned int forColumn = 1 ); + + // Generates both textctrl and button. + wxWindow* GenerateEditorTextCtrlAndButton( const wxPoint& pos, + const wxSize& sz, wxWindow** psecondary, int limited_editing, + wxPGProperty* property ); + + // Generates position for a widget editor dialog box. + // p - Property for which dialog is positioned. + // sz - Known or over-approximated size of the dialog. + // Returns position for dialog. + wxPoint GetGoodEditorDialogPosition( wxPGProperty* p, + const wxSize& sz ); + + // Converts escape sequences in src_str to newlines, + // tabs, etc. and copies result to dst_str. + static wxString& ExpandEscapeSequences( wxString& dst_str, + const wxString& src_str ); + + // Converts newlines, tabs, etc. in src_str to escape + // sequences, and copies result to dst_str. + static wxString& CreateEscapeSequences( wxString& dst_str, + const wxString& src_str ); + + // Checks system screen design used for laying out various dialogs. + static bool IsSmallScreen(); + + // Returns rescaled bitmap + static wxBitmap RescaleBitmap(const wxBitmap& srcBmp, double scaleX, double scaleY); + + // Returns rectangle that fully contains properties between and including + // p1 and p2. Rectangle is in virtual scrolled window coordinates. + wxRect GetPropertyRect( const wxPGProperty* p1, + const wxPGProperty* p2 ) const; + + // Returns pointer to current active primary editor control (NULL if none). + wxWindow* GetEditorControl() const; + + wxWindow* GetPrimaryEditor() const + { + return GetEditorControl(); + } + + // Returns pointer to current active secondary editor control (NULL if + // none). + wxWindow* GetEditorControlSecondary() const + { + return m_wndEditor2; + } + + // Refreshes any active editor control. + void RefreshEditor(); + + // Events from editor controls are forward to this function + bool HandleCustomEditorEvent( wxEvent &event ); + + // Mostly useful for page switching. + void SwitchState( wxPropertyGridPageState* pNewState ); + + long GetInternalFlags() const { return m_iFlags; } + bool HasInternalFlag( long flag ) const + { return (m_iFlags & flag) ? true : false; } + void SetInternalFlag( long flag ) { m_iFlags |= flag; } + void ClearInternalFlag( long flag ) { m_iFlags &= ~(flag); } + + void OnComboItemPaint( const wxPGComboBox* pCb, + int item, + wxDC* pDc, + wxRect& rect, + int flags ); + +#if WXWIN_COMPATIBILITY_3_0 + // Standardized double-to-string conversion. + static const wxString& DoubleToString( wxString& target, + double value, + int precision, + bool removeZeroes, + wxString* precTemplate = NULL ); +#endif // WXWIN_COMPATIBILITY_3_0 + + // Call this from wxPGProperty::OnEvent() to cause property value to be + // changed after the function returns (with true as return value). + // ValueChangeInEvent() must be used if you wish the application to be + // able to use wxEVT_PG_CHANGING to potentially veto the given value. + void ValueChangeInEvent( const wxVariant& variant ) + { + m_changeInEventValue = variant; + m_iFlags |= wxPG_FL_VALUE_CHANGE_IN_EVENT; + } + + // You can use this member function, for instance, to detect in + // wxPGProperty::OnEvent() if wxPGProperty::SetValueInEvent() was + // already called in wxPGEditor::OnEvent(). It really only detects + // if was value was changed using wxPGProperty::SetValueInEvent(), which + // is usually used when a 'picker' dialog is displayed. If value was + // written by "normal means" in wxPGProperty::StringToValue() or + // IntToValue(), then this function will return false (on the other hand, + // wxPGProperty::OnEvent() is not even called in those cases). + bool WasValueChangedInEvent() const + { + return (m_iFlags & wxPG_FL_VALUE_CHANGE_IN_EVENT) ? true : false; + } + + // Returns true if given event is from first of an array of buttons + // (as can be in case when wxPGMultiButton is used). + bool IsMainButtonEvent( const wxEvent& event ) const + { + return (event.GetEventType() == wxEVT_BUTTON) + && (m_wndSecId == event.GetId()); + } + + // Pending value is expected to be passed in PerformValidation(). + virtual bool DoPropertyChanged( wxPGProperty* p, + unsigned int selFlags = 0 ); + + // Called when validation for given property fails. + // invalidValue - Value which failed in validation. + // Returns true if user is allowed to change to another property even + // if current has invalid value. + // To add your own validation failure behaviour, override + // wxPropertyGrid::DoOnValidationFailure(). + bool OnValidationFailure( wxPGProperty* property, + wxVariant& invalidValue ); + + // Called to indicate property and editor has valid value now. + void OnValidationFailureReset( wxPGProperty* property ) + { + if ( property && property->HasFlag(wxPG_PROP_INVALID_VALUE) ) + { + DoOnValidationFailureReset(property); + property->ClearFlag(wxPG_PROP_INVALID_VALUE); + } + m_validationInfo.m_failureMessage.clear(); + } + + // Override in derived class to display error messages in custom manner + // (these message usually only result from validation failure). + // If you implement this, then you also need to implement + // DoHidePropertyError() - possibly to do nothing, if error + // does not need hiding (e.g. it was logged or shown in a + // message box). + virtual void DoShowPropertyError( wxPGProperty* property, + const wxString& msg ); + + // Override in derived class to hide an error displayed by + // DoShowPropertyError(). + virtual void DoHidePropertyError( wxPGProperty* property ); + +#if wxUSE_STATUSBAR + // Return wxStatusBar that is used by this wxPropertyGrid. You can + // reimplement this member function in derived class to override + // the default behaviour of using the top-level wxFrame's status + // bar, if any. + virtual wxStatusBar* GetStatusBar(); +#endif + + // Override to customize property validation failure behaviour. + // invalidValue - Value which failed in validation. + // Returns true if user is allowed to change to another property even + // if current has invalid value. + virtual bool DoOnValidationFailure( wxPGProperty* property, + wxVariant& invalidValue ); + + // Override to customize resetting of property validation failure status. + // Property is guaranteed to have flag wxPG_PROP_INVALID_VALUE set. + virtual void DoOnValidationFailureReset( wxPGProperty* property ); + + int GetSpacingY() const { return m_spacingy; } + + // Must be called in wxPGEditor::CreateControls() if primary editor window + // is wxTextCtrl, just before textctrl is created. + // text - Initial text value of created wxTextCtrl. + void SetupTextCtrlValue( const wxString& text ) { m_prevTcValue = text; } + + // Unfocuses or closes editor if one was open, but does not deselect + // property. + bool UnfocusEditor(); + + virtual void SetWindowStyleFlag( long style ) wxOVERRIDE; + + void DrawItems( const wxPGProperty* p1, const wxPGProperty* p2 ); + + void DrawItem( wxPGProperty* p ) + { + DrawItems(p,p); + } + + virtual void DrawItemAndChildren( wxPGProperty* p ); + + // Draws item, children, and consecutive parents as long as category is + // not met. + void DrawItemAndValueRelated( wxPGProperty* p ); + +protected: + + // wxPropertyGridPageState used by the grid is created here. + // If grid is used in wxPropertyGridManager, there is no point overriding + // this - instead, set custom wxPropertyGridPage classes. + virtual wxPropertyGridPageState* CreateState() const; + + enum PerformValidationFlags + { + SendEvtChanging = 0x0001, + IsStandaloneValidation = 0x0002 // Not called in response to event + }; + + // Runs all validation functionality (includes sending wxEVT_PG_CHANGING). + // Returns true if all tests passed. Implement in derived class to + // add additional validation behaviour. + virtual bool PerformValidation( wxPGProperty* p, + wxVariant& pendingValue, + int flags = SendEvtChanging ); + +public: + + // Control font changer helper. + void SetCurControlBoldFont(); + + wxPGCell& GetPropertyDefaultCell() + { + return m_propertyDefaultCell; + } + + wxPGCell& GetCategoryDefaultCell() + { + return m_categoryDefaultCell; + } + + // Public methods for semi-public use + bool DoSelectProperty( wxPGProperty* p, unsigned int flags = 0 ); + + // Overridden functions. + virtual bool Destroy() wxOVERRIDE; + // Returns property at given y coordinate (relative to grid's top left). + wxPGProperty* GetItemAtY( int y ) const { return DoGetItemAtY(y); } + + virtual void Refresh( bool eraseBackground = true, + const wxRect *rect = (const wxRect *) NULL ) wxOVERRIDE; + virtual bool SetFont( const wxFont& font ) wxOVERRIDE; + virtual void SetExtraStyle( long exStyle ) wxOVERRIDE; + virtual bool Reparent( wxWindowBase *newParent ) wxOVERRIDE; + virtual void ScrollWindow(int dx, int dy, const wxRect* rect) wxOVERRIDE; + virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, + int noUnitsX, int noUnitsY, + int xPos, int yPos, bool noRefresh) wxOVERRIDE; +protected: + virtual void DoThaw() wxOVERRIDE; + + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual void DoEnable(bool enable) wxOVERRIDE; + +#ifndef wxPG_ICON_WIDTH + wxBitmap m_expandbmp, m_collbmp; +#endif + + wxCursor m_cursorSizeWE; + + // wxWindow pointers to editor control(s). + wxWindow *m_wndEditor; + wxWindow *m_wndEditor2; + // Actual positions of the editors within the cell. + wxPoint m_wndEditorPosRel; + wxPoint m_wndEditor2PosRel; + + wxBitmap *m_doubleBuffer; + + // Local time ms when control was created. + wxMilliClock_t m_timeCreated; + + // wxPGProperty::OnEvent can change value by setting this. + wxVariant m_changeInEventValue; + + // Id of m_wndEditor2, or its first child, if any. + int m_wndSecId; + + // Extra Y spacing between the items. + int m_spacingy; + + // Control client area width; updated on resize. + int m_width; + + // Control client area height; updated on resize. + int m_height; + + // Current non-client width (needed when auto-centering). + int m_ncWidth; + + // The gutter spacing in front and back of the image. + // This determines the amount of spacing in front of each item + int m_gutterWidth; + + // Includes separator line. + int m_lineHeight; + + // Gutter*2 + image width. + int m_marginWidth; + + // y spacing for expand/collapse button. + int m_buttonSpacingY; + + // Extra margin for expanded sub-group items. + int m_subgroup_extramargin; + + // The image width of the [+] icon. + // This is also calculated in the gutter + int m_iconWidth; + +#ifndef wxPG_ICON_WIDTH + + // The image height of the [+] icon. + // This is calculated as minimal size and to align + int m_iconHeight; +#endif + + // Current cursor id. + int m_curcursor; + + // Caption font. Same as normal font plus bold style. + wxFont m_captionFont; + + int m_fontHeight; // Height of the font. + + // m_splitterx when drag began. + int m_startingSplitterX; + + // Index to splitter currently being dragged (0=one after the first + // column). + int m_draggedSplitter; + + // Changed property, calculated in PerformValidation(). + wxPGProperty* m_chgInfo_changedProperty; + + // Lowest property for which editing happened, but which does not have + // aggregate parent + wxPGProperty* m_chgInfo_baseChangedProperty; + + // Changed property value, calculated in PerformValidation(). + wxVariant m_chgInfo_pendingValue; + + // Passed to SetValue. + wxVariant m_chgInfo_valueList; + + // Validation information. + wxPGValidationInfo m_validationInfo; + + // Actions and keys that trigger them. + wxPGHashMapI2I m_actionTriggers; + + // Appearance of currently active editor. + wxPGCell m_editorAppearance; + + // Appearance of a unspecified value cell. + wxPGCell m_unspecifiedAppearance; + + // List of properties to be deleted/removed in idle event handler. + wxVector<wxPGProperty*> m_deletedProperties; + wxVector<wxPGProperty*> m_removedProperties; + +#if !WXWIN_COMPATIBILITY_3_0 + // List of editors and their event handlers to be deleted in idle event handler. + wxVector<wxObject*> m_deletedEditorObjects; +#endif + + // List of key codes that will not be handed over to editor controls. +#if WXWIN_COMPATIBILITY_3_0 + // Deprecated: use a hash set instead. + wxVector<int> m_dedicatedKeys; +#else + wxPGHashSetInt m_dedicatedKeys; +#endif + + // + // Temporary values + // + + // Bits are used to indicate which colours are customized. + unsigned short m_coloursCustomized; + + // x - m_splitterx. + signed char m_dragOffset; + + // 0 = not dragging, 1 = drag just started, 2 = drag in progress + unsigned char m_dragStatus; + +#if WXWIN_COMPATIBILITY_3_0 + // Unused variable. + // 0 = margin, 1 = label, 2 = value. + unsigned char m_mouseSide; + + // True when editor control is focused. + unsigned char m_editorFocused; +#else + bool m_editorFocused; +#endif + + unsigned char m_vspacing; + +#if WXWIN_COMPATIBILITY_3_0 + // Unused variable. + // Used to track when Alt/Ctrl+Key was consumed. + unsigned char m_keyComboConsumed; +#endif + + // 1 if in DoPropertyChanged() + bool m_inDoPropertyChanged; + + // 1 if in CommitChangesFromEditor() + bool m_inCommitChangesFromEditor; + + // 1 if in DoSelectProperty() + bool m_inDoSelectProperty; + + bool m_inOnValidationFailure; + + wxPGVFBFlags m_permanentValidationFailureBehavior; // Set by app + + // DoEditorValidate() recursion guard + wxRecursionGuardFlag m_validatingEditor; + + // Internal flags - see wxPG_FL_XXX constants. + wxUint32 m_iFlags; + +#if WXWIN_COMPATIBILITY_3_0 + // Unused variable. + // When drawing next time, clear this many item slots at the end. + int m_clearThisMany; +#endif + + // Mouse is hovering over this column (index), -1 for margin + int m_colHover; + + // pointer to property that has mouse hovering + wxPGProperty* m_propHover; + + // Active label editor and its actual position within the cell + wxTextCtrl* m_labelEditor; + wxPoint m_labelEditorPosRel; + + // For which property the label editor is active + wxPGProperty* m_labelEditorProperty; + + // EventObject for wxPropertyGridEvents + wxWindow* m_eventObject; + + // What (global) window is currently focused (needed to resolve event + // handling mess). + wxWindow* m_curFocused; + + // Event currently being sent - NULL if none at the moment + wxPropertyGridEvent* m_processedEvent; + + // Last known top-level parent + wxWindow* m_tlp; + + // Last closed top-level parent + wxWindow* m_tlpClosed; + + // Local time ms when tlp was closed. + wxMilliClock_t m_tlpClosedTime; + + // Sort function + wxPGSortCallback m_sortFunction; + + // y coordinate of property that mouse hovering + int m_propHoverY; + + // Which column's editor is selected (usually 1)? + unsigned int m_selColumn; + // x relative to splitter (needed for resize). + int m_ctrlXAdjust; + // lines between cells + wxColour m_colLine; + // property labels and values are written in this colour + wxColour m_colPropFore; + // or with this colour when disabled + wxColour m_colDisPropFore; + // background for m_colPropFore + wxColour m_colPropBack; + // text color for captions + wxColour m_colCapFore; + // background color for captions + wxColour m_colCapBack; + // foreground for selected property + wxColour m_colSelFore; + // background for selected property (actually use background color when + // control out-of-focus) + wxColour m_colSelBack; + // background colour for margin + wxColour m_colMargin; + // background colour for empty space below the grid + wxColour m_colEmptySpace; + + // Default property colours + wxPGCell m_propertyDefaultCell; + + // Default property category + wxPGCell m_categoryDefaultCell; + + // Backup of selected property's cells + wxVector<wxPGCell> m_propCellsBackup; + + // NB: These *cannot* be moved to globals. + + // labels when properties use common values + wxVector<wxPGCommonValue*> m_commonValues; + + // array of live events + wxVector<wxPropertyGridEvent*> m_liveEvents; + + // Which cv selection really sets value to unspecified? + int m_cvUnspecified; + + // Used to skip excess text editor events + wxString m_prevTcValue; + +protected: + + // Sets some members to defaults (called constructors). + void Init1(); + + // Initializes some members (called by Create and complex constructor). + void Init2(); + + void OnPaint(wxPaintEvent &event ); + + // main event receivers + void OnMouseMove( wxMouseEvent &event ); + void OnMouseClick( wxMouseEvent &event ); + void OnMouseRightClick( wxMouseEvent &event ); + void OnMouseDoubleClick( wxMouseEvent &event ); + void OnMouseUp( wxMouseEvent &event ); + void OnKey( wxKeyEvent &event ); + void OnResize( wxSizeEvent &event ); + + // event handlers + bool HandleMouseMove( int x, unsigned int y, wxMouseEvent &event ); + bool HandleMouseClick( int x, unsigned int y, wxMouseEvent &event ); + bool HandleMouseRightClick( int x, unsigned int y, wxMouseEvent &event ); + bool HandleMouseDoubleClick( int x, unsigned int y, wxMouseEvent &event ); + bool HandleMouseUp( int x, unsigned int y, wxMouseEvent &event ); + void HandleKeyEvent( wxKeyEvent &event, bool fromChild ); + + void OnMouseEntry( wxMouseEvent &event ); + + void OnIdle( wxIdleEvent &event ); + void OnFocusEvent( wxFocusEvent &event ); + void OnChildFocusEvent( wxChildFocusEvent& event ); + + bool OnMouseCommon( wxMouseEvent &event, int* px, int *py ); + bool OnMouseChildCommon( wxMouseEvent &event, int* px, int *py ); + + // sub-control event handlers + void OnMouseClickChild( wxMouseEvent &event ); + void OnMouseRightClickChild( wxMouseEvent &event ); + void OnMouseMoveChild( wxMouseEvent &event ); + void OnMouseUpChild( wxMouseEvent &event ); + void OnChildKeyDown( wxKeyEvent &event ); + + void OnCaptureChange( wxMouseCaptureChangedEvent &event ); + + void OnScrollEvent( wxScrollWinEvent &event ); + + void OnSysColourChanged( wxSysColourChangedEvent &event ); + + void OnDPIChanged(wxDPIChangedEvent& event); + + void OnTLPClose( wxCloseEvent& event ); + +protected: + + bool AddToSelectionFromInputEvent( wxPGProperty* prop, + unsigned int colIndex, + wxMouseEvent* event = NULL, + int selFlags = 0 ); + + // Adjust the centering of the bitmap icons (collapse / expand) when the + // caption font changes. + // They need to be centered in the middle of the font, so a bit of deltaY + // adjustment is needed. On entry, m_captionFont must be set to window + // font. It will be modified properly. + void CalculateFontAndBitmapStuff( int vspacing ); + + wxRect GetEditorWidgetRect( wxPGProperty* p, int column ) const; + + void CorrectEditorWidgetSizeX(); + + // Called in RecalculateVirtualSize() to reposition control + // on virtual height changes. + void CorrectEditorWidgetPosY(); + +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_MSG("use two-argument function DoDrawItems(dc,rect)") + int DoDrawItems( wxDC& dc, + const wxRect* itemsRect, + bool isBuffered ) const + { + return DoDrawItemsBase(dc, itemsRect, isBuffered); + } + + int DoDrawItems( wxDC& dc, + const wxRect* itemsRect ) const + { + return DoDrawItemsBase(dc, itemsRect, true); + } + + int DoDrawItemsBase( wxDC& dc, + const wxRect* itemsRect, + bool isBuffered ) const; +#else + int DoDrawItems( wxDC& dc, + const wxRect* itemsRect ) const; +#endif + + // Draws an expand/collapse (ie. +/-) button. + virtual void DrawExpanderButton( wxDC& dc, const wxRect& rect, + wxPGProperty* property ) const; + + // Draws items from topItemY to bottomItemY + void DrawItems( wxDC& dc, + unsigned int topItemY, + unsigned int bottomItemY, + const wxRect* itemsRect = NULL ); + + // Translate wxKeyEvent to wxPG_ACTION_XXX + int KeyEventToActions(wxKeyEvent &event, int* pSecond) const; + + int KeyEventToAction(wxKeyEvent &event) const + { + return KeyEventToActions(event, NULL); + } + + void ImprovedClientToScreen( int* px, int* py ) const; + + // Called by focus event handlers. newFocused is the window that becomes + // focused. + void HandleFocusChange( wxWindow* newFocused ); + + // Reloads all non-customized colours from system settings. + void RegainColours(); + + virtual bool DoEditorValidate(); + + // Similar to DoSelectProperty() but also works on columns + // other than 1. Does not active editor if column is not + // editable. + bool DoSelectAndEdit( wxPGProperty* prop, + unsigned int colIndex, + unsigned int selFlags ); + + void DoSetSelection( const wxArrayPGProperty& newSelection, + int selFlags = 0 ); + + void DoSetSplitterPosition( int newxpos, + int splitterIndex = 0, + int flags = wxPG_SPLITTER_REFRESH ); + + bool DoAddToSelection( wxPGProperty* prop, + int selFlags = 0 ); + + bool DoRemoveFromSelection( wxPGProperty* prop, + int selFlags = 0 ); + + void DoBeginLabelEdit( unsigned int colIndex, int selFlags = 0 ); + void DoEndLabelEdit( bool commit, int selFlags = 0 ); + void OnLabelEditorEnterPress( wxCommandEvent& event ); + void OnLabelEditorKeyPress( wxKeyEvent& event ); + + wxPGProperty* DoGetItemAtY( int y ) const; + + void DestroyEditorWnd( wxWindow* wnd ); + void FreeEditors(); + + virtual bool DoExpand( wxPGProperty* p, bool sendEvent = false ); + + virtual bool DoCollapse( wxPGProperty* p, bool sendEvent = false ); + + // Returns nearest paint visible property (such that will be painted unless + // window is scrolled or resized). If given property is paint visible, then + // it itself will be returned. + wxPGProperty* GetNearestPaintVisible( wxPGProperty* p ) const; + + static void RegisterDefaultEditors(); + + // Sets up basic event handling for child control + void SetupChildEventHandling( wxWindow* wnd ); + + void CustomSetCursor( int type, bool override = false ); + + // Repositions scrollbar and underlying panel according + // to changed virtual size. + void RecalculateVirtualSize( int forceXPos = -1 ); + + void SetEditorAppearance( const wxPGCell& cell, + bool unspecified = false ); + + void ResetEditorAppearance() + { + wxPGCell cell; + cell.SetEmptyData(); + SetEditorAppearance(cell, false); + } + + void PrepareAfterItemsAdded(); + + // Send event from the property grid. + // Omit the wxPG_SEL_NOVALIDATE flag to allow vetoing the event + bool SendEvent( wxEventType eventType, wxPGProperty* p, + wxVariant* pValue = NULL, + unsigned int selFlags = wxPG_SEL_NOVALIDATE, + unsigned int column = 1 ); + + void SendEvent(wxEventType eventType, int intVal); + + // This function only moves focus to the wxPropertyGrid if it already + // was on one of its child controls. + void SetFocusOnCanvas(); + + bool DoHideProperty( wxPGProperty* p, bool hide, int flags ); + + void DeletePendingObjects(); + +private: + + bool ButtonTriggerKeyTest( int action, wxKeyEvent& event ); + + wxDECLARE_EVENT_TABLE(); +}; + +// ----------------------------------------------------------------------- + +#define wxPG_BASE_EVT_PRE_ID 1775 + +#ifndef SWIG + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_SELECTED, wxPropertyGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_CHANGING, wxPropertyGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_CHANGED, wxPropertyGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_HIGHLIGHTED, wxPropertyGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_RIGHT_CLICK, wxPropertyGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_PAGE_CHANGED, wxPropertyGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_ITEM_COLLAPSED, wxPropertyGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_ITEM_EXPANDED, wxPropertyGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_DOUBLE_CLICK, wxPropertyGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, + wxEVT_PG_LABEL_EDIT_BEGIN, wxPropertyGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, + wxEVT_PG_LABEL_EDIT_ENDING, wxPropertyGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, + wxEVT_PG_COL_BEGIN_DRAG, wxPropertyGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, + wxEVT_PG_COL_DRAGGING, wxPropertyGridEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, + wxEVT_PG_COL_END_DRAG, wxPropertyGridEvent ); +// Events used only internally +wxDECLARE_EVENT(wxEVT_PG_HSCROLL, wxPropertyGridEvent); +wxDECLARE_EVENT(wxEVT_PG_COLS_RESIZED, wxPropertyGridEvent); + +#else + enum { + wxEVT_PG_SELECTED = wxPG_BASE_EVT_PRE_ID, + wxEVT_PG_CHANGING, + wxEVT_PG_CHANGED, + wxEVT_PG_HIGHLIGHTED, + wxEVT_PG_RIGHT_CLICK, + wxEVT_PG_PAGE_CHANGED, + wxEVT_PG_ITEM_COLLAPSED, + wxEVT_PG_ITEM_EXPANDED, + wxEVT_PG_DOUBLE_CLICK, + wxEVT_PG_LABEL_EDIT_BEGIN, + wxEVT_PG_LABEL_EDIT_ENDING, + wxEVT_PG_COL_BEGIN_DRAG, + wxEVT_PG_COL_DRAGGING, + wxEVT_PG_COL_END_DRAG + }; +#endif + + +#define wxPG_BASE_EVT_TYPE wxEVT_PG_SELECTED +#define wxPG_MAX_EVT_TYPE (wxPG_BASE_EVT_TYPE+30) + + +#ifndef SWIG +typedef void (wxEvtHandler::*wxPropertyGridEventFunction)(wxPropertyGridEvent&); + +#define EVT_PG_SELECTED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_SELECTED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), +#define EVT_PG_CHANGING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_CHANGING, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), +#define EVT_PG_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_CHANGED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), +#define EVT_PG_HIGHLIGHTED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_HIGHLIGHTED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), +#define EVT_PG_RIGHT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_RIGHT_CLICK, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), +#define EVT_PG_DOUBLE_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_DOUBLE_CLICK, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), +#define EVT_PG_PAGE_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_PAGE_CHANGED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), +#define EVT_PG_ITEM_COLLAPSED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_ITEM_COLLAPSED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), +#define EVT_PG_ITEM_EXPANDED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_ITEM_EXPANDED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), +#define EVT_PG_LABEL_EDIT_BEGIN(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_LABEL_EDIT_BEGIN, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), +#define EVT_PG_LABEL_EDIT_ENDING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_LABEL_EDIT_ENDING, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), +#define EVT_PG_COL_BEGIN_DRAG(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_COL_BEGIN_DRAG, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), +#define EVT_PG_COL_DRAGGING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_COL_DRAGGING, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), +#define EVT_PG_COL_END_DRAG(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_COL_END_DRAG, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), + +#define wxPropertyGridEventHandler(fn) \ + wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ) + +#endif + + +// A propertygrid event holds information about events associated with +// wxPropertyGrid objects. +class WXDLLIMPEXP_PROPGRID wxPropertyGridEvent : public wxCommandEvent +{ +public: + + // Constructor. + wxPropertyGridEvent(wxEventType commandType=0, int id=0); + + // Copy constructor. + wxPropertyGridEvent(const wxPropertyGridEvent& event); + + // Destructor. + ~wxPropertyGridEvent(); + + // Copyer. + virtual wxEvent* Clone() const wxOVERRIDE; + + // Returns the column index associated with this event. + // For the column dragging events, it is the column to the left + // of the splitter being dragged + unsigned int GetColumn() const + { + return m_column; + } + + wxPGProperty* GetMainParent() const + { + wxCHECK_MSG(m_property, NULL, "Property cannot be NULL"); + return m_property->GetMainParent(); + } + + // Returns property associated with this event. + wxPGProperty* GetProperty() const + { + return m_property; + } + + wxPGValidationInfo& GetValidationInfo() + { + wxASSERT(m_validationInfo); + return *m_validationInfo; + } + + // Returns true if you can veto the action that the event is signaling. + bool CanVeto() const { return m_canVeto; } + + // Call this from your event handler to veto action that the event is + // signaling. + // You can only veto a shutdown if wxPropertyGridEvent::CanVeto returns + // true. + // Currently only wxEVT_PG_CHANGING supports vetoing. + void Veto( bool veto = true ) { m_wasVetoed = veto; } + + // Returns name of the associated property. + // Property name is stored in event, so it remains + // accessible even after the associated property or + // the property grid has been deleted. + wxString GetPropertyName() const + { + return m_propertyName; + } + + // Returns value of the associated property. Works for all event + // types, but for wxEVT_PG_CHANGING this member function returns + // the value that is pending, so you can call Veto() if the + // value is not satisfactory. + // Property value is stored in event, so it remains + // accessible even after the associated property or + // the property grid has been deleted. + wxVariant GetPropertyValue() const + { + return m_validationInfo ? m_validationInfo->GetValue() : m_value; + } + + // Returns value of the associated property. + // See GetPropertyValue() + wxVariant GetValue() const + { + return GetPropertyValue(); + } + + // Set override validation failure behaviour. + // Only effective if Veto was also called, and only allowed if event type + // is wxEVT_PG_CHANGING. + void SetValidationFailureBehavior( wxPGVFBFlags flags ) + { + wxASSERT( GetEventType() == wxEVT_PG_CHANGING ); + m_validationInfo->SetFailureBehavior( flags ); + } + + // Sets custom failure message for this time only. Only applies if + // wxPG_VFB_SHOW_MESSAGE is set in validation failure flags. + void SetValidationFailureMessage( const wxString& message ) + { + wxASSERT( GetEventType() == wxEVT_PG_CHANGING ); + m_validationInfo->SetFailureMessage( message ); + } + + wxPGVFBFlags GetValidationFailureBehavior() const + { + wxASSERT( GetEventType() == wxEVT_PG_CHANGING ); + return m_validationInfo->GetFailureBehavior(); + } + + void SetColumn( unsigned int column ) + { + m_column = column; + } + + void SetCanVeto( bool canVeto ) { m_canVeto = canVeto; } + bool WasVetoed() const { return m_wasVetoed; } + + // Changes the property associated with this event. + void SetProperty( wxPGProperty* p ) + { + m_property = p; + if ( p ) + m_propertyName = p->GetName(); + } + + void SetPropertyValue( const wxVariant& value ) + { + m_value = value; + } + + void SetPropertyGrid( wxPropertyGrid* pg ) + { + m_pg = pg; + OnPropertyGridSet(); + } + + void SetupValidationInfo() + { + wxASSERT(m_pg); + wxASSERT( GetEventType() == wxEVT_PG_CHANGING ); + m_validationInfo = &m_pg->GetValidationInfo(); + m_value = m_validationInfo->GetValue(); + } + +private: + void OnPropertyGridSet(); + wxDECLARE_DYNAMIC_CLASS(wxPropertyGridEvent); + + wxPGProperty* m_property; + wxPropertyGrid* m_pg; + wxPGValidationInfo* m_validationInfo; + + wxString m_propertyName; + wxVariant m_value; + + unsigned int m_column; + + bool m_canVeto; + bool m_wasVetoed; +}; + + +// ----------------------------------------------------------------------- + +// Allows populating wxPropertyGrid from arbitrary text source. +class WXDLLIMPEXP_PROPGRID wxPropertyGridPopulator +{ +public: + // Default constructor. + wxPropertyGridPopulator(); + + // Destructor. + virtual ~wxPropertyGridPopulator(); + + void SetState( wxPropertyGridPageState* state ); + + void SetGrid( wxPropertyGrid* pg ); + + // Appends a new property under bottommost parent. + // propClass - Property class as string. + wxPGProperty* Add( const wxString& propClass, + const wxString& propLabel, + const wxString& propName, + const wxString* propValue, + wxPGChoices* pChoices = NULL ); + + // Pushes property to the back of parent array (ie it becomes bottommost + // parent), and starts scanning/adding children for it. + // When finished, parent array is returned to the original state. + void AddChildren( wxPGProperty* property ); + + // Adds attribute to the bottommost property. + // type - Allowed values: "string", (same as string), "int", "bool". + // Empty string mean autodetect. + bool AddAttribute( const wxString& name, + const wxString& type, + const wxString& value ); + + // Called once in AddChildren. + virtual void DoScanForChildren() = 0; + + // Returns id of parent property for which children can currently be + // added. + wxPGProperty* GetCurParent() const + { + return m_propHierarchy.back(); + } + + wxPropertyGridPageState* GetState() { return m_state; } + const wxPropertyGridPageState* GetState() const { return m_state; } + + // Like wxString::ToLong, except allows N% in addition of N. + static bool ToLongPCT( const wxString& s, long* pval, long max ); + + // Parses strings of format "choice1"[=value1] ... "choiceN"[=valueN] into + // wxPGChoices. Registers parsed result using idString (if not empty). + // Also, if choices with given id already registered, then don't parse but + // return those choices instead. + wxPGChoices ParseChoices( const wxString& choicesString, + const wxString& idString ); + + // Implement in derived class to do custom process when an error occurs. + // Default implementation uses wxLogError. + virtual void ProcessError( const wxString& msg ); + +protected: + + // Used property grid. + wxPropertyGrid* m_pg; + + // Used property grid state. + wxPropertyGridPageState* m_state; + + // Tree-hierarchy of added properties (that can have children). + wxVector<wxPGProperty*> m_propHierarchy; + + // Hashmap for string-id to wxPGChoicesData mapping. + wxPGHashMapS2P m_dictIdChoices; +}; + +// ----------------------------------------------------------------------- + +// +// Undefine macros that are not needed outside propertygrid sources +// +#ifndef __wxPG_SOURCE_FILE__ + #undef wxPG_FL_DESC_REFRESH_REQUIRED + #undef wxPG_FL_CREATEDSTATE + #undef wxPG_FL_NOSTATUSBARHELP + #undef wxPG_FL_SCROLLED + #undef wxPG_FL_CUR_USES_CUSTOM_IMAGE + #undef wxPG_FL_PRIMARY_FILLS_ENTIRE + #undef wxPG_FL_VALUE_MODIFIED + #undef wxPG_FL_MOUSE_INSIDE + #undef wxPG_FL_FOCUSED + #undef wxPG_FL_MOUSE_CAPTURED + #undef wxPG_FL_INITIALIZED + #undef wxPG_FL_ACTIVATION_BY_CLICK + #undef wxPG_ICON_WIDTH + #undef wxPG_USE_RENDERER_NATIVE +#endif + +// ----------------------------------------------------------------------- + +#endif + +#endif // _WX_PROPGRID_PROPGRID_H_ diff --git a/lib/wxWidgets/include/wx/propgrid/propgriddefs.h b/lib/wxWidgets/include/wx/propgrid/propgriddefs.h new file mode 100644 index 0000000..bd7eb59 --- /dev/null +++ b/lib/wxWidgets/include/wx/propgrid/propgriddefs.h @@ -0,0 +1,766 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/propgrid/propgriddefs.h +// Purpose: wxPropertyGrid miscellaneous definitions +// Author: Jaakko Salli +// Modified by: +// Created: 2008-08-31 +// Copyright: (c) Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PROPGRID_PROPGRIDDEFS_H_ +#define _WX_PROPGRID_PROPGRIDDEFS_H_ + +#include "wx/defs.h" + +#if wxUSE_PROPGRID + +#include "wx/colour.h" +#include "wx/hashset.h" + +class WXDLLIMPEXP_FWD_CORE wxPoint; +class WXDLLIMPEXP_FWD_CORE wxSize; +class WXDLLIMPEXP_FWD_CORE wxFont; + +#if wxUSE_STD_CONTAINERS +#include <numeric> +#endif // wxUSE_STD_CONTAINERS + +// ----------------------------------------------------------------------- + +// +// Here are some platform dependent defines +// NOTE: More in propertygrid.cpp +// +// NB: Only define wxPG_TEXTCTRLXADJUST for platforms that do not +// (yet) support wxTextEntry::SetMargins() for the left margin. + +#if defined(__WXMSW__) + + // space between vertical line and value text + #define wxPG_XBEFORETEXT 4 + // space between vertical line and value editor control + #define wxPG_XBEFOREWIDGET 1 + + // left margin can be set with wxTextEntry::SetMargins() + #undef wxPG_TEXTCTRLXADJUST + + // comment to use bitmap buttons + #define wxPG_ICON_WIDTH 9 + // 1 if wxRendererNative should be employed + #define wxPG_USE_RENDERER_NATIVE 1 + + // width of optional bitmap/image in front of property + #define wxPG_CUSTOM_IMAGE_WIDTH 20 + + // 1 if splitter drag detect margin and control cannot overlap + #define wxPG_NO_CHILD_EVT_MOTION 0 + + #define wxPG_NAT_BUTTON_BORDER_ANY 1 + #define wxPG_NAT_BUTTON_BORDER_X 1 + #define wxPG_NAT_BUTTON_BORDER_Y 1 + + // If 1 then controls are refreshed explicitly in a few places + #define wxPG_REFRESH_CONTROLS 0 + +#elif defined(__WXGTK__) + + // space between vertical line and value text + #define wxPG_XBEFORETEXT 5 + // space between vertical line and value editor control + #define wxPG_XBEFOREWIDGET 1 + + // x position adjustment for wxTextCtrl (and like) + // left margin can be set with wxTextEntry::SetMargins() + #undef wxPG_TEXTCTRLXADJUST + + // comment to use bitmap buttons + #define wxPG_ICON_WIDTH 9 + // 1 if wxRendererNative should be employed + #define wxPG_USE_RENDERER_NATIVE 1 + + // width of optional bitmap/image in front of property + #define wxPG_CUSTOM_IMAGE_WIDTH 20 + + // 1 if splitter drag detect margin and control cannot overlap + #define wxPG_NO_CHILD_EVT_MOTION 1 + + #define wxPG_NAT_BUTTON_BORDER_ANY 1 + #define wxPG_NAT_BUTTON_BORDER_X 1 + #define wxPG_NAT_BUTTON_BORDER_Y 1 + + // If 1 then controls are refreshed after selected was drawn. + #define wxPG_REFRESH_CONTROLS 1 + +#elif defined(__WXMAC__) + + // space between vertical line and value text + #define wxPG_XBEFORETEXT 4 + // space between vertical line and value editor widget + #define wxPG_XBEFOREWIDGET 1 + + // x position adjustment for wxTextCtrl (and like) + // left margin cannot be set with wxTextEntry::SetMargins() + #define wxPG_TEXTCTRLXADJUST 1 + + // comment to use bitmap buttons + #define wxPG_ICON_WIDTH 11 + // 1 if wxRendererNative should be employed + #define wxPG_USE_RENDERER_NATIVE 1 + + // width of optional bitmap/image in front of property + #define wxPG_CUSTOM_IMAGE_WIDTH 20 + + // 1 if splitter drag detect margin and control cannot overlap + #define wxPG_NO_CHILD_EVT_MOTION 0 + + #define wxPG_NAT_BUTTON_BORDER_ANY 0 + #define wxPG_NAT_BUTTON_BORDER_X 0 + #define wxPG_NAT_BUTTON_BORDER_Y 0 + + // If 1 then controls are refreshed after selected was drawn. + #define wxPG_REFRESH_CONTROLS 0 + +#else // defaults + + // space between vertical line and value text + #define wxPG_XBEFORETEXT 5 + // space between vertical line and value editor widget + #define wxPG_XBEFOREWIDGET 1 + + // x position adjustment for wxTextCtrl (and like) + // left margin cannot be set with wxTextEntry::SetMargins() + #define wxPG_TEXTCTRLXADJUST 3 + + // comment to use bitmap buttons + #define wxPG_ICON_WIDTH 9 + // 1 if wxRendererNative should be employed + #define wxPG_USE_RENDERER_NATIVE 0 + + // width of optional bitmap/image in front of property + #define wxPG_CUSTOM_IMAGE_WIDTH 20 + + // 1 if splitter drag detect margin and control cannot overlap + #define wxPG_NO_CHILD_EVT_MOTION 1 + + #define wxPG_NAT_BUTTON_BORDER_ANY 0 + #define wxPG_NAT_BUTTON_BORDER_X 0 + #define wxPG_NAT_BUTTON_BORDER_Y 0 + + // If 1 then controls are refreshed after selected was drawn. + #define wxPG_REFRESH_CONTROLS 0 +#endif // platform + + +#define wxPG_CONTROL_MARGIN 0 // space between splitter and control + +#define wxCC_CUSTOM_IMAGE_MARGIN1 4 // before image +#define wxCC_CUSTOM_IMAGE_MARGIN2 5 // after image + +#define DEFAULT_IMAGE_OFFSET_INCREMENT \ + (wxCC_CUSTOM_IMAGE_MARGIN1 + wxCC_CUSTOM_IMAGE_MARGIN2) + +#define wxPG_DRAG_MARGIN 30 + +#if wxPG_NO_CHILD_EVT_MOTION + #define wxPG_SPLITTERX_DETECTMARGIN1 3 // this much on left + #define wxPG_SPLITTERX_DETECTMARGIN2 2 // this much on right +#else + #define wxPG_SPLITTERX_DETECTMARGIN1 3 // this much on left + #define wxPG_SPLITTERX_DETECTMARGIN2 2 // this much on right +#endif + +// Use this macro to generate standard custom image height from +#define wxPG_STD_CUST_IMAGE_HEIGHT(LINEHEIGHT) ((LINEHEIGHT)-3) + +// Undefine wxPG_ICON_WIDTH to use supplied xpm bitmaps instead +// (for tree buttons) +//#undef wxPG_ICON_WIDTH + +#if WXWIN_COMPATIBILITY_2_8 + #define wxPG_COMPATIBILITY_1_4 1 +#else + #define wxPG_COMPATIBILITY_1_4 0 +#endif + +// Set 1 to include advanced properties (wxFontProperty, wxColourProperty, etc.) +#ifndef wxPG_INCLUDE_ADVPROPS + #define wxPG_INCLUDE_ADVPROPS 1 +#endif + +// Set 1 to include checkbox editor class +#define wxPG_INCLUDE_CHECKBOX 1 + +// ----------------------------------------------------------------------- + + +class WXDLLIMPEXP_FWD_PROPGRID wxPGEditor; +class WXDLLIMPEXP_FWD_PROPGRID wxPGProperty; +class WXDLLIMPEXP_FWD_PROPGRID wxPropertyCategory; +class WXDLLIMPEXP_FWD_PROPGRID wxPGChoices; +class WXDLLIMPEXP_FWD_PROPGRID wxPropertyGridPageState; +class WXDLLIMPEXP_FWD_PROPGRID wxPGCell; +class WXDLLIMPEXP_FWD_PROPGRID wxPGCellRenderer; +class WXDLLIMPEXP_FWD_PROPGRID wxPGChoiceEntry; +class WXDLLIMPEXP_FWD_PROPGRID wxPGPropArgCls; +class WXDLLIMPEXP_FWD_PROPGRID wxPropertyGridInterface; +class WXDLLIMPEXP_FWD_PROPGRID wxPropertyGrid; +class WXDLLIMPEXP_FWD_PROPGRID wxPropertyGridEvent; +class wxPropertyGridManager; +class WXDLLIMPEXP_FWD_PROPGRID wxPGEditorDialogAdapter; +class WXDLLIMPEXP_FWD_PROPGRID wxPGValidationInfo; + + +// ----------------------------------------------------------------------- + +// Some miscellaneous values, types and macros. + +// Used to tell wxPGProperty to use label as name as well +#define wxPG_LABEL (*wxPGProperty::sm_wxPG_LABEL) + +// This is the value placed in wxPGProperty::sm_wxPG_LABEL +#define wxPG_LABEL_STRING wxS("@!") +#if WXWIN_COMPATIBILITY_3_0 +#define wxPG_NULL_BITMAP wxNullBitmap +#endif // WXWIN_COMPATIBILITY_3_0 +#define wxPG_COLOUR_BLACK (*wxBLACK) + +// Convert Red, Green and Blue to a single 32-bit value. +#define wxPG_COLOUR(R,G,B) ((wxUint32)((R)+((G)<<8)+((B)<<16))) + + +// If property is supposed to have custom-painted image, then returning +// this in OnMeasureImage() will usually be enough. +#define wxPG_DEFAULT_IMAGE_SIZE wxDefaultSize + + +// This callback function is used for sorting properties. +// Call wxPropertyGrid::SetSortFunction() to set it. +// Sort function should return a value greater than 0 if position of p1 is +// after p2. So, for instance, when comparing property names, you can use +// following implementation: +// int MyPropertySortFunction(wxPropertyGrid* propGrid, +// wxPGProperty* p1, +// wxPGProperty* p2) +// { +// return p1->GetBaseName().compare( p2->GetBaseName() ); +// } +typedef int (*wxPGSortCallback)(wxPropertyGrid* propGrid, + wxPGProperty* p1, + wxPGProperty* p2); + + +#if WXWIN_COMPATIBILITY_3_0 +typedef wxString wxPGCachedString; +#endif + +// ----------------------------------------------------------------------- + +// Used to indicate wxPGChoices::Add etc. that the value is actually not given +// by the caller. +#define wxPG_INVALID_VALUE INT_MAX + +// ----------------------------------------------------------------------- + +WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(wxPGProperty*, wxArrayPGProperty, + wxBaseArrayPtrVoid, + class WXDLLIMPEXP_PROPGRID); + +WX_DECLARE_STRING_HASH_MAP_WITH_DECL(void*, + wxPGHashMapS2P, + class WXDLLIMPEXP_PROPGRID); + +WX_DECLARE_STRING_HASH_MAP_WITH_DECL(wxString, + wxPGHashMapS2S, + class WXDLLIMPEXP_PROPGRID); + +WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL(void*, + wxPGHashMapP2P, + class WXDLLIMPEXP_PROPGRID); + +WX_DECLARE_HASH_MAP_WITH_DECL(wxInt32, + wxInt32, + wxIntegerHash, + wxIntegerEqual, + wxPGHashMapI2I, + class WXDLLIMPEXP_PROPGRID); + +WX_DECLARE_HASH_SET_WITH_DECL(int, + wxIntegerHash, + wxIntegerEqual, + wxPGHashSetInt, + class WXDLLIMPEXP_PROPGRID); + +#if WXWIN_COMPATIBILITY_3_0 +WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(wxObject*, wxArrayPGObject, + wxBaseArrayPtrVoid, + class WXDLLIMPEXP_PROPGRID); +#endif // WXWIN_COMPATIBILITY_3_0 + +// ----------------------------------------------------------------------- + +enum wxPG_PROPERTYVALUES_FLAGS +{ +// Flag for wxPropertyGridInterface::SetProperty* functions, +// wxPropertyGridInterface::HideProperty(), etc. +// Apply changes only for the property in question. +wxPG_DONT_RECURSE = 0x00000000, + +// Flag for wxPropertyGridInterface::GetPropertyValues(). +// Use this flag to retain category structure; each sub-category +// will be its own wxVariantList of wxVariant. +wxPG_KEEP_STRUCTURE = 0x00000010, + +// Flag for wxPropertyGridInterface::SetProperty* functions, +// wxPropertyGridInterface::HideProperty(), etc. +// Apply changes recursively for the property and all its children. +wxPG_RECURSE = 0x00000020, + +// Flag for wxPropertyGridInterface::GetPropertyValues(). +// Use this flag to include property attributes as well. +wxPG_INC_ATTRIBUTES = 0x00000040, + +// Used when first starting recursion. +wxPG_RECURSE_STARTS = 0x00000080, + +// Force value change. +wxPG_FORCE = 0x00000100, + +// Only sort categories and their immediate children. +// Sorting done by wxPG_AUTO_SORT option uses this. +wxPG_SORT_TOP_LEVEL_ONLY = 0x00000200 +}; + +// ----------------------------------------------------------------------- + +// Misc. argument flags. +enum wxPG_MISC_ARG_FLAGS +{ + // Get/Store full value instead of displayed value. + wxPG_FULL_VALUE = 0x00000001, + + // Perform special action in case of unsuccessful conversion. + wxPG_REPORT_ERROR = 0x00000002, + + wxPG_PROPERTY_SPECIFIC = 0x00000004, + + // Get/Store editable value instead of displayed one (should only be + // different in the case of common values) + wxPG_EDITABLE_VALUE = 0x00000008, + + // Used when dealing with fragments of composite string value + wxPG_COMPOSITE_FRAGMENT = 0x00000010, + + // Means property for which final string value is for cannot really be + // edited. + wxPG_UNEDITABLE_COMPOSITE_FRAGMENT = 0x00000020, + + // ValueToString() called from GetValueAsString() + // (guarantees that input wxVariant value is current own value) + wxPG_VALUE_IS_CURRENT = 0x00000040, + + // Value is being set programmatically (i.e. not by user) + wxPG_PROGRAMMATIC_VALUE = 0x00000080 +}; + +// ----------------------------------------------------------------------- + +// wxPGProperty::SetValue() flags +enum wxPG_SETVALUE_FLAGS +{ + wxPG_SETVAL_REFRESH_EDITOR = 0x0001, + wxPG_SETVAL_AGGREGATED = 0x0002, + wxPG_SETVAL_FROM_PARENT = 0x0004, + wxPG_SETVAL_BY_USER = 0x0008 // Set if value changed by user +}; + +// ----------------------------------------------------------------------- + +// +// Valid constants for wxPG_UINT_BASE attribute +// (long because of wxVariant constructor) +#define wxPG_BASE_OCT 8L +#define wxPG_BASE_DEC 10L +#define wxPG_BASE_HEX 16L +#define wxPG_BASE_HEXL 32L + +// +// Valid constants for wxPG_UINT_PREFIX attribute +#define wxPG_PREFIX_NONE 0L +#define wxPG_PREFIX_0x 1L +#define wxPG_PREFIX_DOLLAR_SIGN 2L + +// ----------------------------------------------------------------------- +// Editor class. + +// Editor accessor (for backwards compatibility use only). +#define wxPG_EDITOR(T) wxPGEditor_##T + +// Macro for declaring editor class, with optional impexpdecl part. +#ifndef WX_PG_DECLARE_EDITOR_WITH_DECL + + #define WX_PG_DECLARE_EDITOR_WITH_DECL(EDITOR,DECL) \ + extern DECL wxPGEditor* wxPGEditor_##EDITOR; \ + extern DECL wxPGEditor* wxPGConstruct##EDITOR##EditorClass(); + +#endif + +// Declare editor class. +#define WX_PG_DECLARE_EDITOR(EDITOR) \ +extern wxPGEditor* wxPGEditor_##EDITOR; \ +extern wxPGEditor* wxPGConstruct##EDITOR##EditorClass(); + +// Declare built-in editor classes. +WX_PG_DECLARE_EDITOR_WITH_DECL(TextCtrl,WXDLLIMPEXP_PROPGRID) +WX_PG_DECLARE_EDITOR_WITH_DECL(Choice,WXDLLIMPEXP_PROPGRID) +WX_PG_DECLARE_EDITOR_WITH_DECL(ComboBox,WXDLLIMPEXP_PROPGRID) +WX_PG_DECLARE_EDITOR_WITH_DECL(TextCtrlAndButton,WXDLLIMPEXP_PROPGRID) +#if wxPG_INCLUDE_CHECKBOX +WX_PG_DECLARE_EDITOR_WITH_DECL(CheckBox,WXDLLIMPEXP_PROPGRID) +#endif +WX_PG_DECLARE_EDITOR_WITH_DECL(ChoiceAndButton,WXDLLIMPEXP_PROPGRID) + +// ----------------------------------------------------------------------- + +#ifndef SWIG + +// +// Macro WXVARIANT allows creation of wxVariant from any type supported by +// wxWidgets internally, and of all types created using +// WX_PG_DECLARE_VARIANT_DATA. +template<class T> +wxVariant WXVARIANT( const T& WXUNUSED(value) ) +{ + wxFAIL_MSG(wxS("Code should always call specializations of this template")); + return wxVariant(); +} + +template<> inline wxVariant WXVARIANT( const int& value ) + { return wxVariant((long)value); } +template<> inline wxVariant WXVARIANT( const long& value ) + { return wxVariant(value); } +template<> inline wxVariant WXVARIANT( const bool& value ) + { return wxVariant(value); } +template<> inline wxVariant WXVARIANT( const double& value ) + { return wxVariant(value); } +template<> inline wxVariant WXVARIANT( const wxArrayString& value ) + { return wxVariant(value); } +template<> inline wxVariant WXVARIANT( const wxString& value ) + { return wxVariant(value); } +#if wxUSE_LONGLONG +template<> inline wxVariant WXVARIANT( const wxLongLong& value ) + { return wxVariant(value); } +template<> inline wxVariant WXVARIANT( const wxULongLong& value ) + { return wxVariant(value); } +#endif +#if wxUSE_DATETIME +template<> inline wxVariant WXVARIANT( const wxDateTime& value ) + { return wxVariant(value); } +#endif + + +// +// These are modified versions of DECLARE/WX_PG_IMPLEMENT_VARIANT_DATA +// macros found in variant.h. Differences are as follows: +// * These support non-wxObject data +// * These implement classname##RefFromVariant function which returns +// reference to data within. +// * const char* classname##_VariantType which equals classname. +// * WXVARIANT +// +#define WX_PG_DECLARE_VARIANT_DATA(classname) \ + WX_PG_DECLARE_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE) + +#define WX_PG_DECLARE_VARIANT_DATA_EXPORTED(classname,expdecl) \ +expdecl classname& operator << ( classname &object, const wxVariant &variant ); \ +expdecl wxVariant& operator << ( wxVariant &variant, const classname &object ); \ +expdecl const classname& classname##RefFromVariant( const wxVariant& variant ); \ +expdecl classname& classname##RefFromVariant( wxVariant& variant ); \ +template<> inline wxVariant WXVARIANT( const classname& value ) \ +{ \ + wxVariant variant; \ + variant << value; \ + return variant; \ +} \ +extern expdecl const char* classname##_VariantType; + + +#define WX_PG_IMPLEMENT_VARIANT_DATA(classname) \ + WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE) + +// Add getter (i.e. classname << variant) separately to allow +// custom implementations. +#define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,expdecl) \ +const char* classname##_VariantType = #classname; \ +class classname##VariantData: public wxVariantData \ +{ \ +public:\ + classname##VariantData() {} \ + classname##VariantData( const classname &value ) : m_value(value) { } \ +\ + classname &GetValue() { return m_value; } \ +\ + const classname &GetValue() const { return m_value; } \ +\ + virtual bool Eq(wxVariantData& data) const wxOVERRIDE; \ +\ + virtual wxString GetType() const wxOVERRIDE; \ +\ + virtual wxVariantData* Clone() const wxOVERRIDE { return new classname##VariantData(m_value); } \ +\ + DECLARE_WXANY_CONVERSION() \ +protected:\ + classname m_value; \ +};\ +\ +IMPLEMENT_TRIVIAL_WXANY_CONVERSION(classname, classname##VariantData) \ +\ +wxString classname##VariantData::GetType() const\ +{\ + return wxS(#classname);\ +}\ +\ +expdecl wxVariant& operator << ( wxVariant &variant, const classname &value )\ +{\ + classname##VariantData *data = new classname##VariantData( value );\ + variant.SetData( data );\ + return variant;\ +} \ +expdecl classname& classname##RefFromVariant( wxVariant& variant ) \ +{ \ + wxASSERT_MSG( variant.GetType() == wxS(#classname), \ + wxString::Format(wxS("Variant type should have been '%s'") \ + wxS("instead of '%s'"), \ + wxS(#classname), \ + variant.GetType())); \ + classname##VariantData *data = \ + (classname##VariantData*) variant.GetData(); \ + return data->GetValue();\ +} \ +expdecl const classname& classname##RefFromVariant( const wxVariant& variant ) \ +{ \ + wxASSERT_MSG( variant.GetType() == wxS(#classname), \ + wxString::Format(wxS("Variant type should have been '%s'") \ + wxS("instead of '%s'"), \ + wxS(#classname), \ + variant.GetType())); \ + classname##VariantData *data = \ + (classname##VariantData*) variant.GetData(); \ + return data->GetValue();\ +} + +#define WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname, expdecl) \ +expdecl classname& operator << ( classname &value, const wxVariant &variant )\ +{\ + wxASSERT( variant.GetType() == #classname );\ + \ + classname##VariantData *data = (classname##VariantData*) variant.GetData();\ + value = data->GetValue();\ + return value;\ +} + +#define WX_PG_IMPLEMENT_VARIANT_DATA_EQ(classname, expdecl) \ +bool classname##VariantData::Eq(wxVariantData& data) const \ +{\ + wxASSERT( GetType() == data.GetType() );\ +\ + classname##VariantData & otherData = (classname##VariantData &) data;\ +\ + return otherData.m_value == m_value;\ +} + +// implements a wxVariantData-derived class using for the Eq() method the +// operator== which must have been provided by "classname" +#define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname,expdecl) \ +WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \ +WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \ +WX_PG_IMPLEMENT_VARIANT_DATA_EQ(classname,wxEMPTY_PARAMETER_VALUE expdecl) + +#define WX_PG_IMPLEMENT_VARIANT_DATA(classname) \ +WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE) + +// with Eq() implementation that always returns false +#define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_DUMMY_EQ(classname,expdecl) \ +WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \ +WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \ +\ +bool classname##VariantData::Eq(wxVariantData& WXUNUSED(data)) const \ +{\ + return false; \ +} + +#define WX_PG_IMPLEMENT_VARIANT_DATA_DUMMY_EQ(classname) \ +WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_DUMMY_EQ(classname, wxEMPTY_PARAMETER_VALUE) + +WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxPoint, WXDLLIMPEXP_PROPGRID) +WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxSize, WXDLLIMPEXP_PROPGRID) +WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxArrayInt, WXDLLIMPEXP_PROPGRID) +DECLARE_VARIANT_OBJECT_EXPORTED(wxFont, WXDLLIMPEXP_PROPGRID) +template<> inline wxVariant WXVARIANT( const wxFont& value ) +{ + wxVariant variant; + variant << value; + return variant; +} + +template<> inline wxVariant WXVARIANT( const wxColour& value ) +{ + wxVariant variant; + variant << value; + return variant; +} + +// Define constants for common wxVariant type strings + +#define wxPG_VARIANT_TYPE_STRING wxPGGlobalVars->m_strstring +#define wxPG_VARIANT_TYPE_LONG wxPGGlobalVars->m_strlong +#define wxPG_VARIANT_TYPE_BOOL wxPGGlobalVars->m_strbool +#define wxPG_VARIANT_TYPE_LIST wxPGGlobalVars->m_strlist +#define wxPG_VARIANT_TYPE_DOUBLE wxS("double") +#define wxPG_VARIANT_TYPE_ARRSTRING wxS("arrstring") +#if wxUSE_DATETIME +#define wxPG_VARIANT_TYPE_DATETIME wxS("datetime") +#endif +#if wxUSE_LONGLONG +#define wxPG_VARIANT_TYPE_LONGLONG wxS("longlong") +#define wxPG_VARIANT_TYPE_ULONGLONG wxS("ulonglong") +#endif +#endif // !SWIG + +// ----------------------------------------------------------------------- + +// +// Tokenizer macros. +// NOTE: I have made two versions - worse ones (performance and consistency +// wise) use wxStringTokenizer and better ones (may have unfound bugs) +// use custom code. +// + +#include "wx/tokenzr.h" + +// TOKENIZER1 can be done with wxStringTokenizer +#define WX_PG_TOKENIZER1_BEGIN(WXSTRING,DELIMITER) \ + wxStringTokenizer tkz(WXSTRING,DELIMITER,wxTOKEN_RET_EMPTY); \ + while ( tkz.HasMoreTokens() ) \ + { \ + wxString token = tkz.GetNextToken(); \ + token.Trim(true); \ + token.Trim(false); + +#define WX_PG_TOKENIZER1_END() \ + } + + +// +// 2nd version: tokens are surrounded by DELIMITERs (for example, C-style +// strings). TOKENIZER2 must use custom code (a class) for full compliance with +// " surrounded strings with \" inside. +// +// class implementation is in propgrid.cpp +// + +class WXDLLIMPEXP_PROPGRID wxPGStringTokenizer +{ +public: + wxPGStringTokenizer( const wxString& str, wxChar delimiter ); + ~wxPGStringTokenizer(); + + bool HasMoreTokens(); // not const so we can do some stuff in it + wxString GetNextToken(); + +protected: + const wxString& m_str; + wxString::const_iterator m_curPos; + wxString m_readyToken; + wxUniChar m_delimiter; +}; + +#define WX_PG_TOKENIZER2_BEGIN(WXSTRING,DELIMITER) \ + wxPGStringTokenizer tkz(WXSTRING,DELIMITER); \ + while ( tkz.HasMoreTokens() ) \ + { \ + wxString token = tkz.GetNextToken(); + +#define WX_PG_TOKENIZER2_END() \ + } + +// ----------------------------------------------------------------------- +// wxVector utilities + +// Utility to check if specific item is in a vector. +template<typename T> +inline bool wxPGItemExistsInVector(const wxVector<T>& vector, const T& item) +{ +#if wxUSE_STL + return std::find(vector.begin(), vector.end(), item) != vector.end(); +#else + for (typename wxVector<T>::const_iterator it = vector.begin(); it != vector.end(); ++it) + { + if ( *it == item ) + return true; + } + return false; +#endif // wxUSE_STL/!wxUSE_STL +} + +// Utility to determine the index of the item in the vector. +template<typename T> +inline int wxPGItemIndexInVector(const wxVector<T>& vector, const T& item) +{ +#if wxUSE_STL + typename wxVector<T>::const_iterator it = std::find(vector.begin(), vector.end(), item); + if ( it != vector.end() ) + return (int)(it - vector.begin()); + + return wxNOT_FOUND; +#else + for (typename wxVector<T>::const_iterator it = vector.begin(); it != vector.end(); ++it) + { + if ( *it == item ) + return (int)(it - vector.begin()); + } + return wxNOT_FOUND; +#endif // wxUSE_STL/!wxUSE_STL +} + +// Utility to remove given item from the vector. +template<typename T> +inline void wxPGRemoveItemFromVector(wxVector<T>& vector, const T& item) +{ +#if wxUSE_STL + typename wxVector<T>::iterator it = std::find(vector.begin(), vector.end(), item); + if ( it != vector.end() ) + { + vector.erase(it); + } +#else + for (typename wxVector<T>::iterator it = vector.begin(); it != vector.end(); ++it) + { + if ( *it == item ) + { + vector.erase(it); + return; + } + } +#endif // wxUSE_STL/!wxUSE_STL +} + +// Utility to calaculate sum of all elements of the vector. +template<typename T> +inline T wxPGGetSumVectorItems(const wxVector<T>& vector, T init) +{ +#if wxUSE_STD_CONTAINERS + return std::accumulate(vector.begin(), vector.end(), init); +#else + for (typename wxVector<T>::const_iterator it = vector.begin(); it != vector.end(); ++it) + init += *it; + + return init; +#endif // wxUSE_STD_CONTAINERS/!wxUSE_STD_CONTAINERS +} + +// ----------------------------------------------------------------------- + +#endif // wxUSE_PROPGRID + +#endif // _WX_PROPGRID_PROPGRIDDEFS_H_ diff --git a/lib/wxWidgets/include/wx/propgrid/propgridiface.h b/lib/wxWidgets/include/wx/propgrid/propgridiface.h new file mode 100644 index 0000000..cad21ae --- /dev/null +++ b/lib/wxWidgets/include/wx/propgrid/propgridiface.h @@ -0,0 +1,1106 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/propgrid/propgridiface.h +// Purpose: wxPropertyGridInterface class +// Author: Jaakko Salli +// Modified by: +// Created: 2008-08-24 +// Copyright: (c) Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __WX_PROPGRID_PROPGRIDIFACE_H__ +#define __WX_PROPGRID_PROPGRIDIFACE_H__ + +#include "wx/defs.h" + +#if wxUSE_PROPGRID + +#include "wx/propgrid/property.h" +#include "wx/propgrid/propgridpagestate.h" + +// ----------------------------------------------------------------------- + +// Most property grid functions have this type as their argument, as it can +// convey a property by either a pointer or name. +class WXDLLIMPEXP_PROPGRID wxPGPropArgCls +{ +public: + wxPGPropArgCls( const wxPGProperty* property ) + { + m_property = const_cast<wxPGProperty*>(property); + m_isProperty = true; + } + wxPGPropArgCls( const wxString& str ) + { + m_name = str; + m_property = NULL; + m_isProperty = false; + } + wxPGPropArgCls( const wxPGPropArgCls& id ) + { + m_isProperty = id.m_isProperty; + m_property = id.m_property; + m_name = id.m_name; + } + // This is only needed for wxPython bindings. + wxPGPropArgCls( wxString* str, bool WXUNUSED(deallocPtr) ) + { + m_name = *str; + delete str; // we own this string + m_property = NULL; + m_isProperty = false; + } + wxPGProperty* GetPtr() const + { + wxCHECK( m_isProperty, NULL ); + return m_property; + } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxPGPropArgCls( const char* str ) + { + m_name = str; + m_property = NULL; + m_isProperty = false; + } +#endif // !wxNO_IMPLICIT_WXSTRING_ENCODING + wxPGPropArgCls( const wchar_t* str ) + { + m_name = str; + m_property = NULL; + m_isProperty = false; + } + // This constructor is required for NULL. + wxPGPropArgCls( int ) + { + m_property = NULL; + m_isProperty = true; + } + wxPGProperty* GetPtr( wxPropertyGridInterface* iface ) const; + wxPGProperty* GetPtr( const wxPropertyGridInterface* iface ) const + { + return GetPtr(const_cast<wxPropertyGridInterface*>(iface)); + } + wxPGProperty* GetPtr0() const { return m_property; } + bool HasName() const { return !m_isProperty; } + const wxString& GetName() const { return m_name; } + +private: + bool m_isProperty; + wxPGProperty* m_property; + wxString m_name; +}; + +typedef const wxPGPropArgCls& wxPGPropArg; + +// ----------------------------------------------------------------------- + +WXDLLIMPEXP_PROPGRID +void wxPGTypeOperationFailed( const wxPGProperty* p, + const wxString& typestr, + const wxString& op ); +WXDLLIMPEXP_PROPGRID +void wxPGGetFailed( const wxPGProperty* p, const wxString& typestr ); + +// ----------------------------------------------------------------------- + +// Helper macro that does necessary preparations when calling +// some wxPGProperty's member function. +#define wxPG_PROP_ARG_CALL_PROLOG_0(PROPERTY) \ + PROPERTY *p = (PROPERTY*)id.GetPtr(this); \ + if ( !p ) return; + +#define wxPG_PROP_ARG_CALL_PROLOG_RETVAL_0(PROPERTY, RETVAL) \ + PROPERTY *p = (PROPERTY*)id.GetPtr(this); \ + if ( !p ) return RETVAL; + +#define wxPG_PROP_ARG_CALL_PROLOG() \ + wxPG_PROP_ARG_CALL_PROLOG_0(wxPGProperty) + +#define wxPG_PROP_ARG_CALL_PROLOG_RETVAL(RVAL) \ + wxPG_PROP_ARG_CALL_PROLOG_RETVAL_0(wxPGProperty, RVAL) + +#define wxPG_PROP_ID_CONST_CALL_PROLOG() \ + wxPG_PROP_ARG_CALL_PROLOG_0(const wxPGProperty) + +#define wxPG_PROP_ID_CONST_CALL_PROLOG_RETVAL(RVAL) \ + wxPG_PROP_ARG_CALL_PROLOG_RETVAL_0(const wxPGProperty, RVAL) + +// ----------------------------------------------------------------------- + + +// Most of the shared property manipulation interface shared by wxPropertyGrid, +// wxPropertyGridPage, and wxPropertyGridManager is defined in this class. +// In separate wxPropertyGrid component this class was known as +// wxPropertyContainerMethods. +// wxPropertyGridInterface's property operation member functions all accept +// a special wxPGPropArg id argument, using which you can refer to properties +// either by their pointer (for performance) or by their name (for conveniency). +class WXDLLIMPEXP_PROPGRID wxPropertyGridInterface +{ +public: + + // Destructor. + virtual ~wxPropertyGridInterface() { } + + // Appends property to the list. + // wxPropertyGrid assumes ownership of the object. + // Becomes child of most recently added category. + // wxPropertyGrid takes the ownership of the property pointer. + // If appending a category with name identical to a category already in + // the wxPropertyGrid, then newly created category is deleted, and most + // recently added category (under which properties are appended) is set + // to the one with same name. This allows easier adding of items to same + // categories in multiple passes. + // Does not automatically redraw the control, so you may need to call + // Refresh when calling this function after control has been shown for + // the first time. + // This functions deselects selected property, if any. Validation + // failure option wxPG_VFB_STAY_IN_PROPERTY is not respected, ie. + // selection is cleared even if editor had invalid value. + wxPGProperty* Append( wxPGProperty* property ); + + // Same as Append(), but appends under given parent property. + wxPGProperty* AppendIn( wxPGPropArg id, wxPGProperty* newproperty ); + + // In order to add new items into a property with fixed children (for + // instance, wxFlagsProperty), you need to call this method. After + // populating has been finished, you need to call EndAddChildren. + void BeginAddChildren( wxPGPropArg id ); + + // Deletes all properties. + virtual void Clear() = 0; + + // Clears current selection, if any. + // validation - If set to false, deselecting the property will always work, + // even if its editor had invalid value in it. + // Returns true if successful or if there was no selection. May + // fail if validation was enabled and active editor had invalid + // value. + bool ClearSelection( bool validation = false ); + + // Resets modified status of all properties. + void ClearModifiedStatus(); + + // Collapses given category or property with children. + // Returns true if actually collapses. + bool Collapse( wxPGPropArg id ); + + // Collapses all items that can be collapsed. + // Return false if failed (may fail if editor value cannot be validated). + bool CollapseAll() { return ExpandAll(false); } + + // Changes value of a property, as if from an editor. + // Use this instead of SetPropertyValue() if you need the value to run + // through validation process, and also send the property change event. + // Returns true if value was successfully changed. + bool ChangePropertyValue( wxPGPropArg id, wxVariant newValue ); + + // Removes and deletes a property and any children. + // id - Pointer or name of a property. + // If you delete a property in a wxPropertyGrid event + // handler, the actual deletion is postponed until the next + // idle event. + // This functions deselects selected property, if any. + // Validation failure option wxPG_VFB_STAY_IN_PROPERTY is not + // respected, ie. selection is cleared even if editor had + // invalid value. + void DeleteProperty( wxPGPropArg id ); + + // Removes a property. Does not delete the property object, but + // instead returns it. + // id - Pointer or name of a property. + // Removed property cannot have any children. + // Also, if you remove property in a wxPropertyGrid event + // handler, the actual removal is postponed until the next + // idle event. + wxPGProperty* RemoveProperty( wxPGPropArg id ); + + // Disables a property. + bool DisableProperty( wxPGPropArg id ) { return EnableProperty(id,false); } + + // Returns true if all property grid data changes have been committed. + // Usually only returns false if value in active editor has been + // invalidated by a wxValidator. + bool EditorValidate(); + + // Enables or disables property, depending on whether enable is true or + // false. Disabled property usually appears as having grey text. + // id - Name or pointer to a property. + // enable - If false, property is disabled instead. + bool EnableProperty( wxPGPropArg id, bool enable = true ); + + // Called after population of property with fixed children has finished. + void EndAddChildren( wxPGPropArg id ); + + // Expands given category or property with children. + // Returns true if actually expands. + bool Expand( wxPGPropArg id ); + + // Expands all items that can be expanded. + bool ExpandAll( bool expand = true ); + + // Returns id of first child of given property. + // Does not return sub-properties! + wxPGProperty* GetFirstChild( wxPGPropArg id ) + { + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxNullProperty) + + if ( !p->GetChildCount() || p->HasFlag(wxPG_PROP_AGGREGATE) ) + return wxNullProperty; + + return p->Item(0); + } + + // Returns iterator class instance. + // flags - See wxPG_ITERATOR_FLAGS. Value wxPG_ITERATE_DEFAULT causes + // iteration over everything except private child properties. + // firstProp - Property to start iteration from. If NULL, then first + // child of root is used. + wxPropertyGridIterator GetIterator( int flags = wxPG_ITERATE_DEFAULT, + wxPGProperty* firstProp = NULL ) + { + return wxPropertyGridIterator( m_pState, flags, firstProp ); + } + + wxPropertyGridConstIterator + GetIterator( int flags = wxPG_ITERATE_DEFAULT, + wxPGProperty* firstProp = NULL ) const + { + return wxPropertyGridConstIterator( m_pState, flags, firstProp ); + } + + // Returns iterator class instance. + // flags - See wxPG_ITERATOR_FLAGS. Value wxPG_ITERATE_DEFAULT causes + // iteration over everything except private child properties. + // startPos - Either wxTOP or wxBOTTOM. wxTOP will indicate that iterations start + // from the first property from the top, and wxBOTTOM means that the + // iteration will instead begin from bottommost valid item. + wxPropertyGridIterator GetIterator( int flags, int startPos ) + { + return wxPropertyGridIterator( m_pState, flags, startPos ); + } + + wxPropertyGridConstIterator GetIterator( int flags, int startPos ) const + { + return wxPropertyGridConstIterator( m_pState, flags, startPos ); + } + + // Returns id of first item that matches given criteria. + wxPGProperty* GetFirst( int flags = wxPG_ITERATE_ALL ) + { + wxPropertyGridIterator it( m_pState, flags, wxNullProperty, 1 ); + return *it; + } + + const wxPGProperty* GetFirst( int flags = wxPG_ITERATE_ALL ) const + { + return const_cast<wxPropertyGridInterface*>(this)->GetFirst(flags); + } + + // Returns pointer to a property with given name (case-sensitive). + // If there is no property with such name, NULL pointer is returned. + // Properties which have non-category, non-root parent + // cannot be accessed globally by their name. Instead, use + // "<property>.<subproperty>" instead of "<subproperty>". + wxPGProperty* GetProperty( const wxString& name ) const + { + return GetPropertyByName(name); + } + + // Returns map-like storage of property's attributes. + // Note that if extra style wxPG_EX_WRITEONLY_BUILTIN_ATTRIBUTES is set, + // then builtin-attributes are not included in the storage. + const wxPGAttributeStorage& GetPropertyAttributes( wxPGPropArg id ) const + { + // If 'id' refers to invalid property, then we will return dummy + // attributes (i.e. root property's attributes, which contents + // should always be empty and of no consequence). + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(m_pState->DoGetRoot()->GetAttributes()) + return p->GetAttributes(); + } + + // Adds to 'targetArr' pointers to properties that have given + // flags 'flags' set. However, if 'inverse' is set to true, then + // only properties without given flags are stored. + // flags - Property flags to use. + // iterFlags - Iterator flags to use. Default is everything expect private children. + void GetPropertiesWithFlag( wxArrayPGProperty* targetArr, + wxPGProperty::FlagType flags, + bool inverse = false, + int iterFlags = wxPG_ITERATE_PROPERTIES | + wxPG_ITERATE_HIDDEN | + wxPG_ITERATE_CATEGORIES) const; + + // Returns value of given attribute. If none found, returns wxNullVariant. + wxVariant GetPropertyAttribute( wxPGPropArg id, + const wxString& attrName ) const + { + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxNullVariant) + return p->GetAttribute(attrName); + } + + // Returns pointer of property's nearest parent category. If no category + // found, returns NULL. + wxPropertyCategory* GetPropertyCategory( wxPGPropArg id ) const + { + wxPG_PROP_ID_CONST_CALL_PROLOG_RETVAL(NULL) + return m_pState->GetPropertyCategory(p); + } + + // Returns client data (void*) of a property. + void* GetPropertyClientData( wxPGPropArg id ) const + { + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(NULL) + return p->GetClientData(); + } + + // Returns first property which label matches given string. + // NULL if none found. Note that this operation is extremely slow when + // compared to GetPropertyByName(). + wxPGProperty* GetPropertyByLabel( const wxString& label ) const; + + // Returns pointer to a property with given name (case-sensitive). + // If there is no property with such name, @NULL pointer is returned. + wxPGProperty* GetPropertyByName( const wxString& name ) const; + + // Returns child property 'subname' of property 'name'. Same as + // calling GetPropertyByName("name.subname"), albeit slightly faster. + wxPGProperty* GetPropertyByName( const wxString& name, + const wxString& subname ) const; + + // Returns property's editor. + const wxPGEditor* GetPropertyEditor( wxPGPropArg id ) const + { + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(NULL) + return p->GetEditorClass(); + } + + // Returns help string associated with a property. + wxString GetPropertyHelpString( wxPGPropArg id ) const + { + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxEmptyString) + return p->GetHelpString(); + } + + // Returns property's custom value image (NULL of none). + wxBitmap* GetPropertyImage( wxPGPropArg id ) const + { + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(NULL) + return p->GetValueImage(); + } + + // Returns label of a property. + const wxString& GetPropertyLabel( wxPGPropArg id ) + { + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(m_emptyString) + return p->GetLabel(); + } + + // Returns name of a property, by which it is globally accessible. + wxString GetPropertyName( wxPGProperty* property ) + { + return property->GetName(); + } + + // Returns parent item of a property. + wxPGProperty* GetPropertyParent( wxPGPropArg id ) + { + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxNullProperty) + return p->GetParent(); + } + +#if wxUSE_VALIDATORS + // Returns validator of a property as a reference, which you + // can pass to any number of SetPropertyValidator. + wxValidator* GetPropertyValidator( wxPGPropArg id ) + { + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(NULL) + return p->GetValidator(); + } +#endif + + // Returns value as wxVariant. To get wxObject pointer from it, + // you will have to use WX_PG_VARIANT_TO_WXOBJECT(VARIANT,CLASSNAME) macro. + // If property value is unspecified, wxNullVariant is returned. + wxVariant GetPropertyValue(wxPGPropArg id); + + wxString GetPropertyValueAsString( wxPGPropArg id ) const; + long GetPropertyValueAsLong( wxPGPropArg id ) const; + unsigned long GetPropertyValueAsULong( wxPGPropArg id ) const + { + return (unsigned long) GetPropertyValueAsLong(id); + } + int GetPropertyValueAsInt( wxPGPropArg id ) const + { return (int)GetPropertyValueAsLong(id); } + bool GetPropertyValueAsBool( wxPGPropArg id ) const; + double GetPropertyValueAsDouble( wxPGPropArg id ) const; + + wxArrayString GetPropertyValueAsArrayString(wxPGPropArg id) const; + +#if defined(wxLongLong_t) && wxUSE_LONGLONG + wxLongLong_t GetPropertyValueAsLongLong(wxPGPropArg id) const; + + wxULongLong_t GetPropertyValueAsULongLong(wxPGPropArg id) const; +#endif + + wxArrayInt GetPropertyValueAsArrayInt(wxPGPropArg id) const; + +#if wxUSE_DATETIME + wxDateTime GetPropertyValueAsDateTime(wxPGPropArg id) const; +#endif + + // Returns a wxVariant list containing wxVariant versions of all + // property values. Order is not guaranteed. + // flags - Use wxPG_KEEP_STRUCTURE to retain category structure; each sub + // category will be its own wxVariantList of wxVariant. + // Use wxPG_INC_ATTRIBUTES to include property attributes as well. + // Each attribute will be stored as list variant named + // "@<propname>@attr." + wxVariant GetPropertyValues( const wxString& listname = wxEmptyString, + wxPGProperty* baseparent = NULL, long flags = 0 ) const + { + return m_pState->DoGetPropertyValues(listname, baseparent, flags); + } + + // Returns currently selected property. NULL if none. + // When wxPG_EX_MULTIPLE_SELECTION extra style is used, this + // member function returns the focused property, that is the + // one which can have active editor. + wxPGProperty* GetSelection() const; + + // Returns list of currently selected properties. + // wxArrayPGProperty should be compatible with std::vector API. + const wxArrayPGProperty& GetSelectedProperties() const + { + return m_pState->m_selection; + } + + wxPropertyGridPageState* GetState() const { return m_pState; } + + // Similar to GetIterator(), but instead returns wxPGVIterator instance, + // which can be useful for forward-iterating through arbitrary property + // containers. + // flags - See wxPG_ITERATOR_FLAGS. + virtual wxPGVIterator GetVIterator( int flags ) const; + + // Hides or reveals a property. + // hide - If true, hides property, otherwise reveals it. + // flags - By default changes are applied recursively. Set this parameter + // wxPG_DONT_RECURSE to prevent this. + bool HideProperty( wxPGPropArg id, + bool hide = true, + int flags = wxPG_RECURSE ); + +#if wxPG_INCLUDE_ADVPROPS + // Initializes *all* property types. Causes references to most object + // files in the library, so calling this may cause significant increase + // in executable size when linking with static library. + static void InitAllTypeHandlers(); +#else + static void InitAllTypeHandlers() { } +#endif + + // Inserts property to the property container. + // priorThis - New property is inserted just prior to this. Available only + // in the first variant. There are two versions of this function + // to allow this parameter to be either an id or name to + // a property. + // newproperty - Pointer to the inserted property. wxPropertyGrid will take + // ownership of this object. + // Returns id for the property, + // wxPropertyGrid takes the ownership of the property pointer. + // While Append may be faster way to add items, make note that when + // both types of data storage (categoric and + // non-categoric) are active, Insert becomes even more slow. This is + // especially true if current mode is non-categoric. + // Example of use: + // // append category + // wxPGProperty* my_cat_id = propertygrid->Append( + // new wxPropertyCategory("My Category") ); + // ... + // // insert into category - using second variant + // wxPGProperty* my_item_id_1 = propertygrid->Insert( + // my_cat_id, 0, new wxStringProperty("My String 1") ); + // // insert before to first item - using first variant + // wxPGProperty* my_item_id_2 = propertygrid->Insert( + // my_item_id, new wxStringProperty("My String 2") ); + wxPGProperty* Insert( wxPGPropArg priorThis, wxPGProperty* newproperty ); + + // Inserts property to the property container. + //See the other overload for more details. + // parent - New property is inserted under this category. Available only + // in the second variant. There are two versions of this function + // to allow this parameter to be either an id or name to + // a property. + // index - Index under category. Available only in the second variant. + // If index is < 0, property is appended in category. + // newproperty - Pointer to the inserted property. wxPropertyGrid will take + // ownership of this object. + // Returns id for the property. + wxPGProperty* Insert( wxPGPropArg parent, + int index, + wxPGProperty* newproperty ); + + // Returns true if property is a category. + bool IsPropertyCategory( wxPGPropArg id ) const + { + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false) + return p->IsCategory(); + } + + // Returns true if property is enabled. + bool IsPropertyEnabled( wxPGPropArg id ) const + { + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false) + return !p->HasFlag(wxPG_PROP_DISABLED); + } + + // Returns true if given property is expanded. + // Naturally, always returns false for properties that cannot be expanded. + bool IsPropertyExpanded( wxPGPropArg id ) const; + + // Returns true if property has been modified after value set or modify + // flag clear by software. + bool IsPropertyModified( wxPGPropArg id ) const + { + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false) +#if WXWIN_COMPATIBILITY_3_0 + return p->HasFlag(wxPG_PROP_MODIFIED)?true:false; +#else + return p->HasFlag(wxPG_PROP_MODIFIED); +#endif + } + + // Returns true if property is selected. + bool IsPropertySelected( wxPGPropArg id ) const + { + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false) + return m_pState->DoIsPropertySelected(p); + } + + // Returns true if property is shown (i.e. HideProperty with true not + // called for it). + bool IsPropertyShown( wxPGPropArg id ) const + { + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false) + return !p->HasFlag(wxPG_PROP_HIDDEN); + } + + // Returns true if property value is set to unspecified. + bool IsPropertyValueUnspecified( wxPGPropArg id ) const + { + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false) + return p->IsValueUnspecified(); + } + + // Disables (limit = true) or enables (limit = false) wxTextCtrl editor + // of a property, if it is not the sole mean to edit the value. + void LimitPropertyEditing( wxPGPropArg id, bool limit = true ); + + // If state is shown in its grid, refresh it now. + virtual void RefreshGrid( wxPropertyGridPageState* state = NULL ); + +#if wxPG_INCLUDE_ADVPROPS + // Initializes additional property editors (SpinCtrl etc.). Causes + // references to most object files in the library, so calling this may + // cause significant increase in executable size when linking with static + // library. + static void RegisterAdditionalEditors(); +#else + static void RegisterAdditionalEditors() { } +#endif + + // Replaces property with id with newly created property. For example, + // this code replaces existing property named "Flags" with one that + // will have different set of items: + // pg->ReplaceProperty("Flags", + // wxFlagsProperty("Flags", wxPG_LABEL, newItems)) + // For more info, see wxPropertyGrid::Insert. + wxPGProperty* ReplaceProperty( wxPGPropArg id, wxPGProperty* property ); + + // Flags for wxPropertyGridInterface::SaveEditableState() + // and wxPropertyGridInterface::RestoreEditableState(). + enum EditableStateFlags + { + // Include selected property. + SelectionState = 0x01, + // Include expanded/collapsed property information. + ExpandedState = 0x02, + // Include scrolled position. + ScrollPosState = 0x04, + // Include selected page information. + // Only applies to wxPropertyGridManager. + PageState = 0x08, + // Include splitter position. Stored for each page. + SplitterPosState = 0x10, + // Include description box size. + // Only applies to wxPropertyGridManager. + DescBoxState = 0x20, + + // Include all supported user editable state information. + // This is usually the default value. + AllStates = SelectionState | + ExpandedState | + ScrollPosState | + PageState | + SplitterPosState | + DescBoxState + }; + + // Restores user-editable state. + // See also wxPropertyGridInterface::SaveEditableState(). + // src - String generated by SaveEditableState. + // restoreStates - Which parts to restore from source string. See @ref + // propgridinterface_editablestate_flags "list of editable state + // flags". + // Returns false if there was problem reading the string. + // If some parts of state (such as scrolled or splitter position) fail to + // restore correctly, please make sure that you call this function after + // wxPropertyGrid size has been set (this may sometimes be tricky when + // sizers are used). + bool RestoreEditableState( const wxString& src, + int restoreStates = AllStates ); + + // Used to acquire user-editable state (selected property, expanded + // properties, scrolled position, splitter positions). + // includedStates - Which parts of state to include. See EditableStateFlags. + wxString SaveEditableState( int includedStates = AllStates ) const; + + // Lets user set the strings listed in the choice dropdown of a + // wxBoolProperty. Defaults are "True" and "False", so changing them to, + // say, "Yes" and "No" may be useful in some less technical applications. + static void SetBoolChoices( const wxString& trueChoice, + const wxString& falseChoice ); + + // Set proportion of a auto-stretchable column. wxPG_SPLITTER_AUTO_CENTER + // window style needs to be used to indicate that columns are auto- + // resizable. + // Returns false on failure. + // You should call this for individual pages of wxPropertyGridManager + // (if used). + bool SetColumnProportion( unsigned int column, int proportion ); + + // Returns auto-resize proportion of the given column. + int GetColumnProportion( unsigned int column ) const + { + return m_pState->DoGetColumnProportion(column); + } + + // Sets an attribute for this property. + // name - Text identifier of attribute. See @ref propgrid_property_attributes. + // value - Value of attribute. + // argFlags - Optional. Use wxPG_RECURSE to set the attribute to child + // properties recursively. + // Setting attribute's value to wxNullVariant will simply remove it + // from property's set of attributes. + void SetPropertyAttribute( wxPGPropArg id, + const wxString& attrName, + wxVariant value, + long argFlags = 0 ) + { + DoSetPropertyAttribute(id,attrName,value,argFlags); + } + + // Sets property attribute for all applicable properties. + // Be sure to use this method only after all properties have been + // added to the grid. + void SetPropertyAttributeAll( const wxString& attrName, wxVariant value ); + + // Sets background colour of a property. + // id - Property name or pointer. + // colour - New background colour. + // flags - Default is wxPG_RECURSE which causes colour to be set recursively. + // Omit this flag to only set colour for the property in question + // and not any of its children. + void SetPropertyBackgroundColour( wxPGPropArg id, + const wxColour& colour, + int flags = wxPG_RECURSE ); + + // Resets text and background colours of given property. + // id - Property name or pointer. + // flags - Default is wxPG_DONT_RECURSE which causes colour to be reset + // only for the property in question (for backward compatibility). +#if WXWIN_COMPATIBILITY_3_0 + void SetPropertyColoursToDefault(wxPGPropArg id); + void SetPropertyColoursToDefault(wxPGPropArg id, int flags); +#else + void SetPropertyColoursToDefault(wxPGPropArg id, int flags = wxPG_DONT_RECURSE); +#endif // WXWIN_COMPATIBILITY_3_0 + + // Sets text colour of a property. + // id - Property name or pointer. + // colour - New background colour. + // flags - Default is wxPG_RECURSE which causes colour to be set recursively. + // Omit this flag to only set colour for the property in question + // and not any of its children. + void SetPropertyTextColour( wxPGPropArg id, + const wxColour& col, + int flags = wxPG_RECURSE ); + + // Returns background colour of first cell of a property. + wxColour GetPropertyBackgroundColour( wxPGPropArg id ) const + { + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxColour()) + return p->GetCell(0).GetBgCol(); + } + + // Returns text colour of first cell of a property. + wxColour GetPropertyTextColour( wxPGPropArg id ) const + { + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxColour()) + return p->GetCell(0).GetFgCol(); + } + + // Sets text, bitmap, and colours for given column's cell. + // You can set label cell by setting column to 0. + // You can use wxPG_LABEL as text to use default text for column. + void SetPropertyCell( wxPGPropArg id, + int column, + const wxString& text = wxEmptyString, + const wxBitmapBundle& bitmap = wxBitmapBundle(), + const wxColour& fgCol = wxNullColour, + const wxColour& bgCol = wxNullColour ); + + // Sets client data (void*) of a property. + // This untyped client data has to be deleted manually. + void SetPropertyClientData( wxPGPropArg id, void* clientData ) + { + wxPG_PROP_ARG_CALL_PROLOG() + p->SetClientData(clientData); + } + + // Sets editor for a property. + // editor - For builtin editors, use wxPGEditor_X, where X is builtin editor's + // name (TextCtrl, Choice, etc. see wxPGEditor documentation for full + // list). + // For custom editors, use pointer you received from + // wxPropertyGrid::RegisterEditorClass(). + void SetPropertyEditor( wxPGPropArg id, const wxPGEditor* editor ) + { + wxPG_PROP_ARG_CALL_PROLOG() + wxCHECK_RET( editor, wxS("unknown/NULL editor") ); + p->SetEditor(editor); + RefreshProperty(p); + } + + // Sets editor control of a property. As editor argument, use + // editor name string, such as "TextCtrl" or "Choice". + void SetPropertyEditor( wxPGPropArg id, const wxString& editorName ) + { + SetPropertyEditor(id,GetEditorByName(editorName)); + } + + // Sets label of a property. + // Properties under same parent may have same labels. However, + // property names must still remain unique. + void SetPropertyLabel( wxPGPropArg id, const wxString& newproplabel ); + + // Sets name of a property. + // id - Name or pointer of property which name to change. + // newName - New name for property. + void SetPropertyName( wxPGPropArg id, const wxString& newName ) + { + wxPG_PROP_ARG_CALL_PROLOG() + m_pState->DoSetPropertyName( p, newName ); + } + + // Sets property (and, recursively, its children) to have read-only value. + // In other words, user cannot change the value in the editor, but they + // can still copy it. + // This is mainly for use with textctrl editor. Not all other editors fully + // support it. + // By default changes are applied recursively. Set parameter "flags" + // to wxPG_DONT_RECURSE to prevent this. + void SetPropertyReadOnly( wxPGPropArg id, + bool set = true, + int flags = wxPG_RECURSE ); + + // Sets property's value to unspecified. + // If it has children (it may be category), then the same thing is done to + // them. + void SetPropertyValueUnspecified( wxPGPropArg id ) + { + wxPG_PROP_ARG_CALL_PROLOG() + p->SetValueToUnspecified(); + } + + // Sets property values from a list of wxVariants. + void SetPropertyValues( const wxVariantList& list, + wxPGPropArg defaultCategory = wxNullProperty ) + { + wxPGProperty* p = defaultCategory.HasName() ? + defaultCategory.GetPtr(this) : defaultCategory.GetPtr0(); + m_pState->DoSetPropertyValues(list, p); + } + + // Sets property values from a list of wxVariants. + void SetPropertyValues( const wxVariant& list, + wxPGPropArg defaultCategory = wxNullProperty ) + { + SetPropertyValues(list.GetList(),defaultCategory); + } + + // Associates the help string with property. + // By default, text is shown either in the manager's "description" + // text box or in the status bar. If extra window style + // wxPG_EX_HELP_AS_TOOLTIPS is used, then the text will appear as a + // tooltip. + void SetPropertyHelpString( wxPGPropArg id, const wxString& helpString ) + { + wxPG_PROP_ARG_CALL_PROLOG() + p->SetHelpString(helpString); + } + + // Set wxBitmap in front of the value. + // Bitmap will be scaled to a size returned by + // wxPropertyGrid::GetImageSize(); + void SetPropertyImage( wxPGPropArg id, const wxBitmapBundle& bmp ) + { + wxPG_PROP_ARG_CALL_PROLOG() + p->SetValueImage(bmp); + RefreshProperty(p); + } + + // Sets max length of property's text. + bool SetPropertyMaxLength( wxPGPropArg id, int maxLen ); + +#if wxUSE_VALIDATORS + // Sets validator of a property. + void SetPropertyValidator( wxPGPropArg id, const wxValidator& validator ) + { + wxPG_PROP_ARG_CALL_PROLOG() + p->SetValidator(validator); + } +#endif + + // Sets value (long integer) of a property. + void SetPropertyValue( wxPGPropArg id, long value ) + { + wxVariant v(value); + SetPropVal( id, v ); + } + + // Sets value (integer) of a property. + void SetPropertyValue( wxPGPropArg id, int value ) + { + wxVariant v((long)value); + SetPropVal( id, v ); + } + + // Sets value (floating point) of a property. + void SetPropertyValue( wxPGPropArg id, double value ) + { + wxVariant v(value); + SetPropVal( id, v ); + } + + // Sets value (bool) of a property. + void SetPropertyValue( wxPGPropArg id, bool value ) + { + wxVariant v(value); + SetPropVal( id, v ); + } + + // Sets value (wchar_t*) of a property. + void SetPropertyValue( wxPGPropArg id, const wchar_t* value ) + { + SetPropertyValueString( id, wxString(value) ); + } + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + // Sets value (char*) of a property. + void SetPropertyValue( wxPGPropArg id, const char* value ) + { + SetPropertyValueString( id, wxString(value) ); + } +#endif // !wxNO_IMPLICIT_WXSTRING_ENCODING + + // Sets value (string) of a property. + void SetPropertyValue( wxPGPropArg id, const wxString& value ) + { + SetPropertyValueString( id, value ); + } + + // Sets value (wxArrayString) of a property. + void SetPropertyValue( wxPGPropArg id, const wxArrayString& value ) + { + wxVariant v(value); + SetPropVal( id, v ); + } + +#if wxUSE_DATETIME + // Sets value (wxDateTime) of a property. + void SetPropertyValue( wxPGPropArg id, const wxDateTime& value ) + { + wxVariant v(value); + SetPropVal( id, v ); + } +#endif + + // Sets value (wxObject*) of a property. + void SetPropertyValue( wxPGPropArg id, wxObject* value ) + { + wxVariant v(value); + SetPropVal( id, v ); + } + + // Sets value (wxObject&) of a property. + void SetPropertyValue( wxPGPropArg id, wxObject& value ) + { + wxVariant v(&value); + SetPropVal( id, v ); + } + +#if wxUSE_LONGLONG +#ifdef wxLongLong_t + // Sets value (native 64-bit int) of a property. + void SetPropertyValue(wxPGPropArg id, wxLongLong_t value) + { + wxVariant v = wxLongLong(value); + SetPropVal(id, v); + } +#endif + // Sets value (wxLongLong) of a property. + void SetPropertyValue( wxPGPropArg id, wxLongLong value ) + { + wxVariant v(value); + SetPropVal( id, v ); + } +#ifdef wxULongLong_t + // Sets value (native 64-bit unsigned int) of a property. + void SetPropertyValue(wxPGPropArg id, wxULongLong_t value) + { + wxVariant v = wxULongLong(value); + SetPropVal(id, v); + } +#endif + // Sets value (wxULongLong) of a property. + void SetPropertyValue( wxPGPropArg id, wxULongLong value ) + { + wxVariant v(value); + SetPropVal( id, v ); + } +#endif + + // Sets value (wxArrayInt&) of a property. + void SetPropertyValue( wxPGPropArg id, const wxArrayInt& value ) + { + wxVariant v = WXVARIANT(value); + SetPropVal( id, v ); + } + + // Sets value (wxString) of a property. + // This method uses wxPGProperty::SetValueFromString, which all properties + // should implement. This means that there should not be a type error, + // and instead the string is converted to property's actual value type. + void SetPropertyValueString( wxPGPropArg id, const wxString& value ); + + // Sets value (wxVariant) of a property. + // Use wxPropertyGrid::ChangePropertyValue() instead if you need to run + // through validation process and send property change event. + void SetPropertyValue( wxPGPropArg id, wxVariant value ) + { + SetPropVal( id, value ); + } + + // Sets value (wxVariant&) of a property. Same as SetPropertyValue, + // but accepts reference. + void SetPropVal( wxPGPropArg id, wxVariant& value ); + + // Adjusts how wxPropertyGrid behaves when invalid value is entered + // in a property. + // vfbFlags - See wxPG_VALIDATION_FAILURE_BEHAVIOR_FLAGS for possible values. + void SetValidationFailureBehavior( int vfbFlags ); + + // Sorts all properties recursively. + // flags - This can contain any of the following options: + // wxPG_SORT_TOP_LEVEL_ONLY: Only sort categories and their + // immediate children. Sorting done by wxPG_AUTO_SORT option + // uses this. + // See SortChildren, wxPropertyGrid::SetSortFunction + void Sort( int flags = 0 ); + + // Sorts children of a property. + // id - Name or pointer to a property. + // flags - This can contain any of the following options: + // wxPG_RECURSE: Sorts recursively. + // See Sort, wxPropertyGrid::SetSortFunction + void SortChildren( wxPGPropArg id, int flags = 0 ) + { + wxPG_PROP_ARG_CALL_PROLOG() + m_pState->DoSortChildren(p, flags); + } + + // GetPropertyByName() with nice assertion error message. + wxPGProperty* GetPropertyByNameA( const wxString& name ) const; + + // Returns editor pointer of editor with given name. + static wxPGEditor* GetEditorByName( const wxString& editorName ); + + // NOTE: This function reselects the property and may cause + // excess flicker, so to just call Refresh() on a rect + // of single property, call DrawItem() instead. + virtual void RefreshProperty( wxPGProperty* p ) = 0; + +protected: + + bool DoClearSelection( bool validation = false, + int selFlags = 0 ); + + // In derived class, implement to set editable state component with + // given name to given value. + virtual bool SetEditableStateItem( const wxString& name, wxVariant value ) + { + wxUnusedVar(name); + wxUnusedVar(value); + return false; + } + + // In derived class, implement to return editable state component with + // given name. + virtual wxVariant GetEditableStateItem( const wxString& name ) const + { + wxUnusedVar(name); + return wxNullVariant; + } + + // Returns page state data for given (sub) page (-1 means current page). + virtual wxPropertyGridPageState* GetPageState( int pageIndex ) const + { + return pageIndex <= 0 ? m_pState : NULL; + } + + virtual bool DoSelectPage( int WXUNUSED(index) ) { return true; } + + // Default call's m_pState's BaseGetPropertyByName + virtual wxPGProperty* DoGetPropertyByName( const wxString& name ) const; + + // Deriving classes must set this (it must be only or current page). + wxPropertyGridPageState* m_pState; + + // Intermediate version needed due to wxVariant copying inefficiency + void DoSetPropertyAttribute( wxPGPropArg id, + const wxString& name, + wxVariant& value, long argFlags ); + + // Empty string object to return from member functions returning const + // wxString&. + wxString m_emptyString; + +private: + // Cannot be GetGrid() due to ambiguity issues. + wxPropertyGrid* GetPropertyGrid() + { + return m_pState ? m_pState->GetGrid() : NULL; + } + + // Cannot be GetGrid() due to ambiguity issues. + const wxPropertyGrid* GetPropertyGrid() const + { + return m_pState ? m_pState->GetGrid() : NULL; + } +}; + +#endif // wxUSE_PROPGRID + +#endif // __WX_PROPGRID_PROPGRIDIFACE_H__ diff --git a/lib/wxWidgets/include/wx/propgrid/propgridpagestate.h b/lib/wxWidgets/include/wx/propgrid/propgridpagestate.h new file mode 100644 index 0000000..6c98b65 --- /dev/null +++ b/lib/wxWidgets/include/wx/propgrid/propgridpagestate.h @@ -0,0 +1,677 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/propgrid/propgridpagestate.h +// Purpose: wxPropertyGridPageState class +// Author: Jaakko Salli +// Modified by: +// Created: 2008-08-24 +// Copyright: (c) Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PROPGRID_PROPGRIDPAGESTATE_H_ +#define _WX_PROPGRID_PROPGRIDPAGESTATE_H_ + +#include "wx/defs.h" + +#if wxUSE_PROPGRID + +#include "wx/propgrid/property.h" + +// ----------------------------------------------------------------------- + +// A return value from wxPropertyGrid::HitTest(), +// contains all you need to know about an arbitrary location on the grid. +class WXDLLIMPEXP_PROPGRID wxPropertyGridHitTestResult +{ + friend class wxPropertyGridPageState; +public: + wxPropertyGridHitTestResult() + : m_property(NULL) + , m_column(-1) + , m_splitter(-1) + , m_splitterHitOffset(0) + { + } + + ~wxPropertyGridHitTestResult() + { + } + + // Returns column hit. -1 for margin. + int GetColumn() const { return m_column; } + + // Returns property hit. NULL if empty space below + // properties was hit instead. + wxPGProperty* GetProperty() const + { + return m_property; + } + + // Returns index of splitter hit, -1 for none. + int GetSplitter() const { return m_splitter; } + + // If splitter hit, then this member function + // returns offset to the exact splitter position. + int GetSplitterHitOffset() const { return m_splitterHitOffset; } + +private: + // Property. NULL if empty space below properties was hit. + wxPGProperty* m_property; + + // Column. -1 for margin. + int m_column; + + // Index of splitter hit, -1 for none. + int m_splitter; + + // If splitter hit, offset to that. + int m_splitterHitOffset; +}; + +// ----------------------------------------------------------------------- + +#define wxPG_IT_CHILDREN(A) ((A)<<16) + +// NOTES: At lower 16-bits, there are flags to check if item will be included. +// At higher 16-bits, there are same flags, but to instead check if children +// will be included. +enum wxPG_ITERATOR_FLAGS +{ + +// Iterate through 'normal' property items (does not include children of +// aggregate or hidden items by default). +wxPG_ITERATE_PROPERTIES = wxPG_PROP_PROPERTY | + wxPG_PROP_MISC_PARENT | + wxPG_PROP_AGGREGATE | + wxPG_PROP_COLLAPSED | + wxPG_IT_CHILDREN(wxPG_PROP_MISC_PARENT) | + wxPG_IT_CHILDREN(wxPG_PROP_CATEGORY), + +// Iterate children of collapsed parents, and individual items that are hidden. +wxPG_ITERATE_HIDDEN = wxPG_PROP_HIDDEN | + wxPG_IT_CHILDREN(wxPG_PROP_COLLAPSED), + +// Iterate children of parent that is an aggregate property (ie has fixed +// children). +wxPG_ITERATE_FIXED_CHILDREN = wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE) | + wxPG_ITERATE_PROPERTIES, + +// Iterate categories. +// Note that even without this flag, children of categories are still iterated +// through. +wxPG_ITERATE_CATEGORIES = wxPG_PROP_CATEGORY | + wxPG_IT_CHILDREN(wxPG_PROP_CATEGORY) | + wxPG_PROP_COLLAPSED, + +wxPG_ITERATE_ALL_PARENTS = wxPG_PROP_MISC_PARENT | + wxPG_PROP_AGGREGATE | + wxPG_PROP_CATEGORY, + +wxPG_ITERATE_ALL_PARENTS_RECURSIVELY = wxPG_ITERATE_ALL_PARENTS | + wxPG_IT_CHILDREN( + wxPG_ITERATE_ALL_PARENTS), + +wxPG_ITERATOR_FLAGS_ALL = wxPG_PROP_PROPERTY | + wxPG_PROP_MISC_PARENT | + wxPG_PROP_AGGREGATE | + wxPG_PROP_HIDDEN | + wxPG_PROP_CATEGORY | + wxPG_PROP_COLLAPSED, + +wxPG_ITERATOR_MASK_OP_ITEM = wxPG_ITERATOR_FLAGS_ALL, + +// (wxPG_PROP_MISC_PARENT|wxPG_PROP_AGGREGATE|wxPG_PROP_CATEGORY) +wxPG_ITERATOR_MASK_OP_PARENT = wxPG_ITERATOR_FLAGS_ALL, + +// Combines all flags needed to iterate through visible properties +// (ie. hidden properties and children of collapsed parents are skipped). +wxPG_ITERATE_VISIBLE = static_cast<int>(wxPG_ITERATE_PROPERTIES) | + wxPG_PROP_CATEGORY | + wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE), + +// Iterate all items. +wxPG_ITERATE_ALL = wxPG_ITERATE_VISIBLE | + wxPG_ITERATE_HIDDEN, + +// Iterate through individual properties (ie categories and children of +// aggregate properties are skipped). +wxPG_ITERATE_NORMAL = wxPG_ITERATE_PROPERTIES | + wxPG_ITERATE_HIDDEN, + +// Default iterator flags. +wxPG_ITERATE_DEFAULT = wxPG_ITERATE_NORMAL + +}; + + +#define wxPG_ITERATOR_CREATE_MASKS(FLAGS, A, B) \ + A = (FLAGS ^ wxPG_ITERATOR_MASK_OP_ITEM) & \ + wxPG_ITERATOR_MASK_OP_ITEM & 0xFFFF; \ + B = ((FLAGS>>16) ^ wxPG_ITERATOR_MASK_OP_PARENT) & \ + wxPG_ITERATOR_MASK_OP_PARENT & 0xFFFF; + + +// Macro to test if children of PWC should be iterated through +#define wxPG_ITERATOR_PARENTEXMASK_TEST(PWC, PARENTMASK) \ + ( \ + !PWC->HasFlag(PARENTMASK) && \ + PWC->GetChildCount() \ + ) + + +// Base for wxPropertyGridIterator classes. +class WXDLLIMPEXP_PROPGRID wxPropertyGridIteratorBase +{ +public: + wxPropertyGridIteratorBase() + { + } + + void Assign( const wxPropertyGridIteratorBase& it ); + + bool AtEnd() const { return m_property == NULL; } + + // Get current property. + wxPGProperty* GetProperty() const { return m_property; } + + void Init( wxPropertyGridPageState* state, + int flags, + wxPGProperty* property, + int dir = 1 ); + + void Init( wxPropertyGridPageState* state, + int flags, + int startPos = wxTOP, + int dir = 0 ); + + // Iterate to the next property. + void Next( bool iterateChildren = true ); + + // Iterate to the previous property. + void Prev(); + + // Set base parent, i.e. a property when, in which iteration returns, it + // ends. + // Default base parent is the root of the used wxPropertyGridPageState. + void SetBaseParent( wxPGProperty* baseParent ) + { m_baseParent = baseParent; } + +protected: + + wxPGProperty* m_property; + +private: + wxPropertyGridPageState* m_state; + wxPGProperty* m_baseParent; + + // Masks are used to quickly exclude items + wxPGProperty::FlagType m_itemExMask; + wxPGProperty::FlagType m_parentExMask; +}; + +template <typename PROPERTY, typename STATE> +class wxPGIterator : public wxPropertyGridIteratorBase +{ +public: + wxPGIterator(STATE* state, int flags = wxPG_ITERATE_DEFAULT, + PROPERTY* property = NULL, int dir = 1) + : wxPropertyGridIteratorBase() + { + Init(const_cast<wxPropertyGridPageState*>(state), flags, const_cast<wxPGProperty*>(property), dir); + } + wxPGIterator(STATE* state, int flags, int startPos, int dir = 0) + : wxPropertyGridIteratorBase() + { + Init(const_cast<wxPropertyGridPageState*>(state), flags, startPos, dir); + } + wxPGIterator() + : wxPropertyGridIteratorBase() + { + m_property = NULL; + } + wxPGIterator(const wxPGIterator& it) + : wxPropertyGridIteratorBase() + { + Assign(it); + } + ~wxPGIterator() + { + } + wxPGIterator& operator=(const wxPGIterator& it) + { + if ( this != &it ) + Assign(it); + return *this; + } + + wxPGIterator& operator++() { Next(); return *this; } + wxPGIterator operator++(int) { wxPGIterator it = *this; Next(); return it; } + wxPGIterator& operator--() { Prev(); return *this; } + wxPGIterator operator--(int) { wxPGIterator it = *this; Prev(); return it; } + PROPERTY* operator *() const { return const_cast<PROPERTY*>(m_property); } + static PROPERTY* OneStep(STATE* state, int flags = wxPG_ITERATE_DEFAULT, + PROPERTY* property = NULL, int dir = 1) + { + wxPGIterator it(state, flags, property, dir); + if ( property ) + { + if ( dir == 1 ) + it.Next(); + else + it.Prev(); + } + return *it; + } +}; + +// Preferable way to iterate through contents of wxPropertyGrid, +// wxPropertyGridManager, and wxPropertyGridPage. +// See wxPropertyGridInterface::GetIterator() for more information about usage. +typedef wxPGIterator<wxPGProperty, wxPropertyGridPageState> wxPropertyGridIterator; +typedef wxPGIterator<const wxPGProperty, const wxPropertyGridPageState> wxPropertyGridConstIterator; + +// ----------------------------------------------------------------------- + +// Base class to derive new viterators. +class WXDLLIMPEXP_PROPGRID wxPGVIteratorBase : public wxObjectRefData +{ + friend class wxPGVIterator; +public: + wxPGVIteratorBase() { } + virtual void Next() = 0; +protected: + virtual ~wxPGVIteratorBase() { } + + wxPropertyGridIterator m_it; +}; + +// Abstract implementation of a simple iterator. Can only be used +// to iterate in forward order, and only through the entire container. +// Used to have functions dealing with all properties work with both +// wxPropertyGrid and wxPropertyGridManager. +class WXDLLIMPEXP_PROPGRID wxPGVIterator +{ +public: + wxPGVIterator() { m_pIt = NULL; } + wxPGVIterator( wxPGVIteratorBase* obj ) { m_pIt = obj; } + ~wxPGVIterator() { UnRef(); } + void UnRef() { if (m_pIt) m_pIt->DecRef(); } + wxPGVIterator( const wxPGVIterator& it ) + { + m_pIt = it.m_pIt; + m_pIt->IncRef(); + } + const wxPGVIterator& operator=( const wxPGVIterator& it ) + { + if (this != &it) + { + UnRef(); + m_pIt = it.m_pIt; + m_pIt->IncRef(); + } + return *this; + } + void Next() { m_pIt->Next(); } + bool AtEnd() const { return m_pIt->m_it.AtEnd(); } + wxPGProperty* GetProperty() const { return m_pIt->m_it.GetProperty(); } +protected: + wxPGVIteratorBase* m_pIt; +}; + +// ----------------------------------------------------------------------- + +// Contains low-level property page information (properties, column widths, +// etc.) of a single wxPropertyGrid or single wxPropertyGridPage. Generally you +// should not use this class directly, but instead member functions in +// wxPropertyGridInterface, wxPropertyGrid, wxPropertyGridPage, and +// wxPropertyGridManager. +// - Currently this class is not implemented in wxPython. +class WXDLLIMPEXP_PROPGRID wxPropertyGridPageState +{ + friend class wxPropertyGrid; + friend class wxPropertyGridInterface; + friend class wxPropertyGridPage; + friend class wxPropertyGridManager; + friend class wxPGProperty; + friend class wxFlagsProperty; + friend class wxPropertyGridIteratorBase; +public: + + // Default constructor. + wxPropertyGridPageState(); + + // Destructor. + virtual ~wxPropertyGridPageState(); + + // Makes sure all columns have minimum width. + void CheckColumnWidths( int widthChange = 0 ); + + // Override this member function to add custom behaviour on property + // deletion. + virtual void DoDelete( wxPGProperty* item, bool doDelete = true ); + + // Override this member function to add custom behaviour on property + // insertion. + virtual wxPGProperty* DoInsert( wxPGProperty* parent, + int index, + wxPGProperty* property ); + + // This needs to be overridden in grid used the manager so that splitter + // changes can be propagated to other pages. + virtual void DoSetSplitterPosition( int pos, + int splitterColumn = 0, + int flags = 0 ); + + bool EnableCategories( bool enable ); + + // Make sure virtual height is up-to-date. + void EnsureVirtualHeight() + { + if ( m_vhCalcPending ) + { + RecalculateVirtualHeight(); + m_vhCalcPending = false; + } + } + + // Returns (precalculated) height of contained visible properties. + unsigned int GetVirtualHeight() const + { + wxASSERT( !m_vhCalcPending ); + return m_virtualHeight; + } + + // Returns (precalculated) height of contained visible properties. + unsigned int GetVirtualHeight() + { + EnsureVirtualHeight(); + return m_virtualHeight; + } + + // Returns actual height of contained visible properties. + // Mostly used for internal diagnostic purposes. + unsigned int GetActualVirtualHeight() const; + + unsigned int GetColumnCount() const + { + return (unsigned int) m_colWidths.size(); + } + + int GetColumnMinWidth( int column ) const; + + int GetColumnWidth( unsigned int column ) const + { + return m_colWidths[column]; + } + + wxPropertyGrid* GetGrid() const { return m_pPropGrid; } + + // Returns last item which could be iterated using given flags. + wxPGProperty* GetLastItem( int flags = wxPG_ITERATE_DEFAULT ); + + const wxPGProperty* GetLastItem( int flags = wxPG_ITERATE_DEFAULT ) const + { + return const_cast<wxPropertyGridPageState*>(this)->GetLastItem(flags); + } + + // Returns currently selected property. + wxPGProperty* GetSelection() const + { + return m_selection.empty()? NULL: m_selection[0]; + } + + wxPropertyCategory* GetPropertyCategory( const wxPGProperty* p ) const; + +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_MSG("don't refer directly to wxPropertyGridPageState::GetPropertyByLabel") + wxPGProperty* GetPropertyByLabel( const wxString& name, + wxPGProperty* parent = NULL ) const; +#endif // WXWIN_COMPATIBILITY_3_0 + + // Returns combined width of margin and all the columns + int GetVirtualWidth() const + { + return m_width; + } + +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_MSG("call GetColumnFullWidth(wxPGProperty*, int) instead") + int GetColumnFullWidth(const wxDC& dc, wxPGProperty* p, unsigned int col); +#endif // WXWIN_COMPATIBILITY_3_0 + int GetColumnFullWidth(wxPGProperty* p, unsigned int col) const; + + // Returns information about arbitrary position in the grid. + // pt - Logical coordinates in the virtual grid space. Use + // wxScrolled<T>::CalcUnscrolledPosition() if you need to + // translate a scrolled position into a logical one. + wxPropertyGridHitTestResult HitTest( const wxPoint& pt ) const; + + // Returns true if page is visibly displayed. + bool IsDisplayed() const; + + bool IsInNonCatMode() const { return m_properties == m_abcArray; } + + // Called after virtual height needs to be recalculated. + void VirtualHeightChanged() + { + m_vhCalcPending = true; + } + +protected: + wxSize DoFitColumns(bool allowGridResize = false); + + wxPGProperty* DoGetItemAtY(int y) const; + + void DoSetSelection(wxPGProperty* prop) + { + m_selection.clear(); + if (prop) + m_selection.push_back(prop); + } + + bool DoClearSelection() + { + return DoSelectProperty(NULL); + } + + void DoRemoveFromSelection(wxPGProperty* prop); + + void DoSetColumnProportion(unsigned int column, int proportion); + + int DoGetColumnProportion(unsigned int column) const + { + return m_columnProportions[column]; + } + + wxVariant DoGetPropertyValues(const wxString& listname, + wxPGProperty* baseparent, + long flags) const; + + wxPGProperty* DoGetRoot() const { return m_properties; } + + void DoSetPropertyName(wxPGProperty* p, const wxString& newName); + + // Utility to check if two properties are visibly next to each other + bool ArePropertiesAdjacent( wxPGProperty* prop1, + wxPGProperty* prop2, + int iterFlags = wxPG_ITERATE_VISIBLE ) const; + + int DoGetSplitterPosition( int splitterIndex = 0 ) const; + + void DoLimitPropertyEditing(wxPGProperty* p, bool limit = true) + { + p->SetFlagRecursively(wxPG_PROP_NOEDITOR, limit); + } + + bool DoSelectProperty(wxPGProperty* p, unsigned int flags = 0); + + // Base append. + wxPGProperty* DoAppend(wxPGProperty* property); + + // Called in, for example, wxPropertyGrid::Clear. + void DoClear(); + + bool DoIsPropertySelected(wxPGProperty* prop) const; + + bool DoCollapse(wxPGProperty* p); + + bool DoExpand(wxPGProperty* p); + + // Returns column at x coordinate (in GetGrid()->GetPanel()). + // pSplitterHit - Give pointer to int that receives index to splitter that is at x. + // pSplitterHitOffset - Distance from said splitter. + int HitTestH( int x, int* pSplitterHit, int* pSplitterHitOffset ) const; + + bool PrepareToAddItem( wxPGProperty* property, + wxPGProperty* scheduledParent ); + + // Returns property by its label. + wxPGProperty* BaseGetPropertyByLabel( const wxString& label, + const wxPGProperty* parent = NULL ) const; + + // Unselect sub-properties. + void DoRemoveChildrenFromSelection(wxPGProperty* p, bool recursive, + int selFlags); + + // Mark sub-properties as being deleted. + void DoMarkChildrenAsDeleted(wxPGProperty* p, bool recursive); + + // Rename the property + // so it won't remain in the way of the user code. + void DoInvalidatePropertyName(wxPGProperty* p); + + // Rename sub-properties + // so it won't remain in the way of the user code. + void DoInvalidateChildrenNames(wxPGProperty* p, bool recursive); + + bool DoHideProperty(wxPGProperty* p, bool hide, int flags = wxPG_RECURSE); + + bool DoSetPropertyValueString(wxPGProperty* p, const wxString& value); + + bool DoSetPropertyValue(wxPGProperty* p, wxVariant& value); + + bool DoSetPropertyValueWxObjectPtr(wxPGProperty* p, wxObject* value); + void DoSetPropertyValues(const wxVariantList& list, + wxPGProperty* default_category); + + void DoSortChildren(wxPGProperty* p, int flags = 0); + void DoSort(int flags = 0); + + // widthChange is non-client. + void OnClientWidthChange(int newWidth, int widthChange, bool fromOnResize = false); + + // Check if property contains given sub-category. + bool IsChildCategory(wxPGProperty* p, + wxPropertyCategory* cat, bool recursive); + + void PropagateColSizeDec(int column, int decrease, int dir); + + void CalculateFontAndBitmapStuff(int vspacing); + + // Returns property by its name. + wxPGProperty* BaseGetPropertyByName(const wxString& name) const; + + // Returns minimal width for given column so that all images and texts + // will fit entirely. + // Used by SetSplitterLeft() and DoFitColumns(). +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_MSG("call GetColumnFitWidth(wxPGProperty*, int, bool) instead") + int GetColumnFitWidth(const wxDC& dc, wxPGProperty* pwc, + unsigned int col, bool subProps) const; +#endif // WXWIN_COMPATIBILITY_3_0 + int GetColumnFitWidth(const wxPGProperty* p, unsigned int col, bool subProps) const; + + void SetSplitterLeft(bool subProps = false); + + void SetColumnCount(int colCount); + + void ResetColumnSizes(int setSplitterFlags); + + bool PrepareAfterItemsAdded(); + + // Recalculates m_virtualHeight. + void RecalculateVirtualHeight() + { + m_virtualHeight = GetActualVirtualHeight(); + } + + // Set virtual width for this particular page. + void SetVirtualWidth(int width); + + // If visible, then this is pointer to wxPropertyGrid. + // This shall *never* be NULL to indicate that this state is not visible. + wxPropertyGrid* m_pPropGrid; + + // Pointer to currently used array. + wxPGProperty* m_properties; + + // Array for categoric mode. + wxPGRootProperty m_regularArray; + + // Array for root of non-categoric mode. + wxPGRootProperty* m_abcArray; + + // Dictionary for name-based access. + wxPGHashMapS2P m_dictName; + + // List of column widths (first column does not include margin). + wxVector<int> m_colWidths; + + // List of indices of columns the user can edit by clicking it. + wxVector<int> m_editableColumns; + + // Column proportions. + wxVector<int> m_columnProportions; + + double m_fSplitterX; + + // Most recently added category. + wxPropertyCategory* m_currentCategory; + + // Array of selected property. + wxArrayPGProperty m_selection; + + // Virtual width. + int m_width; + + // Indicates total virtual height of visible properties. + unsigned int m_virtualHeight; + +#if WXWIN_COMPATIBILITY_3_0 + // 1 items appended/inserted, so stuff needs to be done before drawing; + // If m_virtualHeight == 0, then calcylatey's must be done. + // Otherwise just sort. + unsigned char m_itemsAdded; + + // 1 if any value is modified. + unsigned char m_anyModified; + + unsigned char m_vhCalcPending; +#else + // True: items appended/inserted, so stuff needs to be done before drawing; + // If m_virtualHeight == 0, then calcylatey's must be done. + // Otherwise just sort. + bool m_itemsAdded; + + // True if any value is modified. + bool m_anyModified; + + bool m_vhCalcPending; +#endif // WXWIN_COMPATIBILITY_3_0 + + // True if splitter has been pre-set by the application. + bool m_isSplitterPreSet; + + // Used to (temporarily) disable splitter centering. + bool m_dontCenterSplitter; + +private: + // Only inits arrays, doesn't migrate things or such. + void InitNonCatMode(); +}; + +// ----------------------------------------------------------------------- + +#endif // wxUSE_PROPGRID + +#endif // _WX_PROPGRID_PROPGRIDPAGESTATE_H_ diff --git a/lib/wxWidgets/include/wx/propgrid/props.h b/lib/wxWidgets/include/wx/propgrid/props.h new file mode 100644 index 0000000..698f02c --- /dev/null +++ b/lib/wxWidgets/include/wx/propgrid/props.h @@ -0,0 +1,990 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/propgrid/props.h +// Purpose: wxPropertyGrid Property Classes +// Author: Jaakko Salli +// Modified by: +// Created: 2007-03-28 +// Copyright: (c) Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PROPGRID_PROPS_H_ +#define _WX_PROPGRID_PROPS_H_ + +#include "wx/defs.h" + +#if wxUSE_PROPGRID + +// ----------------------------------------------------------------------- + +#include "wx/propgrid/property.h" + +#include "wx/filename.h" +#include "wx/dialog.h" +#include "wx/textctrl.h" +#include "wx/valtext.h" + +class WXDLLIMPEXP_FWD_PROPGRID wxPGArrayEditorDialog; + +// ----------------------------------------------------------------------- + +// +// Property class implementation helper macros. +// + +#define wxPG_IMPLEMENT_PROPERTY_CLASS(NAME, UPCLASS, EDITOR) \ +wxIMPLEMENT_DYNAMIC_CLASS(NAME, UPCLASS); \ +wxPG_IMPLEMENT_PROPERTY_CLASS_PLAIN(NAME, EDITOR) + +#if WXWIN_COMPATIBILITY_3_0 +// This macro is deprecated. Use wxPG_IMPLEMENT_PROPERTY_CLASS instead. +#define WX_PG_IMPLEMENT_PROPERTY_CLASS(NAME, UPCLASS, T, T_AS_ARG, EDITOR) \ +wxIMPLEMENT_DYNAMIC_CLASS(NAME, UPCLASS); \ +WX_PG_IMPLEMENT_PROPERTY_CLASS_PLAIN(NAME, T, EDITOR) +#endif // WXWIN_COMPATIBILITY_3_0 + +// ----------------------------------------------------------------------- + +// +// These macros help creating DoGetValidator +#define WX_PG_DOGETVALIDATOR_ENTRY() \ + static wxValidator* s_ptr = NULL; \ + if ( s_ptr ) return s_ptr; + +// Common function exit +#define WX_PG_DOGETVALIDATOR_EXIT(VALIDATOR) \ + s_ptr = VALIDATOR; \ + wxPGGlobalVars->m_arrValidators.push_back( VALIDATOR ); \ + return VALIDATOR; + +// ----------------------------------------------------------------------- + +// Creates and manages a temporary wxTextCtrl for validation purposes. +// Uses wxPropertyGrid's current editor, if available. +class WXDLLIMPEXP_PROPGRID wxPGInDialogValidator +{ +public: + wxPGInDialogValidator() + { + m_textCtrl = NULL; + } + + ~wxPGInDialogValidator() + { + if ( m_textCtrl ) + m_textCtrl->Destroy(); + } + + bool DoValidate( wxPropertyGrid* propGrid, + wxValidator* validator, + const wxString& value ); + +private: + wxTextCtrl* m_textCtrl; +}; + + +// ----------------------------------------------------------------------- +// Property classes +// ----------------------------------------------------------------------- + +#define wxPG_PROP_PASSWORD wxPG_PROP_CLASS_SPECIFIC_2 + +// Basic property with string value. +// If value "<composed>" is set, then actual value is formed (or composed) +// from values of child properties. +class WXDLLIMPEXP_PROPGRID wxStringProperty : public wxPGProperty +{ + WX_PG_DECLARE_PROPERTY_CLASS(wxStringProperty) +public: + wxStringProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxString& value = wxEmptyString ); + virtual ~wxStringProperty(); + + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const wxOVERRIDE; + virtual bool StringToValue( wxVariant& variant, + const wxString& text, + int argFlags = 0 ) const wxOVERRIDE; + + virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) wxOVERRIDE; + + // This is updated so "<composed>" special value can be handled. + virtual void OnSetValue() wxOVERRIDE; + +protected: +}; + +// ----------------------------------------------------------------------- + +// Constants used with NumericValidation<>(). +enum wxPGNumericValidationConstants +{ + // Instead of modifying the value, show an error message. + wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE = 0, + + // Modify value, but stick with the limitations. + wxPG_PROPERTY_VALIDATION_SATURATE = 1, + + // Modify value, wrap around on overflow. + wxPG_PROPERTY_VALIDATION_WRAP = 2 +}; + +// ----------------------------------------------------------------------- + +#if wxUSE_VALIDATORS + +// A more comprehensive numeric validator class. +class WXDLLIMPEXP_PROPGRID wxNumericPropertyValidator : public wxTextValidator +{ +public: + enum NumericType + { + Signed = 0, + Unsigned, + Float + }; + + wxNumericPropertyValidator( NumericType numericType, int base = 10 ); + virtual ~wxNumericPropertyValidator() { } + virtual bool Validate(wxWindow* parent) wxOVERRIDE; +}; + +#endif // wxUSE_VALIDATORS + +// Base class for numeric properties. +// Cannot be instantiated directly. +class WXDLLIMPEXP_PROPGRID wxNumericProperty : public wxPGProperty +{ + wxDECLARE_ABSTRACT_CLASS(wxNumericProperty); +public: + virtual ~wxNumericProperty(); + + virtual bool DoSetAttribute(const wxString& name, wxVariant& value) wxOVERRIDE; + + virtual wxVariant AddSpinStepValue(long stepScale) const = 0; + + bool UseSpinMotion() const { return m_spinMotion; } + + // Common validation code - for internal use. + template<typename T> + bool DoNumericValidation(T& value, wxPGValidationInfo* pValidationInfo, + int mode, T defMin, T defMax) const; + +protected: + wxNumericProperty(const wxString& label, const wxString& name); + + wxVariant m_minVal; + wxVariant m_maxVal; + bool m_spinMotion; + wxVariant m_spinStep; + bool m_spinWrap; +}; + +// Basic property with integer value. +// Seamlessly supports 64-bit integer (wxLongLong) on overflow. +class WXDLLIMPEXP_PROPGRID wxIntProperty : public wxNumericProperty +{ + WX_PG_DECLARE_PROPERTY_CLASS(wxIntProperty) +public: + wxIntProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + long value = 0 ); + virtual ~wxIntProperty(); + +#if wxUSE_LONGLONG + wxIntProperty( const wxString& label, + const wxString& name, + const wxLongLong& value ); +#endif + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const wxOVERRIDE; + virtual bool StringToValue( wxVariant& variant, + const wxString& text, + int argFlags = 0 ) const wxOVERRIDE; + virtual bool ValidateValue( wxVariant& value, + wxPGValidationInfo& validationInfo ) const wxOVERRIDE; + virtual bool IntToValue( wxVariant& variant, + int number, + int argFlags = 0 ) const wxOVERRIDE; + static wxValidator* GetClassValidator(); + virtual wxValidator* DoGetValidator() const wxOVERRIDE; + virtual wxVariant AddSpinStepValue(long stepScale) const wxOVERRIDE; + +private: + // Validation helpers. +#if wxUSE_LONGLONG + static bool DoValidation( const wxNumericProperty* property, + wxLongLong& value, + wxPGValidationInfo* pValidationInfo, + int mode = + wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE ); + +#if defined(wxLongLong_t) + static bool DoValidation( const wxNumericProperty* property, + wxLongLong_t& value, + wxPGValidationInfo* pValidationInfo, + int mode = + wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE ); +#endif // wxLongLong_t +#endif // wxUSE_LONGLONG + static bool DoValidation(const wxNumericProperty* property, + long& value, + wxPGValidationInfo* pValidationInfo, + int mode = + wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE); +}; + +// ----------------------------------------------------------------------- + +// Basic property with unsigned integer value. +// Seamlessly supports 64-bit integer (wxULongLong) on overflow. +class WXDLLIMPEXP_PROPGRID wxUIntProperty : public wxNumericProperty +{ + WX_PG_DECLARE_PROPERTY_CLASS(wxUIntProperty) +public: + wxUIntProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + unsigned long value = 0 ); + virtual ~wxUIntProperty(); +#if wxUSE_LONGLONG + wxUIntProperty( const wxString& label, + const wxString& name, + const wxULongLong& value ); +#endif + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const wxOVERRIDE; + virtual bool StringToValue( wxVariant& variant, + const wxString& text, + int argFlags = 0 ) const wxOVERRIDE; + virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) wxOVERRIDE; + virtual bool ValidateValue( wxVariant& value, + wxPGValidationInfo& validationInfo ) const wxOVERRIDE; + virtual wxValidator* DoGetValidator () const wxOVERRIDE; + virtual bool IntToValue( wxVariant& variant, + int number, + int argFlags = 0 ) const wxOVERRIDE; + virtual wxVariant AddSpinStepValue(long stepScale) const wxOVERRIDE; + +protected: + wxByte m_base; + wxByte m_realBase; // translated to 8,16,etc. + wxByte m_prefix; +private: + void Init(); + + // Validation helpers. +#if wxUSE_LONGLONG + static bool DoValidation(const wxNumericProperty* property, + wxULongLong& value, + wxPGValidationInfo* pValidationInfo, + int mode =wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE); +#if defined(wxULongLong_t) + static bool DoValidation(const wxNumericProperty* property, + wxULongLong_t& value, + wxPGValidationInfo* pValidationInfo, + int mode =wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE); +#endif // wxULongLong_t +#endif // wxUSE_LONGLONG + static bool DoValidation(const wxNumericProperty* property, + long& value, + wxPGValidationInfo* pValidationInfo, + int mode = wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE); +}; + +// ----------------------------------------------------------------------- + +// Basic property with double-precision floating point value. +class WXDLLIMPEXP_PROPGRID wxFloatProperty : public wxNumericProperty +{ + WX_PG_DECLARE_PROPERTY_CLASS(wxFloatProperty) +public: + wxFloatProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + double value = 0.0 ); + virtual ~wxFloatProperty(); + + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const wxOVERRIDE; + virtual bool StringToValue( wxVariant& variant, + const wxString& text, + int argFlags = 0 ) const wxOVERRIDE; + virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) wxOVERRIDE; + + virtual bool ValidateValue( wxVariant& value, + wxPGValidationInfo& validationInfo ) const wxOVERRIDE; + + static wxValidator* GetClassValidator(); + virtual wxValidator* DoGetValidator () const wxOVERRIDE; + virtual wxVariant AddSpinStepValue(long stepScale) const wxOVERRIDE; + +protected: + int m_precision; + +private: + // Validation helper. + static bool DoValidation(const wxNumericProperty* property, + double& value, + wxPGValidationInfo* pValidationInfo, + int mode = wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE); +}; + +// ----------------------------------------------------------------------- + +// Basic property with boolean value. +class WXDLLIMPEXP_PROPGRID wxBoolProperty : public wxPGProperty +{ + WX_PG_DECLARE_PROPERTY_CLASS(wxBoolProperty) +public: + wxBoolProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + bool value = false ); + virtual ~wxBoolProperty(); + + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const wxOVERRIDE; + virtual bool StringToValue( wxVariant& variant, + const wxString& text, + int argFlags = 0 ) const wxOVERRIDE; + virtual bool IntToValue( wxVariant& variant, + int number, int argFlags = 0 ) const wxOVERRIDE; + virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) wxOVERRIDE; +}; + +// ----------------------------------------------------------------------- + +// If set, then selection of choices is static and should not be +// changed (i.e. returns NULL in GetPropertyChoices). +#define wxPG_PROP_STATIC_CHOICES wxPG_PROP_CLASS_SPECIFIC_1 + +// Represents a single selection from a list of choices +// You can derive custom properties with choices from this class. +// Updating private index is important. You can do this either by calling +// SetIndex() in IntToValue, and then letting wxBaseEnumProperty::OnSetValue +// be called (by not implementing it, or by calling super class function in +// it) -OR- you can just call SetIndex in OnSetValue. +class WXDLLIMPEXP_PROPGRID wxEnumProperty : public wxPGProperty +{ + WX_PG_DECLARE_PROPERTY_CLASS(wxEnumProperty) +public: + +#ifndef SWIG + wxEnumProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxChar* const* labels = NULL, + const long* values = NULL, + int value = 0 ); + wxEnumProperty( const wxString& label, + const wxString& name, + wxPGChoices& choices, + int value = 0 ); + + // Special constructor for caching choices (used by derived class) + wxEnumProperty( const wxString& label, + const wxString& name, + const char* const* untranslatedLabels, + const long* values, + wxPGChoices* choicesCache, + int value = 0 ); + + wxEnumProperty( const wxString& label, + const wxString& name, + const wxArrayString& labels, + const wxArrayInt& values = wxArrayInt(), + int value = 0 ); +#else + wxEnumProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxArrayString& labels = wxArrayString(), + const wxArrayInt& values = wxArrayInt(), + int value = 0 ); +#endif + + virtual ~wxEnumProperty(); + + size_t GetItemCount() const { return m_choices.GetCount(); } + + virtual void OnSetValue() wxOVERRIDE; + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const wxOVERRIDE; + virtual bool StringToValue( wxVariant& variant, + const wxString& text, + int argFlags = 0 ) const wxOVERRIDE; + virtual bool ValidateValue( wxVariant& value, + wxPGValidationInfo& validationInfo ) const wxOVERRIDE; + + // If wxPG_FULL_VALUE is not set in flags, then the value is interpreted + // as index to choices list. Otherwise, it is actual value. + virtual bool IntToValue( wxVariant& variant, + int number, + int argFlags = 0 ) const wxOVERRIDE; + + // + // Additional virtuals + + // This must be overridden to have non-index based value + virtual int GetIndexForValue( int value ) const; + + // GetChoiceSelection needs to overridden since m_index is + // the true index, and various property classes derived from + // this take advantage of it. + virtual int GetChoiceSelection() const wxOVERRIDE { return m_index; } + +protected: + + int GetIndex() const; + void SetIndex( int index ); + +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_MSG("use ValueFromString_(wxVariant&, int*, const wxString&, int) function instead") + bool ValueFromString_( wxVariant& value, + const wxString& text, + int argFlags ) const + { + return ValueFromString_(value, NULL, text, argFlags); + } + wxDEPRECATED_MSG("use ValueFromInt_(wxVariant&, int*, int, int) function instead") + bool ValueFromInt_( wxVariant& value, int intVal, int argFlags ) const + { + return ValueFromInt_(value, NULL, intVal, argFlags); + } + wxDEPRECATED_MSG("don't use ResetNextIndex() function") + static void ResetNextIndex() { } +#endif + // Converts text to value and returns corresponding index in the collection + bool ValueFromString_(wxVariant& value, + int* pIndex, + const wxString& text, + int argFlags) const; + // Converts number to value and returns corresponding index in the collection + bool ValueFromInt_(wxVariant& value, int* pIndex, int intVal, int argFlags) const; + +private: + // This is private so that classes are guaranteed to use GetIndex + // for up-to-date index value. + int m_index; +}; + +// ----------------------------------------------------------------------- + +// wxEnumProperty with wxString value and writable combo box editor. +// Uses int value, similar to wxEnumProperty, unless text entered by user +// is not in choices (in which case string value is used). +class WXDLLIMPEXP_PROPGRID wxEditEnumProperty : public wxEnumProperty +{ + WX_PG_DECLARE_PROPERTY_CLASS(wxEditEnumProperty) +public: + + wxEditEnumProperty( const wxString& label, + const wxString& name, + const wxChar* const* labels, + const long* values, + const wxString& value ); + wxEditEnumProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxArrayString& labels = wxArrayString(), + const wxArrayInt& values = wxArrayInt(), + const wxString& value = wxEmptyString ); + wxEditEnumProperty( const wxString& label, + const wxString& name, + wxPGChoices& choices, + const wxString& value = wxEmptyString ); + + // Special constructor for caching choices (used by derived class) + wxEditEnumProperty( const wxString& label, + const wxString& name, + const char* const* untranslatedLabels, + const long* values, + wxPGChoices* choicesCache, + const wxString& value ); + + virtual ~wxEditEnumProperty(); + + void OnSetValue() wxOVERRIDE; + bool StringToValue(wxVariant& variant, + const wxString& text, + int argFlags = 0) const wxOVERRIDE; + bool ValidateValue(wxVariant& value, + wxPGValidationInfo& validationInfo) const wxOVERRIDE; + +protected: +}; + +// ----------------------------------------------------------------------- + +// Represents a bit set that fits in a long integer. wxBoolProperty +// sub-properties are created for editing individual bits. Textctrl is created +// to manually edit the flags as a text; a continuous sequence of spaces, +// commas and semicolons is considered as a flag id separator. +// Note: When changing "choices" (ie. flag labels) of wxFlagsProperty, +// you will need to use SetPropertyChoices - otherwise they will not get +// updated properly. +class WXDLLIMPEXP_PROPGRID wxFlagsProperty : public wxPGProperty +{ + WX_PG_DECLARE_PROPERTY_CLASS(wxFlagsProperty) +public: + +#ifndef SWIG + wxFlagsProperty( const wxString& label, + const wxString& name, + const wxChar* const* labels, + const long* values = NULL, + long value = 0 ); + wxFlagsProperty( const wxString& label, + const wxString& name, + wxPGChoices& choices, + long value = 0 ); +#endif + wxFlagsProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxArrayString& labels = wxArrayString(), + const wxArrayInt& values = wxArrayInt(), + int value = 0 ); + virtual ~wxFlagsProperty (); + + virtual void OnSetValue() wxOVERRIDE; + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const wxOVERRIDE; + virtual bool StringToValue( wxVariant& variant, + const wxString& text, + int flags ) const wxOVERRIDE; + virtual wxVariant ChildChanged( wxVariant& thisValue, + int childIndex, + wxVariant& childValue ) const wxOVERRIDE; + virtual void RefreshChildren() wxOVERRIDE; + virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) wxOVERRIDE; + + // GetChoiceSelection needs to overridden since m_choices is + // used and value is integer, but it is not index. + virtual int GetChoiceSelection() const wxOVERRIDE { return wxNOT_FOUND; } + + // helpers + size_t GetItemCount() const { return m_choices.GetCount(); } + const wxString& GetLabel( size_t ind ) const + { return m_choices.GetLabel(static_cast<unsigned int>(ind)); } + +protected: + // Used to detect if choices have been changed + wxPGChoicesData* m_oldChoicesData; + + // Needed to properly mark changed sub-properties + long m_oldValue; + + // Converts string id to a relevant bit. + long IdToBit( const wxString& id ) const; + + // Creates children and sets value. + void Init(); +}; + +// ----------------------------------------------------------------------- +class WXDLLIMPEXP_PROPGRID wxEditorDialogProperty : public wxPGProperty +{ + friend class wxPGDialogAdapter; + wxDECLARE_ABSTRACT_CLASS(wxEditorDialogProperty); + +public: + virtual ~wxEditorDialogProperty(); + + virtual wxPGEditorDialogAdapter* GetEditorDialog() const wxOVERRIDE; + virtual bool DoSetAttribute(const wxString& name, wxVariant& value) wxOVERRIDE; + +protected: + wxEditorDialogProperty(const wxString& label, const wxString& name); + + virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value) = 0; + + wxString m_dlgTitle; // Title for a dialog + long m_dlgStyle; // Dialog style +}; + +// ----------------------------------------------------------------------- + +// Indicates first bit usable by derived properties. +#define wxPG_PROP_SHOW_FULL_FILENAME wxPG_PROP_CLASS_SPECIFIC_1 + +// Like wxLongStringProperty, but the button triggers file selector instead. +class WXDLLIMPEXP_PROPGRID wxFileProperty : public wxEditorDialogProperty +{ + WX_PG_DECLARE_PROPERTY_CLASS(wxFileProperty) +public: + + wxFileProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxString& value = wxEmptyString ); + virtual ~wxFileProperty (); + + virtual void OnSetValue() wxOVERRIDE; + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const wxOVERRIDE; + virtual bool StringToValue( wxVariant& variant, + const wxString& text, + int argFlags = 0 ) const wxOVERRIDE; + virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) wxOVERRIDE; + + static wxValidator* GetClassValidator(); + virtual wxValidator* DoGetValidator() const wxOVERRIDE; + + // Returns filename to file represented by current value. + wxFileName GetFileName() const; + +protected: + virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value) wxOVERRIDE; + + wxString m_wildcard; + wxString m_basePath; // If set, then show path relative to it + wxString m_initialPath; // If set, start the file dialog here + int m_indFilter; // index to the selected filter +}; + +// ----------------------------------------------------------------------- + +// Flag used in wxLongStringProperty to mark that edit button +// should be enabled even in the read-only mode. +#define wxPG_PROP_ACTIVE_BTN wxPG_PROP_CLASS_SPECIFIC_1 + +// Like wxStringProperty, but has a button that triggers a small text +// editor dialog. +class WXDLLIMPEXP_PROPGRID wxLongStringProperty : public wxEditorDialogProperty +{ + WX_PG_DECLARE_PROPERTY_CLASS(wxLongStringProperty) +public: + + wxLongStringProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxString& value = wxEmptyString ); + virtual ~wxLongStringProperty(); + + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const wxOVERRIDE; + virtual bool StringToValue( wxVariant& variant, + const wxString& text, + int argFlags = 0 ) const wxOVERRIDE; + +protected: + virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value) wxOVERRIDE; +}; + +// ----------------------------------------------------------------------- + + +// Like wxLongStringProperty, but the button triggers dir selector instead. +class WXDLLIMPEXP_PROPGRID wxDirProperty : public wxEditorDialogProperty +{ + WX_PG_DECLARE_PROPERTY_CLASS(wxDirProperty) +public: + wxDirProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxString& value = wxEmptyString ); + virtual ~wxDirProperty(); + + virtual wxString ValueToString(wxVariant& value, int argFlags = 0) const wxOVERRIDE; + virtual bool StringToValue(wxVariant& variant, const wxString& text, + int argFlags = 0) const wxOVERRIDE; +#if WXWIN_COMPATIBILITY_3_0 + virtual bool DoSetAttribute(const wxString& name, wxVariant& value) wxOVERRIDE; +#endif // WXWIN_COMPATIBILITY_3_0 + virtual wxValidator* DoGetValidator() const wxOVERRIDE; + +protected: + virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value) wxOVERRIDE; +}; + +// ----------------------------------------------------------------------- + +// wxBoolProperty, wxFlagsProperty specific flags +#define wxPG_PROP_USE_CHECKBOX wxPG_PROP_CLASS_SPECIFIC_1 +// DCC = Double Click Cycles +#define wxPG_PROP_USE_DCC wxPG_PROP_CLASS_SPECIFIC_2 + + +// ----------------------------------------------------------------------- + +// Property that manages a list of strings. +class WXDLLIMPEXP_PROPGRID wxArrayStringProperty : public wxEditorDialogProperty +{ + WX_PG_DECLARE_PROPERTY_CLASS(wxArrayStringProperty) +public: + wxArrayStringProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxArrayString& value = wxArrayString() ); + virtual ~wxArrayStringProperty(); + + virtual void OnSetValue() wxOVERRIDE; + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const wxOVERRIDE; + virtual bool StringToValue( wxVariant& variant, + const wxString& text, + int argFlags = 0 ) const wxOVERRIDE; + virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) wxOVERRIDE; + + // Implement in derived class for custom array-to-string conversion. +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_MSG("use function ConvertArrayToString(arr, delim) returning wxString") + virtual void ConvertArrayToString(const wxArrayString& arr, + wxString* pString, + const wxUniChar& delimiter) const + { + *pString = ConvertArrayToString(arr, delimiter); + } +#endif // WXWIN_COMPATIBILITY_3_0 + virtual wxString ConvertArrayToString(const wxArrayString& arr, const wxUniChar& delimiter) const; + + // Shows string editor dialog. Value to be edited should be read from + // value, and if dialog is not cancelled, it should be stored back and true + // should be returned if that was the case. + virtual bool OnCustomStringEdit( wxWindow* parent, wxString& value ); + +#if WXWIN_COMPATIBILITY_3_0 + // Helper. + wxDEPRECATED_MSG("OnButtonClick() function is no longer used") + virtual bool OnButtonClick( wxPropertyGrid* propgrid, + wxWindow* primary, + const wxChar* cbt ); +#endif // WXWIN_COMPATIBILITY_3_0 + + // Creates wxPGArrayEditorDialog for string editing. Called in OnButtonClick. + virtual wxPGArrayEditorDialog* CreateEditorDialog(); + + enum ConversionFlags + { + Escape = 0x01, + QuoteStrings = 0x02 + }; + + // Generates string based on the contents of wxArrayString src. +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_MSG("use function ArrayStringToString(src, delim, flag) returning wxString") + static void ArrayStringToString( wxString& dst, const wxArrayString& src, + wxUniChar delimiter, int flags ) + { + dst = ArrayStringToString(src, delimiter, flags); + } +#endif // WXWIN_COMPATIBILITY_3_0 + static wxString ArrayStringToString(const wxArrayString& src, + wxUniChar delimiter, int flags); + +protected: + virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value) wxOVERRIDE; + + // Previously this was to be implemented in derived class for array-to- + // string conversion. Now you should implement ConvertValueToString() + // instead. + virtual void GenerateValueAsString(); + + wxString m_display; // Cache for displayed text. + wxUniChar m_delimiter; + wxString m_customBtnText; +}; + +// ----------------------------------------------------------------------- + +#define WX_PG_DECLARE_ARRAYSTRING_PROPERTY_WITH_VALIDATOR_WITH_DECL(PROPNAME, \ + DECL) \ +DECL PROPNAME : public wxArrayStringProperty \ +{ \ + WX_PG_DECLARE_PROPERTY_CLASS(PROPNAME) \ +public: \ + PROPNAME( const wxString& label = wxPG_LABEL, \ + const wxString& name = wxPG_LABEL, \ + const wxArrayString& value = wxArrayString() ); \ + ~PROPNAME(); \ + virtual bool OnCustomStringEdit( wxWindow* parent, wxString& value ) wxOVERRIDE; \ + virtual wxValidator* DoGetValidator() const wxOVERRIDE; \ +}; + +#define WX_PG_DECLARE_ARRAYSTRING_PROPERTY_WITH_VALIDATOR(PROPNAM) \ +WX_PG_DECLARE_ARRAYSTRING_PROPERTY_WITH_VALIDATOR(PROPNAM, class) + +#define WX_PG_IMPLEMENT_ARRAYSTRING_PROPERTY_WITH_VALIDATOR(PROPNAME, \ + DELIMCHAR, \ + CUSTBUTTXT) \ +wxPG_IMPLEMENT_PROPERTY_CLASS(PROPNAME, wxArrayStringProperty, \ + TextCtrlAndButton) \ +PROPNAME::PROPNAME( const wxString& label, \ + const wxString& name, \ + const wxArrayString& value ) \ + : wxArrayStringProperty(label,name,value) \ +{ \ + PROPNAME::GenerateValueAsString(); \ + m_delimiter = DELIMCHAR; \ + m_customBtnText = CUSTBUTTXT; \ +} \ +PROPNAME::~PROPNAME() { } + +#define WX_PG_DECLARE_ARRAYSTRING_PROPERTY(PROPNAME) \ +WX_PG_DECLARE_ARRAYSTRING_PROPERTY_WITH_VALIDATOR(PROPNAME) + +#define WX_PG_DECLARE_ARRAYSTRING_PROPERTY_WITH_DECL(PROPNAME, DECL) \ +WX_PG_DECLARE_ARRAYSTRING_PROPERTY_WITH_VALIDATOR_WITH_DECL(PROPNAME, DECL) + +#define WX_PG_IMPLEMENT_ARRAYSTRING_PROPERTY(PROPNAME,DELIMCHAR,CUSTBUTTXT) \ +WX_PG_IMPLEMENT_ARRAYSTRING_PROPERTY_WITH_VALIDATOR(PROPNAME, \ + DELIMCHAR, \ + CUSTBUTTXT) \ +wxValidator* PROPNAME::DoGetValidator () const \ +{ return NULL; } + + +// ----------------------------------------------------------------------- +// wxPGArrayEditorDialog +// ----------------------------------------------------------------------- + +#if wxUSE_EDITABLELISTBOX + +#include "wx/bmpbuttn.h" +#include "wx/editlbox.h" + +#define wxAEDIALOG_STYLE \ + (wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE) + +class WXDLLIMPEXP_PROPGRID wxPGArrayEditorDialog : public wxDialog +{ +public: + wxPGArrayEditorDialog(); + virtual ~wxPGArrayEditorDialog() { } + + void Init(); + + bool Create( wxWindow *parent, + const wxString& message, + const wxString& caption, + long style = wxAEDIALOG_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize ); + + void EnableCustomNewAction() + { + m_hasCustomNewAction = true; + } + + void SetNewButtonText(const wxString& text) + { + m_customNewButtonText = text; + if ( m_elb && m_elb->GetNewButton() ) + { + m_elb->GetNewButton()->SetToolTip(text); + } + } + + // Set value modified by dialog. + virtual void SetDialogValue( const wxVariant& WXUNUSED(value) ) + { + wxFAIL_MSG(wxS("re-implement this member function in derived class")); + } + + // Return value modified by dialog. + virtual wxVariant GetDialogValue() const + { + wxFAIL_MSG(wxS("re-implement this member function in derived class")); + return wxVariant(); + } + + // Override to return wxValidator to be used with the wxTextCtrl + // in dialog. Note that the validator is used in the standard + // wx way, i.e. it immediately prevents user from entering invalid + // input. + // Note: Dialog frees the validator. + virtual wxValidator* GetTextCtrlValidator() const + { + return NULL; + } + + // Returns true if array was actually modified + bool IsModified() const { return m_modified; } + + // wxEditableListBox utilities + int GetSelection() const; + + // implementation from now on + void OnAddClick(wxCommandEvent& event); + void OnDeleteClick(wxCommandEvent& event); + void OnUpClick(wxCommandEvent& event); + void OnDownClick(wxCommandEvent& event); + void OnEndLabelEdit(wxListEvent& event); + void OnBeginLabelEdit(wxListEvent& evt); + void OnIdle(wxIdleEvent& event); + +protected: + wxEditableListBox* m_elb; + + // These are used for focus repair + wxWindow* m_elbSubPanel; + wxWindow* m_lastFocused; + + // A new item, edited by user, is pending at this index. + // It will be committed once list ctrl item editing is done. + int m_itemPendingAtIndex; + + bool m_modified; + bool m_hasCustomNewAction; + wxString m_customNewButtonText; + + // These must be overridden - must return true on success. + virtual wxString ArrayGet( size_t index ) = 0; + virtual size_t ArrayGetCount() = 0; + virtual bool ArrayInsert( const wxString& str, int index ) = 0; + virtual bool ArraySet( size_t index, const wxString& str ) = 0; + virtual void ArrayRemoveAt( int index ) = 0; + virtual void ArraySwap( size_t first, size_t second ) = 0; + virtual bool OnCustomNewAction(wxString* WXUNUSED(resString)) + { + return false; + } + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxPGArrayEditorDialog); + wxDECLARE_EVENT_TABLE(); +}; + +#endif // wxUSE_EDITABLELISTBOX + +// ----------------------------------------------------------------------- +// wxPGArrayStringEditorDialog +// ----------------------------------------------------------------------- + +class WXDLLIMPEXP_PROPGRID + wxPGArrayStringEditorDialog : public wxPGArrayEditorDialog +{ +public: + wxPGArrayStringEditorDialog(); + virtual ~wxPGArrayStringEditorDialog() { } + + void Init(); + + virtual void SetDialogValue( const wxVariant& value ) wxOVERRIDE + { + m_array = value.GetArrayString(); + } + + virtual wxVariant GetDialogValue() const wxOVERRIDE + { + return m_array; + } + + void SetCustomButton( const wxString& custBtText, + wxArrayStringProperty* pcc ) + { + if ( !custBtText.empty() ) + { + EnableCustomNewAction(); + SetNewButtonText(custBtText); + m_pCallingClass = pcc; + } + } + + virtual bool OnCustomNewAction(wxString* resString) wxOVERRIDE; + +protected: + wxArrayString m_array; + + wxArrayStringProperty* m_pCallingClass; + + virtual wxString ArrayGet( size_t index ) wxOVERRIDE; + virtual size_t ArrayGetCount() wxOVERRIDE; + virtual bool ArrayInsert( const wxString& str, int index ) wxOVERRIDE; + virtual bool ArraySet( size_t index, const wxString& str ) wxOVERRIDE; + virtual void ArrayRemoveAt( int index ) wxOVERRIDE; + virtual void ArraySwap( size_t first, size_t second ) wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxPGArrayStringEditorDialog); + wxDECLARE_EVENT_TABLE(); +}; + +// ----------------------------------------------------------------------- + +#endif // wxUSE_PROPGRID + +#endif // _WX_PROPGRID_PROPS_H_ diff --git a/lib/wxWidgets/include/wx/protocol/file.h b/lib/wxWidgets/include/wx/protocol/file.h new file mode 100644 index 0000000..4654728 --- /dev/null +++ b/lib/wxWidgets/include/wx/protocol/file.h @@ -0,0 +1,38 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/protocol/file.h +// Purpose: File protocol +// Author: Guilhem Lavaux +// Modified by: +// Created: 1997 +// Copyright: (c) 1997, 1998 Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __WX_PROTO_FILE_H__ +#define __WX_PROTO_FILE_H__ + +#include "wx/defs.h" + +#if wxUSE_PROTOCOL_FILE + +#include "wx/protocol/protocol.h" + +class WXDLLIMPEXP_NET wxFileProto: public wxProtocol +{ +public: + wxFileProto(); + virtual ~wxFileProto(); + + bool Abort() wxOVERRIDE { return true; } + wxString GetContentType() const wxOVERRIDE { return wxEmptyString; } + + wxInputStream *GetInputStream(const wxString& path) wxOVERRIDE; + +protected: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxFileProto); + DECLARE_PROTOCOL(wxFileProto) +}; + +#endif // wxUSE_PROTOCOL_FILE + +#endif // __WX_PROTO_FILE_H__ diff --git a/lib/wxWidgets/include/wx/protocol/ftp.h b/lib/wxWidgets/include/wx/protocol/ftp.h new file mode 100644 index 0000000..426b6c9 --- /dev/null +++ b/lib/wxWidgets/include/wx/protocol/ftp.h @@ -0,0 +1,176 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/protocol/ftp.h +// Purpose: FTP protocol +// Author: Vadim Zeitlin +// Modified by: Mark Johnson, wxWindows@mj10777.de +// 20000917 : RmDir, GetLastResult, GetList +// Created: 07/07/1997 +// Copyright: (c) 1997, 1998 Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __WX_FTP_H__ +#define __WX_FTP_H__ + +#include "wx/defs.h" + +#if wxUSE_PROTOCOL_FTP + +#include "wx/sckaddr.h" +#include "wx/protocol/protocol.h" +#include "wx/url.h" + +class WXDLLIMPEXP_NET wxFTP : public wxProtocol +{ +public: + enum TransferMode + { + NONE, // not set by user explicitly + ASCII, + BINARY + }; + + wxFTP(); + virtual ~wxFTP(); + + // Connecting and disconnecting + virtual bool Connect(const wxSockAddress& addr, bool wait = true) wxOVERRIDE; + virtual bool Connect(const wxString& host) wxOVERRIDE { return Connect(host, 0); } + virtual bool Connect(const wxString& host, unsigned short port); + + // disconnect + virtual bool Close() wxOVERRIDE; + + // Parameters set up + + // set transfer mode now + void SetPassive(bool pasv) { m_bPassive = pasv; } + bool SetBinary() { return SetTransferMode(BINARY); } + bool SetAscii() { return SetTransferMode(ASCII); } + bool SetTransferMode(TransferMode mode); + + // Generic FTP interface + + // FTP doesn't know the MIME type of the last downloaded/uploaded file + virtual wxString GetContentType() const wxOVERRIDE { return wxEmptyString; } + + // the last FTP server reply + const wxString& GetLastResult() const { return m_lastResult; } + + // send any FTP command (should be full FTP command line but without + // trailing "\r\n") and return its return code + char SendCommand(const wxString& command); + + // check that the command returned the given code + bool CheckCommand(const wxString& command, char expectedReturn) + { + // SendCommand() does updates m_lastError + return SendCommand(command) == expectedReturn; + } + + // Filesystem commands + bool ChDir(const wxString& dir); + bool MkDir(const wxString& dir); + bool RmDir(const wxString& dir); + wxString Pwd(); + bool Rename(const wxString& src, const wxString& dst); + bool RmFile(const wxString& path); + + // Get the size of a file in the current dir. + // this function tries its best to deliver the size in bytes using BINARY + // (the SIZE command reports different sizes depending on whether + // type is set to ASCII or BINARY) + // returns -1 if file is non-existent or size could not be found + int GetFileSize(const wxString& fileName); + + // Check to see if a file exists in the current dir + bool FileExists(const wxString& fileName); + + // Download methods + bool Abort() wxOVERRIDE; + + virtual wxInputStream *GetInputStream(const wxString& path) wxOVERRIDE; + virtual wxOutputStream *GetOutputStream(const wxString& path); + + // Directory listing + + // get the list of full filenames, the format is fixed: one file name per + // line + bool GetFilesList(wxArrayString& files, + const wxString& wildcard = wxEmptyString) + { + return GetList(files, wildcard, false); + } + + // get a directory list in server dependent format - this can be shown + // directly to the user + bool GetDirList(wxArrayString& files, + const wxString& wildcard = wxEmptyString) + { + return GetList(files, wildcard, true); + } + + // equivalent to either GetFilesList() (default) or GetDirList() + bool GetList(wxArrayString& files, + const wxString& wildcard = wxEmptyString, + bool details = false); + +protected: + // this executes a simple ftp command with the given argument and returns + // true if it its return code starts with '2' + bool DoSimpleCommand(const wxChar *command, + const wxString& arg = wxEmptyString); + + // get the server reply, return the first character of the reply code, + // '1'..'5' for normal FTP replies, 0 (*not* '0') if an error occurred + char GetResult(); + + // check that the result is equal to expected value + bool CheckResult(char ch) { return GetResult() == ch; } + + // return the socket to be used, Passive/Active versions are used only by + // GetPort() + wxSocketBase *GetPort(); + wxSocketBase *GetPassivePort(); + wxSocketBase *GetActivePort(); + + // helper for GetPort() + wxString GetPortCmdArgument(const wxIPV4address& Local, const wxIPV4address& New); + + // accept connection from server in active mode, returns the same socket as + // passed in passive mode + wxSocketBase *AcceptIfActive(wxSocketBase *sock); + + + // internal variables: + + wxString m_lastResult; + + // true if there is an FTP transfer going on + bool m_streaming; + + // although this should be set to ASCII by default according to STD9, + // we will use BINARY transfer mode by default for backwards compatibility + TransferMode m_currentTransfermode; + + bool m_bPassive; + + // following is true when a read or write times out, we then assume + // the connection is dead and abort. we avoid additional delays this way + bool m_bEncounteredError; + + + friend class wxInputFTPStream; + friend class wxOutputFTPStream; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxFTP); + DECLARE_PROTOCOL(wxFTP) +}; + +// the trace mask used by assorted wxLogTrace() in ftp code, do +// wxLog::AddTraceMask(FTP_TRACE_MASK) to see them in output +#define FTP_TRACE_MASK wxT("ftp") + +#endif // wxUSE_PROTOCOL_FTP + +#endif // __WX_FTP_H__ diff --git a/lib/wxWidgets/include/wx/protocol/http.h b/lib/wxWidgets/include/wx/protocol/http.h new file mode 100644 index 0000000..90e0448 --- /dev/null +++ b/lib/wxWidgets/include/wx/protocol/http.h @@ -0,0 +1,96 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/protocol/http.h +// Purpose: HTTP protocol +// Author: Guilhem Lavaux +// Modified by: Simo Virokannas (authentication, Dec 2005) +// Created: August 1997 +// Copyright: (c) 1997, 1998 Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// +#ifndef _WX_HTTP_H +#define _WX_HTTP_H + +#include "wx/defs.h" + +#if wxUSE_PROTOCOL_HTTP + +#include "wx/hashmap.h" +#include "wx/protocol/protocol.h" +#include "wx/buffer.h" + +class WXDLLIMPEXP_NET wxHTTP : public wxProtocol +{ +public: + wxHTTP(); + virtual ~wxHTTP(); + + virtual bool Connect(const wxString& host, unsigned short port); + virtual bool Connect(const wxString& host) wxOVERRIDE { return Connect(host, 0); } + virtual bool Connect(const wxSockAddress& addr, bool wait = true) wxOVERRIDE; + bool Abort() wxOVERRIDE; + + wxInputStream *GetInputStream(const wxString& path) wxOVERRIDE; + + wxString GetContentType() const wxOVERRIDE; + wxString GetHeader(const wxString& header) const; + int GetResponse() const { return m_http_response; } + + void SetMethod(const wxString& method) { m_method = method; } + void SetHeader(const wxString& header, const wxString& h_data); + bool SetPostText(const wxString& contentType, + const wxString& data, + const wxMBConv& conv = wxConvUTF8); + bool SetPostBuffer(const wxString& contentType, const wxMemoryBuffer& data); + void SetProxyMode(bool on); + + /* Cookies */ + wxString GetCookie(const wxString& cookie) const; + bool HasCookies() const { return m_cookies.size() > 0; } + + // Use the other SetPostBuffer() overload or SetPostText() instead. + wxDEPRECATED(void SetPostBuffer(const wxString& post_buf)); + +protected: + typedef wxStringToStringHashMap::iterator wxHeaderIterator; + typedef wxStringToStringHashMap::const_iterator wxHeaderConstIterator; + typedef wxStringToStringHashMap::iterator wxCookieIterator; + typedef wxStringToStringHashMap::const_iterator wxCookieConstIterator; + + bool BuildRequest(const wxString& path, const wxString& method); + void SendHeaders(); + bool ParseHeaders(); + + wxString GenerateAuthString(const wxString& user, const wxString& pass) const; + + // find the header in m_headers + wxHeaderIterator FindHeader(const wxString& header); + wxHeaderConstIterator FindHeader(const wxString& header) const; + wxCookieIterator FindCookie(const wxString& cookie); + wxCookieConstIterator FindCookie(const wxString& cookie) const; + + // deletes the header value strings + void ClearHeaders(); + void ClearCookies(); + + // internal variables: + + wxString m_method; + wxStringToStringHashMap m_cookies; + + wxStringToStringHashMap m_headers; + bool m_read, + m_proxy_mode; + wxSockAddress *m_addr; + wxMemoryBuffer m_postBuffer; + wxString m_contentType; + int m_http_response; + + wxDECLARE_DYNAMIC_CLASS(wxHTTP); + DECLARE_PROTOCOL(wxHTTP) + wxDECLARE_NO_COPY_CLASS(wxHTTP); +}; + +#endif // wxUSE_PROTOCOL_HTTP + +#endif // _WX_HTTP_H + diff --git a/lib/wxWidgets/include/wx/protocol/log.h b/lib/wxWidgets/include/wx/protocol/log.h new file mode 100644 index 0000000..fa3481b --- /dev/null +++ b/lib/wxWidgets/include/wx/protocol/log.h @@ -0,0 +1,54 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/protocol/log.h +// Purpose: wxProtocolLog class for logging network exchanges +// Author: Troelsk, Vadim Zeitlin +// Created: 2009-03-06 +// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PROTOCOL_LOG_H_ +#define _WX_PROTOCOL_LOG_H_ + +#include "wx/string.h" + +// ---------------------------------------------------------------------------- +// wxProtocolLog: simple class for logging network requests and responses +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_NET wxProtocolLog +{ +public: + // Create object doing the logging using wxLogTrace() with the specified + // trace mask. + wxProtocolLog(const wxString& traceMask) + : m_traceMask(traceMask) + { + } + + // Virtual dtor for the base class + virtual ~wxProtocolLog() { } + + // Called by wxProtocol-derived classes to actually log something + virtual void LogRequest(const wxString& str) + { + DoLogString(wxASCII_STR("==> ") + str); + } + + virtual void LogResponse(const wxString& str) + { + DoLogString(wxASCII_STR("<== ") + str); + } + +protected: + // Can be overridden by the derived classes. + virtual void DoLogString(const wxString& str); + +private: + const wxString m_traceMask; + + wxDECLARE_NO_COPY_CLASS(wxProtocolLog); +}; + +#endif // _WX_PROTOCOL_LOG_H_ + diff --git a/lib/wxWidgets/include/wx/protocol/protocol.h b/lib/wxWidgets/include/wx/protocol/protocol.h new file mode 100644 index 0000000..4c9d693 --- /dev/null +++ b/lib/wxWidgets/include/wx/protocol/protocol.h @@ -0,0 +1,177 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/protocol/protocol.h +// Purpose: Protocol base class +// Author: Guilhem Lavaux +// Modified by: +// Created: 10/07/1997 +// Copyright: (c) 1997, 1998 Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PROTOCOL_PROTOCOL_H +#define _WX_PROTOCOL_PROTOCOL_H + +#include "wx/defs.h" + +#if wxUSE_PROTOCOL + +#include "wx/object.h" +#include "wx/string.h" +#include "wx/stream.h" + +#if wxUSE_SOCKETS + #include "wx/socket.h" +#endif + +class WXDLLIMPEXP_FWD_NET wxProtocolLog; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +enum wxProtocolError +{ + wxPROTO_NOERR = 0, + wxPROTO_NETERR, + wxPROTO_PROTERR, + wxPROTO_CONNERR, + wxPROTO_INVVAL, + wxPROTO_NOHNDLR, + wxPROTO_NOFILE, + wxPROTO_ABRT, + wxPROTO_RCNCT, + wxPROTO_STREAMING +}; + +// ---------------------------------------------------------------------------- +// wxProtocol: abstract base class for all protocols +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_NET wxProtocol +#if wxUSE_SOCKETS + : public wxSocketClient +#else + : public wxObject +#endif +{ +public: + wxProtocol(); + virtual ~wxProtocol(); + +#if wxUSE_SOCKETS + bool Reconnect(); + virtual bool Connect( const wxString& WXUNUSED(host) ) { return false; } + virtual bool Connect( const wxSockAddress& addr, bool WXUNUSED(wait) = true) wxOVERRIDE + { return wxSocketClient::Connect(addr); } + + // read a '\r\n' terminated line from the given socket and put it in + // result (without the terminators) + static wxProtocolError ReadLine(wxSocketBase *socket, wxString& result); + + // read a line from this socket - this one can be overridden in the + // derived classes if different line termination convention is to be used + virtual wxProtocolError ReadLine(wxString& result); +#endif // wxUSE_SOCKETS + + virtual bool Abort() = 0; + virtual wxInputStream *GetInputStream(const wxString& path) = 0; + virtual wxString GetContentType() const = 0; + + // the error code + virtual wxProtocolError GetError() const { return m_lastError; } + + void SetUser(const wxString& user) { m_username = user; } + void SetPassword(const wxString& passwd) { m_password = passwd; } + + virtual void SetDefaultTimeout(wxUint32 Value); + + // override wxSocketBase::SetTimeout function to avoid that the internal + // m_uiDefaultTimeout goes out-of-sync: + virtual void SetTimeout(long seconds) wxOVERRIDE + { SetDefaultTimeout(static_cast<wxUint32>(seconds)); } + + + // logging support: each wxProtocol object may have the associated logger + // (by default there is none) which is used to log network requests and + // responses + + // set the logger, deleting the old one and taking ownership of this one + void SetLog(wxProtocolLog *log); + + // return the current logger, may be NULL + wxProtocolLog *GetLog() const { return m_log; } + + // detach the existing logger without deleting it, the caller is + // responsible for deleting the returned pointer if it's non-NULL + wxProtocolLog *DetachLog() + { + wxProtocolLog * const log = m_log; + m_log = NULL; + return log; + } + + // these functions forward to the same functions with the same names in + // wxProtocolLog if we have a valid logger and do nothing otherwise + void LogRequest(const wxString& str); + void LogResponse(const wxString& str); + +protected: + // the timeout associated with the protocol: + wxUint32 m_uiDefaultTimeout; + + wxString m_username; + wxString m_password; + + // this must be always updated by the derived classes! + wxProtocolError m_lastError; + +private: + wxProtocolLog *m_log; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxProtocol); +}; + +// ---------------------------------------------------------------------------- +// macros for protocol classes +// ---------------------------------------------------------------------------- + +#define DECLARE_PROTOCOL(class) \ +public: \ + static wxProtoInfo g_proto_##class; + +#define IMPLEMENT_PROTOCOL(class, name, serv, host) \ +wxProtoInfo class::g_proto_##class(name, serv, host, wxCLASSINFO(class)); \ +bool wxProtocolUse##class = true; + +#define USE_PROTOCOL(class) \ + extern bool wxProtocolUse##class ; \ + static struct wxProtocolUserFor##class \ + { \ + wxProtocolUserFor##class() { wxProtocolUse##class = true; } \ + } wxProtocolDoUse##class; + +class WXDLLIMPEXP_NET wxProtoInfo : public wxObject +{ +public: + wxProtoInfo(const wxChar *name, + const wxChar *serv_name, + const bool need_host1, + wxClassInfo *info); + +protected: + wxProtoInfo *next; + wxString m_protoname; + wxString prefix; + wxString m_servname; + wxClassInfo *m_cinfo; + bool m_needhost; + + friend class wxURL; + + wxDECLARE_DYNAMIC_CLASS(wxProtoInfo); + wxDECLARE_NO_COPY_CLASS(wxProtoInfo); +}; + +#endif // wxUSE_PROTOCOL + +#endif // _WX_PROTOCOL_PROTOCOL_H diff --git a/lib/wxWidgets/include/wx/ptr_scpd.h b/lib/wxWidgets/include/wx/ptr_scpd.h new file mode 100644 index 0000000..76d8e42 --- /dev/null +++ b/lib/wxWidgets/include/wx/ptr_scpd.h @@ -0,0 +1,13 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/ptr_scpd.h +// Purpose: compatibility wrapper for wxScoped{Ptr,Array} +// Author: Vadim Zeitlin +// Created: 2009-02-03 +// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// do not include this file in any new code, include either wx/scopedptr.h or +// wx/scopedarray.h (or both) instead +#include "wx/scopedarray.h" +#include "wx/scopedptr.h" diff --git a/lib/wxWidgets/include/wx/ptr_shrd.h b/lib/wxWidgets/include/wx/ptr_shrd.h new file mode 100644 index 0000000..635cfe3 --- /dev/null +++ b/lib/wxWidgets/include/wx/ptr_shrd.h @@ -0,0 +1,11 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/ptr_shrd.h +// Purpose: compatibility wrapper for wx/sharedptr.h +// Author: Vadim Zeitlin +// Created: 2009-02-03 +// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// do not include this file in any new code, include wx/sharedptr.h instead +#include "wx/sharedptr.h" diff --git a/lib/wxWidgets/include/wx/qt/accel.h b/lib/wxWidgets/include/wx/qt/accel.h new file mode 100644 index 0000000..a988ffe --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/accel.h @@ -0,0 +1,62 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/accel.h +// Purpose: wxAcceleratorTable class +// Author: Peter Most, Javier Torres, Mariano Reingart +// Copyright: (c) 2009 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_ACCEL_H_ +#define _WX_QT_ACCEL_H_ + +/* wxQt accelerators implementation: + * + * Storing: + * QShortcuts are stored in wxWindow (m_qtShortcuts) to allow to delete them + * when the accelerator table is changed, and also because we need to specify + * a not-null parent from them, which is unknown at the moment of creating the + * accelerator table. So, the accelerator table only contains a list of + * wxAcceleratorEntries, which are converted to a list of QShortcuts when + * the table is fixed to a wxWindow. + * + * Passing keypresses to accelerators: + * The accelerators are implemented using QShortcut's. As there is no easy way + * to call them, we must pass all keypress events through the QApplication + * notify() function (which is the one that checks if the keypress match any + * shortcut. + * + * Executing commands when a QShortcut is triggered: + * Each QShortcut has a property ("wxQt_Command") set with the number of the + * wx command it is associated to. Then, its activated() signal is connected to + * a small handler (wxQtShortcutHandler in window_qt.h) which calls the main + * handler (wxWindow::QtHandleShortcut) passing the command extracted from the + * QShortcut. This handler will finally create and send the appropriate wx + * event to the window. */ + +#include "wx/vector.h" + +class QShortcut; +template < class T > class QList; + +class WXDLLIMPEXP_CORE wxAcceleratorTable : public wxObject +{ +public: + wxAcceleratorTable(); + wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]); + + // Implementation + wxVector<QShortcut*> ConvertShortcutTable( QWidget *parent ) const; + + bool Ok() const { return IsOk(); } + bool IsOk() const; + +protected: + // ref counting code + virtual wxObjectRefData *CreateRefData() const wxOVERRIDE; + virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxAcceleratorTable); +}; + +#endif // _WX_QT_ACCEL_H_ diff --git a/lib/wxWidgets/include/wx/qt/anybutton.h b/lib/wxWidgets/include/wx/qt/anybutton.h new file mode 100644 index 0000000..b5d0ac6 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/anybutton.h @@ -0,0 +1,53 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/anybutton.h +// Purpose: wxQT wxAnyButton class declaration +// Author: Mariano Reingart +// Copyright: (c) 2014 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_ANYBUTTON_H_ +#define _WX_QT_ANYBUTTON_H_ + +class QPushButton; + +//----------------------------------------------------------------------------- +// wxAnyButton +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxAnyButton : public wxAnyButtonBase +{ +public: + wxAnyButton(); + + // implementation + // -------------- + + virtual void SetLabel( const wxString &label ) wxOVERRIDE; + + virtual QWidget *GetHandle() const wxOVERRIDE; + + // implementation only + void QtUpdateState(); + virtual int QtGetEventType() const = 0; + +protected: + virtual wxBitmap DoGetBitmap(State state) const wxOVERRIDE; + virtual void DoSetBitmap(const wxBitmapBundle& bitmap, State which) wxOVERRIDE; + + QPushButton *m_qtPushButton; + + void QtCreate(wxWindow *parent); + void QtSetBitmap( const wxBitmapBundle &bitmap ); + +private: + State QtGetCurrentState() const; + + typedef wxAnyButtonBase base_type; + wxBitmapBundle m_bitmaps[State_Max]; + + wxDECLARE_NO_COPY_CLASS(wxAnyButton); +}; + + +#endif // _WX_QT_ANYBUTTON_H_ diff --git a/lib/wxWidgets/include/wx/qt/app.h b/lib/wxWidgets/include/wx/qt/app.h new file mode 100644 index 0000000..b9f2114 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/app.h @@ -0,0 +1,31 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: app.h +// Purpose: wxApp class +// Author: Peter Most, Mariano Reingart +// Copyright: (c) 2009 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_APP_H_ +#define _WX_QT_APP_H_ + +#include <wx/scopedarray.h> + +class QApplication; +class WXDLLIMPEXP_CORE wxApp : public wxAppBase +{ +public: + wxApp(); + ~wxApp(); + + virtual bool Initialize(int& argc, wxChar **argv) wxOVERRIDE; + +private: + wxScopedPtr<QApplication> m_qtApplication; + int m_qtArgc; + wxScopedArray<char*> m_qtArgv; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY( wxApp ); +}; + +#endif // _WX_QT_APP_H_ diff --git a/lib/wxWidgets/include/wx/qt/bitmap.h b/lib/wxWidgets/include/wx/qt/bitmap.h new file mode 100644 index 0000000..e1ea1f6 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/bitmap.h @@ -0,0 +1,127 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/bitmap.h +// Author: Peter Most, Javier Torres, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_BITMAP_H_ +#define _WX_QT_BITMAP_H_ + +class QImage; +class QPixmap; +class QBitmap; + +class WXDLLIMPEXP_CORE wxBitmap : public wxBitmapBase +{ +public: + wxBitmap(); + wxBitmap(QPixmap pix); + 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(int width, int height, const wxDC& dc); + wxBitmap(const char* const* bits); + wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM); + wxBitmap(const wxImage& image, int depth = wxBITMAP_SCREEN_DEPTH, double scale = 1.0); + wxBitmap(const wxImage& image, const wxDC& dc); + + // Convert from wxIcon / wxCursor + wxBitmap(const wxIcon& icon) { CopyFromIcon(icon); } + explicit wxBitmap(const wxCursor& cursor); + + static void InitStandardHandlers(); + + virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH) wxOVERRIDE; + virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) wxOVERRIDE; + virtual bool Create(int width, int height, const wxDC& dc); + + virtual int GetHeight() const wxOVERRIDE; + virtual int GetWidth() const wxOVERRIDE; + virtual int GetDepth() const wxOVERRIDE; + +#if wxUSE_IMAGE + virtual wxImage ConvertToImage() const wxOVERRIDE; +#endif // wxUSE_IMAGE + + virtual wxMask *GetMask() const wxOVERRIDE; + virtual void SetMask(wxMask *mask) wxOVERRIDE; + + virtual wxBitmap GetSubBitmap(const wxRect& rect) const wxOVERRIDE; + + virtual bool SaveFile(const wxString &name, wxBitmapType type, + const wxPalette *palette = NULL) const wxOVERRIDE; + virtual bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE) wxOVERRIDE; + +#if wxUSE_PALETTE + virtual wxPalette *GetPalette() const wxOVERRIDE; + virtual void SetPalette(const wxPalette& palette) wxOVERRIDE; +#endif // wxUSE_PALETTE + + // implementation: +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED(virtual void SetHeight(int height) wxOVERRIDE); + wxDEPRECATED(virtual void SetWidth(int width) wxOVERRIDE); + wxDEPRECATED(virtual void SetDepth(int depth) wxOVERRIDE); +#endif + + void *GetRawData(wxPixelDataBase& data, int bpp); + void UngetRawData(wxPixelDataBase& data); + + // these functions are internal and shouldn't be used, they risk to + // disappear in the future + bool HasAlpha() const wxOVERRIDE; + + QPixmap *GetHandle() const; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + +private: + void InitFromImage(const wxImage& image, int depth, double WXUNUSED(scale)); + + wxDECLARE_DYNAMIC_CLASS(wxBitmap); +}; + +class WXDLLIMPEXP_CORE wxMask : public wxMaskBase +{ +public: + wxMask(); + + // Copy constructor + wxMask(const wxMask &mask); + wxMask& operator=(const wxMask &mask); + + // Construct a mask from a bitmap and a colour indicating the transparent + // area + wxMask(const wxBitmap& bitmap, const wxColour& colour); + + // Construct a mask from a bitmap and a palette index indicating the + // transparent area + wxMask(const wxBitmap& bitmap, int paletteIndex); + + // Construct a mask from a mono bitmap (copies the bitmap). + wxMask(const wxBitmap& bitmap); + virtual ~wxMask(); + + wxBitmap GetBitmap() const; + + // Implementation + QBitmap *GetHandle() const; + +protected: + // this function is called from Create() to free the existing mask data + void FreeData() wxOVERRIDE; + // by the public wrappers + bool InitFromColour(const wxBitmap& bitmap, const wxColour& colour) wxOVERRIDE; + bool InitFromMonoBitmap(const wxBitmap& bitmap) wxOVERRIDE; + +protected: + wxDECLARE_DYNAMIC_CLASS(wxMask); + +private: + QBitmap *m_qtBitmap; +}; + +#endif // _WX_QT_BITMAP_H_ diff --git a/lib/wxWidgets/include/wx/qt/bmpbuttn.h b/lib/wxWidgets/include/wx/qt/bmpbuttn.h new file mode 100644 index 0000000..5cb5244 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/bmpbuttn.h @@ -0,0 +1,45 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/bmpbuttn.h +// Author: Peter Most +// Copyright: (c) Peter Most +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_BMPBUTTN_H_ +#define _WX_QT_BMPBUTTN_H_ + +class WXDLLIMPEXP_CORE wxBitmapButton : public wxBitmapButtonBase +{ +public: + wxBitmapButton(); + + wxBitmapButton(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)); + + bool CreateCloseButton(wxWindow* parent, + wxWindowID winid, + const wxString& name = wxString()); + +protected: + wxDECLARE_DYNAMIC_CLASS(wxBitmapButton); + +private: + // We re-use wxButton +}; + +#endif // _WX_QT_BMPBUTTN_H_ diff --git a/lib/wxWidgets/include/wx/qt/brush.h b/lib/wxWidgets/include/wx/qt/brush.h new file mode 100644 index 0000000..b060ce7 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/brush.h @@ -0,0 +1,49 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/brush.h +// Author: Peter Most, Javier Torres, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_BRUSH_H_ +#define _WX_QT_BRUSH_H_ + +class QBrush; + +class WXDLLIMPEXP_CORE wxBrush : public wxBrushBase +{ +public: + wxBrush(); + wxBrush(const wxColour& col, wxBrushStyle style = wxBRUSHSTYLE_SOLID); + + wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants") + wxBrush(const wxColour& col, int style); + + wxBrush(const wxBitmap& stipple); + + virtual void SetColour(const wxColour& col) wxOVERRIDE; + virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) wxOVERRIDE; + virtual void SetStyle(wxBrushStyle style) wxOVERRIDE; + virtual void SetStipple(const wxBitmap& stipple) wxOVERRIDE; + + bool operator==(const wxBrush& brush) const; + bool operator!=(const wxBrush& brush) const { return !(*this == brush); } + + virtual wxColour GetColour() const wxOVERRIDE; + virtual wxBrushStyle GetStyle() const wxOVERRIDE; + virtual wxBitmap *GetStipple() const wxOVERRIDE; + + wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants") + void SetStyle(int style) { SetStyle((wxBrushStyle)style); } + + QBrush GetHandle() const; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxBrush); +}; + +#endif // _WX_QT_BRUSH_H_ diff --git a/lib/wxWidgets/include/wx/qt/button.h b/lib/wxWidgets/include/wx/qt/button.h new file mode 100644 index 0000000..efc17c6 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/button.h @@ -0,0 +1,42 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/button.h +// Author: Peter Most, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_BUTTON_H_ +#define _WX_QT_BUTTON_H_ + +#include "wx/control.h" +#include "wx/button.h" + +class WXDLLIMPEXP_CORE wxButton : public wxButtonBase +{ +public: + wxButton(); + wxButton(wxWindow *parent, wxWindowID id, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)); + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)); + + virtual wxWindow *SetDefault() wxOVERRIDE; + + // implementation only + virtual int QtGetEventType() const wxOVERRIDE { return wxEVT_BUTTON; } + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxButton); +}; + + +#endif // _WX_QT_BUTTON_H_ diff --git a/lib/wxWidgets/include/wx/qt/calctrl.h b/lib/wxWidgets/include/wx/qt/calctrl.h new file mode 100644 index 0000000..dde92af --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/calctrl.h @@ -0,0 +1,94 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/calctrl.h +// Purpose: wxCalendarCtrl control implementation for wxQt +// Author: Kolya Kosenko +// Created: 2010-05-12 +// Copyright: (c) 2010 Kolya Kosenko +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_CALCTRL_H_ +#define _WX_QT_CALCTRL_H_ + +#include "wx/calctrl.h" +class QCalendarWidget; + +class WXDLLIMPEXP_ADV wxCalendarCtrl : public wxCalendarCtrlBase +{ +public: + wxCalendarCtrl() { Init(); } + wxCalendarCtrl(wxWindow *parent, + wxWindowID id, + const wxDateTime& date = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCAL_SHOW_HOLIDAYS, + const wxString& name = wxASCII_STR(wxCalendarNameStr)) + { + Init(); + Create(parent, id, date, pos, size, style, name); + } + + virtual ~wxCalendarCtrl(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxDateTime& date = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCAL_SHOW_HOLIDAYS, + const wxString& name = wxASCII_STR(wxCalendarNameStr)); + + virtual bool SetDate(const wxDateTime& date) wxOVERRIDE; + virtual wxDateTime GetDate() const wxOVERRIDE; + + virtual bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime, + const wxDateTime& upperdate = wxDefaultDateTime) wxOVERRIDE; + virtual bool GetDateRange(wxDateTime *lowerdate, wxDateTime *upperdate) const wxOVERRIDE; + + virtual bool EnableMonthChange(bool enable = true) wxOVERRIDE; + virtual void Mark(size_t day, bool mark) wxOVERRIDE; + + // holidays colours + virtual void SetHoliday(size_t day) wxOVERRIDE; + virtual void SetHolidayColours(const wxColour& colFg, const wxColour& colBg) wxOVERRIDE; + virtual const wxColour& GetHolidayColourFg() const wxOVERRIDE { return m_colHolidayFg; } + virtual const wxColour& GetHolidayColourBg() const wxOVERRIDE { return m_colHolidayBg; } + + // header colours + virtual void SetHeaderColours(const wxColour& colFg, const wxColour& colBg) wxOVERRIDE; + virtual const wxColour& GetHeaderColourFg() const wxOVERRIDE { return m_colHeaderFg; } + virtual const wxColour& GetHeaderColourBg() const wxOVERRIDE { return m_colHeaderBg; } + + // day attributes + virtual wxCalendarDateAttr *GetAttr(size_t day) const wxOVERRIDE; + virtual void SetAttr(size_t day, wxCalendarDateAttr *attr) wxOVERRIDE; + virtual void ResetAttr(size_t day) wxOVERRIDE { SetAttr(day, NULL); } + + + virtual void SetWindowStyleFlag(long style) wxOVERRIDE; + + using wxCalendarCtrlBase::GenerateAllChangeEvents; + + virtual QWidget *GetHandle() const wxOVERRIDE; + +protected: + virtual void RefreshHolidays() wxOVERRIDE; + +private: + void Init(); + void UpdateStyle(); + + QCalendarWidget *m_qtCalendar; + wxColour m_colHeaderFg, + m_colHeaderBg, + m_colHolidayFg, + m_colHolidayBg; + + wxCalendarDateAttr *m_attrs[31]; + + + wxDECLARE_DYNAMIC_CLASS(wxCalendarCtrl); +}; + +#endif // _WX_QT_CALCTRL_H_ diff --git a/lib/wxWidgets/include/wx/qt/checkbox.h b/lib/wxWidgets/include/wx/qt/checkbox.h new file mode 100644 index 0000000..2f0500f --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/checkbox.h @@ -0,0 +1,50 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/checkbox.h +// Author: Peter Most, Sean D'Epagnier, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_CHECKBOX_H_ +#define _WX_QT_CHECKBOX_H_ + +class QCheckBox; + +class WXDLLIMPEXP_CORE wxCheckBox : public wxCheckBoxBase +{ +public: + wxCheckBox(); + wxCheckBox( wxWindow *parent, wxWindowID id, const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr) ); + + virtual void SetValue(bool value) wxOVERRIDE; + virtual bool GetValue() const wxOVERRIDE; + + virtual void SetLabel(const wxString& label) wxOVERRIDE; + virtual wxString GetLabel() const wxOVERRIDE; + + virtual QWidget *GetHandle() const wxOVERRIDE; + +protected: + virtual void DoSet3StateValue(wxCheckBoxState state) wxOVERRIDE; + virtual wxCheckBoxState DoGet3StateValue() const wxOVERRIDE; + +private: + QCheckBox *m_qtCheckBox; + + wxDECLARE_DYNAMIC_CLASS(wxCheckBox); +}; + +#endif // _WX_QT_CHECKBOX_H_ diff --git a/lib/wxWidgets/include/wx/qt/checklst.h b/lib/wxWidgets/include/wx/qt/checklst.h new file mode 100644 index 0000000..a0bdbda --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/checklst.h @@ -0,0 +1,58 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/checklst.h +// Author: Peter Most, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_CHECKLST_H_ +#define _WX_QT_CHECKLST_H_ + +class WXDLLIMPEXP_CORE wxCheckListBox : public wxCheckListBoxBase +{ +public: + wxCheckListBox(); + wxCheckListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int nStrings = 0, + const wxString *choices = (const wxString *)NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + wxCheckListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + + + virtual ~wxCheckListBox(); + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + + virtual bool IsChecked(unsigned int item) const wxOVERRIDE; + virtual void Check(unsigned int item, bool check = true) wxOVERRIDE; + +private: + virtual void Init() wxOVERRIDE; //common construction + + wxDECLARE_DYNAMIC_CLASS(wxCheckListBox); +}; + +#endif // _WX_QT_CHECKLST_H_ diff --git a/lib/wxWidgets/include/wx/qt/choice.h b/lib/wxWidgets/include/wx/qt/choice.h new file mode 100644 index 0000000..267d341 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/choice.h @@ -0,0 +1,83 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/choice.h +// Author: Peter Most, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_CHOICE_H_ +#define _WX_QT_CHOICE_H_ + +class QComboBox; + +class WXDLLIMPEXP_CORE wxChoice : public wxChoiceBase +{ +public: + wxChoice(); + + wxChoice( wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = (const wxString *) NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr) ); + + wxChoice( wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr) ); + + bool Create( wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr) ); + + bool Create( wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr) ); + + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + virtual unsigned int GetCount() const wxOVERRIDE; + virtual wxString GetString(unsigned int n) const wxOVERRIDE; + virtual void SetString(unsigned int n, const wxString& s) wxOVERRIDE; + + virtual void SetSelection(int n) wxOVERRIDE; + virtual int GetSelection() const wxOVERRIDE; + + virtual QWidget *GetHandle() const wxOVERRIDE; + +protected: + virtual int DoInsertItems(const wxArrayStringsAdapter & items, + unsigned int pos, + void **clientData, + wxClientDataType type) wxOVERRIDE; + virtual int DoInsertOneItem(const wxString& item, unsigned int pos) wxOVERRIDE; + + virtual void DoSetItemClientData(unsigned int n, void *clientData) wxOVERRIDE; + virtual void *DoGetItemClientData(unsigned int n) const wxOVERRIDE; + + virtual void DoClear() wxOVERRIDE; + virtual void DoDeleteOneItem(unsigned int pos) wxOVERRIDE; + + void QtInitSort(QComboBox *combo); + + QComboBox *m_qtComboBox; + +private: + + wxDECLARE_DYNAMIC_CLASS(wxChoice); +}; + +#endif // _WX_QT_CHOICE_H_ diff --git a/lib/wxWidgets/include/wx/qt/clipbrd.h b/lib/wxWidgets/include/wx/qt/clipbrd.h new file mode 100644 index 0000000..d81d704 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/clipbrd.h @@ -0,0 +1,44 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/toolbar.h +// Author: Sean D'Epagnier +// Copyright: (c) Sean D'Epagnier 2014 +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_CLIPBRD_H_ +#define _WX_QT_CLIPBRD_H_ + +#include "wx/weakref.h" + +class QtClipBoardSignalHandler; + +class WXDLLIMPEXP_CORE wxClipboard : public wxClipboardBase +{ +public: + wxClipboard(); + ~wxClipboard(); + + virtual bool Open() wxOVERRIDE; + virtual void Close() wxOVERRIDE; + virtual bool IsOpened() const wxOVERRIDE; + + virtual bool AddData( wxDataObject *data ) wxOVERRIDE; + virtual bool SetData( wxDataObject *data ) wxOVERRIDE; + virtual bool GetData( wxDataObject& data ) wxOVERRIDE; + virtual void Clear() wxOVERRIDE; + virtual bool IsSupported( const wxDataFormat& format ) wxOVERRIDE; + virtual bool IsSupportedAsync(wxEvtHandler *sink) wxOVERRIDE; + +private: + friend class QtClipBoardSignalHandler; + int Mode(); + + QtClipBoardSignalHandler *m_SignalHandler; + wxEvtHandlerRef m_sink; + + bool m_open; + + wxDECLARE_DYNAMIC_CLASS(wxClipboard); +}; + +#endif // _WX_QT_CLIPBRD_H_ diff --git a/lib/wxWidgets/include/wx/qt/clrpicker.h b/lib/wxWidgets/include/wx/qt/clrpicker.h new file mode 100644 index 0000000..d73c133 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/clrpicker.h @@ -0,0 +1,50 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/clrpicker.h +// Author: Peter Most +// Copyright: (c) Peter Most +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_CLRPICKER_H_ +#define _WX_QT_CLRPICKER_H_ + +#include "wx/generic/clrpickerg.h" + +// TODO: A QtColorPicker is available from +// http://qt.nokia.com/products/appdev/add-on-products/catalog/4/Widgets/qtcolorpicker/ +// How to integrate into wxWidgets: +// +// class WXDLLIMPEXP_CORE wxColourPickerWidget : public wxButton, public wxColourPickerWidgetBase + +// TODO: For now we reuse the existing wxGenericColourButton but this should be +// changed to use the above mentioned color picker. + +class WXDLLIMPEXP_CORE wxColourPickerWidget : public wxGenericColourButton +{ +public: + wxColourPickerWidget(); + wxColourPickerWidget(wxWindow *parent, + wxWindowID id, + const wxColour& initial = *wxBLACK, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCLRBTN_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxColourPickerWidgetNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxColour& initial = *wxBLACK, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCLRBTN_DEFAULT_STYLE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxColourPickerWidgetNameStr)); + +protected: + virtual void UpdateColour() wxOVERRIDE; + +private: +}; + +#endif // _WX_QT_CLRPICKER_H_ diff --git a/lib/wxWidgets/include/wx/qt/colordlg.h b/lib/wxWidgets/include/wx/qt/colordlg.h new file mode 100644 index 0000000..cd2871a --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/colordlg.h @@ -0,0 +1,34 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/colordlg.h +// Author: Sean D'Epagnier +// Copyright: (c) Sean D'Epagnier 2014 +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_COLORDLG_H_ +#define _WX_QT_COLORDLG_H_ + +#include "wx/dialog.h" + +class QColorDialog; + +class WXDLLIMPEXP_CORE wxColourDialog : public wxDialog +{ +public: + wxColourDialog() { } + wxColourDialog(wxWindow *parent, + const wxColourData *data = NULL) { Create(parent, data); } + + bool Create(wxWindow *parent, const wxColourData *data = NULL); + + wxColourData &GetColourData(); + +private: + QColorDialog *GetQColorDialog() const; + + wxColourData m_data; + + wxDECLARE_DYNAMIC_CLASS(wxColourDialog); +}; + +#endif // _WX_QT_COLORDLG_H_ diff --git a/lib/wxWidgets/include/wx/qt/colour.h b/lib/wxWidgets/include/wx/qt/colour.h new file mode 100644 index 0000000..f6d041f --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/colour.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/colour.h +// Purpose: wxColour class implementation for wxQt +// Author: Kolya Kosenko +// Created: 2010-05-12 +// Copyright: (c) 2010 Kolya Kosenko +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_COLOUR_H_ +#define _WX_QT_COLOUR_H_ + +class QColor; + +class WXDLLIMPEXP_CORE wxColour : public wxColourBase +{ +public: + DEFINE_STD_WXCOLOUR_CONSTRUCTORS + wxColour(const QColor& color); + + virtual bool IsOk() const wxOVERRIDE { return m_valid; } + + ChannelType Red() const wxOVERRIDE { return m_red; } + ChannelType Green() const wxOVERRIDE { return m_green; } + ChannelType Blue() const wxOVERRIDE { return m_blue; } + ChannelType Alpha() const wxOVERRIDE { return m_alpha; } + + bool operator==(const wxColour& color) const; + bool operator!=(const wxColour& color) const; + + int GetPixel() const; + + QColor GetQColor() const; + +protected: + void Init(); + virtual void InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a) wxOVERRIDE; + +private: + ChannelType m_red, m_green, m_blue, m_alpha; + bool m_valid; + + wxDECLARE_DYNAMIC_CLASS(wxColour); +}; + +#endif // _WX_QT_COLOUR_H_ diff --git a/lib/wxWidgets/include/wx/qt/combobox.h b/lib/wxWidgets/include/wx/qt/combobox.h new file mode 100644 index 0000000..c8a596a --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/combobox.h @@ -0,0 +1,101 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/combobox.h +// Author: Peter Most, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_COMBOBOX_H_ +#define _WX_QT_COMBOBOX_H_ + +#include "wx/choice.h" +class QComboBox; + +class WXDLLIMPEXP_CORE wxComboBox : public wxChoice, public wxTextEntry +{ +public: + wxComboBox(); + + wxComboBox(wxWindow *parent, + wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)); + + wxComboBox(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)); + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = (const wxString *) NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)); + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)); + + virtual void SetSelection(int n) wxOVERRIDE; + virtual void SetSelection(long from, long to) wxOVERRIDE; + + virtual int GetSelection() const wxOVERRIDE { return wxChoice::GetSelection(); } + virtual void GetSelection(long *from, long *to) const wxOVERRIDE; + + virtual wxString GetStringSelection() const wxOVERRIDE + { + return wxItemContainer::GetStringSelection(); + } + + virtual void Clear() wxOVERRIDE; + + // See wxComboBoxBase discussion of IsEmpty(). + bool IsListEmpty() const { return wxItemContainer::IsEmpty(); } + bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); } + + virtual void SetValue(const wxString& value) wxOVERRIDE; + virtual void ChangeValue(const wxString& value) wxOVERRIDE; + virtual void AppendText(const wxString &value) wxOVERRIDE; + virtual void Replace(long from, long to, const wxString &value) wxOVERRIDE; + virtual void WriteText(const wxString &value) wxOVERRIDE; + virtual void SetInsertionPoint(long insertion) wxOVERRIDE; + virtual long GetInsertionPoint() const wxOVERRIDE; + + virtual void Popup(); + virtual void Dismiss(); + + virtual const wxTextEntry* WXGetTextEntry() const wxOVERRIDE { return this; } + + virtual bool QtHandleFocusEvent(QWidget *handler, QFocusEvent *event) wxOVERRIDE; +protected: + + // From wxTextEntry: + virtual wxString DoGetValue() const wxOVERRIDE; + +private: + void SetActualValue(const wxString& value); + bool IsReadOnly() const; + + // From wxTextEntry: + virtual wxWindow *GetEditableWindow() wxOVERRIDE { return this; } + + wxDECLARE_DYNAMIC_CLASS(wxComboBox); +}; + +#endif // _WX_QT_COMBOBOX_H_ diff --git a/lib/wxWidgets/include/wx/qt/control.h b/lib/wxWidgets/include/wx/qt/control.h new file mode 100644 index 0000000..38c45f4 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/control.h @@ -0,0 +1,38 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/control.h +// Author: Peter Most, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_CONTROL_H_ +#define _WX_QT_CONTROL_H_ + +class WXDLLIMPEXP_CORE wxControl : public wxControlBase +{ +public: + wxControl(); + wxControl(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxControlNameStr)); + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxControlNameStr)); + + virtual wxSize DoGetBestSize() const wxOVERRIDE; + +protected: + bool QtCreateControl( wxWindow *parent, wxWindowID id, const wxPoint &pos, + const wxSize &size, long style, const wxValidator &validator, + const wxString &name ); + +private: + wxDECLARE_DYNAMIC_CLASS(wxControl); +}; + +#endif // _WX_QT_CONTROL_H_ diff --git a/lib/wxWidgets/include/wx/qt/ctrlsub.h b/lib/wxWidgets/include/wx/qt/ctrlsub.h new file mode 100644 index 0000000..f021fa4 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/ctrlsub.h @@ -0,0 +1,22 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/ctrlsub.h +// Author: Peter Most +// Copyright: (c) Peter Most +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_CTRLSUB_H_ +#define _WX_QT_CTRLSUB_H_ + +class WXDLLIMPEXP_CORE wxControlWithItems : public wxControlWithItemsBase +{ +public: + wxControlWithItems(); + +protected: + +private: + wxDECLARE_ABSTRACT_CLASS(wxControlWithItems); +}; + +#endif // _WX_QT_CTRLSUB_H_ diff --git a/lib/wxWidgets/include/wx/qt/cursor.h b/lib/wxWidgets/include/wx/qt/cursor.h new file mode 100644 index 0000000..763d61c --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/cursor.h @@ -0,0 +1,48 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: cursor.h +// Author: Sean D'Epagnier +// Copyright: (c) Sean D'Epagnier 2014 +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_CURSOR_H_ +#define _WX_QT_CURSOR_H_ + +#include "wx/image.h" + +class QCursor; + +class WXDLLIMPEXP_CORE wxCursor : public wxCursorBase +{ +public: + wxCursor() { } + wxCursor(wxStockCursor id) { InitFromStock(id); } +#if WXWIN_COMPATIBILITY_2_8 + wxCursor(int id) { InitFromStock((wxStockCursor)id); } +#endif +#if wxUSE_IMAGE + wxCursor( const wxImage & image ); + wxCursor(const char* const* xpmData); +#endif // wxUSE_IMAGE + wxCursor(const wxString& name, + wxBitmapType type = wxCURSOR_DEFAULT_TYPE, + int hotSpotX = 0, int hotSpotY = 0); + + virtual wxPoint GetHotSpot() const wxOVERRIDE; + QCursor &GetHandle() const; + +protected: + void InitFromStock( wxStockCursor cursorId ); +#if wxUSE_IMAGE + void InitFromImage( const wxImage & image ); +#endif + +private: + void Init(); + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxCursor); +}; + +#endif // _WX_QT_CURSOR_H_ diff --git a/lib/wxWidgets/include/wx/qt/dataform.h b/lib/wxWidgets/include/wx/qt/dataform.h new file mode 100644 index 0000000..55932a5 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/dataform.h @@ -0,0 +1,41 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/dataform.h +// Author: Sean D'Epagnier +// Copyright: (c) Sean D'Epagnier 2014 +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_DATAFORM_H_ +#define _WX_QT_DATAFORM_H_ + +class WXDLLIMPEXP_CORE wxDataFormat +{ +public: + wxDataFormat(wxDataFormatId formatId = wxDF_INVALID); + wxDataFormat(const wxString &id); + + // Standard methods + const wxString& GetId() const; + void SetId(const wxString& id); + + wxDataFormatId GetType() const; + void SetType(wxDataFormatId type); + + bool operator==(wxDataFormatId format) const; + bool operator!=(wxDataFormatId format) const; + bool operator==(const wxDataFormat& format) const; + bool operator!=(const wxDataFormat& format) const; + + // Direct access to the underlying mime type. + // Equivalent to "id", except "id" is supposed to be + // invalid for standard types, whereas this should + // always be valid (if meaningful). + const wxString& GetMimeType() const; + void SetMimeType(const wxString& mimeType); + +private: + wxString m_mimeType; + wxDataFormatId m_formatId; +}; + +#endif // _WX_QT_DATAFORM_H_ diff --git a/lib/wxWidgets/include/wx/qt/dataobj.h b/lib/wxWidgets/include/wx/qt/dataobj.h new file mode 100644 index 0000000..3e891d1 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/dataobj.h @@ -0,0 +1,35 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/qt/dataobj.h +// Author: Peter Most +// Copyright: (c) Peter Most +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_DATAOBJ_H_ +#define _WX_QT_DATAOBJ_H_ + +// ---------------------------------------------------------------------------- +// wxDataObject is the same as wxDataObjectBase under wxQT +// ---------------------------------------------------------------------------- + +class QMimeData; + +class WXDLLIMPEXP_CORE wxDataObject : public wxDataObjectBase +{ +public: + wxDataObject(); + virtual ~wxDataObject(); + + virtual bool IsSupportedFormat( const wxDataFormat& format, Direction dir = Get ) const; + + // Adds object's data to Qt mime data appropriately for type + virtual void QtAddDataTo(QMimeData &mimeData) const; + // Sets object's data from Qt mime data appropriately for type + virtual bool QtSetDataFrom(const QMimeData &mimeData); + +private: + // Sets object's data from Qt mime data in specific format + virtual void QtSetDataSingleFormat(const QMimeData &mimeData, const wxDataFormat &format); +}; + +#endif // _WX_QT_DATAOBJ_H_ diff --git a/lib/wxWidgets/include/wx/qt/dataobj2.h b/lib/wxWidgets/include/wx/qt/dataobj2.h new file mode 100644 index 0000000..8ddb3e7 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/dataobj2.h @@ -0,0 +1,37 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/dataobj2.h +// Author: Peter Most +// Copyright: (c) Peter Most +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_DATAOBJ2_H_ +#define _WX_QT_DATAOBJ2_H_ + +class WXDLLIMPEXP_CORE wxBitmapDataObject : public wxBitmapDataObjectBase +{ +public: + wxBitmapDataObject(); + wxBitmapDataObject(const wxBitmap& bitmap); + + // Overridden to set image data directly, which Qt will write to clipboard in many formats + void QtAddDataTo(QMimeData &mimeData) const wxOVERRIDE; + // Overridden to retrieve image data from any format that Qt can read from clipboard + bool QtSetDataFrom(const QMimeData &mimeData) wxOVERRIDE; + +protected: + +private: +}; + + + +class WXDLLIMPEXP_CORE wxFileDataObject : public wxFileDataObjectBase +{ +public: + wxFileDataObject(); + + void AddFile( const wxString &filename ); +}; + +#endif // _WX_QT_DATAOBJ2_H_ diff --git a/lib/wxWidgets/include/wx/qt/dataview.h b/lib/wxWidgets/include/wx/qt/dataview.h new file mode 100644 index 0000000..3846d15 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/dataview.h @@ -0,0 +1,141 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/dataview.h +// Author: Peter Most +// Copyright: (c) Peter Most +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_DATAVIEW_H_ +#define _WX_QT_DATAVIEW_H_ + +class WXDLLIMPEXP_ADV wxDataViewColumn: public wxDataViewColumnBase +{ +public: + wxDataViewColumn( const wxString &title, wxDataViewRenderer *renderer, + unsigned int model_column, int width = wxDVC_DEFAULT_WIDTH, + wxAlignment align = wxALIGN_CENTER, + int flags = wxDATAVIEW_COL_RESIZABLE ); + wxDataViewColumn( const wxBitmapBundle &bitmap, wxDataViewRenderer *renderer, + unsigned int model_column, int width = wxDVC_DEFAULT_WIDTH, + wxAlignment align = wxALIGN_CENTER, + int flags = wxDATAVIEW_COL_RESIZABLE ); + + + // setters: + + virtual void SetTitle( const wxString &title ); + virtual void SetBitmap( const wxBitmapBundle &bitmap ); + + virtual void SetOwner( wxDataViewCtrl *owner ); + + virtual void SetAlignment( wxAlignment align ); + + virtual void SetSortable( bool sortable ); + virtual void SetSortOrder( bool ascending ); + virtual void SetAsSortKey(bool sort = true); + + virtual void SetResizeable( bool resizeable ); + virtual void SetHidden( bool hidden ); + + virtual void SetMinWidth( int minWidth ); + virtual void SetWidth( int width ); + + virtual void SetReorderable( bool reorderable ); + + virtual void SetFlags(int flags); + + // getters: + + virtual wxString GetTitle() const; + virtual wxAlignment GetAlignment() const; + + virtual bool IsSortable() const; + virtual bool IsSortOrderAscending() const; + virtual bool IsSortKey() const; + + virtual bool IsResizeable() const; + virtual bool IsHidden() const; + + virtual int GetWidth() const; + virtual int GetMinWidth() const; + + virtual bool IsReorderable() const; + + virtual int GetFlags() const; + +}; + + +class WXDLLIMPEXP_ADV wxDataViewCtrl: public wxDataViewCtrlBase +{ +public: + wxDataViewCtrl(); + + wxDataViewCtrl( wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator ); + + virtual ~wxDataViewCtrl(); + + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator ); + + virtual bool AssociateModel( wxDataViewModel *model ); + + virtual bool PrependColumn( wxDataViewColumn *col ); + virtual bool AppendColumn( wxDataViewColumn *col ); + virtual bool InsertColumn( unsigned int pos, wxDataViewColumn *col ); + + virtual unsigned int GetColumnCount() const; + virtual wxDataViewColumn* GetColumn( unsigned int pos ) const; + virtual bool DeleteColumn( wxDataViewColumn *column ); + virtual bool ClearColumns(); + virtual int GetColumnPosition( const wxDataViewColumn *column ) const; + + virtual wxDataViewColumn *GetSortingColumn() const; + + virtual wxDataViewItem GetSelection() const; + virtual int GetSelections( wxDataViewItemArray & sel ) const; + virtual void SetSelections( const wxDataViewItemArray & sel ); + virtual void Select( const wxDataViewItem & item ); + virtual void Unselect( const wxDataViewItem & item ); + virtual bool IsSelected( const wxDataViewItem & item ) const; + virtual void SelectAll(); + virtual void UnselectAll(); + + virtual void EnsureVisible( const wxDataViewItem& item, + const wxDataViewColumn *column = NULL ); + virtual void HitTest( const wxPoint &point, + wxDataViewItem &item, + wxDataViewColumn *&column ) const; + virtual wxRect GetItemRect( const wxDataViewItem &item, + const wxDataViewColumn *column = NULL ) const; + + virtual void Collapse( const wxDataViewItem & item ); + virtual bool IsExpanded( const wxDataViewItem & item ) const; + + virtual bool EnableDragSource( const wxDataFormat &format ); + virtual bool DoEnableDropTarget( const wxVector<wxDataFormat>& formats ); + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + wxWindow *GetMainWindow() { return (wxWindow*) this; } + + virtual void OnInternalIdle(); + +protected: + virtual void DoSetExpanderColumn(); + virtual void DoSetIndent(); + virtual void DoExpand( const wxDataViewItem & item, bool expandChildren ); + +private: + virtual wxDataViewItem DoGetCurrentItem() const; + virtual void DoSetCurrentItem(const wxDataViewItem& item); +}; + +#endif // _WX_QT_DATAVIEW_H_ diff --git a/lib/wxWidgets/include/wx/qt/dc.h b/lib/wxWidgets/include/wx/qt/dc.h new file mode 100644 index 0000000..94f3261 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/dc.h @@ -0,0 +1,138 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/dc.h +// Author: Peter Most, Javier Torres, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_DC_H_ +#define _WX_QT_DC_H_ + +class QPainter; +class QImage; + +class WXDLLIMPEXP_FWD_CORE wxRegion; + +class WXDLLIMPEXP_CORE wxQtDCImpl : public wxDCImpl +{ +public: + wxQtDCImpl( wxDC *owner ); + ~wxQtDCImpl(); + + virtual bool CanDrawBitmap() const wxOVERRIDE; + virtual bool CanGetTextExtent() const wxOVERRIDE; + + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; + virtual void DoGetSizeMM(int* width, int* height) const wxOVERRIDE; + + virtual int GetDepth() const wxOVERRIDE; + virtual wxSize GetPPI() const wxOVERRIDE; + + virtual void SetFont(const wxFont& font) wxOVERRIDE; + virtual void SetPen(const wxPen& pen) wxOVERRIDE; + virtual void SetBrush(const wxBrush& brush) wxOVERRIDE; + virtual void SetBackground(const wxBrush& brush) wxOVERRIDE; + virtual void SetBackgroundMode(int mode) wxOVERRIDE; + +#if wxUSE_PALETTE + virtual void SetPalette(const wxPalette& palette) wxOVERRIDE; +#endif // wxUSE_PALETTE + + virtual void SetLogicalFunction(wxRasterOperationMode function) wxOVERRIDE; + + virtual wxCoord GetCharHeight() const wxOVERRIDE; + virtual wxCoord GetCharWidth() const wxOVERRIDE; + virtual void DoGetTextExtent(const wxString& string, + wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + const wxFont *theFont = NULL) const wxOVERRIDE; + + virtual void Clear() wxOVERRIDE; + + virtual void DoSetClippingRegion(wxCoord x, wxCoord y, + wxCoord width, wxCoord height) wxOVERRIDE; + + virtual void DoSetDeviceClippingRegion(const wxRegion& region) wxOVERRIDE; + virtual void DestroyClippingRegion() wxOVERRIDE; + + virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, + wxFloodFillStyle style = wxFLOOD_SURFACE) wxOVERRIDE; + virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const wxOVERRIDE; + + virtual void DoDrawPoint(wxCoord x, wxCoord y) wxOVERRIDE; + virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) wxOVERRIDE; + + virtual void DoDrawArc(wxCoord x1, wxCoord y1, + wxCoord x2, wxCoord y2, + wxCoord xc, wxCoord yc) wxOVERRIDE; + + virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, + double sa, double ea) wxOVERRIDE; + + virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE; + virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, + wxCoord width, wxCoord height, + double radius) wxOVERRIDE; + virtual void DoDrawEllipse(wxCoord x, wxCoord y, + wxCoord width, wxCoord height) wxOVERRIDE; + + virtual void DoCrossHair(wxCoord x, wxCoord y) wxOVERRIDE; + + virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) wxOVERRIDE; + virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, + bool useMask = false) wxOVERRIDE; + + virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) wxOVERRIDE; + virtual void DoDrawRotatedText(const wxString& text, + wxCoord x, wxCoord y, double angle) wxOVERRIDE; + + virtual bool DoBlit(wxCoord xdest, wxCoord ydest, + wxCoord width, wxCoord height, + wxDC *source, + wxCoord xsrc, wxCoord ysrc, + wxRasterOperationMode rop = wxCOPY, + bool useMask = false, + wxCoord xsrcMask = wxDefaultCoord, + wxCoord ysrcMask = wxDefaultCoord) wxOVERRIDE; + + virtual void DoDrawLines(int n, const wxPoint points[], + wxCoord xoffset, wxCoord yoffset ) wxOVERRIDE; + + virtual void DoDrawPolygon(int n, const wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + wxPolygonFillMode fillStyle = wxODDEVEN_RULE) wxOVERRIDE; + + // Use Qt transformations, as they automatically scale pen widths, text... + virtual void ComputeScaleAndOrigin() wxOVERRIDE; + + void QtPreparePainter(); + + virtual void* GetHandle() const wxOVERRIDE { return (void*) m_qtPainter; } + +protected: + virtual QPixmap *GetQPixmap() { return m_qtPixmap; } + + QPainter *m_qtPainter; + QPixmap *m_qtPixmap; + + wxRegion m_clippingRegion; +private: + enum wxQtRasterColourOp + { + wxQtNONE, + wxQtWHITE, + wxQtBLACK, + wxQtINVERT + }; + wxQtRasterColourOp m_rasterColourOp; + QColor *m_qtPenColor; + QColor *m_qtBrushColor; + void ApplyRasterColourOp(); + + wxDECLARE_CLASS(wxQtDCImpl); + wxDECLARE_NO_COPY_CLASS(wxQtDCImpl); + +}; + +#endif // _WX_QT_DC_H_ diff --git a/lib/wxWidgets/include/wx/qt/dcclient.h b/lib/wxWidgets/include/wx/qt/dcclient.h new file mode 100644 index 0000000..c9a5986 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/dcclient.h @@ -0,0 +1,59 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/dcclient.h +// Author: Peter Most, Javier Torres, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_DCCLIENT_H_ +#define _WX_QT_DCCLIENT_H_ + +#include "wx/qt/dc.h" + +#include "wx/scopedptr.h" + +class QPicture; + +class WXDLLIMPEXP_CORE wxWindowDCImpl : public wxQtDCImpl +{ +public: + wxWindowDCImpl( wxDC *owner ); + wxWindowDCImpl( wxDC *owner, wxWindow *win ); + + ~wxWindowDCImpl(); + +protected: + wxWindow *m_window; + +private: + wxDECLARE_CLASS(wxWindowDCImpl); + wxDECLARE_NO_COPY_CLASS(wxWindowDCImpl); +}; + + +class WXDLLIMPEXP_CORE wxClientDCImpl : public wxWindowDCImpl +{ +public: + wxClientDCImpl( wxDC *owner ); + wxClientDCImpl( wxDC *owner, wxWindow *win ); + + ~wxClientDCImpl(); +private: + wxScopedPtr<QPicture> m_pict; + + wxDECLARE_CLASS(wxClientDCImpl); + wxDECLARE_NO_COPY_CLASS(wxClientDCImpl); +}; + + +class WXDLLIMPEXP_CORE wxPaintDCImpl : public wxWindowDCImpl +{ +public: + wxPaintDCImpl( wxDC *owner ); + wxPaintDCImpl( wxDC *owner, wxWindow *win ); +private: + wxDECLARE_CLASS(wxPaintDCImpl); + wxDECLARE_NO_COPY_CLASS(wxPaintDCImpl); +}; + +#endif // _WX_QT_DCCLIENT_H_ diff --git a/lib/wxWidgets/include/wx/qt/dcmemory.h b/lib/wxWidgets/include/wx/qt/dcmemory.h new file mode 100644 index 0000000..9dddf6e --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/dcmemory.h @@ -0,0 +1,34 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/dcmemory.h +// Author: Peter Most, Javier Torres, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_DCMEMORY_H_ +#define _WX_QT_DCMEMORY_H_ + +#include "wx/qt/dcclient.h" + +class WXDLLIMPEXP_CORE wxMemoryDCImpl : public wxQtDCImpl +{ +public: + wxMemoryDCImpl( wxMemoryDC *owner ); + wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap ); + wxMemoryDCImpl( wxMemoryDC *owner, wxDC *dc ); + ~wxMemoryDCImpl(); + + virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const wxOVERRIDE; + virtual void DoSelect(const wxBitmap& bitmap) wxOVERRIDE; + + virtual const wxBitmap& GetSelectedBitmap() const wxOVERRIDE; + virtual wxBitmap& GetSelectedBitmap() wxOVERRIDE; + +private: + wxBitmap m_selected; + + DECLARE_CLASS(wxMemoryDCImpl); + DECLARE_NO_COPY_CLASS(wxMemoryDCImpl); +}; + +#endif // _WX_QT_DCMEMORY_H_ diff --git a/lib/wxWidgets/include/wx/qt/dcprint.h b/lib/wxWidgets/include/wx/qt/dcprint.h new file mode 100644 index 0000000..51b7bee --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/dcprint.h @@ -0,0 +1,106 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/dcprint.h +// Author: Peter Most +// Copyright: (c) Peter Most +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_DCPRINT_H_ +#define _WX_QT_DCPRINT_H_ + +#include "wx/dc.h" + +class WXDLLIMPEXP_CORE wxPrinterDCImpl : public wxDCImpl +{ +public: + wxPrinterDCImpl( wxPrinterDC *, const wxPrintData & ); + + virtual bool CanDrawBitmap() const wxOVERRIDE; + virtual bool CanGetTextExtent() const wxOVERRIDE; + + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; + virtual void DoGetSizeMM(int* width, int* height) const wxOVERRIDE; + + virtual int GetDepth() const wxOVERRIDE; + virtual wxSize GetPPI() const wxOVERRIDE; + + virtual void SetFont(const wxFont& font) wxOVERRIDE; + virtual void SetPen(const wxPen& pen) wxOVERRIDE; + virtual void SetBrush(const wxBrush& brush) wxOVERRIDE; + virtual void SetBackground(const wxBrush& brush) wxOVERRIDE; + virtual void SetBackgroundMode(int mode) wxOVERRIDE; + +#if wxUSE_PALETTE + virtual void SetPalette(const wxPalette& palette) wxOVERRIDE; +#endif // wxUSE_PALETTE + + virtual void SetLogicalFunction(wxRasterOperationMode function) wxOVERRIDE; + + virtual wxCoord GetCharHeight() const wxOVERRIDE; + virtual wxCoord GetCharWidth() const wxOVERRIDE; + virtual void DoGetTextExtent(const wxString& string, + wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + const wxFont *theFont = NULL) const wxOVERRIDE; + + virtual void Clear() wxOVERRIDE; + + virtual void DoSetClippingRegion(wxCoord x, wxCoord y, + wxCoord width, wxCoord height) wxOVERRIDE; + + virtual void DoSetDeviceClippingRegion(const wxRegion& region) wxOVERRIDE; + + virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, + wxFloodFillStyle style = wxFLOOD_SURFACE) wxOVERRIDE; + + virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const wxOVERRIDE; + + virtual void DoDrawPoint(wxCoord x, wxCoord y) wxOVERRIDE; + virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) wxOVERRIDE; + + virtual void DoDrawArc(wxCoord x1, wxCoord y1, + wxCoord x2, wxCoord y2, + wxCoord xc, wxCoord yc) wxOVERRIDE; + virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, + double sa, double ea) wxOVERRIDE; + + virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE; + virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, + wxCoord width, wxCoord height, + double radius) wxOVERRIDE; + virtual void DoDrawEllipse(wxCoord x, wxCoord y, + wxCoord width, wxCoord height) wxOVERRIDE; + + virtual void DoCrossHair(wxCoord x, wxCoord y) wxOVERRIDE; + + virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) wxOVERRIDE; + virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, + bool useMask = false) wxOVERRIDE; + + virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) wxOVERRIDE; + virtual void DoDrawRotatedText(const wxString& text, + wxCoord x, wxCoord y, double angle) wxOVERRIDE; + + virtual bool DoBlit(wxCoord xdest, wxCoord ydest, + wxCoord width, wxCoord height, + wxDC *source, + wxCoord xsrc, wxCoord ysrc, + wxRasterOperationMode rop = wxCOPY, + bool useMask = false, + wxCoord xsrcMask = wxDefaultCoord, + wxCoord ysrcMask = wxDefaultCoord) wxOVERRIDE; + + virtual void DoDrawLines(int n, const wxPoint points[], + wxCoord xoffset, wxCoord yoffset ) wxOVERRIDE; + + virtual void DoDrawPolygon(int n, const wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + wxPolygonFillMode fillStyle = wxODDEVEN_RULE) wxOVERRIDE; + +private: + wxDECLARE_CLASS(wxPrinterDCImpl); + wxDECLARE_NO_COPY_CLASS(wxPrinterDCImpl); +}; + +#endif // _WX_QT_DCPRINT_H_ diff --git a/lib/wxWidgets/include/wx/qt/dcscreen.h b/lib/wxWidgets/include/wx/qt/dcscreen.h new file mode 100644 index 0000000..f2fba75 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/dcscreen.h @@ -0,0 +1,27 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/dcscreen.h +// Author: Sean D'Epagnier +// Copyright: (c) Sean D'Epagnier +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_DCSCREEN_H_ +#define _WX_QT_DCSCREEN_H_ + +#include "wx/qt/dcclient.h" + +class WXDLLIMPEXP_CORE wxScreenDCImpl : public wxWindowDCImpl +{ +public: + wxScreenDCImpl( wxScreenDC *owner ); + + ~wxScreenDCImpl(); + +protected: + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; + virtual QPixmap *GetQPixmap() wxOVERRIDE; + + wxDECLARE_ABSTRACT_CLASS(wxScreenDCImpl); +}; + +#endif // _WX_QT_DCSCREEN_H_ diff --git a/lib/wxWidgets/include/wx/qt/defs.h b/lib/wxWidgets/include/wx/qt/defs.h new file mode 100644 index 0000000..b737b92 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/defs.h @@ -0,0 +1,17 @@ +/* + * Name: wx/qt/defs.h + * Author: Peter Most + * Copyright: (c) Peter Most + * Licence: wxWindows licence + */ + +#ifndef _WX_QT_DEFS_H_ +#define _WX_QT_DEFS_H_ + +#ifdef __cplusplus + +typedef class QWidget *WXWidget; + +#endif + +#endif /* _WX_QT_DEFS_H_ */ diff --git a/lib/wxWidgets/include/wx/qt/dialog.h b/lib/wxWidgets/include/wx/qt/dialog.h new file mode 100644 index 0000000..e5a5572 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/dialog.h @@ -0,0 +1,47 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/dialog.h +// Author: Peter Most, Javier Torres, Mariano Reingart, Sean D'Epagnier +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_DIALOG_H_ +#define _WX_QT_DIALOG_H_ + +#include "wx/dialog.h" +class QDialog; + +class WXDLLIMPEXP_CORE wxDialog : public wxDialogBase +{ +public: + wxDialog(); + wxDialog( wxWindow *parent, wxWindowID id, + const wxString &title, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString &name = wxASCII_STR(wxDialogNameStr) ); + + virtual ~wxDialog(); + + bool Create( wxWindow *parent, wxWindowID id, + const wxString &title, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString &name = wxASCII_STR(wxDialogNameStr) ); + + virtual int ShowModal() wxOVERRIDE; + virtual void EndModal(int retCode) wxOVERRIDE; + virtual bool IsModal() const wxOVERRIDE; + virtual bool Show(bool show = true) wxOVERRIDE; + + QDialog *GetDialogHandle() const; + +private: + + wxDECLARE_DYNAMIC_CLASS( wxDialog ); +}; + + +#endif // _WX_QT_DIALOG_H_ diff --git a/lib/wxWidgets/include/wx/qt/dirdlg.h b/lib/wxWidgets/include/wx/qt/dirdlg.h new file mode 100644 index 0000000..7f47474 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/dirdlg.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/dirdlg.h +// Author: Sean D'Epagnier +// Copyright: (c) 2014 Sean D'Epagnier +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_DIRDLG_H_ +#define _WX_QT_DIRDLG_H_ + +class QFileDialog; + +class WXDLLIMPEXP_CORE wxDirDialog : public wxDirDialogBase +{ +public: + wxDirDialog() { } + + wxDirDialog(wxWindow *parent, + const wxString& message = wxASCII_STR(wxDirSelectorPromptStr), + const wxString& defaultPath = wxEmptyString, + long style = wxDD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxString& name = wxASCII_STR(wxDirDialogNameStr)); + + bool Create(wxWindow *parent, + const wxString& message = wxASCII_STR(wxDirSelectorPromptStr), + const wxString& defaultPath = wxEmptyString, + long style = wxDD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxString& name = wxASCII_STR(wxDirDialogNameStr)); + +public: // overrides from wxGenericDirDialog + + wxString GetPath() const wxOVERRIDE; + void SetPath(const wxString& path) wxOVERRIDE; + +private: + + virtual QFileDialog *GetQFileDialog() const; + + wxDECLARE_DYNAMIC_CLASS(wxDirDialog); +}; + +#endif // _WX_QT_DIRDLG_H_ diff --git a/lib/wxWidgets/include/wx/qt/dnd.h b/lib/wxWidgets/include/wx/qt/dnd.h new file mode 100644 index 0000000..a2e595e --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/dnd.h @@ -0,0 +1,54 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/dnd.h +// Author: Peter Most +// Copyright: (c) Peter Most +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_DND_H_ +#define _WX_QT_DND_H_ + +#define wxDROP_ICON(name) wxCursor(name##_xpm) + +class WXDLLIMPEXP_CORE wxDropTarget : public wxDropTargetBase +{ +public: + wxDropTarget(wxDataObject *dataObject = NULL); + virtual ~wxDropTarget(); + + virtual bool OnDrop(wxCoord x, wxCoord y) wxOVERRIDE; + virtual wxDragResult OnData(wxCoord x, + wxCoord y, + wxDragResult def) wxOVERRIDE; + virtual bool GetData() wxOVERRIDE; + + wxDataFormat GetMatchingPair(); + + void ConnectTo(QWidget* widget); + void Disconnect(); + +private: + class Impl; + Impl* m_pImpl; +}; + +class WXDLLIMPEXP_CORE wxDropSource: public wxDropSourceBase +{ +public: + wxDropSource(wxWindow *win = NULL, + const wxCursor © = wxNullCursor, + const wxCursor &move = wxNullCursor, + const wxCursor &none = wxNullCursor); + + wxDropSource(wxDataObject& data, + wxWindow *win, + const wxCursor © = wxNullCursor, + const wxCursor &move = wxNullCursor, + const wxCursor &none = wxNullCursor); + + virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly) wxOVERRIDE; + +private: + wxWindow* m_parentWindow; +}; +#endif // _WX_QT_DND_H_ diff --git a/lib/wxWidgets/include/wx/qt/dvrenderer.h b/lib/wxWidgets/include/wx/qt/dvrenderer.h new file mode 100644 index 0000000..b1841fe --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/dvrenderer.h @@ -0,0 +1,32 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/dvrenderer.h +// Author: Peter Most +// Copyright: (c) Peter Most +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_DVRENDERER_H_ +#define _WX_QT_DVRENDERER_H_ + +// ---------------------------------------------------------------------------- +// wxDataViewRenderer +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewRenderer: public wxDataViewRendererBase +{ +public: + wxDataViewRenderer( const wxString &varianttype, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT ); + + virtual void SetMode( wxDataViewCellMode mode ); + virtual wxDataViewCellMode GetMode() const; + + virtual void SetAlignment( int align ); + virtual int GetAlignment() const; + + virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE); + virtual wxEllipsizeMode GetEllipsizeMode() const; +}; + +#endif // _WX_QT_DVRENDERER_H_ diff --git a/lib/wxWidgets/include/wx/qt/dvrenderers.h b/lib/wxWidgets/include/wx/qt/dvrenderers.h new file mode 100644 index 0000000..dc57dc3 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/dvrenderers.h @@ -0,0 +1,192 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/dvrenderers.h +// Author: Peter Most +// Copyright: (c) Peter Most +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_DVRENDERERS_H_ +#define _WX_QT_DVRENDERERS_H_ + +// --------------------------------------------------------- +// wxDataViewTextRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer +{ +public: + static wxString GetDefaultType() { return wxS("string"); } + + wxDataViewTextRenderer( const wxString &varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT ); + + bool SetValue( const wxVariant &value ); + bool GetValue( wxVariant &value ) const; + + void SetAlignment( int align ); +}; + +// --------------------------------------------------------- +// wxDataViewBitmapRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer +{ +public: + static wxString GetDefaultType() { return wxS("wxBitmapBundle"); } + + wxDataViewBitmapRenderer( const wxString &varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT ); + + bool SetValue( const wxVariant &value ); + bool GetValue( wxVariant &value ) const; + + bool IsCompatibleVariantType(const wxString& variantType) const; +}; + +// --------------------------------------------------------- +// wxDataViewToggleRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer +{ +public: + static wxString GetDefaultType() { return wxS("bool"); } + + wxDataViewToggleRenderer( const wxString &varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT ); + + bool SetValue( const wxVariant &value ); + bool GetValue( wxVariant &value ) const; +}; + +// --------------------------------------------------------- +// wxDataViewCustomRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewCustomRenderer: public wxDataViewRenderer +{ +public: + static wxString GetDefaultType() { return wxS("string"); } + + wxDataViewCustomRenderer( const wxString &varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT, + bool no_init = false ); + virtual ~wxDataViewCustomRenderer(); + + + virtual bool Render( wxRect cell, wxDC *dc, int state ) = 0; + + void RenderText( const wxString &text, int xoffset, wxRect cell, wxDC *dc, int state ); + + virtual wxSize GetSize() const = 0; + + virtual bool Activate( wxRect WXUNUSED(cell), + wxDataViewModel *WXUNUSED(model), const wxDataViewItem &WXUNUSED(item), unsigned int WXUNUSED(col) ) + { return false; } + + virtual bool LeftClick( wxPoint WXUNUSED(cursor), wxRect WXUNUSED(cell), + wxDataViewModel *WXUNUSED(model), const wxDataViewItem &WXUNUSED(item), unsigned int WXUNUSED(col) ) + { return false; } + virtual bool StartDrag( wxPoint WXUNUSED(cursor), wxRect WXUNUSED(cell), + wxDataViewModel *WXUNUSED(model), const wxDataViewItem &WXUNUSED(item), unsigned int WXUNUSED(col) ) + { return false; } + + // Create DC on request + virtual wxDC *GetDC(); +}; + +// --------------------------------------------------------- +// wxDataViewProgressRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewCustomRenderer +{ +public: + static wxString GetDefaultType() { return wxS("long"); } + + wxDataViewProgressRenderer( const wxString &label = wxEmptyString, + const wxString &varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT ); + virtual ~wxDataViewProgressRenderer(); + + bool SetValue( const wxVariant &value ); + bool GetValue( wxVariant &value ) const; + + virtual bool Render( wxRect cell, wxDC *dc, int state ); + virtual wxSize GetSize() const; +}; + +// --------------------------------------------------------- +// wxDataViewIconTextRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewCustomRenderer +{ +public: + static wxString GetDefaultType() { return wxS("wxDataViewIconText"); } + + wxDataViewIconTextRenderer( const wxString &varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, + int align = wxDVR_DEFAULT_ALIGNMENT ); + virtual ~wxDataViewIconTextRenderer(); + + bool SetValue( const wxVariant &value ); + bool GetValue( wxVariant &value ) const; + + virtual bool Render( wxRect cell, wxDC *dc, int state ); + virtual wxSize GetSize() const; + + virtual bool HasEditorCtrl() const { return true; } + virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ); + virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value ); +}; + +// --------------------------------------------------------- +// wxDataViewDateRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewCustomRenderer +{ +public: + static wxString GetDefaultType() { return wxS("datetime"); } + + wxDataViewDateRenderer( const wxString &varianttype = GetDefaultType(), + wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, + int align = wxDVR_DEFAULT_ALIGNMENT ); + + bool SetValue( const wxVariant &value ); + bool GetValue( wxVariant &value ) const; + + virtual bool Render( wxRect cell, wxDC *dc, int state ); + virtual wxSize GetSize() const; + virtual bool Activate( wxRect cell, + wxDataViewModel *model, const wxDataViewItem &item, unsigned int col ); + +}; + +// ------------------------------------- +// wxDataViewChoiceRenderer +// ------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewChoiceRenderer: public wxDataViewCustomRenderer +{ +public: + wxDataViewChoiceRenderer( const wxArrayString &choices, + wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, + int alignment = wxDVR_DEFAULT_ALIGNMENT ); + virtual bool Render( wxRect rect, wxDC *dc, int state ); + virtual wxSize GetSize() const; + virtual bool SetValue( const wxVariant &value ); + virtual bool GetValue( wxVariant &value ) const; + + void SetAlignment( int align ); +}; + +#endif // _WX_QT_DVRENDERERS_H_ + diff --git a/lib/wxWidgets/include/wx/qt/evtloop.h b/lib/wxWidgets/include/wx/qt/evtloop.h new file mode 100644 index 0000000..2fbac8a --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/evtloop.h @@ -0,0 +1,48 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/evtloop.h +// Author: Peter Most, Javier Torres, Mariano Reingart, Sean D'Epagnier +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_EVTLOOP_H_ +#define _WX_QT_EVTLOOP_H_ + +class wxQtIdleTimer; +class QEventLoop; + +class WXDLLIMPEXP_CORE wxQtEventLoopBase : public wxEventLoopBase +{ +public: + wxQtEventLoopBase(); + ~wxQtEventLoopBase(); + + virtual int DoRun() wxOVERRIDE; + virtual void ScheduleExit(int rc = 0) wxOVERRIDE; + virtual bool Pending() const wxOVERRIDE; + virtual bool Dispatch() wxOVERRIDE; + virtual int DispatchTimeout(unsigned long timeout) wxOVERRIDE; + virtual void WakeUp() wxOVERRIDE; + virtual void DoYieldFor(long eventsToProcess) wxOVERRIDE; + + void ScheduleIdleCheck(); + +private: + QEventLoop *m_qtEventLoop; + wxObjectDataPtr<wxQtIdleTimer> m_qtIdleTimer; + + wxDECLARE_NO_COPY_CLASS(wxQtEventLoopBase); +}; + + +#if wxUSE_GUI + +class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxQtEventLoopBase +{ +public: + wxGUIEventLoop(); +}; + +#endif // wxUSE_GUI + +#endif // _WX_QT_EVTLOOP_H_ diff --git a/lib/wxWidgets/include/wx/qt/filedlg.h b/lib/wxWidgets/include/wx/qt/filedlg.h new file mode 100644 index 0000000..cc48f71 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/filedlg.h @@ -0,0 +1,58 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/filedlg.h +// Author: Sean D'Epagnier +// Copyright: (c) 2014 Sean D'Epagnier +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_FILEDLG_H_ +#define _WX_QT_FILEDLG_H_ + +class QFileDialog; + +class WXDLLIMPEXP_CORE wxFileDialog : public wxFileDialogBase +{ +public: + wxFileDialog() { } + wxFileDialog(wxWindow *parent, + const wxString& message = wxASCII_STR(wxFileSelectorPromptStr), + const wxString& defaultDir = wxEmptyString, + const wxString& defaultFile = wxEmptyString, + const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + long style = wxFD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + const wxString& name = wxASCII_STR(wxFileDialogNameStr)); + bool Create(wxWindow *parent, + const wxString& message = wxASCII_STR(wxFileSelectorPromptStr), + const wxString& defaultDir = wxEmptyString, + const wxString& defaultFile = wxEmptyString, + const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), + long style = wxFD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + const wxString& name = wxASCII_STR(wxFileDialogNameStr)); + + virtual wxString GetPath() const wxOVERRIDE; + virtual void GetPaths(wxArrayString& paths) const wxOVERRIDE; + virtual wxString GetFilename() const wxOVERRIDE; + virtual void GetFilenames(wxArrayString& files) const wxOVERRIDE; + virtual int GetFilterIndex() const wxOVERRIDE; + + virtual void SetMessage(const wxString& message) wxOVERRIDE; + virtual void SetPath(const wxString& path) wxOVERRIDE; + virtual void SetDirectory(const wxString& dir) wxOVERRIDE; + virtual void SetFilename(const wxString& name) wxOVERRIDE; + virtual void SetWildcard(const wxString& wildCard) wxOVERRIDE; + virtual void SetFilterIndex(int filterIndex) wxOVERRIDE; + + virtual bool SupportsExtraControl() const wxOVERRIDE { return true; } + + virtual QFileDialog *GetQFileDialog() const; + +private: + + wxDECLARE_DYNAMIC_CLASS(wxFileDialog); +}; + +#endif // _WX_QT_FILEDLG_H_ diff --git a/lib/wxWidgets/include/wx/qt/font.h b/lib/wxWidgets/include/wx/qt/font.h new file mode 100644 index 0000000..a81bf16 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/font.h @@ -0,0 +1,90 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/font.h +// Author: Peter Most, Javier Torres, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_FONT_H_ +#define _WX_QT_FONT_H_ + +class QFont; +class WXDLLIMPEXP_CORE wxFont : public wxFontBase +{ +public: + wxFont(); + wxFont(const wxFontInfo& info); + wxFont(const wxString& nativeFontInfoString); + wxFont(const wxNativeFontInfo& info); + wxFont(const QFont& font); + wxFont(int size, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + wxFont(const wxSize& pixelSize, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + + wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants") + wxFont(int size, + int family, + int style, + int weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + + bool Create(wxSize size, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + + // accessors: get the font characteristics + virtual int GetPointSize() const wxOVERRIDE; + virtual double GetFractionalPointSize() const wxOVERRIDE; + virtual wxSize GetPixelSize() const wxOVERRIDE; + virtual wxFontStyle GetStyle() const wxOVERRIDE; + virtual int GetNumericWeight() const wxOVERRIDE; + virtual bool GetUnderlined() const wxOVERRIDE; + virtual wxString GetFaceName() const wxOVERRIDE; + virtual wxFontEncoding GetEncoding() const wxOVERRIDE; + virtual const wxNativeFontInfo *GetNativeFontInfo() const wxOVERRIDE; + virtual bool GetStrikethrough() const wxOVERRIDE; + + // change the font characteristics + virtual void SetFractionalPointSize(double pointSize) wxOVERRIDE; + virtual void SetPixelSize(const wxSize& pixelSize) wxOVERRIDE; + virtual void SetFamily( wxFontFamily family ) wxOVERRIDE; + virtual void SetStyle( wxFontStyle style ) wxOVERRIDE; + virtual void SetNumericWeight(int weight) wxOVERRIDE; + virtual bool SetFaceName(const wxString& facename) wxOVERRIDE; + virtual void SetUnderlined( bool underlined ) wxOVERRIDE; + virtual void SetStrikethrough(bool strikethrough) wxOVERRIDE; + virtual void SetEncoding(wxFontEncoding encoding) wxOVERRIDE; + + wxDECLARE_COMMON_FONT_METHODS(); + + virtual QFont GetHandle() const; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + virtual wxFontFamily DoGetFamily() const wxOVERRIDE; + virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info) wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxFont); + +}; + + +#endif // _WX_QT_FONT_H_ diff --git a/lib/wxWidgets/include/wx/qt/fontdlg.h b/lib/wxWidgets/include/wx/qt/fontdlg.h new file mode 100644 index 0000000..91113b2 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/fontdlg.h @@ -0,0 +1,30 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/fontdlg.h +// Author: Peter Most +// Copyright: (c) Peter Most +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_FONTDLG_H_ +#define _WX_QT_FONTDLG_H_ + +class QFontDialog; + +class WXDLLIMPEXP_CORE wxFontDialog : public wxFontDialogBase +{ +public: + wxFontDialog() { } + wxFontDialog(wxWindow *parent) { Create(parent); } + wxFontDialog(wxWindow *parent, const wxFontData& data) { Create(parent, data); } + +protected: + bool DoCreate(wxWindow *parent) wxOVERRIDE; + +private: + + wxFontData m_data; + + wxDECLARE_DYNAMIC_CLASS(wxFontDialog); +}; + +#endif // _WX_QT_FONTDLG_H_ diff --git a/lib/wxWidgets/include/wx/qt/frame.h b/lib/wxWidgets/include/wx/qt/frame.h new file mode 100644 index 0000000..fa674d9 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/frame.h @@ -0,0 +1,78 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/frame.h +// Purpose: wxFrame class interface +// Author: Peter Most +// Modified by: +// Created: 09.08.09 +// Copyright: (c) Peter Most +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_FRAME_H_ +#define _WX_QT_FRAME_H_ + +#include "wx/frame.h" + +class QMainWindow; +class QScrollArea; + +class WXDLLIMPEXP_CORE wxFrame : public wxFrameBase +{ +public: + wxFrame() { Init(); } + wxFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Init(); + + Create( parent, id, title, pos, size, style, name ); + } + virtual ~wxFrame(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + virtual void SetMenuBar(wxMenuBar *menubar) wxOVERRIDE; + virtual void SetStatusBar(wxStatusBar *statusBar ) wxOVERRIDE; + virtual void SetToolBar(wxToolBar *toolbar) wxOVERRIDE; + + virtual void SetWindowStyleFlag( long style ) wxOVERRIDE; + + virtual void AddChild( wxWindowBase *child ) wxOVERRIDE; + virtual void RemoveChild( wxWindowBase *child ) wxOVERRIDE; + + QMainWindow *GetQMainWindow() const; + virtual QScrollArea *QtGetScrollBarsContainer() const wxOVERRIDE; + +protected: + virtual void DoGetClientSize(int *width, int *height) const wxOVERRIDE; + virtual void DoSetClientSize(int width, int height) wxOVERRIDE; + + virtual QWidget* QtGetParentWidget() const wxOVERRIDE; + +private: + // Common part of all ctors. + void Init() + { + m_qtToolBar = NULL; + } + + + // Currently active native toolbar. + class QToolBar* m_qtToolBar; + + wxDECLARE_DYNAMIC_CLASS( wxFrame ); +}; + + +#endif // _WX_QT_FRAME_H_ diff --git a/lib/wxWidgets/include/wx/qt/gauge.h b/lib/wxWidgets/include/wx/qt/gauge.h new file mode 100644 index 0000000..810bcea --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/gauge.h @@ -0,0 +1,51 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/gauge.h +// Author: Peter Most, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_GAUGE_H_ +#define _WX_QT_GAUGE_H_ + +class QProgressBar; + +class WXDLLIMPEXP_CORE wxGauge : public wxGaugeBase +{ +public: + wxGauge(); + + wxGauge(wxWindow *parent, + wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxGaugeNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxGaugeNameStr)); + + virtual QWidget *GetHandle() const wxOVERRIDE; + + // set/get the control range + virtual void SetRange(int range) wxOVERRIDE; + virtual int GetRange() const wxOVERRIDE; + + virtual void SetValue(int pos) wxOVERRIDE; + virtual int GetValue() const wxOVERRIDE; + +private: + QProgressBar *m_qtProgressBar; + + wxDECLARE_DYNAMIC_CLASS(wxGauge); +}; + +#endif // _WX_QT_GAUGE_H_ diff --git a/lib/wxWidgets/include/wx/qt/glcanvas.h b/lib/wxWidgets/include/wx/qt/glcanvas.h new file mode 100644 index 0000000..743ef59 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/glcanvas.h @@ -0,0 +1,87 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/qt/glcanvas.cpp +// Author: Sean D'Epagnier +// Copyright: (c) Sean D'Epagnier 2014 +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GLCANVAS_H_ +#define _WX_GLCANVAS_H_ + +#include <GL/gl.h> + +class QGLWidget; +class QGLContext; +class QGLFormat; + +class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase +{ +public: + wxGLContext(wxGLCanvas *win, + const wxGLContext *other = NULL, + const wxGLContextAttrs *ctxAttrs = NULL); +/// virtual ~wxGLContext(); + + virtual bool SetCurrent(const wxGLCanvas& win) const wxOVERRIDE; + + wxDECLARE_CLASS(wxGLContext); +}; + +// ---------------------------------------------------------------------------- +// wxGLCanvas: OpenGL output window +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasBase +{ +public: + explicit // avoid implicitly converting a wxWindow* to wxGLCanvas + wxGLCanvas(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + + explicit + wxGLCanvas(wxWindow *parent, + wxWindowID id = wxID_ANY, + const int *attribList = NULL, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + + ~wxGLCanvas(); + + bool Create(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const int *attribList = NULL, + const wxPalette& palette = wxNullPalette); + + virtual bool SwapBuffers() wxOVERRIDE; + + static bool ConvertWXAttrsToQtGL(const int *wxattrs, QGLFormat &format); + +private: + +// wxDECLARE_EVENT_TABLE(); + wxDECLARE_CLASS(wxGLCanvas); +}; + +#endif // _WX_GLCANVAS_H_ diff --git a/lib/wxWidgets/include/wx/qt/listbox.h b/lib/wxWidgets/include/wx/qt/listbox.h new file mode 100644 index 0000000..2cdc98f --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/listbox.h @@ -0,0 +1,101 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/listbox.h +// Author: Peter Most, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_LISTBOX_H_ +#define _WX_QT_LISTBOX_H_ + +class QListWidget; +class QModelIndex; +class QScrollArea; + +class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase +{ +public: + wxListBox(); + wxListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + + wxListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + + virtual ~wxListBox(); + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + + virtual bool IsSelected(int n) const wxOVERRIDE; + virtual int GetSelections(wxArrayInt& aSelections) const wxOVERRIDE; + + virtual unsigned int GetCount() const wxOVERRIDE; + virtual wxString GetString(unsigned int n) const wxOVERRIDE; + virtual void SetString(unsigned int n, const wxString& s) wxOVERRIDE; + + virtual int GetSelection() const wxOVERRIDE; + + virtual QWidget *GetHandle() const wxOVERRIDE; + + void QtSendEvent(wxEventType evtType, int rowIndex, bool selected); + +protected: + virtual void DoSetFirstItem(int n) wxOVERRIDE; + + virtual void DoSetSelection(int n, bool select) wxOVERRIDE; + + virtual int DoInsertItems(const wxArrayStringsAdapter & items, + unsigned int pos, + void **clientData, + wxClientDataType type) wxOVERRIDE; + virtual int DoInsertOneItem(const wxString& item, unsigned int pos) wxOVERRIDE; + + virtual void DoSetItemClientData(unsigned int n, void *clientData) wxOVERRIDE; + virtual void *DoGetItemClientData(unsigned int n) const wxOVERRIDE; + + virtual void DoClear() wxOVERRIDE; + virtual void DoDeleteOneItem(unsigned int pos) wxOVERRIDE; + + virtual QScrollArea *QtGetScrollBarsContainer() const wxOVERRIDE; + +#if wxUSE_CHECKLISTBOX + bool m_hasCheckBoxes; +#endif // wxUSE_CHECKLISTBOX + + QListWidget *m_qtListWidget; + +private: + virtual void Init(); //common construction + + // Common part of both Create() overloads. + void DoCreate(wxWindow* parent, long style); + + void UnSelectAll(); + + wxDECLARE_DYNAMIC_CLASS(wxListBox); +}; + +#endif // _WX_QT_LISTBOX_H_ diff --git a/lib/wxWidgets/include/wx/qt/listctrl.h b/lib/wxWidgets/include/wx/qt/listctrl.h new file mode 100644 index 0000000..eefb5b4 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/listctrl.h @@ -0,0 +1,288 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/listctrl.h +// Author: Mariano Reingart, Peter Most +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_LISTCTRL_H_ +#define _WX_QT_LISTCTRL_H_ + +#include "wx/textctrl.h" + +class wxQtListTreeWidget; +class wxQtListModel; +class wxQtVirtualListModel; + +class WXDLLIMPEXP_CORE wxListCtrl: public wxListCtrlBase +{ +public: + wxListCtrl(); + + wxListCtrl(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxLC_ICON, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListCtrlNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxLC_ICON, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListCtrlNameStr)); + + virtual ~wxListCtrl(); + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + // Set the control colours + bool SetForegroundColour(const wxColour& col) wxOVERRIDE; + bool SetBackgroundColour(const wxColour& col) wxOVERRIDE; + + // Gets information about this column + bool GetColumn(int col, wxListItem& info) const wxOVERRIDE; + + // Sets information about this column + bool SetColumn(int col, const wxListItem& info) wxOVERRIDE; + + // Gets the column width + int GetColumnWidth(int col) const wxOVERRIDE; + + // Sets the column width + bool SetColumnWidth(int col, int width) wxOVERRIDE; + + + // Gets the column order from its index or index from its order + int GetColumnOrder(int col) const wxOVERRIDE; + int GetColumnIndexFromOrder(int order) const wxOVERRIDE; + + // Gets the column order for all columns + wxArrayInt GetColumnsOrder() const wxOVERRIDE; + + // Sets the column order for all columns + bool SetColumnsOrder(const wxArrayInt& orders) wxOVERRIDE; + + + // Gets the number of items that can fit vertically in the + // visible area of the list control (list or report view) + // or the total number of items in the list control (icon + // or small icon view) + int GetCountPerPage() const; + + // return the total area occupied by all the items (icon/small icon only) + wxRect GetViewRect() const; + + // Gets the edit control for editing labels. + wxTextCtrl* GetEditControl() const; + + // Gets information about the item + bool GetItem(wxListItem& info) const; + + // Sets information about the item + bool SetItem(wxListItem& info); + + // Sets a string field at a particular column + long SetItem(long index, int col, const wxString& label, int imageId = -1); + + // Gets the item state + int GetItemState(long item, long stateMask) const; + + // Sets the item state + bool SetItemState(long item, long state, long stateMask); + + // Sets the item image + bool SetItemImage(long item, int image, int selImage = -1); + bool SetItemColumnImage(long item, long column, int image); + + // Gets the item text + wxString GetItemText(long item, int col = 0) const; + + // Sets the item text + void SetItemText(long item, const wxString& str); + + // Gets the item data + wxUIntPtr GetItemData(long item) const; + + // Sets the item data + bool SetItemPtrData(long item, wxUIntPtr data); + bool SetItemData(long item, long data); + + // Gets the item rectangle + bool GetItemRect(long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const; + + // Gets the subitem rectangle in report mode + bool GetSubItemRect(long item, long subItem, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const; + + // Gets the item position + bool GetItemPosition(long item, wxPoint& pos) const; + + // Sets the item position + bool SetItemPosition(long item, const wxPoint& pos); + + // Gets the number of items in the list control + int GetItemCount() const wxOVERRIDE; + + // Gets the number of columns in the list control + int GetColumnCount() const wxOVERRIDE; + + // get the horizontal and vertical components of the item spacing + wxSize GetItemSpacing() const; + + // Foreground colour of an item. + void SetItemTextColour( long item, const wxColour& col); + wxColour GetItemTextColour( long item ) const; + + // Background colour of an item. + void SetItemBackgroundColour( long item, const wxColour &col); + wxColour GetItemBackgroundColour( long item ) const; + + // Font of an item. + void SetItemFont( long item, const wxFont &f); + wxFont GetItemFont( long item ) const; + + // Gets the number of selected items in the list control + int GetSelectedItemCount() const; + + // Gets the text colour of the listview + wxColour GetTextColour() const; + + // Sets the text colour of the listview + void SetTextColour(const wxColour& col); + + // Gets the index of the topmost visible item when in + // list or report view + long GetTopItem() const; + + virtual bool HasCheckBoxes() const wxOVERRIDE; + virtual bool EnableCheckBoxes(bool enable = true) wxOVERRIDE; + virtual bool IsItemChecked(long item) const wxOVERRIDE; + virtual void CheckItem(long item, bool check) wxOVERRIDE; + + // Add or remove a single window style + void SetSingleStyle(long style, bool add = true); + + // Set the whole window style + void SetWindowStyleFlag(long style) wxOVERRIDE; + + // Searches for an item, starting from 'item'. + // item can be -1 to find the first item that matches the + // specified flags. + // Returns the item or -1 if unsuccessful. + long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE) const; + + // refresh items selectively (only useful for virtual list controls) + void RefreshItem(long item); + void RefreshItems(long itemFrom, long itemTo); + + // Operations + //////////////////////////////////////////////////////////////////////////// + + // Arranges the items + bool Arrange(int flag = wxLIST_ALIGN_DEFAULT); + + // Deletes an item + bool DeleteItem(long item); + + // Deletes all items + bool DeleteAllItems(); + + // Deletes a column + bool DeleteColumn(int col) wxOVERRIDE; + + // Deletes all columns + bool DeleteAllColumns() wxOVERRIDE; + + // Clears items, and columns if there are any. + void ClearAll(); + + // Edit the label + wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl)); + + // End label editing, optionally cancelling the edit + bool EndEditLabel(bool cancel); + + // Ensures this item is visible + bool EnsureVisible(long item); + + // Find an item whose label matches this string, starting from the item after 'start' + // or the beginning if 'start' is -1. + long FindItem(long start, const wxString& str, bool partial = false); + + // Find an item whose data matches this data, starting from the item after 'start' + // or the beginning if 'start' is -1. + long FindItem(long start, wxUIntPtr data); + + // Find an item nearest this position in the specified direction, starting from + // the item after 'start' or the beginning if 'start' is -1. + long FindItem(long start, const wxPoint& pt, int direction); + + // Determines which item (if any) is at the specified point, + // giving details in 'flags' (see wxLIST_HITTEST_... flags above) + // Request the subitem number as well at the given coordinate. + long HitTest(const wxPoint& point, int& flags, long* ptrSubItem = NULL) const; + + // Inserts an item, returning the index of the new item if successful, + // -1 otherwise. + long InsertItem(const wxListItem& info); + + // Insert a string item + long InsertItem(long index, const wxString& label); + + // Insert an image item + long InsertItem(long index, int imageIndex); + + // Insert an image/string item + long InsertItem(long index, const wxString& label, int imageIndex); + + // set the number of items in a virtual list control + void SetItemCount(long count); + + // Scrolls the list control. If in icon, small icon or report view mode, + // x specifies the number of pixels to scroll. If in list view mode, x + // specifies the number of columns to scroll. + // If in icon, small icon or list view mode, y specifies the number of pixels + // to scroll. If in report view mode, y specifies the number of lines to scroll. + bool ScrollList(int dx, int dy); + + // Sort items. + + // fn is a function which takes 3 long arguments: item1, item2, data. + // item1 is the long data associated with a first item (NOT the index). + // item2 is the long data associated with a second item (NOT the index). + // data is the same value as passed to SortItems. + // The return value is a negative number if the first item should precede the second + // item, a positive number of the second item should precede the first, + // or zero if the two items are equivalent. + + // data is arbitrary data to be passed to the sort function. + bool SortItems(wxListCtrlCompare fn, wxIntPtr data); + + virtual QWidget *GetHandle() const wxOVERRIDE; + +protected: + void Init(); + + // Implement base class pure virtual methods. + virtual long DoInsertColumn(long col, const wxListItem& info) wxOVERRIDE; + void DoUpdateImages(int which) wxOVERRIDE; + + bool m_hasCheckBoxes; + +private: + // Allow access to OnGetItemXXX() method from the virtual model class. + friend class wxQtVirtualListModel; + + + wxQtListTreeWidget *m_qtTreeWidget; + wxQtListModel *m_model; + + wxDECLARE_DYNAMIC_CLASS( wxListCtrl ); +}; + +#endif + diff --git a/lib/wxWidgets/include/wx/qt/mdi.h b/lib/wxWidgets/include/wx/qt/mdi.h new file mode 100644 index 0000000..80756fd --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/mdi.h @@ -0,0 +1,83 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/mdi.h +// Author: Peter Most, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_MDI_H_ +#define _WX_QT_MDI_H_ + +class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase +{ +public: + wxMDIParentFrame(); + wxMDIParentFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + // override/implement base class [pure] virtual methods + // ---------------------------------------------------- + + static bool IsTDI() { return false; } + + virtual void ActivateNext() wxOVERRIDE; + virtual void ActivatePrevious() wxOVERRIDE; + +protected: + +private: + wxDECLARE_DYNAMIC_CLASS(wxMDIParentFrame); +}; + + + +class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxMDIChildFrameBase +{ +public: + wxMDIChildFrame(); + wxMDIChildFrame(wxMDIParentFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + bool Create(wxMDIParentFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + virtual void Activate() wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxMDIChildFrame); +}; + + + +class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase +{ +public: + wxMDIClientWindow(); + + virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL) wxOVERRIDE; + wxDECLARE_DYNAMIC_CLASS(wxMDIClientWindow); +}; + +#endif // _WX_QT_MDI_H_ diff --git a/lib/wxWidgets/include/wx/qt/menu.h b/lib/wxWidgets/include/wx/qt/menu.h new file mode 100644 index 0000000..cd747f2 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/menu.h @@ -0,0 +1,64 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/menu.h +// Author: Peter Most, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_MENU_H_ +#define _WX_QT_MENU_H_ + +class QMenu; +class QMenuBar; + +class WXDLLIMPEXP_CORE wxMenu : public wxMenuBase +{ +public: + wxMenu(long style = 0); + wxMenu(const wxString& title, long style = 0); + + virtual QMenu *GetHandle() const; + +protected: + virtual wxMenuItem *DoAppend(wxMenuItem *item) wxOVERRIDE; + virtual wxMenuItem *DoInsert(size_t pos, wxMenuItem *item) wxOVERRIDE; + virtual wxMenuItem *DoRemove(wxMenuItem *item) wxOVERRIDE; + +private: + QMenu *m_qtMenu; + + wxDECLARE_DYNAMIC_CLASS(wxMenu); +}; + + + +class WXDLLIMPEXP_CORE wxMenuBar : public wxMenuBarBase +{ +public: + wxMenuBar(); + wxMenuBar(long style); + wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0); + + virtual bool Append(wxMenu *menu, const wxString& title) wxOVERRIDE; + virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title) wxOVERRIDE; + virtual wxMenu *Remove(size_t pos) wxOVERRIDE; + + virtual void EnableTop(size_t pos, bool enable) wxOVERRIDE; + virtual bool IsEnabledTop(size_t pos) const wxOVERRIDE; + + virtual void SetMenuLabel(size_t pos, const wxString& label) wxOVERRIDE; + virtual wxString GetMenuLabel(size_t pos) const wxOVERRIDE; + + QMenuBar *GetQMenuBar() const { return m_qtMenuBar; } + virtual QWidget *GetHandle() const wxOVERRIDE; + + virtual void Attach(wxFrame *frame) wxOVERRIDE; + virtual void Detach() wxOVERRIDE; + +private: + QMenuBar *m_qtMenuBar; + + wxDECLARE_DYNAMIC_CLASS(wxMenuBar); +}; + +#endif // _WX_QT_MENU_H_ diff --git a/lib/wxWidgets/include/wx/qt/menuitem.h b/lib/wxWidgets/include/wx/qt/menuitem.h new file mode 100644 index 0000000..80887b5 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/menuitem.h @@ -0,0 +1,52 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/menuitem.h +// Author: Peter Most, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_MENUITEM_H_ +#define _WX_QT_MENUITEM_H_ + +#include "wx/menuitem.h" +#include "wx/bitmap.h" + +class QAction; +class wxQtAction; + +class WXDLLIMPEXP_FWD_CORE wxMenu; + +class WXDLLIMPEXP_CORE wxMenuItem : public wxMenuItemBase +{ +public: + wxMenuItem(wxMenu *parentMenu = NULL, + int id = wxID_SEPARATOR, + const wxString& text = wxEmptyString, + const wxString& help = wxEmptyString, + wxItemKind kind = wxITEM_NORMAL, + wxMenu *subMenu = NULL); + + virtual void SetItemLabel(const wxString& str) wxOVERRIDE; + virtual void SetCheckable(bool checkable) wxOVERRIDE; + + virtual void Enable(bool enable = true) wxOVERRIDE; + virtual bool IsEnabled() const wxOVERRIDE; + + virtual void Check(bool check = true) wxOVERRIDE; + virtual bool IsChecked() const wxOVERRIDE; + + virtual void SetBitmap(const wxBitmapBundle& bitmap) wxOVERRIDE; + + virtual QAction *GetHandle() const; + + virtual void SetFont(const wxFont& font); +private: + // Qt is using an action instead of a menu item. + wxQtAction *m_qtAction; + + wxDECLARE_DYNAMIC_CLASS( wxMenuItem ); +}; + + + +#endif // _WX_QT_MENUITEM_H_ diff --git a/lib/wxWidgets/include/wx/qt/minifram.h b/lib/wxWidgets/include/wx/qt/minifram.h new file mode 100644 index 0000000..c18b7ed --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/minifram.h @@ -0,0 +1,48 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/minifram.h +// Purpose: wxMiniFrame class +// Author: Mariano Reingart +// Copyright: (c) 2014 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MINIFRAM_H_ +#define _WX_MINIFRAM_H_ + +#include "wx/frame.h" + +class WXDLLIMPEXP_CORE wxMiniFrame : public wxFrame +{ +public: + wxMiniFrame() { } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + return wxFrame::Create(parent, id, title, pos, size, + style | wxFRAME_TOOL_WINDOW | wxFRAME_NO_TASKBAR, + name); + } + + wxMiniFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Create(parent, id, title, pos, size, style, name); + } + +protected: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMiniFrame); +}; + +#endif + // _WX_MINIFRAM_H_ diff --git a/lib/wxWidgets/include/wx/qt/msgdlg.h b/lib/wxWidgets/include/wx/qt/msgdlg.h new file mode 100644 index 0000000..63e9646 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/msgdlg.h @@ -0,0 +1,31 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/msgdlg.h +// Author: Peter Most, Javier Torres +// Copyright: (c) Peter Most, Javier Torres +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_MSGDLG_H_ +#define _WX_QT_MSGDLG_H_ + +#include "wx/msgdlg.h" + +class QMessageBox; + +class WXDLLIMPEXP_CORE wxMessageDialog : public wxMessageDialogBase +{ +public: + wxMessageDialog(wxWindow *parent, const wxString& message, + const wxString& caption = wxASCII_STR(wxMessageBoxCaptionStr), + long style = wxOK|wxCENTRE, + const wxPoint& pos = wxDefaultPosition); + virtual ~wxMessageDialog(); + + // Reimplemented to translate return codes from Qt to wx + virtual int ShowModal() wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMessageDialog); +}; + +#endif // _WX_QT_MSGDLG_H_ diff --git a/lib/wxWidgets/include/wx/qt/nonownedwnd.h b/lib/wxWidgets/include/wx/qt/nonownedwnd.h new file mode 100644 index 0000000..87df501 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/nonownedwnd.h @@ -0,0 +1,30 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/nonownedwnd.h +// Author: Sean D'Epagnier +// Copyright: (c) 2016 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_NONOWNEDWND_H_ +#define _WX_QT_NONOWNEDWND_H_ + +// ---------------------------------------------------------------------------- +// wxNonOwnedWindow contains code common to wx{Popup,TopLevel}Window in wxQT. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxNonOwnedWindowBase +{ +public: + wxNonOwnedWindow(); + +protected: + virtual bool DoClearShape() wxOVERRIDE; + virtual bool DoSetRegionShape(const wxRegion& region) wxOVERRIDE; +#if wxUSE_GRAPHICS_CONTEXT + virtual bool DoSetPathShape(const wxGraphicsPath& path) wxOVERRIDE; +#endif // wxUSE_GRAPHICS_CONTEXT + + wxDECLARE_NO_COPY_CLASS(wxNonOwnedWindow); +}; + +#endif // _WX_QT_NONOWNEDWND_H_ diff --git a/lib/wxWidgets/include/wx/qt/notebook.h b/lib/wxWidgets/include/wx/qt/notebook.h new file mode 100644 index 0000000..35e5db5 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/notebook.h @@ -0,0 +1,65 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/notebook.h +// Author: Peter Most, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_NOTEBOOK_H_ +#define _WX_QT_NOTEBOOK_H_ + +class QTabWidget; + +class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase +{ +public: + wxNotebook(); + wxNotebook(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxNotebookNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxNotebookNameStr)); + + virtual void SetPadding(const wxSize& padding) wxOVERRIDE; + virtual void SetTabSize(const wxSize& sz) wxOVERRIDE; + + virtual bool SetPageText(size_t n, const wxString& strText) wxOVERRIDE; + virtual wxString GetPageText(size_t n) const wxOVERRIDE; + + virtual int GetPageImage(size_t n) const wxOVERRIDE; + virtual bool SetPageImage(size_t n, int imageId) wxOVERRIDE; + + virtual bool InsertPage(size_t n, wxWindow *page, const wxString& text, + bool bSelect = false, int imageId = -1) wxOVERRIDE; + + virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const wxOVERRIDE; + + int SetSelection(size_t nPage) wxOVERRIDE; + int ChangeSelection(size_t nPage) wxOVERRIDE; + + virtual bool DeleteAllPages() wxOVERRIDE; + + virtual QWidget *GetHandle() const wxOVERRIDE; + +protected: + virtual wxWindow *DoRemovePage(size_t page) wxOVERRIDE; + +private: + QTabWidget *m_qtTabWidget; + + // internal array to store imageId for each page: + wxVector<int> m_images; + + wxDECLARE_DYNAMIC_CLASS( wxNotebook ); +}; + + +#endif // _WX_QT_NOTEBOOK_H_ diff --git a/lib/wxWidgets/include/wx/qt/palette.h b/lib/wxWidgets/include/wx/qt/palette.h new file mode 100644 index 0000000..23d221b --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/palette.h @@ -0,0 +1,31 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/palette.h +// Author: Peter Most +// Copyright: (c) Peter Most +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_PALETTE_H_ +#define _WX_QT_PALETTE_H_ + +class WXDLLIMPEXP_CORE wxPalette : public wxPaletteBase +{ +public: + wxPalette(); + wxPalette(int n, unsigned char *red, unsigned char *green, unsigned char *blue); + + bool Create(int n, unsigned char *red, unsigned char *green, unsigned char *blue); + + bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const; + int GetPixel(unsigned char red, unsigned char green, unsigned char blue) const; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxPalette); + +}; + +#endif // _WX_QT_PALETTE_H_ diff --git a/lib/wxWidgets/include/wx/qt/pen.h b/lib/wxWidgets/include/wx/qt/pen.h new file mode 100644 index 0000000..a095b0b --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/pen.h @@ -0,0 +1,57 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/pen.h +// Author: Peter Most, Javier Torres +// Copyright: (c) Peter Most, Javier Torres +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_PEN_H_ +#define _WX_QT_PEN_H_ + +class QPen; + +class WXDLLIMPEXP_CORE wxPen : public wxPenBase +{ +public: + wxPen(); + + wxPen( const wxColour &colour, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID ); + + wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") + wxPen(const wxColour& col, int width, int style); + + bool operator==(const wxPen& pen) const; + bool operator!=(const wxPen& pen) const; + + virtual void SetColour(const wxColour& col) wxOVERRIDE; + virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) wxOVERRIDE; + + virtual void SetWidth(int width) wxOVERRIDE; + virtual void SetStyle(wxPenStyle style) wxOVERRIDE; + virtual void SetStipple(const wxBitmap& stipple) wxOVERRIDE; + virtual void SetDashes(int nb_dashes, const wxDash *dash) wxOVERRIDE; + virtual void SetJoin(wxPenJoin join) wxOVERRIDE; + virtual void SetCap(wxPenCap cap) wxOVERRIDE; + + virtual wxColour GetColour() const wxOVERRIDE; + virtual wxBitmap *GetStipple() const wxOVERRIDE; + virtual wxPenStyle GetStyle() const wxOVERRIDE; + virtual wxPenJoin GetJoin() const wxOVERRIDE; + virtual wxPenCap GetCap() const wxOVERRIDE; + virtual int GetWidth() const wxOVERRIDE; + virtual int GetDashes(wxDash **ptr) const wxOVERRIDE; + + wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") + void SetStyle(int style) { SetStyle((wxPenStyle)style); } + + QPen GetHandle() const; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxPen); +}; + +#endif // _WX_QT_PEN_H_ diff --git a/lib/wxWidgets/include/wx/qt/popupwin.h b/lib/wxWidgets/include/wx/qt/popupwin.h new file mode 100644 index 0000000..d70ad92 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/popupwin.h @@ -0,0 +1,23 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/popupwin.h +// Author: Peter Most +// Copyright: (c) Peter Most +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_POPUPWIN_H_ +#define _WX_QT_POPUPWIN_H_ + +class WXDLLIMPEXP_CORE wxPopupWindow : public wxPopupWindowBase +{ +public: + wxPopupWindow(); + wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE); + +protected: + +private: + wxDECLARE_DYNAMIC_CLASS(wxPopupWindow); +}; + +#endif // _WX_QT_POPUPWIN_H_ diff --git a/lib/wxWidgets/include/wx/qt/printdlg.h b/lib/wxWidgets/include/wx/qt/printdlg.h new file mode 100644 index 0000000..93b62f5 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/printdlg.h @@ -0,0 +1,56 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/printdlg.h +// Author: Peter Most +// Copyright: (c) Peter Most +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_PRINTDLG_H_ +#define _WX_QT_PRINTDLG_H_ + +#include "wx/prntbase.h" +#include "wx/printdlg.h" + +class WXDLLIMPEXP_CORE wxQtPrintNativeData: public wxPrintNativeDataBase +{ +public: + wxQtPrintNativeData(); + + virtual bool TransferTo( wxPrintData &data ) wxOVERRIDE; + virtual bool TransferFrom( const wxPrintData &data ) wxOVERRIDE; + + virtual bool IsOk() const wxOVERRIDE; + +}; + +class WXDLLIMPEXP_CORE wxQtPrintDialog : public wxPrintDialogBase +{ +public: + wxQtPrintDialog(wxWindow *parent, wxPrintDialogData *data); + wxQtPrintDialog(wxWindow *parent, wxPrintData *data); + + virtual wxPrintDialogData& GetPrintDialogData() wxOVERRIDE; + virtual wxPrintData& GetPrintData() wxOVERRIDE; + virtual wxDC *GetPrintDC() wxOVERRIDE; + +protected: + +private: +}; + + + +class WXDLLIMPEXP_CORE wxQtPageSetupDialog: public wxPageSetupDialogBase +{ +public: + wxQtPageSetupDialog(); + wxQtPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = NULL); + + bool Create(wxWindow *parent, wxPageSetupDialogData *data = NULL); + + virtual wxPageSetupDialogData& GetPageSetupDialogData() wxOVERRIDE; + +private: +}; + +#endif // _WX_QT_PRINTDLG_H_ diff --git a/lib/wxWidgets/include/wx/qt/printqt.h b/lib/wxWidgets/include/wx/qt/printqt.h new file mode 100644 index 0000000..2e0e765 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/printqt.h @@ -0,0 +1,42 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/printqt.h +// Author: Peter Most +// Copyright: (c) Peter Most +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_PRINTQT_H_ +#define _WX_QT_PRINTQT_H_ + +#include "wx/prntbase.h" + +class WXDLLIMPEXP_CORE wxQtPrinter : public wxPrinterBase +{ +public: + wxQtPrinter( wxPrintDialogData *data = NULL ); + + virtual bool Setup(wxWindow *parent) wxOVERRIDE; + virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true) wxOVERRIDE; + virtual wxDC* PrintDialog(wxWindow *parent) wxOVERRIDE; +private: +}; + + + +class WXDLLIMPEXP_CORE wxQtPrintPreview : public wxPrintPreviewBase +{ +public: + wxQtPrintPreview(wxPrintout *printout, + wxPrintout *printoutForPrinting = NULL, + wxPrintDialogData *data = NULL); + wxQtPrintPreview(wxPrintout *printout, + wxPrintout *printoutForPrinting, + wxPrintData *data); + + virtual bool Print(bool interactive) wxOVERRIDE; + virtual void DetermineScaling() wxOVERRIDE; + +protected: +}; + +#endif // _WX_QT_PRINTQT_H_ diff --git a/lib/wxWidgets/include/wx/qt/private/converter.h b/lib/wxWidgets/include/wx/qt/private/converter.h new file mode 100644 index 0000000..fbb4250 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/private/converter.h @@ -0,0 +1,96 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/converter.h +// Purpose: Converter utility classes and functions +// Author: Peter Most, Kolya Kosenko +// Created: 02/28/10 +// Copyright: (c) Peter Most +// (c) 2010 Kolya Kosenko +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_CONVERTER_H_ +#define _WX_QT_CONVERTER_H_ + +#include "wx/defs.h" + +#include "wx/kbdstate.h" +#include "wx/gdicmn.h" +#include "wx/colour.h" + +#include <QtCore/QRect> +#include <QtCore/QSize> +#include <QtCore/QString> +#include <QtGui/QColor> + +// Rely on overloading and let the compiler pick the correct version, which makes +// them easier to use then to write wxQtConvertQtRectToWxRect() or wxQtConvertWxRectToQtRect() + +inline wxPoint wxQtConvertPoint( const QPoint &point ) +{ + return wxPoint( point.x(), point.y() ); +} +inline QPoint wxQtConvertPoint( const wxPoint &point ) +{ + return QPoint( point.x, point.y ); +} + +inline wxRect wxQtConvertRect( const QRect &rect ) +{ + return wxRect( rect.x(), rect.y(), rect.width(), rect.height() ); +} + +inline QRect wxQtConvertRect( const wxRect &rect ) +{ + return QRect( rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight() ); +} + +// TODO: Check whether QString::toStdString/QString::toStdWString might be faster + +inline wxString wxQtConvertString( const QString &str ) +{ + return wxString( str.toUtf8().data(), wxConvUTF8 ); +} + +inline QString wxQtConvertString( const wxString &str ) +{ + return QString( str.utf8_str() ); +} + +inline wxColour wxQtConvertColour(const QColor &colour) +{ + return wxColour(colour.red(), colour.green(), colour.blue(), colour.alpha()); +} + +inline QColor wxQtConvertColour(const wxColour &colour) +{ + return QColor(colour.Red(), colour.Green(), colour.Blue(), colour.Alpha()); +} + +#if wxUSE_DATETIME + +class WXDLLIMPEXP_FWD_BASE wxDateTime; +class QDate; + +wxDateTime wxQtConvertDate(const QDate& date); +QDate wxQtConvertDate(const wxDateTime& date); + +#endif // wxUSE_DATETIME + +inline wxSize wxQtConvertSize( const QSize &size ) +{ + return wxSize(size.width(), size.height()); +} +inline QSize wxQtConvertSize( const wxSize &size ) +{ + return QSize(size.GetWidth(), size.GetHeight()); +} + +Qt::Orientation wxQtConvertOrientation( long style, wxOrientation defaultOrientation ); +wxOrientation wxQtConvertOrientation( Qt::Orientation ); + +wxKeyCode wxQtConvertKeyCode( int key, Qt::KeyboardModifiers modifiers ); +void wxQtFillKeyboardModifiers( Qt::KeyboardModifiers modifiers, wxKeyboardState *state ); +int wxQtConvertKeyCode( int keyCode, int modifiers, Qt::KeyboardModifiers &qtmodifiers ); + +#endif // _WX_QT_CONVERTER_H_ + diff --git a/lib/wxWidgets/include/wx/qt/private/pointer.h b/lib/wxWidgets/include/wx/qt/private/pointer.h new file mode 100644 index 0000000..6079a66 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/private/pointer.h @@ -0,0 +1,43 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/private/pointer.h +// Author: Peter Most +// Copyright: (c) Peter Most +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_POINTER_H_ +#define _WX_QT_POINTER_H_ + +#include <QtCore/QPointer> + +// Extend QPointer with the ability to delete the object in its destructor. The +// normal behaviour of the QPointer makes sure that this is safe, because if somebody +// has deleted the object, then data() returns NULL and delete does nothing. + +template < typename T > +class wxQtPointer : public QPointer< T > +{ +public: + inline wxQtPointer() + : QPointer< T >() + { + } + + inline wxQtPointer( T *p ) + : QPointer< T >( p ) + { + } + + inline wxQtPointer< T > &operator = ( T *p ) + { + QPointer< T >::operator = ( p ); + return *this; + } + + inline ~wxQtPointer() + { + delete QPointer< T >::data(); + } +}; + +#endif // _WX_QT_POINTER_H_ diff --git a/lib/wxWidgets/include/wx/qt/private/timer.h b/lib/wxWidgets/include/wx/qt/private/timer.h new file mode 100644 index 0000000..ab04629 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/private/timer.h @@ -0,0 +1,39 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/timer.h +// Author: Javier Torres +// Copyright: (c) Javier Torres +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_TIMER_H_ +#define _WX_QT_TIMER_H_ + +#if wxUSE_TIMER + +#include <QtCore/QObject> +#include "wx/private/timer.h" + +//----------------------------------------------------------------------------- +// wxTimer +//----------------------------------------------------------------------------- + +class QTimerEvent; +class WXDLLIMPEXP_CORE wxQtTimerImpl : public wxTimerImpl, QObject +{ +public: + wxQtTimerImpl( wxTimer* timer ); + + virtual bool Start( int millisecs = -1, bool oneShot = false ) wxOVERRIDE; + virtual void Stop() wxOVERRIDE; + virtual bool IsRunning() const wxOVERRIDE; + +protected: + virtual void timerEvent( QTimerEvent * event ) wxOVERRIDE; + +private: + int m_timerId; +}; + +#endif // wxUSE_TIMER + +#endif // _WX_QT_TIMER_H_ diff --git a/lib/wxWidgets/include/wx/qt/private/treeitemdelegate.h b/lib/wxWidgets/include/wx/qt/private/treeitemdelegate.h new file mode 100644 index 0000000..632172f --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/private/treeitemdelegate.h @@ -0,0 +1,99 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/private/treeitemdelegate.h +// Purpose: Delegate to create text edit controls for the tree items +// Author: Matthew Griffin +// Created: 2019-05-29 +// Copyright: Matthew Griffin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_PRIVATE_TREEITEM_DELEGATE_H +#define _WX_QT_PRIVATE_TREEITEM_DELEGATE_H + +#include <QtWidgets/QStyledItemDelegate> +#include <QtWidgets/QToolTip> + +#include "wx/app.h" +#include "wx/textctrl.h" + +#include "treeitemfactory.h" + +class wxQTTreeItemDelegate : public QStyledItemDelegate +{ +public: + explicit wxQTTreeItemDelegate(wxWindow* parent) + : m_parent(parent), + m_textCtrl(NULL) + { + } + + QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &WXUNUSED(option), const QModelIndex &index) const wxOVERRIDE + { + if ( m_textCtrl != NULL ) + destroyEditor(m_textCtrl->GetHandle(), m_currentModelIndex); + + m_currentModelIndex = index; + m_textCtrl = new wxQtListTextCtrl(m_parent, parent); + m_textCtrl->SetFocus(); + return m_textCtrl->GetHandle(); + } + + void destroyEditor(QWidget *WXUNUSED(editor), const QModelIndex &WXUNUSED(index)) const wxOVERRIDE + { + if ( m_textCtrl != NULL ) + { + m_currentModelIndex = QModelIndex(); // invalidate the index + wxTheApp->ScheduleForDestruction(m_textCtrl); + m_textCtrl = NULL; + } + } + + void setModelData(QWidget *WXUNUSED(editor), QAbstractItemModel *WXUNUSED(model), const QModelIndex &WXUNUSED(index)) const wxOVERRIDE + { + // Don't set model data until wx has had a chance to send out events + } + + wxTextCtrl* GetEditControl() const + { + return m_textCtrl; + } + + QModelIndex GetCurrentModelIndex() const + { + return m_currentModelIndex; + } + + void AcceptModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const + { + QStyledItemDelegate::setModelData(editor, model, index); + } + + bool helpEvent(QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index) + { + if ( event->type() == QEvent::ToolTip ) + { + const QRect &itemRect = view->visualRect(index); + const QSize &bestSize = sizeHint(option, index); + if ( itemRect.width() < bestSize.width() ) + { + const QString &value = index.data(Qt::DisplayRole).toString(); + QToolTip::showText(event->globalPos(), value, view); + } + else + { + QToolTip::hideText(); + } + + return true; + } + + return QStyledItemDelegate::helpEvent(event, view, option, index); + } + +private: + wxWindow* m_parent; + mutable wxTextCtrl* m_textCtrl; + mutable QModelIndex m_currentModelIndex; +}; + +#endif // _WX_QT_PRIVATE_TREEITEM_DELEGATE_H diff --git a/lib/wxWidgets/include/wx/qt/private/treeitemfactory.h b/lib/wxWidgets/include/wx/qt/private/treeitemfactory.h new file mode 100644 index 0000000..c15cf19 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/private/treeitemfactory.h @@ -0,0 +1,122 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/private/treeitemfactory.h +// Purpose: Factory to create text edit controls for the tree items +// Author: Graham Dawes +// Created: 2019-02-07 +// Copyright: Graham Dawes +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_PRIVATE_TREEITEM_FACTORY_H_ +#define _WX_QT_PRIVATE_TREEITEM_FACTORY_H_ + +#include <QtWidgets/QItemEditorFactory> +#include <QtWidgets/QTreeWidget> +#include <QtWidgets/QItemDelegate> + +#include "wx/recguard.h" +#include "wx/textctrl.h" + +// wxQT Doesn't have a mechanism for "adopting" external widgets so we have to +// create an instance of wxTextCtrl rather than adopting the control QT would +// create. +// +// Unfortunately the factory is given an internal widget as the parent for +// editor. +// +// To work around these issues we create a wxTextCtl parented by the wxListCtrl +// then recalculate its position relative to the internal widget. + +class wxQtListTextCtrl : public wxTextCtrl +{ +public: + wxQtListTextCtrl(wxWindow* parent, QWidget* actualParent) + : wxTextCtrl(parent, wxID_ANY, wxEmptyString, + wxDefaultPosition, wxDefaultSize, + wxNO_BORDER), + m_actualParent(actualParent), + m_moving(0) + { + Bind(wxEVT_MOVE, &wxQtListTextCtrl::OnMove, this); + } + + void OnMove(wxMoveEvent &event) + { + // QWidget::move generates a QMoveEvent so we need to guard against + // reentrant calls. + wxRecursionGuard guard(m_moving); + + if ( guard.IsInside() ) + { + event.Skip(); + return; + } + + const QPoint eventPos = wxQtConvertPoint(event.GetPosition()); + const QPoint globalPos = m_actualParent->mapToGlobal(eventPos); + + // For some reason this always gives us the offset from the header info + // the internal control. So we need to treat this as an offset rather + // than a position. + QWidget* widget = GetHandle(); + const QPoint offset = widget->mapFromGlobal(globalPos); + + widget->move(eventPos + offset); + } + +private: + QWidget* m_actualParent; + wxRecursionGuardFlag m_moving; + + wxDECLARE_NO_COPY_CLASS(wxQtListTextCtrl); +}; + +// QT doesn't give us direct access to the editor within the QTreeWidget. +// Instead, we'll supply a factory to create the widget for QT and keep track +// of it ourselves. + +class wxQtTreeItemEditorFactory : public QItemEditorFactory +{ +public: + explicit wxQtTreeItemEditorFactory(wxWindow* parent) + : m_parent(parent), + m_textCtrl(NULL) + { + } + + void AttachTo(QTreeWidget *tree) + { + QAbstractItemDelegate* delegate = tree->itemDelegate(); + QItemDelegate *qItemDelegate = static_cast<QItemDelegate*>(delegate); + qItemDelegate->setItemEditorFactory(this); + } + + QWidget* createEditor(int WXUNUSED(userType), QWidget* parent) const wxOVERRIDE + { + if (m_textCtrl != NULL) + ClearEditor(); + + m_textCtrl = new wxQtListTextCtrl(m_parent, parent); + m_textCtrl->SetFocus(); + return m_textCtrl->GetHandle(); + } + + wxTextCtrl* GetEditControl() const + { + return m_textCtrl; + } + + void ClearEditor() const + { + delete m_textCtrl; + m_textCtrl = NULL; + } + +private: + wxWindow* m_parent; + mutable wxTextCtrl* m_textCtrl; + + wxDECLARE_NO_COPY_CLASS(wxQtTreeItemEditorFactory); +}; + +#endif //_WX_QT_PRIVATE_TREEITEM_FACTORY_H_ diff --git a/lib/wxWidgets/include/wx/qt/private/utils.h b/lib/wxWidgets/include/wx/qt/private/utils.h new file mode 100644 index 0000000..a91f03b --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/private/utils.h @@ -0,0 +1,27 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/utils.h +// Purpose: utility classes and/or functions +// Author: Peter Most, Javier Torres +// Created: 15/05/10 +// Copyright: (c) Peter Most, Javier Torres +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_UTILS_H_ +#define _WX_QT_UTILS_H_ + +#include "wx/mousestate.h" +#include <QtCore/Qt> + +void wxQtFillMouseButtons( Qt::MouseButtons buttons, wxMouseState *state ); + +void wxMissingImplementation( const char fileName[], unsigned lineNumber, + const char feature[] ); + +#define wxMISSING_IMPLEMENTATION( feature )\ + wxMissingImplementation( __FILE__, __LINE__, feature ) + +#define wxMISSING_FUNCTION() \ + wxMISSING_IMPLEMENTATION( __WXFUNCTION__ ) + +#endif // _WX_QT_UTILS_H_ diff --git a/lib/wxWidgets/include/wx/qt/private/winevent.h b/lib/wxWidgets/include/wx/qt/private/winevent.h new file mode 100644 index 0000000..54db552 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/private/winevent.h @@ -0,0 +1,461 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/qt/winevent_qt.h +// Purpose: QWidget to wxWindow event handler +// Author: Javier Torres, Peter Most +// Modified by: +// Created: 21.06.10 +// Copyright: (c) Javier Torres +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_EVENTSIGNALFORWARDER_H_ +#define _WX_QT_EVENTSIGNALFORWARDER_H_ + +#include <QtCore/QEvent> +#include <QtGui/QCloseEvent> + +#include "wx/log.h" +#include "wx/window.h" +#include "wx/qt/private/converter.h" +#include "wx/qt/private/utils.h" + +#include <QtWidgets/QGestureEvent> +#include <QtGui/QCursor> + +class QPaintEvent; + +template< typename Handler > +class wxQtSignalHandler +{ +protected: + wxQtSignalHandler( Handler *handler ) + { + m_handler = handler; + } + + void EmitEvent( wxEvent &event ) const + { + wxWindow *handler = GetHandler(); + event.SetEventObject( handler ); + handler->HandleWindowEvent( event ); + } + + virtual Handler *GetHandler() const + { + return m_handler; + } + +private: + Handler *m_handler; +}; + +template < typename Widget, typename Handler > +class wxQtEventSignalHandler : public Widget, public wxQtSignalHandler< Handler > +{ +public: + wxQtEventSignalHandler( wxWindow *parent, Handler *handler ) + : Widget( parent != NULL ? parent->GetHandle() : NULL ) + , wxQtSignalHandler< Handler >( handler ) + { + // Set immediately as it is used to check if wxWindow is alive + wxWindow::QtStoreWindowPointer( this, handler ); + + // Handle QWidget destruction signal AFTER it gets deleted + QObject::connect( this, &QObject::destroyed, this, + &wxQtEventSignalHandler::HandleDestroyedSignal ); + + Widget::setMouseTracking(true); + } + + void HandleDestroyedSignal() + { + } + + virtual Handler *GetHandler() const wxOVERRIDE + { + // Only process the signal / event if the wxWindow is not destroyed + if ( !wxWindow::QtRetrieveWindowPointer( this ) ) + { + return NULL; + } + else + return wxQtSignalHandler< Handler >::GetHandler(); + } + +protected: + /* Not implemented here: wxHelpEvent, wxIdleEvent wxJoystickEvent, + * wxMouseCaptureLostEvent, wxMouseCaptureChangedEvent, + * wxPowerEvent, wxScrollWinEvent, wxSysColourChangedEvent */ + + //wxActivateEvent + virtual void changeEvent ( QEvent * event ) wxOVERRIDE + { + if ( !this->GetHandler() ) + return; + + if ( !this->GetHandler()->QtHandleChangeEvent(this, event) ) + Widget::changeEvent(event); + else + event->accept(); + } + + //wxCloseEvent + virtual void closeEvent ( QCloseEvent * event ) wxOVERRIDE + { + if ( !this->GetHandler() ) + return; + + if ( !this->GetHandler()->QtHandleCloseEvent(this, event) ) + Widget::closeEvent(event); + else + event->ignore(); + } + + //wxContextMenuEvent + virtual void contextMenuEvent ( QContextMenuEvent * event ) wxOVERRIDE + { + if ( !this->GetHandler() ) + return; + + if ( !this->GetHandler()->QtHandleContextMenuEvent(this, event) ) + Widget::contextMenuEvent(event); + else + event->accept(); + } + + //wxDropFilesEvent + //virtual void dropEvent ( QDropEvent * event ) { } + + //wxMouseEvent + virtual void enterEvent ( QEvent * event ) wxOVERRIDE + { + if ( !this->GetHandler() ) + return; + + if ( !this->GetHandler()->QtHandleEnterEvent(this, event) ) + Widget::enterEvent(event); + else + event->accept(); + } + + //wxFocusEvent. + virtual void focusInEvent ( QFocusEvent * event ) wxOVERRIDE + { + if ( !this->GetHandler() ) + return; + + if ( !this->GetHandler()->QtHandleFocusEvent(this, event) ) + Widget::focusInEvent(event); + else + event->accept(); + } + + //wxFocusEvent. + virtual void focusOutEvent ( QFocusEvent * event ) wxOVERRIDE + { + if ( !this->GetHandler() ) + return; + + if ( !this->GetHandler()->QtHandleFocusEvent(this, event) ) + Widget::focusOutEvent(event); + else + event->accept(); + } + + //wxShowEvent + virtual void hideEvent ( QHideEvent * event ) wxOVERRIDE + { + if ( !this->GetHandler() ) + return; + + if ( !this->GetHandler()->QtHandleShowEvent(this, event) ) + Widget::hideEvent(event); + else + event->accept(); + } + + //wxKeyEvent + virtual void keyPressEvent ( QKeyEvent * event ) wxOVERRIDE + { + if ( !this->GetHandler() ) + return; + + if ( !this->GetHandler()->QtHandleKeyEvent(this, event) ) + Widget::keyPressEvent(event); + else + event->accept(); + } + + //wxKeyEvent + virtual void keyReleaseEvent ( QKeyEvent * event ) wxOVERRIDE + { + if ( !this->GetHandler() ) + return; + + if ( !this->GetHandler()->QtHandleKeyEvent(this, event) ) + Widget::keyReleaseEvent(event); + else + event->accept(); + } + + //wxMouseEvent + virtual void leaveEvent ( QEvent * event ) wxOVERRIDE + { + if ( !this->GetHandler() ) + return; + + if ( !this->GetHandler()->QtHandleEnterEvent(this, event) ) + Widget::leaveEvent(event); + else + event->accept(); + } + + //wxMouseEvent + virtual void mouseDoubleClickEvent ( QMouseEvent * event ) wxOVERRIDE + { + if ( !this->GetHandler() ) + return; + + if ( !this->GetHandler()->QtHandleMouseEvent(this, event) ) + Widget::mouseDoubleClickEvent(event); + else + event->accept(); + } + + //wxMouseEvent + virtual void mouseMoveEvent ( QMouseEvent * event ) wxOVERRIDE + { + if ( !this->GetHandler() ) + return; + + if ( !this->GetHandler()->QtHandleMouseEvent(this, event) ) + Widget::mouseMoveEvent(event); + else + event->accept(); + } + + //wxMouseEvent + virtual void mousePressEvent ( QMouseEvent * event ) wxOVERRIDE + { + if ( !this->GetHandler() ) + return; + + if ( !this->GetHandler()->QtHandleMouseEvent(this, event) ) + Widget::mousePressEvent(event); + else + event->accept(); + } + + //wxMouseEvent + virtual void mouseReleaseEvent ( QMouseEvent * event ) wxOVERRIDE + { + if ( !this->GetHandler() ) + return; + + if ( !this->GetHandler()->QtHandleMouseEvent(this, event) ) + Widget::mouseReleaseEvent(event); + else + event->accept(); + } + + //wxMoveEvent + virtual void moveEvent ( QMoveEvent * event ) wxOVERRIDE + { + if ( !this->GetHandler() ) + return; + + if ( !this->GetHandler()->QtHandleMoveEvent(this, event) ) + Widget::moveEvent(event); + else + event->accept(); + } + + //wxEraseEvent then wxPaintEvent + virtual void paintEvent ( QPaintEvent * event ) wxOVERRIDE + { + if ( !this->GetHandler() ) + return; + + if ( !this->GetHandler()->QtHandlePaintEvent(this, event) ) + Widget::paintEvent(event); + else + event->accept(); + } + + //wxSizeEvent + virtual void resizeEvent ( QResizeEvent * event ) wxOVERRIDE + { + if ( !this->GetHandler() ) + return; + + if ( !this->GetHandler()->QtHandleResizeEvent(this, event) ) + Widget::resizeEvent(event); + else + event->accept(); + } + + //wxShowEvent + virtual void showEvent ( QShowEvent * event ) wxOVERRIDE + { + if ( !this->GetHandler() ) + return; + + if ( !this->GetHandler()->QtHandleShowEvent(this, event) ) + Widget::showEvent(event); + else + event->accept(); + } + + //wxMouseEvent + virtual void wheelEvent ( QWheelEvent * event ) wxOVERRIDE + { + if ( !this->GetHandler() ) + return; + + if ( !this->GetHandler()->QtHandleWheelEvent(this, event) ) + Widget::wheelEvent(event); + else + event->accept(); + } + + /* Unused Qt events + virtual void actionEvent ( QActionEvent * event ) { } + virtual void dragEnterEvent ( QDragEnterEvent * event ) { } + virtual void dragLeaveEvent ( QDragLeaveEvent * event ) { } + virtual void dragMoveEvent ( QDragMoveEvent * event ) { } + virtual void inputMethodEvent ( QInputMethodEvent * event ) { } + virtual bool macEvent ( EventHandlerCallRef caller, EventRef event ) { } + virtual bool qwsEvent ( QWSEvent * event ) { } + virtual void tabletEvent ( QTabletEvent * event ) { } + virtual bool winEvent ( MSG * message, long * result ) { } + virtual bool x11Event ( XEvent * event ) { } */ + + virtual bool event(QEvent *event) + { + if (event->type() == QEvent::Gesture) + { + return gestureEvent(static_cast<QGestureEvent*>(event), event); + } + + return Widget::event(event); + } + + bool gestureEvent(QGestureEvent *gesture, QEvent *event) + { + if (QGesture *tah = gesture->gesture(Qt::TapAndHoldGesture)) + { + // Set the policy so that accepted gestures are taken by the first window that gets them + tah->setGestureCancelPolicy ( QGesture::CancelAllInContext ); + tapandholdTriggered(static_cast<QTapAndHoldGesture *>(tah), event); + } + + if (QGesture *pan = gesture->gesture(Qt::PanGesture)) + { + panTriggered(static_cast<QPanGesture *>(pan), event); + } + + if (QGesture *pinch = gesture->gesture(Qt::PinchGesture)) + { + pinchTriggered(static_cast<QPinchGesture *>(pinch), event); + } + + return true; + } + + void tapandholdTriggered(QTapAndHoldGesture *gesture, QEvent *event) + { + wxWindow *win = wxWindow::QtRetrieveWindowPointer( this ); + + if (gesture->state() == Qt::GestureFinished) + { + if ( win ) + { + wxLongPressEvent ev(win->GetId()); + ev.SetPosition( wxQtConvertPoint( gesture->position().toPoint() ) ); + + ev.SetGestureEnd(); + win->ProcessWindowEvent( ev ); + event->accept(); + } + + } + else if (gesture->state() == Qt::GestureStarted) + { + event->accept(); + } + else + { + event->accept(); + } + } + + void panTriggered(QPanGesture *gesture, QEvent *event) + { + wxWindow *win = wxWindow::QtRetrieveWindowPointer( this ); + + if (win) + { + wxPanGestureEvent evp(win->GetId()); + QPoint pos = QCursor::pos(); + evp.SetPosition( wxQtConvertPoint( pos ) ); + + QPoint offset = gesture->offset().toPoint(); + QPoint offset_last = gesture->lastOffset().toPoint(); + QPoint delta(offset.x() - offset_last.x(), offset.y() - offset_last.y()); + + evp.SetDelta( wxQtConvertPoint( delta ) ); + + switch(gesture->state()) + { + case Qt::GestureStarted: + evp.SetGestureStart(); + break; + case Qt::GestureFinished: + case Qt::GestureCanceled: + evp.SetGestureEnd(); + break; + default: + break; + } + + win->ProcessWindowEvent( evp ); + + event->accept(); + } + } + + void pinchTriggered(QPinchGesture *gesture, QEvent *event) + { + wxWindow *win = wxWindow::QtRetrieveWindowPointer( this ); + if (win) + { + + qreal this_sf = gesture->scaleFactor(); + QPoint center_point = gesture->centerPoint().toPoint(); + + wxZoomGestureEvent evp(win->GetId()); + evp.SetPosition( wxQtConvertPoint( center_point ) ); + evp.SetZoomFactor( this_sf); + + switch(gesture->state()) + { + case Qt::GestureStarted: + evp.SetGestureStart(); + break; + case Qt::GestureFinished: + case Qt::GestureCanceled: + evp.SetGestureEnd(); + break; + default: + break; + } + + win->ProcessWindowEvent( evp ); + + event->accept(); + + } + } +}; + +#endif diff --git a/lib/wxWidgets/include/wx/qt/radiobox.h b/lib/wxWidgets/include/wx/qt/radiobox.h new file mode 100644 index 0000000..1c56331 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/radiobox.h @@ -0,0 +1,97 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/radiobox.h +// Author: Peter Most, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_RADIOBOX_H_ +#define _WX_QT_RADIOBOX_H_ + +class QGroupBox; +class QButtonGroup; +class QGridLayout; + +class WXDLLIMPEXP_CORE wxRadioBox : public wxControl, public wxRadioBoxBase +{ +public: + wxRadioBox(); + + wxRadioBox(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + int majorDim = 0, + long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioBoxNameStr)); + + wxRadioBox(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, + long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioBoxNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + int majorDim = 0, + long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioBoxNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, + long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioBoxNameStr)); + + using wxWindowBase::Show; + using wxWindowBase::Enable; + using wxRadioBoxBase::GetDefaultBorder; + + virtual bool Enable(unsigned int n, bool enable = true) wxOVERRIDE; + virtual bool Enable(bool enable = true) wxOVERRIDE; + virtual bool Show(unsigned int n, bool show = true) wxOVERRIDE; + virtual bool Show(bool show = true) wxOVERRIDE; + virtual bool IsItemEnabled(unsigned int n) const wxOVERRIDE; + virtual bool IsItemShown(unsigned int n) const wxOVERRIDE; + + virtual unsigned int GetCount() const wxOVERRIDE; + virtual wxString GetString(unsigned int n) const wxOVERRIDE; + virtual void SetString(unsigned int n, const wxString& s) wxOVERRIDE; + + virtual void SetSelection(int n) wxOVERRIDE; + virtual int GetSelection() const wxOVERRIDE; + + virtual QWidget *GetHandle() const wxOVERRIDE; + +private: + // The 'visual' group box: + QGroupBox *m_qtGroupBox; + + // Handles the mutual exclusion of buttons: + QButtonGroup *m_qtButtonGroup; + + // Autofit layout for buttons (either vert. or horiz.): + QGridLayout *m_qtGridLayout; + + wxDECLARE_DYNAMIC_CLASS(wxRadioBox); +}; + +#endif // _WX_QT_RADIOBOX_H_ diff --git a/lib/wxWidgets/include/wx/qt/radiobut.h b/lib/wxWidgets/include/wx/qt/radiobut.h new file mode 100644 index 0000000..145b97a --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/radiobut.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/radiobut.h +// Author: Peter Most +// Copyright: (c) Peter Most +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_RADIOBUT_H_ +#define _WX_QT_RADIOBUT_H_ + +class QRadioButton; + +class WXDLLIMPEXP_CORE wxRadioButton : public wxRadioButtonBase +{ +public: + wxRadioButton(); + wxRadioButton( wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioButtonNameStr) ); + + bool Create( wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioButtonNameStr) ); + + virtual void SetValue(bool value) wxOVERRIDE; + virtual bool GetValue() const wxOVERRIDE; + + virtual QWidget *GetHandle() const wxOVERRIDE; + +private: + QRadioButton *m_qtRadioButton; + + wxDECLARE_DYNAMIC_CLASS( wxRadioButton ); +}; + +#endif // _WX_QT_RADIOBUT_H_ diff --git a/lib/wxWidgets/include/wx/qt/region.h b/lib/wxWidgets/include/wx/qt/region.h new file mode 100644 index 0000000..a308cb0 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/region.h @@ -0,0 +1,93 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/region.h +// Purpose: header for wxRegion +// Author: Peter Most, Javier Torres +// Copyright: (c) Peter Most, Javier Torres +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_REGION_H_ +#define _WX_QT_REGION_H_ + +class QRegion; +class QRect; +template<class T> class QVector; + +class WXDLLIMPEXP_CORE wxRegion : public wxRegionBase +{ +public: + wxRegion(); + wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h); + wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight); + wxRegion(const wxRect& rect); + wxRegion(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE); + wxRegion(const wxBitmap& bmp); + wxRegion(const wxBitmap& bmp, const wxColour& transp, int tolerance = 0); + + virtual bool IsEmpty() const wxOVERRIDE; + virtual void Clear() wxOVERRIDE; + + virtual const QRegion &GetHandle() const; + virtual void QtSetRegion(QRegion region); // Hangs on to this region + +protected: + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; + + virtual bool DoIsEqual(const wxRegion& region) const wxOVERRIDE; + virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const wxOVERRIDE; + virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const wxOVERRIDE; + virtual wxRegionContain DoContainsRect(const wxRect& rect) const wxOVERRIDE; + + virtual bool DoOffset(wxCoord x, wxCoord y) wxOVERRIDE; + + virtual bool DoUnionWithRect(const wxRect& rect) wxOVERRIDE; + virtual bool DoUnionWithRegion(const wxRegion& region) wxOVERRIDE; + + virtual bool DoIntersect(const wxRegion& region) wxOVERRIDE; + virtual bool DoSubtract(const wxRegion& region) wxOVERRIDE; + virtual bool DoXor(const wxRegion& region) wxOVERRIDE; + + virtual bool DoCombine(const wxRegion& rgn, wxRegionOp op); + +private: + wxDECLARE_DYNAMIC_CLASS(wxRegion); +}; + + + +class WXDLLIMPEXP_CORE wxRegionIterator: public wxObject +{ +public: + wxRegionIterator(); + wxRegionIterator(const wxRegion& region); + wxRegionIterator(const wxRegionIterator& ri); + ~wxRegionIterator(); + + wxRegionIterator& operator=(const wxRegionIterator& ri); + + void Reset(); + void Reset(const wxRegion& region); + + bool HaveRects() const; + operator bool () const; + + wxRegionIterator& operator ++ (); + wxRegionIterator operator ++ (int); + + wxCoord GetX() const; + wxCoord GetY() const; + wxCoord GetW() const; + wxCoord GetWidth() const; + wxCoord GetH() const; + wxCoord GetHeight() const; + wxRect GetRect() const; + +private: + QVector < QRect > *m_qtRects; + int m_pos; + + wxDECLARE_DYNAMIC_CLASS(wxRegionIterator); +}; + +#endif // _WX_QT_REGION_H_ diff --git a/lib/wxWidgets/include/wx/qt/scrolbar.h b/lib/wxWidgets/include/wx/qt/scrolbar.h new file mode 100644 index 0000000..3f90caf --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/scrolbar.h @@ -0,0 +1,55 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/scrolbar.h +// Author: Peter Most, Javier Torres, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_SCROLBAR_H_ +#define _WX_QT_SCROLBAR_H_ + +#include "wx/scrolbar.h" + +class QScrollBar; + +class WXDLLIMPEXP_FWD_CORE wxQtScrollBar; + +class WXDLLIMPEXP_CORE wxScrollBar : public wxScrollBarBase +{ +public: + wxScrollBar(); + wxScrollBar( wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSB_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxScrollBarNameStr) ); + + bool Create( wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSB_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxScrollBarNameStr) ); + + virtual int GetThumbPosition() const wxOVERRIDE; + virtual int GetThumbSize() const wxOVERRIDE; + virtual int GetPageSize() const wxOVERRIDE; + virtual int GetRange() const wxOVERRIDE; + + virtual void SetThumbPosition(int viewStart) wxOVERRIDE; + virtual void SetScrollbar(int position, int thumbSize, + int range, int pageSize, + bool refresh = true) wxOVERRIDE; + + QScrollBar *GetQScrollBar() const { return m_qtScrollBar; } + QWidget *GetHandle() const wxOVERRIDE; + +private: + QScrollBar *m_qtScrollBar; + + wxDECLARE_DYNAMIC_CLASS(wxScrollBar); +}; + + +#endif // _WX_QT_SCROLBAR_H_ diff --git a/lib/wxWidgets/include/wx/qt/slider.h b/lib/wxWidgets/include/wx/qt/slider.h new file mode 100644 index 0000000..5b6eeed --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/slider.h @@ -0,0 +1,61 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/slider.h +// Author: Peter Most, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_SLIDER_H_ +#define _WX_QT_SLIDER_H_ + +class QSlider; + +class WXDLLIMPEXP_CORE wxSlider : public wxSliderBase +{ +public: + wxSlider(); + wxSlider(wxWindow *parent, + wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxSliderNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxSliderNameStr)); + + virtual int GetValue() const wxOVERRIDE; + virtual void SetValue(int value) wxOVERRIDE; + + virtual void SetRange(int minValue, int maxValue) wxOVERRIDE; + virtual int GetMin() const wxOVERRIDE; + virtual int GetMax() const wxOVERRIDE; + + virtual void DoSetTickFreq(int freq) wxOVERRIDE; + virtual int GetTickFreq() const wxOVERRIDE; + + virtual void SetLineSize(int lineSize) wxOVERRIDE; + virtual void SetPageSize(int pageSize) wxOVERRIDE; + virtual int GetLineSize() const wxOVERRIDE; + virtual int GetPageSize() const wxOVERRIDE; + + virtual void SetThumbLength(int lenPixels) wxOVERRIDE; + virtual int GetThumbLength() const wxOVERRIDE; + + virtual QWidget *GetHandle() const wxOVERRIDE; + +private: + QSlider *m_qtSlider; + + wxDECLARE_DYNAMIC_CLASS( wxSlider ); +}; + +#endif // _WX_QT_SLIDER_H_ diff --git a/lib/wxWidgets/include/wx/qt/spinbutt.h b/lib/wxWidgets/include/wx/qt/spinbutt.h new file mode 100644 index 0000000..fe69e87 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/spinbutt.h @@ -0,0 +1,44 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/spinbutt.h +// Author: Peter Most, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_SPINBUTT_H_ +#define _WX_QT_SPINBUTT_H_ + +#include "wx/spinbutt.h" +class QSpinBox; + +class WXDLLIMPEXP_CORE wxSpinButton : public wxSpinButtonBase +{ +public: + wxSpinButton(); + wxSpinButton(wxWindow *parent, + wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_VERTICAL, + const wxString& name = wxSPIN_BUTTON_NAME); + + bool Create(wxWindow *parent, + wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_VERTICAL, + const wxString& name = wxSPIN_BUTTON_NAME); + + virtual int GetValue() const wxOVERRIDE; + virtual void SetValue(int val) wxOVERRIDE; + virtual void SetRange(int min, int max) wxOVERRIDE; + + virtual QWidget *GetHandle() const wxOVERRIDE; + +private: + QSpinBox *m_qtSpinBox; + + wxDECLARE_DYNAMIC_CLASS( wxSpinButton ); +}; + +#endif // _WX_QT_SPINBUTT_H_ diff --git a/lib/wxWidgets/include/wx/qt/spinctrl.h b/lib/wxWidgets/include/wx/qt/spinctrl.h new file mode 100644 index 0000000..c6f0ca5 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/spinctrl.h @@ -0,0 +1,128 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/spinctrl.h +// Author: Peter Most, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_SPINCTRL_H_ +#define _WX_QT_SPINCTRL_H_ + +class QSpinBox; +class QDoubleSpinBox; + +// Take advantage of the Qt compile time polymorphy and use a template to avoid +// copy&paste code for the usage of QSpinBox/QDoubleSpinBox. + +template < typename T, typename Widget > +class WXDLLIMPEXP_CORE wxSpinCtrlQt : public wxSpinCtrlBase +{ +public: + wxSpinCtrlQt(); + wxSpinCtrlQt( wxWindow *parent, wxWindowID id, const wxString& value, + const wxPoint& pos, const wxSize& size, long style, + T min, T max, T initial, T inc, + const wxString& name ); + + bool Create( wxWindow *parent, wxWindowID id, const wxString& value, + const wxPoint& pos, const wxSize& size, long style, + T min, T max, T initial, T inc, + const wxString& name ); + + virtual wxString GetTextValue() const wxOVERRIDE; + virtual void SetValue(const wxString&) wxOVERRIDE {} + + virtual void SetSnapToTicks(bool snap_to_ticks) wxOVERRIDE; + virtual bool GetSnapToTicks() const wxOVERRIDE; + + virtual void SetSelection(long from, long to) wxOVERRIDE; + + virtual void SetValue(T val); + void SetRange(T minVal, T maxVal); + void SetIncrement(T inc); + + T GetValue() const; + T GetMin() const; + T GetMax() const; + T GetIncrement() const; + + virtual QWidget *GetHandle() const wxOVERRIDE; + +protected: + Widget *m_qtSpinBox; + +}; + +class WXDLLIMPEXP_CORE wxSpinCtrl : public wxSpinCtrlQt< int, QSpinBox > +{ +public: + wxSpinCtrl(); + wxSpinCtrl(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + int min = 0, int max = 100, int initial = 0, + const wxString& name = wxT("wxSpinCtrl")); + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + int min = 0, int max = 100, int initial = 0, + const wxString& name = wxT("wxSpinCtrl")); + virtual int GetBase() const wxOVERRIDE { return m_base; } + virtual bool SetBase(int base) wxOVERRIDE; + virtual void SetValue(const wxString & val) wxOVERRIDE; + virtual void SetValue(int val) wxOVERRIDE { wxSpinCtrlQt<int,QSpinBox>::SetValue(val); } + +private: + // Common part of all ctors. + void Init() + { + m_base = 10; + } + int m_base; + wxDECLARE_DYNAMIC_CLASS(wxSpinCtrl); +}; + +class WXDLLIMPEXP_CORE wxSpinCtrlDouble : public wxSpinCtrlQt< double, QDoubleSpinBox > +{ +public: + wxSpinCtrlDouble(); + wxSpinCtrlDouble(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + double min = 0, double max = 100, double initial = 0, + double inc = 1, + const wxString& name = wxT("wxSpinCtrlDouble")); + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + double min = 0, double max = 100, double initial = 0, + double inc = 1, + const wxString& name = wxT("wxSpinCtrlDouble")); + + void SetDigits(unsigned digits); + unsigned GetDigits() const; + + virtual int GetBase() const wxOVERRIDE { return 10; } + virtual bool SetBase(int WXUNUSED(base)) wxOVERRIDE { return false; } + virtual void SetValue(const wxString & val) wxOVERRIDE; + virtual void SetValue(double val) wxOVERRIDE { wxSpinCtrlQt<double,QDoubleSpinBox>::SetValue(val); } + +private: + wxDECLARE_DYNAMIC_CLASS( wxSpinCtrlDouble ); +}; + +#endif // _WX_QT_SPINCTRL_H_ diff --git a/lib/wxWidgets/include/wx/qt/statbmp.h b/lib/wxWidgets/include/wx/qt/statbmp.h new file mode 100644 index 0000000..8abdd6b --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/statbmp.h @@ -0,0 +1,45 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/statbmp.h +// Author: Peter Most, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_STATBMP_H_ +#define _WX_QT_STATBMP_H_ + +class QLabel; + +class WXDLLIMPEXP_CORE wxStaticBitmap : public wxStaticBitmapBase +{ +public: + wxStaticBitmap(); + wxStaticBitmap( wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBitmapNameStr) ); + + bool Create( wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBitmapNameStr)); + + virtual void SetBitmap(const wxBitmapBundle& bitmap) wxOVERRIDE; + virtual wxBitmap GetBitmap() const wxOVERRIDE; + + virtual QWidget *GetHandle() const wxOVERRIDE; +protected: + +private: + QLabel *m_qtLabel; + + wxDECLARE_DYNAMIC_CLASS(wxStaticBitmap); +}; + +#endif // _WX_QT_STATBMP_H_ diff --git a/lib/wxWidgets/include/wx/qt/statbox.h b/lib/wxWidgets/include/wx/qt/statbox.h new file mode 100644 index 0000000..bec283f --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/statbox.h @@ -0,0 +1,47 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/statbox.h +// Author: Peter Most, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_STATBOX_H_ +#define _WX_QT_STATBOX_H_ + +class QGroupBox; + +class WXDLLIMPEXP_CORE wxStaticBox : public wxStaticBoxBase +{ +public: + wxStaticBox(); + + wxStaticBox(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBoxNameStr)); + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBoxNameStr)); + + virtual void GetBordersForSizer(int *borderTop, int *borderOther) const wxOVERRIDE; + + virtual QWidget *GetHandle() const wxOVERRIDE; + + virtual void SetLabel(const wxString& label) wxOVERRIDE; + virtual wxString GetLabel() const wxOVERRIDE; + +protected: + +private: + QGroupBox *m_qtGroupBox; + + wxDECLARE_DYNAMIC_CLASS( wxStaticBox ); +}; + +#endif // _WX_QT_STATBOX_H_ diff --git a/lib/wxWidgets/include/wx/qt/statline.h b/lib/wxWidgets/include/wx/qt/statline.h new file mode 100644 index 0000000..bab0b6b --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/statline.h @@ -0,0 +1,40 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/statline.h +// Author: Peter Most +// Copyright: (c) Peter Most +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_STATLINE_H_ +#define _WX_QT_STATLINE_H_ + +class QFrame; + +class WXDLLIMPEXP_CORE wxStaticLine : public wxStaticLineBase +{ +public: + wxStaticLine(); + + wxStaticLine( wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxASCII_STR(wxStaticLineNameStr) ); + + bool Create( wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxASCII_STR(wxStaticLineNameStr) ); + + virtual QWidget *GetHandle() const wxOVERRIDE; + +private: + QFrame *m_qtFrame; + + wxDECLARE_DYNAMIC_CLASS( wxStaticLine ); +}; + +#endif // _WX_QT_STATLINE_H_ diff --git a/lib/wxWidgets/include/wx/qt/stattext.h b/lib/wxWidgets/include/wx/qt/stattext.h new file mode 100644 index 0000000..c17202c --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/stattext.h @@ -0,0 +1,47 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/stattext.h +// Author: Peter Most, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_STATTEXT_H_ +#define _WX_QT_STATTEXT_H_ + +class QLabel; + +class WXDLLIMPEXP_CORE wxStaticText : public wxStaticTextBase +{ +public: + wxStaticText(); + wxStaticText(wxWindow *parent, + wxWindowID id, + const wxString &label, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxString &name = wxASCII_STR(wxStaticTextNameStr) ); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString &label, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxString &name = wxASCII_STR(wxStaticTextNameStr) ); + + virtual void SetLabel(const wxString& label) wxOVERRIDE; + + virtual QWidget *GetHandle() const wxOVERRIDE; + +protected: + virtual wxString WXGetVisibleLabel() const wxOVERRIDE; + virtual void WXSetVisibleLabel(const wxString& str) wxOVERRIDE; + +private: + QLabel *m_qtLabel; + + wxDECLARE_DYNAMIC_CLASS( wxStaticText ); +}; + +#endif // _WX_QT_STATTEXT_H_ diff --git a/lib/wxWidgets/include/wx/qt/statusbar.h b/lib/wxWidgets/include/wx/qt/statusbar.h new file mode 100644 index 0000000..710bf4f --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/statusbar.h @@ -0,0 +1,54 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/statusbar.h +// Author: Peter Most, Javier Torres, Mariano Reingart, Sean D'Epagnier +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_STATUSBAR_H_ +#define _WX_QT_STATUSBAR_H_ + +#include "wx/statusbr.h" + +class QLabel; +class QStatusBar; + +template < class T > class QList; + +class WXDLLIMPEXP_CORE wxStatusBar : public wxStatusBarBase +{ +public: + wxStatusBar(); + wxStatusBar(wxWindow *parent, wxWindowID winid = wxID_ANY, + long style = wxSTB_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxStatusBarNameStr)); + + bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY, + long style = wxSTB_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxStatusBarNameStr)); + + virtual bool GetFieldRect(int i, wxRect& rect) const wxOVERRIDE; + virtual void SetMinHeight(int height) wxOVERRIDE; + virtual int GetBorderX() const wxOVERRIDE; + virtual int GetBorderY() const wxOVERRIDE; + virtual void Refresh( bool eraseBackground = true, + const wxRect *rect = (const wxRect *) NULL ) wxOVERRIDE; + + QStatusBar *GetQStatusBar() const { return m_qtStatusBar; } + QWidget *GetHandle() const wxOVERRIDE; + +protected: + virtual void DoUpdateStatusText(int number) wxOVERRIDE; + +private: + void Init(); + void UpdateFields(); + + QStatusBar *m_qtStatusBar; + wxVector<QLabel*> m_qtPanes; + + wxDECLARE_DYNAMIC_CLASS(wxStatusBar); +}; + + +#endif // _WX_QT_STATUSBAR_H_ diff --git a/lib/wxWidgets/include/wx/qt/taskbar.h b/lib/wxWidgets/include/wx/qt/taskbar.h new file mode 100644 index 0000000..7362568 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/taskbar.h @@ -0,0 +1,35 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/taskbar.h +// Author: Peter Most +// Copyright: (c) Peter Most +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_TASKBAR_H_ +#define _WX_QT_TASKBAR_H_ + +class QSystemTrayIcon; + +class WXDLLIMPEXP_ADV wxTaskBarIcon : public wxTaskBarIconBase +{ +public: + wxTaskBarIcon(wxTaskBarIconType iconType = wxTBI_DEFAULT_TYPE); + virtual ~wxTaskBarIcon(); + + // Accessors + bool IsOk() const { return false; } + bool IsIconInstalled() const { return false; } + + // Operations + virtual bool SetIcon(const wxBitmapBundle& icon, + const wxString& tooltip = wxEmptyString) wxOVERRIDE; + virtual bool RemoveIcon() wxOVERRIDE; + virtual bool PopupMenu(wxMenu *menu) wxOVERRIDE; + +private: + QSystemTrayIcon *m_qtSystemTrayIcon; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTaskBarIcon); +}; + +#endif // _WX_QT_TASKBAR_H_ diff --git a/lib/wxWidgets/include/wx/qt/textctrl.h b/lib/wxWidgets/include/wx/qt/textctrl.h new file mode 100644 index 0000000..48a2e1c --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/textctrl.h @@ -0,0 +1,80 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/textctrl.h +// Author: Mariano Reingart, Peter Most +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_TEXTCTRL_H_ +#define _WX_QT_TEXTCTRL_H_ + +class QScrollArea; +class wxQtEdit; + +class WXDLLIMPEXP_CORE wxTextCtrl : public wxTextCtrlBase +{ +public: + wxTextCtrl(); + wxTextCtrl(wxWindow *parent, + wxWindowID id, + const wxString &value = wxEmptyString, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString &name = wxASCII_STR(wxTextCtrlNameStr)); + + virtual ~wxTextCtrl(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString &value = wxEmptyString, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString &name = wxASCII_STR(wxTextCtrlNameStr)); + + virtual int GetLineLength(long lineNo) const wxOVERRIDE; + virtual wxString GetLineText(long lineNo) const wxOVERRIDE; + virtual int GetNumberOfLines() const wxOVERRIDE; + + virtual bool IsModified() const wxOVERRIDE; + virtual void MarkDirty() wxOVERRIDE; + virtual void DiscardEdits() wxOVERRIDE; + + virtual bool SetStyle(long start, long end, const wxTextAttr& style) wxOVERRIDE; + virtual bool GetStyle(long position, wxTextAttr& style) wxOVERRIDE; + virtual bool SetDefaultStyle(const wxTextAttr& style) wxOVERRIDE; + + virtual long XYToPosition(long x, long y) const wxOVERRIDE; + virtual bool PositionToXY(long pos, long *x, long *y) const wxOVERRIDE; + + virtual void ShowPosition(long pos) wxOVERRIDE; + + virtual void SetInsertionPoint(long pos) wxOVERRIDE; + virtual long GetInsertionPoint() const wxOVERRIDE; + virtual void SetSelection( long from, long to ) wxOVERRIDE; + virtual void GetSelection(long *from, long *to) const wxOVERRIDE; + + virtual wxString DoGetValue() const wxOVERRIDE; + virtual void DoSetValue(const wxString &text, int flags = 0) wxOVERRIDE; + virtual void WriteText(const wxString& text) wxOVERRIDE; + + virtual QWidget *GetHandle() const wxOVERRIDE; + +protected: + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + virtual bool DoLoadFile(const wxString& file, int fileType) wxOVERRIDE; + virtual bool DoSaveFile(const wxString& file, int fileType) wxOVERRIDE; + + virtual QScrollArea *QtGetScrollBarsContainer() const wxOVERRIDE; + +private: + wxQtEdit *m_qtEdit; + + wxDECLARE_DYNAMIC_CLASS( wxTextCtrl ); +}; + +#endif // _WX_QT_TEXTCTRL_H_ diff --git a/lib/wxWidgets/include/wx/qt/textentry.h b/lib/wxWidgets/include/wx/qt/textentry.h new file mode 100644 index 0000000..d9287a2 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/textentry.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/textentry.h +// Author: Peter Most, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_TEXTENTRY_H_ +#define _WX_QT_TEXTENTRY_H_ + +class WXDLLIMPEXP_CORE wxTextEntry : public wxTextEntryBase +{ +public: + wxTextEntry(); + + virtual void WriteText(const wxString& text) wxOVERRIDE; + + virtual void Remove(long from, long to) wxOVERRIDE; + + virtual void Copy() wxOVERRIDE; + virtual void Cut() wxOVERRIDE; + virtual void Paste() wxOVERRIDE; + + virtual void Undo() wxOVERRIDE; + virtual void Redo() wxOVERRIDE; + virtual bool CanUndo() const wxOVERRIDE; + virtual bool CanRedo() const wxOVERRIDE; + + virtual void SetInsertionPoint(long pos) wxOVERRIDE; + virtual long GetInsertionPoint() const wxOVERRIDE; + virtual long GetLastPosition() const wxOVERRIDE; + + virtual void SetSelection(long from, long to) wxOVERRIDE; + virtual void GetSelection(long *from, long *to) const wxOVERRIDE; + + virtual bool IsEditable() const wxOVERRIDE; + virtual void SetEditable(bool editable) wxOVERRIDE; + +protected: + virtual wxString DoGetValue() const wxOVERRIDE; + virtual void DoSetValue(const wxString& value, int flags=0) wxOVERRIDE; + + virtual wxWindow *GetEditableWindow() wxOVERRIDE; +}; + +#endif // _WX_QT_TEXTENTRY_H_ diff --git a/lib/wxWidgets/include/wx/qt/tglbtn.h b/lib/wxWidgets/include/wx/qt/tglbtn.h new file mode 100644 index 0000000..31fb1e1 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/tglbtn.h @@ -0,0 +1,75 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/tglbtn.h +// Author: Peter Most, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_TGLBTN_H_ +#define _WX_QT_TGLBTN_H_ + +#include "wx/tglbtn.h" + + +class WXDLLIMPEXP_CORE wxToggleButton : public wxToggleButtonBase +{ +public: + wxToggleButton(); + wxToggleButton(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)); + + virtual void SetValue(bool state) wxOVERRIDE; + virtual bool GetValue() const wxOVERRIDE; + + // implementation only + virtual int QtGetEventType() const wxOVERRIDE { return wxEVT_TOGGLEBUTTON; } + +private: + wxDECLARE_DYNAMIC_CLASS(wxToggleButton); + +}; + + + +class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButton +{ +public: + wxBitmapToggleButton(); + wxBitmapToggleButton(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)); + + +private: + wxDECLARE_DYNAMIC_CLASS(wxBitmapToggleButton); + +}; + +#endif // _WX_QT_TGLBTN_H_ diff --git a/lib/wxWidgets/include/wx/qt/toolbar.h b/lib/wxWidgets/include/wx/qt/toolbar.h new file mode 100644 index 0000000..d2de81b --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/toolbar.h @@ -0,0 +1,85 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/toolbar.h +// Author: Sean D'Epagnier, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef _WX_QT_TOOLBAR_H_ +#define _WX_QT_TOOLBAR_H_ + +class QActionGroup; +class QToolBar; + +class WXDLLIMPEXP_CORE wxToolBar : public wxToolBarBase +{ +public: + + wxToolBar() { Init(); } + wxToolBar(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTB_DEFAULT_STYLE | wxNO_BORDER, + const wxString& name = wxASCII_STR(wxToolBarNameStr)) + { + Init(); + + Create(parent, id, pos, size, style, name); + } + + virtual ~wxToolBar(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTB_DEFAULT_STYLE | wxNO_BORDER, + const wxString& name = wxASCII_STR(wxToolBarNameStr)); + + virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const wxOVERRIDE; + + virtual void SetWindowStyleFlag( long style ) wxOVERRIDE; + + virtual void SetToolShortHelp(int id, const wxString& helpString) wxOVERRIDE; + virtual void SetToolNormalBitmap(int id, const wxBitmapBundle& bitmap) wxOVERRIDE; + virtual void SetToolDisabledBitmap(int id, const wxBitmapBundle& bitmap) wxOVERRIDE; + + virtual bool Realize() wxOVERRIDE; + + virtual wxToolBarToolBase *CreateTool(int toolid, + const wxString& label, + const wxBitmapBundle& bmpNormal, + const wxBitmapBundle& bmpDisabled = wxNullBitmap, + wxItemKind kind = wxITEM_NORMAL, + wxObject *clientData = NULL, + const wxString& shortHelp = wxEmptyString, + const wxString& longHelp = wxEmptyString) wxOVERRIDE; + + virtual wxToolBarToolBase *CreateTool(wxControl *control, + const wxString& label) wxOVERRIDE; + QWidget *GetHandle() const wxOVERRIDE; + + // Private, only used by wxFrame. + QToolBar *GetQToolBar() const { return m_qtToolBar; } + +protected: + QActionGroup* GetActionGroup(size_t pos); + virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE; + virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE; + virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable) wxOVERRIDE; + virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle) wxOVERRIDE; + virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle) wxOVERRIDE; + +private: + void Init(); + + long GetButtonStyle(); + + QToolBar *m_qtToolBar; + + wxDECLARE_DYNAMIC_CLASS(wxToolBar); +}; + +#endif // _WX_QT_TOOLBAR_H_ diff --git a/lib/wxWidgets/include/wx/qt/tooltip.h b/lib/wxWidgets/include/wx/qt/tooltip.h new file mode 100644 index 0000000..8f8bb23 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/tooltip.h @@ -0,0 +1,43 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/tooltip.h +// Author: Peter Most, Mariano Reingart +// Copyright: (c) 2010 wxWidgets dev team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_TOOLTIP_H_ +#define _WX_QT_TOOLTIP_H_ + +#include "wx/object.h" + +class WXDLLIMPEXP_FWD_CORE wxWindow; + +class WXDLLIMPEXP_CORE wxToolTip : public wxObject +{ +public: + // controlling tooltip behaviour: globally change tooltip parameters + // enable or disable the tooltips globally + static void Enable(bool flag); + // set the delay after which the tooltip appears + static void SetDelay(long milliseconds); + // set the delay after which the tooltip disappears or how long the + // tooltip remains visible + static void SetAutoPop(long milliseconds); + // set the delay between subsequent tooltips to appear + static void SetReshow(long milliseconds); + + wxToolTip(const wxString &tip); + + void SetTip(const wxString& tip); + const wxString& GetTip() const; + + // the window we're associated with + void SetWindow(wxWindow *win); + wxWindow *GetWindow() const { return m_window; } + +private: + wxString m_text; + wxWindow* m_window; // main window we're associated with +}; + +#endif // _WX_QT_TOOLTIP_H_ diff --git a/lib/wxWidgets/include/wx/qt/toplevel.h b/lib/wxWidgets/include/wx/qt/toplevel.h new file mode 100644 index 0000000..32fb580 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/toplevel.h @@ -0,0 +1,50 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/toplevel.h +// Purpose: declares wxTopLevelWindowNative class +// Author: Peter Most, Javier Torres, Mariano Reingart +// Copyright: (c) 2009 wxWidgets dev team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_TOPLEVEL_H_ +#define _WX_QT_TOPLEVEL_H_ + +class WXDLLIMPEXP_CORE wxTopLevelWindowQt : public wxTopLevelWindowBase +{ +public: + wxTopLevelWindowQt(); + wxTopLevelWindowQt(wxWindow *parent, + wxWindowID winid, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + virtual bool Show(bool show = true) wxOVERRIDE; + virtual void Maximize(bool maximize = true) wxOVERRIDE; + virtual void Restore() wxOVERRIDE; + virtual void Iconize(bool iconize = true) wxOVERRIDE; + virtual bool IsMaximized() const wxOVERRIDE; + virtual bool IsIconized() const wxOVERRIDE; + + virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) wxOVERRIDE; + virtual bool IsFullScreen() const wxOVERRIDE; + virtual void SetTitle(const wxString& title) wxOVERRIDE; + virtual wxString GetTitle() const wxOVERRIDE; + virtual void SetIcons(const wxIconBundle& icons) wxOVERRIDE; + + // Styles + virtual void SetWindowStyleFlag( long style ) wxOVERRIDE; + virtual long GetWindowStyleFlag() const wxOVERRIDE; +}; + +#endif // _WX_QT_TOPLEVEL_H_ diff --git a/lib/wxWidgets/include/wx/qt/treectrl.h b/lib/wxWidgets/include/wx/qt/treectrl.h new file mode 100644 index 0000000..9744243 --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/treectrl.h @@ -0,0 +1,150 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/treectrl.h +// Author: Peter Most +// Copyright: (c) Peter Most +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_TREECTRL_H_ +#define _WX_QT_TREECTRL_H_ + +class wxQTreeWidget; + +class WXDLLIMPEXP_CORE wxTreeCtrl : public wxTreeCtrlBase +{ +public: + wxTreeCtrl(); + wxTreeCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxTreeCtrlNameStr)); + + virtual ~wxTreeCtrl(); + + bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxTreeCtrlNameStr)); + + virtual unsigned int GetCount() const wxOVERRIDE; + + virtual unsigned int GetIndent() const wxOVERRIDE; + virtual void SetIndent(unsigned int indent) wxOVERRIDE; + + virtual void SetImageList(wxImageList *imageList) wxOVERRIDE; + virtual void SetStateImageList(wxImageList *imageList) wxOVERRIDE; + + virtual wxString GetItemText(const wxTreeItemId& item) const wxOVERRIDE; + virtual int GetItemImage(const wxTreeItemId& item, + wxTreeItemIcon which = wxTreeItemIcon_Normal) const wxOVERRIDE; + virtual wxTreeItemData *GetItemData(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxColour GetItemTextColour(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxColour GetItemBackgroundColour(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxFont GetItemFont(const wxTreeItemId& item) const wxOVERRIDE; + + virtual void SetItemText(const wxTreeItemId& item, const wxString& text) wxOVERRIDE; + virtual void SetItemImage(const wxTreeItemId& item, + int image, + wxTreeItemIcon which = wxTreeItemIcon_Normal) wxOVERRIDE; + virtual void SetItemData(const wxTreeItemId& item, wxTreeItemData *data) wxOVERRIDE; + virtual void SetItemHasChildren(const wxTreeItemId& item, bool has = true) wxOVERRIDE; + virtual void SetItemBold(const wxTreeItemId& item, bool bold = true) wxOVERRIDE; + virtual void SetItemDropHighlight(const wxTreeItemId& item, bool highlight = true) wxOVERRIDE; + virtual void SetItemTextColour(const wxTreeItemId& item, const wxColour& col) wxOVERRIDE; + virtual void SetItemBackgroundColour(const wxTreeItemId& item, const wxColour& col) wxOVERRIDE; + virtual void SetItemFont(const wxTreeItemId& item, const wxFont& font) wxOVERRIDE; + + virtual bool IsVisible(const wxTreeItemId& item) const wxOVERRIDE; + virtual bool ItemHasChildren(const wxTreeItemId& item) const wxOVERRIDE; + virtual bool IsExpanded(const wxTreeItemId& item) const wxOVERRIDE; + virtual bool IsSelected(const wxTreeItemId& item) const wxOVERRIDE; + virtual bool IsBold(const wxTreeItemId& item) const wxOVERRIDE; + + virtual size_t GetChildrenCount(const wxTreeItemId& item, bool recursively = true) const wxOVERRIDE; + + virtual wxTreeItemId GetRootItem() const wxOVERRIDE; + virtual wxTreeItemId GetSelection() const wxOVERRIDE; + virtual size_t GetSelections(wxArrayTreeItemIds& selections) const wxOVERRIDE; + + virtual void SetFocusedItem(const wxTreeItemId& item) wxOVERRIDE; + virtual void ClearFocusedItem() wxOVERRIDE; + virtual wxTreeItemId GetFocusedItem() const wxOVERRIDE; + + virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxTreeItemId GetFirstChild(const wxTreeItemId& item, wxTreeItemIdValue& cookie) const wxOVERRIDE; + virtual wxTreeItemId GetNextChild(const wxTreeItemId& item, wxTreeItemIdValue& cookie) const wxOVERRIDE; + virtual wxTreeItemId GetLastChild(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxTreeItemId GetNextSibling(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxTreeItemId GetFirstVisibleItem() const wxOVERRIDE; + virtual wxTreeItemId GetNextVisible(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const wxOVERRIDE; + + virtual wxTreeItemId AddRoot(const wxString& text, + int image = -1, int selImage = -1, + wxTreeItemData *data = NULL) wxOVERRIDE; + + virtual void Delete(const wxTreeItemId& item) wxOVERRIDE; + virtual void DeleteChildren(const wxTreeItemId& item) wxOVERRIDE; + virtual void DeleteAllItems() wxOVERRIDE; + + virtual void Expand(const wxTreeItemId& item) wxOVERRIDE; + virtual void Collapse(const wxTreeItemId& item) wxOVERRIDE; + virtual void CollapseAndReset(const wxTreeItemId& item) wxOVERRIDE; + virtual void Toggle(const wxTreeItemId& item) wxOVERRIDE; + + virtual void Unselect() wxOVERRIDE; + virtual void UnselectAll() wxOVERRIDE; + virtual void SelectItem(const wxTreeItemId& item, bool select = true) wxOVERRIDE; + virtual void SelectChildren(const wxTreeItemId& parent) wxOVERRIDE; + + virtual void EnsureVisible(const wxTreeItemId& item) wxOVERRIDE; + virtual void ScrollTo(const wxTreeItemId& item) wxOVERRIDE; + + virtual wxTextCtrl *EditLabel(const wxTreeItemId& item, wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl)) wxOVERRIDE; + virtual wxTextCtrl *GetEditControl() const wxOVERRIDE; + virtual void EndEditLabel(const wxTreeItemId& item, bool discardChanges = false) wxOVERRIDE; + + virtual void SortChildren(const wxTreeItemId& item) wxOVERRIDE; + + virtual bool GetBoundingRect(const wxTreeItemId& item, wxRect& rect, bool textOnly = false) const wxOVERRIDE; + + virtual void SetWindowStyleFlag(long styles) wxOVERRIDE; + + virtual QWidget *GetHandle() const wxOVERRIDE; + +protected: + virtual int DoGetItemState(const wxTreeItemId& item) const wxOVERRIDE; + virtual void DoSetItemState(const wxTreeItemId& item, int state) wxOVERRIDE; + + virtual wxTreeItemId DoInsertItem(const wxTreeItemId& parent, + size_t pos, + const wxString& text, + int image, int selImage, + wxTreeItemData *data) wxOVERRIDE; + + virtual wxTreeItemId DoInsertAfter(const wxTreeItemId& parent, + const wxTreeItemId& idPrevious, + const wxString& text, + int image = -1, int selImage = -1, + wxTreeItemData *data = NULL) wxOVERRIDE; + + virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, int& flags) const wxOVERRIDE; + + virtual void OnImagesChanged() wxOVERRIDE; + +private: + void SendDeleteEvent(const wxTreeItemId &item); + wxTreeItemId GetNext(const wxTreeItemId &item) const; + + void DoUpdateIconsSize(wxImageList *imageList); + + wxQTreeWidget *m_qtTreeWidget; + wxDECLARE_DYNAMIC_CLASS(wxTreeCtrl); +}; + +#endif // _WX_QT_TREECTRL_H_ diff --git a/lib/wxWidgets/include/wx/qt/window.h b/lib/wxWidgets/include/wx/qt/window.h new file mode 100644 index 0000000..2f4d26a --- /dev/null +++ b/lib/wxWidgets/include/wx/qt/window.h @@ -0,0 +1,259 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/qt/window.h +// Purpose: wxWindow class +// Author: Peter Most, Javier Torres, Mariano Reingart +// Copyright: (c) 2009 wxWidgets dev team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QT_WINDOW_H_ +#define _WX_QT_WINDOW_H_ + +class QShortcut; +template < class T > class QList; + +class QWidget; +class QScrollArea; +class QScrollBar; +class QPicture; +class QPainter; + +class QPaintEvent; +class QResizeEvent; +class QWheelEvent; +class QKeyEvent; +class QMouseEvent; +class QEvent; +class QMoveEvent; +class QEvent; +class QEvent; +class QCloseEvent; +class QContextMenuEvent; +class QFocusEvent; + +class WXDLLIMPEXP_FWD_CORE wxScrollBar; +class WXDLLIMPEXP_FWD_CORE wxQtShortcutHandler; + +/* wxQt specific notes: + * + * Remember to implement the Qt object getters on all subclasses: + * - GetHandle() returns the Qt object + * - QtGetScrollBarsContainer() returns the widget where scrollbars are placed + * For example, for wxFrame, GetHandle() is the QMainWindow, + * QtGetScrollBarsContainer() is the central widget and QtGetContainer() is a widget + * in a layout inside the central widget that also contains the scrollbars. + * Return 0 from QtGetScrollBarsContainer() to disable SetScrollBar() and friends + * for wxWindow subclasses. + * + * + * Event handling is achieved by using the template class wxQtEventForwarder + * found in winevent_qt.(h|cpp) to send all Qt events here to QtHandleXXXEvent() + * methods. All these methods receive the Qt event and the handler. This is + * done because events of the containers (the scrolled part of the window) are + * sent to the same wxWindow instance, that must be able to differentiate them + * as some events need different handling (paintEvent) depending on that. + * We pass the QWidget pointer to all event handlers for consistency. + */ +class WXDLLIMPEXP_CORE wxWindowQt : public wxWindowBase +{ +public: + wxWindowQt(); + ~wxWindowQt(); + wxWindowQt(wxWindowQt *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)); + + bool Create(wxWindowQt *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)); + + // Used by all window classes in the widget creation process. + void PostCreation( bool generic = true ); + + void AddChild( wxWindowBase *child ) wxOVERRIDE; + + virtual bool Show( bool show = true ) wxOVERRIDE; + + virtual void SetLabel(const wxString& label) wxOVERRIDE; + virtual wxString GetLabel() const wxOVERRIDE; + + virtual void DoEnable( bool enable ) wxOVERRIDE; + virtual void SetFocus() wxOVERRIDE; + + // Parent/Child: + static void QtReparent( QWidget *child, QWidget *parent ); + virtual bool Reparent( wxWindowBase *newParent ) wxOVERRIDE; + + // Z-order + virtual void Raise() wxOVERRIDE; + virtual void Lower() wxOVERRIDE; + + // move the mouse to the specified position + virtual void WarpPointer(int x, int y) wxOVERRIDE; + + virtual void Update() wxOVERRIDE; + virtual void Refresh( bool eraseBackground = true, + const wxRect *rect = (const wxRect *) NULL ) wxOVERRIDE; + + virtual bool SetCursor( const wxCursor &cursor ) wxOVERRIDE; + virtual bool SetFont(const wxFont& font) wxOVERRIDE; + + // get the (average) character size for the current font + virtual int GetCharHeight() const wxOVERRIDE; + virtual int GetCharWidth() const wxOVERRIDE; + + virtual void SetScrollbar( int orient, + int pos, + int thumbvisible, + int range, + bool refresh = true ) wxOVERRIDE; + virtual void SetScrollPos( int orient, int pos, bool refresh = true ) wxOVERRIDE; + virtual int GetScrollPos( int orient ) const wxOVERRIDE; + virtual int GetScrollThumb( int orient ) const wxOVERRIDE; + virtual int GetScrollRange( int orient ) const wxOVERRIDE; + + // scroll window to the specified position + virtual void ScrollWindow( int dx, int dy, + const wxRect* rect = NULL ) wxOVERRIDE; + + // Styles + virtual void SetWindowStyleFlag( long style ) wxOVERRIDE; + virtual void SetExtraStyle( long exStyle ) wxOVERRIDE; + + virtual bool SetBackgroundStyle(wxBackgroundStyle style) wxOVERRIDE; + virtual bool IsTransparentBackgroundSupported(wxString* reason = NULL) const wxOVERRIDE; + virtual bool SetTransparent(wxByte alpha) wxOVERRIDE; + virtual bool CanSetTransparent() wxOVERRIDE { return true; } + + virtual bool SetBackgroundColour(const wxColour& colour) wxOVERRIDE; + virtual bool SetForegroundColour(const wxColour& colour) wxOVERRIDE; + + QWidget *GetHandle() const wxOVERRIDE; + +#if wxUSE_DRAG_AND_DROP + virtual void SetDropTarget( wxDropTarget *dropTarget ) wxOVERRIDE; +#endif + +#if wxUSE_ACCEL + // accelerators + // ------------ + virtual void SetAcceleratorTable( const wxAcceleratorTable& accel ) wxOVERRIDE; +#endif // wxUSE_ACCEL + + // wxQt implementation internals: + + // Caller maintains ownership of pict - window will NOT delete it + void QtSetPicture( QPicture* pict ); + + QPainter *QtGetPainter(); + + virtual bool QtHandlePaintEvent ( QWidget *handler, QPaintEvent *event ); + virtual bool QtHandleResizeEvent ( QWidget *handler, QResizeEvent *event ); + virtual bool QtHandleWheelEvent ( QWidget *handler, QWheelEvent *event ); + virtual bool QtHandleKeyEvent ( QWidget *handler, QKeyEvent *event ); + virtual bool QtHandleMouseEvent ( QWidget *handler, QMouseEvent *event ); + virtual bool QtHandleEnterEvent ( QWidget *handler, QEvent *event ); + virtual bool QtHandleMoveEvent ( QWidget *handler, QMoveEvent *event ); + virtual bool QtHandleShowEvent ( QWidget *handler, QEvent *event ); + virtual bool QtHandleChangeEvent ( QWidget *handler, QEvent *event ); + virtual bool QtHandleCloseEvent ( QWidget *handler, QCloseEvent *event ); + virtual bool QtHandleContextMenuEvent ( QWidget *handler, QContextMenuEvent *event ); + virtual bool QtHandleFocusEvent ( QWidget *handler, QFocusEvent *event ); + + static void QtStoreWindowPointer( QWidget *widget, const wxWindowQt *window ); + static wxWindowQt *QtRetrieveWindowPointer( const QWidget *widget ); + static void QtSendSetCursorEvent(wxWindowQt* win, wxPoint posClient); + +#if wxUSE_ACCEL + virtual void QtHandleShortcut ( int command ); +#endif // wxUSE_ACCEL + + virtual QScrollArea *QtGetScrollBarsContainer() const; + +#if wxUSE_TOOLTIPS + // applies tooltip to the widget. + virtual void QtApplyToolTip(const wxString& text); +#endif // wxUSE_TOOLTIPS + +protected: + virtual void DoGetTextExtent(const wxString& string, + int *x, int *y, + int *descent = NULL, + int *externalLeading = NULL, + const wxFont *font = NULL) const wxOVERRIDE; + + // coordinates translation + virtual void DoClientToScreen( int *x, int *y ) const wxOVERRIDE; + virtual void DoScreenToClient( int *x, int *y ) const wxOVERRIDE; + + // capture/release the mouse, used by Capture/ReleaseMouse() + virtual void DoCaptureMouse() wxOVERRIDE; + virtual void DoReleaseMouse() wxOVERRIDE; + + // retrieve the position/size of the window + virtual void DoGetPosition(int *x, int *y) const wxOVERRIDE; + + virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; + + // same as DoSetSize() for the client size + virtual void DoSetClientSize(int width, int height) wxOVERRIDE; + virtual void DoGetClientSize(int *width, int *height) const wxOVERRIDE; + + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; + +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip( wxToolTip *tip ) wxOVERRIDE; +#endif // wxUSE_TOOLTIPS + +#if wxUSE_MENUS + virtual bool DoPopupMenu(wxMenu *menu, int x, int y) wxOVERRIDE; +#endif // wxUSE_MENUS + + // Return the parent to use for children being reparented to us: this is + // overridden in wxFrame to use its central widget rather than the frame + // itself. + virtual QWidget* QtGetParentWidget() const { return GetHandle(); } + + virtual bool EnableTouchEvents(int eventsMask) wxOVERRIDE; + + QWidget *m_qtWindow; + +private: + void Init(); + QScrollArea *m_qtContainer; // either NULL or the same as m_qtWindow pointer + + QScrollBar *m_horzScrollBar; // owned by m_qtWindow when allocated + QScrollBar *m_vertScrollBar; // owned by m_qtWindow when allocated + + // Return the viewport of m_qtContainer, if it's used, or just m_qtWindow. + // + // Always returns non-null pointer if the window has been already created. + QWidget *QtGetClientWidget() const; + + QScrollBar *QtGetScrollBar( int orientation ) const; + QScrollBar *QtSetScrollBar( int orientation, QScrollBar *scrollBar=NULL ); + + bool QtSetBackgroundStyle(); + + QPicture *m_qtPicture; // not owned + wxScopedPtr<QPainter> m_qtPainter; // always allocated + + bool m_mouseInside; + +#if wxUSE_ACCEL + wxVector<QShortcut*> m_qtShortcuts; // owned by whatever GetHandle() returns + wxScopedPtr<wxQtShortcutHandler> m_qtShortcutHandler; // always allocated + bool m_processingShortcut; +#endif // wxUSE_ACCEL + + wxDECLARE_DYNAMIC_CLASS_NO_COPY( wxWindowQt ); +}; + +#endif // _WX_QT_WINDOW_H_ diff --git a/lib/wxWidgets/include/wx/quantize.h b/lib/wxWidgets/include/wx/quantize.h new file mode 100644 index 0000000..b3a722d --- /dev/null +++ b/lib/wxWidgets/include/wx/quantize.h @@ -0,0 +1,75 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/quantize.h +// Purpose: wxQuantizer class +// Author: Julian Smart +// Modified by: +// Created: 22/6/2000 +// Copyright: (c) Julian Smart +// Licence: +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_QUANTIZE_H_ +#define _WX_QUANTIZE_H_ + +#include "wx/object.h" + +/* + * From jquant2.c + * + * Copyright (C) 1991-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + */ + +class WXDLLIMPEXP_FWD_CORE wxImage; +class WXDLLIMPEXP_FWD_CORE wxPalette; + +/* + * wxQuantize + * Based on the JPEG quantization code. Reduces the number of colours in a wxImage. + */ + +#define wxQUANTIZE_INCLUDE_WINDOWS_COLOURS 0x01 +#define wxQUANTIZE_RETURN_8BIT_DATA 0x02 +#define wxQUANTIZE_FILL_DESTINATION_IMAGE 0x04 + +class WXDLLIMPEXP_CORE wxQuantize: public wxObject +{ +public: + wxDECLARE_DYNAMIC_CLASS(wxQuantize); + +//// Constructor + + wxQuantize() {} + virtual ~wxQuantize() {} + +//// Operations + + // Reduce the colours in the source image and put the result into the + // destination image. Both images may be the same, to overwrite the source image. + // Specify an optional palette pointer to receive the resulting palette. + // This palette may be passed to ConvertImageToBitmap, for example. + // If you pass a palette pointer, you must free the palette yourself. + + static bool Quantize(const wxImage& src, wxImage& dest, wxPalette** pPalette, int desiredNoColours = 236, + unsigned char** eightBitData = NULL, int flags = wxQUANTIZE_INCLUDE_WINDOWS_COLOURS|wxQUANTIZE_FILL_DESTINATION_IMAGE|wxQUANTIZE_RETURN_8BIT_DATA); + + // This version sets a palette in the destination image so you don't + // have to manage it yourself. + + static bool Quantize(const wxImage& src, wxImage& dest, int desiredNoColours = 236, + unsigned char** eightBitData = NULL, int flags = wxQUANTIZE_INCLUDE_WINDOWS_COLOURS|wxQUANTIZE_FILL_DESTINATION_IMAGE|wxQUANTIZE_RETURN_8BIT_DATA); + +//// Helpers + + // Converts input bitmap(s) into 8bit representation with custom palette + + // in_rows and out_rows are arrays [0..h-1] of pointer to rows + // (in_rows contains w * 3 bytes per row, out_rows w bytes per row) + // fills out_rows with indexes into palette (which is also stored into palette variable) + static void DoQuantize(unsigned w, unsigned h, unsigned char **in_rows, unsigned char **out_rows, unsigned char *palette, int desiredNoColours); + +}; + +#endif + // _WX_QUANTIZE_H_ diff --git a/lib/wxWidgets/include/wx/radiobox.h b/lib/wxWidgets/include/wx/radiobox.h new file mode 100644 index 0000000..ab9c22a --- /dev/null +++ b/lib/wxWidgets/include/wx/radiobox.h @@ -0,0 +1,172 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/radiobox.h +// Purpose: wxRadioBox declaration +// Author: Vadim Zeitlin +// Modified by: +// Created: 10.09.00 +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RADIOBOX_H_BASE_ +#define _WX_RADIOBOX_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_RADIOBOX + +#include "wx/ctrlsub.h" + +#if wxUSE_TOOLTIPS + +#include "wx/dynarray.h" + +class WXDLLIMPEXP_FWD_CORE wxToolTip; + +WX_DEFINE_EXPORTED_ARRAY_PTR(wxToolTip *, wxToolTipArray); + +#endif // wxUSE_TOOLTIPS + +extern WXDLLIMPEXP_DATA_CORE(const char) wxRadioBoxNameStr[]; + +// ---------------------------------------------------------------------------- +// wxRadioBoxBase is not a normal base class, but rather a mix-in because the +// real wxRadioBox derives from different classes on different platforms: for +// example, it is a wxStaticBox in wxUniv and wxMSW but not in other ports +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxRadioBoxBase : public wxItemContainerImmutable +{ +public: + virtual ~wxRadioBoxBase(); + + // change/query the individual radio button state + virtual bool Enable(unsigned int n, bool enable = true) = 0; + virtual bool Show(unsigned int n, bool show = true) = 0; + virtual bool IsItemEnabled(unsigned int n) const = 0; + virtual bool IsItemShown(unsigned int n) const = 0; + + // return number of columns/rows in this radiobox + unsigned int GetColumnCount() const { return m_numCols; } + unsigned int GetRowCount() const { return m_numRows; } + + // return the next active (i.e. shown and not disabled) item above/below/to + // the left/right of the given one + int GetNextItem(int item, wxDirection dir, long style) const; + +#if wxUSE_TOOLTIPS + // set the tooltip text for a radio item, empty string unsets any tooltip + void SetItemToolTip(unsigned int item, const wxString& text); + + // get the individual items tooltip; returns NULL if none + wxToolTip *GetItemToolTip(unsigned int item) const + { return m_itemsTooltips ? (*m_itemsTooltips)[item] : NULL; } +#endif // wxUSE_TOOLTIPS + +#if wxUSE_HELP + // set helptext for a particular item, pass an empty string to erase it + void SetItemHelpText(unsigned int n, const wxString& helpText); + + // retrieve helptext for a particular item, empty string means no help text + wxString GetItemHelpText(unsigned int n) const; +#else // wxUSE_HELP + // just silently ignore the help text, it's better than requiring using + // conditional compilation in all code using this function + void SetItemHelpText(unsigned int WXUNUSED(n), + const wxString& WXUNUSED(helpText)) + { + } +#endif // wxUSE_HELP + + // returns the radio item at the given position or wxNOT_FOUND if none + // (currently implemented only under MSW and GTK) + virtual int GetItemFromPoint(const wxPoint& WXUNUSED(pt)) const + { + return wxNOT_FOUND; + } + + +protected: + wxRadioBoxBase() + { + m_numCols = + m_numRows = + m_majorDim = 0; + +#if wxUSE_TOOLTIPS + m_itemsTooltips = NULL; +#endif // wxUSE_TOOLTIPS + } + + virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + + // return the number of items in major direction (which depends on whether + // we have wxRA_SPECIFY_COLS or wxRA_SPECIFY_ROWS style) + unsigned int GetMajorDim() const { return m_majorDim; } + + // sets m_majorDim and also updates m_numCols/Rows + // + // the style parameter should be the style of the radiobox itself + void SetMajorDim(unsigned int majorDim, long style); + +#if wxUSE_TOOLTIPS + // called from SetItemToolTip() to really set the tooltip for the specified + // item in the box (or, if tooltip is NULL, to remove any existing one). + // + // NB: this function should really be pure virtual but to avoid breaking + // the build of the ports for which it's not implemented yet we provide + // an empty stub in the base class for now + virtual void DoSetItemToolTip(unsigned int item, wxToolTip *tooltip); + + // returns true if we have any item tooltips + bool HasItemToolTips() const { return m_itemsTooltips != NULL; } +#endif // wxUSE_TOOLTIPS + +#if wxUSE_HELP + // Retrieve help text for an item: this is a helper for the implementation + // of wxWindow::GetHelpTextAtPoint() in the real radiobox class + wxString DoGetHelpTextAtPoint(const wxWindow *derived, + const wxPoint& pt, + wxHelpEvent::Origin origin) const; +#endif // wxUSE_HELP + +private: + // the number of elements in major dimension (i.e. number of columns if + // wxRA_SPECIFY_COLS or the number of rows if wxRA_SPECIFY_ROWS) and also + // the number of rows/columns calculated from it + unsigned int m_majorDim, + m_numCols, + m_numRows; + +#if wxUSE_TOOLTIPS + // array of tooltips for the individual items + // + // this array is initially NULL and initialized on first use + wxToolTipArray *m_itemsTooltips; +#endif + +#if wxUSE_HELP + // help text associated with a particular item or empty string if none + wxArrayString m_itemsHelpTexts; +#endif // wxUSE_HELP +}; + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/radiobox.h" +#elif defined(__WXMSW__) + #include "wx/msw/radiobox.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/radiobox.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/radiobox.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/radiobox.h" +#elif defined(__WXMAC__) + #include "wx/osx/radiobox.h" +#elif defined(__WXQT__) + #include "wx/qt/radiobox.h" +#endif + +#endif // wxUSE_RADIOBOX + +#endif // _WX_RADIOBOX_H_BASE_ diff --git a/lib/wxWidgets/include/wx/radiobut.h b/lib/wxWidgets/include/wx/radiobut.h new file mode 100644 index 0000000..f4cf3b1 --- /dev/null +++ b/lib/wxWidgets/include/wx/radiobut.h @@ -0,0 +1,75 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/radiobut.h +// Purpose: wxRadioButton declaration +// Author: Vadim Zeitlin +// Modified by: +// Created: 07.09.00 +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RADIOBUT_H_BASE_ +#define _WX_RADIOBUT_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_RADIOBTN + +#include "wx/control.h" + +class WXDLLIMPEXP_FWD_CORE wxRadioButton; + +// TODO: In wxUniv, wxRadioButton must derive from wxCheckBox as it reuses +// much of its code. This should be fixed by refactoring wxCheckBox to allow +// this class to reuse its functionality without inheriting from it, but for +// now use this hack to allow the existing code to compile. +#ifdef __WXUNIVERSAL__ + #include "wx/checkbox.h" + + typedef wxCheckBox wxRadioButtonBaseBase; +#else + typedef wxControl wxRadioButtonBaseBase; +#endif + +class WXDLLIMPEXP_CORE wxRadioButtonBase : public wxRadioButtonBaseBase +{ +public: + wxRadioButtonBase() { } + + // Methods to be implemented by the derived classes: + virtual void SetValue(bool value) = 0; + virtual bool GetValue() const = 0; + + + // Methods implemented by this class itself. + wxRadioButton* GetFirstInGroup() const; + wxRadioButton* GetLastInGroup() const; + wxRadioButton* GetPreviousInGroup() const; + wxRadioButton* GetNextInGroup() const; + +private: + wxDECLARE_NO_COPY_CLASS(wxRadioButtonBase); +}; + +extern WXDLLIMPEXP_DATA_CORE(const char) wxRadioButtonNameStr[]; + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/radiobut.h" +#elif defined(__WXMSW__) + #include "wx/msw/radiobut.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/radiobut.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/radiobut.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/radiobut.h" +#elif defined(__WXMAC__) + #include "wx/osx/radiobut.h" +#elif defined(__WXQT__) + #include "wx/qt/radiobut.h" +#endif + +#endif // wxUSE_RADIOBTN + +#endif + // _WX_RADIOBUT_H_BASE_ diff --git a/lib/wxWidgets/include/wx/range.h b/lib/wxWidgets/include/wx/range.h new file mode 100644 index 0000000..d59646e --- /dev/null +++ b/lib/wxWidgets/include/wx/range.h @@ -0,0 +1,28 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/range.h +// Purpose: Range Value Class +// Author: Stefan Csomor +// Modified by: +// Created: 2011-01-07 +// Copyright: (c) 2011 Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RANGE_H_ +#define _WX_RANGE_H_ + +#include "wx/defs.h" + +class wxRange +{ +public : + wxRange(): m_minVal(0), m_maxVal(0) {} + wxRange( int minVal, int maxVal) : m_minVal(minVal), m_maxVal(maxVal) {} + int GetMin() const { return m_minVal; } + int GetMax() const { return m_maxVal; } +private : + int m_minVal; + int m_maxVal; +}; + +#endif // _WX_RANGE_H_ diff --git a/lib/wxWidgets/include/wx/rawbmp.h b/lib/wxWidgets/include/wx/rawbmp.h new file mode 100644 index 0000000..a639878 --- /dev/null +++ b/lib/wxWidgets/include/wx/rawbmp.h @@ -0,0 +1,979 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/rawbmp.h +// Purpose: macros for fast, raw bitmap data access +// Author: Eric Kidd, Vadim Zeitlin +// Modified by: +// Created: 10.03.03 +// Copyright: (c) 2002 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RAWBMP_H_ +#define _WX_RAWBMP_H_ + +#include "wx/defs.h" + +#ifdef wxHAS_RAW_BITMAP + +#include "wx/image.h" +#include "wx/bitmap.h" + +// ---------------------------------------------------------------------------- +// Abstract Pixel API +// +// We need to access our raw bitmap data (1) portably and (2) efficiently. +// We do this using a two-dimensional "iteration" interface. Performance +// is extremely important here: these functions will be called hundreds +// of thousands of times in a row, and even small inefficiencies will +// make applications seem slow. +// +// We can't always rely on inline functions, because not all compilers actually +// bother to inline them unless we crank the optimization levels way up. +// Therefore, we also provide macros to wring maximum speed out of compiler +// unconditionally (e.g. even in debug builds). Of course, if the performance +// isn't absolutely crucial for you shouldn't be using them but the inline +// functions instead. +// ---------------------------------------------------------------------------- + +/* + Usage example: + + typedef wxPixelData<wxBitmap, wxNativePixelFormat> PixelData; + + wxBitmap bmp; + PixelData data(bmp); + if ( !data ) + { + ... raw access to bitmap data unavailable, do something else ... + return; + } + + if ( data.GetWidth() < 20 || data.GetHeight() < 20 ) + { + ... complain: the bitmap it too small ... + return; + } + + PixelData::Iterator p(data); + + // we draw a (10, 10)-(20, 20) rect manually using the given r, g, b + p.Offset(data, 10, 10); + + for ( int y = 0; y < 10; ++y ) + { + PixelData::Iterator rowStart = p; + + for ( int x = 0; x < 10; ++x, ++p ) + { + p.Red() = r; + p.Green() = g; + p.Blue() = b; + } + + p = rowStart; + p.OffsetY(data, 1); + } + */ + +/* + Note: we do not use WXDLLIMPEXP_CORE with classes in this file because VC++ has + problems with exporting inner class defined inside a specialization of a + template class from a DLL. Besides, as all the methods are inline it's not + really necessary to put them in DLL at all. + */ + +// ---------------------------------------------------------------------------- +// wxPixelFormat +// ---------------------------------------------------------------------------- + +/* + wxPixelFormat is a template class describing the bitmap data format. It + contains the constants describing the format of pixel data, but does not + describe how the entire bitmap is stored (i.e. top-to-bottom, + bottom-to-top, ...). It is also a "traits"-like class, i.e. it only + contains some constants and maybe static methods but nothing more, so it + can be safely used without incurring any overhead as all accesses to it are + done at compile-time. + + Current limitations: we don't support RAGABA and ARAGAB formats supported + by Mac OS X. If there is sufficient interest, these classes could be + extended to deal with them. Neither do we support alpha channel having + different representation from the RGB ones (happens under QNX/Photon I + think), but again this could be achieved with some small extra effort. + + Template parameters are: + - type of a single pixel component + - size of the single pixel in bits + - indices of red, green and blue pixel components inside the pixel + - index of the alpha component or -1 if none + - type which can contain the full pixel value (all channels) + */ + +template <class Channel, + size_t Bpp, int R, int G, int B, int A = -1, + class Pixel = wxUint32> + +struct wxPixelFormat +{ + // iterator over pixels is usually of type "ChannelType *" + typedef Channel ChannelType; + + // the type which may hold the entire pixel value + typedef Pixel PixelType; + + // size of one pixel in bits + static const int BitsPerPixel = Bpp; + + // size of one pixel in ChannelType units (usually bytes) + static const int SizePixel = Bpp / (8 * sizeof(Channel)); + + // the channels indices inside the pixel + enum + { + RED = R, + GREEN = G, + BLUE = B, + ALPHA = A + }; + + // true if we have an alpha channel (together with the other channels, this + // doesn't cover the case of wxImage which stores alpha separately) + enum { HasAlpha = A != -1 }; +}; + +// some "predefined" pixel formats +// ------------------------------- + +// wxImage format is common to all platforms +typedef wxPixelFormat<unsigned char, 24, 0, 1, 2> wxImagePixelFormat; + +// the (most common) native bitmap format without alpha support +#if defined(__WXMSW__) + // under MSW the RGB components are reversed, they're in BGR order + typedef wxPixelFormat<unsigned char, 24, 2, 1, 0> wxNativePixelFormat; + + #define wxPIXEL_FORMAT_ALPHA 3 + + template<> + struct wxPixelFormat<void, 1, -1, -1, -1, -1, bool> + { + // the type which may hold the entire pixel value + typedef bool PixelType; + + // size of one pixel in bits + static const int BitsPerPixel = 1; + + // size of one pixel in ChannelType units (usually bytes) + static const int SizePixel = 1; + + // true if we have an alpha channel (together with the other channels, this + // doesn't cover the case of wxImage which stores alpha separately) + enum { HasAlpha = false }; + }; + typedef wxPixelFormat<void, 1, -1, -1, -1, -1, bool> wxMonoPixelFormat; +#elif defined(__WXMAC__) + // under Mac, first component is unused but still present, hence we use + // 32bpp, not 24 + typedef wxPixelFormat<unsigned char, 32, 1, 2, 3> wxNativePixelFormat; + + #define wxPIXEL_FORMAT_ALPHA 0 +#elif defined(__WXGTK__) + // Under GTK+ 2.X we use GdkPixbuf, which is standard RGB or RGBA + typedef wxPixelFormat<unsigned char, 24, 0, 1, 2> wxNativePixelFormat; + + #define wxPIXEL_FORMAT_ALPHA 3 +#elif defined(__WXDFB__) + // Under DirectFB, RGB components are reversed, they're in BGR order + typedef wxPixelFormat<unsigned char, 24, 2, 1, 0> wxNativePixelFormat; + + #define wxPIXEL_FORMAT_ALPHA 3 +#elif defined(__WXQT__) + typedef wxPixelFormat<unsigned char, 24, 0, 1, 2> wxNativePixelFormat; + + #define wxPIXEL_FORMAT_ALPHA 3 +#endif + +// the (most common) native format for bitmaps with alpha channel +#ifdef wxPIXEL_FORMAT_ALPHA + typedef wxPixelFormat<unsigned char, 32, + wxNativePixelFormat::RED, + wxNativePixelFormat::GREEN, + wxNativePixelFormat::BLUE, + wxPIXEL_FORMAT_ALPHA> wxAlphaPixelFormat; +#endif // wxPIXEL_FORMAT_ALPHA + +// we also define the (default/best) pixel format for the given class: this is +// used as default value for the pixel format in wxPixelIterator template +template <class T> struct wxPixelFormatFor; + +#if wxUSE_IMAGE +// wxPixelFormatFor is only defined for wxImage, attempt to use it with other +// classes (wxBitmap...) will result in compile errors which is exactly what we +// want +template <> +struct wxPixelFormatFor<wxImage> +{ + typedef wxImagePixelFormat Format; +}; +#endif //wxUSE_IMAGE + +// ---------------------------------------------------------------------------- +// wxPixelData +// ---------------------------------------------------------------------------- + +/* + wxPixelDataBase is just a helper for wxPixelData: it contains things common + to both wxImage and wxBitmap specializations. + */ +class wxPixelDataBase +{ +public: + // origin of the rectangular region we represent + wxPoint GetOrigin() const { return m_ptOrigin; } + + // width and height of the region we represent + int GetWidth() const { return m_width; } + int GetHeight() const { return m_height; } + + wxSize GetSize() const { return wxSize(m_width, m_height); } + + // the distance between two rows + int GetRowStride() const { return m_stride; } + +// private: -- see comment in the beginning of the file + + // the origin of this image inside the bigger bitmap (usually (0, 0)) + wxPoint m_ptOrigin; + + // the size of the image we address, in pixels + int m_width, + m_height; + + // this parameter is the offset of the start of the (N+1)st row from the + // Nth one and can be different from m_bypp*width in some cases: + // a) the most usual one is to force 32/64 bit alignment of rows + // b) another one is for bottom-to-top images where it's negative + // c) finally, it could conceivably be 0 for the images with all + // lines being identical + int m_stride; + +protected: + // ctor is protected because this class is only meant to be used as the + // base class by wxPixelData + wxPixelDataBase() + { + m_width = + m_height = + m_stride = 0; + } +}; + +/* + wxPixelData represents the entire bitmap data, i.e. unlike + wxPixelFormat (which it uses) it also stores the global bitmap + characteristics such as its size, inter-row separation and so on. + + Because of this it can be used to move the pixel iterators (which don't + have enough information about the bitmap themselves). This may seem a bit + unnatural but must be done in this way to keep the iterator objects as + small as possible for maximum efficiency as otherwise they wouldn't be put + into the CPU registers by the compiler any more. + + Implementation note: we use the standard workaround for lack of partial + template specialization support in VC7: instead of partly specializing the + class Foo<T, U> for some T we introduce FooOut<T> and FooIn<U> nested in + it, make Foo<T, U> equivalent to FooOut<T>::FooIn<U> and fully specialize + FooOut (FIXME-VC7). + + Also note that this class doesn't have any default definition because we + can't really do anything without knowing the exact image class. We do + provide wxPixelDataBase to make it simpler to write new wxPixelData + specializations. + */ + +// we need to define this skeleton template to mollify VC++ +template <class Image> +struct wxPixelDataOut +{ + template <class PixelFormat> + class wxPixelDataIn + { + public: + class Iterator { }; + }; +}; + +#if wxUSE_IMAGE +// wxPixelData specialization for wxImage: this is the simplest case as we +// don't have to care about different pixel formats here +template <> +struct wxPixelDataOut<wxImage> +{ + // NB: this is a template class even though it doesn't use its template + // parameter because otherwise wxPixelData couldn't compile + template <class dummyPixelFormat> + class wxPixelDataIn : public wxPixelDataBase + { + public: + // the type of the class we're working with + typedef wxImage ImageType; + + // the iterator which should be used for working with data in this + // format + class Iterator + { + public: + // the pixel format we use + typedef wxImagePixelFormat PixelFormat; + + // the pixel data we're working with + typedef + wxPixelDataOut<wxImage>::wxPixelDataIn<PixelFormat> PixelData; + + // go back to (0, 0) + void Reset(const PixelData& data) + { + *this = data.GetPixels(); + } + + // creates the iterator pointing to the beginning of data + Iterator(PixelData& data) + { + Reset(data); + } + + // creates the iterator initially pointing to the image origin + Iterator(const wxImage& image) + { + m_pRGB = image.GetData(); + + if ( image.HasAlpha() ) + { + m_pAlpha = image.GetAlpha(); + } + else // alpha is not used at all + { + m_pAlpha = NULL; + } + } + + // true if the iterator is valid + bool IsOk() const { return m_pRGB != NULL; } + + + // navigation + // ---------- + + // advance the iterator to the next pixel, prefix version + Iterator& operator++() + { + m_pRGB += PixelFormat::SizePixel; + if ( m_pAlpha ) + ++m_pAlpha; + + return *this; + } + + // postfix (hence less efficient -- don't use it unless you + // absolutely must) version + Iterator operator++(int) + { + Iterator p(*this); + ++*this; + return p; + } + + // move x pixels to the right and y down + // + // note that the rows don't wrap! + void Offset(const PixelData& data, int x, int y) + { + m_pRGB += data.GetRowStride()*y + PixelFormat::SizePixel*x; + if ( m_pAlpha ) + m_pAlpha += data.GetWidth()*y + x; + } + + // move x pixels to the right (again, no row wrapping) + void OffsetX(const PixelData& WXUNUSED(data), int x) + { + m_pRGB += PixelFormat::SizePixel*x; + if ( m_pAlpha ) + m_pAlpha += x; + } + + // move y rows to the bottom + void OffsetY(const PixelData& data, int y) + { + m_pRGB += data.GetRowStride()*y; + if ( m_pAlpha ) + m_pAlpha += data.GetWidth()*y; + } + + // go to the given position + void MoveTo(const PixelData& data, int x, int y) + { + Reset(data); + Offset(data, x, y); + } + + + // data access + // ----------- + + // access to individual colour components + PixelFormat::ChannelType& Red() { return m_pRGB[PixelFormat::RED]; } + PixelFormat::ChannelType& Green() { return m_pRGB[PixelFormat::GREEN]; } + PixelFormat::ChannelType& Blue() { return m_pRGB[PixelFormat::BLUE]; } + PixelFormat::ChannelType& Alpha() { return *m_pAlpha; } + + // address the pixel contents directly (always RGB, without alpha) + // + // this can't be used to modify the image as assigning a 32bpp + // value to 24bpp pixel would overwrite an extra byte in the next + // pixel or beyond the end of image + const typename PixelFormat::PixelType& Data() + { return *(typename PixelFormat::PixelType *)m_pRGB; } + + // private: -- see comment in the beginning of the file + + // pointer into RGB buffer + unsigned char *m_pRGB; + + // pointer into alpha buffer or NULL if alpha isn't used + unsigned char *m_pAlpha; + }; + + // initializes us with the data of the given image + wxPixelDataIn(ImageType& image) : m_image(image), m_pixels(image) + { + m_width = image.GetWidth(); + m_height = image.GetHeight(); + m_stride = Iterator::PixelFormat::SizePixel * m_width; + } + + // initializes us with the given region of the specified image + wxPixelDataIn(ImageType& image, + const wxPoint& pt, + const wxSize& sz) : m_image(image), m_pixels(image) + { + m_stride = Iterator::PixelFormat::SizePixel * m_width; + + InitRect(pt, sz); + } + + // initializes us with the given region of the specified image + wxPixelDataIn(ImageType& image, + const wxRect& rect) : m_image(image), m_pixels(image) + { + m_stride = Iterator::PixelFormat::SizePixel * m_width; + + InitRect(rect.GetPosition(), rect.GetSize()); + } + + // we evaluate to true only if we could get access to bitmap data + // successfully + operator bool() const { return m_pixels.IsOk(); } + + // get the iterator pointing to the origin + Iterator GetPixels() const { return m_pixels; } + + private: + void InitRect(const wxPoint& pt, const wxSize& sz) + { + m_width = sz.x; + m_height = sz.y; + + m_ptOrigin = pt; + m_pixels.Offset(*this, pt.x, pt.y); + } + + // the image we're working with + ImageType& m_image; + + // the iterator pointing to the image origin + Iterator m_pixels; + }; +}; +#endif //wxUSE_IMAGE + +#if wxUSE_GUI +// wxPixelData specialization for wxBitmap: here things are more interesting as +// we also have to support different pixel formats +template <> +struct wxPixelDataOut<wxBitmap> +{ + template <class Format> + class wxPixelDataIn : public wxPixelDataBase + { + public: + // the type of the class we're working with + typedef wxBitmap ImageType; + + class Iterator + { + public: + // the pixel format we use + typedef Format PixelFormat; + + // the type of the pixel components + typedef typename PixelFormat::ChannelType ChannelType; + + // the pixel data we're working with + typedef wxPixelDataOut<wxBitmap>::wxPixelDataIn<Format> PixelData; + + + // go back to (0, 0) + void Reset(const PixelData& data) + { + *this = data.GetPixels(); + } + + // initializes the iterator to point to the origin of the given + // pixel data + Iterator(PixelData& data) + { + Reset(data); + } + + // initializes the iterator to point to the origin of the given + // bitmap + Iterator(wxBitmap& bmp, PixelData& data) + { + // using cast here is ugly but it should be safe as + // GetRawData() real return type should be consistent with + // BitsPerPixel (which is in turn defined by ChannelType) and + // this is the only thing we can do without making GetRawData() + // a template function which is undesirable + m_ptr = (ChannelType *) + bmp.GetRawData(data, PixelFormat::BitsPerPixel); + } + + // default constructor + Iterator() + { + m_ptr = NULL; + } + + // return true if this iterator is valid + bool IsOk() const { return m_ptr != NULL; } + + + // navigation + // ---------- + + // advance the iterator to the next pixel, prefix version + Iterator& operator++() + { + m_ptr += PixelFormat::SizePixel; + + return *this; + } + + // postfix (hence less efficient -- don't use it unless you + // absolutely must) version + Iterator operator++(int) + { + Iterator p(*this); + ++*this; + return p; + } + + // move x pixels to the right and y down + // + // note that the rows don't wrap! + void Offset(const PixelData& data, int x, int y) + { + m_ptr += data.GetRowStride()*y + PixelFormat::SizePixel*x; + } + + // move x pixels to the right (again, no row wrapping) + void OffsetX(const PixelData& WXUNUSED(data), int x) + { + m_ptr += PixelFormat::SizePixel*x; + } + + // move y rows to the bottom + void OffsetY(const PixelData& data, int y) + { + m_ptr += data.GetRowStride()*y; + } + + // go to the given position + void MoveTo(const PixelData& data, int x, int y) + { + Reset(data); + Offset(data, x, y); + } + + + // data access + // ----------- + + // access to individual colour components + ChannelType& Red() { return m_ptr[PixelFormat::RED]; } + ChannelType& Green() { return m_ptr[PixelFormat::GREEN]; } + ChannelType& Blue() { return m_ptr[PixelFormat::BLUE]; } + ChannelType& Alpha() { return m_ptr[PixelFormat::ALPHA]; } + + // address the pixel contents directly + // + // warning: the format is platform dependent + // + // warning 2: assigning to Data() only works correctly for 16bpp or + // 32bpp formats but using it for 24bpp ones overwrites + // one extra byte and so can't be done + typename PixelFormat::PixelType& Data() + { return *(typename PixelFormat::PixelType *)m_ptr; } + + // private: -- see comment in the beginning of the file + + // for efficiency reasons this class should not have any other + // fields, otherwise it won't be put into a CPU register (as it + // should inside the inner loops) by some compilers, notably gcc + ChannelType *m_ptr; + }; + + // ctor associates this pointer with a bitmap and locks the bitmap for + // raw access, it will be unlocked only by our dtor and so these + // objects should normally be only created on the stack, i.e. have + // limited life-time + wxPixelDataIn(wxBitmap& bmp) : m_bmp(bmp), m_pixels(bmp, *this) + { + } + + wxPixelDataIn(wxBitmap& bmp, const wxRect& rect) + : m_bmp(bmp), m_pixels(bmp, *this) + { + InitRect(rect.GetPosition(), rect.GetSize()); + } + + wxPixelDataIn(wxBitmap& bmp, const wxPoint& pt, const wxSize& sz) + : m_bmp(bmp), m_pixels(bmp, *this) + { + InitRect(pt, sz); + } + + // we evaluate to true only if we could get access to bitmap data + // successfully + operator bool() const { return m_pixels.IsOk(); } + + // get the iterator pointing to the origin + Iterator GetPixels() const { return m_pixels; } + + // dtor unlocks the bitmap + ~wxPixelDataIn() + { + if ( m_pixels.IsOk() ) + { +#if defined(__WXMSW__) || defined(__WXMAC__) + // this is a hack to mark wxBitmap as using alpha channel + if ( Format::HasAlpha ) + m_bmp.UseAlpha(); +#endif + m_bmp.UngetRawData(*this); + } + // else: don't call UngetRawData() if GetRawData() failed + } + +#if WXWIN_COMPATIBILITY_2_8 + // not needed anymore, calls to it should be simply removed + wxDEPRECATED_INLINE( void UseAlpha(), wxEMPTY_PARAMETER_VALUE ) +#endif + + // private: -- see comment in the beginning of the file + + // the bitmap we're associated with + wxBitmap m_bmp; + + // the iterator pointing to the image origin + Iterator m_pixels; + + private: + void InitRect(const wxPoint& pt, const wxSize& sz) + { + m_pixels.Offset(*this, pt.x, pt.y); + + m_ptOrigin = pt; + m_width = sz.x; + m_height = sz.y; + } + }; +}; + + #if defined(__WXMSW__) + template <> + struct wxPixelDataOut<wxBitmap>::wxPixelDataIn<wxMonoPixelFormat> : public wxPixelDataBase + { + public: + // the type of the class we're working with + typedef wxBitmap ImageType; + + // Reference emulates ChannelType& for monochrome bitmap + class Iterator; + class Reference + { + public: + Reference& operator=(bool b) + { + wxByte mask = static_cast<wxByte>(1 << m_bit); + wxByte value = static_cast<wxByte>(b << m_bit); + wxByte& val_m_ptr = *m_ptr; + + val_m_ptr = static_cast<wxByte>(val_m_ptr & ~mask); + val_m_ptr |= value; + + return *this; + } + operator bool() const + { + wxByte mask = static_cast<wxByte>(1 << m_bit); + return (*m_ptr & mask) != 0; + } + + private: + Reference(const Iterator& i) : + m_ptr(i.m_ptr), + m_bit(i.m_bit) + { + } + + wxByte* m_ptr; + wxInt8 m_bit; + friend class Iterator; + }; + + class Iterator + { + public: + // emulate unspecialized template + typedef wxMonoPixelFormat Format; + + // the pixel format we use + typedef Format PixelFormat; + + // the pixel data we're working with + typedef wxPixelDataOut<wxBitmap>::wxPixelDataIn<Format> PixelData; + + + // go back to (0, 0) + void Reset(const PixelData& data) + { + *this = data.GetPixels(); + } + + // initializes the iterator to point to the origin of the given + // pixel data + Iterator(PixelData& data) + { + Reset(data); + } + + // initializes the iterator to point to the origin of the given + // bitmap + Iterator(wxBitmap& bmp, PixelData& data) + { + // using cast here is ugly but it should be safe as + // GetRawData() real return type should be consistent with + // BitsPerPixel (which is in turn defined by ChannelType) and + // this is the only thing we can do without making GetRawData() + // a template function which is undesirable + m_ptr = (wxByte*) + bmp.GetRawData(data, PixelFormat::BitsPerPixel); + m_bit = 7; + } + + // default constructor + Iterator() + { + m_ptr = NULL; + // m_bit doesn't need to be set until m_ptr != NULL + } + + // return true if this iterator is valid + bool IsOk() const { return m_ptr != NULL; } + + + // navigation + // ---------- + + // advance the iterator to the next pixel, prefix version + Iterator& operator++() + { + --m_bit; + m_ptr += (m_bit < 0); + m_bit &= 0x7; + + return *this; + } + + // postfix (hence less efficient -- don't use it unless you + // absolutely must) version + Iterator operator++(int) + { + Iterator p(*this); + ++* this; + return p; + } + + // move x pixels to the right and y down + // + // note that the rows don't wrap! + void Offset(const PixelData& data, int x, int y) + { + m_ptr += data.GetRowStride() * y; + x += 7 - m_bit; + m_ptr += x >> 3; + m_bit = 7 - (x & 0x7); + } + + // move x pixels to the right (again, no row wrapping) + void OffsetX(const PixelData& WXUNUSED(data), int x) + { + x += 7 - m_bit; + m_ptr += x >> 3; + m_bit = 7 - (x & 0x7); + } + + // move y rows to the bottom + void OffsetY(const PixelData& data, int y) + { + m_ptr += data.GetRowStride() * y; + } + + // go to the given position + void MoveTo(const PixelData& data, int x, int y) + { + Reset(data); + Offset(data, x, y); + } + + + // data access + // ----------- + + // access to individual pixels + Reference Pixel() { return Reference(*this); } + + // private: -- see comment in the beginning of the file + + // I don't see a way to bit-twiddle without two fields + wxByte* m_ptr; + wxInt8 m_bit; + }; + + // ctor associates this pointer with a bitmap and locks the bitmap for + // raw access, it will be unlocked only by our dtor and so these + // objects should normally be only created on the stack, i.e. have + // limited life-time + wxPixelDataIn(wxBitmap& bmp) : m_bmp(bmp), m_pixels(bmp, *this) + { + } + + wxPixelDataIn(wxBitmap& bmp, const wxRect& rect) + : m_bmp(bmp), m_pixels(bmp, *this) + { + InitRect(rect.GetPosition(), rect.GetSize()); + } + + wxPixelDataIn(wxBitmap& bmp, const wxPoint& pt, const wxSize& sz) + : m_bmp(bmp), m_pixels(bmp, *this) + { + InitRect(pt, sz); + } + + // we evaluate to true only if we could get access to bitmap data + // successfully + operator bool() const { return m_pixels.IsOk(); } + + // get the iterator pointing to the origin + Iterator GetPixels() const { return m_pixels; } + + // dtor unlocks the bitmap + ~wxPixelDataIn() + { + if ( m_pixels.IsOk() ) + { + m_bmp.UngetRawData(*this); + } + // else: don't call UngetRawData() if GetRawData() failed + } + + // private: -- see comment in the beginning of the file + + // the bitmap we're associated with + wxBitmap m_bmp; + + // the iterator pointing to the image origin + Iterator m_pixels; + + private: + void InitRect(const wxPoint& pt, const wxSize& sz) + { + m_pixels.Offset(*this, pt.x, pt.y); + + m_ptOrigin = pt; + m_width = sz.x; + m_height = sz.y; + } + }; + #endif + +#endif //wxUSE_GUI + +template <class Image, + class PixelFormat = typename wxPixelFormatFor<Image>::Format > +class wxPixelData : + public wxPixelDataOut<Image>::template wxPixelDataIn<PixelFormat> +{ +public: + typedef + typename wxPixelDataOut<Image>::template wxPixelDataIn<PixelFormat> + Base; + + wxPixelData(Image& image) : Base(image) { } + + wxPixelData(Image& i, const wxRect& rect) : Base(i, rect) { } + + wxPixelData(Image& i, const wxPoint& pt, const wxSize& sz) + : Base(i, pt, sz) + { + } +}; + +// some "predefined" pixel data classes +#if wxUSE_IMAGE +typedef wxPixelData<wxImage> wxImagePixelData; +#endif //wxUSE_IMAGE +#if wxUSE_GUI +typedef wxPixelData<wxBitmap, wxNativePixelFormat> wxNativePixelData; +typedef wxPixelData<wxBitmap, wxAlphaPixelFormat> wxAlphaPixelData; + +#if defined(__WXMSW__) +typedef wxPixelData<wxBitmap, wxMonoPixelFormat> wxMonoPixelData; +#endif + +#endif //wxUSE_GUI + +// ---------------------------------------------------------------------------- +// wxPixelIterator +// ---------------------------------------------------------------------------- + +/* + wxPixel::Iterator represents something which points to the pixel data and + allows us to iterate over it. In the simplest case of wxBitmap it is, + indeed, just a pointer, but it can be something more complicated and, + moreover, you are free to specialize it for other image classes and bitmap + formats. + + Note that although it would have been much more intuitive to have a real + class here instead of what we have now, this class would need two template + parameters, and this can't be done because we'd need compiler support for + partial template specialization then and VC7 doesn't provide it. + */ +template < class Image, class PixelFormat = wxPixelFormatFor<Image> > +struct wxPixelIterator : public wxPixelData<Image, PixelFormat>::Iterator +{ +}; + +#endif // wxHAS_RAW_BITMAP +#endif // _WX_RAWBMP_H_ diff --git a/lib/wxWidgets/include/wx/rearrangectrl.h b/lib/wxWidgets/include/wx/rearrangectrl.h new file mode 100644 index 0000000..5e2f5f9 --- /dev/null +++ b/lib/wxWidgets/include/wx/rearrangectrl.h @@ -0,0 +1,241 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/rearrangectrl.h +// Purpose: various controls for rearranging the items interactively +// Author: Vadim Zeitlin +// Created: 2008-12-15 +// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_REARRANGECTRL_H_ +#define _WX_REARRANGECTRL_H_ + +#include "wx/checklst.h" + +#if wxUSE_REARRANGECTRL + +#include "wx/panel.h" +#include "wx/dialog.h" + +#include "wx/arrstr.h" + +extern WXDLLIMPEXP_DATA_CORE(const char) wxRearrangeListNameStr[]; +extern WXDLLIMPEXP_DATA_CORE(const char) wxRearrangeDialogNameStr[]; + +// ---------------------------------------------------------------------------- +// wxRearrangeList: a (check) list box allowing to move items around +// ---------------------------------------------------------------------------- + +// This class works allows to change the order of the items shown in it as well +// as to check or uncheck them individually. The data structure used to allow +// this is the order array which contains the items indices indexed by their +// position with an added twist that the unchecked items are represented by the +// bitwise complement of the corresponding index (for any architecture using +// two's complement for negative numbers representation (i.e. just about any at +// all) this means that a checked item N is represented by -N-1 in unchecked +// state). +// +// So, for example, the array order [1 -3 0] used in conjunction with the items +// array ["first", "second", "third"] means that the items are displayed in the +// order "second", "third", "first" and the "third" item is unchecked while the +// other two are checked. +class WXDLLIMPEXP_CORE wxRearrangeList : public wxCheckListBox +{ +public: + // ctors and such + // -------------- + + // default ctor, call Create() later + wxRearrangeList() { } + + // ctor creating the control, the arguments are the same as for + // wxCheckListBox except for the extra order array which defines the + // (initial) display order of the items as well as their statuses, see the + // description above + wxRearrangeList(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayInt& order, + const wxArrayString& items, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRearrangeListNameStr)) + { + Create(parent, id, pos, size, order, items, style, validator, name); + } + + // Create() function takes the same parameters as the base class one and + // the order array determining the initial display order + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayInt& order, + const wxArrayString& items, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRearrangeListNameStr)); + + + // items order + // ----------- + + // get the current items order; the returned array uses the same convention + // as the one passed to the ctor + const wxArrayInt& GetCurrentOrder() const { return m_order; } + + // return true if the current item can be moved up or down (i.e. just that + // it's not the first or the last one) + bool CanMoveCurrentUp() const; + bool CanMoveCurrentDown() const; + + // move the current item one position up or down, return true if it was moved + // or false if the current item was the first/last one and so nothing was done + bool MoveCurrentUp(); + bool MoveCurrentDown(); + + + // Override this to keep our m_order array in sync with the real item state. + virtual void Check(unsigned int item, bool check = true) wxOVERRIDE; + + int DoInsertItems(const wxArrayStringsAdapter& items, unsigned int pos, + void **clientData, wxClientDataType type) wxOVERRIDE; + void DoDeleteOneItem(unsigned int n) wxOVERRIDE; + void DoClear() wxOVERRIDE; + +private: + // swap two items at the given positions in the listbox + void Swap(int pos1, int pos2); + + // event handler for item checking/unchecking + void OnCheck(wxCommandEvent& event); + + + // the current order array + wxArrayInt m_order; + + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxRearrangeList); +}; + +// ---------------------------------------------------------------------------- +// wxRearrangeCtrl: composite control containing a wxRearrangeList and buttons +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxRearrangeCtrl : public wxPanel +{ +public: + // ctors/Create function are the same as for wxRearrangeList + wxRearrangeCtrl() + { + Init(); + } + + wxRearrangeCtrl(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayInt& order, + const wxArrayString& items, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRearrangeListNameStr)) + { + Init(); + + Create(parent, id, pos, size, order, items, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayInt& order, + const wxArrayString& items, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRearrangeListNameStr)); + + // get the underlying listbox + wxRearrangeList *GetList() const { return m_list; } + +private: + // common part of all ctors + void Init(); + + // event handlers for the buttons + void OnUpdateButtonUI(wxUpdateUIEvent& event); + void OnButton(wxCommandEvent& event); + + + wxRearrangeList *m_list; + + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxRearrangeCtrl); +}; + +// ---------------------------------------------------------------------------- +// wxRearrangeDialog: dialog containing a wxRearrangeCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxRearrangeDialog : public wxDialog +{ +public: + // default ctor, use Create() later + wxRearrangeDialog() { Init(); } + + // ctor for the dialog: message is shown inside the dialog itself, order + // and items are passed to wxRearrangeList used internally + wxRearrangeDialog(wxWindow *parent, + const wxString& message, + const wxString& title, + const wxArrayInt& order, + const wxArrayString& items, + const wxPoint& pos = wxDefaultPosition, + const wxString& name = wxASCII_STR(wxRearrangeDialogNameStr)) + { + Init(); + + Create(parent, message, title, order, items, pos, name); + } + + bool Create(wxWindow *parent, + const wxString& message, + const wxString& title, + const wxArrayInt& order, + const wxArrayString& items, + const wxPoint& pos = wxDefaultPosition, + const wxString& name = wxASCII_STR(wxRearrangeDialogNameStr)); + + + // methods for the dialog customization + + // add extra contents to the dialog below the wxRearrangeCtrl part: the + // given window (usually a wxPanel containing more control inside it) must + // have the dialog as its parent and will be inserted into it at the right + // place by this method + void AddExtraControls(wxWindow *win); + + // return the wxRearrangeList control used by the dialog + wxRearrangeList *GetList() const; + + + // get the order of items after it was modified by the user + wxArrayInt GetOrder() const; + +private: + // common part of all ctors + void Init() { m_ctrl = NULL; } + + wxRearrangeCtrl *m_ctrl; + + wxDECLARE_NO_COPY_CLASS(wxRearrangeDialog); +}; + +#endif // wxUSE_REARRANGECTRL + +#endif // _WX_REARRANGECTRL_H_ + diff --git a/lib/wxWidgets/include/wx/recguard.h b/lib/wxWidgets/include/wx/recguard.h new file mode 100644 index 0000000..d7775b9 --- /dev/null +++ b/lib/wxWidgets/include/wx/recguard.h @@ -0,0 +1,52 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/recguard.h +// Purpose: declaration and implementation of wxRecursionGuard class +// Author: Vadim Zeitlin +// Modified by: +// Created: 14.08.2003 +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RECGUARD_H_ +#define _WX_RECGUARD_H_ + +#include "wx/defs.h" + +// ---------------------------------------------------------------------------- +// wxRecursionGuardFlag is used with wxRecursionGuard +// ---------------------------------------------------------------------------- + +typedef int wxRecursionGuardFlag; + +// ---------------------------------------------------------------------------- +// wxRecursionGuard is the simplest way to protect a function from reentrancy +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxRecursionGuard +{ +public: + wxRecursionGuard(wxRecursionGuardFlag& flag) + : m_flag(flag) + { + m_isInside = flag++ != 0; + } + + ~wxRecursionGuard() + { + wxASSERT_MSG( m_flag > 0, wxT("unbalanced wxRecursionGuards!?") ); + + m_flag--; + } + + bool IsInside() const { return m_isInside; } + +private: + wxRecursionGuardFlag& m_flag; + + // true if the flag had been already set when we were created + bool m_isInside; +}; + +#endif // _WX_RECGUARD_H_ + diff --git a/lib/wxWidgets/include/wx/regex.h b/lib/wxWidgets/include/wx/regex.h new file mode 100644 index 0000000..e94714a --- /dev/null +++ b/lib/wxWidgets/include/wx/regex.h @@ -0,0 +1,174 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/regex.h +// Purpose: regular expression matching +// Author: Karsten Ballueder +// Modified by: VZ at 13.07.01 (integrated to wxWin) +// Created: 05.02.2000 +// Copyright: (c) 2000 Karsten Ballueder <ballueder@gmx.net> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_REGEX_H_ +#define _WX_REGEX_H_ + +#include "wx/defs.h" + +#if wxUSE_REGEX + +#include "wx/string.h" +#include "wx/versioninfo.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// flags for regex compilation: these can be used with Compile() +enum +{ + // use extended regex syntax + wxRE_EXTENDED = 0, + + // use advanced RE syntax (deprecated, same as wxRE_EXTENDED now) + wxRE_ADVANCED = 1, + + // use basic RE syntax + wxRE_BASIC = 2, + + // ignore case in match + wxRE_ICASE = 4, + + // only check match, don't set back references + wxRE_NOSUB = 8, + + // if not set, treat '\n' as an ordinary character, otherwise it is + // special: it is not matched by '.' and '^' and '$' always match + // after/before it regardless of the setting of wxRE_NOT[BE]OL + wxRE_NEWLINE = 16, + + // default flags + wxRE_DEFAULT = wxRE_EXTENDED +}; + +// flags for regex matching: these can be used with Matches() +// +// these flags are mainly useful when doing several matches in a long string, +// they can be used to prevent erroneous matches for '^' and '$' +enum +{ + // '^' doesn't match at the start of line + wxRE_NOTBOL = 32, + + // '$' doesn't match at the end of line + wxRE_NOTEOL = 64, + + // don't accept empty string as valid match, try alternatives or fail + wxRE_NOTEMPTY = 128 +}; + +// ---------------------------------------------------------------------------- +// wxRegEx: a regular expression +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_BASE wxRegExImpl; + +class WXDLLIMPEXP_BASE wxRegEx +{ +public: + // default ctor: use Compile() later + wxRegEx() { Init(); } + + // create and compile + wxRegEx(const wxString& expr, int flags = wxRE_DEFAULT) + { + Init(); + (void)Compile(expr, flags); + } + + // return true if this is a valid compiled regular expression + bool IsValid() const { return m_impl != NULL; } + + // compile the string into regular expression, return true if ok or false + // if string has a syntax error + bool Compile(const wxString& pattern, int flags = wxRE_DEFAULT); + + // matches the precompiled regular expression against a string, return + // true if matches and false otherwise + // + // flags may be combination of wxRE_NOTBOL and wxRE_NOTEOL + // len may be the length of text (ignored by most system regex libs) + // + // may only be called after successful call to Compile() + bool Matches(const wxString& text, int flags = 0) const; + bool Matches(const wxChar *text, int flags, size_t len) const + { return Matches(wxString(text, len), flags); } + + // get the start index and the length of the match of the expression + // (index 0) or a bracketed subexpression (index != 0) + // + // may only be called after successful call to Matches() + // + // return false if no match or on error + bool GetMatch(size_t *start, size_t *len, size_t index = 0) const; + + // return the part of string corresponding to the match, empty string is + // returned if match failed + // + // may only be called after successful call to Matches() + wxString GetMatch(const wxString& text, size_t index = 0) const; + + // return the size of the array of matches, i.e. the number of bracketed + // subexpressions plus one for the expression itself, or 0 on error. + // + // may only be called after successful call to Compile() + size_t GetMatchCount() const; + + // replaces the current regular expression in the string pointed to by + // pattern, with the text in replacement and return number of matches + // replaced (maybe 0 if none found) or -1 on error + // + // the replacement text may contain backreferences (\number) which will be + // replaced with the value of the corresponding subexpression in the + // pattern match + // + // maxMatches may be used to limit the number of replacements made, setting + // it to 1, for example, will only replace first occurrence (if any) of the + // pattern in the text while default value of 0 means replace all + int Replace(wxString *text, const wxString& replacement, + size_t maxMatches = 0) const; + + // replace the first occurrence + int ReplaceFirst(wxString *text, const wxString& replacement) const + { return Replace(text, replacement, 1); } + + // replace all occurrences: this is actually a synonym for Replace() + int ReplaceAll(wxString *text, const wxString& replacement) const + { return Replace(text, replacement, 0); } + + static wxString QuoteMeta(const wxString& str); + + // return the extended RE corresponding to the given basic RE + static wxString ConvertFromBasic(const wxString& bre); + + // return version information for the underlying regex library + static wxVersionInfo GetLibraryVersionInfo(); + + // dtor not virtual, don't derive from this class + ~wxRegEx(); + +private: + // common part of all ctors + void Init(); + + // the real guts of this class + wxRegExImpl *m_impl; + + // as long as the class wxRegExImpl is not ref-counted, + // instances of the handle wxRegEx must not be copied. + wxRegEx(const wxRegEx&); + wxRegEx &operator=(const wxRegEx&); +}; + +#endif // wxUSE_REGEX + +#endif // _WX_REGEX_H_ + diff --git a/lib/wxWidgets/include/wx/region.h b/lib/wxWidgets/include/wx/region.h new file mode 100644 index 0000000..7db620b --- /dev/null +++ b/lib/wxWidgets/include/wx/region.h @@ -0,0 +1,288 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/region.h +// Purpose: Base header for wxRegion +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_REGION_H_BASE_ +#define _WX_REGION_H_BASE_ + +#include "wx/gdiobj.h" +#include "wx/gdicmn.h" + +class WXDLLIMPEXP_FWD_CORE wxBitmap; +class WXDLLIMPEXP_FWD_CORE wxColour; +class WXDLLIMPEXP_FWD_CORE wxRegion; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// result of wxRegion::Contains() call +enum wxRegionContain +{ + wxOutRegion = 0, + wxPartRegion = 1, + wxInRegion = 2 +}; + +// these constants are used with wxRegion::Combine() in the ports which have +// this method +enum wxRegionOp +{ + // Creates the intersection of the two combined regions. + wxRGN_AND, + + // Creates a copy of the region + wxRGN_COPY, + + // Combines the parts of first region that are not in the second one + wxRGN_DIFF, + + // Creates the union of two combined regions. + wxRGN_OR, + + // Creates the union of two regions except for any overlapping areas. + wxRGN_XOR +}; + +// ---------------------------------------------------------------------------- +// wxRegionBase defines wxRegion API +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxRegionBase : public wxGDIObject +{ +public: + // ctors + // ----- + + // none are defined here but the following should be available: +#if 0 + wxRegion(); + wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h); + wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight); + wxRegion(const wxRect& rect); + wxRegion(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE); + wxRegion(const wxBitmap& bmp); + wxRegion(const wxBitmap& bmp, const wxColour& transp, int tolerance = 0); +#endif // 0 + + // operators + // --------- + + bool operator==(const wxRegion& region) const { return IsEqual(region); } + bool operator!=(const wxRegion& region) const { return !(*this == region); } + + + // accessors + // --------- + + // Is region empty? + virtual bool IsEmpty() const = 0; + bool Empty() const { return IsEmpty(); } + + // Is region equal (i.e. covers the same area as another one)? + bool IsEqual(const wxRegion& region) const; + + // Get the bounding box + bool GetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const + { return DoGetBox(x, y, w, h); } + wxRect GetBox() const + { + wxCoord x, y, w, h; + return DoGetBox(x, y, w, h) ? wxRect(x, y, w, h) : wxRect(); + } + + // Test if the given point or rectangle is inside this region + wxRegionContain Contains(wxCoord x, wxCoord y) const + { return DoContainsPoint(x, y); } + wxRegionContain Contains(const wxPoint& pt) const + { return DoContainsPoint(pt.x, pt.y); } + wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h) const + { return DoContainsRect(wxRect(x, y, w, h)); } + wxRegionContain Contains(const wxRect& rect) const + { return DoContainsRect(rect); } + + + // operations + // ---------- + + virtual void Clear() = 0; + + // Move the region + bool Offset(wxCoord x, wxCoord y) + { return DoOffset(x, y); } + bool Offset(const wxPoint& pt) + { return DoOffset(pt.x, pt.y); } + + // Union rectangle or region with this region. + bool Union(wxCoord x, wxCoord y, wxCoord w, wxCoord h) + { return DoUnionWithRect(wxRect(x, y, w, h)); } + bool Union(const wxRect& rect) + { return DoUnionWithRect(rect); } + bool Union(const wxRegion& region) + { return DoUnionWithRegion(region); } + +#if wxUSE_IMAGE + // Use the non-transparent pixels of a wxBitmap for the region to combine + // with this region. First version takes transparency from bitmap's mask, + // second lets the user specify the colour to be treated as transparent + // along with an optional tolerance value. + // NOTE: implemented in common/rgncmn.cpp + bool Union(const wxBitmap& bmp); + bool Union(const wxBitmap& bmp, const wxColour& transp, int tolerance = 0); +#endif // wxUSE_IMAGE + + // Intersect rectangle or region with this one. + bool Intersect(wxCoord x, wxCoord y, wxCoord w, wxCoord h); + bool Intersect(const wxRect& rect); + bool Intersect(const wxRegion& region) + { return DoIntersect(region); } + + // Subtract rectangle or region from this: + // Combines the parts of 'this' that are not part of the second region. + bool Subtract(wxCoord x, wxCoord y, wxCoord w, wxCoord h); + bool Subtract(const wxRect& rect); + bool Subtract(const wxRegion& region) + { return DoSubtract(region); } + + // XOR: the union of two combined regions except for any overlapping areas. + bool Xor(wxCoord x, wxCoord y, wxCoord w, wxCoord h); + bool Xor(const wxRect& rect); + bool Xor(const wxRegion& region) + { return DoXor(region); } + + + // Convert the region to a B&W bitmap with the white pixels being inside + // the region. + wxBitmap ConvertToBitmap() const; + +protected: + virtual bool DoIsEqual(const wxRegion& region) const = 0; + virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const = 0; + virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const = 0; + virtual wxRegionContain DoContainsRect(const wxRect& rect) const = 0; + + virtual bool DoOffset(wxCoord x, wxCoord y) = 0; + + virtual bool DoUnionWithRect(const wxRect& rect) = 0; + virtual bool DoUnionWithRegion(const wxRegion& region) = 0; + + virtual bool DoIntersect(const wxRegion& region) = 0; + virtual bool DoSubtract(const wxRegion& region) = 0; + virtual bool DoXor(const wxRegion& region) = 0; +}; + +// some ports implement a generic Combine() function while others only +// implement individual wxRegion operations, factor out the common code for the +// ports with Combine() in this class +#if defined(__WXMSW__) || \ + ( defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON ) + +#define wxHAS_REGION_COMBINE + +class WXDLLIMPEXP_CORE wxRegionWithCombine : public wxRegionBase +{ +public: + // these methods are not part of public API as they're not implemented on + // all ports + bool Combine(wxCoord x, wxCoord y, wxCoord w, wxCoord h, wxRegionOp op); + bool Combine(const wxRect& rect, wxRegionOp op); + bool Combine(const wxRegion& region, wxRegionOp op) + { return DoCombine(region, op); } + + +protected: + // the real Combine() method, to be defined in the derived class + virtual bool DoCombine(const wxRegion& region, wxRegionOp op) = 0; + + // implement some wxRegionBase pure virtuals in terms of Combine() + virtual bool DoUnionWithRect(const wxRect& rect) wxOVERRIDE; + virtual bool DoUnionWithRegion(const wxRegion& region) wxOVERRIDE; + virtual bool DoIntersect(const wxRegion& region) wxOVERRIDE; + virtual bool DoSubtract(const wxRegion& region) wxOVERRIDE; + virtual bool DoXor(const wxRegion& region) wxOVERRIDE; +}; + +#endif // ports with wxRegion::Combine() + +#if defined(__WXMSW__) + #include "wx/msw/region.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/region.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/region.h" +#elif defined(__WXMOTIF__) || defined(__WXX11__) + #include "wx/x11/region.h" +#elif defined(__WXDFB__) + #include "wx/dfb/region.h" +#elif defined(__WXMAC__) + #include "wx/osx/region.h" +#elif defined(__WXQT__) + #include "wx/qt/region.h" +#endif + +// ---------------------------------------------------------------------------- +// inline functions implementation +// ---------------------------------------------------------------------------- + +// NB: these functions couldn't be defined in the class declaration as they use +// wxRegion and so can be only defined after including the header declaring +// the real class + +inline bool wxRegionBase::Intersect(const wxRect& rect) +{ + return DoIntersect(wxRegion(rect)); +} + +inline bool wxRegionBase::Subtract(const wxRect& rect) +{ + return DoSubtract(wxRegion(rect)); +} + +inline bool wxRegionBase::Xor(const wxRect& rect) +{ + return DoXor(wxRegion(rect)); +} + +// ...and these functions are here because they call the ones above, and its +// not really proper to call an inline function before its defined inline. + +inline bool wxRegionBase::Intersect(wxCoord x, wxCoord y, wxCoord w, wxCoord h) +{ + return Intersect(wxRect(x, y, w, h)); +} + +inline bool wxRegionBase::Subtract(wxCoord x, wxCoord y, wxCoord w, wxCoord h) +{ + return Subtract(wxRect(x, y, w, h)); +} + +inline bool wxRegionBase::Xor(wxCoord x, wxCoord y, wxCoord w, wxCoord h) +{ + return Xor(wxRect(x, y, w, h)); +} + +#ifdef wxHAS_REGION_COMBINE + +inline bool wxRegionWithCombine::Combine(wxCoord x, + wxCoord y, + wxCoord w, + wxCoord h, + wxRegionOp op) +{ + return DoCombine(wxRegion(x, y, w, h), op); +} + +inline bool wxRegionWithCombine::Combine(const wxRect& rect, wxRegionOp op) +{ + return DoCombine(wxRegion(rect), op); +} + +#endif // wxHAS_REGION_COMBINE + +#endif // _WX_REGION_H_BASE_ diff --git a/lib/wxWidgets/include/wx/renderer.h b/lib/wxWidgets/include/wx/renderer.h new file mode 100644 index 0000000..b51af32 --- /dev/null +++ b/lib/wxWidgets/include/wx/renderer.h @@ -0,0 +1,619 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/renderer.h +// Purpose: wxRendererNative class declaration +// Author: Vadim Zeitlin +// Modified by: +// Created: 20.07.2003 +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +/* + Renderers are used in wxWidgets for two similar but different things: + (a) wxUniversal uses them to draw everything, i.e. all the control + (b) all the native ports use them to draw generic controls only + + wxUniversal needs more functionality than what is included in the base class + as it needs to draw stuff like scrollbars which are never going to be + generic. So we put the bare minimum needed by the native ports here and the + full wxRenderer class is declared in wx/univ/renderer.h and is only used by + wxUniveral (although note that native ports can load wxRenderer objects from + theme DLLs and use them as wxRendererNative ones, of course). + */ + +#ifndef _WX_RENDERER_H_ +#define _WX_RENDERER_H_ + +class WXDLLIMPEXP_FWD_CORE wxDC; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +#include "wx/gdicmn.h" // for wxPoint, wxSize +#include "wx/colour.h" +#include "wx/font.h" +#include "wx/bitmap.h" +#include "wx/string.h" + +// some platforms have their own renderers, others use the generic one +#if defined(__WXMSW__) || ( defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON ) || defined(__WXGTK__) + #define wxHAS_NATIVE_RENDERER +#else + #undef wxHAS_NATIVE_RENDERER +#endif + +// only MSW and OS X currently provides DrawTitleBarBitmap() method +#if defined(__WXMSW__) || (defined(__WXMAC__) && wxUSE_LIBPNG && wxUSE_IMAGE) + #define wxHAS_DRAW_TITLE_BAR_BITMAP +#endif + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// control state flags used in wxRenderer and wxColourScheme +enum +{ + wxCONTROL_NONE = 0x00000000, // absence of any other flags + wxCONTROL_DISABLED = 0x00000001, // control is disabled + wxCONTROL_FOCUSED = 0x00000002, // currently has keyboard focus + wxCONTROL_PRESSED = 0x00000004, // (button) is pressed + wxCONTROL_SPECIAL = 0x00000008, // control-specific bit: + wxCONTROL_ISDEFAULT = wxCONTROL_SPECIAL, // only for the buttons + wxCONTROL_ISSUBMENU = wxCONTROL_SPECIAL, // only for the menu items + wxCONTROL_EXPANDED = wxCONTROL_SPECIAL, // only for the tree items + wxCONTROL_SIZEGRIP = wxCONTROL_SPECIAL, // only for the status bar panes + wxCONTROL_FLAT = wxCONTROL_SPECIAL, // checkboxes only: flat border + wxCONTROL_CELL = wxCONTROL_SPECIAL, // only for item selection rect + wxCONTROL_CURRENT = 0x00000010, // mouse is currently over the control + wxCONTROL_SELECTED = 0x00000020, // selected item in e.g. listbox + wxCONTROL_CHECKED = 0x00000040, // (check/radio button) is checked + wxCONTROL_CHECKABLE = 0x00000080, // (menu) item can be checked + wxCONTROL_UNDETERMINED = wxCONTROL_CHECKABLE, // (check) undetermined state + + wxCONTROL_FLAGS_MASK = 0x000000ff, + + // this is a pseudo flag not used directly by wxRenderer but rather by some + // controls internally + wxCONTROL_DIRTY = 0x80000000 +}; + +// title bar buttons supported by DrawTitleBarBitmap() +// +// NB: they have the same values as wxTOPLEVEL_BUTTON_XXX constants in +// wx/univ/toplevel.h as they really represent the same things +enum wxTitleBarButton +{ + wxTITLEBAR_BUTTON_CLOSE = 0x01000000, + wxTITLEBAR_BUTTON_MAXIMIZE = 0x02000000, + wxTITLEBAR_BUTTON_ICONIZE = 0x04000000, + wxTITLEBAR_BUTTON_RESTORE = 0x08000000, + wxTITLEBAR_BUTTON_HELP = 0x10000000 +}; + +// ---------------------------------------------------------------------------- +// helper structs +// ---------------------------------------------------------------------------- + +// wxSplitterWindow parameters +struct WXDLLIMPEXP_CORE wxSplitterRenderParams +{ + // the only way to initialize this struct is by using this ctor + wxSplitterRenderParams(wxCoord widthSash_, wxCoord border_, bool isSens_) + : widthSash(widthSash_), border(border_), isHotSensitive(isSens_) + { + } + + // the width of the splitter sash + const wxCoord widthSash; + + // the width of the border of the splitter window + const wxCoord border; + + // true if the splitter changes its appearance when the mouse is over it + const bool isHotSensitive; +}; + + +// extra optional parameters for DrawHeaderButton +struct WXDLLIMPEXP_CORE wxHeaderButtonParams +{ + wxHeaderButtonParams() + : m_labelAlignment(wxALIGN_LEFT) + { } + + wxColour m_arrowColour; + wxColour m_selectionColour; + wxString m_labelText; + wxFont m_labelFont; + wxColour m_labelColour; + wxBitmap m_labelBitmap; + int m_labelAlignment; +}; + +enum wxHeaderSortIconType +{ + wxHDR_SORT_ICON_NONE, // Header button has no sort arrow + wxHDR_SORT_ICON_UP, // Header button an up sort arrow icon + wxHDR_SORT_ICON_DOWN // Header button a down sort arrow icon +}; + + +// wxRendererNative interface version +struct WXDLLIMPEXP_CORE wxRendererVersion +{ + wxRendererVersion(int version_, int age_) : version(version_), age(age_) { } + + // default copy ctor, assignment operator and dtor are ok + + // the current version and age of wxRendererNative interface: different + // versions are incompatible (in both ways) while the ages inside the same + // version are upwards compatible, i.e. the version of the renderer must + // match the version of the main program exactly while the age may be + // highergreater or equal to it + // + // NB: don't forget to increment age after adding any new virtual function! + enum + { + Current_Version = 1, + Current_Age = 5 + }; + + + // check if the given version is compatible with the current one + static bool IsCompatible(const wxRendererVersion& ver) + { + return ver.version == Current_Version && ver.age >= Current_Age; + } + + const int version; + const int age; +}; + +// ---------------------------------------------------------------------------- +// wxRendererNative: abstracts drawing methods needed by the native controls +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxRendererNative +{ +public: + // drawing functions + // ----------------- + + /* + Note that all these functions don't, and shouldn't, change any + parameters of wxDC passed to them, i.e. pens, brushes or colours. + Their implementation must use wxDCXXXChanger classes instead of + calling wxDC::SetXXX() directly to ensure this. + */ + + // draw the header control button (used by wxListCtrl) Returns optimal + // width for the label contents. + virtual int DrawHeaderButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0, + wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, + wxHeaderButtonParams* params=NULL) = 0; + + + // Draw the contents of a header control button (label, sort arrows, etc.) + // Normally only called by DrawHeaderButton. + virtual int DrawHeaderButtonContents(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0, + wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, + wxHeaderButtonParams* params=NULL) = 0; + + // Returns the default height of a header button, either a fixed platform + // height if available, or a generic height based on the window's font. + virtual int GetHeaderButtonHeight(wxWindow *win) = 0; + + // Returns the margin on left and right sides of header button's label + virtual int GetHeaderButtonMargin(wxWindow *win) = 0; + + + // draw the expanded/collapsed icon for a tree control item + virtual void DrawTreeItemButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) = 0; + + // draw the border for sash window: this border must be such that the sash + // drawn by DrawSash() blends into it well + virtual void DrawSplitterBorder(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) = 0; + + // draw a (vertical) sash + virtual void DrawSplitterSash(wxWindow *win, + wxDC& dc, + const wxSize& size, + wxCoord position, + wxOrientation orient, + int flags = 0) = 0; + + // draw a combobox dropdown button + // + // flags may use wxCONTROL_PRESSED and wxCONTROL_CURRENT + virtual void DrawComboBoxDropButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) = 0; + + // draw a dropdown arrow + // + // flags may use wxCONTROL_PRESSED and wxCONTROL_CURRENT + virtual void DrawDropArrow(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) = 0; + + // draw check button + // + // flags may use wxCONTROL_CHECKED, wxCONTROL_UNDETERMINED and wxCONTROL_CURRENT + virtual void DrawCheckBox(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) = 0; + + // draw check mark + // + // flags may use wxCONTROL_DISABLED + virtual void DrawCheckMark(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) = 0; + + // Returns the default size of a check box. + virtual wxSize GetCheckBoxSize(wxWindow *win, int flags = 0) = 0; + + // Returns the default size of a check mark. + virtual wxSize GetCheckMarkSize(wxWindow *win) = 0; + + // Returns the default size of a expander. + virtual wxSize GetExpanderSize(wxWindow *win) = 0; + + // draw blank button + // + // flags may use wxCONTROL_PRESSED, wxCONTROL_CURRENT and wxCONTROL_ISDEFAULT + virtual void DrawPushButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) = 0; + + // draw collapse button + // + // flags may use wxCONTROL_CHECKED, wxCONTROL_UNDETERMINED and wxCONTROL_CURRENT + virtual void DrawCollapseButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) = 0; + + // Returns the default size of a collapse button + virtual wxSize GetCollapseButtonSize(wxWindow *win, wxDC& dc) = 0; + + // draw rectangle indicating that an item in e.g. a list control + // has been selected or focused + // + // flags may use + // wxCONTROL_SELECTED (item is selected, e.g. draw background) + // wxCONTROL_CURRENT (item is the current item, e.g. dotted border) + // wxCONTROL_FOCUSED (the whole control has focus, e.g. blue background vs. grey otherwise) + virtual void DrawItemSelectionRect(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) = 0; + + // draw the focus rectangle around the label contained in the given rect + // + // only wxCONTROL_SELECTED makes sense in flags here + virtual void DrawFocusRect(wxWindow* win, + wxDC& dc, + const wxRect& rect, + int flags = 0) = 0; + + // Draw a native wxChoice + virtual void DrawChoice(wxWindow* win, + wxDC& dc, + const wxRect& rect, + int flags = 0) = 0; + + // Draw a native wxComboBox + virtual void DrawComboBox(wxWindow* win, + wxDC& dc, + const wxRect& rect, + int flags = 0) = 0; + + // Draw a native wxTextCtrl frame + virtual void DrawTextCtrl(wxWindow* win, + wxDC& dc, + const wxRect& rect, + int flags = 0) = 0; + + // Draw a native wxRadioButton bitmap + virtual void DrawRadioBitmap(wxWindow* win, + wxDC& dc, + const wxRect& rect, + int flags = 0) = 0; + +#ifdef wxHAS_DRAW_TITLE_BAR_BITMAP + // Draw one of the standard title bar buttons + // + // This is currently implemented only for MSW and OS X (for the close + // button only) because there is no way to render standard title bar + // buttons under the other platforms, the best can be done is to use normal + // (only) images which wxArtProvider provides for wxART_HELP and + // wxART_CLOSE (but not any other title bar buttons) + // + // NB: make sure PNG handler is enabled if using this function under OS X + virtual void DrawTitleBarBitmap(wxWindow *win, + wxDC& dc, + const wxRect& rect, + wxTitleBarButton button, + int flags = 0) = 0; +#endif // wxHAS_DRAW_TITLE_BAR_BITMAP + + // Draw a gauge with native style like a wxGauge would display. + // + // wxCONTROL_SPECIAL flag must be used for drawing vertical gauges. + virtual void DrawGauge(wxWindow* win, + wxDC& dc, + const wxRect& rect, + int value, + int max, + int flags = 0) = 0; + + // Draw text using the appropriate color for normal and selected states. + virtual void DrawItemText(wxWindow* win, + wxDC& dc, + const wxString& text, + const wxRect& rect, + int align = wxALIGN_LEFT | wxALIGN_TOP, + int flags = 0, + wxEllipsizeMode ellipsizeMode = wxELLIPSIZE_END) = 0; + + // geometry functions + // ------------------ + + // get the splitter parameters: the x field of the returned point is the + // sash width and the y field is the border width + virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win) = 0; + + + // pseudo constructors + // ------------------- + + // return the currently used renderer + static wxRendererNative& Get(); + + // return the generic implementation of the renderer + static wxRendererNative& GetGeneric(); + + // return the default (native) implementation for this platform + static wxRendererNative& GetDefault(); + + + // changing the global renderer + // ---------------------------- + +#if wxUSE_DYNLIB_CLASS + // load the renderer from the specified DLL, the returned pointer must be + // deleted by caller if not NULL when it is not used any more + static wxRendererNative *Load(const wxString& name); +#endif // wxUSE_DYNLIB_CLASS + + // set the renderer to use, passing NULL reverts to using the default + // renderer + // + // return the previous renderer used with Set() or NULL if none + static wxRendererNative *Set(wxRendererNative *renderer); + + + // miscellaneous stuff + // ------------------- + + // this function is used for version checking: Load() refuses to load any + // DLLs implementing an older or incompatible version; it should be + // implemented simply by returning wxRendererVersion::Current_XXX values + virtual wxRendererVersion GetVersion() const = 0; + + // virtual dtor for any base class + virtual ~wxRendererNative(); +}; + +// ---------------------------------------------------------------------------- +// wxDelegateRendererNative: allows reuse of renderers code +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDelegateRendererNative : public wxRendererNative +{ +public: + wxDelegateRendererNative() + : m_rendererNative(GetGeneric()) { } + + wxDelegateRendererNative(wxRendererNative& rendererNative) + : m_rendererNative(rendererNative) { } + + + virtual int DrawHeaderButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0, + wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, + wxHeaderButtonParams* params = NULL) wxOVERRIDE + { return m_rendererNative.DrawHeaderButton(win, dc, rect, flags, sortArrow, params); } + + virtual int DrawHeaderButtonContents(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0, + wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, + wxHeaderButtonParams* params = NULL) wxOVERRIDE + { return m_rendererNative.DrawHeaderButtonContents(win, dc, rect, flags, sortArrow, params); } + + virtual int GetHeaderButtonHeight(wxWindow *win) wxOVERRIDE + { return m_rendererNative.GetHeaderButtonHeight(win); } + + virtual int GetHeaderButtonMargin(wxWindow *win) wxOVERRIDE + { return m_rendererNative.GetHeaderButtonMargin(win); } + + virtual void DrawTreeItemButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) wxOVERRIDE + { m_rendererNative.DrawTreeItemButton(win, dc, rect, flags); } + + virtual void DrawSplitterBorder(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) wxOVERRIDE + { m_rendererNative.DrawSplitterBorder(win, dc, rect, flags); } + + virtual void DrawSplitterSash(wxWindow *win, + wxDC& dc, + const wxSize& size, + wxCoord position, + wxOrientation orient, + int flags = 0) wxOVERRIDE + { m_rendererNative.DrawSplitterSash(win, dc, size, + position, orient, flags); } + + virtual void DrawComboBoxDropButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) wxOVERRIDE + { m_rendererNative.DrawComboBoxDropButton(win, dc, rect, flags); } + + virtual void DrawDropArrow(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) wxOVERRIDE + { m_rendererNative.DrawDropArrow(win, dc, rect, flags); } + + virtual void DrawCheckBox(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) wxOVERRIDE + { m_rendererNative.DrawCheckBox( win, dc, rect, flags ); } + + virtual void DrawCheckMark(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) wxOVERRIDE + { m_rendererNative.DrawCheckMark( win, dc, rect, flags ); } + + virtual wxSize GetCheckBoxSize(wxWindow *win, int flags = 0) wxOVERRIDE + { return m_rendererNative.GetCheckBoxSize(win, flags); } + + virtual wxSize GetCheckMarkSize(wxWindow *win) wxOVERRIDE + { return m_rendererNative.GetCheckMarkSize(win); } + + virtual wxSize GetExpanderSize(wxWindow *win) wxOVERRIDE + { return m_rendererNative.GetExpanderSize(win); } + + virtual void DrawPushButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) wxOVERRIDE + { m_rendererNative.DrawPushButton( win, dc, rect, flags ); } + + virtual void DrawCollapseButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) wxOVERRIDE + { m_rendererNative.DrawCollapseButton(win, dc, rect, flags); } + + virtual wxSize GetCollapseButtonSize(wxWindow *win, wxDC& dc) wxOVERRIDE + { return m_rendererNative.GetCollapseButtonSize(win, dc); } + + virtual void DrawItemSelectionRect(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) wxOVERRIDE + { m_rendererNative.DrawItemSelectionRect( win, dc, rect, flags ); } + + virtual void DrawFocusRect(wxWindow* win, + wxDC& dc, + const wxRect& rect, + int flags = 0) wxOVERRIDE + { m_rendererNative.DrawFocusRect( win, dc, rect, flags ); } + + virtual void DrawChoice(wxWindow* win, + wxDC& dc, + const wxRect& rect, + int flags = 0) wxOVERRIDE + { m_rendererNative.DrawChoice( win, dc, rect, flags); } + + virtual void DrawComboBox(wxWindow* win, + wxDC& dc, + const wxRect& rect, + int flags = 0) wxOVERRIDE + { m_rendererNative.DrawComboBox( win, dc, rect, flags); } + + virtual void DrawTextCtrl(wxWindow* win, + wxDC& dc, + const wxRect& rect, + int flags = 0) wxOVERRIDE + { m_rendererNative.DrawTextCtrl( win, dc, rect, flags); } + + virtual void DrawRadioBitmap(wxWindow* win, + wxDC& dc, + const wxRect& rect, + int flags = 0) wxOVERRIDE + { m_rendererNative.DrawRadioBitmap(win, dc, rect, flags); } + +#ifdef wxHAS_DRAW_TITLE_BAR_BITMAP + virtual void DrawTitleBarBitmap(wxWindow *win, + wxDC& dc, + const wxRect& rect, + wxTitleBarButton button, + int flags = 0) wxOVERRIDE + { m_rendererNative.DrawTitleBarBitmap(win, dc, rect, button, flags); } +#endif // wxHAS_DRAW_TITLE_BAR_BITMAP + + virtual void DrawGauge(wxWindow* win, + wxDC& dc, + const wxRect& rect, + int value, + int max, + int flags = 0) wxOVERRIDE + { m_rendererNative.DrawGauge(win, dc, rect, value, max, flags); } + + virtual void DrawItemText(wxWindow* win, + wxDC& dc, + const wxString& text, + const wxRect& rect, + int align = wxALIGN_LEFT | wxALIGN_TOP, + int flags = 0, + wxEllipsizeMode ellipsizeMode = wxELLIPSIZE_END) wxOVERRIDE + { m_rendererNative.DrawItemText(win, dc, text, rect, align, flags, ellipsizeMode); } + + virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win) wxOVERRIDE + { return m_rendererNative.GetSplitterParams(win); } + + virtual wxRendererVersion GetVersion() const wxOVERRIDE + { return m_rendererNative.GetVersion(); } + +protected: + wxRendererNative& m_rendererNative; + + wxDECLARE_NO_COPY_CLASS(wxDelegateRendererNative); +}; + +// ---------------------------------------------------------------------------- +// inline functions implementation +// ---------------------------------------------------------------------------- + +#ifndef wxHAS_NATIVE_RENDERER + +// default native renderer is the generic one then +/* static */ inline +wxRendererNative& wxRendererNative::GetDefault() +{ + return GetGeneric(); +} + +#endif // !wxHAS_NATIVE_RENDERER + +#endif // _WX_RENDERER_H_ diff --git a/lib/wxWidgets/include/wx/ribbon/art.h b/lib/wxWidgets/include/wx/ribbon/art.h new file mode 100644 index 0000000..84dd3b8 --- /dev/null +++ b/lib/wxWidgets/include/wx/ribbon/art.h @@ -0,0 +1,969 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/ribbon/art.h +// Purpose: Art providers for ribbon-bar-style interface +// Author: Peter Cawley +// Modified by: +// Created: 2009-05-25 +// Copyright: (C) Peter Cawley +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RIBBON_ART_H_ +#define _WX_RIBBON_ART_H_ + +#include "wx/defs.h" + +#if wxUSE_RIBBON + +#include "wx/brush.h" +#include "wx/colour.h" +#include "wx/font.h" +#include "wx/pen.h" +#include "wx/bitmap.h" +#include "wx/ribbon/bar.h" + +class WXDLLIMPEXP_FWD_CORE wxDC; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +enum wxRibbonArtSetting +{ + wxRIBBON_ART_TAB_SEPARATION_SIZE, + wxRIBBON_ART_PAGE_BORDER_LEFT_SIZE, + wxRIBBON_ART_PAGE_BORDER_TOP_SIZE, + wxRIBBON_ART_PAGE_BORDER_RIGHT_SIZE, + wxRIBBON_ART_PAGE_BORDER_BOTTOM_SIZE, + wxRIBBON_ART_PANEL_X_SEPARATION_SIZE, + wxRIBBON_ART_PANEL_Y_SEPARATION_SIZE, + wxRIBBON_ART_TOOL_GROUP_SEPARATION_SIZE, + wxRIBBON_ART_GALLERY_BITMAP_PADDING_LEFT_SIZE, + wxRIBBON_ART_GALLERY_BITMAP_PADDING_RIGHT_SIZE, + wxRIBBON_ART_GALLERY_BITMAP_PADDING_TOP_SIZE, + wxRIBBON_ART_GALLERY_BITMAP_PADDING_BOTTOM_SIZE, + wxRIBBON_ART_PANEL_LABEL_FONT, + wxRIBBON_ART_BUTTON_BAR_LABEL_FONT, + wxRIBBON_ART_TAB_LABEL_FONT, + wxRIBBON_ART_BUTTON_BAR_LABEL_COLOUR, + wxRIBBON_ART_BUTTON_BAR_HOVER_BORDER_COLOUR, + wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_TOP_COLOUR, + wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR, + wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_COLOUR, + wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_GRADIENT_COLOUR, + wxRIBBON_ART_BUTTON_BAR_ACTIVE_BORDER_COLOUR, + wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_TOP_COLOUR, + wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR, + wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_COLOUR, + wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_GRADIENT_COLOUR, + wxRIBBON_ART_GALLERY_BORDER_COLOUR, + wxRIBBON_ART_GALLERY_HOVER_BACKGROUND_COLOUR, + wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_COLOUR, + wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_GRADIENT_COLOUR, + wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_TOP_COLOUR, + wxRIBBON_ART_GALLERY_BUTTON_FACE_COLOUR, + wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_COLOUR, + wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_GRADIENT_COLOUR, + wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_TOP_COLOUR, + wxRIBBON_ART_GALLERY_BUTTON_HOVER_FACE_COLOUR, + wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_COLOUR, + wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_GRADIENT_COLOUR, + wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_TOP_COLOUR, + wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_FACE_COLOUR, + wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_COLOUR, + wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_GRADIENT_COLOUR, + wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_TOP_COLOUR, + wxRIBBON_ART_GALLERY_BUTTON_DISABLED_FACE_COLOUR, + wxRIBBON_ART_GALLERY_ITEM_BORDER_COLOUR, + wxRIBBON_ART_TAB_LABEL_COLOUR, + wxRIBBON_ART_TAB_ACTIVE_LABEL_COLOUR, + wxRIBBON_ART_TAB_HOVER_LABEL_COLOUR, + wxRIBBON_ART_TAB_SEPARATOR_COLOUR, + wxRIBBON_ART_TAB_SEPARATOR_GRADIENT_COLOUR, + wxRIBBON_ART_TAB_CTRL_BACKGROUND_COLOUR, + wxRIBBON_ART_TAB_CTRL_BACKGROUND_GRADIENT_COLOUR, + wxRIBBON_ART_TAB_HOVER_BACKGROUND_TOP_COLOUR, + wxRIBBON_ART_TAB_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR, + wxRIBBON_ART_TAB_HOVER_BACKGROUND_COLOUR, + wxRIBBON_ART_TAB_HOVER_BACKGROUND_GRADIENT_COLOUR, + wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_COLOUR, + wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR, + wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_COLOUR, + wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_GRADIENT_COLOUR, + wxRIBBON_ART_TAB_BORDER_COLOUR, + wxRIBBON_ART_PANEL_BORDER_COLOUR, + wxRIBBON_ART_PANEL_BORDER_GRADIENT_COLOUR, + wxRIBBON_ART_PANEL_HOVER_BORDER_COLOUR, + wxRIBBON_ART_PANEL_HOVER_BORDER_GRADIENT_COLOUR, + wxRIBBON_ART_PANEL_MINIMISED_BORDER_COLOUR, + wxRIBBON_ART_PANEL_MINIMISED_BORDER_GRADIENT_COLOUR, + wxRIBBON_ART_PANEL_LABEL_BACKGROUND_COLOUR, + wxRIBBON_ART_PANEL_LABEL_BACKGROUND_GRADIENT_COLOUR, + wxRIBBON_ART_PANEL_LABEL_COLOUR, + wxRIBBON_ART_PANEL_HOVER_LABEL_BACKGROUND_COLOUR, + wxRIBBON_ART_PANEL_HOVER_LABEL_BACKGROUND_GRADIENT_COLOUR, + wxRIBBON_ART_PANEL_HOVER_LABEL_COLOUR, + wxRIBBON_ART_PANEL_MINIMISED_LABEL_COLOUR, + wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_TOP_COLOUR, + wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR, + wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_COLOUR, + wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_GRADIENT_COLOUR, + wxRIBBON_ART_PANEL_BUTTON_FACE_COLOUR, + wxRIBBON_ART_PANEL_BUTTON_HOVER_FACE_COLOUR, + + wxRIBBON_ART_PAGE_TOGGLE_FACE_COLOUR, + wxRIBBON_ART_PAGE_TOGGLE_HOVER_FACE_COLOUR, + + wxRIBBON_ART_PAGE_BORDER_COLOUR, + wxRIBBON_ART_PAGE_BACKGROUND_TOP_COLOUR, + wxRIBBON_ART_PAGE_BACKGROUND_TOP_GRADIENT_COLOUR, + wxRIBBON_ART_PAGE_BACKGROUND_COLOUR, + wxRIBBON_ART_PAGE_BACKGROUND_GRADIENT_COLOUR, + wxRIBBON_ART_PAGE_HOVER_BACKGROUND_TOP_COLOUR, + wxRIBBON_ART_PAGE_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR, + wxRIBBON_ART_PAGE_HOVER_BACKGROUND_COLOUR, + wxRIBBON_ART_PAGE_HOVER_BACKGROUND_GRADIENT_COLOUR, + wxRIBBON_ART_TOOLBAR_BORDER_COLOUR, + wxRIBBON_ART_TOOLBAR_HOVER_BORDER_COLOUR, + wxRIBBON_ART_TOOLBAR_FACE_COLOUR, + wxRIBBON_ART_TOOL_BACKGROUND_TOP_COLOUR, + wxRIBBON_ART_TOOL_BACKGROUND_TOP_GRADIENT_COLOUR, + wxRIBBON_ART_TOOL_BACKGROUND_COLOUR, + wxRIBBON_ART_TOOL_BACKGROUND_GRADIENT_COLOUR, + wxRIBBON_ART_TOOL_HOVER_BACKGROUND_TOP_COLOUR, + wxRIBBON_ART_TOOL_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR, + wxRIBBON_ART_TOOL_HOVER_BACKGROUND_COLOUR, + wxRIBBON_ART_TOOL_HOVER_BACKGROUND_GRADIENT_COLOUR, + wxRIBBON_ART_TOOL_ACTIVE_BACKGROUND_TOP_COLOUR, + wxRIBBON_ART_TOOL_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR, + wxRIBBON_ART_TOOL_ACTIVE_BACKGROUND_COLOUR, + wxRIBBON_ART_TOOL_ACTIVE_BACKGROUND_GRADIENT_COLOUR, + wxRIBBON_ART_BUTTON_BAR_LABEL_DISABLED_COLOUR, + wxRIBBON_ART_BUTTON_BAR_LABEL_HIGHLIGHT_COLOUR, + wxRIBBON_ART_BUTTON_BAR_LABEL_HIGHLIGHT_GRADIENT_COLOUR, + wxRIBBON_ART_BUTTON_BAR_LABEL_HIGHLIGHT_TOP_COLOUR, + wxRIBBON_ART_BUTTON_BAR_LABEL_HIGHLIGHT_GRADIENT_TOP_COLOUR +}; + +enum wxRibbonScrollButtonStyle +{ + wxRIBBON_SCROLL_BTN_LEFT = 0, + wxRIBBON_SCROLL_BTN_RIGHT = 1, + wxRIBBON_SCROLL_BTN_UP = 2, + wxRIBBON_SCROLL_BTN_DOWN = 3, + + wxRIBBON_SCROLL_BTN_DIRECTION_MASK = 3, + + wxRIBBON_SCROLL_BTN_NORMAL = 0, + wxRIBBON_SCROLL_BTN_HOVERED = 4, + wxRIBBON_SCROLL_BTN_ACTIVE = 8, + + wxRIBBON_SCROLL_BTN_STATE_MASK = 12, + + wxRIBBON_SCROLL_BTN_FOR_OTHER = 0, + wxRIBBON_SCROLL_BTN_FOR_TABS = 16, + wxRIBBON_SCROLL_BTN_FOR_PAGE = 32, + + wxRIBBON_SCROLL_BTN_FOR_MASK = 48 +}; + +enum wxRibbonButtonKind +{ + wxRIBBON_BUTTON_NORMAL = 1 << 0, + wxRIBBON_BUTTON_DROPDOWN = 1 << 1, + wxRIBBON_BUTTON_HYBRID = wxRIBBON_BUTTON_NORMAL | wxRIBBON_BUTTON_DROPDOWN, + wxRIBBON_BUTTON_TOGGLE = 1 << 2 +}; + +enum wxRibbonButtonBarButtonState +{ + wxRIBBON_BUTTONBAR_BUTTON_SMALL = 0 << 0, + wxRIBBON_BUTTONBAR_BUTTON_MEDIUM = 1 << 0, + wxRIBBON_BUTTONBAR_BUTTON_LARGE = 2 << 0, + wxRIBBON_BUTTONBAR_BUTTON_SIZE_MASK = 3 << 0, + + wxRIBBON_BUTTONBAR_BUTTON_NORMAL_HOVERED = 1 << 3, + wxRIBBON_BUTTONBAR_BUTTON_DROPDOWN_HOVERED = 1 << 4, + wxRIBBON_BUTTONBAR_BUTTON_HOVER_MASK = wxRIBBON_BUTTONBAR_BUTTON_NORMAL_HOVERED | wxRIBBON_BUTTONBAR_BUTTON_DROPDOWN_HOVERED, + wxRIBBON_BUTTONBAR_BUTTON_NORMAL_ACTIVE = 1 << 5, + wxRIBBON_BUTTONBAR_BUTTON_DROPDOWN_ACTIVE = 1 << 6, + wxRIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK = wxRIBBON_BUTTONBAR_BUTTON_NORMAL_ACTIVE | wxRIBBON_BUTTONBAR_BUTTON_DROPDOWN_ACTIVE, + wxRIBBON_BUTTONBAR_BUTTON_DISABLED = 1 << 7, + wxRIBBON_BUTTONBAR_BUTTON_TOGGLED = 1 << 8, + wxRIBBON_BUTTONBAR_BUTTON_STATE_MASK = 0x1F8 +}; + +enum wxRibbonGalleryButtonState +{ + wxRIBBON_GALLERY_BUTTON_NORMAL, + wxRIBBON_GALLERY_BUTTON_HOVERED, + wxRIBBON_GALLERY_BUTTON_ACTIVE, + wxRIBBON_GALLERY_BUTTON_DISABLED +}; + +class wxRibbonBar; +class wxRibbonPage; +class wxRibbonPanel; +class wxRibbonGallery; +class wxRibbonGalleryItem; +class wxRibbonPageTabInfo; +class wxRibbonPageTabInfoArray; + +class WXDLLIMPEXP_RIBBON wxRibbonArtProvider +{ +public: + wxRibbonArtProvider(); + virtual ~wxRibbonArtProvider(); + + virtual wxRibbonArtProvider* Clone() const = 0; + virtual void SetFlags(long flags) = 0; + virtual long GetFlags() const = 0; + + virtual int GetMetric(int id) const = 0; + virtual void SetMetric(int id, int new_val) = 0; + virtual void SetFont(int id, const wxFont& font) = 0; + virtual wxFont GetFont(int id) const = 0; + virtual wxColour GetColour(int id) const = 0; + virtual void SetColour(int id, const wxColor& colour) = 0; + wxColour GetColor(int id) const { return GetColour(id); } + void SetColor(int id, const wxColour& color) { SetColour(id, color); } + virtual void GetColourScheme(wxColour* primary, + wxColour* secondary, + wxColour* tertiary) const = 0; + virtual void SetColourScheme(const wxColour& primary, + const wxColour& secondary, + const wxColour& tertiary) = 0; + + virtual void DrawTabCtrlBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) = 0; + + virtual void DrawTab(wxDC& dc, + wxWindow* wnd, + const wxRibbonPageTabInfo& tab) = 0; + + virtual void DrawTabSeparator(wxDC& dc, + wxWindow* wnd, + const wxRect& rect, + double visibility) = 0; + + virtual void DrawPageBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) = 0; + + virtual void DrawScrollButton( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect, + long style) = 0; + + virtual void DrawPanelBackground( + wxDC& dc, + wxRibbonPanel* wnd, + const wxRect& rect) = 0; + + virtual void DrawGalleryBackground( + wxDC& dc, + wxRibbonGallery* wnd, + const wxRect& rect) = 0; + + virtual void DrawGalleryItemBackground( + wxDC& dc, + wxRibbonGallery* wnd, + const wxRect& rect, + wxRibbonGalleryItem* item) = 0; + + virtual void DrawMinimisedPanel( + wxDC& dc, + wxRibbonPanel* wnd, + const wxRect& rect, + wxBitmap& bitmap) = 0; + + virtual void DrawButtonBarBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) = 0; + + virtual void DrawButtonBarButton( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect, + wxRibbonButtonKind kind, + long state, + const wxString& label, + const wxBitmap& bitmap_large, + const wxBitmap& bitmap_small) = 0; + + virtual void DrawToolBarBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) = 0; + + virtual void DrawToolGroupBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) = 0; + + virtual void DrawTool( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect, + const wxBitmap& bitmap, + wxRibbonButtonKind kind, + long state) = 0; + + virtual void DrawToggleButton( + wxDC& dc, + wxRibbonBar* wnd, + const wxRect& rect, + wxRibbonDisplayMode mode) = 0; + + virtual void DrawHelpButton( + wxDC& dc, + wxRibbonBar* wnd, + const wxRect& rect) = 0; + + virtual void GetBarTabWidth( + wxDC& dc, + wxWindow* wnd, + const wxString& label, + const wxBitmap& bitmap, + int* ideal, + int* small_begin_need_separator, + int* small_must_have_separator, + int* minimum) = 0; + + virtual int GetTabCtrlHeight( + wxDC& dc, + wxWindow* wnd, + const wxRibbonPageTabInfoArray& pages) = 0; + + virtual wxSize GetScrollButtonMinimumSize( + wxDC& dc, + wxWindow* wnd, + long style) = 0; + + virtual wxSize GetPanelSize( + wxDC& dc, + const wxRibbonPanel* wnd, + wxSize client_size, + wxPoint* client_offset) = 0; + + virtual wxSize GetPanelClientSize( + wxDC& dc, + const wxRibbonPanel* wnd, + wxSize size, + wxPoint* client_offset) = 0; + + virtual wxRect GetPanelExtButtonArea( + wxDC& dc, + const wxRibbonPanel* wnd, + wxRect rect) = 0; + + virtual wxSize GetGallerySize( + wxDC& dc, + const wxRibbonGallery* wnd, + wxSize client_size) = 0; + + virtual wxSize GetGalleryClientSize( + wxDC& dc, + const wxRibbonGallery* wnd, + wxSize size, + wxPoint* client_offset, + wxRect* scroll_up_button, + wxRect* scroll_down_button, + wxRect* extension_button) = 0; + + virtual wxRect GetPageBackgroundRedrawArea( + wxDC& dc, + const wxRibbonPage* wnd, + wxSize page_old_size, + wxSize page_new_size) = 0; + + virtual bool GetButtonBarButtonSize( + wxDC& dc, + wxWindow* wnd, + wxRibbonButtonKind kind, + wxRibbonButtonBarButtonState size, + const wxString& label, + wxCoord text_min_width, + wxSize bitmap_size_large, + wxSize bitmap_size_small, + wxSize* button_size, + wxRect* normal_region, + wxRect* dropdown_region) = 0; + + virtual wxCoord GetButtonBarButtonTextWidth( + wxDC& dc, const wxString& label, + wxRibbonButtonKind kind, + wxRibbonButtonBarButtonState size) = 0; + + virtual wxSize GetMinimisedPanelMinimumSize( + wxDC& dc, + const wxRibbonPanel* wnd, + wxSize* desired_bitmap_size, + wxDirection* expanded_panel_direction) = 0; + + virtual wxSize GetToolSize( + wxDC& dc, + wxWindow* wnd, + wxSize bitmap_size, + wxRibbonButtonKind kind, + bool is_first, + bool is_last, + wxRect* dropdown_region) = 0; + + virtual wxRect GetBarToggleButtonArea(const wxRect& rect)= 0; + + virtual wxRect GetRibbonHelpButtonArea(const wxRect& rect) = 0; +}; + +class WXDLLIMPEXP_RIBBON wxRibbonMSWArtProvider : public wxRibbonArtProvider +{ +public: + wxRibbonMSWArtProvider(bool set_colour_scheme = true); + virtual ~wxRibbonMSWArtProvider(); + + wxRibbonArtProvider* Clone() const wxOVERRIDE; + void SetFlags(long flags) wxOVERRIDE; + long GetFlags() const wxOVERRIDE; + + int GetMetric(int id) const wxOVERRIDE; + void SetMetric(int id, int new_val) wxOVERRIDE; + void SetFont(int id, const wxFont& font) wxOVERRIDE; + wxFont GetFont(int id) const wxOVERRIDE; + wxColour GetColour(int id) const wxOVERRIDE; + void SetColour(int id, const wxColor& colour) wxOVERRIDE; + void GetColourScheme(wxColour* primary, + wxColour* secondary, + wxColour* tertiary) const wxOVERRIDE; + void SetColourScheme(const wxColour& primary, + const wxColour& secondary, + const wxColour& tertiary) wxOVERRIDE; + + int GetTabCtrlHeight( + wxDC& dc, + wxWindow* wnd, + const wxRibbonPageTabInfoArray& pages) wxOVERRIDE; + + void DrawTabCtrlBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + void DrawTab(wxDC& dc, + wxWindow* wnd, + const wxRibbonPageTabInfo& tab) wxOVERRIDE; + + void DrawTabSeparator( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect, + double visibility) wxOVERRIDE; + + void DrawPageBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + void DrawScrollButton( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect, + long style) wxOVERRIDE; + + void DrawPanelBackground( + wxDC& dc, + wxRibbonPanel* wnd, + const wxRect& rect) wxOVERRIDE; + + void DrawGalleryBackground( + wxDC& dc, + wxRibbonGallery* wnd, + const wxRect& rect) wxOVERRIDE; + + void DrawGalleryItemBackground( + wxDC& dc, + wxRibbonGallery* wnd, + const wxRect& rect, + wxRibbonGalleryItem* item) wxOVERRIDE; + + void DrawMinimisedPanel( + wxDC& dc, + wxRibbonPanel* wnd, + const wxRect& rect, + wxBitmap& bitmap) wxOVERRIDE; + + void DrawButtonBarBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + void DrawButtonBarButton( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect, + wxRibbonButtonKind kind, + long state, + const wxString& label, + const wxBitmap& bitmap_large, + const wxBitmap& bitmap_small) wxOVERRIDE; + + void DrawToolBarBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + void DrawToolGroupBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + void DrawTool( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect, + const wxBitmap& bitmap, + wxRibbonButtonKind kind, + long state) wxOVERRIDE; + + void DrawToggleButton( + wxDC& dc, + wxRibbonBar* wnd, + const wxRect& rect, + wxRibbonDisplayMode mode) wxOVERRIDE; + + void DrawHelpButton(wxDC& dc, + wxRibbonBar* wnd, + const wxRect& rect) wxOVERRIDE; + + void GetBarTabWidth( + wxDC& dc, + wxWindow* wnd, + const wxString& label, + const wxBitmap& bitmap, + int* ideal, + int* small_begin_need_separator, + int* small_must_have_separator, + int* minimum) wxOVERRIDE; + + wxSize GetScrollButtonMinimumSize( + wxDC& dc, + wxWindow* wnd, + long style) wxOVERRIDE; + + wxSize GetPanelSize( + wxDC& dc, + const wxRibbonPanel* wnd, + wxSize client_size, + wxPoint* client_offset) wxOVERRIDE; + + wxSize GetPanelClientSize( + wxDC& dc, + const wxRibbonPanel* wnd, + wxSize size, + wxPoint* client_offset) wxOVERRIDE; + + wxRect GetPanelExtButtonArea( + wxDC& dc, + const wxRibbonPanel* wnd, + wxRect rect) wxOVERRIDE; + + wxSize GetGallerySize( + wxDC& dc, + const wxRibbonGallery* wnd, + wxSize client_size) wxOVERRIDE; + + wxSize GetGalleryClientSize( + wxDC& dc, + const wxRibbonGallery* wnd, + wxSize size, + wxPoint* client_offset, + wxRect* scroll_up_button, + wxRect* scroll_down_button, + wxRect* extension_button) wxOVERRIDE; + + wxRect GetPageBackgroundRedrawArea( + wxDC& dc, + const wxRibbonPage* wnd, + wxSize page_old_size, + wxSize page_new_size) wxOVERRIDE; + + bool GetButtonBarButtonSize( + wxDC& dc, + wxWindow* wnd, + wxRibbonButtonKind kind, + wxRibbonButtonBarButtonState size, + const wxString& label, + wxCoord text_min_width, + wxSize bitmap_size_large, + wxSize bitmap_size_small, + wxSize* button_size, + wxRect* normal_region, + wxRect* dropdown_region) wxOVERRIDE; + + wxCoord GetButtonBarButtonTextWidth( + wxDC& dc, const wxString& label, + wxRibbonButtonKind kind, + wxRibbonButtonBarButtonState size) wxOVERRIDE; + + wxSize GetMinimisedPanelMinimumSize( + wxDC& dc, + const wxRibbonPanel* wnd, + wxSize* desired_bitmap_size, + wxDirection* expanded_panel_direction) wxOVERRIDE; + + wxSize GetToolSize( + wxDC& dc, + wxWindow* wnd, + wxSize bitmap_size, + wxRibbonButtonKind kind, + bool is_first, + bool is_last, + wxRect* dropdown_region) wxOVERRIDE; + + wxRect GetBarToggleButtonArea(const wxRect& rect) wxOVERRIDE; + + wxRect GetRibbonHelpButtonArea(const wxRect& rect) wxOVERRIDE; + +protected: + void ReallyDrawTabSeparator(wxWindow* wnd, const wxRect& rect, double visibility); + void DrawPartialPageBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect, + bool allow_hovered = true); + void DrawPartialPageBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect, + wxRibbonPage* page, wxPoint offset, bool hovered = false); + void DrawPanelBorder(wxDC& dc, const wxRect& rect, wxPen& primary_colour, + wxPen& secondary_colour); + void RemovePanelPadding(wxRect* rect); + void DrawDropdownArrow(wxDC& dc, int x, int y, const wxColour& colour); + void DrawGalleryBackgroundCommon(wxDC& dc, wxRibbonGallery* wnd, + const wxRect& rect); + virtual void DrawGalleryButton(wxDC& dc, wxRect rect, + wxRibbonGalleryButtonState state, wxBitmap* bitmaps); + void DrawButtonBarButtonForeground( + wxDC& dc, + const wxRect& rect, + wxRibbonButtonKind kind, + long state, + const wxString& label, + const wxBitmap& bitmap_large, + const wxBitmap& bitmap_small); + void DrawMinimisedPanelCommon( + wxDC& dc, + wxRibbonPanel* wnd, + const wxRect& rect, + wxRect* preview_rect); + void CloneTo(wxRibbonMSWArtProvider* copy) const; + + wxBitmap m_cached_tab_separator; + wxBitmap m_gallery_up_bitmap[4]; + wxBitmap m_gallery_down_bitmap[4]; + wxBitmap m_gallery_extension_bitmap[4]; + wxBitmap m_toolbar_drop_bitmap; + wxBitmap m_panel_extension_bitmap[2]; + wxBitmap m_ribbon_toggle_up_bitmap[2]; + wxBitmap m_ribbon_toggle_down_bitmap[2]; + wxBitmap m_ribbon_toggle_pin_bitmap[2]; + wxBitmap m_ribbon_bar_help_button_bitmap[2]; + + wxColour m_primary_scheme_colour; + wxColour m_secondary_scheme_colour; + wxColour m_tertiary_scheme_colour; + + wxColour m_button_bar_label_colour; + wxColour m_button_bar_label_disabled_colour; + wxColour m_tab_label_colour; + wxColour m_tab_active_label_colour; + wxColour m_tab_hover_label_colour; + wxColour m_tab_separator_colour; + wxColour m_tab_separator_gradient_colour; + wxColour m_tab_active_background_colour; + wxColour m_tab_active_background_gradient_colour; + wxColour m_tab_hover_background_colour; + wxColour m_tab_hover_background_gradient_colour; + wxColour m_tab_hover_background_top_colour; + wxColour m_tab_hover_background_top_gradient_colour; + wxColour m_tab_highlight_top_colour; + wxColour m_tab_highlight_top_gradient_colour; + wxColour m_tab_highlight_colour; + wxColour m_tab_highlight_gradient_colour; + wxColour m_panel_label_colour; + wxColour m_panel_minimised_label_colour; + wxColour m_panel_hover_label_colour; + wxColour m_panel_active_background_colour; + wxColour m_panel_active_background_gradient_colour; + wxColour m_panel_active_background_top_colour; + wxColour m_panel_active_background_top_gradient_colour; + wxColour m_panel_button_face_colour; + wxColour m_panel_button_hover_face_colour; + wxColour m_page_toggle_face_colour; + wxColour m_page_toggle_hover_face_colour; + wxColour m_page_background_colour; + wxColour m_page_background_gradient_colour; + wxColour m_page_background_top_colour; + wxColour m_page_background_top_gradient_colour; + wxColour m_page_hover_background_colour; + wxColour m_page_hover_background_gradient_colour; + wxColour m_page_hover_background_top_colour; + wxColour m_page_hover_background_top_gradient_colour; + wxColour m_button_bar_hover_background_colour; + wxColour m_button_bar_hover_background_gradient_colour; + wxColour m_button_bar_hover_background_top_colour; + wxColour m_button_bar_hover_background_top_gradient_colour; + wxColour m_button_bar_active_background_colour; + wxColour m_button_bar_active_background_gradient_colour; + wxColour m_button_bar_active_background_top_colour; + wxColour m_button_bar_active_background_top_gradient_colour; + wxColour m_gallery_button_background_colour; + wxColour m_gallery_button_background_gradient_colour; + wxColour m_gallery_button_hover_background_colour; + wxColour m_gallery_button_hover_background_gradient_colour; + wxColour m_gallery_button_active_background_colour; + wxColour m_gallery_button_active_background_gradient_colour; + wxColour m_gallery_button_disabled_background_colour; + wxColour m_gallery_button_disabled_background_gradient_colour; + wxColour m_gallery_button_face_colour; + wxColour m_gallery_button_hover_face_colour; + wxColour m_gallery_button_active_face_colour; + wxColour m_gallery_button_disabled_face_colour; + + wxColour m_tool_face_colour; + wxColour m_tool_background_top_colour; + wxColour m_tool_background_top_gradient_colour; + wxColour m_tool_background_colour; + wxColour m_tool_background_gradient_colour; + wxColour m_tool_hover_background_top_colour; + wxColour m_tool_hover_background_top_gradient_colour; + wxColour m_tool_hover_background_colour; + wxColour m_tool_hover_background_gradient_colour; + wxColour m_tool_active_background_top_colour; + wxColour m_tool_active_background_top_gradient_colour; + wxColour m_tool_active_background_colour; + wxColour m_tool_active_background_gradient_colour; + + wxBrush m_tab_ctrl_background_brush; + wxBrush m_panel_label_background_brush; + wxBrush m_panel_hover_label_background_brush; + wxBrush m_panel_hover_button_background_brush; + wxBrush m_gallery_hover_background_brush; + wxBrush m_gallery_button_background_top_brush; + wxBrush m_gallery_button_hover_background_top_brush; + wxBrush m_gallery_button_active_background_top_brush; + wxBrush m_gallery_button_disabled_background_top_brush; + wxBrush m_ribbon_toggle_brush; + + wxFont m_tab_label_font; + wxFont m_panel_label_font; + wxFont m_button_bar_label_font; + + wxPen m_page_border_pen; + wxPen m_panel_border_pen; + wxPen m_panel_border_gradient_pen; + wxPen m_panel_hover_border_pen; + wxPen m_panel_hover_border_gradient_pen; + wxPen m_panel_minimised_border_pen; + wxPen m_panel_minimised_border_gradient_pen; + wxPen m_panel_hover_button_border_pen; + wxPen m_tab_border_pen; + wxPen m_button_bar_hover_border_pen; + wxPen m_button_bar_active_border_pen; + wxPen m_gallery_border_pen; + wxPen m_gallery_item_border_pen; + wxPen m_toolbar_border_pen; + wxPen m_ribbon_toggle_pen; + + double m_cached_tab_separator_visibility; + long m_flags; + + int m_tab_separation_size; + int m_page_border_left; + int m_page_border_top; + int m_page_border_right; + int m_page_border_bottom; + int m_panel_x_separation_size; + int m_panel_y_separation_size; + int m_tool_group_separation_size; + int m_gallery_bitmap_padding_left_size; + int m_gallery_bitmap_padding_right_size; + int m_gallery_bitmap_padding_top_size; + int m_gallery_bitmap_padding_bottom_size; + int m_toggle_button_offset; + int m_help_button_offset; +}; + +class WXDLLIMPEXP_RIBBON wxRibbonAUIArtProvider : public wxRibbonMSWArtProvider +{ +public: + wxRibbonAUIArtProvider(); + virtual ~wxRibbonAUIArtProvider(); + + wxRibbonArtProvider* Clone() const wxOVERRIDE; + + wxColour GetColour(int id) const wxOVERRIDE; + void SetColour(int id, const wxColor& colour) wxOVERRIDE; + void SetColourScheme(const wxColour& primary, + const wxColour& secondary, + const wxColour& tertiary) wxOVERRIDE; + void SetFont(int id, const wxFont& font) wxOVERRIDE; + + wxSize GetScrollButtonMinimumSize( + wxDC& dc, + wxWindow* wnd, + long style) wxOVERRIDE; + + void DrawScrollButton( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect, + long style) wxOVERRIDE; + + wxSize GetPanelSize( + wxDC& dc, + const wxRibbonPanel* wnd, + wxSize client_size, + wxPoint* client_offset) wxOVERRIDE; + + wxSize GetPanelClientSize( + wxDC& dc, + const wxRibbonPanel* wnd, + wxSize size, + wxPoint* client_offset) wxOVERRIDE; + + wxRect GetPanelExtButtonArea( + wxDC& dc, + const wxRibbonPanel* wnd, + wxRect rect) wxOVERRIDE; + + void DrawTabCtrlBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + int GetTabCtrlHeight( + wxDC& dc, + wxWindow* wnd, + const wxRibbonPageTabInfoArray& pages) wxOVERRIDE; + + void GetBarTabWidth( + wxDC& dc, + wxWindow* wnd, + const wxString& label, + const wxBitmap& bitmap, + int* ideal, + int* small_begin_need_separator, + int* small_must_have_separator, + int* minimum) wxOVERRIDE; + + void DrawTab(wxDC& dc, + wxWindow* wnd, + const wxRibbonPageTabInfo& tab) wxOVERRIDE; + + void DrawTabSeparator( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect, + double visibility) wxOVERRIDE; + + void DrawPageBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + void DrawPanelBackground( + wxDC& dc, + wxRibbonPanel* wnd, + const wxRect& rect) wxOVERRIDE; + + void DrawMinimisedPanel( + wxDC& dc, + wxRibbonPanel* wnd, + const wxRect& rect, + wxBitmap& bitmap) wxOVERRIDE; + + void DrawGalleryBackground( + wxDC& dc, + wxRibbonGallery* wnd, + const wxRect& rect) wxOVERRIDE; + + void DrawGalleryItemBackground( + wxDC& dc, + wxRibbonGallery* wnd, + const wxRect& rect, + wxRibbonGalleryItem* item) wxOVERRIDE; + + void DrawButtonBarBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + void DrawButtonBarButton( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect, + wxRibbonButtonKind kind, + long state, + const wxString& label, + const wxBitmap& bitmap_large, + const wxBitmap& bitmap_small) wxOVERRIDE; + + void DrawToolBarBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + void DrawToolGroupBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + void DrawTool( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect, + const wxBitmap& bitmap, + wxRibbonButtonKind kind, + long state) wxOVERRIDE; + +protected: + void DrawPartialPanelBackground(wxDC& dc, wxWindow* wnd, + const wxRect& rect); + void DrawGalleryButton(wxDC& dc, wxRect rect, + wxRibbonGalleryButtonState state, wxBitmap* bitmaps) wxOVERRIDE; + + wxColour m_tab_ctrl_background_colour; + wxColour m_tab_ctrl_background_gradient_colour; + wxColour m_panel_label_background_colour; + wxColour m_panel_label_background_gradient_colour; + wxColour m_panel_hover_label_background_colour; + wxColour m_panel_hover_label_background_gradient_colour; + + wxBrush m_background_brush; + wxBrush m_tab_active_top_background_brush; + wxBrush m_tab_hover_background_brush; + wxBrush m_button_bar_hover_background_brush; + wxBrush m_button_bar_active_background_brush; + wxBrush m_gallery_button_active_background_brush; + wxBrush m_gallery_button_hover_background_brush; + wxBrush m_gallery_button_disabled_background_brush; + wxBrush m_tool_hover_background_brush; + wxBrush m_tool_active_background_brush; + + wxPen m_toolbar_hover_borden_pen; + + wxFont m_tab_active_label_font; +}; + +#if defined(__WXMSW__) +typedef wxRibbonMSWArtProvider wxRibbonDefaultArtProvider; +#elif defined(__WXOSX_COCOA__) || \ + defined(__WXOSX_IPHONE__) +// TODO: Once implemented, change typedef to OSX +// typedef wxRibbonOSXArtProvider wxRibbonDefaultArtProvider; +typedef wxRibbonAUIArtProvider wxRibbonDefaultArtProvider; +#else +// TODO: Once implemented, change typedef to AUI +typedef wxRibbonAUIArtProvider wxRibbonDefaultArtProvider; +#endif + +#endif // wxUSE_RIBBON + +#endif // _WX_RIBBON_ART_H_ diff --git a/lib/wxWidgets/include/wx/ribbon/art_internal.h b/lib/wxWidgets/include/wx/ribbon/art_internal.h new file mode 100644 index 0000000..879b22d --- /dev/null +++ b/lib/wxWidgets/include/wx/ribbon/art_internal.h @@ -0,0 +1,81 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/ribbon/art_internal.h +// Purpose: Helper functions & classes used by ribbon art providers +// Author: Peter Cawley +// Modified by: +// Created: 2009-08-04 +// Copyright: (C) Peter Cawley +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RIBBON_ART_INTERNAL_H_ +#define _WX_RIBBON_ART_INTERNAL_H_ + +#include "wx/defs.h" + +#if wxUSE_RIBBON + +WXDLLIMPEXP_RIBBON wxColour wxRibbonInterpolateColour( + const wxColour& start_colour, + const wxColour& end_colour, + int position, + int start_position, + int end_position); + +WXDLLIMPEXP_RIBBON bool wxRibbonCanLabelBreakAtPosition( + const wxString& label, + size_t pos); + +WXDLLIMPEXP_RIBBON void wxRibbonDrawParallelGradientLines( + wxDC& dc, + int nlines, + const wxPoint* line_origins, + int stepx, + int stepy, + int numsteps, + int offset_x, + int offset_y, + const wxColour& start_colour, + const wxColour& end_colour); + +WXDLLIMPEXP_RIBBON wxBitmap wxRibbonLoadPixmap( + const char* const* bits, + wxColour fore); + +/* + HSL colour class, using interface as discussed in wx-dev. Provided mainly + for art providers to perform colour scheme calculations in the HSL colour + space. If such a class makes it into base / core, then this class should be + removed and users switched over to the one in base / core. + + 0.0 <= Hue < 360.0 + 0.0 <= Saturation <= 1.0 + 0.0 <= Luminance <= 1.0 +*/ +class WXDLLIMPEXP_RIBBON wxRibbonHSLColour +{ +public: + wxRibbonHSLColour() + : hue(0.0), saturation(0.0), luminance(0.0) {} + wxRibbonHSLColour(float H, float S, float L) + : hue(H), saturation(S), luminance(L) { } + wxRibbonHSLColour(const wxColour& C); + + wxColour ToRGB() const; + + wxRibbonHSLColour& MakeDarker(float delta); + wxRibbonHSLColour Darker(float delta) const; + wxRibbonHSLColour Lighter(float delta) const; + wxRibbonHSLColour Saturated(float delta) const; + wxRibbonHSLColour Desaturated(float delta) const; + wxRibbonHSLColour ShiftHue(float delta) const; + + float hue, saturation, luminance; +}; + +WXDLLIMPEXP_RIBBON wxRibbonHSLColour wxRibbonShiftLuminance( + wxRibbonHSLColour colour, float amount); + +#endif // wxUSE_RIBBON + +#endif // _WX_RIBBON_ART_INTERNAL_H_ diff --git a/lib/wxWidgets/include/wx/ribbon/bar.h b/lib/wxWidgets/include/wx/ribbon/bar.h new file mode 100644 index 0000000..142e1ba --- /dev/null +++ b/lib/wxWidgets/include/wx/ribbon/bar.h @@ -0,0 +1,302 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/ribbon/bar.h +// Purpose: Top-level component of the ribbon-bar-style interface +// Author: Peter Cawley +// Modified by: +// Created: 2009-05-23 +// Copyright: (C) Peter Cawley +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RIBBON_BAR_H_ +#define _WX_RIBBON_BAR_H_ + +#include "wx/defs.h" + +#if wxUSE_RIBBON + +class WXDLLIMPEXP_FWD_CORE wxImageList; + +#include "wx/ribbon/control.h" +#include "wx/ribbon/page.h" + +#include "wx/vector.h" + +enum wxRibbonBarOption +{ + wxRIBBON_BAR_SHOW_PAGE_LABELS = 1 << 0, + wxRIBBON_BAR_SHOW_PAGE_ICONS = 1 << 1, + wxRIBBON_BAR_FLOW_HORIZONTAL = 0, + wxRIBBON_BAR_FLOW_VERTICAL = 1 << 2, + wxRIBBON_BAR_SHOW_PANEL_EXT_BUTTONS = 1 << 3, + wxRIBBON_BAR_SHOW_PANEL_MINIMISE_BUTTONS = 1 << 4, + wxRIBBON_BAR_ALWAYS_SHOW_TABS = 1 << 5, + wxRIBBON_BAR_SHOW_TOGGLE_BUTTON = 1 << 6, + wxRIBBON_BAR_SHOW_HELP_BUTTON = 1 << 7, + + wxRIBBON_BAR_DEFAULT_STYLE = wxRIBBON_BAR_FLOW_HORIZONTAL + | wxRIBBON_BAR_SHOW_PAGE_LABELS + | wxRIBBON_BAR_SHOW_PANEL_EXT_BUTTONS + | wxRIBBON_BAR_SHOW_TOGGLE_BUTTON + | wxRIBBON_BAR_SHOW_HELP_BUTTON, + + wxRIBBON_BAR_FOLDBAR_STYLE = wxRIBBON_BAR_FLOW_VERTICAL + | wxRIBBON_BAR_SHOW_PAGE_ICONS + | wxRIBBON_BAR_SHOW_PANEL_EXT_BUTTONS + | wxRIBBON_BAR_SHOW_PANEL_MINIMISE_BUTTONS +}; + +enum wxRibbonDisplayMode +{ + wxRIBBON_BAR_PINNED, + wxRIBBON_BAR_MINIMIZED, + wxRIBBON_BAR_EXPANDED +}; + +class WXDLLIMPEXP_RIBBON wxRibbonBarEvent : public wxNotifyEvent +{ +public: + wxRibbonBarEvent(wxEventType command_type = wxEVT_NULL, + int win_id = 0, + wxRibbonPage* page = NULL) + : wxNotifyEvent(command_type, win_id) + , m_page(page) + { + } + wxEvent *Clone() const wxOVERRIDE { return new wxRibbonBarEvent(*this); } + + wxRibbonPage* GetPage() {return m_page;} + void SetPage(wxRibbonPage* page) {m_page = page;} + +protected: + wxRibbonPage* m_page; + +#ifndef SWIG +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxRibbonBarEvent); +#endif +}; + +class WXDLLIMPEXP_RIBBON wxRibbonPageTabInfo +{ +public: + wxRect rect; + wxRibbonPage *page; + int ideal_width; + int small_begin_need_separator_width; + int small_must_have_separator_width; + int minimum_width; + bool active; + bool hovered; + bool highlight; + bool shown; +}; + +#ifndef SWIG +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxRibbonPageTabInfo, wxRibbonPageTabInfoArray, WXDLLIMPEXP_RIBBON); +#endif + +class WXDLLIMPEXP_RIBBON wxRibbonBar : public wxRibbonControl +{ +public: + wxRibbonBar(); + + wxRibbonBar(wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxRIBBON_BAR_DEFAULT_STYLE); + + virtual ~wxRibbonBar(); + + bool Create(wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxRIBBON_BAR_DEFAULT_STYLE); + + void SetTabCtrlMargins(int left, int right); + + void SetArtProvider(wxRibbonArtProvider* art) wxOVERRIDE; + + bool SetActivePage(size_t page); + bool SetActivePage(wxRibbonPage* page); + int GetActivePage() const; + wxRibbonPage* GetPage(int n); + size_t GetPageCount() const; + bool DismissExpandedPanel(); + int GetPageNumber(wxRibbonPage* page) const; + + void DeletePage(size_t n); + void ClearPages(); + + bool IsPageShown(size_t page) const; + void ShowPage(size_t page, bool show = true); + void HidePage(size_t page) { ShowPage(page, false); } + + bool IsPageHighlighted(size_t page) const; + void AddPageHighlight(size_t page, bool highlight = true); + void RemovePageHighlight(size_t page) { AddPageHighlight(page, false); } + + void ShowPanels(wxRibbonDisplayMode mode); + void ShowPanels(bool show = true); + void HidePanels() { ShowPanels(wxRIBBON_BAR_MINIMIZED); } + bool ArePanelsShown() const { return m_arePanelsShown; } + wxRibbonDisplayMode GetDisplayMode() const { return m_ribbon_state; } + + virtual bool HasMultiplePages() const wxOVERRIDE { return true; } + + void SetWindowStyleFlag(long style) wxOVERRIDE; + long GetWindowStyleFlag() const wxOVERRIDE; + virtual bool Realize() wxOVERRIDE; + + // Implementation only. + bool IsToggleButtonHovered() const { return m_toggle_button_hovered; } + bool IsHelpButtonHovered() const { return m_help_button_hovered; } + + void HideIfExpanded(); + + // Return the image list containing images of the given size, creating it + // if necessary. + wxImageList* GetButtonImageList(wxSize size); + +protected: + friend class wxRibbonPage; + + virtual wxSize DoGetBestSize() const wxOVERRIDE; + wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + wxRibbonPageTabInfo* HitTestTabs(wxPoint position, int* index = NULL); + void HitTestRibbonButton(const wxRect& rect, const wxPoint& position, bool &hover_flag); + + void CommonInit(long style); + void AddPage(wxRibbonPage *page); + void RecalculateTabSizes(); + void RecalculateMinSize(); + void ScrollTabBar(int npixels); + void RefreshTabBar(); + void RepositionPage(wxRibbonPage *page); + + void OnPaint(wxPaintEvent& evt); + void OnEraseBackground(wxEraseEvent& evt); + void DoEraseBackground(wxDC& dc); + void OnSize(wxSizeEvent& evt); + void OnMouseLeftDown(wxMouseEvent& evt); + void OnMouseLeftUp(wxMouseEvent& evt); + void OnMouseMiddleDown(wxMouseEvent& evt); + void OnMouseMiddleUp(wxMouseEvent& evt); + void OnMouseRightDown(wxMouseEvent& evt); + void OnMouseRightUp(wxMouseEvent& evt); + void OnMouseMove(wxMouseEvent& evt); + void OnMouseLeave(wxMouseEvent& evt); + void OnMouseDoubleClick(wxMouseEvent& evt); + void DoMouseButtonCommon(wxMouseEvent& evt, wxEventType tab_event_type); + void OnKillFocus(wxFocusEvent& evt); + + wxRibbonPageTabInfoArray m_pages; + wxRect m_tab_scroll_left_button_rect; + wxRect m_tab_scroll_right_button_rect; + wxRect m_toggle_button_rect; + wxRect m_help_button_rect; + long m_flags; + int m_tabs_total_width_ideal; + int m_tabs_total_width_minimum; + int m_tab_margin_left; + int m_tab_margin_right; + int m_tab_height; + int m_tab_scroll_amount; + int m_current_page; + int m_current_hovered_page; + int m_tab_scroll_left_button_state; + int m_tab_scroll_right_button_state; + bool m_tab_scroll_buttons_shown; + bool m_arePanelsShown; + bool m_bar_hovered; + bool m_toggle_button_hovered; + bool m_help_button_hovered; + + wxRibbonDisplayMode m_ribbon_state; + + wxVector<wxImageList*> m_image_lists; + +#ifndef SWIG + wxDECLARE_CLASS(wxRibbonBar); + wxDECLARE_EVENT_TABLE(); +#endif +}; + +#ifndef SWIG + +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONBAR_PAGE_CHANGED, wxRibbonBarEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONBAR_PAGE_CHANGING, wxRibbonBarEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONBAR_TAB_MIDDLE_DOWN, wxRibbonBarEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONBAR_TAB_MIDDLE_UP, wxRibbonBarEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONBAR_TAB_RIGHT_DOWN, wxRibbonBarEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONBAR_TAB_RIGHT_UP, wxRibbonBarEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONBAR_TAB_LEFT_DCLICK, wxRibbonBarEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONBAR_TOGGLED, wxRibbonBarEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONBAR_HELP_CLICK, wxRibbonBarEvent); + +typedef void (wxEvtHandler::*wxRibbonBarEventFunction)(wxRibbonBarEvent&); + +#define wxRibbonBarEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxRibbonBarEventFunction, func) + +#define EVT_RIBBONBAR_PAGE_CHANGED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_RIBBONBAR_PAGE_CHANGED, winid, wxRibbonBarEventHandler(fn)) +#define EVT_RIBBONBAR_PAGE_CHANGING(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_RIBBONBAR_PAGE_CHANGING, winid, wxRibbonBarEventHandler(fn)) +#define EVT_RIBBONBAR_TAB_MIDDLE_DOWN(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_RIBBONBAR_TAB_MIDDLE_DOWN, winid, wxRibbonBarEventHandler(fn)) +#define EVT_RIBBONBAR_TAB_MIDDLE_UP(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_RIBBONBAR_TAB_MIDDLE_UP, winid, wxRibbonBarEventHandler(fn)) +#define EVT_RIBBONBAR_TAB_RIGHT_DOWN(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_RIBBONBAR_TAB_RIGHT_DOWN, winid, wxRibbonBarEventHandler(fn)) +#define EVT_RIBBONBAR_TAB_RIGHT_UP(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_RIBBONBAR_TAB_RIGHT_UP, winid, wxRibbonBarEventHandler(fn)) +#define EVT_RIBBONBAR_TAB_LEFT_DCLICK(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_RIBBONBAR_TAB_LEFT_DCLICK, winid, wxRibbonBarEventHandler(fn)) +#define EVT_RIBBONBAR_TOGGLED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_RIBBONBAR_TOGGLED, winid, wxRibbonBarEventHandler(fn)) +#define EVT_RIBBONBAR_HELP_CLICK(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_RIBBONBAR_HELP_CLICK, winid, wxRibbonBarEventHandler(fn)) +#else + +// wxpython/swig event work +%constant wxEventType wxEVT_RIBBONBAR_PAGE_CHANGED; +%constant wxEventType wxEVT_RIBBONBAR_PAGE_CHANGING; +%constant wxEventType wxEVT_RIBBONBAR_TAB_MIDDLE_DOWN; +%constant wxEventType wxEVT_RIBBONBAR_TAB_MIDDLE_UP; +%constant wxEventType wxEVT_RIBBONBAR_TAB_RIGHT_DOWN; +%constant wxEventType wxEVT_RIBBONBAR_TAB_RIGHT_UP; +%constant wxEventType wxEVT_RIBBONBAR_TAB_LEFT_DCLICK; +%constant wxEventType wxEVT_RIBBONBAR_TOGGLED; +%constant wxEventType wxEVT_RIBBONBAR_HELP_CLICK; + +%pythoncode { + EVT_RIBBONBAR_PAGE_CHANGED = wx.PyEventBinder( wxEVT_RIBBONBAR_PAGE_CHANGED, 1 ) + EVT_RIBBONBAR_PAGE_CHANGING = wx.PyEventBinder( wxEVT_RIBBONBAR_PAGE_CHANGING, 1 ) + EVT_RIBBONBAR_TAB_MIDDLE_DOWN = wx.PyEventBinder( wxEVT_RIBBONBAR_TAB_MIDDLE_DOWN, 1 ) + EVT_RIBBONBAR_TAB_MIDDLE_UP = wx.PyEventBinder( wxEVT_RIBBONBAR_TAB_MIDDLE_UP, 1 ) + EVT_RIBBONBAR_TAB_RIGHT_DOWN = wx.PyEventBinder( wxEVT_RIBBONBAR_TAB_RIGHT_DOWN, 1 ) + EVT_RIBBONBAR_TAB_RIGHT_UP = wx.PyEventBinder( wxEVT_RIBBONBAR_TAB_RIGHT_UP, 1 ) + EVT_RIBBONBAR_TAB_LEFT_DCLICK = wx.PyEventBinder( wxEVT_RIBBONBAR_TAB_LEFT_DCLICK, 1 ) + EVT_RIBBONBAR_TOGGLED = wx.PyEventBinder( wxEVT_RIBBONBAR_TOGGLED, 1 ) + EVT_RIBBONBAR_HELP_CLICK = wx.PyEventBinder( wxEVT_RIBBONBAR_HELP_CLICK, 1 ) +} +#endif + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_RIBBONBAR_PAGE_CHANGED wxEVT_RIBBONBAR_PAGE_CHANGED +#define wxEVT_COMMAND_RIBBONBAR_PAGE_CHANGING wxEVT_RIBBONBAR_PAGE_CHANGING +#define wxEVT_COMMAND_RIBBONBAR_TAB_MIDDLE_DOWN wxEVT_RIBBONBAR_TAB_MIDDLE_DOWN +#define wxEVT_COMMAND_RIBBONBAR_TAB_MIDDLE_UP wxEVT_RIBBONBAR_TAB_MIDDLE_UP +#define wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_DOWN wxEVT_RIBBONBAR_TAB_RIGHT_DOWN +#define wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_UP wxEVT_RIBBONBAR_TAB_RIGHT_UP +#define wxEVT_COMMAND_RIBBONBAR_TAB_LEFT_DCLICK wxEVT_RIBBONBAR_TAB_LEFT_DCLICK +#define wxEVT_COMMAND_RIBBONBAR_TOGGLED wxEVT_RIBBONBAR_TOGGLED +#define wxEVT_COMMAND_RIBBONBAR_HELP_CLICKED wxEVT_RIBBONBAR_HELP_CLICK + +#endif // wxUSE_RIBBON + +#endif // _WX_RIBBON_BAR_H_ + diff --git a/lib/wxWidgets/include/wx/ribbon/buttonbar.h b/lib/wxWidgets/include/wx/ribbon/buttonbar.h new file mode 100644 index 0000000..7a57da6 --- /dev/null +++ b/lib/wxWidgets/include/wx/ribbon/buttonbar.h @@ -0,0 +1,282 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/ribbon/buttonbar.h +// Purpose: Ribbon control similar to a tool bar +// Author: Peter Cawley +// Modified by: +// Created: 2009-07-01 +// Copyright: (C) Peter Cawley +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// +#ifndef _WX_RIBBON_BUTTON_BAR_H_ +#define _WX_RIBBON_BUTTON_BAR_H_ + +#include "wx/defs.h" + +#if wxUSE_RIBBON + +#include "wx/ribbon/art.h" +#include "wx/ribbon/control.h" +#include "wx/dynarray.h" + +class wxRibbonButtonBar; +class wxRibbonButtonBarButtonBase; +class wxRibbonButtonBarLayout; +class wxRibbonButtonBarButtonInstance; + +WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxRibbonButtonBarLayout*, wxArrayRibbonButtonBarLayout, class WXDLLIMPEXP_RIBBON); +WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxRibbonButtonBarButtonBase*, wxArrayRibbonButtonBarButtonBase, class WXDLLIMPEXP_RIBBON); + +class WXDLLIMPEXP_RIBBON wxRibbonButtonBar : public wxRibbonControl +{ +public: + wxRibbonButtonBar(); + + wxRibbonButtonBar(wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0); + + virtual ~wxRibbonButtonBar(); + + bool Create(wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0); + + virtual wxRibbonButtonBarButtonBase* AddButton( + int button_id, + const wxString& label, + const wxBitmap& bitmap, + const wxString& help_string, + wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL); + // NB: help_string cannot be optional as that would cause the signature + // to be identical to the full version of AddButton when 3 arguments are + // given. + + virtual wxRibbonButtonBarButtonBase* AddDropdownButton( + int button_id, + const wxString& label, + const wxBitmap& bitmap, + const wxString& help_string = wxEmptyString); + + virtual wxRibbonButtonBarButtonBase* AddHybridButton( + int button_id, + const wxString& label, + const wxBitmap& bitmap, + const wxString& help_string = wxEmptyString); + + virtual wxRibbonButtonBarButtonBase* AddToggleButton( + int button_id, + const wxString& label, + const wxBitmap& bitmap, + const wxString& help_string = wxEmptyString); + + virtual wxRibbonButtonBarButtonBase* AddButton( + int button_id, + const wxString& label, + const wxBitmap& bitmap, + const wxBitmap& bitmap_small = wxNullBitmap, + const wxBitmap& bitmap_disabled = wxNullBitmap, + const wxBitmap& bitmap_small_disabled = wxNullBitmap, + wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL, + const wxString& help_string = wxEmptyString); + + virtual wxRibbonButtonBarButtonBase* InsertButton( + size_t pos, + int button_id, + const wxString& label, + const wxBitmap& bitmap, + const wxString& help_string, + wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL); + + virtual wxRibbonButtonBarButtonBase* InsertDropdownButton( + size_t pos, + int button_id, + const wxString& label, + const wxBitmap& bitmap, + const wxString& help_string = wxEmptyString); + + virtual wxRibbonButtonBarButtonBase* InsertHybridButton( + size_t pos, + int button_id, + const wxString& label, + const wxBitmap& bitmap, + const wxString& help_string = wxEmptyString); + + virtual wxRibbonButtonBarButtonBase* InsertToggleButton( + size_t pos, + int button_id, + const wxString& label, + const wxBitmap& bitmap, + const wxString& help_string = wxEmptyString); + + virtual wxRibbonButtonBarButtonBase* InsertButton( + size_t pos, + int button_id, + const wxString& label, + const wxBitmap& bitmap, + const wxBitmap& bitmap_small = wxNullBitmap, + const wxBitmap& bitmap_disabled = wxNullBitmap, + const wxBitmap& bitmap_small_disabled = wxNullBitmap, + wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL, + const wxString& help_string = wxEmptyString); + + void SetItemClientObject(wxRibbonButtonBarButtonBase* item, wxClientData* data); + wxClientData* GetItemClientObject(const wxRibbonButtonBarButtonBase* item) const; + void SetItemClientData(wxRibbonButtonBarButtonBase* item, void* data); + void* GetItemClientData(const wxRibbonButtonBarButtonBase* item) const; + + virtual size_t GetButtonCount() const; + virtual wxRibbonButtonBarButtonBase *GetItem(size_t n) const; + virtual wxRibbonButtonBarButtonBase *GetItemById(int id) const; + virtual int GetItemId(wxRibbonButtonBarButtonBase *button) const; + virtual wxRect GetItemRect(int button_id) const; + + + virtual bool Realize() wxOVERRIDE; + virtual void ClearButtons(); + virtual bool DeleteButton(int button_id); + virtual void EnableButton(int button_id, bool enable = true); + virtual void ToggleButton(int button_id, bool checked); + + virtual void SetButtonIcon( + int button_id, + const wxBitmap& bitmap, + const wxBitmap& bitmap_small = wxNullBitmap, + const wxBitmap& bitmap_disabled = wxNullBitmap, + const wxBitmap& bitmap_small_disabled = wxNullBitmap); + + virtual void SetButtonText(int button_id, const wxString& label); + virtual void SetButtonTextMinWidth(int button_id, + int min_width_medium, int min_width_large); + virtual void SetButtonTextMinWidth(int button_id, const wxString& label); + virtual void SetButtonMinSizeClass(int button_id, + wxRibbonButtonBarButtonState min_size_class); + virtual void SetButtonMaxSizeClass(int button_id, + wxRibbonButtonBarButtonState max_size_class); + + virtual wxRibbonButtonBarButtonBase *GetActiveItem() const; + virtual wxRibbonButtonBarButtonBase *GetHoveredItem() const; + + virtual void SetArtProvider(wxRibbonArtProvider* art) wxOVERRIDE; + virtual bool IsSizingContinuous() const wxOVERRIDE; + + virtual wxSize GetMinSize() const wxOVERRIDE; + + void SetShowToolTipsForDisabled(bool show); + bool GetShowToolTipsForDisabled() const; + +protected: + friend class wxRibbonButtonBarEvent; + virtual wxSize DoGetBestSize() const wxOVERRIDE; + wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + + void OnEraseBackground(wxEraseEvent& evt); + void OnPaint(wxPaintEvent& evt); + void OnSize(wxSizeEvent& evt); + void OnMouseMove(wxMouseEvent& evt); + void OnMouseEnter(wxMouseEvent& evt); + void OnMouseLeave(wxMouseEvent& evt); + void OnMouseDown(wxMouseEvent& evt); + void OnMouseUp(wxMouseEvent& evt); + + virtual wxSize DoGetNextSmallerSize(wxOrientation direction, + wxSize relative_to) const wxOVERRIDE; + virtual wxSize DoGetNextLargerSize(wxOrientation direction, + wxSize relative_to) const wxOVERRIDE; + + void CommonInit(long style); + void MakeLayouts(); + void TryCollapseLayout(wxRibbonButtonBarLayout* original, + size_t first_btn, size_t* last_button, + wxRibbonButtonBarButtonState target_size); + void FetchButtonSizeInfo(wxRibbonButtonBarButtonBase* button, + wxRibbonButtonBarButtonState size, wxDC& dc); + virtual void UpdateWindowUI(long flags) wxOVERRIDE; + + wxArrayRibbonButtonBarLayout m_layouts; + wxArrayRibbonButtonBarButtonBase m_buttons; + wxRibbonButtonBarButtonInstance* m_hovered_button; + wxRibbonButtonBarButtonInstance* m_active_button; + + wxPoint m_layout_offset; + wxSize m_bitmap_size_large; + wxSize m_bitmap_size_small; + int m_current_layout; + bool m_layouts_valid; + bool m_lock_active_state; + bool m_show_tooltips_for_disabled; + +private: + wxRibbonBar* m_ribbonBar; + +#ifndef SWIG + wxDECLARE_CLASS(wxRibbonButtonBar); + wxDECLARE_EVENT_TABLE(); +#endif +}; + +class WXDLLIMPEXP_RIBBON wxRibbonButtonBarEvent : public wxCommandEvent +{ +public: + wxRibbonButtonBarEvent(wxEventType command_type = wxEVT_NULL, + int win_id = 0, + wxRibbonButtonBar* bar = NULL, + wxRibbonButtonBarButtonBase* button = NULL) + : wxCommandEvent(command_type, win_id) + , m_bar(bar), m_button(button) + { + } + wxEvent *Clone() const wxOVERRIDE { return new wxRibbonButtonBarEvent(*this); } + + wxRibbonButtonBar* GetBar() {return m_bar;} + wxRibbonButtonBarButtonBase *GetButton() { return m_button; } + void SetBar(wxRibbonButtonBar* bar) {m_bar = bar;} + void SetButton(wxRibbonButtonBarButtonBase* button) { m_button = button; } + bool PopupMenu(wxMenu* menu); + +protected: + wxRibbonButtonBar* m_bar; + wxRibbonButtonBarButtonBase *m_button; + +#ifndef SWIG +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxRibbonButtonBarEvent); +#endif +}; + +#ifndef SWIG + +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONBUTTONBAR_CLICKED, wxRibbonButtonBarEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED, wxRibbonButtonBarEvent); + +typedef void (wxEvtHandler::*wxRibbonButtonBarEventFunction)(wxRibbonButtonBarEvent&); + +#define wxRibbonButtonBarEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxRibbonButtonBarEventFunction, func) + +#define EVT_RIBBONBUTTONBAR_CLICKED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_RIBBONBUTTONBAR_CLICKED, winid, wxRibbonButtonBarEventHandler(fn)) +#define EVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED, winid, wxRibbonButtonBarEventHandler(fn)) +#else + +// wxpython/swig event work +%constant wxEventType wxEVT_RIBBONBUTTONBAR_CLICKED; +%constant wxEventType wxEVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED; + +%pythoncode { + EVT_RIBBONBUTTONBAR_CLICKED = wx.PyEventBinder( wxEVT_RIBBONBUTTONBAR_CLICKED, 1 ) + EVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED = wx.PyEventBinder( wxEVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED, 1 ) +} +#endif + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_RIBBONBUTTON_CLICKED wxEVT_RIBBONBUTTONBAR_CLICKED +#define wxEVT_COMMAND_RIBBONBUTTON_DROPDOWN_CLICKED wxEVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED + +#endif // wxUSE_RIBBON + +#endif // _WX_RIBBON_BUTTON_BAR_H_ diff --git a/lib/wxWidgets/include/wx/ribbon/control.h b/lib/wxWidgets/include/wx/ribbon/control.h new file mode 100644 index 0000000..4fd3e50 --- /dev/null +++ b/lib/wxWidgets/include/wx/ribbon/control.h @@ -0,0 +1,83 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/ribbon/control.h +// Purpose: Extension of wxControl with common ribbon methods +// Author: Peter Cawley +// Modified by: +// Created: 2009-06-05 +// Copyright: (C) Peter Cawley +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RIBBON_CONTROL_H_ +#define _WX_RIBBON_CONTROL_H_ + +#include "wx/defs.h" + +#if wxUSE_RIBBON + +#include "wx/control.h" +#include "wx/dynarray.h" + +class wxRibbonBar; +class wxRibbonArtProvider; + +class WXDLLIMPEXP_RIBBON wxRibbonControl : public wxControl +{ +public: + wxRibbonControl() { Init(); } + + wxRibbonControl(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxControlNameStr)) + { + Init(); + + Create(parent, id, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxControlNameStr)); + + virtual void SetArtProvider(wxRibbonArtProvider* art); + wxRibbonArtProvider* GetArtProvider() const {return m_art;} + + virtual bool IsSizingContinuous() const {return true;} + wxSize GetNextSmallerSize(wxOrientation direction, wxSize relative_to) const; + wxSize GetNextLargerSize(wxOrientation direction, wxSize relative_to) const; + wxSize GetNextSmallerSize(wxOrientation direction) const; + wxSize GetNextLargerSize(wxOrientation direction) const; + + virtual bool Realize(); + bool Realise() {return Realize();} + + virtual wxRibbonBar* GetAncestorRibbonBar()const; + + // Finds the best width and height given the parent's width and height + virtual wxSize GetBestSizeForParentSize(const wxSize& WXUNUSED(parentSize)) const { return GetBestSize(); } + +protected: + wxRibbonArtProvider* m_art; + + virtual wxSize DoGetNextSmallerSize(wxOrientation direction, + wxSize relative_to) const; + virtual wxSize DoGetNextLargerSize(wxOrientation direction, + wxSize relative_to) const; + +private: + void Init() { m_art = NULL; } + +#ifndef SWIG + wxDECLARE_CLASS(wxRibbonControl); +#endif +}; + +WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxRibbonControl*, wxArrayRibbonControl, class WXDLLIMPEXP_RIBBON); + +#endif // wxUSE_RIBBON + +#endif // _WX_RIBBON_CONTROL_H_ diff --git a/lib/wxWidgets/include/wx/ribbon/gallery.h b/lib/wxWidgets/include/wx/ribbon/gallery.h new file mode 100644 index 0000000..cf7b987 --- /dev/null +++ b/lib/wxWidgets/include/wx/ribbon/gallery.h @@ -0,0 +1,199 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/ribbon/gallery.h +// Purpose: Ribbon control which displays a gallery of items to choose from +// Author: Peter Cawley +// Modified by: +// Created: 2009-07-22 +// Copyright: (C) Peter Cawley +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// +#ifndef _WX_RIBBON_GALLERY_H_ +#define _WX_RIBBON_GALLERY_H_ + +#include "wx/defs.h" + +#if wxUSE_RIBBON + +#include "wx/ribbon/art.h" +#include "wx/ribbon/control.h" + +class wxRibbonGalleryItem; + +WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxRibbonGalleryItem*, wxArrayRibbonGalleryItem, class WXDLLIMPEXP_RIBBON); + +class WXDLLIMPEXP_RIBBON wxRibbonGallery : public wxRibbonControl +{ +public: + wxRibbonGallery(); + + wxRibbonGallery(wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0); + + virtual ~wxRibbonGallery(); + + bool Create(wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0); + + void Clear(); + + bool IsEmpty() const; + unsigned int GetCount() const; + wxRibbonGalleryItem* GetItem(unsigned int n); + wxRibbonGalleryItem* Append(const wxBitmap& bitmap, int id); + wxRibbonGalleryItem* Append(const wxBitmap& bitmap, int id, void* clientData); + wxRibbonGalleryItem* Append(const wxBitmap& bitmap, int id, wxClientData* clientData); + + void SetItemClientObject(wxRibbonGalleryItem* item, wxClientData* data); + wxClientData* GetItemClientObject(const wxRibbonGalleryItem* item) const; + void SetItemClientData(wxRibbonGalleryItem* item, void* data); + void* GetItemClientData(const wxRibbonGalleryItem* item) const; + + void SetSelection(wxRibbonGalleryItem* item); + wxRibbonGalleryItem* GetSelection() const; + wxRibbonGalleryItem* GetHoveredItem() const; + wxRibbonGalleryItem* GetActiveItem() const; + wxRibbonGalleryButtonState GetUpButtonState() const; + wxRibbonGalleryButtonState GetDownButtonState() const; + wxRibbonGalleryButtonState GetExtensionButtonState() const; + + bool IsHovered() const; + virtual bool IsSizingContinuous() const wxOVERRIDE; + virtual bool Realize() wxOVERRIDE; + virtual bool Layout() wxOVERRIDE; + + virtual bool ScrollLines(int lines) wxOVERRIDE; + bool ScrollPixels(int pixels); + void EnsureVisible(const wxRibbonGalleryItem* item); + +protected: + wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + void CommonInit(long style); + void CalculateMinSize(); + bool TestButtonHover(const wxRect& rect, wxPoint pos, + wxRibbonGalleryButtonState* state); + + void OnEraseBackground(wxEraseEvent& evt); + void OnMouseEnter(wxMouseEvent& evt); + void OnMouseMove(wxMouseEvent& evt); + void OnMouseLeave(wxMouseEvent& evt); + void OnMouseDown(wxMouseEvent& evt); + void OnMouseUp(wxMouseEvent& evt); + void OnMouseDClick(wxMouseEvent& evt); + void OnPaint(wxPaintEvent& evt); + void OnSize(wxSizeEvent& evt); + int GetScrollLineSize() const; + + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual wxSize DoGetNextSmallerSize(wxOrientation direction, + wxSize relative_to) const wxOVERRIDE; + virtual wxSize DoGetNextLargerSize(wxOrientation direction, + wxSize relative_to) const wxOVERRIDE; + + wxArrayRibbonGalleryItem m_items; + wxRibbonGalleryItem* m_selected_item; + wxRibbonGalleryItem* m_hovered_item; + wxRibbonGalleryItem* m_active_item; + wxSize m_bitmap_size; + wxSize m_bitmap_padded_size; + wxSize m_best_size; + wxRect m_client_rect; + wxRect m_scroll_up_button_rect; + wxRect m_scroll_down_button_rect; + wxRect m_extension_button_rect; + const wxRect* m_mouse_active_rect; + int m_item_separation_x; + int m_item_separation_y; + int m_scroll_amount; + int m_scroll_limit; + wxRibbonGalleryButtonState m_up_button_state; + wxRibbonGalleryButtonState m_down_button_state; + wxRibbonGalleryButtonState m_extension_button_state; + bool m_hovered; + +#ifndef SWIG + wxDECLARE_CLASS(wxRibbonGallery); + wxDECLARE_EVENT_TABLE(); +#endif +}; + +class WXDLLIMPEXP_RIBBON wxRibbonGalleryEvent : public wxCommandEvent +{ +public: + wxRibbonGalleryEvent(wxEventType command_type = wxEVT_NULL, + int win_id = 0, + wxRibbonGallery* gallery = NULL, + wxRibbonGalleryItem* item = NULL) + : wxCommandEvent(command_type, win_id) + , m_gallery(gallery), m_item(item) + { + } +#ifndef SWIG + wxRibbonGalleryEvent(const wxRibbonGalleryEvent& e) : wxCommandEvent(e) + { + m_gallery = e.m_gallery; + m_item = e.m_item; + } +#endif + wxEvent *Clone() const wxOVERRIDE { return new wxRibbonGalleryEvent(*this); } + + wxRibbonGallery* GetGallery() {return m_gallery;} + wxRibbonGalleryItem* GetGalleryItem() {return m_item;} + void SetGallery(wxRibbonGallery* gallery) {m_gallery = gallery;} + void SetGalleryItem(wxRibbonGalleryItem* item) {m_item = item;} + +protected: + wxRibbonGallery* m_gallery; + wxRibbonGalleryItem* m_item; + +#ifndef SWIG +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxRibbonGalleryEvent); +#endif +}; + +#ifndef SWIG + +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONGALLERY_HOVER_CHANGED, wxRibbonGalleryEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONGALLERY_SELECTED, wxRibbonGalleryEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONGALLERY_CLICKED, wxRibbonGalleryEvent); + +typedef void (wxEvtHandler::*wxRibbonGalleryEventFunction)(wxRibbonGalleryEvent&); + +#define wxRibbonGalleryEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxRibbonGalleryEventFunction, func) + +#define EVT_RIBBONGALLERY_HOVER_CHANGED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_RIBBONGALLERY_HOVER_CHANGED, winid, wxRibbonGalleryEventHandler(fn)) +#define EVT_RIBBONGALLERY_SELECTED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_RIBBONGALLERY_SELECTED, winid, wxRibbonGalleryEventHandler(fn)) +#define EVT_RIBBONGALLERY_CLICKED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_RIBBONGALLERY_CLICKED, winid, wxRibbonGalleryEventHandler(fn)) +#else + +// wxpython/swig event work +%constant wxEventType wxEVT_RIBBONGALLERY_HOVER_CHANGED; +%constant wxEventType wxEVT_RIBBONGALLERY_SELECTED; +%constant wxEventType wxEVT_RIBBONGALLERY_CLICKED; + + +%pythoncode { + EVT_RIBBONGALLERY_HOVER_CHANGED = wx.PyEventBinder( wxEVT_RIBBONGALLERY_HOVER_CHANGED, 1 ) + EVT_RIBBONGALLERY_SELECTED = wx.PyEventBinder( wxEVT_RIBBONGALLERY_SELECTED, 1 ) + EVT_RIBBONGALLERY_CLICKED = wx.PyEventBinder( wxEVT_RIBBONGALLERY_CLICKED, 1 ) +} +#endif // SWIG + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_RIBBONGALLERY_HOVER_CHANGED wxEVT_RIBBONGALLERY_HOVER_CHANGED +#define wxEVT_COMMAND_RIBBONGALLERY_SELECTED wxEVT_RIBBONGALLERY_SELECTED +#define wxEVT_COMMAND_RIBBONGALLERY_CLICKED wxEVT_RIBBONGALLERY_CLICKED + +#endif // wxUSE_RIBBON + +#endif // _WX_RIBBON_GALLERY_H_ diff --git a/lib/wxWidgets/include/wx/ribbon/page.h b/lib/wxWidgets/include/wx/ribbon/page.h new file mode 100644 index 0000000..cbddb82 --- /dev/null +++ b/lib/wxWidgets/include/wx/ribbon/page.h @@ -0,0 +1,105 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/ribbon/page.h +// Purpose: Container for ribbon-bar-style interface panels +// Author: Peter Cawley +// Modified by: +// Created: 2009-05-25 +// Copyright: (C) Peter Cawley +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RIBBON_PAGE_H_ +#define _WX_RIBBON_PAGE_H_ + +#include "wx/defs.h" + +#if wxUSE_RIBBON + +#include "wx/ribbon/control.h" +#include "wx/ribbon/panel.h" +#include "wx/bitmap.h" + +class wxRibbonBar; +class wxRibbonPageScrollButton; + +class WXDLLIMPEXP_RIBBON wxRibbonPage : public wxRibbonControl +{ +public: + wxRibbonPage(); + + wxRibbonPage(wxRibbonBar* parent, + wxWindowID id = wxID_ANY, + const wxString& label = wxEmptyString, + const wxBitmap& icon = wxNullBitmap, + long style = 0); + + virtual ~wxRibbonPage(); + + bool Create(wxRibbonBar* parent, + wxWindowID id = wxID_ANY, + const wxString& label = wxEmptyString, + const wxBitmap& icon = wxNullBitmap, + long style = 0); + + void SetArtProvider(wxRibbonArtProvider* art) wxOVERRIDE; + + wxBitmap& GetIcon() {return m_icon;} + virtual wxSize GetMinSize() const wxOVERRIDE; + void SetSizeWithScrollButtonAdjustment(int x, int y, int width, int height); + void AdjustRectToIncludeScrollButtons(wxRect* rect) const; + + bool DismissExpandedPanel(); + + virtual bool Realize() wxOVERRIDE; + virtual bool Show(bool show = true) wxOVERRIDE; + virtual bool Layout() wxOVERRIDE; + virtual bool ScrollLines(int lines) wxOVERRIDE; + bool ScrollPixels(int pixels); + bool ScrollSections(int sections); + + wxOrientation GetMajorAxis() const; + + virtual void RemoveChild(wxWindowBase *child) wxOVERRIDE; + + void HideIfExpanded(); + +protected: + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + + void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; + bool DoActualLayout(); + void OnEraseBackground(wxEraseEvent& evt); + void OnPaint(wxPaintEvent& evt); + void OnSize(wxSizeEvent& evt); + + bool ExpandPanels(wxOrientation direction, int maximum_amount); + bool CollapsePanels(wxOrientation direction, int minimum_amount); + bool ShowScrollButtons(); + void HideScrollButtons(); + + void CommonInit(const wxString& label, const wxBitmap& icon); + void PopulateSizeCalcArray(wxSize (wxWindow::*get_size)(void) const); + + wxArrayRibbonControl m_collapse_stack; + wxBitmap m_icon; + wxSize m_old_size; + // NB: Scroll button windows are siblings rather than children (to get correct clipping of children) + wxRibbonPageScrollButton* m_scroll_left_btn; + wxRibbonPageScrollButton* m_scroll_right_btn; + wxSize* m_size_calc_array; + size_t m_size_calc_array_size; + int m_scroll_amount; + int m_scroll_amount_limit; + int m_size_in_major_axis_for_children; + bool m_scroll_buttons_visible; + +#ifndef SWIG + wxDECLARE_CLASS(wxRibbonPage); + wxDECLARE_EVENT_TABLE(); +#endif +}; + +#endif // wxUSE_RIBBON + +#endif // _WX_RIBBON_PAGE_H_ diff --git a/lib/wxWidgets/include/wx/ribbon/panel.h b/lib/wxWidgets/include/wx/ribbon/panel.h new file mode 100644 index 0000000..c47949f --- /dev/null +++ b/lib/wxWidgets/include/wx/ribbon/panel.h @@ -0,0 +1,193 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/ribbon/panel.h +// Purpose: Ribbon-style container for a group of related tools / controls +// Author: Peter Cawley +// Modified by: +// Created: 2009-05-25 +// Copyright: (C) Peter Cawley +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// +#ifndef _WX_RIBBON_PANEL_H_ +#define _WX_RIBBON_PANEL_H_ + +#include "wx/defs.h" + +#if wxUSE_RIBBON + +#include "wx/bitmap.h" +#include "wx/ribbon/control.h" + +enum wxRibbonPanelOption +{ + wxRIBBON_PANEL_NO_AUTO_MINIMISE = 1 << 0, + wxRIBBON_PANEL_EXT_BUTTON = 1 << 3, + wxRIBBON_PANEL_MINIMISE_BUTTON = 1 << 4, + wxRIBBON_PANEL_STRETCH = 1 << 5, + wxRIBBON_PANEL_FLEXIBLE = 1 << 6, + + wxRIBBON_PANEL_DEFAULT_STYLE = 0 +}; + +class WXDLLIMPEXP_RIBBON wxRibbonPanel : public wxRibbonControl +{ +public: + wxRibbonPanel(); + + wxRibbonPanel(wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxString& label = wxEmptyString, + const wxBitmap& minimised_icon = wxNullBitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxRIBBON_PANEL_DEFAULT_STYLE); + + virtual ~wxRibbonPanel(); + + bool Create(wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxString& label = wxEmptyString, + const wxBitmap& icon = wxNullBitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxRIBBON_PANEL_DEFAULT_STYLE); + + wxBitmap& GetMinimisedIcon() {return m_minimised_icon;} + const wxBitmap& GetMinimisedIcon() const {return m_minimised_icon;} + bool IsMinimised() const; + bool IsMinimised(wxSize at_size) const; + bool IsHovered() const; + bool IsExtButtonHovered() const; + bool CanAutoMinimise() const; + + bool ShowExpanded(); + bool HideExpanded(); + + void SetArtProvider(wxRibbonArtProvider* art) wxOVERRIDE; + + virtual bool Realize() wxOVERRIDE; + virtual bool Layout() wxOVERRIDE; + virtual wxSize GetMinSize() const wxOVERRIDE; + + virtual bool IsSizingContinuous() const wxOVERRIDE; + + virtual void AddChild(wxWindowBase *child) wxOVERRIDE; + virtual void RemoveChild(wxWindowBase *child) wxOVERRIDE; + + virtual bool HasExtButton() const; + + wxRibbonPanel* GetExpandedDummy(); + wxRibbonPanel* GetExpandedPanel(); + + // Finds the best width and height given the parent's width and height + virtual wxSize GetBestSizeForParentSize(const wxSize& parentSize) const wxOVERRIDE; + + long GetFlags() { return m_flags; } + + void HideIfExpanded(); + +protected: + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual wxSize GetPanelSizerBestSize() const; + wxSize GetPanelSizerMinSize() const; + wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + wxSize GetMinNotMinimisedSize() const; + + virtual wxSize DoGetNextSmallerSize(wxOrientation direction, + wxSize relative_to) const wxOVERRIDE; + virtual wxSize DoGetNextLargerSize(wxOrientation direction, + wxSize relative_to) const wxOVERRIDE; + + void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; + void OnSize(wxSizeEvent& evt); + void OnEraseBackground(wxEraseEvent& evt); + void OnPaint(wxPaintEvent& evt); + void OnMouseEnter(wxMouseEvent& evt); + void OnMouseEnterChild(wxMouseEvent& evt); + void OnMouseLeave(wxMouseEvent& evt); + void OnMouseLeaveChild(wxMouseEvent& evt); + void OnMouseClick(wxMouseEvent& evt); + void OnMotion(wxMouseEvent& evt); + void OnKillFocus(wxFocusEvent& evt); + void OnChildKillFocus(wxFocusEvent& evt); + + void TestPositionForHover(const wxPoint& pos); + bool ShouldSendEventToDummy(wxEvent& evt); + virtual bool TryAfter(wxEvent& evt) wxOVERRIDE; + + void CommonInit(const wxString& label, const wxBitmap& icon, long style); + static wxRect GetExpandedPosition(wxRect panel, + wxSize expanded_size, + wxDirection direction); + + wxBitmap m_minimised_icon; + wxBitmap m_minimised_icon_resized; + wxSize m_smallest_unminimised_size; + wxSize m_minimised_size; + wxDirection m_preferred_expand_direction; + wxRibbonPanel* m_expanded_dummy; + wxRibbonPanel* m_expanded_panel; + wxWindow* m_child_with_focus; + long m_flags; + bool m_minimised; + bool m_hovered; + bool m_ext_button_hovered; + wxRect m_ext_button_rect; + +#ifndef SWIG + wxDECLARE_CLASS(wxRibbonPanel); + wxDECLARE_EVENT_TABLE(); +#endif +}; + + +class WXDLLIMPEXP_RIBBON wxRibbonPanelEvent : public wxCommandEvent +{ +public: + wxRibbonPanelEvent(wxEventType command_type = wxEVT_NULL, + int win_id = 0, + wxRibbonPanel* panel = NULL) + : wxCommandEvent(command_type, win_id) + , m_panel(panel) + { + } + wxEvent *Clone() const wxOVERRIDE { return new wxRibbonPanelEvent(*this); } + + wxRibbonPanel* GetPanel() {return m_panel;} + void SetPanel(wxRibbonPanel* panel) {m_panel = panel;} + +protected: + wxRibbonPanel* m_panel; + +#ifndef SWIG +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxRibbonPanelEvent); +#endif +}; + +#ifndef SWIG + +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONPANEL_EXTBUTTON_ACTIVATED, wxRibbonPanelEvent); + +typedef void (wxEvtHandler::*wxRibbonPanelEventFunction)(wxRibbonPanelEvent&); + +#define wxRibbonPanelEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxRibbonPanelEventFunction, func) + +#define EVT_RIBBONPANEL_EXTBUTTON_ACTIVATED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_RIBBONPANEL_EXTBUTTON_ACTIVATED, winid, wxRibbonPanelEventHandler(fn)) +#else + +// wxpython/swig event work +%constant wxEventType wxEVT_RIBBONPANEL_EXTBUTTON_ACTIVATED; + +%pythoncode { + EVT_RIBBONPANEL_EXTBUTTON_ACTIVATED = wx.PyEventBinder( wxEVT_RIBBONPANEL_EXTBUTTON_ACTIVATED, 1 ) +} +#endif + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_RIBBONPANEL_EXTBUTTON_ACTIVATED wxEVT_RIBBONPANEL_EXTBUTTON_ACTIVATED + +#endif // wxUSE_RIBBON + +#endif // _WX_RIBBON_PANEL_H_ diff --git a/lib/wxWidgets/include/wx/ribbon/toolbar.h b/lib/wxWidgets/include/wx/ribbon/toolbar.h new file mode 100644 index 0000000..393613b --- /dev/null +++ b/lib/wxWidgets/include/wx/ribbon/toolbar.h @@ -0,0 +1,261 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/ribbon/toolbar.h +// Purpose: Ribbon-style tool bar +// Author: Peter Cawley +// Modified by: +// Created: 2009-07-06 +// Copyright: (C) Peter Cawley +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// +#ifndef _WX_RIBBON_TOOLBAR_H_ +#define _WX_RIBBON_TOOLBAR_H_ + +#include "wx/defs.h" + +#if wxUSE_RIBBON + +#include "wx/ribbon/control.h" +#include "wx/ribbon/art.h" + +class wxRibbonToolBarToolBase; +class wxRibbonToolBarToolGroup; +WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxRibbonToolBarToolGroup*, wxArrayRibbonToolBarToolGroup, class WXDLLIMPEXP_RIBBON); + +enum wxRibbonToolBarToolState +{ + wxRIBBON_TOOLBAR_TOOL_FIRST = 1 << 0, + wxRIBBON_TOOLBAR_TOOL_LAST = 1 << 1, + wxRIBBON_TOOLBAR_TOOL_POSITION_MASK = wxRIBBON_TOOLBAR_TOOL_FIRST | wxRIBBON_TOOLBAR_TOOL_LAST, + + wxRIBBON_TOOLBAR_TOOL_NORMAL_HOVERED = 1 << 3, + wxRIBBON_TOOLBAR_TOOL_DROPDOWN_HOVERED = 1 << 4, + wxRIBBON_TOOLBAR_TOOL_HOVER_MASK = wxRIBBON_TOOLBAR_TOOL_NORMAL_HOVERED | wxRIBBON_TOOLBAR_TOOL_DROPDOWN_HOVERED, + wxRIBBON_TOOLBAR_TOOL_NORMAL_ACTIVE = 1 << 5, + wxRIBBON_TOOLBAR_TOOL_DROPDOWN_ACTIVE = 1 << 6, + wxRIBBON_TOOLBAR_TOOL_ACTIVE_MASK = wxRIBBON_TOOLBAR_TOOL_NORMAL_ACTIVE | wxRIBBON_TOOLBAR_TOOL_DROPDOWN_ACTIVE, + wxRIBBON_TOOLBAR_TOOL_DISABLED = 1 << 7, + wxRIBBON_TOOLBAR_TOOL_TOGGLED = 1 << 8, + wxRIBBON_TOOLBAR_TOOL_STATE_MASK = 0x1F8 +}; + + +class WXDLLIMPEXP_RIBBON wxRibbonToolBar : public wxRibbonControl +{ +public: + wxRibbonToolBar(); + + wxRibbonToolBar(wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0); + + virtual ~wxRibbonToolBar(); + + bool Create(wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0); + + virtual wxRibbonToolBarToolBase* AddTool( + int tool_id, + const wxBitmap& bitmap, + const wxString& help_string, + wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL); + + virtual wxRibbonToolBarToolBase* AddDropdownTool( + int tool_id, + const wxBitmap& bitmap, + const wxString& help_string = wxEmptyString); + + virtual wxRibbonToolBarToolBase* AddHybridTool( + int tool_id, + const wxBitmap& bitmap, + const wxString& help_string = wxEmptyString); + + virtual wxRibbonToolBarToolBase* AddToggleTool( + int tool_id, + const wxBitmap& bitmap, + const wxString& help_string = wxEmptyString); + + virtual wxRibbonToolBarToolBase* AddTool( + int tool_id, + const wxBitmap& bitmap, + const wxBitmap& bitmap_disabled = wxNullBitmap, + const wxString& help_string = wxEmptyString, + wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL, + wxObject* client_data = NULL); + + virtual wxRibbonToolBarToolBase* AddSeparator(); + + virtual wxRibbonToolBarToolBase* InsertTool( + size_t pos, + int tool_id, + const wxBitmap& bitmap, + const wxString& help_string, + wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL); + + virtual wxRibbonToolBarToolBase* InsertDropdownTool( + size_t pos, + int tool_id, + const wxBitmap& bitmap, + const wxString& help_string = wxEmptyString); + + virtual wxRibbonToolBarToolBase* InsertHybridTool( + size_t pos, + int tool_id, + const wxBitmap& bitmap, + const wxString& help_string = wxEmptyString); + + virtual wxRibbonToolBarToolBase* InsertToggleTool( + size_t pos, + int tool_id, + const wxBitmap& bitmap, + const wxString& help_string = wxEmptyString); + + virtual wxRibbonToolBarToolBase* InsertTool( + size_t pos, + int tool_id, + const wxBitmap& bitmap, + const wxBitmap& bitmap_disabled = wxNullBitmap, + const wxString& help_string = wxEmptyString, + wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL, + wxObject* client_data = NULL); + + virtual wxRibbonToolBarToolBase* InsertSeparator(size_t pos); + + virtual void ClearTools(); + virtual bool DeleteTool(int tool_id); + virtual bool DeleteToolByPos(size_t pos); + + virtual wxRibbonToolBarToolBase* FindById(int tool_id)const; + virtual wxRibbonToolBarToolBase* GetToolByPos(size_t pos)const; + virtual wxRibbonToolBarToolBase* GetToolByPos(wxCoord x, wxCoord y)const; + virtual size_t GetToolCount() const; + virtual int GetToolId(const wxRibbonToolBarToolBase* tool)const; + virtual wxRibbonToolBarToolBase* GetActiveTool() const; + + + virtual wxObject* GetToolClientData(int tool_id)const; + virtual bool GetToolEnabled(int tool_id)const; + virtual wxString GetToolHelpString(int tool_id)const; + virtual wxRibbonButtonKind GetToolKind(int tool_id)const; + virtual int GetToolPos(int tool_id)const; + virtual wxRect GetToolRect(int tool_id)const; + virtual bool GetToolState(int tool_id)const; + + virtual bool Realize() wxOVERRIDE; + virtual void SetRows(int nMin, int nMax = -1); + + virtual void SetToolClientData(int tool_id, wxObject* clientData); + virtual void SetToolDisabledBitmap(int tool_id, const wxBitmap &bitmap); + virtual void SetToolHelpString(int tool_id, const wxString& helpString); + virtual void SetToolNormalBitmap(int tool_id, const wxBitmap &bitmap); + + virtual bool IsSizingContinuous() const wxOVERRIDE; + + virtual void EnableTool(int tool_id, bool enable = true); + virtual void ToggleTool(int tool_id, bool checked); + + // Finds the best width and height given the parent's width and height + virtual wxSize GetBestSizeForParentSize(const wxSize& parentSize) const wxOVERRIDE; + +protected: + friend class wxRibbonToolBarEvent; + virtual wxSize DoGetBestSize() const wxOVERRIDE; + wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + + void OnEraseBackground(wxEraseEvent& evt); + void OnMouseDown(wxMouseEvent& evt); + void OnMouseEnter(wxMouseEvent& evt); + void OnMouseLeave(wxMouseEvent& evt); + void OnMouseMove(wxMouseEvent& evt); + void OnMouseUp(wxMouseEvent& evt); + void OnPaint(wxPaintEvent& evt); + void OnSize(wxSizeEvent& evt); + + virtual wxSize DoGetNextSmallerSize(wxOrientation direction, + wxSize relative_to) const wxOVERRIDE; + virtual wxSize DoGetNextLargerSize(wxOrientation direction, + wxSize relative_to) const wxOVERRIDE; + + void CommonInit(long style); + void AppendGroup(); + wxRibbonToolBarToolGroup* InsertGroup(size_t pos); + virtual void UpdateWindowUI(long flags) wxOVERRIDE; + + static wxBitmap MakeDisabledBitmap(const wxBitmap& original); + + wxArrayRibbonToolBarToolGroup m_groups; + wxRibbonToolBarToolBase* m_hover_tool; + wxRibbonToolBarToolBase* m_active_tool; + wxSize* m_sizes; + int m_nrows_min; + int m_nrows_max; + +#ifndef SWIG + wxDECLARE_CLASS(wxRibbonToolBar); + wxDECLARE_EVENT_TABLE(); +#endif +}; + + +class WXDLLIMPEXP_RIBBON wxRibbonToolBarEvent : public wxCommandEvent +{ +public: + wxRibbonToolBarEvent(wxEventType command_type = wxEVT_NULL, + int win_id = 0, + wxRibbonToolBar* bar = NULL) + : wxCommandEvent(command_type, win_id) + , m_bar(bar) + { + } + wxEvent *Clone() const wxOVERRIDE { return new wxRibbonToolBarEvent(*this); } + + wxRibbonToolBar* GetBar() {return m_bar;} + void SetBar(wxRibbonToolBar* bar) {m_bar = bar;} + bool PopupMenu(wxMenu* menu); + +protected: + wxRibbonToolBar* m_bar; + +#ifndef SWIG +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxRibbonToolBarEvent); +#endif +}; + +#ifndef SWIG + +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONTOOLBAR_CLICKED, wxRibbonToolBarEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONTOOLBAR_DROPDOWN_CLICKED, wxRibbonToolBarEvent); + +typedef void (wxEvtHandler::*wxRibbonToolBarEventFunction)(wxRibbonToolBarEvent&); + +#define wxRibbonToolBarEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxRibbonToolBarEventFunction, func) + +#define EVT_RIBBONTOOLBAR_CLICKED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_RIBBONTOOLBAR_CLICKED, winid, wxRibbonToolBarEventHandler(fn)) +#define EVT_RIBBONTOOLBAR_DROPDOWN_CLICKED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_RIBBONTOOLBAR_DROPDOWN_CLICKED, winid, wxRibbonToolBarEventHandler(fn)) +#else + +// wxpython/swig event work +%constant wxEventType wxEVT_RIBBONTOOLBAR_CLICKED; +%constant wxEventType wxEVT_RIBBONTOOLBAR_DROPDOWN_CLICKED; + +%pythoncode { + EVT_RIBBONTOOLBAR_CLICKED = wx.PyEventBinder( wxEVT_RIBBONTOOLBAR_CLICKED, 1 ) + EVT_RIBBONTOOLBAR_DROPDOWN_CLICKED = wx.PyEventBinder( wxEVT_RIBBONTOOLBAR_DROPDOWN_CLICKED, 1 ) +} +#endif + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_RIBBONTOOL_CLICKED wxEVT_RIBBONTOOLBAR_CLICKED +#define wxEVT_COMMAND_RIBBONTOOL_DROPDOWN_CLICKED wxEVT_RIBBONTOOLBAR_DROPDOWN_CLICKED + +#endif // wxUSE_RIBBON + +#endif // _WX_RIBBON_TOOLBAR_H_ diff --git a/lib/wxWidgets/include/wx/richmsgdlg.h b/lib/wxWidgets/include/wx/richmsgdlg.h new file mode 100644 index 0000000..817d6c3 --- /dev/null +++ b/lib/wxWidgets/include/wx/richmsgdlg.h @@ -0,0 +1,101 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richmsgdlg.h +// Purpose: wxRichMessageDialogBase +// Author: Rickard Westerlund +// Created: 2010-07-03 +// Copyright: (c) 2010 wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RICHMSGDLG_H_BASE_ +#define _WX_RICHMSGDLG_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_RICHMSGDLG + +#include "wx/msgdlg.h" + +// Extends a message dialog with an optional checkbox and user-expandable +// detailed text. +class WXDLLIMPEXP_CORE wxRichMessageDialogBase : public wxGenericMessageDialog +{ +public: + wxRichMessageDialogBase( wxWindow *parent, + const wxString& message, + const wxString& caption, + long style ) + : wxGenericMessageDialog( parent, message, caption, style ), + m_detailsExpanderCollapsedLabel( wxGetTranslation("&See details") ), + m_detailsExpanderExpandedLabel( wxGetTranslation("&Hide details") ), + m_checkBoxValue( false ), + m_footerIcon( 0 ) + { } + + void ShowCheckBox(const wxString& checkBoxText, bool checked = false) + { + m_checkBoxText = checkBoxText; + m_checkBoxValue = checked; + } + + wxString GetCheckBoxText() const { return m_checkBoxText; } + + void ShowDetailedText(const wxString& detailedText) + { m_detailedText = detailedText; } + + wxString GetDetailedText() const { return m_detailedText; } + + virtual bool IsCheckBoxChecked() const { return m_checkBoxValue; } + + void SetFooterText(const wxString& footerText) + { m_footerText = footerText; } + + wxString GetFooterText() const { return m_footerText; } + + void SetFooterIcon(int icon) + { m_footerIcon = icon; } + + int GetFooterIcon() const { return m_footerIcon; } + +protected: + const wxString m_detailsExpanderCollapsedLabel; + const wxString m_detailsExpanderExpandedLabel; + + wxString m_checkBoxText; + bool m_checkBoxValue; + wxString m_detailedText; + wxString m_footerText; + int m_footerIcon; + +private: + void ShowDetails(bool shown); + + wxDECLARE_NO_COPY_CLASS(wxRichMessageDialogBase); +}; + +// Always include the generic version as it's currently used as the base class +// by the MSW native implementation too. +#include "wx/generic/richmsgdlgg.h" + +#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) + #include "wx/msw/richmsgdlg.h" +#else + class WXDLLIMPEXP_CORE wxRichMessageDialog + : public wxGenericRichMessageDialog + { + public: + wxRichMessageDialog( wxWindow *parent, + const wxString& message, + const wxString& caption = wxASCII_STR(wxMessageBoxCaptionStr), + long style = wxOK | wxCENTRE ) + : wxGenericRichMessageDialog( parent, message, caption, style ) + { } + + private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxRichMessageDialog); + }; +#endif + +#endif // wxUSE_RICHMSGDLG + +#endif // _WX_RICHMSGDLG_H_BASE_ diff --git a/lib/wxWidgets/include/wx/richtext/bitmaps/image_placeholder24x24.xpm b/lib/wxWidgets/include/wx/richtext/bitmaps/image_placeholder24x24.xpm new file mode 100644 index 0000000..a281f21 --- /dev/null +++ b/lib/wxWidgets/include/wx/richtext/bitmaps/image_placeholder24x24.xpm @@ -0,0 +1,32 @@ +/* XPM */ +static const char *image_placeholder24x24_xpm[] = { +/* columns rows colors chars-per-pixel */ +"24 24 2 1", +" c #7E97A9", +". c #EBEBFF", +/* pixels */ +" ...... ......", +" ...... ......", +" ...... ......", +" ...... ......", +" ...... ......", +" ...... ......", +"...... ...... ", +"...... ...... ", +"...... ...... ", +"...... ...... ", +"...... ...... ", +"...... ...... ", +" ...... ......", +" ...... ......", +" ...... ......", +" ...... ......", +" ...... ......", +" ...... ......", +"...... ...... ", +"...... ...... ", +"...... ...... ", +"...... ...... ", +"...... ...... ", +"...... ...... " +}; diff --git a/lib/wxWidgets/include/wx/richtext/richtextbackgroundpage.h b/lib/wxWidgets/include/wx/richtext/richtextbackgroundpage.h new file mode 100644 index 0000000..98969bd --- /dev/null +++ b/lib/wxWidgets/include/wx/richtext/richtextbackgroundpage.h @@ -0,0 +1,156 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextbackgroundpage.h +// Purpose: Declares the rich text formatting dialog background +// properties page. +// Author: Julian Smart +// Modified by: +// Created: 13/11/2010 11:17:25 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _RICHTEXTBACKGROUNDPAGE_H_ +#define _RICHTEXTBACKGROUNDPAGE_H_ + +/*! + * Includes + */ + +#include "wx/richtext/richtextdialogpage.h" + +////@begin includes +#include "wx/statline.h" +////@end includes + +/*! + * Forward declarations + */ + +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextColourSwatchCtrl; + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define SYMBOL_WXRICHTEXTBACKGROUNDPAGE_STYLE wxTAB_TRAVERSAL +#define SYMBOL_WXRICHTEXTBACKGROUNDPAGE_TITLE wxEmptyString +#define SYMBOL_WXRICHTEXTBACKGROUNDPAGE_IDNAME ID_RICHTEXTBACKGROUNDPAGE +#define SYMBOL_WXRICHTEXTBACKGROUNDPAGE_SIZE wxSize(400, 300) +#define SYMBOL_WXRICHTEXTBACKGROUNDPAGE_POSITION wxDefaultPosition +////@end control identifiers + + +/*! + * wxRichTextBackgroundPage class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextBackgroundPage: public wxRichTextDialogPage +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextBackgroundPage); + wxDECLARE_EVENT_TABLE(); + DECLARE_HELP_PROVISION() + +public: + /// Constructors + wxRichTextBackgroundPage(); + wxRichTextBackgroundPage( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTBACKGROUNDPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTBACKGROUNDPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTBACKGROUNDPAGE_SIZE, long style = SYMBOL_WXRICHTEXTBACKGROUNDPAGE_STYLE ); + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTBACKGROUNDPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTBACKGROUNDPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTBACKGROUNDPAGE_SIZE, long style = SYMBOL_WXRICHTEXTBACKGROUNDPAGE_STYLE ); + + /// Destructor + ~wxRichTextBackgroundPage(); + + /// Initialises member variables + void Init(); + + /// Creates the controls and sizers + void CreateControls(); + + /// Gets the attributes from the formatting dialog + wxRichTextAttr* GetAttributes(); + + /// Data transfer + virtual bool TransferDataToWindow() wxOVERRIDE; + virtual bool TransferDataFromWindow() wxOVERRIDE; + + /// Respond to colour swatch click + void OnColourSwatch(wxCommandEvent& event); + +////@begin wxRichTextBackgroundPage event handler declarations + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_SHADOW_HORIZONTAL_OFFSET + void OnRichtextShadowUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSHADOWCOLOURSWATCHCTRL + void OnRichtextshadowcolourswatchctrlUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_SHADOW_SPREAD + void OnRichtextShadowSpreadUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_SHADOW_BLUR_DISTANCE + void OnRichtextShadowBlurUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_SHADOW_OPACITY + void OnRichtextShadowOpacityUpdate( wxUpdateUIEvent& event ); + +////@end wxRichTextBackgroundPage event handler declarations + +////@begin wxRichTextBackgroundPage member function declarations + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end wxRichTextBackgroundPage member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + +////@begin wxRichTextBackgroundPage member variables + wxCheckBox* m_backgroundColourCheckBox; + wxRichTextColourSwatchCtrl* m_backgroundColourSwatch; + wxBoxSizer* m_shadowBox; + wxCheckBox* m_useShadow; + wxTextCtrl* m_offsetX; + wxComboBox* m_unitsHorizontalOffset; + wxTextCtrl* m_offsetY; + wxComboBox* m_unitsVerticalOffset; + wxCheckBox* m_shadowColourCheckBox; + wxRichTextColourSwatchCtrl* m_shadowColourSwatch; + wxCheckBox* m_useShadowSpread; + wxTextCtrl* m_spread; + wxComboBox* m_unitsShadowSpread; + wxCheckBox* m_useBlurDistance; + wxTextCtrl* m_blurDistance; + wxComboBox* m_unitsBlurDistance; + wxCheckBox* m_useShadowOpacity; + wxTextCtrl* m_opacity; + /// Control identifiers + enum { + ID_RICHTEXTBACKGROUNDPAGE = 10845, + ID_RICHTEXT_BACKGROUND_COLOUR_CHECKBOX = 10846, + ID_RICHTEXT_BACKGROUND_COLOUR_SWATCH = 10847, + ID_RICHTEXT_USE_SHADOW = 10840, + ID_RICHTEXT_SHADOW_HORIZONTAL_OFFSET = 10703, + ID_RICHTEXT_SHADOW_HORIZONTAL_OFFSET_UNITS = 10712, + ID_RICHTEXT_SHADOW_VERTICAL_OFFSET = 10841, + ID_RICHTEXT_SHADOW_VERTICAL_OFFSET_UNITS = 10842, + ID_RICHTEXT_USE_SHADOW_COLOUR = 10843, + ID_RICHTEXTSHADOWCOLOURSWATCHCTRL = 10844, + ID_RICHTEXT_USE_SHADOW_SPREAD = 10851, + ID_RICHTEXT_SHADOW_SPREAD = 10848, + ID_RICHTEXT_SHADOW_SPREAD_UNITS = 10849, + ID_RICHTEXT_USE_BLUR_DISTANCE = 10855, + ID_RICHTEXT_SHADOW_BLUR_DISTANCE = 10852, + ID_RICHTEXT_SHADOW_BLUR_DISTANCE_UNITS = 10853, + ID_RICHTEXT_USE_SHADOW_OPACITY = 10856, + ID_RICHTEXT_SHADOW_OPACITY = 10854 + }; +////@end wxRichTextBackgroundPage member variables +}; + +#endif + // _RICHTEXTBACKGROUNDPAGE_H_ diff --git a/lib/wxWidgets/include/wx/richtext/richtextborderspage.h b/lib/wxWidgets/include/wx/richtext/richtextborderspage.h new file mode 100644 index 0000000..7c8bf35 --- /dev/null +++ b/lib/wxWidgets/include/wx/richtext/richtextborderspage.h @@ -0,0 +1,302 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextborderspage.h +// Purpose: A border editing page for the wxRTC formatting dialog. +// Author: Julian Smart +// Modified by: +// Created: 21/10/2010 11:34:24 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _RICHTEXTBORDERSPAGE_H_ +#define _RICHTEXTBORDERSPAGE_H_ + +/*! + * Includes + */ + +#include "wx/richtext/richtextdialogpage.h" + +////@begin includes +#include "wx/notebook.h" +#include "wx/statline.h" +////@end includes + +/*! + * Forward declarations + */ + +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextColourSwatchCtrl; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextBorderPreviewCtrl; + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define SYMBOL_WXRICHTEXTBORDERSPAGE_STYLE wxTAB_TRAVERSAL +#define SYMBOL_WXRICHTEXTBORDERSPAGE_TITLE wxEmptyString +#define SYMBOL_WXRICHTEXTBORDERSPAGE_IDNAME ID_RICHTEXTBORDERSPAGE +#define SYMBOL_WXRICHTEXTBORDERSPAGE_SIZE wxSize(400, 300) +#define SYMBOL_WXRICHTEXTBORDERSPAGE_POSITION wxDefaultPosition +////@end control identifiers + + +/*! + * wxRichTextBordersPage class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextBordersPage: public wxRichTextDialogPage +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextBordersPage); + wxDECLARE_EVENT_TABLE(); + DECLARE_HELP_PROVISION() + +public: + /// Constructors + wxRichTextBordersPage(); + wxRichTextBordersPage( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTBORDERSPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTBORDERSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTBORDERSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTBORDERSPAGE_STYLE ); + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTBORDERSPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTBORDERSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTBORDERSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTBORDERSPAGE_STYLE ); + + /// Destructor + ~wxRichTextBordersPage(); + + /// Initialises member variables + void Init(); + + /// Creates the controls and sizers + void CreateControls(); + + /// Gets the attributes from the formatting dialog + wxRichTextAttr* GetAttributes(); + + /// Data transfer + virtual bool TransferDataToWindow() wxOVERRIDE; + virtual bool TransferDataFromWindow() wxOVERRIDE; + + /// Updates the synchronization checkboxes to reflect the state of the attributes + void UpdateSyncControls(); + + /// Updates the preview + void OnCommand(wxCommandEvent& event); + + /// Fill style combo + virtual void FillStyleComboBox(wxComboBox* styleComboBox); + + /// Set the border controls + static void SetBorderValue(wxTextAttrBorder& border, wxTextCtrl* widthValueCtrl, wxComboBox* widthUnitsCtrl, wxCheckBox* checkBox, + wxComboBox* styleCtrl, wxRichTextColourSwatchCtrl* colourCtrl, const wxArrayInt& borderStyles); + + /// Get data from the border controls + static void GetBorderValue(wxTextAttrBorder& border, wxTextCtrl* widthValueCtrl, wxComboBox* widthUnitsCtrl, wxCheckBox* checkBox, + wxComboBox* styleCtrl, wxRichTextColourSwatchCtrl* colourCtrl, const wxArrayInt& borderStyles); + +////@begin wxRichTextBordersPage event handler declarations + + /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXT_BORDER_LEFT_CHECKBOX + void OnRichtextBorderCheckboxClick( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXT_BORDER_LEFT + void OnRichtextBorderLeftValueTextUpdated( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_LEFT + void OnRichtextBorderLeftUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXT_BORDER_LEFT_UNITS + void OnRichtextBorderLeftUnitsSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXT_BORDER_LEFT_STYLE + void OnRichtextBorderLeftStyleSelected( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_RIGHT_CHECKBOX + void OnRichtextBorderOtherCheckboxUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_RIGHT + void OnRichtextBorderRightUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_TOP + void OnRichtextBorderTopUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_BOTTOM + void OnRichtextBorderBottomUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXT_BORDER_SYNCHRONIZE + void OnRichtextBorderSynchronizeClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BORDER_SYNCHRONIZE + void OnRichtextBorderSynchronizeUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXT_OUTLINE_LEFT + void OnRichtextOutlineLeftTextUpdated( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_LEFT + void OnRichtextOutlineLeftUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXT_OUTLINE_LEFT_UNITS + void OnRichtextOutlineLeftUnitsSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXT_OUTLINE_LEFT_STYLE + void OnRichtextOutlineLeftStyleSelected( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_RIGHT_CHECKBOX + void OnRichtextOutlineOtherCheckboxUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_RIGHT + void OnRichtextOutlineRightUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_TOP + void OnRichtextOutlineTopUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_BOTTOM + void OnRichtextOutlineBottomUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXT_OUTLINE_SYNCHRONIZE + void OnRichtextOutlineSynchronizeClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_OUTLINE_SYNCHRONIZE + void OnRichtextOutlineSynchronizeUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBORDERSPAGE_CORNER_TEXT + void OnRichtextborderspageCornerUpdate( wxUpdateUIEvent& event ); + +////@end wxRichTextBordersPage event handler declarations + +////@begin wxRichTextBordersPage member function declarations + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end wxRichTextBordersPage member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + +////@begin wxRichTextBordersPage member variables + wxCheckBox* m_leftBorderCheckbox; + wxTextCtrl* m_leftBorderWidth; + wxComboBox* m_leftBorderWidthUnits; + wxComboBox* m_leftBorderStyle; + wxRichTextColourSwatchCtrl* m_leftBorderColour; + wxCheckBox* m_rightBorderCheckbox; + wxTextCtrl* m_rightBorderWidth; + wxComboBox* m_rightBorderWidthUnits; + wxComboBox* m_rightBorderStyle; + wxRichTextColourSwatchCtrl* m_rightBorderColour; + wxCheckBox* m_topBorderCheckbox; + wxTextCtrl* m_topBorderWidth; + wxComboBox* m_topBorderWidthUnits; + wxComboBox* m_topBorderStyle; + wxRichTextColourSwatchCtrl* m_topBorderColour; + wxCheckBox* m_bottomBorderCheckbox; + wxTextCtrl* m_bottomBorderWidth; + wxComboBox* m_bottomBorderWidthUnits; + wxComboBox* m_bottomBorderStyle; + wxRichTextColourSwatchCtrl* m_bottomBorderColour; + wxCheckBox* m_borderSyncCtrl; + wxCheckBox* m_leftOutlineCheckbox; + wxTextCtrl* m_leftOutlineWidth; + wxComboBox* m_leftOutlineWidthUnits; + wxComboBox* m_leftOutlineStyle; + wxRichTextColourSwatchCtrl* m_leftOutlineColour; + wxCheckBox* m_rightOutlineCheckbox; + wxTextCtrl* m_rightOutlineWidth; + wxComboBox* m_rightOutlineWidthUnits; + wxComboBox* m_rightOutlineStyle; + wxRichTextColourSwatchCtrl* m_rightOutlineColour; + wxCheckBox* m_topOutlineCheckbox; + wxTextCtrl* m_topOutlineWidth; + wxComboBox* m_topOutlineWidthUnits; + wxComboBox* m_topOutlineStyle; + wxRichTextColourSwatchCtrl* m_topOutlineColour; + wxCheckBox* m_bottomOutlineCheckbox; + wxTextCtrl* m_bottomOutlineWidth; + wxComboBox* m_bottomOutlineWidthUnits; + wxComboBox* m_bottomOutlineStyle; + wxRichTextColourSwatchCtrl* m_bottomOutlineColour; + wxCheckBox* m_outlineSyncCtrl; + wxCheckBox* m_cornerRadiusCheckBox; + wxTextCtrl* m_cornerRadiusText; + wxComboBox* m_cornerRadiusUnits; + wxRichTextBorderPreviewCtrl* m_borderPreviewCtrl; + /// Control identifiers + enum { + ID_RICHTEXTBORDERSPAGE = 10800, + ID_RICHTEXTBORDERSPAGE_NOTEBOOK = 10801, + ID_RICHTEXTBORDERSPAGE_BORDERS = 10802, + ID_RICHTEXT_BORDER_LEFT_CHECKBOX = 10803, + ID_RICHTEXT_BORDER_LEFT = 10804, + ID_RICHTEXT_BORDER_LEFT_UNITS = 10805, + ID_RICHTEXT_BORDER_LEFT_STYLE = 10806, + ID_RICHTEXT_BORDER_LEFT_COLOUR = 10807, + ID_RICHTEXT_BORDER_RIGHT_CHECKBOX = 10808, + ID_RICHTEXT_BORDER_RIGHT = 10809, + ID_RICHTEXT_BORDER_RIGHT_UNITS = 10810, + ID_RICHTEXT_BORDER_RIGHT_STYLE = 10811, + ID_RICHTEXT_BORDER_RIGHT_COLOUR = 10812, + ID_RICHTEXT_BORDER_TOP_CHECKBOX = 10813, + ID_RICHTEXT_BORDER_TOP = 10814, + ID_RICHTEXT_BORDER_TOP_UNITS = 10815, + ID_RICHTEXT_BORDER_TOP_STYLE = 10816, + ID_RICHTEXT_BORDER_TOP_COLOUR = 10817, + ID_RICHTEXT_BORDER_BOTTOM_CHECKBOX = 10818, + ID_RICHTEXT_BORDER_BOTTOM = 10819, + ID_RICHTEXT_BORDER_BOTTOM_UNITS = 10820, + ID_RICHTEXT_BORDER_BOTTOM_STYLE = 10821, + ID_RICHTEXT_BORDER_BOTTOM_COLOUR = 10822, + ID_RICHTEXT_BORDER_SYNCHRONIZE = 10845, + ID_RICHTEXTBORDERSPAGE_OUTLINE = 10823, + ID_RICHTEXT_OUTLINE_LEFT_CHECKBOX = 10824, + ID_RICHTEXT_OUTLINE_LEFT = 10825, + ID_RICHTEXT_OUTLINE_LEFT_UNITS = 10826, + ID_RICHTEXT_OUTLINE_LEFT_STYLE = 10827, + ID_RICHTEXT_OUTLINE_LEFT_COLOUR = 10828, + ID_RICHTEXT_OUTLINE_RIGHT_CHECKBOX = 10829, + ID_RICHTEXT_OUTLINE_RIGHT = 10830, + ID_RICHTEXT_OUTLINE_RIGHT_UNITS = 10831, + ID_RICHTEXT_OUTLINE_RIGHT_STYLE = 10832, + ID_RICHTEXT_OUTLINE_RIGHT_COLOUR = 10833, + ID_RICHTEXT_OUTLINE_TOP_CHECKBOX = 10834, + ID_RICHTEXT_OUTLINE_TOP = 10835, + ID_RICHTEXT_OUTLINE_TOP_UNITS = 10836, + ID_RICHTEXT_OUTLINE_TOP_STYLE = 10837, + ID_RICHTEXT_OUTLINE_TOP_COLOUR = 10838, + ID_RICHTEXT_OUTLINE_BOTTOM_CHECKBOX = 10839, + ID_RICHTEXT_OUTLINE_BOTTOM = 10840, + ID_RICHTEXT_OUTLINE_BOTTOM_UNITS = 10841, + ID_RICHTEXT_OUTLINE_BOTTOM_STYLE = 10842, + ID_RICHTEXT_OUTLINE_BOTTOM_COLOUR = 10843, + ID_RICHTEXT_OUTLINE_SYNCHRONIZE = 10846, + ID_RICHTEXTBORDERSPAGE_CORNER = 10847, + ID_RICHTEXTBORDERSPAGE_CORNER_CHECKBOX = 10848, + ID_RICHTEXTBORDERSPAGE_CORNER_TEXT = 10849, + ID_RICHTEXTBORDERSPAGE_CORNER_UNITS = 10850, + ID_RICHTEXT_BORDER_PREVIEW = 10844 + }; +////@end wxRichTextBordersPage member variables + + wxArrayInt m_borderStyles; + wxArrayString m_borderStyleNames; + bool m_ignoreUpdates; +}; + +class WXDLLIMPEXP_RICHTEXT wxRichTextBorderPreviewCtrl : public wxWindow +{ +public: + wxRichTextBorderPreviewCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize, long style = 0); + + void SetAttributes(wxRichTextAttr* attr) { m_attributes = attr; } + wxRichTextAttr* GetAttributes() const { return m_attributes; } + +private: + wxRichTextAttr* m_attributes; + + void OnPaint(wxPaintEvent& event); + wxDECLARE_EVENT_TABLE(); +}; + +#endif + // _RICHTEXTBORDERSPAGE_H_ diff --git a/lib/wxWidgets/include/wx/richtext/richtextbuffer.h b/lib/wxWidgets/include/wx/richtext/richtextbuffer.h new file mode 100644 index 0000000..598d75d --- /dev/null +++ b/lib/wxWidgets/include/wx/richtext/richtextbuffer.h @@ -0,0 +1,7076 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextbuffer.h +// Purpose: Buffer for wxRichTextCtrl +// Author: Julian Smart +// Modified by: +// Created: 2005-09-30 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RICHTEXTBUFFER_H_ +#define _WX_RICHTEXTBUFFER_H_ + +/* + + Data structures + =============== + + Data is represented by a hierarchy of objects, all derived from + wxRichTextObject. + + The top of the hierarchy is the buffer, a kind of wxRichTextParagraphLayoutBox. + These boxes will allow flexible placement of text boxes on a page, but + for now there is a single box representing the document, and this box is + a wxRichTextParagraphLayoutBox which contains further wxRichTextParagraph + objects, each of which can include text and images. + + Each object maintains a range (start and end position) measured + from the start of the main parent box. + A paragraph object knows its range, and a text fragment knows its range + too. So, a character or image in a page has a position relative to the + start of the document, and a character in an embedded text box has + a position relative to that text box. For now, we will not be dealing with + embedded objects but it's something to bear in mind for later. + + Note that internally, a range (5,5) represents a range of one character. + In the public wx[Rich]TextCtrl API, this would be passed to e.g. SetSelection + as (5,6). A paragraph with one character might have an internal range of (0, 1) + since the end of the paragraph takes up one position. + + Layout + ====== + + When Layout is called on an object, it is given a size which the object + must limit itself to, or one or more flexible directions (vertical + or horizontal). So for example a centered paragraph is given the page + width to play with (minus any margins), but can extend indefinitely + in the vertical direction. The implementation of Layout can then + cache the calculated size and position within the parent. + + */ + +/*! + * Includes + */ + +#include "wx/defs.h" + +#if wxUSE_RICHTEXT + +#include "wx/list.h" +#include "wx/textctrl.h" +#include "wx/bitmap.h" +#include "wx/image.h" +#include "wx/cmdproc.h" +#include "wx/txtstrm.h" +#include "wx/variant.h" +#include "wx/position.h" + +#if wxUSE_DATAOBJ +#include "wx/dataobj.h" +#endif + +// Compatibility +//#define wxRichTextAttr wxTextAttr +#define wxTextAttrEx wxTextAttr + +// Setting wxRICHTEXT_USE_OWN_CARET to 1 implements a +// caret reliably without using wxClientDC in case there +// are platform-specific problems with the generic caret. +#if defined(__WXGTK__) || defined(__WXMAC__) +#define wxRICHTEXT_USE_OWN_CARET 1 +#else +#define wxRICHTEXT_USE_OWN_CARET 0 +#endif + +// Switch off for binary compatibility, on for faster drawing +// Note: this seems to be buggy (overzealous use of extents) so +// don't use for now +#define wxRICHTEXT_USE_OPTIMIZED_LINE_DRAWING 0 + +// The following two symbols determine whether an output implementation +// is present. To switch the relevant one on, set wxRICHTEXT_USE_XMLDOCUMENT_OUTPUT in +// richtextxml.cpp. By default, the faster direct output implementation is used. + +// Include the wxXmlDocument implementation for output +#define wxRICHTEXT_HAVE_XMLDOCUMENT_OUTPUT 1 + +// Include the faster, direct implementation for output +#define wxRICHTEXT_HAVE_DIRECT_OUTPUT 1 + +/** + The line break character that can be embedded in content. + */ + +extern WXDLLIMPEXP_RICHTEXT const wxChar wxRichTextLineBreakChar; + +/** + File types in wxRichText context. + */ +enum wxRichTextFileType +{ + wxRICHTEXT_TYPE_ANY = 0, + wxRICHTEXT_TYPE_TEXT, + wxRICHTEXT_TYPE_XML, + wxRICHTEXT_TYPE_HTML, + wxRICHTEXT_TYPE_RTF, + wxRICHTEXT_TYPE_PDF +}; + +/* + * Forward declarations + */ + +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCtrl; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextObject; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextImage; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextPlainText; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCacheObject; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextObjectList; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextLine; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextParagraph; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextFileHandler; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextDrawingHandler; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextField; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextFieldType; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextStyleSheet; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextListStyleDefinition; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextEvent; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextRenderer; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextBuffer; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextXMLHandler; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextParagraphLayoutBox; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextImageBlock; +class WXDLLIMPEXP_FWD_XML wxXmlNode; +class wxRichTextFloatCollector; +class WXDLLIMPEXP_FWD_BASE wxDataInputStream; +class WXDLLIMPEXP_FWD_BASE wxDataOutputStream; + +/** + Flags determining the available space, passed to Layout. + */ + +#define wxRICHTEXT_FIXED_WIDTH 0x01 +#define wxRICHTEXT_FIXED_HEIGHT 0x02 +#define wxRICHTEXT_VARIABLE_WIDTH 0x04 +#define wxRICHTEXT_VARIABLE_HEIGHT 0x08 + +// Only lay out the part of the buffer that lies within +// the rect passed to Layout. +#define wxRICHTEXT_LAYOUT_SPECIFIED_RECT 0x10 + +/** + Flags to pass to Draw + */ + +// Ignore paragraph cache optimization, e.g. for printing purposes +// where one line may be drawn higher (on the next page) compared +// with the previous line +#define wxRICHTEXT_DRAW_IGNORE_CACHE 0x01 +#define wxRICHTEXT_DRAW_SELECTED 0x02 +#define wxRICHTEXT_DRAW_PRINT 0x04 +#define wxRICHTEXT_DRAW_GUIDELINES 0x08 + +/** + Flags returned from hit-testing, or passed to hit-test function. + */ +enum wxRichTextHitTestFlags +{ + // The point was not on this object + wxRICHTEXT_HITTEST_NONE = 0x01, + + // The point was before the position returned from HitTest + wxRICHTEXT_HITTEST_BEFORE = 0x02, + + // The point was after the position returned from HitTest + wxRICHTEXT_HITTEST_AFTER = 0x04, + + // The point was on the position returned from HitTest + wxRICHTEXT_HITTEST_ON = 0x08, + + // The point was on space outside content + wxRICHTEXT_HITTEST_OUTSIDE = 0x10, + + // Only do hit-testing at the current level (don't traverse into top-level objects) + wxRICHTEXT_HITTEST_NO_NESTED_OBJECTS = 0x20, + + // Ignore floating objects + wxRICHTEXT_HITTEST_NO_FLOATING_OBJECTS = 0x40, + + // Don't recurse into objects marked as atomic + wxRICHTEXT_HITTEST_HONOUR_ATOMIC = 0x80 +}; + +/** + Flags for GetRangeSize. + */ + +#define wxRICHTEXT_FORMATTED 0x01 +#define wxRICHTEXT_UNFORMATTED 0x02 +#define wxRICHTEXT_CACHE_SIZE 0x04 +#define wxRICHTEXT_HEIGHT_ONLY 0x08 + +/** + Flags for SetStyle/SetListStyle. + */ + +#define wxRICHTEXT_SETSTYLE_NONE 0x00 + +// Specifies that this operation should be undoable +#define wxRICHTEXT_SETSTYLE_WITH_UNDO 0x01 + +// Specifies that the style should not be applied if the +// combined style at this point is already the style in question. +#define wxRICHTEXT_SETSTYLE_OPTIMIZE 0x02 + +// Specifies that the style should only be applied to paragraphs, +// and not the content. This allows content styling to be +// preserved independently from that of e.g. a named paragraph style. +#define wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY 0x04 + +// Specifies that the style should only be applied to characters, +// and not the paragraph. This allows content styling to be +// preserved independently from that of e.g. a named paragraph style. +#define wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY 0x08 + +// For SetListStyle only: specifies starting from the given number, otherwise +// deduces number from existing attributes +#define wxRICHTEXT_SETSTYLE_RENUMBER 0x10 + +// For SetListStyle only: specifies the list level for all paragraphs, otherwise +// the current indentation will be used +#define wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL 0x20 + +// Resets the existing style before applying the new style +#define wxRICHTEXT_SETSTYLE_RESET 0x40 + +// Removes the given style instead of applying it +#define wxRICHTEXT_SETSTYLE_REMOVE 0x80 + +/** + Flags for SetProperties. + */ + +#define wxRICHTEXT_SETPROPERTIES_NONE 0x00 + +// Specifies that this operation should be undoable +#define wxRICHTEXT_SETPROPERTIES_WITH_UNDO 0x01 + +// Specifies that the properties should only be applied to paragraphs, +// and not the content. +#define wxRICHTEXT_SETPROPERTIES_PARAGRAPHS_ONLY 0x02 + +// Specifies that the properties should only be applied to characters, +// and not the paragraph. +#define wxRICHTEXT_SETPROPERTIES_CHARACTERS_ONLY 0x04 + +// Resets the existing properties before applying the new properties. +#define wxRICHTEXT_SETPROPERTIES_RESET 0x08 + +// Removes the given properties instead of applying them. +#define wxRICHTEXT_SETPROPERTIES_REMOVE 0x10 + +/** + Flags for object insertion. + */ + +#define wxRICHTEXT_INSERT_NONE 0x00 +#define wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE 0x01 +#define wxRICHTEXT_INSERT_INTERACTIVE 0x02 + +// A special flag telling the buffer to keep the first paragraph style +// as-is, when deleting a paragraph marker. In future we might pass a +// flag to InsertFragment and DeleteRange to indicate the appropriate mode. +#define wxTEXT_ATTR_KEEP_FIRST_PARA_STYLE 0x20000000 + +/** + Default superscript/subscript font multiplication factor. + */ + +#define wxSCRIPT_MUL_FACTOR 1.5 + +/** + The type for wxTextAttrDimension flags. + */ +typedef unsigned short wxTextAttrDimensionFlags; + +/** + Miscellaneous text box flags + */ +enum wxTextBoxAttrFlags +{ + wxTEXT_BOX_ATTR_FLOAT = 0x00000001, + wxTEXT_BOX_ATTR_CLEAR = 0x00000002, + wxTEXT_BOX_ATTR_COLLAPSE_BORDERS = 0x00000004, + wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT = 0x00000008, + wxTEXT_BOX_ATTR_BOX_STYLE_NAME = 0x00000010, + wxTEXT_BOX_ATTR_WHITESPACE = 0x00000020, + wxTEXT_BOX_ATTR_CORNER_RADIUS = 0x00000040 +}; + +/** + Whether a value is present, used in dimension flags. + */ +enum wxTextAttrValueFlags +{ + wxTEXT_ATTR_VALUE_VALID = 0x1000, + wxTEXT_ATTR_VALUE_VALID_MASK = 0x1000 +}; + +/** + Units, included in the dimension value. + */ +enum wxTextAttrUnits +{ + wxTEXT_ATTR_UNITS_TENTHS_MM = 0x0001, + wxTEXT_ATTR_UNITS_PIXELS = 0x0002, + wxTEXT_ATTR_UNITS_PERCENTAGE = 0x0004, + wxTEXT_ATTR_UNITS_POINTS = 0x0008, + wxTEXT_ATTR_UNITS_HUNDREDTHS_POINT = 0x0100, + + wxTEXT_ATTR_UNITS_MASK = 0x010F +}; + +/** + Position alternatives, included in the dimension flags. + */ +enum wxTextBoxAttrPosition +{ + wxTEXT_BOX_ATTR_POSITION_STATIC = 0x0000, // Default is static, i.e. as per normal layout + wxTEXT_BOX_ATTR_POSITION_RELATIVE = 0x0010, // Relative to the relevant edge + wxTEXT_BOX_ATTR_POSITION_ABSOLUTE = 0x0020, // Relative to the parent + wxTEXT_BOX_ATTR_POSITION_FIXED = 0x0040, // Relative to the top-level window + + wxTEXT_BOX_ATTR_POSITION_MASK = 0x00F0 +}; + +wxALLOW_COMBINING_ENUMS(wxTextAttrUnits, wxTextAttrValueFlags) + +/** + @class wxTextAttrDimension + + A class representing a rich text dimension, including units and position. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextAttr, wxRichTextCtrl, wxTextAttrDimensions +*/ + +class WXDLLIMPEXP_RICHTEXT wxTextAttrDimension +{ +public: + /** + Default constructor. + */ + wxTextAttrDimension() { Reset(); } + /** + Constructor taking value and units flag. + */ + wxTextAttrDimension(int value, wxTextAttrUnits units = wxTEXT_ATTR_UNITS_TENTHS_MM) { m_value = value; + m_flags = static_cast<wxTextAttrDimensionFlags>(units | wxTEXT_ATTR_VALUE_VALID); } + + /** + Resets the dimension value and flags. + */ + void Reset() { m_value = 0; m_flags = 0; } + + /** + Partial equality test. If @a weakTest is @true, attributes of this object do not + have to be present if those attributes of @a dim are present. If @a weakTest is + @false, the function will fail if an attribute is present in @a dim but not + in this object. + */ + bool EqPartial(const wxTextAttrDimension& dim, bool weakTest = true) const; + + /** Apply the dimension, but not those identical to @a compareWith if present. + */ + bool Apply(const wxTextAttrDimension& dim, const wxTextAttrDimension* compareWith = NULL); + + /** Collects the attributes that are common to a range of content, building up a note of + which attributes are absent in some objects and which clash in some objects. + */ + void CollectCommonAttributes(const wxTextAttrDimension& attr, wxTextAttrDimension& clashingAttr, wxTextAttrDimension& absentAttr); + + /** + Equality operator. + */ + bool operator==(const wxTextAttrDimension& dim) const { return m_value == dim.m_value && m_flags == dim.m_flags; } + + /** + Returns the integer value of the dimension. + */ + int GetValue() const { return m_value; } + + /** + Returns the floating-pointing value of the dimension in mm. + + */ + float GetValueMM() const { return m_value / 10.0f; } + + /** + Sets the value of the dimension in mm. + */ + void SetValueMM(float value) { m_value = (int) ((value * 10.0f) + 0.5f); m_flags |= wxTEXT_ATTR_VALUE_VALID; } + + /** + Sets the integer value of the dimension. + */ + void SetValue(int value) { m_value = value; m_flags |= wxTEXT_ATTR_VALUE_VALID; } + + /** + Sets the integer value of the dimension, passing dimension flags. + */ + void SetValue(int value, wxTextAttrDimensionFlags flags) { SetValue(value); m_flags = flags; } + + /** + Sets the integer value and units. + */ + void SetValue(int value, wxTextAttrUnits units) { m_value = value; + m_flags = static_cast<wxTextAttrDimensionFlags>(units | wxTEXT_ATTR_VALUE_VALID); } + + /** + Sets the dimension. + */ + void SetValue(const wxTextAttrDimension& dim) { (*this) = dim; } + + /** + Gets the units of the dimension. + */ + wxTextAttrUnits GetUnits() const { return (wxTextAttrUnits) (m_flags & wxTEXT_ATTR_UNITS_MASK); } + + /** + Sets the units of the dimension. + */ + void SetUnits(wxTextAttrUnits units) { m_flags &= ~wxTEXT_ATTR_UNITS_MASK; m_flags |= units; } + + /** + Gets the position flags. + */ + wxTextBoxAttrPosition GetPosition() const { return (wxTextBoxAttrPosition) (m_flags & wxTEXT_BOX_ATTR_POSITION_MASK); } + + /** + Sets the position flags. + */ + void SetPosition(wxTextBoxAttrPosition pos) { m_flags &= ~wxTEXT_BOX_ATTR_POSITION_MASK; m_flags |= pos; } + + /** + Returns @true if the dimension is valid. + */ + bool IsValid() const { return (m_flags & wxTEXT_ATTR_VALUE_VALID) != 0; } + + /** + Sets the valid flag. + */ + void SetValid(bool b) { m_flags &= ~wxTEXT_ATTR_VALUE_VALID_MASK; m_flags |= (b ? wxTEXT_ATTR_VALUE_VALID : 0); } + + /** + Gets the dimension flags. + */ + wxTextAttrDimensionFlags GetFlags() const { return m_flags; } + + /** + Sets the dimension flags. + */ + void SetFlags(wxTextAttrDimensionFlags flags) { m_flags = flags; } + + int m_value; + wxTextAttrDimensionFlags m_flags; +}; + +/** + @class wxTextAttrDimensions + A class for left, right, top and bottom dimensions. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextAttr, wxRichTextCtrl, wxTextAttrDimension +*/ + +class WXDLLIMPEXP_RICHTEXT wxTextAttrDimensions +{ +public: + /** + Default constructor. + */ + wxTextAttrDimensions() {} + + /** + Resets the value and flags for all dimensions. + */ + void Reset() { m_left.Reset(); m_top.Reset(); m_right.Reset(); m_bottom.Reset(); } + + /** + Equality operator. + */ + bool operator==(const wxTextAttrDimensions& dims) const { return m_left == dims.m_left && m_top == dims.m_top && m_right == dims.m_right && m_bottom == dims.m_bottom; } + + /** + Partial equality test. If @a weakTest is @true, attributes of this object do not + have to be present if those attributes of @a dims are present. If @a weakTest is + @false, the function will fail if an attribute is present in @a dims but not + in this object. + + */ + bool EqPartial(const wxTextAttrDimensions& dims, bool weakTest = true) const; + + /** + Apply to 'this', but not if the same as @a compareWith. + + */ + bool Apply(const wxTextAttrDimensions& dims, const wxTextAttrDimensions* compareWith = NULL); + + /** + Collects the attributes that are common to a range of content, building up a note of + which attributes are absent in some objects and which clash in some objects. + + */ + void CollectCommonAttributes(const wxTextAttrDimensions& attr, wxTextAttrDimensions& clashingAttr, wxTextAttrDimensions& absentAttr); + + /** + Remove specified attributes from this object. + */ + bool RemoveStyle(const wxTextAttrDimensions& attr); + + /** + Gets the left dimension. + */ + const wxTextAttrDimension& GetLeft() const { return m_left; } + wxTextAttrDimension& GetLeft() { return m_left; } + + /** + Gets the right dimension. + + */ + const wxTextAttrDimension& GetRight() const { return m_right; } + wxTextAttrDimension& GetRight() { return m_right; } + + /** + Gets the top dimension. + + */ + const wxTextAttrDimension& GetTop() const { return m_top; } + wxTextAttrDimension& GetTop() { return m_top; } + + /** + Gets the bottom dimension. + + */ + const wxTextAttrDimension& GetBottom() const { return m_bottom; } + wxTextAttrDimension& GetBottom() { return m_bottom; } + + /** + Are all dimensions valid? + + */ + bool IsValid() const { return m_left.IsValid() && m_top.IsValid() && m_right.IsValid() && m_bottom.IsValid(); } + + wxTextAttrDimension m_left; + wxTextAttrDimension m_top; + wxTextAttrDimension m_right; + wxTextAttrDimension m_bottom; +}; + +/** + @class wxTextAttrSize + A class for representing width and height. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextAttr, wxRichTextCtrl, wxTextAttrDimension +*/ + +class WXDLLIMPEXP_RICHTEXT wxTextAttrSize +{ +public: + /** + Default constructor. + */ + wxTextAttrSize() {} + + /** + Resets the width and height dimensions. + */ + void Reset() { m_width.Reset(); m_height.Reset(); } + + /** + Equality operator. + */ + bool operator==(const wxTextAttrSize& size) const { return m_width == size.m_width && m_height == size.m_height ; } + + /** + Partial equality test. If @a weakTest is @true, attributes of this object do not + have to be present if those attributes of @a size are present. If @a weakTest is + @false, the function will fail if an attribute is present in @a size but not + in this object. + */ + bool EqPartial(const wxTextAttrSize& size, bool weakTest = true) const; + + /** + Apply to this object, but not if the same as @a compareWith. + */ + bool Apply(const wxTextAttrSize& dims, const wxTextAttrSize* compareWith = NULL); + + /** + Collects the attributes that are common to a range of content, building up a note of + which attributes are absent in some objects and which clash in some objects. + */ + void CollectCommonAttributes(const wxTextAttrSize& attr, wxTextAttrSize& clashingAttr, wxTextAttrSize& absentAttr); + + /** + Removes the specified attributes from this object. + */ + bool RemoveStyle(const wxTextAttrSize& attr); + + /** + Returns the width. + */ + wxTextAttrDimension& GetWidth() { return m_width; } + const wxTextAttrDimension& GetWidth() const { return m_width; } + + /** + Sets the width. + */ + void SetWidth(int value, wxTextAttrDimensionFlags flags) { m_width.SetValue(value, flags); } + + /** + Sets the width. + */ + void SetWidth(int value, wxTextAttrUnits units) { m_width.SetValue(value, units); } + + /** + Sets the width. + */ + void SetWidth(const wxTextAttrDimension& dim) { m_width.SetValue(dim); } + + /** + Gets the height. + */ + wxTextAttrDimension& GetHeight() { return m_height; } + const wxTextAttrDimension& GetHeight() const { return m_height; } + + /** + Sets the height. + */ + void SetHeight(int value, wxTextAttrDimensionFlags flags) { m_height.SetValue(value, flags); } + + /** + Sets the height. + */ + void SetHeight(int value, wxTextAttrUnits units) { m_height.SetValue(value, units); } + + /** + Sets the height. + */ + void SetHeight(const wxTextAttrDimension& dim) { m_height.SetValue(dim); } + + /** + Is the size valid? + */ + bool IsValid() const { return m_width.IsValid() && m_height.IsValid(); } + + wxTextAttrDimension m_width; + wxTextAttrDimension m_height; +}; + +/** + @class wxTextAttrDimensionConverter + A class to make it easier to convert dimensions. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextAttr, wxRichTextCtrl, wxTextAttrDimension +*/ + +class WXDLLIMPEXP_RICHTEXT wxTextAttrDimensionConverter +{ +public: + /** + Constructor. + */ + wxTextAttrDimensionConverter(wxDC& dc, double scale = 1.0, const wxSize& parentSize = wxDefaultSize); + /** + Constructor. + */ + wxTextAttrDimensionConverter(int ppi, double scale = 1.0, const wxSize& parentSize = wxDefaultSize); + + /** + Gets the pixel size for the given dimension. + */ + int GetPixels(const wxTextAttrDimension& dim, int direction = wxHORIZONTAL) const; + /** + Gets the mm size for the given dimension. + */ + int GetTenthsMM(const wxTextAttrDimension& dim) const; + + /** + Converts tenths of a mm to pixels. + */ + int ConvertTenthsMMToPixels(int units) const; + /** + Converts pixels to tenths of a mm. + */ + int ConvertPixelsToTenthsMM(int pixels) const; + + /** + Sets the scale factor. + */ + void SetScale(double scale) { m_scale = scale; } + /** + Returns the scale factor. + */ + double GetScale() const { return m_scale; } + + /** + Sets the ppi. + */ + void SetPPI(int ppi) { m_ppi = ppi; } + /** + Returns the ppi. + */ + int GetPPI() const { return m_ppi; } + + /** + Sets the parent size. + */ + void SetParentSize(const wxSize& parentSize) { m_parentSize = parentSize; } + /** + Returns the parent size. + */ + const wxSize& GetParentSize() const { return m_parentSize; } + + int m_ppi; + double m_scale; + wxSize m_parentSize; +}; + +/** + Border styles, used with wxTextAttrBorder. + */ +enum wxTextAttrBorderStyle +{ + wxTEXT_BOX_ATTR_BORDER_NONE = 0, + wxTEXT_BOX_ATTR_BORDER_SOLID = 1, + wxTEXT_BOX_ATTR_BORDER_DOTTED = 2, + wxTEXT_BOX_ATTR_BORDER_DASHED = 3, + wxTEXT_BOX_ATTR_BORDER_DOUBLE = 4, + wxTEXT_BOX_ATTR_BORDER_GROOVE = 5, + wxTEXT_BOX_ATTR_BORDER_RIDGE = 6, + wxTEXT_BOX_ATTR_BORDER_INSET = 7, + wxTEXT_BOX_ATTR_BORDER_OUTSET = 8 +}; + +/** + Border style presence flags, used with wxTextAttrBorder. + */ +enum wxTextAttrBorderFlags +{ + wxTEXT_BOX_ATTR_BORDER_STYLE = 0x0001, + wxTEXT_BOX_ATTR_BORDER_COLOUR = 0x0002 +}; + +/** + Border width symbols for qualitative widths, used with wxTextAttrBorder. + */ +enum wxTextAttrBorderWidth +{ + wxTEXT_BOX_ATTR_BORDER_THIN = -1, + wxTEXT_BOX_ATTR_BORDER_MEDIUM = -2, + wxTEXT_BOX_ATTR_BORDER_THICK = -3 +}; + +/** + Float styles. + */ +enum wxTextBoxAttrFloatStyle +{ + wxTEXT_BOX_ATTR_FLOAT_NONE = 0, + wxTEXT_BOX_ATTR_FLOAT_LEFT = 1, + wxTEXT_BOX_ATTR_FLOAT_RIGHT = 2 +}; + +/** + Clear styles. + */ +enum wxTextBoxAttrClearStyle +{ + wxTEXT_BOX_ATTR_CLEAR_NONE = 0, + wxTEXT_BOX_ATTR_CLEAR_LEFT = 1, + wxTEXT_BOX_ATTR_CLEAR_RIGHT = 2, + wxTEXT_BOX_ATTR_CLEAR_BOTH = 3 +}; + +/** + Collapse mode styles. + */ +enum wxTextBoxAttrCollapseMode +{ + wxTEXT_BOX_ATTR_COLLAPSE_NONE = 0, + wxTEXT_BOX_ATTR_COLLAPSE_FULL = 1 +}; + +/** + Vertical alignment values. + */ +enum wxTextBoxAttrVerticalAlignment +{ + wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_NONE = 0, + wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_TOP = 1, + wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_CENTRE = 2, + wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_BOTTOM = 3 +}; + +/** + Whitespace values mirroring the CSS white-space attribute. + Only wxTEXT_BOX_ATTR_WHITESPACE_NO_WRAP is currently implemented, + in table cells. + */ +enum wxTextBoxAttrWhitespaceMode +{ + wxTEXT_BOX_ATTR_WHITESPACE_NONE = 0, + wxTEXT_BOX_ATTR_WHITESPACE_NORMAL = 1, + wxTEXT_BOX_ATTR_WHITESPACE_NO_WRAP = 2, + wxTEXT_BOX_ATTR_WHITESPACE_PREFORMATTED = 3, + wxTEXT_BOX_ATTR_WHITESPACE_PREFORMATTED_LINE = 4, + wxTEXT_BOX_ATTR_WHITESPACE_PREFORMATTED_WRAP = 5 +}; + +/** + @class wxTextAttrBorder + A class representing a rich text object border. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextAttr, wxRichTextCtrl, wxRichTextAttrBorders +*/ + +class WXDLLIMPEXP_RICHTEXT wxTextAttrBorder +{ +public: + /** + Default constructor. + */ + wxTextAttrBorder() { Reset(); } + + /** + Equality operator. + */ + bool operator==(const wxTextAttrBorder& border) const + { + return m_flags == border.m_flags && m_borderStyle == border.m_borderStyle && + m_borderColour == border.m_borderColour && m_borderWidth == border.m_borderWidth; + } + + /** + Resets the border style, colour, width and flags. + */ + void Reset() { m_borderStyle = 0; m_borderColour = 0; m_flags = 0; m_borderWidth.Reset(); } + + /** + Partial equality test. If @a weakTest is @true, attributes of this object do not + have to be present if those attributes of @a border are present. If @a weakTest is + @false, the function will fail if an attribute is present in @a border but not + in this object. + */ + bool EqPartial(const wxTextAttrBorder& border, bool weakTest = true) const; + + /** + Applies the border to this object, but not if the same as @a compareWith. + + */ + bool Apply(const wxTextAttrBorder& border, const wxTextAttrBorder* compareWith = NULL); + + /** + Removes the specified attributes from this object. + */ + bool RemoveStyle(const wxTextAttrBorder& attr); + + /** + Collects the attributes that are common to a range of content, building up a note of + which attributes are absent in some objects and which clash in some objects. + */ + void CollectCommonAttributes(const wxTextAttrBorder& attr, wxTextAttrBorder& clashingAttr, wxTextAttrBorder& absentAttr); + + /** + Sets the border style. + */ + void SetStyle(int style) { m_borderStyle = style; m_flags |= wxTEXT_BOX_ATTR_BORDER_STYLE; } + + /** + Gets the border style. + + */ + int GetStyle() const { return m_borderStyle; } + + /** + Sets the border colour. + */ + void SetColour(unsigned long colour) { m_borderColour = colour; m_flags |= wxTEXT_BOX_ATTR_BORDER_COLOUR; } + + /** + Sets the border colour. + */ + void SetColour(const wxColour& colour) { m_borderColour = colour.GetRGB(); m_flags |= wxTEXT_BOX_ATTR_BORDER_COLOUR; } + + /** + Gets the colour as a long. + */ + unsigned long GetColourLong() const { return m_borderColour; } + + /** + Gets the colour. + */ + wxColour GetColour() const { return wxColour(m_borderColour); } + + /** + Gets the border width. + */ + wxTextAttrDimension& GetWidth() { return m_borderWidth; } + const wxTextAttrDimension& GetWidth() const { return m_borderWidth; } + + /** + Sets the border width. + */ + void SetWidth(const wxTextAttrDimension& width) { m_borderWidth = width; } + /** + Sets the border width. + */ + void SetWidth(int value, wxTextAttrUnits units = wxTEXT_ATTR_UNITS_TENTHS_MM) { SetWidth(wxTextAttrDimension(value, units)); } + + /** + True if the border has a valid style. + */ + bool HasStyle() const { return (m_flags & wxTEXT_BOX_ATTR_BORDER_STYLE) != 0; } + + /** + True if the border has a valid colour. + */ + bool HasColour() const { return (m_flags & wxTEXT_BOX_ATTR_BORDER_COLOUR) != 0; } + + /** + True if the border has a valid width. + */ + bool HasWidth() const { return m_borderWidth.IsValid(); } + + /** + True if the border is valid. + */ + bool IsValid() const { return HasWidth(); } + + /** + Set the valid flag for this border. + */ + void MakeValid() { m_borderWidth.SetValid(true); } + + /** + True if the border has no attributes set. + */ + bool IsDefault() const { return (m_flags == 0); } + + /** + Returns the border flags. + */ + int GetFlags() const { return m_flags; } + + /** + Sets the border flags. + */ + void SetFlags(int flags) { m_flags = flags; } + + /** + Adds a border flag. + */ + void AddFlag(int flag) { m_flags |= flag; } + + /** + Removes a border flag. + */ + void RemoveFlag(int flag) { m_flags &= ~flag; } + + int m_borderStyle; + unsigned long m_borderColour; + wxTextAttrDimension m_borderWidth; + int m_flags; +}; + +/** + @class wxTextAttrBorders + A class representing a rich text object's borders. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextAttr, wxRichTextCtrl, wxRichTextAttrBorder +*/ + +class WXDLLIMPEXP_RICHTEXT wxTextAttrBorders +{ +public: + /** + Default constructor. + */ + wxTextAttrBorders() { } + + /** + Equality operator. + */ + bool operator==(const wxTextAttrBorders& borders) const + { + return m_left == borders.m_left && m_right == borders.m_right && + m_top == borders.m_top && m_bottom == borders.m_bottom; + } + + /** + Sets the style of all borders. + */ + void SetStyle(int style); + + /** + Sets colour of all borders. + */ + void SetColour(unsigned long colour); + + /** + Sets the colour for all borders. + */ + void SetColour(const wxColour& colour); + + /** + Sets the width of all borders. + */ + void SetWidth(const wxTextAttrDimension& width); + + /** + Sets the width of all borders. + */ + void SetWidth(int value, wxTextAttrUnits units = wxTEXT_ATTR_UNITS_TENTHS_MM) { SetWidth(wxTextAttrDimension(value, units)); } + + /** + Resets all borders. + */ + void Reset() { m_left.Reset(); m_right.Reset(); m_top.Reset(); m_bottom.Reset(); } + + /** + Partial equality test. If @a weakTest is @true, attributes of this object do not + have to be present if those attributes of @a borders are present. If @a weakTest is + @false, the function will fail if an attribute is present in @a borders but not + in this object. + */ + bool EqPartial(const wxTextAttrBorders& borders, bool weakTest = true) const; + + /** + Applies border to this object, but not if the same as @a compareWith. + */ + bool Apply(const wxTextAttrBorders& borders, const wxTextAttrBorders* compareWith = NULL); + + /** + Removes the specified attributes from this object. + */ + bool RemoveStyle(const wxTextAttrBorders& attr); + + /** + Collects the attributes that are common to a range of content, building up a note of + which attributes are absent in some objects and which clash in some objects. + */ + void CollectCommonAttributes(const wxTextAttrBorders& attr, wxTextAttrBorders& clashingAttr, wxTextAttrBorders& absentAttr); + + /** + Returns @true if at least one border is valid. + */ + bool IsValid() const { return m_left.IsValid() || m_right.IsValid() || m_top.IsValid() || m_bottom.IsValid(); } + + /** + Returns @true if no border attributes were set. + */ + bool IsDefault() const { return m_left.IsDefault() && m_right.IsDefault() && m_top.IsDefault() && m_bottom.IsDefault(); } + + /** + Returns the left border. + */ + const wxTextAttrBorder& GetLeft() const { return m_left; } + wxTextAttrBorder& GetLeft() { return m_left; } + + /** + Returns the right border. + */ + const wxTextAttrBorder& GetRight() const { return m_right; } + wxTextAttrBorder& GetRight() { return m_right; } + + /** + Returns the top border. + */ + const wxTextAttrBorder& GetTop() const { return m_top; } + wxTextAttrBorder& GetTop() { return m_top; } + + /** + Returns the bottom border. + */ + const wxTextAttrBorder& GetBottom() const { return m_bottom; } + wxTextAttrBorder& GetBottom() { return m_bottom; } + + wxTextAttrBorder m_left, m_right, m_top, m_bottom; + +}; + +/** + @class wxTextAttrShadow + A class representing a shadow. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextAttr, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxTextAttrShadow +{ +public: + /** + Default constructor. + */ + wxTextAttrShadow() { Reset(); } + + /** + Equality operator. + */ + bool operator==(const wxTextAttrShadow& shadow) const; + + /** + Resets the shadow. + */ + void Reset(); + + /** + Partial equality test. If @a weakTest is @true, attributes of this object do not + have to be present if those attributes of @a border are present. If @a weakTest is + @false, the function will fail if an attribute is present in @a border but not + in this object. + */ + bool EqPartial(const wxTextAttrShadow& shadow, bool weakTest = true) const; + + /** + Applies the border to this object, but not if the same as @a compareWith. + + */ + bool Apply(const wxTextAttrShadow& shadow, const wxTextAttrShadow* compareWith = NULL); + + /** + Removes the specified attributes from this object. + */ + bool RemoveStyle(const wxTextAttrShadow& attr); + + /** + Collects the attributes that are common to a range of content, building up a note of + which attributes are absent in some objects and which clash in some objects. + */ + void CollectCommonAttributes(const wxTextAttrShadow& attr, wxTextAttrShadow& clashingAttr, wxTextAttrShadow& absentAttr); + + /** + Sets the shadow colour. + */ + void SetColour(unsigned long colour) { m_shadowColour = colour; m_flags |= wxTEXT_BOX_ATTR_BORDER_COLOUR; } + + /** + Sets the shadow colour. + */ +#if wxCHECK_VERSION(2,9,0) + void SetColour(const wxColour& colour) { m_shadowColour = colour.GetRGB(); m_flags |= wxTEXT_BOX_ATTR_BORDER_COLOUR; } +#else + void SetColour(const wxColour& colour) { m_shadowColour = (colour.Red() | (colour.Green() << 8) | (colour.Blue() << 16)); m_flags |= wxTEXT_BOX_ATTR_BORDER_COLOUR; } +#endif + + /** + Gets the colour as a long. + */ + unsigned long GetColourLong() const { return m_shadowColour; } + + /** + Gets the colour. + */ + wxColour GetColour() const { return wxColour(m_shadowColour); } + + /** + True if the shadow has a valid colour. + */ + bool HasColour() const { return (m_flags & wxTEXT_BOX_ATTR_BORDER_COLOUR) != 0; } + + /** + Gets the shadow horizontal offset. + */ + wxTextAttrDimension& GetOffsetX() { return m_offsetX; } + const wxTextAttrDimension& GetOffsetX() const { return m_offsetX; } + + /** + Sets the shadow horizontal offset. + */ + void SetOffsetX(const wxTextAttrDimension& offset) { m_offsetX = offset; } + + /** + Gets the shadow vertical offset. + */ + wxTextAttrDimension& GetOffsetY() { return m_offsetY; } + const wxTextAttrDimension& GetOffsetY() const { return m_offsetY; } + + /** + Sets the shadow vertical offset. + */ + void SetOffsetY(const wxTextAttrDimension& offset) { m_offsetY = offset; } + + /** + Gets the shadow spread size. + */ + wxTextAttrDimension& GetSpread() { return m_spread; } + const wxTextAttrDimension& GetSpread() const { return m_spread; } + + /** + Sets the shadow spread size. + */ + void SetSpread(const wxTextAttrDimension& spread) { m_spread = spread; } + + /** + Gets the shadow blur distance. + */ + wxTextAttrDimension& GetBlurDistance() { return m_blurDistance; } + const wxTextAttrDimension& GetBlurDistance() const { return m_blurDistance; } + + /** + Sets the shadow blur distance. + */ + void SetBlurDistance(const wxTextAttrDimension& blur) { m_blurDistance = blur; } + + /** + Gets the shadow opacity. + */ + wxTextAttrDimension& GetOpacity() { return m_opacity; } + const wxTextAttrDimension& GetOpacity() const { return m_opacity; } + + /** + Returns @true if the dimension is valid. + */ + bool IsValid() const { return (m_flags & wxTEXT_ATTR_VALUE_VALID) != 0; } + + /** + Sets the valid flag. + */ + void SetValid(bool b) { m_flags &= ~wxTEXT_ATTR_VALUE_VALID_MASK; m_flags |= (b ? wxTEXT_ATTR_VALUE_VALID : 0); } + + /** + Returns the border flags. + */ + int GetFlags() const { return m_flags; } + + /** + Sets the border flags. + */ + void SetFlags(int flags) { m_flags = flags; } + + /** + Adds a border flag. + */ + void AddFlag(int flag) { m_flags |= flag; } + + /** + Removes a border flag. + */ + void RemoveFlag(int flag) { m_flags &= ~flag; } + + /** + Sets the shadow opacity. + */ + void SetOpacity(const wxTextAttrDimension& opacity) { m_opacity = opacity; } + + /** + True if the shadow has no attributes set. + */ + bool IsDefault() const { return !HasColour() && !m_offsetX.IsValid() && !m_offsetY.IsValid() && !m_spread.IsValid() && !m_blurDistance.IsValid() && !m_opacity.IsValid(); } + + int m_flags; + unsigned long m_shadowColour; + wxTextAttrDimension m_offsetX; + wxTextAttrDimension m_offsetY; + wxTextAttrDimension m_spread; + wxTextAttrDimension m_blurDistance; + wxTextAttrDimension m_opacity; +}; + +/** + @class wxTextBoxAttr + A class representing the box attributes of a rich text object. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextAttr, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxTextBoxAttr +{ +public: + /** + Default constructor. + */ + wxTextBoxAttr() { Init(); } + + /** + Initialises this object. + */ + void Init() { Reset(); } + + /** + Resets this object. + */ + void Reset(); + + // Copy. Unnecessary since we let it do a binary copy + //void Copy(const wxTextBoxAttr& attr); + + // Assignment + //void operator= (const wxTextBoxAttr& attr); + + /** + Equality test. + */ + bool operator== (const wxTextBoxAttr& attr) const; + + /** + Partial equality test, ignoring unset attributes. If @a weakTest is @true, attributes of this object do not + have to be present if those attributes of @a attr are present. If @a weakTest is + @false, the function will fail if an attribute is present in @a attr but not + in this object. + + */ + bool EqPartial(const wxTextBoxAttr& attr, bool weakTest = true) const; + + /** + Merges the given attributes. If @a compareWith is non-NULL, then it will be used + to mask out those attributes that are the same in style and @a compareWith, for + situations where we don't want to explicitly set inherited attributes. + */ + bool Apply(const wxTextBoxAttr& style, const wxTextBoxAttr* compareWith = NULL); + + /** + Collects the attributes that are common to a range of content, building up a note of + which attributes are absent in some objects and which clash in some objects. + */ + void CollectCommonAttributes(const wxTextBoxAttr& attr, wxTextBoxAttr& clashingAttr, wxTextBoxAttr& absentAttr); + + /** + Removes the specified attributes from this object. + */ + bool RemoveStyle(const wxTextBoxAttr& attr); + + /** + Sets the flags. + */ + void SetFlags(int flags) { m_flags = flags; } + + /** + Returns the flags. + */ + int GetFlags() const { return m_flags; } + + /** + Is this flag present? + */ + bool HasFlag(wxTextBoxAttrFlags flag) const { return (m_flags & flag) != 0; } + + /** + Removes this flag. + */ + void RemoveFlag(wxTextBoxAttrFlags flag) { m_flags &= ~flag; } + + /** + Adds this flag. + */ + void AddFlag(wxTextBoxAttrFlags flag) { m_flags |= flag; } + + /** + Returns @true if no attributes are set. + */ + bool IsDefault() const; + + /** + Returns the float mode. + */ + wxTextBoxAttrFloatStyle GetFloatMode() const { return m_floatMode; } + + /** + Sets the float mode. + */ + void SetFloatMode(wxTextBoxAttrFloatStyle mode) { m_floatMode = mode; m_flags |= wxTEXT_BOX_ATTR_FLOAT; } + + /** + Returns @true if float mode is active. + */ + bool HasFloatMode() const { return HasFlag(wxTEXT_BOX_ATTR_FLOAT); } + + /** + Returns @true if this object is floating. + */ + bool IsFloating() const { return HasFloatMode() && GetFloatMode() != wxTEXT_BOX_ATTR_FLOAT_NONE; } + + /** + Returns the clear mode - whether to wrap text after object. Currently unimplemented. + */ + wxTextBoxAttrClearStyle GetClearMode() const { return m_clearMode; } + + /** + Set the clear mode. Currently unimplemented. + */ + void SetClearMode(wxTextBoxAttrClearStyle mode) { m_clearMode = mode; m_flags |= wxTEXT_BOX_ATTR_CLEAR; } + + /** + Returns @true if we have a clear flag. + */ + bool HasClearMode() const { return HasFlag(wxTEXT_BOX_ATTR_CLEAR); } + + /** + Returns the collapse mode - whether to collapse borders. + */ + wxTextBoxAttrCollapseMode GetCollapseBorders() const { return m_collapseMode; } + + /** + Sets the collapse mode - whether to collapse borders. + */ + void SetCollapseBorders(wxTextBoxAttrCollapseMode collapse) { m_collapseMode = collapse; m_flags |= wxTEXT_BOX_ATTR_COLLAPSE_BORDERS; } + + /** + Returns @true if the collapse borders flag is present. + */ + bool HasCollapseBorders() const { return HasFlag(wxTEXT_BOX_ATTR_COLLAPSE_BORDERS); } + + /** + Returns the whitespace mode. + */ + wxTextBoxAttrWhitespaceMode GetWhitespaceMode() const { return m_whitespaceMode; } + + /** + Sets the whitespace mode. + */ + void SetWhitespaceMode(wxTextBoxAttrWhitespaceMode whitespace) { m_whitespaceMode = whitespace; m_flags |= wxTEXT_BOX_ATTR_WHITESPACE; } + + /** + Returns @true if the whitespace flag is present. + */ + bool HasWhitespaceMode() const { return HasFlag(wxTEXT_BOX_ATTR_WHITESPACE); } + + /** + Returns @true if the corner radius flag is present. + */ + bool HasCornerRadius() const { return HasFlag(wxTEXT_BOX_ATTR_CORNER_RADIUS); } + + /** + Returns the corner radius value. + */ + const wxTextAttrDimension& GetCornerRadius() const { return m_cornerRadius; } + wxTextAttrDimension& GetCornerRadius() { return m_cornerRadius; } + + /** + Sets the corner radius value. + */ + void SetCornerRadius(const wxTextAttrDimension& dim) { m_cornerRadius = dim; m_flags |= wxTEXT_BOX_ATTR_CORNER_RADIUS; } + + /** + Returns the vertical alignment. + */ + wxTextBoxAttrVerticalAlignment GetVerticalAlignment() const { return m_verticalAlignment; } + + /** + Sets the vertical alignment. + */ + void SetVerticalAlignment(wxTextBoxAttrVerticalAlignment verticalAlignment) { m_verticalAlignment = verticalAlignment; m_flags |= wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT; } + + /** + Returns @true if a vertical alignment flag is present. + */ + bool HasVerticalAlignment() const { return HasFlag(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT); } + + /** + Returns the margin values. + */ + wxTextAttrDimensions& GetMargins() { return m_margins; } + const wxTextAttrDimensions& GetMargins() const { return m_margins; } + + /** + Returns the left margin. + */ + wxTextAttrDimension& GetLeftMargin() { return m_margins.m_left; } + const wxTextAttrDimension& GetLeftMargin() const { return m_margins.m_left; } + + /** + Returns the right margin. + */ + wxTextAttrDimension& GetRightMargin() { return m_margins.m_right; } + const wxTextAttrDimension& GetRightMargin() const { return m_margins.m_right; } + + /** + Returns the top margin. + */ + wxTextAttrDimension& GetTopMargin() { return m_margins.m_top; } + const wxTextAttrDimension& GetTopMargin() const { return m_margins.m_top; } + + /** + Returns the bottom margin. + */ + wxTextAttrDimension& GetBottomMargin() { return m_margins.m_bottom; } + const wxTextAttrDimension& GetBottomMargin() const { return m_margins.m_bottom; } + + /** + Returns the position. + */ + wxTextAttrDimensions& GetPosition() { return m_position; } + const wxTextAttrDimensions& GetPosition() const { return m_position; } + + /** + Returns the left position. + */ + wxTextAttrDimension& GetLeft() { return m_position.m_left; } + const wxTextAttrDimension& GetLeft() const { return m_position.m_left; } + + /** + Returns the right position. + */ + wxTextAttrDimension& GetRight() { return m_position.m_right; } + const wxTextAttrDimension& GetRight() const { return m_position.m_right; } + + /** + Returns the top position. + */ + wxTextAttrDimension& GetTop() { return m_position.m_top; } + const wxTextAttrDimension& GetTop() const { return m_position.m_top; } + + /** + Returns the bottom position. + */ + wxTextAttrDimension& GetBottom() { return m_position.m_bottom; } + const wxTextAttrDimension& GetBottom() const { return m_position.m_bottom; } + + /** + Returns the padding values. + */ + wxTextAttrDimensions& GetPadding() { return m_padding; } + const wxTextAttrDimensions& GetPadding() const { return m_padding; } + + /** + Returns the left padding value. + */ + wxTextAttrDimension& GetLeftPadding() { return m_padding.m_left; } + const wxTextAttrDimension& GetLeftPadding() const { return m_padding.m_left; } + + /** + Returns the right padding value. + */ + wxTextAttrDimension& GetRightPadding() { return m_padding.m_right; } + const wxTextAttrDimension& GetRightPadding() const { return m_padding.m_right; } + + /** + Returns the top padding value. + */ + wxTextAttrDimension& GetTopPadding() { return m_padding.m_top; } + const wxTextAttrDimension& GetTopPadding() const { return m_padding.m_top; } + + /** + Returns the bottom padding value. + */ + wxTextAttrDimension& GetBottomPadding() { return m_padding.m_bottom; } + const wxTextAttrDimension& GetBottomPadding() const { return m_padding.m_bottom; } + + /** + Returns the borders. + */ + wxTextAttrBorders& GetBorder() { return m_border; } + const wxTextAttrBorders& GetBorder() const { return m_border; } + + /** + Returns the left border. + */ + wxTextAttrBorder& GetLeftBorder() { return m_border.m_left; } + const wxTextAttrBorder& GetLeftBorder() const { return m_border.m_left; } + + /** + Returns the top border. + */ + wxTextAttrBorder& GetTopBorder() { return m_border.m_top; } + const wxTextAttrBorder& GetTopBorder() const { return m_border.m_top; } + + /** + Returns the right border. + */ + wxTextAttrBorder& GetRightBorder() { return m_border.m_right; } + const wxTextAttrBorder& GetRightBorder() const { return m_border.m_right; } + + /** + Returns the bottom border. + */ + wxTextAttrBorder& GetBottomBorder() { return m_border.m_bottom; } + const wxTextAttrBorder& GetBottomBorder() const { return m_border.m_bottom; } + + /** + Returns the outline. + */ + wxTextAttrBorders& GetOutline() { return m_outline; } + const wxTextAttrBorders& GetOutline() const { return m_outline; } + + /** + Returns the left outline. + */ + wxTextAttrBorder& GetLeftOutline() { return m_outline.m_left; } + const wxTextAttrBorder& GetLeftOutline() const { return m_outline.m_left; } + + /** + Returns the top outline. + */ + wxTextAttrBorder& GetTopOutline() { return m_outline.m_top; } + const wxTextAttrBorder& GetTopOutline() const { return m_outline.m_top; } + + /** + Returns the right outline. + */ + wxTextAttrBorder& GetRightOutline() { return m_outline.m_right; } + const wxTextAttrBorder& GetRightOutline() const { return m_outline.m_right; } + + /** + Returns the bottom outline. + */ + wxTextAttrBorder& GetBottomOutline() { return m_outline.m_bottom; } + const wxTextAttrBorder& GetBottomOutline() const { return m_outline.m_bottom; } + + /** + Returns the object size. + */ + wxTextAttrSize& GetSize() { return m_size; } + const wxTextAttrSize& GetSize() const { return m_size; } + + /** + Returns the object minimum size. + */ + + wxTextAttrSize& GetMinSize() { return m_minSize; } + const wxTextAttrSize& GetMinSize() const { return m_minSize; } + + /** + Returns the object maximum size. + */ + + wxTextAttrSize& GetMaxSize() { return m_maxSize; } + const wxTextAttrSize& GetMaxSize() const { return m_maxSize; } + + /** + Sets the object size. + */ + void SetSize(const wxTextAttrSize& sz) { m_size = sz; } + + /** + Sets the object minimum size. + */ + void SetMinSize(const wxTextAttrSize& sz) { m_minSize = sz; } + + /** + Sets the object maximum size. + */ + void SetMaxSize(const wxTextAttrSize& sz) { m_maxSize = sz; } + + /** + Returns the object width. + */ + wxTextAttrDimension& GetWidth() { return m_size.m_width; } + const wxTextAttrDimension& GetWidth() const { return m_size.m_width; } + + /** + Returns the object height. + */ + wxTextAttrDimension& GetHeight() { return m_size.m_height; } + const wxTextAttrDimension& GetHeight() const { return m_size.m_height; } + + /** + Returns the box style name. + */ + const wxString& GetBoxStyleName() const { return m_boxStyleName; } + + /** + Sets the box style name. + */ + void SetBoxStyleName(const wxString& name) { m_boxStyleName = name; AddFlag(wxTEXT_BOX_ATTR_BOX_STYLE_NAME); } + + /** + Returns @true if the box style name is present. + */ + bool HasBoxStyleName() const { return HasFlag(wxTEXT_BOX_ATTR_BOX_STYLE_NAME); } + + /** + Returns the box shadow attributes. + */ + wxTextAttrShadow& GetShadow() { return m_shadow; } + const wxTextAttrShadow& GetShadow() const { return m_shadow; } + + /** + Sets the box shadow attributes. + */ + void SetShadow(const wxTextAttrShadow& shadow) { m_shadow = shadow; } + +public: + + int m_flags; + + wxTextAttrDimensions m_margins; + wxTextAttrDimensions m_padding; + wxTextAttrDimensions m_position; + + wxTextAttrSize m_size; + wxTextAttrSize m_minSize; + wxTextAttrSize m_maxSize; + + wxTextAttrBorders m_border; + wxTextAttrBorders m_outline; + + wxTextBoxAttrFloatStyle m_floatMode; + wxTextBoxAttrClearStyle m_clearMode; + wxTextBoxAttrCollapseMode m_collapseMode; + wxTextBoxAttrVerticalAlignment m_verticalAlignment; + wxTextBoxAttrWhitespaceMode m_whitespaceMode; + wxTextAttrDimension m_cornerRadius; + wxString m_boxStyleName; + wxTextAttrShadow m_shadow; +}; + +/** + @class wxRichTextAttr + A class representing enhanced attributes for rich text objects. + This adds a wxTextBoxAttr member to the basic wxTextAttr class. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextAttr, wxTextBoxAttr, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextAttr: public wxTextAttr +{ +public: + /** + Constructor taking a wxTextAttr. + */ + wxRichTextAttr(const wxTextAttr& attr) { wxTextAttr::Copy(attr); } + + /** + Copy constructor. + */ + wxRichTextAttr(const wxRichTextAttr& attr): wxTextAttr() { Copy(attr); } + + /** + Default constructor. + */ + wxRichTextAttr() {} + + /** + Copy function. + */ + void Copy(const wxRichTextAttr& attr); + + /** + Assignment operator. + */ + void operator=(const wxRichTextAttr& attr) { Copy(attr); } + + /** + Assignment operator. + */ + void operator=(const wxTextAttr& attr) { wxTextAttr::Copy(attr); } + + /** + Equality test. + */ + bool operator==(const wxRichTextAttr& attr) const; + + /** + Partial equality test. If @a weakTest is @true, attributes of this object do not + have to be present if those attributes of @a attr are present. If @a weakTest is + @false, the function will fail if an attribute is present in @a attr but not + in this object. + */ + bool EqPartial(const wxRichTextAttr& attr, bool weakTest = true) const; + + /** + Merges the given attributes. If @a compareWith + is non-NULL, then it will be used to mask out those attributes that are the same in style + and @a compareWith, for situations where we don't want to explicitly set inherited attributes. + */ + bool Apply(const wxRichTextAttr& style, const wxRichTextAttr* compareWith = NULL); + + /** + Collects the attributes that are common to a range of content, building up a note of + which attributes are absent in some objects and which clash in some objects. + */ + void CollectCommonAttributes(const wxRichTextAttr& attr, wxRichTextAttr& clashingAttr, wxRichTextAttr& absentAttr); + + /** + Removes the specified attributes from this object. + */ + bool RemoveStyle(const wxRichTextAttr& attr); + + /** + Returns the text box attributes. + */ + wxTextBoxAttr& GetTextBoxAttr() { return m_textBoxAttr; } + const wxTextBoxAttr& GetTextBoxAttr() const { return m_textBoxAttr; } + + /** + Set the text box attributes. + */ + void SetTextBoxAttr(const wxTextBoxAttr& attr) { m_textBoxAttr = attr; } + + /** + Returns @true if no attributes are set. + */ + bool IsDefault() const { return (GetFlags() == 0) && m_textBoxAttr.IsDefault(); } + + wxTextBoxAttr m_textBoxAttr; +}; + +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxRichTextAttr, wxRichTextAttrArray, WXDLLIMPEXP_RICHTEXT); + +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxVariant, wxRichTextVariantArray, WXDLLIMPEXP_RICHTEXT); + +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxRect, wxRichTextRectArray, WXDLLIMPEXP_RICHTEXT); + +/** + @class wxRichTextProperties + A simple property class using wxVariants. This is used to give each rich text object the + ability to store custom properties that can be used by the application. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextBuffer, wxRichTextObject, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextProperties: public wxObject +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextProperties); +public: + + /** + Default constructor. + */ + wxRichTextProperties() {} + + /** + Copy constructor. + */ + wxRichTextProperties(const wxRichTextProperties& props): wxObject() { Copy(props); } + + /** + Assignment operator. + */ + void operator=(const wxRichTextProperties& props) { Copy(props); } + + /** + Equality operator. + */ + bool operator==(const wxRichTextProperties& props) const; + + /** + Copies from @a props. + */ + void Copy(const wxRichTextProperties& props) { m_properties = props.m_properties; } + + /** + Returns the variant at the given index. + */ + const wxVariant& operator[](size_t idx) const { return m_properties[idx]; } + + /** + Returns the variant at the given index. + */ + wxVariant& operator[](size_t idx) { return m_properties[idx]; } + + /** + Clears the properties. + */ + void Clear() { m_properties.Clear(); } + + /** + Returns the array of variants implementing the properties. + */ + const wxRichTextVariantArray& GetProperties() const { return m_properties; } + + /** + Returns the array of variants implementing the properties. + */ + wxRichTextVariantArray& GetProperties() { return m_properties; } + + /** + Sets the array of variants. + */ + void SetProperties(const wxRichTextVariantArray& props) { m_properties = props; } + + /** + Returns all the property names. + */ + wxArrayString GetPropertyNames() const; + + /** + Returns a count of the properties. + */ + size_t GetCount() const { return m_properties.GetCount(); } + + /** + Returns @true if the given property is found. + */ + bool HasProperty(const wxString& name) const { return Find(name) != -1; } + + /** + Finds the given property. + */ + int Find(const wxString& name) const; + + /** + Removes the given property. + */ + bool Remove(const wxString& name); + + /** + Gets the property variant by name. + */ + const wxVariant& GetProperty(const wxString& name) const; + + /** + Finds or creates a property with the given name, returning a pointer to the variant. + */ + wxVariant* FindOrCreateProperty(const wxString& name); + + /** + Gets the value of the named property as a string. + */ + wxString GetPropertyString(const wxString& name) const; + + /** + Gets the value of the named property as a long integer. + */ + long GetPropertyLong(const wxString& name) const; + + /** + Gets the value of the named property as a boolean. + */ + bool GetPropertyBool(const wxString& name) const; + + /** + Gets the value of the named property as a double. + */ + double GetPropertyDouble(const wxString& name) const; + + /** + Sets the property by passing a variant which contains a name and value. + */ + void SetProperty(const wxVariant& variant); + + /** + Sets a property by name and variant. + */ + void SetProperty(const wxString& name, const wxVariant& variant); + + /** + Sets a property by name and string value. + */ + void SetProperty(const wxString& name, const wxString& value); + + /** + Sets a property by name and wxChar* value. + */ + void SetProperty(const wxString& name, const wxChar* value) { SetProperty(name, wxString(value)); } + + /** + Sets property by name and long integer value. + */ + void SetProperty(const wxString& name, long value); + + /** + Sets property by name and double value. + */ + void SetProperty(const wxString& name, double value); + + /** + Sets property by name and boolean value. + */ + void SetProperty(const wxString& name, bool value); + + /** + Removes the given properties from these properties. + */ + void RemoveProperties(const wxRichTextProperties& properties); + + /** + Merges the given properties with these properties. + */ + void MergeProperties(const wxRichTextProperties& properties); + +protected: + wxRichTextVariantArray m_properties; +}; + + +/** + @class wxRichTextFontTable + Manages quick access to a pool of fonts for rendering rich text. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextBuffer, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextFontTable: public wxObject +{ +public: + /** + Default constructor. + */ + wxRichTextFontTable(); + + /** + Copy constructor. + */ + wxRichTextFontTable(const wxRichTextFontTable& table); + virtual ~wxRichTextFontTable(); + + /** + Returns @true if the font table is valid. + */ + bool IsOk() const { return m_refData != NULL; } + + /** + Finds a font for the given attribute object. + */ + wxFont FindFont(const wxRichTextAttr& fontSpec); + + /** + Clears the font table. + */ + void Clear(); + + /** + Assignment operator. + */ + void operator= (const wxRichTextFontTable& table); + + /** + Equality operator. + */ + bool operator == (const wxRichTextFontTable& table) const; + + /** + Inequality operator. + */ + bool operator != (const wxRichTextFontTable& table) const { return !(*this == table); } + + /** + Set the font scale factor. + */ + void SetFontScale(double fontScale); + +protected: + + double m_fontScale; + + wxDECLARE_DYNAMIC_CLASS(wxRichTextFontTable); +}; + +/** + @class wxRichTextRange + + This stores beginning and end positions for a range of data. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextBuffer, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextRange +{ +public: +// Constructors + + /** + Default constructor. + */ + wxRichTextRange() { m_start = 0; m_end = 0; } + + /** + Constructor taking start and end positions. + */ + wxRichTextRange(long start, long end) { m_start = start; m_end = end; } + + /** + Copy constructor. + */ + wxRichTextRange(const wxRichTextRange& range) { m_start = range.m_start; m_end = range.m_end; } + ~wxRichTextRange() {} + + /** + Assigns @a range to this range. + */ + void operator =(const wxRichTextRange& range) { m_start = range.m_start; m_end = range.m_end; } + + /** + Equality operator. Returns @true if @a range is the same as this range. + */ + bool operator ==(const wxRichTextRange& range) const { return (m_start == range.m_start && m_end == range.m_end); } + + /** + Inequality operator. + */ + bool operator !=(const wxRichTextRange& range) const { return (m_start != range.m_start || m_end != range.m_end); } + + /** + Subtracts a range from this range. + */ + wxRichTextRange operator -(const wxRichTextRange& range) const { return wxRichTextRange(m_start - range.m_start, m_end - range.m_end); } + + /** + Adds a range to this range. + */ + wxRichTextRange operator +(const wxRichTextRange& range) const { return wxRichTextRange(m_start + range.m_start, m_end + range.m_end); } + + /** + Sets the range start and end positions. + */ + void SetRange(long start, long end) { m_start = start; m_end = end; } + + /** + Sets the start position. + */ + void SetStart(long start) { m_start = start; } + + /** + Returns the start position. + */ + long GetStart() const { return m_start; } + + /** + Sets the end position. + */ + void SetEnd(long end) { m_end = end; } + + /** + Gets the end position. + */ + long GetEnd() const { return m_end; } + + /** + Returns true if this range is completely outside @a range. + */ + bool IsOutside(const wxRichTextRange& range) const { return range.m_start > m_end || range.m_end < m_start; } + + /** + Returns true if this range is completely within @a range. + */ + bool IsWithin(const wxRichTextRange& range) const { return m_start >= range.m_start && m_end <= range.m_end; } + + /** + Returns true if @a pos was within the range. Does not match if the range is empty. + */ + bool Contains(long pos) const { return pos >= m_start && pos <= m_end ; } + + /** + Limit this range to be within @a range. + */ + bool LimitTo(const wxRichTextRange& range) ; + + /** + Gets the length of the range. + */ + long GetLength() const { return m_end - m_start + 1; } + + /** + Swaps the start and end. + */ + void Swap() { long tmp = m_start; m_start = m_end; m_end = tmp; } + + /** + Converts the API-standard range, whose end is one past the last character in + the range, to the internal form, which uses the first and last character + positions of the range. In other words, one is subtracted from the end position. + (n, n) is the range of a single character. + */ + wxRichTextRange ToInternal() const { return wxRichTextRange(m_start, m_end-1); } + + /** + Converts the internal range, which uses the first and last character positions + of the range, to the API-standard range, whose end is one past the last + character in the range. In other words, one is added to the end position. + (n, n+1) is the range of a single character. + */ + wxRichTextRange FromInternal() const { return wxRichTextRange(m_start, m_end+1); } + +protected: + long m_start; + long m_end; +}; + +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxRichTextRange, wxRichTextRangeArray, WXDLLIMPEXP_RICHTEXT); + +#define wxRICHTEXT_ALL wxRichTextRange(-2, -2) +#define wxRICHTEXT_NONE wxRichTextRange(-1, -1) + +#define wxRICHTEXT_NO_SELECTION wxRichTextRange(-2, -2) + +/** + @class wxRichTextSelection + + Stores selection information. The selection does not have to be contiguous, though currently non-contiguous + selections are only supported for a range of table cells (a geometric block of cells can consist + of a set of non-contiguous positions). + + The selection consists of an array of ranges, and the container that is the context for the selection. It + follows that a single selection object can only represent ranges with the same parent container. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextBuffer, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextSelection +{ +public: + /** + Copy constructor. + */ + wxRichTextSelection(const wxRichTextSelection& sel) { Copy(sel); } + + /** + Creates a selection from a range and a container. + */ + wxRichTextSelection(const wxRichTextRange& range, wxRichTextParagraphLayoutBox* container) { m_ranges.Add(range); m_container = container; } + + /** + Default constructor. + */ + wxRichTextSelection() { Reset(); } + + /** + Resets the selection. + */ + void Reset() { m_ranges.Clear(); m_container = NULL; } + + /** + Sets the selection. + */ + + void Set(const wxRichTextRange& range, wxRichTextParagraphLayoutBox* container) + { m_ranges.Clear(); m_ranges.Add(range); m_container = container; } + + /** + Adds a range to the selection. + */ + void Add(const wxRichTextRange& range) + { m_ranges.Add(range); } + + /** + Sets the selections from an array of ranges and a container object. + */ + void Set(const wxRichTextRangeArray& ranges, wxRichTextParagraphLayoutBox* container) + { m_ranges = ranges; m_container = container; } + + /** + Copies from @a sel. + */ + void Copy(const wxRichTextSelection& sel) + { m_ranges = sel.m_ranges; m_container = sel.m_container; } + + /** + Assignment operator. + */ + void operator=(const wxRichTextSelection& sel) { Copy(sel); } + + /** + Equality operator. + */ + bool operator==(const wxRichTextSelection& sel) const; + + /** + Index operator. + */ + wxRichTextRange operator[](size_t i) const { return GetRange(i); } + + /** + Returns the selection ranges. + */ + wxRichTextRangeArray& GetRanges() { return m_ranges; } + + /** + Returns the selection ranges. + */ + const wxRichTextRangeArray& GetRanges() const { return m_ranges; } + + /** + Sets the selection ranges. + */ + void SetRanges(const wxRichTextRangeArray& ranges) { m_ranges = ranges; } + + /** + Returns the number of ranges in the selection. + */ + size_t GetCount() const { return m_ranges.GetCount(); } + + /** + Returns the range at the given index. + + */ + wxRichTextRange GetRange(size_t i) const { return m_ranges[i]; } + + /** + Returns the first range if there is one, otherwise wxRICHTEXT_NO_SELECTION. + */ + wxRichTextRange GetRange() const { return (m_ranges.GetCount() > 0) ? (m_ranges[0]) : wxRICHTEXT_NO_SELECTION; } + + /** + Sets a single range. + */ + void SetRange(const wxRichTextRange& range) { m_ranges.Clear(); m_ranges.Add(range); } + + /** + Returns the container for which the selection is valid. + */ + wxRichTextParagraphLayoutBox* GetContainer() const { return m_container; } + + /** + Sets the container for which the selection is valid. + */ + void SetContainer(wxRichTextParagraphLayoutBox* container) { m_container = container; } + + /** + Returns @true if the selection is valid. + */ + bool IsValid() const { return m_ranges.GetCount() > 0 && GetContainer(); } + + /** + Returns the selection appropriate to the specified object, if any; returns an empty array if none + at the level of the object's container. + */ + wxRichTextRangeArray GetSelectionForObject(wxRichTextObject* obj) const; + + /** + Returns @true if the given position is within the selection. + */ + bool WithinSelection(long pos, wxRichTextObject* obj) const; + + /** + Returns @true if the given position is within the selection. + + */ + bool WithinSelection(long pos) const { return WithinSelection(pos, m_ranges); } + + /** + Returns @true if the given position is within the selection range. + */ + static bool WithinSelection(long pos, const wxRichTextRangeArray& ranges); + + /** + Returns @true if the given range is within the selection range. + */ + static bool WithinSelection(const wxRichTextRange& range, const wxRichTextRangeArray& ranges); + + wxRichTextRangeArray m_ranges; + wxRichTextParagraphLayoutBox* m_container; +}; + +/** + @class wxRichTextDrawingContext + + A class for passing information to drawing and measuring functions. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextBuffer, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextDrawingContext: public wxObject +{ + wxDECLARE_CLASS(wxRichTextDrawingContext); +public: + + /** + Pass the buffer to the context so the context can retrieve information + such as virtual attributes. + */ + wxRichTextDrawingContext(wxRichTextBuffer* buffer); + + void Init() + { m_buffer = NULL; m_enableVirtualAttributes = true; m_enableImages = true; m_layingOut = false; m_enableDelayedImageLoading = false; } + + /** + Does this object have virtual attributes? + Virtual attributes can be provided for visual cues without + affecting the actual styling. + */ + bool HasVirtualAttributes(wxRichTextObject* obj) const; + + /** + Returns the virtual attributes for this object. + Virtual attributes can be provided for visual cues without + affecting the actual styling. + */ + wxRichTextAttr GetVirtualAttributes(wxRichTextObject* obj) const; + + /** + Applies any virtual attributes relevant to this object. + */ + bool ApplyVirtualAttributes(wxRichTextAttr& attr, wxRichTextObject* obj) const; + + /** + Gets the count for mixed virtual attributes for individual positions within the object. + For example, individual characters within a text object may require special highlighting. + */ + int GetVirtualSubobjectAttributesCount(wxRichTextObject* obj) const; + + /** + Gets the mixed virtual attributes for individual positions within the object. + For example, individual characters within a text object may require special highlighting. + The function is passed the count returned by GetVirtualSubobjectAttributesCount. + */ + int GetVirtualSubobjectAttributes(wxRichTextObject* obj, wxArrayInt& positions, wxRichTextAttrArray& attributes) const; + + /** + Do we have virtual text for this object? Virtual text allows an application + to replace characters in an object for editing and display purposes, for example + for highlighting special characters. + */ + bool HasVirtualText(const wxRichTextPlainText* obj) const; + + /** + Gets the virtual text for this object. + */ + bool GetVirtualText(const wxRichTextPlainText* obj, wxString& text) const; + + /** + Enables virtual attribute processing. + */ + + void EnableVirtualAttributes(bool b) { m_enableVirtualAttributes = b; } + + /** + Returns @true if virtual attribute processing is enabled. + */ + + bool GetVirtualAttributesEnabled() const { return m_enableVirtualAttributes; } + + /** + Enable or disable images + */ + + void EnableImages(bool b) { m_enableImages = b; } + + /** + Returns @true if images are enabled. + */ + + bool GetImagesEnabled() const { return m_enableImages; } + + /** + Set laying out flag + */ + + void SetLayingOut(bool b) { m_layingOut = b; } + + /** + Returns @true if laying out. + */ + + bool GetLayingOut() const { return m_layingOut; } + + /** + Enable or disable delayed image loading + */ + + void EnableDelayedImageLoading(bool b) { m_enableDelayedImageLoading = b; } + + /** + Returns @true if delayed image loading is enabled. + */ + + bool GetDelayedImageLoading() const { return m_enableDelayedImageLoading; } + + /** + Returns the buffer pointer. + */ + + wxRichTextBuffer* GetBuffer() const { return m_buffer; } + + wxRichTextBuffer* m_buffer; + bool m_enableVirtualAttributes; + bool m_enableImages; + bool m_enableDelayedImageLoading; + bool m_layingOut; +}; + +/** + @class wxRichTextObject + + This is the base for drawable rich text objects. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextBuffer, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextObject: public wxObject +{ + wxDECLARE_CLASS(wxRichTextObject); +public: + /** + Constructor, taking an optional parent pointer. + */ + wxRichTextObject(wxRichTextObject* parent = NULL); + + virtual ~wxRichTextObject(); + +// Overridables + + /** + Draw the item, within the given range. Some objects may ignore the range (for + example paragraphs) while others must obey it (lines, to implement wrapping) + */ + virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style) = 0; + + /** + Lay the item out at the specified position with the given size constraint. + Layout must set the cached size. @rect is the available space for the object, + and @a parentRect is the container that is used to determine a relative size + or position (for example if a text box must be 50% of the parent text box). + */ + virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style) = 0; + + /** + Hit-testing: returns a flag indicating hit test details, plus + information about position. @a contextObj is returned to specify what object + position is relevant to, since otherwise there's an ambiguity. + @ obj might not be a child of @a contextObj, since we may be referring to the container itself + if we have no hit on a child - for example if we click outside an object. + + The function puts the position in @a textPosition if one is found. + @a pt is in logical units (a zero y position is at the beginning of the buffer). + + Pass wxRICHTEXT_HITTEST_NO_NESTED_OBJECTS if you only want to consider objects + directly under the object you are calling HitTest on. Otherwise, it will recurse + and potentially find a nested object. + + @return One of the ::wxRichTextHitTestFlags values. + */ + + virtual int HitTest(wxDC& dc, wxRichTextDrawingContext& context, const wxPoint& pt, long& textPosition, wxRichTextObject** obj, wxRichTextObject** contextObj, int flags = 0); + + /** + Finds the absolute position and row height for the given character position. + */ + virtual bool FindPosition(wxDC& WXUNUSED(dc), wxRichTextDrawingContext& WXUNUSED(context), long WXUNUSED(index), wxPoint& WXUNUSED(pt), int* WXUNUSED(height), bool WXUNUSED(forceLineStart)) { return false; } + + /** + Returns the best size, i.e. the ideal starting size for this object irrespective + of available space. For a short text string, it will be the size that exactly encloses + the text. For a longer string, it might use the parent width for example. + */ + virtual wxSize GetBestSize() const { return m_size; } + + /** + Returns the object size for the given range. Returns @false if the range + is invalid for this object. + */ + + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const = 0; + + /** + Do a split from @a pos, returning an object containing the second part, and setting + the first part in 'this'. + */ + virtual wxRichTextObject* DoSplit(long WXUNUSED(pos)) { return NULL; } + + /** + Calculates the range of the object. By default, guess that the object is 1 unit long. + */ + virtual void CalculateRange(long start, long& end) { end = start ; m_range.SetRange(start, end); } + + /** + Deletes the given range. + */ + virtual bool DeleteRange(const wxRichTextRange& WXUNUSED(range)) { return false; } + + /** + Returns @true if the object is empty. + */ + virtual bool IsEmpty() const { return false; } + + /** + Returns @true if this class of object is floatable. + */ + virtual bool IsFloatable() const { return false; } + + /** + Returns @true if this object is currently floating. + */ + virtual bool IsFloating() const { return GetAttributes().GetTextBoxAttr().IsFloating(); } + + /** + Returns the floating direction. + */ + virtual int GetFloatDirection() const { return GetAttributes().GetTextBoxAttr().GetFloatMode(); } + + /** + Returns any text in this object for the given range. + */ + virtual wxString GetTextForRange(const wxRichTextRange& WXUNUSED(range)) const { return wxEmptyString; } + + /** + Returns @true if this object can merge itself with the given one. + */ + virtual bool CanMerge(wxRichTextObject* WXUNUSED(object), wxRichTextDrawingContext& WXUNUSED(context)) const { return false; } + + /** + Returns @true if this object merged itself with the given one. + The calling code will then delete the given object. + */ + virtual bool Merge(wxRichTextObject* WXUNUSED(object), wxRichTextDrawingContext& WXUNUSED(context)) { return false; } + + /** + Returns @true if this object can potentially be split, by virtue of having + different virtual attributes for individual sub-objects. + */ + virtual bool CanSplit(wxRichTextDrawingContext& WXUNUSED(context)) const { return false; } + + /** + Returns the final object in the split objects if this object was split due to differences between sub-object virtual attributes. + Returns itself if it was not split. + */ + virtual wxRichTextObject* Split(wxRichTextDrawingContext& WXUNUSED(context)) { return this; } + + /** + Dump object data to the given output stream for debugging. + */ + virtual void Dump(wxTextOutputStream& stream); + + /** + Returns @true if we can edit the object's properties via a GUI. + */ + virtual bool CanEditProperties() const { return false; } + + /** + Edits the object's properties via a GUI. + */ + virtual bool EditProperties(wxWindow* WXUNUSED(parent), wxRichTextBuffer* WXUNUSED(buffer)) { return false; } + + /** + Returns the label to be used for the properties context menu item. + */ + virtual wxString GetPropertiesMenuLabel() const { return wxEmptyString; } + + /** + Returns @true if objects of this class can accept the focus, i.e. a call to SetFocusObject + is possible. For example, containers supporting text, such as a text box object, can accept the focus, + but a table can't (set the focus to individual cells instead). + */ + virtual bool AcceptsFocus() const { return false; } + +#if wxUSE_XML + /** + Imports this object from XML. + */ + virtual bool ImportFromXML(wxRichTextBuffer* buffer, wxXmlNode* node, wxRichTextXMLHandler* handler, bool* recurse); +#endif + +#if wxRICHTEXT_HAVE_DIRECT_OUTPUT + /** + Exports this object directly to the given stream, bypassing the creation of a wxXmlNode hierarchy. + This method is considerably faster than creating a tree first. However, both versions of ExportXML must be + implemented so that if the tree method is made efficient in the future, we can deprecate the + more verbose direct output method. Compiled only if wxRICHTEXT_HAVE_DIRECT_OUTPUT is defined (on by default). + */ + virtual bool ExportXML(wxOutputStream& stream, int indent, wxRichTextXMLHandler* handler); +#endif + +#if wxRICHTEXT_HAVE_XMLDOCUMENT_OUTPUT + /** + Exports this object to the given parent node, usually creating at least one child node. + This method is less efficient than the direct-to-stream method but is retained to allow for + switching to this method if we make it more efficient. Compiled only if wxRICHTEXT_HAVE_XMLDOCUMENT_OUTPUT is defined + (on by default). + */ + virtual bool ExportXML(wxXmlNode* parent, wxRichTextXMLHandler* handler); +#endif + + /** + Returns @true if this object takes note of paragraph attributes (text and image objects don't). + */ + virtual bool UsesParagraphAttributes() const { return true; } + + /** + Returns the XML node name of this object. This must be overridden for wxXmlNode-base XML export to work. + */ + virtual wxString GetXMLNodeName() const { return wxT("unknown"); } + + /** + Invalidates the object at the given range. With no argument, invalidates the whole object. + */ + virtual void Invalidate(const wxRichTextRange& invalidRange = wxRICHTEXT_ALL); + + /** + Returns @true if this object can handle the selections of its children, fOr example a table. + Required for composite selection handling to work. + */ + virtual bool HandlesChildSelections() const { return false; } + + /** + Returns a selection object specifying the selections between start and end character positions. + For example, a table would deduce what cells (of range length 1) are selected when dragging across the table. + */ + virtual wxRichTextSelection GetSelection(long WXUNUSED(start), long WXUNUSED(end)) const { return wxRichTextSelection(); } + +// Accessors + + /** + Gets the cached object size as calculated by Layout. + */ + virtual wxSize GetCachedSize() const { return m_size; } + + /** + Sets the cached object size as calculated by Layout. + */ + virtual void SetCachedSize(const wxSize& sz) { m_size = sz; } + + /** + Gets the maximum object size as calculated by Layout. This allows + us to fit an object to its contents or allocate extra space if required. + */ + virtual wxSize GetMaxSize() const { return m_maxSize; } + + /** + Sets the maximum object size as calculated by Layout. This allows + us to fit an object to its contents or allocate extra space if required. + */ + virtual void SetMaxSize(const wxSize& sz) { m_maxSize = sz; } + + /** + Gets the minimum object size as calculated by Layout. This allows + us to constrain an object to its absolute minimum size if necessary. + */ + virtual wxSize GetMinSize() const { return m_minSize; } + + /** + Sets the minimum object size as calculated by Layout. This allows + us to constrain an object to its absolute minimum size if necessary. + */ + virtual void SetMinSize(const wxSize& sz) { m_minSize = sz; } + + /** + Gets the 'natural' size for an object. For an image, it would be the + image size. + */ + virtual wxTextAttrSize GetNaturalSize() const { return wxTextAttrSize(); } + + /** + Returns the object position in pixels. + */ + virtual wxPoint GetPosition() const { return m_pos; } + + /** + Sets the object position in pixels. + */ + virtual void SetPosition(const wxPoint& pos) { m_pos = pos; } + + /** + Returns the absolute object position, by traversing up the child/parent hierarchy. + TODO: may not be needed, if all object positions are in fact relative to the + top of the coordinate space. + */ + virtual wxPoint GetAbsolutePosition() const; + + /** + Returns the rectangle enclosing the object. + */ + virtual wxRect GetRect() const { return wxRect(GetPosition(), GetCachedSize()); } + + /** + Sets the object's range within its container. + */ + void SetRange(const wxRichTextRange& range) { m_range = range; } + + /** + Returns the object's range. + */ + const wxRichTextRange& GetRange() const { return m_range; } + + /** + Returns the object's range. + */ + wxRichTextRange& GetRange() { return m_range; } + + /** + Set the object's own range, for a top-level object with its own position space. + */ + void SetOwnRange(const wxRichTextRange& range) { m_ownRange = range; } + + /** + Returns the object's own range (valid if top-level). + */ + const wxRichTextRange& GetOwnRange() const { return m_ownRange; } + + /** + Returns the object's own range (valid if top-level). + */ + wxRichTextRange& GetOwnRange() { return m_ownRange; } + + /** + Returns the object's own range only if a top-level object. + */ + wxRichTextRange GetOwnRangeIfTopLevel() const { return IsTopLevel() ? m_ownRange : m_range; } + + /** + Returns @true if this object is composite. + */ + virtual bool IsComposite() const { return false; } + + /** + Returns @true if no user editing can be done inside the object. This returns @true for simple objects, + @false for most composite objects, but @true for fields, which if composite, should not be user-edited. + */ + virtual bool IsAtomic() const { return true; } + + /** + Returns a pointer to the parent object. + */ + virtual wxRichTextObject* GetParent() const { return m_parent; } + + /** + Sets the pointer to the parent object. + */ + virtual void SetParent(wxRichTextObject* parent) { m_parent = parent; } + + /** + Returns the top-level container of this object. + May return itself if it's a container; use GetParentContainer to return + a different container. + */ + virtual wxRichTextParagraphLayoutBox* GetContainer() const; + + /** + Returns the top-level container of this object. + Returns a different container than itself, unless there's no parent, in which case it will return NULL. + */ + virtual wxRichTextParagraphLayoutBox* GetParentContainer() const { return GetParent() ? GetParent()->GetContainer() : GetContainer(); } + + /** + Set the margin around the object, in pixels. + */ + virtual void SetMargins(int margin); + + /** + Set the margin around the object, in pixels. + */ + virtual void SetMargins(int leftMargin, int rightMargin, int topMargin, int bottomMargin); + + /** + Returns the left margin of the object, in pixels. + */ + virtual int GetLeftMargin() const; + + /** + Returns the right margin of the object, in pixels. + */ + virtual int GetRightMargin() const; + + /** + Returns the top margin of the object, in pixels. + */ + virtual int GetTopMargin() const; + + /** + Returns the bottom margin of the object, in pixels. + */ + virtual int GetBottomMargin() const; + + /** + Calculates the available content space in the given rectangle, given the + margins, border and padding specified in the object's attributes. + */ + virtual wxRect GetAvailableContentArea(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& outerRect) const; + + /** + Lays out the object first with a given amount of space, and then if no width was specified in attr, + lays out the object again using the minimum size. @a availableParentSpace is the maximum space + for the object, whereas @a availableContainerSpace is the container with which relative positions and + sizes should be computed. For example, a text box whose space has already been constrained + in a previous layout pass to @a availableParentSpace, but should have a width of 50% of @a availableContainerSpace. + (If these two rects were the same, a 2nd pass could see the object getting too small.) + */ + virtual bool LayoutToBestSize(wxDC& dc, wxRichTextDrawingContext& context, wxRichTextBuffer* buffer, + const wxRichTextAttr& parentAttr, const wxRichTextAttr& attr, + const wxRect& availableParentSpace, const wxRect& availableContainerSpace, int style); + + /** + Adjusts the attributes for virtual attribute provision, collapsed borders, etc. + */ + virtual bool AdjustAttributes(wxRichTextAttr& attr, wxRichTextDrawingContext& context); + + /** + Sets the object's attributes. + */ + void SetAttributes(const wxRichTextAttr& attr) { m_attributes = attr; } + + /** + Returns the object's attributes. + */ + const wxRichTextAttr& GetAttributes() const { return m_attributes; } + + /** + Returns the object's attributes. + */ + wxRichTextAttr& GetAttributes() { return m_attributes; } + + /** + Returns the object's properties. + */ + wxRichTextProperties& GetProperties() { return m_properties; } + + /** + Returns the object's properties. + */ + const wxRichTextProperties& GetProperties() const { return m_properties; } + + /** + Sets the object's properties. + */ + void SetProperties(const wxRichTextProperties& props) { m_properties = props; } + + /** + Sets the stored descent value. + */ + void SetDescent(int descent) { m_descent = descent; } + + /** + Returns the stored descent value. + */ + int GetDescent() const { return m_descent; } + + /** + Returns the containing buffer. + */ + wxRichTextBuffer* GetBuffer() const; + + /** + Sets the identifying name for this object as a property using the "name" key. + */ + void SetName(const wxString& name) { m_properties.SetProperty(wxT("name"), name); } + + /** + Returns the identifying name for this object from the properties, using the "name" key. + */ + wxString GetName() const { return m_properties.GetPropertyString(wxT("name")); } + + /** + Returns @true if this object is top-level, i.e. contains its own paragraphs, such as a text box. + */ + virtual bool IsTopLevel() const { return false; } + + /** + Returns @true if the object will be shown, @false otherwise. + */ + bool IsShown() const { return m_show; } + +// Operations + + /** + Call to show or hide this object. This function does not cause the content to be + laid out or redrawn. + */ + virtual void Show(bool show) { m_show = show; } + + /** + Clones the object. + */ + virtual wxRichTextObject* Clone() const { return NULL; } + + /** + Copies the object. + */ + void Copy(const wxRichTextObject& obj); + + /** + Reference-counting allows us to use the same object in multiple + lists (not yet used). + */ + + void Reference() { m_refCount ++; } + + /** + Reference-counting allows us to use the same object in multiple + lists (not yet used). + */ + void Dereference(); + + /** + Moves the object recursively, by adding the offset from old to new. + */ + virtual void Move(const wxPoint& pt); + + /** + Converts units in tenths of a millimetre to device units. + */ + int ConvertTenthsMMToPixels(wxDC& dc, int units) const; + + /** + Converts units in tenths of a millimetre to device units. + */ + static int ConvertTenthsMMToPixels(int ppi, int units, double scale = 1.0); + + /** + Convert units in pixels to tenths of a millimetre. + */ + int ConvertPixelsToTenthsMM(wxDC& dc, int pixels) const; + + /** + Convert units in pixels to tenths of a millimetre. + */ + static int ConvertPixelsToTenthsMM(int ppi, int pixels, double scale = 1.0); + + /** + Draws the borders and background for the given rectangle and attributes. + @a boxRect is taken to be the outer margin box, not the box around the content. + */ + static bool DrawBoxAttributes(wxDC& dc, wxRichTextBuffer* buffer, const wxRichTextAttr& attr, const wxRect& boxRect, int flags = 0, wxRichTextObject* obj = NULL); + + /** + Draws a border. + */ + static bool DrawBorder(wxDC& dc, wxRichTextBuffer* buffer, const wxRichTextAttr& attr, const wxTextAttrBorders& borders, const wxRect& rect, int flags = 0); + + /** + Returns the various rectangles of the box model in pixels. You can either specify @a contentRect (inner) + or @a marginRect (outer), and the other must be the default rectangle (no width or height). + Note that the outline doesn't affect the position of the rectangle, it's drawn in whatever space + is available. + */ + static bool GetBoxRects(wxDC& dc, wxRichTextBuffer* buffer, const wxRichTextAttr& attr, wxRect& marginRect, wxRect& borderRect, wxRect& contentRect, wxRect& paddingRect, wxRect& outlineRect); + + /** + Returns the total margin for the object in pixels, taking into account margin, padding and border size. + */ + static bool GetTotalMargin(wxDC& dc, wxRichTextBuffer* buffer, const wxRichTextAttr& attr, int& leftMargin, int& rightMargin, + int& topMargin, int& bottomMargin); + + /** + Returns the rectangle which the child has available to it given restrictions specified in the + child attribute, e.g. 50% width of the parent, 400 pixels, x position 20% of the parent, etc. + availableContainerSpace might be a parent that the cell has to compute its width relative to. + E.g. a cell that's 50% of its parent. + */ + static wxRect AdjustAvailableSpace(wxDC& dc, wxRichTextBuffer* buffer, const wxRichTextAttr& parentAttr, const wxRichTextAttr& childAttr, + const wxRect& availableParentSpace, const wxRect& availableContainerSpace); + +protected: + wxSize m_size; + wxSize m_maxSize; + wxSize m_minSize; + wxPoint m_pos; + int m_descent; // Descent for this object (if any) + int m_refCount; + bool m_show; + wxRichTextObject* m_parent; + + // The range of this object (start position to end position) + wxRichTextRange m_range; + + // The internal range of this object, if it's a top-level object with its own range space + wxRichTextRange m_ownRange; + + // Attributes + wxRichTextAttr m_attributes; + + // Properties + wxRichTextProperties m_properties; +}; + +WX_DECLARE_LIST_WITH_DECL( wxRichTextObject, wxRichTextObjectList, class WXDLLIMPEXP_RICHTEXT ); + +/** + @class wxRichTextCompositeObject + + Objects of this class can contain other objects. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextObject, wxRichTextBuffer, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextCompositeObject: public wxRichTextObject +{ + wxDECLARE_CLASS(wxRichTextCompositeObject); +public: +// Constructors + + wxRichTextCompositeObject(wxRichTextObject* parent = NULL); + virtual ~wxRichTextCompositeObject(); + +// Overridables + + virtual int HitTest(wxDC& dc, wxRichTextDrawingContext& context, const wxPoint& pt, long& textPosition, wxRichTextObject** obj, wxRichTextObject** contextObj, int flags = 0) wxOVERRIDE; + + virtual bool FindPosition(wxDC& dc, wxRichTextDrawingContext& context, long index, wxPoint& pt, int* height, bool forceLineStart) wxOVERRIDE; + + virtual void CalculateRange(long start, long& end) wxOVERRIDE; + + virtual bool DeleteRange(const wxRichTextRange& range) wxOVERRIDE; + + virtual wxString GetTextForRange(const wxRichTextRange& range) const wxOVERRIDE; + + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const wxOVERRIDE; + + virtual void Dump(wxTextOutputStream& stream) wxOVERRIDE; + + virtual void Invalidate(const wxRichTextRange& invalidRange = wxRICHTEXT_ALL) wxOVERRIDE; + +// Accessors + + /** + Returns the children. + */ + wxRichTextObjectList& GetChildren() { return m_children; } + /** + Returns the children. + */ + const wxRichTextObjectList& GetChildren() const { return m_children; } + + /** + Returns the number of children. + */ + size_t GetChildCount() const ; + + /** + Returns the nth child. + */ + wxRichTextObject* GetChild(size_t n) const ; + + /** + Returns @true if this object is composite. + */ + virtual bool IsComposite() const wxOVERRIDE { return true; } + + /** + Returns @true if no user editing can be done inside the object. This returns @true for simple objects, + @false for most composite objects, but @true for fields, which if composite, should not be user-edited. + */ + virtual bool IsAtomic() const wxOVERRIDE { return false; } + + /** + Returns true if the buffer is empty. + */ + virtual bool IsEmpty() const wxOVERRIDE { return GetChildCount() == 0; } + + /** + Returns the child object at the given character position. + */ + virtual wxRichTextObject* GetChildAtPosition(long pos) const; + +// Operations + + void Copy(const wxRichTextCompositeObject& obj); + + void operator= (const wxRichTextCompositeObject& obj) { Copy(obj); } + + /** + Appends a child, returning the position. + */ + size_t AppendChild(wxRichTextObject* child) ; + + /** + Inserts the child in front of the given object, or at the beginning. + */ + bool InsertChild(wxRichTextObject* child, wxRichTextObject* inFrontOf) ; + + /** + Removes and optionally deletes the specified child. + */ + bool RemoveChild(wxRichTextObject* child, bool deleteChild = false) ; + + /** + Deletes all the children. + */ + bool DeleteChildren() ; + + /** + Recursively merges all pieces that can be merged. + */ + bool Defragment(wxRichTextDrawingContext& context, const wxRichTextRange& range = wxRICHTEXT_ALL); + + /** + Moves the object recursively, by adding the offset from old to new. + */ + virtual void Move(const wxPoint& pt) wxOVERRIDE; + +protected: + wxRichTextObjectList m_children; +}; + +/** + @class wxRichTextParagraphLayoutBox + + This class knows how to lay out paragraphs. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextCompositeObject, wxRichTextObject, wxRichTextBuffer, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextParagraphLayoutBox: public wxRichTextCompositeObject +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextParagraphLayoutBox); +public: +// Constructors + + wxRichTextParagraphLayoutBox(wxRichTextObject* parent = NULL); + wxRichTextParagraphLayoutBox(const wxRichTextParagraphLayoutBox& obj): wxRichTextCompositeObject() { Init(); Copy(obj); } + ~wxRichTextParagraphLayoutBox(); + +// Overridables + + virtual int HitTest(wxDC& dc, wxRichTextDrawingContext& context, const wxPoint& pt, long& textPosition, wxRichTextObject** obj, wxRichTextObject** contextObj, int flags = 0) wxOVERRIDE; + + virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style) wxOVERRIDE; + + virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style) wxOVERRIDE; + + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const wxOVERRIDE; + + virtual bool DeleteRange(const wxRichTextRange& range) wxOVERRIDE; + + virtual wxString GetTextForRange(const wxRichTextRange& range) const wxOVERRIDE; + +#if wxUSE_XML + virtual bool ImportFromXML(wxRichTextBuffer* buffer, wxXmlNode* node, wxRichTextXMLHandler* handler, bool* recurse) wxOVERRIDE; +#endif + +#if wxRICHTEXT_HAVE_DIRECT_OUTPUT + virtual bool ExportXML(wxOutputStream& stream, int indent, wxRichTextXMLHandler* handler) wxOVERRIDE; +#endif + +#if wxRICHTEXT_HAVE_XMLDOCUMENT_OUTPUT + virtual bool ExportXML(wxXmlNode* parent, wxRichTextXMLHandler* handler) wxOVERRIDE; +#endif + + virtual wxString GetXMLNodeName() const wxOVERRIDE { return wxT("paragraphlayout"); } + + virtual bool AcceptsFocus() const wxOVERRIDE { return true; } + +// Accessors + + /** + Associates a control with the buffer, for operations that for example require refreshing the window. + */ + void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_ctrl = ctrl; } + + /** + Returns the associated control. + */ + wxRichTextCtrl* GetRichTextCtrl() const { return m_ctrl; } + + /** + Sets a flag indicating whether the last paragraph is partial or complete. + */ + void SetPartialParagraph(bool partialPara) { m_partialParagraph = partialPara; } + + /** + Returns a flag indicating whether the last paragraph is partial or complete. + */ + bool GetPartialParagraph() const { return m_partialParagraph; } + + /** + Returns the style sheet associated with the overall buffer. + */ + virtual wxRichTextStyleSheet* GetStyleSheet() const; + + virtual bool IsTopLevel() const wxOVERRIDE { return true; } + +// Operations + + /** + Submits a command to insert paragraphs. + */ + bool InsertParagraphsWithUndo(wxRichTextBuffer* buffer, long pos, const wxRichTextParagraphLayoutBox& paragraphs, wxRichTextCtrl* ctrl, int flags = 0); + + /** + Submits a command to insert the given text. + */ + bool InsertTextWithUndo(wxRichTextBuffer* buffer, long pos, const wxString& text, wxRichTextCtrl* ctrl, int flags = 0); + + /** + Submits a command to insert the given text. + */ + bool InsertNewlineWithUndo(wxRichTextBuffer* buffer, long pos, wxRichTextCtrl* ctrl, int flags = 0); + + /** + Submits a command to insert the given image. + */ + bool InsertImageWithUndo(wxRichTextBuffer* buffer, long pos, const wxRichTextImageBlock& imageBlock, + wxRichTextCtrl* ctrl, int flags, const wxRichTextAttr& textAttr); + + /** + Submits a command to insert the given field. Field data can be included in properties. + + @see wxRichTextField, wxRichTextFieldType, wxRichTextFieldTypeStandard + */ + wxRichTextField* InsertFieldWithUndo(wxRichTextBuffer* buffer, long pos, const wxString& fieldType, + const wxRichTextProperties& properties, + wxRichTextCtrl* ctrl, int flags, + const wxRichTextAttr& textAttr); + + /** + Returns the style that is appropriate for a new paragraph at this position. + If the previous paragraph has a paragraph style name, looks up the next-paragraph + style. + */ + wxRichTextAttr GetStyleForNewParagraph(wxRichTextBuffer* buffer, long pos, bool caretPosition = false, bool lookUpNewParaStyle=false) const; + + /** + Inserts an object. + */ + wxRichTextObject* InsertObjectWithUndo(wxRichTextBuffer* buffer, long pos, wxRichTextObject *object, wxRichTextCtrl* ctrl, int flags = 0); + + /** + Submits a command to delete this range. + */ + bool DeleteRangeWithUndo(const wxRichTextRange& range, wxRichTextCtrl* ctrl, wxRichTextBuffer* buffer); + + /** + Draws the floating objects in this buffer. + */ + void DrawFloats(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style); + + /** + Moves an anchored object to another paragraph. + */ + void MoveAnchoredObjectToParagraph(wxRichTextParagraph* from, wxRichTextParagraph* to, wxRichTextObject* obj); + + /** + Initializes the object. + */ + void Init(); + + /** + Clears all the children. + */ + virtual void Clear(); + + /** + Clears and initializes with one blank paragraph. + */ + virtual void Reset(); + + /** + Convenience function to add a paragraph of text. + */ + virtual wxRichTextRange AddParagraph(const wxString& text, wxRichTextAttr* paraStyle = NULL); + + /** + Convenience function to add an image. + */ + virtual wxRichTextRange AddImage(const wxImage& image, wxRichTextAttr* paraStyle = NULL); + + /** + Adds multiple paragraphs, based on newlines. + */ + virtual wxRichTextRange AddParagraphs(const wxString& text, wxRichTextAttr* paraStyle = NULL); + + /** + Returns the line at the given position. If @a caretPosition is true, the position is + a caret position, which is normally a smaller number. + */ + virtual wxRichTextLine* GetLineAtPosition(long pos, bool caretPosition = false) const; + + /** + Returns the line at the given y pixel position, or the last line. + */ + virtual wxRichTextLine* GetLineAtYPosition(int y) const; + + /** + Returns the paragraph at the given character or caret position. + */ + virtual wxRichTextParagraph* GetParagraphAtPosition(long pos, bool caretPosition = false) const; + + /** + Returns the line size at the given position. + */ + virtual wxSize GetLineSizeAtPosition(long pos, bool caretPosition = false) const; + + /** + Given a position, returns the number of the visible line (potentially many to a paragraph), + starting from zero at the start of the buffer. We also have to pass a bool (@a startOfLine) + that indicates whether the caret is being shown at the end of the previous line or at the start + of the next, since the caret can be shown at two visible positions for the same underlying + position. + */ + virtual long GetVisibleLineNumber(long pos, bool caretPosition = false, bool startOfLine = false) const; + + /** + Given a line number, returns the corresponding wxRichTextLine object. + */ + virtual wxRichTextLine* GetLineForVisibleLineNumber(long lineNumber) const; + + /** + Returns the leaf object in a paragraph at this position. + */ + virtual wxRichTextObject* GetLeafObjectAtPosition(long position) const; + + /** + Returns the paragraph by number. + */ + virtual wxRichTextParagraph* GetParagraphAtLine(long paragraphNumber) const; + + /** + Returns the paragraph for a given line. + */ + virtual wxRichTextParagraph* GetParagraphForLine(wxRichTextLine* line) const; + + /** + Returns the length of the paragraph. + */ + virtual int GetParagraphLength(long paragraphNumber) const; + + /** + Returns the number of paragraphs. + */ + virtual int GetParagraphCount() const { return static_cast<int>(GetChildCount()); } + + /** + Returns the number of visible lines. + */ + virtual int GetLineCount() const; + + /** + Returns the text of the paragraph. + */ + virtual wxString GetParagraphText(long paragraphNumber) const; + + /** + Converts zero-based line column and paragraph number to a position. + */ + virtual long XYToPosition(long x, long y) const; + + /** + Converts a zero-based position to line column and paragraph number. + */ + virtual bool PositionToXY(long pos, long* x, long* y) const; + + /** + Sets the attributes for the given range. Pass flags to determine how the + attributes are set. + + The end point of range is specified as the last character position of the span + of text. So, for example, to set the style for a character at position 5, + use the range (5,5). + This differs from the wxRichTextCtrl API, where you would specify (5,6). + + @a flags may contain a bit list of the following values: + - wxRICHTEXT_SETSTYLE_NONE: no style flag. + - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this operation should be + undoable. + - wxRICHTEXT_SETSTYLE_OPTIMIZE: specifies that the style should not be applied + if the combined style at this point is already the style in question. + - wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY: specifies that the style should only be + applied to paragraphs, and not the content. + This allows content styling to be preserved independently from that + of e.g. a named paragraph style. + - wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY: specifies that the style should only be + applied to characters, and not the paragraph. + This allows content styling to be preserved independently from that + of e.g. a named paragraph style. + - wxRICHTEXT_SETSTYLE_RESET: resets (clears) the existing style before applying + the new style. + - wxRICHTEXT_SETSTYLE_REMOVE: removes the specified style. + Only the style flags are used in this operation. + */ + virtual bool SetStyle(const wxRichTextRange& range, const wxRichTextAttr& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); + + /** + Sets the attributes for the given object only, for example the box attributes for a text box. + */ + virtual void SetStyle(wxRichTextObject *obj, const wxRichTextAttr& textAttr, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); + + /** + Returns the combined text attributes for this position. + + This function gets the @e uncombined style - that is, the attributes associated + with the paragraph or character content, and not necessarily the combined + attributes you see on the screen. To get the combined attributes, use GetStyle(). + If you specify (any) paragraph attribute in @e style's flags, this function + will fetch the paragraph attributes. + Otherwise, it will return the character attributes. + */ + virtual bool GetStyle(long position, wxRichTextAttr& style); + + /** + Returns the content (uncombined) attributes for this position. + */ + virtual bool GetUncombinedStyle(long position, wxRichTextAttr& style); + + /** + Implementation helper for GetStyle. If combineStyles is true, combine base, paragraph and + context attributes. + */ + virtual bool DoGetStyle(long position, wxRichTextAttr& style, bool combineStyles = true); + + /** + This function gets a style representing the common, combined attributes in the + given range. + Attributes which have different values within the specified range will not be + included the style flags. + + The function is used to get the attributes to display in the formatting dialog: + the user can edit the attributes common to the selection, and optionally specify the + values of further attributes to be applied uniformly. + + To apply the edited attributes, you can use SetStyle() specifying + the wxRICHTEXT_SETSTYLE_OPTIMIZE flag, which will only apply attributes that + are different from the @e combined attributes within the range. + So, the user edits the effective, displayed attributes for the range, + but his choice won't be applied unnecessarily to content. As an example, + say the style for a paragraph specifies bold, but the paragraph text doesn't + specify a weight. + The combined style is bold, and this is what the user will see on-screen and + in the formatting dialog. The user now specifies red text, in addition to bold. + When applying with SetStyle(), the content font weight attributes won't be + changed to bold because this is already specified by the paragraph. + However the text colour attributes @e will be changed to show red. + */ + virtual bool GetStyleForRange(const wxRichTextRange& range, wxRichTextAttr& style); + + /** + Combines @a style with @a currentStyle for the purpose of summarising the attributes of a range of + content. + */ + bool CollectStyle(wxRichTextAttr& currentStyle, const wxRichTextAttr& style, wxRichTextAttr& clashingAttr, wxRichTextAttr& absentAttr); + + //@{ + /** + Sets the list attributes for the given range, passing flags to determine how + the attributes are set. + Either the style definition or the name of the style definition (in the current + sheet) can be passed. + + @a flags is a bit list of the following: + - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable. + - wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from + @a startFrom, otherwise existing attributes are used. + - wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used + as the level for all paragraphs, otherwise the current indentation will be used. + + @see NumberList(), PromoteList(), ClearListStyle(). + */ + virtual bool SetListStyle(const wxRichTextRange& range, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); + virtual bool SetListStyle(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); + //@} + + /** + Clears the list style from the given range, clearing list-related attributes + and applying any named paragraph style associated with each paragraph. + + @a flags is a bit list of the following: + - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable. + + @see SetListStyle(), PromoteList(), NumberList() + */ + virtual bool ClearListStyle(const wxRichTextRange& range, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); + + //@{ + /** + Numbers the paragraphs in the given range. + + Pass flags to determine how the attributes are set. + Either the style definition or the name of the style definition (in the current + sheet) can be passed. + + @a flags is a bit list of the following: + - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable. + - wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from + @a startFrom, otherwise existing attributes are used. + - wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used + as the level for all paragraphs, otherwise the current indentation will be used. + + @a def can be NULL to indicate that the existing list style should be used. + + @see SetListStyle(), PromoteList(), ClearListStyle() + */ + virtual bool NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); + virtual bool NumberList(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); + //@} + + //@{ + /** + Promotes the list items within the given range. + A positive @a promoteBy produces a smaller indent, and a negative number + produces a larger indent. Pass flags to determine how the attributes are set. + Either the style definition or the name of the style definition (in the current + sheet) can be passed. + + @a flags is a bit list of the following: + - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable. + - wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from + @a startFrom, otherwise existing attributes are used. + - wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used + as the level for all paragraphs, otherwise the current indentation will be used. + + @see SetListStyle(), SetListStyle(), ClearListStyle() + */ + virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1); + virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1); + //@} + + /** + Helper for NumberList and PromoteList, that does renumbering and promotion simultaneously + @a def can be NULL/empty to indicate that the existing list style should be used. + */ + virtual bool DoNumberList(const wxRichTextRange& range, const wxRichTextRange& promotionRange, int promoteBy, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); + + /** + Fills in the attributes for numbering a paragraph after previousParagraph. + */ + virtual bool FindNextParagraphNumber(wxRichTextParagraph* previousParagraph, wxRichTextAttr& attr) const; + + /** + Sets the properties for the given range, passing flags to determine how the + attributes are set. You can merge properties or replace them. + + The end point of range is specified as the last character position of the span + of text, plus one. So, for example, to set the properties for a character at + position 5, use the range (5,6). + + @a flags may contain a bit list of the following values: + - wxRICHTEXT_SETPROPERTIES_NONE: no flag. + - wxRICHTEXT_SETPROPERTIES_WITH_UNDO: specifies that this operation should be + undoable. + - wxRICHTEXT_SETPROPERTIES_PARAGRAPHS_ONLY: specifies that the properties should only be + applied to paragraphs, and not the content. + - wxRICHTEXT_SETPROPERTIES_CHARACTERS_ONLY: specifies that the properties should only be + applied to characters, and not the paragraph. + - wxRICHTEXT_SETPROPERTIES_RESET: resets (clears) the existing properties before applying + the new properties. + - wxRICHTEXT_SETPROPERTIES_REMOVE: removes the specified properties. + */ + virtual bool SetProperties(const wxRichTextRange& range, const wxRichTextProperties& properties, int flags = wxRICHTEXT_SETPROPERTIES_WITH_UNDO); + + /** + Sets with undo the properties for the given object. + */ + virtual bool SetObjectPropertiesWithUndo(wxRichTextObject& obj, const wxRichTextProperties& properties, wxRichTextObject* objToSet = NULL); + + /** + Test if this whole range has character attributes of the specified kind. If any + of the attributes are different within the range, the test fails. You + can use this to implement, for example, bold button updating. style must have + flags indicating which attributes are of interest. + */ + virtual bool HasCharacterAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const; + + /** + Test if this whole range has paragraph attributes of the specified kind. If any + of the attributes are different within the range, the test fails. You + can use this to implement, for example, centering button updating. style must have + flags indicating which attributes are of interest. + */ + virtual bool HasParagraphAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const; + + virtual wxRichTextObject* Clone() const wxOVERRIDE { return new wxRichTextParagraphLayoutBox(*this); } + + /** + Prepares the content just before insertion (or after buffer reset). + Currently is only called if undo mode is on. + */ + virtual void PrepareContent(wxRichTextParagraphLayoutBox& container); + + /** + Insert fragment into this box at the given position. If partialParagraph is true, + it is assumed that the last (or only) paragraph is just a piece of data with no paragraph + marker. + */ + virtual bool InsertFragment(long position, wxRichTextParagraphLayoutBox& fragment); + + /** + Make a copy of the fragment corresponding to the given range, putting it in @a fragment. + */ + virtual bool CopyFragment(const wxRichTextRange& range, wxRichTextParagraphLayoutBox& fragment); + + /** + Apply the style sheet to the buffer, for example if the styles have changed. + */ + virtual bool ApplyStyleSheet(wxRichTextStyleSheet* styleSheet); + + void Copy(const wxRichTextParagraphLayoutBox& obj); + + void operator= (const wxRichTextParagraphLayoutBox& obj) { Copy(obj); } + + /** + Calculate ranges. + */ + virtual void UpdateRanges(); + + /** + Get all the text. + */ + virtual wxString GetText() const; + + /** + Sets the default style, affecting the style currently being applied + (for example, setting the default style to bold will cause subsequently + inserted text to be bold). + + This is not cumulative - setting the default style will replace the previous + default style. + + Setting it to a default attribute object makes new content take on the 'basic' style. + */ + virtual bool SetDefaultStyle(const wxRichTextAttr& style); + + /** + Returns the current default style, affecting the style currently being applied + (for example, setting the default style to bold will cause subsequently + inserted text to be bold). + */ + virtual const wxRichTextAttr& GetDefaultStyle() const { return m_defaultAttributes; } + + /** + Sets the basic (overall) style. This is the style of the whole + buffer before further styles are applied, unlike the default style, which + only affects the style currently being applied (for example, setting the default + style to bold will cause subsequently inserted text to be bold). + */ + virtual void SetBasicStyle(const wxRichTextAttr& style) { m_attributes = style; } + + /** + Returns the basic (overall) style. + + This is the style of the whole buffer before further styles are applied, + unlike the default style, which only affects the style currently being + applied (for example, setting the default style to bold will cause + subsequently inserted text to be bold). + */ + virtual const wxRichTextAttr& GetBasicStyle() const { return m_attributes; } + + /** + Invalidates the buffer. With no argument, invalidates whole buffer. + */ + virtual void Invalidate(const wxRichTextRange& invalidRange = wxRICHTEXT_ALL) wxOVERRIDE; + + /** + Do the (in)validation for this object only. + */ + virtual void DoInvalidate(const wxRichTextRange& invalidRange); + + /** + Do the (in)validation both up and down the hierarchy. + */ + virtual void InvalidateHierarchy(const wxRichTextRange& invalidRange = wxRICHTEXT_ALL); + + /** + Gather information about floating objects. If untilObj is non-NULL, + will stop getting information if the current object is this, since we + will collect the rest later. + */ + virtual bool UpdateFloatingObjects(const wxRect& availableRect, wxRichTextObject* untilObj = NULL); + + /** + Get invalid range, rounding to entire paragraphs if argument is true. + */ + wxRichTextRange GetInvalidRange(bool wholeParagraphs = false) const; + + /** + Returns @true if this object needs layout. + */ + bool IsDirty() const { return m_invalidRange != wxRICHTEXT_NONE; } + + /** + Returns the wxRichTextFloatCollector of this object. + */ + wxRichTextFloatCollector* GetFloatCollector() { return m_floatCollector; } + + /** + Returns the number of floating objects at this level. + */ + int GetFloatingObjectCount() const; + + /** + Returns a list of floating objects. + */ + bool GetFloatingObjects(wxRichTextObjectList& objects) const; + +protected: + wxRichTextCtrl* m_ctrl; + wxRichTextAttr m_defaultAttributes; + + // The invalidated range that will need full layout + wxRichTextRange m_invalidRange; + + // Is the last paragraph partial or complete? + bool m_partialParagraph; + + // The floating layout state + wxRichTextFloatCollector* m_floatCollector; +}; + +/** + @class wxRichTextBox + + This class implements a floating or inline text box, containing paragraphs. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextParagraphLayoutBox, wxRichTextObject, wxRichTextBuffer, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextBox: public wxRichTextParagraphLayoutBox +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextBox); +public: +// Constructors + + /** + Default constructor; optionally pass the parent object. + */ + + wxRichTextBox(wxRichTextObject* parent = NULL); + + /** + Copy constructor. + */ + + wxRichTextBox(const wxRichTextBox& obj): wxRichTextParagraphLayoutBox() { Copy(obj); } + +// Overridables + + virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style) wxOVERRIDE; + + virtual wxString GetXMLNodeName() const wxOVERRIDE { return wxT("textbox"); } + + virtual bool CanEditProperties() const wxOVERRIDE { return true; } + + virtual bool EditProperties(wxWindow* parent, wxRichTextBuffer* buffer) wxOVERRIDE; + + virtual wxString GetPropertiesMenuLabel() const wxOVERRIDE { return wxGetTranslation("&Box"); } + +// Accessors + +// Operations + + virtual wxRichTextObject* Clone() const wxOVERRIDE { return new wxRichTextBox(*this); } + + void Copy(const wxRichTextBox& obj); + +protected: +}; + +/** + @class wxRichTextField + + This class implements the general concept of a field, an object that represents + additional functionality such as a footnote, a bookmark, a page number, a table + of contents, and so on. Extra information (such as a bookmark name) can be stored + in the object properties. + + Drawing, layout, and property editing is delegated to classes derived + from wxRichTextFieldType, such as instances of wxRichTextFieldTypeStandard; this makes + the use of fields an efficient method of introducing extra functionality, since + most of the information required to draw a field (such as a bitmap) is kept centrally + in a single field type definition. + + The FieldType property, accessed by SetFieldType/GetFieldType, is used to retrieve + the field type definition. So be careful not to overwrite this property. + + wxRichTextField is derived from wxRichTextParagraphLayoutBox, which means that it + can contain its own read-only content, refreshed when the application calls the UpdateField + function. Whether a field is treated as a composite or a single graphic is determined + by the field type definition. If using wxRichTextFieldTypeStandard, passing the display + type wxRICHTEXT_FIELD_STYLE_COMPOSITE to the field type definition causes the field + to behave like a composite; the other display styles display a simple graphic. + When implementing a composite field, you will still need to derive from wxRichTextFieldTypeStandard + or wxRichTextFieldType, if only to implement UpdateField to refresh the field content + appropriately. wxRichTextFieldTypeStandard is only one possible implementation, but + covers common needs especially for simple, static fields using text or a bitmap. + + Register field types on application initialisation with the static function + wxRichTextBuffer::AddFieldType. They will be deleted automatically on + application exit. + + An application can write a field to a control with wxRichTextCtrl::WriteField, + taking a field type, the properties for the field, and optional attributes. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextFieldTypeStandard, wxRichTextFieldType, wxRichTextParagraphLayoutBox, wxRichTextProperties, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextField: public wxRichTextParagraphLayoutBox +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextField); +public: +// Constructors + + /** + Default constructor; optionally pass the parent object. + */ + + wxRichTextField(const wxString& fieldType = wxEmptyString, wxRichTextObject* parent = NULL); + + /** + Copy constructor. + */ + + wxRichTextField(const wxRichTextField& obj): wxRichTextParagraphLayoutBox() { Copy(obj); } + +// Overridables + + virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style) wxOVERRIDE; + + virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style) wxOVERRIDE; + + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const wxOVERRIDE; + + virtual wxString GetXMLNodeName() const wxOVERRIDE { return wxT("field"); } + + virtual bool CanEditProperties() const wxOVERRIDE; + + virtual bool EditProperties(wxWindow* parent, wxRichTextBuffer* buffer) wxOVERRIDE; + + virtual wxString GetPropertiesMenuLabel() const wxOVERRIDE; + + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } + + virtual void CalculateRange(long start, long& end) wxOVERRIDE; + + /** + If a field has children, we don't want the user to be able to edit it. + */ + virtual bool IsAtomic() const wxOVERRIDE { return true; } + + virtual bool IsEmpty() const wxOVERRIDE { return false; } + + virtual bool IsTopLevel() const wxOVERRIDE; + +// Accessors + + void SetFieldType(const wxString& fieldType) { GetProperties().SetProperty(wxT("FieldType"), fieldType); } + wxString GetFieldType() const { return GetProperties().GetPropertyString(wxT("FieldType")); } + +// Operations + + /** + Update the field; delegated to the associated field type. This would typically expand the field to its value, + if this is a dynamically changing and/or composite field. + */ + virtual bool UpdateField(wxRichTextBuffer* buffer); + + virtual wxRichTextObject* Clone() const wxOVERRIDE { return new wxRichTextField(*this); } + + void Copy(const wxRichTextField& obj); + +protected: +}; + +/** + @class wxRichTextFieldType + + The base class for custom field types. Each type definition handles one + field type. Override functions to provide drawing, layout, updating and + property editing functionality for a field. + + Register field types on application initialisation with the static function + wxRichTextBuffer::AddFieldType. They will be deleted automatically on + application exit. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextFieldTypeStandard, wxRichTextField, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextFieldType: public wxObject +{ + wxDECLARE_CLASS(wxRichTextFieldType); +public: + /** + Creates a field type definition. + */ + wxRichTextFieldType(const wxString& name = wxEmptyString) + : m_name(name) + { } + + /** + Copy constructor. + */ + wxRichTextFieldType(const wxRichTextFieldType& fieldType) + : wxObject(fieldType) + { Copy(fieldType); } + + void Copy(const wxRichTextFieldType& fieldType) { m_name = fieldType.m_name; } + + /** + Draw the item, within the given range. Some objects may ignore the range (for + example paragraphs) while others must obey it (lines, to implement wrapping) + */ + virtual bool Draw(wxRichTextField* obj, wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style) = 0; + + /** + Lay the item out at the specified position with the given size constraint. + Layout must set the cached size. @rect is the available space for the object, + and @a parentRect is the container that is used to determine a relative size + or position (for example if a text box must be 50% of the parent text box). + */ + virtual bool Layout(wxRichTextField* obj, wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style) = 0; + + /** + Returns the object size for the given range. Returns @false if the range + is invalid for this object. + */ + virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const = 0; + + /** + Returns @true if we can edit the object's properties via a GUI. + */ + virtual bool CanEditProperties(wxRichTextField* WXUNUSED(obj)) const { return false; } + + /** + Edits the object's properties via a GUI. + */ + virtual bool EditProperties(wxRichTextField* WXUNUSED(obj), wxWindow* WXUNUSED(parent), wxRichTextBuffer* WXUNUSED(buffer)) { return false; } + + /** + Returns the label to be used for the properties context menu item. + */ + virtual wxString GetPropertiesMenuLabel(wxRichTextField* WXUNUSED(obj)) const { return wxEmptyString; } + + /** + Update the field. This would typically expand the field to its value, + if this is a dynamically changing and/or composite field. + */ + virtual bool UpdateField(wxRichTextBuffer* WXUNUSED(buffer), wxRichTextField* WXUNUSED(obj)) { return false; } + + /** + Returns @true if this object is top-level, i.e. contains its own paragraphs, such as a text box. + */ + virtual bool IsTopLevel(wxRichTextField* WXUNUSED(obj)) const { return true; } + + /** + Sets the field type name. There should be a unique name per field type object. + */ + void SetName(const wxString& name) { m_name = name; } + + /** + Returns the field type name. There should be a unique name per field type object. + */ + wxString GetName() const { return m_name; } + +protected: + + wxString m_name; +}; + +WX_DECLARE_STRING_HASH_MAP(wxRichTextFieldType*, wxRichTextFieldTypeHashMap); + +/** + @class wxRichTextFieldTypeStandard + + A field type that can handle fields with text or bitmap labels, with a small range + of styles for implementing rectangular fields and fields that can be used for start + and end tags. + + The border, text and background colours can be customised; the default is + white text on a black background. + + The following display styles can be used. + + @beginStyleTable + @style{wxRICHTEXT_FIELD_STYLE_COMPOSITE} + Creates a composite field; you will probably need to derive a new class to implement UpdateField. + @style{wxRICHTEXT_FIELD_STYLE_RECTANGLE} + Shows a rounded rectangle background. + @style{wxRICHTEXT_FIELD_STYLE_NO_BORDER} + Suppresses the background and border; mostly used with a bitmap label. + @style{wxRICHTEXT_FIELD_STYLE_START_TAG} + Shows a start tag background, with the pointy end facing right. + @style{wxRICHTEXT_FIELD_STYLE_END_TAG} + Shows an end tag background, with the pointy end facing left. + @endStyleTable + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextFieldType, wxRichTextField, wxRichTextBuffer, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextFieldTypeStandard: public wxRichTextFieldType +{ + wxDECLARE_CLASS(wxRichTextFieldTypeStandard); +public: + + // Display style types + enum { wxRICHTEXT_FIELD_STYLE_COMPOSITE = 0x01, + wxRICHTEXT_FIELD_STYLE_RECTANGLE = 0x02, + wxRICHTEXT_FIELD_STYLE_NO_BORDER = 0x04, + wxRICHTEXT_FIELD_STYLE_START_TAG = 0x08, + wxRICHTEXT_FIELD_STYLE_END_TAG = 0x10 + }; + + /** + Constructor, creating a field type definition with a text label. + + @param parent + The name of the type definition. This must be unique, and is the type + name used when adding a field to a control. + @param label + The text label to be shown on the field. + @param displayStyle + The display style: one of wxRICHTEXT_FIELD_STYLE_RECTANGLE, + wxRICHTEXT_FIELD_STYLE_NO_BORDER, wxRICHTEXT_FIELD_STYLE_START_TAG, + wxRICHTEXT_FIELD_STYLE_END_TAG. + + */ + wxRichTextFieldTypeStandard(const wxString& name, const wxString& label, int displayStyle = wxRICHTEXT_FIELD_STYLE_RECTANGLE); + + /** + Constructor, creating a field type definition with a bitmap label. + + @param parent + The name of the type definition. This must be unique, and is the type + name used when adding a field to a control. + @param label + The bitmap label to be shown on the field. + @param displayStyle + The display style: one of wxRICHTEXT_FIELD_STYLE_RECTANGLE, + wxRICHTEXT_FIELD_STYLE_NO_BORDER, wxRICHTEXT_FIELD_STYLE_START_TAG, + wxRICHTEXT_FIELD_STYLE_END_TAG. + + */ + wxRichTextFieldTypeStandard(const wxString& name, const wxBitmap& bitmap, int displayStyle = wxRICHTEXT_FIELD_STYLE_NO_BORDER); + + /** + The default constructor. + + */ + wxRichTextFieldTypeStandard() { Init(); } + + /** + The copy constructor. + + */ + wxRichTextFieldTypeStandard(const wxRichTextFieldTypeStandard& field) + : wxRichTextFieldType(field) + { Copy(field); } + + /** + Initialises the object. + */ + void Init(); + + /** + Copies the object. + */ + void Copy(const wxRichTextFieldTypeStandard& field); + + /** + The assignment operator. + */ + void operator=(const wxRichTextFieldTypeStandard& field) { Copy(field); } + + /** + Draw the item, within the given range. Some objects may ignore the range (for + example paragraphs) while others must obey it (lines, to implement wrapping) + */ + virtual bool Draw(wxRichTextField* obj, wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style) wxOVERRIDE; + + /** + Lay the item out at the specified position with the given size constraint. + Layout must set the cached size. @rect is the available space for the object, + and @a parentRect is the container that is used to determine a relative size + or position (for example if a text box must be 50% of the parent text box). + */ + virtual bool Layout(wxRichTextField* obj, wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style) wxOVERRIDE; + + /** + Returns the object size for the given range. Returns @false if the range + is invalid for this object. + */ + virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const wxOVERRIDE; + + /** + Get the size of the field, given the label, font size, and so on. + */ + wxSize GetSize(wxRichTextField* obj, wxDC& dc, wxRichTextDrawingContext& context, int style) const; + + /** + Returns @true if the display type is wxRICHTEXT_FIELD_STYLE_COMPOSITE, @false otherwise. + */ + virtual bool IsTopLevel(wxRichTextField* WXUNUSED(obj)) const wxOVERRIDE { return (GetDisplayStyle() & wxRICHTEXT_FIELD_STYLE_COMPOSITE) != 0; } + + /** + Sets the text label for fields of this type. + */ + void SetLabel(const wxString& label) { m_label = label; } + + /** + Returns the text label for fields of this type. + */ + const wxString& GetLabel() const { return m_label; } + + /** + Sets the bitmap label for fields of this type. + */ + void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; } + + /** + Gets the bitmap label for fields of this type. + */ + const wxBitmap& GetBitmap() const { return m_bitmap; } + + /** + Gets the display style for fields of this type. + */ + int GetDisplayStyle() const { return m_displayStyle; } + + /** + Sets the display style for fields of this type. + */ + void SetDisplayStyle(int displayStyle) { m_displayStyle = displayStyle; } + + /** + Gets the font used for drawing the text label. + */ + const wxFont& GetFont() const { return m_font; } + + /** + Sets the font used for drawing the text label. + */ + void SetFont(const wxFont& font) { m_font = font; } + + /** + Gets the colour used for drawing the text label. + */ + const wxColour& GetTextColour() const { return m_textColour; } + + /** + Sets the colour used for drawing the text label. + */ + void SetTextColour(const wxColour& colour) { m_textColour = colour; } + + /** + Gets the colour used for drawing the field border. + */ + const wxColour& GetBorderColour() const { return m_borderColour; } + + /** + Sets the colour used for drawing the field border. + */ + void SetBorderColour(const wxColour& colour) { m_borderColour = colour; } + + /** + Gets the colour used for drawing the field background. + */ + const wxColour& GetBackgroundColour() const { return m_backgroundColour; } + + /** + Sets the colour used for drawing the field background. + */ + void SetBackgroundColour(const wxColour& colour) { m_backgroundColour = colour; } + + /** + Sets the vertical padding (the distance between the border and the text). + */ + void SetVerticalPadding(int padding) { m_verticalPadding = padding; } + + /** + Gets the vertical padding (the distance between the border and the text). + */ + int GetVerticalPadding() const { return m_verticalPadding; } + + /** + Sets the horizontal padding (the distance between the border and the text). + */ + void SetHorizontalPadding(int padding) { m_horizontalPadding = padding; } + + /** + Sets the horizontal padding (the distance between the border and the text). + */ + int GetHorizontalPadding() const { return m_horizontalPadding; } + + /** + Sets the horizontal margin surrounding the field object. + */ + void SetHorizontalMargin(int margin) { m_horizontalMargin = margin; } + + /** + Gets the horizontal margin surrounding the field object. + */ + int GetHorizontalMargin() const { return m_horizontalMargin; } + + /** + Sets the vertical margin surrounding the field object. + */ + void SetVerticalMargin(int margin) { m_verticalMargin = margin; } + + /** + Gets the vertical margin surrounding the field object. + */ + int GetVerticalMargin() const { return m_verticalMargin; } + +protected: + + wxString m_label; + int m_displayStyle; + wxFont m_font; + wxColour m_textColour; + wxColour m_borderColour; + wxColour m_backgroundColour; + int m_verticalPadding; + int m_horizontalPadding; + int m_horizontalMargin; + int m_verticalMargin; + wxBitmap m_bitmap; +}; + +/** + @class wxRichTextLine + + This object represents a line in a paragraph, and stores + offsets from the start of the paragraph representing the + start and end positions of the line. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextBuffer, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextLine +{ +public: +// Constructors + + wxRichTextLine(wxRichTextParagraph* parent); + wxRichTextLine(const wxRichTextLine& obj) { Init( NULL); Copy(obj); } + virtual ~wxRichTextLine() {} + +// Overridables + +// Accessors + + /** + Sets the range associated with this line. + */ + void SetRange(const wxRichTextRange& range) { m_range = range; } + /** + Sets the range associated with this line. + */ + void SetRange(long from, long to) { m_range = wxRichTextRange(from, to); } + + /** + Returns the parent paragraph. + */ + wxRichTextParagraph* GetParent() { return m_parent; } + + /** + Returns the range. + */ + const wxRichTextRange& GetRange() const { return m_range; } + /** + Returns the range. + */ + wxRichTextRange& GetRange() { return m_range; } + + /** + Returns the absolute range. + */ + wxRichTextRange GetAbsoluteRange() const; + + /** + Returns the line size as calculated by Layout. + */ + virtual wxSize GetSize() const { return m_size; } + + /** + Sets the line size as calculated by Layout. + */ + virtual void SetSize(const wxSize& sz) { m_size = sz; } + + /** + Returns the object position relative to the parent. + */ + virtual wxPoint GetPosition() const { return m_pos; } + + /** + Sets the object position relative to the parent. + */ + virtual void SetPosition(const wxPoint& pos) { m_pos = pos; } + + /** + Returns the absolute object position. + */ + virtual wxPoint GetAbsolutePosition() const; + + /** + Returns the rectangle enclosing the line. + */ + virtual wxRect GetRect() const { return wxRect(GetAbsolutePosition(), GetSize()); } + + /** + Sets the stored descent. + */ + void SetDescent(int descent) { m_descent = descent; } + + /** + Returns the stored descent. + */ + int GetDescent() const { return m_descent; } + +#if wxRICHTEXT_USE_OPTIMIZED_LINE_DRAWING + wxArrayInt& GetObjectSizes() { return m_objectSizes; } + const wxArrayInt& GetObjectSizes() const { return m_objectSizes; } +#endif + +// Operations + + /** + Initialises the object. + */ + void Init(wxRichTextParagraph* parent); + + /** + Copies from @a obj. + */ + void Copy(const wxRichTextLine& obj); + + virtual wxRichTextLine* Clone() const { return new wxRichTextLine(*this); } + +protected: + + // The range of the line (start position to end position) + // This is relative to the parent paragraph. + wxRichTextRange m_range; + + // Size and position measured relative to top of paragraph + wxPoint m_pos; + wxSize m_size; + + // Maximum descent for this line (location of text baseline) + int m_descent; + + // The parent object + wxRichTextParagraph* m_parent; + +#if wxRICHTEXT_USE_OPTIMIZED_LINE_DRAWING + wxArrayInt m_objectSizes; +#endif +}; + +typedef wxVector<wxRichTextLine*> wxRichTextLineVector; + +/** + @class wxRichTextParagraph + + This object represents a single paragraph containing various objects such as text content, images, and further paragraph layout objects. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextBuffer, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextParagraph: public wxRichTextCompositeObject +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextParagraph); +public: +// Constructors + + /** + Constructor taking a parent and style. + */ + wxRichTextParagraph(wxRichTextObject* parent = NULL, wxRichTextAttr* style = NULL); + /** + Constructor taking a text string, a parent and paragraph and character attributes. + */ + wxRichTextParagraph(const wxString& text, wxRichTextObject* parent = NULL, wxRichTextAttr* paraStyle = NULL, wxRichTextAttr* charStyle = NULL); + virtual ~wxRichTextParagraph(); + wxRichTextParagraph(const wxRichTextParagraph& obj): wxRichTextCompositeObject() { Copy(obj); } + + void Init(); + +// Overridables + + virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style) wxOVERRIDE; + + virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style) wxOVERRIDE; + + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const wxOVERRIDE; + + virtual bool FindPosition(wxDC& dc, wxRichTextDrawingContext& context, long index, wxPoint& pt, int* height, bool forceLineStart) wxOVERRIDE; + + virtual int HitTest(wxDC& dc, wxRichTextDrawingContext& context, const wxPoint& pt, long& textPosition, wxRichTextObject** obj, wxRichTextObject** contextObj, int flags = 0) wxOVERRIDE; + + virtual void CalculateRange(long start, long& end) wxOVERRIDE; + + virtual wxString GetXMLNodeName() const wxOVERRIDE { return wxT("paragraph"); } + +// Accessors + + /** + Returns the cached lines. + */ + const wxRichTextLineVector& GetLines() const { return m_cachedLines; } + +// Operations + + /** + Copies the object. + */ + void Copy(const wxRichTextParagraph& obj); + + virtual wxRichTextObject* Clone() const wxOVERRIDE { return new wxRichTextParagraph(*this); } + + /** + Clears the cached lines. + */ + void ClearLines(); + +// Implementation + + /** + Applies paragraph styles such as centering to the wrapped lines. + */ + virtual void ApplyParagraphStyle(wxRichTextLine* line, const wxRichTextAttr& attr, const wxRect& rect, wxDC& dc); + + /** + Inserts text at the given position. + */ + virtual bool InsertText(long pos, const wxString& text); + + /** + Splits an object at this position if necessary, and returns + the previous object, or NULL if inserting at the beginning. + */ + virtual wxRichTextObject* SplitAt(long pos, wxRichTextObject** previousObject = NULL); + + /** + Moves content to a list from this point. + */ + virtual void MoveToList(wxRichTextObject* obj, wxList& list); + + /** + Adds content back from a list. + */ + virtual void MoveFromList(wxList& list); + + /** + Returns the plain text searching from the start or end of the range. + The resulting string may be shorter than the range given. + */ + bool GetContiguousPlainText(wxString& text, const wxRichTextRange& range, bool fromStart = true); + + /** + Finds a suitable wrap position. @a wrapPosition is the last position in the line to the left + of the split. + */ + bool FindWrapPosition(const wxRichTextRange& range, wxDC& dc, wxRichTextDrawingContext& context, int availableSpace, long& wrapPosition, wxArrayInt* partialExtents); + + /** + Finds the object at the given position. + */ + wxRichTextObject* FindObjectAtPosition(long position); + + /** + Returns the bullet text for this paragraph. + */ + wxString GetBulletText(); + + /** + Allocates or reuses a line object. + */ + wxRichTextLine* AllocateLine(int pos); + + /** + Clears remaining unused line objects, if any. + */ + bool ClearUnusedLines(int lineCount); + + /** + Returns combined attributes of the base style, paragraph style and character style. We use this to dynamically + retrieve the actual style. + */ + wxRichTextAttr GetCombinedAttributes(const wxRichTextAttr& contentStyle, bool includingBoxAttr = false) const; + + /** + Returns the combined attributes of the base style and paragraph style. + */ + wxRichTextAttr GetCombinedAttributes(bool includingBoxAttr = false) const; + + /** + Returns the first position from pos that has a line break character. + */ + long GetFirstLineBreakPosition(long pos); + + /** + Creates a default tabstop array. + */ + static void InitDefaultTabs(); + + /** + Clears the default tabstop array. + */ + static void ClearDefaultTabs(); + + /** + Returns the default tabstop array. + */ + static const wxArrayInt& GetDefaultTabs() { return sm_defaultTabs; } + + /** + Lays out the floating objects. + */ + void LayoutFloat(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style, wxRichTextFloatCollector* floatCollector); + + /** + Whether the paragraph is impacted by floating objects from above. + */ + int GetImpactedByFloatingObjects() const { return m_impactedByFloatingObjects; } + + /** + Sets whether the paragraph is impacted by floating objects from above. + */ + void SetImpactedByFloatingObjects(int i) { m_impactedByFloatingObjects = i; } + +protected: + + // The lines that make up the wrapped paragraph + wxRichTextLineVector m_cachedLines; + + // Whether the paragraph is impacted by floating objects from above + int m_impactedByFloatingObjects; + + // Default tabstops + static wxArrayInt sm_defaultTabs; + +friend class wxRichTextFloatCollector; +}; + +/** + @class wxRichTextPlainText + + This object represents a single piece of text. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextBuffer, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextPlainText: public wxRichTextObject +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextPlainText); +public: +// Constructors + + /** + Constructor. + */ + wxRichTextPlainText(const wxString& text = wxEmptyString, wxRichTextObject* parent = NULL, wxRichTextAttr* style = NULL); + + /** + Copy constructor. + */ + wxRichTextPlainText(const wxRichTextPlainText& obj): wxRichTextObject() { Copy(obj); } + +// Overridables + + virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style) wxOVERRIDE; + + virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style) wxOVERRIDE; + + virtual bool AdjustAttributes(wxRichTextAttr& attr, wxRichTextDrawingContext& context) wxOVERRIDE; + + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const wxOVERRIDE; + + virtual wxString GetTextForRange(const wxRichTextRange& range) const wxOVERRIDE; + + virtual wxRichTextObject* DoSplit(long pos) wxOVERRIDE; + + virtual void CalculateRange(long start, long& end) wxOVERRIDE; + + virtual bool DeleteRange(const wxRichTextRange& range) wxOVERRIDE; + + virtual bool IsEmpty() const wxOVERRIDE { return m_text.empty(); } + + virtual bool CanMerge(wxRichTextObject* object, wxRichTextDrawingContext& context) const wxOVERRIDE; + + virtual bool Merge(wxRichTextObject* object, wxRichTextDrawingContext& context) wxOVERRIDE; + + virtual void Dump(wxTextOutputStream& stream) wxOVERRIDE; + + virtual bool CanSplit(wxRichTextDrawingContext& context) const wxOVERRIDE; + + virtual wxRichTextObject* Split(wxRichTextDrawingContext& context) wxOVERRIDE; + + /** + Get the first position from pos that has a line break character. + */ + long GetFirstLineBreakPosition(long pos); + + /// Does this object take note of paragraph attributes? Text and image objects don't. + virtual bool UsesParagraphAttributes() const wxOVERRIDE { return false; } + +#if wxUSE_XML + virtual bool ImportFromXML(wxRichTextBuffer* buffer, wxXmlNode* node, wxRichTextXMLHandler* handler, bool* recurse) wxOVERRIDE; +#endif + +#if wxRICHTEXT_HAVE_DIRECT_OUTPUT + virtual bool ExportXML(wxOutputStream& stream, int indent, wxRichTextXMLHandler* handler) wxOVERRIDE; +#endif + +#if wxRICHTEXT_HAVE_XMLDOCUMENT_OUTPUT + virtual bool ExportXML(wxXmlNode* parent, wxRichTextXMLHandler* handler) wxOVERRIDE; +#endif + + virtual wxString GetXMLNodeName() const wxOVERRIDE { return wxT("text"); } + +// Accessors + + /** + Returns the text. + */ + const wxString& GetText() const { return m_text; } + + /** + Sets the text. + */ + void SetText(const wxString& text) { m_text = text; } + +// Operations + + // Copies the text object, + void Copy(const wxRichTextPlainText& obj); + + // Clones the text object. + virtual wxRichTextObject* Clone() const wxOVERRIDE { return new wxRichTextPlainText(*this); } + +private: + bool DrawTabbedString(wxDC& dc, const wxRichTextAttr& attr, const wxRect& rect, wxString& str, wxCoord& x, wxCoord& y, bool selected); + +protected: + wxString m_text; +}; + +/** + @class wxRichTextImageBlock + + This class stores information about an image, in binary in-memory form. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextBuffer, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextImageBlock: public wxObject +{ +public: + /** + Constructor. + */ + wxRichTextImageBlock(); + + /** + Copy constructor. + */ + wxRichTextImageBlock(const wxRichTextImageBlock& block); + virtual ~wxRichTextImageBlock(); + + /** + Initialises the block. + */ + void Init(); + + /** + Clears the block. + */ + + void Clear(); + + /** + Load the original image into a memory block. + If the image is not a JPEG, we must convert it into a JPEG + to conserve space. + If it's not a JPEG we can make use of @a image, already scaled, so we don't have to + load the image a second time. + */ + virtual bool MakeImageBlock(const wxString& filename, wxBitmapType imageType, + wxImage& image, bool convertToJPEG = true); + + /** + Make an image block from the wxImage in the given + format. + */ + virtual bool MakeImageBlock(wxImage& image, wxBitmapType imageType, int quality = 80); + + /** + Uses a const wxImage for efficiency, but can't set quality (only relevant for JPEG) + */ + virtual bool MakeImageBlockDefaultQuality(const wxImage& image, wxBitmapType imageType); + + /** + Makes the image block. + */ + virtual bool DoMakeImageBlock(const wxImage& image, wxBitmapType imageType); + + /** + Writes the block to a file. + */ + bool Write(const wxString& filename); + + /** + Writes the data in hex to a stream. + */ + bool WriteHex(wxOutputStream& stream); + + /** + Reads the data in hex from a stream. + */ + bool ReadHex(wxInputStream& stream, int length, wxBitmapType imageType); + + /** + Copy from @a block. + */ + void Copy(const wxRichTextImageBlock& block); + + // Load a wxImage from the block + /** + */ + bool Load(wxImage& image); + +// Operators + + /** + Assignment operation. + */ + void operator=(const wxRichTextImageBlock& block); + +// Accessors + + /** + Returns the raw data. + */ + unsigned char* GetData() const { return m_data; } + + /** + Returns the data size in bytes. + */ + size_t GetDataSize() const { return m_dataSize; } + + /** + Returns the image type. + */ + wxBitmapType GetImageType() const { return m_imageType; } + + /** + */ + void SetData(unsigned char* image) { m_data = image; } + + /** + Sets the data size. + */ + void SetDataSize(size_t size) { m_dataSize = size; } + + /** + Sets the image type. + */ + void SetImageType(wxBitmapType imageType) { m_imageType = imageType; } + + /** + Returns @true if the data is non-NULL. + */ + bool IsOk() const { return GetData() != NULL; } + bool Ok() const { return IsOk(); } + + /** + Gets the extension for the block's type. + */ + wxString GetExtension() const; + +/// Implementation + + /** + Allocates and reads from a stream as a block of memory. + */ + static unsigned char* ReadBlock(wxInputStream& stream, size_t size); + + /** + Allocates and reads from a file as a block of memory. + */ + static unsigned char* ReadBlock(const wxString& filename, size_t size); + + /** + Writes a memory block to stream. + */ + static bool WriteBlock(wxOutputStream& stream, unsigned char* block, size_t size); + + /** + Writes a memory block to a file. + */ + static bool WriteBlock(const wxString& filename, unsigned char* block, size_t size); + +protected: + // Size in bytes of the image stored. + // This is in the raw, original form such as a JPEG file. + unsigned char* m_data; + size_t m_dataSize; + wxBitmapType m_imageType; +}; + +/** + @class wxRichTextImage + + This class implements a graphic object. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextBuffer, wxRichTextCtrl, wxRichTextImageBlock +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextImage: public wxRichTextObject +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextImage); +public: + enum { ImageState_Unloaded, ImageState_Loaded, ImageState_Bad }; + +// Constructors + + /** + Default constructor. + */ + wxRichTextImage(wxRichTextObject* parent = NULL): wxRichTextObject(parent) { Init(); } + + /** + Creates a wxRichTextImage from a wxImage. + */ + wxRichTextImage(const wxImage& image, wxRichTextObject* parent = NULL, wxRichTextAttr* charStyle = NULL); + + /** + Creates a wxRichTextImage from an image block. + */ + wxRichTextImage(const wxRichTextImageBlock& imageBlock, wxRichTextObject* parent = NULL, wxRichTextAttr* charStyle = NULL); + + /** + Copy constructor. + */ + wxRichTextImage(const wxRichTextImage& obj): wxRichTextObject(obj) { Copy(obj); } + + /** + Destructor. + */ + ~wxRichTextImage(); + + /** + Initialisation. + */ + void Init(); + +// Overridables + + virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style) wxOVERRIDE; + + virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style) wxOVERRIDE; + + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const wxOVERRIDE; + + /** + Returns the 'natural' size for this object - the image size. + */ + virtual wxTextAttrSize GetNaturalSize() const wxOVERRIDE; + + virtual bool IsEmpty() const wxOVERRIDE { return false; /* !m_imageBlock.IsOk(); */ } + + virtual bool CanEditProperties() const wxOVERRIDE { return true; } + + virtual bool EditProperties(wxWindow* parent, wxRichTextBuffer* buffer) wxOVERRIDE; + + virtual wxString GetPropertiesMenuLabel() const wxOVERRIDE { return wxGetTranslation("&Picture"); } + + virtual bool UsesParagraphAttributes() const wxOVERRIDE { return false; } + +#if wxUSE_XML + virtual bool ImportFromXML(wxRichTextBuffer* buffer, wxXmlNode* node, wxRichTextXMLHandler* handler, bool* recurse) wxOVERRIDE; +#endif + +#if wxRICHTEXT_HAVE_DIRECT_OUTPUT + virtual bool ExportXML(wxOutputStream& stream, int indent, wxRichTextXMLHandler* handler) wxOVERRIDE; +#endif + +#if wxRICHTEXT_HAVE_XMLDOCUMENT_OUTPUT + virtual bool ExportXML(wxXmlNode* parent, wxRichTextXMLHandler* handler) wxOVERRIDE; +#endif + + // Images can be floatable (optionally). + virtual bool IsFloatable() const wxOVERRIDE { return true; } + + virtual wxString GetXMLNodeName() const wxOVERRIDE { return wxT("image"); } + +// Accessors + + /** + Returns the image cache (a scaled bitmap). + */ + const wxBitmap& GetImageCache() const { return m_imageCache; } + + /** + Sets the image cache. + */ + void SetImageCache(const wxBitmap& bitmap) { m_imageCache = bitmap; m_originalImageSize = wxSize(bitmap.GetWidth(), bitmap.GetHeight()); m_imageState = ImageState_Loaded; } + + /** + Resets the image cache. + */ + void ResetImageCache() { m_imageCache = wxNullBitmap; m_originalImageSize = wxSize(-1, -1); m_imageState = ImageState_Unloaded; } + + /** + Returns the image block containing the raw data. + */ + wxRichTextImageBlock& GetImageBlock() { return m_imageBlock; } + +// Operations + + /** + Copies the image object. + */ + void Copy(const wxRichTextImage& obj); + + /** + Clones the image object. + */ + virtual wxRichTextObject* Clone() const wxOVERRIDE { return new wxRichTextImage(*this); } + + /** + Creates a cached image at the required size. + */ + virtual bool LoadImageCache(wxDC& dc, wxRichTextDrawingContext& context, wxSize& retImageSize, bool resetCache = false, const wxSize& parentSize = wxDefaultSize); + + /** + Do the loading and scaling + */ + virtual bool LoadAndScaleImageCache(wxImage& image, const wxSize& sz, wxRichTextDrawingContext& context, bool& changed); + + /** + Gets the original image size. + */ + wxSize GetOriginalImageSize() const { return m_originalImageSize; } + + /** + Sets the original image size. + */ + void SetOriginalImageSize(const wxSize& sz) { m_originalImageSize = sz; } + + /** + Gets the image state. + */ + int GetImageState() const { return m_imageState; } + + /** + Sets the image state. + */ + void SetImageState(int state) { m_imageState = state; } + +protected: + wxRichTextImageBlock m_imageBlock; + wxBitmap m_imageCache; + wxSize m_originalImageSize; + int m_imageState; +}; + +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCommand; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextAction; + +/** + @class wxRichTextBuffer + + This is a kind of paragraph layout box, used to represent the whole buffer. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextParagraphLayoutBox, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextBuffer: public wxRichTextParagraphLayoutBox +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextBuffer); +public: +// Constructors + + /** + Default constructor. + */ + wxRichTextBuffer() { Init(); } + + /** + Copy constructor. + */ + wxRichTextBuffer(const wxRichTextBuffer& obj): wxRichTextParagraphLayoutBox() { Init(); Copy(obj); } + + virtual ~wxRichTextBuffer() ; + +// Accessors + + /** + Returns the command processor. + A text buffer always creates its own command processor when it is initialized. + */ + wxCommandProcessor* GetCommandProcessor() const { return m_commandProcessor; } + + /** + Sets style sheet, if any. This will allow the application to use named character and paragraph + styles found in the style sheet. + + Neither the buffer nor the control owns the style sheet so must be deleted by the application. + */ + void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { m_styleSheet = styleSheet; } + + /** + Returns the style sheet. + */ + virtual wxRichTextStyleSheet* GetStyleSheet() const wxOVERRIDE { return m_styleSheet; } + + /** + Sets the style sheet and sends a notification of the change. + */ + bool SetStyleSheetAndNotify(wxRichTextStyleSheet* sheet); + + /** + Pushes the style sheet to the top of the style sheet stack. + */ + bool PushStyleSheet(wxRichTextStyleSheet* styleSheet); + + /** + Pops the style sheet from the top of the style sheet stack. + */ + wxRichTextStyleSheet* PopStyleSheet(); + + /** + Returns the table storing fonts, for quick access and font reuse. + */ + wxRichTextFontTable& GetFontTable() { return m_fontTable; } + + /** + Returns the table storing fonts, for quick access and font reuse. + */ + const wxRichTextFontTable& GetFontTable() const { return m_fontTable; } + + /** + Sets table storing fonts, for quick access and font reuse. + */ + void SetFontTable(const wxRichTextFontTable& table) { m_fontTable = table; } + + /** + Sets the scale factor for displaying fonts, for example for more comfortable + editing. + */ + void SetFontScale(double fontScale); + + /** + Returns the scale factor for displaying fonts, for example for more comfortable + editing. + */ + double GetFontScale() const { return m_fontScale; } + + /** + Sets the scale factor for displaying certain dimensions such as indentation and + inter-paragraph spacing. This can be useful when editing in a small control + where you still want legible text, but a minimum of wasted white space. + */ + void SetDimensionScale(double dimScale); + + /** + Returns the scale factor for displaying certain dimensions such as indentation + and inter-paragraph spacing. + */ + double GetDimensionScale() const { return m_dimensionScale; } + +// Operations + + /** + Initialisation. + */ + void Init(); + + /** + Clears the buffer, adds an empty paragraph, and clears the command processor. + */ + virtual void ResetAndClearCommands(); + +#if wxUSE_FFILE && wxUSE_STREAMS + //@{ + /** + Loads content from a file. + Not all handlers will implement file loading. + */ + virtual bool LoadFile(const wxString& filename, wxRichTextFileType type = wxRICHTEXT_TYPE_ANY); + //@} + + //@{ + /** + Saves content to a file. + Not all handlers will implement file saving. + */ + virtual bool SaveFile(const wxString& filename, wxRichTextFileType type = wxRICHTEXT_TYPE_ANY); + //@} +#endif // wxUSE_FFILE + +#if wxUSE_STREAMS + //@{ + /** + Loads content from a stream. + Not all handlers will implement loading from a stream. + */ + virtual bool LoadFile(wxInputStream& stream, wxRichTextFileType type = wxRICHTEXT_TYPE_ANY); + //@} + + //@{ + /** + Saves content to a stream. + Not all handlers will implement saving to a stream. + */ + virtual bool SaveFile(wxOutputStream& stream, wxRichTextFileType type = wxRICHTEXT_TYPE_ANY); + //@} +#endif // wxUSE_STREAMS + + /** + Sets the handler flags, controlling loading and saving. + */ + void SetHandlerFlags(int flags) { m_handlerFlags = flags; } + + /** + Gets the handler flags, controlling loading and saving. + */ + int GetHandlerFlags() const { return m_handlerFlags; } + + /** + Convenience function to add a paragraph of text. + */ + virtual wxRichTextRange AddParagraph(const wxString& text, wxRichTextAttr* paraStyle = NULL) wxOVERRIDE { Modify(); return wxRichTextParagraphLayoutBox::AddParagraph(text, paraStyle); } + + /** + Begin collapsing undo/redo commands. Note that this may not work properly + if combining commands that delete or insert content, changing ranges for + subsequent actions. + + @a cmdName should be the name of the combined command that will appear + next to Undo and Redo in the edit menu. + */ + virtual bool BeginBatchUndo(const wxString& cmdName); + + /** + End collapsing undo/redo commands. + */ + virtual bool EndBatchUndo(); + + /** + Returns @true if we are collapsing commands. + */ + virtual bool BatchingUndo() const { return m_batchedCommandDepth > 0; } + + /** + Submit the action immediately, or delay according to whether collapsing is on. + */ + virtual bool SubmitAction(wxRichTextAction* action); + + /** + Returns the collapsed command. + */ + virtual wxRichTextCommand* GetBatchedCommand() const { return m_batchedCommand; } + + /** + Begin suppressing undo/redo commands. The way undo is suppressed may be implemented + differently by each command. If not dealt with by a command implementation, then + it will be implemented automatically by not storing the command in the undo history + when the action is submitted to the command processor. + */ + virtual bool BeginSuppressUndo(); + + /** + End suppressing undo/redo commands. + */ + virtual bool EndSuppressUndo(); + + /** + Are we suppressing undo?? + */ + virtual bool SuppressingUndo() const { return m_suppressUndo > 0; } + + /** + Copy the range to the clipboard. + */ + virtual bool CopyToClipboard(const wxRichTextRange& range); + + /** + Paste the clipboard content to the buffer. + */ + virtual bool PasteFromClipboard(long position); + + /** + Returns @true if we can paste from the clipboard. + */ + virtual bool CanPasteFromClipboard() const; + + /** + Begin using a style. + */ + virtual bool BeginStyle(const wxRichTextAttr& style); + + /** + End the style. + */ + virtual bool EndStyle(); + + /** + End all styles. + */ + virtual bool EndAllStyles(); + + /** + Clears the style stack. + */ + virtual void ClearStyleStack(); + + /** + Returns the size of the style stack, for example to check correct nesting. + */ + virtual size_t GetStyleStackSize() const { return m_attributeStack.GetCount(); } + + /** + Begins using bold. + */ + bool BeginBold(); + + /** + Ends using bold. + */ + bool EndBold() { return EndStyle(); } + + /** + Begins using italic. + */ + bool BeginItalic(); + + /** + Ends using italic. + */ + bool EndItalic() { return EndStyle(); } + + /** + Begins using underline. + */ + bool BeginUnderline(); + + /** + Ends using underline. + */ + bool EndUnderline() { return EndStyle(); } + + /** + Begins using point size. + */ + bool BeginFontSize(int pointSize); + + /** + Ends using point size. + */ + bool EndFontSize() { return EndStyle(); } + + /** + Begins using this font. + */ + bool BeginFont(const wxFont& font); + + /** + Ends using a font. + */ + bool EndFont() { return EndStyle(); } + + /** + Begins using this colour. + */ + bool BeginTextColour(const wxColour& colour); + + /** + Ends using a colour. + */ + bool EndTextColour() { return EndStyle(); } + + /** + Begins using alignment. + */ + bool BeginAlignment(wxTextAttrAlignment alignment); + + /** + Ends alignment. + */ + bool EndAlignment() { return EndStyle(); } + + /** + Begins using @a leftIndent for the left indent, and optionally @a leftSubIndent for + the sub-indent. Both are expressed in tenths of a millimetre. + + The sub-indent is an offset from the left of the paragraph, and is used for all + but the first line in a paragraph. A positive value will cause the first line to appear + to the left of the subsequent lines, and a negative value will cause the first line to be + indented relative to the subsequent lines. + */ + bool BeginLeftIndent(int leftIndent, int leftSubIndent = 0); + + /** + Ends left indent. + */ + bool EndLeftIndent() { return EndStyle(); } + + /** + Begins a right indent, specified in tenths of a millimetre. + */ + bool BeginRightIndent(int rightIndent); + + /** + Ends right indent. + */ + bool EndRightIndent() { return EndStyle(); } + + /** + Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing + in tenths of a millimetre. + */ + bool BeginParagraphSpacing(int before, int after); + + /** + Ends paragraph spacing. + */ + bool EndParagraphSpacing() { return EndStyle(); } + + /** + Begins line spacing using the specified value. @e spacing is a multiple, where + 10 means single-spacing, 15 means 1.5 spacing, and 20 means double spacing. + + The ::wxTextAttrLineSpacing enumeration values are defined for convenience. + */ + bool BeginLineSpacing(int lineSpacing); + + /** + Ends line spacing. + */ + bool EndLineSpacing() { return EndStyle(); } + + /** + Begins numbered bullet. + + This call will be needed for each item in the list, and the + application should take care of incrementing the numbering. + + @a bulletNumber is a number, usually starting with 1. + @a leftIndent and @a leftSubIndent are values in tenths of a millimetre. + @a bulletStyle is a bitlist of the following values: + + wxRichTextBuffer uses indentation to render a bulleted item. + The left indent is the distance between the margin and the bullet. + The content of the paragraph, including the first line, starts + at leftMargin + leftSubIndent. + So the distance between the left edge of the bullet and the + left of the actual paragraph is leftSubIndent. + */ + bool BeginNumberedBullet(int bulletNumber, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_ARABIC|wxTEXT_ATTR_BULLET_STYLE_PERIOD); + + /** + Ends numbered bullet. + */ + bool EndNumberedBullet() { return EndStyle(); } + + /** + Begins applying a symbol bullet, using a character from the current font. + + See BeginNumberedBullet() for an explanation of how indentation is used + to render the bulleted paragraph. + */ + bool BeginSymbolBullet(const wxString& symbol, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_SYMBOL); + + /** + Ends symbol bullet. + */ + bool EndSymbolBullet() { return EndStyle(); } + + /** + Begins applying a standard bullet, using one of the standard bullet names + (currently @c standard/circle or @c standard/square. + + See BeginNumberedBullet() for an explanation of how indentation is used to + render the bulleted paragraph. + */ + bool BeginStandardBullet(const wxString& bulletName, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_STANDARD); + + /** + Ends standard bullet. + */ + bool EndStandardBullet() { return EndStyle(); } + + /** + Begins named character style. + */ + bool BeginCharacterStyle(const wxString& characterStyle); + + /** + Ends named character style. + */ + bool EndCharacterStyle() { return EndStyle(); } + + /** + Begins named paragraph style. + */ + bool BeginParagraphStyle(const wxString& paragraphStyle); + + /** + Ends named character style. + */ + bool EndParagraphStyle() { return EndStyle(); } + + /** + Begins named list style. + + Optionally, you can also pass a level and a number. + */ + bool BeginListStyle(const wxString& listStyle, int level = 1, int number = 1); + + /** + Ends named character style. + */ + bool EndListStyle() { return EndStyle(); } + + /** + Begins applying wxTEXT_ATTR_URL to the content. + + Pass a URL and optionally, a character style to apply, since it is common + to mark a URL with a familiar style such as blue text with underlining. + */ + bool BeginURL(const wxString& url, const wxString& characterStyle = wxEmptyString); + + /** + Ends URL. + */ + bool EndURL() { return EndStyle(); } + +// Event handling + + /** + Adds an event handler. + + A buffer associated with a control has the control as the only event handler, + but the application is free to add more if further notification is required. + All handlers are notified of an event originating from the buffer, such as + the replacement of a style sheet during loading. + + The buffer never deletes any of the event handlers, unless RemoveEventHandler() + is called with @true as the second argument. + */ + bool AddEventHandler(wxEvtHandler* handler); + + /** + Removes an event handler from the buffer's list of handlers, deleting the + object if @a deleteHandler is @true. + */ + bool RemoveEventHandler(wxEvtHandler* handler, bool deleteHandler = false); + + /** + Clear event handlers. + */ + void ClearEventHandlers(); + + /** + Send event to event handlers. If sendToAll is true, will send to all event handlers, + otherwise will stop at the first successful one. + */ + bool SendEvent(wxEvent& event, bool sendToAll = true); + +// Implementation + + virtual int HitTest(wxDC& dc, wxRichTextDrawingContext& context, const wxPoint& pt, long& textPosition, wxRichTextObject** obj, wxRichTextObject** contextObj, int flags = 0) wxOVERRIDE; + + /** + Copies the buffer. + */ + void Copy(const wxRichTextBuffer& obj); + + /** + Assignment operator. + */ + void operator= (const wxRichTextBuffer& obj) { Copy(obj); } + + /** + Clones the buffer. + */ + virtual wxRichTextObject* Clone() const wxOVERRIDE { return new wxRichTextBuffer(*this); } + + /** + Submits a command to insert paragraphs. + */ + bool InsertParagraphsWithUndo(long pos, const wxRichTextParagraphLayoutBox& paragraphs, wxRichTextCtrl* ctrl, int flags = 0); + + /** + Submits a command to insert the given text. + */ + bool InsertTextWithUndo(long pos, const wxString& text, wxRichTextCtrl* ctrl, int flags = 0); + + /** + Submits a command to insert a newline. + */ + bool InsertNewlineWithUndo(long pos, wxRichTextCtrl* ctrl, int flags = 0); + + /** + Submits a command to insert the given image. + */ + bool InsertImageWithUndo(long pos, const wxRichTextImageBlock& imageBlock, wxRichTextCtrl* ctrl, int flags = 0, + const wxRichTextAttr& textAttr = wxRichTextAttr()); + + /** + Submits a command to insert an object. + */ + wxRichTextObject* InsertObjectWithUndo(long pos, wxRichTextObject *object, wxRichTextCtrl* ctrl, int flags); + + /** + Submits a command to delete this range. + */ + bool DeleteRangeWithUndo(const wxRichTextRange& range, wxRichTextCtrl* ctrl); + + /** + Mark modified. + */ + void Modify(bool modify = true) { m_modified = modify; } + + /** + Returns @true if the buffer was modified. + */ + bool IsModified() const { return m_modified; } + + //@{ + /** + Dumps contents of buffer for debugging purposes. + */ + virtual void Dump(); + virtual void Dump(wxTextOutputStream& stream) wxOVERRIDE { wxRichTextParagraphLayoutBox::Dump(stream); } + //@} + + /** + Returns the file handlers. + */ + static wxList& GetHandlers() { return sm_handlers; } + + /** + Adds a file handler to the end. + */ + static void AddHandler(wxRichTextFileHandler *handler); + + /** + Inserts a file handler at the front. + */ + static void InsertHandler(wxRichTextFileHandler *handler); + + /** + Removes a file handler. + */ + static bool RemoveHandler(const wxString& name); + + /** + Finds a file handler by name. + */ + static wxRichTextFileHandler *FindHandler(const wxString& name); + + /** + Finds a file handler by extension and type. + */ + static wxRichTextFileHandler *FindHandler(const wxString& extension, wxRichTextFileType imageType); + + /** + Finds a handler by filename or, if supplied, type. + */ + static wxRichTextFileHandler *FindHandlerFilenameOrType(const wxString& filename, + wxRichTextFileType imageType); + + /** + Finds a handler by type. + */ + static wxRichTextFileHandler *FindHandler(wxRichTextFileType imageType); + + /** + Gets a wildcard incorporating all visible handlers. If @a types is present, + it will be filled with the file type corresponding to each filter. This can be + used to determine the type to pass to LoadFile given a selected filter. + */ + static wxString GetExtWildcard(bool combine = false, bool save = false, wxArrayInt* types = NULL); + + /** + Clean up file handlers. + */ + static void CleanUpHandlers(); + + /** + Initialise the standard file handlers. + Currently, only the plain text loading/saving handler is initialised by default. + */ + static void InitStandardHandlers(); + + /** + Returns the drawing handlers. + */ + static wxList& GetDrawingHandlers() { return sm_drawingHandlers; } + + /** + Adds a drawing handler to the end. + */ + static void AddDrawingHandler(wxRichTextDrawingHandler *handler); + + /** + Inserts a drawing handler at the front. + */ + static void InsertDrawingHandler(wxRichTextDrawingHandler *handler); + + /** + Removes a drawing handler. + */ + static bool RemoveDrawingHandler(const wxString& name); + + /** + Finds a drawing handler by name. + */ + static wxRichTextDrawingHandler *FindDrawingHandler(const wxString& name); + + /** + Clean up drawing handlers. + */ + static void CleanUpDrawingHandlers(); + + /** + Returns the field types. + */ + static wxRichTextFieldTypeHashMap& GetFieldTypes() { return sm_fieldTypes; } + + /** + Adds a field type. + + @see RemoveFieldType(), FindFieldType(), wxRichTextField, wxRichTextFieldType, wxRichTextFieldTypeStandard + + */ + static void AddFieldType(wxRichTextFieldType *fieldType); + + /** + Removes a field type by name. + + @see AddFieldType(), FindFieldType(), wxRichTextField, wxRichTextFieldType, wxRichTextFieldTypeStandard + */ + static bool RemoveFieldType(const wxString& name); + + /** + Finds a field type by name. + + @see RemoveFieldType(), AddFieldType(), wxRichTextField, wxRichTextFieldType, wxRichTextFieldTypeStandard + */ + static wxRichTextFieldType *FindFieldType(const wxString& name); + + /** + Cleans up field types. + */ + static void CleanUpFieldTypes(); + + /** + Returns the renderer object. + */ + static wxRichTextRenderer* GetRenderer() { return sm_renderer; } + + /** + Sets @a renderer as the object to be used to render certain aspects of the + content, such as bullets. + + You can override default rendering by deriving a new class from + wxRichTextRenderer or wxRichTextStdRenderer, overriding one or more + virtual functions, and setting an instance of the class using this function. + */ + static void SetRenderer(wxRichTextRenderer* renderer); + + /** + Returns the minimum margin between bullet and paragraph in 10ths of a mm. + */ + static int GetBulletRightMargin() { return sm_bulletRightMargin; } + + /** + Sets the minimum margin between bullet and paragraph in 10ths of a mm. + */ + static void SetBulletRightMargin(int margin) { sm_bulletRightMargin = margin; } + + /** + Returns the factor to multiply by character height to get a reasonable bullet size. + */ + static float GetBulletProportion() { return sm_bulletProportion; } + + /** + Sets the factor to multiply by character height to get a reasonable bullet size. + */ + static void SetBulletProportion(float prop) { sm_bulletProportion = prop; } + + /** + Returns the scale factor for calculating dimensions. + */ + double GetScale() const { return m_scale; } + + /** + Sets the scale factor for calculating dimensions. + */ + void SetScale(double scale) { m_scale = scale; } + + /** + Sets the floating layout mode. Pass @false to speed up editing by not performing + floating layout. This setting affects all buffers. + + */ + static void SetFloatingLayoutMode(bool mode) { sm_floatingLayoutMode = mode; } + + /** + Returns the floating layout mode. The default is @true, where objects + are laid out according to their floating status. + */ + static bool GetFloatingLayoutMode() { return sm_floatingLayoutMode; } + +protected: + + /// Command processor + wxCommandProcessor* m_commandProcessor; + + /// Table storing fonts + wxRichTextFontTable m_fontTable; + + /// Has been modified? + bool m_modified; + + /// Collapsed command stack + int m_batchedCommandDepth; + + /// Name for collapsed command + wxString m_batchedCommandsName; + + /// Current collapsed command accumulating actions + wxRichTextCommand* m_batchedCommand; + + /// Whether to suppress undo + int m_suppressUndo; + + /// Style sheet, if any + wxRichTextStyleSheet* m_styleSheet; + + /// List of event handlers that will be notified of events + wxList m_eventHandlers; + + /// Stack of attributes for convenience functions + wxList m_attributeStack; + + /// Flags to be passed to handlers + int m_handlerFlags; + + /// File handlers + static wxList sm_handlers; + + /// Drawing handlers + static wxList sm_drawingHandlers; + + /// Field types + static wxRichTextFieldTypeHashMap sm_fieldTypes; + + /// Renderer + static wxRichTextRenderer* sm_renderer; + + /// Minimum margin between bullet and paragraph in 10ths of a mm + static int sm_bulletRightMargin; + + /// Factor to multiply by character height to get a reasonable bullet size + static float sm_bulletProportion; + + /// Floating layout mode, @true by default + static bool sm_floatingLayoutMode; + + /// Scaling factor in use: needed to calculate correct dimensions when printing + double m_scale; + + /// Font scale for adjusting the text size when editing + double m_fontScale; + + /// Dimension scale for reducing redundant whitespace when editing + double m_dimensionScale; +}; + +/** + @class wxRichTextCell + + wxRichTextCell is the cell in a table. + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextCell: public wxRichTextBox +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextCell); +public: +// Constructors + + /** + Default constructor; optionally pass the parent object. + */ + + wxRichTextCell(wxRichTextObject* parent = NULL); + + /** + Copy constructor. + */ + + wxRichTextCell(const wxRichTextCell& obj): wxRichTextBox() { Copy(obj); } + +// Overridables + + virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style) wxOVERRIDE; + + virtual int HitTest(wxDC& dc, wxRichTextDrawingContext& context, const wxPoint& pt, long& textPosition, wxRichTextObject** obj, wxRichTextObject** contextObj, int flags = 0) wxOVERRIDE; + + virtual bool AdjustAttributes(wxRichTextAttr& attr, wxRichTextDrawingContext& context) wxOVERRIDE; + + virtual wxString GetXMLNodeName() const wxOVERRIDE { return wxT("cell"); } + + virtual bool CanEditProperties() const wxOVERRIDE { return true; } + + virtual bool EditProperties(wxWindow* parent, wxRichTextBuffer* buffer) wxOVERRIDE; + + virtual wxString GetPropertiesMenuLabel() const wxOVERRIDE { return wxGetTranslation("&Cell"); } + + /// Don't allow a cell to be deleted in Defragment + virtual bool IsEmpty() const wxOVERRIDE { return false; } + +// Accessors + + /** + Returns the column span. The default is 1. + */ + int GetColSpan() const; + + /** + Sets the column span. + */ + void SetColSpan(int span); + + /** + Returns the row span. The default is 1. + */ + int GetRowSpan() const; + + /** + Sets the row span. + */ + void SetRowSpan(int span); + +// Operations + + virtual wxRichTextObject* Clone() const wxOVERRIDE { return new wxRichTextCell(*this); } + + void Copy(const wxRichTextCell& obj); + +protected: +}; + +/** + @class wxRichTextTable + + wxRichTextTable represents a table with arbitrary columns and rows. + */ + +WX_DEFINE_ARRAY_PTR(wxRichTextObject*, wxRichTextObjectPtrArray); +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxRichTextObjectPtrArray, wxRichTextObjectPtrArrayArray, WXDLLIMPEXP_RICHTEXT); + +class WXDLLIMPEXP_RICHTEXT wxRichTextTable: public wxRichTextBox +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextTable); +public: + +// Constructors + + /** + Default constructor; optionally pass the parent object. + */ + + wxRichTextTable(wxRichTextObject* parent = NULL); + + /** + Copy constructor. + */ + + wxRichTextTable(const wxRichTextTable& obj): wxRichTextBox() { Copy(obj); } + +// Overridables + + virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style) wxOVERRIDE; + + virtual int HitTest(wxDC& dc, wxRichTextDrawingContext& context, const wxPoint& pt, long& textPosition, wxRichTextObject** obj, wxRichTextObject** contextObj, int flags = 0) wxOVERRIDE; + + virtual bool AdjustAttributes(wxRichTextAttr& attr, wxRichTextDrawingContext& context) wxOVERRIDE; + + virtual wxString GetXMLNodeName() const wxOVERRIDE { return wxT("table"); } + + virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style) wxOVERRIDE; + + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const wxOVERRIDE; + + virtual bool DeleteRange(const wxRichTextRange& range) wxOVERRIDE; + + virtual wxString GetTextForRange(const wxRichTextRange& range) const wxOVERRIDE; + +#if wxUSE_XML + virtual bool ImportFromXML(wxRichTextBuffer* buffer, wxXmlNode* node, wxRichTextXMLHandler* handler, bool* recurse) wxOVERRIDE; +#endif + +#if wxRICHTEXT_HAVE_DIRECT_OUTPUT + virtual bool ExportXML(wxOutputStream& stream, int indent, wxRichTextXMLHandler* handler) wxOVERRIDE; +#endif + +#if wxRICHTEXT_HAVE_XMLDOCUMENT_OUTPUT + virtual bool ExportXML(wxXmlNode* parent, wxRichTextXMLHandler* handler) wxOVERRIDE; +#endif + + virtual bool FindPosition(wxDC& dc, wxRichTextDrawingContext& context, long index, wxPoint& pt, int* height, bool forceLineStart) wxOVERRIDE; + + virtual void CalculateRange(long start, long& end) wxOVERRIDE; + + // Can this object handle the selections of its children? FOr example, a table. + virtual bool HandlesChildSelections() const wxOVERRIDE { return true; } + + /// Returns a selection object specifying the selections between start and end character positions. + /// For example, a table would deduce what cells (of range length 1) are selected when dragging across the table. + virtual wxRichTextSelection GetSelection(long start, long end) const wxOVERRIDE; + + virtual bool CanEditProperties() const wxOVERRIDE { return true; } + + virtual bool EditProperties(wxWindow* parent, wxRichTextBuffer* buffer) wxOVERRIDE; + + virtual wxString GetPropertiesMenuLabel() const wxOVERRIDE { return wxGetTranslation("&Table"); } + + // Returns true if objects of this class can accept the focus, i.e. a call to SetFocusObject + // is possible. For example, containers supporting text, such as a text box object, can accept the focus, + // but a table can't (set the focus to individual cells instead). + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } + +// Accessors + + /** + Returns the cells array. + */ + const wxRichTextObjectPtrArrayArray& GetCells() const { return m_cells; } + + /** + Returns the cells array. + */ + wxRichTextObjectPtrArrayArray& GetCells() { return m_cells; } + + /** + Returns the row count. + */ + int GetRowCount() const { return m_rowCount; } + + /** + Sets the row count. + */ + void SetRowCount(int count) { m_rowCount = count; } + + /** + Returns the column count. + */ + int GetColumnCount() const { return m_colCount; } + + /** + Sets the column count. + */ + void SetColumnCount(int count) { m_colCount = count; } + + /** + Returns the cell at the given row/column position. + */ + virtual wxRichTextCell* GetCell(int row, int col) const; + + /** + Returns the cell at the given character position (in the range of the table). + */ + virtual wxRichTextCell* GetCell(long pos) const; + + /** + Returns the row/column for a given character position. + */ + virtual bool GetCellRowColumnPosition(long pos, int& row, int& col) const; + + /** + Returns the coordinates of the cell with keyboard focus, or (-1,-1) if none. + */ + virtual wxPosition GetFocusedCell() const; + +// Operations + + /** + Clears the table. + */ + + virtual void ClearTable(); + + /** + Creates a table of the given dimensions. + */ + + virtual bool CreateTable(int rows, int cols); + + /** + Sets the attributes for the cells specified by the selection. + */ + + virtual bool SetCellStyle(const wxRichTextSelection& selection, const wxRichTextAttr& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); + + /** + Deletes rows from the given row position. + */ + + virtual bool DeleteRows(int startRow, int noRows = 1); + + /** + Deletes columns from the given column position. + */ + + virtual bool DeleteColumns(int startCol, int noCols = 1); + + /** + Adds rows from the given row position. + */ + + virtual bool AddRows(int startRow, int noRows = 1, const wxRichTextAttr& attr = wxRichTextAttr()); + + /** + Adds columns from the given column position. + */ + + virtual bool AddColumns(int startCol, int noCols = 1, const wxRichTextAttr& attr = wxRichTextAttr()); + + // Makes a clone of this object. + virtual wxRichTextObject* Clone() const wxOVERRIDE { return new wxRichTextTable(*this); } + + // Copies this object. + void Copy(const wxRichTextTable& obj); + +protected: + + int m_rowCount; + int m_colCount; + + // An array of rows, each of which is a wxRichTextObjectPtrArray containing + // the cell objects. The cell objects are also children of this object. + // Problem: if boxes are immediate children of a box, this will cause problems + // with wxRichTextParagraphLayoutBox functions (and functions elsewhere) that + // expect to find just paragraphs. May have to adjust the way we handle the + // hierarchy to accept non-paragraph objects in a paragraph layout box. + // We'll be overriding much wxRichTextParagraphLayoutBox functionality so this + // may not be such a problem. Perhaps the table should derive from a different + // class? + wxRichTextObjectPtrArrayArray m_cells; +}; + +/** @class wxRichTextTableBlock + + Stores the coordinates for a block of cells. + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextTableBlock +{ +public: + wxRichTextTableBlock() { Init(); } + wxRichTextTableBlock(int colStart, int colEnd, int rowStart, int rowEnd) + { Init(); m_colStart = colStart; m_colEnd = colEnd; m_rowStart = rowStart; m_rowEnd = rowEnd; } + wxRichTextTableBlock(const wxRichTextTableBlock& block) { Copy(block); } + + void Init() { m_colStart = 0; m_colEnd = 0; m_rowStart = 0; m_rowEnd = 0; } + + void Copy(const wxRichTextTableBlock& block) + { + m_colStart = block.m_colStart; m_colEnd = block.m_colEnd; m_rowStart = block.m_rowStart; m_rowEnd = block.m_rowEnd; + } + void operator=(const wxRichTextTableBlock& block) { Copy(block); } + bool operator==(const wxRichTextTableBlock& block) + { return m_colStart == block.m_colStart && m_colEnd == block.m_colEnd && m_rowStart == block.m_rowStart && m_rowEnd == block.m_rowEnd; } + + /// Computes the block given a table (perhaps about to be edited) and a rich text control + /// that may have a selection. If no selection, the whole table is used. If just the whole content + /// of one cell is selected, this cell only is used. If the cell contents is not selected and + /// requireCellSelection is @false, the focused cell will count as a selected cell. + bool ComputeBlockForSelection(wxRichTextTable* table, wxRichTextCtrl* ctrl, bool requireCellSelection = true); + + /// Does this block represent the whole table? + bool IsWholeTable(wxRichTextTable* table) const; + + /// Returns the cell focused in the table, if any + static wxRichTextCell* GetFocusedCell(wxRichTextCtrl* ctrl); + + int& ColStart() { return m_colStart; } + int ColStart() const { return m_colStart; } + + int& ColEnd() { return m_colEnd; } + int ColEnd() const { return m_colEnd; } + + int& RowStart() { return m_rowStart; } + int RowStart() const { return m_rowStart; } + + int& RowEnd() { return m_rowEnd; } + int RowEnd() const { return m_rowEnd; } + + int m_colStart, m_colEnd, m_rowStart, m_rowEnd; +}; + +/** + The command identifiers for Do/Undo. +*/ + +enum wxRichTextCommandId +{ + wxRICHTEXT_INSERT, + wxRICHTEXT_DELETE, + wxRICHTEXT_CHANGE_ATTRIBUTES, + wxRICHTEXT_CHANGE_STYLE, + wxRICHTEXT_CHANGE_PROPERTIES, + wxRICHTEXT_CHANGE_OBJECT +}; + +/** + @class wxRichTextObjectAddress + + A class for specifying an object anywhere in an object hierarchy, + without using a pointer, necessary since wxRTC commands may delete + and recreate sub-objects so physical object addresses change. An array + of positions (one per hierarchy level) is used. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextCommand +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextObjectAddress +{ +public: + /** + Creates the address given a container and an object. + */ + wxRichTextObjectAddress(wxRichTextParagraphLayoutBox* topLevelContainer, wxRichTextObject* obj) { Create(topLevelContainer, obj); } + /** + */ + wxRichTextObjectAddress() { Init(); } + /** + */ + wxRichTextObjectAddress(const wxRichTextObjectAddress& address) { Copy(address); } + + void Init() {} + + /** + Copies the address. + */ + void Copy(const wxRichTextObjectAddress& address) { m_address = address.m_address; } + + /** + Assignment operator. + */ + void operator=(const wxRichTextObjectAddress& address) { Copy(address); } + + /** + Returns the object specified by the address, given a top level container. + */ + wxRichTextObject* GetObject(wxRichTextParagraphLayoutBox* topLevelContainer) const; + + /** + Creates the address given a container and an object. + */ + bool Create(wxRichTextParagraphLayoutBox* topLevelContainer, wxRichTextObject* obj); + + /** + Returns the array of integers representing the object address. + */ + wxArrayInt& GetAddress() { return m_address; } + + /** + Returns the array of integers representing the object address. + */ + const wxArrayInt& GetAddress() const { return m_address; } + + /** + Sets the address from an array of integers. + */ + void SetAddress(const wxArrayInt& address) { m_address = address; } + +protected: + + wxArrayInt m_address; +}; + +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextAction; + +/** + @class wxRichTextCommand + + Implements a command on the undo/redo stack. A wxRichTextCommand object contains one or more wxRichTextAction + objects, allowing aggregation of a number of operations into one command. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextAction +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextCommand: public wxCommand +{ +public: + /** + Constructor for one action. + */ + wxRichTextCommand(const wxString& name, wxRichTextCommandId id, wxRichTextBuffer* buffer, + wxRichTextParagraphLayoutBox* container, wxRichTextCtrl* ctrl, bool ignoreFirstTime = false); + + /** + Constructor for multiple actions. + */ + wxRichTextCommand(const wxString& name); + + virtual ~wxRichTextCommand(); + + /** + Performs the command. + */ + bool Do() wxOVERRIDE; + + /** + Undoes the command. + */ + bool Undo() wxOVERRIDE; + + /** + Adds an action to the action list. + */ + void AddAction(wxRichTextAction* action); + + /** + Clears the action list. + */ + void ClearActions(); + + /** + Returns the action list. + */ + wxList& GetActions() { return m_actions; } + + /** + Indicate whether the control should be frozen when performing Do/Undo + */ + bool GetFreeze() const { return m_freeze; } + void SetFreeze(bool freeze) { m_freeze = freeze; } + +protected: + + wxList m_actions; + bool m_freeze; +}; + +/** + @class wxRichTextAction + + Implements a part of a command. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextCommand +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextAction: public wxObject +{ +public: + /** + Constructor. @a buffer is the top-level buffer, while @a container is the object within + which the action is taking place. In the simplest case, they are the same. + */ + wxRichTextAction(wxRichTextCommand* cmd, const wxString& name, wxRichTextCommandId id, + wxRichTextBuffer* buffer, wxRichTextParagraphLayoutBox* container, + wxRichTextCtrl* ctrl, bool ignoreFirstTime = false); + + virtual ~wxRichTextAction(); + + /** + Performs the action. + */ + bool Do(); + + /** + Undoes the action. + */ + bool Undo(); + + /** + Updates the control appearance, optimizing if possible given information from the call to Layout. + */ + void UpdateAppearance(long caretPosition, bool sendUpdateEvent = false, + const wxRect& oldFloatRect = wxRect(), + wxArrayInt* optimizationLineCharPositions = NULL, wxArrayInt* optimizationLineYPositions = NULL, + bool isDoCmd = true); + + /** + Replaces the buffer paragraphs with the given fragment. + */ + void ApplyParagraphs(const wxRichTextParagraphLayoutBox& fragment); + + /** + Returns the new fragments. + */ + wxRichTextParagraphLayoutBox& GetNewParagraphs() { return m_newParagraphs; } + + /** + Returns the old fragments. + */ + wxRichTextParagraphLayoutBox& GetOldParagraphs() { return m_oldParagraphs; } + + /** + Returns the attributes, for single-object commands. + */ + wxRichTextAttr& GetAttributes() { return m_attributes; } + + /** + Returns the object to replace the one at the position defined by the container address + and the action's range start position. + */ + wxRichTextObject* GetObject() const { return m_object; } + + /** + Returns the associated rich text control. + */ + wxRichTextCtrl* GetRichTextCtrl() const { return m_ctrl; } + + /** + Stores the object to replace the one at the position defined by the container address + without making an address for it (cf SetObject() and MakeObject()). + */ + void StoreObject(wxRichTextObject* obj) { m_object = obj; } + + /** + Sets the object to replace the one at the position defined by the container address + and the action's range start position. + */ + void SetObject(wxRichTextObject* obj) { m_object = obj; m_objectAddress.Create(m_buffer, m_object); } + + /** + Makes an address from the given object. + */ + void MakeObject(wxRichTextObject* obj) { m_objectAddress.Create(m_buffer, obj); } + + /** + Sets the existing and new objects, for use with wxRICHTEXT_CHANGE_OBJECT. + */ + void SetOldAndNewObjects(wxRichTextObject* oldObj, wxRichTextObject* newObj) { SetObject(oldObj); StoreObject(newObj); } + + /** + Calculate arrays for refresh optimization. + */ + void CalculateRefreshOptimizations(wxArrayInt& optimizationLineCharPositions, wxArrayInt& optimizationLineYPositions, + wxRect& oldFloatRect); + + /** + Sets the position used for e.g. insertion. + */ + void SetPosition(long pos) { m_position = pos; } + + /** + Returns the position used for e.g. insertion. + */ + long GetPosition() const { return m_position; } + + /** + Sets the range for e.g. deletion. + */ + void SetRange(const wxRichTextRange& range) { m_range = range; } + + /** + Returns the range for e.g. deletion. + */ + const wxRichTextRange& GetRange() const { return m_range; } + + /** + Returns the address (nested position) of the container within the buffer being manipulated. + */ + wxRichTextObjectAddress& GetContainerAddress() { return m_containerAddress; } + + /** + Returns the address (nested position) of the container within the buffer being manipulated. + */ + const wxRichTextObjectAddress& GetContainerAddress() const { return m_containerAddress; } + + /** + Sets the address (nested position) of the container within the buffer being manipulated. + */ + void SetContainerAddress(const wxRichTextObjectAddress& address) { m_containerAddress = address; } + + /** + Sets the address (nested position) of the container within the buffer being manipulated. + */ + void SetContainerAddress(wxRichTextParagraphLayoutBox* container, wxRichTextObject* obj) { m_containerAddress.Create(container, obj); } + + /** + Returns the container that this action refers to, using the container address and top-level buffer. + */ + wxRichTextParagraphLayoutBox* GetContainer() const; + + /** + Returns the action name. + */ + const wxString& GetName() const { return m_name; } + + /** + Instructs the first Do() command should be skipped as it's already been applied. + */ + void SetIgnoreFirstTime(bool b) { m_ignoreThis = b; } + + /** + Returns true if the first Do() command should be skipped as it's already been applied. + */ + bool GetIgnoreFirstTime() const { return m_ignoreThis; } + +protected: + // Action name + wxString m_name; + + // Buffer + wxRichTextBuffer* m_buffer; + + // The address (nested position) of the container being manipulated. + // This is necessary because objects are deleted, and we can't + // therefore store actual pointers. + wxRichTextObjectAddress m_containerAddress; + + // Control + wxRichTextCtrl* m_ctrl; + + // Stores the new paragraphs + wxRichTextParagraphLayoutBox m_newParagraphs; + + // Stores the old paragraphs + wxRichTextParagraphLayoutBox m_oldParagraphs; + + // Stores an object to replace the one at the position + // defined by the container address and the action's range start position. + wxRichTextObject* m_object; + + // Stores the attributes + wxRichTextAttr m_attributes; + + // The address of the object being manipulated (used for changing an individual object or its attributes) + wxRichTextObjectAddress m_objectAddress; + + // Stores the old attributes + // wxRichTextAttr m_oldAttributes; + + // The affected range + wxRichTextRange m_range; + + // The insertion point for this command + long m_position; + + // Ignore 1st 'Do' operation because we already did it + bool m_ignoreThis; + + // The command identifier + wxRichTextCommandId m_cmdId; +}; + +/*! + * Handler flags + */ + +// Include style sheet when loading and saving +#define wxRICHTEXT_HANDLER_INCLUDE_STYLESHEET 0x0001 + +// Save images to memory file system in HTML handler +#define wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_MEMORY 0x0010 + +// Save images to files in HTML handler +#define wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_FILES 0x0020 + +// Save images as inline base64 data in HTML handler +#define wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_BASE64 0x0040 + +// Don't write header and footer (or BODY), so we can include the fragment +// in a larger document +#define wxRICHTEXT_HANDLER_NO_HEADER_FOOTER 0x0080 + +// Convert the more common face names to names that will work on the current platform +// in a larger document +#define wxRICHTEXT_HANDLER_CONVERT_FACENAMES 0x0100 + +/** + @class wxRichTextFileHandler + + The base class for file handlers. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextBuffer, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextFileHandler: public wxObject +{ + wxDECLARE_CLASS(wxRichTextFileHandler); +public: + /** + Creates a file handler object. + */ + wxRichTextFileHandler(const wxString& name = wxEmptyString, const wxString& ext = wxEmptyString, int type = 0) + : m_name(name), m_extension(ext), m_type(type), m_flags(0), m_visible(true) + { } + +#if wxUSE_STREAMS + /** + Loads the buffer from a stream. + Not all handlers will implement file loading. + */ + bool LoadFile(wxRichTextBuffer *buffer, wxInputStream& stream) + { return DoLoadFile(buffer, stream); } + + /** + Saves the buffer to a stream. + Not all handlers will implement file saving. + */ + bool SaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream) + { return DoSaveFile(buffer, stream); } +#endif + +#if wxUSE_FFILE && wxUSE_STREAMS + /** + Loads the buffer from a file. + */ + virtual bool LoadFile(wxRichTextBuffer *buffer, const wxString& filename); + + /** + Saves the buffer to a file. + */ + virtual bool SaveFile(wxRichTextBuffer *buffer, const wxString& filename); +#endif // wxUSE_STREAMS && wxUSE_STREAMS + + /** + Returns @true if we handle this filename (if using files). By default, checks the extension. + */ + virtual bool CanHandle(const wxString& filename) const; + + /** + Returns @true if we can save using this handler. + */ + virtual bool CanSave() const { return false; } + + /** + Returns @true if we can load using this handler. + */ + virtual bool CanLoad() const { return false; } + + /** + Returns @true if this handler should be visible to the user. + */ + virtual bool IsVisible() const { return m_visible; } + + /** + Sets whether the handler should be visible to the user (via the application's + load and save dialogs). + */ + virtual void SetVisible(bool visible) { m_visible = visible; } + + /** + Sets the name of the handler. + */ + void SetName(const wxString& name) { m_name = name; } + + /** + Returns the name of the handler. + */ + wxString GetName() const { return m_name; } + + /** + Sets the default extension to recognise. + */ + void SetExtension(const wxString& ext) { m_extension = ext; } + + /** + Returns the default extension to recognise. + */ + wxString GetExtension() const { return m_extension; } + + /** + Sets the handler type. + */ + void SetType(int type) { m_type = type; } + + /** + Returns the handler type. + */ + int GetType() const { return m_type; } + + /** + Sets flags that change the behaviour of loading or saving. + See the documentation for each handler class to see what flags are relevant + for each handler. + + You call this function directly if you are using a file handler explicitly + (without going through the text control or buffer LoadFile/SaveFile API). + Or, you can call the control or buffer's SetHandlerFlags function to set + the flags that will be used for subsequent load and save operations. + */ + void SetFlags(int flags) { m_flags = flags; } + + /** + Returns flags controlling how loading and saving is done. + */ + int GetFlags() const { return m_flags; } + + /** + Sets the encoding to use when saving a file. If empty, a suitable encoding is chosen. + */ + void SetEncoding(const wxString& encoding) { m_encoding = encoding; } + + /** + Returns the encoding to use when saving a file. If empty, a suitable encoding is chosen. + */ + const wxString& GetEncoding() const { return m_encoding; } + +protected: + +#if wxUSE_STREAMS + /** + Override to load content from @a stream into @a buffer. + */ + virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream) = 0; + + /** + Override to save content to @a stream from @a buffer. + */ + virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream) = 0; +#endif + + wxString m_name; + wxString m_encoding; + wxString m_extension; + int m_type; + int m_flags; + bool m_visible; +}; + +/** + @class wxRichTextPlainTextHandler + + Implements saving a buffer to plain text. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextFileHandler, wxRichTextBuffer, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextPlainTextHandler: public wxRichTextFileHandler +{ + wxDECLARE_CLASS(wxRichTextPlainTextHandler); +public: + wxRichTextPlainTextHandler(const wxString& name = wxT("Text"), + const wxString& ext = wxT("txt"), + wxRichTextFileType type = wxRICHTEXT_TYPE_TEXT) + : wxRichTextFileHandler(name, ext, type) + { } + + // Can we save using this handler? + virtual bool CanSave() const wxOVERRIDE { return true; } + + // Can we load using this handler? + virtual bool CanLoad() const wxOVERRIDE { return true; } + +protected: + +#if wxUSE_STREAMS + virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream) wxOVERRIDE; + virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream) wxOVERRIDE; +#endif + +}; + +/** + @class wxRichTextDrawingHandler + + The base class for custom drawing handlers. + Currently, drawing handlers can provide virtual attributes. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextBuffer, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextDrawingHandler: public wxObject +{ + wxDECLARE_CLASS(wxRichTextDrawingHandler); +public: + /** + Creates a drawing handler object. + */ + wxRichTextDrawingHandler(const wxString& name = wxEmptyString) + : m_name(name) + { } + + /** + Returns @true if this object has virtual attributes that we can provide. + */ + virtual bool HasVirtualAttributes(wxRichTextObject* obj) const = 0; + + /** + Provides virtual attributes that we can provide. + */ + virtual bool GetVirtualAttributes(wxRichTextAttr& attr, wxRichTextObject* obj) const = 0; + + /** + Gets the count for mixed virtual attributes for individual positions within the object. + For example, individual characters within a text object may require special highlighting. + */ + virtual int GetVirtualSubobjectAttributesCount(wxRichTextObject* obj) const = 0; + + /** + Gets the mixed virtual attributes for individual positions within the object. + For example, individual characters within a text object may require special highlighting. + Returns the number of virtual attributes found. + */ + virtual int GetVirtualSubobjectAttributes(wxRichTextObject* obj, wxArrayInt& positions, wxRichTextAttrArray& attributes) const = 0; + + /** + Do we have virtual text for this object? Virtual text allows an application + to replace characters in an object for editing and display purposes, for example + for highlighting special characters. + */ + virtual bool HasVirtualText(const wxRichTextPlainText* obj) const = 0; + + /** + Gets the virtual text for this object. + */ + virtual bool GetVirtualText(const wxRichTextPlainText* obj, wxString& text) const = 0; + + /** + Sets the name of the handler. + */ + void SetName(const wxString& name) { m_name = name; } + + /** + Returns the name of the handler. + */ + wxString GetName() const { return m_name; } + +protected: + + wxString m_name; +}; + +#if wxUSE_DATAOBJ + +/** + @class wxRichTextBufferDataObject + + Implements a rich text data object for clipboard transfer. + + @library{wxrichtext} + @category{richtext} + + @see wxDataObjectSimple, wxRichTextBuffer, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextBufferDataObject: public wxDataObjectSimple +{ +public: + /** + The constructor doesn't copy the pointer, so it shouldn't go away while this object + is alive. + */ + wxRichTextBufferDataObject(wxRichTextBuffer* richTextBuffer = NULL); + virtual ~wxRichTextBufferDataObject(); + + /** + After a call to this function, the buffer is owned by the caller and it + is responsible for deleting it. + */ + wxRichTextBuffer* GetRichTextBuffer(); + + /** + Returns the id for the new data format. + */ + static const wxChar* GetRichTextBufferFormatId() { return ms_richTextBufferFormatId; } + + // base class pure virtuals + + virtual wxDataFormat GetPreferredFormat(Direction dir) const wxOVERRIDE; + virtual size_t GetDataSize() const wxOVERRIDE; + virtual bool GetDataHere(void *pBuf) const wxOVERRIDE; + virtual bool SetData(size_t len, const void *buf) wxOVERRIDE; + + // prevent warnings + + virtual size_t GetDataSize(const wxDataFormat&) const wxOVERRIDE { return GetDataSize(); } + virtual bool GetDataHere(const wxDataFormat&, void *buf) const wxOVERRIDE { return GetDataHere(buf); } + virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) wxOVERRIDE { return SetData(len, buf); } + +protected: + wxDataFormat m_formatRichTextBuffer; // our custom format + wxRichTextBuffer* m_richTextBuffer; // our data + static const wxChar* ms_richTextBufferFormatId; // our format id +}; + +#endif + +/** + @class wxRichTextRenderer + + This class isolates some common drawing functionality. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextBuffer, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextRenderer: public wxObject +{ +public: + /** + Constructor. + */ + wxRichTextRenderer() {} + virtual ~wxRichTextRenderer() {} + + /** + Draws a standard bullet, as specified by the value of GetBulletName. This function should be overridden. + */ + virtual bool DrawStandardBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxRichTextAttr& attr, const wxRect& rect) = 0; + + /** + Draws a bullet that can be described by text, such as numbered or symbol bullets. This function should be overridden. + */ + virtual bool DrawTextBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxRichTextAttr& attr, const wxRect& rect, const wxString& text) = 0; + + /** + Draws a bitmap bullet, where the bullet bitmap is specified by the value of GetBulletName. This function should be overridden. + */ + virtual bool DrawBitmapBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxRichTextAttr& attr, const wxRect& rect) = 0; + + /** + Enumerate the standard bullet names currently supported. This function should be overridden. + */ + virtual bool EnumerateStandardBulletNames(wxArrayString& bulletNames) = 0; + + /** + Measure the bullet. + */ + virtual bool MeasureBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxRichTextAttr& attr, wxSize& sz) = 0; +}; + +/** + @class wxRichTextStdRenderer + + The standard renderer for drawing bullets. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextRenderer, wxRichTextBuffer, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextStdRenderer: public wxRichTextRenderer +{ +public: + /** + Constructor. + */ + wxRichTextStdRenderer() {} + + // Draw a standard bullet, as specified by the value of GetBulletName + virtual bool DrawStandardBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxRichTextAttr& attr, const wxRect& rect) wxOVERRIDE; + + // Draw a bullet that can be described by text, such as numbered or symbol bullets + virtual bool DrawTextBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxRichTextAttr& attr, const wxRect& rect, const wxString& text) wxOVERRIDE; + + // Draw a bitmap bullet, where the bullet bitmap is specified by the value of GetBulletName + virtual bool DrawBitmapBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxRichTextAttr& attr, const wxRect& rect) wxOVERRIDE; + + // Enumerate the standard bullet names currently supported + virtual bool EnumerateStandardBulletNames(wxArrayString& bulletNames) wxOVERRIDE; + + // Measure the bullet. + virtual bool MeasureBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxRichTextAttr& attr, wxSize& sz) wxOVERRIDE; + + // Set a font which may depend on text effects. + static void SetFontForBullet(wxRichTextBuffer& buffer, wxDC& dc, const wxRichTextAttr& attr); +}; + +/*! + * Utilities + * + */ + +inline bool wxRichTextHasStyle(int flags, int style) +{ + return ((flags & style) == style); +} + +/// Compare two attribute objects +WXDLLIMPEXP_RICHTEXT bool wxTextAttrEq(const wxRichTextAttr& attr1, const wxRichTextAttr& attr2); +WXDLLIMPEXP_RICHTEXT bool wxTextAttrEq(const wxRichTextAttr& attr1, const wxRichTextAttr& attr2); + +/// Apply one style to another +WXDLLIMPEXP_RICHTEXT bool wxRichTextApplyStyle(wxRichTextAttr& destStyle, const wxRichTextAttr& style, wxRichTextAttr* compareWith = NULL); + +// Remove attributes +WXDLLIMPEXP_RICHTEXT bool wxRichTextRemoveStyle(wxRichTextAttr& destStyle, const wxRichTextAttr& style); + +/// Combine two bitlists +WXDLLIMPEXP_RICHTEXT bool wxRichTextCombineBitlists(int& valueA, int valueB, int& flagsA, int flagsB); + +/// Compare two bitlists +WXDLLIMPEXP_RICHTEXT bool wxRichTextBitlistsEqPartial(int valueA, int valueB, int flags); + +/// Split into paragraph and character styles +WXDLLIMPEXP_RICHTEXT bool wxRichTextSplitParaCharStyles(const wxRichTextAttr& style, wxRichTextAttr& parStyle, wxRichTextAttr& charStyle); + +/// Compare tabs +WXDLLIMPEXP_RICHTEXT bool wxRichTextTabsEq(const wxArrayInt& tabs1, const wxArrayInt& tabs2); + +/// Convert a decimal to Roman numerals +WXDLLIMPEXP_RICHTEXT wxString wxRichTextDecimalToRoman(long n); + +// Collects the attributes that are common to a range of content, building up a note of +// which attributes are absent in some objects and which clash in some objects. +WXDLLIMPEXP_RICHTEXT void wxTextAttrCollectCommonAttributes(wxTextAttr& currentStyle, const wxTextAttr& attr, wxTextAttr& clashingAttr, wxTextAttr& absentAttr); + +WXDLLIMPEXP_RICHTEXT void wxRichTextModuleInit(); + +#endif + // wxUSE_RICHTEXT + +#endif + // _WX_RICHTEXTBUFFER_H_ + diff --git a/lib/wxWidgets/include/wx/richtext/richtextbulletspage.h b/lib/wxWidgets/include/wx/richtext/richtextbulletspage.h new file mode 100644 index 0000000..440e7ba --- /dev/null +++ b/lib/wxWidgets/include/wx/richtext/richtextbulletspage.h @@ -0,0 +1,220 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextbulletspage.h +// Purpose: Declares the rich text formatting dialog bullets page. +// Author: Julian Smart +// Modified by: +// Created: 10/4/2006 10:32:31 AM +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _RICHTEXTBULLETSPAGE_H_ +#define _RICHTEXTBULLETSPAGE_H_ + +/*! + * Includes + */ + +#include "wx/richtext/richtextdialogpage.h" +#include "wx/spinbutt.h" // for wxSpinEvent + +/*! + * Forward declarations + */ + +////@begin forward declarations +class wxSpinCtrl; +class wxRichTextCtrl; +////@end forward declarations + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define SYMBOL_WXRICHTEXTBULLETSPAGE_STYLE wxTAB_TRAVERSAL +#define SYMBOL_WXRICHTEXTBULLETSPAGE_TITLE wxEmptyString +#define SYMBOL_WXRICHTEXTBULLETSPAGE_IDNAME ID_RICHTEXTBULLETSPAGE +#define SYMBOL_WXRICHTEXTBULLETSPAGE_SIZE wxSize(400, 300) +#define SYMBOL_WXRICHTEXTBULLETSPAGE_POSITION wxDefaultPosition +////@end control identifiers + +/*! + * wxRichTextBulletsPage class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextBulletsPage: public wxRichTextDialogPage +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextBulletsPage); + wxDECLARE_EVENT_TABLE(); + DECLARE_HELP_PROVISION() + +public: + /// Constructors + wxRichTextBulletsPage( ); + wxRichTextBulletsPage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTBULLETSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTBULLETSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTBULLETSPAGE_STYLE ); + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTBULLETSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTBULLETSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTBULLETSPAGE_STYLE ); + + /// Initialise members + void Init(); + + /// Creates the controls and sizers + void CreateControls(); + + /// Updates the bullets preview + void UpdatePreview(); + + /// Transfer data from/to window + virtual bool TransferDataFromWindow() wxOVERRIDE; + virtual bool TransferDataToWindow() wxOVERRIDE; + + /// Gets the attributes associated with the main formatting dialog + wxRichTextAttr* GetAttributes(); + + /// Update for symbol-related controls + void OnSymbolUpdate( wxUpdateUIEvent& event ); + + /// Update for number-related controls + void OnNumberUpdate( wxUpdateUIEvent& event ); + + /// Update for standard bullet-related controls + void OnStandardBulletUpdate( wxUpdateUIEvent& event ); + +////@begin wxRichTextBulletsPage event handler declarations + + /// wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_STYLELISTBOX + void OnStylelistboxSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_PERIODCTRL + void OnPeriodctrlClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_PERIODCTRL + void OnPeriodctrlUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL + void OnParenthesesctrlClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL + void OnParenthesesctrlUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_RIGHTPARENTHESISCTRL + void OnRightParenthesisCtrlClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_RIGHTPARENTHESISCTRL + void OnRightParenthesisCtrlUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_BULLETALIGNMENTCTRL + void OnBulletAlignmentCtrlSelected( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC + void OnSymbolstaticUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL + void OnSymbolctrlSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL + void OnSymbolctrlUpdated( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL + void OnSymbolctrlUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL + void OnChooseSymbolClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL + void OnChooseSymbolUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL + void OnSymbolfontctrlSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL + void OnSymbolfontctrlUpdated( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL + void OnSymbolfontctrlUIUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NAMESTATIC + void OnNamestaticUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL + void OnNamectrlSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL + void OnNamectrlUpdated( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL + void OnNamectrlUIUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC + void OnNumberstaticUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL + void OnNumberctrlUpdated( wxSpinEvent& event ); + + /// wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL + void OnNumberctrlUp( wxSpinEvent& event ); + + /// wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL + void OnNumberctrlDown( wxSpinEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL + void OnNumberctrlTextUpdated( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL + void OnNumberctrlUpdate( wxUpdateUIEvent& event ); + +////@end wxRichTextBulletsPage event handler declarations + +////@begin wxRichTextBulletsPage member function declarations + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end wxRichTextBulletsPage member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + +////@begin wxRichTextBulletsPage member variables + wxListBox* m_styleListBox; + wxCheckBox* m_periodCtrl; + wxCheckBox* m_parenthesesCtrl; + wxCheckBox* m_rightParenthesisCtrl; + wxComboBox* m_bulletAlignmentCtrl; + wxComboBox* m_symbolCtrl; + wxComboBox* m_symbolFontCtrl; + wxComboBox* m_bulletNameCtrl; + wxSpinCtrl* m_numberCtrl; + wxRichTextCtrl* m_previewCtrl; + /// Control identifiers + enum { + ID_RICHTEXTBULLETSPAGE = 10300, + ID_RICHTEXTBULLETSPAGE_STYLELISTBOX = 10305, + ID_RICHTEXTBULLETSPAGE_PERIODCTRL = 10313, + ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL = 10311, + ID_RICHTEXTBULLETSPAGE_RIGHTPARENTHESISCTRL = 10306, + ID_RICHTEXTBULLETSPAGE_BULLETALIGNMENTCTRL = 10315, + ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC = 10301, + ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL = 10307, + ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL = 10308, + ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL = 10309, + ID_RICHTEXTBULLETSPAGE_NAMESTATIC = 10303, + ID_RICHTEXTBULLETSPAGE_NAMECTRL = 10304, + ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC = 10302, + ID_RICHTEXTBULLETSPAGE_NUMBERCTRL = 10310, + ID_RICHTEXTBULLETSPAGE_PREVIEW_CTRL = 10314 + }; +////@end wxRichTextBulletsPage member variables + + bool m_hasBulletStyle; + bool m_hasBulletNumber; + bool m_hasBulletSymbol; + bool m_dontUpdate; +}; + +#endif + // _RICHTEXTBULLETSPAGE_H_ diff --git a/lib/wxWidgets/include/wx/richtext/richtextctrl.h b/lib/wxWidgets/include/wx/richtext/richtextctrl.h new file mode 100644 index 0000000..cece67b --- /dev/null +++ b/lib/wxWidgets/include/wx/richtext/richtextctrl.h @@ -0,0 +1,2742 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextctrl.h +// Purpose: A rich edit control +// Author: Julian Smart +// Modified by: +// Created: 2005-09-30 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RICHTEXTCTRL_H_ +#define _WX_RICHTEXTCTRL_H_ + +#include "wx/richtext/richtextbuffer.h" + +#if wxUSE_RICHTEXT + +#include "wx/scrolwin.h" +#include "wx/caret.h" +#include "wx/timer.h" +#include "wx/textctrl.h" + +#if wxUSE_DRAG_AND_DROP +#include "wx/dnd.h" +#endif + +#if !defined(__WXGTK__) && !defined(__WXMAC__) +#define wxRICHTEXT_BUFFERED_PAINTING 1 +#else +#define wxRICHTEXT_BUFFERED_PAINTING 0 +#endif + +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextStyleDefinition; + +/* + * Styles and flags + */ + +/** + Styles +*/ + +#define wxRE_READONLY 0x0010 +#define wxRE_MULTILINE 0x0020 +#define wxRE_CENTRE_CARET 0x8000 +#define wxRE_CENTER_CARET wxRE_CENTRE_CARET + +/** + Flags +*/ + +#define wxRICHTEXT_SHIFT_DOWN 0x01 +#define wxRICHTEXT_CTRL_DOWN 0x02 +#define wxRICHTEXT_ALT_DOWN 0x04 + +/** + Extra flags +*/ + +// Don't draw guide lines around boxes and tables +#define wxRICHTEXT_EX_NO_GUIDELINES 0x00000100 + + +/* + Defaults +*/ + +#define wxRICHTEXT_DEFAULT_OVERALL_SIZE wxSize(-1, -1) +#define wxRICHTEXT_DEFAULT_IMAGE_SIZE wxSize(80, 80) +#define wxRICHTEXT_DEFAULT_SPACING 3 +#define wxRICHTEXT_DEFAULT_MARGIN 3 +#define wxRICHTEXT_DEFAULT_UNFOCUSSED_BACKGROUND wxColour(175, 175, 175) +#define wxRICHTEXT_DEFAULT_FOCUSSED_BACKGROUND wxColour(140, 140, 140) +#define wxRICHTEXT_DEFAULT_UNSELECTED_BACKGROUND wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE) +#define wxRICHTEXT_DEFAULT_TYPE_COLOUR wxColour(0, 0, 200) +#define wxRICHTEXT_DEFAULT_FOCUS_RECT_COLOUR wxColour(100, 80, 80) +#define wxRICHTEXT_DEFAULT_CARET_WIDTH 2 +// Minimum buffer size before delayed layout kicks in +#define wxRICHTEXT_DEFAULT_DELAYED_LAYOUT_THRESHOLD 20000 +// Milliseconds before layout occurs after resize +#define wxRICHTEXT_DEFAULT_LAYOUT_INTERVAL 50 +// Milliseconds before delayed image processing occurs +#define wxRICHTEXT_DEFAULT_DELAYED_IMAGE_PROCESSING_INTERVAL 200 + +/* Identifiers + */ +#define wxID_RICHTEXT_PROPERTIES1 (wxID_HIGHEST + 1) +#define wxID_RICHTEXT_PROPERTIES2 (wxID_HIGHEST + 2) +#define wxID_RICHTEXT_PROPERTIES3 (wxID_HIGHEST + 3) + +/* + Normal selection occurs initially and as user drags within one container. + Common ancestor selection occurs when the user starts dragging across containers + that have a common ancestor, for example the cells in a table. + */ + +enum wxRichTextCtrlSelectionState +{ + wxRichTextCtrlSelectionState_Normal, + wxRichTextCtrlSelectionState_CommonAncestor +}; + +/** + @class wxRichTextContextMenuPropertiesInfo + + wxRichTextContextMenuPropertiesInfo keeps track of objects that appear in the context menu, + whose properties are available to be edited. + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextContextMenuPropertiesInfo +{ +public: + /** + Constructor. + */ + wxRichTextContextMenuPropertiesInfo() { Init(); } + +// Operations + + /** + Initialisation. + */ + void Init() {} + + /** + Adds an item. + */ + bool AddItem(const wxString& label, wxRichTextObject* obj); + + /** + Returns the number of menu items that were added. + */ + int AddMenuItems(wxMenu* menu, int startCmd = wxID_RICHTEXT_PROPERTIES1) const; + + /** + Adds appropriate menu items for the current container and clicked on object + (and container's parent, if appropriate). + */ + int AddItems(wxRichTextCtrl* ctrl, wxRichTextObject* container, wxRichTextObject* obj); + + /** + Clears the items. + */ + void Clear() { m_objects.Clear(); m_labels.Clear(); } + +// Accessors + + /** + Returns the nth label. + */ + wxString GetLabel(int n) const { return m_labels[n]; } + + /** + Returns the nth object. + */ + wxRichTextObject* GetObject(int n) const { return m_objects[n]; } + + /** + Returns the array of objects. + */ + wxRichTextObjectPtrArray& GetObjects() { return m_objects; } + + /** + Returns the array of objects. + */ + const wxRichTextObjectPtrArray& GetObjects() const { return m_objects; } + + /** + Returns the array of labels. + */ + wxArrayString& GetLabels() { return m_labels; } + + /** + Returns the array of labels. + */ + const wxArrayString& GetLabels() const { return m_labels; } + + /** + Returns the number of items. + */ + int GetCount() const { return static_cast<int>(m_objects.GetCount()); } + + wxRichTextObjectPtrArray m_objects; + wxArrayString m_labels; +}; + +/** + @class wxRichTextCtrl + + wxRichTextCtrl provides a generic, ground-up implementation of a text control + capable of showing multiple styles and images. + + wxRichTextCtrl sends notification events: see wxRichTextEvent. + + It also sends the standard wxTextCtrl events @c wxEVT_TEXT_ENTER and + @c wxEVT_TEXT, and wxTextUrlEvent when URL content is clicked. + + For more information, see the @ref overview_richtextctrl. + + @beginStyleTable + @style{wxRE_CENTRE_CARET} + The control will try to keep the caret line centred vertically while editing. + wxRE_CENTER_CARET is a synonym for this style. + @style{wxRE_MULTILINE} + The control will be multiline (mandatory). + @style{wxRE_READONLY} + The control will not be editable. + @endStyleTable + + @library{wxrichtext} + @category{richtext} + @appearance{richtextctrl.png} + + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextCtrl : public wxControl, + public wxTextCtrlIface, + public wxScrollHelper +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextCtrl); + wxDECLARE_EVENT_TABLE(); + +public: +// Constructors + + /** + Default constructor. + */ + wxRichTextCtrl( ); + + /** + Constructor, creating and showing a rich text control. + + @param parent + Parent window. Must not be @NULL. + @param id + Window identifier. The value @c wxID_ANY indicates a default value. + @param value + Default string. + @param pos + Window position. + @param size + Window size. + @param style + Window style. + @param validator + Window validator. + @param name + Window name. + + @see Create(), wxValidator + */ + wxRichTextCtrl( wxWindow* parent, wxWindowID id = -1, const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = wxRE_MULTILINE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxTextCtrlNameStr)); + + /** + Destructor. + */ + virtual ~wxRichTextCtrl( ); + +// Operations + + /** + Creates the underlying window. + */ + bool Create( wxWindow* parent, wxWindowID id = -1, const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = wxRE_MULTILINE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxTextCtrlNameStr) ); + + /** + Initialises the members of the control. + */ + void Init(); + +// Accessors + + /** + Gets the text for the given range. + The end point of range is specified as the last character position of + the span of text, plus one. + */ + virtual wxString GetRange(long from, long to) const wxOVERRIDE; + + /** + Returns the length of the specified line in characters. + */ + virtual int GetLineLength(long lineNo) const wxOVERRIDE ; + + /** + Returns the text for the given line. + */ + virtual wxString GetLineText(long lineNo) const wxOVERRIDE ; + + /** + Returns the number of lines in the buffer. + */ + virtual int GetNumberOfLines() const wxOVERRIDE ; + + /** + Returns @true if the buffer has been modified. + */ + virtual bool IsModified() const wxOVERRIDE ; + + /** + Returns @true if the control is editable. + */ + virtual bool IsEditable() const wxOVERRIDE ; + + /** + Returns @true if the control is single-line. + Currently wxRichTextCtrl does not support single-line editing. + */ + bool IsSingleLine() const { return !HasFlag(wxRE_MULTILINE); } + + /** + Returns @true if the control is multiline. + */ + bool IsMultiLine() const { return !IsSingleLine(); } + + //@{ + /** + Returns the range of the current selection. + The end point of range is specified as the last character position of the span + of text, plus one. + If the return values @a from and @a to are the same, there is no selection. + */ + virtual void GetSelection(long* from, long* to) const wxOVERRIDE; + const wxRichTextSelection& GetSelection() const { return m_selection; } + wxRichTextSelection& GetSelection() { return m_selection; } + //@} + + /** + Returns the text within the current selection range, if any. + */ + virtual wxString GetStringSelection() const wxOVERRIDE; + + /** + Gets the current filename associated with the control. + */ + wxString GetFilename() const { return m_filename; } + + /** + Sets the current filename. + */ + void SetFilename(const wxString& filename) { m_filename = filename; } + + /** + Sets the size of the buffer beyond which layout is delayed during resizing. + This optimizes sizing for large buffers. The default is 20000. + */ + void SetDelayedLayoutThreshold(long threshold) { m_delayedLayoutThreshold = threshold; } + + /** + Gets the size of the buffer beyond which layout is delayed during resizing. + This optimizes sizing for large buffers. The default is 20000. + */ + long GetDelayedLayoutThreshold() const { return m_delayedLayoutThreshold; } + + /** + Gets the flag indicating that full layout is required. + */ + bool GetFullLayoutRequired() const { return m_fullLayoutRequired; } + + /** + Sets the flag indicating that full layout is required. + */ + void SetFullLayoutRequired(bool b) { m_fullLayoutRequired = b; } + + /** + Returns the last time full layout was performed. + */ + wxLongLong GetFullLayoutTime() const { return m_fullLayoutTime; } + + /** + Sets the last time full layout was performed. + */ + void SetFullLayoutTime(wxLongLong t) { m_fullLayoutTime = t; } + + /** + Returns the position that should be shown when full (delayed) layout is performed. + */ + long GetFullLayoutSavedPosition() const { return m_fullLayoutSavedPosition; } + + /** + Sets the position that should be shown when full (delayed) layout is performed. + */ + void SetFullLayoutSavedPosition(long p) { m_fullLayoutSavedPosition = p; } + + /** + Forces any pending layout due to delayed, partial layout when the control + was resized. + */ + void ForceDelayedLayout(); + + /** + Sets the text (normal) cursor. + */ + void SetTextCursor(const wxCursor& cursor ) { m_textCursor = cursor; } + + /** + Returns the text (normal) cursor. + */ + wxCursor GetTextCursor() const { return m_textCursor; } + + /** + Sets the cursor to be used over URLs. + */ + void SetURLCursor(const wxCursor& cursor ) { m_urlCursor = cursor; } + + /** + Returns the cursor to be used over URLs. + */ + wxCursor GetURLCursor() const { return m_urlCursor; } + + /** + Returns @true if we are showing the caret position at the start of a line + instead of at the end of the previous one. + */ + bool GetCaretAtLineStart() const { return m_caretAtLineStart; } + + /** + Sets a flag to remember that we are showing the caret position at the start of a line + instead of at the end of the previous one. + */ + void SetCaretAtLineStart(bool atStart) { m_caretAtLineStart = atStart; } + + /** + Returns @true if we are dragging a selection. + */ + bool GetDragging() const { return m_dragging; } + + /** + Sets a flag to remember if we are dragging a selection. + */ + void SetDragging(bool dragging) { m_dragging = dragging; } + +#if wxUSE_DRAG_AND_DROP + /** + Are we trying to start Drag'n'Drop? + */ + bool GetPreDrag() const { return m_preDrag; } + + /** + Set if we're trying to start Drag'n'Drop + */ + void SetPreDrag(bool pd) { m_preDrag = pd; } + + /** + Get the possible Drag'n'Drop start point + */ + const wxPoint GetDragStartPoint() const { return m_dragStartPoint; } + + /** + Set the possible Drag'n'Drop start point + */ + void SetDragStartPoint(wxPoint sp) { m_dragStartPoint = sp; } + +#if wxUSE_DATETIME + /** + Get the possible Drag'n'Drop start time + */ + const wxDateTime GetDragStartTime() const { return m_dragStartTime; } + + /** + Set the possible Drag'n'Drop start time + */ + void SetDragStartTime(wxDateTime st) { m_dragStartTime = st; } +#endif // wxUSE_DATETIME + +#endif // wxUSE_DRAG_AND_DROP + +#if wxRICHTEXT_BUFFERED_PAINTING + //@{ + /** + Returns the buffer bitmap if using buffered painting. + */ + const wxBitmap& GetBufferBitmap() const { return m_bufferBitmap; } + wxBitmap& GetBufferBitmap() { return m_bufferBitmap; } + //@} +#endif + + /** + Returns the current context menu. + */ + wxMenu* GetContextMenu() const { return m_contextMenu; } + + /** + Sets the current context menu. + */ + void SetContextMenu(wxMenu* menu); + + /** + Returns an anchor so we know how to extend the selection. + It's a caret position since it's between two characters. + */ + long GetSelectionAnchor() const { return m_selectionAnchor; } + + /** + Sets an anchor so we know how to extend the selection. + It's a caret position since it's between two characters. + */ + void SetSelectionAnchor(long anchor) { m_selectionAnchor = anchor; } + + /** + Returns the anchor object if selecting multiple containers. + */ + wxRichTextObject* GetSelectionAnchorObject() const { return m_selectionAnchorObject; } + + /** + Sets the anchor object if selecting multiple containers. + */ + void SetSelectionAnchorObject(wxRichTextObject* anchor) { m_selectionAnchorObject = anchor; } + + //@{ + /** + Returns an object that stores information about context menu property item(s), + in order to communicate between the context menu event handler and the code + that responds to it. The wxRichTextContextMenuPropertiesInfo stores one + item for each object that could respond to a property-editing event. If + objects are nested, several might be editable. + */ + wxRichTextContextMenuPropertiesInfo& GetContextMenuPropertiesInfo() { return m_contextMenuPropertiesInfo; } + const wxRichTextContextMenuPropertiesInfo& GetContextMenuPropertiesInfo() const { return m_contextMenuPropertiesInfo; } + //@} + + /** + Returns the wxRichTextObject object that currently has the editing focus. + If there are no composite objects, this will be the top-level buffer. + */ + wxRichTextParagraphLayoutBox* GetFocusObject() const { return m_focusObject; } + + /** + Sets m_focusObject without making any alterations. + */ + void StoreFocusObject(wxRichTextParagraphLayoutBox* obj) { m_focusObject = obj; } + + /** + Sets the wxRichTextObject object that currently has the editing focus. + */ + bool SetFocusObject(wxRichTextParagraphLayoutBox* obj, bool setCaretPosition = true); + +// Operations + + /** + Invalidates the whole buffer to trigger painting later. + */ + void Invalidate() { GetBuffer().Invalidate(wxRICHTEXT_ALL); } + + /** + Clears the buffer content, leaving a single empty paragraph. Cannot be undone. + */ + virtual void Clear() wxOVERRIDE; + + /** + Replaces the content in the specified range with the string specified by + @a value. + */ + virtual void Replace(long from, long to, const wxString& value) wxOVERRIDE; + + /** + Removes the content in the specified range. + */ + virtual void Remove(long from, long to) wxOVERRIDE; + +#ifdef DOXYGEN + /** + Loads content into the control's buffer using the given type. + + If the specified type is wxRICHTEXT_TYPE_ANY, the type is deduced from + the filename extension. + + This function looks for a suitable wxRichTextFileHandler object. + */ + bool LoadFile(const wxString& file, + int type = wxRICHTEXT_TYPE_ANY); +#endif + +#if wxUSE_FFILE && wxUSE_STREAMS + /** + Helper function for LoadFile(). Loads content into the control's buffer using the given type. + + If the specified type is wxRICHTEXT_TYPE_ANY, the type is deduced from + the filename extension. + + This function looks for a suitable wxRichTextFileHandler object. + */ + virtual bool DoLoadFile(const wxString& file, int fileType) wxOVERRIDE; +#endif // wxUSE_FFILE && wxUSE_STREAMS + +#ifdef DOXYGEN + /** + Saves the buffer content using the given type. + + If the specified type is wxRICHTEXT_TYPE_ANY, the type is deduced from + the filename extension. + + This function looks for a suitable wxRichTextFileHandler object. + */ + bool SaveFile(const wxString& file = wxEmptyString, + int type = wxRICHTEXT_TYPE_ANY); +#endif + +#if wxUSE_FFILE && wxUSE_STREAMS + /** + Helper function for SaveFile(). Saves the buffer content using the given type. + + If the specified type is wxRICHTEXT_TYPE_ANY, the type is deduced from + the filename extension. + + This function looks for a suitable wxRichTextFileHandler object. + */ + virtual bool DoSaveFile(const wxString& file = wxEmptyString, + int fileType = wxRICHTEXT_TYPE_ANY) wxOVERRIDE; +#endif // wxUSE_FFILE && wxUSE_STREAMS + + /** + Sets flags that change the behaviour of loading or saving. + + See the documentation for each handler class to see what flags are + relevant for each handler. + */ + void SetHandlerFlags(int flags) { GetBuffer().SetHandlerFlags(flags); } + + /** + Returns flags that change the behaviour of loading or saving. + See the documentation for each handler class to see what flags are + relevant for each handler. + */ + int GetHandlerFlags() const { return GetBuffer().GetHandlerFlags(); } + + /** + Marks the buffer as modified. + */ + virtual void MarkDirty() wxOVERRIDE; + + /** + Sets the buffer's modified status to @false, and clears the buffer's command + history. + */ + virtual void DiscardEdits() wxOVERRIDE; + + /** + Sets the maximum number of characters that may be entered in a single line + text control. For compatibility only; currently does nothing. + */ + virtual void SetMaxLength(unsigned long WXUNUSED(len)) wxOVERRIDE { } + + /** + Writes text at the current position. + */ + virtual void WriteText(const wxString& text) wxOVERRIDE; + + /** + Sets the insertion point to the end of the buffer and writes the text. + */ + virtual void AppendText(const wxString& text) wxOVERRIDE; + + //@{ + /** + Gets the attributes at the given position. + This function gets the combined style - that is, the style you see on the + screen as a result of combining base style, paragraph style and character + style attributes. + + To get the character or paragraph style alone, use GetUncombinedStyle(). + + @beginWxPerlOnly + In wxPerl this method is implemented as GetStyle(@a position) + returning a 2-element list (ok, attr). + @endWxPerlOnly + */ + virtual bool GetStyle(long position, wxTextAttr& style) wxOVERRIDE; + virtual bool GetStyle(long position, wxRichTextAttr& style); + virtual bool GetStyle(long position, wxRichTextAttr& style, wxRichTextParagraphLayoutBox* container); + //@} + + //@{ + /** + Sets the attributes for the given range. + The end point of range is specified as the last character position of the span + of text, plus one. + + So, for example, to set the style for a character at position 5, use the range + (5,6). + */ + virtual bool SetStyle(long start, long end, const wxTextAttr& style) wxOVERRIDE; + virtual bool SetStyle(long start, long end, const wxRichTextAttr& style); + virtual bool SetStyle(const wxRichTextRange& range, const wxTextAttr& style); + virtual bool SetStyle(const wxRichTextRange& range, const wxRichTextAttr& style); + //@} + + /** + Sets the attributes for a single object + */ + virtual void SetStyle(wxRichTextObject *obj, const wxRichTextAttr& textAttr, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); + + //@{ + /** + Gets the attributes common to the specified range. + Attributes that differ in value within the range will not be included + in @a style flags. + + @beginWxPerlOnly + In wxPerl this method is implemented as GetStyleForRange(@a position) + returning a 2-element list (ok, attr). + @endWxPerlOnly + */ + virtual bool GetStyleForRange(const wxRichTextRange& range, wxTextAttr& style); + virtual bool GetStyleForRange(const wxRichTextRange& range, wxRichTextAttr& style); + virtual bool GetStyleForRange(const wxRichTextRange& range, wxRichTextAttr& style, wxRichTextParagraphLayoutBox* container); + //@} + + /** + Sets the attributes for the given range, passing flags to determine how the + attributes are set. + + The end point of range is specified as the last character position of the span + of text, plus one. So, for example, to set the style for a character at + position 5, use the range (5,6). + + @a flags may contain a bit list of the following values: + - wxRICHTEXT_SETSTYLE_NONE: no style flag. + - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this operation should be + undoable. + - wxRICHTEXT_SETSTYLE_OPTIMIZE: specifies that the style should not be applied + if the combined style at this point is already the style in question. + - wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY: specifies that the style should only be + applied to paragraphs, and not the content. + This allows content styling to be preserved independently from that + of e.g. a named paragraph style. + - wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY: specifies that the style should only be + applied to characters, and not the paragraph. + This allows content styling to be preserved independently from that + of e.g. a named paragraph style. + - wxRICHTEXT_SETSTYLE_RESET: resets (clears) the existing style before applying + the new style. + - wxRICHTEXT_SETSTYLE_REMOVE: removes the specified style. Only the style flags + are used in this operation. + */ + virtual bool SetStyleEx(const wxRichTextRange& range, const wxRichTextAttr& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); + + //@{ + /** + Gets the attributes at the given position. + This function gets the @e uncombined style - that is, the attributes associated + with the paragraph or character content, and not necessarily the combined + attributes you see on the screen. + To get the combined attributes, use GetStyle(). + + If you specify (any) paragraph attribute in @e style's flags, this function + will fetch the paragraph attributes. + Otherwise, it will return the character attributes. + + @beginWxPerlOnly + In wxPerl this method is implemented as GetUncombinedStyle(@a position) + returning a 2-element list (ok, attr). + @endWxPerlOnly + */ + virtual bool GetUncombinedStyle(long position, wxRichTextAttr& style); + virtual bool GetUncombinedStyle(long position, wxRichTextAttr& style, wxRichTextParagraphLayoutBox* container); + //@} + + //@{ + /** + Sets the current default style, which can be used to change how subsequently + inserted text is displayed. + */ + virtual bool SetDefaultStyle(const wxTextAttr& style) wxOVERRIDE; + virtual bool SetDefaultStyle(const wxRichTextAttr& style); + //@} + + /** + Returns the current default style, which can be used to change how subsequently + inserted text is displayed. + */ + virtual const wxRichTextAttr& GetDefaultStyleEx() const; + + //virtual const wxTextAttr& GetDefaultStyle() const; + + //@{ + /** + Sets the list attributes for the given range, passing flags to determine how + the attributes are set. + + Either the style definition or the name of the style definition (in the current + sheet) can be passed. + @a flags is a bit list of the following: + - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable. + - wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from + @a startFrom, otherwise existing attributes are used. + - wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used + as the level for all paragraphs, otherwise the current indentation will be used. + + @see NumberList(), PromoteList(), ClearListStyle(). + */ + virtual bool SetListStyle(const wxRichTextRange& range, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); + virtual bool SetListStyle(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); + //@} + + /** + Clears the list style from the given range, clearing list-related attributes + and applying any named paragraph style associated with each paragraph. + + @a flags is a bit list of the following: + - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable. + + @see SetListStyle(), PromoteList(), NumberList(). + */ + virtual bool ClearListStyle(const wxRichTextRange& range, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); + + //@{ + /** + Numbers the paragraphs in the given range. + Pass flags to determine how the attributes are set. + + Either the style definition or the name of the style definition (in the current + sheet) can be passed. + + @a flags is a bit list of the following: + - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable. + - wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from + @a startFrom, otherwise existing attributes are used. + - wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used + as the level for all paragraphs, otherwise the current indentation will be used. + + @see SetListStyle(), PromoteList(), ClearListStyle(). + */ + virtual bool NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); + virtual bool NumberList(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); + //@} + + //@{ + /** + Promotes or demotes the paragraphs in the given range. + A positive @a promoteBy produces a smaller indent, and a negative number + produces a larger indent. Pass flags to determine how the attributes are set. + Either the style definition or the name of the style definition (in the current + sheet) can be passed. + + @a flags is a bit list of the following: + - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable. + - wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from + @a startFrom, otherwise existing attributes are used. + - wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used + as the level for all paragraphs, otherwise the current indentation will be used. + + @see SetListStyle(), @see SetListStyle(), ClearListStyle(). + */ + virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1); + virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1); + //@} + + /** + Sets the properties for the given range, passing flags to determine how the + attributes are set. You can merge properties or replace them. + + The end point of range is specified as the last character position of the span + of text, plus one. So, for example, to set the properties for a character at + position 5, use the range (5,6). + + @a flags may contain a bit list of the following values: + - wxRICHTEXT_SETSPROPERTIES_NONE: no flag. + - wxRICHTEXT_SETPROPERTIES_WITH_UNDO: specifies that this operation should be + undoable. + - wxRICHTEXT_SETPROPERTIES_PARAGRAPHS_ONLY: specifies that the properties should only be + applied to paragraphs, and not the content. + - wxRICHTEXT_SETPROPERTIES_CHARACTERS_ONLY: specifies that the properties should only be + applied to characters, and not the paragraph. + - wxRICHTEXT_SETPROPERTIES_RESET: resets (clears) the existing properties before applying + the new properties. + - wxRICHTEXT_SETPROPERTIES_REMOVE: removes the specified properties. + */ + virtual bool SetProperties(const wxRichTextRange& range, const wxRichTextProperties& properties, int flags = wxRICHTEXT_SETPROPERTIES_WITH_UNDO); + + /** + Deletes the content within the given range. + */ + virtual bool Delete(const wxRichTextRange& range); + + /** + Translates from column and line number to position. + */ + virtual long XYToPosition(long x, long y) const wxOVERRIDE; + + /** + Converts a text position to zero-based column and line numbers. + */ + virtual bool PositionToXY(long pos, long *x, long *y) const wxOVERRIDE; + + /** + Scrolls the buffer so that the given position is in view. + */ + virtual void ShowPosition(long pos) wxOVERRIDE; + + //@{ + /** + Finds the character at the given position in pixels. + @a pt is in device coords (not adjusted for the client area origin nor for + scrolling). + */ + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const wxOVERRIDE; + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, + wxTextCoord *col, + wxTextCoord *row) const wxOVERRIDE; + + /** + Finds the container at the given point, which is in screen coordinates. + */ + wxRichTextParagraphLayoutBox* FindContainerAtPoint(const wxPoint& pt, long& position, int& hit, wxRichTextObject* hitObj, int flags = 0); + //@} + +#if wxUSE_DRAG_AND_DROP + /** + Does the 'drop' of Drag'n'Drop. + */ + void OnDrop(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxDragResult def, wxDataObject* DataObj); +#endif + +// Clipboard operations + + /** + Copies the selected content (if any) to the clipboard. + */ + virtual void Copy() wxOVERRIDE; + + /** + Copies the selected content (if any) to the clipboard and deletes the selection. + This is undoable. + */ + virtual void Cut() wxOVERRIDE; + + /** + Pastes content from the clipboard to the buffer. + */ + virtual void Paste() wxOVERRIDE; + + /** + Deletes the content in the selection, if any. This is undoable. + */ + virtual void DeleteSelection(); + + /** + Returns @true if selected content can be copied to the clipboard. + */ + virtual bool CanCopy() const wxOVERRIDE; + + /** + Returns @true if selected content can be copied to the clipboard and deleted. + */ + virtual bool CanCut() const wxOVERRIDE; + + /** + Returns @true if the clipboard content can be pasted to the buffer. + */ + virtual bool CanPaste() const wxOVERRIDE; + + /** + Returns @true if selected content can be deleted. + */ + virtual bool CanDeleteSelection() const; + + /** + Undoes the command at the top of the command history, if there is one. + */ + virtual void Undo() wxOVERRIDE; + + /** + Redoes the current command. + */ + virtual void Redo() wxOVERRIDE; + + /** + Returns @true if there is a command in the command history that can be undone. + */ + virtual bool CanUndo() const wxOVERRIDE; + + /** + Returns @true if there is a command in the command history that can be redone. + */ + virtual bool CanRedo() const wxOVERRIDE; + + /** + Sets the insertion point and causes the current editing style to be taken from + the new position (unlike wxRichTextCtrl::SetCaretPosition). + */ + virtual void SetInsertionPoint(long pos) wxOVERRIDE; + + /** + Sets the insertion point to the end of the text control. + */ + virtual void SetInsertionPointEnd() wxOVERRIDE; + + /** + Returns the current insertion point. + */ + virtual long GetInsertionPoint() const wxOVERRIDE; + + /** + Returns the last position in the buffer. + */ + virtual wxTextPos GetLastPosition() const wxOVERRIDE; + + //@{ + /** + Sets the selection to the given range. + The end point of range is specified as the last character position of the span + of text, plus one. + + So, for example, to set the selection for a character at position 5, use the + range (5,6). + */ + virtual void SetSelection(long from, long to) wxOVERRIDE; + void SetSelection(const wxRichTextSelection& sel) { m_selection = sel; } + //@} + + /** + Makes the control editable, or not. + */ + virtual void SetEditable(bool editable) wxOVERRIDE; + + /** + Returns @true if there is a selection and the object containing the selection + was the same as the current focus object. + */ + virtual bool HasSelection() const; + + /** + Returns @true if there was a selection, whether or not the current focus object + is the same as the selection's container object. + */ + virtual bool HasUnfocusedSelection() const; + + //@{ + /** + Write a bitmap or image at the current insertion point. + Supply an optional type to use for internal and file storage of the raw data. + */ + virtual bool WriteImage(const wxImage& image, wxBitmapType bitmapType = wxBITMAP_TYPE_PNG, + const wxRichTextAttr& textAttr = wxRichTextAttr()); + + virtual bool WriteImage(const wxBitmap& bitmap, wxBitmapType bitmapType = wxBITMAP_TYPE_PNG, + const wxRichTextAttr& textAttr = wxRichTextAttr()); + //@} + + /** + Loads an image from a file and writes it at the current insertion point. + */ + virtual bool WriteImage(const wxString& filename, wxBitmapType bitmapType, + const wxRichTextAttr& textAttr = wxRichTextAttr()); + + /** + Writes an image block at the current insertion point. + */ + virtual bool WriteImage(const wxRichTextImageBlock& imageBlock, + const wxRichTextAttr& textAttr = wxRichTextAttr()); + + /** + Write a text box at the current insertion point, returning the text box. + You can then call SetFocusObject() to set the focus to the new object. + */ + virtual wxRichTextBox* WriteTextBox(const wxRichTextAttr& textAttr = wxRichTextAttr()); + + /** + Writes a field at the current insertion point. + + @param fieldType + The field type, matching an existing field type definition. + @param properties + Extra data for the field. + @param textAttr + Optional attributes. + + @see wxRichTextField, wxRichTextFieldType, wxRichTextFieldTypeStandard + */ + virtual wxRichTextField* WriteField(const wxString& fieldType, const wxRichTextProperties& properties, + const wxRichTextAttr& textAttr = wxRichTextAttr()); + + /** + Write a table at the current insertion point, returning the table. + You can then call SetFocusObject() to set the focus to the new object. + */ + virtual wxRichTextTable* WriteTable(int rows, int cols, const wxRichTextAttr& tableAttr = wxRichTextAttr(), const wxRichTextAttr& cellAttr = wxRichTextAttr()); + + /** + Inserts a new paragraph at the current insertion point. @see LineBreak(). + */ + virtual bool Newline(); + + /** + Inserts a line break at the current insertion point. + + A line break forces wrapping within a paragraph, and can be introduced by + using this function, by appending the wxChar value @b wxRichTextLineBreakChar + to text content, or by typing Shift-Return. + */ + virtual bool LineBreak(); + + /** + Sets the basic (overall) style. + + This is the style of the whole buffer before further styles are applied, + unlike the default style, which only affects the style currently being + applied (for example, setting the default style to bold will cause + subsequently inserted text to be bold). + */ + virtual void SetBasicStyle(const wxRichTextAttr& style) { GetBuffer().SetBasicStyle(style); } + + /** + Gets the basic (overall) style. + + This is the style of the whole buffer before further styles are applied, + unlike the default style, which only affects the style currently being + applied (for example, setting the default style to bold will cause + subsequently inserted text to be bold). + */ + virtual const wxRichTextAttr& GetBasicStyle() const { return GetBuffer().GetBasicStyle(); } + + /** + Begins applying a style. + */ + virtual bool BeginStyle(const wxRichTextAttr& style) { return GetBuffer().BeginStyle(style); } + + /** + Ends the current style. + */ + virtual bool EndStyle() { return GetBuffer().EndStyle(); } + + /** + Ends application of all styles in the current style stack. + */ + virtual bool EndAllStyles() { return GetBuffer().EndAllStyles(); } + + /** + Begins using bold. + */ + bool BeginBold() { return GetBuffer().BeginBold(); } + + /** + Ends using bold. + */ + bool EndBold() { return GetBuffer().EndBold(); } + + /** + Begins using italic. + */ + bool BeginItalic() { return GetBuffer().BeginItalic(); } + + /** + Ends using italic. + */ + bool EndItalic() { return GetBuffer().EndItalic(); } + + /** + Begins using underlining. + */ + bool BeginUnderline() { return GetBuffer().BeginUnderline(); } + + /** + End applying underlining. + */ + bool EndUnderline() { return GetBuffer().EndUnderline(); } + + /** + Begins using the given point size. + */ + bool BeginFontSize(int pointSize) { return GetBuffer().BeginFontSize(pointSize); } + + /** + Ends using a point size. + */ + bool EndFontSize() { return GetBuffer().EndFontSize(); } + + /** + Begins using this font. + */ + bool BeginFont(const wxFont& font) { return GetBuffer().BeginFont(font); } + + /** + Ends using a font. + */ + bool EndFont() { return GetBuffer().EndFont(); } + + /** + Begins using this colour. + */ + bool BeginTextColour(const wxColour& colour) { return GetBuffer().BeginTextColour(colour); } + + /** + Ends applying a text colour. + */ + bool EndTextColour() { return GetBuffer().EndTextColour(); } + + /** + Begins using alignment. + For alignment values, see wxTextAttr. + */ + bool BeginAlignment(wxTextAttrAlignment alignment) { return GetBuffer().BeginAlignment(alignment); } + + /** + Ends alignment. + */ + bool EndAlignment() { return GetBuffer().EndAlignment(); } + + /** + Begins applying a left indent and subindent in tenths of a millimetre. + The subindent is an offset from the left edge of the paragraph, and is + used for all but the first line in a paragraph. A positive value will + cause the first line to appear to the left of the subsequent lines, and + a negative value will cause the first line to be indented to the right + of the subsequent lines. + + wxRichTextBuffer uses indentation to render a bulleted item. The + content of the paragraph, including the first line, starts at the + @a leftIndent plus the @a leftSubIndent. + + @param leftIndent + The distance between the margin and the bullet. + @param leftSubIndent + The distance between the left edge of the bullet and the left edge + of the actual paragraph. + */ + bool BeginLeftIndent(int leftIndent, int leftSubIndent = 0) { return GetBuffer().BeginLeftIndent(leftIndent, leftSubIndent); } + + /** + Ends left indent. + */ + bool EndLeftIndent() { return GetBuffer().EndLeftIndent(); } + + /** + Begins a right indent, specified in tenths of a millimetre. + */ + bool BeginRightIndent(int rightIndent) { return GetBuffer().BeginRightIndent(rightIndent); } + + /** + Ends right indent. + */ + bool EndRightIndent() { return GetBuffer().EndRightIndent(); } + + /** + Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing + in tenths of a millimetre. + */ + bool BeginParagraphSpacing(int before, int after) { return GetBuffer().BeginParagraphSpacing(before, after); } + + /** + Ends paragraph spacing. + */ + bool EndParagraphSpacing() { return GetBuffer().EndParagraphSpacing(); } + + /** + Begins applying line spacing. @e spacing is a multiple, where 10 means + single-spacing, 15 means 1.5 spacing, and 20 means double spacing. + + The ::wxTextAttrLineSpacing constants are defined for convenience. + */ + bool BeginLineSpacing(int lineSpacing) { return GetBuffer().BeginLineSpacing(lineSpacing); } + + /** + Ends line spacing. + */ + bool EndLineSpacing() { return GetBuffer().EndLineSpacing(); } + + /** + Begins a numbered bullet. + + This call will be needed for each item in the list, and the + application should take care of incrementing the numbering. + + @a bulletNumber is a number, usually starting with 1. + @a leftIndent and @a leftSubIndent are values in tenths of a millimetre. + @a bulletStyle is a bitlist of the ::wxTextAttrBulletStyle values. + + wxRichTextBuffer uses indentation to render a bulleted item. + The left indent is the distance between the margin and the bullet. + The content of the paragraph, including the first line, starts + at leftMargin + leftSubIndent. + So the distance between the left edge of the bullet and the + left of the actual paragraph is leftSubIndent. + */ + bool BeginNumberedBullet(int bulletNumber, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_ARABIC|wxTEXT_ATTR_BULLET_STYLE_PERIOD) + { return GetBuffer().BeginNumberedBullet(bulletNumber, leftIndent, leftSubIndent, bulletStyle); } + + /** + Ends application of a numbered bullet. + */ + bool EndNumberedBullet() { return GetBuffer().EndNumberedBullet(); } + + /** + Begins applying a symbol bullet, using a character from the current font. + See BeginNumberedBullet() for an explanation of how indentation is used + to render the bulleted paragraph. + */ + bool BeginSymbolBullet(const wxString& symbol, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_SYMBOL) + { return GetBuffer().BeginSymbolBullet(symbol, leftIndent, leftSubIndent, bulletStyle); } + + /** + Ends applying a symbol bullet. + */ + bool EndSymbolBullet() { return GetBuffer().EndSymbolBullet(); } + + /** + Begins applying a symbol bullet. + */ + bool BeginStandardBullet(const wxString& bulletName, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_STANDARD) + { return GetBuffer().BeginStandardBullet(bulletName, leftIndent, leftSubIndent, bulletStyle); } + + /** + Begins applying a standard bullet. + */ + bool EndStandardBullet() { return GetBuffer().EndStandardBullet(); } + + /** + Begins using the named character style. + */ + bool BeginCharacterStyle(const wxString& characterStyle) { return GetBuffer().BeginCharacterStyle(characterStyle); } + + /** + Ends application of a named character style. + */ + bool EndCharacterStyle() { return GetBuffer().EndCharacterStyle(); } + + /** + Begins applying the named paragraph style. + */ + bool BeginParagraphStyle(const wxString& paragraphStyle) { return GetBuffer().BeginParagraphStyle(paragraphStyle); } + + /** + Ends application of a named paragraph style. + */ + bool EndParagraphStyle() { return GetBuffer().EndParagraphStyle(); } + + /** + Begins using a specified list style. + Optionally, you can also pass a level and a number. + */ + bool BeginListStyle(const wxString& listStyle, int level = 1, int number = 1) { return GetBuffer().BeginListStyle(listStyle, level, number); } + + /** + Ends using a specified list style. + */ + bool EndListStyle() { return GetBuffer().EndListStyle(); } + + /** + Begins applying wxTEXT_ATTR_URL to the content. + + Pass a URL and optionally, a character style to apply, since it is common + to mark a URL with a familiar style such as blue text with underlining. + */ + bool BeginURL(const wxString& url, const wxString& characterStyle = wxEmptyString) { return GetBuffer().BeginURL(url, characterStyle); } + + /** + Ends applying a URL. + */ + bool EndURL() { return GetBuffer().EndURL(); } + + /** + Sets the default style to the style under the cursor. + */ + bool SetDefaultStyleToCursorStyle(); + + /** + Cancels any selection. + */ + virtual void SelectNone() wxOVERRIDE; + + /** + Selects the word at the given character position. + */ + virtual bool SelectWord(long position); + + /** + Returns the selection range in character positions. -1, -1 means no selection. + + The range is in API convention, i.e. a single character selection is denoted + by (n, n+1) + */ + wxRichTextRange GetSelectionRange() const; + + /** + Sets the selection to the given range. + The end point of range is specified as the last character position of the span + of text, plus one. + + So, for example, to set the selection for a character at position 5, use the + range (5,6). + */ + void SetSelectionRange(const wxRichTextRange& range); + + /** + Returns the selection range in character positions. -2, -2 means no selection + -1, -1 means select everything. + The range is in internal format, i.e. a single character selection is denoted + by (n, n) + */ + wxRichTextRange GetInternalSelectionRange() const { return m_selection.GetRange(); } + + /** + Sets the selection range in character positions. -2, -2 means no selection + -1, -1 means select everything. + The range is in internal format, i.e. a single character selection is denoted + by (n, n) + */ + void SetInternalSelectionRange(const wxRichTextRange& range) { m_selection.Set(range, GetFocusObject()); } + + /** + Adds a new paragraph of text to the end of the buffer. + */ + virtual wxRichTextRange AddParagraph(const wxString& text); + + /** + Adds an image to the control's buffer. + */ + virtual wxRichTextRange AddImage(const wxImage& image); + + /** + Lays out the buffer, which must be done before certain operations, such as + setting the caret position. + This function should not normally be required by the application. + */ + virtual bool LayoutContent(bool onlyVisibleRect = false); + + /** + Implements layout. An application may override this to perform operations before or after layout. + */ + virtual void DoLayoutBuffer(wxRichTextBuffer& buffer, wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int flags); + + /** + Move the caret to the given character position. + + Please note that this does not update the current editing style + from the new position; to do that, call wxRichTextCtrl::SetInsertionPoint instead. + */ + virtual bool MoveCaret(long pos, bool showAtLineStart = false, wxRichTextParagraphLayoutBox* container = NULL); + + /** + Moves right. + */ + virtual bool MoveRight(int noPositions = 1, int flags = 0); + + /** + Moves left. + */ + virtual bool MoveLeft(int noPositions = 1, int flags = 0); + + /** + Moves to the start of the paragraph. + */ + virtual bool MoveUp(int noLines = 1, int flags = 0); + + /** + Moves the caret down. + */ + virtual bool MoveDown(int noLines = 1, int flags = 0); + + /** + Moves to the end of the line. + */ + virtual bool MoveToLineEnd(int flags = 0); + + /** + Moves to the start of the line. + */ + virtual bool MoveToLineStart(int flags = 0); + + /** + Moves to the end of the paragraph. + */ + virtual bool MoveToParagraphEnd(int flags = 0); + + /** + Moves to the start of the paragraph. + */ + virtual bool MoveToParagraphStart(int flags = 0); + + /** + Moves to the start of the buffer. + */ + virtual bool MoveHome(int flags = 0); + + /** + Moves to the end of the buffer. + */ + virtual bool MoveEnd(int flags = 0); + + /** + Moves one or more pages up. + */ + virtual bool PageUp(int noPages = 1, int flags = 0); + + /** + Moves one or more pages down. + */ + virtual bool PageDown(int noPages = 1, int flags = 0); + + /** + Moves a number of words to the left. + */ + virtual bool WordLeft(int noPages = 1, int flags = 0); + + /** + Move a number of words to the right. + */ + virtual bool WordRight(int noPages = 1, int flags = 0); + + //@{ + /** + Returns the buffer associated with the control. + */ + wxRichTextBuffer& GetBuffer() { return m_buffer; } + const wxRichTextBuffer& GetBuffer() const { return m_buffer; } + //@} + + /** + Starts batching undo history for commands. + */ + virtual bool BeginBatchUndo(const wxString& cmdName) { return m_buffer.BeginBatchUndo(cmdName); } + + /** + Ends batching undo command history. + */ + virtual bool EndBatchUndo() { return m_buffer.EndBatchUndo(); } + + /** + Returns @true if undo commands are being batched. + */ + virtual bool BatchingUndo() const { return m_buffer.BatchingUndo(); } + + /** + Starts suppressing undo history for commands. + */ + virtual bool BeginSuppressUndo() { return m_buffer.BeginSuppressUndo(); } + + /** + Ends suppressing undo command history. + */ + virtual bool EndSuppressUndo() { return m_buffer.EndSuppressUndo(); } + + /** + Returns @true if undo history suppression is on. + */ + virtual bool SuppressingUndo() const { return m_buffer.SuppressingUndo(); } + + /** + Test if this whole range has character attributes of the specified kind. + If any of the attributes are different within the range, the test fails. + + You can use this to implement, for example, bold button updating. + @a style must have flags indicating which attributes are of interest. + */ + virtual bool HasCharacterAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const + { + return GetFocusObject()->HasCharacterAttributes(range.ToInternal(), style); + } + + /** + Test if this whole range has paragraph attributes of the specified kind. + If any of the attributes are different within the range, the test fails. + You can use this to implement, for example, centering button updating. + @a style must have flags indicating which attributes are of interest. + */ + virtual bool HasParagraphAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const + { + return GetFocusObject()->HasParagraphAttributes(range.ToInternal(), style); + } + + /** + Returns @true if all of the selection, or the content at the caret position, is bold. + */ + virtual bool IsSelectionBold(); + + /** + Returns @true if all of the selection, or the content at the caret position, is italic. + */ + virtual bool IsSelectionItalics(); + + /** + Returns @true if all of the selection, or the content at the caret position, is underlined. + */ + virtual bool IsSelectionUnderlined(); + + /** + Returns @true if all of the selection, or the content at the current caret position, has the supplied wxTextAttrEffects flag(s). + */ + virtual bool DoesSelectionHaveTextEffectFlag(int flag); + + /** + Returns @true if all of the selection, or the content at the caret position, is aligned according to the specified flag. + */ + virtual bool IsSelectionAligned(wxTextAttrAlignment alignment); + + /** + Apples bold to the selection or default style (undoable). + */ + virtual bool ApplyBoldToSelection(); + + /** + Applies italic to the selection or default style (undoable). + */ + virtual bool ApplyItalicToSelection(); + + /** + Applies underline to the selection or default style (undoable). + */ + virtual bool ApplyUnderlineToSelection(); + + /** + Applies one or more wxTextAttrEffects flags to the selection (undoable). + If there is no selection, it is applied to the default style. + */ + virtual bool ApplyTextEffectToSelection(int flags); + + /** + Applies the given alignment to the selection or the default style (undoable). + For alignment values, see wxTextAttr. + */ + virtual bool ApplyAlignmentToSelection(wxTextAttrAlignment alignment); + + /** + Applies the style sheet to the buffer, matching paragraph styles in the sheet + against named styles in the buffer. + + This might be useful if the styles have changed. + If @a sheet is @NULL, the sheet set with SetStyleSheet() is used. + Currently this applies paragraph styles only. + */ + virtual bool ApplyStyle(wxRichTextStyleDefinition* def); + + /** + Sets the style sheet associated with the control. + A style sheet allows named character and paragraph styles to be applied. + */ + void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { GetBuffer().SetStyleSheet(styleSheet); } + + /** + Returns the style sheet associated with the control, if any. + A style sheet allows named character and paragraph styles to be applied. + */ + wxRichTextStyleSheet* GetStyleSheet() const { return GetBuffer().GetStyleSheet(); } + + /** + Push the style sheet to top of stack. + */ + bool PushStyleSheet(wxRichTextStyleSheet* styleSheet) { return GetBuffer().PushStyleSheet(styleSheet); } + + /** + Pops the style sheet from top of stack. + */ + wxRichTextStyleSheet* PopStyleSheet() { return GetBuffer().PopStyleSheet(); } + + /** + Applies the style sheet to the buffer, for example if the styles have changed. + */ + bool ApplyStyleSheet(wxRichTextStyleSheet* styleSheet = NULL); + + /** + Shows the given context menu, optionally adding appropriate property-editing commands for the current position in the object hierarchy. + */ + virtual bool ShowContextMenu(wxMenu* menu, const wxPoint& pt, bool addPropertyCommands = true); + + /** + Prepares the context menu, optionally adding appropriate property-editing commands. + Returns the number of property commands added. + */ + virtual int PrepareContextMenu(wxMenu* menu, const wxPoint& pt, bool addPropertyCommands = true); + + /** + Returns @true if we can edit the object's properties via a GUI. + */ + virtual bool CanEditProperties(wxRichTextObject* obj) const { return obj->CanEditProperties(); } + + /** + Edits the object's properties via a GUI. + */ + virtual bool EditProperties(wxRichTextObject* obj, wxWindow* parent) { return obj->EditProperties(parent, & GetBuffer()); } + + /** + Gets the object's properties menu label. + */ + virtual wxString GetPropertiesMenuLabel(wxRichTextObject* obj) { return obj->GetPropertiesMenuLabel(); } + + /** + Prepares the content just before insertion (or after buffer reset). Called by the same function in wxRichTextBuffer. + Currently is only called if undo mode is on. + */ + virtual void PrepareContent(wxRichTextParagraphLayoutBox& WXUNUSED(container)) {} + + /** + Can we delete this range? + Sends an event to the control. + */ + virtual bool CanDeleteRange(wxRichTextParagraphLayoutBox& container, const wxRichTextRange& range) const; + + /** + Can we insert content at this position? + Sends an event to the control. + */ + virtual bool CanInsertContent(wxRichTextParagraphLayoutBox& container, long pos) const; + + /** + Enable or disable the vertical scrollbar. + */ + virtual void EnableVerticalScrollbar(bool enable); + + /** + Returns @true if the vertical scrollbar is enabled. + */ + virtual bool GetVerticalScrollbarEnabled() const { return m_verticalScrollbarEnabled; } + + /** + Sets the scale factor for displaying fonts, for example for more comfortable + editing. + */ + void SetFontScale(double fontScale, bool refresh = false); + + /** + Returns the scale factor for displaying fonts, for example for more comfortable + editing. + */ + double GetFontScale() const { return GetBuffer().GetFontScale(); } + + /** + Sets the scale factor for displaying certain dimensions such as indentation and + inter-paragraph spacing. This can be useful when editing in a small control + where you still want legible text, but a minimum of wasted white space. + */ + void SetDimensionScale(double dimScale, bool refresh = false); + + /** + Returns the scale factor for displaying certain dimensions such as indentation + and inter-paragraph spacing. + */ + double GetDimensionScale() const { return GetBuffer().GetDimensionScale(); } + + /** + Sets an overall scale factor for displaying and editing the content. + */ + void SetScale(double scale, bool refresh = false); + + /** + Returns an overall scale factor for displaying and editing the content. + */ + double GetScale() const { return m_scale; } + + /** + Returns an unscaled point. + */ + wxPoint GetUnscaledPoint(const wxPoint& pt) const; + + /** + Returns a scaled point. + */ + wxPoint GetScaledPoint(const wxPoint& pt) const; + + /** + Returns an unscaled size. + */ + wxSize GetUnscaledSize(const wxSize& sz) const; + + /** + Returns a scaled size. + */ + wxSize GetScaledSize(const wxSize& sz) const; + + /** + Returns an unscaled rectangle. + */ + wxRect GetUnscaledRect(const wxRect& rect) const; + + /** + Returns a scaled rectangle. + */ + wxRect GetScaledRect(const wxRect& rect) const; + + /** + Returns @true if this control can use virtual attributes and virtual text. + The default is @false. + */ + bool GetVirtualAttributesEnabled() const { return m_useVirtualAttributes; } + + /** + Pass @true to let the control use virtual attributes. + The default is @false. + */ + void EnableVirtualAttributes(bool b) { m_useVirtualAttributes = b; } + +// Command handlers + + /** + Sends the event to the control. + */ + void Command(wxCommandEvent& event) wxOVERRIDE; + + /** + Loads the first dropped file. + */ + void OnDropFiles(wxDropFilesEvent& event); + + void OnCaptureLost(wxMouseCaptureLostEvent& event); + void OnSysColourChanged(wxSysColourChangedEvent& event); + + /** + Standard handler for the wxID_CUT command. + */ + void OnCut(wxCommandEvent& event); + + /** + Standard handler for the wxID_COPY command. + */ + void OnCopy(wxCommandEvent& event); + + /** + Standard handler for the wxID_PASTE command. + */ + void OnPaste(wxCommandEvent& event); + + /** + Standard handler for the wxID_UNDO command. + */ + void OnUndo(wxCommandEvent& event); + + /** + Standard handler for the wxID_REDO command. + */ + void OnRedo(wxCommandEvent& event); + + /** + Standard handler for the wxID_SELECTALL command. + */ + void OnSelectAll(wxCommandEvent& event); + + /** + Standard handler for property commands. + */ + void OnProperties(wxCommandEvent& event); + + /** + Standard handler for the wxID_CLEAR command. + */ + void OnClear(wxCommandEvent& event); + + /** + Standard update handler for the wxID_CUT command. + */ + void OnUpdateCut(wxUpdateUIEvent& event); + + /** + Standard update handler for the wxID_COPY command. + */ + void OnUpdateCopy(wxUpdateUIEvent& event); + + /** + Standard update handler for the wxID_PASTE command. + */ + void OnUpdatePaste(wxUpdateUIEvent& event); + + /** + Standard update handler for the wxID_UNDO command. + */ + void OnUpdateUndo(wxUpdateUIEvent& event); + + /** + Standard update handler for the wxID_REDO command. + */ + void OnUpdateRedo(wxUpdateUIEvent& event); + + /** + Standard update handler for the wxID_SELECTALL command. + */ + void OnUpdateSelectAll(wxUpdateUIEvent& event); + + /** + Standard update handler for property commands. + */ + + void OnUpdateProperties(wxUpdateUIEvent& event); + + /** + Standard update handler for the wxID_CLEAR command. + */ + void OnUpdateClear(wxUpdateUIEvent& event); + + /** + Shows a standard context menu with undo, redo, cut, copy, paste, clear, and + select all commands. + */ + void OnContextMenu(wxContextMenuEvent& event); + +// Event handlers + + // Painting + void OnPaint(wxPaintEvent& event); + void OnEraseBackground(wxEraseEvent& event); + + // Left-click + void OnLeftClick(wxMouseEvent& event); + + // Left-up + void OnLeftUp(wxMouseEvent& event); + + // Motion + void OnMoveMouse(wxMouseEvent& event); + + // Left-double-click + void OnLeftDClick(wxMouseEvent& event); + + // Middle-click + void OnMiddleClick(wxMouseEvent& event); + + // Right-click + void OnRightClick(wxMouseEvent& event); + + // Key press + void OnChar(wxKeyEvent& event); + + // Sizing + void OnSize(wxSizeEvent& event); + + // Setting/losing focus + void OnSetFocus(wxFocusEvent& event); + void OnKillFocus(wxFocusEvent& event); + + // Idle-time processing + void OnIdle(wxIdleEvent& event); + + // Scrolling + void OnScroll(wxScrollWinEvent& event); + + /** + Sets the font, and also the basic and default attributes + (see wxRichTextCtrl::SetDefaultStyle). + */ + virtual bool SetFont(const wxFont& font) wxOVERRIDE; + + /** + A helper function setting up scrollbars, for example after a resize. + */ + virtual void SetupScrollbars(bool atTop = false, bool fromOnPaint = false); + + /** + Helper function implementing keyboard navigation. + */ + virtual bool KeyboardNavigate(int keyCode, int flags); + + /** + Paints the background. + */ + virtual void PaintBackground(wxDC& dc); + + /** + Other user defined painting after everything else (i.e. all text) is painted. + + @since 2.9.1 + */ + virtual void PaintAboveContent(wxDC& WXUNUSED(dc)) {} + +#if wxRICHTEXT_BUFFERED_PAINTING + /** + Recreates the buffer bitmap if necessary. + */ + virtual bool RecreateBuffer(const wxSize& size = wxDefaultSize); +#endif + + // Write text + virtual void DoWriteText(const wxString& value, int flags = 0); + + // Should we inherit colours? + virtual bool ShouldInheritColours() const wxOVERRIDE { return false; } + + /** + Internal function to position the visible caret according to the current caret + position. + */ + virtual void PositionCaret(wxRichTextParagraphLayoutBox* container = NULL); + + /** + Helper function for extending the selection, returning @true if the selection + was changed. Selections are in caret positions. + */ + virtual bool ExtendSelection(long oldPosition, long newPosition, int flags); + + /** + Extends a table selection in the given direction. + */ + virtual bool ExtendCellSelection(wxRichTextTable* table, int noRowSteps, int noColSteps); + + /** + Starts selecting table cells. + */ + virtual bool StartCellSelection(wxRichTextTable* table, wxRichTextParagraphLayoutBox* newCell); + + /** + Scrolls @a position into view. This function takes a caret position. + */ + virtual bool ScrollIntoView(long position, int keyCode); + + /** + Refreshes the area affected by a selection change. + */ + bool RefreshForSelectionChange(const wxRichTextSelection& oldSelection, const wxRichTextSelection& newSelection); + + /** + Overrides standard refresh in order to provoke delayed image loading. + */ + virtual void Refresh( bool eraseBackground = true, + const wxRect *rect = (const wxRect *) NULL ) wxOVERRIDE; + + /** + Sets the caret position. + + The caret position is the character position just before the caret. + A value of -1 means the caret is at the start of the buffer. + Please note that this does not update the current editing style + from the new position or cause the actual caret to be refreshed; to do that, + call wxRichTextCtrl::SetInsertionPoint instead. + */ + void SetCaretPosition(long position, bool showAtLineStart = false) ; + + /** + Returns the current caret position. + */ + long GetCaretPosition() const { return m_caretPosition; } + + /** + The adjusted caret position is the character position adjusted to take + into account whether we're at the start of a paragraph, in which case + style information should be taken from the next position, not current one. + */ + long GetAdjustedCaretPosition(long caretPos) const; + + /** + Move the caret one visual step forward: this may mean setting a flag + and keeping the same position if we're going from the end of one line + to the start of the next, which may be the exact same caret position. + */ + void MoveCaretForward(long oldPosition) ; + + /** + Move the caret one visual step forward: this may mean setting a flag + and keeping the same position if we're going from the end of one line + to the start of the next, which may be the exact same caret position. + */ + void MoveCaretBack(long oldPosition) ; + + /** + Returns the caret height and position for the given character position. + If container is null, the current focus object will be used. + + @beginWxPerlOnly + In wxPerl this method is implemented as + GetCaretPositionForIndex(@a position) returning a + 2-element list (ok, rect). + @endWxPerlOnly + */ + bool GetCaretPositionForIndex(long position, wxRect& rect, wxRichTextParagraphLayoutBox* container = NULL); + + /** + Internal helper function returning the line for the visible caret position. + If the caret is shown at the very end of the line, it means the next character + is actually on the following line. + So this function gets the line we're expecting to find if this is the case. + */ + wxRichTextLine* GetVisibleLineForCaretPosition(long caretPosition) const; + + /** + Gets the command processor associated with the control's buffer. + */ + wxCommandProcessor* GetCommandProcessor() const { return GetBuffer().GetCommandProcessor(); } + + /** + Deletes content if there is a selection, e.g. when pressing a key. + Returns the new caret position in @e newPos, or leaves it if there + was no action. This is undoable. + + @beginWxPerlOnly + In wxPerl this method takes no arguments and returns a 2-element + list (ok, newPos). + @endWxPerlOnly + */ + virtual bool DeleteSelectedContent(long* newPos= NULL); + + /** + Transforms logical (unscrolled) position to physical window position. + */ + wxPoint GetPhysicalPoint(const wxPoint& ptLogical) const; + + /** + Transforms physical window position to logical (unscrolled) position. + */ + wxPoint GetLogicalPoint(const wxPoint& ptPhysical) const; + + /** + Helper function for finding the caret position for the next word. + Direction is 1 (forward) or -1 (backwards). + */ + virtual long FindNextWordPosition(int direction = 1) const; + + /** + Returns @true if the given position is visible on the screen. + */ + bool IsPositionVisible(long pos) const; + + /** + Returns the first visible position in the current view. + */ + long GetFirstVisiblePosition() const; + + /** + Returns the caret position since the default formatting was changed. As + soon as this position changes, we no longer reflect the default style + in the UI. A value of -2 means that we should only reflect the style of the + content under the caret. + */ + long GetCaretPositionForDefaultStyle() const { return m_caretPositionForDefaultStyle; } + + /** + Set the caret position for the default style that the user is selecting. + */ + void SetCaretPositionForDefaultStyle(long pos) { m_caretPositionForDefaultStyle = pos; } + + /** + Returns @true if the user has recently set the default style without moving + the caret, and therefore the UI needs to reflect the default style and not + the style at the caret. + + Below is an example of code that uses this function to determine whether the UI + should show that the current style is bold. + + @see SetAndShowDefaultStyle(). + */ + bool IsDefaultStyleShowing() const { return m_caretPositionForDefaultStyle != -2; } + + /** + Sets @a attr as the default style and tells the control that the UI should + reflect this attribute until the user moves the caret. + + @see IsDefaultStyleShowing(). + */ + void SetAndShowDefaultStyle(const wxRichTextAttr& attr) + { + SetDefaultStyle(attr); + SetCaretPositionForDefaultStyle(GetCaretPosition()); + } + + /** + Returns the first visible point in the window. + */ + wxPoint GetFirstVisiblePoint() const; + + /** + Enable or disable images + */ + + void EnableImages(bool b) { m_enableImages = b; } + + /** + Returns @true if images are enabled. + */ + + bool GetImagesEnabled() const { return m_enableImages; } + + /** + Enable or disable delayed image loading + */ + + void EnableDelayedImageLoading(bool b) { m_enableDelayedImageLoading = b; } + + /** + Returns @true if delayed image loading is enabled. + */ + + bool GetDelayedImageLoading() const { return m_enableDelayedImageLoading; } + + /** + Gets the flag indicating that delayed image processing is required. + */ + bool GetDelayedImageProcessingRequired() const { return m_delayedImageProcessingRequired; } + + /** + Sets the flag indicating that delayed image processing is required. + */ + void SetDelayedImageProcessingRequired(bool b) { m_delayedImageProcessingRequired = b; } + + /** + Returns the last time delayed image processing was performed. + */ + wxLongLong GetDelayedImageProcessingTime() const { return m_delayedImageProcessingTime; } + + /** + Sets the last time delayed image processing was performed. + */ + void SetDelayedImageProcessingTime(wxLongLong t) { m_delayedImageProcessingTime = t; } + +#ifdef DOXYGEN + /** + Returns the content of the entire control as a string. + */ + virtual wxString GetValue() const; + + /** + Replaces existing content with the given text. + */ + virtual void SetValue(const wxString& value); + + /** + Call this function to prevent refresh and allow fast updates, and then Thaw() to + refresh the control. + */ + void Freeze(); + + /** + Call this function to end a Freeze and refresh the display. + */ + void Thaw(); + + /** + Returns @true if Freeze has been called without a Thaw. + */ + bool IsFrozen() const; + +#endif + + /// Set the line increment height in pixels + void SetLineHeight(int height) { m_lineHeight = height; } + int GetLineHeight() const { return m_lineHeight; } + +// Implementation + + /** + Processes the back key. + */ + virtual bool ProcessBackKey(wxKeyEvent& event, int flags); + + /** + Given a character position at which there is a list style, find the range + encompassing the same list style by looking backwards and forwards. + */ + virtual wxRichTextRange FindRangeForList(long pos, bool& isNumberedList); + + /** + Sets up the caret for the given position and container, after a mouse click. + */ + bool SetCaretPositionAfterClick(wxRichTextParagraphLayoutBox* container, long position, int hitTestFlags, bool extendSelection = false); + + /** + Find the caret position for the combination of hit-test flags and character position. + Returns the caret position and also an indication of where to place the caret (caretLineStart) + since this is ambiguous (same position used for end of line and start of next). + */ + long FindCaretPositionForCharacterPosition(long position, int hitTestFlags, wxRichTextParagraphLayoutBox* container, + bool& caretLineStart); + + /** + Processes mouse movement in order to change the cursor + */ + virtual bool ProcessMouseMovement(wxRichTextParagraphLayoutBox* container, wxRichTextObject* obj, long position, const wxPoint& pos); + + /** + Font names take a long time to retrieve, so cache them (on demand). + */ + static const wxArrayString& GetAvailableFontNames(); + + /** + Clears the cache of available font names. + */ + static void ClearAvailableFontNames(); + + WX_FORWARD_TO_SCROLL_HELPER() + + // implement wxTextEntry methods + virtual wxString DoGetValue() const wxOVERRIDE; + + /** + Do delayed image loading and garbage-collect other images + */ + bool ProcessDelayedImageLoading(bool refresh); + bool ProcessDelayedImageLoading(const wxRect& screenRect, wxRichTextParagraphLayoutBox* box, int& loadCount); + + /** + Request delayed image processing. + */ + void RequestDelayedImageProcessing(); + + /** + Respond to timer events. + */ + void OnTimer(wxTimerEvent& event); + +protected: + // implement the wxTextEntry pure virtual method + virtual wxWindow *GetEditableWindow() wxOVERRIDE { return this; } + + // margins functions + virtual bool DoSetMargins(const wxPoint& pt) wxOVERRIDE; + virtual wxPoint DoGetMargins() const wxOVERRIDE; + + // FIXME: this does not work, it allows this code to compile but will fail + // during run-time +#ifndef __WXUNIVERSAL__ +#ifdef __WXMSW__ + virtual WXHWND GetEditHWND() const { return GetHWND(); } +#endif +#ifdef __WXMOTIF__ + virtual WXWidget GetTextWidget() const { return NULL; } +#endif +#ifdef __WXGTK20__ + virtual GtkEditable *GetEditable() const { return NULL; } + virtual GtkEntry *GetEntry() const { return NULL; } +#endif +#endif // !__WXUNIVERSAL__ + +// Overrides +protected: + + /** + Currently this simply returns @c wxSize(10, 10). + */ + virtual wxSize DoGetBestSize() const wxOVERRIDE ; + + virtual void DoSetValue(const wxString& value, int flags = 0) wxOVERRIDE; + + virtual void DoThaw() wxOVERRIDE; + + +// Data members +protected: +#if wxRICHTEXT_BUFFERED_PAINTING + /// Buffer bitmap + wxBitmap m_bufferBitmap; +#endif + + /// Text buffer + wxRichTextBuffer m_buffer; + + wxMenu* m_contextMenu; + + /// Caret position (1 less than the character position, so -1 is the + /// first caret position). + long m_caretPosition; + + /// Caret position when the default formatting has been changed. As + /// soon as this position changes, we no longer reflect the default style + /// in the UI. + long m_caretPositionForDefaultStyle; + + /// Selection range in character positions. -2, -2 means no selection. + wxRichTextSelection m_selection; + + wxRichTextCtrlSelectionState m_selectionState; + + /// Anchor so we know how to extend the selection + /// It's a caret position since it's between two characters. + long m_selectionAnchor; + + /// Anchor object if selecting multiple container objects, such as grid cells. + wxRichTextObject* m_selectionAnchorObject; + + /// Are we editable? + bool m_editable; + + /// Can we use virtual attributes and virtual text? + bool m_useVirtualAttributes; + + /// Is the vertical scrollbar enabled? + bool m_verticalScrollbarEnabled; + + /// Are we showing the caret position at the start of a line + /// instead of at the end of the previous one? + bool m_caretAtLineStart; + + /// Are we dragging (i.e. extending) a selection? + bool m_dragging; + +#if wxUSE_DRAG_AND_DROP + /// Are we trying to start Drag'n'Drop? + bool m_preDrag; + + /// Initial position when starting Drag'n'Drop + wxPoint m_dragStartPoint; + +#if wxUSE_DATETIME + /// Initial time when starting Drag'n'Drop + wxDateTime m_dragStartTime; +#endif // wxUSE_DATETIME +#endif // wxUSE_DRAG_AND_DROP + + /// Do we need full layout in idle? + bool m_fullLayoutRequired; + wxLongLong m_fullLayoutTime; + long m_fullLayoutSavedPosition; + + /// Threshold for doing delayed layout + long m_delayedLayoutThreshold; + + /// Cursors + wxCursor m_textCursor; + wxCursor m_urlCursor; + + static wxArrayString sm_availableFontNames; + + wxRichTextContextMenuPropertiesInfo m_contextMenuPropertiesInfo; + + /// The object that currently has the editing focus + wxRichTextParagraphLayoutBox* m_focusObject; + + /// An overall scale factor + double m_scale; + + /// Variables for scrollbar hysteresis detection + wxSize m_lastWindowSize; + int m_setupScrollbarsCount; + int m_setupScrollbarsCountInOnSize; + + /// Whether images are enabled for this control + bool m_enableImages; + + /// Line height in pixels + int m_lineHeight; + + /// Whether delayed image loading is enabled for this control + bool m_enableDelayedImageLoading; + bool m_delayedImageProcessingRequired; + wxLongLong m_delayedImageProcessingTime; + wxTimer m_delayedImageProcessingTimer; +}; + +#if wxUSE_DRAG_AND_DROP +class WXDLLIMPEXP_RICHTEXT wxRichTextDropSource : public wxDropSource +{ +public: + wxRichTextDropSource(wxDataObject& data, wxRichTextCtrl* tc) + : wxDropSource(data, tc), m_rtc(tc) {} + +protected: + bool GiveFeedback(wxDragResult effect) wxOVERRIDE; + + wxRichTextCtrl* m_rtc; +}; + +class WXDLLIMPEXP_RICHTEXT wxRichTextDropTarget : public wxDropTarget +{ +public: + wxRichTextDropTarget(wxRichTextCtrl* tc) + : wxDropTarget(new wxRichTextBufferDataObject(new wxRichTextBuffer)), m_rtc(tc) {} + + virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def) wxOVERRIDE + { + if ( !GetData() ) + return wxDragNone; + m_rtc->OnDrop(x, y, def, m_dataObject); + return def; + } + +protected: + wxRichTextCtrl* m_rtc; +}; +#endif // wxUSE_DRAG_AND_DROP + +/** + @class wxRichTextEvent + + This is the event class for wxRichTextCtrl notifications. + + @beginEventTable{wxRichTextEvent} + @event{EVT_RICHTEXT_LEFT_CLICK(id, func)} + Process a @c wxEVT_RICHTEXT_LEFT_CLICK event, generated when the user + releases the left mouse button over an object. + @event{EVT_RICHTEXT_RIGHT_CLICK(id, func)} + Process a @c wxEVT_RICHTEXT_RIGHT_CLICK event, generated when the user + releases the right mouse button over an object. + @event{EVT_RICHTEXT_MIDDLE_CLICK(id, func)} + Process a @c wxEVT_RICHTEXT_MIDDLE_CLICK event, generated when the user + releases the middle mouse button over an object. + @event{EVT_RICHTEXT_LEFT_DCLICK(id, func)} + Process a @c wxEVT_RICHTEXT_LEFT_DCLICK event, generated when the user + double-clicks an object. + @event{EVT_RICHTEXT_RETURN(id, func)} + Process a @c wxEVT_RICHTEXT_RETURN event, generated when the user + presses the return key. Valid event functions: GetFlags, GetPosition. + @event{EVT_RICHTEXT_CHARACTER(id, func)} + Process a @c wxEVT_RICHTEXT_CHARACTER event, generated when the user + presses a character key. Valid event functions: GetFlags, GetPosition, GetCharacter. + @event{EVT_RICHTEXT_CONSUMING_CHARACTER(id, func)} + Process a @c wxEVT_RICHTEXT_CONSUMING_CHARACTER event, generated when the user + presses a character key but before it is processed and inserted into the control. + Call Veto to prevent normal processing. Valid event functions: GetFlags, GetPosition, + GetCharacter, Veto. + @event{EVT_RICHTEXT_DELETE(id, func)} + Process a @c wxEVT_RICHTEXT_DELETE event, generated when the user + presses the backspace or delete key. Valid event functions: GetFlags, GetPosition. + @event{EVT_RICHTEXT_STYLE_CHANGED(id, func)} + Process a @c wxEVT_RICHTEXT_STYLE_CHANGED event, generated when + styling has been applied to the control. Valid event functions: GetPosition, GetRange. + @event{EVT_RICHTEXT_STYLESHEET_CHANGED(id, func)} + Process a @c wxEVT_RICHTEXT_STYLESHEET_CHANGING event, generated + when the control's stylesheet has changed, for example the user added, + edited or deleted a style. Valid event functions: GetRange, GetPosition. + @event{EVT_RICHTEXT_STYLESHEET_REPLACING(id, func)} + Process a @c wxEVT_RICHTEXT_STYLESHEET_REPLACING event, generated + when the control's stylesheet is about to be replaced, for example when + a file is loaded into the control. + Valid event functions: Veto, GetOldStyleSheet, GetNewStyleSheet. + @event{EVT_RICHTEXT_STYLESHEET_REPLACED(id, func)} + Process a @c wxEVT_RICHTEXT_STYLESHEET_REPLACED event, generated + when the control's stylesheet has been replaced, for example when a file + is loaded into the control. + Valid event functions: GetOldStyleSheet, GetNewStyleSheet. + @event{EVT_RICHTEXT_PROPERTIES_CHANGED(id, func)} + Process a @c wxEVT_RICHTEXT_PROPERTIES_CHANGED event, generated when + properties have been applied to the control. Valid event functions: GetPosition, GetRange. + @event{EVT_RICHTEXT_CONTENT_INSERTED(id, func)} + Process a @c wxEVT_RICHTEXT_CONTENT_INSERTED event, generated when + content has been inserted into the control. + Valid event functions: GetPosition, GetRange. + @event{EVT_RICHTEXT_CONTENT_DELETED(id, func)} + Process a @c wxEVT_RICHTEXT_CONTENT_DELETED event, generated when + content has been deleted from the control. + Valid event functions: GetPosition, GetRange. + @event{EVT_RICHTEXT_BUFFER_RESET(id, func)} + Process a @c wxEVT_RICHTEXT_BUFFER_RESET event, generated when the + buffer has been reset by deleting all content. + You can use this to set a default style for the first new paragraph. + @event{EVT_RICHTEXT_SELECTION_CHANGED(id, func)} + Process a @c wxEVT_RICHTEXT_SELECTION_CHANGED event, generated when the + selection range has changed. + @event{EVT_RICHTEXT_FOCUS_OBJECT_CHANGED(id, func)} + Process a @c wxEVT_RICHTEXT_FOCUS_OBJECT_CHANGED event, generated when the + current focus object has changed. + @endEventTable + + @library{wxrichtext} + @category{events,richtext} +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextEvent : public wxNotifyEvent +{ +public: + /** + Constructor. + + @param commandType + The type of the event. + @param id + Window identifier. The value @c wxID_ANY indicates a default value. + */ + wxRichTextEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) + : wxNotifyEvent(commandType, winid), + m_flags(0), m_position(-1), m_oldStyleSheet(NULL), m_newStyleSheet(NULL), + m_char((wxChar) 0), m_container(NULL), m_oldContainer(NULL) + { } + + /** + Copy constructor. + */ + wxRichTextEvent(const wxRichTextEvent& event) + : wxNotifyEvent(event), + m_flags(event.m_flags), m_position(-1), + m_oldStyleSheet(event.m_oldStyleSheet), m_newStyleSheet(event.m_newStyleSheet), + m_char((wxChar) 0), m_container(event.m_container), m_oldContainer(event.m_oldContainer) + { } + + /** + Returns the buffer position at which the event occurred. + */ + long GetPosition() const { return m_position; } + + /** + Sets the buffer position variable. + */ + void SetPosition(long pos) { m_position = pos; } + + /** + Returns flags indicating modifier keys pressed. + + Possible values are @c wxRICHTEXT_CTRL_DOWN, @c wxRICHTEXT_SHIFT_DOWN, and @c wxRICHTEXT_ALT_DOWN. + */ + int GetFlags() const { return m_flags; } + + /** + Sets flags indicating modifier keys pressed. + + Possible values are @c wxRICHTEXT_CTRL_DOWN, @c wxRICHTEXT_SHIFT_DOWN, and @c wxRICHTEXT_ALT_DOWN. + */ + void SetFlags(int flags) { m_flags = flags; } + + /** + Returns the old style sheet. + + Can be used in a @c wxEVT_RICHTEXT_STYLESHEET_CHANGING or + @c wxEVT_RICHTEXT_STYLESHEET_CHANGED event handler. + */ + wxRichTextStyleSheet* GetOldStyleSheet() const { return m_oldStyleSheet; } + + /** + Sets the old style sheet variable. + */ + void SetOldStyleSheet(wxRichTextStyleSheet* sheet) { m_oldStyleSheet = sheet; } + + /** + Returns the new style sheet. + + Can be used in a @c wxEVT_RICHTEXT_STYLESHEET_CHANGING or + @c wxEVT_RICHTEXT_STYLESHEET_CHANGED event handler. + */ + wxRichTextStyleSheet* GetNewStyleSheet() const { return m_newStyleSheet; } + + /** + Sets the new style sheet variable. + */ + void SetNewStyleSheet(wxRichTextStyleSheet* sheet) { m_newStyleSheet = sheet; } + + /** + Gets the range for the current operation. + */ + const wxRichTextRange& GetRange() const { return m_range; } + + /** + Sets the range variable. + */ + void SetRange(const wxRichTextRange& range) { m_range = range; } + + /** + Returns the character pressed, within a @c wxEVT_RICHTEXT_CHARACTER event. + */ + wxChar GetCharacter() const { return m_char; } + + /** + Sets the character variable. + */ + void SetCharacter(wxChar ch) { m_char = ch; } + + /** + Returns the container for which the event is relevant. + */ + wxRichTextParagraphLayoutBox* GetContainer() const { return m_container; } + + /** + Sets the container for which the event is relevant. + */ + void SetContainer(wxRichTextParagraphLayoutBox* container) { m_container = container; } + + /** + Returns the old container, for a focus change event. + */ + wxRichTextParagraphLayoutBox* GetOldContainer() const { return m_oldContainer; } + + /** + Sets the old container, for a focus change event. + */ + void SetOldContainer(wxRichTextParagraphLayoutBox* container) { m_oldContainer = container; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxRichTextEvent(*this); } + +protected: + int m_flags; + long m_position; + wxRichTextStyleSheet* m_oldStyleSheet; + wxRichTextStyleSheet* m_newStyleSheet; + wxRichTextRange m_range; + wxChar m_char; + wxRichTextParagraphLayoutBox* m_container; + wxRichTextParagraphLayoutBox* m_oldContainer; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxRichTextEvent); +}; + +/*! + * wxRichTextCtrl events + */ +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_LEFT_CLICK, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_RIGHT_CLICK, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_MIDDLE_CLICK, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_LEFT_DCLICK, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_RETURN, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_CHARACTER, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_CONSUMING_CHARACTER, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_DELETE, wxRichTextEvent ); + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_STYLESHEET_CHANGING, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_STYLESHEET_CHANGED, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_STYLESHEET_REPLACING, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_STYLESHEET_REPLACED, wxRichTextEvent ); + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_CONTENT_INSERTED, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_CONTENT_DELETED, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_STYLE_CHANGED, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_PROPERTIES_CHANGED, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_SELECTION_CHANGED, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_BUFFER_RESET, wxRichTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_RICHTEXT_FOCUS_OBJECT_CHANGED, wxRichTextEvent ); + +typedef void (wxEvtHandler::*wxRichTextEventFunction)(wxRichTextEvent&); + +#define wxRichTextEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxRichTextEventFunction, func) + +#define EVT_RICHTEXT_LEFT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_LEFT_CLICK, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_RIGHT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_RIGHT_CLICK, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_MIDDLE_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_MIDDLE_CLICK, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_LEFT_DCLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_LEFT_DCLICK, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_RETURN(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_RETURN, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_CHARACTER(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_CHARACTER, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_CONSUMING_CHARACTER(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_CONSUMING_CHARACTER, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_DELETE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_DELETE, id, -1, wxRichTextEventHandler( fn ), NULL ), + +#define EVT_RICHTEXT_STYLESHEET_CHANGING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_STYLESHEET_CHANGING, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_STYLESHEET_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_STYLESHEET_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_STYLESHEET_REPLACING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_STYLESHEET_REPLACING, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_STYLESHEET_REPLACED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_STYLESHEET_REPLACED, id, -1, wxRichTextEventHandler( fn ), NULL ), + +#define EVT_RICHTEXT_CONTENT_INSERTED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_CONTENT_INSERTED, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_CONTENT_DELETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_CONTENT_DELETED, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_STYLE_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_STYLE_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_PROPERTIES_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_PROPERTIES_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_SELECTION_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_SELECTION_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_BUFFER_RESET(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_BUFFER_RESET, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_FOCUS_OBJECT_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_FOCUS_OBJECT_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ), + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_RICHTEXT_LEFT_CLICK wxEVT_RICHTEXT_LEFT_CLICK +#define wxEVT_COMMAND_RICHTEXT_RIGHT_CLICK wxEVT_RICHTEXT_RIGHT_CLICK +#define wxEVT_COMMAND_RICHTEXT_MIDDLE_CLICK wxEVT_RICHTEXT_MIDDLE_CLICK +#define wxEVT_COMMAND_RICHTEXT_LEFT_DCLICK wxEVT_RICHTEXT_LEFT_DCLICK +#define wxEVT_COMMAND_RICHTEXT_RETURN wxEVT_RICHTEXT_RETURN +#define wxEVT_COMMAND_RICHTEXT_CHARACTER wxEVT_RICHTEXT_CHARACTER +#define wxEVT_COMMAND_RICHTEXT_DELETE wxEVT_RICHTEXT_DELETE +#define wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING wxEVT_RICHTEXT_STYLESHEET_CHANGING +#define wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED wxEVT_RICHTEXT_STYLESHEET_CHANGED +#define wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACING wxEVT_RICHTEXT_STYLESHEET_REPLACING +#define wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACED wxEVT_RICHTEXT_STYLESHEET_REPLACED +#define wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED wxEVT_RICHTEXT_CONTENT_INSERTED +#define wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED wxEVT_RICHTEXT_CONTENT_DELETED +#define wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED wxEVT_RICHTEXT_STYLE_CHANGED +#define wxEVT_COMMAND_RICHTEXT_PROPERTIES_CHANGED wxEVT_RICHTEXT_PROPERTIES_CHANGED +#define wxEVT_COMMAND_RICHTEXT_SELECTION_CHANGED wxEVT_RICHTEXT_SELECTION_CHANGED +#define wxEVT_COMMAND_RICHTEXT_BUFFER_RESET wxEVT_RICHTEXT_BUFFER_RESET +#define wxEVT_COMMAND_RICHTEXT_FOCUS_OBJECT_CHANGED wxEVT_RICHTEXT_FOCUS_OBJECT_CHANGED + +#endif + // wxUSE_RICHTEXT + +#endif + // _WX_RICHTEXTCTRL_H_ diff --git a/lib/wxWidgets/include/wx/richtext/richtextdialogpage.h b/lib/wxWidgets/include/wx/richtext/richtextdialogpage.h new file mode 100644 index 0000000..8caffca --- /dev/null +++ b/lib/wxWidgets/include/wx/richtext/richtextdialogpage.h @@ -0,0 +1,41 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextdialogpage.h +// Purpose: Formatting dialog page base class for wxRTC +// Author: Julian Smart +// Modified by: +// Created: 2010-11-14 +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RICHTEXTDIALOGPAGE_H_ +#define _WX_RICHTEXTDIALOGPAGE_H_ + +#if wxUSE_RICHTEXT + +#include "wx/panel.h" +#include "wx/richtext/richtextuicustomization.h" + +/** + @class wxRichTextDialogPage + The base class for formatting dialog pages. + **/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextDialogPage: public wxPanel +{ +public: + wxDECLARE_CLASS(wxRichTextDialogPage); + wxRichTextDialogPage() {} + wxRichTextDialogPage(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0) + { + Create(parent, id, pos, size, style); + } + + DECLARE_BASE_CLASS_HELP_PROVISION() +}; + +#endif + // wxUSE_RICHTEXT + +#endif + // _WX_RICHTEXTDIALOGPAGE_H_ diff --git a/lib/wxWidgets/include/wx/richtext/richtextfontpage.h b/lib/wxWidgets/include/wx/richtext/richtextfontpage.h new file mode 100644 index 0000000..f52ee19 --- /dev/null +++ b/lib/wxWidgets/include/wx/richtext/richtextfontpage.h @@ -0,0 +1,211 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextfontpage.h +// Purpose: Font page for wxRichTextFormattingDialog +// Author: Julian Smart +// Modified by: +// Created: 2006-10-02 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _RICHTEXTFONTPAGE_H_ +#define _RICHTEXTFONTPAGE_H_ + +/*! + * Includes + */ + +#include "wx/richtext/richtextdialogpage.h" + +////@begin includes +#include "wx/spinbutt.h" +////@end includes + +/*! + * Forward declarations + */ + +////@begin forward declarations +class wxBoxSizer; +class wxSpinButton; +class wxRichTextFontListBox; +class wxRichTextColourSwatchCtrl; +class wxRichTextFontPreviewCtrl; +////@end forward declarations + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define SYMBOL_WXRICHTEXTFONTPAGE_STYLE wxTAB_TRAVERSAL +#define SYMBOL_WXRICHTEXTFONTPAGE_TITLE wxEmptyString +#define SYMBOL_WXRICHTEXTFONTPAGE_IDNAME ID_RICHTEXTFONTPAGE +#define SYMBOL_WXRICHTEXTFONTPAGE_SIZE wxSize(200, 100) +#define SYMBOL_WXRICHTEXTFONTPAGE_POSITION wxDefaultPosition +////@end control identifiers + +/*! + * wxRichTextFontPage class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextFontPage: public wxRichTextDialogPage +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextFontPage); + wxDECLARE_EVENT_TABLE(); + DECLARE_HELP_PROVISION() + +public: + /// Constructors + wxRichTextFontPage( ); + wxRichTextFontPage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTFONTPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTFONTPAGE_SIZE, long style = SYMBOL_WXRICHTEXTFONTPAGE_STYLE ); + + /// Initialise members + void Init(); + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTFONTPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTFONTPAGE_SIZE, long style = SYMBOL_WXRICHTEXTFONTPAGE_STYLE ); + + /// Creates the controls and sizers + void CreateControls(); + + /// Transfer data from/to window + virtual bool TransferDataFromWindow() wxOVERRIDE; + virtual bool TransferDataToWindow() wxOVERRIDE; + + /// Updates the font preview + void UpdatePreview(); + + void OnFaceListBoxSelected( wxCommandEvent& event ); + void OnColourClicked( wxCommandEvent& event ); + + /// Gets the attributes associated with the main formatting dialog + wxRichTextAttr* GetAttributes(); + + /// Determines which text effect controls should be shown. + /// Currently only wxTEXT_ATTR_EFFECT_RTL and wxTEXT_ATTR_EFFECT_SUPPRESS_HYPHENATION may + /// be removed from the page. By default, these effects are not shown as they + /// have no effect in the editor. + static int GetAllowedTextEffects() { return sm_allowedTextEffects; } + + /// Sets the allowed text effects in the page. + static void SetAllowedTextEffects(int allowed) { sm_allowedTextEffects = allowed; } + +////@begin wxRichTextFontPage event handler declarations + + /// wxEVT_IDLE event handler for ID_RICHTEXTFONTPAGE + void OnIdle( wxIdleEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTFONTPAGE_FACETEXTCTRL + void OnFaceTextCtrlUpdated( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTFONTPAGE_SIZETEXTCTRL + void OnSizeTextCtrlUpdated( wxCommandEvent& event ); + + /// wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTFONTPAGE_SPINBUTTONS + void OnRichtextfontpageSpinbuttonsUp( wxSpinEvent& event ); + + /// wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTFONTPAGE_SPINBUTTONS + void OnRichtextfontpageSpinbuttonsDown( wxSpinEvent& event ); + + /// wxEVT_COMMAND_CHOICE_SELECTED event handler for ID_RICHTEXTFONTPAGE_SIZE_UNITS + void OnRichtextfontpageSizeUnitsSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_SIZELISTBOX + void OnSizeListBoxSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_STYLECTRL + void OnStyleCtrlSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_WEIGHTCTRL + void OnWeightCtrlSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_UNDERLINING_CTRL + void OnUnderliningCtrlSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_STRIKETHROUGHCTRL + void OnStrikethroughctrlClick( wxCommandEvent& event ); + + /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_CAPSCTRL + void OnCapsctrlClick( wxCommandEvent& event ); + + /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_SUPERSCRIPT + void OnRichtextfontpageSuperscriptClick( wxCommandEvent& event ); + + /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_SUBSCRIPT + void OnRichtextfontpageSubscriptClick( wxCommandEvent& event ); + +////@end wxRichTextFontPage event handler declarations + +////@begin wxRichTextFontPage member function declarations + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end wxRichTextFontPage member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + +////@begin wxRichTextFontPage member variables + wxBoxSizer* m_innerSizer; + wxTextCtrl* m_faceTextCtrl; + wxTextCtrl* m_sizeTextCtrl; + wxSpinButton* m_fontSizeSpinButtons; + wxChoice* m_sizeUnitsCtrl; + wxBoxSizer* m_fontListBoxParent; + wxRichTextFontListBox* m_faceListBox; + wxListBox* m_sizeListBox; + wxComboBox* m_styleCtrl; + wxComboBox* m_weightCtrl; + wxComboBox* m_underliningCtrl; + wxCheckBox* m_textColourLabel; + wxRichTextColourSwatchCtrl* m_colourCtrl; + wxCheckBox* m_bgColourLabel; + wxRichTextColourSwatchCtrl* m_bgColourCtrl; + wxCheckBox* m_strikethroughCtrl; + wxCheckBox* m_capitalsCtrl; + wxCheckBox* m_smallCapitalsCtrl; + wxCheckBox* m_superscriptCtrl; + wxCheckBox* m_subscriptCtrl; + wxBoxSizer* m_rtlParentSizer; + wxCheckBox* m_rtlCtrl; + wxCheckBox* m_suppressHyphenationCtrl; + wxRichTextFontPreviewCtrl* m_previewCtrl; + /// Control identifiers + enum { + ID_RICHTEXTFONTPAGE = 10000, + ID_RICHTEXTFONTPAGE_FACETEXTCTRL = 10001, + ID_RICHTEXTFONTPAGE_SIZETEXTCTRL = 10002, + ID_RICHTEXTFONTPAGE_SPINBUTTONS = 10003, + ID_RICHTEXTFONTPAGE_SIZE_UNITS = 10004, + ID_RICHTEXTFONTPAGE_FACELISTBOX = 10005, + ID_RICHTEXTFONTPAGE_SIZELISTBOX = 10006, + ID_RICHTEXTFONTPAGE_STYLECTRL = 10007, + ID_RICHTEXTFONTPAGE_WEIGHTCTRL = 10008, + ID_RICHTEXTFONTPAGE_UNDERLINING_CTRL = 10009, + ID_RICHTEXTFONTPAGE_COLOURCTRL_LABEL = 10010, + ID_RICHTEXTFONTPAGE_COLOURCTRL = 10011, + ID_RICHTEXTFONTPAGE_BGCOLOURCTRL_LABEL = 10012, + ID_RICHTEXTFONTPAGE_BGCOLOURCTRL = 10013, + ID_RICHTEXTFONTPAGE_STRIKETHROUGHCTRL = 10014, + ID_RICHTEXTFONTPAGE_CAPSCTRL = 10015, + ID_RICHTEXTFONTPAGE_SMALLCAPSCTRL = 10016, + ID_RICHTEXTFONTPAGE_SUPERSCRIPT = 10017, + ID_RICHTEXTFONTPAGE_SUBSCRIPT = 10018, + ID_RICHTEXTFONTPAGE_RIGHT_TO_LEFT = 10020, + ID_RICHTEXTFONTPAGE_SUBSCRIPT_SUPPRESS_HYPHENATION = 10021, + ID_RICHTEXTFONTPAGE_PREVIEWCTRL = 10019 + }; +////@end wxRichTextFontPage member variables + + bool m_dontUpdate; + bool m_colourPresent; + bool m_bgColourPresent; + static int sm_allowedTextEffects; +}; + +#endif + // _RICHTEXTFONTPAGE_H_ diff --git a/lib/wxWidgets/include/wx/richtext/richtextformatdlg.h b/lib/wxWidgets/include/wx/richtext/richtextformatdlg.h new file mode 100644 index 0000000..7256536 --- /dev/null +++ b/lib/wxWidgets/include/wx/richtext/richtextformatdlg.h @@ -0,0 +1,380 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextformatdlg.h +// Purpose: Formatting dialog for wxRichTextCtrl +// Author: Julian Smart +// Modified by: +// Created: 2006-10-01 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RICHTEXTFORMATDLG_H_ +#define _WX_RICHTEXTFORMATDLG_H_ + +/*! + * Includes + */ + +#include "wx/defs.h" + +#if wxUSE_RICHTEXT + +#include "wx/propdlg.h" +#include "wx/bookctrl.h" +#include "wx/withimages.h" +#include "wx/colourdata.h" + +#if wxUSE_HTML +#include "wx/htmllbox.h" +#endif + +#include "wx/richtext/richtextbuffer.h" +#include "wx/richtext/richtextstyles.h" +#include "wx/richtext/richtextuicustomization.h" + +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextFormattingDialog; +class WXDLLIMPEXP_FWD_CORE wxComboBox; +class WXDLLIMPEXP_FWD_CORE wxCheckBox; + +/*! + * Flags determining the pages and buttons to be created in the dialog + */ + +#define wxRICHTEXT_FORMAT_STYLE_EDITOR 0x0001 +#define wxRICHTEXT_FORMAT_FONT 0x0002 +#define wxRICHTEXT_FORMAT_TABS 0x0004 +#define wxRICHTEXT_FORMAT_BULLETS 0x0008 +#define wxRICHTEXT_FORMAT_INDENTS_SPACING 0x0010 +#define wxRICHTEXT_FORMAT_LIST_STYLE 0x0020 +#define wxRICHTEXT_FORMAT_MARGINS 0x0040 +#define wxRICHTEXT_FORMAT_SIZE 0x0080 +#define wxRICHTEXT_FORMAT_BORDERS 0x0100 +#define wxRICHTEXT_FORMAT_BACKGROUND 0x0200 + +#define wxRICHTEXT_FORMAT_HELP_BUTTON 0x1000 + +/*! + * Indices for bullet styles in list control + */ + +enum { + wxRICHTEXT_BULLETINDEX_NONE = 0, + wxRICHTEXT_BULLETINDEX_ARABIC, + wxRICHTEXT_BULLETINDEX_UPPER_CASE, + wxRICHTEXT_BULLETINDEX_LOWER_CASE, + wxRICHTEXT_BULLETINDEX_UPPER_CASE_ROMAN, + wxRICHTEXT_BULLETINDEX_LOWER_CASE_ROMAN, + wxRICHTEXT_BULLETINDEX_OUTLINE, + wxRICHTEXT_BULLETINDEX_SYMBOL, + wxRICHTEXT_BULLETINDEX_BITMAP, + wxRICHTEXT_BULLETINDEX_STANDARD +}; + +/*! + * Shorthand for common combinations of pages + */ + +#define wxRICHTEXT_FORMAT_PARAGRAPH (wxRICHTEXT_FORMAT_INDENTS_SPACING | wxRICHTEXT_FORMAT_BULLETS | wxRICHTEXT_FORMAT_TABS | wxRICHTEXT_FORMAT_FONT) +#define wxRICHTEXT_FORMAT_CHARACTER (wxRICHTEXT_FORMAT_FONT) +#define wxRICHTEXT_FORMAT_STYLE (wxRICHTEXT_FORMAT_PARAGRAPH | wxRICHTEXT_FORMAT_STYLE_EDITOR) + +/*! + * Factory for formatting dialog + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextFormattingDialogFactory: public wxObject +{ +public: + wxRichTextFormattingDialogFactory() {} + virtual ~wxRichTextFormattingDialogFactory() {} + +// Overridables + + /// Create all pages, under the dialog's book control, also calling AddPage + virtual bool CreatePages(long pages, wxRichTextFormattingDialog* dialog); + + /// Create a page, given a page identifier + virtual wxPanel* CreatePage(int page, wxString& title, wxRichTextFormattingDialog* dialog); + + /// Enumerate all available page identifiers + virtual int GetPageId(int i) const; + + /// Get the number of available page identifiers + virtual int GetPageIdCount() const; + + /// Get the image index for the given page identifier + virtual int GetPageImage(int WXUNUSED(id)) const { return -1; } + + /// Invoke help for the dialog + virtual bool ShowHelp(int page, wxRichTextFormattingDialog* dialog); + + /// Set the sheet style, called at the start of wxRichTextFormattingDialog::Create + virtual bool SetSheetStyle(wxRichTextFormattingDialog* dialog); + + /// Create the main dialog buttons + virtual bool CreateButtons(wxRichTextFormattingDialog* dialog); +}; + +/*! + * Formatting dialog for a wxRichTextCtrl + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextFormattingDialog: public wxPropertySheetDialog, + public wxWithImages +{ + wxDECLARE_CLASS(wxRichTextFormattingDialog); +DECLARE_HELP_PROVISION() + +public: + enum { Option_AllowPixelFontSize = 0x0001 }; + + wxRichTextFormattingDialog() { Init(); } + + wxRichTextFormattingDialog(long flags, wxWindow* parent, const wxString& title = wxGetTranslation(wxT("Formatting")), wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE) + { + Init(); + Create(flags, parent, title, id, pos, sz, style); + } + + ~wxRichTextFormattingDialog(); + + void Init(); + + bool Create(long flags, wxWindow* parent, const wxString& title = wxGetTranslation(wxT("Formatting")), wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE); + + /// Get attributes from the given range + virtual bool GetStyle(wxRichTextCtrl* ctrl, const wxRichTextRange& range); + + /// Set the attributes and optionally update the display + virtual bool SetStyle(const wxRichTextAttr& style, bool update = true); + + /// Set the style definition and optionally update the display + virtual bool SetStyleDefinition(const wxRichTextStyleDefinition& styleDef, wxRichTextStyleSheet* sheet, bool update = true); + + /// Get the style definition, if any + virtual wxRichTextStyleDefinition* GetStyleDefinition() const { return m_styleDefinition; } + + /// Get the style sheet, if any + virtual wxRichTextStyleSheet* GetStyleSheet() const { return m_styleSheet; } + + /// Update the display + virtual bool UpdateDisplay(); + + /// Apply attributes to the given range + virtual bool ApplyStyle(wxRichTextCtrl* ctrl, const wxRichTextRange& range, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_OPTIMIZE); + + /// Apply attributes to the object being edited, if any + virtual bool ApplyStyle(wxRichTextCtrl* ctrl, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); + + /// Gets and sets the attributes + const wxRichTextAttr& GetAttributes() const { return m_attributes; } + wxRichTextAttr& GetAttributes() { return m_attributes; } + void SetAttributes(const wxRichTextAttr& attr) { m_attributes = attr; } + + /// Sets the dialog options, determining what the interface presents to the user. + /// Currently the only option is Option_AllowPixelFontSize. + void SetOptions(int options) { m_options = options; } + + /// Gets the dialog options, determining what the interface presents to the user. + /// Currently the only option is Option_AllowPixelFontSize. + int GetOptions() const { return m_options; } + + /// Returns @true if the given option is present. + bool HasOption(int option) const { return (m_options & option) != 0; } + + /// If editing the attributes for a particular object, such as an image, + /// set the object so the code can initialize attributes such as size correctly. + wxRichTextObject* GetObject() const { return m_object; } + void SetObject(wxRichTextObject* obj) { m_object = obj; } + + /// Transfers the data and from to the window + virtual bool TransferDataToWindow() wxOVERRIDE; + virtual bool TransferDataFromWindow() wxOVERRIDE; + + /// Apply the styles when a different tab is selected, so the previews are + /// up to date + void OnTabChanged(wxBookCtrlEvent& event); + + /// Respond to help command + void OnHelp(wxCommandEvent& event); + void OnUpdateHelp(wxUpdateUIEvent& event); + + /// Get/set formatting factory object + static void SetFormattingDialogFactory(wxRichTextFormattingDialogFactory* factory); + static wxRichTextFormattingDialogFactory* GetFormattingDialogFactory() { return ms_FormattingDialogFactory; } + + /// Helper for pages to get the top-level dialog + static wxRichTextFormattingDialog* GetDialog(wxWindow* win); + + /// Helper for pages to get the attributes + static wxRichTextAttr* GetDialogAttributes(wxWindow* win); + + /// Helper for pages to get the reset attributes + static wxRichTextAttr* GetDialogResetAttributes(wxWindow* win); + + /// Helper for pages to get the style + static wxRichTextStyleDefinition* GetDialogStyleDefinition(wxWindow* win); + + /// Should we show tooltips? + static bool ShowToolTips() { return sm_showToolTips; } + + /// Determines whether tooltips will be shown + static void SetShowToolTips(bool show) { sm_showToolTips = show; } + + /// Set the dimension into the value and units controls. Optionally pass units to + /// specify the ordering of units in the combobox. + static void SetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl, wxCheckBox* checkBox, wxArrayInt* units = NULL); + + /// Get the dimension from the value and units controls Optionally pass units to + /// specify the ordering of units in the combobox. + static void GetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl, wxCheckBox* checkBox, wxArrayInt* units = NULL); + + /// Convert from a string to a dimension integer. + static bool ConvertFromString(const wxString& str, int& ret, int unit); + + /// Map book control page index to our page id + void AddPageId(int id) { m_pageIds.Add(id); } + + /// Find a page by class + wxWindow* FindPage(wxClassInfo* info) const; + + /// Whether to restore the last-selected page. + static bool GetRestoreLastPage() { return sm_restoreLastPage; } + static void SetRestoreLastPage(bool b) { sm_restoreLastPage = b; } + + /// The page identifier of the last page selected (not the control id) + static int GetLastPage() { return sm_lastPage; } + static void SetLastPage(int lastPage) { sm_lastPage = lastPage; } + + /// Sets the custom colour data for use by the colour dialog. + static void SetColourData(const wxColourData& colourData) { sm_colourData = colourData; } + + /// Returns the custom colour data for use by the colour dialog. + static wxColourData GetColourData() { return sm_colourData; } + +protected: + + wxRichTextAttr m_attributes; + wxRichTextStyleDefinition* m_styleDefinition; + wxRichTextStyleSheet* m_styleSheet; + wxRichTextObject* m_object; + wxArrayInt m_pageIds; // mapping of book control indexes to page ids + int m_options; // UI options + bool m_ignoreUpdates; + static wxColourData sm_colourData; + + static wxRichTextFormattingDialogFactory* ms_FormattingDialogFactory; + static bool sm_showToolTips; + + static bool sm_restoreLastPage; + static int sm_lastPage; + + wxDECLARE_EVENT_TABLE(); +}; + +//----------------------------------------------------------------------------- +// helper class - wxRichTextFontPreviewCtrl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_RICHTEXT wxRichTextFontPreviewCtrl : public wxWindow +{ +public: + wxRichTextFontPreviewCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize, long style = 0); + + void SetTextEffects(int effects) { m_textEffects = effects; } + int GetTextEffects() const { return m_textEffects; } + +private: + int m_textEffects; + + void OnPaint(wxPaintEvent& event); + wxDECLARE_EVENT_TABLE(); +}; + +/* + * A control for displaying a small preview of a colour or bitmap + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextColourSwatchCtrl: public wxControl +{ + wxDECLARE_CLASS(wxRichTextColourSwatchCtrl); +public: + wxRichTextColourSwatchCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0); + ~wxRichTextColourSwatchCtrl(); + + void OnMouseEvent(wxMouseEvent& event); + + void SetColour(const wxColour& colour) { m_colour = colour; SetBackgroundColour(m_colour); } + + wxColour& GetColour() { return m_colour; } + + virtual wxSize DoGetBestSize() const wxOVERRIDE { return GetSize(); } + +protected: + wxColour m_colour; + + wxDECLARE_EVENT_TABLE(); +}; + +/*! + * wxRichTextFontListBox class declaration + * A listbox to display fonts. + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextFontListBox: public wxHtmlListBox +{ + wxDECLARE_CLASS(wxRichTextFontListBox); + wxDECLARE_EVENT_TABLE(); + +public: + wxRichTextFontListBox() + { + Init(); + } + wxRichTextFontListBox(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0); + virtual ~wxRichTextFontListBox(); + + void Init() + { + } + + bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0); + + /// Creates a suitable HTML fragment for a font + wxString CreateHTML(const wxString& facename) const; + + /// Get font name for index + wxString GetFaceName(size_t i) const ; + + /// Set selection for string, returning the index. + int SetFaceNameSelection(const wxString& name); + + /// Updates the font list + void UpdateFonts(); + + /// Does this face name exist? + bool HasFaceName(const wxString& faceName) const { return m_faceNames.Index(faceName) != wxNOT_FOUND; } + + /// Returns the array of face names + const wxArrayString& GetFaceNames() const { return m_faceNames; } + +protected: + /// Returns the HTML for this item + virtual wxString OnGetItem(size_t n) const wxOVERRIDE; + +private: + + wxArrayString m_faceNames; +}; + +#endif + // wxUSE_RICHTEXT + +#endif + // _WX_RICHTEXTFORMATDLG_H_ diff --git a/lib/wxWidgets/include/wx/richtext/richtexthtml.h b/lib/wxWidgets/include/wx/richtext/richtexthtml.h new file mode 100644 index 0000000..1db619b --- /dev/null +++ b/lib/wxWidgets/include/wx/richtext/richtexthtml.h @@ -0,0 +1,147 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtexthtml.h +// Purpose: HTML I/O for wxRichTextCtrl +// Author: Julian Smart +// Modified by: +// Created: 2005-09-30 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RICHTEXTHTML_H_ +#define _WX_RICHTEXTHTML_H_ + +/*! + * Includes + */ + +#include "wx/richtext/richtextbuffer.h" + +// Use CSS styles where applicable, otherwise use non-CSS workarounds +#define wxRICHTEXT_HANDLER_USE_CSS 0x1000 + +/*! + * wxRichTextHTMLHandler + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextHTMLHandler: public wxRichTextFileHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextHTMLHandler); +public: + wxRichTextHTMLHandler(const wxString& name = wxT("HTML"), const wxString& ext = wxT("html"), int type = wxRICHTEXT_TYPE_HTML); + + /// Can we save using this handler? + virtual bool CanSave() const wxOVERRIDE { return true; } + + /// Can we load using this handler? + virtual bool CanLoad() const wxOVERRIDE { return false; } + + /// Can we handle this filename (if using files)? By default, checks the extension. + virtual bool CanHandle(const wxString& filename) const wxOVERRIDE; + +// Accessors and operations unique to this handler + + /// Set and get the list of image locations generated by the last operation + void SetTemporaryImageLocations(const wxArrayString& locations) { m_imageLocations = locations; } + const wxArrayString& GetTemporaryImageLocations() const { return m_imageLocations; } + + /// Clear the image locations generated by the last operation + void ClearTemporaryImageLocations() { m_imageLocations.Clear(); } + + /// Delete the in-memory or temporary files generated by the last operation + bool DeleteTemporaryImages(); + + /// Delete the in-memory or temporary files generated by the last operation. This is a static + /// function that can be used to delete the saved locations from an earlier operation, + /// for example after the user has viewed the HTML file. + static bool DeleteTemporaryImages(int flags, const wxArrayString& imageLocations); + + /// Reset the file counter, in case, for example, the same names are required each time + static void SetFileCounter(int counter) { sm_fileCounter = counter; } + + /// Set and get the directory for storing temporary files. If empty, the system + /// temporary directory will be used. + void SetTempDir(const wxString& tempDir) { m_tempDir = tempDir; } + const wxString& GetTempDir() const { return m_tempDir; } + + /// Set and get mapping from point size to HTML font size. There should be 7 elements, + /// one for each HTML font size, each element specifying the maximum point size for that + /// HTML font size. E.g. 8, 10, 13, 17, 22, 29, 100 + void SetFontSizeMapping(const wxArrayInt& fontSizeMapping) { m_fontSizeMapping = fontSizeMapping; } + wxArrayInt GetFontSizeMapping() const { return m_fontSizeMapping; } + +protected: + +// Implementation + +#if wxUSE_STREAMS + virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream) wxOVERRIDE; + virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream) wxOVERRIDE; + + /// Output character formatting + void BeginCharacterFormatting(const wxRichTextAttr& currentStyle, const wxRichTextAttr& thisStyle, const wxRichTextAttr& paraStyle, wxTextOutputStream& stream ); + void EndCharacterFormatting(const wxRichTextAttr& currentStyle, const wxRichTextAttr& thisStyle, const wxRichTextAttr& paraStyle, wxTextOutputStream& stream ); + + /// Output paragraph formatting + void BeginParagraphFormatting(const wxRichTextAttr& currentStyle, const wxRichTextAttr& thisStyle, wxTextOutputStream& stream); + void EndParagraphFormatting(const wxRichTextAttr& currentStyle, const wxRichTextAttr& thisStyle, wxTextOutputStream& stream); + + /// Output font tag + void OutputFont(const wxRichTextAttr& style, wxTextOutputStream& stream); + + /// Closes lists to level (-1 means close all) + void CloseLists(int level, wxTextOutputStream& str); + + /// Writes an image to its base64 equivalent, or to the memory filesystem, or to a file + void WriteImage(wxRichTextImage* image, wxOutputStream& stream); + + /// Converts from pt to size property compatible height + long PtToSize(long size); + + /// Typical base64 encoder + wxChar* b64enc(unsigned char* input, size_t in_len); + + /// Gets the mime type of the given wxBITMAP_TYPE + const wxChar* GetMimeType(int imageType); + + /// Gets the html equivalent of the specified value + wxString GetAlignment(const wxRichTextAttr& thisStyle); + + /// Generates   array for indentations + wxString SymbolicIndent(long indent); + + /// Finds the html equivalent of the specified bullet + int TypeOfList(const wxRichTextAttr& thisStyle, wxString& tag); +#endif + +// Data members + + wxRichTextBuffer* m_buffer; + + /// Indentation values of the table tags + wxArrayInt m_indents; + + /// Stack of list types: 0 = ol, 1 = ul + wxArrayInt m_listTypes; + + /// Is there any opened font tag? + bool m_font; + + /// Are we in a table? + bool m_inTable; + + /// A list of the image files or in-memory images created by the last operation. + wxArrayString m_imageLocations; + + /// A location for the temporary files + wxString m_tempDir; + + /// A mapping from point size to HTML font size + wxArrayInt m_fontSizeMapping; + + /// A counter for generating filenames + static int sm_fileCounter; +}; + +#endif + // _WX_RICHTEXTXML_H_ diff --git a/lib/wxWidgets/include/wx/richtext/richtextimagedlg.h b/lib/wxWidgets/include/wx/richtext/richtextimagedlg.h new file mode 100644 index 0000000..bc29b18 --- /dev/null +++ b/lib/wxWidgets/include/wx/richtext/richtextimagedlg.h @@ -0,0 +1,93 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextimagedlg.h +// Purpose: A dialog for editing image properties. +// Author: Mingquan Yang +// Modified by: Julian Smart +// Created: Wed 02 Jun 2010 11:27:23 CST +// Copyright: (c) Mingquan Yang, Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include "wx/dialog.h" + +#ifndef _RICHTEXTIMAGEDLG_H_ +#define _RICHTEXTIMAGEDLG_H_ + +/*! + * Forward declarations + */ + +class WXDLLIMPEXP_FWD_CORE wxButton; +class WXDLLIMPEXP_FWD_CORE wxComboBox; +class WXDLLIMPEXP_FWD_CORE wxCheckBox; +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; + +/*! + * Includes + */ + +#include "wx/richtext/richtextbuffer.h" +#include "wx/richtext/richtextformatdlg.h" + +/*! + * Control identifiers + */ + +#define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxTAB_TRAVERSAL +#define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_TITLE wxGetTranslation("Object Properties") +#define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_IDNAME ID_RICHTEXTOBJECTPROPERTIESDIALOG +#define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_SIZE wxSize(400, 300) +#define SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_POSITION wxDefaultPosition + +/*! + * wxRichTextObjectPropertiesDialog class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextObjectPropertiesDialog: public wxRichTextFormattingDialog +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextObjectPropertiesDialog); + wxDECLARE_EVENT_TABLE(); + +public: + /// Constructors + wxRichTextObjectPropertiesDialog(); + wxRichTextObjectPropertiesDialog( wxRichTextObject* obj, wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_IDNAME, const wxString& caption = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_SIZE, long style = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_STYLE ); + + /// Creation + bool Create( wxRichTextObject* obj, wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_IDNAME, const wxString& caption = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_SIZE, long style = SYMBOL_WXRICHTEXTOBJECTPROPERTIESDIALOG_STYLE ); + + /// Destructor + ~wxRichTextObjectPropertiesDialog(); + + /// Initialises member variables + void Init(); + + /// Creates the controls and sizers + void CreateControls(); + +////@begin wxRichTextObjectPropertiesDialog event handler declarations + +////@end wxRichTextObjectPropertiesDialog event handler declarations + +////@begin wxRichTextObjectPropertiesDialog member function declarations + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end wxRichTextObjectPropertiesDialog member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + +////@begin wxRichTextObjectPropertiesDialog member variables + /// Control identifiers + enum { + ID_RICHTEXTOBJECTPROPERTIESDIALOG = 10650 + }; +////@end wxRichTextObjectPropertiesDialog member variables +}; + +#endif + // _RICHTEXTIMAGEDLG_H_ diff --git a/lib/wxWidgets/include/wx/richtext/richtextindentspage.h b/lib/wxWidgets/include/wx/richtext/richtextindentspage.h new file mode 100644 index 0000000..8d6bc0e --- /dev/null +++ b/lib/wxWidgets/include/wx/richtext/richtextindentspage.h @@ -0,0 +1,169 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextindentspage.h +// Purpose: Declares the rich text formatting dialog indent page. +// Author: Julian Smart +// Modified by: +// Created: 10/3/2006 2:28:21 PM +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _RICHTEXTINDENTSPAGE_H_ +#define _RICHTEXTINDENTSPAGE_H_ + +/*! + * Includes + */ + +#include "wx/richtext/richtextdialogpage.h" + +////@begin includes +#include "wx/statline.h" +////@end includes + +/*! + * Forward declarations + */ + +////@begin forward declarations +class wxRichTextCtrl; +////@end forward declarations + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL +#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_TITLE wxEmptyString +#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_IDNAME ID_RICHTEXTINDENTSSPACINGPAGE +#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_SIZE wxSize(400, 300) +#define SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_POSITION wxDefaultPosition +////@end control identifiers + +/*! + * wxRichTextIndentsSpacingPage class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextIndentsSpacingPage: public wxRichTextDialogPage +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextIndentsSpacingPage); + wxDECLARE_EVENT_TABLE(); + DECLARE_HELP_PROVISION() + +public: + /// Constructors + wxRichTextIndentsSpacingPage( ); + wxRichTextIndentsSpacingPage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_SIZE, long style = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_STYLE ); + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_SIZE, long style = SYMBOL_WXRICHTEXTINDENTSSPACINGPAGE_STYLE ); + + /// Initialise members + void Init(); + + /// Creates the controls and sizers + void CreateControls(); + + /// Transfer data from/to window + virtual bool TransferDataFromWindow() wxOVERRIDE; + virtual bool TransferDataToWindow() wxOVERRIDE; + + /// Updates the paragraph preview + void UpdatePreview(); + + /// Gets the attributes associated with the main formatting dialog + wxRichTextAttr* GetAttributes(); + +////@begin wxRichTextIndentsSpacingPage event handler declarations + + /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_LEFT + void OnAlignmentLeftSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_RIGHT + void OnAlignmentRightSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_JUSTIFIED + void OnAlignmentJustifiedSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_CENTRED + void OnAlignmentCentredSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_INDETERMINATE + void OnAlignmentIndeterminateSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT + void OnIndentLeftUpdated( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT_FIRST + void OnIndentLeftFirstUpdated( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT + void OnIndentRightUpdated( wxCommandEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_OUTLINELEVEL + void OnRichtextOutlinelevelSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE + void OnSpacingBeforeUpdated( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER + void OnSpacingAfterUpdated( wxCommandEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_LINE + void OnSpacingLineSelected( wxCommandEvent& event ); + +////@end wxRichTextIndentsSpacingPage event handler declarations + +////@begin wxRichTextIndentsSpacingPage member function declarations + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end wxRichTextIndentsSpacingPage member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + +////@begin wxRichTextIndentsSpacingPage member variables + wxRadioButton* m_alignmentLeft; + wxRadioButton* m_alignmentRight; + wxRadioButton* m_alignmentJustified; + wxRadioButton* m_alignmentCentred; + wxRadioButton* m_alignmentIndeterminate; + wxTextCtrl* m_indentLeft; + wxTextCtrl* m_indentLeftFirst; + wxTextCtrl* m_indentRight; + wxComboBox* m_outlineLevelCtrl; + wxTextCtrl* m_spacingBefore; + wxTextCtrl* m_spacingAfter; + wxComboBox* m_spacingLine; + wxCheckBox* m_pageBreakCtrl; + wxRichTextCtrl* m_previewCtrl; + /// Control identifiers + enum { + ID_RICHTEXTINDENTSSPACINGPAGE = 10100, + ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_LEFT = 10102, + ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_RIGHT = 10110, + ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_JUSTIFIED = 10111, + ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_CENTRED = 10112, + ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_INDETERMINATE = 10101, + ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT = 10103, + ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT_FIRST = 10104, + ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT = 10113, + ID_RICHTEXTINDENTSSPACINGPAGE_OUTLINELEVEL = 10105, + ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE = 10114, + ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER = 10116, + ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_LINE = 10115, + ID_RICHTEXTINDENTSSPACINGPAGE_PAGEBREAK = 10106, + ID_RICHTEXTINDENTSSPACINGPAGE_PREVIEW_CTRL = 10109 + }; +////@end wxRichTextIndentsSpacingPage member variables + + bool m_dontUpdate; +}; + +#endif + // _RICHTEXTINDENTSPAGE_H_ diff --git a/lib/wxWidgets/include/wx/richtext/richtextliststylepage.h b/lib/wxWidgets/include/wx/richtext/richtextliststylepage.h new file mode 100644 index 0000000..d45ba86 --- /dev/null +++ b/lib/wxWidgets/include/wx/richtext/richtextliststylepage.h @@ -0,0 +1,278 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextliststylepage.h +// Purpose: Declares the rich text formatting dialog list style page. +// Author: Julian Smart +// Modified by: +// Created: 10/18/2006 11:36:37 AM +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _RICHTEXTLISTSTYLEPAGE_H_ +#define _RICHTEXTLISTSTYLEPAGE_H_ + +/*! + * Includes + */ + +#include "wx/richtext/richtextdialogpage.h" + +////@begin includes +#include "wx/spinctrl.h" +#include "wx/notebook.h" +#include "wx/statline.h" +////@end includes + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL +#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_TITLE wxEmptyString +#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_IDNAME ID_RICHTEXTLISTSTYLEPAGE +#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_SIZE wxSize(400, 300) +#define SYMBOL_WXRICHTEXTLISTSTYLEPAGE_POSITION wxDefaultPosition +////@end control identifiers + +/*! + * wxRichTextListStylePage class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextListStylePage: public wxRichTextDialogPage +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextListStylePage); + wxDECLARE_EVENT_TABLE(); + DECLARE_HELP_PROVISION() + +public: + /// Constructors + wxRichTextListStylePage( ); + wxRichTextListStylePage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_STYLE ); + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTLISTSTYLEPAGE_STYLE ); + + /// Initialises member variables + void Init(); + + /// Creates the controls and sizers + void CreateControls(); + + /// Updates the bullets preview + void UpdatePreview(); + + /// Transfer data from/to window + virtual bool TransferDataFromWindow() wxOVERRIDE; + virtual bool TransferDataToWindow() wxOVERRIDE; + + /// Get attributes for selected level + wxRichTextAttr* GetAttributesForSelection(); + + /// Update for symbol-related controls + void OnSymbolUpdate( wxUpdateUIEvent& event ); + + /// Update for number-related controls + void OnNumberUpdate( wxUpdateUIEvent& event ); + + /// Update for standard bullet-related controls + void OnStandardBulletUpdate( wxUpdateUIEvent& event ); + + /// Just transfer to the window + void DoTransferDataToWindow(); + + /// Transfer from the window and preview + void TransferAndPreview(); + +////@begin wxRichTextListStylePage event handler declarations + + /// wxEVT_SPINCTRL event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL + void OnLevelUpdated( wxSpinEvent& event ); + + /// wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL + void OnLevelUp( wxSpinEvent& event ); + + /// wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL + void OnLevelDown( wxSpinEvent& event ); + + /// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL + void OnLevelTextUpdated( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL + void OnLevelUIUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_BUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT + void OnChooseFontClick( wxCommandEvent& event ); + + /// wxEVT_LISTBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX + void OnStylelistboxSelected( wxCommandEvent& event ); + + /// wxEVT_CHECKBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL + void OnPeriodctrlClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL + void OnPeriodctrlUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_CHECKBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL + void OnParenthesesctrlClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL + void OnParenthesesctrlUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_CHECKBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL + void OnRightParenthesisCtrlClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL + void OnRightParenthesisCtrlUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMBOBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_BULLETALIGNMENTCTRL + void OnBulletAlignmentCtrlSelected( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC + void OnSymbolstaticUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMBOBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL + void OnSymbolctrlSelected( wxCommandEvent& event ); + + /// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL + void OnSymbolctrlUpdated( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL + void OnSymbolctrlUIUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_BUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_SYMBOL + void OnChooseSymbolClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_SYMBOL + void OnChooseSymbolUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMBOBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL + void OnSymbolfontctrlSelected( wxCommandEvent& event ); + + /// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL + void OnSymbolfontctrlUpdated( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL + void OnSymbolfontctrlUIUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMESTATIC + void OnNamestaticUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMBOBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL + void OnNamectrlSelected( wxCommandEvent& event ); + + /// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL + void OnNamectrlUpdated( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL + void OnNamectrlUIUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_RADIOBUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT + void OnRichtextliststylepageAlignleftSelected( wxCommandEvent& event ); + + /// wxEVT_RADIOBUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT + void OnRichtextliststylepageAlignrightSelected( wxCommandEvent& event ); + + /// wxEVT_RADIOBUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED + void OnRichtextliststylepageJustifiedSelected( wxCommandEvent& event ); + + /// wxEVT_RADIOBUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_CENTERED + void OnRichtextliststylepageCenteredSelected( wxCommandEvent& event ); + + /// wxEVT_RADIOBUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE + void OnRichtextliststylepageAlignindeterminateSelected( wxCommandEvent& event ); + + /// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT + void OnIndentLeftUpdated( wxCommandEvent& event ); + + /// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE + void OnIndentFirstLineUpdated( wxCommandEvent& event ); + + /// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT + void OnIndentRightUpdated( wxCommandEvent& event ); + + /// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE + void OnSpacingBeforeUpdated( wxCommandEvent& event ); + + /// wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER + void OnSpacingAfterUpdated( wxCommandEvent& event ); + + /// wxEVT_COMBOBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_LINESPACING + void OnLineSpacingSelected( wxCommandEvent& event ); + +////@end wxRichTextListStylePage event handler declarations + +////@begin wxRichTextListStylePage member function declarations + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end wxRichTextListStylePage member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + +////@begin wxRichTextListStylePage member variables + wxSpinCtrl* m_levelCtrl; + wxListBox* m_styleListBox; + wxCheckBox* m_periodCtrl; + wxCheckBox* m_parenthesesCtrl; + wxCheckBox* m_rightParenthesisCtrl; + wxComboBox* m_bulletAlignmentCtrl; + wxComboBox* m_symbolCtrl; + wxComboBox* m_symbolFontCtrl; + wxComboBox* m_bulletNameCtrl; + wxRadioButton* m_alignmentLeft; + wxRadioButton* m_alignmentRight; + wxRadioButton* m_alignmentJustified; + wxRadioButton* m_alignmentCentred; + wxRadioButton* m_alignmentIndeterminate; + wxTextCtrl* m_indentLeft; + wxTextCtrl* m_indentLeftFirst; + wxTextCtrl* m_indentRight; + wxTextCtrl* m_spacingBefore; + wxTextCtrl* m_spacingAfter; + wxComboBox* m_spacingLine; + wxRichTextCtrl* m_previewCtrl; + /// Control identifiers + enum { + ID_RICHTEXTLISTSTYLEPAGE = 10616, + ID_RICHTEXTLISTSTYLEPAGE_LEVEL = 10617, + ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT = 10604, + ID_RICHTEXTLISTSTYLEPAGE_NOTEBOOK = 10618, + ID_RICHTEXTLISTSTYLEPAGE_BULLETS = 10619, + ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX = 10620, + ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL = 10627, + ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL = 10626, + ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL = 10602, + ID_RICHTEXTLISTSTYLEPAGE_BULLETALIGNMENTCTRL = 10603, + ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC = 10621, + ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL = 10622, + ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_SYMBOL = 10623, + ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL = 10625, + ID_RICHTEXTLISTSTYLEPAGE_NAMESTATIC = 10600, + ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL = 10601, + ID_RICHTEXTLISTSTYLEPAGE_SPACING = 10628, + ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT = 10629, + ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT = 10630, + ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED = 10631, + ID_RICHTEXTLISTSTYLEPAGE_CENTERED = 10632, + ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE = 10633, + ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT = 10634, + ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE = 10635, + ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT = 10636, + ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE = 10637, + ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER = 10638, + ID_RICHTEXTLISTSTYLEPAGE_LINESPACING = 10639, + ID_RICHTEXTLISTSTYLEPAGE_RICHTEXTCTRL = 10640 + }; +////@end wxRichTextListStylePage member variables + + bool m_dontUpdate; + int m_currentLevel; +}; + +#endif + // _RICHTEXTLISTSTYLEPAGE_H_ diff --git a/lib/wxWidgets/include/wx/richtext/richtextmarginspage.h b/lib/wxWidgets/include/wx/richtext/richtextmarginspage.h new file mode 100644 index 0000000..afdc2a0 --- /dev/null +++ b/lib/wxWidgets/include/wx/richtext/richtextmarginspage.h @@ -0,0 +1,177 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextmarginspage.h +// Purpose: Declares the rich text formatting dialog margins page. +// Author: Julian Smart +// Modified by: +// Created: 20/10/2010 10:27:34 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _RICHTEXTMARGINSPAGE_H_ +#define _RICHTEXTMARGINSPAGE_H_ + +/*! + * Includes + */ + +#include "wx/richtext/richtextdialogpage.h" + +////@begin includes +#include "wx/statline.h" +////@end includes + +/*! + * Forward declarations + */ + +////@begin forward declarations +////@end forward declarations + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define SYMBOL_WXRICHTEXTMARGINSPAGE_STYLE wxTAB_TRAVERSAL +#define SYMBOL_WXRICHTEXTMARGINSPAGE_TITLE wxEmptyString +#define SYMBOL_WXRICHTEXTMARGINSPAGE_IDNAME ID_WXRICHTEXTMARGINSPAGE +#define SYMBOL_WXRICHTEXTMARGINSPAGE_SIZE wxSize(400, 300) +#define SYMBOL_WXRICHTEXTMARGINSPAGE_POSITION wxDefaultPosition +////@end control identifiers + + +/*! + * wxRichTextMarginsPage class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextMarginsPage: public wxRichTextDialogPage +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextMarginsPage); + wxDECLARE_EVENT_TABLE(); + DECLARE_HELP_PROVISION() + +public: + /// Constructors + wxRichTextMarginsPage(); + wxRichTextMarginsPage( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTMARGINSPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTMARGINSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTMARGINSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTMARGINSPAGE_STYLE ); + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTMARGINSPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTMARGINSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTMARGINSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTMARGINSPAGE_STYLE ); + + /// Destructor + ~wxRichTextMarginsPage(); + + /// Initialises member variables + void Init(); + + /// Creates the controls and sizers + void CreateControls(); + + /// Gets the attributes from the formatting dialog + wxRichTextAttr* GetAttributes(); + + /// Data transfer + virtual bool TransferDataToWindow() wxOVERRIDE; + virtual bool TransferDataFromWindow() wxOVERRIDE; + +////@begin wxRichTextMarginsPage event handler declarations + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT_MARGIN + void OnRichtextLeftMarginUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_RIGHT_MARGIN + void OnRichtextRightMarginUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_TOP_MARGIN + void OnRichtextTopMarginUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BOTTOM_MARGIN + void OnRichtextBottomMarginUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT_PADDING + void OnRichtextLeftPaddingUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_RIGHT_PADDING + void OnRichtextRightPaddingUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_TOP_PADDING + void OnRichtextTopPaddingUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BOTTOM_PADDING + void OnRichtextBottomPaddingUpdate( wxUpdateUIEvent& event ); + +////@end wxRichTextMarginsPage event handler declarations + +////@begin wxRichTextMarginsPage member function declarations + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end wxRichTextMarginsPage member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + +////@begin wxRichTextMarginsPage member variables + wxCheckBox* m_leftMarginCheckbox; + wxTextCtrl* m_marginLeft; + wxComboBox* m_unitsMarginLeft; + wxCheckBox* m_rightMarginCheckbox; + wxTextCtrl* m_marginRight; + wxComboBox* m_unitsMarginRight; + wxCheckBox* m_topMarginCheckbox; + wxTextCtrl* m_marginTop; + wxComboBox* m_unitsMarginTop; + wxCheckBox* m_bottomMarginCheckbox; + wxTextCtrl* m_marginBottom; + wxComboBox* m_unitsMarginBottom; + wxCheckBox* m_leftPaddingCheckbox; + wxTextCtrl* m_paddingLeft; + wxComboBox* m_unitsPaddingLeft; + wxCheckBox* m_rightPaddingCheckbox; + wxTextCtrl* m_paddingRight; + wxComboBox* m_unitsPaddingRight; + wxCheckBox* m_topPaddingCheckbox; + wxTextCtrl* m_paddingTop; + wxComboBox* m_unitsPaddingTop; + wxCheckBox* m_bottomPaddingCheckbox; + wxTextCtrl* m_paddingBottom; + wxComboBox* m_unitsPaddingBottom; + /// Control identifiers + enum { + ID_WXRICHTEXTMARGINSPAGE = 10750, + ID_RICHTEXT_LEFT_MARGIN_CHECKBOX = 10751, + ID_RICHTEXT_LEFT_MARGIN = 10752, + ID_RICHTEXT_LEFT_MARGIN_UNITS = 10753, + ID_RICHTEXT_RIGHT_MARGIN_CHECKBOX = 10754, + ID_RICHTEXT_RIGHT_MARGIN = 10755, + ID_RICHTEXT_RIGHT_MARGIN_UNITS = 10756, + ID_RICHTEXT_TOP_MARGIN_CHECKBOX = 10757, + ID_RICHTEXT_TOP_MARGIN = 10758, + ID_RICHTEXT_TOP_MARGIN_UNITS = 10759, + ID_RICHTEXT_BOTTOM_MARGIN_CHECKBOX = 10760, + ID_RICHTEXT_BOTTOM_MARGIN = 10761, + ID_RICHTEXT_BOTTOM_MARGIN_UNITS = 10762, + ID_RICHTEXT_LEFT_PADDING_CHECKBOX = 10763, + ID_RICHTEXT_LEFT_PADDING = 10764, + ID_RICHTEXT_LEFT_PADDING_UNITS = 10765, + ID_RICHTEXT_RIGHT_PADDING_CHECKBOX = 10766, + ID_RICHTEXT_RIGHT_PADDING = 10767, + ID_RICHTEXT_RIGHT_PADDING_UNITS = 10768, + ID_RICHTEXT_TOP_PADDING_CHECKBOX = 10769, + ID_RICHTEXT_TOP_PADDING = 10770, + ID_RICHTEXT_TOP_PADDING_UNITS = 10771, + ID_RICHTEXT_BOTTOM_PADDING_CHECKBOX = 10772, + ID_RICHTEXT_BOTTOM_PADDING = 10773, + ID_RICHTEXT_BOTTOM_PADDING_UNITS = 10774 + }; +////@end wxRichTextMarginsPage member variables + + bool m_ignoreUpdates; +}; + +#endif + // _RICHTEXTMARGINSPAGE_H_ diff --git a/lib/wxWidgets/include/wx/richtext/richtextprint.h b/lib/wxWidgets/include/wx/richtext/richtextprint.h new file mode 100644 index 0000000..1776d47 --- /dev/null +++ b/lib/wxWidgets/include/wx/richtext/richtextprint.h @@ -0,0 +1,251 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextprint.h +// Purpose: Rich text printing classes +// Author: Julian Smart +// Created: 2006-10-23 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RICHTEXTPRINT_H_ +#define _WX_RICHTEXTPRINT_H_ + +#include "wx/defs.h" + +#if wxUSE_RICHTEXT & wxUSE_PRINTING_ARCHITECTURE + +#include "wx/richtext/richtextbuffer.h" + +#include "wx/print.h" +#include "wx/printdlg.h" + +#define wxRICHTEXT_PRINT_MAX_PAGES 99999 + +// Header/footer page identifiers +enum wxRichTextOddEvenPage { + wxRICHTEXT_PAGE_ODD, + wxRICHTEXT_PAGE_EVEN, + wxRICHTEXT_PAGE_ALL +}; + +// Header/footer text locations +enum wxRichTextPageLocation { + wxRICHTEXT_PAGE_LEFT, + wxRICHTEXT_PAGE_CENTRE, + wxRICHTEXT_PAGE_RIGHT +}; + +/*! + * Header/footer data + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextHeaderFooterData: public wxObject +{ +public: + wxRichTextHeaderFooterData() { Init(); } + wxRichTextHeaderFooterData(const wxRichTextHeaderFooterData& data): wxObject() { Copy(data); } + + /// Initialise + void Init() { m_headerMargin = 20; m_footerMargin = 20; m_showOnFirstPage = true; } + + /// Copy + void Copy(const wxRichTextHeaderFooterData& data); + + /// Assignment + void operator= (const wxRichTextHeaderFooterData& data) { Copy(data); } + + /// Set/get header text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT + void SetHeaderText(const wxString& text, wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_ALL, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE); + wxString GetHeaderText(wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_EVEN, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE) const; + + /// Set/get footer text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT + void SetFooterText(const wxString& text, wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_ALL, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE); + wxString GetFooterText(wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_EVEN, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE) const; + + /// Set/get text + void SetText(const wxString& text, int headerFooter, wxRichTextOddEvenPage page, wxRichTextPageLocation location); + wxString GetText(int headerFooter, wxRichTextOddEvenPage page, wxRichTextPageLocation location) const; + + /// Set/get margins between text and header or footer, in tenths of a millimeter + void SetMargins(int headerMargin, int footerMargin) { m_headerMargin = headerMargin; m_footerMargin = footerMargin; } + int GetHeaderMargin() const { return m_headerMargin; } + int GetFooterMargin() const { return m_footerMargin; } + + /// Set/get whether to show header or footer on first page + void SetShowOnFirstPage(bool showOnFirstPage) { m_showOnFirstPage = showOnFirstPage; } + bool GetShowOnFirstPage() const { return m_showOnFirstPage; } + + /// Clear all text + void Clear(); + + /// Set/get font + void SetFont(const wxFont& font) { m_font = font; } + const wxFont& GetFont() const { return m_font; } + + /// Set/get colour + void SetTextColour(const wxColour& col) { m_colour = col; } + const wxColour& GetTextColour() const { return m_colour; } + + wxDECLARE_CLASS(wxRichTextHeaderFooterData); + +private: + + // Strings for left, centre, right, top, bottom, odd, even + wxString m_text[12]; + wxFont m_font; + wxColour m_colour; + int m_headerMargin; + int m_footerMargin; + bool m_showOnFirstPage; +}; + +/*! + * wxRichTextPrintout + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextPrintout : public wxPrintout +{ +public: + wxRichTextPrintout(const wxString& title = wxGetTranslation("Printout")); + virtual ~wxRichTextPrintout(); + + /// The buffer to print + void SetRichTextBuffer(wxRichTextBuffer* buffer) { m_richTextBuffer = buffer; } + wxRichTextBuffer* GetRichTextBuffer() const { return m_richTextBuffer; } + + /// Set/get header/footer data + void SetHeaderFooterData(const wxRichTextHeaderFooterData& data) { m_headerFooterData = data; } + const wxRichTextHeaderFooterData& GetHeaderFooterData() const { return m_headerFooterData; } + + /// Sets margins in 10ths of millimetre. Defaults to 1 inch for margins. + void SetMargins(int top = 254, int bottom = 254, int left = 254, int right = 254); + + /// Calculate scaling and rectangles, setting the device context scaling + void CalculateScaling(wxDC* dc, wxRect& textRect, wxRect& headerRect, wxRect& footerRect); + + // wxPrintout virtual functions + virtual bool OnPrintPage(int page) wxOVERRIDE; + virtual bool HasPage(int page) wxOVERRIDE; + virtual void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo) wxOVERRIDE; + virtual bool OnBeginDocument(int startPage, int endPage) wxOVERRIDE; + virtual void OnPreparePrinting() wxOVERRIDE; + +private: + + /// Renders one page into dc + void RenderPage(wxDC *dc, int page); + + /// Substitute keywords + static bool SubstituteKeywords(wxString& str, const wxString& title, int pageNum, int pageCount); + +private: + + wxRichTextBuffer* m_richTextBuffer; + int m_numPages; + wxArrayInt m_pageBreaksStart; + wxArrayInt m_pageBreaksEnd; + wxArrayInt m_pageYOffsets; + int m_marginLeft, m_marginTop, m_marginRight, m_marginBottom; + + wxRichTextHeaderFooterData m_headerFooterData; + + wxDECLARE_NO_COPY_CLASS(wxRichTextPrintout); +}; + +/* + *! wxRichTextPrinting + * A simple interface to perform wxRichTextBuffer printing. + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextPrinting : public wxObject +{ +public: + wxRichTextPrinting(const wxString& name = wxGetTranslation("Printing"), wxWindow *parentWindow = NULL); + virtual ~wxRichTextPrinting(); + + /// Preview the file or buffer +#if wxUSE_FFILE && wxUSE_STREAMS + bool PreviewFile(const wxString& richTextFile); +#endif + bool PreviewBuffer(const wxRichTextBuffer& buffer); + + /// Print the file or buffer +#if wxUSE_FFILE && wxUSE_STREAMS + bool PrintFile(const wxString& richTextFile, bool showPrintDialog = true); +#endif + bool PrintBuffer(const wxRichTextBuffer& buffer, bool showPrintDialog = true); + + /// Shows page setup dialog + void PageSetup(); + + /// Set/get header/footer data + void SetHeaderFooterData(const wxRichTextHeaderFooterData& data) { m_headerFooterData = data; } + const wxRichTextHeaderFooterData& GetHeaderFooterData() const { return m_headerFooterData; } + + /// Set/get header text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT + void SetHeaderText(const wxString& text, wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_ALL, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE); + wxString GetHeaderText(wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_EVEN, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE) const; + + /// Set/get footer text, e.g. wxRICHTEXT_PAGE_ODD, wxRICHTEXT_PAGE_LEFT + void SetFooterText(const wxString& text, wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_ALL, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE); + wxString GetFooterText(wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_EVEN, wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE) const; + + /// Show header/footer on first page, or not + void SetShowOnFirstPage(bool show) { m_headerFooterData.SetShowOnFirstPage(show); } + + /// Set the font + void SetHeaderFooterFont(const wxFont& font) { m_headerFooterData.SetFont(font); } + + /// Set the colour + void SetHeaderFooterTextColour(const wxColour& font) { m_headerFooterData.SetTextColour(font); } + + /// Get print and page setup data + wxPrintData *GetPrintData(); + wxPageSetupDialogData *GetPageSetupData() { return m_pageSetupData; } + + /// Set print and page setup data + void SetPrintData(const wxPrintData& printData); + void SetPageSetupData(const wxPageSetupDialogData& pageSetupData); + + /// Set the rich text buffer pointer, deleting the existing object if present + void SetRichTextBufferPreview(wxRichTextBuffer* buf); + wxRichTextBuffer* GetRichTextBufferPreview() const { return m_richTextBufferPreview; } + + void SetRichTextBufferPrinting(wxRichTextBuffer* buf); + wxRichTextBuffer* GetRichTextBufferPrinting() const { return m_richTextBufferPrinting; } + + /// Set/get the parent window + void SetParentWindow(wxWindow* parent) { m_parentWindow = parent; } + wxWindow* GetParentWindow() const { return m_parentWindow; } + + /// Set/get the title + void SetTitle(const wxString& title) { m_title = title; } + const wxString& GetTitle() const { return m_title; } + + /// Set/get the preview rect + void SetPreviewRect(const wxRect& rect) { m_previewRect = rect; } + const wxRect& GetPreviewRect() const { return m_previewRect; } + +protected: + virtual wxRichTextPrintout *CreatePrintout(); + virtual bool DoPreview(wxRichTextPrintout *printout1, wxRichTextPrintout *printout2); + virtual bool DoPrint(wxRichTextPrintout *printout, bool showPrintDialog); + +private: + wxPrintData* m_printData; + wxPageSetupDialogData* m_pageSetupData; + + wxRichTextHeaderFooterData m_headerFooterData; + wxString m_title; + wxWindow* m_parentWindow; + wxRichTextBuffer* m_richTextBufferPreview; + wxRichTextBuffer* m_richTextBufferPrinting; + wxRect m_previewRect; + + wxDECLARE_NO_COPY_CLASS(wxRichTextPrinting); +}; + +#endif // wxUSE_RICHTEXT & wxUSE_PRINTING_ARCHITECTURE + +#endif // _WX_RICHTEXTPRINT_H_ + diff --git a/lib/wxWidgets/include/wx/richtext/richtextsizepage.h b/lib/wxWidgets/include/wx/richtext/richtextsizepage.h new file mode 100644 index 0000000..e9bc149 --- /dev/null +++ b/lib/wxWidgets/include/wx/richtext/richtextsizepage.h @@ -0,0 +1,304 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextsizepage.h +// Purpose: Declares the rich text formatting dialog size page. +// Author: Julian Smart +// Modified by: +// Created: 20/10/2010 10:23:24 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _RICHTEXTSIZEPAGE_H_ +#define _RICHTEXTSIZEPAGE_H_ + +/*! + * Includes + */ + +#include "wx/richtext/richtextdialogpage.h" +#include "wx/sizer.h" + +////@begin includes +#include "wx/statline.h" +#include "wx/valgen.h" +////@end includes +#include "wx/stattext.h" + +/*! + * Forward declarations + */ + + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define SYMBOL_WXRICHTEXTSIZEPAGE_STYLE wxTAB_TRAVERSAL +#define SYMBOL_WXRICHTEXTSIZEPAGE_TITLE wxEmptyString +#define SYMBOL_WXRICHTEXTSIZEPAGE_IDNAME ID_WXRICHTEXTSIZEPAGE +#define SYMBOL_WXRICHTEXTSIZEPAGE_SIZE wxSize(400, 300) +#define SYMBOL_WXRICHTEXTSIZEPAGE_POSITION wxDefaultPosition +////@end control identifiers + + +/*! + * wxRichTextSizePage class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextSizePage: public wxRichTextDialogPage +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextSizePage); + wxDECLARE_EVENT_TABLE(); + DECLARE_HELP_PROVISION() + +public: + /// Constructors + wxRichTextSizePage(); + wxRichTextSizePage( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTSIZEPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTSIZEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSIZEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTSIZEPAGE_STYLE ); + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTSIZEPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTSIZEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSIZEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTSIZEPAGE_STYLE ); + + /// Destructor + ~wxRichTextSizePage(); + + /// Initialises member variables + void Init(); + + /// Creates the controls and sizers + void CreateControls(); + + /// Gets the attributes from the formatting dialog + wxRichTextAttr* GetAttributes(); + + /// Data transfer + virtual bool TransferDataToWindow() wxOVERRIDE; + virtual bool TransferDataFromWindow() wxOVERRIDE; + + /// Show/hide position controls + static void ShowPositionControls(bool show) { sm_showPositionControls = show; } + + /// Show/hide minimum and maximum size controls + static void ShowMinMaxSizeControls(bool show) { sm_showMinMaxSizeControls = show; } + + /// Show/hide position mode controls + static void ShowPositionModeControls(bool show) { sm_showPositionModeControls = show; } + + /// Show/hide right/bottom position controls + static void ShowRightBottomPositionControls(bool show) { sm_showRightBottomPositionControls = show; } + + /// Show/hide floating and alignment controls + static void ShowFloatingAndAlignmentControls(bool show) { sm_showFloatingAndAlignmentControls = show; } + + /// Show/hide floating controls + static void ShowFloatingControls(bool show) { sm_showFloatingControls = show; } + + /// Show/hide alignment controls + static void ShowAlignmentControls(bool show) { sm_showAlignmentControls = show; } + + /// Enable the position and size units + static void EnablePositionAndSizeUnits(bool enable) { sm_enablePositionAndSizeUnits = enable; } + + /// Enable the checkboxes for position and size + static void EnablePositionAndSizeCheckboxes(bool enable) { sm_enablePositionAndSizeCheckboxes = enable; } + + /// Enable the move object controls + static void ShowMoveObjectControls(bool enable) { sm_showMoveObjectControls = enable; } + +////@begin wxRichTextSizePage event handler declarations + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX + void OnRichtextVerticalAlignmentComboboxUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_WIDTH + void OnRichtextWidthUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_UNITS_W + void OnRichtextWidthUnitsUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_HEIGHT + void OnRichtextHeightUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_UNITS_H + void OnRichtextHeightUnitsUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MIN_WIDTH + void OnRichtextMinWidthUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MIN_HEIGHT + void OnRichtextMinHeightUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MAX_WIDTH + void OnRichtextMaxWidthUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_MAX_HEIGHT + void OnRichtextMaxHeightUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT + void OnRichtextLeftUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_LEFT_UNITS + void OnRichtextLeftUnitsUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_TOP + void OnRichtextTopUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_TOP_UNITS + void OnRichtextTopUnitsUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_RIGHT + void OnRichtextRightUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_RIGHT_UNITS + void OnRichtextRightUnitsUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BOTTOM + void OnRichtextBottomUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_BOTTOM_UNITS + void OnRichtextBottomUnitsUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXT_PARA_UP + void OnRichtextParaUpClick( wxCommandEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXT_PARA_DOWN + void OnRichtextParaDownClick( wxCommandEvent& event ); + +////@end wxRichTextSizePage event handler declarations + +////@begin wxRichTextSizePage member function declarations + + int GetPositionMode() const { return m_positionMode ; } + void SetPositionMode(int value) { m_positionMode = value ; } + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end wxRichTextSizePage member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + +////@begin wxRichTextSizePage member variables + wxBoxSizer* m_parentSizer; + wxBoxSizer* m_floatingAlignmentSizer; + wxBoxSizer* m_floatingSizer; + wxChoice* m_float; + wxBoxSizer* m_alignmentSizer; + wxCheckBox* m_verticalAlignmentCheckbox; + wxChoice* m_verticalAlignmentComboBox; + wxFlexGridSizer* m_sizeSizer; + wxBoxSizer* m_widthSizer; + wxCheckBox* m_widthCheckbox; + wxStaticText* m_widthLabel; + wxTextCtrl* m_width; + wxComboBox* m_unitsW; + wxBoxSizer* m_heightSizer; + wxCheckBox* m_heightCheckbox; + wxStaticText* m_heightLabel; + wxTextCtrl* m_height; + wxComboBox* m_unitsH; + wxCheckBox* m_minWidthCheckbox; + wxBoxSizer* m_minWidthSizer; + wxTextCtrl* m_minWidth; + wxComboBox* m_unitsMinW; + wxCheckBox* m_minHeightCheckbox; + wxBoxSizer* m_minHeightSizer; + wxTextCtrl* m_minHeight; + wxComboBox* m_unitsMinH; + wxCheckBox* m_maxWidthCheckbox; + wxBoxSizer* m_maxWidthSizer; + wxTextCtrl* m_maxWidth; + wxComboBox* m_unitsMaxW; + wxCheckBox* m_maxHeightCheckbox; + wxBoxSizer* m_maxHeightSizer; + wxTextCtrl* m_maxHeight; + wxComboBox* m_unitsMaxH; + wxBoxSizer* m_positionControls; + wxBoxSizer* m_moveObjectParentSizer; + wxBoxSizer* m_positionModeSizer; + wxChoice* m_positionModeCtrl; + wxFlexGridSizer* m_positionGridSizer; + wxBoxSizer* m_leftSizer; + wxCheckBox* m_positionLeftCheckbox; + wxStaticText* m_leftLabel; + wxTextCtrl* m_left; + wxComboBox* m_unitsLeft; + wxBoxSizer* m_topSizer; + wxCheckBox* m_positionTopCheckbox; + wxStaticText* m_topLabel; + wxTextCtrl* m_top; + wxComboBox* m_unitsTop; + wxBoxSizer* m_rightSizer; + wxCheckBox* m_positionRightCheckbox; + wxStaticText* m_rightLabel; + wxBoxSizer* m_rightPositionSizer; + wxTextCtrl* m_right; + wxComboBox* m_unitsRight; + wxBoxSizer* m_bottomSizer; + wxCheckBox* m_positionBottomCheckbox; + wxStaticText* m_bottomLabel; + wxBoxSizer* m_bottomPositionSizer; + wxTextCtrl* m_bottom; + wxComboBox* m_unitsBottom; + wxBoxSizer* m_moveObjectSizer; + int m_positionMode; + /// Control identifiers + enum { + ID_WXRICHTEXTSIZEPAGE = 10700, + ID_RICHTEXT_FLOATING_MODE = 10701, + ID_RICHTEXT_VERTICAL_ALIGNMENT_CHECKBOX = 10708, + ID_RICHTEXT_VERTICAL_ALIGNMENT_COMBOBOX = 10709, + ID_RICHTEXT_WIDTH_CHECKBOX = 10702, + ID_RICHTEXT_WIDTH = 10703, + ID_RICHTEXT_UNITS_W = 10704, + ID_RICHTEXT_HEIGHT_CHECKBOX = 10705, + ID_RICHTEXT_HEIGHT = 10706, + ID_RICHTEXT_UNITS_H = 10707, + ID_RICHTEXT_MIN_WIDTH_CHECKBOX = 10715, + ID_RICHTEXT_MIN_WIDTH = 10716, + ID_RICHTEXT_UNITS_MIN_W = 10717, + ID_RICHTEXT_MIN_HEIGHT_CHECKBOX = 10718, + ID_RICHTEXT_MIN_HEIGHT = 10719, + ID_RICHTEXT_UNITS_MIN_H = 10720, + ID_RICHTEXT_MAX_WIDTH_CHECKBOX = 10721, + ID_RICHTEXT_MAX_WIDTH = 10722, + ID_RICHTEXT_UNITS_MAX_W = 10723, + ID_RICHTEXT_MAX_HEIGHT_CHECKBOX = 10724, + ID_RICHTEXT_MAX_HEIGHT = 10725, + ID_RICHTEXT_UNITS_MAX_H = 10726, + ID_RICHTEXT_POSITION_MODE = 10735, + ID_RICHTEXT_LEFT_CHECKBOX = 10710, + ID_RICHTEXT_LEFT = 10711, + ID_RICHTEXT_LEFT_UNITS = 10712, + ID_RICHTEXT_TOP_CHECKBOX = 10710, + ID_RICHTEXT_TOP = 10728, + ID_RICHTEXT_TOP_UNITS = 10729, + ID_RICHTEXT_RIGHT_CHECKBOX = 10727, + ID_RICHTEXT_RIGHT = 10730, + ID_RICHTEXT_RIGHT_UNITS = 10731, + ID_RICHTEXT_BOTTOM_CHECKBOX = 10732, + ID_RICHTEXT_BOTTOM = 10733, + ID_RICHTEXT_BOTTOM_UNITS = 10734, + ID_RICHTEXT_PARA_UP = 10713, + ID_RICHTEXT_PARA_DOWN = 10714 + }; +////@end wxRichTextSizePage member variables + + static bool sm_showFloatingControls; + static bool sm_showPositionControls; + static bool sm_showMinMaxSizeControls; + static bool sm_showPositionModeControls; + static bool sm_showRightBottomPositionControls; + static bool sm_showAlignmentControls; + static bool sm_showFloatingAndAlignmentControls; + static bool sm_enablePositionAndSizeUnits; + static bool sm_enablePositionAndSizeCheckboxes; + static bool sm_showMoveObjectControls; +}; + +#endif + // _RICHTEXTSIZEPAGE_H_ diff --git a/lib/wxWidgets/include/wx/richtext/richtextstyledlg.h b/lib/wxWidgets/include/wx/richtext/richtextstyledlg.h new file mode 100644 index 0000000..cf45582 --- /dev/null +++ b/lib/wxWidgets/include/wx/richtext/richtextstyledlg.h @@ -0,0 +1,257 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextstyledlg.h +// Purpose: Declares the rich text style editor dialog. +// Author: Julian Smart +// Modified by: +// Created: 10/5/2006 12:05:31 PM +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _RICHTEXTSTYLEDLG_H_ +#define _RICHTEXTSTYLEDLG_H_ + +/*! + * Includes + */ + +#include "wx/dialog.h" + +#include "wx/richtext/richtextuicustomization.h" + +////@begin includes +////@end includes + +#include "wx/richtext/richtextbuffer.h" +#include "wx/richtext/richtextstyles.h" +#include "wx/richtext/richtextctrl.h" + +/*! + * Forward declarations + */ + +////@begin forward declarations +class wxBoxSizer; +class wxRichTextStyleListCtrl; +class wxRichTextCtrl; +class wxStdDialogButtonSizer; +////@end forward declarations + +class WXDLLIMPEXP_FWD_CORE wxButton; +class WXDLLIMPEXP_FWD_CORE wxCheckBox; + +/*! + * Control identifiers + */ + +#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX +#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE wxGetTranslation(wxASCII_STR("Style Organiser")) +#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_IDNAME ID_RICHTEXTSTYLEORGANISERDIALOG +#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE wxSize(400, 300) +#define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION wxDefaultPosition + +/*! + * Flags for specifying permitted operations + */ + +#define wxRICHTEXT_ORGANISER_DELETE_STYLES 0x0001 +#define wxRICHTEXT_ORGANISER_CREATE_STYLES 0x0002 +#define wxRICHTEXT_ORGANISER_APPLY_STYLES 0x0004 +#define wxRICHTEXT_ORGANISER_EDIT_STYLES 0x0008 +#define wxRICHTEXT_ORGANISER_RENAME_STYLES 0x0010 +#define wxRICHTEXT_ORGANISER_OK_CANCEL 0x0020 +#define wxRICHTEXT_ORGANISER_RENUMBER 0x0040 + +// The permitted style types to show +#define wxRICHTEXT_ORGANISER_SHOW_CHARACTER 0x0100 +#define wxRICHTEXT_ORGANISER_SHOW_PARAGRAPH 0x0200 +#define wxRICHTEXT_ORGANISER_SHOW_LIST 0x0400 +#define wxRICHTEXT_ORGANISER_SHOW_BOX 0x0800 +#define wxRICHTEXT_ORGANISER_SHOW_ALL 0x1000 + +// Common combinations +#define wxRICHTEXT_ORGANISER_ORGANISE (wxRICHTEXT_ORGANISER_SHOW_ALL|wxRICHTEXT_ORGANISER_DELETE_STYLES|wxRICHTEXT_ORGANISER_CREATE_STYLES|wxRICHTEXT_ORGANISER_APPLY_STYLES|wxRICHTEXT_ORGANISER_EDIT_STYLES|wxRICHTEXT_ORGANISER_RENAME_STYLES) +#define wxRICHTEXT_ORGANISER_BROWSE (wxRICHTEXT_ORGANISER_SHOW_ALL|wxRICHTEXT_ORGANISER_OK_CANCEL) +#define wxRICHTEXT_ORGANISER_BROWSE_NUMBERING (wxRICHTEXT_ORGANISER_SHOW_LIST|wxRICHTEXT_ORGANISER_OK_CANCEL|wxRICHTEXT_ORGANISER_RENUMBER) + +/*! + * wxRichTextStyleOrganiserDialog class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextStyleOrganiserDialog: public wxDialog +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextStyleOrganiserDialog); + wxDECLARE_EVENT_TABLE(); + DECLARE_HELP_PROVISION() + +public: + /// Constructors + wxRichTextStyleOrganiserDialog( ); + wxRichTextStyleOrganiserDialog( int flags, wxRichTextStyleSheet* sheet, wxRichTextCtrl* ctrl, wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE ); + + /// Creation + bool Create( int flags, wxRichTextStyleSheet* sheet, wxRichTextCtrl* ctrl, wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE ); + + /// Creates the controls and sizers + void CreateControls(); + + /// Initialise member variables + void Init(); + + /// Transfer data from/to window + virtual bool TransferDataFromWindow() wxOVERRIDE; + virtual bool TransferDataToWindow() wxOVERRIDE; + + /// Set/get style sheet + void SetStyleSheet(wxRichTextStyleSheet* sheet) { m_richTextStyleSheet = sheet; } + wxRichTextStyleSheet* GetStyleSheet() const { return m_richTextStyleSheet; } + + /// Set/get control + void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_richTextCtrl = ctrl; } + wxRichTextCtrl* GetRichTextCtrl() const { return m_richTextCtrl; } + + /// Set/get flags + void SetFlags(int flags) { m_flags = flags; } + int GetFlags() const { return m_flags; } + + /// Show preview for given or selected preview + void ShowPreview(int sel = -1); + + /// Clears the preview + void ClearPreview(); + + /// List selection + void OnListSelection(wxCommandEvent& event); + + /// Get/set restart numbering boolean + bool GetRestartNumbering() const { return m_restartNumbering; } + void SetRestartNumbering(bool restartNumbering) { m_restartNumbering = restartNumbering; } + + /// Get selected style name or definition + wxString GetSelectedStyle() const; + wxRichTextStyleDefinition* GetSelectedStyleDefinition() const; + + /// Apply the style + bool ApplyStyle(wxRichTextCtrl* ctrl = NULL); + + /// Should we show tooltips? + static bool ShowToolTips() { return sm_showToolTips; } + + /// Determines whether tooltips will be shown + static void SetShowToolTips(bool show) { sm_showToolTips = show; } + +////@begin wxRichTextStyleOrganiserDialog event handler declarations + + /// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR + void OnNewCharClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR + void OnNewCharUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA + void OnNewParaClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA + void OnNewParaUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST + void OnNewListClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST + void OnNewListUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX + void OnNewBoxClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX + void OnNewBoxUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY + void OnApplyClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY + void OnApplyUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME + void OnRenameClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME + void OnRenameUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT + void OnEditClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT + void OnEditUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_BUTTON event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE + void OnDeleteClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE + void OnDeleteUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_BUTTON event handler for wxID_HELP + void OnHelpClick( wxCommandEvent& event ); + +////@end wxRichTextStyleOrganiserDialog event handler declarations + +////@begin wxRichTextStyleOrganiserDialog member function declarations + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end wxRichTextStyleOrganiserDialog member function declarations + +////@begin wxRichTextStyleOrganiserDialog member variables + wxBoxSizer* m_innerSizer; + wxBoxSizer* m_buttonSizerParent; + wxRichTextStyleListCtrl* m_stylesListBox; + wxRichTextCtrl* m_previewCtrl; + wxBoxSizer* m_buttonSizer; + wxButton* m_newCharacter; + wxButton* m_newParagraph; + wxButton* m_newList; + wxButton* m_newBox; + wxButton* m_applyStyle; + wxButton* m_renameStyle; + wxButton* m_editStyle; + wxButton* m_deleteStyle; + wxButton* m_closeButton; + wxBoxSizer* m_bottomButtonSizer; + wxCheckBox* m_restartNumberingCtrl; + wxStdDialogButtonSizer* m_stdButtonSizer; + wxButton* m_okButton; + wxButton* m_cancelButton; + /// Control identifiers + enum { + ID_RICHTEXTSTYLEORGANISERDIALOG = 10500, + ID_RICHTEXTSTYLEORGANISERDIALOG_STYLES = 10501, + ID_RICHTEXTSTYLEORGANISERDIALOG_CURRENT_STYLE = 10510, + ID_RICHTEXTSTYLEORGANISERDIALOG_PREVIEW = 10509, + ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR = 10504, + ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA = 10505, + ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST = 10508, + ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX = 10512, + ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY = 10503, + ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME = 10502, + ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT = 10506, + ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE = 10507, + ID_RICHTEXTSTYLEORGANISERDIALOG_RESTART_NUMBERING = 10511 + }; +////@end wxRichTextStyleOrganiserDialog member variables + +private: + + wxRichTextCtrl* m_richTextCtrl; + wxRichTextStyleSheet* m_richTextStyleSheet; + + bool m_dontUpdate; + int m_flags; + static bool sm_showToolTips; + bool m_restartNumbering; +}; + +#endif + // _RICHTEXTSTYLEDLG_H_ diff --git a/lib/wxWidgets/include/wx/richtext/richtextstylepage.h b/lib/wxWidgets/include/wx/richtext/richtextstylepage.h new file mode 100644 index 0000000..7d031ef --- /dev/null +++ b/lib/wxWidgets/include/wx/richtext/richtextstylepage.h @@ -0,0 +1,99 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextstylepage.h +// Purpose: Declares the rich text formatting dialog style page. +// Author: Julian Smart +// Modified by: +// Created: 10/5/2006 11:34:55 AM +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _RICHTEXTSTYLEPAGE_H_ +#define _RICHTEXTSTYLEPAGE_H_ + +#include "wx/richtext/richtextdialogpage.h" + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define SYMBOL_WXRICHTEXTSTYLEPAGE_STYLE wxRESIZE_BORDER|wxTAB_TRAVERSAL +#define SYMBOL_WXRICHTEXTSTYLEPAGE_TITLE wxEmptyString +#define SYMBOL_WXRICHTEXTSTYLEPAGE_IDNAME ID_RICHTEXTSTYLEPAGE +#define SYMBOL_WXRICHTEXTSTYLEPAGE_SIZE wxSize(400, 300) +#define SYMBOL_WXRICHTEXTSTYLEPAGE_POSITION wxDefaultPosition +////@end control identifiers + +/*! + * wxRichTextStylePage class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextStylePage: public wxRichTextDialogPage +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextStylePage); + wxDECLARE_EVENT_TABLE(); + DECLARE_HELP_PROVISION() + +public: + /// Constructors + wxRichTextStylePage( ); + wxRichTextStylePage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEPAGE_STYLE ); + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEPAGE_STYLE ); + + /// Initialise members + void Init(); + + /// Creates the controls and sizers + void CreateControls(); + + /// Transfer data from/to window + virtual bool TransferDataFromWindow() wxOVERRIDE; + virtual bool TransferDataToWindow() wxOVERRIDE; + + /// Gets the attributes associated with the main formatting dialog + wxRichTextAttr* GetAttributes(); + + /// Determines whether the style name can be edited + bool GetNameIsEditable() const { return m_nameIsEditable; } + void SetNameIsEditable(bool editable) { m_nameIsEditable = editable; } + +////@begin wxRichTextStylePage event handler declarations + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEPAGE_NEXT_STYLE + void OnNextStyleUpdate( wxUpdateUIEvent& event ); + +////@end wxRichTextStylePage event handler declarations + +////@begin wxRichTextStylePage member function declarations + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end wxRichTextStylePage member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + +////@begin wxRichTextStylePage member variables + wxTextCtrl* m_styleName; + wxComboBox* m_basedOn; + wxComboBox* m_nextStyle; + /// Control identifiers + enum { + ID_RICHTEXTSTYLEPAGE = 10403, + ID_RICHTEXTSTYLEPAGE_STYLE_NAME = 10404, + ID_RICHTEXTSTYLEPAGE_BASED_ON = 10405, + ID_RICHTEXTSTYLEPAGE_NEXT_STYLE = 10406 + }; +////@end wxRichTextStylePage member variables + + bool m_nameIsEditable; +}; + +#endif + // _RICHTEXTSTYLEPAGE_H_ diff --git a/lib/wxWidgets/include/wx/richtext/richtextstyles.h b/lib/wxWidgets/include/wx/richtext/richtextstyles.h new file mode 100644 index 0000000..44cd9a2 --- /dev/null +++ b/lib/wxWidgets/include/wx/richtext/richtextstyles.h @@ -0,0 +1,757 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextstyles.h +// Purpose: Style management for wxRichTextCtrl +// Author: Julian Smart +// Modified by: +// Created: 2005-09-30 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RICHTEXTSTYLES_H_ +#define _WX_RICHTEXTSTYLES_H_ + +/*! + * Includes + */ + +#include "wx/defs.h" + +#if wxUSE_RICHTEXT + +#include "wx/richtext/richtextbuffer.h" + +#if wxUSE_HTML +#include "wx/htmllbox.h" +#endif + +#if wxUSE_COMBOCTRL +#include "wx/combo.h" +#endif + +#include "wx/choice.h" + +/*! + * Forward declarations + */ + +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCtrl; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextBuffer; + +/*! + * wxRichTextStyleDefinition class declaration + * A base class for paragraph and character styles. + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextStyleDefinition: public wxObject +{ + wxDECLARE_CLASS(wxRichTextStyleDefinition); +public: + + /// Copy constructors + wxRichTextStyleDefinition(const wxRichTextStyleDefinition& def) + : wxObject() + { + Init(); + Copy(def); + } + + /// Default constructor + wxRichTextStyleDefinition(const wxString& name = wxEmptyString) { Init(); m_name = name; } + + /// Destructor + virtual ~wxRichTextStyleDefinition() {} + + /// Initialises members + void Init() {} + + /// Copies from def + void Copy(const wxRichTextStyleDefinition& def); + + /// Equality test + bool Eq(const wxRichTextStyleDefinition& def) const; + + /// Assignment operator + void operator =(const wxRichTextStyleDefinition& def) { Copy(def); } + + /// Equality operator + bool operator ==(const wxRichTextStyleDefinition& def) const { return Eq(def); } + + /// Override to clone the object + virtual wxRichTextStyleDefinition* Clone() const = 0; + + /// Sets and gets the name of the style + void SetName(const wxString& name) { m_name = name; } + const wxString& GetName() const { return m_name; } + + /// Sets and gets the style description + void SetDescription(const wxString& descr) { m_description = descr; } + const wxString& GetDescription() const { return m_description; } + + /// Sets and gets the name of the style that this style is based on + void SetBaseStyle(const wxString& name) { m_baseStyle = name; } + const wxString& GetBaseStyle() const { return m_baseStyle; } + + /// Sets and gets the style + void SetStyle(const wxRichTextAttr& style) { m_style = style; } + const wxRichTextAttr& GetStyle() const { return m_style; } + wxRichTextAttr& GetStyle() { return m_style; } + + /// Gets the style combined with the base style + virtual wxRichTextAttr GetStyleMergedWithBase(const wxRichTextStyleSheet* sheet) const; + + /** + Returns the definition's properties. + */ + wxRichTextProperties& GetProperties() { return m_properties; } + + /** + Returns the definition's properties. + */ + const wxRichTextProperties& GetProperties() const { return m_properties; } + + /** + Sets the definition's properties. + */ + void SetProperties(const wxRichTextProperties& props) { m_properties = props; } + +protected: + wxString m_name; + wxString m_baseStyle; + wxString m_description; + wxRichTextAttr m_style; + wxRichTextProperties m_properties; +}; + +/*! + * wxRichTextCharacterStyleDefinition class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextCharacterStyleDefinition: public wxRichTextStyleDefinition +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextCharacterStyleDefinition); +public: + + /// Default constructor + wxRichTextCharacterStyleDefinition(const wxString& name = wxEmptyString): + wxRichTextStyleDefinition(name) {} + + /// Destructor + virtual ~wxRichTextCharacterStyleDefinition() {} + + /// Clones the object + virtual wxRichTextStyleDefinition* Clone() const wxOVERRIDE { return new wxRichTextCharacterStyleDefinition(*this); } + +protected: +}; + +/*! + * wxRichTextParagraphStyleDefinition class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextParagraphStyleDefinition: public wxRichTextStyleDefinition +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextParagraphStyleDefinition); +public: + + /// Copy constructor + wxRichTextParagraphStyleDefinition(const wxRichTextParagraphStyleDefinition& def): wxRichTextStyleDefinition(def) { m_nextStyle = def.m_nextStyle; } + + /// Default constructor + wxRichTextParagraphStyleDefinition(const wxString& name = wxEmptyString): + wxRichTextStyleDefinition(name) {} + + // Destructor + virtual ~wxRichTextParagraphStyleDefinition() {} + + /// Sets and gets the next style + void SetNextStyle(const wxString& name) { m_nextStyle = name; } + const wxString& GetNextStyle() const { return m_nextStyle; } + + /// Copies from def + void Copy(const wxRichTextParagraphStyleDefinition& def); + + /// Assignment operator + void operator =(const wxRichTextParagraphStyleDefinition& def) { Copy(def); } + + /// Equality operator + bool operator ==(const wxRichTextParagraphStyleDefinition& def) const; + + /// Clones the object + virtual wxRichTextStyleDefinition* Clone() const wxOVERRIDE { return new wxRichTextParagraphStyleDefinition(*this); } + +protected: + + /// The next style to use when adding a paragraph after this style. + wxString m_nextStyle; +}; + +/*! + * wxRichTextListStyleDefinition class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextListStyleDefinition: public wxRichTextParagraphStyleDefinition +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextListStyleDefinition); +public: + + /// Copy constructor + wxRichTextListStyleDefinition(const wxRichTextListStyleDefinition& def): wxRichTextParagraphStyleDefinition(def) { Init(); Copy(def); } + + /// Default constructor + wxRichTextListStyleDefinition(const wxString& name = wxEmptyString): + wxRichTextParagraphStyleDefinition(name) { Init(); } + + /// Destructor + virtual ~wxRichTextListStyleDefinition() {} + + /// Copies from def + void Copy(const wxRichTextListStyleDefinition& def); + + /// Assignment operator + void operator =(const wxRichTextListStyleDefinition& def) { Copy(def); } + + /// Equality operator + bool operator ==(const wxRichTextListStyleDefinition& def) const; + + /// Clones the object + virtual wxRichTextStyleDefinition* Clone() const wxOVERRIDE { return new wxRichTextListStyleDefinition(*this); } + + /// Sets/gets the attributes for the given level + void SetLevelAttributes(int i, const wxRichTextAttr& attr); + wxRichTextAttr* GetLevelAttributes(int i); + const wxRichTextAttr* GetLevelAttributes(int i) const; + + /// Convenience function for setting the major attributes for a list level specification + void SetAttributes(int i, int leftIndent, int leftSubIndent, int bulletStyle, const wxString& bulletSymbol = wxEmptyString); + + /// Finds the level corresponding to the given indentation + int FindLevelForIndent(int indent) const; + + /// Combine the base and list style with a paragraph style, using the given indent (from which + /// an appropriate level is found) + wxRichTextAttr CombineWithParagraphStyle(int indent, const wxRichTextAttr& paraStyle, wxRichTextStyleSheet* styleSheet = NULL); + + /// Combine the base and list style, using the given indent (from which + /// an appropriate level is found) + wxRichTextAttr GetCombinedStyle(int indent, wxRichTextStyleSheet* styleSheet = NULL); + + /// Combine the base and list style, using the given level from which + /// an appropriate level is found) + wxRichTextAttr GetCombinedStyleForLevel(int level, wxRichTextStyleSheet* styleSheet = NULL); + + /// Gets the number of available levels + int GetLevelCount() const { return 10; } + + /// Is this a numbered list? + bool IsNumbered(int i) const; + +protected: + + /// The styles for each level (up to 10) + wxRichTextAttr m_levelStyles[10]; +}; + +/*! + * wxRichTextBoxStyleDefinition class declaration, for box attributes in objects such as wxRichTextBox. + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextBoxStyleDefinition: public wxRichTextStyleDefinition +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextBoxStyleDefinition); +public: + + /// Copy constructor + wxRichTextBoxStyleDefinition(const wxRichTextBoxStyleDefinition& def): wxRichTextStyleDefinition(def) { Copy(def); } + + /// Default constructor + wxRichTextBoxStyleDefinition(const wxString& name = wxEmptyString): + wxRichTextStyleDefinition(name) {} + + // Destructor + virtual ~wxRichTextBoxStyleDefinition() {} + + /// Copies from def + void Copy(const wxRichTextBoxStyleDefinition& def); + + /// Assignment operator + void operator =(const wxRichTextBoxStyleDefinition& def) { Copy(def); } + + /// Equality operator + bool operator ==(const wxRichTextBoxStyleDefinition& def) const; + + /// Clones the object + virtual wxRichTextStyleDefinition* Clone() const wxOVERRIDE { return new wxRichTextBoxStyleDefinition(*this); } + +protected: +}; + +/*! + * The style sheet + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextStyleSheet: public wxObject +{ + wxDECLARE_CLASS(wxRichTextStyleSheet); + +public: + /// Constructors + wxRichTextStyleSheet(const wxRichTextStyleSheet& sheet) + : wxObject() + { + Init(); + Copy(sheet); + } + wxRichTextStyleSheet() { Init(); } + virtual ~wxRichTextStyleSheet(); + + /// Initialisation + void Init(); + + /// Copy + void Copy(const wxRichTextStyleSheet& sheet); + + /// Assignment + void operator=(const wxRichTextStyleSheet& sheet) { Copy(sheet); } + + /// Equality + bool operator==(const wxRichTextStyleSheet& sheet) const; + + /// Add a definition to the character style list + bool AddCharacterStyle(wxRichTextCharacterStyleDefinition* def); + + /// Add a definition to the paragraph style list + bool AddParagraphStyle(wxRichTextParagraphStyleDefinition* def); + + /// Add a definition to the list style list + bool AddListStyle(wxRichTextListStyleDefinition* def); + + /// Add a definition to the box style list + bool AddBoxStyle(wxRichTextBoxStyleDefinition* def); + + /// Add a definition to the appropriate style list + bool AddStyle(wxRichTextStyleDefinition* def); + + /// Remove a character style + bool RemoveCharacterStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false) { return RemoveStyle(m_characterStyleDefinitions, def, deleteStyle); } + + /// Remove a paragraph style + bool RemoveParagraphStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false) { return RemoveStyle(m_paragraphStyleDefinitions, def, deleteStyle); } + + /// Remove a list style + bool RemoveListStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false) { return RemoveStyle(m_listStyleDefinitions, def, deleteStyle); } + + /// Remove a box style + bool RemoveBoxStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false) { return RemoveStyle(m_boxStyleDefinitions, def, deleteStyle); } + + /// Remove a style + bool RemoveStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false); + + /// Find a character definition by name + wxRichTextCharacterStyleDefinition* FindCharacterStyle(const wxString& name, bool recurse = true) const { return (wxRichTextCharacterStyleDefinition*) FindStyle(m_characterStyleDefinitions, name, recurse); } + + /// Find a paragraph definition by name + wxRichTextParagraphStyleDefinition* FindParagraphStyle(const wxString& name, bool recurse = true) const { return (wxRichTextParagraphStyleDefinition*) FindStyle(m_paragraphStyleDefinitions, name, recurse); } + + /// Find a list definition by name + wxRichTextListStyleDefinition* FindListStyle(const wxString& name, bool recurse = true) const { return (wxRichTextListStyleDefinition*) FindStyle(m_listStyleDefinitions, name, recurse); } + + /// Find a box definition by name + wxRichTextBoxStyleDefinition* FindBoxStyle(const wxString& name, bool recurse = true) const { return (wxRichTextBoxStyleDefinition*) FindStyle(m_boxStyleDefinitions, name, recurse); } + + /// Find any definition by name + wxRichTextStyleDefinition* FindStyle(const wxString& name, bool recurse = true) const; + + /// Return the number of character styles + size_t GetCharacterStyleCount() const { return m_characterStyleDefinitions.GetCount(); } + + /// Return the number of paragraph styles + size_t GetParagraphStyleCount() const { return m_paragraphStyleDefinitions.GetCount(); } + + /// Return the number of list styles + size_t GetListStyleCount() const { return m_listStyleDefinitions.GetCount(); } + + /// Return the number of box styles + size_t GetBoxStyleCount() const { return m_boxStyleDefinitions.GetCount(); } + + /// Return the nth character style + wxRichTextCharacterStyleDefinition* GetCharacterStyle(size_t n) const { return (wxRichTextCharacterStyleDefinition*) m_characterStyleDefinitions.Item(n)->GetData(); } + + /// Return the nth paragraph style + wxRichTextParagraphStyleDefinition* GetParagraphStyle(size_t n) const { return (wxRichTextParagraphStyleDefinition*) m_paragraphStyleDefinitions.Item(n)->GetData(); } + + /// Return the nth list style + wxRichTextListStyleDefinition* GetListStyle(size_t n) const { return (wxRichTextListStyleDefinition*) m_listStyleDefinitions.Item(n)->GetData(); } + + /// Return the nth box style + wxRichTextBoxStyleDefinition* GetBoxStyle(size_t n) const { return (wxRichTextBoxStyleDefinition*) m_boxStyleDefinitions.Item(n)->GetData(); } + + /// Delete all styles + void DeleteStyles(); + + /// Insert into list of style sheets + bool InsertSheet(wxRichTextStyleSheet* before); + + /// Append to list of style sheets + bool AppendSheet(wxRichTextStyleSheet* after); + + /// Unlink from the list of style sheets + void Unlink(); + + /// Get/set next sheet + wxRichTextStyleSheet* GetNextSheet() const { return m_nextSheet; } + void SetNextSheet(wxRichTextStyleSheet* sheet) { m_nextSheet = sheet; } + + /// Get/set previous sheet + wxRichTextStyleSheet* GetPreviousSheet() const { return m_previousSheet; } + void SetPreviousSheet(wxRichTextStyleSheet* sheet) { m_previousSheet = sheet; } + + /// Sets and gets the name of the style sheet + void SetName(const wxString& name) { m_name = name; } + const wxString& GetName() const { return m_name; } + + /// Sets and gets the style description + void SetDescription(const wxString& descr) { m_description = descr; } + const wxString& GetDescription() const { return m_description; } + + /** + Returns the sheet's properties. + */ + wxRichTextProperties& GetProperties() { return m_properties; } + + /** + Returns the sheet's properties. + */ + const wxRichTextProperties& GetProperties() const { return m_properties; } + + /** + Sets the sheet's properties. + */ + void SetProperties(const wxRichTextProperties& props) { m_properties = props; } + +/// Implementation + + /// Add a definition to one of the style lists + bool AddStyle(wxList& list, wxRichTextStyleDefinition* def); + + /// Remove a style + bool RemoveStyle(wxList& list, wxRichTextStyleDefinition* def, bool deleteStyle); + + /// Find a definition by name + wxRichTextStyleDefinition* FindStyle(const wxList& list, const wxString& name, bool recurse = true) const; + +protected: + + wxString m_description; + wxString m_name; + + wxList m_characterStyleDefinitions; + wxList m_paragraphStyleDefinitions; + wxList m_listStyleDefinitions; + wxList m_boxStyleDefinitions; + + wxRichTextStyleSheet* m_previousSheet; + wxRichTextStyleSheet* m_nextSheet; + wxRichTextProperties m_properties; +}; + +#if wxUSE_HTML +/*! + * wxRichTextStyleListBox class declaration + * A listbox to display styles. + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextStyleListBox: public wxHtmlListBox +{ + wxDECLARE_CLASS(wxRichTextStyleListBox); + wxDECLARE_EVENT_TABLE(); + +public: + /// Which type of style definition is currently showing? + enum wxRichTextStyleType + { + wxRICHTEXT_STYLE_ALL, + wxRICHTEXT_STYLE_PARAGRAPH, + wxRICHTEXT_STYLE_CHARACTER, + wxRICHTEXT_STYLE_LIST, + wxRICHTEXT_STYLE_BOX + }; + + wxRichTextStyleListBox() + { + Init(); + } + wxRichTextStyleListBox(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0); + virtual ~wxRichTextStyleListBox(); + + void Init() + { + m_styleSheet = NULL; + m_richTextCtrl = NULL; + m_applyOnSelection = false; + m_styleType = wxRICHTEXT_STYLE_PARAGRAPH; + m_autoSetSelection = true; + } + + bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0); + + /// Creates a suitable HTML fragment for a definition + wxString CreateHTML(wxRichTextStyleDefinition* def) const; + + /// Associates the control with a style sheet + void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { m_styleSheet = styleSheet; } + wxRichTextStyleSheet* GetStyleSheet() const { return m_styleSheet; } + + /// Associates the control with a wxRichTextCtrl + void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_richTextCtrl = ctrl; } + wxRichTextCtrl* GetRichTextCtrl() const { return m_richTextCtrl; } + + /// Get style for index + wxRichTextStyleDefinition* GetStyle(size_t i) const ; + + /// Get index for style name + int GetIndexForStyle(const wxString& name) const ; + + /// Set selection for string, returning the index. + int SetStyleSelection(const wxString& name); + + /// Updates the list + void UpdateStyles(); + + /// Apply the style + void ApplyStyle(int i); + + /// Left click + void OnLeftDown(wxMouseEvent& event); + + /// Left double-click + void OnLeftDoubleClick(wxMouseEvent& event); + + /// Auto-select from style under caret in idle time + void OnIdle(wxIdleEvent& event); + + /// Convert units in tends of a millimetre to device units + int ConvertTenthsMMToPixels(wxDC& dc, int units) const; + + /// Can we set the selection based on the editor caret position? + /// Need to override this if being used in a combobox popup + virtual bool CanAutoSetSelection() { return m_autoSetSelection; } + virtual void SetAutoSetSelection(bool autoSet) { m_autoSetSelection = autoSet; } + + /// Set whether the style should be applied as soon as the item is selected (the default) + void SetApplyOnSelection(bool applyOnSel) { m_applyOnSelection = applyOnSel; } + bool GetApplyOnSelection() const { return m_applyOnSelection; } + + /// Set the style type to display + void SetStyleType(wxRichTextStyleType styleType) { m_styleType = styleType; UpdateStyles(); } + wxRichTextStyleType GetStyleType() const { return m_styleType; } + + /// Helper for listbox and combo control + static wxString GetStyleToShowInIdleTime(wxRichTextCtrl* ctrl, wxRichTextStyleType styleType); + +protected: + /// Returns the HTML for this item + virtual wxString OnGetItem(size_t n) const wxOVERRIDE; + +private: + + wxRichTextStyleSheet* m_styleSheet; + wxRichTextCtrl* m_richTextCtrl; + bool m_applyOnSelection; // if true, applies style on selection + wxRichTextStyleType m_styleType; // style type to display + bool m_autoSetSelection; + wxArrayString m_styleNames; +}; + +/*! + * wxRichTextStyleListCtrl class declaration + * This is a container for the list control plus a combobox to switch between + * style types. + */ + +#define wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR 0x1000 + +class WXDLLIMPEXP_RICHTEXT wxRichTextStyleListCtrl: public wxControl +{ + wxDECLARE_CLASS(wxRichTextStyleListCtrl); + wxDECLARE_EVENT_TABLE(); + +public: + + /// Constructors + wxRichTextStyleListCtrl() + { + Init(); + } + + wxRichTextStyleListCtrl(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0); + + /// Constructors + virtual ~wxRichTextStyleListCtrl(); + + /// Member initialisation + void Init() + { + m_styleListBox = NULL; + m_styleChoice = NULL; + m_dontUpdate = false; + } + + /// Creates the windows + bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0); + + /// Updates the style list box + void UpdateStyles(); + + /// Associates the control with a style sheet + void SetStyleSheet(wxRichTextStyleSheet* styleSheet); + wxRichTextStyleSheet* GetStyleSheet() const; + + /// Associates the control with a wxRichTextCtrl + void SetRichTextCtrl(wxRichTextCtrl* ctrl); + wxRichTextCtrl* GetRichTextCtrl() const; + + /// Set/get the style type to display + void SetStyleType(wxRichTextStyleListBox::wxRichTextStyleType styleType); + wxRichTextStyleListBox::wxRichTextStyleType GetStyleType() const; + + /// Get the choice index for style type + int StyleTypeToIndex(wxRichTextStyleListBox::wxRichTextStyleType styleType); + + /// Get the style type for choice index + wxRichTextStyleListBox::wxRichTextStyleType StyleIndexToType(int i); + + /// Get the listbox + wxRichTextStyleListBox* GetStyleListBox() const { return m_styleListBox; } + + /// Get the choice + wxChoice* GetStyleChoice() const { return m_styleChoice; } + + /// React to style type choice + void OnChooseType(wxCommandEvent& event); + + /// Lay out the controls + void OnSize(wxSizeEvent& event); + +private: + + wxRichTextStyleListBox* m_styleListBox; + wxChoice* m_styleChoice; + bool m_dontUpdate; +}; + +#if wxUSE_COMBOCTRL + +/*! + * Style drop-down for a wxComboCtrl + */ + +class wxRichTextStyleComboPopup : public wxRichTextStyleListBox, public wxComboPopup +{ +public: + virtual void Init() wxOVERRIDE + { + m_itemHere = -1; // hot item in list + m_value = -1; + } + + virtual bool Create( wxWindow* parent ) wxOVERRIDE; + + virtual wxWindow *GetControl() wxOVERRIDE { return this; } + + virtual void SetStringValue( const wxString& s ) wxOVERRIDE; + + virtual wxString GetStringValue() const wxOVERRIDE; + + /// Can we set the selection based on the editor caret position? + // virtual bool CanAutoSetSelection() { return ((m_combo == NULL) || !m_combo->IsPopupShown()); } + virtual bool CanAutoSetSelection() wxOVERRIDE { return false; } + + // + // Popup event handlers + // + + // Mouse hot-tracking + void OnMouseMove(wxMouseEvent& event); + + // On mouse left, set the value and close the popup + void OnMouseClick(wxMouseEvent& WXUNUSED(event)); + +protected: + + int m_itemHere; // hot item in popup + int m_value; + +private: + wxDECLARE_EVENT_TABLE(); +}; + +/*! + * wxRichTextStyleComboCtrl + * A combo for applying styles. + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextStyleComboCtrl: public wxComboCtrl +{ + wxDECLARE_CLASS(wxRichTextStyleComboCtrl); + wxDECLARE_EVENT_TABLE(); + +public: + wxRichTextStyleComboCtrl() + { + Init(); + } + + wxRichTextStyleComboCtrl(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxCB_READONLY) + { + Init(); + Create(parent, id, pos, size, style); + } + + virtual ~wxRichTextStyleComboCtrl() {} + + void Init() + { + m_stylePopup = NULL; + } + + bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0); + + /// Updates the list + void UpdateStyles() { m_stylePopup->UpdateStyles(); } + + /// Associates the control with a style sheet + void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { m_stylePopup->SetStyleSheet(styleSheet); } + wxRichTextStyleSheet* GetStyleSheet() const { return m_stylePopup->GetStyleSheet(); } + + /// Associates the control with a wxRichTextCtrl + void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_stylePopup->SetRichTextCtrl(ctrl); } + wxRichTextCtrl* GetRichTextCtrl() const { return m_stylePopup->GetRichTextCtrl(); } + + /// Gets the style popup + wxRichTextStyleComboPopup* GetStylePopup() const { return m_stylePopup; } + + /// Auto-select from style under caret in idle time + void OnIdle(wxIdleEvent& event); + +protected: + wxRichTextStyleComboPopup* m_stylePopup; +}; + +#endif + // wxUSE_COMBOCTRL + +#endif + // wxUSE_HTML + +#endif + // wxUSE_RICHTEXT + +#endif + // _WX_RICHTEXTSTYLES_H_ diff --git a/lib/wxWidgets/include/wx/richtext/richtextsymboldlg.h b/lib/wxWidgets/include/wx/richtext/richtextsymboldlg.h new file mode 100644 index 0000000..0096e51 --- /dev/null +++ b/lib/wxWidgets/include/wx/richtext/richtextsymboldlg.h @@ -0,0 +1,375 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextsymboldlg.h +// Purpose: Declares the symbol picker dialog. +// Author: Julian Smart +// Modified by: +// Created: 10/5/2006 3:11:58 PM +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _RICHTEXTSYMBOLDLG_H_ +#define _RICHTEXTSYMBOLDLG_H_ + +/*! + * Includes + */ + +#include "wx/richtext/richtextuicustomization.h" +#include "wx/dialog.h" +#include "wx/vscroll.h" + +/*! + * Forward declarations + */ + +class WXDLLIMPEXP_FWD_CORE wxStaticText; +class WXDLLIMPEXP_FWD_CORE wxComboBox; +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; + +////@begin forward declarations +class wxSymbolListCtrl; +class wxStdDialogButtonSizer; +////@end forward declarations + +// __UNICODE__ is a symbol used by DialogBlocks-generated code. +#ifndef __UNICODE__ +#if wxUSE_UNICODE +#define __UNICODE__ +#endif +#endif + +/*! + * Symbols + */ + +#define SYMBOL_WXSYMBOLPICKERDIALOG_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxCLOSE_BOX) +#define SYMBOL_WXSYMBOLPICKERDIALOG_TITLE wxGetTranslation("Symbols") +#define SYMBOL_WXSYMBOLPICKERDIALOG_IDNAME ID_SYMBOLPICKERDIALOG +#define SYMBOL_WXSYMBOLPICKERDIALOG_SIZE wxSize(400, 300) +#define SYMBOL_WXSYMBOLPICKERDIALOG_POSITION wxDefaultPosition + +/*! + * wxSymbolPickerDialog class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxSymbolPickerDialog: public wxDialog +{ + wxDECLARE_DYNAMIC_CLASS(wxSymbolPickerDialog); + wxDECLARE_EVENT_TABLE(); + DECLARE_HELP_PROVISION() + +public: + /// Constructors + wxSymbolPickerDialog( ); + wxSymbolPickerDialog( const wxString& symbol, const wxString& fontName, const wxString& normalTextFont, + wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = SYMBOL_WXSYMBOLPICKERDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXSYMBOLPICKERDIALOG_POSITION, const wxSize& size = SYMBOL_WXSYMBOLPICKERDIALOG_SIZE, long style = SYMBOL_WXSYMBOLPICKERDIALOG_STYLE ); + + /// Creation + bool Create( const wxString& symbol, const wxString& fontName, const wxString& normalTextFont, + wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = SYMBOL_WXSYMBOLPICKERDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXSYMBOLPICKERDIALOG_POSITION, const wxSize& size = SYMBOL_WXSYMBOLPICKERDIALOG_SIZE, long style = SYMBOL_WXSYMBOLPICKERDIALOG_STYLE ); + + /// Initialises members variables + void Init(); + + /// Creates the controls and sizers + void CreateControls(); + + /// Update the display + void UpdateSymbolDisplay(bool updateSymbolList = true, bool showAtSubset = true); + + /// Respond to symbol selection + void OnSymbolSelected( wxCommandEvent& event ); + + /// Set Unicode mode + void SetUnicodeMode(bool unicodeMode); + + /// Show at the current subset selection + void ShowAtSubset(); + + /// Get the selected symbol character + int GetSymbolChar() const; + + /// Is there a selection? + bool HasSelection() const { return !m_symbol.IsEmpty(); } + + /// Specifying normal text? + bool UseNormalFont() const { return m_fontName.IsEmpty(); } + + /// Should we show tooltips? + static bool ShowToolTips() { return sm_showToolTips; } + + /// Determines whether tooltips will be shown + static void SetShowToolTips(bool show) { sm_showToolTips = show; } + + /// Data transfer + virtual bool TransferDataToWindow() wxOVERRIDE; + +////@begin wxSymbolPickerDialog event handler declarations + + /// wxEVT_COMBOBOX event handler for ID_SYMBOLPICKERDIALOG_FONT + void OnFontCtrlSelected( wxCommandEvent& event ); + +#if defined(__UNICODE__) + /// wxEVT_COMBOBOX event handler for ID_SYMBOLPICKERDIALOG_SUBSET + void OnSubsetSelected( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_SYMBOLPICKERDIALOG_SUBSET + void OnSymbolpickerdialogSubsetUpdate( wxUpdateUIEvent& event ); + +#endif +#if defined(__UNICODE__) + /// wxEVT_COMBOBOX event handler for ID_SYMBOLPICKERDIALOG_FROM + void OnFromUnicodeSelected( wxCommandEvent& event ); + +#endif + /// wxEVT_UPDATE_UI event handler for wxID_OK + void OnOkUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_BUTTON event handler for wxID_HELP + void OnHelpClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for wxID_HELP + void OnHelpUpdate( wxUpdateUIEvent& event ); + +////@end wxSymbolPickerDialog event handler declarations + +////@begin wxSymbolPickerDialog member function declarations + + wxString GetFontName() const { return m_fontName ; } + void SetFontName(const wxString& value) { m_fontName = value; } + + bool GetFromUnicode() const { return m_fromUnicode ; } + void SetFromUnicode(bool value) { m_fromUnicode = value ; } + + wxString GetNormalTextFontName() const { return m_normalTextFontName ; } + void SetNormalTextFontName(const wxString& value) { m_normalTextFontName = value; } + + wxString GetSymbol() const { return m_symbol ; } + void SetSymbol(const wxString& value) { m_symbol = value; } + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end wxSymbolPickerDialog member function declarations + +////@begin wxSymbolPickerDialog member variables + wxComboBox* m_fontCtrl; +#if defined(__UNICODE__) + wxComboBox* m_subsetCtrl; +#endif + wxSymbolListCtrl* m_symbolsCtrl; + wxStaticText* m_symbolStaticCtrl; + wxTextCtrl* m_characterCodeCtrl; +#if defined(__UNICODE__) + wxComboBox* m_fromUnicodeCtrl; +#endif + wxStdDialogButtonSizer* m_stdButtonSizer; + wxString m_fontName; + bool m_fromUnicode; + wxString m_normalTextFontName; + wxString m_symbol; + /// Control identifiers + enum { + ID_SYMBOLPICKERDIALOG = 10600, + ID_SYMBOLPICKERDIALOG_FONT = 10602, + ID_SYMBOLPICKERDIALOG_SUBSET = 10605, + ID_SYMBOLPICKERDIALOG_LISTCTRL = 10608, + ID_SYMBOLPICKERDIALOG_CHARACTERCODE = 10601, + ID_SYMBOLPICKERDIALOG_FROM = 10603 + }; +////@end wxSymbolPickerDialog member variables + + bool m_dontUpdate; + static bool sm_showToolTips; +}; + +/*! + * The scrolling symbol list. + */ + +class WXDLLIMPEXP_RICHTEXT wxSymbolListCtrl : public wxVScrolledWindow +{ +public: + // constructors and such + // --------------------- + + // default constructor, you must call Create() later + wxSymbolListCtrl() { Init(); } + + // normal constructor which calls Create() internally + wxSymbolListCtrl(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)) + { + Init(); + + (void)Create(parent, id, pos, size, style, name); + } + + // really creates the control and sets the initial number of items in it + // (which may be changed later with SetItemCount()) + // + // returns true on success or false if the control couldn't be created + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)); + + // dtor does some internal cleanup + virtual ~wxSymbolListCtrl(); + + + // accessors + // --------- + + // set the current font + virtual bool SetFont(const wxFont& font) wxOVERRIDE; + + // set Unicode/ASCII mode + void SetUnicodeMode(bool unicodeMode); + + // get the index of the currently selected item or wxNOT_FOUND if there is no selection + int GetSelection() const; + + // is this item selected? + bool IsSelected(int item) const; + + // is this item the current one? + bool IsCurrentItem(int item) const { return item == m_current; } + + // get the margins around each cell + wxPoint GetMargins() const { return m_ptMargins; } + + // get the background colour of selected cells + const wxColour& GetSelectionBackground() const { return m_colBgSel; } + + // operations + // ---------- + + // set the selection to the specified item, if it is wxNOT_FOUND the + // selection is unset + void SetSelection(int selection); + + // make this item visible + void EnsureVisible(int item); + + // set the margins: horizontal margin is the distance between the window + // border and the item contents while vertical margin is half of the + // distance between items + // + // by default both margins are 0 + void SetMargins(const wxPoint& pt); + void SetMargins(wxCoord x, wxCoord y) { SetMargins(wxPoint(x, y)); } + + // set the cell size + void SetCellSize(const wxSize& sz) { m_cellSize = sz; } + const wxSize& GetCellSize() const { return m_cellSize; } + + // change the background colour of the selected cells + void SetSelectionBackground(const wxColour& col); + + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // Get min/max symbol values + int GetMinSymbolValue() const { return m_minSymbolValue; } + int GetMaxSymbolValue() const { return m_maxSymbolValue; } + + // Respond to size change + void OnSize(wxSizeEvent& event); + +protected: + + // draws a line of symbols + virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const; + + // gets the line height + virtual wxCoord OnGetRowHeight(size_t line) const wxOVERRIDE; + + // event handlers + void OnPaint(wxPaintEvent& event); + void OnKeyDown(wxKeyEvent& event); + void OnLeftDown(wxMouseEvent& event); + void OnLeftDClick(wxMouseEvent& event); + + // common part of all ctors + void Init(); + + // send the wxEVT_LISTBOX event + void SendSelectedEvent(); + + // change the current item (in single selection listbox it also implicitly + // changes the selection); current may be wxNOT_FOUND in which case there + // will be no current item any more + // + // return true if the current item changed, false otherwise + bool DoSetCurrent(int current); + + // flags for DoHandleItemClick + enum + { + ItemClick_Shift = 1, // item shift-clicked + ItemClick_Ctrl = 2, // ctrl + ItemClick_Kbd = 4 // item selected from keyboard + }; + + // common part of keyboard and mouse handling processing code + void DoHandleItemClick(int item, int flags); + + // calculate line number from symbol value + int SymbolValueToLineNumber(int item); + + // initialise control from current min/max values + void SetupCtrl(bool scrollToSelection = true); + + // hit testing + int HitTest(const wxPoint& pt); + +private: + // the current item or wxNOT_FOUND + int m_current; + + // margins + wxPoint m_ptMargins; + + // the selection bg colour + wxColour m_colBgSel; + + // double buffer + wxBitmap* m_doubleBuffer; + + // cell size + wxSize m_cellSize; + + // minimum and maximum symbol value + int m_minSymbolValue; + + // minimum and maximum symbol value + int m_maxSymbolValue; + + // number of items per line + int m_symbolsPerLine; + + // Unicode/ASCII mode + bool m_unicodeMode; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxSymbolListCtrl); + wxDECLARE_ABSTRACT_CLASS(wxSymbolListCtrl); +}; + +#endif + // _RICHTEXTSYMBOLDLG_H_ diff --git a/lib/wxWidgets/include/wx/richtext/richtexttabspage.h b/lib/wxWidgets/include/wx/richtext/richtexttabspage.h new file mode 100644 index 0000000..5f6e8a5 --- /dev/null +++ b/lib/wxWidgets/include/wx/richtext/richtexttabspage.h @@ -0,0 +1,131 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtexttabspage.h +// Purpose: Declares the rich text formatting dialog tabs page. +// Author: Julian Smart +// Modified by: +// Created: 10/4/2006 8:03:20 AM +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _RICHTEXTTABSPAGE_H_ +#define _RICHTEXTTABSPAGE_H_ + +/*! + * Includes + */ + +#include "wx/richtext/richtextdialogpage.h" + +////@begin includes +////@end includes + +/*! + * Forward declarations + */ + +////@begin forward declarations +////@end forward declarations + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define SYMBOL_WXRICHTEXTTABSPAGE_STYLE wxTAB_TRAVERSAL +#define SYMBOL_WXRICHTEXTTABSPAGE_TITLE wxEmptyString +#define SYMBOL_WXRICHTEXTTABSPAGE_IDNAME ID_RICHTEXTTABSPAGE +#define SYMBOL_WXRICHTEXTTABSPAGE_SIZE wxSize(400, 300) +#define SYMBOL_WXRICHTEXTTABSPAGE_POSITION wxDefaultPosition +////@end control identifiers + +/*! + * wxRichTextTabsPage class declaration + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextTabsPage: public wxRichTextDialogPage +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextTabsPage); + wxDECLARE_EVENT_TABLE(); + DECLARE_HELP_PROVISION() + +public: + /// Constructors + wxRichTextTabsPage( ); + wxRichTextTabsPage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTTABSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTTABSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTTABSPAGE_STYLE ); + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTTABSPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTTABSPAGE_SIZE, long style = SYMBOL_WXRICHTEXTTABSPAGE_STYLE ); + + /// Creates the controls and sizers + void CreateControls(); + + /// Initialise members + void Init(); + + /// Transfer data from/to window + virtual bool TransferDataFromWindow() wxOVERRIDE; + virtual bool TransferDataToWindow() wxOVERRIDE; + + /// Sorts the tab array + virtual void SortTabs(); + + /// Gets the attributes associated with the main formatting dialog + wxRichTextAttr* GetAttributes(); + +////@begin wxRichTextTabsPage event handler declarations + + /// wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTTABSPAGE_TABLIST + void OnTablistSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTTABSPAGE_NEW_TAB + void OnNewTabClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTTABSPAGE_NEW_TAB + void OnNewTabUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTTABSPAGE_DELETE_TAB + void OnDeleteTabClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTTABSPAGE_DELETE_TAB + void OnDeleteTabUpdate( wxUpdateUIEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTTABSPAGE_DELETE_ALL_TABS + void OnDeleteAllTabsClick( wxCommandEvent& event ); + + /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTTABSPAGE_DELETE_ALL_TABS + void OnDeleteAllTabsUpdate( wxUpdateUIEvent& event ); + +////@end wxRichTextTabsPage event handler declarations + +////@begin wxRichTextTabsPage member function declarations + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end wxRichTextTabsPage member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + +////@begin wxRichTextTabsPage member variables + wxTextCtrl* m_tabEditCtrl; + wxListBox* m_tabListCtrl; + /// Control identifiers + enum { + ID_RICHTEXTTABSPAGE = 10200, + ID_RICHTEXTTABSPAGE_TABEDIT = 10213, + ID_RICHTEXTTABSPAGE_TABLIST = 10214, + ID_RICHTEXTTABSPAGE_NEW_TAB = 10201, + ID_RICHTEXTTABSPAGE_DELETE_TAB = 10202, + ID_RICHTEXTTABSPAGE_DELETE_ALL_TABS = 10203 + }; +////@end wxRichTextTabsPage member variables + + bool m_tabsPresent; +}; + +#endif + // _RICHTEXTTABSPAGE_H_ diff --git a/lib/wxWidgets/include/wx/richtext/richtextuicustomization.h b/lib/wxWidgets/include/wx/richtext/richtextuicustomization.h new file mode 100644 index 0000000..381bb0a --- /dev/null +++ b/lib/wxWidgets/include/wx/richtext/richtextuicustomization.h @@ -0,0 +1,128 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextuicustomization.h +// Purpose: UI customization base class for wxRTC +// Author: Julian Smart +// Modified by: +// Created: 2010-11-14 +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RICHTEXTUICUSTOMIZATION_H_ +#define _WX_RICHTEXTUICUSTOMIZATION_H_ + +#if wxUSE_RICHTEXT + +#include "wx/window.h" + +/** + @class wxRichTextUICustomization + The base class for functionality to plug in to various rich text control dialogs, + currently allowing the application to respond to Help button clicks without the + need to derive new dialog classes. + + The application will typically have calls like this in its initialisation: + + wxRichTextFormattingDialog::GetHelpInfo().SetHelpId(ID_HELP_FORMATTINGDIALOG); + wxRichTextFormattingDialog::GetHelpInfo().SetUICustomization(& wxGetApp().GetRichTextUICustomization()); + wxRichTextBordersPage::GetHelpInfo().SetHelpId(ID_HELP_BORDERSPAGE); + + Only the wxRichTextFormattingDialog class needs to have its customization object and help id set, + though the application set them for individual pages if it wants. + **/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextUICustomization +{ +public: + wxRichTextUICustomization() {} + virtual ~wxRichTextUICustomization() {} + + /// Show the help given the current active window, and a help topic id. + virtual bool ShowHelp(wxWindow* win, long id) = 0; +}; + +/** + @class wxRichTextHelpInfo + This class is used as a static member of dialogs, to store the help topic for the dialog + and also the customization object that will allow help to be shown appropriately for the application. + **/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextHelpInfo +{ +public: + wxRichTextHelpInfo() + { + m_helpTopic = -1; + m_uiCustomization = NULL; + } + virtual ~wxRichTextHelpInfo() {} + + virtual bool ShowHelp(wxWindow* win) + { + if ( !m_uiCustomization || m_helpTopic == -1 ) + return false; + + return m_uiCustomization->ShowHelp(win, m_helpTopic); + } + + /// Get the help topic identifier. + long GetHelpId() const { return m_helpTopic; } + + /// Set the help topic identifier. + void SetHelpId(long id) { m_helpTopic = id; } + + /// Get the UI customization object. + wxRichTextUICustomization* GetUICustomization() const { return m_uiCustomization; } + + /// Set the UI customization object. + void SetUICustomization(wxRichTextUICustomization* customization) { m_uiCustomization = customization; } + + /// Is there a valid help topic id? + bool HasHelpId() const { return m_helpTopic != -1; } + + /// Is there a valid customization object? + bool HasUICustomization() const { return m_uiCustomization != NULL; } + +protected: + wxRichTextUICustomization* m_uiCustomization; + long m_helpTopic; +}; + +/// Add this to the base class of dialogs + +#define DECLARE_BASE_CLASS_HELP_PROVISION() \ + virtual long GetHelpId() const = 0; \ + virtual wxRichTextUICustomization* GetUICustomization() const = 0; \ + virtual bool ShowHelp(wxWindow* win) = 0; + +/// A macro to make it easy to add help topic provision and UI customization +/// to a class. Optionally, add virtual functions to a base class +/// using DECLARE_BASE_CLASS_HELP_PROVISION. This means that the formatting dialog +/// can obtain help topics from its individual pages without needing +/// to know in advance what page classes are being used, allowing for extension +/// of the formatting dialog. + +#define DECLARE_HELP_PROVISION() \ + wxWARNING_SUPPRESS_MISSING_OVERRIDE() \ + virtual long GetHelpId() const { return sm_helpInfo.GetHelpId(); } \ + virtual void SetHelpId(long id) { sm_helpInfo.SetHelpId(id); } \ + virtual wxRichTextUICustomization* GetUICustomization() const { return sm_helpInfo.GetUICustomization(); } \ + virtual void SetUICustomization(wxRichTextUICustomization* customization) { sm_helpInfo.SetUICustomization(customization); } \ + virtual bool ShowHelp(wxWindow* win) { return sm_helpInfo.ShowHelp(win); } \ + wxWARNING_RESTORE_MISSING_OVERRIDE() \ +public: \ + static wxRichTextHelpInfo& GetHelpInfo() { return sm_helpInfo; }\ +protected: \ + static wxRichTextHelpInfo sm_helpInfo; \ +public: + +/// Add this to the implementation file for each dialog that needs help provision. + +#define IMPLEMENT_HELP_PROVISION(theClass) \ + wxRichTextHelpInfo theClass::sm_helpInfo; + +#endif + // wxUSE_RICHTEXT + +#endif + // _WX_RICHTEXTUICUSTOMIZATION_H_ diff --git a/lib/wxWidgets/include/wx/richtext/richtextxml.h b/lib/wxWidgets/include/wx/richtext/richtextxml.h new file mode 100644 index 0000000..979fa09 --- /dev/null +++ b/lib/wxWidgets/include/wx/richtext/richtextxml.h @@ -0,0 +1,242 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/richtext/richtextxml.h +// Purpose: XML and HTML I/O for wxRichTextCtrl +// Author: Julian Smart +// Modified by: +// Created: 2005-09-30 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RICHTEXTXML_H_ +#define _WX_RICHTEXTXML_H_ + +/*! + * Includes + */ + +#include "wx/hashmap.h" +#include "wx/richtext/richtextbuffer.h" +#include "wx/richtext/richtextstyles.h" + +#if wxUSE_RICHTEXT && wxUSE_XML + +/*! + @class wxRichTextXMLHelper + A utility class to help with XML import/export, that can be used outside + saving a buffer if needed. + */ + +class WXDLLIMPEXP_RICHTEXT wxRichTextXMLHelper: public wxObject +{ +public: + wxRichTextXMLHelper() { Init(); } + wxRichTextXMLHelper(const wxString& enc) { Init(); SetupForSaving(enc); } + ~wxRichTextXMLHelper(); + + void Init(); + + void SetupForSaving(const wxString& enc); + + void Clear(); + + void SetFileEncoding(const wxString& encoding) { m_fileEncoding = encoding; } + const wxString& GetFileEncoding() const { return m_fileEncoding; } + + // Convert a colour to a 6-digit hex string + static wxString ColourToHexString(const wxColour& col); + + // Convert 6-digit hex string to a colour + static wxColour HexStringToColour(const wxString& hex); + + static wxString MakeString(const int& v) { return wxString::Format(wxT("%d"), v); } + static wxString MakeString(const long& v) { return wxString::Format(wxT("%ld"), v); } + static wxString MakeString(const double& v) { return wxString::Format(wxS("%.2f"), v); } + static wxString MakeString(const wxString& s) { return s; } + static wxString MakeString(const wxColour& col) { return wxT("#") + ColourToHexString(col); } + + static bool HasParam(wxXmlNode* node, const wxString& param); + static wxXmlNode *GetParamNode(wxXmlNode* node, const wxString& param); + static wxString GetNodeContent(wxXmlNode *node); + static wxString GetParamValue(wxXmlNode *node, const wxString& param); + static wxString GetText(wxXmlNode *node, const wxString& param = wxEmptyString); + static wxXmlNode* FindNode(wxXmlNode* node, const wxString& name); + + static wxString AttributeToXML(const wxString& str); + + static bool RichTextFixFaceName(wxString& facename); + static long ColourStringToLong(const wxString& colStr); + static wxTextAttrDimension ParseDimension(const wxString& dimStr); + + // Make a string from the given property. This can be overridden for custom variants. + virtual wxString MakeStringFromProperty(const wxVariant& var); + + // Create a proprty from the string read from the XML file. + virtual wxVariant MakePropertyFromString(const wxString& name, const wxString& value, const wxString& type); + + // Import properties + virtual bool ImportProperties(wxRichTextProperties& properties, wxXmlNode* node); + + virtual bool ImportStyle(wxRichTextAttr& attr, wxXmlNode* node, bool isPara = false); + virtual bool ImportStyleDefinition(wxRichTextStyleSheet* sheet, wxXmlNode* node); + + // Get flags, as per handler flags + int GetFlags() const { return m_flags; } + void SetFlags(int flags) { m_flags = flags; } + +#if wxRICHTEXT_HAVE_DIRECT_OUTPUT + // write string to output + static void OutputString(wxOutputStream& stream, const wxString& str, + wxMBConv *convMem, wxMBConv *convFile); + + static void OutputIndentation(wxOutputStream& stream, int indent); + + // Same as above, but create entities first. + // Translates '<' to "<", '>' to ">" and '&' to "&" + static void OutputStringEnt(wxOutputStream& stream, const wxString& str, + wxMBConv *convMem, wxMBConv *convFile); + + void OutputString(wxOutputStream& stream, const wxString& str); + void OutputStringEnt(wxOutputStream& stream, const wxString& str); + + static void AddString(wxString& str, const int& v) { str << wxString::Format(wxT("%d"), v); } + static void AddString(wxString& str, const long& v) { str << wxString::Format(wxT("%ld"), v); } + static void AddString(wxString& str, const double& v) { str << wxString::Format(wxS("%.2f"), v); } + static void AddString(wxString& str, const wxChar* s) { str << s; } + static void AddString(wxString& str, const wxString& s) { str << s; } + static void AddString(wxString& str, const wxColour& col) { str << wxT("#") << ColourToHexString(col); } + + static void AddAttribute(wxString& str, const wxString& name, const int& v); + static void AddAttribute(wxString& str, const wxString& name, const long& v); + static void AddAttribute(wxString& str, const wxString& name, const double& v); + static void AddAttribute(wxString& str, const wxString& name, const wxChar* s); + static void AddAttribute(wxString& str, const wxString& name, const wxString& s); + static void AddAttribute(wxString& str, const wxString& name, const wxColour& col); + static void AddAttribute(wxString& str, const wxString& name, const wxTextAttrDimension& dim); + static void AddAttribute(wxString& str, const wxString& rootName, const wxTextAttrDimensions& dims); + static void AddAttribute(wxString& str, const wxString& rootName, const wxTextAttrBorder& border); + static void AddAttribute(wxString& str, const wxString& rootName, const wxTextAttrBorders& borders); + + /// Create a string containing style attributes + static wxString AddAttributes(const wxRichTextAttr& attr, bool isPara = false); + + /// Create a string containing style attributes, plus further object 'attributes' (shown, id) + static wxString AddAttributes(wxRichTextObject* obj, bool isPara = false); + + virtual bool ExportStyleDefinition(wxOutputStream& stream, wxRichTextStyleDefinition* def, int level); + + virtual bool WriteProperties(wxOutputStream& stream, const wxRichTextProperties& properties, int level); +#endif + +#if wxRICHTEXT_HAVE_XMLDOCUMENT_OUTPUT + static void AddAttribute(wxXmlNode* node, const wxString& name, const int& v); + static void AddAttribute(wxXmlNode* node, const wxString& name, const long& v); + static void AddAttribute(wxXmlNode* node, const wxString& name, const double& v); + static void AddAttribute(wxXmlNode* node, const wxString& name, const wxString& s); + static void AddAttribute(wxXmlNode* node, const wxString& name, const wxColour& col); + static void AddAttribute(wxXmlNode* node, const wxString& name, const wxTextAttrDimension& dim); + static void AddAttribute(wxXmlNode* node, const wxString& rootName, const wxTextAttrDimensions& dims); + static void AddAttribute(wxXmlNode* node, const wxString& rootName, const wxTextAttrBorder& border); + static void AddAttribute(wxXmlNode* node, const wxString& rootName, const wxTextAttrBorders& borders); + + static bool AddAttributes(wxXmlNode* node, wxRichTextAttr& attr, bool isPara = false); + static bool AddAttributes(wxXmlNode* node, wxRichTextObject* obj, bool isPara = false); + + virtual bool ExportStyleDefinition(wxXmlNode* parent, wxRichTextStyleDefinition* def); + + // Write the properties + virtual bool WriteProperties(wxXmlNode* node, const wxRichTextProperties& properties); +#endif + +public: + +#if wxRICHTEXT_HAVE_DIRECT_OUTPUT + // Used during saving + wxMBConv* m_convMem; + wxMBConv* m_convFile; + bool m_deleteConvFile; +#endif + + wxString m_fileEncoding; + int m_flags; +}; + +/*! + @class wxRichTextXMLHandler + + Implements XML loading and saving. Two methods of saving are included: + writing directly to a text stream, and populating an wxXmlDocument + before writing it. The former method is considerably faster, so we favour + that one, even though the code is a little less elegant. + */ + +class WXDLLIMPEXP_FWD_XML wxXmlNode; +class WXDLLIMPEXP_FWD_XML wxXmlDocument; + +class WXDLLIMPEXP_RICHTEXT wxRichTextXMLHandler: public wxRichTextFileHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextXMLHandler); +public: + wxRichTextXMLHandler(const wxString& name = wxT("XML"), const wxString& ext = wxT("xml"), int type = wxRICHTEXT_TYPE_XML) + : wxRichTextFileHandler(name, ext, type) + { Init(); } + + void Init(); + +#if wxUSE_STREAMS + +#if wxRICHTEXT_HAVE_DIRECT_OUTPUT + /// Recursively export an object + bool ExportXML(wxOutputStream& stream, wxRichTextObject& obj, int level); +#endif + +#if wxRICHTEXT_HAVE_XMLDOCUMENT_OUTPUT + bool ExportXML(wxXmlNode* parent, wxRichTextObject& obj); +#endif + + /// Recursively import an object + bool ImportXML(wxRichTextBuffer* buffer, wxRichTextObject* obj, wxXmlNode* node); +#endif + + /// Creates an object given an XML element name + virtual wxRichTextObject* CreateObjectForXMLName(wxRichTextObject* parent, const wxString& name) const; + + /// Can we save using this handler? + virtual bool CanSave() const wxOVERRIDE { return true; } + + /// Can we load using this handler? + virtual bool CanLoad() const wxOVERRIDE { return true; } + + /// Returns the XML helper object, implementing functionality + /// that can be reused elsewhere. + wxRichTextXMLHelper& GetHelper() { return m_helper; } + +// Implementation + + /** + Call with XML node name, C++ class name so that wxRTC can read in the node. + If you add a custom object, call this. + */ + static void RegisterNodeName(const wxString& nodeName, const wxString& className) { sm_nodeNameToClassMap[nodeName] = className; } + + /** + Cleans up the mapping between node name and C++ class. + */ + static void ClearNodeToClassMap() { sm_nodeNameToClassMap.clear(); } + +protected: +#if wxUSE_STREAMS + virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream) wxOVERRIDE; + virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream) wxOVERRIDE; +#endif + + wxRichTextXMLHelper m_helper; + + static wxStringToStringHashMap sm_nodeNameToClassMap; +}; + +#endif + // wxUSE_RICHTEXT && wxUSE_XML + +#endif + // _WX_RICHTEXTXML_H_ diff --git a/lib/wxWidgets/include/wx/richtooltip.h b/lib/wxWidgets/include/wx/richtooltip.h new file mode 100644 index 0000000..f63166f --- /dev/null +++ b/lib/wxWidgets/include/wx/richtooltip.h @@ -0,0 +1,103 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/richtooltip.h +// Purpose: Declaration of wxRichToolTip class. +// Author: Vadim Zeitlin +// Created: 2011-10-07 +// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RICHTOOLTIP_H_ +#define _WX_RICHTOOLTIP_H_ + +#include "wx/defs.h" + +#if wxUSE_RICHTOOLTIP + +#include "wx/colour.h" + +class WXDLLIMPEXP_FWD_CORE wxBitmapBundle; +class WXDLLIMPEXP_FWD_CORE wxFont; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +class wxRichToolTipImpl; + +// This enum describes the kind of the tip shown which combines both the tip +// position and appearance because the two are related (when the tip is +// positioned asymmetrically, a right handed triangle is used but an +// equilateral one when it's in the middle of a side). +// +// Automatic selects the tip appearance best suited for the current platform +// and the position best suited for the window the tooltip is shown for, i.e. +// chosen in such a way that the tooltip is always fully on screen. +// +// Other values describe the position of the tooltip itself, not the window it +// relates to. E.g. wxTipKind_Top places the tip on the top of the tooltip and +// so the tooltip itself is located beneath its associated window. +enum wxTipKind +{ + wxTipKind_None, + wxTipKind_TopLeft, + wxTipKind_Top, + wxTipKind_TopRight, + wxTipKind_BottomLeft, + wxTipKind_Bottom, + wxTipKind_BottomRight, + wxTipKind_Auto +}; + +// ---------------------------------------------------------------------------- +// wxRichToolTip: a customizable but not necessarily native tooltip. +// ---------------------------------------------------------------------------- + +// Notice that this class does not inherit from wxWindow. +class WXDLLIMPEXP_ADV wxRichToolTip +{ +public: + // Ctor must specify the tooltip title and main message, additional + // attributes can be set later. + wxRichToolTip(const wxString& title, const wxString& message); + + // Set the background colour: if two colours are specified, the background + // is drawn using a gradient from top to bottom, otherwise a single solid + // colour is used. + void SetBackgroundColour(const wxColour& col, + const wxColour& colEnd = wxColour()); + + // Set the small icon to show: either one of the standard information/ + // warning/error ones (the question icon doesn't make sense for a tooltip) + // or a custom icon. + void SetIcon(int icon = wxICON_INFORMATION); + void SetIcon(const wxBitmapBundle& icon); + + // Set timeout after which the tooltip should disappear, in milliseconds. + // By default the tooltip is hidden after system-dependent interval of time + // elapses but this method can be used to change this or also disable + // hiding the tooltip automatically entirely by passing 0 in this parameter + // (but doing this can result in native version not being used). + // Optionally specify a show delay. + void SetTimeout(unsigned milliseconds, unsigned millisecondsShowdelay = 0); + + // Choose the tip kind, possibly none. By default the tip is positioned + // automatically, as if wxTipKind_Auto was used. + void SetTipKind(wxTipKind tipKind); + + // Set the title text font. By default it's emphasized using the font style + // or colour appropriate for the current platform. + void SetTitleFont(const wxFont& font); + + // Show the tooltip for the given window and optionally a specified area. + void ShowFor(wxWindow* win, const wxRect* rect = NULL); + + // Non-virtual dtor as this class is not supposed to be derived from. + ~wxRichToolTip(); + +private: + wxRichToolTipImpl* const m_impl; + + wxDECLARE_NO_COPY_CLASS(wxRichToolTip); +}; + +#endif // wxUSE_RICHTOOLTIP + +#endif // _WX_RICHTOOLTIP_H_ diff --git a/lib/wxWidgets/include/wx/rtti.h b/lib/wxWidgets/include/wx/rtti.h new file mode 100644 index 0000000..a30a3ed --- /dev/null +++ b/lib/wxWidgets/include/wx/rtti.h @@ -0,0 +1,337 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/rtti.h +// Purpose: old RTTI macros (use XTI when possible instead) +// Author: Julian Smart +// Modified by: Ron Lee +// Created: 01/02/97 +// Copyright: (c) 1997 Julian Smart +// (c) 2001 Ron Lee <ron@debian.org> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RTTIH__ +#define _WX_RTTIH__ + +#if !wxUSE_EXTENDED_RTTI // XTI system is meant to replace these macros + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/memory.h" + +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_BASE wxObject; +class WXDLLIMPEXP_FWD_BASE wxString; +class WXDLLIMPEXP_FWD_BASE wxClassInfo; +class WXDLLIMPEXP_FWD_BASE wxHashTable; +class WXDLLIMPEXP_FWD_BASE wxObject; +class WXDLLIMPEXP_FWD_BASE wxPluginLibrary; +class WXDLLIMPEXP_FWD_BASE wxHashTable_Node; + +// ---------------------------------------------------------------------------- +// wxClassInfo +// ---------------------------------------------------------------------------- + +typedef wxObject *(*wxObjectConstructorFn)(void); + +class WXDLLIMPEXP_BASE wxClassInfo +{ + friend class WXDLLIMPEXP_FWD_BASE wxObject; + friend WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxString& name); +public: + wxClassInfo( const wxChar *className, + const wxClassInfo *baseInfo1, + const wxClassInfo *baseInfo2, + int size, + wxObjectConstructorFn ctor ) + : m_className(className) + , m_objectSize(size) + , m_objectConstructor(ctor) + , m_baseInfo1(baseInfo1) + , m_baseInfo2(baseInfo2) + , m_next(sm_first) + { + sm_first = this; + Register(); + } + + ~wxClassInfo(); + + wxObject *CreateObject() const + { return m_objectConstructor ? (*m_objectConstructor)() : NULL; } + bool IsDynamic() const { return (NULL != m_objectConstructor); } + + const wxChar *GetClassName() const { return m_className; } + const wxChar *GetBaseClassName1() const + { return m_baseInfo1 ? m_baseInfo1->GetClassName() : NULL; } + const wxChar *GetBaseClassName2() const + { return m_baseInfo2 ? m_baseInfo2->GetClassName() : NULL; } + const wxClassInfo *GetBaseClass1() const { return m_baseInfo1; } + const wxClassInfo *GetBaseClass2() const { return m_baseInfo2; } + int GetSize() const { return m_objectSize; } + + wxObjectConstructorFn GetConstructor() const + { return m_objectConstructor; } + static const wxClassInfo *GetFirst() { return sm_first; } + const wxClassInfo *GetNext() const { return m_next; } + static wxClassInfo *FindClass(const wxString& className); + + // Climb upwards through inheritance hierarchy. + // Dual inheritance is catered for. + + bool IsKindOf(const wxClassInfo *info) const + { + if ( info == this ) + return true; + + if ( m_baseInfo1 ) + { + if ( m_baseInfo1->IsKindOf(info) ) + return true; + } + + if ( m_baseInfo2 ) + { + if ( m_baseInfo2->IsKindOf(info) ) + return true; + } + + return false; + } + + wxDECLARE_CLASS_INFO_ITERATORS(); + +private: + const wxChar *m_className; + int m_objectSize; + wxObjectConstructorFn m_objectConstructor; + + // Pointers to base wxClassInfos + + const wxClassInfo *m_baseInfo1; + const wxClassInfo *m_baseInfo2; + + // class info object live in a linked list: + // pointers to its head and the next element in it + + static wxClassInfo *sm_first; + wxClassInfo *m_next; + + static wxHashTable *sm_classTable; + +protected: + // registers the class + void Register(); + void Unregister(); + + wxDECLARE_NO_COPY_CLASS(wxClassInfo); +}; + +WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxString& name); + +// ---------------------------------------------------------------------------- +// Dynamic class macros +// ---------------------------------------------------------------------------- + +#define wxDECLARE_ABSTRACT_CLASS(name) \ + public: \ + wxWARNING_SUPPRESS_MISSING_OVERRIDE() \ + virtual wxClassInfo *GetClassInfo() const wxDUMMY_OVERRIDE; \ + wxWARNING_RESTORE_MISSING_OVERRIDE() \ + static wxClassInfo ms_classInfo + +#define wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(name) \ + wxDECLARE_NO_ASSIGN_CLASS(name); \ + wxDECLARE_DYNAMIC_CLASS(name) + +#define wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(name) \ + wxDECLARE_NO_ASSIGN_DEF_COPY(name); \ + wxDECLARE_DYNAMIC_CLASS(name) + +#define wxDECLARE_DYNAMIC_CLASS_NO_COPY(name) \ + wxDECLARE_NO_COPY_CLASS(name); \ + wxDECLARE_DYNAMIC_CLASS(name) + +#define wxDECLARE_DYNAMIC_CLASS(name) \ + wxDECLARE_ABSTRACT_CLASS(name); \ + static wxObject* wxCreateObject() + +#define wxDECLARE_CLASS(name) \ + wxDECLARE_ABSTRACT_CLASS(name) + + +// common part of the macros below +#define wxIMPLEMENT_CLASS_COMMON(name, basename, baseclsinfo2, func) \ + wxClassInfo name::ms_classInfo(wxT(#name), \ + &basename::ms_classInfo, \ + baseclsinfo2, \ + (int) sizeof(name), \ + func); \ + \ + wxClassInfo *name::GetClassInfo() const \ + { return &name::ms_classInfo; } + +#define wxIMPLEMENT_CLASS_COMMON1(name, basename, func) \ + wxIMPLEMENT_CLASS_COMMON(name, basename, NULL, func) + +#define wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, func) \ + wxIMPLEMENT_CLASS_COMMON(name, basename1, &basename2::ms_classInfo, func) + +// ----------------------------------- +// for concrete classes +// ----------------------------------- + + // Single inheritance with one base class +#define wxIMPLEMENT_DYNAMIC_CLASS(name, basename) \ + wxIMPLEMENT_CLASS_COMMON1(name, basename, name::wxCreateObject) \ + wxObject* name::wxCreateObject() \ + { return new name; } + + // Multiple inheritance with two base classes +#define wxIMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) \ + wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, \ + name::wxCreateObject) \ + wxObject* name::wxCreateObject() \ + { return new name; } + +// ----------------------------------- +// for abstract classes +// ----------------------------------- + + // Single inheritance with one base class +#define wxIMPLEMENT_ABSTRACT_CLASS(name, basename) \ + wxIMPLEMENT_CLASS_COMMON1(name, basename, NULL) + + // Multiple inheritance with two base classes +#define wxIMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \ + wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, NULL) + +// ----------------------------------- +// XTI-compatible macros +// ----------------------------------- + +#include "wx/flags.h" + +// these macros only do something when wxUSE_EXTENDED_RTTI=1 +// (and in that case they are defined by xti.h); however to avoid +// to be forced to wrap these macros (in user's source files) with +// +// #if wxUSE_EXTENDED_RTTI +// ... +// #endif +// +// blocks, we define them here as empty. + +#define wxEMPTY_PARAMETER_VALUE /**/ + +#define wxBEGIN_ENUM( e ) wxEMPTY_PARAMETER_VALUE +#define wxENUM_MEMBER( v ) wxEMPTY_PARAMETER_VALUE +#define wxEND_ENUM( e ) wxEMPTY_PARAMETER_VALUE + +#define wxIMPLEMENT_SET_STREAMING(SetName,e) wxEMPTY_PARAMETER_VALUE + +#define wxBEGIN_FLAGS( e ) wxEMPTY_PARAMETER_VALUE +#define wxFLAGS_MEMBER( v ) wxEMPTY_PARAMETER_VALUE +#define wxEND_FLAGS( e ) wxEMPTY_PARAMETER_VALUE + +#define wxCOLLECTION_TYPE_INFO( element, collection ) wxEMPTY_PARAMETER_VALUE + +#define wxHANDLER(name,eventClassType) wxEMPTY_PARAMETER_VALUE +#define wxBEGIN_HANDLERS_TABLE(theClass) wxEMPTY_PARAMETER_VALUE +#define wxEND_HANDLERS_TABLE() wxEMPTY_PARAMETER_VALUE + +#define wxIMPLEMENT_DYNAMIC_CLASS_XTI( name, basename, unit ) \ + wxIMPLEMENT_DYNAMIC_CLASS( name, basename ) +#define wxIMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK( name, basename, unit, callback ) \ + wxIMPLEMENT_DYNAMIC_CLASS( name, basename ) + +#define wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_XTI( name, basename, unit ) \ + wxIMPLEMENT_DYNAMIC_CLASS( name, basename) + +#define wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( name, basename, \ + unit, toString, \ + fromString ) wxEMPTY_PARAMETER_VALUE +#define wxIMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_NO_BASE_XTI( name, unit ) wxEMPTY_PARAMETER_VALUE +#define wxIMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_XTI( name, basename, unit ) wxEMPTY_PARAMETER_VALUE + +#define wxIMPLEMENT_DYNAMIC_CLASS2_XTI( name, basename, basename2, unit) wxIMPLEMENT_DYNAMIC_CLASS2( name, basename, basename2 ) + +#define wxCONSTRUCTOR_0(klass) \ + wxEMPTY_PARAMETER_VALUE +#define wxCONSTRUCTOR_DUMMY(klass) \ + wxEMPTY_PARAMETER_VALUE +#define wxDIRECT_CONSTRUCTOR_0(klass) \ + wxEMPTY_PARAMETER_VALUE +#define wxCONSTRUCTOR_1(klass,t0,v0) \ + wxEMPTY_PARAMETER_VALUE +#define wxDIRECT_CONSTRUCTOR_1(klass,t0,v0) \ + wxEMPTY_PARAMETER_VALUE +#define wxCONSTRUCTOR_2(klass,t0,v0,t1,v1) \ + wxEMPTY_PARAMETER_VALUE +#define wxDIRECT_CONSTRUCTOR_2(klass,t0,v0,t1,v1) \ + wxEMPTY_PARAMETER_VALUE +#define wxCONSTRUCTOR_3(klass,t0,v0,t1,v1,t2,v2) \ + wxEMPTY_PARAMETER_VALUE +#define wxDIRECT_CONSTRUCTOR_3(klass,t0,v0,t1,v1,t2,v2) \ + wxEMPTY_PARAMETER_VALUE +#define wxCONSTRUCTOR_4(klass,t0,v0,t1,v1,t2,v2,t3,v3) \ + wxEMPTY_PARAMETER_VALUE +#define wxDIRECT_CONSTRUCTOR_4(klass,t0,v0,t1,v1,t2,v2,t3,v3) \ + wxEMPTY_PARAMETER_VALUE +#define wxCONSTRUCTOR_5(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4) \ + wxEMPTY_PARAMETER_VALUE +#define wxDIRECT_CONSTRUCTOR_5(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4) \ + wxEMPTY_PARAMETER_VALUE +#define wxCONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \ + wxEMPTY_PARAMETER_VALUE +#define wxDIRECT_CONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \ + wxEMPTY_PARAMETER_VALUE +#define wxCONSTRUCTOR_7(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6) \ + wxEMPTY_PARAMETER_VALUE +#define wxDIRECT_CONSTRUCTOR_7(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6) \ + wxEMPTY_PARAMETER_VALUE +#define wxCONSTRUCTOR_8(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7) \ + wxEMPTY_PARAMETER_VALUE +#define wxDIRECT_CONSTRUCTOR_8(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7) \ + wxEMPTY_PARAMETER_VALUE + +#define wxSETTER( property, Klass, valueType, setterMethod ) wxEMPTY_PARAMETER_VALUE +#define wxGETTER( property, Klass, valueType, gettermethod ) wxEMPTY_PARAMETER_VALUE +#define wxADDER( property, Klass, valueType, addermethod ) wxEMPTY_PARAMETER_VALUE +#define wxCOLLECTION_GETTER( property, Klass, valueType, gettermethod ) wxEMPTY_PARAMETER_VALUE + +#define wxBEGIN_PROPERTIES_TABLE(theClass) wxEMPTY_PARAMETER_VALUE +#define wxEND_PROPERTIES_TABLE() wxEMPTY_PARAMETER_VALUE +#define wxHIDE_PROPERTY( pname ) wxEMPTY_PARAMETER_VALUE + +#define wxPROPERTY( pname, type, setter, getter, defaultValue, flags, help, group) \ + wxEMPTY_PARAMETER_VALUE + +#define wxPROPERTY_FLAGS( pname, flags, type, setter, getter,defaultValue, \ + pflags, help, group) wxEMPTY_PARAMETER_VALUE + +#define wxREADONLY_PROPERTY( pname, type, getter,defaultValue, flags, help, group) \ + wxGETTER( pname, class_t, type, getter ) wxEMPTY_PARAMETER_VALUE + +#define wxREADONLY_PROPERTY_FLAGS( pname, flags, type, getter,defaultValue, \ + pflags, help, group) wxEMPTY_PARAMETER_VALUE + +#define wxPROPERTY_COLLECTION( pname, colltype, addelemtype, adder, getter, \ + flags, help, group ) wxEMPTY_PARAMETER_VALUE + +#define wxREADONLY_PROPERTY_COLLECTION( pname, colltype, addelemtype, getter, \ + flags, help, group) wxEMPTY_PARAMETER_VALUE +#define wxEVENT_PROPERTY( name, eventType, eventClass ) wxEMPTY_PARAMETER_VALUE + +#define wxEVENT_RANGE_PROPERTY( name, eventType, lastEventType, eventClass ) wxEMPTY_PARAMETER_VALUE + +#define wxIMPLEMENT_PROPERTY(name, type) wxEMPTY_PARAMETER_VALUE + +#define wxEMPTY_HANDLERS_TABLE(name) wxEMPTY_PARAMETER_VALUE + +#endif // !wxUSE_EXTENDED_RTTI +#endif // _WX_RTTIH__ diff --git a/lib/wxWidgets/include/wx/sashwin.h b/lib/wxWidgets/include/wx/sashwin.h new file mode 100644 index 0000000..21967a5 --- /dev/null +++ b/lib/wxWidgets/include/wx/sashwin.h @@ -0,0 +1,17 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/sashwin.h +// Purpose: Base header for wxSashWindow +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SASHWIN_H_BASE_ +#define _WX_SASHWIN_H_BASE_ + +#include "wx/generic/sashwin.h" + +#endif + // _WX_SASHWIN_H_BASE_ diff --git a/lib/wxWidgets/include/wx/sckaddr.h b/lib/wxWidgets/include/wx/sckaddr.h new file mode 100644 index 0000000..da34171 --- /dev/null +++ b/lib/wxWidgets/include/wx/sckaddr.h @@ -0,0 +1,203 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/sckaddr.h +// Purpose: Network address classes +// Author: Guilhem Lavaux +// Modified by: Vadim Zeitlin to switch to wxSockAddressImpl implementation +// Created: 26/04/1997 +// Copyright: (c) 1997, 1998 Guilhem Lavaux +// (c) 2008, 2009 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SCKADDR_H_ +#define _WX_SCKADDR_H_ + +#include "wx/defs.h" + +#if wxUSE_SOCKETS + +#include "wx/object.h" +#include "wx/string.h" + +class wxSockAddressImpl; + +// forward declare it instead of including the system headers defining it which +// can bring in <windows.h> under Windows which we don't want to include from +// public wx headers +struct sockaddr; + +// Any socket address kind +class WXDLLIMPEXP_NET wxSockAddress : public wxObject +{ +public: + enum Family + { + NONE, + IPV4, + IPV6, + UNIX + }; + + wxSockAddress(); + wxSockAddress(const wxSockAddress& other); + virtual ~wxSockAddress(); + + wxSockAddress& operator=(const wxSockAddress& other); + + virtual void Clear(); + virtual Family Type() = 0; + + // accessors for the low level address represented by this object + const sockaddr *GetAddressData() const; + int GetAddressDataLen() const; + + // we need to be able to create copies of the addresses polymorphically + // (i.e. without knowing the exact address class) + virtual wxSockAddress *Clone() const = 0; + + + // implementation only, don't use + const wxSockAddressImpl& GetAddress() const { return *m_impl; } + void SetAddress(const wxSockAddressImpl& address); + +protected: + wxSockAddressImpl *m_impl; + +private: + void Init(); + wxDECLARE_ABSTRACT_CLASS(wxSockAddress); +}; + +// An IP address (either IPv4 or IPv6) +class WXDLLIMPEXP_NET wxIPaddress : public wxSockAddress +{ +public: + bool operator==(const wxIPaddress& addr) const; + + bool Hostname(const wxString& name); + bool Service(const wxString& name); + bool Service(unsigned short port); + + bool LocalHost(); + virtual bool IsLocalHost() const = 0; + + bool AnyAddress(); + + virtual wxString IPAddress() const = 0; + + wxString Hostname() const; + unsigned short Service() const; + + wxString OrigHostname() const { return m_origHostname; } + +protected: + // get m_impl initialized to the right family if it hadn't been done yet + wxSockAddressImpl& GetImpl(); + const wxSockAddressImpl& GetImpl() const + { + return const_cast<wxIPaddress *>(this)->GetImpl(); + } + + // host name originally passed to Hostname() + wxString m_origHostname; + +private: + // create the wxSockAddressImpl object of the correct family if it's + // currently uninitialized + virtual void DoInitImpl() = 0; + + + wxDECLARE_ABSTRACT_CLASS(wxIPaddress); +}; + +// An IPv4 address +class WXDLLIMPEXP_NET wxIPV4address : public wxIPaddress +{ +public: + // implement wxSockAddress pure virtuals: + virtual Family Type() wxOVERRIDE { return IPV4; } + virtual wxSockAddress *Clone() const wxOVERRIDE { return new wxIPV4address(*this); } + + + // implement wxIPaddress pure virtuals: + virtual bool IsLocalHost() const wxOVERRIDE; + + virtual wxString IPAddress() const wxOVERRIDE; + + + // IPv4-specific methods: + bool Hostname(unsigned long addr); + + // make base class methods hidden by our overload visible + using wxIPaddress::Hostname; + + bool BroadcastAddress(); + +private: + virtual void DoInitImpl() wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxIPV4address); +}; + + +#if wxUSE_IPV6 + +// An IPv6 address +class WXDLLIMPEXP_NET wxIPV6address : public wxIPaddress +{ +public: + // implement wxSockAddress pure virtuals: + virtual Family Type() wxOVERRIDE { return IPV6; } + virtual wxSockAddress *Clone() const wxOVERRIDE { return new wxIPV6address(*this); } + + + // implement wxIPaddress pure virtuals: + virtual bool IsLocalHost() const wxOVERRIDE; + + virtual wxString IPAddress() const wxOVERRIDE; + + // IPv6-specific methods: + bool Hostname(unsigned char addr[16]); + + using wxIPaddress::Hostname; + +private: + virtual void DoInitImpl() wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxIPV6address); +}; + +#endif // wxUSE_IPV6 + +// Unix domain sockets are only available under, well, Unix +#if defined(__UNIX__) && !defined(__WINDOWS__) && !defined(__WINE__) + #define wxHAS_UNIX_DOMAIN_SOCKETS +#endif + +#ifdef wxHAS_UNIX_DOMAIN_SOCKETS + +// A Unix domain socket address +class WXDLLIMPEXP_NET wxUNIXaddress : public wxSockAddress +{ +public: + void Filename(const wxString& name); + wxString Filename() const; + + virtual Family Type() wxOVERRIDE { return UNIX; } + virtual wxSockAddress *Clone() const wxOVERRIDE { return new wxUNIXaddress(*this); } + +private: + wxSockAddressImpl& GetUNIX(); + const wxSockAddressImpl& GetUNIX() const + { + return const_cast<wxUNIXaddress *>(this)->GetUNIX(); + } + + wxDECLARE_DYNAMIC_CLASS(wxUNIXaddress); +}; + +#endif // wxHAS_UNIX_DOMAIN_SOCKETS + +#endif // wxUSE_SOCKETS + +#endif // _WX_SCKADDR_H_ diff --git a/lib/wxWidgets/include/wx/sckipc.h b/lib/wxWidgets/include/wx/sckipc.h new file mode 100644 index 0000000..4f050d0 --- /dev/null +++ b/lib/wxWidgets/include/wx/sckipc.h @@ -0,0 +1,159 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/sckipc.h +// Purpose: Interprocess communication implementation (wxSocket version) +// Author: Julian Smart +// Modified by: Guilhem Lavaux (big rewrite) May 1997, 1998 +// Guillermo Rodriguez (updated for wxSocket v2) Jan 2000 +// (callbacks deprecated) Mar 2000 +// Created: 1993 +// Copyright: (c) Julian Smart 1993 +// (c) Guilhem Lavaux 1997, 1998 +// (c) 2000 Guillermo Rodriguez <guille@iies.es> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SCKIPC_H +#define _WX_SCKIPC_H + +#include "wx/defs.h" + +#if wxUSE_SOCKETS && wxUSE_IPC + +#include "wx/ipcbase.h" +#include "wx/socket.h" +#include "wx/sckstrm.h" +#include "wx/datstrm.h" + +/* + * Mini-DDE implementation + + Most transactions involve a topic name and an item name (choose these + as befits your application). + + A client can: + + - ask the server to execute commands (data) associated with a topic + - request data from server by topic and item + - poke data into the server + - ask the server to start an advice loop on topic/item + - ask the server to stop an advice loop + + A server can: + + - respond to execute, request, poke and advice start/stop + - send advise data to client + + Note that this limits the server in the ways it can send data to the + client, i.e. it can't send unsolicited information. + * + */ + +class WXDLLIMPEXP_FWD_NET wxTCPServer; +class WXDLLIMPEXP_FWD_NET wxTCPClient; + +class wxIPCSocketStreams; + +class WXDLLIMPEXP_NET wxTCPConnection : public wxConnectionBase +{ +public: + wxTCPConnection() { Init(); } + wxTCPConnection(void *buffer, size_t size) + : wxConnectionBase(buffer, size) + { + Init(); + } + + virtual ~wxTCPConnection(); + + // implement base class pure virtual methods + virtual const void *Request(const wxString& item, + size_t *size = NULL, + wxIPCFormat format = wxIPC_TEXT) wxOVERRIDE; + virtual bool StartAdvise(const wxString& item) wxOVERRIDE; + virtual bool StopAdvise(const wxString& item) wxOVERRIDE; + virtual bool Disconnect() wxOVERRIDE; + + // Will be used in the future to enable the compression but does nothing + // for now. + void Compress(bool on); + + +protected: + virtual bool DoExecute(const void *data, size_t size, wxIPCFormat format) wxOVERRIDE; + virtual bool DoPoke(const wxString& item, const void *data, size_t size, + wxIPCFormat format) wxOVERRIDE; + virtual bool DoAdvise(const wxString& item, const void *data, size_t size, + wxIPCFormat format) wxOVERRIDE; + + + // notice that all the members below are only initialized once the + // connection is made, i.e. in MakeConnection() for the client objects and + // after OnAcceptConnection() in the server ones + + // the underlying socket (wxSocketClient for IPC client and wxSocketServer + // for IPC server) + wxSocketBase *m_sock; + + // various streams that we use + wxIPCSocketStreams *m_streams; + + // the topic of this connection + wxString m_topic; + +private: + // common part of both ctors + void Init(); + + friend class wxTCPServer; + friend class wxTCPClient; + friend class wxTCPEventHandler; + + wxDECLARE_NO_COPY_CLASS(wxTCPConnection); + wxDECLARE_DYNAMIC_CLASS(wxTCPConnection); +}; + +class WXDLLIMPEXP_NET wxTCPServer : public wxServerBase +{ +public: + wxTCPServer(); + virtual ~wxTCPServer(); + + // Returns false on error (e.g. port number is already in use) + virtual bool Create(const wxString& serverName) wxOVERRIDE; + + virtual wxConnectionBase *OnAcceptConnection(const wxString& topic) wxOVERRIDE; + +protected: + wxSocketServer *m_server; + +#ifdef __UNIX_LIKE__ + // the name of the file associated to the Unix domain socket, may be empty + wxString m_filename; +#endif // __UNIX_LIKE__ + + wxDECLARE_NO_COPY_CLASS(wxTCPServer); + wxDECLARE_DYNAMIC_CLASS(wxTCPServer); +}; + +class WXDLLIMPEXP_NET wxTCPClient : public wxClientBase +{ +public: + wxTCPClient(); + + virtual bool ValidHost(const wxString& host) wxOVERRIDE; + + // Call this to make a connection. Returns NULL if cannot. + virtual wxConnectionBase *MakeConnection(const wxString& host, + const wxString& server, + const wxString& topic) wxOVERRIDE; + + // Callbacks to CLIENT - override at will + virtual wxConnectionBase *OnMakeConnection() wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxTCPClient); +}; + +#endif // wxUSE_SOCKETS && wxUSE_IPC + +#endif // _WX_SCKIPC_H diff --git a/lib/wxWidgets/include/wx/sckstrm.h b/lib/wxWidgets/include/wx/sckstrm.h new file mode 100644 index 0000000..f90a2fe --- /dev/null +++ b/lib/wxWidgets/include/wx/sckstrm.h @@ -0,0 +1,74 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/sckstrm.h +// Purpose: wxSocket*Stream +// Author: Guilhem Lavaux +// Modified by: +// Created: 17/07/97 +// Copyright: (c) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// +#ifndef __SCK_STREAM_H__ +#define __SCK_STREAM_H__ + +#include "wx/stream.h" + +#if wxUSE_SOCKETS && wxUSE_STREAMS + +#include "wx/socket.h" + +class WXDLLIMPEXP_NET wxSocketOutputStream : public wxOutputStream +{ +public: + wxSocketOutputStream(wxSocketBase& s); + virtual ~wxSocketOutputStream(); + +protected: + wxSocketBase *m_o_socket; + + size_t OnSysWrite(const void *buffer, size_t bufsize) wxOVERRIDE; + + // socket streams are both un-seekable and size-less streams: + wxFileOffset OnSysTell() const wxOVERRIDE + { return wxInvalidOffset; } + wxFileOffset OnSysSeek(wxFileOffset WXUNUSED(pos), wxSeekMode WXUNUSED(mode)) wxOVERRIDE + { return wxInvalidOffset; } + + wxDECLARE_NO_COPY_CLASS(wxSocketOutputStream); +}; + +class WXDLLIMPEXP_NET wxSocketInputStream : public wxInputStream +{ +public: + wxSocketInputStream(wxSocketBase& s); + virtual ~wxSocketInputStream(); + +protected: + wxSocketBase *m_i_socket; + + size_t OnSysRead(void *buffer, size_t bufsize) wxOVERRIDE; + + // socket streams are both un-seekable and size-less streams: + + wxFileOffset OnSysTell() const wxOVERRIDE + { return wxInvalidOffset; } + wxFileOffset OnSysSeek(wxFileOffset WXUNUSED(pos), wxSeekMode WXUNUSED(mode)) wxOVERRIDE + { return wxInvalidOffset; } + + wxDECLARE_NO_COPY_CLASS(wxSocketInputStream); +}; + +class WXDLLIMPEXP_NET wxSocketStream : public wxSocketInputStream, + public wxSocketOutputStream +{ +public: + wxSocketStream(wxSocketBase& s); + virtual ~wxSocketStream(); + + wxDECLARE_NO_COPY_CLASS(wxSocketStream); +}; + +#endif + // wxUSE_SOCKETS && wxUSE_STREAMS + +#endif + // __SCK_STREAM_H__ diff --git a/lib/wxWidgets/include/wx/scopedarray.h b/lib/wxWidgets/include/wx/scopedarray.h new file mode 100644 index 0000000..02455d7 --- /dev/null +++ b/lib/wxWidgets/include/wx/scopedarray.h @@ -0,0 +1,120 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/scopedarray.h +// Purpose: scoped smart pointer class +// Author: Vadim Zeitlin +// Created: 2009-02-03 +// Copyright: (c) Jesse Lovelace and original Boost authors (see below) +// (c) 2009 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SCOPED_ARRAY_H_ +#define _WX_SCOPED_ARRAY_H_ + +#include "wx/defs.h" +#include "wx/checkeddelete.h" + +// ---------------------------------------------------------------------------- +// wxScopedArray: A scoped array +// ---------------------------------------------------------------------------- + +template <class T> +class wxScopedArray +{ +public: + typedef T element_type; + + explicit wxScopedArray(T * array = NULL) : m_array(array) { } + explicit wxScopedArray(size_t count) : m_array(new T[count]) { } + + ~wxScopedArray() { delete [] m_array; } + + // test for pointer validity: defining conversion to unspecified_bool_type + // and not more obvious bool to avoid implicit conversions to integer types + typedef T *(wxScopedArray<T>::*unspecified_bool_type)() const; + operator unspecified_bool_type() const + { + return m_array ? &wxScopedArray<T>::get : NULL; + } + + void reset(T *array = NULL) + { + if ( array != m_array ) + { + delete [] m_array; + m_array = array; + } + } + + T& operator[](size_t n) const { return m_array[n]; } + + T *get() const { return m_array; } + + void swap(wxScopedArray &other) + { + T * const tmp = other.m_array; + other.m_array = m_array; + m_array = tmp; + } + +private: + T *m_array; + + wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxScopedArray, T); +}; + +// ---------------------------------------------------------------------------- +// old macro based implementation +// ---------------------------------------------------------------------------- + +// the same but for arrays instead of simple pointers +#define wxDECLARE_SCOPED_ARRAY(T, name)\ +class name \ +{ \ +private: \ + T * m_ptr; \ + name(name const &); \ + name & operator=(name const &); \ + \ +public: \ + explicit name(T * p = NULL) : m_ptr(p) \ + {} \ + \ + ~name(); \ + void reset(T * p = NULL); \ + \ + T & operator[](long int i) const\ + { \ + wxASSERT(m_ptr != NULL); \ + wxASSERT(i >= 0); \ + return m_ptr[i]; \ + } \ + \ + T * get() const \ + { \ + return m_ptr; \ + } \ + \ + void swap(name & ot) \ + { \ + T * tmp = ot.m_ptr; \ + ot.m_ptr = m_ptr; \ + m_ptr = tmp; \ + } \ +}; + +#define wxDEFINE_SCOPED_ARRAY(T, name) \ +name::~name() \ +{ \ + wxCHECKED_DELETE_ARRAY(m_ptr); \ +} \ +void name::reset(T * p){ \ + if (m_ptr != p) \ + { \ + wxCHECKED_DELETE_ARRAY(m_ptr); \ + m_ptr = p; \ + } \ +} + +#endif // _WX_SCOPED_ARRAY_H_ + diff --git a/lib/wxWidgets/include/wx/scopedptr.h b/lib/wxWidgets/include/wx/scopedptr.h new file mode 100644 index 0000000..a6bd239 --- /dev/null +++ b/lib/wxWidgets/include/wx/scopedptr.h @@ -0,0 +1,209 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/scopedptr.h +// Purpose: scoped smart pointer class +// Author: Jesse Lovelace <jllovela@eos.ncsu.edu> +// Created: 06/01/02 +// Copyright: (c) Jesse Lovelace and original Boost authors (see below) +// (c) 2009 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// This class closely follows the implementation of the boost +// library scoped_ptr and is an adaptation for c++ macro's in +// the wxWidgets project. The original authors of the boost +// scoped_ptr are given below with their respective copyrights. + +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. +// Copyright (c) 2001, 2002 Peter Dimov +// +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. +// This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. +// +// See http://www.boost.org/libs/smart_ptr/scoped_ptr.htm for documentation. +// + +#ifndef _WX_SCOPED_PTR_H_ +#define _WX_SCOPED_PTR_H_ + +#include "wx/defs.h" +#include "wx/checkeddelete.h" + +// ---------------------------------------------------------------------------- +// wxScopedPtr: A scoped pointer +// ---------------------------------------------------------------------------- + +template <class T> +class wxScopedPtr +{ +public: + typedef T element_type; + + explicit wxScopedPtr(T * ptr = NULL) : m_ptr(ptr) { } + + ~wxScopedPtr() { wxCHECKED_DELETE(m_ptr); } + + // test for pointer validity: defining conversion to unspecified_bool_type + // and not more obvious bool to avoid implicit conversions to integer types + typedef T *(wxScopedPtr<T>::*unspecified_bool_type)() const; + + operator unspecified_bool_type() const + { + return m_ptr ? &wxScopedPtr<T>::get : NULL; + } + + void reset(T * ptr = NULL) + { + if ( ptr != m_ptr ) + { + wxCHECKED_DELETE(m_ptr); + m_ptr = ptr; + } + } + + T *release() + { + T *ptr = m_ptr; + m_ptr = NULL; + return ptr; + } + + T & operator*() const + { + wxASSERT(m_ptr != NULL); + return *m_ptr; + } + + T * operator->() const + { + wxASSERT(m_ptr != NULL); + return m_ptr; + } + + T * get() const + { + return m_ptr; + } + + void swap(wxScopedPtr& other) + { + T * const tmp = other.m_ptr; + other.m_ptr = m_ptr; + m_ptr = tmp; + } + +private: + T * m_ptr; + + wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxScopedPtr, T); +}; + +// ---------------------------------------------------------------------------- +// old macro based implementation +// ---------------------------------------------------------------------------- + +/* The type being used *must* be complete at the time + that wxDEFINE_SCOPED_* is called or a compiler error will result. + This is because the class checks for the completeness of the type + being used. */ + +#define wxDECLARE_SCOPED_PTR(T, name) \ +class name \ +{ \ +private: \ + T * m_ptr; \ + \ + name(name const &); \ + name & operator=(name const &); \ + \ +public: \ + explicit name(T * ptr = NULL) \ + : m_ptr(ptr) { } \ + \ + ~name(); \ + \ + void reset(T * ptr = NULL); \ + \ + T *release() \ + { \ + T *ptr = m_ptr; \ + m_ptr = NULL; \ + return ptr; \ + } \ + \ + T & operator*() const \ + { \ + wxASSERT(m_ptr != NULL); \ + return *m_ptr; \ + } \ + \ + T * operator->() const \ + { \ + wxASSERT(m_ptr != NULL); \ + return m_ptr; \ + } \ + \ + T * get() const \ + { \ + return m_ptr; \ + } \ + \ + void swap(name & ot) \ + { \ + T * tmp = ot.m_ptr; \ + ot.m_ptr = m_ptr; \ + m_ptr = tmp; \ + } \ +}; + +#define wxDEFINE_SCOPED_PTR(T, name)\ +void name::reset(T * ptr) \ +{ \ + if (m_ptr != ptr) \ + { \ + wxCHECKED_DELETE(m_ptr); \ + m_ptr = ptr; \ + } \ +} \ +name::~name() \ +{ \ + wxCHECKED_DELETE(m_ptr); \ +} + +// this macro can be used for the most common case when you want to declare and +// define the scoped pointer at the same time and want to use the standard +// naming convention: auto pointer to Foo is called FooPtr +#define wxDEFINE_SCOPED_PTR_TYPE(T) \ + wxDECLARE_SCOPED_PTR(T, T ## Ptr) \ + wxDEFINE_SCOPED_PTR(T, T ## Ptr) + +// ---------------------------------------------------------------------------- +// "Tied" scoped pointer: same as normal one but also sets the value of +// some other variable to the pointer value +// ---------------------------------------------------------------------------- + +#define wxDEFINE_TIED_SCOPED_PTR_TYPE(T) \ + wxDEFINE_SCOPED_PTR_TYPE(T) \ + class T ## TiedPtr : public T ## Ptr \ + { \ + public: \ + T ## TiedPtr(T **pp, T *p) \ + : T ## Ptr(p), m_pp(pp) \ + { \ + m_pOld = *pp; \ + *pp = p; \ + } \ + \ + ~ T ## TiedPtr() \ + { \ + *m_pp = m_pOld; \ + } \ + \ + private: \ + T **m_pp; \ + T *m_pOld; \ + }; + +#endif // _WX_SCOPED_PTR_H_ + diff --git a/lib/wxWidgets/include/wx/scopeguard.h b/lib/wxWidgets/include/wx/scopeguard.h new file mode 100644 index 0000000..676ffbd --- /dev/null +++ b/lib/wxWidgets/include/wx/scopeguard.h @@ -0,0 +1,524 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/scopeguard.h +// Purpose: declares wxScopeGuard and related macros +// Author: Vadim Zeitlin +// Modified by: +// Created: 03.07.2003 +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +/* + Acknowledgements: this header is heavily based on (well, almost the exact + copy of) ScopeGuard.h by Andrei Alexandrescu and Petru Marginean published + in December 2000 issue of C/C++ Users Journal. + http://www.cuj.com/documents/cujcexp1812alexandr/ + */ + +#ifndef _WX_SCOPEGUARD_H_ +#define _WX_SCOPEGUARD_H_ + +#include "wx/defs.h" + +#include "wx/except.h" + +// ---------------------------------------------------------------------------- +// helpers +// ---------------------------------------------------------------------------- + +namespace wxPrivate +{ + // in the original implementation this was a member template function of + // ScopeGuardImplBase but gcc 2.8 which is still used for OS/2 doesn't + // support member templates and so we must make it global + template <class ScopeGuardImpl> + void OnScopeExit(ScopeGuardImpl& guard) + { + if ( !guard.WasDismissed() ) + { + // we're called from ScopeGuardImpl dtor and so we must not throw + wxTRY + { + guard.Execute(); + } + wxCATCH_ALL(;) // do nothing, just eat the exception + } + } + + // just to avoid the warning about unused variables + template <class T> + void Use(const T& WXUNUSED(t)) + { + } +} // namespace wxPrivate + +#define wxPrivateOnScopeExit(n) wxPrivate::OnScopeExit(n) +#define wxPrivateUse(n) wxPrivate::Use(n) + +// ============================================================================ +// wxScopeGuard for functions and functors +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxScopeGuardImplBase: used by wxScopeGuardImpl[0..N] below +// ---------------------------------------------------------------------------- + +class wxScopeGuardImplBase +{ +public: + wxScopeGuardImplBase() : m_wasDismissed(false) { } + + wxScopeGuardImplBase(const wxScopeGuardImplBase& other) + : m_wasDismissed(other.m_wasDismissed) + { + other.Dismiss(); + } + + void Dismiss() const { m_wasDismissed = true; } + + // for OnScopeExit() only (we can't make it friend, unfortunately)! + bool WasDismissed() const { return m_wasDismissed; } + +protected: + ~wxScopeGuardImplBase() { } + + // must be mutable for copy ctor to work + mutable bool m_wasDismissed; + +private: + wxScopeGuardImplBase& operator=(const wxScopeGuardImplBase&); +}; + +// wxScopeGuard is just a reference, see the explanation in CUJ article +typedef const wxScopeGuardImplBase& wxScopeGuard; + +// ---------------------------------------------------------------------------- +// wxScopeGuardImpl0: scope guard for actions without parameters +// ---------------------------------------------------------------------------- + +template <class F> +class wxScopeGuardImpl0 : public wxScopeGuardImplBase +{ +public: + static wxScopeGuardImpl0<F> MakeGuard(F fun) + { + return wxScopeGuardImpl0<F>(fun); + } + + ~wxScopeGuardImpl0() { wxPrivateOnScopeExit(*this); } + + void Execute() { m_fun(); } + +protected: + wxScopeGuardImpl0(F fun) : m_fun(fun) { } + + F m_fun; + + wxScopeGuardImpl0& operator=(const wxScopeGuardImpl0&); +}; + +template <class F> +inline wxScopeGuardImpl0<F> wxMakeGuard(F fun) +{ + return wxScopeGuardImpl0<F>::MakeGuard(fun); +} + +// ---------------------------------------------------------------------------- +// wxScopeGuardImpl1: scope guard for actions with 1 parameter +// ---------------------------------------------------------------------------- + +template <class F, class P1> +class wxScopeGuardImpl1 : public wxScopeGuardImplBase +{ +public: + static wxScopeGuardImpl1<F, P1> MakeGuard(F fun, P1 p1) + { + return wxScopeGuardImpl1<F, P1>(fun, p1); + } + + ~wxScopeGuardImpl1() { wxPrivateOnScopeExit(* this); } + + void Execute() { m_fun(m_p1); } + +protected: + wxScopeGuardImpl1(F fun, P1 p1) : m_fun(fun), m_p1(p1) { } + + F m_fun; + const P1 m_p1; + + wxScopeGuardImpl1& operator=(const wxScopeGuardImpl1&); +}; + +template <class F, class P1> +inline wxScopeGuardImpl1<F, P1> wxMakeGuard(F fun, P1 p1) +{ + return wxScopeGuardImpl1<F, P1>::MakeGuard(fun, p1); +} + +// ---------------------------------------------------------------------------- +// wxScopeGuardImpl2: scope guard for actions with 2 parameters +// ---------------------------------------------------------------------------- + +template <class F, class P1, class P2> +class wxScopeGuardImpl2 : public wxScopeGuardImplBase +{ +public: + static wxScopeGuardImpl2<F, P1, P2> MakeGuard(F fun, P1 p1, P2 p2) + { + return wxScopeGuardImpl2<F, P1, P2>(fun, p1, p2); + } + + ~wxScopeGuardImpl2() { wxPrivateOnScopeExit(*this); } + + void Execute() { m_fun(m_p1, m_p2); } + +protected: + wxScopeGuardImpl2(F fun, P1 p1, P2 p2) : m_fun(fun), m_p1(p1), m_p2(p2) { } + + F m_fun; + const P1 m_p1; + const P2 m_p2; + + wxScopeGuardImpl2& operator=(const wxScopeGuardImpl2&); +}; + +template <class F, class P1, class P2> +inline wxScopeGuardImpl2<F, P1, P2> wxMakeGuard(F fun, P1 p1, P2 p2) +{ + return wxScopeGuardImpl2<F, P1, P2>::MakeGuard(fun, p1, p2); +} + +// ---------------------------------------------------------------------------- +// wxScopeGuardImpl3: scope guard for actions with 3 parameters +// ---------------------------------------------------------------------------- + +template <class F, class P1, class P2, class P3> +class wxScopeGuardImpl3 : public wxScopeGuardImplBase +{ +public: + static wxScopeGuardImpl3<F, P1, P2, P3> MakeGuard(F fun, P1 p1, P2 p2, P3 p3) + { + return wxScopeGuardImpl3<F, P1, P2, P3>(fun, p1, p2, p3); + } + + ~wxScopeGuardImpl3() { wxPrivateOnScopeExit(*this); } + + void Execute() { m_fun(m_p1, m_p2, m_p3); } + +protected: + wxScopeGuardImpl3(F fun, P1 p1, P2 p2, P3 p3) + : m_fun(fun), m_p1(p1), m_p2(p2), m_p3(p3) { } + + F m_fun; + const P1 m_p1; + const P2 m_p2; + const P3 m_p3; + + wxScopeGuardImpl3& operator=(const wxScopeGuardImpl3&); +}; + +template <class F, class P1, class P2, class P3> +inline wxScopeGuardImpl3<F, P1, P2, P3> wxMakeGuard(F fun, P1 p1, P2 p2, P3 p3) +{ + return wxScopeGuardImpl3<F, P1, P2, P3>::MakeGuard(fun, p1, p2, p3); +} + +// ============================================================================ +// wxScopeGuards for object methods +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxObjScopeGuardImpl0 +// ---------------------------------------------------------------------------- + +template <class Obj, class MemFun> +class wxObjScopeGuardImpl0 : public wxScopeGuardImplBase +{ +public: + static wxObjScopeGuardImpl0<Obj, MemFun> + MakeObjGuard(Obj& obj, MemFun memFun) + { + return wxObjScopeGuardImpl0<Obj, MemFun>(obj, memFun); + } + + ~wxObjScopeGuardImpl0() { wxPrivateOnScopeExit(*this); } + + void Execute() { (m_obj.*m_memfun)(); } + +protected: + wxObjScopeGuardImpl0(Obj& obj, MemFun memFun) + : m_obj(obj), m_memfun(memFun) { } + + Obj& m_obj; + MemFun m_memfun; +}; + +template <class Obj, class MemFun> +inline wxObjScopeGuardImpl0<Obj, MemFun> wxMakeObjGuard(Obj& obj, MemFun memFun) +{ + return wxObjScopeGuardImpl0<Obj, MemFun>::MakeObjGuard(obj, memFun); +} + +template <class Obj, class MemFun, class P1> +class wxObjScopeGuardImpl1 : public wxScopeGuardImplBase +{ +public: + static wxObjScopeGuardImpl1<Obj, MemFun, P1> + MakeObjGuard(Obj& obj, MemFun memFun, P1 p1) + { + return wxObjScopeGuardImpl1<Obj, MemFun, P1>(obj, memFun, p1); + } + + ~wxObjScopeGuardImpl1() { wxPrivateOnScopeExit(*this); } + + void Execute() { (m_obj.*m_memfun)(m_p1); } + +protected: + wxObjScopeGuardImpl1(Obj& obj, MemFun memFun, P1 p1) + : m_obj(obj), m_memfun(memFun), m_p1(p1) { } + + Obj& m_obj; + MemFun m_memfun; + const P1 m_p1; +}; + +template <class Obj, class MemFun, class P1> +inline wxObjScopeGuardImpl1<Obj, MemFun, P1> +wxMakeObjGuard(Obj& obj, MemFun memFun, P1 p1) +{ + return wxObjScopeGuardImpl1<Obj, MemFun, P1>::MakeObjGuard(obj, memFun, p1); +} + +template <class Obj, class MemFun, class P1, class P2> +class wxObjScopeGuardImpl2 : public wxScopeGuardImplBase +{ +public: + static wxObjScopeGuardImpl2<Obj, MemFun, P1, P2> + MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2) + { + return wxObjScopeGuardImpl2<Obj, MemFun, P1, P2>(obj, memFun, p1, p2); + } + + ~wxObjScopeGuardImpl2() { wxPrivateOnScopeExit(*this); } + + void Execute() { (m_obj.*m_memfun)(m_p1, m_p2); } + +protected: + wxObjScopeGuardImpl2(Obj& obj, MemFun memFun, P1 p1, P2 p2) + : m_obj(obj), m_memfun(memFun), m_p1(p1), m_p2(p2) { } + + Obj& m_obj; + MemFun m_memfun; + const P1 m_p1; + const P2 m_p2; +}; + +template <class Obj, class MemFun, class P1, class P2> +inline wxObjScopeGuardImpl2<Obj, MemFun, P1, P2> +wxMakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2) +{ + return wxObjScopeGuardImpl2<Obj, MemFun, P1, P2>:: + MakeObjGuard(obj, memFun, p1, p2); +} + +template <class Obj, class MemFun, class P1, class P2, class P3> +class wxObjScopeGuardImpl3 : public wxScopeGuardImplBase +{ +public: + static wxObjScopeGuardImpl3<Obj, MemFun, P1, P2, P3> + MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2, P3 p3) + { + return wxObjScopeGuardImpl3<Obj, MemFun, P1, P2, P3>(obj, memFun, p1, p2, p3); + } + + ~wxObjScopeGuardImpl3() { wxPrivateOnScopeExit(*this); } + + void Execute() { (m_obj.*m_memfun)(m_p1, m_p2, m_p3); } + +protected: + wxObjScopeGuardImpl3(Obj& obj, MemFun memFun, P1 p1, P2 p2, P3 p3) + : m_obj(obj), m_memfun(memFun), m_p1(p1), m_p2(p2), m_p3(p3) { } + + Obj& m_obj; + MemFun m_memfun; + const P1 m_p1; + const P2 m_p2; + const P3 m_p3; +}; + +template <class Obj, class MemFun, class P1, class P2, class P3> +inline wxObjScopeGuardImpl3<Obj, MemFun, P1, P2, P3> +wxMakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2, P3 p3) +{ + return wxObjScopeGuardImpl3<Obj, MemFun, P1, P2, P3>:: + MakeObjGuard(obj, memFun, p1, p2, p3); +} + +// ---------------------------------------------------------------------------- +// wxVariableSetter: use the same technique as for wxScopeGuard to allow +// setting a variable to some value on block exit +// ---------------------------------------------------------------------------- + +namespace wxPrivate +{ + +// empty class just to be able to define a reference to it +class VariableSetterBase : public wxScopeGuardImplBase { }; + +typedef const VariableSetterBase& VariableSetter; + +template <typename T, typename U> +class VariableSetterImpl : public VariableSetterBase +{ +public: + VariableSetterImpl(T& var, U value) + : m_var(var), + m_value(value) + { + } + + ~VariableSetterImpl() { wxPrivateOnScopeExit(*this); } + + void Execute() { m_var = m_value; } + +private: + T& m_var; + const U m_value; + + // suppress the warning about assignment operator not being generated + VariableSetterImpl<T, U>& operator=(const VariableSetterImpl<T, U>&); +}; + +template <typename T> +class VariableNullerImpl : public VariableSetterBase +{ +public: + VariableNullerImpl(T& var) + : m_var(var) + { + } + + ~VariableNullerImpl() { wxPrivateOnScopeExit(*this); } + + void Execute() { m_var = NULL; } + +private: + T& m_var; + + VariableNullerImpl<T>& operator=(const VariableNullerImpl<T>&); +}; + +} // namespace wxPrivate + +template <typename T, typename U> +inline +wxPrivate::VariableSetterImpl<T, U> wxMakeVarSetter(T& var, U value) +{ + return wxPrivate::VariableSetterImpl<T, U>(var, value); +} + +// calling wxMakeVarSetter(ptr, NULL) doesn't work because U is deduced to be +// "int" and subsequent assignment of "U" to "T *" fails, so provide a special +// function for this special case +template <typename T> +inline +wxPrivate::VariableNullerImpl<T> wxMakeVarNuller(T& var) +{ + return wxPrivate::VariableNullerImpl<T>(var); +} + +// ============================================================================ +// macros for declaring unnamed scoped guards (which can't be dismissed) +// ============================================================================ + +// NB: the original code has a single (and much nicer) ON_BLOCK_EXIT macro +// but this results in compiler warnings about unused variables and I +// didn't find a way to work around this other than by having different +// macros with different names or using a less natural syntax for passing +// the arguments (e.g. as Boost preprocessor sequences, which would mean +// having to write wxON_BLOCK_EXIT(fwrite, (buf)(size)(n)(fp)) instead of +// wxON_BLOCK_EXIT4(fwrite, buf, size, n, fp)). + +#define wxGuardName wxMAKE_UNIQUE_NAME(wxScopeGuard) + +#define wxON_BLOCK_EXIT0_IMPL(n, f) \ + wxScopeGuard n = wxMakeGuard(f); \ + wxPrivateUse(n) +#define wxON_BLOCK_EXIT0(f) \ + wxON_BLOCK_EXIT0_IMPL(wxGuardName, f) + +#define wxON_BLOCK_EXIT_OBJ0_IMPL(n, o, m) \ + wxScopeGuard n = wxMakeObjGuard(o, m); \ + wxPrivateUse(n) +#define wxON_BLOCK_EXIT_OBJ0(o, m) \ + wxON_BLOCK_EXIT_OBJ0_IMPL(wxGuardName, o, &m) + +#define wxON_BLOCK_EXIT_THIS0(m) \ + wxON_BLOCK_EXIT_OBJ0(*this, m) + + +#define wxON_BLOCK_EXIT1_IMPL(n, f, p1) \ + wxScopeGuard n = wxMakeGuard(f, p1); \ + wxPrivateUse(n) +#define wxON_BLOCK_EXIT1(f, p1) \ + wxON_BLOCK_EXIT1_IMPL(wxGuardName, f, p1) + +#define wxON_BLOCK_EXIT_OBJ1_IMPL(n, o, m, p1) \ + wxScopeGuard n = wxMakeObjGuard(o, m, p1); \ + wxPrivateUse(n) +#define wxON_BLOCK_EXIT_OBJ1(o, m, p1) \ + wxON_BLOCK_EXIT_OBJ1_IMPL(wxGuardName, o, &m, p1) + +#define wxON_BLOCK_EXIT_THIS1(m, p1) \ + wxON_BLOCK_EXIT_OBJ1(*this, m, p1) + + +#define wxON_BLOCK_EXIT2_IMPL(n, f, p1, p2) \ + wxScopeGuard n = wxMakeGuard(f, p1, p2); \ + wxPrivateUse(n) +#define wxON_BLOCK_EXIT2(f, p1, p2) \ + wxON_BLOCK_EXIT2_IMPL(wxGuardName, f, p1, p2) + +#define wxON_BLOCK_EXIT_OBJ2_IMPL(n, o, m, p1, p2) \ + wxScopeGuard n = wxMakeObjGuard(o, m, p1, p2); \ + wxPrivateUse(n) +#define wxON_BLOCK_EXIT_OBJ2(o, m, p1, p2) \ + wxON_BLOCK_EXIT_OBJ2_IMPL(wxGuardName, o, &m, p1, p2) + +#define wxON_BLOCK_EXIT_THIS2(m, p1, p2) \ + wxON_BLOCK_EXIT_OBJ2(*this, m, p1, p2) + + +#define wxON_BLOCK_EXIT3_IMPL(n, f, p1, p2, p3) \ + wxScopeGuard n = wxMakeGuard(f, p1, p2, p3); \ + wxPrivateUse(n) +#define wxON_BLOCK_EXIT3(f, p1, p2, p3) \ + wxON_BLOCK_EXIT3_IMPL(wxGuardName, f, p1, p2, p3) + +#define wxON_BLOCK_EXIT_OBJ3_IMPL(n, o, m, p1, p2, p3) \ + wxScopeGuard n = wxMakeObjGuard(o, m, p1, p2, p3); \ + wxPrivateUse(n) +#define wxON_BLOCK_EXIT_OBJ3(o, m, p1, p2, p3) \ + wxON_BLOCK_EXIT_OBJ3_IMPL(wxGuardName, o, &m, p1, p2, p3) + +#define wxON_BLOCK_EXIT_THIS3(m, p1, p2, p3) \ + wxON_BLOCK_EXIT_OBJ3(*this, m, p1, p2, p3) + + +#define wxSetterName wxMAKE_UNIQUE_NAME(wxVarSetter) + +#define wxON_BLOCK_EXIT_SET_IMPL(n, var, value) \ + wxPrivate::VariableSetter n = wxMakeVarSetter(var, value); \ + wxPrivateUse(n) + +#define wxON_BLOCK_EXIT_SET(var, value) \ + wxON_BLOCK_EXIT_SET_IMPL(wxSetterName, var, value) + +#define wxON_BLOCK_EXIT_NULL_IMPL(n, var) \ + wxPrivate::VariableSetter n = wxMakeVarNuller(var); \ + wxPrivateUse(n) + +#define wxON_BLOCK_EXIT_NULL(ptr) \ + wxON_BLOCK_EXIT_NULL_IMPL(wxSetterName, ptr) + +#endif // _WX_SCOPEGUARD_H_ diff --git a/lib/wxWidgets/include/wx/scrolbar.h b/lib/wxWidgets/include/wx/scrolbar.h new file mode 100644 index 0000000..9bd54be --- /dev/null +++ b/lib/wxWidgets/include/wx/scrolbar.h @@ -0,0 +1,84 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/scrolbar.h +// Purpose: wxScrollBar base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SCROLBAR_H_BASE_ +#define _WX_SCROLBAR_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_SCROLLBAR + +#include "wx/control.h" + +extern WXDLLIMPEXP_DATA_CORE(const char) wxScrollBarNameStr[]; + +// ---------------------------------------------------------------------------- +// wxScrollBar: a scroll bar control +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxScrollBarBase : public wxControl +{ +public: + wxScrollBarBase() { } + + /* + Derived classes should provide the following method and ctor with the + same parameters: + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSB_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxScrollBarNameStr)); + */ + + // accessors + virtual int GetThumbPosition() const = 0; + virtual int GetThumbSize() const = 0; + virtual int GetPageSize() const = 0; + virtual int GetRange() const = 0; + + bool IsVertical() const { return (m_windowStyle & wxVERTICAL) != 0; } + + // operations + virtual void SetThumbPosition(int viewStart) = 0; + virtual void SetScrollbar(int position, int thumbSize, + int range, int pageSize, + bool refresh = true) wxOVERRIDE = 0; + + // implementation-only + bool IsNeeded() const { return GetRange() > GetThumbSize(); } + +private: + wxDECLARE_NO_COPY_CLASS(wxScrollBarBase); +}; + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/scrolbar.h" +#elif defined(__WXMSW__) + #include "wx/msw/scrolbar.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/scrolbar.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/scrolbar.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/scrolbar.h" +#elif defined(__WXMAC__) + #include "wx/osx/scrolbar.h" +#elif defined(__WXQT__) + #include "wx/qt/scrolbar.h" +#endif + +#endif // wxUSE_SCROLLBAR + +#endif + // _WX_SCROLBAR_H_BASE_ diff --git a/lib/wxWidgets/include/wx/scrolwin.h b/lib/wxWidgets/include/wx/scrolwin.h new file mode 100644 index 0000000..f4ac9b8 --- /dev/null +++ b/lib/wxWidgets/include/wx/scrolwin.h @@ -0,0 +1,511 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/scrolwin.h +// Purpose: wxScrolledWindow, wxScrolledControl and wxScrollHelper +// Author: Vadim Zeitlin +// Modified by: +// Created: 30.08.00 +// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SCROLWIN_H_BASE_ +#define _WX_SCROLWIN_H_BASE_ + +#include "wx/control.h" +#include "wx/panel.h" + +#ifdef __WXOSX__ + #include "wx/scrolbar.h" +#endif + +class WXDLLIMPEXP_FWD_CORE wxScrollHelperEvtHandler; +class WXDLLIMPEXP_FWD_BASE wxTimer; + +// default scrolled window style: scroll in both directions +#define wxScrolledWindowStyle (wxHSCROLL | wxVSCROLL) + +// values for the second argument of wxScrollHelper::ShowScrollbars() +enum wxScrollbarVisibility +{ + wxSHOW_SB_NEVER = -1, // never show the scrollbar at all + wxSHOW_SB_DEFAULT, // show scrollbar only if it is needed + wxSHOW_SB_ALWAYS // always show scrollbar, even if not needed +}; + +// ---------------------------------------------------------------------------- +// The hierarchy of scrolling classes is a bit complicated because we want to +// put as much functionality as possible in a mix-in class not deriving from +// wxWindow so that other classes could derive from the same base class on all +// platforms irrespectively of whether they are native controls (and hence +// don't use our scrolling) or not. +// +// So we have +// +// wxAnyScrollHelperBase +// | +// | +// \|/ +// wxScrollHelperBase +// | +// | +// \|/ +// wxWindow wxScrollHelper +// | \ / / +// | \ / / +// | _| |_ / +// | wxScrolledWindow / +// | / +// \|/ / +// wxControl / +// \ / +// \ / +// _| |_ +// wxScrolledControl +// +// ---------------------------------------------------------------------------- + +// This class allows reusing some of wxScrollHelperBase functionality in +// wxVarScrollHelperBase in wx/vscroll.h without duplicating its code. +class WXDLLIMPEXP_CORE wxAnyScrollHelperBase +{ +public: + explicit wxAnyScrollHelperBase(wxWindow* win); + virtual ~wxAnyScrollHelperBase() {} + + // Disable use of keyboard keys for scrolling. By default cursor movement + // keys (including Home, End, Page Up and Down) are used to scroll the + // window appropriately. If the derived class uses these keys for something + // else, e.g. changing the currently selected item, this function can be + // used to disable this behaviour as it's not only not necessary then but + // can actually be actively harmful if another object forwards a keyboard + // event corresponding to one of the above keys to us using + // ProcessWindowEvent() because the event will always be processed which + // can be undesirable. + void DisableKeyboardScrolling() { m_kbdScrollingEnabled = false; } + + // Override this function to draw the graphic (or just process EVT_PAINT) + virtual void OnDraw(wxDC& WXUNUSED(dc)) { } + + // change the DC origin according to the scroll position. + virtual void DoPrepareDC(wxDC& dc) = 0; + + // Simple accessor for the window that is really being scrolled. + wxWindow *GetTargetWindow() const { return m_targetWindow; } + + + // The methods called from the window event handlers. + void HandleOnChar(wxKeyEvent& event); + void HandleOnPaint(wxPaintEvent& event); + +protected: + // the window that receives the scroll events and the window to actually + // scroll, respectively + wxWindow *m_win, + *m_targetWindow; + + // whether cursor keys should scroll the window + bool m_kbdScrollingEnabled; +}; + +// This is the class containing the guts of (uniform) scrolling logic. +class WXDLLIMPEXP_CORE wxScrollHelperBase : public wxAnyScrollHelperBase +{ +public: + // ctor must be given the associated window + wxScrollHelperBase(wxWindow *winToScroll); + virtual ~wxScrollHelperBase(); + + // configure the scrolling + virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, + int noUnitsX, int noUnitsY, + int xPos = 0, int yPos = 0, + bool noRefresh = false ); + + // scroll to the given (in logical coords) position + // + // notice that for backwards compatibility reasons Scroll() is virtual as + // the existing code could override it but new code should override + // DoScroll() instead + virtual void Scroll(int x, int y) { DoScroll(x, y); } + virtual void Scroll(const wxPoint& pt) { DoScroll(pt.x, pt.y); } + + // get/set the page size for this orientation (wxVERTICAL/wxHORIZONTAL) + int GetScrollPageSize(int orient) const; + void SetScrollPageSize(int orient, int pageSize); + + // get the number of lines the window can scroll, + // returns 0 if no scrollbars are there. + int GetScrollLines( int orient ) const; + + // Set the x, y scrolling increments. + void SetScrollRate( int xstep, int ystep ); + + // get the size of one logical unit in physical ones + void GetScrollPixelsPerUnit(int *pixelsPerUnitX, int *pixelsPerUnitY) const; + + // Set scrollbar visibility: it is possible to show scrollbar only if it is + // needed (i.e. if our virtual size is greater than the current size of the + // associated window), always (as wxALWAYS_SHOW_SB style does) or never (in + // which case you should provide some other way to scroll the window as the + // user wouldn't be able to do it at all) + void ShowScrollbars(wxScrollbarVisibility horz, wxScrollbarVisibility vert) + { + DoShowScrollbars(horz, vert); + } + + // Test whether the specified scrollbar is shown. + virtual bool IsScrollbarShown(int orient) const = 0; + + // Enable/disable Windows scrolling in either direction. If true, wxWidgets + // scrolls the canvas and only a bit of the canvas is invalidated; no + // Clear() is necessary. If false, the whole canvas is invalidated and a + // Clear() is necessary. Disable for when the scroll increment is used to + // actually scroll a non-constant distance + // + // Notice that calling this method with a false argument doesn't disable + // scrolling the window in this direction, it just changes the mechanism by + // which it is implemented to not use wxWindow::ScrollWindow(). + virtual void EnableScrolling(bool x_scrolling, bool y_scrolling); + + // Get the view start + void GetViewStart(int *x, int *y) const { DoGetViewStart(x, y); } + + wxPoint GetViewStart() const + { + wxPoint pt; + DoGetViewStart(&pt.x, &pt.y); + return pt; + } + + // Set the scale factor, used in PrepareDC + void SetScale(double xs, double ys) { m_scaleX = xs; m_scaleY = ys; } + double GetScaleX() const { return m_scaleX; } + double GetScaleY() const { return m_scaleY; } + + // translate between scrolled and unscrolled coordinates + void CalcScrolledPosition(int x, int y, int *xx, int *yy) const + { DoCalcScrolledPosition(x, y, xx, yy); } + wxPoint CalcScrolledPosition(const wxPoint& pt) const + { + wxPoint p2; + DoCalcScrolledPosition(pt.x, pt.y, &p2.x, &p2.y); + return p2; + } + + void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const + { DoCalcUnscrolledPosition(x, y, xx, yy); } + wxPoint CalcUnscrolledPosition(const wxPoint& pt) const + { + wxPoint p2; + DoCalcUnscrolledPosition(pt.x, pt.y, &p2.x, &p2.y); + return p2; + } + + void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const; + void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const; + + // Adjust the scrollbars + virtual void AdjustScrollbars() = 0; + + // Calculate scroll increment + int CalcScrollInc(wxScrollWinEvent& event); + + // Normally the wxScrolledWindow will scroll itself, but in some rare + // occasions you might want it to scroll [part of] another window (e.g. a + // child of it in order to scroll only a portion the area between the + // scrollbars (spreadsheet: only cell area will move). + void SetTargetWindow(wxWindow *target); + + void SetTargetRect(const wxRect& rect) { m_rectToScroll = rect; } + wxRect GetTargetRect() const { return m_rectToScroll; } + + virtual void DoPrepareDC(wxDC& dc) wxOVERRIDE; + + // are we generating the autoscroll events? + bool IsAutoScrolling() const { return m_timerAutoScroll != NULL; } + + // stop generating the scroll events when mouse is held outside the window + void StopAutoScrolling(); + + // this method can be overridden in a derived class to forbid sending the + // auto scroll events - note that unlike StopAutoScrolling() it doesn't + // stop the timer, so it will be called repeatedly and will typically + // return different values depending on the current mouse position + // + // the base class version just returns true + virtual bool SendAutoScrollEvents(wxScrollWinEvent& event) const; + + // the methods to be called from the window event handlers + void HandleOnScroll(wxScrollWinEvent& event); + void HandleOnSize(wxSizeEvent& event); + void HandleOnMouseEnter(wxMouseEvent& event); + void HandleOnMouseLeave(wxMouseEvent& event); +#if wxUSE_MOUSEWHEEL + void HandleOnMouseWheel(wxMouseEvent& event); +#endif // wxUSE_MOUSEWHEEL + void HandleOnChildFocus(wxChildFocusEvent& event); + +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED( + void OnScroll(wxScrollWinEvent& event) { HandleOnScroll(event); } + ) +#endif // WXWIN_COMPATIBILITY_2_8 + +protected: + // get pointer to our scroll rect if we use it or NULL + const wxRect *GetScrollRect() const + { + return m_rectToScroll.width != 0 ? &m_rectToScroll : NULL; + } + + // get the size of the target window + wxSize GetTargetSize() const + { + return m_rectToScroll.width != 0 ? m_rectToScroll.GetSize() + : m_targetWindow->GetClientSize(); + } + + void GetTargetSize(int *w, int *h) const + { + wxSize size = GetTargetSize(); + if ( w ) + *w = size.x; + if ( h ) + *h = size.y; + } + + // implementation of public methods with the same name + virtual void DoGetViewStart(int *x, int *y) const; + virtual void DoScroll(int x, int y) = 0; + virtual void DoShowScrollbars(wxScrollbarVisibility horz, + wxScrollbarVisibility vert) = 0; + + // implementations of various wxWindow virtual methods which should be + // forwarded to us (this can be done by WX_FORWARD_TO_SCROLL_HELPER()) + bool ScrollLayout(); + void ScrollDoSetVirtualSize(int x, int y); + wxSize ScrollGetBestVirtualSize() const; + + // change just the target window (unlike SetWindow which changes m_win as + // well) + void DoSetTargetWindow(wxWindow *target); + + // delete the event handler we installed + void DeleteEvtHandler(); + + // this function should be overridden to return the size available for + // m_targetWindow inside m_win of the given size + // + // the default implementation is only good for m_targetWindow == m_win + // case, if we're scrolling a subwindow you must override this method + virtual wxSize GetSizeAvailableForScrollTarget(const wxSize& size) + { + // returning just size from here is wrong but it was decided that it is + // not wrong enough to break the existing code (which doesn't override + // this recently added function at all) by adding this assert + // + // wxASSERT_MSG( m_targetWindow == m_win, "must be overridden" ); + + return size; + } + + // Can be overridden to return false if the child window shouldn't be + // scrolled into view automatically when it gets focus, which is the + // default behaviour. + virtual bool ShouldScrollToChildOnFocus(wxWindow* child) + { +#if defined(__WXOSX__) && wxUSE_SCROLLBAR + if ( wxDynamicCast(child, wxScrollBar) ) + return false; +#else + wxUnusedVar(child); +#endif + + return true; + } + + + double m_scaleX; + double m_scaleY; + + wxRect m_rectToScroll; + + wxTimer *m_timerAutoScroll; + + // The number of pixels to scroll in horizontal and vertical directions + // respectively. + // + // If 0, means that the scrolling in the given direction is disabled. + int m_xScrollPixelsPerLine; + int m_yScrollPixelsPerLine; + int m_xScrollPosition; + int m_yScrollPosition; + int m_xScrollLines; + int m_yScrollLines; + int m_xScrollLinesPerPage; + int m_yScrollLinesPerPage; + + bool m_xScrollingEnabled; + bool m_yScrollingEnabled; + +#if wxUSE_MOUSEWHEEL + int m_wheelRotation; +#endif // wxUSE_MOUSEWHEEL + + wxScrollHelperEvtHandler *m_handler; + + wxDECLARE_NO_COPY_CLASS(wxScrollHelperBase); +}; + +// this macro can be used in a wxScrollHelper-derived class to forward wxWindow +// methods to corresponding wxScrollHelper methods +#define WX_FORWARD_TO_SCROLL_HELPER() \ +public: \ + virtual void PrepareDC(wxDC& dc) wxOVERRIDE { DoPrepareDC(dc); } \ + virtual bool Layout() wxOVERRIDE { return ScrollLayout(); } \ + virtual bool CanScroll(int orient) const wxOVERRIDE \ + { return IsScrollbarShown(orient); } \ + virtual void DoSetVirtualSize(int x, int y) wxOVERRIDE \ + { ScrollDoSetVirtualSize(x, y); } \ + virtual wxSize GetBestVirtualSize() const wxOVERRIDE \ + { return ScrollGetBestVirtualSize(); } + +// include the declaration of the real wxScrollHelper +#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) + #include "wx/gtk/scrolwin.h" +#elif defined(__WXGTK__) && !defined(__WXUNIVERSAL__) + #include "wx/gtk1/scrolwin.h" +#else + #define wxHAS_GENERIC_SCROLLWIN + #include "wx/generic/scrolwin.h" +#endif + +// ---------------------------------------------------------------------------- +// wxScrolled<T>: a wxWindow which knows how to scroll +// ---------------------------------------------------------------------------- + +// helper class for wxScrolled<T> below +struct WXDLLIMPEXP_CORE wxScrolledT_Helper +{ + static wxSize FilterBestSize(const wxWindow *win, + const wxScrollHelper *helper, + const wxSize& origBest); +#ifdef __WXMSW__ + static WXLRESULT FilterMSWWindowProc(WXUINT nMsg, WXLRESULT origResult); +#endif +}; + +// Scrollable window base on window type T. This used to be wxScrolledWindow, +// but wxScrolledWindow includes wxControlContainer functionality and that's +// not always desirable. +template<class T> +bool wxCreateScrolled(T* self, + wxWindow *parent, wxWindowID winid, + const wxPoint& pos, const wxSize& size, + long style, const wxString& name) +{ + return self->Create(parent, winid, pos, size, style, name); +} + +#if wxUSE_CONTROLS +// For wxControl we have to provide overloaded wxCreateScrolled() +// because wxControl::Create() has 7 parameters and therefore base +// template expecting 6-parameter T::Create() cannot be used. +inline bool wxCreateScrolled(wxControl* self, + wxWindow *parent, wxWindowID winid, + const wxPoint& pos, const wxSize& size, + long style, const wxString& name) +{ + return self->Create(parent, winid, pos, size, style, wxDefaultValidator, name); +} +#endif // wxUSE_CONTROLS + +template<class T> +class wxScrolled : public T, + public wxScrollHelper, + private wxScrolledT_Helper +{ +public: + wxScrolled() : wxScrollHelper(this) { } + wxScrolled(wxWindow *parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxScrolledWindowStyle, + const wxString& name = wxASCII_STR(wxPanelNameStr)) + : wxScrollHelper(this) + { + Create(parent, winid, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID winid, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxScrolledWindowStyle, + const wxString& name = wxASCII_STR(wxPanelNameStr)) + { + m_targetWindow = this; + +#ifdef __WXMAC__ + this->MacSetClipChildren(true); +#endif + + // by default, we're scrollable in both directions (but if one of the + // styles is specified explicitly, we shouldn't add the other one + // automatically) + if ( !(style & (wxHSCROLL | wxVSCROLL)) ) + style |= wxHSCROLL | wxVSCROLL; + + return wxCreateScrolled((T*)this, parent, winid, pos, size, style, name); + } + +#ifdef __WXMSW__ + // we need to return a special WM_GETDLGCODE value to process just the + // arrows but let the other navigation characters through + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) wxOVERRIDE + { + return FilterMSWWindowProc(nMsg, T::MSWWindowProc(nMsg, wParam, lParam)); + } + + // Take into account the scroll origin. + virtual void MSWAdjustBrushOrg(int* xOrg, int* yOrg) const wxOVERRIDE + { + CalcUnscrolledPosition(*xOrg, *yOrg, xOrg, yOrg); + } +#endif // __WXMSW__ + + WX_FORWARD_TO_SCROLL_HELPER() + +protected: + virtual wxSize DoGetBestSize() const wxOVERRIDE + { + return FilterBestSize(this, this, T::DoGetBestSize()); + } + +private: + wxDECLARE_NO_COPY_CLASS(wxScrolled); +}; + +// for compatibility with existing code, we provide wxScrolledWindow +// "typedef" for wxScrolled<wxPanel>. It's not a real typedef because we +// want wxScrolledWindow to show in wxRTTI information (the class is widely +// used and likelihood of its wxRTTI information being used too is high): +class WXDLLIMPEXP_CORE wxScrolledWindow : public wxScrolled<wxPanel> +{ +public: + wxScrolledWindow() : wxScrolled<wxPanel>() {} + wxScrolledWindow(wxWindow *parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxScrolledWindowStyle, + const wxString& name = wxASCII_STR(wxPanelNameStr)) + : wxScrolled<wxPanel>(parent, winid, pos, size, style, name) {} + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxScrolledWindow); +}; + +typedef wxScrolled<wxWindow> wxScrolledCanvas; + +#endif // _WX_SCROLWIN_H_BASE_ diff --git a/lib/wxWidgets/include/wx/secretstore.h b/lib/wxWidgets/include/wx/secretstore.h new file mode 100644 index 0000000..7d35d47 --- /dev/null +++ b/lib/wxWidgets/include/wx/secretstore.h @@ -0,0 +1,266 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/secretstore.h +// Purpose: Storing and retrieving secrets using OS-provided facilities. +// Author: Vadim Zeitlin +// Created: 2016-05-27 +// Copyright: (c) 2016 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SECRETSTORE_H_ +#define _WX_SECRETSTORE_H_ + +#include "wx/defs.h" + +#include "wx/string.h" + +#if wxUSE_SECRETSTORE + +// Initial version of wxSecretStore required passing user name to Load(), which +// didn't make much sense without support for multiple usernames per service, +// so the API was changed to load the username too. Test for this symbol to +// distinguish between the old and the new API, it wasn't defined before the +// API change. +#define wxHAS_SECRETSTORE_LOAD_USERNAME + +class wxSecretStoreImpl; +class wxSecretValueImpl; + +// ---------------------------------------------------------------------------- +// Represents a secret value, e.g. a password string. +// ---------------------------------------------------------------------------- + +// This is an immutable value-like class which tries to ensure that the secret +// value will be wiped out from memory once it's not needed any more. +class WXDLLIMPEXP_BASE wxSecretValue +{ +public: + // Creates an empty secret value (not the same as an empty password). + wxSecretValue() : m_impl(NULL) { } + + // Creates a secret value from the given data. + wxSecretValue(size_t size, const void *data) + : m_impl(NewImpl(size, data, "application/octet-stream")) + { + } + + // Creates a secret value from string. + explicit wxSecretValue(const wxString& secret) + { + const wxScopedCharBuffer buf(secret.utf8_str()); + m_impl = NewImpl(buf.length(), buf.data(), "text/plain"); + } + + wxSecretValue(const wxSecretValue& other); + wxSecretValue& operator=(const wxSecretValue& other); + + ~wxSecretValue(); + + // Check if a secret is not empty. + bool IsOk() const { return m_impl != NULL; } + + // Compare with another secret. + bool operator==(const wxSecretValue& other) const; + bool operator!=(const wxSecretValue& other) const + { + return !(*this == other); + } + + // Get the size, in bytes, of the secret data. + size_t GetSize() const; + + // Get read-only access to the secret data. + // + // Don't assume it is NUL-terminated, use GetSize() instead. + const void *GetData() const; + + // Get the secret data as a string. + // + // Notice that you may want to overwrite the string contents after using it + // by calling WipeString(). + wxString GetAsString(const wxMBConv& conv = wxConvWhateverWorks) const; + + // Erase the given area of memory overwriting its presumably sensitive + // content. + static void Wipe(size_t size, void *data); + + // Overwrite the contents of the given wxString. + static void WipeString(wxString& str); + +private: + // This method is implemented in platform-specific code and must return a + // new heap-allocated object initialized with the given data. + static wxSecretValueImpl* + NewImpl(size_t size, const void *data, const char* contentType); + + // This one is kept for ABI-compatibility only. + static wxSecretValueImpl* + NewImpl(size_t size, const void *data); + + // This ctor is only used by wxSecretStore and takes ownership of the + // provided existing impl pointer. + explicit wxSecretValue(wxSecretValueImpl* impl) : m_impl(impl) { } + + wxSecretValueImpl* m_impl; + + friend class wxSecretStore; +}; + +// ---------------------------------------------------------------------------- +// A collection of secrets, sometimes called a key chain. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxSecretStore +{ +public: + // Returns the default secrets collection to use. + // + // Currently this is the only way to create a secret store object. In the + // future we could add more factory functions to e.g. create non-persistent + // stores or allow creating stores corresponding to the native facilities + // being used (e.g. specify schema name under Linux or a SecKeychainRef + // under OS X). + static wxSecretStore GetDefault(); + + // This class has no default ctor, use GetDefault() instead. + + // But it can be copied, a copy refers to the same store as the original. + wxSecretStore(const wxSecretStore& store); + + // Dtor is not virtual, this class is not supposed to be derived from. + ~wxSecretStore(); + + + // Check if this object is valid, i.e. can be used, and optionally fill in + // the provided error message string if it isn't. + bool IsOk(wxString* errmsg = NULL) const; + + + // Store a username/password combination. + // + // The service name should be user readable and unique. + // + // If a secret with the same service name already exists, it will be + // overwritten with the new value. + // + // Returns false after logging an error message if an error occurs, + // otherwise returns true indicating that the secret has been stored. + bool Save(const wxString& service, + const wxString& username, + const wxSecretValue& password); + + // Look up the username/password for the given service. + // + // If no username/password is found for the given service, false is + // returned. + // + // Otherwise the function returns true and updates the provided user name + // and password arguments. + bool Load(const wxString& service, + wxString& username, + wxSecretValue& password) const; + + // Delete a previously stored username/password combination. + // + // If anything was deleted, returns true. Otherwise returns false and + // logs an error if any error other than not finding any matches occurred. + bool Delete(const wxString& service); + +private: + // Ctor takes ownership of the passed pointer. + explicit wxSecretStore(wxSecretStoreImpl* impl) : m_impl(impl) { } + + wxSecretStoreImpl* const m_impl; +}; + +#else // !wxUSE_SECRETSTORE + +#include "wx/utils.h" + +// Provide stand in for wxSecretValue allowing to use it without having #if +// wxUSE_SECRETSTORE checks everywhere. Unlike the real version, this class +// doesn't provide any added security. +class wxSecretValue +{ +public: + wxSecretValue() { m_valid = false; } + + wxSecretValue(size_t size, const void *data) + { + Init(size, data); + } + + explicit wxSecretValue(const wxString& secret) + { + const wxScopedCharBuffer buf(secret.utf8_str()); + Init(buf.length(), buf.data()); + } + + bool IsOk() const { return m_valid; } + + bool operator==(const wxSecretValue& other) const + { + return m_valid == other.m_valid && m_data == other.m_data; + } + + bool operator!=(const wxSecretValue& other) const + { + return !(*this == other); + } + + size_t GetSize() const { return m_data.utf8_str().length(); } + + const void *GetData() const { return m_data.utf8_str().data(); } + + wxString GetAsString(const wxMBConv& conv = wxConvWhateverWorks) const + { + wxUnusedVar(conv); + return m_data; + } + + static void Wipe(size_t size, void *data) { wxSecureZeroMemory(data, size); } + static void WipeString(wxString& str) + { + str.assign(str.length(), '*'); + str.clear(); + } + +private: + void Init(size_t size, const void *data) + { + m_data = wxString::From8BitData(static_cast<const char*>(data), size); + } + + wxString m_data; + bool m_valid; +}; + +#endif // wxUSE_SECRETSTORE/!wxUSE_SECRETSTORE + +// Helper class ensuring WipeString() is called. +// +// It should only be used as a local variable and never polymorphically. +class wxSecretString : public wxString +{ +public: + wxSecretString() + { + } + + wxSecretString(const wxString& value) + : wxString(value) + { + } + + explicit wxSecretString(const wxSecretValue& value) + : wxString(value.GetAsString()) + { + } + + ~wxSecretString() + { + wxSecretValue::WipeString(*this); + } +}; + +#endif // _WX_SECRETSTORE_H_ diff --git a/lib/wxWidgets/include/wx/selstore.h b/lib/wxWidgets/include/wx/selstore.h new file mode 100644 index 0000000..0d64031 --- /dev/null +++ b/lib/wxWidgets/include/wx/selstore.h @@ -0,0 +1,129 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/selstore.h +// Purpose: wxSelectionStore stores selected items in a control +// Author: Vadim Zeitlin +// Modified by: +// Created: 08.06.03 (extracted from src/generic/listctrl.cpp) +// Copyright: (c) 2000-2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SELSTORE_H_ +#define _WX_SELSTORE_H_ + +#include "wx/dynarray.h" + +// ---------------------------------------------------------------------------- +// wxSelectedIndices is just a sorted array of indices +// ---------------------------------------------------------------------------- + +inline int CMPFUNC_CONV wxUIntCmp(unsigned n1, unsigned n2) +{ + return (int)(n1 - n2); +} + +WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_INT(unsigned, wxUIntCmp, wxSelectedIndices); + +// ---------------------------------------------------------------------------- +// wxSelectionStore is used to store the selected items in the virtual +// controls, i.e. it is well suited for storing even when the control contains +// a huge (practically infinite) number of items. +// +// Of course, internally it still has to store the selected items somehow (as +// an array currently) but the advantage is that it can handle the selection +// of all items (common operation) efficiently and that it could be made even +// smarter in the future (e.g. store the selections as an array of ranges + +// individual items) without changing its API. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSelectionStore +{ +public: + wxSelectionStore() : m_itemsSel(wxUIntCmp) { Init(); } + + // set the total number of items we handle + void SetItemCount(unsigned count); + + // special case of SetItemCount(0) + void Clear() { m_itemsSel.Clear(); m_count = 0; m_defaultState = false; } + + // must be called when new items are inserted/added + void OnItemsInserted(unsigned item, unsigned numItems); + + // must be called when an items is deleted + void OnItemDelete(unsigned item); + + // more efficient version for notifying the selection about deleting + // several items at once, return true if any of them were selected + bool OnItemsDeleted(unsigned item, unsigned numItems); + + // select one item, use SelectRange() instead if possible! + // + // returns true if the items selection really changed + bool SelectItem(unsigned item, bool select = true); + + // select the range of items (inclusive) + // + // return true and fill the itemsChanged array with the indices of items + // which have changed state if "few" of them did, otherwise return false + // (meaning that too many items changed state to bother counting them + // individually) + bool SelectRange(unsigned itemFrom, unsigned itemTo, + bool select = true, + wxArrayInt *itemsChanged = NULL); + + // return true if the given item is selected + bool IsSelected(unsigned item) const; + + // return true if no items are currently selected + bool IsEmpty() const + { + return m_defaultState ? m_itemsSel.size() == m_count + : m_itemsSel.empty(); + } + + // return the total number of selected items + unsigned GetSelectedCount() const + { + // we can we never have more than UINT_MAX selected items, knowing that + // we store the total number of items in an unsigned m_count, so the + // cast is safe. + return static_cast<unsigned>( + m_defaultState ? m_count - m_itemsSel.GetCount() + : m_itemsSel.GetCount() + ); + } + + // type of a "cookie" used to preserve the iteration state, this is an + // opaque type, don't rely on its current representation + typedef size_t IterationState; + + // constant representing absence of selection and hence end of iteration + static const unsigned NO_SELECTION; + + // get the first selected item in index order, return NO_SELECTION if none + unsigned GetFirstSelectedItem(IterationState& cookie) const; + + // get the next selected item, return NO_SELECTION if no more + unsigned GetNextSelectedItem(IterationState& cookie) const; + +private: + // (re)init + void Init() { m_count = 0; m_defaultState = false; } + + // the total number of items we handle + unsigned m_count; + + // the default state: normally, false (i.e. off) but maybe set to true if + // there are more selected items than non selected ones - this allows to + // handle selection of all items efficiently + bool m_defaultState; + + // the array of items whose selection state is different from default + wxSelectedIndices m_itemsSel; + + wxDECLARE_NO_COPY_CLASS(wxSelectionStore); +}; + +#endif // _WX_SELSTORE_H_ + diff --git a/lib/wxWidgets/include/wx/settings.h b/lib/wxWidgets/include/wx/settings.h new file mode 100644 index 0000000..eb32ec5 --- /dev/null +++ b/lib/wxWidgets/include/wx/settings.h @@ -0,0 +1,260 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/settings.h +// Purpose: wxSystemSettings class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SETTINGS_H_BASE_ +#define _WX_SETTINGS_H_BASE_ + +#include "wx/colour.h" +#include "wx/font.h" + +class WXDLLIMPEXP_FWD_CORE wxWindow; + +// possible values for wxSystemSettings::GetFont() parameter +// +// NB: wxMSW assumes that they have the same values as the parameters of +// Windows GetStockObject() API, don't change the values! +enum wxSystemFont +{ + wxSYS_OEM_FIXED_FONT = 10, + wxSYS_ANSI_FIXED_FONT, + wxSYS_ANSI_VAR_FONT, + wxSYS_SYSTEM_FONT, + wxSYS_DEVICE_DEFAULT_FONT, + + // don't use: this is here just to make the values of enum elements + // coincide with the corresponding MSW constants + wxSYS_DEFAULT_PALETTE, + + // don't use: MSDN says that this is a stock object provided only + // for compatibility with 16-bit Windows versions earlier than 3.0! + wxSYS_SYSTEM_FIXED_FONT, + + wxSYS_DEFAULT_GUI_FONT, + + // this was just a temporary aberration, do not use it any more + wxSYS_ICONTITLE_FONT = wxSYS_DEFAULT_GUI_FONT +}; + +// possible values for wxSystemSettings::GetColour() parameter +// +// NB: wxMSW assumes that they have the same values as the parameters of +// Windows GetSysColor() API, don't change the values! +enum wxSystemColour +{ + wxSYS_COLOUR_SCROLLBAR, + wxSYS_COLOUR_DESKTOP, + wxSYS_COLOUR_ACTIVECAPTION, + wxSYS_COLOUR_INACTIVECAPTION, + wxSYS_COLOUR_MENU, + wxSYS_COLOUR_WINDOW, + wxSYS_COLOUR_WINDOWFRAME, + wxSYS_COLOUR_MENUTEXT, + wxSYS_COLOUR_WINDOWTEXT, + wxSYS_COLOUR_CAPTIONTEXT, + wxSYS_COLOUR_ACTIVEBORDER, + wxSYS_COLOUR_INACTIVEBORDER, + wxSYS_COLOUR_APPWORKSPACE, + wxSYS_COLOUR_HIGHLIGHT, + wxSYS_COLOUR_HIGHLIGHTTEXT, + wxSYS_COLOUR_BTNFACE, + wxSYS_COLOUR_BTNSHADOW, + wxSYS_COLOUR_GRAYTEXT, + wxSYS_COLOUR_BTNTEXT, + wxSYS_COLOUR_INACTIVECAPTIONTEXT, + wxSYS_COLOUR_BTNHIGHLIGHT, + wxSYS_COLOUR_3DDKSHADOW, + wxSYS_COLOUR_3DLIGHT, + wxSYS_COLOUR_INFOTEXT, + wxSYS_COLOUR_INFOBK, + wxSYS_COLOUR_LISTBOX, + wxSYS_COLOUR_HOTLIGHT, + wxSYS_COLOUR_GRADIENTACTIVECAPTION, + wxSYS_COLOUR_GRADIENTINACTIVECAPTION, + wxSYS_COLOUR_MENUHILIGHT, + wxSYS_COLOUR_MENUBAR, + wxSYS_COLOUR_LISTBOXTEXT, + wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT, + + wxSYS_COLOUR_MAX, + + // synonyms + wxSYS_COLOUR_BACKGROUND = wxSYS_COLOUR_DESKTOP, + wxSYS_COLOUR_3DFACE = wxSYS_COLOUR_BTNFACE, + wxSYS_COLOUR_3DSHADOW = wxSYS_COLOUR_BTNSHADOW, + wxSYS_COLOUR_BTNHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT, + wxSYS_COLOUR_3DHIGHLIGHT = wxSYS_COLOUR_BTNHIGHLIGHT, + wxSYS_COLOUR_3DHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT, + wxSYS_COLOUR_FRAMEBK = wxSYS_COLOUR_BTNFACE +}; + +// possible values for wxSystemSettings::GetMetric() index parameter +// +// NB: update the conversion table in msw/settings.cpp if you change the values +// of the elements of this enum +enum wxSystemMetric +{ + wxSYS_MOUSE_BUTTONS = 1, + wxSYS_BORDER_X, + wxSYS_BORDER_Y, + wxSYS_CURSOR_X, + wxSYS_CURSOR_Y, + wxSYS_DCLICK_X, + wxSYS_DCLICK_Y, + wxSYS_DRAG_X, + wxSYS_DRAG_Y, + wxSYS_EDGE_X, + wxSYS_EDGE_Y, + wxSYS_HSCROLL_ARROW_X, + wxSYS_HSCROLL_ARROW_Y, + wxSYS_HTHUMB_X, + wxSYS_ICON_X, + wxSYS_ICON_Y, + wxSYS_ICONSPACING_X, + wxSYS_ICONSPACING_Y, + wxSYS_WINDOWMIN_X, + wxSYS_WINDOWMIN_Y, + wxSYS_SCREEN_X, + wxSYS_SCREEN_Y, + wxSYS_FRAMESIZE_X, + wxSYS_FRAMESIZE_Y, + wxSYS_SMALLICON_X, + wxSYS_SMALLICON_Y, + wxSYS_HSCROLL_Y, + wxSYS_VSCROLL_X, + wxSYS_VSCROLL_ARROW_X, + wxSYS_VSCROLL_ARROW_Y, + wxSYS_VTHUMB_Y, + wxSYS_CAPTION_Y, + wxSYS_MENU_Y, + wxSYS_NETWORK_PRESENT, + wxSYS_PENWINDOWS_PRESENT, + wxSYS_SHOW_SOUNDS, + wxSYS_SWAP_BUTTONS, + wxSYS_DCLICK_MSEC, + wxSYS_CARET_ON_MSEC, + wxSYS_CARET_OFF_MSEC, + wxSYS_CARET_TIMEOUT_MSEC +}; + +// possible values for wxSystemSettings::HasFeature() parameter +enum wxSystemFeature +{ + wxSYS_CAN_DRAW_FRAME_DECORATIONS = 1, + wxSYS_CAN_ICONIZE_FRAME, + wxSYS_TABLET_PRESENT +}; + +// values for different screen designs +enum wxSystemScreenType +{ + wxSYS_SCREEN_NONE = 0, // not yet defined + + wxSYS_SCREEN_TINY, // < + wxSYS_SCREEN_PDA, // >= 320x240 + wxSYS_SCREEN_SMALL, // >= 640x480 + wxSYS_SCREEN_DESKTOP // >= 800x600 +}; + +// ---------------------------------------------------------------------------- +// wxSystemAppearance: describes the global appearance used for the UI +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSystemAppearance +{ +public: + // Return the name if available or empty string otherwise. + wxString GetName() const; + + // Return true if the current system there is explicitly recognized as + // being a dark theme or if the default window background is dark. + bool IsDark() const; + + // Return true if the background is darker than foreground. This is used by + // IsDark() if there is no platform-specific way to determine whether a + // dark mode is being used. + bool IsUsingDarkBackground() const; + +private: + friend class wxSystemSettingsNative; + + // Ctor is private, even though it's trivial, because objects of this type + // are only supposed to be created by wxSystemSettingsNative. + wxSystemAppearance() { } + + // Currently this class doesn't have any internal state because the only + // available implementation doesn't need it. If we do need it later, we + // could add some "wxSystemAppearanceImpl* const m_impl" here, which we'd + // forward our public functions to (we'd also need to add the copy ctor and + // dtor to clone/free it). +}; + +// ---------------------------------------------------------------------------- +// wxSystemSettingsNative: defines the API for wxSystemSettings class +// ---------------------------------------------------------------------------- + +// this is a namespace rather than a class: it has only non virtual static +// functions +// +// also note that the methods are implemented in the platform-specific source +// files (i.e. this is not a real base class as we can't override its virtual +// functions because it doesn't have any) + +class WXDLLIMPEXP_CORE wxSystemSettingsNative +{ +public: + // get a standard system colour + static wxColour GetColour(wxSystemColour index); + + // get a standard system font + static wxFont GetFont(wxSystemFont index); + + // get a system-dependent metric + static int GetMetric(wxSystemMetric index, const wxWindow* win = NULL); + + // get the object describing the current system appearance + static wxSystemAppearance GetAppearance(); + + // return true if the port has certain feature + static bool HasFeature(wxSystemFeature index); +}; + +// ---------------------------------------------------------------------------- +// include the declaration of the real platform-dependent class +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSystemSettings : public wxSystemSettingsNative +{ +public: +#ifdef __WXUNIVERSAL__ + // in wxUniversal we want to use the theme standard colours instead of the + // system ones, otherwise wxSystemSettings is just the same as + // wxSystemSettingsNative + static wxColour GetColour(wxSystemColour index); + + // some metrics are toolkit-dependent and provided by wxUniv, some are + // lowlevel + static int GetMetric(wxSystemMetric index, const wxWindow* win = NULL); +#endif // __WXUNIVERSAL__ + + // Get system screen design (desktop, pda, ..) used for + // laying out various dialogs. + static wxSystemScreenType GetScreenType(); + + // Override default. + static void SetScreenType( wxSystemScreenType screen ); + + // Value + static wxSystemScreenType ms_screen; + +}; + +#endif + // _WX_SETTINGS_H_BASE_ + diff --git a/lib/wxWidgets/include/wx/setup_inc.h b/lib/wxWidgets/include/wx/setup_inc.h new file mode 100644 index 0000000..6fdcd93 --- /dev/null +++ b/lib/wxWidgets/include/wx/setup_inc.h @@ -0,0 +1,1617 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/setup_inc.h +// Purpose: setup.h settings +// Author: Vadim Zeitlin +// Modified by: +// Created: +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ---------------------------------------------------------------------------- +// global settings +// ---------------------------------------------------------------------------- + +// define this to 0 when building wxBase library - this can also be done from +// makefile/project file overriding the value here +#ifndef wxUSE_GUI + #define wxUSE_GUI 1 +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// compatibility settings +// ---------------------------------------------------------------------------- + +// This setting determines the compatibility with 2.8 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_8 0 + +// This setting determines the compatibility with 3.0 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_3_0 1 + +// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when +// default system font is used for wxWindow::GetCharWidth/Height() instead of +// the current font. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxDIALOG_UNIT_COMPATIBILITY 0 + +// Provide unsafe implicit conversions in wxString to "const char*" or +// "std::string" (depending on wxUSE_STD_STRING_CONV_IN_WXSTRING value). +// +// Default is 1 but only for compatibility reasons, it is recommended to set +// this to 0 because converting wxString to a narrow (non-Unicode) string may +// fail unless a locale using UTF-8 encoding is used, which is never the case +// under MSW, for example, hence such conversions can result in silent data +// loss. +// +// Recommended setting: 0 +#define wxUSE_UNSAFE_WXSTRING_CONV 1 + +// If set to 1, enables "reproducible builds", i.e. build output should be +// exactly the same if the same build is redone again. As using __DATE__ and +// __TIME__ macros clearly makes the build irreproducible, setting this option +// to 1 disables their use in the library code. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_REPRODUCIBLE_BUILD 0 + +// ---------------------------------------------------------------------------- +// debugging settings +// ---------------------------------------------------------------------------- + +// wxDEBUG_LEVEL will be defined as 1 in wx/debug.h so normally there is no +// need to define it here. You may do it for two reasons: either completely +// disable/compile out the asserts in release version (then do it inside #ifdef +// NDEBUG) or, on the contrary, enable more asserts, including the usually +// disabled ones, in the debug build (then do it inside #ifndef NDEBUG) +// +// #ifdef NDEBUG +// #define wxDEBUG_LEVEL 0 +// #else +// #define wxDEBUG_LEVEL 2 +// #endif + +// wxHandleFatalExceptions() may be used to catch the program faults at run +// time and, instead of terminating the program with a usual GPF message box, +// call the user-defined wxApp::OnFatalException() function. If you set +// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. +// +// This setting is for Win32 only and can only be enabled if your compiler +// supports Win32 structured exception handling (currently only VC++ does) +// +// Default is 1 +// +// Recommended setting: 1 if your compiler supports it. +#define wxUSE_ON_FATAL_EXCEPTION 1 + +// Set this to 1 to be able to generate a human-readable (unlike +// machine-readable minidump created by wxCrashReport::Generate()) stack back +// trace when your program crashes using wxStackWalker +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_STACKWALKER 1 + +// Set this to 1 to compile in wxDebugReport class which allows you to create +// and optionally upload to your web site a debug report consisting of back +// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, it is compiled into a separate library so there +// is no overhead if you don't use it +#define wxUSE_DEBUGREPORT 1 + +// Generic comment about debugging settings: they are very useful if you don't +// use any other memory leak detection tools such as Purify/BoundsChecker, but +// are probably redundant otherwise. Also, Visual C++ CRT has the same features +// as wxWidgets memory debugging subsystem built in since version 5.0 and you +// may prefer to use it instead of built in memory debugging code because it is +// faster and more fool proof. +// +// Using VC++ CRT memory debugging is enabled by default in debug build (_DEBUG +// is defined) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) +// and if __NO_VC_CRTDBG__ is not defined. + +// The rest of the options in this section are obsolete and not supported, +// enable them at your own risk. + +// If 1, enables wxDebugContext, for writing error messages to file, etc. If +// __WXDEBUG__ is not defined, will still use the normal memory operators. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_CONTEXT 0 + +// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* +// __WXDEBUG__ is also defined. +// +// WARNING: this code may not work with all architectures, especially if +// alignment is an issue. This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 1 if you are not using a memory debugging tool, else 0 +#define wxUSE_MEMORY_TRACING 0 + +// In debug mode, cause new and delete to be redefined globally. +// If this causes problems (e.g. link errors which is a common problem +// especially if you use another library which also redefines the global new +// and delete), set this to 0. +// This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If +// this causes problems (e.g. link errors), set this to 0. You may need to set +// this to 0 if using templates (at least for VC++). This switch is currently +// ignored for MinGW/Cygwin. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_NEW_ALWAYS 0 + + +// ---------------------------------------------------------------------------- +// Unicode support +// ---------------------------------------------------------------------------- + +// This option is deprecated: the library should be always built in Unicode mode +// now, only set wxUSE_UNICODE to 0 to compile legacy code in ANSI mode if +// absolutely necessary -- updating it is strongly recommended as the ANSI mode +// will disappear completely in future wxWidgets releases. +#ifndef wxUSE_UNICODE + #define wxUSE_UNICODE 1 +#endif + +// ---------------------------------------------------------------------------- +// global features +// ---------------------------------------------------------------------------- + +// Compile library in exception-safe mode? If set to 1, the library will try to +// behave correctly in presence of exceptions (even though it still will not +// use the exceptions itself) and notify the user code about any unhandled +// exceptions. If set to 0, propagation of the exceptions through the library +// code will lead to undefined behaviour -- but the code itself will be +// slightly smaller and faster. +// +// Note that like wxUSE_THREADS this option is automatically set to 0 if +// wxNO_EXCEPTIONS is defined. +// +// Default is 1 +// +// Recommended setting: depends on whether you intend to use C++ exceptions +// in your own code (1 if you do, 0 if you don't) +#define wxUSE_EXCEPTIONS 1 + +// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI +// +// This feature is incomplete and experimental, please only enable it if +// you want to participate in its development. +// +// Recommended setting: 0 (unless you wish to try working on it). +#define wxUSE_EXTENDED_RTTI 0 + +// Support for message/error logging. This includes wxLogXXX() functions and +// wxLog and derived classes. Don't set this to 0 unless you really know what +// you are doing. +// +// Default is 1 +// +// Recommended setting: 1 (always) +#define wxUSE_LOG 1 + +// Recommended setting: 1 +#define wxUSE_LOGWINDOW 1 + +// Recommended setting: 1 +#define wxUSE_LOGGUI 1 + +// Recommended setting: 1 +#define wxUSE_LOG_DIALOG 1 + +// Support for command line parsing using wxCmdLineParser class. +// +// Default is 1 +// +// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) +#define wxUSE_CMDLINE_PARSER 1 + +// Support for multithreaded applications: if 1, compile in thread classes +// (thread.h) and make the library a bit more thread safe. Although thread +// support is quite stable by now, you may still consider recompiling the +// library without it if you have no use for it - this will result in a +// somewhat smaller and faster operation. +// +// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset +// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in +// build/msw/config.* file this value will have no effect. +// +// Default is 1 +// +// Recommended setting: 0 unless you do plan to develop MT applications +#define wxUSE_THREADS 1 + +// If enabled, compiles wxWidgets streams classes +// +// wx stream classes are used for image IO, process IO redirection, network +// protocols implementation and much more and so disabling this results in a +// lot of other functionality being lost. +// +// Default is 1 +// +// Recommended setting: 1 as setting it to 0 disables many other things +#define wxUSE_STREAMS 1 + +// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. +// Note that if the system's implementation does not support positional +// parameters, setting this to 1 forces the use of the wxWidgets implementation +// of wxVsnprintf. The standard vsnprintf() supports positional parameters on +// many Unix systems but usually doesn't under Windows. +// +// Positional parameters are very useful when translating a program since using +// them in formatting strings allow translators to correctly reorder the +// translated sentences. +// +// Default is 1 +// +// Recommended setting: 1 if you want to support multiple languages +#define wxUSE_PRINTF_POS_PARAMS 1 + +// Enable the use of compiler-specific thread local storage keyword, if any. +// This is used for wxTLS_XXX() macros implementation and normally should use +// the compiler-provided support as it's simpler and more efficient, but is +// disabled under Windows in wx/msw/chkconf.h as it can't be used if wxWidgets +// is used in a dynamically loaded Win32 DLL (i.e. using LoadLibrary()) under +// XP as this triggers a bug in compiler TLS support that results in crashes +// when any TLS variables are used. +// +// If you're absolutely sure that your build of wxWidgets is never going to be +// used in such situation, either because it's not going to be linked from any +// kind of plugin or because you only target Vista or later systems, you can +// set this to 2 to force the use of compiler TLS even under MSW. +// +// Default is 1 meaning that compiler TLS is used only if it's 100% safe. +// +// Recommended setting: 2 if you want to have maximal performance and don't +// care about the scenario described above. +#define wxUSE_COMPILER_TLS 1 + +// ---------------------------------------------------------------------------- +// Interoperability with the standard library. +// ---------------------------------------------------------------------------- + +// Set wxUSE_STL to 1 to enable maximal interoperability with the standard +// library, even at the cost of backwards compatibility. +// +// Default is 0 +// +// Recommended setting: 0 as the options below already provide a relatively +// good level of interoperability and changing this option arguably isn't worth +// diverging from the official builds of the library. +#define wxUSE_STL 0 + +// This is not a real option but is used as the default value for +// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS_COMPATIBLY. +// +// Set it to 0 if you want to disable the use of all standard classes +// completely for some reason. +#define wxUSE_STD_DEFAULT 1 + +// Use standard C++ containers where it can be done without breaking backwards +// compatibility. +// +// This provides better interoperability with the standard library, e.g. with +// this option on it's possible to insert std::vector<> into many wxWidgets +// containers directly. +// +// Default is 1. +// +// Recommended setting is 1 unless you want to avoid all dependencies on the +// standard library. +#define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT + +// Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<> +// and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but +// usually more limited) implementations are used which allows to avoid the +// dependency on the C++ run-time library. +// +// Default is 0 for compatibility reasons. +// +// Recommended setting: 1 unless compatibility with the official wxWidgets +// build and/or the existing code is a concern. +#define wxUSE_STD_CONTAINERS 0 + +// Use standard C++ streams if 1 instead of wx streams in some places. If +// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the +// standard streams library. +// +// Notice that enabling this does not replace wx streams with std streams +// everywhere, in a lot of places wx streams are used no matter what. +// +// Default is 1 if compiler supports it. +// +// Recommended setting: 1 if you use the standard streams anyhow and so +// dependency on the standard streams library is not a +// problem +#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT + +// Enable minimal interoperability with the standard C++ string class if 1. +// "Minimal" means that wxString can be constructed from std::string or +// std::wstring but can't be implicitly converted to them. You need to enable +// the option below for the latter. +// +// Default is 1 for most compilers. +// +// Recommended setting: 1 unless you want to ensure your program doesn't use +// the standard C++ library at all. +#define wxUSE_STD_STRING wxUSE_STD_DEFAULT + +// Make wxString as much interchangeable with std::[w]string as possible, in +// particular allow implicit conversion of wxString to either of these classes. +// This comes at a price (or a benefit, depending on your point of view) of not +// allowing implicit conversion to "const char *" and "const wchar_t *". +// +// Because a lot of existing code relies on these conversions, this option is +// disabled by default but can be enabled for your build if you don't care +// about compatibility. +// +// Default is 0 if wxUSE_STL has its default value or 1 if it is enabled. +// +// Recommended setting: 0 to remain compatible with the official builds of +// wxWidgets. +#define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL + +// ---------------------------------------------------------------------------- +// non GUI features selection +// ---------------------------------------------------------------------------- + +// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit +// integer which is implemented in terms of native 64 bit integers if any or +// uses emulation otherwise. +// +// This class is required by wxDateTime and so you should enable it if you want +// to use wxDateTime. For most modern platforms, it will use the native 64 bit +// integers in which case (almost) all of its functions are inline and it +// almost does not take any space, so there should be no reason to switch it +// off. +// +// Recommended setting: 1 +#define wxUSE_LONGLONG 1 + +// Set wxUSE_BASE64 to 1, to compile in Base64 support. This is required for +// storing binary data in wxConfig on most platforms. +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_BASE64 1 + +// Set this to 1 to be able to use wxEventLoop even in console applications +// (i.e. using base library only, without GUI). This is mostly useful for +// processing socket events but is also necessary to use timers in console +// applications +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_CONSOLE_EVENTLOOP 1 + +// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level +// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. +// +// Default is 1 +// +// Recommended setting: 1 (wxFile is highly recommended as it is required by +// i18n code, wxFileConfig and others) +#define wxUSE_FILE 1 +#define wxUSE_FFILE 1 + +// Use wxFSVolume class providing access to the configured/active mount points +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely disabled if you don't use it) +#define wxUSE_FSVOLUME 1 + +// Use wxSecretStore class for storing passwords using OS-specific facilities. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely disabled if you don't use it) +#define wxUSE_SECRETSTORE 1 + +// Allow the use of the OS built-in spell checker in wxTextCtrl. +// +// Default is 1, the corresponding wxTextCtrl functions simply won't do +// anything if the functionality is not supported by the current platform. +// +// Recommended setting: 1 unless you want to save a tiny bit of code. +#define wxUSE_SPELLCHECK 1 + +// Use wxStandardPaths class which allows to retrieve some standard locations +// in the file system +// +// Default is 1 +// +// Recommended setting: 1 (may be disabled to save space, but not much) +#define wxUSE_STDPATHS 1 + +// use wxTextBuffer class: required by wxTextFile +#define wxUSE_TEXTBUFFER 1 + +// use wxTextFile class: requires wxFile and wxTextBuffer, required by +// wxFileConfig +#define wxUSE_TEXTFILE 1 + +// i18n support: _() macro, wxLocale class. +#define wxUSE_INTL 1 + +// Provide wxFoo_l() functions similar to standard foo() functions but taking +// an extra locale parameter. +// +// Notice that this is fully implemented only for the systems providing POSIX +// xlocale support or Microsoft Visual C++ >= 8 (which provides proprietary +// almost-equivalent of xlocale functions), otherwise wxFoo_l() functions will +// only work for the current user locale and "C" locale. You can use +// wxHAS_XLOCALE_SUPPORT to test whether the full support is available. +// +// Default is 1 +// +// Recommended setting: 1 but may be disabled if you are writing programs +// running only in C locale anyhow +#define wxUSE_XLOCALE 1 + +// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which +// allow to manipulate dates, times and time intervals. +// +// Requires: wxUSE_LONGLONG +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_DATETIME 1 + +// Set wxUSE_TIMER to 1 to compile wxTimer class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_TIMER 1 + +// Use wxStopWatch class. +// +// Default is 1 +// +// Recommended setting: 1 (needed by wxSocket) +#define wxUSE_STOPWATCH 1 + +// Set wxUSE_FSWATCHER to 1 if you want to enable wxFileSystemWatcher +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_FSWATCHER 1 + +// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes +// which allow the application to store its settings in the persistent +// storage. Setting this to 1 will also enable on-demand creation of the +// global config object in wxApp. +// +// See also wxUSE_CONFIG_NATIVE below. +// +// Recommended setting: 1 +#define wxUSE_CONFIG 1 + +// If wxUSE_CONFIG is 1, you may choose to use either the native config +// classes under Windows (using the registry) or the portable text file +// format used by the config classes under Unix. +// +// Default is 1 to use native classes. Note that you may still use +// wxFileConfig even if you set this to 1 - just the config object created by +// default for the applications needs will be a wxRegConfig or wxIniConfig and +// not wxFileConfig. +// +// Recommended setting: 1 +#define wxUSE_CONFIG_NATIVE 1 + +// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows +// to connect/disconnect from the network and be notified whenever the dial-up +// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DIALUP_MANAGER 1 + +// Compile in classes for run-time DLL loading and function calling. +// Required by wxUSE_DIALUP_MANAGER. +// +// This setting is for Win32 only +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DYNLIB_CLASS 1 + +// experimental, don't use for now +#define wxUSE_DYNAMIC_LOADER 1 + +// Set to 1 to use socket classes +#define wxUSE_SOCKETS 1 + +// Set to 1 to use ipv6 socket classes (requires wxUSE_SOCKETS) +// +// Default is 1. +// +// Recommended setting: 1. +#define wxUSE_IPV6 1 + +// Set to 1 to enable virtual file systems (required by wxHTML) +#define wxUSE_FILESYSTEM 1 + +// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ZIP 1 + +// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ARCHIVE 1 + +// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_INET 1 + +// wxArchive classes for accessing archives such as zip and tar +#define wxUSE_ARCHIVE_STREAMS 1 + +// Set to 1 to compile wxZipInput/OutputStream classes. +#define wxUSE_ZIPSTREAM 1 + +// Set to 1 to compile wxTarInput/OutputStream classes. +#define wxUSE_TARSTREAM 1 + +// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by +// wxUSE_LIBPNG +#define wxUSE_ZLIB 1 + +// Set to 1 if liblzma is available to enable wxLZMA{Input,Output}Stream +// classes. +// +// Notice that if you enable this build option when not using configure or +// CMake, you need to ensure that liblzma headers and libraries are available +// (i.e. by building the library yourself or downloading its binaries) and can +// be found, either by copying them to one of the locations searched by the +// compiler/linker by default (e.g. any of the directories in the INCLUDE or +// LIB environment variables, respectively, when using MSVC) or modify the +// make- or project files to add references to these directories. +// +// Default is 0 under MSW, auto-detected by configure. +// +// Recommended setting: 1 if you need LZMA compression. +#define wxUSE_LIBLZMA 0 + +// If enabled, the code written by Apple will be used to write, in a portable +// way, float on the disk. See extended.c for the license which is different +// from wxWidgets one. +// +// Default is 1. +// +// Recommended setting: 1 unless you don't like the license terms (unlikely) +#define wxUSE_APPLE_IEEE 1 + +// Joystick support class +#define wxUSE_JOYSTICK 1 + +// wxFontEnumerator class +#define wxUSE_FONTENUM 1 + +// wxFontMapper class +#define wxUSE_FONTMAP 1 + +// wxMimeTypesManager class +#define wxUSE_MIMETYPE 1 + +// wxWebRequest allows usage of system libraries for HTTP(S) requests. +// +// Note that for wxWebRequest to be built, at least one of its backends must be +// available. Under MSW and macOS this will always be the case unless +// explicitly disabled. +// +// Default is 1 +// +// Recommended setting: 1, setting it to 0 may be useful to avoid dependencies +// on libcurl on Unix systems. +#define wxUSE_WEBREQUEST 1 + +// wxWebRequest backend based on NSURLSession +// +// Default is 1 under macOS. +// +// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, +// otherwise wxWebRequest won't be available at all under Mac. +#ifdef __APPLE__ +#define wxUSE_WEBREQUEST_URLSESSION wxUSE_WEBREQUEST +#else +#define wxUSE_WEBREQUEST_URLSESSION 0 +#endif + +// wxWebRequest backend based on libcurl, can be used under all platforms. +// +// Default is 0 for MSW and macOS, detected automatically when using configure. +// +// Recommended setting: 0 on Windows and macOS, otherwise 1 as it is required +// for wxWebRequest to be available at all. +#define wxUSE_WEBREQUEST_CURL 0 + +// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP +// or wxURL you need to set this to 1. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_PROTOCOL 1 + +// The settings for the individual URL schemes +#define wxUSE_PROTOCOL_FILE 1 +#define wxUSE_PROTOCOL_FTP 1 +#define wxUSE_PROTOCOL_HTTP 1 + +// Define this to use wxURL class. +#define wxUSE_URL 1 + +// Define this to use native platform url and protocol support. +// Currently valid only for MS-Windows. +// Note: if you set this to 1, you can open ftp/http/gopher sites +// and obtain a valid input stream for these sites +// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. +// Doing so reduces the code size. +// +// This code is experimental and subject to change. +#define wxUSE_URL_NATIVE 0 + +// Support for wxVariant class used in several places throughout the library, +// notably in wxDataViewCtrl API. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size as much as +// possible in which case setting this to 0 can gain up to 100KB. +#define wxUSE_VARIANT 1 + +// Support for wxAny class, the successor for wxVariant. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size by a small amount, +// or your compiler cannot for some reason cope with complexity of templates used. +#define wxUSE_ANY 1 + +// Support for regular expression matching via wxRegEx class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_REGEX 1 + +// wxSystemOptions class +#define wxUSE_SYSTEM_OPTIONS 1 + +// wxSound class +#define wxUSE_SOUND 1 + +// Use wxMediaCtrl +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_MEDIACTRL 1 + +// Use wxWidget's XRC XML-based resource system. Recommended. +// +// Default is 1 +// +// Recommended setting: 1 (requires wxUSE_XML) +#define wxUSE_XRC 1 + +// XML parsing classes. +// +// Default is 1 +// +// Recommended setting: 1 (required by XRC) +#define wxUSE_XML 1 + +// Use wxWidget's AUI docking system +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_AUI 1 + +// Use wxWidget's Ribbon classes for interfaces +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_RIBBON 1 + +// Use wxPropertyGrid. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_PROPGRID 1 + +// Use wxStyledTextCtrl, a wxWidgets Scintilla wrapper. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STC 1 + +// Use wxWidget's web viewing classes +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_WEBVIEW 1 + +// Use the IE wxWebView backend +// +// Default is 1 on MSW +// +// Recommended setting: 1 +#ifdef __WXMSW__ +#define wxUSE_WEBVIEW_IE 1 +#else +#define wxUSE_WEBVIEW_IE 0 +#endif + +// Use the Edge (Chromium) wxWebView backend (Requires WebView2 SDK) +// +// Default is 0 because WebView2 is not always available, set it to 1 if you do have it. +// +// Recommended setting: 1 when building for Windows with WebView2 SDK +#define wxUSE_WEBVIEW_EDGE 0 + +// Use the Edge (Chromium) wxWebView backend without loader DLL +// +// Default is 0, set it to 1 if you don't want to depend on WebView2Loader.dll. +// +// Recommended setting: 0 +#define wxUSE_WEBVIEW_EDGE_STATIC 0 + +// Use the WebKit wxWebView backend +// +// Default is 1 on GTK and OSX +// +// Recommended setting: 1 +#if (defined(__WXGTK__) && !defined(__WXGTK3__)) || defined(__WXOSX__) +#define wxUSE_WEBVIEW_WEBKIT 1 +#else +#define wxUSE_WEBVIEW_WEBKIT 0 +#endif + +// Use the WebKit2 wxWebView backend +// +// Default is 1 on GTK3 +// +// Recommended setting: 1 +#if defined(__WXGTK3__) +#define wxUSE_WEBVIEW_WEBKIT2 1 +#else +#define wxUSE_WEBVIEW_WEBKIT2 0 +#endif + +// Enable wxGraphicsContext and related classes for a modern 2D drawing API. +// +// Default is 1 except if you're using a compiler without support for GDI+ +// under MSW, i.e. gdiplus.h and related headers (MSVC and MinGW >= 4.8 are +// known to have them). For other compilers (e.g. older mingw32) you may need +// to install the headers (and just the headers) yourself. If you do, change +// the setting below manually. +// +// Recommended setting: 1 if supported by the compilation environment + +// Notice that we can't use wxCHECK_VISUALC_VERSION() nor wxCHECK_GCC_VERSION() +// here as this file is included from wx/platform.h before they're defined. +#if defined(_MSC_VER) || \ + (defined(__MINGW32__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 8)) +#define wxUSE_GRAPHICS_CONTEXT 1 +#else +// Disable support for other Windows compilers, enable it if your compiler +// comes with new enough SDK or you installed the headers manually. +// +// Notice that this will be set by configure under non-Windows platforms +// anyhow so the value there is not important. +#define wxUSE_GRAPHICS_CONTEXT 0 +#endif + +// Enable wxGraphicsContext implementation using Cairo library. +// +// This is not needed under Windows and detected automatically by configure +// under other systems, however you may set this to 1 manually if you installed +// Cairo under Windows yourself and prefer to use it instead the native GDI+ +// implementation. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_CAIRO 0 + + +// ---------------------------------------------------------------------------- +// Individual GUI controls +// ---------------------------------------------------------------------------- + +// You must set wxUSE_CONTROLS to 1 if you are using any controls at all +// (without it, wxControl class is not compiled) +// +// Default is 1 +// +// Recommended setting: 1 (don't change except for very special programs) +#define wxUSE_CONTROLS 1 + +// Support markup in control labels, i.e. provide wxControl::SetLabelMarkup(). +// Currently markup is supported only by a few controls and only some ports but +// their number will increase with time. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you want to save on code size) +#define wxUSE_MARKUP 1 + +// wxPopupWindow class is a top level transient window. It is currently used +// to implement wxTipWindow +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) +#define wxUSE_POPUPWIN 1 + +// wxTipWindow allows to implement the custom tooltips, it is used by the +// context help classes. Requires wxUSE_POPUPWIN. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0) +#define wxUSE_TIPWINDOW 1 + +// Each of the settings below corresponds to one wxWidgets control. They are +// all switched on by default but may be disabled if you are sure that your +// program (including any standard dialogs it can show!) doesn't need them and +// if you desperately want to save some space. If you use any of these you must +// set wxUSE_CONTROLS as well. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_ACTIVITYINDICATOR 1 // wxActivityIndicator +#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl +#define wxUSE_BANNERWINDOW 1 // wxBannerWindow +#define wxUSE_BUTTON 1 // wxButton +#define wxUSE_BMPBUTTON 1 // wxBitmapButton +#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl +#define wxUSE_CHECKBOX 1 // wxCheckBox +#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) +#define wxUSE_CHOICE 1 // wxChoice +#define wxUSE_COLLPANE 1 // wxCollapsiblePane +#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl +#define wxUSE_COMBOBOX 1 // wxComboBox +#define wxUSE_COMMANDLINKBUTTON 1 // wxCommandLinkButton +#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl +#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl +#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl +#define wxUSE_EDITABLELISTBOX 1 // wxEditableListBox +#define wxUSE_FILECTRL 1 // wxFileCtrl +#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl +#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl +#define wxUSE_GAUGE 1 // wxGauge +#define wxUSE_HEADERCTRL 1 // wxHeaderCtrl +#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl +#define wxUSE_LISTBOX 1 // wxListBox +#define wxUSE_LISTCTRL 1 // wxListCtrl +#define wxUSE_RADIOBOX 1 // wxRadioBox +#define wxUSE_RADIOBTN 1 // wxRadioButton +#define wxUSE_RICHMSGDLG 1 // wxRichMessageDialog +#define wxUSE_SCROLLBAR 1 // wxScrollBar +#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl +#define wxUSE_SLIDER 1 // wxSlider +#define wxUSE_SPINBTN 1 // wxSpinButton +#define wxUSE_SPINCTRL 1 // wxSpinCtrl +#define wxUSE_STATBOX 1 // wxStaticBox +#define wxUSE_STATLINE 1 // wxStaticLine +#define wxUSE_STATTEXT 1 // wxStaticText +#define wxUSE_STATBMP 1 // wxStaticBitmap +#define wxUSE_TEXTCTRL 1 // wxTextCtrl +#define wxUSE_TIMEPICKCTRL 1 // wxTimePickerCtrl +#define wxUSE_TOGGLEBTN 1 // requires wxButton +#define wxUSE_TREECTRL 1 // wxTreeCtrl +#define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl + +// Use generic version of wxDataViewCtrl even if a native one is available? +// +// Default is 1. +// +// Recommended setting: 1, but can be set to 0 if your program is affected by +// the native control limitations. +#define wxUSE_NATIVE_DATAVIEWCTRL 1 + +// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR +// below either wxStatusBar95 or a generic wxStatusBar will be used. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STATUSBAR 1 + +// Two status bar implementations are available under Win32: the generic one +// or the wrapper around native control. For native look and feel the native +// version should be used. +// +// Default is 1 for the platforms where native status bar is supported. +// +// Recommended setting: 1 (there is no advantage in using the generic one) +#define wxUSE_NATIVE_STATUSBAR 1 + +// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar +// classes at all. Otherwise, use the native toolbar class unless +// wxUSE_TOOLBAR_NATIVE is 0. +// +// Default is 1 for all settings. +// +// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. +#define wxUSE_TOOLBAR 1 +#define wxUSE_TOOLBAR_NATIVE 1 + +// wxNotebook is a control with several "tabs" located on one of its sides. It +// may be used to logically organise the data presented to the user instead of +// putting everything in one huge dialog. It replaces wxTabControl and related +// classes of wxWin 1.6x. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTEBOOK 1 + +// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_LISTBOOK 1 + +// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CHOICEBOOK 1 + +// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TREEBOOK 1 + +// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of +// tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLBOOK 1 + +// wxTaskBarIcon is a small notification icon shown in the system toolbar or +// dock. +// +// Default is 1. +// +// Recommended setting: 1 (but can be set to 0 if you don't need it) +#define wxUSE_TASKBARICON 1 + +// wxGrid class +// +// Default is 1, set to 0 to cut down compilation time and binaries size if you +// don't use it. +// +// Recommended setting: 1 +// +#define wxUSE_GRID 1 + +// wxMiniFrame class: a frame with narrow title bar +// +// Default is 1. +// +// Recommended setting: 1 (it doesn't cost almost anything) +#define wxUSE_MINIFRAME 1 + +// wxComboCtrl and related classes: combobox with custom popup window and +// not necessarily a listbox. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it +// is used by wxComboBox +#define wxUSE_COMBOCTRL 1 + +// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox +// items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0, except where it is +// needed as a base class for generic wxBitmapComboBox. +#define wxUSE_ODCOMBOBOX 1 + +// wxBitmapComboBox is a combobox that can have images in front of text items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 +#define wxUSE_BITMAPCOMBOBOX 1 + +// wxRearrangeCtrl is a wxCheckListBox with two buttons allowing to move items +// up and down in it. It is also used as part of wxRearrangeDialog. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 (currently used only by +// wxHeaderCtrl) +#define wxUSE_REARRANGECTRL 1 + +// wxAddRemoveCtrl is a composite control containing a control showing some +// items (e.g. wxListBox, wxListCtrl, wxTreeCtrl, wxDataViewCtrl, ...) and "+"/ +// "-" buttons allowing to add and remove items to/from the control. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 if you don't need it (not +// used by the library itself). +#define wxUSE_ADDREMOVECTRL 1 + +// ---------------------------------------------------------------------------- +// Miscellaneous GUI stuff +// ---------------------------------------------------------------------------- + +// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) +#define wxUSE_ACCEL 1 + +// Use the standard art provider. The icons returned by this provider are +// embedded into the library as XPMs so disabling it reduces the library size +// somewhat but this should only be done if you use your own custom art +// provider returning the icons or never use any icons not provided by the +// native art provider (which might not be implemented at all for some +// platforms) or by the Tango icons provider (if it's not itself disabled +// below). +// +// Default is 1. +// +// Recommended setting: 1 unless you use your own custom art provider. +#define wxUSE_ARTPROVIDER_STD 1 + +// Use art provider providing Tango icons: this art provider has higher quality +// icons than the default one. It uses SVG format which allows much better scaling +// then when bitmaps are used, at the expense of somewhat larger library size. +// +// Default is 1 under non-GTK ports. Under wxGTK the native art provider using +// the GTK+ stock icons replaces it so it is normally not necessary. +// +// Recommended setting: 1 but can be turned off to reduce the library size. +#define wxUSE_ARTPROVIDER_TANGO 1 + +// Hotkey support (currently Windows and macOS only) +#define wxUSE_HOTKEY 1 + +// Use wxCaret: a class implementing a "cursor" in a text control (called caret +// under Windows). +// +// Default is 1. +// +// Recommended setting: 1 (can be safely set to 0, not used by the library) +#define wxUSE_CARET 1 + +// Use wxDisplay class: it allows enumerating all displays on a system and +// their geometries as well as finding the display on which the given point or +// window lies. +// +// Default is 1. +// +// Recommended setting: 1 if you need it, can be safely set to 0 otherwise +#define wxUSE_DISPLAY 1 + +// Miscellaneous geometry code: needed for Canvas library +#define wxUSE_GEOMETRY 1 + +// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and +// wxListCtrl. +// +// Default is 1. +// +// Recommended setting: 1 (set it to 0 if you don't use any of the controls +// enumerated above, then this class is mostly useless too) +#define wxUSE_IMAGLIST 1 + +// Use wxInfoBar class. +// +// Default is 1. +// +// Recommended setting: 1 (but can be disabled without problems as nothing +// depends on it) +#define wxUSE_INFOBAR 1 + +// Use wxMenu, wxMenuItem. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUS 1 + +// Use wxMenuBar. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUBAR 1 + +// Use wxNotificationMessage. +// +// wxNotificationMessage allows to show non-intrusive messages to the user +// using balloons, banners, popups or whatever is the appropriate method for +// the current platform. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTIFICATION_MESSAGE 1 + +// wxPreferencesEditor provides a common API for different ways of presenting +// the standard "Preferences" or "Properties" dialog under different platforms +// (e.g. some use modal dialogs, some use modeless ones; some apply the changes +// immediately while others require an explicit "Apply" button). +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_PREFERENCES_EDITOR 1 + +// wxFont::AddPrivateFont() allows to use fonts not installed on the system by +// loading them from font files during run-time. +// +// Default is 1 except under Unix where it will be turned off by configure if +// the required libraries are not available or not new enough. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it and +// want to avoid extra dependencies under Linux, for example). +#define wxUSE_PRIVATE_FONTS 1 + +// wxRichToolTip is a customizable tooltip class which has more functionality +// than the stock (but native, unlike this class) wxToolTip. +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely set to 0 if you don't need it) +#define wxUSE_RICHTOOLTIP 1 + +// Use wxSashWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SASH 1 + +// Use wxSplitterWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SPLITTER 1 + +// Use wxToolTip and wxWindow::Set/GetToolTip() methods. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLTIPS 1 + +// wxValidator class and related methods +#define wxUSE_VALIDATORS 1 + +// Use reference counted ID management: this means that wxWidgets will track +// the automatically allocated ids (those used when you use wxID_ANY when +// creating a window, menu or toolbar item &c) instead of just supposing that +// the program never runs out of them. This is mostly useful only under wxMSW +// where the total ids range is limited to SHRT_MIN..SHRT_MAX and where +// long-running programs can run into problems with ids reuse without this. On +// the other platforms, where the ids have the full int range, this shouldn't +// be necessary. +#ifdef __WXMSW__ +#define wxUSE_AUTOID_MANAGEMENT 1 +#else +#define wxUSE_AUTOID_MANAGEMENT 0 +#endif + +// ---------------------------------------------------------------------------- +// common dialogs +// ---------------------------------------------------------------------------- + +// Use common dialogs (e.g. file selector, printer dialog). Switching this off +// also switches off the printing architecture and interactive wxPrinterDC. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COMMON_DIALOGS 1 + +// wxBusyInfo displays window with message when app is busy. Works in same way +// as wxBusyCursor +#define wxUSE_BUSYINFO 1 + +// Use single/multiple choice dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_CHOICEDLG 1 + +// Use colour picker dialog +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COLOURDLG 1 + +// wxDirDlg class for getting a directory name from user +#define wxUSE_DIRDLG 1 + +// Use file open/save dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in many places in the library itself) +#define wxUSE_FILEDLG 1 + +// Use find/replace dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely set to 0) +#define wxUSE_FINDREPLDLG 1 + +// Use font picker dialog +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_FONTDLG 1 + +// Use wxMessageDialog and wxMessageBox. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_MSGDLG 1 + +// progress dialog class for lengthy operations +#define wxUSE_PROGRESSDLG 1 + +// Set to 0 to disable the use of the native progress dialog (currently only +// available under MSW and suffering from some bugs there, hence this option). +#define wxUSE_NATIVE_PROGRESSDLG 1 + +// support for startup tips (wxShowTip &c) +#define wxUSE_STARTUP_TIPS 1 + +// text entry dialog and wxGetTextFromUser function +#define wxUSE_TEXTDLG 1 + +// number entry dialog +#define wxUSE_NUMBERDLG 1 + +// credential entry dialog +#define wxUSE_CREDENTIALDLG 1 + +// splash screen class +#define wxUSE_SPLASH 1 + +// wizards +#define wxUSE_WIZARDDLG 1 + +// Compile in wxAboutBox() function showing the standard "About" dialog. +// +// Default is 1 +// +// Recommended setting: 1 but can be set to 0 to save some space if you don't +// use this function +#define wxUSE_ABOUTDLG 1 + +// wxFileHistory class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_FILE_HISTORY 1 + +// ---------------------------------------------------------------------------- +// Metafiles support +// ---------------------------------------------------------------------------- + +// Windows supports the graphics format known as metafile which, though not +// portable, is widely used under Windows and so is supported by wxWidgets +// (under Windows only, of course). Both the so-called "Window MetaFiles" or +// WMFs, and "Enhanced MetaFiles" or EMFs are supported in wxWin and, by +// default, EMFs will be used. This may be changed by setting +// wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting wxUSE_ENH_METAFILE to 0. +// You may also set wxUSE_METAFILE to 0 to not compile in any metafile +// related classes at all. +// +// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. +// +// Recommended setting: default or 0 for everything for portable programs. +#define wxUSE_METAFILE 1 +#define wxUSE_ENH_METAFILE 1 +#define wxUSE_WIN_METAFILES_ALWAYS 0 + +// ---------------------------------------------------------------------------- +// Big GUI components +// ---------------------------------------------------------------------------- + +// Set to 0 to disable MDI support. +// +// Requires wxUSE_NOTEBOOK under platforms other than MSW. +// +// Default is 1. +// +// Recommended setting: 1, can be safely set to 0. +#define wxUSE_MDI 1 + +// Set to 0 to disable document/view architecture +#define wxUSE_DOC_VIEW_ARCHITECTURE 1 + +// Set to 0 to disable MDI document/view architecture +// +// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE +#define wxUSE_MDI_ARCHITECTURE 1 + +// Set to 0 to disable print/preview architecture code +#define wxUSE_PRINTING_ARCHITECTURE 1 + +// wxHTML allows displaying simple HTML. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_HTML 1 + +// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL +// headers and libraries to be able to compile the library with wxUSE_GLCANVAS +// set to 1 and, under Windows, also to add opengl32.lib and glu32.lib to the +// list of libraries used to link your application when linking to wxWidgets +// statically (although this is done implicitly for Microsoft Visual C++ users). +// +// Default is 1. +// +// Recommended setting: 1 if you intend to use OpenGL, can be safely set to 0 +// otherwise. +#define wxUSE_GLCANVAS 1 + +// Setting wxUSE_GLCANVAS_EGL to 1 enables OpenGL EGL backend. This will be +// automatically enabled if EGL support is detected. EGL support is only +// available under Unix platforms. +// +// Default is 0. +// +#define wxUSE_GLCANVAS_EGL 0 + +// wxRichTextCtrl allows editing of styled text. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 if you want compile a +// smaller library. +#define wxUSE_RICHTEXT 1 + +// ---------------------------------------------------------------------------- +// Data transfer +// ---------------------------------------------------------------------------- + +// Use wxClipboard class for clipboard copy/paste. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CLIPBOARD 1 + +// Use wxDataObject and related classes. Needed for clipboard and OLE drag and +// drop +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DATAOBJ 1 + +// Use wxDropTarget and wxDropSource classes for drag and drop (this is +// different from "built in" drag and drop in wxTreeCtrl which is always +// available). Requires wxUSE_DATAOBJ. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DRAG_AND_DROP 1 + +// Use wxAccessible for enhanced and customisable accessibility. +// Depends on wxUSE_OLE on MSW. +// +// Default is 1 on MSW, 0 elsewhere. +// +// Recommended setting (at present): 1 (MSW-only) +#ifdef __WXMSW__ +#define wxUSE_ACCESSIBILITY 1 +#else +#define wxUSE_ACCESSIBILITY 0 +#endif + +// ---------------------------------------------------------------------------- +// miscellaneous settings +// ---------------------------------------------------------------------------- + +// wxSingleInstanceChecker class allows to verify at startup if another program +// instance is running. +// +// Default is 1 +// +// Recommended setting: 1 (the class is tiny, disabling it won't save much +// space) +#define wxUSE_SNGLINST_CHECKER 1 + +#define wxUSE_DRAGIMAGE 1 + +#define wxUSE_IPC 1 + // 0 for no interprocess comms +#define wxUSE_HELP 1 + // 0 for no help facility + +// Should we use MS HTML help for wxHelpController? If disabled, neither +// wxCHMHelpController nor wxBestHelpController are available. +// +// Default is 1 under MSW, 0 is always used for the other platforms. +// +// Recommended setting: 1, only set to 0 if you have trouble compiling +// wxCHMHelpController (could be a problem with really ancient compilers) +#define wxUSE_MS_HTML_HELP 1 + + +// Use wxHTML-based help controller? +#define wxUSE_WXHTML_HELP 1 + +#define wxUSE_CONSTRAINTS 1 + // 0 for no window layout constraint system + +#define wxUSE_SPLINES 1 + // 0 for no splines + +#define wxUSE_MOUSEWHEEL 1 + // Include mouse wheel support + +// Compile wxUIActionSimulator class? +#define wxUSE_UIACTIONSIMULATOR 1 + +// ---------------------------------------------------------------------------- +// wxDC classes for various output formats +// ---------------------------------------------------------------------------- + +// Set to 1 for PostScript device context. +#define wxUSE_POSTSCRIPT 0 + +// Set to 1 to use font metric files in GetTextExtent +#define wxUSE_AFM_FOR_POSTSCRIPT 1 + +// Set to 1 to compile in support for wxSVGFileDC, a wxDC subclass which allows +// to create files in SVG (Scalable Vector Graphics) format. +#define wxUSE_SVG 1 + +// Should wxDC provide SetTransformMatrix() and related methods? +// +// Default is 1 but can be set to 0 if this functionality is not used. Notice +// that currently wxMSW, wxGTK3 support this for wxDC and all platforms support +// this for wxGCDC so setting this to 0 doesn't change much if neither of these +// is used (although it will still save a few bytes probably). +// +// Recommended setting: 1. +#define wxUSE_DC_TRANSFORM_MATRIX 1 + +// ---------------------------------------------------------------------------- +// image format support +// ---------------------------------------------------------------------------- + +// wxImage supports many different image formats which can be configured at +// compile-time. BMP is always supported, others are optional and can be safely +// disabled if you don't plan to use images in such format sometimes saving +// substantial amount of code in the final library. +// +// Some formats require an extra library (e.g. libpng) which is always included in +// wxWidgets sources but some build systems (cmake, configure) can be configured to +// to use the system or user-provided version. +// +// Set to 1 for wxImage support (recommended). +#define wxUSE_IMAGE 1 + +// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. +#define wxUSE_LIBPNG 1 + +// Set to 1 for JPEG format support (requires libjpeg) +#define wxUSE_LIBJPEG 1 + +// Set to 1 for TIFF format support (requires libtiff) +#define wxUSE_LIBTIFF 1 + +// Set to 1 for SVG rasterizing support using nanosvg +#define wxUSE_NANOSVG 1 + +// Set to 1 to use external nanosvg library when wxUSE_NANOSVG is enabled +#define wxUSE_NANOSVG_EXTERNAL 0 + +// Set to 1 for TGA format support (loading only) +#define wxUSE_TGA 1 + +// Set to 1 for GIF format support +#define wxUSE_GIF 1 + +// Set to 1 for PNM format support +#define wxUSE_PNM 1 + +// Set to 1 for PCX format support +#define wxUSE_PCX 1 + +// Set to 1 for IFF format support (Amiga format) +#define wxUSE_IFF 0 + +// Set to 1 for XPM format support +#define wxUSE_XPM 1 + +// Set to 1 for MS Icons and Cursors format support +#define wxUSE_ICO_CUR 1 + +// Set to 1 to compile in wxPalette class +#define wxUSE_PALETTE 1 + +// ---------------------------------------------------------------------------- +// wxUniversal-only options +// ---------------------------------------------------------------------------- + +// Set to 1 to enable compilation of all themes, this is the default +#define wxUSE_ALL_THEMES 1 + +// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES +// is unset, if it is set these options are not used; notice that metal theme +// uses Win32 one +#define wxUSE_THEME_GTK 0 +#define wxUSE_THEME_METAL 0 +#define wxUSE_THEME_MONO 0 +#define wxUSE_THEME_WIN32 0 + diff --git a/lib/wxWidgets/include/wx/setup_redirect.h b/lib/wxWidgets/include/wx/setup_redirect.h new file mode 100644 index 0000000..7648c19 --- /dev/null +++ b/lib/wxWidgets/include/wx/setup_redirect.h @@ -0,0 +1,17 @@ +/* + * wx/setup.h + * + * This file should not normally be used, except where makefiles + * have not yet been adjusted to take into account of the new scheme + * whereby a setup.h is created under the lib directory. + * + * Copyright: (c) Vadim Zeitlin + * Licence: wxWindows Licence + */ + +#ifdef __WXMSW__ +#include "wx/msw/setup.h" +#else +#error Please adjust your include path to pick up the wx/setup.h file under lib first. +#endif + diff --git a/lib/wxWidgets/include/wx/sharedptr.h b/lib/wxWidgets/include/wx/sharedptr.h new file mode 100644 index 0000000..b9db5c8 --- /dev/null +++ b/lib/wxWidgets/include/wx/sharedptr.h @@ -0,0 +1,169 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/sharedptr.h +// Purpose: Shared pointer based on the counted_ptr<> template, which +// is in the public domain +// Author: Robert Roebling, Yonat Sharon +// Copyright: Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SHAREDPTR_H_ +#define _WX_SHAREDPTR_H_ + +#include "wx/defs.h" +#include "wx/atomic.h" + +// ---------------------------------------------------------------------------- +// wxSharedPtr: A smart pointer with non-intrusive reference counting. +// ---------------------------------------------------------------------------- + +template <class T> +class wxSharedPtr +{ +public: + typedef T element_type; + + explicit wxSharedPtr( T* ptr = NULL ) + : m_ref(NULL) + { + if (ptr) + m_ref = new reftype(ptr); + } + + template<typename Deleter> + explicit wxSharedPtr(T* ptr, Deleter d) + : m_ref(NULL) + { + if (ptr) + m_ref = new reftype_with_deleter<Deleter>(ptr, d); + } + + ~wxSharedPtr() { Release(); } + wxSharedPtr(const wxSharedPtr& tocopy) { Acquire(tocopy.m_ref); } + + wxSharedPtr& operator=( const wxSharedPtr& tocopy ) + { + if (this != &tocopy) + { + Release(); + Acquire(tocopy.m_ref); + } + return *this; + } + + wxSharedPtr& operator=( T* ptr ) + { + if (get() != ptr) + { + Release(); + if (ptr) + m_ref = new reftype(ptr); + } + return *this; + } + + // test for pointer validity: defining conversion to unspecified_bool_type + // and not more obvious bool to avoid implicit conversions to integer types + typedef T *(wxSharedPtr<T>::*unspecified_bool_type)() const; + operator unspecified_bool_type() const + { + if (m_ref && m_ref->m_ptr) + return &wxSharedPtr<T>::get; + else + return NULL; + } + + T& operator*() const + { + wxASSERT(m_ref != NULL); + wxASSERT(m_ref->m_ptr != NULL); + return *(m_ref->m_ptr); + } + + T* operator->() const + { + wxASSERT(m_ref != NULL); + wxASSERT(m_ref->m_ptr != NULL); + return m_ref->m_ptr; + } + + T* get() const + { + return m_ref ? m_ref->m_ptr : NULL; + } + + void reset( T* ptr = NULL ) + { + Release(); + if (ptr) + m_ref = new reftype(ptr); + } + + template<typename Deleter> + void reset(T* ptr, Deleter d) + { + Release(); + if (ptr) + m_ref = new reftype_with_deleter<Deleter>(ptr, d); + } + + bool unique() const { return (m_ref ? m_ref->m_count == 1 : true); } + long use_count() const { return (m_ref ? (long)m_ref->m_count : 0); } + +private: + + struct reftype + { + reftype(T* ptr) : m_ptr(ptr), m_count(1) {} + virtual ~reftype() {} + virtual void delete_ptr() { delete m_ptr; } + + T* m_ptr; + wxAtomicInt m_count; + }; + + template<typename Deleter> + struct reftype_with_deleter : public reftype + { + reftype_with_deleter(T* ptr, Deleter d) : reftype(ptr), m_deleter(d) {} + virtual void delete_ptr() wxOVERRIDE { m_deleter(this->m_ptr); } + + Deleter m_deleter; + }; + + reftype* m_ref; + + void Acquire(reftype* ref) + { + m_ref = ref; + if (ref) + wxAtomicInc( ref->m_count ); + } + + void Release() + { + if (m_ref) + { + if (!wxAtomicDec( m_ref->m_count )) + { + m_ref->delete_ptr(); + delete m_ref; + } + m_ref = NULL; + } + } +}; + +template <class T, class U> +bool operator == (wxSharedPtr<T> const &a, wxSharedPtr<U> const &b ) +{ + return a.get() == b.get(); +} + +template <class T, class U> +bool operator != (wxSharedPtr<T> const &a, wxSharedPtr<U> const &b ) +{ + return a.get() != b.get(); +} + +#endif // _WX_SHAREDPTR_H_ diff --git a/lib/wxWidgets/include/wx/simplebook.h b/lib/wxWidgets/include/wx/simplebook.h new file mode 100644 index 0000000..4d3c481 --- /dev/null +++ b/lib/wxWidgets/include/wx/simplebook.h @@ -0,0 +1,259 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/simplebook.h +// Purpose: wxBookCtrlBase-derived class without any controller. +// Author: Vadim Zeitlin +// Created: 2012-08-21 +// Copyright: (c) 2012 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SIMPLEBOOK_H_ +#define _WX_SIMPLEBOOK_H_ + +#include "wx/bookctrl.h" + +#if wxUSE_BOOKCTRL + +#include "wx/containr.h" +#include "wx/vector.h" + +// Hack to work around problems with wxNavigationEnabled<wxBookCtrlBase> when +// using wx as DLL: we want the compiler to see that it's already available in +// the DLL by including some other DLL exported class using it as the base in +// order to prevent it from generating a non-DLL-exported instantiation which +// will conflict with the one in the DLL at the link-time. +// +// Find the first available class using wxNavigationEnabled<wxBookCtrlBase> as +// base, any will do (except for wxAUI one, as this would create a dependency +// on the AUI library that we can't have here). +#if wxUSE_CHOICEBOOK + #include "wx/choicebk.h" +#elif wxUSE_LISTBOOK + #include "wx/listbook.h" +#elif wxUSE_TOOLBOOK + #include "wx/toolbook.h" +#elif wxUSE_TREEBOOK + #include "wx/treebook.h" +#endif + +// ---------------------------------------------------------------------------- +// wxSimplebook: a book control without any user-actionable controller. +// ---------------------------------------------------------------------------- + +// NB: This class doesn't use DLL export declaration as it's fully inline. + +class wxSimplebook : public wxNavigationEnabled<wxBookCtrlBase> +{ +public: + wxSimplebook() + { + Init(); + } + + wxSimplebook(wxWindow *parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxEmptyString) + { + wxBookCtrlBase::Create(parent, winid, pos, size, style | wxBK_TOP, name); + Init(); + } + + bool Create(wxWindow *parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxEmptyString) + { + return wxBookCtrlBase::Create(parent, winid, pos, size, style | wxBK_TOP, name); + } + + + // Methods specific to this class. + + // A method allowing to add a new page without any label (which is unused + // by this control) and show it immediately. + bool ShowNewPage(wxWindow* page) + { + return AddPage(page, wxString(), true /* select it */); + } + + + // Set effect to use for showing/hiding pages. + void SetEffects(wxShowEffect showEffect, wxShowEffect hideEffect) + { + m_showEffect = showEffect; + m_hideEffect = hideEffect; + } + + // Or the same effect for both of them. + void SetEffect(wxShowEffect effect) + { + SetEffects(effect, effect); + } + + // And the same for time outs. + void SetEffectsTimeouts(unsigned showTimeout, unsigned hideTimeout) + { + m_showTimeout = showTimeout; + m_hideTimeout = hideTimeout; + } + + void SetEffectTimeout(unsigned timeout) + { + SetEffectsTimeouts(timeout, timeout); + } + + + // Implement base class pure virtual methods. + + // Page management + virtual bool InsertPage(size_t n, + wxWindow *page, + const wxString& text, + bool bSelect = false, + int imageId = NO_IMAGE) wxOVERRIDE + { + if ( !wxBookCtrlBase::InsertPage(n, page, text, bSelect, imageId) ) + return false; + + m_pageTexts.insert(m_pageTexts.begin() + n, text); + + if ( !DoSetSelectionAfterInsertion(n, bSelect) ) + page->Hide(); + + return true; + } + + virtual int SetSelection(size_t n) wxOVERRIDE + { + return DoSetSelection(n, SetSelection_SendEvent); + } + + virtual int ChangeSelection(size_t n) wxOVERRIDE + { + return DoSetSelection(n); + } + + // Neither labels nor images are supported but we still store the labels + // just in case the user code attaches some importance to them. + virtual bool SetPageText(size_t n, const wxString& strText) wxOVERRIDE + { + wxCHECK_MSG( n < GetPageCount(), false, wxS("Invalid page") ); + + m_pageTexts[n] = strText; + + return true; + } + + virtual wxString GetPageText(size_t n) const wxOVERRIDE + { + wxCHECK_MSG( n < GetPageCount(), wxString(), wxS("Invalid page") ); + + return m_pageTexts[n]; + } + + virtual bool SetPageImage(size_t WXUNUSED(n), int WXUNUSED(imageId)) wxOVERRIDE + { + return false; + } + + virtual int GetPageImage(size_t WXUNUSED(n)) const wxOVERRIDE + { + return NO_IMAGE; + } + + // Override some wxWindow methods too. + virtual void SetFocus() wxOVERRIDE + { + wxWindow* const page = GetCurrentPage(); + if ( page ) + page->SetFocus(); + } + +protected: + virtual void UpdateSelectedPage(size_t WXUNUSED(newsel)) wxOVERRIDE + { + // Nothing to do here, but must be overridden to avoid the assert in + // the base class version. + } + + virtual wxBookCtrlEvent* CreatePageChangingEvent() const wxOVERRIDE + { + return new wxBookCtrlEvent(wxEVT_BOOKCTRL_PAGE_CHANGING, + GetId()); + } + + virtual void MakeChangedEvent(wxBookCtrlEvent& event) wxOVERRIDE + { + event.SetEventType(wxEVT_BOOKCTRL_PAGE_CHANGED); + } + + virtual wxWindow *DoRemovePage(size_t page) wxOVERRIDE + { + wxWindow* const win = wxBookCtrlBase::DoRemovePage(page); + if ( win ) + { + m_pageTexts.erase(m_pageTexts.begin() + page); + + DoSetSelectionAfterRemoval(page); + } + + return win; + } + + virtual void DoSize() wxOVERRIDE + { + wxWindow* const page = GetCurrentPage(); + if ( page ) + page->SetSize(GetPageRect()); + } + + virtual void DoShowPage(wxWindow* page, bool show) wxOVERRIDE + { + if ( show ) + { + page->ShowWithEffect(m_showEffect, m_showTimeout); + + // Unlike simple Show(), ShowWithEffect() doesn't necessarily give + // focus to the window, but we do expect the new page to have focus. + page->SetFocus(); + } + else + { + page->HideWithEffect(m_hideEffect, m_hideTimeout); + } + } + +private: + void Init() + { + // We don't need any border as we don't have anything to separate the + // page contents from. + SetInternalBorder(0); + + // No effects by default. + m_showEffect = + m_hideEffect = wxSHOW_EFFECT_NONE; + + m_showTimeout = + m_hideTimeout = 0; + } + + wxVector<wxString> m_pageTexts; + + wxShowEffect m_showEffect, + m_hideEffect; + + unsigned m_showTimeout, + m_hideTimeout; + + wxDECLARE_NO_COPY_CLASS(wxSimplebook); +}; + +#endif // wxUSE_BOOKCTRL + +#endif // _WX_SIMPLEBOOK_H_ diff --git a/lib/wxWidgets/include/wx/sizer.h b/lib/wxWidgets/include/wx/sizer.h new file mode 100644 index 0000000..16af934 --- /dev/null +++ b/lib/wxWidgets/include/wx/sizer.h @@ -0,0 +1,1357 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/sizer.h +// Purpose: provide wxSizer class for layout +// Author: Robert Roebling and Robin Dunn +// Modified by: Ron Lee, Vadim Zeitlin (wxSizerFlags) +// Created: +// Copyright: (c) Robin Dunn, Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __WXSIZER_H__ +#define __WXSIZER_H__ + +#include "wx/defs.h" + +#include "wx/window.h" + +//--------------------------------------------------------------------------- +// classes +//--------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxButton; +class WXDLLIMPEXP_FWD_CORE wxBoxSizer; +class WXDLLIMPEXP_FWD_CORE wxSizerItem; +class WXDLLIMPEXP_FWD_CORE wxSizer; + +#ifndef wxUSE_BORDER_BY_DEFAULT + #define wxUSE_BORDER_BY_DEFAULT 1 +#endif + +// ---------------------------------------------------------------------------- +// wxSizerFlags: flags used for an item in the sizer +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSizerFlags +{ +public: + // construct the flags object initialized with the given proportion (0 by + // default) + wxSizerFlags(int proportion = 0) : m_proportion(proportion) + { + m_flags = 0; + m_borderInPixels = 0; + } + + // setters for all sizer flags, they all return the object itself so that + // calls to them can be chained + + wxSizerFlags& Proportion(int proportion) + { + m_proportion = proportion; + return *this; + } + + wxSizerFlags& Expand() + { + m_flags |= wxEXPAND; + return *this; + } + + // notice that Align() replaces the current alignment flags, use specific + // methods below such as Top(), Left() &c if you want to set just the + // vertical or horizontal alignment + wxSizerFlags& Align(int alignment) // combination of wxAlignment values + { + m_flags &= ~wxALIGN_MASK; + m_flags |= alignment; + + return *this; + } + + // this is just a shortcut for Align() + wxSizerFlags& Centre() { return Align(wxALIGN_CENTRE); } + wxSizerFlags& Center() { return Centre(); } + + // but all the remaining methods turn on the corresponding alignment flag + // without affecting the existing ones + wxSizerFlags& CentreVertical() + { + m_flags = (m_flags & ~wxALIGN_BOTTOM) | wxALIGN_CENTRE_VERTICAL; + return *this; + } + + wxSizerFlags& CenterVertical() { return CentreVertical(); } + + wxSizerFlags& CentreHorizontal() + { + m_flags = (m_flags & ~wxALIGN_RIGHT) | wxALIGN_CENTRE_HORIZONTAL; + return *this; + } + + wxSizerFlags& CenterHorizontal() { return CentreHorizontal(); } + + wxSizerFlags& Top() + { + m_flags &= ~(wxALIGN_BOTTOM | wxALIGN_CENTRE_VERTICAL); + return *this; + } + + wxSizerFlags& Left() + { + m_flags &= ~(wxALIGN_RIGHT | wxALIGN_CENTRE_HORIZONTAL); + return *this; + } + + wxSizerFlags& Right() + { + m_flags = (m_flags & ~wxALIGN_CENTRE_HORIZONTAL) | wxALIGN_RIGHT; + return *this; + } + + wxSizerFlags& Bottom() + { + m_flags = (m_flags & ~wxALIGN_CENTRE_VERTICAL) | wxALIGN_BOTTOM; + return *this; + } + + + // default border size used by Border() below + static int GetDefaultBorder() + { + return wxRound(GetDefaultBorderFractional()); + } + + static float GetDefaultBorderFractional() + { +#if wxUSE_BORDER_BY_DEFAULT + #ifdef __WXGTK20__ + // GNOME HIG says to use 6px as the base unit: + // http://library.gnome.org/devel/hig-book/stable/design-window.html.en + return 6; + #elif defined(__WXMAC__) + // Not sure if this is really the correct size for the border. + return 5; + #else + // For the other platforms, we need to scale raw pixel values using the + // current DPI, do it once (and cache the result) in another function. + #define wxNEEDS_BORDER_IN_PX + + return DoGetDefaultBorderInPx(); + #endif +#else + return 0; +#endif + } + + + wxSizerFlags& Border(int direction, int borderInPixels) + { + wxCHECK_MSG( !(direction & ~wxALL), *this, + wxS("direction must be a combination of wxDirection ") + wxS("enum values.") ); + + m_flags &= ~wxALL; + m_flags |= direction; + + m_borderInPixels = borderInPixels; + + return *this; + } + + wxSizerFlags& Border(int direction = wxALL) + { +#if wxUSE_BORDER_BY_DEFAULT + return Border(direction, wxRound(GetDefaultBorderFractional())); +#else + // no borders by default on limited size screen + wxUnusedVar(direction); + + return *this; +#endif + } + + wxSizerFlags& DoubleBorder(int direction = wxALL) + { +#if wxUSE_BORDER_BY_DEFAULT + return Border(direction, wxRound(2 * GetDefaultBorderFractional())); +#else + wxUnusedVar(direction); + + return *this; +#endif + } + + wxSizerFlags& TripleBorder(int direction = wxALL) + { +#if wxUSE_BORDER_BY_DEFAULT + return Border(direction, wxRound(3 * GetDefaultBorderFractional())); +#else + wxUnusedVar(direction); + + return *this; +#endif + } + + wxSizerFlags& HorzBorder() + { +#if wxUSE_BORDER_BY_DEFAULT + return Border(wxLEFT | wxRIGHT, wxRound(GetDefaultBorderFractional())); +#else + return *this; +#endif + } + + wxSizerFlags& DoubleHorzBorder() + { +#if wxUSE_BORDER_BY_DEFAULT + return Border(wxLEFT | wxRIGHT, wxRound(2 * GetDefaultBorderFractional())); +#else + return *this; +#endif + } + + // setters for the others flags + wxSizerFlags& Shaped() + { + m_flags |= wxSHAPED; + + return *this; + } + + wxSizerFlags& FixedMinSize() + { + m_flags |= wxFIXED_MINSIZE; + + return *this; + } + + // makes the item ignore window's visibility status + wxSizerFlags& ReserveSpaceEvenIfHidden() + { + m_flags |= wxRESERVE_SPACE_EVEN_IF_HIDDEN; + return *this; + } + + // accessors for wxSizer only + int GetProportion() const { return m_proportion; } + int GetFlags() const { return m_flags; } + int GetBorderInPixels() const { return m_borderInPixels; } + + // Disablee sizer flags (in)consistency asserts. + static void DisableConsistencyChecks(); + +private: +#ifdef wxNEEDS_BORDER_IN_PX + static float DoGetDefaultBorderInPx(); +#endif // wxNEEDS_BORDER_IN_PX + + int m_proportion; + int m_flags; + int m_borderInPixels; +}; + + +// ---------------------------------------------------------------------------- +// wxSizerSpacer: used by wxSizerItem to represent a spacer +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSizerSpacer +{ +public: + wxSizerSpacer(const wxSize& size) : m_size(size), m_isShown(true) { } + + void SetSize(const wxSize& size) { m_size = size; } + const wxSize& GetSize() const { return m_size; } + + void Show(bool show) { m_isShown = show; } + bool IsShown() const { return m_isShown; } + +private: + // the size, in pixel + wxSize m_size; + + // is the spacer currently shown? + bool m_isShown; +}; + +// ---------------------------------------------------------------------------- +// wxSizerItem +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSizerItem : public wxObject +{ +public: + // window + wxSizerItem( wxWindow *window, + int proportion=0, + int flag=0, + int border=0, + wxObject* userData=NULL ); + + // window with flags + wxSizerItem(wxWindow *window, const wxSizerFlags& flags) + { + Init(flags); + + DoSetWindow(window); + } + + // subsizer + wxSizerItem( wxSizer *sizer, + int proportion=0, + int flag=0, + int border=0, + wxObject* userData=NULL ); + + // sizer with flags + wxSizerItem(wxSizer *sizer, const wxSizerFlags& flags) + { + Init(flags); + + DoSetSizer(sizer); + } + + // spacer + wxSizerItem( int width, + int height, + int proportion=0, + int flag=0, + int border=0, + wxObject* userData=NULL); + + // spacer with flags + wxSizerItem(int width, int height, const wxSizerFlags& flags) + { + Init(flags); + + DoSetSpacer(wxSize(width, height)); + } + + wxSizerItem(); + virtual ~wxSizerItem(); + + virtual void DeleteWindows(); + + // Enable deleting the SizerItem without destroying the contained sizer. + void DetachSizer() { m_sizer = NULL; } + + // Enable deleting the SizerItem without resetting the sizer in the + // contained window. + void DetachWindow() { m_window = NULL; m_kind = Item_None; } + + virtual wxSize GetSize() const; + virtual wxSize CalcMin(); + virtual void SetDimension( const wxPoint& pos, const wxSize& size ); + + wxSize GetMinSize() const + { return m_minSize; } + wxSize GetMinSizeWithBorder() const; + + wxSize GetMaxSize() const + { return IsWindow() ? m_window->GetMaxSize() : wxDefaultSize; } + wxSize GetMaxSizeWithBorder() const; + + void SetMinSize(const wxSize& size) + { + if ( IsWindow() ) + m_window->SetMinSize(size); + m_minSize = size; + } + void SetMinSize( int x, int y ) + { SetMinSize(wxSize(x, y)); } + void SetInitSize( int x, int y ) + { SetMinSize(wxSize(x, y)); } + + // if either of dimensions is zero, ratio is assumed to be 1 + // to avoid "divide by zero" errors + void SetRatio(int width, int height) + { m_ratio = (width && height) ? ((float) width / (float) height) : 1; } + void SetRatio(const wxSize& size) + { SetRatio(size.x, size.y); } + void SetRatio(float ratio) + { m_ratio = ratio; } + float GetRatio() const + { return m_ratio; } + + virtual wxRect GetRect() { return m_rect; } + + // set a sizer item id (different from a window id, all sizer items, + // including spacers, can have an associated id) + void SetId(int id) { m_id = id; } + int GetId() const { return m_id; } + + bool IsWindow() const { return m_kind == Item_Window; } + bool IsSizer() const { return m_kind == Item_Sizer; } + bool IsSpacer() const { return m_kind == Item_Spacer; } + + void SetProportion( int proportion ) + { m_proportion = proportion; } + int GetProportion() const + { return m_proportion; } + void SetFlag( int flag ) + { m_flag = flag; } + int GetFlag() const + { return m_flag; } + void SetBorder( int border ) + { m_border = border; } + int GetBorder() const + { return m_border; } + + wxWindow *GetWindow() const + { return m_kind == Item_Window ? m_window : NULL; } + wxSizer *GetSizer() const + { return m_kind == Item_Sizer ? m_sizer : NULL; } + wxSize GetSpacer() const; + + // This function behaves obviously for the windows and spacers but for the + // sizers it returns true if any sizer element is shown and only returns + // false if all of them are hidden. Also, it always returns true if + // wxRESERVE_SPACE_EVEN_IF_HIDDEN flag was used. + bool IsShown() const; + + void Show(bool show); + + void SetUserData(wxObject* userData) + { delete m_userData; m_userData = userData; } + wxObject* GetUserData() const + { return m_userData; } + wxPoint GetPosition() const + { return m_pos; } + + // Called once the first component of an item has been decided. This is + // used in algorithms that depend on knowing the size in one direction + // before the min size in the other direction can be known. + // Returns true if it made use of the information (and min size was changed). + bool InformFirstDirection( int direction, int size, int availableOtherDir=-1 ); + + // these functions delete the current contents of the item if it's a sizer + // or a spacer but not if it is a window + void AssignWindow(wxWindow *window) + { + Free(); + DoSetWindow(window); + } + + void AssignSizer(wxSizer *sizer) + { + Free(); + DoSetSizer(sizer); + } + + void AssignSpacer(const wxSize& size) + { + Free(); + DoSetSpacer(size); + } + + void AssignSpacer(int w, int h) { AssignSpacer(wxSize(w, h)); } + +#if WXWIN_COMPATIBILITY_2_8 + // these functions do not free the old sizer/spacer and so can easily + // provoke the memory leaks and so shouldn't be used, use Assign() instead + wxDEPRECATED( void SetWindow(wxWindow *window) ); + wxDEPRECATED( void SetSizer(wxSizer *sizer) ); + wxDEPRECATED( void SetSpacer(const wxSize& size) ); + wxDEPRECATED( void SetSpacer(int width, int height) ); +#endif // WXWIN_COMPATIBILITY_2_8 + +protected: + // common part of several ctors + void Init() { m_userData = NULL; m_kind = Item_None; } + + // common part of ctors taking wxSizerFlags + void Init(const wxSizerFlags& flags); + + // free current contents + void Free(); + + // common parts of Set/AssignXXX() + void DoSetWindow(wxWindow *window); + void DoSetSizer(wxSizer *sizer); + void DoSetSpacer(const wxSize& size); + + // Add the border specified for this item to the given size + // if it's != wxDefaultSize, just return wxDefaultSize otherwise. + wxSize AddBorderToSize(const wxSize& size) const; + + // discriminated union: depending on m_kind one of the fields is valid + enum + { + Item_None, + Item_Window, + Item_Sizer, + Item_Spacer, + Item_Max + } m_kind; + union + { + wxWindow *m_window; + wxSizer *m_sizer; + wxSizerSpacer *m_spacer; + }; + + wxPoint m_pos; + wxSize m_minSize; + int m_proportion; + int m_border; + int m_flag; + int m_id; + + // on screen rectangle of this item (not including borders) + wxRect m_rect; + + // Aspect ratio can always be calculated from m_size, + // but this would cause precision loss when the window + // is shrunk. It is safer to preserve the initial value. + float m_ratio; + + wxObject *m_userData; + +private: + wxDECLARE_CLASS(wxSizerItem); + wxDECLARE_NO_COPY_CLASS(wxSizerItem); +}; + +WX_DECLARE_EXPORTED_LIST( wxSizerItem, wxSizerItemList ); + + +//--------------------------------------------------------------------------- +// wxSizer +//--------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSizer: public wxObject, public wxClientDataContainer +{ +public: + wxSizer() { m_containingWindow = NULL; } + virtual ~wxSizer(); + + // methods for adding elements to the sizer: there are Add/Insert/Prepend + // overloads for each of window/sizer/spacer/wxSizerItem + wxSizerItem* Add(wxWindow *window, + int proportion = 0, + int flag = 0, + int border = 0, + wxObject* userData = NULL); + wxSizerItem* Add(wxSizer *sizer, + int proportion = 0, + int flag = 0, + int border = 0, + wxObject* userData = NULL); + wxSizerItem* Add(int width, + int height, + int proportion = 0, + int flag = 0, + int border = 0, + wxObject* userData = NULL); + wxSizerItem* Add( wxWindow *window, const wxSizerFlags& flags); + wxSizerItem* Add( wxSizer *sizer, const wxSizerFlags& flags); + wxSizerItem* Add( int width, int height, const wxSizerFlags& flags); + wxSizerItem* Add( wxSizerItem *item); + + virtual wxSizerItem *AddSpacer(int size); + wxSizerItem* AddStretchSpacer(int prop = 1); + + wxSizerItem* Insert(size_t index, + wxWindow *window, + int proportion = 0, + int flag = 0, + int border = 0, + wxObject* userData = NULL); + wxSizerItem* Insert(size_t index, + wxSizer *sizer, + int proportion = 0, + int flag = 0, + int border = 0, + wxObject* userData = NULL); + wxSizerItem* Insert(size_t index, + int width, + int height, + int proportion = 0, + int flag = 0, + int border = 0, + wxObject* userData = NULL); + wxSizerItem* Insert(size_t index, + wxWindow *window, + const wxSizerFlags& flags); + wxSizerItem* Insert(size_t index, + wxSizer *sizer, + const wxSizerFlags& flags); + wxSizerItem* Insert(size_t index, + int width, + int height, + const wxSizerFlags& flags); + + // NB: do _not_ override this function in the derived classes, this one is + // virtual for compatibility reasons only to allow old code overriding + // it to continue to work, override DoInsert() instead in the new code + virtual wxSizerItem* Insert(size_t index, wxSizerItem *item); + + wxSizerItem* InsertSpacer(size_t index, int size); + wxSizerItem* InsertStretchSpacer(size_t index, int prop = 1); + + wxSizerItem* Prepend(wxWindow *window, + int proportion = 0, + int flag = 0, + int border = 0, + wxObject* userData = NULL); + wxSizerItem* Prepend(wxSizer *sizer, + int proportion = 0, + int flag = 0, + int border = 0, + wxObject* userData = NULL); + wxSizerItem* Prepend(int width, + int height, + int proportion = 0, + int flag = 0, + int border = 0, + wxObject* userData = NULL); + wxSizerItem* Prepend(wxWindow *window, const wxSizerFlags& flags); + wxSizerItem* Prepend(wxSizer *sizer, const wxSizerFlags& flags); + wxSizerItem* Prepend(int width, int height, const wxSizerFlags& flags); + wxSizerItem* Prepend(wxSizerItem *item); + + wxSizerItem* PrependSpacer(int size); + wxSizerItem* PrependStretchSpacer(int prop = 1); + + // set (or possibly unset if window is NULL) or get the window this sizer + // is used in + void SetContainingWindow(wxWindow *window); + wxWindow *GetContainingWindow() const { return m_containingWindow; } + + virtual bool Remove( wxSizer *sizer ); + virtual bool Remove( int index ); + + virtual bool Detach( wxWindow *window ); + virtual bool Detach( wxSizer *sizer ); + virtual bool Detach( int index ); + + virtual bool Replace( wxWindow *oldwin, wxWindow *newwin, bool recursive = false ); + virtual bool Replace( wxSizer *oldsz, wxSizer *newsz, bool recursive = false ); + virtual bool Replace( size_t index, wxSizerItem *newitem ); + + virtual void Clear( bool delete_windows = false ); + virtual void DeleteWindows(); + + // Inform sizer about the first direction that has been decided (by parent item) + // Returns true if it made use of the information (and recalculated min size) + // + // Note that while this method doesn't do anything by default, it should + // almost always be overridden in the derived classes and should have been + // pure virtual if not for backwards compatibility constraints. + virtual bool InformFirstDirection( int WXUNUSED(direction), int WXUNUSED(size), int WXUNUSED(availableOtherDir) ) + { return false; } + + void SetMinSize( int width, int height ) + { DoSetMinSize( width, height ); } + void SetMinSize( const wxSize& size ) + { DoSetMinSize( size.x, size.y ); } + + // Searches recursively + bool SetItemMinSize( wxWindow *window, int width, int height ) + { return DoSetItemMinSize( window, width, height ); } + bool SetItemMinSize( wxWindow *window, const wxSize& size ) + { return DoSetItemMinSize( window, size.x, size.y ); } + + // Searches recursively + bool SetItemMinSize( wxSizer *sizer, int width, int height ) + { return DoSetItemMinSize( sizer, width, height ); } + bool SetItemMinSize( wxSizer *sizer, const wxSize& size ) + { return DoSetItemMinSize( sizer, size.x, size.y ); } + + bool SetItemMinSize( size_t index, int width, int height ) + { return DoSetItemMinSize( index, width, height ); } + bool SetItemMinSize( size_t index, const wxSize& size ) + { return DoSetItemMinSize( index, size.x, size.y ); } + + wxSize GetSize() const + { return m_size; } + wxPoint GetPosition() const + { return m_position; } + + // Calculate the minimal size or return m_minSize if bigger. + wxSize GetMinSize(); + + // These virtual functions are used by the layout algorithm: first + // CalcMin() is called to calculate the minimal size of the sizer and + // prepare for laying it out and then RepositionChildren() is called with + // this size to really update all the sizer items. + virtual wxSize CalcMin() = 0; + + // This method should be overridden but isn't pure virtual for backwards + // compatibility. + virtual void RepositionChildren(const wxSize& WXUNUSED(minSize)) + { + RecalcSizes(); + } + + // This is a deprecated version of RepositionChildren() which doesn't take + // the minimal size parameter which is not needed for very simple sizers + // but typically is for anything more complicated, so prefer to override + // RepositionChildren() in new code. + // + // If RepositionChildren() is not overridden, this method must be + // overridden, calling the base class version results in an assertion + // failure. + virtual void RecalcSizes(); + + virtual void Layout(); + + wxSize ComputeFittingClientSize(wxWindow *window); + wxSize ComputeFittingWindowSize(wxWindow *window); + + wxSize Fit( wxWindow *window ); + void FitInside( wxWindow *window ); + void SetSizeHints( wxWindow *window ); +#if WXWIN_COMPATIBILITY_2_8 + // This only calls FitInside() since 2.9 + wxDEPRECATED( void SetVirtualSizeHints( wxWindow *window ) ); +#endif + + wxSizerItemList& GetChildren() + { return m_children; } + const wxSizerItemList& GetChildren() const + { return m_children; } + + void SetDimension(const wxPoint& pos, const wxSize& size) + { + m_position = pos; + m_size = size; + Layout(); + + // This call is required for wxWrapSizer to be able to calculate its + // minimal size correctly. + InformFirstDirection(wxHORIZONTAL, size.x, size.y); + } + void SetDimension(int x, int y, int width, int height) + { SetDimension(wxPoint(x, y), wxSize(width, height)); } + + size_t GetItemCount() const { return m_children.GetCount(); } + bool IsEmpty() const { return m_children.IsEmpty(); } + + wxSizerItem* GetItem( wxWindow *window, bool recursive = false ); + wxSizerItem* GetItem( wxSizer *sizer, bool recursive = false ); + wxSizerItem* GetItem( size_t index ); + wxSizerItem* GetItemById( int id, bool recursive = false ); + + // Manage whether individual scene items are considered + // in the layout calculations or not. + bool Show( wxWindow *window, bool show = true, bool recursive = false ); + bool Show( wxSizer *sizer, bool show = true, bool recursive = false ); + bool Show( size_t index, bool show = true ); + + bool Hide( wxSizer *sizer, bool recursive = false ) + { return Show( sizer, false, recursive ); } + bool Hide( wxWindow *window, bool recursive = false ) + { return Show( window, false, recursive ); } + bool Hide( size_t index ) + { return Show( index, false ); } + + bool IsShown( wxWindow *window ) const; + bool IsShown( wxSizer *sizer ) const; + bool IsShown( size_t index ) const; + + // Recursively call wxWindow::Show () on all sizer items. + virtual void ShowItems (bool show); + + void Show(bool show) { ShowItems(show); } + + // This is the ShowItems() counterpart and returns true if any of the sizer + // items are shown. + virtual bool AreAnyItemsShown() const; + +protected: + wxSize m_size; + wxSize m_minSize; + wxPoint m_position; + wxSizerItemList m_children; + + // the window this sizer is used in, can be NULL + wxWindow *m_containingWindow; + + wxSize GetMaxClientSize( wxWindow *window ) const; + wxSize GetMinClientSize( wxWindow *window ); + wxSize VirtualFitSize( wxWindow *window ); + + virtual void DoSetMinSize( int width, int height ); + virtual bool DoSetItemMinSize( wxWindow *window, int width, int height ); + virtual bool DoSetItemMinSize( wxSizer *sizer, int width, int height ); + virtual bool DoSetItemMinSize( size_t index, int width, int height ); + + // insert a new item into m_children at given index and return the item + // itself + virtual wxSizerItem* DoInsert(size_t index, wxSizerItem *item); + +private: + wxDECLARE_CLASS(wxSizer); +}; + +//--------------------------------------------------------------------------- +// wxGridSizer +//--------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGridSizer: public wxSizer +{ +public: + // ctors specifying the number of columns only: number of rows will be + // deduced automatically depending on the number of sizer elements + wxGridSizer( int cols, int vgap, int hgap ); + wxGridSizer( int cols, const wxSize& gap = wxSize(0, 0) ); + + // ctors specifying the number of rows and columns + wxGridSizer( int rows, int cols, int vgap, int hgap ); + wxGridSizer( int rows, int cols, const wxSize& gap ); + + virtual void RepositionChildren(const wxSize& minSize) wxOVERRIDE; + virtual wxSize CalcMin() wxOVERRIDE; + + void SetCols( int cols ) + { + wxASSERT_MSG( cols >= 0, "Number of columns must be non-negative"); + m_cols = cols; + } + + void SetRows( int rows ) + { + wxASSERT_MSG( rows >= 0, "Number of rows must be non-negative"); + m_rows = rows; + } + + void SetVGap( int gap ) { m_vgap = gap; } + void SetHGap( int gap ) { m_hgap = gap; } + int GetCols() const { return m_cols; } + int GetRows() const { return m_rows; } + int GetVGap() const { return m_vgap; } + int GetHGap() const { return m_hgap; } + + int GetEffectiveColsCount() const { return m_cols ? m_cols : CalcCols(); } + int GetEffectiveRowsCount() const { return m_rows ? m_rows : CalcRows(); } + + // return the number of total items and the number of columns and rows + // (for internal use only) + int CalcRowsCols(int& rows, int& cols) const; + +protected: + // the number of rows/columns in the sizer, if 0 then it is determined + // dynamically depending on the total number of items + int m_rows; + int m_cols; + + // gaps between rows and columns + int m_vgap; + int m_hgap; + + virtual wxSizerItem *DoInsert(size_t index, wxSizerItem *item) wxOVERRIDE; + + void SetItemBounds( wxSizerItem *item, int x, int y, int w, int h ); + + // returns the number of columns/rows needed for the current total number + // of children (and the fixed number of rows/columns) + int CalcCols() const + { + wxCHECK_MSG + ( + m_rows, 0, + "Can't calculate number of cols if number of rows is not specified" + ); + + return int(m_children.GetCount() + m_rows - 1) / m_rows; + } + + int CalcRows() const + { + wxCHECK_MSG + ( + m_cols, 0, + "Can't calculate number of cols if number of rows is not specified" + ); + + return int(m_children.GetCount() + m_cols - 1) / m_cols; + } + +private: + wxDECLARE_CLASS(wxGridSizer); +}; + +//--------------------------------------------------------------------------- +// wxFlexGridSizer +//--------------------------------------------------------------------------- + +// values which define the behaviour for resizing wxFlexGridSizer cells in the +// "non-flexible" direction +enum wxFlexSizerGrowMode +{ + // don't resize the cells in non-flexible direction at all + wxFLEX_GROWMODE_NONE, + + // uniformly resize only the specified ones (default) + wxFLEX_GROWMODE_SPECIFIED, + + // uniformly resize all cells + wxFLEX_GROWMODE_ALL +}; + +class WXDLLIMPEXP_CORE wxFlexGridSizer: public wxGridSizer +{ +public: + // ctors specifying the number of columns only: number of rows will be + // deduced automatically depending on the number of sizer elements + wxFlexGridSizer( int cols, int vgap, int hgap ); + wxFlexGridSizer( int cols, const wxSize& gap = wxSize(0, 0) ); + + // ctors specifying the number of rows and columns + wxFlexGridSizer( int rows, int cols, int vgap, int hgap ); + wxFlexGridSizer( int rows, int cols, const wxSize& gap ); + + // dtor + virtual ~wxFlexGridSizer(); + + // set the rows/columns which will grow (the others will remain of the + // constant initial size) + void AddGrowableRow( size_t idx, int proportion = 0 ); + void RemoveGrowableRow( size_t idx ); + void AddGrowableCol( size_t idx, int proportion = 0 ); + void RemoveGrowableCol( size_t idx ); + + bool IsRowGrowable( size_t idx ); + bool IsColGrowable( size_t idx ); + + // the sizer cells may grow in both directions, not grow at all or only + // grow in one direction but not the other + + // the direction may be wxVERTICAL, wxHORIZONTAL or wxBOTH (default) + void SetFlexibleDirection(int direction) { m_flexDirection = direction; } + int GetFlexibleDirection() const { return m_flexDirection; } + + // note that the grow mode only applies to the direction which is not + // flexible + void SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode) { m_growMode = mode; } + wxFlexSizerGrowMode GetNonFlexibleGrowMode() const { return m_growMode; } + + // Read-only access to the row heights and col widths arrays + const wxArrayInt& GetRowHeights() const { return m_rowHeights; } + const wxArrayInt& GetColWidths() const { return m_colWidths; } + + // implementation + virtual void RepositionChildren(const wxSize& minSize) wxOVERRIDE; + virtual wxSize CalcMin() wxOVERRIDE; + +protected: + void AdjustForFlexDirection(); + void AdjustForGrowables(const wxSize& sz, const wxSize& minSize); + wxSize FindWidthsAndHeights(int nrows, int ncols); + + // the heights/widths of all rows/columns + wxArrayInt m_rowHeights, + m_colWidths; + + // indices of the growable columns and rows + wxArrayInt m_growableRows, + m_growableCols; + + // proportion values of the corresponding growable rows and columns + wxArrayInt m_growableRowsProportions, + m_growableColsProportions; + + // parameters describing whether the growable cells should be resized in + // both directions or only one + int m_flexDirection; + wxFlexSizerGrowMode m_growMode; + +private: + wxDECLARE_CLASS(wxFlexGridSizer); + wxDECLARE_NO_COPY_CLASS(wxFlexGridSizer); +}; + +//--------------------------------------------------------------------------- +// wxBoxSizer +//--------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBoxSizer: public wxSizer +{ +public: + wxBoxSizer(int orient) + { + m_orient = orient; + m_totalProportion = 0; + + wxASSERT_MSG( m_orient == wxHORIZONTAL || m_orient == wxVERTICAL, + wxT("invalid value for wxBoxSizer orientation") ); + } + + virtual wxSizerItem *AddSpacer(int size) wxOVERRIDE; + + int GetOrientation() const { return m_orient; } + + bool IsVertical() const { return m_orient == wxVERTICAL; } + + void SetOrientation(int orient) { m_orient = orient; } + + // implementation of our resizing logic + virtual wxSize CalcMin() wxOVERRIDE; + virtual void RepositionChildren(const wxSize& minSize) wxOVERRIDE; + + virtual bool InformFirstDirection(int direction, + int size, + int availableOtherDir) wxOVERRIDE; + +protected: + // Only overridden to perform extra debugging checks. + virtual wxSizerItem *DoInsert(size_t index, wxSizerItem *item) wxOVERRIDE; + + // helpers for our code: this returns the component of the given wxSize in + // the direction of the sizer and in the other direction, respectively + int GetSizeInMajorDir(const wxSize& sz) const + { + return m_orient == wxHORIZONTAL ? sz.x : sz.y; + } + + int& SizeInMajorDir(wxSize& sz) + { + return m_orient == wxHORIZONTAL ? sz.x : sz.y; + } + + int& PosInMajorDir(wxPoint& pt) + { + return m_orient == wxHORIZONTAL ? pt.x : pt.y; + } + + int GetSizeInMinorDir(const wxSize& sz) const + { + return m_orient == wxHORIZONTAL ? sz.y : sz.x; + } + + int& SizeInMinorDir(wxSize& sz) + { + return m_orient == wxHORIZONTAL ? sz.y : sz.x; + } + + int& PosInMinorDir(wxPoint& pt) + { + return m_orient == wxHORIZONTAL ? pt.y : pt.x; + } + + // another helper: creates wxSize from major and minor components + wxSize SizeFromMajorMinor(int major, int minor) const + { + if ( m_orient == wxHORIZONTAL ) + { + return wxSize(major, minor); + } + else // wxVERTICAL + { + return wxSize(minor, major); + } + } + + + // either wxHORIZONTAL or wxVERTICAL + int m_orient; + + // the sum of proportion of all of our elements + int m_totalProportion; + +private: + wxDECLARE_CLASS(wxBoxSizer); +}; + +//--------------------------------------------------------------------------- +// wxStaticBoxSizer +//--------------------------------------------------------------------------- + +#if wxUSE_STATBOX + +class WXDLLIMPEXP_FWD_CORE wxStaticBox; + +class WXDLLIMPEXP_CORE wxStaticBoxSizer: public wxBoxSizer +{ +public: + wxStaticBoxSizer(wxStaticBox *box, int orient); + wxStaticBoxSizer(int orient, wxWindow *win, const wxString& label = wxEmptyString); + virtual ~wxStaticBoxSizer(); + + virtual wxSize CalcMin() wxOVERRIDE; + virtual void RepositionChildren(const wxSize& minSize) wxOVERRIDE; + + wxStaticBox *GetStaticBox() const + { return m_staticBox; } + + // override to hide/show the static box as well + virtual void ShowItems (bool show) wxOVERRIDE; + virtual bool AreAnyItemsShown() const wxOVERRIDE; + + virtual bool Detach( wxWindow *window ) wxOVERRIDE; + virtual bool Detach( wxSizer *sizer ) wxOVERRIDE { return wxBoxSizer::Detach(sizer); } + virtual bool Detach( int index ) wxOVERRIDE { return wxBoxSizer::Detach(index); } + +protected: + wxStaticBox *m_staticBox; + +private: + wxDECLARE_CLASS(wxStaticBoxSizer); + wxDECLARE_NO_COPY_CLASS(wxStaticBoxSizer); +}; + +#endif // wxUSE_STATBOX + +//--------------------------------------------------------------------------- +// wxStdDialogButtonSizer +//--------------------------------------------------------------------------- + +#if wxUSE_BUTTON + +class WXDLLIMPEXP_CORE wxStdDialogButtonSizer: public wxBoxSizer +{ +public: + // Constructor just creates a new wxBoxSizer, not much else. + // Box sizer orientation is automatically determined here: + // vertical for PDAs, horizontal for everything else? + wxStdDialogButtonSizer(); + + // Checks button ID against system IDs and sets one of the pointers below + // to this button. Does not do any sizer-related things here. + void AddButton(wxButton *button); + + // Use these if no standard ID can/should be used + void SetAffirmativeButton( wxButton *button ); + void SetNegativeButton( wxButton *button ); + void SetCancelButton( wxButton *button ); + + // All platform-specific code here, checks which buttons exist and add + // them to the sizer accordingly. + // Note - one potential hack on Mac we could use here, + // if m_buttonAffirmative is wxID_SAVE then ensure wxID_SAVE + // is set to _("Save") and m_buttonNegative is set to _("Don't Save") + // I wouldn't add any other hacks like that into here, + // but this one I can see being useful. + void Realize(); + + wxButton *GetAffirmativeButton() const { return m_buttonAffirmative; } + wxButton *GetApplyButton() const { return m_buttonApply; } + wxButton *GetNegativeButton() const { return m_buttonNegative; } + wxButton *GetCancelButton() const { return m_buttonCancel; } + wxButton *GetHelpButton() const { return m_buttonHelp; } + +protected: + wxButton *m_buttonAffirmative; // wxID_OK, wxID_YES, wxID_SAVE go here + wxButton *m_buttonApply; // wxID_APPLY + wxButton *m_buttonNegative; // wxID_NO + wxButton *m_buttonCancel; // wxID_CANCEL, wxID_CLOSE + wxButton *m_buttonHelp; // wxID_HELP, wxID_CONTEXT_HELP + +private: + wxDECLARE_CLASS(wxStdDialogButtonSizer); + wxDECLARE_NO_COPY_CLASS(wxStdDialogButtonSizer); +}; + +#endif // wxUSE_BUTTON + + +// ---------------------------------------------------------------------------- +// inline functions implementation +// ---------------------------------------------------------------------------- + +#if WXWIN_COMPATIBILITY_2_8 + +inline void wxSizerItem::SetWindow(wxWindow *window) +{ + DoSetWindow(window); +} + +inline void wxSizerItem::SetSizer(wxSizer *sizer) +{ + DoSetSizer(sizer); +} + +inline void wxSizerItem::SetSpacer(const wxSize& size) +{ + DoSetSpacer(size); +} + +inline void wxSizerItem::SetSpacer(int width, int height) +{ + DoSetSpacer(wxSize(width, height)); +} + +#endif // WXWIN_COMPATIBILITY_2_8 + +inline wxSizerItem* +wxSizer::Insert(size_t index, wxSizerItem *item) +{ + return DoInsert(index, item); +} + + +inline wxSizerItem* +wxSizer::Add( wxSizerItem *item ) +{ + return Insert( m_children.GetCount(), item ); +} + +inline wxSizerItem* +wxSizer::Add( wxWindow *window, int proportion, int flag, int border, wxObject* userData ) +{ + return Add( new wxSizerItem( window, proportion, flag, border, userData ) ); +} + +inline wxSizerItem* +wxSizer::Add( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData ) +{ + return Add( new wxSizerItem( sizer, proportion, flag, border, userData ) ); +} + +inline wxSizerItem* +wxSizer::Add( int width, int height, int proportion, int flag, int border, wxObject* userData ) +{ + return Add( new wxSizerItem( width, height, proportion, flag, border, userData ) ); +} + +inline wxSizerItem* +wxSizer::Add( wxWindow *window, const wxSizerFlags& flags ) +{ + return Add( new wxSizerItem(window, flags) ); +} + +inline wxSizerItem* +wxSizer::Add( wxSizer *sizer, const wxSizerFlags& flags ) +{ + return Add( new wxSizerItem(sizer, flags) ); +} + +inline wxSizerItem* +wxSizer::Add( int width, int height, const wxSizerFlags& flags ) +{ + return Add( new wxSizerItem(width, height, flags) ); +} + +inline wxSizerItem* +wxSizer::AddSpacer(int size) +{ + return Add(size, size); +} + +inline wxSizerItem* +wxSizer::AddStretchSpacer(int prop) +{ + return Add(0, 0, prop); +} + +inline wxSizerItem* +wxSizer::Prepend( wxSizerItem *item ) +{ + return Insert( 0, item ); +} + +inline wxSizerItem* +wxSizer::Prepend( wxWindow *window, int proportion, int flag, int border, wxObject* userData ) +{ + return Prepend( new wxSizerItem( window, proportion, flag, border, userData ) ); +} + +inline wxSizerItem* +wxSizer::Prepend( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData ) +{ + return Prepend( new wxSizerItem( sizer, proportion, flag, border, userData ) ); +} + +inline wxSizerItem* +wxSizer::Prepend( int width, int height, int proportion, int flag, int border, wxObject* userData ) +{ + return Prepend( new wxSizerItem( width, height, proportion, flag, border, userData ) ); +} + +inline wxSizerItem* +wxSizer::PrependSpacer(int size) +{ + return Prepend(size, size); +} + +inline wxSizerItem* +wxSizer::PrependStretchSpacer(int prop) +{ + return Prepend(0, 0, prop); +} + +inline wxSizerItem* +wxSizer::Prepend( wxWindow *window, const wxSizerFlags& flags ) +{ + return Prepend( new wxSizerItem(window, flags) ); +} + +inline wxSizerItem* +wxSizer::Prepend( wxSizer *sizer, const wxSizerFlags& flags ) +{ + return Prepend( new wxSizerItem(sizer, flags) ); +} + +inline wxSizerItem* +wxSizer::Prepend( int width, int height, const wxSizerFlags& flags ) +{ + return Prepend( new wxSizerItem(width, height, flags) ); +} + +inline wxSizerItem* +wxSizer::Insert( size_t index, + wxWindow *window, + int proportion, + int flag, + int border, + wxObject* userData ) +{ + return Insert( index, new wxSizerItem( window, proportion, flag, border, userData ) ); +} + +inline wxSizerItem* +wxSizer::Insert( size_t index, + wxSizer *sizer, + int proportion, + int flag, + int border, + wxObject* userData ) +{ + return Insert( index, new wxSizerItem( sizer, proportion, flag, border, userData ) ); +} + +inline wxSizerItem* +wxSizer::Insert( size_t index, + int width, + int height, + int proportion, + int flag, + int border, + wxObject* userData ) +{ + return Insert( index, new wxSizerItem( width, height, proportion, flag, border, userData ) ); +} + +inline wxSizerItem* +wxSizer::Insert( size_t index, wxWindow *window, const wxSizerFlags& flags ) +{ + return Insert( index, new wxSizerItem(window, flags) ); +} + +inline wxSizerItem* +wxSizer::Insert( size_t index, wxSizer *sizer, const wxSizerFlags& flags ) +{ + return Insert( index, new wxSizerItem(sizer, flags) ); +} + +inline wxSizerItem* +wxSizer::Insert( size_t index, int width, int height, const wxSizerFlags& flags ) +{ + return Insert( index, new wxSizerItem(width, height, flags) ); +} + +inline wxSizerItem* +wxSizer::InsertSpacer(size_t index, int size) +{ + return Insert(index, size, size); +} + +inline wxSizerItem* +wxSizer::InsertStretchSpacer(size_t index, int prop) +{ + return Insert(index, 0, 0, prop); +} + +#endif // __WXSIZER_H__ diff --git a/lib/wxWidgets/include/wx/slider.h b/lib/wxWidgets/include/wx/slider.h new file mode 100644 index 0000000..0e698cb --- /dev/null +++ b/lib/wxWidgets/include/wx/slider.h @@ -0,0 +1,149 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/slider.h +// Purpose: wxSlider interface +// Author: Vadim Zeitlin +// Modified by: +// Created: 09.02.01 +// Copyright: (c) 1996-2001 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SLIDER_H_BASE_ +#define _WX_SLIDER_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_SLIDER + +#include "wx/control.h" + +// ---------------------------------------------------------------------------- +// wxSlider flags +// ---------------------------------------------------------------------------- + +#define wxSL_HORIZONTAL wxHORIZONTAL /* 0x0004 */ +#define wxSL_VERTICAL wxVERTICAL /* 0x0008 */ + +#define wxSL_TICKS 0x0010 +#define wxSL_AUTOTICKS wxSL_TICKS // we don't support manual ticks +#define wxSL_LEFT 0x0040 +#define wxSL_TOP 0x0080 +#define wxSL_RIGHT 0x0100 +#define wxSL_BOTTOM 0x0200 +#define wxSL_BOTH 0x0400 +#define wxSL_SELRANGE 0x0800 +#define wxSL_INVERSE 0x1000 +#define wxSL_MIN_MAX_LABELS 0x2000 +#define wxSL_VALUE_LABEL 0x4000 +#define wxSL_LABELS (wxSL_MIN_MAX_LABELS|wxSL_VALUE_LABEL) + +extern WXDLLIMPEXP_DATA_CORE(const char) wxSliderNameStr[]; + +// ---------------------------------------------------------------------------- +// wxSliderBase: define wxSlider interface +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSliderBase : public wxControl +{ +public: + /* the ctor of the derived class should have the following form: + + wxSlider(wxWindow *parent, + wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxSliderNameStr); + */ + wxSliderBase() { } + + // get/set the current slider value (should be in range) + virtual int GetValue() const = 0; + virtual void SetValue(int value) = 0; + + // retrieve/change the range + virtual void SetRange(int minValue, int maxValue) = 0; + virtual int GetMin() const = 0; + virtual int GetMax() const = 0; + void SetMin( int minValue ) { SetRange( minValue , GetMax() ) ; } + void SetMax( int maxValue ) { SetRange( GetMin() , maxValue ) ; } + + // the line/page size is the increment by which the slider moves when + // cursor arrow key/page up or down are pressed (clicking the mouse is like + // pressing PageUp/Down) and are by default set to 1 and 1/10 of the range + virtual void SetLineSize(int lineSize) = 0; + virtual void SetPageSize(int pageSize) = 0; + virtual int GetLineSize() const = 0; + virtual int GetPageSize() const = 0; + + // these methods get/set the length of the slider pointer in pixels + virtual void SetThumbLength(int lenPixels) = 0; + virtual int GetThumbLength() const = 0; + + // warning: most of subsequent methods are currently only implemented in + // wxMSW and are silently ignored on other platforms + + void SetTickFreq(int freq) { DoSetTickFreq(freq); } + virtual int GetTickFreq() const { return 0; } + virtual void ClearTicks() { } + virtual void SetTick(int WXUNUSED(tickPos)) { } + + virtual void ClearSel() { } + virtual int GetSelEnd() const { return GetMin(); } + virtual int GetSelStart() const { return GetMax(); } + virtual void SetSelection(int WXUNUSED(min), int WXUNUSED(max)) { } + +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED_INLINE( void SetTickFreq(int freq, int), DoSetTickFreq(freq); ) +#endif + +protected: + // Platform-specific implementation of SetTickFreq + virtual void DoSetTickFreq(int WXUNUSED(freq)) { /* unsupported by default */ } + + // choose the default border for this window + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + + // adjust value according to wxSL_INVERSE style + virtual int ValueInvertOrNot(int value) const + { + if (HasFlag(wxSL_INVERSE)) + return (GetMax() + GetMin()) - value; + else + return value; + } + +private: + wxDECLARE_NO_COPY_CLASS(wxSliderBase); +}; + +// ---------------------------------------------------------------------------- +// include the real class declaration +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/slider.h" +#elif defined(__WXMSW__) + #include "wx/msw/slider.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/slider.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/slider.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/slider.h" +#elif defined(__WXMAC__) + #include "wx/osx/slider.h" +#elif defined(__WXQT__) + #include "wx/qt/slider.h" +#endif + +#endif // wxUSE_SLIDER + +#endif + // _WX_SLIDER_H_BASE_ diff --git a/lib/wxWidgets/include/wx/snglinst.h b/lib/wxWidgets/include/wx/snglinst.h new file mode 100644 index 0000000..61213a8 --- /dev/null +++ b/lib/wxWidgets/include/wx/snglinst.h @@ -0,0 +1,96 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/snglinst.h +// Purpose: wxSingleInstanceChecker can be used to restrict the number of +// simultaneously running copies of a program to one +// Author: Vadim Zeitlin +// Modified by: +// Created: 08.06.01 +// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SNGLINST_H_ +#define _WX_SNGLINST_H_ + +#if wxUSE_SNGLINST_CHECKER + +#include "wx/app.h" +#include "wx/utils.h" + +// ---------------------------------------------------------------------------- +// wxSingleInstanceChecker +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxSingleInstanceChecker +{ +public: + // default ctor, use Create() after it + wxSingleInstanceChecker() { Init(); } + + // like Create() but no error checking (dangerous!) + wxSingleInstanceChecker(const wxString& name, + const wxString& path = wxEmptyString) + { + Init(); + Create(name, path); + } + + // notice that calling Create() is optional now, if you don't do it before + // calling IsAnotherRunning(), CreateDefault() is used automatically + // + // name it is used as the mutex name under Win32 and the lock file name + // under Unix so it should be as unique as possible and must be non-empty + // + // path is optional and is ignored under Win32 and used as the directory to + // create the lock file in under Unix (default is wxGetHomeDir()) + // + // returns false if initialization failed, it doesn't mean that another + // instance is running - use IsAnotherRunning() to check it + bool Create(const wxString& name, const wxString& path = wxEmptyString); + + // use the default name, which is a combination of wxTheApp->GetAppName() + // and wxGetUserId() for mutex/lock file + // + // this is called implicitly by IsAnotherRunning() if the checker hadn't + // been created until then + bool CreateDefault() + { + wxCHECK_MSG( wxTheApp, false, "must have application instance" ); + return Create(wxTheApp->GetAppName() + '-' + wxGetUserId()); + } + + // is another copy of this program already running? + bool IsAnotherRunning() const + { + if ( !m_impl ) + { + if ( !const_cast<wxSingleInstanceChecker *>(this)->CreateDefault() ) + { + // if creation failed, return false as it's better to not + // prevent this instance from starting up if there is an error + return false; + } + } + + return DoIsAnotherRunning(); + } + + // dtor is not virtual, this class is not meant to be used polymorphically + ~wxSingleInstanceChecker(); + +private: + // common part of all ctors + void Init() { m_impl = NULL; } + + // do check if another instance is running, called only if m_impl != NULL + bool DoIsAnotherRunning() const; + + // the implementation details (platform specific) + class WXDLLIMPEXP_FWD_BASE wxSingleInstanceCheckerImpl *m_impl; + + wxDECLARE_NO_COPY_CLASS(wxSingleInstanceChecker); +}; + +#endif // wxUSE_SNGLINST_CHECKER + +#endif // _WX_SNGLINST_H_ diff --git a/lib/wxWidgets/include/wx/socket.h b/lib/wxWidgets/include/wx/socket.h new file mode 100644 index 0000000..971364c --- /dev/null +++ b/lib/wxWidgets/include/wx/socket.h @@ -0,0 +1,445 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/socket.h +// Purpose: Socket handling classes +// Authors: Guilhem Lavaux, Guillermo Rodriguez Garcia +// Modified by: +// Created: April 1997 +// Copyright: (c) Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SOCKET_H_ +#define _WX_SOCKET_H_ + +#include "wx/defs.h" + +#if wxUSE_SOCKETS + +// --------------------------------------------------------------------------- +// wxSocket headers +// --------------------------------------------------------------------------- + +#include "wx/event.h" +#include "wx/sckaddr.h" +#include "wx/list.h" + +class wxSocketImpl; + +// ------------------------------------------------------------------------ +// Types and constants +// ------------------------------------------------------------------------ + +// Define the type of native sockets. +#if defined(__WINDOWS__) + // Although socket descriptors are still 32 bit values, even under Win64, + // the socket type is 64 bit there. + typedef wxUIntPtr wxSOCKET_T; +#else + typedef int wxSOCKET_T; +#endif + + +// Types of different socket notifications or events. +// +// NB: the values here should be consecutive and start with 0 as they are +// used to construct the wxSOCKET_XXX_FLAG bit mask values below +enum wxSocketNotify +{ + wxSOCKET_INPUT, + wxSOCKET_OUTPUT, + wxSOCKET_CONNECTION, + wxSOCKET_LOST +}; + +enum +{ + wxSOCKET_INPUT_FLAG = 1 << wxSOCKET_INPUT, + wxSOCKET_OUTPUT_FLAG = 1 << wxSOCKET_OUTPUT, + wxSOCKET_CONNECTION_FLAG = 1 << wxSOCKET_CONNECTION, + wxSOCKET_LOST_FLAG = 1 << wxSOCKET_LOST +}; + +// this is a combination of the bit masks defined above +typedef int wxSocketEventFlags; + +enum wxSocketError +{ + wxSOCKET_NOERROR = 0, + wxSOCKET_INVOP, + wxSOCKET_IOERR, + wxSOCKET_INVADDR, + wxSOCKET_INVSOCK, + wxSOCKET_NOHOST, + wxSOCKET_INVPORT, + wxSOCKET_WOULDBLOCK, + wxSOCKET_TIMEDOUT, + wxSOCKET_MEMERR, + wxSOCKET_OPTERR +}; + +// socket options/flags bit masks +enum +{ + wxSOCKET_NONE = 0x0000, + wxSOCKET_NOWAIT_READ = 0x0001, + wxSOCKET_NOWAIT_WRITE = 0x0002, + wxSOCKET_NOWAIT = wxSOCKET_NOWAIT_READ | wxSOCKET_NOWAIT_WRITE, + wxSOCKET_WAITALL_READ = 0x0004, + wxSOCKET_WAITALL_WRITE = 0x0008, + wxSOCKET_WAITALL = wxSOCKET_WAITALL_READ | wxSOCKET_WAITALL_WRITE, + wxSOCKET_BLOCK = 0x0010, + wxSOCKET_REUSEADDR = 0x0020, + wxSOCKET_BROADCAST = 0x0040, + wxSOCKET_NOBIND = 0x0080 +}; + +typedef int wxSocketFlags; + +// socket kind values (badly defined, don't use) +enum wxSocketType +{ + wxSOCKET_UNINIT, + wxSOCKET_CLIENT, + wxSOCKET_SERVER, + wxSOCKET_BASE, + wxSOCKET_DATAGRAM +}; + + +// event +class WXDLLIMPEXP_FWD_NET wxSocketEvent; +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_NET, wxEVT_SOCKET, wxSocketEvent); + +// -------------------------------------------------------------------------- +// wxSocketBase +// -------------------------------------------------------------------------- + +class WXDLLIMPEXP_NET wxSocketBase : public wxObject +{ +public: + // Public interface + // ---------------- + + // ctors and dtors + wxSocketBase(); + wxSocketBase(wxSocketFlags flags, wxSocketType type); + virtual ~wxSocketBase(); + void Init(); + bool Destroy(); + + // state + bool Ok() const { return IsOk(); } + bool IsOk() const { return m_impl != NULL; } + bool Error() const { return LastError() != wxSOCKET_NOERROR; } + bool IsClosed() const { return m_closed; } + bool IsConnected() const { return m_connected; } + bool IsData() { return WaitForRead(0, 0); } + bool IsDisconnected() const { return !IsConnected(); } + wxUint32 LastCount() const { return m_lcount; } + wxUint32 LastReadCount() const { return m_lcount_read; } + wxUint32 LastWriteCount() const { return m_lcount_write; } + wxSocketError LastError() const; + void SaveState(); + void RestoreState(); + + // addresses + virtual bool GetLocal(wxSockAddress& addr_man) const; + virtual bool GetPeer(wxSockAddress& addr_man) const; + virtual bool SetLocal(const wxIPV4address& local); + + // base IO + virtual bool Close(); + void ShutdownOutput(); + wxSocketBase& Discard(); + wxSocketBase& Peek(void* buffer, wxUint32 nbytes); + wxSocketBase& Read(void* buffer, wxUint32 nbytes); + wxSocketBase& ReadMsg(void *buffer, wxUint32 nbytes); + wxSocketBase& Unread(const void *buffer, wxUint32 nbytes); + wxSocketBase& Write(const void *buffer, wxUint32 nbytes); + wxSocketBase& WriteMsg(const void *buffer, wxUint32 nbytes); + + // all Wait() functions wait until their condition is satisfied or the + // timeout expires; if seconds == -1 (default) then m_timeout value is used + // + // it is also possible to call InterruptWait() to cancel any current Wait() + + // wait for anything at all to happen with this socket + bool Wait(long seconds = -1, long milliseconds = 0); + + // wait until we can read from or write to the socket without blocking + // (notice that this does not mean that the operation will succeed but only + // that it will return immediately) + bool WaitForRead(long seconds = -1, long milliseconds = 0); + bool WaitForWrite(long seconds = -1, long milliseconds = 0); + + // wait until the connection is terminated + bool WaitForLost(long seconds = -1, long milliseconds = 0); + + void InterruptWait() { m_interrupt = true; } + + + wxSocketFlags GetFlags() const { return m_flags; } + void SetFlags(wxSocketFlags flags); + virtual void SetTimeout(long seconds); + long GetTimeout() const { return m_timeout; } + + bool GetOption(int level, int optname, void *optval, int *optlen); + bool SetOption(int level, int optname, const void *optval, int optlen); + wxUint32 GetLastIOSize() const { return m_lcount; } + wxUint32 GetLastIOReadSize() const { return m_lcount_read; } + wxUint32 GetLastIOWriteSize() const { return m_lcount_write; } + + // event handling + void *GetClientData() const { return m_clientData; } + void SetClientData(void *data) { m_clientData = data; } + void SetEventHandler(wxEvtHandler& handler, int id = wxID_ANY); + void SetNotify(wxSocketEventFlags flags); + void Notify(bool notify); + + // Get the underlying socket descriptor. + wxSOCKET_T GetSocket() const; + + // initialize/shutdown the sockets (done automatically so there is no need + // to call these functions usually) + // + // should always be called from the main thread only so one of the cases + // where they should indeed be called explicitly is when the first wxSocket + // object in the application is created in a different thread + static bool Initialize(); + static void Shutdown(); + + // check if wxSocket had been already initialized + // + // notice that this function should be only called from the main thread as + // otherwise it is inherently unsafe because Initialize/Shutdown() may be + // called concurrently with it in the main thread + static bool IsInitialized(); + + // Implementation from now on + // -------------------------- + + // do not use, should be private (called from wxSocketImpl only) + void OnRequest(wxSocketNotify notify); + + // do not use, not documented nor supported + bool IsNoWait() const { return ((m_flags & wxSOCKET_NOWAIT) != 0); } + wxSocketType GetType() const { return m_type; } + + // Helper returning wxSOCKET_NONE if non-blocking sockets can be used, i.e. + // the socket is being created in the main thread and the event loop is + // running, or wxSOCKET_BLOCK otherwise. + // + // This is an internal function used only by wxWidgets itself, user code + // should decide if it wants blocking sockets or not and use the + // appropriate style instead of using it (but wxWidgets has to do it like + // this for compatibility with the original network classes behaviour). + static int GetBlockingFlagIfNeeded(); + +private: + friend class wxSocketClient; + friend class wxSocketServer; + friend class wxDatagramSocket; + + // low level IO + wxUint32 DoRead(void* buffer, wxUint32 nbytes); + wxUint32 DoWrite(const void *buffer, wxUint32 nbytes); + + // wait until the given flags are set for this socket or the given timeout + // (or m_timeout) expires + // + // notice that wxSOCKET_LOST_FLAG is always taken into account and the + // function returns -1 if the connection was lost; otherwise it returns + // true if any of the events specified by flags argument happened or false + // if the timeout expired + int DoWait(long timeout, wxSocketEventFlags flags); + + // a helper calling DoWait() using the same convention as the public + // WaitForXXX() functions use, i.e. use our timeout if seconds == -1 or the + // specified timeout otherwise + int DoWait(long seconds, long milliseconds, wxSocketEventFlags flags); + + // another helper calling DoWait() using our m_timeout + int DoWaitWithTimeout(wxSocketEventFlags flags) + { + return DoWait(m_timeout*1000, flags); + } + + // pushback buffer + void Pushback(const void *buffer, wxUint32 size); + wxUint32 GetPushback(void *buffer, wxUint32 size, bool peek); + + // store the given error as the LastError() + void SetError(wxSocketError error); + +private: + // socket + wxSocketImpl *m_impl; // port-specific implementation + wxSocketType m_type; // wxSocket type + + // state + wxSocketFlags m_flags; // wxSocket flags + bool m_connected; // connected? + bool m_establishing; // establishing connection? + bool m_reading; // busy reading? + bool m_writing; // busy writing? + bool m_closed; // was the other end closed? + wxUint32 m_lcount; // last IO transaction size + wxUint32 m_lcount_read; // last IO transaction size of Read() direction. + wxUint32 m_lcount_write; // last IO transaction size of Write() direction. + unsigned long m_timeout; // IO timeout value in seconds + // (TODO: remove, wxSocketImpl has it too) + wxList m_states; // stack of states (TODO: remove!) + bool m_interrupt; // interrupt ongoing wait operations? + bool m_beingDeleted; // marked for delayed deletion? + wxIPV4address m_localAddress; // bind to local address? + + // pushback buffer + void *m_unread; // pushback buffer + wxUint32 m_unrd_size; // pushback buffer size + wxUint32 m_unrd_cur; // pushback pointer (index into buffer) + + // events + int m_id; // socket id + wxEvtHandler *m_handler; // event handler + void *m_clientData; // client data for events + bool m_notify; // notify events to users? + wxSocketEventFlags m_eventmask; // which events to notify? + wxSocketEventFlags m_eventsgot; // collects events received in OnRequest() + + + friend class wxSocketReadGuard; + friend class wxSocketWriteGuard; + + wxDECLARE_CLASS(wxSocketBase); + wxDECLARE_NO_COPY_CLASS(wxSocketBase); +}; + + +// -------------------------------------------------------------------------- +// wxSocketServer +// -------------------------------------------------------------------------- + +class WXDLLIMPEXP_NET wxSocketServer : public wxSocketBase +{ +public: + wxSocketServer(const wxSockAddress& addr, + wxSocketFlags flags = wxSOCKET_NONE); + + wxSocketBase* Accept(bool wait = true); + bool AcceptWith(wxSocketBase& socket, bool wait = true); + + bool WaitForAccept(long seconds = -1, long milliseconds = 0); + + wxDECLARE_CLASS(wxSocketServer); + wxDECLARE_NO_COPY_CLASS(wxSocketServer); +}; + + +// -------------------------------------------------------------------------- +// wxSocketClient +// -------------------------------------------------------------------------- + +class WXDLLIMPEXP_NET wxSocketClient : public wxSocketBase +{ +public: + wxSocketClient(wxSocketFlags flags = wxSOCKET_NONE); + + virtual bool Connect(const wxSockAddress& addr, bool wait = true); + bool Connect(const wxSockAddress& addr, + const wxSockAddress& local, + bool wait = true); + + bool WaitOnConnect(long seconds = -1, long milliseconds = 0); + + // Sets initial socket buffer sizes using the SO_SNDBUF and SO_RCVBUF + // options before calling connect (either one can be -1 to leave it + // unchanged) + void SetInitialSocketBuffers(int recv, int send) + { + m_initialRecvBufferSize = recv; + m_initialSendBufferSize = send; + } + +private: + virtual bool DoConnect(const wxSockAddress& addr, + const wxSockAddress* local, + bool wait = true); + + // buffer sizes, -1 if unset and defaults should be used + int m_initialRecvBufferSize; + int m_initialSendBufferSize; + + wxDECLARE_CLASS(wxSocketClient); + wxDECLARE_NO_COPY_CLASS(wxSocketClient); +}; + + +// -------------------------------------------------------------------------- +// wxDatagramSocket +// -------------------------------------------------------------------------- + +// WARNING: still in alpha stage + +class WXDLLIMPEXP_NET wxDatagramSocket : public wxSocketBase +{ +public: + wxDatagramSocket(const wxSockAddress& addr, + wxSocketFlags flags = wxSOCKET_NONE); + + wxDatagramSocket& RecvFrom(wxSockAddress& addr, + void *buf, + wxUint32 nBytes); + wxDatagramSocket& SendTo(const wxSockAddress& addr, + const void* buf, + wxUint32 nBytes); + + /* TODO: + bool Connect(wxSockAddress& addr); + */ + +private: + wxDECLARE_CLASS(wxDatagramSocket); + wxDECLARE_NO_COPY_CLASS(wxDatagramSocket); +}; + + +// -------------------------------------------------------------------------- +// wxSocketEvent +// -------------------------------------------------------------------------- + +class WXDLLIMPEXP_NET wxSocketEvent : public wxEvent +{ +public: + wxSocketEvent(int id = 0) + : wxEvent(id, wxEVT_SOCKET) + { + } + + wxSocketNotify GetSocketEvent() const { return m_event; } + wxSocketBase *GetSocket() const + { return (wxSocketBase *) GetEventObject(); } + void *GetClientData() const { return m_clientData; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxSocketEvent(*this); } + virtual wxEventCategory GetEventCategory() const wxOVERRIDE { return wxEVT_CATEGORY_SOCKET; } + +public: + wxSocketNotify m_event; + void *m_clientData; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxSocketEvent); +}; + + +typedef void (wxEvtHandler::*wxSocketEventFunction)(wxSocketEvent&); + +#define wxSocketEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxSocketEventFunction, func) + +#define EVT_SOCKET(id, func) \ + wx__DECLARE_EVT1(wxEVT_SOCKET, id, wxSocketEventHandler(func)) + +#endif // wxUSE_SOCKETS + +#endif // _WX_SOCKET_H_ + diff --git a/lib/wxWidgets/include/wx/sound.h b/lib/wxWidgets/include/wx/sound.h new file mode 100644 index 0000000..003a4b7 --- /dev/null +++ b/lib/wxWidgets/include/wx/sound.h @@ -0,0 +1,77 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/sound.h +// Purpose: wxSoundBase class +// Author: Vaclav Slavik +// Modified by: +// Created: 2004/02/01 +// Copyright: (c) 2004, Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SOUND_H_BASE_ +#define _WX_SOUND_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_SOUND + +#include "wx/object.h" + +// ---------------------------------------------------------------------------- +// wxSoundBase: common wxSound code and interface +// ---------------------------------------------------------------------------- + +// Flags for wxSound::Play + +// NB: We can't use enum with some compilers, because they keep reporting +// nonexistent ambiguities between Play(unsigned) and static Play(const +// wxString&, unsigned). +#define wxSOUND_SYNC ((unsigned)0) +#define wxSOUND_ASYNC ((unsigned)1) +#define wxSOUND_LOOP ((unsigned)2) + +// Base class for wxSound implementations +class WXDLLIMPEXP_ADV wxSoundBase : public wxObject +{ +public: + // Play the sound: + bool Play(unsigned flags = wxSOUND_ASYNC) const + { + wxASSERT_MSG( (flags & wxSOUND_LOOP) == 0 || + (flags & wxSOUND_ASYNC) != 0, + wxT("sound can only be looped asynchronously") ); + return DoPlay(flags); + } + + // Plays sound from filename: + static bool Play(const wxString& filename, unsigned flags = wxSOUND_ASYNC); + +protected: + virtual bool DoPlay(unsigned flags) const = 0; +}; + +// ---------------------------------------------------------------------------- +// wxSound class implementation +// ---------------------------------------------------------------------------- + +#if defined(__WINDOWS__) + #include "wx/msw/sound.h" +#elif defined(__WXMAC__) + #include "wx/osx/sound.h" +#elif defined(__UNIX__) + #include "wx/unix/sound.h" +#endif + +// ---------------------------------------------------------------------------- +// wxSoundBase methods +// ---------------------------------------------------------------------------- + +inline bool wxSoundBase::Play(const wxString& filename, unsigned flags) +{ + wxSound snd(filename); + return snd.IsOk() ? snd.Play(flags) : false; +} + +#endif // wxUSE_SOUND + +#endif // _WX_SOUND_H_BASE_ diff --git a/lib/wxWidgets/include/wx/spinbutt.h b/lib/wxWidgets/include/wx/spinbutt.h new file mode 100644 index 0000000..5204b95 --- /dev/null +++ b/lib/wxWidgets/include/wx/spinbutt.h @@ -0,0 +1,141 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/spinbutt.h +// Purpose: wxSpinButtonBase class +// Author: Julian Smart, Vadim Zeitlin +// Modified by: +// Created: 23.07.99 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SPINBUTT_H_BASE_ +#define _WX_SPINBUTT_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_SPINBTN + +#include "wx/control.h" +#include "wx/event.h" +#include "wx/range.h" + +#define wxSPIN_BUTTON_NAME wxT("wxSpinButton") + +// ---------------------------------------------------------------------------- +// The wxSpinButton is like a small scrollbar than is often placed next +// to a text control. +// +// Styles: +// wxSP_HORIZONTAL: horizontal spin button +// wxSP_VERTICAL: vertical spin button (the default) +// wxSP_ARROW_KEYS: arrow keys increment/decrement value +// wxSP_WRAP: value wraps at either end +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSpinButtonBase : public wxControl +{ +public: + // ctor initializes the range with the default (0..100) values + wxSpinButtonBase() { m_min = 0; m_max = 100; } + + // accessors + virtual int GetValue() const = 0; + virtual int GetMin() const { return m_min; } + virtual int GetMax() const { return m_max; } + wxRange GetRange() const { return wxRange( GetMin(), GetMax() );} + + // operations + virtual void SetValue(int val) = 0; + virtual void SetMin(int minVal) { SetRange ( minVal , m_max ) ; } + virtual void SetMax(int maxVal) { SetRange ( m_min , maxVal ) ; } + virtual void SetRange(int minVal, int maxVal) + { + m_min = minVal; + m_max = maxVal; + } + void SetRange( const wxRange& range) { SetRange( range.GetMin(), range.GetMax()); } + + // is this spin button vertically oriented? + bool IsVertical() const { return (m_windowStyle & wxSP_VERTICAL) != 0; } + virtual void SetIncrement(int WXUNUSED(value)) { } + virtual int GetIncrement() const { return 1; } + +protected: + // the range value + int m_min; + int m_max; + wxDECLARE_NO_COPY_CLASS(wxSpinButtonBase); +}; + +// ---------------------------------------------------------------------------- +// include the declaration of the real class +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/spinbutt.h" +#elif defined(__WXMSW__) + #include "wx/msw/spinbutt.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/spinbutt.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/spinbutt.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/spinbutt.h" +#elif defined(__WXMAC__) + #include "wx/osx/spinbutt.h" +#elif defined(__WXQT__) + #include "wx/qt/spinbutt.h" +#endif + +// ---------------------------------------------------------------------------- +// the wxSpinButton event +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSpinEvent : public wxNotifyEvent +{ +public: + wxSpinEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) + : wxNotifyEvent(commandType, winid) + { + } + + wxSpinEvent(const wxSpinEvent& event) : wxNotifyEvent(event) {} + + // get the current value of the control + int GetValue() const { return m_commandInt; } + void SetValue(int value) { m_commandInt = value; } + + int GetPosition() const { return m_commandInt; } + void SetPosition(int pos) { m_commandInt = pos; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxSpinEvent(*this); } + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSpinEvent); +}; + +typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&); + +#define wxSpinEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxSpinEventFunction, func) + +// macros for handling spin events: notice that we must use the real values of +// the event type constants and not their references (wxEVT_SPIN[_UP/DOWN]) +// here as otherwise the event tables could end up with non-initialized +// (because of undefined initialization order of the globals defined in +// different translation units) references in them +#define EVT_SPIN_UP(winid, func) \ + wx__DECLARE_EVT1(wxEVT_SPIN_UP, winid, wxSpinEventHandler(func)) +#define EVT_SPIN_DOWN(winid, func) \ + wx__DECLARE_EVT1(wxEVT_SPIN_DOWN, winid, wxSpinEventHandler(func)) +#define EVT_SPIN(winid, func) \ + wx__DECLARE_EVT1(wxEVT_SPIN, winid, wxSpinEventHandler(func)) + +#endif // wxUSE_SPINBTN + +#endif + // _WX_SPINBUTT_H_BASE_ diff --git a/lib/wxWidgets/include/wx/spinctrl.h b/lib/wxWidgets/include/wx/spinctrl.h new file mode 100644 index 0000000..42d2af5 --- /dev/null +++ b/lib/wxWidgets/include/wx/spinctrl.h @@ -0,0 +1,147 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/spinctrl.h +// Purpose: wxSpinCtrlBase class +// Author: Vadim Zeitlin +// Modified by: +// Created: 22.07.99 +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SPINCTRL_H_ +#define _WX_SPINCTRL_H_ + +#include "wx/defs.h" + +#if wxUSE_SPINCTRL + +#include "wx/spinbutt.h" // should make wxSpinEvent visible to the app + +// Events +class WXDLLIMPEXP_FWD_CORE wxSpinDoubleEvent; + +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SPINCTRL, wxSpinEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SPINCTRLDOUBLE, wxSpinDoubleEvent); + +// ---------------------------------------------------------------------------- +// A spin ctrl is a text control with a spin button which is usually used to +// prompt the user for a numeric input. +// There are two kinds for number types T=integer or T=double. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSpinCtrlBase : public wxControl +{ +public: + wxSpinCtrlBase() {} + + // accessor functions that derived classes are expected to have + virtual wxString GetTextValue() const = 0; + // T GetValue() const + // T GetMin() const + // T GetMax() const + // T GetIncrement() const + virtual bool GetSnapToTicks() const = 0; + // unsigned GetDigits() const - wxSpinCtrlDouble only + + // operation functions that derived classes are expected to have + virtual void SetValue(const wxString& value) = 0; + // void SetValue(T val) + // void SetRange(T minVal, T maxVal) + // void SetIncrement(T inc) + virtual void SetSnapToTicks(bool snap_to_ticks) = 0; + // void SetDigits(unsigned digits) - wxSpinCtrlDouble only + + // The base for numbers display, e.g. 10 or 16. + virtual int GetBase() const = 0; + virtual bool SetBase(int base) = 0; + // Select text in the textctrl + virtual void SetSelection(long from, long to) = 0; + +private: + wxDECLARE_NO_COPY_CLASS(wxSpinCtrlBase); +}; + +// ---------------------------------------------------------------------------- +// wxSpinDoubleEvent - a wxSpinEvent for double valued controls +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSpinDoubleEvent : public wxNotifyEvent +{ +public: + wxSpinDoubleEvent(wxEventType commandType = wxEVT_NULL, int winid = 0, + double value = 0) + : wxNotifyEvent(commandType, winid), m_value(value) + { + } + + wxSpinDoubleEvent(const wxSpinDoubleEvent& event) + : wxNotifyEvent(event), m_value(event.GetValue()) + { + } + + double GetValue() const { return m_value; } + void SetValue(double value) { m_value = value; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxSpinDoubleEvent(*this); } + +protected: + double m_value; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSpinDoubleEvent); +}; + +// ---------------------------------------------------------------------------- +// wxSpinDoubleEvent event type, see also wxSpinEvent in wx/spinbutt.h +// ---------------------------------------------------------------------------- + +typedef void (wxEvtHandler::*wxSpinDoubleEventFunction)(wxSpinDoubleEvent&); + +#define wxSpinDoubleEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxSpinDoubleEventFunction, func) + +// macros for handling spinctrl events + +#define EVT_SPINCTRL(id, fn) \ + wx__DECLARE_EVT1(wxEVT_SPINCTRL, id, wxSpinEventHandler(fn)) + +#define EVT_SPINCTRLDOUBLE(id, fn) \ + wx__DECLARE_EVT1(wxEVT_SPINCTRLDOUBLE, id, wxSpinDoubleEventHandler(fn)) + +// ---------------------------------------------------------------------------- +// include the platform-dependent class implementation +// ---------------------------------------------------------------------------- + +// we may have a native wxSpinCtrl implementation, native wxSpinCtrl and +// wxSpinCtrlDouble implementations or neither, define the appropriate symbols +// and include the generic version if necessary to provide the missing class(es) + +#if defined(__WXUNIVERSAL__) + // nothing, use generic controls +#elif defined(__WXMSW__) + #define wxHAS_NATIVE_SPINCTRL + #include "wx/msw/spinctrl.h" +#elif defined(__WXGTK20__) + #define wxHAS_NATIVE_SPINCTRL + #define wxHAS_NATIVE_SPINCTRLDOUBLE + #include "wx/gtk/spinctrl.h" +#elif defined(__WXGTK__) + #define wxHAS_NATIVE_SPINCTRL + #include "wx/gtk1/spinctrl.h" +#elif defined(__WXQT__) + #define wxHAS_NATIVE_SPINCTRL + #define wxHAS_NATIVE_SPINCTRLDOUBLE + #include "wx/qt/spinctrl.h" +#endif // platform + +#if !defined(wxHAS_NATIVE_SPINCTRL) || !defined(wxHAS_NATIVE_SPINCTRLDOUBLE) + #include "wx/generic/spinctlg.h" +#endif + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_SPINCTRL_UPDATED wxEVT_SPINCTRL +#define wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED wxEVT_SPINCTRLDOUBLE + +#endif // wxUSE_SPINCTRL + +#endif // _WX_SPINCTRL_H_ diff --git a/lib/wxWidgets/include/wx/splash.h b/lib/wxWidgets/include/wx/splash.h new file mode 100644 index 0000000..e4fb0c2 --- /dev/null +++ b/lib/wxWidgets/include/wx/splash.h @@ -0,0 +1,17 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/splash.h +// Purpose: Base header for wxSplashScreen +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SPLASH_H_BASE_ +#define _WX_SPLASH_H_BASE_ + +#include "wx/generic/splash.h" + +#endif + // _WX_SPLASH_H_BASE_ diff --git a/lib/wxWidgets/include/wx/splitter.h b/lib/wxWidgets/include/wx/splitter.h new file mode 100644 index 0000000..62fbff9 --- /dev/null +++ b/lib/wxWidgets/include/wx/splitter.h @@ -0,0 +1,41 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/splitter.h +// Purpose: Base header for wxSplitterWindow +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SPLITTER_H_BASE_ +#define _WX_SPLITTER_H_BASE_ + +#include "wx/event.h" + +// ---------------------------------------------------------------------------- +// wxSplitterWindow flags +// ---------------------------------------------------------------------------- + +#define wxSP_NOBORDER 0x0000 +#define wxSP_THIN_SASH 0x0000 // NB: the default is 3D sash +#define wxSP_NOSASH 0x0010 +#define wxSP_PERMIT_UNSPLIT 0x0040 +#define wxSP_LIVE_UPDATE 0x0080 +#define wxSP_3DSASH 0x0100 +#define wxSP_3DBORDER 0x0200 +#define wxSP_NO_XP_THEME 0x0400 +#define wxSP_BORDER wxSP_3DBORDER +#define wxSP_3D (wxSP_3DBORDER | wxSP_3DSASH) + +class WXDLLIMPEXP_FWD_CORE wxSplitterEvent; + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_SPLITTER_SASH_POS_CHANGED, wxSplitterEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_SPLITTER_SASH_POS_CHANGING, wxSplitterEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_SPLITTER_SASH_POS_RESIZE, wxSplitterEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_SPLITTER_DOUBLECLICKED, wxSplitterEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_SPLITTER_UNSPLIT, wxSplitterEvent ); + +#include "wx/generic/splitter.h" + +#endif // _WX_SPLITTER_H_BASE_ diff --git a/lib/wxWidgets/include/wx/srchctrl.h b/lib/wxWidgets/include/wx/srchctrl.h new file mode 100644 index 0000000..bd46a27 --- /dev/null +++ b/lib/wxWidgets/include/wx/srchctrl.h @@ -0,0 +1,129 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/srchctrl.h +// Purpose: wxSearchCtrlBase class +// Author: Vince Harron +// Created: 2006-02-18 +// Copyright: (c) Vince Harron +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SEARCHCTRL_H_BASE_ +#define _WX_SEARCHCTRL_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_SEARCHCTRL + +#include "wx/textctrl.h" + +#if (!defined(__WXMAC__) && !defined(__WXGTK20__)) || defined(__WXUNIVERSAL__) + // no native version, use the generic one + #define wxUSE_NATIVE_SEARCH_CONTROL 0 + + #include "wx/compositewin.h" + #include "wx/containr.h" + + class WXDLLIMPEXP_CORE wxSearchCtrlBaseBaseClass + : public wxCompositeWindow< wxNavigationEnabled<wxControl> >, + public wxTextCtrlIface + { + }; +#elif defined(__WXMAC__) + // search control was introduced in Mac OS X 10.3 Panther + #define wxUSE_NATIVE_SEARCH_CONTROL 1 + + #define wxSearchCtrlBaseBaseClass wxTextCtrl +#elif defined(__WXGTK20__) + // Use GtkSearchEntry if available, construct a similar one using GtkEntry + // otherwise. + #define wxUSE_NATIVE_SEARCH_CONTROL 1 + + class WXDLLIMPEXP_CORE wxGTKSearchCtrlBase + : public wxControl, public wxTextEntry + { + }; + + #define wxSearchCtrlBaseBaseClass wxGTKSearchCtrlBase +#endif + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +extern WXDLLIMPEXP_DATA_CORE(const char) wxSearchCtrlNameStr[]; + +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SEARCH_CANCEL, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SEARCH, wxCommandEvent); + +// ---------------------------------------------------------------------------- +// a search ctrl is a text control with a search button and a cancel button +// it is based on the MacOSX 10.3 control HISearchFieldCreate +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSearchCtrlBase : public wxSearchCtrlBaseBaseClass +{ +public: + wxSearchCtrlBase() { } + virtual ~wxSearchCtrlBase() { } + + // search control +#if wxUSE_MENUS + virtual void SetMenu(wxMenu *menu) = 0; + virtual wxMenu *GetMenu() = 0; +#endif // wxUSE_MENUS + + // get/set options + virtual void ShowSearchButton( bool show ) = 0; + virtual bool IsSearchButtonVisible() const = 0; + + virtual void ShowCancelButton( bool show ) = 0; + virtual bool IsCancelButtonVisible() const = 0; + + virtual void SetDescriptiveText(const wxString& text) = 0; + virtual wxString GetDescriptiveText() const = 0; + +#if wxUSE_NATIVE_SEARCH_CONTROL + virtual const wxTextEntry* WXGetTextEntry() const wxOVERRIDE { return this; } +#endif // wxUSE_NATIVE_SEARCH_CONTROL + +private: + // implement wxTextEntry pure virtual method + virtual wxWindow *GetEditableWindow() wxOVERRIDE { return this; } +}; + + +// include the platform-dependent class implementation +#if wxUSE_NATIVE_SEARCH_CONTROL + #if defined(__WXMAC__) + #include "wx/osx/srchctrl.h" + #elif defined(__WXGTK__) + #include "wx/gtk/srchctrl.h" + #endif +#else + #include "wx/generic/srchctlg.h" +#endif + +// ---------------------------------------------------------------------------- +// macros for handling search events +// ---------------------------------------------------------------------------- + +#define EVT_SEARCH_CANCEL(id, fn) \ + wx__DECLARE_EVT1(wxEVT_SEARCH_CANCEL, id, wxCommandEventHandler(fn)) + +#define EVT_SEARCH(id, fn) \ + wx__DECLARE_EVT1(wxEVT_SEARCH, id, wxCommandEventHandler(fn)) + +// old synonyms +#define wxEVT_SEARCHCTRL_CANCEL_BTN wxEVT_SEARCH_CANCEL +#define wxEVT_SEARCHCTRL_SEARCH_BTN wxEVT_SEARCH + +#define EVT_SEARCHCTRL_CANCEL_BTN(id, fn) EVT_SEARCH_CANCEL(id, fn) +#define EVT_SEARCHCTRL_SEARCH_BTN(id, fn) EVT_SEARCH(id, fn) + +// even older wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN wxEVT_SEARCHCTRL_CANCEL_BTN +#define wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN wxEVT_SEARCHCTRL_SEARCH_BTN + +#endif // wxUSE_SEARCHCTRL + +#endif // _WX_SEARCHCTRL_H_BASE_ diff --git a/lib/wxWidgets/include/wx/sstream.h b/lib/wxWidgets/include/wx/sstream.h new file mode 100644 index 0000000..865acd3 --- /dev/null +++ b/lib/wxWidgets/include/wx/sstream.h @@ -0,0 +1,103 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/sstream.h +// Purpose: string-based streams +// Author: Vadim Zeitlin +// Modified by: +// Created: 2004-09-19 +// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SSTREAM_H_ +#define _WX_SSTREAM_H_ + +#include "wx/stream.h" + +#if wxUSE_STREAMS + +// ---------------------------------------------------------------------------- +// wxStringInputStream is a stream reading from the given (fixed size) string +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStringInputStream : public wxInputStream +{ +public: + // ctor associates the stream with the given string which makes a copy of + // it + wxStringInputStream(const wxString& s); + + virtual wxFileOffset GetLength() const wxOVERRIDE; + virtual bool IsSeekable() const wxOVERRIDE { return true; } + +protected: + virtual wxFileOffset OnSysSeek(wxFileOffset ofs, wxSeekMode mode) wxOVERRIDE; + virtual wxFileOffset OnSysTell() const wxOVERRIDE; + virtual size_t OnSysRead(void *buffer, size_t size) wxOVERRIDE; + +private: + // the string that was passed in the ctor + wxString m_str; + + // the buffer we're reading from + wxCharBuffer m_buf; + + // length of the buffer we're reading from + size_t m_len; + + // position in the stream in bytes, *not* in chars + size_t m_pos; + + wxDECLARE_NO_COPY_CLASS(wxStringInputStream); +}; + +// ---------------------------------------------------------------------------- +// wxStringOutputStream writes data to the given string, expanding it as needed +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStringOutputStream : public wxOutputStream +{ +public: + // The stream will write data either to the provided string or to an + // internal string which can be retrieved using GetString() + // + // Note that the conversion object should have the life time greater than + // this stream. + explicit wxStringOutputStream(wxString *pString = NULL, + wxMBConv& conv = wxConvUTF8); + + // get the string containing current output + const wxString& GetString() const { return *m_str; } + + virtual bool IsSeekable() const wxOVERRIDE { return true; } + +protected: + virtual wxFileOffset OnSysTell() const wxOVERRIDE; + virtual size_t OnSysWrite(const void *buffer, size_t size) wxOVERRIDE; + +private: + // internal string, not used if caller provided his own string + wxString m_strInternal; + + // pointer given by the caller or just pointer to m_strInternal + wxString *m_str; + + // position in the stream in bytes, *not* in chars + size_t m_pos; + + // converter to use: notice that with the default UTF-8 one the input + // stream must contain valid UTF-8 data, use wxConvISO8859_1 to work with + // arbitrary 8 bit data + wxMBConv& m_conv; + +#if wxUSE_UNICODE + // unconverted data from the last call to OnSysWrite() + wxMemoryBuffer m_unconv; +#endif // wxUSE_UNICODE + + wxDECLARE_NO_COPY_CLASS(wxStringOutputStream); +}; + +#endif // wxUSE_STREAMS + +#endif // _WX_SSTREAM_H_ + diff --git a/lib/wxWidgets/include/wx/stack.h b/lib/wxWidgets/include/wx/stack.h new file mode 100644 index 0000000..b4e8ed2 --- /dev/null +++ b/lib/wxWidgets/include/wx/stack.h @@ -0,0 +1,85 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/stack.h +// Purpose: STL stack clone +// Author: Lindsay Mathieson, Vadim Zeitlin +// Created: 30.07.2001 +// Copyright: (c) 2001 Lindsay Mathieson <lindsay@mathieson.org> (WX_DECLARE_STACK) +// 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STACK_H_ +#define _WX_STACK_H_ + +#include "wx/vector.h" + +#if wxUSE_STD_CONTAINERS + +#include <stack> +#define wxStack std::stack + +#else // !wxUSE_STD_CONTAINERS + +// Notice that unlike std::stack, wxStack currently always uses wxVector and +// can't be used with any other underlying container type. +// +// Another difference is that comparison operators between stacks are not +// implemented (but they should be, see 23.2.3.3 of ISO/IEC 14882:1998). + +template <typename T> +class wxStack +{ +public: + typedef wxVector<T> container_type; + typedef typename container_type::size_type size_type; + typedef typename container_type::value_type value_type; + + wxStack() { } + explicit wxStack(const container_type& cont) : m_cont(cont) { } + + // Default copy ctor, assignment operator and dtor are ok. + + + bool empty() const { return m_cont.empty(); } + size_type size() const { return m_cont.size(); } + + value_type& top() { return m_cont.back(); } + const value_type& top() const { return m_cont.back(); } + + void push(const value_type& val) { m_cont.push_back(val); } + void pop() { m_cont.pop_back(); } + +private: + container_type m_cont; +}; + +#endif // wxUSE_STD_CONTAINERS/!wxUSE_STD_CONTAINERS + + +// Deprecated macro-based class for compatibility only, don't use any more. +#define WX_DECLARE_STACK(obj, cls) \ +class cls : public wxVector<obj> \ +{\ +public:\ + void push(const obj& o)\ + {\ + push_back(o); \ + };\ +\ + void pop()\ + {\ + pop_back(); \ + };\ +\ + obj& top()\ + {\ + return at(size() - 1);\ + };\ + const obj& top() const\ + {\ + return at(size() - 1); \ + };\ +} + +#endif // _WX_STACK_H_ + diff --git a/lib/wxWidgets/include/wx/stackwalk.h b/lib/wxWidgets/include/wx/stackwalk.h new file mode 100644 index 0000000..0cde0ea --- /dev/null +++ b/lib/wxWidgets/include/wx/stackwalk.h @@ -0,0 +1,161 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/stackwalk.h +// Purpose: wxStackWalker and related classes, common part +// Author: Vadim Zeitlin +// Modified by: +// Created: 2005-01-07 +// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STACKWALK_H_ +#define _WX_STACKWALK_H_ + +#include "wx/defs.h" + +#if wxUSE_STACKWALKER + +#include "wx/string.h" + +class WXDLLIMPEXP_FWD_BASE wxStackFrame; + +#define wxSTACKWALKER_MAX_DEPTH (200) + +// ---------------------------------------------------------------------------- +// wxStackFrame: a single stack level +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStackFrameBase +{ +private: + // put this inline function here so that it is defined before use + wxStackFrameBase *ConstCast() const + { return const_cast<wxStackFrameBase *>(this); } + +public: + wxStackFrameBase(size_t level, void *address = NULL) + { + m_level = level; + + m_line = + m_offset = 0; + + m_address = address; + } + + // get the level of this frame (deepest/innermost one is 0) + size_t GetLevel() const { return m_level; } + + // return the address of this frame + void *GetAddress() const { return m_address; } + + + // return the unmangled (if possible) name of the function containing this + // frame + wxString GetName() const { ConstCast()->OnGetName(); return m_name; } + + // return the instruction pointer offset from the start of the function + size_t GetOffset() const { ConstCast()->OnGetName(); return m_offset; } + + // get the module this function belongs to (not always available) + wxString GetModule() const { ConstCast()->OnGetName(); return m_module; } + + + // return true if we have the filename and line number for this frame + bool HasSourceLocation() const { return !GetFileName().empty(); } + + // return the name of the file containing this frame, empty if + // unavailable (typically because debug info is missing) + wxString GetFileName() const + { ConstCast()->OnGetLocation(); return m_filename; } + + // return the line number of this frame, 0 if unavailable + size_t GetLine() const { ConstCast()->OnGetLocation(); return m_line; } + + + // return the number of parameters of this function (may return 0 if we + // can't retrieve the parameters info even although the function does have + // parameters) + virtual size_t GetParamCount() const { return 0; } + + // get the name, type and value (in text form) of the given parameter + // + // any pointer may be NULL + // + // return true if at least some values could be retrieved + virtual bool GetParam(size_t WXUNUSED(n), + wxString * WXUNUSED(type), + wxString * WXUNUSED(name), + wxString * WXUNUSED(value)) const + { + return false; + } + + + // although this class is not supposed to be used polymorphically, give it + // a virtual dtor to silence compiler warnings + virtual ~wxStackFrameBase() { } + +protected: + // hooks for derived classes to initialize some fields on demand + virtual void OnGetName() { } + virtual void OnGetLocation() { } + + + // fields are protected, not private, so that OnGetXXX() could modify them + // directly + size_t m_level; + + wxString m_name, + m_module, + m_filename; + + size_t m_line; + + void *m_address; + size_t m_offset; +}; + +// ---------------------------------------------------------------------------- +// wxStackWalker: class for enumerating stack frames +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStackWalkerBase +{ +public: + // ctor does nothing, use Walk() to walk the stack + wxStackWalkerBase() { } + + // dtor does nothing either but should be virtual + virtual ~wxStackWalkerBase() { } + + // enumerate stack frames from the current location, skipping the initial + // number of them (this can be useful when Walk() is called from some known + // location and you don't want to see the first few frames anyhow; also + // notice that Walk() frame itself is not included if skip >= 1) + virtual void Walk(size_t skip = 1, size_t maxDepth = wxSTACKWALKER_MAX_DEPTH) = 0; + +#if wxUSE_ON_FATAL_EXCEPTION + // enumerate stack frames from the location of uncaught exception + // + // this version can only be called from wxApp::OnFatalException() + virtual void WalkFromException(size_t maxDepth = wxSTACKWALKER_MAX_DEPTH) = 0; +#endif // wxUSE_ON_FATAL_EXCEPTION + +protected: + // this function must be overridden to process the given frame + virtual void OnStackFrame(const wxStackFrame& frame) = 0; +}; + +#ifdef __WINDOWS__ + #include "wx/msw/stackwalk.h" +#elif defined(__UNIX__) + #include "wx/unix/stackwalk.h" +#else + #error "wxStackWalker is not supported, set wxUSE_STACKWALKER to 0" +#endif + +#endif // wxUSE_STACKWALKER + +#endif // _WX_STACKWALK_H_ + diff --git a/lib/wxWidgets/include/wx/statbmp.h b/lib/wxWidgets/include/wx/statbmp.h new file mode 100644 index 0000000..07817d6 --- /dev/null +++ b/lib/wxWidgets/include/wx/statbmp.h @@ -0,0 +1,84 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/statbmp.h +// Purpose: wxStaticBitmap class interface +// Author: Vadim Zeitlin +// Modified by: +// Created: 25.08.00 +// Copyright: (c) 2000 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATBMP_H_BASE_ +#define _WX_STATBMP_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_STATBMP + +#include "wx/control.h" +#include "wx/bmpbndl.h" +#include "wx/icon.h" + +extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticBitmapNameStr[]; + +// a control showing an icon or a bitmap +class WXDLLIMPEXP_CORE wxStaticBitmapBase : public wxControl +{ +public: + enum ScaleMode + { + Scale_None, + Scale_Fill, + Scale_AspectFit, + Scale_AspectFill + }; + + wxStaticBitmapBase() { } + virtual ~wxStaticBitmapBase(); + + // our interface + virtual void SetBitmap(const wxBitmapBundle& bitmap) = 0; + virtual wxBitmap GetBitmap() const; + + virtual void SetIcon(const wxIcon& icon); + virtual wxIcon GetIcon() const; + + virtual void SetScaleMode(ScaleMode WXUNUSED(scaleMode)) { } + virtual ScaleMode GetScaleMode() const { return Scale_None; } + + // overridden base class virtuals + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } + virtual bool HasTransparentBackground() wxOVERRIDE { return true; } + +protected: + // choose the default border for this window + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + // Bitmap bundle passed to ctor or SetBitmap(). + wxBitmapBundle m_bitmapBundle; + + wxDECLARE_NO_COPY_CLASS(wxStaticBitmapBase); +}; + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/statbmp.h" +#elif defined(__WXMSW__) + #include "wx/msw/statbmp.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/statbmp.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/statbmp.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/statbmp.h" +#elif defined(__WXMAC__) + #include "wx/osx/statbmp.h" +#elif defined(__WXQT__) + #include "wx/qt/statbmp.h" +#endif + +#endif // wxUSE_STATBMP + +#endif + // _WX_STATBMP_H_BASE_ diff --git a/lib/wxWidgets/include/wx/statbox.h b/lib/wxWidgets/include/wx/statbox.h new file mode 100644 index 0000000..d5d15a9 --- /dev/null +++ b/lib/wxWidgets/include/wx/statbox.h @@ -0,0 +1,86 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/statbox.h +// Purpose: wxStaticBox base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATBOX_H_BASE_ +#define _WX_STATBOX_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_STATBOX + +#include "wx/control.h" +#include "wx/containr.h" + +extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticBoxNameStr[]; + +// ---------------------------------------------------------------------------- +// wxStaticBox: a grouping box with a label +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxStaticBoxBase : public wxNavigationEnabled<wxControl> +{ +public: + wxStaticBoxBase(); + + // overridden base class virtuals + virtual bool HasTransparentBackground() wxOVERRIDE { return true; } + virtual bool Enable(bool enable = true) wxOVERRIDE; + + // implementation only: this is used by wxStaticBoxSizer to account for the + // need for extra space taken by the static box + // + // the top border is the margin at the top (where the title is), + // borderOther is the margin on all other sides + virtual void GetBordersForSizer(int *borderTop, int *borderOther) const; + + // This is an internal function currently used by wxStaticBoxSizer only. + // + // Reparent all children of the static box under its parent and destroy the + // box itself. + void WXDestroyWithoutChildren(); + +protected: + // choose the default border for this window + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + + // If non-null, the window used as our label. This window is owned by the + // static box and will be deleted when it is. + wxWindow* m_labelWin; + + // For boxes with window label this member variable is used instead of + // m_isEnabled to remember the last value passed to Enable(). It is + // required because the box itself doesn't get disabled by Enable(false) in + // this case (see comments in Enable() implementation), and m_isEnabled + // must correspond to its real state. + bool m_areChildrenEnabled; + + wxDECLARE_NO_COPY_CLASS(wxStaticBoxBase); +}; + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/statbox.h" +#elif defined(__WXMSW__) + #include "wx/msw/statbox.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/statbox.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/statbox.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/statbox.h" +#elif defined(__WXMAC__) + #include "wx/osx/statbox.h" +#elif defined(__WXQT__) + #include "wx/qt/statbox.h" +#endif + +#endif // wxUSE_STATBOX + +#endif + // _WX_STATBOX_H_BASE_ diff --git a/lib/wxWidgets/include/wx/statline.h b/lib/wxWidgets/include/wx/statline.h new file mode 100644 index 0000000..49023d5 --- /dev/null +++ b/lib/wxWidgets/include/wx/statline.h @@ -0,0 +1,103 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/statline.h +// Purpose: wxStaticLine class interface +// Author: Vadim Zeitlin +// Created: 28.06.99 +// Copyright: (c) 1999 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATLINE_H_BASE_ +#define _WX_STATLINE_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// this defines wxUSE_STATLINE +#include "wx/defs.h" + +#if wxUSE_STATLINE + +// the base class declaration +#include "wx/control.h" + +// ---------------------------------------------------------------------------- +// global variables +// ---------------------------------------------------------------------------- + +// the default name for objects of class wxStaticLine +extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticLineNameStr[]; + +// ---------------------------------------------------------------------------- +// wxStaticLine - a line in a dialog +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxStaticLineBase : public wxControl +{ +public: + // constructor + wxStaticLineBase() { } + + // is the line vertical? + bool IsVertical() const { return (GetWindowStyle() & wxLI_VERTICAL) != 0; } + + // get the default size for the "lesser" dimension of the static line + static int GetDefaultSize() { return 2; } + + // overridden base class virtuals + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } + +protected: + // choose the default border for this window + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + + // set the right size for the right dimension + wxSize AdjustSize(const wxSize& size) const + { + wxSize sizeReal(size); + if ( IsVertical() ) + { + if ( size.x == wxDefaultCoord ) + sizeReal.x = GetDefaultSize(); + } + else + { + if ( size.y == wxDefaultCoord ) + sizeReal.y = GetDefaultSize(); + } + + return sizeReal; + } + + virtual wxSize DoGetBestSize() const wxOVERRIDE + { + return AdjustSize(wxDefaultSize); + } + + wxDECLARE_NO_COPY_CLASS(wxStaticLineBase); +}; + +// ---------------------------------------------------------------------------- +// now include the actual class declaration +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/statline.h" +#elif defined(__WXMSW__) + #include "wx/msw/statline.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/statline.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/statline.h" +#elif defined(__WXMAC__) + #include "wx/osx/statline.h" +#elif defined(__WXQT__) + #include "wx/qt/statline.h" +#else // use generic implementation for all other platforms + #include "wx/generic/statline.h" +#endif + +#endif // wxUSE_STATLINE + +#endif // _WX_STATLINE_H_BASE_ diff --git a/lib/wxWidgets/include/wx/stattext.h b/lib/wxWidgets/include/wx/stattext.h new file mode 100644 index 0000000..369ab6d --- /dev/null +++ b/lib/wxWidgets/include/wx/stattext.h @@ -0,0 +1,119 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/stattext.h +// Purpose: wxStaticText base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATTEXT_H_BASE_ +#define _WX_STATTEXT_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_STATTEXT + +#include "wx/control.h" + +/* + * wxStaticText flags + */ +#define wxST_NO_AUTORESIZE 0x0001 +// free 0x0002 bit +#define wxST_ELLIPSIZE_START 0x0004 +#define wxST_ELLIPSIZE_MIDDLE 0x0008 +#define wxST_ELLIPSIZE_END 0x0010 + +#define wxST_ELLIPSIZE_MASK \ + (wxST_ELLIPSIZE_START | wxST_ELLIPSIZE_MIDDLE | wxST_ELLIPSIZE_END) + +extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticTextNameStr[]; + +class WXDLLIMPEXP_CORE wxStaticTextBase : public wxControl +{ +public: + wxStaticTextBase() { } + + // wrap the text of the control so that no line is longer than the given + // width (if possible: this function won't break words) + // This function will modify the value returned by GetLabel()! + void Wrap(int width); + + // overridden base virtuals + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } + virtual bool HasTransparentBackground() wxOVERRIDE { return true; } + + bool IsEllipsized() const + { + return (GetWindowStyle() & wxST_ELLIPSIZE_MASK) != 0; + } + +protected: // functions required for wxST_ELLIPSIZE_* support + + // choose the default border for this window + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + + // Calls Ellipsize() on the real label if necessary. Unlike GetLabelText(), + // keeps the mnemonics instead of removing them. + virtual wxString GetEllipsizedLabel() const; + + // Replaces parts of the string with ellipsis according to the ellipsize + // style. Shouldn't be called if we don't have any. + wxString Ellipsize(const wxString& label) const; + + + // Note that even though ports with native support for ellipsization + // (currently only wxGTK) don't need this stuff, we still need to define it + // as it's used by wxGenericStaticText. + + // Must be called when the size or font changes to redo the ellipsization + // for the new size. Calls WXSetVisibleLabel() to actually update the + // display. + void UpdateLabel(); + + // These functions are platform-specific and must be implemented in the + // platform-specific code. They must not use or update m_labelOrig. + + // Returns the label currently displayed inside the control, with mnemonics + // if any. + virtual wxString WXGetVisibleLabel() const = 0; + + // Sets the real label currently displayed inside the control, _without_ + // invalidating the size. The text passed is always markup-free but may + // contain the mnemonic characters. + virtual void WXSetVisibleLabel(const wxString& str) = 0; + + // Update the current size to match the best size unless wxST_NO_AUTORESIZE + // style is explicitly used. + void AutoResizeIfNecessary(); + +private: + wxDECLARE_NO_COPY_CLASS(wxStaticTextBase); +}; + +// see wx/generic/stattextg.h for the explanation +#ifndef wxNO_PORT_STATTEXT_INCLUDE + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/stattext.h" +#elif defined(__WXMSW__) + #include "wx/msw/stattext.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/stattext.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/stattext.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/stattext.h" +#elif defined(__WXMAC__) + #include "wx/osx/stattext.h" +#elif defined(__WXQT__) + #include "wx/qt/stattext.h" +#endif + +#endif // !wxNO_PORT_STATTEXT_INCLUDE + +#endif // wxUSE_STATTEXT + +#endif // _WX_STATTEXT_H_BASE_ diff --git a/lib/wxWidgets/include/wx/statusbr.h b/lib/wxWidgets/include/wx/statusbr.h new file mode 100644 index 0000000..375ee8d --- /dev/null +++ b/lib/wxWidgets/include/wx/statusbr.h @@ -0,0 +1,250 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/statusbr.h +// Purpose: wxStatusBar class interface +// Author: Vadim Zeitlin +// Modified by: +// Created: 05.02.00 +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATUSBR_H_BASE_ +#define _WX_STATUSBR_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_STATUSBAR + +#include "wx/control.h" +#include "wx/list.h" +#include "wx/dynarray.h" + +extern WXDLLIMPEXP_DATA_CORE(const char) wxStatusBarNameStr[]; + +// ---------------------------------------------------------------------------- +// wxStatusBar constants +// ---------------------------------------------------------------------------- + +// wxStatusBar styles +#define wxSTB_SIZEGRIP 0x0010 +#define wxSTB_SHOW_TIPS 0x0020 + +#define wxSTB_ELLIPSIZE_START 0x0040 +#define wxSTB_ELLIPSIZE_MIDDLE 0x0080 +#define wxSTB_ELLIPSIZE_END 0x0100 + +#define wxSTB_DEFAULT_STYLE (wxSTB_SIZEGRIP|wxSTB_ELLIPSIZE_END|wxSTB_SHOW_TIPS|wxFULL_REPAINT_ON_RESIZE) + + +// old compat style name: +#define wxST_SIZEGRIP wxSTB_SIZEGRIP + + +// style flags for wxStatusBar fields +#define wxSB_NORMAL 0x0000 +#define wxSB_FLAT 0x0001 +#define wxSB_RAISED 0x0002 +#define wxSB_SUNKEN 0x0003 + +// ---------------------------------------------------------------------------- +// wxStatusBarPane: an helper for wxStatusBar +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxStatusBarPane +{ +public: + wxStatusBarPane(int style = wxSB_NORMAL, int width = 0) + : m_nStyle(style), m_nWidth(width) + { m_bEllipsized = false; } + + int GetWidth() const { return m_nWidth; } + int GetStyle() const { return m_nStyle; } + wxString GetText() const { return m_text; } + + + // implementation-only from now on + // ------------------------------- + + bool IsEllipsized() const + { return m_bEllipsized; } + void SetIsEllipsized(bool isEllipsized) { m_bEllipsized = isEllipsized; } + + void SetWidth(int width) { m_nWidth = width; } + void SetStyle(int style) { m_nStyle = style; } + + // set text, return true if it changed or false if it was already set to + // this value + bool SetText(const wxString& text); + + // save the existing text on top of our stack and make the new text + // current; return true if the text really changed + bool PushText(const wxString& text); + + // restore the message saved by the last call to Push() (unless it was + // changed by an intervening call to SetText()) and return true if we + // really restored anything + bool PopText(); + +private: + int m_nStyle; + int m_nWidth; // may be negative, indicating a variable-width field + wxString m_text; + + // the array used to keep the previous values of this pane after a + // PushStatusText() call, its top element is the value to restore after the + // next PopStatusText() call while the currently shown value is always in + // m_text + wxArrayString m_arrStack; + + // is the currently shown value shown with ellipsis in the status bar? + bool m_bEllipsized; +}; + +WX_DECLARE_EXPORTED_OBJARRAY(wxStatusBarPane, wxStatusBarPaneArray); + +// ---------------------------------------------------------------------------- +// wxStatusBar: a window near the bottom of the frame used for status info +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxStatusBarBase : public wxControl +{ +public: + wxStatusBarBase(); + + virtual ~wxStatusBarBase(); + + // field count + // ----------- + + // set the number of fields and call SetStatusWidths(widths) if widths are + // given + virtual void SetFieldsCount(int number = 1, const int *widths = NULL); + int GetFieldsCount() const { return (int)m_panes.GetCount(); } + + // field text + // ---------- + + // just change or get the currently shown text + void SetStatusText(const wxString& text, int number = 0); + wxString GetStatusText(int number = 0) const; + + // change the currently shown text to the new one and save the current + // value to be restored by the next call to PopStatusText() + void PushStatusText(const wxString& text, int number = 0); + void PopStatusText(int number = 0); + + // fields widths + // ------------- + + // set status field widths as absolute numbers: positive widths mean that + // the field has the specified absolute width, negative widths are + // interpreted as the sizer options, i.e. the extra space (total space + // minus the sum of fixed width fields) is divided between the fields with + // negative width according to the abs value of the width (field with width + // -2 grows twice as much as one with width -1 &c) + virtual void SetStatusWidths(int n, const int widths[]); + + int GetStatusWidth(int n) const + { return m_panes[n].GetWidth(); } + + // field styles + // ------------ + + // Set the field border style to one of wxSB_XXX values. + virtual void SetStatusStyles(int n, const int styles[]); + + int GetStatusStyle(int n) const + { return m_panes[n].GetStyle(); } + + // geometry + // -------- + + // Get the position and size of the field's internal bounding rectangle + virtual bool GetFieldRect(int i, wxRect& rect) const = 0; + + // sets the minimal vertical size of the status bar + virtual void SetMinHeight(int height) = 0; + + // get the dimensions of the horizontal and vertical borders + virtual int GetBorderX() const = 0; + virtual int GetBorderY() const = 0; + + wxSize GetBorders() const + { return wxSize(GetBorderX(), GetBorderY()); } + + // miscellaneous + // ------------- + + const wxStatusBarPane& GetField(int n) const + { return m_panes[n]; } + + // wxWindow overrides: + + // don't want status bars to accept the focus at all + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } + + // the client size of a toplevel window doesn't include the status bar + virtual bool CanBeOutsideClientArea() const wxOVERRIDE { return true; } + +protected: + // called after the status bar pane text changed and should update its + // display + virtual void DoUpdateStatusText(int number) = 0; + + + // wxWindow overrides: + +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip( wxToolTip *tip ) wxOVERRIDE + { + wxASSERT_MSG(!HasFlag(wxSTB_SHOW_TIPS), + "Do not set tooltip(s) manually when using wxSTB_SHOW_TIPS!"); + wxWindow::DoSetToolTip(tip); + } +#endif // wxUSE_TOOLTIPS + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + + + // internal helpers & data: + + // calculate the real field widths for the given total available size + wxArrayInt CalculateAbsWidths(wxCoord widthTotal) const; + + // should be called to remember if the pane text is currently being show + // ellipsized or not + void SetEllipsizedFlag(int n, bool isEllipsized); + + + // the array with the pane infos: + wxStatusBarPaneArray m_panes; + + // if true overrides the width info of the wxStatusBarPanes + bool m_bSameWidthForAllPanes; + + wxDECLARE_NO_COPY_CLASS(wxStatusBarBase); +}; + +// ---------------------------------------------------------------------------- +// include the actual wxStatusBar class declaration +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + #define wxStatusBarUniv wxStatusBar + #include "wx/univ/statusbr.h" +#elif defined(__WXMSW__) && wxUSE_NATIVE_STATUSBAR + #include "wx/msw/statusbar.h" +#elif defined(__WXMAC__) + #define wxStatusBarMac wxStatusBar + #include "wx/generic/statusbr.h" + #include "wx/osx/statusbr.h" +#elif defined(__WXQT__) + #include "wx/qt/statusbar.h" +#else + #define wxStatusBarGeneric wxStatusBar + #include "wx/generic/statusbr.h" +#endif + +#endif // wxUSE_STATUSBAR + +#endif + // _WX_STATUSBR_H_BASE_ diff --git a/lib/wxWidgets/include/wx/stc/private.h b/lib/wxWidgets/include/wx/stc/private.h new file mode 100644 index 0000000..f48a037 --- /dev/null +++ b/lib/wxWidgets/include/wx/stc/private.h @@ -0,0 +1,54 @@ +//////////////////////////////////////////////////////////////////////////// +// Name: wx/stc/private.h +// Purpose: Private declarations for wxSTC +// Author: Robin Dunn +// Created: 2007-07-15 +// Copyright: (c) 2000 by Total Control Software +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STC_PRIVATE_H_ +#define _WX_STC_PRIVATE_H_ + +#include "wx/defs.h" +#include "wx/string.h" + +//---------------------------------------------------------------------- +// Utility functions used within wxSTC + +#if wxUSE_UNICODE + +extern wxString stc2wx(const char* str); +extern wxString stc2wx(const char* str, size_t len); +extern wxCharBuffer wx2stc(const wxString& str); + +// This function takes both wxString and wxCharBuffer because it uses either +// one or the other of them depending on the build mode. In Unicode it uses the +// length of the already converted buffer to avoid doing the conversion again +// just to compute the length. +inline size_t wx2stclen(const wxString& WXUNUSED(str), const wxCharBuffer& buf) +{ + return buf.length(); +} + +#else // not UNICODE + +inline wxString stc2wx(const char* str) { + return wxString(str); +} +inline wxString stc2wx(const char* str, size_t len) { + return wxString(str, len); +} +inline const char* wx2stc(const wxString& str) { + return str.mbc_str(); +} + +// As explained above, the buffer argument is only used in Unicode build. +inline size_t wx2stclen(const wxString& str, const char* WXUNUSED(buf)) +{ + return str.length(); +} + +#endif // UNICODE + +#endif // _WX_STC_PRIVATE_H_ diff --git a/lib/wxWidgets/include/wx/stc/stc.h b/lib/wxWidgets/include/wx/stc/stc.h new file mode 100644 index 0000000..e165d73 --- /dev/null +++ b/lib/wxWidgets/include/wx/stc/stc.h @@ -0,0 +1,5781 @@ +//////////////////////////////////////////////////////////////////////////// +// Name: wx/stc/stc.h +// Purpose: A wxWidgets implementation of Scintilla. This class is the +// one meant to be used directly by wx applications. It does not +// derive directly from the Scintilla classes, and in fact there +// is no mention of Scintilla classes at all in this header. +// This class delegates all method calls and events to the +// Scintilla objects and so forth. This allows the use of +// Scintilla without polluting the namespace with all the +// classes and identifiers from Scintilla. +// +// Author: Robin Dunn +// +// Created: 13-Jan-2000 +// Copyright: (c) 2000 by Total Control Software +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +/* + IMPORTANT: include/wx/stc/stc.h is generated by src/stc/gen_iface.py from + src/stc/stc.h.in, don't edit stc.h file as your changes will be + lost after the next regeneration, edit stc.h.in and rerun the + gen_iface.py script instead! + + Parts of this file generated by the script are found in between + the special "{{{" and "}}}" markers, the rest of it is copied + verbatim from src.h.in. + */ + +#ifndef _WX_STC_STC_H_ +#define _WX_STC_STC_H_ + +#include "wx/defs.h" + +#if wxUSE_STC + +#include "wx/control.h" +#include "wx/dnd.h" +#include "wx/stopwatch.h" +#include "wx/versioninfo.h" + +#include "wx/textentry.h" +#if wxUSE_TEXTCTRL + #include "wx/textctrl.h" +#endif // wxUSE_TEXTCTRL + +class WXDLLIMPEXP_FWD_CORE wxScrollBar; + +// SWIG can't handle "#if" type of conditionals, only "#ifdef" +#ifdef SWIG +#define STC_USE_DND 1 +#else +#if wxUSE_DRAG_AND_DROP +#define STC_USE_DND 1 +#endif +#endif + +//---------------------------------------------------------------------- +// STC constants generated section {{{ + +#define wxSTC_INVALID_POSITION -1 + +/// Define start of Scintilla messages to be greater than all Windows edit (EM_*) messages +/// as many EM_ messages can be used although that use is deprecated. +#define wxSTC_START 2000 +#define wxSTC_OPTIONAL_START 3000 +#define wxSTC_LEXER_START 4000 +#define wxSTC_WS_INVISIBLE 0 +#define wxSTC_WS_VISIBLEALWAYS 1 +#define wxSTC_WS_VISIBLEAFTERINDENT 2 +#define wxSTC_WS_VISIBLEONLYININDENT 3 +#define wxSTC_TD_LONGARROW 0 +#define wxSTC_TD_STRIKEOUT 1 +#define wxSTC_EOL_CRLF 0 +#define wxSTC_EOL_CR 1 +#define wxSTC_EOL_LF 2 + +/// The SC_CP_UTF8 value can be used to enter Unicode mode. +/// This is the same value as CP_UTF8 in Windows +#define wxSTC_CP_UTF8 65001 +#define wxSTC_IME_WINDOWED 0 +#define wxSTC_IME_INLINE 1 +#define wxSTC_MARKER_MAX 31 +#define wxSTC_MARK_CIRCLE 0 +#define wxSTC_MARK_ROUNDRECT 1 +#define wxSTC_MARK_ARROW 2 +#define wxSTC_MARK_SMALLRECT 3 +#define wxSTC_MARK_SHORTARROW 4 +#define wxSTC_MARK_EMPTY 5 +#define wxSTC_MARK_ARROWDOWN 6 +#define wxSTC_MARK_MINUS 7 +#define wxSTC_MARK_PLUS 8 + +/// Shapes used for outlining column. +#define wxSTC_MARK_VLINE 9 +#define wxSTC_MARK_LCORNER 10 +#define wxSTC_MARK_TCORNER 11 +#define wxSTC_MARK_BOXPLUS 12 +#define wxSTC_MARK_BOXPLUSCONNECTED 13 +#define wxSTC_MARK_BOXMINUS 14 +#define wxSTC_MARK_BOXMINUSCONNECTED 15 +#define wxSTC_MARK_LCORNERCURVE 16 +#define wxSTC_MARK_TCORNERCURVE 17 +#define wxSTC_MARK_CIRCLEPLUS 18 +#define wxSTC_MARK_CIRCLEPLUSCONNECTED 19 +#define wxSTC_MARK_CIRCLEMINUS 20 +#define wxSTC_MARK_CIRCLEMINUSCONNECTED 21 + +/// Invisible mark that only sets the line background colour. +#define wxSTC_MARK_BACKGROUND 22 +#define wxSTC_MARK_DOTDOTDOT 23 +#define wxSTC_MARK_ARROWS 24 +#define wxSTC_MARK_PIXMAP 25 +#define wxSTC_MARK_FULLRECT 26 +#define wxSTC_MARK_LEFTRECT 27 +#define wxSTC_MARK_AVAILABLE 28 +#define wxSTC_MARK_UNDERLINE 29 +#define wxSTC_MARK_RGBAIMAGE 30 +#define wxSTC_MARK_BOOKMARK 31 +#define wxSTC_MARK_CHARACTER 10000 + +/// Markers used for outlining column. +#define wxSTC_MARKNUM_FOLDEREND 25 +#define wxSTC_MARKNUM_FOLDEROPENMID 26 +#define wxSTC_MARKNUM_FOLDERMIDTAIL 27 +#define wxSTC_MARKNUM_FOLDERTAIL 28 +#define wxSTC_MARKNUM_FOLDERSUB 29 +#define wxSTC_MARKNUM_FOLDER 30 +#define wxSTC_MARKNUM_FOLDEROPEN 31 +#define wxSTC_MASK_FOLDERS 0xFE000000 +#define wxSTC_MAX_MARGIN 4 +#define wxSTC_MARGIN_SYMBOL 0 +#define wxSTC_MARGIN_NUMBER 1 +#define wxSTC_MARGIN_BACK 2 +#define wxSTC_MARGIN_FORE 3 +#define wxSTC_MARGIN_TEXT 4 +#define wxSTC_MARGIN_RTEXT 5 +#define wxSTC_MARGIN_COLOUR 6 + +/// Styles in range 32..38 are predefined for parts of the UI and are not used as normal styles. +/// Style 39 is for future use. +#define wxSTC_STYLE_DEFAULT 32 +#define wxSTC_STYLE_LINENUMBER 33 +#define wxSTC_STYLE_BRACELIGHT 34 +#define wxSTC_STYLE_BRACEBAD 35 +#define wxSTC_STYLE_CONTROLCHAR 36 +#define wxSTC_STYLE_INDENTGUIDE 37 +#define wxSTC_STYLE_CALLTIP 38 +#define wxSTC_STYLE_FOLDDISPLAYTEXT 39 +#define wxSTC_STYLE_LASTPREDEFINED 39 +#define wxSTC_STYLE_MAX 255 + +/// Character set identifiers are used in StyleSetCharacterSet. +/// The values are the same as the Windows *_CHARSET values. +#define wxSTC_CHARSET_ANSI 0 +#define wxSTC_CHARSET_DEFAULT 1 +#define wxSTC_CHARSET_BALTIC 186 +#define wxSTC_CHARSET_CHINESEBIG5 136 +#define wxSTC_CHARSET_EASTEUROPE 238 +#define wxSTC_CHARSET_GB2312 134 +#define wxSTC_CHARSET_GREEK 161 +#define wxSTC_CHARSET_HANGUL 129 +#define wxSTC_CHARSET_MAC 77 +#define wxSTC_CHARSET_OEM 255 +#define wxSTC_CHARSET_RUSSIAN 204 +#define wxSTC_CHARSET_OEM866 866 +#define wxSTC_CHARSET_CYRILLIC 1251 +#define wxSTC_CHARSET_SHIFTJIS 128 +#define wxSTC_CHARSET_SYMBOL 2 +#define wxSTC_CHARSET_TURKISH 162 +#define wxSTC_CHARSET_JOHAB 130 +#define wxSTC_CHARSET_HEBREW 177 +#define wxSTC_CHARSET_ARABIC 178 +#define wxSTC_CHARSET_VIETNAMESE 163 +#define wxSTC_CHARSET_THAI 222 +#define wxSTC_CHARSET_8859_15 1000 +#define wxSTC_CASE_MIXED 0 +#define wxSTC_CASE_UPPER 1 +#define wxSTC_CASE_LOWER 2 +#define wxSTC_CASE_CAMEL 3 +#define wxSTC_FONT_SIZE_MULTIPLIER 100 +#define wxSTC_WEIGHT_NORMAL 400 +#define wxSTC_WEIGHT_SEMIBOLD 600 +#define wxSTC_WEIGHT_BOLD 700 + +/// Indicator style enumeration and some constants +#define wxSTC_INDIC_PLAIN 0 +#define wxSTC_INDIC_SQUIGGLE 1 +#define wxSTC_INDIC_TT 2 +#define wxSTC_INDIC_DIAGONAL 3 +#define wxSTC_INDIC_STRIKE 4 +#define wxSTC_INDIC_HIDDEN 5 +#define wxSTC_INDIC_BOX 6 +#define wxSTC_INDIC_ROUNDBOX 7 +#define wxSTC_INDIC_STRAIGHTBOX 8 +#define wxSTC_INDIC_DASH 9 +#define wxSTC_INDIC_DOTS 10 +#define wxSTC_INDIC_SQUIGGLELOW 11 +#define wxSTC_INDIC_DOTBOX 12 +#define wxSTC_INDIC_SQUIGGLEPIXMAP 13 +#define wxSTC_INDIC_COMPOSITIONTHICK 14 +#define wxSTC_INDIC_COMPOSITIONTHIN 15 +#define wxSTC_INDIC_FULLBOX 16 +#define wxSTC_INDIC_TEXTFORE 17 +#define wxSTC_INDIC_POINT 18 +#define wxSTC_INDIC_POINTCHARACTER 19 +#define wxSTC_INDIC_IME 32 +#define wxSTC_INDIC_IME_MAX 35 +#define wxSTC_INDIC_MAX 35 +#define wxSTC_INDIC_CONTAINER 8 +#define wxSTC_INDICVALUEBIT 0x1000000 +#define wxSTC_INDICVALUEMASK 0xFFFFFF +#define wxSTC_INDICFLAG_VALUEFORE 1 +#define wxSTC_IV_NONE 0 +#define wxSTC_IV_REAL 1 +#define wxSTC_IV_LOOKFORWARD 2 +#define wxSTC_IV_LOOKBOTH 3 + +/// PrintColourMode - use same colours as screen. +#define wxSTC_PRINT_NORMAL 0 + +/// PrintColourMode - invert the light value of each style for printing. +#define wxSTC_PRINT_INVERTLIGHT 1 + +/// PrintColourMode - force black text on white background for printing. +#define wxSTC_PRINT_BLACKONWHITE 2 + +/// PrintColourMode - text stays coloured, but all background is forced to be white for printing. +#define wxSTC_PRINT_COLOURONWHITE 3 + +/// PrintColourMode - only the default-background is forced to be white for printing. +#define wxSTC_PRINT_COLOURONWHITEDEFAULTBG 4 +#define wxSTC_FIND_WHOLEWORD 0x2 +#define wxSTC_FIND_MATCHCASE 0x4 +#define wxSTC_FIND_WORDSTART 0x00100000 +#define wxSTC_FIND_REGEXP 0x00200000 +#define wxSTC_FIND_POSIX 0x00400000 +#define wxSTC_FOLDLEVELBASE 0x400 +#define wxSTC_FOLDLEVELWHITEFLAG 0x1000 +#define wxSTC_FOLDLEVELHEADERFLAG 0x2000 +#define wxSTC_FOLDLEVELNUMBERMASK 0x0FFF +#define wxSTC_FOLDDISPLAYTEXT_HIDDEN 0 +#define wxSTC_FOLDDISPLAYTEXT_STANDARD 1 +#define wxSTC_FOLDDISPLAYTEXT_BOXED 2 +#define wxSTC_FOLDACTION_CONTRACT 0 +#define wxSTC_FOLDACTION_EXPAND 1 +#define wxSTC_FOLDACTION_TOGGLE 2 +#define wxSTC_AUTOMATICFOLD_SHOW 0x0001 +#define wxSTC_AUTOMATICFOLD_CLICK 0x0002 +#define wxSTC_AUTOMATICFOLD_CHANGE 0x0004 +#define wxSTC_FOLDFLAG_LINEBEFORE_EXPANDED 0x0002 +#define wxSTC_FOLDFLAG_LINEBEFORE_CONTRACTED 0x0004 +#define wxSTC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008 +#define wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010 +#define wxSTC_FOLDFLAG_LEVELNUMBERS 0x0040 +#define wxSTC_FOLDFLAG_LINESTATE 0x0080 +#define wxSTC_TIME_FOREVER 10000000 +#define wxSTC_IDLESTYLING_NONE 0 +#define wxSTC_IDLESTYLING_TOVISIBLE 1 +#define wxSTC_IDLESTYLING_AFTERVISIBLE 2 +#define wxSTC_IDLESTYLING_ALL 3 +#define wxSTC_WRAP_NONE 0 +#define wxSTC_WRAP_WORD 1 +#define wxSTC_WRAP_CHAR 2 +#define wxSTC_WRAP_WHITESPACE 3 +#define wxSTC_WRAPVISUALFLAG_NONE 0x0000 +#define wxSTC_WRAPVISUALFLAG_END 0x0001 +#define wxSTC_WRAPVISUALFLAG_START 0x0002 +#define wxSTC_WRAPVISUALFLAG_MARGIN 0x0004 +#define wxSTC_WRAPVISUALFLAGLOC_DEFAULT 0x0000 +#define wxSTC_WRAPVISUALFLAGLOC_END_BY_TEXT 0x0001 +#define wxSTC_WRAPVISUALFLAGLOC_START_BY_TEXT 0x0002 +#define wxSTC_WRAPINDENT_FIXED 0 +#define wxSTC_WRAPINDENT_SAME 1 +#define wxSTC_WRAPINDENT_INDENT 2 +#define wxSTC_CACHE_NONE 0 +#define wxSTC_CACHE_CARET 1 +#define wxSTC_CACHE_PAGE 2 +#define wxSTC_CACHE_DOCUMENT 3 +#define wxSTC_PHASES_ONE 0 +#define wxSTC_PHASES_TWO 1 +#define wxSTC_PHASES_MULTIPLE 2 + +/// Control font anti-aliasing. +#define wxSTC_EFF_QUALITY_MASK 0xF +#define wxSTC_EFF_QUALITY_DEFAULT 0 +#define wxSTC_EFF_QUALITY_NON_ANTIALIASED 1 +#define wxSTC_EFF_QUALITY_ANTIALIASED 2 +#define wxSTC_EFF_QUALITY_LCD_OPTIMIZED 3 +#define wxSTC_MULTIPASTE_ONCE 0 +#define wxSTC_MULTIPASTE_EACH 1 +#define wxSTC_EDGE_NONE 0 +#define wxSTC_EDGE_LINE 1 +#define wxSTC_EDGE_BACKGROUND 2 +#define wxSTC_EDGE_MULTILINE 3 +#define wxSTC_POPUP_NEVER 0 +#define wxSTC_POPUP_ALL 1 +#define wxSTC_POPUP_TEXT 2 +#define wxSTC_STATUS_OK 0 +#define wxSTC_STATUS_FAILURE 1 +#define wxSTC_STATUS_BADALLOC 2 +#define wxSTC_STATUS_WARN_START 1000 +#define wxSTC_STATUS_WARN_REGEX 1001 +#define wxSTC_CURSORNORMAL -1 +#define wxSTC_CURSORARROW 2 +#define wxSTC_CURSORWAIT 4 +#define wxSTC_CURSORREVERSEARROW 7 + +/// Constants for use with SetVisiblePolicy, similar to SetCaretPolicy. +#define wxSTC_VISIBLE_SLOP 0x01 +#define wxSTC_VISIBLE_STRICT 0x04 + +/// Caret policy, used by SetXCaretPolicy and SetYCaretPolicy. +/// If CARET_SLOP is set, we can define a slop value: caretSlop. +/// This value defines an unwanted zone (UZ) where the caret is... unwanted. +/// This zone is defined as a number of pixels near the vertical margins, +/// and as a number of lines near the horizontal margins. +/// By keeping the caret away from the edges, it is seen within its context, +/// so it is likely that the identifier that the caret is on can be completely seen, +/// and that the current line is seen with some of the lines following it which are +/// often dependent on that line. +#define wxSTC_CARET_SLOP 0x01 + +/// If CARET_STRICT is set, the policy is enforced... strictly. +/// The caret is centred on the display if slop is not set, +/// and cannot go in the UZ if slop is set. +#define wxSTC_CARET_STRICT 0x04 + +/// If CARET_JUMPS is set, the display is moved more energetically +/// so the caret can move in the same direction longer before the policy is applied again. +#define wxSTC_CARET_JUMPS 0x10 + +/// If CARET_EVEN is not set, instead of having symmetrical UZs, +/// the left and bottom UZs are extended up to right and top UZs respectively. +/// This way, we favour the displaying of useful information: the beginning of lines, +/// where most code reside, and the lines after the caret, eg. the body of a function. +#define wxSTC_CARET_EVEN 0x08 +#define wxSTC_SEL_STREAM 0 +#define wxSTC_SEL_RECTANGLE 1 +#define wxSTC_SEL_LINES 2 +#define wxSTC_SEL_THIN 3 +#define wxSTC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE 0 +#define wxSTC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1 +#define wxSTC_MULTIAUTOC_ONCE 0 +#define wxSTC_MULTIAUTOC_EACH 1 +#define wxSTC_ORDER_PRESORTED 0 +#define wxSTC_ORDER_PERFORMSORT 1 +#define wxSTC_ORDER_CUSTOM 2 +#define wxSTC_CARETSTICKY_OFF 0 +#define wxSTC_CARETSTICKY_ON 1 +#define wxSTC_CARETSTICKY_WHITESPACE 2 +#define wxSTC_ALPHA_TRANSPARENT 0 +#define wxSTC_ALPHA_OPAQUE 255 +#define wxSTC_ALPHA_NOALPHA 256 +#define wxSTC_CARETSTYLE_INVISIBLE 0 +#define wxSTC_CARETSTYLE_LINE 1 +#define wxSTC_CARETSTYLE_BLOCK 2 +#define wxSTC_MARGINOPTION_NONE 0 +#define wxSTC_MARGINOPTION_SUBLINESELECT 1 +#define wxSTC_ANNOTATION_HIDDEN 0 +#define wxSTC_ANNOTATION_STANDARD 1 +#define wxSTC_ANNOTATION_BOXED 2 +#define wxSTC_ANNOTATION_INDENTED 3 +#define wxSTC_UNDO_MAY_COALESCE 1 +#define wxSTC_VS_NONE 0 +#define wxSTC_VS_RECTANGULARSELECTION 1 +#define wxSTC_VS_USERACCESSIBLE 2 +#define wxSTC_VS_NOWRAPLINESTART 4 +#define wxSTC_TECHNOLOGY_DEFAULT 0 +#define wxSTC_TECHNOLOGY_DIRECTWRITE 1 + +/// Line end types which may be used in addition to LF, CR, and CRLF +/// SC_LINE_END_TYPE_UNICODE includes U+2028 Line Separator, +/// U+2029 Paragraph Separator, and U+0085 Next Line +#define wxSTC_LINE_END_TYPE_DEFAULT 0 +#define wxSTC_LINE_END_TYPE_UNICODE 1 + +/// Maximum value of keywordSet parameter of SetKeyWords. +#define wxSTC_KEYWORDSET_MAX 8 +#define wxSTC_TYPE_BOOLEAN 0 +#define wxSTC_TYPE_INTEGER 1 +#define wxSTC_TYPE_STRING 2 + +/// Notifications +/// Type of modification and the action which caused the modification. +/// These are defined as a bit mask to make it easy to specify which notifications are wanted. +/// One bit is set from each of SC_MOD_* and SC_PERFORMED_*. +#define wxSTC_MOD_INSERTTEXT 0x1 +#define wxSTC_MOD_DELETETEXT 0x2 +#define wxSTC_MOD_CHANGESTYLE 0x4 +#define wxSTC_MOD_CHANGEFOLD 0x8 +#define wxSTC_PERFORMED_USER 0x10 +#define wxSTC_PERFORMED_UNDO 0x20 +#define wxSTC_PERFORMED_REDO 0x40 +#define wxSTC_MULTISTEPUNDOREDO 0x80 +#define wxSTC_LASTSTEPINUNDOREDO 0x100 +#define wxSTC_MOD_CHANGEMARKER 0x200 +#define wxSTC_MOD_BEFOREINSERT 0x400 +#define wxSTC_MOD_BEFOREDELETE 0x800 +#define wxSTC_MULTILINEUNDOREDO 0x1000 +#define wxSTC_STARTACTION 0x2000 +#define wxSTC_MOD_CHANGEINDICATOR 0x4000 +#define wxSTC_MOD_CHANGELINESTATE 0x8000 +#define wxSTC_MOD_CHANGEMARGIN 0x10000 +#define wxSTC_MOD_CHANGEANNOTATION 0x20000 +#define wxSTC_MOD_CONTAINER 0x40000 +#define wxSTC_MOD_LEXERSTATE 0x80000 +#define wxSTC_MOD_INSERTCHECK 0x100000 +#define wxSTC_MOD_CHANGETABSTOPS 0x200000 +#define wxSTC_MODEVENTMASKALL 0x3FFFFF +#define wxSTC_UPDATE_CONTENT 0x1 +#define wxSTC_UPDATE_SELECTION 0x2 +#define wxSTC_UPDATE_V_SCROLL 0x4 +#define wxSTC_UPDATE_H_SCROLL 0x8 + +/// Symbolic key codes and modifier flags. +/// ASCII and other printable characters below 256. +/// Extended keys above 300. +#define wxSTC_KEY_DOWN 300 +#define wxSTC_KEY_UP 301 +#define wxSTC_KEY_LEFT 302 +#define wxSTC_KEY_RIGHT 303 +#define wxSTC_KEY_HOME 304 +#define wxSTC_KEY_END 305 +#define wxSTC_KEY_PRIOR 306 +#define wxSTC_KEY_NEXT 307 +#define wxSTC_KEY_DELETE 308 +#define wxSTC_KEY_INSERT 309 +#define wxSTC_KEY_ESCAPE 7 +#define wxSTC_KEY_BACK 8 +#define wxSTC_KEY_TAB 9 +#define wxSTC_KEY_RETURN 13 +#define wxSTC_KEY_ADD 310 +#define wxSTC_KEY_SUBTRACT 311 +#define wxSTC_KEY_DIVIDE 312 +#define wxSTC_KEY_WIN 313 +#define wxSTC_KEY_RWIN 314 +#define wxSTC_KEY_MENU 315 +#define wxSTC_KEYMOD_NORM 0 +#define wxSTC_KEYMOD_SHIFT 1 +#define wxSTC_KEYMOD_CTRL 2 +#define wxSTC_KEYMOD_ALT 4 +#define wxSTC_KEYMOD_SUPER 8 +#define wxSTC_KEYMOD_META 16 +#define wxSTC_AC_FILLUP 1 +#define wxSTC_AC_DOUBLECLICK 2 +#define wxSTC_AC_TAB 3 +#define wxSTC_AC_NEWLINE 4 +#define wxSTC_AC_COMMAND 5 + +/// For SciLexer.h +#define wxSTC_LEX_CONTAINER 0 +#define wxSTC_LEX_NULL 1 +#define wxSTC_LEX_PYTHON 2 +#define wxSTC_LEX_CPP 3 +#define wxSTC_LEX_HTML 4 +#define wxSTC_LEX_XML 5 +#define wxSTC_LEX_PERL 6 +#define wxSTC_LEX_SQL 7 +#define wxSTC_LEX_VB 8 +#define wxSTC_LEX_PROPERTIES 9 +#define wxSTC_LEX_ERRORLIST 10 +#define wxSTC_LEX_MAKEFILE 11 +#define wxSTC_LEX_BATCH 12 +#define wxSTC_LEX_XCODE 13 +#define wxSTC_LEX_LATEX 14 +#define wxSTC_LEX_LUA 15 +#define wxSTC_LEX_DIFF 16 +#define wxSTC_LEX_CONF 17 +#define wxSTC_LEX_PASCAL 18 +#define wxSTC_LEX_AVE 19 +#define wxSTC_LEX_ADA 20 +#define wxSTC_LEX_LISP 21 +#define wxSTC_LEX_RUBY 22 +#define wxSTC_LEX_EIFFEL 23 +#define wxSTC_LEX_EIFFELKW 24 +#define wxSTC_LEX_TCL 25 +#define wxSTC_LEX_NNCRONTAB 26 +#define wxSTC_LEX_BULLANT 27 +#define wxSTC_LEX_VBSCRIPT 28 +#define wxSTC_LEX_BAAN 31 +#define wxSTC_LEX_MATLAB 32 +#define wxSTC_LEX_SCRIPTOL 33 +#define wxSTC_LEX_ASM 34 +#define wxSTC_LEX_CPPNOCASE 35 +#define wxSTC_LEX_FORTRAN 36 +#define wxSTC_LEX_F77 37 +#define wxSTC_LEX_CSS 38 +#define wxSTC_LEX_POV 39 +#define wxSTC_LEX_LOUT 40 +#define wxSTC_LEX_ESCRIPT 41 +#define wxSTC_LEX_PS 42 +#define wxSTC_LEX_NSIS 43 +#define wxSTC_LEX_MMIXAL 44 +#define wxSTC_LEX_CLW 45 +#define wxSTC_LEX_CLWNOCASE 46 +#define wxSTC_LEX_LOT 47 +#define wxSTC_LEX_YAML 48 +#define wxSTC_LEX_TEX 49 +#define wxSTC_LEX_METAPOST 50 +#define wxSTC_LEX_POWERBASIC 51 +#define wxSTC_LEX_FORTH 52 +#define wxSTC_LEX_ERLANG 53 +#define wxSTC_LEX_OCTAVE 54 +#define wxSTC_LEX_MSSQL 55 +#define wxSTC_LEX_VERILOG 56 +#define wxSTC_LEX_KIX 57 +#define wxSTC_LEX_GUI4CLI 58 +#define wxSTC_LEX_SPECMAN 59 +#define wxSTC_LEX_AU3 60 +#define wxSTC_LEX_APDL 61 +#define wxSTC_LEX_BASH 62 +#define wxSTC_LEX_ASN1 63 +#define wxSTC_LEX_VHDL 64 +#define wxSTC_LEX_CAML 65 +#define wxSTC_LEX_BLITZBASIC 66 +#define wxSTC_LEX_PUREBASIC 67 +#define wxSTC_LEX_HASKELL 68 +#define wxSTC_LEX_PHPSCRIPT 69 +#define wxSTC_LEX_TADS3 70 +#define wxSTC_LEX_REBOL 71 +#define wxSTC_LEX_SMALLTALK 72 +#define wxSTC_LEX_FLAGSHIP 73 +#define wxSTC_LEX_CSOUND 74 +#define wxSTC_LEX_FREEBASIC 75 +#define wxSTC_LEX_INNOSETUP 76 +#define wxSTC_LEX_OPAL 77 +#define wxSTC_LEX_SPICE 78 +#define wxSTC_LEX_D 79 +#define wxSTC_LEX_CMAKE 80 +#define wxSTC_LEX_GAP 81 +#define wxSTC_LEX_PLM 82 +#define wxSTC_LEX_PROGRESS 83 +#define wxSTC_LEX_ABAQUS 84 +#define wxSTC_LEX_ASYMPTOTE 85 +#define wxSTC_LEX_R 86 +#define wxSTC_LEX_MAGIK 87 +#define wxSTC_LEX_POWERSHELL 88 +#define wxSTC_LEX_MYSQL 89 +#define wxSTC_LEX_PO 90 +#define wxSTC_LEX_TAL 91 +#define wxSTC_LEX_COBOL 92 +#define wxSTC_LEX_TACL 93 +#define wxSTC_LEX_SORCUS 94 +#define wxSTC_LEX_POWERPRO 95 +#define wxSTC_LEX_NIMROD 96 +#define wxSTC_LEX_SML 97 +#define wxSTC_LEX_MARKDOWN 98 +#define wxSTC_LEX_TXT2TAGS 99 +#define wxSTC_LEX_A68K 100 +#define wxSTC_LEX_MODULA 101 +#define wxSTC_LEX_COFFEESCRIPT 102 +#define wxSTC_LEX_TCMD 103 +#define wxSTC_LEX_AVS 104 +#define wxSTC_LEX_ECL 105 +#define wxSTC_LEX_OSCRIPT 106 +#define wxSTC_LEX_VISUALPROLOG 107 +#define wxSTC_LEX_LITERATEHASKELL 108 +#define wxSTC_LEX_STTXT 109 +#define wxSTC_LEX_KVIRC 110 +#define wxSTC_LEX_RUST 111 +#define wxSTC_LEX_DMAP 112 +#define wxSTC_LEX_AS 113 +#define wxSTC_LEX_DMIS 114 +#define wxSTC_LEX_REGISTRY 115 +#define wxSTC_LEX_BIBTEX 116 +#define wxSTC_LEX_SREC 117 +#define wxSTC_LEX_IHEX 118 +#define wxSTC_LEX_TEHEX 119 +#define wxSTC_LEX_JSON 120 +#define wxSTC_LEX_EDIFACT 121 + +/// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a +/// value assigned in sequence from SCLEX_AUTOMATIC+1. +#define wxSTC_LEX_AUTOMATIC 1000 + +/// Lexical states for SCLEX_PYTHON +#define wxSTC_P_DEFAULT 0 +#define wxSTC_P_COMMENTLINE 1 +#define wxSTC_P_NUMBER 2 +#define wxSTC_P_STRING 3 +#define wxSTC_P_CHARACTER 4 +#define wxSTC_P_WORD 5 +#define wxSTC_P_TRIPLE 6 +#define wxSTC_P_TRIPLEDOUBLE 7 +#define wxSTC_P_CLASSNAME 8 +#define wxSTC_P_DEFNAME 9 +#define wxSTC_P_OPERATOR 10 +#define wxSTC_P_IDENTIFIER 11 +#define wxSTC_P_COMMENTBLOCK 12 +#define wxSTC_P_STRINGEOL 13 +#define wxSTC_P_WORD2 14 +#define wxSTC_P_DECORATOR 15 + +/// Lexical states for SCLEX_CPP, SCLEX_BULLANT, SCLEX_COBOL, SCLEX_TACL, SCLEX_TAL +#define wxSTC_C_DEFAULT 0 +#define wxSTC_C_COMMENT 1 +#define wxSTC_C_COMMENTLINE 2 +#define wxSTC_C_COMMENTDOC 3 +#define wxSTC_C_NUMBER 4 +#define wxSTC_C_WORD 5 +#define wxSTC_C_STRING 6 +#define wxSTC_C_CHARACTER 7 +#define wxSTC_C_UUID 8 +#define wxSTC_C_PREPROCESSOR 9 +#define wxSTC_C_OPERATOR 10 +#define wxSTC_C_IDENTIFIER 11 +#define wxSTC_C_STRINGEOL 12 +#define wxSTC_C_VERBATIM 13 +#define wxSTC_C_REGEX 14 +#define wxSTC_C_COMMENTLINEDOC 15 +#define wxSTC_C_WORD2 16 +#define wxSTC_C_COMMENTDOCKEYWORD 17 +#define wxSTC_C_COMMENTDOCKEYWORDERROR 18 +#define wxSTC_C_GLOBALCLASS 19 +#define wxSTC_C_STRINGRAW 20 +#define wxSTC_C_TRIPLEVERBATIM 21 +#define wxSTC_C_HASHQUOTEDSTRING 22 +#define wxSTC_C_PREPROCESSORCOMMENT 23 +#define wxSTC_C_PREPROCESSORCOMMENTDOC 24 +#define wxSTC_C_USERLITERAL 25 +#define wxSTC_C_TASKMARKER 26 +#define wxSTC_C_ESCAPESEQUENCE 27 + +/// Lexical states for SCLEX_D +#define wxSTC_D_DEFAULT 0 +#define wxSTC_D_COMMENT 1 +#define wxSTC_D_COMMENTLINE 2 +#define wxSTC_D_COMMENTDOC 3 +#define wxSTC_D_COMMENTNESTED 4 +#define wxSTC_D_NUMBER 5 +#define wxSTC_D_WORD 6 +#define wxSTC_D_WORD2 7 +#define wxSTC_D_WORD3 8 +#define wxSTC_D_TYPEDEF 9 +#define wxSTC_D_STRING 10 +#define wxSTC_D_STRINGEOL 11 +#define wxSTC_D_CHARACTER 12 +#define wxSTC_D_OPERATOR 13 +#define wxSTC_D_IDENTIFIER 14 +#define wxSTC_D_COMMENTLINEDOC 15 +#define wxSTC_D_COMMENTDOCKEYWORD 16 +#define wxSTC_D_COMMENTDOCKEYWORDERROR 17 +#define wxSTC_D_STRINGB 18 +#define wxSTC_D_STRINGR 19 +#define wxSTC_D_WORD5 20 +#define wxSTC_D_WORD6 21 +#define wxSTC_D_WORD7 22 + +/// Lexical states for SCLEX_TCL +#define wxSTC_TCL_DEFAULT 0 +#define wxSTC_TCL_COMMENT 1 +#define wxSTC_TCL_COMMENTLINE 2 +#define wxSTC_TCL_NUMBER 3 +#define wxSTC_TCL_WORD_IN_QUOTE 4 +#define wxSTC_TCL_IN_QUOTE 5 +#define wxSTC_TCL_OPERATOR 6 +#define wxSTC_TCL_IDENTIFIER 7 +#define wxSTC_TCL_SUBSTITUTION 8 +#define wxSTC_TCL_SUB_BRACE 9 +#define wxSTC_TCL_MODIFIER 10 +#define wxSTC_TCL_EXPAND 11 +#define wxSTC_TCL_WORD 12 +#define wxSTC_TCL_WORD2 13 +#define wxSTC_TCL_WORD3 14 +#define wxSTC_TCL_WORD4 15 +#define wxSTC_TCL_WORD5 16 +#define wxSTC_TCL_WORD6 17 +#define wxSTC_TCL_WORD7 18 +#define wxSTC_TCL_WORD8 19 +#define wxSTC_TCL_COMMENT_BOX 20 +#define wxSTC_TCL_BLOCK_COMMENT 21 + +/// Lexical states for SCLEX_HTML, SCLEX_XML +#define wxSTC_H_DEFAULT 0 +#define wxSTC_H_TAG 1 +#define wxSTC_H_TAGUNKNOWN 2 +#define wxSTC_H_ATTRIBUTE 3 +#define wxSTC_H_ATTRIBUTEUNKNOWN 4 +#define wxSTC_H_NUMBER 5 +#define wxSTC_H_DOUBLESTRING 6 +#define wxSTC_H_SINGLESTRING 7 +#define wxSTC_H_OTHER 8 +#define wxSTC_H_COMMENT 9 +#define wxSTC_H_ENTITY 10 + +/// XML and ASP +#define wxSTC_H_TAGEND 11 +#define wxSTC_H_XMLSTART 12 +#define wxSTC_H_XMLEND 13 +#define wxSTC_H_SCRIPT 14 +#define wxSTC_H_ASP 15 +#define wxSTC_H_ASPAT 16 +#define wxSTC_H_CDATA 17 +#define wxSTC_H_QUESTION 18 + +/// More HTML +#define wxSTC_H_VALUE 19 + +/// X-Code +#define wxSTC_H_XCCOMMENT 20 + +/// SGML +#define wxSTC_H_SGML_DEFAULT 21 +#define wxSTC_H_SGML_COMMAND 22 +#define wxSTC_H_SGML_1ST_PARAM 23 +#define wxSTC_H_SGML_DOUBLESTRING 24 +#define wxSTC_H_SGML_SIMPLESTRING 25 +#define wxSTC_H_SGML_ERROR 26 +#define wxSTC_H_SGML_SPECIAL 27 +#define wxSTC_H_SGML_ENTITY 28 +#define wxSTC_H_SGML_COMMENT 29 +#define wxSTC_H_SGML_1ST_PARAM_COMMENT 30 +#define wxSTC_H_SGML_BLOCK_DEFAULT 31 + +/// Embedded Javascript +#define wxSTC_HJ_START 40 +#define wxSTC_HJ_DEFAULT 41 +#define wxSTC_HJ_COMMENT 42 +#define wxSTC_HJ_COMMENTLINE 43 +#define wxSTC_HJ_COMMENTDOC 44 +#define wxSTC_HJ_NUMBER 45 +#define wxSTC_HJ_WORD 46 +#define wxSTC_HJ_KEYWORD 47 +#define wxSTC_HJ_DOUBLESTRING 48 +#define wxSTC_HJ_SINGLESTRING 49 +#define wxSTC_HJ_SYMBOLS 50 +#define wxSTC_HJ_STRINGEOL 51 +#define wxSTC_HJ_REGEX 52 + +/// ASP Javascript +#define wxSTC_HJA_START 55 +#define wxSTC_HJA_DEFAULT 56 +#define wxSTC_HJA_COMMENT 57 +#define wxSTC_HJA_COMMENTLINE 58 +#define wxSTC_HJA_COMMENTDOC 59 +#define wxSTC_HJA_NUMBER 60 +#define wxSTC_HJA_WORD 61 +#define wxSTC_HJA_KEYWORD 62 +#define wxSTC_HJA_DOUBLESTRING 63 +#define wxSTC_HJA_SINGLESTRING 64 +#define wxSTC_HJA_SYMBOLS 65 +#define wxSTC_HJA_STRINGEOL 66 +#define wxSTC_HJA_REGEX 67 + +/// Embedded VBScript +#define wxSTC_HB_START 70 +#define wxSTC_HB_DEFAULT 71 +#define wxSTC_HB_COMMENTLINE 72 +#define wxSTC_HB_NUMBER 73 +#define wxSTC_HB_WORD 74 +#define wxSTC_HB_STRING 75 +#define wxSTC_HB_IDENTIFIER 76 +#define wxSTC_HB_STRINGEOL 77 + +/// ASP VBScript +#define wxSTC_HBA_START 80 +#define wxSTC_HBA_DEFAULT 81 +#define wxSTC_HBA_COMMENTLINE 82 +#define wxSTC_HBA_NUMBER 83 +#define wxSTC_HBA_WORD 84 +#define wxSTC_HBA_STRING 85 +#define wxSTC_HBA_IDENTIFIER 86 +#define wxSTC_HBA_STRINGEOL 87 + +/// Embedded Python +#define wxSTC_HP_START 90 +#define wxSTC_HP_DEFAULT 91 +#define wxSTC_HP_COMMENTLINE 92 +#define wxSTC_HP_NUMBER 93 +#define wxSTC_HP_STRING 94 +#define wxSTC_HP_CHARACTER 95 +#define wxSTC_HP_WORD 96 +#define wxSTC_HP_TRIPLE 97 +#define wxSTC_HP_TRIPLEDOUBLE 98 +#define wxSTC_HP_CLASSNAME 99 +#define wxSTC_HP_DEFNAME 100 +#define wxSTC_HP_OPERATOR 101 +#define wxSTC_HP_IDENTIFIER 102 + +/// PHP +#define wxSTC_HPHP_COMPLEX_VARIABLE 104 + +/// ASP Python +#define wxSTC_HPA_START 105 +#define wxSTC_HPA_DEFAULT 106 +#define wxSTC_HPA_COMMENTLINE 107 +#define wxSTC_HPA_NUMBER 108 +#define wxSTC_HPA_STRING 109 +#define wxSTC_HPA_CHARACTER 110 +#define wxSTC_HPA_WORD 111 +#define wxSTC_HPA_TRIPLE 112 +#define wxSTC_HPA_TRIPLEDOUBLE 113 +#define wxSTC_HPA_CLASSNAME 114 +#define wxSTC_HPA_DEFNAME 115 +#define wxSTC_HPA_OPERATOR 116 +#define wxSTC_HPA_IDENTIFIER 117 + +/// PHP +#define wxSTC_HPHP_DEFAULT 118 +#define wxSTC_HPHP_HSTRING 119 +#define wxSTC_HPHP_SIMPLESTRING 120 +#define wxSTC_HPHP_WORD 121 +#define wxSTC_HPHP_NUMBER 122 +#define wxSTC_HPHP_VARIABLE 123 +#define wxSTC_HPHP_COMMENT 124 +#define wxSTC_HPHP_COMMENTLINE 125 +#define wxSTC_HPHP_HSTRING_VARIABLE 126 +#define wxSTC_HPHP_OPERATOR 127 + +/// Lexical states for SCLEX_PERL +#define wxSTC_PL_DEFAULT 0 +#define wxSTC_PL_ERROR 1 +#define wxSTC_PL_COMMENTLINE 2 +#define wxSTC_PL_POD 3 +#define wxSTC_PL_NUMBER 4 +#define wxSTC_PL_WORD 5 +#define wxSTC_PL_STRING 6 +#define wxSTC_PL_CHARACTER 7 +#define wxSTC_PL_PUNCTUATION 8 +#define wxSTC_PL_PREPROCESSOR 9 +#define wxSTC_PL_OPERATOR 10 +#define wxSTC_PL_IDENTIFIER 11 +#define wxSTC_PL_SCALAR 12 +#define wxSTC_PL_ARRAY 13 +#define wxSTC_PL_HASH 14 +#define wxSTC_PL_SYMBOLTABLE 15 +#define wxSTC_PL_VARIABLE_INDEXER 16 +#define wxSTC_PL_REGEX 17 +#define wxSTC_PL_REGSUBST 18 +#define wxSTC_PL_LONGQUOTE 19 +#define wxSTC_PL_BACKTICKS 20 +#define wxSTC_PL_DATASECTION 21 +#define wxSTC_PL_HERE_DELIM 22 +#define wxSTC_PL_HERE_Q 23 +#define wxSTC_PL_HERE_QQ 24 +#define wxSTC_PL_HERE_QX 25 +#define wxSTC_PL_STRING_Q 26 +#define wxSTC_PL_STRING_QQ 27 +#define wxSTC_PL_STRING_QX 28 +#define wxSTC_PL_STRING_QR 29 +#define wxSTC_PL_STRING_QW 30 +#define wxSTC_PL_POD_VERB 31 +#define wxSTC_PL_SUB_PROTOTYPE 40 +#define wxSTC_PL_FORMAT_IDENT 41 +#define wxSTC_PL_FORMAT 42 +#define wxSTC_PL_STRING_VAR 43 +#define wxSTC_PL_XLAT 44 +#define wxSTC_PL_REGEX_VAR 54 +#define wxSTC_PL_REGSUBST_VAR 55 +#define wxSTC_PL_BACKTICKS_VAR 57 +#define wxSTC_PL_HERE_QQ_VAR 61 +#define wxSTC_PL_HERE_QX_VAR 62 +#define wxSTC_PL_STRING_QQ_VAR 64 +#define wxSTC_PL_STRING_QX_VAR 65 +#define wxSTC_PL_STRING_QR_VAR 66 + +/// Lexical states for SCLEX_RUBY +#define wxSTC_RB_DEFAULT 0 +#define wxSTC_RB_ERROR 1 +#define wxSTC_RB_COMMENTLINE 2 +#define wxSTC_RB_POD 3 +#define wxSTC_RB_NUMBER 4 +#define wxSTC_RB_WORD 5 +#define wxSTC_RB_STRING 6 +#define wxSTC_RB_CHARACTER 7 +#define wxSTC_RB_CLASSNAME 8 +#define wxSTC_RB_DEFNAME 9 +#define wxSTC_RB_OPERATOR 10 +#define wxSTC_RB_IDENTIFIER 11 +#define wxSTC_RB_REGEX 12 +#define wxSTC_RB_GLOBAL 13 +#define wxSTC_RB_SYMBOL 14 +#define wxSTC_RB_MODULE_NAME 15 +#define wxSTC_RB_INSTANCE_VAR 16 +#define wxSTC_RB_CLASS_VAR 17 +#define wxSTC_RB_BACKTICKS 18 +#define wxSTC_RB_DATASECTION 19 +#define wxSTC_RB_HERE_DELIM 20 +#define wxSTC_RB_HERE_Q 21 +#define wxSTC_RB_HERE_QQ 22 +#define wxSTC_RB_HERE_QX 23 +#define wxSTC_RB_STRING_Q 24 +#define wxSTC_RB_STRING_QQ 25 +#define wxSTC_RB_STRING_QX 26 +#define wxSTC_RB_STRING_QR 27 +#define wxSTC_RB_STRING_QW 28 +#define wxSTC_RB_WORD_DEMOTED 29 +#define wxSTC_RB_STDIN 30 +#define wxSTC_RB_STDOUT 31 +#define wxSTC_RB_STDERR 40 +#define wxSTC_RB_UPPER_BOUND 41 + +/// Lexical states for SCLEX_VB, SCLEX_VBSCRIPT, SCLEX_POWERBASIC, SCLEX_BLITZBASIC, SCLEX_PUREBASIC, SCLEX_FREEBASIC +#define wxSTC_B_DEFAULT 0 +#define wxSTC_B_COMMENT 1 +#define wxSTC_B_NUMBER 2 +#define wxSTC_B_KEYWORD 3 +#define wxSTC_B_STRING 4 +#define wxSTC_B_PREPROCESSOR 5 +#define wxSTC_B_OPERATOR 6 +#define wxSTC_B_IDENTIFIER 7 +#define wxSTC_B_DATE 8 +#define wxSTC_B_STRINGEOL 9 +#define wxSTC_B_KEYWORD2 10 +#define wxSTC_B_KEYWORD3 11 +#define wxSTC_B_KEYWORD4 12 +#define wxSTC_B_CONSTANT 13 +#define wxSTC_B_ASM 14 +#define wxSTC_B_LABEL 15 +#define wxSTC_B_ERROR 16 +#define wxSTC_B_HEXNUMBER 17 +#define wxSTC_B_BINNUMBER 18 +#define wxSTC_B_COMMENTBLOCK 19 +#define wxSTC_B_DOCLINE 20 +#define wxSTC_B_DOCBLOCK 21 +#define wxSTC_B_DOCKEYWORD 22 + +/// Lexical states for SCLEX_PROPERTIES +#define wxSTC_PROPS_DEFAULT 0 +#define wxSTC_PROPS_COMMENT 1 +#define wxSTC_PROPS_SECTION 2 +#define wxSTC_PROPS_ASSIGNMENT 3 +#define wxSTC_PROPS_DEFVAL 4 +#define wxSTC_PROPS_KEY 5 + +/// Lexical states for SCLEX_LATEX +#define wxSTC_L_DEFAULT 0 +#define wxSTC_L_COMMAND 1 +#define wxSTC_L_TAG 2 +#define wxSTC_L_MATH 3 +#define wxSTC_L_COMMENT 4 +#define wxSTC_L_TAG2 5 +#define wxSTC_L_MATH2 6 +#define wxSTC_L_COMMENT2 7 +#define wxSTC_L_VERBATIM 8 +#define wxSTC_L_SHORTCMD 9 +#define wxSTC_L_SPECIAL 10 +#define wxSTC_L_CMDOPT 11 +#define wxSTC_L_ERROR 12 + +/// Lexical states for SCLEX_LUA +#define wxSTC_LUA_DEFAULT 0 +#define wxSTC_LUA_COMMENT 1 +#define wxSTC_LUA_COMMENTLINE 2 +#define wxSTC_LUA_COMMENTDOC 3 +#define wxSTC_LUA_NUMBER 4 +#define wxSTC_LUA_WORD 5 +#define wxSTC_LUA_STRING 6 +#define wxSTC_LUA_CHARACTER 7 +#define wxSTC_LUA_LITERALSTRING 8 +#define wxSTC_LUA_PREPROCESSOR 9 +#define wxSTC_LUA_OPERATOR 10 +#define wxSTC_LUA_IDENTIFIER 11 +#define wxSTC_LUA_STRINGEOL 12 +#define wxSTC_LUA_WORD2 13 +#define wxSTC_LUA_WORD3 14 +#define wxSTC_LUA_WORD4 15 +#define wxSTC_LUA_WORD5 16 +#define wxSTC_LUA_WORD6 17 +#define wxSTC_LUA_WORD7 18 +#define wxSTC_LUA_WORD8 19 +#define wxSTC_LUA_LABEL 20 + +/// Lexical states for SCLEX_ERRORLIST +#define wxSTC_ERR_DEFAULT 0 +#define wxSTC_ERR_PYTHON 1 +#define wxSTC_ERR_GCC 2 +#define wxSTC_ERR_MS 3 +#define wxSTC_ERR_CMD 4 +#define wxSTC_ERR_BORLAND 5 +#define wxSTC_ERR_PERL 6 +#define wxSTC_ERR_NET 7 +#define wxSTC_ERR_LUA 8 +#define wxSTC_ERR_CTAG 9 +#define wxSTC_ERR_DIFF_CHANGED 10 +#define wxSTC_ERR_DIFF_ADDITION 11 +#define wxSTC_ERR_DIFF_DELETION 12 +#define wxSTC_ERR_DIFF_MESSAGE 13 +#define wxSTC_ERR_PHP 14 +#define wxSTC_ERR_ELF 15 +#define wxSTC_ERR_IFC 16 +#define wxSTC_ERR_IFORT 17 +#define wxSTC_ERR_ABSF 18 +#define wxSTC_ERR_TIDY 19 +#define wxSTC_ERR_JAVA_STACK 20 +#define wxSTC_ERR_VALUE 21 +#define wxSTC_ERR_GCC_INCLUDED_FROM 22 +#define wxSTC_ERR_ESCSEQ 23 +#define wxSTC_ERR_ESCSEQ_UNKNOWN 24 +#define wxSTC_ERR_ES_BLACK 40 +#define wxSTC_ERR_ES_RED 41 +#define wxSTC_ERR_ES_GREEN 42 +#define wxSTC_ERR_ES_BROWN 43 +#define wxSTC_ERR_ES_BLUE 44 +#define wxSTC_ERR_ES_MAGENTA 45 +#define wxSTC_ERR_ES_CYAN 46 +#define wxSTC_ERR_ES_GRAY 47 +#define wxSTC_ERR_ES_DARK_GRAY 48 +#define wxSTC_ERR_ES_BRIGHT_RED 49 +#define wxSTC_ERR_ES_BRIGHT_GREEN 50 +#define wxSTC_ERR_ES_YELLOW 51 +#define wxSTC_ERR_ES_BRIGHT_BLUE 52 +#define wxSTC_ERR_ES_BRIGHT_MAGENTA 53 +#define wxSTC_ERR_ES_BRIGHT_CYAN 54 +#define wxSTC_ERR_ES_WHITE 55 + +/// Lexical states for SCLEX_BATCH +#define wxSTC_BAT_DEFAULT 0 +#define wxSTC_BAT_COMMENT 1 +#define wxSTC_BAT_WORD 2 +#define wxSTC_BAT_LABEL 3 +#define wxSTC_BAT_HIDE 4 +#define wxSTC_BAT_COMMAND 5 +#define wxSTC_BAT_IDENTIFIER 6 +#define wxSTC_BAT_OPERATOR 7 + +/// Lexical states for SCLEX_TCMD +#define wxSTC_TCMD_DEFAULT 0 +#define wxSTC_TCMD_COMMENT 1 +#define wxSTC_TCMD_WORD 2 +#define wxSTC_TCMD_LABEL 3 +#define wxSTC_TCMD_HIDE 4 +#define wxSTC_TCMD_COMMAND 5 +#define wxSTC_TCMD_IDENTIFIER 6 +#define wxSTC_TCMD_OPERATOR 7 +#define wxSTC_TCMD_ENVIRONMENT 8 +#define wxSTC_TCMD_EXPANSION 9 +#define wxSTC_TCMD_CLABEL 10 + +/// Lexical states for SCLEX_MAKEFILE +#define wxSTC_MAKE_DEFAULT 0 +#define wxSTC_MAKE_COMMENT 1 +#define wxSTC_MAKE_PREPROCESSOR 2 +#define wxSTC_MAKE_IDENTIFIER 3 +#define wxSTC_MAKE_OPERATOR 4 +#define wxSTC_MAKE_TARGET 5 +#define wxSTC_MAKE_IDEOL 9 + +/// Lexical states for SCLEX_DIFF +#define wxSTC_DIFF_DEFAULT 0 +#define wxSTC_DIFF_COMMENT 1 +#define wxSTC_DIFF_COMMAND 2 +#define wxSTC_DIFF_HEADER 3 +#define wxSTC_DIFF_POSITION 4 +#define wxSTC_DIFF_DELETED 5 +#define wxSTC_DIFF_ADDED 6 +#define wxSTC_DIFF_CHANGED 7 + +/// Lexical states for SCLEX_CONF (Apache Configuration Files Lexer) +#define wxSTC_CONF_DEFAULT 0 +#define wxSTC_CONF_COMMENT 1 +#define wxSTC_CONF_NUMBER 2 +#define wxSTC_CONF_IDENTIFIER 3 +#define wxSTC_CONF_EXTENSION 4 +#define wxSTC_CONF_PARAMETER 5 +#define wxSTC_CONF_STRING 6 +#define wxSTC_CONF_OPERATOR 7 +#define wxSTC_CONF_IP 8 +#define wxSTC_CONF_DIRECTIVE 9 + +/// Lexical states for SCLEX_AVE, Avenue +#define wxSTC_AVE_DEFAULT 0 +#define wxSTC_AVE_COMMENT 1 +#define wxSTC_AVE_NUMBER 2 +#define wxSTC_AVE_WORD 3 +#define wxSTC_AVE_STRING 6 +#define wxSTC_AVE_ENUM 7 +#define wxSTC_AVE_STRINGEOL 8 +#define wxSTC_AVE_IDENTIFIER 9 +#define wxSTC_AVE_OPERATOR 10 +#define wxSTC_AVE_WORD1 11 +#define wxSTC_AVE_WORD2 12 +#define wxSTC_AVE_WORD3 13 +#define wxSTC_AVE_WORD4 14 +#define wxSTC_AVE_WORD5 15 +#define wxSTC_AVE_WORD6 16 + +/// Lexical states for SCLEX_ADA +#define wxSTC_ADA_DEFAULT 0 +#define wxSTC_ADA_WORD 1 +#define wxSTC_ADA_IDENTIFIER 2 +#define wxSTC_ADA_NUMBER 3 +#define wxSTC_ADA_DELIMITER 4 +#define wxSTC_ADA_CHARACTER 5 +#define wxSTC_ADA_CHARACTEREOL 6 +#define wxSTC_ADA_STRING 7 +#define wxSTC_ADA_STRINGEOL 8 +#define wxSTC_ADA_LABEL 9 +#define wxSTC_ADA_COMMENTLINE 10 +#define wxSTC_ADA_ILLEGAL 11 + +/// Lexical states for SCLEX_BAAN +#define wxSTC_BAAN_DEFAULT 0 +#define wxSTC_BAAN_COMMENT 1 +#define wxSTC_BAAN_COMMENTDOC 2 +#define wxSTC_BAAN_NUMBER 3 +#define wxSTC_BAAN_WORD 4 +#define wxSTC_BAAN_STRING 5 +#define wxSTC_BAAN_PREPROCESSOR 6 +#define wxSTC_BAAN_OPERATOR 7 +#define wxSTC_BAAN_IDENTIFIER 8 +#define wxSTC_BAAN_STRINGEOL 9 +#define wxSTC_BAAN_WORD2 10 +#define wxSTC_BAAN_WORD3 11 +#define wxSTC_BAAN_WORD4 12 +#define wxSTC_BAAN_WORD5 13 +#define wxSTC_BAAN_WORD6 14 +#define wxSTC_BAAN_WORD7 15 +#define wxSTC_BAAN_WORD8 16 +#define wxSTC_BAAN_WORD9 17 +#define wxSTC_BAAN_TABLEDEF 18 +#define wxSTC_BAAN_TABLESQL 19 +#define wxSTC_BAAN_FUNCTION 20 +#define wxSTC_BAAN_DOMDEF 21 +#define wxSTC_BAAN_FUNCDEF 22 +#define wxSTC_BAAN_OBJECTDEF 23 +#define wxSTC_BAAN_DEFINEDEF 24 + +/// Lexical states for SCLEX_LISP +#define wxSTC_LISP_DEFAULT 0 +#define wxSTC_LISP_COMMENT 1 +#define wxSTC_LISP_NUMBER 2 +#define wxSTC_LISP_KEYWORD 3 +#define wxSTC_LISP_KEYWORD_KW 4 +#define wxSTC_LISP_SYMBOL 5 +#define wxSTC_LISP_STRING 6 +#define wxSTC_LISP_STRINGEOL 8 +#define wxSTC_LISP_IDENTIFIER 9 +#define wxSTC_LISP_OPERATOR 10 +#define wxSTC_LISP_SPECIAL 11 +#define wxSTC_LISP_MULTI_COMMENT 12 + +/// Lexical states for SCLEX_EIFFEL and SCLEX_EIFFELKW +#define wxSTC_EIFFEL_DEFAULT 0 +#define wxSTC_EIFFEL_COMMENTLINE 1 +#define wxSTC_EIFFEL_NUMBER 2 +#define wxSTC_EIFFEL_WORD 3 +#define wxSTC_EIFFEL_STRING 4 +#define wxSTC_EIFFEL_CHARACTER 5 +#define wxSTC_EIFFEL_OPERATOR 6 +#define wxSTC_EIFFEL_IDENTIFIER 7 +#define wxSTC_EIFFEL_STRINGEOL 8 + +/// Lexical states for SCLEX_NNCRONTAB (nnCron crontab Lexer) +#define wxSTC_NNCRONTAB_DEFAULT 0 +#define wxSTC_NNCRONTAB_COMMENT 1 +#define wxSTC_NNCRONTAB_TASK 2 +#define wxSTC_NNCRONTAB_SECTION 3 +#define wxSTC_NNCRONTAB_KEYWORD 4 +#define wxSTC_NNCRONTAB_MODIFIER 5 +#define wxSTC_NNCRONTAB_ASTERISK 6 +#define wxSTC_NNCRONTAB_NUMBER 7 +#define wxSTC_NNCRONTAB_STRING 8 +#define wxSTC_NNCRONTAB_ENVIRONMENT 9 +#define wxSTC_NNCRONTAB_IDENTIFIER 10 + +/// Lexical states for SCLEX_FORTH (Forth Lexer) +#define wxSTC_FORTH_DEFAULT 0 +#define wxSTC_FORTH_COMMENT 1 +#define wxSTC_FORTH_COMMENT_ML 2 +#define wxSTC_FORTH_IDENTIFIER 3 +#define wxSTC_FORTH_CONTROL 4 +#define wxSTC_FORTH_KEYWORD 5 +#define wxSTC_FORTH_DEFWORD 6 +#define wxSTC_FORTH_PREWORD1 7 +#define wxSTC_FORTH_PREWORD2 8 +#define wxSTC_FORTH_NUMBER 9 +#define wxSTC_FORTH_STRING 10 +#define wxSTC_FORTH_LOCALE 11 + +/// Lexical states for SCLEX_MATLAB +#define wxSTC_MATLAB_DEFAULT 0 +#define wxSTC_MATLAB_COMMENT 1 +#define wxSTC_MATLAB_COMMAND 2 +#define wxSTC_MATLAB_NUMBER 3 +#define wxSTC_MATLAB_KEYWORD 4 + +/// single quoted string +#define wxSTC_MATLAB_STRING 5 +#define wxSTC_MATLAB_OPERATOR 6 +#define wxSTC_MATLAB_IDENTIFIER 7 +#define wxSTC_MATLAB_DOUBLEQUOTESTRING 8 + +/// Lexical states for SCLEX_SCRIPTOL +#define wxSTC_SCRIPTOL_DEFAULT 0 +#define wxSTC_SCRIPTOL_WHITE 1 +#define wxSTC_SCRIPTOL_COMMENTLINE 2 +#define wxSTC_SCRIPTOL_PERSISTENT 3 +#define wxSTC_SCRIPTOL_CSTYLE 4 +#define wxSTC_SCRIPTOL_COMMENTBLOCK 5 +#define wxSTC_SCRIPTOL_NUMBER 6 +#define wxSTC_SCRIPTOL_STRING 7 +#define wxSTC_SCRIPTOL_CHARACTER 8 +#define wxSTC_SCRIPTOL_STRINGEOL 9 +#define wxSTC_SCRIPTOL_KEYWORD 10 +#define wxSTC_SCRIPTOL_OPERATOR 11 +#define wxSTC_SCRIPTOL_IDENTIFIER 12 +#define wxSTC_SCRIPTOL_TRIPLE 13 +#define wxSTC_SCRIPTOL_CLASSNAME 14 +#define wxSTC_SCRIPTOL_PREPROCESSOR 15 + +/// Lexical states for SCLEX_ASM, SCLEX_AS +#define wxSTC_ASM_DEFAULT 0 +#define wxSTC_ASM_COMMENT 1 +#define wxSTC_ASM_NUMBER 2 +#define wxSTC_ASM_STRING 3 +#define wxSTC_ASM_OPERATOR 4 +#define wxSTC_ASM_IDENTIFIER 5 +#define wxSTC_ASM_CPUINSTRUCTION 6 +#define wxSTC_ASM_MATHINSTRUCTION 7 +#define wxSTC_ASM_REGISTER 8 +#define wxSTC_ASM_DIRECTIVE 9 +#define wxSTC_ASM_DIRECTIVEOPERAND 10 +#define wxSTC_ASM_COMMENTBLOCK 11 +#define wxSTC_ASM_CHARACTER 12 +#define wxSTC_ASM_STRINGEOL 13 +#define wxSTC_ASM_EXTINSTRUCTION 14 +#define wxSTC_ASM_COMMENTDIRECTIVE 15 + +/// Lexical states for SCLEX_FORTRAN +#define wxSTC_F_DEFAULT 0 +#define wxSTC_F_COMMENT 1 +#define wxSTC_F_NUMBER 2 +#define wxSTC_F_STRING1 3 +#define wxSTC_F_STRING2 4 +#define wxSTC_F_STRINGEOL 5 +#define wxSTC_F_OPERATOR 6 +#define wxSTC_F_IDENTIFIER 7 +#define wxSTC_F_WORD 8 +#define wxSTC_F_WORD2 9 +#define wxSTC_F_WORD3 10 +#define wxSTC_F_PREPROCESSOR 11 +#define wxSTC_F_OPERATOR2 12 +#define wxSTC_F_LABEL 13 +#define wxSTC_F_CONTINUATION 14 + +/// Lexical states for SCLEX_CSS +#define wxSTC_CSS_DEFAULT 0 +#define wxSTC_CSS_TAG 1 +#define wxSTC_CSS_CLASS 2 +#define wxSTC_CSS_PSEUDOCLASS 3 +#define wxSTC_CSS_UNKNOWN_PSEUDOCLASS 4 +#define wxSTC_CSS_OPERATOR 5 +#define wxSTC_CSS_IDENTIFIER 6 +#define wxSTC_CSS_UNKNOWN_IDENTIFIER 7 +#define wxSTC_CSS_VALUE 8 +#define wxSTC_CSS_COMMENT 9 +#define wxSTC_CSS_ID 10 +#define wxSTC_CSS_IMPORTANT 11 +#define wxSTC_CSS_DIRECTIVE 12 +#define wxSTC_CSS_DOUBLESTRING 13 +#define wxSTC_CSS_SINGLESTRING 14 +#define wxSTC_CSS_IDENTIFIER2 15 +#define wxSTC_CSS_ATTRIBUTE 16 +#define wxSTC_CSS_IDENTIFIER3 17 +#define wxSTC_CSS_PSEUDOELEMENT 18 +#define wxSTC_CSS_EXTENDED_IDENTIFIER 19 +#define wxSTC_CSS_EXTENDED_PSEUDOCLASS 20 +#define wxSTC_CSS_EXTENDED_PSEUDOELEMENT 21 +#define wxSTC_CSS_MEDIA 22 +#define wxSTC_CSS_VARIABLE 23 + +/// Lexical states for SCLEX_POV +#define wxSTC_POV_DEFAULT 0 +#define wxSTC_POV_COMMENT 1 +#define wxSTC_POV_COMMENTLINE 2 +#define wxSTC_POV_NUMBER 3 +#define wxSTC_POV_OPERATOR 4 +#define wxSTC_POV_IDENTIFIER 5 +#define wxSTC_POV_STRING 6 +#define wxSTC_POV_STRINGEOL 7 +#define wxSTC_POV_DIRECTIVE 8 +#define wxSTC_POV_BADDIRECTIVE 9 +#define wxSTC_POV_WORD2 10 +#define wxSTC_POV_WORD3 11 +#define wxSTC_POV_WORD4 12 +#define wxSTC_POV_WORD5 13 +#define wxSTC_POV_WORD6 14 +#define wxSTC_POV_WORD7 15 +#define wxSTC_POV_WORD8 16 + +/// Lexical states for SCLEX_LOUT +#define wxSTC_LOUT_DEFAULT 0 +#define wxSTC_LOUT_COMMENT 1 +#define wxSTC_LOUT_NUMBER 2 +#define wxSTC_LOUT_WORD 3 +#define wxSTC_LOUT_WORD2 4 +#define wxSTC_LOUT_WORD3 5 +#define wxSTC_LOUT_WORD4 6 +#define wxSTC_LOUT_STRING 7 +#define wxSTC_LOUT_OPERATOR 8 +#define wxSTC_LOUT_IDENTIFIER 9 +#define wxSTC_LOUT_STRINGEOL 10 + +/// Lexical states for SCLEX_ESCRIPT +#define wxSTC_ESCRIPT_DEFAULT 0 +#define wxSTC_ESCRIPT_COMMENT 1 +#define wxSTC_ESCRIPT_COMMENTLINE 2 +#define wxSTC_ESCRIPT_COMMENTDOC 3 +#define wxSTC_ESCRIPT_NUMBER 4 +#define wxSTC_ESCRIPT_WORD 5 +#define wxSTC_ESCRIPT_STRING 6 +#define wxSTC_ESCRIPT_OPERATOR 7 +#define wxSTC_ESCRIPT_IDENTIFIER 8 +#define wxSTC_ESCRIPT_BRACE 9 +#define wxSTC_ESCRIPT_WORD2 10 +#define wxSTC_ESCRIPT_WORD3 11 + +/// Lexical states for SCLEX_PS +#define wxSTC_PS_DEFAULT 0 +#define wxSTC_PS_COMMENT 1 +#define wxSTC_PS_DSC_COMMENT 2 +#define wxSTC_PS_DSC_VALUE 3 +#define wxSTC_PS_NUMBER 4 +#define wxSTC_PS_NAME 5 +#define wxSTC_PS_KEYWORD 6 +#define wxSTC_PS_LITERAL 7 +#define wxSTC_PS_IMMEVAL 8 +#define wxSTC_PS_PAREN_ARRAY 9 +#define wxSTC_PS_PAREN_DICT 10 +#define wxSTC_PS_PAREN_PROC 11 +#define wxSTC_PS_TEXT 12 +#define wxSTC_PS_HEXSTRING 13 +#define wxSTC_PS_BASE85STRING 14 +#define wxSTC_PS_BADSTRINGCHAR 15 + +/// Lexical states for SCLEX_NSIS +#define wxSTC_NSIS_DEFAULT 0 +#define wxSTC_NSIS_COMMENT 1 +#define wxSTC_NSIS_STRINGDQ 2 +#define wxSTC_NSIS_STRINGLQ 3 +#define wxSTC_NSIS_STRINGRQ 4 +#define wxSTC_NSIS_FUNCTION 5 +#define wxSTC_NSIS_VARIABLE 6 +#define wxSTC_NSIS_LABEL 7 +#define wxSTC_NSIS_USERDEFINED 8 +#define wxSTC_NSIS_SECTIONDEF 9 +#define wxSTC_NSIS_SUBSECTIONDEF 10 +#define wxSTC_NSIS_IFDEFINEDEF 11 +#define wxSTC_NSIS_MACRODEF 12 +#define wxSTC_NSIS_STRINGVAR 13 +#define wxSTC_NSIS_NUMBER 14 +#define wxSTC_NSIS_SECTIONGROUP 15 +#define wxSTC_NSIS_PAGEEX 16 +#define wxSTC_NSIS_FUNCTIONDEF 17 +#define wxSTC_NSIS_COMMENTBOX 18 + +/// Lexical states for SCLEX_MMIXAL +#define wxSTC_MMIXAL_LEADWS 0 +#define wxSTC_MMIXAL_COMMENT 1 +#define wxSTC_MMIXAL_LABEL 2 +#define wxSTC_MMIXAL_OPCODE 3 +#define wxSTC_MMIXAL_OPCODE_PRE 4 +#define wxSTC_MMIXAL_OPCODE_VALID 5 +#define wxSTC_MMIXAL_OPCODE_UNKNOWN 6 +#define wxSTC_MMIXAL_OPCODE_POST 7 +#define wxSTC_MMIXAL_OPERANDS 8 +#define wxSTC_MMIXAL_NUMBER 9 +#define wxSTC_MMIXAL_REF 10 +#define wxSTC_MMIXAL_CHAR 11 +#define wxSTC_MMIXAL_STRING 12 +#define wxSTC_MMIXAL_REGISTER 13 +#define wxSTC_MMIXAL_HEX 14 +#define wxSTC_MMIXAL_OPERATOR 15 +#define wxSTC_MMIXAL_SYMBOL 16 +#define wxSTC_MMIXAL_INCLUDE 17 + +/// Lexical states for SCLEX_CLW +#define wxSTC_CLW_DEFAULT 0 +#define wxSTC_CLW_LABEL 1 +#define wxSTC_CLW_COMMENT 2 +#define wxSTC_CLW_STRING 3 +#define wxSTC_CLW_USER_IDENTIFIER 4 +#define wxSTC_CLW_INTEGER_CONSTANT 5 +#define wxSTC_CLW_REAL_CONSTANT 6 +#define wxSTC_CLW_PICTURE_STRING 7 +#define wxSTC_CLW_KEYWORD 8 +#define wxSTC_CLW_COMPILER_DIRECTIVE 9 +#define wxSTC_CLW_RUNTIME_EXPRESSIONS 10 +#define wxSTC_CLW_BUILTIN_PROCEDURES_FUNCTION 11 +#define wxSTC_CLW_STRUCTURE_DATA_TYPE 12 +#define wxSTC_CLW_ATTRIBUTE 13 +#define wxSTC_CLW_STANDARD_EQUATE 14 +#define wxSTC_CLW_ERROR 15 +#define wxSTC_CLW_DEPRECATED 16 + +/// Lexical states for SCLEX_LOT +#define wxSTC_LOT_DEFAULT 0 +#define wxSTC_LOT_HEADER 1 +#define wxSTC_LOT_BREAK 2 +#define wxSTC_LOT_SET 3 +#define wxSTC_LOT_PASS 4 +#define wxSTC_LOT_FAIL 5 +#define wxSTC_LOT_ABORT 6 + +/// Lexical states for SCLEX_YAML +#define wxSTC_YAML_DEFAULT 0 +#define wxSTC_YAML_COMMENT 1 +#define wxSTC_YAML_IDENTIFIER 2 +#define wxSTC_YAML_KEYWORD 3 +#define wxSTC_YAML_NUMBER 4 +#define wxSTC_YAML_REFERENCE 5 +#define wxSTC_YAML_DOCUMENT 6 +#define wxSTC_YAML_TEXT 7 +#define wxSTC_YAML_ERROR 8 +#define wxSTC_YAML_OPERATOR 9 + +/// Lexical states for SCLEX_TEX +#define wxSTC_TEX_DEFAULT 0 +#define wxSTC_TEX_SPECIAL 1 +#define wxSTC_TEX_GROUP 2 +#define wxSTC_TEX_SYMBOL 3 +#define wxSTC_TEX_COMMAND 4 +#define wxSTC_TEX_TEXT 5 +#define wxSTC_METAPOST_DEFAULT 0 +#define wxSTC_METAPOST_SPECIAL 1 +#define wxSTC_METAPOST_GROUP 2 +#define wxSTC_METAPOST_SYMBOL 3 +#define wxSTC_METAPOST_COMMAND 4 +#define wxSTC_METAPOST_TEXT 5 +#define wxSTC_METAPOST_EXTRA 6 + +/// Lexical states for SCLEX_ERLANG +#define wxSTC_ERLANG_DEFAULT 0 +#define wxSTC_ERLANG_COMMENT 1 +#define wxSTC_ERLANG_VARIABLE 2 +#define wxSTC_ERLANG_NUMBER 3 +#define wxSTC_ERLANG_KEYWORD 4 +#define wxSTC_ERLANG_STRING 5 +#define wxSTC_ERLANG_OPERATOR 6 +#define wxSTC_ERLANG_ATOM 7 +#define wxSTC_ERLANG_FUNCTION_NAME 8 +#define wxSTC_ERLANG_CHARACTER 9 +#define wxSTC_ERLANG_MACRO 10 +#define wxSTC_ERLANG_RECORD 11 +#define wxSTC_ERLANG_PREPROC 12 +#define wxSTC_ERLANG_NODE_NAME 13 +#define wxSTC_ERLANG_COMMENT_FUNCTION 14 +#define wxSTC_ERLANG_COMMENT_MODULE 15 +#define wxSTC_ERLANG_COMMENT_DOC 16 +#define wxSTC_ERLANG_COMMENT_DOC_MACRO 17 +#define wxSTC_ERLANG_ATOM_QUOTED 18 +#define wxSTC_ERLANG_MACRO_QUOTED 19 +#define wxSTC_ERLANG_RECORD_QUOTED 20 +#define wxSTC_ERLANG_NODE_NAME_QUOTED 21 +#define wxSTC_ERLANG_BIFS 22 +#define wxSTC_ERLANG_MODULES 23 +#define wxSTC_ERLANG_MODULES_ATT 24 +#define wxSTC_ERLANG_UNKNOWN 31 + +/// Lexical states for SCLEX_OCTAVE are identical to MatLab +/// Lexical states for SCLEX_MSSQL +#define wxSTC_MSSQL_DEFAULT 0 +#define wxSTC_MSSQL_COMMENT 1 +#define wxSTC_MSSQL_LINE_COMMENT 2 +#define wxSTC_MSSQL_NUMBER 3 +#define wxSTC_MSSQL_STRING 4 +#define wxSTC_MSSQL_OPERATOR 5 +#define wxSTC_MSSQL_IDENTIFIER 6 +#define wxSTC_MSSQL_VARIABLE 7 +#define wxSTC_MSSQL_COLUMN_NAME 8 +#define wxSTC_MSSQL_STATEMENT 9 +#define wxSTC_MSSQL_DATATYPE 10 +#define wxSTC_MSSQL_SYSTABLE 11 +#define wxSTC_MSSQL_GLOBAL_VARIABLE 12 +#define wxSTC_MSSQL_FUNCTION 13 +#define wxSTC_MSSQL_STORED_PROCEDURE 14 +#define wxSTC_MSSQL_DEFAULT_PREF_DATATYPE 15 +#define wxSTC_MSSQL_COLUMN_NAME_2 16 + +/// Lexical states for SCLEX_VERILOG +#define wxSTC_V_DEFAULT 0 +#define wxSTC_V_COMMENT 1 +#define wxSTC_V_COMMENTLINE 2 +#define wxSTC_V_COMMENTLINEBANG 3 +#define wxSTC_V_NUMBER 4 +#define wxSTC_V_WORD 5 +#define wxSTC_V_STRING 6 +#define wxSTC_V_WORD2 7 +#define wxSTC_V_WORD3 8 +#define wxSTC_V_PREPROCESSOR 9 +#define wxSTC_V_OPERATOR 10 +#define wxSTC_V_IDENTIFIER 11 +#define wxSTC_V_STRINGEOL 12 +#define wxSTC_V_USER 19 +#define wxSTC_V_COMMENT_WORD 20 +#define wxSTC_V_INPUT 21 +#define wxSTC_V_OUTPUT 22 +#define wxSTC_V_INOUT 23 +#define wxSTC_V_PORT_CONNECT 24 + +/// Lexical states for SCLEX_KIX +#define wxSTC_KIX_DEFAULT 0 +#define wxSTC_KIX_COMMENT 1 +#define wxSTC_KIX_STRING1 2 +#define wxSTC_KIX_STRING2 3 +#define wxSTC_KIX_NUMBER 4 +#define wxSTC_KIX_VAR 5 +#define wxSTC_KIX_MACRO 6 +#define wxSTC_KIX_KEYWORD 7 +#define wxSTC_KIX_FUNCTIONS 8 +#define wxSTC_KIX_OPERATOR 9 +#define wxSTC_KIX_COMMENTSTREAM 10 +#define wxSTC_KIX_IDENTIFIER 31 + +/// Lexical states for SCLEX_GUI4CLI +#define wxSTC_GC_DEFAULT 0 +#define wxSTC_GC_COMMENTLINE 1 +#define wxSTC_GC_COMMENTBLOCK 2 +#define wxSTC_GC_GLOBAL 3 +#define wxSTC_GC_EVENT 4 +#define wxSTC_GC_ATTRIBUTE 5 +#define wxSTC_GC_CONTROL 6 +#define wxSTC_GC_COMMAND 7 +#define wxSTC_GC_STRING 8 +#define wxSTC_GC_OPERATOR 9 + +/// Lexical states for SCLEX_SPECMAN +#define wxSTC_SN_DEFAULT 0 +#define wxSTC_SN_CODE 1 +#define wxSTC_SN_COMMENTLINE 2 +#define wxSTC_SN_COMMENTLINEBANG 3 +#define wxSTC_SN_NUMBER 4 +#define wxSTC_SN_WORD 5 +#define wxSTC_SN_STRING 6 +#define wxSTC_SN_WORD2 7 +#define wxSTC_SN_WORD3 8 +#define wxSTC_SN_PREPROCESSOR 9 +#define wxSTC_SN_OPERATOR 10 +#define wxSTC_SN_IDENTIFIER 11 +#define wxSTC_SN_STRINGEOL 12 +#define wxSTC_SN_REGEXTAG 13 +#define wxSTC_SN_SIGNAL 14 +#define wxSTC_SN_USER 19 + +/// Lexical states for SCLEX_AU3 +#define wxSTC_AU3_DEFAULT 0 +#define wxSTC_AU3_COMMENT 1 +#define wxSTC_AU3_COMMENTBLOCK 2 +#define wxSTC_AU3_NUMBER 3 +#define wxSTC_AU3_FUNCTION 4 +#define wxSTC_AU3_KEYWORD 5 +#define wxSTC_AU3_MACRO 6 +#define wxSTC_AU3_STRING 7 +#define wxSTC_AU3_OPERATOR 8 +#define wxSTC_AU3_VARIABLE 9 +#define wxSTC_AU3_SENT 10 +#define wxSTC_AU3_PREPROCESSOR 11 +#define wxSTC_AU3_SPECIAL 12 +#define wxSTC_AU3_EXPAND 13 +#define wxSTC_AU3_COMOBJ 14 +#define wxSTC_AU3_UDF 15 + +/// Lexical states for SCLEX_APDL +#define wxSTC_APDL_DEFAULT 0 +#define wxSTC_APDL_COMMENT 1 +#define wxSTC_APDL_COMMENTBLOCK 2 +#define wxSTC_APDL_NUMBER 3 +#define wxSTC_APDL_STRING 4 +#define wxSTC_APDL_OPERATOR 5 +#define wxSTC_APDL_WORD 6 +#define wxSTC_APDL_PROCESSOR 7 +#define wxSTC_APDL_COMMAND 8 +#define wxSTC_APDL_SLASHCOMMAND 9 +#define wxSTC_APDL_STARCOMMAND 10 +#define wxSTC_APDL_ARGUMENT 11 +#define wxSTC_APDL_FUNCTION 12 + +/// Lexical states for SCLEX_BASH +#define wxSTC_SH_DEFAULT 0 +#define wxSTC_SH_ERROR 1 +#define wxSTC_SH_COMMENTLINE 2 +#define wxSTC_SH_NUMBER 3 +#define wxSTC_SH_WORD 4 +#define wxSTC_SH_STRING 5 +#define wxSTC_SH_CHARACTER 6 +#define wxSTC_SH_OPERATOR 7 +#define wxSTC_SH_IDENTIFIER 8 +#define wxSTC_SH_SCALAR 9 +#define wxSTC_SH_PARAM 10 +#define wxSTC_SH_BACKTICKS 11 +#define wxSTC_SH_HERE_DELIM 12 +#define wxSTC_SH_HERE_Q 13 + +/// Lexical states for SCLEX_ASN1 +#define wxSTC_ASN1_DEFAULT 0 +#define wxSTC_ASN1_COMMENT 1 +#define wxSTC_ASN1_IDENTIFIER 2 +#define wxSTC_ASN1_STRING 3 +#define wxSTC_ASN1_OID 4 +#define wxSTC_ASN1_SCALAR 5 +#define wxSTC_ASN1_KEYWORD 6 +#define wxSTC_ASN1_ATTRIBUTE 7 +#define wxSTC_ASN1_DESCRIPTOR 8 +#define wxSTC_ASN1_TYPE 9 +#define wxSTC_ASN1_OPERATOR 10 + +/// Lexical states for SCLEX_VHDL +#define wxSTC_VHDL_DEFAULT 0 +#define wxSTC_VHDL_COMMENT 1 +#define wxSTC_VHDL_COMMENTLINEBANG 2 +#define wxSTC_VHDL_NUMBER 3 +#define wxSTC_VHDL_STRING 4 +#define wxSTC_VHDL_OPERATOR 5 +#define wxSTC_VHDL_IDENTIFIER 6 +#define wxSTC_VHDL_STRINGEOL 7 +#define wxSTC_VHDL_KEYWORD 8 +#define wxSTC_VHDL_STDOPERATOR 9 +#define wxSTC_VHDL_ATTRIBUTE 10 +#define wxSTC_VHDL_STDFUNCTION 11 +#define wxSTC_VHDL_STDPACKAGE 12 +#define wxSTC_VHDL_STDTYPE 13 +#define wxSTC_VHDL_USERWORD 14 +#define wxSTC_VHDL_BLOCK_COMMENT 15 + +/// Lexical states for SCLEX_CAML +#define wxSTC_CAML_DEFAULT 0 +#define wxSTC_CAML_IDENTIFIER 1 +#define wxSTC_CAML_TAGNAME 2 +#define wxSTC_CAML_KEYWORD 3 +#define wxSTC_CAML_KEYWORD2 4 +#define wxSTC_CAML_KEYWORD3 5 +#define wxSTC_CAML_LINENUM 6 +#define wxSTC_CAML_OPERATOR 7 +#define wxSTC_CAML_NUMBER 8 +#define wxSTC_CAML_CHAR 9 +#define wxSTC_CAML_WHITE 10 +#define wxSTC_CAML_STRING 11 +#define wxSTC_CAML_COMMENT 12 +#define wxSTC_CAML_COMMENT1 13 +#define wxSTC_CAML_COMMENT2 14 +#define wxSTC_CAML_COMMENT3 15 + +/// Lexical states for SCLEX_HASKELL +#define wxSTC_HA_DEFAULT 0 +#define wxSTC_HA_IDENTIFIER 1 +#define wxSTC_HA_KEYWORD 2 +#define wxSTC_HA_NUMBER 3 +#define wxSTC_HA_STRING 4 +#define wxSTC_HA_CHARACTER 5 +#define wxSTC_HA_CLASS 6 +#define wxSTC_HA_MODULE 7 +#define wxSTC_HA_CAPITAL 8 +#define wxSTC_HA_DATA 9 +#define wxSTC_HA_IMPORT 10 +#define wxSTC_HA_OPERATOR 11 +#define wxSTC_HA_INSTANCE 12 +#define wxSTC_HA_COMMENTLINE 13 +#define wxSTC_HA_COMMENTBLOCK 14 +#define wxSTC_HA_COMMENTBLOCK2 15 +#define wxSTC_HA_COMMENTBLOCK3 16 +#define wxSTC_HA_PRAGMA 17 +#define wxSTC_HA_PREPROCESSOR 18 +#define wxSTC_HA_STRINGEOL 19 +#define wxSTC_HA_RESERVED_OPERATOR 20 +#define wxSTC_HA_LITERATE_COMMENT 21 +#define wxSTC_HA_LITERATE_CODEDELIM 22 + +/// Lexical states of SCLEX_TADS3 +#define wxSTC_T3_DEFAULT 0 +#define wxSTC_T3_X_DEFAULT 1 +#define wxSTC_T3_PREPROCESSOR 2 +#define wxSTC_T3_BLOCK_COMMENT 3 +#define wxSTC_T3_LINE_COMMENT 4 +#define wxSTC_T3_OPERATOR 5 +#define wxSTC_T3_KEYWORD 6 +#define wxSTC_T3_NUMBER 7 +#define wxSTC_T3_IDENTIFIER 8 +#define wxSTC_T3_S_STRING 9 +#define wxSTC_T3_D_STRING 10 +#define wxSTC_T3_X_STRING 11 +#define wxSTC_T3_LIB_DIRECTIVE 12 +#define wxSTC_T3_MSG_PARAM 13 +#define wxSTC_T3_HTML_TAG 14 +#define wxSTC_T3_HTML_DEFAULT 15 +#define wxSTC_T3_HTML_STRING 16 +#define wxSTC_T3_USER1 17 +#define wxSTC_T3_USER2 18 +#define wxSTC_T3_USER3 19 +#define wxSTC_T3_BRACE 20 + +/// Lexical states for SCLEX_REBOL +#define wxSTC_REBOL_DEFAULT 0 +#define wxSTC_REBOL_COMMENTLINE 1 +#define wxSTC_REBOL_COMMENTBLOCK 2 +#define wxSTC_REBOL_PREFACE 3 +#define wxSTC_REBOL_OPERATOR 4 +#define wxSTC_REBOL_CHARACTER 5 +#define wxSTC_REBOL_QUOTEDSTRING 6 +#define wxSTC_REBOL_BRACEDSTRING 7 +#define wxSTC_REBOL_NUMBER 8 +#define wxSTC_REBOL_PAIR 9 +#define wxSTC_REBOL_TUPLE 10 +#define wxSTC_REBOL_BINARY 11 +#define wxSTC_REBOL_MONEY 12 +#define wxSTC_REBOL_ISSUE 13 +#define wxSTC_REBOL_TAG 14 +#define wxSTC_REBOL_FILE 15 +#define wxSTC_REBOL_EMAIL 16 +#define wxSTC_REBOL_URL 17 +#define wxSTC_REBOL_DATE 18 +#define wxSTC_REBOL_TIME 19 +#define wxSTC_REBOL_IDENTIFIER 20 +#define wxSTC_REBOL_WORD 21 +#define wxSTC_REBOL_WORD2 22 +#define wxSTC_REBOL_WORD3 23 +#define wxSTC_REBOL_WORD4 24 +#define wxSTC_REBOL_WORD5 25 +#define wxSTC_REBOL_WORD6 26 +#define wxSTC_REBOL_WORD7 27 +#define wxSTC_REBOL_WORD8 28 + +/// Lexical states for SCLEX_SQL +#define wxSTC_SQL_DEFAULT 0 +#define wxSTC_SQL_COMMENT 1 +#define wxSTC_SQL_COMMENTLINE 2 +#define wxSTC_SQL_COMMENTDOC 3 +#define wxSTC_SQL_NUMBER 4 +#define wxSTC_SQL_WORD 5 +#define wxSTC_SQL_STRING 6 +#define wxSTC_SQL_CHARACTER 7 +#define wxSTC_SQL_SQLPLUS 8 +#define wxSTC_SQL_SQLPLUS_PROMPT 9 +#define wxSTC_SQL_OPERATOR 10 +#define wxSTC_SQL_IDENTIFIER 11 +#define wxSTC_SQL_SQLPLUS_COMMENT 13 +#define wxSTC_SQL_COMMENTLINEDOC 15 +#define wxSTC_SQL_WORD2 16 +#define wxSTC_SQL_COMMENTDOCKEYWORD 17 +#define wxSTC_SQL_COMMENTDOCKEYWORDERROR 18 +#define wxSTC_SQL_USER1 19 +#define wxSTC_SQL_USER2 20 +#define wxSTC_SQL_USER3 21 +#define wxSTC_SQL_USER4 22 +#define wxSTC_SQL_QUOTEDIDENTIFIER 23 +#define wxSTC_SQL_QOPERATOR 24 + +/// Lexical states for SCLEX_SMALLTALK +#define wxSTC_ST_DEFAULT 0 +#define wxSTC_ST_STRING 1 +#define wxSTC_ST_NUMBER 2 +#define wxSTC_ST_COMMENT 3 +#define wxSTC_ST_SYMBOL 4 +#define wxSTC_ST_BINARY 5 +#define wxSTC_ST_BOOL 6 +#define wxSTC_ST_SELF 7 +#define wxSTC_ST_SUPER 8 +#define wxSTC_ST_NIL 9 +#define wxSTC_ST_GLOBAL 10 +#define wxSTC_ST_RETURN 11 +#define wxSTC_ST_SPECIAL 12 +#define wxSTC_ST_KWSEND 13 +#define wxSTC_ST_ASSIGN 14 +#define wxSTC_ST_CHARACTER 15 +#define wxSTC_ST_SPEC_SEL 16 + +/// Lexical states for SCLEX_FLAGSHIP (clipper) +#define wxSTC_FS_DEFAULT 0 +#define wxSTC_FS_COMMENT 1 +#define wxSTC_FS_COMMENTLINE 2 +#define wxSTC_FS_COMMENTDOC 3 +#define wxSTC_FS_COMMENTLINEDOC 4 +#define wxSTC_FS_COMMENTDOCKEYWORD 5 +#define wxSTC_FS_COMMENTDOCKEYWORDERROR 6 +#define wxSTC_FS_KEYWORD 7 +#define wxSTC_FS_KEYWORD2 8 +#define wxSTC_FS_KEYWORD3 9 +#define wxSTC_FS_KEYWORD4 10 +#define wxSTC_FS_NUMBER 11 +#define wxSTC_FS_STRING 12 +#define wxSTC_FS_PREPROCESSOR 13 +#define wxSTC_FS_OPERATOR 14 +#define wxSTC_FS_IDENTIFIER 15 +#define wxSTC_FS_DATE 16 +#define wxSTC_FS_STRINGEOL 17 +#define wxSTC_FS_CONSTANT 18 +#define wxSTC_FS_WORDOPERATOR 19 +#define wxSTC_FS_DISABLEDCODE 20 +#define wxSTC_FS_DEFAULT_C 21 +#define wxSTC_FS_COMMENTDOC_C 22 +#define wxSTC_FS_COMMENTLINEDOC_C 23 +#define wxSTC_FS_KEYWORD_C 24 +#define wxSTC_FS_KEYWORD2_C 25 +#define wxSTC_FS_NUMBER_C 26 +#define wxSTC_FS_STRING_C 27 +#define wxSTC_FS_PREPROCESSOR_C 28 +#define wxSTC_FS_OPERATOR_C 29 +#define wxSTC_FS_IDENTIFIER_C 30 +#define wxSTC_FS_STRINGEOL_C 31 + +/// Lexical states for SCLEX_CSOUND +#define wxSTC_CSOUND_DEFAULT 0 +#define wxSTC_CSOUND_COMMENT 1 +#define wxSTC_CSOUND_NUMBER 2 +#define wxSTC_CSOUND_OPERATOR 3 +#define wxSTC_CSOUND_INSTR 4 +#define wxSTC_CSOUND_IDENTIFIER 5 +#define wxSTC_CSOUND_OPCODE 6 +#define wxSTC_CSOUND_HEADERSTMT 7 +#define wxSTC_CSOUND_USERKEYWORD 8 +#define wxSTC_CSOUND_COMMENTBLOCK 9 +#define wxSTC_CSOUND_PARAM 10 +#define wxSTC_CSOUND_ARATE_VAR 11 +#define wxSTC_CSOUND_KRATE_VAR 12 +#define wxSTC_CSOUND_IRATE_VAR 13 +#define wxSTC_CSOUND_GLOBAL_VAR 14 +#define wxSTC_CSOUND_STRINGEOL 15 + +/// Lexical states for SCLEX_INNOSETUP +#define wxSTC_INNO_DEFAULT 0 +#define wxSTC_INNO_COMMENT 1 +#define wxSTC_INNO_KEYWORD 2 +#define wxSTC_INNO_PARAMETER 3 +#define wxSTC_INNO_SECTION 4 +#define wxSTC_INNO_PREPROC 5 +#define wxSTC_INNO_INLINE_EXPANSION 6 +#define wxSTC_INNO_COMMENT_PASCAL 7 +#define wxSTC_INNO_KEYWORD_PASCAL 8 +#define wxSTC_INNO_KEYWORD_USER 9 +#define wxSTC_INNO_STRING_DOUBLE 10 +#define wxSTC_INNO_STRING_SINGLE 11 +#define wxSTC_INNO_IDENTIFIER 12 + +/// Lexical states for SCLEX_OPAL +#define wxSTC_OPAL_SPACE 0 +#define wxSTC_OPAL_COMMENT_BLOCK 1 +#define wxSTC_OPAL_COMMENT_LINE 2 +#define wxSTC_OPAL_INTEGER 3 +#define wxSTC_OPAL_KEYWORD 4 +#define wxSTC_OPAL_SORT 5 +#define wxSTC_OPAL_STRING 6 +#define wxSTC_OPAL_PAR 7 +#define wxSTC_OPAL_BOOL_CONST 8 +#define wxSTC_OPAL_DEFAULT 32 + +/// Lexical states for SCLEX_SPICE +#define wxSTC_SPICE_DEFAULT 0 +#define wxSTC_SPICE_IDENTIFIER 1 +#define wxSTC_SPICE_KEYWORD 2 +#define wxSTC_SPICE_KEYWORD2 3 +#define wxSTC_SPICE_KEYWORD3 4 +#define wxSTC_SPICE_NUMBER 5 +#define wxSTC_SPICE_DELIMITER 6 +#define wxSTC_SPICE_VALUE 7 +#define wxSTC_SPICE_COMMENTLINE 8 + +/// Lexical states for SCLEX_CMAKE +#define wxSTC_CMAKE_DEFAULT 0 +#define wxSTC_CMAKE_COMMENT 1 +#define wxSTC_CMAKE_STRINGDQ 2 +#define wxSTC_CMAKE_STRINGLQ 3 +#define wxSTC_CMAKE_STRINGRQ 4 +#define wxSTC_CMAKE_COMMANDS 5 +#define wxSTC_CMAKE_PARAMETERS 6 +#define wxSTC_CMAKE_VARIABLE 7 +#define wxSTC_CMAKE_USERDEFINED 8 +#define wxSTC_CMAKE_WHILEDEF 9 +#define wxSTC_CMAKE_FOREACHDEF 10 +#define wxSTC_CMAKE_IFDEFINEDEF 11 +#define wxSTC_CMAKE_MACRODEF 12 +#define wxSTC_CMAKE_STRINGVAR 13 +#define wxSTC_CMAKE_NUMBER 14 + +/// Lexical states for SCLEX_GAP +#define wxSTC_GAP_DEFAULT 0 +#define wxSTC_GAP_IDENTIFIER 1 +#define wxSTC_GAP_KEYWORD 2 +#define wxSTC_GAP_KEYWORD2 3 +#define wxSTC_GAP_KEYWORD3 4 +#define wxSTC_GAP_KEYWORD4 5 +#define wxSTC_GAP_STRING 6 +#define wxSTC_GAP_CHAR 7 +#define wxSTC_GAP_OPERATOR 8 +#define wxSTC_GAP_COMMENT 9 +#define wxSTC_GAP_NUMBER 10 +#define wxSTC_GAP_STRINGEOL 11 + +/// Lexical state for SCLEX_PLM +#define wxSTC_PLM_DEFAULT 0 +#define wxSTC_PLM_COMMENT 1 +#define wxSTC_PLM_STRING 2 +#define wxSTC_PLM_NUMBER 3 +#define wxSTC_PLM_IDENTIFIER 4 +#define wxSTC_PLM_OPERATOR 5 +#define wxSTC_PLM_CONTROL 6 +#define wxSTC_PLM_KEYWORD 7 + +/// Lexical state for SCLEX_PROGRESS +#define wxSTC_ABL_DEFAULT 0 +#define wxSTC_ABL_NUMBER 1 +#define wxSTC_ABL_WORD 2 +#define wxSTC_ABL_STRING 3 +#define wxSTC_ABL_CHARACTER 4 +#define wxSTC_ABL_PREPROCESSOR 5 +#define wxSTC_ABL_OPERATOR 6 +#define wxSTC_ABL_IDENTIFIER 7 +#define wxSTC_ABL_BLOCK 8 +#define wxSTC_ABL_END 9 +#define wxSTC_ABL_COMMENT 10 +#define wxSTC_ABL_TASKMARKER 11 +#define wxSTC_ABL_LINECOMMENT 12 + +/// Lexical states for SCLEX_ABAQUS +#define wxSTC_ABAQUS_DEFAULT 0 +#define wxSTC_ABAQUS_COMMENT 1 +#define wxSTC_ABAQUS_COMMENTBLOCK 2 +#define wxSTC_ABAQUS_NUMBER 3 +#define wxSTC_ABAQUS_STRING 4 +#define wxSTC_ABAQUS_OPERATOR 5 +#define wxSTC_ABAQUS_WORD 6 +#define wxSTC_ABAQUS_PROCESSOR 7 +#define wxSTC_ABAQUS_COMMAND 8 +#define wxSTC_ABAQUS_SLASHCOMMAND 9 +#define wxSTC_ABAQUS_STARCOMMAND 10 +#define wxSTC_ABAQUS_ARGUMENT 11 +#define wxSTC_ABAQUS_FUNCTION 12 + +/// Lexical states for SCLEX_ASYMPTOTE +#define wxSTC_ASY_DEFAULT 0 +#define wxSTC_ASY_COMMENT 1 +#define wxSTC_ASY_COMMENTLINE 2 +#define wxSTC_ASY_NUMBER 3 +#define wxSTC_ASY_WORD 4 +#define wxSTC_ASY_STRING 5 +#define wxSTC_ASY_CHARACTER 6 +#define wxSTC_ASY_OPERATOR 7 +#define wxSTC_ASY_IDENTIFIER 8 +#define wxSTC_ASY_STRINGEOL 9 +#define wxSTC_ASY_COMMENTLINEDOC 10 +#define wxSTC_ASY_WORD2 11 + +/// Lexical states for SCLEX_R +#define wxSTC_R_DEFAULT 0 +#define wxSTC_R_COMMENT 1 +#define wxSTC_R_KWORD 2 +#define wxSTC_R_BASEKWORD 3 +#define wxSTC_R_OTHERKWORD 4 +#define wxSTC_R_NUMBER 5 +#define wxSTC_R_STRING 6 +#define wxSTC_R_STRING2 7 +#define wxSTC_R_OPERATOR 8 +#define wxSTC_R_IDENTIFIER 9 +#define wxSTC_R_INFIX 10 +#define wxSTC_R_INFIXEOL 11 + +/// Lexical state for SCLEX_MAGIK +#define wxSTC_MAGIK_DEFAULT 0 +#define wxSTC_MAGIK_COMMENT 1 +#define wxSTC_MAGIK_HYPER_COMMENT 16 +#define wxSTC_MAGIK_STRING 2 +#define wxSTC_MAGIK_CHARACTER 3 +#define wxSTC_MAGIK_NUMBER 4 +#define wxSTC_MAGIK_IDENTIFIER 5 +#define wxSTC_MAGIK_OPERATOR 6 +#define wxSTC_MAGIK_FLOW 7 +#define wxSTC_MAGIK_CONTAINER 8 +#define wxSTC_MAGIK_BRACKET_BLOCK 9 +#define wxSTC_MAGIK_BRACE_BLOCK 10 +#define wxSTC_MAGIK_SQBRACKET_BLOCK 11 +#define wxSTC_MAGIK_UNKNOWN_KEYWORD 12 +#define wxSTC_MAGIK_KEYWORD 13 +#define wxSTC_MAGIK_PRAGMA 14 +#define wxSTC_MAGIK_SYMBOL 15 + +/// Lexical state for SCLEX_POWERSHELL +#define wxSTC_POWERSHELL_DEFAULT 0 +#define wxSTC_POWERSHELL_COMMENT 1 +#define wxSTC_POWERSHELL_STRING 2 +#define wxSTC_POWERSHELL_CHARACTER 3 +#define wxSTC_POWERSHELL_NUMBER 4 +#define wxSTC_POWERSHELL_VARIABLE 5 +#define wxSTC_POWERSHELL_OPERATOR 6 +#define wxSTC_POWERSHELL_IDENTIFIER 7 +#define wxSTC_POWERSHELL_KEYWORD 8 +#define wxSTC_POWERSHELL_CMDLET 9 +#define wxSTC_POWERSHELL_ALIAS 10 +#define wxSTC_POWERSHELL_FUNCTION 11 +#define wxSTC_POWERSHELL_USER1 12 +#define wxSTC_POWERSHELL_COMMENTSTREAM 13 +#define wxSTC_POWERSHELL_HERE_STRING 14 +#define wxSTC_POWERSHELL_HERE_CHARACTER 15 +#define wxSTC_POWERSHELL_COMMENTDOCKEYWORD 16 + +/// Lexical state for SCLEX_MYSQL +#define wxSTC_MYSQL_DEFAULT 0 +#define wxSTC_MYSQL_COMMENT 1 +#define wxSTC_MYSQL_COMMENTLINE 2 +#define wxSTC_MYSQL_VARIABLE 3 +#define wxSTC_MYSQL_SYSTEMVARIABLE 4 +#define wxSTC_MYSQL_KNOWNSYSTEMVARIABLE 5 +#define wxSTC_MYSQL_NUMBER 6 +#define wxSTC_MYSQL_MAJORKEYWORD 7 +#define wxSTC_MYSQL_KEYWORD 8 +#define wxSTC_MYSQL_DATABASEOBJECT 9 +#define wxSTC_MYSQL_PROCEDUREKEYWORD 10 +#define wxSTC_MYSQL_STRING 11 +#define wxSTC_MYSQL_SQSTRING 12 +#define wxSTC_MYSQL_DQSTRING 13 +#define wxSTC_MYSQL_OPERATOR 14 +#define wxSTC_MYSQL_FUNCTION 15 +#define wxSTC_MYSQL_IDENTIFIER 16 +#define wxSTC_MYSQL_QUOTEDIDENTIFIER 17 +#define wxSTC_MYSQL_USER1 18 +#define wxSTC_MYSQL_USER2 19 +#define wxSTC_MYSQL_USER3 20 +#define wxSTC_MYSQL_HIDDENCOMMAND 21 +#define wxSTC_MYSQL_PLACEHOLDER 22 + +/// Lexical state for SCLEX_PO +#define wxSTC_PO_DEFAULT 0 +#define wxSTC_PO_COMMENT 1 +#define wxSTC_PO_MSGID 2 +#define wxSTC_PO_MSGID_TEXT 3 +#define wxSTC_PO_MSGSTR 4 +#define wxSTC_PO_MSGSTR_TEXT 5 +#define wxSTC_PO_MSGCTXT 6 +#define wxSTC_PO_MSGCTXT_TEXT 7 +#define wxSTC_PO_FUZZY 8 +#define wxSTC_PO_PROGRAMMER_COMMENT 9 +#define wxSTC_PO_REFERENCE 10 +#define wxSTC_PO_FLAGS 11 +#define wxSTC_PO_MSGID_TEXT_EOL 12 +#define wxSTC_PO_MSGSTR_TEXT_EOL 13 +#define wxSTC_PO_MSGCTXT_TEXT_EOL 14 +#define wxSTC_PO_ERROR 15 + +/// Lexical states for SCLEX_PASCAL +#define wxSTC_PAS_DEFAULT 0 +#define wxSTC_PAS_IDENTIFIER 1 +#define wxSTC_PAS_COMMENT 2 +#define wxSTC_PAS_COMMENT2 3 +#define wxSTC_PAS_COMMENTLINE 4 +#define wxSTC_PAS_PREPROCESSOR 5 +#define wxSTC_PAS_PREPROCESSOR2 6 +#define wxSTC_PAS_NUMBER 7 +#define wxSTC_PAS_HEXNUMBER 8 +#define wxSTC_PAS_WORD 9 +#define wxSTC_PAS_STRING 10 +#define wxSTC_PAS_STRINGEOL 11 +#define wxSTC_PAS_CHARACTER 12 +#define wxSTC_PAS_OPERATOR 13 +#define wxSTC_PAS_ASM 14 + +/// Lexical state for SCLEX_SORCUS +#define wxSTC_SORCUS_DEFAULT 0 +#define wxSTC_SORCUS_COMMAND 1 +#define wxSTC_SORCUS_PARAMETER 2 +#define wxSTC_SORCUS_COMMENTLINE 3 +#define wxSTC_SORCUS_STRING 4 +#define wxSTC_SORCUS_STRINGEOL 5 +#define wxSTC_SORCUS_IDENTIFIER 6 +#define wxSTC_SORCUS_OPERATOR 7 +#define wxSTC_SORCUS_NUMBER 8 +#define wxSTC_SORCUS_CONSTANT 9 + +/// Lexical state for SCLEX_POWERPRO +#define wxSTC_POWERPRO_DEFAULT 0 +#define wxSTC_POWERPRO_COMMENTBLOCK 1 +#define wxSTC_POWERPRO_COMMENTLINE 2 +#define wxSTC_POWERPRO_NUMBER 3 +#define wxSTC_POWERPRO_WORD 4 +#define wxSTC_POWERPRO_WORD2 5 +#define wxSTC_POWERPRO_WORD3 6 +#define wxSTC_POWERPRO_WORD4 7 +#define wxSTC_POWERPRO_DOUBLEQUOTEDSTRING 8 +#define wxSTC_POWERPRO_SINGLEQUOTEDSTRING 9 +#define wxSTC_POWERPRO_LINECONTINUE 10 +#define wxSTC_POWERPRO_OPERATOR 11 +#define wxSTC_POWERPRO_IDENTIFIER 12 +#define wxSTC_POWERPRO_STRINGEOL 13 +#define wxSTC_POWERPRO_VERBATIM 14 +#define wxSTC_POWERPRO_ALTQUOTE 15 +#define wxSTC_POWERPRO_FUNCTION 16 + +/// Lexical states for SCLEX_SML +#define wxSTC_SML_DEFAULT 0 +#define wxSTC_SML_IDENTIFIER 1 +#define wxSTC_SML_TAGNAME 2 +#define wxSTC_SML_KEYWORD 3 +#define wxSTC_SML_KEYWORD2 4 +#define wxSTC_SML_KEYWORD3 5 +#define wxSTC_SML_LINENUM 6 +#define wxSTC_SML_OPERATOR 7 +#define wxSTC_SML_NUMBER 8 +#define wxSTC_SML_CHAR 9 +#define wxSTC_SML_STRING 11 +#define wxSTC_SML_COMMENT 12 +#define wxSTC_SML_COMMENT1 13 +#define wxSTC_SML_COMMENT2 14 +#define wxSTC_SML_COMMENT3 15 + +/// Lexical state for SCLEX_MARKDOWN +#define wxSTC_MARKDOWN_DEFAULT 0 +#define wxSTC_MARKDOWN_LINE_BEGIN 1 +#define wxSTC_MARKDOWN_STRONG1 2 +#define wxSTC_MARKDOWN_STRONG2 3 +#define wxSTC_MARKDOWN_EM1 4 +#define wxSTC_MARKDOWN_EM2 5 +#define wxSTC_MARKDOWN_HEADER1 6 +#define wxSTC_MARKDOWN_HEADER2 7 +#define wxSTC_MARKDOWN_HEADER3 8 +#define wxSTC_MARKDOWN_HEADER4 9 +#define wxSTC_MARKDOWN_HEADER5 10 +#define wxSTC_MARKDOWN_HEADER6 11 +#define wxSTC_MARKDOWN_PRECHAR 12 +#define wxSTC_MARKDOWN_ULIST_ITEM 13 +#define wxSTC_MARKDOWN_OLIST_ITEM 14 +#define wxSTC_MARKDOWN_BLOCKQUOTE 15 +#define wxSTC_MARKDOWN_STRIKEOUT 16 +#define wxSTC_MARKDOWN_HRULE 17 +#define wxSTC_MARKDOWN_LINK 18 +#define wxSTC_MARKDOWN_CODE 19 +#define wxSTC_MARKDOWN_CODE2 20 +#define wxSTC_MARKDOWN_CODEBK 21 + +/// Lexical state for SCLEX_TXT2TAGS +#define wxSTC_TXT2TAGS_DEFAULT 0 +#define wxSTC_TXT2TAGS_LINE_BEGIN 1 +#define wxSTC_TXT2TAGS_STRONG1 2 +#define wxSTC_TXT2TAGS_STRONG2 3 +#define wxSTC_TXT2TAGS_EM1 4 +#define wxSTC_TXT2TAGS_EM2 5 +#define wxSTC_TXT2TAGS_HEADER1 6 +#define wxSTC_TXT2TAGS_HEADER2 7 +#define wxSTC_TXT2TAGS_HEADER3 8 +#define wxSTC_TXT2TAGS_HEADER4 9 +#define wxSTC_TXT2TAGS_HEADER5 10 +#define wxSTC_TXT2TAGS_HEADER6 11 +#define wxSTC_TXT2TAGS_PRECHAR 12 +#define wxSTC_TXT2TAGS_ULIST_ITEM 13 +#define wxSTC_TXT2TAGS_OLIST_ITEM 14 +#define wxSTC_TXT2TAGS_BLOCKQUOTE 15 +#define wxSTC_TXT2TAGS_STRIKEOUT 16 +#define wxSTC_TXT2TAGS_HRULE 17 +#define wxSTC_TXT2TAGS_LINK 18 +#define wxSTC_TXT2TAGS_CODE 19 +#define wxSTC_TXT2TAGS_CODE2 20 +#define wxSTC_TXT2TAGS_CODEBK 21 +#define wxSTC_TXT2TAGS_COMMENT 22 +#define wxSTC_TXT2TAGS_OPTION 23 +#define wxSTC_TXT2TAGS_PREPROC 24 +#define wxSTC_TXT2TAGS_POSTPROC 25 + +/// Lexical states for SCLEX_A68K +#define wxSTC_A68K_DEFAULT 0 +#define wxSTC_A68K_COMMENT 1 +#define wxSTC_A68K_NUMBER_DEC 2 +#define wxSTC_A68K_NUMBER_BIN 3 +#define wxSTC_A68K_NUMBER_HEX 4 +#define wxSTC_A68K_STRING1 5 +#define wxSTC_A68K_OPERATOR 6 +#define wxSTC_A68K_CPUINSTRUCTION 7 +#define wxSTC_A68K_EXTINSTRUCTION 8 +#define wxSTC_A68K_REGISTER 9 +#define wxSTC_A68K_DIRECTIVE 10 +#define wxSTC_A68K_MACRO_ARG 11 +#define wxSTC_A68K_LABEL 12 +#define wxSTC_A68K_STRING2 13 +#define wxSTC_A68K_IDENTIFIER 14 +#define wxSTC_A68K_MACRO_DECLARATION 15 +#define wxSTC_A68K_COMMENT_WORD 16 +#define wxSTC_A68K_COMMENT_SPECIAL 17 +#define wxSTC_A68K_COMMENT_DOXYGEN 18 + +/// Lexical states for SCLEX_MODULA +#define wxSTC_MODULA_DEFAULT 0 +#define wxSTC_MODULA_COMMENT 1 +#define wxSTC_MODULA_DOXYCOMM 2 +#define wxSTC_MODULA_DOXYKEY 3 +#define wxSTC_MODULA_KEYWORD 4 +#define wxSTC_MODULA_RESERVED 5 +#define wxSTC_MODULA_NUMBER 6 +#define wxSTC_MODULA_BASENUM 7 +#define wxSTC_MODULA_FLOAT 8 +#define wxSTC_MODULA_STRING 9 +#define wxSTC_MODULA_STRSPEC 10 +#define wxSTC_MODULA_CHAR 11 +#define wxSTC_MODULA_CHARSPEC 12 +#define wxSTC_MODULA_PROC 13 +#define wxSTC_MODULA_PRAGMA 14 +#define wxSTC_MODULA_PRGKEY 15 +#define wxSTC_MODULA_OPERATOR 16 +#define wxSTC_MODULA_BADSTR 17 + +/// Lexical states for SCLEX_COFFEESCRIPT +#define wxSTC_COFFEESCRIPT_DEFAULT 0 +#define wxSTC_COFFEESCRIPT_COMMENT 1 +#define wxSTC_COFFEESCRIPT_COMMENTLINE 2 +#define wxSTC_COFFEESCRIPT_COMMENTDOC 3 +#define wxSTC_COFFEESCRIPT_NUMBER 4 +#define wxSTC_COFFEESCRIPT_WORD 5 +#define wxSTC_COFFEESCRIPT_STRING 6 +#define wxSTC_COFFEESCRIPT_CHARACTER 7 +#define wxSTC_COFFEESCRIPT_UUID 8 +#define wxSTC_COFFEESCRIPT_PREPROCESSOR 9 +#define wxSTC_COFFEESCRIPT_OPERATOR 10 +#define wxSTC_COFFEESCRIPT_IDENTIFIER 11 +#define wxSTC_COFFEESCRIPT_STRINGEOL 12 +#define wxSTC_COFFEESCRIPT_VERBATIM 13 +#define wxSTC_COFFEESCRIPT_REGEX 14 +#define wxSTC_COFFEESCRIPT_COMMENTLINEDOC 15 +#define wxSTC_COFFEESCRIPT_WORD2 16 +#define wxSTC_COFFEESCRIPT_COMMENTDOCKEYWORD 17 +#define wxSTC_COFFEESCRIPT_COMMENTDOCKEYWORDERROR 18 +#define wxSTC_COFFEESCRIPT_GLOBALCLASS 19 +#define wxSTC_COFFEESCRIPT_STRINGRAW 20 +#define wxSTC_COFFEESCRIPT_TRIPLEVERBATIM 21 +#define wxSTC_COFFEESCRIPT_COMMENTBLOCK 22 +#define wxSTC_COFFEESCRIPT_VERBOSE_REGEX 23 +#define wxSTC_COFFEESCRIPT_VERBOSE_REGEX_COMMENT 24 +#define wxSTC_COFFEESCRIPT_INSTANCEPROPERTY 25 + +/// Lexical states for SCLEX_AVS +#define wxSTC_AVS_DEFAULT 0 +#define wxSTC_AVS_COMMENTBLOCK 1 +#define wxSTC_AVS_COMMENTBLOCKN 2 +#define wxSTC_AVS_COMMENTLINE 3 +#define wxSTC_AVS_NUMBER 4 +#define wxSTC_AVS_OPERATOR 5 +#define wxSTC_AVS_IDENTIFIER 6 +#define wxSTC_AVS_STRING 7 +#define wxSTC_AVS_TRIPLESTRING 8 +#define wxSTC_AVS_KEYWORD 9 +#define wxSTC_AVS_FILTER 10 +#define wxSTC_AVS_PLUGIN 11 +#define wxSTC_AVS_FUNCTION 12 +#define wxSTC_AVS_CLIPPROP 13 +#define wxSTC_AVS_USERDFN 14 + +/// Lexical states for SCLEX_ECL +#define wxSTC_ECL_DEFAULT 0 +#define wxSTC_ECL_COMMENT 1 +#define wxSTC_ECL_COMMENTLINE 2 +#define wxSTC_ECL_NUMBER 3 +#define wxSTC_ECL_STRING 4 +#define wxSTC_ECL_WORD0 5 +#define wxSTC_ECL_OPERATOR 6 +#define wxSTC_ECL_CHARACTER 7 +#define wxSTC_ECL_UUID 8 +#define wxSTC_ECL_PREPROCESSOR 9 +#define wxSTC_ECL_UNKNOWN 10 +#define wxSTC_ECL_IDENTIFIER 11 +#define wxSTC_ECL_STRINGEOL 12 +#define wxSTC_ECL_VERBATIM 13 +#define wxSTC_ECL_REGEX 14 +#define wxSTC_ECL_COMMENTLINEDOC 15 +#define wxSTC_ECL_WORD1 16 +#define wxSTC_ECL_COMMENTDOCKEYWORD 17 +#define wxSTC_ECL_COMMENTDOCKEYWORDERROR 18 +#define wxSTC_ECL_WORD2 19 +#define wxSTC_ECL_WORD3 20 +#define wxSTC_ECL_WORD4 21 +#define wxSTC_ECL_WORD5 22 +#define wxSTC_ECL_COMMENTDOC 23 +#define wxSTC_ECL_ADDED 24 +#define wxSTC_ECL_DELETED 25 +#define wxSTC_ECL_CHANGED 26 +#define wxSTC_ECL_MOVED 27 + +/// Lexical states for SCLEX_OSCRIPT +#define wxSTC_OSCRIPT_DEFAULT 0 +#define wxSTC_OSCRIPT_LINE_COMMENT 1 +#define wxSTC_OSCRIPT_BLOCK_COMMENT 2 +#define wxSTC_OSCRIPT_DOC_COMMENT 3 +#define wxSTC_OSCRIPT_PREPROCESSOR 4 +#define wxSTC_OSCRIPT_NUMBER 5 +#define wxSTC_OSCRIPT_SINGLEQUOTE_STRING 6 +#define wxSTC_OSCRIPT_DOUBLEQUOTE_STRING 7 +#define wxSTC_OSCRIPT_CONSTANT 8 +#define wxSTC_OSCRIPT_IDENTIFIER 9 +#define wxSTC_OSCRIPT_GLOBAL 10 +#define wxSTC_OSCRIPT_KEYWORD 11 +#define wxSTC_OSCRIPT_OPERATOR 12 +#define wxSTC_OSCRIPT_LABEL 13 +#define wxSTC_OSCRIPT_TYPE 14 +#define wxSTC_OSCRIPT_FUNCTION 15 +#define wxSTC_OSCRIPT_OBJECT 16 +#define wxSTC_OSCRIPT_PROPERTY 17 +#define wxSTC_OSCRIPT_METHOD 18 + +/// Lexical states for SCLEX_VISUALPROLOG +#define wxSTC_VISUALPROLOG_DEFAULT 0 +#define wxSTC_VISUALPROLOG_KEY_MAJOR 1 +#define wxSTC_VISUALPROLOG_KEY_MINOR 2 +#define wxSTC_VISUALPROLOG_KEY_DIRECTIVE 3 +#define wxSTC_VISUALPROLOG_COMMENT_BLOCK 4 +#define wxSTC_VISUALPROLOG_COMMENT_LINE 5 +#define wxSTC_VISUALPROLOG_COMMENT_KEY 6 +#define wxSTC_VISUALPROLOG_COMMENT_KEY_ERROR 7 +#define wxSTC_VISUALPROLOG_IDENTIFIER 8 +#define wxSTC_VISUALPROLOG_VARIABLE 9 +#define wxSTC_VISUALPROLOG_ANONYMOUS 10 +#define wxSTC_VISUALPROLOG_NUMBER 11 +#define wxSTC_VISUALPROLOG_OPERATOR 12 +#define wxSTC_VISUALPROLOG_CHARACTER 13 +#define wxSTC_VISUALPROLOG_CHARACTER_TOO_MANY 14 +#define wxSTC_VISUALPROLOG_CHARACTER_ESCAPE_ERROR 15 +#define wxSTC_VISUALPROLOG_STRING 16 +#define wxSTC_VISUALPROLOG_STRING_ESCAPE 17 +#define wxSTC_VISUALPROLOG_STRING_ESCAPE_ERROR 18 +#define wxSTC_VISUALPROLOG_STRING_EOL_OPEN 19 +#define wxSTC_VISUALPROLOG_STRING_VERBATIM 20 +#define wxSTC_VISUALPROLOG_STRING_VERBATIM_SPECIAL 21 +#define wxSTC_VISUALPROLOG_STRING_VERBATIM_EOL 22 + +/// Lexical states for SCLEX_STTXT +#define wxSTC_STTXT_DEFAULT 0 +#define wxSTC_STTXT_COMMENT 1 +#define wxSTC_STTXT_COMMENTLINE 2 +#define wxSTC_STTXT_KEYWORD 3 +#define wxSTC_STTXT_TYPE 4 +#define wxSTC_STTXT_FUNCTION 5 +#define wxSTC_STTXT_FB 6 +#define wxSTC_STTXT_NUMBER 7 +#define wxSTC_STTXT_HEXNUMBER 8 +#define wxSTC_STTXT_PRAGMA 9 +#define wxSTC_STTXT_OPERATOR 10 +#define wxSTC_STTXT_CHARACTER 11 +#define wxSTC_STTXT_STRING1 12 +#define wxSTC_STTXT_STRING2 13 +#define wxSTC_STTXT_STRINGEOL 14 +#define wxSTC_STTXT_IDENTIFIER 15 +#define wxSTC_STTXT_DATETIME 16 +#define wxSTC_STTXT_VARS 17 +#define wxSTC_STTXT_PRAGMAS 18 + +/// Lexical states for SCLEX_KVIRC +#define wxSTC_KVIRC_DEFAULT 0 +#define wxSTC_KVIRC_COMMENT 1 +#define wxSTC_KVIRC_COMMENTBLOCK 2 +#define wxSTC_KVIRC_STRING 3 +#define wxSTC_KVIRC_WORD 4 +#define wxSTC_KVIRC_KEYWORD 5 +#define wxSTC_KVIRC_FUNCTION_KEYWORD 6 +#define wxSTC_KVIRC_FUNCTION 7 +#define wxSTC_KVIRC_VARIABLE 8 +#define wxSTC_KVIRC_NUMBER 9 +#define wxSTC_KVIRC_OPERATOR 10 +#define wxSTC_KVIRC_STRING_FUNCTION 11 +#define wxSTC_KVIRC_STRING_VARIABLE 12 + +/// Lexical states for SCLEX_RUST +#define wxSTC_RUST_DEFAULT 0 +#define wxSTC_RUST_COMMENTBLOCK 1 +#define wxSTC_RUST_COMMENTLINE 2 +#define wxSTC_RUST_COMMENTBLOCKDOC 3 +#define wxSTC_RUST_COMMENTLINEDOC 4 +#define wxSTC_RUST_NUMBER 5 +#define wxSTC_RUST_WORD 6 +#define wxSTC_RUST_WORD2 7 +#define wxSTC_RUST_WORD3 8 +#define wxSTC_RUST_WORD4 9 +#define wxSTC_RUST_WORD5 10 +#define wxSTC_RUST_WORD6 11 +#define wxSTC_RUST_WORD7 12 +#define wxSTC_RUST_STRING 13 +#define wxSTC_RUST_STRINGR 14 +#define wxSTC_RUST_CHARACTER 15 +#define wxSTC_RUST_OPERATOR 16 +#define wxSTC_RUST_IDENTIFIER 17 +#define wxSTC_RUST_LIFETIME 18 +#define wxSTC_RUST_MACRO 19 +#define wxSTC_RUST_LEXERROR 20 +#define wxSTC_RUST_BYTESTRING 21 +#define wxSTC_RUST_BYTESTRINGR 22 +#define wxSTC_RUST_BYTECHARACTER 23 + +/// Lexical states for SCLEX_DMAP +#define wxSTC_DMAP_DEFAULT 0 +#define wxSTC_DMAP_COMMENT 1 +#define wxSTC_DMAP_NUMBER 2 +#define wxSTC_DMAP_STRING1 3 +#define wxSTC_DMAP_STRING2 4 +#define wxSTC_DMAP_STRINGEOL 5 +#define wxSTC_DMAP_OPERATOR 6 +#define wxSTC_DMAP_IDENTIFIER 7 +#define wxSTC_DMAP_WORD 8 +#define wxSTC_DMAP_WORD2 9 +#define wxSTC_DMAP_WORD3 10 + +/// Lexical states for SCLEX_DMIS +#define wxSTC_DMIS_DEFAULT 0 +#define wxSTC_DMIS_COMMENT 1 +#define wxSTC_DMIS_STRING 2 +#define wxSTC_DMIS_NUMBER 3 +#define wxSTC_DMIS_KEYWORD 4 +#define wxSTC_DMIS_MAJORWORD 5 +#define wxSTC_DMIS_MINORWORD 6 +#define wxSTC_DMIS_UNSUPPORTED_MAJOR 7 +#define wxSTC_DMIS_UNSUPPORTED_MINOR 8 +#define wxSTC_DMIS_LABEL 9 + +/// Lexical states for SCLEX_REGISTRY +#define wxSTC_REG_DEFAULT 0 +#define wxSTC_REG_COMMENT 1 +#define wxSTC_REG_VALUENAME 2 +#define wxSTC_REG_STRING 3 +#define wxSTC_REG_HEXDIGIT 4 +#define wxSTC_REG_VALUETYPE 5 +#define wxSTC_REG_ADDEDKEY 6 +#define wxSTC_REG_DELETEDKEY 7 +#define wxSTC_REG_ESCAPED 8 +#define wxSTC_REG_KEYPATH_GUID 9 +#define wxSTC_REG_STRING_GUID 10 +#define wxSTC_REG_PARAMETER 11 +#define wxSTC_REG_OPERATOR 12 + +/// Lexical state for SCLEX_BIBTEX +#define wxSTC_BIBTEX_DEFAULT 0 +#define wxSTC_BIBTEX_ENTRY 1 +#define wxSTC_BIBTEX_UNKNOWN_ENTRY 2 +#define wxSTC_BIBTEX_KEY 3 +#define wxSTC_BIBTEX_PARAMETER 4 +#define wxSTC_BIBTEX_VALUE 5 +#define wxSTC_BIBTEX_COMMENT 6 + +/// Lexical state for SCLEX_SREC +#define wxSTC_HEX_DEFAULT 0 +#define wxSTC_HEX_RECSTART 1 +#define wxSTC_HEX_RECTYPE 2 +#define wxSTC_HEX_RECTYPE_UNKNOWN 3 +#define wxSTC_HEX_BYTECOUNT 4 +#define wxSTC_HEX_BYTECOUNT_WRONG 5 +#define wxSTC_HEX_NOADDRESS 6 +#define wxSTC_HEX_DATAADDRESS 7 +#define wxSTC_HEX_RECCOUNT 8 +#define wxSTC_HEX_STARTADDRESS 9 +#define wxSTC_HEX_ADDRESSFIELD_UNKNOWN 10 +#define wxSTC_HEX_EXTENDEDADDRESS 11 +#define wxSTC_HEX_DATA_ODD 12 +#define wxSTC_HEX_DATA_EVEN 13 +#define wxSTC_HEX_DATA_UNKNOWN 14 +#define wxSTC_HEX_DATA_EMPTY 15 +#define wxSTC_HEX_CHECKSUM 16 +#define wxSTC_HEX_CHECKSUM_WRONG 17 +#define wxSTC_HEX_GARBAGE 18 + +/// Lexical state for SCLEX_IHEX (shared with Srec) +/// Lexical state for SCLEX_TEHEX (shared with Srec) +/// Lexical states for SCLEX_JSON +#define wxSTC_JSON_DEFAULT 0 +#define wxSTC_JSON_NUMBER 1 +#define wxSTC_JSON_STRING 2 +#define wxSTC_JSON_STRINGEOL 3 +#define wxSTC_JSON_PROPERTYNAME 4 +#define wxSTC_JSON_ESCAPESEQUENCE 5 +#define wxSTC_JSON_LINECOMMENT 6 +#define wxSTC_JSON_BLOCKCOMMENT 7 +#define wxSTC_JSON_OPERATOR 8 +#define wxSTC_JSON_URI 9 +#define wxSTC_JSON_COMPACTIRI 10 +#define wxSTC_JSON_KEYWORD 11 +#define wxSTC_JSON_LDKEYWORD 12 +#define wxSTC_JSON_ERROR 13 +#define wxSTC_EDI_DEFAULT 0 +#define wxSTC_EDI_SEGMENTSTART 1 +#define wxSTC_EDI_SEGMENTEND 2 +#define wxSTC_EDI_SEP_ELEMENT 3 +#define wxSTC_EDI_SEP_COMPOSITE 4 +#define wxSTC_EDI_SEP_RELEASE 5 +#define wxSTC_EDI_UNA 6 +#define wxSTC_EDI_UNH 7 +#define wxSTC_EDI_BADSEGMENT 8 + +//}}} +//---------------------------------------------------------------------- + + +#if defined(__clang__) || wxCHECK_GCC_VERSION(4, 5) + #define wxSTC_STRINGIFY(X) #X + #define wxSTC_DEPRECATED_MACRO_VALUE(value,msg) \ + _Pragma(wxSTC_STRINGIFY(GCC warning msg)) value +#else + #define wxSTC_DEPRECATED_MACRO_VALUE(value,msg) value +#endif + +#if WXWIN_COMPATIBILITY_3_0 + +// The wxSTC_INDIC{0,1,2,S}_MASK values are no longer used in Scintilla + +#if wxCHECK_VISUALC_VERSION(10) + #pragma deprecated(wxSTC_INDIC0_MASK, wxSTC_INDIC1_MASK, \ + wxSTC_INDIC2_MASK, wxSTC_INDICS_MASK) +#endif + +#define wxSTC_INDIC0_MASK wxSTC_DEPRECATED_MACRO_VALUE(0x20,\ + "wxSTC_INDIC0_MASK is deprecated. Style byte indicators are no longer used.") +#define wxSTC_INDIC1_MASK wxSTC_DEPRECATED_MACRO_VALUE(0x40,\ + "wxSTC_INDIC1_MASK is deprecated. Style byte indicators are no longer used.") +#define wxSTC_INDIC2_MASK wxSTC_DEPRECATED_MACRO_VALUE(0x80,\ + "wxSTC_INDIC2_MASK is deprecated. Style byte indicators are no longer used.") +#define wxSTC_INDICS_MASK wxSTC_DEPRECATED_MACRO_VALUE(0xE0,\ + "wxSTC_INDICS_MASK is deprecated. Style byte indicators are no longer used.") + + +// The following entries have non-conformant prefixes. + +#if wxCHECK_VISUALC_VERSION(10) + #pragma deprecated(wxSTC_SCMOD_NORM, wxSTC_SCMOD_SHIFT, wxSTC_SCMOD_CTRL, \ + wxSTC_SCMOD_ALT, wxSTC_SCMOD_SUPER, wxSTC_SCMOD_META, \ + wxSTC_SCVS_NONE, wxSTC_SCVS_RECTANGULARSELECTION, \ + wxSTC_SCVS_USERACCESSIBLE, wxSTC_SCVS_NOWRAPLINESTART) +#endif + +#define wxSTC_SCMOD_NORM wxSTC_DEPRECATED_MACRO_VALUE(0,\ + "wxSTC_SCMOD_NORM is deprecated. Use wxSTC_KEYMOD_NORM instead.") +#define wxSTC_SCMOD_SHIFT wxSTC_DEPRECATED_MACRO_VALUE(1,\ + "wxSTC_SCMOD_SHIFT is deprecated. Use wxSTC_KEYMOD_SHIFT instead.") +#define wxSTC_SCMOD_CTRL wxSTC_DEPRECATED_MACRO_VALUE(2,\ + "wxSTC_SCMOD_CTRL is deprecated. Use wxSTC_KEYMOD_CTRL instead.") +#define wxSTC_SCMOD_ALT wxSTC_DEPRECATED_MACRO_VALUE(4,\ + "wxSTC_SCMOD_ALT is deprecated. Use wxSTC_KEYMOD_ALT instead.") +#define wxSTC_SCMOD_SUPER wxSTC_DEPRECATED_MACRO_VALUE(8,\ + "wxSTC_SCMOD_SUPER is deprecated. Use wxSTC_KEYMOD_SUPER instead.") +#define wxSTC_SCMOD_META wxSTC_DEPRECATED_MACRO_VALUE(16,\ + "wxSTC_SCMOD_META is deprecated. Use wxSTC_KEYMOD_META instead.") + +#define wxSTC_SCVS_NONE wxSTC_DEPRECATED_MACRO_VALUE(0, \ + "wxSTC_SCVS_NONE is deprecated. Use wxSTC_VS_NONE instead.") +#define wxSTC_SCVS_RECTANGULARSELECTION wxSTC_DEPRECATED_MACRO_VALUE(1, \ + "wxSTC_SCVS_RECTANGULARSELECTION is deprecated. Use wxSTC_VS_RECTANGULARSELECTION instead.") +#define wxSTC_SCVS_USERACCESSIBLE wxSTC_DEPRECATED_MACRO_VALUE(2, \ + "wxSTC_SCVS_USERACCESSIBLE is deprecated. Use wxSTC_VS_USERACCESSIBLE instead.") +#define wxSTC_SCVS_NOWRAPLINESTART wxSTC_DEPRECATED_MACRO_VALUE(4, \ + "wxSTC_SCVS_NOWRAPLINESTART is deprecated. Use wxSTC_VS_NOWRAPLINESTART instead.") + +#endif // WXWIN_COMPATIBILITY_3_0 + +// wxSTC is currently built without c++11 regex support, but the search flag +// wxSTC_FIND_CXX11REGEX was included with wxSTC any way. gen_iface.py has since +// been changed so that this flag will no longer be generated or documented, +// but the flag is preserved here so that any code using the flag before +// gen_iface.py was changed will not be broken. + +#define wxSTC_FIND_CXX11REGEX 0x00800000 + +//---------------------------------------------------------------------- +// Commands that can be bound to keystrokes section {{{ + + +/// Redoes the next action on the undo history. +#define wxSTC_CMD_REDO 2011 + +/// Select all the text in the document. +#define wxSTC_CMD_SELECTALL 2013 + +/// Undo one action in the undo history. +#define wxSTC_CMD_UNDO 2176 + +/// Cut the selection to the clipboard. +#define wxSTC_CMD_CUT 2177 + +/// Copy the selection to the clipboard. +#define wxSTC_CMD_COPY 2178 + +/// Paste the contents of the clipboard into the document replacing the selection. +#define wxSTC_CMD_PASTE 2179 + +/// Clear the selection. +#define wxSTC_CMD_CLEAR 2180 + +/// Move caret down one line. +#define wxSTC_CMD_LINEDOWN 2300 + +/// Move caret down one line extending selection to new caret position. +#define wxSTC_CMD_LINEDOWNEXTEND 2301 + +/// Move caret up one line. +#define wxSTC_CMD_LINEUP 2302 + +/// Move caret up one line extending selection to new caret position. +#define wxSTC_CMD_LINEUPEXTEND 2303 + +/// Move caret left one character. +#define wxSTC_CMD_CHARLEFT 2304 + +/// Move caret left one character extending selection to new caret position. +#define wxSTC_CMD_CHARLEFTEXTEND 2305 + +/// Move caret right one character. +#define wxSTC_CMD_CHARRIGHT 2306 + +/// Move caret right one character extending selection to new caret position. +#define wxSTC_CMD_CHARRIGHTEXTEND 2307 + +/// Move caret left one word. +#define wxSTC_CMD_WORDLEFT 2308 + +/// Move caret left one word extending selection to new caret position. +#define wxSTC_CMD_WORDLEFTEXTEND 2309 + +/// Move caret right one word. +#define wxSTC_CMD_WORDRIGHT 2310 + +/// Move caret right one word extending selection to new caret position. +#define wxSTC_CMD_WORDRIGHTEXTEND 2311 + +/// Move caret to first position on line. +#define wxSTC_CMD_HOME 2312 + +/// Move caret to first position on line extending selection to new caret position. +#define wxSTC_CMD_HOMEEXTEND 2313 + +/// Move caret to last position on line. +#define wxSTC_CMD_LINEEND 2314 + +/// Move caret to last position on line extending selection to new caret position. +#define wxSTC_CMD_LINEENDEXTEND 2315 + +/// Move caret to first position in document. +#define wxSTC_CMD_DOCUMENTSTART 2316 + +/// Move caret to first position in document extending selection to new caret position. +#define wxSTC_CMD_DOCUMENTSTARTEXTEND 2317 + +/// Move caret to last position in document. +#define wxSTC_CMD_DOCUMENTEND 2318 + +/// Move caret to last position in document extending selection to new caret position. +#define wxSTC_CMD_DOCUMENTENDEXTEND 2319 + +/// Move caret one page up. +#define wxSTC_CMD_PAGEUP 2320 + +/// Move caret one page up extending selection to new caret position. +#define wxSTC_CMD_PAGEUPEXTEND 2321 + +/// Move caret one page down. +#define wxSTC_CMD_PAGEDOWN 2322 + +/// Move caret one page down extending selection to new caret position. +#define wxSTC_CMD_PAGEDOWNEXTEND 2323 + +/// Switch from insert to overtype mode or the reverse. +#define wxSTC_CMD_EDITTOGGLEOVERTYPE 2324 + +/// Cancel any modes such as call tip or auto-completion list display. +#define wxSTC_CMD_CANCEL 2325 + +/// Delete the selection or if no selection, the character before the caret. +#define wxSTC_CMD_DELETEBACK 2326 + +/// If selection is empty or all on one line replace the selection with a tab character. +/// If more than one line selected, indent the lines. +#define wxSTC_CMD_TAB 2327 + +/// Dedent the selected lines. +#define wxSTC_CMD_BACKTAB 2328 + +/// Insert a new line, may use a CRLF, CR or LF depending on EOL mode. +#define wxSTC_CMD_NEWLINE 2329 + +/// Insert a Form Feed character. +#define wxSTC_CMD_FORMFEED 2330 + +/// Move caret to before first visible character on line. +/// If already there move to first character on line. +#define wxSTC_CMD_VCHOME 2331 + +/// Like VCHome but extending selection to new caret position. +#define wxSTC_CMD_VCHOMEEXTEND 2332 + +/// Magnify the displayed text by increasing the sizes by 1 point. +#define wxSTC_CMD_ZOOMIN 2333 + +/// Make the displayed text smaller by decreasing the sizes by 1 point. +#define wxSTC_CMD_ZOOMOUT 2334 + +/// Delete the word to the left of the caret. +#define wxSTC_CMD_DELWORDLEFT 2335 + +/// Delete the word to the right of the caret. +#define wxSTC_CMD_DELWORDRIGHT 2336 + +/// Delete the word to the right of the caret, but not the trailing non-word characters. +#define wxSTC_CMD_DELWORDRIGHTEND 2518 + +/// Cut the line containing the caret. +#define wxSTC_CMD_LINECUT 2337 + +/// Delete the line containing the caret. +#define wxSTC_CMD_LINEDELETE 2338 + +/// Switch the current line with the previous. +#define wxSTC_CMD_LINETRANSPOSE 2339 + +/// Duplicate the current line. +#define wxSTC_CMD_LINEDUPLICATE 2404 + +/// Transform the selection to lower case. +#define wxSTC_CMD_LOWERCASE 2340 + +/// Transform the selection to upper case. +#define wxSTC_CMD_UPPERCASE 2341 + +/// Scroll the document down, keeping the caret visible. +#define wxSTC_CMD_LINESCROLLDOWN 2342 + +/// Scroll the document up, keeping the caret visible. +#define wxSTC_CMD_LINESCROLLUP 2343 + +/// Delete the selection or if no selection, the character before the caret. +/// Will not delete the character before at the start of a line. +#define wxSTC_CMD_DELETEBACKNOTLINE 2344 + +/// Move caret to first position on display line. +#define wxSTC_CMD_HOMEDISPLAY 2345 + +/// Move caret to first position on display line extending selection to +/// new caret position. +#define wxSTC_CMD_HOMEDISPLAYEXTEND 2346 + +/// Move caret to last position on display line. +#define wxSTC_CMD_LINEENDDISPLAY 2347 + +/// Move caret to last position on display line extending selection to new +/// caret position. +#define wxSTC_CMD_LINEENDDISPLAYEXTEND 2348 + +/// Like Home but when word-wrap is enabled goes first to start of display line +/// HomeDisplay, then to start of document line Home. +#define wxSTC_CMD_HOMEWRAP 2349 + +/// Like HomeExtend but when word-wrap is enabled extends first to start of display line +/// HomeDisplayExtend, then to start of document line HomeExtend. +#define wxSTC_CMD_HOMEWRAPEXTEND 2450 + +/// Like LineEnd but when word-wrap is enabled goes first to end of display line +/// LineEndDisplay, then to start of document line LineEnd. +#define wxSTC_CMD_LINEENDWRAP 2451 + +/// Like LineEndExtend but when word-wrap is enabled extends first to end of display line +/// LineEndDisplayExtend, then to start of document line LineEndExtend. +#define wxSTC_CMD_LINEENDWRAPEXTEND 2452 + +/// Like VCHome but when word-wrap is enabled goes first to start of display line +/// VCHomeDisplay, then behaves like VCHome. +#define wxSTC_CMD_VCHOMEWRAP 2453 + +/// Like VCHomeExtend but when word-wrap is enabled extends first to start of display line +/// VCHomeDisplayExtend, then behaves like VCHomeExtend. +#define wxSTC_CMD_VCHOMEWRAPEXTEND 2454 + +/// Copy the line containing the caret. +#define wxSTC_CMD_LINECOPY 2455 + +/// Move to the previous change in capitalisation. +#define wxSTC_CMD_WORDPARTLEFT 2390 + +/// Move to the previous change in capitalisation extending selection +/// to new caret position. +#define wxSTC_CMD_WORDPARTLEFTEXTEND 2391 + +/// Move to the change next in capitalisation. +#define wxSTC_CMD_WORDPARTRIGHT 2392 + +/// Move to the next change in capitalisation extending selection +/// to new caret position. +#define wxSTC_CMD_WORDPARTRIGHTEXTEND 2393 + +/// Delete back from the current position to the start of the line. +#define wxSTC_CMD_DELLINELEFT 2395 + +/// Delete forwards from the current position to the end of the line. +#define wxSTC_CMD_DELLINERIGHT 2396 + +/// Move caret down one paragraph (delimited by empty lines). +#define wxSTC_CMD_PARADOWN 2413 + +/// Extend selection down one paragraph (delimited by empty lines). +#define wxSTC_CMD_PARADOWNEXTEND 2414 + +/// Move caret up one paragraph (delimited by empty lines). +#define wxSTC_CMD_PARAUP 2415 + +/// Extend selection up one paragraph (delimited by empty lines). +#define wxSTC_CMD_PARAUPEXTEND 2416 + +/// Move caret down one line, extending rectangular selection to new caret position. +#define wxSTC_CMD_LINEDOWNRECTEXTEND 2426 + +/// Move caret up one line, extending rectangular selection to new caret position. +#define wxSTC_CMD_LINEUPRECTEXTEND 2427 + +/// Move caret left one character, extending rectangular selection to new caret position. +#define wxSTC_CMD_CHARLEFTRECTEXTEND 2428 + +/// Move caret right one character, extending rectangular selection to new caret position. +#define wxSTC_CMD_CHARRIGHTRECTEXTEND 2429 + +/// Move caret to first position on line, extending rectangular selection to new caret position. +#define wxSTC_CMD_HOMERECTEXTEND 2430 + +/// Move caret to before first visible character on line. +/// If already there move to first character on line. +/// In either case, extend rectangular selection to new caret position. +#define wxSTC_CMD_VCHOMERECTEXTEND 2431 + +/// Move caret to last position on line, extending rectangular selection to new caret position. +#define wxSTC_CMD_LINEENDRECTEXTEND 2432 + +/// Move caret one page up, extending rectangular selection to new caret position. +#define wxSTC_CMD_PAGEUPRECTEXTEND 2433 + +/// Move caret one page down, extending rectangular selection to new caret position. +#define wxSTC_CMD_PAGEDOWNRECTEXTEND 2434 + +/// Move caret to top of page, or one page up if already at top of page. +#define wxSTC_CMD_STUTTEREDPAGEUP 2435 + +/// Move caret to top of page, or one page up if already at top of page, extending selection to new caret position. +#define wxSTC_CMD_STUTTEREDPAGEUPEXTEND 2436 + +/// Move caret to bottom of page, or one page down if already at bottom of page. +#define wxSTC_CMD_STUTTEREDPAGEDOWN 2437 + +/// Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position. +#define wxSTC_CMD_STUTTEREDPAGEDOWNEXTEND 2438 + +/// Move caret left one word, position cursor at end of word. +#define wxSTC_CMD_WORDLEFTEND 2439 + +/// Move caret left one word, position cursor at end of word, extending selection to new caret position. +#define wxSTC_CMD_WORDLEFTENDEXTEND 2440 + +/// Move caret right one word, position cursor at end of word. +#define wxSTC_CMD_WORDRIGHTEND 2441 + +/// Move caret right one word, position cursor at end of word, extending selection to new caret position. +#define wxSTC_CMD_WORDRIGHTENDEXTEND 2442 + +/// Centre current line in window. +#define wxSTC_CMD_VERTICALCENTRECARET 2619 + +/// Move the selected lines up one line, shifting the line above after the selection +#define wxSTC_CMD_MOVESELECTEDLINESUP 2620 + +/// Move the selected lines down one line, shifting the line below before the selection +#define wxSTC_CMD_MOVESELECTEDLINESDOWN 2621 + +/// Scroll to start of document. +#define wxSTC_CMD_SCROLLTOSTART 2628 + +/// Scroll to end of document. +#define wxSTC_CMD_SCROLLTOEND 2629 + +/// Move caret to before first visible character on display line. +/// If already there move to first character on display line. +#define wxSTC_CMD_VCHOMEDISPLAY 2652 + +/// Like VCHomeDisplay but extending selection to new caret position. +#define wxSTC_CMD_VCHOMEDISPLAYEXTEND 2653 + +//}}} +//---------------------------------------------------------------------- + +class ScintillaWX; // forward declare +class WordList; +struct SCNotification; + +#ifndef SWIG +extern WXDLLIMPEXP_DATA_STC(const char) wxSTCNameStr[]; +class WXDLLIMPEXP_FWD_STC wxStyledTextCtrl; +class WXDLLIMPEXP_FWD_STC wxStyledTextEvent; +#endif + +//---------------------------------------------------------------------- + +class WXDLLIMPEXP_STC wxStyledTextCtrl : public wxControl, +#if wxUSE_TEXTCTRL + public wxTextCtrlIface +#else // !wxUSE_TEXTCTRL + public wxTextEntryBase +#endif // wxUSE_TEXTCTRL/!wxUSE_TEXTCTRL +{ +public: + +#ifdef SWIG + %pythonAppend wxStyledTextCtrl "self._setOORInfo(self)" + %pythonAppend wxStyledTextCtrl() "" + + wxStyledTextCtrl(wxWindow *parent, wxWindowID id=wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxString& name = wxPySTCNameStr); + %RenameCtor(PreStyledTextCtrl, wxStyledTextCtrl()); + +#else + wxStyledTextCtrl(wxWindow *parent, wxWindowID id=wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxString& name = wxSTCNameStr); + wxStyledTextCtrl() { m_swx = NULL; } + ~wxStyledTextCtrl(); + +#endif + + bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxString& name = wxSTCNameStr); + + + //---------------------------------------------------------------------- + // Generated method declaration section {{{ + + + // Add text to the document at current position. + void AddText(const wxString& text); + + // Add array of cells to document. + void AddStyledText(const wxMemoryBuffer& data); + + // Insert string at a position. + void InsertText(int pos, const wxString& text); + + // Change the text that is being inserted in response to wxSTC_MOD_INSERTCHECK + void ChangeInsertion(int length, const wxString& text); + + // Delete all text in the document. + void ClearAll(); + + // Delete a range of text in the document. + void DeleteRange(int start, int lengthDelete); + + // Set all style bytes to 0, remove all folding information. + void ClearDocumentStyle(); + + // Returns the number of bytes in the document. + int GetLength() const; + + // Returns the character byte at the position. + int GetCharAt(int pos) const; + + // Returns the position of the caret. + int GetCurrentPos() const; + + // Returns the position of the opposite end of the selection to the caret. + int GetAnchor() const; + + // Returns the style byte at the position. + int GetStyleAt(int pos) const; + + // Redoes the next action on the undo history. + void Redo() wxOVERRIDE; + + // Choose between collecting actions into the undo + // history and discarding them. + void SetUndoCollection(bool collectUndo); + + // Select all the text in the document. + void SelectAll() wxOVERRIDE; + + // Remember the current position in the undo history as the position + // at which the document was saved. + void SetSavePoint(); + + // Retrieve a buffer of cells. + wxMemoryBuffer GetStyledText(int startPos, int endPos); + + // Are there any redoable actions in the undo history? + bool CanRedo() const wxOVERRIDE; + + // Retrieve the line number at which a particular marker is located. + int MarkerLineFromHandle(int markerHandle); + + // Delete a marker. + void MarkerDeleteHandle(int markerHandle); + + // Is undo history being collected? + bool GetUndoCollection() const; + + // Are white space characters currently visible? + // Returns one of wxSTC_WS_* constants. + int GetViewWhiteSpace() const; + + // Make white space characters invisible, always visible or visible outside indentation. + void SetViewWhiteSpace(int viewWS); + + // Retrieve the current tab draw mode. + // Returns one of wxSTC_TD_* constants. + int GetTabDrawMode() const; + + // Set how tabs are drawn when visible. + void SetTabDrawMode(int tabDrawMode); + + // Find the position from a point within the window. + int PositionFromPoint(wxPoint pt) const; + + // Find the position from a point within the window but return + // wxSTC_INVALID_POSITION if not close to text. + int PositionFromPointClose(int x, int y); + + // Set caret to start of a line and ensure it is visible. + void GotoLine(int line); + + // Set caret to a position and ensure it is visible. + void GotoPos(int caret); + + // Set the selection anchor to a position. The anchor is the opposite + // end of the selection from the caret. + void SetAnchor(int anchor); + + // Retrieve the text of the line containing the caret. + #ifdef SWIG + wxString GetCurLine(int* OUTPUT); +#else + wxString GetCurLine(int* linePos=NULL); +#endif + + // Retrieve the position of the last correctly styled character. + int GetEndStyled() const; + + // Convert all line endings in the document to one mode. + void ConvertEOLs(int eolMode); + + // Retrieve the current end of line mode - one of wxSTC_EOL_CRLF, wxSTC_EOL_CR, or wxSTC_EOL_LF. + int GetEOLMode() const; + + // Set the current end of line mode. + void SetEOLMode(int eolMode); + + // Set the current styling position to start. + void StartStyling(int start); + + // Change style from current styling position for length characters to a style + // and move the current styling position to after this newly styled segment. + void SetStyling(int length, int style); + + // Is drawing done first into a buffer or direct to the screen? + bool GetBufferedDraw() const; + + // If drawing is buffered then each line of text is drawn into a bitmap buffer + // before drawing it to the screen to avoid flicker. + void SetBufferedDraw(bool buffered); + + // Change the visible size of a tab to be a multiple of the width of a space character. + void SetTabWidth(int tabWidth); + + // Retrieve the visible size of a tab. + int GetTabWidth() const; + + // Clear explicit tabstops on a line. + void ClearTabStops(int line); + + // Add an explicit tab stop for a line. + void AddTabStop(int line, int x); + + // Find the next explicit tab stop position on a line after a position. + int GetNextTabStop(int line, int x); + + // Set the code page used to interpret the bytes of the document as characters. + void SetCodePage(int codePage); + + // Is the IME displayed in a window or inline? + int GetIMEInteraction() const; + + // Choose to display the IME in a winow or inline. + void SetIMEInteraction(int imeInteraction); + + // Set the symbol used for a particular marker number, + // and optionally the fore and background colours. + void MarkerDefine(int markerNumber, int markerSymbol, + const wxColour& foreground = wxNullColour, + const wxColour& background = wxNullColour); + + // Set the foreground colour used for a particular marker number. + void MarkerSetForeground(int markerNumber, const wxColour& fore); + + // Set the background colour used for a particular marker number. + void MarkerSetBackground(int markerNumber, const wxColour& back); + + // Set the background colour used for a particular marker number when its folding block is selected. + void MarkerSetBackgroundSelected(int markerNumber, const wxColour& back); + + // Enable/disable highlight for current folding block (smallest one that contains the caret) + void MarkerEnableHighlight(bool enabled); + + // Add a marker to a line, returning an ID which can be used to find or delete the marker. + int MarkerAdd(int line, int markerNumber); + + // Delete a marker from a line. + void MarkerDelete(int line, int markerNumber); + + // Delete all markers with a particular number from all lines. + void MarkerDeleteAll(int markerNumber); + + // Get a bit mask of all the markers set on a line. + int MarkerGet(int line); + + // Find the next line at or after lineStart that includes a marker in mask. + // Return -1 when no more lines. + int MarkerNext(int lineStart, int markerMask); + + // Find the previous line before lineStart that includes a marker in mask. + int MarkerPrevious(int lineStart, int markerMask); + + // Define a marker from a bitmap + void MarkerDefinePixmap(int markerNumber, const char* const* xpmData); + + // Add a set of markers to a line. + void MarkerAddSet(int line, int markerSet); + + // Set the alpha used for a marker that is drawn in the text area, not the margin. + void MarkerSetAlpha(int markerNumber, int alpha); + + // Set a margin to be either numeric or symbolic. + void SetMarginType(int margin, int marginType); + + // Retrieve the type of a margin. + int GetMarginType(int margin) const; + + // Set the width of a margin to a width expressed in pixels. + void SetMarginWidth(int margin, int pixelWidth); + + // Retrieve the width of a margin in pixels. + int GetMarginWidth(int margin) const; + + // Set a mask that determines which markers are displayed in a margin. + void SetMarginMask(int margin, int mask); + + // Retrieve the marker mask of a margin. + int GetMarginMask(int margin) const; + + // Make a margin sensitive or insensitive to mouse clicks. + void SetMarginSensitive(int margin, bool sensitive); + + // Retrieve the mouse click sensitivity of a margin. + bool GetMarginSensitive(int margin) const; + + // Set the cursor shown when the mouse is inside a margin. + void SetMarginCursor(int margin, int cursor); + + // Retrieve the cursor shown in a margin. + int GetMarginCursor(int margin) const; + + // Set the background colour of a margin. Only visible for wxSTC_MARGIN_COLOUR. + void SetMarginBackground(int margin, const wxColour& back); + + // Retrieve the background colour of a margin + wxColour GetMarginBackground(int margin) const; + + // Allocate a non-standard number of margins. + void SetMarginCount(int margins); + + // How many margins are there?. + int GetMarginCount() const; + + // Clear all the styles and make equivalent to the global default style. + void StyleClearAll(); + + // Set the foreground colour of a style. + void StyleSetForeground(int style, const wxColour& fore); + + // Set the background colour of a style. + void StyleSetBackground(int style, const wxColour& back); + + // Set a style to be bold or not. + void StyleSetBold(int style, bool bold); + + // Set a style to be italic or not. + void StyleSetItalic(int style, bool italic); + + // Set the size of characters of a style. + void StyleSetSize(int style, int sizePoints); + + // Set the font of a style. + void StyleSetFaceName(int style, const wxString& fontName); + + // Set a style to have its end of line filled or not. + void StyleSetEOLFilled(int style, bool eolFilled); + + // Reset the default style to its state at startup + void StyleResetDefault(); + + // Set a style to be underlined or not. + void StyleSetUnderline(int style, bool underline); + + // Get the foreground colour of a style. + wxColour StyleGetForeground(int style) const; + + // Get the background colour of a style. + wxColour StyleGetBackground(int style) const; + + // Get is a style bold or not. + bool StyleGetBold(int style) const; + + // Get is a style italic or not. + bool StyleGetItalic(int style) const; + + // Get the size of characters of a style. + int StyleGetSize(int style) const; + + // Get the font facename of a style + wxString StyleGetFaceName(int style); + + // Get is a style to have its end of line filled or not. + bool StyleGetEOLFilled(int style) const; + + // Get is a style underlined or not. + bool StyleGetUnderline(int style) const; + + // Get is a style mixed case, or to force upper or lower case. + int StyleGetCase(int style) const; + + // Get the character get of the font in a style. + int StyleGetCharacterSet(int style) const; + + // Get is a style visible or not. + bool StyleGetVisible(int style) const; + + // Get is a style changeable or not (read only). + // Experimental feature, currently buggy. + bool StyleGetChangeable(int style) const; + + // Get is a style a hotspot or not. + bool StyleGetHotSpot(int style) const; + + // Set a style to be mixed case, or to force upper or lower case. + void StyleSetCase(int style, int caseVisible); + + // Set the size of characters of a style. Size is in points multiplied by 100. + void StyleSetSizeFractional(int style, int sizeHundredthPoints); + + // Get the size of characters of a style in points multiplied by 100 + int StyleGetSizeFractional(int style) const; + + // Set the weight of characters of a style. + void StyleSetWeight(int style, int weight); + + // Get the weight of characters of a style. + int StyleGetWeight(int style) const; + + // Set the character set of the font in a style. + void StyleSetCharacterSet(int style, int characterSet); + + // Set a style to be a hotspot or not. + void StyleSetHotSpot(int style, bool hotspot); + + // Set the foreground colour of the main and additional selections and whether to use this setting. + void SetSelForeground(bool useSetting, const wxColour& fore); + + // Set the background colour of the main and additional selections and whether to use this setting. + void SetSelBackground(bool useSetting, const wxColour& back); + + // Get the alpha of the selection. + int GetSelAlpha() const; + + // Set the alpha of the selection. + void SetSelAlpha(int alpha); + + // Is the selection end of line filled? + bool GetSelEOLFilled() const; + + // Set the selection to have its end of line filled or not. + void SetSelEOLFilled(bool filled); + + // Set the foreground colour of the caret. + void SetCaretForeground(const wxColour& fore); + + // When key+modifier combination keyDefinition is pressed perform sciCommand. + void CmdKeyAssign(int key, int modifiers, int cmd); + + // When key+modifier combination keyDefinition is pressed do nothing. + void CmdKeyClear(int key, int modifiers); + + // Drop all key mappings. + void CmdKeyClearAll(); + + // Set the styles for a segment of the document. + void SetStyleBytes(int length, char* styleBytes); + + // Set a style to be visible or not. + void StyleSetVisible(int style, bool visible); + + // Get the time in milliseconds that the caret is on and off. + int GetCaretPeriod() const; + + // Get the time in milliseconds that the caret is on and off. 0 = steady on. + void SetCaretPeriod(int periodMilliseconds); + + // Set the set of characters making up words for when moving or selecting by word. + // First sets defaults like SetCharsDefault. + void SetWordChars(const wxString& characters); + + // Get the set of characters making up words for when moving or selecting by word. + wxString GetWordChars() const; + + // Start a sequence of actions that is undone and redone as a unit. + // May be nested. + void BeginUndoAction(); + + // End a sequence of actions that is undone and redone as a unit. + void EndUndoAction(); + + // Set an indicator to plain, squiggle or TT. + void IndicatorSetStyle(int indicator, int indicatorStyle); + + // Retrieve the style of an indicator. + int IndicatorGetStyle(int indicator) const; + + // Set the foreground colour of an indicator. + void IndicatorSetForeground(int indicator, const wxColour& fore); + + // Retrieve the foreground colour of an indicator. + wxColour IndicatorGetForeground(int indicator) const; + + // Set an indicator to draw under text or over(default). + void IndicatorSetUnder(int indicator, bool under); + + // Retrieve whether indicator drawn under or over text. + bool IndicatorGetUnder(int indicator) const; + + // Set a hover indicator to plain, squiggle or TT. + void IndicatorSetHoverStyle(int indicator, int indicatorStyle); + + // Retrieve the hover style of an indicator. + int IndicatorGetHoverStyle(int indicator) const; + + // Set the foreground hover colour of an indicator. + void IndicatorSetHoverForeground(int indicator, const wxColour& fore); + + // Retrieve the foreground hover colour of an indicator. + wxColour IndicatorGetHoverForeground(int indicator) const; + + // Set the attributes of an indicator. + void IndicatorSetFlags(int indicator, int flags); + + // Retrieve the attributes of an indicator. + int IndicatorGetFlags(int indicator) const; + + // Set the foreground colour of all whitespace and whether to use this setting. + void SetWhitespaceForeground(bool useSetting, const wxColour& fore); + + // Set the background colour of all whitespace and whether to use this setting. + void SetWhitespaceBackground(bool useSetting, const wxColour& back); + + // Set the size of the dots used to mark space characters. + void SetWhitespaceSize(int size); + + // Get the size of the dots used to mark space characters. + int GetWhitespaceSize() const; + + // Divide each styling byte into lexical class bits (default: 5) and indicator + // bits (default: 3). If a lexer requires more than 32 lexical states, then this + // is used to expand the possible states. + wxDEPRECATED_MSG( "This method uses a function deprecated in the Scintilla library." ) + void SetStyleBits(int bits); + + // Retrieve number of bits in style bytes used to hold the lexical state. + wxDEPRECATED_MSG( "This method uses a function deprecated in the Scintilla library." ) + int GetStyleBits() const; + + // Used to hold extra styling information for each line. + void SetLineState(int line, int state); + + // Retrieve the extra styling information for a line. + int GetLineState(int line) const; + + // Retrieve the last line number that has line state. + int GetMaxLineState() const; + + // Is the background of the line containing the caret in a different colour? + bool GetCaretLineVisible() const; + + // Display the background of the line containing the caret in a different colour. + void SetCaretLineVisible(bool show); + + // Get the colour of the background of the line containing the caret. + wxColour GetCaretLineBackground() const; + + // Set the colour of the background of the line containing the caret. + void SetCaretLineBackground(const wxColour& back); + + // Set a style to be changeable or not (read only). + // Experimental feature, currently buggy. + void StyleSetChangeable(int style, bool changeable); + + // Display an auto-completion list. + // The lengthEntered parameter indicates how many characters before + // the caret should be used to provide context. + void AutoCompShow(int lengthEntered, const wxString& itemList); + + // Remove the auto-completion list from the screen. + void AutoCompCancel(); + + // Is there an auto-completion list visible? + bool AutoCompActive(); + + // Retrieve the position of the caret when the auto-completion list was displayed. + int AutoCompPosStart(); + + // User has selected an item so remove the list and insert the selection. + void AutoCompComplete(); + + // Define a set of character that when typed cancel the auto-completion list. + void AutoCompStops(const wxString& characterSet); + + // Change the separator character in the string setting up an auto-completion list. + // Default is space but can be changed if items contain space. + void AutoCompSetSeparator(int separatorCharacter); + + // Retrieve the auto-completion list separator character. + int AutoCompGetSeparator() const; + + // Select the item in the auto-completion list that starts with a string. + void AutoCompSelect(const wxString& select); + + // Should the auto-completion list be cancelled if the user backspaces to a + // position before where the box was created. + void AutoCompSetCancelAtStart(bool cancel); + + // Retrieve whether auto-completion cancelled by backspacing before start. + bool AutoCompGetCancelAtStart() const; + + // Define a set of characters that when typed will cause the autocompletion to + // choose the selected item. + void AutoCompSetFillUps(const wxString& characterSet); + + // Should a single item auto-completion list automatically choose the item. + void AutoCompSetChooseSingle(bool chooseSingle); + + // Retrieve whether a single item auto-completion list automatically choose the item. + bool AutoCompGetChooseSingle() const; + + // Set whether case is significant when performing auto-completion searches. + void AutoCompSetIgnoreCase(bool ignoreCase); + + // Retrieve state of ignore case flag. + bool AutoCompGetIgnoreCase() const; + + // Display a list of strings and send notification when user chooses one. + void UserListShow(int listType, const wxString& itemList); + + // Set whether or not autocompletion is hidden automatically when nothing matches. + void AutoCompSetAutoHide(bool autoHide); + + // Retrieve whether or not autocompletion is hidden automatically when nothing matches. + bool AutoCompGetAutoHide() const; + + // Set whether or not autocompletion deletes any word characters + // after the inserted text upon completion. + void AutoCompSetDropRestOfWord(bool dropRestOfWord); + + // Retrieve whether or not autocompletion deletes any word characters + // after the inserted text upon completion. + bool AutoCompGetDropRestOfWord() const; + + // Register an image for use in autocompletion lists. + void RegisterImage(int type, const char* const* xpmData); + + // Clear all the registered images. + void ClearRegisteredImages(); + + // Retrieve the auto-completion list type-separator character. + int AutoCompGetTypeSeparator() const; + + // Change the type-separator character in the string setting up an auto-completion list. + // Default is '?' but can be changed if items contain '?'. + void AutoCompSetTypeSeparator(int separatorCharacter); + + // Set the maximum width, in characters, of auto-completion and user lists. + // Set to 0 to autosize to fit longest item, which is the default. + void AutoCompSetMaxWidth(int characterCount); + + // Get the maximum width, in characters, of auto-completion and user lists. + int AutoCompGetMaxWidth() const; + + // Set the maximum height, in rows, of auto-completion and user lists. + // The default is 5 rows. + void AutoCompSetMaxHeight(int rowCount); + + // Set the maximum height, in rows, of auto-completion and user lists. + int AutoCompGetMaxHeight() const; + + // Set the number of spaces used for one level of indentation. + void SetIndent(int indentSize); + + // Retrieve indentation size. + int GetIndent() const; + + // Indentation will only use space characters if useTabs is false, otherwise + // it will use a combination of tabs and spaces. + void SetUseTabs(bool useTabs); + + // Retrieve whether tabs will be used in indentation. + bool GetUseTabs() const; + + // Change the indentation of a line to a number of columns. + void SetLineIndentation(int line, int indentation); + + // Retrieve the number of columns that a line is indented. + int GetLineIndentation(int line) const; + + // Retrieve the position before the first non indentation character on a line. + int GetLineIndentPosition(int line) const; + + // Retrieve the column number of a position, taking tab width into account. + int GetColumn(int pos) const; + + // Count characters between two positions. + int CountCharacters(int start, int end); + + // Show or hide the horizontal scroll bar. + void SetUseHorizontalScrollBar(bool visible); + + // Is the horizontal scroll bar visible? + bool GetUseHorizontalScrollBar() const; + + // Show or hide indentation guides. + void SetIndentationGuides(int indentView); + + // Are the indentation guides visible? + int GetIndentationGuides() const; + + // Set the highlighted indentation guide column. + // 0 = no highlighted guide. + void SetHighlightGuide(int column); + + // Get the highlighted indentation guide column. + int GetHighlightGuide() const; + + // Get the position after the last visible characters on a line. + int GetLineEndPosition(int line) const; + + // Get the code page used to interpret the bytes of the document as characters. + int GetCodePage() const; + + // Get the foreground colour of the caret. + wxColour GetCaretForeground() const; + + // In read-only mode? + bool GetReadOnly() const; + + // Sets the position of the caret. + void SetCurrentPos(int caret); + + // Sets the position that starts the selection - this becomes the anchor. + void SetSelectionStart(int anchor); + + // Returns the position at the start of the selection. + int GetSelectionStart() const; + + // Sets the position that ends the selection - this becomes the caret. + void SetSelectionEnd(int caret); + + // Returns the position at the end of the selection. + int GetSelectionEnd() const; + + // Set caret to a position, while removing any existing selection. + void SetEmptySelection(int caret); + + // Sets the print magnification added to the point size of each style for printing. + void SetPrintMagnification(int magnification); + + // Returns the print magnification. + int GetPrintMagnification() const; + + // Modify colours when printing for clearer printed text. + void SetPrintColourMode(int mode); + + // Returns the print colour mode. + int GetPrintColourMode() const; + + // Find some text in the document. + int FindText(int minPos, int maxPos, const wxString& text, int flags=0, + int* findEnd=NULL); + + // On Windows, will draw the document into a display context such as a printer. + int FormatRange(bool doDraw, + int startPos, + int endPos, + wxDC* draw, + wxDC* target, + wxRect renderRect, + wxRect pageRect); + + // Retrieve the display line at the top of the display. + int GetFirstVisibleLine() const; + + // Retrieve the contents of a line. + wxString GetLine(int line) const; + + // Returns the number of lines in the document. There is always at least one. + int GetLineCount() const; + + // Sets the size in pixels of the left margin. + void SetMarginLeft(int pixelWidth); + + // Returns the size in pixels of the left margin. + int GetMarginLeft() const; + + // Sets the size in pixels of the right margin. + void SetMarginRight(int pixelWidth); + + // Returns the size in pixels of the right margin. + int GetMarginRight() const; + + // Is the document different from when it was last saved? + bool GetModify() const; + + // Retrieve the selected text. + wxString GetSelectedText(); + + // Retrieve a range of text. + wxString GetTextRange(int startPos, int endPos); + + // Draw the selection in normal style or with selection highlighted. + void HideSelection(bool hide); + + // Retrieve the point in the window where a position is displayed. + wxPoint PointFromPosition(int pos); + + // Retrieve the line containing a position. + int LineFromPosition(int pos) const; + + // Retrieve the position at the start of a line. + int PositionFromLine(int line) const; + + // Scroll horizontally and vertically. + void LineScroll(int columns, int lines); + + // Ensure the caret is visible. + void EnsureCaretVisible(); + + // Scroll the argument positions and the range between them into view giving + // priority to the primary position then the secondary position. + // This may be used to make a search match visible. + void ScrollRange(int secondary, int primary); + + // Replace the selected text with the argument text. + void ReplaceSelection(const wxString& text); + + // Set to read only or read write. + void SetReadOnly(bool readOnly); + + // Will a paste succeed? + bool CanPaste() const wxOVERRIDE; + + // Are there any undoable actions in the undo history? + bool CanUndo() const wxOVERRIDE; + + // Delete the undo history. + void EmptyUndoBuffer() wxOVERRIDE; + + // Undo one action in the undo history. + void Undo() wxOVERRIDE; + + // Cut the selection to the clipboard. + void Cut() wxOVERRIDE; + + // Copy the selection to the clipboard. + void Copy() wxOVERRIDE; + + // Paste the contents of the clipboard into the document replacing the selection. + void Paste() wxOVERRIDE; + + // Clear the selection. + void Clear() wxOVERRIDE; + + // Replace the contents of the document with the argument text. + void SetText(const wxString& text); + + // Retrieve all the text in the document. + wxString GetText() const; + + // Retrieve the number of characters in the document. + int GetTextLength() const; + + // Retrieve a pointer to a function that processes messages for this Scintilla. + void* GetDirectFunction() const; + + // Retrieve a pointer value to use as the first argument when calling + // the function returned by GetDirectFunction. + void* GetDirectPointer() const; + + // Set to overtype (true) or insert mode. + void SetOvertype(bool overType); + + // Returns true if overtype mode is active otherwise false is returned. + bool GetOvertype() const; + + // Set the width of the insert mode caret. + void SetCaretWidth(int pixelWidth); + + // Returns the width of the insert mode caret. + int GetCaretWidth() const; + + // Sets the position that starts the target which is used for updating the + // document without affecting the scroll position. + void SetTargetStart(int start); + + // Get the position that starts the target. + int GetTargetStart() const; + + // Sets the position that ends the target which is used for updating the + // document without affecting the scroll position. + void SetTargetEnd(int end); + + // Get the position that ends the target. + int GetTargetEnd() const; + + // Sets both the start and end of the target in one call. + void SetTargetRange(int start, int end); + + // Retrieve the text in the target. + wxString GetTargetText() const; + + // Make the target range start and end be the same as the selection range start and end. + void TargetFromSelection(); + + // Sets the target to the whole document. + void TargetWholeDocument(); + + // Replace the target text with the argument text. + // Text is counted so it can contain NULs. + // Returns the length of the replacement text. + int ReplaceTarget(const wxString& text); + + // Replace the target text with the argument text after \\d processing. + // Text is counted so it can contain NULs. + // Looks for \\d where d is between 1 and 9 and replaces these with the strings + // matched in the last search operation which were surrounded by \\( and \\). + // Returns the length of the replacement text including any change + // caused by processing the \\d patterns. + int ReplaceTargetRE(const wxString& text); + + // Search for a counted string in the target and set the target to the found + // range. Text is counted so it can contain NULs. + // Returns length of range or -1 for failure in which case target is not moved. + int SearchInTarget(const wxString& text); + + // Set the search flags used by SearchInTarget. + void SetSearchFlags(int searchFlags); + + // Get the search flags used by SearchInTarget. + int GetSearchFlags() const; + + // Show a call tip containing a definition near position pos. + void CallTipShow(int pos, const wxString& definition); + + // Remove the call tip from the screen. + void CallTipCancel(); + + // Is there an active call tip? + bool CallTipActive(); + + // Retrieve the position where the caret was before displaying the call tip. + int CallTipPosAtStart(); + + // Set the start position in order to change when backspacing removes the calltip. + void CallTipSetPosAtStart(int posStart); + + // Highlight a segment of the definition. + void CallTipSetHighlight(int highlightStart, int highlightEnd); + + // Set the background colour for the call tip. + void CallTipSetBackground(const wxColour& back); + + // Set the foreground colour for the call tip. + void CallTipSetForeground(const wxColour& fore); + + // Set the foreground colour for the highlighted part of the call tip. + void CallTipSetForegroundHighlight(const wxColour& fore); + + // Enable use of wxSTC_STYLE_CALLTIP and set call tip tab size in pixels. + void CallTipUseStyle(int tabSize); + + // Set position of calltip, above or below text. + void CallTipSetPosition(bool above); + + // Find the display line of a document line taking hidden lines into account. + int VisibleFromDocLine(int docLine); + + // Find the document line of a display line taking hidden lines into account. + int DocLineFromVisible(int displayLine); + + // The number of display lines needed to wrap a document line + int WrapCount(int docLine); + + // Set the fold level of a line. + // This encodes an integer level along with flags indicating whether the + // line is a header and whether it is effectively white space. + void SetFoldLevel(int line, int level); + + // Retrieve the fold level of a line. + int GetFoldLevel(int line) const; + + // Find the last child line of a header line. + int GetLastChild(int line, int level) const; + + // Find the parent line of a child line. + int GetFoldParent(int line) const; + + // Make a range of lines visible. + void ShowLines(int lineStart, int lineEnd); + + // Make a range of lines invisible. + void HideLines(int lineStart, int lineEnd); + + // Is a line visible? + bool GetLineVisible(int line) const; + + // Are all lines visible? + bool GetAllLinesVisible() const; + + // Show the children of a header line. + void SetFoldExpanded(int line, bool expanded); + + // Is a header line expanded? + bool GetFoldExpanded(int line) const; + + // Switch a header line between expanded and contracted. + void ToggleFold(int line); + + // Switch a header line between expanded and contracted and show some text after the line. + void ToggleFoldShowText(int line, const wxString& text); + + // Set the style of fold display text + void FoldDisplayTextSetStyle(int style); + + // Expand or contract a fold header. + void FoldLine(int line, int action); + + // Expand or contract a fold header and its children. + void FoldChildren(int line, int action); + + // Expand a fold header and all children. Use the level argument instead of the line's current level. + void ExpandChildren(int line, int level); + + // Expand or contract all fold headers. + void FoldAll(int action); + + // Ensure a particular line is visible by expanding any header line hiding it. + void EnsureVisible(int line); + + // Set automatic folding behaviours. + void SetAutomaticFold(int automaticFold); + + // Get automatic folding behaviours. + int GetAutomaticFold() const; + + // Set some style options for folding. + void SetFoldFlags(int flags); + + // Ensure a particular line is visible by expanding any header line hiding it. + // Use the currently set visibility policy to determine which range to display. + void EnsureVisibleEnforcePolicy(int line); + + // Sets whether a tab pressed when caret is within indentation indents. + void SetTabIndents(bool tabIndents); + + // Does a tab pressed when caret is within indentation indent? + bool GetTabIndents() const; + + // Sets whether a backspace pressed when caret is within indentation unindents. + void SetBackSpaceUnIndents(bool bsUnIndents); + + // Does a backspace pressed when caret is within indentation unindent? + bool GetBackSpaceUnIndents() const; + + // Sets the time the mouse must sit still to generate a mouse dwell event. + void SetMouseDwellTime(int periodMilliseconds); + + // Retrieve the time the mouse must sit still to generate a mouse dwell event. + int GetMouseDwellTime() const; + + // Get position of start of word. + int WordStartPosition(int pos, bool onlyWordCharacters); + + // Get position of end of word. + int WordEndPosition(int pos, bool onlyWordCharacters); + + // Is the range start..end considered a word? + bool IsRangeWord(int start, int end); + + // Sets limits to idle styling. + void SetIdleStyling(int idleStyling); + + // Retrieve the limits to idle styling. + int GetIdleStyling() const; + + // Sets whether text is word wrapped. + void SetWrapMode(int wrapMode); + + // Retrieve whether text is word wrapped. + int GetWrapMode() const; + + // Set the display mode of visual flags for wrapped lines. + void SetWrapVisualFlags(int wrapVisualFlags); + + // Retrieve the display mode of visual flags for wrapped lines. + int GetWrapVisualFlags() const; + + // Set the location of visual flags for wrapped lines. + void SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation); + + // Retrieve the location of visual flags for wrapped lines. + int GetWrapVisualFlagsLocation() const; + + // Set the start indent for wrapped lines. + void SetWrapStartIndent(int indent); + + // Retrieve the start indent for wrapped lines. + int GetWrapStartIndent() const; + + // Sets how wrapped sublines are placed. Default is wxSTC_WRAPINDENT_FIXED. + void SetWrapIndentMode(int wrapIndentMode); + + // Retrieve how wrapped sublines are placed. Default is wxSTC_WRAPINDENT_FIXED. + int GetWrapIndentMode() const; + + // Sets the degree of caching of layout information. + void SetLayoutCache(int cacheMode); + + // Retrieve the degree of caching of layout information. + int GetLayoutCache() const; + + // Sets the document width assumed for scrolling. + void SetScrollWidth(int pixelWidth); + + // Retrieve the document width assumed for scrolling. + int GetScrollWidth() const; + + // Sets whether the maximum width line displayed is used to set scroll width. + void SetScrollWidthTracking(bool tracking); + + // Retrieve whether the scroll width tracks wide lines. + bool GetScrollWidthTracking() const; + + // Measure the pixel width of some text in a particular style. + // Does not handle tab or control characters. + int TextWidth(int style, const wxString& text); + + // Sets the scroll range so that maximum scroll position has + // the last line at the bottom of the view (default). + // Setting this to false allows scrolling one page below the last line. + void SetEndAtLastLine(bool endAtLastLine); + + // Retrieve whether the maximum scroll position has the last + // line at the bottom of the view. + bool GetEndAtLastLine() const; + + // Retrieve the height of a particular line of text in pixels. + int TextHeight(int line); + + // Show or hide the vertical scroll bar. + void SetUseVerticalScrollBar(bool visible); + + // Is the vertical scroll bar visible? + bool GetUseVerticalScrollBar() const; + + // Append a string to the end of the document without changing the selection. + void AppendText(const wxString& text) wxOVERRIDE; + + // Is drawing done in two phases with backgrounds drawn before foregrounds? + bool GetTwoPhaseDraw() const; + + // In twoPhaseDraw mode, drawing is performed in two phases, first the background + // and then the foreground. This avoids chopping off characters that overlap the next run. + void SetTwoPhaseDraw(bool twoPhase); + + // How many phases is drawing done in? + int GetPhasesDraw() const; + + // In one phase draw, text is drawn in a series of rectangular blocks with no overlap. + // In two phase draw, text is drawn in a series of lines allowing runs to overlap horizontally. + // In multiple phase draw, each element is drawn over the whole drawing area, allowing text + // to overlap from one line to the next. + void SetPhasesDraw(int phases); + + // Choose the quality level for text. + void SetFontQuality(int fontQuality); + + // Retrieve the quality level for text. + int GetFontQuality() const; + + // Scroll so that a display line is at the top of the display. + void SetFirstVisibleLine(int displayLine); + + // Change the effect of pasting when there are multiple selections. + void SetMultiPaste(int multiPaste); + + // Retrieve the effect of pasting when there are multiple selections. + int GetMultiPaste() const; + + // Retrieve the value of a tag from a regular expression search. + wxString GetTag(int tagNumber) const; + + // Join the lines in the target. + void LinesJoin(); + + // Split the lines in the target into lines that are less wide than pixelWidth + // where possible. + void LinesSplit(int pixelWidth); + + // Set one of the colours used as a chequerboard pattern in the fold margin + void SetFoldMarginColour(bool useSetting, const wxColour& back); + + // Set the other colour used as a chequerboard pattern in the fold margin + void SetFoldMarginHiColour(bool useSetting, const wxColour& fore); + + // Move caret down one line. + void LineDown(); + + // Move caret down one line extending selection to new caret position. + void LineDownExtend(); + + // Move caret up one line. + void LineUp(); + + // Move caret up one line extending selection to new caret position. + void LineUpExtend(); + + // Move caret left one character. + void CharLeft(); + + // Move caret left one character extending selection to new caret position. + void CharLeftExtend(); + + // Move caret right one character. + void CharRight(); + + // Move caret right one character extending selection to new caret position. + void CharRightExtend(); + + // Move caret left one word. + void WordLeft(); + + // Move caret left one word extending selection to new caret position. + void WordLeftExtend(); + + // Move caret right one word. + void WordRight(); + + // Move caret right one word extending selection to new caret position. + void WordRightExtend(); + + // Move caret to first position on line. + void Home(); + + // Move caret to first position on line extending selection to new caret position. + void HomeExtend(); + + // Move caret to last position on line. + void LineEnd(); + + // Move caret to last position on line extending selection to new caret position. + void LineEndExtend(); + + // Move caret to first position in document. + void DocumentStart(); + + // Move caret to first position in document extending selection to new caret position. + void DocumentStartExtend(); + + // Move caret to last position in document. + void DocumentEnd(); + + // Move caret to last position in document extending selection to new caret position. + void DocumentEndExtend(); + + // Move caret one page up. + void PageUp(); + + // Move caret one page up extending selection to new caret position. + void PageUpExtend(); + + // Move caret one page down. + void PageDown(); + + // Move caret one page down extending selection to new caret position. + void PageDownExtend(); + + // Switch from insert to overtype mode or the reverse. + void EditToggleOvertype(); + + // Cancel any modes such as call tip or auto-completion list display. + void Cancel(); + + // Delete the selection or if no selection, the character before the caret. + void DeleteBack(); + + // If selection is empty or all on one line replace the selection with a tab character. + // If more than one line selected, indent the lines. + void Tab(); + + // Dedent the selected lines. + void BackTab(); + + // Insert a new line, may use a CRLF, CR or LF depending on EOL mode. + void NewLine(); + + // Insert a Form Feed character. + void FormFeed(); + + // Move caret to before first visible character on line. + // If already there move to first character on line. + void VCHome(); + + // Like VCHome but extending selection to new caret position. + void VCHomeExtend(); + + // Magnify the displayed text by increasing the sizes by 1 point. + void ZoomIn(); + + // Make the displayed text smaller by decreasing the sizes by 1 point. + void ZoomOut(); + + // Delete the word to the left of the caret. + void DelWordLeft(); + + // Delete the word to the right of the caret. + void DelWordRight(); + + // Delete the word to the right of the caret, but not the trailing non-word characters. + void DelWordRightEnd(); + + // Cut the line containing the caret. + void LineCut(); + + // Delete the line containing the caret. + void LineDelete(); + + // Switch the current line with the previous. + void LineTranspose(); + + // Duplicate the current line. + void LineDuplicate(); + + // Transform the selection to lower case. + void LowerCase(); + + // Transform the selection to upper case. + void UpperCase(); + + // Scroll the document down, keeping the caret visible. + void LineScrollDown(); + + // Scroll the document up, keeping the caret visible. + void LineScrollUp(); + + // Delete the selection or if no selection, the character before the caret. + // Will not delete the character before at the start of a line. + void DeleteBackNotLine(); + + // Move caret to first position on display line. + void HomeDisplay(); + + // Move caret to first position on display line extending selection to + // new caret position. + void HomeDisplayExtend(); + + // Move caret to last position on display line. + void LineEndDisplay(); + + // Move caret to last position on display line extending selection to new + // caret position. + void LineEndDisplayExtend(); + + // Like Home but when word-wrap is enabled goes first to start of display line + // HomeDisplay, then to start of document line Home. + void HomeWrap(); + + // Like HomeExtend but when word-wrap is enabled extends first to start of display line + // HomeDisplayExtend, then to start of document line HomeExtend. + void HomeWrapExtend(); + + // Like LineEnd but when word-wrap is enabled goes first to end of display line + // LineEndDisplay, then to start of document line LineEnd. + void LineEndWrap(); + + // Like LineEndExtend but when word-wrap is enabled extends first to end of display line + // LineEndDisplayExtend, then to start of document line LineEndExtend. + void LineEndWrapExtend(); + + // Like VCHome but when word-wrap is enabled goes first to start of display line + // VCHomeDisplay, then behaves like VCHome. + void VCHomeWrap(); + + // Like VCHomeExtend but when word-wrap is enabled extends first to start of display line + // VCHomeDisplayExtend, then behaves like VCHomeExtend. + void VCHomeWrapExtend(); + + // Copy the line containing the caret. + void LineCopy(); + + // Move the caret inside current view if it's not there already. + void MoveCaretInsideView(); + + // How many characters are on a line, including end of line characters? + int LineLength(int line) const; + + // Highlight the characters at two positions. + void BraceHighlight(int posA, int posB); + + // Use specified indicator to highlight matching braces instead of changing their style. + void BraceHighlightIndicator(bool useSetting, int indicator); + + // Highlight the character at a position indicating there is no matching brace. + void BraceBadLight(int pos); + + // Use specified indicator to highlight non matching brace instead of changing its style. + void BraceBadLightIndicator(bool useSetting, int indicator); + + // Find the position of a matching brace or wxSTC_INVALID_POSITION if no match. + // The maxReStyle must be 0 for now. It may be defined in a future release. + int BraceMatch(int pos, int maxReStyle=0); + + // Are the end of line characters visible? + bool GetViewEOL() const; + + // Make the end of line characters visible or invisible. + void SetViewEOL(bool visible); + + // Retrieve a pointer to the document object. + void* GetDocPointer(); + + // Change the document object used. + void SetDocPointer(void* docPointer); + + // Set which document modification events are sent to the container. + void SetModEventMask(int eventMask); + + // Retrieve the column number which text should be kept within. + int GetEdgeColumn() const; + + // Set the column number of the edge. + // If text goes past the edge then it is highlighted. + void SetEdgeColumn(int column); + + // Retrieve the edge highlight mode. + int GetEdgeMode() const; + + // The edge may be displayed by a line (wxSTC_EDGE_LINE/wxSTC_EDGE_MULTILINE) or by highlighting text that + // goes beyond it (wxSTC_EDGE_BACKGROUND) or not displayed at all (wxSTC_EDGE_NONE). + void SetEdgeMode(int edgeMode); + + // Retrieve the colour used in edge indication. + wxColour GetEdgeColour() const; + + // Change the colour used in edge indication. + void SetEdgeColour(const wxColour& edgeColour); + + // Add a new vertical edge to the view. + void MultiEdgeAddLine(int column, const wxColour& edgeColour); + + // Clear all vertical edges. + void MultiEdgeClearAll(); + + // Sets the current caret position to be the search anchor. + void SearchAnchor(); + + // Find some text starting at the search anchor. + // Does not ensure the selection is visible. + int SearchNext(int searchFlags, const wxString& text); + + // Find some text starting at the search anchor and moving backwards. + // Does not ensure the selection is visible. + int SearchPrev(int searchFlags, const wxString& text); + + // Retrieves the number of lines completely visible. + int LinesOnScreen() const; + + // Set whether a pop up menu is displayed automatically when the user presses + // the wrong mouse button on certain areas. + void UsePopUp(int popUpMode); + + // Is the selection rectangular? The alternative is the more common stream selection. + bool SelectionIsRectangle() const; + + // Set the zoom level. This number of points is added to the size of all fonts. + // It may be positive to magnify or negative to reduce. + void SetZoom(int zoomInPoints); + + // Retrieve the zoom level. + int GetZoom() const; + + // Create a new document object. + // Starts with reference count of 1 and not selected into editor. + void* CreateDocument(); + + // Extend life of document. + void AddRefDocument(void* docPointer); + + // Release a reference to the document, deleting document if it fades to black. + void ReleaseDocument(void* docPointer); + + // Get which document modification events are sent to the container. + int GetModEventMask() const; + + // Change internal focus flag. + void SetSTCFocus(bool focus); + + // Get internal focus flag. + bool GetSTCFocus() const; + + // Change error status - 0 = OK. + void SetStatus(int status); + + // Get error status. + int GetStatus() const; + + // Set whether the mouse is captured when its button is pressed. + void SetMouseDownCaptures(bool captures); + + // Get whether mouse gets captured. + bool GetMouseDownCaptures() const; + + // Set whether the mouse wheel can be active outside the window. + void SetMouseWheelCaptures(bool captures); + + // Get whether mouse wheel can be active outside the window. + bool GetMouseWheelCaptures() const; + + // Sets the cursor to one of the wxSTC_CURSOR* values. + void SetSTCCursor(int cursorType); + + // Get cursor type. + int GetSTCCursor() const; + + // Change the way control characters are displayed: + // If symbol is < 32, keep the drawn way, else, use the given character. + void SetControlCharSymbol(int symbol); + + // Get the way control characters are displayed. + int GetControlCharSymbol() const; + + // Move to the previous change in capitalisation. + void WordPartLeft(); + + // Move to the previous change in capitalisation extending selection + // to new caret position. + void WordPartLeftExtend(); + + // Move to the change next in capitalisation. + void WordPartRight(); + + // Move to the next change in capitalisation extending selection + // to new caret position. + void WordPartRightExtend(); + + // Set the way the display area is determined when a particular line + // is to be moved to by Find, FindNext, GotoLine, etc. + void SetVisiblePolicy(int visiblePolicy, int visibleSlop); + + // Delete back from the current position to the start of the line. + void DelLineLeft(); + + // Delete forwards from the current position to the end of the line. + void DelLineRight(); + + // Set the xOffset (ie, horizontal scroll position). + void SetXOffset(int xOffset); + + // Get the xOffset (ie, horizontal scroll position). + int GetXOffset() const; + + // Set the last x chosen value to be the caret x position. + void ChooseCaretX(); + + // Set the way the caret is kept visible when going sideways. + // The exclusion zone is given in pixels. + void SetXCaretPolicy(int caretPolicy, int caretSlop); + + // Set the way the line the caret is on is kept visible. + // The exclusion zone is given in lines. + void SetYCaretPolicy(int caretPolicy, int caretSlop); + + // Set printing to line wrapped (wxSTC_WRAP_WORD) or not line wrapped (wxSTC_WRAP_NONE). + void SetPrintWrapMode(int wrapMode); + + // Is printing line wrapped? + int GetPrintWrapMode() const; + + // Set a fore colour for active hotspots. + void SetHotspotActiveForeground(bool useSetting, const wxColour& fore); + + // Get the fore colour for active hotspots. + wxColour GetHotspotActiveForeground() const; + + // Set a back colour for active hotspots. + void SetHotspotActiveBackground(bool useSetting, const wxColour& back); + + // Get the back colour for active hotspots. + wxColour GetHotspotActiveBackground() const; + + // Enable / Disable underlining active hotspots. + void SetHotspotActiveUnderline(bool underline); + + // Get whether underlining for active hotspots. + bool GetHotspotActiveUnderline() const; + + // Limit hotspots to single line so hotspots on two lines don't merge. + void SetHotspotSingleLine(bool singleLine); + + // Get the HotspotSingleLine property + bool GetHotspotSingleLine() const; + + // Move caret down one paragraph (delimited by empty lines). + void ParaDown(); + + // Extend selection down one paragraph (delimited by empty lines). + void ParaDownExtend(); + + // Move caret up one paragraph (delimited by empty lines). + void ParaUp(); + + // Extend selection up one paragraph (delimited by empty lines). + void ParaUpExtend(); + + // Given a valid document position, return the previous position taking code + // page into account. Returns 0 if passed 0. + int PositionBefore(int pos); + + // Given a valid document position, return the next position taking code + // page into account. Maximum value returned is the last position in the document. + int PositionAfter(int pos); + + // Given a valid document position, return a position that differs in a number + // of characters. Returned value is always between 0 and last position in document. + int PositionRelative(int pos, int relative); + + // Copy a range of text to the clipboard. Positions are clipped into the document. + void CopyRange(int start, int end); + + // Copy argument text to the clipboard. + void CopyText(int length, const wxString& text); + + // Set the selection mode to stream (wxSTC_SEL_STREAM) or rectangular (wxSTC_SEL_RECTANGLE/wxSTC_SEL_THIN) or + // by lines (wxSTC_SEL_LINES). + void SetSelectionMode(int selectionMode); + + // Get the mode of the current selection. + int GetSelectionMode() const; + + // Retrieve the position of the start of the selection at the given line (wxSTC_INVALID_POSITION if no selection on this line). + int GetLineSelStartPosition(int line); + + // Retrieve the position of the end of the selection at the given line (wxSTC_INVALID_POSITION if no selection on this line). + int GetLineSelEndPosition(int line); + + // Move caret down one line, extending rectangular selection to new caret position. + void LineDownRectExtend(); + + // Move caret up one line, extending rectangular selection to new caret position. + void LineUpRectExtend(); + + // Move caret left one character, extending rectangular selection to new caret position. + void CharLeftRectExtend(); + + // Move caret right one character, extending rectangular selection to new caret position. + void CharRightRectExtend(); + + // Move caret to first position on line, extending rectangular selection to new caret position. + void HomeRectExtend(); + + // Move caret to before first visible character on line. + // If already there move to first character on line. + // In either case, extend rectangular selection to new caret position. + void VCHomeRectExtend(); + + // Move caret to last position on line, extending rectangular selection to new caret position. + void LineEndRectExtend(); + + // Move caret one page up, extending rectangular selection to new caret position. + void PageUpRectExtend(); + + // Move caret one page down, extending rectangular selection to new caret position. + void PageDownRectExtend(); + + // Move caret to top of page, or one page up if already at top of page. + void StutteredPageUp(); + + // Move caret to top of page, or one page up if already at top of page, extending selection to new caret position. + void StutteredPageUpExtend(); + + // Move caret to bottom of page, or one page down if already at bottom of page. + void StutteredPageDown(); + + // Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position. + void StutteredPageDownExtend(); + + // Move caret left one word, position cursor at end of word. + void WordLeftEnd(); + + // Move caret left one word, position cursor at end of word, extending selection to new caret position. + void WordLeftEndExtend(); + + // Move caret right one word, position cursor at end of word. + void WordRightEnd(); + + // Move caret right one word, position cursor at end of word, extending selection to new caret position. + void WordRightEndExtend(); + + // Set the set of characters making up whitespace for when moving or selecting by word. + // Should be called after SetWordChars. + void SetWhitespaceChars(const wxString& characters); + + // Get the set of characters making up whitespace for when moving or selecting by word. + wxString GetWhitespaceChars() const; + + // Set the set of characters making up punctuation characters + // Should be called after SetWordChars. + void SetPunctuationChars(const wxString& characters); + + // Get the set of characters making up punctuation characters + wxString GetPunctuationChars() const; + + // Reset the set of characters for whitespace and word characters to the defaults. + void SetCharsDefault(); + + // Get currently selected item position in the auto-completion list + int AutoCompGetCurrent() const; + + // Get currently selected item text in the auto-completion list + wxString AutoCompGetCurrentText() const; + + // Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference. + void AutoCompSetCaseInsensitiveBehaviour(int behaviour); + + // Get auto-completion case insensitive behaviour. + int AutoCompGetCaseInsensitiveBehaviour() const; + + // Change the effect of autocompleting when there are multiple selections. + void AutoCompSetMulti(int multi); + + // Retrieve the effect of autocompleting when there are multiple selections. + int AutoCompGetMulti() const; + + // Set the way autocompletion lists are ordered. + void AutoCompSetOrder(int order); + + // Get the way autocompletion lists are ordered. + int AutoCompGetOrder() const; + + // Enlarge the document to a particular size of text bytes. + void Allocate(int bytes); + + // Find the position of a column on a line taking into account tabs and + // multi-byte characters. If beyond end of line, return line end position. + int FindColumn(int line, int column); + + // Can the caret preferred x position only be changed by explicit movement commands? + int GetCaretSticky() const; + + // Stop the caret preferred x position changing when the user types. + void SetCaretSticky(int useCaretStickyBehaviour); + + // Switch between sticky and non-sticky: meant to be bound to a key. + void ToggleCaretSticky(); + + // Enable/Disable convert-on-paste for line endings + void SetPasteConvertEndings(bool convert); + + // Get convert-on-paste setting + bool GetPasteConvertEndings() const; + + // Duplicate the selection. If selection empty duplicate the line containing the caret. + void SelectionDuplicate(); + + // Set background alpha of the caret line. + void SetCaretLineBackAlpha(int alpha); + + // Get the background alpha of the caret line. + int GetCaretLineBackAlpha() const; + + // Set the style of the caret to be drawn. + void SetCaretStyle(int caretStyle); + + // Returns the current style of the caret. + int GetCaretStyle() const; + + // Set the indicator used for IndicatorFillRange and IndicatorClearRange + void SetIndicatorCurrent(int indicator); + + // Get the current indicator + int GetIndicatorCurrent() const; + + // Set the value used for IndicatorFillRange + void SetIndicatorValue(int value); + + // Get the current indicator value + int GetIndicatorValue() const; + + // Turn an indicator on over a range. + void IndicatorFillRange(int start, int lengthFill); + + // Turn an indicator off over a range. + void IndicatorClearRange(int start, int lengthClear); + + // Are any indicators present at pos? + int IndicatorAllOnFor(int pos); + + // What value does a particular indicator have at a position? + int IndicatorValueAt(int indicator, int pos); + + // Where does a particular indicator start? + int IndicatorStart(int indicator, int pos); + + // Where does a particular indicator end? + int IndicatorEnd(int indicator, int pos); + + // Set number of entries in position cache + void SetPositionCacheSize(int size); + + // How many entries are allocated to the position cache? + int GetPositionCacheSize() const; + + // Copy the selection, if selection empty copy the line with the caret + void CopyAllowLine(); + + // Compact the document buffer and return a read-only pointer to the + // characters in the document. + const char* GetCharacterPointer() const; + + // Return a read-only pointer to a range of characters in the document. + // May move the gap so that the range is contiguous, but will only move up + // to lengthRange bytes. + const char* GetRangePointer(int position, int rangeLength) const; + + // Return a position which, to avoid performance costs, should not be within + // the range of a call to GetRangePointer. + int GetGapPosition() const; + + // Set the alpha fill colour of the given indicator. + void IndicatorSetAlpha(int indicator, int alpha); + + // Get the alpha fill colour of the given indicator. + int IndicatorGetAlpha(int indicator) const; + + // Set the alpha outline colour of the given indicator. + void IndicatorSetOutlineAlpha(int indicator, int alpha); + + // Get the alpha outline colour of the given indicator. + int IndicatorGetOutlineAlpha(int indicator) const; + + // Set extra ascent for each line + void SetExtraAscent(int extraAscent); + + // Get extra ascent for each line + int GetExtraAscent() const; + + // Set extra descent for each line + void SetExtraDescent(int extraDescent); + + // Get extra descent for each line + int GetExtraDescent() const; + + // Which symbol was defined for markerNumber with MarkerDefine + int GetMarkerSymbolDefined(int markerNumber); + + // Set the text in the text margin for a line + void MarginSetText(int line, const wxString& text); + + // Get the text in the text margin for a line + wxString MarginGetText(int line) const; + + // Set the style number for the text margin for a line + void MarginSetStyle(int line, int style); + + // Get the style number for the text margin for a line + int MarginGetStyle(int line) const; + + // Set the style in the text margin for a line + void MarginSetStyles(int line, const wxString& styles); + + // Get the styles in the text margin for a line + wxString MarginGetStyles(int line) const; + + // Clear the margin text on all lines + void MarginTextClearAll(); + + // Get the start of the range of style numbers used for margin text + void MarginSetStyleOffset(int style); + + // Get the start of the range of style numbers used for margin text + int MarginGetStyleOffset() const; + + // Set the margin options. + void SetMarginOptions(int marginOptions); + + // Get the margin options. + int GetMarginOptions() const; + + // Set the annotation text for a line + void AnnotationSetText(int line, const wxString& text); + + // Get the annotation text for a line + wxString AnnotationGetText(int line) const; + + // Set the style number for the annotations for a line + void AnnotationSetStyle(int line, int style); + + // Get the style number for the annotations for a line + int AnnotationGetStyle(int line) const; + + // Set the annotation styles for a line + void AnnotationSetStyles(int line, const wxString& styles); + + // Get the annotation styles for a line + wxString AnnotationGetStyles(int line) const; + + // Get the number of annotation lines for a line + int AnnotationGetLines(int line) const; + + // Clear the annotations from all lines + void AnnotationClearAll(); + + // Set the visibility for the annotations for a view + void AnnotationSetVisible(int visible); + + // Get the visibility for the annotations for a view + int AnnotationGetVisible() const; + + // Get the start of the range of style numbers used for annotations + void AnnotationSetStyleOffset(int style); + + // Get the start of the range of style numbers used for annotations + int AnnotationGetStyleOffset() const; + + // Release all extended (>255) style numbers + void ReleaseAllExtendedStyles(); + + // Allocate some extended (>255) style numbers and return the start of the range + int AllocateExtendedStyles(int numberStyles); + + // Add a container action to the undo stack + void AddUndoAction(int token, int flags); + + // Find the position of a character from a point within the window. + int CharPositionFromPoint(int x, int y); + + // Find the position of a character from a point within the window. + // Return wxSTC_INVALID_POSITION if not close to text. + int CharPositionFromPointClose(int x, int y); + + // Set whether switching to rectangular mode while selecting with the mouse is allowed. + void SetMouseSelectionRectangularSwitch(bool mouseSelectionRectangularSwitch); + + // Whether switching to rectangular mode while selecting with the mouse is allowed. + bool GetMouseSelectionRectangularSwitch() const; + + // Set whether multiple selections can be made + void SetMultipleSelection(bool multipleSelection); + + // Whether multiple selections can be made + bool GetMultipleSelection() const; + + // Set whether typing can be performed into multiple selections + void SetAdditionalSelectionTyping(bool additionalSelectionTyping); + + // Whether typing can be performed into multiple selections + bool GetAdditionalSelectionTyping() const; + + // Set whether additional carets will blink + void SetAdditionalCaretsBlink(bool additionalCaretsBlink); + + // Whether additional carets will blink + bool GetAdditionalCaretsBlink() const; + + // Set whether additional carets are visible + void SetAdditionalCaretsVisible(bool additionalCaretsVisible); + + // Whether additional carets are visible + bool GetAdditionalCaretsVisible() const; + + // How many selections are there? + int GetSelections() const; + + // Is every selected range empty? + bool GetSelectionEmpty() const; + + // Clear selections to a single empty stream selection + void ClearSelections(); + + // Add a selection + int AddSelection(int caret, int anchor); + + // Drop one selection + void DropSelectionN(int selection); + + // Set the main selection + void SetMainSelection(int selection); + + // Which selection is the main selection + int GetMainSelection() const; + + // Set the caret position of the nth selection. + void SetSelectionNCaret(int selection, int caret); + + // Return the caret position of the nth selection. + int GetSelectionNCaret(int selection) const; + + // Set the anchor position of the nth selection. + void SetSelectionNAnchor(int selection, int anchor); + + // Return the anchor position of the nth selection. + int GetSelectionNAnchor(int selection) const; + + // Set the virtual space of the caret of the nth selection. + void SetSelectionNCaretVirtualSpace(int selection, int space); + + // Return the virtual space of the caret of the nth selection. + int GetSelectionNCaretVirtualSpace(int selection) const; + + // Set the virtual space of the anchor of the nth selection. + void SetSelectionNAnchorVirtualSpace(int selection, int space); + + // Return the virtual space of the anchor of the nth selection. + int GetSelectionNAnchorVirtualSpace(int selection) const; + + // Sets the position that starts the selection - this becomes the anchor. + void SetSelectionNStart(int selection, int anchor); + + // Returns the position at the start of the selection. + int GetSelectionNStart(int selection) const; + + // Sets the position that ends the selection - this becomes the currentPosition. + void SetSelectionNEnd(int selection, int caret); + + // Returns the position at the end of the selection. + int GetSelectionNEnd(int selection) const; + + // Set the caret position of the rectangular selection. + void SetRectangularSelectionCaret(int caret); + + // Return the caret position of the rectangular selection. + int GetRectangularSelectionCaret() const; + + // Set the anchor position of the rectangular selection. + void SetRectangularSelectionAnchor(int anchor); + + // Return the anchor position of the rectangular selection. + int GetRectangularSelectionAnchor() const; + + // Set the virtual space of the caret of the rectangular selection. + void SetRectangularSelectionCaretVirtualSpace(int space); + + // Return the virtual space of the caret of the rectangular selection. + int GetRectangularSelectionCaretVirtualSpace() const; + + // Set the virtual space of the anchor of the rectangular selection. + void SetRectangularSelectionAnchorVirtualSpace(int space); + + // Return the virtual space of the anchor of the rectangular selection. + int GetRectangularSelectionAnchorVirtualSpace() const; + + // Set options for virtual space behaviour. + void SetVirtualSpaceOptions(int virtualSpaceOptions); + + // Return options for virtual space behaviour. + int GetVirtualSpaceOptions() const; + + // On GTK+, allow selecting the modifier key to use for mouse-based + // rectangular selection. Often the window manager requires Alt+Mouse Drag + // for moving windows. + // Valid values are wxSTC_KEYMOD_CTRL (default), wxSTC_KEYMOD_ALT, or wxSTC_KEYMOD_SUPER. + void SetRectangularSelectionModifier(int modifier); + + // Get the modifier key used for rectangular selection. + int GetRectangularSelectionModifier() const; + + // Set the foreground colour of additional selections. + // Must have previously called SetSelFore with non-zero first argument for this to have an effect. + void SetAdditionalSelForeground(const wxColour& fore); + + // Set the background colour of additional selections. + // Must have previously called SetSelBack with non-zero first argument for this to have an effect. + void SetAdditionalSelBackground(const wxColour& back); + + // Set the alpha of the selection. + void SetAdditionalSelAlpha(int alpha); + + // Get the alpha of the selection. + int GetAdditionalSelAlpha() const; + + // Set the foreground colour of additional carets. + void SetAdditionalCaretForeground(const wxColour& fore); + + // Get the foreground colour of additional carets. + wxColour GetAdditionalCaretForeground() const; + + // Set the main selection to the next selection. + void RotateSelection(); + + // Swap that caret and anchor of the main selection. + void SwapMainAnchorCaret(); + + // Add the next occurrence of the main selection to the set of selections as main. + // If the current selection is empty then select word around caret. + void MultipleSelectAddNext(); + + // Add each occurrence of the main selection in the target to the set of selections. + // If the current selection is empty then select word around caret. + void MultipleSelectAddEach(); + + // Indicate that the internal state of a lexer has changed over a range and therefore + // there may be a need to redraw. + int ChangeLexerState(int start, int end); + + // Find the next line at or after lineStart that is a contracted fold header line. + // Return -1 when no more lines. + int ContractedFoldNext(int lineStart); + + // Centre current line in window. + void VerticalCentreCaret(); + + // Move the selected lines up one line, shifting the line above after the selection + void MoveSelectedLinesUp(); + + // Move the selected lines down one line, shifting the line below before the selection + void MoveSelectedLinesDown(); + + // Set the identifier reported as idFrom in notification messages. + void SetIdentifier(int identifier); + + // Get the identifier. + int GetIdentifier() const; + + // Set the width for future RGBA image data. + void RGBAImageSetWidth(int width); + + // Set the height for future RGBA image data. + void RGBAImageSetHeight(int height); + + // Set the scale factor in percent for future RGBA image data. + void RGBAImageSetScale(int scalePercent); + + // Define a marker from RGBA data. + // It has the width and height from RGBAImageSetWidth/Height + void MarkerDefineRGBAImage(int markerNumber, const unsigned char* pixels); + + // Register an RGBA image for use in autocompletion lists. + // It has the width and height from RGBAImageSetWidth/Height + void RegisterRGBAImage(int type, const unsigned char* pixels); + + // Scroll to start of document. + void ScrollToStart(); + + // Scroll to end of document. + void ScrollToEnd(); + + // Set the technology used. + void SetTechnology(int technology); + + // Get the tech. + int GetTechnology() const; + + // Create an ILoader*. + void* CreateLoader(int bytes) const; + + // Move caret to before first visible character on display line. + // If already there move to first character on display line. + void VCHomeDisplay(); + + // Like VCHomeDisplay but extending selection to new caret position. + void VCHomeDisplayExtend(); + + // Is the caret line always visible? + bool GetCaretLineVisibleAlways() const; + + // Sets the caret line to always visible. + void SetCaretLineVisibleAlways(bool alwaysVisible); + + // Set the line end types that the application wants to use. May not be used if incompatible with lexer or encoding. + void SetLineEndTypesAllowed(int lineEndBitSet); + + // Get the line end types currently allowed. + int GetLineEndTypesAllowed() const; + + // Get the line end types currently recognised. May be a subset of the allowed types due to lexer limitation. + int GetLineEndTypesActive() const; + + // Set the way a character is drawn. + void SetRepresentation(const wxString& encodedCharacter, const wxString& representation); + + // Set the way a character is drawn. + wxString GetRepresentation(const wxString& encodedCharacter) const; + + // Remove a character representation. + void ClearRepresentation(const wxString& encodedCharacter); + + // Start notifying the container of all key presses and commands. + void StartRecord(); + + // Stop notifying the container of all key presses and commands. + void StopRecord(); + + // Set the lexing language of the document. + void SetLexer(int lexer); + + // Retrieve the lexing language of the document. + int GetLexer() const; + + // Colourise a segment of the document using the current lexing language. + void Colourise(int start, int end); + + // Set up a value that may be used by a lexer for some optional feature. + void SetProperty(const wxString& key, const wxString& value); + + // Set up the key words used by the lexer. + void SetKeyWords(int keyWordSet, const wxString& keyWords); + + // Set the lexing language of the document based on string name. + void SetLexerLanguage(const wxString& language); + + // Load a lexer library (dll / so). + void LoadLexerLibrary(const wxString& path); + + // Retrieve a "property" value previously set with SetProperty. + wxString GetProperty(const wxString& key); + + // Retrieve a "property" value previously set with SetProperty, + // with "$()" variable replacement on returned buffer. + wxString GetPropertyExpanded(const wxString& key); + + // Retrieve a "property" value previously set with SetProperty, + // interpreted as an int AFTER any "$()" variable replacement. + int GetPropertyInt(const wxString &key, int defaultValue=0) const; + + // Retrieve the number of bits the current lexer needs for styling. + wxDEPRECATED_MSG( "This method uses a function deprecated in the Scintilla library." ) + int GetStyleBitsNeeded() const; + + // Retrieve the lexing language of the document. + wxString GetLexerLanguage() const; + + // For private communication between an application and a known lexer. + void* PrivateLexerCall(int operation, void* pointer); + + // Retrieve a '\\n' separated list of properties understood by the current lexer. + wxString PropertyNames() const; + + // Retrieve the type of a property. + int PropertyType(const wxString& name); + + // Describe a property. + wxString DescribeProperty(const wxString& name) const; + + // Retrieve a '\\n' separated list of descriptions of the keyword sets understood by the current lexer. + wxString DescribeKeyWordSets() const; + + // Bit set of LineEndType enumertion for which line ends beyond the standard + // LF, CR, and CRLF are supported by the lexer. + int GetLineEndTypesSupported() const; + + // Allocate a set of sub styles for a particular base style, returning start of range + int AllocateSubStyles(int styleBase, int numberStyles); + + // The starting style number for the sub styles associated with a base style + int GetSubStylesStart(int styleBase) const; + + // The number of sub styles associated with a base style + int GetSubStylesLength(int styleBase) const; + + // For a sub style, return the base style, else return the argument. + int GetStyleFromSubStyle(int subStyle) const; + + // For a secondary style, return the primary style, else return the argument. + int GetPrimaryStyleFromStyle(int style) const; + + // Free allocated sub styles + void FreeSubStyles(); + + // Set the identifiers that are shown in a particular style + void SetIdentifiers(int style, const wxString& identifiers); + + // Where styles are duplicated by a feature such as active/inactive code + // return the distance between the two types. + int DistanceToSecondaryStyles() const; + + // Get the set of base styles that can be extended with sub styles + wxString GetSubStyleBases() const; + + //}}} + //---------------------------------------------------------------------- + + // Manually declared methods + + // Returns the line number of the line with the caret. + int GetCurrentLine(); + + // Extract style settings from a spec-string which is composed of one or + // more of the following comma separated elements: + // + // bold turns on bold + // italic turns on italics + // fore:[name or #RRGGBB] sets the foreground colour + // back:[name or #RRGGBB] sets the background colour + // face:[facename] sets the font face name to use + // size:[num] sets the font size in points + // eol turns on eol filling + // underline turns on underlining + // + void StyleSetSpec(int styleNum, const wxString& spec); + + + // Get the font of a style. + wxFont StyleGetFont(int style); + + + // Set style size, face, bold, italic, and underline attributes from + // a wxFont's attributes. + void StyleSetFont(int styleNum, const wxFont& font); + + + + // Set all font style attributes at once. + void StyleSetFontAttr(int styleNum, int size, + const wxString& faceName, + bool bold, bool italic, + bool underline, + wxFontEncoding encoding=wxFONTENCODING_DEFAULT); + + + // Set the font encoding to be used by a style. + void StyleSetFontEncoding(int style, wxFontEncoding encoding); + + + // Perform one of the operations defined by the wxSTC_CMD_* constants. + void CmdKeyExecute(int cmd); + + + // Set the left and right margin in the edit area, measured in pixels. + void SetMargins(int left, int right); + + + // Scroll enough to make the given line visible + void ScrollToLine(int line); + + + // Scroll enough to make the given column visible + void ScrollToColumn(int column); + + + // Send a message to Scintilla + // + // NB: this method is not really const as it can modify the control but it + // has to be declared as such as it's called from both const and + // non-const methods and we can't distinguish between the two + wxIntPtr SendMsg(int msg, wxUIntPtr wp=0, wxIntPtr lp=0) const; + + + // Set the vertical scrollbar to use instead of the one that's built-in. + void SetVScrollBar(wxScrollBar* bar); + + + // Set the horizontal scrollbar to use instead of the one that's built-in. + void SetHScrollBar(wxScrollBar* bar); + + // Can be used to prevent the EVT_CHAR handler from adding the char + bool GetLastKeydownProcessed() { return m_lastKeyDownConsumed; } + void SetLastKeydownProcessed(bool val) { m_lastKeyDownConsumed = val; } + + // if we derive from wxTextAreaBase it already provides these methods +#if !wxUSE_TEXTCTRL + // Write the contents of the editor to filename + bool SaveFile(const wxString& filename); + + // Load the contents of filename into the editor + bool LoadFile(const wxString& filename); +#endif // !wxUSE_TEXTCTRL + +#ifdef STC_USE_DND + // Allow for simulating a DnD DragEnter + wxDragResult DoDragEnter(wxCoord x, wxCoord y, wxDragResult def); + + // Allow for simulating a DnD DragOver + wxDragResult DoDragOver(wxCoord x, wxCoord y, wxDragResult def); + + // Allow for simulating a DnD DragLeave + void DoDragLeave(); + + // Allow for simulating a DnD DropText + bool DoDropText(long x, long y, const wxString& data); +#endif + + // Specify whether anti-aliased fonts should be used. Will have no effect + // on some platforms, but on some (wxMac for example) can greatly improve + // performance. + void SetUseAntiAliasing(bool useAA); + + // Returns the current UseAntiAliasing setting. + bool GetUseAntiAliasing(); + + // Clear annotations from the given line. + void AnnotationClearLine(int line); + + // Define a marker from a bitmap. + void MarkerDefineBitmap(int markerNumber, const wxBitmap& bmp); + + // Register an image for use in autocompletion lists. + void RegisterImage(int type, const wxBitmap& bmp); + + + + // The following methods are nearly equivalent to their similarly named + // cousins above. The difference is that these methods bypass wxString + // and always use a char* even if used in a unicode build of wxWidgets. + // In that case the character data will be utf-8 encoded since that is + // what is used internally by Scintilla in unicode builds. + + // Add text to the document at current position. + void AddTextRaw(const char* text, int length=-1); + + // Insert string at a position. + void InsertTextRaw(int pos, const char* text); + + // Retrieve the text of the line containing the caret. + // Returns the index of the caret on the line. +#ifdef SWIG + wxCharBuffer GetCurLineRaw(int* OUTPUT); +#else + wxCharBuffer GetCurLineRaw(int* linePos=NULL); +#endif + + // Retrieve the contents of a line. + wxCharBuffer GetLineRaw(int line); + + // Retrieve the selected text. + wxCharBuffer GetSelectedTextRaw(); + + // Retrieve the target text. + wxCharBuffer GetTargetTextRaw(); + + // Retrieve a range of text. + wxCharBuffer GetTextRangeRaw(int startPos, int endPos); + + // Replace the contents of the document with the argument text. + void SetTextRaw(const char* text); + + // Retrieve all the text in the document. + wxCharBuffer GetTextRaw(); + + // Append a string to the end of the document without changing the selection. + void AppendTextRaw(const char* text, int length=-1); + + // Replace the selected text with the argument text. + void ReplaceSelectionRaw(const char* text); + + // Replace the target text with the argument text. + int ReplaceTargetRaw(const char* text, int length=-1); + + // Replace the target text with the argument text after \d processing. + int ReplaceTargetRERaw(const char* text, int length=-1); + +#ifdef SWIG + %pythoncode "_stc_utf8_methods.py" +#endif + + + // implement wxTextEntryBase pure virtual methods + // ---------------------------------------------- + + virtual void WriteText(const wxString& text) wxOVERRIDE + { + ReplaceSelection(text); + } + + virtual void Remove(long from, long to) wxOVERRIDE + { + Replace(from, to, wxString()); + } + virtual void Replace(long from, long to, const wxString& text) wxOVERRIDE + { + SetTargetStart((int)from); + SetTargetEnd((int)to); + ReplaceTarget(text); + } + + /* + These functions are already declared in the generated section. + + 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) wxOVERRIDE + { + SetCurrentPos(int(pos == -1 ? GetLastPosition() : pos)); + } + virtual long GetInsertionPoint() const wxOVERRIDE { return GetCurrentPos(); } + virtual long GetLastPosition() const wxOVERRIDE { return GetTextLength(); } + + virtual void SetSelection(long from, long to) wxOVERRIDE + { + if ( from == -1 && to == -1 ) + { + SelectAll(); + } + else + { + SetSelectionStart((int)from); + SetSelectionEnd((int)to); + } + } + + virtual void SelectNone() wxOVERRIDE + { + ClearSelections(); + } + +#ifdef SWIG + void GetSelection(long* OUTPUT, long* OUTPUT) const; +#else + virtual void GetSelection(long *from, long *to) const wxOVERRIDE + { + if ( from ) + *from = GetSelectionStart(); + if ( to ) + *to = GetSelectionEnd(); + } + + // kept for compatibility only + void GetSelection(int *from, int *to) + { + long f, t; + GetSelection(&f, &t); + if ( from ) + *from = (int)f; + if ( to ) + *to = (int)t; + } +#endif + + virtual bool IsEditable() const wxOVERRIDE { return !GetReadOnly(); } + virtual void SetEditable(bool editable) wxOVERRIDE { SetReadOnly(!editable); } + + // implement wxTextAreaBase pure virtual methods + // --------------------------------------------- + + virtual int GetLineLength(long lineNo) const wxOVERRIDE + { + if ( lineNo < 0 || lineNo >= GetNumberOfLines() ) + return -1; + + return static_cast<int>(GetLineText(lineNo).length()); + } + + virtual wxString GetLineText(long lineNo) const wxOVERRIDE + { + wxString text = GetLine(static_cast<int>(lineNo)); + size_t lastNewLine = text.find_last_not_of(wxS("\r\n")); + + if ( lastNewLine != wxString::npos ) + text.erase(lastNewLine + 1); // remove trailing cr+lf + else + text.clear(); + return text; + } + virtual int GetNumberOfLines() const wxOVERRIDE { return GetLineCount(); } + + virtual bool IsModified() const wxOVERRIDE { return GetModify(); } + virtual void MarkDirty() wxOVERRIDE { wxFAIL_MSG("not implemented"); } + virtual void DiscardEdits() wxOVERRIDE { SetSavePoint(); } + + virtual bool SetStyle(long WXUNUSED(start), long WXUNUSED(end), + const wxTextAttr& WXUNUSED(style)) wxOVERRIDE + { + wxFAIL_MSG("not implemented"); + + return false; + } + + virtual bool GetStyle(long WXUNUSED(position), wxTextAttr& WXUNUSED(style)) wxOVERRIDE + { + wxFAIL_MSG("not implemented"); + + return false; + } + + virtual bool SetDefaultStyle(const wxTextAttr& WXUNUSED(style)) wxOVERRIDE + { + wxFAIL_MSG("not implemented"); + + return false; + } + + virtual long XYToPosition(long x, long y) const wxOVERRIDE + { + long pos = PositionFromLine((int)y); + if ( pos == -1 ) + return -1; + + if ( x >= LineLength(y) ) + return -1; + + pos += x; + return pos; + } + + virtual bool PositionToXY(long pos, long *x, long *y) const wxOVERRIDE + { + int l = LineFromPosition((int)pos); + if ( l == -1 ) + return false; + + int lx = pos - PositionFromLine(l); + if ( lx >= LineLength(l) ) + return false; + + if ( x ) + *x = lx; + + if ( y ) + *y = l; + + return true; + } + + virtual void ShowPosition(long pos) wxOVERRIDE { GotoPos((int)pos); } + + using wxWindow::HitTest; + + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const wxOVERRIDE + { + const long l = PositionFromPoint(pt); + if ( l == -1 ) + return wxTE_HT_BELOW; // we don't really know where it was + + if ( pos ) + *pos = l; + + return wxTE_HT_ON_TEXT; + } + + // just unhide it + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, + wxTextCoord *col, + wxTextCoord *row) const wxOVERRIDE + { + return wxTextAreaBase::HitTest(pt, col, row); + } + + // methods deprecated due to changes in the scintilla library + // --------------------------------------------- +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_MSG("use UsePopUp(int) instead.") + void UsePopUp(bool allowPopUp); + + wxDEPRECATED_MSG("use StartStyling(int start) instead.") + void StartStyling(int start, int unused); +#endif // WXWIN_COMPATIBILITY_3_0 + + static wxVersionInfo GetLibraryVersionInfo(); + +protected: + virtual void DoSetValue(const wxString& value, int flags) wxOVERRIDE; + virtual wxString DoGetValue() const wxOVERRIDE { return GetText(); } + virtual wxWindow *GetEditableWindow() wxOVERRIDE { return this; } + +#ifndef SWIG + virtual bool DoLoadFile(const wxString& file, int fileType) wxOVERRIDE; + virtual bool DoSaveFile(const wxString& file, int fileType) wxOVERRIDE; + + // Event handlers + void OnPaint(wxPaintEvent& evt); + void OnScrollWin(wxScrollWinEvent& evt); + void OnScroll(wxScrollEvent& evt); + void OnSize(wxSizeEvent& evt); + void OnMouseLeftDown(wxMouseEvent& evt); + void OnMouseRightDown(wxMouseEvent& evt); + void OnMouseMove(wxMouseEvent& evt); + void OnMouseLeftUp(wxMouseEvent& evt); + void OnMouseMiddleUp(wxMouseEvent& evt); + void OnContextMenu(wxContextMenuEvent& evt); + void OnMouseWheel(wxMouseEvent& evt); + void OnChar(wxKeyEvent& evt); + void OnKeyDown(wxKeyEvent& evt); + void OnLoseFocus(wxFocusEvent& evt); + void OnGainFocus(wxFocusEvent& evt); + void OnDPIChanged(wxDPIChangedEvent& evt); + void OnSysColourChanged(wxSysColourChangedEvent& evt); + void OnEraseBackground(wxEraseEvent& evt); + void OnMenu(wxCommandEvent& evt); + void OnListBox(wxCommandEvent& evt); + void OnIdle(wxIdleEvent& evt); + void OnMouseCaptureLost(wxMouseCaptureLostEvent& evt); + + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + // Turn notifications from Scintilla into events + void NotifyChange(); + void NotifyParent(SCNotification* scn); + +#ifdef __WXMSW__ + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) wxOVERRIDE; +#endif // __WXMSW__ + +private: + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxStyledTextCtrl); + +protected: + + ScintillaWX* m_swx; + wxStopWatch m_stopWatch; + wxScrollBar* m_vScrollBar; + wxScrollBar* m_hScrollBar; + + bool m_lastKeyDownConsumed; + + friend class ScintillaWX; + friend class Platform; +#endif // !SWIG +}; + +//---------------------------------------------------------------------- + +class WXDLLIMPEXP_STC wxStyledTextEvent : public wxCommandEvent { +public: + wxStyledTextEvent(wxEventType commandType=0, int id=0); +#ifndef SWIG + wxStyledTextEvent(const wxStyledTextEvent& event); +#endif + ~wxStyledTextEvent() {} + + void SetPosition(int pos) { m_position = pos; } + void SetKey(int k) { m_key = k; } + void SetModifiers(int m) { m_modifiers = m; } + void SetModificationType(int t) { m_modificationType = t; } + // Kept for backwards compatibility, use SetString(). + void SetText(const wxString& t) { SetString(t); } + void SetLength(int len) { m_length = len; } + void SetLinesAdded(int num) { m_linesAdded = num; } + void SetLine(int val) { m_line = val; } + void SetFoldLevelNow(int val) { m_foldLevelNow = val; } + void SetFoldLevelPrev(int val) { m_foldLevelPrev = val; } + void SetMargin(int val) { m_margin = val; } + void SetMessage(int val) { m_message = val; } + void SetWParam(int val) { m_wParam = val; } + void SetLParam(int val) { m_lParam = val; } + void SetListType(int val) { m_listType = val; } + void SetX(int val) { m_x = val; } + void SetY(int val) { m_y = val; } + void SetToken(int val) { m_token = val; } + void SetAnnotationLinesAdded(int val) { m_annotationLinesAdded = val; } + void SetUpdated(int val) { m_updated = val; } + void SetListCompletionMethod(int val) { m_listCompletionMethod = val; } +#ifdef STC_USE_DND + // Kept for backwards compatibility, use SetString(). + void SetDragText(const wxString& val) { SetString(val); } + void SetDragFlags(int flags) { m_dragFlags = flags; } + void SetDragResult(wxDragResult val) { m_dragResult = val; } + + // This method is kept mainly for backwards compatibility, use + // SetDragFlags() in the new code. + void SetDragAllowMove(bool allow) + { + if ( allow ) + m_dragFlags |= wxDrag_AllowMove; + else + m_dragFlags &= ~(wxDrag_AllowMove | wxDrag_DefaultMove); + } +#endif + + int GetPosition() const { return m_position; } + int GetKey() const { return m_key; } + int GetModifiers() const { return m_modifiers; } + int GetModificationType() const { return m_modificationType; } + // Kept for backwards compatibility, use GetString(). + wxString GetText() const { return GetString(); } + int GetLength() const { return m_length; } + int GetLinesAdded() const { return m_linesAdded; } + int GetLine() const { return m_line; } + int GetFoldLevelNow() const { return m_foldLevelNow; } + int GetFoldLevelPrev() const { return m_foldLevelPrev; } + int GetMargin() const { return m_margin; } + int GetMessage() const { return m_message; } + int GetWParam() const { return m_wParam; } + int GetLParam() const { return m_lParam; } + int GetListType() const { return m_listType; } + int GetX() const { return m_x; } + int GetY() const { return m_y; } + int GetToken() const { return m_token; } + int GetAnnotationsLinesAdded() const { return m_annotationLinesAdded; } + int GetUpdated() const { return m_updated; } + int GetListCompletionMethod() const { return m_listCompletionMethod; } + +#ifdef STC_USE_DND + // Kept for backwards compatibility, use GetString(). + wxString GetDragText() { return GetString(); } + int GetDragFlags() { return m_dragFlags; } + wxDragResult GetDragResult() { return m_dragResult; } + + bool GetDragAllowMove() { return (GetDragFlags() & wxDrag_AllowMove) != 0; } +#endif + + bool GetShift() const; + bool GetControl() const; + bool GetAlt() const; + + virtual wxEvent* Clone() const wxOVERRIDE { return new wxStyledTextEvent(*this); } + +#ifndef SWIG +private: + wxDECLARE_DYNAMIC_CLASS(wxStyledTextEvent); + + int m_position; + int m_key; + int m_modifiers; + + int m_modificationType; // wxEVT_STC_MODIFIED + int m_length; + int m_linesAdded; + int m_line; + int m_foldLevelNow; + int m_foldLevelPrev; + + int m_margin; // wxEVT_STC_MARGINCLICK + + int m_message; // wxEVT_STC_MACRORECORD + int m_wParam; + int m_lParam; + + int m_listType; + int m_x; + int m_y; + + int m_token; // wxEVT_STC__MODIFIED with SC_MOD_CONTAINER + int m_annotationLinesAdded; // wxEVT_STC_MODIFIED with SC_MOD_CHANGEANNOTATION + int m_updated; // wxEVT_STC_UPDATEUI + int m_listCompletionMethod; + +#if wxUSE_DRAG_AND_DROP + int m_dragFlags; // wxEVT_STC_START_DRAG + wxDragResult m_dragResult; // wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP +#endif +#endif +}; + + + +#ifndef SWIG +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CHANGE, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_STYLENEEDED, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CHARADDED, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_SAVEPOINTREACHED, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_SAVEPOINTLEFT, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_ROMODIFYATTEMPT, wxStyledTextEvent ); +#if WXWIN_COMPATIBILITY_3_0 +wxDEPRECATED_MSG( "Don't handle wxEVT_STC_KEY. It's never generated." ) \ + wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_KEY, wxStyledTextEvent ); +#endif // WXWIN_COMPATIBILITY_3_0 +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_DOUBLECLICK, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_UPDATEUI, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_MODIFIED, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_MACRORECORD, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_MARGINCLICK, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_NEEDSHOWN, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_PAINTED, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_USERLISTSELECTION, wxStyledTextEvent ); +#if WXWIN_COMPATIBILITY_3_0 +wxDEPRECATED_MSG( "Don't handle wxEVT_STC_URIDROPPED. It's never generated." ) \ + wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_URIDROPPED, wxStyledTextEvent ); +#endif // WXWIN_COMPATIBILITY_3_0 +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_DWELLSTART, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_DWELLEND, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_START_DRAG, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_DRAG_OVER, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_DO_DROP, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_ZOOM, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_HOTSPOT_CLICK, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_HOTSPOT_DCLICK, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CALLTIP_CLICK, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_SELECTION, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_INDICATOR_CLICK, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_INDICATOR_RELEASE, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_CANCELLED, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_CHAR_DELETED, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_HOTSPOT_RELEASE_CLICK, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CLIPBOARD_COPY, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CLIPBOARD_PASTE, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_COMPLETED, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_MARGIN_RIGHT_CLICK, wxStyledTextEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_SELECTION_CHANGE, wxStyledTextEvent ); + +#else + enum { + wxEVT_STC_CHANGE, + wxEVT_STC_STYLENEEDED, + wxEVT_STC_CHARADDED, + wxEVT_STC_SAVEPOINTREACHED, + wxEVT_STC_SAVEPOINTLEFT, + wxEVT_STC_ROMODIFYATTEMPT, +#if WXWIN_COMPATIBILITY_3_0 + wxEVT_STC_KEY, // deprecated +#endif // WXWIN_COMPATIBILITY_3_0 + wxEVT_STC_DOUBLECLICK, + wxEVT_STC_UPDATEUI, + wxEVT_STC_MODIFIED, + wxEVT_STC_MACRORECORD, + wxEVT_STC_MARGINCLICK, + wxEVT_STC_NEEDSHOWN, + wxEVT_STC_PAINTED, + wxEVT_STC_USERLISTSELECTION, +#if WXWIN_COMPATIBILITY_3_0 + wxEVT_STC_URIDROPPED, // deprecated +#endif // WXWIN_COMPATIBILITY_3_0 + wxEVT_STC_DWELLSTART, + wxEVT_STC_DWELLEND, + wxEVT_STC_START_DRAG, + wxEVT_STC_DRAG_OVER, + wxEVT_STC_DO_DROP, + wxEVT_STC_ZOOM, + wxEVT_STC_HOTSPOT_CLICK, + wxEVT_STC_HOTSPOT_DCLICK, + wxEVT_STC_CALLTIP_CLICK, + wxEVT_STC_AUTOCOMP_SELECTION, + wxEVT_STC_INDICATOR_CLICK, + wxEVT_STC_INDICATOR_RELEASE, + wxEVT_STC_AUTOCOMP_CANCELLED, + wxEVT_STC_AUTOCOMP_CHAR_DELETED, + wxEVT_STC_HOTSPOT_RELEASE_CLICK, + wxEVT_STC_CLIPBOARD_COPY, + wxEVT_STC_CLIPBOARD_PASTE, + wxEVT_STC_AUTOCOMP_COMPLETED, + wxEVT_STC_MARGIN_RIGHT_CLICK, + wxEVT_STC_AUTOCOMP_SELECTION_CHANGE + }; +#endif + + + +#ifndef SWIG +typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&); + +#define wxStyledTextEventHandler( func ) \ + wxEVENT_HANDLER_CAST( wxStyledTextEventFunction, func ) + +#define EVT_STC_CHANGE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHANGE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_STYLENEEDED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_STYLENEEDED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_CHARADDED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHARADDED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_SAVEPOINTREACHED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTREACHED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_SAVEPOINTLEFT(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTLEFT, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_ROMODIFYATTEMPT(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ROMODIFYATTEMPT, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_KEY(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_KEY, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_DOUBLECLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DOUBLECLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_UPDATEUI(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_UPDATEUI, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_MODIFIED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MODIFIED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_MACRORECORD(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MACRORECORD, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_MARGINCLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGINCLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_NEEDSHOWN(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_NEEDSHOWN, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_PAINTED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_PAINTED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_USERLISTSELECTION(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_USERLISTSELECTION, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_URIDROPPED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_URIDROPPED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_DWELLSTART(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLSTART, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_DWELLEND(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLEND, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_START_DRAG(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_START_DRAG, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_DRAG_OVER(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_DO_DROP(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_ZOOM(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ZOOM, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_HOTSPOT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_HOTSPOT_DCLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_DCLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_CALLTIP_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CALLTIP_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_AUTOCOMP_SELECTION(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_SELECTION, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_INDICATOR_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_INDICATOR_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_INDICATOR_RELEASE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_INDICATOR_RELEASE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_AUTOCOMP_CANCELLED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_CANCELLED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_AUTOCOMP_CHAR_DELETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_CHAR_DELETED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_HOTSPOT_RELEASE_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_RELEASE_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_CLIPBOARD_COPY(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CLIPBOARD_COPY, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_CLIPBOARD_PASTE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CLIPBOARD_PASTE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_AUTOCOMP_COMPLETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_COMPLETED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_MARGIN_RIGHT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGIN_RIGHT_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_AUTOCOMP_SELECTION_CHANGE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_SELECTION_CHANGE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#endif + +#endif // wxUSE_STC + +#endif // _WX_STC_STC_H_ diff --git a/lib/wxWidgets/include/wx/stdpaths.h b/lib/wxWidgets/include/wx/stdpaths.h new file mode 100644 index 0000000..effa94c --- /dev/null +++ b/lib/wxWidgets/include/wx/stdpaths.h @@ -0,0 +1,274 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/stdpaths.h +// Purpose: declaration of wxStandardPaths class +// Author: Vadim Zeitlin +// Modified by: +// Created: 2004-10-17 +// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STDPATHS_H_ +#define _WX_STDPATHS_H_ + +#include "wx/defs.h" + +#include "wx/string.h" +#include "wx/filefn.h" + +class WXDLLIMPEXP_FWD_BASE wxStandardPaths; + +// ---------------------------------------------------------------------------- +// wxStandardPaths returns the standard locations in the file system +// ---------------------------------------------------------------------------- + +// NB: This is always compiled in, wxUSE_STDPATHS=0 only disables native +// wxStandardPaths class, but a minimal version is always available +class WXDLLIMPEXP_BASE wxStandardPathsBase +{ +public: + // possible resources categories + enum ResourceCat + { + // no special category + ResourceCat_None, + + // message catalog resources + ResourceCat_Messages, + + // end of enum marker + ResourceCat_Max + }; + + // what should we use to construct paths unique to this application: + // (AppInfo_AppName and AppInfo_VendorName can be combined together) + enum + { + AppInfo_None = 0, // nothing + AppInfo_AppName = 1, // the application name + AppInfo_VendorName = 2 // the vendor name + }; + + enum Dir + { + Dir_Cache, + Dir_Documents, + Dir_Desktop, + Dir_Downloads, + Dir_Music, + Dir_Pictures, + Dir_Videos + }; + + // Layout to use for user config/data files under Unix. + enum FileLayout + { + FileLayout_Classic, // Default: use home directory. + FileLayout_XDG // Recommended: use XDG specification. + }; + + // Naming convention for the config files under Unix. + enum ConfigFileConv + { + ConfigFileConv_Dot, // Classic Unix dot-file convention. + ConfigFileConv_Ext // Use .conf extension. + }; + + + // return the global standard paths object + static wxStandardPaths& Get(); + + // return the path (directory+filename) of the running executable or + // wxEmptyString if it couldn't be determined. + // The path is returned as an absolute path whenever possible. + // Default implementation only try to use wxApp->argv[0]. + virtual wxString GetExecutablePath() const; + + // return the directory with system config files: + // /etc under Unix, c:\Documents and Settings\All Users\Application Data + // under Windows, /Library/Preferences for Mac + virtual wxString GetConfigDir() const = 0; + + // return the directory for the user config files: + // $HOME under Unix, c:\Documents and Settings\username under Windows, + // ~/Library/Preferences under Mac + // + // only use this if you have a single file to put there, otherwise + // GetUserDataDir() is more appropriate + virtual wxString GetUserConfigDir() const = 0; + + // return the location of the applications global, i.e. not user-specific, + // data files + // + // prefix/share/appname under Unix, c:\Program Files\appname under Windows, + // appname.app/Contents/SharedSupport app bundle directory under Mac + virtual wxString GetDataDir() const = 0; + + // return the location for application data files which are host-specific + // + // same as GetDataDir() except under Unix where it is /etc/appname + virtual wxString GetLocalDataDir() const; + + // return the directory for the user-dependent application data files + // + // $HOME/.appname under Unix, + // c:\Documents and Settings\username\Application Data\appname under Windows + // and ~/Library/Application Support/appname under Mac + virtual wxString GetUserDataDir() const = 0; + + // return the directory for user data files which shouldn't be shared with + // the other machines + // + // same as GetUserDataDir() for all platforms except Windows where it is + // the "Local Settings\Application Data\appname" directory + virtual wxString GetUserLocalDataDir() const; + + // return the directory where the loadable modules (plugins) live + // + // prefix/lib/appname under Unix, program directory under Windows and + // Contents/Plugins app bundle subdirectory under Mac + virtual wxString GetPluginsDir() const = 0; + + // get resources directory: resources are auxiliary files used by the + // application and include things like image and sound files + // + // same as GetDataDir() for all platforms except Mac where it returns + // Contents/Resources subdirectory of the app bundle + virtual wxString GetResourcesDir() const { return GetDataDir(); } + + // get localized resources directory containing the resource files of the + // specified category for the given language + // + // in general this is just GetResourcesDir()/lang under Windows and Unix + // and GetResourcesDir()/lang.lproj under Mac but is something quite + // different under Unix for message catalog category (namely the standard + // prefix/share/locale/lang/LC_MESSAGES) + virtual wxString + GetLocalizedResourcesDir(const wxString& lang, + ResourceCat WXUNUSED(category) + = ResourceCat_None) const + { + return GetResourcesDir() + wxFILE_SEP_PATH + lang; + } + + // return the "Documents" directory for the current user + // + // C:\Documents and Settings\username\My Documents under Windows, + // $HOME under Unix and ~/Documents under Mac + virtual wxString GetDocumentsDir() const + { + return GetUserDir(Dir_Documents); + } + + // return the directory for the documents files used by this application: + // it's a subdirectory of GetDocumentsDir() constructed using the + // application name/vendor if it exists or just GetDocumentsDir() otherwise + virtual wxString GetAppDocumentsDir() const; + + // return the temporary directory for the current user + virtual wxString GetTempDir() const; + + virtual wxString GetUserDir(Dir userDir) const; + + virtual wxString + MakeConfigFileName(const wxString& basename, + ConfigFileConv conv = ConfigFileConv_Ext) const = 0; + + // virtual dtor for the base class + virtual ~wxStandardPathsBase(); + + // Information used by AppendAppInfo + void UseAppInfo(int info) + { + m_usedAppInfo = info; + } + + bool UsesAppInfo(int info) const { return (m_usedAppInfo & info) != 0; } + + void SetFileLayout(FileLayout layout) + { + m_fileLayout = layout; + } + + FileLayout GetFileLayout() const + { + return m_fileLayout; + } + +protected: + // Ctor is protected as this is a base class which should never be created + // directly. + wxStandardPathsBase(); + + // append the path component, with a leading path separator if a + // path separator or dot (.) is not already at the end of dir + static wxString AppendPathComponent(const wxString& dir, const wxString& component); + + // append application information determined by m_usedAppInfo to dir + wxString AppendAppInfo(const wxString& dir) const; + + + // combination of AppInfo_XXX flags used by AppendAppInfo() + int m_usedAppInfo; + + // The file layout to use, currently only used under Unix. + FileLayout m_fileLayout; +}; + +#if wxUSE_STDPATHS + #if defined(__WINDOWS__) + #include "wx/msw/stdpaths.h" + #define wxHAS_NATIVE_STDPATHS + #elif defined(__WXOSX_COCOA__) || defined(__WXOSX_IPHONE__) || defined(__DARWIN__) + #include "wx/osx/cocoa/stdpaths.h" + #define wxHAS_NATIVE_STDPATHS + #elif defined(__UNIX__) + #include "wx/unix/stdpaths.h" + #define wxHAS_NATIVE_STDPATHS + #define wxHAS_STDPATHS_INSTALL_PREFIX + #endif +#endif + +// ---------------------------------------------------------------------------- +// Minimal generic implementation +// ---------------------------------------------------------------------------- + +// NB: Note that this minimal implementation is compiled in even if +// wxUSE_STDPATHS=0, so that our code can still use wxStandardPaths. + +#ifndef wxHAS_NATIVE_STDPATHS +#define wxHAS_STDPATHS_INSTALL_PREFIX +class WXDLLIMPEXP_BASE wxStandardPaths : public wxStandardPathsBase +{ +public: + void SetInstallPrefix(const wxString& prefix) { m_prefix = prefix; } + wxString GetInstallPrefix() const { return m_prefix; } + + virtual wxString GetExecutablePath() const { return m_prefix; } + virtual wxString GetConfigDir() const { return m_prefix; } + virtual wxString GetUserConfigDir() const { return m_prefix; } + virtual wxString GetDataDir() const { return m_prefix; } + virtual wxString GetLocalDataDir() const { return m_prefix; } + virtual wxString GetUserDataDir() const { return m_prefix; } + virtual wxString GetPluginsDir() const { return m_prefix; } + virtual wxString GetUserDir(Dir WXUNUSED(userDir)) const { return m_prefix; } + virtual wxString + MakeConfigFileName(const wxString& basename, + ConfigFileConv WXUNUSED(conv) = ConfigFileConv_Ext) const + { + return m_prefix + wxS("/") + basename; + } + +protected: + // Ctor is protected because wxStandardPaths::Get() should always be used + // to access the global wxStandardPaths object of the correct type instead + // of creating one of a possibly wrong type yourself. + wxStandardPaths() { } + +private: + wxString m_prefix; +}; +#endif // !wxHAS_NATIVE_STDPATHS + +#endif // _WX_STDPATHS_H_ + diff --git a/lib/wxWidgets/include/wx/stdstream.h b/lib/wxWidgets/include/wx/stdstream.h new file mode 100644 index 0000000..3cf565b --- /dev/null +++ b/lib/wxWidgets/include/wx/stdstream.h @@ -0,0 +1,122 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/stdstream.h +// Purpose: Header of std::istream and std::ostream derived wrappers for +// wxInputStream and wxOutputStream +// Author: Jonathan Liu <net147@gmail.com> +// Created: 2009-05-02 +// Copyright: (c) 2009 Jonathan Liu +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STDSTREAM_H_ +#define _WX_STDSTREAM_H_ + +#include "wx/defs.h" // wxUSE_STD_IOSTREAM + +#if wxUSE_STREAMS && wxUSE_STD_IOSTREAM + +#include "wx/defs.h" +#include "wx/stream.h" +#include "wx/ioswrap.h" + +// ========================================================================== +// wxStdInputStreamBuffer +// ========================================================================== + +class WXDLLIMPEXP_BASE wxStdInputStreamBuffer : public std::streambuf +{ +public: + wxStdInputStreamBuffer(wxInputStream& stream); + virtual ~wxStdInputStreamBuffer() { } + +protected: + virtual std::streambuf *setbuf(char *s, std::streamsize n) wxOVERRIDE; + virtual std::streampos seekoff(std::streamoff off, + std::ios_base::seekdir way, + std::ios_base::openmode which = + std::ios_base::in | + std::ios_base::out) wxOVERRIDE; + virtual std::streampos seekpos(std::streampos sp, + std::ios_base::openmode which = + std::ios_base::in | + std::ios_base::out) wxOVERRIDE; + virtual std::streamsize showmanyc() wxOVERRIDE; + virtual std::streamsize xsgetn(char *s, std::streamsize n) wxOVERRIDE; + virtual int underflow() wxOVERRIDE; + virtual int uflow() wxOVERRIDE; + virtual int pbackfail(int c = EOF) wxOVERRIDE; + + // Special work around for VC8/9 (this bug was fixed in VC10 and later): + // these versions have non-standard _Xsgetn_s() that it being called from + // the stream code instead of xsgetn() and so our overridden implementation + // never actually gets used. To work around this, forward to it explicitly. +#if defined(__VISUALC8__) || defined(__VISUALC9__) + virtual std::streamsize + _Xsgetn_s(char *s, size_t WXUNUSED(size), std::streamsize n) + { + return xsgetn(s, n); + } +#endif // VC8 or VC9 + + wxInputStream& m_stream; + int m_lastChar; +}; + +// ========================================================================== +// wxStdInputStream +// ========================================================================== + +class WXDLLIMPEXP_BASE wxStdInputStream : public std::istream +{ +public: + wxStdInputStream(wxInputStream& stream); + virtual ~wxStdInputStream() { } + +protected: + wxStdInputStreamBuffer m_streamBuffer; +}; + +// ========================================================================== +// wxStdOutputStreamBuffer +// ========================================================================== + +class WXDLLIMPEXP_BASE wxStdOutputStreamBuffer : public std::streambuf +{ +public: + wxStdOutputStreamBuffer(wxOutputStream& stream); + virtual ~wxStdOutputStreamBuffer() { } + +protected: + virtual std::streambuf *setbuf(char *s, std::streamsize n) wxOVERRIDE; + virtual std::streampos seekoff(std::streamoff off, + std::ios_base::seekdir way, + std::ios_base::openmode which = + std::ios_base::in | + std::ios_base::out) wxOVERRIDE; + virtual std::streampos seekpos(std::streampos sp, + std::ios_base::openmode which = + std::ios_base::in | + std::ios_base::out) wxOVERRIDE; + virtual std::streamsize xsputn(const char *s, std::streamsize n) wxOVERRIDE; + virtual int overflow(int c) wxOVERRIDE; + + wxOutputStream& m_stream; +}; + +// ========================================================================== +// wxStdOutputStream +// ========================================================================== + +class WXDLLIMPEXP_BASE wxStdOutputStream : public std::ostream +{ +public: + wxStdOutputStream(wxOutputStream& stream); + virtual ~wxStdOutputStream() { } + +protected: + wxStdOutputStreamBuffer m_streamBuffer; +}; + +#endif // wxUSE_STREAMS && wxUSE_STD_IOSTREAM + +#endif // _WX_STDSTREAM_H_ diff --git a/lib/wxWidgets/include/wx/stockitem.h b/lib/wxWidgets/include/wx/stockitem.h new file mode 100644 index 0000000..a03d55a --- /dev/null +++ b/lib/wxWidgets/include/wx/stockitem.h @@ -0,0 +1,80 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/stockitem.h +// Purpose: stock items helpers (privateh header) +// Author: Vaclav Slavik +// Modified by: +// Created: 2004-08-15 +// Copyright: (c) Vaclav Slavik, 2004 +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STOCKITEM_H_ +#define _WX_STOCKITEM_H_ + +#include "wx/defs.h" +#include "wx/chartype.h" +#include "wx/string.h" +#include "wx/accel.h" + +// ---------------------------------------------------------------------------- +// Helper functions for stock items handling: +// ---------------------------------------------------------------------------- + +// Returns true if the ID is in the list of recognized stock actions +WXDLLIMPEXP_CORE bool wxIsStockID(wxWindowID id); + +// Returns true of the label is empty or label of a stock button with +// given ID +WXDLLIMPEXP_CORE bool wxIsStockLabel(wxWindowID id, const wxString& label); + +enum wxStockLabelQueryFlag +{ + wxSTOCK_NOFLAGS = 0, + + wxSTOCK_WITH_MNEMONIC = 1, + wxSTOCK_WITH_ACCELERATOR = 2, + + // by default, stock items text is returned with ellipsis, if appropriate, + // this flag allows to avoid having it + wxSTOCK_WITHOUT_ELLIPSIS = 4, + + // return label for button, not menu item: buttons should always use + // mnemonics and never use ellipsis + wxSTOCK_FOR_BUTTON = wxSTOCK_WITHOUT_ELLIPSIS | wxSTOCK_WITH_MNEMONIC +}; + +// Returns label that should be used for given stock UI element (e.g. "&OK" +// for wxSTOCK_OK); if wxSTOCK_WITH_MNEMONIC is given, the & character +// is included; if wxSTOCK_WITH_ACCELERATOR is given, the stock accelerator +// for given ID is concatenated to the label using \t as separator +WXDLLIMPEXP_CORE wxString wxGetStockLabel(wxWindowID id, + long flags = wxSTOCK_WITH_MNEMONIC); + +#if wxUSE_ACCEL + + // Returns the accelerator that should be used for given stock UI element + // (e.g. "Ctrl+x" for wxSTOCK_EXIT) + WXDLLIMPEXP_CORE wxAcceleratorEntry wxGetStockAccelerator(wxWindowID id); + +#endif + +// wxStockHelpStringClient conceptually works like wxArtClient: it gives a hint to +// wxGetStockHelpString() about the context where the help string is to be used +enum wxStockHelpStringClient +{ + wxSTOCK_MENU // help string to use for menu items +}; + +// Returns a help string for the given stock UI element and for the given "context". +WXDLLIMPEXP_CORE wxString wxGetStockHelpString(wxWindowID id, + wxStockHelpStringClient client = wxSTOCK_MENU); + + +#ifdef __WXGTK20__ + +// Translates stock ID to GTK+'s stock item string identifier: +WXDLLIMPEXP_CORE const char *wxGetStockGtkID(wxWindowID id); + +#endif + +#endif // _WX_STOCKITEM_H_ diff --git a/lib/wxWidgets/include/wx/stopwatch.h b/lib/wxWidgets/include/wx/stopwatch.h new file mode 100644 index 0000000..ef39f39 --- /dev/null +++ b/lib/wxWidgets/include/wx/stopwatch.h @@ -0,0 +1,92 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/stopwatch.h +// Purpose: wxStopWatch and global time-related functions +// Author: Julian Smart (wxTimer), Sylvain Bougnoux (wxStopWatch), +// Vadim Zeitlin (time functions, current wxStopWatch) +// Created: 26.06.03 (extracted from wx/timer.h) +// Copyright: (c) 1998-2003 Julian Smart, Sylvain Bougnoux +// (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STOPWATCH_H_ +#define _WX_STOPWATCH_H_ + +#include "wx/defs.h" +#include "wx/longlong.h" + +// Time-related functions are also available via this header for compatibility +// but you should include wx/time.h directly if you need only them and not +// wxStopWatch itself. +#include "wx/time.h" + +// ---------------------------------------------------------------------------- +// wxStopWatch: measure time intervals with up to 1ms resolution +// ---------------------------------------------------------------------------- + +#if wxUSE_STOPWATCH + +class WXDLLIMPEXP_BASE wxStopWatch +{ +public: + // ctor starts the stop watch + wxStopWatch() { m_pauseCount = 0; Start(); } + + // Start the stop watch at the moment t0 expressed in milliseconds (i.e. + // calling Time() immediately afterwards returns t0). This can be used to + // restart an existing stopwatch. + void Start(long t0 = 0); + + // pause the stop watch + void Pause() + { + if ( m_pauseCount++ == 0 ) + m_elapsedBeforePause = GetCurrentClockValue() - m_t0; + } + + // resume it + void Resume() + { + wxASSERT_MSG( m_pauseCount > 0, + wxT("Resuming stop watch which is not paused") ); + + if ( --m_pauseCount == 0 ) + { + DoStart(); + m_t0 -= m_elapsedBeforePause; + } + } + + // Get elapsed time since the last Start() in microseconds. + wxLongLong TimeInMicro() const; + + // get elapsed time since the last Start() in milliseconds + long Time() const { return (TimeInMicro()/1000).ToLong(); } + +private: + // Really starts the stop watch. The initial time is set to current clock + // value. + void DoStart(); + + // Returns the current clock value in its native units. + wxLongLong GetCurrentClockValue() const; + + // Return the frequency of the clock used in its ticks per second. + wxLongLong GetClockFreq() const; + + + // The clock value when the stop watch was last started. Its units vary + // depending on the platform. + wxLongLong m_t0; + + // The elapsed time as of last Pause() call (only valid if m_pauseCount > + // 0) in the same units as m_t0. + wxLongLong m_elapsedBeforePause; + + // if > 0, the stop watch is paused, otherwise it is running + int m_pauseCount; +}; + +#endif // wxUSE_STOPWATCH + +#endif // _WX_STOPWATCH_H_ diff --git a/lib/wxWidgets/include/wx/strconv.h b/lib/wxWidgets/include/wx/strconv.h new file mode 100644 index 0000000..aceed78 --- /dev/null +++ b/lib/wxWidgets/include/wx/strconv.h @@ -0,0 +1,737 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/strconv.h +// Purpose: conversion routines for char sets any Unicode +// Author: Ove Kaaven, Robert Roebling, Vadim Zeitlin +// Modified by: +// Created: 29/01/98 +// Copyright: (c) 1998 Ove Kaaven, Robert Roebling +// (c) 1998-2006 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STRCONV_H_ +#define _WX_STRCONV_H_ + +#include "wx/defs.h" +#include "wx/chartype.h" +#include "wx/buffer.h" + +#include <stdlib.h> + +class WXDLLIMPEXP_FWD_BASE wxString; + +// the error value returned by wxMBConv methods +#define wxCONV_FAILED ((size_t)-1) + +// ---------------------------------------------------------------------------- +// wxMBConv (abstract base class for conversions) +// ---------------------------------------------------------------------------- + +// When deriving a new class from wxMBConv you must reimplement ToWChar() and +// FromWChar() methods which are not pure virtual only for historical reasons, +// don't let the fact that the existing classes implement MB2WC/WC2MB() instead +// confuse you. +// +// For many encodings you must override GetMaxCharLen(). +// +// You also have to implement Clone() to allow copying the conversions +// polymorphically. +// +// And you might need to override GetMBNulLen() as well. +class WXDLLIMPEXP_BASE wxMBConv +{ +public: + // The functions doing actual conversion from/to narrow to/from wide + // character strings. + // + // On success, the return value is the length (i.e. the number of + // characters, not bytes) of the converted string including any trailing + // L'\0' or (possibly multiple) '\0'(s). If the conversion fails or if + // there is not enough space for everything, including the trailing NUL + // character(s), in the output buffer, wxCONV_FAILED is returned. + // + // In the special case when dst is NULL (the value of dstLen is ignored + // then) the return value is the length of the needed buffer but nothing + // happens otherwise. If srcLen is wxNO_LEN, the entire string, up to and + // including the trailing NUL(s), is converted, otherwise exactly srcLen + // bytes are. + // + // Typical usage: + // + // size_t dstLen = conv.ToWChar(NULL, 0, src); + // if ( dstLen == wxCONV_FAILED ) + // ... handle error ... + // wchar_t *wbuf = new wchar_t[dstLen]; + // conv.ToWChar(wbuf, dstLen, src); + // ... work with wbuf ... + // delete [] wbuf; + // + virtual size_t ToWChar(wchar_t *dst, size_t dstLen, + const char *src, size_t srcLen = wxNO_LEN) const; + + virtual size_t FromWChar(char *dst, size_t dstLen, + const wchar_t *src, size_t srcLen = wxNO_LEN) const; + + + // Convenience functions for translating NUL-terminated strings: return + // the buffer containing the converted string or empty buffer if the + // conversion failed. + wxWCharBuffer cMB2WC(const char *in) const + { return DoConvertMB2WC(in, wxNO_LEN); } + wxCharBuffer cWC2MB(const wchar_t *in) const + { return DoConvertWC2MB(in, wxNO_LEN); } + + wxWCharBuffer cMB2WC(const wxScopedCharBuffer& in) const + { return DoConvertMB2WC(in, in.length()); } + wxCharBuffer cWC2MB(const wxScopedWCharBuffer& in) const + { return DoConvertWC2MB(in, in.length()); } + + + // Convenience functions for converting strings which may contain embedded + // NULs and don't have to be NUL-terminated. + // + // inLen is the length of the buffer including trailing NUL if any or + // wxNO_LEN if the input is NUL-terminated. + // + // outLen receives, if not NULL, the length of the converted string or 0 if + // the conversion failed (returning 0 and not -1 in this case makes it + // difficult to distinguish between failed conversion and empty input but + // this is done for backwards compatibility). Notice that the rules for + // whether outLen accounts or not for the last NUL are the same as for + // To/FromWChar() above: if inLen is specified, outLen is exactly the + // number of characters converted, whether the last one of them was NUL or + // not. But if inLen == wxNO_LEN then outLen doesn't account for the last + // NUL even though it is present. + wxWCharBuffer + cMB2WC(const char *in, size_t inLen, size_t *outLen) const; + wxCharBuffer + cWC2MB(const wchar_t *in, size_t inLen, size_t *outLen) const; + + // convenience functions for converting MB or WC to/from wxWin default +#if wxUSE_UNICODE + wxWCharBuffer cMB2WX(const char *psz) const { return cMB2WC(psz); } + wxCharBuffer cWX2MB(const wchar_t *psz) const { return cWC2MB(psz); } + const wchar_t* cWC2WX(const wchar_t *psz) const { return psz; } + const wchar_t* cWX2WC(const wchar_t *psz) const { return psz; } +#else // ANSI + const char* cMB2WX(const char *psz) const { return psz; } + const char* cWX2MB(const char *psz) const { return psz; } + wxCharBuffer cWC2WX(const wchar_t *psz) const { return cWC2MB(psz); } + wxWCharBuffer cWX2WC(const char *psz) const { return cMB2WC(psz); } +#endif // Unicode/ANSI + + // return the maximum number of bytes that can be required to encode a + // single character in this encoding, e.g. 4 for UTF-8 + virtual size_t GetMaxCharLen() const { return 1; } + + // this function is used in the implementation of cMB2WC() to distinguish + // between the following cases: + // + // a) var width encoding with strings terminated by a single NUL + // (usual multibyte encodings): return 1 in this case + // b) fixed width encoding with 2 bytes/char and so terminated by + // 2 NULs (UTF-16/UCS-2 and variants): return 2 in this case + // c) fixed width encoding with 4 bytes/char and so terminated by + // 4 NULs (UTF-32/UCS-4 and variants): return 4 in this case + // + // anything else is not supported currently and -1 should be returned + virtual size_t GetMBNulLen() const { return 1; } + + // return the maximal value currently returned by GetMBNulLen() for any + // encoding + static size_t GetMaxMBNulLen() { return 4 /* for UTF-32 */; } + + // return true if the converter's charset is UTF-8, i.e. char* strings + // decoded using this object can be directly copied to wxString's internal + // storage without converting to WC and then back to UTF-8 MB string + virtual bool IsUTF8() const { return false; } + + // The old conversion functions. The existing classes currently mostly + // implement these ones but we're in transition to using To/FromWChar() + // instead and any new classes should implement just the new functions. + // For now, however, we provide default implementation of To/FromWChar() in + // this base class in terms of MB2WC/WC2MB() to avoid having to rewrite all + // the conversions at once. + // + // On success, the return value is the length (i.e. the number of + // characters, not bytes) not counting the trailing NUL(s) of the converted + // string. On failure, (size_t)-1 is returned. In the special case when + // outputBuf is NULL the return value is the same one but nothing is + // written to the buffer. + // + // Note that outLen is the length of the output buffer, not the length of + // the input (which is always supposed to be terminated by one or more + // NULs, as appropriate for the encoding)! + virtual size_t MB2WC(wchar_t *out, const char *in, size_t outLen) const; + virtual size_t WC2MB(char *out, const wchar_t *in, size_t outLen) const; + + + // make a heap-allocated copy of this object + virtual wxMBConv *Clone() const = 0; + + // virtual dtor for any base class + virtual ~wxMBConv() { } + +private: + // Common part of single argument cWC2MB() and cMB2WC() overloads above. + wxCharBuffer DoConvertWC2MB(const wchar_t* pwz, size_t srcLen) const; + wxWCharBuffer DoConvertMB2WC(const char* psz, size_t srcLen) const; +}; + +// ---------------------------------------------------------------------------- +// wxMBConvLibc uses standard mbstowcs() and wcstombs() functions for +// conversion (hence it depends on the current locale) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMBConvLibc : public wxMBConv +{ +public: + virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const wxOVERRIDE; + virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const wxOVERRIDE; + + virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvLibc; } + + virtual bool IsUTF8() const wxOVERRIDE { return wxLocaleIsUtf8; } +}; + +#ifdef __UNIX__ + +// ---------------------------------------------------------------------------- +// wxConvBrokenFileNames is made for Unix in Unicode mode when +// files are accidentally written in an encoding which is not +// the system encoding. Typically, the system encoding will be +// UTF8 but there might be files stored in ISO8859-1 on disk. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxConvBrokenFileNames : public wxMBConv +{ +public: + wxConvBrokenFileNames(const wxString& charset); + wxConvBrokenFileNames(const wxConvBrokenFileNames& conv) + : wxMBConv(), + m_conv(conv.m_conv ? conv.m_conv->Clone() : NULL) + { + } + virtual ~wxConvBrokenFileNames() { delete m_conv; } + + virtual size_t MB2WC(wchar_t *out, const char *in, size_t outLen) const wxOVERRIDE + { + return m_conv->MB2WC(out, in, outLen); + } + + virtual size_t WC2MB(char *out, const wchar_t *in, size_t outLen) const wxOVERRIDE + { + return m_conv->WC2MB(out, in, outLen); + } + + virtual size_t GetMBNulLen() const wxOVERRIDE + { + // cast needed to call a private function + return m_conv->GetMBNulLen(); + } + + virtual bool IsUTF8() const wxOVERRIDE { return m_conv->IsUTF8(); } + + virtual wxMBConv *Clone() const wxOVERRIDE { return new wxConvBrokenFileNames(*this); } + +private: + // the conversion object we forward to + wxMBConv *m_conv; + + wxDECLARE_NO_ASSIGN_CLASS(wxConvBrokenFileNames); +}; + +#endif // __UNIX__ + +// ---------------------------------------------------------------------------- +// wxMBConvUTF7 (for conversion using UTF7 encoding) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMBConvUTF7 : public wxMBConv +{ +public: + wxMBConvUTF7() { } + + // compiler-generated copy ctor, assignment operator and dtor are ok + // (assuming it's ok to copy the shift state -- not really sure about it) + + virtual size_t ToWChar(wchar_t *dst, size_t dstLen, + const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + virtual size_t FromWChar(char *dst, size_t dstLen, + const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + + virtual size_t GetMaxCharLen() const wxOVERRIDE { return 4; } + + virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvUTF7; } + +private: + // UTF-7 decoder/encoder may be in direct mode or in shifted mode after a + // '+' (and until the '-' or any other non-base64 character) + struct StateMode + { + enum Mode + { + Direct, // pass through state + Shifted // after a '+' (and before '-') + }; + }; + + // the current decoder state: this is only used by ToWChar() if srcLen + // parameter is not wxNO_LEN, when working on the entire NUL-terminated + // strings we neither update nor use the state + class DecoderState : private StateMode + { + private: + // current state: this one is private as we want to enforce the use of + // ToDirect/ToShifted() methods below + Mode mode; + + public: + // the initial state is direct + DecoderState() { mode = Direct; accum = bit = msb = 0; isLSB = false; } + + // switch to/from shifted mode + void ToDirect() { mode = Direct; } + void ToShifted() { mode = Shifted; accum = bit = 0; isLSB = false; } + + bool IsDirect() const { return mode == Direct; } + bool IsShifted() const { return mode == Shifted; } + + + // these variables are only used in shifted mode + + unsigned int accum; // accumulator of the bit we've already got + unsigned int bit; // the number of bits consumed mod 8 + unsigned char msb; // the high byte of UTF-16 word + bool isLSB; // whether we're decoding LSB or MSB of UTF-16 word + }; + + DecoderState m_stateDecoder; + + + // encoder state is simpler as we always receive entire Unicode characters + // on input + class EncoderState : private StateMode + { + private: + Mode mode; + + public: + EncoderState() { mode = Direct; accum = bit = 0; } + + void ToDirect() { mode = Direct; } + void ToShifted() { mode = Shifted; accum = bit = 0; } + + bool IsDirect() const { return mode == Direct; } + bool IsShifted() const { return mode == Shifted; } + + unsigned int accum; + unsigned int bit; + }; + + EncoderState m_stateEncoder; +}; + +// ---------------------------------------------------------------------------- +// wxMBConvUTF8 (for conversion using UTF8 encoding) +// ---------------------------------------------------------------------------- + +// this is the real UTF-8 conversion class, it has to be called "strict UTF-8" +// for compatibility reasons: the wxMBConvUTF8 class below also supports lossy +// conversions if it is created with non default options +class WXDLLIMPEXP_BASE wxMBConvStrictUTF8 : public wxMBConv +{ +public: + // compiler-generated default ctor and other methods are ok + + virtual size_t ToWChar(wchar_t *dst, size_t dstLen, + const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + virtual size_t FromWChar(char *dst, size_t dstLen, + const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + + virtual size_t GetMaxCharLen() const wxOVERRIDE { return 4; } + + virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvStrictUTF8(); } + + // NB: other mapping modes are not, strictly speaking, UTF-8, so we can't + // take the shortcut in that case + virtual bool IsUTF8() const wxOVERRIDE { return true; } +}; + +class WXDLLIMPEXP_BASE wxMBConvUTF8 : public wxMBConvStrictUTF8 +{ +public: + enum + { + MAP_INVALID_UTF8_NOT = 0, + MAP_INVALID_UTF8_TO_PUA = 1, + MAP_INVALID_UTF8_TO_OCTAL = 2 + }; + + wxMBConvUTF8(int options = MAP_INVALID_UTF8_NOT) : m_options(options) { } + + virtual size_t ToWChar(wchar_t *dst, size_t dstLen, + const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + virtual size_t FromWChar(char *dst, size_t dstLen, + const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + + virtual size_t GetMaxCharLen() const wxOVERRIDE { return 4; } + + virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvUTF8(m_options); } + + // NB: other mapping modes are not, strictly speaking, UTF-8, so we can't + // take the shortcut in that case + virtual bool IsUTF8() const wxOVERRIDE { return m_options == MAP_INVALID_UTF8_NOT; } + +private: + int m_options; +}; + +// ---------------------------------------------------------------------------- +// wxMBConvUTF16Base: for both LE and BE variants +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMBConvUTF16Base : public wxMBConv +{ +public: + enum { BYTES_PER_CHAR = 2 }; + + virtual size_t GetMBNulLen() const wxOVERRIDE { return BYTES_PER_CHAR; } + +protected: + // return the length of the buffer using srcLen if it's not wxNO_LEN and + // computing the length ourselves if it is; also checks that the length is + // even if specified as we need an entire number of UTF-16 characters and + // returns wxNO_LEN which indicates error if it is odd + static size_t GetLength(const char *src, size_t srcLen); +}; + +// ---------------------------------------------------------------------------- +// wxMBConvUTF16LE (for conversion using UTF16 Little Endian encoding) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMBConvUTF16LE : public wxMBConvUTF16Base +{ +public: + virtual size_t ToWChar(wchar_t *dst, size_t dstLen, + const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + virtual size_t FromWChar(char *dst, size_t dstLen, + const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + virtual size_t GetMaxCharLen() const wxOVERRIDE { return 4; } + virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvUTF16LE; } +}; + +// ---------------------------------------------------------------------------- +// wxMBConvUTF16BE (for conversion using UTF16 Big Endian encoding) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMBConvUTF16BE : public wxMBConvUTF16Base +{ +public: + virtual size_t ToWChar(wchar_t *dst, size_t dstLen, + const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + virtual size_t FromWChar(char *dst, size_t dstLen, + const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + virtual size_t GetMaxCharLen() const wxOVERRIDE { return 4; } + virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvUTF16BE; } +}; + +// ---------------------------------------------------------------------------- +// wxMBConvUTF32Base: base class for both LE and BE variants +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMBConvUTF32Base : public wxMBConv +{ +public: + enum { BYTES_PER_CHAR = 4 }; + + virtual size_t GetMBNulLen() const wxOVERRIDE { return BYTES_PER_CHAR; } + +protected: + // this is similar to wxMBConvUTF16Base method with the same name except + // that, of course, it verifies that length is divisible by 4 if given and + // not by 2 + static size_t GetLength(const char *src, size_t srcLen); +}; + +// ---------------------------------------------------------------------------- +// wxMBConvUTF32LE (for conversion using UTF32 Little Endian encoding) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMBConvUTF32LE : public wxMBConvUTF32Base +{ +public: + virtual size_t ToWChar(wchar_t *dst, size_t dstLen, + const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + virtual size_t FromWChar(char *dst, size_t dstLen, + const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + virtual size_t GetMaxCharLen() const wxOVERRIDE { return 4; } + virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvUTF32LE; } +}; + +// ---------------------------------------------------------------------------- +// wxMBConvUTF32BE (for conversion using UTF32 Big Endian encoding) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMBConvUTF32BE : public wxMBConvUTF32Base +{ +public: + virtual size_t ToWChar(wchar_t *dst, size_t dstLen, + const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + virtual size_t FromWChar(char *dst, size_t dstLen, + const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + virtual size_t GetMaxCharLen() const wxOVERRIDE { return 4; } + virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvUTF32BE; } +}; + +// ---------------------------------------------------------------------------- +// wxCSConv (for conversion based on loadable char sets) +// ---------------------------------------------------------------------------- + +#include "wx/fontenc.h" + +class WXDLLIMPEXP_BASE wxCSConv : public wxMBConv +{ +public: + // we can be created either from charset name or from an encoding constant + // but we can't have both at once + wxCSConv(const wxString& charset); + wxCSConv(wxFontEncoding encoding); + + wxCSConv(const wxCSConv& conv); + virtual ~wxCSConv(); + + wxCSConv& operator=(const wxCSConv& conv); + + virtual size_t ToWChar(wchar_t *dst, size_t dstLen, + const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + virtual size_t FromWChar(char *dst, size_t dstLen, + const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + virtual size_t GetMBNulLen() const wxOVERRIDE; + + virtual bool IsUTF8() const wxOVERRIDE; + + virtual wxMBConv *Clone() const wxOVERRIDE { return new wxCSConv(*this); } + + void Clear(); + + // return true if the conversion could be initialized successfully + bool IsOk() const; + +private: + // common part of all ctors + void Init(); + + // Creates the conversion to use, called from all ctors to initialize + // m_convReal. + wxMBConv *DoCreate() const; + + // Set the name (may be only called when m_name == NULL), makes copy of + // the charset string. + void SetName(const char *charset); + + // Set m_encoding field respecting the rules below, i.e. making sure it has + // a valid value if m_name == NULL (thus this should be always called after + // SetName()). + // + // Input encoding may be valid or not. + void SetEncoding(wxFontEncoding encoding); + + + // The encoding we use is specified by the two fields below: + // + // 1. If m_name != NULL, m_encoding corresponds to it if it's one of + // encodings we know about (i.e. member of wxFontEncoding) or is + // wxFONTENCODING_SYSTEM otherwise. + // + // 2. If m_name == NULL, m_encoding is always valid, i.e. not one of + // wxFONTENCODING_{SYSTEM,DEFAULT,MAX}. + char *m_name; + wxFontEncoding m_encoding; + + // The conversion object for our encoding or NULL if we failed to create it + // in which case we fall back to hard-coded ISO8859-1 conversion. + wxMBConv *m_convReal; +}; + +// ---------------------------------------------------------------------------- +// wxWhateverWorksConv: use whatever encoding works for the input +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxWhateverWorksConv : public wxMBConv +{ +public: + wxWhateverWorksConv() + { + } + + // Try to interpret the string as UTF-8, if it fails fall back to the + // current locale encoding (wxConvLibc) and if this fails as well, + // interpret it as wxConvISO8859_1 (which is used because it never fails + // and this conversion is used when we really, really must produce + // something on output). + virtual size_t + ToWChar(wchar_t *dst, size_t dstLen, + const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + + // Try to encode the string using the current locale encoding (wxConvLibc) + // and fall back to UTF-8 (which never fails) if it doesn't work. Note that + // we never use wxConvISO8859_1 here as we prefer to fall back on UTF-8 + // even for the strings containing only code points representable in 8869-1. + virtual size_t + FromWChar(char *dst, size_t dstLen, + const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + + // Use the value for UTF-8 here to make sure we try to decode up to 4 bytes + // as UTF-8 before giving up. + virtual size_t GetMaxCharLen() const wxOVERRIDE { return 4; } + + virtual wxMBConv *Clone() const wxOVERRIDE + { + return new wxWhateverWorksConv(); + } +}; + +// ---------------------------------------------------------------------------- +// declare predefined conversion objects +// ---------------------------------------------------------------------------- + +// Note: this macro is an implementation detail (see the comment in +// strconv.cpp). The wxGet_XXX() and wxGet_XXXPtr() functions shouldn't be +// used by user code and neither should XXXPtr, use the wxConvXXX macro +// instead. +#define WX_DECLARE_GLOBAL_CONV(klass, name) \ + extern WXDLLIMPEXP_DATA_BASE(klass*) name##Ptr; \ + extern WXDLLIMPEXP_BASE klass* wxGet_##name##Ptr(); \ + inline klass& wxGet_##name() \ + { \ + if ( !name##Ptr ) \ + name##Ptr = wxGet_##name##Ptr(); \ + return *name##Ptr; \ + } + + +// conversion to be used with all standard functions affected by locale, e.g. +// strtol(), strftime(), ... +WX_DECLARE_GLOBAL_CONV(wxMBConv, wxConvLibc) +#define wxConvLibc wxGet_wxConvLibc() + +// conversion ISO-8859-1/UTF-7/UTF-8 <-> wchar_t +WX_DECLARE_GLOBAL_CONV(wxCSConv, wxConvISO8859_1) +#define wxConvISO8859_1 wxGet_wxConvISO8859_1() + +WX_DECLARE_GLOBAL_CONV(wxMBConvStrictUTF8, wxConvUTF8) +#define wxConvUTF8 wxGet_wxConvUTF8() + +WX_DECLARE_GLOBAL_CONV(wxMBConvUTF7, wxConvUTF7) +#define wxConvUTF7 wxGet_wxConvUTF7() + +// conversion used when we may not afford to lose data when outputting Unicode +// strings (should be avoid in the other direction as it can misinterpret the +// input encoding) +WX_DECLARE_GLOBAL_CONV(wxWhateverWorksConv, wxConvWhateverWorks) +#define wxConvWhateverWorks wxGet_wxConvWhateverWorks() + +// conversion used for the file names on the systems where they're not Unicode +// (basically anything except Windows) +// +// this is used by all file functions, can be changed by the application +// +// by default UTF-8 under Mac OS X and wxConvLibc elsewhere (but it's not used +// under Windows normally) +extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvFileName; + +// backwards compatible define +#define wxConvFile (*wxConvFileName) + +// the current conversion object, may be set to any conversion, is used by +// default in a couple of places inside wx (initially same as wxConvLibc) +extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvCurrent; + +// the conversion corresponding to the current locale +WX_DECLARE_GLOBAL_CONV(wxCSConv, wxConvLocal) +#define wxConvLocal wxGet_wxConvLocal() + +// the conversion corresponding to the encoding of the standard UI elements +// +// by default this is the same as wxConvLocal but may be changed if the program +// needs to use a fixed encoding +extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvUI; + +#undef WX_DECLARE_GLOBAL_CONV + +// ---------------------------------------------------------------------------- +// endianness-dependent conversions +// ---------------------------------------------------------------------------- + +#ifdef WORDS_BIGENDIAN + typedef wxMBConvUTF16BE wxMBConvUTF16; + typedef wxMBConvUTF32BE wxMBConvUTF32; +#else + typedef wxMBConvUTF16LE wxMBConvUTF16; + typedef wxMBConvUTF32LE wxMBConvUTF32; +#endif + +// ---------------------------------------------------------------------------- +// filename conversion macros +// ---------------------------------------------------------------------------- + +// filenames are multibyte on Unix and widechar on Windows +#if wxMBFILES && wxUSE_UNICODE + #define wxFNCONV(name) wxConvFileName->cWX2MB(name) + #define wxFNSTRINGCAST wxMBSTRINGCAST +#else +#if defined(__WXOSX__) && wxMBFILES + #define wxFNCONV(name) wxConvFileName->cWC2MB( wxConvLocal.cWX2WC(name) ) +#else + #define wxFNCONV(name) name +#endif + #define wxFNSTRINGCAST WXSTRINGCAST +#endif + +// ---------------------------------------------------------------------------- +// macros for the most common conversions +// ---------------------------------------------------------------------------- + +#if wxUSE_UNICODE + #define wxConvertWX2MB(s) wxConvCurrent->cWX2MB(s) + #define wxConvertMB2WX(s) wxConvCurrent->cMB2WX(s) + + // these functions should be used when the conversions really, really have + // to succeed (usually because we pass their results to a standard C + // function which would crash if we passed NULL to it), so these functions + // always return a valid pointer if their argument is non-NULL + + inline wxWCharBuffer wxSafeConvertMB2WX(const char *s) + { + return wxConvWhateverWorks.cMB2WC(s); + } + + inline wxCharBuffer wxSafeConvertWX2MB(const wchar_t *ws) + { + return wxConvWhateverWorks.cWC2MB(ws); + } +#else // ANSI + // no conversions to do + #define wxConvertWX2MB(s) (s) + #define wxConvertMB2WX(s) (s) + #define wxSafeConvertMB2WX(s) (s) + #define wxSafeConvertWX2MB(s) (s) +#endif // Unicode/ANSI + +// Macro that indicates the default encoding for converting C strings +// to wxString. It provides a default value for a const wxMBConv& +// parameter (i.e. wxConvLibc) unless wxNO_IMPLICIT_WXSTRING_ENCODING +// is defined. +// +// Intended use: +// wxString(const char *data, ..., +// const wxMBConv &conv wxSTRING_DEFAULT_CONV_ARG); +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +#define wxSTRING_DEFAULT_CONV_ARG = wxConvLibc +#else +#define wxSTRING_DEFAULT_CONV_ARG +#endif + +#endif // _WX_STRCONV_H_ + diff --git a/lib/wxWidgets/include/wx/stream.h b/lib/wxWidgets/include/wx/stream.h new file mode 100644 index 0000000..4de1d5b --- /dev/null +++ b/lib/wxWidgets/include/wx/stream.h @@ -0,0 +1,735 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/stream.h +// Purpose: stream classes +// Author: Guilhem Lavaux, Guillermo Rodriguez Garcia, Vadim Zeitlin +// Modified by: +// Created: 11/07/98 +// Copyright: (c) Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WXSTREAM_H__ +#define _WX_WXSTREAM_H__ + +#include "wx/defs.h" + +#if wxUSE_STREAMS + +#include <stdio.h> +#include "wx/object.h" +#include "wx/string.h" +#include "wx/filefn.h" // for wxFileOffset, wxInvalidOffset and wxSeekMode + +class WXDLLIMPEXP_FWD_BASE wxStreamBase; +class WXDLLIMPEXP_FWD_BASE wxInputStream; +class WXDLLIMPEXP_FWD_BASE wxOutputStream; + +typedef wxInputStream& (*__wxInputManip)(wxInputStream&); +typedef wxOutputStream& (*__wxOutputManip)(wxOutputStream&); + +WXDLLIMPEXP_BASE wxOutputStream& wxEndL(wxOutputStream& o_stream); + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +enum wxStreamError +{ + wxSTREAM_NO_ERROR = 0, // stream is in good state + wxSTREAM_EOF, // EOF reached in Read() or similar + wxSTREAM_WRITE_ERROR, // generic write error + wxSTREAM_READ_ERROR // generic read error +}; + +const int wxEOF = -1; + +// ============================================================================ +// base stream classes: wxInputStream and wxOutputStream +// ============================================================================ + +// --------------------------------------------------------------------------- +// wxStreamBase: common (but non virtual!) base for all stream classes +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStreamBase : public wxObject +{ +public: + wxStreamBase(); + virtual ~wxStreamBase(); + + // error testing + wxStreamError GetLastError() const { return m_lasterror; } + virtual bool IsOk() const { return GetLastError() == wxSTREAM_NO_ERROR; } + bool operator!() const { return !IsOk(); } + + // reset the stream state + void Reset(wxStreamError error = wxSTREAM_NO_ERROR) { m_lasterror = error; } + + // this doesn't make sense for all streams, always test its return value + virtual size_t GetSize() const; + virtual wxFileOffset GetLength() const { return wxInvalidOffset; } + + // returns true if the streams supports seeking to arbitrary offsets + virtual bool IsSeekable() const { return false; } + +protected: + virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode); + virtual wxFileOffset OnSysTell() const; + + size_t m_lastcount; + wxStreamError m_lasterror; + + friend class wxStreamBuffer; + + wxDECLARE_ABSTRACT_CLASS(wxStreamBase); + wxDECLARE_NO_COPY_CLASS(wxStreamBase); +}; + +// ---------------------------------------------------------------------------- +// wxInputStream: base class for the input streams +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxInputStream : public wxStreamBase +{ +public: + // ctor and dtor, nothing exciting + wxInputStream(); + virtual ~wxInputStream(); + + + // IO functions + // ------------ + + // return a character from the stream without removing it, i.e. it will + // still be returned by the next call to GetC() + // + // blocks until something appears in the stream if necessary, if nothing + // ever does (i.e. EOF) LastRead() will return 0 (and the return value is + // undefined), otherwise 1 + virtual char Peek(); + + // return one byte from the stream, blocking until it appears if + // necessary + // + // on success returns a value between 0 - 255, or wxEOF on EOF or error. + int GetC(); + + // read at most the given number of bytes from the stream + // + // there are 2 possible situations here: either there is nothing at all in + // the stream right now in which case Read() blocks until something appears + // (use CanRead() to avoid this) or there is already some data available in + // the stream and then Read() doesn't block but returns just the data it + // can read without waiting for more + // + // in any case, if there are not enough bytes in the stream right now, + // LastRead() value will be less than size but greater than 0. If it is 0, + // it means that EOF has been reached. + virtual wxInputStream& Read(void *buffer, size_t size); + + // Read exactly the given number of bytes, unlike Read(), which may read + // less than the requested amount of data without returning an error, this + // method either reads all the data or returns false. + bool ReadAll(void *buffer, size_t size); + + // copy the entire contents of this stream into streamOut, stopping only + // when EOF is reached or an error occurs + wxInputStream& Read(wxOutputStream& streamOut); + + + // status functions + // ---------------- + + // returns the number of bytes read by the last call to Read(), GetC() or + // Peek() + // + // this should be used to discover whether that call succeeded in reading + // all the requested data or not + virtual size_t LastRead() const { return wxStreamBase::m_lastcount; } + + // returns true if some data is available in the stream right now, so that + // calling Read() wouldn't block + virtual bool CanRead() const; + + // is the stream at EOF? + // + // note that this cannot be really implemented for all streams and + // CanRead() is more reliable than Eof() + virtual bool Eof() const; + + + // write back buffer + // ----------------- + + // put back the specified number of bytes into the stream, they will be + // fetched by the next call to the read functions + // + // returns the number of bytes really stuffed back + size_t Ungetch(const void *buffer, size_t size); + + // put back the specified character in the stream + // + // returns true if ok, false on error + bool Ungetch(char c); + + + // position functions + // ------------------ + + // move the stream pointer to the given position (if the stream supports + // it) + // + // returns wxInvalidOffset on error + virtual wxFileOffset SeekI(wxFileOffset pos, wxSeekMode mode = wxFromStart); + + // return the current position of the stream pointer or wxInvalidOffset + virtual wxFileOffset TellI() const; + + + // stream-like operators + // --------------------- + + wxInputStream& operator>>(wxOutputStream& out) { return Read(out); } + wxInputStream& operator>>(__wxInputManip func) { return func(*this); } + +protected: + // do read up to size bytes of data into the provided buffer + // + // this method should return 0 if EOF has been reached or an error occurred + // (m_lasterror should be set accordingly as well) or the number of bytes + // read + virtual size_t OnSysRead(void *buffer, size_t size) = 0; + + // write-back buffer support + // ------------------------- + + // return the pointer to a buffer big enough to hold sizeNeeded bytes + char *AllocSpaceWBack(size_t sizeNeeded); + + // read up to size data from the write back buffer, return the number of + // bytes read + size_t GetWBack(void *buf, size_t size); + + // write back buffer or NULL if none + char *m_wback; + + // the size of the buffer + size_t m_wbacksize; + + // the current position in the buffer + size_t m_wbackcur; + + friend class wxStreamBuffer; + + wxDECLARE_ABSTRACT_CLASS(wxInputStream); + wxDECLARE_NO_COPY_CLASS(wxInputStream); +}; + +// ---------------------------------------------------------------------------- +// wxOutputStream: base for the output streams +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxOutputStream : public wxStreamBase +{ +public: + wxOutputStream(); + virtual ~wxOutputStream(); + + void PutC(char c); + virtual wxOutputStream& Write(const void *buffer, size_t size); + + // This is ReadAll() equivalent for Write(): it either writes exactly the + // given number of bytes or returns false, unlike Write() which can write + // less data than requested but still return without error. + bool WriteAll(const void *buffer, size_t size); + + wxOutputStream& Write(wxInputStream& stream_in); + + virtual wxFileOffset SeekO(wxFileOffset pos, wxSeekMode mode = wxFromStart); + virtual wxFileOffset TellO() const; + + virtual size_t LastWrite() const { return wxStreamBase::m_lastcount; } + + virtual void Sync(); + virtual bool Close() { return true; } + + wxOutputStream& operator<<(wxInputStream& out) { return Write(out); } + wxOutputStream& operator<<( __wxOutputManip func) { return func(*this); } + +protected: + // to be implemented in the derived classes (it should have been pure + // virtual) + virtual size_t OnSysWrite(const void *buffer, size_t bufsize); + + friend class wxStreamBuffer; + + wxDECLARE_ABSTRACT_CLASS(wxOutputStream); + wxDECLARE_NO_COPY_CLASS(wxOutputStream); +}; + +// ============================================================================ +// helper stream classes +// ============================================================================ + +// --------------------------------------------------------------------------- +// A stream for measuring streamed output +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxCountingOutputStream : public wxOutputStream +{ +public: + wxCountingOutputStream(); + + virtual wxFileOffset GetLength() const wxOVERRIDE; + bool Ok() const { return IsOk(); } + virtual bool IsOk() const wxOVERRIDE { return true; } + +protected: + virtual size_t OnSysWrite(const void *buffer, size_t size) wxOVERRIDE; + virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE; + virtual wxFileOffset OnSysTell() const wxOVERRIDE; + + size_t m_currentPos, + m_lastPos; + + wxDECLARE_DYNAMIC_CLASS(wxCountingOutputStream); + wxDECLARE_NO_COPY_CLASS(wxCountingOutputStream); +}; + +// --------------------------------------------------------------------------- +// "Filter" streams +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFilterInputStream : public wxInputStream +{ +public: + wxFilterInputStream(); + wxFilterInputStream(wxInputStream& stream); + wxFilterInputStream(wxInputStream *stream); + virtual ~wxFilterInputStream(); + + virtual char Peek() wxOVERRIDE { return m_parent_i_stream->Peek(); } + + virtual wxFileOffset GetLength() const wxOVERRIDE { return m_parent_i_stream->GetLength(); } + + wxInputStream *GetFilterInputStream() const { return m_parent_i_stream; } + +protected: + wxInputStream *m_parent_i_stream; + bool m_owns; + + wxDECLARE_ABSTRACT_CLASS(wxFilterInputStream); + wxDECLARE_NO_COPY_CLASS(wxFilterInputStream); +}; + +class WXDLLIMPEXP_BASE wxFilterOutputStream : public wxOutputStream +{ +public: + wxFilterOutputStream(); + wxFilterOutputStream(wxOutputStream& stream); + wxFilterOutputStream(wxOutputStream *stream); + virtual ~wxFilterOutputStream(); + + virtual wxFileOffset GetLength() const wxOVERRIDE { return m_parent_o_stream->GetLength(); } + + wxOutputStream *GetFilterOutputStream() const { return m_parent_o_stream; } + + bool Close() wxOVERRIDE; + +protected: + wxOutputStream *m_parent_o_stream; + bool m_owns; + + wxDECLARE_ABSTRACT_CLASS(wxFilterOutputStream); + wxDECLARE_NO_COPY_CLASS(wxFilterOutputStream); +}; + +enum wxStreamProtocolType +{ + wxSTREAM_PROTOCOL, // wxFileSystem protocol (should be only one) + wxSTREAM_MIMETYPE, // MIME types the stream handles + wxSTREAM_ENCODING, // The HTTP Content-Encodings the stream handles + wxSTREAM_FILEEXT // File extensions the stream handles +}; + +void WXDLLIMPEXP_BASE wxUseFilterClasses(); + +class WXDLLIMPEXP_BASE wxFilterClassFactoryBase : public wxObject +{ +public: + virtual ~wxFilterClassFactoryBase() { } + + wxString GetProtocol() const { return wxString(*GetProtocols()); } + wxString PopExtension(const wxString& location) const; + + virtual const wxChar * const *GetProtocols(wxStreamProtocolType type + = wxSTREAM_PROTOCOL) const = 0; + + bool CanHandle(const wxString& protocol, + wxStreamProtocolType type + = wxSTREAM_PROTOCOL) const; + +protected: + wxString::size_type FindExtension(const wxString& location) const; + + wxDECLARE_ABSTRACT_CLASS(wxFilterClassFactoryBase); +}; + +class WXDLLIMPEXP_BASE wxFilterClassFactory : public wxFilterClassFactoryBase +{ +public: + virtual ~wxFilterClassFactory() { } + + virtual wxFilterInputStream *NewStream(wxInputStream& stream) const = 0; + virtual wxFilterOutputStream *NewStream(wxOutputStream& stream) const = 0; + virtual wxFilterInputStream *NewStream(wxInputStream *stream) const = 0; + virtual wxFilterOutputStream *NewStream(wxOutputStream *stream) const = 0; + + static const wxFilterClassFactory *Find(const wxString& protocol, + wxStreamProtocolType type + = wxSTREAM_PROTOCOL); + + static const wxFilterClassFactory *GetFirst(); + const wxFilterClassFactory *GetNext() const { return m_next; } + + void PushFront() { Remove(); m_next = sm_first; sm_first = this; } + void Remove(); + +protected: + wxFilterClassFactory() : m_next(this) { } + + wxFilterClassFactory& operator=(const wxFilterClassFactory&) + { return *this; } + +private: + static wxFilterClassFactory *sm_first; + wxFilterClassFactory *m_next; + + wxDECLARE_ABSTRACT_CLASS(wxFilterClassFactory); +}; + +// ============================================================================ +// buffered streams +// ============================================================================ + +// --------------------------------------------------------------------------- +// Stream buffer: this class can be derived from and passed to +// wxBufferedStreams to implement custom buffering +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStreamBuffer +{ +public: + // suppress Xcode 11 warning about shadowing global read() symbol + wxCLANG_WARNING_SUPPRESS(shadow) + + enum BufMode + { + read, + write, + read_write + }; + + wxCLANG_WARNING_RESTORE(shadow) + + wxStreamBuffer(wxStreamBase& stream, BufMode mode) + { + InitWithStream(stream, mode); + } + + wxStreamBuffer(size_t bufsize, wxInputStream& stream) + { + InitWithStream(stream, read); + SetBufferIO(bufsize); + } + + wxStreamBuffer(size_t bufsize, wxOutputStream& stream) + { + InitWithStream(stream, write); + SetBufferIO(bufsize); + } + + wxStreamBuffer(const wxStreamBuffer& buf); + virtual ~wxStreamBuffer(); + + // Filtered IO + virtual size_t Read(void *buffer, size_t size); + size_t Read(wxStreamBuffer *buf); + virtual size_t Write(const void *buffer, size_t size); + size_t Write(wxStreamBuffer *buf); + + virtual char Peek(); + virtual char GetChar(); + virtual void PutChar(char c); + virtual wxFileOffset Tell() const; + virtual wxFileOffset Seek(wxFileOffset pos, wxSeekMode mode); + + // Buffer control + void ResetBuffer(); + void Truncate(); + + // NB: the buffer must always be allocated with malloc() if takeOwn is + // true as it will be deallocated by free() + void SetBufferIO(void *start, void *end, bool takeOwnership = false); + void SetBufferIO(void *start, size_t len, bool takeOwnership = false); + void SetBufferIO(size_t bufsize); + void *GetBufferStart() const { return m_buffer_start; } + void *GetBufferEnd() const { return m_buffer_end; } + void *GetBufferPos() const { return m_buffer_pos; } + size_t GetBufferSize() const { return m_buffer_end - m_buffer_start; } + size_t GetIntPosition() const { return m_buffer_pos - m_buffer_start; } + void SetIntPosition(size_t pos) { m_buffer_pos = m_buffer_start + pos; } + size_t GetLastAccess() const { return m_buffer_end - m_buffer_start; } + size_t GetBytesLeft() const { return m_buffer_end - m_buffer_pos; } + + void Fixed(bool fixed) { m_fixed = fixed; } + void Flushable(bool f) { m_flushable = f; } + + bool FlushBuffer(); + bool FillBuffer(); + size_t GetDataLeft(); + + // misc accessors + wxStreamBase *GetStream() const { return m_stream; } + bool HasBuffer() const { return m_buffer_start != m_buffer_end; } + + bool IsFixed() const { return m_fixed; } + bool IsFlushable() const { return m_flushable; } + + // only for input/output buffers respectively, returns NULL otherwise + wxInputStream *GetInputStream() const; + wxOutputStream *GetOutputStream() const; + + // this constructs a dummy wxStreamBuffer, used by (and exists for) + // wxMemoryStreams only, don't use! + wxStreamBuffer(BufMode mode); + +protected: + void GetFromBuffer(void *buffer, size_t size); + void PutToBuffer(const void *buffer, size_t size); + + // set the last error to the specified value if we didn't have it before + void SetError(wxStreamError err); + + // common part of several ctors + void Init(); + + // common part of ctors taking wxStreamBase parameter + void InitWithStream(wxStreamBase& stream, BufMode mode); + + // init buffer variables to be empty + void InitBuffer(); + + // free the buffer (always safe to call) + void FreeBuffer(); + + // the buffer itself: the pointers to its start and end and the current + // position in the buffer + char *m_buffer_start, + *m_buffer_end, + *m_buffer_pos; + + // the stream we're associated with + wxStreamBase *m_stream; + + // its mode + BufMode m_mode; + + // flags + bool m_destroybuf, // deallocate buffer? + m_fixed, + m_flushable; + + + wxDECLARE_NO_ASSIGN_CLASS(wxStreamBuffer); +}; + +// --------------------------------------------------------------------------- +// wxBufferedInputStream +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxBufferedInputStream : public wxFilterInputStream +{ +public: + // create a buffered stream on top of the specified low-level stream + // + // if a non NULL buffer is given to the stream, it will be deleted by it, + // otherwise a default 1KB buffer will be used + wxBufferedInputStream(wxInputStream& stream, + wxStreamBuffer *buffer = NULL); + + // ctor allowing to specify the buffer size, it's just a more convenient + // alternative to creating wxStreamBuffer, calling its SetBufferIO(bufsize) + // and using the ctor above + wxBufferedInputStream(wxInputStream& stream, size_t bufsize); + + + virtual ~wxBufferedInputStream(); + + virtual char Peek() wxOVERRIDE; + virtual wxInputStream& Read(void *buffer, size_t size) wxOVERRIDE; + + // Position functions + virtual wxFileOffset SeekI(wxFileOffset pos, wxSeekMode mode = wxFromStart) wxOVERRIDE; + virtual wxFileOffset TellI() const wxOVERRIDE; + virtual bool IsSeekable() const wxOVERRIDE { return m_parent_i_stream->IsSeekable(); } + + // the buffer given to the stream will be deleted by it + void SetInputStreamBuffer(wxStreamBuffer *buffer); + wxStreamBuffer *GetInputStreamBuffer() const { return m_i_streambuf; } + +protected: + virtual size_t OnSysRead(void *buffer, size_t bufsize) wxOVERRIDE; + virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode) wxOVERRIDE; + virtual wxFileOffset OnSysTell() const wxOVERRIDE; + + wxStreamBuffer *m_i_streambuf; + + wxDECLARE_NO_COPY_CLASS(wxBufferedInputStream); +}; + +// ---------------------------------------------------------------------------- +// wxBufferedOutputStream +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxBufferedOutputStream : public wxFilterOutputStream +{ +public: + // create a buffered stream on top of the specified low-level stream + // + // if a non NULL buffer is given to the stream, it will be deleted by it, + // otherwise a default 1KB buffer will be used + wxBufferedOutputStream(wxOutputStream& stream, + wxStreamBuffer *buffer = NULL); + + // ctor allowing to specify the buffer size, it's just a more convenient + // alternative to creating wxStreamBuffer, calling its SetBufferIO(bufsize) + // and using the ctor above + wxBufferedOutputStream(wxOutputStream& stream, size_t bufsize); + + virtual ~wxBufferedOutputStream(); + + virtual wxOutputStream& Write(const void *buffer, size_t size) wxOVERRIDE; + + // Position functions + virtual wxFileOffset SeekO(wxFileOffset pos, wxSeekMode mode = wxFromStart) wxOVERRIDE; + virtual wxFileOffset TellO() const wxOVERRIDE; + virtual bool IsSeekable() const wxOVERRIDE { return m_parent_o_stream->IsSeekable(); } + + void Sync() wxOVERRIDE; + bool Close() wxOVERRIDE; + + virtual wxFileOffset GetLength() const wxOVERRIDE; + + // the buffer given to the stream will be deleted by it + void SetOutputStreamBuffer(wxStreamBuffer *buffer); + wxStreamBuffer *GetOutputStreamBuffer() const { return m_o_streambuf; } + +protected: + virtual size_t OnSysWrite(const void *buffer, size_t bufsize) wxOVERRIDE; + virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode) wxOVERRIDE; + virtual wxFileOffset OnSysTell() const wxOVERRIDE; + + wxStreamBuffer *m_o_streambuf; + + wxDECLARE_NO_COPY_CLASS(wxBufferedOutputStream); +}; + +// --------------------------------------------------------------------------- +// wxWrapperInputStream: forwards all IO to another stream. +// --------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxWrapperInputStream : public wxFilterInputStream +{ +public: + // Constructor fully initializing the stream. The overload taking pointer + // takes ownership of the parent stream, the one taking reference does not. + // + // Notice that this class also has a default ctor but it's protected as the + // derived class is supposed to take care of calling InitParentStream() if + // it's used. + wxWrapperInputStream(wxInputStream& stream); + wxWrapperInputStream(wxInputStream* stream); + + // Override the base class methods to forward to the wrapped stream. + virtual wxFileOffset GetLength() const wxOVERRIDE; + virtual bool IsSeekable() const wxOVERRIDE; + +protected: + virtual size_t OnSysRead(void *buffer, size_t size) wxOVERRIDE; + virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE; + virtual wxFileOffset OnSysTell() const wxOVERRIDE; + + // Ensure that our own last error is the same as that of the real stream. + // + // This method is const because the error must be updated even from const + // methods (in other words, it really should have been mutable in the first + // place). + void SynchronizeLastError() const + { + const_cast<wxWrapperInputStream*>(this)-> + Reset(m_parent_i_stream->GetLastError()); + } + + // Default constructor, use InitParentStream() later. + wxWrapperInputStream(); + + // Set up the wrapped stream for an object initialized using the default + // constructor. The ownership logic is the same as above. + void InitParentStream(wxInputStream& stream); + void InitParentStream(wxInputStream* stream); + + wxDECLARE_NO_COPY_CLASS(wxWrapperInputStream); +}; + +// ---------------------------------------------------------------------------- +// wxPeekInputStream(): read some data from a stream and then rewind it back +// ---------------------------------------------------------------------------- + +// This semi-private class is used in wx code to read some data, using the +// provided method of the class T, from a stream if it's seekable and then +// rewind it back. +class wxInputStreamPeeker +{ +public: + explicit wxInputStreamPeeker(wxInputStream& stream) + : m_stream(stream), + m_ofsOrig(stream.IsSeekable() ? stream.TellI() : wxInvalidOffset) + { + } + + // Call the given function if the stream is seekable, otherwise return 0. + template <typename R, typename T> + R CallIfCanSeek(R (T::*func)(wxInputStream&), T* obj) + { + return RewindAndReturn(CanSeek() ? (obj->*func)(m_stream) : R(0)); + } + + // Overload for const methods. + template <typename R, typename T> + R CallIfCanSeek(R (T::*func)(wxInputStream&) const, const T* obj) + { + return RewindAndReturn(CanSeek() ? (obj->*func)(m_stream) : R(0)); + } + +private: + bool CanSeek() const { return m_ofsOrig != wxInvalidOffset; } + + template <typename R> + R RewindAndReturn(R retval) + { + if ( CanSeek() && m_stream.SeekI(m_ofsOrig) == wxInvalidOffset ) + return R(0); + + return retval; + } + + wxInputStream& m_stream; + const wxFileOffset m_ofsOrig; + + wxDECLARE_NO_COPY_CLASS(wxInputStreamPeeker); +}; + +#endif // wxUSE_STREAMS + +#endif // _WX_WXSTREAM_H__ diff --git a/lib/wxWidgets/include/wx/string.h b/lib/wxWidgets/include/wx/string.h new file mode 100644 index 0000000..dc8b5c5 --- /dev/null +++ b/lib/wxWidgets/include/wx/string.h @@ -0,0 +1,4574 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/string.h +// Purpose: wxString class +// Author: Vadim Zeitlin +// Modified by: +// Created: 29/01/98 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +/* + Efficient string class [more or less] compatible with MFC CString, + wxWidgets version 1 wxString and std::string and some handy functions + missing from string.h. +*/ + +#ifndef _WX_WXSTRING_H__ +#define _WX_WXSTRING_H__ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" // everybody should include this + +#if defined(__WXMAC__) + #include <ctype.h> +#endif + +#include <string.h> +#include <stdio.h> +#include <stdarg.h> +#include <limits.h> +#include <stdlib.h> + +#include "wx/wxcrtbase.h" // for wxChar, wxStrlen() etc. +#include "wx/strvararg.h" +#include "wx/buffer.h" // for wxCharBuffer +#include "wx/strconv.h" // for wxConvertXXX() macros and wxMBConv classes +#include "wx/stringimpl.h" +#include "wx/stringops.h" +#include "wx/unichar.h" + +// by default we cache the mapping of the positions in UTF-8 string to the byte +// offset as this results in noticeable performance improvements for loops over +// strings using indices; comment out this line to disable this +// +// notice that this optimization is well worth using even in debug builds as it +// changes asymptotic complexity of algorithms using indices to iterate over +// wxString back to expected linear from quadratic +// +// also notice that wxTLS_TYPE() (__declspec(thread) in this case) is unsafe to +// use in DLL build under pre-Vista Windows so we disable this code for now, if +// anybody really needs to use UTF-8 build under Windows with this optimization +// it would have to be re-tested and probably corrected +// CS: under OSX release builds the string destructor/cache cleanup sometimes +// crashes, disable until we find the true reason or a better workaround +#if wxUSE_UNICODE_UTF8 && !defined(__WINDOWS__) && !defined(__WXOSX__) + #define wxUSE_STRING_POS_CACHE 1 +#else + #define wxUSE_STRING_POS_CACHE 0 +#endif + +#if wxUSE_STRING_POS_CACHE + #include "wx/tls.h" + + // change this 0 to 1 to enable additional (very expensive) asserts + // verifying that string caching logic works as expected + #if 0 + #define wxSTRING_CACHE_ASSERT(cond) wxASSERT(cond) + #else + #define wxSTRING_CACHE_ASSERT(cond) + #endif +#endif // wxUSE_STRING_POS_CACHE + +class WXDLLIMPEXP_FWD_BASE wxString; + +// unless this symbol is predefined to disable the compatibility functions, do +// use them +#ifndef WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER + #define WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER 1 +#endif + +// enforce consistency among encoding-related macros +#ifdef wxNO_IMPLICIT_WXSTRING_ENCODING + +#ifndef wxNO_UNSAFE_WXSTRING_CONV +#define wxNO_UNSAFE_WXSTRING_CONV +#endif + +#if wxUSE_UTF8_LOCALE_ONLY +#error wxNO_IMPLICIT_WXSTRING_ENCODING cannot be used in UTF-8 only builds +#endif + +#endif + +namespace wxPrivate +{ + template <typename T> struct wxStringAsBufHelper; +} + +// --------------------------------------------------------------------------- +// macros +// --------------------------------------------------------------------------- + +// Shorthand for instantiating ASCII strings +#define wxASCII_STR(s) wxString::FromAscii(s) + +// These macros are not used by wxWidgets itself any longer and are only +// preserved for compatibility with the user code that might be still using +// them. Do _not_ use them in the new code, just use const_cast<> instead. +#define WXSTRINGCAST (wxChar *)(const wxChar *) +#define wxCSTRINGCAST (wxChar *)(const wxChar *) +#define wxMBSTRINGCAST (char *)(const char *) +#define wxWCSTRINGCAST (wchar_t *)(const wchar_t *) + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// --------------------------------------------------------------------------- +// global functions complementing standard C string library replacements for +// strlen() and portable strcasecmp() +//--------------------------------------------------------------------------- + +#if WXWIN_COMPATIBILITY_2_8 +// Use wxXXX() functions from wxcrt.h instead! These functions are for +// backwards compatibility only. + +// checks whether the passed in pointer is NULL and if the string is empty +wxDEPRECATED_MSG("use wxIsEmpty() instead") +inline bool IsEmpty(const char *p) { return (!p || !*p); } + +// safe version of strlen() (returns 0 if passed NULL pointer) +wxDEPRECATED_MSG("use wxStrlen() instead") +inline size_t Strlen(const char *psz) + { return psz ? strlen(psz) : 0; } + +// portable strcasecmp/_stricmp +wxDEPRECATED_MSG("use wxStricmp() instead") +inline int Stricmp(const char *psz1, const char *psz2) + { return wxCRT_StricmpA(psz1, psz2); } + +#endif // WXWIN_COMPATIBILITY_2_8 + +// ---------------------------------------------------------------------------- +// wxCStrData +// ---------------------------------------------------------------------------- + +// Lightweight object returned by wxString::c_str() and implicitly convertible +// to either const char* or const wchar_t*. +class wxCStrData +{ +private: + // Ctors; for internal use by wxString and wxCStrData only + wxCStrData(const wxString *str, size_t offset = 0, bool owned = false) + : m_str(str), m_offset(offset), m_owned(owned) {} + +public: + // Ctor constructs the object from char literal; they are needed to make + // operator?: compile and they intentionally take char*, not const char* +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + inline wxCStrData(char *buf); +#endif + inline wxCStrData(wchar_t *buf); + inline wxCStrData(const wxCStrData& data); + + inline ~wxCStrData(); + + // AsWChar() and AsChar() can't be defined here as they use wxString and so + // must come after it and because of this won't be inlined when called from + // wxString methods (without a lot of work to extract these wxString methods + // from inside the class itself). But we still define them being inline + // below to let compiler inline them from elsewhere. And because of this we + // must declare them as inline here because otherwise some compilers give + // warnings about them, e.g. mingw32 3.4.5 warns about "<symbol> defined + // locally after being referenced with dllimport linkage" while IRIX + // mipsPro 7.4 warns about "function declared inline after being called". + inline const wchar_t* AsWChar() const; + operator const wchar_t*() const { return AsWChar(); } + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + inline const char* AsChar() const; + const unsigned char* AsUnsignedChar() const + { return (const unsigned char *) AsChar(); } + operator const char*() const { return AsChar(); } + operator const unsigned char*() const { return AsUnsignedChar(); } + + operator const void*() const { return AsChar(); } + + // returns buffers that are valid as long as the associated wxString exists + const wxScopedCharBuffer AsCharBuf() const + { + return wxScopedCharBuffer::CreateNonOwned(AsChar()); + } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + + const wxScopedWCharBuffer AsWCharBuf() const + { + return wxScopedWCharBuffer::CreateNonOwned(AsWChar()); + } + + inline wxString AsString() const; + + // returns the value as C string in internal representation (equivalent + // to AsString().wx_str(), but more efficient) + const wxStringCharType *AsInternal() const; + + // allow expressions like "c_str()[0]": + inline wxUniChar operator[](size_t n) const; + wxUniChar operator[](int n) const { return operator[](size_t(n)); } + wxUniChar operator[](long n) const { return operator[](size_t(n)); } +#ifndef wxSIZE_T_IS_UINT + wxUniChar operator[](unsigned int n) const { return operator[](size_t(n)); } +#endif // size_t != unsigned int + + // These operators are needed to emulate the pointer semantics of c_str(): + // expressions like "wxChar *p = str.c_str() + 1;" should continue to work + // (we need both versions to resolve ambiguities). Note that this means + // the 'n' value is interpreted as addition to char*/wchar_t* pointer, it + // is *not* number of Unicode characters in wxString. + wxCStrData operator+(int n) const + { return wxCStrData(m_str, m_offset + n, m_owned); } + wxCStrData operator+(long n) const + { return wxCStrData(m_str, m_offset + n, m_owned); } + wxCStrData operator+(size_t n) const + { return wxCStrData(m_str, m_offset + n, m_owned); } + + // and these for "str.c_str() + (p2 - p1)" (it also works for any integer + // expression but it must be ptrdiff_t and not e.g. int to work in this + // example): + wxCStrData operator-(ptrdiff_t n) const + { + wxASSERT_MSG( n <= (ptrdiff_t)m_offset, + wxT("attempt to construct address before the beginning of the string") ); + return wxCStrData(m_str, m_offset - n, m_owned); + } + + // this operator is needed to make expressions like "*c_str()" or + // "*(c_str() + 2)" work + inline wxUniChar operator*() const; + +private: + // the wxString this object was returned for + const wxString *m_str; + // Offset into c_str() return value. Note that this is *not* offset in + // m_str in Unicode characters. Instead, it is index into the + // char*/wchar_t* buffer returned by c_str(). It's interpretation depends + // on how is the wxCStrData instance used: if it is eventually cast to + // const char*, m_offset will be in bytes form string's start; if it is + // cast to const wchar_t*, it will be in wchar_t values. + size_t m_offset; + // should m_str be deleted, i.e. is it owned by us? + bool m_owned; + + friend class WXDLLIMPEXP_FWD_BASE wxString; +}; + +// ---------------------------------------------------------------------------- +// wxString: string class trying to be compatible with std::string, MFC +// CString and wxWindows 1.x wxString all at once +// --------------------------------------------------------------------------- + +#if wxUSE_UNICODE_UTF8 +// see the comment near wxString::iterator for why we need this +class WXDLLIMPEXP_BASE wxStringIteratorNode +{ +public: + wxStringIteratorNode() + : m_str(NULL), m_citer(NULL), m_iter(NULL), m_prev(NULL), m_next(NULL) {} + wxStringIteratorNode(const wxString *str, + wxStringImpl::const_iterator *citer) + { DoSet(str, citer, NULL); } + wxStringIteratorNode(const wxString *str, wxStringImpl::iterator *iter) + { DoSet(str, NULL, iter); } + ~wxStringIteratorNode() + { clear(); } + + inline void set(const wxString *str, wxStringImpl::const_iterator *citer) + { clear(); DoSet(str, citer, NULL); } + inline void set(const wxString *str, wxStringImpl::iterator *iter) + { clear(); DoSet(str, NULL, iter); } + + const wxString *m_str; + wxStringImpl::const_iterator *m_citer; + wxStringImpl::iterator *m_iter; + wxStringIteratorNode *m_prev, *m_next; + +private: + inline void clear(); + inline void DoSet(const wxString *str, + wxStringImpl::const_iterator *citer, + wxStringImpl::iterator *iter); + + // the node belongs to a particular iterator instance, it's not copied + // when a copy of the iterator is made + wxDECLARE_NO_COPY_CLASS(wxStringIteratorNode); +}; +#endif // wxUSE_UNICODE_UTF8 + +class WXDLLIMPEXP_BASE wxString +{ + // NB: special care was taken in arranging the member functions in such order + // that all inline functions can be effectively inlined, verify that all + // performance critical functions are still inlined if you change order! +public: + // an 'invalid' value for string index, moved to this place due to a CW bug + static const size_t npos; + +private: + // if we hadn't made these operators private, it would be possible to + // compile "wxString s; s = 17;" without any warnings as 17 is implicitly + // converted to char in C and we do have operator=(char) + // + // NB: we don't need other versions (short/long and unsigned) as attempt + // to assign another numeric type to wxString will now result in + // ambiguity between operator=(char) and operator=(int) + wxString& operator=(int); + + // these methods are not implemented - there is _no_ conversion from int to + // string, you're doing something wrong if the compiler wants to call it! + // + // try `s << i' or `s.Printf(wxASCII_STR("%d"), i)' instead + wxString(int); + +#ifdef wxNO_IMPLICIT_WXSTRING_ENCODING + // These constructors are disabled because the encoding must be explicit + explicit wxString(const char *psz); + explicit wxString(const char *psz, size_t nLength); + explicit wxString(const unsigned char *psz); + explicit wxString(const unsigned char *psz, size_t nLength); +#endif + + // buffer for holding temporary substring when using any of the methods + // that take (char*,size_t) or (wchar_t*,size_t) arguments: + template<typename T> + struct SubstrBufFromType + { + T data; + size_t len; + + SubstrBufFromType(const T& data_, size_t len_) + : data(data_), len(len_) + { + wxASSERT_MSG( len != npos, "must have real length" ); + } + }; + +#if wxUSE_UNICODE_UTF8 + // even char* -> char* needs conversion, from locale charset to UTF-8 + typedef SubstrBufFromType<wxScopedCharBuffer> SubstrBufFromWC; + typedef SubstrBufFromType<wxScopedCharBuffer> SubstrBufFromMB; +#elif wxUSE_UNICODE_WCHAR + typedef SubstrBufFromType<const wchar_t*> SubstrBufFromWC; + typedef SubstrBufFromType<wxScopedWCharBuffer> SubstrBufFromMB; +#else + typedef SubstrBufFromType<const char*> SubstrBufFromMB; + typedef SubstrBufFromType<wxScopedCharBuffer> SubstrBufFromWC; +#endif + + + // Functions implementing primitive operations on string data; wxString + // methods and iterators are implemented in terms of it. The differences + // between UTF-8 and wchar_t* representations of the string are mostly + // contained here. + +#if wxUSE_UNICODE_UTF8 + static SubstrBufFromMB ConvertStr(const char *psz, size_t nLength, + const wxMBConv& conv); + static SubstrBufFromWC ConvertStr(const wchar_t *pwz, size_t nLength, + const wxMBConv& conv); +#elif wxUSE_UNICODE_WCHAR + static SubstrBufFromMB ConvertStr(const char *psz, size_t nLength, + const wxMBConv& conv); +#else + static SubstrBufFromWC ConvertStr(const wchar_t *pwz, size_t nLength, + const wxMBConv& conv); +#endif + +#if !wxUSE_UNICODE_UTF8 // wxUSE_UNICODE_WCHAR or !wxUSE_UNICODE + // returns C string encoded as the implementation expects: + #if wxUSE_UNICODE + static const wchar_t* ImplStr(const wchar_t* str) + { return str ? str : wxT(""); } + static const SubstrBufFromWC ImplStr(const wchar_t* str, size_t n) + { return SubstrBufFromWC(str, (str && n == npos) ? wxWcslen(str) : n); } + static wxScopedWCharBuffer ImplStr(const char* str, + const wxMBConv& conv wxSTRING_DEFAULT_CONV_ARG) + { return ConvertStr(str, npos, conv).data; } + static SubstrBufFromMB ImplStr(const char* str, size_t n, + const wxMBConv& conv wxSTRING_DEFAULT_CONV_ARG) + { return ConvertStr(str, n, conv); } + #else + static const char* ImplStr(const char* str, + const wxMBConv& WXUNUSED(conv) wxSTRING_DEFAULT_CONV_ARG) + { return str ? str : ""; } + static const SubstrBufFromMB ImplStr(const char* str, size_t n, + const wxMBConv& WXUNUSED(conv) wxSTRING_DEFAULT_CONV_ARG) + { return SubstrBufFromMB(str, (str && n == npos) ? wxStrlen(str) : n); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + static wxScopedCharBuffer ImplStr(const wchar_t* str) + { return ConvertStr(str, npos, wxConvLibc).data; } + static SubstrBufFromWC ImplStr(const wchar_t* str, size_t n) + { return ConvertStr(str, n, wxConvLibc); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + #endif + + // translates position index in wxString to/from index in underlying + // wxStringImpl: + static size_t PosToImpl(size_t pos) { return pos; } + static void PosLenToImpl(size_t pos, size_t len, + size_t *implPos, size_t *implLen) + { *implPos = pos; *implLen = len; } + static size_t LenToImpl(size_t len) { return len; } + static size_t PosFromImpl(size_t pos) { return pos; } + + // we don't want to define these as empty inline functions as it could + // result in noticeable (and quite unnecessary in non-UTF-8 build) slowdown + // in debug build where the inline functions are not effectively inlined + #define wxSTRING_INVALIDATE_CACHE() + #define wxSTRING_INVALIDATE_CACHED_LENGTH() + #define wxSTRING_UPDATE_CACHED_LENGTH(n) + #define wxSTRING_SET_CACHED_LENGTH(n) + +#else // wxUSE_UNICODE_UTF8 + + static wxScopedCharBuffer ImplStr(const char* str, + const wxMBConv& conv wxSTRING_DEFAULT_CONV_ARG) + { return ConvertStr(str, npos, conv).data; } + static SubstrBufFromMB ImplStr(const char* str, size_t n, + const wxMBConv& conv wxSTRING_DEFAULT_CONV_ARG) + { return ConvertStr(str, n, conv); } + + static wxScopedCharBuffer ImplStr(const wchar_t* str) + { return ConvertStr(str, npos, wxMBConvUTF8()).data; } + static SubstrBufFromWC ImplStr(const wchar_t* str, size_t n) + { return ConvertStr(str, n, wxMBConvUTF8()); } + +#if wxUSE_STRING_POS_CACHE + // this is an extremely simple cache used by PosToImpl(): each cache element + // contains the string it applies to and the index corresponding to the last + // used position in this wxString in its m_impl string + // + // NB: notice that this struct (and nested Element one) must be a POD or we + // wouldn't be able to use a thread-local variable of this type, in + // particular it should have no ctor -- we rely on statics being + // initialized to 0 instead + struct Cache + { + enum { SIZE = 8 }; + + struct Element + { + const wxString *str; // the string to which this element applies + size_t pos, // the cached index in this string + impl, // the corresponding position in its m_impl + len; // cached length or npos if unknown + + // reset cached index to 0 + void ResetPos() { pos = impl = 0; } + + // reset position and length + void Reset() { ResetPos(); len = npos; } + }; + + // cache the indices mapping for the last few string used + Element cached[SIZE]; + + // the last used index + unsigned lastUsed; + }; + +#ifndef wxHAS_COMPILER_TLS + // we must use an accessor function and not a static variable when the TLS + // variables support is implemented in the library (and not by the compiler) + // because the global s_cache variable could be not yet initialized when a + // ctor of another global object is executed and if that ctor uses any + // wxString methods, bad things happen + // + // however notice that this approach does not work when compiler TLS is used, + // at least not with g++ 4.1.2 under amd64 as it apparently compiles code + // using this accessor incorrectly when optimizations are enabled (-O2 is + // enough) -- luckily we don't need it then either as static __thread + // variables are initialized by 0 anyhow then and so we can use the variable + // directly + WXEXPORT static Cache& GetCache() + { + static wxTLS_TYPE(Cache) s_cache; + + return wxTLS_VALUE(s_cache); + } + + // this helper struct is used to ensure that GetCache() is called during + // static initialization time, i.e. before any threads creation, as otherwise + // the static s_cache construction inside GetCache() wouldn't be MT-safe + friend struct wxStrCacheInitializer; +#else // wxHAS_COMPILER_TLS + static wxTLS_TYPE(Cache) ms_cache; + static Cache& GetCache() { return wxTLS_VALUE(ms_cache); } +#endif // !wxHAS_COMPILER_TLS/wxHAS_COMPILER_TLS + + static Cache::Element *GetCacheBegin() { return GetCache().cached; } + static Cache::Element *GetCacheEnd() { return GetCacheBegin() + Cache::SIZE; } + static unsigned& LastUsedCacheElement() { return GetCache().lastUsed; } + + // this is used in debug builds only to provide a convenient function, + // callable from a debugger, to show the cache contents + friend struct wxStrCacheDumper; + + // uncomment this to have access to some profiling statistics on program + // termination + //#define wxPROFILE_STRING_CACHE + +#ifdef wxPROFILE_STRING_CACHE + static struct PosToImplCacheStats + { + unsigned postot, // total non-trivial calls to PosToImpl + poshits, // cache hits from PosToImpl() + mishits, // cached position beyond the needed one + sumpos, // sum of all positions, used to compute the + // average position after dividing by postot + sumofs, // sum of all offsets after using the cache, used to + // compute the average after dividing by hits + lentot, // number of total calls to length() + lenhits; // number of cache hits in length() + } ms_cacheStats; + + friend struct wxStrCacheStatsDumper; + + #define wxCACHE_PROFILE_FIELD_INC(field) ms_cacheStats.field++ + #define wxCACHE_PROFILE_FIELD_ADD(field, val) ms_cacheStats.field += (val) +#else // !wxPROFILE_STRING_CACHE + #define wxCACHE_PROFILE_FIELD_INC(field) + #define wxCACHE_PROFILE_FIELD_ADD(field, val) +#endif // wxPROFILE_STRING_CACHE/!wxPROFILE_STRING_CACHE + + // note: it could seem that the functions below shouldn't be inline because + // they are big, contain loops and so the compiler shouldn't be able to + // inline them anyhow, however moving them into string.cpp does decrease the + // code performance by ~5%, at least when using g++ 4.1 so do keep them here + // unless tests show that it's not advantageous any more + + // return the pointer to the cache element for this string or NULL if not + // cached + Cache::Element *FindCacheElement() const + { + // profiling seems to show a small but consistent gain if we use this + // simple loop instead of starting from the last used element (there are + // a lot of misses in this function...) + Cache::Element * const cacheBegin = GetCacheBegin(); +#ifndef wxHAS_COMPILER_TLS + // during destruction tls calls may return NULL, in this case return NULL + // immediately without accessing anything else + if ( cacheBegin == NULL ) + return NULL; +#endif + + // gcc 7 warns about not being able to optimize this loop because of + // possible loop variable overflow, really not sure what to do about + // this, so just disable this warnings for now + wxGCC_ONLY_WARNING_SUPPRESS(unsafe-loop-optimizations) + + Cache::Element * const cacheEnd = GetCacheEnd(); + for ( Cache::Element *c = cacheBegin; c != cacheEnd; c++ ) + { + if ( c->str == this ) + return c; + } + + wxGCC_ONLY_WARNING_RESTORE(unsafe-loop-optimizations) + + return NULL; + } + + // unlike FindCacheElement(), this one always returns a valid pointer to the + // cache element for this string, it may have valid last cached position and + // its corresponding index in the byte string or not + Cache::Element *GetCacheElement() const + { + // gcc warns about cacheBegin and c inside the loop being possibly null, + // but this shouldn't actually be the case +#if wxCHECK_GCC_VERSION(6,1) + wxGCC_ONLY_WARNING_SUPPRESS(null-dereference) +#endif + + Cache::Element * const cacheBegin = GetCacheBegin(); + Cache::Element * const cacheEnd = GetCacheEnd(); + Cache::Element * const cacheStart = cacheBegin + LastUsedCacheElement(); + + // check the last used first, this does no (measurable) harm for a miss + // but does help for simple loops addressing the same string all the time + if ( cacheStart->str == this ) + return cacheStart; + + // notice that we're going to check cacheStart again inside this call but + // profiling shows that it's still faster to use a simple loop like + // inside FindCacheElement() than manually looping with wrapping starting + // from the cache entry after the start one + Cache::Element *c = FindCacheElement(); + if ( !c ) + { + // claim the next cache entry for this string + c = cacheStart; + if ( ++c == cacheEnd ) + c = cacheBegin; + + c->str = this; + c->Reset(); + + // and remember the last used element + LastUsedCacheElement() = static_cast<unsigned int>(c - cacheBegin); + } + + return c; + +#if wxCHECK_GCC_VERSION(6,1) + wxGCC_ONLY_WARNING_RESTORE(null-dereference) +#endif + } + + size_t DoPosToImpl(size_t pos) const + { + wxCACHE_PROFILE_FIELD_INC(postot); + + // NB: although the case of pos == 1 (and offset from cached position + // equal to 1) are common, nothing is gained by writing special code + // for handling them, the compiler (at least g++ 4.1 used) seems to + // optimize the code well enough on its own + + wxCACHE_PROFILE_FIELD_ADD(sumpos, pos); + + Cache::Element * const cache = GetCacheElement(); + + // cached position can't be 0 so if it is, it means that this entry was + // used for length caching only so far, i.e. it doesn't count as a hit + // from our point of view + if ( cache->pos ) + { + wxCACHE_PROFILE_FIELD_INC(poshits); + } + + if ( pos == cache->pos ) + return cache->impl; + + // this seems to happen only rarely so just reset the cache in this case + // instead of complicating code even further by seeking backwards in this + // case + if ( cache->pos > pos ) + { + wxCACHE_PROFILE_FIELD_INC(mishits); + + cache->ResetPos(); + } + + wxCACHE_PROFILE_FIELD_ADD(sumofs, pos - cache->pos); + + + wxStringImpl::const_iterator i(m_impl.begin() + cache->impl); + for ( size_t n = cache->pos; n < pos; n++ ) + wxStringOperations::IncIter(i); + + cache->pos = pos; + cache->impl = i - m_impl.begin(); + + wxSTRING_CACHE_ASSERT( + (int)cache->impl == (begin() + pos).impl() - m_impl.begin() ); + + return cache->impl; + } + + void InvalidateCache() + { + Cache::Element * const cache = FindCacheElement(); + if ( cache ) + cache->Reset(); + } + + void InvalidateCachedLength() + { + Cache::Element * const cache = FindCacheElement(); + if ( cache ) + cache->len = npos; + } + + void SetCachedLength(size_t len) + { + // we optimistically cache the length here even if the string wasn't + // present in the cache before, this seems to do no harm and the + // potential for avoiding length recomputation for long strings looks + // interesting + GetCacheElement()->len = len; + } + + void UpdateCachedLength(ptrdiff_t delta) + { + Cache::Element * const cache = FindCacheElement(); + if ( cache && cache->len != npos ) + { + wxSTRING_CACHE_ASSERT( (ptrdiff_t)cache->len + delta >= 0 ); + + cache->len += delta; + } + } + + #define wxSTRING_INVALIDATE_CACHE() InvalidateCache() + #define wxSTRING_INVALIDATE_CACHED_LENGTH() InvalidateCachedLength() + #define wxSTRING_UPDATE_CACHED_LENGTH(n) UpdateCachedLength(n) + #define wxSTRING_SET_CACHED_LENGTH(n) SetCachedLength(n) +#else // !wxUSE_STRING_POS_CACHE + size_t DoPosToImpl(size_t pos) const + { + return (begin() + pos).impl() - m_impl.begin(); + } + + #define wxSTRING_INVALIDATE_CACHE() + #define wxSTRING_INVALIDATE_CACHED_LENGTH() + #define wxSTRING_UPDATE_CACHED_LENGTH(n) + #define wxSTRING_SET_CACHED_LENGTH(n) +#endif // wxUSE_STRING_POS_CACHE/!wxUSE_STRING_POS_CACHE + + size_t PosToImpl(size_t pos) const + { + return pos == 0 || pos == npos ? pos : DoPosToImpl(pos); + } + + void PosLenToImpl(size_t pos, size_t len, size_t *implPos, size_t *implLen) const; + + size_t LenToImpl(size_t len) const + { + size_t pos, len2; + PosLenToImpl(0, len, &pos, &len2); + return len2; + } + + size_t PosFromImpl(size_t pos) const + { + if ( pos == 0 || pos == npos ) + return pos; + else + return const_iterator(this, m_impl.begin() + pos) - begin(); + } +#endif // !wxUSE_UNICODE_UTF8/wxUSE_UNICODE_UTF8 + +public: + // standard types + typedef wxUniChar value_type; + typedef wxUniChar char_type; + typedef wxUniCharRef reference; + typedef wxChar* pointer; + typedef const wxChar* const_pointer; + + typedef size_t size_type; + typedef const wxUniChar const_reference; + +#if wxUSE_STD_STRING + #if wxUSE_UNICODE_UTF8 + // random access is not O(1), as required by Random Access Iterator + #define WX_STR_ITERATOR_TAG std::bidirectional_iterator_tag + #else + #define WX_STR_ITERATOR_TAG std::random_access_iterator_tag + #endif + #define WX_DEFINE_ITERATOR_CATEGORY(cat) typedef cat iterator_category; +#else + // not defining iterator_category at all in this case is better than defining + // it as some dummy type -- at least it results in more intelligible error + // messages + #define WX_DEFINE_ITERATOR_CATEGORY(cat) +#endif + + #define WX_STR_ITERATOR_IMPL(iterator_name, pointer_type, reference_type) \ + private: \ + typedef wxStringImpl::iterator_name underlying_iterator; \ + public: \ + WX_DEFINE_ITERATOR_CATEGORY(WX_STR_ITERATOR_TAG) \ + typedef wxUniChar value_type; \ + typedef ptrdiff_t difference_type; \ + typedef reference_type reference; \ + typedef pointer_type pointer; \ + \ + reference operator[](size_t n) const { return *(*this + n); } \ + \ + iterator_name& operator++() \ + { wxStringOperations::IncIter(m_cur); return *this; } \ + iterator_name& operator--() \ + { wxStringOperations::DecIter(m_cur); return *this; } \ + iterator_name operator++(int) \ + { \ + iterator_name tmp = *this; \ + wxStringOperations::IncIter(m_cur); \ + return tmp; \ + } \ + iterator_name operator--(int) \ + { \ + iterator_name tmp = *this; \ + wxStringOperations::DecIter(m_cur); \ + return tmp; \ + } \ + \ + iterator_name& operator+=(ptrdiff_t n) \ + { \ + m_cur = wxStringOperations::AddToIter(m_cur, n); \ + return *this; \ + } \ + iterator_name& operator-=(ptrdiff_t n) \ + { \ + m_cur = wxStringOperations::AddToIter(m_cur, -n); \ + return *this; \ + } \ + \ + difference_type operator-(const iterator_name& i) const \ + { return wxStringOperations::DiffIters(m_cur, i.m_cur); } \ + \ + bool operator==(const iterator_name& i) const \ + { return m_cur == i.m_cur; } \ + bool operator!=(const iterator_name& i) const \ + { return m_cur != i.m_cur; } \ + \ + bool operator<(const iterator_name& i) const \ + { return m_cur < i.m_cur; } \ + bool operator>(const iterator_name& i) const \ + { return m_cur > i.m_cur; } \ + bool operator<=(const iterator_name& i) const \ + { return m_cur <= i.m_cur; } \ + bool operator>=(const iterator_name& i) const \ + { return m_cur >= i.m_cur; } \ + \ + private: \ + /* for internal wxString use only: */ \ + underlying_iterator impl() const { return m_cur; } \ + \ + friend class wxString; \ + friend class wxCStrData; \ + \ + private: \ + underlying_iterator m_cur + + class WXDLLIMPEXP_FWD_BASE const_iterator; + +#if wxUSE_UNICODE_UTF8 + // NB: In UTF-8 build, (non-const) iterator needs to keep reference + // to the underlying wxStringImpl, because UTF-8 is variable-length + // encoding and changing the value pointer to by an iterator (using + // its operator*) requires calling wxStringImpl::replace() if the old + // and new values differ in their encoding's length. + // + // Furthermore, the replace() call may invalid all iterators for the + // string, so we have to keep track of outstanding iterators and update + // them if replace() happens. + // + // This is implemented by maintaining linked list of iterators for every + // string and traversing it in wxUniCharRef::operator=(). Head of the + // list is stored in wxString. (FIXME-UTF8) + + class WXDLLIMPEXP_BASE iterator + { + WX_STR_ITERATOR_IMPL(iterator, wxChar*, wxUniCharRef); + + public: + iterator() {} + iterator(const iterator& i) + : m_cur(i.m_cur), m_node(i.str(), &m_cur) {} + iterator& operator=(const iterator& i) + { + if (&i != this) + { + m_cur = i.m_cur; + m_node.set(i.str(), &m_cur); + } + return *this; + } + + reference operator*() + { return wxUniCharRef::CreateForString(*str(), m_cur); } + + iterator operator+(ptrdiff_t n) const + { return iterator(str(), wxStringOperations::AddToIter(m_cur, n)); } + iterator operator-(ptrdiff_t n) const + { return iterator(str(), wxStringOperations::AddToIter(m_cur, -n)); } + + // Normal iterators need to be comparable with the const_iterators so + // declare the comparison operators and implement them below after the + // full const_iterator declaration. + bool operator==(const const_iterator& i) const; + bool operator!=(const const_iterator& i) const; + bool operator<(const const_iterator& i) const; + bool operator>(const const_iterator& i) const; + bool operator<=(const const_iterator& i) const; + bool operator>=(const const_iterator& i) const; + + private: + iterator(wxString *wxstr, underlying_iterator ptr) + : m_cur(ptr), m_node(wxstr, &m_cur) {} + + wxString* str() const { return const_cast<wxString*>(m_node.m_str); } + + wxStringIteratorNode m_node; + + friend class const_iterator; + }; + + class WXDLLIMPEXP_BASE const_iterator + { + // NB: reference_type is intentionally value, not reference, the character + // may be encoded differently in wxString data: + WX_STR_ITERATOR_IMPL(const_iterator, const wxChar*, wxUniChar); + + public: + const_iterator() {} + const_iterator(const const_iterator& i) + : m_cur(i.m_cur), m_node(i.str(), &m_cur) {} + const_iterator(const iterator& i) + : m_cur(i.m_cur), m_node(i.str(), &m_cur) {} + + const_iterator& operator=(const const_iterator& i) + { + if (&i != this) + { + m_cur = i.m_cur; + m_node.set(i.str(), &m_cur); + } + return *this; + } + const_iterator& operator=(const iterator& i) + { m_cur = i.m_cur; m_node.set(i.str(), &m_cur); return *this; } + + reference operator*() const + { return wxStringOperations::DecodeChar(m_cur); } + + const_iterator operator+(ptrdiff_t n) const + { return const_iterator(str(), wxStringOperations::AddToIter(m_cur, n)); } + const_iterator operator-(ptrdiff_t n) const + { return const_iterator(str(), wxStringOperations::AddToIter(m_cur, -n)); } + + // Until C++20 we could avoid defining these comparison operators because + // the implicit conversion from iterator to const_iterator was used to + // reuse the operators defined inside WX_STR_ITERATOR_IMPL. However in + // C++20 the operator overloads with reversed arguments would be used + // instead, resulting in infinite recursion, so we do need them and, just + // for consistency, define them in all cases. + bool operator==(const iterator& i) const; + bool operator!=(const iterator& i) const; + bool operator<(const iterator& i) const; + bool operator>(const iterator& i) const; + bool operator<=(const iterator& i) const; + bool operator>=(const iterator& i) const; + + private: + // for internal wxString use only: + const_iterator(const wxString *wxstr, underlying_iterator ptr) + : m_cur(ptr), m_node(wxstr, &m_cur) {} + + const wxString* str() const { return m_node.m_str; } + + wxStringIteratorNode m_node; + }; + + iterator GetIterForNthChar(size_t n) + { return iterator(this, m_impl.begin() + PosToImpl(n)); } + const_iterator GetIterForNthChar(size_t n) const + { return const_iterator(this, m_impl.begin() + PosToImpl(n)); } +#else // !wxUSE_UNICODE_UTF8 + + class WXDLLIMPEXP_BASE iterator + { + WX_STR_ITERATOR_IMPL(iterator, wxChar*, wxUniCharRef); + + public: + iterator() {} + reference operator*() + { return wxUniCharRef::CreateForString(m_cur); } + + iterator operator+(ptrdiff_t n) const + { return iterator(wxStringOperations::AddToIter(m_cur, n)); } + iterator operator-(ptrdiff_t n) const + { return iterator(wxStringOperations::AddToIter(m_cur, -n)); } + + // As in UTF-8 case above, define comparison operators taking + // const_iterator too. + bool operator==(const const_iterator& i) const; + bool operator!=(const const_iterator& i) const; + bool operator<(const const_iterator& i) const; + bool operator>(const const_iterator& i) const; + bool operator<=(const const_iterator& i) const; + bool operator>=(const const_iterator& i) const; + + private: + // for internal wxString use only: + iterator(underlying_iterator ptr) : m_cur(ptr) {} + iterator(wxString *WXUNUSED(str), underlying_iterator ptr) : m_cur(ptr) {} + + friend class const_iterator; + }; + + class WXDLLIMPEXP_BASE const_iterator + { + // NB: reference_type is intentionally value, not reference, the character + // may be encoded differently in wxString data: + WX_STR_ITERATOR_IMPL(const_iterator, const wxChar*, wxUniChar); + + public: + const_iterator() {} + const_iterator(const iterator& i) : m_cur(i.m_cur) {} + + const_reference operator*() const + { return wxStringOperations::DecodeChar(m_cur); } + + const_iterator operator+(ptrdiff_t n) const + { return const_iterator(wxStringOperations::AddToIter(m_cur, n)); } + const_iterator operator-(ptrdiff_t n) const + { return const_iterator(wxStringOperations::AddToIter(m_cur, -n)); } + + // See comment for comparison operators in the UTF-8 case above. + bool operator==(const iterator& i) const; + bool operator!=(const iterator& i) const; + bool operator<(const iterator& i) const; + bool operator>(const iterator& i) const; + bool operator<=(const iterator& i) const; + bool operator>=(const iterator& i) const; + + private: + // for internal wxString use only: + const_iterator(underlying_iterator ptr) : m_cur(ptr) {} + const_iterator(const wxString *WXUNUSED(str), underlying_iterator ptr) + : m_cur(ptr) {} + }; + + iterator GetIterForNthChar(size_t n) { return begin() + n; } + const_iterator GetIterForNthChar(size_t n) const { return begin() + n; } +#endif // wxUSE_UNICODE_UTF8/!wxUSE_UNICODE_UTF8 + + size_t IterToImplPos(wxString::iterator i) const + { return wxStringImpl::const_iterator(i.impl()) - m_impl.begin(); } + + #undef WX_STR_ITERATOR_TAG + #undef WX_STR_ITERATOR_IMPL + + // This method is mostly used by wxWidgets itself and return the offset of + // the given iterator in bytes relative to the start of the buffer + // representing the current string contents in the current locale encoding. + // + // It is inefficient as it involves converting part of the string to this + // encoding (and also unsafe as it simply returns 0 if the conversion fails) + // and so should be avoided if possible, wx itself only uses it to implement + // backwards-compatible API. + ptrdiff_t IterOffsetInMBStr(const const_iterator& i) const + { + const wxString str(begin(), i); + + // This is logically equivalent to strlen(str.mb_str()) but avoids + // actually converting the string to multibyte and just computes the + // length that it would have after conversion. + + // Note that in UTF-8 build we need to use the actual wide character + // buffer length and not the string length, as it may be different when + // using surrogates, but in wchar_t build they're the same by definition + // and we can avoid creating an extra buffer. +#if wxUSE_UNICODE_UTF8 + const wxScopedWCharBuffer wbuf(str.wc_str()); + const size_t ofs = wxConvLibc.FromWChar(NULL, 0, wbuf.data(), wbuf.length()); +#else // wxUSE_UNICODE_WCHAR + const size_t ofs = wxConvLibc.FromWChar(NULL, 0, str.wc_str(), str.length()); +#endif + return ofs == wxCONV_FAILED ? 0 : static_cast<ptrdiff_t>(ofs); + } + + friend class iterator; + friend class const_iterator; + + template <typename T> + class reverse_iterator_impl + { + public: + typedef T iterator_type; + + WX_DEFINE_ITERATOR_CATEGORY(typename T::iterator_category) + typedef typename T::value_type value_type; + typedef typename T::difference_type difference_type; + typedef typename T::reference reference; + typedef typename T::pointer *pointer; + + reverse_iterator_impl() {} + reverse_iterator_impl(iterator_type i) : m_cur(i) {} + + iterator_type base() const { return m_cur; } + + reference operator*() const { return *(m_cur-1); } + reference operator[](size_t n) const { return *(*this + n); } + + reverse_iterator_impl& operator++() + { --m_cur; return *this; } + reverse_iterator_impl operator++(int) + { reverse_iterator_impl tmp = *this; --m_cur; return tmp; } + reverse_iterator_impl& operator--() + { ++m_cur; return *this; } + reverse_iterator_impl operator--(int) + { reverse_iterator_impl tmp = *this; ++m_cur; return tmp; } + + reverse_iterator_impl operator+(ptrdiff_t n) const + { return reverse_iterator_impl(m_cur - n); } + reverse_iterator_impl operator-(ptrdiff_t n) const + { return reverse_iterator_impl(m_cur + n); } + reverse_iterator_impl operator+=(ptrdiff_t n) + { m_cur -= n; return *this; } + reverse_iterator_impl operator-=(ptrdiff_t n) + { m_cur += n; return *this; } + + difference_type operator-(const reverse_iterator_impl& i) const + { return i.m_cur - m_cur; } + + bool operator==(const reverse_iterator_impl& ri) const + { return m_cur == ri.m_cur; } + bool operator!=(const reverse_iterator_impl& ri) const + { return !(*this == ri); } + + bool operator<(const reverse_iterator_impl& i) const + { return m_cur > i.m_cur; } + bool operator>(const reverse_iterator_impl& i) const + { return m_cur < i.m_cur; } + bool operator<=(const reverse_iterator_impl& i) const + { return m_cur >= i.m_cur; } + bool operator>=(const reverse_iterator_impl& i) const + { return m_cur <= i.m_cur; } + + private: + iterator_type m_cur; + }; + + typedef reverse_iterator_impl<iterator> reverse_iterator; + typedef reverse_iterator_impl<const_iterator> const_reverse_iterator; + +private: + // used to transform an expression built using c_str() (and hence of type + // wxCStrData) to an iterator into the string + static const_iterator CreateConstIterator(const wxCStrData& data) + { + return const_iterator(data.m_str, + (data.m_str->begin() + data.m_offset).impl()); + } + + // in UTF-8 STL build, creation from std::string requires conversion under + // non-UTF8 locales, so we can't have and use wxString(wxStringImpl) ctor; + // instead we define dummy type that lets us have wxString ctor for creation + // from wxStringImpl that couldn't be used by user code (in all other builds, + // "standard" ctors can be used): +#if wxUSE_UNICODE_UTF8 && wxUSE_STL_BASED_WXSTRING + struct CtorFromStringImplTag {}; + + wxString(CtorFromStringImplTag* WXUNUSED(dummy), const wxStringImpl& src) + : m_impl(src) {} + + static wxString FromImpl(const wxStringImpl& src) + { return wxString((CtorFromStringImplTag*)NULL, src); } + + #ifdef wxHAS_RVALUE_REF + wxString(CtorFromStringImplTag* WXUNUSED(dummy), wxStringImpl&& src) wxNOEXCEPT + : m_impl(std::move(src)) {} + + static wxString FromImpl(wxStringImpl&& src) wxNOEXCEPT + { + return wxString((CtorFromStringImplTag*)NULL, std::move(src)); + } + #endif +#else + #if !wxUSE_STL_BASED_WXSTRING + wxString(const wxStringImpl& src) : m_impl(src) { } + // else: already defined as wxString(wxStdString) below + #endif + static wxString FromImpl(const wxStringImpl& src) { return wxString(src); } + #ifdef wxHAS_RVALUE_REF + static wxString FromImpl(wxStringImpl&& src) wxNOEXCEPT { return wxString(std::move(src)); } + #endif +#endif + +public: + // constructors and destructor + // ctor for an empty string + wxString() {} + + // copy ctor + wxString(const wxString& stringSrc) : m_impl(stringSrc.m_impl) { } + +#ifdef wxHAS_RVALUE_REF + // move ctor + wxString(wxString&& stringSrc) wxNOEXCEPT : m_impl(std::move(stringSrc.m_impl)) + { +#if wxUSE_STRING_POS_CACHE + stringSrc.InvalidateCache(); +#endif // wxUSE_STRING_POS_CACHE + } +#endif + + // string containing nRepeat copies of ch + wxString(wxUniChar ch, size_t nRepeat = 1 ) + { assign(nRepeat, ch); } + wxString(size_t nRepeat, wxUniChar ch) + { assign(nRepeat, ch); } + wxString(wxUniCharRef ch, size_t nRepeat = 1) + { assign(nRepeat, ch); } + wxString(size_t nRepeat, wxUniCharRef ch) + { assign(nRepeat, ch); } + wxString(char ch, size_t nRepeat = 1) + { assign(nRepeat, ch); } + wxString(size_t nRepeat, char ch) + { assign(nRepeat, ch); } + wxString(wchar_t ch, size_t nRepeat = 1) + { assign(nRepeat, ch); } + wxString(size_t nRepeat, wchar_t ch) + { assign(nRepeat, ch); } + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + // ctors from char* strings: + wxString(const char *psz) + : m_impl(ImplStr(psz)) {} +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + wxString(const char *psz, const wxMBConv& conv) + : m_impl(ImplStr(psz, conv)) {} +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString(const char *psz, size_t nLength) + { assign(psz, nLength); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + wxString(const char *psz, const wxMBConv& conv, size_t nLength) + { + SubstrBufFromMB str(ImplStr(psz, nLength, conv)); + m_impl.assign(str.data, str.len); + } + + // and unsigned char*: +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString(const unsigned char *psz) + : m_impl(ImplStr((const char*)psz)) {} +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + wxString(const unsigned char *psz, const wxMBConv& conv) + : m_impl(ImplStr((const char*)psz, conv)) {} +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString(const unsigned char *psz, size_t nLength) + { assign((const char*)psz, nLength); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + wxString(const unsigned char *psz, const wxMBConv& conv, size_t nLength) + { + SubstrBufFromMB str(ImplStr((const char*)psz, nLength, conv)); + m_impl.assign(str.data, str.len); + } + + // ctors from wchar_t* strings: + wxString(const wchar_t *pwz) + : m_impl(ImplStr(pwz)) {} + wxString(const wchar_t *pwz, const wxMBConv& WXUNUSED(conv)) + : m_impl(ImplStr(pwz)) {} + wxString(const wchar_t *pwz, size_t nLength) + { assign(pwz, nLength); } + wxString(const wchar_t *pwz, const wxMBConv& WXUNUSED(conv), size_t nLength) + { assign(pwz, nLength); } + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString(const wxScopedCharBuffer& buf) + { assign(buf.data(), buf.length()); } +#endif + wxString(const wxScopedWCharBuffer& buf) + { assign(buf.data(), buf.length()); } + + wxString(const wxScopedCharBuffer& buf, const wxMBConv& conv) + { assign(buf, conv); } + + // NB: this version uses m_impl.c_str() to force making a copy of the + // string, so that "wxString(str.c_str())" idiom for passing strings + // between threads works + wxString(const wxCStrData& cstr) + : m_impl(cstr.AsString().m_impl.c_str()) { } + + // as we provide both ctors with this signature for both char and unsigned + // char string, we need to provide one for wxCStrData to resolve ambiguity + wxString(const wxCStrData& cstr, size_t nLength) + : m_impl(cstr.AsString().Mid(0, nLength).m_impl) {} + + // and because wxString is convertible to wxCStrData and const wxChar * + // we also need to provide this one + wxString(const wxString& str, size_t nLength) + { assign(str, nLength); } +#ifdef wxHAS_RVALUE_REF + wxString(wxString&& str, size_t nLength) + { assign(std::move(str), nLength); } +#endif + + +#if wxUSE_STRING_POS_CACHE + ~wxString() + { + // we need to invalidate our cache entry as another string could be + // recreated at the same address (unlikely, but still possible, with the + // heap-allocated strings but perfectly common with stack-allocated ones) + InvalidateCache(); + } +#endif // wxUSE_STRING_POS_CACHE + + // even if we're not built with wxUSE_STD_STRING_CONV_IN_WXSTRING == 1 it is + // very convenient to allow implicit conversions from std::string to wxString + // and vice verse as this allows to use the same strings in non-GUI and GUI + // code, however we don't want to unconditionally add this ctor as it would + // make wx lib dependent on libstdc++ on some Linux versions which is bad, so + // instead we ask the client code to define this wxUSE_STD_STRING symbol if + // they need it +#if wxUSE_STD_STRING + #if wxUSE_UNICODE_WCHAR + wxString(const wxStdWideString& str) : m_impl(str) {} + #ifdef wxHAS_RVALUE_REF + wxString(wxStdWideString&& str) wxNOEXCEPT : m_impl(std::move(str)) {} + #endif + #else // UTF-8 or ANSI + wxString(const wxStdWideString& str) + { assign(str.c_str(), str.length()); } + #endif + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + #if !wxUSE_UNICODE // ANSI build + // FIXME-UTF8: do this in UTF8 build #if wxUSE_UTF8_LOCALE_ONLY, too + wxString(const std::string& str) : m_impl(str) {} + #ifdef wxHAS_RVALUE_REF + wxString(std::string&& str) wxNOEXCEPT : m_impl(std::move(str)) {} + #endif + #else // Unicode + wxString(const std::string& str) + { assign(str.c_str(), str.length()); } + #endif +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING +#endif // wxUSE_STD_STRING + + // Also always provide explicit conversions to std::[w]string in any case, + // see below for the implicit ones. +#if wxUSE_STD_STRING + // We can avoid a copy if we already use this string type internally, + // otherwise we create a copy on the fly: + #if wxUSE_UNICODE_WCHAR && wxUSE_STL_BASED_WXSTRING + #define wxStringToStdWstringRetType const wxStdWideString& + const wxStdWideString& ToStdWstring() const { return m_impl; } + #else + // wxStringImpl is either not std::string or needs conversion + #define wxStringToStdWstringRetType wxStdWideString + wxStdWideString ToStdWstring() const + { +#if wxUSE_UNICODE_WCHAR + wxScopedWCharBuffer buf = + wxScopedWCharBuffer::CreateNonOwned(m_impl.c_str(), m_impl.length()); +#else // !wxUSE_UNICODE_WCHAR + wxScopedWCharBuffer buf(wc_str()); +#endif + + return wxStdWideString(buf.data(), buf.length()); + } + #endif + + #if (!wxUSE_UNICODE || wxUSE_UTF8_LOCALE_ONLY) && wxUSE_STL_BASED_WXSTRING + // wxStringImpl is std::string in the encoding we want + #define wxStringToStdStringRetType const std::string& + const std::string& ToStdString() const { return m_impl; } + std::string ToStdString(const wxMBConv& WXUNUSED(conv)) const + { + // No conversions are done when not using Unicode as everything is + // supposed to be in 7 bit ASCII anyhow, this method is provided just + // for compatibility with the Unicode build. + return ToStdString(); + } + #else + // wxStringImpl is either not std::string or needs conversion + #define wxStringToStdStringRetType std::string + std::string ToStdString(const wxMBConv& conv wxSTRING_DEFAULT_CONV_ARG) const + { + wxScopedCharBuffer buf(mb_str(conv)); + return std::string(buf.data(), buf.length()); + } + #endif + +#if wxUSE_STD_STRING_CONV_IN_WXSTRING + // Implicit conversions to std::[w]string are not provided by default as + // they conflict with the implicit conversions to "const char/wchar_t *" + // which we use for backwards compatibility but do provide them if + // explicitly requested. +#if wxUSE_UNSAFE_WXSTRING_CONV && !defined(wxNO_UNSAFE_WXSTRING_CONV) + operator wxStringToStdStringRetType() const { return ToStdString(); } +#endif // wxUSE_UNSAFE_WXSTRING_CONV + operator wxStringToStdWstringRetType() const { return ToStdWstring(); } +#endif // wxUSE_STD_STRING_CONV_IN_WXSTRING + +#undef wxStringToStdStringRetType +#undef wxStringToStdWstringRetType + +#endif // wxUSE_STD_STRING + + wxString Clone() const + { + // make a deep copy of the string, i.e. the returned string will have + // ref count = 1 with refcounted implementation + return wxString::FromImpl(wxStringImpl(m_impl.c_str(), m_impl.length())); + } + + // first valid index position + const_iterator begin() const { return const_iterator(this, m_impl.begin()); } + iterator begin() { return iterator(this, m_impl.begin()); } + const_iterator cbegin() const { return const_iterator(this, m_impl.begin()); } + // position one after the last valid one + const_iterator end() const { return const_iterator(this, m_impl.end()); } + iterator end() { return iterator(this, m_impl.end()); } + const_iterator cend() const { return const_iterator(this, m_impl.end()); } + + // first element of the reversed string + const_reverse_iterator rbegin() const + { return const_reverse_iterator(end()); } + reverse_iterator rbegin() + { return reverse_iterator(end()); } + const_reverse_iterator crbegin() const + { return const_reverse_iterator(end()); } + // one beyond the end of the reversed string + const_reverse_iterator rend() const + { return const_reverse_iterator(begin()); } + reverse_iterator rend() + { return reverse_iterator(begin()); } + const_reverse_iterator crend() const + { return const_reverse_iterator(begin()); } + + // std::string methods: +#if wxUSE_UNICODE_UTF8 + size_t length() const + { +#if wxUSE_STRING_POS_CACHE + wxCACHE_PROFILE_FIELD_INC(lentot); + + Cache::Element * const cache = GetCacheElement(); + + if ( cache->len == npos ) + { + // it's probably not worth trying to be clever and using cache->pos + // here as it's probably 0 anyhow -- you usually call length() before + // starting to index the string + cache->len = end() - begin(); + } + else + { + wxCACHE_PROFILE_FIELD_INC(lenhits); + + wxSTRING_CACHE_ASSERT( (int)cache->len == end() - begin() ); + } + + return cache->len; +#else // !wxUSE_STRING_POS_CACHE + return end() - begin(); +#endif // wxUSE_STRING_POS_CACHE/!wxUSE_STRING_POS_CACHE + } +#else + size_t length() const { return m_impl.length(); } +#endif + + size_type size() const { return length(); } + size_type max_size() const { return npos; } + + bool empty() const { return m_impl.empty(); } + + // NB: these methods don't have a well-defined meaning in UTF-8 case + size_type capacity() const { return m_impl.capacity(); } + void reserve(size_t sz) { m_impl.reserve(sz); } + + void shrink_to_fit() { Shrink(); } + + void resize(size_t nSize, wxUniChar ch = wxT('\0')) + { + const size_t len = length(); + if ( nSize == len) + return; + +#if wxUSE_UNICODE_UTF8 + if ( nSize < len ) + { + wxSTRING_INVALIDATE_CACHE(); + + // we can't use wxStringImpl::resize() for truncating the string as it + // counts in bytes, not characters + erase(nSize); + return; + } + + // we also can't use (presumably more efficient) resize() if we have to + // append characters taking more than one byte + if ( !ch.IsAscii() ) + { + append(nSize - len, ch); + } + else // can use (presumably faster) resize() version +#endif // wxUSE_UNICODE_UTF8 + { + wxSTRING_INVALIDATE_CACHED_LENGTH(); + + m_impl.resize(nSize, (wxStringCharType)ch); + } + } + + wxString substr(size_t nStart = 0, size_t nLen = npos) const + { + size_t pos, len; + PosLenToImpl(nStart, nLen, &pos, &len); + return FromImpl(m_impl.substr(pos, len)); + } + + // generic attributes & operations + // as standard strlen() + size_t Len() const { return length(); } + // string contains any characters? + bool IsEmpty() const { return empty(); } + // empty string is "false", so !str will return true + bool operator!() const { return empty(); } + // truncate the string to given length + wxString& Truncate(size_t uiLen); + // empty string contents + void Empty() { clear(); } + // empty the string and free memory + void Clear() { clear(); } + + // contents test + // Is an ascii value + bool IsAscii() const; + // Is a number + bool IsNumber() const; + // Is a word + bool IsWord() const; + + // data access (all indexes are 0 based) + // read access + wxUniChar at(size_t n) const + { return wxStringOperations::DecodeChar(m_impl.begin() + PosToImpl(n)); } + wxUniChar GetChar(size_t n) const + { return at(n); } + // read/write access + wxUniCharRef at(size_t n) + { return *GetIterForNthChar(n); } + wxUniCharRef GetWritableChar(size_t n) + { return at(n); } + // write access + void SetChar(size_t n, wxUniChar ch) + { at(n) = ch; } + + // get last character + wxUniChar Last() const + { + wxASSERT_MSG( !empty(), wxT("wxString: index out of bounds") ); + return *rbegin(); + } + + // get writable last character + wxUniCharRef Last() + { + wxASSERT_MSG( !empty(), wxT("wxString: index out of bounds") ); + return *rbegin(); + } + + /* + Note that we must define all of the overloads below to avoid + ambiguity when using str[0]. + */ + wxUniChar operator[](int n) const + { return at(n); } + wxUniChar operator[](long n) const + { return at(n); } + wxUniChar operator[](size_t n) const + { return at(n); } +#ifndef wxSIZE_T_IS_UINT + wxUniChar operator[](unsigned int n) const + { return at(n); } +#endif // size_t != unsigned int + + // operator versions of GetWriteableChar() + wxUniCharRef operator[](int n) + { return at(n); } + wxUniCharRef operator[](long n) + { return at(n); } + wxUniCharRef operator[](size_t n) + { return at(n); } +#ifndef wxSIZE_T_IS_UINT + wxUniCharRef operator[](unsigned int n) + { return at(n); } +#endif // size_t != unsigned int + + + /* + Overview of wxString conversions, implicit and explicit: + + - wxString has a std::[w]string-like c_str() method, however it does + not return a C-style string directly but instead returns wxCStrData + helper object which is convertible to either "char *" narrow string + or "wchar_t *" wide string. Usually the correct conversion will be + applied by the compiler automatically but if this doesn't happen you + need to explicitly choose one using wxCStrData::AsChar() or AsWChar() + methods or another wxString conversion function. + + - One of the places where the conversion does *NOT* happen correctly is + when c_str() is passed to a vararg function such as printf() so you + must *NOT* use c_str() with them. Either use wxPrintf() (all wx + functions do handle c_str() correctly, even if they appear to be + vararg (but they're not, really)) or add an explicit AsChar() or, if + compatibility with previous wxWidgets versions is important, add a + cast to "const char *". + + - In non-STL mode only, wxString is also implicitly convertible to + wxCStrData. The same warning as above applies. + + - c_str() is polymorphic as it can be converted to either narrow or + wide string. If you explicitly need one or the other, choose to use + mb_str() (for narrow) or wc_str() (for wide) instead. Notice that + these functions can return either the pointer to string directly (if + this is what the string uses internally) or a temporary buffer + containing the string and convertible to it. Again, conversion will + usually be done automatically by the compiler but beware of the + vararg functions: you need an explicit cast when using them. + + - There are also non-const versions of mb_str() and wc_str() called + char_str() and wchar_str(). They are only meant to be used with + non-const-correct functions and they always return buffers. + + - Finally wx_str() returns whatever string representation is used by + wxString internally. It may be either a narrow or wide string + depending on wxWidgets build mode but it will always be a raw pointer + (and not a buffer). + */ + + // explicit conversion to wxCStrData + wxCStrData c_str() const { return wxCStrData(this); } + wxCStrData data() const { return c_str(); } + + // implicit conversion to wxCStrData + operator wxCStrData() const { return c_str(); } + + // the first two operators conflict with operators for conversion to + // std::string and they must be disabled if those conversions are enabled; + // the next one only makes sense if conversions to char* are also defined + // and not defining it in STL build also helps us to get more clear error + // messages for the code which relies on implicit conversion to char* in + // STL build +#if !wxUSE_STD_STRING_CONV_IN_WXSTRING + operator const wchar_t*() const { return c_str(); } + +#if wxUSE_UNSAFE_WXSTRING_CONV && !defined(wxNO_UNSAFE_WXSTRING_CONV) + operator const char*() const { return c_str(); } + // implicit conversion to untyped pointer for compatibility with previous + // wxWidgets versions: this is the same as conversion to const char * so it + // may fail! + operator const void*() const { return c_str(); } +#endif // wxUSE_UNSAFE_WXSTRING_CONV && !defined(wxNO_UNSAFE_WXSTRING_CONV) + +#endif // !wxUSE_STD_STRING_CONV_IN_WXSTRING + + // identical to c_str(), for MFC compatibility + const wxCStrData GetData() const { return c_str(); } + + // explicit conversion to C string in internal representation (char*, + // wchar_t*, UTF-8-encoded char*, depending on the build): + const wxStringCharType *wx_str() const { return m_impl.c_str(); } + + // conversion to *non-const* multibyte or widestring buffer; modifying + // returned buffer won't affect the string, these methods are only useful + // for passing values to const-incorrect functions + wxWritableCharBuffer char_str(const wxMBConv& conv wxSTRING_DEFAULT_CONV_ARG) const + { return mb_str(conv); } + wxWritableWCharBuffer wchar_str() const { return wc_str(); } + + // conversion to the buffer of the given type T (= char or wchar_t) and + // also optionally return the buffer length + // + // this is mostly/only useful for the template functions + template <typename T> + wxCharTypeBuffer<T> tchar_str(size_t *len = NULL) const + { +#if wxUSE_UNICODE + // we need a helper dispatcher depending on type + return wxPrivate::wxStringAsBufHelper<T>::Get(*this, len); +#else // ANSI + // T can only be char in ANSI build + if ( len ) + *len = length(); + + return wxCharTypeBuffer<T>::CreateNonOwned(wx_str(), length()); +#endif // Unicode build kind + } + + // conversion to/from plain (i.e. 7 bit) ASCII: this is useful for + // converting numbers or strings which are certain not to contain special + // chars (typically system functions, X atoms, environment variables etc.) + // + // the behaviour of these functions with the strings containing anything + // else than 7 bit ASCII characters is undefined, use at your own risk. +#if wxUSE_UNICODE + static wxString FromAscii(const char *ascii, size_t len); + static wxString FromAscii(const char *ascii); + static wxString FromAscii(char ascii); + const wxScopedCharBuffer ToAscii(char replaceWith = '_') const; +#else // ANSI + static wxString FromAscii(const char *ascii) { return wxString( ascii ); } + static wxString FromAscii(const char *ascii, size_t len) + { return wxString( ascii, len ); } + static wxString FromAscii(char ascii) { return wxString( ascii ); } + const char *ToAscii(char WXUNUSED(replaceWith) = '_') const { return c_str(); } +#endif // Unicode/!Unicode + + // also provide unsigned char overloads as signed/unsigned doesn't matter + // for 7 bit ASCII characters + static wxString FromAscii(const unsigned char *ascii) + { return FromAscii((const char *)ascii); } + static wxString FromAscii(const unsigned char *ascii, size_t len) + { return FromAscii((const char *)ascii, len); } + + // conversion to/from UTF-8: +#if wxUSE_UNICODE_UTF8 + static wxString FromUTF8Unchecked(const char *utf8) + { + if ( !utf8 ) + return wxEmptyString; + + wxASSERT( wxStringOperations::IsValidUtf8String(utf8) ); + return FromImpl(wxStringImpl(utf8)); + } + static wxString FromUTF8Unchecked(const char *utf8, size_t len) + { + if ( !utf8 ) + return wxEmptyString; + if ( len == npos ) + return FromUTF8Unchecked(utf8); + + wxASSERT( wxStringOperations::IsValidUtf8String(utf8, len) ); + return FromImpl(wxStringImpl(utf8, len)); + } + + static wxString FromUTF8(const char *utf8) + { + if ( !utf8 || !wxStringOperations::IsValidUtf8String(utf8) ) + return wxString(); + + return FromImpl(wxStringImpl(utf8)); + } + static wxString FromUTF8(const char *utf8, size_t len) + { + if ( len == npos ) + return FromUTF8(utf8); + + if ( !utf8 || !wxStringOperations::IsValidUtf8String(utf8, len) ) + return wxString(); + + return FromImpl(wxStringImpl(utf8, len)); + } + +#if wxUSE_STD_STRING + static wxString FromUTF8Unchecked(const std::string& utf8) + { + wxASSERT( wxStringOperations::IsValidUtf8String(utf8.c_str(), utf8.length()) ); + /* + Note that, under wxUSE_UNICODE_UTF8 and wxUSE_STD_STRING, wxStringImpl can be + initialized with a std::string whether wxUSE_STL_BASED_WXSTRING is 1 or not. + */ + return FromImpl(utf8); + } + static wxString FromUTF8(const std::string& utf8) + { + if ( utf8.empty() || !wxStringOperations::IsValidUtf8String(utf8.c_str(), utf8.length()) ) + return wxString(); + return FromImpl(utf8); + } + + #ifdef wxHAS_RVALUE_REF + static wxString FromUTF8Unchecked(std::string&& utf8) wxNOEXCEPT + { + wxASSERT(wxStringOperations::IsValidUtf8String(utf8.c_str(), utf8.length())); + return FromImpl(std::move(utf8)); + } + static wxString FromUTF8(std::string&& utf8) + { + if (utf8.empty() || !wxStringOperations::IsValidUtf8String(utf8.c_str(), utf8.length())) + return wxString(); + return FromImpl(std::move(utf8)); + } + #endif + + std::string utf8_string() const { return m_impl; } +#endif + + const wxScopedCharBuffer utf8_str() const + { return wxCharBuffer::CreateNonOwned(m_impl.c_str(), m_impl.length()); } + + // this function exists in UTF-8 build only and returns the length of the + // internal UTF-8 representation + size_t utf8_length() const { return m_impl.length(); } +#elif wxUSE_UNICODE_WCHAR + static wxString FromUTF8(const char *utf8, size_t len = npos) + { return wxString(utf8, wxMBConvUTF8(), len); } + static wxString FromUTF8Unchecked(const char *utf8, size_t len = npos) + { + const wxString s(utf8, wxMBConvUTF8(), len); + wxASSERT_MSG( !utf8 || !*utf8 || !s.empty(), + "string must be valid UTF-8" ); + return s; + } +#if wxUSE_STD_STRING + static wxString FromUTF8(const std::string& utf8) + { return FromUTF8(utf8.c_str(), utf8.length()); } + static wxString FromUTF8Unchecked(const std::string& utf8) + { return FromUTF8Unchecked(utf8.c_str(), utf8.length()); } + + std::string utf8_string() const { return ToStdString(wxMBConvUTF8()); } +#endif + const wxScopedCharBuffer utf8_str() const { return mb_str(wxMBConvUTF8()); } +#else // ANSI + static wxString FromUTF8(const char *utf8) + { return wxString(wxMBConvUTF8().cMB2WC(utf8)); } + static wxString FromUTF8(const char *utf8, size_t len) + { + size_t wlen; + wxScopedWCharBuffer buf(wxMBConvUTF8().cMB2WC(utf8, len == npos ? wxNO_LEN : len, &wlen)); + return wxString(buf.data(), wlen); + } + static wxString FromUTF8Unchecked(const char *utf8, size_t len = npos) + { + size_t wlen; + wxScopedWCharBuffer buf + ( + wxMBConvUTF8().cMB2WC + ( + utf8, + len == npos ? wxNO_LEN : len, + &wlen + ) + ); + wxASSERT_MSG( !utf8 || !*utf8 || wlen, + "string must be valid UTF-8" ); + + return wxString(buf.data(), wlen); + } +#if wxUSE_STD_STRING + static wxString FromUTF8(const std::string& utf8) + { return FromUTF8(utf8.c_str(), utf8.length()); } + static wxString FromUTF8Unchecked(const std::string& utf8) + { return FromUTF8Unchecked(utf8.c_str(), utf8.length()); } + + std::string utf8_string() const { return ToStdString(wxMBConvUTF8()); } +#endif + const wxScopedCharBuffer utf8_str() const + { + if (empty()) + return wxScopedCharBuffer::CreateNonOwned("", 0); + return wxMBConvUTF8().cWC2MB(wc_str()); + } +#endif + + const wxScopedCharBuffer ToUTF8() const { return utf8_str(); } + + // functions for storing binary data in wxString: +#if wxUSE_UNICODE + static wxString From8BitData(const char *data, size_t len) + { return wxString(data, wxConvISO8859_1, len); } + // version for NUL-terminated data: + static wxString From8BitData(const char *data) + { return wxString(data, wxConvISO8859_1); } + const wxScopedCharBuffer To8BitData() const + { return mb_str(wxConvISO8859_1); } +#else // ANSI + static wxString From8BitData(const char *data, size_t len) + { return wxString(data, len); } + // version for NUL-terminated data: + static wxString From8BitData(const char *data) + { return wxString(data); } + const wxScopedCharBuffer To8BitData() const + { return wxScopedCharBuffer::CreateNonOwned(wx_str(), length()); } +#endif // Unicode/ANSI + + // conversions with (possible) format conversions: have to return a + // buffer with temporary data + // + // the functions defined (in either Unicode or ANSI) mode are mb_str() to + // return an ANSI (multibyte) string, wc_str() to return a wide string and + // fn_str() to return a string which should be used with the OS APIs + // accepting the file names. The return value is always the same, but the + // type differs because a function may either return pointer to the buffer + // directly or have to use intermediate buffer for translation. + +#if wxUSE_UNICODE + + // this is an optimization: even though using mb_str(wxConvLibc) does the + // same thing (i.e. returns pointer to internal representation as locale is + // always an UTF-8 one) in wxUSE_UTF8_LOCALE_ONLY case, we can avoid the + // extra checks and the temporary buffer construction by providing a + // separate mb_str() overload +#if wxUSE_UTF8_LOCALE_ONLY + const char* mb_str() const { return wx_str(); } + const wxScopedCharBuffer mb_str(const wxMBConv& conv) const + { + return AsCharBuf(conv); + } +#else // !wxUSE_UTF8_LOCALE_ONLY + const wxScopedCharBuffer mb_str(const wxMBConv& conv wxSTRING_DEFAULT_CONV_ARG) const + { + return AsCharBuf(conv); + } +#endif // wxUSE_UTF8_LOCALE_ONLY/!wxUSE_UTF8_LOCALE_ONLY + + const wxWX2MBbuf mbc_str() const { return mb_str(*wxConvCurrent); } + +#if wxUSE_UNICODE_WCHAR + const wchar_t* wc_str() const { return wx_str(); } +#elif wxUSE_UNICODE_UTF8 + const wxScopedWCharBuffer wc_str() const + { return AsWCharBuf(wxMBConvStrictUTF8()); } +#endif + // for compatibility with !wxUSE_UNICODE version + const wxWX2WCbuf wc_str(const wxMBConv& WXUNUSED(conv)) const + { return wc_str(); } + +#if wxMBFILES + const wxScopedCharBuffer fn_str() const { return mb_str(wxConvFile); } +#else // !wxMBFILES + const wxWX2WCbuf fn_str() const { return wc_str(); } +#endif // wxMBFILES/!wxMBFILES + +#else // ANSI + const char* mb_str() const { return wx_str(); } + + // for compatibility with wxUSE_UNICODE version + const char* mb_str(const wxMBConv& WXUNUSED(conv)) const { return wx_str(); } + + const wxWX2MBbuf mbc_str() const { return mb_str(); } + + const wxScopedWCharBuffer wc_str(const wxMBConv& conv wxSTRING_DEFAULT_CONV_ARG) const + { return AsWCharBuf(conv); } + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + const wxScopedCharBuffer fn_str() const + { return wxConvFile.cWC2WX( wc_str( wxConvLibc ) ); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING +#endif // Unicode/ANSI + +#if wxUSE_UNICODE_UTF8 + const wxScopedWCharBuffer t_str() const { return wc_str(); } +#elif wxUSE_UNICODE_WCHAR + const wchar_t* t_str() const { return wx_str(); } +#else + const char* t_str() const { return wx_str(); } +#endif + + + // overloaded assignment + // from another wxString + wxString& operator=(const wxString& stringSrc) + { + if ( this != &stringSrc ) + { + wxSTRING_INVALIDATE_CACHE(); + + m_impl = stringSrc.m_impl; + } + + return *this; + } + +#ifdef wxHAS_RVALUE_REF + // move from another wxString + wxString& operator=(wxString&& stringSrc) wxNOEXCEPT + { + m_impl = std::move(stringSrc.m_impl); +#if wxUSE_STRING_POS_CACHE + InvalidateCache(); + stringSrc.InvalidateCache(); +#endif // wxUSE_STRING_POS_CACHE + + return *this; + } +#endif + + wxString& operator=(const wxCStrData& cstr) + { return *this = cstr.AsString(); } + // from a character + wxString& operator=(wxUniChar ch) + { + wxSTRING_INVALIDATE_CACHE(); + + if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) ) + m_impl = (wxStringCharType)ch; + else + m_impl = wxStringOperations::EncodeChar(ch); + + return *this; + } + + wxString& operator=(wxUniCharRef ch) + { return operator=((wxUniChar)ch); } + wxString& operator=(char ch) + { return operator=(wxUniChar(ch)); } + wxString& operator=(unsigned char ch) + { return operator=(wxUniChar(ch)); } + wxString& operator=(wchar_t ch) + { return operator=(wxUniChar(ch)); } + // from a C string - STL probably will crash on NULL, + // so we need to compensate in that case +#if wxUSE_STL_BASED_WXSTRING +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& operator=(const char *psz) + { + wxSTRING_INVALIDATE_CACHE(); + + if ( psz ) + m_impl = ImplStr(psz); + else + clear(); + + return *this; + } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + + wxString& operator=(const wchar_t *pwz) + { + wxSTRING_INVALIDATE_CACHE(); + + if ( pwz ) + m_impl = ImplStr(pwz); + else + clear(); + + return *this; + } +#else // !wxUSE_STL_BASED_WXSTRING +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& operator=(const char *psz) + { + wxSTRING_INVALIDATE_CACHE(); + + m_impl = ImplStr(psz); + + return *this; + } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + + wxString& operator=(const wchar_t *pwz) + { + wxSTRING_INVALIDATE_CACHE(); + + m_impl = ImplStr(pwz); + + return *this; + } +#endif // wxUSE_STL_BASED_WXSTRING/!wxUSE_STL_BASED_WXSTRING + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& operator=(const unsigned char *psz) + { return operator=((const char*)psz); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + + // from wxScopedWCharBuffer + wxString& operator=(const wxScopedWCharBuffer& s) + { return assign(s); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + // from wxScopedCharBuffer + wxString& operator=(const wxScopedCharBuffer& s) + { return assign(s); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + + // string concatenation + // in place concatenation + /* + Concatenate and return the result. Note that the left to right + associativity of << allows to write things like "str << str1 << str2 + << ..." (unlike with +=) + */ + // string += string + wxString& operator<<(const wxString& s) + { +#if WXWIN_COMPATIBILITY_2_8 && !wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8 + wxASSERT_MSG( s.IsValid(), + wxT("did you forget to call UngetWriteBuf()?") ); +#endif + + append(s); + return *this; + } + // string += C string +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& operator<<(const char *psz) + { append(psz); return *this; } +#endif + wxString& operator<<(const wchar_t *pwz) + { append(pwz); return *this; } + wxString& operator<<(const wxCStrData& psz) + { append(psz.AsString()); return *this; } + // string += char + wxString& operator<<(wxUniChar ch) { append(1, ch); return *this; } + wxString& operator<<(wxUniCharRef ch) { append(1, ch); return *this; } + wxString& operator<<(char ch) { append(1, ch); return *this; } + wxString& operator<<(unsigned char ch) { append(1, ch); return *this; } + wxString& operator<<(wchar_t ch) { append(1, ch); return *this; } + + // string += buffer (i.e. from wxGetString) + wxString& operator<<(const wxScopedWCharBuffer& s) + { return append(s); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& operator<<(const wxScopedCharBuffer& s) + { return append(s); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + + // string += C string + wxString& Append(const wxString& s) + { + // test for empty() to share the string if possible + if ( empty() ) + *this = s; + else + append(s); + return *this; + } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& Append(const char* psz) + { append(psz); return *this; } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& Append(const wchar_t* pwz) + { append(pwz); return *this; } + wxString& Append(const wxCStrData& psz) + { append(psz); return *this; } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& Append(const wxScopedCharBuffer& psz) + { append(psz); return *this; } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& Append(const wxScopedWCharBuffer& psz) + { append(psz); return *this; } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& Append(const char* psz, size_t nLen) + { append(psz, nLen); return *this; } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& Append(const wchar_t* pwz, size_t nLen) + { append(pwz, nLen); return *this; } + wxString& Append(const wxCStrData& psz, size_t nLen) + { append(psz, nLen); return *this; } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& Append(const wxScopedCharBuffer& psz, size_t nLen) + { append(psz, nLen); return *this; } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& Append(const wxScopedWCharBuffer& psz, size_t nLen) + { append(psz, nLen); return *this; } + // append count copies of given character + wxString& Append(wxUniChar ch, size_t count = 1u) + { append(count, ch); return *this; } + wxString& Append(wxUniCharRef ch, size_t count = 1u) + { append(count, ch); return *this; } + wxString& Append(char ch, size_t count = 1u) + { append(count, ch); return *this; } + wxString& Append(unsigned char ch, size_t count = 1u) + { append(count, ch); return *this; } + wxString& Append(wchar_t ch, size_t count = 1u) + { append(count, ch); return *this; } + + // prepend a string, return the string itself + wxString& Prepend(const wxString& str) + { *this = str + *this; return *this; } + + // non-destructive concatenation + // two strings + friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string1, + const wxString& string2); + // string with a single char + friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string, wxUniChar ch); + // char with a string + friend wxString WXDLLIMPEXP_BASE operator+(wxUniChar ch, const wxString& string); + // string with C string +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string, + const char *psz); +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string, + const wchar_t *pwz); + // C string with string +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + friend wxString WXDLLIMPEXP_BASE operator+(const char *psz, + const wxString& string); +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + friend wxString WXDLLIMPEXP_BASE operator+(const wchar_t *pwz, + const wxString& string); + + // stream-like functions + // insert an int into string + wxString& operator<<(int i) + { return (*this) << Format(wxT("%d"), i); } + // insert an unsigned int into string + wxString& operator<<(unsigned int ui) + { return (*this) << Format(wxT("%u"), ui); } + // insert a long into string + wxString& operator<<(long l) + { return (*this) << Format(wxT("%ld"), l); } + // insert an unsigned long into string + wxString& operator<<(unsigned long ul) + { return (*this) << Format(wxT("%lu"), ul); } +#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG + // insert a long long if they exist and aren't longs + wxString& operator<<(wxLongLong_t ll) + { + return (*this) << Format(wxASCII_STR("%" wxLongLongFmtSpec "d"), ll); + } + // insert an unsigned long long + wxString& operator<<(wxULongLong_t ull) + { + return (*this) << Format(wxASCII_STR("%" wxLongLongFmtSpec "u") , ull); + } +#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG + // insert a float into string + wxString& operator<<(float f) + { return *this << Format(wxS("%f"), static_cast<double>(f)); } + // insert a double into string + wxString& operator<<(double d) + { return (*this) << Format(wxT("%g"), d); } + + // string comparison + // case-sensitive comparison (returns a value < 0, = 0 or > 0) +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + int Cmp(const char *psz) const + { return compare(psz); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + int Cmp(const wchar_t *pwz) const + { return compare(pwz); } + int Cmp(const wxString& s) const + { return compare(s); } + int Cmp(const wxCStrData& s) const + { return compare(s); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + int Cmp(const wxScopedCharBuffer& s) const + { return compare(s); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + int Cmp(const wxScopedWCharBuffer& s) const + { return compare(s); } + // same as Cmp() but not case-sensitive + int CmpNoCase(const wxString& s) const; + + // test for the string equality, either considering case or not + // (if compareWithCase then the case matters) + bool IsSameAs(const wxString& str, bool compareWithCase = true) const + { +#if !wxUSE_UNICODE_UTF8 + // in UTF-8 build, length() is O(n) and doing this would be _slower_ + if ( length() != str.length() ) + return false; +#endif + return (compareWithCase ? Cmp(str) : CmpNoCase(str)) == 0; + } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + bool IsSameAs(const char *str, bool compareWithCase = true) const + { return (compareWithCase ? Cmp(str) : CmpNoCase(str)) == 0; } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + bool IsSameAs(const wchar_t *str, bool compareWithCase = true) const + { return (compareWithCase ? Cmp(str) : CmpNoCase(str)) == 0; } + + bool IsSameAs(const wxCStrData& str, bool compareWithCase = true) const + { return IsSameAs(str.AsString(), compareWithCase); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + bool IsSameAs(const wxScopedCharBuffer& str, bool compareWithCase = true) const + { return IsSameAs(str.data(), compareWithCase); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + bool IsSameAs(const wxScopedWCharBuffer& str, bool compareWithCase = true) const + { return IsSameAs(str.data(), compareWithCase); } + // comparison with a single character: returns true if equal + bool IsSameAs(wxUniChar c, bool compareWithCase = true) const; + // FIXME-UTF8: remove these overloads + bool IsSameAs(wxUniCharRef c, bool compareWithCase = true) const + { return IsSameAs(wxUniChar(c), compareWithCase); } + bool IsSameAs(char c, bool compareWithCase = true) const + { return IsSameAs(wxUniChar(c), compareWithCase); } + bool IsSameAs(unsigned char c, bool compareWithCase = true) const + { return IsSameAs(wxUniChar(c), compareWithCase); } + bool IsSameAs(wchar_t c, bool compareWithCase = true) const + { return IsSameAs(wxUniChar(c), compareWithCase); } + bool IsSameAs(int c, bool compareWithCase = true) const + { return IsSameAs(wxUniChar(c), compareWithCase); } + + // simple sub-string extraction + // return substring starting at nFirst of length nCount (or till the end + // if nCount = default value) + wxString Mid(size_t nFirst, size_t nCount = npos) const; + + // operator version of Mid() + wxString operator()(size_t start, size_t len) const + { return Mid(start, len); } + + // check if the string starts with the given prefix and return the rest + // of the string in the provided pointer if it is not NULL; otherwise + // return false + bool StartsWith(const wxString& prefix, wxString *rest = NULL) const; + // check if the string ends with the given suffix and return the + // beginning of the string before the suffix in the provided pointer if + // it is not NULL; otherwise return false + bool EndsWith(const wxString& suffix, wxString *rest = NULL) const; + + // get first nCount characters + wxString Left(size_t nCount) const; + // get last nCount characters + wxString Right(size_t nCount) const; + // get all characters before the first occurrence of ch + // (returns the whole string if ch not found) and also put everything + // following the first occurrence of ch into rest if it's non-NULL + wxString BeforeFirst(wxUniChar ch, wxString *rest = NULL) const; + // get all characters before the last occurrence of ch + // (returns empty string if ch not found) and also put everything + // following the last occurrence of ch into rest if it's non-NULL + wxString BeforeLast(wxUniChar ch, wxString *rest = NULL) const; + // get all characters after the first occurrence of ch + // (returns empty string if ch not found) + wxString AfterFirst(wxUniChar ch) const; + // get all characters after the last occurrence of ch + // (returns the whole string if ch not found) + wxString AfterLast(wxUniChar ch) const; + + // for compatibility only, use more explicitly named functions above + wxString Before(wxUniChar ch) const { return BeforeLast(ch); } + wxString After(wxUniChar ch) const { return AfterFirst(ch); } + + // case conversion + // convert to upper case in place, return the string itself + wxString& MakeUpper(); + // convert to upper case, return the copy of the string + wxString Upper() const { return wxString(*this).MakeUpper(); } + // convert to lower case in place, return the string itself + wxString& MakeLower(); + // convert to lower case, return the copy of the string + wxString Lower() const { return wxString(*this).MakeLower(); } + // convert the first character to the upper case and the rest to the + // lower one, return the modified string itself + wxString& MakeCapitalized(); + // convert the first character to the upper case and the rest to the + // lower one, return the copy of the string + wxString Capitalize() const { return wxString(*this).MakeCapitalized(); } + + // trimming/padding whitespace (either side) and truncating + // remove spaces from left or from right (default) side + wxString& Trim(bool bFromRight = true); + // add nCount copies chPad in the beginning or at the end (default) + wxString& Pad(size_t nCount, wxUniChar chPad = wxT(' '), bool bFromRight = true); + + // searching and replacing + // searching (return starting index, or -1 if not found) + int Find(wxUniChar ch, bool bFromEnd = false) const; // like strchr/strrchr + int Find(wxUniCharRef ch, bool bFromEnd = false) const + { return Find(wxUniChar(ch), bFromEnd); } + int Find(char ch, bool bFromEnd = false) const + { return Find(wxUniChar(ch), bFromEnd); } + int Find(unsigned char ch, bool bFromEnd = false) const + { return Find(wxUniChar(ch), bFromEnd); } + int Find(wchar_t ch, bool bFromEnd = false) const + { return Find(wxUniChar(ch), bFromEnd); } + // searching (return starting index, or -1 if not found) + int Find(const wxString& sub) const // like strstr + { + const size_type idx = find(sub); + return (idx == npos) ? wxNOT_FOUND : (int)idx; + } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + int Find(const char *sub) const // like strstr + { + const size_type idx = find(sub); + return (idx == npos) ? wxNOT_FOUND : (int)idx; + } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + int Find(const wchar_t *sub) const // like strstr + { + const size_type idx = find(sub); + return (idx == npos) ? wxNOT_FOUND : (int)idx; + } + + int Find(const wxCStrData& sub) const + { return Find(sub.AsString()); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + int Find(const wxScopedCharBuffer& sub) const + { return Find(sub.data()); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + int Find(const wxScopedWCharBuffer& sub) const + { return Find(sub.data()); } + + // replace first (or all of bReplaceAll) occurrences of substring with + // another string, returns the number of replacements made + size_t Replace(const wxString& strOld, + const wxString& strNew, + bool bReplaceAll = true); + + // check if the string contents matches a mask containing '*' and '?' + bool Matches(const wxString& mask) const; + + // conversion to numbers: all functions return true only if the whole + // string is a number and put the value of this number into the pointer + // provided, the base is the numeric base in which the conversion should be + // done and must be comprised between 2 and 36 or be 0 in which case the + // standard C rules apply (leading '0' => octal, "0x" => hex) + + // convert to a signed integer + bool ToInt(int *val, int base = 10) const; + // convert to an unsigned integer + bool ToUInt(unsigned int *val, int base = 10) const; + // convert to a signed long + bool ToLong(long *val, int base = 10) const; + // convert to an unsigned long + bool ToULong(unsigned long *val, int base = 10) const; + // convert to wxLongLong +#if defined(wxLongLong_t) + bool ToLongLong(wxLongLong_t *val, int base = 10) const; + // convert to wxULongLong + bool ToULongLong(wxULongLong_t *val, int base = 10) const; +#endif // wxLongLong_t + // convert to a double + bool ToDouble(double *val) const; + + // conversions to numbers using C locale + // convert to a signed integer + bool ToCLong(long *val, int base = 10) const; + // convert to an unsigned integer + bool ToCULong(unsigned long *val, int base = 10) const; + // convert to a double + bool ToCDouble(double *val) const; + + // create a string representing the given floating point number with the + // default (like %g) or fixed (if precision >=0) precision + // in the current locale + static wxString FromDouble(double val, int precision = -1); + // in C locale + static wxString FromCDouble(double val, int precision = -1); + + // formatted input/output + // as sprintf(), returns the number of characters written or < 0 on error + // (take 'this' into account in attribute parameter count) + // int Printf(const wxString& format, ...); + WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const wxFormatString&), + DoPrintfWchar, DoPrintfUtf8) + // as vprintf(), returns the number of characters written or < 0 on error + int PrintfV(const wxString& format, va_list argptr); + + // returns the string containing the result of Printf() to it + // static wxString Format(const wxString& format, ...) WX_ATTRIBUTE_PRINTF_1; + WX_DEFINE_VARARG_FUNC(static wxString, Format, 1, (const wxFormatString&), + DoFormatWchar, DoFormatUtf8) + // the same as above, but takes a va_list + static wxString FormatV(const wxString& format, va_list argptr); + + // raw access to string memory + // ensure that string has space for at least nLen characters + // only works if the data of this string is not shared + bool Alloc(size_t nLen) { reserve(nLen); return capacity() >= nLen; } + // minimize the string's memory + // only works if the data of this string is not shared + bool Shrink(); +#if WXWIN_COMPATIBILITY_2_8 && !wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8 + // These are deprecated, use wxStringBuffer or wxStringBufferLength instead + // + // get writable buffer of at least nLen bytes. Unget() *must* be called + // a.s.a.p. to put string back in a reasonable state! + wxDEPRECATED( wxStringCharType *GetWriteBuf(size_t nLen) ); + // call this immediately after GetWriteBuf() has been used + wxDEPRECATED( void UngetWriteBuf() ); + wxDEPRECATED( void UngetWriteBuf(size_t nLen) ); +#endif // WXWIN_COMPATIBILITY_2_8 && !wxUSE_STL_BASED_WXSTRING && wxUSE_UNICODE_UTF8 + + // wxWidgets version 1 compatibility functions + + // use Mid() + wxString SubString(size_t from, size_t to) const + { return Mid(from, (to - from + 1)); } + // values for second parameter of CompareTo function + enum caseCompare {exact, ignoreCase}; + // values for first parameter of Strip function + enum stripType {leading = 0x1, trailing = 0x2, both = 0x3}; + + // use Printf() + // (take 'this' into account in attribute parameter count) + // int sprintf(const wxString& format, ...) WX_ATTRIBUTE_PRINTF_2; + WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const wxFormatString&), + DoPrintfWchar, DoPrintfUtf8) + + // use Cmp() + int CompareTo(const wxChar* psz, caseCompare cmp = exact) const + { return cmp == exact ? Cmp(psz) : CmpNoCase(psz); } + + // use length() + size_t Length() const { return length(); } + // Count the number of characters + int Freq(wxUniChar ch) const; + // use MakeLower + void LowerCase() { MakeLower(); } + // use MakeUpper + void UpperCase() { MakeUpper(); } + // use Trim except that it doesn't change this string + wxString Strip(stripType w = trailing) const; + + // use Find (more general variants not yet supported) + size_t Index(const wxChar* psz) const { return Find(psz); } + size_t Index(wxUniChar ch) const { return Find(ch); } + // use Truncate + wxString& Remove(size_t pos) { return Truncate(pos); } + wxString& RemoveLast(size_t n = 1) { return Truncate(length() - n); } + + wxString& Remove(size_t nStart, size_t nLen) + { return (wxString&)erase( nStart, nLen ); } + + // use Find() + int First( wxUniChar ch ) const { return Find(ch); } + int First( wxUniCharRef ch ) const { return Find(ch); } + int First( char ch ) const { return Find(ch); } + int First( unsigned char ch ) const { return Find(ch); } + int First( wchar_t ch ) const { return Find(ch); } + int First( const wxString& str ) const { return Find(str); } + int Last( wxUniChar ch ) const { return Find(ch, true); } + bool Contains(const wxString& str) const { return Find(str) != wxNOT_FOUND; } + + // use empty() + bool IsNull() const { return empty(); } + + // std::string compatibility functions + + // take nLen chars starting at nPos + wxString(const wxString& str, size_t nPos, size_t nLen) + { assign(str, nPos, nLen); } + // take all characters from first to last + wxString(const_iterator first, const_iterator last) + : m_impl(first.impl(), last.impl()) { } +#if WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER + // the 2 overloads below are for compatibility with the existing code using + // pointers instead of iterators +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString(const char *first, const char *last) + { + SubstrBufFromMB str(ImplStr(first, last - first)); + m_impl.assign(str.data, str.len); + } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + wxString(const wchar_t *first, const wchar_t *last) + { + SubstrBufFromWC str(ImplStr(first, last - first)); + m_impl.assign(str.data, str.len); + } + // and this one is needed to compile code adding offsets to c_str() result + wxString(const wxCStrData& first, const wxCStrData& last) + : m_impl(CreateConstIterator(first).impl(), + CreateConstIterator(last).impl()) + { + wxASSERT_MSG( first.m_str == last.m_str, + wxT("pointers must be into the same string") ); + } +#endif // WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER + + // lib.string.modifiers + // append elements str[pos], ..., str[pos+n] + wxString& append(const wxString& str, size_t pos, size_t n) + { + wxSTRING_UPDATE_CACHED_LENGTH(n); + + size_t from, len; + str.PosLenToImpl(pos, n, &from, &len); + m_impl.append(str.m_impl, from, len); + return *this; + } + // append a string + wxString& append(const wxString& str) + { + wxSTRING_UPDATE_CACHED_LENGTH(str.length()); + + m_impl.append(str.m_impl); + return *this; + } + + // append first n (or all if n == npos) characters of sz +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& append(const char *sz) + { + wxSTRING_INVALIDATE_CACHED_LENGTH(); + + m_impl.append(ImplStr(sz)); + return *this; + } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + + wxString& append(const wchar_t *sz) + { + wxSTRING_INVALIDATE_CACHED_LENGTH(); + + m_impl.append(ImplStr(sz)); + return *this; + } + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& append(const char *sz, size_t n) + { + wxSTRING_INVALIDATE_CACHED_LENGTH(); + + SubstrBufFromMB str(ImplStr(sz, n)); + m_impl.append(str.data, str.len); + return *this; + } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& append(const wchar_t *sz, size_t n) + { + wxSTRING_UPDATE_CACHED_LENGTH(n); + + SubstrBufFromWC str(ImplStr(sz, n)); + m_impl.append(str.data, str.len); + return *this; + } + + wxString& append(const wxCStrData& str) + { return append(str.AsString()); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& append(const wxScopedCharBuffer& str) + { return append(str.data(), str.length()); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& append(const wxScopedWCharBuffer& str) + { return append(str.data(), str.length()); } + wxString& append(const wxCStrData& str, size_t n) + { return append(str.AsString(), 0, n); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& append(const wxScopedCharBuffer& str, size_t n) + { return append(str.data(), n); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& append(const wxScopedWCharBuffer& str, size_t n) + { return append(str.data(), n); } + + // append n copies of ch + wxString& append(size_t n, wxUniChar ch) + { + if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) ) + { + wxSTRING_UPDATE_CACHED_LENGTH(n); + + m_impl.append(n, (wxStringCharType)ch); + } + else + { + wxSTRING_INVALIDATE_CACHED_LENGTH(); + + m_impl.append(wxStringOperations::EncodeNChars(n, ch)); + } + + return *this; + } + + wxString& append(size_t n, wxUniCharRef ch) + { return append(n, wxUniChar(ch)); } + wxString& append(size_t n, char ch) + { return append(n, wxUniChar(ch)); } + wxString& append(size_t n, unsigned char ch) + { return append(n, wxUniChar(ch)); } + wxString& append(size_t n, wchar_t ch) + { return append(n, wxUniChar(ch)); } + + // append from first to last + wxString& append(const_iterator first, const_iterator last) + { + wxSTRING_INVALIDATE_CACHED_LENGTH(); + + m_impl.append(first.impl(), last.impl()); + return *this; + } +#if WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& append(const char *first, const char *last) + { return append(first, last - first); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& append(const wchar_t *first, const wchar_t *last) + { return append(first, last - first); } + wxString& append(const wxCStrData& first, const wxCStrData& last) + { return append(CreateConstIterator(first), CreateConstIterator(last)); } +#endif // WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER + + // same as `this_string = str' + wxString& assign(const wxString& str) + { + wxSTRING_SET_CACHED_LENGTH(str.length()); + + m_impl = str.m_impl; + + return *this; + } + +#ifdef wxHAS_RVALUE_REF + wxString& assign(wxString&& str) wxNOEXCEPT + { + #if wxUSE_STRING_POS_CACHE + wxSTRING_SET_CACHED_LENGTH(str.length()); + str.InvalidateCache(); + #endif + m_impl = std::move(str.m_impl); + + return *this; + } +#endif + + // This is a non-standard-compliant overload taking the first "len" + // characters of the source string. + wxString& assign(const wxString& str, size_t len) + { +#if wxUSE_STRING_POS_CACHE + // It is legal to pass len > str.length() to wxStringImpl::assign() but + // by restricting it here we save some work for that function so it's not + // really less efficient and, at the same time, ensure that we don't + // cache invalid length. + const size_t lenSrc = str.length(); + if ( len > lenSrc ) + len = lenSrc; + + wxSTRING_SET_CACHED_LENGTH(len); +#endif // wxUSE_STRING_POS_CACHE + + m_impl.assign(str.m_impl, 0, str.LenToImpl(len)); + + return *this; + } + +#ifdef wxHAS_RVALUE_REF + wxString& assign(wxString&& str, size_t len) + { + str.Truncate(len); + return assign(std::move(str)); + } +#endif + + // same as ` = str[pos..pos + n] + wxString& assign(const wxString& str, size_t pos, size_t n) + { + size_t from, len; + str.PosLenToImpl(pos, n, &from, &len); + m_impl.assign(str.m_impl, from, len); + + // it's important to call this after PosLenToImpl() above in case str is + // the same string as this one + wxSTRING_SET_CACHED_LENGTH(n); + + return *this; + } + + // same as `= first n (or all if n == npos) characters of sz' +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& assign(const char *sz) + { + wxSTRING_INVALIDATE_CACHE(); + + m_impl.assign(ImplStr(sz)); + + return *this; + } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + + wxString& assign(const wchar_t *sz) + { + wxSTRING_INVALIDATE_CACHE(); + + m_impl.assign(ImplStr(sz)); + + return *this; + } + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& assign(const char *sz, size_t n) + { + wxSTRING_INVALIDATE_CACHE(); + + SubstrBufFromMB str(ImplStr(sz, n)); + m_impl.assign(str.data, str.len); + + return *this; + } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + + wxString& assign(const wchar_t *sz, size_t n) + { + wxSTRING_SET_CACHED_LENGTH(n); + + SubstrBufFromWC str(ImplStr(sz, n)); + m_impl.assign(str.data, str.len); + + return *this; + } + + wxString& assign(const wxCStrData& str) + { return assign(str.AsString()); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& assign(const wxScopedCharBuffer& str) + { return assign(str.data(), str.length()); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& assign(const wxScopedCharBuffer& buf, const wxMBConv& conv) + { + SubstrBufFromMB str(ImplStr(buf.data(), buf.length(), conv)); + m_impl.assign(str.data, str.len); + + return *this; + } + wxString& assign(const wxScopedWCharBuffer& str) + { return assign(str.data(), str.length()); } + wxString& assign(const wxCStrData& str, size_t len) + { return assign(str.AsString(), len); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& assign(const wxScopedCharBuffer& str, size_t len) + { return assign(str.data(), len); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& assign(const wxScopedWCharBuffer& str, size_t len) + { return assign(str.data(), len); } + + // same as `= n copies of ch' + wxString& assign(size_t n, wxUniChar ch) + { + wxSTRING_SET_CACHED_LENGTH(n); + + if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) ) + m_impl.assign(n, (wxStringCharType)ch); + else + m_impl.assign(wxStringOperations::EncodeNChars(n, ch)); + + return *this; + } + + wxString& assign(size_t n, wxUniCharRef ch) + { return assign(n, wxUniChar(ch)); } + wxString& assign(size_t n, char ch) + { return assign(n, wxUniChar(ch)); } + wxString& assign(size_t n, unsigned char ch) + { return assign(n, wxUniChar(ch)); } + wxString& assign(size_t n, wchar_t ch) + { return assign(n, wxUniChar(ch)); } + + // assign from first to last + wxString& assign(const_iterator first, const_iterator last) + { + wxSTRING_INVALIDATE_CACHE(); + + m_impl.assign(first.impl(), last.impl()); + + return *this; + } +#if WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& assign(const char *first, const char *last) + { return assign(first, last - first); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& assign(const wchar_t *first, const wchar_t *last) + { return assign(first, last - first); } + wxString& assign(const wxCStrData& first, const wxCStrData& last) + { return assign(CreateConstIterator(first), CreateConstIterator(last)); } +#endif // WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER + + // string comparison + int compare(const wxString& str) const; +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + int compare(const char* sz) const; +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + int compare(const wchar_t* sz) const; + int compare(const wxCStrData& str) const + { return compare(str.AsString()); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + int compare(const wxScopedCharBuffer& str) const + { return compare(str.data()); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + int compare(const wxScopedWCharBuffer& str) const + { return compare(str.data()); } + // comparison with a substring + int compare(size_t nStart, size_t nLen, const wxString& str) const; + // comparison of 2 substrings + int compare(size_t nStart, size_t nLen, + const wxString& str, size_t nStart2, size_t nLen2) const; + // substring comparison with first nCount characters of sz +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + int compare(size_t nStart, size_t nLen, + const char* sz, size_t nCount = npos) const; +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + int compare(size_t nStart, size_t nLen, + const wchar_t* sz, size_t nCount = npos) const; + + // insert another string + wxString& insert(size_t nPos, const wxString& str) + { insert(GetIterForNthChar(nPos), str.begin(), str.end()); return *this; } + // insert n chars of str starting at nStart (in str) + wxString& insert(size_t nPos, const wxString& str, size_t nStart, size_t n) + { + wxSTRING_UPDATE_CACHED_LENGTH(n); + + size_t from, len; + str.PosLenToImpl(nStart, n, &from, &len); + m_impl.insert(PosToImpl(nPos), str.m_impl, from, len); + + return *this; + } + + // insert first n (or all if n == npos) characters of sz +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& insert(size_t nPos, const char *sz) + { + wxSTRING_INVALIDATE_CACHE(); + + m_impl.insert(PosToImpl(nPos), ImplStr(sz)); + + return *this; + } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + + wxString& insert(size_t nPos, const wchar_t *sz) + { + wxSTRING_INVALIDATE_CACHE(); + + m_impl.insert(PosToImpl(nPos), ImplStr(sz)); return *this; + } + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& insert(size_t nPos, const char *sz, size_t n) + { + wxSTRING_UPDATE_CACHED_LENGTH(n); + + SubstrBufFromMB str(ImplStr(sz, n)); + m_impl.insert(PosToImpl(nPos), str.data, str.len); + + return *this; + } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + + wxString& insert(size_t nPos, const wchar_t *sz, size_t n) + { + wxSTRING_UPDATE_CACHED_LENGTH(n); + + SubstrBufFromWC str(ImplStr(sz, n)); + m_impl.insert(PosToImpl(nPos), str.data, str.len); + + return *this; + } + + // insert n copies of ch + wxString& insert(size_t nPos, size_t n, wxUniChar ch) + { + wxSTRING_UPDATE_CACHED_LENGTH(n); + + if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) ) + m_impl.insert(PosToImpl(nPos), n, (wxStringCharType)ch); + else + m_impl.insert(PosToImpl(nPos), wxStringOperations::EncodeNChars(n, ch)); + + return *this; + } + + iterator insert(iterator it, wxUniChar ch) + { + wxSTRING_UPDATE_CACHED_LENGTH(1); + + if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) ) + return iterator(this, m_impl.insert(it.impl(), (wxStringCharType)ch)); + else + { + size_t pos = IterToImplPos(it); + m_impl.insert(pos, wxStringOperations::EncodeChar(ch)); + return iterator(this, m_impl.begin() + pos); + } + } + + void insert(iterator it, const_iterator first, const_iterator last) + { + wxSTRING_INVALIDATE_CACHE(); + + m_impl.insert(it.impl(), first.impl(), last.impl()); + } + +#if WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + void insert(iterator it, const char *first, const char *last) + { insert(it - begin(), first, last - first); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + void insert(iterator it, const wchar_t *first, const wchar_t *last) + { insert(it - begin(), first, last - first); } + void insert(iterator it, const wxCStrData& first, const wxCStrData& last) + { insert(it, CreateConstIterator(first), CreateConstIterator(last)); } +#endif // WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER + + void insert(iterator it, size_type n, wxUniChar ch) + { + wxSTRING_UPDATE_CACHED_LENGTH(n); + + if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) ) + m_impl.insert(it.impl(), n, (wxStringCharType)ch); + else + m_impl.insert(IterToImplPos(it), wxStringOperations::EncodeNChars(n, ch)); + } + + // delete characters from nStart to nStart + nLen + wxString& erase(size_type pos = 0, size_type n = npos) + { + wxSTRING_INVALIDATE_CACHE(); + + size_t from, len; + PosLenToImpl(pos, n, &from, &len); + m_impl.erase(from, len); + + return *this; + } + + // delete characters from first up to last + iterator erase(iterator first, iterator last) + { + wxSTRING_INVALIDATE_CACHE(); + + return iterator(this, m_impl.erase(first.impl(), last.impl())); + } + + iterator erase(iterator first) + { + wxSTRING_UPDATE_CACHED_LENGTH(-1); + + return iterator(this, m_impl.erase(first.impl())); + } + + void clear() + { + wxSTRING_SET_CACHED_LENGTH(0); + + m_impl.clear(); + } + + // replaces the substring of length nLen starting at nStart +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& replace(size_t nStart, size_t nLen, const char* sz) + { + wxSTRING_INVALIDATE_CACHE(); + + size_t from, len; + PosLenToImpl(nStart, nLen, &from, &len); + m_impl.replace(from, len, ImplStr(sz)); + + return *this; + } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + + wxString& replace(size_t nStart, size_t nLen, const wchar_t* sz) + { + wxSTRING_INVALIDATE_CACHE(); + + size_t from, len; + PosLenToImpl(nStart, nLen, &from, &len); + m_impl.replace(from, len, ImplStr(sz)); + + return *this; + } + + // replaces the substring of length nLen starting at nStart + wxString& replace(size_t nStart, size_t nLen, const wxString& str) + { + wxSTRING_INVALIDATE_CACHE(); + + size_t from, len; + PosLenToImpl(nStart, nLen, &from, &len); + m_impl.replace(from, len, str.m_impl); + + return *this; + } + + // replaces the substring with nCount copies of ch + wxString& replace(size_t nStart, size_t nLen, size_t nCount, wxUniChar ch) + { + wxSTRING_INVALIDATE_CACHE(); + + size_t from, len; + PosLenToImpl(nStart, nLen, &from, &len); + + if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) ) + m_impl.replace(from, len, nCount, (wxStringCharType)ch); + else + m_impl.replace(from, len, wxStringOperations::EncodeNChars(nCount, ch)); + + return *this; + } + + // replaces a substring with another substring + wxString& replace(size_t nStart, size_t nLen, + const wxString& str, size_t nStart2, size_t nLen2) + { + wxSTRING_INVALIDATE_CACHE(); + + size_t from, len; + PosLenToImpl(nStart, nLen, &from, &len); + + size_t from2, len2; + str.PosLenToImpl(nStart2, nLen2, &from2, &len2); + + m_impl.replace(from, len, str.m_impl, from2, len2); + + return *this; + } + + // replaces the substring with first nCount chars of sz +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& replace(size_t nStart, size_t nLen, + const char* sz, size_t nCount) + { + wxSTRING_INVALIDATE_CACHE(); + + size_t from, len; + PosLenToImpl(nStart, nLen, &from, &len); + + SubstrBufFromMB str(ImplStr(sz, nCount)); + + m_impl.replace(from, len, str.data, str.len); + + return *this; + } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + + wxString& replace(size_t nStart, size_t nLen, + const wchar_t* sz, size_t nCount) + { + wxSTRING_INVALIDATE_CACHE(); + + size_t from, len; + PosLenToImpl(nStart, nLen, &from, &len); + + SubstrBufFromWC str(ImplStr(sz, nCount)); + + m_impl.replace(from, len, str.data, str.len); + + return *this; + } + + wxString& replace(size_t nStart, size_t nLen, + const wxString& s, size_t nCount) + { + wxSTRING_INVALIDATE_CACHE(); + + size_t from, len; + PosLenToImpl(nStart, nLen, &from, &len); + m_impl.replace(from, len, s.m_impl.c_str(), s.LenToImpl(nCount)); + + return *this; + } + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& replace(iterator first, iterator last, const char* s) + { + wxSTRING_INVALIDATE_CACHE(); + + m_impl.replace(first.impl(), last.impl(), ImplStr(s)); + + return *this; + } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + + wxString& replace(iterator first, iterator last, const wchar_t* s) + { + wxSTRING_INVALIDATE_CACHE(); + + m_impl.replace(first.impl(), last.impl(), ImplStr(s)); + + return *this; + } + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& replace(iterator first, iterator last, const char* s, size_type n) + { + wxSTRING_INVALIDATE_CACHE(); + + SubstrBufFromMB str(ImplStr(s, n)); + m_impl.replace(first.impl(), last.impl(), str.data, str.len); + + return *this; + } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + + wxString& replace(iterator first, iterator last, const wchar_t* s, size_type n) + { + wxSTRING_INVALIDATE_CACHE(); + + SubstrBufFromWC str(ImplStr(s, n)); + m_impl.replace(first.impl(), last.impl(), str.data, str.len); + + return *this; + } + + wxString& replace(iterator first, iterator last, const wxString& s) + { + wxSTRING_INVALIDATE_CACHE(); + + m_impl.replace(first.impl(), last.impl(), s.m_impl); + + return *this; + } + + wxString& replace(iterator first, iterator last, size_type n, wxUniChar ch) + { + wxSTRING_INVALIDATE_CACHE(); + + if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) ) + m_impl.replace(first.impl(), last.impl(), n, (wxStringCharType)ch); + else + m_impl.replace(first.impl(), last.impl(), + wxStringOperations::EncodeNChars(n, ch)); + + return *this; + } + + wxString& replace(iterator first, iterator last, + const_iterator first1, const_iterator last1) + { + wxSTRING_INVALIDATE_CACHE(); + + m_impl.replace(first.impl(), last.impl(), first1.impl(), last1.impl()); + + return *this; + } + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& replace(iterator first, iterator last, + const char *first1, const char *last1) + { replace(first, last, first1, last1 - first1); return *this; } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& replace(iterator first, iterator last, + const wchar_t *first1, const wchar_t *last1) + { replace(first, last, first1, last1 - first1); return *this; } + + // swap two strings + void swap(wxString& str) wxNOEXCEPT + { +#if wxUSE_STRING_POS_CACHE + // we modify not only this string but also the other one directly so we + // need to invalidate cache for both of them (we could also try to + // exchange their cache entries but it seems unlikely to be worth it) + InvalidateCache(); + str.InvalidateCache(); +#endif // wxUSE_STRING_POS_CACHE + + m_impl.swap(str.m_impl); + } + + // non-member swap for ADL + friend void swap(wxString& s1, wxString& s2) wxNOEXCEPT + { + s1.swap(s2); + } + + // find a substring + size_t find(const wxString& str, size_t nStart = 0) const + { return PosFromImpl(m_impl.find(str.m_impl, PosToImpl(nStart))); } + + // find first n characters of sz +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find(const char* sz, size_t nStart = 0, size_t n = npos) const + { + SubstrBufFromMB str(ImplStr(sz, n)); + return PosFromImpl(m_impl.find(str.data, PosToImpl(nStart), str.len)); + } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find(const wchar_t* sz, size_t nStart = 0, size_t n = npos) const + { + SubstrBufFromWC str(ImplStr(sz, n)); + return PosFromImpl(m_impl.find(str.data, PosToImpl(nStart), str.len)); + } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find(const wxScopedCharBuffer& s, size_t nStart = 0, size_t n = npos) const + { return find(s.data(), nStart, n); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find(const wxScopedWCharBuffer& s, size_t nStart = 0, size_t n = npos) const + { return find(s.data(), nStart, n); } + size_t find(const wxCStrData& s, size_t nStart = 0, size_t n = npos) const + { return find(s.AsWChar(), nStart, n); } + + // find the first occurrence of character ch after nStart + size_t find(wxUniChar ch, size_t nStart = 0) const + { + if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) ) + return PosFromImpl(m_impl.find((wxStringCharType)ch, + PosToImpl(nStart))); + else + return PosFromImpl(m_impl.find(wxStringOperations::EncodeChar(ch), + PosToImpl(nStart))); + } + size_t find(wxUniCharRef ch, size_t nStart = 0) const + { return find(wxUniChar(ch), nStart); } + size_t find(char ch, size_t nStart = 0) const + { return find(wxUniChar(ch), nStart); } + size_t find(unsigned char ch, size_t nStart = 0) const + { return find(wxUniChar(ch), nStart); } + size_t find(wchar_t ch, size_t nStart = 0) const + { return find(wxUniChar(ch), nStart); } + + // rfind() family is exactly like find() but works right to left + + // as find, but from the end + size_t rfind(const wxString& str, size_t nStart = npos) const + { return PosFromImpl(m_impl.rfind(str.m_impl, PosToImpl(nStart))); } + + // as find, but from the end +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t rfind(const char* sz, size_t nStart = npos, size_t n = npos) const + { + SubstrBufFromMB str(ImplStr(sz, n)); + return PosFromImpl(m_impl.rfind(str.data, PosToImpl(nStart), str.len)); + } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t rfind(const wchar_t* sz, size_t nStart = npos, size_t n = npos) const + { + SubstrBufFromWC str(ImplStr(sz, n)); + return PosFromImpl(m_impl.rfind(str.data, PosToImpl(nStart), str.len)); + } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t rfind(const wxScopedCharBuffer& s, size_t nStart = npos, size_t n = npos) const + { return rfind(s.data(), nStart, n); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t rfind(const wxScopedWCharBuffer& s, size_t nStart = npos, size_t n = npos) const + { return rfind(s.data(), nStart, n); } + size_t rfind(const wxCStrData& s, size_t nStart = npos, size_t n = npos) const + { return rfind(s.AsWChar(), nStart, n); } + // as find, but from the end + size_t rfind(wxUniChar ch, size_t nStart = npos) const + { + if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) ) + return PosFromImpl(m_impl.rfind((wxStringCharType)ch, + PosToImpl(nStart))); + else + return PosFromImpl(m_impl.rfind(wxStringOperations::EncodeChar(ch), + PosToImpl(nStart))); + } + size_t rfind(wxUniCharRef ch, size_t nStart = npos) const + { return rfind(wxUniChar(ch), nStart); } + size_t rfind(char ch, size_t nStart = npos) const + { return rfind(wxUniChar(ch), nStart); } + size_t rfind(unsigned char ch, size_t nStart = npos) const + { return rfind(wxUniChar(ch), nStart); } + size_t rfind(wchar_t ch, size_t nStart = npos) const + { return rfind(wxUniChar(ch), nStart); } + + // find first/last occurrence of any character (not) in the set: +#if wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8 + // FIXME-UTF8: this is not entirely correct, because it doesn't work if + // sizeof(wchar_t)==2 and surrogates are present in the string; + // should we care? Probably not. + size_t find_first_of(const wxString& str, size_t nStart = 0) const + { return m_impl.find_first_of(str.m_impl, nStart); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_first_of(const char* sz, size_t nStart = 0) const + { return m_impl.find_first_of(ImplStr(sz), nStart); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_first_of(const wchar_t* sz, size_t nStart = 0) const + { return m_impl.find_first_of(ImplStr(sz), nStart); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_first_of(const char* sz, size_t nStart, size_t n) const + { return m_impl.find_first_of(ImplStr(sz), nStart, n); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_first_of(const wchar_t* sz, size_t nStart, size_t n) const + { return m_impl.find_first_of(ImplStr(sz), nStart, n); } + size_t find_first_of(wxUniChar c, size_t nStart = 0) const + { return m_impl.find_first_of((wxChar)c, nStart); } + + size_t find_last_of(const wxString& str, size_t nStart = npos) const + { return m_impl.find_last_of(str.m_impl, nStart); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_last_of(const char* sz, size_t nStart = npos) const + { return m_impl.find_last_of(ImplStr(sz), nStart); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_last_of(const wchar_t* sz, size_t nStart = npos) const + { return m_impl.find_last_of(ImplStr(sz), nStart); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_last_of(const char* sz, size_t nStart, size_t n) const + { return m_impl.find_last_of(ImplStr(sz), nStart, n); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_last_of(const wchar_t* sz, size_t nStart, size_t n) const + { return m_impl.find_last_of(ImplStr(sz), nStart, n); } + size_t find_last_of(wxUniChar c, size_t nStart = npos) const + { return m_impl.find_last_of((wxChar)c, nStart); } + + size_t find_first_not_of(const wxString& str, size_t nStart = 0) const + { return m_impl.find_first_not_of(str.m_impl, nStart); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_first_not_of(const char* sz, size_t nStart = 0) const + { return m_impl.find_first_not_of(ImplStr(sz), nStart); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_first_not_of(const wchar_t* sz, size_t nStart = 0) const + { return m_impl.find_first_not_of(ImplStr(sz), nStart); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_first_not_of(const char* sz, size_t nStart, size_t n) const + { return m_impl.find_first_not_of(ImplStr(sz), nStart, n); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_first_not_of(const wchar_t* sz, size_t nStart, size_t n) const + { return m_impl.find_first_not_of(ImplStr(sz), nStart, n); } + size_t find_first_not_of(wxUniChar c, size_t nStart = 0) const + { return m_impl.find_first_not_of((wxChar)c, nStart); } + + size_t find_last_not_of(const wxString& str, size_t nStart = npos) const + { return m_impl.find_last_not_of(str.m_impl, nStart); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_last_not_of(const char* sz, size_t nStart = npos) const + { return m_impl.find_last_not_of(ImplStr(sz), nStart); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_last_not_of(const wchar_t* sz, size_t nStart = npos) const + { return m_impl.find_last_not_of(ImplStr(sz), nStart); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_last_not_of(const char* sz, size_t nStart, size_t n) const + { return m_impl.find_last_not_of(ImplStr(sz), nStart, n); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_last_not_of(const wchar_t* sz, size_t nStart, size_t n) const + { return m_impl.find_last_not_of(ImplStr(sz), nStart, n); } + size_t find_last_not_of(wxUniChar c, size_t nStart = npos) const + { return m_impl.find_last_not_of((wxChar)c, nStart); } +#else + // we can't use std::string implementation in UTF-8 build, because the + // character sets would be interpreted wrongly: + + // as strpbrk() but starts at nStart, returns npos if not found + size_t find_first_of(const wxString& str, size_t nStart = 0) const +#if wxUSE_UNICODE // FIXME-UTF8: temporary + { return find_first_of(str.wc_str(), nStart); } +#else + { return find_first_of(str.mb_str(), nStart); } +#endif + // same as above +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_first_of(const char* sz, size_t nStart = 0) const; +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_first_of(const wchar_t* sz, size_t nStart = 0) const; +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_first_of(const char* sz, size_t nStart, size_t n) const; +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_first_of(const wchar_t* sz, size_t nStart, size_t n) const; + // same as find(char, size_t) + size_t find_first_of(wxUniChar c, size_t nStart = 0) const + { return find(c, nStart); } + // find the last (starting from nStart) char from str in this string + size_t find_last_of (const wxString& str, size_t nStart = npos) const +#if wxUSE_UNICODE // FIXME-UTF8: temporary + { return find_last_of(str.wc_str(), nStart); } +#else + { return find_last_of(str.mb_str(), nStart); } +#endif + // same as above +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_last_of (const char* sz, size_t nStart = npos) const; +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_last_of (const wchar_t* sz, size_t nStart = npos) const; +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_last_of(const char* sz, size_t nStart, size_t n) const; +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_last_of(const wchar_t* sz, size_t nStart, size_t n) const; + // same as above + size_t find_last_of(wxUniChar c, size_t nStart = npos) const + { return rfind(c, nStart); } + + // find first/last occurrence of any character not in the set + + // as strspn() (starting from nStart), returns npos on failure + size_t find_first_not_of(const wxString& str, size_t nStart = 0) const +#if wxUSE_UNICODE // FIXME-UTF8: temporary + { return find_first_not_of(str.wc_str(), nStart); } +#else + { return find_first_not_of(str.mb_str(), nStart); } +#endif + // same as above +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_first_not_of(const char* sz, size_t nStart = 0) const; +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_first_not_of(const wchar_t* sz, size_t nStart = 0) const; +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_first_not_of(const char* sz, size_t nStart, size_t n) const; +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_first_not_of(const wchar_t* sz, size_t nStart, size_t n) const; + // same as above + size_t find_first_not_of(wxUniChar ch, size_t nStart = 0) const; + // as strcspn() + size_t find_last_not_of(const wxString& str, size_t nStart = npos) const +#if wxUSE_UNICODE // FIXME-UTF8: temporary + { return find_last_not_of(str.wc_str(), nStart); } +#else + { return find_last_not_of(str.mb_str(), nStart); } +#endif + // same as above +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_last_not_of(const char* sz, size_t nStart = npos) const; +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_last_not_of(const wchar_t* sz, size_t nStart = npos) const; +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_last_not_of(const char* sz, size_t nStart, size_t n) const; +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_last_not_of(const wchar_t* sz, size_t nStart, size_t n) const; + // same as above + size_t find_last_not_of(wxUniChar ch, size_t nStart = npos) const; +#endif // wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8 or not + + // provide char/wchar_t/wxUniCharRef overloads for char-finding functions + // above to resolve ambiguities: + size_t find_first_of(wxUniCharRef ch, size_t nStart = 0) const + { return find_first_of(wxUniChar(ch), nStart); } + size_t find_first_of(char ch, size_t nStart = 0) const + { return find_first_of(wxUniChar(ch), nStart); } + size_t find_first_of(unsigned char ch, size_t nStart = 0) const + { return find_first_of(wxUniChar(ch), nStart); } + size_t find_first_of(wchar_t ch, size_t nStart = 0) const + { return find_first_of(wxUniChar(ch), nStart); } + size_t find_last_of(wxUniCharRef ch, size_t nStart = npos) const + { return find_last_of(wxUniChar(ch), nStart); } + size_t find_last_of(char ch, size_t nStart = npos) const + { return find_last_of(wxUniChar(ch), nStart); } + size_t find_last_of(unsigned char ch, size_t nStart = npos) const + { return find_last_of(wxUniChar(ch), nStart); } + size_t find_last_of(wchar_t ch, size_t nStart = npos) const + { return find_last_of(wxUniChar(ch), nStart); } + size_t find_first_not_of(wxUniCharRef ch, size_t nStart = 0) const + { return find_first_not_of(wxUniChar(ch), nStart); } + size_t find_first_not_of(char ch, size_t nStart = 0) const + { return find_first_not_of(wxUniChar(ch), nStart); } + size_t find_first_not_of(unsigned char ch, size_t nStart = 0) const + { return find_first_not_of(wxUniChar(ch), nStart); } + size_t find_first_not_of(wchar_t ch, size_t nStart = 0) const + { return find_first_not_of(wxUniChar(ch), nStart); } + size_t find_last_not_of(wxUniCharRef ch, size_t nStart = npos) const + { return find_last_not_of(wxUniChar(ch), nStart); } + size_t find_last_not_of(char ch, size_t nStart = npos) const + { return find_last_not_of(wxUniChar(ch), nStart); } + size_t find_last_not_of(unsigned char ch, size_t nStart = npos) const + { return find_last_not_of(wxUniChar(ch), nStart); } + size_t find_last_not_of(wchar_t ch, size_t nStart = npos) const + { return find_last_not_of(wxUniChar(ch), nStart); } + + // and additional overloads for the versions taking strings: + size_t find_first_of(const wxCStrData& sz, size_t nStart = 0) const + { return find_first_of(sz.AsString(), nStart); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_first_of(const wxScopedCharBuffer& sz, size_t nStart = 0) const + { return find_first_of(sz.data(), nStart); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_first_of(const wxScopedWCharBuffer& sz, size_t nStart = 0) const + { return find_first_of(sz.data(), nStart); } + size_t find_first_of(const wxCStrData& sz, size_t nStart, size_t n) const + { return find_first_of(sz.AsWChar(), nStart, n); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_first_of(const wxScopedCharBuffer& sz, size_t nStart, size_t n) const + { return find_first_of(sz.data(), nStart, n); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_first_of(const wxScopedWCharBuffer& sz, size_t nStart, size_t n) const + { return find_first_of(sz.data(), nStart, n); } + + size_t find_last_of(const wxCStrData& sz, size_t nStart = 0) const + { return find_last_of(sz.AsString(), nStart); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_last_of(const wxScopedCharBuffer& sz, size_t nStart = 0) const + { return find_last_of(sz.data(), nStart); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_last_of(const wxScopedWCharBuffer& sz, size_t nStart = 0) const + { return find_last_of(sz.data(), nStart); } + size_t find_last_of(const wxCStrData& sz, size_t nStart, size_t n) const + { return find_last_of(sz.AsWChar(), nStart, n); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_last_of(const wxScopedCharBuffer& sz, size_t nStart, size_t n) const + { return find_last_of(sz.data(), nStart, n); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_last_of(const wxScopedWCharBuffer& sz, size_t nStart, size_t n) const + { return find_last_of(sz.data(), nStart, n); } + + size_t find_first_not_of(const wxCStrData& sz, size_t nStart = 0) const + { return find_first_not_of(sz.AsString(), nStart); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_first_not_of(const wxScopedCharBuffer& sz, size_t nStart = 0) const + { return find_first_not_of(sz.data(), nStart); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_first_not_of(const wxScopedWCharBuffer& sz, size_t nStart = 0) const + { return find_first_not_of(sz.data(), nStart); } + size_t find_first_not_of(const wxCStrData& sz, size_t nStart, size_t n) const + { return find_first_not_of(sz.AsWChar(), nStart, n); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_first_not_of(const wxScopedCharBuffer& sz, size_t nStart, size_t n) const + { return find_first_not_of(sz.data(), nStart, n); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_first_not_of(const wxScopedWCharBuffer& sz, size_t nStart, size_t n) const + { return find_first_not_of(sz.data(), nStart, n); } + + size_t find_last_not_of(const wxCStrData& sz, size_t nStart = 0) const + { return find_last_not_of(sz.AsString(), nStart); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_last_not_of(const wxScopedCharBuffer& sz, size_t nStart = 0) const + { return find_last_not_of(sz.data(), nStart); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_last_not_of(const wxScopedWCharBuffer& sz, size_t nStart = 0) const + { return find_last_not_of(sz.data(), nStart); } + size_t find_last_not_of(const wxCStrData& sz, size_t nStart, size_t n) const + { return find_last_not_of(sz.AsWChar(), nStart, n); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_last_not_of(const wxScopedCharBuffer& sz, size_t nStart, size_t n) const + { return find_last_not_of(sz.data(), nStart, n); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + size_t find_last_not_of(const wxScopedWCharBuffer& sz, size_t nStart, size_t n) const + { return find_last_not_of(sz.data(), nStart, n); } + + bool starts_with(const wxString &str) const + { return StartsWith(str); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + bool starts_with(const char *sz) const + { return StartsWith(sz); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + bool starts_with(const wchar_t *sz) const + { return StartsWith(sz); } + + bool ends_with(const wxString &str) const + { return EndsWith(str); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + bool ends_with(const char *sz) const + { return EndsWith(sz); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + bool ends_with(const wchar_t *sz) const + { return EndsWith(sz); } + + // string += string + wxString& operator+=(const wxString& s) + { + wxSTRING_INVALIDATE_CACHED_LENGTH(); + + m_impl += s.m_impl; + return *this; + } + // string += C string +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& operator+=(const char *psz) + { + wxSTRING_INVALIDATE_CACHED_LENGTH(); + + m_impl += ImplStr(psz); + return *this; + } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& operator+=(const wchar_t *pwz) + { + wxSTRING_INVALIDATE_CACHED_LENGTH(); + + m_impl += ImplStr(pwz); + return *this; + } + wxString& operator+=(const wxCStrData& s) + { + wxSTRING_INVALIDATE_CACHED_LENGTH(); + + m_impl += s.AsString().m_impl; + return *this; + } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& operator+=(const wxScopedCharBuffer& s) + { return append(s); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + wxString& operator+=(const wxScopedWCharBuffer& s) + { return append(s); } + // string += char + wxString& operator+=(wxUniChar ch) + { + wxSTRING_UPDATE_CACHED_LENGTH(1); + + if ( wxStringOperations::IsSingleCodeUnitCharacter(ch) ) + m_impl += (wxStringCharType)ch; + else + m_impl += wxStringOperations::EncodeChar(ch); + + return *this; + } + wxString& operator+=(wxUniCharRef ch) { return *this += wxUniChar(ch); } + wxString& operator+=(int ch) { return *this += wxUniChar(ch); } + wxString& operator+=(char ch) { return *this += wxUniChar(ch); } + wxString& operator+=(unsigned char ch) { return *this += wxUniChar(ch); } + wxString& operator+=(wchar_t ch) { return *this += wxUniChar(ch); } + +private: +#if !wxUSE_STL_BASED_WXSTRING + // helpers for wxStringBuffer and wxStringBufferLength + wxStringCharType *DoGetWriteBuf(size_t nLen) + { + return m_impl.DoGetWriteBuf(nLen); + } + + void DoUngetWriteBuf() + { + wxSTRING_INVALIDATE_CACHE(); + + m_impl.DoUngetWriteBuf(); + } + + void DoUngetWriteBuf(size_t nLen) + { + wxSTRING_INVALIDATE_CACHE(); + + m_impl.DoUngetWriteBuf(nLen); + } +#endif // !wxUSE_STL_BASED_WXSTRING + + #if !wxUSE_UTF8_LOCALE_ONLY + int DoPrintfWchar(const wxChar *format, ...); + static wxString DoFormatWchar(const wxChar *format, ...); + #endif + #if wxUSE_UNICODE_UTF8 + int DoPrintfUtf8(const char *format, ...); + static wxString DoFormatUtf8(const char *format, ...); + #endif + +#if !wxUSE_STL_BASED_WXSTRING + // check string's data validity + bool IsValid() const { return m_impl.GetStringData()->IsValid(); } +#endif + +private: + wxStringImpl m_impl; + + // buffers for compatibility conversion from (char*)c_str() and + // (wchar_t*)c_str(): the pointers returned by these functions should remain + // valid until the string itself is modified for compatibility with the + // existing code and consistency with std::string::c_str() so returning a + // temporary buffer won't do and we need to cache the conversion results + + // TODO-UTF8: benchmark various approaches to keeping compatibility buffers + template<typename T> + struct ConvertedBuffer + { + // notice that there is no need to initialize m_len here as it's unused + // as long as m_str is NULL + ConvertedBuffer() : m_str(NULL), m_len(0) {} + ~ConvertedBuffer() + { free(m_str); } + + bool Extend(size_t len) + { + // add extra 1 for the trailing NUL + void * const str = realloc(m_str, sizeof(T)*(len + 1)); + if ( !str ) + return false; + + m_str = static_cast<T *>(str); + m_len = len; + + return true; + } + + const wxScopedCharTypeBuffer<T> AsScopedBuffer() const + { + return wxScopedCharTypeBuffer<T>::CreateNonOwned(m_str, m_len); + } + + T *m_str; // pointer to the string data + size_t m_len; // length, not size, i.e. in chars and without last NUL + }; + + +#if wxUSE_UNICODE + // common mb_str() and wxCStrData::AsChar() helper: performs the conversion + // and returns either m_convertedToChar.m_str (in which case its m_len is + // also updated) or NULL if it failed + // + // there is an important exception: in wxUSE_UNICODE_UTF8 build if conv is a + // UTF-8 one, we return m_impl.c_str() directly, without doing any conversion + // as optimization and so the caller needs to check for this before using + // m_convertedToChar + // + // NB: AsChar() returns char* in any build, unlike mb_str() + const char *AsChar(const wxMBConv& conv) const; + + // mb_str() implementation helper + wxScopedCharBuffer AsCharBuf(const wxMBConv& conv) const + { +#if wxUSE_UNICODE_UTF8 + // avoid conversion if we can + if ( conv.IsUTF8() ) + { + return wxScopedCharBuffer::CreateNonOwned(m_impl.c_str(), + m_impl.length()); + } +#endif // wxUSE_UNICODE_UTF8 + + // call this solely in order to fill in m_convertedToChar as AsChar() + // updates it as a side effect: this is a bit ugly but it's a completely + // internal function so the users of this class shouldn't care or know + // about it and doing it like this, i.e. having a separate AsChar(), + // allows us to avoid the creation and destruction of a temporary buffer + // when using wxCStrData without duplicating any code + if ( !AsChar(conv) ) + { + // although it would be probably more correct to return NULL buffer + // from here if the conversion fails, a lot of existing code doesn't + // expect mb_str() (or wc_str()) to ever return NULL so return an + // empty string otherwise to avoid crashes in it + // + // also, some existing code does check for the conversion success and + // so asserting here would be bad too -- even if it does mean that + // silently losing data is possible for badly written code + return wxScopedCharBuffer::CreateNonOwned("", 0); + } + + return m_convertedToChar.AsScopedBuffer(); + } + + ConvertedBuffer<char> m_convertedToChar; +#endif // !wxUSE_UNICODE + +#if !wxUSE_UNICODE_WCHAR + // common wc_str() and wxCStrData::AsWChar() helper for both UTF-8 and ANSI + // builds: converts the string contents into m_convertedToWChar and returns + // NULL if the conversion failed (this can only happen in ANSI build) + // + // NB: AsWChar() returns wchar_t* in any build, unlike wc_str() + const wchar_t *AsWChar(const wxMBConv& conv) const; + + // wc_str() implementation helper + wxScopedWCharBuffer AsWCharBuf(const wxMBConv& conv) const + { + if ( !AsWChar(conv) ) + return wxScopedWCharBuffer::CreateNonOwned(L"", 0); + + return m_convertedToWChar.AsScopedBuffer(); + } + + ConvertedBuffer<wchar_t> m_convertedToWChar; +#endif // !wxUSE_UNICODE_WCHAR + +#if wxUSE_UNICODE_UTF8 + // FIXME-UTF8: (try to) move this elsewhere (TLS) or solve differently + // assigning to character pointer to by wxString::iterator may + // change the underlying wxStringImpl iterator, so we have to + // keep track of all iterators and update them as necessary: + struct wxStringIteratorNodeHead + { + wxStringIteratorNodeHead() : ptr(NULL) {} + wxStringIteratorNode *ptr; + + // copying is disallowed as it would result in more than one pointer into + // the same linked list + wxDECLARE_NO_COPY_CLASS(wxStringIteratorNodeHead); + }; + + wxStringIteratorNodeHead m_iterators; + + friend class WXDLLIMPEXP_FWD_BASE wxStringIteratorNode; + friend class WXDLLIMPEXP_FWD_BASE wxUniCharRef; +#endif // wxUSE_UNICODE_UTF8 + + friend class WXDLLIMPEXP_FWD_BASE wxCStrData; + friend class wxStringInternalBuffer; + friend class wxStringInternalBufferLength; +}; + +// string iterator operators that satisfy STL Random Access Iterator +// requirements: +inline wxString::iterator operator+(ptrdiff_t n, wxString::iterator i) + { return i + n; } +inline wxString::const_iterator operator+(ptrdiff_t n, wxString::const_iterator i) + { return i + n; } +inline wxString::reverse_iterator operator+(ptrdiff_t n, wxString::reverse_iterator i) + { return i + n; } +inline wxString::const_reverse_iterator operator+(ptrdiff_t n, wxString::const_reverse_iterator i) + { return i + n; } + +// notice that even though for many compilers the friend declarations above are +// enough, from the point of view of C++ standard we must have the declarations +// here as friend ones are not injected in the enclosing namespace and without +// them the code fails to compile with conforming compilers such as xlC or g++4 +wxString WXDLLIMPEXP_BASE operator+(const wxString& string1, const wxString& string2); +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +wxString WXDLLIMPEXP_BASE operator+(const wxString& string, const char *psz); +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING +wxString WXDLLIMPEXP_BASE operator+(const wxString& string, const wchar_t *pwz); +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +wxString WXDLLIMPEXP_BASE operator+(const char *psz, const wxString& string); +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING +wxString WXDLLIMPEXP_BASE operator+(const wchar_t *pwz, const wxString& string); + +wxString WXDLLIMPEXP_BASE operator+(const wxString& string, wxUniChar ch); +wxString WXDLLIMPEXP_BASE operator+(wxUniChar ch, const wxString& string); + +inline wxString operator+(const wxString& string, wxUniCharRef ch) + { return string + (wxUniChar)ch; } +inline wxString operator+(const wxString& string, char ch) + { return string + wxUniChar(ch); } +inline wxString operator+(const wxString& string, wchar_t ch) + { return string + wxUniChar(ch); } +inline wxString operator+(wxUniCharRef ch, const wxString& string) + { return (wxUniChar)ch + string; } +inline wxString operator+(char ch, const wxString& string) + { return wxUniChar(ch) + string; } +inline wxString operator+(wchar_t ch, const wxString& string) + { return wxUniChar(ch) + string; } + + +#define wxGetEmptyString() wxString() + +// ---------------------------------------------------------------------------- +// helper functions which couldn't be defined inline +// ---------------------------------------------------------------------------- + +namespace wxPrivate +{ + +#if wxUSE_UNICODE_WCHAR + +template <> +struct wxStringAsBufHelper<char> +{ + static wxScopedCharBuffer Get(const wxString& s, size_t *len) + { + wxScopedCharBuffer buf(s.mb_str(wxConvUTF8)); + if ( len ) + *len = buf ? strlen(buf) : 0; + return buf; + } +}; + +template <> +struct wxStringAsBufHelper<wchar_t> +{ + static wxScopedWCharBuffer Get(const wxString& s, size_t *len) + { + const size_t length = s.length(); + if ( len ) + *len = length; + return wxScopedWCharBuffer::CreateNonOwned(s.wx_str(), length); + } +}; + +#elif wxUSE_UNICODE_UTF8 + +template <> +struct wxStringAsBufHelper<char> +{ + static wxScopedCharBuffer Get(const wxString& s, size_t *len) + { + const size_t length = s.utf8_length(); + if ( len ) + *len = length; + return wxScopedCharBuffer::CreateNonOwned(s.wx_str(), length); + } +}; + +template <> +struct wxStringAsBufHelper<wchar_t> +{ + static wxScopedWCharBuffer Get(const wxString& s, size_t *len) + { + wxScopedWCharBuffer wbuf(s.wc_str()); + if ( len ) + *len = wxWcslen(wbuf); + return wbuf; + } +}; + +#endif // Unicode build kind + +} // namespace wxPrivate + +// ---------------------------------------------------------------------------- +// wxStringBuffer: a tiny class allowing to get a writable pointer into string +// ---------------------------------------------------------------------------- + +#if !wxUSE_STL_BASED_WXSTRING +// string buffer for direct access to string data in their native +// representation: +class wxStringInternalBuffer +{ +public: + typedef wxStringCharType CharType; + + wxStringInternalBuffer(wxString& str, size_t lenWanted = 1024) + : m_str(str), m_buf(NULL) + { m_buf = m_str.DoGetWriteBuf(lenWanted); } + + ~wxStringInternalBuffer() { m_str.DoUngetWriteBuf(); } + + operator wxStringCharType*() const { return m_buf; } + +private: + wxString& m_str; + wxStringCharType *m_buf; + + wxDECLARE_NO_COPY_CLASS(wxStringInternalBuffer); +}; + +class wxStringInternalBufferLength +{ +public: + typedef wxStringCharType CharType; + + wxStringInternalBufferLength(wxString& str, size_t lenWanted = 1024) + : m_str(str), m_buf(NULL), m_len(0), m_lenSet(false) + { + m_buf = m_str.DoGetWriteBuf(lenWanted); + wxASSERT(m_buf != NULL); + } + + ~wxStringInternalBufferLength() + { + wxASSERT(m_lenSet); + m_str.DoUngetWriteBuf(m_len); + } + + operator wxStringCharType*() const { return m_buf; } + void SetLength(size_t length) { m_len = length; m_lenSet = true; } + +private: + wxString& m_str; + wxStringCharType *m_buf; + size_t m_len; + bool m_lenSet; + + wxDECLARE_NO_COPY_CLASS(wxStringInternalBufferLength); +}; + +#endif // !wxUSE_STL_BASED_WXSTRING + +template<typename T> +class wxStringTypeBufferBase +{ +public: + typedef T CharType; + + wxStringTypeBufferBase(wxString& str, size_t lenWanted = 1024) + : m_str(str), m_buf(lenWanted) + { + // for compatibility with old wxStringBuffer which provided direct + // access to wxString internal buffer, initialize ourselves with the + // string initial contents + + size_t len; + const wxCharTypeBuffer<CharType> buf(str.tchar_str<CharType>(&len)); + if ( buf ) + { + if ( len > lenWanted ) + { + // in this case there is not enough space for terminating NUL, + // ensure that we still put it there + m_buf.data()[lenWanted] = 0; + len = lenWanted - 1; + } + + memcpy(m_buf.data(), buf, (len + 1)*sizeof(CharType)); + } + //else: conversion failed, this can happen when trying to get Unicode + // string contents into a char string + } + + operator CharType*() { return m_buf.data(); } + +protected: + wxString& m_str; + wxCharTypeBuffer<CharType> m_buf; +}; + +template<typename T> +class wxStringTypeBufferLengthBase : public wxStringTypeBufferBase<T> +{ +public: + wxStringTypeBufferLengthBase(wxString& str, size_t lenWanted = 1024) + : wxStringTypeBufferBase<T>(str, lenWanted), + m_len(0), + m_lenSet(false) + { } + + ~wxStringTypeBufferLengthBase() + { + wxASSERT_MSG( this->m_lenSet, "forgot to call SetLength()" ); + } + + void SetLength(size_t length) { m_len = length; m_lenSet = true; } + +protected: + size_t m_len; + bool m_lenSet; +}; + +template<typename T> +class wxStringTypeBuffer : public wxStringTypeBufferBase<T> +{ +public: + wxStringTypeBuffer(wxString& str, size_t lenWanted = 1024) + : wxStringTypeBufferBase<T>(str, lenWanted) + { } + + ~wxStringTypeBuffer() + { + this->m_str.assign(this->m_buf.data()); + } + + wxDECLARE_NO_COPY_CLASS(wxStringTypeBuffer); +}; + +template<typename T> +class wxStringTypeBufferLength : public wxStringTypeBufferLengthBase<T> +{ +public: + wxStringTypeBufferLength(wxString& str, size_t lenWanted = 1024) + : wxStringTypeBufferLengthBase<T>(str, lenWanted) + { } + + ~wxStringTypeBufferLength() + { + this->m_str.assign(this->m_buf.data(), this->m_len); + } + + wxDECLARE_NO_COPY_CLASS(wxStringTypeBufferLength); +}; + +#if wxUSE_STL_BASED_WXSTRING + +class wxStringInternalBuffer : public wxStringTypeBufferBase<wxStringCharType> +{ +public: + wxStringInternalBuffer(wxString& str, size_t lenWanted = 1024) + : wxStringTypeBufferBase<wxStringCharType>(str, lenWanted) {} + ~wxStringInternalBuffer() + { m_str.m_impl.assign(m_buf.data()); } + + wxDECLARE_NO_COPY_CLASS(wxStringInternalBuffer); +}; + +class wxStringInternalBufferLength + : public wxStringTypeBufferLengthBase<wxStringCharType> +{ +public: + wxStringInternalBufferLength(wxString& str, size_t lenWanted = 1024) + : wxStringTypeBufferLengthBase<wxStringCharType>(str, lenWanted) {} + + ~wxStringInternalBufferLength() + { + m_str.m_impl.assign(m_buf.data(), m_len); + } + + wxDECLARE_NO_COPY_CLASS(wxStringInternalBufferLength); +}; + +#endif // wxUSE_STL_BASED_WXSTRING + + +#if wxUSE_STL_BASED_WXSTRING || wxUSE_UNICODE_UTF8 +typedef wxStringTypeBuffer<wxChar> wxStringBuffer; +typedef wxStringTypeBufferLength<wxChar> wxStringBufferLength; +#else // if !wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8 +typedef wxStringInternalBuffer wxStringBuffer; +typedef wxStringInternalBufferLength wxStringBufferLength; +#endif // !wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8 + +#if wxUSE_UNICODE_UTF8 +typedef wxStringInternalBuffer wxUTF8StringBuffer; +typedef wxStringInternalBufferLength wxUTF8StringBufferLength; +#elif wxUSE_UNICODE_WCHAR + +// Note about inlined dtors in the classes below: this is done not for +// performance reasons but just to avoid linking errors in the MSVC DLL build +// under Windows: if a class has non-inline methods it must be declared as +// being DLL-exported but, due to an extremely interesting feature of MSVC 7 +// and later, any template class which is used as a base of a DLL-exported +// class is implicitly made DLL-exported too, as explained at the bottom of +// http://msdn.microsoft.com/en-us/library/twa2aw10.aspx (just to confirm: yes, +// _inheriting_ from a class can change whether it is being exported from DLL) +// +// But this results in link errors because the base template class is not DLL- +// exported, whether it is declared with WXDLLIMPEXP_BASE or not, because it +// does have only inline functions. So the simplest fix is to just make all the +// functions of these classes inline too. + +class wxUTF8StringBuffer : public wxStringTypeBufferBase<char> +{ +public: + wxUTF8StringBuffer(wxString& str, size_t lenWanted = 1024) + : wxStringTypeBufferBase<char>(str, lenWanted) {} + ~wxUTF8StringBuffer() + { + wxMBConvStrictUTF8 conv; + size_t wlen = conv.ToWChar(NULL, 0, m_buf); + wxCHECK_RET( wlen != wxCONV_FAILED, "invalid UTF-8 data in string buffer?" ); + + wxStringInternalBuffer wbuf(m_str, wlen); + conv.ToWChar(wbuf, wlen, m_buf); + } + + wxDECLARE_NO_COPY_CLASS(wxUTF8StringBuffer); +}; + +class wxUTF8StringBufferLength : public wxStringTypeBufferLengthBase<char> +{ +public: + wxUTF8StringBufferLength(wxString& str, size_t lenWanted = 1024) + : wxStringTypeBufferLengthBase<char>(str, lenWanted) {} + ~wxUTF8StringBufferLength() + { + wxCHECK_RET(m_lenSet, "length not set"); + + wxMBConvStrictUTF8 conv; + size_t wlen = conv.ToWChar(NULL, 0, m_buf, m_len); + wxCHECK_RET( wlen != wxCONV_FAILED, "invalid UTF-8 data in string buffer?" ); + + wxStringInternalBufferLength wbuf(m_str, wlen); + conv.ToWChar(wbuf, wlen, m_buf, m_len); + wbuf.SetLength(wlen); + } + + wxDECLARE_NO_COPY_CLASS(wxUTF8StringBufferLength); +}; +#endif // wxUSE_UNICODE_UTF8/wxUSE_UNICODE_WCHAR + + +// --------------------------------------------------------------------------- +// wxString comparison functions: operator versions are always case sensitive +// --------------------------------------------------------------------------- + +// comparison with C-style narrow and wide strings. +#define wxCMP_WXCHAR_STRING(p, s, op) 0 op s.Cmp(p) + +wxDEFINE_ALL_COMPARISONS(const wchar_t *, const wxString&, wxCMP_WXCHAR_STRING) +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +wxDEFINE_ALL_COMPARISONS(const char *, const wxString&, wxCMP_WXCHAR_STRING) +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + +#undef wxCMP_WXCHAR_STRING + +inline bool operator==(const wxString& s1, const wxString& s2) + { return s1.IsSameAs(s2); } +inline bool operator!=(const wxString& s1, const wxString& s2) + { return !s1.IsSameAs(s2); } +inline bool operator< (const wxString& s1, const wxString& s2) + { return s1.Cmp(s2) < 0; } +inline bool operator> (const wxString& s1, const wxString& s2) + { return s1.Cmp(s2) > 0; } +inline bool operator<=(const wxString& s1, const wxString& s2) + { return s1.Cmp(s2) <= 0; } +inline bool operator>=(const wxString& s1, const wxString& s2) + { return s1.Cmp(s2) >= 0; } + +inline bool operator==(const wxString& s1, const wxCStrData& s2) + { return s1 == s2.AsString(); } +inline bool operator==(const wxCStrData& s1, const wxString& s2) + { return s1.AsString() == s2; } +inline bool operator!=(const wxString& s1, const wxCStrData& s2) + { return s1 != s2.AsString(); } +inline bool operator!=(const wxCStrData& s1, const wxString& s2) + { return s1.AsString() != s2; } + +inline bool operator==(const wxString& s1, const wxScopedWCharBuffer& s2) + { return (s1.Cmp((const wchar_t *)s2) == 0); } +inline bool operator==(const wxScopedWCharBuffer& s1, const wxString& s2) + { return (s2.Cmp((const wchar_t *)s1) == 0); } +inline bool operator!=(const wxString& s1, const wxScopedWCharBuffer& s2) + { return (s1.Cmp((const wchar_t *)s2) != 0); } +inline bool operator!=(const wxScopedWCharBuffer& s1, const wxString& s2) + { return (s2.Cmp((const wchar_t *)s1) != 0); } + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline bool operator==(const wxString& s1, const wxScopedCharBuffer& s2) + { return (s1.Cmp((const char *)s2) == 0); } +inline bool operator==(const wxScopedCharBuffer& s1, const wxString& s2) + { return (s2.Cmp((const char *)s1) == 0); } +inline bool operator!=(const wxString& s1, const wxScopedCharBuffer& s2) + { return (s1.Cmp((const char *)s2) != 0); } +inline bool operator!=(const wxScopedCharBuffer& s1, const wxString& s2) + { return (s2.Cmp((const char *)s1) != 0); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + +inline wxString operator+(const wxString& string, const wxScopedWCharBuffer& buf) + { return string + (const wchar_t *)buf; } +inline wxString operator+(const wxScopedWCharBuffer& buf, const wxString& string) + { return (const wchar_t *)buf + string; } + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline wxString operator+(const wxString& string, const wxScopedCharBuffer& buf) + { return string + (const char *)buf; } +inline wxString operator+(const wxScopedCharBuffer& buf, const wxString& string) + { return (const char *)buf + string; } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + +// comparison with char +inline bool operator==(const wxUniChar& c, const wxString& s) { return s.IsSameAs(c); } +inline bool operator==(const wxUniCharRef& c, const wxString& s) { return s.IsSameAs(c); } +inline bool operator==(char c, const wxString& s) { return s.IsSameAs(c); } +inline bool operator==(wchar_t c, const wxString& s) { return s.IsSameAs(c); } +inline bool operator==(int c, const wxString& s) { return s.IsSameAs(c); } +inline bool operator==(const wxString& s, const wxUniChar& c) { return s.IsSameAs(c); } +inline bool operator==(const wxString& s, const wxUniCharRef& c) { return s.IsSameAs(c); } +inline bool operator==(const wxString& s, char c) { return s.IsSameAs(c); } +inline bool operator==(const wxString& s, wchar_t c) { return s.IsSameAs(c); } +inline bool operator!=(const wxUniChar& c, const wxString& s) { return !s.IsSameAs(c); } +inline bool operator!=(const wxUniCharRef& c, const wxString& s) { return !s.IsSameAs(c); } +inline bool operator!=(char c, const wxString& s) { return !s.IsSameAs(c); } +inline bool operator!=(wchar_t c, const wxString& s) { return !s.IsSameAs(c); } +inline bool operator!=(int c, const wxString& s) { return !s.IsSameAs(c); } +inline bool operator!=(const wxString& s, const wxUniChar& c) { return !s.IsSameAs(c); } +inline bool operator!=(const wxString& s, const wxUniCharRef& c) { return !s.IsSameAs(c); } +inline bool operator!=(const wxString& s, char c) { return !s.IsSameAs(c); } +inline bool operator!=(const wxString& s, wchar_t c) { return !s.IsSameAs(c); } + + +// wxString iterators comparisons +inline bool wxString::const_iterator::operator==(const iterator& i) const + { return *this == const_iterator(i); } +inline bool wxString::const_iterator::operator!=(const iterator& i) const + { return *this != const_iterator(i); } +inline bool wxString::const_iterator::operator<(const iterator& i) const + { return *this < const_iterator(i); } +inline bool wxString::const_iterator::operator>(const iterator& i) const + { return *this > const_iterator(i); } +inline bool wxString::const_iterator::operator<=(const iterator& i) const + { return *this <= const_iterator(i); } +inline bool wxString::const_iterator::operator>=(const iterator& i) const + { return *this >= const_iterator(i); } + +inline bool wxString::iterator::operator==(const const_iterator& i) const + { return i == *this; } +inline bool wxString::iterator::operator!=(const const_iterator& i) const + { return i != *this; } +inline bool wxString::iterator::operator<(const const_iterator& i) const + { return i > *this; } +inline bool wxString::iterator::operator>(const const_iterator& i) const + { return i < *this; } +inline bool wxString::iterator::operator<=(const const_iterator& i) const + { return i >= *this; } +inline bool wxString::iterator::operator>=(const const_iterator& i) const + { return i <= *this; } + +// we also need to provide the operators for comparison with wxCStrData to +// resolve ambiguity between operator(const wxChar *,const wxString &) and +// operator(const wxChar *, const wxChar *) for "p == s.c_str()" +// +// notice that these are (shallow) pointer comparisons, not (deep) string ones +#define wxCMP_CHAR_CSTRDATA(p, s, op) p op s.AsChar() +#define wxCMP_WCHAR_CSTRDATA(p, s, op) p op s.AsWChar() + +wxDEFINE_ALL_COMPARISONS(const wchar_t *, const wxCStrData&, wxCMP_WCHAR_CSTRDATA) +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +wxDEFINE_ALL_COMPARISONS(const char *, const wxCStrData&, wxCMP_CHAR_CSTRDATA) +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + +#undef wxCMP_CHAR_CSTRDATA +#undef wxCMP_WCHAR_CSTRDATA + +// ---------------------------------------------------------------------------- +// Implement hashing using C++11 std::hash<>. +// ---------------------------------------------------------------------------- + +#if __cplusplus >= 201103L || wxCHECK_VISUALC_VERSION(10) + +// Don't do this if ToStdWstring() is not available. We could work around it +// but, presumably, if using std::wstring is undesirable, then so is using +// std::hash<> anyhow. +#if wxUSE_STD_STRING + +#include <functional> + +namespace std +{ + template<> + struct hash<wxString> + { + size_t operator()(const wxString& s) const + { + return std::hash<std::wstring>()(s.ToStdWstring()); + } + }; +} // namespace std + +#endif // wxUSE_STD_STRING + +#endif // C++11 + +// --------------------------------------------------------------------------- +// Implementation only from here until the end of file +// --------------------------------------------------------------------------- + +#if wxUSE_STD_IOSTREAM + +#include "wx/iosfwrap.h" + +WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxString&); +WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxCStrData&); +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxScopedCharBuffer&); +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING +WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxScopedWCharBuffer&); + +#if wxUSE_UNICODE && defined(HAVE_WOSTREAM) + +WXDLLIMPEXP_BASE wxSTD wostream& operator<<(wxSTD wostream&, const wxString&); +WXDLLIMPEXP_BASE wxSTD wostream& operator<<(wxSTD wostream&, const wxCStrData&); +WXDLLIMPEXP_BASE wxSTD wostream& operator<<(wxSTD wostream&, const wxScopedWCharBuffer&); + +#endif // wxUSE_UNICODE && defined(HAVE_WOSTREAM) + +#endif // wxUSE_STD_IOSTREAM + +// --------------------------------------------------------------------------- +// wxCStrData implementation +// --------------------------------------------------------------------------- + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline wxCStrData::wxCStrData(char *buf) + : m_str(new wxString(buf)), m_offset(0), m_owned(true) {} +#endif +inline wxCStrData::wxCStrData(wchar_t *buf) + : m_str(new wxString(buf)), m_offset(0), m_owned(true) {} + +inline wxCStrData::wxCStrData(const wxCStrData& data) + : m_str(data.m_owned ? new wxString(*data.m_str) : data.m_str), + m_offset(data.m_offset), + m_owned(data.m_owned) +{ +} + +inline wxCStrData::~wxCStrData() +{ + if ( m_owned ) + delete const_cast<wxString*>(m_str); // cast to silence warnings +} + +// AsChar() and AsWChar() implementations simply forward to wxString methods + +inline const wchar_t* wxCStrData::AsWChar() const +{ + const wchar_t * const p = +#if wxUSE_UNICODE_WCHAR + m_str->wc_str(); +#elif wxUSE_UNICODE_UTF8 + m_str->AsWChar(wxMBConvStrictUTF8()); +#else + m_str->AsWChar(wxConvLibc); +#endif + + // in Unicode build the string always has a valid Unicode representation + // and even if a conversion is needed (as in UTF8 case) it can't fail + // + // but in ANSI build the string contents might be not convertible to + // Unicode using the current locale encoding so we do need to check for + // errors +#if !wxUSE_UNICODE + if ( !p ) + { + // if conversion fails, return empty string and not NULL to avoid + // crashes in code written with either wxWidgets 2 wxString or + // std::string behaviour in mind: neither of them ever returns NULL + // from its c_str() and so we shouldn't either + // + // notice that the same is done in AsChar() below and + // wxString::wc_str() and mb_str() for the same reasons + return L""; + } +#endif // !wxUSE_UNICODE + + return p + m_offset; +} + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline const char* wxCStrData::AsChar() const +{ +#if wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY + const char * const p = m_str->AsChar(wxConvLibc); + if ( !p ) + return ""; +#else // !wxUSE_UNICODE || wxUSE_UTF8_LOCALE_ONLY + const char * const p = m_str->mb_str(); +#endif // wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY + + return p + m_offset; +} +#endif + +inline wxString wxCStrData::AsString() const +{ + if ( m_offset == 0 ) + return *m_str; + else + return m_str->Mid(m_offset); +} + +inline const wxStringCharType *wxCStrData::AsInternal() const +{ +#if wxUSE_UNICODE_UTF8 + return wxStringOperations::AddToIter(m_str->wx_str(), m_offset); +#else + return m_str->wx_str() + m_offset; +#endif +} + +inline wxUniChar wxCStrData::operator*() const +{ + if ( m_str->empty() ) + return wxUniChar(wxT('\0')); + else + return (*m_str)[m_offset]; +} + +inline wxUniChar wxCStrData::operator[](size_t n) const +{ + // NB: we intentionally use operator[] and not at() here because the former + // works for the terminating NUL while the latter does not + return (*m_str)[m_offset + n]; +} + +// ---------------------------------------------------------------------------- +// more wxCStrData operators +// ---------------------------------------------------------------------------- + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +// we need to define those to allow "size_t pos = p - s.c_str()" where p is +// some pointer into the string +inline size_t operator-(const char *p, const wxCStrData& cs) +{ + return p - cs.AsChar(); +} +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + +inline size_t operator-(const wchar_t *p, const wxCStrData& cs) +{ + return p - cs.AsWChar(); +} + +// ---------------------------------------------------------------------------- +// implementation of wx[W]CharBuffer inline methods using wxCStrData +// ---------------------------------------------------------------------------- + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +// FIXME-UTF8: move this to buffer.h +inline wxCharBuffer::wxCharBuffer(const wxCStrData& cstr) + : wxCharTypeBufferBase(cstr.AsCharBuf()) +{ +} +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + +inline wxWCharBuffer::wxWCharBuffer(const wxCStrData& cstr) + : wxCharTypeBufferBase(cstr.AsWCharBuf()) +{ +} + +#if wxUSE_UNICODE_UTF8 +// ---------------------------------------------------------------------------- +// implementation of wxStringIteratorNode inline methods +// ---------------------------------------------------------------------------- + +void wxStringIteratorNode::DoSet(const wxString *str, + wxStringImpl::const_iterator *citer, + wxStringImpl::iterator *iter) +{ + m_prev = NULL; + m_iter = iter; + m_citer = citer; + m_str = str; + if ( str ) + { + m_next = str->m_iterators.ptr; + const_cast<wxString*>(m_str)->m_iterators.ptr = this; + if ( m_next ) + m_next->m_prev = this; + } + else + { + m_next = NULL; + } +} + +void wxStringIteratorNode::clear() +{ + if ( m_next ) + m_next->m_prev = m_prev; + if ( m_prev ) + m_prev->m_next = m_next; + else if ( m_str ) // first in the list + const_cast<wxString*>(m_str)->m_iterators.ptr = m_next; + + m_next = m_prev = NULL; + m_citer = NULL; + m_iter = NULL; + m_str = NULL; +} +#endif // wxUSE_UNICODE_UTF8 + +#if WXWIN_COMPATIBILITY_2_8 + // lot of code out there doesn't explicitly include wx/crt.h, but uses + // CRT wrappers that are now declared in wx/wxcrt.h and wx/wxcrtvararg.h, + // so let's include this header now that wxString is defined and it's safe + // to do it: + #include "wx/crt.h" +#endif + +// ---------------------------------------------------------------------------- +// Checks on wxString characters +// ---------------------------------------------------------------------------- + +template<bool (T)(const wxUniChar& c)> + inline bool wxStringCheck(const wxString& val) + { + for ( wxString::const_iterator i = val.begin(); + i != val.end(); + ++i ) + if (T(*i) == 0) + return false; + return true; + } + +#endif // _WX_WXSTRING_H_ diff --git a/lib/wxWidgets/include/wx/stringimpl.h b/lib/wxWidgets/include/wx/stringimpl.h new file mode 100644 index 0000000..d10242e --- /dev/null +++ b/lib/wxWidgets/include/wx/stringimpl.h @@ -0,0 +1,558 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/stringimpl.h +// Purpose: wxStringImpl class, implementation of wxString +// Author: Vadim Zeitlin +// Modified by: +// Created: 29/01/98 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +/* + This header implements std::string-like string class, wxStringImpl, that is + used by wxString to store the data. Alternatively, if wxUSE_STD_STRING=1, + wxStringImpl is just a typedef to std:: string class. +*/ + +#ifndef _WX_WXSTRINGIMPL_H__ +#define _WX_WXSTRINGIMPL_H__ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" // everybody should include this +#include "wx/chartype.h" // for wxChar +#include "wx/wxcrtbase.h" // for wxStrlen() etc. + +#include <stdlib.h> + +// --------------------------------------------------------------------------- +// macros +// --------------------------------------------------------------------------- + +// implementation only +#define wxASSERT_VALID_INDEX(i) \ + wxASSERT_MSG( (size_t)(i) <= length(), wxT("invalid index in wxString") ) + + +// ---------------------------------------------------------------------------- +// global data +// ---------------------------------------------------------------------------- + +// global pointer to empty string +extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxEmptyString; +#if wxUSE_UNICODE_UTF8 +// FIXME-UTF8: we should have only one wxEmptyString +extern WXDLLIMPEXP_DATA_BASE(const wxStringCharType*) wxEmptyStringImpl; +#endif + + +// ---------------------------------------------------------------------------- +// deal with various build options +// ---------------------------------------------------------------------------- + +// we use STL-based string internally if we use std::string at all now, there +// should be no reason to prefer our internal implement but if you really need +// it you can predefine wxUSE_STL_BASED_WXSTRING as 0 when building the library +#ifndef wxUSE_STL_BASED_WXSTRING + #define wxUSE_STL_BASED_WXSTRING wxUSE_STD_STRING +#endif + +// in both cases we need to define wxStdString +#if wxUSE_STL_BASED_WXSTRING || wxUSE_STD_STRING + +#include "wx/beforestd.h" +#include <string> +#include "wx/afterstd.h" + +#ifdef HAVE_STD_WSTRING + typedef std::wstring wxStdWideString; +#else + typedef std::basic_string<wchar_t> wxStdWideString; +#endif + +#if wxUSE_UNICODE_WCHAR + typedef wxStdWideString wxStdString; +#else + typedef std::string wxStdString; +#endif + +#endif // wxUSE_STL_BASED_WXSTRING || wxUSE_STD_STRING + + +#if wxUSE_STL_BASED_WXSTRING + + // we always want ctor from std::string when using std::string internally + #undef wxUSE_STD_STRING + #define wxUSE_STD_STRING 1 + + typedef wxStdString wxStringImpl; +#else // if !wxUSE_STL_BASED_WXSTRING + +// in non-STL mode, compare() is implemented in wxString and not wxStringImpl +#undef HAVE_STD_STRING_COMPARE + +// --------------------------------------------------------------------------- +// string data prepended with some housekeeping info (used by wxString class), +// is never used directly (but had to be put here to allow inlining) +// --------------------------------------------------------------------------- + +struct WXDLLIMPEXP_BASE wxStringData +{ + int nRefs; // reference count + size_t nDataLength, // actual string length + nAllocLength; // allocated memory size + + // mimics declaration 'wxStringCharType data[nAllocLength]' + wxStringCharType* data() { return reinterpret_cast<wxStringCharType*>(this + 1); } + const wxStringCharType* data() const { return reinterpret_cast<const wxStringCharType*>(this + 1); } + + // empty string has a special ref count so it's never deleted + bool IsEmpty() const { return (nRefs == -1); } + bool IsShared() const { return (nRefs > 1); } + + // lock/unlock + void Lock() { if ( !IsEmpty() ) nRefs++; } + + // VC++ will refuse to inline Unlock but profiling shows that it is wrong +#if defined(__VISUALC__) + __forceinline +#endif + // VC++ free must take place in same DLL as allocation when using non dll + // run-time library (e.g. Multithreaded instead of Multithreaded DLL) +#if defined(__VISUALC__) && defined(_MT) && !defined(_DLL) + void Unlock() { if ( !IsEmpty() && --nRefs == 0) Free(); } + // we must not inline deallocation since allocation is not inlined + void Free(); +#else + void Unlock() { if ( !IsEmpty() && --nRefs == 0) free(this); } +#endif + + // if we had taken control over string memory (GetWriteBuf), it's + // intentionally put in invalid state + void Validate(bool b) { nRefs = (b ? 1 : 0); } + bool IsValid() const { return (nRefs != 0); } +}; + +class WXDLLIMPEXP_BASE wxStringImpl +{ +public: + // an 'invalid' value for string index, moved to this place due to a CW bug + static const size_t npos; + +protected: + // points to data preceded by wxStringData structure with ref count info + wxStringCharType *m_pchData; + + // accessor to string data + wxStringData* GetStringData() const { return (wxStringData*)m_pchData - 1; } + + // string (re)initialization functions + // initializes the string to the empty value (must be called only from + // ctors, use Reinit() otherwise) +#if wxUSE_UNICODE_UTF8 + void Init() { m_pchData = const_cast<wxStringCharType*>(wxEmptyStringImpl); } // FIXME-UTF8 +#else + void Init() { m_pchData = const_cast<wxStringCharType*>(wxEmptyString); } +#endif + // initializes the string with (a part of) C-string + void InitWith(const wxStringCharType *psz, size_t nPos = 0, size_t nLen = npos); + // as Init, but also frees old data + void Reinit() { GetStringData()->Unlock(); Init(); } + + // memory allocation + // allocates memory for string of length nLen + bool AllocBuffer(size_t nLen); + // effectively copies data to string + bool AssignCopy(size_t, const wxStringCharType *); + + // append a (sub)string + bool ConcatSelf(size_t nLen, const wxStringCharType *src, size_t nMaxLen); + bool ConcatSelf(size_t nLen, const wxStringCharType *src) + { return ConcatSelf(nLen, src, nLen); } + + // functions called before writing to the string: they copy it if there + // are other references to our data (should be the only owner when writing) + bool CopyBeforeWrite(); + bool AllocBeforeWrite(size_t); + + // compatibility with wxString + bool Alloc(size_t nLen); + +public: + // standard types + typedef wxStringCharType value_type; + typedef wxStringCharType char_type; + typedef size_t size_type; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef value_type* pointer; + typedef const value_type* const_pointer; + + // macro to define the bulk of iterator and const_iterator classes + #define WX_DEFINE_STRINGIMPL_ITERATOR(iterator_name, ref_type, ptr_type) \ + public: \ + typedef wxStringCharType value_type; \ + typedef ref_type reference; \ + typedef ptr_type pointer; \ + typedef int difference_type; \ + \ + iterator_name() : m_ptr(NULL) { } \ + iterator_name(pointer ptr) : m_ptr(ptr) { } \ + \ + reference operator*() const { return *m_ptr; } \ + \ + iterator_name& operator++() { m_ptr++; return *this; } \ + iterator_name operator++(int) \ + { \ + const iterator_name tmp(*this); \ + m_ptr++; \ + return tmp; \ + } \ + \ + iterator_name& operator--() { m_ptr--; return *this; } \ + iterator_name operator--(int) \ + { \ + const iterator_name tmp(*this); \ + m_ptr--; \ + return tmp; \ + } \ + \ + iterator_name operator+(ptrdiff_t n) const \ + { return iterator_name(m_ptr + n); } \ + iterator_name operator-(ptrdiff_t n) const \ + { return iterator_name(m_ptr - n); } \ + iterator_name& operator+=(ptrdiff_t n) \ + { m_ptr += n; return *this; } \ + iterator_name& operator-=(ptrdiff_t n) \ + { m_ptr -= n; return *this; } \ + \ + difference_type operator-(const iterator_name& i) const \ + { return m_ptr - i.m_ptr; } \ + \ + bool operator==(const iterator_name& i) const \ + { return m_ptr == i.m_ptr; } \ + bool operator!=(const iterator_name& i) const \ + { return m_ptr != i.m_ptr; } \ + \ + bool operator<(const iterator_name& i) const \ + { return m_ptr < i.m_ptr; } \ + bool operator>(const iterator_name& i) const \ + { return m_ptr > i.m_ptr; } \ + bool operator<=(const iterator_name& i) const \ + { return m_ptr <= i.m_ptr; } \ + bool operator>=(const iterator_name& i) const \ + { return m_ptr >= i.m_ptr; } \ + \ + private: \ + /* for wxStringImpl use only */ \ + pointer GetPtr() const { return m_ptr; } \ + \ + friend class wxStringImpl; \ + \ + pointer m_ptr + + // we need to declare const_iterator in wxStringImpl scope, the friend + // declaration inside iterator class itself is not enough, or at least not + // for g++ 3.4 (g++ 4 is ok) + class WXDLLIMPEXP_FWD_BASE const_iterator; + + class WXDLLIMPEXP_BASE iterator + { + WX_DEFINE_STRINGIMPL_ITERATOR(iterator, + wxStringCharType&, + wxStringCharType*); + + friend class const_iterator; + }; + + class WXDLLIMPEXP_BASE const_iterator + { + public: + const_iterator(iterator i) : m_ptr(i.m_ptr) { } + + WX_DEFINE_STRINGIMPL_ITERATOR(const_iterator, + const wxStringCharType&, + const wxStringCharType*); + }; + + #undef WX_DEFINE_STRINGIMPL_ITERATOR + + + // constructors and destructor + // ctor for an empty string + wxStringImpl() { Init(); } + // copy ctor + wxStringImpl(const wxStringImpl& stringSrc) + { + wxASSERT_MSG( stringSrc.GetStringData()->IsValid(), + wxT("did you forget to call UngetWriteBuf()?") ); + + if ( stringSrc.empty() ) { + // nothing to do for an empty string + Init(); + } + else { + m_pchData = stringSrc.m_pchData; // share same data + GetStringData()->Lock(); // => one more copy + } + } + // string containing nRepeat copies of ch + wxStringImpl(size_type nRepeat, wxStringCharType ch); + // ctor takes first nLength characters from C string + // (default value of npos means take all the string) + wxStringImpl(const wxStringCharType *psz) + { InitWith(psz, 0, npos); } + wxStringImpl(const wxStringCharType *psz, size_t nLength) + { InitWith(psz, 0, nLength); } + // take nLen chars starting at nPos + wxStringImpl(const wxStringImpl& str, size_t nPos, size_t nLen) + { + wxASSERT_MSG( str.GetStringData()->IsValid(), + wxT("did you forget to call UngetWriteBuf()?") ); + Init(); + size_t strLen = str.length() - nPos; nLen = strLen < nLen ? strLen : nLen; + InitWith(str.c_str(), nPos, nLen); + } + // take everything between start and end + wxStringImpl(const_iterator start, const_iterator end); + + + // ctor from and conversion to std::string +#if wxUSE_STD_STRING + wxStringImpl(const wxStdString& impl) + { InitWith(impl.c_str(), 0, impl.length()); } + + operator wxStdString() const + { return wxStdString(c_str(), length()); } +#endif + +#if defined(__VISUALC__) + // disable warning about Unlock() below not being inlined (first, it + // seems to be inlined nevertheless and second, even if it isn't, there + // is nothing we can do about this + #pragma warning(push) + #pragma warning (disable:4714) +#endif + + // dtor is not virtual, this class must not be inherited from! + ~wxStringImpl() + { + GetStringData()->Unlock(); + } + +#if defined(__VISUALC__) + #pragma warning(pop) +#endif + + // overloaded assignment + // from another wxString + wxStringImpl& operator=(const wxStringImpl& stringSrc); + // from a character + wxStringImpl& operator=(wxStringCharType ch); + // from a C string + wxStringImpl& operator=(const wxStringCharType *psz); + + // return the length of the string + size_type length() const { return GetStringData()->nDataLength; } + // return the length of the string + size_type size() const { return length(); } + // return the maximum size of the string + size_type max_size() const { return npos; } + // resize the string, filling the space with c if c != 0 + void resize(size_t nSize, wxStringCharType ch = '\0'); + // delete the contents of the string + void clear() { erase(0, npos); } + // returns true if the string is empty + bool empty() const { return length() == 0; } + // inform string about planned change in size + void reserve(size_t sz) { Alloc(sz); } + size_type capacity() const { return GetStringData()->nAllocLength; } + + // lib.string.access + // return the character at position n + value_type operator[](size_type n) const { return m_pchData[n]; } + value_type at(size_type n) const + { wxASSERT_VALID_INDEX( n ); return m_pchData[n]; } + // returns the writable character at position n + reference operator[](size_type n) { CopyBeforeWrite(); return m_pchData[n]; } + reference at(size_type n) + { + wxASSERT_VALID_INDEX( n ); + CopyBeforeWrite(); + return m_pchData[n]; + } // FIXME-UTF8: not useful for us...? + + // lib.string.modifiers + // append elements str[pos], ..., str[pos+n] + wxStringImpl& append(const wxStringImpl& str, size_t pos, size_t n) + { + wxASSERT(pos <= str.length()); + ConcatSelf(n, str.c_str() + pos, str.length() - pos); + return *this; + } + // append a string + wxStringImpl& append(const wxStringImpl& str) + { ConcatSelf(str.length(), str.c_str()); return *this; } + // append first n (or all if n == npos) characters of sz + wxStringImpl& append(const wxStringCharType *sz) + { ConcatSelf(wxStrlen(sz), sz); return *this; } + wxStringImpl& append(const wxStringCharType *sz, size_t n) + { ConcatSelf(n, sz); return *this; } + // append n copies of ch + wxStringImpl& append(size_t n, wxStringCharType ch); + // append from first to last + wxStringImpl& append(const_iterator first, const_iterator last) + { ConcatSelf(last - first, first.GetPtr()); return *this; } + + // same as `this_string = str' + wxStringImpl& assign(const wxStringImpl& str) + { return *this = str; } + // same as ` = str[pos..pos + n] + wxStringImpl& assign(const wxStringImpl& str, size_t pos, size_t n) + { return replace(0, npos, str, pos, n); } + // same as `= first n (or all if n == npos) characters of sz' + wxStringImpl& assign(const wxStringCharType *sz) + { return replace(0, npos, sz, wxStrlen(sz)); } + wxStringImpl& assign(const wxStringCharType *sz, size_t n) + { return replace(0, npos, sz, n); } + // same as `= n copies of ch' + wxStringImpl& assign(size_t n, wxStringCharType ch) + { return replace(0, npos, n, ch); } + // assign from first to last + wxStringImpl& assign(const_iterator first, const_iterator last) + { return replace(begin(), end(), first, last); } + + // first valid index position + const_iterator begin() const { return m_pchData; } + iterator begin(); + // position one after the last valid one + const_iterator end() const { return m_pchData + length(); } + iterator end(); + + // insert another string + wxStringImpl& insert(size_t nPos, const wxStringImpl& str) + { + wxASSERT( str.GetStringData()->IsValid() ); + return insert(nPos, str.c_str(), str.length()); + } + // insert n chars of str starting at nStart (in str) + wxStringImpl& insert(size_t nPos, const wxStringImpl& str, size_t nStart, size_t n) + { + wxASSERT( str.GetStringData()->IsValid() ); + wxASSERT( nStart < str.length() ); + size_t strLen = str.length() - nStart; + n = strLen < n ? strLen : n; + return insert(nPos, str.c_str() + nStart, n); + } + // insert first n (or all if n == npos) characters of sz + wxStringImpl& insert(size_t nPos, const wxStringCharType *sz, size_t n = npos); + // insert n copies of ch + wxStringImpl& insert(size_t nPos, size_t n, wxStringCharType ch) + { return insert(nPos, wxStringImpl(n, ch)); } + iterator insert(iterator it, wxStringCharType ch) + { size_t idx = it - begin(); insert(idx, 1, ch); return begin() + idx; } + void insert(iterator it, const_iterator first, const_iterator last) + { insert(it - begin(), first.GetPtr(), last - first); } + void insert(iterator it, size_type n, wxStringCharType ch) + { insert(it - begin(), n, ch); } + + // delete characters from nStart to nStart + nLen + wxStringImpl& erase(size_type pos = 0, size_type n = npos); + iterator erase(iterator first, iterator last) + { + size_t idx = first - begin(); + erase(idx, last - first); + return begin() + idx; + } + iterator erase(iterator first); + + // explicit conversion to C string (use this with printf()!) + const wxStringCharType* c_str() const { return m_pchData; } + const wxStringCharType* data() const { return m_pchData; } + + // replaces the substring of length nLen starting at nStart + wxStringImpl& replace(size_t nStart, size_t nLen, const wxStringCharType* sz) + { return replace(nStart, nLen, sz, npos); } + // replaces the substring of length nLen starting at nStart + wxStringImpl& replace(size_t nStart, size_t nLen, const wxStringImpl& str) + { return replace(nStart, nLen, str.c_str(), str.length()); } + // replaces the substring with nCount copies of ch + wxStringImpl& replace(size_t nStart, size_t nLen, + size_t nCount, wxStringCharType ch) + { return replace(nStart, nLen, wxStringImpl(nCount, ch)); } + // replaces a substring with another substring + wxStringImpl& replace(size_t nStart, size_t nLen, + const wxStringImpl& str, size_t nStart2, size_t nLen2) + { return replace(nStart, nLen, str.substr(nStart2, nLen2)); } + // replaces the substring with first nCount chars of sz + wxStringImpl& replace(size_t nStart, size_t nLen, + const wxStringCharType* sz, size_t nCount); + + wxStringImpl& replace(iterator first, iterator last, const_pointer s) + { return replace(first - begin(), last - first, s); } + wxStringImpl& replace(iterator first, iterator last, const_pointer s, + size_type n) + { return replace(first - begin(), last - first, s, n); } + wxStringImpl& replace(iterator first, iterator last, const wxStringImpl& s) + { return replace(first - begin(), last - first, s); } + wxStringImpl& replace(iterator first, iterator last, size_type n, wxStringCharType c) + { return replace(first - begin(), last - first, n, c); } + wxStringImpl& replace(iterator first, iterator last, + const_iterator first1, const_iterator last1) + { return replace(first - begin(), last - first, first1.GetPtr(), last1 - first1); } + + // swap two strings + void swap(wxStringImpl& str); + + // All find() functions take the nStart argument which specifies the + // position to start the search on, the default value is 0. All functions + // return npos if there were no match. + + // find a substring + size_t find(const wxStringImpl& str, size_t nStart = 0) const; + + // find first n characters of sz + size_t find(const wxStringCharType* sz, size_t nStart = 0, size_t n = npos) const; + + // find the first occurrence of character ch after nStart + size_t find(wxStringCharType ch, size_t nStart = 0) const; + + // rfind() family is exactly like find() but works right to left + + // as find, but from the end + size_t rfind(const wxStringImpl& str, size_t nStart = npos) const; + + // as find, but from the end + size_t rfind(const wxStringCharType* sz, size_t nStart = npos, + size_t n = npos) const; + // as find, but from the end + size_t rfind(wxStringCharType ch, size_t nStart = npos) const; + + size_type copy(wxStringCharType* s, size_type n, size_type pos = 0); + + // substring extraction + wxStringImpl substr(size_t nStart = 0, size_t nLen = npos) const; + + // string += string + wxStringImpl& operator+=(const wxStringImpl& s) { return append(s); } + // string += C string + wxStringImpl& operator+=(const wxStringCharType *psz) { return append(psz); } + // string += char + wxStringImpl& operator+=(wxStringCharType ch) { return append(1, ch); } + + // helpers for wxStringBuffer and wxStringBufferLength + wxStringCharType *DoGetWriteBuf(size_t nLen); + void DoUngetWriteBuf(); + void DoUngetWriteBuf(size_t nLen); + + friend class WXDLLIMPEXP_FWD_BASE wxString; +}; + +#endif // !wxUSE_STL_BASED_WXSTRING + +// don't pollute the library user's name space +#undef wxASSERT_VALID_INDEX + +#endif // _WX_WXSTRINGIMPL_H__ diff --git a/lib/wxWidgets/include/wx/stringops.h b/lib/wxWidgets/include/wx/stringops.h new file mode 100644 index 0000000..dd46e66 --- /dev/null +++ b/lib/wxWidgets/include/wx/stringops.h @@ -0,0 +1,204 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/stringops.h +// Purpose: implementation of wxString primitive operations +// Author: Vaclav Slavik +// Modified by: +// Created: 2007-04-16 +// Copyright: (c) 2007 REA Elektronik GmbH +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WXSTRINGOPS_H__ +#define _WX_WXSTRINGOPS_H__ + +#include "wx/chartype.h" +#include "wx/stringimpl.h" +#include "wx/unichar.h" +#include "wx/buffer.h" + +// This header contains wxStringOperations "namespace" class that implements +// elementary operations on string data as static methods; wxString methods and +// iterators are implemented in terms of it. Two implementations are available, +// one for UTF-8 encoded char* string and one for "raw" wchar_t* strings (or +// char* in ANSI build). + +// FIXME-UTF8: only wchar after we remove ANSI build +#if wxUSE_UNICODE_WCHAR || !wxUSE_UNICODE +struct WXDLLIMPEXP_BASE wxStringOperationsWchar +{ + // moves the iterator to the next Unicode character + template <typename Iterator> + static void IncIter(Iterator& i) { ++i; } + + // moves the iterator to the previous Unicode character + template <typename Iterator> + static void DecIter(Iterator& i) { --i; } + + // moves the iterator by n Unicode characters + template <typename Iterator> + static Iterator AddToIter(const Iterator& i, ptrdiff_t n) + { return i + n; } + + // returns distance of the two iterators in Unicode characters + template <typename Iterator> + static ptrdiff_t DiffIters(const Iterator& i1, const Iterator& i2) + { return i1 - i2; } + +#if wxUSE_UNICODE_UTF16 + // encodes the characters as UTF-16: + struct Utf16CharBuffer + { + // Notice that data is left uninitialized, it is filled by EncodeChar() + // which is the only function creating objects of this class. + + wchar_t data[3]; + operator const wchar_t*() const { return data; } + }; + static Utf16CharBuffer EncodeChar(const wxUniChar& ch); + static wxWCharBuffer EncodeNChars(size_t n, const wxUniChar& ch); + static bool IsSingleCodeUnitCharacter(const wxUniChar& ch) + { return !ch.IsSupplementary(); } +#else + // encodes the character to a form used to represent it in internal + // representation + struct SingleCharBuffer + { + wxChar data[2]; + operator const wxChar*() const { return data; } + }; + static SingleCharBuffer EncodeChar(const wxUniChar& ch) + { + SingleCharBuffer buf; + buf.data[0] = (wxChar)ch; + buf.data[1] = 0; + return buf; + } + static wxWxCharBuffer EncodeNChars(size_t n, const wxUniChar& ch); + static bool IsSingleCodeUnitCharacter(const wxUniChar&) { return true; } +#endif + + static wxUniChar DecodeChar(const wxStringImpl::const_iterator& i) + { return *i; } +}; +#endif // wxUSE_UNICODE_WCHAR || !wxUSE_UNICODE + + +#if wxUSE_UNICODE_UTF8 +struct WXDLLIMPEXP_BASE wxStringOperationsUtf8 +{ + // checks correctness of UTF-8 sequence + static bool IsValidUtf8String(const char *c, + size_t len = wxStringImpl::npos); + static bool IsValidUtf8LeadByte(unsigned char c) + { + return (c <= 0x7F) || (c >= 0xC2 && c <= 0xF4); + } + + // returns offset to skip forward when iterating over UTF-8 sequence + static unsigned char GetUTF8IterOffset(unsigned char c); + + + template<typename Iterator> + static void IncIter(Iterator& i) + { + wxASSERT( IsValidUtf8LeadByte(*i) ); + i += GetUTF8IterOffset(*i); + } + + template<typename Iterator> + static void DecIter(Iterator& i) + { + // Non-lead bytes are all in the 0x80..0xBF range (i.e. 10xxxxxx in + // binary), so we just have to go back until we hit a byte that is + // either < 0x80 (i.e. 0xxxxxxx in binary) or 0xC0..0xFF (11xxxxxx in + // binary; this includes some invalid values, but we can ignore it + // here, because we assume valid UTF-8 input for the purpose of + // efficient implementation). + --i; + while ( ((*i) & 0xC0) == 0x80 /* 2 highest bits are '10' */ ) + --i; + } + + template<typename Iterator> + static Iterator AddToIter(const Iterator& i, ptrdiff_t n) + { + Iterator out(i); + + if ( n > 0 ) + { + for ( ptrdiff_t j = 0; j < n; ++j ) + IncIter(out); + } + else if ( n < 0 ) + { + for ( ptrdiff_t j = 0; j > n; --j ) + DecIter(out); + } + + return out; + } + + template<typename Iterator> + static ptrdiff_t DiffIters(Iterator i1, Iterator i2) + { + ptrdiff_t dist = 0; + + if ( i1 < i2 ) + { + while ( i1 != i2 ) + { + IncIter(i1); + dist--; + } + } + else if ( i2 < i1 ) + { + while ( i2 != i1 ) + { + IncIter(i2); + dist++; + } + } + + return dist; + } + + static bool IsSingleCodeUnitCharacter(const wxUniChar& ch) + { return ch.IsAscii(); } + + // encodes the character as UTF-8: + typedef wxUniChar::Utf8CharBuffer Utf8CharBuffer; + static Utf8CharBuffer EncodeChar(const wxUniChar& ch) + { return ch.AsUTF8(); } + + // returns n copies of ch encoded in UTF-8 string + static wxCharBuffer EncodeNChars(size_t n, const wxUniChar& ch); + + // returns the length of UTF-8 encoding of the character with lead byte 'c' + static size_t GetUtf8CharLength(char c) + { + wxASSERT( IsValidUtf8LeadByte(c) ); + return GetUTF8IterOffset(c); + } + + // decodes single UTF-8 character from UTF-8 string + static wxUniChar DecodeChar(wxStringImpl::const_iterator i) + { + if ( (unsigned char)*i < 0x80 ) + return (int)*i; + return DecodeNonAsciiChar(i); + } + +private: + static wxUniChar DecodeNonAsciiChar(wxStringImpl::const_iterator i); +}; +#endif // wxUSE_UNICODE_UTF8 + + +#if wxUSE_UNICODE_UTF8 +typedef wxStringOperationsUtf8 wxStringOperations; +#else +typedef wxStringOperationsWchar wxStringOperations; +#endif + +#endif // _WX_WXSTRINGOPS_H_ diff --git a/lib/wxWidgets/include/wx/strvararg.h b/lib/wxWidgets/include/wx/strvararg.h new file mode 100644 index 0000000..f80298b --- /dev/null +++ b/lib/wxWidgets/include/wx/strvararg.h @@ -0,0 +1,1290 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/strvararg.h +// Purpose: macros for implementing type-safe vararg passing of strings +// Author: Vaclav Slavik +// Created: 2007-02-19 +// Copyright: (c) 2007 REA Elektronik GmbH +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STRVARARG_H_ +#define _WX_STRVARARG_H_ + +#include "wx/platform.h" + +#include "wx/cpp.h" +#include "wx/chartype.h" +#include "wx/strconv.h" +#include "wx/buffer.h" +#include "wx/unichar.h" + +#if defined(HAVE_TYPE_TRAITS) + #include <type_traits> +#elif defined(HAVE_TR1_TYPE_TRAITS) + #ifdef __VISUALC__ + #include <type_traits> + #else + #include <tr1/type_traits> + #endif +#endif + +class WXDLLIMPEXP_FWD_BASE wxCStrData; +class WXDLLIMPEXP_FWD_BASE wxString; + +// There are a lot of structs with intentionally private ctors in this file, +// suppress gcc warnings about this. +wxGCC_WARNING_SUPPRESS(ctor-dtor-privacy) + +// ---------------------------------------------------------------------------- +// WX_DEFINE_VARARG_FUNC* macros +// ---------------------------------------------------------------------------- + +// This macro is used to implement type-safe wrappers for variadic functions +// that accept strings as arguments. This makes it possible to pass char*, +// wchar_t* or even wxString (as opposed to having to use wxString::c_str()) +// to e.g. wxPrintf(). +// +// This is done by defining a set of N template function taking 1..N arguments +// (currently, N is set to 30 in this header). These functions are just thin +// wrappers around another variadic function ('impl' or 'implUtf8' arguments, +// see below) and the only thing the wrapper does is that it normalizes the +// arguments passed in so that they are of the type expected by variadic +// functions taking string arguments, i.e., char* or wchar_t*, depending on the +// build: +// * char* in the current locale's charset in ANSI build +// * char* with UTF-8 encoding if wxUSE_UNICODE_UTF8 and the app is running +// under an UTF-8 locale +// * wchar_t* if wxUSE_UNICODE_WCHAR or if wxUSE_UNICODE_UTF8 and the current +// locale is not UTF-8 +// +// Note that wxFormatString *must* be used for the format parameter of these +// functions, otherwise the implementation won't work correctly. Furthermore, +// it must be passed by value, not reference, because it's modified by the +// vararg templates internally. +// +// Parameters: +// [ there are examples in square brackets showing values of the parameters +// for the wxFprintf() wrapper for fprintf() function with the following +// prototype: +// int wxFprintf(FILE *stream, const wxString& format, ...); ] +// +// rettype Functions' return type [int] +// name Name of the function [fprintf] +// numfixed The number of leading "fixed" (i.e., not variadic) +// arguments of the function (e.g. "stream" and "format" +// arguments of fprintf()); their type is _not_ converted +// using wxArgNormalizer<T>, unlike the rest of +// the function's arguments [2] +// fixed List of types of the leading "fixed" arguments, in +// parentheses [(FILE*,const wxString&)] +// impl Name of the variadic function that implements 'name' for +// the native strings representation (wchar_t* if +// wxUSE_UNICODE_WCHAR or wxUSE_UNICODE_UTF8 when running under +// non-UTF8 locale, char* in ANSI build) [wxCrt_Fprintf] +// implUtf8 Like 'impl', but for the UTF-8 char* version to be used +// if wxUSE_UNICODE_UTF8 and running under UTF-8 locale +// (ignored otherwise) [fprintf] +// +#define WX_DEFINE_VARARG_FUNC(rettype, name, numfixed, fixed, impl, implUtf8) \ + _WX_VARARG_DEFINE_FUNC_N0(rettype, name, impl, implUtf8, numfixed, fixed) \ + WX_DEFINE_VARARG_FUNC_SANS_N0(rettype, name, numfixed, fixed, impl, implUtf8) + +// ditto, but without the version with 0 template/vararg arguments +#define WX_DEFINE_VARARG_FUNC_SANS_N0(rettype, name, \ + numfixed, fixed, impl, implUtf8) \ + _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \ + _WX_VARARG_DEFINE_FUNC, \ + rettype, name, impl, implUtf8, numfixed, fixed) + +// Like WX_DEFINE_VARARG_FUNC, but for variadic functions that don't return +// a value. +#define WX_DEFINE_VARARG_FUNC_VOID(name, numfixed, fixed, impl, implUtf8) \ + _WX_VARARG_DEFINE_FUNC_VOID_N0(name, impl, implUtf8, numfixed, fixed) \ + _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \ + _WX_VARARG_DEFINE_FUNC_VOID, \ + void, name, impl, implUtf8, numfixed, fixed) + +// Like WX_DEFINE_VARARG_FUNC_VOID, but instead of wrapping an implementation +// function, does nothing in defined functions' bodies. +// +// Used to implement wxLogXXX functions if wxUSE_LOG=0. +#define WX_DEFINE_VARARG_FUNC_NOP(name, numfixed, fixed) \ + _WX_VARARG_DEFINE_FUNC_NOP_N0(name, numfixed, fixed) \ + _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \ + _WX_VARARG_DEFINE_FUNC_NOP, \ + void, name, dummy, dummy, numfixed, fixed) + +// Like WX_DEFINE_VARARG_FUNC_CTOR, but for defining template constructors +#define WX_DEFINE_VARARG_FUNC_CTOR(name, numfixed, fixed, impl, implUtf8) \ + _WX_VARARG_DEFINE_FUNC_CTOR_N0(name, impl, implUtf8, numfixed, fixed) \ + _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \ + _WX_VARARG_DEFINE_FUNC_CTOR, \ + void, name, impl, implUtf8, numfixed, fixed) + + +// ---------------------------------------------------------------------------- +// wxFormatString +// ---------------------------------------------------------------------------- + +// This class must be used for format string argument of the functions +// defined using WX_DEFINE_VARARG_FUNC_* macros. It converts the string to +// char* or wchar_t* for passing to implementation function efficiently (i.e. +// without keeping the converted string in memory for longer than necessary, +// like c_str()). It also converts format string to the correct form that +// accounts for string changes done by wxArgNormalizer<> +// +// Note that this class can _only_ be used for function arguments! +class WXDLLIMPEXP_BASE wxFormatString +{ +public: +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxFormatString(const char *str) + : m_char(wxScopedCharBuffer::CreateNonOwned(str)), m_str(NULL), m_cstr(NULL) {} +#endif + wxFormatString(const wchar_t *str) + : m_wchar(wxScopedWCharBuffer::CreateNonOwned(str)), m_str(NULL), m_cstr(NULL) {} + wxFormatString(const wxString& str) + : m_str(&str), m_cstr(NULL) {} + wxFormatString(const wxCStrData& str) + : m_str(NULL), m_cstr(&str) {} +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxFormatString(const wxScopedCharBuffer& str) + : m_char(str), m_str(NULL), m_cstr(NULL) {} +#endif + wxFormatString(const wxScopedWCharBuffer& str) + : m_wchar(str), m_str(NULL), m_cstr(NULL) {} + + // Possible argument types. These are or-combinable for wxASSERT_ARG_TYPE + // convenience. Some of the values are or-combined with another value, this + // expresses "supertypes" for use with wxASSERT_ARG_TYPE masks. For example, + // a char* string is also a pointer and an integer is also a char. + enum ArgumentType + { + Arg_Unused = 0, // not used at all; the value of 0 is chosen to + // conveniently pass wxASSERT_ARG_TYPE's check + + Arg_Char = 0x0001, // character as char %c + Arg_Pointer = 0x0002, // %p + Arg_String = 0x0004 | Arg_Pointer, // any form of string (%s and %p too) + + Arg_Int = 0x0008 | Arg_Char, // (ints can be used with %c) +#if SIZEOF_INT == SIZEOF_LONG + Arg_LongInt = Arg_Int, +#else + Arg_LongInt = 0x0010, +#endif +#if defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG == SIZEOF_LONG + Arg_LongLongInt = Arg_LongInt, +#elif defined(wxLongLong_t) + Arg_LongLongInt = 0x0020, +#endif + + Arg_Double = 0x0040, + Arg_LongDouble = 0x0080, + +#if defined(wxSIZE_T_IS_UINT) + Arg_Size_t = Arg_Int, +#elif defined(wxSIZE_T_IS_ULONG) + Arg_Size_t = Arg_LongInt, +#elif defined(SIZEOF_LONG_LONG) && SIZEOF_SIZE_T == SIZEOF_LONG_LONG + Arg_Size_t = Arg_LongLongInt, +#else + Arg_Size_t = 0x0100, +#endif + + Arg_IntPtr = 0x0200, // %n -- store # of chars written + Arg_ShortIntPtr = 0x0400, + Arg_LongIntPtr = 0x0800, + + Arg_Unknown = 0x8000 // unrecognized specifier (likely error) + }; + + // returns the type of format specifier for n-th variadic argument (this is + // not necessarily n-th format specifier if positional specifiers are used); + // called by wxArgNormalizer<> specializations to get information about + // n-th variadic argument desired representation + ArgumentType GetArgumentType(unsigned n) const; + + // returns the value passed to ctor, only converted to wxString, similarly + // to other InputAsXXX() methods + wxString InputAsString() const; + +#if !wxUSE_UNICODE_WCHAR && !defined wxNO_IMPLICIT_WXSTRING_ENCODING + operator const char*() const + { return const_cast<wxFormatString*>(this)->AsChar(); } +private: + // InputAsChar() returns the value passed to ctor, only converted + // to char, while AsChar() takes the string returned by InputAsChar() + // and does format string conversion on it as well (and similarly for + // ..AsWChar() below) + const char* InputAsChar(); + const char* AsChar(); + wxScopedCharBuffer m_convertedChar; +#endif // !wxUSE_UNICODE_WCHAR && !defined wx_NO_IMPLICIT_WXSTRING_ENCODING + +#if wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY +public: + operator const wchar_t*() const + { return const_cast<wxFormatString*>(this)->AsWChar(); } +private: + const wchar_t* InputAsWChar(); + const wchar_t* AsWChar(); + wxScopedWCharBuffer m_convertedWChar; +#endif // wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY + +private: + wxScopedCharBuffer m_char; + wxScopedWCharBuffer m_wchar; + + // NB: we can use a pointer here, because wxFormatString is only used + // as function argument, so it has shorter life than the string + // passed to the ctor + const wxString * const m_str; + const wxCStrData * const m_cstr; + + wxDECLARE_NO_ASSIGN_CLASS(wxFormatString); +}; + +// these two helper classes are used to find wxFormatString argument among fixed +// arguments passed to a vararg template +struct wxFormatStringArgument +{ + wxFormatStringArgument(const wxFormatString *s = NULL) : m_str(s) {} + const wxFormatString *m_str; + + // overriding this operator allows us to reuse _WX_VARARG_JOIN macro + wxFormatStringArgument operator,(const wxFormatStringArgument& a) const + { + wxASSERT_MSG( m_str == NULL || a.m_str == NULL, + "can't have two format strings in vararg function" ); + return wxFormatStringArgument(m_str ? m_str : a.m_str); + } + + operator const wxFormatString*() const { return m_str; } +}; + +template<typename T> +struct wxFormatStringArgumentFinder +{ + static wxFormatStringArgument find(T) + { + // by default, arguments are not format strings, so return "not found" + return wxFormatStringArgument(); + } +}; + +template<> +struct wxFormatStringArgumentFinder<const wxFormatString&> +{ + static wxFormatStringArgument find(const wxFormatString& arg) + { return wxFormatStringArgument(&arg); } +}; + +template<> +struct wxFormatStringArgumentFinder<wxFormatString> + : public wxFormatStringArgumentFinder<const wxFormatString&> {}; + +// avoid passing big objects by value to wxFormatStringArgumentFinder::find() +// (and especially wx[W]CharBuffer with its auto_ptr<> style semantics!): +template<> +struct wxFormatStringArgumentFinder<wxString> + : public wxFormatStringArgumentFinder<const wxString&> {}; + +template<> +struct wxFormatStringArgumentFinder<wxScopedCharBuffer> + : public wxFormatStringArgumentFinder<const wxScopedCharBuffer&> { +#ifdef wxNO_IMPLICIT_WXSTRING_ENCODING +private: + wxFormatStringArgumentFinder() wxMEMBER_DELETE; +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING +}; + +template<> +struct wxFormatStringArgumentFinder<wxScopedWCharBuffer> + : public wxFormatStringArgumentFinder<const wxScopedWCharBuffer&> {}; + +template<> +struct wxFormatStringArgumentFinder<wxCharBuffer> + : public wxFormatStringArgumentFinder<const wxCharBuffer&> { +#ifdef wxNO_IMPLICIT_WXSTRING_ENCODING +private: + wxFormatStringArgumentFinder() wxMEMBER_DELETE; +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING +}; + +template<> +struct wxFormatStringArgumentFinder<wxWCharBuffer> + : public wxFormatStringArgumentFinder<const wxWCharBuffer&> {}; + + +// ---------------------------------------------------------------------------- +// wxArgNormalizer*<T> converters +// ---------------------------------------------------------------------------- + +#if wxDEBUG_LEVEL + // Check that the format specifier for index-th argument in 'fmt' has + // the correct type (one of wxFormatString::Arg_XXX or-combination in + // 'expected_mask'). + #define wxASSERT_ARG_TYPE(fmt, index, expected_mask) \ + wxSTATEMENT_MACRO_BEGIN \ + if ( !fmt ) \ + break; \ + const int argtype = fmt->GetArgumentType(index); \ + wxASSERT_MSG( (argtype & (expected_mask)) == argtype, \ + "format specifier doesn't match argument type" ); \ + wxSTATEMENT_MACRO_END +#else + // Just define it to suppress "unused parameter" warnings for the + // parameters which we don't use otherwise + #define wxASSERT_ARG_TYPE(fmt, index, expected_mask) \ + wxUnusedVar(fmt); \ + wxUnusedVar(index) +#endif // wxDEBUG_LEVEL/!wxDEBUG_LEVEL + + +#if defined(HAVE_TYPE_TRAITS) || defined(HAVE_TR1_TYPE_TRAITS) + +// Note: this type is misnamed, so that the error message is easier to +// understand (no error happens for enums, because the IsEnum=true case is +// specialized). +template<bool IsEnum> +struct wxFormatStringSpecifierNonPodType {}; + +template<> +struct wxFormatStringSpecifierNonPodType<true> +{ + enum { value = wxFormatString::Arg_Int }; +}; + +template<typename T> +struct wxFormatStringSpecifier +{ +#ifdef HAVE_TYPE_TRAITS + typedef std::is_enum<T> is_enum; +#elif defined HAVE_TR1_TYPE_TRAITS + typedef std::tr1::is_enum<T> is_enum; +#endif + enum { value = wxFormatStringSpecifierNonPodType<is_enum::value>::value }; +}; + +#else // !HAVE_(TR1_)TYPE_TRAITS + +template<typename T> +struct wxFormatStringSpecifier +{ + // We can't detect enums without is_enum, so the only thing we can + // do is to accept unknown types. However, the only acceptable unknown + // types still are enums, which are promoted to ints, so return Arg_Int + // here. This will at least catch passing of non-POD types through ... at + // runtime. + // + // Furthermore, if the compiler doesn't have partial template + // specialization, we didn't cover pointers either. + enum { value = wxFormatString::Arg_Int }; +}; + +#endif // HAVE_TR1_TYPE_TRAITS/!HAVE_TR1_TYPE_TRAITS + + +template<typename T> +struct wxFormatStringSpecifier<T*> +{ + enum { value = wxFormatString::Arg_Pointer }; +}; + +template<typename T> +struct wxFormatStringSpecifier<const T*> +{ + enum { value = wxFormatString::Arg_Pointer }; +}; + + +#define wxFORMAT_STRING_SPECIFIER(T, arg) \ + template<> struct wxFormatStringSpecifier<T> \ + { \ + enum { value = arg }; \ + }; + +#define wxDISABLED_FORMAT_STRING_SPECIFIER(T) \ + template<> struct wxFormatStringSpecifier<T> \ + { \ + private: \ + wxFormatStringSpecifier() wxMEMBER_DELETE; \ + }; + +wxFORMAT_STRING_SPECIFIER(bool, wxFormatString::Arg_Int) +wxFORMAT_STRING_SPECIFIER(int, wxFormatString::Arg_Int) +wxFORMAT_STRING_SPECIFIER(unsigned int, wxFormatString::Arg_Int) +wxFORMAT_STRING_SPECIFIER(short int, wxFormatString::Arg_Int) +wxFORMAT_STRING_SPECIFIER(short unsigned int, wxFormatString::Arg_Int) +wxFORMAT_STRING_SPECIFIER(long int, wxFormatString::Arg_LongInt) +wxFORMAT_STRING_SPECIFIER(long unsigned int, wxFormatString::Arg_LongInt) +#ifdef wxLongLong_t +wxFORMAT_STRING_SPECIFIER(wxLongLong_t, wxFormatString::Arg_LongLongInt) +wxFORMAT_STRING_SPECIFIER(wxULongLong_t, wxFormatString::Arg_LongLongInt) +#endif +wxFORMAT_STRING_SPECIFIER(float, wxFormatString::Arg_Double) +wxFORMAT_STRING_SPECIFIER(double, wxFormatString::Arg_Double) +wxFORMAT_STRING_SPECIFIER(long double, wxFormatString::Arg_LongDouble) + +#if wxWCHAR_T_IS_REAL_TYPE +wxFORMAT_STRING_SPECIFIER(wchar_t, wxFormatString::Arg_Char | wxFormatString::Arg_Int) +#endif + +#if !wxUSE_UNICODE && !defined wxNO_IMPLICIT_WXSTRING_ENCODING +wxFORMAT_STRING_SPECIFIER(char, wxFormatString::Arg_Char | wxFormatString::Arg_Int) +wxFORMAT_STRING_SPECIFIER(signed char, wxFormatString::Arg_Char | wxFormatString::Arg_Int) +wxFORMAT_STRING_SPECIFIER(unsigned char, wxFormatString::Arg_Char | wxFormatString::Arg_Int) +#endif + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +wxFORMAT_STRING_SPECIFIER(char*, wxFormatString::Arg_String) +wxFORMAT_STRING_SPECIFIER(unsigned char*, wxFormatString::Arg_String) +wxFORMAT_STRING_SPECIFIER(signed char*, wxFormatString::Arg_String) +wxFORMAT_STRING_SPECIFIER(const char*, wxFormatString::Arg_String) +wxFORMAT_STRING_SPECIFIER(const unsigned char*, wxFormatString::Arg_String) +wxFORMAT_STRING_SPECIFIER(const signed char*, wxFormatString::Arg_String) +#else // wxNO_IMPLICIT_WXSTRING_ENCODING +wxDISABLED_FORMAT_STRING_SPECIFIER(char*) +wxDISABLED_FORMAT_STRING_SPECIFIER(unsigned char*) +wxDISABLED_FORMAT_STRING_SPECIFIER(signed char*) +wxDISABLED_FORMAT_STRING_SPECIFIER(const char*) +wxDISABLED_FORMAT_STRING_SPECIFIER(const unsigned char*) +wxDISABLED_FORMAT_STRING_SPECIFIER(const signed char*) +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING +wxFORMAT_STRING_SPECIFIER(wchar_t*, wxFormatString::Arg_String) +wxFORMAT_STRING_SPECIFIER(const wchar_t*, wxFormatString::Arg_String) + +wxFORMAT_STRING_SPECIFIER(int*, wxFormatString::Arg_IntPtr | wxFormatString::Arg_Pointer) +wxFORMAT_STRING_SPECIFIER(short int*, wxFormatString::Arg_ShortIntPtr | wxFormatString::Arg_Pointer) +wxFORMAT_STRING_SPECIFIER(long int*, wxFormatString::Arg_LongIntPtr | wxFormatString::Arg_Pointer) + +#ifdef wxHAS_NULLPTR_T +wxFORMAT_STRING_SPECIFIER(std::nullptr_t, wxFormatString::Arg_Pointer) +#endif + +#undef wxFORMAT_STRING_SPECIFIER +#undef wxDISABLED_FORMAT_STRING_SPECIFIER + + +// Converts an argument passed to wxPrint etc. into standard form expected, +// by wxXXX functions, e.g. all strings (wxString, char*, wchar_t*) are +// converted into wchar_t* or char* depending on the build. +template<typename T> +struct wxArgNormalizer +{ + // Ctor. 'value' is the value passed as variadic argument, 'fmt' is pointer + // to printf-like format string or NULL if the variadic function doesn't + // use format string and 'index' is index of 'value' in variadic arguments + // list (starting at 1) + wxArgNormalizer(T value, + const wxFormatString *fmt, unsigned index) + : m_value(value) + { + wxASSERT_ARG_TYPE( fmt, index, wxFormatStringSpecifier<T>::value ); + } + + // Returns the value in a form that can be safely passed to real vararg + // functions. In case of strings, this is char* in ANSI build and wchar_t* + // in Unicode build. + T get() const { return m_value; } + + T m_value; +}; + +// normalizer for passing arguments to functions working with wchar_t* (and +// until ANSI build is removed, char* in ANSI build as well - FIXME-UTF8) +// string representation +#if !wxUSE_UTF8_LOCALE_ONLY +template<typename T> +struct wxArgNormalizerWchar : public wxArgNormalizer<T> +{ + wxArgNormalizerWchar(T value, + const wxFormatString *fmt, unsigned index) + : wxArgNormalizer<T>(value, fmt, index) {} +}; +#endif // !wxUSE_UTF8_LOCALE_ONLY + +// normalizer for passing arguments to functions working with UTF-8 encoded +// char* strings +#if wxUSE_UNICODE_UTF8 + template<typename T> + struct wxArgNormalizerUtf8 : public wxArgNormalizer<T> + { + wxArgNormalizerUtf8(T value, + const wxFormatString *fmt, unsigned index) + : wxArgNormalizer<T>(value, fmt, index) {} + }; + + #define wxArgNormalizerNative wxArgNormalizerUtf8 +#else // wxUSE_UNICODE_WCHAR + #define wxArgNormalizerNative wxArgNormalizerWchar +#endif // wxUSE_UNICODE_UTF8 // wxUSE_UNICODE_UTF8 + + + +// special cases for converting strings: + + +// base class for wxArgNormalizer<T> specializations that need to do conversion; +// CharType is either wxStringCharType or wchar_t in UTF-8 build when wrapping +// widechar CRT function +template<typename CharType> +struct wxArgNormalizerWithBuffer +{ + typedef wxScopedCharTypeBuffer<CharType> CharBuffer; + + wxArgNormalizerWithBuffer() {} + wxArgNormalizerWithBuffer(const CharBuffer& buf, + const wxFormatString *fmt, + unsigned index) + : m_value(buf) + { + wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_String ); + } + + const CharType *get() const { return m_value; } + + CharBuffer m_value; +}; + +// string objects: +template<> +struct WXDLLIMPEXP_BASE wxArgNormalizerNative<const wxString&> +{ + wxArgNormalizerNative(const wxString& s, + const wxFormatString *fmt, + unsigned index) + : m_value(s) + { + wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_String ); + } + + const wxStringCharType *get() const; + + const wxString& m_value; +}; + +// c_str() values: +template<> +struct WXDLLIMPEXP_BASE wxArgNormalizerNative<const wxCStrData&> +{ + wxArgNormalizerNative(const wxCStrData& value, + const wxFormatString *fmt, + unsigned index) + : m_value(value) + { + wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_String ); + } + + const wxStringCharType *get() const; + + const wxCStrData& m_value; +}; + +// wxString/wxCStrData conversion to wchar_t* value +#if wxUSE_UNICODE_UTF8 && !wxUSE_UTF8_LOCALE_ONLY +template<> +struct WXDLLIMPEXP_BASE wxArgNormalizerWchar<const wxString&> + : public wxArgNormalizerWithBuffer<wchar_t> +{ + wxArgNormalizerWchar(const wxString& s, + const wxFormatString *fmt, unsigned index); +}; + +template<> +struct WXDLLIMPEXP_BASE wxArgNormalizerWchar<const wxCStrData&> + : public wxArgNormalizerWithBuffer<wchar_t> +{ + wxArgNormalizerWchar(const wxCStrData& s, + const wxFormatString *fmt, unsigned index); +}; +#endif // wxUSE_UNICODE_UTF8 && !wxUSE_UTF8_LOCALE_ONLY + + +// C string pointers of the wrong type (wchar_t* for ANSI or UTF8 build, +// char* for wchar_t Unicode build or UTF8): +#if wxUSE_UNICODE_WCHAR + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +template<> +struct wxArgNormalizerWchar<const char*> + : public wxArgNormalizerWithBuffer<wchar_t> +{ + wxArgNormalizerWchar(const char* s, + const wxFormatString *fmt, unsigned index) + : wxArgNormalizerWithBuffer<wchar_t>(wxConvLibc.cMB2WC(s), fmt, index) {} +}; +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + +#elif wxUSE_UNICODE_UTF8 + +template<> +struct wxArgNormalizerUtf8<const wchar_t*> + : public wxArgNormalizerWithBuffer<char> +{ + wxArgNormalizerUtf8(const wchar_t* s, + const wxFormatString *fmt, unsigned index) + : wxArgNormalizerWithBuffer<char>(wxConvUTF8.cWC2MB(s), fmt, index) {} +}; + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +template<> +struct wxArgNormalizerUtf8<const char*> + : public wxArgNormalizerWithBuffer<char> +{ + wxArgNormalizerUtf8(const char* s, + const wxFormatString *fmt, + unsigned index) + { + wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_String ); + + if ( wxLocaleIsUtf8 ) + { + m_value = wxScopedCharBuffer::CreateNonOwned(s); + } + else + { + // convert to widechar string first: + wxScopedWCharBuffer buf(wxConvLibc.cMB2WC(s)); + + // then to UTF-8: + if ( buf ) + m_value = wxConvUTF8.cWC2MB(buf); + } + } +}; +#endif + +// UTF-8 build needs conversion to wchar_t* too: +#if !wxUSE_UTF8_LOCALE_ONLY && !defined wxNO_IMPLICIT_WXSTRING_ENCODING +template<> +struct wxArgNormalizerWchar<const char*> + : public wxArgNormalizerWithBuffer<wchar_t> +{ + wxArgNormalizerWchar(const char* s, + const wxFormatString *fmt, unsigned index) + : wxArgNormalizerWithBuffer<wchar_t>(wxConvLibc.cMB2WC(s), fmt, index) {} +}; +#endif // !wxUSE_UTF8_LOCALE_ONLY && !defined wxNO_IMPLICIT_WXSTRING_ENCODING + +#else // ANSI - FIXME-UTF8 + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +template<> +struct wxArgNormalizerWchar<const wchar_t*> + : public wxArgNormalizerWithBuffer<char> +{ + wxArgNormalizerWchar(const wchar_t* s, + const wxFormatString *fmt, unsigned index) + : wxArgNormalizerWithBuffer<char>(wxConvLibc.cWC2MB(s), fmt, index) {} +}; +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + +#endif // wxUSE_UNICODE_WCHAR/wxUSE_UNICODE_UTF8/ANSI + + +#ifdef wxNO_IMPLICIT_WXSTRING_ENCODING +// wxArgNormalizer specializations that cannot be instanced +template<> +struct wxArgNormalizer<const char*> { +private: + wxArgNormalizer(const char*, const wxFormatString *, unsigned); + const char *get() const; +}; +template<> +struct wxArgNormalizer<char*> { +private: + wxArgNormalizer(const char*, const wxFormatString *, unsigned); + char *get() const; +}; +template<> +struct wxArgNormalizer<const std::string> { +private: + wxArgNormalizer(const std::string&, const wxFormatString *, unsigned); + std::string get() const; +}; +template<> +struct wxArgNormalizer<std::string> { +private: + wxArgNormalizer(std::string&, const wxFormatString *, unsigned); + std::string get() const; +}; +template<> +struct wxArgNormalizer<wxCharBuffer> { +private: + wxArgNormalizer(wxCharBuffer&, const wxFormatString *, unsigned); + std::string get() const; +}; +template<> +struct wxArgNormalizer<wxScopedCharBuffer> { +private: + wxArgNormalizer(wxScopedCharBuffer&, const wxFormatString *, unsigned); + std::string get() const; +}; +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + +// this macro is used to implement specialization that are exactly same as +// some other specialization, i.e. to "forward" the implementation (e.g. for +// T=wxString and T=const wxString&). Note that the ctor takes BaseT argument, +// not T! +#if wxUSE_UNICODE_UTF8 + #if wxUSE_UTF8_LOCALE_ONLY + #define WX_ARG_NORMALIZER_FORWARD(T, BaseT) \ + _WX_ARG_NORMALIZER_FORWARD_IMPL(wxArgNormalizerUtf8, T, BaseT) + #else // possibly non-UTF8 locales + #define WX_ARG_NORMALIZER_FORWARD(T, BaseT) \ + _WX_ARG_NORMALIZER_FORWARD_IMPL(wxArgNormalizerWchar, T, BaseT); \ + _WX_ARG_NORMALIZER_FORWARD_IMPL(wxArgNormalizerUtf8, T, BaseT) + #endif +#else // wxUSE_UNICODE_WCHAR + #define WX_ARG_NORMALIZER_FORWARD(T, BaseT) \ + _WX_ARG_NORMALIZER_FORWARD_IMPL(wxArgNormalizerWchar, T, BaseT) +#endif // wxUSE_UNICODE_UTF8/wxUSE_UNICODE_WCHAR + +#define _WX_ARG_NORMALIZER_FORWARD_IMPL(Normalizer, T, BaseT) \ + template<> \ + struct Normalizer<T> : public Normalizer<BaseT> \ + { \ + Normalizer(BaseT value, \ + const wxFormatString *fmt, unsigned index) \ + : Normalizer<BaseT>(value, fmt, index) {} \ + } + +// non-reference versions of specializations for string objects +WX_ARG_NORMALIZER_FORWARD(wxString, const wxString&); +WX_ARG_NORMALIZER_FORWARD(wxCStrData, const wxCStrData&); + +// versions for passing non-const pointers: +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +WX_ARG_NORMALIZER_FORWARD(char*, const char*); +#endif +WX_ARG_NORMALIZER_FORWARD(wchar_t*, const wchar_t*); + +// versions for passing wx[W]CharBuffer: +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +WX_ARG_NORMALIZER_FORWARD(wxScopedCharBuffer, const char*); +WX_ARG_NORMALIZER_FORWARD(const wxScopedCharBuffer&, const char*); +#endif +WX_ARG_NORMALIZER_FORWARD(wxScopedWCharBuffer, const wchar_t*); +WX_ARG_NORMALIZER_FORWARD(const wxScopedWCharBuffer&, const wchar_t*); +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +WX_ARG_NORMALIZER_FORWARD(wxCharBuffer, const char*); +WX_ARG_NORMALIZER_FORWARD(const wxCharBuffer&, const char*); +#endif +WX_ARG_NORMALIZER_FORWARD(wxWCharBuffer, const wchar_t*); +WX_ARG_NORMALIZER_FORWARD(const wxWCharBuffer&, const wchar_t*); + +// versions for std::[w]string: +#if wxUSE_STD_STRING + +#include "wx/stringimpl.h" + +// And also string_view, if we have it (notice that <string> was included from +// wx/stringimpl.h above, so __cpp_lib_string_view should be defined if it's +// supported). +#ifdef __cpp_lib_string_view + #include <string_view> +#endif // __cpp_lib_string_view + +#if !wxUSE_UTF8_LOCALE_ONLY +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +template<> +struct wxArgNormalizerWchar<const std::string&> + : public wxArgNormalizerWchar<const char*> +{ + wxArgNormalizerWchar(const std::string& s, + const wxFormatString *fmt, unsigned index) + : wxArgNormalizerWchar<const char*>(s.c_str(), fmt, index) {} +}; + +#ifdef __cpp_lib_string_view +// This is inefficient because we create a temporary string rather than using +// the string_view directly, but is required because the rest of the code +// assumes NUL-terminated strings and is still better than nothing (i.e. no +// support for std::string_view at all). +template<> +struct wxArgNormalizerWchar<const std::string_view&> + : public wxArgNormalizerWchar<const std::string&> +{ + wxArgNormalizerWchar(const std::string_view& v, + const wxFormatString *fmt, unsigned index) + : wxArgNormalizerWchar<const std::string&>(std::string{v}, fmt, index) {} +}; +#endif // __cpp_lib_string_view + +#endif // NO_IMPLICIT_WXSTRING_ENCODING + +template<> +struct wxArgNormalizerWchar<const wxStdWideString&> + : public wxArgNormalizerWchar<const wchar_t*> +{ + wxArgNormalizerWchar(const wxStdWideString& s, + const wxFormatString *fmt, unsigned index) + : wxArgNormalizerWchar<const wchar_t*>(s.c_str(), fmt, index) {} +}; +#endif // !wxUSE_UTF8_LOCALE_ONLY + +#if wxUSE_UNICODE_UTF8 +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +template<> +struct wxArgNormalizerUtf8<const std::string&> + : public wxArgNormalizerUtf8<const char*> +{ + wxArgNormalizerUtf8(const std::string& s, + const wxFormatString *fmt, unsigned index) + : wxArgNormalizerUtf8<const char*>(s.c_str(), fmt, index) {} +}; + +#ifdef __cpp_lib_string_view +template<> +struct wxArgNormalizerUtf8<const std::string_view&> + : public wxArgNormalizerUtf8<const char*> +{ + wxArgNormalizerUtf8(const std::string_view& v, + const wxFormatString *fmt, unsigned index) + : wxArgNormalizerUtf8<const char*>(v.data(), fmt, index) {} +}; +#endif // __cpp_lib_string_view + +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + +template<> +struct wxArgNormalizerUtf8<const wxStdWideString&> + : public wxArgNormalizerUtf8<const wchar_t*> +{ + wxArgNormalizerUtf8(const wxStdWideString& s, + const wxFormatString *fmt, unsigned index) + : wxArgNormalizerUtf8<const wchar_t*>(s.c_str(), fmt, index) {} +}; +#endif // wxUSE_UNICODE_UTF8 + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +WX_ARG_NORMALIZER_FORWARD(std::string, const std::string&); +#ifdef __cpp_lib_string_view +WX_ARG_NORMALIZER_FORWARD(std::string_view, const std::string_view&); +#endif // __cpp_lib_string_view +#endif +WX_ARG_NORMALIZER_FORWARD(wxStdWideString, const wxStdWideString&); + +#endif // wxUSE_STD_STRING + + +// versions for wxUniChar, wxUniCharRef: +// (this is same for UTF-8 and Wchar builds, we just convert to wchar_t) +template<> +struct wxArgNormalizer<const wxUniChar&> : public wxArgNormalizer<wchar_t> +{ + wxArgNormalizer(const wxUniChar& s, + const wxFormatString *fmt, unsigned index) + : wxArgNormalizer<wchar_t>(wx_truncate_cast(wchar_t, s.GetValue()), fmt, index) {} +}; + +// for wchar_t, default handler does the right thing + +// char has to be treated differently in Unicode builds: a char argument may +// be used either for a character value (which should be converted into +// wxUniChar) or as an integer value (which should be left as-is). We take +// advantage of the fact that both char and wchar_t are converted into int +// in variadic arguments here. +#if wxUSE_UNICODE +template<typename T> +struct wxArgNormalizerNarrowChar +{ + wxArgNormalizerNarrowChar(T value, + const wxFormatString *fmt, unsigned index) + { + wxASSERT_ARG_TYPE( fmt, index, + wxFormatString::Arg_Char | wxFormatString::Arg_Int ); + + // FIXME-UTF8: which one is better default in absence of fmt string + // (i.e. when used like e.g. Foo("foo", "bar", 'c', NULL)? + if ( !fmt || fmt->GetArgumentType(index) == wxFormatString::Arg_Char ) + m_value = wx_truncate_cast(T, wxUniChar(value).GetValue()); + else + m_value = value; + } + + int get() const { return m_value; } + + T m_value; +}; + +template<> +struct wxArgNormalizer<char> : public wxArgNormalizerNarrowChar<char> +{ + wxArgNormalizer(char value, + const wxFormatString *fmt, unsigned index) + : wxArgNormalizerNarrowChar<char>(value, fmt, index) {} +}; + +template<> +struct wxArgNormalizer<unsigned char> + : public wxArgNormalizerNarrowChar<unsigned char> +{ + wxArgNormalizer(unsigned char value, + const wxFormatString *fmt, unsigned index) + : wxArgNormalizerNarrowChar<unsigned char>(value, fmt, index) {} +}; + +template<> +struct wxArgNormalizer<signed char> + : public wxArgNormalizerNarrowChar<signed char> +{ + wxArgNormalizer(signed char value, + const wxFormatString *fmt, unsigned index) + : wxArgNormalizerNarrowChar<signed char>(value, fmt, index) {} +}; + +#endif // wxUSE_UNICODE + +// convert references: +WX_ARG_NORMALIZER_FORWARD(wxUniChar, const wxUniChar&); +WX_ARG_NORMALIZER_FORWARD(const wxUniCharRef&, const wxUniChar&); +WX_ARG_NORMALIZER_FORWARD(wxUniCharRef, const wxUniChar&); +WX_ARG_NORMALIZER_FORWARD(const wchar_t&, wchar_t); + +WX_ARG_NORMALIZER_FORWARD(const char&, char); +WX_ARG_NORMALIZER_FORWARD(const unsigned char&, unsigned char); +WX_ARG_NORMALIZER_FORWARD(const signed char&, signed char); + + +#undef WX_ARG_NORMALIZER_FORWARD +#undef _WX_ARG_NORMALIZER_FORWARD_IMPL + +// NB: Don't #undef wxASSERT_ARG_TYPE here as it's also used in wx/longlong.h. + +// ---------------------------------------------------------------------------- +// WX_VA_ARG_STRING +// ---------------------------------------------------------------------------- + +// Replacement for va_arg() for use with strings in functions that accept +// strings normalized by wxArgNormalizer<T>: + +struct WXDLLIMPEXP_BASE wxArgNormalizedString +{ + wxArgNormalizedString(const void* ptr) : m_ptr(ptr) {} + + // returns true if non-NULL string was passed in + bool IsValid() const { return m_ptr != NULL; } + operator bool() const { return IsValid(); } + + // extracts the string, returns empty string if NULL was passed in + wxString GetString() const; + operator wxString() const; + +private: + const void *m_ptr; +}; + +#define WX_VA_ARG_STRING(ap) wxArgNormalizedString(va_arg(ap, const void*)) + +// ---------------------------------------------------------------------------- +// implementation of the WX_DEFINE_VARARG_* macros +// ---------------------------------------------------------------------------- + +// NB: The vararg emulation code is limited to 30 variadic and 4 fixed +// arguments at the moment. +// If you need more variadic arguments, you need to +// 1) increase the value of _WX_VARARG_MAX_ARGS +// 2) add _WX_VARARG_JOIN_* and _WX_VARARG_ITER_* up to the new +// _WX_VARARG_MAX_ARGS value to the lists below +// If you need more fixed arguments, you need to +// 1) increase the value of _WX_VARARG_MAX_FIXED_ARGS +// 2) add _WX_VARARG_FIXED_EXPAND_* and _WX_VARARG_FIXED_UNUSED_EXPAND_* +// macros below +#define _WX_VARARG_MAX_ARGS 30 +#define _WX_VARARG_MAX_FIXED_ARGS 4 + +#define _WX_VARARG_JOIN_1(m) m(1) +#define _WX_VARARG_JOIN_2(m) _WX_VARARG_JOIN_1(m), m(2) +#define _WX_VARARG_JOIN_3(m) _WX_VARARG_JOIN_2(m), m(3) +#define _WX_VARARG_JOIN_4(m) _WX_VARARG_JOIN_3(m), m(4) +#define _WX_VARARG_JOIN_5(m) _WX_VARARG_JOIN_4(m), m(5) +#define _WX_VARARG_JOIN_6(m) _WX_VARARG_JOIN_5(m), m(6) +#define _WX_VARARG_JOIN_7(m) _WX_VARARG_JOIN_6(m), m(7) +#define _WX_VARARG_JOIN_8(m) _WX_VARARG_JOIN_7(m), m(8) +#define _WX_VARARG_JOIN_9(m) _WX_VARARG_JOIN_8(m), m(9) +#define _WX_VARARG_JOIN_10(m) _WX_VARARG_JOIN_9(m), m(10) +#define _WX_VARARG_JOIN_11(m) _WX_VARARG_JOIN_10(m), m(11) +#define _WX_VARARG_JOIN_12(m) _WX_VARARG_JOIN_11(m), m(12) +#define _WX_VARARG_JOIN_13(m) _WX_VARARG_JOIN_12(m), m(13) +#define _WX_VARARG_JOIN_14(m) _WX_VARARG_JOIN_13(m), m(14) +#define _WX_VARARG_JOIN_15(m) _WX_VARARG_JOIN_14(m), m(15) +#define _WX_VARARG_JOIN_16(m) _WX_VARARG_JOIN_15(m), m(16) +#define _WX_VARARG_JOIN_17(m) _WX_VARARG_JOIN_16(m), m(17) +#define _WX_VARARG_JOIN_18(m) _WX_VARARG_JOIN_17(m), m(18) +#define _WX_VARARG_JOIN_19(m) _WX_VARARG_JOIN_18(m), m(19) +#define _WX_VARARG_JOIN_20(m) _WX_VARARG_JOIN_19(m), m(20) +#define _WX_VARARG_JOIN_21(m) _WX_VARARG_JOIN_20(m), m(21) +#define _WX_VARARG_JOIN_22(m) _WX_VARARG_JOIN_21(m), m(22) +#define _WX_VARARG_JOIN_23(m) _WX_VARARG_JOIN_22(m), m(23) +#define _WX_VARARG_JOIN_24(m) _WX_VARARG_JOIN_23(m), m(24) +#define _WX_VARARG_JOIN_25(m) _WX_VARARG_JOIN_24(m), m(25) +#define _WX_VARARG_JOIN_26(m) _WX_VARARG_JOIN_25(m), m(26) +#define _WX_VARARG_JOIN_27(m) _WX_VARARG_JOIN_26(m), m(27) +#define _WX_VARARG_JOIN_28(m) _WX_VARARG_JOIN_27(m), m(28) +#define _WX_VARARG_JOIN_29(m) _WX_VARARG_JOIN_28(m), m(29) +#define _WX_VARARG_JOIN_30(m) _WX_VARARG_JOIN_29(m), m(30) + +#define _WX_VARARG_ITER_1(m,a,b,c,d,e,f) m(1,a,b,c,d,e,f) +#define _WX_VARARG_ITER_2(m,a,b,c,d,e,f) _WX_VARARG_ITER_1(m,a,b,c,d,e,f) m(2,a,b,c,d,e,f) +#define _WX_VARARG_ITER_3(m,a,b,c,d,e,f) _WX_VARARG_ITER_2(m,a,b,c,d,e,f) m(3,a,b,c,d,e,f) +#define _WX_VARARG_ITER_4(m,a,b,c,d,e,f) _WX_VARARG_ITER_3(m,a,b,c,d,e,f) m(4,a,b,c,d,e,f) +#define _WX_VARARG_ITER_5(m,a,b,c,d,e,f) _WX_VARARG_ITER_4(m,a,b,c,d,e,f) m(5,a,b,c,d,e,f) +#define _WX_VARARG_ITER_6(m,a,b,c,d,e,f) _WX_VARARG_ITER_5(m,a,b,c,d,e,f) m(6,a,b,c,d,e,f) +#define _WX_VARARG_ITER_7(m,a,b,c,d,e,f) _WX_VARARG_ITER_6(m,a,b,c,d,e,f) m(7,a,b,c,d,e,f) +#define _WX_VARARG_ITER_8(m,a,b,c,d,e,f) _WX_VARARG_ITER_7(m,a,b,c,d,e,f) m(8,a,b,c,d,e,f) +#define _WX_VARARG_ITER_9(m,a,b,c,d,e,f) _WX_VARARG_ITER_8(m,a,b,c,d,e,f) m(9,a,b,c,d,e,f) +#define _WX_VARARG_ITER_10(m,a,b,c,d,e,f) _WX_VARARG_ITER_9(m,a,b,c,d,e,f) m(10,a,b,c,d,e,f) +#define _WX_VARARG_ITER_11(m,a,b,c,d,e,f) _WX_VARARG_ITER_10(m,a,b,c,d,e,f) m(11,a,b,c,d,e,f) +#define _WX_VARARG_ITER_12(m,a,b,c,d,e,f) _WX_VARARG_ITER_11(m,a,b,c,d,e,f) m(12,a,b,c,d,e,f) +#define _WX_VARARG_ITER_13(m,a,b,c,d,e,f) _WX_VARARG_ITER_12(m,a,b,c,d,e,f) m(13,a,b,c,d,e,f) +#define _WX_VARARG_ITER_14(m,a,b,c,d,e,f) _WX_VARARG_ITER_13(m,a,b,c,d,e,f) m(14,a,b,c,d,e,f) +#define _WX_VARARG_ITER_15(m,a,b,c,d,e,f) _WX_VARARG_ITER_14(m,a,b,c,d,e,f) m(15,a,b,c,d,e,f) +#define _WX_VARARG_ITER_16(m,a,b,c,d,e,f) _WX_VARARG_ITER_15(m,a,b,c,d,e,f) m(16,a,b,c,d,e,f) +#define _WX_VARARG_ITER_17(m,a,b,c,d,e,f) _WX_VARARG_ITER_16(m,a,b,c,d,e,f) m(17,a,b,c,d,e,f) +#define _WX_VARARG_ITER_18(m,a,b,c,d,e,f) _WX_VARARG_ITER_17(m,a,b,c,d,e,f) m(18,a,b,c,d,e,f) +#define _WX_VARARG_ITER_19(m,a,b,c,d,e,f) _WX_VARARG_ITER_18(m,a,b,c,d,e,f) m(19,a,b,c,d,e,f) +#define _WX_VARARG_ITER_20(m,a,b,c,d,e,f) _WX_VARARG_ITER_19(m,a,b,c,d,e,f) m(20,a,b,c,d,e,f) +#define _WX_VARARG_ITER_21(m,a,b,c,d,e,f) _WX_VARARG_ITER_20(m,a,b,c,d,e,f) m(21,a,b,c,d,e,f) +#define _WX_VARARG_ITER_22(m,a,b,c,d,e,f) _WX_VARARG_ITER_21(m,a,b,c,d,e,f) m(22,a,b,c,d,e,f) +#define _WX_VARARG_ITER_23(m,a,b,c,d,e,f) _WX_VARARG_ITER_22(m,a,b,c,d,e,f) m(23,a,b,c,d,e,f) +#define _WX_VARARG_ITER_24(m,a,b,c,d,e,f) _WX_VARARG_ITER_23(m,a,b,c,d,e,f) m(24,a,b,c,d,e,f) +#define _WX_VARARG_ITER_25(m,a,b,c,d,e,f) _WX_VARARG_ITER_24(m,a,b,c,d,e,f) m(25,a,b,c,d,e,f) +#define _WX_VARARG_ITER_26(m,a,b,c,d,e,f) _WX_VARARG_ITER_25(m,a,b,c,d,e,f) m(26,a,b,c,d,e,f) +#define _WX_VARARG_ITER_27(m,a,b,c,d,e,f) _WX_VARARG_ITER_26(m,a,b,c,d,e,f) m(27,a,b,c,d,e,f) +#define _WX_VARARG_ITER_28(m,a,b,c,d,e,f) _WX_VARARG_ITER_27(m,a,b,c,d,e,f) m(28,a,b,c,d,e,f) +#define _WX_VARARG_ITER_29(m,a,b,c,d,e,f) _WX_VARARG_ITER_28(m,a,b,c,d,e,f) m(29,a,b,c,d,e,f) +#define _WX_VARARG_ITER_30(m,a,b,c,d,e,f) _WX_VARARG_ITER_29(m,a,b,c,d,e,f) m(30,a,b,c,d,e,f) + + +#define _WX_VARARG_FIXED_EXPAND_1(t1) \ + t1 f1 +#define _WX_VARARG_FIXED_EXPAND_2(t1,t2) \ + t1 f1, t2 f2 +#define _WX_VARARG_FIXED_EXPAND_3(t1,t2,t3) \ + t1 f1, t2 f2, t3 f3 +#define _WX_VARARG_FIXED_EXPAND_4(t1,t2,t3,t4) \ + t1 f1, t2 f2, t3 f3, t4 f4 + +#define _WX_VARARG_FIXED_UNUSED_EXPAND_1(t1) \ + t1 WXUNUSED(f1) +#define _WX_VARARG_FIXED_UNUSED_EXPAND_2(t1,t2) \ + t1 WXUNUSED(f1), t2 WXUNUSED(f2) +#define _WX_VARARG_FIXED_UNUSED_EXPAND_3(t1,t2,t3) \ + t1 WXUNUSED(f1), t2 WXUNUSED(f2), t3 WXUNUSED(f3) +#define _WX_VARARG_FIXED_UNUSED_EXPAND_4(t1,t2,t3,t4) \ + t1 WXUNUSED(f1), t2 WXUNUSED(f2), t3 WXUNUSED(f3), t4 WXUNUSED(f4) + +#define _WX_VARARG_FIXED_TYPEDEFS_1(t1) \ + typedef t1 TF1 +#define _WX_VARARG_FIXED_TYPEDEFS_2(t1,t2) \ + _WX_VARARG_FIXED_TYPEDEFS_1(t1); typedef t2 TF2 +#define _WX_VARARG_FIXED_TYPEDEFS_3(t1,t2,t3) \ + _WX_VARARG_FIXED_TYPEDEFS_2(t1,t2); typedef t3 TF3 +#define _WX_VARARG_FIXED_TYPEDEFS_4(t1,t2,t3,t4) \ + _WX_VARARG_FIXED_TYPEDEFS_3(t1,t2,t3); typedef t4 TF4 + +// This macro expands N-items tuple of fixed arguments types into part of +// function's declaration. For example, +// "_WX_VARARG_FIXED_EXPAND(3, (int, char*, int))" expands into +// "int f1, char* f2, int f3". +#define _WX_VARARG_FIXED_EXPAND(N, args) \ + _WX_VARARG_FIXED_EXPAND_IMPL(N, args) +#define _WX_VARARG_FIXED_EXPAND_IMPL(N, args) \ + _WX_VARARG_FIXED_EXPAND_##N args + +// Ditto for unused arguments +#define _WX_VARARG_FIXED_UNUSED_EXPAND(N, args) \ + _WX_VARARG_FIXED_UNUSED_EXPAND_IMPL(N, args) +#define _WX_VARARG_FIXED_UNUSED_EXPAND_IMPL(N, args) \ + _WX_VARARG_FIXED_UNUSED_EXPAND_##N args + +// Declarates typedefs for fixed arguments types; i-th fixed argument types +// will have TFi typedef. +#define _WX_VARARG_FIXED_TYPEDEFS(N, args) \ + _WX_VARARG_FIXED_TYPEDEFS_IMPL(N, args) +#define _WX_VARARG_FIXED_TYPEDEFS_IMPL(N, args) \ + _WX_VARARG_FIXED_TYPEDEFS_##N args + + +// This macro calls another macro 'm' passed as second argument 'N' times, +// with its only argument set to 1..N, and concatenates the results using +// comma as separator. +// +// An example: +// #define foo(i) x##i +// // this expands to "x1,x2,x3,x4" +// _WX_VARARG_JOIN(4, foo) +// +// +// N must not be greater than _WX_VARARG_MAX_ARGS (=30). +#define _WX_VARARG_JOIN(N, m) _WX_VARARG_JOIN_IMPL(N, m) +#define _WX_VARARG_JOIN_IMPL(N, m) _WX_VARARG_JOIN_##N(m) + + +// This macro calls another macro 'm' passed as second argument 'N' times, with +// its first argument set to 1..N and the remaining arguments set to 'a', 'b', +// 'c', 'd', 'e' and 'f'. The results are separated with whitespace in the +// expansion. +// +// An example: +// // this macro expands to: +// // foo(1,a,b,c,d,e,f) +// // foo(2,a,b,c,d,e,f) +// // foo(3,a,b,c,d,e,f) +// _WX_VARARG_ITER(3, foo, a, b, c, d, e, f) +// +// N must not be greater than _WX_VARARG_MAX_ARGS (=30). +#define _WX_VARARG_ITER(N,m,a,b,c,d,e,f) \ + _WX_VARARG_ITER_IMPL(N,m,a,b,c,d,e,f) +#define _WX_VARARG_ITER_IMPL(N,m,a,b,c,d,e,f) \ + _WX_VARARG_ITER_##N(m,a,b,c,d,e,f) + +// Generates code snippet for i-th "variadic" argument in vararg function's +// prototype: +#define _WX_VARARG_ARG(i) T##i a##i + +// Like _WX_VARARG_ARG_UNUSED, but outputs argument's type with WXUNUSED: +#define _WX_VARARG_ARG_UNUSED(i) T##i WXUNUSED(a##i) + +// Generates code snippet for i-th type in vararg function's template<...>: +#define _WX_VARARG_TEMPL(i) typename T##i + +// Generates code snippet for passing i-th argument of vararg function +// wrapper to its implementation, normalizing it in the process: +#define _WX_VARARG_PASS_WCHAR(i) \ + wxArgNormalizerWchar<T##i>(a##i, fmt, i).get() +#define _WX_VARARG_PASS_UTF8(i) \ + wxArgNormalizerUtf8<T##i>(a##i, fmt, i).get() + + +// And the same for fixed arguments, _not_ normalizing it: +#define _WX_VARARG_PASS_FIXED(i) f##i + +#define _WX_VARARG_FIND_FMT(i) \ + (wxFormatStringArgumentFinder<TF##i>::find(f##i)) + +#define _WX_VARARG_FORMAT_STRING(numfixed, fixed) \ + _WX_VARARG_FIXED_TYPEDEFS(numfixed, fixed); \ + const wxFormatString *fmt = \ + (_WX_VARARG_JOIN(numfixed, _WX_VARARG_FIND_FMT)) + +#if wxUSE_UNICODE_UTF8 + #define _WX_VARARG_DO_CALL_UTF8(return_kw, impl, implUtf8, N, numfixed) \ + return_kw implUtf8(_WX_VARARG_JOIN(numfixed, _WX_VARARG_PASS_FIXED), \ + _WX_VARARG_JOIN(N, _WX_VARARG_PASS_UTF8)) + #define _WX_VARARG_DO_CALL0_UTF8(return_kw, impl, implUtf8, numfixed) \ + return_kw implUtf8(_WX_VARARG_JOIN(numfixed, _WX_VARARG_PASS_FIXED)) +#endif // wxUSE_UNICODE_UTF8 + +#define _WX_VARARG_DO_CALL_WCHAR(return_kw, impl, implUtf8, N, numfixed) \ + return_kw impl(_WX_VARARG_JOIN(numfixed, _WX_VARARG_PASS_FIXED), \ + _WX_VARARG_JOIN(N, _WX_VARARG_PASS_WCHAR)) +#define _WX_VARARG_DO_CALL0_WCHAR(return_kw, impl, implUtf8, numfixed) \ + return_kw impl(_WX_VARARG_JOIN(numfixed, _WX_VARARG_PASS_FIXED)) + +#if wxUSE_UNICODE_UTF8 + #if wxUSE_UTF8_LOCALE_ONLY + #define _WX_VARARG_DO_CALL _WX_VARARG_DO_CALL_UTF8 + #define _WX_VARARG_DO_CALL0 _WX_VARARG_DO_CALL0_UTF8 + #else // possibly non-UTF8 locales + #define _WX_VARARG_DO_CALL(return_kw, impl, implUtf8, N, numfixed) \ + if ( wxLocaleIsUtf8 ) \ + _WX_VARARG_DO_CALL_UTF8(return_kw, impl, implUtf8, N, numfixed);\ + else \ + _WX_VARARG_DO_CALL_WCHAR(return_kw, impl, implUtf8, N, numfixed) + + #define _WX_VARARG_DO_CALL0(return_kw, impl, implUtf8, numfixed) \ + if ( wxLocaleIsUtf8 ) \ + _WX_VARARG_DO_CALL0_UTF8(return_kw, impl, implUtf8, numfixed); \ + else \ + _WX_VARARG_DO_CALL0_WCHAR(return_kw, impl, implUtf8, numfixed) + #endif // wxUSE_UTF8_LOCALE_ONLY or not +#else // wxUSE_UNICODE_WCHAR or ANSI + #define _WX_VARARG_DO_CALL _WX_VARARG_DO_CALL_WCHAR + #define _WX_VARARG_DO_CALL0 _WX_VARARG_DO_CALL0_WCHAR +#endif // wxUSE_UNICODE_UTF8 / wxUSE_UNICODE_WCHAR + + +// Macro to be used with _WX_VARARG_ITER in the implementation of +// WX_DEFINE_VARARG_FUNC (see its documentation for the meaning of arguments) +#define _WX_VARARG_DEFINE_FUNC(N, rettype, name, \ + impl, implUtf8, numfixed, fixed) \ + template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \ + rettype name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed), \ + _WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \ + { \ + _WX_VARARG_FORMAT_STRING(numfixed, fixed); \ + _WX_VARARG_DO_CALL(return, impl, implUtf8, N, numfixed); \ + } + +#define _WX_VARARG_DEFINE_FUNC_N0(rettype, name, \ + impl, implUtf8, numfixed, fixed) \ + inline rettype name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed)) \ + { \ + _WX_VARARG_DO_CALL0(return, impl, implUtf8, numfixed); \ + } + +// Macro to be used with _WX_VARARG_ITER in the implementation of +// WX_DEFINE_VARARG_FUNC_VOID (see its documentation for the meaning of +// arguments; rettype is ignored and is used only to satisfy _WX_VARARG_ITER's +// requirements). +#define _WX_VARARG_DEFINE_FUNC_VOID(N, rettype, name, \ + impl, implUtf8, numfixed, fixed) \ + template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \ + void name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed), \ + _WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \ + { \ + _WX_VARARG_FORMAT_STRING(numfixed, fixed); \ + _WX_VARARG_DO_CALL(wxEMPTY_PARAMETER_VALUE, \ + impl, implUtf8, N, numfixed); \ + } + +#define _WX_VARARG_DEFINE_FUNC_VOID_N0(name, impl, implUtf8, numfixed, fixed) \ + inline void name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed)) \ + { \ + _WX_VARARG_DO_CALL0(wxEMPTY_PARAMETER_VALUE, \ + impl, implUtf8, numfixed); \ + } + +// Macro to be used with _WX_VARARG_ITER in the implementation of +// WX_DEFINE_VARARG_FUNC_CTOR (see its documentation for the meaning of +// arguments; rettype is ignored and is used only to satisfy _WX_VARARG_ITER's +// requirements). +#define _WX_VARARG_DEFINE_FUNC_CTOR(N, rettype, name, \ + impl, implUtf8, numfixed, fixed) \ + template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \ + name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed), \ + _WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \ + { \ + _WX_VARARG_FORMAT_STRING(numfixed, fixed); \ + _WX_VARARG_DO_CALL(wxEMPTY_PARAMETER_VALUE, \ + impl, implUtf8, N, numfixed); \ + } + +#define _WX_VARARG_DEFINE_FUNC_CTOR_N0(name, impl, implUtf8, numfixed, fixed) \ + inline name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed)) \ + { \ + _WX_VARARG_DO_CALL0(wxEMPTY_PARAMETER_VALUE, \ + impl, implUtf8, numfixed); \ + } + +// Macro to be used with _WX_VARARG_ITER in the implementation of +// WX_DEFINE_VARARG_FUNC_NOP, i.e. empty stub for a disabled vararg function. +// The rettype and impl arguments are ignored. +#define _WX_VARARG_DEFINE_FUNC_NOP(N, rettype, name, \ + impl, implUtf8, numfixed, fixed) \ + template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \ + void name(_WX_VARARG_FIXED_UNUSED_EXPAND(numfixed, fixed), \ + _WX_VARARG_JOIN(N, _WX_VARARG_ARG_UNUSED)) \ + {} + +#define _WX_VARARG_DEFINE_FUNC_NOP_N0(name, numfixed, fixed) \ + inline void name(_WX_VARARG_FIXED_UNUSED_EXPAND(numfixed, fixed)) \ + {} + +wxGCC_WARNING_RESTORE(ctor-dtor-privacy) + +#endif // _WX_STRVARARG_H_ diff --git a/lib/wxWidgets/include/wx/sysopt.h b/lib/wxWidgets/include/wx/sysopt.h new file mode 100644 index 0000000..63474c0 --- /dev/null +++ b/lib/wxWidgets/include/wx/sysopt.h @@ -0,0 +1,74 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/sysopt.h +// Purpose: wxSystemOptions +// Author: Julian Smart +// Modified by: +// Created: 2001-07-10 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SYSOPT_H_ +#define _WX_SYSOPT_H_ + +#include "wx/object.h" + +// ---------------------------------------------------------------------------- +// Enables an application to influence the wxWidgets implementation +// ---------------------------------------------------------------------------- + +class +#if wxUSE_SYSTEM_OPTIONS +WXDLLIMPEXP_BASE +#endif +wxSystemOptions : public wxObject +{ +public: + wxSystemOptions() { } + + // User-customizable hints to wxWidgets or associated libraries + // These could also be used to influence GetSystem... calls, indeed + // to implement SetSystemColour/Font/Metric + +#if wxUSE_SYSTEM_OPTIONS + static void SetOption(const wxString& name, const wxString& value); + static void SetOption(const wxString& name, int value); +#endif // wxUSE_SYSTEM_OPTIONS + static wxString GetOption(const wxString& name); + static int GetOptionInt(const wxString& name); + static bool HasOption(const wxString& name); + + static bool IsFalse(const wxString& name) + { + return HasOption(name) && GetOptionInt(name) == 0; + } +}; + +#if !wxUSE_SYSTEM_OPTIONS + +// define inline stubs for accessors to make it possible to use wxSystemOptions +// in the library itself without checking for wxUSE_SYSTEM_OPTIONS all the time + +/* static */ inline +wxString wxSystemOptions::GetOption(const wxString& WXUNUSED(name)) +{ + return wxEmptyString; +} + +/* static */ inline +int wxSystemOptions::GetOptionInt(const wxString& WXUNUSED(name)) +{ + return 0; +} + +/* static */ inline +bool wxSystemOptions::HasOption(const wxString& WXUNUSED(name)) +{ + return false; +} + +#endif // !wxUSE_SYSTEM_OPTIONS + +#endif + // _WX_SYSOPT_H_ + diff --git a/lib/wxWidgets/include/wx/systhemectrl.h b/lib/wxWidgets/include/wx/systhemectrl.h new file mode 100644 index 0000000..5881b6c --- /dev/null +++ b/lib/wxWidgets/include/wx/systhemectrl.h @@ -0,0 +1,87 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/systhemectrl.h +// Purpose: Class to make controls appear in the systems theme +// Author: Tobias Taschner +// Created: 2014-08-14 +// Copyright: (c) 2014 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SYSTHEMECTRL_H +#define _WX_SYSTHEMECTRL_H + +#include "wx/defs.h" + +#if defined(__WXMSW__) && wxUSE_UXTHEME && !defined(__WXUNIVERSAL__) + #define wxHAS_SYSTEM_THEMED_CONTROL +#endif + +class WXDLLIMPEXP_FWD_CORE wxWindow; + +class WXDLLIMPEXP_CORE wxSystemThemedControlBase +{ +public: + wxSystemThemedControlBase() + { +#ifdef wxHAS_SYSTEM_THEMED_CONTROL + m_systemThemeDisabled = false; +#endif // wxHAS_SYSTEM_THEMED_CONTROL + } + + bool IsSystemThemeDisabled() const + { +#ifdef wxHAS_SYSTEM_THEMED_CONTROL + return m_systemThemeDisabled; +#else // !wxHAS_SYSTEM_THEMED_CONTROL + return false; +#endif // wxHAS_SYSTEM_THEMED_CONTROL/!wxHAS_SYSTEM_THEMED_CONTROL + } + + virtual ~wxSystemThemedControlBase() { } + +protected: + // This method is virtual and can be overridden, e.g. composite controls do + // it to enable the system theme for all of their parts. + virtual void DoEnableSystemTheme +#ifdef wxHAS_SYSTEM_THEMED_CONTROL + // Only __WXMSW__ has a non-trivial implementation currently. + (bool enable, wxWindow* window); +#else + (bool WXUNUSED(enable), wxWindow* WXUNUSED(window)) { } +#endif // wxHAS_SYSTEM_THEMED_CONTROL + +private: +#ifdef wxHAS_SYSTEM_THEMED_CONTROL + bool m_systemThemeDisabled; +#endif // wxHAS_SYSTEM_THEMED_CONTROL + + wxDECLARE_NO_COPY_CLASS(wxSystemThemedControlBase); +}; + +// This class used CRTP, i.e. it should be instantiated for the real base class +// and inherited from. +template <class C> +class wxSystemThemedControl : public C, + public wxSystemThemedControlBase +{ +public: + wxSystemThemedControl() { } + + void EnableSystemTheme(bool enable = true) + { + DoEnableSystemTheme(enable, this); + } + +protected: + void EnableSystemThemeByDefault() + { + // Check if the system theme hadn't been explicitly disabled before + // enabling it by default. + if ( !this->IsSystemThemeDisabled() ) + DoEnableSystemTheme(true, this); + } + + wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxSystemThemedControl, C); +}; + +#endif // _WX_SYSTHEMECTRL_H diff --git a/lib/wxWidgets/include/wx/tarstrm.h b/lib/wxWidgets/include/wx/tarstrm.h new file mode 100644 index 0000000..37a1ab3 --- /dev/null +++ b/lib/wxWidgets/include/wx/tarstrm.h @@ -0,0 +1,353 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/tarstrm.h +// Purpose: Streams for Tar files +// Author: Mike Wetherell +// Copyright: (c) 2004 Mike Wetherell +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WXTARSTREAM_H__ +#define _WX_WXTARSTREAM_H__ + +#include "wx/defs.h" + +#if wxUSE_TARSTREAM + +#include "wx/archive.h" +#include "wx/hashmap.h" + + +///////////////////////////////////////////////////////////////////////////// +// Constants + +// TypeFlag values +enum wxTarType +{ + wxTAR_REGTYPE = '0', // regular file + wxTAR_LNKTYPE = '1', // hard link + wxTAR_SYMTYPE = '2', // symbolic link + wxTAR_CHRTYPE = '3', // character special + wxTAR_BLKTYPE = '4', // block special + wxTAR_DIRTYPE = '5', // directory + wxTAR_FIFOTYPE = '6', // named pipe + wxTAR_CONTTYPE = '7' // contiguous file +}; + +// Archive Formats (use wxTAR_PAX, it's backward compatible) +enum wxTarFormat +{ + wxTAR_USTAR, // POSIX.1-1990 tar format + wxTAR_PAX // POSIX.1-2001 tar format +}; + + +///////////////////////////////////////////////////////////////////////////// +// wxTarNotifier + +class WXDLLIMPEXP_BASE wxTarNotifier +{ +public: + virtual ~wxTarNotifier() { } + + virtual void OnEntryUpdated(class wxTarEntry& entry) = 0; +}; + + +///////////////////////////////////////////////////////////////////////////// +// Tar Entry - hold the meta data for a file in the tar + +class WXDLLIMPEXP_BASE wxTarEntry : public wxArchiveEntry +{ +public: + wxTarEntry(const wxString& name = wxEmptyString, + const wxDateTime& dt = wxDateTime::Now(), + wxFileOffset size = wxInvalidOffset); + virtual ~wxTarEntry(); + + wxTarEntry(const wxTarEntry& entry); + wxTarEntry& operator=(const wxTarEntry& entry); + + // Get accessors + wxString GetName(wxPathFormat format = wxPATH_NATIVE) const wxOVERRIDE; + wxString GetInternalName() const wxOVERRIDE { return m_Name; } + wxPathFormat GetInternalFormat() const wxOVERRIDE { return wxPATH_UNIX; } + int GetMode() const; + int GetUserId() const { return m_UserId; } + int GetGroupId() const { return m_GroupId; } + wxFileOffset GetSize() const wxOVERRIDE { return m_Size; } + wxFileOffset GetOffset() const wxOVERRIDE { return m_Offset; } + wxDateTime GetDateTime() const wxOVERRIDE { return m_ModifyTime; } + wxDateTime GetAccessTime() const { return m_AccessTime; } + wxDateTime GetCreateTime() const { return m_CreateTime; } + int GetTypeFlag() const { return m_TypeFlag; } + wxString GetLinkName() const { return m_LinkName; } + wxString GetUserName() const { return m_UserName; } + wxString GetGroupName() const { return m_GroupName; } + int GetDevMajor() const { return m_DevMajor; } + int GetDevMinor() const { return m_DevMinor; } + + // is accessors + bool IsDir() const wxOVERRIDE; + bool IsReadOnly() const wxOVERRIDE { return !(m_Mode & 0222); } + + // set accessors + void SetName(const wxString& name, wxPathFormat format = wxPATH_NATIVE) wxOVERRIDE; + void SetUserId(int id) { m_UserId = id; } + void SetGroupId(int id) { m_GroupId = id; } + void SetMode(int mode); + void SetSize(wxFileOffset size) wxOVERRIDE { m_Size = size; } + void SetDateTime(const wxDateTime& dt) wxOVERRIDE { m_ModifyTime = dt; } + void SetAccessTime(const wxDateTime& dt) { m_AccessTime = dt; } + void SetCreateTime(const wxDateTime& dt) { m_CreateTime = dt; } + void SetTypeFlag(int type) { m_TypeFlag = type; } + void SetLinkName(const wxString& link) { m_LinkName = link; } + void SetUserName(const wxString& user) { m_UserName = user; } + void SetGroupName(const wxString& group) { m_GroupName = group; } + void SetDevMajor(int dev) { m_DevMajor = dev; } + void SetDevMinor(int dev) { m_DevMinor = dev; } + + // set is accessors + void SetIsDir(bool isDir = true) wxOVERRIDE; + void SetIsReadOnly(bool isReadOnly = true) wxOVERRIDE; + + static wxString GetInternalName(const wxString& name, + wxPathFormat format = wxPATH_NATIVE, + bool *pIsDir = NULL); + + wxTarEntry *Clone() const { return new wxTarEntry(*this); } + + void SetNotifier(wxTarNotifier& WXUNUSED(notifier)) { } + +private: + void SetOffset(wxFileOffset offset) wxOVERRIDE { m_Offset = offset; } + + virtual wxArchiveEntry* DoClone() const wxOVERRIDE { return Clone(); } + + wxString m_Name; + int m_Mode; + bool m_IsModeSet; + int m_UserId; + int m_GroupId; + wxFileOffset m_Size; + wxFileOffset m_Offset; + wxDateTime m_ModifyTime; + wxDateTime m_AccessTime; + wxDateTime m_CreateTime; + int m_TypeFlag; + wxString m_LinkName; + wxString m_UserName; + wxString m_GroupName; + int m_DevMajor; + int m_DevMinor; + + friend class wxTarInputStream; + + wxDECLARE_DYNAMIC_CLASS(wxTarEntry); +}; + + +///////////////////////////////////////////////////////////////////////////// +// wxTarInputStream + +WX_DECLARE_STRING_HASH_MAP(wxString, wxTarHeaderRecords); + +class WXDLLIMPEXP_BASE wxTarInputStream : public wxArchiveInputStream +{ +public: + typedef wxTarEntry entry_type; + + wxTarInputStream(wxInputStream& stream, wxMBConv& conv = wxConvLocal); + wxTarInputStream(wxInputStream *stream, wxMBConv& conv = wxConvLocal); + virtual ~wxTarInputStream(); + + bool OpenEntry(wxTarEntry& entry); + bool CloseEntry() wxOVERRIDE; + + wxTarEntry *GetNextEntry(); + + wxFileOffset GetLength() const wxOVERRIDE { return m_size; } + bool IsSeekable() const wxOVERRIDE { return m_parent_i_stream->IsSeekable(); } + +protected: + size_t OnSysRead(void *buffer, size_t size) wxOVERRIDE; + wxFileOffset OnSysTell() const wxOVERRIDE { return m_pos; } + wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode) wxOVERRIDE; + +private: + void Init(); + + wxArchiveEntry *DoGetNextEntry() wxOVERRIDE { return GetNextEntry(); } + bool OpenEntry(wxArchiveEntry& entry) wxOVERRIDE; + bool IsOpened() const { return m_pos != wxInvalidOffset; } + + wxStreamError ReadHeaders(); + bool ReadExtendedHeader(wxTarHeaderRecords*& recs); + + wxString GetExtendedHeader(const wxString& key) const; + wxString GetHeaderPath() const; + wxFileOffset GetHeaderNumber(int id) const; + wxString GetHeaderString(int id) const; + wxDateTime GetHeaderDate(const wxString& key) const; + + wxFileOffset m_pos; // position within the current entry + wxFileOffset m_offset; // offset to the start of the entry's data + wxFileOffset m_size; // size of the current entry's data + + int m_sumType; + int m_tarType; + class wxTarHeaderBlock *m_hdr; + wxTarHeaderRecords *m_HeaderRecs; + wxTarHeaderRecords *m_GlobalHeaderRecs; + + wxDECLARE_NO_COPY_CLASS(wxTarInputStream); +}; + + +///////////////////////////////////////////////////////////////////////////// +// wxTarOutputStream + +class WXDLLIMPEXP_BASE wxTarOutputStream : public wxArchiveOutputStream +{ +public: + wxTarOutputStream(wxOutputStream& stream, + wxTarFormat format = wxTAR_PAX, + wxMBConv& conv = wxConvLocal); + wxTarOutputStream(wxOutputStream *stream, + wxTarFormat format = wxTAR_PAX, + wxMBConv& conv = wxConvLocal); + virtual ~wxTarOutputStream(); + + bool PutNextEntry(wxTarEntry *entry); + + bool PutNextEntry(const wxString& name, + const wxDateTime& dt = wxDateTime::Now(), + wxFileOffset size = wxInvalidOffset) wxOVERRIDE; + + bool PutNextDirEntry(const wxString& name, + const wxDateTime& dt = wxDateTime::Now()) wxOVERRIDE; + + bool CopyEntry(wxTarEntry *entry, wxTarInputStream& inputStream); + bool CopyArchiveMetaData(wxTarInputStream& WXUNUSED(s)) { return true; } + + void Sync() wxOVERRIDE; + bool CloseEntry() wxOVERRIDE; + bool Close() wxOVERRIDE; + + bool IsSeekable() const wxOVERRIDE { return m_parent_o_stream->IsSeekable(); } + + void SetBlockingFactor(int factor) { m_BlockingFactor = factor; } + int GetBlockingFactor() const { return m_BlockingFactor; } + +protected: + size_t OnSysWrite(const void *buffer, size_t size) wxOVERRIDE; + wxFileOffset OnSysTell() const wxOVERRIDE { return m_pos; } + wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE; + +private: + void Init(wxTarFormat format); + + bool PutNextEntry(wxArchiveEntry *entry) wxOVERRIDE; + bool CopyEntry(wxArchiveEntry *entry, wxArchiveInputStream& stream) wxOVERRIDE; + bool CopyArchiveMetaData(wxArchiveInputStream& WXUNUSED(s)) wxOVERRIDE { return true; } + bool IsOpened() const { return m_pos != wxInvalidOffset; } + + bool WriteHeaders(wxTarEntry& entry); + bool ModifyHeader(); + wxString PaxHeaderPath(const wxString& format, const wxString& path); + + void SetExtendedHeader(const wxString& key, const wxString& value); + void SetHeaderPath(const wxString& name); + bool SetHeaderNumber(int id, wxFileOffset n); + void SetHeaderString(int id, const wxString& str); + void SetHeaderDate(const wxString& key, const wxDateTime& datetime); + + wxFileOffset m_pos; // position within the current entry + wxFileOffset m_maxpos; // max pos written + wxFileOffset m_size; // expected entry size + + wxFileOffset m_headpos; // offset within the file to the entry's header + wxFileOffset m_datapos; // offset within the file to the entry's data + + wxFileOffset m_tarstart;// offset within the file to the tar + wxFileOffset m_tarsize; // size of tar so far + + bool m_pax; + int m_BlockingFactor; + wxUint32 m_chksum; + bool m_large; + class wxTarHeaderBlock *m_hdr; + class wxTarHeaderBlock *m_hdr2; + char *m_extendedHdr; + size_t m_extendedSize; + wxString m_badfit; + bool m_endrecWritten; + + wxDECLARE_NO_COPY_CLASS(wxTarOutputStream); +}; + + +///////////////////////////////////////////////////////////////////////////// +// Iterators + +#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR +typedef wxArchiveIterator<wxTarInputStream> wxTarIter; +typedef wxArchiveIterator<wxTarInputStream, + std::pair<wxString, wxTarEntry*> > wxTarPairIter; +#endif + + +///////////////////////////////////////////////////////////////////////////// +// wxTarClassFactory + +class WXDLLIMPEXP_BASE wxTarClassFactory : public wxArchiveClassFactory +{ +public: + typedef wxTarEntry entry_type; + typedef wxTarInputStream instream_type; + typedef wxTarOutputStream outstream_type; + typedef wxTarNotifier notifier_type; +#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR + typedef wxTarIter iter_type; + typedef wxTarPairIter pairiter_type; +#endif + + wxTarClassFactory(); + + wxTarEntry *NewEntry() const + { return new wxTarEntry; } + wxTarInputStream *NewStream(wxInputStream& stream) const + { return new wxTarInputStream(stream, GetConv()); } + wxTarOutputStream *NewStream(wxOutputStream& stream) const + { return new wxTarOutputStream(stream, wxTAR_PAX, GetConv()); } + wxTarInputStream *NewStream(wxInputStream *stream) const + { return new wxTarInputStream(stream, GetConv()); } + wxTarOutputStream *NewStream(wxOutputStream *stream) const + { return new wxTarOutputStream(stream, wxTAR_PAX, GetConv()); } + + wxString GetInternalName(const wxString& name, + wxPathFormat format = wxPATH_NATIVE) const wxOVERRIDE + { return wxTarEntry::GetInternalName(name, format); } + + const wxChar * const *GetProtocols(wxStreamProtocolType type + = wxSTREAM_PROTOCOL) const wxOVERRIDE; + +protected: + wxArchiveEntry *DoNewEntry() const wxOVERRIDE + { return NewEntry(); } + wxArchiveInputStream *DoNewStream(wxInputStream& stream) const wxOVERRIDE + { return NewStream(stream); } + wxArchiveOutputStream *DoNewStream(wxOutputStream& stream) const wxOVERRIDE + { return NewStream(stream); } + wxArchiveInputStream *DoNewStream(wxInputStream *stream) const wxOVERRIDE + { return NewStream(stream); } + wxArchiveOutputStream *DoNewStream(wxOutputStream *stream) const wxOVERRIDE + { return NewStream(stream); } + +private: + wxDECLARE_DYNAMIC_CLASS(wxTarClassFactory); +}; + + +#endif // wxUSE_TARSTREAM + +#endif // _WX_WXTARSTREAM_H__ diff --git a/lib/wxWidgets/include/wx/taskbar.h b/lib/wxWidgets/include/wx/taskbar.h new file mode 100644 index 0000000..dad5cfd --- /dev/null +++ b/lib/wxWidgets/include/wx/taskbar.h @@ -0,0 +1,162 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/taskbar.h +// Purpose: wxTaskBarIcon base header and class +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TASKBAR_H_BASE_ +#define _WX_TASKBAR_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_TASKBARICON + +#include "wx/event.h" + +class WXDLLIMPEXP_FWD_CORE wxTaskBarIconEvent; +class wxBitmapBundle; + +// ---------------------------------------------------------------------------- + +// type of taskbar item to create. Only applicable in wxOSX_COCOA +enum wxTaskBarIconType +{ + wxTBI_DOCK, + wxTBI_CUSTOM_STATUSITEM, +#if defined(wxOSX_USE_COCOA) && wxOSX_USE_COCOA + wxTBI_DEFAULT_TYPE = wxTBI_CUSTOM_STATUSITEM +#else + wxTBI_DEFAULT_TYPE = wxTBI_DOCK +#endif +}; + + +// ---------------------------------------------------------------------------- +// wxTaskBarIconBase: define wxTaskBarIcon interface +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTaskBarIconBase : public wxEvtHandler +{ +public: + wxTaskBarIconBase() { } + +#if defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) || defined(__WXQT__) + static bool IsAvailable(); +#else + static bool IsAvailable() { return true; } +#endif + + // Operations: + virtual bool SetIcon(const wxBitmapBundle& icon, + const wxString& tooltip = wxEmptyString) = 0; + virtual bool RemoveIcon() = 0; + virtual bool PopupMenu(wxMenu *menu) = 0; + + // delayed destruction (similarly to wxWindow::Destroy()) + void Destroy(); + +protected: + // Note: only one of the following functions should be overridden, if both + // of them are, GetPopupMenu() has the priority, i.e. CreatePopupMenu() + // won't be called if GetPopupMenu() returns a non-null pointer. + + // creates menu to be displayed when user clicks on the icon + virtual wxMenu *CreatePopupMenu() { return NULL; } + + // same as CreatePopupMenu but the returned menu won't be destroyed + virtual wxMenu *GetPopupMenu() { return NULL; } + +private: + // default events handling, calls CreatePopupMenu: + void OnRightButtonDown(wxTaskBarIconEvent& event); + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxTaskBarIconBase); +}; + + +// ---------------------------------------------------------------------------- +// now include the actual class declaration +// ---------------------------------------------------------------------------- + +#if defined(__WXMSW__) + #include "wx/msw/taskbar.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/taskbar.h" +#elif defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) + #include "wx/unix/taskbarx11.h" +#elif defined (__WXMAC__) + #include "wx/osx/taskbarosx.h" +#elif defined (__WXQT__) + #include "wx/qt/taskbar.h" +#endif + +// ---------------------------------------------------------------------------- +// wxTaskBarIcon events +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTaskBarIconEvent : public wxEvent +{ +public: + wxTaskBarIconEvent(wxEventType evtType, wxTaskBarIcon *tbIcon) + : wxEvent(wxID_ANY, evtType) + { + SetEventObject(tbIcon); + } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxTaskBarIconEvent(*this); } + +private: + wxDECLARE_NO_ASSIGN_DEF_COPY(wxTaskBarIconEvent); +}; + +typedef void (wxEvtHandler::*wxTaskBarIconEventFunction)(wxTaskBarIconEvent&); + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TASKBAR_MOVE, wxTaskBarIconEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TASKBAR_LEFT_DOWN, wxTaskBarIconEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TASKBAR_LEFT_UP, wxTaskBarIconEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TASKBAR_RIGHT_DOWN, wxTaskBarIconEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TASKBAR_RIGHT_UP, wxTaskBarIconEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TASKBAR_LEFT_DCLICK, wxTaskBarIconEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TASKBAR_RIGHT_DCLICK, wxTaskBarIconEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TASKBAR_BALLOON_TIMEOUT, wxTaskBarIconEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TASKBAR_BALLOON_CLICK, wxTaskBarIconEvent ); + +#define wxTaskBarIconEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxTaskBarIconEventFunction, func) + +#define wx__DECLARE_TASKBAREVT(evt, fn) \ + wx__DECLARE_EVT0(wxEVT_TASKBAR_ ## evt, wxTaskBarIconEventHandler(fn)) + +#define EVT_TASKBAR_MOVE(fn) wx__DECLARE_TASKBAREVT(MOVE, fn) +#define EVT_TASKBAR_LEFT_DOWN(fn) wx__DECLARE_TASKBAREVT(LEFT_DOWN, fn) +#define EVT_TASKBAR_LEFT_UP(fn) wx__DECLARE_TASKBAREVT(LEFT_UP, fn) +#define EVT_TASKBAR_RIGHT_DOWN(fn) wx__DECLARE_TASKBAREVT(RIGHT_DOWN, fn) +#define EVT_TASKBAR_RIGHT_UP(fn) wx__DECLARE_TASKBAREVT(RIGHT_UP, fn) +#define EVT_TASKBAR_LEFT_DCLICK(fn) wx__DECLARE_TASKBAREVT(LEFT_DCLICK, fn) +#define EVT_TASKBAR_RIGHT_DCLICK(fn) wx__DECLARE_TASKBAREVT(RIGHT_DCLICK, fn) + +// taskbar menu is shown on right button press under all platforms except MSW +// where it's shown on right button release, using this event type and macro +// allows to write code which works correctly on all platforms +#ifdef __WXMSW__ + #define wxEVT_TASKBAR_CLICK wxEVT_TASKBAR_RIGHT_UP +#else + #define wxEVT_TASKBAR_CLICK wxEVT_TASKBAR_RIGHT_DOWN +#endif +#define EVT_TASKBAR_CLICK(fn) wx__DECLARE_TASKBAREVT(CLICK, fn) + +// these events are currently generated only under wxMSW and only after (MSW- +// specific) ShowBalloon() had been called, don't use them in portable code +#define EVT_TASKBAR_BALLOON_TIMEOUT(fn) \ + wx__DECLARE_TASKBAREVT(BALLOON_TIMEOUT, fn) +#define EVT_TASKBAR_BALLOON_CLICK(fn) \ + wx__DECLARE_TASKBAREVT(BALLOON_CLICK, fn) + +#endif // wxUSE_TASKBARICON + +#endif // _WX_TASKBAR_H_BASE_ diff --git a/lib/wxWidgets/include/wx/taskbarbutton.h b/lib/wxWidgets/include/wx/taskbarbutton.h new file mode 100644 index 0000000..e62db4b --- /dev/null +++ b/lib/wxWidgets/include/wx/taskbarbutton.h @@ -0,0 +1,253 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: include/taskbarbutton.h +// Purpose: Defines wxTaskBarButton class for manipulating buttons on the +// windows taskbar. +// Author: Chaobin Zhang <zhchbin@gmail.com> +// Created: 2014-04-30 +// Copyright: (c) 2014 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TASKBARBUTTON_H_ +#define _WX_TASKBARBUTTON_H_ + +#include "wx/defs.h" + +#if wxUSE_TASKBARBUTTON + +#include "wx/icon.h" +#include "wx/string.h" + +class WXDLLIMPEXP_FWD_CORE wxTaskBarButton; +class WXDLLIMPEXP_FWD_CORE wxTaskBarJumpListCategory; +class WXDLLIMPEXP_FWD_CORE wxTaskBarJumpList; +class WXDLLIMPEXP_FWD_CORE wxTaskBarJumpListImpl; + +// ---------------------------------------------------------------------------- +// wxTaskBarButton: define wxTaskBarButton interface. +// ---------------------------------------------------------------------------- + +/** + State of the task bar button. +*/ +enum wxTaskBarButtonState +{ + wxTASKBAR_BUTTON_NO_PROGRESS = 0, + wxTASKBAR_BUTTON_INDETERMINATE = 1, + wxTASKBAR_BUTTON_NORMAL = 2, + wxTASKBAR_BUTTON_ERROR = 4, + wxTASKBAR_BUTTON_PAUSED = 8 +}; + +class WXDLLIMPEXP_CORE wxThumbBarButton : public wxObject +{ +public: + wxThumbBarButton() : m_taskBarButtonParent(NULL) + { } + + wxThumbBarButton(int id, + const wxIcon& icon, + const wxString& tooltip = wxString(), + bool enable = true, + bool dismissOnClick = false, + bool hasBackground = true, + bool shown = true, + bool interactive = true); + + bool Create(int id, + const wxIcon& icon, + const wxString& tooltip = wxString(), + bool enable = true, + bool dismissOnClick = false, + bool hasBackground = true, + bool shown = true, + bool interactive = true); + int GetID() const { return m_id; } + const wxIcon& GetIcon() const { return m_icon; } + const wxString& GetTooltip() const { return m_tooltip; } + + bool IsEnable() const { return m_enable; } + void Enable(bool enable = true); + void Disable() { Enable(false); } + + bool IsDismissOnClick() const { return m_dismissOnClick; } + void EnableDismissOnClick(bool enable = true); + void DisableDimissOnClick() { EnableDismissOnClick(false); } + + bool HasBackground() const { return m_hasBackground; } + void SetHasBackground(bool has = true); + + bool IsShown() const { return m_shown; } + void Show(bool shown = true); + void Hide() { Show(false); } + + bool IsInteractive() const { return m_interactive; } + void SetInteractive(bool interactive = true); + + void SetParent(wxTaskBarButton *parent) { m_taskBarButtonParent = parent; } + wxTaskBarButton* GetParent() const { return m_taskBarButtonParent; } + +private: + bool UpdateParentTaskBarButton(); + + int m_id; + wxIcon m_icon; + wxString m_tooltip; + bool m_enable; + bool m_dismissOnClick; + bool m_hasBackground; + bool m_shown; + bool m_interactive; + wxTaskBarButton *m_taskBarButtonParent; + + wxDECLARE_DYNAMIC_CLASS(wxThumbBarButton); +}; + +class WXDLLIMPEXP_CORE wxTaskBarButton +{ +public: + // Factory function, may return NULL if task bar buttons are not supported + // by the current system. + static wxTaskBarButton* New(wxWindow* parent); + + virtual ~wxTaskBarButton() { } + + // Operations: + virtual void SetProgressRange(int range) = 0; + virtual void SetProgressValue(int value) = 0; + virtual void PulseProgress() = 0; + virtual void Show(bool show = true) = 0; + virtual void Hide() = 0; + virtual void SetThumbnailTooltip(const wxString& tooltip) = 0; + virtual void SetProgressState(wxTaskBarButtonState state) = 0; + virtual void SetOverlayIcon(const wxIcon& icon, + const wxString& description = wxString()) = 0; + virtual void SetThumbnailClip(const wxRect& rect) = 0; + virtual void SetThumbnailContents(const wxWindow *child) = 0; + virtual bool InsertThumbBarButton(size_t pos, wxThumbBarButton *button) = 0; + virtual bool AppendThumbBarButton(wxThumbBarButton *button) = 0; + virtual bool AppendSeparatorInThumbBar() = 0; + virtual wxThumbBarButton* RemoveThumbBarButton(wxThumbBarButton *button) = 0; + virtual wxThumbBarButton* RemoveThumbBarButton(int id) = 0; + virtual void Realize() = 0; + +protected: + wxTaskBarButton() { } + +private: + wxDECLARE_NO_COPY_CLASS(wxTaskBarButton); +}; + +enum wxTaskBarJumpListItemType +{ + wxTASKBAR_JUMP_LIST_SEPARATOR, + wxTASKBAR_JUMP_LIST_TASK, + wxTASKBAR_JUMP_LIST_DESTINATION +}; + +class WXDLLIMPEXP_CORE wxTaskBarJumpListItem +{ +public: + wxTaskBarJumpListItem(wxTaskBarJumpListCategory *parentCategory = NULL, + wxTaskBarJumpListItemType type = wxTASKBAR_JUMP_LIST_SEPARATOR, + const wxString& title = wxEmptyString, + const wxString& filePath = wxEmptyString, + const wxString& arguments = wxEmptyString, + const wxString& tooltip = wxEmptyString, + const wxString& iconPath = wxEmptyString, + int iconIndex = 0); + + wxTaskBarJumpListItemType GetType() const; + void SetType(wxTaskBarJumpListItemType type); + const wxString& GetTitle() const; + void SetTitle(const wxString& title); + const wxString& GetFilePath() const; + void SetFilePath(const wxString& filePath); + const wxString& GetArguments() const; + void SetArguments(const wxString& arguments); + const wxString& GetTooltip() const; + void SetTooltip(const wxString& tooltip); + const wxString& GetIconPath() const; + void SetIconPath(const wxString& iconPath); + int GetIconIndex() const; + void SetIconIndex(int iconIndex); + wxTaskBarJumpListCategory* GetCategory() const; + void SetCategory(wxTaskBarJumpListCategory *category); + +private: + wxTaskBarJumpListCategory *m_parentCategory; + wxTaskBarJumpListItemType m_type; + wxString m_title; + wxString m_filePath; + wxString m_arguments; + wxString m_tooltip; + wxString m_iconPath; + int m_iconIndex; + + wxDECLARE_NO_COPY_CLASS(wxTaskBarJumpListItem); +}; + +typedef wxVector<wxTaskBarJumpListItem*> wxTaskBarJumpListItems; + +class WXDLLIMPEXP_CORE wxTaskBarJumpListCategory +{ +public: + wxTaskBarJumpListCategory(wxTaskBarJumpList *parent = NULL, + const wxString& title = wxEmptyString); + virtual ~wxTaskBarJumpListCategory(); + + wxTaskBarJumpListItem* Append(wxTaskBarJumpListItem *item); + void Delete(wxTaskBarJumpListItem *item); + wxTaskBarJumpListItem* Remove(wxTaskBarJumpListItem *item); + wxTaskBarJumpListItem* FindItemByPosition(size_t pos) const; + wxTaskBarJumpListItem* Insert(size_t pos, wxTaskBarJumpListItem *item); + wxTaskBarJumpListItem* Prepend(wxTaskBarJumpListItem *item); + void SetTitle(const wxString& title); + const wxString& GetTitle() const; + const wxTaskBarJumpListItems& GetItems() const; + +private: + friend class wxTaskBarJumpListItem; + + void Update(); + + wxTaskBarJumpList *m_parent; + wxTaskBarJumpListItems m_items; + wxString m_title; + + wxDECLARE_NO_COPY_CLASS(wxTaskBarJumpListCategory); +}; + +typedef wxVector<wxTaskBarJumpListCategory*> wxTaskBarJumpListCategories; + +class WXDLLIMPEXP_CORE wxTaskBarJumpList +{ +public: + wxTaskBarJumpList(const wxString& appID = wxEmptyString); + virtual ~wxTaskBarJumpList(); + void ShowRecentCategory(bool shown = true); + void HideRecentCategory(); + void ShowFrequentCategory(bool shown = true); + void HideFrequentCategory(); + + wxTaskBarJumpListCategory& GetTasks() const; + const wxTaskBarJumpListCategory& GetFrequentCategory() const; + const wxTaskBarJumpListCategory& GetRecentCategory() const; + const wxTaskBarJumpListCategories& GetCustomCategories() const; + + void AddCustomCategory(wxTaskBarJumpListCategory* category); + wxTaskBarJumpListCategory* RemoveCustomCategory(const wxString& title); + void DeleteCustomCategory(const wxString& title); + +private: + friend class wxTaskBarJumpListCategory; + + void Update(); + wxTaskBarJumpListImpl *m_jumpListImpl; + + wxDECLARE_NO_COPY_CLASS(wxTaskBarJumpList); +}; + +#endif // wxUSE_TASKBARBUTTON + +#endif // _WX_TASKBARBUTTON_H_ diff --git a/lib/wxWidgets/include/wx/tbarbase.h b/lib/wxWidgets/include/wx/tbarbase.h new file mode 100644 index 0000000..a379ce0 --- /dev/null +++ b/lib/wxWidgets/include/wx/tbarbase.h @@ -0,0 +1,734 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/tbarbase.h +// Purpose: Base class for toolbar classes +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TBARBASE_H_ +#define _WX_TBARBASE_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_TOOLBAR + +#include "wx/bitmap.h" +#include "wx/bmpbndl.h" +#include "wx/list.h" +#include "wx/control.h" + +class WXDLLIMPEXP_FWD_CORE wxToolBarBase; +class WXDLLIMPEXP_FWD_CORE wxToolBarToolBase; +class WXDLLIMPEXP_FWD_CORE wxImage; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +extern WXDLLIMPEXP_DATA_CORE(const char) wxToolBarNameStr[]; +extern WXDLLIMPEXP_DATA_CORE(const wxSize) wxDefaultSize; +extern WXDLLIMPEXP_DATA_CORE(const wxPoint) wxDefaultPosition; + +enum wxToolBarToolStyle +{ + wxTOOL_STYLE_BUTTON = 1, + wxTOOL_STYLE_SEPARATOR = 2, + wxTOOL_STYLE_CONTROL +}; + +// ---------------------------------------------------------------------------- +// wxToolBarTool is a toolbar element. +// +// It has a unique id (except for the separators which always have id wxID_ANY), the +// style (telling whether it is a normal button, separator or a control), the +// state (toggled or not, enabled or not) and short and long help strings. The +// default implementations use the short help string for the tooltip text which +// is popped up when the mouse pointer enters the tool and the long help string +// for the applications status bar. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxToolBarToolBase : public wxObject +{ +public: + // ctors & dtor + // ------------ + + // generic ctor for any kind of tool + wxToolBarToolBase(wxToolBarBase *tbar = NULL, + int toolid = wxID_SEPARATOR, + const wxString& label = wxEmptyString, + const wxBitmapBundle& bmpNormal = wxBitmapBundle(), + const wxBitmapBundle& bmpDisabled = wxBitmapBundle(), + wxItemKind kind = wxITEM_NORMAL, + wxObject *clientData = NULL, + const wxString& shortHelpString = wxEmptyString, + const wxString& longHelpString = wxEmptyString) + : m_label(label), + m_shortHelpString(shortHelpString), + m_longHelpString(longHelpString) + { + Init + ( + tbar, + toolid == wxID_SEPARATOR ? wxTOOL_STYLE_SEPARATOR + : wxTOOL_STYLE_BUTTON, + toolid == wxID_ANY ? wxWindow::NewControlId() + : toolid, + kind + ); + + m_clientData = clientData; + + m_bmpNormal = bmpNormal; + m_bmpDisabled = bmpDisabled; + } + + // ctor for controls only + wxToolBarToolBase(wxToolBarBase *tbar, + wxControl *control, + const wxString& label) + : m_label(label) + { + Init(tbar, wxTOOL_STYLE_CONTROL, control->GetId(), wxITEM_MAX); + + m_control = control; + } + + virtual ~wxToolBarToolBase(); + + // accessors + // --------- + + // general + int GetId() const { return m_id; } + + wxControl *GetControl() const + { + wxASSERT_MSG( IsControl(), wxT("this toolbar tool is not a control") ); + + return m_control; + } + + wxToolBarBase *GetToolBar() const { return m_tbar; } + + // style/kind + bool IsStretchable() const { return m_stretchable; } + bool IsButton() const { return m_toolStyle == wxTOOL_STYLE_BUTTON; } + bool IsControl() const { return m_toolStyle == wxTOOL_STYLE_CONTROL; } + bool IsSeparator() const { return m_toolStyle == wxTOOL_STYLE_SEPARATOR; } + bool IsStretchableSpace() const { return IsSeparator() && IsStretchable(); } + int GetStyle() const { return m_toolStyle; } + wxItemKind GetKind() const + { + wxASSERT_MSG( IsButton(), wxT("only makes sense for buttons") ); + + return m_kind; + } + + void MakeStretchable() + { + wxASSERT_MSG( IsSeparator(), "only separators can be stretchable" ); + + m_stretchable = true; + } + + // state + bool IsEnabled() const { return m_enabled; } + bool IsToggled() const { return m_toggled; } + bool CanBeToggled() const + { return m_kind == wxITEM_CHECK || m_kind == wxITEM_RADIO; } + + // attributes + wxBitmapBundle GetNormalBitmapBundle() const { return m_bmpNormal; } + wxBitmapBundle GetDisabledBitmapBundle() const { return m_bmpDisabled; } + + wxBitmap GetNormalBitmap(const wxSize& size = wxDefaultSize) const + { return m_bmpNormal.GetBitmap(size); } + wxBitmap GetDisabledBitmap(const wxSize& size = wxDefaultSize) const + { return m_bmpDisabled.GetBitmap(size); } + + wxBitmap GetBitmap(const wxSize& size = wxDefaultSize) const + { return IsEnabled() ? GetNormalBitmap(size) : GetDisabledBitmap(size); } + + const wxString& GetLabel() const { return m_label; } + + const wxString& GetShortHelp() const { return m_shortHelpString; } + const wxString& GetLongHelp() const { return m_longHelpString; } + + wxObject *GetClientData() const + { + if ( m_toolStyle == wxTOOL_STYLE_CONTROL ) + { + return (wxObject*)m_control->GetClientData(); + } + else + { + return m_clientData; + } + } + + // modifiers: return true if the state really changed + virtual bool Enable(bool enable); + virtual bool Toggle(bool toggle); + virtual bool SetToggle(bool toggle); + virtual bool SetShortHelp(const wxString& help); + virtual bool SetLongHelp(const wxString& help); + + void Toggle() { Toggle(!IsToggled()); } + + void SetNormalBitmap(const wxBitmapBundle& bmp) { m_bmpNormal = bmp; } + void SetDisabledBitmap(const wxBitmapBundle& bmp) { m_bmpDisabled = bmp; } + + virtual void SetLabel(const wxString& label) { m_label = label; } + + void SetClientData(wxObject *clientData) + { + if ( m_toolStyle == wxTOOL_STYLE_CONTROL ) + { + m_control->SetClientData(clientData); + } + else + { + m_clientData = clientData; + } + } + + // add tool to/remove it from a toolbar + virtual void Detach() { m_tbar = NULL; } + virtual void Attach(wxToolBarBase *tbar) { m_tbar = tbar; } + +#if wxUSE_MENUS + // these methods are only for tools of wxITEM_DROPDOWN kind (but even such + // tools can have a NULL associated menu) + virtual void SetDropdownMenu(wxMenu *menu); + wxMenu *GetDropdownMenu() const { return m_dropdownMenu; } +#endif + +protected: + // common part of all ctors + void Init(wxToolBarBase *tbar, + wxToolBarToolStyle style, + int toolid, + wxItemKind kind) + { + m_tbar = tbar; + m_toolStyle = style; + m_id = toolid; + m_kind = kind; + + m_clientData = NULL; + + m_stretchable = false; + m_toggled = false; + m_enabled = true; + +#if wxUSE_MENUS + m_dropdownMenu = NULL; +#endif + + } + + wxToolBarBase *m_tbar; // the toolbar to which we belong (may be NULL) + + // tool parameters + wxToolBarToolStyle m_toolStyle; + wxWindowIDRef m_id; // the tool id, wxID_SEPARATOR for separator + wxItemKind m_kind; // for normal buttons may be wxITEM_NORMAL/CHECK/RADIO + + // as controls have their own client data, no need to waste memory + union + { + wxObject *m_clientData; + wxControl *m_control; + }; + + // true if this tool is stretchable: currently is only value for separators + bool m_stretchable; + + // tool state + bool m_toggled; + bool m_enabled; + + // normal and disabled bitmaps for the tool, both can be invalid + wxBitmapBundle m_bmpNormal; + wxBitmapBundle m_bmpDisabled; + + // the button label + wxString m_label; + + // short and long help strings + wxString m_shortHelpString; + wxString m_longHelpString; + +#if wxUSE_MENUS + wxMenu *m_dropdownMenu; +#endif + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxToolBarToolBase); +}; + +// a list of toolbar tools +WX_DECLARE_EXPORTED_LIST(wxToolBarToolBase, wxToolBarToolsList); + +// ---------------------------------------------------------------------------- +// the base class for all toolbars +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxToolBarBase : public wxControl +{ +public: + wxToolBarBase(); + virtual ~wxToolBarBase(); + + // toolbar construction + // -------------------- + + // the full AddTool() function + // + // If bmpDisabled is an empty bundle, a shadowed version of the normal bitmap + // is created and used as the disabled image. + wxToolBarToolBase *AddTool(int toolid, + const wxString& label, + const wxBitmapBundle& bitmap, + const wxBitmapBundle& bmpDisabled, + wxItemKind kind = wxITEM_NORMAL, + const wxString& shortHelp = wxEmptyString, + const wxString& longHelp = wxEmptyString, + wxObject *clientData = NULL) + { + return DoAddTool(toolid, label, bitmap, bmpDisabled, kind, + shortHelp, longHelp, clientData); + } + + // the most common AddTool() version + wxToolBarToolBase *AddTool(int toolid, + const wxString& label, + const wxBitmapBundle& bitmap, + const wxString& shortHelp = wxEmptyString, + wxItemKind kind = wxITEM_NORMAL) + { + return AddTool(toolid, label, bitmap, wxBitmapBundle(), kind, shortHelp); + } + + // add a check tool, i.e. a tool which can be toggled + wxToolBarToolBase *AddCheckTool(int toolid, + const wxString& label, + const wxBitmapBundle& bitmap, + const wxBitmapBundle& bmpDisabled = wxBitmapBundle(), + const wxString& shortHelp = wxEmptyString, + const wxString& longHelp = wxEmptyString, + wxObject *clientData = NULL) + { + return AddTool(toolid, label, bitmap, bmpDisabled, wxITEM_CHECK, + shortHelp, longHelp, clientData); + } + + // add a radio tool, i.e. a tool which can be toggled and releases any + // other toggled radio tools in the same group when it happens + wxToolBarToolBase *AddRadioTool(int toolid, + const wxString& label, + const wxBitmapBundle& bitmap, + const wxBitmapBundle& bmpDisabled = wxBitmapBundle(), + const wxString& shortHelp = wxEmptyString, + const wxString& longHelp = wxEmptyString, + wxObject *clientData = NULL) + { + return AddTool(toolid, label, bitmap, bmpDisabled, wxITEM_RADIO, + shortHelp, longHelp, clientData); + } + + + // insert the new tool at the given position, if pos == GetToolsCount(), it + // is equivalent to AddTool() + virtual wxToolBarToolBase *InsertTool + ( + size_t pos, + int toolid, + const wxString& label, + const wxBitmapBundle& bitmap, + const wxBitmapBundle& bmpDisabled = wxBitmapBundle(), + wxItemKind kind = wxITEM_NORMAL, + const wxString& shortHelp = wxEmptyString, + const wxString& longHelp = wxEmptyString, + wxObject *clientData = NULL + ); + + virtual wxToolBarToolBase *AddTool (wxToolBarToolBase *tool); + virtual wxToolBarToolBase *InsertTool (size_t pos, wxToolBarToolBase *tool); + + // add an arbitrary control to the toolbar (notice that the control will be + // deleted by the toolbar and that it will also adjust its position/size) + // + // the label is optional and, if specified, will be shown near the control + // NB: the control should have toolbar as its parent + virtual wxToolBarToolBase * + AddControl(wxControl *control, const wxString& label = wxEmptyString); + + virtual wxToolBarToolBase * + InsertControl(size_t pos, wxControl *control, + const wxString& label = wxEmptyString); + + // get the control with the given id or return NULL + virtual wxControl *FindControl( int toolid ); + + // add a separator to the toolbar + virtual wxToolBarToolBase *AddSeparator(); + virtual wxToolBarToolBase *InsertSeparator(size_t pos); + + // add a stretchable space to the toolbar: this is similar to a separator + // except that it's always blank and that all the extra space the toolbar + // has is [equally] distributed among the stretchable spaces in it + virtual wxToolBarToolBase *AddStretchableSpace(); + virtual wxToolBarToolBase *InsertStretchableSpace(size_t pos); + + // remove the tool from the toolbar: the caller is responsible for actually + // deleting the pointer + virtual wxToolBarToolBase *RemoveTool(int toolid); + + // delete tool either by index or by position + virtual bool DeleteToolByPos(size_t pos); + virtual bool DeleteTool(int toolid); + + // delete all tools + virtual void ClearTools(); + + // must be called after all buttons have been created to finish toolbar + // initialisation + // + // derived class versions should call the base one first, before doing + // platform-specific stuff + virtual bool Realize(); + + // tools state + // ----------- + + virtual void EnableTool(int toolid, bool enable); + virtual void ToggleTool(int toolid, bool toggle); + + // Set this to be togglable (or not) + virtual void SetToggle(int toolid, bool toggle); + + // set/get tools client data (not for controls) + virtual wxObject *GetToolClientData(int toolid) const; + virtual void SetToolClientData(int toolid, wxObject *clientData); + + // returns tool pos, or wxNOT_FOUND if tool isn't found + virtual int GetToolPos(int id) const; + + // return true if the tool is toggled + virtual bool GetToolState(int toolid) const; + + virtual bool GetToolEnabled(int toolid) const; + + virtual void SetToolShortHelp(int toolid, const wxString& helpString); + virtual wxString GetToolShortHelp(int toolid) const; + virtual void SetToolLongHelp(int toolid, const wxString& helpString); + virtual wxString GetToolLongHelp(int toolid) const; + + virtual void SetToolNormalBitmap(int WXUNUSED(id), + const wxBitmapBundle& WXUNUSED(bitmap)) {} + virtual void SetToolDisabledBitmap(int WXUNUSED(id), + const wxBitmapBundle& WXUNUSED(bitmap)) {} + + + // margins/packing/separation + // -------------------------- + + virtual void SetMargins(int x, int y); + void SetMargins(const wxSize& size) + { SetMargins((int) size.x, (int) size.y); } + virtual void SetToolPacking(int packing) + { m_toolPacking = packing; } + virtual void SetToolSeparation(int separation) + { m_toolSeparation = separation; } + + virtual wxSize GetToolMargins() const { return wxSize(m_xMargin, m_yMargin); } + virtual int GetToolPacking() const { return m_toolPacking; } + virtual int GetToolSeparation() const { return m_toolSeparation; } + + // toolbar geometry + // ---------------- + + // set the number of toolbar rows + virtual void SetRows(int nRows); + + // the toolbar can wrap - limit the number of columns or rows it may take + void SetMaxRowsCols(int rows, int cols) + { m_maxRows = rows; m_maxCols = cols; } + int GetMaxRows() const { return m_maxRows; } + int GetMaxCols() const { return m_maxCols; } + + // get/set the size of the bitmaps used by the toolbar, in logical pixels: + // should be called before realizing the toolbar if it's called at all + virtual void SetToolBitmapSize(const wxSize& size); + virtual wxSize GetToolBitmapSize() const; + + // the button size in some implementations is bigger than the bitmap size: + // get the total button size (by default the same as bitmap size) + virtual wxSize GetToolSize() const + { return GetToolBitmapSize(); } + + // returns a (non separator) tool containing the point (x, y) or NULL if + // there is no tool at this point (coordinates are client) + virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, + wxCoord y) const = 0; + + // find the tool by id + wxToolBarToolBase *FindById(int toolid) const; + + // return true if this is a vertical toolbar, otherwise false + bool IsVertical() const; + + // returns one of wxTB_TOP, wxTB_BOTTOM, wxTB_LEFT, wxTB_RIGHT + // indicating where the toolbar is placed in the associated frame + int GetDirection() const; + + // these methods allow to access tools by their index in the toolbar + size_t GetToolsCount() const { return m_tools.GetCount(); } + wxToolBarToolBase *GetToolByPos(int pos) { return m_tools[pos]; } + const wxToolBarToolBase *GetToolByPos(int pos) const { return m_tools[pos]; } + +#if WXWIN_COMPATIBILITY_2_8 + // the old versions of the various methods kept for compatibility + // don't use in the new code! + // -------------------------------------------------------------- + wxDEPRECATED_INLINE( + wxToolBarToolBase *AddTool(int toolid, + const wxBitmap& bitmap, + const wxBitmap& bmpDisabled, + bool toggle, + wxObject *clientData = NULL, + const wxString& shortHelpString = wxEmptyString, + const wxString& longHelpString = wxEmptyString) + , + return AddTool(toolid, wxEmptyString, + bitmap, bmpDisabled, + toggle ? wxITEM_CHECK : wxITEM_NORMAL, + shortHelpString, longHelpString, clientData); + ) + wxDEPRECATED_INLINE( + wxToolBarToolBase *AddTool(int toolid, + const wxBitmap& bitmap, + const wxString& shortHelpString = wxEmptyString, + const wxString& longHelpString = wxEmptyString) + , + return AddTool(toolid, wxEmptyString, + bitmap, wxBitmapBundle(), wxITEM_NORMAL, + shortHelpString, longHelpString, NULL); + ) + wxDEPRECATED_INLINE( + wxToolBarToolBase *AddTool(int toolid, + const wxBitmap& bitmap, + const wxBitmap& bmpDisabled, + bool toggle, + wxCoord xPos, + wxCoord yPos = wxDefaultCoord, + wxObject *clientData = NULL, + const wxString& shortHelp = wxEmptyString, + const wxString& longHelp = wxEmptyString) + , + return DoAddTool(toolid, wxEmptyString, bitmap, bmpDisabled, + toggle ? wxITEM_CHECK : wxITEM_NORMAL, + shortHelp, longHelp, clientData, xPos, yPos); + ) + wxDEPRECATED_INLINE( + wxToolBarToolBase *InsertTool(size_t pos, + int toolid, + const wxBitmap& bitmap, + const wxBitmap& bmpDisabled = wxNullBitmap, + bool toggle = false, + wxObject *clientData = NULL, + const wxString& shortHelp = wxEmptyString, + const wxString& longHelp = wxEmptyString) + , + return InsertTool(pos, toolid, wxEmptyString, bitmap, bmpDisabled, + toggle ? wxITEM_CHECK : wxITEM_NORMAL, + shortHelp, longHelp, clientData); + ) +#endif // WXWIN_COMPATIBILITY_2_8 + + // event handlers + // -------------- + + // NB: these functions are deprecated, use EVT_TOOL_XXX() instead! + + // Only allow toggle if returns true. Call when left button up. + virtual bool OnLeftClick(int toolid, bool toggleDown); + + // Call when right button down. + virtual void OnRightClick(int toolid, long x, long y); + + // Called when the mouse cursor enters a tool bitmap. + // Argument is wxID_ANY if mouse is exiting the toolbar. + virtual void OnMouseEnter(int toolid); + + // more deprecated functions + // ------------------------- + + // use GetToolMargins() instead + wxSize GetMargins() const { return GetToolMargins(); } + + // Tool factories, + // helper functions to create toolbar tools + // ------------------------- + virtual wxToolBarToolBase *CreateTool(int toolid, + const wxString& label, + const wxBitmapBundle& bmpNormal, + const wxBitmapBundle& bmpDisabled = wxBitmapBundle(), + wxItemKind kind = wxITEM_NORMAL, + wxObject *clientData = NULL, + const wxString& shortHelp = wxEmptyString, + const wxString& longHelp = wxEmptyString) = 0; + + virtual wxToolBarToolBase *CreateTool(wxControl *control, + const wxString& label) = 0; + + // this one is not virtual but just a simple helper/wrapper around + // CreateTool() for separators + wxToolBarToolBase *CreateSeparator() + { + return CreateTool(wxID_SEPARATOR, + wxEmptyString, + wxBitmapBundle(), wxBitmapBundle(), + wxITEM_SEPARATOR, NULL, + wxEmptyString, wxEmptyString); + } + + + // implementation only from now on + // ------------------------------- + + // Do the toolbar button updates (check for EVT_UPDATE_UI handlers) + virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE) wxOVERRIDE ; + + // don't want toolbars to accept the focus + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } + +#if wxUSE_MENUS + // Set dropdown menu + bool SetDropdownMenu(int toolid, wxMenu *menu); +#endif + +protected: + // choose the default border for this window + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + + // to implement in derived classes + // ------------------------------- + + // create a new toolbar tool and add it to the toolbar, this is typically + // implemented by just calling InsertTool() + virtual wxToolBarToolBase *DoAddTool + ( + int toolid, + const wxString& label, + const wxBitmapBundle& bitmap, + const wxBitmapBundle& bmpDisabled, + wxItemKind kind, + const wxString& shortHelp = wxEmptyString, + const wxString& longHelp = wxEmptyString, + wxObject *clientData = NULL, + wxCoord xPos = wxDefaultCoord, + wxCoord yPos = wxDefaultCoord + ); + + // the tool is not yet inserted into m_tools list when this function is + // called and will only be added to it if this function succeeds + virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool) = 0; + + // the tool is still in m_tools list when this function is called, it will + // only be deleted from it if it succeeds + virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool) = 0; + + // called when the tools enabled flag changes + virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable) = 0; + + // called when the tool is toggled + virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle) = 0; + + // called when the tools "can be toggled" flag changes + virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle) = 0; + + + // helper functions + // ---------------- + + // call this from derived class ctor/Create() to ensure that we have either + // wxTB_HORIZONTAL or wxTB_VERTICAL style, there is a lot of existing code + // which randomly checks either one or the other of them and gets confused + // if neither is set (and making one of them 0 is not an option neither as + // then the existing tests would break down) + void FixupStyle(); + + // un-toggle all buttons in the same radio group + void UnToggleRadioGroup(wxToolBarToolBase *tool); + + // make the size of the buttons big enough to fit the largest bitmap size + void AdjustToolBitmapSize(); + + // calls InsertTool() and deletes the tool if inserting it failed + wxToolBarToolBase *DoInsertNewTool(size_t pos, wxToolBarToolBase *tool) + { + if ( !InsertTool(pos, tool) ) + { + delete tool; + return NULL; + } + + return tool; + } + + // set the tool bitmap size without changing m_requestedBitmapSize + virtual void DoSetToolBitmapSize(const wxSize& size); + + + // the list of all our tools + wxToolBarToolsList m_tools; + + // the offset of the first tool + int m_xMargin; + int m_yMargin; + + // the maximum number of toolbar rows/columns + int m_maxRows; + int m_maxCols; + + // the tool packing and separation + int m_toolPacking, + m_toolSeparation; + + // the currently used size of the toolbar bitmaps in logical pixels: the + // name is unfortunate but keep it for compatibility + wxCoord m_defaultWidth, m_defaultHeight; + +private: + // the size of the bitmaps requested by the application by calling + // SetToolBitmapSize() expressed in DIPs because we want to keep using the + // same value even if the DPI changes + wxSize m_requestedBitmapSize; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxToolBarBase); +}; + +// deprecated function for creating the image for disabled buttons, use +// wxImage::ConvertToGreyscale() instead +#if WXWIN_COMPATIBILITY_2_8 + +wxDEPRECATED( bool wxCreateGreyedImage(const wxImage& in, wxImage& out) ); + +#endif // WXWIN_COMPATIBILITY_2_8 + + +#endif // wxUSE_TOOLBAR + +#endif + // _WX_TBARBASE_H_ + diff --git a/lib/wxWidgets/include/wx/testing.h b/lib/wxWidgets/include/wx/testing.h new file mode 100644 index 0000000..44417af --- /dev/null +++ b/lib/wxWidgets/include/wx/testing.h @@ -0,0 +1,531 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/testing.h +// Purpose: helpers for GUI testing +// Author: Vaclav Slavik +// Created: 2012-08-28 +// Copyright: (c) 2012 Vaclav Slavik +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TESTING_H_ +#define _WX_TESTING_H_ + +#include "wx/debug.h" +#include "wx/string.h" +#include "wx/modalhook.h" + +class WXDLLIMPEXP_FWD_CORE wxMessageDialogBase; +class WXDLLIMPEXP_FWD_CORE wxFileDialogBase; + +// ---------------------------------------------------------------------------- +// testing API +// ---------------------------------------------------------------------------- + +// Don't include this code when building the library itself +#ifndef WXBUILDING + +#include "wx/beforestd.h" +#include <algorithm> +#include <iterator> +#include <queue> +#include "wx/afterstd.h" +#include "wx/cpp.h" +#include "wx/dialog.h" +#include "wx/msgdlg.h" +#include "wx/filedlg.h" + +#ifndef __WXDEBUG__ + #include "wx/crt.h" +#endif // !__WXDEBUG__ + +#include <typeinfo> + +class wxTestingModalHook; + +// This helper is used to construct the best possible name for the dialog of +// the given type using either wxRTTI or C++ RTTI. +inline +wxString +wxGetDialogClassDescription(const wxClassInfo *ci, const std::type_info& ti) +{ + // We prefer to use the name from wxRTTI as it's guaranteed to be readable, + // unlike the name returned by type_info::name() which may need to be + // demangled, but if wxRTTI macros were not used for this object, it's + // better to return a not-very-readable-but-informative mangled name rather + // than a readable but useless "wxDialog". + if ( ci == wxCLASSINFO(wxDialog) ) + { + return wxString::Format(wxASCII_STR("dialog of type \"%s\""), + wxASCII_STR(ti.name())); + } + + // We consider that an unmangled name is clear enough to be used on its own. + return ci->GetClassName(); +} + +// Non-template base class for wxExpectModal<T> (via wxExpectModalBase). +// Only used internally. +class wxModalExpectation +{ +public: + wxModalExpectation() : m_isOptional(false) {} + virtual ~wxModalExpectation() {} + + wxString GetDescription() const + { + return m_description.empty() ? GetDefaultDescription() : m_description; + } + + bool IsOptional() const { return m_isOptional; } + + virtual int Invoke(wxDialog *dlg) const = 0; + +protected: + // Override to return the default description of the expected dialog used + // if no specific description for this particular expectation is given. + virtual wxString GetDefaultDescription() const = 0; + + // User-provided description of the dialog, may be empty. + wxString m_description; + + // Is this dialog optional, i.e. not required to be shown? + bool m_isOptional; +}; + + +// This template is specialized for some of the standard dialog classes and can +// also be specialized outside of the library for the custom dialogs. +// +// All specializations must derive from wxExpectModalBase<T>. +template<class T> class wxExpectModal; + + +/** + Base class for the expectation of a dialog of the given type T. + + Test code can derive ad hoc classes from this class directly and implement + its OnInvoked() to perform the necessary actions or derive wxExpectModal<T> + and implement it once if the implementation of OnInvoked() is always the + same, i.e. depends just on the type T. + + T must be a class derived from wxDialog and E is the derived class type, + i.e. this is an example of using CRTP. The default value of E is fine in + case you're using this class as a base for your wxExpectModal<> + specialization anyhow but also if you don't use either Optional() or + Describe() methods, as the derived class type is only needed for them. + */ +template<class T, class E = wxExpectModal<T> > +class wxExpectModalBase : public wxModalExpectation +{ +public: + typedef T DialogType; + typedef E ExpectationType; + + + // A note about these "modifier" methods: they return copies of this object + // and not a reference to the object itself (after modifying it) because + // this object is likely to be temporary and will be destroyed soon, while + // the new temporary created by these objects is bound to a const reference + // inside WX_TEST_IMPL_ADD_EXPECTATION() macro ensuring that its lifetime + // is prolonged until we can check if the expectations were met. + // + // This is also the reason these methods must be in this class and use + // CRTP: a copy of this object can't be created in the base class, which is + // abstract, and the copy must have the same type as the derived object to + // avoid slicing. + // + // Make sure you understand this comment in its entirety before considering + // modifying this code. + + + /** + Returns a copy of the expectation where the expected dialog is marked + as optional. + + Optional dialogs aren't required to appear, it's not an error if they + don't. + */ + ExpectationType Optional() const + { + ExpectationType e(*static_cast<const ExpectationType*>(this)); + e.m_isOptional = true; + return e; + } + + /** + Sets a description shown in the error message if the expectation fails. + + Using this method with unique descriptions for the different dialogs is + recommended to make it easier to find out which one of the expected + dialogs exactly was not shown. + */ + ExpectationType Describe(const wxString& description) const + { + ExpectationType e(*static_cast<const ExpectationType*>(this)); + e.m_description = description; + return e; + } + +protected: + virtual int Invoke(wxDialog *dlg) const wxOVERRIDE + { + DialogType *t = dynamic_cast<DialogType*>(dlg); + if ( t ) + return OnInvoked(t); + else + return wxID_NONE; // not handled + } + + /// Returns description of the expected dialog (by default, its class). + virtual wxString GetDefaultDescription() const wxOVERRIDE + { + return wxGetDialogClassDescription(wxCLASSINFO(T), typeid(T)); + } + + /** + This method is called when ShowModal() was invoked on a dialog of type T. + + @return Return value is used as ShowModal()'s return value. + */ + virtual int OnInvoked(DialogType *dlg) const = 0; +}; + + +// wxExpectModal<T> specializations for common dialogs: + +template<class T> +class wxExpectDismissableModal + : public wxExpectModalBase<T, wxExpectDismissableModal<T> > +{ +public: + explicit wxExpectDismissableModal(int id) + { + switch ( id ) + { + case wxYES: + m_id = wxID_YES; + break; + case wxNO: + m_id = wxID_NO; + break; + case wxCANCEL: + m_id = wxID_CANCEL; + break; + case wxOK: + m_id = wxID_OK; + break; + case wxHELP: + m_id = wxID_HELP; + break; + default: + m_id = id; + break; + } + } + +protected: + virtual int OnInvoked(T *WXUNUSED(dlg)) const wxOVERRIDE + { + return m_id; + } + + int m_id; +}; + +template<> +class wxExpectModal<wxMessageDialog> + : public wxExpectDismissableModal<wxMessageDialog> +{ +public: + explicit wxExpectModal(int id) + : wxExpectDismissableModal<wxMessageDialog>(id) + { + } + +protected: + virtual wxString GetDefaultDescription() const wxOVERRIDE + { + // It can be useful to show which buttons the expected message box was + // supposed to have, in case there could have been several of them. + wxString details; + switch ( m_id ) + { + case wxID_YES: + case wxID_NO: + details = wxASCII_STR("wxYES_NO style"); + break; + + case wxID_CANCEL: + details = wxASCII_STR("wxCANCEL style"); + break; + + case wxID_OK: + details = wxASCII_STR("wxOK style"); + break; + + default: + details.Printf(wxASCII_STR("a button with ID=%d"), m_id); + break; + } + + return wxASCII_STR("wxMessageDialog with ") + details; + } +}; + +class wxExpectAny : public wxExpectDismissableModal<wxDialog> +{ +public: + explicit wxExpectAny(int id) + : wxExpectDismissableModal<wxDialog>(id) + { + } +}; + +#if wxUSE_FILEDLG + +template<> +class wxExpectModal<wxFileDialog> : public wxExpectModalBase<wxFileDialog> +{ +public: + wxExpectModal(const wxString& path, int id = wxID_OK) + : m_path(path), m_id(id) + { + } + +protected: + virtual int OnInvoked(wxFileDialog *dlg) const wxOVERRIDE + { + dlg->SetPath(m_path); + return m_id; + } + + wxString m_path; + int m_id; +}; + +#endif + +// Implementation of wxModalDialogHook for use in testing, with +// wxExpectModal<T> and the wxTEST_DIALOG() macro. It is not intended for +// direct use, use the macro instead. +class wxTestingModalHook : public wxModalDialogHook +{ +public: + // This object is created with the location of the macro containing it by + // wxTEST_DIALOG macro, otherwise it falls back to the location of this + // line itself, which is not very useful, so normally you should provide + // your own values. + wxTestingModalHook(const char* file = NULL, + int line = 0, + const char* func = NULL) + : m_file(file), m_line(line), m_func(func) + { + Register(); + } + + // Called to verify that all expectations were met. This cannot be done in + // the destructor, because ReportFailure() may throw (either because it's + // overridden or because wx's assertions handling is, globally). And + // throwing from the destructor would introduce all sort of problems, + // including messing up the order of errors in some cases. + void CheckUnmetExpectations() + { + while ( !m_expectations.empty() ) + { + const wxModalExpectation *expect = m_expectations.front(); + m_expectations.pop(); + if ( expect->IsOptional() ) + continue; + + ReportFailure + ( + wxString::Format + ( + wxASCII_STR("Expected %s was not shown."), + expect->GetDescription() + ) + ); + break; + } + } + + void AddExpectation(const wxModalExpectation& e) + { + m_expectations.push(&e); + } + +protected: + virtual int Enter(wxDialog *dlg) wxOVERRIDE + { + while ( !m_expectations.empty() ) + { + const wxModalExpectation *expect = m_expectations.front(); + m_expectations.pop(); + + int ret = expect->Invoke(dlg); + if ( ret != wxID_NONE ) + return ret; // dialog shown as expected + + // not showing an optional dialog is OK, but showing an unexpected + // one definitely isn't: + if ( !expect->IsOptional() ) + { + ReportFailure + ( + wxString::Format + ( + wxASCII_STR("%s was shown unexpectedly, expected %s."), + DescribeUnexpectedDialog(dlg), + expect->GetDescription() + ) + ); + return wxID_NONE; + } + // else: try the next expectation in the chain + } + + ReportFailure + ( + wxString::Format + ( + wxASCII_STR("%s was shown unexpectedly."), + DescribeUnexpectedDialog(dlg) + ) + ); + return wxID_NONE; + } + +protected: + // This method may be overridden to provide a better description of + // (unexpected) dialogs, e.g. add knowledge of custom dialogs used by the + // program here. + virtual wxString DescribeUnexpectedDialog(wxDialog* dlg) const + { + // Message boxes are handled specially here just because they are so + // ubiquitous. + if ( wxMessageDialog *msgdlg = dynamic_cast<wxMessageDialog*>(dlg) ) + { + return wxString::Format + ( + wxASCII_STR("A message box \"%s\""), + msgdlg->GetMessage() + ); + } + + return wxString::Format + ( + wxASCII_STR("A %s with title \"%s\""), + wxGetDialogClassDescription(dlg->GetClassInfo(), typeid(*dlg)), + dlg->GetTitle() + ); + } + + // This method may be overridden to change the way test failures are + // handled. By default they result in an assertion failure which, of + // course, can itself be customized. + virtual void ReportFailure(const wxString& msg) + { +#ifdef __WXDEBUG__ + wxFAIL_MSG_AT( msg, + m_file ? m_file : __FILE__, + m_line ? m_line : __LINE__, + m_func ? m_func : __WXFUNCTION__ ); +#else // !__WXDEBUG__ + // We still need to report the failure somehow when wx asserts are + // disabled. + wxFprintf(stderr, wxASCII_STR("%s at %s:%d in %s()\n"), + msg, + wxASCII_STR(m_file ? m_file : __FILE__), + m_line ? m_line : __LINE__, + wxASCII_STR(m_func ? m_func : __WXFUNCTION__)); +#endif // __WXDEBUG__/!__WXDEBUG__ + } + +private: + const char* const m_file; + const int m_line; + const char* const m_func; + + std::queue<const wxModalExpectation*> m_expectations; + + wxDECLARE_NO_COPY_CLASS(wxTestingModalHook); +}; + + +// Redefining this value makes it possible to customize the hook class, +// including e.g. its error reporting. +#ifndef wxTEST_DIALOG_HOOK_CLASS + #define wxTEST_DIALOG_HOOK_CLASS wxTestingModalHook +#endif + +#define WX_TEST_IMPL_ADD_EXPECTATION(pos, expect) \ + const wxModalExpectation& wx_exp##pos = expect; \ + wx_hook.AddExpectation(wx_exp##pos); + +/** + Runs given code with all modal dialogs redirected to wxExpectModal<T> + hooks, instead of being shown to the user. + + The first argument is any valid expression, typically a function call. The + remaining arguments are wxExpectModal<T> instances defining the dialogs + that are expected to be shown, in order of appearance. + + Some typical examples: + + @code + wxTEST_DIALOG + ( + rc = dlg.ShowModal(), + wxExpectModal<wxFileDialog>(wxGetCwd() + "/test.txt") + ); + @endcode + + Sometimes, the code may show more than one dialog: + + @code + wxTEST_DIALOG + ( + RunSomeFunction(), + wxExpectModal<wxMessageDialog>(wxNO), + wxExpectModal<MyConfirmationDialog>(wxYES), + wxExpectModal<wxFileDialog>(wxGetCwd() + "/test.txt") + ); + @endcode + + Notice that wxExpectModal<T> has some convenience methods for further + tweaking the expectations. For example, it's possible to mark an expected + dialog as @em optional for situations when a dialog may be shown, but isn't + required to, by calling the Optional() method: + + @code + wxTEST_DIALOG + ( + RunSomeFunction(), + wxExpectModal<wxMessageDialog>(wxNO), + wxExpectModal<wxFileDialog>(wxGetCwd() + "/test.txt").Optional() + ); + @endcode + + @note By default, errors are reported with wxFAIL_MSG(). You may customize this by + implementing a class derived from wxTestingModalHook, overriding its + ReportFailure() method and redefining the wxTEST_DIALOG_HOOK_CLASS + macro to be the name of this class. + + @note Custom dialogs are supported too. All you have to do is to specialize + wxExpectModal<> for your dialog type and implement its OnInvoked() + method. + */ +#ifdef HAVE_VARIADIC_MACROS + +#define wxTEST_DIALOG(codeToRun, ...) \ + { \ + wxTEST_DIALOG_HOOK_CLASS wx_hook(__FILE__, __LINE__, __WXFUNCTION__); \ + wxCALL_FOR_EACH(WX_TEST_IMPL_ADD_EXPECTATION, __VA_ARGS__) \ + codeToRun; \ + wx_hook.CheckUnmetExpectations(); \ + } +#endif /* HAVE_VARIADIC_MACROS */ + +#endif // !WXBUILDING + +#endif // _WX_TESTING_H_ diff --git a/lib/wxWidgets/include/wx/textbuf.h b/lib/wxWidgets/include/wx/textbuf.h new file mode 100644 index 0000000..cef304e --- /dev/null +++ b/lib/wxWidgets/include/wx/textbuf.h @@ -0,0 +1,208 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/textbuf.h +// Purpose: class wxTextBuffer to work with text buffers of _small_ size +// (buffer is fully loaded in memory) and which understands CR/LF +// differences between platforms. +// Created: 14.11.01 +// Author: Morten Hanssen, Vadim Zeitlin +// Copyright: (c) 1998-2001 Morten Hanssen, Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TEXTBUFFER_H +#define _WX_TEXTBUFFER_H + +#include "wx/defs.h" +#include "wx/arrstr.h" +#include "wx/convauto.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// the line termination type (kept wxTextFileType name for compatibility) +enum wxTextFileType +{ + wxTextFileType_None, // incomplete (the last line of the file only) + wxTextFileType_Unix, // line is terminated with 'LF' = 0xA = 10 = '\n' + wxTextFileType_Dos, // 'CR' 'LF' + wxTextFileType_Mac, // 'CR' = 0xD = 13 = '\r' + wxTextFileType_Os2 // 'CR' 'LF' +}; + +#include "wx/string.h" + +#if wxUSE_TEXTBUFFER + +#include "wx/dynarray.h" + +// ---------------------------------------------------------------------------- +// wxTextBuffer +// ---------------------------------------------------------------------------- + +WX_DEFINE_USER_EXPORTED_ARRAY_INT(wxTextFileType, + wxArrayLinesType, + class WXDLLIMPEXP_BASE); + +#endif // wxUSE_TEXTBUFFER + +class WXDLLIMPEXP_BASE wxTextBuffer +{ +public: + // constants and static functions + // default type for current platform (determined at compile time) + static const wxTextFileType typeDefault; + + // this function returns a string which is identical to "text" passed in + // except that the line terminator characters are changed to correspond the + // given type. Called with the default argument, the function translates + // the string to the native format (Unix for Unix, DOS for Windows, ...). + static wxString Translate(const wxString& text, + wxTextFileType type = typeDefault); + + // get the buffer termination string + static const wxChar *GetEOL(wxTextFileType type = typeDefault); + + // the static methods of this class are compiled in even when + // !wxUSE_TEXTBUFFER because they are used by the library itself, but the + // rest can be left out +#if wxUSE_TEXTBUFFER + + // buffer operations + // ----------------- + + // buffer exists? + bool Exists() const; + + // create the buffer if it doesn't already exist + bool Create(); + + // same as Create() but with (another) buffer name + bool Create(const wxString& strBufferName); + + // Open() also loads buffer in memory on success + bool Open(const wxMBConv& conv = wxConvAuto()); + + // same as Open() but with (another) buffer name + bool Open(const wxString& strBufferName, const wxMBConv& conv = wxConvAuto()); + + // closes the buffer and frees memory, losing all changes + bool Close(); + + // is buffer currently opened? + bool IsOpened() const { return m_isOpened; } + + // accessors + // --------- + + // get the number of lines in the buffer + size_t GetLineCount() const { return m_aLines.size(); } + + // the returned line may be modified (but don't add CR/LF at the end!) + wxString& GetLine(size_t n) { return m_aLines[n]; } + const wxString& GetLine(size_t n) const { return m_aLines[n]; } + wxString& operator[](size_t n) { return m_aLines[n]; } + const wxString& operator[](size_t n) const { return m_aLines[n]; } + + // the current line has meaning only when you're using + // GetFirstLine()/GetNextLine() functions, it doesn't get updated when + // you're using "direct access" i.e. GetLine() + size_t GetCurrentLine() const { return m_nCurLine; } + void GoToLine(size_t n) { m_nCurLine = n; } + bool Eof() const { return m_nCurLine == m_aLines.size(); } + + // these methods allow more "iterator-like" traversal of the list of + // lines, i.e. you may write something like: + // for ( str = GetFirstLine(); !Eof(); str = GetNextLine() ) { ... } + + wxString& GetFirstLine() + { return m_aLines.empty() ? ms_eof : m_aLines[m_nCurLine = 0]; } + wxString& GetNextLine() + { return ++m_nCurLine == m_aLines.size() ? ms_eof + : m_aLines[m_nCurLine]; } + wxString& GetPrevLine() + { wxASSERT(m_nCurLine > 0); return m_aLines[--m_nCurLine]; } + wxString& GetLastLine() + { return m_aLines.empty() ? ms_eof : m_aLines[m_nCurLine = m_aLines.size() - 1]; } + + // get the type of the line (see also GetEOL) + wxTextFileType GetLineType(size_t n) const { return m_aTypes[n]; } + + // guess the type of buffer + wxTextFileType GuessType() const; + + // get the name of the buffer + const wxString& GetName() const { return m_strBufferName; } + + // add/remove lines + // ---------------- + + // add a line to the end + void AddLine(const wxString& str, wxTextFileType type = typeDefault) + { m_aLines.push_back(str); m_aTypes.push_back(type); } + // insert a line before the line number n + void InsertLine(const wxString& str, + size_t n, + wxTextFileType type = typeDefault) + { + m_aLines.insert(m_aLines.begin() + n, str); + m_aTypes.insert(m_aTypes.begin()+n, type); + } + + // delete one line + void RemoveLine(size_t n) + { + m_aLines.erase(m_aLines.begin() + n); + m_aTypes.erase(m_aTypes.begin() + n); + } + + // remove all lines + void Clear() { m_aLines.clear(); m_aTypes.clear(); m_nCurLine = 0; } + + // change the buffer (default argument means "don't change type") + // possibly in another format + bool Write(wxTextFileType typeNew = wxTextFileType_None, + const wxMBConv& conv = wxConvAuto()); + + // dtor + virtual ~wxTextBuffer(); + +protected: + // ctors + // ----- + + // default ctor, use Open(string) + wxTextBuffer() { m_nCurLine = 0; m_isOpened = false; } + + // ctor from filename + wxTextBuffer(const wxString& strBufferName); + + enum wxTextBufferOpenMode { ReadAccess, WriteAccess }; + + // Must implement these in derived classes. + virtual bool OnExists() const = 0; + virtual bool OnOpen(const wxString &strBufferName, + wxTextBufferOpenMode openmode) = 0; + virtual bool OnClose() = 0; + virtual bool OnRead(const wxMBConv& conv) = 0; + virtual bool OnWrite(wxTextFileType typeNew, const wxMBConv& conv) = 0; + + static wxString ms_eof; // dummy string returned at EOF + wxString m_strBufferName; // name of the buffer + +private: + wxArrayLinesType m_aTypes; // type of each line + wxArrayString m_aLines; // lines of file + + size_t m_nCurLine; // number of current line in the buffer + + bool m_isOpened; // was the buffer successfully opened the last time? +#endif // wxUSE_TEXTBUFFER + + // copy ctor/assignment operator not implemented + wxTextBuffer(const wxTextBuffer&); + wxTextBuffer& operator=(const wxTextBuffer&); +}; + +#endif // _WX_TEXTBUFFER_H + diff --git a/lib/wxWidgets/include/wx/textcompleter.h b/lib/wxWidgets/include/wx/textcompleter.h new file mode 100644 index 0000000..44f677f --- /dev/null +++ b/lib/wxWidgets/include/wx/textcompleter.h @@ -0,0 +1,89 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/textcompleter.h +// Purpose: Declaration of wxTextCompleter class. +// Author: Vadim Zeitlin +// Created: 2011-04-13 +// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TEXTCOMPLETER_H_ +#define _WX_TEXTCOMPLETER_H_ + +#include "wx/defs.h" +#include "wx/arrstr.h" + +// ---------------------------------------------------------------------------- +// wxTextCompleter: used by wxTextEnter::AutoComplete() +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTextCompleter +{ +public: + wxTextCompleter() { } + + // The virtual functions to be implemented by the derived classes: the + // first one is called to start preparing for completions for the given + // prefix and, if it returns true, GetNext() is called until it returns an + // empty string indicating that there are no more completions. + virtual bool Start(const wxString& prefix) = 0; + virtual wxString GetNext() = 0; + + virtual ~wxTextCompleter(); + +private: + wxDECLARE_NO_COPY_CLASS(wxTextCompleter); +}; + +// ---------------------------------------------------------------------------- +// wxTextCompleterSimple: returns the entire set of completions at once +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTextCompleterSimple : public wxTextCompleter +{ +public: + wxTextCompleterSimple() { } + + // Must be implemented to return all the completions for the given prefix. + virtual void GetCompletions(const wxString& prefix, wxArrayString& res) = 0; + + virtual bool Start(const wxString& prefix) wxOVERRIDE; + virtual wxString GetNext() wxOVERRIDE; + +private: + wxArrayString m_completions; + unsigned m_index; + + wxDECLARE_NO_COPY_CLASS(wxTextCompleterSimple); +}; + +// ---------------------------------------------------------------------------- +// wxTextCompleterFixed: Trivial wxTextCompleter implementation which always +// returns the same fixed array of completions. +// ---------------------------------------------------------------------------- + +// NB: This class is private and intentionally not documented as it is +// currently used only for implementation of completion with the fixed list +// of strings only by wxWidgets itself, do not use it outside of wxWidgets. + +class wxTextCompleterFixed : public wxTextCompleterSimple +{ +public: + void SetCompletions(const wxArrayString& strings) + { + m_strings = strings; + } + + virtual void GetCompletions(const wxString& WXUNUSED(prefix), + wxArrayString& res) wxOVERRIDE + { + res = m_strings; + } + +private: + wxArrayString m_strings; +}; + + +#endif // _WX_TEXTCOMPLETER_H_ + diff --git a/lib/wxWidgets/include/wx/textctrl.h b/lib/wxWidgets/include/wx/textctrl.h new file mode 100644 index 0000000..b2db92f --- /dev/null +++ b/lib/wxWidgets/include/wx/textctrl.h @@ -0,0 +1,1012 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/textctrl.h +// Purpose: wxTextAttr and wxTextCtrlBase class - the interface of wxTextCtrl +// Author: Vadim Zeitlin +// Modified by: +// Created: 13.07.99 +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TEXTCTRL_H_BASE_ +#define _WX_TEXTCTRL_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_TEXTCTRL + +#include "wx/control.h" // the base class +#include "wx/textentry.h" // single-line text entry interface +#include "wx/dynarray.h" // wxArrayInt +#include "wx/gdicmn.h" // wxPoint + +#if wxUSE_STD_IOSTREAM + #include "wx/ioswrap.h" + #define wxHAS_TEXT_WINDOW_STREAM 1 +#else + #define wxHAS_TEXT_WINDOW_STREAM 0 +#endif + +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; +class WXDLLIMPEXP_FWD_CORE wxTextCtrlBase; + +// ---------------------------------------------------------------------------- +// wxTextCtrl types +// ---------------------------------------------------------------------------- + +// wxTextCoord is the line or row number (which should have been unsigned but +// is long for backwards compatibility) +typedef long wxTextCoord; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +extern WXDLLIMPEXP_DATA_CORE(const char) wxTextCtrlNameStr[]; + +// this is intentionally not enum to avoid warning fixes with +// typecasting from enum type to wxTextCoord +const wxTextCoord wxOutOfRangeTextCoord = -1; +const wxTextCoord wxInvalidTextCoord = -2; + +// ---------------------------------------------------------------------------- +// wxTextCtrl style flags +// ---------------------------------------------------------------------------- + +// Some of wxTE_XXX are defined in wx/defs.h, they take 0x0C70 bits. + +#define wxTE_NO_VSCROLL 0x0002 + +// alignment flags +#define wxTE_LEFT 0x0000 // 0x0000 +#define wxTE_CENTER wxALIGN_CENTER_HORIZONTAL // 0x0100 +#define wxTE_RIGHT wxALIGN_RIGHT // 0x0200 +#define wxTE_CENTRE wxTE_CENTER + +// this style means to use RICHEDIT control and does something only under wxMSW +// and Win32 and is silently ignored under all other platforms +#define wxTE_RICH 0x0080 + +// automatically detect the URLs and generate the events when mouse is +// moved/clicked over an URL +// +// this is for Win32 richedit and wxGTK2 multiline controls only so far +#define wxTE_AUTO_URL 0x1000 + +// by default, the Windows text control doesn't show the selection when it +// doesn't have focus - use this style to force it to always show it +#define wxTE_NOHIDESEL 0x2000 + +// use wxHSCROLL to not wrap text at all, wxTE_CHARWRAP to wrap it at any +// position and wxTE_WORDWRAP to wrap at words boundary +// +// if no wrapping style is given at all, the control wraps at word boundary +#define wxTE_DONTWRAP wxHSCROLL +#define wxTE_CHARWRAP 0x4000 // wrap at any position +#define wxTE_WORDWRAP 0x0001 // wrap only at words boundaries +#define wxTE_BESTWRAP 0x0000 // this is the default + +#if WXWIN_COMPATIBILITY_2_8 + // this style is (or at least should be) on by default now, don't use it + #define wxTE_AUTO_SCROLL 0 +#endif // WXWIN_COMPATIBILITY_2_8 + +// force using RichEdit version 2.0 or 3.0 instead of 1.0 (default) for +// wxTE_RICH controls - can be used together with or instead of wxTE_RICH +#define wxTE_RICH2 0x8000 + +#if defined(__WXOSX_IPHONE__) +#define wxTE_CAPITALIZE wxTE_RICH2 +#else +#define wxTE_CAPITALIZE 0 +#endif + +// ---------------------------------------------------------------------------- +// wxTextCtrl file types +// ---------------------------------------------------------------------------- + +#define wxTEXT_TYPE_ANY 0 + +// ---------------------------------------------------------------------------- +// wxTextCtrl::HitTest return values +// ---------------------------------------------------------------------------- + +// the point asked is ... +enum wxTextCtrlHitTestResult +{ + wxTE_HT_UNKNOWN = -2, // this means HitTest() is simply not implemented + wxTE_HT_BEFORE, // either to the left or upper + wxTE_HT_ON_TEXT, // directly on + wxTE_HT_BELOW, // below [the last line] + wxTE_HT_BEYOND // after [the end of line] +}; +// ... the character returned + +#if wxUSE_SPELLCHECK + +// ---------------------------------------------------------------------------- +// This object can be passed to wxTextCtrl::EnableProofCheck() to configure the +// proofing options for this control. +// ---------------------------------------------------------------------------- +class wxTextProofOptions +{ +public: + // Return the object corresponding to the default options: current + // language, spell checking enabled, grammar checking disabled. + static wxTextProofOptions Default() + { + wxTextProofOptions opts; + return opts.SpellCheck(true); + } + + // Return the object with all checks disabled. + static wxTextProofOptions Disable() + { + return wxTextProofOptions(); + } + + // Default copy ctor, assignment operator and dtor are ok + + // Methods that can be used to set the various options. + wxTextProofOptions& SpellCheck(bool enable = true) + { + m_EnableSpellCheck = enable; + return *this; + } + + wxTextProofOptions& GrammarCheck(bool enable = true) + { + m_EnableGrammarCheck = enable; + return *this; + } + + wxTextProofOptions& Language(const wxString& lang) + { + m_lang = lang; + return *this; + } + + // And the corresponding accessors. + bool IsSpellCheckEnabled() const { return m_EnableSpellCheck; } + bool IsGrammarCheckEnabled() const { return m_EnableGrammarCheck; } + const wxString& GetLang() const { return m_lang; } + + bool AnyChecksEnabled() const + { + return IsSpellCheckEnabled() || IsGrammarCheckEnabled(); + } + +private: + // Ctor is private, use static factory methods to create objects of this + // class. + wxTextProofOptions() + { + m_EnableSpellCheck = + m_EnableGrammarCheck = false; + } + + wxString m_lang; + bool m_EnableSpellCheck; + bool m_EnableGrammarCheck; +}; + +#endif // wxUSE_SPELLCHECK + +// ---------------------------------------------------------------------------- +// Types for wxTextAttr +// ---------------------------------------------------------------------------- + +// Alignment + +enum wxTextAttrAlignment +{ + wxTEXT_ALIGNMENT_DEFAULT, + wxTEXT_ALIGNMENT_LEFT, + wxTEXT_ALIGNMENT_CENTRE, + wxTEXT_ALIGNMENT_CENTER = wxTEXT_ALIGNMENT_CENTRE, + wxTEXT_ALIGNMENT_RIGHT, + wxTEXT_ALIGNMENT_JUSTIFIED +}; + +// Flags to indicate which attributes are being applied +enum wxTextAttrFlags +{ + wxTEXT_ATTR_TEXT_COLOUR = 0x00000001, + wxTEXT_ATTR_BACKGROUND_COLOUR = 0x00000002, + + wxTEXT_ATTR_FONT_FACE = 0x00000004, + wxTEXT_ATTR_FONT_POINT_SIZE = 0x00000008, + wxTEXT_ATTR_FONT_PIXEL_SIZE = 0x10000000, + wxTEXT_ATTR_FONT_WEIGHT = 0x00000010, + wxTEXT_ATTR_FONT_ITALIC = 0x00000020, + wxTEXT_ATTR_FONT_UNDERLINE = 0x00000040, + wxTEXT_ATTR_FONT_STRIKETHROUGH = 0x08000000, + wxTEXT_ATTR_FONT_ENCODING = 0x02000000, + wxTEXT_ATTR_FONT_FAMILY = 0x04000000, + wxTEXT_ATTR_FONT_SIZE = \ + ( wxTEXT_ATTR_FONT_POINT_SIZE | wxTEXT_ATTR_FONT_PIXEL_SIZE ), + wxTEXT_ATTR_FONT = \ + ( wxTEXT_ATTR_FONT_FACE | wxTEXT_ATTR_FONT_SIZE | wxTEXT_ATTR_FONT_WEIGHT | \ + wxTEXT_ATTR_FONT_ITALIC | wxTEXT_ATTR_FONT_UNDERLINE | wxTEXT_ATTR_FONT_STRIKETHROUGH | wxTEXT_ATTR_FONT_ENCODING | wxTEXT_ATTR_FONT_FAMILY ), + + wxTEXT_ATTR_ALIGNMENT = 0x00000080, + wxTEXT_ATTR_LEFT_INDENT = 0x00000100, + wxTEXT_ATTR_RIGHT_INDENT = 0x00000200, + wxTEXT_ATTR_TABS = 0x00000400, + wxTEXT_ATTR_PARA_SPACING_AFTER = 0x00000800, + wxTEXT_ATTR_PARA_SPACING_BEFORE = 0x00001000, + wxTEXT_ATTR_LINE_SPACING = 0x00002000, + wxTEXT_ATTR_CHARACTER_STYLE_NAME = 0x00004000, + wxTEXT_ATTR_PARAGRAPH_STYLE_NAME = 0x00008000, + wxTEXT_ATTR_LIST_STYLE_NAME = 0x00010000, + + wxTEXT_ATTR_BULLET_STYLE = 0x00020000, + wxTEXT_ATTR_BULLET_NUMBER = 0x00040000, + wxTEXT_ATTR_BULLET_TEXT = 0x00080000, + wxTEXT_ATTR_BULLET_NAME = 0x00100000, + + wxTEXT_ATTR_BULLET = \ + ( wxTEXT_ATTR_BULLET_STYLE | wxTEXT_ATTR_BULLET_NUMBER | wxTEXT_ATTR_BULLET_TEXT | \ + wxTEXT_ATTR_BULLET_NAME ), + + + wxTEXT_ATTR_URL = 0x00200000, + wxTEXT_ATTR_PAGE_BREAK = 0x00400000, + wxTEXT_ATTR_EFFECTS = 0x00800000, + wxTEXT_ATTR_OUTLINE_LEVEL = 0x01000000, + + wxTEXT_ATTR_AVOID_PAGE_BREAK_BEFORE = 0x20000000, + wxTEXT_ATTR_AVOID_PAGE_BREAK_AFTER = 0x40000000, + + /*! + * Character and paragraph combined styles + */ + + wxTEXT_ATTR_CHARACTER = \ + (wxTEXT_ATTR_FONT|wxTEXT_ATTR_EFFECTS| \ + wxTEXT_ATTR_BACKGROUND_COLOUR|wxTEXT_ATTR_TEXT_COLOUR|wxTEXT_ATTR_CHARACTER_STYLE_NAME|wxTEXT_ATTR_URL), + + wxTEXT_ATTR_PARAGRAPH = \ + (wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_TABS|\ + wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|wxTEXT_ATTR_LINE_SPACING|\ + wxTEXT_ATTR_BULLET|wxTEXT_ATTR_PARAGRAPH_STYLE_NAME|wxTEXT_ATTR_LIST_STYLE_NAME|wxTEXT_ATTR_OUTLINE_LEVEL|\ + wxTEXT_ATTR_PAGE_BREAK|wxTEXT_ATTR_AVOID_PAGE_BREAK_BEFORE|wxTEXT_ATTR_AVOID_PAGE_BREAK_AFTER), + + wxTEXT_ATTR_ALL = (wxTEXT_ATTR_CHARACTER|wxTEXT_ATTR_PARAGRAPH) +}; + +/*! + * Styles for wxTextAttr::SetBulletStyle + */ +enum wxTextAttrBulletStyle +{ + wxTEXT_ATTR_BULLET_STYLE_NONE = 0x00000000, + wxTEXT_ATTR_BULLET_STYLE_ARABIC = 0x00000001, + wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER = 0x00000002, + wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER = 0x00000004, + wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER = 0x00000008, + wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER = 0x00000010, + wxTEXT_ATTR_BULLET_STYLE_SYMBOL = 0x00000020, + wxTEXT_ATTR_BULLET_STYLE_BITMAP = 0x00000040, + wxTEXT_ATTR_BULLET_STYLE_PARENTHESES = 0x00000080, + wxTEXT_ATTR_BULLET_STYLE_PERIOD = 0x00000100, + wxTEXT_ATTR_BULLET_STYLE_STANDARD = 0x00000200, + wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS = 0x00000400, + wxTEXT_ATTR_BULLET_STYLE_OUTLINE = 0x00000800, + + wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT = 0x00000000, + wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT = 0x00001000, + wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE = 0x00002000, + + wxTEXT_ATTR_BULLET_STYLE_CONTINUATION = 0x00004000 +}; + +/*! + * Styles for wxTextAttr::SetTextEffects + */ +enum wxTextAttrEffects +{ + wxTEXT_ATTR_EFFECT_NONE = 0x00000000, + wxTEXT_ATTR_EFFECT_CAPITALS = 0x00000001, + wxTEXT_ATTR_EFFECT_SMALL_CAPITALS = 0x00000002, + wxTEXT_ATTR_EFFECT_STRIKETHROUGH = 0x00000004, + wxTEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH = 0x00000008, + wxTEXT_ATTR_EFFECT_SHADOW = 0x00000010, + wxTEXT_ATTR_EFFECT_EMBOSS = 0x00000020, + wxTEXT_ATTR_EFFECT_OUTLINE = 0x00000040, + wxTEXT_ATTR_EFFECT_ENGRAVE = 0x00000080, + wxTEXT_ATTR_EFFECT_SUPERSCRIPT = 0x00000100, + wxTEXT_ATTR_EFFECT_SUBSCRIPT = 0x00000200, + wxTEXT_ATTR_EFFECT_RTL = 0x00000400, + wxTEXT_ATTR_EFFECT_SUPPRESS_HYPHENATION = 0x00001000 +}; + +/*! + * Line spacing values + */ +enum wxTextAttrLineSpacing +{ + wxTEXT_ATTR_LINE_SPACING_NORMAL = 10, + wxTEXT_ATTR_LINE_SPACING_HALF = 15, + wxTEXT_ATTR_LINE_SPACING_TWICE = 20 +}; + +enum wxTextAttrUnderlineType +{ + wxTEXT_ATTR_UNDERLINE_NONE, + wxTEXT_ATTR_UNDERLINE_SOLID, + wxTEXT_ATTR_UNDERLINE_DOUBLE, + wxTEXT_ATTR_UNDERLINE_SPECIAL +}; + +// ---------------------------------------------------------------------------- +// wxTextAttr: a structure containing the visual attributes of a text +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTextAttr +{ +public: + // ctors + wxTextAttr() { Init(); } + wxTextAttr(const wxTextAttr& attr) { Init(); Copy(attr); } + wxTextAttr(const wxColour& colText, + const wxColour& colBack = wxNullColour, + const wxFont& font = wxNullFont, + wxTextAttrAlignment alignment = wxTEXT_ALIGNMENT_DEFAULT); + + // Initialise this object. + void Init(); + + // Copy + void Copy(const wxTextAttr& attr); + + // Assignment + void operator= (const wxTextAttr& attr); + + // Equality test + bool operator== (const wxTextAttr& attr) const; + + // Partial equality test. If @a weakTest is @true, attributes of this object do not + // have to be present if those attributes of @a attr are present. If @a weakTest is + // @false, the function will fail if an attribute is present in @a attr but not + // in this object. + bool EqPartial(const wxTextAttr& attr, bool weakTest = true) const; + + // Get attributes from font. + bool GetFontAttributes(const wxFont& font, int flags = wxTEXT_ATTR_FONT); + + // setters + void SetTextColour(const wxColour& colText) { m_colText = colText; m_flags |= wxTEXT_ATTR_TEXT_COLOUR; } + void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; m_flags |= wxTEXT_ATTR_BACKGROUND_COLOUR; } + void SetAlignment(wxTextAttrAlignment alignment) { m_textAlignment = alignment; m_flags |= wxTEXT_ATTR_ALIGNMENT; } + void SetTabs(const wxArrayInt& tabs) { m_tabs = tabs; m_flags |= wxTEXT_ATTR_TABS; } + void SetLeftIndent(int indent, int subIndent = 0) { m_leftIndent = indent; m_leftSubIndent = subIndent; m_flags |= wxTEXT_ATTR_LEFT_INDENT; } + void SetRightIndent(int indent) { m_rightIndent = indent; m_flags |= wxTEXT_ATTR_RIGHT_INDENT; } + + void SetFontSize(int pointSize) { m_fontSize = pointSize; m_flags &= ~wxTEXT_ATTR_FONT_SIZE; m_flags |= wxTEXT_ATTR_FONT_POINT_SIZE; } + void SetFontPointSize(int pointSize) { m_fontSize = pointSize; m_flags &= ~wxTEXT_ATTR_FONT_SIZE; m_flags |= wxTEXT_ATTR_FONT_POINT_SIZE; } + void SetFontPixelSize(int pixelSize) { m_fontSize = pixelSize; m_flags &= ~wxTEXT_ATTR_FONT_SIZE; m_flags |= wxTEXT_ATTR_FONT_PIXEL_SIZE; } + void SetFontStyle(wxFontStyle fontStyle) { m_fontStyle = fontStyle; m_flags |= wxTEXT_ATTR_FONT_ITALIC; } + void SetFontWeight(wxFontWeight fontWeight) { m_fontWeight = fontWeight; m_flags |= wxTEXT_ATTR_FONT_WEIGHT; } + void SetFontFaceName(const wxString& faceName) { m_fontFaceName = faceName; m_flags |= wxTEXT_ATTR_FONT_FACE; } + void SetFontUnderlined(bool underlined) { SetFontUnderlined(underlined ? wxTEXT_ATTR_UNDERLINE_SOLID : wxTEXT_ATTR_UNDERLINE_NONE); } + void SetFontUnderlined(wxTextAttrUnderlineType type, const wxColour& colour = wxNullColour) + { + m_flags |= wxTEXT_ATTR_FONT_UNDERLINE; + m_fontUnderlineType = type; + m_colUnderline = colour; + } + void SetFontStrikethrough(bool strikethrough) { m_fontStrikethrough = strikethrough; m_flags |= wxTEXT_ATTR_FONT_STRIKETHROUGH; } + void SetFontEncoding(wxFontEncoding encoding) { m_fontEncoding = encoding; m_flags |= wxTEXT_ATTR_FONT_ENCODING; } + void SetFontFamily(wxFontFamily family) { m_fontFamily = family; m_flags |= wxTEXT_ATTR_FONT_FAMILY; } + + // Set font + void SetFont(const wxFont& font, int flags = (wxTEXT_ATTR_FONT & ~wxTEXT_ATTR_FONT_PIXEL_SIZE)) { GetFontAttributes(font, flags); } + + void SetFlags(long flags) { m_flags = flags; } + + void SetCharacterStyleName(const wxString& name) { m_characterStyleName = name; m_flags |= wxTEXT_ATTR_CHARACTER_STYLE_NAME; } + void SetParagraphStyleName(const wxString& name) { m_paragraphStyleName = name; m_flags |= wxTEXT_ATTR_PARAGRAPH_STYLE_NAME; } + void SetListStyleName(const wxString& name) { m_listStyleName = name; SetFlags(GetFlags() | wxTEXT_ATTR_LIST_STYLE_NAME); } + void SetParagraphSpacingAfter(int spacing) { m_paragraphSpacingAfter = spacing; m_flags |= wxTEXT_ATTR_PARA_SPACING_AFTER; } + void SetParagraphSpacingBefore(int spacing) { m_paragraphSpacingBefore = spacing; m_flags |= wxTEXT_ATTR_PARA_SPACING_BEFORE; } + void SetLineSpacing(int spacing) { m_lineSpacing = spacing; m_flags |= wxTEXT_ATTR_LINE_SPACING; } + void SetBulletStyle(int style) { m_bulletStyle = style; m_flags |= wxTEXT_ATTR_BULLET_STYLE; } + void SetBulletNumber(int n) { m_bulletNumber = n; m_flags |= wxTEXT_ATTR_BULLET_NUMBER; } + void SetBulletText(const wxString& text) { m_bulletText = text; m_flags |= wxTEXT_ATTR_BULLET_TEXT; } + void SetBulletFont(const wxString& bulletFont) { m_bulletFont = bulletFont; } + void SetBulletName(const wxString& name) { m_bulletName = name; m_flags |= wxTEXT_ATTR_BULLET_NAME; } + void SetURL(const wxString& url) { m_urlTarget = url; m_flags |= wxTEXT_ATTR_URL; } + void SetPageBreak(bool pageBreak = true) { SetFlags(pageBreak ? (GetFlags() | wxTEXT_ATTR_PAGE_BREAK) : (GetFlags() & ~wxTEXT_ATTR_PAGE_BREAK)); } + void SetTextEffects(int effects) { m_textEffects = effects; SetFlags(GetFlags() | wxTEXT_ATTR_EFFECTS); } + void SetTextEffectFlags(int effects) { m_textEffectFlags = effects; } + void SetOutlineLevel(int level) { m_outlineLevel = level; SetFlags(GetFlags() | wxTEXT_ATTR_OUTLINE_LEVEL); } + + const wxColour& GetTextColour() const { return m_colText; } + const wxColour& GetBackgroundColour() const { return m_colBack; } + wxTextAttrAlignment GetAlignment() const { return m_textAlignment; } + const wxArrayInt& GetTabs() const { return m_tabs; } + long GetLeftIndent() const { return m_leftIndent; } + long GetLeftSubIndent() const { return m_leftSubIndent; } + long GetRightIndent() const { return m_rightIndent; } + long GetFlags() const { return m_flags; } + + int GetFontSize() const { return m_fontSize; } + wxFontStyle GetFontStyle() const { return m_fontStyle; } + wxFontWeight GetFontWeight() const { return m_fontWeight; } + bool GetFontUnderlined() const { return m_fontUnderlineType != wxTEXT_ATTR_UNDERLINE_NONE; } + wxTextAttrUnderlineType GetUnderlineType() const { return m_fontUnderlineType; } + const wxColour& GetUnderlineColour() const { return m_colUnderline; } + bool GetFontStrikethrough() const { return m_fontStrikethrough; } + const wxString& GetFontFaceName() const { return m_fontFaceName; } + wxFontEncoding GetFontEncoding() const { return m_fontEncoding; } + wxFontFamily GetFontFamily() const { return m_fontFamily; } + + wxFont GetFont() const; + + const wxString& GetCharacterStyleName() const { return m_characterStyleName; } + const wxString& GetParagraphStyleName() const { return m_paragraphStyleName; } + const wxString& GetListStyleName() const { return m_listStyleName; } + int GetParagraphSpacingAfter() const { return m_paragraphSpacingAfter; } + int GetParagraphSpacingBefore() const { return m_paragraphSpacingBefore; } + + int GetLineSpacing() const { return m_lineSpacing; } + int GetBulletStyle() const { return m_bulletStyle; } + int GetBulletNumber() const { return m_bulletNumber; } + const wxString& GetBulletText() const { return m_bulletText; } + const wxString& GetBulletFont() const { return m_bulletFont; } + const wxString& GetBulletName() const { return m_bulletName; } + const wxString& GetURL() const { return m_urlTarget; } + int GetTextEffects() const { return m_textEffects; } + int GetTextEffectFlags() const { return m_textEffectFlags; } + int GetOutlineLevel() const { return m_outlineLevel; } + + // accessors + bool HasTextColour() const { return m_colText.IsOk() && HasFlag(wxTEXT_ATTR_TEXT_COLOUR) ; } + bool HasBackgroundColour() const { return m_colBack.IsOk() && HasFlag(wxTEXT_ATTR_BACKGROUND_COLOUR) ; } + bool HasAlignment() const { return (m_textAlignment != wxTEXT_ALIGNMENT_DEFAULT) && HasFlag(wxTEXT_ATTR_ALIGNMENT) ; } + bool HasTabs() const { return HasFlag(wxTEXT_ATTR_TABS) ; } + bool HasLeftIndent() const { return HasFlag(wxTEXT_ATTR_LEFT_INDENT); } + bool HasRightIndent() const { return HasFlag(wxTEXT_ATTR_RIGHT_INDENT); } + bool HasFontWeight() const { return HasFlag(wxTEXT_ATTR_FONT_WEIGHT); } + bool HasFontSize() const { return HasFlag(wxTEXT_ATTR_FONT_SIZE); } + bool HasFontPointSize() const { return HasFlag(wxTEXT_ATTR_FONT_POINT_SIZE); } + bool HasFontPixelSize() const { return HasFlag(wxTEXT_ATTR_FONT_PIXEL_SIZE); } + bool HasFontItalic() const { return HasFlag(wxTEXT_ATTR_FONT_ITALIC); } + bool HasFontUnderlined() const { return HasFlag(wxTEXT_ATTR_FONT_UNDERLINE); } + bool HasFontStrikethrough() const { return HasFlag(wxTEXT_ATTR_FONT_STRIKETHROUGH); } + bool HasFontFaceName() const { return HasFlag(wxTEXT_ATTR_FONT_FACE); } + bool HasFontEncoding() const { return HasFlag(wxTEXT_ATTR_FONT_ENCODING); } + bool HasFontFamily() const { return HasFlag(wxTEXT_ATTR_FONT_FAMILY); } + bool HasFont() const { return HasFlag(wxTEXT_ATTR_FONT); } + + bool HasParagraphSpacingAfter() const { return HasFlag(wxTEXT_ATTR_PARA_SPACING_AFTER); } + bool HasParagraphSpacingBefore() const { return HasFlag(wxTEXT_ATTR_PARA_SPACING_BEFORE); } + bool HasLineSpacing() const { return HasFlag(wxTEXT_ATTR_LINE_SPACING); } + bool HasCharacterStyleName() const { return HasFlag(wxTEXT_ATTR_CHARACTER_STYLE_NAME) && !m_characterStyleName.IsEmpty(); } + bool HasParagraphStyleName() const { return HasFlag(wxTEXT_ATTR_PARAGRAPH_STYLE_NAME) && !m_paragraphStyleName.IsEmpty(); } + bool HasListStyleName() const { return HasFlag(wxTEXT_ATTR_LIST_STYLE_NAME) || !m_listStyleName.IsEmpty(); } + bool HasBulletStyle() const { return HasFlag(wxTEXT_ATTR_BULLET_STYLE); } + bool HasBulletNumber() const { return HasFlag(wxTEXT_ATTR_BULLET_NUMBER); } + bool HasBulletText() const { return HasFlag(wxTEXT_ATTR_BULLET_TEXT); } + bool HasBulletName() const { return HasFlag(wxTEXT_ATTR_BULLET_NAME); } + bool HasURL() const { return HasFlag(wxTEXT_ATTR_URL); } + bool HasPageBreak() const { return HasFlag(wxTEXT_ATTR_PAGE_BREAK); } + bool HasTextEffects() const { return HasFlag(wxTEXT_ATTR_EFFECTS); } + bool HasTextEffect(int effect) const { return HasFlag(wxTEXT_ATTR_EFFECTS) && ((GetTextEffectFlags() & effect) != 0); } + bool HasOutlineLevel() const { return HasFlag(wxTEXT_ATTR_OUTLINE_LEVEL); } + + bool HasFlag(long flag) const { return (m_flags & flag) != 0; } + void RemoveFlag(long flag) { m_flags &= ~flag; } + void AddFlag(long flag) { m_flags |= flag; } + + // Is this a character style? + bool IsCharacterStyle() const { return HasFlag(wxTEXT_ATTR_CHARACTER); } + bool IsParagraphStyle() const { return HasFlag(wxTEXT_ATTR_PARAGRAPH); } + + // returns false if we have any attributes set, true otherwise + bool IsDefault() const + { + return GetFlags() == 0; + } + + // Merges the given attributes. If compareWith + // is non-NULL, then it will be used to mask out those attributes that are the same in style + // and compareWith, for situations where we don't want to explicitly set inherited attributes. + bool Apply(const wxTextAttr& style, const wxTextAttr* compareWith = NULL); + + // merges the attributes of the base and the overlay objects and returns + // the result; the parameter attributes take precedence + // + // WARNING: the order of arguments is the opposite of Combine() + static wxTextAttr Merge(const wxTextAttr& base, const wxTextAttr& overlay) + { + return Combine(overlay, base, NULL); + } + + // merges the attributes of this object and overlay + void Merge(const wxTextAttr& overlay) + { + *this = Merge(*this, overlay); + } + + // return the attribute having the valid font and colours: it uses the + // attributes set in attr and falls back first to attrDefault and then to + // the text control font/colours for those attributes which are not set + static wxTextAttr Combine(const wxTextAttr& attr, + const wxTextAttr& attrDef, + const wxTextCtrlBase *text); + + // Compare tabs + static bool TabsEq(const wxArrayInt& tabs1, const wxArrayInt& tabs2); + + // Remove attributes + static bool RemoveStyle(wxTextAttr& destStyle, const wxTextAttr& style); + + // Combine two bitlists, specifying the bits of interest with separate flags. + static bool CombineBitlists(int& valueA, int valueB, int& flagsA, int flagsB); + + // Compare two bitlists + static bool BitlistsEqPartial(int valueA, int valueB, int flags); + + // Split into paragraph and character styles + static bool SplitParaCharStyles(const wxTextAttr& style, wxTextAttr& parStyle, wxTextAttr& charStyle); + +private: + long m_flags; + + // Paragraph styles + wxArrayInt m_tabs; // array of int: tab stops in 1/10 mm + int m_leftIndent; // left indent in 1/10 mm + int m_leftSubIndent; // left indent for all but the first + // line in a paragraph relative to the + // first line, in 1/10 mm + int m_rightIndent; // right indent in 1/10 mm + wxTextAttrAlignment m_textAlignment; + + int m_paragraphSpacingAfter; + int m_paragraphSpacingBefore; + int m_lineSpacing; + int m_bulletStyle; + int m_bulletNumber; + int m_textEffects; + int m_textEffectFlags; + int m_outlineLevel; + wxString m_bulletText; + wxString m_bulletFont; + wxString m_bulletName; + wxString m_urlTarget; + wxFontEncoding m_fontEncoding; + + // Character styles + wxColour m_colText, + m_colBack; + int m_fontSize; + wxFontStyle m_fontStyle; + wxFontWeight m_fontWeight; + wxFontFamily m_fontFamily; + wxTextAttrUnderlineType m_fontUnderlineType; + wxColour m_colUnderline; + bool m_fontStrikethrough; + wxString m_fontFaceName; + + // Character style + wxString m_characterStyleName; + + // Paragraph style + wxString m_paragraphStyleName; + + // List style + wxString m_listStyleName; +}; + +// ---------------------------------------------------------------------------- +// wxTextAreaBase: multiline text control specific methods +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTextAreaBase +{ +public: + wxTextAreaBase() { } + virtual ~wxTextAreaBase() { } + + // lines access + // ------------ + + virtual int GetLineLength(long lineNo) const = 0; + virtual wxString GetLineText(long lineNo) const = 0; + virtual int GetNumberOfLines() const = 0; + + + // file IO + // ------- + + bool LoadFile(const wxString& file, int fileType = wxTEXT_TYPE_ANY) + { return DoLoadFile(file, fileType); } + bool SaveFile(const wxString& file = wxEmptyString, + int fileType = wxTEXT_TYPE_ANY); + + // dirty flag handling + // ------------------- + + virtual bool IsModified() const = 0; + virtual void MarkDirty() = 0; + virtual void DiscardEdits() = 0; + void SetModified(bool modified) + { + if ( modified ) + MarkDirty(); + else + DiscardEdits(); + } + + virtual void EmptyUndoBuffer() { } + + + // styles handling + // --------------- + + // text control under some platforms supports the text styles: these + // methods allow to apply the given text style to the given selection or to + // set/get the style which will be used for all appended text + virtual bool SetStyle(long start, long end, const wxTextAttr& style) = 0; + virtual bool GetStyle(long position, wxTextAttr& style) = 0; + virtual bool SetDefaultStyle(const wxTextAttr& style) = 0; + virtual const wxTextAttr& GetDefaultStyle() const { return m_defaultStyle; } + + + // coordinates translation + // ----------------------- + + // translate between the position (which is just an index in the text ctrl + // considering all its contents as a single strings) and (x, y) coordinates + // which represent column and line. + virtual long XYToPosition(long x, long y) const = 0; + virtual bool PositionToXY(long pos, long *x, long *y) const = 0; + + // translate the given position (which is just an index in the text control) + // to client coordinates + wxPoint PositionToCoords(long pos) const; + + + virtual void ShowPosition(long pos) = 0; + + // find the character at position given in pixels + // + // NB: pt is in device coords (not adjusted for the client area origin nor + // scrolling) + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const; + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, + wxTextCoord *col, + wxTextCoord *row) const; + virtual wxString GetValue() const = 0; + virtual void SetValue(const wxString& value) = 0; + +protected: + // implementation of loading/saving + virtual bool DoLoadFile(const wxString& file, int fileType); + virtual bool DoSaveFile(const wxString& file, int fileType); + + // Return true if the given position is valid, i.e. positive and less than + // the last position. + virtual bool IsValidPosition(long pos) const = 0; + + // Default stub implementation of PositionToCoords() always returns + // wxDefaultPosition. + virtual wxPoint DoPositionToCoords(long pos) const; + + // the name of the last file loaded with LoadFile() which will be used by + // SaveFile() by default + wxString m_filename; + + // the text style which will be used for any new text added to the control + wxTextAttr m_defaultStyle; + + + wxDECLARE_NO_COPY_CLASS(wxTextAreaBase); +}; + +// this class defines wxTextCtrl interface, wxTextCtrlBase actually implements +// too much things because it derives from wxTextEntry and not wxTextEntryBase +// and so any classes which "look like" wxTextCtrl (such as wxRichTextCtrl) +// but don't need the (native) implementation bits from wxTextEntry should +// actually derive from this one and not wxTextCtrlBase +class WXDLLIMPEXP_CORE wxTextCtrlIface : public wxTextAreaBase, + public wxTextEntryBase +{ +public: + wxTextCtrlIface() { } + + // wxTextAreaBase overrides + virtual wxString GetValue() const wxOVERRIDE + { + return wxTextEntryBase::GetValue(); + } + virtual void SetValue(const wxString& value) wxOVERRIDE + { + wxTextEntryBase::SetValue(value); + } + +protected: + virtual bool IsValidPosition(long pos) const wxOVERRIDE + { + return pos >= 0 && pos <= GetLastPosition(); + } + +private: + wxDECLARE_NO_COPY_CLASS(wxTextCtrlIface); +}; + +// ---------------------------------------------------------------------------- +// wxTextCtrl: a single or multiple line text zone where user can edit text +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTextCtrlBase : public wxControl, +#if wxHAS_TEXT_WINDOW_STREAM + public wxSTD streambuf, +#endif + public wxTextAreaBase, + public wxTextEntry +{ +public: + // creation + // -------- + + wxTextCtrlBase() { } + virtual ~wxTextCtrlBase() { } + + + // more readable flag testing methods + bool IsSingleLine() const { return !HasFlag(wxTE_MULTILINE); } + bool IsMultiLine() const { return !IsSingleLine(); } + + // stream-like insertion operators: these are always available, whether we + // were, or not, compiled with streambuf support + wxTextCtrl& operator<<(const wxString& s); + wxTextCtrl& operator<<(int i); + wxTextCtrl& operator<<(long i); + wxTextCtrl& operator<<(float f) { return *this << double(f); } + wxTextCtrl& operator<<(double d); + wxTextCtrl& operator<<(char c) { return *this << wxString(c); } + wxTextCtrl& operator<<(wchar_t c) { return *this << wxString(c); } + + // insert the character which would have resulted from this key event, + // return true if anything has been inserted + virtual bool EmulateKeyPress(const wxKeyEvent& event); + + + // do the window-specific processing after processing the update event + virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) wxOVERRIDE; + + virtual bool ShouldInheritColours() const wxOVERRIDE { return false; } + + // work around the problem with having HitTest() both in wxControl and + // wxTextAreaBase base classes + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const wxOVERRIDE + { + return wxTextAreaBase::HitTest(pt, pos); + } + + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, + wxTextCoord *col, + wxTextCoord *row) const wxOVERRIDE + { + return wxTextAreaBase::HitTest(pt, col, row); + } + + // we provide stubs for these functions as not all platforms have styles + // support, but we really should leave them pure virtual here + virtual bool SetStyle(long start, long end, const wxTextAttr& style) wxOVERRIDE; + virtual bool GetStyle(long position, wxTextAttr& style) wxOVERRIDE; + virtual bool SetDefaultStyle(const wxTextAttr& style) wxOVERRIDE; + + // wxTextAreaBase overrides + virtual wxString GetValue() const wxOVERRIDE + { + return wxTextEntry::GetValue(); + } + virtual void SetValue(const wxString& value) wxOVERRIDE + { + wxTextEntry::SetValue(value); + } + + // wxWindow overrides + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL) + { + return GetCompositeControlsDefaultAttributes(variant); + } + + virtual const wxTextEntry* WXGetTextEntry() const wxOVERRIDE { return this; } + +#if wxUSE_SPELLCHECK + // Use native spelling and grammar checking functions. + virtual bool EnableProofCheck(const wxTextProofOptions& WXUNUSED(options) + = wxTextProofOptions::Default()) + { + return false; + } + virtual wxTextProofOptions GetProofCheckOptions() const + { + return wxTextProofOptions::Disable(); + } +#endif // wxUSE_SPELLCHECK + +protected: + // Override wxEvtHandler method to check for a common problem of binding + // wxEVT_TEXT_ENTER to a control without wxTE_PROCESS_ENTER style, which is + // never going to work. + virtual bool OnDynamicBind(wxDynamicEventTableEntry& entry) wxOVERRIDE; + + // override streambuf method +#if wxHAS_TEXT_WINDOW_STREAM + int overflow(int i) wxOVERRIDE; +#endif // wxHAS_TEXT_WINDOW_STREAM + + // Another wxTextAreaBase override. + virtual bool IsValidPosition(long pos) const wxOVERRIDE + { + return pos >= 0 && pos <= GetLastPosition(); + } + + // implement the wxTextEntry pure virtual method + virtual wxWindow *GetEditableWindow() wxOVERRIDE { return this; } + + wxDECLARE_NO_COPY_CLASS(wxTextCtrlBase); + wxDECLARE_ABSTRACT_CLASS(wxTextCtrlBase); +}; + +// ---------------------------------------------------------------------------- +// include the platform-dependent class definition +// ---------------------------------------------------------------------------- + +#if defined(__WXX11__) + #include "wx/x11/textctrl.h" +#elif defined(__WXUNIVERSAL__) + #include "wx/univ/textctrl.h" +#elif defined(__WXMSW__) + #include "wx/msw/textctrl.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/textctrl.h" +#elif defined(__WXGTK20__) + #include "wx/gtk/textctrl.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/textctrl.h" +#elif defined(__WXMAC__) + #include "wx/osx/textctrl.h" +#elif defined(__WXQT__) + #include "wx/qt/textctrl.h" +#endif + +// ---------------------------------------------------------------------------- +// wxTextCtrl events +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxTextUrlEvent; + +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT_ENTER, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT_URL, wxTextUrlEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT_MAXLEN, wxCommandEvent); + +class WXDLLIMPEXP_CORE wxTextUrlEvent : public wxCommandEvent +{ +public: + wxTextUrlEvent(int winid, const wxMouseEvent& evtMouse, + long start, long end) + : wxCommandEvent(wxEVT_TEXT_URL, winid), + m_evtMouse(evtMouse), m_start(start), m_end(end) + { } + wxTextUrlEvent(const wxTextUrlEvent& event) + : wxCommandEvent(event), + m_evtMouse(event.m_evtMouse), + m_start(event.m_start), + m_end(event.m_end) { } + + // get the mouse event which happened over the URL + const wxMouseEvent& GetMouseEvent() const { return m_evtMouse; } + + // get the start of the URL + long GetURLStart() const { return m_start; } + + // get the end of the URL + long GetURLEnd() const { return m_end; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxTextUrlEvent(*this); } + +protected: + // the corresponding mouse event + wxMouseEvent m_evtMouse; + + // the start and end indices of the URL in the text control + long m_start, + m_end; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxTextUrlEvent); + +public: + // for wxWin RTTI only, don't use + wxTextUrlEvent() : m_evtMouse(), m_start(0), m_end(0) { } +}; + +typedef void (wxEvtHandler::*wxTextUrlEventFunction)(wxTextUrlEvent&); + +#define wxTextEventHandler(func) wxCommandEventHandler(func) +#define wxTextUrlEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxTextUrlEventFunction, func) + +#define wx__DECLARE_TEXTEVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_TEXT_ ## evt, id, wxTextEventHandler(fn)) + +#define wx__DECLARE_TEXTURLEVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_TEXT_ ## evt, id, wxTextUrlEventHandler(fn)) + +#define EVT_TEXT(id, fn) wx__DECLARE_EVT1(wxEVT_TEXT, id, wxTextEventHandler(fn)) +#define EVT_TEXT_ENTER(id, fn) wx__DECLARE_TEXTEVT(ENTER, id, fn) +#define EVT_TEXT_URL(id, fn) wx__DECLARE_TEXTURLEVT(URL, id, fn) +#define EVT_TEXT_MAXLEN(id, fn) wx__DECLARE_TEXTEVT(MAXLEN, id, fn) + +#if wxHAS_TEXT_WINDOW_STREAM + +// ---------------------------------------------------------------------------- +// wxStreamToTextRedirector: this class redirects all data sent to the given +// C++ stream to the wxTextCtrl given to its ctor during its lifetime. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxStreamToTextRedirector +{ +private: + void Init(wxTextCtrl *text) + { + m_sbufOld = m_ostr.rdbuf(); + m_ostr.rdbuf(text); + } + +public: + wxStreamToTextRedirector(wxTextCtrl *text) + : m_ostr(wxSTD cout) + { + Init(text); + } + + wxStreamToTextRedirector(wxTextCtrl *text, wxSTD ostream *ostr) + : m_ostr(*ostr) + { + Init(text); + } + + ~wxStreamToTextRedirector() + { + m_ostr.rdbuf(m_sbufOld); + } + +private: + // the stream we're redirecting + wxSTD ostream& m_ostr; + + // the old streambuf (before we changed it) + wxSTD streambuf *m_sbufOld; +}; + +#endif // wxHAS_TEXT_WINDOW_STREAM + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_TEXT_UPDATED wxEVT_TEXT +#define wxEVT_COMMAND_TEXT_ENTER wxEVT_TEXT_ENTER +#define wxEVT_COMMAND_TEXT_URL wxEVT_TEXT_URL +#define wxEVT_COMMAND_TEXT_MAXLEN wxEVT_TEXT_MAXLEN + +#endif // wxUSE_TEXTCTRL + +#endif + // _WX_TEXTCTRL_H_BASE_ diff --git a/lib/wxWidgets/include/wx/textdlg.h b/lib/wxWidgets/include/wx/textdlg.h new file mode 100644 index 0000000..509b700 --- /dev/null +++ b/lib/wxWidgets/include/wx/textdlg.h @@ -0,0 +1,17 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/textdlg.h +// Purpose: wxTextEntryDialog class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TEXTDLG_H_BASE_ +#define _WX_TEXTDLG_H_BASE_ + +#include "wx/generic/textdlgg.h" + +#endif // _WX_TEXTDLG_H_BASE_ + diff --git a/lib/wxWidgets/include/wx/textentry.h b/lib/wxWidgets/include/wx/textentry.h new file mode 100644 index 0000000..1147439 --- /dev/null +++ b/lib/wxWidgets/include/wx/textentry.h @@ -0,0 +1,348 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/textentry.h +// Purpose: declares wxTextEntry interface defining a simple text entry +// Author: Vadim Zeitlin +// Created: 2007-09-24 +// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TEXTENTRY_H_ +#define _WX_TEXTENTRY_H_ + +// wxTextPos is the position in the text (currently it's hardly used anywhere +// and should probably be replaced with int anyhow) +typedef long wxTextPos; + +class WXDLLIMPEXP_FWD_BASE wxArrayString; +class WXDLLIMPEXP_FWD_CORE wxTextCompleter; +class WXDLLIMPEXP_FWD_CORE wxTextEntryHintData; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +#include "wx/filefn.h" // for wxFILE and wxDIR only +#include "wx/gdicmn.h" // for wxPoint + +// ---------------------------------------------------------------------------- +// wxTextEntryBase +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTextEntryBase +{ +public: + wxTextEntryBase() { m_eventsBlock = 0; m_hintData = NULL; } + virtual ~wxTextEntryBase(); + + + // accessing the value + // ------------------- + + // SetValue() generates a text change event, ChangeValue() doesn't + virtual void SetValue(const wxString& value) + { DoSetValue(value, SetValue_SendEvent); } + virtual void ChangeValue(const wxString& value); + + // writing text inserts it at the current position replacing any current + // selection, appending always inserts it at the end and doesn't remove any + // existing text (but it will reset the selection if there is any) + virtual void WriteText(const wxString& text) = 0; + virtual void AppendText(const wxString& text); + + virtual wxString GetValue() const; + virtual wxString GetRange(long from, long to) const; + bool IsEmpty() const { return GetLastPosition() <= 0; } + + + // editing operations + // ------------------ + + virtual void Replace(long from, long to, const wxString& value); + virtual void Remove(long from, long to) = 0; + virtual void Clear() { Remove(0, -1); } + void RemoveSelection(); + + + // clipboard operations + // -------------------- + + virtual void Copy() = 0; + virtual void Cut() = 0; + virtual void Paste() = 0; + + virtual bool CanCopy() const; + virtual bool CanCut() const; + virtual bool CanPaste() const; + + // undo/redo + // --------- + + virtual void Undo() = 0; + virtual void Redo() = 0; + + virtual bool CanUndo() const = 0; + virtual bool CanRedo() const = 0; + + + // insertion point + // --------------- + + // note that moving insertion point removes any current selection + virtual void SetInsertionPoint(long pos) = 0; + virtual void SetInsertionPointEnd() { SetInsertionPoint(-1); } + virtual long GetInsertionPoint() const = 0; + virtual long GetLastPosition() const = 0; + + + // selection + // --------- + + virtual void SetSelection(long from, long to) = 0; + virtual void SelectAll() { SetSelection(-1, -1); } + virtual void SelectNone() + { const long pos = GetInsertionPoint(); SetSelection(pos, pos); } + virtual void GetSelection(long *from, long *to) const = 0; + bool HasSelection() const; + virtual wxString GetStringSelection() const; + + + // auto-completion + // --------------- + + // these functions allow to auto-complete the text already entered into the + // control using either the given fixed list of strings, the paths from the + // file system or an arbitrary user-defined completer + // + // they all return true if completion was enabled or false on error (most + // commonly meaning that this functionality is not available under the + // current platform) + + bool AutoComplete(const wxArrayString& choices) + { return DoAutoCompleteStrings(choices); } + + bool AutoCompleteFileNames() + { return DoAutoCompleteFileNames(wxFILE); } + + bool AutoCompleteDirectories() + { return DoAutoCompleteFileNames(wxDIR); } + + // notice that we take ownership of the pointer and will delete it + // + // if the pointer is NULL auto-completion is disabled + bool AutoComplete(wxTextCompleter *completer) + { return DoAutoCompleteCustom(completer); } + + + // status + // ------ + + virtual bool IsEditable() const = 0; + virtual void SetEditable(bool editable) = 0; + + + // input restrictions + // ------------------ + + // set the max number of characters which may be entered in a single line + // text control + virtual void SetMaxLength(unsigned long WXUNUSED(len)) { } + + // convert any lower-case characters to upper-case on the fly in this entry + virtual void ForceUpper(); + + + // hints + // ----- + + // hint is the (usually greyed out) text shown in the control as long as + // it's empty and doesn't have focus, it is typically used in controls used + // for searching to let the user know what is supposed to be entered there + + virtual bool SetHint(const wxString& hint); + virtual wxString GetHint() const; + + + // margins + // ------- + + // margins are the empty space between borders of control and the text + // itself. When setting margin, use value -1 to indicate that specific + // margin should not be changed. + + bool SetMargins(const wxPoint& pt) + { return DoSetMargins(pt); } + bool SetMargins(wxCoord left, wxCoord top = -1) + { return DoSetMargins(wxPoint(left, top)); } + wxPoint GetMargins() const + { return DoGetMargins(); } + + + // implementation only + // ------------------- + + // generate the wxEVT_TEXT event for GetEditableWindow(), + // like SetValue() does and return true if the event was processed + // + // NB: this is public for wxRichTextCtrl use only right now, do not call it + static bool SendTextUpdatedEvent(wxWindow *win); + + // generate the wxEVT_TEXT event for this window + bool SendTextUpdatedEvent() + { + return SendTextUpdatedEvent(GetEditableWindow()); + } + + + // generate the wxEVT_TEXT event for this window if the + // events are not currently disabled + void SendTextUpdatedEventIfAllowed() + { + if ( EventsAllowed() ) + SendTextUpdatedEvent(); + } + + // this function is provided solely for the purpose of forwarding text + // change notifications state from one control to another, e.g. it can be + // used by a wxComboBox which derives from wxTextEntry if it delegates all + // of its methods to another wxTextCtrl + void ForwardEnableTextChangedEvents(bool enable) + { + // it's important to call the functions which update m_eventsBlock here + // and not just our own EnableTextChangedEvents() because our state + // (i.e. the result of EventsAllowed()) must change as well + if ( enable ) + ResumeTextChangedEvents(); + else + SuppressTextChangedEvents(); + } + + // change the entry value to be in upper case only, if needed (i.e. if it's + // not already the case) + void ConvertToUpperCase(); + +protected: + // flags for DoSetValue(): common part of SetValue() and ChangeValue() and + // also used to implement WriteText() in wxMSW + enum + { + SetValue_NoEvent = 0, + SetValue_SendEvent = 1, + SetValue_SelectionOnly = 2 + }; + + virtual void DoSetValue(const wxString& value, int flags); + virtual wxString DoGetValue() const = 0; + + // override this to return the associated window, it will be used for event + // generation and also by generic hints implementation + virtual wxWindow *GetEditableWindow() = 0; + + // margins functions + virtual bool DoSetMargins(const wxPoint& pt); + virtual wxPoint DoGetMargins() const; + + // the derived classes should override these virtual methods to implement + // auto-completion, they do the same thing as their public counterparts but + // have different names to allow overriding just one of them without hiding + // the other one(s) + virtual bool DoAutoCompleteStrings(const wxArrayString& WXUNUSED(choices)) + { return false; } + virtual bool DoAutoCompleteFileNames(int WXUNUSED(flags)) // wxFILE | wxDIR + { return false; } + virtual bool DoAutoCompleteCustom(wxTextCompleter *completer); + + + // Stub virtual functions for forward binary compatibility. DO NOT USE. + virtual void* WXReservedTextEntry1(void*); + virtual void* WXReservedTextEntry2(void*); + virtual void* WXReservedTextEntry3(void*); + + + // class which should be used to temporarily disable text change events + // + // if suppress argument in ctor is false, nothing is done + class EventsSuppressor + { + public: + EventsSuppressor(wxTextEntryBase *text, bool suppress = true) + : m_text(text), + m_suppress(suppress) + { + if ( m_suppress ) + m_text->SuppressTextChangedEvents(); + } + + ~EventsSuppressor() + { + if ( m_suppress ) + m_text->ResumeTextChangedEvents(); + } + + private: + wxTextEntryBase *m_text; + bool m_suppress; + }; + + friend class EventsSuppressor; + +private: + // suppress or resume the text changed events generation: don't use these + // functions directly, use EventsSuppressor class above instead + void SuppressTextChangedEvents() + { + if ( !m_eventsBlock++ ) + EnableTextChangedEvents(false); + } + + void ResumeTextChangedEvents() + { + if ( !--m_eventsBlock ) + EnableTextChangedEvents(true); + } + + + // this must be overridden in the derived classes if our implementation of + // SetValue() or Replace() is used to disable (and enable back) generation + // of the text changed events + // + // initially the generation of the events is enabled + virtual void EnableTextChangedEvents(bool WXUNUSED(enable)) { } + + // return true if the events are currently not suppressed + bool EventsAllowed() const { return m_eventsBlock == 0; } + + + // if this counter is non-null, events are blocked + unsigned m_eventsBlock; + + // hint-related stuff, only allocated if/when SetHint() is used + wxTextEntryHintData *m_hintData; + + // It needs to call our Do{Get,Set}Value() to work with the real control + // contents. + friend class wxTextEntryHintData; +}; + +#ifdef __WXUNIVERSAL__ + // TODO: we need to use wxTextEntryDelegate here, but for now just prevent + // the GTK/MSW classes from being used in wxUniv build + class WXDLLIMPEXP_CORE wxTextEntry : public wxTextEntryBase + { + }; +#elif defined(__WXGTK20__) + #include "wx/gtk/textentry.h" +#elif defined(__WXMAC__) + #include "wx/osx/textentry.h" +#elif defined(__WXMSW__) + #include "wx/msw/textentry.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/textentry.h" +#elif defined(__WXQT__) + #include "wx/qt/textentry.h" +#else + // no platform-specific implementation of wxTextEntry yet + class WXDLLIMPEXP_CORE wxTextEntry : public wxTextEntryBase + { + }; +#endif + +#endif // _WX_TEXTENTRY_H_ + diff --git a/lib/wxWidgets/include/wx/textfile.h b/lib/wxWidgets/include/wx/textfile.h new file mode 100644 index 0000000..64fefeb --- /dev/null +++ b/lib/wxWidgets/include/wx/textfile.h @@ -0,0 +1,61 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/textfile.h +// Purpose: class wxTextFile to work with text files of _small_ size +// (file is fully loaded in memory) and which understands CR/LF +// differences between platforms. +// Author: Vadim Zeitlin +// Modified by: +// Created: 03.04.98 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TEXTFILE_H +#define _WX_TEXTFILE_H + +#include "wx/defs.h" + +#include "wx/textbuf.h" + +#if wxUSE_TEXTFILE + +#include "wx/file.h" + +// ---------------------------------------------------------------------------- +// wxTextFile +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxTextFile : public wxTextBuffer +{ +public: + // constructors + wxTextFile() { } + wxTextFile(const wxString& strFileName); + +protected: + // implement the base class pure virtuals + virtual bool OnExists() const wxOVERRIDE; + virtual bool OnOpen(const wxString &strBufferName, + wxTextBufferOpenMode openMode) wxOVERRIDE; + virtual bool OnClose() wxOVERRIDE; + virtual bool OnRead(const wxMBConv& conv) wxOVERRIDE; + virtual bool OnWrite(wxTextFileType typeNew, const wxMBConv& conv) wxOVERRIDE; + +private: + + wxFile m_file; + + wxDECLARE_NO_COPY_CLASS(wxTextFile); +}; + +#else // !wxUSE_TEXTFILE + +// old code relies on the static methods of wxTextFile being always available +// and they still are available in wxTextBuffer (even if !wxUSE_TEXTBUFFER), so +// make it possible to use them in a backwards compatible way +typedef wxTextBuffer wxTextFile; + +#endif // wxUSE_TEXTFILE/!wxUSE_TEXTFILE + +#endif // _WX_TEXTFILE_H + diff --git a/lib/wxWidgets/include/wx/textwrapper.h b/lib/wxWidgets/include/wx/textwrapper.h new file mode 100644 index 0000000..02e37bd --- /dev/null +++ b/lib/wxWidgets/include/wx/textwrapper.h @@ -0,0 +1,128 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/textwrapper.h +// Purpose: declaration of wxTextWrapper class +// Author: Vadim Zeitlin +// Created: 2009-05-31 (extracted from dlgcmn.cpp via wx/private/stattext.h) +// Copyright: (c) 1999, 2009 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TEXTWRAPPER_H_ +#define _WX_TEXTWRAPPER_H_ + +#include "wx/window.h" + +// ---------------------------------------------------------------------------- +// wxTextWrapper +// ---------------------------------------------------------------------------- + +// this class is used to wrap the text on word boundary: wrapping is done by +// calling OnStartLine() and OnOutputLine() functions +class WXDLLIMPEXP_CORE wxTextWrapper +{ +public: + wxTextWrapper() { m_eol = false; } + + // win is used for getting the font, text is the text to wrap, width is the + // max line width or -1 to disable wrapping + void Wrap(wxWindow *win, const wxString& text, int widthMax); + + // we don't need it, but just to avoid compiler warnings + virtual ~wxTextWrapper() { } + +protected: + // line may be empty + virtual void OnOutputLine(const wxString& line) = 0; + + // called at the start of every new line (except the very first one) + virtual void OnNewLine() { } + +private: + // call OnOutputLine() and set m_eol to true + void DoOutputLine(const wxString& line) + { + OnOutputLine(line); + + m_eol = true; + } + + // this function is a destructive inspector: when it returns true it also + // resets the flag to false so calling it again wouldn't return true any + // more + bool IsStartOfNewLine() + { + if ( !m_eol ) + return false; + + m_eol = false; + + return true; + } + + + bool m_eol; + + wxDECLARE_NO_COPY_CLASS(wxTextWrapper); +}; + +#if wxUSE_STATTEXT + +#include "wx/sizer.h" +#include "wx/stattext.h" + +// A class creating a sizer with one static text per line of text. Creation of +// the controls used for each line can be customized by overriding +// OnCreateLine() function. +// +// This class is currently private to wxWidgets and used only by wxDialog +// itself. We may make it public later if there is sufficient interest. +class wxTextSizerWrapper : public wxTextWrapper +{ +public: + wxTextSizerWrapper(wxWindow *win) + { + m_win = win; + m_hLine = 0; + } + + wxSizer *CreateSizer(const wxString& text, int widthMax) + { + m_sizer = new wxBoxSizer(wxVERTICAL); + Wrap(m_win, text, widthMax); + return m_sizer; + } + + wxWindow *GetParent() const { return m_win; } + +protected: + virtual wxWindow *OnCreateLine(const wxString& line) + { + return new wxStaticText(m_win, wxID_ANY, + wxControl::EscapeMnemonics(line)); + } + + virtual void OnOutputLine(const wxString& line) wxOVERRIDE + { + if ( !line.empty() ) + { + m_sizer->Add(OnCreateLine(line)); + } + else // empty line, no need to create a control for it + { + if ( !m_hLine ) + m_hLine = m_win->GetCharHeight(); + + m_sizer->Add(5, m_hLine); + } + } + +private: + wxWindow *m_win; + wxSizer *m_sizer; + int m_hLine; +}; + +#endif // wxUSE_STATTEXT + +#endif // _WX_TEXTWRAPPER_H_ + diff --git a/lib/wxWidgets/include/wx/tglbtn.h b/lib/wxWidgets/include/wx/tglbtn.h new file mode 100644 index 0000000..bb11446 --- /dev/null +++ b/lib/wxWidgets/include/wx/tglbtn.h @@ -0,0 +1,99 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/tglbtn.h +// Purpose: This dummy header includes the proper header file for the +// system we're compiling under. +// Author: John Norris, minor changes by Axel Schlueter +// Modified by: +// Created: 08.02.01 +// Copyright: (c) 2000 Johnny C. Norris II +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TOGGLEBUTTON_H_BASE_ +#define _WX_TOGGLEBUTTON_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_TOGGLEBTN + +#include "wx/event.h" +#include "wx/anybutton.h" // base class + +extern WXDLLIMPEXP_DATA_CORE(const char) wxCheckBoxNameStr[]; + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TOGGLEBUTTON, wxCommandEvent ); + +// ---------------------------------------------------------------------------- +// wxToggleButtonBase +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxToggleButtonBase : public wxAnyButton +{ +public: + wxToggleButtonBase() { } + + // Get/set the value + virtual void SetValue(bool state) = 0; + virtual bool GetValue() const = 0; + + // The current "normal" state for the toggle button depends upon its value. + virtual State GetNormalState() const wxOVERRIDE + { + return GetValue() ? State_Pressed : State_Normal; + } + + void UpdateWindowUI(long flags) wxOVERRIDE + { + wxControl::UpdateWindowUI(flags); + + if ( !IsShown() ) + return; + + wxWindow *tlw = wxGetTopLevelParent( this ); + if (tlw && wxPendingDelete.Member( tlw )) + return; + + wxUpdateUIEvent event( GetId() ); + event.SetEventObject(this); + + if (GetEventHandler()->ProcessEvent(event) ) + { + if ( event.GetSetChecked() ) + SetValue( event.GetChecked() ); + } + } + +protected: + wxDECLARE_NO_COPY_CLASS(wxToggleButtonBase); +}; + + +#define EVT_TOGGLEBUTTON(id, fn) \ + wx__DECLARE_EVT1(wxEVT_TOGGLEBUTTON, id, wxCommandEventHandler(fn)) + +#if defined(__WXUNIVERSAL__) + #include "wx/univ/tglbtn.h" +#elif defined(__WXMSW__) + #include "wx/msw/tglbtn.h" + #define wxHAS_BITMAPTOGGLEBUTTON +#elif defined(__WXGTK20__) + #include "wx/gtk/tglbtn.h" + #define wxHAS_BITMAPTOGGLEBUTTON +#elif defined(__WXGTK__) + #include "wx/gtk1/tglbtn.h" +# elif defined(__WXMOTIF__) + #include "wx/motif/tglbtn.h" +#elif defined(__WXMAC__) + #include "wx/osx/tglbtn.h" + #define wxHAS_BITMAPTOGGLEBUTTON +#elif defined(__WXQT__) + #include "wx/qt/tglbtn.h" +#endif + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_TOGGLEBUTTON_CLICKED wxEVT_TOGGLEBUTTON + +#endif // wxUSE_TOGGLEBTN + +#endif // _WX_TOGGLEBUTTON_H_BASE_ + diff --git a/lib/wxWidgets/include/wx/thread.h b/lib/wxWidgets/include/wx/thread.h new file mode 100644 index 0000000..487c8ff --- /dev/null +++ b/lib/wxWidgets/include/wx/thread.h @@ -0,0 +1,873 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/thread.h +// Purpose: Thread API +// Author: Guilhem Lavaux +// Modified by: Vadim Zeitlin (modifications partly inspired by omnithreads +// package from Olivetti & Oracle Research Laboratory) +// Created: 04/13/98 +// Copyright: (c) Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_THREAD_H_ +#define _WX_THREAD_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// get the value of wxUSE_THREADS configuration flag +#include "wx/defs.h" + +#if wxUSE_THREADS + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +enum wxMutexError +{ + wxMUTEX_NO_ERROR = 0, // operation completed successfully + wxMUTEX_INVALID, // mutex hasn't been initialized + wxMUTEX_DEAD_LOCK, // mutex is already locked by the calling thread + wxMUTEX_BUSY, // mutex is already locked by another thread + wxMUTEX_UNLOCKED, // attempt to unlock a mutex which is not locked + wxMUTEX_TIMEOUT, // LockTimeout() has timed out + wxMUTEX_MISC_ERROR // any other error +}; + +enum wxCondError +{ + wxCOND_NO_ERROR = 0, + wxCOND_INVALID, + wxCOND_TIMEOUT, // WaitTimeout() has timed out + wxCOND_MISC_ERROR +}; + +enum wxSemaError +{ + wxSEMA_NO_ERROR = 0, + wxSEMA_INVALID, // semaphore hasn't been initialized successfully + wxSEMA_BUSY, // returned by TryWait() if Wait() would block + wxSEMA_TIMEOUT, // returned by WaitTimeout() + wxSEMA_OVERFLOW, // Post() would increase counter past the max + wxSEMA_MISC_ERROR +}; + +enum wxThreadError +{ + wxTHREAD_NO_ERROR = 0, // No error + wxTHREAD_NO_RESOURCE, // No resource left to create a new thread + wxTHREAD_RUNNING, // The thread is already running + wxTHREAD_NOT_RUNNING, // The thread isn't running + wxTHREAD_KILLED, // Thread we waited for had to be killed + wxTHREAD_MISC_ERROR // Some other error +}; + +enum wxThreadKind +{ + wxTHREAD_DETACHED, + wxTHREAD_JOINABLE +}; + +enum wxThreadWait +{ + wxTHREAD_WAIT_BLOCK, + wxTHREAD_WAIT_YIELD, // process events while waiting; MSW only + + // For compatibility reasons we use wxTHREAD_WAIT_YIELD by default as this + // was the default behaviour of wxMSW 2.8 but it should be avoided as it's + // dangerous and not portable. +#if WXWIN_COMPATIBILITY_2_8 + wxTHREAD_WAIT_DEFAULT = wxTHREAD_WAIT_YIELD +#else + wxTHREAD_WAIT_DEFAULT = wxTHREAD_WAIT_BLOCK +#endif +}; + +// Obsolete synonyms for wxPRIORITY_XXX for backwards compatibility-only +enum +{ + WXTHREAD_MIN_PRIORITY = wxPRIORITY_MIN, + WXTHREAD_DEFAULT_PRIORITY = wxPRIORITY_DEFAULT, + WXTHREAD_MAX_PRIORITY = wxPRIORITY_MAX +}; + +// There are 2 types of mutexes: normal mutexes and recursive ones. The attempt +// to lock a normal mutex by a thread which already owns it results in +// undefined behaviour (it always works under Windows, it will almost always +// result in a deadlock under Unix). Locking a recursive mutex in such +// situation always succeeds and it must be unlocked as many times as it has +// been locked. +// +// However recursive mutexes have several important drawbacks: first, in the +// POSIX implementation, they're less efficient. Second, and more importantly, +// they CANNOT BE USED WITH CONDITION VARIABLES under Unix! Using them with +// wxCondition will work under Windows and some Unices (notably Linux) but will +// deadlock under other Unix versions (e.g. Solaris). As it might be difficult +// to ensure that a recursive mutex is not used with wxCondition, it is a good +// idea to avoid using recursive mutexes at all. Also, the last problem with +// them is that some (older) Unix versions don't support this at all -- which +// results in a configure warning when building and a deadlock when using them. +enum wxMutexType +{ + // normal mutex: try to always use this one + wxMUTEX_DEFAULT, + + // recursive mutex: don't use these ones with wxCondition + wxMUTEX_RECURSIVE +}; + +// forward declarations +class WXDLLIMPEXP_FWD_BASE wxThreadHelper; +class WXDLLIMPEXP_FWD_BASE wxConditionInternal; +class WXDLLIMPEXP_FWD_BASE wxMutexInternal; +class WXDLLIMPEXP_FWD_BASE wxSemaphoreInternal; +class WXDLLIMPEXP_FWD_BASE wxThreadInternal; + +// ---------------------------------------------------------------------------- +// A mutex object is a synchronization object whose state is set to signaled +// when it is not owned by any thread, and nonsignaled when it is owned. Its +// name comes from its usefulness in coordinating mutually-exclusive access to +// a shared resource. Only one thread at a time can own a mutex object. +// ---------------------------------------------------------------------------- + +// you should consider wxMutexLocker whenever possible instead of directly +// working with wxMutex class - it is safer +class WXDLLIMPEXP_BASE wxMutex +{ +public: + // constructor & destructor + // ------------------------ + + // create either default (always safe) or recursive mutex + wxMutex(wxMutexType mutexType = wxMUTEX_DEFAULT); + + // destroys the mutex kernel object + ~wxMutex(); + + // test if the mutex has been created successfully + bool IsOk() const; + + // mutex operations + // ---------------- + + // Lock the mutex, blocking on it until it is unlocked by the other thread. + // The result of locking a mutex already locked by the current thread + // depend on the mutex type. + // + // The caller must call Unlock() later if Lock() returned wxMUTEX_NO_ERROR. + wxMutexError Lock(); + + // Same as Lock() but return wxMUTEX_TIMEOUT if the mutex can't be locked + // during the given number of milliseconds + wxMutexError LockTimeout(unsigned long ms); + + // Try to lock the mutex: if it is currently locked, return immediately + // with an error. Otherwise the caller must call Unlock(). + wxMutexError TryLock(); + + // Unlock the mutex. It is an error to unlock an already unlocked mutex + wxMutexError Unlock(); + +protected: + wxMutexInternal *m_internal; + + friend class wxConditionInternal; + + wxDECLARE_NO_COPY_CLASS(wxMutex); +}; + +// a helper class which locks the mutex in the ctor and unlocks it in the dtor: +// this ensures that mutex is always unlocked, even if the function returns or +// throws an exception before it reaches the end +class WXDLLIMPEXP_BASE wxMutexLocker +{ +public: + // lock the mutex in the ctor + wxMutexLocker(wxMutex& mutex) + : m_isOk(false), m_mutex(mutex) + { m_isOk = ( m_mutex.Lock() == wxMUTEX_NO_ERROR ); } + + // returns true if mutex was successfully locked in ctor + bool IsOk() const + { return m_isOk; } + + // unlock the mutex in dtor + ~wxMutexLocker() + { if ( IsOk() ) m_mutex.Unlock(); } + +private: + // no assignment operator nor copy ctor + wxMutexLocker(const wxMutexLocker&); + wxMutexLocker& operator=(const wxMutexLocker&); + + bool m_isOk; + wxMutex& m_mutex; +}; + +// ---------------------------------------------------------------------------- +// Critical section: this is the same as mutex but is only visible to the +// threads of the same process. For the platforms which don't have native +// support for critical sections, they're implemented entirely in terms of +// mutexes. +// +// NB: wxCriticalSection object does not allocate any memory in its ctor +// which makes it possible to have static globals of this class +// ---------------------------------------------------------------------------- + +// in order to avoid any overhead under platforms where critical sections are +// just mutexes make all wxCriticalSection class functions inline +#if !defined(__WINDOWS__) + #define wxCRITSECT_IS_MUTEX 1 + + #define wxCRITSECT_INLINE WXEXPORT inline +#else // MSW + #define wxCRITSECT_IS_MUTEX 0 + + #define wxCRITSECT_INLINE +#endif // MSW/!MSW + +enum wxCriticalSectionType +{ + // recursive critical section + wxCRITSEC_DEFAULT, + + // non-recursive critical section + wxCRITSEC_NON_RECURSIVE +}; + +// you should consider wxCriticalSectionLocker whenever possible instead of +// directly working with wxCriticalSection class - it is safer +class WXDLLIMPEXP_BASE wxCriticalSection +{ +public: + // ctor & dtor + wxCRITSECT_INLINE wxCriticalSection( wxCriticalSectionType critSecType = wxCRITSEC_DEFAULT ); + wxCRITSECT_INLINE ~wxCriticalSection(); + // enter the section (the same as locking a mutex) + wxCRITSECT_INLINE void Enter(); + + // try to enter the section (the same as trying to lock a mutex) + wxCRITSECT_INLINE bool TryEnter(); + + // leave the critical section (same as unlocking a mutex) + wxCRITSECT_INLINE void Leave(); + +private: +#if wxCRITSECT_IS_MUTEX + wxMutex m_mutex; +#elif defined(__WINDOWS__) + // we can't allocate any memory in the ctor, so use placement new - + // unfortunately, we have to hardcode the sizeof() here because we can't + // include windows.h from this public header and we also have to use the + // union to force the correct (i.e. maximal) alignment + // + // if CRITICAL_SECTION size changes in Windows, you'll get an assert from + // thread.cpp and will need to increase the buffer size +#ifdef __WIN64__ + typedef char wxCritSectBuffer[40]; +#else // __WIN32__ + typedef char wxCritSectBuffer[24]; +#endif + union + { + unsigned long m_dummy1; + void *m_dummy2; + + wxCritSectBuffer m_buffer; + }; +#endif // Unix/Win32 + + wxDECLARE_NO_COPY_CLASS(wxCriticalSection); +}; + +#if wxCRITSECT_IS_MUTEX + // implement wxCriticalSection using mutexes + inline wxCriticalSection::wxCriticalSection( wxCriticalSectionType critSecType ) + : m_mutex( critSecType == wxCRITSEC_DEFAULT ? wxMUTEX_RECURSIVE : wxMUTEX_DEFAULT ) { } + inline wxCriticalSection::~wxCriticalSection() { } + + inline void wxCriticalSection::Enter() { (void)m_mutex.Lock(); } + inline bool wxCriticalSection::TryEnter() { return m_mutex.TryLock() == wxMUTEX_NO_ERROR; } + inline void wxCriticalSection::Leave() { (void)m_mutex.Unlock(); } +#endif // wxCRITSECT_IS_MUTEX + +#undef wxCRITSECT_INLINE +#undef wxCRITSECT_IS_MUTEX + +// wxCriticalSectionLocker is the same to critical sections as wxMutexLocker is +// to mutexes +class WXDLLIMPEXP_BASE wxCriticalSectionLocker +{ +public: + wxCriticalSectionLocker(wxCriticalSection& cs) + : m_critsect(cs) + { + m_critsect.Enter(); + } + + ~wxCriticalSectionLocker() + { + m_critsect.Leave(); + } + +private: + wxCriticalSection& m_critsect; + + wxDECLARE_NO_COPY_CLASS(wxCriticalSectionLocker); +}; + +// ---------------------------------------------------------------------------- +// wxCondition models a POSIX condition variable which allows one (or more) +// thread(s) to wait until some condition is fulfilled +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxCondition +{ +public: + // Each wxCondition object is associated with a (single) wxMutex object. + // The mutex object MUST be locked before calling Wait() + wxCondition(wxMutex& mutex); + + // dtor is not virtual, don't use this class polymorphically + ~wxCondition(); + + // return true if the condition has been created successfully + bool IsOk() const; + + // NB: the associated mutex MUST be locked beforehand by the calling thread + // + // it atomically releases the lock on the associated mutex + // and starts waiting to be woken up by a Signal()/Broadcast() + // once its signaled, then it will wait until it can reacquire + // the lock on the associated mutex object, before returning. + wxCondError Wait(); + + // std::condition_variable-like variant that evaluates the associated condition + template<typename Functor> + wxCondError Wait(const Functor& predicate) + { + while ( !predicate() ) + { + wxCondError e = Wait(); + if ( e != wxCOND_NO_ERROR ) + return e; + } + return wxCOND_NO_ERROR; + } + + // exactly as Wait() except that it may also return if the specified + // timeout elapses even if the condition hasn't been signalled: in this + // case, the return value is wxCOND_TIMEOUT, otherwise (i.e. in case of a + // normal return) it is wxCOND_NO_ERROR. + // + // the timeout parameter specifies an interval that needs to be waited for + // in milliseconds + wxCondError WaitTimeout(unsigned long milliseconds); + + // NB: the associated mutex may or may not be locked by the calling thread + // + // this method unblocks one thread if any are blocking on the condition. + // if no thread is blocking in Wait(), then the signal is NOT remembered + // The thread which was blocking on Wait() will then reacquire the lock + // on the associated mutex object before returning + wxCondError Signal(); + + // NB: the associated mutex may or may not be locked by the calling thread + // + // this method unblocks all threads if any are blocking on the condition. + // if no thread is blocking in Wait(), then the signal is NOT remembered + // The threads which were blocking on Wait() will then reacquire the lock + // on the associated mutex object before returning. + wxCondError Broadcast(); + +private: + wxConditionInternal *m_internal; + + wxDECLARE_NO_COPY_CLASS(wxCondition); +}; + +// ---------------------------------------------------------------------------- +// wxSemaphore: a counter limiting the number of threads concurrently accessing +// a shared resource +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxSemaphore +{ +public: + // specifying a maxcount of 0 actually makes wxSemaphore behave as if there + // is no upper limit, if maxcount is 1 the semaphore behaves as a mutex + wxSemaphore( int initialcount = 0, int maxcount = 0 ); + + // dtor is not virtual, don't use this class polymorphically + ~wxSemaphore(); + + // return true if the semaphore has been created successfully + bool IsOk() const; + + // wait indefinitely, until the semaphore count goes beyond 0 + // and then decrement it and return (this method might have been called + // Acquire()) + wxSemaError Wait(); + + // same as Wait(), but does not block, returns wxSEMA_NO_ERROR if + // successful and wxSEMA_BUSY if the count is currently zero + wxSemaError TryWait(); + + // same as Wait(), but as a timeout limit, returns wxSEMA_NO_ERROR if the + // semaphore was acquired and wxSEMA_TIMEOUT if the timeout has elapsed + wxSemaError WaitTimeout(unsigned long milliseconds); + + // increments the semaphore count and signals one of the waiting threads + wxSemaError Post(); + +private: + wxSemaphoreInternal *m_internal; + + wxDECLARE_NO_COPY_CLASS(wxSemaphore); +}; + +// ---------------------------------------------------------------------------- +// wxThread: class encapsulating a thread of execution +// ---------------------------------------------------------------------------- + +// there are two different kinds of threads: joinable and detached (default) +// ones. Only joinable threads can return a return code and only detached +// threads auto-delete themselves - the user should delete the joinable +// threads manually. + +// NB: in the function descriptions the words "this thread" mean the thread +// created by the wxThread object while "main thread" is the thread created +// during the process initialization (a.k.a. the GUI thread) + +// On VMS thread pointers are 64 bits (also needed for other systems??? +#ifdef __VMS + typedef unsigned long long wxThreadIdType; +#else + typedef unsigned long wxThreadIdType; +#endif + +class WXDLLIMPEXP_BASE wxThread +{ +public: + // the return type for the thread function + typedef void *ExitCode; + + // static functions + // Returns the wxThread object for the calling thread. NULL is returned + // if the caller is the main thread (but it's recommended to use + // IsMain() and only call This() for threads other than the main one + // because NULL is also returned on error). If the thread wasn't + // created with wxThread class, the returned value is undefined. + static wxThread *This(); + + // Returns true if current thread is the main thread. + // + // Notice that it also returns true if main thread id hadn't been + // initialized yet on the assumption that it's too early in wx startup + // process for any other threads to have been created in this case. + static bool IsMain() + { + return !ms_idMainThread || GetCurrentId() == ms_idMainThread; + } + + // Return the main thread id + static wxThreadIdType GetMainId() { return ms_idMainThread; } + + // Release the rest of our time slice letting the other threads run + static void Yield(); + + // Sleep during the specified period of time in milliseconds + // + // This is the same as wxMilliSleep(). + static void Sleep(unsigned long milliseconds); + + // get the number of system CPUs - useful with SetConcurrency() + // (the "best" value for it is usually number of CPUs + 1) + // + // Returns -1 if unknown, number of CPUs otherwise + static int GetCPUCount(); + + // Get the platform specific thread ID and return as a long. This + // can be used to uniquely identify threads, even if they are not + // wxThreads. This is used by wxPython. + static wxThreadIdType GetCurrentId(); + + // sets the concurrency level: this is, roughly, the number of threads + // the system tries to schedule to run in parallel. 0 means the + // default value (usually acceptable, but may not yield the best + // performance for this process) + // + // Returns true on success, false otherwise (if not implemented, for + // example) + static bool SetConcurrency(size_t level); + + // constructor only creates the C++ thread object and doesn't create (or + // start) the real thread + wxThread(wxThreadKind kind = wxTHREAD_DETACHED); + + // functions that change the thread state: all these can only be called + // from _another_ thread (typically the thread that created this one, e.g. + // the main thread), not from the thread itself + + // create a new thread and optionally set the stack size on + // platforms that support that - call Run() to start it + wxThreadError Create(unsigned int stackSize = 0); + + // starts execution of the thread - from the moment Run() is called + // the execution of wxThread::Entry() may start at any moment, caller + // shouldn't suppose that it starts after (or before) Run() returns. + wxThreadError Run(); + + // stops the thread if it's running and deletes the wxThread object if + // this is a detached thread freeing its memory - otherwise (for + // joinable threads) you still need to delete wxThread object + // yourself. + // + // this function only works if the thread calls TestDestroy() + // periodically - the thread will only be deleted the next time it + // does it! + // + // will fill the rc pointer with the thread exit code if it's !NULL + wxThreadError Delete(ExitCode *rc = NULL, + wxThreadWait waitMode = wxTHREAD_WAIT_DEFAULT); + + // waits for a joinable thread to finish and returns its exit code + // + // Returns (ExitCode)-1 on error (for example, if the thread is not + // joinable) + ExitCode Wait(wxThreadWait waitMode = wxTHREAD_WAIT_DEFAULT); + + // kills the thread without giving it any chance to clean up - should + // not be used under normal circumstances, use Delete() instead. + // It is a dangerous function that should only be used in the most + // extreme cases! + // + // The wxThread object is deleted by Kill() if the thread is + // detachable, but you still have to delete it manually for joinable + // threads. + wxThreadError Kill(); + + // pause a running thread: as Delete(), this only works if the thread + // calls TestDestroy() regularly + wxThreadError Pause(); + + // resume a paused thread + wxThreadError Resume(); + + // priority + // Sets the priority to "prio" which must be in 0..100 range (see + // also wxPRIORITY_XXX constants). + void SetPriority(unsigned int prio); + + // Get the current priority. + unsigned int GetPriority() const; + + // thread status inquiries + // Returns true if the thread is alive: i.e. running or suspended + bool IsAlive() const; + // Returns true if the thread is running (not paused, not killed). + bool IsRunning() const; + // Returns true if the thread is suspended + bool IsPaused() const; + + // is the thread of detached kind? + bool IsDetached() const { return m_isDetached; } + + // Get the thread ID - a platform dependent number which uniquely + // identifies a thread inside a process + wxThreadIdType GetId() const; + +#ifdef __WINDOWS__ + // Get the internal OS handle + WXHANDLE MSWGetHandle() const; +#endif // __WINDOWS__ + + wxThreadKind GetKind() const + { return m_isDetached ? wxTHREAD_DETACHED : wxTHREAD_JOINABLE; } + + // Returns true if the thread was asked to terminate: this function should + // be called by the thread from time to time, otherwise the main thread + // will be left forever in Delete()! + virtual bool TestDestroy(); + + // dtor is public, but the detached threads should never be deleted - use + // Delete() instead (or leave the thread terminate by itself) + virtual ~wxThread(); + + // sets name to assist debugging + static bool SetNameForCurrent(const wxString &name); + +protected: + // sets name to assist debugging + bool SetName(const wxString &name); + + // exits from the current thread - can be called only from this thread + void Exit(ExitCode exitcode = NULL); + + // entry point for the thread - called by Run() and executes in the context + // of this thread. + virtual void *Entry() = 0; + + // obsolete private function calling Entry(), do not use. + void *CallEntry(); + + // Callbacks which may be overridden by the derived class to perform some + // specific actions when the thread is deleted or killed. By default they + // do nothing. + + // This one is called by Delete() before actually deleting the thread and + // is executed in the context of the thread that called Delete(). + virtual void OnDelete() {} + + // This one is called by Kill() before killing the thread and is executed + // in the context of the thread that called Kill(). + virtual void OnKill() {} + + // called when the thread exits - in the context of this thread + // + // NB: this function will not be called if the thread is Kill()ed + virtual void OnExit() {} + +private: + // no copy ctor/assignment operator + wxThread(const wxThread&); + wxThread& operator=(const wxThread&); + + friend class wxThreadInternal; + friend class wxThreadModule; + + + // the main thread identifier, should be set on startup + static wxThreadIdType ms_idMainThread; + + // the (platform-dependent) thread class implementation + wxThreadInternal *m_internal; + + // protects access to any methods of wxThreadInternal object + mutable wxCriticalSection m_critsect; + + // true if the thread is detached, false if it is joinable + bool m_isDetached; +}; + +// wxThreadHelperThread class +// -------------------------- + +class wxThreadHelperThread : public wxThread +{ +public: + // constructor only creates the C++ thread object and doesn't create (or + // start) the real thread + wxThreadHelperThread(wxThreadHelper& owner, wxThreadKind kind) + : wxThread(kind), m_owner(owner) + { } + +protected: + // entry point for the thread -- calls Entry() in owner. + virtual void *Entry() wxOVERRIDE; + +private: + // the owner of the thread + wxThreadHelper& m_owner; + + // no copy ctor/assignment operator + wxThreadHelperThread(const wxThreadHelperThread&); + wxThreadHelperThread& operator=(const wxThreadHelperThread&); +}; + +// ---------------------------------------------------------------------------- +// wxThreadHelper: this class implements the threading logic to run a +// background task in another object (such as a window). It is a mix-in: just +// derive from it to implement a threading background task in your class. +// ---------------------------------------------------------------------------- + +class wxThreadHelper +{ +private: + void KillThread() + { + // If wxThreadHelperThread is detached and is about to finish, it will + // set m_thread to NULL so don't delete it then. + // But if KillThread is called before wxThreadHelperThread (in detached mode) + // sets it to NULL, then the thread object still exists and can be killed + wxCriticalSectionLocker locker(m_critSection); + + if ( m_thread ) + { + m_thread->Kill(); + + if ( m_kind == wxTHREAD_JOINABLE ) + delete m_thread; + + m_thread = NULL; + } + } + +public: + // constructor only initializes m_thread to NULL + wxThreadHelper(wxThreadKind kind = wxTHREAD_JOINABLE) + : m_thread(NULL), m_kind(kind) { } + + // destructor deletes m_thread + virtual ~wxThreadHelper() { KillThread(); } + +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED( wxThreadError Create(unsigned int stackSize = 0) ); +#endif + + // create a new thread (and optionally set the stack size on platforms that + // support/need that), call Run() to start it + wxThreadError CreateThread(wxThreadKind kind = wxTHREAD_JOINABLE, + unsigned int stackSize = 0) + { + KillThread(); + + m_kind = kind; + m_thread = new wxThreadHelperThread(*this, m_kind); + + return m_thread->Create(stackSize); + } + + // entry point for the thread - called by Run() and executes in the context + // of this thread. + virtual void *Entry() = 0; + + // returns a pointer to the thread which can be used to call Run() + wxThread *GetThread() const + { + wxCriticalSectionLocker locker(m_critSection); + + wxThread* thread = m_thread; + + return thread; + } + +protected: + wxThread *m_thread; + wxThreadKind m_kind; + mutable wxCriticalSection m_critSection; // To guard the m_thread variable + + friend class wxThreadHelperThread; +}; + +#if WXWIN_COMPATIBILITY_2_8 +inline wxThreadError wxThreadHelper::Create(unsigned int stackSize) +{ return CreateThread(m_kind, stackSize); } +#endif + +// call Entry() in owner, put it down here to avoid circular declarations +inline void *wxThreadHelperThread::Entry() +{ + void * const result = m_owner.Entry(); + + wxCriticalSectionLocker locker(m_owner.m_critSection); + + // Detached thread will be deleted after returning, so make sure + // wxThreadHelper::GetThread will not return an invalid pointer. + // And that wxThreadHelper::KillThread will not try to kill + // an already deleted thread + if ( m_owner.m_kind == wxTHREAD_DETACHED ) + m_owner.m_thread = NULL; + + return result; +} + +// ---------------------------------------------------------------------------- +// Automatic initialization +// ---------------------------------------------------------------------------- + +// GUI mutex handling. +void WXDLLIMPEXP_BASE wxMutexGuiEnter(); +void WXDLLIMPEXP_BASE wxMutexGuiLeave(); + +// macros for entering/leaving critical sections which may be used without +// having to take them inside "#if wxUSE_THREADS" +#define wxENTER_CRIT_SECT(cs) (cs).Enter() +#define wxLEAVE_CRIT_SECT(cs) (cs).Leave() +#define wxCRIT_SECT_DECLARE(cs) static wxCriticalSection cs +#define wxCRIT_SECT_DECLARE_MEMBER(cs) wxCriticalSection cs +#define wxCRIT_SECT_LOCKER(name, cs) wxCriticalSectionLocker name(cs) + +// function for checking if we're in the main thread which may be used whether +// wxUSE_THREADS is 0 or 1 +inline bool wxIsMainThread() { return wxThread::IsMain(); } + +#else // !wxUSE_THREADS + +// no thread support +inline void wxMutexGuiEnter() { } +inline void wxMutexGuiLeave() { } + +// macros for entering/leaving critical sections which may be used without +// having to take them inside "#if wxUSE_THREADS" +// (the implementation uses dummy structs to force semicolon after the macro) +#define wxENTER_CRIT_SECT(cs) do {} while (0) +#define wxLEAVE_CRIT_SECT(cs) do {} while (0) +#define wxCRIT_SECT_DECLARE(cs) struct wxDummyCS##cs +#define wxCRIT_SECT_DECLARE_MEMBER(cs) struct wxDummyCSMember##cs { } +#define wxCRIT_SECT_LOCKER(name, cs) struct wxDummyCSLocker##name + +// if there is only one thread, it is always the main one +inline bool wxIsMainThread() { return true; } + +#endif // wxUSE_THREADS/!wxUSE_THREADS + +// mark part of code as being a critical section: this macro declares a +// critical section with the given name and enters it immediately and leaves +// it at the end of the current scope +// +// example: +// +// int Count() +// { +// static int s_counter = 0; +// +// wxCRITICAL_SECTION(counter); +// +// return ++s_counter; +// } +// +// this function is MT-safe in presence of the threads but there is no +// overhead when the library is compiled without threads +#define wxCRITICAL_SECTION(name) \ + wxCRIT_SECT_DECLARE(s_cs##name); \ + wxCRIT_SECT_LOCKER(cs##name##Locker, s_cs##name) + +// automatically lock GUI mutex in ctor and unlock it in dtor +class WXDLLIMPEXP_BASE wxMutexGuiLocker +{ +public: + wxMutexGuiLocker() { wxMutexGuiEnter(); } + ~wxMutexGuiLocker() { wxMutexGuiLeave(); } +}; + +// ----------------------------------------------------------------------------- +// implementation only until the end of file +// ----------------------------------------------------------------------------- + +#if wxUSE_THREADS + +#if defined(__WINDOWS__) || defined(__DARWIN__) + // unlock GUI if there are threads waiting for and lock it back when + // there are no more of them - should be called periodically by the main + // thread + extern void WXDLLIMPEXP_BASE wxMutexGuiLeaveOrEnter(); + + // returns true if the main thread has GUI lock + extern bool WXDLLIMPEXP_BASE wxGuiOwnedByMainThread(); + + // wakes up the main thread if it's sleeping inside ::GetMessage() + extern void WXDLLIMPEXP_BASE wxWakeUpMainThread(); + +#ifndef __DARWIN__ + // return true if the main thread is waiting for some other to terminate: + // wxApp then should block all "dangerous" messages + extern bool WXDLLIMPEXP_BASE wxIsWaitingForThread(); +#endif +#endif // MSW, OSX + +#endif // wxUSE_THREADS + +#endif // _WX_THREAD_H_ diff --git a/lib/wxWidgets/include/wx/thrimpl.cpp b/lib/wxWidgets/include/wx/thrimpl.cpp new file mode 100644 index 0000000..ba7930a --- /dev/null +++ b/lib/wxWidgets/include/wx/thrimpl.cpp @@ -0,0 +1,355 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/thrimpl.cpp +// Purpose: common part of wxThread Implementations +// Author: Vadim Zeitlin +// Modified by: +// Created: 04.06.02 (extracted from src/*/thread.cpp files) +// Copyright: (c) Vadim Zeitlin (2002) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// this file is supposed to be included only by the various thread.cpp + +// ---------------------------------------------------------------------------- +// wxMutex +// ---------------------------------------------------------------------------- + +wxMutex::wxMutex(wxMutexType mutexType) +{ + m_internal = new wxMutexInternal(mutexType); + + if ( !m_internal->IsOk() ) + { + delete m_internal; + m_internal = NULL; + } +} + +wxMutex::~wxMutex() +{ + delete m_internal; +} + +bool wxMutex::IsOk() const +{ + return m_internal != NULL; +} + +wxMutexError wxMutex::Lock() +{ + wxCHECK_MSG( m_internal, wxMUTEX_INVALID, + wxT("wxMutex::Lock(): not initialized") ); + + return m_internal->Lock(); +} + +wxMutexError wxMutex::LockTimeout(unsigned long ms) +{ + wxCHECK_MSG( m_internal, wxMUTEX_INVALID, + wxT("wxMutex::Lock(): not initialized") ); + + return m_internal->Lock(ms); +} + +wxMutexError wxMutex::TryLock() +{ + wxCHECK_MSG( m_internal, wxMUTEX_INVALID, + wxT("wxMutex::TryLock(): not initialized") ); + + return m_internal->TryLock(); +} + +wxMutexError wxMutex::Unlock() +{ + wxCHECK_MSG( m_internal, wxMUTEX_INVALID, + wxT("wxMutex::Unlock(): not initialized") ); + + return m_internal->Unlock(); +} + +// -------------------------------------------------------------------------- +// wxConditionInternal +// -------------------------------------------------------------------------- + +// Win32 doesn't have explicit support for the POSIX condition +// variables and its events/event semaphores have quite different semantics, +// so we reimplement the conditions from scratch using the mutexes and +// semaphores +#if defined(__WINDOWS__) + +class wxConditionInternal +{ +public: + wxConditionInternal(wxMutex& mutex); + + bool IsOk() const { return m_mutex.IsOk() && m_semaphore.IsOk(); } + + wxCondError Wait(); + wxCondError WaitTimeout(unsigned long milliseconds); + + wxCondError Signal(); + wxCondError Broadcast(); + +private: + // the number of threads currently waiting for this condition + LONG m_numWaiters; + + // the critical section protecting m_numWaiters + wxCriticalSection m_csWaiters; + + wxMutex& m_mutex; + wxSemaphore m_semaphore; + + wxDECLARE_NO_COPY_CLASS(wxConditionInternal); +}; + +wxConditionInternal::wxConditionInternal(wxMutex& mutex) + : m_mutex(mutex) +{ + // another thread can't access it until we return from ctor, so no need to + // protect access to m_numWaiters here + m_numWaiters = 0; +} + +wxCondError wxConditionInternal::Wait() +{ + // increment the number of waiters + { + wxCriticalSectionLocker lock(m_csWaiters); + m_numWaiters++; + } + + m_mutex.Unlock(); + + // after unlocking the mutex other threads may Signal() us, but it is ok + // now as we had already incremented m_numWaiters so Signal() will post the + // semaphore and decrement m_numWaiters back even if it is called before we + // start to Wait() + const wxSemaError err = m_semaphore.Wait(); + + m_mutex.Lock(); + + if ( err == wxSEMA_NO_ERROR ) + { + // m_numWaiters was decremented by Signal() + return wxCOND_NO_ERROR; + } + + // but in case of an error we need to do it manually + { + wxCriticalSectionLocker lock(m_csWaiters); + m_numWaiters--; + } + + return err == wxSEMA_TIMEOUT ? wxCOND_TIMEOUT : wxCOND_MISC_ERROR; +} + +wxCondError wxConditionInternal::WaitTimeout(unsigned long milliseconds) +{ + { + wxCriticalSectionLocker lock(m_csWaiters); + m_numWaiters++; + } + + m_mutex.Unlock(); + + wxSemaError err = m_semaphore.WaitTimeout(milliseconds); + + m_mutex.Lock(); + + if ( err == wxSEMA_NO_ERROR ) + return wxCOND_NO_ERROR; + + if ( err == wxSEMA_TIMEOUT ) + { + // a potential race condition exists here: it happens when a waiting + // thread times out but doesn't have time to decrement m_numWaiters yet + // before Signal() is called in another thread + // + // to handle this particular case, check the semaphore again after + // acquiring m_csWaiters lock -- this will catch the signals missed + // during this window + wxCriticalSectionLocker lock(m_csWaiters); + + err = m_semaphore.WaitTimeout(0); + if ( err == wxSEMA_NO_ERROR ) + return wxCOND_NO_ERROR; + + // we need to decrement m_numWaiters ourselves as it wasn't done by + // Signal() + m_numWaiters--; + + return err == wxSEMA_TIMEOUT ? wxCOND_TIMEOUT : wxCOND_MISC_ERROR; + } + + // undo m_numWaiters++ above in case of an error + { + wxCriticalSectionLocker lock(m_csWaiters); + m_numWaiters--; + } + + return wxCOND_MISC_ERROR; +} + +wxCondError wxConditionInternal::Signal() +{ + wxCriticalSectionLocker lock(m_csWaiters); + + if ( m_numWaiters > 0 ) + { + // increment the semaphore by 1 + if ( m_semaphore.Post() != wxSEMA_NO_ERROR ) + return wxCOND_MISC_ERROR; + + m_numWaiters--; + } + + return wxCOND_NO_ERROR; +} + +wxCondError wxConditionInternal::Broadcast() +{ + wxCriticalSectionLocker lock(m_csWaiters); + + while ( m_numWaiters > 0 ) + { + if ( m_semaphore.Post() != wxSEMA_NO_ERROR ) + return wxCOND_MISC_ERROR; + + m_numWaiters--; + } + + return wxCOND_NO_ERROR; +} + +#endif // __WINDOWS__ + +// ---------------------------------------------------------------------------- +// wxCondition +// ---------------------------------------------------------------------------- + +wxCondition::wxCondition(wxMutex& mutex) +{ + m_internal = new wxConditionInternal(mutex); + + if ( !m_internal->IsOk() ) + { + delete m_internal; + m_internal = NULL; + } +} + +wxCondition::~wxCondition() +{ + delete m_internal; +} + +bool wxCondition::IsOk() const +{ + return m_internal != NULL; +} + +wxCondError wxCondition::Wait() +{ + wxCHECK_MSG( m_internal, wxCOND_INVALID, + wxT("wxCondition::Wait(): not initialized") ); + + return m_internal->Wait(); +} + +wxCondError wxCondition::WaitTimeout(unsigned long milliseconds) +{ + wxCHECK_MSG( m_internal, wxCOND_INVALID, + wxT("wxCondition::Wait(): not initialized") ); + + return m_internal->WaitTimeout(milliseconds); +} + +wxCondError wxCondition::Signal() +{ + wxCHECK_MSG( m_internal, wxCOND_INVALID, + wxT("wxCondition::Signal(): not initialized") ); + + return m_internal->Signal(); +} + +wxCondError wxCondition::Broadcast() +{ + wxCHECK_MSG( m_internal, wxCOND_INVALID, + wxT("wxCondition::Broadcast(): not initialized") ); + + return m_internal->Broadcast(); +} + +// -------------------------------------------------------------------------- +// wxSemaphore +// -------------------------------------------------------------------------- + +wxSemaphore::wxSemaphore(int initialcount, int maxcount) +{ + m_internal = new wxSemaphoreInternal( initialcount, maxcount ); + if ( !m_internal->IsOk() ) + { + delete m_internal; + m_internal = NULL; + } +} + +wxSemaphore::~wxSemaphore() +{ + delete m_internal; +} + +bool wxSemaphore::IsOk() const +{ + return m_internal != NULL; +} + +wxSemaError wxSemaphore::Wait() +{ + wxCHECK_MSG( m_internal, wxSEMA_INVALID, + wxT("wxSemaphore::Wait(): not initialized") ); + + return m_internal->Wait(); +} + +wxSemaError wxSemaphore::TryWait() +{ + wxCHECK_MSG( m_internal, wxSEMA_INVALID, + wxT("wxSemaphore::TryWait(): not initialized") ); + + return m_internal->TryWait(); +} + +wxSemaError wxSemaphore::WaitTimeout(unsigned long milliseconds) +{ + wxCHECK_MSG( m_internal, wxSEMA_INVALID, + wxT("wxSemaphore::WaitTimeout(): not initialized") ); + + return m_internal->WaitTimeout(milliseconds); +} + +wxSemaError wxSemaphore::Post() +{ + wxCHECK_MSG( m_internal, wxSEMA_INVALID, + wxT("wxSemaphore::Post(): not initialized") ); + + return m_internal->Post(); +} + +// ---------------------------------------------------------------------------- +// wxThread +// ---------------------------------------------------------------------------- + +#include "wx/utils.h" + +void wxThread::Sleep(unsigned long milliseconds) +{ + wxMilliSleep(milliseconds); +} + +// This function exists only for backwards compatibility, don't call it. +void *wxThread::CallEntry() +{ + return Entry(); +} diff --git a/lib/wxWidgets/include/wx/time.h b/lib/wxWidgets/include/wx/time.h new file mode 100644 index 0000000..918da12 --- /dev/null +++ b/lib/wxWidgets/include/wx/time.h @@ -0,0 +1,76 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/time.h +// Purpose: Miscellaneous time-related functions. +// Author: Vadim Zeitlin +// Created: 2011-11-26 +// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TIME_H_ +#define _WX_TIME_H_ + +#include "wx/longlong.h" + +// Returns the difference between UTC and local time in seconds. +WXDLLIMPEXP_BASE int wxGetTimeZone(); + +// Get number of seconds since local time 00:00:00 Jan 1st 1970. +extern long WXDLLIMPEXP_BASE wxGetLocalTime(); + +// Get number of seconds since GMT 00:00:00, Jan 1st 1970. +extern long WXDLLIMPEXP_BASE wxGetUTCTime(); + +#if wxUSE_LONGLONG + typedef wxLongLong wxMilliClock_t; + inline long wxMilliClockToLong(wxLongLong ll) { return ll.ToLong(); } +#else + typedef double wxMilliClock_t; + inline long wxMilliClockToLong(double d) { return wx_truncate_cast(long, d); } +#endif // wxUSE_LONGLONG + +// Get number of milliseconds since local time 00:00:00 Jan 1st 1970 +extern wxMilliClock_t WXDLLIMPEXP_BASE wxGetLocalTimeMillis(); + +#if wxUSE_LONGLONG + +// Get the number of milliseconds or microseconds since the Epoch. +wxLongLong WXDLLIMPEXP_BASE wxGetUTCTimeMillis(); +wxLongLong WXDLLIMPEXP_BASE wxGetUTCTimeUSec(); + +#endif // wxUSE_LONGLONG + +#define wxGetCurrentTime() wxGetLocalTime() + +// on some really old systems gettimeofday() doesn't have the second argument, +// define wxGetTimeOfDay() to hide this difference +#ifdef HAVE_GETTIMEOFDAY + #ifdef WX_GETTIMEOFDAY_NO_TZ + #define wxGetTimeOfDay(tv) gettimeofday(tv) + #else + #define wxGetTimeOfDay(tv) gettimeofday((tv), NULL) + #endif +#endif // HAVE_GETTIMEOFDAY + +/* 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__) + // 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__) + // On Windows, gmtime _is_ threadsafe! +#warning using pseudo thread-safe wrapper for gmtime to emulate gmtime_r +#endif +#endif + +#endif // _WX_TIME_H_ diff --git a/lib/wxWidgets/include/wx/timectrl.h b/lib/wxWidgets/include/wx/timectrl.h new file mode 100644 index 0000000..4e4a7a3 --- /dev/null +++ b/lib/wxWidgets/include/wx/timectrl.h @@ -0,0 +1,131 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/timectrl.h +// Purpose: Declaration of wxTimePickerCtrl class. +// Author: Vadim Zeitlin +// Created: 2011-09-22 +// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TIMECTRL_H_ +#define _WX_TIMECTRL_H_ + +#include "wx/defs.h" + +#if wxUSE_TIMEPICKCTRL + +#include "wx/datetimectrl.h" + +#define wxTimePickerCtrlNameStr wxS("timectrl") + +// No special styles are currently defined for this control but still define a +// symbolic constant for the default style for consistency. +enum +{ + wxTP_DEFAULT = 0 +}; + +// ---------------------------------------------------------------------------- +// wxTimePickerCtrl: Allow the user to enter the time. +// ---------------------------------------------------------------------------- + +// The template argument must be a class deriving from wxDateTimePickerCtrlBase +// (i.e. in practice either this class itself or wxDateTimePickerCtrl). +template <typename Base> +class wxTimePickerCtrlCommonBase : public Base +{ +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 = wxTP_DEFAULT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTimePickerCtrlNameStr); + */ + + /* + We also inherit Set/GetValue() methods from the base class which define + our public API. Notice that the date portion of the date passed as + input or received as output is or should be ignored, only the time part + of wxDateTime objects is really significant here. Use Set/GetTime() + below for possibly simpler interface. + */ + + // Set the given time. + bool SetTime(int hour, int min, int sec) + { + // Notice that we should use a date on which DST doesn't change to + // avoid any problems with time discontinuity so use a fixed date (on + // which nobody changes DST) instead of e.g. today. + wxDateTime dt(1, wxDateTime::Jan, 2012, hour, min, sec); + if ( !dt.IsValid() ) + { + // No need to assert here, wxDateTime already does it for us. + return false; + } + + this->SetValue(dt); + + return true; + } + + // Get the current time components. All pointers must be non-NULL. + bool GetTime(int* hour, int* min, int* sec) const + { + wxCHECK_MSG( hour && min && sec, false, + wxS("Time component pointers must be non-NULL") ); + + const wxDateTime::Tm tm = this->GetValue().GetTm(); + *hour = tm.hour; + *min = tm.min; + *sec = tm.sec; + + return true; + } +}; + +// This class is defined mostly for compatibility and is used as the base class +// by native wxTimePickerCtrl implementations. +typedef wxTimePickerCtrlCommonBase<wxDateTimePickerCtrl> wxTimePickerCtrlBase; + +#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) + #include "wx/msw/timectrl.h" + + #define wxHAS_NATIVE_TIMEPICKERCTRL +#elif defined(__WXOSX_COCOA__) && !defined(__WXUNIVERSAL__) + #include "wx/osx/timectrl.h" + + #define wxHAS_NATIVE_TIMEPICKERCTRL +#else + #include "wx/generic/timectrl.h" + + class WXDLLIMPEXP_ADV wxTimePickerCtrl : public wxTimePickerCtrlGeneric + { + public: + wxTimePickerCtrl() { } + wxTimePickerCtrl(wxWindow *parent, + wxWindowID id, + const wxDateTime& date = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTP_DEFAULT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTimePickerCtrlNameStr) + : wxTimePickerCtrlGeneric(parent, id, date, pos, size, style, validator, name) + { + } + + private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTimePickerCtrl); + }; +#endif + +#endif // wxUSE_TIMEPICKCTRL + +#endif // _WX_TIMECTRL_H_ diff --git a/lib/wxWidgets/include/wx/timer.h b/lib/wxWidgets/include/wx/timer.h new file mode 100644 index 0000000..1b60e6a --- /dev/null +++ b/lib/wxWidgets/include/wx/timer.h @@ -0,0 +1,201 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/timer.h +// Purpose: wxTimer, wxStopWatch and global time-related functions +// Author: Julian Smart +// Modified by: Vadim Zeitlin (wxTimerBase) +// Guillermo Rodriguez (global clean up) +// Created: 04/01/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TIMER_H_BASE_ +#define _WX_TIMER_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_TIMER + +#include "wx/object.h" +#include "wx/longlong.h" +#include "wx/event.h" +#include "wx/stopwatch.h" // for backwards compatibility +#include "wx/utils.h" + + +// more readable flags for Start(): + +// generate notifications periodically until the timer is stopped (default) +#define wxTIMER_CONTINUOUS false + +// only send the notification once and then stop the timer +#define wxTIMER_ONE_SHOT true + +class WXDLLIMPEXP_FWD_BASE wxTimerImpl; +class WXDLLIMPEXP_FWD_BASE wxTimerEvent; + +// timer event type +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_TIMER, wxTimerEvent); + +// the interface of wxTimer class +class WXDLLIMPEXP_BASE wxTimer : public wxEvtHandler +{ +public: + // ctors and initializers + // ---------------------- + + // default: if you don't call SetOwner(), your only chance to get timer + // notifications is to override Notify() in the derived class + wxTimer() + { + Init(); + SetOwner(this); + } + + // ctor which allows to avoid having to override Notify() in the derived + // class: the owner will get timer notifications which can be handled with + // EVT_TIMER + wxTimer(wxEvtHandler *owner, int timerid = wxID_ANY) + { + Init(); + SetOwner(owner, timerid); + } + + // same as ctor above + void SetOwner(wxEvtHandler *owner, int timerid = wxID_ANY); + + virtual ~wxTimer(); + + + // working with the timer + // ---------------------- + + // NB: Start() and Stop() are not supposed to be overridden, they are only + // virtual for historical reasons, only Notify() can be overridden + + // start the timer: if milliseconds == -1, use the same value as for the + // last Start() + // + // it is now valid to call Start() multiple times: this just restarts the + // timer if it is already running + virtual bool Start(int milliseconds = -1, bool oneShot = false); + + // start the timer for one iteration only, this is just a simple wrapper + // for Start() + bool StartOnce(int milliseconds = -1) { return Start(milliseconds, true); } + + // stop the timer, does nothing if the timer is not running + virtual void Stop(); + + // override this in your wxTimer-derived class if you want to process timer + // messages in it, use non default ctor or SetOwner() otherwise + virtual void Notify(); + + + // accessors + // --------- + + // get the object notified about the timer events + wxEvtHandler *GetOwner() const; + + // return true if the timer is running + bool IsRunning() const; + + // return the timer ID + int GetId() const; + + // get the (last) timer interval in milliseconds + int GetInterval() const; + + // return true if the timer is one shot + bool IsOneShot() const; + +protected: + // common part of all ctors + void Init(); + + wxTimerImpl *m_impl; + + wxDECLARE_NO_COPY_CLASS(wxTimer); +}; + +// ---------------------------------------------------------------------------- +// wxTimerRunner: starts the timer in its ctor, stops in the dtor +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxTimerRunner +{ +public: + wxTimerRunner(wxTimer& timer) : m_timer(timer) { } + wxTimerRunner(wxTimer& timer, int milli, bool oneShot = false) + : m_timer(timer) + { + m_timer.Start(milli, oneShot); + } + + void Start(int milli, bool oneShot = false) + { + m_timer.Start(milli, oneShot); + } + + ~wxTimerRunner() + { + if ( m_timer.IsRunning() ) + { + m_timer.Stop(); + } + } + +private: + wxTimer& m_timer; + + wxDECLARE_NO_COPY_CLASS(wxTimerRunner); +}; + +// ---------------------------------------------------------------------------- +// wxTimerEvent +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxTimerEvent : public wxEvent +{ +public: + wxTimerEvent(wxTimer& timer) + : wxEvent(timer.GetId(), wxEVT_TIMER), + m_timer(&timer) + { + SetEventObject(timer.GetOwner()); + } + + // accessors + int GetInterval() const { return m_timer->GetInterval(); } + wxTimer& GetTimer() const { return *m_timer; } + + // implement the base class pure virtual + virtual wxEvent *Clone() const wxOVERRIDE { return new wxTimerEvent(*this); } + virtual wxEventCategory GetEventCategory() const wxOVERRIDE { return wxEVT_CATEGORY_TIMER; } + + // default ctor creates an unusable event object and should not be used (in + // fact, no code outside wxWidgets is supposed to create event objects) +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_MSG("wxTimerEvent not supposed to be created by user code") + wxTimerEvent() + : wxEvent(wxID_ANY, wxEVT_TIMER) { m_timer=NULL; } +#endif // WXWIN_COMPATIBILITY_3_0 + +private: + wxTimer* m_timer; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxTimerEvent); +}; + +typedef void (wxEvtHandler::*wxTimerEventFunction)(wxTimerEvent&); + +#define wxTimerEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxTimerEventFunction, func) + +#define EVT_TIMER(timerid, func) \ + wx__DECLARE_EVT1(wxEVT_TIMER, timerid, wxTimerEventHandler(func)) + +#endif // wxUSE_TIMER + +#endif // _WX_TIMER_H_BASE_ diff --git a/lib/wxWidgets/include/wx/tipdlg.h b/lib/wxWidgets/include/wx/tipdlg.h new file mode 100644 index 0000000..173bbf4 --- /dev/null +++ b/lib/wxWidgets/include/wx/tipdlg.h @@ -0,0 +1,86 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/tipdlg.h +// Purpose: declaration of wxTipDialog +// Author: Vadim Zeitlin +// Modified by: +// Created: 28.06.99 +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TIPDLG_H_ +#define _WX_TIPDLG_H_ + +// ---------------------------------------------------------------------------- +// headers which we must include here +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_STARTUP_TIPS + +#include "wx/textfile.h" + +// ---------------------------------------------------------------------------- +// wxTipProvider - a class which is used by wxTipDialog to get the text of the +// tips +// ---------------------------------------------------------------------------- + +// the abstract base class: it provides the tips, i.e. implements the GetTip() +// function which returns the new tip each time it's called. To support this, +// wxTipProvider evidently needs some internal state which is the tip "index" +// and which should be saved/restored by the program to not always show one and +// the same tip (of course, you may use random starting position as well...) +class WXDLLIMPEXP_ADV wxTipProvider +{ +public: + wxTipProvider(size_t currentTip) { m_currentTip = currentTip; } + + // get the current tip and update the internal state to return the next tip + // when called for the next time + virtual wxString GetTip() = 0; + + // get the current tip "index" (or whatever allows the tip provider to know + // from where to start the next time) + size_t GetCurrentTip() const { return m_currentTip; } + + // virtual dtor for the base class + virtual ~wxTipProvider() { } + + +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_MSG("this method does nothing, simply don't call it") + wxString PreprocessTip(const wxString& tip) { return tip; } +#endif + +protected: + size_t m_currentTip; +}; + +// a function which returns an implementation of wxTipProvider using the +// specified text file as the source of tips (each line is a tip). +// +// NB: the caller is responsible for deleting the pointer! +#if wxUSE_TEXTFILE +WXDLLIMPEXP_ADV wxTipProvider *wxCreateFileTipProvider(const wxString& filename, + size_t currentTip); +#endif // wxUSE_TEXTFILE + +// ---------------------------------------------------------------------------- +// wxTipDialog +// ---------------------------------------------------------------------------- + +// A dialog which shows a "tip" - a short and helpful messages describing to +// the user some program characteristic. Many programs show the tips at +// startup, so the dialog has "Show tips on startup" checkbox which allows to +// the user to disable this (however, it's the program which should show, or +// not, the dialog on startup depending on its value, not this class). +// +// The function returns true if this checkbox is checked, false otherwise. +WXDLLIMPEXP_ADV bool wxShowTip(wxWindow *parent, + wxTipProvider *tipProvider, + bool showAtStartup = true); + +#endif // wxUSE_STARTUP_TIPS + +#endif // _WX_TIPDLG_H_ diff --git a/lib/wxWidgets/include/wx/tipwin.h b/lib/wxWidgets/include/wx/tipwin.h new file mode 100644 index 0000000..1fc0da5 --- /dev/null +++ b/lib/wxWidgets/include/wx/tipwin.h @@ -0,0 +1,82 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/tipwin.h +// Purpose: wxTipWindow is a window like the one typically used for +// showing the tooltips +// Author: Vadim Zeitlin +// Modified by: +// Created: 10.09.00 +// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TIPWIN_H_ +#define _WX_TIPWIN_H_ + +#include "wx/defs.h" + +#if wxUSE_TIPWINDOW + +#include "wx/popupwin.h" + +class WXDLLIMPEXP_FWD_CORE wxTipWindowView; + +// ---------------------------------------------------------------------------- +// wxTipWindow +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTipWindow : public wxPopupTransientWindow +{ +public: + // the mandatory ctor parameters are: the parent window and the text to + // show + // + // optionally you may also specify the length at which the lines are going + // to be broken in rows (100 pixels by default) + // + // windowPtr and rectBound are just passed to SetTipWindowPtr() and + // SetBoundingRect() - see below + wxTipWindow(wxWindow *parent, + const wxString& text, + wxCoord maxLength = 100, + wxTipWindow** windowPtr = NULL, + wxRect *rectBound = NULL); + + virtual ~wxTipWindow(); + + // If windowPtr is not NULL the given address will be NULLed when the + // window has closed + void SetTipWindowPtr(wxTipWindow** windowPtr) { m_windowPtr = windowPtr; } + + // If rectBound is not NULL, the window will disappear automatically when + // the mouse leave the specified rect: note that rectBound should be in the + // screen coordinates! + void SetBoundingRect(const wxRect& rectBound); + + // Hide and destroy the window + void Close(); + +protected: + // called by wxTipWindowView only + bool CheckMouseInBounds(const wxPoint& pos); + + // event handlers + void OnMouseClick(wxMouseEvent& event); + + virtual void OnDismiss() wxOVERRIDE; + +private: + wxTipWindowView *m_view; + + wxTipWindow** m_windowPtr; + wxRect m_rectBound; + + wxDECLARE_EVENT_TABLE(); + + friend class wxTipWindowView; + + wxDECLARE_NO_COPY_CLASS(wxTipWindow); +}; + +#endif // wxUSE_TIPWINDOW + +#endif // _WX_TIPWIN_H_ diff --git a/lib/wxWidgets/include/wx/tls.h b/lib/wxWidgets/include/wx/tls.h new file mode 100644 index 0000000..7e75922 --- /dev/null +++ b/lib/wxWidgets/include/wx/tls.h @@ -0,0 +1,143 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/tls.h +// Purpose: Implementation of thread local storage +// Author: Vadim Zeitlin +// Created: 2008-08-08 +// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TLS_H_ +#define _WX_TLS_H_ + +#include "wx/defs.h" + +// ---------------------------------------------------------------------------- +// check for compiler support of thread-specific variables +// ---------------------------------------------------------------------------- + +// when not using threads at all, there is no need for thread-specific +// values to be really thread-specific +#if !wxUSE_THREADS + #define wxHAS_COMPILER_TLS + #define wxTHREAD_SPECIFIC_DECL +// otherwise try to find the compiler-specific way to handle TLS unless +// explicitly disabled by setting wxUSE_COMPILER_TLS to 0 (it is 1 by default). +#elif wxUSE_COMPILER_TLS +// __thread keyword is not supported correctly by MinGW, at least in some +// configurations, see http://sourceforge.net/support/tracker.php?aid=2837047 +// and when in doubt we prefer to not use it at all. +#if defined(HAVE___THREAD_KEYWORD) && !defined(__MINGW32__) + #define wxHAS_COMPILER_TLS + #define wxTHREAD_SPECIFIC_DECL __thread +// MSVC has its own version which might be supported by some other Windows +// compilers, to be tested +#elif defined(__VISUALC__) + #define wxHAS_COMPILER_TLS + #define wxTHREAD_SPECIFIC_DECL __declspec(thread) +#endif // compilers +#endif // wxUSE_COMPILER_TLS + +// ---------------------------------------------------------------------------- +// define wxTLS_TYPE() +// ---------------------------------------------------------------------------- + +#ifdef wxHAS_COMPILER_TLS + #define wxTLS_TYPE(T) wxTHREAD_SPECIFIC_DECL T + #define wxTLS_TYPE_REF(T) T& + #define wxTLS_PTR(var) (&(var)) + #define wxTLS_VALUE(var) (var) +#else // !wxHAS_COMPILER_TLS + + extern "C" + { + typedef void (*wxTlsDestructorFunction)(void*); + } + + #if defined(__WINDOWS__) + #include "wx/msw/tls.h" + #elif defined(__UNIX__) + #include "wx/unix/tls.h" + #else + // TODO: we could emulate TLS for such platforms... + #error Neither compiler nor OS support thread-specific variables. + #endif + + #include <stdlib.h> // for calloc() + + // wxTlsValue<T> represents a thread-specific value of type T but, unlike + // with native compiler thread-specific variables, it behaves like a + // (never NULL) pointer to T and so needs to be dereferenced before use + // + // Note: T must be a POD! + // + // Note: On Unix, thread-specific T value is freed when the thread exits. + // On Windows, thread-specific values are freed later, when given + // wxTlsValue<T> is destroyed. The only exception to this is the + // value for the main thread, which is always freed when + // wxTlsValue<T> is destroyed. + template <typename T> + class wxTlsValue + { + public: + typedef T ValueType; + + // ctor doesn't do anything, the object is created on first access + wxTlsValue() : m_key(free) {} + + // dtor is only called in the main thread context and so is not enough + // to free memory allocated by us for the other threads, we use + // destructor function when using Pthreads for this (which is not + // called for the main thread as it doesn't call pthread_exit() but + // just to be safe we also reset the key anyhow) + ~wxTlsValue() + { + if ( m_key.Get() ) + m_key.Set(NULL); // this deletes the value + } + + // access the object creating it on demand + ValueType *Get() + { + void *value = m_key.Get(); + if ( !value ) + { + // ValueType must be POD to be used in wxHAS_COMPILER_TLS case + // anyhow (at least gcc doesn't accept non-POD values being + // declared with __thread) so initialize it as a POD too + value = calloc(1, sizeof(ValueType)); + + if ( !m_key.Set(value) ) + { + free(value); + + // this will probably result in a crash in the caller but + // it's arguably better to crash immediately instead of + // slowly dying from out-of-memory errors which would + // happen as the next access to this object would allocate + // another ValueType instance and so on forever + value = NULL; + } + } + + return static_cast<ValueType *>(value); + } + + // pointer-like accessors + ValueType *operator->() { return Get(); } + ValueType& operator*() { return *Get(); } + + private: + wxTlsKey m_key; + + wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxTlsValue, T); + }; + + #define wxTLS_TYPE(T) wxTlsValue<T> + #define wxTLS_TYPE_REF(T) wxTLS_TYPE(T)& + #define wxTLS_PTR(var) ((var).Get()) + #define wxTLS_VALUE(var) (*(var)) +#endif // wxHAS_COMPILER_TLS/!wxHAS_COMPILER_TLS + +#endif // _WX_TLS_H_ + diff --git a/lib/wxWidgets/include/wx/tokenzr.h b/lib/wxWidgets/include/wx/tokenzr.h new file mode 100644 index 0000000..45f91a0 --- /dev/null +++ b/lib/wxWidgets/include/wx/tokenzr.h @@ -0,0 +1,153 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/tokenzr.h +// Purpose: String tokenizer - a C++ replacement for strtok(3) +// Author: Guilhem Lavaux +// Modified by: (or rather rewritten by) Vadim Zeitlin +// Created: 04/22/98 +// Copyright: (c) Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TOKENZRH +#define _WX_TOKENZRH + +#include "wx/object.h" +#include "wx/string.h" +#include "wx/arrstr.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// default: delimiters are usual white space characters +#define wxDEFAULT_DELIMITERS (wxT(" \t\r\n")) + +// wxStringTokenizer mode flags which determine its behaviour +enum wxStringTokenizerMode +{ + wxTOKEN_INVALID = -1, // set by def ctor until SetString() is called + wxTOKEN_DEFAULT, // strtok() for whitespace delims, RET_EMPTY else + wxTOKEN_RET_EMPTY, // return empty token in the middle of the string + wxTOKEN_RET_EMPTY_ALL, // return trailing empty tokens too + wxTOKEN_RET_DELIMS, // return the delim with token (implies RET_EMPTY) + wxTOKEN_STRTOK // behave exactly like strtok(3) +}; + +// ---------------------------------------------------------------------------- +// wxStringTokenizer: replaces infamous strtok() and has some other features +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStringTokenizer : public wxObject +{ +public: + // ctors and initializers + // default ctor, call SetString() later + wxStringTokenizer() { m_mode = wxTOKEN_INVALID; } + // ctor which gives us the string + wxStringTokenizer(const wxString& str, + const wxString& delims = wxDEFAULT_DELIMITERS, + wxStringTokenizerMode mode = wxTOKEN_DEFAULT); + // copy ctor and assignment operator + wxStringTokenizer(const wxStringTokenizer& src); + wxStringTokenizer& operator=(const wxStringTokenizer& src); + + // args are same as for the non default ctor above + void SetString(const wxString& str, + const wxString& delims = wxDEFAULT_DELIMITERS, + wxStringTokenizerMode mode = wxTOKEN_DEFAULT); + + // reinitialize the tokenizer with the same delimiters/mode + void Reinit(const wxString& str); + + // tokens access + // return the number of remaining tokens + size_t CountTokens() const; + // did we reach the end of the string? + bool HasMoreTokens() const; + // get the next token, will return empty string if !HasMoreTokens() + wxString GetNextToken(); + // get the delimiter which terminated the token last retrieved by + // GetNextToken() or NUL if there had been no tokens yet or the last + // one wasn't terminated (but ran to the end of the string) + wxChar GetLastDelimiter() const { return m_lastDelim; } + + // get current tokenizer state + // returns the part of the string which remains to tokenize (*not* the + // initial string) + wxString GetString() const { return wxString(m_pos, m_string.end()); } + + // returns the current position (i.e. one index after the last + // returned token or 0 if GetNextToken() has never been called) in the + // original string + size_t GetPosition() const { return m_pos - m_string.begin(); } + + // misc + // get the current mode - can be different from the one passed to the + // ctor if it was wxTOKEN_DEFAULT + wxStringTokenizerMode GetMode() const { return m_mode; } + // do we return empty tokens? + bool AllowEmpty() const { return m_mode != wxTOKEN_STRTOK; } + + + // backwards compatibility section from now on + // ------------------------------------------- + + // for compatibility only, use GetNextToken() instead + wxString NextToken() { return GetNextToken(); } + + // compatibility only, don't use + void SetString(const wxString& to_tokenize, + const wxString& delims, + bool WXUNUSED(ret_delim)) + { + SetString(to_tokenize, delims, wxTOKEN_RET_DELIMS); + } + + wxStringTokenizer(const wxString& to_tokenize, + const wxString& delims, + bool ret_delim) + { + SetString(to_tokenize, delims, ret_delim); + } + +protected: + bool IsOk() const { return m_mode != wxTOKEN_INVALID; } + + bool DoHasMoreTokens() const; + + void DoCopyFrom(const wxStringTokenizer& src); + + enum MoreTokensState + { + MoreTokens_Unknown, + MoreTokens_Yes, + MoreTokens_No + }; + + MoreTokensState m_hasMoreTokens; + + wxString m_string; // the string we tokenize + wxString::const_iterator m_stringEnd; + // FIXME-UTF8: use wxWcharBuffer + wxWxCharBuffer m_delims; // all possible delimiters + size_t m_delimsLen; + + wxString::const_iterator m_pos; // the current position in m_string + + wxStringTokenizerMode m_mode; // see wxTOKEN_XXX values + + wxChar m_lastDelim; // delimiter after last token or '\0' +}; + +// ---------------------------------------------------------------------------- +// convenience function which returns all tokens at once +// ---------------------------------------------------------------------------- + +// the function takes the same parameters as wxStringTokenizer ctor and returns +// the array containing all tokens +wxArrayString WXDLLIMPEXP_BASE +wxStringTokenize(const wxString& str, + const wxString& delims = wxDEFAULT_DELIMITERS, + wxStringTokenizerMode mode = wxTOKEN_DEFAULT); + +#endif // _WX_TOKENZRH diff --git a/lib/wxWidgets/include/wx/toolbar.h b/lib/wxWidgets/include/wx/toolbar.h new file mode 100644 index 0000000..f6a3a76 --- /dev/null +++ b/lib/wxWidgets/include/wx/toolbar.h @@ -0,0 +1,87 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/toolbar.h +// Purpose: wxToolBar interface declaration +// Author: Vadim Zeitlin +// Modified by: +// Created: 20.11.99 +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TOOLBAR_H_BASE_ +#define _WX_TOOLBAR_H_BASE_ + +#include "wx/defs.h" + +// ---------------------------------------------------------------------------- +// wxToolBar style flags +// ---------------------------------------------------------------------------- + +enum wxToolBarStyleFlags +{ + // lay out the toolbar horizontally + wxTB_HORIZONTAL = wxHORIZONTAL, // == 0x0004 + wxTB_TOP = wxTB_HORIZONTAL, + + // lay out the toolbar vertically + wxTB_VERTICAL = wxVERTICAL, // == 0x0008 + wxTB_LEFT = wxTB_VERTICAL, + + // "flat" buttons (Win32/GTK only) + wxTB_FLAT = 0x0020, + + // dockable toolbar (GTK only) + wxTB_DOCKABLE = 0x0040, + + // don't show the icons (they're shown by default) + wxTB_NOICONS = 0x0080, + + // show the text (not shown by default) + wxTB_TEXT = 0x0100, + + // don't show the divider between toolbar and the window (Win32 only) + wxTB_NODIVIDER = 0x0200, + + // no automatic alignment (Win32 only, useless) + wxTB_NOALIGN = 0x0400, + + // show the text and the icons alongside, not vertically stacked (Win32/GTK) + wxTB_HORZ_LAYOUT = 0x0800, + wxTB_HORZ_TEXT = wxTB_HORZ_LAYOUT | wxTB_TEXT, + + // don't show the toolbar short help tooltips + wxTB_NO_TOOLTIPS = 0x1000, + + // lay out toolbar at the bottom of the window + wxTB_BOTTOM = 0x2000, + + // lay out toolbar at the right edge of the window + wxTB_RIGHT = 0x4000, + + wxTB_DEFAULT_STYLE = wxTB_HORIZONTAL +}; + +wxALLOW_COMBINING_ENUMS(wxToolBarStyleFlags, wxBorder) + +#if wxUSE_TOOLBAR + #include "wx/tbarbase.h" // the base class for all toolbars + + #if defined(__WXUNIVERSAL__) + #include "wx/univ/toolbar.h" + #elif defined(__WXMSW__) + #include "wx/msw/toolbar.h" + #elif defined(__WXMOTIF__) + #include "wx/motif/toolbar.h" + #elif defined(__WXGTK20__) + #include "wx/gtk/toolbar.h" + #elif defined(__WXGTK__) + #include "wx/gtk1/toolbar.h" + #elif defined(__WXMAC__) + #include "wx/osx/toolbar.h" + #elif defined(__WXQT__) + #include "wx/qt/toolbar.h" + #endif +#endif // wxUSE_TOOLBAR + +#endif + // _WX_TOOLBAR_H_BASE_ diff --git a/lib/wxWidgets/include/wx/toolbook.h b/lib/wxWidgets/include/wx/toolbook.h new file mode 100644 index 0000000..b75ee03 --- /dev/null +++ b/lib/wxWidgets/include/wx/toolbook.h @@ -0,0 +1,156 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/toolbook.h +// Purpose: wxToolbook: wxToolBar and wxNotebook combination +// Author: Julian Smart +// Modified by: +// Created: 2006-01-29 +// Copyright: (c) 2006 Julian Smart +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TOOLBOOK_H_ +#define _WX_TOOLBOOK_H_ + +#include "wx/defs.h" + +#if wxUSE_TOOLBOOK + +#include "wx/bookctrl.h" +#include "wx/containr.h" + +class WXDLLIMPEXP_FWD_CORE wxToolBarBase; +class WXDLLIMPEXP_FWD_CORE wxCommandEvent; + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TOOLBOOK_PAGE_CHANGED, wxBookCtrlEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TOOLBOOK_PAGE_CHANGING, wxBookCtrlEvent ); + + +// Use wxButtonToolBar +#define wxTBK_BUTTONBAR 0x0100 + +// Use wxTB_HORZ_LAYOUT style for the controlling toolbar +#define wxTBK_HORZ_LAYOUT 0x8000 + +// deprecated synonym, don't use +#if WXWIN_COMPATIBILITY_2_8 + #define wxBK_BUTTONBAR wxTBK_BUTTONBAR +#endif + +// ---------------------------------------------------------------------------- +// wxToolbook +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxToolbook : public wxNavigationEnabled<wxBookCtrlBase> +{ +public: + wxToolbook() + { + Init(); + } + + wxToolbook(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxEmptyString) + { + Init(); + + (void)Create(parent, id, pos, size, style, name); + } + + // quasi ctor + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxEmptyString); + + + // implement base class virtuals + virtual bool SetPageText(size_t n, const wxString& strText) wxOVERRIDE; + virtual wxString GetPageText(size_t n) const wxOVERRIDE; + virtual int GetPageImage(size_t n) const wxOVERRIDE; + virtual bool SetPageImage(size_t n, int imageId) wxOVERRIDE; + virtual bool InsertPage(size_t n, + wxWindow *page, + const wxString& text, + bool bSelect = false, + int imageId = NO_IMAGE) wxOVERRIDE; + virtual int SetSelection(size_t n) wxOVERRIDE { return DoSetSelection(n, SetSelection_SendEvent); } + virtual int ChangeSelection(size_t n) wxOVERRIDE { return DoSetSelection(n); } + + virtual bool DeleteAllPages() wxOVERRIDE; + virtual int HitTest(const wxPoint& pt, long *flags = NULL) const wxOVERRIDE; + + + // methods which are not part of base wxBookctrl API + + // get the underlying toolbar + wxToolBarBase* GetToolBar() const { return (wxToolBarBase*)m_bookctrl; } + + // enable/disable a page + bool EnablePage(wxWindow *page, bool enable); + bool EnablePage(size_t page, bool enable); + + // must be called in OnIdle or by application to realize the toolbar and + // select the initial page. + void Realize(); + +protected: + virtual wxWindow *DoRemovePage(size_t page) wxOVERRIDE; + + // event handlers + void OnToolSelected(wxCommandEvent& event); + void OnSize(wxSizeEvent& event); + void OnIdle(wxIdleEvent& event); + + void UpdateSelectedPage(size_t newsel) wxOVERRIDE; + + wxBookCtrlEvent* CreatePageChangingEvent() const wxOVERRIDE; + void MakeChangedEvent(wxBookCtrlEvent &event) wxOVERRIDE; + + // whether the toolbar needs to be realized + bool m_needsRealizing; + +private: + // common part of all constructors + void Init(); + + // returns the tool identifier for the specified page + int PageToToolId(size_t page) const; + + // returns the page index for the specified tool ID or + // wxNOT_FOUND if there is no page with that tool ID + int ToolIdToPage(int toolId) const; + + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxToolbook); +}; + +// ---------------------------------------------------------------------------- +// listbook event class and related stuff +// ---------------------------------------------------------------------------- + +// wxToolbookEvent is obsolete and defined for compatibility only +#define wxToolbookEvent wxBookCtrlEvent +typedef wxBookCtrlEventFunction wxToolbookEventFunction; +#define wxToolbookEventHandler(func) wxBookCtrlEventHandler(func) + + +#define EVT_TOOLBOOK_PAGE_CHANGED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_TOOLBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn)) + +#define EVT_TOOLBOOK_PAGE_CHANGING(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_TOOLBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn)) + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED wxEVT_TOOLBOOK_PAGE_CHANGED +#define wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING wxEVT_TOOLBOOK_PAGE_CHANGING + +#endif // wxUSE_TOOLBOOK + +#endif // _WX_TOOLBOOK_H_ diff --git a/lib/wxWidgets/include/wx/tooltip.h b/lib/wxWidgets/include/wx/tooltip.h new file mode 100644 index 0000000..d65fef0 --- /dev/null +++ b/lib/wxWidgets/include/wx/tooltip.h @@ -0,0 +1,36 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/tooltip.h +// Purpose: wxToolTip base header +// Author: Robert Roebling +// Modified by: +// Created: +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TOOLTIP_H_BASE_ +#define _WX_TOOLTIP_H_BASE_ + +#include "wx/defs.h" + +#if wxUSE_TOOLTIPS + +#if defined(__WXMSW__) +#include "wx/msw/tooltip.h" +#elif defined(__WXMOTIF__) +// #include "wx/motif/tooltip.h" +#elif defined(__WXGTK20__) +#include "wx/gtk/tooltip.h" +#elif defined(__WXGTK__) +#include "wx/gtk1/tooltip.h" +#elif defined(__WXMAC__) +#include "wx/osx/tooltip.h" +#elif defined(__WXQT__) +#include "wx/qt/tooltip.h" +#endif + +#endif + // wxUSE_TOOLTIPS + +#endif + // _WX_TOOLTIP_H_BASE_ diff --git a/lib/wxWidgets/include/wx/toplevel.h b/lib/wxWidgets/include/wx/toplevel.h new file mode 100644 index 0000000..174937f --- /dev/null +++ b/lib/wxWidgets/include/wx/toplevel.h @@ -0,0 +1,425 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/toplevel.h +// Purpose: declares wxTopLevelWindow class, the base class for all +// top level windows (such as frames and dialogs) +// Author: Vadim Zeitlin, Vaclav Slavik +// Modified by: +// Created: 06.08.01 +// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Vaclav Slavik <vaclav@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TOPLEVEL_BASE_H_ +#define _WX_TOPLEVEL_BASE_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/nonownedwnd.h" +#include "wx/iconbndl.h" +#include "wx/weakref.h" + +// the default names for various classes +extern WXDLLIMPEXP_DATA_CORE(const char) wxFrameNameStr[]; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +/* + Summary of the bits used (some of them are defined in wx/frame.h and + wx/dialog.h and not here): + + +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + |15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0| + +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | \_ wxCENTRE + | | | | | | | | | | | | | | \____ wxFRAME_NO_TASKBAR + | | | | | | | | | | | | | \_______ wxFRAME_TOOL_WINDOW + | | | | | | | | | | | | \__________ wxFRAME_FLOAT_ON_PARENT + | | | | | | | | | | | \_____________ wxFRAME_SHAPED + | | | | | | | | | | \________________ wxDIALOG_NO_PARENT + | | | | | | | | | \___________________ wxRESIZE_BORDER + | | | | | | | | \______________________ wxTINY_CAPTION_VERT + | | | | | | | \_________________________ + | | | | | | \____________________________ wxMAXIMIZE_BOX + | | | | | \_______________________________ wxMINIMIZE_BOX + | | | | \__________________________________ wxSYSTEM_MENU + | | | \_____________________________________ wxCLOSE_BOX + | | \________________________________________ wxMAXIMIZE + | \___________________________________________ wxMINIMIZE + \______________________________________________ wxSTAY_ON_TOP + + + Notice that the 8 lower bits overlap with wxCENTRE and the button selection + bits (wxYES, wxOK wxNO, wxCANCEL, wxAPPLY, wxCLOSE and wxNO_DEFAULT) which + can be combined with the dialog style for several standard dialogs and + hence shouldn't overlap with any styles which can be used for the dialogs. + Additionally, wxCENTRE can be used with frames also. + */ + +// style common to both wxFrame and wxDialog +#define wxSTAY_ON_TOP 0x8000 +#define wxICONIZE 0x4000 +#define wxMINIMIZE wxICONIZE +#define wxMAXIMIZE 0x2000 +#define wxCLOSE_BOX 0x1000 // == wxHELP so can't be used with it + +#define wxSYSTEM_MENU 0x0800 +#define wxMINIMIZE_BOX 0x0400 +#define wxMAXIMIZE_BOX 0x0200 + +#define wxTINY_CAPTION 0x0080 // clashes with wxNO_DEFAULT +#define wxRESIZE_BORDER 0x0040 // == wxCLOSE + +#if WXWIN_COMPATIBILITY_2_8 + // HORIZ and VERT styles are equivalent anyhow so don't use different names + // for them + #define wxTINY_CAPTION_HORIZ wxTINY_CAPTION + #define wxTINY_CAPTION_VERT wxTINY_CAPTION +#endif + +// default style +#define wxDEFAULT_FRAME_STYLE \ + (wxSYSTEM_MENU | \ + wxRESIZE_BORDER | \ + wxMINIMIZE_BOX | \ + wxMAXIMIZE_BOX | \ + wxCLOSE_BOX | \ + wxCAPTION | \ + wxCLIP_CHILDREN) + + +// Dialogs are created in a special way +#define wxTOPLEVEL_EX_DIALOG 0x00000008 + +// Styles for ShowFullScreen +// (note that wxTopLevelWindow only handles wxFULLSCREEN_NOBORDER and +// wxFULLSCREEN_NOCAPTION; the rest is handled by wxTopLevelWindow) +enum +{ + wxFULLSCREEN_NOMENUBAR = 0x0001, + wxFULLSCREEN_NOTOOLBAR = 0x0002, + wxFULLSCREEN_NOSTATUSBAR = 0x0004, + wxFULLSCREEN_NOBORDER = 0x0008, + wxFULLSCREEN_NOCAPTION = 0x0010, + + wxFULLSCREEN_ALL = wxFULLSCREEN_NOMENUBAR | wxFULLSCREEN_NOTOOLBAR | + wxFULLSCREEN_NOSTATUSBAR | wxFULLSCREEN_NOBORDER | + wxFULLSCREEN_NOCAPTION +}; + +// Styles for RequestUserAttention +enum +{ + wxUSER_ATTENTION_INFO = 1, + wxUSER_ATTENTION_ERROR = 2 +}; + +// Values for Get/SetContentProtection +enum wxContentProtection +{ + wxCONTENT_PROTECTION_NONE, + wxCONTENT_PROTECTION_ENABLED +}; + +// ---------------------------------------------------------------------------- +// wxTopLevelWindow: a top level (as opposed to child) window +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTopLevelWindowBase : public wxNonOwnedWindow +{ +public: + // construction + wxTopLevelWindowBase(); + virtual ~wxTopLevelWindowBase(); + + // top level wnd state + // -------------------- + + // maximize = true => maximize, otherwise - restore + virtual void Maximize(bool maximize = true) = 0; + + // undo Maximize() or Iconize() + virtual void Restore() = 0; + + // iconize = true => iconize, otherwise - restore + virtual void Iconize(bool iconize = true) = 0; + + // return true if the frame is maximized + virtual bool IsMaximized() const = 0; + + // return true if the frame is always maximized + // due to native guidelines or current policy + virtual bool IsAlwaysMaximized() const; + + // return true if the frame is iconized + virtual bool IsIconized() const = 0; + + // get the frame icon + wxIcon GetIcon() const; + + // get the frame icons + const wxIconBundle& GetIcons() const { return m_icons; } + + // set the frame icon: implemented in terms of SetIcons() + void SetIcon(const wxIcon& icon); + + // set the frame icons + virtual void SetIcons(const wxIconBundle& icons) { m_icons = icons; } + + virtual bool EnableFullScreenView(bool WXUNUSED(enable) = true, + long WXUNUSED(style) = wxFULLSCREEN_ALL) + { + return false; + } + + // maximize the window to cover entire screen + virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) = 0; + + // shows the window, but doesn't activate it. If the base code is being run, + // it means the port doesn't implement this method yet and so alert the user. + virtual void ShowWithoutActivating() { + wxFAIL_MSG("ShowWithoutActivating not implemented on this platform."); + } + + // return true if the frame is in fullscreen mode + virtual bool IsFullScreen() const = 0; + + virtual wxContentProtection GetContentProtection() const + { return wxCONTENT_PROTECTION_NONE; } + virtual bool SetContentProtection(wxContentProtection WXUNUSED(contentProtection)) + { return false; } + + // the title of the top level window: the text which the + // window shows usually at the top of the frame/dialog in dedicated bar + virtual void SetTitle(const wxString& title) = 0; + virtual wxString GetTitle() const = 0; + + // enable/disable close button [x] + virtual bool EnableCloseButton(bool WXUNUSED(enable) = true) { return false; } + virtual bool EnableMaximizeButton(bool WXUNUSED(enable) = true) { return false; } + virtual bool EnableMinimizeButton(bool WXUNUSED(enable) = true) { return false; } + + // Attracts the users attention to this window if the application is + // inactive (should be called when a background event occurs) + virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO); + + // Is this the active frame (highlighted in the taskbar)? + // + // A TLW is active only if it contains the currently focused window. + virtual bool IsActive() { return IsDescendant(FindFocus()); } + + // this function may be overridden to return false to allow closing the + // application even when this top level window is still open + // + // notice that the window is still closed prior to the application exit and + // so it can still veto it even if it returns false from here + virtual bool ShouldPreventAppExit() const { return true; } + + // centre the window on screen: this is just a shortcut + void CentreOnScreen(int dir = wxBOTH) { DoCentre(dir | wxCENTRE_ON_SCREEN); } + void CenterOnScreen(int dir = wxBOTH) { CentreOnScreen(dir); } + + // Get the default size for a new top level window. This is used when + // creating a wxTLW under some platforms if no explicit size given. + static wxSize GetDefaultSize(); + + + // default item access: we have a permanent default item which is the one + // set by the user code but we may also have a temporary default item which + // would be chosen if the user pressed "Enter" now but the default action + // reverts to the "permanent" default as soon as this temporary default + // item loses focus + + // get the default item, temporary or permanent + wxWindow *GetDefaultItem() const + { return m_winTmpDefault ? m_winTmpDefault : m_winDefault; } + + // set the permanent default item, return the old default + wxWindow *SetDefaultItem(wxWindow *win) + { wxWindow *old = GetDefaultItem(); m_winDefault = win; return old; } + + // return the temporary default item, can be NULL + wxWindow *GetTmpDefaultItem() const { return m_winTmpDefault; } + + // set a temporary default item, SetTmpDefaultItem(NULL) should be called + // soon after a call to SetTmpDefaultItem(window), return the old default + wxWindow *SetTmpDefaultItem(wxWindow *win) + { wxWindow *old = GetDefaultItem(); m_winTmpDefault = win; return old; } + + + // Class for saving/restoring fields describing the window geometry. + // + // This class is used by the functions below to allow saving the geometry + // of the window and restoring it later. The components describing geometry + // are platform-dependent, so there is no struct containing them and + // instead the methods of this class are used to save or [try to] restore + // whichever components are used under the current platform. + class GeometrySerializer + { + public: + virtual ~GeometrySerializer() {} + + // If saving a field returns false, it's fatal error and SaveGeometry() + // will return false. + virtual bool SaveField(const wxString& name, int value) const = 0; + + // If restoring a field returns false, it just means that the field is + // not present and RestoreToGeometry() still continues with restoring + // the other values. + virtual bool RestoreField(const wxString& name, int* value) = 0; + }; + + // Save the current window geometry using the provided serializer and + // restore the window to the previously saved geometry. + bool SaveGeometry(const GeometrySerializer& ser) const; + bool RestoreToGeometry(GeometrySerializer& ser); + + + // implementation only from now on + // ------------------------------- + + // override some base class virtuals + virtual bool Destroy() wxOVERRIDE; + virtual bool IsTopLevel() const wxOVERRIDE { return true; } + virtual bool IsTopNavigationDomain(NavigationKind kind) const wxOVERRIDE; + virtual bool IsVisible() const { return IsShown(); } + + // override to do TLW-specific layout: we resize our unique child to fill + // the entire client area + virtual bool Layout() wxOVERRIDE; + + // event handlers + void OnCloseWindow(wxCloseEvent& event); + void OnSize(wxSizeEvent& WXUNUSED(event)) { Layout(); } + + // Get rect to be used to center top-level children + virtual void GetRectForTopLevelChildren(int *x, int *y, int *w, int *h); + + // this should go away, but for now it's called from docview.cpp, + // so should be there for all platforms + void OnActivate(wxActivateEvent &WXUNUSED(event)) { } + + // do the window-specific processing after processing the update event + virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) wxOVERRIDE ; + + // a different API for SetSizeHints + virtual void SetMinSize(const wxSize& minSize) wxOVERRIDE; + virtual void SetMaxSize(const wxSize& maxSize) wxOVERRIDE; + + virtual void OSXSetModified(bool modified) { m_modified = modified; } + virtual bool OSXIsModified() const { return m_modified; } + + virtual void SetRepresentedFilename(const wxString& WXUNUSED(filename)) { } + +protected: + // the frame client to screen translation should take account of the + // toolbar which may shift the origin of the client area + virtual void DoClientToScreen(int *x, int *y) const wxOVERRIDE; + virtual void DoScreenToClient(int *x, int *y) const wxOVERRIDE; + + // add support for wxCENTRE_ON_SCREEN + virtual void DoCentre(int dir) wxOVERRIDE; + + // no need to do client to screen translation to get our position in screen + // coordinates: this is already the case + virtual void DoGetScreenPosition(int *x, int *y) const wxOVERRIDE + { + DoGetPosition(x, y); + } + + // test whether this window makes part of the frame + // (menubar, toolbar and statusbar are excluded from automatic layout) + virtual bool IsOneOfBars(const wxWindow *WXUNUSED(win)) const + { return false; } + + // check if we should exit the program after deleting this window + bool IsLastBeforeExit() const; + + // send the iconize event, return true if processed + bool SendIconizeEvent(bool iconized = true); + + // this method is only kept for compatibility, call Layout() instead. + void DoLayout() { Layout(); } + + static int WidthDefault(int w) { return w == wxDefaultCoord ? GetDefaultSize().x : w; } + static int HeightDefault(int h) { return h == wxDefaultCoord ? GetDefaultSize().y : h; } + + // Stub virtual functions for forward binary compatibility. DO NOT USE. + virtual void* WXReservedTLW1(void*); + virtual void* WXReservedTLW2(void*); + virtual void* WXReservedTLW3(void*); + + + // the frame icon + wxIconBundle m_icons; + + // a default window (usually a button) or NULL + wxWindowRef m_winDefault; + + // a temporary override of m_winDefault, use the latter if NULL + wxWindowRef m_winTmpDefault; + + bool m_modified; + + wxDECLARE_NO_COPY_CLASS(wxTopLevelWindowBase); + wxDECLARE_EVENT_TABLE(); +}; + + +// include the real class declaration +#if defined(__WXMSW__) + #include "wx/msw/toplevel.h" + #define wxTopLevelWindowNative wxTopLevelWindowMSW +#elif defined(__WXGTK20__) + #include "wx/gtk/toplevel.h" + #define wxTopLevelWindowNative wxTopLevelWindowGTK +#elif defined(__WXGTK__) + #include "wx/gtk1/toplevel.h" + #define wxTopLevelWindowNative wxTopLevelWindowGTK +#elif defined(__WXX11__) + #include "wx/x11/toplevel.h" + #define wxTopLevelWindowNative wxTopLevelWindowX11 +#elif defined(__WXDFB__) + #include "wx/dfb/toplevel.h" + #define wxTopLevelWindowNative wxTopLevelWindowDFB +#elif defined(__WXMAC__) + #include "wx/osx/toplevel.h" + #define wxTopLevelWindowNative wxTopLevelWindowMac +#elif defined(__WXMOTIF__) + #include "wx/motif/toplevel.h" + #define wxTopLevelWindowNative wxTopLevelWindowMotif +#elif defined(__WXQT__) + #include "wx/qt/toplevel.h" +#define wxTopLevelWindowNative wxTopLevelWindowQt +#endif + +#ifdef __WXUNIVERSAL__ + #include "wx/univ/toplevel.h" +#else // !__WXUNIVERSAL__ + class WXDLLIMPEXP_CORE wxTopLevelWindow : public wxTopLevelWindowNative + { + public: + // construction + wxTopLevelWindow() { } + wxTopLevelWindow(wxWindow *parent, + wxWindowID winid, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + : wxTopLevelWindowNative(parent, winid, title, + pos, size, style, name) + { + } + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTopLevelWindow); + }; +#endif // __WXUNIVERSAL__/!__WXUNIVERSAL__ + +#endif // _WX_TOPLEVEL_BASE_H_ diff --git a/lib/wxWidgets/include/wx/tracker.h b/lib/wxWidgets/include/wx/tracker.h new file mode 100644 index 0000000..d8f2728 --- /dev/null +++ b/lib/wxWidgets/include/wx/tracker.h @@ -0,0 +1,91 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/tracker.h +// Purpose: Support class for object lifetime tracking (wxWeakRef<T>) +// Author: Arne Steinarson +// Created: 28 Dec 07 +// Copyright: (c) 2007 Arne Steinarson +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TRACKER_H_ +#define _WX_TRACKER_H_ + +#include "wx/defs.h" + +class wxEventConnectionRef; + +// This class represents an object tracker and is stored in a linked list +// in the tracked object. It is only used in one of its derived forms. +class WXDLLIMPEXP_BASE wxTrackerNode +{ +public: + wxTrackerNode() : m_nxt(NULL) { } + virtual ~wxTrackerNode() { } + + virtual void OnObjectDestroy() = 0; + + virtual wxEventConnectionRef *ToEventConnection() { return NULL; } + +private: + wxTrackerNode *m_nxt; + + friend class wxTrackable; // For list access + friend class wxEvtHandler; // For list access +}; + +// Add-on base class for a trackable object. +class WXDLLIMPEXP_BASE wxTrackable +{ +public: + void AddNode(wxTrackerNode *prn) + { + prn->m_nxt = m_first; + m_first = prn; + } + + void RemoveNode(wxTrackerNode *prn) + { + for ( wxTrackerNode **pprn = &m_first; *pprn; pprn = &(*pprn)->m_nxt ) + { + if ( *pprn == prn ) + { + *pprn = prn->m_nxt; + return; + } + } + + wxFAIL_MSG( "removing invalid tracker node" ); + } + + wxTrackerNode *GetFirst() const { return m_first; } + +protected: + // this class is only supposed to be used as a base class but never be + // created nor destroyed directly so all ctors and dtor are protected + + wxTrackable() : m_first(NULL) { } + + // copy ctor and assignment operator intentionally do not copy m_first: the + // objects which track the original trackable shouldn't track the new copy + wxTrackable(const wxTrackable& WXUNUSED(other)) : m_first(NULL) { } + wxTrackable& operator=(const wxTrackable& WXUNUSED(other)) { return *this; } + + // dtor is not virtual: this class is not supposed to be used + // polymorphically and adding a virtual table to it would add unwanted + // overhead + ~wxTrackable() + { + // Notify all registered refs + while ( m_first ) + { + wxTrackerNode * const first = m_first; + m_first = first->m_nxt; + first->OnObjectDestroy(); + } + } + + wxTrackerNode *m_first; +}; + +#endif // _WX_TRACKER_H_ + diff --git a/lib/wxWidgets/include/wx/translation.h b/lib/wxWidgets/include/wx/translation.h new file mode 100644 index 0000000..067564b --- /dev/null +++ b/lib/wxWidgets/include/wx/translation.h @@ -0,0 +1,412 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/translation.h +// Purpose: Internationalization and localisation for wxWidgets +// Author: Vadim Zeitlin, Vaclav Slavik, +// Michael N. Filippov <michael@idisys.iae.nsk.su> +// Created: 2010-04-23 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// (c) 2010 Vaclav Slavik <vslavik@fastmail.fm> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TRANSLATION_H_ +#define _WX_TRANSLATION_H_ + +#include "wx/defs.h" +#include "wx/string.h" + +#if wxUSE_INTL + +#include "wx/buffer.h" +#include "wx/language.h" +#include "wx/hashmap.h" +#include "wx/strconv.h" +#include "wx/scopedptr.h" + +// ============================================================================ +// global decls +// ============================================================================ + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +// gettext() style macros (notice that xgettext should be invoked with +// --keyword="_" --keyword="wxPLURAL:1,2" options +// to extract the strings from the sources) +#ifndef WXINTL_NO_GETTEXT_MACRO +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + #define _(s) wxGetTranslation((s)) +#else + #define _(s) wxGetTranslation(wxASCII_STR(s)) +#endif + #define wxPLURAL(sing, plur, n) wxGetTranslation((sing), (plur), n) +#endif + +// wx-specific macro for translating strings in the given context: if you use +// them, you need to also add +// --keyword="wxGETTEXT_IN_CONTEXT:1c,2" --keyword="wxGETTEXT_IN_CONTEXT_PLURAL:1c,2,3" +// options to xgettext invocation. +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +#define wxGETTEXT_IN_CONTEXT(c, s) \ + wxGetTranslation((s), wxString(), c) +#else +#define wxGETTEXT_IN_CONTEXT(c, s) \ + wxGetTranslation(wxASCII_STR(s), wxString(), c) +#endif +#define wxGETTEXT_IN_CONTEXT_PLURAL(c, sing, plur, n) \ + wxGetTranslation((sing), (plur), n, wxString(), c) + +// another one which just marks the strings for extraction, but doesn't +// perform the translation (use -kwxTRANSLATE with xgettext!) +#define wxTRANSLATE(str) str + +// another one which just marks the strings, with a context, for extraction, +// but doesn't perform the translation (use -kwxTRANSLATE_IN_CONTEXT:1c,2 with +// xgettext!) +#define wxTRANSLATE_IN_CONTEXT(c, str) str + +// ---------------------------------------------------------------------------- +// forward decls +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_BASE wxArrayString; +class WXDLLIMPEXP_FWD_BASE wxTranslationsLoader; +class WXDLLIMPEXP_FWD_BASE wxLocale; + +class wxPluralFormsCalculator; +wxDECLARE_SCOPED_PTR(wxPluralFormsCalculator, wxPluralFormsCalculatorPtr) + +// ---------------------------------------------------------------------------- +// wxMsgCatalog corresponds to one loaded message catalog. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxMsgCatalog +{ +public: + // Ctor is protected, because CreateFromXXX functions must be used, + // but destruction should be unrestricted +#if !wxUSE_UNICODE + ~wxMsgCatalog(); +#endif + + // load the catalog from disk or from data; caller is responsible for + // deleting them if not NULL + static wxMsgCatalog *CreateFromFile(const wxString& filename, + const wxString& domain); + + static wxMsgCatalog *CreateFromData(const wxScopedCharBuffer& data, + const wxString& domain); + + // get name of the catalog + wxString GetDomain() const { return m_domain; } + + // get the translated string: returns NULL if not found + const wxString *GetString(const wxString& sz, unsigned n = UINT_MAX, const wxString& ct = wxEmptyString) const; + +protected: + wxMsgCatalog(const wxString& domain) + : m_pNext(NULL), m_domain(domain) +#if !wxUSE_UNICODE + , m_conv(NULL) +#endif + {} + +private: + // variable pointing to the next element in a linked list (or NULL) + wxMsgCatalog *m_pNext; + friend class wxTranslations; + + wxStringToStringHashMap m_messages; // all messages in the catalog + wxString m_domain; // name of the domain + +#if !wxUSE_UNICODE + // the conversion corresponding to this catalog charset if we installed it + // as the global one + wxCSConv *m_conv; +#endif + + wxPluralFormsCalculatorPtr m_pluralFormsCalculator; +}; + +// ---------------------------------------------------------------------------- +// wxTranslations: message catalogs +// ---------------------------------------------------------------------------- + +// this class allows to get translations for strings +class WXDLLIMPEXP_BASE wxTranslations +{ +public: + wxTranslations(); + ~wxTranslations(); + + // returns current translations object, may return NULL + static wxTranslations *Get(); + // sets current translations object (takes ownership; may be NULL) + static void Set(wxTranslations *t); + + // changes loader to non-default one; takes ownership of 'loader' + void SetLoader(wxTranslationsLoader *loader); + + void SetLanguage(wxLanguage lang); + void SetLanguage(const wxString& lang); + + // get languages available for this app + wxArrayString GetAvailableTranslations(const wxString& domain) const; + +#if wxABI_VERSION >= 30203 + // find best available translation language for given domain + wxString GetBestAvailableTranslation(const wxString& domain); +#endif // wxABI_VERSION >= 3.2.3 + + wxString GetBestTranslation(const wxString& domain, wxLanguage msgIdLanguage); + wxString GetBestTranslation(const wxString& domain, + const wxString& msgIdLanguage = wxASCII_STR("en")); + +#if wxABI_VERSION >= 30203 + // add catalog for the given domain returning true if it could be found by + // wxTranslationsLoader + bool AddAvailableCatalog(const wxString& domain); +#endif // wxABI_VERSION >= 3.2.3 + + // add standard wxWidgets catalog ("wxstd") + bool AddStdCatalog(); + + // add catalog with given domain name and language, looking it up via + // wxTranslationsLoader -- unlike AddAvailableCatalog(), this function also + // returns true if this catalog is not needed at all because msgIdLanguage + // is an acceptable language to use directly + bool AddCatalog(const wxString& domain, + wxLanguage msgIdLanguage = wxLANGUAGE_ENGLISH_US); +#if !wxUSE_UNICODE + bool AddCatalog(const wxString& domain, + wxLanguage msgIdLanguage, + const wxString& msgIdCharset); +#endif + + // check if the given catalog is loaded + bool IsLoaded(const wxString& domain) const; + + // access to translations + const wxString *GetTranslatedString(const wxString& origString, + const wxString& domain = wxEmptyString, + const wxString& context = wxEmptyString) const; + const wxString *GetTranslatedString(const wxString& origString, + unsigned n, + const wxString& domain = wxEmptyString, + const wxString& context = wxEmptyString) const; + + wxString GetHeaderValue(const wxString& header, + const wxString& domain = wxEmptyString) const; + + // this is hack to work around a problem with wxGetTranslation() which + // returns const wxString& and not wxString, so when it returns untranslated + // string, it needs to have a copy of it somewhere + static const wxString& GetUntranslatedString(const wxString& str); + +private: + // perform loading of the catalog via m_loader + bool LoadCatalog(const wxString& domain, const wxString& lang, const wxString& msgIdLang); + + // find catalog by name in a linked list, return NULL if !found + wxMsgCatalog *FindCatalog(const wxString& domain) const; + + // same as Set(), without taking ownership; only for wxLocale + static void SetNonOwned(wxTranslations *t); + friend class wxLocale; + +private: + wxString m_lang; + wxTranslationsLoader *m_loader; + + wxMsgCatalog *m_pMsgCat; // pointer to linked list of catalogs + + // In addition to keeping all the catalogs in the linked list, we also + // store them in a hash map indexed by the domain name to allow finding + // them by name efficiently. + WX_DECLARE_HASH_MAP(wxString, wxMsgCatalog *, wxStringHash, wxStringEqual, wxMsgCatalogMap); + wxMsgCatalogMap m_catalogMap; +}; + + +// abstraction of translations discovery and loading +class WXDLLIMPEXP_BASE wxTranslationsLoader +{ +public: + wxTranslationsLoader() {} + virtual ~wxTranslationsLoader() {} + + virtual wxMsgCatalog *LoadCatalog(const wxString& domain, + const wxString& lang) = 0; + + virtual wxArrayString GetAvailableTranslations(const wxString& domain) const = 0; +}; + + +// standard wxTranslationsLoader implementation, using filesystem +class WXDLLIMPEXP_BASE wxFileTranslationsLoader + : public wxTranslationsLoader +{ +public: + static void AddCatalogLookupPathPrefix(const wxString& prefix); + + virtual wxMsgCatalog *LoadCatalog(const wxString& domain, + const wxString& lang) wxOVERRIDE; + + virtual wxArrayString GetAvailableTranslations(const wxString& domain) const wxOVERRIDE; +}; + + +#ifdef __WINDOWS__ +// loads translations from win32 resources +class WXDLLIMPEXP_BASE wxResourceTranslationsLoader + : public wxTranslationsLoader +{ +public: + virtual wxMsgCatalog *LoadCatalog(const wxString& domain, + const wxString& lang) wxOVERRIDE; + + virtual wxArrayString GetAvailableTranslations(const wxString& domain) const wxOVERRIDE; + +protected: + // returns resource type to use for translations + virtual wxString GetResourceType() const { return wxASCII_STR("MOFILE"); } + + // returns module to load resources from + virtual WXHINSTANCE GetModule() const { return NULL; } +}; +#endif // __WINDOWS__ + + +// ---------------------------------------------------------------------------- +// global functions +// ---------------------------------------------------------------------------- + +// get the translation of the string in the current locale +inline const wxString& wxGetTranslation(const wxString& str, + const wxString& domain = wxString(), + const wxString& context = wxString()) +{ + wxTranslations *trans = wxTranslations::Get(); + const wxString *transStr = trans ? trans->GetTranslatedString(str, domain, context) + : NULL; + if ( transStr ) + return *transStr; + else + // NB: this function returns reference to a string, so we have to keep + // a copy of it somewhere + return wxTranslations::GetUntranslatedString(str); +} + +inline const wxString& wxGetTranslation(const wxString& str1, + const wxString& str2, + unsigned n, + const wxString& domain = wxString(), + const wxString& context = wxString()) +{ + wxTranslations *trans = wxTranslations::Get(); + const wxString *transStr = trans ? trans->GetTranslatedString(str1, n, domain, context) + : NULL; + if ( transStr ) + return *transStr; + else + // NB: this function returns reference to a string, so we have to keep + // a copy of it somewhere + return n == 1 + ? wxTranslations::GetUntranslatedString(str1) + : wxTranslations::GetUntranslatedString(str2); +} + +#ifdef wxNO_IMPLICIT_WXSTRING_ENCODING + +/* + * It must always be possible to call wxGetTranslation() with const + * char* arguments. + */ +inline const wxString& wxGetTranslation(const char *str, + const char *domain = "", + const char *context = "") { + const wxMBConv &conv = wxConvWhateverWorks; + return wxGetTranslation(wxString(str, conv), wxString(domain, conv), + wxString(context, conv)); +} + +inline const wxString& wxGetTranslation(const char *str1, + const char *str2, + unsigned n, + const char *domain = "", + const char *context = "") { + const wxMBConv &conv = wxConvWhateverWorks; + return wxGetTranslation(wxString(str1, conv), wxString(str2, conv), n, + wxString(domain, conv), + wxString(context, conv)); +} + +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + +#else // !wxUSE_INTL + +// the macros should still be defined - otherwise compilation would fail + +#if !defined(WXINTL_NO_GETTEXT_MACRO) + #if !defined(_) +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + #define _(s) (s) +#else + #define _(s) wxASCII_STR(s) +#endif + #endif + #define wxPLURAL(sing, plur, n) ((n) == 1 ? (sing) : (plur)) + #define wxGETTEXT_IN_CONTEXT(c, s) (s) + #define wxGETTEXT_IN_CONTEXT_PLURAL(c, sing, plur, n) wxPLURAL(sing, plur, n) +#endif + +#define wxTRANSLATE(str) str +#define wxTRANSLATE_IN_CONTEXT(c, str) str + +// NB: we use a template here in order to avoid using +// wxLocale::GetUntranslatedString() above, which would be required if +// we returned const wxString&; this way, the compiler should be able to +// optimize wxGetTranslation() away + +template<typename TString> +inline TString wxGetTranslation(TString str) + { return str; } + +template<typename TString, typename TDomain> +inline TString wxGetTranslation(TString str, TDomain WXUNUSED(domain)) + { return str; } + +template<typename TString, typename TDomain, typename TContext> +inline TString wxGetTranslation(TString str, TDomain WXUNUSED(domain), TContext WXUNUSED(context)) + { return str; } + +template<typename TString, typename TDomain> +inline TString wxGetTranslation(TString str1, TString str2, size_t n) + { return n == 1 ? str1 : str2; } + +template<typename TString, typename TDomain> +inline TString wxGetTranslation(TString str1, TString str2, size_t n, + TDomain WXUNUSED(domain)) + { return n == 1 ? str1 : str2; } + +template<typename TString, typename TDomain, typename TContext> +inline TString wxGetTranslation(TString str1, TString str2, size_t n, + TDomain WXUNUSED(domain), + TContext WXUNUSED(context)) + { return n == 1 ? str1 : str2; } + +#endif // wxUSE_INTL/!wxUSE_INTL + +// define this one just in case it occurs somewhere (instead of preferred +// wxTRANSLATE) too +#if !defined(WXINTL_NO_GETTEXT_MACRO) + #if !defined(gettext_noop) + #define gettext_noop(str) (str) + #endif + #if !defined(N_) + #define N_(s) (s) + #endif +#endif + +#endif // _WX_TRANSLATION_H_ diff --git a/lib/wxWidgets/include/wx/treebase.h b/lib/wxWidgets/include/wx/treebase.h new file mode 100644 index 0000000..e2fd96d --- /dev/null +++ b/lib/wxWidgets/include/wx/treebase.h @@ -0,0 +1,369 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/treebase.h +// Purpose: wxTreeCtrl base classes and types +// Author: Julian Smart et al +// Modified by: +// Created: 01/02/97 +// Copyright: (c) 1997,1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TREEBASE_H_ +#define _WX_TREEBASE_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_TREECTRL + +#include "wx/window.h" // for wxClientData +#include "wx/event.h" +#include "wx/dynarray.h" +#include "wx/itemid.h" + +// ---------------------------------------------------------------------------- +// wxTreeItemId identifies an element of the tree. It's opaque for the +// application and the only method which can be used by user code is IsOk(). +// ---------------------------------------------------------------------------- + +// This is a class and not a typedef because existing code may forward declare +// wxTreeItemId as a class and we don't want to break it without good reason. +class wxTreeItemId : public wxItemId<void*> +{ +public: + wxTreeItemId() : wxItemId<void*>() { } + wxTreeItemId(void* pItem) : wxItemId<void*>(pItem) { } +}; + +// ---------------------------------------------------------------------------- +// wxTreeItemData is some (arbitrary) user class associated with some item. The +// main advantage of having this class (compared to old untyped interface) is +// that wxTreeItemData's are destroyed automatically by the tree and, as this +// class has virtual dtor, it means that the memory will be automatically +// freed. OTOH, we don't just use wxObject instead of wxTreeItemData because +// the size of this class is critical: in any real application, each tree leaf +// will have wxTreeItemData associated with it and number of leaves may be +// quite big. +// +// Because the objects of this class are deleted by the tree, they should +// always be allocated on the heap! +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTreeItemData: public wxClientData +{ +friend class WXDLLIMPEXP_FWD_CORE wxTreeCtrl; +friend class WXDLLIMPEXP_FWD_CORE wxGenericTreeCtrl; +public: + // creation/destruction + // -------------------- + // default ctor + wxTreeItemData() { } + + // default copy ctor/assignment operator are ok + + // accessor: get the item associated with us + const wxTreeItemId& GetId() const { return m_pItem; } + void SetId(const wxTreeItemId& id) { m_pItem = id; } + +protected: + wxTreeItemId m_pItem; +}; + +typedef void *wxTreeItemIdValue; + +WX_DEFINE_EXPORTED_ARRAY_PTR(wxTreeItemIdValue, wxArrayTreeItemIdsBase); + +// this is a wrapper around the array class defined above which allow to wok +// with values of natural wxTreeItemId type instead of using wxTreeItemIdValue +// and does it without any loss of efficiency +class wxArrayTreeItemIds : public wxArrayTreeItemIdsBase +{ +public: + void Add(const wxTreeItemId& id) + { wxArrayTreeItemIdsBase::Add(id.m_pItem); } + void Insert(const wxTreeItemId& id, size_t pos) + { wxArrayTreeItemIdsBase::Insert(id.m_pItem, pos); } + wxTreeItemId Item(size_t i) const + { return wxTreeItemId(wxArrayTreeItemIdsBase::Item(i)); } + wxTreeItemId operator[](size_t i) const { return Item(i); } +}; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// enum for different images associated with a treectrl item +enum wxTreeItemIcon +{ + wxTreeItemIcon_Normal, // not selected, not expanded + wxTreeItemIcon_Selected, // selected, not expanded + wxTreeItemIcon_Expanded, // not selected, expanded + wxTreeItemIcon_SelectedExpanded, // selected, expanded + wxTreeItemIcon_Max +}; + +// special values for the 'state' parameter of wxTreeCtrl::SetItemState() +static const int wxTREE_ITEMSTATE_NONE = -1; // not state (no display state image) +static const int wxTREE_ITEMSTATE_NEXT = -2; // cycle to the next state +static const int wxTREE_ITEMSTATE_PREV = -3; // cycle to the previous state + +// ---------------------------------------------------------------------------- +// wxTreeCtrl flags +// ---------------------------------------------------------------------------- + +#define wxTR_NO_BUTTONS 0x0000 // for convenience +#define wxTR_HAS_BUTTONS 0x0001 // draw collapsed/expanded btns +#define wxTR_NO_LINES 0x0004 // don't draw lines at all +#define wxTR_LINES_AT_ROOT 0x0008 // connect top-level nodes +#define wxTR_TWIST_BUTTONS 0x0010 // still used by wxTreeListCtrl + +#define wxTR_SINGLE 0x0000 // for convenience +#define wxTR_MULTIPLE 0x0020 // can select multiple items + +#if WXWIN_COMPATIBILITY_2_8 + #define wxTR_EXTENDED 0x0040 // deprecated, don't use +#endif // WXWIN_COMPATIBILITY_2_8 + +#define wxTR_HAS_VARIABLE_ROW_HEIGHT 0x0080 // what it says + +#define wxTR_EDIT_LABELS 0x0200 // can edit item labels +#define wxTR_ROW_LINES 0x0400 // put border around items +#define wxTR_HIDE_ROOT 0x0800 // don't display root node + +#define wxTR_FULL_ROW_HIGHLIGHT 0x2000 // highlight full horz space + +// make the default control appearance look more native-like depending on the +// platform +#if defined(__WXGTK20__) + #define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_NO_LINES) +#elif defined(__WXMAC__) + #define wxTR_DEFAULT_STYLE \ + (wxTR_HAS_BUTTONS | wxTR_NO_LINES | wxTR_FULL_ROW_HIGHLIGHT) +#else + #define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT) +#endif + +// values for the `flags' parameter of wxTreeCtrl::HitTest() which determine +// where exactly the specified point is situated: + +static const int wxTREE_HITTEST_ABOVE = 0x0001; +static const int wxTREE_HITTEST_BELOW = 0x0002; +static const int wxTREE_HITTEST_NOWHERE = 0x0004; + // on the button associated with an item. +static const int wxTREE_HITTEST_ONITEMBUTTON = 0x0008; + // on the bitmap associated with an item. +static const int wxTREE_HITTEST_ONITEMICON = 0x0010; + // on the indent associated with an item. +static const int wxTREE_HITTEST_ONITEMINDENT = 0x0020; + // on the label (string) associated with an item. +static const int wxTREE_HITTEST_ONITEMLABEL = 0x0040; + // on the right of the label associated with an item. +static const int wxTREE_HITTEST_ONITEMRIGHT = 0x0080; + // on the label (string) associated with an item. +static const int wxTREE_HITTEST_ONITEMSTATEICON = 0x0100; + // on the left of the wxTreeCtrl. +static const int wxTREE_HITTEST_TOLEFT = 0x0200; + // on the right of the wxTreeCtrl. +static const int wxTREE_HITTEST_TORIGHT = 0x0400; + // on the upper part (first half) of the item. +static const int wxTREE_HITTEST_ONITEMUPPERPART = 0x0800; + // on the lower part (second half) of the item. +static const int wxTREE_HITTEST_ONITEMLOWERPART = 0x1000; + + // anywhere on the item +static const int wxTREE_HITTEST_ONITEM = wxTREE_HITTEST_ONITEMICON | + wxTREE_HITTEST_ONITEMLABEL; + +// tree ctrl default name +extern WXDLLIMPEXP_DATA_CORE(const char) wxTreeCtrlNameStr[]; + +// ---------------------------------------------------------------------------- +// wxTreeEvent is a special class for all events associated with tree controls +// +// NB: note that not all accessors make sense for all events, see the event +// descriptions below +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxTreeCtrlBase; + +class WXDLLIMPEXP_CORE wxTreeEvent : public wxNotifyEvent +{ +public: + wxTreeEvent(wxEventType commandType = wxEVT_NULL, int id = 0); + wxTreeEvent(wxEventType commandType, + wxTreeCtrlBase *tree, + const wxTreeItemId &item = wxTreeItemId()); + wxTreeEvent(const wxTreeEvent& event); + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxTreeEvent(*this); } + + // accessors + // get the item on which the operation was performed or the newly + // selected item for wxEVT_TREE_SEL_CHANGED/ING events + wxTreeItemId GetItem() const { return m_item; } + void SetItem(const wxTreeItemId& item) { m_item = item; } + + // for wxEVT_TREE_SEL_CHANGED/ING events, get the previously + // selected item + wxTreeItemId GetOldItem() const { return m_itemOld; } + void SetOldItem(const wxTreeItemId& item) { m_itemOld = item; } + + // the point where the mouse was when the drag operation started (for + // wxEVT_TREE_BEGIN_(R)DRAG events only) or click position + wxPoint GetPoint() const { return m_pointDrag; } + void SetPoint(const wxPoint& pt) { m_pointDrag = pt; } + + // keyboard data (for wxEVT_TREE_KEY_DOWN only) + const wxKeyEvent& GetKeyEvent() const { return m_evtKey; } + int GetKeyCode() const { return m_evtKey.GetKeyCode(); } + void SetKeyEvent(const wxKeyEvent& evt) { m_evtKey = evt; } + + // label (for EVT_TREE_{BEGIN|END}_LABEL_EDIT only) + const wxString& GetLabel() const { return m_label; } + void SetLabel(const wxString& label) { m_label = label; } + + // edit cancel flag (for EVT_TREE_{BEGIN|END}_LABEL_EDIT only) + bool IsEditCancelled() const { return m_editCancelled; } + void SetEditCanceled(bool editCancelled) { m_editCancelled = editCancelled; } + + // Set the tooltip for the item (for EVT_TREE_ITEM_GETTOOLTIP events) + void SetToolTip(const wxString& toolTip) { m_label = toolTip; } + wxString GetToolTip() const { return m_label; } + +private: + // not all of the members are used (or initialized) for all events + wxKeyEvent m_evtKey; + wxTreeItemId m_item, + m_itemOld; + wxPoint m_pointDrag; + wxString m_label; + bool m_editCancelled; + + friend class WXDLLIMPEXP_FWD_CORE wxTreeCtrl; + friend class WXDLLIMPEXP_FWD_CORE wxGenericTreeCtrl; + + wxDECLARE_DYNAMIC_CLASS(wxTreeEvent); +}; + +typedef void (wxEvtHandler::*wxTreeEventFunction)(wxTreeEvent&); + +// ---------------------------------------------------------------------------- +// tree control events and macros for handling them +// ---------------------------------------------------------------------------- + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_BEGIN_DRAG, wxTreeEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_BEGIN_RDRAG, wxTreeEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_BEGIN_LABEL_EDIT, wxTreeEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_END_LABEL_EDIT, wxTreeEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_DELETE_ITEM, wxTreeEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_GET_INFO, wxTreeEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_SET_INFO, wxTreeEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_EXPANDED, wxTreeEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_EXPANDING, wxTreeEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_COLLAPSED, wxTreeEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_COLLAPSING, wxTreeEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_SEL_CHANGED, wxTreeEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_SEL_CHANGING, wxTreeEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_KEY_DOWN, wxTreeEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_ACTIVATED, wxTreeEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_RIGHT_CLICK, wxTreeEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_MIDDLE_CLICK, wxTreeEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_END_DRAG, wxTreeEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_STATE_IMAGE_CLICK, wxTreeEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_GETTOOLTIP, wxTreeEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREE_ITEM_MENU, wxTreeEvent ); + +#define wxTreeEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxTreeEventFunction, func) + +#define wx__DECLARE_TREEEVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_TREE_ ## evt, id, wxTreeEventHandler(fn)) + +// GetItem() returns the item being dragged, GetPoint() the mouse coords +// +// if you call event.Allow(), the drag operation will start and a +// EVT_TREE_END_DRAG event will be sent when the drag is over. +#define EVT_TREE_BEGIN_DRAG(id, fn) wx__DECLARE_TREEEVT(BEGIN_DRAG, id, fn) +#define EVT_TREE_BEGIN_RDRAG(id, fn) wx__DECLARE_TREEEVT(BEGIN_RDRAG, id, fn) + +// GetItem() is the item on which the drop occurred (if any) and GetPoint() the +// current mouse coords +#define EVT_TREE_END_DRAG(id, fn) wx__DECLARE_TREEEVT(END_DRAG, id, fn) + +// GetItem() returns the itme whose label is being edited, GetLabel() returns +// the current item label for BEGIN and the would be new one for END. +// +// Vetoing BEGIN event means that label editing won't happen at all, +// vetoing END means that the new value is discarded and the old one kept +#define EVT_TREE_BEGIN_LABEL_EDIT(id, fn) wx__DECLARE_TREEEVT(BEGIN_LABEL_EDIT, id, fn) +#define EVT_TREE_END_LABEL_EDIT(id, fn) wx__DECLARE_TREEEVT(END_LABEL_EDIT, id, fn) + +// provide/update information about GetItem() item +#define EVT_TREE_GET_INFO(id, fn) wx__DECLARE_TREEEVT(GET_INFO, id, fn) +#define EVT_TREE_SET_INFO(id, fn) wx__DECLARE_TREEEVT(SET_INFO, id, fn) + +// GetItem() is the item being expanded/collapsed, the "ING" versions can use +#define EVT_TREE_ITEM_EXPANDED(id, fn) wx__DECLARE_TREEEVT(ITEM_EXPANDED, id, fn) +#define EVT_TREE_ITEM_EXPANDING(id, fn) wx__DECLARE_TREEEVT(ITEM_EXPANDING, id, fn) +#define EVT_TREE_ITEM_COLLAPSED(id, fn) wx__DECLARE_TREEEVT(ITEM_COLLAPSED, id, fn) +#define EVT_TREE_ITEM_COLLAPSING(id, fn) wx__DECLARE_TREEEVT(ITEM_COLLAPSING, id, fn) + +// GetOldItem() is the item which had the selection previously, GetItem() is +// the item which acquires selection +#define EVT_TREE_SEL_CHANGED(id, fn) wx__DECLARE_TREEEVT(SEL_CHANGED, id, fn) +#define EVT_TREE_SEL_CHANGING(id, fn) wx__DECLARE_TREEEVT(SEL_CHANGING, id, fn) + +// GetKeyCode() returns the key code +// NB: this is the only message for which GetItem() is invalid (you may get the +// item from GetSelection()) +#define EVT_TREE_KEY_DOWN(id, fn) wx__DECLARE_TREEEVT(KEY_DOWN, id, fn) + +// GetItem() returns the item being deleted, the associated data (if any) will +// be deleted just after the return of this event handler (if any) +#define EVT_TREE_DELETE_ITEM(id, fn) wx__DECLARE_TREEEVT(DELETE_ITEM, id, fn) + +// GetItem() returns the item that was activated (double click, enter, space) +#define EVT_TREE_ITEM_ACTIVATED(id, fn) wx__DECLARE_TREEEVT(ITEM_ACTIVATED, id, fn) + +// GetItem() returns the item for which the context menu shall be shown +#define EVT_TREE_ITEM_MENU(id, fn) wx__DECLARE_TREEEVT(ITEM_MENU, id, fn) + +// GetItem() returns the item that was clicked on +#define EVT_TREE_ITEM_RIGHT_CLICK(id, fn) wx__DECLARE_TREEEVT(ITEM_RIGHT_CLICK, id, fn) +#define EVT_TREE_ITEM_MIDDLE_CLICK(id, fn) wx__DECLARE_TREEEVT(ITEM_MIDDLE_CLICK, id, fn) + +// GetItem() returns the item whose state image was clicked on +#define EVT_TREE_STATE_IMAGE_CLICK(id, fn) wx__DECLARE_TREEEVT(STATE_IMAGE_CLICK, id, fn) + +// GetItem() is the item for which the tooltip is being requested +#define EVT_TREE_ITEM_GETTOOLTIP(id, fn) wx__DECLARE_TREEEVT(ITEM_GETTOOLTIP, id, fn) + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_TREE_BEGIN_DRAG wxEVT_TREE_BEGIN_DRAG +#define wxEVT_COMMAND_TREE_BEGIN_RDRAG wxEVT_TREE_BEGIN_RDRAG +#define wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT wxEVT_TREE_BEGIN_LABEL_EDIT +#define wxEVT_COMMAND_TREE_END_LABEL_EDIT wxEVT_TREE_END_LABEL_EDIT +#define wxEVT_COMMAND_TREE_DELETE_ITEM wxEVT_TREE_DELETE_ITEM +#define wxEVT_COMMAND_TREE_GET_INFO wxEVT_TREE_GET_INFO +#define wxEVT_COMMAND_TREE_SET_INFO wxEVT_TREE_SET_INFO +#define wxEVT_COMMAND_TREE_ITEM_EXPANDED wxEVT_TREE_ITEM_EXPANDED +#define wxEVT_COMMAND_TREE_ITEM_EXPANDING wxEVT_TREE_ITEM_EXPANDING +#define wxEVT_COMMAND_TREE_ITEM_COLLAPSED wxEVT_TREE_ITEM_COLLAPSED +#define wxEVT_COMMAND_TREE_ITEM_COLLAPSING wxEVT_TREE_ITEM_COLLAPSING +#define wxEVT_COMMAND_TREE_SEL_CHANGED wxEVT_TREE_SEL_CHANGED +#define wxEVT_COMMAND_TREE_SEL_CHANGING wxEVT_TREE_SEL_CHANGING +#define wxEVT_COMMAND_TREE_KEY_DOWN wxEVT_TREE_KEY_DOWN +#define wxEVT_COMMAND_TREE_ITEM_ACTIVATED wxEVT_TREE_ITEM_ACTIVATED +#define wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK wxEVT_TREE_ITEM_RIGHT_CLICK +#define wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK wxEVT_TREE_ITEM_MIDDLE_CLICK +#define wxEVT_COMMAND_TREE_END_DRAG wxEVT_TREE_END_DRAG +#define wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK wxEVT_TREE_STATE_IMAGE_CLICK +#define wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP wxEVT_TREE_ITEM_GETTOOLTIP +#define wxEVT_COMMAND_TREE_ITEM_MENU wxEVT_TREE_ITEM_MENU + +#endif // wxUSE_TREECTRL + +#endif // _WX_TREEBASE_H_ diff --git a/lib/wxWidgets/include/wx/treebook.h b/lib/wxWidgets/include/wx/treebook.h new file mode 100644 index 0000000..11b44cf --- /dev/null +++ b/lib/wxWidgets/include/wx/treebook.h @@ -0,0 +1,255 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/treebook.h +// Purpose: wxTreebook: wxNotebook-like control presenting pages in a tree +// Author: Evgeniy Tarassov, Vadim Zeitlin +// Modified by: +// Created: 2005-09-15 +// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TREEBOOK_H_ +#define _WX_TREEBOOK_H_ + +#include "wx/defs.h" + +#if wxUSE_TREEBOOK + +#include "wx/bookctrl.h" +#include "wx/containr.h" +#include "wx/treebase.h" // for wxTreeItemId +#include "wx/vector.h" + +typedef wxWindow wxTreebookPage; + +class WXDLLIMPEXP_FWD_CORE wxTreeCtrl; +class WXDLLIMPEXP_FWD_CORE wxTreeEvent; + +// ---------------------------------------------------------------------------- +// wxTreebook +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTreebook : public wxNavigationEnabled<wxBookCtrlBase> +{ +public: + // Constructors and such + // --------------------- + + // Default ctor doesn't create the control, use Create() afterwards + wxTreebook() + { + } + + // This ctor creates the tree book control + wxTreebook(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxBK_DEFAULT, + const wxString& name = wxEmptyString) + { + (void)Create(parent, id, pos, size, style, name); + } + + // Really creates the control + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxBK_DEFAULT, + const wxString& name = wxEmptyString); + + + // Page insertion operations + // ------------------------- + + // Notice that page pointer may be NULL in which case the next non NULL + // page (usually the first child page of a node) is shown when this page is + // selected + + // Inserts a new page just before the page indicated by page. + // The new page is placed on the same level as page. + virtual bool InsertPage(size_t pos, + wxWindow *page, + const wxString& text, + bool bSelect = false, + int imageId = NO_IMAGE) wxOVERRIDE; + + // Inserts a new sub-page to the end of children of the page at given pos. + virtual bool InsertSubPage(size_t pos, + wxWindow *page, + const wxString& text, + bool bSelect = false, + int imageId = NO_IMAGE); + + // Adds a new page at top level after all other pages. + virtual bool AddPage(wxWindow *page, + const wxString& text, + bool bSelect = false, + int imageId = NO_IMAGE) wxOVERRIDE; + + // Adds a new child-page to the last top-level page inserted. + // Useful when constructing 1 level tree structure. + virtual bool AddSubPage(wxWindow *page, + const wxString& text, + bool bSelect = false, + int imageId = NO_IMAGE); + + // Deletes the page and ALL its children. Could trigger page selection + // change in a case when selected page is removed. In that case its parent + // is selected (or the next page if no parent). + virtual bool DeletePage(size_t pos) wxOVERRIDE; + + + // Tree operations + // --------------- + + // Gets the page node state -- node is expanded or collapsed + virtual bool IsNodeExpanded(size_t pos) const; + + // Expands or collapses the page node. Returns the previous state. + // May generate page changing events (if selected page + // is under the collapsed branch, then parent is autoselected). + virtual bool ExpandNode(size_t pos, bool expand = true); + + // shortcut for ExpandNode(pos, false) + bool CollapseNode(size_t pos) { return ExpandNode(pos, false); } + + // get the parent page or wxNOT_FOUND if this is a top level page + int GetPageParent(size_t pos) const; + + // the tree control we use for showing the pages index tree + wxTreeCtrl* GetTreeCtrl() const { return (wxTreeCtrl*)m_bookctrl; } + + + // Standard operations inherited from wxBookCtrlBase + // ------------------------------------------------- + + virtual bool SetPageText(size_t n, const wxString& strText) wxOVERRIDE; + virtual wxString GetPageText(size_t n) const wxOVERRIDE; + virtual int GetPageImage(size_t n) const wxOVERRIDE; + virtual bool SetPageImage(size_t n, int imageId) wxOVERRIDE; + virtual int SetSelection(size_t n) wxOVERRIDE { return DoSetSelection(n, SetSelection_SendEvent); } + virtual int ChangeSelection(size_t n) wxOVERRIDE { return DoSetSelection(n); } + virtual int HitTest(const wxPoint& pt, long *flags = NULL) const wxOVERRIDE; + virtual bool DeleteAllPages() wxOVERRIDE; + +protected: + // Implementation of a page removal. See DeletPage for comments. + wxTreebookPage *DoRemovePage(size_t pos) wxOVERRIDE; + + virtual void OnImagesChanged() wxOVERRIDE; + + // This subclass of wxBookCtrlBase accepts NULL page pointers (empty pages) + virtual bool AllowNullPage() const wxOVERRIDE { return true; } + virtual wxWindow *TryGetNonNullPage(size_t page) wxOVERRIDE; + + // event handlers + void OnTreeSelectionChange(wxTreeEvent& event); + void OnTreeNodeExpandedCollapsed(wxTreeEvent& event); + + // array of tree item ids corresponding to the page indices + wxVector<wxTreeItemId> m_treeIds; + +private: + // The real implementations of page insertion functions + // ------------------------------------------------------ + // All DoInsert/Add(Sub)Page functions add the page into : + // - the base class + // - the tree control + // - update the index/TreeItemId corespondance array + bool DoInsertPage(size_t pos, + wxWindow *page, + const wxString& text, + bool bSelect = false, + int imageId = NO_IMAGE); + bool DoInsertSubPage(size_t pos, + wxWindow *page, + const wxString& text, + bool bSelect = false, + int imageId = NO_IMAGE); + bool DoAddSubPage(wxWindow *page, + const wxString& text, + bool bSelect = false, + int imageId = NO_IMAGE); + + // Overridden methods used by the base class DoSetSelection() + // implementation. + void UpdateSelectedPage(size_t newsel) wxOVERRIDE; + wxBookCtrlEvent* CreatePageChangingEvent() const wxOVERRIDE; + void MakeChangedEvent(wxBookCtrlEvent &event) wxOVERRIDE; + + // Does the selection update. Called from page insertion functions + // to update selection if the selected page was pushed by the newly inserted + void DoUpdateSelection(bool bSelect, int page); + + + // Operations on the internal private members of the class + // ------------------------------------------------------- + // Returns the page TreeItemId for the page. + // Or, if the page index is incorrect, a fake one (fakePage.IsOk() == false) + wxTreeItemId DoInternalGetPage(size_t pos) const; + + // Linear search for a page with the id specified. If no page + // found wxNOT_FOUND is returned. The function is used when we catch an event + // from m_tree (wxTreeCtrl) component. + int DoInternalFindPageById(wxTreeItemId page) const; + + // Updates page and wxTreeItemId correspondence. + void DoInternalAddPage(size_t newPos, wxWindow *page, wxTreeItemId pageId); + + // Removes the page from internal structure. + void DoInternalRemovePage(size_t pos) + { DoInternalRemovePageRange(pos, 0); } + + // Removes the page and all its children designated by subCount + // from internal structures of the control. + void DoInternalRemovePageRange(size_t pos, size_t subCount); + + // Returns internal number of pages which can be different from + // GetPageCount() while performing a page insertion or removal. + size_t DoInternalGetPageCount() const { return m_treeIds.size(); } + + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTreebook); +}; + + +// ---------------------------------------------------------------------------- +// treebook event class and related stuff +// ---------------------------------------------------------------------------- + +// wxTreebookEvent is obsolete and defined for compatibility only +#define wxTreebookEvent wxBookCtrlEvent +typedef wxBookCtrlEventFunction wxTreebookEventFunction; +#define wxTreebookEventHandler(func) wxBookCtrlEventHandler(func) + + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREEBOOK_PAGE_CHANGED, wxBookCtrlEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREEBOOK_PAGE_CHANGING, wxBookCtrlEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREEBOOK_NODE_COLLAPSED, wxBookCtrlEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_TREEBOOK_NODE_EXPANDED, wxBookCtrlEvent ); + +#define EVT_TREEBOOK_PAGE_CHANGED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_TREEBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn)) + +#define EVT_TREEBOOK_PAGE_CHANGING(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_TREEBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn)) + +#define EVT_TREEBOOK_NODE_COLLAPSED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_TREEBOOK_NODE_COLLAPSED, winid, wxBookCtrlEventHandler(fn)) + +#define EVT_TREEBOOK_NODE_EXPANDED(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_TREEBOOK_NODE_EXPANDED, winid, wxBookCtrlEventHandler(fn)) + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED wxEVT_TREEBOOK_PAGE_CHANGED +#define wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING wxEVT_TREEBOOK_PAGE_CHANGING +#define wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED wxEVT_TREEBOOK_NODE_COLLAPSED +#define wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED wxEVT_TREEBOOK_NODE_EXPANDED + + +#endif // wxUSE_TREEBOOK + +#endif // _WX_TREEBOOK_H_ diff --git a/lib/wxWidgets/include/wx/treectrl.h b/lib/wxWidgets/include/wx/treectrl.h new file mode 100644 index 0000000..9f5a90c --- /dev/null +++ b/lib/wxWidgets/include/wx/treectrl.h @@ -0,0 +1,464 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/treectrl.h +// Purpose: wxTreeCtrl base header +// Author: Karsten Ballueder +// Modified by: +// Created: +// Copyright: (c) Karsten Ballueder +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TREECTRL_H_BASE_ +#define _WX_TREECTRL_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_TREECTRL + +#include "wx/control.h" +#include "wx/treebase.h" +#include "wx/textctrl.h" // wxTextCtrl::ms_classinfo used through wxCLASSINFO macro +#include "wx/systhemectrl.h" +#include "wx/withimages.h" + +#if !defined(__WXMSW__) && !defined(__WXQT__) || defined(__WXUNIVERSAL__) + #define wxHAS_GENERIC_TREECTRL +#endif + +// ---------------------------------------------------------------------------- +// wxTreeCtrlBase +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTreeCtrlBase : public wxSystemThemedControl<wxControl>, + public wxWithImages +{ +public: + wxTreeCtrlBase(); + virtual ~wxTreeCtrlBase(); + + // accessors + // --------- + + // get the total number of items in the control + virtual unsigned int GetCount() const = 0; + + // indent is the number of pixels the children are indented relative to + // the parents position. SetIndent() also redraws the control + // immediately. + virtual unsigned int GetIndent() const = 0; + virtual void SetIndent(unsigned int indent) = 0; + + // spacing is the number of pixels between the start and the Text + // (has no effect under wxMSW) + unsigned int GetSpacing() const { return m_spacing; } + void SetSpacing(unsigned int spacing) { m_spacing = spacing; } + + // In addition to {Set,Get,Assign}ImageList() methods inherited from + // wxWithImages, this control has similar functions for the state image + // list that can be used to show a state icon corresponding to an + // app-defined item state (for example, checked/unchecked). + wxImageList *GetStateImageList() const + { + return m_imagesState.GetImageList(); + } + virtual void SetStateImageList(wxImageList *imageList) = 0; + void AssignStateImageList(wxImageList *imageList) + { + SetStateImageList(imageList); + m_imagesState.TakeOwnership(); + } + + + // Functions to work with tree ctrl items. Unfortunately, they can _not_ be + // member functions of wxTreeItem because they must know the tree the item + // belongs to for Windows implementation and storing the pointer to + // wxTreeCtrl in each wxTreeItem is just too much waste. + + // accessors + // --------- + + // retrieve items label + virtual wxString GetItemText(const wxTreeItemId& item) const = 0; + // get one of the images associated with the item (normal by default) + virtual int GetItemImage(const wxTreeItemId& item, + wxTreeItemIcon which = wxTreeItemIcon_Normal) const = 0; + // get the data associated with the item + virtual wxTreeItemData *GetItemData(const wxTreeItemId& item) const = 0; + + // get the item's text colour + virtual wxColour GetItemTextColour(const wxTreeItemId& item) const = 0; + + // get the item's background colour + virtual wxColour GetItemBackgroundColour(const wxTreeItemId& item) const = 0; + + // get the item's font + virtual wxFont GetItemFont(const wxTreeItemId& item) const = 0; + + // get the items state + int GetItemState(const wxTreeItemId& item) const + { + return DoGetItemState(item); + } + + // modifiers + // --------- + + // set items label + virtual void SetItemText(const wxTreeItemId& item, const wxString& text) = 0; + // set one of the images associated with the item (normal by default) + virtual void SetItemImage(const wxTreeItemId& item, + int image, + wxTreeItemIcon which = wxTreeItemIcon_Normal) = 0; + // associate some data with the item + virtual void SetItemData(const wxTreeItemId& item, wxTreeItemData *data) = 0; + + // force appearance of [+] button near the item. This is useful to + // allow the user to expand the items which don't have any children now + // - but instead add them only when needed, thus minimizing memory + // usage and loading time. + virtual void SetItemHasChildren(const wxTreeItemId& item, + bool has = true) = 0; + + // the item will be shown in bold + virtual void SetItemBold(const wxTreeItemId& item, bool bold = true) = 0; + + // the item will be shown with a drop highlight + virtual void SetItemDropHighlight(const wxTreeItemId& item, + bool highlight = true) = 0; + + // set the items text colour + virtual void SetItemTextColour(const wxTreeItemId& item, + const wxColour& col) = 0; + + // set the items background colour + virtual void SetItemBackgroundColour(const wxTreeItemId& item, + const wxColour& col) = 0; + + // set the items font (should be of the same height for all items) + virtual void SetItemFont(const wxTreeItemId& item, + const wxFont& font) = 0; + + // set the items state (special state values: wxTREE_ITEMSTATE_NONE/NEXT/PREV) + void SetItemState(const wxTreeItemId& item, int state); + + // item status inquiries + // --------------------- + + // is the item visible (it might be outside the view or not expanded)? + virtual bool IsVisible(const wxTreeItemId& item) const = 0; + // does the item has any children? + virtual bool ItemHasChildren(const wxTreeItemId& item) const = 0; + // same as above + bool HasChildren(const wxTreeItemId& item) const + { return ItemHasChildren(item); } + // is the item expanded (only makes sense if HasChildren())? + virtual bool IsExpanded(const wxTreeItemId& item) const = 0; + // is this item currently selected (the same as has focus)? + virtual bool IsSelected(const wxTreeItemId& item) const = 0; + // is item text in bold font? + virtual bool IsBold(const wxTreeItemId& item) const = 0; + // is the control empty? + bool IsEmpty() const; + + + // number of children + // ------------------ + + // if 'recursively' is false, only immediate children count, otherwise + // the returned number is the number of all items in this branch + virtual size_t GetChildrenCount(const wxTreeItemId& item, + bool recursively = true) const = 0; + + // navigation + // ---------- + + // wxTreeItemId.IsOk() will return false if there is no such item + + // get the root tree item + virtual wxTreeItemId GetRootItem() const = 0; + + // get the item currently selected (may return NULL if no selection) + virtual wxTreeItemId GetSelection() const = 0; + + // get the items currently selected, return the number of such item + // + // NB: this operation is expensive and can take a long time for a + // control with a lot of items (~ O(number of items)). + virtual size_t GetSelections(wxArrayTreeItemIds& selections) const = 0; + + // get the last item to be clicked when the control has wxTR_MULTIPLE + // equivalent to GetSelection() if not wxTR_MULTIPLE + virtual wxTreeItemId GetFocusedItem() const = 0; + + + // Clears the currently focused item + virtual void ClearFocusedItem() = 0; + // Sets the currently focused item. Item should be valid + virtual void SetFocusedItem(const wxTreeItemId& item) = 0; + + + // get the parent of this item (may return NULL if root) + virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const = 0; + + // for this enumeration function you must pass in a "cookie" parameter + // which is opaque for the application but is necessary for the library + // to make these functions reentrant (i.e. allow more than one + // enumeration on one and the same object simultaneously). Of course, + // the "cookie" passed to GetFirstChild() and GetNextChild() should be + // the same! + + // get the first child of this item + virtual wxTreeItemId GetFirstChild(const wxTreeItemId& item, + wxTreeItemIdValue& cookie) const = 0; + // get the next child + virtual wxTreeItemId GetNextChild(const wxTreeItemId& item, + wxTreeItemIdValue& cookie) const = 0; + // get the last child of this item - this method doesn't use cookies + virtual wxTreeItemId GetLastChild(const wxTreeItemId& item) const = 0; + + // get the next sibling of this item + virtual wxTreeItemId GetNextSibling(const wxTreeItemId& item) const = 0; + // get the previous sibling + virtual wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const = 0; + + // get first visible item + virtual wxTreeItemId GetFirstVisibleItem() const = 0; + // get the next visible item: item must be visible itself! + // see IsVisible() and wxTreeCtrl::GetFirstVisibleItem() + virtual wxTreeItemId GetNextVisible(const wxTreeItemId& item) const = 0; + // get the previous visible item: item must be visible itself! + virtual wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const = 0; + + // operations + // ---------- + + // add the root node to the tree + virtual wxTreeItemId AddRoot(const wxString& text, + int image = -1, int selImage = -1, + wxTreeItemData *data = NULL) = 0; + + // insert a new item in as the first child of the parent + wxTreeItemId PrependItem(const wxTreeItemId& parent, + const wxString& text, + int image = -1, int selImage = -1, + wxTreeItemData *data = NULL) + { + return DoInsertItem(parent, 0u, text, image, selImage, data); + } + + // insert a new item after a given one + wxTreeItemId InsertItem(const wxTreeItemId& parent, + const wxTreeItemId& idPrevious, + const wxString& text, + int image = -1, int selImage = -1, + wxTreeItemData *data = NULL) + { + return DoInsertAfter(parent, idPrevious, text, image, selImage, data); + } + + // insert a new item before the one with the given index + wxTreeItemId InsertItem(const wxTreeItemId& parent, + size_t pos, + const wxString& text, + int image = -1, int selImage = -1, + wxTreeItemData *data = NULL) + { + return DoInsertItem(parent, pos, text, image, selImage, data); + } + + // insert a new item in as the last child of the parent + wxTreeItemId AppendItem(const wxTreeItemId& parent, + const wxString& text, + int image = -1, int selImage = -1, + wxTreeItemData *data = NULL) + { + return DoInsertItem(parent, (size_t)-1, text, image, selImage, data); + } + + // delete this item and associated data if any + virtual void Delete(const wxTreeItemId& item) = 0; + // delete all children (but don't delete the item itself) + // NB: this won't send wxEVT_TREE_ITEM_DELETED events + virtual void DeleteChildren(const wxTreeItemId& item) = 0; + // delete all items from the tree + // NB: this won't send wxEVT_TREE_ITEM_DELETED events + virtual void DeleteAllItems() = 0; + + // expand this item + virtual void Expand(const wxTreeItemId& item) = 0; + // expand the item and all its children recursively + void ExpandAllChildren(const wxTreeItemId& item); + // expand all items + void ExpandAll(); + // collapse the item without removing its children + virtual void Collapse(const wxTreeItemId& item) = 0; + // collapse the item and all its children + void CollapseAllChildren(const wxTreeItemId& item); + // collapse all items + void CollapseAll(); + // collapse the item and remove all children + virtual void CollapseAndReset(const wxTreeItemId& item) = 0; + // toggles the current state + virtual void Toggle(const wxTreeItemId& item) = 0; + + // remove the selection from currently selected item (if any) + virtual void Unselect() = 0; + // unselect all items (only makes sense for multiple selection control) + virtual void UnselectAll() = 0; + // select this item + virtual void SelectItem(const wxTreeItemId& item, bool select = true) = 0; + // selects all (direct) children for given parent (only for + // multiselection controls) + virtual void SelectChildren(const wxTreeItemId& parent) = 0; + // unselect this item + void UnselectItem(const wxTreeItemId& item) { SelectItem(item, false); } + // toggle item selection + void ToggleItemSelection(const wxTreeItemId& item) + { + SelectItem(item, !IsSelected(item)); + } + + // make sure this item is visible (expanding the parent item and/or + // scrolling to this item if necessary) + virtual void EnsureVisible(const wxTreeItemId& item) = 0; + // scroll to this item (but don't expand its parent) + virtual void ScrollTo(const wxTreeItemId& item) = 0; + + // start editing the item label: this (temporarily) replaces the item + // with a one line edit control. The item will be selected if it hadn't + // been before. textCtrlClass parameter allows you to create an edit + // control of arbitrary user-defined class deriving from wxTextCtrl. + virtual wxTextCtrl *EditLabel(const wxTreeItemId& item, + wxClassInfo* textCtrlClass = wxCLASSINFO(wxTextCtrl)) = 0; + // returns the same pointer as StartEdit() if the item is being edited, + // NULL otherwise (it's assumed that no more than one item may be + // edited simultaneously) + virtual wxTextCtrl *GetEditControl() const = 0; + // end editing and accept or discard the changes to item label + virtual void EndEditLabel(const wxTreeItemId& item, + bool discardChanges = false) = 0; + + // Enable or disable beep when incremental match doesn't find any item. + // Only implemented in the generic version currently. + virtual void EnableBellOnNoMatch(bool WXUNUSED(on) = true) { } + + // sorting + // ------- + + // this function is called to compare 2 items and should return -1, 0 + // or +1 if the first item is less than, equal to or greater than the + // second one. The base class version performs alphabetic comparison + // of item labels (GetText) + virtual int OnCompareItems(const wxTreeItemId& item1, + const wxTreeItemId& item2) + { + return wxStrcmp(GetItemText(item1), GetItemText(item2)); + } + + // sort the children of this item using OnCompareItems + // + // NB: this function is not reentrant and not MT-safe (FIXME)! + virtual void SortChildren(const wxTreeItemId& item) = 0; + + // items geometry + // -------------- + + // determine to which item (if any) belongs the given point (the + // coordinates specified are relative to the client area of tree ctrl) + // and, in the second variant, fill the flags parameter with a bitmask + // of wxTREE_HITTEST_xxx constants. + wxTreeItemId HitTest(const wxPoint& point) const + { int dummy; return DoTreeHitTest(point, dummy); } + wxTreeItemId HitTest(const wxPoint& point, int& flags) const + { return DoTreeHitTest(point, flags); } + + // get the bounding rectangle of the item (or of its label only) + virtual bool GetBoundingRect(const wxTreeItemId& item, + wxRect& rect, + bool textOnly = false) const = 0; + + + // implementation + // -------------- + + virtual bool ShouldInheritColours() const wxOVERRIDE { return false; } + + // hint whether to calculate best size quickly or accurately + void SetQuickBestSize(bool q) { m_quickBestSize = q; } + bool GetQuickBestSize() const { return m_quickBestSize; } + +protected: + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + // common part of Get/SetItemState() + virtual int DoGetItemState(const wxTreeItemId& item) const = 0; + virtual void DoSetItemState(const wxTreeItemId& item, int state) = 0; + + // common part of Append/Prepend/InsertItem() + // + // pos is the position at which to insert the item or (size_t)-1 to append + // it to the end + virtual wxTreeItemId DoInsertItem(const wxTreeItemId& parent, + size_t pos, + const wxString& text, + int image, int selImage, + wxTreeItemData *data) = 0; + + // and this function implements overloaded InsertItem() taking wxTreeItemId + // (it can't be called InsertItem() as we'd have virtual function hiding + // problem in derived classes then) + virtual wxTreeItemId DoInsertAfter(const wxTreeItemId& parent, + const wxTreeItemId& idPrevious, + const wxString& text, + int image = -1, int selImage = -1, + wxTreeItemData *data = NULL) = 0; + + // real HitTest() implementation: again, can't be called just HitTest() + // because it's overloaded and so the non-virtual overload would be hidden + // (and can't be called DoHitTest() because this is already in wxWindow) + virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, + int& flags) const = 0; + + + // Usually we inherit from this class, rather than aggregating it, but we + // need two different sets of images here, so we do both. + wxWithImages m_imagesState; + + // spacing between left border and the text + unsigned int m_spacing; + + // whether full or quick calculation is done in DoGetBestSize + bool m_quickBestSize; + + +private: + // Intercept Escape and Return keys to ensure that our in-place edit + // control always gets them before they're used for dialog navigation or + // anything else. + void OnCharHook(wxKeyEvent& event); + + + wxDECLARE_NO_COPY_CLASS(wxTreeCtrlBase); +}; + +// ---------------------------------------------------------------------------- +// include the platform-dependent wxTreeCtrl class +// ---------------------------------------------------------------------------- + +#ifdef wxHAS_GENERIC_TREECTRL + #include "wx/generic/treectlg.h" +#elif defined(__WXMSW__) + #include "wx/msw/treectrl.h" +#elif defined(__WXQT__) + #include "wx/qt/treectrl.h" +#else + #error "unknown native wxTreeCtrl implementation" +#endif + +#endif // wxUSE_TREECTRL + +#endif // _WX_TREECTRL_H_BASE_ diff --git a/lib/wxWidgets/include/wx/treelist.h b/lib/wxWidgets/include/wx/treelist.h new file mode 100644 index 0000000..ce9dba4 --- /dev/null +++ b/lib/wxWidgets/include/wx/treelist.h @@ -0,0 +1,577 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/treelist.h +// Purpose: wxTreeListCtrl class declaration. +// Author: Vadim Zeitlin +// Created: 2011-08-17 +// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TREELIST_H_ +#define _WX_TREELIST_H_ + +#include "wx/defs.h" + +#if wxUSE_TREELISTCTRL + +#include "wx/compositewin.h" +#include "wx/containr.h" +#include "wx/headercol.h" +#include "wx/itemid.h" +#include "wx/vector.h" +#include "wx/window.h" +#include "wx/withimages.h" + +class WXDLLIMPEXP_FWD_CORE wxDataViewCtrl; +class WXDLLIMPEXP_FWD_CORE wxDataViewEvent; + +extern WXDLLIMPEXP_DATA_CORE(const char) wxTreeListCtrlNameStr[]; + +class wxTreeListCtrl; +class wxTreeListModel; +class wxTreeListModelNode; + +// ---------------------------------------------------------------------------- +// Constants. +// ---------------------------------------------------------------------------- + +// wxTreeListCtrl styles. +// +// Notice that using wxTL_USER_3STATE implies wxTL_3STATE and wxTL_3STATE in +// turn implies wxTL_CHECKBOX. +enum +{ + wxTL_SINGLE = 0x0000, // This is the default anyhow. + wxTL_MULTIPLE = 0x0001, // Allow multiple selection. + wxTL_CHECKBOX = 0x0002, // Show checkboxes in the first column. + wxTL_3STATE = 0x0004, // Allow 3rd state in checkboxes. + wxTL_USER_3STATE = 0x0008, // Allow user to set 3rd state. + wxTL_NO_HEADER = 0x0010, // Column titles not visible. + + wxTL_DEFAULT_STYLE = wxTL_SINGLE, + wxTL_STYLE_MASK = wxTL_SINGLE | + wxTL_MULTIPLE | + wxTL_CHECKBOX | + wxTL_3STATE | + wxTL_USER_3STATE +}; + +// ---------------------------------------------------------------------------- +// wxTreeListItem: unique identifier of an item in wxTreeListCtrl. +// ---------------------------------------------------------------------------- + +// Make wxTreeListItem a forward-declarable class even though it's simple +// enough to possibly be declared as a simple typedef. +class wxTreeListItem : public wxItemId<wxTreeListModelNode*> +{ +public: + wxTreeListItem(wxTreeListModelNode* item = NULL) + : wxItemId<wxTreeListModelNode*>(item) + { + } +}; + +// Container of multiple items. +typedef wxVector<wxTreeListItem> wxTreeListItems; + +// Some special "items" that can be used with InsertItem(): +extern WXDLLIMPEXP_DATA_CORE(const wxTreeListItem) wxTLI_FIRST; +extern WXDLLIMPEXP_DATA_CORE(const wxTreeListItem) wxTLI_LAST; + +// ---------------------------------------------------------------------------- +// wxTreeListItemComparator: defines order of wxTreeListCtrl items. +// ---------------------------------------------------------------------------- + +class wxTreeListItemComparator +{ +public: + wxTreeListItemComparator() { } + + // The comparison function should return negative, null or positive value + // depending on whether the first item is less than, equal to or greater + // than the second one. The items should be compared using their values for + // the given column. + virtual int + Compare(wxTreeListCtrl* treelist, + unsigned column, + wxTreeListItem first, + wxTreeListItem second) = 0; + + // Although this class is not used polymorphically by wxWidgets itself, + // provide virtual dtor in case it's used like this in the user code. + virtual ~wxTreeListItemComparator() { } + +private: + wxDECLARE_NO_COPY_CLASS(wxTreeListItemComparator); +}; + +// ---------------------------------------------------------------------------- +// wxTreeListCtrl: a control combining wxTree- and wxListCtrl features. +// ---------------------------------------------------------------------------- + +// This control also provides easy to use high level interface. Although the +// implementation uses wxDataViewCtrl internally, this class is intentionally +// simpler than wxDataViewCtrl and doesn't provide all of its functionality. +// +// If you need extra features you can always use GetDataView() accessor to work +// with wxDataViewCtrl directly but doing this makes your unportable to possible +// future non-wxDataViewCtrl-based implementations of this class. + +class WXDLLIMPEXP_CORE wxTreeListCtrl + : public wxCompositeWindow< wxNavigationEnabled<wxWindow> >, + public wxWithImages +{ +public: + // Constructors and such + // --------------------- + + wxTreeListCtrl() { Init(); } + wxTreeListCtrl(wxWindow* parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTL_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxTreeListCtrlNameStr)) + { + Init(); + + Create(parent, id, pos, size, style, name); + } + + bool Create(wxWindow* parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTL_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxTreeListCtrlNameStr)); + + + virtual ~wxTreeListCtrl(); + + // Columns methods + // --------------- + + // Add a column with the given title and attributes, returns the index of + // the new column or -1 on failure. + int AppendColumn(const wxString& title, + int width = wxCOL_WIDTH_AUTOSIZE, + wxAlignment align = wxALIGN_LEFT, + int flags = wxCOL_RESIZABLE) + { + return DoInsertColumn(title, -1, width, align, flags); + } + + // Return the total number of columns. + unsigned GetColumnCount() const; + + // Delete the column with the given index, returns false if index is + // invalid or deleting the column failed for some other reason. + bool DeleteColumn(unsigned col); + + // Delete all columns. + void ClearColumns(); + + // Set column width to either the given value in pixels or to the value + // large enough to fit all of the items if width == wxCOL_WIDTH_AUTOSIZE. + void SetColumnWidth(unsigned col, int width); + + // Get the current width of the given column in pixels. + int GetColumnWidth(unsigned col) const; + + // Get the width appropriate for showing the given text. This is typically + // used as second argument for AppendColumn() or with SetColumnWidth(). + int WidthFor(const wxString& text) const; + + + // Item methods + // ------------ + + // Adding items. The parent and text of the first column of the new item + // must always be specified, the rest is optional. + // + // Each item can have two images: one used for closed state and another for + // opened one. Only the first one is ever used for the items that don't + // have children. And both are not set by default. + // + // It is also possible to associate arbitrary client data pointer with the + // new item. It will be deleted by the control when the item is deleted + // (either by an explicit DeleteItem() call or because the entire control + // is destroyed). + + wxTreeListItem AppendItem(wxTreeListItem parent, + const wxString& text, + int imageClosed = NO_IMAGE, + int imageOpened = NO_IMAGE, + wxClientData* data = NULL) + { + return DoInsertItem(parent, wxTLI_LAST, text, + imageClosed, imageOpened, data); + } + + wxTreeListItem InsertItem(wxTreeListItem parent, + wxTreeListItem previous, + const wxString& text, + int imageClosed = NO_IMAGE, + int imageOpened = NO_IMAGE, + wxClientData* data = NULL) + { + return DoInsertItem(parent, previous, text, + imageClosed, imageOpened, data); + } + + wxTreeListItem PrependItem(wxTreeListItem parent, + const wxString& text, + int imageClosed = NO_IMAGE, + int imageOpened = NO_IMAGE, + wxClientData* data = NULL) + { + return DoInsertItem(parent, wxTLI_FIRST, text, + imageClosed, imageOpened, data); + } + + // Deleting items. + void DeleteItem(wxTreeListItem item); + void DeleteAllItems(); + + + // Tree navigation + // --------------- + + // Return the (never shown) root item. + wxTreeListItem GetRootItem() const; + + // The parent item may be invalid for the root-level items. + wxTreeListItem GetItemParent(wxTreeListItem item) const; + + // Iterate over the given item children: start by calling GetFirstChild() + // and then call GetNextSibling() for as long as it returns valid item. + wxTreeListItem GetFirstChild(wxTreeListItem item) const; + wxTreeListItem GetNextSibling(wxTreeListItem item) const; + + // Return the first child of the root item, which is also the first item of + // the tree in depth-first traversal order. + wxTreeListItem GetFirstItem() const { return GetFirstChild(GetRootItem()); } + + // Get item after the given one in the depth-first tree-traversal order. + // Calling this function starting with the result of GetFirstItem() allows + // iterating over all items in the tree. + wxTreeListItem GetNextItem(wxTreeListItem item) const; + + + // Items attributes + // ---------------- + + const wxString& GetItemText(wxTreeListItem item, unsigned col = 0) const; + + // The convenience overload below sets the text for the first column. + void SetItemText(wxTreeListItem item, unsigned col, const wxString& text); + void SetItemText(wxTreeListItem item, const wxString& text) + { + SetItemText(item, 0, text); + } + + // By default the opened image is the same as the normal, closed one (if + // it's used at all). + void SetItemImage(wxTreeListItem item, int closed, int opened = NO_IMAGE); + + // Retrieve or set the data associated with the item. + wxClientData* GetItemData(wxTreeListItem item) const; + void SetItemData(wxTreeListItem item, wxClientData* data); + + + // Expanding and collapsing + // ------------------------ + + void Expand(wxTreeListItem item); + void Collapse(wxTreeListItem item); + bool IsExpanded(wxTreeListItem item) const; + + + // Selection handling + // ------------------ + + // This function can be used with single selection controls, use + // GetSelections() with the multi-selection ones. + wxTreeListItem GetSelection() const; + + // This one can be used with either single or multi-selection controls. + unsigned GetSelections(wxTreeListItems& selections) const; + + // In single selection mode Select() deselects any other selected items, in + // multi-selection case it adds to the selection. + void Select(wxTreeListItem item); + + // Can be used in multiple selection mode only, single selected item in the + // single selection mode can't be unselected. + void Unselect(wxTreeListItem item); + + // Return true if the item is selected, can be used in both single and + // multiple selection modes. + bool IsSelected(wxTreeListItem item) const; + + // Select or unselect all items, only valid in multiple selection mode. + void SelectAll(); + void UnselectAll(); + + void EnsureVisible(wxTreeListItem item); + + // Checkbox handling + // ----------------- + + // Methods in this section can only be used with the controls created with + // wxTL_CHECKBOX style. + + // Simple set, unset or query the checked state. + void CheckItem(wxTreeListItem item, wxCheckBoxState state = wxCHK_CHECKED); + void UncheckItem(wxTreeListItem item) { CheckItem(item, wxCHK_UNCHECKED); } + + // The same but do it recursively for this item itself and its children. + void CheckItemRecursively(wxTreeListItem item, + wxCheckBoxState state = wxCHK_CHECKED); + + // Update the parent of this item recursively: if this item and all its + // siblings are checked, the parent will become checked as well. If this + // item and all its siblings are unchecked, the parent will be unchecked. + // And if the siblings of this item are not all in the same state, the + // parent will be switched to indeterminate state. And then the same logic + // will be applied to the parents parent and so on recursively. + // + // This is typically called when the state of the given item has changed + // from EVT_TREELIST_ITEM_CHECKED() handler in the controls which have + // wxTL_3STATE flag. Notice that without this flag this function can't work + // as it would be unable to set the state of a parent with both checked and + // unchecked items so it's only allowed to call it when this flag is set. + void UpdateItemParentStateRecursively(wxTreeListItem item); + + // Return the current state. + wxCheckBoxState GetCheckedState(wxTreeListItem item) const; + + // Return true if all item children (if any) are in the given state. + bool AreAllChildrenInState(wxTreeListItem item, + wxCheckBoxState state) const; + + + + // Sorting. + // -------- + + // Sort by the given column, either in ascending (default) or descending + // sort order. + // + // By default, simple alphabetical sorting is done by this column contents + // but SetItemComparator() may be called to perform comparison in some + // other way. + void SetSortColumn(unsigned col, bool ascendingOrder = true); + + // If the control contents is sorted, return true and fill the output + // parameters with the column which is currently used for sorting and + // whether we sort using ascending or descending order. Otherwise, i.e. if + // the control contents is unsorted, simply return false. + bool GetSortColumn(unsigned* col, bool* ascendingOrder = NULL); + + // Set the object to use for comparing the items. It will be called when + // the control is being sorted because the user clicked on a sortable + // column. + // + // The provided pointer is stored by the control so the object it points to + // must have a life-time equal or greater to that of the control itself. In + // addition, the pointer can be NULL to stop using custom comparator and + // revert to the default alphabetical comparison. + void SetItemComparator(wxTreeListItemComparator* comparator); + + + // View window functions. + // ---------------------- + + // This control itself is entirely covered by the "view window" which is + // currently a wxDataViewCtrl but if you want to avoid relying on this to + // allow your code to work with later versions which might not be + // wxDataViewCtrl-based, use the first function only and only use the + // second one if you really need to call wxDataViewCtrl methods on it. + wxWindow* GetView() const; + wxDataViewCtrl* GetDataView() const { return m_view; } + +private: + // Common part of all ctors. + void Init(); + + // Pure virtual method inherited from wxCompositeWindow. + virtual wxWindowList GetCompositeWindowParts() const wxOVERRIDE; + + // Implementation of AppendColumn(). + int DoInsertColumn(const wxString& title, + int pos, // May be -1 meaning "append". + int width, + wxAlignment align, + int flags); + + // Common part of {Append,Insert,Prepend}Item(). + wxTreeListItem DoInsertItem(wxTreeListItem parent, + wxTreeListItem previous, + const wxString& text, + int imageClosed, + int imageOpened, + wxClientData* data); + + // Send wxTreeListEvent corresponding to the given wxDataViewEvent for an + // item (as opposed for column-oriented events). + // + // Also updates the original event "skipped" and "vetoed" flags. + void SendItemEvent(wxEventType evt, wxDataViewEvent& event); + + // Send wxTreeListEvent corresponding to the given column wxDataViewEvent. + void SendColumnEvent(wxEventType evt, wxDataViewEvent& event); + + + // Called by wxTreeListModel when an item is toggled by the user. + void OnItemToggled(wxTreeListItem item, wxCheckBoxState stateOld); + + // Event handlers. + void OnSelectionChanged(wxDataViewEvent& event); + void OnItemExpanding(wxDataViewEvent& event); + void OnItemExpanded(wxDataViewEvent& event); + void OnItemActivated(wxDataViewEvent& event); + void OnItemContextMenu(wxDataViewEvent& event); + void OnColumnSorted(wxDataViewEvent& event); + void OnSize(wxSizeEvent& event); + + wxDECLARE_EVENT_TABLE(); + + + wxDataViewCtrl* m_view; + wxTreeListModel* m_model; + + wxTreeListItemComparator* m_comparator; + + + // It calls our inherited protected wxWithImages::GetImage() method. + friend class wxTreeListModel; + + wxDECLARE_NO_COPY_CLASS(wxTreeListCtrl); +}; + +// ---------------------------------------------------------------------------- +// wxTreeListEvent: event generated by wxTreeListCtrl. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTreeListEvent : public wxNotifyEvent +{ +public: + // Default ctor is provided for wxRTTI needs only but should never be used. + wxTreeListEvent() { Init(); } + + // The item affected by the event. Valid for all events except + // column-specific ones such as COLUMN_SORTED. + wxTreeListItem GetItem() const { return m_item; } + + // The previous state of the item checkbox for ITEM_CHECKED events only. + wxCheckBoxState GetOldCheckedState() const { return m_oldCheckedState; } + + // The index of the column affected by the event. Currently only used by + // COLUMN_SORTED event. + unsigned GetColumn() const { return m_column; } + + virtual wxEvent* Clone() const wxOVERRIDE { return new wxTreeListEvent(*this); } + +private: + // Common part of all ctors. + void Init() + { + m_column = static_cast<unsigned>(-1); + + m_oldCheckedState = wxCHK_UNDETERMINED; + } + + // Ctor is private, only wxTreeListCtrl can create events of this type. + wxTreeListEvent(wxEventType evtType, + wxTreeListCtrl* treelist, + wxTreeListItem item) + : wxNotifyEvent(evtType, treelist->GetId()), + m_item(item) + { + SetEventObject(treelist); + + Init(); + } + + // Set the checkbox state before this event for ITEM_CHECKED events. + void SetOldCheckedState(wxCheckBoxState state) + { + m_oldCheckedState = state; + } + + // Set the column affected by this event for COLUMN_SORTED events. + void SetColumn(unsigned column) + { + m_column = column; + } + + + const wxTreeListItem m_item; + + wxCheckBoxState m_oldCheckedState; + + unsigned m_column; + + friend class wxTreeListCtrl; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxTreeListEvent); +}; + +// Event types and event table macros. + +typedef void (wxEvtHandler::*wxTreeListEventFunction)(wxTreeListEvent&); + +#define wxTreeListEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxTreeListEventFunction, func) + +#define wxEVT_TREELIST_GENERIC(name, id, fn) \ + wx__DECLARE_EVT1(wxEVT_TREELIST_##name, id, wxTreeListEventHandler(fn)) + +#define wxDECLARE_TREELIST_EVENT(name) \ + wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, \ + wxEVT_TREELIST_##name, \ + wxTreeListEvent) + +wxDECLARE_TREELIST_EVENT(SELECTION_CHANGED); +#define EVT_TREELIST_SELECTION_CHANGED(id, fn) \ + wxEVT_TREELIST_GENERIC(SELECTION_CHANGED, id, fn) + +wxDECLARE_TREELIST_EVENT(ITEM_EXPANDING); +#define EVT_TREELIST_ITEM_EXPANDING(id, fn) \ + wxEVT_TREELIST_GENERIC(ITEM_EXPANDING, id, fn) + +wxDECLARE_TREELIST_EVENT(ITEM_EXPANDED); +#define EVT_TREELIST_ITEM_EXPANDED(id, fn) \ + wxEVT_TREELIST_GENERIC(ITEM_EXPANDED, id, fn) + +wxDECLARE_TREELIST_EVENT(ITEM_CHECKED); +#define EVT_TREELIST_ITEM_CHECKED(id, fn) \ + wxEVT_TREELIST_GENERIC(ITEM_CHECKED, id, fn) + +wxDECLARE_TREELIST_EVENT(ITEM_ACTIVATED); +#define EVT_TREELIST_ITEM_ACTIVATED(id, fn) \ + wxEVT_TREELIST_GENERIC(ITEM_ACTIVATED, id, fn) + +wxDECLARE_TREELIST_EVENT(ITEM_CONTEXT_MENU); +#define EVT_TREELIST_ITEM_CONTEXT_MENU(id, fn) \ + wxEVT_TREELIST_GENERIC(ITEM_CONTEXT_MENU, id, fn) + +wxDECLARE_TREELIST_EVENT(COLUMN_SORTED); +#define EVT_TREELIST_COLUMN_SORTED(id, fn) \ + wxEVT_TREELIST_GENERIC(COLUMN_SORTED, id, fn) + +#undef wxDECLARE_TREELIST_EVENT + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_TREELIST_SELECTION_CHANGED wxEVT_TREELIST_SELECTION_CHANGED +#define wxEVT_COMMAND_TREELIST_ITEM_EXPANDING wxEVT_TREELIST_ITEM_EXPANDING +#define wxEVT_COMMAND_TREELIST_ITEM_EXPANDED wxEVT_TREELIST_ITEM_EXPANDED +#define wxEVT_COMMAND_TREELIST_ITEM_CHECKED wxEVT_TREELIST_ITEM_CHECKED +#define wxEVT_COMMAND_TREELIST_ITEM_ACTIVATED wxEVT_TREELIST_ITEM_ACTIVATED +#define wxEVT_COMMAND_TREELIST_ITEM_CONTEXT_MENU wxEVT_TREELIST_ITEM_CONTEXT_MENU +#define wxEVT_COMMAND_TREELIST_COLUMN_SORTED wxEVT_TREELIST_COLUMN_SORTED + +#endif // wxUSE_TREELISTCTRL + +#endif // _WX_TREELIST_H_ diff --git a/lib/wxWidgets/include/wx/txtstrm.h b/lib/wxWidgets/include/wx/txtstrm.h new file mode 100644 index 0000000..4e769f1 --- /dev/null +++ b/lib/wxWidgets/include/wx/txtstrm.h @@ -0,0 +1,206 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/txtstrm.h +// Purpose: Text stream classes +// Author: Guilhem Lavaux +// Modified by: +// Created: 28/06/1998 +// Copyright: (c) Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TXTSTREAM_H_ +#define _WX_TXTSTREAM_H_ + +#include "wx/stream.h" +#include "wx/convauto.h" + +#if wxUSE_STREAMS + +class WXDLLIMPEXP_FWD_BASE wxTextInputStream; +class WXDLLIMPEXP_FWD_BASE wxTextOutputStream; + +typedef wxTextInputStream& (*__wxTextInputManip)(wxTextInputStream&); +typedef wxTextOutputStream& (*__wxTextOutputManip)(wxTextOutputStream&); + +WXDLLIMPEXP_BASE wxTextOutputStream &endl( wxTextOutputStream &stream ); + + +// Obsolete constant defined only for compatibility, not used. +#define wxEOT wxT('\4') + +// If you're scanning through a file using wxTextInputStream, you should check for EOF _before_ +// reading the next item (word / number), because otherwise the last item may get lost. +// You should however be prepared to receive an empty item (empty string / zero number) at the +// end of file, especially on Windows systems. This is unavoidable because most (but not all) files end +// with whitespace (i.e. usually a newline). +class WXDLLIMPEXP_BASE wxTextInputStream +{ +public: +#if wxUSE_UNICODE + wxTextInputStream(wxInputStream& s, + const wxString &sep=wxT(" \t"), + const wxMBConv& conv = wxConvAuto()); +#else + wxTextInputStream(wxInputStream& s, const wxString &sep=wxT(" \t")); +#endif + ~wxTextInputStream(); + + const wxInputStream& GetInputStream() const { return m_input; } + + // base may be between 2 and 36, inclusive, or the special 0 (= C format) + wxUint64 Read64(int base = 10); + wxUint32 Read32(int base = 10); + wxUint16 Read16(int base = 10); + wxUint8 Read8(int base = 10); + wxInt64 Read64S(int base = 10); + wxInt32 Read32S(int base = 10); + wxInt16 Read16S(int base = 10); + wxInt8 Read8S(int base = 10); + double ReadDouble(); + wxString ReadLine(); + wxString ReadWord(); + wxChar GetChar(); + + wxString GetStringSeparators() const { return m_separators; } + void SetStringSeparators(const wxString &c) { m_separators = c; } + + // Operators + wxTextInputStream& operator>>(wxString& word); + wxTextInputStream& operator>>(char& c); +#if wxUSE_UNICODE && wxWCHAR_T_IS_REAL_TYPE + wxTextInputStream& operator>>(wchar_t& wc); +#endif // wxUSE_UNICODE + wxTextInputStream& operator>>(wxInt16& i); + wxTextInputStream& operator>>(wxInt32& i); + wxTextInputStream& operator>>(wxInt64& i); + wxTextInputStream& operator>>(wxUint16& i); + wxTextInputStream& operator>>(wxUint32& i); + wxTextInputStream& operator>>(wxUint64& i); + wxTextInputStream& operator>>(double& i); + wxTextInputStream& operator>>(float& f); + + wxTextInputStream& operator>>( __wxTextInputManip func) { return func(*this); } + +protected: + wxInputStream &m_input; + wxString m_separators; + + // Data possibly (see m_validXXX) read from the stream but not decoded yet. + // This is necessary because GetChar() may only return a single character + // but we may get more than one character when decoding raw input bytes. + char m_lastBytes[10]; + + // The bytes [0, m_validEnd) of m_lastBytes contain the bytes read by the + // last GetChar() call (this interval may be empty if GetChar() hasn't been + // called yet). The bytes [0, m_validBegin) have been already decoded and + // returned to caller or stored in m_lastWChar in the particularly + // egregious case of decoding a non-BMP character when using UTF-16 for + // wchar_t. Finally, the bytes [m_validBegin, m_validEnd) remain to be + // decoded and returned during the next call (again, this interval can, and + // usually will, be empty too if m_validBegin == m_validEnd). + size_t m_validBegin, + m_validEnd; + +#if wxUSE_UNICODE + wxMBConv *m_conv; + + // The second half of a surrogate character when using UTF-16 for wchar_t: + // we can't return it immediately from GetChar() when we read a Unicode + // code point outside of the BMP, but we can't keep it in m_lastBytes + // either because it can't separately decoded, so we have a separate 1 + // wchar_t buffer just for this case. +#if SIZEOF_WCHAR_T == 2 + wchar_t m_lastWChar; +#endif // SIZEOF_WCHAR_T == 2 +#endif // wxUSE_UNICODE + + bool EatEOL(const wxChar &c); + void UngetLast(); // should be used instead of wxInputStream::Ungetch() because of Unicode issues + wxChar NextNonSeparators(); + + wxDECLARE_NO_COPY_CLASS(wxTextInputStream); +}; + +enum wxEOL +{ + wxEOL_NATIVE, + wxEOL_UNIX, + wxEOL_MAC, + wxEOL_DOS +}; + +class WXDLLIMPEXP_BASE wxTextOutputStream +{ +public: +#if wxUSE_UNICODE + wxTextOutputStream(wxOutputStream& s, + wxEOL mode = wxEOL_NATIVE, + const wxMBConv& conv = wxConvAuto()); +#else + wxTextOutputStream(wxOutputStream& s, wxEOL mode = wxEOL_NATIVE); +#endif + virtual ~wxTextOutputStream(); + + const wxOutputStream& GetOutputStream() const { return m_output; } + + void SetMode( wxEOL mode = wxEOL_NATIVE ); + wxEOL GetMode() { return m_mode; } + + template<typename T> + void Write(const T& i) + { + wxString str; + str << i; + + WriteString(str); + } + + void Write64(wxUint64 i); + void Write32(wxUint32 i); + void Write16(wxUint16 i); + void Write8(wxUint8 i); + virtual void WriteDouble(double d); + virtual void WriteString(const wxString& string); + + wxTextOutputStream& PutChar(wxChar c); + + void Flush(); + + wxTextOutputStream& operator<<(const wxString& string); + wxTextOutputStream& operator<<(char c); +#if wxUSE_UNICODE && wxWCHAR_T_IS_REAL_TYPE + wxTextOutputStream& operator<<(wchar_t wc); +#endif // wxUSE_UNICODE + wxTextOutputStream& operator<<(wxInt16 c); + wxTextOutputStream& operator<<(wxInt32 c); + wxTextOutputStream& operator<<(wxInt64 c); + wxTextOutputStream& operator<<(wxUint16 c); + wxTextOutputStream& operator<<(wxUint32 c); + wxTextOutputStream& operator<<(wxUint64 c); + wxTextOutputStream& operator<<(double f); + wxTextOutputStream& operator<<(float f); + + wxTextOutputStream& operator<<( __wxTextOutputManip func) { return func(*this); } + +protected: + wxOutputStream &m_output; + wxEOL m_mode; + +#if wxUSE_UNICODE + wxMBConv *m_conv; + +#if SIZEOF_WCHAR_T == 2 + // The first half of a surrogate character if one was passed to PutChar() + // and couldn't be output when it was called the last time. + wchar_t m_lastWChar; +#endif // SIZEOF_WCHAR_T == 2 +#endif // wxUSE_UNICODE + + wxDECLARE_NO_COPY_CLASS(wxTextOutputStream); +}; + +#endif + // wxUSE_STREAMS + +#endif + // _WX_DATSTREAM_H_ diff --git a/lib/wxWidgets/include/wx/typeinfo.h b/lib/wxWidgets/include/wx/typeinfo.h new file mode 100644 index 0000000..c20106d --- /dev/null +++ b/lib/wxWidgets/include/wx/typeinfo.h @@ -0,0 +1,147 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/typeinfo.h +// Purpose: wxTypeId implementation +// Author: Jaakko Salli +// Created: 2009-11-19 +// Copyright: (c) wxWidgets Team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TYPEINFO_H_ +#define _WX_TYPEINFO_H_ + +// +// This file defines wxTypeId macro that should be used internally in +// wxWidgets instead of typeid(), for compatibility with builds that do +// not implement C++ RTTI. Also, type defining macros in this file are +// intended for internal use only at this time and may change in future +// versions. +// +// The reason why we need this simple RTTI system in addition to the older +// wxObject-based one is that the latter does not work in template +// classes. +// + +#include "wx/defs.h" + +#ifndef wxNO_RTTI + +// +// Let's trust that Visual C++ versions 9.0 and later implement C++ +// RTTI well enough, so we can use it and work around harmless memory +// leaks reported by the static run-time libraries. +// +#if wxCHECK_VISUALC_VERSION(9) + #define wxTRUST_CPP_RTTI 1 +#else + #define wxTRUST_CPP_RTTI 0 +#endif + +#include <typeinfo> +#include <string.h> + +#define _WX_DECLARE_TYPEINFO_CUSTOM(CLS, IDENTFUNC) +#define WX_DECLARE_TYPEINFO_INLINE(CLS) +#define WX_DECLARE_TYPEINFO(CLS) +#define WX_DEFINE_TYPEINFO(CLS) +#define WX_DECLARE_ABSTRACT_TYPEINFO(CLS) + +#if wxTRUST_CPP_RTTI + +#define wxTypeId typeid + +#else /* !wxTRUST_CPP_RTTI */ + +// +// For improved type-safety, let's make the check using class name +// comparison. Most modern compilers already do this, but we cannot +// rely on all supported compilers to work this well. However, in +// cases where we'd know that typeid() would be flawless (as such), +// wxTypeId could of course simply be defined as typeid. +// + +class wxTypeIdentifier +{ +public: + wxTypeIdentifier(const char* className) + { + m_className = className; + } + + bool operator==(const wxTypeIdentifier& other) const + { + return strcmp(m_className, other.m_className) == 0; + } + + bool operator!=(const wxTypeIdentifier& other) const + { + return !(*this == other); + } +private: + const char* m_className; +}; + +#define wxTypeId(OBJ) wxTypeIdentifier(typeid(OBJ).name()) + +#endif /* wxTRUST_CPP_RTTI/!wxTRUST_CPP_RTTI */ + +#else // if !wxNO_RTTI + +#define wxTRUST_CPP_RTTI 0 + +// +// When C++ RTTI is not available, we will have to make the type comparison +// using pointer to a dummy static member function. This will fail if +// declared type is used across DLL boundaries, although using +// WX_DECLARE_TYPEINFO() and WX_DEFINE_TYPEINFO() pair instead of +// WX_DECLARE_TYPEINFO_INLINE() should fix this. However, that approach is +// usually not possible when type info needs to be declared for a template +// class. +// + +typedef void (*wxTypeIdentifier)(); + +// Use this macro to declare type info with specified static function +// IDENTFUNC used as type identifier. Usually you should only use +// WX_DECLARE_TYPEINFO() or WX_DECLARE_TYPEINFO_INLINE() however. +#define _WX_DECLARE_TYPEINFO_CUSTOM(CLS, IDENTFUNC) \ +public: \ + virtual wxTypeIdentifier GetWxTypeId() const wxOVERRIDE \ + { \ + return reinterpret_cast<wxTypeIdentifier> \ + (&IDENTFUNC); \ + } + +// Use this macro to declare type info with externally specified +// type identifier, defined with WX_DEFINE_TYPEINFO(). +#define WX_DECLARE_TYPEINFO(CLS) \ +private: \ + static CLS sm_wxClassInfo(); \ +_WX_DECLARE_TYPEINFO_CUSTOM(CLS, sm_wxClassInfo) + +// Use this macro to implement type identifier function required by +// WX_DECLARE_TYPEINFO(). +// NOTE: CLS is required to have default ctor. If it doesn't +// already, you should provide a private dummy one. +#define WX_DEFINE_TYPEINFO(CLS) \ +CLS CLS::sm_wxClassInfo() { return CLS(); } + +// Use this macro to declare type info fully inline in class. +// NOTE: CLS is required to have default ctor. If it doesn't +// already, you should provide a private dummy one. +#define WX_DECLARE_TYPEINFO_INLINE(CLS) \ +private: \ + static CLS sm_wxClassInfo() { return CLS(); } \ +_WX_DECLARE_TYPEINFO_CUSTOM(CLS, sm_wxClassInfo) + +#define wxTypeId(OBJ) (OBJ).GetWxTypeId() + +// Because abstract classes cannot be instantiated, we use +// this macro to define pure virtual type interface for them. +#define WX_DECLARE_ABSTRACT_TYPEINFO(CLS) \ +public: \ + virtual wxTypeIdentifier GetWxTypeId() const = 0; + +#endif // wxNO_RTTI/!wxNO_RTTI + +#endif // _WX_TYPEINFO_H_ diff --git a/lib/wxWidgets/include/wx/types.h b/lib/wxWidgets/include/wx/types.h new file mode 100644 index 0000000..8ac189b --- /dev/null +++ b/lib/wxWidgets/include/wx/types.h @@ -0,0 +1,384 @@ +/* + * Name: wx/types.h + * Purpose: Declarations of common wx types and related constants. + * Author: Vadim Zeitlin (extracted from wx/defs.h) + * Created: 2018-01-07 + * Copyright: (c) 1997-2018 wxWidgets dev team + * Licence: wxWindows licence + */ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#ifndef _WX_TYPES_H_ +#define _WX_TYPES_H_ + +/* + Don't include wx/defs.h from here as we're included from it, but do include + wx/platform.h which will take care of including wx/setup.h too. + */ +#include "wx/platform.h" + +/* ---------------------------------------------------------------------------- */ +/* standard wxWidgets types */ +/* ---------------------------------------------------------------------------- */ + +/* the type for screen and DC coordinates */ +typedef int wxCoord; + +enum { wxDefaultCoord = -1 }; + +/* ---------------------------------------------------------------------------- */ +/* define fixed length types */ +/* ---------------------------------------------------------------------------- */ + +#if defined(__MINGW32__) + #include <sys/types.h> +#endif + +/* chars are always one byte (by definition), shorts are always two (in */ +/* practice) */ + +/* 8bit */ +typedef signed char wxInt8; +typedef unsigned char wxUint8; +typedef wxUint8 wxByte; + + +/* 16bit */ +#ifdef SIZEOF_SHORT + #if SIZEOF_SHORT != 2 + #error "wxWidgets assumes sizeof(short) == 2, please fix the code" + #endif +#else + #define SIZEOF_SHORT 2 +#endif + +typedef signed short wxInt16; +typedef unsigned short wxUint16; + +typedef wxUint16 wxWord; + +/* + things are getting more interesting with ints, longs and pointers + + there are several different standard data models described by this table: + + +-----------+----------------------------+ + |type\model | LP64 ILP64 LLP64 ILP32 LP32| + +-----------+----------------------------+ + |char | 8 8 8 8 8 | + |short | 16 16 16 16 16 | + |int | 32 64 32 32 16 | + |long | 64 64 32 32 32 | + |long long | 64 64 64 -- -- | + |void * | 64 64 64 32 32 | + +-----------+----------------------------+ + + Win16 used LP32 (but we don't support it any longer), Win32 obviously used + ILP32 and Win64 uses LLP64 (a.k.a. P64) + + Under Unix LP64 is the most widely used (the only I've ever seen, in fact) + */ + +/* 32bit */ +#if defined(__WINDOWS__) + #if defined(__WIN32__) + typedef int wxInt32; + typedef unsigned int wxUint32; + + /* + Win64 uses LLP64 model and so ints and longs have the same size as + in Win32. + */ + #ifndef SIZEOF_INT + #define SIZEOF_INT 4 + #endif + + #ifndef SIZEOF_LONG + #define SIZEOF_LONG 4 + #endif + + #ifndef SIZEOF_LONG_LONG + #define SIZEOF_LONG_LONG 8 + #endif + + #ifndef SIZEOF_WCHAR_T + /* Windows uses UTF-16 */ + #define SIZEOF_WCHAR_T 2 + #endif + + #ifndef SIZEOF_SIZE_T + /* + Under Win64 sizeof(size_t) == 8 and so it is neither unsigned + int nor unsigned long! + */ + #ifdef __WIN64__ + #define SIZEOF_SIZE_T 8 + + #undef wxSIZE_T_IS_UINT + #else /* Win32 */ + #define SIZEOF_SIZE_T 4 + + #define wxSIZE_T_IS_UINT + #endif + #undef wxSIZE_T_IS_ULONG + #endif + + #ifndef SIZEOF_VOID_P + #ifdef __WIN64__ + #define SIZEOF_VOID_P 8 + #else /* Win32 */ + #define SIZEOF_VOID_P 4 + #endif /* Win64/32 */ + #endif + #else + #error "Unsupported Windows version" + #endif +#else /* !Windows */ + /* SIZEOF_XXX are normally defined by configure */ + #ifdef SIZEOF_INT + #if SIZEOF_INT == 8 + /* must be ILP64 data model, there is normally a special 32 bit */ + /* type in it but we don't know what it is... */ + #error "No 32bit int type on this platform" + #elif SIZEOF_INT == 4 + typedef int wxInt32; + typedef unsigned int wxUint32; + #elif SIZEOF_INT == 2 + /* must be LP32 */ + #if SIZEOF_LONG != 4 + #error "No 32bit int type on this platform" + #endif + + typedef long wxInt32; + typedef unsigned long wxUint32; + #else + /* wxWidgets is not ready for 128bit systems yet... */ + #error "Unknown sizeof(int) value, what are you compiling for?" + #endif + #else /* !defined(SIZEOF_INT) */ + /* assume default 32bit machine -- what else can we do? */ + wxCOMPILE_TIME_ASSERT( sizeof(int) == 4, IntMustBeExactly4Bytes); + wxCOMPILE_TIME_ASSERT( sizeof(size_t) == 4, SizeTMustBeExactly4Bytes); + wxCOMPILE_TIME_ASSERT( sizeof(void *) == 4, PtrMustBeExactly4Bytes); + + #define SIZEOF_INT 4 + #define SIZEOF_SIZE_T 4 + #define SIZEOF_VOID_P 4 + + typedef int wxInt32; + typedef unsigned int wxUint32; + + #if defined(__MACH__) && !defined(SIZEOF_WCHAR_T) + #define SIZEOF_WCHAR_T 4 + #endif + #if !defined(SIZEOF_WCHAR_T) + /* also assume that sizeof(wchar_t) == 2 (under Unix the most */ + /* common case is 4 but there configure would have defined */ + /* SIZEOF_WCHAR_T for us) */ + /* the most common case */ + wxCOMPILE_TIME_ASSERT( sizeof(wchar_t) == 2, + Wchar_tMustBeExactly2Bytes); + + #define SIZEOF_WCHAR_T 2 + #endif /* !defined(SIZEOF_WCHAR_T) */ + #endif +#endif /* Win/!Win */ + +#ifndef SIZEOF_WCHAR_T + #error "SIZEOF_WCHAR_T must be defined, but isn't" +#endif + +/* also define C99-like sized MIN/MAX constants */ +#define wxINT8_MIN CHAR_MIN +#define wxINT8_MAX CHAR_MAX +#define wxUINT8_MAX UCHAR_MAX + +#define wxINT16_MIN SHRT_MIN +#define wxINT16_MAX SHRT_MAX +#define wxUINT16_MAX USHRT_MAX + +#if SIZEOF_INT == 4 + #define wxINT32_MIN INT_MIN + #define wxINT32_MAX INT_MAX + #define wxUINT32_MAX UINT_MAX +#elif SIZEOF_LONG == 4 + #define wxINT32_MIN LONG_MIN + #define wxINT32_MAX LONG_MAX + #define wxUINT32_MAX ULONG_MAX +#else + #error "Unknown 32 bit type" +#endif + +typedef wxUint32 wxDword; + +#ifdef LLONG_MAX + #define wxINT64_MIN LLONG_MIN + #define wxINT64_MAX LLONG_MAX + #define wxUINT64_MAX ULLONG_MAX +#else + #define wxINT64_MIN (wxLL(-9223372036854775807)-1) + #define wxINT64_MAX wxLL(9223372036854775807) + #define wxUINT64_MAX wxULL(0xFFFFFFFFFFFFFFFF) +#endif + +/* 64 bit */ + +/* NB: we #define and not typedef wxLongLong_t because we use "#ifdef */ +/* wxLongLong_t" in wx/longlong.h */ + +/* wxULongLong_t is set later (usually to unsigned wxLongLong_t) */ + +/* to avoid compilation problems on 64bit machines with ambiguous method calls */ +/* we will need to define this */ +#undef wxLongLongIsLong + +/* + First check for specific compilers which have known 64 bit integer types, + this avoids clashes with SIZEOF_LONG[_LONG] being defined incorrectly for + e.g. MSVC builds (Python.h defines it as 8 even for MSVC). + + Also notice that we check for "long long" before checking for 64 bit long as + we still want to use "long long" and not "long" for wxLongLong_t on 64 bit + architectures to be able to pass wxLongLong_t to the standard functions + prototyped as taking "long long" such as strtoll(). + */ +#if (defined(__VISUALC__) || defined(__INTELC__)) && defined(__WIN32__) + #define wxLongLong_t __int64 + #define wxLongLongSuffix i64 + #define wxLongLongFmtSpec "I64" +#elif defined(__MINGW32__) && \ + (defined(__USE_MINGW_ANSI_STDIO) && (__USE_MINGW_ANSI_STDIO != 1)) + #define wxLongLong_t long long + #define wxLongLongSuffix ll + #define wxLongLongFmtSpec "I64" +#elif (defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG >= 8) || \ + defined(__GNUC__) || \ + defined(__CYGWIN__) + #define wxLongLong_t long long + #define wxLongLongSuffix ll + #define wxLongLongFmtSpec "ll" +#elif defined(SIZEOF_LONG) && (SIZEOF_LONG == 8) + #define wxLongLong_t long + #define wxLongLongSuffix l + #define wxLongLongFmtSpec "l" + #define wxLongLongIsLong +#endif + + +#ifdef wxLongLong_t + #define wxULongLong_t unsigned wxLongLong_t + + /* + wxLL() and wxULL() macros allow to define 64 bit constants in a + portable way. + */ + #define wxLL(x) wxCONCAT(x, wxLongLongSuffix) + #define wxULL(x) wxCONCAT(x, wxCONCAT(u, wxLongLongSuffix)) + + typedef wxLongLong_t wxInt64; + typedef wxULongLong_t wxUint64; + + #define wxHAS_INT64 1 + + #ifndef wxLongLongIsLong + #define wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG + #endif +#elif wxUSE_LONGLONG + /* these macros allow to define 64 bit constants in a portable way */ + #define wxLL(x) wxLongLong(x) + #define wxULL(x) wxULongLong(x) + + #define wxInt64 wxLongLong + #define wxUint64 wxULongLong + + #define wxHAS_INT64 1 + +#else /* !wxUSE_LONGLONG */ + + #define wxHAS_INT64 0 + +#endif + +/* + Helper macro for conditionally compiling some code only if wxLongLong_t is + available and is a type different from the other integer types (i.e. not + long). + */ +#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG + #define wxIF_LONG_LONG_TYPE(x) x +#else + #define wxIF_LONG_LONG_TYPE(x) +#endif + + +/* Make sure ssize_t is defined (a signed type the same size as size_t). */ +/* (HAVE_SSIZE_T is not already defined by configure) */ +#ifndef HAVE_SSIZE_T +#ifdef __MINGW32__ + #if defined(_SSIZE_T_) || defined(_SSIZE_T_DEFINED) + #define HAVE_SSIZE_T + #endif +#endif +#endif /* !HAVE_SSIZE_T */ + +/* If we really don't have ssize_t, provide our own version. */ +#ifdef HAVE_SSIZE_T + #ifdef __UNIX__ + #include <sys/types.h> + #endif +#else /* !HAVE_SSIZE_T */ + #if SIZEOF_SIZE_T == 4 + typedef wxInt32 ssize_t; + #elif SIZEOF_SIZE_T == 8 + typedef wxInt64 ssize_t; + #else + #error "error defining ssize_t, size_t is not 4 or 8 bytes" + #endif + + /* prevent ssize_t redefinitions in other libraries */ + #define HAVE_SSIZE_T +#endif + +/* + We can't rely on Windows _W64 being defined as windows.h may not be + included so define our own equivalent: this should be used with types + like WXLPARAM or WXWPARAM which are 64 bit under Win64 to avoid warnings + each time we cast it to a pointer or a handle (which results in hundreds + of warnings as Win32 API often passes pointers in them) + */ +#if defined(__VISUALC__) && (_MSC_VER < 1800) + #define wxW64 __w64 +#else + #define wxW64 +#endif + +/* + Define signed and unsigned integral types big enough to contain all of long, + size_t and void *. + */ +#if SIZEOF_LONG >= SIZEOF_VOID_P + /* + Normal case when long is the largest integral type. + */ + typedef long wxIntPtr; + typedef unsigned long wxUIntPtr; +#elif SIZEOF_SIZE_T >= SIZEOF_VOID_P + /* + Win64 case: size_t is the only integral type big enough for "void *". + + Notice that we must use __w64 to avoid warnings about casting pointers + to wxIntPtr (which we do often as this is what it is defined for) in 32 + bit build with MSVC. + */ + typedef wxW64 ssize_t wxIntPtr; + typedef size_t wxUIntPtr; +#else + /* + This should never happen for the current architectures but if you're + using one where it does, please contact wx-dev@googlegroups.com. + */ + #error "Pointers can't be stored inside integer types." +#endif + +#endif // _WX_TYPES_H_ diff --git a/lib/wxWidgets/include/wx/uiaction.h b/lib/wxWidgets/include/wx/uiaction.h new file mode 100644 index 0000000..9b8df10 --- /dev/null +++ b/lib/wxWidgets/include/wx/uiaction.h @@ -0,0 +1,91 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/uiaction.h +// Purpose: wxUIActionSimulator interface +// Author: Kevin Ollivier, Steven Lamerton, Vadim Zeitlin +// Created: 2010-03-06 +// Copyright: (c) 2010 Kevin Ollivier +// (c) 2010 Steven Lamerton +// (c) 2010-2016 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UIACTIONSIMULATOR_H_ +#define _WX_UIACTIONSIMULATOR_H_ + +#include "wx/defs.h" + +#if wxUSE_UIACTIONSIMULATOR + +#include "wx/mousestate.h" // for wxMOUSE_BTN_XXX constants + +class WXDLLIMPEXP_CORE wxUIActionSimulator +{ +public: + wxUIActionSimulator(); + ~wxUIActionSimulator(); + + + // Mouse simulation + // ---------------- + + // Low level methods + bool MouseMove(long x, long y); + bool MouseMove(const wxPoint& point) { return MouseMove(point.x, point.y); } + + bool MouseDown(int button = wxMOUSE_BTN_LEFT); + bool MouseUp(int button = wxMOUSE_BTN_LEFT); + + // Higher level interface, use it if possible instead + bool MouseClick(int button = wxMOUSE_BTN_LEFT); + bool MouseDblClick(int button = wxMOUSE_BTN_LEFT); + bool MouseDragDrop(long x1, long y1, long x2, long y2, + int button = wxMOUSE_BTN_LEFT); + bool MouseDragDrop(const wxPoint& p1, const wxPoint& p2, + int button = wxMOUSE_BTN_LEFT) + { return MouseDragDrop(p1.x, p1.y, p2.x, p2.y, button); } + + // Keyboard simulation + // ------------------- + + // Low level methods for generating key presses and releases + bool KeyDown(int keycode, int modifiers = wxMOD_NONE) + { return Key(keycode, modifiers, true); } + + bool KeyUp(int keycode, int modifiers = wxMOD_NONE) + { return Key(keycode, modifiers, false); } + + // Higher level methods for generating both the key press and release for a + // single key or for all characters in the ASCII string "text" which can currently + // contain letters, digits and characters for the definition of numbers [+-., ]. + bool Char(int keycode, int modifiers = wxMOD_NONE); + + bool Text(const char *text); + + // Select the item with the given text in the currently focused control. + bool Select(const wxString& text); + +private: + // This is the common part of Key{Down,Up}() methods: while we keep them + // separate at public API level for consistency with Mouse{Down,Up}(), at + // implementation level it makes more sense to have them in a single + // function. + // + // It calls DoModifiers() to simulate pressing the modifier keys if + // necessary and then DoKey() for the key itself. + bool Key(int keycode, int modifiers, bool isDown); + + // Call DoKey() for all modifier keys whose bits are set in the parameter. + void SimulateModifiers(int modifier, bool isDown); + + + + // This pointer is allocated in the ctor and points to the + // platform-specific implementation. + class wxUIActionSimulatorImpl* const m_impl; + + wxDECLARE_NO_COPY_CLASS(wxUIActionSimulator); +}; + +#endif // wxUSE_UIACTIONSIMULATOR + +#endif // _WX_UIACTIONSIMULATOR_H_ diff --git a/lib/wxWidgets/include/wx/uilocale.h b/lib/wxWidgets/include/wx/uilocale.h new file mode 100644 index 0000000..70ee542 --- /dev/null +++ b/lib/wxWidgets/include/wx/uilocale.h @@ -0,0 +1,272 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/uilocale.h +// Purpose: wxUILocale class declaration. +// Author: Vadim Zeitlin +// Created: 2021-07-31 +// Copyright: (c) 2021 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UILOCALE_H_ +#define _WX_UILOCALE_H_ + +#include "wx/defs.h" + +#if wxUSE_INTL + +#include "wx/datetime.h" +#include "wx/localedefs.h" +#include "wx/string.h" +#include "wx/vector.h" + +class wxUILocaleImpl; + +// Flags for wxUILocale::CompareStrings(). +enum +{ + wxCompare_CaseSensitive = 0, + wxCompare_CaseInsensitive = 1 +}; + +// ---------------------------------------------------------------------------- +// wxLocaleIdent: allows to fully identify a locale under all platforms +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxLocaleIdent +{ +public: + // Create the object from BCP 47-like language tag: the string must contain + // at least the language part (2 or 3 ASCII letters) and may contain script + // and region separated by dashes. + static wxLocaleIdent FromTag(const wxString& tag); + + // Default ctor creates an empty, invalid identifier. + wxLocaleIdent() { } + + // Set language + wxLocaleIdent& Language(const wxString& language); + + // Set region + wxLocaleIdent& Region(const wxString& region); + + // Set script (not supported and ignored under Unix) + wxLocaleIdent& Script(const wxString& script); + + // Set charset (only supported under Unix) + wxLocaleIdent& Charset(const wxString& charset); + + // Set modifier (only supported under Unix) + wxLocaleIdent& Modifier(const wxString& modifier); + + // Set extension (only supported under Windows) + wxLocaleIdent& Extension(const wxString& extension); + + // Set sort order (only supported under Windows) + wxLocaleIdent& SortOrder(const wxString& sortorder); + + // Accessors for the individual fields. + const wxString& GetLanguage() const { return m_language; } + const wxString& GetRegion() const { return m_region; } + const wxString& GetScript() const { return m_script; } + const wxString& GetCharset() const { return m_charset; } + const wxString& GetModifier() const { return m_modifier; } + const wxString& GetExtension() const { return m_extension; } + const wxString& GetSortorder() const { return m_sortorder; } + + // Construct platform dependent name + wxString GetName() const; + + // Get the language tag: for the objects created with FromTag() returns the + // string passed to it directly, otherwise reconstructs this string from + // the components. + wxString GetTag(wxLocaleTagType tagType = wxLOCALE_TAGTYPE_DEFAULT) const; + + // Empty locale identifier is invalid. at least Language() must be called. + bool IsEmpty() const + { + return m_language.empty(); + } + +private: + wxString m_tag; + + wxString m_language; + wxString m_region; + wxString m_script; + wxString m_charset; + wxString m_modifier; + wxString m_extension; + wxString m_sortorder; +}; + +// ---------------------------------------------------------------------------- +// wxUILocale allows to use the default UI locale and get information about it +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxUILocale +{ +public: + // Configure the UI to use the default user locale. + static bool UseDefault(); + + // Use the locale corresponding to the given POSIX locale, e.g. "de_DE.UTF-8". + // + // This is a compatibility function used by wxWidgets itself, don't use it + // in the new code. + static bool UseLocaleName(const wxString& localeName); + + // Get the object corresponding to the currently used locale. + static const wxUILocale& GetCurrent(); + + // A helper just to avoid writing wxUILocale(wxLocaleIdent::FromTag(...)). + static wxUILocale FromTag(const wxString& tag) + { + return wxUILocale(wxLocaleIdent::FromTag(tag)); + } + + // Create the object corresponding to the given locale. + explicit wxUILocale(const wxLocaleIdent& localeId); + + // Objects of this class can be (cheaply) copied. + wxUILocale(const wxUILocale& loc); + wxUILocale& operator=(const wxUILocale& loc); + + // Check if the locale is actually supported by the current system: if it's + // not supported, the other functions will behave as for the "C" locale. + bool IsSupported() const; + + // Get the platform-dependent name of the current locale. + wxString GetName() const; + + // Get the locale id from which the current locale was instantiated. + wxLocaleIdent GetLocaleId() const; + + // Query the locale for the specified information. + wxString GetInfo(wxLocaleInfo index, + wxLocaleCategory cat = wxLOCALE_CAT_DEFAULT) const; + + // Query the locale for the specified localized name. + wxString GetLocalizedName(wxLocaleName name, wxLocaleForm form) const; + + // Query the layout direction of the current locale. + wxLayoutDirection GetLayoutDirection() const; + + // Compares two strings in the order defined by this locale. + int CompareStrings(const wxString& lhs, const wxString& rhs, + int flags = wxCompare_CaseSensitive) const; + +#if wxUSE_DATETIME +#if wxABI_VERSION >= 30203 + // Get the full (default) or abbreviated localized month name + // returns empty string on error + wxString GetMonthName(wxDateTime::Month month, + wxDateTime::NameFlags flags = wxDateTime::Name_Full) const; + + // Get the full (default) or abbreviated localized weekday name + // returns empty string on error + wxString GetWeekDayName(wxDateTime::WeekDay weekday, + wxDateTime::NameFlags flags = wxDateTime::Name_Full) const; +#endif // wxABI_VERSION >= 3.2.3 +#endif // wxUSE_DATETIME + + // Note that this class is not supposed to be used polymorphically, hence + // its dtor is not virtual. + ~wxUILocale(); + +#if wxABI_VERSION >= 30202 + // Return the locale ID representing the default system locale, which would + // be set is UseDefault() is called. + static wxLocaleIdent GetSystemLocaleId(); +#endif // wxABI_VERSION >= 3.2.2 + + // Try to get user's (or OS's) preferred language setting. + // Return wxLANGUAGE_UNKNOWN if the language-guessing algorithm failed + // Prefer using GetSystemLocaleId() above. + static int GetSystemLanguage(); + + // Try to get user's (or OS's) default locale setting. + // Return wxLANGUAGE_UNKNOWN if the locale-guessing algorithm failed + // Prefer using GetSystemLocaleId() above. + static int GetSystemLocale(); + + // Try to retrieve a list of user's (or OS's) preferred UI languages. + // Return empty list if language-guessing algorithm failed + static wxVector<wxString> GetPreferredUILanguages(); + + // Retrieve the language info struct for the given language + // + // Returns NULL if no info found, pointer must *not* be deleted by caller + static const wxLanguageInfo* GetLanguageInfo(int lang); + + // Returns language name in English or empty string if the language + // is not in database + static wxString GetLanguageName(int lang); + + // Returns ISO code ("canonical name") of language or empty string if the + // language is not in database + static wxString GetLanguageCanonicalName(int lang); + + // Find the language for the given locale string which may be either a + // canonical ISO 2 letter language code ("xx"), a language code followed by + // the country code ("xx_XX") or a Windows full language name ("Xxxxx...") + // + // Returns NULL if no info found, pointer must *not* be deleted by caller + static const wxLanguageInfo* FindLanguageInfo(const wxString& locale); + + // Find the language for the given locale string which may be either a + // canonical ISO 2 letter language code ("xx"), a language code followed by + // the country code ("xx_XX") or a Windows full language name ("Xxxxx...") + // + // Returns NULL if no info found, pointer must *not* be deleted by caller + static const wxLanguageInfo* FindLanguageInfo(const wxLocaleIdent& locId); + + // Add custom language to the list of known languages. + // Notes: 1) wxLanguageInfo contains platform-specific data + // 2) must be called before Init to have effect + static void AddLanguage(const wxLanguageInfo& info); + + // These two methods are for internal use only. First one creates the + // global language database if it doesn't already exist, second one destroys + // it. + static void CreateLanguagesDB(); + static void DestroyLanguagesDB(); + + // These two methods are for internal use only. + // wxLocaleIdent expects script identifiers as listed in ISO 15924. + // However, directory names for translation catalogs follow the + // Unix convention, using script aliases as listed in ISO 15924. + // First one converts a script name to its alias, second converts + // a script alias to its corresponding script name. + // Both methods return empty strings, if the script name or alias + // couldn't be found. + static wxString GetScriptAliasFromName(const wxString& scriptName); + static wxString GetScriptNameFromAlias(const wxString& scriptAlias); + +private: + // This ctor is private and exists only for implementation reasons. + // It takes ownership of the provided pointer. + explicit wxUILocale(wxUILocaleImpl* impl = NULL) : m_impl(impl) { } + + // Creates the global tables of languages and scripts called by CreateLanguagesDB + static void InitLanguagesDB(); + + static wxUILocale ms_current; + + wxUILocaleImpl* m_impl; +}; + +inline wxString wxGetUIDateFormat() +{ + return wxUILocale::GetCurrent().GetInfo(wxLOCALE_SHORT_DATE_FMT); +} + +#else // !wxUSE_INTL + +inline wxString wxGetUIDateFormat() +{ + return wxString(wxS("%x")); +} + +#endif // wxUSE_INTL/!wxUSE_INTL + +#endif // _WX_UILOCALE_H_ diff --git a/lib/wxWidgets/include/wx/unichar.h b/lib/wxWidgets/include/wx/unichar.h new file mode 100644 index 0000000..fc8d7d1 --- /dev/null +++ b/lib/wxWidgets/include/wx/unichar.h @@ -0,0 +1,400 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/unichar.h +// Purpose: wxUniChar and wxUniCharRef classes +// Author: Vaclav Slavik +// Created: 2007-03-19 +// Copyright: (c) 2007 REA Elektronik GmbH +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNICHAR_H_ +#define _WX_UNICHAR_H_ + +#include "wx/defs.h" +#include "wx/chartype.h" +#include "wx/stringimpl.h" + +// We need to get std::swap() declaration in order to specialize it below and +// it is declared in different headers for C++98 and C++11. Instead of testing +// which one is being used, just include both of them as it's simpler and less +// error-prone. +#include <algorithm> // std::swap() for C++98 +#include <utility> // std::swap() for C++11 + +class WXDLLIMPEXP_FWD_BASE wxUniCharRef; +class WXDLLIMPEXP_FWD_BASE wxString; + +// This class represents single Unicode character. It can be converted to +// and from char or wchar_t and implements commonly used character operations. +class WXDLLIMPEXP_BASE wxUniChar +{ +public: + // NB: this is not wchar_t on purpose, it needs to represent the entire + // Unicode code points range and wchar_t may be too small for that + // (e.g. on Win32 where wchar_t* is encoded in UTF-16) + typedef wxUint32 value_type; + + wxUniChar() : m_value(0) {} + + // Create the character from 8bit character value encoded in the current + // locale's charset. + wxUniChar(char c) { m_value = From8bit(c); } + wxUniChar(unsigned char c) { m_value = From8bit((char)c); } + +#define wxUNICHAR_DEFINE_CTOR(type) \ + wxUniChar(type c) { m_value = (value_type)c; } + wxDO_FOR_INT_TYPES(wxUNICHAR_DEFINE_CTOR) +#undef wxUNICHAR_DEFINE_CTOR + + wxUniChar(const wxUniCharRef& c); + + // Returns Unicode code point value of the character + value_type GetValue() const { return m_value; } + +#if wxUSE_UNICODE_UTF8 + // buffer for single UTF-8 character + struct Utf8CharBuffer + { + char data[5]; + operator const char*() const { return data; } + }; + + // returns the character encoded as UTF-8 + // (NB: implemented in stringops.cpp) + Utf8CharBuffer AsUTF8() const; +#endif // wxUSE_UNICODE_UTF8 + + // Returns true if the character is an ASCII character: + bool IsAscii() const { return m_value < 0x80; } + + // Returns true if the character is representable as a single byte in the + // current locale encoding and return this byte in output argument c (which + // must be non-NULL) + bool GetAsChar(char *c) const + { +#if wxUSE_UNICODE + if ( !IsAscii() ) + { +#if !wxUSE_UTF8_LOCALE_ONLY + if ( GetAsHi8bit(m_value, c) ) + return true; +#endif // !wxUSE_UTF8_LOCALE_ONLY + + return false; + } +#endif // wxUSE_UNICODE + + *c = wx_truncate_cast(char, m_value); + return true; + } + + // Returns true if the character is a BMP character: + static bool IsBMP(wxUint32 value) { return value < 0x10000; } + + // Returns true if the character is a supplementary character: + static bool IsSupplementary(wxUint32 value) { return 0x10000 <= value && value < 0x110000; } + + // Returns the high surrogate code unit for the supplementary character + static wxUint16 HighSurrogate(wxUint32 value) + { + wxASSERT_MSG(IsSupplementary(value), "wxUniChar::HighSurrogate() must be called on a supplementary character"); + return static_cast<wxUint16>(0xD800 | ((value - 0x10000) >> 10)); + } + + // Returns the low surrogate code unit for the supplementary character + static wxUint16 LowSurrogate(wxUint32 value) + { + wxASSERT_MSG(IsSupplementary(value), "wxUniChar::LowSurrogate() must be called on a supplementary character"); + return static_cast<wxUint16>(0xDC00 | ((value - 0x10000) & 0x03FF)); + } + + // Returns true if the character is a BMP character: + bool IsBMP() const { return IsBMP(m_value); } + + // Returns true if the character is a supplementary character: + bool IsSupplementary() const { return IsSupplementary(m_value); } + + // Returns the high surrogate code unit for the supplementary character + wxUint16 HighSurrogate() const { return HighSurrogate(m_value); } + + // Returns the low surrogate code unit for the supplementary character + wxUint16 LowSurrogate() const { return LowSurrogate(m_value); } + + // Conversions to char and wchar_t types: all of those are needed to be + // able to pass wxUniChars to various standard narrow and wide character + // functions + operator char() const { return To8bit(m_value); } + operator unsigned char() const { return (unsigned char)To8bit(m_value); } + +#define wxUNICHAR_DEFINE_OPERATOR_PAREN(type) \ + operator type() const { return (type)m_value; } + wxDO_FOR_INT_TYPES(wxUNICHAR_DEFINE_OPERATOR_PAREN) +#undef wxUNICHAR_DEFINE_OPERATOR_PAREN + + // We need this operator for the "*p" part of expressions like "for ( + // const_iterator p = begin() + nStart; *p; ++p )". In this case, + // compilation would fail without it because the conversion to bool would + // be ambiguous (there are all these int types conversions...). (And adding + // operator unspecified_bool_type() would only makes the ambiguity worse.) + operator bool() const { return m_value != 0; } + bool operator!() const { return !((bool)*this); } + + // And this one is needed by some (not all, but not using ifdefs makes the + // code easier) compilers to parse "str[0] && *p" successfully + bool operator&&(bool v) const { return (bool)*this && v; } + + // Assignment operators: + wxUniChar& operator=(const wxUniCharRef& c); + wxUniChar& operator=(char c) { m_value = From8bit(c); return *this; } + wxUniChar& operator=(unsigned char c) { m_value = From8bit((char)c); return *this; } + +#define wxUNICHAR_DEFINE_OPERATOR_EQUAL(type) \ + wxUniChar& operator=(type c) { m_value = (value_type)c; return *this; } + wxDO_FOR_INT_TYPES(wxUNICHAR_DEFINE_OPERATOR_EQUAL) +#undef wxUNICHAR_DEFINE_OPERATOR_EQUAL + + // Comparison operators: +#define wxDEFINE_UNICHAR_CMP_WITH_INT(T, op) \ + bool operator op(T c) const { return m_value op (value_type)c; } + + // define the given comparison operator for all the types +#define wxDEFINE_UNICHAR_OPERATOR(op) \ + bool operator op(const wxUniChar& c) const { return m_value op c.m_value; }\ + bool operator op(char c) const { return m_value op From8bit(c); } \ + bool operator op(unsigned char c) const { return m_value op From8bit((char)c); } \ + wxDO_FOR_INT_TYPES_1(wxDEFINE_UNICHAR_CMP_WITH_INT, op) + + wxFOR_ALL_COMPARISONS(wxDEFINE_UNICHAR_OPERATOR) + +#undef wxDEFINE_UNICHAR_OPERATOR +#undef wxDEFINE_UNCHAR_CMP_WITH_INT + + // this is needed for expressions like 'Z'-c + int operator-(const wxUniChar& c) const { return m_value - c.m_value; } + int operator-(char c) const { return m_value - From8bit(c); } + int operator-(unsigned char c) const { return m_value - From8bit((char)c); } + int operator-(wchar_t c) const { return m_value - (value_type)c; } + + +private: + // notice that we implement these functions inline for 7-bit ASCII + // characters purely for performance reasons + static value_type From8bit(char c) + { +#if wxUSE_UNICODE + if ( (unsigned char)c < 0x80 ) + return c; + + return FromHi8bit(c); +#else + return c; +#endif + } + + static char To8bit(value_type c) + { +#if wxUSE_UNICODE + if ( c < 0x80 ) + return wx_truncate_cast(char, c); + + return ToHi8bit(c); +#else + return wx_truncate_cast(char, c); +#endif + } + + // helpers of the functions above called to deal with non-ASCII chars + static value_type FromHi8bit(char c); + static char ToHi8bit(value_type v); + static bool GetAsHi8bit(value_type v, char *c); + +private: + value_type m_value; +}; + + +// Writeable reference to a character in wxString. +// +// This class can be used in the same way wxChar is used, except that changing +// its value updates the underlying string object. +class WXDLLIMPEXP_BASE wxUniCharRef +{ +private: + typedef wxStringImpl::iterator iterator; + + // create the reference +#if wxUSE_UNICODE_UTF8 + wxUniCharRef(wxString& str, iterator pos) : m_str(str), m_pos(pos) {} +#else + wxUniCharRef(iterator pos) : m_pos(pos) {} +#endif + +public: + // NB: we have to make this public, because we don't have wxString + // declaration available here and so can't declare wxString::iterator + // as friend; so at least don't use a ctor but a static function + // that must be used explicitly (this is more than using 'explicit' + // keyword on ctor!): +#if wxUSE_UNICODE_UTF8 + static wxUniCharRef CreateForString(wxString& str, iterator pos) + { return wxUniCharRef(str, pos); } +#else + static wxUniCharRef CreateForString(iterator pos) + { return wxUniCharRef(pos); } +#endif + + wxUniChar::value_type GetValue() const { return UniChar().GetValue(); } + +#if wxUSE_UNICODE_UTF8 + wxUniChar::Utf8CharBuffer AsUTF8() const { return UniChar().AsUTF8(); } +#endif // wxUSE_UNICODE_UTF8 + + bool IsAscii() const { return UniChar().IsAscii(); } + bool GetAsChar(char *c) const { return UniChar().GetAsChar(c); } + + bool IsBMP() const { return UniChar().IsBMP(); } + bool IsSupplementary() const { return UniChar().IsSupplementary(); } + wxUint16 HighSurrogate() const { return UniChar().HighSurrogate(); } + wxUint16 LowSurrogate() const { return UniChar().LowSurrogate(); } + + // Assignment operators: +#if wxUSE_UNICODE_UTF8 + wxUniCharRef& operator=(const wxUniChar& c); +#else + wxUniCharRef& operator=(const wxUniChar& c) { *m_pos = c; return *this; } +#endif + + wxUniCharRef& operator=(const wxUniCharRef& c) + { if (&c != this) *this = c.UniChar(); return *this; } + +#ifdef wxHAS_MEMBER_DEFAULT + wxUniCharRef(const wxUniCharRef&) = default; +#endif + +#define wxUNICHAR_REF_DEFINE_OPERATOR_EQUAL(type) \ + wxUniCharRef& operator=(type c) { return *this = wxUniChar(c); } + wxDO_FOR_CHAR_INT_TYPES(wxUNICHAR_REF_DEFINE_OPERATOR_EQUAL) +#undef wxUNICHAR_REF_DEFINE_OPERATOR_EQUAL + + // Conversions to the same types as wxUniChar is convertible too: +#define wxUNICHAR_REF_DEFINE_OPERATOR_PAREN(type) \ + operator type() const { return UniChar(); } + wxDO_FOR_CHAR_INT_TYPES(wxUNICHAR_REF_DEFINE_OPERATOR_PAREN) +#undef wxUNICHAR_REF_DEFINE_OPERATOR_PAREN + + // see wxUniChar::operator bool etc. for explanation + operator bool() const { return (bool)UniChar(); } + bool operator!() const { return !UniChar(); } + bool operator&&(bool v) const { return UniChar() && v; } + +#define wxDEFINE_UNICHARREF_CMP_WITH_INT(T, op) \ + bool operator op(T c) const { return UniChar() op c; } + + // Comparison operators: +#define wxDEFINE_UNICHARREF_OPERATOR(op) \ + bool operator op(const wxUniCharRef& c) const { return UniChar() op c.UniChar(); }\ + bool operator op(const wxUniChar& c) const { return UniChar() op c; } \ + wxDO_FOR_CHAR_INT_TYPES_1(wxDEFINE_UNICHARREF_CMP_WITH_INT, op) + + wxFOR_ALL_COMPARISONS(wxDEFINE_UNICHARREF_OPERATOR) + +#undef wxDEFINE_UNICHARREF_OPERATOR +#undef wxDEFINE_UNICHARREF_CMP_WITH_INT + + // for expressions like c-'A': + int operator-(const wxUniCharRef& c) const { return UniChar() - c.UniChar(); } + int operator-(const wxUniChar& c) const { return UniChar() - c; } + int operator-(char c) const { return UniChar() - c; } + int operator-(unsigned char c) const { return UniChar() - c; } + int operator-(wchar_t c) const { return UniChar() - c; } + +private: +#if wxUSE_UNICODE_UTF8 + wxUniChar UniChar() const; +#else + wxUniChar UniChar() const { return *m_pos; } +#endif + + friend class WXDLLIMPEXP_FWD_BASE wxUniChar; + +private: + // reference to the string and pointer to the character in string +#if wxUSE_UNICODE_UTF8 + wxString& m_str; +#endif + iterator m_pos; +}; + +inline wxUniChar::wxUniChar(const wxUniCharRef& c) +{ + m_value = c.UniChar().m_value; +} + +inline wxUniChar& wxUniChar::operator=(const wxUniCharRef& c) +{ + m_value = c.UniChar().m_value; + return *this; +} + +// wxUniCharRef doesn't behave quite like a reference, notably because template +// deduction from wxUniCharRef doesn't yield wxUniChar as would have been the +// case if it were a real reference. This results in a number of problems and +// we can't fix all of them but we can at least provide a working swap() for +// it, instead of the default version which doesn't work because a "wrong" type +// is deduced. +namespace std +{ + +template <> +inline +void swap<wxUniCharRef>(wxUniCharRef& lhs, wxUniCharRef& rhs) +{ + if ( &lhs != &rhs ) + { + // The use of wxUniChar here is the crucial difference: in the default + // implementation, tmp would be wxUniCharRef and so assigning to lhs + // would modify it too. Here we make a real copy, not affected by + // changing lhs, instead. + wxUniChar tmp = lhs; + lhs = rhs; + rhs = tmp; + } +} + +} // namespace std + +#if __cplusplus >= 201103L || wxCHECK_VISUALC_VERSION(10) + +// For std::iter_swap() to work with wxString::iterator, which uses +// wxUniCharRef as its reference type, we need to ensure that swap() works with +// wxUniCharRef objects by defining this overload. +// +// See https://bugs.llvm.org/show_bug.cgi?id=28559#c9 +inline +void swap(wxUniCharRef&& lhs, wxUniCharRef&& rhs) +{ + wxUniChar tmp = lhs; + lhs = rhs; + rhs = tmp; +} + +#endif // C++11 + + +// Comparison operators for the case when wxUniChar(Ref) is the second operand +// implemented in terms of member comparison functions + +wxDEFINE_COMPARISONS_BY_REV(char, const wxUniChar&) +wxDEFINE_COMPARISONS_BY_REV(char, const wxUniCharRef&) + +wxDEFINE_COMPARISONS_BY_REV(wchar_t, const wxUniChar&) +wxDEFINE_COMPARISONS_BY_REV(wchar_t, const wxUniCharRef&) + +wxDEFINE_COMPARISONS_BY_REV(const wxUniChar&, const wxUniCharRef&) + +// for expressions like c-'A': +inline int operator-(char c1, const wxUniCharRef& c2) { return -(c2 - c1); } +inline int operator-(const wxUniChar& c1, const wxUniCharRef& c2) { return -(c2 - c1); } +inline int operator-(wchar_t c1, const wxUniCharRef& c2) { return -(c2 - c1); } + +#endif /* _WX_UNICHAR_H_ */ diff --git a/lib/wxWidgets/include/wx/univ/anybutton.h b/lib/wxWidgets/include/wx/univ/anybutton.h new file mode 100644 index 0000000..58259dd --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/anybutton.h @@ -0,0 +1,89 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/anybutton.h +// Purpose: wxAnyButton class +// Author: Vadim Zeitlin +// Created: 2000-08-15 (extracted from button.h) +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_ANYBUTTON_H_ +#define _WX_UNIV_ANYBUTTON_H_ +#include "wx/univ/inphand.h" +// ---------------------------------------------------------------------------- +// Common button functionality +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxAnyButton : public wxAnyButtonBase +{ +public: + wxAnyButton() {} + + virtual ~wxAnyButton() {} + + // wxAnyButton actions + virtual void Toggle(); + virtual void Press(); + virtual void Release(); + virtual void Click(){} + + virtual bool PerformAction(const wxControlAction& action, + long numArg = -1, + const wxString& strArg = wxEmptyString) wxOVERRIDE; + + static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) wxOVERRIDE + { + return GetStdInputHandler(handlerDef); + } + +protected: + // choose the default border for this window + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_STATIC; } + + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + + virtual bool DoDrawBackground(wxDC& dc) wxOVERRIDE; + virtual void DoDraw(wxControlRenderer *renderer) wxOVERRIDE; + // current state + bool m_isPressed, + m_isDefault; + + // the (optional) image to show and the margins around it + wxBitmap m_bitmap; + wxCoord m_marginBmpX, + m_marginBmpY; + +private: + wxDECLARE_NO_COPY_CLASS(wxAnyButton); +}; + +// ---------------------------------------------------------------------------- +// wxStdAnyButtonInputHandler: translates SPACE and ENTER keys and the left mouse +// click into button press/release actions +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxStdAnyButtonInputHandler : public wxStdInputHandler +{ +public: + wxStdAnyButtonInputHandler(wxInputHandler *inphand); + + virtual bool HandleKey(wxInputConsumer *consumer, + const wxKeyEvent& event, + bool pressed) wxOVERRIDE; + virtual bool HandleMouse(wxInputConsumer *consumer, + const wxMouseEvent& event) wxOVERRIDE; + virtual bool HandleMouseMove(wxInputConsumer *consumer, + const wxMouseEvent& event) wxOVERRIDE; + virtual bool HandleFocus(wxInputConsumer *consumer, + const wxFocusEvent& event) wxOVERRIDE; + virtual bool HandleActivation(wxInputConsumer *consumer, bool activated) wxOVERRIDE; + +private: + // the window (button) which has capture or NULL and the flag telling if + // the mouse is inside the button which captured it or not + wxWindow *m_winCapture; + bool m_winHasMouse; +}; + +#endif // _WX_UNIV_ANYBUTTON_H_ diff --git a/lib/wxWidgets/include/wx/univ/app.h b/lib/wxWidgets/include/wx/univ/app.h new file mode 100644 index 0000000..2d946d5 --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/app.h @@ -0,0 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/app.h +// Purpose: wxUniversalApp class extends wxApp for wxUniv port +// Author: Vadim Zeitlin +// Modified by: +// Created: 06.08.00 +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_APP_H_ +#define _WX_UNIX_APP_H_ + +class WXDLLIMPEXP_CORE wxUniversalApp : public wxApp +{ +public: +}; + +#endif // _WX_UNIX_APP_H_ + diff --git a/lib/wxWidgets/include/wx/univ/bmpbuttn.h b/lib/wxWidgets/include/wx/univ/bmpbuttn.h new file mode 100644 index 0000000..052a6d4 --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/bmpbuttn.h @@ -0,0 +1,76 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/bmpbuttn.h +// Purpose: wxBitmapButton class for wxUniversal +// Author: Vadim Zeitlin +// Modified by: +// Created: 25.08.00 +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_BMPBUTTN_H_ +#define _WX_UNIV_BMPBUTTN_H_ + +class WXDLLIMPEXP_CORE wxBitmapButton : public wxBitmapButtonBase +{ +public: + wxBitmapButton() { } + + wxBitmapButton(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)) + { + Create(parent, id, bitmap, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)); + + bool CreateCloseButton(wxWindow* parent, + wxWindowID winid, + const wxString& name = wxString()); + + + virtual void SetMargins(int x, int y) wxOVERRIDE + { + SetBitmapMargins(x, y); + + wxBitmapButtonBase::SetMargins(x, y); + } + + virtual bool Enable(bool enable = true) wxOVERRIDE; + + virtual bool SetCurrent(bool doit = true) wxOVERRIDE; + + virtual void Press() wxOVERRIDE; + virtual void Release() wxOVERRIDE; + +protected: + void OnSetFocus(wxFocusEvent& event); + void OnKillFocus(wxFocusEvent& event); + + // called when one of the bitmap is changed by user + virtual void OnSetBitmap() wxOVERRIDE; + + // set bitmap to the given one if it's ok or to the normal bitmap and + // return true if the bitmap really changed + bool ChangeBitmap(const wxBitmap& bmp); + +private: + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxBitmapButton); +}; + +#endif // _WX_UNIV_BMPBUTTN_H_ + diff --git a/lib/wxWidgets/include/wx/univ/button.h b/lib/wxWidgets/include/wx/univ/button.h new file mode 100644 index 0000000..89b40da --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/button.h @@ -0,0 +1,110 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/button.h +// Purpose: wxButton for wxUniversal +// Author: Vadim Zeitlin +// Modified by: +// Created: 15.08.00 +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_BUTTON_H_ +#define _WX_UNIV_BUTTON_H_ + +// ---------------------------------------------------------------------------- +// the actions supported by this control +// ---------------------------------------------------------------------------- +//checkbox.cpp needed it, so not move it to anybutton.h +#define wxACTION_BUTTON_TOGGLE wxT("toggle") // press/release the button +#define wxACTION_BUTTON_PRESS wxT("press") // press the button +#define wxACTION_BUTTON_RELEASE wxT("release") // release the button +#define wxACTION_BUTTON_CLICK wxT("click") // generate button click event + +// ---------------------------------------------------------------------------- +// wxButton: a push button +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxButton : public wxButtonBase +{ +public: + wxButton() { Init(); } + wxButton(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& bitmap, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)) + { + Init(); + + Create(parent, id, bitmap, label, pos, size, style, validator, name); + } + + wxButton(wxWindow *parent, + wxWindowID id, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)) + { + Init(); + + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)) + { + return Create(parent, id, wxNullBitmap, label, + pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& bitmap, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxButtonNameStr)); + + virtual ~wxButton(); + + virtual wxWindow *SetDefault() wxOVERRIDE; + + virtual bool IsPressed() const wxOVERRIDE { return m_isPressed; } + virtual bool IsDefault() const wxOVERRIDE { return m_isDefault; } + + // wxButton actions + virtual void Click() wxOVERRIDE; + + virtual bool CanBeHighlighted() const wxOVERRIDE { return true; } + + + +protected: + virtual void DoSetBitmap(const wxBitmapBundle& bitmap, State which) wxOVERRIDE; + virtual wxBitmap DoGetBitmap(State which) const wxOVERRIDE; + virtual void DoSetBitmapMargins(wxCoord x, wxCoord y) wxOVERRIDE; + + // common part of all ctors + void Init(); + +private: + wxDECLARE_DYNAMIC_CLASS(wxButton); +}; + +#endif // _WX_UNIV_BUTTON_H_ + diff --git a/lib/wxWidgets/include/wx/univ/checkbox.h b/lib/wxWidgets/include/wx/univ/checkbox.h new file mode 100644 index 0000000..f1b4c79 --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/checkbox.h @@ -0,0 +1,149 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/checkbox.h +// Purpose: wxCheckBox declaration +// Author: Vadim Zeitlin +// Modified by: +// Created: 07.09.00 +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_CHECKBOX_H_ +#define _WX_UNIV_CHECKBOX_H_ + +#include "wx/button.h" // for wxStdButtonInputHandler + +// ---------------------------------------------------------------------------- +// the actions supported by wxCheckBox +// ---------------------------------------------------------------------------- + +#define wxACTION_CHECKBOX_CHECK wxT("check") // SetValue(true) +#define wxACTION_CHECKBOX_CLEAR wxT("clear") // SetValue(false) +#define wxACTION_CHECKBOX_TOGGLE wxT("toggle") // toggle the check state + +// additionally it accepts wxACTION_BUTTON_PRESS and RELEASE + +// ---------------------------------------------------------------------------- +// wxCheckBox +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxCheckBox : public wxCheckBoxBase +{ +public: + // checkbox constants + enum State + { + State_Normal, + State_Pressed, + State_Disabled, + State_Current, + State_Max + }; + + enum Status + { + Status_Checked, + Status_Unchecked, + Status_3rdState, + Status_Max + }; + + // constructors + wxCheckBox() { Init(); } + + wxCheckBox(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)) + { + Init(); + + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)); + + // implement the checkbox interface + virtual void SetValue(bool value) wxOVERRIDE; + virtual bool GetValue() const wxOVERRIDE; + + // set/get the bitmaps to use for the checkbox indicator + void SetBitmap(const wxBitmap& bmp, State state, Status status); + virtual wxBitmap GetBitmap(State state, Status status) const; + + // wxCheckBox actions + void Toggle(); + virtual void Press(); + virtual void Release(); + virtual void ChangeValue(bool value); + + // overridden base class virtuals + virtual bool IsPressed() const wxOVERRIDE { return m_isPressed; } + + virtual bool PerformAction(const wxControlAction& action, + long numArg = -1, + const wxString& strArg = wxEmptyString) wxOVERRIDE; + + virtual bool CanBeHighlighted() const wxOVERRIDE { return true; } + virtual wxInputHandler *CreateStdInputHandler(wxInputHandler *handlerDef); + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) wxOVERRIDE + { + return CreateStdInputHandler(handlerDef); + } + +protected: + virtual void DoSet3StateValue(wxCheckBoxState WXUNUSED(state)) wxOVERRIDE; + virtual wxCheckBoxState DoGet3StateValue() const wxOVERRIDE; + + virtual void DoDraw(wxControlRenderer *renderer) wxOVERRIDE; + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + + // get the size of the bitmap using either the current one or the default + // one (query renderer then) + virtual wxSize GetBitmapSize() const; + + // common part of all ctors + void Init(); + + // send command event notifying about the checkbox state change + virtual void SendEvent(); + + // called when the checkbox becomes checked - radio button hook + virtual void OnCheck(); + + // get the state corresponding to the flags (combination of wxCONTROL_XXX) + wxCheckBox::State GetState(int flags) const; + + // directly access the bitmaps array without trying to find a valid bitmap + // to use as GetBitmap() does + wxBitmap DoGetBitmap(State state, Status status) const + { return m_bitmaps[state][status]; } + + // get the current status + Status GetStatus() const { return m_status; } + +private: + // the current check status + Status m_status; + + // the bitmaps to use for the different states + wxBitmap m_bitmaps[State_Max][Status_Max]; + + // is the checkbox currently pressed? + bool m_isPressed; + + wxDECLARE_DYNAMIC_CLASS(wxCheckBox); +}; + +#endif // _WX_UNIV_CHECKBOX_H_ diff --git a/lib/wxWidgets/include/wx/univ/checklst.h b/lib/wxWidgets/include/wx/univ/checklst.h new file mode 100644 index 0000000..f93be1e --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/checklst.h @@ -0,0 +1,110 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/checklst.h +// Purpose: wxCheckListBox class for wxUniversal +// Author: Vadim Zeitlin +// Modified by: +// Created: 12.09.00 +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_CHECKLST_H_ +#define _WX_UNIV_CHECKLST_H_ + +// ---------------------------------------------------------------------------- +// actions +// ---------------------------------------------------------------------------- + +#define wxACTION_CHECKLISTBOX_TOGGLE wxT("toggle") + +// ---------------------------------------------------------------------------- +// wxCheckListBox +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxCheckListBox : public wxCheckListBoxBase +{ +public: + // ctors + wxCheckListBox() { Init(); } + + wxCheckListBox(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int nStrings = 0, + const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)) + { + Init(); + + Create(parent, id, pos, size, nStrings, choices, style, validator, name); + } + wxCheckListBox(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int nStrings = 0, + const wxString choices[] = (const wxString *) NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + + // implement check list box methods + virtual bool IsChecked(unsigned int item) const wxOVERRIDE; + virtual void Check(unsigned int item, bool check = true) wxOVERRIDE; + + // and input handling + virtual bool PerformAction(const wxControlAction& action, + long numArg = -1l, + const wxString& strArg = wxEmptyString) wxOVERRIDE; + + static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) wxOVERRIDE + { + return GetStdInputHandler(handlerDef); + } + +protected: + // override all methods which add/delete items to update m_checks array as + // well + virtual void OnItemInserted(unsigned int pos) wxOVERRIDE; + virtual void DoDeleteOneItem(unsigned int n) wxOVERRIDE; + virtual void DoClear() wxOVERRIDE; + + // draw the check items instead of the usual ones + virtual void DoDrawRange(wxControlRenderer *renderer, + int itemFirst, int itemLast) wxOVERRIDE; + + // take them also into account for size calculation + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + + // common part of all ctors + void Init(); + +private: + // the array containing the checked status of the items + wxArrayInt m_checks; + + wxDECLARE_DYNAMIC_CLASS(wxCheckListBox); +}; + +#endif // _WX_UNIV_CHECKLST_H_ diff --git a/lib/wxWidgets/include/wx/univ/chkconf.h b/lib/wxWidgets/include/wx/univ/chkconf.h new file mode 100644 index 0000000..eda4353 --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/chkconf.h @@ -0,0 +1,127 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/chkconf.h +// Purpose: wxUniversal-specific configuration options checks +// Author: Vadim Zeitlin +// Created: 2006-09-28 (extracted from wx/chkconf.h) +// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_CHKCONF_H_ +#define _WX_UNIV_CHKCONF_H_ + +#if wxUSE_OWNER_DRAWN + /* + It is not clear if owner-drawn code makes much sense for wxUniv in the + first place but in any case it doesn't link currently (at least under + wxMSW but probably elsewhere too) as there is no wxUniv-specific + wxOwnerDrawnBase implementation so disable it for now. + */ + #undef wxUSE_OWNER_DRAWN + #define wxUSE_OWNER_DRAWN 0 +#endif /* wxUSE_OWNER_DRAWN */ + +#if (wxUSE_COMBOBOX || wxUSE_MENUS) && !wxUSE_POPUPWIN +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_POPUPWIN must be defined to use comboboxes/menus" +# else +# undef wxUSE_POPUPWIN +# define wxUSE_POPUPWIN 1 +# endif +#endif + +#if wxUSE_COMBOBOX +# if !wxUSE_LISTBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxComboBox requires wxListBox in wxUniversal" +# else +# undef wxUSE_LISTBOX +# define wxUSE_LISTBOX 1 +# endif +# endif +#endif /* wxUSE_COMBOBOX */ + +#if wxUSE_RADIOBTN +# if !wxUSE_CHECKBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_RADIOBTN requires wxUSE_CHECKBOX in wxUniversal" +# else +# undef wxUSE_CHECKBOX +# define wxUSE_CHECKBOX 1 +# endif +# endif +#endif /* wxUSE_RADIOBTN */ + +#if wxUSE_TEXTCTRL +# if !wxUSE_CARET +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxTextCtrl requires wxCaret in wxUniversal" +# else +# undef wxUSE_CARET +# define wxUSE_CARET 1 +# endif +# endif /* wxUSE_CARET */ + +# if !wxUSE_SCROLLBAR +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxTextCtrl requires wxScrollBar in wxUniversal" +# else +# undef wxUSE_SCROLLBAR +# define wxUSE_SCROLLBAR 1 +# endif +# endif /* wxUSE_SCROLLBAR */ +#endif /* wxUSE_TEXTCTRL */ + + +/* Themes checks */ +#ifndef wxUSE_ALL_THEMES +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ALL_THEMES must be defined" +# else +# define wxUSE_ALL_THEMES 1 +# endif +#endif /* wxUSE_ALL_THEMES */ + +#ifndef wxUSE_THEME_GTK +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_THEME_GTK must be defined" +# else +# define wxUSE_THEME_GTK 1 +# endif +#endif /* wxUSE_THEME_GTK */ + +#ifndef wxUSE_THEME_METAL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_THEME_METAL must be defined" +# else +# define wxUSE_THEME_METAL 1 +# endif +#endif /* wxUSE_THEME_METAL */ + +#ifndef wxUSE_THEME_MONO +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_THEME_MONO must be defined" +# else +# define wxUSE_THEME_MONO 1 +# endif +#endif /* wxUSE_THEME_MONO */ + +#ifndef wxUSE_THEME_WIN32 +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_THEME_WIN32 must be defined" +# else +# define wxUSE_THEME_WIN32 1 +# endif +#endif /* wxUSE_THEME_WIN32 */ + +#if !wxUSE_ALL_THEMES && wxUSE_THEME_METAL && !wxUSE_THEME_WIN32 +# ifdef wxABORT_ON_CONFIG_ERROR +# error "Metal theme requires Win32 one" +# else +# undef wxUSE_THEME_WIN32 +# define wxUSE_THEME_WIN32 1 +# endif +#endif /* wxUSE_THEME_METAL && !wxUSE_THEME_WIN32 */ + +#endif /* _WX_UNIV_CHKCONF_H_ */ + diff --git a/lib/wxWidgets/include/wx/univ/choice.h b/lib/wxWidgets/include/wx/univ/choice.h new file mode 100644 index 0000000..512e317 --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/choice.h @@ -0,0 +1,63 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/choice.h +// Purpose: the universal choice +// Author: Vadim Zeitlin +// Modified by: +// Created: 30.08.00 +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_CHOICE_H_ +#define _WX_UNIV_CHOICE_H_ + +#include "wx/combobox.h" + +// VS: This is only a *temporary* implementation, real wxChoice should not +// derive from wxComboBox and may have different l&f +class WXDLLIMPEXP_CORE wxChoice : public wxComboBox +{ +public: + wxChoice() {} + wxChoice(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = (const wxString *) NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr)) + { + Create(parent, id, pos, size, n, choices, style, validator, name); + } + wxChoice(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr)); + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr)); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxChoiceNameStr)); + +private: + void OnComboBox(wxCommandEvent &event); + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxChoice); +}; + + +#endif // _WX_UNIV_CHOICE_H_ diff --git a/lib/wxWidgets/include/wx/univ/colschem.h b/lib/wxWidgets/include/wx/univ/colschem.h new file mode 100644 index 0000000..5c5ea7c --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/colschem.h @@ -0,0 +1,102 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/colschem.h +// Purpose: wxColourScheme class provides the colours to use for drawing +// Author: Vadim Zeitlin +// Modified by: +// Created: 19.08.00 +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_COLSCHEM_H_ +#define _WX_UNIV_COLSCHEM_H_ + +class WXDLLIMPEXP_FWD_CORE wxWindow; + +#include "wx/colour.h" +#include "wx/checkbox.h" + +// ---------------------------------------------------------------------------- +// wxColourScheme +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxColourScheme +{ +public: + // the standard colours + enum StdColour + { + // the background colour for a window + WINDOW, + + // the different background and text colours for the control + CONTROL, + CONTROL_PRESSED, + CONTROL_CURRENT, + + // the label text for the normal and the disabled state + CONTROL_TEXT, + CONTROL_TEXT_DISABLED, + CONTROL_TEXT_DISABLED_SHADOW, + + // the scrollbar background colour for the normal and pressed states + SCROLLBAR, + SCROLLBAR_PRESSED, + + // the background and text colour for the highlighted item + HIGHLIGHT, + HIGHLIGHT_TEXT, + + // these colours are used for drawing the shadows of 3D objects + SHADOW_DARK, + SHADOW_HIGHLIGHT, + SHADOW_IN, + SHADOW_OUT, + + // the titlebar background colours for the normal and focused states + TITLEBAR, + TITLEBAR_ACTIVE, + + // the titlebar text colours + TITLEBAR_TEXT, + TITLEBAR_ACTIVE_TEXT, + + // the default gauge fill colour + GAUGE, + + // desktop background colour (only used by framebuffer ports) + DESKTOP, + + // wxFrame's background colour + FRAME, + + MAX + }; + + // get a standard colour + virtual wxColour Get(StdColour col) const = 0; + + // get the background colour for the given window + virtual wxColour GetBackground(wxWindow *win) const = 0; + + // virtual dtor for any base class + virtual ~wxColourScheme() {} +}; + +// some people just can't spell it correctly :-) +typedef wxColourScheme wxColorScheme; + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +// retrieve the default colour from the theme or the given scheme +#define wxSCHEME_COLOUR(scheme, what) scheme->Get(wxColorScheme::what) +#define wxTHEME_COLOUR(what) \ + wxSCHEME_COLOUR(wxTheme::Get()->GetColourScheme(), what) + +// get the background colour for the window in the current theme +#define wxTHEME_BG_COLOUR(win) \ + wxTheme::Get()->GetColourScheme()->GetBackground(win) + +#endif // _WX_UNIV_COLSCHEM_H_ diff --git a/lib/wxWidgets/include/wx/univ/combobox.h b/lib/wxWidgets/include/wx/univ/combobox.h new file mode 100644 index 0000000..22a7f16 --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/combobox.h @@ -0,0 +1,192 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/combobox.h +// Purpose: the universal combobox +// Author: Vadim Zeitlin +// Modified by: +// Created: 30.08.00 +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + + +#ifndef _WX_UNIV_COMBOBOX_H_ +#define _WX_UNIV_COMBOBOX_H_ + +#include "wx/combo.h" + +class WXDLLIMPEXP_FWD_CORE wxListBox; + +// ---------------------------------------------------------------------------- +// NB: some actions supported by this control are in wx/generic/combo.h +// ---------------------------------------------------------------------------- + +// choose the next/prev/specified (by numArg) item +#define wxACTION_COMBOBOX_SELECT_NEXT wxT("next") +#define wxACTION_COMBOBOX_SELECT_PREV wxT("prev") +#define wxACTION_COMBOBOX_SELECT wxT("select") + + +// ---------------------------------------------------------------------------- +// wxComboBox: a combination of text control and a listbox +// ---------------------------------------------------------------------------- + +// NB: Normally we'd like wxComboBox to inherit from wxComboBoxBase, but here +// we can't really do that since both wxComboBoxBase and wxComboCtrl inherit +// from wxTextCtrl. +class WXDLLIMPEXP_CORE wxComboBox : + public wxWindowWithItems<wxComboCtrl, wxItemContainer> +{ +public: + // ctors and such + wxComboBox() { Init(); } + + wxComboBox(wxWindow *parent, + wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, + const wxString choices[] = (const wxString *) NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)) + { + Init(); + + (void)Create(parent, id, value, pos, size, n, choices, + style, validator, name); + } + wxComboBox(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, + const wxString choices[] = (const wxString *) NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)); + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxComboBoxNameStr)); + + virtual ~wxComboBox(); + + // the wxUniversal-specific methods + // -------------------------------- + + // implement the combobox interface + + // wxTextCtrl methods + virtual wxString GetValue() const wxOVERRIDE { return DoGetValue(); } + virtual void SetValue(const wxString& value) wxOVERRIDE; + virtual void WriteText(const wxString& value) wxOVERRIDE; + virtual void Copy() wxOVERRIDE; + virtual void Cut() wxOVERRIDE; + virtual void Paste() wxOVERRIDE; + virtual void SetInsertionPoint(long pos) wxOVERRIDE; + virtual void SetInsertionPointEnd() wxOVERRIDE; + virtual long GetInsertionPoint() const wxOVERRIDE; + virtual wxTextPos GetLastPosition() const wxOVERRIDE; + virtual void Replace(long from, long to, const wxString& value) wxOVERRIDE; + virtual void Remove(long from, long to) wxOVERRIDE; + virtual void SetSelection(long from, long to) wxOVERRIDE; + virtual void GetSelection(long *from, long *to) const wxOVERRIDE; + virtual void SetEditable(bool editable) wxOVERRIDE; + virtual bool IsEditable() const wxOVERRIDE; + + virtual void Undo() wxOVERRIDE; + virtual void Redo() wxOVERRIDE; + virtual void SelectAll() wxOVERRIDE; + + virtual bool CanCopy() const wxOVERRIDE; + virtual bool CanCut() const wxOVERRIDE; + virtual bool CanPaste() const wxOVERRIDE; + virtual bool CanUndo() const wxOVERRIDE; + virtual bool CanRedo() const wxOVERRIDE; + + // override these methods to disambiguate between two base classes versions + virtual void Clear() wxOVERRIDE + { + wxItemContainer::Clear(); + } + + // See wxComboBoxBase discussion of IsEmpty(). + bool IsListEmpty() const { return wxItemContainer::IsEmpty(); } + bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); } + + // wxControlWithItems methods + virtual void DoClear() wxOVERRIDE; + virtual void DoDeleteOneItem(unsigned int n) wxOVERRIDE; + virtual unsigned int GetCount() const wxOVERRIDE; + virtual wxString GetString(unsigned int n) const wxOVERRIDE; + virtual void SetString(unsigned int n, const wxString& s) wxOVERRIDE; + virtual int FindString(const wxString& s, bool bCase = false) const wxOVERRIDE; + virtual void SetSelection(int n) wxOVERRIDE; + virtual int GetSelection() const wxOVERRIDE; + virtual wxString GetStringSelection() const wxOVERRIDE; + + // we have our own input handler and our own actions + // (but wxComboCtrl already handled Popup/Dismiss) + /* + virtual bool PerformAction(const wxControlAction& action, + long numArg = 0l, + const wxString& strArg = wxEmptyString); + */ + + static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) wxOVERRIDE + { + return GetStdInputHandler(handlerDef); + } + + // we delegate our client data handling to wxListBox which we use for the + // items, so override this and other methods dealing with the client data + virtual wxClientDataType GetClientDataType() const wxOVERRIDE; + virtual void SetClientDataType(wxClientDataType clientDataItemsType) wxOVERRIDE; + + virtual const wxTextEntry* WXGetTextEntry() const wxOVERRIDE { return this; } + +protected: + virtual int DoInsertItems(const wxArrayStringsAdapter& items, + unsigned int pos, + void **clientData, wxClientDataType type) wxOVERRIDE; + + virtual void DoSetItemClientData(unsigned int n, void* clientData) wxOVERRIDE; + virtual void* DoGetItemClientData(unsigned int n) const wxOVERRIDE; + + + // common part of all ctors + void Init(); + + // get the associated listbox + wxListBox *GetLBox() const { return m_lbox; } + +private: + // implement wxTextEntry pure virtual method + virtual wxWindow *GetEditableWindow() wxOVERRIDE { return this; } + + // the popup listbox + wxListBox *m_lbox; + + //wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxComboBox); +}; + +#endif // _WX_UNIV_COMBOBOX_H_ diff --git a/lib/wxWidgets/include/wx/univ/control.h b/lib/wxWidgets/include/wx/univ/control.h new file mode 100644 index 0000000..f6b4f66 --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/control.h @@ -0,0 +1,106 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/control.h +// Purpose: universal wxControl: adds handling of mnemonics +// Author: Vadim Zeitlin +// Modified by: +// Created: 14.08.00 +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_CONTROL_H_ +#define _WX_UNIV_CONTROL_H_ + +class WXDLLIMPEXP_FWD_CORE wxControlRenderer; +class WXDLLIMPEXP_FWD_CORE wxInputHandler; +class WXDLLIMPEXP_FWD_CORE wxRenderer; + +// we must include it as most/all control classes derive their handlers from +// it +#include "wx/univ/inphand.h" + +#include "wx/univ/inpcons.h" + +// ---------------------------------------------------------------------------- +// wxControlAction: the action is currently just a string which identifies it, +// later it might become an atom (i.e. an opaque handler to string). +// ---------------------------------------------------------------------------- + +typedef wxString wxControlAction; + +// the list of actions which apply to all controls (other actions are defined +// in the controls headers) + +#define wxACTION_NONE wxT("") // no action to perform + +// ---------------------------------------------------------------------------- +// wxControl: the base class for all GUI controls +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxControl : public wxControlBase, public wxInputConsumer +{ +public: + wxControl() { Init(); } + + wxControl(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxControlNameStr)) + { + Init(); + + Create(parent, id, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxControlNameStr)); + + // this function will filter out '&' characters and will put the + // accelerator char (the one immediately after '&') into m_chAccel + virtual void SetLabel(const wxString& label) wxOVERRIDE; + + // return the current label + virtual wxString GetLabel() const wxOVERRIDE { return wxControlBase::GetLabel(); } + + // wxUniversal-specific methods + + // return the index of the accel char in the label or -1 if none + int GetAccelIndex() const { return m_indexAccel; } + + // return the accel char itself or 0 if none + wxChar GetAccelChar() const + { + return m_indexAccel == -1 ? wxT('\0') : (wxChar)m_label[m_indexAccel]; + } + + virtual wxWindow *GetInputWindow() const wxOVERRIDE + { + return const_cast<wxControl*>(this); + } + +protected: + // common part of all ctors + void Init(); + + // set m_label and m_indexAccel and refresh the control to show the new + // label (but, unlike SetLabel(), don't call the base class SetLabel() thus + // avoiding to change wxControlBase::m_labelOrig) + void UnivDoSetLabel(const wxString& label); + +private: + // label and accel info + wxString m_label; + int m_indexAccel; + + wxDECLARE_DYNAMIC_CLASS(wxControl); + wxDECLARE_EVENT_TABLE(); + WX_DECLARE_INPUT_CONSUMER() +}; + +#endif // _WX_UNIV_CONTROL_H_ diff --git a/lib/wxWidgets/include/wx/univ/custombgwin.h b/lib/wxWidgets/include/wx/univ/custombgwin.h new file mode 100644 index 0000000..64ebf0c --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/custombgwin.h @@ -0,0 +1,36 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/custombgwin.h +// Purpose: wxUniv implementation of wxCustomBackgroundWindow. +// Author: Vadim Zeitlin +// Created: 2011-10-10 +// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_CUSTOMBGWIN_H_ +#define _WX_UNIV_CUSTOMBGWIN_H_ + +// ---------------------------------------------------------------------------- +// wxCustomBackgroundWindow +// ---------------------------------------------------------------------------- + +template <class W> +class wxCustomBackgroundWindow : public W, + public wxCustomBackgroundWindowBase +{ +public: + typedef W BaseWindowClass; + + wxCustomBackgroundWindow() { } + +protected: + virtual void DoSetBackgroundBitmap(const wxBitmap& bmp) wxOVERRIDE + { + // We have support for background bitmap even at the base class level. + BaseWindowClass::SetBackground(bmp, wxALIGN_NOT, wxTILE); + } + + wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxCustomBackgroundWindow, W); +}; + +#endif // _WX_UNIV_CUSTOMBGWIN_H_ diff --git a/lib/wxWidgets/include/wx/univ/dialog.h b/lib/wxWidgets/include/wx/univ/dialog.h new file mode 100644 index 0000000..fa79b88 --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/dialog.h @@ -0,0 +1,87 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/dialog.h +// Purpose: wxDialog class +// Author: Vaclav Slavik +// Created: 2001/09/16 +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_DIALOG_H_ +#define _WX_UNIV_DIALOG_H_ + +extern WXDLLIMPEXP_DATA_CORE(const char) wxDialogNameStr[]; +class WXDLLIMPEXP_FWD_CORE wxWindowDisabler; +class WXDLLIMPEXP_FWD_CORE wxEventLoop; + +// Dialog boxes +class WXDLLIMPEXP_CORE wxDialog : public wxDialogBase +{ +public: + wxDialog() { Init(); } + + // Constructor with no modal flag - the new convention. + wxDialog(wxWindow *parent, wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxASCII_STR(wxDialogNameStr)) + { + Init(); + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxASCII_STR(wxDialogNameStr)); + + virtual ~wxDialog(); + + // is the dialog in modal state right now? + virtual bool IsModal() const wxOVERRIDE; + + // For now, same as Show(true) but returns return code + virtual int ShowModal() wxOVERRIDE; + + // may be called to terminate the dialog with the given return code + virtual void EndModal(int retCode) wxOVERRIDE; + + // returns true if we're in a modal loop + bool IsModalShowing() const; + + virtual bool Show(bool show = true) wxOVERRIDE; + + // implementation only from now on + // ------------------------------- + + // event handlers + void OnCloseWindow(wxCloseEvent& event); + void OnOK(wxCommandEvent& event); + void OnApply(wxCommandEvent& event); + void OnCancel(wxCommandEvent& event); + +protected: + // common part of all ctors + void Init(); + +private: + // while we are showing a modal dialog we disable the other windows using + // this object + wxWindowDisabler *m_windowDisabler; + + // modal dialog runs its own event loop + wxEventLoop *m_eventLoop; + + // is modal right now? + bool m_isShowingModal; + + wxDECLARE_DYNAMIC_CLASS(wxDialog); + wxDECLARE_EVENT_TABLE(); +}; + +#endif + // _WX_UNIV_DIALOG_H_ diff --git a/lib/wxWidgets/include/wx/univ/frame.h b/lib/wxWidgets/include/wx/univ/frame.h new file mode 100644 index 0000000..823e2d9 --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/frame.h @@ -0,0 +1,88 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/frame.h +// Purpose: wxFrame class for wxUniversal +// Author: Vadim Zeitlin +// Modified by: +// Created: 19.05.01 +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_FRAME_H_ +#define _WX_UNIV_FRAME_H_ + +// ---------------------------------------------------------------------------- +// wxFrame +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFrame : public wxFrameBase +{ +public: + wxFrame() {} + wxFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + virtual wxPoint GetClientAreaOrigin() const wxOVERRIDE; + virtual bool Enable(bool enable = true) wxOVERRIDE; + +#if wxUSE_STATUSBAR + virtual wxStatusBar* CreateStatusBar(int number = 1, + long style = wxSTB_DEFAULT_STYLE, + wxWindowID id = 0, + const wxString& name = wxASCII_STR(wxStatusLineNameStr)) wxOVERRIDE; +#endif // wxUSE_STATUSBAR + +#if wxUSE_TOOLBAR + // create main toolbar bycalling OnCreateToolBar() + virtual wxToolBar* CreateToolBar(long style = -1, + wxWindowID id = wxID_ANY, + const wxString& name = wxASCII_STR(wxToolBarNameStr)) wxOVERRIDE; +#endif // wxUSE_TOOLBAR + + virtual wxSize GetMinSize() const wxOVERRIDE; + +protected: + void OnSize(wxSizeEvent& event); + void OnSysColourChanged(wxSysColourChangedEvent& event); + + virtual void DoGetClientSize(int *width, int *height) const wxOVERRIDE; + virtual void DoSetClientSize(int width, int height) wxOVERRIDE; + +#if wxUSE_MENUS + // override to update menu bar position when the frame size changes + virtual void PositionMenuBar() wxOVERRIDE; + virtual void DetachMenuBar() wxOVERRIDE; + virtual void AttachMenuBar(wxMenuBar *menubar) wxOVERRIDE; +#endif // wxUSE_MENUS + +#if wxUSE_STATUSBAR + // override to update statusbar position when the frame size changes + virtual void PositionStatusBar() wxOVERRIDE; +#endif // wxUSE_MENUS + +protected: +#if wxUSE_TOOLBAR + virtual void PositionToolBar() wxOVERRIDE; +#endif // wxUSE_TOOLBAR + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxFrame); +}; + +#endif // _WX_UNIV_FRAME_H_ diff --git a/lib/wxWidgets/include/wx/univ/gauge.h b/lib/wxWidgets/include/wx/univ/gauge.h new file mode 100644 index 0000000..a92ca33 --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/gauge.h @@ -0,0 +1,74 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/gauge.h +// Purpose: wxUniversal wxGauge declaration +// Author: Vadim Zeitlin +// Modified by: +// Created: 20.02.01 +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_GAUGE_H_ +#define _WX_UNIV_GAUGE_H_ + +// ---------------------------------------------------------------------------- +// wxGauge: a progress bar +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGauge : public wxGaugeBase +{ +public: + wxGauge() { Init(); } + + wxGauge(wxWindow *parent, + wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxGaugeNameStr)) + { + Init(); + + (void)Create(parent, id, range, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxGaugeNameStr)); + + // implement base class virtuals + virtual void SetRange(int range) wxOVERRIDE; + virtual void SetValue(int pos) wxOVERRIDE; + + // wxUniv-specific methods + + // is it a smooth progress bar or a discrete one? + bool IsSmooth() const { return (GetWindowStyle() & wxGA_SMOOTH) != 0; } + + // is it a vertica; progress bar or a horizontal one? + bool IsVertical() const { return (GetWindowStyle() & wxGA_VERTICAL) != 0; } + +protected: + // common part of all ctors + void Init(); + + // return the def border for a progress bar + virtual wxBorder GetDefaultBorder() const wxOVERRIDE; + + // return the default size + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + + // draw the control + virtual void DoDraw(wxControlRenderer *renderer) wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxGauge); +}; + +#endif // _WX_UNIV_GAUGE_H_ diff --git a/lib/wxWidgets/include/wx/univ/inpcons.h b/lib/wxWidgets/include/wx/univ/inpcons.h new file mode 100644 index 0000000..033d17b --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/inpcons.h @@ -0,0 +1,152 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/inpcons.h +// Purpose: wxInputConsumer: mix-in class for input handling +// Author: Vadim Zeitlin +// Modified by: +// Created: 14.08.00 +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_INPCONS_H_ +#define _WX_UNIV_INPCONS_H_ + +class WXDLLIMPEXP_FWD_CORE wxInputHandler; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +#include "wx/object.h" +#include "wx/event.h" + +// ---------------------------------------------------------------------------- +// wxControlAction: the action is currently just a string which identifies it, +// later it might become an atom (i.e. an opaque handler to string). +// ---------------------------------------------------------------------------- + +typedef wxString wxControlAction; + +// the list of actions which apply to all controls (other actions are defined +// in the controls headers) + +#define wxACTION_NONE wxT("") // no action to perform + +// ---------------------------------------------------------------------------- +// wxInputConsumer: mix-in class for handling wxControlActions (used by +// wxControl and wxTopLevelWindow). +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxInputConsumer +{ +public: + wxInputConsumer() { m_inputHandler = NULL; } + virtual ~wxInputConsumer() { } + + // get the input handler + wxInputHandler *GetInputHandler() const { return m_inputHandler; } + + // perform a control-dependent action: an action may have an optional + // numeric and another (also optional) string argument whose interpretation + // depends on the action + // + // NB: we might use ellipsis in PerformAction() declaration but this + // wouldn't be more efficient than always passing 2 unused parameters + // but would be more difficult. Another solution would be to have + // several overloaded versions but this will expose the problem of + // virtual function hiding we don't have here. + virtual bool PerformAction(const wxControlAction& action, + long numArg = -1l, + const wxString& strArg = wxEmptyString); + + // get the window to work with (usually the class wxInputConsumer was mixed into) + virtual wxWindow *GetInputWindow() const = 0; + + // this function must be implemented in any classes process input (i.e. not + // static controls) to create the standard input handler for the concrete + // class deriving from this mix-in + // + // the parameter is the default input handler which should receive all + // unprocessed input (i.e. typically handlerDef is passed to + // wxStdInputHandler ctor) or it may be NULL + // + // the returned pointer will not be deleted by caller so it must either + // point to a static object or be deleted on program termination + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef); + + +protected: + // event handlers + void OnMouse(wxMouseEvent& event); + void OnKeyDown(wxKeyEvent& event); + void OnKeyUp(wxKeyEvent& event); + void OnFocus(wxFocusEvent& event); + void OnActivate(wxActivateEvent& event); + + // create input handler by name, fall back to GetStdInputHandler() if + // the current theme doesn't define any specific handler of this type + void CreateInputHandler(const wxString& inphandler); + +private: + // the input processor (we never delete it) + wxInputHandler *m_inputHandler; +}; + + +// ---------------------------------------------------------------------------- +// macros which must be used by the classes derived from wxInputConsumer mix-in +// ---------------------------------------------------------------------------- + +// declare the methods to be forwarded +#define WX_DECLARE_INPUT_CONSUMER() \ +private: \ + void OnMouse(wxMouseEvent& event); \ + void OnKeyDown(wxKeyEvent& event); \ + void OnKeyUp(wxKeyEvent& event); \ + void OnFocus(wxFocusEvent& event); \ +public: /* because of docview :-( */ \ + void OnActivate(wxActivateEvent& event); \ +private: + +// implement the event table entries for wxControlContainer +#define WX_EVENT_TABLE_INPUT_CONSUMER(classname) \ + EVT_KEY_DOWN(classname::OnKeyDown) \ + EVT_KEY_UP(classname::OnKeyUp) \ + EVT_MOUSE_EVENTS(classname::OnMouse) \ + EVT_SET_FOCUS(classname::OnFocus) \ + EVT_KILL_FOCUS(classname::OnFocus) \ + EVT_ACTIVATE(classname::OnActivate) + +// Forward event handlers to wxInputConsumer +// +// (We can't use them directly, because wxIC has virtual methods, which forces +// the compiler to include (at least) two vtables into wxControl, one for the +// wxWindow-wxControlBase-wxControl branch and one for the wxIC mix-in. +// Consequently, the "this" pointer has different value when in wxControl's +// and wxIC's method, even though the instance stays same. This doesn't matter +// so far as member pointers aren't used, but that's not wxControl's case. +// When we add an event table entry (= use a member pointer) pointing to +// wxIC's OnXXX method, GCC compiles code that executes wxIC::OnXXX with the +// version of "this" that belongs to wxControl, not wxIC! In our particular +// case, the effect is that m_handler is NULL (probably same memory +// area as the_other_vtable's_this->m_refObj) and input handling doesn't work.) +#define WX_FORWARD_TO_INPUT_CONSUMER(classname) \ + void classname::OnMouse(wxMouseEvent& event) \ + { \ + wxInputConsumer::OnMouse(event); \ + } \ + void classname::OnKeyDown(wxKeyEvent& event) \ + { \ + wxInputConsumer::OnKeyDown(event); \ + } \ + void classname::OnKeyUp(wxKeyEvent& event) \ + { \ + wxInputConsumer::OnKeyUp(event); \ + } \ + void classname::OnFocus(wxFocusEvent& event) \ + { \ + wxInputConsumer::OnFocus(event); \ + } \ + void classname::OnActivate(wxActivateEvent& event) \ + { \ + wxInputConsumer::OnActivate(event); \ + } + +#endif // _WX_UNIV_INPCONS_H_ diff --git a/lib/wxWidgets/include/wx/univ/inphand.h b/lib/wxWidgets/include/wx/univ/inphand.h new file mode 100644 index 0000000..1affc52 --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/inphand.h @@ -0,0 +1,115 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/inphand.h +// Purpose: wxInputHandler class maps the keyboard and mouse events to the +// actions which then are performed by the control +// Author: Vadim Zeitlin +// Modified by: +// Created: 18.08.00 +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_INPHAND_H_ +#define _WX_UNIV_INPHAND_H_ + +#include "wx/univ/inpcons.h" // for wxControlAction(s) + +// ---------------------------------------------------------------------------- +// types of the standard input handlers which can be passed to +// wxTheme::GetInputHandler() +// ---------------------------------------------------------------------------- + +#define wxINP_HANDLER_DEFAULT wxT("") +#define wxINP_HANDLER_BUTTON wxT("button") +#define wxINP_HANDLER_CHECKBOX wxT("checkbox") +#define wxINP_HANDLER_CHECKLISTBOX wxT("checklistbox") +#define wxINP_HANDLER_COMBOBOX wxT("combobox") +#define wxINP_HANDLER_LISTBOX wxT("listbox") +#define wxINP_HANDLER_NOTEBOOK wxT("notebook") +#define wxINP_HANDLER_RADIOBTN wxT("radiobtn") +#define wxINP_HANDLER_SCROLLBAR wxT("scrollbar") +#define wxINP_HANDLER_SLIDER wxT("slider") +#define wxINP_HANDLER_SPINBTN wxT("spinbtn") +#define wxINP_HANDLER_STATUSBAR wxT("statusbar") +#define wxINP_HANDLER_TEXTCTRL wxT("textctrl") +#define wxINP_HANDLER_TOOLBAR wxT("toolbar") +#define wxINP_HANDLER_TOPLEVEL wxT("toplevel") + +// ---------------------------------------------------------------------------- +// wxInputHandler: maps the events to the actions +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxInputHandler : public wxObject +{ +public: + // map a keyboard event to one or more actions (pressed == true if the key + // was pressed, false if released), returns true if something was done + virtual bool HandleKey(wxInputConsumer *consumer, + const wxKeyEvent& event, + bool pressed) = 0; + + // map a mouse (click) event to one or more actions + virtual bool HandleMouse(wxInputConsumer *consumer, + const wxMouseEvent& event) = 0; + + // handle mouse movement (or enter/leave) event: it is separated from + // HandleMouse() for convenience as many controls don't care about mouse + // movements at all + virtual bool HandleMouseMove(wxInputConsumer *consumer, + const wxMouseEvent& event); + + // do something with focus set/kill event: this is different from + // HandleMouseMove() as the mouse maybe over the control without it having + // focus + // + // return true to refresh the control, false otherwise + virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event); + + // react to the app getting/losing activation + // + // return true to refresh the control, false otherwise + virtual bool HandleActivation(wxInputConsumer *consumer, bool activated); + + // virtual dtor for any base class + virtual ~wxInputHandler(); +}; + +// ---------------------------------------------------------------------------- +// wxStdInputHandler is just a base class for all other "standard" handlers +// and also provides the way to chain input handlers together +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxStdInputHandler : public wxInputHandler +{ +public: + wxStdInputHandler(wxInputHandler *handler) : m_handler(handler) { } + + virtual bool HandleKey(wxInputConsumer *consumer, + const wxKeyEvent& event, + bool pressed) wxOVERRIDE + { + return m_handler ? m_handler->HandleKey(consumer, event, pressed) + : false; + } + + virtual bool HandleMouse(wxInputConsumer *consumer, + const wxMouseEvent& event) wxOVERRIDE + { + return m_handler ? m_handler->HandleMouse(consumer, event) : false; + } + + virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event) wxOVERRIDE + { + return m_handler ? m_handler->HandleMouseMove(consumer, event) : false; + } + + virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event) wxOVERRIDE + { + return m_handler ? m_handler->HandleFocus(consumer, event) : false; + } + +private: + wxInputHandler *m_handler; +}; + +#endif // _WX_UNIV_INPHAND_H_ diff --git a/lib/wxWidgets/include/wx/univ/listbox.h b/lib/wxWidgets/include/wx/univ/listbox.h new file mode 100644 index 0000000..3e4ccd2 --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/listbox.h @@ -0,0 +1,309 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/listbox.h +// Purpose: the universal listbox +// Author: Vadim Zeitlin +// Modified by: +// Created: 30.08.00 +// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_LISTBOX_H_ +#define _WX_UNIV_LISTBOX_H_ + +#include "wx/scrolwin.h" // for wxScrollHelper +#include "wx/dynarray.h" +#include "wx/arrstr.h" + +// ---------------------------------------------------------------------------- +// the actions supported by this control +// ---------------------------------------------------------------------------- + +// change the current item +#define wxACTION_LISTBOX_SETFOCUS wxT("setfocus") // select the item +#define wxACTION_LISTBOX_MOVEDOWN wxT("down") // select item below +#define wxACTION_LISTBOX_MOVEUP wxT("up") // select item above +#define wxACTION_LISTBOX_PAGEDOWN wxT("pagedown") // go page down +#define wxACTION_LISTBOX_PAGEUP wxT("pageup") // go page up +#define wxACTION_LISTBOX_START wxT("start") // go to first item +#define wxACTION_LISTBOX_END wxT("end") // go to last item +#define wxACTION_LISTBOX_FIND wxT("find") // find item by 1st letter + +// do something with the current item +#define wxACTION_LISTBOX_ACTIVATE wxT("activate") // activate (choose) +#define wxACTION_LISTBOX_TOGGLE wxT("toggle") // togglee selected state +#define wxACTION_LISTBOX_SELECT wxT("select") // sel this, unsel others +#define wxACTION_LISTBOX_SELECTADD wxT("selectadd") // add to selection +#define wxACTION_LISTBOX_UNSELECT wxT("unselect") // unselect +#define wxACTION_LISTBOX_ANCHOR wxT("selanchor") // anchor selection + +// do something with the selection globally (not for single selection ones) +#define wxACTION_LISTBOX_SELECTALL wxT("selectall") // select all items +#define wxACTION_LISTBOX_UNSELECTALL wxT("unselectall") // unselect all items +#define wxACTION_LISTBOX_SELTOGGLE wxT("togglesel") // invert the selection +#define wxACTION_LISTBOX_EXTENDSEL wxT("extend") // extend to item + +// ---------------------------------------------------------------------------- +// wxListBox: a list of selectable items +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase, public wxScrollHelper +{ +public: + // ctors and such + wxListBox() : wxScrollHelper(this) { Init(); } + wxListBox(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = (const wxString *) NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr) ) + : wxScrollHelper(this) + { + Init(); + + Create(parent, id, pos, size, n, choices, style, validator, name); + } + wxListBox(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr) ); + + virtual ~wxListBox(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = (const wxString *) NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxListBoxNameStr)); + + // implement the listbox interface defined by wxListBoxBase + virtual void DoClear() wxOVERRIDE; + virtual void DoDeleteOneItem(unsigned int n) wxOVERRIDE; + + virtual unsigned int GetCount() const wxOVERRIDE; + virtual wxString GetString(unsigned int n) const wxOVERRIDE; + virtual void SetString(unsigned int n, const wxString& s) wxOVERRIDE; + virtual int FindString(const wxString& s, bool bCase = false) const wxOVERRIDE; + + virtual bool IsSelected(int n) const wxOVERRIDE + { return m_selections.Index(n) != wxNOT_FOUND; } + virtual int GetSelection() const wxOVERRIDE; + virtual int GetSelections(wxArrayInt& aSelections) const wxOVERRIDE; + +protected: + virtual void DoSetSelection(int n, bool select) wxOVERRIDE; + + virtual int DoInsertItems(const wxArrayStringsAdapter& items, + unsigned int pos, + void **clientData, + wxClientDataType type) wxOVERRIDE; + + virtual int DoListHitTest(const wxPoint& point) const wxOVERRIDE; + + // universal wxComboBox implementation internally uses wxListBox + friend class WXDLLIMPEXP_FWD_CORE wxComboBox; + + virtual void DoSetFirstItem(int n) wxOVERRIDE; + + virtual void DoSetItemClientData(unsigned int n, void* clientData) wxOVERRIDE; + virtual void* DoGetItemClientData(unsigned int n) const wxOVERRIDE; + +public: + // override some more base class methods + virtual bool SetFont(const wxFont& font) wxOVERRIDE; + + // the wxUniversal-specific methods + // -------------------------------- + + // the current item is the same as the selected one for wxLB_SINGLE + // listboxes but for the other ones it is just the focused item which may + // be selected or not + int GetCurrentItem() const { return m_current; } + void SetCurrentItem(int n); + + // select the item which is diff items below the current one + void ChangeCurrent(int diff); + + // activate (i.e. send a LISTBOX_DOUBLECLICKED message) the specified item + void Activate(int item); + + // select or unselect the specified or current (if -1) item + void DoSelect(int item = -1, bool sel = true); + + // more readable wrapper + void DoUnselect(int item) { DoSelect(item, false); } + + // select an item and send a notification about it + void SelectAndNotify(int item); + + // ensure that the given item is visible by scrolling it into view + virtual void EnsureVisible(int n) wxOVERRIDE; + + // find the first item [strictly] after the current one which starts with + // the given string and make it the current one, return true if the current + // item changed + bool FindItem(const wxString& prefix, bool strictlyAfter = false); + bool FindNextItem(const wxString& prefix) { return FindItem(prefix, true); } + + // extend the selection to span the range from the anchor (see below) to + // the specified or current item + void ExtendSelection(int itemTo = -1); + + // make this item the new selection anchor: extending selection with + // ExtendSelection() will work with it + void AnchorSelection(int itemFrom) { m_selAnchor = itemFrom; } + + // get, calculating it if necessary, the number of items per page, the + // height of each line and the max width of an item + int GetItemsPerPage() const; + wxCoord GetLineHeight() const; + wxCoord GetMaxWidth() const; + + // override the wxControl virtual methods + virtual bool PerformAction(const wxControlAction& action, + long numArg = 0l, + const wxString& strArg = wxEmptyString) wxOVERRIDE; + + static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) wxOVERRIDE + { + return GetStdInputHandler(handlerDef); + } + + // idle processing + virtual void OnInternalIdle() wxOVERRIDE; + +protected: + // geometry + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; + + virtual void DoDraw(wxControlRenderer *renderer) wxOVERRIDE; + virtual wxBorder GetDefaultBorder() const wxOVERRIDE; + + // special hook for wxCheckListBox which allows it to update its internal + // data when a new item is inserted into the listbox + virtual void OnItemInserted(unsigned int WXUNUSED(pos)) { } + + + // common part of all ctors + void Init(); + + // event handlers + void OnSize(wxSizeEvent& event); + + // refresh the given item(s) or everything + void RefreshItems(int from, int count); + void RefreshItem(int n); + void RefreshFromItemToEnd(int n); + void RefreshAll(); + + // send an event of the given type (using m_current by default) + bool SendEvent(wxEventType type, int item = -1); + + // calculate the number of items per page using our current size + void CalcItemsPerPage(); + + // can/should we have a horz scrollbar? + bool HasHorzScrollbar() const + { return (m_windowStyle & wxLB_HSCROLL) != 0; } + + // redraw the items in the given range only: called from DoDraw() + virtual void DoDrawRange(wxControlRenderer *renderer, + int itemFirst, int itemLast); + + // update the scrollbars and then ensure that the item is visible + void DoEnsureVisible(int n); + + // mark horz scrollbar for updating + void RefreshHorzScrollbar(); + + // update (show/hide/adjust) the scrollbars + void UpdateScrollbars(); + + // refresh the items specified by m_updateCount and m_updateFrom + void UpdateItems(); + + // the array containing all items (it is sorted if the listbox has + // wxLB_SORT style) + union + { + wxArrayString *unsorted; + wxSortedArrayString *sorted; + } m_strings; + + // this array contains the indices of the selected items (for the single + // selection listboxes only the first element of it is used and contains + // the current selection) + wxArrayInt m_selections; + + // and this one the client data (either void or wxClientData) + wxArrayPtrVoid m_itemsClientData; + + // this is hold the input handler type. the input handler is different + // between ListBox and its subclass--CheckListbox + wxString m_inputHandlerType; + + // the current item + int m_current; + +private: + // the range of elements which must be updated: if m_updateCount is 0 no + // update is needed, if it is -1 everything must be updated, otherwise + // m_updateCount items starting from m_updateFrom have to be redrawn + int m_updateFrom, + m_updateCount; + + // the height of one line in the listbox (all lines have the same height) + wxCoord m_lineHeight; + + // the maximal width of a listbox item and the item which has it + wxCoord m_maxWidth; + int m_maxWidthItem; + + // the extents of horz and vert scrollbars + int m_scrollRangeX, + m_scrollRangeY; + + // the number of items per page + size_t m_itemsPerPage; + + // if the number of items has changed we may need to show/hide the + // scrollbar + bool m_updateScrollbarX, m_updateScrollbarY, + m_showScrollbarX, m_showScrollbarY; + + // if the current item has changed, we might need to scroll if it went out + // of the window + bool m_currentChanged; + + // the anchor from which the selection is extended for the listboxes with + // wxLB_EXTENDED style - this is set to the last item which was selected + // by not extending the selection but by choosing it directly + int m_selAnchor; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxListBox); +}; + +#endif // _WX_UNIV_LISTBOX_H_ diff --git a/lib/wxWidgets/include/wx/univ/menu.h b/lib/wxWidgets/include/wx/univ/menu.h new file mode 100644 index 0000000..72becf3 --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/menu.h @@ -0,0 +1,276 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/menu.h +// Purpose: wxMenu and wxMenuBar classes for wxUniversal +// Author: Vadim Zeitlin +// Modified by: +// Created: 05.05.01 +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_MENU_H_ +#define _WX_UNIV_MENU_H_ + +#if wxUSE_ACCEL + #include "wx/accel.h" +#endif // wxUSE_ACCEL + +#include "wx/dynarray.h" + +// fwd declarations +class WXDLLIMPEXP_FWD_CORE wxMenuInfo; +WX_DECLARE_EXPORTED_OBJARRAY(wxMenuInfo, wxMenuInfoArray); + +class WXDLLIMPEXP_FWD_CORE wxMenuGeometryInfo; +class WXDLLIMPEXP_FWD_CORE wxPopupMenuWindow; +class WXDLLIMPEXP_FWD_CORE wxRenderer; + +// ---------------------------------------------------------------------------- +// wxMenu +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMenu : public wxMenuBase +{ +public: + // ctors and dtor + wxMenu(const wxString& title, long style = 0) + : wxMenuBase(title, style) { Init(); } + + wxMenu(long style = 0) : wxMenuBase(style) { Init(); } + + virtual ~wxMenu(); + + // called by wxMenuItem when an item of this menu changes + void RefreshItem(wxMenuItem *item); + + // does the menu have any items? + bool IsEmpty() const { return !GetMenuItems().GetFirst(); } + + // show this menu at the given position (in screen coords) and optionally + // select its first item + void Popup(const wxPoint& pos, const wxSize& size, + bool selectFirst = true); + + // dismiss the menu + void Dismiss(); + + // override the base class methods to connect/disconnect event handlers + virtual void Attach(wxMenuBarBase *menubar) wxOVERRIDE; + virtual void Detach() wxOVERRIDE; + + // implementation only from here + + // do as if this item were clicked, return true if the resulting event was + // processed, false otherwise + bool ClickItem(wxMenuItem *item); + + // process the key event, return true if done + bool ProcessKeyDown(int key); + +#if wxUSE_ACCEL + // find the item for the given accel and generate an event if found + bool ProcessAccelEvent(const wxKeyEvent& event); +#endif // wxUSE_ACCEL + +protected: + // implement base class virtuals + virtual wxMenuItem* DoAppend(wxMenuItem *item) wxOVERRIDE; + virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item) wxOVERRIDE; + virtual wxMenuItem* DoRemove(wxMenuItem *item) wxOVERRIDE; + + // common part of DoAppend and DoInsert + void OnItemAdded(wxMenuItem *item); + + // called by wxPopupMenuWindow when the window is hidden + void OnDismiss(bool dismissParent); + + // return true if the menu is currently shown on screen + bool IsShown() const; + + // get the menu geometry info + const wxMenuGeometryInfo& GetGeometryInfo() const; + + // forget old menu geometry info + void InvalidateGeometryInfo(); + + // return either the menubar or the invoking window, normally never NULL + wxWindow *GetRootWindow() const; + + // get the renderer we use for drawing: either the one of the menu bar or + // the one of the window if we're a popup menu + wxRenderer *GetRenderer() const; + +#if wxUSE_ACCEL + // add/remove accel for the given menu item + void AddAccelFor(wxMenuItem *item); + void RemoveAccelFor(wxMenuItem *item); +#endif // wxUSE_ACCEL + +private: + // common part of all ctors + void Init(); + + // terminate the current radio group, if any + void EndRadioGroup(); + + // the exact menu geometry is defined by a struct derived from this one + // which is opaque and defined by the renderer + wxMenuGeometryInfo *m_geometry; + + // the menu shown on screen or NULL if not currently shown + wxPopupMenuWindow *m_popupMenu; + +#if wxUSE_ACCEL + // the accel table for this menu + wxAcceleratorTable m_accelTable; +#endif // wxUSE_ACCEL + + // the position of the first item in the current radio group or -1 + int m_startRadioGroup; + + // it calls out OnDismiss() + friend class wxPopupMenuWindow; + wxDECLARE_DYNAMIC_CLASS(wxMenu); +}; + +// ---------------------------------------------------------------------------- +// wxMenuBar +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMenuBar : public wxMenuBarBase +{ +public: + // ctors and dtor + wxMenuBar(long WXUNUSED(style) = 0) { Init(); } + wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0); + virtual ~wxMenuBar(); + + // implement base class virtuals + virtual bool Append( wxMenu *menu, const wxString &title ) wxOVERRIDE; + virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title) wxOVERRIDE; + virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title) wxOVERRIDE; + virtual wxMenu *Remove(size_t pos) wxOVERRIDE; + + virtual void EnableTop(size_t pos, bool enable) wxOVERRIDE; + virtual bool IsEnabledTop(size_t pos) const wxOVERRIDE; + + virtual void SetMenuLabel(size_t pos, const wxString& label) wxOVERRIDE; + virtual wxString GetMenuLabel(size_t pos) const wxOVERRIDE; + + virtual void Attach(wxFrame *frame) wxOVERRIDE; + virtual void Detach() wxOVERRIDE; + + // get the next item for the givan accel letter (used by wxFrame), return + // -1 if none + // + // if unique is not NULL, filled with true if there is only one item with + // this accel, false if two or more + int FindNextItemForAccel(int idxStart, + int keycode, + bool *unique = NULL) const; + + // called by wxFrame to set focus to or open the given menu + void SelectMenu(size_t pos); + void PopupMenu(size_t pos); + +#if wxUSE_ACCEL + // find the item for the given accel and generate an event if found + bool ProcessAccelEvent(const wxKeyEvent& event); +#endif // wxUSE_ACCEL + + // called by wxMenu when it is dismissed + void OnDismissMenu(bool dismissMenuBar = false); + +protected: + // common part of all ctors + void Init(); + + // event handlers + void OnLeftDown(wxMouseEvent& event); + void OnLeftUp(wxMouseEvent& event); + void OnMouseMove(wxMouseEvent& event); + void OnKeyDown(wxKeyEvent& event); + void OnKillFocus(wxFocusEvent& event); + void OnCaptureLost(wxMouseCaptureLostEvent& event); + + // process the mouse move event, return true if we did, false to continue + // processing as usual + // + // the coordinates are client coordinates of menubar, convert if necessary + bool ProcessMouseEvent(const wxPoint& pt); + + // called when the menu bar loses mouse capture - it is not hidden unlike + // menus, but it doesn't have modal status any longer + void OnDismiss(); + + // draw the menubar + virtual void DoDraw(wxControlRenderer *renderer) wxOVERRIDE; + + // menubar geometry + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + + // has the menubar been created already? + bool IsCreated() const { return m_frameLast != NULL; } + + // "fast" version of GetMenuCount() + size_t GetCount() const { return m_menuInfos.GetCount(); } + + // get the (total) width of the specified menu + wxCoord GetItemWidth(size_t pos) const; + + // get the rect of the item + wxRect GetItemRect(size_t pos) const; + + // get the menu from the given point or -1 if none + int GetMenuFromPoint(const wxPoint& pos) const; + + // refresh the given item + void RefreshItem(size_t pos); + + // refresh all items after this one (including it) + void RefreshAllItemsAfter(size_t pos); + + // hide the currently shown menu and show this one + void DoSelectMenu(size_t pos); + + // popup the currently selected menu + void PopupCurrentMenu(bool selectFirst = true); + + // hide the currently selected menu + void DismissMenu(); + + // do we show a menu currently? + bool IsShowingMenu() const { return m_menuShown != 0; } + + // we don't want to have focus except while selecting from menu + void GiveAwayFocus(); + + // Release the mouse capture if we have it + bool ReleaseMouseCapture(); + + // the array containing extra menu info we need + wxMenuInfoArray m_menuInfos; + + // the current item (only used when menubar has focus) + int m_current; + +private: + // the last frame to which we were attached, NULL initially + wxFrame *m_frameLast; + + // the currently shown menu or NULL + wxMenu *m_menuShown; + + // should be showing the menu? this is subtly different from m_menuShown != + // NULL as the menu which should be shown may be disabled in which case we + // don't show it - but will do as soon as the focus shifts to another menu + bool m_shouldShowMenu; + + // it calls out ProcessMouseEvent() + friend class wxPopupMenuWindow; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxMenuBar); +}; + +#endif // _WX_UNIV_MENU_H_ diff --git a/lib/wxWidgets/include/wx/univ/menuitem.h b/lib/wxWidgets/include/wx/univ/menuitem.h new file mode 100644 index 0000000..7562749 --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/menuitem.h @@ -0,0 +1,129 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/menuitem.h +// Purpose: wxMenuItem class for wxUniversal +// Author: Vadim Zeitlin +// Modified by: +// Created: 05.05.01 +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_MENUITEM_H_ +#define _WX_UNIV_MENUITEM_H_ + +// ---------------------------------------------------------------------------- +// wxMenuItem implements wxMenuItemBase +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMenuItem : public wxMenuItemBase +{ +public: + // ctor & dtor + wxMenuItem(wxMenu *parentMenu = NULL, + int id = wxID_SEPARATOR, + const wxString& name = wxEmptyString, + const wxString& help = wxEmptyString, + wxItemKind kind = wxITEM_NORMAL, + wxMenu *subMenu = NULL); + virtual ~wxMenuItem(); + + // override base class virtuals to update the item appearance on screen + virtual void SetItemLabel(const wxString& text) wxOVERRIDE; + virtual void SetCheckable(bool checkable) wxOVERRIDE; + + virtual void Enable(bool enable = true) wxOVERRIDE; + virtual void Check(bool check = true) wxOVERRIDE; + + // we add some extra functions which are also available under MSW from + // wxOwnerDrawn class - they will be moved to wxMenuItemBase later + // hopefully + void SetBitmaps(const wxBitmapBundle& bmpChecked, + const wxBitmapBundle& bmpUnchecked = wxBitmapBundle()); + virtual void SetBitmap(const wxBitmapBundle& bmp) wxOVERRIDE { SetBitmaps(bmp); } + wxBitmap GetBitmap(bool checked) const + { return GetBitmapFromBundle(checked ? m_bitmap : m_bmpUnchecked); } + virtual wxBitmap GetBitmap() const wxOVERRIDE + { return GetBitmap(true); } + + void SetDisabledBitmap( const wxBitmapBundle& bmpDisabled ) + { m_bmpDisabled = bmpDisabled; } + wxBitmap GetDisabledBitmap() const + { return GetBitmapFromBundle(m_bmpDisabled); } + + // mark item as belonging to the given radio group + void SetAsRadioGroupStart(); + void SetRadioGroupStart(int start); + void SetRadioGroupEnd(int end); + int GetRadioGroupStart(); + int GetRadioGroupEnd(); + + // wxUniv-specific methods for implementation only starting from here + + // get the accel index of our label or -1 if none + int GetAccelIndex() const { return m_indexAccel; } + + // get the accel string (displayed to the right of the label) + const wxString& GetAccelString() const { return m_strAccel; } + + // set/get the y coord and the height of this item: note that it must be + // set first and retrieved later, the item doesn't calculate it itself + void SetGeometry(wxCoord y, wxCoord height) + { + m_posY = y; + m_height = height; + } + + wxCoord GetPosition() const + { + wxASSERT_MSG( m_posY != wxDefaultCoord, wxT("must call SetHeight first!") ); + + return m_posY; + } + + wxCoord GetHeight() const + { + wxASSERT_MSG( m_height != wxDefaultCoord, wxT("must call SetHeight first!") ); + + return m_height; + } + +protected: + // notify the menu about the change in this item + inline void NotifyMenu(); + + // set the accel index and string from text + void UpdateAccelInfo(); + + // the bitmaps (may be invalid, then they're not used) + wxBitmapBundle m_bmpUnchecked, + m_bmpDisabled; + + // the positions of the first and last items of the radio group this item + // belongs to or -1: start is the radio group start and is valid for all + // but first radio group items (m_isRadioGroupStart == false), end is valid + // only for the first one + union + { + int start; + int end; + } m_radioGroup; + + // does this item start a radio group? + bool m_isRadioGroupStart; + + // the position of the accelerator in our label, -1 if none + int m_indexAccel; + + // the accel string (i.e. "Ctrl-Q" or "Alt-F1") + wxString m_strAccel; + + // the position and height of the displayed item + wxCoord m_posY, + m_height; + +private: + wxDECLARE_DYNAMIC_CLASS(wxMenuItem); +}; + +#endif // _WX_UNIV_MENUITEM_H_ + diff --git a/lib/wxWidgets/include/wx/univ/notebook.h b/lib/wxWidgets/include/wx/univ/notebook.h new file mode 100644 index 0000000..f487118 --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/notebook.h @@ -0,0 +1,251 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/notebook.h +// Purpose: universal version of wxNotebook +// Author: Vadim Zeitlin +// Modified by: +// Created: 01.02.01 +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_NOTEBOOK_H_ +#define _WX_UNIV_NOTEBOOK_H_ + +#include "wx/arrstr.h" + +class WXDLLIMPEXP_FWD_CORE wxSpinButton; + +// ---------------------------------------------------------------------------- +// the actions supported by this control +// ---------------------------------------------------------------------------- + +// change the page: to the next/previous/given one +#define wxACTION_NOTEBOOK_NEXT wxT("nexttab") +#define wxACTION_NOTEBOOK_PREV wxT("prevtab") +#define wxACTION_NOTEBOOK_GOTO wxT("gototab") + +// ---------------------------------------------------------------------------- +// wxNotebook +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase +{ +public: + // ctors and such + // -------------- + + wxNotebook() { Init(); } + + wxNotebook(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxNotebookNameStr)) + { + Init(); + + (void)Create(parent, id, pos, size, style, name); + } + + // quasi ctor + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxNotebookNameStr)); + + // dtor + virtual ~wxNotebook(); + + // implement wxNotebookBase pure virtuals + // -------------------------------------- + + virtual int SetSelection(size_t nPage) wxOVERRIDE { return DoSetSelection(nPage, SetSelection_SendEvent); } + + // changes selected page without sending events + int ChangeSelection(size_t nPage) wxOVERRIDE { return DoSetSelection(nPage); } + + virtual bool SetPageText(size_t nPage, const wxString& strText) wxOVERRIDE; + virtual wxString GetPageText(size_t nPage) const wxOVERRIDE; + + virtual int GetPageImage(size_t nPage) const wxOVERRIDE; + virtual bool SetPageImage(size_t nPage, int nImage) wxOVERRIDE; + + virtual void SetPageSize(const wxSize& size) wxOVERRIDE; + virtual void SetPadding(const wxSize& padding) wxOVERRIDE; + virtual void SetTabSize(const wxSize& sz) wxOVERRIDE; + + virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const wxOVERRIDE; + + virtual bool DeleteAllPages() wxOVERRIDE; + + virtual bool InsertPage(size_t nPage, + wxNotebookPage *pPage, + const wxString& strText, + bool bSelect = false, + int imageId = NO_IMAGE) wxOVERRIDE; + + // style tests + // ----------- + + // return true if all tabs have the same width + bool FixedSizeTabs() const { return HasFlag(wxNB_FIXEDWIDTH); } + + // return wxTOP/wxBOTTOM/wxRIGHT/wxLEFT + wxDirection GetTabOrientation() const; + + // return true if the notebook has tabs at the sidesand not at the top (or + // bottom) as usual + bool IsVertical() const; + + // hit testing + // ----------- + + virtual int HitTest(const wxPoint& pt, long *flags = NULL) const wxOVERRIDE; + + // input handling + // -------------- + + virtual bool PerformAction(const wxControlAction& action, + long numArg = 0l, + const wxString& strArg = wxEmptyString) wxOVERRIDE; + + static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) wxOVERRIDE + { + return GetStdInputHandler(handlerDef); + } + + // refresh the currently selected tab + void RefreshCurrent(); + +protected: + virtual wxNotebookPage *DoRemovePage(size_t nPage) wxOVERRIDE; + + // drawing + virtual void DoDraw(wxControlRenderer *renderer) wxOVERRIDE; + void DoDrawTab(wxDC& dc, const wxRect& rect, size_t n); + + // resizing + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; + + int DoSetSelection(size_t nPage, int flags = 0) wxOVERRIDE; + + // common part of all ctors + void Init(); + + // resize the tab to fit its title (and icon if any) + void ResizeTab(int page); + + // recalculate the geometry of the notebook completely + void Relayout(); + + // is the spin button currently shown? + bool HasSpinBtn() const; + + // calculate last (fully) visible tab: updates m_lastVisible + void CalcLastVisibleTab(); + + // show or hide the spin control for tabs scrolling depending on whether it + // is needed or not + void UpdateSpinBtn(); + + // position the spin button + void PositionSpinBtn(); + + // refresh the given tab only + void RefreshTab(int page, bool forceSelected = false); + + // refresh all tabs + void RefreshAllTabs(); + + // get the tab rect (inefficient, don't use this in a loop) + wxRect GetTabRect(int page) const; + + // get the rectangle containing all tabs + wxRect GetAllTabsRect() const; + + // get the part occupied by the tabs - slightly smaller than + // GetAllTabsRect() because the tabs may be indented from it + wxRect GetTabsPart() const; + + // calculate the tab size (without padding) + wxSize CalcTabSize(int page) const; + + // get the (cached) size of a tab + void GetTabSize(int page, wxCoord *w, wxCoord *h) const; + + // get the (cached) width of the tab + wxCoord GetTabWidth(int page) const + { return FixedSizeTabs() ? m_widthMax : m_widths[page]; } + + // return true if the tab has an associated image + bool HasImage(int page) const + { return HasImageList() && m_images[page] != -1; } + + // get the part of the notebook reserved for the pages (slightly larger + // than GetPageRect() as we draw a border and leave marginin between) + wxRect GetPagePart() const; + + // get the page rect in our client coords + wxRect GetPageRect() const wxOVERRIDE; + + // get our client size from the page size + wxSize GetSizeForPage(const wxSize& size) const; + + // scroll the tabs so that the first page shown becomes the given one + void ScrollTo(size_t page); + + // scroll the tabs so that the first page shown becomes the given one + void ScrollLastTo(size_t page); + + // the pages titles + wxArrayString m_titles; + + // the spin button to change the pages + wxSpinButton *m_spinbtn; + + // the offset of the first page shown (may be changed with m_spinbtn) + wxCoord m_offset; + + // the first and last currently visible tabs: the name is not completely + // accurate as m_lastVisible is, in fact, the first tab which is *not* + // visible: so the visible tabs are those with indexes such that + // m_firstVisible <= n < m_lastVisible + size_t m_firstVisible, + m_lastVisible; + + // the last fully visible item, usually just m_lastVisible - 1 but may be + // different from it + size_t m_lastFullyVisible; + + // the height of tabs in a normal notebook or the width of tabs in a + // notebook with tabs on a side + wxCoord m_heightTab; + + // the biggest height (or width) of a notebook tab (used only if + // FixedSizeTabs()) or -1 if not calculated yet + wxCoord m_widthMax; + + // the cached widths (or heights) of tabs + wxArrayInt m_widths; + + // the icon indices + wxArrayInt m_images; + + // the accel indexes for labels + wxArrayInt m_accels; + + // the padding + wxSize m_sizePad; + + wxDECLARE_DYNAMIC_CLASS(wxNotebook); +}; + +#endif // _WX_UNIV_NOTEBOOK_H_ + diff --git a/lib/wxWidgets/include/wx/univ/panel.h b/lib/wxWidgets/include/wx/univ/panel.h new file mode 100644 index 0000000..175c26b --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/panel.h @@ -0,0 +1,50 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/panel.h +// Purpose: wxUniversal-specific wxPanel class. +// Author: Vadim Zeitlin +// Created: 2011-03-18 +// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_PANEL_H_ +#define _WX_UNIV_PANEL_H_ + +// ---------------------------------------------------------------------------- +// wxPanel +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPanel : public wxPanelBase +{ +public: + wxPanel() { } + + wxPanel(wxWindow *parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTAB_TRAVERSAL | wxNO_BORDER, + const wxString& name = wxASCII_STR(wxPanelNameStr)) + { + Create(parent, winid, pos, size, style, name); + } + + virtual bool IsCanvasWindow() const { return true; } + +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED_CONSTRUCTOR( + wxPanel(wxWindow *parent, + int x, int y, int width, int height, + long style = wxTAB_TRAVERSAL | wxNO_BORDER, + const wxString& name = wxASCII_STR(wxPanelNameStr)) + { + Create(parent, wxID_ANY, wxPoint(x, y), wxSize(width, height), style, name); + } + ) +#endif // WXWIN_COMPATIBILITY_2_8 + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxPanel); +}; + +#endif // _WX_UNIV_PANEL_H_ diff --git a/lib/wxWidgets/include/wx/univ/radiobox.h b/lib/wxWidgets/include/wx/univ/radiobox.h new file mode 100644 index 0000000..db67828 --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/radiobox.h @@ -0,0 +1,152 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/radiobox.h +// Purpose: wxRadioBox declaration +// Author: Vadim Zeitlin +// Modified by: +// Created: 11.09.00 +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_RADIOBOX_H_ +#define _WX_UNIV_RADIOBOX_H_ + +class WXDLLIMPEXP_FWD_CORE wxRadioButton; + +#include "wx/statbox.h" +#include "wx/dynarray.h" + +WX_DEFINE_EXPORTED_ARRAY_PTR(wxRadioButton *, wxArrayRadioButtons); + +// ---------------------------------------------------------------------------- +// wxRadioBox: a box full of radio buttons +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxRadioBox : public wxStaticBox, + public wxRadioBoxBase +{ +public: + // wxRadioBox construction + wxRadioBox() { Init(); } + + wxRadioBox(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString *choices = NULL, + int majorDim = 0, + long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioBoxNameStr)) + { + Init(); + + (void)Create(parent, id, title, pos, size, n, choices, + majorDim, style, val, name); + } + wxRadioBox(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, + long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioBoxNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString *choices = NULL, + int majorDim = 0, + long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioBoxNameStr)); + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, + long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioBoxNameStr)); + + virtual ~wxRadioBox(); + + // implement wxRadioBox interface + virtual void SetSelection(int n) wxOVERRIDE; + virtual int GetSelection() const wxOVERRIDE; + + virtual unsigned int GetCount() const wxOVERRIDE + { return (unsigned int)m_buttons.GetCount(); } + + virtual wxString GetString(unsigned int n) const wxOVERRIDE; + virtual void SetString(unsigned int n, const wxString& label) wxOVERRIDE; + + virtual bool Enable(unsigned int n, bool enable = true) wxOVERRIDE; + virtual bool Show(unsigned int n, bool show = true) wxOVERRIDE; + + virtual bool IsItemEnabled(unsigned int n) const wxOVERRIDE; + virtual bool IsItemShown(unsigned int n) const wxOVERRIDE; + + // we also override the wxControl methods to avoid virtual function hiding + virtual bool Enable(bool enable = true) wxOVERRIDE; + virtual bool Show(bool show = true) wxOVERRIDE; + virtual wxString GetLabel() const wxOVERRIDE; + virtual void SetLabel(const wxString& label) wxOVERRIDE; + + // we inherit a version always returning false from wxStaticBox, override + // it to behave normally + virtual bool AcceptsFocus() const wxOVERRIDE { return wxControl::AcceptsFocus(); } + +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip( wxToolTip *tip ); +#endif // wxUSE_TOOLTIPS + + // wxUniversal-only methods + + // another Append() version + void Append(int n, const wxString *choices); + + // implementation only: called by wxRadioHookHandler + void OnRadioButton(wxEvent& event); + bool OnKeyDown(wxKeyEvent& event); + +protected: + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + + // override the base class methods dealing with window positioning/sizing + // as we must move/size the buttons as well + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + + // generate a radiobutton click event for the current item + void SendRadioEvent(); + + // common part of all ctors + void Init(); + + // calculate the max size of all buttons + wxSize GetMaxButtonSize() const; + + // the currently selected radio button or -1 + int m_selection; + + // all radio buttons + wxArrayRadioButtons m_buttons; + + // the event handler which is used to translate radiobutton events into + // radiobox one + wxEvtHandler *m_evtRadioHook; + +private: + wxDECLARE_DYNAMIC_CLASS(wxRadioBox); +}; + +#endif // _WX_UNIV_RADIOBOX_H_ diff --git a/lib/wxWidgets/include/wx/univ/radiobut.h b/lib/wxWidgets/include/wx/univ/radiobut.h new file mode 100644 index 0000000..711e0a6 --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/radiobut.h @@ -0,0 +1,79 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/radiobut.h +// Purpose: wxRadioButton declaration +// Author: Vadim Zeitlin +// Modified by: +// Created: 10.09.00 +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_RADIOBUT_H_ +#define _WX_UNIV_RADIOBUT_H_ + +// ---------------------------------------------------------------------------- +// wxRadioButton +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxRadioButton : public wxRadioButtonBase +{ +public: + // constructors + wxRadioButton() { Init(); } + + wxRadioButton(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioButtonNameStr)) + { + Init(); + + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxRadioButtonNameStr)); + + // (re)implement pure virtuals from wxRadioButtonBase + virtual void SetValue(bool value) wxOVERRIDE { return wxCheckBox::SetValue(value); } + virtual bool GetValue() const wxOVERRIDE { return wxCheckBox::GetValue(); } + + // override some base class methods + virtual void ChangeValue(bool value) wxOVERRIDE; + +protected: + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + + // implement our own drawing + virtual void DoDraw(wxControlRenderer *renderer) wxOVERRIDE; + + // we use the radio button bitmaps for size calculation + virtual wxSize GetBitmapSize() const wxOVERRIDE; + + // the radio button can only be cleared using this method, not + // ChangeValue() above - and it is protected as it can only be called by + // another radiobutton + void ClearValue(); + + // called when the radio button becomes checked: we clear all the buttons + // in the same group with us here + virtual void OnCheck() wxOVERRIDE; + + // send event about radio button selection + virtual void SendEvent() wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxRadioButton); +}; + +#endif // _WX_UNIV_RADIOBUT_H_ diff --git a/lib/wxWidgets/include/wx/univ/renderer.h b/lib/wxWidgets/include/wx/univ/renderer.h new file mode 100644 index 0000000..986535c --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/renderer.h @@ -0,0 +1,926 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/renderer.h +// Purpose: wxRenderer class declaration +// Author: Vadim Zeitlin +// Modified by: +// Created: 06.08.00 +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_RENDERER_H_ +#define _WX_UNIV_RENDERER_H_ + +/* + wxRenderer class is used to draw all wxWidgets controls. This is an ABC and + the look of the application is determined by the concrete derivation of + wxRenderer used in the program. + + It also contains a few static methods which may be used by the concrete + renderers and provide the functionality which is often similar or identical + in all renderers (using inheritance here would be more restrictive as the + given concrete renderer may need an arbitrary subset of the base class + methods). + + Finally note that wxRenderer supersedes wxRendererNative in wxUniv build and + includes the latters functionality (which it may delegate to the generic + implementation of the latter or reimplement itself). + */ + +#include "wx/renderer.h" + +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxDC; +class WXDLLIMPEXP_FWD_CORE wxCheckListBox; + +#if wxUSE_LISTBOX + class WXDLLIMPEXP_FWD_CORE wxListBox; +#endif // wxUSE_LISTBOX + +#if wxUSE_MENUS + class WXDLLIMPEXP_FWD_CORE wxMenu; + class WXDLLIMPEXP_FWD_CORE wxMenuGeometryInfo; +#endif // wxUSE_MENUS + +class WXDLLIMPEXP_FWD_CORE wxScrollBar; + +#if wxUSE_TEXTCTRL + class WXDLLIMPEXP_FWD_CORE wxTextCtrl; +#endif + +#if wxUSE_GAUGE + class WXDLLIMPEXP_FWD_CORE wxGauge; +#endif // wxUSE_GAUGE + +#include "wx/string.h" +#include "wx/gdicmn.h" +#include "wx/icon.h" + +// helper class used by wxMenu-related functions +class WXDLLIMPEXP_CORE wxMenuGeometryInfo +{ +public: + // get the total size of the menu + virtual wxSize GetSize() const = 0; + + virtual ~wxMenuGeometryInfo(); +}; + +// ---------------------------------------------------------------------------- +// wxRenderer: abstract renderers interface +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxRenderer : public wxDelegateRendererNative +{ +public: + // drawing functions + // ----------------- + + // draw the controls background + virtual void DrawBackground(wxDC& dc, + const wxColour& col, + const wxRect& rect, + int flags, + wxWindow *window = NULL) = 0; + + // draw the button surface + virtual void DrawButtonSurface(wxDC& dc, + const wxColour& col, + const wxRect& rect, + int flags) = 0; + + // draw the label inside the given rectangle with the specified alignment + // and optionally emphasize the character with the given index + virtual void DrawLabel(wxDC& dc, + const wxString& label, + const wxRect& rect, + int flags = 0, + int alignment = wxALIGN_LEFT | wxALIGN_TOP, + int indexAccel = -1, + wxRect *rectBounds = NULL) = 0; + + // same but also draw a bitmap if it is valid + virtual void DrawButtonLabel(wxDC& dc, + const wxString& label, + const wxBitmap& image, + const wxRect& rect, + int flags = 0, + int alignment = wxALIGN_LEFT | wxALIGN_TOP, + int indexAccel = -1, + wxRect *rectBounds = NULL) = 0; + + + // draw the border and optionally return the rectangle containing the + // region inside the border + virtual void DrawBorder(wxDC& dc, + wxBorder border, + const wxRect& rect, + int flags = 0, + wxRect *rectIn = NULL) = 0; + + // draw text control border (I hate to have a separate method for this but + // it is needed to accommodate GTK+) + virtual void DrawTextBorder(wxDC& dc, + wxBorder border, + const wxRect& rect, + int flags = 0, + wxRect *rectIn = NULL) = 0; + + // draw push button border and return the rectangle left for the label + virtual void DrawButtonBorder(wxDC& dc, + const wxRect& rect, + int flags = 0, + wxRect *rectIn = NULL) = 0; + + // draw a horizontal line + virtual void DrawHorizontalLine(wxDC& dc, + wxCoord y, wxCoord x1, wxCoord x2) = 0; + + // draw a vertical line + virtual void DrawVerticalLine(wxDC& dc, + wxCoord x, wxCoord y1, wxCoord y2) = 0; + + // draw a frame with the label (horizontal alignment can be specified) + virtual void DrawFrame(wxDC& dc, + const wxString& label, + const wxRect& rect, + int flags = 0, + int alignment = wxALIGN_LEFT, + int indexAccel = -1) = 0; + + // draw an arrow in the given direction + virtual void DrawArrow(wxDC& dc, + wxDirection dir, + const wxRect& rect, + int flags = 0) = 0; + + // draw a scrollbar arrow (may be the same as arrow but may be not) + virtual void DrawScrollbarArrow(wxDC& dc, + wxDirection dir, + const wxRect& rect, + int flags = 0) = 0; + + // draw the scrollbar thumb + virtual void DrawScrollbarThumb(wxDC& dc, + wxOrientation orient, + const wxRect& rect, + int flags = 0) = 0; + + // draw a (part of) scrollbar shaft + virtual void DrawScrollbarShaft(wxDC& dc, + wxOrientation orient, + const wxRect& rect, + int flags = 0) = 0; + + // draw the rectangle in the corner between two scrollbars + virtual void DrawScrollCorner(wxDC& dc, + const wxRect& rect) = 0; + + // draw an item of a wxListBox + virtual void DrawItem(wxDC& dc, + const wxString& label, + const wxRect& rect, + int flags = 0) = 0; + + // draw an item of a wxCheckListBox + virtual void DrawCheckItem(wxDC& dc, + const wxString& label, + const wxBitmap& bitmap, + const wxRect& rect, + int flags = 0) = 0; + + // draw a checkbutton (bitmap may be invalid to use default one) + virtual void DrawCheckButton(wxDC& dc, + const wxString& label, + const wxBitmap& bitmap, + const wxRect& rect, + int flags = 0, + wxAlignment align = wxALIGN_LEFT, + int indexAccel = -1) = 0; + + // draw a radio button + virtual void DrawRadioButton(wxDC& dc, + const wxString& label, + const wxBitmap& bitmap, + const wxRect& rect, + int flags = 0, + wxAlignment align = wxALIGN_LEFT, + int indexAccel = -1) = 0; + +#if wxUSE_TOOLBAR + // draw a toolbar button (label may be empty, bitmap may be invalid, if + // both conditions are true this function draws a separator) + virtual void DrawToolBarButton(wxDC& dc, + const wxString& label, + const wxBitmap& bitmap, + const wxRect& rect, + int flags = 0, + long style = 0, + int tbarStyle = 0) = 0; +#endif // wxUSE_TOOLBAR + +#if wxUSE_TEXTCTRL + // draw a (part of) line in the text control + virtual void DrawTextLine(wxDC& dc, + const wxString& text, + const wxRect& rect, + int selStart = -1, + int selEnd = -1, + int flags = 0) = 0; + + // draw a line wrap indicator + virtual void DrawLineWrapMark(wxDC& dc, const wxRect& rect) = 0; +#endif // wxUSE_TEXTCTRL + +#if wxUSE_NOTEBOOK + // draw a notebook tab + virtual void DrawTab(wxDC& dc, + const wxRect& rect, + wxDirection dir, + const wxString& label, + const wxBitmap& bitmap = wxNullBitmap, + int flags = 0, + int indexAccel = -1) = 0; +#endif // wxUSE_NOTEBOOK + +#if wxUSE_SLIDER + + // draw the slider shaft + virtual void DrawSliderShaft(wxDC& dc, + const wxRect& rect, + int lenThumb, + wxOrientation orient, + int flags = 0, + long style = 0, + wxRect *rectShaft = NULL) = 0; + + // draw the slider thumb + virtual void DrawSliderThumb(wxDC& dc, + const wxRect& rect, + wxOrientation orient, + int flags = 0, + long style = 0) = 0; + + // draw the slider ticks + virtual void DrawSliderTicks(wxDC& dc, + const wxRect& rect, + int lenThumb, + wxOrientation orient, + int start, + int end, + int step = 1, + int flags = 0, + long style = 0) = 0; +#endif // wxUSE_SLIDER + +#if wxUSE_MENUS + // draw a menu bar item + virtual void DrawMenuBarItem(wxDC& dc, + const wxRect& rect, + const wxString& label, + int flags = 0, + int indexAccel = -1) = 0; + + // draw a menu item (also used for submenus if flags has ISSUBMENU flag) + // + // the geometryInfo is calculated by GetMenuGeometry() function from below + virtual void DrawMenuItem(wxDC& dc, + wxCoord y, + const wxMenuGeometryInfo& geometryInfo, + const wxString& label, + const wxString& accel, + const wxBitmap& bitmap = wxNullBitmap, + int flags = 0, + int indexAccel = -1) = 0; + + // draw a menu bar separator + virtual void DrawMenuSeparator(wxDC& dc, + wxCoord y, + const wxMenuGeometryInfo& geomInfo) = 0; +#endif // wxUSE_MENUS + +#if wxUSE_STATUSBAR + // draw a status bar field: wxCONTROL_ISDEFAULT bit in the flags is + // interpreted specially and means "draw the status bar grip" here + virtual void DrawStatusField(wxDC& dc, + const wxRect& rect, + const wxString& label, + int flags = 0, int style = 0) = 0; +#endif // wxUSE_STATUSBAR + + // draw complete frame/dialog titlebar + virtual void DrawFrameTitleBar(wxDC& dc, + const wxRect& rect, + const wxString& title, + const wxIcon& icon, + int flags, + int specialButton = 0, + int specialButtonFlags = 0) = 0; + + // draw frame borders + virtual void DrawFrameBorder(wxDC& dc, + const wxRect& rect, + int flags) = 0; + + // draw frame titlebar background + virtual void DrawFrameBackground(wxDC& dc, + const wxRect& rect, + int flags) = 0; + + // draw frame title + virtual void DrawFrameTitle(wxDC& dc, + const wxRect& rect, + const wxString& title, + int flags) = 0; + + // draw frame icon + virtual void DrawFrameIcon(wxDC& dc, + const wxRect& rect, + const wxIcon& icon, + int flags) = 0; + + // draw frame buttons + virtual void DrawFrameButton(wxDC& dc, + wxCoord x, wxCoord y, + int button, + int flags = 0) = 0; + + // misc functions + // -------------- + +#if wxUSE_COMBOBOX + // return the bitmaps to use for combobox button + virtual void GetComboBitmaps(wxBitmap *bmpNormal, + wxBitmap *bmpFocus, + wxBitmap *bmpPressed, + wxBitmap *bmpDisabled) = 0; +#endif // wxUSE_COMBOBOX + + // geometry functions + // ------------------ + + // get the dimensions of the border: rect.x/y contain the width/height of + // the left/top side, width/height - of the right/bottom one + virtual wxRect GetBorderDimensions(wxBorder border) const = 0; + + // the scrollbars may be drawn either inside the window border or outside + // it - this function is used to decide how to draw them + virtual bool AreScrollbarsInsideBorder() const = 0; + + // adjust the size of the control of the given class: for most controls, + // this just takes into account the border, but for some (buttons, for + // example) it is more complicated - the result being, in any case, that + // the control looks "nice" if it uses the adjusted rectangle + virtual void AdjustSize(wxSize *size, const wxWindow *window) = 0; + +#if wxUSE_SCROLLBAR + // get the size of a scrollbar arrow + virtual wxSize GetScrollbarArrowSize() const = 0; +#endif // wxUSE_SCROLLBAR + + // get the height of a listbox item from the base font height + virtual wxCoord GetListboxItemHeight(wxCoord fontHeight) = 0; + + // get the size of a checkbox/radio button bitmap + virtual wxSize GetCheckBitmapSize() const = 0; + virtual wxSize GetRadioBitmapSize() const = 0; + virtual wxCoord GetCheckItemMargin() const = 0; + +#if wxUSE_TOOLBAR + // get the standard size of a toolbar button and also return the size of + // a toolbar separator in the provided pointer + virtual wxSize GetToolBarButtonSize(wxCoord *separator) const = 0; + + // get the margins between/around the toolbar buttons + virtual wxSize GetToolBarMargin() const = 0; +#endif // wxUSE_TOOLBAR + +#if wxUSE_TEXTCTRL + // convert between text rectangle and client rectangle for text controls: + // the former is typically smaller to leave margins around text + virtual wxRect GetTextTotalArea(const wxTextCtrl *text, + const wxRect& rectText) const = 0; + + // extra space is for line indicators + virtual wxRect GetTextClientArea(const wxTextCtrl *text, + const wxRect& rectTotal, + wxCoord *extraSpaceBeyond) const = 0; +#endif // wxUSE_TEXTCTRL + +#if wxUSE_NOTEBOOK + // get the overhang of a selected tab + virtual wxSize GetTabIndent() const = 0; + + // get the padding around the text in a tab + virtual wxSize GetTabPadding() const = 0; +#endif // wxUSE_NOTEBOOK + +#if wxUSE_SLIDER + // get the default size of the slider in lesser dimension (i.e. height of a + // horizontal slider or width of a vertical one) + virtual wxCoord GetSliderDim() const = 0; + + // get the length of the slider ticks displayed along side slider + virtual wxCoord GetSliderTickLen() const = 0; + + // get the slider shaft rect from the total slider rect + virtual wxRect GetSliderShaftRect(const wxRect& rect, + int lenThumb, + wxOrientation orient, + long style = 0) const = 0; + + // get the size of the slider thumb for the given total slider rect + virtual wxSize GetSliderThumbSize(const wxRect& rect, + int lenThumb, + wxOrientation orient) const = 0; +#endif // wxUSE_SLIDER + + // get the size of one progress bar step (in horz and vertical directions) + virtual wxSize GetProgressBarStep() const = 0; + +#if wxUSE_MENUS + // get the size of rectangle to use in the menubar for the given text rect + virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const = 0; + + // get the struct storing all layout info needed to draw all menu items + // (this can't be calculated for each item separately as they should be + // aligned) + // + // the returned pointer must be deleted by the caller + virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win, + const wxMenu& menu) const = 0; +#endif // wxUSE_MENUS + +#if wxUSE_STATUSBAR + // get the borders around the status bar fields (x and y fields of the + // return value) + virtual wxSize GetStatusBarBorders() const = 0; + + // get the border between the status bar fields + virtual wxCoord GetStatusBarBorderBetweenFields() const = 0; + + // get the mergin between a field and its border + virtual wxSize GetStatusBarFieldMargins() const = 0; +#endif // wxUSE_STATUSBAR + + // get client area rectangle of top level window (i.e. subtract + // decorations from given rectangle) + virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const = 0; + + // get size of whole top level window, given size of its client area size + virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const = 0; + + // get the minimal size of top level window + virtual wxSize GetFrameMinSize(int flags) const = 0; + + // get titlebar icon size + virtual wxSize GetFrameIconSize() const = 0; + + // returns one of wxHT_TOPLEVEL_XXX constants + virtual int HitTestFrame(const wxRect& rect, + const wxPoint& pt, + int flags = 0) const = 0; + + // virtual dtor for any base class + virtual ~wxRenderer(); +}; + +// ---------------------------------------------------------------------------- +// wxDelegateRenderer: it is impossible to inherit from any of standard +// renderers as their declarations are in private code, but you can use this +// class to override only some of the Draw() functions - all the other ones +// will be left to the original renderer +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDelegateRenderer : public wxRenderer +{ +public: + wxDelegateRenderer(wxRenderer *renderer) : m_renderer(renderer) { } + + virtual void DrawBackground(wxDC& dc, + const wxColour& col, + const wxRect& rect, + int flags, + wxWindow *window = NULL ) wxOVERRIDE + { m_renderer->DrawBackground(dc, col, rect, flags, window ); } + virtual void DrawButtonSurface(wxDC& dc, + const wxColour& col, + const wxRect& rect, + int flags) wxOVERRIDE + { m_renderer->DrawButtonSurface(dc, col, rect, flags); } + virtual void DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0) wxOVERRIDE + { m_renderer->DrawFocusRect(win, dc, rect, flags); } + virtual void DrawLabel(wxDC& dc, + const wxString& label, + const wxRect& rect, + int flags = 0, + int align = wxALIGN_LEFT | wxALIGN_TOP, + int indexAccel = -1, + wxRect *rectBounds = NULL) wxOVERRIDE + { m_renderer->DrawLabel(dc, label, rect, + flags, align, indexAccel, rectBounds); } + virtual void DrawButtonLabel(wxDC& dc, + const wxString& label, + const wxBitmap& image, + const wxRect& rect, + int flags = 0, + int align = wxALIGN_LEFT | wxALIGN_TOP, + int indexAccel = -1, + wxRect *rectBounds = NULL) wxOVERRIDE + { m_renderer->DrawButtonLabel(dc, label, image, rect, + flags, align, indexAccel, rectBounds); } + virtual void DrawBorder(wxDC& dc, + wxBorder border, + const wxRect& rect, + int flags = 0, + wxRect *rectIn = NULL) wxOVERRIDE + { m_renderer->DrawBorder(dc, border, rect, flags, rectIn); } + virtual void DrawTextBorder(wxDC& dc, + wxBorder border, + const wxRect& rect, + int flags = 0, + wxRect *rectIn = NULL) wxOVERRIDE + { m_renderer->DrawTextBorder(dc, border, rect, flags, rectIn); } + virtual void DrawButtonBorder(wxDC& dc, + const wxRect& rect, + int flags = 0, + wxRect *rectIn = NULL) wxOVERRIDE + { m_renderer->DrawButtonBorder(dc, rect, flags, rectIn); } + virtual void DrawFrame(wxDC& dc, + const wxString& label, + const wxRect& rect, + int flags = 0, + int align = wxALIGN_LEFT, + int indexAccel = -1) wxOVERRIDE + { m_renderer->DrawFrame(dc, label, rect, flags, align, indexAccel); } + virtual void DrawHorizontalLine(wxDC& dc, + wxCoord y, wxCoord x1, wxCoord x2) wxOVERRIDE + { m_renderer->DrawHorizontalLine(dc, y, x1, x2); } + virtual void DrawVerticalLine(wxDC& dc, + wxCoord x, wxCoord y1, wxCoord y2) wxOVERRIDE + { m_renderer->DrawVerticalLine(dc, x, y1, y2); } + virtual void DrawArrow(wxDC& dc, + wxDirection dir, + const wxRect& rect, + int flags = 0) wxOVERRIDE + { m_renderer->DrawArrow(dc, dir, rect, flags); } + virtual void DrawScrollbarArrow(wxDC& dc, + wxDirection dir, + const wxRect& rect, + int flags = 0) wxOVERRIDE + { m_renderer->DrawScrollbarArrow(dc, dir, rect, flags); } + virtual void DrawScrollbarThumb(wxDC& dc, + wxOrientation orient, + const wxRect& rect, + int flags = 0) wxOVERRIDE + { m_renderer->DrawScrollbarThumb(dc, orient, rect, flags); } + virtual void DrawScrollbarShaft(wxDC& dc, + wxOrientation orient, + const wxRect& rect, + int flags = 0) wxOVERRIDE + { m_renderer->DrawScrollbarShaft(dc, orient, rect, flags); } + virtual void DrawScrollCorner(wxDC& dc, + const wxRect& rect) wxOVERRIDE + { m_renderer->DrawScrollCorner(dc, rect); } + virtual void DrawItem(wxDC& dc, + const wxString& label, + const wxRect& rect, + int flags = 0) wxOVERRIDE + { m_renderer->DrawItem(dc, label, rect, flags); } + virtual void DrawCheckItem(wxDC& dc, + const wxString& label, + const wxBitmap& bitmap, + const wxRect& rect, + int flags = 0) wxOVERRIDE + { m_renderer->DrawCheckItem(dc, label, bitmap, rect, flags); } + virtual void DrawCheckButton(wxDC& dc, + const wxString& label, + const wxBitmap& bitmap, + const wxRect& rect, + int flags = 0, + wxAlignment align = wxALIGN_LEFT, + int indexAccel = -1) wxOVERRIDE + { m_renderer->DrawCheckButton(dc, label, bitmap, rect, + flags, align, indexAccel); } + virtual void DrawRadioButton(wxDC& dc, + const wxString& label, + const wxBitmap& bitmap, + const wxRect& rect, + int flags = 0, + wxAlignment align = wxALIGN_LEFT, + int indexAccel = -1) wxOVERRIDE + { m_renderer->DrawRadioButton(dc, label, bitmap, rect, + flags, align, indexAccel); } +#if wxUSE_TOOLBAR + virtual void DrawToolBarButton(wxDC& dc, + const wxString& label, + const wxBitmap& bitmap, + const wxRect& rect, + int flags = 0, + long style = 0, + int tbarStyle = 0) wxOVERRIDE + { m_renderer->DrawToolBarButton(dc, label, bitmap, rect, flags, style, tbarStyle); } +#endif // wxUSE_TOOLBAR + +#if wxUSE_TEXTCTRL + virtual void DrawTextLine(wxDC& dc, + const wxString& text, + const wxRect& rect, + int selStart = -1, + int selEnd = -1, + int flags = 0) wxOVERRIDE + { m_renderer->DrawTextLine(dc, text, rect, selStart, selEnd, flags); } + virtual void DrawLineWrapMark(wxDC& dc, const wxRect& rect) wxOVERRIDE + { m_renderer->DrawLineWrapMark(dc, rect); } +#endif // wxUSE_TEXTCTRL + +#if wxUSE_NOTEBOOK + virtual void DrawTab(wxDC& dc, + const wxRect& rect, + wxDirection dir, + const wxString& label, + const wxBitmap& bitmap = wxNullBitmap, + int flags = 0, + int accel = -1) wxOVERRIDE + { m_renderer->DrawTab(dc, rect, dir, label, bitmap, flags, accel); } +#endif // wxUSE_NOTEBOOK + +#if wxUSE_SLIDER + + virtual void DrawSliderShaft(wxDC& dc, + const wxRect& rect, + int lenThumb, + wxOrientation orient, + int flags = 0, + long style = 0, + wxRect *rectShaft = NULL) wxOVERRIDE + { m_renderer->DrawSliderShaft(dc, rect, lenThumb, orient, flags, style, rectShaft); } + virtual void DrawSliderThumb(wxDC& dc, + const wxRect& rect, + wxOrientation orient, + int flags = 0, + long style = 0) wxOVERRIDE + { m_renderer->DrawSliderThumb(dc, rect, orient, flags, style); } + virtual void DrawSliderTicks(wxDC& dc, + const wxRect& rect, + int lenThumb, + wxOrientation orient, + int start, + int end, + int WXUNUSED(step) = 1, + int flags = 0, + long style = 0) wxOVERRIDE + { m_renderer->DrawSliderTicks(dc, rect, lenThumb, orient, + start, end, start, flags, style); } +#endif // wxUSE_SLIDER + +#if wxUSE_MENUS + virtual void DrawMenuBarItem(wxDC& dc, + const wxRect& rect, + const wxString& label, + int flags = 0, + int indexAccel = -1) wxOVERRIDE + { m_renderer->DrawMenuBarItem(dc, rect, label, flags, indexAccel); } + virtual void DrawMenuItem(wxDC& dc, + wxCoord y, + const wxMenuGeometryInfo& gi, + const wxString& label, + const wxString& accel, + const wxBitmap& bitmap = wxNullBitmap, + int flags = 0, + int indexAccel = -1) wxOVERRIDE + { m_renderer->DrawMenuItem(dc, y, gi, label, accel, + bitmap, flags, indexAccel); } + virtual void DrawMenuSeparator(wxDC& dc, + wxCoord y, + const wxMenuGeometryInfo& geomInfo) wxOVERRIDE + { m_renderer->DrawMenuSeparator(dc, y, geomInfo); } +#endif // wxUSE_MENUS + +#if wxUSE_STATUSBAR + virtual void DrawStatusField(wxDC& dc, + const wxRect& rect, + const wxString& label, + int flags = 0, int style = 0) wxOVERRIDE + { m_renderer->DrawStatusField(dc, rect, label, flags, style); } +#endif // wxUSE_STATUSBAR + + virtual void DrawFrameTitleBar(wxDC& dc, + const wxRect& rect, + const wxString& title, + const wxIcon& icon, + int flags, + int specialButton = 0, + int specialButtonFlag = 0) wxOVERRIDE + { m_renderer->DrawFrameTitleBar(dc, rect, title, icon, flags, + specialButton, specialButtonFlag); } + virtual void DrawFrameBorder(wxDC& dc, + const wxRect& rect, + int flags) wxOVERRIDE + { m_renderer->DrawFrameBorder(dc, rect, flags); } + virtual void DrawFrameBackground(wxDC& dc, + const wxRect& rect, + int flags) wxOVERRIDE + { m_renderer->DrawFrameBackground(dc, rect, flags); } + virtual void DrawFrameTitle(wxDC& dc, + const wxRect& rect, + const wxString& title, + int flags) wxOVERRIDE + { m_renderer->DrawFrameTitle(dc, rect, title, flags); } + virtual void DrawFrameIcon(wxDC& dc, + const wxRect& rect, + const wxIcon& icon, + int flags) wxOVERRIDE + { m_renderer->DrawFrameIcon(dc, rect, icon, flags); } + virtual void DrawFrameButton(wxDC& dc, + wxCoord x, wxCoord y, + int button, + int flags = 0) wxOVERRIDE + { m_renderer->DrawFrameButton(dc, x, y, button, flags); } + +#if wxUSE_COMBOBOX + virtual void GetComboBitmaps(wxBitmap *bmpNormal, + wxBitmap *bmpFocus, + wxBitmap *bmpPressed, + wxBitmap *bmpDisabled) wxOVERRIDE + { m_renderer->GetComboBitmaps(bmpNormal, bmpFocus, + bmpPressed, bmpDisabled); } +#endif // wxUSE_COMBOBOX + + virtual void AdjustSize(wxSize *size, const wxWindow *window) wxOVERRIDE + { m_renderer->AdjustSize(size, window); } + virtual wxRect GetBorderDimensions(wxBorder border) const wxOVERRIDE + { return m_renderer->GetBorderDimensions(border); } + virtual bool AreScrollbarsInsideBorder() const wxOVERRIDE + { return m_renderer->AreScrollbarsInsideBorder(); } + +#if wxUSE_SCROLLBAR + virtual wxSize GetScrollbarArrowSize() const wxOVERRIDE + { return m_renderer->GetScrollbarArrowSize(); } +#endif // wxUSE_SCROLLBAR + + virtual wxCoord GetListboxItemHeight(wxCoord fontHeight) wxOVERRIDE + { return m_renderer->GetListboxItemHeight(fontHeight); } + virtual wxSize GetCheckBitmapSize() const wxOVERRIDE + { return m_renderer->GetCheckBitmapSize(); } + virtual wxSize GetRadioBitmapSize() const wxOVERRIDE + { return m_renderer->GetRadioBitmapSize(); } + virtual wxCoord GetCheckItemMargin() const wxOVERRIDE + { return m_renderer->GetCheckItemMargin(); } + +#if wxUSE_TOOLBAR + virtual wxSize GetToolBarButtonSize(wxCoord *separator) const wxOVERRIDE + { return m_renderer->GetToolBarButtonSize(separator); } + virtual wxSize GetToolBarMargin() const wxOVERRIDE + { return m_renderer->GetToolBarMargin(); } +#endif // wxUSE_TOOLBAR + +#if wxUSE_TEXTCTRL + virtual wxRect GetTextTotalArea(const wxTextCtrl *text, + const wxRect& rect) const wxOVERRIDE + { return m_renderer->GetTextTotalArea(text, rect); } + virtual wxRect GetTextClientArea(const wxTextCtrl *text, + const wxRect& rect, + wxCoord *extraSpaceBeyond) const wxOVERRIDE + { return m_renderer->GetTextClientArea(text, rect, extraSpaceBeyond); } +#endif // wxUSE_TEXTCTRL + +#if wxUSE_NOTEBOOK + virtual wxSize GetTabIndent() const wxOVERRIDE { return m_renderer->GetTabIndent(); } + virtual wxSize GetTabPadding() const wxOVERRIDE { return m_renderer->GetTabPadding(); } +#endif // wxUSE_NOTEBOOK + +#if wxUSE_SLIDER + virtual wxCoord GetSliderDim() const wxOVERRIDE + { return m_renderer->GetSliderDim(); } + virtual wxCoord GetSliderTickLen() const wxOVERRIDE + { return m_renderer->GetSliderTickLen(); } + + virtual wxRect GetSliderShaftRect(const wxRect& rect, + int lenThumb, + wxOrientation orient, + long style = 0) const wxOVERRIDE + { return m_renderer->GetSliderShaftRect(rect, lenThumb, orient, style); } + virtual wxSize GetSliderThumbSize(const wxRect& rect, + int lenThumb, + wxOrientation orient) const wxOVERRIDE + { return m_renderer->GetSliderThumbSize(rect, lenThumb, orient); } +#endif // wxUSE_SLIDER + + virtual wxSize GetProgressBarStep() const wxOVERRIDE + { return m_renderer->GetProgressBarStep(); } + +#if wxUSE_MENUS + virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const wxOVERRIDE + { return m_renderer->GetMenuBarItemSize(sizeText); } + virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win, + const wxMenu& menu) const wxOVERRIDE + { return m_renderer->GetMenuGeometry(win, menu); } +#endif // wxUSE_MENUS + +#if wxUSE_STATUSBAR + virtual wxSize GetStatusBarBorders() const wxOVERRIDE + { return m_renderer->GetStatusBarBorders(); } + virtual wxCoord GetStatusBarBorderBetweenFields() const wxOVERRIDE + { return m_renderer->GetStatusBarBorderBetweenFields(); } + virtual wxSize GetStatusBarFieldMargins() const wxOVERRIDE + { return m_renderer->GetStatusBarFieldMargins(); } +#endif // wxUSE_STATUSBAR + + virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const wxOVERRIDE + { return m_renderer->GetFrameClientArea(rect, flags); } + virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const wxOVERRIDE + { return m_renderer->GetFrameTotalSize(clientSize, flags); } + virtual wxSize GetFrameMinSize(int flags) const wxOVERRIDE + { return m_renderer->GetFrameMinSize(flags); } + virtual wxSize GetFrameIconSize() const wxOVERRIDE + { return m_renderer->GetFrameIconSize(); } + virtual int HitTestFrame(const wxRect& rect, + const wxPoint& pt, + int flags) const wxOVERRIDE + { return m_renderer->HitTestFrame(rect, pt, flags); } + + virtual int DrawHeaderButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0, + wxHeaderSortIconType sortIcon = wxHDR_SORT_ICON_NONE, + wxHeaderButtonParams* params = NULL) wxOVERRIDE + { return m_renderer->DrawHeaderButton(win, dc, rect, flags, sortIcon, params); } + virtual void DrawTreeItemButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) wxOVERRIDE + { m_renderer->DrawTreeItemButton(win, dc, rect, flags); } + +protected: + wxRenderer *m_renderer; +}; + +// ---------------------------------------------------------------------------- +// wxControlRenderer: wraps the wxRenderer functions in a form easy to use from +// OnPaint() +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxControlRenderer +{ +public: + // create a renderer for this dc with this "fundamental" renderer + wxControlRenderer(wxWindow *control, wxDC& dc, wxRenderer *renderer); + + // operations + void DrawLabel(); + void DrawButtonLabel(const wxBitmap& bitmap = wxNullBitmap, + wxCoord marginX = 0, wxCoord marginY = 0); +#if wxUSE_LISTBOX + void DrawItems(const wxListBox *listbox, + size_t itemFirst, size_t itemLast); +#endif // wxUSE_LISTBOX +#if wxUSE_CHECKLISTBOX + void DrawCheckItems(const wxCheckListBox *listbox, + size_t itemFirst, size_t itemLast); +#endif // wxUSE_CHECKLISTBOX + void DrawButtonBorder(); + // the line must be either horizontal or vertical + void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); + void DrawFrame(); + void DrawBitmap(const wxBitmap& bitmap); + void DrawBackgroundBitmap(); + void DrawScrollbar(const wxScrollBar *scrollbar, int thumbPosOld); +#if wxUSE_GAUGE + void DrawProgressBar(const wxGauge *gauge); +#endif // wxUSE_GAUGE + + // accessors + wxWindow *GetWindow() const { return m_window; } + wxRenderer *GetRenderer() const { return m_renderer; } + + wxDC& GetDC() { return m_dc; } + + const wxRect& GetRect() const { return m_rect; } + wxRect& GetRect() { return m_rect; } + + // static helpers + static void DrawBitmap(wxDC &dc, + const wxBitmap& bitmap, + const wxRect& rect, + int alignment = wxALIGN_CENTRE | + wxALIGN_CENTRE_VERTICAL, + wxStretch stretch = wxSTRETCH_NOT); + +private: + +#if wxUSE_LISTBOX + // common part of DrawItems() and DrawCheckItems() + void DoDrawItems(const wxListBox *listbox, + size_t itemFirst, size_t itemLast, + bool isCheckLbox = false); +#endif // wxUSE_LISTBOX + + wxWindow *m_window; + wxRenderer *m_renderer; + wxDC& m_dc; + wxRect m_rect; +}; + +#endif // _WX_UNIV_RENDERER_H_ diff --git a/lib/wxWidgets/include/wx/univ/scrarrow.h b/lib/wxWidgets/include/wx/univ/scrarrow.h new file mode 100644 index 0000000..5746c76 --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/scrarrow.h @@ -0,0 +1,113 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/scrarrow.h +// Purpose: wxScrollArrows class +// Author: Vadim Zeitlin +// Modified by: +// Created: 22.01.01 +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_SCRARROW_H_ +#define _WX_UNIV_SCRARROW_H_ + +#if wxUSE_SCROLLBAR +// ---------------------------------------------------------------------------- +// wxScrollArrows is not a control but just a class containing the common +// functionality of scroll arrows, whether part of scrollbars, spin ctrls or +// anything else. +// +// To customize its behaviour, wxScrollArrows doesn't use any virtual methods +// but instead a callback pointer to a wxControlWithArrows object which is used +// for all control-dependent stuff. Thus, to use wxScrollArrows, you just need +// to derive from the wxControlWithArrows interface and implement its methods. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxControlWithArrows; +class WXDLLIMPEXP_FWD_CORE wxDC; +class WXDLLIMPEXP_FWD_CORE wxMouseEvent; +class WXDLLIMPEXP_FWD_CORE wxRect; +class WXDLLIMPEXP_FWD_CORE wxRenderer; + +// ---------------------------------------------------------------------------- +// wxScrollArrows: an abstraction of scrollbar arrow +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxScrollArrows +{ +public: + enum Arrow + { + Arrow_None = -1, + Arrow_First, // left or top + Arrow_Second, // right or bottom + Arrow_Max + }; + + // ctor requires a back pointer to wxControlWithArrows + wxScrollArrows(wxControlWithArrows *control); + + // draws the arrow on the given DC in the given rectangle, uses + // wxControlWithArrows::GetArrowState() to get its current state + void DrawArrow(Arrow arrow, wxDC& dc, const wxRect& rect, + bool scrollbarLike = false) const; + + // process a mouse move, enter or leave event, possibly calling + // wxControlWithArrows::SetArrowState() if + // wxControlWithArrows::HitTestArrow() says that the mouse has left/entered + // an arrow + bool HandleMouseMove(const wxMouseEvent& event) const; + + // process a mouse click event + bool HandleMouse(const wxMouseEvent& event) const; + + // dtor + ~wxScrollArrows(); + +private: + // set or clear the wxCONTROL_CURRENT flag for the arrow + void UpdateCurrentFlag(Arrow arrow, Arrow arrowCur) const; + + // the main control + wxControlWithArrows *m_control; + + // the data for the mouse capture + struct wxScrollArrowCaptureData *m_captureData; +}; + +// ---------------------------------------------------------------------------- +// wxControlWithArrows: interface implemented by controls using wxScrollArrows +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxControlWithArrows +{ +public: + virtual ~wxControlWithArrows() {} + + // get the renderer to use for drawing the arrows + virtual wxRenderer *GetRenderer() const = 0; + + // get the controls window (used for mouse capturing) + virtual wxWindow *GetWindow() = 0; + + // get the orientation of the arrows (vertical or horizontal) + virtual bool IsVertical() const = 0; + + // get the state of this arrow as combination of wxCONTROL_XXX flags + virtual int GetArrowState(wxScrollArrows::Arrow arrow) const = 0; + + // set or clear the specified flag in the arrow state: this function is + // responsible for refreshing the control + virtual void SetArrowFlag(wxScrollArrows::Arrow arrow, + int flag, bool set = true) = 0; + + // hit testing: return on which arrow the point is (or Arrow_None) + virtual wxScrollArrows::Arrow HitTestArrow(const wxPoint& pt) const = 0; + + // called when the arrow is pressed, return true to continue scrolling and + // false to stop it + virtual bool OnArrow(wxScrollArrows::Arrow arrow) = 0; +}; +#endif // wxUSE_SCROLLBAR + +#endif // _WX_UNIV_SCRARROW_H_ diff --git a/lib/wxWidgets/include/wx/univ/scrolbar.h b/lib/wxWidgets/include/wx/univ/scrolbar.h new file mode 100644 index 0000000..acc1d3a --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/scrolbar.h @@ -0,0 +1,282 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/scrolbar.h +// Purpose: wxScrollBar for wxUniversal +// Author: Vadim Zeitlin +// Modified by: +// Created: 20.08.00 +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_SCROLBAR_H_ +#define _WX_UNIV_SCROLBAR_H_ + +class WXDLLIMPEXP_FWD_CORE wxScrollTimer; + +#include "wx/univ/scrarrow.h" +#include "wx/renderer.h" + +// ---------------------------------------------------------------------------- +// the actions supported by this control +// ---------------------------------------------------------------------------- + +// scroll the bar +#define wxACTION_SCROLL_START wxT("start") // to the beginning +#define wxACTION_SCROLL_END wxT("end") // to the end +#define wxACTION_SCROLL_LINE_UP wxT("lineup") // one line up/left +#define wxACTION_SCROLL_PAGE_UP wxT("pageup") // one page up/left +#define wxACTION_SCROLL_LINE_DOWN wxT("linedown") // one line down/right +#define wxACTION_SCROLL_PAGE_DOWN wxT("pagedown") // one page down/right + +// the scrollbar thumb may be dragged +#define wxACTION_SCROLL_THUMB_DRAG wxT("thumbdrag") +#define wxACTION_SCROLL_THUMB_MOVE wxT("thumbmove") +#define wxACTION_SCROLL_THUMB_RELEASE wxT("thumbrelease") + +// ---------------------------------------------------------------------------- +// wxScrollBar +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxScrollBar : public wxScrollBarBase, + public wxControlWithArrows +{ +public: + // scrollbar elements: they correspond to wxHT_SCROLLBAR_XXX constants but + // start from 0 which allows to use them as array indices + enum Element + { + Element_Arrow_Line_1, + Element_Arrow_Line_2, + Element_Arrow_Page_1, + Element_Arrow_Page_2, + Element_Thumb, + Element_Bar_1, + Element_Bar_2, + Element_Max + }; + + wxScrollBar(); + wxScrollBar(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSB_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxScrollBarNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSB_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxScrollBarNameStr)); + + virtual ~wxScrollBar(); + + // implement base class pure virtuals + virtual int GetThumbPosition() const wxOVERRIDE; + virtual int GetThumbSize() const wxOVERRIDE; + virtual int GetPageSize() const wxOVERRIDE; + virtual int GetRange() const wxOVERRIDE; + + virtual void SetThumbPosition(int thumbPos) wxOVERRIDE; + virtual void SetScrollbar(int position, int thumbSize, + int range, int pageSize, + bool refresh = true) wxOVERRIDE; + + // wxScrollBar actions + void ScrollToStart(); + void ScrollToEnd(); + bool ScrollLines(int nLines) wxOVERRIDE; + bool ScrollPages(int nPages) wxOVERRIDE; + + virtual bool PerformAction(const wxControlAction& action, + long numArg = 0, + const wxString& strArg = wxEmptyString) wxOVERRIDE; + + static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) wxOVERRIDE + { + return GetStdInputHandler(handlerDef); + } + + // scrollbars around a normal window should not receive the focus + virtual bool AcceptsFocus() const wxOVERRIDE; + + // wxScrollBar sub elements state (combination of wxCONTROL_XXX) + void SetState(Element which, int flags); + int GetState(Element which) const; + + // implement wxControlWithArrows methods + virtual wxRenderer *GetRenderer() const wxOVERRIDE { return m_renderer; } + virtual wxWindow *GetWindow() wxOVERRIDE { return this; } + virtual bool IsVertical() const wxOVERRIDE { return wxScrollBarBase::IsVertical(); } + virtual int GetArrowState(wxScrollArrows::Arrow arrow) const wxOVERRIDE; + virtual void SetArrowFlag(wxScrollArrows::Arrow arrow, int flag, bool set) wxOVERRIDE; + virtual bool OnArrow(wxScrollArrows::Arrow arrow) wxOVERRIDE; + virtual wxScrollArrows::Arrow HitTestArrow(const wxPoint& pt) const wxOVERRIDE; + + // for wxControlRenderer::DrawScrollbar() only + const wxScrollArrows& GetArrows() const { return m_arrows; } + + // returns one of wxHT_SCROLLBAR_XXX constants + wxHitTest HitTestBar(const wxPoint& pt) const; + + // idle processing + virtual void OnInternalIdle() wxOVERRIDE; + +protected: + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + virtual void DoDraw(wxControlRenderer *renderer) wxOVERRIDE; + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + + // forces update of thumb's visual appearance (does nothing if m_dirty=false) + void UpdateThumb(); + + // SetThumbPosition() helper + void DoSetThumb(int thumbPos); + + // common part of all ctors + void Init(); + + // is this scrollbar attached to a window or a standalone control? + bool IsStandalone() const; + + // scrollbar geometry methods: + + // gets the bounding box for a scrollbar element for the given (by default + // - current) thumb position + wxRect GetScrollbarRect(wxScrollBar::Element elem, int thumbPos = -1) const; + + // returns the size of the scrollbar shaft excluding the arrows + wxCoord GetScrollbarSize() const; + + // translate the scrollbar position (in logical units) into physical + // coordinate (in pixels) and the other way round + wxCoord ScrollbarToPixel(int thumbPos = -1); + int PixelToScrollbar(wxCoord coord); + + // return the starting and ending positions, in pixels, of the thumb of a + // scrollbar with the given logical position, thumb size and range and the + // given physical length + static void GetScrollBarThumbSize(wxCoord length, + int thumbPos, + int thumbSize, + int range, + wxCoord *thumbStart, + wxCoord *thumbEnd); + +private: + // total range of the scrollbar in logical units + int m_range; + + // the current and previous (after last refresh - this is used for + // repainting optimisation) size of the thumb in logical units (from 0 to + // m_range) and its position (from 0 to m_range - m_thumbSize) + int m_thumbSize, + m_thumbPos, + m_thumbPosOld; + + // the page size, i.e. the number of lines by which to scroll when page + // up/down action is performed + int m_pageSize; + + // the state of the sub elements + int m_elementsState[Element_Max]; + + // the dirty flag: if set, scrollbar must be updated + bool m_dirty; + + // the object handling the arrows + wxScrollArrows m_arrows; + + friend class WXDLLIMPEXP_FWD_CORE wxControlRenderer; // for geometry methods + friend class wxStdScrollBarInputHandler; // for geometry methods + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxScrollBar); +}; + +// ---------------------------------------------------------------------------- +// Standard scrollbar input handler which can be used as a base class +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxStdScrollBarInputHandler : public wxStdInputHandler +{ +public: + // constructor takes a renderer (used for scrollbar hit testing) and the + // base handler to which all unhandled events are forwarded + wxStdScrollBarInputHandler(wxRenderer *renderer, + wxInputHandler *inphand); + + virtual bool HandleKey(wxInputConsumer *consumer, + const wxKeyEvent& event, + bool pressed) wxOVERRIDE; + virtual bool HandleMouse(wxInputConsumer *consumer, + const wxMouseEvent& event) wxOVERRIDE; + virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event) wxOVERRIDE; + + virtual ~wxStdScrollBarInputHandler(); + + // this method is called by wxScrollBarTimer only and may be overridden + // + // return true to continue scrolling, false to stop the timer + virtual bool OnScrollTimer(wxScrollBar *scrollbar, + const wxControlAction& action); + +protected: + // return true if the mouse button can be used to activate scrollbar, false + // if not (any button under GTK+ unlike left button only which is default) + virtual bool IsAllowedButton(int button) const + { return button == wxMOUSE_BTN_LEFT; } + + // set or clear the specified flag on the scrollbar element corresponding + // to m_htLast + void SetElementState(wxScrollBar *scrollbar, int flag, bool doIt); + + // [un]highlight the scrollbar element corresponding to m_htLast + virtual void Highlight(wxScrollBar *scrollbar, bool doIt) + { SetElementState(scrollbar, wxCONTROL_CURRENT, doIt); } + + // [un]press the scrollbar element corresponding to m_htLast + virtual void Press(wxScrollBar *scrollbar, bool doIt) + { SetElementState(scrollbar, wxCONTROL_PRESSED, doIt); } + + // stop scrolling because we reached the end point + void StopScrolling(wxScrollBar *scrollbar); + + // get the mouse coordinates in the scrollbar direction from the event + wxCoord GetMouseCoord(const wxScrollBar *scrollbar, + const wxMouseEvent& event) const; + + // generate a "thumb move" action for this mouse event + void HandleThumbMove(wxScrollBar *scrollbar, const wxMouseEvent& event); + + + // the window (scrollbar) which has capture or NULL and the flag telling if + // the mouse is inside the element which captured it or not + wxWindow *m_winCapture; + bool m_winHasMouse; + int m_btnCapture; // the mouse button which has captured mouse + + // the position where we started scrolling by page + wxPoint m_ptStartScrolling; + + // one of wxHT_SCROLLBAR_XXX value: where has the mouse been last time? + wxHitTest m_htLast; + + // the renderer (we use it only for hit testing) + wxRenderer *m_renderer; + + // the offset of the top/left of the scrollbar relative to the mouse to + // keep during the thumb drag + int m_ofsMouse; + + // the timer for generating scroll events when the mouse stays pressed on + // a scrollbar + wxScrollTimer *m_timerScroll; +}; + +#endif // _WX_UNIV_SCROLBAR_H_ + diff --git a/lib/wxWidgets/include/wx/univ/scrthumb.h b/lib/wxWidgets/include/wx/univ/scrthumb.h new file mode 100644 index 0000000..3da2e71 --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/scrthumb.h @@ -0,0 +1,139 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/scrthumb.h +// Purpose: wxScrollThumb class +// Author: Vadim Zeitlin +// Modified by: +// Created: 12.02.01 +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_SCRTHUMB_H_ +#define _WX_UNIV_SCRTHUMB_H_ + +// ---------------------------------------------------------------------------- +// wxScrollThumb is not a control but just a class containing the common +// functionality of scroll thumb such as used by scrollbars, sliders and maybe +// other (user) controls +// +// This class is similar to wxScrollThumb. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxControlWithThumb; +class WXDLLIMPEXP_FWD_CORE wxMouseEvent; +class WXDLLIMPEXP_FWD_CORE wxRect; +class WXDLLIMPEXP_FWD_CORE wxScrollTimer; + +#include "wx/timer.h" + +// ---------------------------------------------------------------------------- +// wxScrollThumb: an abstraction of scrollbar thumb +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxScrollThumb +{ +public: + enum Shaft + { + Shaft_None = -1, + Shaft_Above, // or to the left of the thumb + Shaft_Below, // or to the right of the thumb + Shaft_Thumb, // on the thumb + Shaft_Max + }; + + // ctor requires a back pointer to wxControlWithThumb + wxScrollThumb(wxControlWithThumb *control); + + // process a mouse click: will capture the mouse if the button was pressed + // on either the thumb (start dragging it then) or the shaft (start + // scrolling) + bool HandleMouse(const wxMouseEvent& event) const; + + // process a mouse move + bool HandleMouseMove(const wxMouseEvent& event) const; + + // dtor + ~wxScrollThumb(); + +private: + // do we have the mouse capture? + bool HasCapture() const { return m_captureData != NULL; } + + // get the coord of this event in the direction we're interested in (y for + // vertical shaft or x for horizontal ones) + wxCoord GetMouseCoord(const wxMouseEvent& event) const; + + // get the position of the thumb corresponding to the current mouse + // position (can only be called while we're dragging the thumb!) + int GetThumbPos(const wxMouseEvent& event) const; + + // the main control + wxControlWithThumb *m_control; + + // the part of it where the mouse currently is + Shaft m_shaftPart; + + // the data for the mouse capture + struct WXDLLIMPEXP_FWD_CORE wxScrollThumbCaptureData *m_captureData; +}; + +// ---------------------------------------------------------------------------- +// wxControlWithThumb: interface implemented by controls using wxScrollThumb +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxControlWithThumb +{ +public: + virtual ~wxControlWithThumb() {} + + // simple accessors + // ---------------- + + // get the controls window (used for mouse capturing) + virtual wxWindow *GetWindow() = 0; + + // get the orientation of the shaft (vertical or horizontal) + virtual bool IsVertical() const = 0; + + // geometry functions + // ------------------ + + // hit testing: return part of the shaft the point is in (or Shaft_None) + virtual wxScrollThumb::Shaft HitTest(const wxPoint& pt) const = 0; + + // get the current position in pixels of the thumb + virtual wxCoord ThumbPosToPixel() const = 0; + + // transform from pixel offset to the thumb logical position + virtual int PixelToThumbPos(wxCoord x) const = 0; + + // callbacks + // --------- + + // set or clear the specified flag in the arrow state: this function is + // responsible for refreshing the control + virtual void SetShaftPartState(wxScrollThumb::Shaft shaftPart, + int flag, + bool set = true) = 0; + + // called when the user starts dragging the thumb + virtual void OnThumbDragStart(int pos) = 0; + + // called while the user drags the thumb + virtual void OnThumbDrag(int pos) = 0; + + // called when the user stops dragging the thumb + virtual void OnThumbDragEnd(int pos) = 0; + + // called before starting to call OnPageScroll() - gives the control the + // possibility to remember its current state + virtual void OnPageScrollStart() = 0; + + // called while the user keeps the mouse pressed above/below the thumb, + // return true to continue scrollign and false to stop it (e.g. because the + // scrollbar has reached the top/bottom) + virtual bool OnPageScroll(int pageInc) = 0; +}; + +#endif // _WX_UNIV_SCRTHUMB_H_ diff --git a/lib/wxWidgets/include/wx/univ/scrtimer.h b/lib/wxWidgets/include/wx/univ/scrtimer.h new file mode 100644 index 0000000..f7c079f --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/scrtimer.h @@ -0,0 +1,50 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/scrtimer.h +// Purpose: wxScrollTimer: small helper class for wxScrollArrow/Thumb +// Author: Vadim Zeitlin +// Modified by: +// Created: 18.02.01 +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_SCRTIMER_H +#define _WX_UNIV_SCRTIMER_H + +// NB: this class is implemented in scrolbar.cpp + +#include "wx/defs.h" + +#if wxUSE_TIMER + +#include "wx/timer.h" + +// ---------------------------------------------------------------------------- +// wxScrollTimer: the timer used when the arrow or scrollbar shaft is kept +// pressed +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxScrollTimer : public wxTimer +{ +public: + // default ctor + wxScrollTimer(); + + // start generating the events + void StartAutoScroll(); + + // the base class method + virtual void Notify() wxOVERRIDE; + +protected: + // to implement in derived classes: perform the scroll action and return + // true to continue scrolling or false to stop + virtual bool DoNotify() = 0; + + // should we skip the next timer event? + bool m_skipNext; +}; + +#endif // wxUSE_TIMER + +#endif // _WX_UNIV_SCRTIMER_H diff --git a/lib/wxWidgets/include/wx/univ/setup.h b/lib/wxWidgets/include/wx/univ/setup.h new file mode 100644 index 0000000..b507d42 --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/setup.h @@ -0,0 +1,1816 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/setup.h +// Purpose: Configuration for the universal build of the library +// Author: Julian Smart +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SETUP_H_ +#define _WX_SETUP_H_ + +/* --- start common options --- */ +// ---------------------------------------------------------------------------- +// global settings +// ---------------------------------------------------------------------------- + +// define this to 0 when building wxBase library - this can also be done from +// makefile/project file overriding the value here +#ifndef wxUSE_GUI + #define wxUSE_GUI 1 +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// compatibility settings +// ---------------------------------------------------------------------------- + +// This setting determines the compatibility with 2.8 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_8 0 + +// This setting determines the compatibility with 3.0 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_3_0 1 + +// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when +// default system font is used for wxWindow::GetCharWidth/Height() instead of +// the current font. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxDIALOG_UNIT_COMPATIBILITY 0 + +// Provide unsafe implicit conversions in wxString to "const char*" or +// "std::string" (depending on wxUSE_STD_STRING_CONV_IN_WXSTRING value). +// +// Default is 1 but only for compatibility reasons, it is recommended to set +// this to 0 because converting wxString to a narrow (non-Unicode) string may +// fail unless a locale using UTF-8 encoding is used, which is never the case +// under MSW, for example, hence such conversions can result in silent data +// loss. +// +// Recommended setting: 0 +#define wxUSE_UNSAFE_WXSTRING_CONV 1 + +// If set to 1, enables "reproducible builds", i.e. build output should be +// exactly the same if the same build is redone again. As using __DATE__ and +// __TIME__ macros clearly makes the build irreproducible, setting this option +// to 1 disables their use in the library code. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_REPRODUCIBLE_BUILD 0 + +// ---------------------------------------------------------------------------- +// debugging settings +// ---------------------------------------------------------------------------- + +// wxDEBUG_LEVEL will be defined as 1 in wx/debug.h so normally there is no +// need to define it here. You may do it for two reasons: either completely +// disable/compile out the asserts in release version (then do it inside #ifdef +// NDEBUG) or, on the contrary, enable more asserts, including the usually +// disabled ones, in the debug build (then do it inside #ifndef NDEBUG) +// +// #ifdef NDEBUG +// #define wxDEBUG_LEVEL 0 +// #else +// #define wxDEBUG_LEVEL 2 +// #endif + +// wxHandleFatalExceptions() may be used to catch the program faults at run +// time and, instead of terminating the program with a usual GPF message box, +// call the user-defined wxApp::OnFatalException() function. If you set +// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. +// +// This setting is for Win32 only and can only be enabled if your compiler +// supports Win32 structured exception handling (currently only VC++ does) +// +// Default is 1 +// +// Recommended setting: 1 if your compiler supports it. +#define wxUSE_ON_FATAL_EXCEPTION 1 + +// Set this to 1 to be able to generate a human-readable (unlike +// machine-readable minidump created by wxCrashReport::Generate()) stack back +// trace when your program crashes using wxStackWalker +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_STACKWALKER 1 + +// Set this to 1 to compile in wxDebugReport class which allows you to create +// and optionally upload to your web site a debug report consisting of back +// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, it is compiled into a separate library so there +// is no overhead if you don't use it +#define wxUSE_DEBUGREPORT 1 + +// Generic comment about debugging settings: they are very useful if you don't +// use any other memory leak detection tools such as Purify/BoundsChecker, but +// are probably redundant otherwise. Also, Visual C++ CRT has the same features +// as wxWidgets memory debugging subsystem built in since version 5.0 and you +// may prefer to use it instead of built in memory debugging code because it is +// faster and more fool proof. +// +// Using VC++ CRT memory debugging is enabled by default in debug build (_DEBUG +// is defined) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) +// and if __NO_VC_CRTDBG__ is not defined. + +// The rest of the options in this section are obsolete and not supported, +// enable them at your own risk. + +// If 1, enables wxDebugContext, for writing error messages to file, etc. If +// __WXDEBUG__ is not defined, will still use the normal memory operators. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_CONTEXT 0 + +// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* +// __WXDEBUG__ is also defined. +// +// WARNING: this code may not work with all architectures, especially if +// alignment is an issue. This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 1 if you are not using a memory debugging tool, else 0 +#define wxUSE_MEMORY_TRACING 0 + +// In debug mode, cause new and delete to be redefined globally. +// If this causes problems (e.g. link errors which is a common problem +// especially if you use another library which also redefines the global new +// and delete), set this to 0. +// This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If +// this causes problems (e.g. link errors), set this to 0. You may need to set +// this to 0 if using templates (at least for VC++). This switch is currently +// ignored for MinGW/Cygwin. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_NEW_ALWAYS 0 + + +// ---------------------------------------------------------------------------- +// Unicode support +// ---------------------------------------------------------------------------- + +// This option is deprecated: the library should be always built in Unicode mode +// now, only set wxUSE_UNICODE to 0 to compile legacy code in ANSI mode if +// absolutely necessary -- updating it is strongly recommended as the ANSI mode +// will disappear completely in future wxWidgets releases. +#ifndef wxUSE_UNICODE + #define wxUSE_UNICODE 1 +#endif + +// ---------------------------------------------------------------------------- +// global features +// ---------------------------------------------------------------------------- + +// Compile library in exception-safe mode? If set to 1, the library will try to +// behave correctly in presence of exceptions (even though it still will not +// use the exceptions itself) and notify the user code about any unhandled +// exceptions. If set to 0, propagation of the exceptions through the library +// code will lead to undefined behaviour -- but the code itself will be +// slightly smaller and faster. +// +// Note that like wxUSE_THREADS this option is automatically set to 0 if +// wxNO_EXCEPTIONS is defined. +// +// Default is 1 +// +// Recommended setting: depends on whether you intend to use C++ exceptions +// in your own code (1 if you do, 0 if you don't) +#define wxUSE_EXCEPTIONS 1 + +// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI +// +// This feature is incomplete and experimental, please only enable it if +// you want to participate in its development. +// +// Recommended setting: 0 (unless you wish to try working on it). +#define wxUSE_EXTENDED_RTTI 0 + +// Support for message/error logging. This includes wxLogXXX() functions and +// wxLog and derived classes. Don't set this to 0 unless you really know what +// you are doing. +// +// Default is 1 +// +// Recommended setting: 1 (always) +#define wxUSE_LOG 1 + +// Recommended setting: 1 +#define wxUSE_LOGWINDOW 1 + +// Recommended setting: 1 +#define wxUSE_LOGGUI 1 + +// Recommended setting: 1 +#define wxUSE_LOG_DIALOG 1 + +// Support for command line parsing using wxCmdLineParser class. +// +// Default is 1 +// +// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) +#define wxUSE_CMDLINE_PARSER 1 + +// Support for multithreaded applications: if 1, compile in thread classes +// (thread.h) and make the library a bit more thread safe. Although thread +// support is quite stable by now, you may still consider recompiling the +// library without it if you have no use for it - this will result in a +// somewhat smaller and faster operation. +// +// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset +// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in +// build/msw/config.* file this value will have no effect. +// +// Default is 1 +// +// Recommended setting: 0 unless you do plan to develop MT applications +#define wxUSE_THREADS 1 + +// If enabled, compiles wxWidgets streams classes +// +// wx stream classes are used for image IO, process IO redirection, network +// protocols implementation and much more and so disabling this results in a +// lot of other functionality being lost. +// +// Default is 1 +// +// Recommended setting: 1 as setting it to 0 disables many other things +#define wxUSE_STREAMS 1 + +// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. +// Note that if the system's implementation does not support positional +// parameters, setting this to 1 forces the use of the wxWidgets implementation +// of wxVsnprintf. The standard vsnprintf() supports positional parameters on +// many Unix systems but usually doesn't under Windows. +// +// Positional parameters are very useful when translating a program since using +// them in formatting strings allow translators to correctly reorder the +// translated sentences. +// +// Default is 1 +// +// Recommended setting: 1 if you want to support multiple languages +#define wxUSE_PRINTF_POS_PARAMS 1 + +// Enable the use of compiler-specific thread local storage keyword, if any. +// This is used for wxTLS_XXX() macros implementation and normally should use +// the compiler-provided support as it's simpler and more efficient, but is +// disabled under Windows in wx/msw/chkconf.h as it can't be used if wxWidgets +// is used in a dynamically loaded Win32 DLL (i.e. using LoadLibrary()) under +// XP as this triggers a bug in compiler TLS support that results in crashes +// when any TLS variables are used. +// +// If you're absolutely sure that your build of wxWidgets is never going to be +// used in such situation, either because it's not going to be linked from any +// kind of plugin or because you only target Vista or later systems, you can +// set this to 2 to force the use of compiler TLS even under MSW. +// +// Default is 1 meaning that compiler TLS is used only if it's 100% safe. +// +// Recommended setting: 2 if you want to have maximal performance and don't +// care about the scenario described above. +#define wxUSE_COMPILER_TLS 1 + +// ---------------------------------------------------------------------------- +// Interoperability with the standard library. +// ---------------------------------------------------------------------------- + +// Set wxUSE_STL to 1 to enable maximal interoperability with the standard +// library, even at the cost of backwards compatibility. +// +// Default is 0 +// +// Recommended setting: 0 as the options below already provide a relatively +// good level of interoperability and changing this option arguably isn't worth +// diverging from the official builds of the library. +#define wxUSE_STL 0 + +// This is not a real option but is used as the default value for +// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS_COMPATIBLY. +// +// Set it to 0 if you want to disable the use of all standard classes +// completely for some reason. +#define wxUSE_STD_DEFAULT 1 + +// Use standard C++ containers where it can be done without breaking backwards +// compatibility. +// +// This provides better interoperability with the standard library, e.g. with +// this option on it's possible to insert std::vector<> into many wxWidgets +// containers directly. +// +// Default is 1. +// +// Recommended setting is 1 unless you want to avoid all dependencies on the +// standard library. +#define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT + +// Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<> +// and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but +// usually more limited) implementations are used which allows to avoid the +// dependency on the C++ run-time library. +// +// Default is 0 for compatibility reasons. +// +// Recommended setting: 1 unless compatibility with the official wxWidgets +// build and/or the existing code is a concern. +#define wxUSE_STD_CONTAINERS 0 + +// Use standard C++ streams if 1 instead of wx streams in some places. If +// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the +// standard streams library. +// +// Notice that enabling this does not replace wx streams with std streams +// everywhere, in a lot of places wx streams are used no matter what. +// +// Default is 1 if compiler supports it. +// +// Recommended setting: 1 if you use the standard streams anyhow and so +// dependency on the standard streams library is not a +// problem +#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT + +// Enable minimal interoperability with the standard C++ string class if 1. +// "Minimal" means that wxString can be constructed from std::string or +// std::wstring but can't be implicitly converted to them. You need to enable +// the option below for the latter. +// +// Default is 1 for most compilers. +// +// Recommended setting: 1 unless you want to ensure your program doesn't use +// the standard C++ library at all. +#define wxUSE_STD_STRING wxUSE_STD_DEFAULT + +// Make wxString as much interchangeable with std::[w]string as possible, in +// particular allow implicit conversion of wxString to either of these classes. +// This comes at a price (or a benefit, depending on your point of view) of not +// allowing implicit conversion to "const char *" and "const wchar_t *". +// +// Because a lot of existing code relies on these conversions, this option is +// disabled by default but can be enabled for your build if you don't care +// about compatibility. +// +// Default is 0 if wxUSE_STL has its default value or 1 if it is enabled. +// +// Recommended setting: 0 to remain compatible with the official builds of +// wxWidgets. +#define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL + +// ---------------------------------------------------------------------------- +// non GUI features selection +// ---------------------------------------------------------------------------- + +// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit +// integer which is implemented in terms of native 64 bit integers if any or +// uses emulation otherwise. +// +// This class is required by wxDateTime and so you should enable it if you want +// to use wxDateTime. For most modern platforms, it will use the native 64 bit +// integers in which case (almost) all of its functions are inline and it +// almost does not take any space, so there should be no reason to switch it +// off. +// +// Recommended setting: 1 +#define wxUSE_LONGLONG 1 + +// Set wxUSE_BASE64 to 1, to compile in Base64 support. This is required for +// storing binary data in wxConfig on most platforms. +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_BASE64 1 + +// Set this to 1 to be able to use wxEventLoop even in console applications +// (i.e. using base library only, without GUI). This is mostly useful for +// processing socket events but is also necessary to use timers in console +// applications +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_CONSOLE_EVENTLOOP 1 + +// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level +// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. +// +// Default is 1 +// +// Recommended setting: 1 (wxFile is highly recommended as it is required by +// i18n code, wxFileConfig and others) +#define wxUSE_FILE 1 +#define wxUSE_FFILE 1 + +// Use wxFSVolume class providing access to the configured/active mount points +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely disabled if you don't use it) +#define wxUSE_FSVOLUME 1 + +// Use wxSecretStore class for storing passwords using OS-specific facilities. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely disabled if you don't use it) +#define wxUSE_SECRETSTORE 1 + +// Allow the use of the OS built-in spell checker in wxTextCtrl. +// +// Default is 1, the corresponding wxTextCtrl functions simply won't do +// anything if the functionality is not supported by the current platform. +// +// Recommended setting: 1 unless you want to save a tiny bit of code. +#define wxUSE_SPELLCHECK 1 + +// Use wxStandardPaths class which allows to retrieve some standard locations +// in the file system +// +// Default is 1 +// +// Recommended setting: 1 (may be disabled to save space, but not much) +#define wxUSE_STDPATHS 1 + +// use wxTextBuffer class: required by wxTextFile +#define wxUSE_TEXTBUFFER 1 + +// use wxTextFile class: requires wxFile and wxTextBuffer, required by +// wxFileConfig +#define wxUSE_TEXTFILE 1 + +// i18n support: _() macro, wxLocale class. +#define wxUSE_INTL 1 + +// Provide wxFoo_l() functions similar to standard foo() functions but taking +// an extra locale parameter. +// +// Notice that this is fully implemented only for the systems providing POSIX +// xlocale support or Microsoft Visual C++ >= 8 (which provides proprietary +// almost-equivalent of xlocale functions), otherwise wxFoo_l() functions will +// only work for the current user locale and "C" locale. You can use +// wxHAS_XLOCALE_SUPPORT to test whether the full support is available. +// +// Default is 1 +// +// Recommended setting: 1 but may be disabled if you are writing programs +// running only in C locale anyhow +#define wxUSE_XLOCALE 1 + +// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which +// allow to manipulate dates, times and time intervals. +// +// Requires: wxUSE_LONGLONG +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_DATETIME 1 + +// Set wxUSE_TIMER to 1 to compile wxTimer class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_TIMER 1 + +// Use wxStopWatch class. +// +// Default is 1 +// +// Recommended setting: 1 (needed by wxSocket) +#define wxUSE_STOPWATCH 1 + +// Set wxUSE_FSWATCHER to 1 if you want to enable wxFileSystemWatcher +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_FSWATCHER 1 + +// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes +// which allow the application to store its settings in the persistent +// storage. Setting this to 1 will also enable on-demand creation of the +// global config object in wxApp. +// +// See also wxUSE_CONFIG_NATIVE below. +// +// Recommended setting: 1 +#define wxUSE_CONFIG 1 + +// If wxUSE_CONFIG is 1, you may choose to use either the native config +// classes under Windows (using the registry) or the portable text file +// format used by the config classes under Unix. +// +// Default is 1 to use native classes. Note that you may still use +// wxFileConfig even if you set this to 1 - just the config object created by +// default for the applications needs will be a wxRegConfig or wxIniConfig and +// not wxFileConfig. +// +// Recommended setting: 1 +#define wxUSE_CONFIG_NATIVE 1 + +// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows +// to connect/disconnect from the network and be notified whenever the dial-up +// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DIALUP_MANAGER 1 + +// Compile in classes for run-time DLL loading and function calling. +// Required by wxUSE_DIALUP_MANAGER. +// +// This setting is for Win32 only +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DYNLIB_CLASS 1 + +// experimental, don't use for now +#define wxUSE_DYNAMIC_LOADER 1 + +// Set to 1 to use socket classes +#define wxUSE_SOCKETS 1 + +// Set to 1 to use ipv6 socket classes (requires wxUSE_SOCKETS) +// +// Default is 1. +// +// Recommended setting: 1. +#define wxUSE_IPV6 1 + +// Set to 1 to enable virtual file systems (required by wxHTML) +#define wxUSE_FILESYSTEM 1 + +// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ZIP 1 + +// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ARCHIVE 1 + +// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_INET 1 + +// wxArchive classes for accessing archives such as zip and tar +#define wxUSE_ARCHIVE_STREAMS 1 + +// Set to 1 to compile wxZipInput/OutputStream classes. +#define wxUSE_ZIPSTREAM 1 + +// Set to 1 to compile wxTarInput/OutputStream classes. +#define wxUSE_TARSTREAM 1 + +// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by +// wxUSE_LIBPNG +#define wxUSE_ZLIB 1 + +// Set to 1 if liblzma is available to enable wxLZMA{Input,Output}Stream +// classes. +// +// Notice that if you enable this build option when not using configure or +// CMake, you need to ensure that liblzma headers and libraries are available +// (i.e. by building the library yourself or downloading its binaries) and can +// be found, either by copying them to one of the locations searched by the +// compiler/linker by default (e.g. any of the directories in the INCLUDE or +// LIB environment variables, respectively, when using MSVC) or modify the +// make- or project files to add references to these directories. +// +// Default is 0 under MSW, auto-detected by configure. +// +// Recommended setting: 1 if you need LZMA compression. +#define wxUSE_LIBLZMA 0 + +// If enabled, the code written by Apple will be used to write, in a portable +// way, float on the disk. See extended.c for the license which is different +// from wxWidgets one. +// +// Default is 1. +// +// Recommended setting: 1 unless you don't like the license terms (unlikely) +#define wxUSE_APPLE_IEEE 1 + +// Joystick support class +#define wxUSE_JOYSTICK 1 + +// wxFontEnumerator class +#define wxUSE_FONTENUM 1 + +// wxFontMapper class +#define wxUSE_FONTMAP 1 + +// wxMimeTypesManager class +#define wxUSE_MIMETYPE 1 + +// wxWebRequest allows usage of system libraries for HTTP(S) requests. +// +// Note that for wxWebRequest to be built, at least one of its backends must be +// available. Under MSW and macOS this will always be the case unless +// explicitly disabled. +// +// Default is 1 +// +// Recommended setting: 1, setting it to 0 may be useful to avoid dependencies +// on libcurl on Unix systems. +#define wxUSE_WEBREQUEST 1 + +// wxWebRequest backend based on NSURLSession +// +// Default is 1 under macOS. +// +// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, +// otherwise wxWebRequest won't be available at all under Mac. +#ifdef __APPLE__ +#define wxUSE_WEBREQUEST_URLSESSION wxUSE_WEBREQUEST +#else +#define wxUSE_WEBREQUEST_URLSESSION 0 +#endif + +// wxWebRequest backend based on libcurl, can be used under all platforms. +// +// Default is 0 for MSW and macOS, detected automatically when using configure. +// +// Recommended setting: 0 on Windows and macOS, otherwise 1 as it is required +// for wxWebRequest to be available at all. +#define wxUSE_WEBREQUEST_CURL 0 + +// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP +// or wxURL you need to set this to 1. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_PROTOCOL 1 + +// The settings for the individual URL schemes +#define wxUSE_PROTOCOL_FILE 1 +#define wxUSE_PROTOCOL_FTP 1 +#define wxUSE_PROTOCOL_HTTP 1 + +// Define this to use wxURL class. +#define wxUSE_URL 1 + +// Define this to use native platform url and protocol support. +// Currently valid only for MS-Windows. +// Note: if you set this to 1, you can open ftp/http/gopher sites +// and obtain a valid input stream for these sites +// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. +// Doing so reduces the code size. +// +// This code is experimental and subject to change. +#define wxUSE_URL_NATIVE 0 + +// Support for wxVariant class used in several places throughout the library, +// notably in wxDataViewCtrl API. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size as much as +// possible in which case setting this to 0 can gain up to 100KB. +#define wxUSE_VARIANT 1 + +// Support for wxAny class, the successor for wxVariant. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size by a small amount, +// or your compiler cannot for some reason cope with complexity of templates used. +#define wxUSE_ANY 1 + +// Support for regular expression matching via wxRegEx class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_REGEX 1 + +// wxSystemOptions class +#define wxUSE_SYSTEM_OPTIONS 1 + +// wxSound class +#define wxUSE_SOUND 1 + +// Use wxMediaCtrl +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_MEDIACTRL 1 + +// Use wxWidget's XRC XML-based resource system. Recommended. +// +// Default is 1 +// +// Recommended setting: 1 (requires wxUSE_XML) +#define wxUSE_XRC 1 + +// XML parsing classes. +// +// Default is 1 +// +// Recommended setting: 1 (required by XRC) +#define wxUSE_XML 1 + +// Use wxWidget's AUI docking system +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_AUI 1 + +// Use wxWidget's Ribbon classes for interfaces +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_RIBBON 1 + +// Use wxPropertyGrid. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_PROPGRID 1 + +// Use wxStyledTextCtrl, a wxWidgets Scintilla wrapper. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STC 1 + +// Use wxWidget's web viewing classes +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_WEBVIEW 1 + +// Use the IE wxWebView backend +// +// Default is 1 on MSW +// +// Recommended setting: 1 +#ifdef __WXMSW__ +#define wxUSE_WEBVIEW_IE 1 +#else +#define wxUSE_WEBVIEW_IE 0 +#endif + +// Use the Edge (Chromium) wxWebView backend (Requires WebView2 SDK) +// +// Default is 0 because WebView2 is not always available, set it to 1 if you do have it. +// +// Recommended setting: 1 when building for Windows with WebView2 SDK +#define wxUSE_WEBVIEW_EDGE 0 + +// Use the Edge (Chromium) wxWebView backend without loader DLL +// +// Default is 0, set it to 1 if you don't want to depend on WebView2Loader.dll. +// +// Recommended setting: 0 +#define wxUSE_WEBVIEW_EDGE_STATIC 0 + +// Use the WebKit wxWebView backend +// +// Default is 1 on GTK and OSX +// +// Recommended setting: 1 +#if (defined(__WXGTK__) && !defined(__WXGTK3__)) || defined(__WXOSX__) +#define wxUSE_WEBVIEW_WEBKIT 1 +#else +#define wxUSE_WEBVIEW_WEBKIT 0 +#endif + +// Use the WebKit2 wxWebView backend +// +// Default is 1 on GTK3 +// +// Recommended setting: 1 +#if defined(__WXGTK3__) +#define wxUSE_WEBVIEW_WEBKIT2 1 +#else +#define wxUSE_WEBVIEW_WEBKIT2 0 +#endif + +// Enable wxGraphicsContext and related classes for a modern 2D drawing API. +// +// Default is 1 except if you're using a compiler without support for GDI+ +// under MSW, i.e. gdiplus.h and related headers (MSVC and MinGW >= 4.8 are +// known to have them). For other compilers (e.g. older mingw32) you may need +// to install the headers (and just the headers) yourself. If you do, change +// the setting below manually. +// +// Recommended setting: 1 if supported by the compilation environment + +// Notice that we can't use wxCHECK_VISUALC_VERSION() nor wxCHECK_GCC_VERSION() +// here as this file is included from wx/platform.h before they're defined. +#if defined(_MSC_VER) || \ + (defined(__MINGW32__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 8)) +#define wxUSE_GRAPHICS_CONTEXT 1 +#else +// Disable support for other Windows compilers, enable it if your compiler +// comes with new enough SDK or you installed the headers manually. +// +// Notice that this will be set by configure under non-Windows platforms +// anyhow so the value there is not important. +#define wxUSE_GRAPHICS_CONTEXT 0 +#endif + +// Enable wxGraphicsContext implementation using Cairo library. +// +// This is not needed under Windows and detected automatically by configure +// under other systems, however you may set this to 1 manually if you installed +// Cairo under Windows yourself and prefer to use it instead the native GDI+ +// implementation. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_CAIRO 0 + + +// ---------------------------------------------------------------------------- +// Individual GUI controls +// ---------------------------------------------------------------------------- + +// You must set wxUSE_CONTROLS to 1 if you are using any controls at all +// (without it, wxControl class is not compiled) +// +// Default is 1 +// +// Recommended setting: 1 (don't change except for very special programs) +#define wxUSE_CONTROLS 1 + +// Support markup in control labels, i.e. provide wxControl::SetLabelMarkup(). +// Currently markup is supported only by a few controls and only some ports but +// their number will increase with time. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you want to save on code size) +#define wxUSE_MARKUP 1 + +// wxPopupWindow class is a top level transient window. It is currently used +// to implement wxTipWindow +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) +#define wxUSE_POPUPWIN 1 + +// wxTipWindow allows to implement the custom tooltips, it is used by the +// context help classes. Requires wxUSE_POPUPWIN. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0) +#define wxUSE_TIPWINDOW 1 + +// Each of the settings below corresponds to one wxWidgets control. They are +// all switched on by default but may be disabled if you are sure that your +// program (including any standard dialogs it can show!) doesn't need them and +// if you desperately want to save some space. If you use any of these you must +// set wxUSE_CONTROLS as well. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_ACTIVITYINDICATOR 1 // wxActivityIndicator +#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl +#define wxUSE_BANNERWINDOW 1 // wxBannerWindow +#define wxUSE_BUTTON 1 // wxButton +#define wxUSE_BMPBUTTON 1 // wxBitmapButton +#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl +#define wxUSE_CHECKBOX 1 // wxCheckBox +#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) +#define wxUSE_CHOICE 1 // wxChoice +#define wxUSE_COLLPANE 1 // wxCollapsiblePane +#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl +#define wxUSE_COMBOBOX 1 // wxComboBox +#define wxUSE_COMMANDLINKBUTTON 1 // wxCommandLinkButton +#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl +#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl +#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl +#define wxUSE_EDITABLELISTBOX 1 // wxEditableListBox +#define wxUSE_FILECTRL 1 // wxFileCtrl +#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl +#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl +#define wxUSE_GAUGE 1 // wxGauge +#define wxUSE_HEADERCTRL 1 // wxHeaderCtrl +#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl +#define wxUSE_LISTBOX 1 // wxListBox +#define wxUSE_LISTCTRL 1 // wxListCtrl +#define wxUSE_RADIOBOX 1 // wxRadioBox +#define wxUSE_RADIOBTN 1 // wxRadioButton +#define wxUSE_RICHMSGDLG 1 // wxRichMessageDialog +#define wxUSE_SCROLLBAR 1 // wxScrollBar +#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl +#define wxUSE_SLIDER 1 // wxSlider +#define wxUSE_SPINBTN 1 // wxSpinButton +#define wxUSE_SPINCTRL 1 // wxSpinCtrl +#define wxUSE_STATBOX 1 // wxStaticBox +#define wxUSE_STATLINE 1 // wxStaticLine +#define wxUSE_STATTEXT 1 // wxStaticText +#define wxUSE_STATBMP 1 // wxStaticBitmap +#define wxUSE_TEXTCTRL 1 // wxTextCtrl +#define wxUSE_TIMEPICKCTRL 1 // wxTimePickerCtrl +#define wxUSE_TOGGLEBTN 1 // requires wxButton +#define wxUSE_TREECTRL 1 // wxTreeCtrl +#define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl + +// Use generic version of wxDataViewCtrl even if a native one is available? +// +// Default is 1. +// +// Recommended setting: 1, but can be set to 0 if your program is affected by +// the native control limitations. +#define wxUSE_NATIVE_DATAVIEWCTRL 1 + +// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR +// below either wxStatusBar95 or a generic wxStatusBar will be used. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STATUSBAR 1 + +// Two status bar implementations are available under Win32: the generic one +// or the wrapper around native control. For native look and feel the native +// version should be used. +// +// Default is 1 for the platforms where native status bar is supported. +// +// Recommended setting: 1 (there is no advantage in using the generic one) +#define wxUSE_NATIVE_STATUSBAR 1 + +// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar +// classes at all. Otherwise, use the native toolbar class unless +// wxUSE_TOOLBAR_NATIVE is 0. +// +// Default is 1 for all settings. +// +// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. +#define wxUSE_TOOLBAR 1 +#define wxUSE_TOOLBAR_NATIVE 1 + +// wxNotebook is a control with several "tabs" located on one of its sides. It +// may be used to logically organise the data presented to the user instead of +// putting everything in one huge dialog. It replaces wxTabControl and related +// classes of wxWin 1.6x. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTEBOOK 1 + +// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_LISTBOOK 1 + +// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CHOICEBOOK 1 + +// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TREEBOOK 1 + +// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of +// tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLBOOK 1 + +// wxTaskBarIcon is a small notification icon shown in the system toolbar or +// dock. +// +// Default is 1. +// +// Recommended setting: 1 (but can be set to 0 if you don't need it) +#define wxUSE_TASKBARICON 1 + +// wxGrid class +// +// Default is 1, set to 0 to cut down compilation time and binaries size if you +// don't use it. +// +// Recommended setting: 1 +// +#define wxUSE_GRID 1 + +// wxMiniFrame class: a frame with narrow title bar +// +// Default is 1. +// +// Recommended setting: 1 (it doesn't cost almost anything) +#define wxUSE_MINIFRAME 1 + +// wxComboCtrl and related classes: combobox with custom popup window and +// not necessarily a listbox. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it +// is used by wxComboBox +#define wxUSE_COMBOCTRL 1 + +// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox +// items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0, except where it is +// needed as a base class for generic wxBitmapComboBox. +#define wxUSE_ODCOMBOBOX 1 + +// wxBitmapComboBox is a combobox that can have images in front of text items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 +#define wxUSE_BITMAPCOMBOBOX 1 + +// wxRearrangeCtrl is a wxCheckListBox with two buttons allowing to move items +// up and down in it. It is also used as part of wxRearrangeDialog. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 (currently used only by +// wxHeaderCtrl) +#define wxUSE_REARRANGECTRL 1 + +// wxAddRemoveCtrl is a composite control containing a control showing some +// items (e.g. wxListBox, wxListCtrl, wxTreeCtrl, wxDataViewCtrl, ...) and "+"/ +// "-" buttons allowing to add and remove items to/from the control. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 if you don't need it (not +// used by the library itself). +#define wxUSE_ADDREMOVECTRL 1 + +// ---------------------------------------------------------------------------- +// Miscellaneous GUI stuff +// ---------------------------------------------------------------------------- + +// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) +#define wxUSE_ACCEL 1 + +// Use the standard art provider. The icons returned by this provider are +// embedded into the library as XPMs so disabling it reduces the library size +// somewhat but this should only be done if you use your own custom art +// provider returning the icons or never use any icons not provided by the +// native art provider (which might not be implemented at all for some +// platforms) or by the Tango icons provider (if it's not itself disabled +// below). +// +// Default is 1. +// +// Recommended setting: 1 unless you use your own custom art provider. +#define wxUSE_ARTPROVIDER_STD 1 + +// Use art provider providing Tango icons: this art provider has higher quality +// icons than the default one. It uses SVG format which allows much better scaling +// then when bitmaps are used, at the expense of somewhat larger library size. +// +// Default is 1 under non-GTK ports. Under wxGTK the native art provider using +// the GTK+ stock icons replaces it so it is normally not necessary. +// +// Recommended setting: 1 but can be turned off to reduce the library size. +#define wxUSE_ARTPROVIDER_TANGO 1 + +// Hotkey support (currently Windows and macOS only) +#define wxUSE_HOTKEY 1 + +// Use wxCaret: a class implementing a "cursor" in a text control (called caret +// under Windows). +// +// Default is 1. +// +// Recommended setting: 1 (can be safely set to 0, not used by the library) +#define wxUSE_CARET 1 + +// Use wxDisplay class: it allows enumerating all displays on a system and +// their geometries as well as finding the display on which the given point or +// window lies. +// +// Default is 1. +// +// Recommended setting: 1 if you need it, can be safely set to 0 otherwise +#define wxUSE_DISPLAY 1 + +// Miscellaneous geometry code: needed for Canvas library +#define wxUSE_GEOMETRY 1 + +// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and +// wxListCtrl. +// +// Default is 1. +// +// Recommended setting: 1 (set it to 0 if you don't use any of the controls +// enumerated above, then this class is mostly useless too) +#define wxUSE_IMAGLIST 1 + +// Use wxInfoBar class. +// +// Default is 1. +// +// Recommended setting: 1 (but can be disabled without problems as nothing +// depends on it) +#define wxUSE_INFOBAR 1 + +// Use wxMenu, wxMenuItem. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUS 1 + +// Use wxMenuBar. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUBAR 1 + +// Use wxNotificationMessage. +// +// wxNotificationMessage allows to show non-intrusive messages to the user +// using balloons, banners, popups or whatever is the appropriate method for +// the current platform. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTIFICATION_MESSAGE 1 + +// wxPreferencesEditor provides a common API for different ways of presenting +// the standard "Preferences" or "Properties" dialog under different platforms +// (e.g. some use modal dialogs, some use modeless ones; some apply the changes +// immediately while others require an explicit "Apply" button). +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_PREFERENCES_EDITOR 1 + +// wxFont::AddPrivateFont() allows to use fonts not installed on the system by +// loading them from font files during run-time. +// +// Default is 1 except under Unix where it will be turned off by configure if +// the required libraries are not available or not new enough. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it and +// want to avoid extra dependencies under Linux, for example). +#define wxUSE_PRIVATE_FONTS 1 + +// wxRichToolTip is a customizable tooltip class which has more functionality +// than the stock (but native, unlike this class) wxToolTip. +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely set to 0 if you don't need it) +#define wxUSE_RICHTOOLTIP 1 + +// Use wxSashWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SASH 1 + +// Use wxSplitterWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SPLITTER 1 + +// Use wxToolTip and wxWindow::Set/GetToolTip() methods. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLTIPS 1 + +// wxValidator class and related methods +#define wxUSE_VALIDATORS 1 + +// Use reference counted ID management: this means that wxWidgets will track +// the automatically allocated ids (those used when you use wxID_ANY when +// creating a window, menu or toolbar item &c) instead of just supposing that +// the program never runs out of them. This is mostly useful only under wxMSW +// where the total ids range is limited to SHRT_MIN..SHRT_MAX and where +// long-running programs can run into problems with ids reuse without this. On +// the other platforms, where the ids have the full int range, this shouldn't +// be necessary. +#ifdef __WXMSW__ +#define wxUSE_AUTOID_MANAGEMENT 1 +#else +#define wxUSE_AUTOID_MANAGEMENT 0 +#endif + +// ---------------------------------------------------------------------------- +// common dialogs +// ---------------------------------------------------------------------------- + +// Use common dialogs (e.g. file selector, printer dialog). Switching this off +// also switches off the printing architecture and interactive wxPrinterDC. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COMMON_DIALOGS 1 + +// wxBusyInfo displays window with message when app is busy. Works in same way +// as wxBusyCursor +#define wxUSE_BUSYINFO 1 + +// Use single/multiple choice dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_CHOICEDLG 1 + +// Use colour picker dialog +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COLOURDLG 1 + +// wxDirDlg class for getting a directory name from user +#define wxUSE_DIRDLG 1 + +// Use file open/save dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in many places in the library itself) +#define wxUSE_FILEDLG 1 + +// Use find/replace dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely set to 0) +#define wxUSE_FINDREPLDLG 1 + +// Use font picker dialog +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_FONTDLG 1 + +// Use wxMessageDialog and wxMessageBox. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_MSGDLG 1 + +// progress dialog class for lengthy operations +#define wxUSE_PROGRESSDLG 1 + +// Set to 0 to disable the use of the native progress dialog (currently only +// available under MSW and suffering from some bugs there, hence this option). +#define wxUSE_NATIVE_PROGRESSDLG 1 + +// support for startup tips (wxShowTip &c) +#define wxUSE_STARTUP_TIPS 1 + +// text entry dialog and wxGetTextFromUser function +#define wxUSE_TEXTDLG 1 + +// number entry dialog +#define wxUSE_NUMBERDLG 1 + +// credential entry dialog +#define wxUSE_CREDENTIALDLG 1 + +// splash screen class +#define wxUSE_SPLASH 1 + +// wizards +#define wxUSE_WIZARDDLG 1 + +// Compile in wxAboutBox() function showing the standard "About" dialog. +// +// Default is 1 +// +// Recommended setting: 1 but can be set to 0 to save some space if you don't +// use this function +#define wxUSE_ABOUTDLG 1 + +// wxFileHistory class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_FILE_HISTORY 1 + +// ---------------------------------------------------------------------------- +// Metafiles support +// ---------------------------------------------------------------------------- + +// Windows supports the graphics format known as metafile which, though not +// portable, is widely used under Windows and so is supported by wxWidgets +// (under Windows only, of course). Both the so-called "Window MetaFiles" or +// WMFs, and "Enhanced MetaFiles" or EMFs are supported in wxWin and, by +// default, EMFs will be used. This may be changed by setting +// wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting wxUSE_ENH_METAFILE to 0. +// You may also set wxUSE_METAFILE to 0 to not compile in any metafile +// related classes at all. +// +// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. +// +// Recommended setting: default or 0 for everything for portable programs. +#define wxUSE_METAFILE 1 +#define wxUSE_ENH_METAFILE 1 +#define wxUSE_WIN_METAFILES_ALWAYS 0 + +// ---------------------------------------------------------------------------- +// Big GUI components +// ---------------------------------------------------------------------------- + +// Set to 0 to disable MDI support. +// +// Requires wxUSE_NOTEBOOK under platforms other than MSW. +// +// Default is 1. +// +// Recommended setting: 1, can be safely set to 0. +#define wxUSE_MDI 1 + +// Set to 0 to disable document/view architecture +#define wxUSE_DOC_VIEW_ARCHITECTURE 1 + +// Set to 0 to disable MDI document/view architecture +// +// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE +#define wxUSE_MDI_ARCHITECTURE 1 + +// Set to 0 to disable print/preview architecture code +#define wxUSE_PRINTING_ARCHITECTURE 1 + +// wxHTML allows displaying simple HTML. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_HTML 1 + +// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL +// headers and libraries to be able to compile the library with wxUSE_GLCANVAS +// set to 1 and, under Windows, also to add opengl32.lib and glu32.lib to the +// list of libraries used to link your application when linking to wxWidgets +// statically (although this is done implicitly for Microsoft Visual C++ users). +// +// Default is 1. +// +// Recommended setting: 1 if you intend to use OpenGL, can be safely set to 0 +// otherwise. +#define wxUSE_GLCANVAS 1 + +// Setting wxUSE_GLCANVAS_EGL to 1 enables OpenGL EGL backend. This will be +// automatically enabled if EGL support is detected. EGL support is only +// available under Unix platforms. +// +// Default is 0. +// +#define wxUSE_GLCANVAS_EGL 0 + +// wxRichTextCtrl allows editing of styled text. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 if you want compile a +// smaller library. +#define wxUSE_RICHTEXT 1 + +// ---------------------------------------------------------------------------- +// Data transfer +// ---------------------------------------------------------------------------- + +// Use wxClipboard class for clipboard copy/paste. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CLIPBOARD 1 + +// Use wxDataObject and related classes. Needed for clipboard and OLE drag and +// drop +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DATAOBJ 1 + +// Use wxDropTarget and wxDropSource classes for drag and drop (this is +// different from "built in" drag and drop in wxTreeCtrl which is always +// available). Requires wxUSE_DATAOBJ. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DRAG_AND_DROP 1 + +// Use wxAccessible for enhanced and customisable accessibility. +// Depends on wxUSE_OLE on MSW. +// +// Default is 1 on MSW, 0 elsewhere. +// +// Recommended setting (at present): 1 (MSW-only) +#ifdef __WXMSW__ +#define wxUSE_ACCESSIBILITY 1 +#else +#define wxUSE_ACCESSIBILITY 0 +#endif + +// ---------------------------------------------------------------------------- +// miscellaneous settings +// ---------------------------------------------------------------------------- + +// wxSingleInstanceChecker class allows to verify at startup if another program +// instance is running. +// +// Default is 1 +// +// Recommended setting: 1 (the class is tiny, disabling it won't save much +// space) +#define wxUSE_SNGLINST_CHECKER 1 + +#define wxUSE_DRAGIMAGE 1 + +#define wxUSE_IPC 1 + // 0 for no interprocess comms +#define wxUSE_HELP 1 + // 0 for no help facility + +// Should we use MS HTML help for wxHelpController? If disabled, neither +// wxCHMHelpController nor wxBestHelpController are available. +// +// Default is 1 under MSW, 0 is always used for the other platforms. +// +// Recommended setting: 1, only set to 0 if you have trouble compiling +// wxCHMHelpController (could be a problem with really ancient compilers) +#define wxUSE_MS_HTML_HELP 1 + + +// Use wxHTML-based help controller? +#define wxUSE_WXHTML_HELP 1 + +#define wxUSE_CONSTRAINTS 1 + // 0 for no window layout constraint system + +#define wxUSE_SPLINES 1 + // 0 for no splines + +#define wxUSE_MOUSEWHEEL 1 + // Include mouse wheel support + +// Compile wxUIActionSimulator class? +#define wxUSE_UIACTIONSIMULATOR 1 + +// ---------------------------------------------------------------------------- +// wxDC classes for various output formats +// ---------------------------------------------------------------------------- + +// Set to 1 for PostScript device context. +#define wxUSE_POSTSCRIPT 0 + +// Set to 1 to use font metric files in GetTextExtent +#define wxUSE_AFM_FOR_POSTSCRIPT 1 + +// Set to 1 to compile in support for wxSVGFileDC, a wxDC subclass which allows +// to create files in SVG (Scalable Vector Graphics) format. +#define wxUSE_SVG 1 + +// Should wxDC provide SetTransformMatrix() and related methods? +// +// Default is 1 but can be set to 0 if this functionality is not used. Notice +// that currently wxMSW, wxGTK3 support this for wxDC and all platforms support +// this for wxGCDC so setting this to 0 doesn't change much if neither of these +// is used (although it will still save a few bytes probably). +// +// Recommended setting: 1. +#define wxUSE_DC_TRANSFORM_MATRIX 1 + +// ---------------------------------------------------------------------------- +// image format support +// ---------------------------------------------------------------------------- + +// wxImage supports many different image formats which can be configured at +// compile-time. BMP is always supported, others are optional and can be safely +// disabled if you don't plan to use images in such format sometimes saving +// substantial amount of code in the final library. +// +// Some formats require an extra library (e.g. libpng) which is always included in +// wxWidgets sources but some build systems (cmake, configure) can be configured to +// to use the system or user-provided version. +// +// Set to 1 for wxImage support (recommended). +#define wxUSE_IMAGE 1 + +// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. +#define wxUSE_LIBPNG 1 + +// Set to 1 for JPEG format support (requires libjpeg) +#define wxUSE_LIBJPEG 1 + +// Set to 1 for TIFF format support (requires libtiff) +#define wxUSE_LIBTIFF 1 + +// Set to 1 for SVG rasterizing support using nanosvg +#define wxUSE_NANOSVG 1 + +// Set to 1 to use external nanosvg library when wxUSE_NANOSVG is enabled +#define wxUSE_NANOSVG_EXTERNAL 0 + +// Set to 1 for TGA format support (loading only) +#define wxUSE_TGA 1 + +// Set to 1 for GIF format support +#define wxUSE_GIF 1 + +// Set to 1 for PNM format support +#define wxUSE_PNM 1 + +// Set to 1 for PCX format support +#define wxUSE_PCX 1 + +// Set to 1 for IFF format support (Amiga format) +#define wxUSE_IFF 0 + +// Set to 1 for XPM format support +#define wxUSE_XPM 1 + +// Set to 1 for MS Icons and Cursors format support +#define wxUSE_ICO_CUR 1 + +// Set to 1 to compile in wxPalette class +#define wxUSE_PALETTE 1 + +// ---------------------------------------------------------------------------- +// wxUniversal-only options +// ---------------------------------------------------------------------------- + +// Set to 1 to enable compilation of all themes, this is the default +#define wxUSE_ALL_THEMES 1 + +// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES +// is unset, if it is set these options are not used; notice that metal theme +// uses Win32 one +#define wxUSE_THEME_GTK 0 +#define wxUSE_THEME_METAL 0 +#define wxUSE_THEME_MONO 0 +#define wxUSE_THEME_WIN32 0 + +/* --- end common options --- */ + +/* --- start MSW options --- */ +// ---------------------------------------------------------------------------- +// Windows-specific backends choices +// ---------------------------------------------------------------------------- + +// The options here are only taken into account if wxUSE_GRAPHICS_CONTEXT is 1. + +// Enable support for GDI+-based implementation of wxGraphicsContext. +// +// Default is 1. +// +// Recommended setting: 1 if you need to support XP, as Direct2D is not +// available there. +#define wxUSE_GRAPHICS_GDIPLUS wxUSE_GRAPHICS_CONTEXT + +// Enable support for Direct2D-based implementation of wxGraphicsContext. +// +// Default is 1 for compilers which support it, i.e. VC10+ currently. If you +// use an earlier MSVC version or another compiler and installed the necessary +// SDK components manually, you need to change this setting. +// +// Recommended setting: 1 for faster and better quality graphics under Windows +// 7 and later systems (if wxUSE_GRAPHICS_GDIPLUS is also enabled, earlier +// systems will fall back on using GDI+). +#if defined(_MSC_VER) && _MSC_VER >= 1600 + #define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT +#else + #define wxUSE_GRAPHICS_DIRECT2D 0 +#endif + +// ---------------------------------------------------------------------------- +// Windows-only settings +// ---------------------------------------------------------------------------- + +// Set this to 1 for generic OLE support: this is required for drag-and-drop, +// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and +// can't compile/doesn't have the OLE headers. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_OLE 1 + +// Set this to 1 to enable wxAutomationObject class. +// +// Default is 1. +// +// Recommended setting: 1 if you need to control other applications via OLE +// Automation, can be safely set to 0 otherwise +#define wxUSE_OLE_AUTOMATION 1 + +// Set this to 1 to enable wxActiveXContainer class allowing to embed OLE +// controls in wx. +// +// Default is 1. +// +// Recommended setting: 1, required by wxMediaCtrl +#define wxUSE_ACTIVEX 1 + +#define wxUSE_WINRT 0 + +// wxDC caching implementation +#define wxUSE_DC_CACHEING 1 + +// Set this to 1 to enable wxDIB class used internally for manipulating +// wxBitmap data. +// +// Default is 1, set it to 0 only if you don't use wxImage either +// +// Recommended setting: 1 (without it conversion to/from wxImage won't work) +#define wxUSE_WXDIB 1 + +// Set to 0 to disable PostScript print/preview architecture code under Windows +// (just use Windows printing). +#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1 + +// Set this to 1 to compile in wxRegKey class. +// +// Default is 1 +// +// Recommended setting: 1, this is used internally by wx in a few places +#define wxUSE_REGKEY 1 + +// Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH +// which allows to put more than ~32Kb of text in it even under Win9x (NT +// doesn't have such limitation). +// +// Default is 1 for compilers which support it +// +// Recommended setting: 1, only set it to 0 if your compiler doesn't have +// or can't compile <richedit.h> +#define wxUSE_RICHEDIT 1 + +// Set this to 1 to use extra features of richedit v2 and later controls +// +// Default is 1 for compilers which support it +// +// Recommended setting: 1 +#define wxUSE_RICHEDIT2 1 + +// Set this to 1 to enable support for the owner-drawn menu and listboxes. This +// is required by wxUSE_CHECKLISTBOX. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 for a small library size reduction +#define wxUSE_OWNER_DRAWN 1 + +// Set this to 1 to enable MSW-specific wxTaskBarIcon::ShowBalloon() method. It +// is required by native wxNotificationMessage implementation. +// +// Default is 1 but disabled in wx/msw/chkconf.h if SDK is too old to contain +// the necessary declarations. +// +// Recommended setting: 1, set to 0 for a tiny library size reduction +#define wxUSE_TASKBARICON_BALLOONS 1 + +#define wxUSE_TASKBARBUTTON 0 + +// Set to 1 to compile MS Windows XP theme engine support +#define wxUSE_UXTHEME 1 + +// Set to 1 to use InkEdit control (Tablet PC), if available +#define wxUSE_INKEDIT 0 + +// Set to 1 to enable .INI files based wxConfig implementation (wxIniConfig) +// +// Default is 0. +// +// Recommended setting: 0, nobody uses .INI files any more +#define wxUSE_INICONF 0 + +// Set to 1 if you need to include <winsock2.h> over <winsock.h> +// +// Default is 0. +// +// Recommended setting: 0 +#define wxUSE_WINSOCK2 0 + +// ---------------------------------------------------------------------------- +// Generic versions of native controls +// ---------------------------------------------------------------------------- + +// Set this to 1 to be able to use wxDatePickerCtrlGeneric in addition to the +// native wxDatePickerCtrl +// +// Default is 0. +// +// Recommended setting: 0, this is mainly used for testing +#define wxUSE_DATEPICKCTRL_GENERIC 0 + +// ---------------------------------------------------------------------------- +// Crash debugging helpers +// ---------------------------------------------------------------------------- + +// Set this to 1 to use dbghelp.dll for providing stack traces in crash +// reports. +// +// Default is 1 if the compiler supports it, 0 for old MinGW. +// +// Recommended setting: 1, there is not much gain in disabling this +#if defined(__VISUALC__) || defined(__MINGW64_TOOLCHAIN__) + #define wxUSE_DBGHELP 1 +#else + #define wxUSE_DBGHELP 0 +#endif + +// Set this to 1 to be able to use wxCrashReport::Generate() to create mini +// dumps of your program when it crashes (or at any other moment) +// +// Default is 1 if supported by the compiler (VC++ and recent BC++ only). +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_CRASHREPORT 1 +/* --- end MSW options --- */ + +/* --- start wxUniv options --- */ +// ---------------------------------------------------------------------------- +// wxUniversal-only options +// ---------------------------------------------------------------------------- + +// Set to 1 to enable compilation of all themes, this is the default +#define wxUSE_ALL_THEMES 1 + +// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES +// is unset, if it is set these options are not used; notice that metal theme +// uses Win32 one +#define wxUSE_THEME_GTK 0 +#define wxUSE_THEME_METAL 0 +#define wxUSE_THEME_MONO 0 +#define wxUSE_THEME_WIN32 0 +/* --- end wxUniv options --- */ + +#endif // _WX_SETUP_H_ diff --git a/lib/wxWidgets/include/wx/univ/setup_inc.h b/lib/wxWidgets/include/wx/univ/setup_inc.h new file mode 100644 index 0000000..8e13ecd --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/setup_inc.h @@ -0,0 +1,25 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/setup_inc.h +// Purpose: wxUniversal-specific setup.h options (this file is not used +// directly, it is injected by build/update-setup-h in the +// generated include/wx/univ/setup.h) +// Author: Vadim Zeitlin +// Created: 2008-02-03 +// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ---------------------------------------------------------------------------- +// wxUniversal-only options +// ---------------------------------------------------------------------------- + +// Set to 1 to enable compilation of all themes, this is the default +#define wxUSE_ALL_THEMES 1 + +// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES +// is unset, if it is set these options are not used; notice that metal theme +// uses Win32 one +#define wxUSE_THEME_GTK 0 +#define wxUSE_THEME_METAL 0 +#define wxUSE_THEME_MONO 0 +#define wxUSE_THEME_WIN32 0 diff --git a/lib/wxWidgets/include/wx/univ/slider.h b/lib/wxWidgets/include/wx/univ/slider.h new file mode 100644 index 0000000..1bc6c18 --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/slider.h @@ -0,0 +1,227 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/slider.h +// Purpose: wxSlider control for wxUniversal +// Author: Vadim Zeitlin +// Modified by: +// Created: 09.02.01 +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_SLIDER_H_ +#define _WX_UNIV_SLIDER_H_ + +#include "wx/univ/scrthumb.h" + +// ---------------------------------------------------------------------------- +// the actions supported by this control +// ---------------------------------------------------------------------------- + +// our actions are the same as scrollbars + +#define wxACTION_SLIDER_START wxT("start") // to the beginning +#define wxACTION_SLIDER_END wxT("end") // to the end +#define wxACTION_SLIDER_LINE_UP wxT("lineup") // one line up/left +#define wxACTION_SLIDER_PAGE_UP wxT("pageup") // one page up/left +#define wxACTION_SLIDER_LINE_DOWN wxT("linedown") // one line down/right +#define wxACTION_SLIDER_PAGE_DOWN wxT("pagedown") // one page down/right +#define wxACTION_SLIDER_PAGE_CHANGE wxT("pagechange")// change page by numArg + +#define wxACTION_SLIDER_THUMB_DRAG wxT("thumbdrag") +#define wxACTION_SLIDER_THUMB_MOVE wxT("thumbmove") +#define wxACTION_SLIDER_THUMB_RELEASE wxT("thumbrelease") + +// ---------------------------------------------------------------------------- +// wxSlider +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxSlider : public wxSliderBase, + public wxControlWithThumb +{ +public: + // ctors and such + wxSlider(); + + wxSlider(wxWindow *parent, + wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxSliderNameStr)); + + bool Create(wxWindow *parent, + wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxSliderNameStr)); + + // implement base class pure virtuals + virtual int GetValue() const wxOVERRIDE; + virtual void SetValue(int value) wxOVERRIDE; + + virtual void SetRange(int minValue, int maxValue) wxOVERRIDE; + virtual int GetMin() const wxOVERRIDE; + virtual int GetMax() const wxOVERRIDE; + + virtual void SetLineSize(int lineSize) wxOVERRIDE; + virtual void SetPageSize(int pageSize) wxOVERRIDE; + virtual int GetLineSize() const wxOVERRIDE; + virtual int GetPageSize() const wxOVERRIDE; + + virtual void SetThumbLength(int lenPixels) wxOVERRIDE; + virtual int GetThumbLength() const wxOVERRIDE; + + virtual int GetTickFreq() const wxOVERRIDE { return m_tickFreq; } + + // wxUniv-specific methods + // ----------------------- + + // is this a vertical slider? + bool IsVert() const { return (GetWindowStyle() & wxSL_VERTICAL) != 0; } + + // get the slider orientation + wxOrientation GetOrientation() const + { return IsVert() ? wxVERTICAL : wxHORIZONTAL; } + + // do we have labels? + bool HasLabels() const + { return ((GetWindowStyle() & wxSL_LABELS) != 0) && + ((GetWindowStyle() & (wxSL_TOP|wxSL_BOTTOM|wxSL_LEFT|wxSL_RIGHT)) != 0); } + + // do we have ticks? + bool HasTicks() const + { return ((GetWindowStyle() & wxSL_TICKS) != 0) && + ((GetWindowStyle() & (wxSL_TOP|wxSL_BOTTOM|wxSL_LEFT|wxSL_RIGHT|wxSL_BOTH)) != 0); } + + // implement wxControlWithThumb interface + virtual wxWindow *GetWindow() wxOVERRIDE { return this; } + virtual bool IsVertical() const wxOVERRIDE { return IsVert(); } + + virtual wxScrollThumb::Shaft HitTest(const wxPoint& pt) const wxOVERRIDE; + virtual wxCoord ThumbPosToPixel() const wxOVERRIDE; + virtual int PixelToThumbPos(wxCoord x) const wxOVERRIDE; + + virtual void SetShaftPartState(wxScrollThumb::Shaft shaftPart, + int flag, + bool set = true) wxOVERRIDE; + + virtual void OnThumbDragStart(int pos) wxOVERRIDE; + virtual void OnThumbDrag(int pos) wxOVERRIDE; + virtual void OnThumbDragEnd(int pos) wxOVERRIDE; + virtual void OnPageScrollStart() wxOVERRIDE; + virtual bool OnPageScroll(int pageInc) wxOVERRIDE; + + // for wxStdSliderInputHandler + wxScrollThumb& GetThumb() { return m_thumb; } + + virtual bool PerformAction(const wxControlAction& action, + long numArg = 0, + const wxString& strArg = wxEmptyString) wxOVERRIDE; + + static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) wxOVERRIDE + { + return GetStdInputHandler(handlerDef); + } + +protected: + enum + { + INVALID_THUMB_VALUE = -0xffff + }; + + // Platform-specific implementation of SetTickFreq + virtual void DoSetTickFreq(int freq) wxOVERRIDE; + + // overridden base class virtuals + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + virtual void DoDraw(wxControlRenderer *renderer) wxOVERRIDE; + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + + // event handlers + void OnSize(wxSizeEvent& event); + + // common part of all ctors + void Init(); + + // normalize the value to fit in the range + int NormalizeValue(int value) const; + + // change the value by the given increment, return true if really changed + bool ChangeValueBy(int inc); + + // change the value to the given one + bool ChangeValueTo(int value); + + // is the value inside the range? + bool IsInRange(int value) { return (value >= m_min) && (value <= m_max); } + + // format the value for printing as label + virtual wxString FormatValue(int value) const; + + // calculate max label size + wxSize CalcLabelSize() const; + + // calculate m_rectLabel/Slider + void CalcGeometry(); + + // get the thumb size + wxSize GetThumbSize() const; + + // get the shaft rect (uses m_rectSlider which is supposed to be calculated) + wxRect GetShaftRect() const; + + // calc the current thumb position using the shaft rect (if the pointer is + // NULL, we calculate it here too) + void CalcThumbRect(const wxRect *rectShaft, + wxRect *rectThumbOut, + wxRect *rectLabelOut, + int value = INVALID_THUMB_VALUE) const; + + // return the slider rect calculating it if needed + const wxRect& GetSliderRect() const; + + // refresh the current thumb position + void RefreshThumb(); + +private: + // get the default thumb size (without using m_thumbSize) + wxSize GetDefaultThumbSize() const; + + // the object which manages our thumb + wxScrollThumb m_thumb; + + // the slider range and value + int m_min, + m_max, + m_value; + + // the tick frequence (default is 1) + int m_tickFreq; + + // the line and page increments (logical units) + int m_lineSize, + m_pageSize; + + // the size of the thumb (in pixels) + int m_thumbSize; + + // the part of the client area reserved for the label, the ticks and the + // part for the slider itself + wxRect m_rectLabel, + m_rectTicks, + m_rectSlider; + + // the state of the thumb (wxCONTROL_XXX constants sum) + int m_thumbFlags; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxSlider); +}; + +#endif // _WX_UNIV_SLIDER_H_ diff --git a/lib/wxWidgets/include/wx/univ/spinbutt.h b/lib/wxWidgets/include/wx/univ/spinbutt.h new file mode 100644 index 0000000..8dbe81e --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/spinbutt.h @@ -0,0 +1,121 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/spinbutt.h +// Purpose: universal version of wxSpinButton +// Author: Vadim Zeitlin +// Modified by: +// Created: 21.01.01 +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_SPINBUTT_H_ +#define _WX_UNIV_SPINBUTT_H_ + +#include "wx/univ/scrarrow.h" + +// ---------------------------------------------------------------------------- +// wxSpinButton +// ---------------------------------------------------------------------------- + +// actions supported by this control +#define wxACTION_SPIN_INC wxT("inc") +#define wxACTION_SPIN_DEC wxT("dec") + +class WXDLLIMPEXP_CORE wxSpinButton : public wxSpinButtonBase, + public wxControlWithArrows +{ +public: + wxSpinButton(); + wxSpinButton(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_VERTICAL | wxSP_ARROW_KEYS, + const wxString& name = wxSPIN_BUTTON_NAME); + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_VERTICAL | wxSP_ARROW_KEYS, + const wxString& name = wxSPIN_BUTTON_NAME); + + // implement wxSpinButtonBase methods + virtual int GetValue() const wxOVERRIDE; + virtual void SetValue(int val) wxOVERRIDE; + virtual void SetRange(int minVal, int maxVal) wxOVERRIDE; + + // implement wxControlWithArrows methods + virtual wxRenderer *GetRenderer() const wxOVERRIDE { return m_renderer; } + virtual wxWindow *GetWindow() wxOVERRIDE { return this; } + virtual bool IsVertical() const wxOVERRIDE { return wxSpinButtonBase::IsVertical(); } + virtual int GetArrowState(wxScrollArrows::Arrow arrow) const wxOVERRIDE; + virtual void SetArrowFlag(wxScrollArrows::Arrow arrow, int flag, bool set) wxOVERRIDE; + virtual bool OnArrow(wxScrollArrows::Arrow arrow) wxOVERRIDE; + virtual wxScrollArrows::Arrow HitTestArrow(const wxPoint& pt) const wxOVERRIDE; + + // for wxStdSpinButtonInputHandler + const wxScrollArrows& GetArrows() { return m_arrows; } + + virtual bool PerformAction(const wxControlAction& action, + long numArg = 0, + const wxString& strArg = wxEmptyString) wxOVERRIDE; + + static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) wxOVERRIDE + { + return GetStdInputHandler(handlerDef); + } + +protected: + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + virtual void DoDraw(wxControlRenderer *renderer) wxOVERRIDE; + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + + // the common part of all ctors + void Init(); + + // normalize the value to fit into min..max range + int NormalizeValue(int value) const; + + // change the value by +1/-1 and send the event, return true if value was + // changed + bool ChangeValue(int inc); + + // get the rectangles for our 2 arrows + void CalcArrowRects(wxRect *rect1, wxRect *rect2) const; + + // the current controls value + int m_value; + +private: + // the object which manages our arrows + wxScrollArrows m_arrows; + + // the state (combination of wxCONTROL_XXX flags) of the arrows + int m_arrowsState[wxScrollArrows::Arrow_Max]; + + wxDECLARE_DYNAMIC_CLASS(wxSpinButton); +}; + +// ---------------------------------------------------------------------------- +// wxStdSpinButtonInputHandler: manages clicks on them (use arrows like +// wxStdScrollBarInputHandler) and processes keyboard events too +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxStdSpinButtonInputHandler : public wxStdInputHandler +{ +public: + wxStdSpinButtonInputHandler(wxInputHandler *inphand); + + virtual bool HandleKey(wxInputConsumer *consumer, + const wxKeyEvent& event, + bool pressed) wxOVERRIDE; + virtual bool HandleMouse(wxInputConsumer *consumer, + const wxMouseEvent& event) wxOVERRIDE; + virtual bool HandleMouseMove(wxInputConsumer *consumer, + const wxMouseEvent& event) wxOVERRIDE; +}; + +#endif // _WX_UNIV_SPINBUTT_H_ + diff --git a/lib/wxWidgets/include/wx/univ/statbmp.h b/lib/wxWidgets/include/wx/univ/statbmp.h new file mode 100644 index 0000000..0f9a487 --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/statbmp.h @@ -0,0 +1,66 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/statbmp.h +// Purpose: wxStaticBitmap class for wxUniversal +// Author: Vadim Zeitlin +// Modified by: +// Created: 25.08.00 +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_STATBMP_H_ +#define _WX_UNIV_STATBMP_H_ + +#include "wx/bitmap.h" + +// ---------------------------------------------------------------------------- +// wxStaticBitmap +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxStaticBitmap : public wxStaticBitmapBase +{ +public: + wxStaticBitmap() + { + } + + wxStaticBitmap(wxWindow *parent, + const wxBitmapBundle& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0) + { + Create(parent, wxID_ANY, label, pos, size, style); + } + + wxStaticBitmap(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBitmapNameStr)) + { + Create(parent, id, label, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxBitmapBundle& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBitmapNameStr)); + + virtual void SetBitmap(const wxBitmapBundle& bitmap) wxOVERRIDE; + + virtual bool HasTransparentBackground() wxOVERRIDE { return true; } + +protected: + virtual void DoDraw(wxControlRenderer *renderer) wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxStaticBitmap); +}; + +#endif // _WX_UNIV_STATBMP_H_ diff --git a/lib/wxWidgets/include/wx/univ/statbox.h b/lib/wxWidgets/include/wx/univ/statbox.h new file mode 100644 index 0000000..6e54afb --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/statbox.h @@ -0,0 +1,64 @@ +////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/statbox.h +// Purpose: wxStaticBox declaration +// Author: Vadim Zeitlin +// Modified by: +// Created: 15.08.00 +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_STATBOX_H_ +#define _WX_UNIV_STATBOX_H_ + +class WXDLLIMPEXP_CORE wxStaticBox : public wxStaticBoxBase +{ +public: + wxStaticBox() { } + + wxStaticBox(wxWindow *parent, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize) + { + Create(parent, wxID_ANY, label, pos, size); + } + + wxStaticBox(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBoxNameStr)) + { + Create(parent, id, label, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxStaticBoxNameStr)); + + // the origin of the static box is inside the border and under the label: + // take account of this + virtual wxPoint GetBoxAreaOrigin() const; + + // returning true from here ensures that we act as a container window for + // our children + virtual bool IsStaticBox() const wxOVERRIDE { return true; } + +protected: + // draw the control + virtual void DoDraw(wxControlRenderer *renderer) wxOVERRIDE; + + // get the size of the border + wxRect GetBorderGeometry() const; + +private: + wxDECLARE_DYNAMIC_CLASS(wxStaticBox); +}; + +#endif // _WX_UNIV_STATBOX_H_ diff --git a/lib/wxWidgets/include/wx/univ/statline.h b/lib/wxWidgets/include/wx/univ/statline.h new file mode 100644 index 0000000..e67e43b --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/statline.h @@ -0,0 +1,55 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/statline.h +// Purpose: wxStaticLine class for wxUniversal +// Author: Vadim Zeitlin +// Created: 28.06.99 +// Copyright: (c) 1999 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_STATLINE_H_ +#define _WX_UNIV_STATLINE_H_ + +class WXDLLIMPEXP_CORE wxStaticLine : public wxStaticLineBase +{ +public: + // constructors and pseudo-constructors + wxStaticLine() { } + + wxStaticLine(wxWindow *parent, + const wxPoint &pos, + wxCoord length, + long style = wxLI_HORIZONTAL) + { + Create(parent, wxID_ANY, pos, + style & wxLI_VERTICAL ? wxSize(wxDefaultCoord, length) + : wxSize(length, wxDefaultCoord), + style); + } + + wxStaticLine(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxASCII_STR(wxStaticLineNameStr) ) + { + Create(parent, id, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxASCII_STR(wxStaticLineNameStr) ); + +protected: + virtual void DoDraw(wxControlRenderer *renderer) wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxStaticLine); +}; + +#endif // _WX_UNIV_STATLINE_H_ + diff --git a/lib/wxWidgets/include/wx/univ/stattext.h b/lib/wxWidgets/include/wx/univ/stattext.h new file mode 100644 index 0000000..72e038b --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/stattext.h @@ -0,0 +1,67 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/stattext.h +// Purpose: wxStaticText +// Author: Vadim Zeitlin +// Modified by: +// Created: 14.08.00 +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_STATTEXT_H_ +#define _WX_UNIV_STATTEXT_H_ + +#include "wx/generic/stattextg.h" + +class WXDLLIMPEXP_CORE wxStaticText : public wxGenericStaticText +{ +public: + wxStaticText() { } + + // usual ctor + wxStaticText(wxWindow *parent, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize) + { + Create(parent, wxID_ANY, label, pos, size, 0, wxASCII_STR(wxStaticTextNameStr)); + } + + // full form + wxStaticText(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString &name = wxASCII_STR(wxStaticTextNameStr)) + { + Create(parent, id, label, pos, size, style, name); + } + + // function ctor + bool Create(wxWindow *parent, + wxWindowID id, + const wxString &label, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxString &name = wxASCII_STR(wxStaticTextNameStr)); + + // implementation only from now on + + virtual void SetLabel(const wxString& label) wxOVERRIDE; + + virtual bool IsFocused() const wxOVERRIDE { return false; } + +protected: + // draw the control + virtual void DoDraw(wxControlRenderer *renderer) wxOVERRIDE; + + virtual void WXSetVisibleLabel(const wxString& str) wxOVERRIDE; + virtual wxString WXGetVisibleLabel() const wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxStaticText); +}; + +#endif // _WX_UNIV_STATTEXT_H_ diff --git a/lib/wxWidgets/include/wx/univ/statusbr.h b/lib/wxWidgets/include/wx/univ/statusbr.h new file mode 100644 index 0000000..a5f05ba --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/statusbr.h @@ -0,0 +1,99 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/statusbr.h +// Purpose: wxStatusBarUniv: wxStatusBar for wxUniversal declaration +// Author: Vadim Zeitlin +// Modified by: +// Created: 14.10.01 +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_STATUSBR_H_ +#define _WX_UNIV_STATUSBR_H_ + +#include "wx/univ/inpcons.h" +#include "wx/arrstr.h" + +// ---------------------------------------------------------------------------- +// wxStatusBarUniv: a window near the bottom of the frame used for status info +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxStatusBarUniv : public wxStatusBarBase +{ +public: + wxStatusBarUniv() { Init(); } + + wxStatusBarUniv(wxWindow *parent, + wxWindowID id = wxID_ANY, + long style = wxSTB_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxPanelNameStr)) + { + Init(); + + (void)Create(parent, id, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + long style = wxSTB_DEFAULT_STYLE, + const wxString& name = wxASCII_STR(wxPanelNameStr)); + + // implement base class methods + virtual void SetFieldsCount(int number = 1, const int *widths = NULL) wxOVERRIDE; + virtual void SetStatusWidths(int n, const int widths[]) wxOVERRIDE; + + virtual bool GetFieldRect(int i, wxRect& rect) const wxOVERRIDE; + virtual void SetMinHeight(int height) wxOVERRIDE; + + virtual int GetBorderX() const wxOVERRIDE; + virtual int GetBorderY() const wxOVERRIDE; + + // wxInputConsumer pure virtual + virtual wxWindow *GetInputWindow() const wxOVERRIDE + { return const_cast<wxStatusBar*>(this); } + +protected: + virtual void DoUpdateStatusText(int i) wxOVERRIDE; + + // recalculate the field widths + void OnSize(wxSizeEvent& event); + + // draw the statusbar + virtual void DoDraw(wxControlRenderer *renderer) wxOVERRIDE; + + // tell them about our preferred height + virtual wxSize DoGetBestSize() const wxOVERRIDE; + + // override DoSetSize() to prevent the status bar height from changing + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; + + // get the (fixed) status bar height + wxCoord GetHeight() const; + + // get the rectangle containing all the fields and the border between them + // + // also updates m_widthsAbs if necessary + wxRect GetTotalFieldRect(wxCoord *borderBetweenFields); + + // get the rect for this field without ani side effects (see code) + wxRect DoGetFieldRect(int n) const; + + // common part of all ctors + void Init(); + +private: + // the current status fields strings + //wxArrayString m_statusText; + + // the absolute status fields widths + wxArrayInt m_widthsAbs; + + wxDECLARE_DYNAMIC_CLASS(wxStatusBarUniv); + wxDECLARE_EVENT_TABLE(); + WX_DECLARE_INPUT_CONSUMER() +}; + +#endif // _WX_UNIV_STATUSBR_H_ + diff --git a/lib/wxWidgets/include/wx/univ/stdrend.h b/lib/wxWidgets/include/wx/univ/stdrend.h new file mode 100644 index 0000000..06077e5 --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/stdrend.h @@ -0,0 +1,352 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/stdrend.h +// Purpose: wxStdRenderer class declaration +// Author: Vadim Zeitlin +// Created: 2006-09-18 +// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_STDREND_H_ +#define _WX_UNIV_STDREND_H_ + +#include "wx/univ/renderer.h" +#include "wx/pen.h" + +class WXDLLIMPEXP_FWD_CORE wxColourScheme; + +// ---------------------------------------------------------------------------- +// wxStdRenderer: implements as much of wxRenderer API as possible generically +// ---------------------------------------------------------------------------- + +class wxStdRenderer : public wxRenderer +{ +public: + // the renderer will use the given scheme, whose lifetime must be at least + // as long as of this object itself, to choose the colours for drawing + wxStdRenderer(const wxColourScheme *scheme); + + virtual void DrawBackground(wxDC& dc, + const wxColour& col, + const wxRect& rect, + int flags = 0, + wxWindow *window = NULL) wxOVERRIDE; + virtual void DrawButtonSurface(wxDC& dc, + const wxColour& col, + const wxRect& rect, + int flags) wxOVERRIDE; + + + virtual void DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0) wxOVERRIDE; + + virtual void DrawLabel(wxDC& dc, + const wxString& label, + const wxRect& rect, + int flags = 0, + int alignment = wxALIGN_LEFT | wxALIGN_TOP, + int indexAccel = -1, + wxRect *rectBounds = NULL) wxOVERRIDE; + virtual void DrawButtonLabel(wxDC& dc, + const wxString& label, + const wxBitmap& image, + const wxRect& rect, + int flags = 0, + int alignment = wxALIGN_LEFT | wxALIGN_TOP, + int indexAccel = -1, + wxRect *rectBounds = NULL) wxOVERRIDE; + + + virtual void DrawBorder(wxDC& dc, + wxBorder border, + const wxRect& rect, + int flags = 0, + wxRect *rectIn = NULL) wxOVERRIDE; + virtual void DrawTextBorder(wxDC& dc, + wxBorder border, + const wxRect& rect, + int flags = 0, + wxRect *rectIn = NULL) wxOVERRIDE; + + virtual void DrawHorizontalLine(wxDC& dc, + wxCoord y, wxCoord x1, wxCoord x2) wxOVERRIDE; + virtual void DrawVerticalLine(wxDC& dc, + wxCoord x, wxCoord y1, wxCoord y2) wxOVERRIDE; + virtual void DrawFrame(wxDC& dc, + const wxString& label, + const wxRect& rect, + int flags = 0, + int alignment = wxALIGN_LEFT, + int indexAccel = -1) wxOVERRIDE; + + + virtual void DrawItem(wxDC& dc, + const wxString& label, + const wxRect& rect, + int flags = 0) wxOVERRIDE; + virtual void DrawCheckItem(wxDC& dc, + const wxString& label, + const wxBitmap& bitmap, + const wxRect& rect, + int flags = 0) wxOVERRIDE; + + virtual void DrawCheckButton(wxDC& dc, + const wxString& label, + const wxBitmap& bitmap, + const wxRect& rect, + int flags = 0, + wxAlignment align = wxALIGN_LEFT, + int indexAccel = -1) wxOVERRIDE; + virtual void DrawRadioButton(wxDC& dc, + const wxString& label, + const wxBitmap& bitmap, + const wxRect& rect, + int flags = 0, + wxAlignment align = wxALIGN_LEFT, + int indexAccel = -1) wxOVERRIDE; + + virtual void DrawScrollbarArrow(wxDC& dc, + wxDirection dir, + const wxRect& rect, + int flags = 0) wxOVERRIDE; + virtual void DrawScrollCorner(wxDC& dc, + const wxRect& rect) wxOVERRIDE; + +#if wxUSE_TEXTCTRL + virtual void DrawTextLine(wxDC& dc, + const wxString& text, + const wxRect& rect, + int selStart = -1, + int selEnd = -1, + int flags = 0) wxOVERRIDE; + + virtual void DrawLineWrapMark(wxDC& dc, const wxRect& rect) wxOVERRIDE; + + virtual wxRect GetTextTotalArea(const wxTextCtrl *text, + const wxRect& rect) const wxOVERRIDE; + virtual wxRect GetTextClientArea(const wxTextCtrl *text, + const wxRect& rect, + wxCoord *extraSpaceBeyond) const wxOVERRIDE; +#endif // wxUSE_TEXTCTRL + + virtual wxRect GetBorderDimensions(wxBorder border) const wxOVERRIDE; + + virtual bool AreScrollbarsInsideBorder() const wxOVERRIDE; + + virtual void AdjustSize(wxSize *size, const wxWindow *window) wxOVERRIDE; + + virtual wxCoord GetListboxItemHeight(wxCoord fontHeight) wxOVERRIDE; + +#if wxUSE_STATUSBAR + virtual void DrawStatusField(wxDC& dc, + const wxRect& rect, + const wxString& label, + int flags = 0, int style = 0) wxOVERRIDE; + + virtual wxSize GetStatusBarBorders() const wxOVERRIDE; + + virtual wxCoord GetStatusBarBorderBetweenFields() const wxOVERRIDE; + + virtual wxSize GetStatusBarFieldMargins() const wxOVERRIDE; +#endif // wxUSE_STATUSBAR + + virtual wxCoord GetCheckItemMargin() const wxOVERRIDE { return 0; } + + + virtual void DrawFrameTitleBar(wxDC& dc, + const wxRect& rect, + const wxString& title, + const wxIcon& icon, + int flags, + int specialButton = 0, + int specialButtonFlag = 0) wxOVERRIDE; + virtual void DrawFrameBorder(wxDC& dc, + const wxRect& rect, + int flags) wxOVERRIDE; + virtual void DrawFrameBackground(wxDC& dc, + const wxRect& rect, + int flags) wxOVERRIDE; + virtual void DrawFrameTitle(wxDC& dc, + const wxRect& rect, + const wxString& title, + int flags) wxOVERRIDE; + virtual void DrawFrameIcon(wxDC& dc, + const wxRect& rect, + const wxIcon& icon, + int flags) wxOVERRIDE; + virtual void DrawFrameButton(wxDC& dc, + wxCoord x, wxCoord y, + int button, + int flags = 0) wxOVERRIDE; + + virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const wxOVERRIDE; + + virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const wxOVERRIDE; + + virtual wxSize GetFrameMinSize(int flags) const wxOVERRIDE; + + virtual wxSize GetFrameIconSize() const wxOVERRIDE; + + virtual int HitTestFrame(const wxRect& rect, + const wxPoint& pt, + int flags = 0) const wxOVERRIDE; +protected: + // various constants + enum ArrowDirection + { + Arrow_Left, + Arrow_Right, + Arrow_Up, + Arrow_Down, + Arrow_Max + }; + + enum ArrowStyle + { + Arrow_Normal, + Arrow_Disabled, + Arrow_Pressed, + Arrow_Inverted, + Arrow_InvertedDisabled, + Arrow_StateMax + }; + + enum FrameButtonType + { + FrameButton_Close, + FrameButton_Minimize, + FrameButton_Maximize, + FrameButton_Restore, + FrameButton_Help, + FrameButton_Max + }; + + enum IndicatorType + { + IndicatorType_Check, + IndicatorType_Radio, + IndicatorType_MaxCtrl, + IndicatorType_Menu = IndicatorType_MaxCtrl, + IndicatorType_Max + }; + + enum IndicatorState + { + IndicatorState_Normal, + IndicatorState_Pressed, // this one is for check/radioboxes + IndicatorState_Disabled, + IndicatorState_MaxCtrl, + + // the rest of the states are valid for menu items only + IndicatorState_Selected = IndicatorState_Pressed, + IndicatorState_SelectedDisabled = IndicatorState_MaxCtrl, + IndicatorState_MaxMenu + }; + + enum IndicatorStatus + { + IndicatorStatus_Checked, + IndicatorStatus_Unchecked, + IndicatorStatus_Undetermined, + IndicatorStatus_Max + }; + + // translate the appropriate bits in flags to the above enum elements + static void GetIndicatorsFromFlags(int flags, + IndicatorState& state, + IndicatorStatus& status); + + // translate wxDirection to ArrowDirection + static ArrowDirection GetArrowDirection(wxDirection dir); + + + // fill the rectangle with a brush of given colour (must be valid) + void DrawSolidRect(wxDC& dc, const wxColour& col, const wxRect& rect); + + + // all the functions in this section adjust the rect parameter to + // correspond to the interiour of the drawn area + + // draw complete rectangle + void DrawRect(wxDC& dc, wxRect *rect, const wxPen& pen); + + // draw the rectangle using the first pen for the left and top sides + // and the second one for the bottom and right ones + void DrawShadedRect(wxDC& dc, wxRect *rect, + const wxPen& pen1, const wxPen& pen2); + + // border drawing routines, may be overridden in the derived class + virtual void DrawRaisedBorder(wxDC& dc, wxRect *rect); + virtual void DrawSunkenBorder(wxDC& dc, wxRect *rect); + virtual void DrawAntiSunkenBorder(wxDC& dc, wxRect *rect); + virtual void DrawBoxBorder(wxDC& dc, wxRect *rect); + virtual void DrawStaticBorder(wxDC& dc, wxRect *rect); + virtual void DrawExtraBorder(wxDC& dc, wxRect *rect); + + + // draw the frame with non-empty label inside the given rectText + virtual void DrawFrameWithLabel(wxDC& dc, + const wxString& label, + const wxRect& rectFrame, + const wxRect& rectText, + int flags, + int alignment, + int indexAccel); + + // draw the (static box) frame without the part corresponding to rectLabel + void DrawFrameWithoutLabel(wxDC& dc, + const wxRect& rectFrame, + const wxRect& rectLabel); + + + // draw the bitmap for a check item (which is by default the same as check + // box one but may be different) + virtual void DrawCheckItemBitmap(wxDC& dc, + const wxBitmap& bitmap, + const wxRect& rect, + int flags); + + // common routine for drawing check and radio buttons + void DrawCheckOrRadioButton(wxDC& dc, + const wxString& label, + const wxBitmap& bitmap, + const wxRect& rect, + int flags, + wxAlignment align, + int indexAccel); + + // return the check/radio bitmap for the given flags + virtual wxBitmap GetRadioBitmap(int flags) = 0; + virtual wxBitmap GetCheckBitmap(int flags) = 0; + + // return the frame icon bitmap + virtual wxBitmap GetFrameButtonBitmap(FrameButtonType type) = 0; + + // get the width of either normal or resizable frame border depending on + // whether flags contains wxTOPLEVEL_RESIZEABLE bit + // + // notice that these methods only make sense with standard border drawing + // code which uses the borders of the same width on all sides, this is why + // they are only present here and not in wxRenderer itself + virtual int GetFrameBorderWidth(int flags) const; + +#if wxUSE_TEXTCTRL + // return the width of the border around the text area in the text control + virtual int GetTextBorderWidth(const wxTextCtrl *text) const; +#endif // wxUSE_TEXTCTRL + + // GDI objects we often use + wxPen m_penBlack, + m_penDarkGrey, + m_penLightGrey, + m_penHighlight; + + wxFont m_titlebarFont; + + // the colours we use, they never change currently so we don't have to ever + // update m_penXXX objects above + const wxColourScheme * const m_scheme; + + wxDECLARE_NO_COPY_CLASS(wxStdRenderer); +}; + +#endif // _WX_UNIV_STDREND_H_ diff --git a/lib/wxWidgets/include/wx/univ/textctrl.h b/lib/wxWidgets/include/wx/univ/textctrl.h new file mode 100644 index 0000000..7b59237 --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/textctrl.h @@ -0,0 +1,539 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/textctrl.h +// Purpose: wxTextCtrl class +// Author: Vadim Zeitlin +// Modified by: +// Created: 15.09.00 +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_TEXTCTRL_H_ +#define _WX_UNIV_TEXTCTRL_H_ + +class WXDLLIMPEXP_FWD_CORE wxCaret; +class WXDLLIMPEXP_FWD_CORE wxTextCtrlCommandProcessor; + +#include "wx/scrolwin.h" // for wxScrollHelper + +#include "wx/univ/inphand.h" + +// ---------------------------------------------------------------------------- +// wxTextCtrl actions +// ---------------------------------------------------------------------------- + +// cursor movement and also selection and delete operations +#define wxACTION_TEXT_GOTO wxT("goto") // to pos in numArg +#define wxACTION_TEXT_FIRST wxT("first") // go to pos 0 +#define wxACTION_TEXT_LAST wxT("last") // go to last pos +#define wxACTION_TEXT_HOME wxT("home") +#define wxACTION_TEXT_END wxT("end") +#define wxACTION_TEXT_LEFT wxT("left") +#define wxACTION_TEXT_RIGHT wxT("right") +#define wxACTION_TEXT_UP wxT("up") +#define wxACTION_TEXT_DOWN wxT("down") +#define wxACTION_TEXT_WORD_LEFT wxT("wordleft") +#define wxACTION_TEXT_WORD_RIGHT wxT("wordright") +#define wxACTION_TEXT_PAGE_UP wxT("pageup") +#define wxACTION_TEXT_PAGE_DOWN wxT("pagedown") +#define wxACTION_TEXT_RETURN wxT("return") + +// clipboard operations +#define wxACTION_TEXT_COPY wxT("copy") +#define wxACTION_TEXT_CUT wxT("cut") +#define wxACTION_TEXT_PASTE wxT("paste") + +// insert text at the cursor position: the text is in strArg of PerformAction +#define wxACTION_TEXT_INSERT wxT("insert") + +// if the action starts with either of these prefixes and the rest of the +// string is one of the movement commands, it means to select/delete text from +// the current cursor position to the new one +#define wxACTION_TEXT_PREFIX_SEL wxT("sel") +#define wxACTION_TEXT_PREFIX_DEL wxT("del") + +// mouse selection +#define wxACTION_TEXT_ANCHOR_SEL wxT("anchorsel") +#define wxACTION_TEXT_EXTEND_SEL wxT("extendsel") +#define wxACTION_TEXT_SEL_WORD wxT("wordsel") +#define wxACTION_TEXT_SEL_LINE wxT("linesel") + +// undo or redo +#define wxACTION_TEXT_UNDO wxT("undo") +#define wxACTION_TEXT_REDO wxT("redo") + +// ---------------------------------------------------------------------------- +// wxTextCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTextCtrl : public wxTextCtrlBase, + public wxScrollHelper +{ +public: + // creation + // -------- + + wxTextCtrl() : wxScrollHelper(this) { Init(); } + + wxTextCtrl(wxWindow *parent, + wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxTextCtrlNameStr)) + : wxScrollHelper(this) + { + Init(); + + Create(parent, id, value, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxTextCtrlNameStr)); + + virtual ~wxTextCtrl(); + + // implement base class pure virtuals + // ---------------------------------- + + virtual int GetLineLength(wxTextCoord lineNo) const wxOVERRIDE; + virtual wxString GetLineText(wxTextCoord lineNo) const wxOVERRIDE; + virtual int GetNumberOfLines() const wxOVERRIDE; + + virtual bool IsModified() const wxOVERRIDE; + virtual bool IsEditable() const wxOVERRIDE; + + virtual void SetMaxLength(unsigned long len) wxOVERRIDE; + // If the return values from and to are the same, there is no selection. + virtual void GetSelection(wxTextPos* from, wxTextPos* to) const wxOVERRIDE; + + // operations + // ---------- + + // editing + virtual void Clear() wxOVERRIDE; + virtual void Replace(wxTextPos from, wxTextPos to, const wxString& value) wxOVERRIDE; + virtual void Remove(wxTextPos from, wxTextPos to) wxOVERRIDE; + + // sets/clears the dirty flag + virtual void MarkDirty() wxOVERRIDE; + virtual void DiscardEdits() wxOVERRIDE; + + // writing text inserts it at the current position, appending always + // inserts it at the end + virtual void WriteText(const wxString& text) wxOVERRIDE; + virtual void AppendText(const wxString& text) wxOVERRIDE; + + // translate between the position (which is just an index in the text ctrl + // considering all its contents as a single strings) and (x, y) coordinates + // which represent (logical, i.e. unwrapped) column and line. + virtual wxTextPos XYToPosition(wxTextCoord x, wxTextCoord y) const wxOVERRIDE; + virtual bool PositionToXY(wxTextPos pos, + wxTextCoord *x, wxTextCoord *y) const wxOVERRIDE; + + // wxUniv-specific: find a screen position (in client coordinates) of the + // given text position or of the caret + bool PositionToLogicalXY(wxTextPos pos, wxCoord *x, wxCoord *y) const; + bool PositionToDeviceXY(wxTextPos pos, wxCoord *x, wxCoord *y) const; + wxPoint GetCaretPosition() const; + + virtual void ShowPosition(wxTextPos pos) wxOVERRIDE; + + // Clipboard operations + virtual void Copy() wxOVERRIDE; + virtual void Cut() wxOVERRIDE; + virtual void Paste() wxOVERRIDE; + + // Undo/redo + virtual void Undo() wxOVERRIDE; + virtual void Redo() wxOVERRIDE; + + virtual bool CanUndo() const wxOVERRIDE; + virtual bool CanRedo() const wxOVERRIDE; + + // Insertion point + virtual void SetInsertionPoint(wxTextPos pos) wxOVERRIDE; + virtual void SetInsertionPointEnd() wxOVERRIDE; + virtual wxTextPos GetInsertionPoint() const wxOVERRIDE; + virtual wxTextPos GetLastPosition() const wxOVERRIDE; + + virtual void SetSelection(wxTextPos from, wxTextPos to) wxOVERRIDE; + virtual void SetEditable(bool editable) wxOVERRIDE; + + // wxUniv-specific methods + // ----------------------- + + // caret stuff + virtual void ShowCaret(bool show = true); + void HideCaret() { ShowCaret(false); } + void CreateCaret(); // for the current font size + + // helpers for cursor movement + wxTextPos GetWordStart() const; + wxTextPos GetWordEnd() const; + + // selection helpers + bool HasSelection() const + { return m_selStart != -1 && m_selEnd > m_selStart; } + void ClearSelection(); + void RemoveSelection(); + wxString GetSelectionText() const; + + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const wxOVERRIDE; + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, + wxTextCoord *col, + wxTextCoord *row) const wxOVERRIDE; + + // find the character at this position in the given line, return value as + // for HitTest() + // + // NB: x is the logical coord (client and unscrolled) + wxTextCtrlHitTestResult HitTestLine(const wxString& line, + wxCoord x, + wxTextCoord *colOut) const; + + // bring the given position into view + void ShowHorzPosition(wxCoord pos); + + // scroll the window horizontally so that the first character shown is in + // position pos + void ScrollText(wxTextCoord col); + + // adjust the DC for horz text control scrolling too + virtual void DoPrepareDC(wxDC& dc) wxOVERRIDE; + + // implementation only from now on + // ------------------------------- + + // override this to take into account our scrollbar-less scrolling + virtual void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const; + virtual void CalcScrolledPosition(int x, int y, int *xx, int *yy) const; + + // perform an action + virtual bool PerformAction(const wxControlAction& action, + long numArg = -1, + const wxString& strArg = wxEmptyString) wxOVERRIDE; + + static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) wxOVERRIDE + { + return GetStdInputHandler(handlerDef); + } + + // override these methods to handle the caret + virtual bool SetFont(const wxFont &font) wxOVERRIDE; + virtual bool Enable(bool enable = true) wxOVERRIDE; + + // more readable flag testing methods + bool IsPassword() const { return HasFlag(wxTE_PASSWORD); } + bool WrapLines() const { return m_wrapLines; } + + // only for wxStdTextCtrlInputHandler + void RefreshSelection(); + + // override wxScrollHelper method to prevent (auto)scrolling beyond the end + // of line + virtual bool SendAutoScrollEvents(wxScrollWinEvent& event) const wxOVERRIDE; + + // idle processing + virtual void OnInternalIdle() wxOVERRIDE; + +protected: + // ensure we have correct default border + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_SUNKEN; } + + // override base class methods + virtual void DoDrawBorder(wxDC& dc, const wxRect& rect) wxOVERRIDE; + virtual void DoDraw(wxControlRenderer *renderer) wxOVERRIDE; + + // calc the size from the text extent + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + + // implements Set/ChangeValue() + virtual void DoSetValue(const wxString& value, int flags = 0) wxOVERRIDE; + virtual wxString DoGetValue() const wxOVERRIDE; + + // common part of all ctors + void Init(); + + // drawing + // ------- + + // draw the text in the given rectangle + void DoDrawTextInRect(wxDC& dc, const wxRect& rectUpdate); + + // draw the line wrap marks in this rect + void DoDrawLineWrapMarks(wxDC& dc, const wxRect& rectUpdate); + + // line/row geometry calculations + // ------------------------------ + + // get the extent (width) of the text + wxCoord GetTextWidth(const wxString& text) const; + + // get the logical text width (accounting for scrolling) + wxCoord GetTotalWidth() const; + + // get total number of rows (different from number of lines if the lines + // can be wrapped) + wxTextCoord GetRowCount() const; + + // find the number of rows in this line (only if WrapLines()) + wxTextCoord GetRowsPerLine(wxTextCoord line) const; + + // get the starting row of the given line + wxTextCoord GetFirstRowOfLine(wxTextCoord line) const; + + // get the row following this line + wxTextCoord GetRowAfterLine(wxTextCoord line) const; + + // refresh functions + // ----------------- + + // the text area is the part of the window in which the text can be + // displayed, i.e. part of it inside the margins and the real text area is + // the area in which the text *is* currently displayed: for example, in the + // multiline control case the text area can have extra space at the bottom + // which is not tall enough for another line and which is then not included + // into the real text area + wxRect GetRealTextArea() const; + + // refresh the text in the given (in logical coords) rect + void RefreshTextRect(const wxRect& rect, bool textOnly = true); + + // refresh the line wrap marks for the given range of lines (inclusive) + void RefreshLineWrapMarks(wxTextCoord rowFirst, wxTextCoord rowLast); + + // refresh the text in the given range (in logical coords) of this line, if + // width is 0, refresh to the end of line + void RefreshPixelRange(wxTextCoord line, wxCoord start, wxCoord width); + + // refresh the text in the given range (in text coords) in this line + void RefreshColRange(wxTextCoord line, wxTextPos start, size_t count); + + // refresh the text from in the given line range (inclusive) + void RefreshLineRange(wxTextCoord lineFirst, wxTextCoord lineLast); + + // refresh the text in the given range which can span multiple lines + // (this method accepts arguments in any order) + void RefreshTextRange(wxTextPos start, wxTextPos end); + + // get the text to show: either the text itself or the text replaced with + // starts for wxTE_PASSWORD control + wxString GetTextToShow(const wxString& text) const; + + // find the row in this line where the given position (counted from the + // start of line) is + wxTextCoord GetRowInLine(wxTextCoord line, + wxTextCoord col, + wxTextCoord *colRowStart = NULL) const; + + // find the number of characters of a line before it wraps + // (and optionally also the real width of the line) + size_t GetPartOfWrappedLine(const wxChar* text, + wxCoord *widthReal = NULL) const; + + // get the start and end of the selection for this line: if the line is + // outside the selection, both will be -1 and false will be returned + bool GetSelectedPartOfLine(wxTextCoord line, + wxTextPos *start, wxTextPos *end) const; + + // update the text rect: the zone inside our client rect (its coords are + // client coords) which contains the text + void UpdateTextRect(); + + // calculate the last visible position + void UpdateLastVisible(); + + // move caret to the given position unconditionally + // (SetInsertionPoint() does nothing if the position didn't change) + void DoSetInsertionPoint(wxTextPos pos); + + // move caret to the new position without updating the display (for + // internal use only) + void MoveInsertionPoint(wxTextPos pos); + + // set the caret to its initial (default) position + void InitInsertionPoint(); + + // get the width of the longest line in pixels + wxCoord GetMaxWidth() const; + + // force recalculation of the max line width + void RecalcMaxWidth(); + + // update the max width after the given line was modified + void UpdateMaxWidth(wxTextCoord line); + + // hit testing + // ----------- + + // HitTest2() is more efficient than 2 consecutive HitTest()s with the same + // line (i.e. y) and it also returns the offset of the starting position in + // pixels + // + // as the last hack, this function accepts either logical or device (by + // default) coords depending on devCoords flag + wxTextCtrlHitTestResult HitTest2(wxCoord y, + wxCoord x1, + wxCoord x2, + wxTextCoord *row, + wxTextCoord *colStart, + wxTextCoord *colEnd, + wxTextCoord *colRowStart, + bool devCoords = true) const; + + // HitTest() version which takes the logical text coordinates and not the + // device ones + wxTextCtrlHitTestResult HitTestLogical(const wxPoint& pos, + wxTextCoord *col, + wxTextCoord *row) const; + + // get the line and the row in this line corresponding to the given row, + // return true if ok and false if row is out of range + // + // NB: this function can only be called for controls which wrap lines + bool GetLineAndRow(wxTextCoord row, + wxTextCoord *line, + wxTextCoord *rowInLine) const; + + // get the height of one line (the same for all lines) + wxCoord GetLineHeight() const + { + // this one should be already precalculated + wxASSERT_MSG( m_heightLine != -1, wxT("should have line height") ); + + return m_heightLine; + } + + // get the average char width + wxCoord GetAverageWidth() const { return m_widthAvg; } + + // recalc the line height and char width (to call when the font changes) + void RecalcFontMetrics(); + + // vertical scrolling helpers + // -------------------------- + + // all these functions are for multi line controls only + + // get the number of visible lines + size_t GetLinesPerPage() const; + + // return the position above the cursor or INVALID_POS_VALUE + wxTextPos GetPositionAbove(); + + // return the position below the cursor or INVALID_POS_VALUE + wxTextPos GetPositionBelow(); + + // event handlers + // -------------- + void OnChar(wxKeyEvent& event); + void OnSize(wxSizeEvent& event); + + // return the struct containing control-type dependent data + struct wxTextSingleLineData& SData() { return *m_data.sdata; } + struct wxTextMultiLineData& MData() { return *m_data.mdata; } + struct wxTextWrappedData& WData() { return *m_data.wdata; } + const wxTextSingleLineData& SData() const { return *m_data.sdata; } + const wxTextMultiLineData& MData() const { return *m_data.mdata; } + const wxTextWrappedData& WData() const { return *m_data.wdata; } + + // clipboard operations (unlike the versions without Do prefix, they have a + // return code) + bool DoCut(); + bool DoPaste(); + + bool ClickDefaultButtonIfPossible(); + +private: + // all these methods are for multiline text controls only + + // update the scrollbars (only called from OnIdle) + void UpdateScrollbars(); + + // get read only access to the lines of multiline control + inline const wxArrayString& GetLines() const; + inline size_t GetLineCount() const; + + // replace a line (returns true if the number of rows in thel ine changed) + bool ReplaceLine(wxTextCoord line, const wxString& text); + + // remove a line + void RemoveLine(wxTextCoord line); + + // insert a line at this position + void InsertLine(wxTextCoord line, const wxString& text); + + // calculate geometry of this line + void LayoutLine(wxTextCoord line, class wxWrappedLineData& lineData) const; + + // calculate geometry of all lines until the given one + void LayoutLines(wxTextCoord lineLast) const; + + // the initially specified control size + wxSize m_sizeInitial; + + // the global control text + wxString m_value; + + // current position + wxTextPos m_curPos; + wxTextCoord m_curCol, + m_curRow; + + // last position (only used by GetLastPosition()) + wxTextPos m_posLast; + + // max text line length + unsigned long m_maxLength; + + // selection + wxTextPos m_selAnchor, + m_selStart, + m_selEnd; + + // flags + bool m_isModified:1, + m_isEditable:1, + m_hasCaret:1, + m_wrapLines:1; // can't be changed after creation + + // the rectangle (in client coordinates) to draw text inside + wxRect m_rectText; + + // the height of one line (cached value of GetCharHeight) + wxCoord m_heightLine; + + // and the average char width (cached value of GetCharWidth) + wxCoord m_widthAvg; + + // we have some data which depends on the kind of control (single or multi + // line) + union + { + wxTextSingleLineData *sdata; + wxTextMultiLineData *mdata; + wxTextWrappedData *wdata; + void *data; + } m_data; + + // the object to which we delegate our undo/redo implementation + wxTextCtrlCommandProcessor *m_cmdProcessor; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxTextCtrl); + + friend class wxWrappedLineData; +}; + +#endif // _WX_UNIV_TEXTCTRL_H_ + diff --git a/lib/wxWidgets/include/wx/univ/tglbtn.h b/lib/wxWidgets/include/wx/univ/tglbtn.h new file mode 100644 index 0000000..a49adef --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/tglbtn.h @@ -0,0 +1,65 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/tglbtn.h +// Purpose: wxToggleButton for wxUniversal +// Author: Vadim Zeitlin +// Modified by: David Bjorkevik +// Created: 16.05.06 +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_TGLBTN_H_ +#define _WX_UNIV_TGLBTN_H_ + +// ---------------------------------------------------------------------------- +// wxToggleButton: a push button +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxToggleButton: public wxToggleButtonBase +{ +public: + wxToggleButton(); + + wxToggleButton(wxWindow *parent, + wxWindowID id, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)); + + // Create the control + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& lbl = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxCheckBoxNameStr)); + + virtual bool IsPressed() const wxOVERRIDE { return m_isPressed || m_value; } + + // wxToggleButton actions + virtual void Toggle() wxOVERRIDE; + virtual void Click() wxOVERRIDE; + + // Get/set the value + void SetValue(bool state); + bool GetValue() const { return m_value; } + +protected: + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + + // the current value + bool m_value; + +private: + // common part of all ctors + void Init(); + + wxDECLARE_DYNAMIC_CLASS(wxToggleButton); +}; + +#endif // _WX_UNIV_TGLBTN_H_ diff --git a/lib/wxWidgets/include/wx/univ/theme.h b/lib/wxWidgets/include/wx/univ/theme.h new file mode 100644 index 0000000..e50adbc --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/theme.h @@ -0,0 +1,201 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/theme.h +// Purpose: wxTheme class manages all configurable aspects of the +// application including the look (wxRenderer), feel +// (wxInputHandler) and the colours (wxColourScheme) +// Author: Vadim Zeitlin +// Modified by: +// Created: 06.08.00 +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_THEME_H_ +#define _WX_UNIV_THEME_H_ + +#include "wx/string.h" + +// ---------------------------------------------------------------------------- +// wxTheme +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxArtProvider; +class WXDLLIMPEXP_FWD_CORE wxColourScheme; +class WXDLLIMPEXP_FWD_CORE wxInputConsumer; +class WXDLLIMPEXP_FWD_CORE wxInputHandler; +class WXDLLIMPEXP_FWD_CORE wxRenderer; +struct WXDLLIMPEXP_FWD_CORE wxThemeInfo; + +class WXDLLIMPEXP_CORE wxTheme +{ +public: + // static methods + // -------------- + + // create the default theme + static bool CreateDefault(); + + // create the theme by name (will return NULL if not found) + static wxTheme *Create(const wxString& name); + + // change the current scheme + static wxTheme *Set(wxTheme *theme); + + // get the current theme (never NULL) + static wxTheme *Get() { return ms_theme; } + + // the theme methods + // ----------------- + + // get the renderer implementing all the control-drawing operations in + // this theme + virtual wxRenderer *GetRenderer() = 0; + + // get the art provider to be used together with this theme + virtual wxArtProvider *GetArtProvider() = 0; + + // get the input handler of the given type, forward to the standard one + virtual wxInputHandler *GetInputHandler(const wxString& handlerType, + wxInputConsumer *consumer) = 0; + + // get the colour scheme for the control with this name + virtual wxColourScheme *GetColourScheme() = 0; + + // implementation only from now on + // ------------------------------- + + virtual ~wxTheme(); + +private: + // the list of descriptions of all known themes + static wxThemeInfo *ms_allThemes; + + // the current theme + static wxTheme *ms_theme; + friend struct wxThemeInfo; +}; + +// ---------------------------------------------------------------------------- +// wxDelegateTheme: it is impossible to inherit from any of standard +// themes as their declarations are in private code, but you can use this +// class to override only some of their functions - all the other ones +// will be left to the original theme +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDelegateTheme : public wxTheme +{ +public: + wxDelegateTheme(const wxString& theme); + virtual ~wxDelegateTheme(); + + virtual wxRenderer *GetRenderer(); + virtual wxArtProvider *GetArtProvider(); + virtual wxInputHandler *GetInputHandler(const wxString& control, + wxInputConsumer *consumer); + virtual wxColourScheme *GetColourScheme(); + +protected: + // gets or creates theme and sets m_theme to point to it, + // returns true on success + bool GetOrCreateTheme(); + + wxString m_themeName; + wxTheme *m_theme; +}; + +// ---------------------------------------------------------------------------- +// dynamic theme creation helpers +// ---------------------------------------------------------------------------- + +struct WXDLLIMPEXP_CORE wxThemeInfo +{ + typedef wxTheme *(*Constructor)(); + + // theme name and (user readable) description + wxString name, desc; + + // the function to create a theme object + Constructor ctor; + + // next node in the linked list or NULL + wxThemeInfo *next; + + // constructor for the struct itself + wxThemeInfo(Constructor ctor, const wxString& name, const wxString& desc); +}; + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +// to use a standard theme insert this macro into one of the application files: +// without it, an over optimizing linker may discard the object module +// containing the theme implementation entirely +#define WX_USE_THEME(themename) \ + /* this indirection makes it possible to pass macro as the argument */ \ + WX_USE_THEME_IMPL(themename) + +#define WX_USE_THEME_IMPL(themename) \ + extern WXDLLIMPEXP_DATA_CORE(bool) wxThemeUse##themename; \ + static struct wxThemeUserFor##themename \ + { \ + wxThemeUserFor##themename() { wxThemeUse##themename = true; } \ + } wxThemeDoUse##themename + +// to declare a new theme, this macro must be used in the class declaration +#define WX_DECLARE_THEME(themename) \ + private: \ + static wxThemeInfo ms_info##themename; \ + public: \ + const wxThemeInfo *GetThemeInfo() const \ + { return &ms_info##themename; } + +// and this one must be inserted in the source file +#define WX_IMPLEMENT_THEME(classname, themename, themedesc) \ + WXDLLIMPEXP_DATA_CORE(bool) wxThemeUse##themename = true; \ + wxTheme *wxCtorFor##themename() { return new classname; } \ + wxThemeInfo classname::ms_info##themename(wxCtorFor##themename, \ + wxT( #themename ), themedesc) + +// ---------------------------------------------------------------------------- +// determine default theme +// ---------------------------------------------------------------------------- + +#if wxUSE_ALL_THEMES + #undef wxUSE_THEME_WIN32 + #define wxUSE_THEME_WIN32 1 + #undef wxUSE_THEME_GTK + #define wxUSE_THEME_GTK 1 + #undef wxUSE_THEME_MONO + #define wxUSE_THEME_MONO 1 + #undef wxUSE_THEME_METAL + #define wxUSE_THEME_METAL 1 +#endif // wxUSE_ALL_THEMES + +// determine the default theme to use: +#if defined(__WXGTK__) && wxUSE_THEME_GTK + #define wxUNIV_DEFAULT_THEME gtk +#elif defined(__WXDFB__) && wxUSE_THEME_MONO + // use mono theme for DirectFB port because it cannot correctly + // render either win32 or gtk themes yet: + #define wxUNIV_DEFAULT_THEME mono +#endif + +// if no theme was picked, get any theme compiled in (sorted by +// quality/completeness of the theme): +#ifndef wxUNIV_DEFAULT_THEME + #if wxUSE_THEME_GTK + #define wxUNIV_DEFAULT_THEME gtk + #elif wxUSE_THEME_WIN32 + #define wxUNIV_DEFAULT_THEME win32 + #elif wxUSE_THEME_MONO + #define wxUNIV_DEFAULT_THEME mono + #endif + // If nothing matches, no themes are compiled and the app must provide + // some theme itself + // (note that wxUSE_THEME_METAL depends on win32 theme, so we don't have to + // try it) + // +#endif // !wxUNIV_DEFAULT_THEME + +#endif // _WX_UNIV_THEME_H_ diff --git a/lib/wxWidgets/include/wx/univ/toolbar.h b/lib/wxWidgets/include/wx/univ/toolbar.h new file mode 100644 index 0000000..3d8bcd7 --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/toolbar.h @@ -0,0 +1,135 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/toolbar.h +// Purpose: wxToolBar declaration +// Author: Robert Roebling +// Modified by: +// Created: 10.09.00 +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_TOOLBAR_H_ +#define _WX_UNIV_TOOLBAR_H_ + +#include "wx/button.h" // for wxStdButtonInputHandler + +class WXDLLIMPEXP_FWD_CORE wxToolBarTool; + +// ---------------------------------------------------------------------------- +// the actions supported by this control +// ---------------------------------------------------------------------------- + +#define wxACTION_TOOLBAR_TOGGLE wxACTION_BUTTON_TOGGLE +#define wxACTION_TOOLBAR_PRESS wxACTION_BUTTON_PRESS +#define wxACTION_TOOLBAR_RELEASE wxACTION_BUTTON_RELEASE +#define wxACTION_TOOLBAR_CLICK wxACTION_BUTTON_CLICK +#define wxACTION_TOOLBAR_ENTER wxT("enter") // highlight the tool +#define wxACTION_TOOLBAR_LEAVE wxT("leave") // unhighlight the tool + +// ---------------------------------------------------------------------------- +// wxToolBar +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxToolBar : public wxToolBarBase +{ +public: + // construction/destruction + wxToolBar() { Init(); } + wxToolBar(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxToolBarNameStr)) + { + Init(); + + Create(parent, id, pos, size, style, name); + } + + bool Create( wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxToolBarNameStr) ); + + virtual ~wxToolBar(); + + virtual bool Realize() wxOVERRIDE; + + virtual void SetWindowStyleFlag( long style ) wxOVERRIDE; + + virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const wxOVERRIDE; + + virtual void SetToolShortHelp(int id, const wxString& helpString) wxOVERRIDE; + + virtual void SetMargins(int x, int y) wxOVERRIDE; + void SetMargins(const wxSize& size) + { SetMargins((int) size.x, (int) size.y); } + + virtual bool PerformAction(const wxControlAction& action, + long numArg = -1, + const wxString& strArg = wxEmptyString) wxOVERRIDE; + static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) wxOVERRIDE + { + return GetStdInputHandler(handlerDef); + } + +protected: + // common part of all ctors + void Init(); + + // implement base class pure virtuals + virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE; + virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE; + + virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable) wxOVERRIDE; + virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle) wxOVERRIDE; + virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle) wxOVERRIDE; + + virtual wxToolBarToolBase *CreateTool(int id, + const wxString& label, + const wxBitmapBundle& bmpNormal, + const wxBitmapBundle& bmpDisabled, + wxItemKind kind, + wxObject *clientData, + const wxString& shortHelp, + const wxString& longHelp) wxOVERRIDE; + virtual wxToolBarToolBase *CreateTool(wxControl *control, + const wxString& label) wxOVERRIDE; + + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + virtual void DoDraw(wxControlRenderer *renderer) wxOVERRIDE; + + // get the bounding rect for the given tool + wxRect GetToolRect(wxToolBarToolBase *tool) const; + + // redraw the given tool + void RefreshTool(wxToolBarToolBase *tool); + + // (re)calculate the tool positions, should only be called if it is + // necessary to do it, i.e. m_needsLayout == true + void DoLayout(); + + // get the rect limits depending on the orientation: top/bottom for a + // vertical toolbar, left/right for a horizontal one + void GetRectLimits(const wxRect& rect, wxCoord *start, wxCoord *end) const; + +private: + // have we calculated the positions of our tools? + bool m_needsLayout; + + // the width of a separator + wxCoord m_widthSeparator; + + // the total size of all toolbar elements + wxCoord m_maxWidth, + m_maxHeight; + +private: + wxDECLARE_DYNAMIC_CLASS(wxToolBar); +}; + +#endif // _WX_UNIV_TOOLBAR_H_ diff --git a/lib/wxWidgets/include/wx/univ/toplevel.h b/lib/wxWidgets/include/wx/univ/toplevel.h new file mode 100644 index 0000000..e2e8efc --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/toplevel.h @@ -0,0 +1,195 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/toplevel.h +// Purpose: Top level window, abstraction of wxFrame and wxDialog +// Author: Vaclav Slavik +// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __WX_UNIV_TOPLEVEL_H__ +#define __WX_UNIV_TOPLEVEL_H__ + +#include "wx/univ/inpcons.h" +#include "wx/univ/inphand.h" +#include "wx/icon.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// frame decorations type flags used in wxRenderer and wxColourScheme +enum +{ + wxTOPLEVEL_ACTIVE = 0x00000001, + wxTOPLEVEL_MAXIMIZED = 0x00000002, + wxTOPLEVEL_TITLEBAR = 0x00000004, + wxTOPLEVEL_ICON = 0x00000008, + wxTOPLEVEL_RESIZEABLE = 0x00000010, + wxTOPLEVEL_BORDER = 0x00000020, + wxTOPLEVEL_BUTTON_CLOSE = 0x01000000, + wxTOPLEVEL_BUTTON_MAXIMIZE = 0x02000000, + wxTOPLEVEL_BUTTON_ICONIZE = 0x04000000, + wxTOPLEVEL_BUTTON_RESTORE = 0x08000000, + wxTOPLEVEL_BUTTON_HELP = 0x10000000 +}; + +// frame hit test return values: +enum +{ + wxHT_TOPLEVEL_NOWHERE = 0x00000000, + wxHT_TOPLEVEL_CLIENT_AREA = 0x00000001, + wxHT_TOPLEVEL_ICON = 0x00000002, + wxHT_TOPLEVEL_TITLEBAR = 0x00000004, + + wxHT_TOPLEVEL_BORDER_N = 0x00000010, + wxHT_TOPLEVEL_BORDER_S = 0x00000020, + wxHT_TOPLEVEL_BORDER_E = 0x00000040, + wxHT_TOPLEVEL_BORDER_W = 0x00000080, + wxHT_TOPLEVEL_BORDER_NE = wxHT_TOPLEVEL_BORDER_N | wxHT_TOPLEVEL_BORDER_E, + wxHT_TOPLEVEL_BORDER_SE = wxHT_TOPLEVEL_BORDER_S | wxHT_TOPLEVEL_BORDER_E, + wxHT_TOPLEVEL_BORDER_NW = wxHT_TOPLEVEL_BORDER_N | wxHT_TOPLEVEL_BORDER_W, + wxHT_TOPLEVEL_BORDER_SW = wxHT_TOPLEVEL_BORDER_S | wxHT_TOPLEVEL_BORDER_W, + wxHT_TOPLEVEL_ANY_BORDER = 0x000000F0, + + wxHT_TOPLEVEL_BUTTON_CLOSE = /*0x01000000*/ wxTOPLEVEL_BUTTON_CLOSE, + wxHT_TOPLEVEL_BUTTON_MAXIMIZE = /*0x02000000*/ wxTOPLEVEL_BUTTON_MAXIMIZE, + wxHT_TOPLEVEL_BUTTON_ICONIZE = /*0x04000000*/ wxTOPLEVEL_BUTTON_ICONIZE, + wxHT_TOPLEVEL_BUTTON_RESTORE = /*0x08000000*/ wxTOPLEVEL_BUTTON_RESTORE, + wxHT_TOPLEVEL_BUTTON_HELP = /*0x10000000*/ wxTOPLEVEL_BUTTON_HELP, + wxHT_TOPLEVEL_ANY_BUTTON = 0x1F000000 +}; + +// Flags for interactive frame manipulation functions (only in wxUniversal): +enum +{ + wxINTERACTIVE_MOVE = 0x00000001, + wxINTERACTIVE_RESIZE = 0x00000002, + wxINTERACTIVE_RESIZE_S = 0x00000010, + wxINTERACTIVE_RESIZE_N = 0x00000020, + wxINTERACTIVE_RESIZE_W = 0x00000040, + wxINTERACTIVE_RESIZE_E = 0x00000080, + wxINTERACTIVE_WAIT_FOR_INPUT = 0x10000000 +}; + +// ---------------------------------------------------------------------------- +// the actions supported by this control +// ---------------------------------------------------------------------------- + +#define wxACTION_TOPLEVEL_ACTIVATE wxT("activate") // (de)activate the frame +#define wxACTION_TOPLEVEL_BUTTON_PRESS wxT("pressbtn") // press titlebar btn +#define wxACTION_TOPLEVEL_BUTTON_RELEASE wxT("releasebtn") // press titlebar btn +#define wxACTION_TOPLEVEL_BUTTON_CLICK wxT("clickbtn") // press titlebar btn +#define wxACTION_TOPLEVEL_MOVE wxT("move") // move the frame +#define wxACTION_TOPLEVEL_RESIZE wxT("resize") // resize the frame + +//----------------------------------------------------------------------------- +// wxTopLevelWindow +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTopLevelWindow : public wxTopLevelWindowNative, + public wxInputConsumer +{ +public: + // construction + wxTopLevelWindow() { Init(); } + wxTopLevelWindow(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Init(); + + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + // wxUniv-specific methods: do [not] use native decorations for this (or + // all) window(s) + // + // notice that this has no effect if the system doesn't support any native + // decorations anyhow and that by default native decorations are used + // + // if UseNativeDecorations() is used, it must be called before Create() + static void UseNativeDecorationsByDefault(bool native = true); + void UseNativeDecorations(bool native = true); + bool IsUsingNativeDecorations() const; + + + // implement base class pure virtuals + virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) wxOVERRIDE; + virtual wxPoint GetClientAreaOrigin() const wxOVERRIDE; + virtual void SetIcons(const wxIconBundle& icons) wxOVERRIDE; + + // implementation from now on + // -------------------------- + + // tests for frame's part at given point + long HitTest(const wxPoint& pt) const; + + virtual bool PerformAction(const wxControlAction& action, + long numArg = -1, + const wxString& strArg = wxEmptyString) wxOVERRIDE; + + static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) wxOVERRIDE + { + return GetStdInputHandler(handlerDef); + } + + // move/resize the frame interactively, i.e. let the user do it + virtual void InteractiveMove(int flags = wxINTERACTIVE_MOVE); + + virtual wxSize GetMinSize() const wxOVERRIDE; + + virtual wxWindow *GetInputWindow() const wxOVERRIDE { return const_cast<wxTopLevelWindow*>(this); } + +protected: + virtual void DoGetClientSize(int *width, int *height) const wxOVERRIDE; + virtual void DoSetClientSize(int width, int height) wxOVERRIDE; + + // handle titlebar button click event + virtual void ClickTitleBarButton(long button); + + // return wxTOPLEVEL_xxx combination based on current state of the frame + long GetDecorationsStyle() const; + + // common part of all ctors + void Init(); + + void RefreshTitleBar(); + void OnNcPaint(wxNcPaintEvent& event); + void OnSystemMenu(wxCommandEvent& event); + + // true if wxTLW should render decorations (aka titlebar) itself + static int ms_drawDecorations; + // true if wxTLW can be iconized + static int ms_canIconize; + + // true if we're using native decorations + bool m_usingNativeDecorations; + // true for currently active frame + bool m_isActive; + // version of icon for titlebar (16x16) + wxIcon m_titlebarIcon; + // saved window style in fullscreen mdoe + long m_fsSavedStyle; + // currently pressed titlebar button + long m_pressedButton; + + wxDECLARE_DYNAMIC_CLASS(wxTopLevelWindow); + wxDECLARE_EVENT_TABLE(); + WX_DECLARE_INPUT_CONSUMER() +}; + +#endif // __WX_UNIV_TOPLEVEL_H__ diff --git a/lib/wxWidgets/include/wx/univ/window.h b/lib/wxWidgets/include/wx/univ/window.h new file mode 100644 index 0000000..5909cbc --- /dev/null +++ b/lib/wxWidgets/include/wx/univ/window.h @@ -0,0 +1,290 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/window.h +// Purpose: wxWindow class which is the base class for all +// wxUniv port controls, it supports the customization of the +// window drawing and input processing. +// Author: Vadim Zeitlin +// Modified by: +// Created: 06.08.00 +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_WINDOW_H_ +#define _WX_UNIV_WINDOW_H_ + +#include "wx/bitmap.h" // for m_bitmapBg + +class WXDLLIMPEXP_FWD_CORE wxControlRenderer; +class WXDLLIMPEXP_FWD_CORE wxEventLoop; + +#if wxUSE_MENUS + class WXDLLIMPEXP_FWD_CORE wxMenu; + class WXDLLIMPEXP_FWD_CORE wxMenuBar; +#endif // wxUSE_MENUS + +class WXDLLIMPEXP_FWD_CORE wxRenderer; + +#if wxUSE_SCROLLBAR + class WXDLLIMPEXP_FWD_CORE wxScrollBar; +#endif // wxUSE_SCROLLBAR + +#ifdef __WXX11__ +#define wxUSE_TWO_WINDOWS 1 +#else +#define wxUSE_TWO_WINDOWS 0 +#endif + +// ---------------------------------------------------------------------------- +// wxWindow +// ---------------------------------------------------------------------------- + +#if defined(__WXMSW__) +#define wxWindowNative wxWindowMSW +#elif defined(__WXGTK__) +#define wxWindowNative wxWindowGTK +#elif defined(__WXX11__) +#define wxWindowNative wxWindowX11 +#elif defined(__WXMAC__) +#define wxWindowNative wxWindowMac +#endif + +class WXDLLIMPEXP_CORE wxWindow : public wxWindowNative +{ +public: + // ctors and create functions + // --------------------------- + + wxWindow() { Init(); } + + wxWindow(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)) + : wxWindowNative(parent, id, pos, size, style | wxCLIP_CHILDREN, name) + { Init(); } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)); + + virtual ~wxWindow(); + + // background pixmap support + // ------------------------- + + virtual void SetBackground(const wxBitmap& bitmap, + int alignment = wxALIGN_CENTRE, + wxStretch stretch = wxSTRETCH_NOT); + + const wxBitmap& GetBackgroundBitmap(int *alignment = NULL, + wxStretch *stretch = NULL) const; + + // scrollbars: we (re)implement it ourselves using our own scrollbars + // instead of the native ones + // ------------------------------------------------------------------ + + virtual void SetScrollbar(int orient, + int pos, + int page, + int range, + bool refresh = true ) wxOVERRIDE; + virtual void SetScrollPos(int orient, int pos, bool refresh = true) wxOVERRIDE; + virtual int GetScrollPos(int orient) const wxOVERRIDE; + virtual int GetScrollThumb(int orient) const wxOVERRIDE; + virtual int GetScrollRange(int orient) const wxOVERRIDE; + virtual void ScrollWindow(int dx, int dy, + const wxRect* rect = NULL) wxOVERRIDE; + + // take into account the borders here + virtual wxPoint GetClientAreaOrigin() const wxOVERRIDE; + + // popup menu support + // ------------------ + + // NB: all menu related functions are implemented in menu.cpp + +#if wxUSE_MENUS + // this is wxUniv-specific private method to be used only by wxMenu + void DismissPopupMenu(); +#endif // wxUSE_MENUS + + // miscellaneous other methods + // --------------------------- + + // get the state information + virtual bool IsFocused() const; + virtual bool IsCurrent() const; + virtual bool IsPressed() const; + virtual bool IsDefault() const; + + // return all state flags at once (combination of wxCONTROL_XXX values) + int GetStateFlags() const; + + // set the "highlighted" flag and return true if it changed + virtual bool SetCurrent(bool doit = true); + +#if wxUSE_SCROLLBAR + // get the scrollbar (may be NULL) for the given orientation + wxScrollBar *GetScrollbar(int orient) const + { + return orient & wxVERTICAL ? m_scrollbarVert : m_scrollbarHorz; + } +#endif // wxUSE_SCROLLBAR + + // methods used by wxColourScheme to choose the colours for this window + // -------------------------------------------------------------------- + + // return true if this is a panel/canvas window which contains other + // controls only + virtual bool IsCanvasWindow() const { return false; } + + // return true if this control can be highlighted when the mouse is over + // it (the theme decides itself whether it is really highlighted or not) + virtual bool CanBeHighlighted() const { return false; } + + // return true if we should use the colours/fonts returned by the + // corresponding GetXXX() methods instead of the default ones + bool UseFgCol() const { return m_hasFgCol; } + bool UseFont() const { return m_hasFont; } + + // return true if this window serves as a container for the other windows + // only and doesn't get any input itself + virtual bool IsStaticBox() const { return false; } + + // returns the (low level) renderer to use for drawing the control by + // querying the current theme + wxRenderer *GetRenderer() const { return m_renderer; } + + // scrolling helper: like ScrollWindow() except that it doesn't refresh the + // uncovered window areas but returns the rectangle to update (don't call + // this with both dx and dy non zero) + wxRect ScrollNoRefresh(int dx, int dy, const wxRect *rect = NULL); + + // after scrollbars are added or removed they must be refreshed by calling + // this function + void RefreshScrollbars(); + + // erase part of the control + virtual void EraseBackground(wxDC& dc, const wxRect& rect); + + // overridden base class methods + // ----------------------------- + + // the rect coordinates are, for us, in client coords, but if no rect is + // specified, the entire window is refreshed + virtual void Refresh(bool eraseBackground = true, + const wxRect *rect = (const wxRect *) NULL) wxOVERRIDE; + + // we refresh the window when it is dis/enabled + virtual bool Enable(bool enable = true) wxOVERRIDE; + + // should we use the standard control colours or not? + virtual bool ShouldInheritColours() const wxOVERRIDE { return false; } + + virtual bool IsClientAreaChild(const wxWindow *child) const wxOVERRIDE + { +#if wxUSE_SCROLLBAR + if ( child == (wxWindow*)m_scrollbarHorz || + child == (wxWindow*)m_scrollbarVert ) + return false; +#endif + return wxWindowNative::IsClientAreaChild(child); + } + + virtual wxSize GetWindowBorderSize() const wxOVERRIDE; + +protected: + // common part of all ctors + void Init(); + +#if wxUSE_MENUS + virtual bool DoPopupMenu(wxMenu *menu, int x, int y) wxOVERRIDE; +#endif // wxUSE_MENUS + + // we deal with the scrollbars in these functions + virtual void DoSetClientSize(int width, int height) wxOVERRIDE; + virtual void DoGetClientSize(int *width, int *height) const wxOVERRIDE; + virtual wxHitTest DoHitTest(wxCoord x, wxCoord y) const wxOVERRIDE; + + // event handlers + void OnSize(wxSizeEvent& event); + void OnNcPaint(wxNcPaintEvent& event); + void OnPaint(wxPaintEvent& event); + void OnErase(wxEraseEvent& event); + +#if wxUSE_ACCEL || wxUSE_MENUS + void OnKeyDown(wxKeyEvent& event); +#endif // wxUSE_ACCEL + +#if wxUSE_MENUS + void OnChar(wxKeyEvent& event); + void OnKeyUp(wxKeyEvent& event); +#endif // wxUSE_MENUS + + // draw the control background, return true if done + virtual bool DoDrawBackground(wxDC& dc); + + // draw the controls border + virtual void DoDrawBorder(wxDC& dc, const wxRect& rect); + + // draw the controls contents + virtual void DoDraw(wxControlRenderer *renderer); + + // adjust the size of the window to take into account its borders + wxSize AdjustSize(const wxSize& size) const; + + // put the scrollbars along the edges of the window + void PositionScrollbars(); + +#if wxUSE_MENUS + // return the menubar of the parent frame or NULL + wxMenuBar *GetParentFrameMenuBar() const; +#endif // wxUSE_MENUS + + // the renderer we use + wxRenderer *m_renderer; + + // background bitmap info + wxBitmap m_bitmapBg; + int m_alignBgBitmap; + wxStretch m_stretchBgBitmap; + + // old size + wxSize m_oldSize; + + // is the mouse currently inside the window? + bool m_isCurrent:1; + +#ifdef __WXMSW__ +public: + // override MSWWindowProc() to process WM_NCHITTEST + WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); +#endif // __WXMSW__ + +private: + +#if wxUSE_SCROLLBAR + // the window scrollbars + wxScrollBar *m_scrollbarHorz, + *m_scrollbarVert; +#endif // wxUSE_SCROLLBAR + +#if wxUSE_MENUS + // the current modal event loop for the popup menu we show or NULL + static wxEventLoop *ms_evtLoopPopup; + + // the last window over which Alt was pressed (used by OnKeyUp) + static wxWindow *ms_winLastAltPress; +#endif // wxUSE_MENUS + + wxDECLARE_DYNAMIC_CLASS(wxWindow); + wxDECLARE_EVENT_TABLE(); +}; + +#endif // _WX_UNIV_WINDOW_H_ diff --git a/lib/wxWidgets/include/wx/unix/app.h b/lib/wxWidgets/include/wx/unix/app.h new file mode 100644 index 0000000..8b17354 --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/app.h @@ -0,0 +1,73 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/app.h +// Purpose: wxAppConsole implementation for Unix +// Author: Lukasz Michalski +// Created: 28/01/2005 +// Copyright: (c) Lukasz Michalski +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +//Ensure that sigset_t is being defined +#include <signal.h> + +class wxFDIODispatcher; +class wxFDIOHandler; +class wxWakeUpPipe; + +// wxApp subclass implementing event processing for console applications +class WXDLLIMPEXP_BASE wxAppConsole : public wxAppConsoleBase +{ +public: + wxAppConsole(); + virtual ~wxAppConsole(); + + // override base class initialization + virtual bool Initialize(int& argc, wxChar** argv) wxOVERRIDE; + + + // Unix-specific: Unix signal handling + // ----------------------------------- + + // type of the function which can be registered as signal handler: notice + // that it isn't really a signal handler, i.e. it's not subject to the + // usual signal handlers constraints, because it is called later from + // CheckSignal() and not when the signal really occurs + typedef void (*SignalHandler)(int); + + // Set signal handler for the given signal, SIG_DFL or SIG_IGN can be used + // instead of a function pointer + // + // Return true if handler was installed, false on error + bool SetSignalHandler(int signal, SignalHandler handler); + + // Check if any Unix signals arrived since the last call and execute + // handlers for them + void CheckSignal(); + + // Register the signal wake up pipe with the given dispatcher. + // + // This is used by wxExecute(wxEXEC_NOEVENTS) implementation only. + // + // The pointer to the handler used for processing events on this descriptor + // is returned so that it can be deleted when we no longer needed it. + wxFDIOHandler* RegisterSignalWakeUpPipe(wxFDIODispatcher& dispatcher); + +private: + // signal handler set up by SetSignalHandler() for all signals we handle, + // it just adds the signal to m_signalsCaught -- the real processing is + // done later, when CheckSignal() is called + static void HandleSignal(int signal); + + + // signals for which HandleSignal() had been called (reset from + // CheckSignal()) + sigset_t m_signalsCaught; + + // the signal handlers + WX_DECLARE_HASH_MAP(int, SignalHandler, wxIntegerHash, wxIntegerEqual, SignalHandlerHash); + SignalHandlerHash m_signalHandlerHash; + + // pipe used for wake up signal handling: if a signal arrives while we're + // blocking for input, writing to this pipe triggers a call to our CheckSignal() + wxWakeUpPipe *m_signalWakeUpPipe; +}; diff --git a/lib/wxWidgets/include/wx/unix/apptbase.h b/lib/wxWidgets/include/wx/unix/apptbase.h new file mode 100644 index 0000000..5ce97d6 --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/apptbase.h @@ -0,0 +1,67 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/apptbase.h +// Purpose: declaration of wxAppTraits for Unix systems +// Author: Vadim Zeitlin +// Modified by: +// Created: 23.06.2003 +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_APPTBASE_H_ +#define _WX_UNIX_APPTBASE_H_ + +#include "wx/evtloop.h" +#include "wx/evtloopsrc.h" + +class wxExecuteData; +class wxFDIOManager; +class wxEventLoopSourcesManagerBase; + +// ---------------------------------------------------------------------------- +// wxAppTraits: the Unix version adds extra hooks needed by Unix code +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxAppTraits : public wxAppTraitsBase +{ +public: + // wxExecute() support methods + // --------------------------- + + // Wait for the process termination and return its exit code or -1 on error. + // + // Notice that this is only used when execData.flags contains wxEXEC_SYNC + // and does not contain wxEXEC_NOEVENTS, i.e. when we need to really wait + // until the child process exit and dispatch the events while doing it. + virtual int WaitForChild(wxExecuteData& execData); + +#if wxUSE_SOCKETS + // return a pointer to the object which should be used to integrate + // monitoring of the file descriptors to the event loop (currently this is + // used for the sockets only but should be used for arbitrary event loop + // sources in the future) + // + // this object may be different for the console and GUI applications + // + // the pointer is not deleted by the caller as normally it points to a + // static variable + virtual wxFDIOManager *GetFDIOManager(); +#endif // wxUSE_SOCKETS + +#if wxUSE_CONSOLE_EVENTLOOP && wxUSE_EVENTLOOP_SOURCE + // Return a non-NULL pointer to the object responsible for managing the + // event loop sources in this kind of application. + virtual wxEventLoopSourcesManagerBase* GetEventLoopSourcesManager(); +#endif // wxUSE_CONSOLE_EVENTLOOP && wxUSE_CONSOLE_EVENTLOOP + +protected: + // Wait for the process termination by running the given event loop until + // this happens. + // + // This is used by the public WaitForChild() after creating the event loop + // of the appropriate kind. + int RunLoopUntilChildExit(wxExecuteData& execData, wxEventLoopBase& loop); +}; + +#endif // _WX_UNIX_APPTBASE_H_ + diff --git a/lib/wxWidgets/include/wx/unix/apptrait.h b/lib/wxWidgets/include/wx/unix/apptrait.h new file mode 100644 index 0000000..6513653 --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/apptrait.h @@ -0,0 +1,93 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/apptrait.h +// Purpose: standard implementations of wxAppTraits for Unix +// Author: Vadim Zeitlin +// Modified by: +// Created: 23.06.2003 +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_APPTRAIT_H_ +#define _WX_UNIX_APPTRAIT_H_ + +// ---------------------------------------------------------------------------- +// wxGUI/ConsoleAppTraits: must derive from wxAppTraits, not wxAppTraitsBase +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxConsoleAppTraits : public wxConsoleAppTraitsBase +{ +public: +#if wxUSE_CONSOLE_EVENTLOOP + virtual wxEventLoopBase *CreateEventLoop() wxOVERRIDE; +#endif // wxUSE_CONSOLE_EVENTLOOP +#if wxUSE_TIMER + virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer) wxOVERRIDE; +#endif +}; + +#if wxUSE_GUI + +// GTK+ and Motif integrate sockets and child processes monitoring directly in +// their main loop, the other Unix ports do it at wxEventLoop level and so use +// the non-GUI traits and don't need anything here +// +// TODO: Should we use XtAddInput() for wxX11 too? Or, vice versa, if there is +// no advantage in doing this compared to the generic way currently used +// by wxX11, should we continue to use GTK/Motif-specific stuff? +#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXQT__) + #define wxHAS_GUI_FDIOMANAGER + #define wxHAS_GUI_PROCESS_CALLBACKS +#endif // ports using wxFDIOManager + +#if defined(__WXMAC__) + #define wxHAS_GUI_PROCESS_CALLBACKS + #define wxHAS_GUI_SOCKET_MANAGER +#endif + +class WXDLLIMPEXP_CORE wxGUIAppTraits : public wxGUIAppTraitsBase +{ +public: + virtual wxEventLoopBase *CreateEventLoop() wxOVERRIDE; + virtual int WaitForChild(wxExecuteData& execData) wxOVERRIDE; +#if wxUSE_TIMER + virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer) wxOVERRIDE; +#endif +#if wxUSE_THREADS && defined(__WXGTK20__) + virtual void MutexGuiEnter() wxOVERRIDE; + virtual void MutexGuiLeave() wxOVERRIDE; +#endif + + wxPortId GetToolkitVersion(int *majVer = NULL, + int *minVer = NULL, + int *microVer = NULL) const wxOVERRIDE; + +#ifdef __WXGTK20__ + virtual wxString GetDesktopEnvironment() const wxOVERRIDE; +#endif // __WXGTK20____ + +#if defined(__WXGTK20__) + virtual bool ShowAssertDialog(const wxString& msg) wxOVERRIDE; +#endif + +#if wxUSE_SOCKETS + +#ifdef wxHAS_GUI_SOCKET_MANAGER + virtual wxSocketManager *GetSocketManager() wxOVERRIDE; +#endif + +#ifdef wxHAS_GUI_FDIOMANAGER + virtual wxFDIOManager *GetFDIOManager() wxOVERRIDE; +#endif + +#endif // wxUSE_SOCKETS + +#if wxUSE_EVENTLOOP_SOURCE + virtual wxEventLoopSourcesManagerBase* GetEventLoopSourcesManager() wxOVERRIDE; +#endif +}; + +#endif // wxUSE_GUI + +#endif // _WX_UNIX_APPTRAIT_H_ + diff --git a/lib/wxWidgets/include/wx/unix/chkconf.h b/lib/wxWidgets/include/wx/unix/chkconf.h new file mode 100644 index 0000000..d51d364 --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/chkconf.h @@ -0,0 +1,51 @@ +/* + * Name: wx/unix/chkconf.h + * Purpose: Unix-specific config settings consistency checks + * Author: Vadim Zeitlin + * Created: 2007-07-14 + * Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwidgets.org> + * Licence: wxWindows licence + */ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#if wxUSE_CONSOLE_EVENTLOOP +# if !wxUSE_SELECT_DISPATCHER && !wxUSE_EPOLL_DISPATCHER +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxSelect/EpollDispatcher needed for console event loop" +# else +# undef wxUSE_SELECT_DISPATCHER +# define wxUSE_SELECT_DISPATCHER 1 +# endif +# endif +#endif /* wxUSE_CONSOLE_EVENTLOOP */ + +#if wxUSE_FSWATCHER +# if !defined(wxHAS_INOTIFY) && !defined(wxHAS_KQUEUE) +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxFileSystemWatcher requires either inotify() or kqueue()" +# else +# undef wxUSE_FSWATCHER +# define wxUSE_FSWATCHER 0 +# endif +# endif +#endif /* wxUSE_FSWATCHER */ + +#if wxUSE_GSTREAMER +# if !wxUSE_THREADS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "GStreamer requires threads" +# else +# undef wxUSE_GSTREAMER +# define wxUSE_GSTREAMER 0 +# endif +# endif +#endif /* wxUSE_GSTREAMER */ + +#ifndef wxUSE_XTEST +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_XTEST must be defined, please read comment near the top of this file." +# else +# define wxUSE_XTEST 0 +# endif +#endif /* !defined(wxUSE_XTEST) */ diff --git a/lib/wxWidgets/include/wx/unix/evtloop.h b/lib/wxWidgets/include/wx/unix/evtloop.h new file mode 100644 index 0000000..5c2d074 --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/evtloop.h @@ -0,0 +1,62 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/evtloop.h +// Purpose: declares wxEventLoop class +// Author: Lukasz Michalski (lm@zork.pl) +// Created: 2007-05-07 +// Copyright: (c) 2007 Lukasz Michalski +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_EVTLOOP_H_ +#define _WX_UNIX_EVTLOOP_H_ + +#if wxUSE_CONSOLE_EVENTLOOP + +// ---------------------------------------------------------------------------- +// wxConsoleEventLoop +// ---------------------------------------------------------------------------- + +class wxEventLoopSource; +class wxFDIODispatcher; +class wxWakeUpPipeMT; + +class WXDLLIMPEXP_BASE wxConsoleEventLoop +#ifdef __WXOSX__ +: public wxCFEventLoop +#else +: public wxEventLoopManual +#endif +{ +public: + // initialize the event loop, use IsOk() to check if we were successful + wxConsoleEventLoop(); + virtual ~wxConsoleEventLoop(); + + // implement base class pure virtuals + virtual bool Pending() const wxOVERRIDE; + virtual bool Dispatch() wxOVERRIDE; + virtual int DispatchTimeout(unsigned long timeout) wxOVERRIDE; + virtual void WakeUp() wxOVERRIDE; + virtual bool IsOk() const wxOVERRIDE { return m_dispatcher != NULL; } + +protected: + virtual void OnNextIteration() wxOVERRIDE; + virtual void DoYieldFor(long eventsToProcess) wxOVERRIDE; + +private: + // pipe used for wake up messages: when a child thread wants to wake up + // the event loop in the main thread it writes to this pipe + wxWakeUpPipeMT *m_wakeupPipe; + + // the event loop source used to monitor this pipe + wxEventLoopSource* m_wakeupSource; + + // either wxSelectDispatcher or wxEpollDispatcher + wxFDIODispatcher *m_dispatcher; + + wxDECLARE_NO_COPY_CLASS(wxConsoleEventLoop); +}; + +#endif // wxUSE_CONSOLE_EVENTLOOP + +#endif // _WX_UNIX_EVTLOOP_H_ diff --git a/lib/wxWidgets/include/wx/unix/evtloopsrc.h b/lib/wxWidgets/include/wx/unix/evtloopsrc.h new file mode 100644 index 0000000..4c2cfec --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/evtloopsrc.h @@ -0,0 +1,48 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/evtloopsrc.h +// Purpose: wxUnixEventLoopSource class +// Author: Vadim Zeitlin +// Created: 2009-10-21 +// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_EVTLOOPSRC_H_ +#define _WX_UNIX_EVTLOOPSRC_H_ + +class wxFDIODispatcher; +class wxFDIOHandler; + +// ---------------------------------------------------------------------------- +// wxUnixEventLoopSource: wxEventLoopSource for Unix-like toolkits using fds +// ---------------------------------------------------------------------------- + +class wxUnixEventLoopSource : public wxEventLoopSource +{ +public: + // dispatcher and fdioHandler are only used here to allow us to unregister + // from the event loop when we're destroyed + wxUnixEventLoopSource(wxFDIODispatcher *dispatcher, + wxFDIOHandler *fdioHandler, + int fd, + wxEventLoopSourceHandler *handler, + int flags) + : wxEventLoopSource(handler, flags), + m_dispatcher(dispatcher), + m_fdioHandler(fdioHandler), + m_fd(fd) + { + } + + virtual ~wxUnixEventLoopSource(); + +private: + wxFDIODispatcher * const m_dispatcher; + wxFDIOHandler * const m_fdioHandler; + const int m_fd; + + wxDECLARE_NO_COPY_CLASS(wxUnixEventLoopSource); +}; + +#endif // _WX_UNIX_EVTLOOPSRC_H_ + diff --git a/lib/wxWidgets/include/wx/unix/fontutil.h b/lib/wxWidgets/include/wx/unix/fontutil.h new file mode 100644 index 0000000..a3c7d53 --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/fontutil.h @@ -0,0 +1,36 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/fontutil.h +// Purpose: font-related helper functions for Unix/X11 +// Author: Vadim Zeitlin +// Modified by: +// Created: 05.11.99 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_FONTUTIL_H_ +#define _WX_UNIX_FONTUTIL_H_ + +#ifdef __X__ + typedef WXFontStructPtr wxNativeFont; +#elif defined(__WXGTK__) + typedef GdkFont *wxNativeFont; +#else + #error "Unsupported toolkit" +#endif + +// returns the handle of the nearest available font or 0 +extern wxNativeFont +wxLoadQueryNearestFont(double pointSize, + wxFontFamily family, + wxFontStyle style, + int weight, + bool underlined, + const wxString &facename, + wxFontEncoding encoding, + wxString* xFontName = NULL); + +// returns the font specified by the given XLFD +extern wxNativeFont wxLoadFont(const wxString& fontSpec); + +#endif // _WX_UNIX_FONTUTIL_H_ diff --git a/lib/wxWidgets/include/wx/unix/fswatcher_inotify.h b/lib/wxWidgets/include/wx/unix/fswatcher_inotify.h new file mode 100644 index 0000000..1881966 --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/fswatcher_inotify.h @@ -0,0 +1,36 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/fswatcher_inotify.h +// Purpose: wxInotifyFileSystemWatcher +// Author: Bartosz Bekier +// Created: 2009-05-26 +// Copyright: (c) 2009 Bartosz Bekier <bartosz.bekier@gmail.com> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FSWATCHER_UNIX_H_ +#define _WX_FSWATCHER_UNIX_H_ + +#include "wx/defs.h" + +#if wxUSE_FSWATCHER + +class WXDLLIMPEXP_BASE wxInotifyFileSystemWatcher : + public wxFileSystemWatcherBase +{ +public: + wxInotifyFileSystemWatcher(); + + wxInotifyFileSystemWatcher(const wxFileName& path, + int events = wxFSW_EVENT_ALL); + + virtual ~wxInotifyFileSystemWatcher(); + + void OnDirDeleted(const wxString& path); + +protected: + bool Init(); +}; + +#endif + +#endif /* _WX_FSWATCHER_UNIX_H_ */ diff --git a/lib/wxWidgets/include/wx/unix/fswatcher_kqueue.h b/lib/wxWidgets/include/wx/unix/fswatcher_kqueue.h new file mode 100644 index 0000000..a324eb7 --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/fswatcher_kqueue.h @@ -0,0 +1,34 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/fswatcher_kqueue.h +// Purpose: wxKqueueFileSystemWatcher +// Author: Bartosz Bekier +// Created: 2009-05-26 +// Copyright: (c) 2009 Bartosz Bekier <bartosz.bekier@gmail.com> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FSWATCHER_KQUEUE_H_ +#define _WX_FSWATCHER_KQUEUE_H_ + +#include "wx/defs.h" + +#if wxUSE_FSWATCHER + +class WXDLLIMPEXP_BASE wxKqueueFileSystemWatcher : + public wxFileSystemWatcherBase +{ +public: + wxKqueueFileSystemWatcher(); + + wxKqueueFileSystemWatcher(const wxFileName& path, + int events = wxFSW_EVENT_ALL); + + virtual ~wxKqueueFileSystemWatcher(); + +protected: + bool Init(); +}; + +#endif + +#endif /* _WX_FSWATCHER_OSX_H_ */ diff --git a/lib/wxWidgets/include/wx/unix/glegl.h b/lib/wxWidgets/include/wx/unix/glegl.h new file mode 100644 index 0000000..eb23e5e --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/glegl.h @@ -0,0 +1,188 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/glegl.h +// Purpose: class common for all EGL-based wxGLCanvas implementations +// Author: Scott Talbert +// Created: 2017-12-26 +// Copyright: (c) 2017 Scott Talbert <swt@techie.net> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_GLEGL_H_ +#define _WX_UNIX_GLEGL_H_ + +#include <GL/gl.h> + +// This is to avoid including Wayland & EGL headers here to pollute namespace +struct wl_compositor; +struct wl_subcompositor; +struct wl_callback; +struct wl_egl_window; +struct wl_surface; +struct wl_region; +struct wl_subsurface; +typedef void *EGLDisplay; +typedef void *EGLConfig; +typedef void *EGLSurface; +typedef void *EGLContext; + +class wxGLContextAttrs; +class wxGLAttributes; + +// ---------------------------------------------------------------------------- +// wxGLContext +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase +{ +public: + wxGLContext(wxGLCanvas *win, + const wxGLContext *other = NULL, + const wxGLContextAttrs *ctxAttrs = NULL); + virtual ~wxGLContext(); + + virtual bool SetCurrent(const wxGLCanvas& win) const wxOVERRIDE; + +private: + EGLContext m_glContext; + + wxDECLARE_CLASS(wxGLContext); +}; + +// ---------------------------------------------------------------------------- +// wxGLCanvasEGL +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_GL wxGLCanvasEGL : public wxGLCanvasBase +{ +public: + // initialization and dtor + // ----------------------- + + // default ctor doesn't do anything, InitConfig() must be called + wxGLCanvasEGL(); + + // initializes EGLConfig corresponding to the given attributes + bool InitVisual(const wxGLAttributes& dispAttrs); + + // creates EGLSurface + bool CreateSurface(); + + virtual ~wxGLCanvasEGL(); + + // implement wxGLCanvasBase methods + // -------------------------------- + + virtual bool SwapBuffers() wxOVERRIDE; + + + // X11-specific methods + // -------------------- + + // get the X11 handle of this window + virtual unsigned long GetXWindow() const = 0; + + + // override some wxWindow methods + // ------------------------------ + + // return true only if the window is realized: OpenGL context can't be + // created until we are + virtual bool IsShownOnScreen() const wxOVERRIDE; + + + // implementation only from now on + // ------------------------------- + + // get the EGLConfig we use + EGLConfig *GetEGLConfig() const { return m_config; } + EGLDisplay GetEGLDisplay() const { return m_display; } + EGLSurface GetEGLSurface() const { return m_surface; } + + static EGLDisplay GetDisplay(); + + // initialize the global default GL config, return false if matching config + // not found + static bool InitDefaultConfig(const int *attribList); + + // get the default EGL Config (may be NULL, shouldn't be freed by caller) + static EGLConfig *GetDefaultConfig() { return ms_glEGLConfig; } + + // free the global GL visual, called by wxGLApp + static void FreeDefaultConfig(); + + // initializes EGLConfig + // + // returns NULL if EGLConfig couldn't be initialized, otherwise caller + // is responsible for freeing the pointer + static EGLConfig *InitConfig(const wxGLAttributes& dispAttrs); + + // private Wayland-specific callbacks +#if wxABI_VERSION >= 30203 + void CreateWaylandSubsurface(); + void DestroyWaylandSubsurface(); + + void OnWLFrameCallback(); +#endif // wxABI_VERSION >= 3.2.3 + + bool m_readyToDraw; + wl_compositor *m_wlCompositor; + wl_subcompositor *m_wlSubcompositor; + wl_callback *m_wlFrameCallbackHandler; + wl_egl_window *m_wlEGLWindow; + +private: + + EGLConfig *m_config; + EGLDisplay m_display; + EGLSurface m_surface; + + unsigned long m_xwindow; + wl_surface *m_wlSurface; + wl_region *m_wlRegion; + wl_subsurface *m_wlSubsurface; + + // the global/default versions of the above + static EGLConfig *ms_glEGLConfig; + + friend void wxEGLUpdatePosition(wxGLCanvasEGL* win); +}; + +// ---------------------------------------------------------------------------- +// wxGLApp +// ---------------------------------------------------------------------------- + +// this is used in wx/glcanvas.h, prevent it from defining a generic wxGLApp +#define wxGL_APP_DEFINED + +class WXDLLIMPEXP_GL wxGLApp : public wxGLAppBase +{ +public: + wxGLApp() : wxGLAppBase() { } + + // implement wxGLAppBase method + virtual bool InitGLVisual(const int *attribList) wxOVERRIDE + { + return wxGLCanvasEGL::InitDefaultConfig(attribList); + } + + // This method is not currently used by the library itself, but remains for + // backwards compatibility and also because wxGTK has it we could start + // using it for the same purpose in wxX11 too some day. + virtual void* GetXVisualInfo() wxOVERRIDE + { + return wxGLCanvasEGL::GetDefaultConfig(); + } + + // and override this wxApp method to clean up + virtual int OnExit() wxOVERRIDE + { + wxGLCanvasEGL::FreeDefaultConfig(); + + return wxGLAppBase::OnExit(); + } + +private: + wxDECLARE_DYNAMIC_CLASS(wxGLApp); +}; + +#endif // _WX_UNIX_GLEGL_H_ diff --git a/lib/wxWidgets/include/wx/unix/glx11.h b/lib/wxWidgets/include/wx/unix/glx11.h new file mode 100644 index 0000000..e7b49bb --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/glx11.h @@ -0,0 +1,129 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/glx11.h +// Purpose: class common for all X11-based wxGLCanvas implementations +// Author: Vadim Zeitlin +// Created: 2007-04-15 +// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_GLX11_H_ +#define _WX_UNIX_GLX11_H_ + +#include <GL/gl.h> + +typedef struct __GLXcontextRec* GLXContext; +typedef struct __GLXFBConfigRec* GLXFBConfig; + +// ---------------------------------------------------------------------------- +// wxGLContext +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase +{ +public: + wxGLContext(wxGLCanvas *win, + const wxGLContext *other = NULL, + const wxGLContextAttrs *ctxAttrs = NULL); + virtual ~wxGLContext(); + + virtual bool SetCurrent(const wxGLCanvas& win) const wxOVERRIDE; + +private: + GLXContext m_glContext; + + wxDECLARE_CLASS(wxGLContext); +}; + +// ---------------------------------------------------------------------------- +// wxGLCanvasX11 +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_GL wxGLCanvasX11 : public wxGLCanvasBase +{ +public: + // initialization and dtor + // ----------------------- + + // default ctor doesn't do anything, InitVisual() must be called + wxGLCanvasX11(); + + // initializes GLXFBConfig and XVisualInfo corresponding to the given attributes + bool InitVisual(const wxGLAttributes& dispAttrs); + + // frees XVisualInfo info + virtual ~wxGLCanvasX11(); + + + // implement wxGLCanvasBase methods + // -------------------------------- + + virtual bool SwapBuffers() wxOVERRIDE; + + + // X11-specific methods + // -------------------- + + // return GLX version: 13 means 1.3 &c + static int GetGLXVersion(); + + // return true if multisample extension is available + static bool IsGLXMultiSampleAvailable(); + + // get the X11 handle of this window + virtual unsigned long GetXWindow() const = 0; + + + // GLX-specific methods + // -------------------- + + // override some wxWindow methods + // ------------------------------ + + // return true only if the window is realized: OpenGL context can't be + // created until we are + virtual bool IsShownOnScreen() const wxOVERRIDE; + + + // implementation only from now on + // ------------------------------- + + // get the GLXFBConfig/XVisualInfo we use + GLXFBConfig *GetGLXFBConfig() const { return m_fbc; } + void* GetXVisualInfo() const { return m_vi; } + + // initialize the global default GL visual, return false if matching visual + // not found + static bool InitDefaultVisualInfo(const int *attribList); + +private: + GLXFBConfig *m_fbc; + void* m_vi; +}; + +// ---------------------------------------------------------------------------- +// wxGLApp +// ---------------------------------------------------------------------------- + +// this is used in wx/glcanvas.h, prevent it from defining a generic wxGLApp +#define wxGL_APP_DEFINED + +class WXDLLIMPEXP_GL wxGLApp : public wxGLAppBase +{ +public: + virtual bool InitGLVisual(const int *attribList) wxOVERRIDE; + + // This method is not currently used by the library itself, but remains for + // backwards compatibility and also because wxGTK has it we could start + // using it for the same purpose in wxX11 too some day. + virtual void* GetXVisualInfo() wxOVERRIDE; + + // and override this wxApp method to clean up + virtual int OnExit() wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxGLApp); +}; + +#endif // _WX_UNIX_GLX11_H_ + diff --git a/lib/wxWidgets/include/wx/unix/joystick.h b/lib/wxWidgets/include/wx/unix/joystick.h new file mode 100644 index 0000000..a20c936 --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/joystick.h @@ -0,0 +1,94 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/joystick.h +// Purpose: wxJoystick class +// Author: Guilhem Lavaux +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_JOYSTICK_H_ +#define _WX_UNIX_JOYSTICK_H_ + +#include "wx/event.h" + +class WXDLLIMPEXP_FWD_CORE wxJoystickThread; + +class WXDLLIMPEXP_ADV wxJoystick: public wxObject +{ + wxDECLARE_DYNAMIC_CLASS(wxJoystick); +public: + /* + * Public interface + */ + + wxJoystick(int joystick = wxJOYSTICK1); + virtual ~wxJoystick(); + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + wxPoint GetPosition() const; + int GetPosition(unsigned axis) const; + bool GetButtonState(unsigned button) const; + int GetZPosition() const; + int GetButtonState() const; + int GetPOVPosition() const; + int GetPOVCTSPosition() const; + int GetRudderPosition() const; + int GetUPosition() const; + int GetVPosition() const; + int GetMovementThreshold() const; + void SetMovementThreshold(int threshold) ; + + // Capabilities + //////////////////////////////////////////////////////////////////////////// + + bool IsOk() const; // Checks that the joystick is functioning + static int GetNumberJoysticks() ; + int GetManufacturerId() const ; + int GetProductId() const ; + wxString GetProductName() const ; + int GetXMin() const; + int GetYMin() const; + int GetZMin() const; + int GetXMax() const; + int GetYMax() const; + int GetZMax() const; + int GetNumberButtons() const; + int GetNumberAxes() const; + int GetMaxButtons() const; + int GetMaxAxes() const; + int GetPollingMin() const; + int GetPollingMax() const; + int GetRudderMin() const; + int GetRudderMax() const; + int GetUMin() const; + int GetUMax() const; + int GetVMin() const; + int GetVMax() const; + + bool HasRudder() const; + bool HasZ() const; + bool HasU() const; + bool HasV() const; + bool HasPOV() const; + bool HasPOV4Dir() const; + bool HasPOVCTS() const; + + // Operations + //////////////////////////////////////////////////////////////////////////// + + // pollingFreq = 0 means that movement events are sent when above the threshold. + // If pollingFreq > 0, events are received every this many milliseconds. + bool SetCapture(wxWindow* win, int pollingFreq = 0); + bool ReleaseCapture(); + +protected: + int m_device; + int m_joystick; + wxJoystickThread* m_thread; +}; + +#endif // _WX_UNIX_JOYSTICK_H_ diff --git a/lib/wxWidgets/include/wx/unix/mimetype.h b/lib/wxWidgets/include/wx/unix/mimetype.h new file mode 100644 index 0000000..1436dd1 --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/mimetype.h @@ -0,0 +1,174 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/mimetype.h +// Purpose: classes and functions to manage MIME types +// Author: Vadim Zeitlin +// Modified by: +// Created: 23.09.98 +// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence (part of wxExtra library) +///////////////////////////////////////////////////////////////////////////// + +#ifndef _MIMETYPE_IMPL_H +#define _MIMETYPE_IMPL_H + +#include "wx/mimetype.h" + +#if wxUSE_MIMETYPE + +class wxMimeTypeCommands; + +WX_DEFINE_ARRAY_PTR(wxMimeTypeCommands *, wxMimeCommandsArray); + +// this is the real wxMimeTypesManager for Unix +class WXDLLIMPEXP_BASE wxMimeTypesManagerImpl +{ +public: + // ctor and dtor + wxMimeTypesManagerImpl(); + virtual ~wxMimeTypesManagerImpl(); + + // load all data into memory - done when it is needed for the first time + void Initialize(int mailcapStyles = wxMAILCAP_ALL, + const wxString& extraDir = wxEmptyString); + + // and delete the data here + void ClearData(); + + // implement containing class functions + wxFileType *GetFileTypeFromExtension(const wxString& ext); + wxFileType *GetFileTypeFromMimeType(const wxString& mimeType); + + size_t EnumAllFileTypes(wxArrayString& mimetypes); + + void AddFallback(const wxFileTypeInfo& filetype); + + // add information about the given mimetype + void AddMimeTypeInfo(const wxString& mimetype, + const wxString& extensions, + const wxString& description); + void AddMailcapInfo(const wxString& strType, + const wxString& strOpenCmd, + const wxString& strPrintCmd, + const wxString& strTest, + const wxString& strDesc); + + // add a new record to the user .mailcap/.mime.types files + wxFileType *Associate(const wxFileTypeInfo& ftInfo); + // remove association + bool Unassociate(wxFileType *ft); + + // accessors + // get the string containing space separated extensions for the given + // file type + wxString GetExtension(size_t index) { return m_aExtensions[index]; } + +protected: + void InitIfNeeded(); + + wxArrayString m_aTypes, // MIME types + m_aDescriptions, // descriptions (just some text) + m_aExtensions, // space separated list of extensions + m_aIcons; // Icon filenames + + // verb=command pairs for this file type + wxMimeCommandsArray m_aEntries; + + // are we initialized? + bool m_initialized; + + wxString GetCommand(const wxString &verb, size_t nIndex) const; + + // Read XDG *.desktop file + void LoadXDGApp(const wxString& filename); + // Scan XDG directory + void LoadXDGAppsFilesFromDir(const wxString& dirname); + + // Load XDG globs files + void LoadXDGGlobs(const wxString& filename); + + // functions used to do associations + virtual int AddToMimeData(const wxString& strType, + const wxString& strIcon, + wxMimeTypeCommands *entry, + const wxArrayString& strExtensions, + const wxString& strDesc, + bool replaceExisting = true); + virtual bool DoAssociation(const wxString& strType, + const wxString& strIcon, + wxMimeTypeCommands *entry, + const wxArrayString& strExtensions, + const wxString& strDesc); + + virtual wxString GetIconFromMimeType(const wxString& mime); + + // give it access to m_aXXX variables + friend class WXDLLIMPEXP_FWD_BASE wxFileTypeImpl; +}; + +class WXDLLIMPEXP_BASE wxFileTypeImpl +{ +public: + // initialization functions + // this is used to construct a list of mimetypes which match; + // if built with GetFileTypeFromMimetype index 0 has the exact match and + // index 1 the type / * match + // if built with GetFileTypeFromExtension, index 0 has the mimetype for + // the first extension found, index 1 for the second and so on + + void Init(wxMimeTypesManagerImpl *manager, size_t index) + { m_manager = manager; m_index.Add(index); } + + // accessors + bool GetExtensions(wxArrayString& extensions); + bool GetMimeType(wxString *mimeType) const + { *mimeType = m_manager->m_aTypes[m_index[0]]; return true; } + bool GetMimeTypes(wxArrayString& mimeTypes) const; + bool GetIcon(wxIconLocation *iconLoc) const; + + bool GetDescription(wxString *desc) const + { *desc = m_manager->m_aDescriptions[m_index[0]]; return true; } + + bool GetOpenCommand(wxString *openCmd, + const wxFileType::MessageParameters& params) const + { + *openCmd = GetExpandedCommand(wxT("open"), params); + return (! openCmd -> IsEmpty() ); + } + + bool GetPrintCommand(wxString *printCmd, + const wxFileType::MessageParameters& params) const + { + *printCmd = GetExpandedCommand(wxT("print"), params); + return (! printCmd -> IsEmpty() ); + } + + // return the number of commands defined for this file type, 0 if none + size_t GetAllCommands(wxArrayString *verbs, wxArrayString *commands, + const wxFileType::MessageParameters& params) const; + + + // remove the record for this file type + // probably a mistake to come here, use wxMimeTypesManager.Unassociate (ft) instead + bool Unassociate(wxFileType *ft) + { + return m_manager->Unassociate(ft); + } + + // set an arbitrary command, ask confirmation if it already exists and + // overwriteprompt is TRUE + bool SetCommand(const wxString& cmd, const wxString& verb, bool overwriteprompt = true); + bool SetDefaultIcon(const wxString& strIcon = wxEmptyString, int index = 0); + + wxString + GetExpandedCommand(const wxString & verb, + const wxFileType::MessageParameters& params) const; +private: + wxMimeTypesManagerImpl *m_manager; + wxArrayInt m_index; // in the wxMimeTypesManagerImpl arrays +}; + +#endif // wxUSE_MIMETYPE + +#endif // _MIMETYPE_IMPL_H + + diff --git a/lib/wxWidgets/include/wx/unix/pipe.h b/lib/wxWidgets/include/wx/unix/pipe.h new file mode 100644 index 0000000..1bde422 --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/pipe.h @@ -0,0 +1,102 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/pipe.h +// Purpose: wxPipe class +// Author: Vadim Zeitlin +// Modified by: +// Created: 24.06.2003 (extracted from src/unix/utilsunx.cpp) +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_PIPE_H_ +#define _WX_UNIX_PIPE_H_ + +#include <unistd.h> +#include <fcntl.h> + +#include "wx/log.h" +#include "wx/intl.h" + +// ---------------------------------------------------------------------------- +// wxPipe: this class encapsulates pipe() system call +// ---------------------------------------------------------------------------- + +class wxPipe +{ +public: + // the symbolic names for the pipe ends + enum Direction + { + Read, + Write + }; + + enum + { + INVALID_FD = -1 + }; + + // default ctor doesn't do anything + wxPipe() { m_fds[Read] = m_fds[Write] = INVALID_FD; } + + // create the pipe, return TRUE if ok, FALSE on error + bool Create() + { + if ( pipe(m_fds) == -1 ) + { + wxLogSysError(wxGetTranslation("Pipe creation failed")); + + return false; + } + + return true; + } + + // switch the given end of the pipe to non-blocking IO + bool MakeNonBlocking(Direction which) + { + const int flags = fcntl(m_fds[which], F_GETFL, 0); + if ( flags == -1 ) + return false; + + return fcntl(m_fds[which], F_SETFL, flags | O_NONBLOCK) == 0; + } + + // return TRUE if we were created successfully + bool IsOk() const { return m_fds[Read] != INVALID_FD; } + + // return the descriptor for one of the pipe ends + int operator[](Direction which) const { return m_fds[which]; } + + // detach a descriptor, meaning that the pipe dtor won't close it, and + // return it + int Detach(Direction which) + { + int fd = m_fds[which]; + m_fds[which] = INVALID_FD; + + return fd; + } + + // close the pipe descriptors + void Close() + { + for ( size_t n = 0; n < WXSIZEOF(m_fds); n++ ) + { + if ( m_fds[n] != INVALID_FD ) + { + close(m_fds[n]); + m_fds[n] = INVALID_FD; + } + } + } + + // dtor closes the pipe descriptors + ~wxPipe() { Close(); } + +private: + int m_fds[2]; +}; + +#endif // _WX_UNIX_PIPE_H_ + diff --git a/lib/wxWidgets/include/wx/unix/private.h b/lib/wxWidgets/include/wx/unix/private.h new file mode 100644 index 0000000..0227de8 --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/private.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/private.h +// Purpose: miscellaneous private things for Unix wx ports +// Author: Vadim Zeitlin +// Created: 2005-09-25 +// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_PRIVATE_H_ +#define _WX_UNIX_PRIVATE_H_ + +// this file is currently empty as its original contents was moved to +// include/wx/private/fd.h but let's keep it for now in case we need it for +// something again in the future +#include "wx/private/fd.h" + +#endif // _WX_UNIX_PRIVATE_H_ + diff --git a/lib/wxWidgets/include/wx/unix/private/displayx11.h b/lib/wxWidgets/include/wx/unix/private/displayx11.h new file mode 100644 index 0000000..c78b213 --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/private/displayx11.h @@ -0,0 +1,183 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/private/displayx11.h +// Purpose: Helper functions used by wxX11 and wxGTK ports +// Author: Vadim Zeitlin +// Created: 2018-10-04 (extracted from src/unix/displayx11.cpp) +// Copyright: (c) 2002-2018 wxWindows team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_PRIVATE_DISPLAYX11_H_ +#define _WX_UNIX_PRIVATE_DISPLAYX11_H_ + +#include "wx/defs.h" + +#include <X11/Xlib.h> +#include <X11/Xatom.h> + +#if wxUSE_DISPLAY + +#include "wx/log.h" +#include "wx/translation.h" + +#ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H + +#include <X11/extensions/xf86vmode.h> + +// +// See (http://www.xfree86.org/4.2.0/XF86VidModeDeleteModeLine.3.html) for more +// info about xf86 video mode extensions +// + +//free private data common to x (usually s3) servers +#define wxClearXVM(vm) if(vm.privsize) XFree(vm.c_private) + +// Correct res rate from GLFW +#define wxCRR2(v,dc) (int) (((1000.0f * (float) dc) /*PIXELS PER SECOND */) / ((float) v.htotal * v.vtotal /*PIXELS PER FRAME*/) + 0.5f) +#define wxCRR(v) wxCRR2(v,v.dotclock) +#define wxCVM2(v, dc, display, nScreen) wxVideoMode(v.hdisplay, v.vdisplay, DefaultDepth(display, nScreen), wxCRR2(v,dc)) +#define wxCVM(v, display, nScreen) wxCVM2(v, v.dotclock, display, nScreen) + +wxArrayVideoModes wxXF86VidMode_GetModes(const wxVideoMode& mode, Display* display, int nScreen) +{ + XF86VidModeModeInfo** ppXModes; //Enumerated Modes (Don't forget XFree() :)) + int nNumModes; //Number of modes enumerated.... + + wxArrayVideoModes Modes; //modes to return... + + if (XF86VidModeGetAllModeLines(display, nScreen, &nNumModes, &ppXModes)) + { + for (int i = 0; i < nNumModes; ++i) + { + XF86VidModeModeInfo& info = *ppXModes[i]; + const wxVideoMode vm = wxCVM(info, display, nScreen); + if (vm.Matches(mode)) + { + Modes.Add(vm); + } + wxClearXVM(info); + // XFree(ppXModes[i]); //supposed to free? + } + XFree(ppXModes); + } + else //OOPS! + { + wxLogSysError(_("Failed to enumerate video modes")); + } + + return Modes; +} + +wxVideoMode wxXF86VidMode_GetCurrentMode(Display* display, int nScreen) +{ + XF86VidModeModeLine VM; + int nDotClock; + if ( !XF86VidModeGetModeLine(display, nScreen, &nDotClock, &VM) ) + return wxVideoMode(); + + wxClearXVM(VM); + return wxCVM2(VM, nDotClock, display, nScreen); +} + +bool wxXF86VidMode_ChangeMode(const wxVideoMode& mode, Display* display, int nScreen) +{ + XF86VidModeModeInfo** ppXModes; //Enumerated Modes (Don't forget XFree() :)) + int nNumModes; //Number of modes enumerated.... + + if(!XF86VidModeGetAllModeLines(display, nScreen, &nNumModes, &ppXModes)) + { + wxLogSysError(_("Failed to change video mode")); + return false; + } + + bool bRet = false; + if (mode == wxDefaultVideoMode) + { + bRet = XF86VidModeSwitchToMode(display, nScreen, ppXModes[0]) != 0; + + for (int i = 0; i < nNumModes; ++i) + { + wxClearXVM((*ppXModes[i])); + // XFree(ppXModes[i]); //supposed to free? + } + } + else + { + for (int i = 0; i < nNumModes; ++i) + { + if (!bRet && + ppXModes[i]->hdisplay == mode.GetWidth() && + ppXModes[i]->vdisplay == mode.GetHeight() && + wxCRR((*ppXModes[i])) == mode.GetRefresh()) + { + //switch! + bRet = XF86VidModeSwitchToMode(display, nScreen, ppXModes[i]) != 0; + } + wxClearXVM((*ppXModes[i])); + // XFree(ppXModes[i]); //supposed to free? + } + } + + XFree(ppXModes); + + return bRet; +} + +#else // !HAVE_X11_EXTENSIONS_XF86VMODE_H + +wxArrayVideoModes wxX11_GetModes(const wxDisplayImpl* impl, const wxVideoMode& modeMatch, Display* display) +{ + int count_return; + int* depths = XListDepths(display, 0, &count_return); + wxArrayVideoModes modes; + if ( depths ) + { + const wxRect rect = impl->GetGeometry(); + for ( int x = 0; x < count_return; ++x ) + { + wxVideoMode mode(rect.width, rect.height, depths[x]); + if ( mode.Matches(modeMatch) ) + { + modes.Add(mode); + } + } + + XFree(depths); + } + return modes; +} + +#endif // !HAVE_X11_EXTENSIONS_XF86VMODE_H + +#endif // wxUSE_DISPLAY + +void wxGetWorkAreaX11(Screen* screen, int& x, int& y, int& width, int& height) +{ + Display* display = DisplayOfScreen(screen); + Atom property = XInternAtom(display, "_NET_WORKAREA", true); + if (property) + { + Atom actual_type; + int actual_format; + unsigned long nitems; + unsigned long bytes_after; + unsigned char* data = NULL; + Status status = XGetWindowProperty( + display, RootWindowOfScreen(screen), property, + 0, 4, false, XA_CARDINAL, + &actual_type, &actual_format, &nitems, &bytes_after, &data); + if (status == Success && actual_type == XA_CARDINAL && + actual_format == 32 && nitems == 4) + { + const long* p = (long*)data; + x = p[0]; + y = p[1]; + width = p[2]; + height = p[3]; + } + if (data) + XFree(data); + } +} + +#endif // _WX_UNIX_PRIVATE_DISPLAYX11_H_ diff --git a/lib/wxWidgets/include/wx/unix/private/epolldispatcher.h b/lib/wxWidgets/include/wx/unix/private/epolldispatcher.h new file mode 100644 index 0000000..7bdfb0f --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/private/epolldispatcher.h @@ -0,0 +1,53 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/private/epolldispatcher.h +// Purpose: wxEpollDispatcher class +// Authors: Lukasz Michalski +// Created: April 2007 +// Copyright: (c) Lukasz Michalski +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_EPOLLDISPATCHER_H_ +#define _WX_PRIVATE_EPOLLDISPATCHER_H_ + +#include "wx/defs.h" + +#ifdef wxUSE_EPOLL_DISPATCHER + +#include "wx/private/fdiodispatcher.h" + +struct epoll_event; + +class WXDLLIMPEXP_BASE wxEpollDispatcher : public wxFDIODispatcher +{ +public: + // create a new instance of this class, can return NULL if + // epoll() is not supported on this system + // + // the caller should delete the returned pointer + static wxEpollDispatcher *Create(); + + virtual ~wxEpollDispatcher(); + + // implement base class pure virtual methods + virtual bool RegisterFD(int fd, wxFDIOHandler* handler, int flags = wxFDIO_ALL) wxOVERRIDE; + virtual bool ModifyFD(int fd, wxFDIOHandler* handler, int flags = wxFDIO_ALL) wxOVERRIDE; + virtual bool UnregisterFD(int fd) wxOVERRIDE; + virtual bool HasPending() const wxOVERRIDE; + virtual int Dispatch(int timeout = TIMEOUT_INFINITE) wxOVERRIDE; + +private: + // ctor is private, use Create() + wxEpollDispatcher(int epollDescriptor); + + // common part of HasPending() and Dispatch(): calls epoll_wait() with the + // given timeout + int DoPoll(epoll_event *events, int numEvents, int timeout) const; + + + int m_epollDescriptor; +}; + +#endif // wxUSE_EPOLL_DISPATCHER + +#endif // _WX_PRIVATE_SOCKETEVTDISPATCH_H_ diff --git a/lib/wxWidgets/include/wx/unix/private/execute.h b/lib/wxWidgets/include/wx/unix/private/execute.h new file mode 100644 index 0000000..156413c --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/private/execute.h @@ -0,0 +1,102 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/private/execute.h +// Purpose: private details of wxExecute() implementation +// Author: Vadim Zeitlin +// Copyright: (c) 1998 Robert Roebling, Julian Smart, Vadim Zeitlin +// (c) 2013 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_EXECUTE_H +#define _WX_UNIX_EXECUTE_H + +#include "wx/app.h" +#include "wx/hashmap.h" +#include "wx/process.h" + +#if wxUSE_STREAMS + #include "wx/unix/pipe.h" + #include "wx/private/streamtempinput.h" +#endif + +class wxEventLoopBase; + +// Information associated with a running child process. +class wxExecuteData +{ +public: + wxExecuteData() + { + m_flags = + m_pid = 0; + m_exitcode = -1; + + m_process = NULL; + + m_syncEventLoop = NULL; + +#if wxUSE_STREAMS + m_fdOut = + m_fdErr = wxPipe::INVALID_FD; +#endif // wxUSE_STREAMS + } + + // This must be called in the parent process as soon as fork() returns to + // update us with the effective child PID. It also ensures that we handle + // SIGCHLD to be able to detect when this PID exits, so wxTheApp must be + // available. + void OnStart(int pid); + + // Called when the child process exits. + void OnExit(int exitcode); + + // Return true if we should (or already did) redirect the child IO. + bool IsRedirected() const { return m_process && m_process->IsRedirected(); } + + + // wxExecute() flags + int m_flags; + + // the pid of the child process + int m_pid; + + // The exit code of the process, set once the child terminates. + int m_exitcode; + + // the associated process object or NULL + wxProcess *m_process; + + // Local event loop used to wait for the child process termination in + // synchronous execution case. We can't create it ourselves as its exact + // type depends on the application kind (console/GUI), so we rely on + // wxAppTraits setting up this pointer to point to the appropriate object. + wxEventLoopBase *m_syncEventLoop; + +#if wxUSE_STREAMS + // the input buffer bufOut is connected to stdout, this is why it is + // called bufOut and not bufIn + wxStreamTempInputBuffer m_bufOut, + m_bufErr; + + // the corresponding FDs, -1 if not redirected + int m_fdOut, + m_fdErr; +#endif // wxUSE_STREAMS + + +private: + // SIGCHLD signal handler that checks whether any of the currently running + // children have exited. + static void OnSomeChildExited(int sig); + + // All currently running child processes indexed by their PID. + // + // Notice that the container doesn't own its elements. + WX_DECLARE_HASH_MAP(int, wxExecuteData*, wxIntegerHash, wxIntegerEqual, + ChildProcessesData); + static ChildProcessesData ms_childProcesses; + + wxDECLARE_NO_COPY_CLASS(wxExecuteData); +}; + +#endif // _WX_UNIX_EXECUTE_H diff --git a/lib/wxWidgets/include/wx/unix/private/executeiohandler.h b/lib/wxWidgets/include/wx/unix/private/executeiohandler.h new file mode 100644 index 0000000..c21350d --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/private/executeiohandler.h @@ -0,0 +1,136 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/private/executeiohandler.h +// Purpose: IO handler class for the FD used by wxExecute() under Unix +// Author: Rob Bresalier, Vadim Zeitlin +// Created: 2013-01-06 +// Copyright: (c) 2013 Rob Bresalier, Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_PRIVATE_EXECUTEIOHANDLER_H_ +#define _WX_UNIX_PRIVATE_EXECUTEIOHANDLER_H_ + +#include "wx/private/streamtempinput.h" + +// This class handles IO events on the pipe FD connected to the child process +// stdout/stderr and is used by wxExecute(). +// +// Currently it can derive from either wxEventLoopSourceHandler or +// wxFDIOHandler depending on the kind of dispatcher/event loop it is used +// with. In the future, when we get rid of wxFDIOHandler entirely, it will +// derive from wxEventLoopSourceHandler only. +template <class T> +class wxExecuteIOHandlerBase : public T +{ +public: + wxExecuteIOHandlerBase(int fd, wxStreamTempInputBuffer& buf) + : m_fd(fd), + m_buf(buf) + { + m_callbackDisabled = false; + } + + // Called when the associated descriptor is available for reading. + virtual void OnReadWaiting() wxOVERRIDE + { + // Sync process, process all data coming at us from the pipe so that + // the pipe does not get full and cause a deadlock situation. + m_buf.Update(); + + if ( m_buf.Eof() ) + DisableCallback(); + } + + // These methods are never called as we only monitor the associated FD for + // reading, but we still must implement them as they're pure virtual in the + // base class. + virtual void OnWriteWaiting() wxOVERRIDE { } + virtual void OnExceptionWaiting() wxOVERRIDE { } + + // Disable any future calls to our OnReadWaiting(), can be called when + // we're sure that no more input is forthcoming. + void DisableCallback() + { + if ( !m_callbackDisabled ) + { + m_callbackDisabled = true; + + DoDisable(); + } + } + +protected: + const int m_fd; + +private: + virtual void DoDisable() = 0; + + wxStreamTempInputBuffer& m_buf; + + // If true, DisableCallback() had been already called. + bool m_callbackDisabled; + + wxDECLARE_NO_COPY_CLASS(wxExecuteIOHandlerBase); +}; + +// This is the version used with wxFDIODispatcher, which must be passed to the +// ctor in order to register this handler with it. +class wxExecuteFDIOHandler : public wxExecuteIOHandlerBase<wxFDIOHandler> +{ +public: + wxExecuteFDIOHandler(wxFDIODispatcher& dispatcher, + int fd, + wxStreamTempInputBuffer& buf) + : wxExecuteIOHandlerBase<wxFDIOHandler>(fd, buf), + m_dispatcher(dispatcher) + { + dispatcher.RegisterFD(fd, this, wxFDIO_INPUT); + } + + virtual ~wxExecuteFDIOHandler() + { + DisableCallback(); + } + +private: + virtual void DoDisable() wxOVERRIDE + { + m_dispatcher.UnregisterFD(m_fd); + } + + wxFDIODispatcher& m_dispatcher; + + wxDECLARE_NO_COPY_CLASS(wxExecuteFDIOHandler); +}; + +// And this is the version used with an event loop. As AddSourceForFD() is +// static, we don't require passing the event loop to the ctor but an event +// loop must be running to handle our events. +class wxExecuteEventLoopSourceHandler + : public wxExecuteIOHandlerBase<wxEventLoopSourceHandler> +{ +public: + wxExecuteEventLoopSourceHandler(int fd, wxStreamTempInputBuffer& buf) + : wxExecuteIOHandlerBase<wxEventLoopSourceHandler>(fd, buf) + { + m_source = wxEventLoop::AddSourceForFD(fd, this, wxEVENT_SOURCE_INPUT); + } + + virtual ~wxExecuteEventLoopSourceHandler() + { + DisableCallback(); + } + +private: + virtual void DoDisable() wxOVERRIDE + { + delete m_source; + m_source = NULL; + } + + wxEventLoopSource* m_source; + + wxDECLARE_NO_COPY_CLASS(wxExecuteEventLoopSourceHandler); +}; + +#endif // _WX_UNIX_PRIVATE_EXECUTEIOHANDLER_H_ diff --git a/lib/wxWidgets/include/wx/unix/private/fdiounix.h b/lib/wxWidgets/include/wx/unix/private/fdiounix.h new file mode 100644 index 0000000..09d79bb --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/private/fdiounix.h @@ -0,0 +1,27 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/private/fdiounix.h +// Purpose: wxFDIOManagerUnix class used by console Unix applications +// Author: Vadim Zeitlin +// Created: 2009-08-17 +// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _UNIX_PRIVATE_FDIOUNIX_H_ +#define _UNIX_PRIVATE_FDIOUNIX_H_ + +#include "wx/private/fdiomanager.h" + +// ---------------------------------------------------------------------------- +// wxFDIOManagerUnix: implement wxFDIOManager interface using wxFDIODispatcher +// ---------------------------------------------------------------------------- + +class wxFDIOManagerUnix : public wxFDIOManager +{ +public: + virtual int AddInput(wxFDIOHandler *handler, int fd, Direction d) wxOVERRIDE; + virtual void RemoveInput(wxFDIOHandler *handler, int fd, Direction d) wxOVERRIDE; +}; + +#endif // _UNIX_PRIVATE_FDIOUNIX_H_ + diff --git a/lib/wxWidgets/include/wx/unix/private/fswatcher_inotify.h b/lib/wxWidgets/include/wx/unix/private/fswatcher_inotify.h new file mode 100644 index 0000000..e525920 --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/private/fswatcher_inotify.h @@ -0,0 +1,71 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/private/fswatcher_inotify.h +// Purpose: File system watcher impl classes +// Author: Bartosz Bekier +// Created: 2009-05-26 +// Copyright: (c) 2009 Bartosz Bekier <bartosz.bekier@gmail.com> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef WX_UNIX_PRIVATE_FSWATCHER_INOTIFY_H_ +#define WX_UNIX_PRIVATE_FSWATCHER_INOTIFY_H_ + +#include "wx/filename.h" +#include "wx/evtloopsrc.h" + +// ============================================================================ +// wxFSWatcherEntry implementation & helper declarations +// ============================================================================ + +class wxFSWatcherImplUNIX; + +class wxFSWatchEntry : public wxFSWatchInfo +{ +public: + wxFSWatchEntry(const wxFSWatchInfo& winfo) : + wxFSWatchInfo(winfo) + { + } + + int GetWatchDescriptor() const + { + return m_wd; + } + + void SetWatchDescriptor(int wd) + { + m_wd = wd; + } + +private: + int m_wd; + + wxDECLARE_NO_COPY_CLASS(wxFSWatchEntry); +}; + + +// ============================================================================ +// wxFSWSourceHandler helper class +// ============================================================================ + +class wxFSWatcherImplUnix; + +/** + * Handler for handling i/o from inotify descriptor + */ +class wxFSWSourceHandler : public wxEventLoopSourceHandler +{ +public: + wxFSWSourceHandler(wxFSWatcherImplUnix* service) : + m_service(service) + { } + + virtual void OnReadWaiting() wxOVERRIDE; + virtual void OnWriteWaiting() wxOVERRIDE; + virtual void OnExceptionWaiting() wxOVERRIDE; + +protected: + wxFSWatcherImplUnix* m_service; +}; + +#endif /* WX_UNIX_PRIVATE_FSWATCHER_INOTIFY_H_ */ diff --git a/lib/wxWidgets/include/wx/unix/private/fswatcher_kqueue.h b/lib/wxWidgets/include/wx/unix/private/fswatcher_kqueue.h new file mode 100644 index 0000000..940fda2 --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/private/fswatcher_kqueue.h @@ -0,0 +1,108 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/private/fswatcher_kqueue.h +// Purpose: File system watcher impl classes +// Author: Bartosz Bekier +// Created: 2009-05-26 +// Copyright: (c) 2009 Bartosz Bekier <bartosz.bekier@gmail.com> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef WX_UNIX_PRIVATE_FSWATCHER_KQUEUE_H_ +#define WX_UNIX_PRIVATE_FSWATCHER_KQUEUE_H_ + +#include <fcntl.h> +#include <unistd.h> +#include "wx/dir.h" +#include "wx/debug.h" +#include "wx/arrstr.h" + +// ============================================================================ +// wxFSWatcherEntry implementation & helper declarations +// ============================================================================ + +class wxFSWatcherImplKqueue; + +class wxFSWatchEntryKq : public wxFSWatchInfo +{ +public: + struct wxDirState + { + wxDirState(const wxFSWatchInfo& winfo) + { + if (!wxDir::Exists(winfo.GetPath())) + return; + + wxDir dir(winfo.GetPath()); + wxCHECK_RET( dir.IsOpened(), + wxString::Format(wxASCII_STR("Unable to open dir '%s'"), winfo.GetPath())); + + wxString filename; + bool ret = dir.GetFirst(&filename); + while (ret) + { + files.push_back(filename); + ret = dir.GetNext(&filename); + } + } + + wxSortedArrayString files; + }; + + wxFSWatchEntryKq(const wxFSWatchInfo& winfo) : + wxFSWatchInfo(winfo), m_lastState(winfo) + { + m_fd = wxOpen(m_path, O_RDONLY, 0); + if (m_fd == -1) + { + wxLogSysError(_("Unable to open path '%s'"), m_path); + } + } + + virtual ~wxFSWatchEntryKq() + { + (void) Close(); + } + + bool Close() + { + if (!IsOk()) + return false; + + int ret = close(m_fd); + if (ret == -1) + { + wxLogSysError(_("Unable to close path '%s'"), m_path); + } + m_fd = -1; + + return ret != -1; + } + + bool IsOk() const + { + return m_fd != -1; + } + + int GetFileDescriptor() const + { + return m_fd; + } + + void RefreshState() + { + m_lastState = wxDirState(*this); + } + + const wxDirState& GetLastState() const + { + return m_lastState; + } + +private: + int m_fd; + wxDirState m_lastState; + + wxDECLARE_NO_COPY_CLASS(wxFSWatchEntryKq); +}; + +#endif /* WX_UNIX_PRIVATE_FSWATCHER_KQUEUE_H_ */ diff --git a/lib/wxWidgets/include/wx/unix/private/pipestream.h b/lib/wxWidgets/include/wx/unix/private/pipestream.h new file mode 100644 index 0000000..dc842f6 --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/private/pipestream.h @@ -0,0 +1,37 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/private/pipestream.h +// Purpose: Unix wxPipeInputStream and wxPipeOutputStream declarations +// Author: Vadim Zeitlin +// Created: 2013-06-08 (extracted from wx/unix/pipe.h) +// Copyright: (c) 2013 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_PRIVATE_PIPESTREAM_H_ +#define _WX_UNIX_PRIVATE_PIPESTREAM_H_ + +#include "wx/wfstream.h" + +class wxPipeInputStream : public wxFileInputStream +{ +public: + explicit wxPipeInputStream(int fd) : wxFileInputStream(fd) { } + + // return true if the pipe is still opened + bool IsOpened() const { return !Eof(); } + + // return true if we have anything to read, don't block + virtual bool CanRead() const wxOVERRIDE; +}; + +class wxPipeOutputStream : public wxFileOutputStream +{ +public: + wxPipeOutputStream(int fd) : wxFileOutputStream(fd) { } + + // Override the base class version to ignore "pipe full" errors: this is + // not an error for this class. + size_t OnSysWrite(const void *buffer, size_t size) wxOVERRIDE; +}; + +#endif // _WX_UNIX_PRIVATE_PIPESTREAM_H_ diff --git a/lib/wxWidgets/include/wx/unix/private/sockunix.h b/lib/wxWidgets/include/wx/unix/private/sockunix.h new file mode 100644 index 0000000..97f4e6f --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/private/sockunix.h @@ -0,0 +1,151 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/private/sockunix.h +// Purpose: wxSocketImpl implementation for Unix systems +// Authors: Guilhem Lavaux, Vadim Zeitlin +// Created: April 1997 +// Copyright: (c) 1997 Guilhem Lavaux +// (c) 2008 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_GSOCKUNX_H_ +#define _WX_UNIX_GSOCKUNX_H_ + +#include <unistd.h> +#include <sys/ioctl.h> + +// Under older (Open)Solaris versions FIONBIO is declared in this header only. +// In the newer versions it's included by sys/ioctl.h but it's simpler to just +// include it always instead of testing for whether it is or not. +#ifdef __SOLARIS__ + #include <sys/filio.h> +#endif + +#include "wx/private/fdiomanager.h" + +#define wxCloseSocket close + +class wxSocketImplUnix : public wxSocketImpl, + public wxFDIOHandler +{ +public: + wxSocketImplUnix(wxSocketBase& wxsocket) + : wxSocketImpl(wxsocket) + { + m_fds[0] = + m_fds[1] = -1; + } + + virtual wxSocketError GetLastError() const wxOVERRIDE; + + virtual void ReenableEvents(wxSocketEventFlags flags) wxOVERRIDE + { + // Events are only ever used for non-blocking sockets. + if ( GetSocketFlags() & wxSOCKET_BLOCK ) + return; + + // enable the notifications about input/output being available again in + // case they were disabled by OnRead/WriteWaiting() + // + // notice that we'd like to enable the events here only if there is + // nothing more left on the socket right now as otherwise we're going + // to get a "ready for whatever" notification immediately (well, during + // the next event loop iteration) and disable the event back again + // which is rather inefficient but unfortunately doing it like this + // doesn't work because the existing code (e.g. src/common/sckipc.cpp) + // expects to keep getting notifications about the data available from + // the socket even if it didn't read all the data the last time, so we + // absolutely have to continue generating them + EnableEvents(flags); + } + + virtual void UpdateBlockingState() wxOVERRIDE + { + // Make this int and not bool to allow passing it to ioctl(). + int isNonBlocking = (GetSocketFlags() & wxSOCKET_BLOCK) == 0; + ioctl(m_fd, FIONBIO, &isNonBlocking); + + DoEnableEvents(wxSOCKET_INPUT_FLAG | wxSOCKET_OUTPUT_FLAG, isNonBlocking); + } + + // wxFDIOHandler methods + virtual void OnReadWaiting() wxOVERRIDE; + virtual void OnWriteWaiting() wxOVERRIDE; + virtual void OnExceptionWaiting() wxOVERRIDE; + virtual bool IsOk() const wxOVERRIDE { return m_fd != INVALID_SOCKET; } + +private: + virtual void DoClose() wxOVERRIDE + { + DisableEvents(); + + wxCloseSocket(m_fd); + } + + // enable or disable notifications for socket input/output events + void EnableEvents(int flags = wxSOCKET_INPUT_FLAG | wxSOCKET_OUTPUT_FLAG) + { DoEnableEvents(flags, true); } + void DisableEvents(int flags = wxSOCKET_INPUT_FLAG | wxSOCKET_OUTPUT_FLAG) + { DoEnableEvents(flags, false); } + + // really enable or disable socket input/output events + void DoEnableEvents(int flags, bool enable); + +protected: + // descriptors for input and output event notification channels associated + // with the socket + int m_fds[2]; + +private: + // notify the associated wxSocket about a change in socket state and shut + // down the socket if the event is wxSOCKET_LOST + void OnStateChange(wxSocketNotify event); + + // check if there is any input available, return 1 if yes, 0 if no or -1 on + // error + int CheckForInput(); + + + // give it access to our m_fds + friend class wxSocketFDBasedManager; +}; + +// A version of wxSocketManager which uses FDs for socket IO: it is used by +// Unix console applications and some X11-like ports (wxGTK and wxMotif but not +// wxX11 currently) which implement their own port-specific wxFDIOManagers +class wxSocketFDBasedManager : public wxSocketManager +{ +public: + wxSocketFDBasedManager() + { + m_fdioManager = NULL; + } + + virtual bool OnInit() wxOVERRIDE; + virtual void OnExit() wxOVERRIDE { } + + virtual wxSocketImpl *CreateSocket(wxSocketBase& wxsocket) wxOVERRIDE + { + return new wxSocketImplUnix(wxsocket); + } + + virtual void Install_Callback(wxSocketImpl *socket_, wxSocketNotify event) wxOVERRIDE; + virtual void Uninstall_Callback(wxSocketImpl *socket_, wxSocketNotify event) wxOVERRIDE; + +protected: + // get the FD index corresponding to the given wxSocketNotify + wxFDIOManager::Direction + GetDirForEvent(wxSocketImpl *socket, wxSocketNotify event); + + // access the FDs we store + int& FD(wxSocketImplUnix *socket, wxFDIOManager::Direction d) + { + return socket->m_fds[d]; + } + + wxFDIOManager *m_fdioManager; + + wxDECLARE_NO_COPY_CLASS(wxSocketFDBasedManager); +}; + +#endif /* _WX_UNIX_GSOCKUNX_H_ */ diff --git a/lib/wxWidgets/include/wx/unix/private/timer.h b/lib/wxWidgets/include/wx/unix/private/timer.h new file mode 100644 index 0000000..0c531b1 --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/private/timer.h @@ -0,0 +1,138 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/private/timer.h +// Purpose: wxTimer for wxBase (unix) +// Author: Lukasz Michalski +// Created: 15/01/2005 +// Copyright: (c) Lukasz Michalski +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_PRIVATE_TIMER_H_ +#define _WX_UNIX_PRIVATE_TIMER_H_ + +#if wxUSE_TIMER + +#include "wx/private/timer.h" + +// the type used for milliseconds is large enough for microseconds too but +// introduce a synonym for it to avoid confusion +typedef wxMilliClock_t wxUsecClock_t; + +// ---------------------------------------------------------------------------- +// wxTimer implementation class for Unix platforms +// ---------------------------------------------------------------------------- + +// NB: we have to export at least this symbol from the shared library, because +// it's used by wxDFB's wxCore +class WXDLLIMPEXP_BASE wxUnixTimerImpl : public wxTimerImpl +{ +public: + wxUnixTimerImpl(wxTimer *timer); + virtual ~wxUnixTimerImpl(); + + virtual bool IsRunning() const wxOVERRIDE; + virtual bool Start(int milliseconds = -1, bool oneShot = false) wxOVERRIDE; + virtual void Stop() wxOVERRIDE; + + // for wxTimerScheduler only: resets the internal flag indicating that the + // timer is running + void MarkStopped() + { + wxASSERT_MSG( m_isRunning, wxT("stopping non-running timer?") ); + + m_isRunning = false; + } + +private: + bool m_isRunning; +}; + +// ---------------------------------------------------------------------------- +// wxTimerSchedule: information about a single timer, used by wxTimerScheduler +// ---------------------------------------------------------------------------- + +struct wxTimerSchedule +{ + wxTimerSchedule(wxUnixTimerImpl *timer, wxUsecClock_t expiration) + : m_timer(timer), + m_expiration(expiration) + { + } + + // the timer itself (we don't own this pointer) + wxUnixTimerImpl *m_timer; + + // the time of its next expiration, in usec + wxUsecClock_t m_expiration; +}; + +// the linked list of all active timers, we keep it sorted by expiration time +WX_DECLARE_LIST(wxTimerSchedule, wxTimerList); + +// ---------------------------------------------------------------------------- +// wxTimerScheduler: class responsible for updating all timers +// ---------------------------------------------------------------------------- + +class wxTimerScheduler +{ +public: + // get the unique timer scheduler instance + static wxTimerScheduler& Get() + { + if ( !ms_instance ) + ms_instance = new wxTimerScheduler; + + return *ms_instance; + } + + // must be called on shutdown to delete the global timer scheduler + static void Shutdown() + { + if ( ms_instance ) + { + delete ms_instance; + ms_instance = NULL; + } + } + + // adds timer which should expire at the given absolute time to the list + void AddTimer(wxUnixTimerImpl *timer, wxUsecClock_t expiration); + + // remove timer from the list, called automatically from timer dtor + void RemoveTimer(wxUnixTimerImpl *timer); + + + // the functions below are used by the event loop implementation to monitor + // and notify timers: + + // if this function returns true, the time remaining until the next time + // expiration is returned in the provided parameter (always positive or 0) + // + // it returns false if there are no timers + bool GetNext(wxUsecClock_t *remaining) const; + + // trigger the timer event for all timers which have expired, return true + // if any did + bool NotifyExpired(); + +private: + // ctor and dtor are private, this is a singleton class only created by + // Get() and destroyed by Shutdown() + wxTimerScheduler() { } + ~wxTimerScheduler(); + + // add the given timer schedule to the list in the right place + // + // we take ownership of the pointer "s" which must be heap-allocated + void DoAddTimer(wxTimerSchedule *s); + + + // the list of all currently active timers sorted by expiration + wxTimerList m_timers; + + static wxTimerScheduler *ms_instance; +}; + +#endif // wxUSE_TIMER + +#endif // _WX_UNIX_PRIVATE_TIMER_H_ diff --git a/lib/wxWidgets/include/wx/unix/private/uilocale.h b/lib/wxWidgets/include/wx/unix/private/uilocale.h new file mode 100644 index 0000000..a371a51 --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/private/uilocale.h @@ -0,0 +1,67 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/private/uilocale.h +// Purpose: Various locale-related helpers used under Unix systems only +// Author: Vadim Zeitlin +// Created: 2021-08-14 (extracted from src/common/intl.cpp) +// Copyright: (c) 2021 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_PRIVATE_UILOCALE_H_ +#define _WX_UNIX_PRIVATE_UILOCALE_H_ + +#include "wx/string.h" + +// get just the language part ("en" in "en_GB") +inline wxString ExtractLang(const wxString& langFull) +{ + return langFull.BeforeFirst('_'); +} + +// get everything else (including the leading '_') +inline wxString ExtractNotLang(const wxString& langFull) +{ + size_t pos = langFull.find('_'); + if ( pos != wxString::npos ) + return langFull.substr(pos); + else + return wxString(); +} + +const char *wxSetlocaleTryAll(int c, const wxLocaleIdent& lc); + +// Extract date format from D_T_FMT value. +wxString wxGetDateFormatOnly(const wxString& fmt); + +// Helper class changing the global locale to the one specified by the +// environment variables in its ctor and restoring it in its dtor. +namespace +{ + +class TempLocaleSetter +{ +public: + explicit TempLocaleSetter(int localeCategory, + const wxString& localeId = wxString()) + : m_localeCategory(localeCategory), + m_localeOrig(strdup(setlocale(localeCategory, NULL))) + { + setlocale(localeCategory, localeId.mb_str()); + } + + ~TempLocaleSetter() + { + setlocale(m_localeCategory, m_localeOrig); + free(m_localeOrig); + } + +private: + const int m_localeCategory; + char* const m_localeOrig; + + wxDECLARE_NO_COPY_CLASS(TempLocaleSetter); +}; + +} // anonymous namespace + +#endif // _WX_UNIX_PRIVATE_UILOCALE_H_ diff --git a/lib/wxWidgets/include/wx/unix/private/wakeuppipe.h b/lib/wxWidgets/include/wx/unix/private/wakeuppipe.h new file mode 100644 index 0000000..982d438 --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/private/wakeuppipe.h @@ -0,0 +1,97 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/private/wakeuppipe.h +// Purpose: Helper class allowing to wake up the main thread. +// Author: Vadim Zeitlin +// Created: 2013-06-09 (extracted from src/unix/evtloopunix.cpp) +// Copyright: (c) 2013 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_PRIVATE_WAKEUPPIPE_H_ +#define _WX_UNIX_PRIVATE_WAKEUPPIPE_H_ + +#include "wx/unix/pipe.h" +#include "wx/evtloopsrc.h" + +// ---------------------------------------------------------------------------- +// wxWakeUpPipe: allows to wake up the event loop by writing to it +// ---------------------------------------------------------------------------- + +// This class is not MT-safe, see wxWakeUpPipeMT below for a wake up pipe +// usable from other threads. + +class wxWakeUpPipe : public wxEventLoopSourceHandler +{ +public: + // Create and initialize the pipe. + // + // It's the callers responsibility to add the read end of this pipe, + // returned by GetReadFd(), to the code blocking on input. + wxWakeUpPipe(); + + // Wake up the blocking operation involving this pipe. + // + // It simply writes to the write end of the pipe. + // + // As indicated by its name, this method does no locking and so can be + // called only from the main thread. + void WakeUpNoLock(); + + // Same as WakeUp() but without locking. + + // Return the read end of the pipe. + int GetReadFd() { return m_pipe[wxPipe::Read]; } + + + // Implement wxEventLoopSourceHandler pure virtual methods + virtual void OnReadWaiting() wxOVERRIDE; + virtual void OnWriteWaiting() wxOVERRIDE { } + virtual void OnExceptionWaiting() wxOVERRIDE { } + +private: + wxPipe m_pipe; + + // This flag is set to true after writing to the pipe and reset to false + // after reading from it in the main thread. Having it allows us to avoid + // overflowing the pipe with too many writes if the main thread can't keep + // up with reading from it. + bool m_pipeIsEmpty; +}; + +// ---------------------------------------------------------------------------- +// wxWakeUpPipeMT: thread-safe version of wxWakeUpPipe +// ---------------------------------------------------------------------------- + +// This class can be used from multiple threads, i.e. its WakeUp() can be +// called concurrently. + +class wxWakeUpPipeMT : public wxWakeUpPipe +{ +#if wxUSE_THREADS +public: + wxWakeUpPipeMT() { } + + // Thread-safe wrapper around WakeUpNoLock(): can be called from another + // thread to wake up the main one. + void WakeUp() + { + wxCriticalSectionLocker lock(m_pipeLock); + + WakeUpNoLock(); + } + + virtual void OnReadWaiting() wxOVERRIDE + { + wxCriticalSectionLocker lock(m_pipeLock); + + wxWakeUpPipe::OnReadWaiting(); + } + +private: + // Protects access to m_pipeIsEmpty. + wxCriticalSection m_pipeLock; + +#endif // wxUSE_THREADS +}; + +#endif // _WX_UNIX_PRIVATE_WAKEUPPIPE_H_ diff --git a/lib/wxWidgets/include/wx/unix/sound.h b/lib/wxWidgets/include/wx/unix/sound.h new file mode 100644 index 0000000..b72b62b --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/sound.h @@ -0,0 +1,160 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/sound.h +// Purpose: wxSound class +// Author: Julian Smart, Vaclav Slavik +// Modified by: +// Created: 25/10/98 +// Copyright: (c) Julian Smart, Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SOUND_H_ +#define _WX_SOUND_H_ + +#include "wx/defs.h" + +#if wxUSE_SOUND + +#include "wx/object.h" + +// ---------------------------------------------------------------------------- +// wxSound: simple audio playback class +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxSoundBackend; +class WXDLLIMPEXP_FWD_CORE wxSound; +class WXDLLIMPEXP_FWD_BASE wxDynamicLibrary; + +/// Sound data, as loaded from .wav file: +class WXDLLIMPEXP_CORE wxSoundData +{ +public: + wxSoundData() : m_refCnt(1) {} + void IncRef(); + void DecRef(); + + // .wav header information: + unsigned m_channels; // num of channels (mono:1, stereo:2) + unsigned m_samplingRate; + unsigned m_bitsPerSample; // if 8, then m_data contains unsigned 8bit + // samples (wxUint8), if 16 then signed 16bit + // (wxInt16) + unsigned m_samples; // length in samples: + + // wave data: + size_t m_dataBytes; + wxUint8 *m_data; // m_dataBytes bytes of data + +private: + ~wxSoundData(); + unsigned m_refCnt; + wxUint8 *m_dataWithHeader; // ditto, but prefixed with .wav header + friend class wxSound; +}; + + +/// Simple sound class: +class WXDLLIMPEXP_CORE wxSound : public wxSoundBase +{ +public: + wxSound(); + wxSound(const wxString& fileName, bool isResource = false); + wxSound(size_t size, const void* data); + virtual ~wxSound(); + + // Create from resource or file + bool Create(const wxString& fileName, bool isResource = false); + // Create from data + bool Create(size_t size, const void* data); + + bool IsOk() const { return m_data != NULL; } + + // Stop playing any sound + static void Stop(); + + // Returns true if a sound is being played + static bool IsPlaying(); + + // for internal use + static void UnloadBackend(); + +protected: + bool DoPlay(unsigned flags) const wxOVERRIDE; + + static void EnsureBackend(); + void Free(); + bool LoadWAV(const void* data, size_t length, bool copyData); + + static wxSoundBackend *ms_backend; +#if wxUSE_LIBSDL && wxUSE_PLUGINS + // FIXME - temporary, until we have plugins architecture + static wxDynamicLibrary *ms_backendSDL; +#endif + +private: + wxSoundData *m_data; +}; + + +// ---------------------------------------------------------------------------- +// wxSoundBackend: +// ---------------------------------------------------------------------------- + +// This is interface to sound playing implementation. There are multiple +// sound architectures in use on Unix platforms and wxWidgets can use several +// of them for playback, depending on their availability at runtime; hence +// the need for backends. This class is for use by wxWidgets and people writing +// additional backends only, it is _not_ for use by applications! + +// Structure that holds playback status information +struct wxSoundPlaybackStatus +{ + // playback is in progress + bool m_playing; + // main thread called wxSound::Stop() + bool m_stopRequested; +}; + +// Audio backend interface +class WXDLLIMPEXP_CORE wxSoundBackend +{ +public: + virtual ~wxSoundBackend() {} + + // Returns the name of the backend (e.g. "Open Sound System") + virtual wxString GetName() const = 0; + + // Returns priority (higher priority backends are tried first) + virtual int GetPriority() const = 0; + + // Checks if the backend's audio system is available and the backend can + // be used for playback + virtual bool IsAvailable() const = 0; + + // Returns true if the backend is capable of playing sound asynchronously. + // If false, then wxWidgets creates a playback thread and handles async + // playback, otherwise it is left up to the backend (will usually be more + // effective). + virtual bool HasNativeAsyncPlayback() const = 0; + + // Plays the sound. flags are same flags as those passed to wxSound::Play. + // The function should periodically check the value of + // status->m_stopRequested and terminate if it is set to true (it may + // be modified by another thread) + virtual bool Play(wxSoundData *data, unsigned flags, + volatile wxSoundPlaybackStatus *status) = 0; + + // Stops playback (if something is played). + virtual void Stop() = 0; + + // Returns true if the backend is playing anything at the moment. + // (This method is never called for backends that don't support async + // playback.) + virtual bool IsPlaying() const = 0; +}; + + +#endif // wxUSE_SOUND + +#endif // _WX_SOUND_H_ + diff --git a/lib/wxWidgets/include/wx/unix/stackwalk.h b/lib/wxWidgets/include/wx/unix/stackwalk.h new file mode 100644 index 0000000..00c2e08 --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/stackwalk.h @@ -0,0 +1,98 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/stackwalk.h +// Purpose: declaration of wxStackWalker for Unix +// Author: Vadim Zeitlin +// Modified by: +// Created: 2005-01-19 +// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_STACKWALK_H_ +#define _WX_UNIX_STACKWALK_H_ + +// ---------------------------------------------------------------------------- +// wxStackFrame +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStackFrame : public wxStackFrameBase +{ + friend class wxStackWalker; + +public: + // arguments are the stack depth of this frame, its address and the return + // value of backtrace_symbols() for it + // + // NB: we don't copy syminfo pointer so it should have lifetime at least as + // long as ours + wxStackFrame(size_t level = 0, void *address = NULL, const char *syminfo = NULL) + : wxStackFrameBase(level, address) + { + m_syminfo = syminfo; + } + +protected: + virtual void OnGetName() wxOVERRIDE; + + // optimized for the 2 step initialization done by wxStackWalker + void Set(const wxString &name, const wxString &filename, const char* syminfo, + size_t level, size_t numLine, void *address) + { + m_level = level; + m_name = name; + m_filename = filename; + m_syminfo = syminfo; + + m_line = numLine; + m_address = address; + } + +private: + const char *m_syminfo; +}; + +// ---------------------------------------------------------------------------- +// wxStackWalker +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStackWalker : public wxStackWalkerBase +{ +public: + // we need the full path to the program executable to be able to use + // addr2line, normally we can retrieve it from wxTheApp but if wxTheApp + // doesn't exist or doesn't have the correct value, the path may be given + // explicitly + wxStackWalker(const char *argv0 = NULL) + { + ms_exepath = wxString::FromAscii(argv0); + } + + ~wxStackWalker() + { + FreeStack(); + } + + virtual void Walk(size_t skip = 1, size_t maxDepth = wxSTACKWALKER_MAX_DEPTH) wxOVERRIDE; +#if wxUSE_ON_FATAL_EXCEPTION + virtual void WalkFromException(size_t maxDepth = wxSTACKWALKER_MAX_DEPTH) wxOVERRIDE { Walk(2, maxDepth); } +#endif // wxUSE_ON_FATAL_EXCEPTION + + static const wxString& GetExePath() { return ms_exepath; } + + + // these two may be used to save the stack at some point (fast operation) + // and then process it later (slow operation) + void SaveStack(size_t maxDepth); + void ProcessFrames(size_t skip); + void FreeStack(); + +private: + int InitFrames(wxStackFrame *arr, size_t n, void **addresses, char **syminfo); + + static wxString ms_exepath; + static void *ms_addresses[]; + static char **ms_symbols; + static int m_depth; +}; + +#endif // _WX_UNIX_STACKWALK_H_ diff --git a/lib/wxWidgets/include/wx/unix/stdpaths.h b/lib/wxWidgets/include/wx/unix/stdpaths.h new file mode 100644 index 0000000..45401cf --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/stdpaths.h @@ -0,0 +1,66 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/stdpaths.h +// Purpose: wxStandardPaths for Unix systems +// Author: Vadim Zeitlin +// Modified by: +// Created: 2004-10-19 +// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_STDPATHS_H_ +#define _WX_UNIX_STDPATHS_H_ + +// ---------------------------------------------------------------------------- +// wxStandardPaths +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStandardPaths : public wxStandardPathsBase +{ +public: + // tries to determine the installation prefix automatically (Linux only right + // now) and returns /usr/local if it failed + void DetectPrefix(); + + // set the program installation directory which is /usr/local by default + // + // under some systems (currently only Linux) the program directory can be + // determined automatically but for portable programs you should always set + // it explicitly + void SetInstallPrefix(const wxString& prefix); + + // get the program installation prefix + // + // if the prefix had been previously by SetInstallPrefix, returns that + // value, otherwise calls DetectPrefix() + wxString GetInstallPrefix() const; + + + // implement base class pure virtuals + virtual wxString GetExecutablePath() const wxOVERRIDE; + virtual wxString GetConfigDir() const wxOVERRIDE; + virtual wxString GetUserConfigDir() const wxOVERRIDE; + virtual wxString GetDataDir() const wxOVERRIDE; + virtual wxString GetLocalDataDir() const wxOVERRIDE; + virtual wxString GetUserDataDir() const wxOVERRIDE; + virtual wxString GetPluginsDir() const wxOVERRIDE; + virtual wxString GetLocalizedResourcesDir(const wxString& lang, + ResourceCat category) const wxOVERRIDE; +#ifndef __VMS + virtual wxString GetUserDir(Dir userDir) const wxOVERRIDE; +#endif + virtual wxString MakeConfigFileName(const wxString& basename, + ConfigFileConv conv = ConfigFileConv_Ext + ) const wxOVERRIDE; + +protected: + // Ctor is protected, use wxStandardPaths::Get() instead of instantiating + // objects of this class directly. + wxStandardPaths() { } + +private: + wxString m_prefix; +}; + +#endif // _WX_UNIX_STDPATHS_H_ + diff --git a/lib/wxWidgets/include/wx/unix/taskbarx11.h b/lib/wxWidgets/include/wx/unix/taskbarx11.h new file mode 100644 index 0000000..1aac326 --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/taskbarx11.h @@ -0,0 +1,40 @@ +///////////////////////////////////////////////////////////////////////// +// File: wx/unix/taskbarx11.h +// Purpose: Defines wxTaskBarIcon class for most common X11 desktops +// Author: Vaclav Slavik +// Modified by: +// Created: 04/04/2003 +// Copyright: (c) Vaclav Slavik, 2003 +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_TASKBAR_H_ +#define _WX_UNIX_TASKBAR_H_ + +class WXDLLIMPEXP_FWD_CORE wxTaskBarIconArea; + +class WXDLLIMPEXP_CORE wxTaskBarIcon: public wxTaskBarIconBase +{ +public: + wxTaskBarIcon(); + virtual ~wxTaskBarIcon(); + + // Accessors: + bool IsOk() const; + bool IsIconInstalled() const; + + // Operations: + bool SetIcon(const wxBitmapBundle& icon, const wxString& tooltip = wxEmptyString) wxOVERRIDE; + bool RemoveIcon() wxOVERRIDE; + bool PopupMenu(wxMenu *menu) wxOVERRIDE; + +protected: + wxTaskBarIconArea *m_iconWnd; + +private: + void OnDestroy(wxWindowDestroyEvent&); + + wxDECLARE_DYNAMIC_CLASS(wxTaskBarIcon); +}; + +#endif // _WX_UNIX_TASKBAR_H_ diff --git a/lib/wxWidgets/include/wx/unix/tls.h b/lib/wxWidgets/include/wx/unix/tls.h new file mode 100644 index 0000000..ce61e6f --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/tls.h @@ -0,0 +1,65 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/tls.h +// Purpose: Pthreads implementation of wxTlsValue<> +// Author: Vadim Zeitlin +// Created: 2008-08-08 +// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_TLS_H_ +#define _WX_UNIX_TLS_H_ + +#include <pthread.h> + +// ---------------------------------------------------------------------------- +// wxTlsKey is a helper class encapsulating the TLS value index +// ---------------------------------------------------------------------------- + +class wxTlsKey +{ +public: + // ctor allocates a new key and possibly registering a destructor function + // for it + wxTlsKey(wxTlsDestructorFunction destructor) + { + m_destructor = destructor; + if ( pthread_key_create(&m_key, destructor) != 0 ) + m_key = 0; + } + + // return true if the key was successfully allocated + bool IsOk() const { return m_key != 0; } + + // get the key value, there is no error return + void *Get() const + { + return pthread_getspecific(m_key); + } + + // change the key value, return true if ok + bool Set(void *value) + { + void *old = Get(); + if ( old ) + m_destructor(old); + + return pthread_setspecific(m_key, value) == 0; + } + + // free the key + ~wxTlsKey() + { + if ( IsOk() ) + pthread_key_delete(m_key); + } + +private: + wxTlsDestructorFunction m_destructor; + pthread_key_t m_key; + + wxDECLARE_NO_COPY_CLASS(wxTlsKey); +}; + +#endif // _WX_UNIX_TLS_H_ + diff --git a/lib/wxWidgets/include/wx/unix/utilsx11.h b/lib/wxWidgets/include/wx/unix/utilsx11.h new file mode 100644 index 0000000..d242a2e --- /dev/null +++ b/lib/wxWidgets/include/wx/unix/utilsx11.h @@ -0,0 +1,88 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/utilsx11.h +// Purpose: Miscellaneous X11 functions +// Author: Mattia Barbon, Vaclav Slavik, Vadim Zeitlin +// Modified by: +// Created: 25.03.02 +// Copyright: (c) wxWidgets team +// (c) 2010 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_UTILSX11_H_ +#define _WX_UNIX_UTILSX11_H_ + +#include "wx/defs.h" +#include "wx/gdicmn.h" + +#include <X11/Xlib.h> + +// NB: Content of this header is for wxWidgets' private use! It is not +// part of public API and may be modified or even disappear in the future! + +#if defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXX11__) + +#if defined(__WXGTK__) +typedef void WXDisplay; +typedef void* WXWindow; +#endif +typedef unsigned long WXKeySym; + +int wxCharCodeXToWX(WXKeySym keySym); +WXKeySym wxCharCodeWXToX(int id); +#ifdef __WXX11__ +int wxUnicodeCharXToWX(WXKeySym keySym); +#endif + +class wxIconBundle; + +void wxSetIconsX11( WXDisplay* display, WXWindow window, + const wxIconBundle& ib ); + + +enum wxX11FullScreenMethod +{ + wxX11_FS_AUTODETECT = 0, + wxX11_FS_WMSPEC, + wxX11_FS_KDE, + wxX11_FS_GENERIC +}; + +wxX11FullScreenMethod wxGetFullScreenMethodX11(WXDisplay* display, + WXWindow rootWindow); + +void wxSetFullScreenStateX11(WXDisplay* display, WXWindow rootWindow, + WXWindow window, bool show, wxRect *origSize, + wxX11FullScreenMethod method); + + +// Class wrapping X11 Display: it opens it in ctor and closes it in dtor. +class wxX11Display +{ +public: + wxX11Display() { m_dpy = XOpenDisplay(NULL); } + ~wxX11Display() { if ( m_dpy ) XCloseDisplay(m_dpy); } + + // Pseudo move ctor: steals the open display from the other object. + explicit wxX11Display(wxX11Display& display) + { + m_dpy = display.m_dpy; + display.m_dpy = NULL; + } + + operator Display *() const { return m_dpy; } + + // Using DefaultRootWindow() with an object of wxX11Display class doesn't + // compile because it is a macro which tries to cast wxX11Display so + // provide a convenient helper. + Window DefaultRoot() const { return DefaultRootWindow(m_dpy); } + +private: + Display *m_dpy; + + wxDECLARE_NO_COPY_CLASS(wxX11Display); +}; + +#endif // __WXMOTIF__, __WXGTK__, __WXX11__ + +#endif // _WX_UNIX_UTILSX11_H_ diff --git a/lib/wxWidgets/include/wx/uri.h b/lib/wxWidgets/include/wx/uri.h new file mode 100644 index 0000000..828428e --- /dev/null +++ b/lib/wxWidgets/include/wx/uri.h @@ -0,0 +1,183 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/uri.h +// Purpose: wxURI - Class for parsing URIs +// Author: Ryan Norton +// Vadim Zeitlin (UTF-8 URI support, many other changes) +// Created: 07/01/2004 +// Copyright: (c) 2004 Ryan Norton +// 2008 Vadim Zeitlin +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_URI_H_ +#define _WX_URI_H_ + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/string.h" +#include "wx/arrstr.h" + +// Host Type that the server component can be +enum wxURIHostType +{ + wxURI_REGNAME, // Host is a normal register name (www.mysite.com etc.) + wxURI_IPV4ADDRESS, // Host is a version 4 ip address (192.168.1.100) + wxURI_IPV6ADDRESS, // Host is a version 6 ip address [aa:aa:aa:aa::aa:aa]:5050 + wxURI_IPVFUTURE // Host is a future ip address (wxURI is unsure what kind) +}; + +// Component Flags +enum wxURIFieldType +{ + wxURI_SCHEME = 1, + wxURI_USERINFO = 2, + wxURI_SERVER = 4, + wxURI_PORT = 8, + wxURI_PATH = 16, + wxURI_QUERY = 32, + wxURI_FRAGMENT = 64 +}; + +// Miscellaneous other flags +enum wxURIFlags +{ + wxURI_STRICT = 1 +}; + + +// Generic class for parsing URIs. +// +// See RFC 3986 +class WXDLLIMPEXP_BASE wxURI : public wxObject +{ +public: + wxURI(); + wxURI(const wxString& uri); + + // default copy ctor, assignment operator and dtor are ok + + bool Create(const wxString& uri); + + wxURI& operator=(const wxString& string) + { + Create(string); + return *this; + } + + bool operator==(const wxURI& uri) const; + + // various accessors + + bool HasScheme() const { return (m_fields & wxURI_SCHEME) != 0; } + bool HasUserInfo() const { return (m_fields & wxURI_USERINFO) != 0; } + bool HasServer() const { return (m_fields & wxURI_SERVER) != 0; } + bool HasPort() const { return (m_fields & wxURI_PORT) != 0; } + bool HasPath() const { return (m_fields & wxURI_PATH) != 0; } + bool HasQuery() const { return (m_fields & wxURI_QUERY) != 0; } + bool HasFragment() const { return (m_fields & wxURI_FRAGMENT) != 0; } + + const wxString& GetScheme() const { return m_scheme; } + const wxString& GetPath() const { return m_path; } + const wxString& GetQuery() const { return m_query; } + const wxString& GetFragment() const { return m_fragment; } + const wxString& GetPort() const { return m_port; } + const wxString& GetUserInfo() const { return m_userinfo; } + const wxString& GetServer() const { return m_server; } + wxURIHostType GetHostType() const { return m_hostType; } + + // these functions only work if the user information part of the URI is in + // the usual (but insecure and hence explicitly recommended against by the + // RFC) "user:password" form + wxString GetUser() const; + wxString GetPassword() const; + + + // combine all URI components into a single string + // + // BuildURI() returns the real URI suitable for use with network libraries, + // for example, while BuildUnescapedURI() returns a string suitable to be + // shown to the user. + wxString BuildURI() const { return DoBuildURI(&wxURI::Nothing); } + wxString BuildUnescapedURI() const { return DoBuildURI(&wxURI::Unescape); } + + // the escaped URI should contain only ASCII characters, including possible + // escape sequences + static wxString Unescape(const wxString& escapedURI); + + + void Resolve(const wxURI& base, int flags = wxURI_STRICT); + bool IsReference() const; + bool IsRelative() const; + +protected: + void Clear(); + + // common part of BuildURI() and BuildUnescapedURI() + wxString DoBuildURI(wxString (*funcDecode)(const wxString&)) const; + + // function which returns its argument unmodified, this is used by + // BuildURI() to tell DoBuildURI() that nothing needs to be done with the + // URI components + static wxString Nothing(const wxString& value) { return value; } + + bool Parse(const char* uri); + + const char* ParseAuthority (const char* uri); + const char* ParseScheme (const char* uri); + const char* ParseUserInfo (const char* uri); + const char* ParseServer (const char* uri); + const char* ParsePort (const char* uri); + const char* ParsePath (const char* uri); + const char* ParseQuery (const char* uri); + const char* ParseFragment (const char* uri); + + + static bool ParseH16(const char*& uri); + static bool ParseIPv4address(const char*& uri); + static bool ParseIPv6address(const char*& uri); + static bool ParseIPvFuture(const char*& uri); + + // append next character pointer to by p to the string in an escaped form + // and advance p past it + // + // if the next character is '%' and it's followed by 2 hex digits, they are + // not escaped (again) by this function, this allows to keep (backwards- + // compatible) ambiguity about the input format to wxURI::Create(): it can + // be either already escaped or not + void AppendNextEscaped(wxString& s, const char *& p); + + // convert hexadecimal digit to its value; return -1 if c isn't valid + static int CharToHex(char c); + + // split an URI path string in its component segments (including empty and + // "." ones, no post-processing is done) + static wxArrayString SplitInSegments(const wxString& path); + + // various URI grammar helpers + static bool IsUnreserved(char c); + static bool IsReserved(char c); + static bool IsGenDelim(char c); + static bool IsSubDelim(char c); + static bool IsHex(char c); + static bool IsAlpha(char c); + static bool IsDigit(char c); + static bool IsEndPath(char c); + + wxString m_scheme; + wxString m_path; + wxString m_query; + wxString m_fragment; + + wxString m_userinfo; + wxString m_server; + wxString m_port; + + wxURIHostType m_hostType; + + size_t m_fields; + + wxDECLARE_DYNAMIC_CLASS(wxURI); +}; + +#endif // _WX_URI_H_ + diff --git a/lib/wxWidgets/include/wx/url.h b/lib/wxWidgets/include/wx/url.h new file mode 100644 index 0000000..457b043 --- /dev/null +++ b/lib/wxWidgets/include/wx/url.h @@ -0,0 +1,116 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/url.h +// Purpose: URL parser +// Author: Guilhem Lavaux +// Modified by: Ryan Norton +// Created: 20/07/1997 +// Copyright: (c) 1997, 1998 Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_URL_H +#define _WX_URL_H + +#include "wx/defs.h" + +#if wxUSE_URL + +#include "wx/uri.h" +#include "wx/protocol/protocol.h" + +#if wxUSE_PROTOCOL_HTTP + #include "wx/protocol/http.h" +#endif + +enum wxURLError { + wxURL_NOERR = 0, + wxURL_SNTXERR, + wxURL_NOPROTO, + wxURL_NOHOST, + wxURL_NOPATH, + wxURL_CONNERR, + wxURL_PROTOERR +}; + +#if wxUSE_URL_NATIVE +class WXDLLIMPEXP_FWD_NET wxURL; + +class WXDLLIMPEXP_NET wxURLNativeImp : public wxObject +{ +public: + virtual ~wxURLNativeImp() { } + virtual wxInputStream *GetInputStream(wxURL *owner) = 0; +}; +#endif // wxUSE_URL_NATIVE + +class WXDLLIMPEXP_NET wxURL : public wxURI +{ +public: + wxURL(const wxString& sUrl = wxEmptyString); + wxURL(const wxURI& uri); + wxURL(const wxURL& url); + virtual ~wxURL(); + + wxURL& operator = (const wxString& url); + wxURL& operator = (const wxURI& uri); + wxURL& operator = (const wxURL& url); + + wxProtocol& GetProtocol() { return *m_protocol; } + wxURLError GetError() const { return m_error; } + wxString GetURL() const { return m_url; } + + wxURLError SetURL(const wxString &url) + { *this = url; return m_error; } + + bool IsOk() const + { return m_error == wxURL_NOERR; } + + wxInputStream *GetInputStream(); + +#if wxUSE_PROTOCOL_HTTP + static void SetDefaultProxy(const wxString& url_proxy); + void SetProxy(const wxString& url_proxy); +#endif // wxUSE_PROTOCOL_HTTP + +protected: + static wxProtoInfo *ms_protocols; + +#if wxUSE_PROTOCOL_HTTP + static wxHTTP *ms_proxyDefault; + static bool ms_useDefaultProxy; + wxHTTP *m_proxy; + bool m_useProxy; +#endif // wxUSE_PROTOCOL_HTTP + +#if wxUSE_URL_NATIVE + friend class wxURLNativeImp; + // pointer to a native URL implementation object + wxURLNativeImp *m_nativeImp; + // Creates on the heap and returns a native + // implementation object for the current platform. + static wxURLNativeImp *CreateNativeImpObject(); +#endif // wxUSE_URL_NATIVE + + wxProtoInfo *m_protoinfo; + wxProtocol *m_protocol; + + wxURLError m_error; + wxString m_url; + + void Init(const wxString&); + bool ParseURL(); + void CleanData(); + void Free(); + bool FetchProtocol(); + + friend class wxProtoInfo; + friend class wxURLModule; + +private: + wxDECLARE_DYNAMIC_CLASS(wxURL); +}; + +#endif // wxUSE_URL + +#endif // _WX_URL_H + diff --git a/lib/wxWidgets/include/wx/ustring.h b/lib/wxWidgets/include/wx/ustring.h new file mode 100644 index 0000000..7790ac1 --- /dev/null +++ b/lib/wxWidgets/include/wx/ustring.h @@ -0,0 +1,705 @@ + +// Name: wx/ustring.h +// Purpose: 32-bit string (UCS-4) +// Author: Robert Roebling +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_USTRING_H_ +#define _WX_USTRING_H_ + +#include "wx/defs.h" +#include "wx/string.h" + +#include <string> + +#if SIZEOF_WCHAR_T == 2 +typedef wxWCharBuffer wxU16CharBuffer; +typedef wxScopedWCharBuffer wxScopedU16CharBuffer; +#else +typedef wxCharTypeBuffer<wxChar16> wxU16CharBuffer; +typedef wxScopedCharTypeBuffer<wxChar16> wxScopedU16CharBuffer; +#endif + +#if SIZEOF_WCHAR_T == 4 +typedef wxWCharBuffer wxU32CharBuffer; +typedef wxScopedWCharBuffer wxScopedU32CharBuffer; +#else +typedef wxCharTypeBuffer<wxChar32> wxU32CharBuffer; +typedef wxScopedCharTypeBuffer<wxChar32> wxScopedU32CharBuffer; +#endif + +#ifdef __VISUALC__ + // "non dll-interface class 'std::basic_string<wxChar32>' used as base + // interface for dll-interface class 'wxString'" -- this is OK in our case + // (and warning is unavoidable anyhow) + #pragma warning(push) + #pragma warning(disable:4275) +#endif + +class WXDLLIMPEXP_BASE wxUString: public std::basic_string<wxChar32> +{ +public: + wxUString() { } + + wxUString( const wxChar32 *str ) { assign(str); } + wxUString( const wxScopedU32CharBuffer &buf ) { assign(buf); } + + wxUString( const char *str ) { assign(str); } + wxUString( const wxScopedCharBuffer &buf ) { assign(buf); } + wxUString( const char *str, const wxMBConv &conv ) { assign(str,conv); } + wxUString( const wxScopedCharBuffer &buf, const wxMBConv &conv ) { assign(buf,conv); } + + wxUString( const wxChar16 *str ) { assign(str); } + wxUString( const wxScopedU16CharBuffer &buf ) { assign(buf); } + + wxUString( const wxCStrData *cstr ) { assign(cstr); } + wxUString( const wxString &str ) { assign(str); } + + wxUString( char ch ) { assign(ch); } + wxUString( wxChar16 ch ) { assign(ch); } + wxUString( wxChar32 ch ) { assign(ch); } + wxUString( wxUniChar ch ) { assign(ch); } + wxUString( wxUniCharRef ch ) { assign(ch); } + wxUString( size_type n, char ch ) { assign(n,ch); } + wxUString( size_type n, wxChar16 ch ) { assign(n,ch); } + wxUString( size_type n, wxChar32 ch ) { assign(n,ch); } + wxUString( size_type n, wxUniChar ch ) { assign(n,ch); } + wxUString( size_type n, wxUniCharRef ch ) { assign(n,ch); } + + // static construction + + static wxUString FromAscii( const char *str, size_type n ) + { + wxUString ret; + ret.assignFromAscii( str, n ); + return ret; + } + + static wxUString FromAscii( const char *str ) + { + wxUString ret; + ret.assignFromAscii( str ); + return ret; + } + + static wxUString FromUTF8( const char *str, size_type n ) + { + wxUString ret; + ret.assignFromUTF8( str, n ); + return ret; + } + + static wxUString FromUTF8( const char *str ) + { + wxUString ret; + ret.assignFromUTF8( str ); + return ret; + } + + static wxUString FromUTF16( const wxChar16 *str, size_type n ) + { + wxUString ret; + ret.assignFromUTF16( str, n ); + return ret; + } + + static wxUString FromUTF16( const wxChar16 *str ) + { + wxUString ret; + ret.assignFromUTF16( str ); + return ret; + } + + // assign from encoding + + wxUString &assignFromAscii( const char *str ); + wxUString &assignFromAscii( const char *str, size_type n ); + wxUString &assignFromUTF8( const char *str ); + wxUString &assignFromUTF8( const char *str, size_type n ); + wxUString &assignFromUTF16( const wxChar16* str ); + wxUString &assignFromUTF16( const wxChar16* str, size_type n ); + wxUString &assignFromCString( const char* str ); + wxUString &assignFromCString( const char* str, const wxMBConv &conv ); + + // conversions + + wxScopedCharBuffer utf8_str() const; + wxScopedU16CharBuffer utf16_str() const; + +#if SIZEOF_WCHAR_T == 2 + wxScopedWCharBuffer wc_str() const + { + return utf16_str(); + } +#else + const wchar_t *wc_str() const + { + return c_str(); + } +#endif + + operator wxString() const + { +#if wxUSE_UNICODE_UTF8 + return wxString::FromUTF8( utf8_str() ); +#else +#if SIZEOF_WCHAR_T == 2 + return wxString( utf16_str() ); +#else + return wxString( c_str() ); +#endif +#endif + } + +#if wxUSE_UNICODE_UTF8 + wxScopedCharBuffer wx_str() const + { + return utf8_str(); + } +#else +#if SIZEOF_WCHAR_T == 2 + wxScopedWCharBuffer wx_str() const + { + return utf16_str(); + } +#else + const wchar_t* wx_str() const + { + return c_str(); + } +#endif +#endif + + // assign + + wxUString &assign( const wxChar32* str ) + { + std::basic_string<wxChar32> *base = this; + return (wxUString &) base->assign( str ); + } + + wxUString &assign( const wxChar32* str, size_type n ) + { + std::basic_string<wxChar32> *base = this; + return (wxUString &) base->assign( str, n ); + } + + wxUString &assign( const wxUString &str ) + { + std::basic_string<wxChar32> *base = this; + return (wxUString &) base->assign( str ); + } + + wxUString &assign( const wxUString &str, size_type pos, size_type n ) + { + std::basic_string<wxChar32> *base = this; + return (wxUString &) base->assign( str, pos, n ); + } + + wxUString &assign( wxChar32 ch ) + { + std::basic_string<wxChar32> *base = this; + return (wxUString &) base->assign( (size_type) 1, ch ); + } + + wxUString &assign( size_type n, wxChar32 ch ) + { + std::basic_string<wxChar32> *base = this; + return (wxUString &) base->assign( n, ch ); + } + + wxUString &assign( const wxScopedU32CharBuffer &buf ) + { + return assign( buf.data() ); + } + + wxUString &assign( const char *str ) + { + return assignFromCString( str ); + } + + wxUString &assign( const wxScopedCharBuffer &buf ) + { + return assignFromCString( buf.data() ); + } + + wxUString &assign( const char *str, const wxMBConv &conv ) + { + return assignFromCString( str, conv ); + } + + wxUString &assign( const wxScopedCharBuffer &buf, const wxMBConv &conv ) + { + return assignFromCString( buf.data(), conv ); + } + + wxUString &assign( const wxChar16 *str ) + { + return assignFromUTF16( str ); + } + + wxUString &assign( const wxScopedU16CharBuffer &buf ) + { + return assignFromUTF16( buf.data() ); + } + + wxUString &assign( const wxCStrData *cstr ) + { +#if SIZEOF_WCHAR_T == 2 + return assignFromUTF16( cstr->AsWChar() ); +#else + return assign( cstr->AsWChar() ); +#endif + } + + wxUString &assign( const wxString &str ) + { +#if wxUSE_UNICODE_UTF8 + return assignFromUTF8( str.wx_str() ); +#else + #if SIZEOF_WCHAR_T == 2 + return assignFromUTF16( str.wc_str() ); + #else + return assign( str.wc_str() ); + #endif +#endif + } + + wxUString &assign( char ch ) + { + char buf[2]; + buf[0] = ch; + buf[1] = 0; + return assignFromCString( buf ); + } + + wxUString &assign( size_type n, char ch ) + { + wxCharBuffer buffer(n); + char *p = buffer.data(); + size_type i; + for (i = 0; i < n; i++) + { + *p = ch; + p++; + } + return assignFromCString( buffer.data() ); + } + + wxUString &assign( wxChar16 ch ) + { + wxChar16 buf[2]; + buf[0] = ch; + buf[1] = 0; + return assignFromUTF16( buf ); + } + + wxUString &assign( size_type n, wxChar16 ch ) + { + wxU16CharBuffer buffer(n); + wxChar16 *p = buffer.data(); + size_type i; + for (i = 0; i < n; i++) + { + *p = ch; + p++; + } + return assignFromUTF16( buffer.data() ); + } + + wxUString &assign( wxUniChar ch ) + { + return assign( (wxChar32) ch.GetValue() ); + } + + wxUString &assign( size_type n, wxUniChar ch ) + { + return assign( n, (wxChar32) ch.GetValue() ); + } + + wxUString &assign( wxUniCharRef ch ) + { + return assign( (wxChar32) ch.GetValue() ); + } + + wxUString &assign( size_type n, wxUniCharRef ch ) + { + return assign( n, (wxChar32) ch.GetValue() ); + } + + // append [STL overload] + + wxUString &append( const wxUString &s ) + { + std::basic_string<wxChar32> *base = this; + return (wxUString &) base->append( s ); + } + + wxUString &append( const wxUString &s, size_type pos, size_type n ) + { + std::basic_string<wxChar32> *base = this; + return (wxUString &) base->append( s, pos, n ); + } + + wxUString &append( const wxChar32* s ) + { + std::basic_string<wxChar32> *base = this; + return (wxUString &) base->append( s ); + } + + wxUString &append( const wxChar32* s, size_type n ) + { + std::basic_string<wxChar32> *base = this; + return (wxUString &) base->append( s, n ); + } + + wxUString &append( size_type n, wxChar32 c ) + { + std::basic_string<wxChar32> *base = this; + return (wxUString &) base->append( n, c ); + } + + wxUString &append( wxChar32 c ) + { + std::basic_string<wxChar32> *base = this; + return (wxUString &) base->append( 1, c ); + } + + // append [wx overload] + + wxUString &append( const wxScopedU16CharBuffer &buf ) + { + return append( buf.data() ); + } + + wxUString &append( const wxScopedU32CharBuffer &buf ) + { + return append( buf.data() ); + } + + wxUString &append( const char *str ) + { + return append( wxUString( str ) ); + } + + wxUString &append( const wxScopedCharBuffer &buf ) + { + return append( wxUString( buf ) ); + } + + wxUString &append( const wxChar16 *str ) + { + return append( wxUString( str ) ); + } + + wxUString &append( const wxString &str ) + { + return append( wxUString( str ) ); + } + + wxUString &append( const wxCStrData *cstr ) + { + return append( wxUString( cstr ) ); + } + + wxUString &append( char ch ) + { + char buf[2]; + buf[0] = ch; + buf[1] = 0; + return append( buf ); + } + + wxUString &append( wxChar16 ch ) + { + wxChar16 buf[2]; + buf[0] = ch; + buf[1] = 0; + return append( buf ); + } + + wxUString &append( wxUniChar ch ) + { + return append( (size_type) 1, (wxChar32) ch.GetValue() ); + } + + wxUString &append( wxUniCharRef ch ) + { + return append( (size_type) 1, (wxChar32) ch.GetValue() ); + } + + + // insert [STL overloads] + + wxUString &insert( size_type pos, const wxUString &s ) + { + std::basic_string<wxChar32> *base = this; + return (wxUString &) base->insert( pos, s ); + } + + wxUString &insert( size_type pos, const wxUString &s, size_type pos1, size_type n ) + { + std::basic_string<wxChar32> *base = this; + return (wxUString &) base->insert( pos, s, pos1, n ); + } + + wxUString &insert( size_type pos, const wxChar32 *s ) + { + std::basic_string<wxChar32> *base = this; + return (wxUString &) base->insert( pos, s ); + } + + wxUString &insert( size_type pos, const wxChar32 *s, size_type n ) + { + std::basic_string<wxChar32> *base = this; + return (wxUString &) base->insert( pos, s, n ); + } + + wxUString &insert( size_type pos, size_type n, wxChar32 c ) + { + std::basic_string<wxChar32> *base = this; + return (wxUString &) base->insert( pos, n, c ); + } + + + // insert [STL overloads] + + wxUString &insert( size_type n, const char *s ) + { + return insert( n, wxUString( s ) ); + } + + wxUString &insert( size_type n, const wxChar16 *s ) + { + return insert( n, wxUString( s ) ); + } + + wxUString &insert( size_type n, const wxScopedCharBuffer &buf ) + { + return insert( n, wxUString( buf ) ); + } + + wxUString &insert( size_type n, const wxScopedU16CharBuffer &buf ) + { + return insert( n, wxUString( buf ) ); + } + + wxUString &insert( size_type n, const wxScopedU32CharBuffer &buf ) + { + return insert( n, buf.data() ); + } + + wxUString &insert( size_type n, const wxString &s ) + { + return insert( n, wxUString( s ) ); + } + + wxUString &insert( size_type n, const wxCStrData *cstr ) + { + return insert( n, wxUString( cstr ) ); + } + + wxUString &insert( size_type n, char ch ) + { + char buf[2]; + buf[0] = ch; + buf[1] = 0; + return insert( n, buf ); + } + + wxUString &insert( size_type n, wchar_t ch ) + { + wchar_t buf[2]; + buf[0] = ch; + buf[1] = 0; + return insert( n, buf ); + } + + // insert iterator + + iterator insert( iterator it, wxChar32 ch ) + { + std::basic_string<wxChar32> *base = this; + return base->insert( it, ch ); + } + + void insert(iterator it, const_iterator first, const_iterator last) + { + std::basic_string<wxChar32> *base = this; + base->insert( it, first, last ); + } + + + // operator = + wxUString& operator=(const wxString& s) + { return assign( s ); } + wxUString& operator=(const wxCStrData* s) + { return assign( s ); } + wxUString& operator=(const char *s) + { return assign( s ); } + wxUString& operator=(const wxChar16 *s) + { return assign( s ); } + wxUString& operator=(const wxChar32 *s) + { return assign( s ); } + wxUString& operator=(const wxScopedCharBuffer &s) + { return assign( s ); } + wxUString& operator=(const wxScopedU16CharBuffer &s) + { return assign( s ); } + wxUString& operator=(const wxScopedU32CharBuffer &s) + { return assign( s ); } + wxUString& operator=(char ch) + { return assign( ch ); } + wxUString& operator=(wxChar16 ch) + { return assign( ch ); } + wxUString& operator=(wxChar32 ch) + { return assign( ch ); } + wxUString& operator=(wxUniChar ch) + { return assign( ch ); } + wxUString& operator=(const wxUniCharRef ch) + { return assign( ch ); } + + // operator += + wxUString& operator+=(const wxUString& s) + { return append( s ); } + wxUString& operator+=(const wxString& s) + { return append( s ); } + wxUString& operator+=(const wxCStrData* s) + { return append( s ); } + wxUString& operator+=(const char *s) + { return append( s ); } + wxUString& operator+=(const wxChar16 *s) + { return append( s ); } + wxUString& operator+=(const wxChar32 *s) + { return append( s ); } + wxUString& operator+=(const wxScopedCharBuffer &s) + { return append( s ); } + wxUString& operator+=(const wxScopedU16CharBuffer &s) + { return append( s ); } + wxUString& operator+=(const wxScopedU32CharBuffer &s) + { return append( s ); } + wxUString& operator+=(char ch) + { return append( ch ); } + wxUString& operator+=(wxChar16 ch) + { return append( ch ); } + wxUString& operator+=(wxChar32 ch) + { return append( ch ); } + wxUString& operator+=(wxUniChar ch) + { return append( ch ); } + wxUString& operator+=(const wxUniCharRef ch) + { return append( ch ); } + +}; + +#ifdef __VISUALC__ + #pragma warning(pop) +#endif + +inline wxUString operator+(const wxUString &s1, const wxUString &s2) + { wxUString ret( s1 ); ret.append( s2 ); return ret; } +inline wxUString operator+(const wxUString &s1, const char *s2) + { return s1 + wxUString(s2); } +inline wxUString operator+(const wxUString &s1, const wxString &s2) + { return s1 + wxUString(s2); } +inline wxUString operator+(const wxUString &s1, const wxCStrData *s2) + { return s1 + wxUString(s2); } +inline wxUString operator+(const wxUString &s1, const wxChar16* s2) + { return s1 + wxUString(s2); } +inline wxUString operator+(const wxUString &s1, const wxChar32 *s2) + { return s1 + wxUString(s2); } +inline wxUString operator+(const wxUString &s1, const wxScopedCharBuffer &s2) + { return s1 + wxUString(s2); } +inline wxUString operator+(const wxUString &s1, const wxScopedU16CharBuffer &s2) + { return s1 + wxUString(s2); } +inline wxUString operator+(const wxUString &s1, const wxScopedU32CharBuffer &s2) + { return s1 + wxUString(s2); } +inline wxUString operator+(const wxUString &s1, char s2) + { return s1 + wxUString(s2); } +inline wxUString operator+(const wxUString &s1, wxChar32 s2) + { wxUString ret( s1 ); ret.append( s2 ); return ret; } +inline wxUString operator+(const wxUString &s1, wxChar16 s2) + { wxUString ret( s1 ); ret.append( (wxChar32) s2 ); return ret; } +inline wxUString operator+(const wxUString &s1, wxUniChar s2) + { wxUString ret( s1 ); ret.append( (wxChar32) s2.GetValue() ); return ret; } +inline wxUString operator+(const wxUString &s1, wxUniCharRef s2) + { wxUString ret( s1 ); ret.append( (wxChar32) s2.GetValue() ); return ret; } + +inline wxUString operator+(const char *s1, const wxUString &s2) + { return wxUString(s1) + s2; } +inline wxUString operator+(const wxString &s1, const wxUString &s2) + { return wxUString(s1) + s2; } +inline wxUString operator+(const wxCStrData *s1, const wxUString &s2) + { return wxUString(s1) + s2; } +inline wxUString operator+(const wxChar16* s1, const wxUString &s2) + { return wxUString(s1) + s2; } +inline wxUString operator+(const wxChar32 *s1, const wxUString &s2) + { return wxUString(s1) + s2; } +inline wxUString operator+(const wxScopedCharBuffer &s1, const wxUString &s2) + { return wxUString(s1) + s2; } +inline wxUString operator+(const wxScopedU16CharBuffer &s1, const wxUString &s2) + { return wxUString(s1) + s2; } +inline wxUString operator+(const wxScopedU32CharBuffer &s1, const wxUString &s2) + { return wxUString(s1) + s2; } +inline wxUString operator+(char s1, const wxUString &s2) + { return wxUString(s1) + s2; } +inline wxUString operator+(wxChar32 s1, const wxUString &s2 ) + { return wxUString(s1) + s2; } +inline wxUString operator+(wxChar16 s1, const wxUString &s2) + { return wxUString(s1) + s2; } +inline wxUString operator+(wxUniChar s1, const wxUString &s2) + { return wxUString(s1) + s2; } +inline wxUString operator+(wxUniCharRef s1, const wxUString &s2) + { return wxUString(s1) + s2; } + + +inline bool operator==(const wxUString& s1, const wxUString& s2) + { return s1.compare( s2 ) == 0; } +inline bool operator!=(const wxUString& s1, const wxUString& s2) + { return s1.compare( s2 ) != 0; } +inline bool operator< (const wxUString& s1, const wxUString& s2) + { return s1.compare( s2 ) < 0; } +inline bool operator> (const wxUString& s1, const wxUString& s2) + { return s1.compare( s2 ) > 0; } +inline bool operator<=(const wxUString& s1, const wxUString& s2) + { return s1.compare( s2 ) <= 0; } +inline bool operator>=(const wxUString& s1, const wxUString& s2) + { return s1.compare( s2 ) >= 0; } + +#define wxUSTRING_COMP_OPERATORS( T ) \ +inline bool operator==(const wxUString& s1, T s2) \ + { return s1.compare( wxUString(s2) ) == 0; } \ +inline bool operator!=(const wxUString& s1, T s2) \ + { return s1.compare( wxUString(s2) ) != 0; } \ +inline bool operator< (const wxUString& s1, T s2) \ + { return s1.compare( wxUString(s2) ) < 0; } \ +inline bool operator> (const wxUString& s1, T s2) \ + { return s1.compare( wxUString(s2) ) > 0; } \ +inline bool operator<=(const wxUString& s1, T s2) \ + { return s1.compare( wxUString(s2) ) <= 0; } \ +inline bool operator>=(const wxUString& s1, T s2) \ + { return s1.compare( wxUString(s2) ) >= 0; } \ +\ +inline bool operator==(T s2, const wxUString& s1) \ + { return s1.compare( wxUString(s2) ) == 0; } \ +inline bool operator!=(T s2, const wxUString& s1) \ + { return s1.compare( wxUString(s2) ) != 0; } \ +inline bool operator< (T s2, const wxUString& s1) \ + { return s1.compare( wxUString(s2) ) > 0; } \ +inline bool operator> (T s2, const wxUString& s1) \ + { return s1.compare( wxUString(s2) ) < 0; } \ +inline bool operator<=(T s2, const wxUString& s1) \ + { return s1.compare( wxUString(s2) ) >= 0; } \ +inline bool operator>=(T s2, const wxUString& s1) \ + { return s1.compare( wxUString(s2) ) <= 0; } + +wxUSTRING_COMP_OPERATORS( const wxString & ) +wxUSTRING_COMP_OPERATORS( const char * ) +wxUSTRING_COMP_OPERATORS( const wxChar16 * ) +wxUSTRING_COMP_OPERATORS( const wxChar32 * ) +wxUSTRING_COMP_OPERATORS( const wxScopedCharBuffer & ) +wxUSTRING_COMP_OPERATORS( const wxScopedU16CharBuffer & ) +wxUSTRING_COMP_OPERATORS( const wxScopedU32CharBuffer & ) +wxUSTRING_COMP_OPERATORS( const wxCStrData * ) + +#endif // _WX_USTRING_H_ diff --git a/lib/wxWidgets/include/wx/utils.h b/lib/wxWidgets/include/wx/utils.h new file mode 100644 index 0000000..2131128 --- /dev/null +++ b/lib/wxWidgets/include/wx/utils.h @@ -0,0 +1,884 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/utils.h +// Purpose: Miscellaneous utilities +// Author: Julian Smart +// Modified by: +// Created: 29/01/98 +// Copyright: (c) 1998 Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UTILS_H_ +#define _WX_UTILS_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/object.h" +#include "wx/list.h" +#include "wx/filefn.h" +#include "wx/hashmap.h" +#include "wx/versioninfo.h" +#include "wx/meta/implicitconversion.h" + +#if wxUSE_GUI + #include "wx/gdicmn.h" + #include "wx/mousestate.h" + #include "wx/vector.h" +#endif + +class WXDLLIMPEXP_FWD_BASE wxArrayString; +class WXDLLIMPEXP_FWD_BASE wxArrayInt; + +// need this for wxGetDiskSpace() as we can't, unfortunately, forward declare +// wxLongLong +#include "wx/longlong.h" + +// needed for wxOperatingSystemId, wxLinuxDistributionInfo +#include "wx/platinfo.h" + +#if defined(__X__) + #include <dirent.h> + #include <unistd.h> +#endif + +#include <stdio.h> + +// ---------------------------------------------------------------------------- +// Forward declaration +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_BASE wxProcess; +class WXDLLIMPEXP_FWD_CORE wxFrame; +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxEventLoop; + +// ---------------------------------------------------------------------------- +// Arithmetic functions +// ---------------------------------------------------------------------------- + +template<typename T1, typename T2> +inline typename wxImplicitConversionType<T1,T2>::value +wxMax(T1 a, T2 b) +{ + typedef typename wxImplicitConversionType<T1,T2>::value ResultType; + + // Cast both operands to the same type before comparing them to avoid + // warnings about signed/unsigned comparisons from some compilers: + return static_cast<ResultType>(a) > static_cast<ResultType>(b) ? a : b; +} + +template<typename T1, typename T2> +inline typename wxImplicitConversionType<T1,T2>::value +wxMin(T1 a, T2 b) +{ + typedef typename wxImplicitConversionType<T1,T2>::value ResultType; + + return static_cast<ResultType>(a) < static_cast<ResultType>(b) ? a : b; +} + +template<typename T1, typename T2, typename T3> +inline typename wxImplicitConversionType3<T1,T2,T3>::value +wxClip(T1 a, T2 b, T3 c) +{ + typedef typename wxImplicitConversionType3<T1,T2,T3>::value ResultType; + + if ( static_cast<ResultType>(a) < static_cast<ResultType>(b) ) + return b; + + if ( static_cast<ResultType>(a) > static_cast<ResultType>(c) ) + return c; + + return a; +} + +// ---------------------------------------------------------------------------- +// wxMemorySize +// ---------------------------------------------------------------------------- + +// wxGetFreeMemory can return huge amount of memory on 32-bit platforms as well +// so to always use long long for its result type on all platforms which +// support it +#if wxUSE_LONGLONG + typedef wxLongLong wxMemorySize; +#else + typedef long wxMemorySize; +#endif + +// ---------------------------------------------------------------------------- +// String functions (deprecated, use wxString) +// ---------------------------------------------------------------------------- + +#if WXWIN_COMPATIBILITY_2_8 +// A shorter way of using strcmp +wxDEPRECATED_INLINE(inline bool wxStringEq(const char *s1, const char *s2), + return wxCRT_StrcmpA(s1, s2) == 0; ) + +#if wxUSE_UNICODE +wxDEPRECATED_INLINE(inline bool wxStringEq(const wchar_t *s1, const wchar_t *s2), + return wxCRT_StrcmpW(s1, s2) == 0; ) +#endif // wxUSE_UNICODE + +#endif // WXWIN_COMPATIBILITY_2_8 + +// ---------------------------------------------------------------------------- +// Miscellaneous functions +// ---------------------------------------------------------------------------- + +// Sound the bell +WXDLLIMPEXP_CORE void wxBell(); + +#if wxUSE_MSGDLG +// Show wxWidgets information +WXDLLIMPEXP_CORE void wxInfoMessageBox(wxWindow* parent); +#endif // wxUSE_MSGDLG + +WXDLLIMPEXP_CORE wxVersionInfo wxGetLibraryVersionInfo(); + +// Get OS description as a user-readable string +WXDLLIMPEXP_BASE wxString wxGetOsDescription(); + +// Get OS version +WXDLLIMPEXP_BASE wxOperatingSystemId wxGetOsVersion(int *verMaj = NULL, + int *verMin = NULL, + int *verMicro = NULL); + +// Check is OS version is at least the specified major and minor version +WXDLLIMPEXP_BASE bool wxCheckOsVersion(int majorVsn, int minorVsn = 0, int microVsn = 0); + +// Get platform endianness +WXDLLIMPEXP_BASE bool wxIsPlatformLittleEndian(); + +// Get platform architecture bitness +WXDLLIMPEXP_BASE bool wxIsPlatform64Bit(); + +// Get machine CPU architecture +WXDLLIMPEXP_BASE wxString wxGetCpuArchitectureName(); + +// Get native machine CPU architecture +WXDLLIMPEXP_BASE wxString wxGetNativeCpuArchitectureName(); + +#ifdef __LINUX__ +// Get linux-distro information +WXDLLIMPEXP_BASE wxLinuxDistributionInfo wxGetLinuxDistributionInfo(); +#endif + +// Return a string with the current date/time +WXDLLIMPEXP_BASE wxString wxNow(); + +// Return path where wxWidgets is installed (mostly useful in Unices) +WXDLLIMPEXP_BASE wxString wxGetInstallPrefix(); +// Return path to wxWin data (/usr/share/wx/%{version}) (Unices) +WXDLLIMPEXP_BASE wxString wxGetDataDir(); + +#if wxUSE_GUI + +// Get the state of a key (true if pressed, false if not) +// This is generally most useful getting the state of +// the modifier or toggle keys. +WXDLLIMPEXP_CORE bool wxGetKeyState(wxKeyCode key); + +// Don't synthesize KeyUp events holding down a key and producing +// KeyDown events with autorepeat. On by default and always on +// in wxMSW. +WXDLLIMPEXP_CORE bool wxSetDetectableAutoRepeat( bool flag ); + +// Returns the current state of the mouse position, buttons and modifiers +WXDLLIMPEXP_CORE wxMouseState wxGetMouseState(); + +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// wxPlatform +// ---------------------------------------------------------------------------- + +/* + * Class to make it easier to specify platform-dependent values + * + * Examples: + * long val = wxPlatform::If(wxMac, 1).ElseIf(wxGTK, 2).ElseIf(stPDA, 5).Else(3); + * wxString strVal = wxPlatform::If(wxMac, wxT("Mac")).ElseIf(wxMSW, wxT("MSW")).Else(wxT("Other")); + * + * A custom platform symbol: + * + * #define stPDA 100 + * #ifdef __WXMSW__ + * wxPlatform::AddPlatform(stPDA); + * #endif + * + * long windowStyle = wxCAPTION | (long) wxPlatform::IfNot(stPDA, wxRESIZE_BORDER); + * + */ + +class WXDLLIMPEXP_BASE wxPlatform +{ +public: + wxPlatform() { Init(); } + wxPlatform(const wxPlatform& platform) { Copy(platform); } + void operator = (const wxPlatform& platform) { if (&platform != this) Copy(platform); } + void Copy(const wxPlatform& platform); + + // Specify an optional default value + wxPlatform(int defValue) { Init(); m_longValue = (long)defValue; } + wxPlatform(long defValue) { Init(); m_longValue = defValue; } + wxPlatform(const wxString& defValue) { Init(); m_stringValue = defValue; } + wxPlatform(double defValue) { Init(); m_doubleValue = defValue; } + + static wxPlatform If(int platform, long value); + static wxPlatform IfNot(int platform, long value); + wxPlatform& ElseIf(int platform, long value); + wxPlatform& ElseIfNot(int platform, long value); + wxPlatform& Else(long value); + + static wxPlatform If(int platform, int value) { return If(platform, (long)value); } + static wxPlatform IfNot(int platform, int value) { return IfNot(platform, (long)value); } + wxPlatform& ElseIf(int platform, int value) { return ElseIf(platform, (long) value); } + wxPlatform& ElseIfNot(int platform, int value) { return ElseIfNot(platform, (long) value); } + wxPlatform& Else(int value) { return Else((long) value); } + + static wxPlatform If(int platform, double value); + static wxPlatform IfNot(int platform, double value); + wxPlatform& ElseIf(int platform, double value); + wxPlatform& ElseIfNot(int platform, double value); + wxPlatform& Else(double value); + + static wxPlatform If(int platform, const wxString& value); + static wxPlatform IfNot(int platform, const wxString& value); + wxPlatform& ElseIf(int platform, const wxString& value); + wxPlatform& ElseIfNot(int platform, const wxString& value); + wxPlatform& Else(const wxString& value); + + long GetInteger() const { return m_longValue; } + const wxString& GetString() const { return m_stringValue; } + double GetDouble() const { return m_doubleValue; } + + operator int() const { return (int) GetInteger(); } + operator long() const { return GetInteger(); } + operator double() const { return GetDouble(); } + operator const wxString&() const { return GetString(); } + + static void AddPlatform(int platform); + static bool Is(int platform); + static void ClearPlatforms(); + +private: + + void Init() { m_longValue = 0; m_doubleValue = 0.0; } + + long m_longValue; + double m_doubleValue; + wxString m_stringValue; + static wxArrayInt* sm_customPlatforms; +}; + +/// Function for testing current platform +inline bool wxPlatformIs(int platform) { return wxPlatform::Is(platform); } + +// ---------------------------------------------------------------------------- +// Window ID management +// ---------------------------------------------------------------------------- + +// Ensure subsequent IDs don't clash with this one +WXDLLIMPEXP_BASE void wxRegisterId(wxWindowID id); + +// Return the current ID +WXDLLIMPEXP_BASE wxWindowID wxGetCurrentId(); + +// Generate a unique ID +WXDLLIMPEXP_BASE wxWindowID wxNewId(); + +// ---------------------------------------------------------------------------- +// Various conversions +// ---------------------------------------------------------------------------- + +// Convert 2-digit hex number to decimal +WXDLLIMPEXP_BASE int wxHexToDec(const wxString& buf); + +// Convert 2-digit hex number to decimal +inline int wxHexToDec(const char* buf) +{ + int firstDigit, secondDigit; + + if (buf[0] >= 'A') + firstDigit = buf[0] - 'A' + 10; + else if (buf[0] >= '0') + firstDigit = buf[0] - '0'; + else + firstDigit = -1; + + wxCHECK_MSG( firstDigit >= 0 && firstDigit <= 15, -1, wxS("Invalid argument") ); + + if (buf[1] >= 'A') + secondDigit = buf[1] - 'A' + 10; + else if (buf[1] >= '0') + secondDigit = buf[1] - '0'; + else + secondDigit = -1; + + wxCHECK_MSG( secondDigit >= 0 && secondDigit <= 15, -1, wxS("Invalid argument") ); + + return firstDigit * 16 + secondDigit; +} + + +// Convert decimal integer to 2-character hex string +WXDLLIMPEXP_BASE void wxDecToHex(unsigned char dec, wxChar *buf); +WXDLLIMPEXP_BASE void wxDecToHex(unsigned char dec, char* ch1, char* ch2); +WXDLLIMPEXP_BASE wxString wxDecToHex(unsigned char dec); + +// ---------------------------------------------------------------------------- +// Security +// ---------------------------------------------------------------------------- + +WXDLLIMPEXP_BASE void wxSecureZeroMemory(void *p, size_t n); + +// ---------------------------------------------------------------------------- +// Process management +// ---------------------------------------------------------------------------- + +// NB: for backwards compatibility reasons the values of wxEXEC_[A]SYNC *must* +// be 0 and 1, don't change! + +enum +{ + // execute the process asynchronously + wxEXEC_ASYNC = 0, + + // execute it synchronously, i.e. wait until it finishes + wxEXEC_SYNC = 1, + + // under Windows, don't hide the child even if it's IO is redirected (this + // is done by default) + wxEXEC_SHOW_CONSOLE = 2, + + // deprecated synonym for wxEXEC_SHOW_CONSOLE, use the new name as it's + // more clear + wxEXEC_NOHIDE = wxEXEC_SHOW_CONSOLE, + + // under Unix, if the process is the group leader then passing wxKILL_CHILDREN to wxKill + // kills all children as well as pid + // under Windows (NT family only), sets the CREATE_NEW_PROCESS_GROUP flag, + // which allows to target Ctrl-Break signal to the spawned process. + // applies to console processes only. + wxEXEC_MAKE_GROUP_LEADER = 4, + + // by default synchronous execution disables all program windows to avoid + // that the user interacts with the program while the child process is + // running, you can use this flag to prevent this from happening + wxEXEC_NODISABLE = 8, + + // by default, the event loop is run while waiting for synchronous execution + // to complete and this flag can be used to simply block the main process + // until the child process finishes + wxEXEC_NOEVENTS = 16, + + // under Windows, hide the console of the child process if it has one, even + // if its IO is not redirected + wxEXEC_HIDE_CONSOLE = 32, + + // convenient synonym for flags given system()-like behaviour + wxEXEC_BLOCK = wxEXEC_SYNC | wxEXEC_NOEVENTS +}; + +// Map storing environment variables. +typedef wxStringToStringHashMap wxEnvVariableHashMap; + +// Used to pass additional parameters for child process to wxExecute(). Could +// be extended with other fields later. +struct wxExecuteEnv +{ + wxString cwd; // If empty, CWD is not changed. + wxEnvVariableHashMap env; // If empty, environment is unchanged. +}; + +// Execute another program. +// +// If flags contain wxEXEC_SYNC, return -1 on failure and the exit code of the +// process if everything was ok. Otherwise (i.e. if wxEXEC_ASYNC), return 0 on +// failure and the PID of the launched process if ok. +WXDLLIMPEXP_BASE long wxExecute(const wxString& command, + int flags = wxEXEC_ASYNC, + wxProcess *process = NULL, + const wxExecuteEnv *env = NULL); +WXDLLIMPEXP_BASE long wxExecute(const char* const* argv, + int flags = wxEXEC_ASYNC, + wxProcess *process = NULL, + const wxExecuteEnv *env = NULL); +#if wxUSE_UNICODE +WXDLLIMPEXP_BASE long wxExecute(const wchar_t* const* argv, + int flags = wxEXEC_ASYNC, + wxProcess *process = NULL, + const wxExecuteEnv *env = NULL); +#endif // wxUSE_UNICODE + +// execute the command capturing its output into an array line by line, this is +// always synchronous +WXDLLIMPEXP_BASE long wxExecute(const wxString& command, + wxArrayString& output, + int flags = 0, + const wxExecuteEnv *env = NULL); + +// also capture stderr (also synchronous) +WXDLLIMPEXP_BASE long wxExecute(const wxString& command, + wxArrayString& output, + wxArrayString& error, + int flags = 0, + const wxExecuteEnv *env = NULL); + +#if defined(__WINDOWS__) && wxUSE_IPC +// ask a DDE server to execute the DDE request with given parameters +WXDLLIMPEXP_BASE bool wxExecuteDDE(const wxString& ddeServer, + const wxString& ddeTopic, + const wxString& ddeCommand); +#endif // __WINDOWS__ && wxUSE_IPC + +enum wxSignal +{ + wxSIGNONE = 0, // verify if the process exists under Unix + wxSIGHUP, + wxSIGINT, + wxSIGQUIT, + wxSIGILL, + wxSIGTRAP, + wxSIGABRT, + wxSIGIOT = wxSIGABRT, // another name + wxSIGEMT, + wxSIGFPE, + wxSIGKILL, + wxSIGBUS, + wxSIGSEGV, + wxSIGSYS, + wxSIGPIPE, + wxSIGALRM, + wxSIGTERM + + // further signals are different in meaning between different Unix systems +}; + +enum wxKillError +{ + wxKILL_OK, // no error + wxKILL_BAD_SIGNAL, // no such signal + wxKILL_ACCESS_DENIED, // permission denied + wxKILL_NO_PROCESS, // no such process + wxKILL_ERROR // another, unspecified error +}; + +enum wxKillFlags +{ + wxKILL_NOCHILDREN = 0, // don't kill children + wxKILL_CHILDREN = 1 // kill children +}; + +enum wxShutdownFlags +{ + wxSHUTDOWN_FORCE = 1,// can be combined with other flags (MSW-only) + wxSHUTDOWN_POWEROFF = 2,// power off the computer + wxSHUTDOWN_REBOOT = 4,// shutdown and reboot + wxSHUTDOWN_LOGOFF = 8 // close session (currently MSW-only) +}; + +// Shutdown or reboot the PC +WXDLLIMPEXP_BASE bool wxShutdown(int flags = wxSHUTDOWN_POWEROFF); + +// send the given signal to the process (only NONE and KILL are supported under +// Windows, all others mean TERM), return 0 if ok and -1 on error +// +// return detailed error in rc if not NULL +WXDLLIMPEXP_BASE int wxKill(long pid, + wxSignal sig = wxSIGTERM, + wxKillError *rc = NULL, + int flags = wxKILL_NOCHILDREN); + +// Execute a command in an interactive shell window (always synchronously) +// If no command then just the shell +WXDLLIMPEXP_BASE bool wxShell(const wxString& command = wxEmptyString); + +// As wxShell(), but must give a (non interactive) command and its output will +// be returned in output array +WXDLLIMPEXP_BASE bool wxShell(const wxString& command, wxArrayString& output); + +// Sleep for nSecs seconds +WXDLLIMPEXP_BASE void wxSleep(int nSecs); + +// Sleep for a given amount of milliseconds +WXDLLIMPEXP_BASE void wxMilliSleep(unsigned long milliseconds); + +// Sleep for a given amount of microseconds +WXDLLIMPEXP_BASE void wxMicroSleep(unsigned long microseconds); + +#if WXWIN_COMPATIBILITY_2_8 +// Sleep for a given amount of milliseconds (old, bad name), use wxMilliSleep +wxDEPRECATED( WXDLLIMPEXP_BASE void wxUsleep(unsigned long milliseconds) ); +#endif + +// Get the process id of the current process +WXDLLIMPEXP_BASE unsigned long wxGetProcessId(); + +// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX) +WXDLLIMPEXP_BASE wxMemorySize wxGetFreeMemory(); + +#if wxUSE_ON_FATAL_EXCEPTION + +// should wxApp::OnFatalException() be called? +WXDLLIMPEXP_BASE bool wxHandleFatalExceptions(bool doit = true); + +#endif // wxUSE_ON_FATAL_EXCEPTION + +// ---------------------------------------------------------------------------- +// Environment variables +// ---------------------------------------------------------------------------- + +// returns true if variable exists (value may be NULL if you just want to check +// for this) +WXDLLIMPEXP_BASE bool wxGetEnv(const wxString& var, wxString *value); + +// set the env var name to the given value, return true on success +WXDLLIMPEXP_BASE bool wxSetEnv(const wxString& var, const wxString& value); + +// remove the env var from environment +WXDLLIMPEXP_BASE bool wxUnsetEnv(const wxString& var); + +#if WXWIN_COMPATIBILITY_2_8 +inline bool wxSetEnv(const wxString& var, const char *value) + { return wxSetEnv(var, wxString(value)); } +inline bool wxSetEnv(const wxString& var, const wchar_t *value) + { return wxSetEnv(var, wxString(value)); } +template<typename T> +inline bool wxSetEnv(const wxString& var, const wxScopedCharTypeBuffer<T>& value) + { return wxSetEnv(var, wxString(value)); } +inline bool wxSetEnv(const wxString& var, const wxCStrData& value) + { return wxSetEnv(var, wxString(value)); } + +// this one is for passing NULL directly - don't use it, use wxUnsetEnv instead +wxDEPRECATED( inline bool wxSetEnv(const wxString& var, int value) ); +inline bool wxSetEnv(const wxString& var, int value) +{ + wxASSERT_MSG( value == 0, "using non-NULL integer as string?" ); + + wxUnusedVar(value); // fix unused parameter warning in release build + + return wxUnsetEnv(var); +} +#endif // WXWIN_COMPATIBILITY_2_8 + +// Retrieve the complete environment by filling specified map. +// Returns true on success or false if an error occurred. +WXDLLIMPEXP_BASE bool wxGetEnvMap(wxEnvVariableHashMap *map); + +// ---------------------------------------------------------------------------- +// Network and username functions. +// ---------------------------------------------------------------------------- + +// NB: "char *" functions are deprecated, use wxString ones! + +// Get eMail address +WXDLLIMPEXP_BASE bool wxGetEmailAddress(wxChar *buf, int maxSize); +WXDLLIMPEXP_BASE wxString wxGetEmailAddress(); + +// Get hostname. +WXDLLIMPEXP_BASE bool wxGetHostName(wxChar *buf, int maxSize); +WXDLLIMPEXP_BASE wxString wxGetHostName(); + +// Get FQDN +WXDLLIMPEXP_BASE wxString wxGetFullHostName(); +WXDLLIMPEXP_BASE bool wxGetFullHostName(wxChar *buf, int maxSize); + +// Get user ID e.g. jacs (this is known as login name under Unix) +WXDLLIMPEXP_BASE bool wxGetUserId(wxChar *buf, int maxSize); +WXDLLIMPEXP_BASE wxString wxGetUserId(); + +// Get user name e.g. Julian Smart +WXDLLIMPEXP_BASE bool wxGetUserName(wxChar *buf, int maxSize); +WXDLLIMPEXP_BASE wxString wxGetUserName(); + +// Get current Home dir and copy to dest (returns pstr->c_str()) +WXDLLIMPEXP_BASE wxString wxGetHomeDir(); +WXDLLIMPEXP_BASE const wxChar* wxGetHomeDir(wxString *pstr); + +// Get the user's (by default use the current user name) home dir, +// return empty string on error +WXDLLIMPEXP_BASE wxString wxGetUserHome(const wxString& user = wxEmptyString); + + +#if wxUSE_LONGLONG + typedef wxLongLong wxDiskspaceSize_t; +#else + typedef long wxDiskspaceSize_t; +#endif + +// get number of total/free bytes on the disk where path belongs +WXDLLIMPEXP_BASE bool wxGetDiskSpace(const wxString& path, + wxDiskspaceSize_t *pTotal = NULL, + wxDiskspaceSize_t *pFree = NULL); + + + +// See wx/vector.h for more about this hack. +#ifndef wxQSORT_DECLARED + +#define wxQSORT_DECLARED + +typedef int (*wxSortCallback)(const void* pItem1, + const void* pItem2, + const void* user_data); + + +WXDLLIMPEXP_BASE void wxQsort(void* pbase, size_t total_elems, + size_t size, wxSortCallback cmp, + const void* user_data); + +#endif // !wxQSORT_DECLARED + + +#if wxUSE_GUI // GUI only things from now on + +// ---------------------------------------------------------------------------- +// Launch default browser +// ---------------------------------------------------------------------------- + +// flags for wxLaunchDefaultBrowser +enum +{ + wxBROWSER_NEW_WINDOW = 0x01, + wxBROWSER_NOBUSYCURSOR = 0x02 +}; + +// Launch url in the user's default internet browser +WXDLLIMPEXP_CORE bool wxLaunchDefaultBrowser(const wxString& url, int flags = 0); + +// Launch document in the user's default application +WXDLLIMPEXP_CORE bool wxLaunchDefaultApplication(const wxString& path, int flags = 0); + +// ---------------------------------------------------------------------------- +// Menu accelerators related things +// ---------------------------------------------------------------------------- + +// flags for wxStripMenuCodes +enum +{ + // strip '&' characters + wxStrip_Mnemonics = 1, + + // strip everything after '\t' + wxStrip_Accel = 2, + + // strip mnemonics of the form "(&X)" appended to the string (used in CJK + // translations) + wxStrip_CJKMnemonics = 4, + + // strip everything (this doesn't include wxStrip_CJKMnemonics for + // compatibility) + wxStrip_All = wxStrip_Mnemonics | wxStrip_Accel, + + // strip everything including CJK mnemonics, suitable for menu items labels + // only (despite its name, wxStripMenuCodes() is currently used for control + // labels too) + wxStrip_Menu = wxStrip_All | wxStrip_CJKMnemonics +}; + +// strip mnemonics and/or accelerators from the label +WXDLLIMPEXP_CORE wxString +wxStripMenuCodes(const wxString& str, int flags = wxStrip_All); + +// ---------------------------------------------------------------------------- +// Window search +// ---------------------------------------------------------------------------- + +// Returns menu item id or wxNOT_FOUND if none. +WXDLLIMPEXP_CORE int wxFindMenuItemId(wxFrame *frame, const wxString& menuString, const wxString& itemString); + +// Find the wxWindow at the given point. wxGenericFindWindowAtPoint +// is always present but may be less reliable than a native version. +WXDLLIMPEXP_CORE wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt); +WXDLLIMPEXP_CORE wxWindow* wxFindWindowAtPoint(const wxPoint& pt); + +// NB: this function is obsolete, use wxWindow::FindWindowByLabel() instead +// +// Find the window/widget with the given title or label. +// Pass a parent to begin the search from, or NULL to look through +// all windows. +WXDLLIMPEXP_CORE wxWindow* wxFindWindowByLabel(const wxString& title, wxWindow *parent = NULL); + +// NB: this function is obsolete, use wxWindow::FindWindowByName() instead +// +// Find window by name, and if that fails, by label. +WXDLLIMPEXP_CORE wxWindow* wxFindWindowByName(const wxString& name, wxWindow *parent = NULL); + +// ---------------------------------------------------------------------------- +// Message/event queue helpers +// ---------------------------------------------------------------------------- + +// Yield to other apps/messages and disable user input +WXDLLIMPEXP_CORE bool wxSafeYield(wxWindow *win = NULL, bool onlyIfNeeded = false); + +// Enable or disable input to all top level windows +WXDLLIMPEXP_CORE void wxEnableTopLevelWindows(bool enable = true); + +// Check whether this window wants to process messages, e.g. Stop button +// in long calculations. +WXDLLIMPEXP_CORE bool wxCheckForInterrupt(wxWindow *wnd); + +// Consume all events until no more left +WXDLLIMPEXP_CORE void wxFlushEvents(); + +// a class which disables all windows (except, may be, the given one) in its +// ctor and enables them back in its dtor +class WXDLLIMPEXP_CORE wxWindowDisabler +{ +public: + // this ctor conditionally disables all windows: if the argument is false, + // it doesn't do anything + explicit wxWindowDisabler(bool disable = true); + + // ctor disables all windows except the given one(s) + explicit wxWindowDisabler(wxWindow *winToSkip, wxWindow *winToSkip2 = NULL); + + // dtor enables back all windows disabled by the ctor + ~wxWindowDisabler(); + +private: + // disable all windows not in m_windowsToSkip + void DoDisable(); + +#if defined(__WXOSX__) && wxOSX_USE_COCOA + void AfterDisable(wxWindow* winToSkip); + void BeforeEnable(); + + wxEventLoop* m_modalEventLoop = NULL; +#endif + wxVector<wxWindow*> m_windowsToSkip; + bool m_disabled; + + wxDECLARE_NO_COPY_CLASS(wxWindowDisabler); +}; + +// ---------------------------------------------------------------------------- +// Cursors +// ---------------------------------------------------------------------------- + +// Set the cursor to the busy cursor for all windows +WXDLLIMPEXP_CORE void wxBeginBusyCursor(const wxCursor *cursor = wxHOURGLASS_CURSOR); + +// Restore cursor to normal +WXDLLIMPEXP_CORE void wxEndBusyCursor(); + +// true if we're between the above two calls +WXDLLIMPEXP_CORE bool wxIsBusy(); + +// Convenience class so we can just create a wxBusyCursor object on the stack +class WXDLLIMPEXP_CORE wxBusyCursor +{ +public: + wxBusyCursor(const wxCursor* cursor = wxHOURGLASS_CURSOR) + { wxBeginBusyCursor(cursor); } + ~wxBusyCursor() + { wxEndBusyCursor(); } + + // FIXME: These two methods are currently only implemented (and needed?) + // in wxGTK. BusyCursor handling should probably be moved to + // common code since the wxGTK and wxMSW implementations are very + // similar except for wxMSW using HCURSOR directly instead of + // wxCursor.. -- RL. + static const wxCursor &GetStoredCursor(); + static const wxCursor GetBusyCursor(); +}; + +void WXDLLIMPEXP_CORE wxGetMousePosition( int* x, int* y ); + +// ---------------------------------------------------------------------------- +// X11 Display access +// ---------------------------------------------------------------------------- + +#if defined(__X__) || (defined(__WXGTK__) && defined(__UNIX__)) + +#ifdef __WXGTK__ + WXDLLIMPEXP_CORE void *wxGetDisplay(); + enum wxDisplayType + { + wxDisplayNone, + wxDisplayX11, + wxDisplayWayland + }; + struct wxDisplayInfo + { + void* dpy; + wxDisplayType type; + }; + WXDLLIMPEXP_CORE wxDisplayInfo wxGetDisplayInfo(); +#endif + +#ifdef __X__ + WXDLLIMPEXP_CORE WXDisplay *wxGetDisplay(); + WXDLLIMPEXP_CORE bool wxSetDisplay(const wxString& display_name); + WXDLLIMPEXP_CORE wxString wxGetDisplayName(); +#endif // X or GTK+ + +// use this function instead of the functions above in implementation code +inline struct _XDisplay *wxGetX11Display() +{ + return (_XDisplay *)wxGetDisplay(); +} + +#endif // X11 || wxGTK + +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// wxYield(): these functions are obsolete, please use wxApp methods instead! +// ---------------------------------------------------------------------------- + +// avoid redeclaring this function here if it had been already declared by +// wx/app.h, this results in warnings from g++ with -Wredundant-decls +#ifndef wx_YIELD_DECLARED +#define wx_YIELD_DECLARED + +// Yield to other apps/messages +WXDLLIMPEXP_CORE bool wxYield(); + +#endif // wx_YIELD_DECLARED + +// Like wxYield, but fails silently if the yield is recursive. +WXDLLIMPEXP_CORE bool wxYieldIfNeeded(); + +// ---------------------------------------------------------------------------- +// Windows resources access +// ---------------------------------------------------------------------------- + +// Windows only: get user-defined resource from the .res file. +#ifdef __WINDOWS__ + // default resource type for wxLoadUserResource() + extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxUserResourceStr; + + // Return the pointer to the resource data. This pointer is read-only, use + // the overload below if you need to modify the data. + // + // Notice that the resource type can be either a real string or an integer + // produced by MAKEINTRESOURCE(). In particular, any standard resource type, + // i.e any RT_XXX constant, could be passed here. + // + // Returns true on success, false on failure. Doesn't log an error message + // if the resource is not found (because this could be expected) but does + // log one if any other error occurs. + WXDLLIMPEXP_BASE bool + wxLoadUserResource(const void **outData, + size_t *outLen, + const wxString& resourceName, + const wxChar* resourceType = wxUserResourceStr, + WXHINSTANCE module = NULL); + + // This function allocates a new buffer and makes a copy of the resource + // data, remember to delete[] the buffer. And avoid using it entirely if + // the overload above can be used. + // + // Returns NULL on failure. + WXDLLIMPEXP_BASE char* + wxLoadUserResource(const wxString& resourceName, + const wxChar* resourceType = wxUserResourceStr, + int* pLen = NULL, + WXHINSTANCE module = NULL); +#endif // __WINDOWS__ + +#endif + // _WX_UTILSH__ diff --git a/lib/wxWidgets/include/wx/valgen.h b/lib/wxWidgets/include/wx/valgen.h new file mode 100644 index 0000000..995db4f --- /dev/null +++ b/lib/wxWidgets/include/wx/valgen.h @@ -0,0 +1,94 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/valgen.h +// Purpose: wxGenericValidator class +// Author: Kevin Smith +// Created: Jan 22 1999 +// Copyright: (c) 1999 Julian Smart (assigned from Kevin) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_VALGENH__ +#define _WX_VALGENH__ + +#include "wx/validate.h" + +#if wxUSE_VALIDATORS + +class WXDLLIMPEXP_FWD_BASE wxDateTime; +class WXDLLIMPEXP_FWD_BASE wxFileName; + +// ---------------------------------------------------------------------------- +// wxGenericValidator performs data transfer between many standard controls and +// variables of the type corresponding to their values. +// +// It doesn't do any validation so its name is a slight misnomer. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGenericValidator: public wxValidator +{ +public: + // Different constructors: each of them creates a validator which can only + // be used with some controls, the comments before each constructor + // indicate which ones: + // wxCheckBox, wxRadioButton, wx(Bitmap)ToggleButton + wxGenericValidator(bool* val); + // wxChoice, wxGauge, wxRadioBox, wxScrollBar, wxSlider, wxSpinButton + wxGenericValidator(int* val); + // wxComboBox, wxTextCtrl, wxButton, wxStaticText (read-only) + wxGenericValidator(wxString* val); + // wxListBox, wxCheckListBox + wxGenericValidator(wxArrayInt* val); +#if wxUSE_DATETIME + // wxDatePickerCtrl + wxGenericValidator(wxDateTime* val); +#endif // wxUSE_DATETIME + // wxTextCtrl + wxGenericValidator(wxFileName* val); + // wxTextCtrl + wxGenericValidator(float* val); + // wxTextCtrl + wxGenericValidator(double* val); + + wxGenericValidator(const wxGenericValidator& copyFrom); + + virtual ~wxGenericValidator(){} + + // Make a clone of this validator (or return NULL) - currently necessary + // if you're passing a reference to a validator. + // Another possibility is to always pass a pointer to a new validator + // (so the calling code can use a copy constructor of the relevant class). + virtual wxObject *Clone() const wxOVERRIDE { return new wxGenericValidator(*this); } + bool Copy(const wxGenericValidator& val); + + // Called when the value in the window must be validated: this is not used + // by this class + virtual bool Validate(wxWindow * WXUNUSED(parent)) wxOVERRIDE { return true; } + + // Called to transfer data to the window + virtual bool TransferToWindow() wxOVERRIDE; + + // Called to transfer data to the window + virtual bool TransferFromWindow() wxOVERRIDE; + +protected: + void Initialize(); + + bool* m_pBool; + int* m_pInt; + wxString* m_pString; + wxArrayInt* m_pArrayInt; +#if wxUSE_DATETIME + wxDateTime* m_pDateTime; +#endif // wxUSE_DATETIME + wxFileName* m_pFileName; + float* m_pFloat; + double* m_pDouble; + +private: + wxDECLARE_CLASS(wxGenericValidator); + wxDECLARE_NO_ASSIGN_CLASS(wxGenericValidator); +}; + +#endif // wxUSE_VALIDATORS + +#endif // _WX_VALGENH__ diff --git a/lib/wxWidgets/include/wx/validate.h b/lib/wxWidgets/include/wx/validate.h new file mode 100644 index 0000000..d7fb54f --- /dev/null +++ b/lib/wxWidgets/include/wx/validate.h @@ -0,0 +1,117 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/validate.h +// Purpose: wxValidator class +// Author: Julian Smart +// Modified by: +// Created: 29/01/98 +// Copyright: (c) 1998 Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_VALIDATE_H_ +#define _WX_VALIDATE_H_ + +#include "wx/defs.h" + +#if wxUSE_VALIDATORS + +#include "wx/event.h" + +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxWindowBase; + +/* + A validator has up to three purposes: + + 1) To validate the data in the window that's associated + with the validator. + 2) To transfer data to and from the window. + 3) To filter input, using its role as a wxEvtHandler + to intercept e.g. OnChar. + + Note that wxValidator and derived classes use reference counting. +*/ + +class WXDLLIMPEXP_CORE wxValidator : public wxEvtHandler +{ +public: + wxValidator(); + wxValidator(const wxValidator& other) + : wxEvtHandler() + , m_validatorWindow(other.m_validatorWindow) + { + } + virtual ~wxValidator(); + + // Make a clone of this validator (or return NULL) - currently necessary + // if you're passing a reference to a validator. + // Another possibility is to always pass a pointer to a new validator + // (so the calling code can use a copy constructor of the relevant class). + virtual wxObject *Clone() const + { return NULL; } + bool Copy(const wxValidator& val) + { m_validatorWindow = val.m_validatorWindow; return true; } + + // Called when the value in the window must be validated. + // This function can pop up an error message. + virtual bool Validate(wxWindow *WXUNUSED(parent)) { return false; } + + // Called to transfer data to the window + virtual bool TransferToWindow() { return false; } + + // Called to transfer data from the window + virtual bool TransferFromWindow() { return false; } + + // Called when the validator is associated with a window, may be useful to + // override if it needs to somehow initialize the window. + virtual void SetWindow(wxWindow *win) { m_validatorWindow = win; } + + // accessors + wxWindow *GetWindow() const { return m_validatorWindow; } + + // validators beep by default if invalid key is pressed, this function + // allows to change this + static void SuppressBellOnError(bool suppress = true) + { ms_isSilent = suppress; } + + // test if beep is currently disabled + static bool IsSilent() { return ms_isSilent; } + + // this function is deprecated because it handled its parameter + // unnaturally: it disabled the bell when it was true, not false as could + // be expected; use SuppressBellOnError() instead +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED_INLINE(static + void SetBellOnError(bool doIt = true), + ms_isSilent = doIt; + ) +#endif + +protected: + wxWindow *m_validatorWindow; + +private: + static bool ms_isSilent; + + wxDECLARE_DYNAMIC_CLASS(wxValidator); + wxDECLARE_NO_ASSIGN_CLASS(wxValidator); +}; + +#define wxVALIDATOR_PARAM(val) val + +extern WXDLLIMPEXP_DATA_CORE(const wxValidator) wxDefaultValidator; + +#else // !wxUSE_VALIDATORS + // wxWidgets is compiled without support for wxValidator, but we still + // want to be able to pass wxDefaultValidator to the functions which take + // a wxValidator parameter to avoid using "#if wxUSE_VALIDATORS" + // everywhere + class wxValidator { }; + #define wxDefaultValidator wxValidator() + + // this macro allows to avoid warnings about unused parameters when + // wxUSE_VALIDATORS == 0 + #define wxVALIDATOR_PARAM(val) +#endif // wxUSE_VALIDATORS/!wxUSE_VALIDATORS + +#endif // _WX_VALIDATE_H_ diff --git a/lib/wxWidgets/include/wx/valnum.h b/lib/wxWidgets/include/wx/valnum.h new file mode 100644 index 0000000..95fd1a7 --- /dev/null +++ b/lib/wxWidgets/include/wx/valnum.h @@ -0,0 +1,541 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/valnum.h +// Purpose: Numeric validator classes. +// Author: Vadim Zeitlin based on the submission of Fulvio Senore +// Created: 2010-11-06 +// Copyright: (c) 2010 wxWidgets team +// (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_VALNUM_H_ +#define _WX_VALNUM_H_ + +#include "wx/defs.h" + +#if wxUSE_VALIDATORS + +#include "wx/textentry.h" +#include "wx/validate.h" + +// This header uses std::numeric_limits<>::min/max, but these symbols are, +// unfortunately, often defined as macros and the code here wouldn't compile in +// this case, so preventively undefine them to avoid this problem. +#undef min +#undef max + +#include <limits> + +// Bit masks used for numeric validator styles. +enum wxNumValidatorStyle +{ + wxNUM_VAL_DEFAULT = 0x0, + wxNUM_VAL_THOUSANDS_SEPARATOR = 0x1, + wxNUM_VAL_ZERO_AS_BLANK = 0x2, + wxNUM_VAL_NO_TRAILING_ZEROES = 0x4 +}; + +// ---------------------------------------------------------------------------- +// Base class for all numeric validators. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxNumValidatorBase : public wxValidator +{ +public: + // Change the validator style. Usually it's specified during construction. + void SetStyle(int style) { m_style = style; } + + + // Override base class method to not do anything but always return success: + // we don't need this as we do our validation on the fly here. + virtual bool Validate(wxWindow * WXUNUSED(parent)) wxOVERRIDE { return true; } + + // Override base class method to check that the window is a text control or + // combobox. + virtual void SetWindow(wxWindow *win) wxOVERRIDE; + +protected: + wxNumValidatorBase(int style) + { + m_style = style; + } + + wxNumValidatorBase(const wxNumValidatorBase& other) : wxValidator(other) + { + m_style = other.m_style; + } + + bool HasFlag(wxNumValidatorStyle style) const + { + return (m_style & style) != 0; + } + + // Get the text entry of the associated control. Normally shouldn't ever + // return NULL (and will assert if it does return it) but the caller should + // still test the return value for safety. + wxTextEntry *GetTextEntry() const; + + // Convert wxNUM_VAL_THOUSANDS_SEPARATOR and wxNUM_VAL_NO_TRAILING_ZEROES + // bits of our style to the corresponding wxNumberFormatter::Style values. + int GetFormatFlags() const; + + // Return the string which would result from inserting the given character + // at the specified position. + wxString GetValueAfterInsertingChar(wxString val, int pos, wxChar ch) const + { + val.insert(pos, ch); + return val; + } + + // Return true if this control allows negative numbers in it. + // + // If it doesn't, we don't allow entering "-" at all. + virtual bool CanBeNegative() const = 0; + +private: + // Check whether the specified character can be inserted in the control at + // the given position in the string representing the current controls + // contents. + // + // Notice that the base class checks for '-' itself so it's never passed to + // this function. + virtual bool IsCharOk(const wxString& val, int pos, wxChar ch) const = 0; + + // Return the canonical form of the number corresponding to the contents of + // the string: if the input string is invalid, return a string representing + // some valid value. + virtual wxString NormalizeString(const wxString& s) const = 0; + + + // Event handlers. + void OnChar(wxKeyEvent& event); + void OnKillFocus(wxFocusEvent& event); + + + // Determine the current insertion point and text in the associated control. + void GetCurrentValueAndInsertionPoint(wxString& val, int& pos) const; + + // Return true if pressing a '-' key is acceptable for the current control + // contents and insertion point. This is used by OnChar() to handle '-' and + // relies on CanBeNegative() implementation in the derived class. + bool IsMinusOk(const wxString& val, int pos) const; + + + // Combination of wxVAL_NUM_XXX values. + int m_style; + + + wxDECLARE_EVENT_TABLE(); + + wxDECLARE_NO_ASSIGN_CLASS(wxNumValidatorBase); +}; + +namespace wxPrivate +{ + +// This is a helper class used by wxIntegerValidator and wxFloatingPointValidator +// below that implements Transfer{To,From}Window() adapted to the type of the +// variable. +// +// The template argument B is the name of the base class which must derive from +// wxNumValidatorBase and define LongestValueType type and {To,As}String() +// methods i.e. basically be one of wx{Integer,Number}ValidatorBase classes. +// +// The template argument T is just the type handled by the validator that will +// inherit from this one. +template <class B, typename T> +class wxNumValidator : public B +{ +public: + typedef B BaseValidator; + typedef T ValueType; + + typedef typename BaseValidator::LongestValueType LongestValueType; + + wxCOMPILE_TIME_ASSERT + ( + sizeof(ValueType) <= sizeof(LongestValueType), + UnsupportedType + ); + + void SetMin(ValueType min) + { + m_min = min; + } + + ValueType GetMin() const + { + return m_min; + } + + void SetMax(ValueType max) + { + m_max = max; + } + + ValueType GetMax() const + { + return m_max; + } + + void SetRange(ValueType min, ValueType max) + { + SetMin(min); + SetMax(max); + } + + void GetRange(ValueType& min, ValueType& max) const + { + min = GetMin(); + max = GetMax(); + } + + virtual bool TransferToWindow() wxOVERRIDE + { + if ( m_value ) + { + wxTextEntry * const control = BaseValidator::GetTextEntry(); + if ( !control ) + return false; + + control->SetValue(NormalizeValue(static_cast<LongestValueType>(*m_value))); + } + + return true; + } + + virtual bool TransferFromWindow() wxOVERRIDE + { + if ( m_value ) + { + wxTextEntry * const control = BaseValidator::GetTextEntry(); + if ( !control ) + return false; + + const wxString s(control->GetValue()); + LongestValueType value; + if ( s.empty() && BaseValidator::HasFlag(wxNUM_VAL_ZERO_AS_BLANK) ) + value = 0; + else if ( !BaseValidator::FromString(s, &value) ) + return false; + + if ( !this->IsInRange(value) ) + return false; + + *m_value = static_cast<ValueType>(value); + } + + return true; + } + +protected: + wxNumValidator(ValueType *value, int style) + : BaseValidator(style), + m_value(value) + { + } + + // Implement wxNumValidatorBase virtual method which is the same for + // both integer and floating point numbers. + virtual wxString NormalizeString(const wxString& s) const wxOVERRIDE + { + LongestValueType value; + if ( !BaseValidator::FromString(s, &value) ) + { + // We don't have any valid number at all, just arbitrarily decide + // to return the minimum value. + value = static_cast<LongestValueType>(m_min); + } + else if ( !this->IsInRange(value) ) + { + // We do have a value, but it's out of range: clamp it to the + // closest limit. + if ( value > static_cast<LongestValueType>(m_max) ) + value = static_cast<LongestValueType>(m_max); + else + value = static_cast<LongestValueType>(m_min); + } + + return NormalizeValue(value); + } + + virtual bool CanBeNegative() const wxOVERRIDE { return m_min < 0; } + + + // This member is protected because it can be useful to the derived classes + // in their Transfer{From,To}Window() implementations. + ValueType * const m_value; + +private: + // Just a helper which is a common part of TransferToWindow() and + // NormalizeString(): returns string representation of a number honouring + // wxNUM_VAL_ZERO_AS_BLANK flag. + wxString NormalizeValue(LongestValueType value) const + { + // We really want to compare with the exact 0 here, so disable gcc + // warning about doing this. + wxGCC_WARNING_SUPPRESS(float-equal) + + wxString s; + if ( value != 0 || !BaseValidator::HasFlag(wxNUM_VAL_ZERO_AS_BLANK) ) + s = this->ToString(value); + + wxGCC_WARNING_RESTORE(float-equal) + + return s; + } + + // Minimal and maximal values accepted (inclusive). + ValueType m_min, m_max; + + wxDECLARE_NO_ASSIGN_CLASS(wxNumValidator); +}; + +} // namespace wxPrivate + +// ---------------------------------------------------------------------------- +// Validators for integer numbers. +// ---------------------------------------------------------------------------- + +// Base class for integer numbers validator. This class contains all non +// type-dependent code of wxIntegerValidator<> and always works with values of +// type LongestValueType. It is not meant to be used directly, please use +// wxIntegerValidator<> only instead. +class WXDLLIMPEXP_CORE wxIntegerValidatorBase : public wxNumValidatorBase +{ +protected: + // Define the type we use here, it should be the maximal-sized integer type + // we support to make it possible to base wxIntegerValidator<> for any type + // on it. +#ifdef wxLongLong_t + typedef wxLongLong_t LongestValueType; + typedef wxULongLong_t ULongestValueType; +#else + typedef long LongestValueType; + typedef unsigned long ULongestValueType; +#endif + + wxIntegerValidatorBase(int style) + : wxNumValidatorBase(style) + { + wxASSERT_MSG( !(style & wxNUM_VAL_NO_TRAILING_ZEROES), + "This style doesn't make sense for integers." ); + } + + // Default copy ctor is ok. + + // Provide methods for wxNumValidator use. + wxString ToString(LongestValueType value) const; + bool FromString(const wxString& s, LongestValueType *value) const; + + virtual bool IsInRange(LongestValueType value) const = 0; + + // Implement wxNumValidatorBase pure virtual method. + virtual bool IsCharOk(const wxString& val, int pos, wxChar ch) const wxOVERRIDE; + +private: + wxDECLARE_NO_ASSIGN_CLASS(wxIntegerValidatorBase); +}; + +// Validator for integer numbers. It can actually work with any integer type +// (short, int or long and long long if supported) and their unsigned versions +// as well. +template <typename T> +class wxIntegerValidator + : public wxPrivate::wxNumValidator<wxIntegerValidatorBase, T> +{ +public: + typedef T ValueType; + + typedef + wxPrivate::wxNumValidator<wxIntegerValidatorBase, T> Base; + typedef + wxIntegerValidatorBase::LongestValueType LongestValueType; + + // Ctor for an integer validator. + // + // Sets the range appropriately for the type, including setting 0 as the + // minimal value for the unsigned types. + wxIntegerValidator(ValueType *value = NULL, int style = wxNUM_VAL_DEFAULT) + : Base(value, style) + { + this->SetMin(std::numeric_limits<ValueType>::min()); + this->SetMax(std::numeric_limits<ValueType>::max()); + } + + // Ctor for an integer validator. + // + // Sets the range to the specified interval [min, max]. + wxIntegerValidator(ValueType *value, + ValueType min, + ValueType max, + int style = wxNUM_VAL_DEFAULT) + : Base(value, style) + { + this->SetMin(min); + this->SetMax(max); + } + + virtual wxObject *Clone() const wxOVERRIDE { return new wxIntegerValidator(*this); } + + virtual bool IsInRange(LongestValueType value) const wxOVERRIDE + { + // LongestValueType is used as a container for the values of any type + // which can be used in type-independent wxIntegerValidatorBase code, + // but we need to use the correct type for comparisons, notably for + // comparing unsigned values correctly, so cast to this type and check + // that we don't lose precision while doing it. + const ValueType valueT = static_cast<ValueType>(value); + if ( static_cast<LongestValueType>(valueT) != value ) + { + // The conversion wasn't lossless, so the value must not be exactly + // representable in this type and so is definitely not in range. + return false; + } + + return this->GetMin() <= valueT && valueT <= this->GetMax(); + } + +private: + wxDECLARE_NO_ASSIGN_CLASS(wxIntegerValidator); +}; + +// Helper function for creating integer validators which allows to avoid +// explicitly specifying the type as it deduces it from its parameter. +template <typename T> +inline wxIntegerValidator<T> +wxMakeIntegerValidator(T *value, int style = wxNUM_VAL_DEFAULT) +{ + return wxIntegerValidator<T>(value, style); +} + +// ---------------------------------------------------------------------------- +// Validators for floating point numbers. +// ---------------------------------------------------------------------------- + +// Similar to wxIntegerValidatorBase, this class is not meant to be used +// directly, only wxFloatingPointValidator<> should be used in the user code. +class WXDLLIMPEXP_CORE wxFloatingPointValidatorBase : public wxNumValidatorBase +{ +public: + // Set precision i.e. the number of digits shown (and accepted on input) + // after the decimal point. By default this is set to the maximal precision + // supported by the type handled by the validator. + void SetPrecision(unsigned precision) { m_precision = precision; } + + // Set multiplier applied for displaying the value, e.g. 100 if the value + // should be displayed in percents, so that the variable containing 0.5 + // would be displayed as 50. + void SetFactor(double factor) { m_factor = factor; } + +protected: + // Notice that we can't use "long double" here because it's not supported + // by wxNumberFormatter yet, so restrict ourselves to just double (and + // float). + typedef double LongestValueType; + + wxFloatingPointValidatorBase(int style) + : wxNumValidatorBase(style) + { + m_factor = 1.0; + } + + // Default copy ctor is ok. + + // Provide methods for wxNumValidator use. + wxString ToString(LongestValueType value) const; + bool FromString(const wxString& s, LongestValueType *value) const; + + virtual bool IsInRange(LongestValueType value) const = 0; + + // Implement wxNumValidatorBase pure virtual method. + virtual bool IsCharOk(const wxString& val, int pos, wxChar ch) const wxOVERRIDE; + +private: + // Maximum number of decimals digits after the decimal separator. + unsigned m_precision; + + // Factor applied for the displayed the value. + double m_factor; + + wxDECLARE_NO_ASSIGN_CLASS(wxFloatingPointValidatorBase); +}; + +// Validator for floating point numbers. It can be used with float, double or +// long double values. +template <typename T> +class wxFloatingPointValidator + : public wxPrivate::wxNumValidator<wxFloatingPointValidatorBase, T> +{ +public: + typedef T ValueType; + typedef wxPrivate::wxNumValidator<wxFloatingPointValidatorBase, T> Base; + typedef wxFloatingPointValidatorBase::LongestValueType LongestValueType; + + + // Ctor using implicit (maximal) precision for this type. + wxFloatingPointValidator(ValueType *value = NULL, + int style = wxNUM_VAL_DEFAULT) + : Base(value, style) + { + DoSetMinMax(); + + this->SetPrecision(std::numeric_limits<ValueType>::digits10); + } + + // Ctor specifying an explicit precision. + wxFloatingPointValidator(int precision, + ValueType *value = NULL, + int style = wxNUM_VAL_DEFAULT) + : Base(value, style) + { + DoSetMinMax(); + + this->SetPrecision(precision); + } + + virtual wxObject *Clone() const wxOVERRIDE + { + return new wxFloatingPointValidator(*this); + } + + virtual bool IsInRange(LongestValueType value) const wxOVERRIDE + { + const ValueType valueT = static_cast<ValueType>(value); + + return this->GetMin() <= valueT && valueT <= this->GetMax(); + } + +private: + void DoSetMinMax() + { + // NB: Do not use min(), it's not the smallest representable value for + // the floating point types but rather the smallest representable + // positive value. + this->SetMin(-std::numeric_limits<ValueType>::max()); + this->SetMax( std::numeric_limits<ValueType>::max()); + } +}; + +// Helper similar to wxMakeIntValidator(). +// +// NB: Unfortunately we can't just have a wxMakeNumericValidator() which would +// return either wxIntegerValidator<> or wxFloatingPointValidator<> so we +// do need two different functions. +template <typename T> +inline wxFloatingPointValidator<T> +wxMakeFloatingPointValidator(T *value, int style = wxNUM_VAL_DEFAULT) +{ + return wxFloatingPointValidator<T>(value, style); +} + +template <typename T> +inline wxFloatingPointValidator<T> +wxMakeFloatingPointValidator(int precision, T *value, int style = wxNUM_VAL_DEFAULT) +{ + return wxFloatingPointValidator<T>(precision, value, style); +} + +#endif // wxUSE_VALIDATORS + +#endif // _WX_VALNUM_H_ diff --git a/lib/wxWidgets/include/wx/valtext.h b/lib/wxWidgets/include/wx/valtext.h new file mode 100644 index 0000000..c0b8fd9 --- /dev/null +++ b/lib/wxWidgets/include/wx/valtext.h @@ -0,0 +1,168 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/valtext.h +// Purpose: wxTextValidator class +// Author: Julian Smart +// Modified by: Francesco Montorsi +// Created: 29/01/98 +// Copyright: (c) 1998 Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_VALTEXT_H_ +#define _WX_VALTEXT_H_ + +#include "wx/defs.h" + +#if wxUSE_VALIDATORS && (wxUSE_TEXTCTRL || wxUSE_COMBOBOX) + +class WXDLLIMPEXP_FWD_CORE wxTextEntry; + +#include "wx/validate.h" + +enum wxTextValidatorStyle +{ + wxFILTER_NONE = 0x0, + wxFILTER_EMPTY = 0x1, + wxFILTER_ASCII = 0x2, + wxFILTER_ALPHA = 0x4, + wxFILTER_ALPHANUMERIC = 0x8, + wxFILTER_DIGITS = 0x10, + wxFILTER_NUMERIC = 0x20, + wxFILTER_INCLUDE_LIST = 0x40, + wxFILTER_INCLUDE_CHAR_LIST = 0x80, + wxFILTER_EXCLUDE_LIST = 0x100, + wxFILTER_EXCLUDE_CHAR_LIST = 0x200, + wxFILTER_XDIGITS = 0x400, + wxFILTER_SPACE = 0x800, + + // filter char class (for internal use only) + wxFILTER_CC = wxFILTER_SPACE|wxFILTER_ASCII|wxFILTER_NUMERIC| + wxFILTER_ALPHANUMERIC|wxFILTER_ALPHA| + wxFILTER_DIGITS|wxFILTER_XDIGITS +}; + +// ---------------------------------------------------------------------------- +// wxTextValidator +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTextValidator: public wxValidator +{ +public: + wxTextValidator(long style = wxFILTER_NONE, wxString *val = NULL); + wxTextValidator(const wxTextValidator& val); + + virtual ~wxTextValidator(){} + + // Make a clone of this validator (or return NULL) - currently necessary + // if you're passing a reference to a validator. + // Another possibility is to always pass a pointer to a new validator + // (so the calling code can use a copy constructor of the relevant class). + virtual wxObject *Clone() const wxOVERRIDE { return new wxTextValidator(*this); } + bool Copy(const wxTextValidator& val); + + // Called when the value in the window must be validated. + // This function can pop up an error message. + virtual bool Validate(wxWindow *parent) wxOVERRIDE; + + // Called to transfer data to the window + virtual bool TransferToWindow() wxOVERRIDE; + + // Called to transfer data from the window + virtual bool TransferFromWindow() wxOVERRIDE; + + // Filter keystrokes + void OnChar(wxKeyEvent& event); + + // ACCESSORS + inline long GetStyle() const { return m_validatorStyle; } + void SetStyle(long style); + + wxTextEntry *GetTextEntry(); + + // strings & chars inclusions: + // --------------------------- + + void SetCharIncludes(const wxString& chars); + void AddCharIncludes(const wxString& chars); + + void SetIncludes(const wxArrayString& includes); + void AddInclude(const wxString& include); + + const wxArrayString& GetIncludes() const { return m_includes; } + wxString GetCharIncludes() const { return m_charIncludes; } + + // strings & chars exclusions: + // --------------------------- + + void SetCharExcludes(const wxString& chars); + void AddCharExcludes(const wxString& chars); + + void SetExcludes(const wxArrayString& excludes); + void AddExclude(const wxString& exclude); + + const wxArrayString& GetExcludes() const { return m_excludes; } + wxString GetCharExcludes() const { return m_charExcludes; } + + bool HasFlag(wxTextValidatorStyle style) const + { return (m_validatorStyle & style) != 0; } + + // implementation only + // -------------------- + + // returns the error message if the contents of 'str' are invalid + virtual wxString IsValid(const wxString& str) const; + +protected: + + bool IsCharIncluded(const wxUniChar& c) const + { + return m_charIncludes.find(c) != wxString::npos; + } + + bool IsCharExcluded(const wxUniChar& c) const + { + return m_charExcludes.find(c) != wxString::npos; + } + + bool IsIncluded(const wxString& str) const + { + if ( HasFlag(wxFILTER_INCLUDE_LIST) ) + return m_includes.Index(str) != wxNOT_FOUND; + + // m_includes should be ignored (i.e. return true) + // if the style is not set. + return true; + } + + bool IsExcluded(const wxString& str) const + { + return m_excludes.Index(str) != wxNOT_FOUND; + } + + // returns false if the character is invalid + bool IsValidChar(const wxUniChar& c) const; + + // These two functions (undocumented now) are kept for compatibility reasons. + bool ContainsOnlyIncludedCharacters(const wxString& val) const; + bool ContainsExcludedCharacters(const wxString& val) const; + +protected: + long m_validatorStyle; + wxString* m_stringValue; + wxString m_charIncludes; + wxString m_charExcludes; + wxArrayString m_includes; + wxArrayString m_excludes; + +private: + void OnPaste(wxClipboardTextEvent& event); + + wxDECLARE_NO_ASSIGN_CLASS(wxTextValidator); + wxDECLARE_DYNAMIC_CLASS(wxTextValidator); + wxDECLARE_EVENT_TABLE(); +}; + +#endif + // wxUSE_VALIDATORS && (wxUSE_TEXTCTRL || wxUSE_COMBOBOX) + +#endif // _WX_VALTEXT_H_ diff --git a/lib/wxWidgets/include/wx/variant.h b/lib/wxWidgets/include/wx/variant.h new file mode 100644 index 0000000..442dcd4 --- /dev/null +++ b/lib/wxWidgets/include/wx/variant.h @@ -0,0 +1,586 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/variant.h +// Purpose: wxVariant class, container for any type +// Author: Julian Smart +// Modified by: +// Created: 10/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_VARIANT_H_ +#define _WX_VARIANT_H_ + +#include "wx/defs.h" + +#if wxUSE_VARIANT + +#include "wx/object.h" +#include "wx/string.h" +#include "wx/arrstr.h" +#include "wx/list.h" +#include "wx/cpp.h" +#include "wx/longlong.h" + +#if wxUSE_DATETIME + #include "wx/datetime.h" +#endif // wxUSE_DATETIME + +#include "wx/iosfwrap.h" + +class wxAny; + +/* + * wxVariantData stores the actual data in a wxVariant object, + * to allow it to store any type of data. + * Derive from this to provide custom data handling. + * + * NB: When you construct a wxVariantData, it will have refcount + * of one. Refcount will not be further increased when + * it is passed to wxVariant. This simulates old common + * scenario where wxVariant took ownership of wxVariantData + * passed to it. + * If you create wxVariantData for other reasons than passing + * it to wxVariant, technically you are not required to call + * DecRef() before deleting it. + * + * TODO: in order to replace wxPropertyValue, we would need + * to consider adding constructors that take pointers to C++ variables, + * or removing that functionality from the wxProperty library. + * Essentially wxPropertyValue takes on some of the wxValidator functionality + * by storing pointers and not just actual values, allowing update of C++ data + * to be handled automatically. Perhaps there's another way of doing this without + * overloading wxVariant with unnecessary functionality. + */ + +class WXDLLIMPEXP_BASE wxVariantData : public wxObjectRefData +{ + friend class wxVariant; +public: + wxVariantData() { } + + // Override these to provide common functionality + virtual bool Eq(wxVariantData& data) const = 0; + +#if wxUSE_STD_IOSTREAM + virtual bool Write(wxSTD ostream& WXUNUSED(str)) const { return false; } +#endif + virtual bool Write(wxString& WXUNUSED(str)) const { return false; } +#if wxUSE_STD_IOSTREAM + virtual bool Read(wxSTD istream& WXUNUSED(str)) { return false; } +#endif + virtual bool Read(wxString& WXUNUSED(str)) { return false; } + // What type is it? Return a string name. + virtual wxString GetType() const = 0; + // If it based on wxObject return the ClassInfo. + virtual wxClassInfo* GetValueClassInfo() { return NULL; } + + // Implement this to make wxVariant::UnShare work. Returns + // a copy of the data. + virtual wxVariantData* Clone() const { return NULL; } + +#if wxUSE_ANY + // Converts value to wxAny, if possible. Return true if successful. + virtual bool GetAsAny(wxAny* WXUNUSED(any)) const { return false; } +#endif + +protected: + // Protected dtor should make some incompatible code + // break more louder. That is, they should do data->DecRef() + // instead of delete data. + virtual ~wxVariantData() { } +}; + +/* + * wxVariant can store any kind of data, but has some basic types + * built in. + */ + +class WXDLLIMPEXP_FWD_BASE wxVariant; + +WX_DECLARE_LIST_WITH_DECL(wxVariant, wxVariantList, class WXDLLIMPEXP_BASE); + +class WXDLLIMPEXP_BASE wxVariant: public wxObject +{ +public: + wxVariant(); + + wxVariant(const wxVariant& variant); + wxVariant(wxVariantData* data, const wxString& name = wxEmptyString); +#if wxUSE_ANY + wxVariant(const wxAny& any); +#endif + virtual ~wxVariant(); + + // generic assignment + void operator= (const wxVariant& variant); + + // Assignment using data, e.g. + // myVariant = new wxStringVariantData("hello"); + void operator= (wxVariantData* variantData); + + bool operator== (const wxVariant& variant) const; + bool operator!= (const wxVariant& variant) const; + + // Sets/gets name + inline void SetName(const wxString& name) { m_name = name; } + inline const wxString& GetName() const { return m_name; } + + // Tests whether there is data + bool IsNull() const; + + // For compatibility with wxWidgets <= 2.6, this doesn't increase + // reference count. + wxVariantData* GetData() const + { + return (wxVariantData*) m_refData; + } + void SetData(wxVariantData* data) ; + + // make a 'clone' of the object + void Ref(const wxVariant& clone) { wxObject::Ref(clone); } + + // ensure that the data is exclusive to this variant, and not shared + bool Unshare(); + + // Make NULL (i.e. delete the data) + void MakeNull(); + + // Delete data and name + void Clear(); + + // Returns a string representing the type of the variant, + // e.g. "string", "bool", "stringlist", "list", "double", "long" + wxString GetType() const; + + bool IsType(const wxString& type) const; + bool IsValueKindOf(const wxClassInfo* type) const; + + // write contents to a string (e.g. for debugging) + wxString MakeString() const; + +#if wxUSE_ANY + wxAny GetAny() const; +#endif + + // double + wxVariant(double val, const wxString& name = wxEmptyString); + bool operator== (double value) const; + bool operator!= (double value) const; + void operator= (double value) ; + inline operator double () const { return GetDouble(); } + inline double GetReal() const { return GetDouble(); } + double GetDouble() const; + + // long + wxVariant(long val, const wxString& name = wxEmptyString); + wxVariant(int val, const wxString& name = wxEmptyString); + wxVariant(short val, const wxString& name = wxEmptyString); + bool operator== (long value) const; + bool operator!= (long value) const; + void operator= (long value) ; + inline operator long () const { return GetLong(); } + inline long GetInteger() const { return GetLong(); } + long GetLong() const; + + // bool + wxVariant(bool val, const wxString& name = wxEmptyString); + bool operator== (bool value) const; + bool operator!= (bool value) const; + void operator= (bool value) ; + inline operator bool () const { return GetBool(); } + bool GetBool() const ; + + // wxDateTime +#if wxUSE_DATETIME + wxVariant(const wxDateTime& val, const wxString& name = wxEmptyString); + bool operator== (const wxDateTime& value) const; + bool operator!= (const wxDateTime& value) const; + void operator= (const wxDateTime& value) ; + inline operator wxDateTime () const { return GetDateTime(); } + wxDateTime GetDateTime() const; +#endif + + // wxString + wxVariant(const wxString& val, const wxString& name = wxEmptyString); + // these overloads are necessary to prevent the compiler from using bool + // version instead of wxString one: + wxVariant(const char* val, const wxString& name = wxEmptyString); + wxVariant(const wchar_t* val, const wxString& name = wxEmptyString); + wxVariant(const wxCStrData& val, const wxString& name = wxEmptyString); + wxVariant(const wxScopedCharBuffer& val, const wxString& name = wxEmptyString); + wxVariant(const wxScopedWCharBuffer& val, const wxString& name = wxEmptyString); + + bool operator== (const wxString& value) const; + bool operator!= (const wxString& value) const; + wxVariant& operator=(const wxString& value); + // these overloads are necessary to prevent the compiler from using bool + // version instead of wxString one: +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxVariant& operator=(const char* value) + { return *this = wxString(value); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + wxVariant& operator=(const wchar_t* value) + { return *this = wxString(value); } + wxVariant& operator=(const wxCStrData& value) + { return *this = value.AsString(); } + template<typename T> + wxVariant& operator=(const wxScopedCharTypeBuffer<T>& value) + { return *this = value.data(); } + + inline operator wxString () const { return MakeString(); } + wxString GetString() const; + +#if wxUSE_STD_STRING +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING + wxVariant(const std::string& val, const wxString& name = wxEmptyString); + bool operator==(const std::string& value) const + { return operator==(wxString(value)); } + bool operator!=(const std::string& value) const + { return operator!=(wxString(value)); } + wxVariant& operator=(const std::string& value) + { return operator=(wxString(value)); } + operator std::string() const { return (operator wxString()).ToStdString(); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + + wxVariant(const wxStdWideString& val, const wxString& name = wxEmptyString); + bool operator==(const wxStdWideString& value) const + { return operator==(wxString(value)); } + bool operator!=(const wxStdWideString& value) const + { return operator!=(wxString(value)); } + wxVariant& operator=(const wxStdWideString& value) + { return operator=(wxString(value)); } + operator wxStdWideString() const { return (operator wxString()).ToStdWstring(); } +#endif // wxUSE_STD_STRING + + // wxUniChar + wxVariant(const wxUniChar& val, const wxString& name = wxEmptyString); + wxVariant(const wxUniCharRef& val, const wxString& name = wxEmptyString); + wxVariant(char val, const wxString& name = wxEmptyString); + wxVariant(wchar_t val, const wxString& name = wxEmptyString); + bool operator==(const wxUniChar& value) const; + bool operator==(const wxUniCharRef& value) const { return *this == wxUniChar(value); } + bool operator==(char value) const { return *this == wxUniChar(value); } + bool operator==(wchar_t value) const { return *this == wxUniChar(value); } + bool operator!=(const wxUniChar& value) const { return !(*this == value); } + bool operator!=(const wxUniCharRef& value) const { return !(*this == value); } + bool operator!=(char value) const { return !(*this == value); } + bool operator!=(wchar_t value) const { return !(*this == value); } + wxVariant& operator=(const wxUniChar& value); + wxVariant& operator=(const wxUniCharRef& value) { return *this = wxUniChar(value); } + wxVariant& operator=(char value) { return *this = wxUniChar(value); } + wxVariant& operator=(wchar_t value) { return *this = wxUniChar(value); } + operator wxUniChar() const { return GetChar(); } + operator char() const { return GetChar(); } + operator wchar_t() const { return GetChar(); } + wxUniChar GetChar() const; + + // wxArrayString + wxVariant(const wxArrayString& val, const wxString& name = wxEmptyString); + bool operator== (const wxArrayString& value) const; + bool operator!= (const wxArrayString& value) const; + void operator= (const wxArrayString& value); + operator wxArrayString () const { return GetArrayString(); } + wxArrayString GetArrayString() const; + + // void* + wxVariant(void* ptr, const wxString& name = wxEmptyString); + bool operator== (void* value) const; + bool operator!= (void* value) const; + void operator= (void* value); + operator void* () const { return GetVoidPtr(); } + void* GetVoidPtr() const; + + // wxObject* + wxVariant(wxObject* ptr, const wxString& name = wxEmptyString); + bool operator== (wxObject* value) const; + bool operator!= (wxObject* value) const; + void operator= (wxObject* value); + wxObject* GetWxObjectPtr() const; + +#if wxUSE_LONGLONG + // wxLongLong + wxVariant(wxLongLong, const wxString& name = wxEmptyString); + bool operator==(wxLongLong value) const; + bool operator!=(wxLongLong value) const; + void operator=(wxLongLong value); + operator wxLongLong() const { return GetLongLong(); } + wxLongLong GetLongLong() const; + + // wxULongLong + wxVariant(wxULongLong, const wxString& name = wxEmptyString); + bool operator==(wxULongLong value) const; + bool operator!=(wxULongLong value) const; + void operator=(wxULongLong value); + operator wxULongLong() const { return GetULongLong(); } + wxULongLong GetULongLong() const; +#endif + + // ------------------------------ + // list operations + // ------------------------------ + + wxVariant(const wxVariantList& val, const wxString& name = wxEmptyString); // List of variants + bool operator== (const wxVariantList& value) const; + bool operator!= (const wxVariantList& value) const; + void operator= (const wxVariantList& value) ; + // Treat a list variant as an array + wxVariant operator[] (size_t idx) const; + wxVariant& operator[] (size_t idx) ; + wxVariantList& GetList() const ; + + // Return the number of elements in a list + size_t GetCount() const; + + // Make empty list + void NullList(); + + // Append to list + void Append(const wxVariant& value); + + // Insert at front of list + void Insert(const wxVariant& value); + + // Returns true if the variant is a member of the list + bool Member(const wxVariant& value) const; + + // Deletes the nth element of the list + bool Delete(size_t item); + + // Clear list + void ClearList(); + +public: + // Type conversion + bool Convert(long* value) const; + bool Convert(bool* value) const; + bool Convert(double* value) const; + bool Convert(wxString* value) const; + bool Convert(wxUniChar* value) const; + bool Convert(char* value) const; + bool Convert(wchar_t* value) const; +#if wxUSE_DATETIME + bool Convert(wxDateTime* value) const; +#endif // wxUSE_DATETIME +#if wxUSE_LONGLONG + bool Convert(wxLongLong* value) const; + bool Convert(wxULongLong* value) const; + #ifdef wxLongLong_t + bool Convert(wxLongLong_t* value) const + { + wxLongLong temp; + if ( !Convert(&temp) ) + return false; + *value = temp.GetValue(); + return true; + } + bool Convert(wxULongLong_t* value) const + { + wxULongLong temp; + if ( !Convert(&temp) ) + return false; + *value = temp.GetValue(); + return true; + } + #endif // wxLongLong_t +#endif // wxUSE_LONGLONG + +// Attributes +protected: + virtual wxObjectRefData *CreateRefData() const wxOVERRIDE; + virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const wxOVERRIDE; + + wxString m_name; + +private: + wxDECLARE_DYNAMIC_CLASS(wxVariant); +}; + + +// +// wxVariant <-> wxAny conversion code +// +#if wxUSE_ANY + +#include "wx/any.h" + +// In order to convert wxAny to wxVariant, we need to be able to associate +// wxAnyValueType with a wxVariantData factory function. +typedef wxVariantData* (*wxVariantDataFactory)(const wxAny& any); + +// Actual Any-to-Variant registration must be postponed to a time when all +// global variables have been initialized. Hence this arrangement. +// wxAnyToVariantRegistration instances are kept in global scope and +// wxAnyValueTypeGlobals in any.cpp will use their data when the time is +// right. +class WXDLLIMPEXP_BASE wxAnyToVariantRegistration +{ +public: + wxAnyToVariantRegistration(wxVariantDataFactory factory); + virtual ~wxAnyToVariantRegistration(); + + virtual wxAnyValueType* GetAssociatedType() = 0; + wxVariantDataFactory GetFactory() const { return m_factory; } +private: + wxVariantDataFactory m_factory; +}; + +template<typename T> +class wxAnyToVariantRegistrationImpl : public wxAnyToVariantRegistration +{ +public: + wxAnyToVariantRegistrationImpl(wxVariantDataFactory factory) + : wxAnyToVariantRegistration(factory) + { + } + + virtual wxAnyValueType* GetAssociatedType() wxOVERRIDE + { + return wxAnyValueTypeImpl<T>::GetInstance(); + } +private: +}; + +#define DECLARE_WXANY_CONVERSION() \ +virtual bool GetAsAny(wxAny* any) const wxOVERRIDE; \ +static wxVariantData* VariantDataFactory(const wxAny& any); + +#define _REGISTER_WXANY_CONVERSION(T, CLASSNAME, FUNC) \ +static wxAnyToVariantRegistrationImpl<T> \ + gs_##CLASSNAME##AnyToVariantRegistration = \ + wxAnyToVariantRegistrationImpl<T>(&FUNC); + +#define REGISTER_WXANY_CONVERSION(T, CLASSNAME) \ +_REGISTER_WXANY_CONVERSION(T, CLASSNAME, CLASSNAME::VariantDataFactory) + +#define IMPLEMENT_TRIVIAL_WXANY_CONVERSION(T, CLASSNAME) \ +bool CLASSNAME::GetAsAny(wxAny* any) const \ +{ \ + *any = m_value; \ + return true; \ +} \ +wxVariantData* CLASSNAME::VariantDataFactory(const wxAny& any) \ +{ \ + return new CLASSNAME(any.As<T>()); \ +} \ +REGISTER_WXANY_CONVERSION(T, CLASSNAME) + +#else // if !wxUSE_ANY + +#define DECLARE_WXANY_CONVERSION() +#define REGISTER_WXANY_CONVERSION(T, CLASSNAME) +#define IMPLEMENT_TRIVIAL_WXANY_CONVERSION(T, CLASSNAME) + +#endif // wxUSE_ANY/!wxUSE_ANY + + +#define DECLARE_VARIANT_OBJECT(classname) \ + DECLARE_VARIANT_OBJECT_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE) + +#define DECLARE_VARIANT_OBJECT_EXPORTED(classname,expdecl) \ +expdecl classname& operator << ( classname &object, const wxVariant &variant ); \ +expdecl wxVariant& operator << ( wxVariant &variant, const classname &object ); + +#define IMPLEMENT_VARIANT_OBJECT(classname) \ + IMPLEMENT_VARIANT_OBJECT_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE) + +#define IMPLEMENT_VARIANT_OBJECT_EXPORTED_NO_EQ(classname,expdecl) \ +class classname##VariantData: public wxVariantData \ +{ \ +public:\ + classname##VariantData() {} \ + classname##VariantData( const classname &value ) : m_value(value) { } \ +\ + classname &GetValue() { return m_value; } \ +\ + virtual bool Eq(wxVariantData& data) const wxOVERRIDE; \ +\ + virtual wxString GetType() const wxOVERRIDE; \ + virtual wxClassInfo* GetValueClassInfo() wxOVERRIDE; \ +\ + virtual wxVariantData* Clone() const wxOVERRIDE { return new classname##VariantData(m_value); } \ +\ + DECLARE_WXANY_CONVERSION() \ +protected:\ + classname m_value; \ +};\ +\ +wxString classname##VariantData::GetType() const\ +{\ + return m_value.GetClassInfo()->GetClassName();\ +}\ +\ +wxClassInfo* classname##VariantData::GetValueClassInfo()\ +{\ + return m_value.GetClassInfo();\ +}\ +\ +expdecl classname& operator << ( classname &value, const wxVariant &variant )\ +{\ + wxASSERT( variant.GetType() == #classname );\ + \ + classname##VariantData *data = (classname##VariantData*) variant.GetData();\ + value = data->GetValue();\ + return value;\ +}\ +\ +expdecl wxVariant& operator << ( wxVariant &variant, const classname &value )\ +{\ + classname##VariantData *data = new classname##VariantData( value );\ + variant.SetData( data );\ + return variant;\ +} \ +IMPLEMENT_TRIVIAL_WXANY_CONVERSION(classname, classname##VariantData) + +// implements a wxVariantData-derived class using for the Eq() method the +// operator== which must have been provided by "classname" +#define IMPLEMENT_VARIANT_OBJECT_EXPORTED(classname,expdecl) \ +IMPLEMENT_VARIANT_OBJECT_EXPORTED_NO_EQ(classname,wxEMPTY_PARAMETER_VALUE expdecl) \ +\ +bool classname##VariantData::Eq(wxVariantData& data) const \ +{\ + wxASSERT( GetType() == data.GetType() );\ +\ + classname##VariantData & otherData = (classname##VariantData &) data;\ +\ + return otherData.m_value == m_value;\ +}\ + + +// implements a wxVariantData-derived class using for the Eq() method a shallow +// comparison (through wxObject::IsSameAs function) +#define IMPLEMENT_VARIANT_OBJECT_SHALLOWCMP(classname) \ + IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(classname, wxEMPTY_PARAMETER_VALUE) +#define IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(classname,expdecl) \ +IMPLEMENT_VARIANT_OBJECT_EXPORTED_NO_EQ(classname,wxEMPTY_PARAMETER_VALUE expdecl) \ +\ +bool classname##VariantData::Eq(wxVariantData& data) const \ +{\ + wxASSERT( GetType() == data.GetType() );\ +\ + classname##VariantData & otherData = (classname##VariantData &) data;\ +\ + return (otherData.m_value.IsSameAs(m_value));\ +}\ + + +// Since we want type safety wxVariant we need to fetch and dynamic_cast +// in a seemingly safe way so the compiler can check, so we define +// a dynamic_cast /wxDynamicCast analogue. + +#define wxGetVariantCast(var,classname) \ + ((classname*)(var.IsValueKindOf(&classname::ms_classInfo) ?\ + var.GetWxObjectPtr() : NULL)); + +// Replacement for using wxDynamicCast on a wxVariantData object +#ifndef wxNO_RTTI + #define wxDynamicCastVariantData(data, classname) dynamic_cast<classname*>(data) +#endif + +#define wxStaticCastVariantData(data, classname) static_cast<classname*>(data) + +extern wxVariant WXDLLIMPEXP_BASE wxNullVariant; + +#endif // wxUSE_VARIANT + +#endif // _WX_VARIANT_H_ diff --git a/lib/wxWidgets/include/wx/variantbase.h b/lib/wxWidgets/include/wx/variantbase.h new file mode 100644 index 0000000..8335415 --- /dev/null +++ b/lib/wxWidgets/include/wx/variantbase.h @@ -0,0 +1,278 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/variantbase.h +// Purpose: wxVariantBase class, a minimal version of wxVariant used by XTI +// Author: Julian Smart +// Modified by: Francesco Montorsi +// Created: 10/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_VARIANTBASE_H_ +#define _WX_VARIANTBASE_H_ + +#include "wx/defs.h" + +#if wxUSE_VARIANT + +#include "wx/string.h" +#include "wx/arrstr.h" +#include "wx/cpp.h" +#include <typeinfo> + +#if wxUSE_DATETIME + #include "wx/datetime.h" +#endif // wxUSE_DATETIME + +#include "wx/iosfwrap.h" + +class wxTypeInfo; +class wxObject; +class wxClassInfo; + +/* + * wxVariantData stores the actual data in a wxVariant object, + * to allow it to store any type of data. + * Derive from this to provide custom data handling. + * + * NB: To prevent addition of extra vtbl pointer to wxVariantData, + * we don't multiple-inherit from wxObjectRefData. Instead, + * we simply replicate the wxObject ref-counting scheme. + * + * NB: When you construct a wxVariantData, it will have refcount + * of one. Refcount will not be further increased when + * it is passed to wxVariant. This simulates old common + * scenario where wxVariant took ownership of wxVariantData + * passed to it. + * If you create wxVariantData for other reasons than passing + * it to wxVariant, technically you are not required to call + * DecRef() before deleting it. + * + * TODO: in order to replace wxPropertyValue, we would need + * to consider adding constructors that take pointers to C++ variables, + * or removing that functionality from the wxProperty library. + * Essentially wxPropertyValue takes on some of the wxValidator functionality + * by storing pointers and not just actual values, allowing update of C++ data + * to be handled automatically. Perhaps there's another way of doing this without + * overloading wxVariant with unnecessary functionality. + */ + +class WXDLLIMPEXP_BASE wxVariantData +{ + friend class wxVariantBase; + +public: + wxVariantData() + : m_count(1) + { } + +#if wxUSE_STD_IOSTREAM + virtual bool Write(wxSTD ostream& WXUNUSED(str)) const { return false; } + virtual bool Read(wxSTD istream& WXUNUSED(str)) { return false; } +#endif + virtual bool Write(wxString& WXUNUSED(str)) const { return false; } + virtual bool Read(wxString& WXUNUSED(str)) { return false; } + + // Override these to provide common functionality + virtual bool Eq(wxVariantData& data) const = 0; + + // What type is it? Return a string name. + virtual wxString GetType() const = 0; + + // returns the type info of the content + virtual const wxTypeInfo* GetTypeInfo() const = 0; + + // If it based on wxObject return the ClassInfo. + virtual wxClassInfo* GetValueClassInfo() { return NULL; } + + int GetRefCount() const + { return m_count; } + void IncRef() + { m_count++; } + void DecRef() + { + if ( --m_count == 0 ) + delete this; + } + +protected: + // Protected dtor should make some incompatible code + // break more louder. That is, they should do data->DecRef() + // instead of delete data. + virtual ~wxVariantData() {} + +private: + int m_count; +}; + +template<typename T> class wxVariantDataT : public wxVariantData +{ +public: + wxVariantDataT(const T& d) : m_data(d) {} + virtual ~wxVariantDataT() {} + + // get a ref to the stored data + T & Get() { return m_data; } + + // get a const ref to the stored data + const T & Get() const { return m_data; } + + // set the data + void Set(const T& d) { m_data = d; } + + // Override these to provide common functionality + virtual bool Eq(wxVariantData& WXUNUSED(data)) const + { return false; /* FIXME!! */ } + + // What type is it? Return a string name. + virtual wxString GetType() const + { return GetTypeInfo()->GetTypeName(); } + + // return a heap allocated duplicate + //virtual wxVariantData* Clone() const { return new wxVariantDataT<T>( Get() ); } + + // returns the type info of the contentc + virtual const wxTypeInfo* GetTypeInfo() const { return wxGetTypeInfo( (T*) NULL ); } + +private: + T m_data; +}; + + +/* + * wxVariantBase can store any kind of data, but has some basic types + * built in. + */ + +class WXDLLIMPEXP_BASE wxVariantBase +{ +public: + wxVariantBase(); + wxVariantBase(const wxVariantBase& variant); + wxVariantBase(wxVariantData* data, const wxString& name = wxEmptyString); + + template<typename T> + wxVariantBase(const T& data, const wxString& name = wxEmptyString) : + m_data(new wxVariantDataT<T>(data)), m_name(name) {} + + virtual ~wxVariantBase(); + + // generic assignment + void operator= (const wxVariantBase& variant); + + // Assignment using data, e.g. + // myVariant = new wxStringVariantData("hello"); + void operator= (wxVariantData* variantData); + + bool operator== (const wxVariantBase& variant) const; + bool operator!= (const wxVariantBase& variant) const; + + // Sets/gets name + inline void SetName(const wxString& name) { m_name = name; } + inline const wxString& GetName() const { return m_name; } + + // Tests whether there is data + bool IsNull() const; + + // FIXME: used by wxVariantBase code but is nice wording... + bool IsEmpty() const { return IsNull(); } + + // For compatibility with wxWidgets <= 2.6, this doesn't increase + // reference count. + wxVariantData* GetData() const { return m_data; } + void SetData(wxVariantData* data) ; + + // make a 'clone' of the object + void Ref(const wxVariantBase& clone); + + // destroy a reference + void UnRef(); + + // Make NULL (i.e. delete the data) + void MakeNull(); + + // write contents to a string (e.g. for debugging) + wxString MakeString() const; + + // Delete data and name + void Clear(); + + // Returns a string representing the type of the variant, + // e.g. "string", "bool", "stringlist", "list", "double", "long" + wxString GetType() const; + + bool IsType(const wxString& type) const; + bool IsValueKindOf(const wxClassInfo* type) const; + + // FIXME wxXTI methods: + + // get the typeinfo of the stored object + const wxTypeInfo* GetTypeInfo() const + { + if (!m_data) + return NULL; + return m_data->GetTypeInfo(); + } + + // get a ref to the stored data + template<typename T> T& Get() + { + wxVariantDataT<T> *dataptr = + wx_dynamic_cast(wxVariantDataT<T>*, m_data); + wxASSERT_MSG( dataptr, + wxString::Format(wxT("Cast to %s not possible"), typeid(T).name()) ); + return dataptr->Get(); + } + + // get a const ref to the stored data + template<typename T> const T& Get() const + { + const wxVariantDataT<T> *dataptr = + wx_dynamic_cast(const wxVariantDataT<T>*, m_data); + wxASSERT_MSG( dataptr, + wxString::Format(wxT("Cast to %s not possible"), typeid(T).name()) ); + return dataptr->Get(); + } + + template<typename T> bool HasData() const + { + const wxVariantDataT<T> *dataptr = + wx_dynamic_cast(const wxVariantDataT<T>*, m_data); + return dataptr != NULL; + } + + // returns this value as string + wxString GetAsString() const; + + // gets the stored data casted to a wxObject*, + // returning NULL if cast is not possible + wxObject* GetAsObject(); + +protected: + wxVariantData* m_data; + wxString m_name; +}; + +#include "wx/dynarray.h" +WX_DECLARE_OBJARRAY_WITH_DECL(wxVariantBase, wxVariantBaseArray, class WXDLLIMPEXP_BASE); + + +// templated streaming, every type must have their specialization for these methods + +template<typename T> +void wxStringReadValue( const wxString &s, T &data ); + +template<typename T> +void wxStringWriteValue( wxString &s, const T &data); + +template<typename T> +void wxToStringConverter( const wxVariantBase &v, wxString &s ) \ + { wxStringWriteValue( s, v.Get<T>() ); } + +template<typename T> +void wxFromStringConverter( const wxString &s, wxVariantBase &v ) \ + { T d; wxStringReadValue( s, d ); v = wxVariantBase(d); } + + +#endif // wxUSE_VARIANT +#endif // _WX_VARIANTBASE_H_ diff --git a/lib/wxWidgets/include/wx/vector.h b/lib/wxWidgets/include/wx/vector.h new file mode 100644 index 0000000..fa3b358 --- /dev/null +++ b/lib/wxWidgets/include/wx/vector.h @@ -0,0 +1,749 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/vector.h +// Purpose: STL vector clone +// Author: Lindsay Mathieson +// Modified by: Vaclav Slavik - make it a template +// Created: 30.07.2001 +// Copyright: (c) 2001 Lindsay Mathieson <lindsay@mathieson.org>, +// 2007 Vaclav Slavik <vslavik@fastmail.fm> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_VECTOR_H_ +#define _WX_VECTOR_H_ + +#include "wx/defs.h" + +#if wxUSE_STD_CONTAINERS + +#include <vector> +#include <algorithm> + +#define wxVector std::vector +template<typename T> +inline void wxVectorSort(wxVector<T>& v) +{ + std::sort(v.begin(), v.end()); +} + +template<typename T> +inline bool wxVectorContains(const wxVector<T>& v, const T& obj) +{ + return std::find(v.begin(), v.end(), obj) != v.end(); +} + +#else // !wxUSE_STD_CONTAINERS + +#include "wx/scopeguard.h" +#include "wx/meta/movable.h" +#include "wx/meta/if.h" + +#include "wx/beforestd.h" +#if wxUSE_STD_CONTAINERS_COMPATIBLY +#include <iterator> +#endif +#include <new> // for placement new +#include "wx/afterstd.h" + +// wxQsort is declared in wx/utils.h, but can't include that file here, +// it indirectly includes this file. Just lovely... +// +// Moreover, just declaring it here unconditionally results in gcc +// -Wredundant-decls warning, so use a preprocessor guard to avoid this. +#ifndef wxQSORT_DECLARED + +#define wxQSORT_DECLARED + +typedef int (*wxSortCallback)(const void* pItem1, + const void* pItem2, + const void* user_data); +WXDLLIMPEXP_BASE void wxQsort(void* pbase, size_t total_elems, + size_t size, wxSortCallback cmp, + const void* user_data); + +#endif // !wxQSORT_DECLARED + +// Fix using placement new in case it was redefined by wx/msw/msvcrt.h. +#ifdef WXDEBUG_NEW + #undef new +#endif + +namespace wxPrivate +{ + +// These templates encapsulate memory operations for use by wxVector; there are +// two implementations, both in generic way for any C++ types and as an +// optimized version for "movable" types that uses realloc() and memmove(). + +// version for movable types: +template<typename T> +struct wxVectorMemOpsMovable +{ + static void Free(T* array) + { free(array); } + + static T* Realloc(T* old, size_t newCapacity, size_t WXUNUSED(occupiedSize)) + { return (T*)realloc(old, newCapacity * sizeof(T)); } + + static void MemmoveBackward(T* dest, T* source, size_t count) + { memmove(dest, source, count * sizeof(T)); } + + static void MemmoveForward(T* dest, T* source, size_t count) + { memmove(dest, source, count * sizeof(T)); } +}; + +// generic version for non-movable types: +template<typename T> +struct wxVectorMemOpsGeneric +{ + static void Free(T* array) + { ::operator delete(array); } + + static T* Realloc(T* old, size_t newCapacity, size_t occupiedSize) + { + T *mem = (T*)::operator new(newCapacity * sizeof(T)); + for ( size_t i = 0; i < occupiedSize; i++ ) + { + ::new(mem + i) T(old[i]); + old[i].~T(); + } + ::operator delete(old); + return mem; + } + + static void MemmoveBackward(T* dest, T* source, size_t count) + { + wxASSERT( dest < source ); + T* destptr = dest; + T* sourceptr = source; + for ( size_t i = count; i > 0; --i, ++destptr, ++sourceptr ) + { + ::new(destptr) T(*sourceptr); + sourceptr->~T(); + } + } + + static void MemmoveForward(T* dest, T* source, size_t count) + { + wxASSERT( dest > source ); + T* destptr = dest + count - 1; + T* sourceptr = source + count - 1; + for ( size_t i = count; i > 0; --i, --destptr, --sourceptr ) + { + ::new(destptr) T(*sourceptr); + sourceptr->~T(); + } + } +}; + +// We need to distinguish integers from iterators in assign() overloads and the +// simplest way to do it would be by using std::iterator_traits<>, however this +// might break existing code using custom iterator classes but not specializing +// iterator_traits<> for them, so we approach the problem from the other end +// and use our own traits that we specialize for all integer types. + +struct IsIntType {}; +struct IsNotIntType {}; + +template <typename T> struct IsInt : IsNotIntType {}; + +#define WX_DECLARE_TYPE_IS_INT(type) \ + template <> struct IsInt<type> : IsIntType {} + +WX_DECLARE_TYPE_IS_INT(unsigned char); +WX_DECLARE_TYPE_IS_INT(signed char); +WX_DECLARE_TYPE_IS_INT(unsigned short int); +WX_DECLARE_TYPE_IS_INT(signed short int); +WX_DECLARE_TYPE_IS_INT(unsigned int); +WX_DECLARE_TYPE_IS_INT(signed int); +WX_DECLARE_TYPE_IS_INT(unsigned long int); +WX_DECLARE_TYPE_IS_INT(signed long int); +#ifdef wxLongLong_t +WX_DECLARE_TYPE_IS_INT(wxLongLong_t); +WX_DECLARE_TYPE_IS_INT(wxULongLong_t); +#endif + +#undef WX_DECLARE_TYPE_IS_INT + +} // namespace wxPrivate + +template<typename T> +class wxVector +{ +private: + // This cryptic expression means "typedef Ops to wxVectorMemOpsMovable if + // type T is movable type, otherwise to wxVectorMemOpsGeneric". + // + + typedef typename wxIf< wxIsMovable<T>::value, + wxPrivate::wxVectorMemOpsMovable<T>, + wxPrivate::wxVectorMemOpsGeneric<T> >::value + Ops; + +public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type* iterator; + typedef const value_type* const_iterator; + typedef value_type& reference; + typedef const value_type& const_reference; + + class reverse_iterator + { + public: +#if wxUSE_STD_CONTAINERS_COMPATIBLY + typedef std::random_access_iterator_tag iterator_category; +#endif + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef value_type* pointer; + typedef value_type& reference; + + reverse_iterator() : m_ptr(NULL) { } + explicit reverse_iterator(iterator it) : m_ptr(it) { } + + reference operator*() const { return *m_ptr; } + pointer operator->() const { return m_ptr; } + + iterator base() const { return m_ptr + 1; } + + reverse_iterator& operator++() + { --m_ptr; return *this; } + reverse_iterator operator++(int) + { reverse_iterator tmp = *this; --m_ptr; return tmp; } + reverse_iterator& operator--() + { ++m_ptr; return *this; } + reverse_iterator operator--(int) + { reverse_iterator tmp = *this; ++m_ptr; return tmp; } + + reverse_iterator operator+(difference_type n) const + { return reverse_iterator(m_ptr - n); } + reverse_iterator& operator+=(difference_type n) + { m_ptr -= n; return *this; } + reverse_iterator operator-(difference_type n) const + { return reverse_iterator(m_ptr + n); } + reverse_iterator& operator-=(difference_type n) + { m_ptr += n; return *this; } + difference_type operator-(const reverse_iterator& it) const + { return it.m_ptr - m_ptr; } + + reference operator[](difference_type n) const + { return *(*this + n); } + + bool operator ==(const reverse_iterator& it) const + { return m_ptr == it.m_ptr; } + bool operator !=(const reverse_iterator& it) const + { return m_ptr != it.m_ptr; } + bool operator<(const reverse_iterator& it) const + { return m_ptr > it.m_ptr; } + bool operator>(const reverse_iterator& it) const + { return m_ptr < it.m_ptr; } + bool operator<=(const reverse_iterator& it) const + { return m_ptr >= it.m_ptr; } + bool operator>=(const reverse_iterator& it) const + { return m_ptr <= it.m_ptr; } + + private: + value_type *m_ptr; + + friend class const_reverse_iterator; + }; + + class const_reverse_iterator + { + public: +#if wxUSE_STD_CONTAINERS_COMPATIBLY + typedef std::random_access_iterator_tag iterator_category; +#endif + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef const value_type* pointer; + typedef const value_type& reference; + + const_reverse_iterator() : m_ptr(NULL) { } + explicit const_reverse_iterator(const_iterator it) : m_ptr(it) { } + const_reverse_iterator(const reverse_iterator& it) : m_ptr(it.m_ptr) { } + const_reverse_iterator(const const_reverse_iterator& it) : m_ptr(it.m_ptr) { } + + const_reference operator*() const { return *m_ptr; } + const_pointer operator->() const { return m_ptr; } + + const_iterator base() const { return m_ptr + 1; } + + const_reverse_iterator& operator++() + { --m_ptr; return *this; } + const_reverse_iterator operator++(int) + { const_reverse_iterator tmp = *this; --m_ptr; return tmp; } + const_reverse_iterator& operator--() + { ++m_ptr; return *this; } + const_reverse_iterator operator--(int) + { const_reverse_iterator tmp = *this; ++m_ptr; return tmp; } + + const_reverse_iterator operator+(difference_type n) const + { return const_reverse_iterator(m_ptr - n); } + const_reverse_iterator& operator+=(difference_type n) + { m_ptr -= n; return *this; } + const_reverse_iterator operator-(difference_type n) const + { return const_reverse_iterator(m_ptr + n); } + const_reverse_iterator& operator-=(difference_type n) + { m_ptr += n; return *this; } + difference_type operator-(const const_reverse_iterator& it) const + { return it.m_ptr - m_ptr; } + + const_reference operator[](difference_type n) const + { return *(*this + n); } + + bool operator ==(const const_reverse_iterator& it) const + { return m_ptr == it.m_ptr; } + bool operator !=(const const_reverse_iterator& it) const + { return m_ptr != it.m_ptr; } + bool operator<(const const_reverse_iterator& it) const + { return m_ptr > it.m_ptr; } + bool operator>(const const_reverse_iterator& it) const + { return m_ptr < it.m_ptr; } + bool operator<=(const const_reverse_iterator& it) const + { return m_ptr >= it.m_ptr; } + bool operator>=(const const_reverse_iterator& it) const + { return m_ptr <= it.m_ptr; } + + protected: + const value_type *m_ptr; + }; + + wxVector() : m_size(0), m_capacity(0), m_values(NULL) {} + + wxVector(size_type p_size) + : m_size(0), m_capacity(0), m_values(NULL) + { + reserve(p_size); + for ( size_t n = 0; n < p_size; n++ ) + push_back(value_type()); + } + + wxVector(size_type p_size, const value_type& v) + : m_size(0), m_capacity(0), m_values(NULL) + { + reserve(p_size); + for ( size_t n = 0; n < p_size; n++ ) + push_back(v); + } + + wxVector(const wxVector& c) : m_size(0), m_capacity(0), m_values(NULL) + { + Copy(c); + } + + template <class InputIterator> + wxVector(InputIterator first, InputIterator last) + : m_size(0), m_capacity(0), m_values(NULL) + { + assign(first, last); + } + + ~wxVector() + { + clear(); + } + + void assign(size_type p_size, const value_type& v) + { + AssignFromValue(p_size, v); + } + + template <typename InputIterator> + void assign(InputIterator first, InputIterator last) + { + AssignDispatch(first, last, typename wxPrivate::IsInt<InputIterator>()); + } + + void swap(wxVector& v) + { + wxSwap(m_size, v.m_size); + wxSwap(m_capacity, v.m_capacity); + wxSwap(m_values, v.m_values); + } + + void clear() + { + // call destructors of stored objects: + for ( size_type i = 0; i < m_size; i++ ) + { + m_values[i].~T(); + } + + Ops::Free(m_values); + m_values = NULL; + m_size = + m_capacity = 0; + } + + void reserve(size_type n) + { + if ( n <= m_capacity ) + return; + + // increase the size twice, unless we're already too big or unless + // more is requested + // + // NB: casts to size_type are needed to suppress warnings about + // mixing enumeral and non-enumeral type in conditional expression + const size_type increment = m_size > ALLOC_INITIAL_SIZE + ? m_size + : (size_type)ALLOC_INITIAL_SIZE; + if ( m_capacity + increment > n ) + n = m_capacity + increment; + + m_values = Ops::Realloc(m_values, n, m_size); + m_capacity = n; + } + + void resize(size_type n) + { + if ( n < m_size ) + Shrink(n); + else if ( n > m_size ) + Extend(n, value_type()); + } + + void resize(size_type n, const value_type& v) + { + if ( n < m_size ) + Shrink(n); + else if ( n > m_size ) + Extend(n, v); + } + + size_type size() const + { + return m_size; + } + + size_type capacity() const + { + return m_capacity; + } + + void shrink_to_fit() + { + m_values = Ops::Realloc(m_values, m_size, m_size); + m_capacity = m_size; + } + + bool empty() const + { + return size() == 0; + } + + wxVector& operator=(const wxVector& vb) + { + if (this != &vb) + { + clear(); + Copy(vb); + } + return *this; + } + + bool operator==(const wxVector& vb) const + { + if ( vb.m_size != m_size ) + return false; + + for ( size_type i = 0; i < m_size; i++ ) + { + if ( vb.m_values[i] != m_values[i] ) + return false; + } + + return true; + } + + bool operator!=(const wxVector& vb) const + { + return !(*this == vb); + } + + void push_back(const value_type& v) + { + reserve(size() + 1); + + // use placement new to initialize new object in preallocated place in + // m_values and store 'v' in it: + void* const place = m_values + m_size; + ::new(place) value_type(v); + + // only increase m_size if the ctor didn't throw an exception; notice + // that if it _did_ throw, everything is OK, because we only increased + // vector's capacity so far and possibly written some data to + // uninitialized memory at the end of m_values + m_size++; + } + + void pop_back() + { + erase(end() - 1); + } + + const value_type& at(size_type idx) const + { + wxASSERT(idx < m_size); + return m_values[idx]; + } + + value_type& at(size_type idx) + { + wxASSERT(idx < m_size); + return m_values[idx]; + } + + const value_type& operator[](size_type idx) const { return at(idx); } + value_type& operator[](size_type idx) { return at(idx); } + const value_type& front() const { return at(0); } + value_type& front() { return at(0); } + const value_type& back() const { return at(size() - 1); } + value_type& back() { return at(size() - 1); } + + const_iterator begin() const { return m_values; } + iterator begin() { return m_values; } + const_iterator end() const { return m_values + size(); } + iterator end() { return m_values + size(); } + + reverse_iterator rbegin() { return reverse_iterator(end() - 1); } + reverse_iterator rend() { return reverse_iterator(begin() - 1); } + + const_reverse_iterator rbegin() const { return const_reverse_iterator(end() - 1); } + const_reverse_iterator rend() const { return const_reverse_iterator(begin() - 1); } + + iterator insert(iterator it, size_type count, const value_type& v) + { + // NB: this must be done before reserve(), because reserve() + // invalidates iterators! + const size_t idx = it - begin(); + const size_t after = end() - it; + + // Unfortunately gcc 12 still complains about use-after-free even + // though our code is correct because it actually optimizes it to be + // wrong, with -O2 or higher, by moving the assignment above below the + // call to reserve() below, so use this hack to avoid the warning with + // it by preventing it from rearranging the code. +#if wxCHECK_GCC_VERSION(12, 1) + __asm__ __volatile__("":::"memory"); +#endif + + reserve(size() + count); + + // the place where the new element is going to be inserted + value_type * const place = m_values + idx; + + // unless we're inserting at the end, move following elements out of + // the way: + if ( after > 0 ) + Ops::MemmoveForward(place + count, place, after); + + // if the ctor called below throws an exception, we need to move all + // the elements back to their original positions in m_values + wxScopeGuard moveBack = wxMakeGuard( + Ops::MemmoveBackward, place, place + count, after); + if ( !after ) + moveBack.Dismiss(); + + // use placement new to initialize new object in preallocated place in + // m_values and store 'v' in it: + for ( size_type i = 0; i < count; i++ ) + ::new(place + i) value_type(v); + + // now that we did successfully add the new element, increment the size + // and disable moving the items back + moveBack.Dismiss(); + m_size += count; + + return begin() + idx; + } + + iterator insert(iterator it, const value_type& v = value_type()) + { + return insert(it, 1, v); + } + + iterator erase(iterator it) + { + return erase(it, it + 1); + } + + iterator erase(iterator first, iterator last) + { + if ( first == last ) + return first; + wxASSERT( first < end() && last <= end() ); + + const size_type idx = first - begin(); + const size_type count = last - first; + const size_type after = end() - last; + + // erase elements by calling their destructors: + for ( iterator i = first; i < last; ++i ) + i->~T(); + + // once that's done, move following elements over to the freed space: + if ( after > 0 ) + { + Ops::MemmoveBackward(m_values + idx, m_values + idx + count, after); + } + + m_size -= count; + + return begin() + idx; + } + +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED( size_type erase(size_type n) ); +#endif // WXWIN_COMPATIBILITY_2_8 + +private: + static const size_type ALLOC_INITIAL_SIZE = 16; + + void Copy(const wxVector& vb) + { + reserve(vb.size()); + + for ( const_iterator i = vb.begin(); i != vb.end(); ++i ) + push_back(*i); + } + +private: + void Shrink(size_type n) + { + for ( size_type i = n; i < m_size; i++ ) + m_values[i].~T(); + m_size = n; + } + + void Extend(size_type n, const value_type& v) + { + reserve(n); + for ( size_type i = m_size; i < n; i++ ) + push_back(v); + } + + void AssignFromValue(size_type p_size, const value_type& v) + { + clear(); + reserve(p_size); + for ( size_t n = 0; n < p_size; n++ ) + push_back(v); + } + + template <typename InputIterator> + void AssignDispatch(InputIterator first, InputIterator last, + wxPrivate::IsIntType) + { + AssignFromValue(static_cast<size_type>(first), + static_cast<const value_type&>(last)); + } + + template <typename InputIterator> + void AssignDispatch(InputIterator first, InputIterator last, + wxPrivate::IsNotIntType) + { + clear(); + + // Notice that it would be nice to call reserve() here but we can't do + // it for arbitrary input iterators, we should have a dispatch on + // iterator type and call it if possible. + + for ( InputIterator it = first; it != last; ++it ) + push_back(*it); + } + + size_type m_size, + m_capacity; + value_type *m_values; +}; + +#if WXWIN_COMPATIBILITY_2_8 +template<typename T> +inline typename wxVector<T>::size_type wxVector<T>::erase(size_type n) +{ + erase(begin() + n); + return n; +} +#endif // WXWIN_COMPATIBILITY_2_8 + + + +namespace wxPrivate +{ + +// This is a helper for the wxVectorSort function, and should not be used +// directly in user's code. +template<typename T> +struct wxVectorComparator +{ + static int + Compare(const void* pitem1, const void* pitem2, const void* ) + { + const T& item1 = *reinterpret_cast<const T*>(pitem1); + const T& item2 = *reinterpret_cast<const T*>(pitem2); + + if (item1 < item2) + return -1; + else if (item2 < item1) + return 1; + else + return 0; + } +}; + +} // namespace wxPrivate + + + +template<typename T> +void wxVectorSort(wxVector<T>& v) +{ + wxQsort(v.begin(), v.size(), sizeof(T), + wxPrivate::wxVectorComparator<T>::Compare, NULL); +} + +template<typename T> +inline bool wxVectorContains(const wxVector<T>& v, const T& obj) +{ + for ( size_t n = 0; n < v.size(); ++n ) + { + if ( v[n] == obj ) + return true; + } + + return false; +} + +// Redefine if it we undefined it above. +#ifdef WXDEBUG_NEW + #define new WXDEBUG_NEW +#endif + +#endif // wxUSE_STD_CONTAINERS/!wxUSE_STD_CONTAINERS + +// Define vector::shrink_to_fit() equivalent which can be always used, even +// when using pre-C++11 std::vector. +template<typename T> +inline void wxShrinkToFit(wxVector<T>& v) +{ +#if !wxUSE_STD_CONTAINERS || __cplusplus >= 201103L || wxCHECK_VISUALC_VERSION(10) + v.shrink_to_fit(); +#else + wxVector<T> tmp(v); + v.swap(tmp); +#endif +} + +#if WXWIN_COMPATIBILITY_2_8 + #define WX_DECLARE_VECTORBASE(obj, cls) typedef wxVector<obj> cls + #define _WX_DECLARE_VECTOR(obj, cls, exp) WX_DECLARE_VECTORBASE(obj, cls) + #define WX_DECLARE_VECTOR(obj, cls) WX_DECLARE_VECTORBASE(obj, cls) +#endif // WXWIN_COMPATIBILITY_2_8 + +#endif // _WX_VECTOR_H_ diff --git a/lib/wxWidgets/include/wx/version.h b/lib/wxWidgets/include/wx/version.h new file mode 100644 index 0000000..4205cef --- /dev/null +++ b/lib/wxWidgets/include/wx/version.h @@ -0,0 +1,90 @@ +/* + * Name: wx/version.h + * Purpose: wxWidgets version numbers + * Author: Julian Smart + * Modified by: Ryan Norton (Converted to C) + * Created: 29/01/98 + * Copyright: (c) 1998 Julian Smart + * Licence: wxWindows licence + */ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#ifndef _WX_VERSION_H_ +#define _WX_VERSION_H_ + +#include "wx/cpp.h" /* for wxSTRINGIZE */ + +/* the constants below must be changed with each new version */ +/* ---------------------------------------------------------------------------- */ + +/* + Don't forget to update WX_CURRENT, WX_REVISION and WX_AGE in + build/bakefiles/version.bkl and regenerate the makefiles when you change + this! + */ + +/* NB: this file is parsed by automatic tools so don't change its format! */ +#define wxMAJOR_VERSION 3 +#define wxMINOR_VERSION 2 +#define wxRELEASE_NUMBER 5 +#define wxSUBRELEASE_NUMBER 0 +#define wxVERSION_STRING wxT("wxWidgets 3.2.5") + +/* nothing to update below this line when updating the version */ +/* ---------------------------------------------------------------------------- */ + +/* Users can pre-define wxABI_VERSION to a lower value in their + * makefile/project settings to compile code that will be binary compatible + * with earlier versions of the ABI within the same minor version (between + * minor versions binary compatibility breaks anyway). The default is the + * version of wxWidgets being used. A single number with two decimal digits + * for each component, e.g. 20601 for 2.6.1 */ +#ifndef wxABI_VERSION +#define wxABI_VERSION ( wxMAJOR_VERSION * 10000 + wxMINOR_VERSION * 100 + 99 ) +#endif + +/* helpers for wxVERSION_NUM_XXX */ +#define wxMAKE_VERSION_STRING(x, y, z) \ + wxSTRINGIZE(x) wxSTRINGIZE(y) wxSTRINGIZE(z) +#define wxMAKE_VERSION_DOT_STRING(x, y, z) \ + wxSTRINGIZE(x) "." wxSTRINGIZE(y) "." wxSTRINGIZE(z) + +#define wxMAKE_VERSION_STRING_T(x, y, z) \ + wxSTRINGIZE_T(x) wxSTRINGIZE_T(y) wxSTRINGIZE_T(z) +#define wxMAKE_VERSION_DOT_STRING_T(x, y, z) \ + wxSTRINGIZE_T(x) wxT(".") wxSTRINGIZE_T(y) wxT(".") wxSTRINGIZE_T(z) + +/* these are used by src/msw/version.rc and should always be ASCII, not Unicode */ +#define wxVERSION_NUM_STRING \ + wxMAKE_VERSION_STRING(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) +#define wxVERSION_NUM_DOT_STRING \ + wxMAKE_VERSION_DOT_STRING(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) + +/* those are Unicode-friendly */ +#define wxVERSION_NUM_STRING_T \ + wxMAKE_VERSION_STRING_T(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) +#define wxVERSION_NUM_DOT_STRING_T \ + wxMAKE_VERSION_DOT_STRING_T(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) + +/* some more defines, not really sure if they're [still] useful */ +#define wxVERSION_NUMBER ( (wxMAJOR_VERSION * 1000) + (wxMINOR_VERSION * 100) + wxRELEASE_NUMBER ) +#define wxBETA_NUMBER 0 +#define wxVERSION_FLOAT ( wxMAJOR_VERSION + (wxMINOR_VERSION/10.0) + (wxRELEASE_NUMBER/100.0) + (wxBETA_NUMBER/10000.0) ) + +/* check if the current version is at least major.minor.release */ +#define wxCHECK_VERSION(major,minor,release) \ + (wxMAJOR_VERSION > (major) || \ + (wxMAJOR_VERSION == (major) && wxMINOR_VERSION > (minor)) || \ + (wxMAJOR_VERSION == (major) && wxMINOR_VERSION == (minor) && wxRELEASE_NUMBER >= (release))) + +/* the same but check the subrelease also */ +#define wxCHECK_VERSION_FULL(major,minor,release,subrel) \ + (wxCHECK_VERSION(major, minor, release) && \ + ((major) != wxMAJOR_VERSION || \ + (minor) != wxMINOR_VERSION || \ + (release) != wxRELEASE_NUMBER || \ + (subrel) <= wxSUBRELEASE_NUMBER)) + +#endif /* _WX_VERSION_H_ */ + diff --git a/lib/wxWidgets/include/wx/versioninfo.h b/lib/wxWidgets/include/wx/versioninfo.h new file mode 100644 index 0000000..436fcbb --- /dev/null +++ b/lib/wxWidgets/include/wx/versioninfo.h @@ -0,0 +1,103 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/versioninfo.h +// Purpose: declaration of wxVersionInfo class +// Author: Troels K +// Created: 2010-11-22 +// Copyright: (c) 2010 wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_VERSIONINFO_H_ +#define _WX_VERSIONINFO_H_ + +#include "wx/string.h" + +// ---------------------------------------------------------------------------- +// wxVersionInfo: represents version information +// ---------------------------------------------------------------------------- + +class wxVersionInfo +{ +public: + wxVersionInfo(const wxString& name = wxString(), + int major = 0, + int minor = 0, + int micro = 0, + int revision = 0, + const wxString& description = wxString(), + const wxString& copyright = wxString()) + { + Init(name, major, minor, micro, revision, description, copyright); + } + + // This constructor exists for backward compatibility (before the revision + // part was added). + wxVersionInfo(const wxString& name, + int major, int minor, int micro, + const wxString& description, + const wxString& copyright = wxString()) + { + Init(name, major, minor, micro, 0, description, copyright); + } + + // Default copy ctor, assignment operator and dtor are ok. + + + const wxString& GetName() const { return m_name; } + + int GetMajor() const { return m_major; } + int GetMinor() const { return m_minor; } + int GetMicro() const { return m_micro; } + int GetRevision() const { return m_revision; } + + wxString ToString() const + { + return HasDescription() ? GetDescription() : GetVersionString(); + } + + wxString GetVersionString() const + { + wxString str; + str << m_name << ' ' << GetMajor() << '.' << GetMinor(); + if ( GetMicro() || GetRevision() ) + { + str << '.' << GetMicro(); + if ( GetRevision() ) + str << '.' << GetRevision(); + } + + return str; + } + + bool HasDescription() const { return !m_description.empty(); } + const wxString& GetDescription() const { return m_description; } + + bool HasCopyright() const { return !m_copyright.empty(); } + const wxString& GetCopyright() const { return m_copyright; } + +private: + void Init(const wxString& name, + int major, int minor, int micro, int revision, + const wxString& description, + const wxString& copyright) + { + m_name = name; + m_description = description; + m_copyright = copyright; + m_major = major; + m_minor = minor; + m_micro = micro; + m_revision = revision; + } + + wxString m_name, + m_description, + m_copyright; + + int m_major, + m_minor, + m_micro, + m_revision; +}; + +#endif // _WX_VERSIONINFO_H_ diff --git a/lib/wxWidgets/include/wx/vidmode.h b/lib/wxWidgets/include/wx/vidmode.h new file mode 100644 index 0000000..550bb3b --- /dev/null +++ b/lib/wxWidgets/include/wx/vidmode.h @@ -0,0 +1,73 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/vidmode.h +// Purpose: declares wxVideoMode class used by both wxDisplay and wxApp +// Author: Vadim Zeitlin +// Modified by: +// Created: 27.09.2003 (extracted from wx/display.h) +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_VMODE_H_ +#define _WX_VMODE_H_ + +// ---------------------------------------------------------------------------- +// wxVideoMode: a simple struct containing video mode parameters for a display +// ---------------------------------------------------------------------------- + +struct WXDLLIMPEXP_CORE wxVideoMode +{ + wxVideoMode(int width = 0, int height = 0, int depth = 0, int freq = 0) + { + w = width; + h = height; + + bpp = depth; + + refresh = freq; + } + + // default copy ctor and assignment operator are ok + + bool operator==(const wxVideoMode& m) const + { + return w == m.w && h == m.h && bpp == m.bpp && refresh == m.refresh; + } + bool operator!=(const wxVideoMode& mode) const + { + return !operator==(mode); + } + + // returns true if this mode matches the other one in the sense that all + // non zero fields of the other mode have the same value in this one + // (except for refresh which is allowed to have a greater value) + bool Matches(const wxVideoMode& other) const + { + return (!other.w || w == other.w) && + (!other.h || h == other.h) && + (!other.bpp || bpp == other.bpp) && + (!other.refresh || refresh >= other.refresh); + } + + // trivial accessors + int GetWidth() const { return w; } + int GetHeight() const { return h; } + int GetDepth() const { return bpp; } + int GetRefresh() const { return refresh; } + + // returns true if the object has been initialized + bool IsOk() const { return w && h; } + + + // the screen size in pixels (e.g. 640*480), 0 means unspecified + int w, h; + + // bits per pixel (e.g. 32), 1 is monochrome and 0 means unspecified/known + int bpp; + + // refresh frequency in Hz, 0 means unspecified/unknown + int refresh; +}; + +#endif // _WX_VMODE_H_ + diff --git a/lib/wxWidgets/include/wx/vlbox.h b/lib/wxWidgets/include/wx/vlbox.h new file mode 100644 index 0000000..b7b149e --- /dev/null +++ b/lib/wxWidgets/include/wx/vlbox.h @@ -0,0 +1,312 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/vlbox.h +// Purpose: wxVListBox is a virtual listbox with lines of variable height +// Author: Vadim Zeitlin +// Modified by: +// Created: 31.05.03 +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_VLBOX_H_ +#define _WX_VLBOX_H_ + +#include "wx/vscroll.h" // base class +#include "wx/bitmap.h" + +class WXDLLIMPEXP_FWD_CORE wxSelectionStore; + +extern WXDLLIMPEXP_DATA_CORE(const char) wxVListBoxNameStr[]; + +// ---------------------------------------------------------------------------- +// wxVListBox +// ---------------------------------------------------------------------------- + +/* + This class has two main differences from a regular listbox: it can have an + arbitrarily huge number of items because it doesn't store them itself but + uses OnDrawItem() callback to draw them and its items can have variable + height as determined by OnMeasureItem(). + + It emits the same events as wxListBox and the same event macros may be used + with it. + */ +class WXDLLIMPEXP_CORE wxVListBox : public wxVScrolledWindow +{ +public: + // constructors and such + // --------------------- + + // default constructor, you must call Create() later + wxVListBox() { Init(); } + + // normal constructor which calls Create() internally + wxVListBox(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxVListBoxNameStr)) + { + Init(); + + (void)Create(parent, id, pos, size, style, name); + } + + // really creates the control and sets the initial number of items in it + // (which may be changed later with SetItemCount()) + // + // the only special style which may be specified here is wxLB_MULTIPLE + // + // returns true on success or false if the control couldn't be created + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxVListBoxNameStr)); + + // dtor does some internal cleanup (deletes m_selStore if any) + virtual ~wxVListBox(); + + + // accessors + // --------- + + // get the number of items in the control + size_t GetItemCount() const { return GetRowCount(); } + + // does this control use multiple selection? + bool HasMultipleSelection() const { return m_selStore != NULL; } + + // get the currently selected item or wxNOT_FOUND if there is no selection + // + // this method is only valid for the single selection listboxes + int GetSelection() const + { + wxASSERT_MSG( !HasMultipleSelection(), + wxT("GetSelection() can't be used with wxLB_MULTIPLE") ); + + return m_current; + } + + // is this item the current one? + bool IsCurrent(size_t item) const { return item == (size_t)m_current; } + #ifdef __WXUNIVERSAL__ + bool IsCurrent() const { return wxVScrolledWindow::IsCurrent(); } + #endif + + // is this item selected? + bool IsSelected(size_t item) const; + + // get the number of the selected items (maybe 0) + // + // this method is valid for both single and multi selection listboxes + size_t GetSelectedCount() const; + + // get the first selected item, returns wxNOT_FOUND if none + // + // cookie is an opaque parameter which should be passed to + // GetNextSelected() later + // + // this method is only valid for the multi selection listboxes + int GetFirstSelected(unsigned long& cookie) const; + + // get next selection item, return wxNOT_FOUND if no more + // + // cookie must be the same parameter that was passed to GetFirstSelected() + // before + // + // this method is only valid for the multi selection listboxes + int GetNextSelected(unsigned long& cookie) const; + + // get the margins around each item + wxPoint GetMargins() const { return m_ptMargins; } + + // get the background colour of selected cells + const wxColour& GetSelectionBackground() const { return m_colBgSel; } + + // get the item rect, returns empty rect if the item is not visible + wxRect GetItemRect(size_t n) const; + + // operations + // ---------- + + // set the number of items to be shown in the control + // + // this is just a synonym for wxVScrolledWindow::SetRowCount() + virtual void SetItemCount(size_t count); + + // delete all items from the control + void Clear() { SetItemCount(0); } + + // set the selection to the specified item, if it is wxNOT_FOUND the + // selection is unset + // + // this function is only valid for the single selection listboxes + void SetSelection(int selection); + + // selects or deselects the specified item which must be valid (i.e. not + // equal to wxNOT_FOUND) + // + // return true if the items selection status has changed or false + // otherwise + // + // this function is only valid for the multiple selection listboxes + bool Select(size_t item, bool select = true); + + // selects the items in the specified range whose end points may be given + // in any order + // + // return true if any items selection status has changed, false otherwise + // + // this function is only valid for the single selection listboxes + bool SelectRange(size_t from, size_t to); + + // toggle the selection of the specified item (must be valid) + // + // this function is only valid for the multiple selection listboxes + void Toggle(size_t item) { Select(item, !IsSelected(item)); } + + // select all items in the listbox + // + // the return code indicates if any items were affected by this operation + // (true) or if nothing has changed (false) + bool SelectAll() { return DoSelectAll(true); } + + // unselect all items in the listbox + // + // the return code has the same meaning as for SelectAll() + bool DeselectAll() { return DoSelectAll(false); } + + // set the margins: horizontal margin is the distance between the window + // border and the item contents while vertical margin is half of the + // distance between items + // + // by default both margins are 0 + void SetMargins(const wxPoint& pt); + void SetMargins(wxCoord x, wxCoord y) { SetMargins(wxPoint(x, y)); } + + // change the background colour of the selected cells + void SetSelectionBackground(const wxColour& col); + + // refreshes only the selected items + void RefreshSelected(); + + + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + +protected: + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_THEME; } + + // the derived class must implement this function to actually draw the item + // with the given index on the provided DC + virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const = 0; + + // the derived class must implement this method to return the height of the + // specified item + virtual wxCoord OnMeasureItem(size_t n) const = 0; + + // this method may be used to draw separators between the lines; note that + // the rectangle may be modified, typically to deflate it a bit before + // passing to OnDrawItem() + // + // the base class version doesn't do anything + virtual void OnDrawSeparator(wxDC& dc, wxRect& rect, size_t n) const; + + // this method is used to draw the items background and, maybe, a border + // around it + // + // the base class version implements a reasonable default behaviour which + // consists in drawing the selected item with the standard background + // colour and drawing a border around the item if it is either selected or + // current + virtual void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const; + + // we implement OnGetRowHeight() in terms of OnMeasureItem() because this + // allows us to add borders to the items easily + // + // this function is not supposed to be overridden by the derived classes + virtual wxCoord OnGetRowHeight(size_t line) const wxOVERRIDE; + + + // event handlers + void OnPaint(wxPaintEvent& event); + void OnKeyDown(wxKeyEvent& event); + void OnLeftDown(wxMouseEvent& event); + void OnLeftDClick(wxMouseEvent& event); + void OnSetOrKillFocus(wxFocusEvent& event); + void OnSize(wxSizeEvent& event); + + // common part of all ctors + void Init(); + + // send the wxEVT_LISTBOX event + void SendSelectedEvent(); + virtual void InitEvent(wxCommandEvent& event, int n); + + // common implementation of SelectAll() and DeselectAll() + bool DoSelectAll(bool select); + + // change the current item (in single selection listbox it also implicitly + // changes the selection); current may be wxNOT_FOUND in which case there + // will be no current item any more + // + // return true if the current item changed, false otherwise + bool DoSetCurrent(int current); + + // flags for DoHandleItemClick + enum + { + ItemClick_Shift = 1, // item shift-clicked + ItemClick_Ctrl = 2, // ctrl + ItemClick_Kbd = 4 // item selected from keyboard + }; + + // common part of keyboard and mouse handling processing code + void DoHandleItemClick(int item, int flags); + + // paint the background of the given item using the provided colour if it's + // valid, otherwise just return false and do nothing (this is used by + // OnDrawBackground()) + bool DoDrawSolidBackground(const wxColour& col, + wxDC& dc, + const wxRect& rect, + size_t n) const; + +private: + // the current item or wxNOT_FOUND + // + // if m_selStore == NULL this is also the selected item, otherwise the + // selections are managed by m_selStore + int m_current; + + // the anchor of the selection for the multiselection listboxes: + // shift-clicking an item extends the selection from m_anchor to the item + // clicked, for example + // + // always wxNOT_FOUND for single selection listboxes + int m_anchor; + + // the object managing our selected items if not NULL + wxSelectionStore *m_selStore; + + // margins + wxPoint m_ptMargins; + + // the selection bg colour + wxColour m_colBgSel; + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxVListBox); + wxDECLARE_ABSTRACT_CLASS(wxVListBox); +}; + +#endif // _WX_VLBOX_H_ + diff --git a/lib/wxWidgets/include/wx/vms_x_fix.h b/lib/wxWidgets/include/wx/vms_x_fix.h new file mode 100644 index 0000000..8d34abd --- /dev/null +++ b/lib/wxWidgets/include/wx/vms_x_fix.h @@ -0,0 +1,1213 @@ +/*************************************************************************** + * * + * Author : Jouk Jansen (joukj@hrem.stm.tudelft.nl) * + * * + * Last revision : 7 October 2005 * + * * + * Repair definitions of Runtime library functions when compiling with * + * /name=(as_is) on OpenVMS * + * * + ***************************************************************************/ + +#ifndef VMS_X_FIX +#define VMS_X_FIX + +#define decw$_select DECW$_SELECT +#define DtSaverGetWindows DTSAVERGETWINDOWS +#define MrmFetchWidget MRMFETCHWIDGET +#define MrmInitialize MRMINITIALIZE +#define MrmOpenHierarchy MRMOPENHIERARCHY +#define MrmRegisterNames MRMREGISTERNAMES +#define XAddExtension XADDEXTENSION +#define XAddHosts XADDHOSTS +#define XAllocClassHint XALLOCCLASSHINT +#define XAllocColor XALLOCCOLOR +#define XAllocColorCells XALLOCCOLORCELLS +#define XAllocIconSize XALLOCICONSIZE +#define XAllocNamedColor XALLOCNAMEDCOLOR +#define XAllocSizeHints XALLOCSIZEHINTS +#define XAllocStandardColormap XALLOCSTANDARDCOLORMAP +#define XAllocWMHints XALLOCWMHINTS +#define XAllowEvents XALLOWEVENTS +#define XAutoRepeatOff XAUTOREPEATOFF +#define XAutoRepeatOn XAUTOREPEATON +#define XBaseFontNameListOfFontSet XBASEFONTNAMELISTOFFONTSET +#define XBell XBELL +#define XBitmapPad XBITMAPPAD +#define XBlackPixel XBLACKPIXEL +#define XBlackPixelOfScreen XBLACKPIXELOFSCREEN +#define XCellsOfScreen XCELLSOFSCREEN +#define XChangeActivePointerGrab XCHANGEACTIVEPOINTERGRAB +#define XChangeGC XCHANGEGC +#define XChangeKeyboardControl XCHANGEKEYBOARDCONTROL +#define XChangePointerControl XCHANGEPOINTERCONTROL +#define XChangeProperty XCHANGEPROPERTY +#define XChangeWindowAttributes XCHANGEWINDOWATTRIBUTES +#define XCheckIfEvent XCHECKIFEVENT +#define XCheckMaskEvent XCHECKMASKEVENT +#define XCheckTypedEvent XCHECKTYPEDEVENT +#define XCheckTypedWindowEvent XCHECKTYPEDWINDOWEVENT +#define XCheckWindowEvent XCHECKWINDOWEVENT +#define XClearArea XCLEARAREA +#define XClearWindow XCLEARWINDOW +#define XClipBox XCLIPBOX +#define XCloseDisplay XCLOSEDISPLAY +#define XCloseIM XCLOSEIM +#define XConfigureWindow XCONFIGUREWINDOW +#define XConvertSelection XCONVERTSELECTION +#define XCopyArea XCOPYAREA +#define XCopyColormapAndFree XCOPYCOLORMAPANDFREE +#define XCopyGC XCOPYGC +#define XCopyPlane XCOPYPLANE +#define XCreateBitmapFromData XCREATEBITMAPFROMDATA +#define XCreateColormap XCREATECOLORMAP +#define XCreateFontCursor XCREATEFONTCURSOR +#define XCreateFontSet XCREATEFONTSET +#define XCreateGC XCREATEGC +#define XCreateGlyphCursor XCREATEGLYPHCURSOR +#define XCreateIC XCREATEIC +#define XCreateImage XCREATEIMAGE +#define XCreatePixmap XCREATEPIXMAP +#define XCreatePixmapCursor XCREATEPIXMAPCURSOR +#define XCreatePixmapFromBitmapData XCREATEPIXMAPFROMBITMAPDATA +#define XCreateRegion XCREATEREGION +#define XCreateSimpleWindow XCREATESIMPLEWINDOW +#define XCreateWindow XCREATEWINDOW +#define XDefaultColormap XDEFAULTCOLORMAP +#define XDefaultColormapOfScreen XDEFAULTCOLORMAPOFSCREEN +#define XDefaultDepth XDEFAULTDEPTH +#define XDefaultDepthOfScreen XDEFAULTDEPTHOFSCREEN +#define XDefaultGC XDEFAULTGC +#define XDefaultRootWindow XDEFAULTROOTWINDOW +#define XDefaultScreen XDEFAULTSCREEN +#define XDefaultScreenOfDisplay XDEFAULTSCREENOFDISPLAY +#define XDefaultVisual XDEFAULTVISUAL +#define XDefaultVisualOfScreen XDEFAULTVISUALOFSCREEN +#define XDefineCursor XDEFINECURSOR +#define XDeleteContext XDELETECONTEXT +#define XDeleteProperty XDELETEPROPERTY +#define XDestroyIC XDESTROYIC +#define XDestroyRegion XDESTROYREGION +#define XDestroySubwindows XDESTROYSUBWINDOWS +#define XDestroyWindow XDESTROYWINDOW +#define XDisableAccessControl XDISABLEACCESSCONTROL +#define XDisplayCells XDISPLAYCELLS +#define XDisplayHeight XDISPLAYHEIGHT +#define XDisplayKeycodes XDISPLAYKEYCODES +#define XDisplayName XDISPLAYNAME +#define XDisplayOfIM XDISPLAYOFIM +#define XDisplayOfScreen XDISPLAYOFSCREEN +#define XDisplayString XDISPLAYSTRING +#define XDisplayWidth XDISPLAYWIDTH +#define XDoesBackingStore XDOESBACKINGSTORE +#define XDrawArc XDRAWARC +#define XDrawArcs XDRAWARCS +#define XDrawImageString XDRAWIMAGESTRING +#define XDrawImageString16 XDRAWIMAGESTRING16 +#define XDrawLine XDRAWLINE +#define XDrawLines XDRAWLINES +#define XDrawPoint XDRAWPOINT +#define XDrawPoints XDRAWPOINTS +#define XDrawRectangle XDRAWRECTANGLE +#define XDrawRectangles XDRAWRECTANGLES +#define XDrawSegments XDRAWSEGMENTS +#define XDrawString XDRAWSTRING +#define XDrawString16 XDRAWSTRING16 +#define XDrawText XDRAWTEXT +#define XDrawText16 XDRAWTEXT16 +#define XESetCloseDisplay XESETCLOSEDISPLAY +#define XEmptyRegion XEMPTYREGION +#define XEnableAccessControl XENABLEACCESSCONTROL +#define XEqualRegion XEQUALREGION +#define XEventsQueued XEVENTSQUEUED +#define XExtendedMaxRequestSize XEXTENDEDMAXREQUESTSIZE +#define XExtentsOfFontSet XEXTENTSOFFONTSET +#define XFetchBuffer XFETCHBUFFER +#define XFetchBytes XFETCHBYTES +#define XFetchName XFETCHNAME +#define XFillArc XFILLARC +#define XFillArcs XFILLARCS +#define XFillPolygon XFILLPOLYGON +#define XFillRectangle XFILLRECTANGLE +#define XFillRectangles XFILLRECTANGLES +#define XFilterEvent XFILTEREVENT +#define XFindContext XFINDCONTEXT +#define XFlush XFLUSH +#define XFontsOfFontSet XFONTSOFFONTSET +#define XForceScreenSaver XFORCESCREENSAVER +#define XFree XFREE +#define XFreeColormap XFREECOLORMAP +#define XFreeColors XFREECOLORS +#define XFreeCursor XFREECURSOR +#define XFreeDeviceList XFREEDEVICELIST +#define XFreeDeviceState XFREEDEVICESTATE +#define XFreeFont XFREEFONT +#define XFreeFontInfo XFREEFONTINFO +#define XFreeFontNames XFREEFONTNAMES +#define XFreeFontSet XFREEFONTSET +#define XFreeGC XFREEGC +#define XFreeModifiermap XFREEMODIFIERMAP +#define XFreePixmap XFREEPIXMAP +#define XFreeStringList XFREESTRINGLIST +#define XGContextFromGC XGCONTEXTFROMGC +#define XGeometry XGEOMETRY +#define XGetAtomName XGETATOMNAME +#define XGetCommand XGETCOMMAND +#define XGetDefault XGETDEFAULT +#define XGetErrorDatabaseText XGETERRORDATABASETEXT +#define XGetErrorText XGETERRORTEXT +#define XGetExtensionVersion XGETEXTENSIONVERSION +#define XGetFontProperty XGETFONTPROPERTY +#define XGetGCValues XGETGCVALUES +#define XGetGeometry XGETGEOMETRY +#define XGetICValues XGETICVALUES +#define XGetIMValues XGETIMVALUES +#define XGetIconName XGETICONNAME +#define XGetIconSizes XGETICONSIZES +#define XGetImage XGETIMAGE +#define XGetInputFocus XGETINPUTFOCUS +#define XGetKeyboardControl XGETKEYBOARDCONTROL +#define XGetKeyboardMapping XGETKEYBOARDMAPPING +#define XGetModifierMapping XGETMODIFIERMAPPING +#define XGetMotionEvents XGETMOTIONEVENTS +#define XGetNormalHints XGETNORMALHINTS +#define XGetPointerMapping XGETPOINTERMAPPING +#define XGetRGBColormaps XGETRGBCOLORMAPS +#define XGetScreenSaver XGETSCREENSAVER +#define XGetSelectionOwner XGETSELECTIONOWNER +#define XGetStandardColormap XGETSTANDARDCOLORMAP +#define XGetSubImage XGETSUBIMAGE +#define XGetTextProperty XGETTEXTPROPERTY +#define XGetVisualInfo XGETVISUALINFO +#define XGetWMColormapWindows XGETWMCOLORMAPWINDOWS +#define XGetWMHints XGETWMHINTS +#define XGetWMIconName XGETWMICONNAME +#define XGetWMName XGETWMNAME +#define XGetWMNormalHints XGETWMNORMALHINTS +#define XGetWindowAttributes XGETWINDOWATTRIBUTES +#define XGetWindowProperty XGETWINDOWPROPERTY +#define XGrabButton XGRABBUTTON +#define XGrabKeyboard XGRABKEYBOARD +#define XGrabPointer XGRABPOINTER +#define XGrabServer XGRABSERVER +#define XHeightMMOfScreen XHEIGHTMMOFSCREEN +#define XHeightOfScreen XHEIGHTOFSCREEN +#define XIconifyWindow XICONIFYWINDOW +#define XIfEvent XIFEVENT +#define XInitExtension XINITEXTENSION +#define XInitImage XINITIMAGE +#define XInstallColormap XINSTALLCOLORMAP +#define XInternAtom XINTERNATOM +#define XInternAtoms XINTERNATOMS +#define XIntersectRegion XINTERSECTREGION +#define XKeycodeToKeysym XKEYCODETOKEYSYM +#define XKeysymToKeycode XKEYSYMTOKEYCODE +#define XKeysymToString XKEYSYMTOSTRING +#define XKillClient XKILLCLIENT +#define XListDepths XLISTDEPTHS +#define XListFonts XLISTFONTS +#define XListFontsWithInfo XLISTFONTSWITHINFO +#define XListHosts XLISTHOSTS +#define XListInputDevices XLISTINPUTDEVICES +#define XListInstalledColormaps XLISTINSTALLEDCOLORMAPS +#define XListPixmapFormats XLISTPIXMAPFORMATS +#define XListProperties XLISTPROPERTIES +#define XLoadFont XLOADFONT +#define XLoadQueryFont XLOADQUERYFONT +#define XLookupColor XLOOKUPCOLOR +#define XLookupKeysym XLOOKUPKEYSYM +#define XLookupString XLOOKUPSTRING +#define XLowerWindow XLOWERWINDOW +#define XMapRaised XMAPRAISED +#define XMapSubwindows XMAPSUBWINDOWS +#define XMapWindow XMAPWINDOW +#define XMatchVisualInfo XMATCHVISUALINFO +#define XMaxRequestSize XMAXREQUESTSIZE +#define XMissingExtension XMISSINGEXTENSION +#define XMoveResizeWindow XMOVERESIZEWINDOW +#define XMoveWindow XMOVEWINDOW +#define XNextEvent XNEXTEVENT +#define XNextRequest XNEXTREQUEST +#define XNoOp XNOOP +#define XOffsetRegion XOFFSETREGION +#define XOpenDevice XOPENDEVICE +#define XOpenDisplay XOPENDISPLAY +#define XOpenIM XOPENIM +#define XParseColor XPARSECOLOR +#define XParseGeometry XPARSEGEOMETRY +#define XPeekEvent XPEEKEVENT +#define XPeekIfEvent XPEEKIFEVENT +#define XPending XPENDING +#define XPointInRegion XPOINTINREGION +#define XPolygonRegion XPOLYGONREGION +#define XPutBackEvent XPUTBACKEVENT +#define XPutImage XPUTIMAGE +#define XQLength XQLENGTH +#define XQueryBestCursor XQUERYBESTCURSOR +#define XQueryBestStipple XQUERYBESTSTIPPLE +#define XQueryColor XQUERYCOLOR +#define XQueryColors XQUERYCOLORS +#define XQueryDeviceState XQUERYDEVICESTATE +#define XQueryExtension XQUERYEXTENSION +#define XQueryFont XQUERYFONT +#define XQueryKeymap XQUERYKEYMAP +#define XQueryPointer XQUERYPOINTER +#define XQueryTree XQUERYTREE +#define XRaiseWindow XRAISEWINDOW +#define XReadBitmapFile XREADBITMAPFILE +#define XRecolorCursor XRECOLORCURSOR +#define XReconfigureWMWindow XRECONFIGUREWMWINDOW +#define XRectInRegion XRECTINREGION +#define XRefreshKeyboardMapping XREFRESHKEYBOARDMAPPING +#define XRemoveHosts XREMOVEHOSTS +#define XReparentWindow XREPARENTWINDOW +#define XResetScreenSaver XRESETSCREENSAVER +#define XResizeWindow XRESIZEWINDOW +#define XResourceManagerString XRESOURCEMANAGERSTRING +#define XRestackWindows XRESTACKWINDOWS +#define XRotateBuffers XROTATEBUFFERS +#define XRootWindow XROOTWINDOW +#define XRootWindowOfScreen XROOTWINDOWOFSCREEN +#define XSaveContext XSAVECONTEXT +#define XScreenNumberOfScreen XSCREENNUMBEROFSCREEN +#define XScreenOfDisplay XSCREENOFDISPLAY +#define XSelectAsyncEvent XSELECTASYNCEVENT +#define XSelectAsyncInput XSELECTASYNCINPUT +#define XSelectExtensionEvent XSELECTEXTENSIONEVENT +#define XSelectInput XSELECTINPUT +#define XSendEvent XSENDEVENT +#define XServerVendor XSERVERVENDOR +#define XSetArcMode XSETARCMODE +#define XSetBackground XSETBACKGROUND +#define XSetClassHint XSETCLASSHINT +#define XSetClipMask XSETCLIPMASK +#define XSetClipOrigin XSETCLIPORIGIN +#define XSetClipRectangles XSETCLIPRECTANGLES +#define XSetCloseDownMode XSETCLOSEDOWNMODE +#define XSetCommand XSETCOMMAND +#define XSetDashes XSETDASHES +#define XSetErrorHandler XSETERRORHANDLER +#define XSetFillRule XSETFILLRULE +#define XSetFillStyle XSETFILLSTYLE +#define XSetFont XSETFONT +#define XSetForeground XSETFOREGROUND +#define XSetFunction XSETFUNCTION +#define XSetGraphicsExposures XSETGRAPHICSEXPOSURES +#define XSetICFocus XSETICFOCUS +#define XSetICValues XSETICVALUES +#define XSetIOErrorHandler XSETIOERRORHANDLER +#define XSetIconName XSETICONNAME +#define XSetInputFocus XSETINPUTFOCUS +#define XSetLineAttributes XSETLINEATTRIBUTES +#define XSetLocaleModifiers XSETLOCALEMODIFIERS +#define XSetNormalHints XSETNORMALHINTS +#define XSetPlaneMask XSETPLANEMASK +#define XSetRegion XSETREGION +#define XSetRGBColormaps XSETRGBCOLORMAPS +#define XSetScreenSaver XSETSCREENSAVER +#define XSetSelectionOwner XSETSELECTIONOWNER +#define XSetStandardProperties XSETSTANDARDPROPERTIES +#define XSetState XSETSTATE +#define XSetStipple XSETSTIPPLE +#define XSetSubwindowMode XSETSUBWINDOWMODE +#define XSetTSOrigin XSETTSORIGIN +#define XSetTextProperty XSETTEXTPROPERTY +#define XSetTile XSETTILE +#define XSetTransientForHint XSETTRANSIENTFORHINT +#define XSetWMClientMachine XSETWMCLIENTMACHINE +#define XSetWMColormapWindows XSETWMCOLORMAPWINDOWS +#define XSetWMHints XSETWMHINTS +#define XSetWMIconName XSETWMICONNAME +#define XSetWMName XSETWMNAME +#define XSetWMNormalHints XSETWMNORMALHINTS +#define XSetWMProperties XSETWMPROPERTIES +#define XSetWMProtocols XSETWMPROTOCOLS +#define XSetWMSizeHints XSETWMSIZEHINTS +#define XSetWindowBackground XSETWINDOWBACKGROUND +#define XSetWindowBackgroundPixmap XSETWINDOWBACKGROUNDPIXMAP +#define XSetWindowBorder XSETWINDOWBORDER +#define XSetWindowBorderPixmap XSETWINDOWBORDERPIXMAP +#define XSetWindowBorderWidth XSETWINDOWBORDERWIDTH +#define XSetWindowColormap XSETWINDOWCOLORMAP +#define XShapeCombineMask XSHAPECOMBINEMASK +#define XShapeCombineRectangles XSHAPECOMBINERECTANGLES +#define XShapeGetRectangles XSHAPEGETRECTANGLES +#define XShapeQueryExtension XSHAPEQUERYEXTENSION +#define XShmAttach XSHMATTACH +#define XShmCreateImage XSHMCREATEIMAGE +#define XShmCreatePixmap XSHMCREATEPIXMAP +#define XShmDetach XSHMDETACH +#define XShmGetEventBase XSHMGETEVENTBASE +#define XShmPutImage XSHMPUTIMAGE +#define XShmQueryExtension XSHMQUERYEXTENSION +#define XShmQueryVersion XSHMQUERYVERSION +#define XShrinkRegion XSHRINKREGION +#define XStoreBuffer XSTOREBUFFER +#define XStoreBytes XSTOREBYTES +#define XStoreColor XSTORECOLOR +#define XStoreColors XSTORECOLORS +#define XStoreName XSTORENAME +#define XStringListToTextProperty XSTRINGLISTTOTEXTPROPERTY +#define XStringToKeysym XSTRINGTOKEYSYM +#define XSubtractRegion XSUBTRACTREGION +#define XSupportsLocale XSUPPORTSLOCALE +#define XSync XSYNC +#define XSynchronize XSYNCHRONIZE +#define XTextExtents XTEXTEXTENTS +#define XTextExtents16 XTEXTEXTENTS16 +#define XTextPropertyToStringList XTEXTPROPERTYTOSTRINGLIST +#define XTextWidth XTEXTWIDTH +#define XTextWidth16 XTEXTWIDTH16 +#define XTranslateCoordinates XTRANSLATECOORDINATES +#define XUndefineCursor XUNDEFINECURSOR +#define XUngrabButton XUNGRABBUTTON +#define XUngrabKeyboard XUNGRABKEYBOARD +#define XUngrabPointer XUNGRABPOINTER +#define XUngrabServer XUNGRABSERVER +#define XUninstallColormap XUNINSTALLCOLORMAP +#define XUnionRectWithRegion XUNIONRECTWITHREGION +#define XUnionRegion XUNIONREGION +#define XUniqueContext XUNIQUECONTEXT +#define XUnmapWindow XUNMAPWINDOW +#define XUnsetICFocus XUNSETICFOCUS +#define XVaCreateNestedList XVACREATENESTEDLIST +#define XVisualIDFromVisual XVISUALIDFROMVISUAL +#define XWMGeometry XWMGEOMETRY +#define XWarpPointer XWARPPOINTER +#define XWhitePixel XWHITEPIXEL +#define XWhitePixelOfScreen XWHITEPIXELOFSCREEN +#define XWidthMMOfScreen XWIDTHMMOFSCREEN +#define XWidthOfScreen XWIDTHOFSCREEN +#define XWindowEvent XWINDOWEVENT +#define XWithdrawWindow XWITHDRAWWINDOW +#define XXorRegion XXORREGION +#define XcmsQueryColor XCMSQUERYCOLOR +#define XdbeAllocateBackBufferName XDBEALLOCATEBACKBUFFERNAME +#define XdbeFreeVisualInfo XDBEFREEVISUALINFO +#define XdbeGetVisualInfo XDBEGETVISUALINFO +#define XdbeQueryExtension XDBEQUERYEXTENSION +#define XdbeSwapBuffers XDBESWAPBUFFERS +#define XextAddDisplay XEXTADDDISPLAY +#define XextFindDisplay XEXTFINDDISPLAY +#define XextRemoveDisplay XEXTREMOVEDISPLAY +#define XkbSetDetectableAutoRepeat XKBSETDETECTABLEAUTOREPEAT +#define XmActivateProtocol XMACTIVATEPROTOCOL +#define XmAddProtocolCallback XMADDPROTOCOLCALLBACK +#define XmAddProtocols XMADDPROTOCOLS +#define XmChangeColor XMCHANGECOLOR +#define XmClipboardCopy XMCLIPBOARDCOPY +#define XmClipboardCopyByName XMCLIPBOARDCOPYBYNAME +#define XmClipboardEndCopy XMCLIPBOARDENDCOPY +#define XmClipboardEndRetrieve XMCLIPBOARDENDRETRIEVE +#define XmClipboardInquireCount XMCLIPBOARDINQUIRECOUNT +#define XmClipboardInquireFormat XMCLIPBOARDINQUIREFORMAT +#define XmClipboardInquireLength XMCLIPBOARDINQUIRELENGTH +#define XmClipboardLock XMCLIPBOARDLOCK +#define XmClipboardRetrieve XMCLIPBOARDRETRIEVE +#define XmClipboardStartCopy XMCLIPBOARDSTARTCOPY +#define XmClipboardStartRetrieve XMCLIPBOARDSTARTRETRIEVE +#define XmClipboardUnlock XMCLIPBOARDUNLOCK +#define XmCommandError XMCOMMANDERROR +#define XmCommandGetChild XMCOMMANDGETCHILD +#define XmCommandSetValue XMCOMMANDSETVALUE +#define XmCreateArrowButton XMCREATEARROWBUTTON +#define XmCreateArrowButtonGadget XMCREATEARROWBUTTONGADGET +#define XmCreateBulletinBoardDialog XMCREATEBULLETINBOARDDIALOG +#define XmCreateCascadeButton XMCREATECASCADEBUTTON +#define XmCreateCascadeButtonGadget XMCREATECASCADEBUTTONGADGET +#define XmCreateDialogShell XMCREATEDIALOGSHELL +#define XmCreateDragIcon XMCREATEDRAGICON +#define XmCreateDrawingArea XMCREATEDRAWINGAREA +#define XmCreateDrawnButton XMCREATEDRAWNBUTTON +#define XmCreateErrorDialog XMCREATEERRORDIALOG +#define XmCreateFileSelectionBox XMCREATEFILESELECTIONBOX +#define XmCreateFileSelectionDialog XMCREATEFILESELECTIONDIALOG +#define XmCreateForm XMCREATEFORM +#define XmCreateFormDialog XMCREATEFORMDIALOG +#define XmCreateFrame XMCREATEFRAME +#define XmCreateInformationDialog XMCREATEINFORMATIONDIALOG +#define XmCreateLabel XMCREATELABEL +#define XmCreateLabelGadget XMCREATELABELGADGET +#define XmCreateList XMCREATELIST +#define XmCreateMainWindow XMCREATEMAINWINDOW +#define XmCreateMenuBar XMCREATEMENUBAR +#define XmCreateMessageBox XMCREATEMESSAGEBOX +#define XmCreateMessageDialog XMCREATEMESSAGEDIALOG +#define XmCreateOptionMenu XMCREATEOPTIONMENU +#define XmCreatePanedWindow XMCREATEPANEDWINDOW +#define XmCreatePopupMenu XMCREATEPOPUPMENU +#define XmCreatePromptDialog XMCREATEPROMPTDIALOG +#define XmCreatePulldownMenu XMCREATEPULLDOWNMENU +#define XmCreatePushButton XMCREATEPUSHBUTTON +#define XmCreatePushButtonGadget XMCREATEPUSHBUTTONGADGET +#define XmCreateQuestionDialog XMCREATEQUESTIONDIALOG +#define XmCreateRadioBox XMCREATERADIOBOX +#define XmCreateRowColumn XMCREATEROWCOLUMN +#define XmCreateScale XMCREATESCALE +#define XmCreateScrollBar XMCREATESCROLLBAR +#define XmCreateScrolledList XMCREATESCROLLEDLIST +#define XmCreateScrolledText XMCREATESCROLLEDTEXT +#define XmCreateScrolledWindow XMCREATESCROLLEDWINDOW +#define XmCreateSelectionDialog XMCREATESELECTIONDIALOG +#define XmCreateSeparator XMCREATESEPARATOR +#define XmCreateSeparatorGadget XMCREATESEPARATORGADGET +#define XmCreateTemplateDialog XMCREATETEMPLATEDIALOG +#define XmCreateText XMCREATETEXT +#define XmCreateTextField XMCREATETEXTFIELD +#define XmCreateToggleButton XMCREATETOGGLEBUTTON +#define XmCreateToggleButtonGadget XMCREATETOGGLEBUTTONGADGET +#define XmCreateWarningDialog XMCREATEWARNINGDIALOG +#define XmCvtCTToXmString XMCVTCTTOXMSTRING +#define XmDestroyPixmap XMDESTROYPIXMAP +#define XmDragStart XMDRAGSTART +#define XmDropSiteRegister XMDROPSITEREGISTER +#define XmDropSiteUnregister XMDROPSITEUNREGISTER +#define XmDropSiteUpdate XMDROPSITEUPDATE +#define XmDropTransferStart XMDROPTRANSFERSTART +#define XmFileSelectionBoxGetChild XMFILESELECTIONBOXGETCHILD +#define XmFileSelectionDoSearch XMFILESELECTIONDOSEARCH +#define XmFontListAppendEntry XMFONTLISTAPPENDENTRY +#define XmFontListCopy XMFONTLISTCOPY +#define XmFontListCreate XMFONTLISTCREATE +#define XmFontListEntryCreate XMFONTLISTENTRYCREATE +#define XmFontListEntryFree XMFONTLISTENTRYFREE +#define XmFontListEntryGetFont XMFONTLISTENTRYGETFONT +#define XmFontListEntryGetTag XMFONTLISTENTRYGETTAG +#define XmFontListEntryLoad XMFONTLISTENTRYLOAD +#define XmFontListFree XMFONTLISTFREE +#define XmFontListFreeFontContext XMFONTLISTFREEFONTCONTEXT +#define XmFontListGetNextFont XMFONTLISTGETNEXTFONT +#define XmFontListInitFontContext XMFONTLISTINITFONTCONTEXT +#define XmFontListNextEntry XMFONTLISTNEXTENTRY +#define XmGetColors XMGETCOLORS +#define XmGetColorCalculation XMGETCOLORCALCULATION +#define XmGetFocusWidget XMGETFOCUSWIDGET +#define XmGetMenuCursor XMGETMENUCURSOR +#define XmGetPixmap XMGETPIXMAP +#define XmGetPixmapByDepth XMGETPIXMAPBYDEPTH +#define XmGetTearOffControl XMGETTEAROFFCONTROL +#define XmGetXmDisplay XMGETXMDISPLAY +#define XmImMbLookupString XMIMMBLOOKUPSTRING +#define XmImRegister XMIMREGISTER +#define XmImSetFocusValues XMIMSETFOCUSVALUES +#define XmImSetValues XMIMSETVALUES +#define XmImUnregister XMIMUNREGISTER +#define XmImUnsetFocus XMIMUNSETFOCUS +#define XmInstallImage XMINSTALLIMAGE +#define XmInternAtom XMINTERNATOM +#define XmIsMotifWMRunning XMISMOTIFWMRUNNING +#define XmListAddItem XMLISTADDITEM +#define XmListAddItemUnselected XMLISTADDITEMUNSELECTED +#define XmListAddItems XMLISTADDITEMS +#define XmListAddItemsUnselected XMLISTADDITEMSUNSELECTED +#define XmListDeleteAllItems XMLISTDELETEALLITEMS +#define XmListDeleteItem XMLISTDELETEITEM +#define XmListDeleteItemsPos XMLISTDELETEITEMSPOS +#define XmListDeletePos XMLISTDELETEPOS +#define XmListDeselectAllItems XMLISTDESELECTALLITEMS +#define XmListDeselectPos XMLISTDESELECTPOS +#define XmListGetKbdItemPos XMLISTGETKBDITEMPOS +#define XmListGetMatchPos XMLISTGETMATCHPOS +#define XmListGetSelectedPos XMLISTGETSELECTEDPOS +#define XmListItemExists XMLISTITEMEXISTS +#define XmListItemPos XMLISTITEMPOS +#define XmListPosSelected XMLISTPOSSELECTED +#define XmListReplaceItems XMLISTREPLACEITEMS +#define XmListReplaceItemsPos XMLISTREPLACEITEMSPOS +#define XmListSelectItem XMLISTSELECTITEM +#define XmListSelectPos XMLISTSELECTPOS +#define XmListSetBottomPos XMLISTSETBOTTOMPOS +#define XmListSetItem XMLISTSETITEM +#define XmListSetKbdItemPos XMLISTSETKBDITEMPOS +#define XmListSetPos XMLISTSETPOS +#define XmMainWindowSetAreas XMMAINWINDOWSETAREAS +#define XmMenuPosition XMMENUPOSITION +#define XmMessageBoxGetChild XMMESSAGEBOXGETCHILD +#define XmOptionButtonGadget XMOPTIONBUTTONGADGET +#define XmOptionLabelGadget XMOPTIONLABELGADGET +#define XmProcessTraversal XMPROCESSTRAVERSAL +#define XmQmotif XMQMOTIF +#define XmRemoveProtocolCallback XMREMOVEPROTOCOLCALLBACK +#define XmRemoveProtocols XMREMOVEPROTOCOLS +#define XmRemoveTabGroup XMREMOVETABGROUP +#define XmRepTypeGetId XMREPTYPEGETID +#define XmRepTypeGetRecord XMREPTYPEGETRECORD +#define XmRepTypeInstallTearOffModelCon XMREPTYPEINSTALLTEAROFFMODELCON +#define XmRepTypeRegister XMREPTYPEREGISTER +#define XmRepTypeValidValue XMREPTYPEVALIDVALUE +#define XmScrollBarGetValues XMSCROLLBARGETVALUES +#define XmScrollBarSetValues XMSCROLLBARSETVALUES +#define XmScrolledWindowSetAreas XMSCROLLEDWINDOWSETAREAS +#define XmSelectionBoxGetChild XMSELECTIONBOXGETCHILD +#define XmSetColorCalculation XMSETCOLORCALCULATION +#define XmStringByteCompare XMSTRINGBYTECOMPARE +#define XmStringCompare XMSTRINGCOMPARE +#define XmStringConcat XMSTRINGCONCAT +#define XmStringCopy XMSTRINGCOPY +#define XmStringCreate XMSTRINGCREATE +#define XmStringCreateLocalized XMSTRINGCREATELOCALIZED +#define XmStringCreateLtoR XMSTRINGCREATELTOR +#define XmStringCreateSimple XMSTRINGCREATESIMPLE +#define XmStringDraw XMSTRINGDRAW +#define XmStringDrawUnderline XMSTRINGDRAWUNDERLINE +#define XmStringExtent XMSTRINGEXTENT +#define XmStringFree XMSTRINGFREE +#define XmStringFreeContext XMSTRINGFREECONTEXT +#define XmStringGetLtoR XMSTRINGGETLTOR +#define XmStringGetNextComponent XMSTRINGGETNEXTCOMPONENT +#define XmStringGetNextSegment XMSTRINGGETNEXTSEGMENT +#define XmStringInitContext XMSTRINGINITCONTEXT +#define XmStringLength XMSTRINGLENGTH +#define XmStringLtoRCreate XMSTRINGLTORCREATE +#define XmStringNConcat XMSTRINGNCONCAT +#define XmStringSegmentCreate XMSTRINGSEGMENTCREATE +#define XmStringSeparatorCreate XMSTRINGSEPARATORCREATE +#define XmStringWidth XMSTRINGWIDTH +#define XmTextClearSelection XMTEXTCLEARSELECTION +#define XmTextCopy XMTEXTCOPY +#define XmTextCut XMTEXTCUT +#define XmTextFieldClearSelection XMTEXTFIELDCLEARSELECTION +#define XmTextFieldCopy XMTEXTFIELDCOPY +#define XmTextFieldCut XMTEXTFIELDCUT +#define XmTextFieldGetEditable XMTEXTFIELDGETEDITABLE +#define XmTextFieldGetInsertionPosition XMTEXTFIELDGETINSERTIONPOSITION +#define XmTextFieldGetLastPosition XMTEXTFIELDGETLASTPOSITION +#define XmTextFieldGetMaxLength XMTEXTFIELDGETMAXLENGTH +#define XmTextFieldGetSelection XMTEXTFIELDGETSELECTION +#define XmTextFieldGetSelectionPosition XMTEXTFIELDGETSELECTIONPOSITION +#define XmTextFieldGetString XMTEXTFIELDGETSTRING +#define XmTextFieldInsert XMTEXTFIELDINSERT +#define XmTextFieldPaste XMTEXTFIELDPASTE +#define XmTextFieldRemove XMTEXTFIELDREMOVE +#define XmTextFieldReplace XMTEXTFIELDREPLACE +#define XmTextFieldSetAddMode XMTEXTFIELDSETADDMODE +#define XmTextFieldSetHighlight XMTEXTFIELDSETHIGHLIGHT +#define XmTextFieldSetInsertionPosition XMTEXTFIELDSETINSERTIONPOSITION +#define XmTextFieldSetMaxLength XMTEXTFIELDSETMAXLENGTH +#define XmTextFieldSetSelection XMTEXTFIELDSETSELECTION +#define XmTextFieldSetString XMTEXTFIELDSETSTRING +#define XmTextFieldShowPosition XMTEXTFIELDSHOWPOSITION +#define XmTextGetCursorPosition XMTEXTGETCURSORPOSITION +#define XmTextGetEditable XMTEXTGETEDITABLE +#define XmTextGetInsertionPosition XMTEXTGETINSERTIONPOSITION +#define XmTextGetLastPosition XMTEXTGETLASTPOSITION +#define XmTextGetMaxLength XMTEXTGETMAXLENGTH +#define XmTextGetSelection XMTEXTGETSELECTION +#define XmTextGetSelectionPosition XMTEXTGETSELECTIONPOSITION +#define XmTextGetString XMTEXTGETSTRING +#define XmTextInsert XMTEXTINSERT +#define XmTextPaste XMTEXTPASTE +#define XmTextPosToXY XMTEXTPOSTOXY +#define XmTextRemove XMTEXTREMOVE +#define XmTextReplace XMTEXTREPLACE +#define XmTextSetCursorPosition XMTEXTSETCURSORPOSITION +#define XmTextSetEditable XMTEXTSETEDITABLE +#define XmTextSetHighlight XMTEXTSETHIGHLIGHT +#define XmTextSetInsertionPosition XMTEXTSETINSERTIONPOSITION +#define XmTextSetSelection XMTEXTSETSELECTION +#define XmTextSetString XMTEXTSETSTRING +#define XmTextSetTopCharacter XMTEXTSETTOPCHARACTER +#define XmTextShowPosition XMTEXTSHOWPOSITION +#define XmToggleButtonGadgetGetState XMTOGGLEBUTTONGADGETGETSTATE +#define XmToggleButtonGadgetSetState XMTOGGLEBUTTONGADGETSETSTATE +#define XmToggleButtonGetState XMTOGGLEBUTTONGETSTATE +#define XmToggleButtonSetState XMTOGGLEBUTTONSETSTATE +#define XmUninstallImage XMUNINSTALLIMAGE +#define XmUpdateDisplay XMUPDATEDISPLAY +#define XmVaCreateSimpleRadioBox XMVACREATESIMPLERADIOBOX +#define XmbDrawString XMBDRAWSTRING +#define XmbLookupString XMBLOOKUPSTRING +#define XmbResetIC XMBRESETIC +#define XmbSetWMProperties XMBSETWMPROPERTIES +#define XmbTextEscapement XMBTEXTESCAPEMENT +#define XmbTextExtents XMBTEXTEXTENTS +#define XmbTextListToTextProperty XMBTEXTLISTTOTEXTPROPERTY +#define XmbTextPropertyToTextList XMBTEXTPROPERTYTOTEXTLIST +#define XmbufCreateBuffers XMBUFCREATEBUFFERS +#define XmbufDestroyBuffers XMBUFDESTROYBUFFERS +#define XmbufDisplayBuffers XMBUFDISPLAYBUFFERS +#define XmbufQueryExtension XMBUFQUERYEXTENSION +#define Xmemory_free XMEMORY_FREE +#define Xmemory_malloc XMEMORY_MALLOC +#define XmuClientWindow XMUCLIENTWINDOW +#define XmuConvertStandardSelection XMUCONVERTSTANDARDSELECTION +#define XmuCvtStringToBitmap XMUCVTSTRINGTOBITMAP +#define XmuInternAtom XMUINTERNATOM +#define XmuInternStrings XMUINTERNSTRINGS +#define XmuLookupStandardColormap XMULOOKUPSTANDARDCOLORMAP +#define XmuPrintDefaultErrorMessage XMUPRINTDEFAULTERRORMESSAGE +#define XrmCombineDatabase XRMCOMBINEDATABASE +#define XrmCombineFileDatabase XRMCOMBINEFILEDATABASE +#define XrmDestroyDatabase XRMDESTROYDATABASE +#define XrmGetDatabase XRMGETDATABASE +#define XrmGetFileDatabase XRMGETFILEDATABASE +#define XrmGetResource XRMGETRESOURCE +#define XrmGetStringDatabase XRMGETSTRINGDATABASE +#define XrmInitialize XRMINITIALIZE +#define XrmMergeDatabases XRMMERGEDATABASES +#define XrmParseCommand XRMPARSECOMMAND +#define XrmPermStringToQuark XRMPERMSTRINGTOQUARK +#define XrmPutFileDatabase XRMPUTFILEDATABASE +#define XrmPutLineResource XRMPUTLINERESOURCE +#define XrmPutStringResource XRMPUTSTRINGRESOURCE +#define XrmQGetResource XRMQGETRESOURCE +#define XrmQPutStringResource XRMQPUTSTRINGRESOURCE +#define XrmQuarkToString XRMQUARKTOSTRING +#define XrmSetDatabase XRMSETDATABASE +#define XrmStringToBindingQuarkList XRMSTRINGTOBINDINGQUARKLIST +#define XrmStringToQuark XRMSTRINGTOQUARK +#define XtAddCallback XTADDCALLBACK +#define XtAddCallbacks XTADDCALLBACKS +#define XtAddConverter XTADDCONVERTER +#define XtAddEventHandler XTADDEVENTHANDLER +#define XtAddExposureToRegion XTADDEXPOSURETOREGION +#define XtAddGrab XTADDGRAB +#define XtAddRawEventHandler XTADDRAWEVENTHANDLER +#define XtAllocateGC XTALLOCATEGC +#define XtAppAddActions XTAPPADDACTIONS +#define XtAppAddInput XTAPPADDINPUT +#define XtAppAddTimeOut XTAPPADDTIMEOUT +#define XtAppAddWorkProc XTAPPADDWORKPROC +#define XtAppCreateShell XTAPPCREATESHELL +#define XtAppError XTAPPERROR +#define XtAppErrorMsg XTAPPERRORMSG +#define XtAppInitialize XTAPPINITIALIZE +#define XtAppMainLoop XTAPPMAINLOOP +#define XtAppNextEvent XTAPPNEXTEVENT +#define XtAppPeekEvent XTAPPPEEKEVENT +#define XtAppPending XTAPPPENDING +#define XtAppProcessEvent XTAPPPROCESSEVENT +#define XtAppSetErrorHandler XTAPPSETERRORHANDLER +#define XtAppSetFallbackResources XTAPPSETFALLBACKRESOURCES +#define XtAppSetTypeConverter XTAPPSETTYPECONVERTER +#define XtAppSetWarningHandler XTAPPSETWARNINGHANDLER +#define XtAppWarningMsg XTAPPWARNINGMSG +#define XtAppSetWarningMsgHandler XTAPPSETWARNINGMSGHANDLER +#define XtAppWarning XTAPPWARNING +#define XtAugmentTranslations XTAUGMENTTRANSLATIONS +#define XtCallActionProc XTCALLACTIONPROC +#define XtCallCallbackList XTCALLCALLBACKLIST +#define XtCallCallbacks XTCALLCALLBACKS +#define XtCallConverter XTCALLCONVERTER +#define XtCalloc XTCALLOC +#ifndef NOXTDISPLAY +#define XtClass XTCLASS +#endif +#define XtCloseDisplay XTCLOSEDISPLAY +#define XtConfigureWidget XTCONFIGUREWIDGET +#define XtConvert XTCONVERT +#define XtConvertAndStore XTCONVERTANDSTORE +#define XtCreateApplicationContext XTCREATEAPPLICATIONCONTEXT +#define XtCreateManagedWidget XTCREATEMANAGEDWIDGET +#define XtCreatePopupShell XTCREATEPOPUPSHELL +#define XtCreateWidget XTCREATEWIDGET +#define XtCreateWindow XTCREATEWINDOW +#define XtCvtStringToFont XTCVTSTRINGTOFONT +#define XtDatabase XTDATABASE +#define XtDestroyApplicationContext XTDESTROYAPPLICATIONCONTEXT +#define XtDestroyWidget XTDESTROYWIDGET +#define XtDisownSelection XTDISOWNSELECTION +#define XtDispatchEvent XTDISPATCHEVENT +#ifndef NOXTDISPLAY +#define XtDisplay XTDISPLAY +#endif +#define XtDisplayOfObject XTDISPLAYOFOBJECT +#define XtDisplayStringConvWarning XTDISPLAYSTRINGCONVWARNING +#define XtDisplayToApplicationContext XTDISPLAYTOAPPLICATIONCONTEXT +#define XtError XTERROR +#define XtErrorMsg XTERRORMSG +#define XtFree XTFREE +#define XtGetActionKeysym XTGETACTIONKEYSYM +#define XtGetActionList XTGETACTIONLIST +#define XtGetApplicationNameAndClass XTGETAPPLICATIONNAMEANDCLASS +#define XtGetApplicationResources XTGETAPPLICATIONRESOURCES +#define XtGetClassExtension XTGETCLASSEXTENSION +#define XtGetConstraintResourceList XTGETCONSTRAINTRESOURCELIST +#define XtGetGC XTGETGC +#define XtGetMultiClickTime XTGETMULTICLICKTIME +#define XtGetResourceList XTGETRESOURCELIST +#define XtGetSelectionValue XTGETSELECTIONVALUE +#define XtGetSelectionValues XTGETSELECTIONVALUES +#define XtGetSubresources XTGETSUBRESOURCES +#define XtGetValues XTGETVALUES +#define XtGrabButton XTGRABBUTTON +#define XtGrabKeyboard XTGRABKEYBOARD +#define XtGrabPointer XTGRABPOINTER +#define XtHasCallbacks XTHASCALLBACKS +#define XtInitialize XTINITIALIZE +#define XtInitializeWidgetClass XTINITIALIZEWIDGETCLASS +#define XtInsertEventHandler XTINSERTEVENTHANDLER +#define XtInsertRawEventHandler XTINSERTRAWEVENTHANDLER +#define XtInstallAccelerators XTINSTALLACCELERATORS +#define XtIsManaged XTISMANAGED +#define XtIsObject XTISOBJECT +#ifndef NOXTDISPLAY +#define XtIsRealized XTISREALIZED +#endif +#define XtIsSensitive XTISSENSITIVE +#define XtIsSubclass XTISSUBCLASS +#define XtLastTimestampProcessed XTLASTTIMESTAMPPROCESSED +#define XtMainLoop XTMAINLOOP +#define XtMakeGeometryRequest XTMAKEGEOMETRYREQUEST +#define XtMakeResizeRequest XTMAKERESIZEREQUEST +#define XtMalloc XTMALLOC +#define XtManageChild XTMANAGECHILD +#define XtManageChildren XTMANAGECHILDREN +#define XtMergeArgLists XTMERGEARGLISTS +#define XtMoveWidget XTMOVEWIDGET +#define XtName XTNAME +#define XtNameToWidget XTNAMETOWIDGET +#define XtOpenApplication XTOPENAPPLICATION +#define XtOpenDisplay XTOPENDISPLAY +#define XtOverrideTranslations XTOVERRIDETRANSLATIONS +#define XtOwnSelection XTOWNSELECTION +#ifndef NOXTDISPLAY +#define XtParent XTPARENT +#endif +#define XtParseAcceleratorTable XTPARSEACCELERATORTABLE +#define XtParseTranslationTable XTPARSETRANSLATIONTABLE +#define XtPopdown XTPOPDOWN +#define XtPopup XTPOPUP +#define XtPopupSpringLoaded XTPOPUPSPRINGLOADED +#define XtQueryGeometry XTQUERYGEOMETRY +#define XtRealizeWidget XTREALIZEWIDGET +#define XtRealloc XTREALLOC +#define XtRegisterDrawable _XTREGISTERWINDOW +#define XtRegisterGrabAction XTREGISTERGRABACTION +#define XtReleaseGC XTRELEASEGC +#define XtRemoveAllCallbacks XTREMOVEALLCALLBACKS +#define XtRemoveCallback XTREMOVECALLBACK +#define XtRemoveEventHandler XTREMOVEEVENTHANDLER +#define XtRemoveGrab XTREMOVEGRAB +#define XtRemoveInput XTREMOVEINPUT +#define XtRemoveTimeOut XTREMOVETIMEOUT +#define XtRemoveWorkProc XTREMOVEWORKPROC +#define XtResizeWidget XTRESIZEWIDGET +#define XtResolvePathname XTRESOLVEPATHNAME +#ifndef NOXTDISPLAY +#define XtScreen XTSCREEN +#endif +#define XtScreenDatabase XTSCREENDATABASE +#define XtScreenOfObject XTSCREENOFOBJECT +#define XtSessionReturnToken XTSESSIONRETURNTOKEN +#define XtSetErrorHandler XTSETERRORHANDLER +#define XtSetKeyboardFocus XTSETKEYBOARDFOCUS +#define XtSetLanguageProc XTSETLANGUAGEPROC +#define XtSetMappedWhenManaged XTSETMAPPEDWHENMANAGED +#define XtSetSensitive XTSETSENSITIVE +#define XtSetTypeConverter XTSETTYPECONVERTER +#define XtSetValues XTSETVALUES +#define XtShellStrings XTSHELLSTRINGS +#define XtStringConversionWarning XTSTRINGCONVERSIONWARNING +#define XtStrings XTSTRINGS +#define XtToolkitInitialize XTTOOLKITINITIALIZE +#define XtTranslateCoords XTTRANSLATECOORDS +#define XtTranslateKeycode XTTRANSLATEKEYCODE +#define XtUngrabButton XTUNGRABBUTTON +#define XtUngrabKeyboard XTUNGRABKEYBOARD +#define XtUngrabPointer XTUNGRABPOINTER +#define XtUnmanageChild XTUNMANAGECHILD +#define XtUnmanageChildren XTUNMANAGECHILDREN +#define XtUnrealizeWidget XTUNREALIZEWIDGET +#define XtUnregisterDrawable _XTUNREGISTERWINDOW +#define XtVaCreateManagedWidget XTVACREATEMANAGEDWIDGET +#define XtVaCreatePopupShell XTVACREATEPOPUPSHELL +#define XtVaCreateWidget XTVACREATEWIDGET +#define XtVaGetApplicationResources XTVAGETAPPLICATIONRESOURCES +#define XtVaGetValues XTVAGETVALUES +#define XtVaSetValues XTVASETVALUES +#define XtWarning XTWARNING +#define XtWarningMsg XTWARNINGMSG +#define XtWidgetToApplicationContext XTWIDGETTOAPPLICATIONCONTEXT +#ifndef NOXTDISPLAY +#define XtWindow XTWINDOW +#endif +#define XtWindowOfObject XTWINDOWOFOBJECT +#define XtWindowToWidget XTWINDOWTOWIDGET +#define XwcDrawImageString XWCDRAWIMAGESTRING +#define XwcDrawString XWCDRAWSTRING +#define XwcFreeStringList XWCFREESTRINGLIST +#define XwcTextEscapement XWCTEXTESCAPEMENT +#define XwcTextExtents XWCTEXTEXTENTS +#define XwcTextListToTextProperty XWCTEXTLISTTOTEXTPROPERTY +#define XwcLookupString XWCLOOKUPSTRING +#define XwcTextPropertyToTextList XWCTEXTPROPERTYTOTEXTLIST +#define _XAllocTemp _XALLOCTEMP +#define _XDeqAsyncHandler _XDEQASYNCHANDLER +#define _XEatData _XEATDATA +#define _XFlush _XFLUSH +#define _XFreeTemp _XFREETEMP +#define _XGetAsyncReply _XGETASYNCREPLY +#define _XInitImageFuncPtrs _XINITIMAGEFUNCPTRS +#define _XRead _XREAD +#define _XReadPad _XREADPAD +#define _XRegisterFilterByType _XREGISTERFILTERBYTYPE +#define _XReply _XREPLY +#define _XSend _XSEND +#define _XUnregisterFilter _XUNREGISTERFILTER +#define _XVIDtoVisual _XVIDTOVISUAL +#define _XmBottomShadowColorDefault _XMBOTTOMSHADOWCOLORDEFAULT +#define _XmClearBorder _XMCLEARBORDER +#define _XmConfigureObject _XMCONFIGUREOBJECT +#define _XmDestroyParentCallback _XMDESTROYPARENTCALLBACK +#define _XmDrawArrow _XMDRAWARROW +#define _XmDrawShadows _XMDRAWSHADOWS +#define _XmFontListGetDefaultFont _XMFONTLISTGETDEFAULTFONT +#define _XmFromHorizontalPixels _XMFROMHORIZONTALPIXELS +#define _XmFromVerticalPixels _XMFROMVERTICALPIXELS +#define _XmGetClassExtensionPtr _XMGETCLASSEXTENSIONPTR +#define _XmGetDefaultFontList _XMGETDEFAULTFONTLIST +#define _XmGetTextualDragIcon _XMGETTEXTUALDRAGICON +#define _XmGetWidgetExtData _XMGETWIDGETEXTDATA +#define _XmGrabKeyboard _XMGRABKEYBOARD +#define _XmGrabPointer _XMGRABPOINTER +#define _XmInheritClass _XMINHERITCLASS +#define _XmInputForGadget _XMINPUTFORGADGET +#define _XmInputInGadget _XMINPUTINGADGET +#define _XmMakeGeometryRequest _XMMAKEGEOMETRYREQUEST +#define _XmMenuPopDown _XMMENUPOPDOWN +#define _XmMoveObject _XMMOVEOBJECT +#define _XmNavigChangeManaged _XMNAVIGCHANGEMANAGED +#define _XmOSBuildFileList _XMOSBUILDFILELIST +#define _XmOSFileCompare _XMOSFILECOMPARE +#define _XmOSFindPatternPart _XMOSFINDPATTERNPART +#define _XmOSQualifyFileSpec _XMOSQUALIFYFILESPEC +#define _XmPostPopupMenu _XMPOSTPOPUPMENU +#define _XmPrimitiveEnter _XMPRIMITIVEENTER +#define _XmPrimitiveLeave _XMPRIMITIVELEAVE +#define _XmRedisplayGadgets _XMREDISPLAYGADGETS +#define _XmShellIsExclusive _XMSHELLISEXCLUSIVE +#define _XmStringDraw _XMSTRINGDRAW +#define _XmStringGetTextConcat _XMSTRINGGETTEXTCONCAT +#define _XmStrings _XMSTRINGS +#define _XmToHorizontalPixels _XMTOHORIZONTALPIXELS +#define _XmToVerticalPixels _XMTOVERTICALPIXELS +#define _XmTopShadowColorDefault _XMTOPSHADOWCOLORDEFAULT +#define _Xm_fastPtr _XM_FASTPTR +#define _XtCheckSubclassFlag _XTCHECKSUBCLASSFLAG +#define _XtCopyFromArg _XTCOPYFROMARG +#define _XtCountVaList _XTCOUNTVALIST +#define _XtInherit _XTINHERIT +#define _XtInheritTranslations _XTINHERITTRANSLATIONS +#define _XtIsSubclassOf _XTISSUBCLASSOF +#define _XtVaToArgList _XTVATOARGLIST +#define applicationShellWidgetClass APPLICATIONSHELLWIDGETCLASS +#define cli$dcl_parse CLI$DCL_PARSE +#define cli$get_value CLI$GET_VALUE +#define cli$present CLI$PRESENT +#define compositeClassRec COMPOSITECLASSREC +#define compositeWidgetClass COMPOSITEWIDGETCLASS +#define constraintClassRec CONSTRAINTCLASSREC +#define constraintWidgetClass CONSTRAINTWIDGETCLASS +#define coreWidgetClass COREWIDGETCLASS +#define exe$getspi EXE$GETSPI +#define lbr$close LBR$CLOSE +#define lbr$get_header LBR$GET_HEADER +#define lbr$get_index LBR$GET_INDEX +#define lbr$get_record LBR$GET_RECORD +#define lbr$ini_control LBR$INI_CONTROL +#define lbr$lookup_key LBR$LOOKUP_KEY +#define lbr$open LBR$OPEN +#define lbr$output_help LBR$OUTPUT_HELP +#define lib$add_times LIB$ADD_TIMES +#define lib$addx LIB$ADDX +#define lib$create_dir LIB$CREATE_DIR +#define lib$create_vm_zone LIB$CREATE_VM_ZONE +#define lib$cvt_from_internal_time LIB$CVT_FROM_INTERNAL_TIME +#define lib$cvt_htb LIB$CVT_HTB +#define lib$cvt_vectim LIB$CVT_VECTIM +#define lib$day LIB$DAY +#define lib$day_of_week LIB$DAY_OF_WEEK +#define lib$delete_symbol LIB$DELETE_SYMBOL +#define lib$delete_vm_zone LIB$DELETE_VM_ZONE +#define lib$disable_ctrl LIB$DISABLE_CTRL +#define lib$ediv LIB$EDIV +#define lib$emul LIB$EMUL +#define lib$enable_ctrl LIB$ENABLE_CTRL +#define lib$find_vm_zone LIB$FIND_VM_ZONE +#define lib$format_date_time LIB$FORMAT_DATE_TIME +#define lib$free_timer LIB$FREE_TIMER +#define lib$free_vm LIB$FREE_VM +#define lib$get_ef LIB$GET_EF +#define lib$get_foreign LIB$GET_FOREIGN +#define lib$get_input LIB$GET_INPUT +#define lib$get_users_language LIB$GET_USERS_LANGUAGE +#define lib$get_vm LIB$GET_VM +#define lib$get_symbol LIB$GET_SYMBOL +#define lib$getdvi LIB$GETDVI +#define lib$init_date_time_context LIB$INIT_DATE_TIME_CONTEXT +#define lib$init_timer LIB$INIT_TIMER +#define lib$find_file LIB$FIND_FILE +#define lib$find_file_end LIB$FIND_FILE_END +#define lib$find_image_symbol LIB$FIND_IMAGE_SYMBOL +#define lib$mult_delta_time LIB$MULT_DELTA_TIME +#define lib$put_output LIB$PUT_OUTPUT +#define lib$rename_file LIB$RENAME_FILE +#define lib$reset_vm_zone LIB$RESET_VM_ZONE +#define lib$set_symbol LIB$SET_SYMBOL +#define lib$sfree1_dd LIB$SFREE1_DD +#define lib$show_vm LIB$SHOW_VM +#define lib$show_vm_zone LIB$SHOW_VM_ZONE +#define lib$spawn LIB$SPAWN +#define lib$stat_timer LIB$STAT_TIMER +#define lib$subx LIB$SUBX +#define lib$sub_times LIB$SUB_TIMES +#define lib$wait LIB$WAIT +#define mail$send_add_address MAIL$SEND_ADD_ADDRESS +#define mail$send_add_attribute MAIL$SEND_ADD_ATTRIBUTE +#define mail$send_add_bodypart MAIL$SEND_ADD_BODYPART +#define mail$send_begin MAIL$SEND_BEGIN +#define mail$send_end MAIL$SEND_END +#define mail$send_message MAIL$SEND_MESSAGE +#define ncs$convert NCS$CONVERT +#define ncs$get_cf NCS$GET_CF +#define objectClass OBJECTCLASS +#define objectClassRec OBJECTCLASSREC +#define overrideShellClassRec OVERRIDESHELLCLASSREC +#define overrideShellWidgetClass OVERRIDESHELLWIDGETCLASS +#define pthread_attr_create PTHREAD_ATTR_CREATE +#define pthread_attr_delete PTHREAD_ATTR_DELETE +#define pthread_attr_destroy PTHREAD_ATTR_DESTROY +#define pthread_attr_getdetach_np PTHREAD_ATTR_GETDETACH_NP +#define pthread_attr_getguardsize_np PTHREAD_ATTR_GETGUARDSIZE_NP +#define pthread_attr_getinheritsched PTHREAD_ATTR_GETINHERITSCHED +#define pthread_attr_getprio PTHREAD_ATTR_GETPRIO +#define pthread_attr_getsched PTHREAD_ATTR_GETSCHED +#define pthread_attr_getschedparam PTHREAD_ATTR_GETSCHEDPARAM +#define pthread_attr_getschedpolicy PTHREAD_ATTR_GETSCHEDPOLICY +#define pthread_attr_getstacksize PTHREAD_ATTR_GETSTACKSIZE +#define pthread_attr_init PTHREAD_ATTR_INIT +#define pthread_attr_setdetach_np PTHREAD_ATTR_SETDETACH_NP +#define pthread_attr_setdetachstate PTHREAD_ATTR_SETDETACHSTATE +#define pthread_attr_setguardsize_np PTHREAD_ATTR_SETGUARDSIZE_NP +#define pthread_attr_setinheritsched PTHREAD_ATTR_SETINHERITSCHED +#define pthread_attr_setprio PTHREAD_ATTR_SETPRIO +#define pthread_attr_setsched PTHREAD_ATTR_SETSCHED +#define pthread_attr_setschedparam PTHREAD_ATTR_SETSCHEDPARAM +#define pthread_attr_setschedpolicy PTHREAD_ATTR_SETSCHEDPOLICY +#ifndef pthread_attr_setscope +# define pthread_attr_setscope PTHREAD_ATTR_SETSCOPE +#endif +#define pthread_attr_setstacksize PTHREAD_ATTR_SETSTACKSIZE +#define pthread_cancel PTHREAD_CANCEL +#define pthread_cancel_e PTHREAD_CANCEL_E +#define pthread_cond_broadcast PTHREAD_COND_BROADCAST +#define pthread_cond_destroy PTHREAD_COND_DESTROY +#define pthread_cond_init PTHREAD_COND_INIT +#define pthread_cond_sig_preempt_int_np PTHREAD_COND_SIG_PREEMPT_INT_NP +#define pthread_cond_signal PTHREAD_COND_SIGNAL +#define pthread_cond_signal_int_np PTHREAD_COND_SIGNAL_INT_NP +#define pthread_cond_timedwait PTHREAD_COND_TIMEDWAIT +#define pthread_cond_wait PTHREAD_COND_WAIT +#define pthread_condattr_create PTHREAD_CONDATTR_CREATE +#define pthread_condattr_delete PTHREAD_CONDATTR_DELETE +#define pthread_condattr_init PTHREAD_CONDATTR_INIT +#define pthread_create PTHREAD_CREATE +#define pthread_delay_np PTHREAD_DELAY_NP +#define pthread_detach PTHREAD_DETACH +#define pthread_equal PTHREAD_EQUAL +#define pthread_exc_fetch_fp_np PTHREAD_EXC_FETCH_FP_NP +#define pthread_exc_handler_np PTHREAD_EXC_HANDLER_NP +#define pthread_exc_matches_np PTHREAD_EXC_MATCHES_NP +#define pthread_exc_pop_ctx_np PTHREAD_EXC_POP_CTX_NP +#define pthread_exc_push_ctx_np PTHREAD_EXC_PUSH_CTX_NP +#define pthread_exc_raise_np PTHREAD_EXC_RAISE_NP +#define pthread_exc_savecontext_np PTHREAD_EXC_SAVECONTEXT_NP +#define pthread_exit PTHREAD_EXIT +#define pthread_get_expiration_np PTHREAD_GET_EXPIRATION_NP +#define pthread_getprio PTHREAD_GETPRIO +#define pthread_getschedparam PTHREAD_GETSCHEDPARAM +#define pthread_getscheduler PTHREAD_GETSCHEDULER +#define pthread_getspecific PTHREAD_GETSPECIFIC +#define pthread_getunique_np PTHREAD_GETUNIQUE_NP +#define pthread_join PTHREAD_JOIN +#define pthread_join32 PTHREAD_JOIN32 +#define pthread_key_create PTHREAD_KEY_CREATE +#define pthread_key_delete PTHREAD_KEY_DELETE +#define pthread_keycreate PTHREAD_KEYCREATE +#define pthread_kill PTHREAD_KILL +#define pthread_lock_global_np PTHREAD_LOCK_GLOBAL_NP +#define pthread_mutex_destroy PTHREAD_MUTEX_DESTROY +#define pthread_mutex_init PTHREAD_MUTEX_INIT +#define pthread_mutex_lock PTHREAD_MUTEX_LOCK +#define pthread_mutex_trylock PTHREAD_MUTEX_TRYLOCK +#define pthread_mutex_unlock PTHREAD_MUTEX_UNLOCK +#define pthread_mutexattr_create PTHREAD_MUTEXATTR_CREATE +#define pthread_mutexattr_delete PTHREAD_MUTEXATTR_DELETE +#define pthread_mutexattr_destroy PTHREAD_MUTEXATTR_DESTROY +#define pthread_mutexattr_getkind_np PTHREAD_MUTEXATTR_GETKIND_NP +#define pthread_mutexattr_init PTHREAD_MUTEXATTR_INIT +#define pthread_mutexattr_setkind_np PTHREAD_MUTEXATTR_SETKIND_NP +#define pthread_mutexattr_settype_np PTHREAD_MUTEXATTR_SETTYPE_NP +#define pthread_once PTHREAD_ONCE +#define pthread_resume_np PTHREAD_RESUME_NP +#define pthread_self PTHREAD_SELF +#define pthread_setasynccancel PTHREAD_SETASYNCCANCEL +#define pthread_setcancel PTHREAD_SETCANCEL +#define pthread_setcancelstate PTHREAD_SETCANCELSTATE +#define pthread_setcanceltype PTHREAD_SETCANCELTYPE +#define pthread_setprio PTHREAD_SETPRIO +#define pthread_setschedparam PTHREAD_SETSCHEDPARAM +#define pthread_setscheduler PTHREAD_SETSCHEDULER +#define pthread_setspecific PTHREAD_SETSPECIFIC +#define pthread_suspend_np PTHREAD_SUSPEND_NP +#define pthread_testcancel PTHREAD_TESTCANCEL +#define pthread_unlock_global_np PTHREAD_UNLOCK_GLOBAL_NP +#define pthread_yield PTHREAD_YIELD +#define pthread_yield_np PTHREAD_YIELD_NP +#define rectObjClass RECTOBJCLASS +#define rectObjClassRec RECTOBJCLASSREC +#define sessionShellWidgetClass SESSIONSHELLWIDGETCLASS +#define shellWidgetClass SHELLWIDGETCLASS +#define shmat SHMAT +#define shmctl SHMCTL +#define shmdt SHMDT +#define shmget SHMGET +#define smg$create_key_table SMG$CREATE_KEY_TABLE +#define smg$create_virtual_keyboard SMG$CREATE_VIRTUAL_KEYBOARD +#define smg$read_composed_line SMG$READ_COMPOSED_LINE +#define sys$add_ident SYS$ADD_IDENT +#define sys$asctoid SYS$ASCTOID +#define sys$assign SYS$ASSIGN +#define sys$bintim SYS$BINTIM +#define sys$cancel SYS$CANCEL +#define sys$cantim SYS$CANTIM +#define sys$check_access SYS$CHECK_ACCESS +#define sys$close SYS$CLOSE +#define sys$connect SYS$CONNECT +#define sys$create SYS$CREATE +#define sys$create_user_profile SYS$CREATE_USER_PROFILE +#define sys$crembx SYS$CREMBX +#define sys$creprc SYS$CREPRC +#define sys$crmpsc SYS$CRMPSC +#define sys$dassgn SYS$DASSGN +#define sys$dclast SYS$DCLAST +#define sys$dclexh SYS$DCLEXH +#define sys$delprc SYS$DELPRC +#define sys$deq SYS$DEQ +#define sys$dgblsc SYS$DGBLSC +#define sys$display SYS$DISPLAY +#define sys$enq SYS$ENQ +#define sys$enqw SYS$ENQW +#define sys$erase SYS$ERASE +#define sys$fao SYS$FAO +#define sys$faol SYS$FAOL +#define sys$find_held SYS$FIND_HELD +#define sys$finish_rdb SYS$FINISH_RDB +#define sys$flush SYS$FLUSH +#define sys$forcex SYS$FORCEX +#define sys$get SYS$GET +#define sys$get_security SYS$GET_SECURITY +#define sys$getdviw SYS$GETDVIW +#define sys$getjpi SYS$GETJPI +#define sys$getjpiw SYS$GETJPIW +#define sys$getlkiw SYS$GETLKIW +#define sys$getmsg SYS$GETMSG +#define sys$getsyi SYS$GETSYI +#define sys$getsyiw SYS$GETSYIW +#define sys$gettim SYS$GETTIM +#define sys$getuai SYS$GETUAI +#define sys$grantid SYS$GRANTID +#define sys$hash_password SYS$HASH_PASSWORD +#define sys$hiber SYS$HIBER +#define sys$mgblsc SYS$MGBLSC +#define sys$numtim SYS$NUMTIM +#define sys$open SYS$OPEN +#define sys$parse SYS$PARSE +#define sys$parse_acl SYS$PARSE_ACL +#define sys$parse_acl SYS$PARSE_ACL +#define sys$persona_assume SYS$PERSONA_ASSUME +#define sys$persona_create SYS$PERSONA_CREATE +#define sys$persona_delete SYS$PERSONA_DELETE +#define sys$process_scan SYS$PROCESS_SCAN +#define sys$put SYS$PUT +#define sys$qio SYS$QIO +#define sys$qiow SYS$QIOW +#define sys$read SYS$READ +#define sys$resched SYS$RESCHED +#define sys$rewind SYS$REWIND +#define sys$search SYS$SEARCH +#define sys$set_security SYS$SET_SECURITY +#define sys$setast SYS$SETAST +#define sys$setef SYS$SETEF +#define sys$setimr SYS$SETIMR +#define sys$setpri SYS$SETPRI +#define sys$setprn SYS$SETPRN +#define sys$setprv SYS$SETPRV +#define sys$setswm SYS$SETSWM +#define sys$setuai SYS$SETUAI +#define sys$sndopr SYS$SNDOPR +#define sys$synch SYS$SYNCH +#define sys$trnlnm SYS$TRNLNM +#define sys$update SYS$UPDATE +#define sys$wake SYS$WAKE +#define sys$write SYS$WRITE +#define topLevelShellClassRec TOPLEVELSHELLCLASSREC +#define topLevelShellWidgetClass TOPLEVELSHELLWIDGETCLASS +#define transientShellWidgetClass TRANSIENTSHELLWIDGETCLASS +#define vendorShellClassRec VENDORSHELLCLASSREC +#define vendorShellWidgetClass VENDORSHELLWIDGETCLASS +#define widgetClass WIDGETCLASS +#define widgetClassRec WIDGETCLASSREC +#define wmShellClassRec WMSHELLCLASSREC +#define wmShellWidgetClass WMSHELLWIDGETCLASS +#define x$soft_ast_lib_lock X$SOFT_AST_LIB_LOCK +#define x$soft_ast_lock_depth X$SOFT_AST_LOCK_DEPTH +#define x$soft_reenable_asts X$SOFT_REENABLE_ASTS +#define xmArrowButtonWidgetClass XMARROWBUTTONWIDGETCLASS +#define xmBulletinBoardWidgetClass XMBULLETINBOARDWIDGETCLASS +#define xmCascadeButtonClassRec XMCASCADEBUTTONCLASSREC +#define xmCascadeButtonGadgetClass XMCASCADEBUTTONGADGETCLASS +#define xmCascadeButtonWidgetClass XMCASCADEBUTTONWIDGETCLASS +#define xmCommandWidgetClass XMCOMMANDWIDGETCLASS +#define xmDialogShellWidgetClass XMDIALOGSHELLWIDGETCLASS +#define xmDrawingAreaWidgetClass XMDRAWINGAREAWIDGETCLASS +#define xmDrawnButtonWidgetClass XMDRAWNBUTTONWIDGETCLASS +#define xmFileSelectionBoxWidgetClass XMFILESELECTIONBOXWIDGETCLASS +#define xmFormWidgetClass XMFORMWIDGETCLASS +#define xmFrameWidgetClass XMFRAMEWIDGETCLASS +#define xmGadgetClass XMGADGETCLASS +#define xmLabelGadgetClass XMLABELGADGETCLASS +#define xmLabelWidgetClass XMLABELWIDGETCLASS +#define xmListWidgetClass XMLISTWIDGETCLASS +#define xmMainWindowWidgetClass XMMAINWINDOWWIDGETCLASS +#define xmManagerClassRec XMMANAGERCLASSREC +#define xmManagerWidgetClass XMMANAGERWIDGETCLASS +#define xmMenuShellWidgetClass XMMENUSHELLWIDGETCLASS +#define xmMessageBoxWidgetClass XMMESSAGEBOXWIDGETCLASS +#define xmPrimitiveClassRec XMPRIMITIVECLASSREC +#define xmPrimitiveWidgetClass XMPRIMITIVEWIDGETCLASS +#define xmPushButtonClassRec XMPUSHBUTTONCLASSREC +#define xmPushButtonGadgetClass XMPUSHBUTTONGADGETCLASS +#define xmPushButtonWidgetClass XMPUSHBUTTONWIDGETCLASS +#define xmRowColumnWidgetClass XMROWCOLUMNWIDGETCLASS +#define xmSashWidgetClass XMSASHWIDGETCLASS +#define xmScaleWidgetClass XMSCALEWIDGETCLASS +#define xmScrollBarWidgetClass XMSCROLLBARWIDGETCLASS +#define xmScrolledWindowClassRec XMSCROLLEDWINDOWCLASSREC +#define xmScrolledWindowWidgetClass XMSCROLLEDWINDOWWIDGETCLASS +#define xmSeparatorGadgetClass XMSEPARATORGADGETCLASS +#define xmSeparatorWidgetClass XMSEPARATORWIDGETCLASS +#define xmTextFieldWidgetClass XMTEXTFIELDWIDGETCLASS +#define xmTextWidgetClass XMTEXTWIDGETCLASS +#define xmToggleButtonGadgetClass XMTOGGLEBUTTONGADGETCLASS +#define xmToggleButtonWidgetClass XMTOGGLEBUTTONWIDGETCLASS + +#if (__VMS_VER < 80200000) +# define SetReqLen(req,n,badlen) \ + if ((req->length + n) > (unsigned)65535) { \ + n = badlen; \ + req->length += n; \ + } else \ + req->length += n +#endif + +#ifdef __cplusplus +extern "C" { +#endif +extern void XtFree(char*); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/lib/wxWidgets/include/wx/volume.h b/lib/wxWidgets/include/wx/volume.h new file mode 100644 index 0000000..fd6a837 --- /dev/null +++ b/lib/wxWidgets/include/wx/volume.h @@ -0,0 +1,145 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/volume.h +// Purpose: wxFSVolume - encapsulates system volume information +// Author: George Policello +// Modified by: +// Created: 28 Jan 02 +// Copyright: (c) 2002 George Policello +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ---------------------------------------------------------------------------- +// wxFSVolume represents a volume/drive in a file system +// ---------------------------------------------------------------------------- + +#ifndef _WX_FSVOLUME_H_ +#define _WX_FSVOLUME_H_ + +#include "wx/defs.h" + +#if wxUSE_FSVOLUME + +#include "wx/arrstr.h" + +// the volume flags +enum wxFSVolumeFlags +{ + // is the volume mounted? + wxFS_VOL_MOUNTED = 0x0001, + + // is the volume removable (floppy, CD, ...)? + wxFS_VOL_REMOVABLE = 0x0002, + + // read only? (otherwise read write) + wxFS_VOL_READONLY = 0x0004, + + // network resources + wxFS_VOL_REMOTE = 0x0008 +}; + +// the volume types +enum wxFSVolumeKind +{ + wxFS_VOL_FLOPPY, + wxFS_VOL_DISK, + wxFS_VOL_CDROM, + wxFS_VOL_DVDROM, + wxFS_VOL_NETWORK, + wxFS_VOL_OTHER, + wxFS_VOL_MAX +}; + +class WXDLLIMPEXP_BASE wxFSVolumeBase +{ +public: + // return the array containing the names of the volumes + // + // only the volumes with the flags such that + // (flags & flagsSet) == flagsSet && !(flags & flagsUnset) + // are returned (by default, all mounted ones) + static wxArrayString GetVolumes(int flagsSet = wxFS_VOL_MOUNTED, + int flagsUnset = 0); + + // stop execution of GetVolumes() called previously (should be called from + // another thread, of course) + static void CancelSearch(); + + // create the volume object with this name (should be one of those returned + // by GetVolumes()). + wxFSVolumeBase(); + wxFSVolumeBase(const wxString& name); + bool Create(const wxString& name); + + // accessors + // --------- + + // is this a valid volume? + bool IsOk() const; + + // kind of this volume? + wxFSVolumeKind GetKind() const; + + // flags of this volume? + int GetFlags() const; + + // can we write to this volume? + bool IsWritable() const { return !(GetFlags() & wxFS_VOL_READONLY); } + + // get the name of the volume and the name which should be displayed to the + // user + wxString GetName() const { return m_volName; } + wxString GetDisplayName() const { return m_dispName; } + + // TODO: operatios (Mount(), Unmount(), Eject(), ...)? + +protected: + // the internal volume name + wxString m_volName; + + // the volume name as it is displayed to the user + wxString m_dispName; + + // have we been initialized correctly? + bool m_isOk; +}; + +#if wxUSE_GUI + +#include "wx/icon.h" +#include "wx/iconbndl.h" // only for wxIconArray + +enum wxFSIconType +{ + wxFS_VOL_ICO_SMALL = 0, + wxFS_VOL_ICO_LARGE, + wxFS_VOL_ICO_SEL_SMALL, + wxFS_VOL_ICO_SEL_LARGE, + wxFS_VOL_ICO_MAX +}; + +// wxFSVolume adds GetIcon() to wxFSVolumeBase +class WXDLLIMPEXP_CORE wxFSVolume : public wxFSVolumeBase +{ +public: + wxFSVolume() : wxFSVolumeBase() { InitIcons(); } + wxFSVolume(const wxString& name) : wxFSVolumeBase(name) { InitIcons(); } + + wxIcon GetIcon(wxFSIconType type) const; + +private: + void InitIcons(); + + // the different icons for this volume (created on demand) + wxIconArray m_icons; +}; + +#else // !wxUSE_GUI + +// wxFSVolume is the same thing as wxFSVolume in wxBase +typedef wxFSVolumeBase wxFSVolume; + +#endif // wxUSE_GUI/!wxUSE_GUI + +#endif // wxUSE_FSVOLUME + +#endif // _WX_FSVOLUME_H_ diff --git a/lib/wxWidgets/include/wx/vscroll.h b/lib/wxWidgets/include/wx/vscroll.h new file mode 100644 index 0000000..1c062b4 --- /dev/null +++ b/lib/wxWidgets/include/wx/vscroll.h @@ -0,0 +1,871 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/vscroll.h +// Purpose: Variable scrolled windows (wx[V/H/HV]ScrolledWindow) +// Author: Vadim Zeitlin +// Modified by: Brad Anderson, Bryan Petty +// Created: 30.05.03 +// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_VSCROLL_H_ +#define _WX_VSCROLL_H_ + +#include "wx/panel.h" +#include "wx/position.h" +#include "wx/scrolwin.h" + +class WXDLLIMPEXP_FWD_CORE wxVarScrollHelperEvtHandler; + + +// Using the same techniques as the wxScrolledWindow class | +// hierarchy, the wx[V/H/HV]ScrolledWindow classes are slightly | +// more complex (compare with the diagram outlined in | +// scrolwin.h) for the purpose of reducing code duplication | +// through the use of mix-in classes. | +// | +// wxAnyScrollHelperBase | +// | | +// | | +// | | +// V | +// wxVarScrollHelperBase | +// / \ | +// / \ | +// V V | +// wxVarHScrollHelper wxVarVScrollHelper | +// | \ / | | +// | \ / | | +// | V V | | +// | wxVarHVScrollHelper | | +// | | | | +// | | V | +// | wxPanel | wxVarVScrollLegacyAdaptor | +// | / \ \ | | | +// | / \ `-----|----------. | | +// | / \ | \ | | +// | / \ | \ | | +// V V \ | V V | +// wxHScrolledWindow \ | wxVScrolledWindow | +// V V | +// wxHVScrolledWindow | +// | +// | +// Border added to suppress GCC multi-line comment warnings ->| + + +// =========================================================================== +// wxVarScrollHelperBase +// =========================================================================== + +// Provides all base common scroll calculations needed for either orientation, +// automatic scrollbar functionality, saved scroll positions, functionality +// for changing the target window to be scrolled, as well as defining all +// required virtual functions that need to be implemented for any orientation +// specific work. + +class WXDLLIMPEXP_CORE wxVarScrollHelperBase : public wxAnyScrollHelperBase +{ +public: + // constructors and such + // --------------------- + + wxVarScrollHelperBase(wxWindow *winToScroll); + virtual ~wxVarScrollHelperBase(); + + // operations + // ---------- + + // with physical scrolling on, the device origin is changed properly when + // a wxPaintDC is prepared, children are actually moved and laid out + // properly, and the contents of the window (pixels) are actually moved + void EnablePhysicalScrolling(bool scrolling = true) + { m_physicalScrolling = scrolling; } + + // wxNOT_FOUND if none, i.e. if it is below the last item + int VirtualHitTest(wxCoord coord) const; + + // recalculate all our parameters and redisplay all units + virtual void RefreshAll(); + + // accessors + // --------- + + // get the first currently visible unit + size_t GetVisibleBegin() const { return m_unitFirst; } + + // get the last currently visible unit + size_t GetVisibleEnd() const + { return m_unitFirst + m_nUnitsVisible; } + + // is this unit currently visible? + bool IsVisible(size_t unit) const + { return unit >= m_unitFirst && unit < GetVisibleEnd(); } + + // translate between scrolled and unscrolled coordinates + int CalcScrolledPosition(int coord) const + { return DoCalcScrolledPosition(coord); } + int CalcUnscrolledPosition(int coord) const + { return DoCalcUnscrolledPosition(coord); } + + virtual int DoCalcScrolledPosition(int coord) const; + virtual int DoCalcUnscrolledPosition(int coord) const; + + // update the thumb size shown by the scrollbar + virtual void UpdateScrollbar(); + void RemoveScrollbar(); + + // Normally the wxScrolledWindow will scroll itself, but in some rare + // occasions you might want it to scroll [part of] another window (e.g. a + // child of it in order to scroll only a portion the area between the + // scrollbars (spreadsheet: only cell area will move). + virtual void SetTargetWindow(wxWindow *target); + + // change the DC origin according to the scroll position. To properly + // forward calls to wxWindow::Layout use WX_FORWARD_TO_SCROLL_HELPER() + // derived class + virtual void DoPrepareDC(wxDC& dc) wxOVERRIDE; + + // the methods to be called from the window event handlers + void HandleOnScroll(wxScrollWinEvent& event); + void HandleOnSize(wxSizeEvent& event); +#if wxUSE_MOUSEWHEEL + void HandleOnMouseWheel(wxMouseEvent& event); +#endif // wxUSE_MOUSEWHEEL + + // these functions must be overridden in the derived class to return + // orientation specific data (e.g. the width for vertically scrolling + // derivatives in the case of GetOrientationTargetSize()) + virtual int GetOrientationTargetSize() const = 0; + virtual int GetNonOrientationTargetSize() const = 0; + virtual wxOrientation GetOrientation() const = 0; + +protected: + // all *Unit* functions are protected to be exposed by + // wxVarScrollHelperBase implementations (with appropriate names) + + // get the number of units this window contains (previously set by + // SetUnitCount()) + size_t GetUnitCount() const { return m_unitMax; } + + // set the number of units the helper contains: the derived class must + // provide the sizes for all units with indices up to the one given here + // in its OnGetUnitSize() + void SetUnitCount(size_t count); + + // redraw the specified unit + virtual void RefreshUnit(size_t unit); + + // redraw all units in the specified range (inclusive) + virtual void RefreshUnits(size_t from, size_t to); + + // scroll to the specified unit: it will become the first visible unit in + // the window + // + // return true if we scrolled the window, false if nothing was done + bool DoScrollToUnit(size_t unit); + + // scroll by the specified number of units/pages + virtual bool DoScrollUnits(int units); + virtual bool DoScrollPages(int pages); + + // this function must be overridden in the derived class and it should + // return the size of the given unit in pixels + virtual wxCoord OnGetUnitSize(size_t n) const = 0; + + // this function doesn't have to be overridden but it may be useful to do + // it if calculating the units' sizes is a relatively expensive operation + // as it gives the user code a possibility to calculate several of them at + // once + // + // OnGetUnitsSizeHint() is normally called just before OnGetUnitSize() but + // you shouldn't rely on the latter being called for all units in the + // interval specified here. It is also possible that OnGetUnitHeight() will + // be called for the units outside of this interval, so this is really just + // a hint, not a promise. + // + // finally note that unitMin is inclusive, while unitMax is exclusive, as + // usual + virtual void OnGetUnitsSizeHint(size_t WXUNUSED(unitMin), + size_t WXUNUSED(unitMax)) const + { } + + // when the number of units changes, we try to estimate the total size + // of all units which is a rather expensive operation in terms of unit + // access, so if the user code may estimate the average size + // better/faster than we do, it should override this function to implement + // its own logic + // + // this function should return the best guess for the total size it may + // make + virtual wxCoord EstimateTotalSize() const { return DoEstimateTotalSize(); } + + wxCoord DoEstimateTotalSize() const; + + // find the index of the unit we need to show to fit the specified unit on + // the opposite side either fully or partially (depending on fullyVisible) + size_t FindFirstVisibleFromLast(size_t last, + bool fullyVisible = false) const; + + // get the total size of the units between unitMin (inclusive) and + // unitMax (exclusive) + wxCoord GetUnitsSize(size_t unitMin, size_t unitMax) const; + + // get the offset of the first visible unit + wxCoord GetScrollOffset() const + { return GetUnitsSize(0, GetVisibleBegin()); } + + // get the size of the target window + wxSize GetTargetSize() const { return m_targetWindow->GetClientSize(); } + + void GetTargetSize(int *w, int *h) + { + wxSize size = GetTargetSize(); + if ( w ) + *w = size.x; + if ( h ) + *h = size.y; + } + + // calculate the new scroll position based on scroll event type + size_t GetNewScrollPosition(wxScrollWinEvent& event) const; + + // replacement implementation of wxWindow::Layout virtual method. To + // properly forward calls to wxWindow::Layout use + // WX_FORWARD_TO_SCROLL_HELPER() derived class + bool ScrollLayout(); + +#ifdef __WXMAC__ + // queue mac window update after handling scroll event + virtual void UpdateMacScrollWindow() { } +#endif // __WXMAC__ + + // change the target window + void DoSetTargetWindow(wxWindow *target); + + // delete the event handler we installed + void DeleteEvtHandler(); + + // helper function abstracting the orientation test: with vertical + // orientation, it assigns the first value to x and the second one to y, + // with horizontal orientation it reverses them, i.e. the first value is + // assigned to y and the second one to x + void AssignOrient(wxCoord& x, wxCoord& y, wxCoord first, wxCoord second); + + // similar to "oriented assignment" above but does "oriented increment": + // for vertical orientation, y is incremented by the given value and x if + // left unchanged, for horizontal orientation x is incremented + void IncOrient(wxCoord& x, wxCoord& y, wxCoord inc); + +private: + // the total number of (logical) units + size_t m_unitMax; + + // the total (estimated) size + wxCoord m_sizeTotal; + + // the first currently visible unit + size_t m_unitFirst; + + // the number of currently visible units (including the last, possibly only + // partly, visible one) + size_t m_nUnitsVisible; + + // accumulated mouse wheel rotation +#if wxUSE_MOUSEWHEEL + int m_sumWheelRotation; +#endif + + // do child scrolling (used in DoPrepareDC()) + bool m_physicalScrolling; + + // handler injected into target window to forward some useful events to us + wxVarScrollHelperEvtHandler *m_handler; +}; + + + +// =========================================================================== +// wxVarVScrollHelper +// =========================================================================== + +// Provides public API functions targeted for vertical-specific scrolling, +// wrapping the functionality of wxVarScrollHelperBase. + +class WXDLLIMPEXP_CORE wxVarVScrollHelper : public wxVarScrollHelperBase +{ +public: + // constructors and such + // --------------------- + + // ctor must be given the associated window + wxVarVScrollHelper(wxWindow *winToScroll) + : wxVarScrollHelperBase(winToScroll) + { + } + + // operators + + void SetRowCount(size_t rowCount) { SetUnitCount(rowCount); } + bool ScrollToRow(size_t row) { return DoScrollToUnit(row); } + + virtual bool ScrollRows(int rows) + { return DoScrollUnits(rows); } + virtual bool ScrollRowPages(int pages) + { return DoScrollPages(pages); } + + virtual void RefreshRow(size_t row) + { RefreshUnit(row); } + virtual void RefreshRows(size_t from, size_t to) + { RefreshUnits(from, to); } + + // accessors + + size_t GetRowCount() const { return GetUnitCount(); } + size_t GetVisibleRowsBegin() const { return GetVisibleBegin(); } + size_t GetVisibleRowsEnd() const { return GetVisibleEnd(); } + bool IsRowVisible(size_t row) const { return IsVisible(row); } + + virtual int GetOrientationTargetSize() const wxOVERRIDE + { return GetTargetWindow()->GetClientSize().y; } + virtual int GetNonOrientationTargetSize() const wxOVERRIDE + { return GetTargetWindow()->GetClientSize().x; } + virtual wxOrientation GetOrientation() const wxOVERRIDE { return wxVERTICAL; } + +protected: + // this function must be overridden in the derived class and it should + // return the size of the given row in pixels + virtual wxCoord OnGetRowHeight(size_t n) const = 0; + wxCoord OnGetUnitSize(size_t n) const wxOVERRIDE { return OnGetRowHeight(n); } + + virtual void OnGetRowsHeightHint(size_t WXUNUSED(rowMin), + size_t WXUNUSED(rowMax)) const { } + + // forward calls to OnGetRowsHeightHint() + virtual void OnGetUnitsSizeHint(size_t unitMin, size_t unitMax) const wxOVERRIDE + { OnGetRowsHeightHint(unitMin, unitMax); } + + // again, if not overridden, it will fall back on default method + virtual wxCoord EstimateTotalHeight() const + { return DoEstimateTotalSize(); } + + // forward calls to EstimateTotalHeight() + virtual wxCoord EstimateTotalSize() const wxOVERRIDE { return EstimateTotalHeight(); } + + wxCoord GetRowsHeight(size_t rowMin, size_t rowMax) const + { return GetUnitsSize(rowMin, rowMax); } +}; + + + +// =========================================================================== +// wxVarHScrollHelper +// =========================================================================== + +// Provides public API functions targeted for horizontal-specific scrolling, +// wrapping the functionality of wxVarScrollHelperBase. + +class WXDLLIMPEXP_CORE wxVarHScrollHelper : public wxVarScrollHelperBase +{ +public: + // constructors and such + // --------------------- + + // ctor must be given the associated window + wxVarHScrollHelper(wxWindow *winToScroll) + : wxVarScrollHelperBase(winToScroll) + { + } + + // operators + + void SetColumnCount(size_t columnCount) + { SetUnitCount(columnCount); } + + bool ScrollToColumn(size_t column) + { return DoScrollToUnit(column); } + virtual bool ScrollColumns(int columns) + { return DoScrollUnits(columns); } + virtual bool ScrollColumnPages(int pages) + { return DoScrollPages(pages); } + + virtual void RefreshColumn(size_t column) + { RefreshUnit(column); } + virtual void RefreshColumns(size_t from, size_t to) + { RefreshUnits(from, to); } + + // accessors + + size_t GetColumnCount() const + { return GetUnitCount(); } + size_t GetVisibleColumnsBegin() const + { return GetVisibleBegin(); } + size_t GetVisibleColumnsEnd() const + { return GetVisibleEnd(); } + bool IsColumnVisible(size_t column) const + { return IsVisible(column); } + + + virtual int GetOrientationTargetSize() const wxOVERRIDE + { return GetTargetWindow()->GetClientSize().x; } + virtual int GetNonOrientationTargetSize() const wxOVERRIDE + { return GetTargetWindow()->GetClientSize().y; } + virtual wxOrientation GetOrientation() const wxOVERRIDE { return wxHORIZONTAL; } + +protected: + // this function must be overridden in the derived class and it should + // return the size of the given column in pixels + virtual wxCoord OnGetColumnWidth(size_t n) const = 0; + wxCoord OnGetUnitSize(size_t n) const wxOVERRIDE { return OnGetColumnWidth(n); } + + virtual void OnGetColumnsWidthHint(size_t WXUNUSED(columnMin), + size_t WXUNUSED(columnMax)) const + { } + + // forward calls to OnGetColumnsWidthHint() + virtual void OnGetUnitsSizeHint(size_t unitMin, size_t unitMax) const wxOVERRIDE + { OnGetColumnsWidthHint(unitMin, unitMax); } + + // again, if not overridden, it will fall back on default method + virtual wxCoord EstimateTotalWidth() const { return DoEstimateTotalSize(); } + + // forward calls to EstimateTotalWidth() + virtual wxCoord EstimateTotalSize() const wxOVERRIDE { return EstimateTotalWidth(); } + + wxCoord GetColumnsWidth(size_t columnMin, size_t columnMax) const + { return GetUnitsSize(columnMin, columnMax); } +}; + + + +// =========================================================================== +// wxVarHVScrollHelper +// =========================================================================== + +// Provides public API functions targeted at functions with similar names in +// both wxVScrollHelper and wxHScrollHelper so class scope doesn't need to be +// specified (since we are using multiple inheritance). It also provides +// functions to make changing values for both orientations at the same time +// easier. + +class WXDLLIMPEXP_CORE wxVarHVScrollHelper : public wxVarVScrollHelper, + public wxVarHScrollHelper +{ +public: + // constructors and such + // --------------------- + + // ctor must be given the associated window + wxVarHVScrollHelper(wxWindow *winToScroll) + : wxVarVScrollHelper(winToScroll), wxVarHScrollHelper(winToScroll) { } + + // operators + // --------- + + // set the number of units the window contains for each axis: the derived + // class must provide the widths and heights for all units with indices up + // to each of the one given here in its OnGetColumnWidth() and + // OnGetRowHeight() + void SetRowColumnCount(size_t rowCount, size_t columnCount); + + + // with physical scrolling on, the device origin is changed properly when + // a wxPaintDC is prepared, children are actually moved and laid out + // properly, and the contents of the window (pixels) are actually moved + void EnablePhysicalScrolling(bool vscrolling = true, bool hscrolling = true) + { + wxVarVScrollHelper::EnablePhysicalScrolling(vscrolling); + wxVarHScrollHelper::EnablePhysicalScrolling(hscrolling); + } + + // scroll to the specified row/column: it will become the first visible + // cell in the window + // + // return true if we scrolled the window, false if nothing was done + bool ScrollToRowColumn(size_t row, size_t column); + bool ScrollToRowColumn(const wxPosition &pos) + { return ScrollToRowColumn(pos.GetRow(), pos.GetColumn()); } + + // redraw the specified cell + virtual void RefreshRowColumn(size_t row, size_t column); + virtual void RefreshRowColumn(const wxPosition &pos) + { RefreshRowColumn(pos.GetRow(), pos.GetColumn()); } + + // redraw the specified regions (inclusive). If the target window for + // both orientations is the same the rectangle of cells is refreshed; if + // the target windows differ the entire client size opposite the + // orientation direction is refreshed between the specified limits + virtual void RefreshRowsColumns(size_t fromRow, size_t toRow, + size_t fromColumn, size_t toColumn); + virtual void RefreshRowsColumns(const wxPosition& from, + const wxPosition& to) + { + RefreshRowsColumns(from.GetRow(), to.GetRow(), + from.GetColumn(), to.GetColumn()); + } + + // locate the virtual position from the given device coordinates + wxPosition VirtualHitTest(wxCoord x, wxCoord y) const; + wxPosition VirtualHitTest(const wxPoint &pos) const + { return VirtualHitTest(pos.x, pos.y); } + + // change the DC origin according to the scroll position. To properly + // forward calls to wxWindow::Layout use WX_FORWARD_TO_SCROLL_HELPER() + // derived class. We use this version to call both base classes' + // DoPrepareDC() + virtual void DoPrepareDC(wxDC& dc) wxOVERRIDE; + + // replacement implementation of wxWindow::Layout virtual method. To + // properly forward calls to wxWindow::Layout use + // WX_FORWARD_TO_SCROLL_HELPER() derived class. We use this version to + // call both base classes' ScrollLayout() + bool ScrollLayout(); + + // accessors + // --------- + + // get the number of units this window contains (previously set by + // Set[Column/Row/RowColumn/Unit]Count()) + wxSize GetRowColumnCount() const; + + // get the first currently visible units + wxPosition GetVisibleBegin() const; + wxPosition GetVisibleEnd() const; + + // is this cell currently visible? + bool IsVisible(size_t row, size_t column) const; + bool IsVisible(const wxPosition &pos) const + { return IsVisible(pos.GetRow(), pos.GetColumn()); } +}; + + + +#if WXWIN_COMPATIBILITY_2_8 + +// =========================================================================== +// wxVarVScrollLegacyAdaptor +// =========================================================================== + +// Provides backwards compatible API for applications originally built using +// wxVScrolledWindow in 2.6 or 2.8. Originally, wxVScrolledWindow referred +// to scrolling "lines". We use "units" in wxVarScrollHelperBase to avoid +// implying any orientation (since the functions are used for both horizontal +// and vertical scrolling in derived classes). And in the new +// wxVScrolledWindow and wxHScrolledWindow classes, we refer to them as +// "rows" and "columns", respectively. This is to help clear some confusion +// in not only those classes, but also in wxHVScrolledWindow where functions +// are inherited from both. + +class WXDLLIMPEXP_CORE wxVarVScrollLegacyAdaptor : public wxVarVScrollHelper +{ +public: + // constructors and such + // --------------------- + wxVarVScrollLegacyAdaptor(wxWindow *winToScroll) + : wxVarVScrollHelper(winToScroll) + { + } + + // accessors + // --------- + + // this is the same as GetVisibleRowsBegin(), exists to match + // GetLastVisibleLine() and for backwards compatibility only + wxDEPRECATED( size_t GetFirstVisibleLine() const ); + + // get the last currently visible line + // + // this function is unsafe as it returns (size_t)-1 (i.e. a huge positive + // number) if the control is empty, use GetVisibleRowsEnd() instead, this + // one is kept for backwards compatibility + wxDEPRECATED( size_t GetLastVisibleLine() const ); + + // "line" to "unit" compatibility functions + // ---------------------------------------- + + // get the number of lines this window contains (set by SetLineCount()) + wxDEPRECATED( size_t GetLineCount() const ); + + // set the number of lines the helper contains: the derived class must + // provide the sizes for all lines with indices up to the one given here + // in its OnGetLineHeight() + wxDEPRECATED( void SetLineCount(size_t count) ); + + // redraw the specified line + wxDEPRECATED( virtual void RefreshLine(size_t line) ); + + // redraw all lines in the specified range (inclusive) + wxDEPRECATED( virtual void RefreshLines(size_t from, size_t to) ); + + // scroll to the specified line: it will become the first visible line in + // the window + // + // return true if we scrolled the window, false if nothing was done + wxDEPRECATED( bool ScrollToLine(size_t line) ); + + // scroll by the specified number of lines/pages + wxDEPRECATED( virtual bool ScrollLines(int lines) ); + wxDEPRECATED( virtual bool ScrollPages(int pages) ); + +protected: + // unless the code has been updated to override OnGetRowHeight() instead, + // this function must be overridden in the derived class and it should + // return the height of the given row in pixels + wxDEPRECATED_BUT_USED_INTERNALLY( + virtual wxCoord OnGetLineHeight(size_t n) const ); + + // forwards the calls from base class pure virtual function to pure virtual + // OnGetLineHeight instead (backwards compatible name) + // note that we don't need to forward OnGetUnitSize() as it is already + // forwarded to OnGetRowHeight() in wxVarVScrollHelper + virtual wxCoord OnGetRowHeight(size_t n) const wxOVERRIDE; + + // this function doesn't have to be overridden but it may be useful to do + // it if calculating the lines heights is a relatively expensive operation + // as it gives the user code a possibility to calculate several of them at + // once + // + // OnGetLinesHint() is normally called just before OnGetLineHeight() but you + // shouldn't rely on the latter being called for all lines in the interval + // specified here. It is also possible that OnGetLineHeight() will be + // called for the lines outside of this interval, so this is really just a + // hint, not a promise. + // + // finally note that lineMin is inclusive, while lineMax is exclusive, as + // usual + wxDEPRECATED_BUT_USED_INTERNALLY( virtual void OnGetLinesHint( + size_t lineMin, size_t lineMax) const ); + + // forwards the calls from base class pure virtual function to pure virtual + // OnGetLinesHint instead (backwards compatible name) + void OnGetRowsHeightHint(size_t rowMin, size_t rowMax) const wxOVERRIDE; +}; + +#else // !WXWIN_COMPATIBILITY_2_8 + +// shortcut to avoid checking compatibility modes later +// remove this and all references to wxVarVScrollLegacyAdaptor once +// wxWidgets 2.6 and 2.8 compatibility is removed +typedef wxVarVScrollHelper wxVarVScrollLegacyAdaptor; + +#endif // WXWIN_COMPATIBILITY_2_8/!WXWIN_COMPATIBILITY_2_8 + + +// this macro must be used in declaration of wxVarScrollHelperBase-derived +// classes +#define WX_FORWARD_TO_VAR_SCROLL_HELPER() \ +public: \ + virtual void PrepareDC(wxDC& dc) wxOVERRIDE { DoPrepareDC(dc); } \ + virtual bool Layout() wxOVERRIDE { return ScrollLayout(); } + + + +// =========================================================================== +// wxVScrolledWindow +// =========================================================================== + +// In the name of this class, "V" may stand for "variable" because it can be +// used for scrolling rows of variable heights; "virtual", because it is not +// necessary to know the heights of all rows in advance -- only those which +// are shown on the screen need to be measured; or even "vertical", because +// this class only supports scrolling vertically. + +// In any case, this is a generalization of the wxScrolledWindow class which +// can be only used when all rows have the same heights. It lacks some other +// wxScrolledWindow features however, notably it can't scroll only a rectangle +// of the window and not its entire client area. + +class WXDLLIMPEXP_CORE wxVScrolledWindow : public wxPanel, + public wxVarVScrollLegacyAdaptor +{ +public: + // constructors and such + // --------------------- + + // default ctor, you must call Create() later + wxVScrolledWindow() : wxVarVScrollLegacyAdaptor(this) { } + + // normal ctor, no need to call Create() after this one + // + // note that wxVSCROLL is always automatically added to our style, there is + // no need to specify it explicitly + wxVScrolledWindow(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)) + : wxVarVScrollLegacyAdaptor(this) + { + (void)Create(parent, id, pos, size, style, name); + } + + // same as the previous ctor but returns status code: true if ok + // + // just as with the ctor above, wxVSCROLL style is always used, there is no + // need to specify it + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)) + { + return wxPanel::Create(parent, id, pos, size, style | wxVSCROLL, name); + } + +#if WXWIN_COMPATIBILITY_2_8 + // Make sure we prefer our version of HitTest rather than wxWindow's + // These functions should no longer be masked in favor of VirtualHitTest() + int HitTest(wxCoord WXUNUSED(x), wxCoord y) const + { return wxVarVScrollHelper::VirtualHitTest(y); } + int HitTest(const wxPoint& pt) const + { return HitTest(pt.x, pt.y); } +#endif // WXWIN_COMPATIBILITY_2_8 + + WX_FORWARD_TO_VAR_SCROLL_HELPER() + +#ifdef __WXMAC__ +protected: + virtual void UpdateMacScrollWindow() wxOVERRIDE { Update(); } +#endif // __WXMAC__ + +private: + wxDECLARE_NO_COPY_CLASS(wxVScrolledWindow); + wxDECLARE_ABSTRACT_CLASS(wxVScrolledWindow); +}; + + + +// =========================================================================== +// wxHScrolledWindow +// =========================================================================== + +// In the name of this class, "H" stands for "horizontal" because it can be +// used for scrolling columns of variable widths. It is not necessary to know +// the widths of all columns in advance -- only those which are shown on the +// screen need to be measured. + +// This is a generalization of the wxScrolledWindow class which can be only +// used when all columns have the same width. It lacks some other +// wxScrolledWindow features however, notably it can't scroll only a rectangle +// of the window and not its entire client area. + +class WXDLLIMPEXP_CORE wxHScrolledWindow : public wxPanel, + public wxVarHScrollHelper +{ +public: + // constructors and such + // --------------------- + + // default ctor, you must call Create() later + wxHScrolledWindow() : wxVarHScrollHelper(this) { } + + // normal ctor, no need to call Create() after this one + // + // note that wxHSCROLL is always automatically added to our style, there is + // no need to specify it explicitly + wxHScrolledWindow(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)) + : wxVarHScrollHelper(this) + { + (void)Create(parent, id, pos, size, style, name); + } + + // same as the previous ctor but returns status code: true if ok + // + // just as with the ctor above, wxHSCROLL style is always used, there is no + // need to specify it + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)) + { + return wxPanel::Create(parent, id, pos, size, style | wxHSCROLL, name); + } + + WX_FORWARD_TO_VAR_SCROLL_HELPER() + +#ifdef __WXMAC__ +protected: + virtual void UpdateMacScrollWindow() wxOVERRIDE { Update(); } +#endif // __WXMAC__ + +private: + wxDECLARE_NO_COPY_CLASS(wxHScrolledWindow); + wxDECLARE_ABSTRACT_CLASS(wxHScrolledWindow); +}; + + + +// =========================================================================== +// wxHVScrolledWindow +// =========================================================================== + +// This window inherits all functionality of both vertical and horizontal +// scrolled windows automatically handling everything needed to scroll both +// axis simultaneously. + +class WXDLLIMPEXP_CORE wxHVScrolledWindow : public wxPanel, + public wxVarHVScrollHelper +{ +public: + // constructors and such + // --------------------- + + // default ctor, you must call Create() later + wxHVScrolledWindow() + : wxPanel(), + wxVarHVScrollHelper(this) { } + + // normal ctor, no need to call Create() after this one + // + // note that wxVSCROLL and wxHSCROLL are always automatically added to our + // style, there is no need to specify them explicitly + wxHVScrolledWindow(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)) + : wxPanel(), + wxVarHVScrollHelper(this) + { + (void)Create(parent, id, pos, size, style, name); + } + + // same as the previous ctor but returns status code: true if ok + // + // just as with the ctor above, wxVSCROLL and wxHSCROLL styles are always + // used, there is no need to specify them + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)) + { + return wxPanel::Create(parent, id, pos, size, + style | wxVSCROLL | wxHSCROLL, name); + } + + WX_FORWARD_TO_VAR_SCROLL_HELPER() + +#ifdef __WXMAC__ +protected: + virtual void UpdateMacScrollWindow() wxOVERRIDE { Update(); } +#endif // __WXMAC__ + +private: + wxDECLARE_NO_COPY_CLASS(wxHVScrolledWindow); + wxDECLARE_ABSTRACT_CLASS(wxHVScrolledWindow); +}; + +#endif // _WX_VSCROLL_H_ + diff --git a/lib/wxWidgets/include/wx/weakref.h b/lib/wxWidgets/include/wx/weakref.h new file mode 100644 index 0000000..25e2306 --- /dev/null +++ b/lib/wxWidgets/include/wx/weakref.h @@ -0,0 +1,227 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/weakref.h +// Purpose: wxWeakRef - Generic weak references for wxWidgets +// Author: Arne Steinarson +// Created: 27 Dec 07 +// Copyright: (c) 2007 Arne Steinarson +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WEAKREF_H_ +#define _WX_WEAKREF_H_ + +#include "wx/tracker.h" + + +#include "wx/meta/convertible.h" +#include "wx/meta/int2type.h" + +template <class T> +struct wxIsStaticTrackable +{ + enum { value = wxIsPubliclyDerived<T, wxTrackable>::value }; +}; + + +// A weak reference to an object of type T (which must inherit from wxTrackable) +template <class T> +class wxWeakRef : public wxTrackerNode +{ +public: + typedef T element_type; + + // Default ctor + wxWeakRef() : m_pobj(NULL), m_ptbase(NULL) { } + + // Ctor from the object of this type: this is needed as the template ctor + // below is not used by at least g++4 when a literal NULL is used + wxWeakRef(T *pobj) : m_pobj(NULL), m_ptbase(NULL) + { + this->Assign(pobj); + } + + // When we have the full type here, static_cast<> will always work + // (or give a straight compiler error). + template <class TDerived> + wxWeakRef(TDerived* pobj) : m_pobj(NULL), m_ptbase(NULL) + { + this->Assign(pobj); + } + + // We need this copy ctor, since otherwise a default compiler (binary) copy + // happens (if embedded as an object member). + wxWeakRef(const wxWeakRef<T>& wr) : m_pobj(NULL), m_ptbase(NULL) + { + this->Assign(wr.get()); + } + + wxWeakRef<T>& operator=(const wxWeakRef<T>& wr) + { + this->AssignCopy(wr); + return *this; + } + + virtual ~wxWeakRef() { this->Release(); } + + // Smart pointer functions + T& operator*() const { return *this->m_pobj; } + T* operator->() const { return this->m_pobj; } + + T* get() const { return this->m_pobj; } + operator T*() const { return this->m_pobj; } + +public: + void Release() + { + // Release old object if any + if ( m_pobj ) + { + // Remove ourselves from object tracker list + m_ptbase->RemoveNode(this); + m_pobj = NULL; + m_ptbase = NULL; + } + } + + virtual void OnObjectDestroy() wxOVERRIDE + { + // Tracked object itself removes us from list of trackers + wxASSERT(m_pobj != NULL); + m_pobj = NULL; + m_ptbase = NULL; + } + +protected: + // Assign receives most derived class here and can use that + template <class TDerived> + void Assign( TDerived* pobj ) + { + wxCOMPILE_TIME_ASSERT( wxIsStaticTrackable<TDerived>::value, + Tracked_class_should_inherit_from_wxTrackable ); + wxTrackable *ptbase = static_cast<wxTrackable*>(pobj); + DoAssign(pobj, ptbase); + } + + void AssignCopy(const wxWeakRef& wr) + { + DoAssign(wr.m_pobj, wr.m_ptbase); + } + + void DoAssign(T* pobj, wxTrackable *ptbase) + { + if ( m_pobj == pobj ) + return; + + Release(); + + // Now set new trackable object + if ( pobj ) + { + // Add ourselves to object tracker list + ptbase->AddNode( this ); + m_pobj = pobj; + m_ptbase = ptbase; + } + } + + T *m_pobj; + wxTrackable *m_ptbase; +}; + + +#ifndef wxNO_RTTI + +// Weak ref implementation assign objects are queried for wxTrackable +// using dynamic_cast<> +template <class T> +class wxWeakRefDynamic : public wxTrackerNode +{ +public: + wxWeakRefDynamic() : m_pobj(NULL) { } + + wxWeakRefDynamic(T* pobj) : m_pobj(pobj) + { + Assign(pobj); + } + + wxWeakRefDynamic(const wxWeakRef<T>& wr) + { + Assign(wr.get()); + } + + virtual ~wxWeakRefDynamic() { Release(); } + + // Smart pointer functions + T& operator*() const { return *m_pobj; } + T* operator->() const { return m_pobj; } + + T* get() const { return m_pobj; } + operator T* () const { return m_pobj; } + + T* operator = (T* pobj) { Assign(pobj); return m_pobj; } + + // Assign from another weak ref, point to same object + T* operator = (const wxWeakRef<T> &wr) { Assign( wr.get() ); return m_pobj; } + + void Release() + { + // Release old object if any + if( m_pobj ) + { + // Remove ourselves from object tracker list + wxTrackable *pt = dynamic_cast<wxTrackable*>(m_pobj); + pt->RemoveNode(this); + m_pobj = NULL; + } + } + + virtual void OnObjectDestroy() wxOVERRIDE + { + wxASSERT_MSG(m_pobj, "tracked object should have removed us itself"); + + m_pobj = NULL; + } + +protected: + void Assign(T *pobj) + { + if ( m_pobj == pobj ) + return; + + Release(); + + // Now set new trackable object + if ( pobj ) + { + // Add ourselves to object tracker list + wxTrackable *pt = dynamic_cast<wxTrackable*>(pobj); + if ( pt ) + { + pt->AddNode(this); + m_pobj = pobj; + } + else + { + // If the object we want to track does not support wxTackable, then + // log a message and keep the NULL object pointer. + wxFAIL_MSG( "Tracked class should inherit from wxTrackable" ); + } + } + } + + T *m_pobj; +}; + +#endif // RTTI enabled + + +// Provide some basic types of weak references +class WXDLLIMPEXP_FWD_BASE wxEvtHandler; +class WXDLLIMPEXP_FWD_CORE wxWindow; + + +typedef wxWeakRef<wxEvtHandler> wxEvtHandlerRef; +typedef wxWeakRef<wxWindow> wxWindowRef; + +#endif // _WX_WEAKREF_H_ + diff --git a/lib/wxWidgets/include/wx/webrequest.h b/lib/wxWidgets/include/wx/webrequest.h new file mode 100644 index 0000000..bbb2386 --- /dev/null +++ b/lib/wxWidgets/include/wx/webrequest.h @@ -0,0 +1,308 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/webrequest.h +// Purpose: wxWebRequest base classes +// Author: Tobias Taschner +// Created: 2018-10-17 +// Copyright: (c) 2018 wxWidgets development team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WEBREQUEST_H +#define _WX_WEBREQUEST_H + +#include "wx/defs.h" + +#include "wx/secretstore.h" + +// Note that this class is intentionally defined outside of wxUSE_WEBREQUEST +// test as it's also used in wxCredentialEntryDialog and can be made available +// even if wxWebRequest itself is disabled. +class wxWebCredentials +{ +public: + wxWebCredentials(const wxString& user = wxString(), + const wxSecretValue& password = wxSecretValue()) + : m_user(user), m_password(password) + { + } + + const wxString& GetUser() const { return m_user; } + const wxSecretValue& GetPassword() const { return m_password; } + +private: + wxString m_user; + wxSecretValue m_password; +}; + +#if wxUSE_WEBREQUEST + +#include "wx/event.h" +#include "wx/object.h" +#include "wx/stream.h" +#include "wx/versioninfo.h" + +class wxWebResponse; +class wxWebSession; +class wxWebSessionFactory; + +typedef struct wxWebRequestHandleOpaque* wxWebRequestHandle; +typedef struct wxWebSessionHandleOpaque* wxWebSessionHandle; + +class wxWebAuthChallengeImpl; +class wxWebRequestImpl; +class wxWebResponseImpl; +class wxWebSessionImpl; + +typedef wxObjectDataPtr<wxWebAuthChallengeImpl> wxWebAuthChallengeImplPtr; +typedef wxObjectDataPtr<wxWebRequestImpl> wxWebRequestImplPtr; +typedef wxObjectDataPtr<wxWebResponseImpl> wxWebResponseImplPtr; +typedef wxObjectDataPtr<wxWebSessionImpl> wxWebSessionImplPtr; + +class WXDLLIMPEXP_NET wxWebAuthChallenge +{ +public: + enum Source + { + Source_Server, + Source_Proxy + }; + + wxWebAuthChallenge(); + wxWebAuthChallenge(const wxWebAuthChallenge& other); + wxWebAuthChallenge& operator=(const wxWebAuthChallenge& other); + ~wxWebAuthChallenge(); + + bool IsOk() const { return m_impl.get() != NULL; } + + Source GetSource() const; + + void SetCredentials(const wxWebCredentials& cred); + +private: + // Ctor is used by wxWebRequest only. + friend class wxWebRequest; + explicit wxWebAuthChallenge(const wxWebAuthChallengeImplPtr& impl); + + wxWebAuthChallengeImplPtr m_impl; +}; + +class WXDLLIMPEXP_NET wxWebResponse +{ +public: + wxWebResponse(); + wxWebResponse(const wxWebResponse& other); + wxWebResponse& operator=(const wxWebResponse& other); + ~wxWebResponse(); + + bool IsOk() const { return m_impl.get() != NULL; } + + wxFileOffset GetContentLength() const; + + wxString GetURL() const; + + wxString GetHeader(const wxString& name) const; + + wxString GetMimeType() const; + + int GetStatus() const; + + wxString GetStatusText() const; + + wxInputStream* GetStream() const; + + wxString GetSuggestedFileName() const; + + wxString AsString() const; + + wxString GetDataFile() const; + +protected: + // Ctor is used by wxWebRequest and implementation classes to create public + // objects from the existing implementation pointers. + friend class wxWebRequest; + friend class wxWebRequestImpl; + friend class wxWebResponseImpl; + explicit wxWebResponse(const wxWebResponseImplPtr& impl); + + wxWebResponseImplPtr m_impl; +}; + +class WXDLLIMPEXP_NET wxWebRequest +{ +public: + enum State + { + State_Idle, + State_Unauthorized, + State_Active, + State_Completed, + State_Failed, + State_Cancelled + }; + + enum Storage + { + Storage_Memory, + Storage_File, + Storage_None + }; + + wxWebRequest(); + wxWebRequest(const wxWebRequest& other); + wxWebRequest& operator=(const wxWebRequest& other); + ~wxWebRequest(); + + bool IsOk() const { return m_impl.get() != NULL; } + + void SetHeader(const wxString& name, const wxString& value); + + void SetMethod(const wxString& method); + + void SetData(const wxString& text, const wxString& contentType, const wxMBConv& conv = wxConvUTF8); + + bool SetData(wxInputStream* dataStream, const wxString& contentType, wxFileOffset dataSize = wxInvalidOffset); + + void SetStorage(Storage storage); + + Storage GetStorage() const; + + void Start(); + + void Cancel(); + + wxWebResponse GetResponse() const; + + wxWebAuthChallenge GetAuthChallenge() const; + + int GetId() const; + + wxWebSession& GetSession() const; + + State GetState() const; + + wxFileOffset GetBytesSent() const; + + wxFileOffset GetBytesExpectedToSend() const; + + wxFileOffset GetBytesReceived() const; + + wxFileOffset GetBytesExpectedToReceive() const; + + wxWebRequestHandle GetNativeHandle() const; + + void DisablePeerVerify(bool disable = true); + + bool IsPeerVerifyDisabled() const; + +private: + // Ctor is used by wxWebSession and implementation classes to create + // wxWebRequest objects from the existing implementation pointers. + friend class wxWebSession; + friend class wxWebRequestImpl; + friend class wxWebResponseImpl; + explicit wxWebRequest(const wxWebRequestImplPtr& impl); + + wxWebRequestImplPtr m_impl; +}; + +extern WXDLLIMPEXP_DATA_NET(const char) wxWebSessionBackendWinHTTP[]; +extern WXDLLIMPEXP_DATA_NET(const char) wxWebSessionBackendURLSession[]; +extern WXDLLIMPEXP_DATA_NET(const char) wxWebSessionBackendCURL[]; + +class WXDLLIMPEXP_NET wxWebSession +{ +public: + // Default ctor creates an invalid session object, only IsOpened() can be + // called on it. + wxWebSession(); + + wxWebSession(const wxWebSession& other); + wxWebSession& operator=(const wxWebSession& other); + ~wxWebSession(); + + // Objects of this class can't be created directly, use the following + // factory functions to get access to them. + static wxWebSession& GetDefault(); + + static wxWebSession New(const wxString& backend = wxString()); + + // Can be used to check if the given backend is available without actually + // creating a session using it. + static bool IsBackendAvailable(const wxString& backend); + + wxWebRequest + CreateRequest(wxEvtHandler* handler, const wxString& url, int id = wxID_ANY); + + wxVersionInfo GetLibraryVersionInfo(); + + void AddCommonHeader(const wxString& name, const wxString& value); + + void SetTempDir(const wxString& dir); + wxString GetTempDir() const; + + bool IsOpened() const; + + void Close(); + + wxWebSessionHandle GetNativeHandle() const; + +private: + static void RegisterFactory(const wxString& backend, + wxWebSessionFactory* factory); + + static void InitFactoryMap(); + + explicit wxWebSession(const wxWebSessionImplPtr& impl); + + wxWebSessionImplPtr m_impl; +}; + +class WXDLLIMPEXP_NET wxWebRequestEvent : public wxEvent +{ +public: + wxWebRequestEvent(wxEventType type = wxEVT_NULL, + int id = wxID_ANY, + wxWebRequest::State state = wxWebRequest::State_Idle, + const wxWebRequest& request = wxWebRequest(), + const wxWebResponse& response = wxWebResponse(), + const wxString& errorDesc = wxString()) + : wxEvent(id, type), + m_state(state), m_request(request), m_response(response), + m_errorDescription(errorDesc) + { } + + wxWebRequest::State GetState() const { return m_state; } + + const wxWebRequest& GetRequest() const { return m_request; } + + const wxWebResponse& GetResponse() const { return m_response; } + + const wxString& GetErrorDescription() const { return m_errorDescription; } + + const wxString& GetDataFile() const { return m_dataFile; } + + void SetDataFile(const wxString& dataFile) { m_dataFile = dataFile; } + + const void* GetDataBuffer() const { return m_dataBuf.GetData(); } + + size_t GetDataSize() const { return m_dataBuf.GetDataLen(); } + + void SetDataBuffer(const wxMemoryBuffer& dataBuf) { m_dataBuf = dataBuf; } + + wxEvent* Clone() const wxOVERRIDE { return new wxWebRequestEvent(*this); } + +private: + wxWebRequest::State m_state; + const wxWebRequest m_request; + const wxWebResponse m_response; // may be invalid + wxString m_dataFile; + wxMemoryBuffer m_dataBuf; + wxString m_errorDescription; +}; + +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_NET, wxEVT_WEBREQUEST_STATE, wxWebRequestEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_NET, wxEVT_WEBREQUEST_DATA, wxWebRequestEvent); + +#endif // wxUSE_WEBREQUEST + +#endif // _WX_WEBREQUEST_H diff --git a/lib/wxWidgets/include/wx/webview.h b/lib/wxWidgets/include/wx/webview.h new file mode 100644 index 0000000..f95edb0 --- /dev/null +++ b/lib/wxWidgets/include/wx/webview.h @@ -0,0 +1,379 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: webview.h +// Purpose: Common interface and events for web view component +// Author: Marianne Gagnon +// Copyright: (c) 2010 Marianne Gagnon, 2011 Steven Lamerton +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WEBVIEW_H_ +#define _WX_WEBVIEW_H_ + +#include "wx/defs.h" + +#if wxUSE_WEBVIEW + +#include "wx/control.h" +#include "wx/event.h" +#include "wx/sstream.h" +#include "wx/sharedptr.h" +#include "wx/vector.h" +#include "wx/versioninfo.h" + +#if defined(__WXOSX__) + #include "wx/osx/webviewhistoryitem_webkit.h" +#elif defined(__WXGTK__) + #include "wx/gtk/webviewhistoryitem_webkit.h" +#elif defined(__WXMSW__) + #include "wx/msw/webviewhistoryitem_ie.h" +#else + #error "wxWebView not implemented on this platform." +#endif + +class wxFSFile; +class wxFileSystem; +class wxWebView; + +enum wxWebViewZoom +{ + wxWEBVIEW_ZOOM_TINY, + wxWEBVIEW_ZOOM_SMALL, + wxWEBVIEW_ZOOM_MEDIUM, + wxWEBVIEW_ZOOM_LARGE, + wxWEBVIEW_ZOOM_LARGEST +}; + +enum wxWebViewZoomType +{ + //Scales entire page, including images + wxWEBVIEW_ZOOM_TYPE_LAYOUT, + wxWEBVIEW_ZOOM_TYPE_TEXT +}; + +enum wxWebViewNavigationError +{ + wxWEBVIEW_NAV_ERR_CONNECTION, + wxWEBVIEW_NAV_ERR_CERTIFICATE, + wxWEBVIEW_NAV_ERR_AUTH, + wxWEBVIEW_NAV_ERR_SECURITY, + wxWEBVIEW_NAV_ERR_NOT_FOUND, + wxWEBVIEW_NAV_ERR_REQUEST, + wxWEBVIEW_NAV_ERR_USER_CANCELLED, + wxWEBVIEW_NAV_ERR_OTHER +}; + +enum wxWebViewReloadFlags +{ + //Default, may access cache + wxWEBVIEW_RELOAD_DEFAULT, + wxWEBVIEW_RELOAD_NO_CACHE +}; + +enum wxWebViewFindFlags +{ + wxWEBVIEW_FIND_WRAP = 0x0001, + wxWEBVIEW_FIND_ENTIRE_WORD = 0x0002, + wxWEBVIEW_FIND_MATCH_CASE = 0x0004, + wxWEBVIEW_FIND_HIGHLIGHT_RESULT = 0x0008, + wxWEBVIEW_FIND_BACKWARDS = 0x0010, + wxWEBVIEW_FIND_DEFAULT = 0 +}; + +enum wxWebViewNavigationActionFlags +{ + wxWEBVIEW_NAV_ACTION_NONE, + wxWEBVIEW_NAV_ACTION_USER, + wxWEBVIEW_NAV_ACTION_OTHER +}; + +enum wxWebViewUserScriptInjectionTime +{ + wxWEBVIEW_INJECT_AT_DOCUMENT_START, + wxWEBVIEW_INJECT_AT_DOCUMENT_END +}; + +//Base class for custom scheme handlers +class WXDLLIMPEXP_WEBVIEW wxWebViewHandler +{ +public: + wxWebViewHandler(const wxString& scheme) + : m_scheme(scheme), m_securityURL() {} + virtual ~wxWebViewHandler() {} + virtual wxString GetName() const { return m_scheme; } + virtual wxFSFile* GetFile(const wxString &uri) = 0; + virtual void SetSecurityURL(const wxString& url) { m_securityURL = url; } + virtual wxString GetSecurityURL() const { return m_securityURL; } +private: + wxString m_scheme; + wxString m_securityURL; +}; + +extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewNameStr[]; +extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewDefaultURLStr[]; +extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewBackendDefault[]; +extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewBackendIE[]; +extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewBackendEdge[]; +extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewBackendWebKit[]; + +class WXDLLIMPEXP_WEBVIEW wxWebViewFactory : public wxObject +{ +public: + virtual wxWebView* Create() = 0; + virtual wxWebView* Create(wxWindow* parent, + wxWindowID id, + const wxString& url = wxASCII_STR(wxWebViewDefaultURLStr), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxWebViewNameStr)) = 0; + virtual bool IsAvailable() { return true; } + virtual wxVersionInfo GetVersionInfo() { return wxVersionInfo(); } +}; + +WX_DECLARE_STRING_HASH_MAP(wxSharedPtr<wxWebViewFactory>, wxStringWebViewFactoryMap); + +class WXDLLIMPEXP_WEBVIEW wxWebView : public wxControl +{ +public: + wxWebView() + { + m_showMenu = true; + m_syncScriptResult = 0; + } + + virtual ~wxWebView() {} + + virtual bool Create(wxWindow* parent, + wxWindowID id, + const wxString& url = wxASCII_STR(wxWebViewDefaultURLStr), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxWebViewNameStr)) = 0; + + // Factory methods allowing the use of custom factories registered with + // RegisterFactory + static wxWebView* New(const wxString& backend = wxASCII_STR(wxWebViewBackendDefault)); + static wxWebView* New(wxWindow* parent, + wxWindowID id, + const wxString& url = wxASCII_STR(wxWebViewDefaultURLStr), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxString& backend = wxASCII_STR(wxWebViewBackendDefault), + long style = 0, + const wxString& name = wxASCII_STR(wxWebViewNameStr)); + + static void RegisterFactory(const wxString& backend, + wxSharedPtr<wxWebViewFactory> factory); + static bool IsBackendAvailable(const wxString& backend); + static wxVersionInfo GetBackendVersionInfo(const wxString& backend = wxASCII_STR(wxWebViewBackendDefault)); + + // General methods + virtual void EnableContextMenu(bool enable = true) + { + m_showMenu = enable; + } + virtual void EnableAccessToDevTools(bool WXUNUSED(enable) = true) { } + virtual wxString GetCurrentTitle() const = 0; + virtual wxString GetCurrentURL() const = 0; + // TODO: handle choosing a frame when calling GetPageSource()? + virtual wxString GetPageSource() const; + virtual wxString GetPageText() const; + virtual bool IsBusy() const = 0; + virtual bool IsContextMenuEnabled() const { return m_showMenu; } + virtual bool IsAccessToDevToolsEnabled() const { return false; } + virtual bool IsEditable() const = 0; + virtual void LoadURL(const wxString& url) = 0; + virtual void Print() = 0; + virtual void RegisterHandler(wxSharedPtr<wxWebViewHandler> handler) = 0; + virtual void Reload(wxWebViewReloadFlags flags = wxWEBVIEW_RELOAD_DEFAULT) = 0; + virtual bool SetUserAgent(const wxString& userAgent) { wxUnusedVar(userAgent); return false; } + virtual wxString GetUserAgent() const; + + // Script + virtual bool RunScript(const wxString& javascript, wxString* output = NULL) const; + virtual void RunScriptAsync(const wxString& javascript, void* clientData = NULL) const; + virtual bool AddScriptMessageHandler(const wxString& name) + { wxUnusedVar(name); return false; } + virtual bool RemoveScriptMessageHandler(const wxString& name) + { wxUnusedVar(name); return false; } + virtual bool AddUserScript(const wxString& javascript, + wxWebViewUserScriptInjectionTime injectionTime = wxWEBVIEW_INJECT_AT_DOCUMENT_START) + { wxUnusedVar(javascript); wxUnusedVar(injectionTime); return false; } + virtual void RemoveAllUserScripts() {} + + virtual void SetEditable(bool enable = true) = 0; + void SetPage(const wxString& html, const wxString& baseUrl) + { + DoSetPage(html, baseUrl); + } + void SetPage(wxInputStream& html, wxString baseUrl) + { + wxStringOutputStream stream; + stream.Write(html); + DoSetPage(stream.GetString(), baseUrl); + } + virtual void Stop() = 0; + + //History + virtual bool CanGoBack() const = 0; + virtual bool CanGoForward() const = 0; + virtual void GoBack() = 0; + virtual void GoForward() = 0; + virtual void ClearHistory() = 0; + virtual void EnableHistory(bool enable = true) = 0; + virtual wxVector<wxSharedPtr<wxWebViewHistoryItem> > GetBackwardHistory() = 0; + virtual wxVector<wxSharedPtr<wxWebViewHistoryItem> > GetForwardHistory() = 0; + virtual void LoadHistoryItem(wxSharedPtr<wxWebViewHistoryItem> item) = 0; + + //Zoom + virtual bool CanSetZoomType(wxWebViewZoomType type) const = 0; + virtual wxWebViewZoom GetZoom() const; + virtual float GetZoomFactor() const = 0; + virtual wxWebViewZoomType GetZoomType() const = 0; + virtual void SetZoom(wxWebViewZoom zoom); + virtual void SetZoomFactor(float zoom) = 0; + virtual void SetZoomType(wxWebViewZoomType zoomType) = 0; + + //Selection + virtual void SelectAll() ; + virtual bool HasSelection() const; + virtual void DeleteSelection(); + virtual wxString GetSelectedText() const; + virtual wxString GetSelectedSource() const; + virtual void ClearSelection(); + + //Clipboard functions + virtual bool CanCut() const; + virtual bool CanCopy() const; + virtual bool CanPaste() const; + virtual void Cut(); + virtual void Copy(); + virtual void Paste(); + + //Undo / redo functionality + virtual bool CanUndo() const = 0; + virtual bool CanRedo() const = 0; + virtual void Undo() = 0; + virtual void Redo() = 0; + + //Get the pointer to the underlying native engine. + virtual void* GetNativeBackend() const = 0; + //Find function + virtual long Find(const wxString& text, int flags = wxWEBVIEW_FIND_DEFAULT); + +protected: + virtual void DoSetPage(const wxString& html, const wxString& baseUrl) = 0; + + bool QueryCommandEnabled(const wxString& command) const; + void ExecCommand(const wxString& command); + + void SendScriptResult(void* clientData, bool success, + const wxString& output) const; + +private: + static void InitFactoryMap(); + static wxStringWebViewFactoryMap::iterator FindFactory(const wxString &backend); + + bool m_showMenu; + mutable int m_syncScriptResult; + mutable wxString m_syncScriptOutput; + wxString m_findText; + static wxStringWebViewFactoryMap m_factoryMap; + + wxDECLARE_ABSTRACT_CLASS(wxWebView); +}; + +class WXDLLIMPEXP_WEBVIEW wxWebViewEvent : public wxNotifyEvent +{ +public: + wxWebViewEvent() {} + wxWebViewEvent(wxEventType type, int id, const wxString& url, + const wxString target, + wxWebViewNavigationActionFlags flags = wxWEBVIEW_NAV_ACTION_NONE, + const wxString& messageHandler = wxString()) + : wxNotifyEvent(type, id), m_url(url), m_target(target), + m_actionFlags(flags), m_messageHandler(messageHandler) + {} + + bool IsError() const { return GetInt() == 0; } + + const wxString& GetURL() const { return m_url; } + const wxString& GetTarget() const { return m_target; } + + wxWebViewNavigationActionFlags GetNavigationAction() const { return m_actionFlags; } + const wxString& GetMessageHandler() const { return m_messageHandler; } + + virtual wxEvent* Clone() const wxOVERRIDE { return new wxWebViewEvent(*this); } +private: + wxString m_url; + wxString m_target; + wxWebViewNavigationActionFlags m_actionFlags; + wxString m_messageHandler; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxWebViewEvent); +}; + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_WEBVIEW_NAVIGATING, wxWebViewEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_WEBVIEW_NAVIGATED, wxWebViewEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_WEBVIEW_LOADED, wxWebViewEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_WEBVIEW_ERROR, wxWebViewEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_WEBVIEW_NEWWINDOW, wxWebViewEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_WEBVIEW_TITLE_CHANGED, wxWebViewEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_WEBVIEW_FULLSCREEN_CHANGED, wxWebViewEvent); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_WEBVIEW_SCRIPT_MESSAGE_RECEIVED, wxWebViewEvent); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEBVIEW, wxEVT_WEBVIEW_SCRIPT_RESULT, wxWebViewEvent); + +typedef void (wxEvtHandler::*wxWebViewEventFunction) + (wxWebViewEvent&); + +#define wxWebViewEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxWebViewEventFunction, func) + +#define EVT_WEBVIEW_NAVIGATING(id, fn) \ + wx__DECLARE_EVT1(wxEVT_WEBVIEW_NAVIGATING, id, \ + wxWebViewEventHandler(fn)) + +#define EVT_WEBVIEW_NAVIGATED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_WEBVIEW_NAVIGATED, id, \ + wxWebViewEventHandler(fn)) + +#define EVT_WEBVIEW_LOADED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_WEBVIEW_LOADED, id, \ + wxWebViewEventHandler(fn)) + +#define EVT_WEBVIEW_ERROR(id, fn) \ + wx__DECLARE_EVT1(wxEVT_WEBVIEW_ERROR, id, \ + wxWebViewEventHandler(fn)) + +#define EVT_WEBVIEW_NEWWINDOW(id, fn) \ + wx__DECLARE_EVT1(wxEVT_WEBVIEW_NEWWINDOW, id, \ + wxWebViewEventHandler(fn)) + +#define EVT_WEBVIEW_TITLE_CHANGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_WEBVIEW_TITLE_CHANGED, id, \ + wxWebViewEventHandler(fn)) + +#define EVT_WEBVIEW_FULLSCREEN_CHANGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_WEBVIEW_FULLSCREEN_CHANGED, id, \ + wxWebViewEventHandler(fn)) + +#define EVT_WEBVIEW_SCRIPT_MESSAGE_RECEIVED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_WEBVIEW_SCRIPT_MESSAGE_RECEIVED, id, \ + wxWebViewEventHandler(fn)) + +#define EVT_WEBVIEW_SCRIPT_RESULT(id, fn) \ + wx__DECLARE_EVT1(wxEVT_WEBVIEW_SCRIPT_RESULT, id, \ + wxWebViewEventHandler(fn)) + +// old wxEVT_COMMAND_* constants +#define wxEVT_COMMAND_WEBVIEW_NAVIGATING wxEVT_WEBVIEW_NAVIGATING +#define wxEVT_COMMAND_WEBVIEW_NAVIGATED wxEVT_WEBVIEW_NAVIGATED +#define wxEVT_COMMAND_WEBVIEW_LOADED wxEVT_WEBVIEW_LOADED +#define wxEVT_COMMAND_WEBVIEW_ERROR wxEVT_WEBVIEW_ERROR +#define wxEVT_COMMAND_WEBVIEW_NEWWINDOW wxEVT_WEBVIEW_NEWWINDOW +#define wxEVT_COMMAND_WEBVIEW_TITLE_CHANGED wxEVT_WEBVIEW_TITLE_CHANGED + +#endif // wxUSE_WEBVIEW + +#endif // _WX_WEBVIEW_H_ diff --git a/lib/wxWidgets/include/wx/webviewarchivehandler.h b/lib/wxWidgets/include/wx/webviewarchivehandler.h new file mode 100644 index 0000000..6157b6b --- /dev/null +++ b/lib/wxWidgets/include/wx/webviewarchivehandler.h @@ -0,0 +1,36 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: webviewarchivehandler.h +// Purpose: Custom webview handler to allow archive browsing +// Author: Steven Lamerton +// Copyright: (c) 2011 Steven Lamerton +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WEBVIEW_FILE_HANDLER_H_ +#define _WX_WEBVIEW_FILE_HANDLER_H_ + +#include "wx/setup.h" + +#if wxUSE_WEBVIEW + +class wxFSFile; +class wxFileSystem; + +#include "wx/webview.h" + +//Loads from uris such as scheme:///C:/example/example.html or archives such as +//scheme:///C:/example/example.zip;protocol=zip/example.html + +class WXDLLIMPEXP_WEBVIEW wxWebViewArchiveHandler : public wxWebViewHandler +{ +public: + wxWebViewArchiveHandler(const wxString& scheme); + virtual ~wxWebViewArchiveHandler(); + virtual wxFSFile* GetFile(const wxString &uri) wxOVERRIDE; +private: + wxFileSystem* m_fileSystem; +}; + +#endif // wxUSE_WEBVIEW + +#endif // _WX_WEBVIEW_FILE_HANDLER_H_ diff --git a/lib/wxWidgets/include/wx/webviewfshandler.h b/lib/wxWidgets/include/wx/webviewfshandler.h new file mode 100644 index 0000000..275410a --- /dev/null +++ b/lib/wxWidgets/include/wx/webviewfshandler.h @@ -0,0 +1,37 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: webviewfshandler.h +// Purpose: Custom webview handler for virtual file system +// Author: Nick Matthews +// Copyright: (c) 2012 Steven Lamerton +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// Based on webviewarchivehandler.h file by Steven Lamerton + +#ifndef _WX_WEBVIEW_FS_HANDLER_H_ +#define _WX_WEBVIEW_FS_HANDLER_H_ + +#include "wx/setup.h" + +#if wxUSE_WEBVIEW + +class wxFSFile; +class wxFileSystem; + +#include "wx/webview.h" + +//Loads from uris such as scheme:example.html + +class WXDLLIMPEXP_WEBVIEW wxWebViewFSHandler : public wxWebViewHandler +{ +public: + wxWebViewFSHandler(const wxString& scheme); + virtual ~wxWebViewFSHandler(); + virtual wxFSFile* GetFile(const wxString &uri) wxOVERRIDE; +private: + wxFileSystem* m_fileSystem; +}; + +#endif // wxUSE_WEBVIEW + +#endif // _WX_WEBVIEW_FS_HANDLER_H_ diff --git a/lib/wxWidgets/include/wx/wfstream.h b/lib/wxWidgets/include/wx/wfstream.h new file mode 100644 index 0000000..7fea3d7 --- /dev/null +++ b/lib/wxWidgets/include/wx/wfstream.h @@ -0,0 +1,288 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/wfstream.h +// Purpose: File stream classes +// Author: Guilhem Lavaux +// Modified by: +// Created: 11/07/98 +// Copyright: (c) Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WXFSTREAM_H__ +#define _WX_WXFSTREAM_H__ + +#include "wx/defs.h" + +#if wxUSE_STREAMS + +#include "wx/object.h" +#include "wx/string.h" +#include "wx/stream.h" +#include "wx/file.h" +#include "wx/ffile.h" + +#if wxUSE_FILE + +// ---------------------------------------------------------------------------- +// wxFileStream using wxFile +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFileInputStream : public wxInputStream +{ +public: + wxFileInputStream(const wxString& ifileName); + wxFileInputStream(wxFile& file); + wxFileInputStream(int fd); + virtual ~wxFileInputStream(); + + virtual wxFileOffset GetLength() const wxOVERRIDE; + + bool Ok() const { return IsOk(); } + virtual bool IsOk() const wxOVERRIDE; + virtual bool IsSeekable() const wxOVERRIDE { return m_file->GetKind() == wxFILE_KIND_DISK; } + + wxFile* GetFile() const { return m_file; } + +protected: + wxFileInputStream(); + + virtual size_t OnSysRead(void *buffer, size_t size) wxOVERRIDE; + virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE; + virtual wxFileOffset OnSysTell() const wxOVERRIDE; + +protected: + wxFile *m_file; + bool m_file_destroy; + + wxDECLARE_NO_COPY_CLASS(wxFileInputStream); +}; + +class WXDLLIMPEXP_BASE wxFileOutputStream : public wxOutputStream +{ +public: + wxFileOutputStream(const wxString& fileName); + wxFileOutputStream(wxFile& file); + wxFileOutputStream(int fd); + virtual ~wxFileOutputStream(); + + void Sync() wxOVERRIDE; + bool Close() wxOVERRIDE { return m_file_destroy ? m_file->Close() : true; } + virtual wxFileOffset GetLength() const wxOVERRIDE; + + bool Ok() const { return IsOk(); } + virtual bool IsOk() const wxOVERRIDE; + virtual bool IsSeekable() const wxOVERRIDE { return m_file->GetKind() == wxFILE_KIND_DISK; } + + wxFile* GetFile() const { return m_file; } + +protected: + wxFileOutputStream(); + + virtual size_t OnSysWrite(const void *buffer, size_t size) wxOVERRIDE; + virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE; + virtual wxFileOffset OnSysTell() const wxOVERRIDE; + +protected: + wxFile *m_file; + bool m_file_destroy; + + wxDECLARE_NO_COPY_CLASS(wxFileOutputStream); +}; + +class WXDLLIMPEXP_BASE wxTempFileOutputStream : public wxOutputStream +{ +public: + wxTempFileOutputStream(const wxString& fileName); + virtual ~wxTempFileOutputStream(); + + bool Close() wxOVERRIDE { return Commit(); } + WXDLLIMPEXP_INLINE_BASE virtual bool Commit() { return m_file->Commit(); } + WXDLLIMPEXP_INLINE_BASE virtual void Discard() { m_file->Discard(); } + + virtual wxFileOffset GetLength() const wxOVERRIDE { return m_file->Length(); } + virtual bool IsSeekable() const wxOVERRIDE { return true; } + +protected: + virtual size_t OnSysWrite(const void *buffer, size_t size) wxOVERRIDE; + virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE + { return m_file->Seek(pos, mode); } + virtual wxFileOffset OnSysTell() const wxOVERRIDE { return m_file->Tell(); } + +private: + wxTempFile *m_file; + + wxDECLARE_NO_COPY_CLASS(wxTempFileOutputStream); +}; + +class WXDLLIMPEXP_BASE wxTempFFileOutputStream : public wxOutputStream +{ +public: + wxTempFFileOutputStream(const wxString& fileName); + virtual ~wxTempFFileOutputStream(); + + bool Close() wxOVERRIDE { return Commit(); } + WXDLLIMPEXP_INLINE_BASE virtual bool Commit() { return m_file->Commit(); } + WXDLLIMPEXP_INLINE_BASE virtual void Discard() { m_file->Discard(); } + + virtual wxFileOffset GetLength() const wxOVERRIDE { return m_file->Length(); } + virtual bool IsSeekable() const wxOVERRIDE { return true; } + +protected: + virtual size_t OnSysWrite(const void *buffer, size_t size) wxOVERRIDE; + virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE + { return m_file->Seek(pos, mode); } + virtual wxFileOffset OnSysTell() const wxOVERRIDE { return m_file->Tell(); } + +private: + wxTempFFile *m_file; + + wxDECLARE_NO_COPY_CLASS(wxTempFFileOutputStream); +}; + +class WXDLLIMPEXP_BASE wxFileStream : public wxFileInputStream, + public wxFileOutputStream +{ +public: + wxFileStream(const wxString& fileName); + virtual bool IsOk() const wxOVERRIDE; + + // override (some) virtual functions inherited from both classes to resolve + // ambiguities (this wouldn't be necessary if wxStreamBase were a virtual + // base class but it isn't) + + virtual bool IsSeekable() const wxOVERRIDE + { + return wxFileInputStream::IsSeekable(); + } + + virtual wxFileOffset GetLength() const wxOVERRIDE + { + return wxFileInputStream::GetLength(); + } + +protected: + virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE + { + return wxFileInputStream::OnSysSeek(pos, mode); + } + + virtual wxFileOffset OnSysTell() const wxOVERRIDE + { + return wxFileInputStream::OnSysTell(); + } + +private: + wxDECLARE_NO_COPY_CLASS(wxFileStream); +}; + +#endif //wxUSE_FILE + +#if wxUSE_FFILE + +// ---------------------------------------------------------------------------- +// wxFFileStream using wxFFile +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFFileInputStream : public wxInputStream +{ +public: + wxFFileInputStream(const wxString& fileName, const wxString& mode = wxASCII_STR("rb")); + wxFFileInputStream(wxFFile& file); + wxFFileInputStream(FILE *file); + virtual ~wxFFileInputStream(); + + virtual wxFileOffset GetLength() const wxOVERRIDE; + + bool Ok() const { return IsOk(); } + virtual bool IsOk() const wxOVERRIDE; + virtual bool IsSeekable() const wxOVERRIDE { return m_file->GetKind() == wxFILE_KIND_DISK; } + + wxFFile* GetFile() const { return m_file; } + +protected: + wxFFileInputStream(); + + virtual size_t OnSysRead(void *buffer, size_t size) wxOVERRIDE; + virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE; + virtual wxFileOffset OnSysTell() const wxOVERRIDE; + +protected: + wxFFile *m_file; + bool m_file_destroy; + + wxDECLARE_NO_COPY_CLASS(wxFFileInputStream); +}; + +class WXDLLIMPEXP_BASE wxFFileOutputStream : public wxOutputStream +{ +public: + wxFFileOutputStream(const wxString& fileName, const wxString& mode = wxASCII_STR("wb")); + wxFFileOutputStream(wxFFile& file); + wxFFileOutputStream(FILE *file); + virtual ~wxFFileOutputStream(); + + void Sync() wxOVERRIDE; + bool Close() wxOVERRIDE { return m_file_destroy ? m_file->Close() : true; } + virtual wxFileOffset GetLength() const wxOVERRIDE; + + bool Ok() const { return IsOk(); } + virtual bool IsOk() const wxOVERRIDE; + virtual bool IsSeekable() const wxOVERRIDE { return m_file->GetKind() == wxFILE_KIND_DISK; } + + wxFFile* GetFile() const { return m_file; } + +protected: + wxFFileOutputStream(); + + virtual size_t OnSysWrite(const void *buffer, size_t size) wxOVERRIDE; + virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE; + virtual wxFileOffset OnSysTell() const wxOVERRIDE; + +protected: + wxFFile *m_file; + bool m_file_destroy; + + wxDECLARE_NO_COPY_CLASS(wxFFileOutputStream); +}; + +class WXDLLIMPEXP_BASE wxFFileStream : public wxFFileInputStream, + public wxFFileOutputStream +{ +public: + wxFFileStream(const wxString& fileName, const wxString& mode = wxASCII_STR("w+b")); + + // override some virtual functions to resolve ambiguities, just as in + // wxFileStream + + virtual bool IsOk() const wxOVERRIDE; + + virtual bool IsSeekable() const wxOVERRIDE + { + return wxFFileInputStream::IsSeekable(); + } + + virtual wxFileOffset GetLength() const wxOVERRIDE + { + return wxFFileInputStream::GetLength(); + } + +protected: + virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE + { + return wxFFileInputStream::OnSysSeek(pos, mode); + } + + virtual wxFileOffset OnSysTell() const wxOVERRIDE + { + return wxFFileInputStream::OnSysTell(); + } + +private: + wxDECLARE_NO_COPY_CLASS(wxFFileStream); +}; + +#endif //wxUSE_FFILE + +#endif // wxUSE_STREAMS + +#endif // _WX_WXFSTREAM_H__ diff --git a/lib/wxWidgets/include/wx/window.h b/lib/wxWidgets/include/wx/window.h new file mode 100644 index 0000000..d728345 --- /dev/null +++ b/lib/wxWidgets/include/wx/window.h @@ -0,0 +1,2257 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/window.h +// Purpose: wxWindowBase class - the interface of wxWindow +// Author: Vadim Zeitlin +// Modified by: Ron Lee +// Created: 01/02/97 +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WINDOW_H_BASE_ +#define _WX_WINDOW_H_BASE_ + +// ---------------------------------------------------------------------------- +// headers which we must include here +// ---------------------------------------------------------------------------- + +#include "wx/event.h" // the base class + +#include "wx/list.h" // defines wxWindowList + +#include "wx/cursor.h" // we have member variables of these classes +#include "wx/font.h" // so we can't do without them +#include "wx/colour.h" +#include "wx/region.h" +#include "wx/utils.h" +#include "wx/intl.h" + +#include "wx/validate.h" // for wxDefaultValidator (always include it) +#include "wx/windowid.h" + +#if wxUSE_PALETTE + #include "wx/palette.h" +#endif // wxUSE_PALETTE + +#if wxUSE_ACCEL + #include "wx/accel.h" +#endif // wxUSE_ACCEL + +#if wxUSE_ACCESSIBILITY +#include "wx/access.h" +#endif + +// when building wxUniv/Foo we don't want the code for native menu use to be +// compiled in - it should only be used when building real wxFoo +#ifdef __WXUNIVERSAL__ + #define wxUSE_MENUS_NATIVE 0 +#else // !__WXUNIVERSAL__ + #define wxUSE_MENUS_NATIVE wxUSE_MENUS +#endif // __WXUNIVERSAL__/!__WXUNIVERSAL__ + +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxCaret; +class WXDLLIMPEXP_FWD_CORE wxControl; +class WXDLLIMPEXP_FWD_CORE wxDC; +class WXDLLIMPEXP_FWD_CORE wxDropTarget; +class WXDLLIMPEXP_FWD_CORE wxLayoutConstraints; +class WXDLLIMPEXP_FWD_CORE wxSizer; +class WXDLLIMPEXP_FWD_CORE wxTextEntry; +class WXDLLIMPEXP_FWD_CORE wxToolTip; +class WXDLLIMPEXP_FWD_CORE wxWindowBase; +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxScrollHelper; + +#if wxUSE_ACCESSIBILITY +class WXDLLIMPEXP_FWD_CORE wxAccessible; +#endif + +// ---------------------------------------------------------------------------- +// helper stuff used by wxWindow +// ---------------------------------------------------------------------------- + +// struct containing all the visual attributes of a control +struct WXDLLIMPEXP_CORE wxVisualAttributes +{ + // the font used for control label/text inside it + wxFont font; + + // the foreground colour + wxColour colFg; + + // the background colour, may be wxNullColour if the controls background + // colour is not solid + wxColour colBg; +}; + +// different window variants, on platforms like e.g. mac uses different +// rendering sizes +enum wxWindowVariant +{ + wxWINDOW_VARIANT_NORMAL, // Normal size + wxWINDOW_VARIANT_SMALL, // Smaller size (about 25 % smaller than normal) + wxWINDOW_VARIANT_MINI, // Mini size (about 33 % smaller than normal) + wxWINDOW_VARIANT_LARGE, // Large size (about 25 % larger than normal) + wxWINDOW_VARIANT_MAX +}; + +#if wxUSE_SYSTEM_OPTIONS + #define wxWINDOW_DEFAULT_VARIANT wxT("window-default-variant") +#endif + +// valid values for Show/HideWithEffect() +enum wxShowEffect +{ + wxSHOW_EFFECT_NONE, + wxSHOW_EFFECT_ROLL_TO_LEFT, + wxSHOW_EFFECT_ROLL_TO_RIGHT, + wxSHOW_EFFECT_ROLL_TO_TOP, + wxSHOW_EFFECT_ROLL_TO_BOTTOM, + wxSHOW_EFFECT_SLIDE_TO_LEFT, + wxSHOW_EFFECT_SLIDE_TO_RIGHT, + wxSHOW_EFFECT_SLIDE_TO_TOP, + wxSHOW_EFFECT_SLIDE_TO_BOTTOM, + wxSHOW_EFFECT_BLEND, + wxSHOW_EFFECT_EXPAND, + wxSHOW_EFFECT_MAX +}; + +// Values for EnableTouchEvents() mask. +enum +{ + wxTOUCH_NONE = 0x0000, + wxTOUCH_VERTICAL_PAN_GESTURE = 0x0001, + wxTOUCH_HORIZONTAL_PAN_GESTURE = 0x0002, + wxTOUCH_PAN_GESTURES = wxTOUCH_VERTICAL_PAN_GESTURE | + wxTOUCH_HORIZONTAL_PAN_GESTURE, + wxTOUCH_ZOOM_GESTURE = 0x0004, + wxTOUCH_ROTATE_GESTURE = 0x0008, + wxTOUCH_PRESS_GESTURES = 0x0010, + wxTOUCH_ALL_GESTURES = 0x001f +}; + +// flags for SendSizeEvent() +enum +{ + wxSEND_EVENT_POST = 1 +}; + +// Flags for WXSetInitialFittingClientSize(). +enum +{ + wxSIZE_SET_CURRENT = 0x0001, // Set the current size. + wxSIZE_SET_MIN = 0x0002 // Set the size as the minimum allowed size. +}; + +// ---------------------------------------------------------------------------- +// (pseudo)template list classes +// ---------------------------------------------------------------------------- + +WX_DECLARE_LIST_3(wxWindow, wxWindowBase, wxWindowList, wxWindowListNode, class WXDLLIMPEXP_CORE); + +// ---------------------------------------------------------------------------- +// global variables +// ---------------------------------------------------------------------------- + +extern WXDLLIMPEXP_DATA_CORE(wxWindowList) wxTopLevelWindows; + +// declared here for compatibility only, main declaration is in wx/app.h +extern WXDLLIMPEXP_DATA_BASE(wxList) wxPendingDelete; + +// ---------------------------------------------------------------------------- +// wxWindowBase is the base class for all GUI controls/widgets, this is the public +// interface of this class. +// +// Event handler: windows have themselves as their event handlers by default, +// but their event handlers could be set to another object entirely. This +// separation can reduce the amount of derivation required, and allow +// alteration of a window's functionality (e.g. by a resource editor that +// temporarily switches event handlers). +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWindowBase : public wxEvtHandler +{ +public: + // creating the window + // ------------------- + + // default ctor, initializes everything which can be initialized before + // Create() + wxWindowBase() ; + + virtual ~wxWindowBase(); + + // deleting the window + // ------------------- + + // ask the window to close itself, return true if the event handler + // honoured our request + bool Close( bool force = false ); + + // the following functions delete the C++ objects (the window itself + // or its children) as well as the GUI windows and normally should + // never be used directly + + // delete window unconditionally (dangerous!), returns true if ok + virtual bool Destroy(); + // delete all children of this window, returns true if ok + bool DestroyChildren(); + + // is the window being deleted? + bool IsBeingDeleted() const; + + // window attributes + // ----------------- + + // label is just the same as the title (but for, e.g., buttons it + // makes more sense to speak about labels), title access + // is available from wxTLW classes only (frames, dialogs) + virtual void SetLabel(const wxString& label) = 0; + virtual wxString GetLabel() const = 0; + + // the window name is used for resource setting in X, it is not the + // same as the window title/label + virtual void SetName( const wxString &name ) { m_windowName = name; } + virtual wxString GetName() const { return m_windowName; } + + // sets the window variant, calls internally DoSetVariant if variant + // has changed + void SetWindowVariant(wxWindowVariant variant); + wxWindowVariant GetWindowVariant() const { return m_windowVariant; } + + + // get or change the layout direction (LTR or RTL) for this window, + // wxLayout_Default is returned if layout direction is not supported + virtual wxLayoutDirection GetLayoutDirection() const + { return wxLayout_Default; } + virtual void SetLayoutDirection(wxLayoutDirection WXUNUSED(dir)) + { } + + // mirror coordinates for RTL layout if this window uses it and if the + // mirroring is not done automatically like Win32 + virtual wxCoord AdjustForLayoutDirection(wxCoord x, + wxCoord width, + wxCoord widthTotal) const; + + + // window id uniquely identifies the window among its siblings unless + // it is wxID_ANY which means "don't care" + virtual void SetId( wxWindowID winid ) { m_windowId = winid; } + wxWindowID GetId() const { return m_windowId; } + + // generate a unique id (or count of them consecutively), returns a + // valid id in the auto-id range or wxID_NONE if failed. If using + // autoid management, it will mark the id as reserved until it is + // used (by assigning it to a wxWindowIDRef) or unreserved. + static wxWindowID NewControlId(int count = 1) + { + return wxIdManager::ReserveId(count); + } + + // If an ID generated from NewControlId is not assigned to a wxWindowIDRef, + // it must be unreserved + static void UnreserveControlId(wxWindowID id, int count = 1) + { + wxIdManager::UnreserveId(id, count); + } + + + // moving/resizing + // --------------- + + // set the window size and/or position + void SetSize( int x, int y, int width, int height, + int sizeFlags = wxSIZE_AUTO ) + { DoSetSize(x, y, width, height, sizeFlags); } + + void SetSize( int width, int height ) + { DoSetSize( wxDefaultCoord, wxDefaultCoord, width, height, wxSIZE_USE_EXISTING ); } + + void SetSize( const wxSize& size ) + { SetSize( size.x, size.y); } + + void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) + { DoSetSize(rect.x, rect.y, rect.width, rect.height, sizeFlags); } + + void Move(int x, int y, int flags = wxSIZE_USE_EXISTING) + { DoSetSize(x, y, wxDefaultCoord, wxDefaultCoord, flags); } + + void Move(const wxPoint& pt, int flags = wxSIZE_USE_EXISTING) + { Move(pt.x, pt.y, flags); } + + void SetPosition(const wxPoint& pt) { Move(pt); } + + // Z-order + virtual void Raise() = 0; + virtual void Lower() = 0; + + // client size is the size of area available for subwindows + void SetClientSize( int width, int height ) + { DoSetClientSize(width, height); } + + void SetClientSize( const wxSize& size ) + { DoSetClientSize(size.x, size.y); } + + void SetClientSize(const wxRect& rect) + { SetClientSize( rect.width, rect.height ); } + + // get the window position (pointers may be NULL): notice that it is in + // client coordinates for child windows and screen coordinates for the + // top level ones, use GetScreenPosition() if you need screen + // coordinates for all kinds of windows + void GetPosition( int *x, int *y ) const { DoGetPosition(x, y); } + wxPoint GetPosition() const + { + int x, y; + DoGetPosition(&x, &y); + + return wxPoint(x, y); + } + + // get the window position in screen coordinates + void GetScreenPosition(int *x, int *y) const { DoGetScreenPosition(x, y); } + wxPoint GetScreenPosition() const + { + int x, y; + DoGetScreenPosition(&x, &y); + + return wxPoint(x, y); + } + + // get the window size (pointers may be NULL) + void GetSize( int *w, int *h ) const { DoGetSize(w, h); } + wxSize GetSize() const + { + int w, h; + DoGetSize(& w, & h); + return wxSize(w, h); + } + + void GetClientSize( int *w, int *h ) const { DoGetClientSize(w, h); } + wxSize GetClientSize() const + { + int w, h; + DoGetClientSize(&w, &h); + + return wxSize(w, h); + } + + // get the position and size at once + wxRect GetRect() const + { + int x, y, w, h; + GetPosition(&x, &y); + GetSize(&w, &h); + + return wxRect(x, y, w, h); + } + + wxRect GetScreenRect() const + { + int x, y, w, h; + GetScreenPosition(&x, &y); + GetSize(&w, &h); + + return wxRect(x, y, w, h); + } + + // get the origin of the client area of the window relative to the + // window top left corner (the client area may be shifted because of + // the borders, scrollbars, other decorations...) + virtual wxPoint GetClientAreaOrigin() const; + + // get the client rectangle in window (i.e. client) coordinates + wxRect GetClientRect() const + { + return wxRect(GetClientAreaOrigin(), GetClientSize()); + } + + // client<->window size conversion + virtual wxSize ClientToWindowSize(const wxSize& size) const; + virtual wxSize WindowToClientSize(const wxSize& size) const; + + // get the size best suited for the window (in fact, minimal + // acceptable size using which it will still look "nice" in + // most situations) + wxSize GetBestSize() const; + + void GetBestSize(int *w, int *h) const + { + wxSize s = GetBestSize(); + if ( w ) + *w = s.x; + if ( h ) + *h = s.y; + } + + // Determine the best size in the other direction if one of them is + // fixed. This is used with windows that can wrap their contents and + // returns input-independent best size for the others. + int GetBestHeight(int width) const; + int GetBestWidth(int height) const; + + + void SetScrollHelper( wxScrollHelper *sh ) { m_scrollHelper = sh; } + wxScrollHelper *GetScrollHelper() { return m_scrollHelper; } + + // reset the cached best size value so it will be recalculated the + // next time it is needed. + void InvalidateBestSize(); + void CacheBestSize(const wxSize& size) const + { wxConstCast(this, wxWindowBase)->m_bestSizeCache = size; } + + + // This function will merge the window's best size into the window's + // minimum size, giving priority to the min size components, and + // returns the results. + virtual wxSize GetEffectiveMinSize() const; + +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED_MSG("use GetEffectiveMinSize() instead") + wxSize GetBestFittingSize() const; +#endif // WXWIN_COMPATIBILITY_2_8 + + // A 'Smart' SetSize that will fill in default size values with 'best' + // size. Sets the minsize to what was passed in. + void SetInitialSize(const wxSize& size=wxDefaultSize); + +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED_MSG("use SetInitialSize() instead") + void SetBestFittingSize(const wxSize& size=wxDefaultSize); +#endif // WXWIN_COMPATIBILITY_2_8 + + + // the generic centre function - centers the window on parent by` + // default or on screen if it doesn't have parent or + // wxCENTER_ON_SCREEN flag is given + void Centre(int dir = wxBOTH) { DoCentre(dir); } + void Center(int dir = wxBOTH) { DoCentre(dir); } + + // centre with respect to the parent window + void CentreOnParent(int dir = wxBOTH) { DoCentre(dir); } + void CenterOnParent(int dir = wxBOTH) { CentreOnParent(dir); } + + // set window size to wrap around its children + virtual void Fit(); + + // set virtual size to satisfy children + virtual void FitInside(); + + + // SetSizeHints is actually for setting the size hints + // for the wxTLW for a Window Manager - hence the name - + // and it is therefore overridden in wxTLW to do that. + // In wxWindow(Base), it has (unfortunately) been abused + // to mean the same as SetMinSize() and SetMaxSize(). + + virtual void SetSizeHints( int minW, int minH, + int maxW = wxDefaultCoord, int maxH = wxDefaultCoord, + int incW = wxDefaultCoord, int incH = wxDefaultCoord ) + { DoSetSizeHints(minW, minH, maxW, maxH, incW, incH); } + + void SetSizeHints( const wxSize& minSize, + const wxSize& maxSize=wxDefaultSize, + const wxSize& incSize=wxDefaultSize) + { DoSetSizeHints(minSize.x, minSize.y, maxSize.x, maxSize.y, incSize.x, incSize.y); } + + +#if WXWIN_COMPATIBILITY_2_8 + // these are useless and do nothing since wxWidgets 2.9 + wxDEPRECATED( virtual void SetVirtualSizeHints( int minW, int minH, + int maxW = wxDefaultCoord, int maxH = wxDefaultCoord ) ); + wxDEPRECATED( void SetVirtualSizeHints( const wxSize& minSize, + const wxSize& maxSize=wxDefaultSize) ); +#endif // WXWIN_COMPATIBILITY_2_8 + + + // Call these to override what GetBestSize() returns. This + // method is only virtual because it is overridden in wxTLW + // as a different API for SetSizeHints(). + virtual void SetMinSize(const wxSize& minSize); + virtual void SetMaxSize(const wxSize& maxSize); + + // Like Set*Size, but for client, not window, size + virtual void SetMinClientSize(const wxSize& size) + { SetMinSize(ClientToWindowSize(size)); } + virtual void SetMaxClientSize(const wxSize& size) + { SetMaxSize(ClientToWindowSize(size)); } + + // Override these methods to impose restrictions on min/max size. + // The easier way is to call SetMinSize() and SetMaxSize() which + // will have the same effect. Doing both is non-sense. + virtual wxSize GetMinSize() const { return wxSize(m_minWidth, m_minHeight); } + virtual wxSize GetMaxSize() const { return wxSize(m_maxWidth, m_maxHeight); } + + // Like Get*Size, but for client, not window, size + virtual wxSize GetMinClientSize() const + { return WindowToClientSize(GetMinSize()); } + virtual wxSize GetMaxClientSize() const + { return WindowToClientSize(GetMaxSize()); } + + // Get the min and max values one by one + int GetMinWidth() const { return GetMinSize().x; } + int GetMinHeight() const { return GetMinSize().y; } + int GetMaxWidth() const { return GetMaxSize().x; } + int GetMaxHeight() const { return GetMaxSize().y; } + + + // Methods for accessing the virtual size of a window. For most + // windows this is just the client area of the window, but for + // some like scrolled windows it is more or less independent of + // the screen window size. You may override the DoXXXVirtual + // methods below for classes where that is the case. + + void SetVirtualSize( const wxSize &size ) { DoSetVirtualSize( size.x, size.y ); } + void SetVirtualSize( int x, int y ) { DoSetVirtualSize( x, y ); } + + wxSize GetVirtualSize() const { return DoGetVirtualSize(); } + void GetVirtualSize( int *x, int *y ) const + { + wxSize s( DoGetVirtualSize() ); + + if( x ) + *x = s.GetWidth(); + if( y ) + *y = s.GetHeight(); + } + + // Override these methods for windows that have a virtual size + // independent of their client size. e.g. the virtual area of a + // wxScrolledWindow. + + virtual void DoSetVirtualSize( int x, int y ); + virtual wxSize DoGetVirtualSize() const; + + // Return the largest of ClientSize and BestSize (as determined + // by a sizer, interior children, or other means) + + virtual wxSize GetBestVirtualSize() const + { + wxSize client( GetClientSize() ); + wxSize best( GetBestSize() ); + + return wxSize( wxMax( client.x, best.x ), wxMax( client.y, best.y ) ); + } + + // Return the magnification of the content of this window for the platforms + // using logical pixels different from physical ones, i.e. those for which + // wxHAS_DPI_INDEPENDENT_PIXELS is defined. For the other ones, always + // returns 1, regardless of DPI scale factor returned by the function below. + virtual double GetContentScaleFactor() const; + + // Return the ratio of the DPI used by this window to the standard DPI, + // e.g. 1 for standard DPI screens and 2 for "200% scaling". + virtual double GetDPIScaleFactor() const; + + // return the size of the left/right and top/bottom borders in x and y + // components of the result respectively + virtual wxSize GetWindowBorderSize() const; + + // wxSizer and friends use this to give a chance to a component to recalc + // its min size once one of the final size components is known. Override + // this function when that is useful (such as for wxStaticText which can + // stretch over several lines). Parameter availableOtherDir + // tells the item how much more space there is available in the opposite + // direction (-1 if unknown). + virtual bool + InformFirstDirection(int direction, int size, int availableOtherDir); + + // sends a size event to the window using its current size -- this has an + // effect of refreshing the window layout + // + // by default the event is sent, i.e. processed immediately, but if flags + // value includes wxSEND_EVENT_POST then it's posted, i.e. only schedule + // for later processing + virtual void SendSizeEvent(int flags = 0); + + // this is a safe wrapper for GetParent()->SendSizeEvent(): it checks that + // we have a parent window and it's not in process of being deleted + // + // this is used by controls such as tool/status bars changes to which must + // also result in parent re-layout + void SendSizeEventToParent(int flags = 0); + + // this is a more readable synonym for SendSizeEvent(wxSEND_EVENT_POST) + void PostSizeEvent() { SendSizeEvent(wxSEND_EVENT_POST); } + + // this is the same as SendSizeEventToParent() but using PostSizeEvent() + void PostSizeEventToParent() { SendSizeEventToParent(wxSEND_EVENT_POST); } + + // These functions should be used before repositioning the children of + // this window to reduce flicker or, in MSW case, even avoid display + // corruption in some situations (so they're more than just optimization). + // + // EndRepositioningChildren() should be called if and only if + // BeginRepositioningChildren() returns true. To ensure that this is always + // done automatically, use ChildrenRepositioningGuard class below. + virtual bool BeginRepositioningChildren() { return false; } + virtual void EndRepositioningChildren() { } + + // A simple helper which ensures that EndRepositioningChildren() is called + // from its dtor if and only if calling BeginRepositioningChildren() from + // the ctor returned true. + class ChildrenRepositioningGuard + { + public: + // Notice that window can be NULL here, for convenience. In this case + // this class simply doesn't do anything. + explicit ChildrenRepositioningGuard(wxWindowBase* win) + : m_win(win), + m_callEnd(win && win->BeginRepositioningChildren()) + { + } + + ~ChildrenRepositioningGuard() + { + if ( m_callEnd ) + m_win->EndRepositioningChildren(); + } + + private: + wxWindowBase* const m_win; + const bool m_callEnd; + + wxDECLARE_NO_COPY_CLASS(ChildrenRepositioningGuard); + }; + + + // window state + // ------------ + + // returns true if window was shown/hidden, false if the nothing was + // done (window was already shown/hidden) + virtual bool Show( bool show = true ); + bool Hide() { return Show(false); } + + // show or hide the window with a special effect, not implemented on + // most platforms (where it is the same as Show()/Hide() respectively) + // + // timeout specifies how long the animation should take, in ms, the + // default value of 0 means to use the default (system-dependent) value + virtual bool ShowWithEffect(wxShowEffect WXUNUSED(effect), + unsigned WXUNUSED(timeout) = 0) + { + return Show(); + } + + virtual bool HideWithEffect(wxShowEffect WXUNUSED(effect), + unsigned WXUNUSED(timeout) = 0) + { + return Hide(); + } + + // returns true if window was enabled/disabled, false if nothing done + virtual bool Enable( bool enable = true ); + bool Disable() { return Enable(false); } + + virtual bool IsShown() const { return m_isShown; } + // returns true if the window is really enabled and false otherwise, + // whether because it had been explicitly disabled itself or because + // its parent is currently disabled -- then this method returns false + // whatever is the intrinsic state of this window, use IsThisEnabled(0 + // to retrieve it. In other words, this relation always holds: + // + // IsEnabled() == IsThisEnabled() && parent.IsEnabled() + // + bool IsEnabled() const; + + // returns the internal window state independently of the parent(s) + // state, i.e. the state in which the window would be if all its + // parents were enabled (use IsEnabled() above to get the effective + // window state) + virtual bool IsThisEnabled() const { return m_isEnabled; } + + // returns true if the window is visible, i.e. IsShown() returns true + // if called on it and all its parents up to the first TLW + virtual bool IsShownOnScreen() const; + + // get/set window style (setting style won't update the window and so + // is only useful for internal usage) + virtual void SetWindowStyleFlag( long style ) { m_windowStyle = style; } + virtual long GetWindowStyleFlag() const { return m_windowStyle; } + + // just some (somewhat shorter) synonyms + void SetWindowStyle( long style ) { SetWindowStyleFlag(style); } + long GetWindowStyle() const { return GetWindowStyleFlag(); } + + // check if the flag is set + bool HasFlag(int flag) const { return (m_windowStyle & flag) != 0; } + virtual bool IsRetained() const { return HasFlag(wxRETAINED); } + + // turn the flag on if it had been turned off before and vice versa, + // return true if the flag is currently turned on + bool ToggleWindowStyle(int flag); + + // extra style: the less often used style bits which can't be set with + // SetWindowStyleFlag() + virtual void SetExtraStyle(long exStyle) { m_exStyle = exStyle; } + long GetExtraStyle() const { return m_exStyle; } + + bool HasExtraStyle(int exFlag) const { return (m_exStyle & exFlag) != 0; } + +#if WXWIN_COMPATIBILITY_2_8 + // make the window modal (all other windows unresponsive) + wxDEPRECATED( virtual void MakeModal(bool modal = true) ); +#endif + + // (primitive) theming support + // --------------------------- + + virtual void SetThemeEnabled(bool enableTheme) { m_themeEnabled = enableTheme; } + virtual bool GetThemeEnabled() const { return m_themeEnabled; } + + + // focus and keyboard handling + // --------------------------- + + // set focus to this window + virtual void SetFocus() = 0; + + // set focus to this window as the result of a keyboard action + virtual void SetFocusFromKbd() { SetFocus(); } + + // return the window which currently has the focus or NULL + static wxWindow *FindFocus(); + + static wxWindow *DoFindFocus() /* = 0: implement in derived classes */; + + // return true if the window has focus (handles composite windows + // correctly - returns true if GetMainWindowOfCompositeControl() + // has focus) + virtual bool HasFocus() const; + + // can this window have focus in principle? + // + // the difference between AcceptsFocus[FromKeyboard]() and CanAcceptFocus + // [FromKeyboard]() is that the former functions are meant to be + // overridden in the derived classes to simply return false if the + // control can't have focus, while the latter are meant to be used by + // this class clients and take into account the current window state + virtual bool AcceptsFocus() const { return true; } + + // can this window or one of its children accept focus? + // + // usually it's the same as AcceptsFocus() but is overridden for + // container windows + virtual bool AcceptsFocusRecursively() const { return AcceptsFocus(); } + + // can this window be given focus by keyboard navigation? if not, the + // only way to give it focus (provided it accepts it at all) is to + // click it + virtual bool AcceptsFocusFromKeyboard() const + { return !m_disableFocusFromKbd && AcceptsFocus(); } + + // Disable any input focus from the keyboard + void DisableFocusFromKeyboard() { m_disableFocusFromKbd = true; } + + + // Can this window be focused right now, in its current state? This + // shouldn't be called at all if AcceptsFocus() returns false. + // + // It is a convenient helper for the various functions using it below + // but also a hook allowing to override the default logic for some rare + // cases (currently just wxRadioBox in wxMSW) when it's inappropriate. + virtual bool CanBeFocused() const { return IsShown() && IsEnabled(); } + + // can this window itself have focus? + bool IsFocusable() const { return AcceptsFocus() && CanBeFocused(); } + + // can this window have focus right now? + // + // if this method returns true, it means that calling SetFocus() will + // put focus either to this window or one of its children, if you need + // to know whether this window accepts focus itself, use IsFocusable() + bool CanAcceptFocus() const + { return AcceptsFocusRecursively() && CanBeFocused(); } + + // can this window be assigned focus from keyboard right now? + bool CanAcceptFocusFromKeyboard() const + { return AcceptsFocusFromKeyboard() && CanBeFocused(); } + + // call this when the return value of AcceptsFocus() changes + virtual void SetCanFocus(bool WXUNUSED(canFocus)) { } + + // call to customize visible focus indicator if possible in the port + virtual void EnableVisibleFocus(bool WXUNUSED(enabled)) { } + + // navigates inside this window + bool NavigateIn(int flags = wxNavigationKeyEvent::IsForward) + { return DoNavigateIn(flags); } + + // navigates in the specified direction from this window, this is + // equivalent to GetParent()->NavigateIn() + bool Navigate(int flags = wxNavigationKeyEvent::IsForward) + { return m_parent && ((wxWindowBase *)m_parent)->DoNavigateIn(flags); } + + // this function will generate the appropriate call to Navigate() if the + // key event is one normally used for keyboard navigation and return true + // in this case + bool HandleAsNavigationKey(const wxKeyEvent& event); + + // move this window just before/after the specified one in tab order + // (the other window must be our sibling!) + void MoveBeforeInTabOrder(wxWindow *win) + { DoMoveInTabOrder(win, OrderBefore); } + void MoveAfterInTabOrder(wxWindow *win) + { DoMoveInTabOrder(win, OrderAfter); } + + + // parent/children relations + // ------------------------- + + // get the list of children + const wxWindowList& GetChildren() const { return m_children; } + wxWindowList& GetChildren() { return m_children; } + + // needed just for extended runtime + const wxWindowList& GetWindowChildren() const { return GetChildren() ; } + + // get the window before/after this one in the parents children list, + // returns NULL if this is the first/last window + wxWindow *GetPrevSibling() const { return DoGetSibling(OrderBefore); } + wxWindow *GetNextSibling() const { return DoGetSibling(OrderAfter); } + + // get the parent or the parent of the parent + wxWindow *GetParent() const { return m_parent; } + inline wxWindow *GetGrandParent() const; + + // is this window a top level one? + virtual bool IsTopLevel() const; + + // is this window a child or grand child of this one (inside the same + // TLW)? + bool IsDescendant(wxWindowBase* win) const; + + // it doesn't really change parent, use Reparent() instead + void SetParent( wxWindowBase *parent ); + // change the real parent of this window, return true if the parent + // was changed, false otherwise (error or newParent == oldParent) + virtual bool Reparent( wxWindowBase *newParent ); + + // implementation mostly + virtual void AddChild( wxWindowBase *child ); + virtual void RemoveChild( wxWindowBase *child ); + + // returns true if the child is in the client area of the window, i.e. is + // not scrollbar, toolbar etc. + virtual bool IsClientAreaChild(const wxWindow *WXUNUSED(child)) const + { return true; } + + // looking for windows + // ------------------- + + // find window among the descendants of this one either by id or by + // name (return NULL if not found) + wxWindow *FindWindow(long winid) const; + wxWindow *FindWindow(const wxString& name) const; + + // Find a window among any window (all return NULL if not found) + static wxWindow *FindWindowById( long winid, const wxWindow *parent = NULL ); + static wxWindow *FindWindowByName( const wxString& name, + const wxWindow *parent = NULL ); + static wxWindow *FindWindowByLabel( const wxString& label, + const wxWindow *parent = NULL ); + + // event handler stuff + // ------------------- + + // get the current event handler + wxEvtHandler *GetEventHandler() const { return m_eventHandler; } + + // replace the event handler (allows to completely subclass the + // window) + void SetEventHandler( wxEvtHandler *handler ); + + // push/pop event handler: allows to chain a custom event handler to + // already existing ones + void PushEventHandler( wxEvtHandler *handler ); + wxEvtHandler *PopEventHandler( bool deleteHandler = false ); + + // find the given handler in the event handler chain and remove (but + // not delete) it from the event handler chain, return true if it was + // found and false otherwise (this also results in an assert failure so + // this function should only be called when the handler is supposed to + // be there) + bool RemoveEventHandler(wxEvtHandler *handler); + + // Process an event by calling GetEventHandler()->ProcessEvent(): this + // is a straightforward replacement for ProcessEvent() itself which + // shouldn't be used directly with windows as it doesn't take into + // account any event handlers associated with the window + bool ProcessWindowEvent(wxEvent& event) + { return GetEventHandler()->ProcessEvent(event); } + + // Call GetEventHandler()->ProcessEventLocally(): this should be used + // instead of calling ProcessEventLocally() directly on the window + // itself as this wouldn't take any pushed event handlers into account + // correctly + bool ProcessWindowEventLocally(wxEvent& event) + { return GetEventHandler()->ProcessEventLocally(event); } + + // Process an event by calling GetEventHandler()->ProcessEvent() and + // handling any exceptions thrown by event handlers. It's mostly useful + // when processing wx events when called from C code (e.g. in GTK+ + // callback) when the exception wouldn't correctly propagate to + // wxEventLoop. + bool HandleWindowEvent(wxEvent& event) const; + + // disable wxEvtHandler double-linked list mechanism: + virtual void SetNextHandler(wxEvtHandler *handler) wxOVERRIDE; + virtual void SetPreviousHandler(wxEvtHandler *handler) wxOVERRIDE; + + +protected: + + // NOTE: we change the access specifier of the following wxEvtHandler functions + // so that the user won't be able to call them directly. + // Calling wxWindow::ProcessEvent in fact only works when there are NO + // event handlers pushed on the window. + // To ensure correct operation, instead of wxWindow::ProcessEvent + // you must always call wxWindow::GetEventHandler()->ProcessEvent() + // or HandleWindowEvent(). + // The same holds for all other wxEvtHandler functions. + + using wxEvtHandler::ProcessEvent; + using wxEvtHandler::ProcessEventLocally; +#if wxUSE_THREADS + using wxEvtHandler::ProcessThreadEvent; +#endif + using wxEvtHandler::SafelyProcessEvent; + using wxEvtHandler::ProcessPendingEvents; + using wxEvtHandler::AddPendingEvent; + using wxEvtHandler::QueueEvent; + +public: + + // validators + // ---------- + +#if wxUSE_VALIDATORS + // a window may have an associated validator which is used to control + // user input + virtual void SetValidator( const wxValidator &validator ); + virtual wxValidator *GetValidator() { return m_windowValidator; } +#endif // wxUSE_VALIDATORS + + + // dialog oriented functions + // ------------------------- + + // validate the correctness of input, return true if ok + virtual bool Validate(); + + // transfer data between internal and GUI representations + virtual bool TransferDataToWindow(); + virtual bool TransferDataFromWindow(); + + virtual void InitDialog(); + +#if wxUSE_ACCEL + // accelerators + // ------------ + virtual void SetAcceleratorTable( const wxAcceleratorTable& accel ) + { m_acceleratorTable = accel; } + wxAcceleratorTable *GetAcceleratorTable() + { return &m_acceleratorTable; } + +#endif // wxUSE_ACCEL + +#if wxUSE_HOTKEY + // hot keys (system wide accelerators) + // ----------------------------------- + + virtual bool RegisterHotKey(int hotkeyId, int modifiers, int keycode); + virtual bool UnregisterHotKey(int hotkeyId); +#endif // wxUSE_HOTKEY + + + // translation between different units + // ----------------------------------- + + // Get the DPI used by the given window or wxSize(0, 0) if unknown. + virtual wxSize GetDPI() const; + + // Some ports need to modify the font object when the DPI of the window it + // is used with changes, this function can be used to do it. + // + // Currently it is only used in wxMSW and is not considered to be part of + // wxWidgets public API. + virtual void WXAdjustFontToOwnPPI(wxFont& WXUNUSED(font)) const { } + + // All pixel coordinates used in wx API are in logical pixels, which + // are the same as physical screen pixels under MSW, but same as DIPs + // (see below) under the other ports. The functions defined here can be + // used under all platforms to convert between them without using any + // preprocessor checks. + +#ifdef wxHAS_DPI_INDEPENDENT_PIXELS + static wxSize FromPhys(wxSize sz, const wxWindowBase* w); +#else + static wxSize FromPhys(const wxSize& sz, const wxWindowBase* WXUNUSED(w)) + { + return sz; + } +#endif + static wxPoint FromPhys(const wxPoint& pt, const wxWindowBase* w) + { + const wxSize sz = FromPhys(wxSize(pt.x, pt.y), w); + return wxPoint(sz.x, sz.y); + } + static int FromPhys(int d, const wxWindowBase* w) + { + return FromPhys(wxSize(d, 0), w).x; + } + + wxSize FromPhys(const wxSize& sz) const { return FromPhys(sz, this); } + wxPoint FromPhys(const wxPoint& pt) const { return FromPhys(pt, this); } + int FromPhys(int d) const { return FromPhys(d, this); } + +#ifdef wxHAS_DPI_INDEPENDENT_PIXELS + static wxSize ToPhys(wxSize sz, const wxWindowBase* w); +#else + static wxSize ToPhys(const wxSize& sz, const wxWindowBase* WXUNUSED(w)) + { + return sz; + } +#endif // wxHAS_DPI_INDEPENDENT_PIXELS + static wxPoint ToPhys(const wxPoint& pt, const wxWindowBase* w) + { + const wxSize sz = ToPhys(wxSize(pt.x, pt.y), w); + return wxPoint(sz.x, sz.y); + } + static int ToPhys(int d, const wxWindowBase* w) + { + return ToPhys(wxSize(d, 0), w).x; + } + + wxSize ToPhys(const wxSize& sz) const { return ToPhys(sz, this); } + wxPoint ToPhys(const wxPoint& pt) const { return ToPhys(pt, this); } + int ToPhys(int d) const { return ToPhys(d, this); } + + + // DPI-independent pixels, or DIPs, are pixel values for the standard + // 96 DPI display, they are scaled to take the current resolution into + // account (i.e. multiplied by the same factor as returned by + // GetDPIScaleFactor()) if necessary for the current platform. + // + // To support monitor-specific resolutions, prefer using the non-static + // member functions or use a valid (non-null) window pointer. + // + // Similarly, currently in practice the factor is the same in both + // horizontal and vertical directions, but this could, in principle, + // change too, so prefer using the overloads taking wxPoint or wxSize. + +#ifdef wxHAS_DPI_INDEPENDENT_PIXELS + static wxSize FromDIP(const wxSize& sz, const wxWindowBase* WXUNUSED(w)) + { + return sz; + } +#else + static wxSize FromDIP(const wxSize& sz, const wxWindowBase* w); +#endif // wxHAS_DPI_INDEPENDENT_PIXELS + static wxPoint FromDIP(const wxPoint& pt, const wxWindowBase* w) + { + const wxSize sz = FromDIP(wxSize(pt.x, pt.y), w); + return wxPoint(sz.x, sz.y); + } + static int FromDIP(int d, const wxWindowBase* w) + { + return FromDIP(wxSize(d, 0), w).x; + } + + wxSize FromDIP(const wxSize& sz) const { return FromDIP(sz, this); } + wxPoint FromDIP(const wxPoint& pt) const { return FromDIP(pt, this); } + int FromDIP(int d) const { return FromDIP(d, this); } + +#ifdef wxHAS_DPI_INDEPENDENT_PIXELS + static wxSize ToDIP(const wxSize& sz, const wxWindowBase* WXUNUSED(w)) + { + return sz; + } +#else + static wxSize ToDIP(const wxSize& sz, const wxWindowBase* w); +#endif // wxHAS_DPI_INDEPENDENT_PIXELS + static wxPoint ToDIP(const wxPoint& pt, const wxWindowBase* w) + { + const wxSize sz = ToDIP(wxSize(pt.x, pt.y), w); + return wxPoint(sz.x, sz.y); + } + static int ToDIP(int d, const wxWindowBase* w) + { + return ToDIP(wxSize(d, 0), w).x; + } + + wxSize ToDIP(const wxSize& sz) const { return ToDIP(sz, this); } + wxPoint ToDIP(const wxPoint& pt) const { return ToDIP(pt, this); } + int ToDIP(int d) const { return ToDIP(d, this); } + + + // Dialog units are based on the size of the current font. + + wxPoint ConvertPixelsToDialog( const wxPoint& pt ) const; + wxPoint ConvertDialogToPixels( const wxPoint& pt ) const; + wxSize ConvertPixelsToDialog( const wxSize& sz ) const + { + wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y))); + + return wxSize(pt.x, pt.y); + } + + wxSize ConvertDialogToPixels( const wxSize& sz ) const + { + wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y))); + + return wxSize(pt.x, pt.y); + } + + // mouse functions + // --------------- + + // move the mouse to the specified position + virtual void WarpPointer(int x, int y) = 0; + + // start or end mouse capture, these functions maintain the stack of + // windows having captured the mouse and after calling ReleaseMouse() + // the mouse is not released but returns to the window which had + // captured it previously (if any) + void CaptureMouse(); + void ReleaseMouse(); + + // get the window which currently captures the mouse or NULL + static wxWindow *GetCapture(); + + // does this window have the capture? + virtual bool HasCapture() const + { return reinterpret_cast<const wxWindow*>(this) == GetCapture(); } + + // enable the specified touch events for this window, return false if + // the requested events are not supported + virtual bool EnableTouchEvents(int WXUNUSED(eventsMask)) + { + return false; + } + + // painting the window + // ------------------- + + // mark the specified rectangle (or the whole window) as "dirty" so it + // will be repainted + virtual void Refresh( bool eraseBackground = true, + const wxRect *rect = (const wxRect *) NULL ) = 0; + + // a less awkward wrapper for Refresh + void RefreshRect(const wxRect& rect, bool eraseBackground = true) + { + Refresh(eraseBackground, &rect); + } + + // repaint all invalid areas of the window immediately + virtual void Update() { } + + // clear the window background + virtual void ClearBackground(); + + // freeze the window: don't redraw it until it is thawed + void Freeze(); + + // thaw the window: redraw it after it had been frozen + void Thaw(); + + // return true if window had been frozen and not unthawed yet + bool IsFrozen() const { return m_freezeCount != 0; } + + // adjust DC for drawing on this window + virtual void PrepareDC( wxDC & WXUNUSED(dc) ) { } + + // enable or disable double buffering + virtual void SetDoubleBuffered(bool WXUNUSED(on)) { } + + // return true if the window contents is double buffered by the system + virtual bool IsDoubleBuffered() const { return false; } + + // the update region of the window contains the areas which must be + // repainted by the program + const wxRegion& GetUpdateRegion() const { return m_updateRegion; } + wxRegion& GetUpdateRegion() { return m_updateRegion; } + + // get the update rectangle region bounding box in client coords + wxRect GetUpdateClientRect() const; + + // these functions verify whether the given point/rectangle belongs to + // (or at least intersects with) the update region + virtual bool DoIsExposed( int x, int y ) const; + virtual bool DoIsExposed( int x, int y, int w, int h ) const; + + bool IsExposed( int x, int y ) const + { return DoIsExposed(x, y); } + bool IsExposed( int x, int y, int w, int h ) const + { return DoIsExposed(x, y, w, h); } + bool IsExposed( const wxPoint& pt ) const + { return DoIsExposed(pt.x, pt.y); } + bool IsExposed( const wxRect& rect ) const + { return DoIsExposed(rect.x, rect.y, rect.width, rect.height); } + + // colours, fonts and cursors + // -------------------------- + + // get the default attributes for the controls of this class: we + // provide a virtual function which can be used to query the default + // attributes of an existing control and a static function which can + // be used even when no existing object of the given class is + // available, but which won't return any styles specific to this + // particular control, of course (e.g. "Ok" button might have + // different -- bold for example -- font) + virtual wxVisualAttributes GetDefaultAttributes() const + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // set/retrieve the window colours (system defaults are used by + // default): SetXXX() functions return true if colour was changed, + // SetDefaultXXX() reset the "m_inheritXXX" flag after setting the + // value to prevent it from being inherited by our children + virtual bool SetBackgroundColour(const wxColour& colour); + void SetOwnBackgroundColour(const wxColour& colour) + { + if ( SetBackgroundColour(colour) ) + m_inheritBgCol = false; + } + wxColour GetBackgroundColour() const; + bool InheritsBackgroundColour() const + { + return m_inheritBgCol; + } + bool UseBgCol() const + { + return m_hasBgCol; + } + bool UseBackgroundColour() const + { + return UseBgCol(); + } + + virtual bool SetForegroundColour(const wxColour& colour); + void SetOwnForegroundColour(const wxColour& colour) + { + if ( SetForegroundColour(colour) ) + m_inheritFgCol = false; + } + wxColour GetForegroundColour() const; + bool UseForegroundColour() const + { + return m_hasFgCol; + } + bool InheritsForegroundColour() const + { + return m_inheritFgCol; + } + + // Set/get the background style. + virtual bool SetBackgroundStyle(wxBackgroundStyle style); + wxBackgroundStyle GetBackgroundStyle() const + { return m_backgroundStyle; } + + // returns true if the control has "transparent" areas such as a + // wxStaticText and wxCheckBox and the background should be adapted + // from a parent window + virtual bool HasTransparentBackground() { return false; } + + // Returns true if background transparency is supported for this + // window, i.e. if calling SetBackgroundStyle(wxBG_STYLE_TRANSPARENT) + // has a chance of succeeding. If reason argument is non-NULL, returns a + // user-readable explanation of why it isn't supported if the return + // value is false. + virtual bool IsTransparentBackgroundSupported(wxString* reason = NULL) const; + + // set/retrieve the font for the window (SetFont() returns true if the + // font really changed) + virtual bool SetFont(const wxFont& font) = 0; + void SetOwnFont(const wxFont& font) + { + if ( SetFont(font) ) + m_inheritFont = false; + } + wxFont GetFont() const; + + // set/retrieve the cursor for this window (SetCursor() returns true + // if the cursor was really changed) + virtual bool SetCursor( const wxCursor &cursor ); + const wxCursor& GetCursor() const { return m_cursor; } + +#if wxUSE_CARET + // associate a caret with the window + void SetCaret(wxCaret *caret); + // get the current caret (may be NULL) + wxCaret *GetCaret() const { return m_caret; } +#endif // wxUSE_CARET + + // get the (average) character size for the current font + virtual int GetCharHeight() const = 0; + virtual int GetCharWidth() const = 0; + + // get the width/height/... of the text using current or specified + // font + void GetTextExtent(const wxString& string, + int *x, int *y, + int *descent = NULL, + int *externalLeading = NULL, + const wxFont *font = NULL) const + { + DoGetTextExtent(string, x, y, descent, externalLeading, font); + } + + wxSize GetTextExtent(const wxString& string) const + { + wxCoord w, h; + GetTextExtent(string, &w, &h); + return wxSize(w, h); + } + + // client <-> screen coords + // ------------------------ + + // translate to/from screen/client coordinates (pointers may be NULL) + void ClientToScreen( int *x, int *y ) const + { DoClientToScreen(x, y); } + void ScreenToClient( int *x, int *y ) const + { DoScreenToClient(x, y); } + + // wxPoint interface to do the same thing + wxPoint ClientToScreen(const wxPoint& pt) const + { + int x = pt.x, y = pt.y; + DoClientToScreen(&x, &y); + + return wxPoint(x, y); + } + + wxPoint ScreenToClient(const wxPoint& pt) const + { + int x = pt.x, y = pt.y; + DoScreenToClient(&x, &y); + + return wxPoint(x, y); + } + + // test where the given (in client coords) point lies + wxHitTest HitTest(wxCoord x, wxCoord y) const + { return DoHitTest(x, y); } + + wxHitTest HitTest(const wxPoint& pt) const + { return DoHitTest(pt.x, pt.y); } + + // misc + // ---- + + // get the window border style from the given flags: this is different from + // simply doing flags & wxBORDER_MASK because it uses GetDefaultBorder() to + // translate wxBORDER_DEFAULT to something reasonable + wxBorder GetBorder(long flags) const; + + // get border for the flags of this window + wxBorder GetBorder() const { return GetBorder(GetWindowStyleFlag()); } + + // send wxUpdateUIEvents to this window, and children if recurse is true + virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE); + + // do the window-specific processing after processing the update event + virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) ; + +#if wxUSE_MENUS + // show popup menu at the given position, generate events for the items + // selected in it + bool PopupMenu(wxMenu *menu, const wxPoint& pos = wxDefaultPosition) + { return PopupMenu(menu, pos.x, pos.y); } + bool PopupMenu(wxMenu *menu, int x, int y); + + // simply return the id of the selected item or wxID_NONE without + // generating any events + int GetPopupMenuSelectionFromUser(wxMenu& menu, + const wxPoint& pos = wxDefaultPosition) + { return DoGetPopupMenuSelectionFromUser(menu, pos.x, pos.y); } + int GetPopupMenuSelectionFromUser(wxMenu& menu, int x, int y) + { return DoGetPopupMenuSelectionFromUser(menu, x, y); } +#endif // wxUSE_MENUS + + // override this method to return true for controls having multiple pages + virtual bool HasMultiplePages() const { return false; } + + + // scrollbars + // ---------- + + // can the window have the scrollbar in this orientation? + virtual bool CanScroll(int orient) const; + + // does the window have the scrollbar in this orientation? + bool HasScrollbar(int orient) const; + + // configure the window scrollbars + virtual void SetScrollbar( int orient, + int pos, + int thumbvisible, + int range, + bool refresh = true ) = 0; + virtual void SetScrollPos( int orient, int pos, bool refresh = true ) = 0; + virtual int GetScrollPos( int orient ) const = 0; + virtual int GetScrollThumb( int orient ) const = 0; + virtual int GetScrollRange( int orient ) const = 0; + + // scroll window to the specified position + virtual void ScrollWindow( int dx, int dy, + const wxRect* rect = NULL ) = 0; + + // scrolls window by line/page: note that not all controls support this + // + // return true if the position changed, false otherwise + virtual bool ScrollLines(int WXUNUSED(lines)) { return false; } + virtual bool ScrollPages(int WXUNUSED(pages)) { return false; } + + // convenient wrappers for ScrollLines/Pages + bool LineUp() { return ScrollLines(-1); } + bool LineDown() { return ScrollLines(1); } + bool PageUp() { return ScrollPages(-1); } + bool PageDown() { return ScrollPages(1); } + + // call this to always show one or both scrollbars, even if the window + // is big enough to not require them + virtual void AlwaysShowScrollbars(bool WXUNUSED(horz) = true, + bool WXUNUSED(vert) = true) + { + } + + // return true if AlwaysShowScrollbars() had been called before for the + // corresponding orientation + virtual bool IsScrollbarAlwaysShown(int WXUNUSED(orient)) const + { + return false; + } + + // context-sensitive help + // ---------------------- + + // these are the convenience functions wrapping wxHelpProvider methods + +#if wxUSE_HELP + // associate this help text with this window + void SetHelpText(const wxString& text); + +#if WXWIN_COMPATIBILITY_2_8 + // Associate this help text with all windows with the same id as this one. + // Don't use this, do wxHelpProvider::Get()->AddHelp(id, text); + wxDEPRECATED( void SetHelpTextForId(const wxString& text) ); +#endif // WXWIN_COMPATIBILITY_2_8 + + // get the help string associated with the given position in this window + // + // notice that pt may be invalid if event origin is keyboard or unknown + // and this method should return the global window help text then + virtual wxString GetHelpTextAtPoint(const wxPoint& pt, + wxHelpEvent::Origin origin) const; + // returns the position-independent help text + wxString GetHelpText() const + { + return GetHelpTextAtPoint(wxDefaultPosition, wxHelpEvent::Origin_Unknown); + } + +#else // !wxUSE_HELP + // silently ignore SetHelpText() calls + void SetHelpText(const wxString& WXUNUSED(text)) { } + void SetHelpTextForId(const wxString& WXUNUSED(text)) { } +#endif // wxUSE_HELP + + // tooltips + // -------- + +#if wxUSE_TOOLTIPS + // the easiest way to set a tooltip for a window is to use this method + void SetToolTip( const wxString &tip ) { DoSetToolTipText(tip); } + // attach a tooltip to the window, pointer can be NULL to remove + // existing tooltip + void SetToolTip( wxToolTip *tip ) { DoSetToolTip(tip); } + // more readable synonym for SetToolTip(NULL) + void UnsetToolTip() { SetToolTip(NULL); } + // get the associated tooltip or NULL if none + wxToolTip* GetToolTip() const { return m_tooltip; } + wxString GetToolTipText() const; + + // Use the same tool tip as the given one (which can be NULL to indicate + // that no tooltip should be used) for this window. This is currently only + // used by wxCompositeWindow::DoSetToolTip() implementation and is not part + // of the public wx API. + // + // Returns true if tip was valid and we copied it or false if it was NULL + // and we reset our own tooltip too. + bool CopyToolTip(wxToolTip *tip); +#else // !wxUSE_TOOLTIPS + // make it much easier to compile apps in an environment + // that doesn't support tooltips + void SetToolTip(const wxString & WXUNUSED(tip)) { } + void UnsetToolTip() { } +#endif // wxUSE_TOOLTIPS/!wxUSE_TOOLTIPS + + // drag and drop + // ------------- +#if wxUSE_DRAG_AND_DROP + // set/retrieve the drop target associated with this window (may be + // NULL; it's owned by the window and will be deleted by it) + virtual void SetDropTarget( wxDropTarget *dropTarget ) = 0; + virtual wxDropTarget *GetDropTarget() const { return m_dropTarget; } + + // Accept files for dragging + virtual void DragAcceptFiles(bool accept) +#ifdef __WXMSW__ + // it does have common implementation but not for MSW which has its own + // native version of it + = 0 +#endif // __WXMSW__ + ; + +#endif // wxUSE_DRAG_AND_DROP + + // constraints and sizers + // ---------------------- +#if wxUSE_CONSTRAINTS + // set the constraints for this window or retrieve them (may be NULL) + void SetConstraints( wxLayoutConstraints *constraints ); + wxLayoutConstraints *GetConstraints() const { return m_constraints; } + + // implementation only + void UnsetConstraints(wxLayoutConstraints *c); + wxWindowList *GetConstraintsInvolvedIn() const + { return m_constraintsInvolvedIn; } + void AddConstraintReference(wxWindowBase *otherWin); + void RemoveConstraintReference(wxWindowBase *otherWin); + void DeleteRelatedConstraints(); + void ResetConstraints(); + + // these methods may be overridden for special layout algorithms + virtual void SetConstraintSizes(bool recurse = true); + virtual bool LayoutPhase1(int *noChanges); + virtual bool LayoutPhase2(int *noChanges); + virtual bool DoPhase(int phase); + + // these methods are virtual but normally won't be overridden + virtual void SetSizeConstraint(int x, int y, int w, int h); + virtual void MoveConstraint(int x, int y); + virtual void GetSizeConstraint(int *w, int *h) const ; + virtual void GetClientSizeConstraint(int *w, int *h) const ; + virtual void GetPositionConstraint(int *x, int *y) const ; + +#endif // wxUSE_CONSTRAINTS + + // when using constraints or sizers, it makes sense to update + // children positions automatically whenever the window is resized + // - this is done if autoLayout is on + void SetAutoLayout( bool autoLayout ) { m_autoLayout = autoLayout; } + bool GetAutoLayout() const { return m_autoLayout; } + + // lay out the window and its children + virtual bool Layout(); + + // sizers + void SetSizer(wxSizer *sizer, bool deleteOld = true ); + void SetSizerAndFit( wxSizer *sizer, bool deleteOld = true ); + + wxSizer *GetSizer() const { return m_windowSizer; } + + // Track if this window is a member of a sizer + void SetContainingSizer(wxSizer* sizer); + wxSizer *GetContainingSizer() const { return m_containingSizer; } + + // accessibility + // ---------------------- +#if wxUSE_ACCESSIBILITY + // Override to create a specific accessible object. + virtual wxAccessible* CreateAccessible() { return NULL; } + + // Sets the accessible object. + void SetAccessible(wxAccessible* accessible) ; + + // Returns the accessible object. + wxAccessible* GetAccessible() { return m_accessible; } + + // Returns the accessible object, calling CreateAccessible if necessary. + // May return NULL, in which case system-provide accessible is used. + wxAccessible* GetOrCreateAccessible() ; +#endif + + + // Set window transparency if the platform supports it + virtual bool SetTransparent(wxByte WXUNUSED(alpha)) { return false; } + virtual bool CanSetTransparent() { return false; } + + + // implementation + // -------------- + + // event handlers + void OnSysColourChanged( wxSysColourChangedEvent& event ); + void OnInitDialog( wxInitDialogEvent &event ); + void OnMiddleClick( wxMouseEvent& event ); +#if wxUSE_HELP + void OnHelp(wxHelpEvent& event); +#endif // wxUSE_HELP + + // virtual function for implementing internal idle + // behaviour + virtual void OnInternalIdle(); + + // Send idle event to window and all subwindows + // Returns true if more idle time is requested. + virtual bool SendIdleEvents(wxIdleEvent& event); + + // Send wxContextMenuEvent and return true if it was processed. + // + // Note that the event may end up being sent to a different window, if this + // window is part of a composite control. + bool WXSendContextMenuEvent(const wxPoint& posInScreenCoords); + + // This internal function needs to be called to set the fitting client size + // (i.e. the minimum size determined by the window sizer) when the size + // that we really need to use is not known until the window is actually + // shown, as is the case for TLWs with recent GTK versions, as it will + // update the size again when it does become known, if necessary. + // + // The optional sizer argument can be passed to use the given sizer for + // laying out the window, which is useful if this function is called before + // SetSizer(). By default the window sizer is used. + virtual void WXSetInitialFittingClientSize(int flags, wxSizer* sizer = NULL); + + // get the handle of the window for the underlying window system: this + // is only used for wxWin itself or for user code which wants to call + // platform-specific APIs + virtual WXWidget GetHandle() const = 0; + // associate the window with a new native handle + virtual void AssociateHandle(WXWidget WXUNUSED(handle)) { } + // dissociate the current native handle from the window + virtual void DissociateHandle() { } + +#if wxUSE_PALETTE + // Store the palette used by DCs in wxWindow so that the dcs can share + // a palette. And we can respond to palette messages. + wxPalette GetPalette() const { return m_palette; } + + // When palette is changed tell the DC to set the system palette to the + // new one. + void SetPalette(const wxPalette& pal); + + // return true if we have a specific palette + bool HasCustomPalette() const { return m_hasCustomPalette; } + + // return the first parent window with a custom palette or NULL + wxWindow *GetAncestorWithCustomPalette() const; +#endif // wxUSE_PALETTE + + // inherit the parents visual attributes if they had been explicitly set + // by the user (i.e. we don't inherit default attributes) and if we don't + // have our own explicitly set + virtual void InheritAttributes(); + + // returns false from here if this window doesn't want to inherit the + // parents colours even if InheritAttributes() would normally do it + // + // this just provides a simple way to customize InheritAttributes() + // behaviour in the most common case + virtual bool ShouldInheritColours() const { return false; } + + // returns true if the window can be positioned outside of parent's client + // area (normal windows can't, but e.g. menubar or statusbar can): + virtual bool CanBeOutsideClientArea() const { return false; } + + // returns true if the platform should explicitly apply a theme border. Currently + // used only by Windows + virtual bool CanApplyThemeBorder() const { return true; } + + // returns the main window of composite control; this is the window + // that FindFocus returns if the focus is in one of composite control's + // windows + virtual wxWindow *GetMainWindowOfCompositeControl() + { return (wxWindow*)this; } + + enum NavigationKind + { + Navigation_Tab, + Navigation_Accel + }; + + // If this function returns true, keyboard events of the given kind can't + // escape from it. A typical example of such "navigation domain" is a top + // level window because pressing TAB in one of them must not transfer focus + // to a different top level window. But it's not limited to them, e.g. MDI + // children frames are not top level windows (and their IsTopLevel() + // returns false) but still are self-contained navigation domains for the + // purposes of TAB navigation -- but not for the accelerators. + virtual bool IsTopNavigationDomain(NavigationKind WXUNUSED(kind)) const + { + return false; + } + + // This is an internal helper function implemented by text-like controls. + virtual const wxTextEntry* WXGetTextEntry() const { return NULL; } + +protected: + // helper for the derived class Create() methods: the first overload, with + // validator parameter, should be used for child windows while the second + // one is used for top level ones + bool CreateBase(wxWindowBase *parent, + wxWindowID winid, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxASCII_STR(wxPanelNameStr)); + + bool CreateBase(wxWindowBase *parent, + wxWindowID winid, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name); + + // event handling specific to wxWindow + virtual bool TryBefore(wxEvent& event) wxOVERRIDE; + virtual bool TryAfter(wxEvent& event) wxOVERRIDE; + + enum WindowOrder + { + OrderBefore, // insert before the given window + OrderAfter // insert after the given window + }; + + // common part of GetPrev/NextSibling() + wxWindow *DoGetSibling(WindowOrder order) const; + + // common part of MoveBefore/AfterInTabOrder() + virtual void DoMoveInTabOrder(wxWindow *win, WindowOrder move); + + // implementation of Navigate() and NavigateIn() + virtual bool DoNavigateIn(int flags); + +#if wxUSE_CONSTRAINTS + // satisfy the constraints for the windows but don't set the window sizes + void SatisfyConstraints(); +#endif // wxUSE_CONSTRAINTS + + // Send the wxWindowDestroyEvent if not done yet and sets m_isBeingDeleted + // to true + void SendDestroyEvent(); + + // this method should be implemented to use operating system specific code + // to really enable/disable the widget, it will only be called when we + // really need to enable/disable window and so no additional checks on the + // widgets state are necessary + virtual void DoEnable(bool WXUNUSED(enable)) { } + + + // the window id - a number which uniquely identifies a window among + // its siblings unless it is wxID_ANY + wxWindowIDRef m_windowId; + + // the parent window of this window (or NULL) and the list of the children + // of this window + wxWindow *m_parent; + wxWindowList m_children; + + // the minimal allowed size for the window (no minimal size if variable(s) + // contain(s) wxDefaultCoord) + int m_minWidth, + m_minHeight, + m_maxWidth, + m_maxHeight; + + // event handler for this window: usually is just 'this' but may be + // changed with SetEventHandler() + wxEvtHandler *m_eventHandler; + +#if wxUSE_VALIDATORS + // associated validator or NULL if none + wxValidator *m_windowValidator; +#endif // wxUSE_VALIDATORS + +#if wxUSE_DRAG_AND_DROP + wxDropTarget *m_dropTarget; +#endif // wxUSE_DRAG_AND_DROP + + // visual window attributes + wxCursor m_cursor; + wxFont m_font; // see m_hasFont + wxColour m_backgroundColour, // m_hasBgCol + m_foregroundColour; // m_hasFgCol + +#if wxUSE_CARET + wxCaret *m_caret; +#endif // wxUSE_CARET + + // the region which should be repainted in response to paint event + wxRegion m_updateRegion; + +#if wxUSE_ACCEL + // the accelerator table for the window which translates key strokes into + // command events + wxAcceleratorTable m_acceleratorTable; +#endif // wxUSE_ACCEL + + // the tooltip for this window (may be NULL) +#if wxUSE_TOOLTIPS + wxToolTip *m_tooltip; +#endif // wxUSE_TOOLTIPS + + // constraints and sizers +#if wxUSE_CONSTRAINTS + // the constraints for this window or NULL + wxLayoutConstraints *m_constraints; + + // constraints this window is involved in + wxWindowList *m_constraintsInvolvedIn; +#endif // wxUSE_CONSTRAINTS + + // this window's sizer + wxSizer *m_windowSizer; + + // The sizer this window is a member of, if any + wxSizer *m_containingSizer; + + // Layout() window automatically when its size changes? + bool m_autoLayout:1; + + // window state + bool m_isShown:1; + bool m_isEnabled:1; + bool m_isBeingDeleted:1; + + // was the window colours/font explicitly changed by user? + bool m_hasBgCol:1; + bool m_hasFgCol:1; + bool m_hasFont:1; + + // and should it be inherited by children? + bool m_inheritBgCol:1; + bool m_inheritFgCol:1; + bool m_inheritFont:1; + + // flag disabling accepting focus from keyboard + bool m_disableFocusFromKbd:1; + + // window attributes + long m_windowStyle, + m_exStyle; + wxString m_windowName; + bool m_themeEnabled; + wxBackgroundStyle m_backgroundStyle; +#if wxUSE_PALETTE + wxPalette m_palette; + bool m_hasCustomPalette; +#endif // wxUSE_PALETTE + +#if wxUSE_ACCESSIBILITY + wxAccessible* m_accessible; +#endif + + // Virtual size (scrolling) + wxSize m_virtualSize; + + wxScrollHelper *m_scrollHelper; + + wxWindowVariant m_windowVariant ; + + // override this to change the default (i.e. used when no style is + // specified) border for the window class + virtual wxBorder GetDefaultBorder() const; + + // this allows you to implement standard control borders without + // repeating the code in different classes that are not derived from + // wxControl + virtual wxBorder GetDefaultBorderForControl() const { return wxBORDER_THEME; } + + // Get the default size for the new window if no explicit size given. TLWs + // have their own default size so this is just for non top-level windows. + static int WidthDefault(int w) { return w == wxDefaultCoord ? 20 : w; } + static int HeightDefault(int h) { return h == wxDefaultCoord ? 20 : h; } + + + // Used to save the results of DoGetBestSize so it doesn't need to be + // recalculated each time the value is needed. + wxSize m_bestSizeCache; + +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED_MSG("use SetInitialSize() instead.") + void SetBestSize(const wxSize& size); + wxDEPRECATED_MSG("use SetInitialSize() instead.") + virtual void SetInitialBestSize(const wxSize& size); +#endif // WXWIN_COMPATIBILITY_2_8 + + + + // more pure virtual functions + // --------------------------- + + // NB: we must have DoSomething() function when Something() is an overloaded + // method: indeed, we can't just have "virtual Something()" in case when + // the function is overloaded because then we'd have to make virtual all + // the variants (otherwise only the virtual function may be called on a + // pointer to derived class according to C++ rules) which is, in + // general, absolutely not needed. So instead we implement all + // overloaded Something()s in terms of DoSomething() which will be the + // only one to be virtual. + + // text extent + virtual void DoGetTextExtent(const wxString& string, + int *x, int *y, + int *descent = NULL, + int *externalLeading = NULL, + const wxFont *font = NULL) const = 0; + + // coordinates translation + virtual void DoClientToScreen( int *x, int *y ) const = 0; + virtual void DoScreenToClient( int *x, int *y ) const = 0; + + virtual wxHitTest DoHitTest(wxCoord x, wxCoord y) const; + + // capture/release the mouse, used by Capture/ReleaseMouse() + virtual void DoCaptureMouse() = 0; + virtual void DoReleaseMouse() = 0; + + // retrieve the position/size of the window + virtual void DoGetPosition(int *x, int *y) const = 0; + virtual void DoGetScreenPosition(int *x, int *y) const; + virtual void DoGetSize(int *width, int *height) const = 0; + virtual void DoGetClientSize(int *width, int *height) const = 0; + + // get the size which best suits the window: for a control, it would be + // the minimal size which doesn't truncate the control, for a panel - the + // same size as it would have after a call to Fit() + virtual wxSize DoGetBestSize() const; + + // this method can be overridden instead of DoGetBestSize() if it computes + // the best size of the client area of the window only, excluding borders + // (GetBorderSize() will be used to add them) + virtual wxSize DoGetBestClientSize() const { return wxDefaultSize; } + + // These two methods can be overridden to implement intelligent + // width-for-height and/or height-for-width best size determination for the + // window. By default the fixed best size is used. + virtual int DoGetBestClientHeight(int WXUNUSED(width)) const + { return wxDefaultCoord; } + virtual int DoGetBestClientWidth(int WXUNUSED(height)) const + { return wxDefaultCoord; } + + // this is the virtual function to be overridden in any derived class which + // wants to change how SetSize() or Move() works - it is called by all + // versions of these functions in the base class + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO) = 0; + + // same as DoSetSize() for the client size + virtual void DoSetClientSize(int width, int height) = 0; + + virtual void DoSetSizeHints( int minW, int minH, + int maxW, int maxH, + int incW, int incH ); + + // move the window to the specified location and resize it: this is called + // from both DoSetSize() and DoSetClientSize() and would usually just + // reposition this window except for composite controls which will want to + // arrange themselves inside the given rectangle + // + // Important note: the coordinates passed to this method are in parent's + // *window* coordinates and not parent's client coordinates (as the values + // passed to DoSetSize and returned by DoGetPosition are)! + virtual void DoMoveWindow(int x, int y, int width, int height) = 0; + + // centre the window in the specified direction on parent, note that + // wxCENTRE_ON_SCREEN shouldn't be specified here, it only makes sense for + // TLWs + virtual void DoCentre(int dir); + +#if wxUSE_TOOLTIPS + virtual void DoSetToolTipText( const wxString &tip ); + virtual void DoSetToolTip( wxToolTip *tip ); +#endif // wxUSE_TOOLTIPS + +#if wxUSE_MENUS + virtual bool DoPopupMenu(wxMenu *menu, int x, int y) = 0; +#endif // wxUSE_MENUS + + // Makes an adjustment to the window position to make it relative to the + // parents client area, e.g. if the parent is a frame with a toolbar, its + // (0, 0) is just below the toolbar + virtual void AdjustForParentClientOrigin(int& x, int& y, + int sizeFlags = 0) const; + + // implements the window variants + virtual void DoSetWindowVariant( wxWindowVariant variant ) ; + + + // really freeze/thaw the window (should have port-specific implementation) + virtual void DoFreeze() { } + virtual void DoThaw() { } + + + // Must be called when mouse capture is lost to send + // wxMouseCaptureLostEvent to windows on capture stack. + static void NotifyCaptureLost(); + + + // Stub virtual functions for forward binary compatibility. DO NOT USE. + virtual void* WXReservedWindow1(void*); + virtual void* WXReservedWindow2(void*); + virtual void* WXReservedWindow3(void*); + +private: + // recursively call our own and our children DoEnable() when the + // enabled/disabled status changed because a parent window had been + // enabled/disabled + void NotifyWindowOnEnableChange(bool enabled); + +#if wxUSE_MENUS + // temporary event handlers used by GetPopupMenuSelectionFromUser() + void InternalOnPopupMenu(wxCommandEvent& event); + void InternalOnPopupMenuUpdate(wxUpdateUIEvent& event); + + // implementation of the public GetPopupMenuSelectionFromUser() method + int DoGetPopupMenuSelectionFromUser(wxMenu& menu, int x, int y); +#endif // wxUSE_MENUS + + // layout the window children when its size changes unless this was + // explicitly disabled with SetAutoLayout(false) + void InternalOnSize(wxSizeEvent& event); + + // base for dialog unit conversion, i.e. average character size + wxSize GetDlgUnitBase() const; + + + // number of Freeze() calls minus the number of Thaw() calls: we're frozen + // (i.e. not being updated) if it is positive + unsigned int m_freezeCount; + + wxDECLARE_ABSTRACT_CLASS(wxWindowBase); + wxDECLARE_NO_COPY_CLASS(wxWindowBase); + wxDECLARE_EVENT_TABLE(); +}; + + +#if WXWIN_COMPATIBILITY_2_8 +// Inlines for some deprecated methods +inline wxSize wxWindowBase::GetBestFittingSize() const +{ + return GetEffectiveMinSize(); +} + +inline void wxWindowBase::SetBestFittingSize(const wxSize& size) +{ + SetInitialSize(size); +} + +inline void wxWindowBase::SetBestSize(const wxSize& size) +{ + SetInitialSize(size); +} + +inline void wxWindowBase::SetInitialBestSize(const wxSize& size) +{ + SetInitialSize(size); +} +#endif // WXWIN_COMPATIBILITY_2_8 + + +// ---------------------------------------------------------------------------- +// now include the declaration of wxWindow class +// ---------------------------------------------------------------------------- + +// include the declaration of the platform-specific class +#if defined(__WXMSW__) + #ifdef __WXUNIVERSAL__ + #define wxWindowNative wxWindowMSW + #else // !wxUniv + #define wxWindowMSW wxWindow + #endif // wxUniv/!wxUniv + #include "wx/msw/window.h" +#elif defined(__WXMOTIF__) + #include "wx/motif/window.h" +#elif defined(__WXGTK20__) + #ifdef __WXUNIVERSAL__ + #define wxWindowNative wxWindowGTK + #else // !wxUniv + #define wxWindowGTK wxWindow + #endif // wxUniv + #include "wx/gtk/window.h" +#elif defined(__WXGTK__) + #ifdef __WXUNIVERSAL__ + #define wxWindowNative wxWindowGTK + #else // !wxUniv + #define wxWindowGTK wxWindow + #endif // wxUniv + #include "wx/gtk1/window.h" +#elif defined(__WXX11__) + #ifdef __WXUNIVERSAL__ + #define wxWindowNative wxWindowX11 + #else // !wxUniv + #define wxWindowX11 wxWindow + #endif // wxUniv + #include "wx/x11/window.h" +#elif defined(__WXDFB__) + #define wxWindowNative wxWindowDFB + #include "wx/dfb/window.h" +#elif defined(__WXMAC__) + #ifdef __WXUNIVERSAL__ + #define wxWindowNative wxWindowMac + #else // !wxUniv + #define wxWindowMac wxWindow + #endif // wxUniv + #include "wx/osx/window.h" +#elif defined(__WXQT__) + #ifdef __WXUNIVERSAL__ + #define wxWindowNative wxWindowQt + #else // !wxUniv + #define wxWindowQt wxWindow + #endif // wxUniv + #include "wx/qt/window.h" +#endif + +// for wxUniversal, we now derive the real wxWindow from wxWindow<platform>, +// for the native ports we already have defined it above +#if defined(__WXUNIVERSAL__) + #ifndef wxWindowNative + #error "wxWindowNative must be defined above!" + #endif + + #include "wx/univ/window.h" +#endif // wxUniv + +// ---------------------------------------------------------------------------- +// inline functions which couldn't be declared in the class body because of +// forward dependencies +// ---------------------------------------------------------------------------- + +inline wxWindow *wxWindowBase::GetGrandParent() const +{ + return m_parent ? m_parent->GetParent() : NULL; +} + +// ---------------------------------------------------------------------------- +// global functions +// ---------------------------------------------------------------------------- + +// Find the wxWindow at the current mouse position, also returning the mouse +// position. +extern WXDLLIMPEXP_CORE wxWindow* wxFindWindowAtPointer(wxPoint& pt); + +// Get the current mouse position. +extern WXDLLIMPEXP_CORE wxPoint wxGetMousePosition(); + +// get the currently active window of this application or NULL +extern WXDLLIMPEXP_CORE wxWindow *wxGetActiveWindow(); + +// get the (first) top level parent window +WXDLLIMPEXP_CORE wxWindow* wxGetTopLevelParent(wxWindowBase *win); + +// Return a string with platform-dependent description of the window. +extern WXDLLIMPEXP_CORE wxString wxDumpWindow(const wxWindowBase* win); + +#if wxUSE_ACCESSIBILITY +// ---------------------------------------------------------------------------- +// accessible object for windows +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWindowAccessible: public wxAccessible +{ +public: + wxWindowAccessible(wxWindow* win): wxAccessible(win) { if (win) win->SetAccessible(this); } + virtual ~wxWindowAccessible() {} + +// Overridables + + // Can return either a child object, or an integer + // representing the child element, starting from 1. + virtual wxAccStatus HitTest(const wxPoint& pt, int* childId, wxAccessible** childObject) wxOVERRIDE; + + // Returns the rectangle for this object (id = 0) or a child element (id > 0). + virtual wxAccStatus GetLocation(wxRect& rect, int elementId) wxOVERRIDE; + + // Navigates from fromId to toId/toObject. + virtual wxAccStatus Navigate(wxNavDir navDir, int fromId, + int* toId, wxAccessible** toObject) wxOVERRIDE; + + // Gets the name of the specified object. + virtual wxAccStatus GetName(int childId, wxString* name) wxOVERRIDE; + + // Gets the number of children. + virtual wxAccStatus GetChildCount(int* childCount) wxOVERRIDE; + + // 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 childId, wxAccessible** child) wxOVERRIDE; + + // Gets the parent, or NULL. + virtual wxAccStatus GetParent(wxAccessible** parent) wxOVERRIDE; + + // 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 childId) wxOVERRIDE; + + // 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 childId, wxString* actionName) wxOVERRIDE; + + // Returns the description for this object or a child. + virtual wxAccStatus GetDescription(int childId, wxString* description) wxOVERRIDE; + + // Returns help text for this object or a child, similar to tooltip text. + virtual wxAccStatus GetHelpText(int childId, wxString* helpText) wxOVERRIDE; + + // Returns the keyboard shortcut for this object or child. + // Return e.g. ALT+K + virtual wxAccStatus GetKeyboardShortcut(int childId, wxString* shortcut) wxOVERRIDE; + + // Returns a role constant. + virtual wxAccStatus GetRole(int childId, wxAccRole* role) wxOVERRIDE; + + // Returns a state constant. + virtual wxAccStatus GetState(int childId, long* state) wxOVERRIDE; + + // Returns a localized string representing the value for the object + // or child. + virtual wxAccStatus GetValue(int childId, wxString* strValue) wxOVERRIDE; + + // Selects the object or child. + virtual wxAccStatus Select(int childId, wxAccSelectionFlags selectFlags) wxOVERRIDE; + + // 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* childId, wxAccessible** child) wxOVERRIDE; + +#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* selections) wxOVERRIDE; +#endif // wxUSE_VARIANT +}; + +#endif // wxUSE_ACCESSIBILITY + + +#endif // _WX_WINDOW_H_BASE_ diff --git a/lib/wxWidgets/include/wx/windowid.h b/lib/wxWidgets/include/wx/windowid.h new file mode 100644 index 0000000..a6618b6 --- /dev/null +++ b/lib/wxWidgets/include/wx/windowid.h @@ -0,0 +1,187 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/windowid.h +// Purpose: wxWindowID class - a class for managing window ids +// Author: Brian Vanderburg II +// Created: 2007-09-21 +// Copyright: (c) 2007 Brian Vanderburg II +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WINDOWID_H_ +#define _WX_WINDOWID_H_ + +#include "wx/defs.h" + +// ---------------------------------------------------------------------------- +// wxWindowIDRef: reference counted id value +// ---------------------------------------------------------------------------- + +// A wxWindowIDRef object wraps an id value and marks it as (un)used as +// necessary. All ids returned from wxWindow::NewControlId() should be assigned +// to an instance of this class to ensure that the id is marked as being in +// use. +// +// This class is always defined but it is trivial if wxUSE_AUTOID_MANAGEMENT is +// off. +class WXDLLIMPEXP_CORE wxWindowIDRef +{ +public: + // default ctor + wxWindowIDRef() + { + m_id = wxID_NONE; + } + + // ctor taking id values + wxWindowIDRef(int id) + { + Init(id); + } + + wxWindowIDRef(long id) + { + Init(wxWindowID(id)); + } + + wxWindowIDRef(const wxWindowIDRef& id) + { + Init(id.m_id); + } + + // dtor + ~wxWindowIDRef() + { + Assign(wxID_NONE); + } + + // assignment + wxWindowIDRef& operator=(int id) + { + Assign(id); + return *this; + } + + wxWindowIDRef& operator=(long id) + { + Assign(wxWindowID(id)); + return *this; + } + + wxWindowIDRef& operator=(const wxWindowIDRef& id) + { + if (&id != this) + Assign(id.m_id); + return *this; + } + + // access to the stored id value + wxWindowID GetValue() const + { + return m_id; + } + + operator wxWindowID() const + { + return m_id; + } + +private: +#if wxUSE_AUTOID_MANAGEMENT + // common part of all ctors: call Assign() for our new id + void Init(wxWindowID id) + { + // m_id must be initialized before calling Assign() + m_id = wxID_NONE; + Assign(id); + } + + // increase reference count of id, decrease the one of m_id + void Assign(wxWindowID id); +#else // !wxUSE_AUTOID_MANAGEMENT + // trivial stubs for the functions above + void Init(wxWindowID id) + { + m_id = id; + } + + void Assign(wxWindowID id) + { + m_id = id; + } +#endif // wxUSE_AUTOID_MANAGEMENT/!wxUSE_AUTOID_MANAGEMENT + + + wxWindowID m_id; +}; + +// comparison operators +inline bool operator==(const wxWindowIDRef& lhs, const wxWindowIDRef& rhs) +{ + return lhs.GetValue() == rhs.GetValue(); +} + +inline bool operator==(const wxWindowIDRef& lhs, int rhs) +{ + return lhs.GetValue() == rhs; +} + +inline bool operator==(const wxWindowIDRef& lhs, long rhs) +{ + return lhs.GetValue() == rhs; +} + +inline bool operator==(int lhs, const wxWindowIDRef& rhs) +{ + return rhs == lhs; +} + +inline bool operator==(long lhs, const wxWindowIDRef& rhs) +{ + return rhs == lhs; +} + +inline bool operator!=(const wxWindowIDRef& lhs, const wxWindowIDRef& rhs) +{ + return !(lhs == rhs); +} + +inline bool operator!=(const wxWindowIDRef& lhs, int rhs) +{ + return !(lhs == rhs); +} + +inline bool operator!=(const wxWindowIDRef& lhs, long rhs) +{ + return !(lhs == rhs); +} + +inline bool operator!=(int lhs, const wxWindowIDRef& rhs) +{ + return !(lhs == rhs); +} + +inline bool operator!=(long lhs, const wxWindowIDRef& rhs) +{ + return !(lhs == rhs); +} + +// ---------------------------------------------------------------------------- +// wxIdManager +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxIdManager +{ +public: + // This returns an id value and not an wxWindowIDRef. The returned value + // should be assigned a.s.a.p to a wxWindowIDRef. The IDs are marked as + // reserved so that another call to ReserveId before assigning the id to a + // wxWindowIDRef will not use the same ID + static wxWindowID ReserveId(int count = 1); + + // This will release an unused reserved ID. This should only be called + // if the ID returned by ReserveId was NOT assigned to a wxWindowIDRef + // for some purpose, maybe an early return from a function + static void UnreserveId(wxWindowID id, int count = 1); +}; + +#endif // _WX_WINDOWID_H_ diff --git a/lib/wxWidgets/include/wx/windowptr.h b/lib/wxWidgets/include/wx/windowptr.h new file mode 100644 index 0000000..b4ac928 --- /dev/null +++ b/lib/wxWidgets/include/wx/windowptr.h @@ -0,0 +1,63 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/windowptr.h +// Purpose: smart pointer for holding wxWindow instances +// Author: Vaclav Slavik +// Created: 2013-09-01 +// Copyright: (c) 2013 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WINDOWPTR_H_ +#define _WX_WINDOWPTR_H_ + +#include "wx/sharedptr.h" + +// ---------------------------------------------------------------------------- +// wxWindowPtr: A smart pointer with correct wxWindow destruction. +// ---------------------------------------------------------------------------- + +namespace wxPrivate +{ + +struct wxWindowDeleter +{ + void operator()(wxWindow *win) + { + win->Destroy(); + } +}; + +} // namespace wxPrivate + +template<typename T> +class wxWindowPtr : public wxSharedPtr<T> +{ +public: + typedef T element_type; + + explicit wxWindowPtr(element_type* win) + : wxSharedPtr<T>(win, wxPrivate::wxWindowDeleter()) + { + } + + wxWindowPtr() {} + wxWindowPtr(const wxWindowPtr& tocopy) : wxSharedPtr<T>(tocopy) {} + + wxWindowPtr& operator=(const wxWindowPtr& tocopy) + { + wxSharedPtr<T>::operator=(tocopy); + return *this; + } + + wxWindowPtr& operator=(element_type* win) + { + return operator=(wxWindowPtr(win)); + } + + void reset(T* ptr = NULL) + { + wxSharedPtr<T>::reset(ptr, wxPrivate::wxWindowDeleter()); + } +}; + +#endif // _WX_WINDOWPTR_H_ diff --git a/lib/wxWidgets/include/wx/withimages.h b/lib/wxWidgets/include/wx/withimages.h new file mode 100644 index 0000000..f4a784d --- /dev/null +++ b/lib/wxWidgets/include/wx/withimages.h @@ -0,0 +1,297 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/withimages.h +// Purpose: Declaration of a simple wxWithImages class. +// Author: Vadim Zeitlin +// Created: 2011-08-17 +// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WITHIMAGES_H_ +#define _WX_WITHIMAGES_H_ + +#include "wx/defs.h" +#include "wx/bmpbndl.h" +#include "wx/icon.h" +#include "wx/imaglist.h" +#include "wx/vector.h" + +class WXDLLIMPEXP_FWD_CORE wxWindow; + +// ---------------------------------------------------------------------------- +// wxWithImages: mix-in for classes using indices for image access +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWithImages +{ +public: + enum + { + NO_IMAGE = -1 + }; + + typedef wxVector<wxBitmapBundle> Images; + + wxWithImages() + { + m_imageList = NULL; + m_ownsImageList = false; + } + + virtual ~wxWithImages() + { + FreeIfNeeded(); + } + + // Return the number of images, possibly 0. + int GetImageCount() const + { + if ( !m_images.empty() ) + { + // Cast is safe, we don't risk having more than INT_MAX images. + return static_cast<int>(m_images.size()); + } + + return m_imageList ? m_imageList->GetImageCount() : 0; + } + + // Return true if we are using any images. + bool HasImages() const + { + // Note that the sole presence of the image list indicates that we're + // using images, even if it is currently empty, because images can be + // added to it at any moment (it's common and valid to create an image + // list and associate it with the control first and fill it later) and + // it's better to err on the side of having the images and not showing + // anything if there are really none than decide that we don't have any + // and not show those that we do have. + return !m_images.empty() || m_imageList; + } + + // Sets the images to use. + // + // Override OnImagesChanged() in the derived class to update the actually + // shown images. + void SetImages(const Images& images) + { + m_images = images; + + OnImagesChanged(); + } + + // Sets the image list to use, it is *not* deleted by the control. + // + // This function is virtual for compatibility, as it could be overridden in + // the existing application code, however it should not be overridden in wx + // itself, where OnImagesChanged() should be overridden instead. + virtual void SetImageList(wxImageList* imageList) + { + FreeIfNeeded(); + m_imageList = imageList; + + OnImagesChanged(); + } + + // As SetImageList() but we will delete the image list ourselves. + void AssignImageList(wxImageList* imageList) + { + SetImageList(imageList); + m_ownsImageList = true; + } + + // This function can be used for implementing AssignImageList()-like + // methods in the classes using this one and tells us to simply take + // ownership of the image list that we already have. + // + // Avoid using it if possible. + void TakeOwnership() { m_ownsImageList = true; } + + // Get pointer (may be NULL) to the associated image list. + wxImageList* GetImageList() const { return m_imageList; } + + // This helper function can be used from OnImagesChanged() if the derived + // class actually needs to use wxImageList: it ensures that m_imageList is + // updated from m_images, if the latter is not empty, using the images of + // the appropriate size for the given window, and returns it. + wxImageList* GetUpdatedImageListFor(wxWindow* win) + { + if ( !m_images.empty() ) + { + // Note that we can't just call AssignImageList() here to avoid + // infinite recursion. + FreeIfNeeded(); + m_imageList = wxBitmapBundle::CreateImageList(win, m_images); + + // We always own it as we created it ourselves. + m_ownsImageList = true; + } + + return m_imageList; + } + +#if wxABI_VERSION >= 30202 + // Return logical size of the image to use or (0, 0) if there are none. + wxSize GetImageLogicalSize(const wxWindow* window, int iconIndex) const + { + wxSize size; + + if ( iconIndex != NO_IMAGE ) + { + if ( !m_images.empty() ) + { + size = m_images.at(iconIndex).GetPreferredLogicalSizeFor(window); + } + else if ( m_imageList ) + { + // All images in the image list are of the same size. + size = m_imageList->GetSize(); + } + } + + return size; + } + + // Overload provided to facilitate transition from the existing code using + // wxImageList::GetSize() -- don't use it in the new code. + void GetImageLogicalSize(const wxWindow* window, int iconIndex, + int& width, int& height) const + { + const wxSize size = GetImageLogicalSize(window, iconIndex); + width = size.x; + height = size.y; + } + + // Return the bitmap to use at the current DPI of the given window. + // + // If index == NO_IMAGE, just returns wxNullBitmap. + wxBitmap GetImageBitmapFor(const wxWindow* window, int iconIndex) const + { + wxBitmap bitmap; + + if ( iconIndex != NO_IMAGE ) + { + if ( !m_images.empty() ) + { + bitmap = m_images.at(iconIndex).GetBitmapFor(window); + } + else if ( m_imageList ) + { + bitmap = m_imageList->GetBitmap(iconIndex); + } + else + { + wxFAIL_MSG + ( + "Image index specified, but there are no images.\n" + "\n" + "Did you forget to call SetImages()?" + ); + } + } + + return bitmap; + } +#endif // wxABI_VERSION >= 3.2.2 + +protected: + // This function is called when the images associated with the control + // change, due to either SetImages() or SetImageList() being called. + // + // It ought to be pure virtual, but isn't because there could be existing + // application code inheriting from this class and not overriding it + // (because this function hadn't existed when this code was written). + virtual void OnImagesChanged() { } + + // This function can be used as event handle for wxEVT_DPI_CHANGED event + // and simply calls OnImagesChanged() to refresh the images when it happens. + void WXHandleDPIChanged(wxDPIChangedEvent& event) + { + if ( HasImages() ) + OnImagesChanged(); + + event.Skip(); + } + + + // Return true if we have a valid image list. + bool HasImageList() const { return m_imageList != NULL; } + + // Return the image with the given index from the image list. + // + // If there is no image list or if index == NO_IMAGE, silently returns + // wxNullIcon. + wxIcon GetImage(int iconIndex) const + { + return m_imageList && iconIndex != NO_IMAGE + ? m_imageList->GetIcon(iconIndex) + : wxNullIcon; + } + + // Return the bitmap bundle for the image with the given index. + // + // If index == NO_IMAGE or there are no images at all, returns an empty + // bundle (but, unlike GetImage() above, asserts if the index is valid but + // there is no image, as this probably indicates a programming mistake). + // + // If there is no bundle, but there is an image list, returns a bundle + // containing just the bitmap from the image list. + wxBitmapBundle GetBitmapBundle(int iconIndex) const + { + wxBitmapBundle bundle; + + if ( iconIndex != NO_IMAGE ) + { + if ( !m_images.empty() ) + { + bundle = m_images.at(iconIndex); + } + else if ( m_imageList ) + { + bundle = m_imageList->GetIcon(iconIndex); + } + else + { + wxFAIL_MSG + ( + "Image index specified, but there are no images.\n" + "\n" + "Did you forget to call SetImages()?" + ); + } + } + + return bundle; + } + + // Accessor to the images for the derived classes: this is only useful when + // delegating SetImages() to another object. + const Images& GetImages() const { return m_images; } + +private: + // Free the image list if necessary, i.e. if we own it. + void FreeIfNeeded() + { + if ( m_ownsImageList ) + { + delete m_imageList; + m_imageList = NULL; + + // We don't own it any more. + m_ownsImageList = false; + } + } + + + // The images we use: if this vector is not empty, m_imageList is not used. + Images m_images; + + // The associated image list or NULL. + wxImageList* m_imageList; + + // False by default, if true then we delete m_imageList. + bool m_ownsImageList; + + wxDECLARE_NO_COPY_CLASS(wxWithImages); +}; + +#endif // _WX_WITHIMAGES_H_ diff --git a/lib/wxWidgets/include/wx/wizard.h b/lib/wxWidgets/include/wx/wizard.h new file mode 100644 index 0000000..87415ff --- /dev/null +++ b/lib/wxWidgets/include/wx/wizard.h @@ -0,0 +1,337 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/wizard.h +// Purpose: wxWizard class: a GUI control presenting the user with a +// sequence of dialogs which allows to simply perform some task +// Author: Vadim Zeitlin (partly based on work by Ron Kuris and Kevin B. +// Smith) +// Modified by: Robert Cavanaugh +// Added capability to use .WXR resource files in Wizard pages +// Added wxWIZARD_HELP event +// Robert Vazan (sizers) +// Created: 15.08.99 +// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WIZARD_H_ +#define _WX_WIZARD_H_ + +#include "wx/defs.h" + +#if wxUSE_WIZARDDLG + +// ---------------------------------------------------------------------------- +// headers and other simple declarations +// ---------------------------------------------------------------------------- + +#include "wx/dialog.h" // the base class +#include "wx/panel.h" // ditto +#include "wx/event.h" // wxEVT_XXX constants +#include "wx/bmpbndl.h" + +// Extended style to specify a help button +#define wxWIZARD_EX_HELPBUTTON 0x00000010 + +// Placement flags +#define wxWIZARD_VALIGN_TOP 0x01 +#define wxWIZARD_VALIGN_CENTRE 0x02 +#define wxWIZARD_VALIGN_BOTTOM 0x04 +#define wxWIZARD_HALIGN_LEFT 0x08 +#define wxWIZARD_HALIGN_CENTRE 0x10 +#define wxWIZARD_HALIGN_RIGHT 0x20 +#define wxWIZARD_TILE 0x40 + +// forward declarations +class WXDLLIMPEXP_FWD_CORE wxWizard; + +// ---------------------------------------------------------------------------- +// wxWizardPage is one of the wizards screen: it must know what are the +// following and preceding pages (which may be NULL for the first/last page). +// +// Other than GetNext/Prev() functions, wxWizardPage is just a panel and may be +// used as such (i.e. controls may be placed directly on it &c). +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWizardPage : public wxPanel +{ +public: + wxWizardPage() { Init(); } + + // ctor accepts an optional bitmap which will be used for this page instead + // of the default one for this wizard (should be of the same size). Notice + // that no other parameters are needed because the wizard will resize and + // reposition the page anyhow + wxWizardPage(wxWizard *parent, + const wxBitmapBundle& bitmap = wxBitmapBundle()); + + bool Create(wxWizard *parent, + const wxBitmapBundle& bitmap = wxBitmapBundle()); + + // these functions are used by the wizard to show another page when the + // user chooses "Back" or "Next" button + virtual wxWizardPage *GetPrev() const = 0; + virtual wxWizardPage *GetNext() const = 0; + + // default GetBitmap() will just return m_bitmap which is ok in 99% of + // cases - override this method if you want to create the bitmap to be used + // dynamically or to do something even more fancy. It's ok to return + // wxNullBitmap from here - the default one will be used then. + virtual wxBitmap GetBitmap() const { return m_bitmap.GetBitmapFor(this); } + +#if wxUSE_VALIDATORS + // Override the base functions to allow a validator to be assigned to this page. + virtual bool TransferDataToWindow() wxOVERRIDE + { + return GetValidator() ? GetValidator()->TransferToWindow() + : wxPanel::TransferDataToWindow(); + } + + virtual bool TransferDataFromWindow() wxOVERRIDE + { + return GetValidator() ? GetValidator()->TransferFromWindow() + : wxPanel::TransferDataFromWindow(); + } + + virtual bool Validate() wxOVERRIDE + { + return GetValidator() ? GetValidator()->Validate(this) + : wxPanel::Validate(); + } +#endif // wxUSE_VALIDATORS + +protected: + // common part of ctors: + void Init(); + + wxBitmapBundle m_bitmap; + +private: + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxWizardPage); +}; + +// ---------------------------------------------------------------------------- +// wxWizardPageSimple just returns the pointers given to the ctor and is useful +// to create a simple wizard where the order of pages never changes. +// +// OTOH, it is also possible to dynamically decide which page to return (i.e. +// depending on the user's choices) as the wizard sample shows - in order to do +// this, you must derive from wxWizardPage directly. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWizardPageSimple : public wxWizardPage +{ +public: + wxWizardPageSimple() { Init(); } + + // ctor takes the previous and next pages + wxWizardPageSimple(wxWizard *parent, + wxWizardPage *prev = NULL, + wxWizardPage *next = NULL, + const wxBitmapBundle& bitmap = wxBitmapBundle()) + { + Create(parent, prev, next, bitmap); + } + + bool Create(wxWizard *parent = NULL, // let it be default ctor too + wxWizardPage *prev = NULL, + wxWizardPage *next = NULL, + const wxBitmapBundle& bitmap = wxBitmapBundle()) + { + m_prev = prev; + m_next = next; + return wxWizardPage::Create(parent, bitmap); + } + + // the pointers may be also set later - but before starting the wizard + void SetPrev(wxWizardPage *prev) { m_prev = prev; } + void SetNext(wxWizardPage *next) { m_next = next; } + + // Convenience functions to make the pages follow each other without having + // to call their SetPrev() or SetNext() explicitly. + wxWizardPageSimple& Chain(wxWizardPageSimple* next) + { + SetNext(next); + next->SetPrev(this); + return *next; + } + + static void Chain(wxWizardPageSimple *first, wxWizardPageSimple *second) + { + wxCHECK_RET( first && second, + wxT("NULL passed to wxWizardPageSimple::Chain") ); + + first->SetNext(second); + second->SetPrev(first); + } + + // base class pure virtuals + virtual wxWizardPage *GetPrev() const wxOVERRIDE; + virtual wxWizardPage *GetNext() const wxOVERRIDE; + +private: + // common part of ctors: + void Init() + { + m_prev = m_next = NULL; + } + + // pointers are private, the derived classes shouldn't mess with them - + // just derive from wxWizardPage directly to implement different behaviour + wxWizardPage *m_prev, + *m_next; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxWizardPageSimple); +}; + +// ---------------------------------------------------------------------------- +// wxWizard +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWizardBase : public wxDialog +{ +public: + /* + The derived class (i.e. the real wxWizard) has a ctor and Create() + function taking the following arguments: + + wxWizard(wxWindow *parent, + int id = wxID_ANY, + const wxString& title = wxEmptyString, + const wxBitmapBundle& bitmap = wxBitmapBundle(), + const wxPoint& pos = wxDefaultPosition, + long style = wxDEFAULT_DIALOG_STYLE); + */ + wxWizardBase() { } + + // executes the wizard starting from the given page, returns true if it was + // successfully finished, false if user cancelled it + virtual bool RunWizard(wxWizardPage *firstPage) = 0; + + // get the current page (NULL if RunWizard() isn't running) + virtual wxWizardPage *GetCurrentPage() const = 0; + + // set the min size which should be available for the pages: a + // wizard will take into account the size of the bitmap (if any) + // itself and will never be less than some predefined fixed size + virtual void SetPageSize(const wxSize& size) = 0; + + // get the size available for the page + virtual wxSize GetPageSize() const = 0; + + // set the best size for the wizard, i.e. make it big enough to contain all + // of the pages starting from the given one + // + // this function may be called several times and possible with different + // pages in which case it will only increase the page size if needed (this + // may be useful if not all pages are accessible from the first one by + // default) + virtual void FitToPage(const wxWizardPage *firstPage) = 0; + + // Adding pages to page area sizer enlarges wizard + virtual wxSizer *GetPageAreaSizer() const = 0; + + // Set border around page area. Default is 0 if you add at least one + // page to GetPageAreaSizer and 5 if you don't. + virtual void SetBorder(int border) = 0; + + // the methods below may be overridden by the derived classes to provide + // custom logic for determining the pages order + + virtual bool HasNextPage(wxWizardPage *page) + { return page->GetNext() != NULL; } + + virtual bool HasPrevPage(wxWizardPage *page) + { return page->GetPrev() != NULL; } + + /// Override these functions to stop InitDialog from calling TransferDataToWindow + /// for _all_ pages when the wizard starts. Instead 'ShowPage' will call + /// TransferDataToWindow for the first page only. + bool TransferDataToWindow() wxOVERRIDE { return true; } + bool TransferDataFromWindow() wxOVERRIDE { return true; } + bool Validate() wxOVERRIDE { return true; } + +private: + wxDECLARE_NO_COPY_CLASS(wxWizardBase); +}; + +// include the real class declaration +#include "wx/generic/wizard.h" + +// ---------------------------------------------------------------------------- +// wxWizardEvent class represents an event generated by the wizard: this event +// is first sent to the page itself and, if not processed there, goes up the +// window hierarchy as usual +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWizardEvent : public wxNotifyEvent +{ +public: + wxWizardEvent(wxEventType type = wxEVT_NULL, + int id = wxID_ANY, + bool direction = true, + wxWizardPage* page = NULL); + + // for EVT_WIZARD_PAGE_CHANGING, return true if we're going forward or + // false otherwise and for EVT_WIZARD_PAGE_CHANGED return true if we came + // from the previous page and false if we returned from the next one + // (this function doesn't make sense for CANCEL events) + bool GetDirection() const { return m_direction; } + + wxWizardPage* GetPage() const { return m_page; } + + virtual wxEvent *Clone() const wxOVERRIDE { return new wxWizardEvent(*this); } + +private: + bool m_direction; + wxWizardPage* m_page; + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxWizardEvent); +}; + +// ---------------------------------------------------------------------------- +// macros for handling wxWizardEvents +// ---------------------------------------------------------------------------- + +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_WIZARD_PAGE_CHANGED, wxWizardEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_WIZARD_PAGE_CHANGING, wxWizardEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_WIZARD_CANCEL, wxWizardEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_WIZARD_HELP, wxWizardEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_WIZARD_FINISHED, wxWizardEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_WIZARD_PAGE_SHOWN, wxWizardEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_WIZARD_BEFORE_PAGE_CHANGED, wxWizardEvent ); + +typedef void (wxEvtHandler::*wxWizardEventFunction)(wxWizardEvent&); + +#define wxWizardEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxWizardEventFunction, func) + +#define wx__DECLARE_WIZARDEVT(evt, id, fn) \ + wx__DECLARE_EVT1(wxEVT_WIZARD_ ## evt, id, wxWizardEventHandler(fn)) + +// notifies that the page has just been changed (can't be vetoed) +#define EVT_WIZARD_PAGE_CHANGED(id, fn) wx__DECLARE_WIZARDEVT(PAGE_CHANGED, id, fn) + +// the user pressed "<Back" or "Next>" button and the page is going to be +// changed - unless the event handler vetoes the event +#define EVT_WIZARD_PAGE_CHANGING(id, fn) wx__DECLARE_WIZARDEVT(PAGE_CHANGING, id, fn) + +// Called before GetNext/GetPrev is called, so that the handler can change state that will be +// used when GetNext/GetPrev is called. PAGE_CHANGING is called too late to influence GetNext/GetPrev. +#define EVT_WIZARD_BEFORE_PAGE_CHANGED(id, fn) wx__DECLARE_WIZARDEVT(BEFORE_PAGE_CHANGED, id, fn) + +// the user pressed "Cancel" button and the wizard is going to be dismissed - +// unless the event handler vetoes the event +#define EVT_WIZARD_CANCEL(id, fn) wx__DECLARE_WIZARDEVT(CANCEL, id, fn) + +// the user pressed "Finish" button and the wizard is going to be dismissed - +#define EVT_WIZARD_FINISHED(id, fn) wx__DECLARE_WIZARDEVT(FINISHED, id, fn) + +// the user pressed "Help" button +#define EVT_WIZARD_HELP(id, fn) wx__DECLARE_WIZARDEVT(HELP, id, fn) + +// the page was just shown and laid out +#define EVT_WIZARD_PAGE_SHOWN(id, fn) wx__DECLARE_WIZARDEVT(PAGE_SHOWN, id, fn) + +#endif // wxUSE_WIZARDDLG + +#endif // _WX_WIZARD_H_ diff --git a/lib/wxWidgets/include/wx/wrapsizer.h b/lib/wxWidgets/include/wx/wrapsizer.h new file mode 100644 index 0000000..d0494a1 --- /dev/null +++ b/lib/wxWidgets/include/wx/wrapsizer.h @@ -0,0 +1,103 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/wrapsizer.h +// Purpose: provide wrapping sizer for layout (wxWrapSizer) +// Author: Arne Steinarson +// Created: 2008-05-08 +// Copyright: (c) Arne Steinarson +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WRAPSIZER_H_ +#define _WX_WRAPSIZER_H_ + +#include "wx/sizer.h" + +// flags for wxWrapSizer +enum +{ + wxEXTEND_LAST_ON_EACH_LINE = 1, + // don't leave spacers in the beginning of a new row + wxREMOVE_LEADING_SPACES = 2, + + wxWRAPSIZER_DEFAULT_FLAGS = wxEXTEND_LAST_ON_EACH_LINE | + wxREMOVE_LEADING_SPACES +}; + +// ---------------------------------------------------------------------------- +// A box sizer that can wrap items on several lines when sum of widths exceed +// available line width. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxWrapSizer : public wxBoxSizer +{ +public: + wxWrapSizer(int orient = wxHORIZONTAL, int flags = wxWRAPSIZER_DEFAULT_FLAGS); + virtual ~wxWrapSizer(); + + // override base class virtual methods + virtual wxSize CalcMin() wxOVERRIDE; + virtual void RepositionChildren(const wxSize& minSize) wxOVERRIDE; + + virtual bool InformFirstDirection(int direction, + int size, + int availableOtherDir) wxOVERRIDE; + +protected: + // This method is called to decide if an item represents empty space or + // not. We do this to avoid having space-only items first or last on a + // wrapped line (left alignment). + // + // By default only spacers are considered to be empty items but a derived + // class may override this item if some other kind of sizer elements should + // be also considered empty for some reason. + virtual bool IsSpaceItem(wxSizerItem *item) const + { + return item->IsSpacer(); + } + + // helpers of CalcMin() + void CalcMinFromMinor(int totMinor); + void CalcMinFromMajor(int totMajor); + void CalcMinUsingCurrentLayout(); + void CalcMinFittingSize(const wxSize& szBoundary); + void CalcMaxSingleItemSize(); + + // temporarily change the proportion of the last item of the N-th row to + // extend to the end of line if the appropriate flag is set + void AdjustLastRowItemProp(size_t n, wxSizerItem *itemLast); + + // remove all the items from m_rows + void ClearRows(); + + // return the N-th row sizer from m_rows creating it if necessary + wxSizer *GetRowSizer(size_t n); + + // should be called after completion of each row + void FinishRow(size_t n, int rowMajor, int rowMinor, wxSizerItem *itemLast); + + + const int m_flags; // Flags specified in the ctor + + int m_dirInform; // Direction for size information + int m_availSize; // Size available in m_dirInform direction + int m_availableOtherDir; // Size available in the other direction + bool m_lastUsed; // Indicates whether value from InformFirst... has + // been used yet + + // The sizes below are computed by RepositionChildren(), i.e. they don't have + // valid values during the initial call to CalcMin() and they are only + // valid for the current layout (i.e. the current number of rows) + int m_minSizeMinor; // Min size in minor direction + int m_maxSizeMajor; // Size of longest row + int m_minItemMajor; // Size of smallest item in major direction + + // the minimal size needed for this sizer as calculated by the last call to + // our CalcMin() + wxSize m_calculatedMinSize; + + wxBoxSizer m_rows; // Sizer containing multiple rows of our items + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxWrapSizer); +}; + +#endif // _WX_WRAPSIZER_H_ diff --git a/lib/wxWidgets/include/wx/wupdlock.h b/lib/wxWidgets/include/wx/wupdlock.h new file mode 100644 index 0000000..3500301 --- /dev/null +++ b/lib/wxWidgets/include/wx/wupdlock.h @@ -0,0 +1,53 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/wupdlock.h +// Purpose: wxWindowUpdateLocker prevents window redrawing +// Author: Vadim Zeitlin +// Created: 2006-03-06 +// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WUPDLOCK_H_ +#define _WX_WUPDLOCK_H_ + +#include "wx/window.h" + +// ---------------------------------------------------------------------------- +// wxWindowUpdateLocker prevents updates to the window during its lifetime +// ---------------------------------------------------------------------------- + +class wxWindowUpdateLocker +{ +public: + // Prefer using the ctor below if possible, this ctor is only useful if + // Lock() must be called only conditionally. + wxWindowUpdateLocker() : m_win(NULL) { } + + // create an object preventing updates of the given window (which must have + // a lifetime at least as great as ours) + explicit wxWindowUpdateLocker(wxWindow *win) : m_win(win) { win->Freeze(); } + + // May be called only for the object constructed using the default ctor. + void Lock(wxWindow *win) + { + wxASSERT( !m_win ); + + m_win = win; + win->Freeze(); + } + + // dtor thaws the window to permit updates again + ~wxWindowUpdateLocker() + { + if ( m_win ) + m_win->Thaw(); + } + +private: + wxWindow *m_win; + + wxDECLARE_NO_COPY_CLASS(wxWindowUpdateLocker); +}; + +#endif // _WX_WUPDLOCK_H_ + diff --git a/lib/wxWidgets/include/wx/wx.h b/lib/wxWidgets/include/wx/wx.h new file mode 100644 index 0000000..f672167 --- /dev/null +++ b/lib/wxWidgets/include/wx/wx.h @@ -0,0 +1,113 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/wx.h +// Purpose: wxWidgets central header including the most often used ones +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WX_H_ +#define _WX_WX_H_ + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/dynarray.h" +#include "wx/list.h" +#include "wx/hash.h" +#include "wx/string.h" +#include "wx/hashmap.h" +#include "wx/arrstr.h" +#include "wx/intl.h" +#include "wx/log.h" +#include "wx/event.h" +#include "wx/app.h" +#include "wx/utils.h" +#include "wx/stream.h" +#include "wx/memory.h" +#include "wx/math.h" +#include "wx/stopwatch.h" +#include "wx/timer.h" +#include "wx/module.h" +#include "wx/wxcrt.h" +#include "wx/wxcrtvararg.h" + +#if wxUSE_GUI + +#include "wx/window.h" +#include "wx/containr.h" +#include "wx/panel.h" +#include "wx/toplevel.h" +#include "wx/frame.h" +#include "wx/gdicmn.h" +#include "wx/gdiobj.h" +#include "wx/region.h" +#include "wx/bitmap.h" +#include "wx/bmpbndl.h" +#include "wx/image.h" +#include "wx/colour.h" +#include "wx/font.h" +#include "wx/dc.h" +#include "wx/dcclient.h" +#include "wx/dcmemory.h" +#include "wx/dcprint.h" +#include "wx/dcscreen.h" +#include "wx/button.h" +#include "wx/menuitem.h" +#include "wx/menu.h" +#include "wx/pen.h" +#include "wx/brush.h" +#include "wx/palette.h" +#include "wx/icon.h" +#include "wx/cursor.h" +#include "wx/dialog.h" +#include "wx/settings.h" +#include "wx/msgdlg.h" +#include "wx/dataobj.h" + +#include "wx/control.h" +#include "wx/ctrlsub.h" +#include "wx/bmpbuttn.h" +#include "wx/checkbox.h" +#include "wx/checklst.h" +#include "wx/choice.h" +#include "wx/scrolbar.h" +#include "wx/stattext.h" +#include "wx/statbmp.h" +#include "wx/statbox.h" +#include "wx/listbox.h" +#include "wx/radiobox.h" +#include "wx/radiobut.h" +#include "wx/textctrl.h" +#include "wx/slider.h" +#include "wx/gauge.h" +#include "wx/scrolwin.h" +#include "wx/dirdlg.h" +#include "wx/toolbar.h" +#include "wx/combobox.h" +#include "wx/layout.h" +#include "wx/sizer.h" +#include "wx/statusbr.h" +#include "wx/choicdlg.h" +#include "wx/textdlg.h" +#include "wx/filedlg.h" + +// this one is included by exactly one file (mdi.cpp) during wx build so even +// although we keep it here for the library users, don't include it to avoid +// bloating the PCH and (worse) rebuilding the entire library when it changes +// when building the library itself +#ifndef WXBUILDING + #include "wx/mdi.h" +#endif + +// always include, even if !wxUSE_VALIDATORS because we need wxDefaultValidator +#include "wx/validate.h" + +#if wxUSE_VALIDATORS + #include "wx/valtext.h" +#endif // wxUSE_VALIDATORS + +#endif // wxUSE_GUI + +#endif // _WX_WX_H_ diff --git a/lib/wxWidgets/include/wx/wxchar.h b/lib/wxWidgets/include/wx/wxchar.h new file mode 100644 index 0000000..597bbe1 --- /dev/null +++ b/lib/wxWidgets/include/wx/wxchar.h @@ -0,0 +1,18 @@ +////////////////////////////////////////////////////////////////////////////// +// Name: wx/wxchar.h +// Purpose: Declarations common to wx char/wchar_t usage (wide chars) +// 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 +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WXCHAR_H_ +#define _WX_WXCHAR_H_ + +// This header used to define CRT functions wrappers in wxWidgets 2.8. This is +// now done in (headers included by) wx/crt.h, so include it for compatibility: +#include "wx/crt.h" + +#endif /* _WX_WXCHAR_H_ */ diff --git a/lib/wxWidgets/include/wx/wxcrt.h b/lib/wxWidgets/include/wx/wxcrt.h new file mode 100644 index 0000000..3f4fa73 --- /dev/null +++ b/lib/wxWidgets/include/wx/wxcrt.h @@ -0,0 +1,1114 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/wxcrt.h +// Purpose: Type-safe ANSI and Unicode builds compatible wrappers for +// CRT functions +// Author: Joel Farley, Ove Kaaven +// Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee, Vaclav Slavik +// Created: 1998/06/12 +// Copyright: (c) 1998-2006 wxWidgets dev team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WXCRT_H_ +#define _WX_WXCRT_H_ + +#include "wx/wxcrtbase.h" +#include "wx/string.h" + +#ifndef __WX_SETUP_H__ +// For non-configure builds assume vsscanf is available, if not Visual C +#if !defined (__VISUALC__) + #define HAVE_VSSCANF 1 +#endif +#endif + +// ============================================================================ +// misc functions +// ============================================================================ + +/* checks whether the passed in pointer is NULL and if the string is empty */ +inline bool wxIsEmpty(const char *s) { return !s || !*s; } +inline bool wxIsEmpty(const wchar_t *s) { return !s || !*s; } +inline bool wxIsEmpty(const wxScopedCharBuffer& s) { return wxIsEmpty(s.data()); } +inline bool wxIsEmpty(const wxScopedWCharBuffer& s) { return wxIsEmpty(s.data()); } +inline bool wxIsEmpty(const wxString& s) { return s.empty(); } +inline bool wxIsEmpty(const wxCStrData& s) { return s.AsString().empty(); } + + + +/* multibyte to wide char conversion functions and macros */ + +/* multibyte<->widechar conversion */ +WXDLLIMPEXP_BASE size_t wxMB2WC(wchar_t *buf, const char *psz, size_t n); +WXDLLIMPEXP_BASE size_t wxWC2MB(char *buf, const wchar_t *psz, size_t n); + +#if wxUSE_UNICODE + #define wxMB2WX wxMB2WC + #define wxWX2MB wxWC2MB + #define wxWC2WX wxStrncpy + #define wxWX2WC wxStrncpy +#else + #define wxMB2WX wxStrncpy + #define wxWX2MB wxStrncpy + #define wxWC2WX wxWC2MB + #define wxWX2WC wxMB2WC +#endif + + +// RN: We could do the usual tricky compiler detection here, +// and use their variant (such as wmemchr, etc.). The problem +// is that these functions are quite rare, even though they are +// part of the current POSIX standard. In addition, most compilers +// (including even MSC) inline them just like we do right in their +// headers. +// +#include <string.h> + +#if wxUSE_UNICODE + //implement our own wmem variants + inline wxChar* wxTmemchr(const wxChar* s, wxChar c, size_t l) + { + for(;l && *s != c;--l, ++s) {} + + if(l) + return const_cast<wxChar*>(s); + return NULL; + } + + inline int wxTmemcmp(const wxChar* sz1, const wxChar* sz2, size_t len) + { + for(; *sz1 == *sz2 && len; --len, ++sz1, ++sz2) {} + + if(len) + return *sz1 < *sz2 ? -1 : *sz1 > *sz2; + else + return 0; + } + + inline wxChar* wxTmemcpy(wxChar* szOut, const wxChar* szIn, size_t len) + { + return (wxChar*) memcpy(szOut, szIn, len * sizeof(wxChar)); + } + + inline wxChar* wxTmemmove(wxChar* szOut, const wxChar* szIn, size_t len) + { + return (wxChar*) memmove(szOut, szIn, len * sizeof(wxChar)); + } + + inline wxChar* wxTmemset(wxChar* szOut, wxChar cIn, size_t len) + { + wxChar* szRet = szOut; + + while (len--) + *szOut++ = cIn; + + return szRet; + } +#endif /* wxUSE_UNICODE */ + +// provide trivial wrappers for char* versions for both ANSI and Unicode builds +// (notice that these intentionally return "char *" and not "void *" unlike the +// standard memxxx() for symmetry with the wide char versions): +inline char* wxTmemchr(const char* s, char c, size_t len) + { return const_cast<char*>(static_cast<const char*>(memchr(s, c, len))); } +inline int wxTmemcmp(const char* sz1, const char* sz2, size_t len) + { return memcmp(sz1, sz2, len); } +inline char* wxTmemcpy(char* szOut, const char* szIn, size_t len) + { return (char*)memcpy(szOut, szIn, len); } +inline char* wxTmemmove(char* szOut, const char* szIn, size_t len) + { return (char*)memmove(szOut, szIn, len); } +inline char* wxTmemset(char* szOut, char cIn, size_t len) + { return (char*)memset(szOut, cIn, len); } + + +// ============================================================================ +// wx wrappers for CRT functions in both char* and wchar_t* versions +// ============================================================================ + +// A few notes on implementation of these wrappers: +// +// We need both char* and wchar_t* versions of functions like wxStrlen() for +// compatibility with both ANSI and Unicode builds. +// +// This makes passing wxString or c_str()/mb_str()/wc_str() result to them +// ambiguous, so we need to provide overrides for that as well (in cases where +// it makes sense). +// +// We can do this without problems for some functions (wxStrlen()), but in some +// cases, we can't stay compatible with both ANSI and Unicode builds, e.g. for +// wxStrcpy(const wxString&), which can only return either char* or wchar_t*. +// In these cases, we preserve ANSI build compatibility by returning char*. + +// ---------------------------------------------------------------------------- +// locale functions +// ---------------------------------------------------------------------------- + +// NB: we can't provide const wchar_t* (= wxChar*) overload, because calling +// wxSetlocale(category, NULL) -- which is a common thing to do -- would be +// ambiguous +WXDLLIMPEXP_BASE char* wxSetlocale(int category, const char *locale); +inline char* wxSetlocale(int category, const wxScopedCharBuffer& locale) + { return wxSetlocale(category, locale.data()); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline char* wxSetlocale(int category, const wxString& locale) + { return wxSetlocale(category, locale.mb_str()); } +inline char* wxSetlocale(int category, const wxCStrData& locale) + { return wxSetlocale(category, locale.AsCharBuf()); } +#endif + +// ---------------------------------------------------------------------------- +// string functions +// ---------------------------------------------------------------------------- + +/* safe version of strlen() (returns 0 if passed NULL pointer) */ +// NB: these are defined in wxcrtbase.h, see the comment there +// inline size_t wxStrlen(const char *s) { return s ? strlen(s) : 0; } +// inline size_t wxStrlen(const wchar_t *s) { return s ? wxCRT_Strlen_(s) : 0; } +inline size_t wxStrlen(const wxScopedCharBuffer& s) { return wxStrlen(s.data()); } +inline size_t wxStrlen(const wxScopedWCharBuffer& s) { return wxStrlen(s.data()); } +inline size_t wxStrlen(const wxString& s) { return s.length(); } +inline size_t wxStrlen(const wxCStrData& s) { return s.AsString().length(); } + +// this is a function new in 2.9 so we don't care about backwards compatibility and +// so don't need to support wxScopedCharBuffer/wxScopedWCharBuffer overloads +#if defined(wxCRT_StrnlenA) +inline size_t wxStrnlen(const char *str, size_t maxlen) { return wxCRT_StrnlenA(str, maxlen); } +#else +inline size_t wxStrnlen(const char *str, size_t maxlen) +{ + size_t n; + for ( n = 0; n < maxlen; n++ ) + if ( !str[n] ) + break; + + return n; +} +#endif + +#if defined(wxCRT_StrnlenW) +inline size_t wxStrnlen(const wchar_t *str, size_t maxlen) { return wxCRT_StrnlenW(str, maxlen); } +#else +inline size_t wxStrnlen(const wchar_t *str, size_t maxlen) +{ + size_t n; + for ( n = 0; n < maxlen; n++ ) + if ( !str[n] ) + break; + + return n; +} +#endif + +// NB: these are defined in wxcrtbase.h, see the comment there +// inline char* wxStrdup(const char *s) { return wxStrdupA(s); } +// inline wchar_t* wxStrdup(const wchar_t *s) { return wxStrdupW(s); } +inline char* wxStrdup(const wxScopedCharBuffer& s) { return wxStrdup(s.data()); } +inline wchar_t* wxStrdup(const wxScopedWCharBuffer& s) { return wxStrdup(s.data()); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline char* wxStrdup(const wxString& s) { return wxStrdup(s.mb_str()); } +inline char* wxStrdup(const wxCStrData& s) { return wxStrdup(s.AsCharBuf()); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + +inline char *wxStrcpy(char *dest, const char *src) + { return wxCRT_StrcpyA(dest, src); } +inline wchar_t *wxStrcpy(wchar_t *dest, const wchar_t *src) + { return wxCRT_StrcpyW(dest, src); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline char *wxStrcpy(char *dest, const wxString& src) + { return wxCRT_StrcpyA(dest, src.mb_str()); } +inline char *wxStrcpy(char *dest, const wxCStrData& src) + { return wxCRT_StrcpyA(dest, src.AsCharBuf()); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING +inline char *wxStrcpy(char *dest, const wxScopedCharBuffer& src) + { return wxCRT_StrcpyA(dest, src.data()); } +inline wchar_t *wxStrcpy(wchar_t *dest, const wxString& src) + { return wxCRT_StrcpyW(dest, src.wc_str()); } +inline wchar_t *wxStrcpy(wchar_t *dest, const wxCStrData& src) + { return wxCRT_StrcpyW(dest, src.AsWCharBuf()); } +inline wchar_t *wxStrcpy(wchar_t *dest, const wxScopedWCharBuffer& src) + { return wxCRT_StrcpyW(dest, src.data()); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline char *wxStrcpy(char *dest, const wchar_t *src) + { return wxCRT_StrcpyA(dest, wxConvLibc.cWC2MB(src)); } +inline wchar_t *wxStrcpy(wchar_t *dest, const char *src) + { return wxCRT_StrcpyW(dest, wxConvLibc.cMB2WC(src)); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + +inline char *wxStrncpy(char *dest, const char *src, size_t n) + { return wxCRT_StrncpyA(dest, src, n); } +inline wchar_t *wxStrncpy(wchar_t *dest, const wchar_t *src, size_t n) + { return wxCRT_StrncpyW(dest, src, n); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline char *wxStrncpy(char *dest, const wxString& src, size_t n) + { return wxCRT_StrncpyA(dest, src.mb_str(), n); } +inline char *wxStrncpy(char *dest, const wxCStrData& src, size_t n) + { return wxCRT_StrncpyA(dest, src.AsCharBuf(), n); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING +inline char *wxStrncpy(char *dest, const wxScopedCharBuffer& src, size_t n) + { return wxCRT_StrncpyA(dest, src.data(), n); } +inline wchar_t *wxStrncpy(wchar_t *dest, const wxString& src, size_t n) + { return wxCRT_StrncpyW(dest, src.wc_str(), n); } +inline wchar_t *wxStrncpy(wchar_t *dest, const wxCStrData& src, size_t n) + { return wxCRT_StrncpyW(dest, src.AsWCharBuf(), n); } +inline wchar_t *wxStrncpy(wchar_t *dest, const wxScopedWCharBuffer& src, size_t n) + { return wxCRT_StrncpyW(dest, src.data(), n); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline char *wxStrncpy(char *dest, const wchar_t *src, size_t n) + { return wxCRT_StrncpyA(dest, wxConvLibc.cWC2MB(src), n); } +inline wchar_t *wxStrncpy(wchar_t *dest, const char *src, size_t n) + { return wxCRT_StrncpyW(dest, wxConvLibc.cMB2WC(src), n); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + +// this is a function new in 2.9 so we don't care about backwards compatibility and +// so don't need to support wchar_t/char overloads +inline size_t wxStrlcpy(char *dest, const char *src, size_t n) +{ + const size_t len = wxCRT_StrlenA(src); + + if ( n ) + { + if ( n-- > len ) + n = len; + memcpy(dest, src, n); + dest[n] = '\0'; + } + + return len; +} +inline size_t wxStrlcpy(wchar_t *dest, const wchar_t *src, size_t n) +{ + const size_t len = wxCRT_StrlenW(src); + if ( n ) + { + if ( n-- > len ) + n = len; + memcpy(dest, src, n * sizeof(wchar_t)); + dest[n] = L'\0'; + } + + return len; +} + +inline char *wxStrcat(char *dest, const char *src) + { return wxCRT_StrcatA(dest, src); } +inline wchar_t *wxStrcat(wchar_t *dest, const wchar_t *src) + { return wxCRT_StrcatW(dest, src); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline char *wxStrcat(char *dest, const wxString& src) + { return wxCRT_StrcatA(dest, src.mb_str()); } +inline char *wxStrcat(char *dest, const wxCStrData& src) + { return wxCRT_StrcatA(dest, src.AsCharBuf()); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING +inline char *wxStrcat(char *dest, const wxScopedCharBuffer& src) + { return wxCRT_StrcatA(dest, src.data()); } +inline wchar_t *wxStrcat(wchar_t *dest, const wxString& src) + { return wxCRT_StrcatW(dest, src.wc_str()); } +inline wchar_t *wxStrcat(wchar_t *dest, const wxCStrData& src) + { return wxCRT_StrcatW(dest, src.AsWCharBuf()); } +inline wchar_t *wxStrcat(wchar_t *dest, const wxScopedWCharBuffer& src) + { return wxCRT_StrcatW(dest, src.data()); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline char *wxStrcat(char *dest, const wchar_t *src) + { return wxCRT_StrcatA(dest, wxConvLibc.cWC2MB(src)); } +inline wchar_t *wxStrcat(wchar_t *dest, const char *src) + { return wxCRT_StrcatW(dest, wxConvLibc.cMB2WC(src)); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + +inline char *wxStrncat(char *dest, const char *src, size_t n) + { return wxCRT_StrncatA(dest, src, n); } +inline wchar_t *wxStrncat(wchar_t *dest, const wchar_t *src, size_t n) + { return wxCRT_StrncatW(dest, src, n); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline char *wxStrncat(char *dest, const wxString& src, size_t n) + { return wxCRT_StrncatA(dest, src.mb_str(), n); } +inline char *wxStrncat(char *dest, const wxCStrData& src, size_t n) + { return wxCRT_StrncatA(dest, src.AsCharBuf(), n); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING +inline char *wxStrncat(char *dest, const wxScopedCharBuffer& src, size_t n) + { return wxCRT_StrncatA(dest, src.data(), n); } +inline wchar_t *wxStrncat(wchar_t *dest, const wxString& src, size_t n) + { return wxCRT_StrncatW(dest, src.wc_str(), n); } +inline wchar_t *wxStrncat(wchar_t *dest, const wxCStrData& src, size_t n) + { return wxCRT_StrncatW(dest, src.AsWCharBuf(), n); } +inline wchar_t *wxStrncat(wchar_t *dest, const wxScopedWCharBuffer& src, size_t n) + { return wxCRT_StrncatW(dest, src.data(), n); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline char *wxStrncat(char *dest, const wchar_t *src, size_t n) + { return wxCRT_StrncatA(dest, wxConvLibc.cWC2MB(src), n); } +inline wchar_t *wxStrncat(wchar_t *dest, const char *src, size_t n) + { return wxCRT_StrncatW(dest, wxConvLibc.cMB2WC(src), n); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + + +#define WX_STR_DECL(name, T1, T2) name(T1 s1, T2 s2) +#define WX_STR_CALL(func, a1, a2) func(a1, a2) + +// This macro defines string function for all possible variants of arguments, +// except for those taking wxString or wxCStrData as second argument. +// Parameters: +// rettype - return type +// name - name of the (overloaded) function to define +// crtA - function to call for char* versions (takes two arguments) +// crtW - ditto for wchar_t* function +// forString - function to call when the *first* argument is wxString; +// the second argument can be any string type, so this is +// typically a template +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +#define WX_STR_FUNC_NO_INVERT(rettype, name, crtA, crtW, forString) \ + inline rettype WX_STR_DECL(name, const char *, const char *) \ + { return WX_STR_CALL(crtA, s1, s2); } \ + inline rettype WX_STR_DECL(name, const char *, const wchar_t *) \ + { return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \ + inline rettype WX_STR_DECL(name, const char *, const wxScopedCharBuffer&) \ + { return WX_STR_CALL(crtA, s1, s2.data()); } \ + inline rettype WX_STR_DECL(name, const char *, const wxScopedWCharBuffer&) \ + { return WX_STR_CALL(forString, wxString(s1), s2.data()); } \ + \ + inline rettype WX_STR_DECL(name, const wchar_t *, const wchar_t *) \ + { return WX_STR_CALL(crtW, s1, s2); } \ + inline rettype WX_STR_DECL(name, const wchar_t *, const char *) \ + { return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \ + inline rettype WX_STR_DECL(name, const wchar_t *, const wxScopedWCharBuffer&) \ + { return WX_STR_CALL(crtW, s1, s2.data()); } \ + inline rettype WX_STR_DECL(name, const wchar_t *, const wxScopedCharBuffer&) \ + { return WX_STR_CALL(forString, wxString(s1), s2.data()); } \ + \ + inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const char *) \ + { return WX_STR_CALL(crtA, s1.data(), s2); } \ + inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wchar_t *) \ + { return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \ + inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wxScopedCharBuffer&)\ + { return WX_STR_CALL(crtA, s1.data(), s2.data()); } \ + inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wxScopedWCharBuffer&) \ + { return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \ + \ + inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wchar_t *) \ + { return WX_STR_CALL(crtW, s1.data(), s2); } \ + inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const char *) \ + { return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \ + inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxScopedWCharBuffer&) \ + { return WX_STR_CALL(crtW, s1.data(), s2.data()); } \ + inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxScopedCharBuffer&) \ + { return WX_STR_CALL(forString, wxString(s1), wxString(s2)); } \ + \ + inline rettype WX_STR_DECL(name, const wxString&, const char*) \ + { return WX_STR_CALL(forString, s1, s2); } \ + inline rettype WX_STR_DECL(name, const wxString&, const wchar_t*) \ + { return WX_STR_CALL(forString, s1, s2); } \ + inline rettype WX_STR_DECL(name, const wxString&, const wxScopedCharBuffer&) \ + { return WX_STR_CALL(forString, s1, s2); } \ + inline rettype WX_STR_DECL(name, const wxString&, const wxScopedWCharBuffer&) \ + { return WX_STR_CALL(forString, s1, s2); } \ + inline rettype WX_STR_DECL(name, const wxString&, const wxString&) \ + { return WX_STR_CALL(forString, s1, s2); } \ + inline rettype WX_STR_DECL(name, const wxString&, const wxCStrData&) \ + { return WX_STR_CALL(forString, s1, s2); } \ + \ + inline rettype WX_STR_DECL(name, const wxCStrData&, const char*) \ + { return WX_STR_CALL(forString, s1.AsString(), s2); } \ + inline rettype WX_STR_DECL(name, const wxCStrData&, const wchar_t*) \ + { return WX_STR_CALL(forString, s1.AsString(), s2); } \ + inline rettype WX_STR_DECL(name, const wxCStrData&, const wxScopedCharBuffer&) \ + { return WX_STR_CALL(forString, s1.AsString(), s2); } \ + inline rettype WX_STR_DECL(name, const wxCStrData&, const wxScopedWCharBuffer&) \ + { return WX_STR_CALL(forString, s1.AsString(), s2); } \ + inline rettype WX_STR_DECL(name, const wxCStrData&, const wxString&) \ + { return WX_STR_CALL(forString, s1.AsString(), s2); } \ + inline rettype WX_STR_DECL(name, const wxCStrData&, const wxCStrData&) \ + { return WX_STR_CALL(forString, s1.AsString(), s2); } +#else // wxNO_IMPLICIT_WXSTRING_ENCODING +#define WX_STR_FUNC_NO_INVERT(rettype, name, crtA, crtW, forString) \ + inline rettype WX_STR_DECL(name, const char *, const char *) \ + { return WX_STR_CALL(crtA, s1, s2); } \ + \ + inline rettype WX_STR_DECL(name, const wchar_t *, const wchar_t *) \ + { return WX_STR_CALL(crtW, s1, s2); } \ + inline rettype WX_STR_DECL(name, const wchar_t *, const wxScopedWCharBuffer&) \ + { return WX_STR_CALL(crtW, s1, s2.data()); } \ + \ + inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const char *) \ + { return WX_STR_CALL(crtA, s1.data(), s2); } \ + inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wxScopedCharBuffer&)\ + { return WX_STR_CALL(crtA, s1.data(), s2.data()); } \ + \ + inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wchar_t *) \ + { return WX_STR_CALL(crtW, s1.data(), s2); } \ + inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxScopedWCharBuffer&) \ + { return WX_STR_CALL(crtW, s1.data(), s2.data()); } \ + \ + inline rettype WX_STR_DECL(name, const wxString&, const wchar_t*) \ + { return WX_STR_CALL(forString, s1, s2); } \ + inline rettype WX_STR_DECL(name, const wxString&, const wxScopedWCharBuffer&) \ + { return WX_STR_CALL(forString, s1, s2); } \ + inline rettype WX_STR_DECL(name, const wxString&, const wxString&) \ + { return WX_STR_CALL(forString, s1, s2); } \ + inline rettype WX_STR_DECL(name, const wxString&, const wxCStrData&) \ + { return WX_STR_CALL(forString, s1, s2); } \ + \ + inline rettype WX_STR_DECL(name, const wxCStrData&, const wchar_t*) \ + { return WX_STR_CALL(forString, s1.AsString(), s2); } \ + inline rettype WX_STR_DECL(name, const wxCStrData&, const wxScopedWCharBuffer&) \ + { return WX_STR_CALL(forString, s1.AsString(), s2); } \ + inline rettype WX_STR_DECL(name, const wxCStrData&, const wxString&) \ + { return WX_STR_CALL(forString, s1.AsString(), s2); } \ + inline rettype WX_STR_DECL(name, const wxCStrData&, const wxCStrData&) \ + { return WX_STR_CALL(forString, s1.AsString(), s2); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + +// This defines strcmp-like function, i.e. one returning the result of +// comparison; see WX_STR_FUNC_NO_INVERT for explanation of the arguments +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +#define WX_STRCMP_FUNC(name, crtA, crtW, forString) \ + WX_STR_FUNC_NO_INVERT(int, name, crtA, crtW, forString) \ + \ + inline int WX_STR_DECL(name, const char *, const wxCStrData&) \ + { return -WX_STR_CALL(forString, s2.AsString(), s1); } \ + inline int WX_STR_DECL(name, const char *, const wxString&) \ + { return -WX_STR_CALL(forString, s2, s1); } \ + \ + inline int WX_STR_DECL(name, const wchar_t *, const wxCStrData&) \ + { return -WX_STR_CALL(forString, s2.AsString(), s1); } \ + inline int WX_STR_DECL(name, const wchar_t *, const wxString&) \ + { return -WX_STR_CALL(forString, s2, s1); } \ + \ + inline int WX_STR_DECL(name, const wxScopedCharBuffer&, const wxCStrData&) \ + { return -WX_STR_CALL(forString, s2.AsString(), s1.data()); } \ + inline int WX_STR_DECL(name, const wxScopedCharBuffer&, const wxString&) \ + { return -WX_STR_CALL(forString, s2, s1.data()); } \ + \ + inline int WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxCStrData&) \ + { return -WX_STR_CALL(forString, s2.AsString(), s1.data()); } \ + inline int WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxString&) \ + { return -WX_STR_CALL(forString, s2, s1.data()); } +#else // wxNO_IMPLICIT_WXSTRING_ENCODING +#define WX_STRCMP_FUNC(name, crtA, crtW, forString) \ + WX_STR_FUNC_NO_INVERT(int, name, crtA, crtW, forString) \ + \ + inline int WX_STR_DECL(name, const wchar_t *, const wxCStrData&) \ + { return -WX_STR_CALL(forString, s2.AsString(), s1); } \ + inline int WX_STR_DECL(name, const wchar_t *, const wxString&) \ + { return -WX_STR_CALL(forString, s2, s1); } \ + \ + inline int WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxCStrData&) \ + { return -WX_STR_CALL(forString, s2.AsString(), s1.data()); } \ + inline int WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxString&) \ + { return -WX_STR_CALL(forString, s2, s1.data()); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + + +// This defines a string function that is *not* strcmp-like, i.e. doesn't +// return the result of comparison and so if the second argument is a string, +// it has to be converted to char* or wchar_t* +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +#define WX_STR_FUNC(rettype, name, crtA, crtW, forString) \ + WX_STR_FUNC_NO_INVERT(rettype, name, crtA, crtW, forString) \ + \ + inline rettype WX_STR_DECL(name, const char *, const wxCStrData&) \ + { return WX_STR_CALL(crtA, s1, s2.AsCharBuf()); } \ + inline rettype WX_STR_DECL(name, const char *, const wxString&) \ + { return WX_STR_CALL(crtA, s1, s2.mb_str()); } \ + \ + inline rettype WX_STR_DECL(name, const wchar_t *, const wxCStrData&) \ + { return WX_STR_CALL(crtW, s1, s2.AsWCharBuf()); } \ + inline rettype WX_STR_DECL(name, const wchar_t *, const wxString&) \ + { return WX_STR_CALL(crtW, s1, s2.wc_str()); } \ + \ + inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wxCStrData&) \ + { return WX_STR_CALL(crtA, s1.data(), s2.AsCharBuf()); } \ + inline rettype WX_STR_DECL(name, const wxScopedCharBuffer&, const wxString&) \ + { return WX_STR_CALL(crtA, s1.data(), s2.mb_str()); } \ + \ + inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxCStrData&) \ + { return WX_STR_CALL(crtW, s1.data(), s2.AsWCharBuf()); } \ + inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxString&) \ + { return WX_STR_CALL(crtW, s1.data(), s2.wc_str()); } +#else // wxNO_IMPLICIT_WXSTRING_ENCODING +#define WX_STR_FUNC(rettype, name, crtA, crtW, forString) \ + WX_STR_FUNC_NO_INVERT(rettype, name, crtA, crtW, forString) \ + \ + inline rettype WX_STR_DECL(name, const wchar_t *, const wxCStrData&) \ + { return WX_STR_CALL(crtW, s1, s2.AsWCharBuf()); } \ + inline rettype WX_STR_DECL(name, const wchar_t *, const wxString&) \ + { return WX_STR_CALL(crtW, s1, s2.wc_str()); } \ + \ + inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxCStrData&) \ + { return WX_STR_CALL(crtW, s1.data(), s2.AsWCharBuf()); } \ + inline rettype WX_STR_DECL(name, const wxScopedWCharBuffer&, const wxString&) \ + { return WX_STR_CALL(crtW, s1.data(), s2.wc_str()); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + +template<typename T> +inline int wxStrcmp_String(const wxString& s1, const T& s2) + { return s1.compare(s2); } +WX_STRCMP_FUNC(wxStrcmp, wxCRT_StrcmpA, wxCRT_StrcmpW, wxStrcmp_String) + +template<typename T> +inline int wxStricmp_String(const wxString& s1, const T& s2) + { return s1.CmpNoCase(s2); } +WX_STRCMP_FUNC(wxStricmp, wxCRT_StricmpA, wxCRT_StricmpW, wxStricmp_String) + +#if defined(wxCRT_StrcollA) && defined(wxCRT_StrcollW) + +template<typename T> +inline int wxStrcoll_String(const wxString& s1, const T& s2); +WX_STRCMP_FUNC(wxStrcoll, wxCRT_StrcollA, wxCRT_StrcollW, wxStrcoll_String) + +template<typename T> +inline int wxStrcoll_String(const wxString& s1, const T& s2) +{ +#if wxUSE_UNICODE + // NB: strcoll() doesn't work correctly on UTF-8 strings, so we have to use + // wc_str() even if wxUSE_UNICODE_UTF8; the (const wchar_t*) cast is + // there just as optimization to avoid going through + // wxStrcoll<wxScopedWCharBuffer>: + return wxStrcoll((const wchar_t*)s1.wc_str(), s2); +#else + return wxStrcoll((const char*)s1.mb_str(), s2); +#endif +} + +#endif // defined(wxCRT_Strcoll[AW]) + +template<typename T> +inline size_t wxStrspn_String(const wxString& s1, const T& s2) +{ + size_t pos = s1.find_first_not_of(s2); + return pos == wxString::npos ? s1.length() : pos; +} +WX_STR_FUNC(size_t, wxStrspn, wxCRT_StrspnA, wxCRT_StrspnW, wxStrspn_String) + +template<typename T> +inline size_t wxStrcspn_String(const wxString& s1, const T& s2) +{ + size_t pos = s1.find_first_of(s2); + return pos == wxString::npos ? s1.length() : pos; +} +WX_STR_FUNC(size_t, wxStrcspn, wxCRT_StrcspnA, wxCRT_StrcspnW, wxStrcspn_String) + +#undef WX_STR_DECL +#undef WX_STR_CALL +#define WX_STR_DECL(name, T1, T2) name(T1 s1, T2 s2, size_t n) +#define WX_STR_CALL(func, a1, a2) func(a1, a2, n) + +template<typename T> +inline int wxStrncmp_String(const wxString& s1, const T& s2, size_t n) + { return s1.compare(0, n, s2, 0, n); } +WX_STRCMP_FUNC(wxStrncmp, wxCRT_StrncmpA, wxCRT_StrncmpW, wxStrncmp_String) + +template<typename T> +inline int wxStrnicmp_String(const wxString& s1, const T& s2, size_t n) + { return s1.substr(0, n).CmpNoCase(wxString(s2).substr(0, n)); } +WX_STRCMP_FUNC(wxStrnicmp, wxCRT_StrnicmpA, wxCRT_StrnicmpW, wxStrnicmp_String) + +#undef WX_STR_DECL +#undef WX_STR_CALL +#undef WX_STRCMP_FUNC +#undef WX_STR_FUNC +#undef WX_STR_FUNC_NO_INVERT + +#if defined(wxCRT_StrxfrmA) && defined(wxCRT_StrxfrmW) + +inline size_t wxStrxfrm(char *dest, const char *src, size_t n) + { return wxCRT_StrxfrmA(dest, src, n); } +inline size_t wxStrxfrm(wchar_t *dest, const wchar_t *src, size_t n) + { return wxCRT_StrxfrmW(dest, src, n); } +template<typename T> +inline size_t wxStrxfrm(T *dest, const wxScopedCharTypeBuffer<T>& src, size_t n) + { return wxStrxfrm(dest, src.data(), n); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline size_t wxStrxfrm(char *dest, const wxString& src, size_t n) + { return wxCRT_StrxfrmA(dest, src.mb_str(), n); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING +inline size_t wxStrxfrm(wchar_t *dest, const wxString& src, size_t n) + { return wxCRT_StrxfrmW(dest, src.wc_str(), n); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline size_t wxStrxfrm(char *dest, const wxCStrData& src, size_t n) + { return wxCRT_StrxfrmA(dest, src.AsCharBuf(), n); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING +inline size_t wxStrxfrm(wchar_t *dest, const wxCStrData& src, size_t n) + { return wxCRT_StrxfrmW(dest, src.AsWCharBuf(), n); } + +#endif // defined(wxCRT_Strxfrm[AW]) + +inline char *wxStrtok(char *str, const char *delim, char **saveptr) + { return wxCRT_StrtokA(str, delim, saveptr); } +inline wchar_t *wxStrtok(wchar_t *str, const wchar_t *delim, wchar_t **saveptr) + { return wxCRT_StrtokW(str, delim, saveptr); } +template<typename T> +inline T *wxStrtok(T *str, const wxScopedCharTypeBuffer<T>& delim, T **saveptr) + { return wxStrtok(str, delim.data(), saveptr); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline char *wxStrtok(char *str, const wxCStrData& delim, char **saveptr) + { return wxCRT_StrtokA(str, delim.AsCharBuf(), saveptr); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING +inline wchar_t *wxStrtok(wchar_t *str, const wxCStrData& delim, wchar_t **saveptr) + { return wxCRT_StrtokW(str, delim.AsWCharBuf(), saveptr); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline char *wxStrtok(char *str, const wxString& delim, char **saveptr) + { return wxCRT_StrtokA(str, delim.mb_str(), saveptr); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING +inline wchar_t *wxStrtok(wchar_t *str, const wxString& delim, wchar_t **saveptr) + { return wxCRT_StrtokW(str, delim.wc_str(), saveptr); } + +inline const char *wxStrstr(const char *haystack, const char *needle) + { return wxCRT_StrstrA(haystack, needle); } +inline const wchar_t *wxStrstr(const wchar_t *haystack, const wchar_t *needle) + { return wxCRT_StrstrW(haystack, needle); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline const char *wxStrstr(const char *haystack, const wxString& needle) + { return wxCRT_StrstrA(haystack, needle.mb_str()); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING +inline const wchar_t *wxStrstr(const wchar_t *haystack, const wxString& needle) + { return wxCRT_StrstrW(haystack, needle.wc_str()); } +// these functions return char* pointer into the non-temporary conversion buffer +// used by c_str()'s implicit conversion to char*, for ANSI build compatibility +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline const char *wxStrstr(const wxString& haystack, const wxString& needle) + { return wxCRT_StrstrA(haystack.c_str(), needle.mb_str()); } +inline const char *wxStrstr(const wxCStrData& haystack, const wxString& needle) + { return wxCRT_StrstrA(haystack, needle.mb_str()); } +inline const char *wxStrstr(const wxCStrData& haystack, const wxCStrData& needle) + { return wxCRT_StrstrA(haystack, needle.AsCharBuf()); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING +// if 'needle' is char/wchar_t, then the same is probably wanted as return value +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline const char *wxStrstr(const wxString& haystack, const char *needle) + { return wxCRT_StrstrA(haystack.c_str(), needle); } +inline const char *wxStrstr(const wxCStrData& haystack, const char *needle) + { return wxCRT_StrstrA(haystack, needle); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING +inline const wchar_t *wxStrstr(const wxString& haystack, const wchar_t *needle) + { return wxCRT_StrstrW(haystack.c_str(), needle); } +inline const wchar_t *wxStrstr(const wxCStrData& haystack, const wchar_t *needle) + { return wxCRT_StrstrW(haystack, needle); } + +inline const char *wxStrchr(const char *s, char c) + { return wxCRT_StrchrA(s, c); } +inline const wchar_t *wxStrchr(const wchar_t *s, wchar_t c) + { return wxCRT_StrchrW(s, c); } +inline const char *wxStrrchr(const char *s, char c) + { return wxCRT_StrrchrA(s, c); } +inline const wchar_t *wxStrrchr(const wchar_t *s, wchar_t c) + { return wxCRT_StrrchrW(s, c); } +inline const char *wxStrchr(const char *s, const wxUniChar& uc) + { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : NULL; } +inline const wchar_t *wxStrchr(const wchar_t *s, const wxUniChar& c) + { return wxCRT_StrchrW(s, (wchar_t)c); } +inline const char *wxStrrchr(const char *s, const wxUniChar& uc) + { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : NULL; } +inline const wchar_t *wxStrrchr(const wchar_t *s, const wxUniChar& c) + { return wxCRT_StrrchrW(s, (wchar_t)c); } +inline const char *wxStrchr(const char *s, const wxUniCharRef& uc) + { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : NULL; } +inline const wchar_t *wxStrchr(const wchar_t *s, const wxUniCharRef& c) + { return wxCRT_StrchrW(s, (wchar_t)c); } +inline const char *wxStrrchr(const char *s, const wxUniCharRef& uc) + { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : NULL; } +inline const wchar_t *wxStrrchr(const wchar_t *s, const wxUniCharRef& c) + { return wxCRT_StrrchrW(s, (wchar_t)c); } +template<typename T> +inline const T* wxStrchr(const wxScopedCharTypeBuffer<T>& s, T c) + { return wxStrchr(s.data(), c); } +template<typename T> +inline const T* wxStrrchr(const wxScopedCharTypeBuffer<T>& s, T c) + { return wxStrrchr(s.data(), c); } +template<typename T> +inline const T* wxStrchr(const wxScopedCharTypeBuffer<T>& s, const wxUniChar& c) + { return wxStrchr(s.data(), (T)c); } +template<typename T> +inline const T* wxStrrchr(const wxScopedCharTypeBuffer<T>& s, const wxUniChar& c) + { return wxStrrchr(s.data(), (T)c); } +template<typename T> +inline const T* wxStrchr(const wxScopedCharTypeBuffer<T>& s, const wxUniCharRef& c) + { return wxStrchr(s.data(), (T)c); } +template<typename T> +inline const T* wxStrrchr(const wxScopedCharTypeBuffer<T>& s, const wxUniCharRef& c) + { return wxStrrchr(s.data(), (T)c); } +// these functions return char* pointer into the non-temporary conversion buffer +// used by c_str()'s implicit conversion to char*, for ANSI build compatibility +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline const char* wxStrchr(const wxString& s, char c) + { return wxCRT_StrchrA((const char*)s.c_str(), c); } +inline const char* wxStrrchr(const wxString& s, char c) + { return wxCRT_StrrchrA((const char*)s.c_str(), c); } +inline const char* wxStrchr(const wxString& s, int c) + { return wxCRT_StrchrA((const char*)s.c_str(), c); } +inline const char* wxStrrchr(const wxString& s, int c) + { return wxCRT_StrrchrA((const char*)s.c_str(), c); } +inline const char* wxStrchr(const wxString& s, const wxUniChar& uc) + { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s.c_str(), c) : NULL; } +inline const char* wxStrrchr(const wxString& s, const wxUniChar& uc) + { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s.c_str(), c) : NULL; } +inline const char* wxStrchr(const wxString& s, const wxUniCharRef& uc) + { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s.c_str(), c) : NULL; } +inline const char* wxStrrchr(const wxString& s, const wxUniCharRef& uc) + { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s.c_str(), c) : NULL; } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING +inline const wchar_t* wxStrchr(const wxString& s, wchar_t c) + { return wxCRT_StrchrW((const wchar_t*)s.c_str(), c); } +inline const wchar_t* wxStrrchr(const wxString& s, wchar_t c) + { return wxCRT_StrrchrW((const wchar_t*)s.c_str(), c); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline const char* wxStrchr(const wxCStrData& s, char c) + { return wxCRT_StrchrA(s.AsChar(), c); } +inline const char* wxStrrchr(const wxCStrData& s, char c) + { return wxCRT_StrrchrA(s.AsChar(), c); } +inline const char* wxStrchr(const wxCStrData& s, int c) + { return wxCRT_StrchrA(s.AsChar(), c); } +inline const char* wxStrrchr(const wxCStrData& s, int c) + { return wxCRT_StrrchrA(s.AsChar(), c); } +inline const char* wxStrchr(const wxCStrData& s, const wxUniChar& uc) + { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : NULL; } +inline const char* wxStrrchr(const wxCStrData& s, const wxUniChar& uc) + { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : NULL; } +inline const char* wxStrchr(const wxCStrData& s, const wxUniCharRef& uc) + { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : NULL; } +inline const char* wxStrrchr(const wxCStrData& s, const wxUniCharRef& uc) + { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : NULL; } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING +inline const wchar_t* wxStrchr(const wxCStrData& s, wchar_t c) + { return wxCRT_StrchrW(s.AsWChar(), c); } +inline const wchar_t* wxStrrchr(const wxCStrData& s, wchar_t c) + { return wxCRT_StrrchrW(s.AsWChar(), c); } + +inline const char *wxStrpbrk(const char *s, const char *accept) + { return wxCRT_StrpbrkA(s, accept); } +inline const wchar_t *wxStrpbrk(const wchar_t *s, const wchar_t *accept) + { return wxCRT_StrpbrkW(s, accept); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline const char *wxStrpbrk(const char *s, const wxString& accept) + { return wxCRT_StrpbrkA(s, accept.mb_str()); } +inline const char *wxStrpbrk(const char *s, const wxCStrData& accept) + { return wxCRT_StrpbrkA(s, accept.AsCharBuf()); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING +inline const wchar_t *wxStrpbrk(const wchar_t *s, const wxString& accept) + { return wxCRT_StrpbrkW(s, accept.wc_str()); } +inline const wchar_t *wxStrpbrk(const wchar_t *s, const wxCStrData& accept) + { return wxCRT_StrpbrkW(s, accept.AsWCharBuf()); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline const char *wxStrpbrk(const wxString& s, const wxString& accept) + { return wxCRT_StrpbrkA(s.c_str(), accept.mb_str()); } +inline const char *wxStrpbrk(const wxString& s, const char *accept) + { return wxCRT_StrpbrkA(s.c_str(), accept); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING +inline const wchar_t *wxStrpbrk(const wxString& s, const wchar_t *accept) + { return wxCRT_StrpbrkW(s.wc_str(), accept); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline const char *wxStrpbrk(const wxString& s, const wxCStrData& accept) + { return wxCRT_StrpbrkA(s.c_str(), accept.AsCharBuf()); } +inline const char *wxStrpbrk(const wxCStrData& s, const wxString& accept) + { return wxCRT_StrpbrkA(s.AsChar(), accept.mb_str()); } +inline const char *wxStrpbrk(const wxCStrData& s, const char *accept) + { return wxCRT_StrpbrkA(s.AsChar(), accept); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING +inline const wchar_t *wxStrpbrk(const wxCStrData& s, const wchar_t *accept) + { return wxCRT_StrpbrkW(s.AsWChar(), accept); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline const char *wxStrpbrk(const wxCStrData& s, const wxCStrData& accept) + { return wxCRT_StrpbrkA(s.AsChar(), accept.AsCharBuf()); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING +template <typename S, typename T> +inline const T *wxStrpbrk(const S& s, const wxScopedCharTypeBuffer<T>& accept) + { return wxStrpbrk(s, accept.data()); } + + +/* inlined non-const versions */ +template <typename T> +inline char *wxStrstr(char *haystack, T needle) + { return const_cast<char*>(wxStrstr(const_cast<const char*>(haystack), needle)); } +template <typename T> +inline wchar_t *wxStrstr(wchar_t *haystack, T needle) + { return const_cast<wchar_t*>(wxStrstr(const_cast<const wchar_t*>(haystack), needle)); } + +template <typename T> +inline char * wxStrchr(char *s, T c) + { return const_cast<char*>(wxStrchr(const_cast<const char*>(s), c)); } +template <typename T> +inline wchar_t * wxStrchr(wchar_t *s, T c) + { return const_cast<wchar_t*>(wxStrchr(const_cast<const wchar_t*>(s), c)); } +template <typename T> +inline char * wxStrrchr(char *s, T c) + { return const_cast<char*>(wxStrrchr(const_cast<const char*>(s), c)); } +template <typename T> +inline wchar_t * wxStrrchr(wchar_t *s, T c) + { return const_cast<wchar_t*>(wxStrrchr(const_cast<const wchar_t*>(s), c)); } + +template <typename T> +inline char * wxStrpbrk(char *s, T accept) + { return const_cast<char*>(wxStrpbrk(const_cast<const char*>(s), accept)); } +template <typename T> +inline wchar_t * wxStrpbrk(wchar_t *s, T accept) + { return const_cast<wchar_t*>(wxStrpbrk(const_cast<const wchar_t*>(s), accept)); } + + +// ---------------------------------------------------------------------------- +// stdio.h functions +// ---------------------------------------------------------------------------- + +// NB: using fn_str() for mode is a hack to get the same type (char*/wchar_t*) +// as needed, the conversion itself doesn't matter, it's ASCII +inline FILE *wxFopen(const wxString& path, const wxString& mode) + { return wxCRT_Fopen(path.fn_str(), mode.fn_str()); } +inline FILE *wxFreopen(const wxString& path, const wxString& mode, FILE *stream) + { return wxCRT_Freopen(path.fn_str(), mode.fn_str(), stream); } +inline int wxRemove(const wxString& path) + { return wxCRT_Remove(path.fn_str()); } +inline int wxRename(const wxString& oldpath, const wxString& newpath) + { return wxCRT_Rename(oldpath.fn_str(), newpath.fn_str()); } + +extern WXDLLIMPEXP_BASE int wxPuts(const wxString& s); +extern WXDLLIMPEXP_BASE int wxFputs(const wxString& s, FILE *stream); +extern WXDLLIMPEXP_BASE void wxPerror(const wxString& s); + +extern WXDLLIMPEXP_BASE int wxFputc(const wxUniChar& c, FILE *stream); + +#define wxPutc(c, stream) wxFputc(c, stream) +#define wxPutchar(c) wxFputc(c, stdout) +#define wxFputchar(c) wxPutchar(c) + +// NB: We only provide ANSI version of fgets() because fgetws() interprets the +// stream according to current locale, which is rarely what is desired. +inline char *wxFgets(char *s, int size, FILE *stream) + { return wxCRT_FgetsA(s, size, stream); } +// This version calls ANSI version and converts the string using wxConvLibc +extern WXDLLIMPEXP_BASE wchar_t *wxFgets(wchar_t *s, int size, FILE *stream); + +#define wxGets(s) wxGets_is_insecure_and_dangerous_use_wxFgets_instead + +// NB: We only provide ANSI versions of this for the same reasons as in the +// case of wxFgets() above +inline int wxFgetc(FILE *stream) { return wxCRT_FgetcA(stream); } +inline int wxUngetc(int c, FILE *stream) { return wxCRT_UngetcA(c, stream); } + +#define wxGetc(stream) wxFgetc(stream) +#define wxGetchar() wxFgetc(stdin) +#define wxFgetchar() wxGetchar() + +// ---------------------------------------------------------------------------- +// stdlib.h functions +// +// We only use wxConvLibc here because if the string is non-ASCII, +// then it's fine for the conversion to yield empty string, as atoi() +// will return 0 for it, which is the correct thing to do in this +// case. +// ---------------------------------------------------------------------------- + +#ifdef wxCRT_AtoiW +inline int wxAtoi(const wxString& str) { return wxCRT_AtoiW(str.wc_str()); } +#else +inline int wxAtoi(const wxString& str) { return wxCRT_AtoiA(str.mb_str(wxConvLibc)); } +#endif + +#ifdef wxCRT_AtolW +inline long wxAtol(const wxString& str) { return wxCRT_AtolW(str.wc_str()); } +#else +inline long wxAtol(const wxString& str) { return wxCRT_AtolA(str.mb_str(wxConvLibc)); } +#endif + +#ifdef wxCRT_AtofW +inline double wxAtof(const wxString& str) { return wxCRT_AtofW(str.wc_str()); } +#else +inline double wxAtof(const wxString& str) { return wxCRT_AtofA(str.mb_str(wxConvLibc)); } +#endif + +inline double wxStrtod(const char *nptr, char **endptr) + { return wxCRT_StrtodA(nptr, endptr); } +inline double wxStrtod(const wchar_t *nptr, wchar_t **endptr) + { return wxCRT_StrtodW(nptr, endptr); } +template<typename T> +inline double wxStrtod(const wxScopedCharTypeBuffer<T>& nptr, T **endptr) + { return wxStrtod(nptr.data(), endptr); } + +// We implement wxStrto*() like this so that the code compiles when NULL is +// passed in - - if we had just char** and wchar_t** overloads for 'endptr', it +// would be ambiguous. The solution is to use a template so that endptr can be +// any type: when NULL constant is used, the type will be int and we can handle +// that case specially. Otherwise, we infer the type that 'nptr' should be +// converted to from the type of 'endptr'. We need wxStrtoxCharType<T> template +// to make the code compile even for T=int (that's the case when it's not going +// to be ever used, but it still has to compile). +template<typename T> struct wxStrtoxCharType {}; +template<> struct wxStrtoxCharType<char**> +{ + typedef const char* Type; + static char** AsPointer(char **p) { return p; } +}; +template<> struct wxStrtoxCharType<wchar_t**> +{ + typedef const wchar_t* Type; + static wchar_t** AsPointer(wchar_t **p) { return p; } +}; +template<> struct wxStrtoxCharType<int> +{ + typedef const char* Type; /* this one is never used */ + static char** AsPointer(int WXUNUSED_UNLESS_DEBUG(p)) + { + wxASSERT_MSG( p == 0, "passing non-NULL int is invalid" ); + return NULL; + } +}; + +template<typename T> +inline double wxStrtod(const wxString& nptr, T endptr) +{ + if (!endptr) + { + // when we don't care about endptr, use the string representation that + // doesn't require any conversion (it doesn't matter for this function + // even if its UTF-8): + wxStringCharType** p = NULL; + return wxStrtod(nptr.wx_str(), p); + } + // note that it is important to use c_str() here and not mb_str() or + // wc_str(), because we store the pointer into (possibly converted) + // buffer in endptr and so it must be valid even when wxStrtod() returns + typedef typename wxStrtoxCharType<T>::Type CharType; + return wxStrtod((CharType)nptr.c_str(), + wxStrtoxCharType<T>::AsPointer(endptr)); +} +template<typename T> +inline double wxStrtod(const wxCStrData& nptr, T endptr) + { return wxStrtod(nptr.AsString(), endptr); } + +#ifdef wxHAS_NULLPTR_T + +inline double wxStrtod(const wxString& nptr, std::nullptr_t) + { return wxStrtod(nptr.wx_str(), static_cast<wxStringCharType**>(NULL)); } +inline double wxStrtod(const wxCStrData& nptr, std::nullptr_t) + { return wxStrtod(nptr.AsString(), static_cast<wxStringCharType**>(NULL)); } + +#define WX_STRTOX_DEFINE_NULLPTR_OVERLOADS(rettype, name) \ + inline rettype name(const wxString& nptr, std::nullptr_t, int base) \ + { return name(nptr.wx_str(), static_cast<wxStringCharType**>(NULL), \ + base); } \ + inline rettype name(const wxCStrData& nptr, std::nullptr_t, int base) \ + { return name(nptr.AsString(), static_cast<wxStringCharType**>(NULL), \ + base); } + +#else // !wxHAS_NULLPTR_T +#define WX_STRTOX_DEFINE_NULLPTR_OVERLOADS(rettype, name) +#endif // wxHAS_NULLPTR_T/!wxHAS_NULLPTR_T + + +#define WX_STRTOX_FUNC(rettype, name, implA, implW) \ + /* see wxStrtod() above for explanation of this code: */ \ + inline rettype name(const char *nptr, char **endptr, int base) \ + { return implA(nptr, endptr, base); } \ + inline rettype name(const wchar_t *nptr, wchar_t **endptr, int base) \ + { return implW(nptr, endptr, base); } \ + template<typename T> \ + inline rettype name(const wxScopedCharTypeBuffer<T>& nptr, T **endptr, int)\ + { return name(nptr.data(), endptr); } \ + template<typename T> \ + inline rettype name(const wxString& nptr, T endptr, int base) \ + { \ + if (!endptr) \ + { \ + wxStringCharType** p = NULL; \ + return name(nptr.wx_str(), p, base); \ + } \ + typedef typename wxStrtoxCharType<T>::Type CharType; \ + return name((CharType)nptr.c_str(), \ + wxStrtoxCharType<T>::AsPointer(endptr), \ + base); \ + } \ + template<typename T> \ + inline rettype name(const wxCStrData& nptr, T endptr, int base) \ + { return name(nptr.AsString(), endptr, base); } \ + WX_STRTOX_DEFINE_NULLPTR_OVERLOADS(rettype, name) + +WX_STRTOX_FUNC(long, wxStrtol, wxCRT_StrtolA, wxCRT_StrtolW) +WX_STRTOX_FUNC(unsigned long, wxStrtoul, wxCRT_StrtoulA, wxCRT_StrtoulW) +#ifdef wxLongLong_t +WX_STRTOX_FUNC(wxLongLong_t, wxStrtoll, wxCRT_StrtollA, wxCRT_StrtollW) +WX_STRTOX_FUNC(wxULongLong_t, wxStrtoull, wxCRT_StrtoullA, wxCRT_StrtoullW) +#endif // wxLongLong_t + +#undef WX_STRTOX_FUNC + +// ios doesn't export system starting from iOS 11 anymore and usage was critical before +#if defined(__WXOSX__) && wxOSX_USE_IPHONE +#else +// mingw32 doesn't provide _tsystem() even though it provides other stdlib.h +// functions in their wide versions +#ifdef wxCRT_SystemW +inline int wxSystem(const wxString& str) { return wxCRT_SystemW(str.wc_str()); } +#elif !defined wxNO_IMPLICIT_WXSTRING_ENCODING +inline int wxSystem(const wxString& str) { return wxCRT_SystemA(str.mb_str()); } +#endif +#endif + +inline char* wxGetenv(const char *name) { return wxCRT_GetenvA(name); } +inline wchar_t* wxGetenv(const wchar_t *name) { return wxCRT_GetenvW(name); } +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline char* wxGetenv(const wxString& name) { return wxCRT_GetenvA(name.mb_str()); } +inline char* wxGetenv(const wxCStrData& name) { return wxCRT_GetenvA(name.AsCharBuf()); } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING +inline char* wxGetenv(const wxScopedCharBuffer& name) { return wxCRT_GetenvA(name.data()); } +inline wchar_t* wxGetenv(const wxScopedWCharBuffer& name) { return wxCRT_GetenvW(name.data()); } + +// ---------------------------------------------------------------------------- +// time.h functions +// ---------------------------------------------------------------------------- + +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +inline size_t wxStrftime(char *s, size_t max, + const wxString& format, const struct tm *tm) + { + wxGCC_ONLY_WARNING_SUPPRESS(format-nonliteral) + + return wxCRT_StrftimeA(s, max, format.mb_str(), tm); + + wxGCC_ONLY_WARNING_RESTORE(format-nonliteral) + } +#endif // wxNO_IMPLICIT_WXSTRING_ENCODING + +inline size_t wxStrftime(wchar_t *s, size_t max, + const wxString& format, const struct tm *tm) + { return wxCRT_StrftimeW(s, max, format.wc_str(), tm); } + +// NB: we can't provide both char* and wchar_t* versions for obvious reasons +// and returning wxString wouldn't work either (it would be immediately +// destroyed and if assigned to char*/wchar_t*, the pointer would be +// invalid), so we only keep ASCII version, because the returned value +// is always ASCII anyway +#define wxAsctime asctime +#define wxCtime ctime + + +// ---------------------------------------------------------------------------- +// ctype.h functions +// ---------------------------------------------------------------------------- + +// FIXME-UTF8: we'd be better off implementing these ourselves, as the CRT +// version is locale-dependent +// FIXME-UTF8: these don't work when EOF is passed in because of wxUniChar, +// is this OK or not? + +inline bool wxIsalnum(const wxUniChar& c) { return wxCRT_IsalnumW(c) != 0; } +inline bool wxIsalpha(const wxUniChar& c) { return wxCRT_IsalphaW(c) != 0; } +inline bool wxIscntrl(const wxUniChar& c) { return wxCRT_IscntrlW(c) != 0; } +inline bool wxIsdigit(const wxUniChar& c) { return wxCRT_IsdigitW(c) != 0; } +inline bool wxIsgraph(const wxUniChar& c) { return wxCRT_IsgraphW(c) != 0; } +inline bool wxIslower(const wxUniChar& c) { return wxCRT_IslowerW(c) != 0; } +inline bool wxIsprint(const wxUniChar& c) { return wxCRT_IsprintW(c) != 0; } +inline bool wxIspunct(const wxUniChar& c) { return wxCRT_IspunctW(c) != 0; } +inline bool wxIsspace(const wxUniChar& c) { return wxCRT_IsspaceW(c) != 0; } +inline bool wxIsupper(const wxUniChar& c) { return wxCRT_IsupperW(c) != 0; } +inline bool wxIsxdigit(const wxUniChar& c) { return wxCRT_IsxdigitW(c) != 0; } + +inline wxUniChar wxTolower(const wxUniChar& c) { return wxCRT_TolowerW(c); } +inline wxUniChar wxToupper(const wxUniChar& c) { return wxCRT_ToupperW(c); } + +#if WXWIN_COMPATIBILITY_2_8 +// we had goofed and defined wxIsctrl() instead of (correct) wxIscntrl() in the +// initial versions of this header -- now it is too late to remove it so +// although we fixed the function/macro name above, still provide the +// backwards-compatible synonym. +wxDEPRECATED( inline int wxIsctrl(const wxUniChar& c) ); +inline int wxIsctrl(const wxUniChar& c) { return wxIscntrl(c); } +#endif // WXWIN_COMPATIBILITY_2_8 + +inline bool wxIsascii(const wxUniChar& c) { return c.IsAscii(); } + +#endif /* _WX_WXCRT_H_ */ diff --git a/lib/wxWidgets/include/wx/wxcrtbase.h b/lib/wxWidgets/include/wx/wxcrtbase.h new file mode 100644 index 0000000..7887324 --- /dev/null +++ b/lib/wxWidgets/include/wx/wxcrtbase.h @@ -0,0 +1,672 @@ +/* + * Name: wx/wxcrtbase.h + * Purpose: Type-safe ANSI and Unicode builds compatible wrappers for + * CRT functions + * Author: Joel Farley, Ove Kaaven + * 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_WXCRTBASE_H_ +#define _WX_WXCRTBASE_H_ + +/* ------------------------------------------------------------------------- + headers and missing declarations + ------------------------------------------------------------------------- */ + +#include "wx/chartype.h" + +/* + Standard headers we need here. + + NB: don't include any wxWidgets headers here because almost all of them + include this one! + + NB2: User code should include wx/crt.h instead of including this + header directly. + + */ + +#include <stdio.h> +#include <string.h> +#include <ctype.h> +#include <wctype.h> +#include <time.h> + +#if defined(__WINDOWS__) + #include <io.h> +#endif + +#if defined(HAVE_STRTOK_R) && defined(__DARWIN__) && defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS + char *strtok_r(char *, const char *, char **); +#endif + +/* + Traditional MinGW doesn't declare isascii() in strict ANSI mode and we can't + declare it here ourselves as it's an inline function, so use our own + replacement instead. + */ +#ifndef isascii + #if defined(wxNEEDS_STRICT_ANSI_WORKAROUNDS) + #define wxNEED_ISASCII + #endif +#endif /* isascii */ + +#ifdef wxNEED_ISASCII + inline int isascii(int c) { return (unsigned)c < 0x80; } + + // Avoid further (re)definitions of it. + #define isascii isascii +#endif + +/* string.h functions */ + +#ifdef wxNEED_STRDUP + WXDLLIMPEXP_BASE char *strdup(const char* s); +#endif + + +/* ------------------------------------------------------------------------- + UTF-8 locale handling + ------------------------------------------------------------------------- */ + +#ifdef __cplusplus + /* flag indicating whether the current locale uses UTF-8 or not; must be + updated every time the locale is changed! */ + #if wxUSE_UTF8_LOCALE_ONLY + #define wxLocaleIsUtf8 true + #else + extern WXDLLIMPEXP_BASE bool wxLocaleIsUtf8; + #endif + /* function used to update the flag: */ + extern WXDLLIMPEXP_BASE void wxUpdateLocaleIsUtf8(); +#endif /* __cplusplus */ + + +/* ------------------------------------------------------------------------- + string.h + ------------------------------------------------------------------------- */ + +#define wxCRT_StrcatA strcat +#define wxCRT_StrchrA strchr +#define wxCRT_StrcmpA strcmp +#define wxCRT_StrcpyA strcpy +#define wxCRT_StrcspnA strcspn +#define wxCRT_StrlenA strlen +#define wxCRT_StrncatA strncat +#define wxCRT_StrncmpA strncmp +#define wxCRT_StrncpyA strncpy +#define wxCRT_StrpbrkA strpbrk +#define wxCRT_StrrchrA strrchr +#define wxCRT_StrspnA strspn +#define wxCRT_StrstrA strstr + +#define wxCRT_StrcatW wcscat +#define wxCRT_StrchrW wcschr +#define wxCRT_StrcmpW wcscmp +#define wxCRT_StrcpyW wcscpy +#define wxCRT_StrcspnW wcscspn +#define wxCRT_StrncatW wcsncat +#define wxCRT_StrncmpW wcsncmp +#define wxCRT_StrncpyW wcsncpy +#define wxCRT_StrpbrkW wcspbrk +#define wxCRT_StrrchrW wcsrchr +#define wxCRT_StrspnW wcsspn +#define wxCRT_StrstrW wcsstr + +#define wxCRT_StrcollA strcoll +#define wxCRT_StrxfrmA strxfrm + +#define wxCRT_StrcollW wcscoll +#define wxCRT_StrxfrmW wcsxfrm + +/* Almost all compilers have strdup(), but VC++ and MinGW call it _strdup(). + And we need to declare it manually for MinGW in strict ANSI mode. */ +#if (defined(__VISUALC__) && __VISUALC__ >= 1400) + #define wxCRT_StrdupA _strdup +#elif defined(__MINGW32__) + wxDECL_FOR_STRICT_MINGW32(char*, _strdup, (const char *)) + #define wxCRT_StrdupA _strdup +#else + #define wxCRT_StrdupA strdup +#endif + +/* Windows compilers provide _wcsdup() except for (old) Cygwin */ +#if defined(__WINDOWS__) && !defined(__CYGWIN__) + wxDECL_FOR_STRICT_MINGW32(wchar_t*, _wcsdup, (const wchar_t*)) + #define wxCRT_StrdupW _wcsdup +#elif defined(HAVE_WCSDUP) + #define wxCRT_StrdupW wcsdup +#endif + +#ifdef wxHAVE_TCHAR_SUPPORT + /* we surely have wchar_t if we have TCHAR have wcslen() */ + #ifndef HAVE_WCSLEN + #define HAVE_WCSLEN + #endif +#endif /* wxHAVE_TCHAR_SUPPORT */ + +#ifdef HAVE_WCSLEN + #define wxCRT_StrlenW wcslen +#endif + +#define wxCRT_StrtodA strtod +#define wxCRT_StrtolA strtol +#define wxCRT_StrtoulA strtoul + +#ifdef __ANDROID__ // these functions are broken on android + +extern double android_wcstod(const wchar_t *nptr, wchar_t **endptr); +extern long android_wcstol(const wchar_t *nptr, wchar_t **endptr, int base); +extern unsigned long android_wcstoul(const wchar_t *nptr, wchar_t **endptr, int base); + +#define wxCRT_StrtodW android_wcstod +#define wxCRT_StrtolW android_wcstol +#define wxCRT_StrtoulW android_wcstoul +#else +#define wxCRT_StrtodW wcstod +#define wxCRT_StrtolW wcstol +#define wxCRT_StrtoulW wcstoul +#endif + +#ifdef __VISUALC__ + #define wxCRT_StrtollA _strtoi64 + #define wxCRT_StrtoullA _strtoui64 + #define wxCRT_StrtollW _wcstoi64 + #define wxCRT_StrtoullW _wcstoui64 +#else + /* Both of these functions are implemented in C++11 compilers */ + #if wxCHECK_CXX_STD(201103L) + #ifndef HAVE_STRTOULL + #define HAVE_STRTOULL + #endif + #ifndef HAVE_WCSTOULL + #define HAVE_WCSTOULL + #endif + #endif + + #ifdef HAVE_STRTOULL + wxDECL_FOR_STRICT_MINGW32(long long, strtoll, (const char*, char**, int)) + wxDECL_FOR_STRICT_MINGW32(unsigned long long, strtoull, (const char*, char**, int)) + + #define wxCRT_StrtollA strtoll + #define wxCRT_StrtoullA strtoull + #endif /* HAVE_STRTOULL */ + #ifdef HAVE_WCSTOULL + /* assume that we have wcstoull(), which is also C99, too */ + #define wxCRT_StrtollW wcstoll + #define wxCRT_StrtoullW wcstoull + #endif /* HAVE_WCSTOULL */ +#endif + +/* + Only VC8 and later provide strnlen() and wcsnlen() functions under Windows. + */ +#if wxCHECK_VISUALC_VERSION(8) + #ifndef HAVE_STRNLEN + #define HAVE_STRNLEN + #endif + #ifndef HAVE_WCSNLEN + #define HAVE_WCSNLEN + #endif +#endif + +#ifdef HAVE_STRNLEN + #define wxCRT_StrnlenA strnlen +#endif + +#ifdef HAVE_WCSNLEN + /* + When using MinGW, wcsnlen() is not declared, but is still found by + configure -- just declare it in this case as it seems better to use it + if it's available (see https://sourceforge.net/p/mingw/bugs/2332/) + */ + wxDECL_FOR_MINGW32_ALWAYS(size_t, wcsnlen, (const wchar_t*, size_t)) + + #define wxCRT_StrnlenW wcsnlen +#endif + +/* define wxCRT_StricmpA/W and wxCRT_StrnicmpA/W for various compilers */ +#if defined(__VISUALC__) || defined(__MINGW32__) + /* + Due to MinGW 5.3 bug (https://sourceforge.net/p/mingw/bugs/2322/), + _stricmp() and _strnicmp() are not declared in its standard headers + when compiling without optimizations. Work around this by always + declaring them ourselves (notice that if/when this bug were fixed, we'd + still need to use wxDECL_FOR_STRICT_MINGW32() for them here. + */ + wxDECL_FOR_MINGW32_ALWAYS(int, _stricmp, (const char*, const char*)) + wxDECL_FOR_MINGW32_ALWAYS(int, _strnicmp, (const char*, const char*, size_t)) + + #define wxCRT_StricmpA _stricmp + #define wxCRT_StrnicmpA _strnicmp +#elif defined(__UNIX__) + #define wxCRT_StricmpA strcasecmp + #define wxCRT_StrnicmpA strncasecmp +/* #else -- use wxWidgets implementation */ +#endif + +#ifdef __VISUALC__ + #define wxCRT_StricmpW _wcsicmp + #define wxCRT_StrnicmpW _wcsnicmp +#elif defined(__UNIX__) + #ifdef HAVE_WCSCASECMP + #define wxCRT_StricmpW wcscasecmp + #endif + #ifdef HAVE_WCSNCASECMP + #define wxCRT_StrnicmpW wcsncasecmp + #endif +/* #else -- use wxWidgets implementation */ +#endif + +#ifdef HAVE_STRTOK_R + #define wxCRT_StrtokA(str, sep, last) strtok_r(str, sep, last) +#endif +/* FIXME-UTF8: detect and use wcstok() if available for wxCRT_StrtokW */ + +/* these are extern "C" because they are used by regex lib: */ +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef wxCRT_StrlenW +WXDLLIMPEXP_BASE size_t wxCRT_StrlenW(const wchar_t *s); +#endif + +#ifndef wxCRT_StrncmpW +WXDLLIMPEXP_BASE int wxCRT_StrncmpW(const wchar_t *s1, const wchar_t *s2, size_t n); +#endif + +#ifdef __cplusplus +} +#endif + +/* FIXME-UTF8: remove this once we are Unicode only */ +#if wxUSE_UNICODE + #define wxCRT_StrlenNative wxCRT_StrlenW + #define wxCRT_StrncmpNative wxCRT_StrncmpW + #define wxCRT_ToupperNative wxCRT_ToupperW + #define wxCRT_TolowerNative wxCRT_TolowerW +#else + #define wxCRT_StrlenNative wxCRT_StrlenA + #define wxCRT_StrncmpNative wxCRT_StrncmpA + #define wxCRT_ToupperNative toupper + #define wxCRT_TolowerNative tolower +#endif + +#ifndef wxCRT_StrcatW +WXDLLIMPEXP_BASE wchar_t *wxCRT_StrcatW(wchar_t *dest, const wchar_t *src); +#endif + +#ifndef wxCRT_StrchrW +WXDLLIMPEXP_BASE const wchar_t *wxCRT_StrchrW(const wchar_t *s, wchar_t c); +#endif + +#ifndef wxCRT_StrcmpW +WXDLLIMPEXP_BASE int wxCRT_StrcmpW(const wchar_t *s1, const wchar_t *s2); +#endif + +#ifndef wxCRT_StrcollW +WXDLLIMPEXP_BASE int wxCRT_StrcollW(const wchar_t *s1, const wchar_t *s2); +#endif + +#ifndef wxCRT_StrcpyW +WXDLLIMPEXP_BASE wchar_t *wxCRT_StrcpyW(wchar_t *dest, const wchar_t *src); +#endif + +#ifndef wxCRT_StrcspnW +WXDLLIMPEXP_BASE size_t wxCRT_StrcspnW(const wchar_t *s, const wchar_t *reject); +#endif + +#ifndef wxCRT_StrncatW +WXDLLIMPEXP_BASE wchar_t *wxCRT_StrncatW(wchar_t *dest, const wchar_t *src, size_t n); +#endif + +#ifndef wxCRT_StrncpyW +WXDLLIMPEXP_BASE wchar_t *wxCRT_StrncpyW(wchar_t *dest, const wchar_t *src, size_t n); +#endif + +#ifndef wxCRT_StrpbrkW +WXDLLIMPEXP_BASE const wchar_t *wxCRT_StrpbrkW(const wchar_t *s, const wchar_t *accept); +#endif + +#ifndef wxCRT_StrrchrW +WXDLLIMPEXP_BASE const wchar_t *wxCRT_StrrchrW(const wchar_t *s, wchar_t c); +#endif + +#ifndef wxCRT_StrspnW +WXDLLIMPEXP_BASE size_t wxCRT_StrspnW(const wchar_t *s, const wchar_t *accept); +#endif + +#ifndef wxCRT_StrstrW +WXDLLIMPEXP_BASE const wchar_t *wxCRT_StrstrW(const wchar_t *haystack, const wchar_t *needle); +#endif + +#ifndef wxCRT_StrtodW +WXDLLIMPEXP_BASE double wxCRT_StrtodW(const wchar_t *nptr, wchar_t **endptr); +#endif + +#ifndef wxCRT_StrtolW +WXDLLIMPEXP_BASE long int wxCRT_StrtolW(const wchar_t *nptr, wchar_t **endptr, int base); +#endif + +#ifndef wxCRT_StrtoulW +WXDLLIMPEXP_BASE unsigned long int wxCRT_StrtoulW(const wchar_t *nptr, wchar_t **endptr, int base); +#endif + +#ifndef wxCRT_StrxfrmW +WXDLLIMPEXP_BASE size_t wxCRT_StrxfrmW(wchar_t *dest, const wchar_t *src, size_t n); +#endif + +#ifndef wxCRT_StrdupA +WXDLLIMPEXP_BASE char *wxCRT_StrdupA(const char *psz); +#endif + +#ifndef wxCRT_StrdupW +WXDLLIMPEXP_BASE wchar_t *wxCRT_StrdupW(const wchar_t *pwz); +#endif + +#ifndef wxCRT_StricmpA +WXDLLIMPEXP_BASE int wxCRT_StricmpA(const char *psz1, const char *psz2); +#endif + +#ifndef wxCRT_StricmpW +WXDLLIMPEXP_BASE int wxCRT_StricmpW(const wchar_t *psz1, const wchar_t *psz2); +#endif + +#ifndef wxCRT_StrnicmpA +WXDLLIMPEXP_BASE int wxCRT_StrnicmpA(const char *psz1, const char *psz2, size_t len); +#endif + +#ifndef wxCRT_StrnicmpW +WXDLLIMPEXP_BASE int wxCRT_StrnicmpW(const wchar_t *psz1, const wchar_t *psz2, size_t len); +#endif + +#ifndef wxCRT_StrtokA +WXDLLIMPEXP_BASE char *wxCRT_StrtokA(char *psz, const char *delim, char **save_ptr); +#endif + +#ifndef wxCRT_StrtokW +WXDLLIMPEXP_BASE wchar_t *wxCRT_StrtokW(wchar_t *psz, const wchar_t *delim, wchar_t **save_ptr); +#endif + +/* supply strtoll and strtoull, if needed */ +#ifdef wxLongLong_t + #ifndef wxCRT_StrtollA + WXDLLIMPEXP_BASE wxLongLong_t wxCRT_StrtollA(const char* nptr, + char** endptr, + int base); + WXDLLIMPEXP_BASE wxULongLong_t wxCRT_StrtoullA(const char* nptr, + char** endptr, + int base); + #endif + #ifndef wxCRT_StrtollW + WXDLLIMPEXP_BASE wxLongLong_t wxCRT_StrtollW(const wchar_t* nptr, + wchar_t** endptr, + int base); + WXDLLIMPEXP_BASE wxULongLong_t wxCRT_StrtoullW(const wchar_t* nptr, + wchar_t** endptr, + int base); + #endif +#endif /* wxLongLong_t */ + + +/* ------------------------------------------------------------------------- + stdio.h + ------------------------------------------------------------------------- */ + +#if defined(__UNIX__) || defined(__WXMAC__) + #define wxMBFILES 1 +#else + #define wxMBFILES 0 +#endif + + +/* these functions are only needed in the form used for filenames (i.e. char* + on Unix, wchar_t* on Windows), so we don't need to use A/W suffix: */ +#if wxMBFILES || !wxUSE_UNICODE /* ANSI filenames */ + + #define wxCRT_Fopen fopen + #define wxCRT_Freopen freopen + #define wxCRT_Remove remove + #define wxCRT_Rename rename + +#else /* Unicode filenames */ + wxDECL_FOR_STRICT_MINGW32(FILE*, _wfopen, (const wchar_t*, const wchar_t*)) + wxDECL_FOR_STRICT_MINGW32(FILE*, _wfreopen, (const wchar_t*, const wchar_t*, FILE*)) + wxDECL_FOR_STRICT_MINGW32(int, _wrename, (const wchar_t*, const wchar_t*)) + wxDECL_FOR_STRICT_MINGW32(int, _wremove, (const wchar_t*)) + + #define wxCRT_Rename _wrename + #define wxCRT_Remove _wremove + #define wxCRT_Fopen _wfopen + #define wxCRT_Freopen _wfreopen + +#endif /* wxMBFILES/!wxMBFILES */ + +#define wxCRT_PutsA puts +#define wxCRT_FputsA fputs +#define wxCRT_FgetsA fgets +#define wxCRT_FputcA fputc +#define wxCRT_FgetcA fgetc +#define wxCRT_UngetcA ungetc + +#ifdef wxHAVE_TCHAR_SUPPORT + #define wxCRT_PutsW _putws + #define wxCRT_FputsW fputws + #define wxCRT_FputcW fputwc +#endif +#ifdef HAVE_FPUTWS + #define wxCRT_FputsW fputws +#endif +#ifdef HAVE_PUTWS + #define wxCRT_PutsW putws +#endif +#ifdef HAVE_FPUTWC + #define wxCRT_FputcW fputwc +#endif +#define wxCRT_FgetsW fgetws + +#ifndef wxCRT_PutsW +WXDLLIMPEXP_BASE int wxCRT_PutsW(const wchar_t *ws); +#endif + +#ifndef wxCRT_FputsW +WXDLLIMPEXP_BASE int wxCRT_FputsW(const wchar_t *ch, FILE *stream); +#endif + +#ifndef wxCRT_FputcW +WXDLLIMPEXP_BASE int wxCRT_FputcW(wchar_t wc, FILE *stream); +#endif + +/* + NB: tmpnam() is unsafe and thus is not wrapped! + Use other wxWidgets facilities instead: + wxFileName::CreateTempFileName, wxTempFile, or wxTempFileOutputStream +*/ +#define wxTmpnam(x) wxTmpnam_is_insecure_use_wxTempFile_instead + +#define wxCRT_PerrorA perror +#ifdef wxHAVE_TCHAR_SUPPORT + #define wxCRT_PerrorW _wperror +#endif + +/* ------------------------------------------------------------------------- + stdlib.h + ------------------------------------------------------------------------- */ + +#define wxCRT_GetenvA getenv +#ifdef wxHAVE_TCHAR_SUPPORT + #define wxCRT_GetenvW _wgetenv +#endif + +#ifndef wxCRT_GetenvW +WXDLLIMPEXP_BASE wchar_t * wxCRT_GetenvW(const wchar_t *name); +#endif + + +#define wxCRT_SystemA system +#ifdef wxHAVE_TCHAR_SUPPORT + #define wxCRT_SystemW _wsystem +#endif + +#define wxCRT_AtofA atof +#define wxCRT_AtoiA atoi +#define wxCRT_AtolA atol + +#if defined(wxHAVE_TCHAR_SUPPORT) + wxDECL_FOR_STRICT_MINGW32(int, _wtoi, (const wchar_t*)) + wxDECL_FOR_STRICT_MINGW32(long, _wtol, (const wchar_t*)) + + #define wxCRT_AtoiW _wtoi + #define wxCRT_AtolW _wtol + /* _wtof doesn't exist */ +#else +#ifndef __VMS + #define wxCRT_AtofW(s) wcstod(s, NULL) +#endif + #define wxCRT_AtolW(s) wcstol(s, NULL, 10) + /* wcstoi doesn't exist */ +#endif + +/* ------------------------------------------------------------------------- + time.h + ------------------------------------------------------------------------- */ + +#define wxCRT_StrftimeA strftime +#ifdef __SGI__ + /* + IRIX provides not one but two versions of wcsftime(): XPG4 one which + uses "const char*" for the third parameter and so can't be used and the + correct, XPG5, one. Unfortunately we can't just define _XOPEN_SOURCE + high enough to get XPG5 version as this undefines other symbols which + make other functions we use unavailable (see <standards.h> for gory + details). So just declare the XPG5 version ourselves, we're extremely + unlikely to ever be compiled on a system without it. But if we ever do, + a configure test would need to be added for it (and _MIPS_SYMBOL_PRESENT + should be used to check for its presence during run-time, i.e. it would + probably be simpler to just always use our own wxCRT_StrftimeW() below + if it does ever become a problem). + */ +#ifdef __cplusplus + extern "C" +#endif + size_t + _xpg5_wcsftime(wchar_t *, size_t, const wchar_t *, const struct tm * ); + #define wxCRT_StrftimeW _xpg5_wcsftime +#else + /* + Assume it's always available under non-Unix systems as this does seem + to be the case for now. And under Unix we trust configure to detect it + (except for SGI special case above). + */ + #if defined(HAVE_WCSFTIME) || !defined(__UNIX__) + #define wxCRT_StrftimeW wcsftime + #endif +#endif + +#ifndef wxCRT_StrftimeW +WXDLLIMPEXP_BASE size_t wxCRT_StrftimeW(wchar_t *s, size_t max, + const wchar_t *fmt, + const struct tm *tm); +#endif + + + +/* ------------------------------------------------------------------------- + ctype.h + ------------------------------------------------------------------------- */ + +#define wxCRT_IsalnumW(c) iswalnum(c) +#define wxCRT_IsalphaW(c) iswalpha(c) +#define wxCRT_IscntrlW(c) iswcntrl(c) +#define wxCRT_IsdigitW(c) iswdigit(c) +#define wxCRT_IsgraphW(c) iswgraph(c) +#define wxCRT_IslowerW(c) iswlower(c) +#define wxCRT_IsprintW(c) iswprint(c) +#define wxCRT_IspunctW(c) iswpunct(c) +#define wxCRT_IsspaceW(c) iswspace(c) +#define wxCRT_IsupperW(c) iswupper(c) +#define wxCRT_IsxdigitW(c) iswxdigit(c) + +#ifdef __GLIBC__ + #if (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0) + /* /usr/include/wctype.h incorrectly declares translations */ + /* tables which provokes tons of compile-time warnings -- try */ + /* to correct this */ + #define wxCRT_TolowerW(wc) towctrans((wc), (wctrans_t)__ctype_tolower) + #define wxCRT_ToupperW(wc) towctrans((wc), (wctrans_t)__ctype_toupper) + #else /* !glibc 2.0 */ + #define wxCRT_TolowerW towlower + #define wxCRT_ToupperW towupper + #endif +#else /* !__GLIBC__ */ + /* There is a bug in MSVC RTL: toxxx() functions don't do anything + with signed chars < 0, so "fix" it here. */ + #define wxCRT_TolowerW(c) towlower((wxUChar)(wxChar)(c)) + #define wxCRT_ToupperW(c) towupper((wxUChar)(wxChar)(c)) +#endif /* __GLIBC__/!__GLIBC__ */ + +/* The Android platform, as of 2014, only support most wide-char function with + the exception of multi-byte encoding/decoding functions & wsprintf/wsscanf + See android-ndk-r9d/docs/STANDALONE-TOOLCHAIN.html (section 7.2) + In fact, mbstowcs/wcstombs are defined and compile, but don't work correctly +*/ + +#if defined(__WXQT__) && defined(__ANDROID__) + #define wxNEED_WX_MBSTOWCS + #undef HAVE_WCSRTOMBS + // TODO: use Qt built-in required functionality +#endif + +#if defined(wxNEED_WX_MBSTOWCS) && defined(__ANDROID__) + #warning "Custom mb/wchar conv. only works for ASCII, see Android NDK notes" + WXDLLIMPEXP_BASE size_t android_mbstowcs(wchar_t *, const char *, size_t); + WXDLLIMPEXP_BASE size_t android_wcstombs(char *, const wchar_t *, size_t); + #define wxMbstowcs android_mbstowcs + #define wxWcstombs android_wcstombs +#else + #define wxMbstowcs mbstowcs + #define wxWcstombs wcstombs +#endif + + +/* ------------------------------------------------------------------------- + wx wrappers for CRT functions in both char* and wchar_t* versions + ------------------------------------------------------------------------- */ + +#ifdef __cplusplus + +/* NB: this belongs to wxcrt.h and not this header, but it makes life easier + * for buffer.h and stringimpl.h (both of which must be included before + * string.h, which is required by wxcrt.h) to have them here: */ + +/* safe version of strlen() (returns 0 if passed NULL pointer) */ +inline size_t wxStrlen(const char *s) { return s ? wxCRT_StrlenA(s) : 0; } +inline size_t wxStrlen(const wchar_t *s) { return s ? wxCRT_StrlenW(s) : 0; } +#ifndef wxWCHAR_T_IS_WXCHAR16 + WXDLLIMPEXP_BASE size_t wxStrlen(const wxChar16 *s ); +#endif +#ifndef wxWCHAR_T_IS_WXCHAR32 + WXDLLIMPEXP_BASE size_t wxStrlen(const wxChar32 *s ); +#endif +#define wxWcslen wxCRT_StrlenW + +#define wxStrdupA wxCRT_StrdupA +#define wxStrdupW wxCRT_StrdupW +inline char* wxStrdup(const char *s) { return wxCRT_StrdupA(s); } +inline wchar_t* wxStrdup(const wchar_t *s) { return wxCRT_StrdupW(s); } +#ifndef wxWCHAR_T_IS_WXCHAR16 + WXDLLIMPEXP_BASE wxChar16* wxStrdup(const wxChar16* s); +#endif +#ifndef wxWCHAR_T_IS_WXCHAR32 + WXDLLIMPEXP_BASE wxChar32* wxStrdup(const wxChar32* s); +#endif + +#endif /* __cplusplus */ + +#endif /* _WX_WXCRTBASE_H_ */ diff --git a/lib/wxWidgets/include/wx/wxcrtvararg.h b/lib/wxWidgets/include/wx/wxcrtvararg.h new file mode 100644 index 0000000..b743bb7 --- /dev/null +++ b/lib/wxWidgets/include/wx/wxcrtvararg.h @@ -0,0 +1,451 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/wxcrtvararg.h +// Purpose: Type-safe ANSI and Unicode builds compatible wrappers for +// printf(), scanf() and related CRT functions +// Author: Joel Farley, Ove Kåven +// Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee +// Created: 2007-02-19 +// Copyright: (c) 2007 REA Elektronik GmbH +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WXCRTVARARG_H_ +#define _WX_WXCRTVARARG_H_ + +// NB: User code should include wx/crt.h instead of including this +// header directly. + +#include "wx/wxcrt.h" +#include "wx/strvararg.h" + +#include "wx/string.h" + +// ---------------------------------------------------------------------------- +// CRT functions aliases +// ---------------------------------------------------------------------------- + +/* Required for wxPrintf() etc */ +#include <stdarg.h> + +/* printf() family saga */ + +/* + For many old Unix systems [v]snprintf()/vsscanf() exists in the system + libraries but not in the headers, so we need to declare it ourselves to be + able to use it. + */ +#ifdef __UNIX__ + +/* Wrapper for vsnprintf if it's 3rd parameter is non-const. Note: the + * same isn't done for snprintf below, the builtin wxSnprintf_ is used + * instead since it's already a simple wrapper */ +#if defined __cplusplus && defined HAVE_BROKEN_VSNPRINTF_DECL + inline int wx_fixed_vsnprintf(char *str, size_t size, const char *format, va_list ap) + { + return vsnprintf(str, size, (char*)format, ap); + } +#endif + +#endif /* __UNIX__ */ + +/* + mingw32 normally uses MSVCRT which has non-standard vswprintf() and so + normally _vsnwprintf() is used instead, the only exception is when mingw32 + is used with STLPort which does have a standard vswprintf() starting from + version 5.1 which we can use. + */ +#ifdef __MINGW32__ + #if defined(_STLPORT_VERSION) && _STLPORT_VERSION >= 0x510 + #ifndef HAVE_VSWPRINTF + #define HAVE_VSWPRINTF + #endif + #elif defined(HAVE_VSWPRINTF) + /* can't use non-standard vswprintf() */ + #undef HAVE_VSWPRINTF + #endif +#endif /* __MINGW32__ */ + +#if wxUSE_PRINTF_POS_PARAMS + /* + The systems where vsnprintf() supports positional parameters should + define the HAVE_UNIX98_PRINTF symbol. + + On systems which don't (e.g. Windows) we are forced to use + our wxVsnprintf() implementation. + */ + #if defined(HAVE_UNIX98_PRINTF) + #ifdef HAVE_VSWPRINTF + #define wxCRT_VsnprintfW vswprintf + #endif + #ifdef HAVE_BROKEN_VSNPRINTF_DECL + #define wxCRT_VsnprintfA wx_fixed_vsnprintf + #else + #define wxCRT_VsnprintfA vsnprintf + #endif + #else /* !HAVE_UNIX98_PRINTF */ + /* + The only compiler with positional parameters support under Windows + is VC++ 8.0 which provides a new xxprintf_p() functions family. + The 2003 PSDK includes a slightly earlier version of VC8 than the + main release and does not have the printf_p functions. + */ + #if defined _MSC_FULL_VER && _MSC_FULL_VER >= 140050727 + #define wxCRT_VsnprintfA _vsprintf_p + #define wxCRT_VsnprintfW _vswprintf_p + #endif + #endif /* HAVE_UNIX98_PRINTF/!HAVE_UNIX98_PRINTF */ +#else /* !wxUSE_PRINTF_POS_PARAMS */ + /* + We always want to define safe snprintf() function to be used instead of + sprintf(). Some compilers already have it (or rather vsnprintf() which + we really need...), otherwise we implement it using our own printf() + code. + + We define function with a trailing underscore here because the real one + is a wrapper around it as explained below + */ + + #if defined(__VISUALC__) + #define wxCRT_VsnprintfA _vsnprintf + #define wxCRT_VsnprintfW _vsnwprintf + #else + #if defined(HAVE__VSNWPRINTF) + #define wxCRT_VsnprintfW _vsnwprintf + #elif defined(HAVE_VSWPRINTF) + #define wxCRT_VsnprintfW vswprintf + #endif + + #if defined(HAVE_VSNPRINTF) + #ifdef HAVE_BROKEN_VSNPRINTF_DECL + #define wxCRT_VsnprintfA wx_fixed_vsnprintf + #else + #define wxCRT_VsnprintfA vsnprintf + #endif + #endif + #endif +#endif /* wxUSE_PRINTF_POS_PARAMS/!wxUSE_PRINTF_POS_PARAMS */ + +#ifndef wxCRT_VsnprintfW + /* no (suitable) vsnprintf(), cook our own */ + WXDLLIMPEXP_BASE int + wxCRT_VsnprintfW(wchar_t *buf, size_t len, const wchar_t *format, va_list argptr); + #define wxUSE_WXVSNPRINTFW 1 +#else + #define wxUSE_WXVSNPRINTFW 0 +#endif + +#ifndef wxCRT_VsnprintfA + /* no (suitable) vsnprintf(), cook our own */ + WXDLLIMPEXP_BASE int + wxCRT_VsnprintfA(char *buf, size_t len, const char *format, va_list argptr); + #define wxUSE_WXVSNPRINTFA 1 +#else + #define wxUSE_WXVSNPRINTFA 0 +#endif + +// for wxString code, define wxUSE_WXVSNPRINTF to indicate that wx +// implementation is used no matter what (in UTF-8 build, either *A or *W +// version may be called): +#if !wxUSE_UNICODE + #define wxUSE_WXVSNPRINTF wxUSE_WXVSNPRINTFA +#elif wxUSE_UNICODE_WCHAR + #define wxUSE_WXVSNPRINTF wxUSE_WXVSNPRINTFW +#elif wxUSE_UTF8_LOCALE_ONLY + #define wxUSE_WXVSNPRINTF wxUSE_WXVSNPRINTFA +#else // UTF-8 under any locale + #define wxUSE_WXVSNPRINTF (wxUSE_WXVSNPRINTFA && wxUSE_WXVSNPRINTFW) +#endif + +#define wxCRT_FprintfA fprintf +#define wxCRT_PrintfA printf +#define wxCRT_VfprintfA vfprintf +#define wxCRT_VprintfA vprintf +#define wxCRT_VsprintfA vsprintf + +/* + In Unicode mode we need to have all standard functions such as wprintf() and + so on but not all systems have them so use our own implementations in this + case. + */ +#if !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_WPRINTF) + #define wxNEED_WPRINTF +#endif +#if !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_VSWSCANF) && defined(HAVE_VSSCANF) + #define wxNEED_VSWSCANF +#endif + + +#if defined(wxNEED_WPRINTF) + /* + we need to implement all wide character printf functions either because + we don't have them at all or because they don't have the semantics we + need + */ + int wxCRT_PrintfW( const wchar_t *format, ... ); + int wxCRT_FprintfW( FILE *stream, const wchar_t *format, ... ); + int wxCRT_VfprintfW( FILE *stream, const wchar_t *format, va_list ap ); + int wxCRT_VprintfW( const wchar_t *format, va_list ap ); + int wxCRT_VsprintfW( wchar_t *str, const wchar_t *format, va_list ap ); +#else /* !wxNEED_WPRINTF */ + #define wxCRT_FprintfW fwprintf + #define wxCRT_PrintfW wprintf + #define wxCRT_VfprintfW vfwprintf + #define wxCRT_VprintfW vwprintf + + #if defined(__WINDOWS__) && !defined(HAVE_VSWPRINTF) + // only non-standard vswprintf() without buffer size argument can be used here + #define wxCRT_VsprintfW vswprintf + #endif +#endif /* wxNEED_WPRINTF */ + + +/* Required for wxScanf() etc. */ +#define wxCRT_ScanfA scanf +#define wxCRT_SscanfA sscanf +#define wxCRT_FscanfA fscanf + +/* vsscanf() may have a wrong declaration with non-const first parameter, fix + * this by wrapping it if necessary. */ +#if defined __cplusplus && defined HAVE_BROKEN_VSSCANF_DECL + inline int wxCRT_VsscanfA(const char *str, const char *format, va_list ap) + { + return vsscanf(const_cast<char *>(str), format, ap); + } +#else + wxDECL_FOR_STRICT_MINGW32(int, vsscanf, (const char*, const char*, va_list)) + + #define wxCRT_VsscanfA vsscanf +#endif + +#if defined(wxNEED_WPRINTF) + int wxCRT_ScanfW(const wchar_t *format, ...); + int wxCRT_SscanfW(const wchar_t *str, const wchar_t *format, ...); + int wxCRT_FscanfW(FILE *stream, const wchar_t *format, ...); +#else + #define wxCRT_ScanfW wxVMS_USE_STD wscanf + #define wxCRT_SscanfW wxVMS_USE_STD swscanf + #define wxCRT_FscanfW wxVMS_USE_STD fwscanf +#endif +#ifdef wxNEED_VSWSCANF + int wxCRT_VsscanfW(const wchar_t *str, const wchar_t *format, va_list ap); +#else + wxDECL_FOR_STRICT_MINGW32(int, vswscanf, (const wchar_t*, const wchar_t*, va_list)) + + #define wxCRT_VsscanfW wxVMS_USE_STD vswscanf +#endif + +// ---------------------------------------------------------------------------- +// user-friendly wrappers to CRT functions +// ---------------------------------------------------------------------------- + + // FIXME-UTF8: remove this +#if wxUSE_UNICODE + #define wxCRT_PrintfNative wxCRT_PrintfW + #define wxCRT_FprintfNative wxCRT_FprintfW +#else + #define wxCRT_PrintfNative wxCRT_PrintfA + #define wxCRT_FprintfNative wxCRT_FprintfA +#endif + + +wxGCC_ONLY_WARNING_SUPPRESS(format-nonliteral) + +WX_DEFINE_VARARG_FUNC_SANS_N0(int, wxPrintf, 1, (const wxFormatString&), + wxCRT_PrintfNative, wxCRT_PrintfA) +inline int wxPrintf(const wxFormatString& s) +{ + return wxPrintf(wxASCII_STR("%s"), s.InputAsString()); +} + +WX_DEFINE_VARARG_FUNC_SANS_N0(int, wxFprintf, 2, (FILE*, const wxFormatString&), + wxCRT_FprintfNative, wxCRT_FprintfA) +inline int wxFprintf(FILE *f, const wxFormatString& s) +{ + return wxFprintf(f, wxASCII_STR("%s"), s.InputAsString()); +} + +wxGCC_ONLY_WARNING_RESTORE(format-nonliteral) + +// va_list versions of printf functions simply forward to the respective +// CRT function; note that they assume that va_list was created using +// wxArgNormalizer<T>! +#if wxUSE_UNICODE_UTF8 + #if wxUSE_UTF8_LOCALE_ONLY + #define WX_VARARG_VFOO_IMPL(args, implW, implA) \ + return implA args + #else + #define WX_VARARG_VFOO_IMPL(args, implW, implA) \ + if ( wxLocaleIsUtf8 ) return implA args; \ + else return implW args + #endif +#elif wxUSE_UNICODE_WCHAR + #define WX_VARARG_VFOO_IMPL(args, implW, implA) \ + return implW args +#else // ANSI + #define WX_VARARG_VFOO_IMPL(args, implW, implA) \ + return implA args +#endif + +// In non-Unicode build we get suggestions for using gnu_printf format +// attribute, but it doesn't work in Unicode build, so don't bother with it and +// just disable the warning. +wxGCC_ONLY_WARNING_SUPPRESS(suggest-attribute=format) + +inline int +wxVprintf(const wxString& format, va_list ap) +{ + WX_VARARG_VFOO_IMPL((wxFormatString(format), ap), + wxCRT_VprintfW, wxCRT_VprintfA); +} + +inline int +wxVfprintf(FILE *f, const wxString& format, va_list ap) +{ + WX_VARARG_VFOO_IMPL((f, wxFormatString(format), ap), + wxCRT_VfprintfW, wxCRT_VfprintfA); +} + +wxGCC_ONLY_WARNING_RESTORE(suggest-attribute=format) + +#undef WX_VARARG_VFOO_IMPL + + +// wxSprintf() and friends have to be implemented in two forms, one for +// writing to char* buffer and one for writing to wchar_t*: + +#if !wxUSE_UTF8_LOCALE_ONLY +int WXDLLIMPEXP_BASE wxDoSprintfWchar(char *str, const wxChar *format, ...); +#endif +#if wxUSE_UNICODE_UTF8 +int WXDLLIMPEXP_BASE wxDoSprintfUtf8(char *str, const char *format, ...); +#endif +WX_DEFINE_VARARG_FUNC(int, wxSprintf, 2, (char*, const wxFormatString&), + wxDoSprintfWchar, wxDoSprintfUtf8) + +int WXDLLIMPEXP_BASE +wxVsprintf(char *str, const wxString& format, va_list argptr); + +#if !wxUSE_UTF8_LOCALE_ONLY +int WXDLLIMPEXP_BASE wxDoSnprintfWchar(char *str, size_t size, const wxChar *format, ...); +#endif +#if wxUSE_UNICODE_UTF8 +int WXDLLIMPEXP_BASE wxDoSnprintfUtf8(char *str, size_t size, const char *format, ...); +#endif +WX_DEFINE_VARARG_FUNC(int, wxSnprintf, 3, (char*, size_t, const wxFormatString&), + wxDoSnprintfWchar, wxDoSnprintfUtf8) + +int WXDLLIMPEXP_BASE +wxVsnprintf(char *str, size_t size, const wxString& format, va_list argptr); + +#if wxUSE_UNICODE + +#if !wxUSE_UTF8_LOCALE_ONLY +int WXDLLIMPEXP_BASE wxDoSprintfWchar(wchar_t *str, const wxChar *format, ...); +#endif +#if wxUSE_UNICODE_UTF8 +int WXDLLIMPEXP_BASE wxDoSprintfUtf8(wchar_t *str, const char *format, ...); +#endif +WX_DEFINE_VARARG_FUNC(int, wxSprintf, 2, (wchar_t*, const wxFormatString&), + wxDoSprintfWchar, wxDoSprintfUtf8) + +int WXDLLIMPEXP_BASE +wxVsprintf(wchar_t *str, const wxString& format, va_list argptr); + +#if !wxUSE_UTF8_LOCALE_ONLY +int WXDLLIMPEXP_BASE wxDoSnprintfWchar(wchar_t *str, size_t size, const wxChar *format, ...); +#endif +#if wxUSE_UNICODE_UTF8 +int WXDLLIMPEXP_BASE wxDoSnprintfUtf8(wchar_t *str, size_t size, const char *format, ...); +#endif +WX_DEFINE_VARARG_FUNC(int, wxSnprintf, 3, (wchar_t*, size_t, const wxFormatString&), + wxDoSnprintfWchar, wxDoSnprintfUtf8) + +int WXDLLIMPEXP_BASE +wxVsnprintf(wchar_t *str, size_t size, const wxString& format, va_list argptr); + +#endif // wxUSE_UNICODE + +// We can't use wxArgNormalizer<T> for variadic arguments to wxScanf() etc. +// because they are writable, so instead of providing friendly template +// vararg-like functions, we just provide both char* and wchar_t* variants +// of these functions. The type of output variadic arguments for %s must match +// the type of 'str' and 'format' arguments. +// +// For compatibility with earlier wx versions, we also provide wxSscanf() +// version with the first argument (input string) wxString; for this version, +// the type of output string values is determined by the type of format string +// only. + +#define _WX_SCANFUNC_EXTRACT_ARGS_1(x) x +#define _WX_SCANFUNC_EXTRACT_ARGS_2(x,y) x, y +#define _WX_SCANFUNC_EXTRACT_ARGS(N, args) _WX_SCANFUNC_EXTRACT_ARGS_##N args + +#define _WX_VARARG_PASS_WRITABLE(i) a##i + +#define _WX_DEFINE_SCANFUNC(N, dummy1, name, impl, passfixed, numfixed, fixed)\ + template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \ + int name(_WX_SCANFUNC_EXTRACT_ARGS(numfixed, fixed), \ + _WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \ + { \ + return impl(_WX_SCANFUNC_EXTRACT_ARGS(numfixed, passfixed), \ + _WX_VARARG_JOIN(N, _WX_VARARG_PASS_WRITABLE)); \ + } + +#define WX_DEFINE_SCANFUNC(name, numfixed, fixed, impl, passfixed) \ + _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \ + _WX_DEFINE_SCANFUNC, \ + dummy1, name, impl, passfixed, numfixed, fixed) + +// this is needed to normalize the format string, see src/common/strvararg.cpp +// for more details +#ifdef __WINDOWS__ + #define wxScanfConvertFormatW(fmt) fmt +#else + const wxScopedWCharBuffer + WXDLLIMPEXP_BASE wxScanfConvertFormatW(const wchar_t *format); +#endif + +WX_DEFINE_SCANFUNC(wxScanf, 1, (const char *format), + wxCRT_ScanfA, (format)) +WX_DEFINE_SCANFUNC(wxScanf, 1, (const wchar_t *format), + wxCRT_ScanfW, (wxScanfConvertFormatW(format))) + +WX_DEFINE_SCANFUNC(wxFscanf, 2, (FILE *stream, const char *format), + wxCRT_FscanfA, (stream, format)) +WX_DEFINE_SCANFUNC(wxFscanf, 2, (FILE *stream, const wchar_t *format), + wxCRT_FscanfW, (stream, wxScanfConvertFormatW(format))) + +WX_DEFINE_SCANFUNC(wxSscanf, 2, (const char *str, const char *format), + wxCRT_SscanfA, (str, format)) +WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wchar_t *str, const wchar_t *format), + wxCRT_SscanfW, (str, wxScanfConvertFormatW(format))) +WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxScopedCharBuffer& str, const char *format), + wxCRT_SscanfA, (str.data(), format)) +WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxScopedWCharBuffer& str, const wchar_t *format), + wxCRT_SscanfW, (str.data(), wxScanfConvertFormatW(format))) +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxString& str, const char *format), + wxCRT_SscanfA, (str.mb_str(), format)) +#endif +WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxString& str, const wchar_t *format), + wxCRT_SscanfW, (str.wc_str(), wxScanfConvertFormatW(format))) +#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING +WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxCStrData& str, const char *format), + wxCRT_SscanfA, (str.AsCharBuf(), format)) +#endif +WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxCStrData& str, const wchar_t *format), + wxCRT_SscanfW, (str.AsWCharBuf(), wxScanfConvertFormatW(format))) + +// Visual C++ doesn't provide vsscanf() +#ifndef __VISUALC___ +int WXDLLIMPEXP_BASE wxVsscanf(const char *str, const char *format, va_list ap); +int WXDLLIMPEXP_BASE wxVsscanf(const wchar_t *str, const wchar_t *format, va_list ap); +int WXDLLIMPEXP_BASE wxVsscanf(const wxScopedCharBuffer& str, const char *format, va_list ap); +int WXDLLIMPEXP_BASE wxVsscanf(const wxScopedWCharBuffer& str, const wchar_t *format, va_list ap); +int WXDLLIMPEXP_BASE wxVsscanf(const wxString& str, const char *format, va_list ap); +int WXDLLIMPEXP_BASE wxVsscanf(const wxString& str, const wchar_t *format, va_list ap); +int WXDLLIMPEXP_BASE wxVsscanf(const wxCStrData& str, const char *format, va_list ap); +int WXDLLIMPEXP_BASE wxVsscanf(const wxCStrData& str, const wchar_t *format, va_list ap); +#endif // !__VISUALC__ + +#endif /* _WX_WXCRTVARARG_H_ */ diff --git a/lib/wxWidgets/include/wx/wxhtml.h b/lib/wxWidgets/include/wx/wxhtml.h new file mode 100644 index 0000000..9759dac --- /dev/null +++ b/lib/wxWidgets/include/wx/wxhtml.h @@ -0,0 +1,21 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/wxhtml.h +// Purpose: wxHTML library for wxWidgets +// Author: Vaclav Slavik +// Copyright: (c) 1999 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HTML_H_ +#define _WX_HTML_H_ + +#include "wx/html/htmldefs.h" +#include "wx/html/htmltag.h" +#include "wx/html/htmlcell.h" +#include "wx/html/htmlpars.h" +#include "wx/html/htmlwin.h" +#include "wx/html/winpars.h" +#include "wx/filesys.h" +#include "wx/html/helpctrl.h" + +#endif // __WXHTML_H__ diff --git a/lib/wxWidgets/include/wx/wxprec.h b/lib/wxWidgets/include/wx/wxprec.h new file mode 100644 index 0000000..366f0a3 --- /dev/null +++ b/lib/wxWidgets/include/wx/wxprec.h @@ -0,0 +1,44 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/wxprec.h +// Purpose: Includes the appropriate files for precompiled headers +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// compiler detection; includes setup.h +#include "wx/defs.h" + +// check if to use precompiled headers: do it for most Windows compilers unless +// explicitly disabled by defining NOPCH +#if defined(__VISUALC__) + // If user did not request NOCPH and we're not building using configure + // then assume user wants precompiled headers. + #if !defined(NOPCH) && !defined(__WX_SETUP_H__) + #define WX_PRECOMP + #endif +#endif + +#ifdef WX_PRECOMP + +// include "wx/chartype.h" first to ensure that UNICODE macro is correctly set +// _before_ including <windows.h> +#include "wx/chartype.h" + +// include standard Windows headers +#if defined(__WINDOWS__) + #include "wx/msw/wrapwin.h" + #include "wx/msw/private.h" +#endif +#if defined(__WXMSW__) + #include "wx/msw/wrapcctl.h" + #include "wx/msw/wrapcdlg.h" + #include "wx/msw/missing.h" +#endif + +// include the most common wx headers +#include "wx/wx.h" + +#endif // WX_PRECOMP diff --git a/lib/wxWidgets/include/wx/x11/app.h b/lib/wxWidgets/include/wx/x11/app.h new file mode 100644 index 0000000..5902ddd --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/app.h @@ -0,0 +1,107 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/app.h +// Purpose: wxApp class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_X11_APP_H_ +#define _WX_X11_APP_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/gdicmn.h" +#include "wx/event.h" + +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxFrame; +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxApp; +class WXDLLIMPEXP_FWD_CORE wxKeyEvent; +class WXDLLIMPEXP_FWD_BASE wxLog; +class WXDLLIMPEXP_FWD_CORE wxXVisualInfo; + +// ---------------------------------------------------------------------------- +// the wxApp class for wxX11 - see wxAppBase for more details +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxApp : public wxAppBase +{ +public: + wxApp(); + virtual ~wxApp(); + + // override base class (pure) virtuals + // ----------------------------------- + + virtual void Exit(); + + virtual void WakeUpIdle(); + + virtual bool OnInitGui(); + + // implementation from now on + // -------------------------- + + // Processes an X event. + virtual bool ProcessXEvent(WXEvent* event); + +public: + // Implementation + virtual bool Initialize(int& argc, wxChar **argv); + virtual void CleanUp(); + + WXWindow GetTopLevelWidget() const { return m_topLevelWidget; } + WXColormap GetMainColormap(WXDisplay* display); + long GetMaxRequestSize() const { return m_maxRequestSize; } + + // This handler is called when a property change event occurs + virtual bool HandlePropertyChange(WXEvent *event); + + // Values that can be passed on the command line. + // Returns -1, -1 if none specified. + const wxSize& GetInitialSize() const { return m_initialSize; } + bool GetShowIconic() const { return m_showIconic; } + +#if wxUSE_UNICODE + // Global context for Pango layout. Either use X11 + // or use Xft rendering according to GDK_USE_XFT + // environment variable + PangoContext* GetPangoContext(); +#endif + + wxXVisualInfo* GetVisualInfo(WXDisplay* WXUNUSED(display)) + { + // this should be implemented correctly for wxBitmap to work + // with multiple display + return m_visualInfo; + } + virtual void* GetXVisualInfo() { return NULL; } + +public: + static long sm_lastMessageTime; + bool m_showIconic; + wxSize m_initialSize; + +#if !wxUSE_NANOX + wxXVisualInfo* m_visualInfo; +#endif + +protected: + WXWindow m_topLevelWidget; + WXColormap m_mainColormap; + long m_maxRequestSize; + + wxDECLARE_DYNAMIC_CLASS(wxApp); +}; + +#endif // _WX_X11_APP_H_ + diff --git a/lib/wxWidgets/include/wx/x11/bitmap.h b/lib/wxWidgets/include/wx/x11/bitmap.h new file mode 100644 index 0000000..c7cf061 --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/bitmap.h @@ -0,0 +1,135 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/bitmap.h +// Purpose: wxBitmap class +// Author: Julian Smart, Robert Roebling +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart, Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BITMAP_H_ +#define _WX_BITMAP_H_ + +#include "wx/palette.h" +#include "wx/gdiobj.h" + +//----------------------------------------------------------------------------- +// wxMask +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMask: public wxObject +{ +public: + wxMask(); + wxMask(const wxMask& mask); + wxMask( const wxBitmap& bitmap, const wxColour& colour ); + wxMask( const wxBitmap& bitmap, int paletteIndex ); + wxMask( const wxBitmap& bitmap ); + virtual ~wxMask(); + + bool Create( const wxBitmap& bitmap, const wxColour& colour ); + bool Create( const wxBitmap& bitmap, int paletteIndex ); + bool Create( const wxBitmap& bitmap ); + + // implementation + WXPixmap GetBitmap() const { return m_bitmap; } + void SetBitmap( WXPixmap bitmap ) { m_bitmap = bitmap; } + + WXDisplay *GetDisplay() const { return m_display; } + void SetDisplay( WXDisplay *display ) { m_display = display; } + +private: + WXPixmap m_bitmap; + WXDisplay *m_display; + wxSize m_size; + +private: + wxDECLARE_DYNAMIC_CLASS(wxMask); +}; + +//----------------------------------------------------------------------------- +// wxBitmap +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase +{ +public: + wxBitmap() {} + wxBitmap( int width, int height, int depth = -1 ) { Create( width, height, depth ); } + wxBitmap( const wxSize& sz, int depth = -1 ) { Create( sz, depth ); } + wxBitmap( int width, int height, const wxDC& dc ) { Create(width, height, dc); } + + wxBitmap( const char bits[], int width, int height, int depth = 1 ); + wxBitmap( const char* const* bits ); + wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE ); + virtual ~wxBitmap(); + + static void InitStandardHandlers(); + + bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); + bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) + { return Create(sz.GetWidth(), sz.GetHeight(), depth); } + bool Create(int width, int height, const wxDC& WXUNUSED(dc)) + { return Create(width,height); } + + bool Create(const void* data, wxBitmapType type, + int width, int height, int depth = -1); + // create the wxBitmap using a _copy_ of the pixmap + bool Create(WXPixmap pixmap); + + int GetHeight() const; + int GetWidth() const; + int GetDepth() const; + +#if wxUSE_IMAGE + wxBitmap( const wxImage& image, int depth = -1, double WXUNUSED(scale) = 1.0 ) { (void)CreateFromImage(image, depth); } + wxBitmap( const wxImage& image, const wxDC& WXUNUSED(dc) ) { (void)CreateFromImage(image); } + wxImage ConvertToImage() const; + bool CreateFromImage(const wxImage& image, int depth = -1); +#endif // wxUSE_IMAGE + + wxMask *GetMask() const; + void SetMask( wxMask *mask ); + + wxBitmap GetSubBitmap( const wxRect& rect ) const; + + bool SaveFile( const wxString &name, wxBitmapType type, const wxPalette *palette = NULL ) const; + bool LoadFile( const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE ); + + wxPalette *GetPalette() const; + wxPalette *GetColourMap() const + { return GetPalette(); } + virtual void SetPalette(const wxPalette& palette); + + // implementation + // -------------- + +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED(void SetHeight( int height )); + wxDEPRECATED(void SetWidth( int width )); + wxDEPRECATED(void SetDepth( int depth )); +#endif + void SetPixmap( WXPixmap pixmap ); + void SetBitmap( WXPixmap bitmap ); + + WXPixmap GetPixmap() const; + WXPixmap GetBitmap() const; + + WXPixmap GetDrawable() const; + + WXDisplay *GetDisplay() const; + + // This is provided only for compatibility with the other ports, there is + // no alpha support in X11 bitmaps. + bool HasAlpha() const { return false; } + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + +private: + wxDECLARE_DYNAMIC_CLASS(wxBitmap); +}; + +#endif // _WX_BITMAP_H_ diff --git a/lib/wxWidgets/include/wx/x11/brush.h b/lib/wxWidgets/include/wx/x11/brush.h new file mode 100644 index 0000000..6095b67 --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/brush.h @@ -0,0 +1,63 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/brush.h +// Purpose: wxBrush class +// Author: Julian Smart, Robert Roebling +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart, Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BRUSH_H_ +#define _WX_BRUSH_H_ + +#include "wx/gdiobj.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxBrush; +class WXDLLIMPEXP_FWD_CORE wxColour; +class WXDLLIMPEXP_FWD_CORE wxBitmap; + +//----------------------------------------------------------------------------- +// wxBrush +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBrush : public wxBrushBase +{ +public: + wxBrush() { } + + wxBrush( const wxColour &colour, wxBrushStyle style = wxBRUSHSTYLE_SOLID ); + wxBrush( const wxBitmap &stippleBitmap ); + virtual ~wxBrush(); + + bool operator==(const wxBrush& brush) const; + bool operator!=(const wxBrush& brush) const { return !(*this == brush); } + + wxBrushStyle GetStyle() const; + wxColour GetColour() const; + wxBitmap *GetStipple() const; + + void SetColour( const wxColour& col ); + void SetColour( unsigned char r, unsigned char g, unsigned char b ); + void SetStyle( wxBrushStyle style ); + void SetStipple( const wxBitmap& stipple ); + + + wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants") + wxBrush(const wxColour& col, int style); + + wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants") + void SetStyle(int style) { SetStyle((wxBrushStyle)style); } + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + + wxDECLARE_DYNAMIC_CLASS(wxBrush); +}; + +#endif // _WX_BRUSH_H_ diff --git a/lib/wxWidgets/include/wx/x11/chkconf.h b/lib/wxWidgets/include/wx/x11/chkconf.h new file mode 100644 index 0000000..c552e83 --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/chkconf.h @@ -0,0 +1,30 @@ +/* + * Name: wx/x11/chkconf.h + * Purpose: Compiler-specific configuration checking + * Author: Julian Smart + * Modified by: + * Created: 01/02/97 + * Copyright: (c) Julian Smart + * Licence: wxWindows licence + */ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#ifndef _WX_X11_CHKCONF_H_ +#define _WX_X11_CHKCONF_H_ + +/* wxPalette is always needed */ +#if !wxUSE_PALETTE +# error "wxX11 requires wxUSE_PALETTE=1" +#endif + +#if wxUSE_SOCKETS && !wxUSE_SELECT_DISPATCHER +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxSocket requires wxSelectDispatcher in wxX11" +# else +# undef wxUSE_SELECT_DISPATCHER +# define wxUSE_SELECT_DISPATCHER 1 +# endif +#endif + +#endif /* _WX_X11_CHKCONF_H_ */ diff --git a/lib/wxWidgets/include/wx/x11/clipbrd.h b/lib/wxWidgets/include/wx/x11/clipbrd.h new file mode 100644 index 0000000..4b00655 --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/clipbrd.h @@ -0,0 +1,76 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/clipbrd.h +// Purpose: Clipboard functionality. +// Author: Robert Roebling +// Created: 17/09/98 +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_X11_CLIPBRD_H_ +#define _WX_X11_CLIPBRD_H_ + +#if wxUSE_CLIPBOARD + +#include "wx/object.h" +#include "wx/list.h" +#include "wx/dataobj.h" +#include "wx/control.h" +#include "wx/module.h" + +// ---------------------------------------------------------------------------- +// wxClipboard +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxClipboard : public wxClipboardBase +{ +public: + wxClipboard(); + virtual ~wxClipboard(); + + // open the clipboard before SetData() and GetData() + virtual bool Open(); + + // close the clipboard after SetData() and GetData() + virtual void Close(); + + // query whether the clipboard is opened + virtual bool IsOpened() const; + + // set the clipboard data. all other formats will be deleted. + virtual bool SetData( wxDataObject *data ); + + // add to the clipboard data. + virtual bool AddData( wxDataObject *data ); + + // ask if data in correct format is available + virtual bool IsSupported( const wxDataFormat& format ); + + // fill data with data on the clipboard (if available) + virtual bool GetData( wxDataObject& data ); + + // clears wxTheClipboard and the system's clipboard if possible + virtual void Clear(); + + // implementation from now on + bool m_open; + bool m_ownsClipboard; + bool m_ownsPrimarySelection; + wxDataObject *m_data; + + WXWindow m_clipboardWidget; /* for getting and offering data */ + WXWindow m_targetsWidget; /* for getting list of supported formats */ + bool m_waiting; /* querying data or formats is asynchronous */ + + bool m_formatSupported; + Atom m_targetRequested; + wxDataObject *m_receivedData; + +private: + wxDECLARE_DYNAMIC_CLASS(wxClipboard); + +}; + +#endif // wxUSE_CLIPBOARD + +#endif // _WX_X11_CLIPBRD_H_ diff --git a/lib/wxWidgets/include/wx/x11/colour.h b/lib/wxWidgets/include/wx/x11/colour.h new file mode 100644 index 0000000..568cf07 --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/colour.h @@ -0,0 +1,70 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/colour.h +// Purpose: wxColour class +// Author: Julian Smart, Robert Roebling +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart, Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COLOUR_H_ +#define _WX_COLOUR_H_ + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/string.h" +#include "wx/gdiobj.h" +#include "wx/palette.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxDC; +class WXDLLIMPEXP_FWD_CORE wxPaintDC; +class WXDLLIMPEXP_FWD_CORE wxBitmap; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +class WXDLLIMPEXP_FWD_CORE wxColour; + +//----------------------------------------------------------------------------- +// wxColour +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxColour : public wxColourBase +{ +public: + // constructors + // ------------ + DEFINE_STD_WXCOLOUR_CONSTRUCTORS + + virtual ~wxColour(); + + bool operator==(const wxColour& col) const; + bool operator!=(const wxColour& col) const { return !(*this == col); } + + unsigned char Red() const; + unsigned char Green() const; + unsigned char Blue() const; + + // Implementation part + + void CalcPixel( WXColormap cmap ); + unsigned long GetPixel() const; + WXColor *GetColor() const; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + + virtual void + InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a); + + virtual bool FromString(const wxString& str); + +private: + wxDECLARE_DYNAMIC_CLASS(wxColour); +}; + +#endif // _WX_COLOUR_H_ diff --git a/lib/wxWidgets/include/wx/x11/cursor.h b/lib/wxWidgets/include/wx/x11/cursor.h new file mode 100644 index 0000000..b9bdc11 --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/cursor.h @@ -0,0 +1,54 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/cursor.h +// Purpose: wxCursor class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CURSOR_H_ +#define _WX_CURSOR_H_ + +#include "wx/colour.h" + +class WXDLLIMPEXP_FWD_CORE wxImage; + +//----------------------------------------------------------------------------- +// wxCursor +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxCursor : public wxCursorBase +{ +public: + wxCursor(); + wxCursor(wxStockCursor id) { InitFromStock(id); } +#if WXWIN_COMPATIBILITY_2_8 + wxCursor(int id) { InitFromStock((wxStockCursor)id); } +#endif +#if wxUSE_IMAGE + wxCursor( const wxImage & image ); + wxCursor(const char* const* xpmData); +#endif + + wxCursor(const wxString& name, + wxBitmapType type = wxCURSOR_DEFAULT_TYPE, + int hotSpotX = 0, int hotSpotY = 0); + virtual ~wxCursor(); + + // implementation + + WXCursor GetCursor() const; + +protected: + void InitFromStock(wxStockCursor); + + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + +private: + wxDECLARE_DYNAMIC_CLASS(wxCursor); +}; + +#endif // _WX_CURSOR_H_ diff --git a/lib/wxWidgets/include/wx/x11/dataform.h b/lib/wxWidgets/include/wx/x11/dataform.h new file mode 100644 index 0000000..f07f017 --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/dataform.h @@ -0,0 +1,64 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/dataform.h +// Purpose: declaration of the wxDataFormat class +// Author: Robert Roebling +// Modified by: +// Created: 19.10.99 (extracted from motif/dataobj.h) +// Copyright: (c) 1999 Robert Roebling +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_X11_DATAFORM_H +#define _WX_X11_DATAFORM_H + +class WXDLLIMPEXP_CORE wxDataFormat +{ +public: + // the clipboard formats under Xt are Atoms + typedef Atom NativeFormat; + + wxDataFormat(); + wxDataFormat( wxDataFormatId type ); + wxDataFormat( const wxString &id ); + wxDataFormat( NativeFormat format ); + + wxDataFormat& operator=(NativeFormat format) + { SetId(format); return *this; } + + // comparison (must have both versions) + bool operator==(NativeFormat format) const + { return m_format == (NativeFormat)format; } + bool operator!=(NativeFormat format) const + { return m_format != (NativeFormat)format; } + bool operator==(wxDataFormatId format) const + { return m_type == (wxDataFormatId)format; } + bool operator!=(wxDataFormatId format) const + { return m_type != (wxDataFormatId)format; } + + // explicit and implicit conversions to NativeFormat which is one of + // standard data types (implicit conversion is useful for preserving the + // compatibility with old code) + NativeFormat GetFormatId() const { return m_format; } + operator NativeFormat() const { return m_format; } + + void SetId( NativeFormat format ); + + // string ids are used for custom types - this SetId() must be used for + // application-specific formats + wxString GetId() const; + void SetId( const wxString& id ); + + // implementation + wxDataFormatId GetType() const; + +private: + wxDataFormatId m_type; + NativeFormat m_format; + + void PrepareFormats(); + void SetType( wxDataFormatId type ); +}; + + +#endif // _WX_X11_DATAFORM_H + diff --git a/lib/wxWidgets/include/wx/x11/dataobj.h b/lib/wxWidgets/include/wx/x11/dataobj.h new file mode 100644 index 0000000..b2efffc --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/dataobj.h @@ -0,0 +1,29 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/dataobj.h +// Purpose: declaration of the wxDataObject class for Motif +// Author: Julian Smart +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_X11_DATAOBJ_H_ +#define _WX_X11_DATAOBJ_H_ + +// ---------------------------------------------------------------------------- +// wxDataObject is the same as wxDataObjectBase under wxMotif +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataObject : public wxDataObjectBase +{ +public: + wxDataObject(); + +#ifdef __DARWIN__ + virtual ~wxDataObject() { } +#endif + + virtual bool IsSupportedFormat( const wxDataFormat& format, Direction dir = Get ) const; +}; + +#endif //_WX_X11_DATAOBJ_H_ + diff --git a/lib/wxWidgets/include/wx/x11/dataobj2.h b/lib/wxWidgets/include/wx/x11/dataobj2.h new file mode 100644 index 0000000..aef3921 --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/dataobj2.h @@ -0,0 +1,92 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/dataobj2.h +// Purpose: declaration of standard wxDataObjectSimple-derived classes +// Author: Robert Roebling +// Created: 19.10.99 (extracted from gtk/dataobj.h) +// Copyright: (c) 1998, 1999 Vadim Zeitlin, Robert Roebling +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_X11_DATAOBJ2_H_ +#define _WX_X11_DATAOBJ2_H_ + +// ---------------------------------------------------------------------------- +// wxBitmapDataObject is a specialization of wxDataObject for bitmaps +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBitmapDataObject : public wxBitmapDataObjectBase +{ +public: + // ctors + wxBitmapDataObject(); + wxBitmapDataObject(const wxBitmap& bitmap); + + // destr + virtual ~wxBitmapDataObject(); + + // override base class virtual to update PNG data too + virtual void SetBitmap(const wxBitmap& bitmap); + + // implement base class pure virtuals + // ---------------------------------- + + virtual size_t GetDataSize() const { return m_pngSize; } + 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); + } + +protected: + void Init() { m_pngData = NULL; m_pngSize = 0; } + void Clear() { free(m_pngData); } + void ClearAll() { Clear(); Init(); } + + size_t m_pngSize; + void *m_pngData; + + void DoConvertToPng(); +}; + +// ---------------------------------------------------------------------------- +// wxFileDataObject is a specialization of wxDataObject for file names +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFileDataObject : public wxFileDataObjectBase +{ +public: + // implement base class pure virtuals + // ---------------------------------- + + void AddFile( const wxString &filename ); + + 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); + } +}; + +#endif // _WX_X11_DATAOBJ2_H_ + diff --git a/lib/wxWidgets/include/wx/x11/dc.h b/lib/wxWidgets/include/wx/x11/dc.h new file mode 100644 index 0000000..418e87d --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/dc.h @@ -0,0 +1,52 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/dc.h +// Purpose: wxDC class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DC_H_ +#define _WX_DC_H_ + +#include "wx/pen.h" +#include "wx/brush.h" +#include "wx/icon.h" +#include "wx/font.h" +#include "wx/gdicmn.h" + +//----------------------------------------------------------------------------- +// wxDC +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxX11DCImpl : public wxDCImpl +{ +public: + wxX11DCImpl( wxDC *owner ); + virtual ~wxX11DCImpl() { } + + virtual wxSize GetPPI() const; + +protected: + virtual void DoSetClippingRegion(wxCoord x, wxCoord y, + wxCoord width, wxCoord height); + virtual void DoGetSizeMM(int* width, int* height) const; + + // implementation + wxCoord XDEV2LOG(wxCoord x) const { return DeviceToLogicalX(x); } + wxCoord XDEV2LOGREL(wxCoord x) const { return DeviceToLogicalXRel(x); } + wxCoord YDEV2LOG(wxCoord y) const { return DeviceToLogicalY(y); } + wxCoord YDEV2LOGREL(wxCoord y) const { return DeviceToLogicalYRel(y); } + wxCoord XLOG2DEV(wxCoord x) const { return LogicalToDeviceX(x); } + wxCoord XLOG2DEVREL(wxCoord x) const { return LogicalToDeviceXRel(x); } + wxCoord YLOG2DEV(wxCoord y) const { return LogicalToDeviceY(y); } + wxCoord YLOG2DEVREL(wxCoord y) const { return LogicalToDeviceYRel(y); } + +private: + wxDECLARE_CLASS(wxX11DCImpl); +}; + +#endif +// _WX_DC_H_ diff --git a/lib/wxWidgets/include/wx/x11/dcclient.h b/lib/wxWidgets/include/wx/x11/dcclient.h new file mode 100644 index 0000000..f274086 --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/dcclient.h @@ -0,0 +1,181 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/dcclient.h +// Purpose: wxClientDC, wxPaintDC and wxWindowDC classes +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCCLIENT_H_ +#define _WX_DCCLIENT_H_ + +#include "wx/dc.h" +#include "wx/dcclient.h" +#include "wx/x11/dc.h" +#include "wx/region.h" + +// ----------------------------------------------------------------------------- +// fwd declarations +// ----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxWindow; + +//----------------------------------------------------------------------------- +// wxWindowDCImpl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWindowDCImpl : public wxX11DCImpl +{ +public: + wxWindowDCImpl( wxDC *owner ); + wxWindowDCImpl( wxDC *owner, wxWindow *win ); + + virtual ~wxWindowDCImpl(); + + virtual bool CanDrawBitmap() const { return true; } + virtual bool CanGetTextExtent() const { return true; } + +protected: + virtual void DoGetSize(int *width, int *height) const; + virtual bool DoFloodFill( wxCoord x, wxCoord y, const wxColour& col, + wxFloodFillStyle style = wxFLOOD_SURFACE ); + virtual bool DoGetPixel( wxCoord x, wxCoord y, wxColour *col ) const; + + virtual void DoDrawPoint(wxCoord x, wxCoord y); + virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); + + virtual void DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ); + virtual void DoDrawBitmap( const wxBitmap &bitmap, wxCoord x, wxCoord y, + bool useMask = false ); + + virtual void DoDrawArc(wxCoord x1, wxCoord y1, + wxCoord x2, wxCoord y2, + wxCoord xc, wxCoord yc); + virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, + double sa, double ea); + + virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, + wxCoord width, wxCoord height, + double radius); + virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + + virtual void DoCrossHair(wxCoord x, wxCoord y); + + virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); + virtual void DoDrawRotatedText(const wxString &text, wxCoord x, wxCoord y, double angle); + + virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, + wxDC *source, wxCoord xsrc, wxCoord ysrc, + wxRasterOperationMode rop = wxCOPY, bool useMask = false, + wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); + + virtual void DoSetClippingRegion(wxCoord x, wxCoord y, + wxCoord width, wxCoord height); + virtual void DoSetDeviceClippingRegion(const wxRegion& region); + + virtual void DoDrawLines(int n, const wxPoint points[], + wxCoord xoffset, wxCoord yoffset); + virtual void DoDrawPolygon(int n, const wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + wxPolygonFillMode fillStyle = wxODDEVEN_RULE); + + +public: + virtual void Clear(); + + virtual void SetFont(const wxFont& font); + virtual void SetPen(const wxPen& pen); + virtual void SetBrush(const wxBrush& brush); + virtual void SetBackground(const wxBrush& brush); + virtual void SetBackgroundMode(int mode); + virtual void SetPalette(const wxPalette& palette); + virtual void SetLogicalFunction( wxRasterOperationMode function ); + + virtual void SetTextForeground(const wxColour& colour); + virtual void SetTextBackground(const wxColour& colour); + + virtual wxCoord GetCharHeight() const; + virtual wxCoord GetCharWidth() const; + + virtual int GetDepth() const; + virtual wxSize GetPPI() const; + + virtual void DestroyClippingRegion(); + WXWindow GetX11Window() const { return m_x11window; } + + virtual void ComputeScaleAndOrigin(); +#if wxUSE_CAIRO + virtual void* GetCairoContext() const wxOVERRIDE; +#endif + +protected: + // implementation + // -------------- + virtual void DoGetTextExtent(const wxString& string, + wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + const wxFont *theFont = NULL) const; + + void Init(); + + WXDisplay *m_display; + WXWindow m_x11window; + WXGC m_penGC; + WXGC m_brushGC; + WXGC m_textGC; + WXGC m_bgGC; + WXColormap m_cmap; + bool m_isMemDC; + bool m_isScreenDC; + wxRegion m_currentClippingRegion; + wxRegion m_paintClippingRegion; + +#if wxUSE_UNICODE + PangoContext *m_context; + PangoFontDescription *m_fontdesc; +#endif + + void SetUpDC(); + void Destroy(); + +private: + wxDECLARE_CLASS(wxWindowDCImpl); +}; + +//----------------------------------------------------------------------------- +// wxClientDC +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxClientDCImpl : public wxWindowDCImpl +{ +public: + wxClientDCImpl( wxDC *owner ) : wxWindowDCImpl( owner ) { } + wxClientDCImpl( wxDC *owner, wxWindow *win ); + +protected: + virtual void DoGetSize(int *width, int *height) const; + +private: + wxDECLARE_CLASS(wxClientDCImpl); +}; + +//----------------------------------------------------------------------------- +// wxPaintDC +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPaintDCImpl : public wxClientDCImpl +{ +public: + wxPaintDCImpl( wxDC *owner ) : wxClientDCImpl( owner ) { } + wxPaintDCImpl( wxDC *owner, wxWindow *win ); + +private: + wxDECLARE_CLASS(wxPaintDCImpl); +}; + +#endif +// _WX_DCCLIENT_H_ diff --git a/lib/wxWidgets/include/wx/x11/dcmemory.h b/lib/wxWidgets/include/wx/x11/dcmemory.h new file mode 100644 index 0000000..3b08cff --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/dcmemory.h @@ -0,0 +1,44 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/dcmemory.h +// Purpose: wxMemoryDC class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCMEMORY_H_ +#define _WX_DCMEMORY_H_ + +#include "wx/dc.h" +#include "wx/dcmemory.h" +#include "wx/x11/dcclient.h" + +class WXDLLIMPEXP_CORE wxMemoryDCImpl : public wxWindowDCImpl +{ +public: + wxMemoryDCImpl( wxDC* owner ); + wxMemoryDCImpl( wxDC* owner, wxBitmap& bitmap); + wxMemoryDCImpl( wxDC* owner, wxDC *dc ); + virtual ~wxMemoryDCImpl(); + + virtual const wxBitmap& GetSelectedBitmap() const; + virtual wxBitmap& GetSelectedBitmap(); + + // implementation + wxBitmap m_selected; + +protected: + virtual void DoGetSize( int *width, int *height ) const; + virtual void DoSelect(const wxBitmap& bitmap); + +private: + void Init(); + +private: + wxDECLARE_CLASS(wxMemoryDCImpl); +}; + +#endif +// _WX_DCMEMORY_H_ diff --git a/lib/wxWidgets/include/wx/x11/dcprint.h b/lib/wxWidgets/include/wx/x11/dcprint.h new file mode 100644 index 0000000..e28eec0 --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/dcprint.h @@ -0,0 +1,28 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/dcprint.h +// Purpose: wxPrinterDC class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCPRINT_H_ +#define _WX_DCPRINT_H_ + +#include "wx/dc.h" + +class WXDLLIMPEXP_CORE wxPrinterDC: public wxDC +{ +public: + wxDECLARE_CLASS(wxPrinterDC); + + // Create a printer DC + wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output, bool interactive = TRUE, wxPrintOrientation orientation = wxPORTRAIT); + + virtual ~wxPrinterDC(); +}; + +#endif + // _WX_DCPRINT_H_ diff --git a/lib/wxWidgets/include/wx/x11/dcscreen.h b/lib/wxWidgets/include/wx/x11/dcscreen.h new file mode 100644 index 0000000..d0bab6a --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/dcscreen.h @@ -0,0 +1,36 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/dcscreen.h +// Purpose: wxScreenDC class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCSCREEN_H_ +#define _WX_DCSCREEN_H_ + +#include "wx/dcclient.h" +#include "wx/x11/dcclient.h" + +//----------------------------------------------------------------------------- +// wxScreenDC +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxScreenDCImpl : public wxPaintDCImpl +{ +public: + wxScreenDCImpl( wxDC *owner); + virtual ~wxScreenDCImpl(); + +protected: + virtual void DoGetSize(int *width, int *height) const; + +private: + wxDECLARE_CLASS(wxScreenDCImpl); +}; + + +#endif + // _WX_DCSCREEN_H_ diff --git a/lib/wxWidgets/include/wx/x11/dnd.h b/lib/wxWidgets/include/wx/x11/dnd.h new file mode 100644 index 0000000..76073d5 --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/dnd.h @@ -0,0 +1,172 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/dnd.h +// Purpose: declaration of wxDropTarget, wxDropSource classes +// Author: Julian Smart +// Copyright: (c) 1998 Vadim Zeitlin, Robert Roebling, Julian Smart +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DND_H_ +#define _WX_DND_H_ + +#include "wx/defs.h" + +#if wxUSE_DRAG_AND_DROP + +#include "wx/object.h" +#include "wx/string.h" +#include "wx/dataobj.h" +#include "wx/cursor.h" + +//------------------------------------------------------------------------- +// classes +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxWindow; + +class WXDLLIMPEXP_FWD_CORE wxDropTarget; +class WXDLLIMPEXP_FWD_CORE wxTextDropTarget; +class WXDLLIMPEXP_FWD_CORE wxFileDropTarget; +class WXDLLIMPEXP_FWD_CORE wxPrivateDropTarget; + +class WXDLLIMPEXP_FWD_CORE wxDropSource; + +//------------------------------------------------------------------------- +// wxDropTarget +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDropTarget: public wxObject +{ +public: + + wxDropTarget(); + virtual ~wxDropTarget(); + + virtual void OnEnter() { } + virtual void OnLeave() { } + virtual bool OnDrop( long x, long y, const void *data, size_t size ) = 0; + + // Override these to indicate what kind of data you support: + + virtual size_t GetFormatCount() const = 0; + virtual wxDataFormat GetFormat(size_t n) const = 0; + + // implementation +}; + +//------------------------------------------------------------------------- +// wxTextDropTarget +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTextDropTarget: public wxDropTarget +{ +public: + + wxTextDropTarget() {} + virtual bool OnDrop( long x, long y, const void *data, size_t size ); + virtual bool OnDropText( long x, long y, const char *psz ); + +protected: + + virtual size_t GetFormatCount() const; + virtual wxDataFormat GetFormat(size_t n) const; +}; + +//------------------------------------------------------------------------- +// wxPrivateDropTarget +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPrivateDropTarget: public wxDropTarget +{ +public: + + wxPrivateDropTarget(); + + // you have to override OnDrop to get at the data + + // the string ID identifies the format of clipboard or DnD data. a word + // processor would e.g. add a wxTextDataObject and a wxPrivateDataObject + // to the clipboard - the latter with the Id "WXWORD_FORMAT". + + void SetId( const wxString& id ) + { m_id = id; } + + wxString GetId() + { return m_id; } + +private: + + virtual size_t GetFormatCount() const; + virtual wxDataFormat GetFormat(size_t n) const; + + wxString m_id; +}; + +// ---------------------------------------------------------------------------- +// A drop target which accepts files (dragged from File Manager or Explorer) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFileDropTarget: public wxDropTarget +{ +public: + + wxFileDropTarget() {} + + virtual bool OnDrop( long x, long y, const void *data, size_t size ); + virtual bool OnDropFiles( long x, long y, + size_t nFiles, const char * const aszFiles[] ); + +protected: + + virtual size_t GetFormatCount() const; + virtual wxDataFormat GetFormat(size_t n) const; +}; + +//------------------------------------------------------------------------- +// wxDropSource +//------------------------------------------------------------------------- + +enum wxDragResult +{ + wxDragError, // error prevented the d&d operation from completing + wxDragNone, // drag target didn't accept the data + wxDragCopy, // the data was successfully copied + wxDragMove, // the data was successfully moved + wxDragCancel // the operation was cancelled by user (not an error) +}; + +class WXDLLIMPEXP_CORE wxDropSource: public wxObject +{ +public: + + wxDropSource( wxWindow *win ); + wxDropSource( wxDataObject &data, wxWindow *win ); + + virtual ~wxDropSource(void); + + void SetData( wxDataObject &data ); + wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly); + + virtual bool GiveFeedback( wxDragResult WXUNUSED(effect), bool WXUNUSED(bScrolling) ) { return TRUE; } + + // implementation +#if 0 + void RegisterWindow(void); + void UnregisterWindow(void); + + wxWindow *m_window; + wxDragResult m_retValue; + wxDataObject *m_data; + + wxCursor m_defaultCursor; + wxCursor m_goaheadCursor; +#endif +}; + +#endif + +// wxUSE_DRAG_AND_DROP + +#endif +//_WX_DND_H_ + diff --git a/lib/wxWidgets/include/wx/x11/font.h b/lib/wxWidgets/include/wx/x11/font.h new file mode 100644 index 0000000..59de475 --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/font.h @@ -0,0 +1,162 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/font.h +// Purpose: wxFont class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONT_H_ +#define _WX_FONT_H_ + +class wxXFont; + +// Font +class WXDLLIMPEXP_CORE wxFont : public wxFontBase +{ +public: + // ctors and such + wxFont() { } + + wxFont(const wxFontInfo& info) + { + Create(info.GetPointSize(), + info.GetFamily(), + info.GetStyle(), + info.GetWeight(), + info.IsUnderlined(), + info.GetFaceName(), + info.GetEncoding()); + + if ( info.IsUsingSizeInPixels() ) + SetPixelSize(info.GetPixelSize()); + } + + wxFont(int size, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + Create(size, family, style, weight, underlined, face, encoding); + } + + wxFont(const wxSize& pixelSize, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + Create(10, family, style, weight, underlined, face, encoding); + SetPixelSize(pixelSize); + } + + bool Create(int size, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + + wxFont(const wxNativeFontInfo& info); + + wxFont(const wxString &nativeInfoString) + { + Create(nativeInfoString); + } + + bool Create(const wxString& fontname, + wxFontEncoding fontenc = wxFONTENCODING_DEFAULT); + + // DELETEME: no longer seems to be implemented. + // bool Create(const wxNativeFontInfo& fontinfo); + + virtual ~wxFont(); + + // implement base class pure virtuals + virtual double GetFractionalPointSize() const; + virtual wxFontStyle GetStyle() const; + virtual int GetNumericWeight() const; + virtual bool GetUnderlined() const; + virtual bool GetStrikethrough() const wxOVERRIDE; + virtual wxString GetFaceName() const; + virtual wxFontEncoding GetEncoding() const; + virtual const wxNativeFontInfo *GetNativeFontInfo() const; + + virtual bool IsFixedWidth() const; + + virtual void SetFractionalPointSize(double pointSize); + virtual void SetFamily(wxFontFamily family); + virtual void SetStyle(wxFontStyle style); + virtual void SetNumericWeight(int weight); + virtual bool SetFaceName(const wxString& faceName); + virtual void SetUnderlined(bool underlined); + virtual void SetStrikethrough(bool strikethrough) wxOVERRIDE; + virtual void SetEncoding(wxFontEncoding encoding); + + wxDECLARE_COMMON_FONT_METHODS(); + + wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants") + wxFont(int size, + int family, + int style, + int weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); + } + + // Implementation + +#if wxUSE_PANGO + // Set Pango attributes in the specified layout. Currently only + // underlined and strike-through attributes are handled by this function. + // + // If neither of them is specified, returns false, otherwise sets up the + // attributes and returns true. + bool SetPangoAttrs(PangoLayout* layout) const; +#else + // Find an existing, or create a new, XFontStruct + // based on this wxFont and the given scale. Append the + // font to list in the private data for future reference. + + // TODO This is a fairly basic implementation, that doesn't + // allow for different facenames, and also doesn't do a mapping + // between 'standard' facenames (e.g. Arial, Helvetica, Times Roman etc.) + // and the fonts that are available on a particular system. + // Maybe we need to scan the user's machine to build up a profile + // of the fonts and a mapping file. + + // Return font struct, and optionally the Motif font list + wxXFont *GetInternalFont(double scale = 1.0, + WXDisplay* display = NULL) const; + + // Helper function for convenient access of the above. + WXFontStructPtr GetFontStruct(double scale = 1.0, + WXDisplay* display = NULL) const; +#endif + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + + virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info ); + virtual wxFontFamily DoGetFamily() const; + + void Unshare(); + +private: + wxDECLARE_DYNAMIC_CLASS(wxFont); +}; + +#endif + // _WX_FONT_H_ diff --git a/lib/wxWidgets/include/wx/x11/glcanvas.h b/lib/wxWidgets/include/wx/x11/glcanvas.h new file mode 100644 index 0000000..356eb00 --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/glcanvas.h @@ -0,0 +1,68 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/glcanvas.h +// Purpose: wxGLCanvas, for using OpenGL with wxWidgets 2.0 for Motif. +// Uses the GLX extension. +// Author: Julian Smart and Wolfram Gloger +// Modified by: +// Created: 1995, 1999 +// Copyright: (c) Julian Smart, Wolfram Gloger +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GLCANVAS_H_ +#define _WX_GLCANVAS_H_ + +#include "wx/unix/glx11.h" + +class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasX11 +{ +public: + wxGLCanvas(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + + explicit // avoid implicitly converting a wxWindow* to wxGLCanvas + wxGLCanvas(wxWindow *parent, + wxWindowID id = wxID_ANY, + const int *attribList = NULL, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + + bool Create(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const int *attribList = NULL, + const wxPalette& palette = wxNullPalette); + + // implement wxGLCanvasX11 methods + // -------------------------------- + + virtual unsigned long GetXWindow() const; + +protected: + virtual int GetColourIndex(const wxColour& col); + + wxDECLARE_CLASS(wxGLCanvas); +}; + +#endif // _WX_GLCANVAS_H_ diff --git a/lib/wxWidgets/include/wx/x11/joystick.h b/lib/wxWidgets/include/wx/x11/joystick.h new file mode 100644 index 0000000..1b982bd --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/joystick.h @@ -0,0 +1,88 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/joystick.h +// Purpose: wxJoystick class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_JOYSTICK_H_ +#define _WX_JOYSTICK_H_ + +#include "wx/event.h" + +class WXDLLIMPEXP_ADV wxJoystick: public wxObject +{ + wxDECLARE_DYNAMIC_CLASS(wxJoystick); +public: +/* +* Public interface + */ + + wxJoystick(int joystick = wxJOYSTICK1) { m_joystick = joystick; } + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + wxPoint GetPosition() const; + int GetZPosition() const; + int GetButtonState() const; + int GetPOVPosition() const; + int GetPOVCTSPosition() const; + int GetRudderPosition() const; + int GetUPosition() const; + int GetVPosition() const; + int GetMovementThreshold() const; + void SetMovementThreshold(int threshold) ; + + // Capabilities + //////////////////////////////////////////////////////////////////////////// + + bool IsOk() const; // Checks that the joystick is functioning + static int GetNumberJoysticks() ; + int GetManufacturerId() const ; + int GetProductId() const ; + wxString GetProductName() const ; + int GetXMin() const; + int GetYMin() const; + int GetZMin() const; + int GetXMax() const; + int GetYMax() const; + int GetZMax() const; + int GetNumberButtons() const; + int GetNumberAxes() const; + int GetMaxButtons() const; + int GetMaxAxes() const; + int GetPollingMin() const; + int GetPollingMax() const; + int GetRudderMin() const; + int GetRudderMax() const; + int GetUMin() const; + int GetUMax() const; + int GetVMin() const; + int GetVMax() const; + + bool HasRudder() const; + bool HasZ() const; + bool HasU() const; + bool HasV() const; + bool HasPOV() const; + bool HasPOV4Dir() const; + bool HasPOVCTS() const; + + // Operations + //////////////////////////////////////////////////////////////////////////// + + // pollingFreq = 0 means that movement events are sent when above the threshold. + // If pollingFreq > 0, events are received every this many milliseconds. + bool SetCapture(wxWindow* win, int pollingFreq = 0); + bool ReleaseCapture(); + +protected: + int m_joystick; +}; + +#endif + // _WX_JOYSTICK_H_ diff --git a/lib/wxWidgets/include/wx/x11/minifram.h b/lib/wxWidgets/include/wx/x11/minifram.h new file mode 100644 index 0000000..3e120dd --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/minifram.h @@ -0,0 +1,41 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/minifram.h +// Purpose: wxMiniFrame class. A small frame for e.g. floating toolbars. +// If there is no equivalent on your platform, just make it a +// normal frame. +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MINIFRAM_H_ +#define _WX_MINIFRAM_H_ + +#include "wx/frame.h" + +class WXDLLIMPEXP_CORE wxMiniFrame: public wxFrame { + + wxDECLARE_DYNAMIC_CLASS(wxMiniFrame); + +public: + inline wxMiniFrame() {} + inline wxMiniFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE|wxTINY_CAPTION, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + // Use wxFrame constructor in absence of more specific code. + Create(parent, id, title, pos, size, style, name); + } + + virtual ~wxMiniFrame() {} +protected: +}; + +#endif + // _WX_MINIFRAM_H_ diff --git a/lib/wxWidgets/include/wx/x11/nanox/X11/Xatom.h b/lib/wxWidgets/include/wx/x11/nanox/X11/Xatom.h new file mode 100644 index 0000000..60fba84 --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/nanox/X11/Xatom.h @@ -0,0 +1,6 @@ + +/* + * Xlib compatibility + */ + +/* Nothing yet */ diff --git a/lib/wxWidgets/include/wx/x11/nanox/X11/Xlib.h b/lib/wxWidgets/include/wx/x11/nanox/X11/Xlib.h new file mode 100644 index 0000000..f1ebf6f --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/nanox/X11/Xlib.h @@ -0,0 +1,356 @@ +/* + * Xlib compatibility + */ + +#ifndef _DUMMY_XLIBH_ +#define _DUMMY_XLIBH_ + +/* Move away the typedef in XtoNX.h */ +#define XFontStruct XFontStruct1 +#include <XtoNX.h> +#undef XFontStruct +#undef XCharStruct + +/* Data types */ + +typedef GR_PALETTE* Colormap; +typedef GR_DRAW_ID Drawable ; +typedef int Status; +typedef unsigned long VisualID; +typedef int Bool; +typedef long XID; +typedef GR_SCANCODE KeySym; +typedef GR_EVENT_KEYSTROKE XKeyEvent; +typedef struct { + GR_FONT_INFO info; + GR_FONT_ID fid; +} XFontStruct; +typedef struct { + short lbearing; /* origin to left edge of raster */ + short rbearing; /* origin to right edge of raster */ + short width; /* advance to next char's origin */ + short ascent; /* baseline to top edge of raster */ + short descent; /* baseline to bottom edge of raster */ + unsigned short attributes; /* per char flags (not predefined) */ +} XCharStruct; + +/* Configure window value mask bits */ +#define CWX (1<<0) +#define CWY (1<<1) +#define CWWidth (1<<2) +#define CWHeight (1<<3) +#define CWBorderWidth (1<<4) +#define CWSibling (1<<5) +#define CWStackMode (1<<6) + +/* Values */ + +typedef struct { + int x, y; + int width, height; + int border_width; + Window sibling; + int stack_mode; +} XWindowChanges; + +/* typedef unsigned long Time; */ + +#define Success 0 +#define GrabSuccess Success +#define GrabNotViewable (Success+1) +#define InputOutput 1 +#define InputOnly 2 +#define IsUnmapped 0 +#define IsUnviewable 1 +#define IsViewable 2 +/* Is this right? */ +#define PropertyChangeMask GR_EVENT_MASK_SELECTION_CHANGED +#define GraphicsExpose GR_EVENT_TYPE_EXPOSURE +#define GraphicsExposeMask GR_EVENT_MASK_EXPOSURE +#define ColormapChangeMask 0 +#define FillSolid 0 +#define LineSolid 0 +#define LineOnOffDash 0 +#define CapNotLast 0 +#define CapRound 0 +#define CapProjecting 0 +#define CapButt 0 +#define JoinRound 0 +#define JoinBevel 0 +#define JoinMiter 0 +#define IncludeInferiors 0 +#define ClipByChildren 0 +#define DoRed 0 +#define DoGreen 0 +#define DoBlue 0 +#define NoEventMask GR_EVENT_MASK_NONE +#define RevertToParent 0 +#define CurrentTime 0 +#define GrabModeAsync 0 + +#define GXcopy GR_MODE_COPY +#define GXclear GR_MODE_CLEAR +#ifndef GXxor +#define GXxor GR_MODE_OR +#endif +#define GXinvert GR_MODE_INVERT +#define GXorReverse GR_MODE_ORREVERSE +#define GXandReverse GR_MODE_ANDREVERSE +#define GXand GR_MODE_AND +#define GXor GR_MODE_OR +#define GXandInverted GR_MODE_ANDINVERTED +#define GXnoop GR_MODE_NOOP +#define GXnor GR_MODE_NOR +#define GXequiv GR_MODE_EQUIV +#define GXcopyInverted GR_MODE_COPYINVERTED +#define GXorInverted GR_MODE_ORINVERTED +#define GXnand GR_MODE_NAND +#define GXset GR_MODE_SET + +#define XSynchronize(display,sync) +#define XDefaultRootWindow(d) GR_ROOT_WINDOW_ID +#define RootWindowOfScreen(s) GR_ROOT_WINDOW_ID +#define XFreePixmap(d, p) GrDestroyWindow(p) +#define XFreeCursor(d, c) GrDestroyCursor(c) +#define XFreeGC(d, gc) GrDestroyGC(gc) +#define XSetBackground(d, gc, c) GrSetGCBackground(gc, c) +#define DefaultVisual(d, s) (NULL) +#define DefaultColormap(d, s) DefaultColormapOfScreen(NULL) +#define DefaultScreenOfDisplay(d) 0 +#define XSetFillStyle(d, gc, s) wxNoop() +#define XSetLineAttributes(d, gc, a, b, c, e) wxNoop() +#define XSetClipMask(d, gc, m) wxNoop() +#define XSetTSOrigin(d, gc, x, y) wxNoop() +#define XFillArc(d, w, gc, x, y, rx, ry, a1, a2) GrArcAngle(w, gc, x, y, rx, ry, a1, a2, GR_PIE) +#define XDrawArc(d, w, gc, x, y, rx, ry, a1, a2) GrArcAngle(w, gc, x, y, rx, ry, a1, a2, GR_ARC) +#define XDrawPoint(d, w, gc, x, y) GrPoint(w, gc, x, y) +#define XFillPolygon(d, w, gc, p, n, s, m) GrFillPoly(w, gc, n, p) +#define XDrawRectangle(d, w, gc, x, y, width, height) GrRect(w, gc, x, y, width, height) +#define XSetClipOrigin(d, gc, x, y) GrSetGCClipOrigin(gc, x, y) +#define XSetRegion(d, gc, r) GrSetGCRegion(gc, r) +#define XSetTile(d, gc, p) wxNoop() +#define XSetStipple(d, gc, p) wxNoop() +#define XSetSubwindowMode(d, gc, mode) wxNoop() +#define XFreeColormap(d, cmap) wxNoop() +#define XSetTransientForHint(d, w, p) wxNoop() +#define XUnionRegion(sr1,sr2,r) GrUnionRegion(r,sr1,sr2) +#define XIntersectRegion(sr1,sr2,r) GrIntersectRegion(r,sr1,sr2) +#define XEqualRegion(r1, r2) GrEqualRegion(r1, r2) +#define XEmptyRegion(r) GrEmptyRegion(r) +#define XOffsetRegion(r, x, y) GrOffsetRegion(r, x, y) +#define XClipBox(r, rect) GrGetRegionBox(r, rect) +#define XPointInRegion(r, x, y) GrPointInRegion(r, x, y) +#define XXorRegion(sr1, sr2, r) GrXorRegion(r, sr1, sr2) +/* TODO: Cannot find equivalent for this. */ +#define XIconifyWindow(d, w, s) 0 +#define XCreateWindowWithColor(d,p,x,y,w,h,bw,depth,cl,vis,backColor,foreColor) \ + GrNewWindow(p,x,y,w,h,bw,backColor,foreColor) +#define XLookupString(event, buf, len, sym, status) (*sym = (event)->scancode) +#define XBell(a, b) GrBell() +#define DisplayWidthMM(d, s) 100 +#define DisplayHeightMM(d, s) 100 + +/* These defines are wrongly defined in XtoNX.h, IMHO, + * since they reference a static global. + * Redefined as functions, below. + */ + +#undef DisplayWidth +#undef DisplayHeight +#undef DefaultDepth + +/* + * Data structure used by color operations + */ +typedef struct { + unsigned long pixel; + unsigned short red, green, blue; + char flags; /* do_red, do_green, do_blue */ + char pad; +} XColor; + +typedef struct { + int type; + Display *display; /* Display the event was read from */ + XID resourceid; /* resource id */ + unsigned long serial; /* serial number of failed request */ + unsigned char error_code; /* error code of failed request */ + unsigned char request_code; /* Major op-code of failed request */ + unsigned char minor_code; /* Minor op-code of failed request */ +} XErrorEvent; + +/* + * Visual structure; contains information about colormapping possible. + */ +typedef struct { + void *ext_data; /* hook for extension to hang data */ + VisualID visualid; /* visual id of this visual */ +#if defined(__cplusplus) || defined(c_plusplus) + int c_class; /* C++ class of screen (monochrome, etc.) */ +#else + int class; /* class of screen (monochrome, etc.) */ +#endif + unsigned long red_mask, green_mask, blue_mask; /* mask values */ + int bits_per_rgb; /* log base 2 of distinct color values */ + int map_entries; /* color map entries */ +} Visual; + +/* + * Depth structure; contains information for each possible depth. + */ +typedef struct { + int depth; /* this depth (Z) of the depth */ + int nvisuals; /* number of Visual types at this depth */ + Visual *visuals; /* list of visuals possible at this depth */ +} Depth; + +/* + * Information about the screen. The contents of this structure are + * implementation dependent. A Screen should be treated as opaque + * by application code. + */ + +struct _XDisplay; /* Forward declare before use for C++ */ + +typedef struct { + void *ext_data; /* hook for extension to hang data */ + struct _XDisplay *display; /* back pointer to display structure */ + Window root; /* Root window id. */ + int width, height; /* width and height of screen */ + int mwidth, mheight; /* width and height of in millimeters */ + int ndepths; /* number of depths possible */ + Depth *depths; /* list of allowable depths on the screen */ + int root_depth; /* bits per pixel */ + Visual *root_visual; /* root visual */ + GC default_gc; /* GC for the root root visual */ + Colormap cmap; /* default color map */ + unsigned long white_pixel; + unsigned long black_pixel; /* White and Black pixel values */ + int max_maps, min_maps; /* max and min color maps */ + int backing_store; /* Never, WhenMapped, Always */ + Bool save_unders; + long root_input_mask; /* initial root input mask */ +} Screen; + + +typedef struct { + int x, y; /* location of window */ + int width, height; /* width and height of window */ + int border_width; /* border width of window */ + int depth; /* depth of window */ + Visual *visual; /* the associated visual structure */ + Window root; /* root of screen containing window */ + int _class; /* InputOutput, InputOnly*/ + int bit_gravity; /* one of the bit gravity values */ + int win_gravity; /* one of the window gravity values */ + int backing_store; /* NotUseful, WhenMapped, Always */ + unsigned long backing_planes;/* planes to be preserved if possible */ + unsigned long backing_pixel;/* value to be used when restoring planes */ + Bool save_under; /* boolean, should bits under be saved? */ + Colormap colormap; /* color map to be associated with window */ + Bool map_installed; /* boolean, is color map currently installed*/ + int map_state; /* IsUnmapped, IsUnviewable, IsViewable */ + long all_event_masks; /* set of events all people have interest in*/ + long your_event_mask; /* my event mask */ + long do_not_propagate_mask;/* set of events that should not propagate */ + Bool override_redirect; /* boolean value for override-redirect */ + Screen *screen; /* back pointer to correct screen */ +} XWindowAttributes; + +typedef int (*XErrorHandler) (/* WARNING, this type not in Xlib spec */ + Display* /* display */, + XErrorEvent* /* error_event */ +); + +/* events*/ + +/* What should this be? */ +#if 0 +#ifndef ResizeRequest +#define ResizeRequest ?? +#endif +#endif + +#ifndef MotionNotify +#define MotionNotify GR_EVENT_TYPE_MOUSE_POSITION +#define PointerMotionMask GR_EVENT_MASK_MOUSE_POSITION +#endif + +#define ButtonMotionMask GR_EVENT_MASK_MOUSE_POSITION +#define KeymapStateMask 0 +#define StructureNotifyMask GR_EVENT_MASK_UPDATE + +#ifdef ConfigureNotify +/* XtoNX.h gets it wrong */ +#undef ConfigureNotify +#endif +#define ConfigureNotify GR_EVENT_TYPE_UPDATE + +#ifndef FocusIn +#define FocusIn GR_EVENT_TYPE_FOCUS_IN +#define FocusOut GR_EVENT_TYPE_FOCUS_OUT +#define FocusChangeMask GR_EVENT_MASK_FOCUS_IN|GR_EVENT_MASK_FOCUS_OUT +#endif + +/* Fuunctions */ + +#ifdef __cplusplus +extern "C" { +#endif + +Display *XOpenDisplay(char *name); +Colormap DefaultColormapOfScreen(Screen* /* screen */) ; +int XSetGraphicsExposures( Display* /* display */, GC /* gc */, Bool /* graphics_exposures */) ; +int XWarpPointer( Display* /* display */, Window /* srcW */, Window /* destW */, + int /* srcX */, int /* srcY */, + unsigned int /* srcWidth */, + unsigned int /* srcHeight */, + int destX, int destY); +int XSetInputFocus(Display* /* display */, Window focus, int /* revert_to */, Time /* time */) ; +int XGetInputFocus(Display* /* display */, Window* /* focus_return */, int* /* revert_to_return */) ; +int XGrabPointer(Display* /* display */, Window /* grab_window */, + Bool /* owner_events */, unsigned int /* event_mask */, + int /* pointer_mode */, int /* keyboard_mode */, + Window /* confine_to */, Cursor /* cursor */, Time /* time */) ; +int XUngrabPointer(Display* /* display */, Time /* time */) ; +int XCopyArea(Display* /* display */, Drawable src, Drawable dest, GC gc, + int src_x, int src_y, unsigned int width, unsigned int height, + int dest_x, int dest_y) ; +int XCopyPlane(Display* /* display */, Drawable src, Drawable dest, GC gc, + int src_x, int src_y, unsigned int width, unsigned int height, + int dest_x, int dest_y, unsigned long /* plane */) ; + +XErrorHandler XSetErrorHandler (XErrorHandler /* handler */); +Screen *XScreenOfDisplay(Display* /* display */, + int /* screen_number */); +int DisplayWidth(Display* /* display */, int /* screen */); +int DisplayHeight(Display* /* display */, int /* screen */); +int DefaultDepth(Display* /* display */, int /* screen */); +int XAllocColor(Display* /* display */, Colormap /* cmap */, + XColor* color); +int XParseColor(Display* display, Colormap cmap, + const char* cname, XColor* color); +int XDrawLine(Display* display, Window win, GC gc, + int x1, int y1, int x2, int y2); +int XTextExtents( XFontStruct* font, char* s, int len, int* direction, + int* ascent, int* descent2, XCharStruct* overall); +int XPending(Display *d); +XFontStruct* XLoadQueryFont(Display* display, const char* fontSpec); +int XFreeFont(Display* display, XFontStruct* fontStruct); +int XQueryColor(Display* display, Colormap cmap, XColor* color); +Status XGetWindowAttributes(Display* display, Window w, + XWindowAttributes* window_attributes); + +int XConfigureWindow(Display* display, Window w, int mask, XWindowChanges* changes); +int XTranslateCoordinates(Display* display, Window srcWindow, Window destWindow, int srcX, int srcY, int* destX, int* destY, Window* childReturn); + +void wxNoop(); + +#ifdef __cplusplus +} +#endif + +#define XMaxRequestSize(display) 16384 + +#endif + /* _DUMMY_XLIBH_ */ diff --git a/lib/wxWidgets/include/wx/x11/nanox/X11/Xutil.h b/lib/wxWidgets/include/wx/x11/nanox/X11/Xutil.h new file mode 100644 index 0000000..adf6bea --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/nanox/X11/Xutil.h @@ -0,0 +1,5 @@ +/* + * Xlib compatibility + */ + +/* Nothing yet */ diff --git a/lib/wxWidgets/include/wx/x11/palette.h b/lib/wxWidgets/include/wx/x11/palette.h new file mode 100644 index 0000000..9c1ca7f --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/palette.h @@ -0,0 +1,75 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/palette.h +// Purpose: wxPalette class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PALETTE_H_ +#define _WX_PALETTE_H_ + +#include "wx/list.h" + +class WXDLLIMPEXP_FWD_CORE wxPalette; + +// Palette for one display +class wxXPalette : public wxObject +{ + wxDECLARE_DYNAMIC_CLASS(wxXPalette); + +public: + wxXPalette(); + + WXDisplay* m_display; + int m_pix_array_n; + unsigned char* m_red; + unsigned char* m_green; + unsigned char* m_blue; + unsigned long* m_pix_array; + WXColormap m_cmap; + bool m_destroyable; +}; + +class WXDLLIMPEXP_CORE wxPaletteRefData: public wxGDIRefData +{ + friend class WXDLLIMPEXP_FWD_CORE wxPalette; +public: + wxPaletteRefData(); + virtual ~wxPaletteRefData(); + +protected: + wxList m_palettes; +}; + +#define M_PALETTEDATA ((wxPaletteRefData *)m_refData) + +class WXDLLIMPEXP_CORE wxPalette : public wxPaletteBase +{ + wxDECLARE_DYNAMIC_CLASS(wxPalette); + +public: + wxPalette(); + + wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); + virtual ~wxPalette(); + bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); + int GetPixel(unsigned char red, unsigned char green, unsigned char blue) const; + bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const; + + // X-specific + WXColormap GetXColormap(WXDisplay* display = NULL) const; + bool TransferBitmap(void *data, int depth, int size); + bool TransferBitmap8(unsigned char *data, unsigned long size, void *dest, unsigned int bpp); + unsigned long *GetXPixArray(WXDisplay* display, int *pix_array_n); + void PutXColormap(WXDisplay* display, WXColormap cmap, bool destroyable); + virtual int GetColoursCount() const wxOVERRIDE; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; +}; + +#endif // _WX_PALETTE_H_ diff --git a/lib/wxWidgets/include/wx/x11/pen.h b/lib/wxWidgets/include/wx/x11/pen.h new file mode 100644 index 0000000..bb3f9dc --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/pen.h @@ -0,0 +1,79 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/pen.h +// Purpose: wxPen class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PEN_H_ +#define _WX_PEN_H_ + +#include "wx/gdicmn.h" +#include "wx/gdiobj.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxPen; +class WXDLLIMPEXP_FWD_CORE wxColour; +class WXDLLIMPEXP_FWD_CORE wxBitmap; + +typedef char wxX11Dash; + +//----------------------------------------------------------------------------- +// wxPen +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPen: public wxPenBase +{ +public: + wxPen() { } + + wxPen( const wxColour &colour, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID ); + + wxPen( const wxBitmap &stipple, int width ); + + wxPen( const wxPenInfo& info ); + + virtual ~wxPen(); + + bool operator == ( const wxPen& pen ) const; + bool operator != (const wxPen& pen) const { return !(*this == pen); } + + void SetColour( const wxColour &colour ); + void SetColour( unsigned char red, unsigned char green, unsigned char blue ); + void SetCap( wxPenCap capStyle ); + void SetJoin( wxPenJoin joinStyle ); + void SetStyle( wxPenStyle style ); + void SetWidth( int width ); + void SetDashes( int number_of_dashes, const wxDash *dash ); + void SetStipple( const wxBitmap& stipple ); + + wxColour GetColour() const; + wxPenCap GetCap() const; + wxPenJoin GetJoin() const; + wxPenStyle GetStyle() const; + int GetWidth() const; + int GetDashes(wxDash **ptr) const; + int GetDashCount() const; + wxDash* GetDash() const; + wxBitmap* GetStipple() const; + + + wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") + wxPen(const wxColour& col, int width, int style); + wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") + void SetStyle(int style) { SetStyle((wxPenStyle)style); } + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + + wxDECLARE_DYNAMIC_CLASS(wxPen); +}; + +#endif // _WX_PEN_H_ diff --git a/lib/wxWidgets/include/wx/x11/popupwin.h b/lib/wxWidgets/include/wx/x11/popupwin.h new file mode 100644 index 0000000..c1435a5 --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/popupwin.h @@ -0,0 +1,45 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/popupwin.h +// Purpose: +// Author: Robert Roebling +// Created: +// Copyright: (c) 2001 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKPOPUPWINH__ +#define __GTKPOPUPWINH__ + +#include "wx/defs.h" +#include "wx/panel.h" +#include "wx/icon.h" + +//----------------------------------------------------------------------------- +// wxPopUpWindow +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPopupWindow: public wxPopupWindowBase +{ +public: + wxPopupWindow() { } + virtual ~wxPopupWindow() ; + + wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE) + { (void)Create(parent, flags); } + + bool Create(wxWindow *parent, int flags = wxBORDER_NONE); + + virtual bool Show( bool show = TRUE ); + +protected: + virtual void DoMoveWindow(int x, int y, int width, int height); + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + +private: + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxPopupWindow); +}; + +#endif // __GTKPOPUPWINDOWH__ diff --git a/lib/wxWidgets/include/wx/x11/print.h b/lib/wxWidgets/include/wx/x11/print.h new file mode 100644 index 0000000..82970f7 --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/print.h @@ -0,0 +1,51 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/print.h +// Purpose: wxPrinter, wxPrintPreview classes +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRINT_H_ +#define _WX_PRINT_H_ + +#include "wx/prntbase.h" + +/* +* Represents the printer: manages printing a wxPrintout object +*/ + +class WXDLLIMPEXP_CORE wxPrinter: public wxPrinterBase +{ + wxDECLARE_DYNAMIC_CLASS(wxPrinter); + +public: + wxPrinter(wxPrintData *data = NULL); + virtual ~wxPrinter(); + + virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = TRUE); + virtual bool PrintDialog(wxWindow *parent); + virtual bool Setup(wxWindow *parent); +}; + +/* +* wxPrintPreview +* Programmer creates an object of this class to preview a wxPrintout. +*/ + +class WXDLLIMPEXP_CORE wxPrintPreview: public wxPrintPreviewBase +{ + wxDECLARE_CLASS(wxPrintPreview); + +public: + wxPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting = NULL, wxPrintData *data = NULL); + virtual ~wxPrintPreview(); + + virtual bool Print(bool interactive); + virtual void DetermineScaling(); +}; + +#endif + // _WX_PRINT_H_ diff --git a/lib/wxWidgets/include/wx/x11/private.h b/lib/wxWidgets/include/wx/x11/private.h new file mode 100644 index 0000000..d1436ae --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/private.h @@ -0,0 +1,83 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/private.h +// Purpose: Private declarations for X11 port +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_H_ +#define _WX_PRIVATE_H_ + +#include "wx/defs.h" +#include "wx/hashmap.h" +#include "wx/utils.h" +#if defined( __cplusplus ) && defined( __VMS ) +#pragma message disable nosimpint +#endif +#include "X11/Xlib.h" +#include "X11/Xatom.h" +#include "X11/Xutil.h" +#if defined( __cplusplus ) && defined( __VMS ) +#pragma message enable nosimpint +#endif + +// Include common declarations +#include "wx/x11/privx.h" + +#if wxUSE_PANGO +#include <pango/pango.h> +#endif + +class WXDLLIMPEXP_FWD_CORE wxMouseEvent; +class WXDLLIMPEXP_FWD_CORE wxKeyEvent; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +// ---------------------------------------------------------------------------- +// Some Unicode <-> UTF8 macros stolen from GTK +// ---------------------------------------------------------------------------- + +#if wxUSE_UNICODE + #define wxGTK_CONV(s) wxConvUTF8.cWX2MB(s) + #define wxGTK_CONV_BACK(s) wxConvUTF8.cMB2WX(s) +#else + #define wxGTK_CONV(s) s.c_str() + #define wxGTK_CONV_BACK(s) s +#endif + +// ---------------------------------------------------------------------------- +// we maintain a hash table which contains the mapping from Widget to wxWindow +// corresponding to the window for this widget +// ---------------------------------------------------------------------------- + +WX_DECLARE_HASH_MAP(Window, wxWindow *, wxIntegerHash, wxIntegerEqual, wxWindowHash); + +// these hashes are defined in app.cpp +extern wxWindowHash *wxWidgetHashTable; +extern wxWindowHash *wxClientWidgetHashTable; + +extern void wxDeleteWindowFromTable(Window w); +extern wxWindow *wxGetWindowFromTable(Window w); +extern bool wxAddWindowToTable(Window w, wxWindow *win); + +extern void wxDeleteClientWindowFromTable(Window w); +extern wxWindow *wxGetClientWindowFromTable(Window w); +extern bool wxAddClientWindowToTable(Window w, wxWindow *win); + +// ---------------------------------------------------------------------------- +// TranslateXXXEvent() functions - translate X event to wxWindow one +// ---------------------------------------------------------------------------- +extern bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Window window, XEvent *xevent); +extern bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Window window, XEvent *xevent, bool isAscii = FALSE); + +extern Window wxGetWindowParent(Window window); + +// Set the window manager decorations according to the +// given wxWidgets style +bool wxSetWMDecorations(Window w, long style); +bool wxMWMIsRunning(Window w); + +#endif +// _WX_PRIVATE_H_ diff --git a/lib/wxWidgets/include/wx/x11/private/wrapxkb.h b/lib/wxWidgets/include/wx/x11/private/wrapxkb.h new file mode 100644 index 0000000..d13100e --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/private/wrapxkb.h @@ -0,0 +1,24 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/private/wrapxkb.h +// Purpose: Private header wrapping X11/XKBlib.h inclusion. +// Author: Vadim Zeitlin +// Created: 2012-05-07 +// Copyright: (c) 2012 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _X11_PRIVATE_WRAPXKB_H_ +#define _X11_PRIVATE_WRAPXKB_H_ + +#ifdef HAVE_X11_XKBLIB_H + /* under HP-UX and Solaris 2.6, at least, XKBlib.h defines structures with + * field named "explicit" - which is, of course, an error for a C++ + * compiler. To be on the safe side, just redefine it everywhere. */ + #define explicit __wx_explicit + + #include <X11/XKBlib.h> + + #undef explicit +#endif // HAVE_X11_XKBLIB_H + +#endif // _X11_PRIVATE_WRAPXKB_H_ diff --git a/lib/wxWidgets/include/wx/x11/privx.h b/lib/wxWidgets/include/wx/x11/privx.h new file mode 100644 index 0000000..c4de802 --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/privx.h @@ -0,0 +1,169 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/privx.h +// Purpose: Private declarations common to X11 and Motif ports +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVX_H_ +#define _WX_PRIVX_H_ + +#include "wx/defs.h" +#include "wx/utils.h" +#include "wx/colour.h" + +#if defined( __cplusplus ) && defined( __VMS ) +#pragma message disable nosimpint +#endif +#include "X11/Xlib.h" +#include "X11/Xatom.h" +#include "X11/Xutil.h" +#if defined( __cplusplus ) && defined( __VMS ) +#pragma message enable nosimpint +#endif + +class WXDLLIMPEXP_FWD_CORE wxMouseEvent; +class WXDLLIMPEXP_FWD_CORE wxKeyEvent; +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxRegion; + +// ---------------------------------------------------------------------------- +// key events related functions +// ---------------------------------------------------------------------------- + +WXPixel wxGetBestMatchingPixel(Display *display, XColor *desiredColor, Colormap cmap); +Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap ); + +extern XColor g_itemColors[]; +extern int wxComputeColours (Display *display, const wxColour * back, const wxColour * fore); + +// For convenience +inline Display* wxGlobalDisplay() { return (Display*) wxGetDisplay(); } + +#define wxMAX_RGB 0xff +#define wxMAX_SV 1000 +#define wxSIGN(x) ((x < 0) ? -x : x) +#define wxH_WEIGHT 4 +#define wxS_WEIGHT 1 +#define wxV_WEIGHT 2 + +typedef struct wx_hsv { + int h,s,v; + } wxHSV; + +#define wxMax3(x,y,z) ((x > y) ? ((x > z) ? x : z) : ((y > z) ? y : z)) +#define wxMin3(x,y,z) ((x < y) ? ((x < z) ? x : z) : ((y < z) ? y : z)) + +void wxHSVToXColor(wxHSV *hsv,XColor *xcolor); +void wxXColorToHSV(wxHSV *hsv,XColor *xcolor); +void wxAllocNearestColor(Display *display,Colormap colormap,XColor *xcolor); +void wxAllocColor(Display *display,Colormap colormap,XColor *xcolor); + +// For debugging +wxString wxGetXEventName(XEvent& event); + +#if wxUSE_NANOX +#define XEventGetWindow(event) event->general.wid +#define XEventGetType(event) event->general.type +#define XConfigureEventGetX(event) ((int) event->update.x) +#define XConfigureEventGetY(event) ((int) event->update.y) +#define XConfigureEventGetWidth(event) ((int) event->update.width) +#define XConfigureEventGetHeight(event) ((int) event->update.height) +#define XExposeEventGetX(event) event->exposure.x +#define XExposeEventGetY(event) event->exposure.y +#define XExposeEventGetWidth(event) event->exposure.width +#define XExposeEventGetHeight(event) event->exposure.height +#define XButtonEventGetTime(event) (wxGetLocalTime()) +#define XButtonEventLChanged(event) (event->button.changebuttons & GR_BUTTON_L) +#define XButtonEventMChanged(event) (event->button.changebuttons & GR_BUTTON_M) +#define XButtonEventRChanged(event) (event->button.changebuttons & GR_BUTTON_R) +#define XButtonEventLIsDown(x) ((x)->button.buttons & GR_BUTTON_L) +#define XButtonEventMIsDown(x) ((x)->button.buttons & GR_BUTTON_M) +#define XButtonEventRIsDown(x) ((x)->button.buttons & GR_BUTTON_R) +#define XButtonEventShiftIsDown(x) (x->button.modifiers & MWKMOD_SHIFT) +#define XButtonEventCtrlIsDown(x) (x->button.modifiers & MWKMOD_CTRL) +#define XButtonEventAltIsDown(x) (x->button.modifiers & MWKMOD_ALT) +#define XButtonEventMetaIsDown(x) (x->button.modifiers & MWKMOD_META) +#define XButtonEventGetX(event) (event->button.x) +#define XButtonEventGetY(event) (event->button.y) +#define XKeyEventGetTime(event) (wxGetLocalTime()) +#define XKeyEventGetX(event) (event->keystroke.x) +#define XKeyEventGetY(event) (event->keystroke.y) +#define XKeyEventShiftIsDown(x) (x->keystroke.modifiers & MWKMOD_SHIFT) +#define XKeyEventCtrlIsDown(x) (x->keystroke.modifiers & MWKMOD_CTRL) +#define XKeyEventAltIsDown(x) (x->keystroke.modifiers & MWKMOD_ALT) +#define XKeyEventMetaIsDown(x) (x->keystroke.modifiers & MWKMOD_META) +#define XFontStructGetAscent(f) f->info.baseline + +#else + +#define XEventGetWindow(event) event->xany.window +#define XEventGetType(event) event->xany.type +#define XConfigureEventGetX(event) event->xconfigure.x +#define XConfigureEventGetY(event) event->xconfigure.y +#define XConfigureEventGetWidth(event) event->xconfigure.width +#define XConfigureEventGetHeight(event) event->xconfigure.height +#define XExposeEventGetX(event) event->xexpose.x +#define XExposeEventGetY(event) event->xexpose.y +#define XExposeEventGetWidth(event) event->xexpose.width +#define XExposeEventGetHeight(event) event->xexpose.height +#define XButtonEventGetTime(event) (event->xbutton.time) +#define XButtonEventLChanged(event) (event->xbutton.button == Button1) +#define XButtonEventMChanged(event) (event->xbutton.button == Button2) +#define XButtonEventRChanged(event) (event->xbutton.button == Button3) +#define XButtonEventLIsDown(x) ((x)->xbutton.state & Button1Mask) +#define XButtonEventMIsDown(x) ((x)->xbutton.state & Button2Mask) +#define XButtonEventRIsDown(x) ((x)->xbutton.state & Button3Mask) +#define XButtonEventShiftIsDown(x) (x->xbutton.state & ShiftMask) +#define XButtonEventCtrlIsDown(x) (x->xbutton.state & ControlMask) +#define XButtonEventAltIsDown(x) (x->xbutton.state & Mod3Mask) +#define XButtonEventMetaIsDown(x) (x->xbutton.state & Mod1Mask) +#define XButtonEventGetX(event) (event->xbutton.x) +#define XButtonEventGetY(event) (event->xbutton.y) +#define XKeyEventGetTime(event) (event->xkey.time) +#define XKeyEventShiftIsDown(x) (x->xkey.state & ShiftMask) +#define XKeyEventCtrlIsDown(x) (x->xkey.state & ControlMask) +#define XKeyEventAltIsDown(x) (x->xkey.state & Mod3Mask) +#define XKeyEventMetaIsDown(x) (x->xkey.state & Mod1Mask) +#define XKeyEventGetX(event) (event->xkey.x) +#define XKeyEventGetY(event) (event->xkey.y) +#define XFontStructGetAscent(f) f->ascent +#endif + +// ---------------------------------------------------------------------------- +// Misc functions +// ---------------------------------------------------------------------------- + +bool wxDoSetShape( Display* xdisplay, Window xwindow, const wxRegion& region ); + +class WXDLLIMPEXP_CORE wxXVisualInfo +{ +public: + wxXVisualInfo(); + ~wxXVisualInfo(); + void Init( Display* dpy, XVisualInfo* visualInfo ); + + int m_visualType; // TrueColor, DirectColor etc. + int m_visualDepth; + int m_visualColormapSize; + void *m_visualColormap; + int m_visualScreen; + unsigned long m_visualRedMask; + unsigned long m_visualGreenMask; + unsigned long m_visualBlueMask; + int m_visualRedShift; + int m_visualGreenShift; + int m_visualBlueShift; + int m_visualRedPrec; + int m_visualGreenPrec; + int m_visualBluePrec; + + unsigned char *m_colorCube; +}; + +bool wxFillXVisualInfo( wxXVisualInfo* vi, Display* dpy ); + +#endif // _WX_PRIVX_H_ diff --git a/lib/wxWidgets/include/wx/x11/region.h b/lib/wxWidgets/include/wx/x11/region.h new file mode 100644 index 0000000..62779bd --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/region.h @@ -0,0 +1,122 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/region.h +// Purpose: wxRegion class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart, Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_REGION_H_ +#define _WX_REGION_H_ + +#include "wx/list.h" + +// ---------------------------------------------------------------------------- +// wxRegion +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxRegion : public wxRegionBase +{ +public: + wxRegion() { } + + wxRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h ) + { + InitRect(x, y, w, h); + } + + wxRegion( const wxPoint& topLeft, const wxPoint& bottomRight ) + { + InitRect(topLeft.x, topLeft.y, + bottomRight.x - topLeft.x, bottomRight.y - topLeft.y); + } + + wxRegion( const wxRect& rect ) + { + InitRect(rect.x, rect.y, rect.width, rect.height); + } + + wxRegion( size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE ); + + wxRegion( const wxBitmap& bmp) + { + Union(bmp); + } + wxRegion( const wxBitmap& bmp, + const wxColour& transColour, int tolerance = 0) + { + Union(bmp, transColour, tolerance); + } + + virtual ~wxRegion(); + + // wxRegionBase methods + virtual void Clear(); + virtual bool IsEmpty() const; + +public: + WXRegion *GetX11Region() const; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + + // wxRegionBase pure virtuals + virtual bool DoIsEqual(const wxRegion& region) const; + virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const; + virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const; + virtual wxRegionContain DoContainsRect(const wxRect& rect) const; + + virtual bool DoOffset(wxCoord x, wxCoord y); + virtual bool DoUnionWithRect(const wxRect& rect); + virtual bool DoUnionWithRegion(const wxRegion& region); + virtual bool DoIntersect(const wxRegion& region); + virtual bool DoSubtract(const wxRegion& region); + virtual bool DoXor(const wxRegion& region); + + // common part of ctors for a rectangle region + void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h); + +private: + wxDECLARE_DYNAMIC_CLASS(wxRegion); +}; + +// ---------------------------------------------------------------------------- +// wxRegionIterator: decomposes a region into rectangles +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxRegionIterator: public wxObject +{ +public: + wxRegionIterator(); + wxRegionIterator(const wxRegion& region); + + void Reset() { m_current = 0u; } + void Reset(const wxRegion& region); + + operator bool () const; + bool HaveRects() const; + + void operator ++ (); + void operator ++ (int); + + wxCoord GetX() const; + wxCoord GetY() const; + wxCoord GetW() const; + wxCoord GetWidth() const { return GetW(); } + wxCoord GetH() const; + wxCoord GetHeight() const { return GetH(); } + wxRect GetRect() const; + +private: + size_t m_current; + wxRegion m_region; + +private: + wxDECLARE_DYNAMIC_CLASS(wxRegionIterator); +}; + +#endif +// _WX_REGION_H_ diff --git a/lib/wxWidgets/include/wx/x11/reparent.h b/lib/wxWidgets/include/wx/x11/reparent.h new file mode 100644 index 0000000..43a1b8d --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/reparent.h @@ -0,0 +1,66 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/reparent.h +// Purpose: Reparenting classes +// Author: Julian Smart +// Modified by: +// Created: 2002-03-09 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_REPARENT_H_ +#define _WX_REPARENT_H_ + +#include "wx/window.h" + +/* + * This class helps to reparent a specific window + */ + +class WXDLLIMPEXP_FWD_CORE wxAdoptedWindow; +class WXDLLIMPEXP_CORE wxReparenter: public wxObject +{ +public: + wxReparenter() {} + + // We assume that toReparent has had its X window set + // appropriately. toReparent is typically a wxAdoptedWindow. + bool Reparent(wxWindow* newParent, wxAdoptedWindow* toReparent); + + // Wait for an appropriate window to be created. + // If exactMatch is FALSE, a substring match is OK. + // If windowName is empty, then wait for the next overrideRedirect window. + bool WaitAndReparent(wxWindow* newParent, wxAdoptedWindow* toReparent, + const wxString& windowName = wxEmptyString, + bool exactMatch = TRUE); + +protected: + + bool ProcessXEvent(WXEvent* event); + WXWindow FindAClientWindow(WXWindow window, const wxString& name); + + static bool sm_done; + static wxAdoptedWindow* sm_toReparent; + static wxWindow* sm_newParent; + static wxString sm_name; + static bool sm_exactMatch; +}; + +/* + * A window that adopts its handle from the native + * toolkit. It has no parent until reparented. + */ + +class WXDLLIMPEXP_CORE wxAdoptedWindow: public wxWindow +{ + public: + wxAdoptedWindow(); + wxAdoptedWindow(WXWindow window); + virtual ~wxAdoptedWindow(); + + void SetHandle(WXWindow window) { m_mainWindow = window; m_clientWindow = window; } + WXWindow GetHandle() const { return X11GetMainWindow(); } +}; + +#endif +// _WX_REPARENT_H_ diff --git a/lib/wxWidgets/include/wx/x11/textctrl.h b/lib/wxWidgets/include/wx/x11/textctrl.h new file mode 100644 index 0000000..b624964 --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/textctrl.h @@ -0,0 +1,385 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/textctrl.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __X11TEXTCTRLH__ +#define __X11TEXTCTRLH__ + +// Set to 1 to use wxUniv's implementation, 0 +// to use wxX11's. +#define wxUSE_UNIV_TEXTCTRL 1 + +#if wxUSE_UNIV_TEXTCTRL +#include "wx/univ/textctrl.h" +#else + +#include "wx/scrolwin.h" +#include "wx/arrstr.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; + +//----------------------------------------------------------------------------- +// helpers +//----------------------------------------------------------------------------- + +enum wxSourceUndo +{ + wxSOURCE_UNDO_LINE, + wxSOURCE_UNDO_ENTER, + wxSOURCE_UNDO_BACK, + wxSOURCE_UNDO_INSERT_LINE, + wxSOURCE_UNDO_DELETE, + wxSOURCE_UNDO_PASTE +}; + +class wxSourceUndoStep: public wxObject +{ +public: + wxSourceUndoStep( wxSourceUndo type, int y1, int y2, wxTextCtrl *owner ); + + void Undo(); + + wxSourceUndo m_type; + int m_y1; + int m_y2; + int m_cursorX; + int m_cursorY; + wxTextCtrl *m_owner; + wxString m_text; + wxArrayString m_lines; +}; + +class wxSourceLine +{ +public: + wxSourceLine( const wxString &text = wxEmptyString ) + { + m_text = text; + } + + wxString m_text; +}; + +WX_DECLARE_OBJARRAY(wxSourceLine, wxSourceLineArray); + +enum wxSourceLanguage +{ + wxSOURCE_LANG_NONE, + wxSOURCE_LANG_CPP, + wxSOURCE_LANG_PERL, + wxSOURCE_LANG_PYTHON +}; + +//----------------------------------------------------------------------------- +// wxTextCtrl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTextCtrl: public wxTextCtrlBase, public wxScrollHelper +{ +public: + wxTextCtrl() { Init(); } + wxTextCtrl(wxWindow *parent, + wxWindowID id, + const wxString &value = wxEmptyString, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString &name = wxASCII_STR(wxTextCtrlNameStr)); + virtual ~wxTextCtrl(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString &value = wxEmptyString, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString &name = wxASCII_STR(wxTextCtrlNameStr)); + + // required for scrolling with wxScrollHelper + // ------------------------------------------ + + virtual void PrepareDC(wxDC& dc) { DoPrepareDC(dc); } + + // implement base class pure virtuals + // ---------------------------------- + + virtual void ChangeValue(const wxString &value); + + virtual int GetLineLength(long lineNo) const; + virtual wxString GetLineText(long lineNo) const; + virtual int GetNumberOfLines() const; + + virtual bool IsModified() const; + virtual bool IsEditable() const; + + // more readable flag testing methods + // ---------------------------------- + + bool IsPassword() const { return (GetWindowStyle() & wxTE_PASSWORD) != 0; } + bool WrapLines() const { return false; } + + // If the return values from and to are the same, there is no selection. + virtual void GetSelection(long* from, long* to) const; + + // operations + // ---------- + + // editing + virtual void Clear(); + virtual void Replace(long from, long to, const wxString& value); + virtual void Remove(long from, long to); + + // clears the dirty flag + virtual void DiscardEdits(); + + virtual void SetMaxLength(unsigned long len); + + // writing text inserts it at the current position, appending always + // inserts it at the end + virtual void WriteText(const wxString& text); + virtual void AppendText(const wxString& text); + + // apply text attribute to the range of text (only works with richedit + // controls) + virtual bool SetStyle(long start, long end, const wxTextAttr& style); + + // translate between the position (which is just an index in the text ctrl + // considering all its contents as a single strings) and (x, y) coordinates + // which represent column and line. + virtual long XYToPosition(long x, long y) const; + virtual bool PositionToXY(long pos, long *x, long *y) const; + + virtual void ShowPosition(long pos); + + // Clipboard operations + virtual void Copy(); + virtual void Cut(); + virtual void Paste(); + + // Undo/redo + virtual void Undo(); + virtual void Redo() {} + + virtual bool CanUndo() const { return (m_undos.GetCount() > 0); } + virtual bool CanRedo() const { return false; } + + // Insertion point + virtual void SetInsertionPoint(long pos); + virtual void SetInsertionPointEnd(); + virtual long GetInsertionPoint() const; + virtual wxTextPos GetLastPosition() const; + + virtual void SetSelection(long from, long to); + virtual void SetEditable(bool editable); + + virtual bool Enable( bool enable = true ); + + void OnCut(wxCommandEvent& event); + void OnCopy(wxCommandEvent& event); + void OnPaste(wxCommandEvent& event); + void OnUndo(wxCommandEvent& event); + void OnRedo(wxCommandEvent& event); + + void OnUpdateCut(wxUpdateUIEvent& event); + void OnUpdateCopy(wxUpdateUIEvent& event); + void OnUpdatePaste(wxUpdateUIEvent& event); + void OnUpdateUndo(wxUpdateUIEvent& event); + void OnUpdateRedo(wxUpdateUIEvent& event); + + bool SetFont(const wxFont& font); + bool SetForegroundColour(const wxColour& colour); + bool SetBackgroundColour(const wxColour& colour); + + void SetModified() { m_modified = true; } + + // textctrl specific scrolling + virtual bool ScrollLines(int lines); + virtual bool ScrollPages(int pages); + + // not part of the wxTextCtrl API from now on.. + + void SetLanguage( wxSourceLanguage lang = wxSOURCE_LANG_NONE ); + + void Delete(); + void DeleteLine(); + + void Indent(); + void Unindent(); + + bool HasSelection(); + void ClearSelection(); + + int GetCursorX() { return m_cursorX; } + int GetCursorY() { return m_cursorY; } + bool IsModified() { return m_modified; } + bool OverwriteMode() { return m_overwrite; } + + // implementation from now on... + + int PosToPixel( int line, int pos ); + int PixelToPos( int line, int pixel ); + + void SearchForBrackets(); + + void DoChar( char c ); + void DoBack(); + void DoDelete(); + void DoReturn(); + void DoDClick(); + + wxString GetNextToken( wxString &line, size_t &pos ); + + void DrawLinePart( wxDC &dc, int x, int y, const wxString &toDraw, const wxString &origin, const wxColour &colour); + void DrawLine( wxDC &dc, int x, int y, const wxString &line, int lineNum ); + void OnPaint( wxPaintEvent &event ); + void OnEraseBackground( wxEraseEvent &event ); + void OnMouse( wxMouseEvent &event ); + void OnChar( wxKeyEvent &event ); + void OnSetFocus( wxFocusEvent& event ); + void OnKillFocus( wxFocusEvent& event ); + + void OnInternalIdle(); + void RefreshLine( int n ); + void RefreshDown( int n ); + void MoveCursor( int new_x, int new_y, bool shift = false, bool centre = false ); + void MyAdjustScrollbars(); + +protected: + // common part of all ctors + void Init(); + + virtual wxSize DoGetBestSize() const; + + virtual void DoSetValue(const wxString& value, int flags = 0); + + friend class wxSourceUndoStep; + + wxSourceLineArray m_lines; + + wxFont m_sourceFont; + wxColour m_sourceColour; + wxColour m_commentColour; + wxColour m_stringColour; + + int m_cursorX; + int m_cursorY; + + int m_selStartX,m_selStartY; + int m_selEndX,m_selEndY; + + int m_lineHeight; + int m_charWidth; + + int m_longestLine; + + bool m_overwrite; + bool m_modified; + bool m_editable; + bool m_ignoreInput; + + wxArrayString m_keywords; + wxColour m_keywordColour; + + wxArrayString m_defines; + wxColour m_defineColour; + + wxArrayString m_variables; + wxColour m_variableColour; + + wxSourceLanguage m_lang; + + wxList m_undos; + + bool m_capturing; + + int m_bracketX; + int m_bracketY; + +private: + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxTextCtrl); +}; + +//----------------------------------------------------------------------------- +// this is superfluous here but helps to compile +//----------------------------------------------------------------------------- + +// cursor movement and also selection and delete operations +#define wxACTION_TEXT_GOTO wxT("goto") // to pos in numArg +#define wxACTION_TEXT_FIRST wxT("first") // go to pos 0 +#define wxACTION_TEXT_LAST wxT("last") // go to last pos +#define wxACTION_TEXT_HOME wxT("home") +#define wxACTION_TEXT_END wxT("end") +#define wxACTION_TEXT_LEFT wxT("left") +#define wxACTION_TEXT_RIGHT wxT("right") +#define wxACTION_TEXT_UP wxT("up") +#define wxACTION_TEXT_DOWN wxT("down") +#define wxACTION_TEXT_WORD_LEFT wxT("wordleft") +#define wxACTION_TEXT_WORD_RIGHT wxT("wordright") +#define wxACTION_TEXT_PAGE_UP wxT("pageup") +#define wxACTION_TEXT_PAGE_DOWN wxT("pagedown") + +// clipboard operations +#define wxACTION_TEXT_COPY wxT("copy") +#define wxACTION_TEXT_CUT wxT("cut") +#define wxACTION_TEXT_PASTE wxT("paste") + +// insert text at the cursor position: the text is in strArg of PerformAction +#define wxACTION_TEXT_INSERT wxT("insert") + +// if the action starts with either of these prefixes and the rest of the +// string is one of the movement commands, it means to select/delete text from +// the current cursor position to the new one +#define wxACTION_TEXT_PREFIX_SEL wxT("sel") +#define wxACTION_TEXT_PREFIX_DEL wxT("del") + +// mouse selection +#define wxACTION_TEXT_ANCHOR_SEL wxT("anchorsel") +#define wxACTION_TEXT_EXTEND_SEL wxT("extendsel") +#define wxACTION_TEXT_SEL_WORD wxT("wordsel") +#define wxACTION_TEXT_SEL_LINE wxT("linesel") + +// undo or redo +#define wxACTION_TEXT_UNDO wxT("undo") +#define wxACTION_TEXT_REDO wxT("redo") + +// ---------------------------------------------------------------------------- +// wxTextCtrl types +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxStdTextCtrlInputHandler : public wxStdInputHandler +{ +public: + wxStdTextCtrlInputHandler(wxInputHandler *inphand) : wxStdInputHandler(inphand) {} + + virtual bool HandleKey(wxInputConsumer *consumer, + const wxKeyEvent& event, + bool pressed) { return false; } + virtual bool HandleMouse(wxInputConsumer *consumer, const wxMouseEvent& event) { return false; } + virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event) { return false; } + virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event) { return false; } + +protected: + // get the position of the mouse click + static wxTextPos HitTest(const wxTextCtrl *text, const wxPoint& pos) { return 0; } + + // capture data + wxTextCtrl *m_winCapture; +}; + +#endif +// wxUSE_UNIV_TEXTCTRL + +#endif // __X11TEXTCTRLH__ + diff --git a/lib/wxWidgets/include/wx/x11/toplevel.h b/lib/wxWidgets/include/wx/x11/toplevel.h new file mode 100644 index 0000000..9f74c2d --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/toplevel.h @@ -0,0 +1,116 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/toplevel.h +// Purpose: wxTopLevelWindowX11 is the X11 implementation of wxTLW +// Author: Julian Smart +// Modified by: +// Created: 20.09.01 +// Copyright: (c) 2002 Julian Smart +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_X11_TOPLEVEL_H_ +#define _WX_X11_TOPLEVEL_H_ + +// ---------------------------------------------------------------------------- +// wxTopLevelWindowX11 +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTopLevelWindowX11 : public wxTopLevelWindowBase +{ +public: + // constructors and such + wxTopLevelWindowX11() { Init(); } + + wxTopLevelWindowX11(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)) + { + Init(); + + (void)Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxASCII_STR(wxFrameNameStr)); + + virtual ~wxTopLevelWindowX11(); + + // implement base class pure virtuals + virtual void Maximize(bool maximize = true); + virtual bool IsMaximized() const; + virtual void Iconize(bool iconize = true); + virtual bool IsIconized() const; + virtual void SetIcons(const wxIconBundle& icons); + virtual void Restore(); + + virtual bool Show( bool show = true ); + + virtual bool ShowFullScreen( bool show, long style = wxFULLSCREEN_ALL ); + virtual bool IsFullScreen() const { return m_fsIsShowing; } + + virtual void SetTitle( const wxString& title); + virtual wxString GetTitle() const; + + // implementation + void SetNeedResizeInIdle( bool set = true ) + { m_needResizeInIdle = set; } + void SetConfigureGeometry( int x, int y, int width, int height ) + { m_x = x; m_y = y; m_width = width; m_height = height; } + + virtual bool SetShape(const wxRegion& region); + + // For implementation purposes - sometimes decorations make the + // client area smaller + virtual wxPoint GetClientAreaOrigin() const; + + virtual void OnInternalIdle(); + +protected: + // common part of all ctors + void Init(); + + // set the icon for the window + void DoSetIcon( const wxIcon& icon ); + + // For implementation of delayed resize events + bool m_needResizeInIdle; + + virtual void DoGetClientSize( int *width, int *height ) const; + virtual void DoGetSize( int *width, int *height ) const; + virtual void DoSetClientSize(int width, int height); + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + virtual void DoGetPosition( int *x, int *y ) const; + + // Is the frame currently iconized? + bool m_iconized; + + // Should the frame be maximized when it will be shown? set by Maximize() + // when it is called while the frame is hidden + bool m_maximizeOnShow; + + // Data to save/restore when calling ShowFullScreen + long m_fsStyle; // Passed to ShowFullScreen + wxRect m_fsOldSize; + bool m_fsIsMaximized; + bool m_fsIsShowing; + wxString m_title; + + // Geometry + int m_x,m_y,m_width,m_height; +}; + +// list of all frames and modeless dialogs +//extern WXDLLIMPEXP_DATA_CORE(wxWindowList) wxModelessWindows; + +#endif // _WX_X11_TOPLEVEL_H_ diff --git a/lib/wxWidgets/include/wx/x11/window.h b/lib/wxWidgets/include/wx/x11/window.h new file mode 100644 index 0000000..8c46554 --- /dev/null +++ b/lib/wxWidgets/include/wx/x11/window.h @@ -0,0 +1,221 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/window.h +// Purpose: wxWindow class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WINDOW_H_ +#define _WX_WINDOW_H_ + +#include "wx/region.h" + +// ---------------------------------------------------------------------------- +// wxWindow class for Motif - see also wxWindowBase +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWindowX11 : public wxWindowBase +{ + friend class WXDLLIMPEXP_FWD_CORE wxDC; + friend class WXDLLIMPEXP_FWD_CORE wxWindowDC; + +public: + wxWindowX11() { Init(); } + + wxWindowX11(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)) + { + Init(); + Create(parent, id, pos, size, style, name); + } + + virtual ~wxWindowX11(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxASCII_STR(wxPanelNameStr)); + + virtual void Raise(); + virtual void Lower(); + + // SetLabel(), which does nothing in wxWindow + virtual void SetLabel(const wxString& label) wxOVERRIDE { m_Label = label; } + virtual wxString GetLabel() const wxOVERRIDE { return m_Label; } + + virtual bool Show( bool show = true ); + virtual bool Enable( bool enable = true ); + + virtual void SetFocus(); + + virtual void WarpPointer(int x, int y); + + virtual void Refresh( bool eraseBackground = true, + const wxRect *rect = (const wxRect *) NULL ); + virtual void Update(); + + virtual bool SetBackgroundColour( const wxColour &colour ); + virtual bool SetForegroundColour( const wxColour &colour ); + + virtual bool SetCursor( const wxCursor &cursor ); + virtual bool SetFont( const wxFont &font ); + + virtual int GetCharHeight() const; + virtual int GetCharWidth() const; + + virtual void ScrollWindow( int dx, int dy, const wxRect* rect = NULL ); + +#if wxUSE_DRAG_AND_DROP + virtual void SetDropTarget( wxDropTarget *dropTarget ); +#endif // wxUSE_DRAG_AND_DROP + + // Accept files for dragging + virtual void DragAcceptFiles(bool accept); + + // Get the unique identifier of a window + virtual WXWindow GetHandle() const { return X11GetMainWindow(); } + + // implementation from now on + // -------------------------- + + // accessors + // --------- + + // Get main X11 window + virtual WXWindow X11GetMainWindow() const; + + // Get X11 window representing the client area + virtual WXWindow GetClientAreaWindow() const; + + void SetLastClick(int button, long timestamp) + { m_lastButton = button; m_lastTS = timestamp; } + + int GetLastClickedButton() const { return m_lastButton; } + long GetLastClickTime() const { return m_lastTS; } + + // Gives window a chance to do something in response to a size message, e.g. + // arrange status bar, toolbar etc. + virtual bool PreResize(); + + // Generates paint events from m_updateRegion + void SendPaintEvents(); + + // Generates paint events from flag + void SendNcPaintEvents(); + + // Generates erase events from m_clearRegion + void SendEraseEvents(); + + // Clip to paint region? + bool GetClipPaintRegion() { return m_clipPaintRegion; } + + // Return clear region + wxRegion &GetClearRegion() { return m_clearRegion; } + + void NeedUpdateNcAreaInIdle( bool update = true ) { m_updateNcArea = update; } + + // Inserting into main window instead of client + // window. This is mostly for a wxWindow's own + // scrollbars. + void SetInsertIntoMain( bool insert = true ) { m_insertIntoMain = insert; } + bool GetInsertIntoMain() { return m_insertIntoMain; } + + // sets the fore/background colour for the given widget + static void DoChangeForegroundColour(WXWindow widget, wxColour& foregroundColour); + static void DoChangeBackgroundColour(WXWindow widget, wxColour& backgroundColour, bool changeArmColour = false); + + // I don't want users to override what's done in idle so everything that + // has to be done in idle time in order for wxX11 to work is done in + // OnInternalIdle + virtual void OnInternalIdle(); + +protected: + // Responds to colour changes: passes event on to children. + void OnSysColourChanged(wxSysColourChangedEvent& event); + + // For double-click detection + long m_lastTS; // last timestamp + int m_lastButton; // last pressed button + +protected: + WXWindow m_mainWindow; + WXWindow m_clientWindow; + bool m_insertIntoMain; + + bool m_winCaptured; + wxRegion m_clearRegion; + bool m_clipPaintRegion; + bool m_updateNcArea; + bool m_needsInputFocus; // Input focus set in OnIdle + + // implement the base class pure virtuals + virtual void DoGetTextExtent(const wxString& string, + int *x, int *y, + int *descent = NULL, + int *externalLeading = NULL, + const wxFont *font = NULL) const; + virtual void DoClientToScreen( int *x, int *y ) const; + virtual void DoScreenToClient( int *x, int *y ) const; + virtual void DoGetPosition( int *x, int *y ) const; + virtual void DoGetSize( int *width, int *height ) const; + virtual void DoGetClientSize( int *width, int *height ) const; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + virtual void DoSetClientSize(int width, int height); + virtual void DoMoveWindow(int x, int y, int width, int height); + virtual void DoSetSizeHints(int minW, int minH, + int maxW, int maxH, + int incW, int incH); + virtual void DoCaptureMouse(); + virtual void DoReleaseMouse(); + virtual void KillFocus(); + +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip( wxToolTip *tip ); +#endif // wxUSE_TOOLTIPS + +private: + // common part of all ctors + void Init(); + + wxString m_Label; + + wxDECLARE_DYNAMIC_CLASS(wxWindowX11); + wxDECLARE_NO_COPY_CLASS(wxWindowX11); + wxDECLARE_EVENT_TABLE(); +}; + +// ---------------------------------------------------------------------------- +// A little class to switch off `size optimization' while an instance of the +// object exists: this may be useful to temporarily disable the optimisation +// which consists to do nothing when the new size is equal to the old size - +// although quite useful usually to avoid flicker, sometimes it leads to +// undesired effects. +// +// Usage: create an instance of this class on the stack to disable the size +// optimisation, it will be re-enabled as soon as the object goes out from scope. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxNoOptimize +{ +public: + wxNoOptimize() { ms_count++; } + ~wxNoOptimize() { ms_count--; } + + static bool CanOptimize() { return ms_count == 0; } + +protected: + static int ms_count; +}; + +#endif // _WX_WINDOW_H_ diff --git a/lib/wxWidgets/include/wx/xlocale.h b/lib/wxWidgets/include/wx/xlocale.h new file mode 100644 index 0000000..c433d25 --- /dev/null +++ b/lib/wxWidgets/include/wx/xlocale.h @@ -0,0 +1,346 @@ +////////////////////////////////////////////////////////////////////////////// +// Name: wx/xlocale.h +// Purpose: Header to provide some xlocale wrappers +// Author: Brian Vanderburg II, Vadim Zeitlin +// Created: 2008-01-07 +// Copyright: (c) 2008 Brian Vanderburg II +// 2008 Vadim Zeitlin <vadim@wxwidgets.org> +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +/* + This header defines portable wrappers around xlocale foo_l() functions or + their MSVC proprietary _foo_l() equivalents when they are available and + implements these functions for the "C" locale [only] if they are not. This + allows the program running under the default user locale to still use "C" + locale for operations such as reading data from files where they are stored + using decimal point &c. + + TODO: Currently only the character classification and transformation + functions and number <-> string functions, are implemented, + we also need at least + - formatted IO: scanf_l(), printf_l() &c + - time: strftime_l(), strptime_l() + */ + +#ifndef _WX_XLOCALE_H_ +#define _WX_XLOCALE_H_ + +#include "wx/defs.h" // wxUSE_XLOCALE + +#if wxUSE_XLOCALE + +#include "wx/crt.h" // Includes wx/chartype.h, wx/wxcrt.h(wx/string.h) +#include "wx/intl.h" // wxLanguage + +// The platform-specific locale type +// If wxXLocale_t is not defined, then only "C" locale support is provided +#ifdef wxHAS_XLOCALE_SUPPORT + #if wxCHECK_VISUALC_VERSION(8) + typedef _locale_t wxXLocale_t; + #define wxXLOCALE_IDENT(name) _ ## name + #elif defined(HAVE_LOCALE_T) + // Some systems (notably macOS) require including a separate header for + // locale_t and related functions. + #ifdef HAVE_XLOCALE_H + #include <xlocale.h> + #endif + #include <locale.h> + #include <ctype.h> + #include <stdlib.h> + + #if wxUSE_UNICODE + #include <wctype.h> + #endif + + // Locale type and identifier name + typedef locale_t wxXLocale_t; + + #define wxXLOCALE_IDENT(name) name + #else + #error "Unknown xlocale support" + #endif +#endif // wxHAS_XLOCALE_SUPPORT + + +// wxXLocale is a wrapper around the native type representing a locale. +// +// It is not to be confused with wxLocale, which handles actually changing the +// locale, loading message catalogs, etc. This just stores a locale value. +// The similarity of names is unfortunate, but there doesn't seem to be any +// better alternative right now. Perhaps by wxWidgets 4.0 better naming could +// be used, or this class could become wxLocale (a wrapper for the value), and +// some other class could be used to load the language catalogs or something +// that would be clearer +#ifdef wxHAS_XLOCALE_SUPPORT + +class WXDLLIMPEXP_BASE wxXLocale +{ +public: + // Construct an uninitialized locale + wxXLocale() { m_locale = NULL; } + +#if wxUSE_INTL + // Construct from a symbolic language constant + wxXLocale(wxLanguage lang); +#endif + + // Construct from the given language string + wxXLocale(const char *loc) { Init(loc); } + + // Destroy the locale + ~wxXLocale() { Free(); } + + + // Get the global "C" locale object + static wxXLocale& GetCLocale(); + + // Check if the object represents a valid locale (notice that without + // wxHAS_XLOCALE_SUPPORT the only valid locale is the "C" one) + bool IsOk() const { return m_locale != NULL; } + + // Get the type + wxXLocale_t Get() const { return m_locale; } + + bool operator== (const wxXLocale& loc) const + { return m_locale == loc.m_locale; } + +private: + // Special ctor for the "C" locale, it's only used internally as the user + // code is supposed to use GetCLocale() + wxXLocale(struct wxXLocaleCTag * WXUNUSED(dummy)) { Init("C"); } + + // Create from the given language string (called from ctors) + void Init(const char *loc); + + // Free the locale if it's non-NULL + void Free(); + + + // The corresponding locale handle, NULL if invalid + wxXLocale_t m_locale; + + + // POSIX xlocale API provides a duplocale() function but MSVC locale API + // doesn't give us any means to copy a _locale_t object so we reduce the + // functionality to least common denominator here -- it shouldn't be a + // problem as copying the locale objects shouldn't be often needed + wxDECLARE_NO_COPY_CLASS(wxXLocale); +}; + +#else // !wxHAS_XLOCALE_SUPPORT + +// Skeleton version supporting only the "C" locale for the systems without +// xlocale support +class WXDLLIMPEXP_BASE wxXLocale +{ +public: + // Construct an uninitialized locale + wxXLocale() { m_isC = false; } + + // Construct from a symbolic language constant: unless the language is + // wxLANGUAGE_ENGLISH_US (which we assume to be the same as "C" locale) + // the object will be invalid + wxXLocale(wxLanguage lang) + { + m_isC = lang == wxLANGUAGE_ENGLISH_US; + } + + // Construct from the given language string: unless the string is "C" or + // "POSIX" the object will be invalid + wxXLocale(const char *loc) + { + m_isC = loc && (strcmp(loc, "C") == 0 || strcmp(loc, "POSIX") == 0); + } + + // Default copy ctor, assignment operator and dtor are ok (or would be if + // we didn't use wxDECLARE_NO_COPY_CLASS() for consistency with the + // xlocale version) + + + // Get the global "C" locale object + static wxXLocale& GetCLocale(); + + // Check if the object represents a valid locale (notice that without + // wxHAS_XLOCALE_SUPPORT the only valid locale is the "C" one) + bool IsOk() const { return m_isC; } + +private: + // Special ctor for the "C" locale, it's only used internally as the user + // code is supposed to use GetCLocale() + wxXLocale(struct wxXLocaleCTag * WXUNUSED(dummy)) { m_isC = true; } + + // Without xlocale support this class can only represent "C" locale, if + // this is false the object is invalid + bool m_isC; + + + // although it's not a problem to copy the objects of this class, we use + // this macro in this implementation for consistency with the xlocale-based + // one which can't be copied when using MSVC locale API + wxDECLARE_NO_COPY_CLASS(wxXLocale); +}; + +#endif // wxHAS_XLOCALE_SUPPORT/!wxHAS_XLOCALE_SUPPORT + + +// A shorter synonym for the most commonly used locale object +#define wxCLocale (wxXLocale::GetCLocale()) +extern WXDLLIMPEXP_DATA_BASE(wxXLocale) wxNullXLocale; + +// Wrappers for various functions: +#ifdef wxHAS_XLOCALE_SUPPORT + + // ctype functions + #define wxCRT_Isalnum_lA wxXLOCALE_IDENT(isalnum_l) + #define wxCRT_Isalpha_lA wxXLOCALE_IDENT(isalpha_l) + #define wxCRT_Iscntrl_lA wxXLOCALE_IDENT(iscntrl_l) + #define wxCRT_Isdigit_lA wxXLOCALE_IDENT(isdigit_l) + #define wxCRT_Isgraph_lA wxXLOCALE_IDENT(isgraph_l) + #define wxCRT_Islower_lA wxXLOCALE_IDENT(islower_l) + #define wxCRT_Isprint_lA wxXLOCALE_IDENT(isprint_l) + #define wxCRT_Ispunct_lA wxXLOCALE_IDENT(ispunct_l) + #define wxCRT_Isspace_lA wxXLOCALE_IDENT(isspace_l) + #define wxCRT_Isupper_lA wxXLOCALE_IDENT(isupper_l) + #define wxCRT_Isxdigit_lA wxXLOCALE_IDENT(isxdigit_l) + #define wxCRT_Tolower_lA wxXLOCALE_IDENT(tolower_l) + #define wxCRT_Toupper_lA wxXLOCALE_IDENT(toupper_l) + + inline int wxIsalnum_l(char c, const wxXLocale& loc) + { return wxCRT_Isalnum_lA(static_cast<unsigned char>(c), loc.Get()); } + inline int wxIsalpha_l(char c, const wxXLocale& loc) + { return wxCRT_Isalpha_lA(static_cast<unsigned char>(c), loc.Get()); } + inline int wxIscntrl_l(char c, const wxXLocale& loc) + { return wxCRT_Iscntrl_lA(static_cast<unsigned char>(c), loc.Get()); } + inline int wxIsdigit_l(char c, const wxXLocale& loc) + { return wxCRT_Isdigit_lA(static_cast<unsigned char>(c), loc.Get()); } + inline int wxIsgraph_l(char c, const wxXLocale& loc) + { return wxCRT_Isgraph_lA(static_cast<unsigned char>(c), loc.Get()); } + inline int wxIslower_l(char c, const wxXLocale& loc) + { return wxCRT_Islower_lA(static_cast<unsigned char>(c), loc.Get()); } + inline int wxIsprint_l(char c, const wxXLocale& loc) + { return wxCRT_Isprint_lA(static_cast<unsigned char>(c), loc.Get()); } + inline int wxIspunct_l(char c, const wxXLocale& loc) + { return wxCRT_Ispunct_lA(static_cast<unsigned char>(c), loc.Get()); } + inline int wxIsspace_l(char c, const wxXLocale& loc) + { return wxCRT_Isspace_lA(static_cast<unsigned char>(c), loc.Get()); } + inline int wxIsupper_l(char c, const wxXLocale& loc) + { return wxCRT_Isupper_lA(static_cast<unsigned char>(c), loc.Get()); } + inline int wxIsxdigit_l(char c, const wxXLocale& loc) + { return wxCRT_Isxdigit_lA(static_cast<unsigned char>(c), loc.Get()); } + inline int wxTolower_l(char c, const wxXLocale& loc) + { return wxCRT_Tolower_lA(static_cast<unsigned char>(c), loc.Get()); } + inline int wxToupper_l(char c, const wxXLocale& loc) + { return wxCRT_Toupper_lA(static_cast<unsigned char>(c), loc.Get()); } + + + // stdlib functions for numeric <-> string conversion + // NOTE: GNU libc does not have ato[fil]_l functions; + // MSVC++8 does not have _strto[u]ll_l functions; + // thus we take the minimal set of functions provided in both environments: + + #define wxCRT_Strtod_lA wxXLOCALE_IDENT(strtod_l) + #define wxCRT_Strtol_lA wxXLOCALE_IDENT(strtol_l) + #define wxCRT_Strtoul_lA wxXLOCALE_IDENT(strtoul_l) + + inline double wxStrtod_lA(const char *c, char **endptr, const wxXLocale& loc) + { return wxCRT_Strtod_lA(c, endptr, loc.Get()); } + inline long wxStrtol_lA(const char *c, char **endptr, int base, const wxXLocale& loc) + { return wxCRT_Strtol_lA(c, endptr, base, loc.Get()); } + inline unsigned long wxStrtoul_lA(const char *c, char **endptr, int base, const wxXLocale& loc) + { return wxCRT_Strtoul_lA(c, endptr, base, loc.Get()); } + + #if wxUSE_UNICODE + + // ctype functions + #define wxCRT_Isalnum_lW wxXLOCALE_IDENT(iswalnum_l) + #define wxCRT_Isalpha_lW wxXLOCALE_IDENT(iswalpha_l) + #define wxCRT_Iscntrl_lW wxXLOCALE_IDENT(iswcntrl_l) + #define wxCRT_Isdigit_lW wxXLOCALE_IDENT(iswdigit_l) + #define wxCRT_Isgraph_lW wxXLOCALE_IDENT(iswgraph_l) + #define wxCRT_Islower_lW wxXLOCALE_IDENT(iswlower_l) + #define wxCRT_Isprint_lW wxXLOCALE_IDENT(iswprint_l) + #define wxCRT_Ispunct_lW wxXLOCALE_IDENT(iswpunct_l) + #define wxCRT_Isspace_lW wxXLOCALE_IDENT(iswspace_l) + #define wxCRT_Isupper_lW wxXLOCALE_IDENT(iswupper_l) + #define wxCRT_Isxdigit_lW wxXLOCALE_IDENT(iswxdigit_l) + #define wxCRT_Tolower_lW wxXLOCALE_IDENT(towlower_l) + #define wxCRT_Toupper_lW wxXLOCALE_IDENT(towupper_l) + + inline int wxIsalnum_l(wchar_t c, const wxXLocale& loc) + { return wxCRT_Isalnum_lW(c, loc.Get()); } + inline int wxIsalpha_l(wchar_t c, const wxXLocale& loc) + { return wxCRT_Isalpha_lW(c, loc.Get()); } + inline int wxIscntrl_l(wchar_t c, const wxXLocale& loc) + { return wxCRT_Iscntrl_lW(c, loc.Get()); } + inline int wxIsdigit_l(wchar_t c, const wxXLocale& loc) + { return wxCRT_Isdigit_lW(c, loc.Get()); } + inline int wxIsgraph_l(wchar_t c, const wxXLocale& loc) + { return wxCRT_Isgraph_lW(c, loc.Get()); } + inline int wxIslower_l(wchar_t c, const wxXLocale& loc) + { return wxCRT_Islower_lW(c, loc.Get()); } + inline int wxIsprint_l(wchar_t c, const wxXLocale& loc) + { return wxCRT_Isprint_lW(c, loc.Get()); } + inline int wxIspunct_l(wchar_t c, const wxXLocale& loc) + { return wxCRT_Ispunct_lW(c, loc.Get()); } + inline int wxIsspace_l(wchar_t c, const wxXLocale& loc) + { return wxCRT_Isspace_lW(c, loc.Get()); } + inline int wxIsupper_l(wchar_t c, const wxXLocale& loc) + { return wxCRT_Isupper_lW(c, loc.Get()); } + inline int wxIsxdigit_l(wchar_t c, const wxXLocale& loc) + { return wxCRT_Isxdigit_lW(c, loc.Get()); } + inline wchar_t wxTolower_l(wchar_t c, const wxXLocale& loc) + { return wxCRT_Tolower_lW(c, loc.Get()); } + inline wchar_t wxToupper_l(wchar_t c, const wxXLocale& loc) + { return wxCRT_Toupper_lW(c, loc.Get()); } + + + // stdlib functions for numeric <-> string conversion + // (see notes above about missing functions) + #define wxCRT_Strtod_lW wxXLOCALE_IDENT(wcstod_l) + #define wxCRT_Strtol_lW wxXLOCALE_IDENT(wcstol_l) + #define wxCRT_Strtoul_lW wxXLOCALE_IDENT(wcstoul_l) + + inline double wxStrtod_l(const wchar_t *c, wchar_t **endptr, const wxXLocale& loc) + { return wxCRT_Strtod_lW(c, endptr, loc.Get()); } + inline long wxStrtol_l(const wchar_t *c, wchar_t **endptr, int base, const wxXLocale& loc) + { return wxCRT_Strtol_lW(c, endptr, base, loc.Get()); } + inline unsigned long wxStrtoul_l(const wchar_t *c, wchar_t **endptr, int base, const wxXLocale& loc) + { return wxCRT_Strtoul_lW(c, endptr, base, loc.Get()); } + #else // !wxUSE_UNICODE + inline double wxStrtod_l(const char *c, char **endptr, const wxXLocale& loc) + { return wxCRT_Strtod_lA(c, endptr, loc.Get()); } + inline long wxStrtol_l(const char *c, char **endptr, int base, const wxXLocale& loc) + { return wxCRT_Strtol_lA(c, endptr, base, loc.Get()); } + inline unsigned long wxStrtoul_l(const char *c, char **endptr, int base, const wxXLocale& loc) + { return wxCRT_Strtoul_lA(c, endptr, base, loc.Get()); } + #endif // wxUSE_UNICODE +#else // !wxHAS_XLOCALE_SUPPORT + // ctype functions + int WXDLLIMPEXP_BASE wxIsalnum_l(const wxUniChar& c, const wxXLocale& loc); + int WXDLLIMPEXP_BASE wxIsalpha_l(const wxUniChar& c, const wxXLocale& loc); + int WXDLLIMPEXP_BASE wxIscntrl_l(const wxUniChar& c, const wxXLocale& loc); + int WXDLLIMPEXP_BASE wxIsdigit_l(const wxUniChar& c, const wxXLocale& loc); + int WXDLLIMPEXP_BASE wxIsgraph_l(const wxUniChar& c, const wxXLocale& loc); + int WXDLLIMPEXP_BASE wxIslower_l(const wxUniChar& c, const wxXLocale& loc); + int WXDLLIMPEXP_BASE wxIsprint_l(const wxUniChar& c, const wxXLocale& loc); + int WXDLLIMPEXP_BASE wxIspunct_l(const wxUniChar& c, const wxXLocale& loc); + int WXDLLIMPEXP_BASE wxIsspace_l(const wxUniChar& c, const wxXLocale& loc); + int WXDLLIMPEXP_BASE wxIsupper_l(const wxUniChar& c, const wxXLocale& loc); + int WXDLLIMPEXP_BASE wxIsxdigit_l(const wxUniChar& c, const wxXLocale& loc); + int WXDLLIMPEXP_BASE wxTolower_l(const wxUniChar& c, const wxXLocale& loc); + int WXDLLIMPEXP_BASE wxToupper_l(const wxUniChar& c, const wxXLocale& loc); + + // stdlib functions + double WXDLLIMPEXP_BASE wxStrtod_l(const wchar_t* str, wchar_t **endptr, const wxXLocale& loc); + double WXDLLIMPEXP_BASE wxStrtod_l(const char* str, char **endptr, const wxXLocale& loc); + long WXDLLIMPEXP_BASE wxStrtol_l(const wchar_t* str, wchar_t **endptr, int base, const wxXLocale& loc); + long WXDLLIMPEXP_BASE wxStrtol_l(const char* str, char **endptr, int base, const wxXLocale& loc); + unsigned long WXDLLIMPEXP_BASE wxStrtoul_l(const wchar_t* str, wchar_t **endptr, int base, const wxXLocale& loc); + unsigned long WXDLLIMPEXP_BASE wxStrtoul_l(const char* str, char **endptr, int base, const wxXLocale& loc); + +#endif // wxHAS_XLOCALE_SUPPORT/!wxHAS_XLOCALE_SUPPORT + +#endif // wxUSE_XLOCALE + +#endif // _WX_XLOCALE_H_ diff --git a/lib/wxWidgets/include/wx/xml/xml.h b/lib/wxWidgets/include/wx/xml/xml.h new file mode 100644 index 0000000..a816ce2 --- /dev/null +++ b/lib/wxWidgets/include/wx/xml/xml.h @@ -0,0 +1,366 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xml/xml.h +// Purpose: wxXmlDocument - XML parser & data holder class +// Author: Vaclav Slavik +// Created: 2000/03/05 +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef _WX_XML_H_ +#define _WX_XML_H_ + +#include "wx/defs.h" + +#if wxUSE_XML + +#include "wx/string.h" +#include "wx/object.h" +#include "wx/list.h" +#include "wx/textbuf.h" +#include "wx/versioninfo.h" + +#ifdef WXMAKINGDLL_XML + #define WXDLLIMPEXP_XML WXEXPORT +#elif defined(WXUSINGDLL) + #define WXDLLIMPEXP_XML WXIMPORT +#else // not making nor using DLL + #define WXDLLIMPEXP_XML +#endif + +class WXDLLIMPEXP_FWD_XML wxXmlNode; +class WXDLLIMPEXP_FWD_XML wxXmlAttribute; +class WXDLLIMPEXP_FWD_XML wxXmlDocument; +class WXDLLIMPEXP_FWD_XML wxXmlIOHandler; +class WXDLLIMPEXP_FWD_BASE wxInputStream; +class WXDLLIMPEXP_FWD_BASE wxOutputStream; + +// Represents XML node type. +enum wxXmlNodeType +{ + // note: values are synchronized with xmlElementType from libxml + wxXML_ELEMENT_NODE = 1, + wxXML_ATTRIBUTE_NODE = 2, + wxXML_TEXT_NODE = 3, + wxXML_CDATA_SECTION_NODE = 4, + wxXML_ENTITY_REF_NODE = 5, + wxXML_ENTITY_NODE = 6, + wxXML_PI_NODE = 7, + wxXML_COMMENT_NODE = 8, + wxXML_DOCUMENT_NODE = 9, + wxXML_DOCUMENT_TYPE_NODE = 10, + wxXML_DOCUMENT_FRAG_NODE = 11, + wxXML_NOTATION_NODE = 12, + wxXML_HTML_DOCUMENT_NODE = 13 +}; + + +// Represents node property(ies). +// Example: in <img src="hello.gif" id="3"/> "src" is property with value +// "hello.gif" and "id" is prop. with value "3". + +class WXDLLIMPEXP_XML wxXmlAttribute +{ +public: + wxXmlAttribute() : m_next(NULL) {} + wxXmlAttribute(const wxString& name, const wxString& value, + wxXmlAttribute *next = NULL) + : m_name(name), m_value(value), m_next(next) {} + virtual ~wxXmlAttribute() {} + + const wxString& GetName() const { return m_name; } + const wxString& GetValue() const { return m_value; } + wxXmlAttribute *GetNext() const { return m_next; } + + void SetName(const wxString& name) { m_name = name; } + void SetValue(const wxString& value) { m_value = value; } + void SetNext(wxXmlAttribute *next) { m_next = next; } + +private: + wxString m_name; + wxString m_value; + wxXmlAttribute *m_next; +}; + +#if WXWIN_COMPATIBILITY_2_8 + // NB: #define is used instead of typedef so that forward declarations + // continue to work + #define wxXmlProperty wxXmlAttribute +#endif + + +// Represents node in XML document. Node has name and may have content and +// attributes. Most common node types are wxXML_TEXT_NODE (name and attributes +// are irrelevant) and wxXML_ELEMENT_NODE (e.g. in <title>hi there is +// element with name="title", irrelevant content and one child (wxXML_TEXT_NODE +// with content="hi"). +// +// If wxUSE_UNICODE is 0, all strings are encoded in the encoding given to Load +// (default is UTF-8). + +class WXDLLIMPEXP_XML wxXmlNode +{ +public: + wxXmlNode() + : m_attrs(NULL), m_parent(NULL), m_children(NULL), m_next(NULL), + m_lineNo(-1), m_noConversion(false) + { + } + + wxXmlNode(wxXmlNode *parent, wxXmlNodeType type, + const wxString& name, const wxString& content = wxEmptyString, + wxXmlAttribute *attrs = NULL, wxXmlNode *next = NULL, + int lineNo = -1); + + virtual ~wxXmlNode(); + + // copy ctor & operator=. Note that this does NOT copy siblings + // and parent pointer, i.e. m_parent and m_next will be NULL + // after using copy ctor and are never unmodified by operator=. + // On the other hand, it DOES copy children and attributes. + wxXmlNode(const wxXmlNode& node); + wxXmlNode& operator=(const wxXmlNode& node); + + // user-friendly creation: + wxXmlNode(wxXmlNodeType type, const wxString& name, + const wxString& content = wxEmptyString, + int lineNo = -1); + virtual void AddChild(wxXmlNode *child); + virtual bool InsertChild(wxXmlNode *child, wxXmlNode *followingNode); + virtual bool InsertChildAfter(wxXmlNode *child, wxXmlNode *precedingNode); + virtual bool RemoveChild(wxXmlNode *child); + virtual void AddAttribute(const wxString& name, const wxString& value); + virtual bool DeleteAttribute(const wxString& name); + + // access methods: + wxXmlNodeType GetType() const { return m_type; } + const wxString& GetName() const { return m_name; } + const wxString& GetContent() const { return m_content; } + + bool IsWhitespaceOnly() const; + int GetDepth(wxXmlNode *grandparent = NULL) const; + + // Gets node content from wxXML_ENTITY_NODE + // The problem is, content is represented as + // wxXML_ENTITY_NODE name="tag", content="" + // |-- wxXML_TEXT_NODE or + // wxXML_CDATA_SECTION_NODE name="" content="content" + wxString GetNodeContent() const; + + wxXmlNode *GetParent() const { return m_parent; } + wxXmlNode *GetNext() const { return m_next; } + wxXmlNode *GetChildren() const { return m_children; } + + wxXmlAttribute *GetAttributes() const { return m_attrs; } + bool GetAttribute(const wxString& attrName, wxString *value) const; + wxString GetAttribute(const wxString& attrName, + const wxString& defaultVal = wxEmptyString) const; + bool HasAttribute(const wxString& attrName) const; + + int GetLineNumber() const { return m_lineNo; } + + void SetType(wxXmlNodeType type) { m_type = type; } + void SetName(const wxString& name) { m_name = name; } + void SetContent(const wxString& con) { m_content = con; } + + void SetParent(wxXmlNode *parent) { m_parent = parent; } + void SetNext(wxXmlNode *next) { m_next = next; } + void SetChildren(wxXmlNode *child) { m_children = child; } + + void SetAttributes(wxXmlAttribute *attr) { m_attrs = attr; } + virtual void AddAttribute(wxXmlAttribute *attr); + + // If true, don't do encoding conversion to improve efficiency - node content is ASCII text + bool GetNoConversion() const { return m_noConversion; } + void SetNoConversion(bool noconversion) { m_noConversion = noconversion; } + +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED( inline wxXmlAttribute *GetProperties() const ); + wxDEPRECATED( inline bool GetPropVal(const wxString& propName, + wxString *value) const ); + wxDEPRECATED( inline wxString GetPropVal(const wxString& propName, + const wxString& defaultVal) const ); + wxDEPRECATED( inline bool HasProp(const wxString& propName) const ); + + wxDEPRECATED( inline void SetProperties(wxXmlAttribute *prop) ); +#endif // WXWIN_COMPATIBILITY_2_8 + + // The following three functions are backward compatibility, but because + // they were virtual, we must make it possible to override them. This + // is done by calling e.g. AddProperty() from AddAttribute(), so we have + // to keep AddProperty() even if 2.8 compatibility is off. To prevent + // old code from compiling in that case, we make them private and + // non-virtual. (This can be removed when WXWIN_COMPATIBILITY_2_8 is + // removed, we'll have just *Attribute versions then.) +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED_BUT_USED_INTERNALLY( + virtual void AddProperty(const wxString& name, const wxString& value) ); + wxDEPRECATED_BUT_USED_INTERNALLY( + virtual bool DeleteProperty(const wxString& name) ); + wxDEPRECATED_BUT_USED_INTERNALLY( + virtual void AddProperty(wxXmlAttribute *attr) ); +#else +private: + void AddProperty(const wxString& name, const wxString& value); + bool DeleteProperty(const wxString& name); + void AddProperty(wxXmlAttribute *attr); +#endif // WXWIN_COMPATIBILITY_2_8/!WXWIN_COMPATIBILITY_2_8 + +private: + wxXmlNodeType m_type; + wxString m_name; + wxString m_content; + wxXmlAttribute *m_attrs; + wxXmlNode *m_parent, *m_children, *m_next; + int m_lineNo; // line number in original file, or -1 + bool m_noConversion; // don't do encoding conversion - node is plain text + + void DoFree(); + void DoCopy(const wxXmlNode& node); +}; + +#if WXWIN_COMPATIBILITY_2_8 +inline wxXmlAttribute *wxXmlNode::GetProperties() const + { return GetAttributes(); } +inline bool wxXmlNode::GetPropVal(const wxString& propName, + wxString *value) const + { return GetAttribute(propName, value); } +inline wxString wxXmlNode::GetPropVal(const wxString& propName, + const wxString& defaultVal) const + { return GetAttribute(propName, defaultVal); } +inline bool wxXmlNode::HasProp(const wxString& propName) const + { return HasAttribute(propName); } +inline void wxXmlNode::SetProperties(wxXmlAttribute *prop) + { SetAttributes(prop); } +#endif // WXWIN_COMPATIBILITY_2_8 + + + +class WXDLLIMPEXP_XML wxXmlDoctype +{ +public: + explicit + wxXmlDoctype(const wxString& rootName = wxString(), + const wxString& systemId = wxString(), + const wxString& publicId = wxString()) + : m_rootName(rootName), + m_systemId(systemId), + m_publicId(publicId) + {} + + // Default copy ctor and assignment operators are ok. + + bool IsValid() const; + void Clear(); + + const wxString& GetRootName() const { return m_rootName; } + const wxString& GetSystemId() const { return m_systemId; } + const wxString& GetPublicId() const { return m_publicId; } + + wxString GetFullString() const; + +private: + wxString m_rootName; + wxString m_systemId; + wxString m_publicId; +}; + + + +// special indentation value for wxXmlDocument::Save +#define wxXML_NO_INDENTATION (-1) + +// flags for wxXmlDocument::Load +enum wxXmlDocumentLoadFlag +{ + wxXMLDOC_NONE = 0, + wxXMLDOC_KEEP_WHITESPACE_NODES = 1 +}; + + +// This class holds XML data/document as parsed by XML parser. + +class WXDLLIMPEXP_XML wxXmlDocument : public wxObject +{ +public: + wxXmlDocument(); + wxXmlDocument(const wxString& filename, + const wxString& encoding = wxT("UTF-8")); + wxXmlDocument(wxInputStream& stream, + const wxString& encoding = wxT("UTF-8")); + virtual ~wxXmlDocument() { wxDELETE(m_docNode); } + + wxXmlDocument(const wxXmlDocument& doc); + wxXmlDocument& operator=(const wxXmlDocument& doc); + + // Parses .xml file and loads data. Returns TRUE on success, FALSE + // otherwise. + virtual bool Load(const wxString& filename, + const wxString& encoding = wxT("UTF-8"), int flags = wxXMLDOC_NONE); + virtual bool Load(wxInputStream& stream, + const wxString& encoding = wxT("UTF-8"), int flags = wxXMLDOC_NONE); + + // Saves document as .xml file. + virtual bool Save(const wxString& filename, int indentstep = 2) const; + virtual bool Save(wxOutputStream& stream, int indentstep = 2) const; + + bool IsOk() const { return GetRoot() != NULL; } + + // Returns root node of the document. + wxXmlNode *GetRoot() const; + // Returns the document node. + wxXmlNode *GetDocumentNode() const { return m_docNode; } + + + // Returns version of document (may be empty). + const wxString& GetVersion() const { return m_version; } + // Returns encoding of document (may be empty). + // Note: this is the encoding original file was saved in, *not* the + // encoding of in-memory representation! + const wxString& GetFileEncoding() const { return m_fileEncoding; } + const wxXmlDoctype& GetDoctype() const { return m_doctype; } + // Returns file type of document + wxTextFileType GetFileType() const { return m_fileType; } + wxString GetEOL() const { return m_eol; } + + // Write-access methods: + wxXmlNode *DetachDocumentNode() { wxXmlNode *old=m_docNode; m_docNode=NULL; return old; } + void SetDocumentNode(wxXmlNode *node) { wxDELETE(m_docNode); m_docNode = node; } + wxXmlNode *DetachRoot(); + void SetRoot(wxXmlNode *node); + void SetVersion(const wxString& version) { m_version = version; } + void SetFileEncoding(const wxString& encoding) { m_fileEncoding = encoding; } + void SetDoctype(const wxXmlDoctype& doctype) { m_doctype = doctype; } + void SetFileType(wxTextFileType fileType); + void AppendToProlog(wxXmlNode *node); + +#if !wxUSE_UNICODE + // Returns encoding of in-memory representation of the document + // (same as passed to Load or ctor, defaults to UTF-8). + // NB: this is meaningless in Unicode build where data are stored as wchar_t* + wxString GetEncoding() const { return m_encoding; } + void SetEncoding(const wxString& enc) { m_encoding = enc; } +#endif + + static wxVersionInfo GetLibraryVersionInfo(); + +private: + wxString m_version; + wxString m_fileEncoding; +#if !wxUSE_UNICODE + wxString m_encoding; +#endif + wxXmlDoctype m_doctype; + wxXmlNode *m_docNode; + wxTextFileType m_fileType; + wxString m_eol; + + void DoCopy(const wxXmlDocument& doc); + + wxDECLARE_CLASS(wxXmlDocument); +}; + +#endif // wxUSE_XML + +#endif // _WX_XML_H_ diff --git a/lib/wxWidgets/include/wx/xpmdecod.h b/lib/wxWidgets/include/wx/xpmdecod.h new file mode 100644 index 0000000..46b5aaf --- /dev/null +++ b/lib/wxWidgets/include/wx/xpmdecod.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xpmdecod.h +// Purpose: wxXPMDecoder, XPM reader for wxImage and wxBitmap +// Author: Vaclav Slavik +// Copyright: (c) 2001 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XPMDECOD_H_ +#define _WX_XPMDECOD_H_ + +#include "wx/defs.h" + +#if wxUSE_IMAGE && wxUSE_XPM + +class WXDLLIMPEXP_FWD_CORE wxImage; +class WXDLLIMPEXP_FWD_BASE wxInputStream; + +// -------------------------------------------------------------------------- +// wxXPMDecoder class +// -------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxXPMDecoder +{ +public: + // constructor, destructor, etc. + wxXPMDecoder() {} + ~wxXPMDecoder() {} + +#if wxUSE_STREAMS + // Is the stream XPM file? + // NOTE: this function modifies the current stream position + bool CanRead(wxInputStream& stream); + + // Read XPM file from the stream, parse it and create image from it + wxImage ReadFile(wxInputStream& stream); +#endif + + // Read directly from XPM data (as passed to wxBitmap ctor): + wxImage ReadData(const char* const* xpm_data); + +}; + +#endif // wxUSE_IMAGE && wxUSE_XPM + +#endif // _WX_XPM_H_ diff --git a/lib/wxWidgets/include/wx/xpmhand.h b/lib/wxWidgets/include/wx/xpmhand.h new file mode 100644 index 0000000..c7f8d0d --- /dev/null +++ b/lib/wxWidgets/include/wx/xpmhand.h @@ -0,0 +1,21 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xpmhand.h +// Purpose: XPM handler base header +// Author: Julian Smart +// Modified by: +// Created: +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XPMHAND_H_BASE_ +#define _WX_XPMHAND_H_BASE_ + +// Only wxMSW currently defines a separate XPM handler, since +// mostly Windows apps won't need XPMs. +#if defined(__WXMSW__) +#error xpmhand.h is no longer needed since wxImage now handles XPMs. +#endif + +#endif + // _WX_XPMHAND_H_BASE_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_activityindicator.h b/lib/wxWidgets/include/wx/xrc/xh_activityindicator.h new file mode 100644 index 0000000..b6a0e8c --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_activityindicator.h @@ -0,0 +1,31 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_activityindicator.h +// Purpose: Declaration of wxActivityIndicator XRC handler. +// Author: Vadim Zeitlin +// Created: 2015-03-18 +// Copyright: (c) 2015 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_ACTIVITYINDICATOR_H_ +#define _WX_XH_ACTIVITYINDICATOR_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_ACTIVITYINDICATOR + +class WXDLLIMPEXP_XRC wxActivityIndicatorXmlHandler : public wxXmlResourceHandler +{ +public: + wxActivityIndicatorXmlHandler(); + + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxActivityIndicatorXmlHandler); +}; + +#endif // wxUSE_XRC && wxUSE_ACTIVITYINDICATOR + +#endif // _WX_XH_ACTIVITYINDICATOR_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_all.h b/lib/wxWidgets/include/wx/xrc/xh_all.h new file mode 100644 index 0000000..df10787 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_all.h @@ -0,0 +1,83 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_all.h +// Purpose: includes all xh_*.h files +// Author: Vaclav Slavik +// Created: 2000/03/05 +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_ALL_H_ +#define _WX_XH_ALL_H_ + + +// Existing handlers: + +#include "wx/xrc/xh_activityindicator.h" +#include "wx/xrc/xh_animatctrl.h" +#include "wx/xrc/xh_bannerwindow.h" +#include "wx/xrc/xh_bmp.h" +#include "wx/xrc/xh_bmpbt.h" +#include "wx/xrc/xh_bmpcbox.h" +#include "wx/xrc/xh_bttn.h" +#include "wx/xrc/xh_cald.h" +#include "wx/xrc/xh_chckb.h" +#include "wx/xrc/xh_chckl.h" +#include "wx/xrc/xh_choic.h" +#include "wx/xrc/xh_choicbk.h" +#include "wx/xrc/xh_clrpicker.h" +#include "wx/xrc/xh_cmdlinkbn.h" +#include "wx/xrc/xh_collpane.h" +#include "wx/xrc/xh_combo.h" +#include "wx/xrc/xh_comboctrl.h" +#include "wx/xrc/xh_dataview.h" +#include "wx/xrc/xh_datectrl.h" +#include "wx/xrc/xh_dirpicker.h" +#include "wx/xrc/xh_dlg.h" +#include "wx/xrc/xh_editlbox.h" +#include "wx/xrc/xh_filectrl.h" +#include "wx/xrc/xh_filepicker.h" +#include "wx/xrc/xh_fontpicker.h" +#include "wx/xrc/xh_frame.h" +#include "wx/xrc/xh_gauge.h" +#include "wx/xrc/xh_gdctl.h" +#include "wx/xrc/xh_grid.h" +#include "wx/xrc/xh_html.h" +#include "wx/xrc/xh_htmllbox.h" +#include "wx/xrc/xh_hyperlink.h" +#include "wx/xrc/xh_infobar.h" +#include "wx/xrc/xh_listb.h" +#include "wx/xrc/xh_listc.h" +#include "wx/xrc/xh_listbk.h" +#include "wx/xrc/xh_mdi.h" +#include "wx/xrc/xh_menu.h" +#include "wx/xrc/xh_notbk.h" +#include "wx/xrc/xh_odcombo.h" +#include "wx/xrc/xh_panel.h" +#include "wx/xrc/xh_propdlg.h" +#include "wx/xrc/xh_radbt.h" +#include "wx/xrc/xh_radbx.h" +#include "wx/xrc/xh_scrol.h" +#include "wx/xrc/xh_scwin.h" +#include "wx/xrc/xh_simplebook.h" +#include "wx/xrc/xh_sizer.h" +#include "wx/xrc/xh_slidr.h" +#include "wx/xrc/xh_spin.h" +#include "wx/xrc/xh_split.h" +#include "wx/xrc/xh_srchctrl.h" +#include "wx/xrc/xh_statbar.h" +#include "wx/xrc/xh_stbox.h" +#include "wx/xrc/xh_stbmp.h" +#include "wx/xrc/xh_sttxt.h" +#include "wx/xrc/xh_stlin.h" +#include "wx/xrc/xh_text.h" +#include "wx/xrc/xh_tglbtn.h" +#include "wx/xrc/xh_timectrl.h" +#include "wx/xrc/xh_toolb.h" +#include "wx/xrc/xh_toolbk.h" +#include "wx/xrc/xh_tree.h" +#include "wx/xrc/xh_treebk.h" +#include "wx/xrc/xh_unkwn.h" +#include "wx/xrc/xh_wizrd.h" + +#endif // _WX_XH_ALL_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_animatctrl.h b/lib/wxWidgets/include/wx/xrc/xh_animatctrl.h new file mode 100644 index 0000000..5af50ba --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_animatctrl.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_animatctrl.h +// Purpose: XML resource handler for wxAnimationCtrl +// Author: Francesco Montorsi +// Created: 2006-10-15 +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_ANIMATIONCTRL_H_ +#define _WX_XH_ANIMATIONCTRL_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_ANIMATIONCTRL + +class WXDLLIMPEXP_XRC wxAnimationCtrlXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxAnimationCtrlXmlHandler); + +public: + wxAnimationCtrlXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC && wxUSE_ANIMATIONCTRL + +#endif // _WX_XH_ANIMATIONCTRL_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_aui.h b/lib/wxWidgets/include/wx/xrc/xh_aui.h new file mode 100644 index 0000000..ada8e34 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_aui.h @@ -0,0 +1,51 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_aui.h +// Purpose: XRC resource handler for wxAUI +// Author: Andrea Zanellato, Steve Lamerton (wxAuiNotebook) +// Created: 2011-09-18 +// Copyright: (c) 2011 wxWidgets Team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_AUI_H_ +#define _WX_XH_AUI_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_AUI + +#include "wx/vector.h" + +class WXDLLIMPEXP_FWD_AUI wxAuiManager; +class WXDLLIMPEXP_FWD_AUI wxAuiNotebook; + +class WXDLLIMPEXP_AUI wxAuiXmlHandler : public wxXmlResourceHandler +{ +public: + wxAuiXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + + // Returns the wxAuiManager for the specified window + wxAuiManager *GetAuiManager(wxWindow *managed) const; + +private: + // Used to UnInit() the wxAuiManager before destroying its managed window + void OnManagedWindowClose(wxWindowDestroyEvent &event); + + typedef wxVector Managers; + Managers m_managers; // all wxAuiManagers created in this handler + + wxAuiManager *m_manager; // Current wxAuiManager + wxWindow *m_window; // Current managed wxWindow + wxAuiNotebook *m_notebook; + + bool m_mgrInside; // Are we handling a wxAuiManager or panes inside it? + bool m_anbInside; // Are we handling a wxAuiNotebook or pages inside it? + + wxDECLARE_DYNAMIC_CLASS(wxAuiXmlHandler); +}; + +#endif //wxUSE_XRC && wxUSE_AUI + +#endif //_WX_XH_AUI_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_auitoolb.h b/lib/wxWidgets/include/wx/xrc/xh_auitoolb.h new file mode 100644 index 0000000..66c722e --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_auitoolb.h @@ -0,0 +1,51 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_toolb.h +// Purpose: XML resource handler for wxAuiToolBar +// Author: Rodolphe Suescun +// Created: 2013-11-23 +// Copyright: (c) 2013 Rodolphe Suescun +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_AUITOOLB_H_ +#define _WX_XH_AUITOOLB_H_ + +#include "wx/aui/auibar.h" +#include "wx/menu.h" +#include "wx/vector.h" +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_AUI + +class WXDLLIMPEXP_FWD_AUI wxAuiToolBar; + +class WXDLLIMPEXP_AUI wxAuiToolBarXmlHandler : public wxXmlResourceHandler +{ +public: + wxAuiToolBarXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + bool m_isInside; + wxAuiToolBar *m_toolbar; + wxSize m_toolSize; + + class MenuHandler : public wxEvtHandler + { + public: + void OnDropDown(wxAuiToolBarEvent& event); + unsigned RegisterMenu(wxAuiToolBar *toobar, int id, wxMenu *menu); + + private: + wxVector m_menus; + }; + + MenuHandler m_menuHandler; + + wxDECLARE_DYNAMIC_CLASS(wxAuiToolBarXmlHandler); +}; + +#endif // wxUSE_XRC && wxUSE_AUI + +#endif // _WX_XH_AUITOOLB_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_bannerwindow.h b/lib/wxWidgets/include/wx/xrc/xh_bannerwindow.h new file mode 100644 index 0000000..7631bb2 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_bannerwindow.h @@ -0,0 +1,30 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_bannerwindow.h +// Purpose: Declaration of wxBannerWindow XRC handler. +// Author: Vadim Zeitlin +// Created: 2011-08-16 +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_BANNERWINDOW_H_ +#define _WX_XH_BANNERWINDOW_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_BANNERWINDOW + +class WXDLLIMPEXP_XRC wxBannerWindowXmlHandler : public wxXmlResourceHandler +{ +public: + wxBannerWindowXmlHandler(); + + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxBannerWindowXmlHandler); +}; + +#endif // wxUSE_XRC && wxUSE_BANNERWINDOW + +#endif // _WX_XH_BANNERWINDOW_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_bmp.h b/lib/wxWidgets/include/wx/xrc/xh_bmp.h new file mode 100644 index 0000000..9d27430 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_bmp.h @@ -0,0 +1,39 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_bmp.h +// Purpose: XML resource handler for wxBitmap and wxIcon +// Author: Vaclav Slavik +// Created: 2000/09/00 +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_BMP_H_ +#define _WX_XH_BMP_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC + +class WXDLLIMPEXP_XRC wxBitmapXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxBitmapXmlHandler); + +public: + wxBitmapXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +class WXDLLIMPEXP_XRC wxIconXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxIconXmlHandler); + +public: + wxIconXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC + +#endif // _WX_XH_BMP_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_bmpbt.h b/lib/wxWidgets/include/wx/xrc/xh_bmpbt.h new file mode 100644 index 0000000..f3e10b5 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_bmpbt.h @@ -0,0 +1,39 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_bmpbt.h +// Purpose: XML resource handler for bitmap buttons +// Author: Brian Gavin +// Created: 2000/03/05 +// Copyright: (c) 2000 Brian Gavin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_BMPBT_H_ +#define _WX_XH_BMPBT_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_BMPBUTTON + +#include "wx/bmpbuttn.h" + +class WXDLLIMPEXP_XRC wxBitmapButtonXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxBitmapButtonXmlHandler); + +public: + wxBitmapButtonXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + typedef void (wxBitmapButton::*BitmapSetter)(const wxBitmapBundle&); + + void SetBitmapIfSpecified(wxBitmapButton* button, + BitmapSetter setter, + const char* paramName, + const char* paramNameAlt = NULL); +}; + +#endif // wxUSE_XRC && wxUSE_BMPBUTTON + +#endif // _WX_XH_BMPBT_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_bmpcbox.h b/lib/wxWidgets/include/wx/xrc/xh_bmpcbox.h new file mode 100644 index 0000000..7a536ba --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_bmpcbox.h @@ -0,0 +1,35 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_bmpcbox.h +// Purpose: XML resource handler for wxBitmapComboBox +// Author: Jaakko Salli +// Created: Sep-10-2006 +// Copyright: (c) 2006 Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_BMPCBOX_H_ +#define _WX_XH_BMPCBOX_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_BITMAPCOMBOBOX + +class WXDLLIMPEXP_FWD_CORE wxBitmapComboBox; + +class WXDLLIMPEXP_XRC wxBitmapComboBoxXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxBitmapComboBoxXmlHandler); + +public: + wxBitmapComboBoxXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + wxBitmapComboBox* m_combobox; + bool m_isInside; +}; + +#endif // wxUSE_XRC && wxUSE_BITMAPCOMBOBOX + +#endif // _WX_XH_BMPCBOX_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_bookctrlbase.h b/lib/wxWidgets/include/wx/xrc/xh_bookctrlbase.h new file mode 100644 index 0000000..8db4d72 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_bookctrlbase.h @@ -0,0 +1,82 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_bookctrlbase.h +// Purpose: Base class for wxBookCtrl-derived classes XRC handlers +// Author: Vadim Zeitlin +// Created: 2022-02-23 +// Copyright: (c) 2022 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XRC_XH_BOOKCTRLBASE_H_ +#define _WX_XRC_XH_BOOKCTRLBASE_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_BOOKCTRL + +class WXDLLIMPEXP_FWD_CORE wxBookCtrlBase; + +// ---------------------------------------------------------------------------- +// wxBookCtrlXmlHandlerBase: base class of handlers for wxBookCtrl subclasses +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_XRC wxBookCtrlXmlHandlerBase : public wxXmlResourceHandler +{ +protected: + wxBookCtrlXmlHandlerBase(); + virtual ~wxBookCtrlXmlHandlerBase(); + + // Create all pages under the current node and add them to the book control. + // + // This should be called instead of calling CreateChildren() directly by + // the derived class to deal with the contents of the book control node. + void DoCreatePages(wxBookCtrlBase* book); + + // Create a new page using the contents of the current node. + // + // This should be called to handle the book control page node. + wxObject* DoCreatePage(wxBookCtrlBase* book); + + // Return true if we're parsing the book control node itself. + bool IsInside() const { return m_isInside; } + + // This struct contains the actual page, created by DoCreatePage(), and all + // its attributes read from wxXmlNode. + struct PageWithAttrs + { + PageWithAttrs(); + + // Returns bmpId if it's valid or imgId (which can still be invalid) + // otherwise. + int GetImageId() const; + + wxWindow* wnd; + wxString label; + bool selected; + int imgId; // index in the image list + int bmpId; // index in m_bookImages vector + }; + +private: + // This function is implemented by just calling AddPage() in the base + // class, but can be overridden if something else is needed, as is e.g. the + // case for wxTreebookXmlHandler. + virtual void + DoAddPage(wxBookCtrlBase* book, size_t n, const PageWithAttrs& page); + + + // And this vector contains all the pages created so far. + wxVector m_bookPages; + + // All bitmaps defined for the pages, may be empty. + wxVector m_bookImages; + + // True if we're used for parsing the contents of the book control node. + bool m_isInside; + + wxDECLARE_NO_COPY_CLASS(wxBookCtrlXmlHandlerBase); +}; + +#endif // wxUSE_XRC && wxUSE_BOOKCTRL + +#endif // _WX_XRC_XH_BOOKCTRLBASE_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_bttn.h b/lib/wxWidgets/include/wx/xrc/xh_bttn.h new file mode 100644 index 0000000..5c608ae --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_bttn.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_bttn.h +// Purpose: XML resource handler for buttons +// Author: Vaclav Slavik +// Created: 2000/03/05 +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_BTTN_H_ +#define _WX_XH_BTTN_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_BUTTON + +class WXDLLIMPEXP_XRC wxButtonXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxButtonXmlHandler); + +public: + wxButtonXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC && wxUSE_BUTTON + +#endif // _WX_XH_BTTN_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_cald.h b/lib/wxWidgets/include/wx/xrc/xh_cald.h new file mode 100644 index 0000000..7bb2b61 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_cald.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_cald.h +// Purpose: XML resource handler for wxCalendarCtrl +// Author: Brian Gavin +// Created: 2000/09/09 +// Copyright: (c) 2000 Brian Gavin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_CALD_H_ +#define _WX_XH_CALD_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_CALENDARCTRL + +class WXDLLIMPEXP_XRC wxCalendarCtrlXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxCalendarCtrlXmlHandler); + +public: + wxCalendarCtrlXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC && wxUSE_CALENDARCTRL + +#endif // _WX_XH_CALD_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_chckb.h b/lib/wxWidgets/include/wx/xrc/xh_chckb.h new file mode 100644 index 0000000..e07daf5 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_chckb.h @@ -0,0 +1,30 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_chckb.h +// Purpose: XML resource handler for wxCheckBox +// Author: Bob Mitchell +// Created: 2000/03/21 +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_CHCKB_H_ +#define _WX_XH_CHCKB_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_CHECKBOX + +class WXDLLIMPEXP_XRC wxCheckBoxXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxCheckBoxXmlHandler); + +public: + wxCheckBoxXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC && wxUSE_CHECKBOX + +#endif // _WX_XH_CHECKBOX_H_ + diff --git a/lib/wxWidgets/include/wx/xrc/xh_chckl.h b/lib/wxWidgets/include/wx/xrc/xh_chckl.h new file mode 100644 index 0000000..6761361 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_chckl.h @@ -0,0 +1,33 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_chckl.h +// Purpose: XML resource handler for wxCheckListBox +// Author: Bob Mitchell +// Created: 2000/03/21 +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_CHCKL_H_ +#define _WX_XH_CHCKL_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_CHECKLISTBOX + +class WXDLLIMPEXP_XRC wxCheckListBoxXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxCheckListBoxXmlHandler); + +public: + wxCheckListBoxXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + bool m_insideBox; + wxArrayString strList; +}; + +#endif // wxUSE_XRC && wxUSE_CHECKLISTBOX + +#endif // _WX_XH_CHECKLIST_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_choic.h b/lib/wxWidgets/include/wx/xrc/xh_choic.h new file mode 100644 index 0000000..8275586 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_choic.h @@ -0,0 +1,33 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_choic.h +// Purpose: XML resource handler for wxChoice +// Author: Bob Mitchell +// Created: 2000/03/21 +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_CHOIC_H_ +#define _WX_XH_CHOIC_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_CHOICE + +class WXDLLIMPEXP_XRC wxChoiceXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxChoiceXmlHandler); + +public: + wxChoiceXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + bool m_insideBox; + wxArrayString strList; +}; + +#endif // wxUSE_XRC && wxUSE_CHOICE + +#endif // _WX_XH_CHOIC_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_choicbk.h b/lib/wxWidgets/include/wx/xrc/xh_choicbk.h new file mode 100644 index 0000000..4cfe757 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_choicbk.h @@ -0,0 +1,33 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_choicbk.h +// Purpose: XML resource handler for wxChoicebook +// Author: Vaclav Slavik +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_CHOICEBK_H_ +#define _WX_XH_CHOICEBK_H_ + +#include "wx/xrc/xh_bookctrlbase.h" + +#if wxUSE_XRC && wxUSE_CHOICEBOOK + +class WXDLLIMPEXP_FWD_CORE wxChoicebook; + +class WXDLLIMPEXP_XRC wxChoicebookXmlHandler : public wxBookCtrlXmlHandlerBase +{ + wxDECLARE_DYNAMIC_CLASS(wxChoicebookXmlHandler); + +public: + wxChoicebookXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + wxChoicebook *m_choicebook; +}; + +#endif // wxUSE_XRC && wxUSE_CHOICEBOOK + +#endif // _WX_XH_CHOICEBK_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_clrpicker.h b/lib/wxWidgets/include/wx/xrc/xh_clrpicker.h new file mode 100644 index 0000000..4798811 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_clrpicker.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_clrpicker.h +// Purpose: XML resource handler for wxColourPickerCtrl +// Author: Francesco Montorsi +// Created: 2006-04-17 +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_CLRPICKERCTRL_H_ +#define _WX_XH_CLRPICKERCTRL_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_COLOURPICKERCTRL + +class WXDLLIMPEXP_XRC wxColourPickerCtrlXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxColourPickerCtrlXmlHandler); + +public: + wxColourPickerCtrlXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC && wxUSE_COLOURPICKERCTRL + +#endif // _WX_XH_CLRPICKERCTRL_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_cmdlinkbn.h b/lib/wxWidgets/include/wx/xrc/xh_cmdlinkbn.h new file mode 100644 index 0000000..91482a8 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_cmdlinkbn.h @@ -0,0 +1,31 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_cmdlinkbn.h +// Purpose: XML resource handler for command link buttons +// Author: Kinaou Herve +// Created: 2010-10-20 +// Copyright: (c) 2010 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_CMDLINKBN_H_ +#define _WX_XH_CMDLINKBN_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_COMMANDLINKBUTTON + +class WXDLLIMPEXP_XRC wxCommandLinkButtonXmlHandler : public wxXmlResourceHandler +{ +public: + wxCommandLinkButtonXmlHandler(); + + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxCommandLinkButtonXmlHandler); +}; + +#endif // wxUSE_XRC && wxUSE_COMMANDLINKBUTTON + +#endif // _WX_XH_CMDLINKBN_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_collpane.h b/lib/wxWidgets/include/wx/xrc/xh_collpane.h new file mode 100644 index 0000000..14b92b8 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_collpane.h @@ -0,0 +1,35 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_collpane.h +// Purpose: XML resource handler for wxCollapsiblePane +// Author: Francesco Montorsi +// Created: 2006-10-27 +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_COLLPANE_H_ +#define _WX_XH_COLLPANE_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_COLLPANE + +class WXDLLIMPEXP_FWD_CORE wxCollapsiblePane; + +class WXDLLIMPEXP_XRC wxCollapsiblePaneXmlHandler : public wxXmlResourceHandler +{ +public: + wxCollapsiblePaneXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + bool m_isInside; + wxCollapsiblePane *m_collpane; + + wxDECLARE_DYNAMIC_CLASS(wxCollapsiblePaneXmlHandler); +}; + +#endif // wxUSE_XRC && wxUSE_COLLPANE + +#endif // _WX_XH_COLLPANE_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_combo.h b/lib/wxWidgets/include/wx/xrc/xh_combo.h new file mode 100644 index 0000000..9fa1c51 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_combo.h @@ -0,0 +1,33 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_combo.h +// Purpose: XML resource handler for wxComboBox +// Author: Bob Mitchell +// Created: 2000/03/21 +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_COMBO_H_ +#define _WX_XH_COMBO_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_COMBOBOX + +class WXDLLIMPEXP_XRC wxComboBoxXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxComboBoxXmlHandler); + +public: + wxComboBoxXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + bool m_insideBox; + wxArrayString strList; +}; + +#endif // wxUSE_XRC && wxUSE_COMBOBOX + +#endif // _WX_XH_COMBO_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_comboctrl.h b/lib/wxWidgets/include/wx/xrc/xh_comboctrl.h new file mode 100644 index 0000000..e3c4467 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_comboctrl.h @@ -0,0 +1,31 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_comboctrl.h +// Purpose: XML resource handler for wxComboBox +// Author: Jaakko Salli +// Created: 2009/01/25 +// Copyright: (c) 2009 Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_COMBOCTRL_H_ +#define _WX_XH_COMBOCTRL_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_COMBOCTRL + +class WXDLLIMPEXP_XRC wxComboCtrlXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxComboCtrlXmlHandler); + +public: + wxComboCtrlXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: +}; + +#endif // wxUSE_XRC && wxUSE_COMBOCTRL + +#endif // _WX_XH_COMBOCTRL_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_dataview.h b/lib/wxWidgets/include/wx/xrc/xh_dataview.h new file mode 100644 index 0000000..c022d4a --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_dataview.h @@ -0,0 +1,34 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_dataview.h +// Purpose: XML resource handler for wxDataViewCtrl +// Author: Anton Triest +// Created: 2019/06/27 +// Copyright: (c) 2019 Anton Triest, Bricsys +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_DATAVIEW_H_ +#define _WX_XH_DATAVIEW_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_DATAVIEWCTRL + +class WXDLLIMPEXP_XRC wxDataViewXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxDataViewXmlHandler); + +public: + wxDataViewXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + wxObject* HandleCtrl(); + wxObject* HandleListCtrl(); + wxObject* HandleTreeCtrl(); +}; + +#endif // wxUSE_XRC && wxUSE_DATAVIEWCTRL + +#endif // _WX_XH_DATAVIEW_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_datectrl.h b/lib/wxWidgets/include/wx/xrc/xh_datectrl.h new file mode 100644 index 0000000..2626f93 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_datectrl.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_datectrl.h +// Purpose: XML resource handler for wxDatePickerCtrl +// Author: Vaclav Slavik +// Created: 2005-02-07 +// Copyright: (c) 2005 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_DATECTRL_H_ +#define _WX_XH_DATECTRL_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_DATEPICKCTRL + +class WXDLLIMPEXP_XRC wxDateCtrlXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxDateCtrlXmlHandler); + +public: + wxDateCtrlXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC && wxUSE_DATEPICKCTRL + +#endif // _WX_XH_DATECTRL_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_dirpicker.h b/lib/wxWidgets/include/wx/xrc/xh_dirpicker.h new file mode 100644 index 0000000..120f136 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_dirpicker.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_dirpicker.h +// Purpose: XML resource handler for wxDirPickerCtrl +// Author: Francesco Montorsi +// Created: 2006-04-17 +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_DIRPICKERCTRL_H_ +#define _WX_XH_DIRPICKERCTRL_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_DIRPICKERCTRL + +class WXDLLIMPEXP_XRC wxDirPickerCtrlXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxDirPickerCtrlXmlHandler); + +public: + wxDirPickerCtrlXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC && wxUSE_DIRPICKERCTRL + +#endif // _WX_XH_DIRPICKERCTRL_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_dlg.h b/lib/wxWidgets/include/wx/xrc/xh_dlg.h new file mode 100644 index 0000000..ca3f1b6 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_dlg.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_dlg.h +// Purpose: XML resource handler for dialogs +// Author: Vaclav Slavik +// Created: 2000/03/05 +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_DLG_H_ +#define _WX_XH_DLG_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC + +class WXDLLIMPEXP_XRC wxDialogXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxDialogXmlHandler); + +public: + wxDialogXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC + +#endif // _WX_XH_DLG_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_editlbox.h b/lib/wxWidgets/include/wx/xrc/xh_editlbox.h new file mode 100644 index 0000000..0d0cb18 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_editlbox.h @@ -0,0 +1,39 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_editlbox.h +// Purpose: declaration of wxEditableListBox XRC handler +// Author: Vadim Zeitlin +// Created: 2009-06-04 +// Copyright: (c) 2009 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XRC_XH_EDITLBOX_H_ +#define _WX_XRC_XH_EDITLBOX_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_EDITABLELISTBOX + +// ---------------------------------------------------------------------------- +// wxEditableListBoxXmlHandler: XRC handler for wxEditableListBox +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_XRC wxEditableListBoxXmlHandler : public wxXmlResourceHandler +{ +public: + wxEditableListBoxXmlHandler(); + + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + bool m_insideBox; + wxArrayString m_items; + + wxDECLARE_DYNAMIC_CLASS(wxEditableListBoxXmlHandler); +}; + +#endif // wxUSE_XRC && wxUSE_EDITABLELISTBOX + +#endif // _WX_XRC_XH_EDITLBOX_H_ + diff --git a/lib/wxWidgets/include/wx/xrc/xh_filectrl.h b/lib/wxWidgets/include/wx/xrc/xh_filectrl.h new file mode 100644 index 0000000..c32bebb --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_filectrl.h @@ -0,0 +1,30 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_filectrl.h +// Purpose: XML resource handler for wxFileCtrl +// Author: Kinaou Hervé +// Created: 2009-05-11 +// Copyright: (c) 2009 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_FILECTRL_H_ +#define _WX_XH_FILECTRL_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_FILECTRL + +class WXDLLIMPEXP_XRC wxFileCtrlXmlHandler : public wxXmlResourceHandler +{ +public: + wxFileCtrlXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxFileCtrlXmlHandler); +}; + +#endif // wxUSE_XRC && wxUSE_FILECTRL + +#endif // _WX_XH_FILEPICKERCTRL_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_filepicker.h b/lib/wxWidgets/include/wx/xrc/xh_filepicker.h new file mode 100644 index 0000000..206f6c1 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_filepicker.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_filepicker.h +// Purpose: XML resource handler for wxFilePickerCtrl +// Author: Francesco Montorsi +// Created: 2006-04-17 +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_FILEPICKERCTRL_H_ +#define _WX_XH_FILEPICKERCTRL_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_FILEPICKERCTRL + +class WXDLLIMPEXP_XRC wxFilePickerCtrlXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxFilePickerCtrlXmlHandler); + +public: + wxFilePickerCtrlXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC && wxUSE_FILEPICKERCTRL + +#endif // _WX_XH_FILEPICKERCTRL_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_fontpicker.h b/lib/wxWidgets/include/wx/xrc/xh_fontpicker.h new file mode 100644 index 0000000..822c0d9 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_fontpicker.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_fontpicker.h +// Purpose: XML resource handler for wxFontPickerCtrl +// Author: Francesco Montorsi +// Created: 2006-04-17 +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_FONTPICKERCTRL_H_ +#define _WX_XH_FONTPICKERCTRL_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_FONTPICKERCTRL + +class WXDLLIMPEXP_XRC wxFontPickerCtrlXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxFontPickerCtrlXmlHandler); + +public: + wxFontPickerCtrlXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC && wxUSE_FONTPICKERCTRL + +#endif // _WX_XH_FONTPICKERCTRL_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_frame.h b/lib/wxWidgets/include/wx/xrc/xh_frame.h new file mode 100644 index 0000000..8370892 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_frame.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_frame.h +// Purpose: XML resource handler for wxFrame +// Author: Vaclav Slavik & Aleks. +// Created: 2000/03/05 +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_FRAME_H_ +#define _WX_XH_FRAME_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC + +class WXDLLIMPEXP_XRC wxFrameXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxFrameXmlHandler); + +public: + wxFrameXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC + +#endif // _WX_XH_FRAME_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_gauge.h b/lib/wxWidgets/include/wx/xrc/xh_gauge.h new file mode 100644 index 0000000..af147d6 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_gauge.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_gauge.h +// Purpose: XML resource handler for wxGauge +// Author: Bob Mitchell +// Created: 2000/03/21 +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_GAUGE_H_ +#define _WX_XH_GAUGE_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_GAUGE + +class WXDLLIMPEXP_XRC wxGaugeXmlHandler : public wxXmlResourceHandler +{ +public: + wxGaugeXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxGaugeXmlHandler); +}; + +#endif // wxUSE_XRC && wxUSE_GAUGE + +#endif // _WX_XH_GAUGE_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_gdctl.h b/lib/wxWidgets/include/wx/xrc/xh_gdctl.h new file mode 100644 index 0000000..398881d --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_gdctl.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_gdctl.h +// Purpose: XML resource handler for wxGenericDirCtrl +// Author: Markus Greither +// Created: 2002/01/20 +// Copyright: (c) 2002 Markus Greither +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_GDCTL_H_ +#define _WX_XH_GDCTL_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_DIRDLG + +class WXDLLIMPEXP_XRC wxGenericDirCtrlXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxGenericDirCtrlXmlHandler); + +public: + wxGenericDirCtrlXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC && wxUSE_DIRDLG + +#endif // _WX_XH_GDCTL_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_grid.h b/lib/wxWidgets/include/wx/xrc/xh_grid.h new file mode 100644 index 0000000..553d5fd --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_grid.h @@ -0,0 +1,30 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_grid.h +// Purpose: XML resource handler for wxGrid +// Author: Agron Selimaj +// Created: 2005/08/11 +// Copyright: (c) 2005 Agron Selimaj, Freepour Controls Inc. +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_GRD_H_ +#define _WX_XH_GRD_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_GRID + +class WXDLLIMPEXP_XRC wxGridXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxGridXmlHandler); + +public: + wxGridXmlHandler(); + + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC && wxUSE_GRID + +#endif // _WX_XH_GRD_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_html.h b/lib/wxWidgets/include/wx/xrc/xh_html.h new file mode 100644 index 0000000..1266182 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_html.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_html.h +// Purpose: XML resource handler for wxHtmlWindow +// Author: Bob Mitchell +// Created: 2000/03/21 +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_HTML_H_ +#define _WX_XH_HTML_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_HTML + +class WXDLLIMPEXP_XRC wxHtmlWindowXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxHtmlWindowXmlHandler); + +public: + wxHtmlWindowXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC && wxUSE_HTML + +#endif // _WX_XH_HTML_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_htmllbox.h b/lib/wxWidgets/include/wx/xrc/xh_htmllbox.h new file mode 100644 index 0000000..7c8adc0 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_htmllbox.h @@ -0,0 +1,33 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_htmllbox.h +// Purpose: XML resource handler for wxSimpleHtmlListBox +// Author: Francesco Montorsi +// Created: 2006/10/21 +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_SIMPLEHTMLLISTBOX_H_ +#define _WX_XH_SIMPLEHTMLLISTBOX_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_HTML + +class WXDLLIMPEXP_XRC wxSimpleHtmlListBoxXmlHandler : public wxXmlResourceHandler +{ +public: + wxSimpleHtmlListBoxXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + bool m_insideBox; + wxArrayString strList; + + wxDECLARE_DYNAMIC_CLASS(wxSimpleHtmlListBoxXmlHandler); +}; + +#endif // wxUSE_XRC && wxUSE_HTML + +#endif // _WX_XH_SIMPLEHTMLLISTBOX_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_hyperlink.h b/lib/wxWidgets/include/wx/xrc/xh_hyperlink.h new file mode 100644 index 0000000..adb11d8 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_hyperlink.h @@ -0,0 +1,36 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_hyperlink.h +// Purpose: Hyperlink control (wxAdv) +// Author: David Norris +// Modified by: Ryan Norton, Francesco Montorsi +// Created: 04/02/2005 +// Copyright: (c) 2005 David Norris +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_HYPERLINKH__ +#define _WX_XH_HYPERLINKH__ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_HYPERLINKCTRL + +class WXDLLIMPEXP_XRC wxHyperlinkCtrlXmlHandler : public wxXmlResourceHandler +{ + // Register with wxWindows' dynamic class subsystem. + wxDECLARE_DYNAMIC_CLASS(wxHyperlinkCtrlXmlHandler); + +public: + // Constructor. + wxHyperlinkCtrlXmlHandler(); + + // Creates the control and returns a pointer to it. + virtual wxObject *DoCreateResource() wxOVERRIDE; + + // Returns true if we know how to create a control for the given node. + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC && wxUSE_HYPERLINKCTRL + +#endif // _WX_XH_HYPERLINKH__ diff --git a/lib/wxWidgets/include/wx/xrc/xh_infobar.h b/lib/wxWidgets/include/wx/xrc/xh_infobar.h new file mode 100644 index 0000000..7c60437 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_infobar.h @@ -0,0 +1,36 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_infobar.h +// Purpose: XML resource handler for wxInfoBar +// Author: Ilya Sinitsyn +// Created: 2019-09-25 +// Copyright: (c) 2019 TT-Solutions SARL +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_INFOBAR_H_ +#define _WX_XH_INFOBAR_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_INFOBAR + +class WXDLLIMPEXP_XRC wxInfoBarXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxInfoBarXmlHandler); + +public: + wxInfoBarXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + wxShowEffect GetShowEffect(wxString const& param); + + bool m_insideBar; + + wxString m_effectNames[wxSHOW_EFFECT_MAX]; +}; + +#endif // wxUSE_XRC && wxUSE_INFOBAR + +#endif // _WX_XH_INFOBAR_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_listb.h b/lib/wxWidgets/include/wx/xrc/xh_listb.h new file mode 100644 index 0000000..2dbc3d4 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_listb.h @@ -0,0 +1,33 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_listb.h +// Purpose: XML resource handler for wxListbox +// Author: Bob Mitchell & Vaclav Slavik +// Created: 2000/07/29 +// Copyright: (c) 2000 Bob Mitchell & Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_LISTB_H_ +#define _WX_XH_LISTB_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_LISTBOX + +class WXDLLIMPEXP_XRC wxListBoxXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxListBoxXmlHandler); + +public: + wxListBoxXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + bool m_insideBox; + wxArrayString strList; +}; + +#endif // wxUSE_XRC && wxUSE_LISTBOX + +#endif // _WX_XH_LISTB_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_listbk.h b/lib/wxWidgets/include/wx/xrc/xh_listbk.h new file mode 100644 index 0000000..e5852fb --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_listbk.h @@ -0,0 +1,33 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_listbk.h +// Purpose: XML resource handler for wxListbook +// Author: Vaclav Slavik +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_LISTBK_H_ +#define _WX_XH_LISTBK_H_ + +#include "wx/xrc/xh_bookctrlbase.h" + +#if wxUSE_XRC && wxUSE_LISTBOOK + +class WXDLLIMPEXP_FWD_CORE wxListbook; + +class WXDLLIMPEXP_XRC wxListbookXmlHandler : public wxBookCtrlXmlHandlerBase +{ + wxDECLARE_DYNAMIC_CLASS(wxListbookXmlHandler); + +public: + wxListbookXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + wxListbook *m_listbook; +}; + +#endif // wxUSE_XRC && wxUSE_LISTBOOK + +#endif // _WX_XH_LISTBK_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_listc.h b/lib/wxWidgets/include/wx/xrc/xh_listc.h new file mode 100644 index 0000000..bfe6e5c --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_listc.h @@ -0,0 +1,45 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_listc.h +// Purpose: XML resource handler for wxListCtrl +// Author: Brian Gavin +// Created: 2000/09/09 +// Copyright: (c) 2000 Brian Gavin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_LISTC_H_ +#define _WX_XH_LISTC_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_LISTCTRL + +class WXDLLIMPEXP_FWD_CORE wxListCtrl; +class WXDLLIMPEXP_FWD_CORE wxListItem; + +class WXDLLIMPEXP_XRC wxListCtrlXmlHandler : public wxXmlResourceHandler +{ +public: + wxListCtrlXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + // handlers for wxListCtrl itself and its listcol and listitem children + wxListCtrl *HandleListCtrl(); + void HandleListCol(); + void HandleListItem(); + + // common part to HandleList{Col,Item}() + void HandleCommonItemAttrs(wxListItem& item); + + // gets the items image index in the corresponding image list (normal if + // which is wxIMAGE_LIST_NORMAL or small if it is wxIMAGE_LIST_SMALL) + long GetImageIndex(wxListCtrl *listctrl, int which); + + wxDECLARE_DYNAMIC_CLASS(wxListCtrlXmlHandler); +}; + +#endif // wxUSE_XRC && wxUSE_LISTCTRL + +#endif // _WX_XH_LISTC_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_mdi.h b/lib/wxWidgets/include/wx/xrc/xh_mdi.h new file mode 100644 index 0000000..bf2fd58 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_mdi.h @@ -0,0 +1,34 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_mdi.h +// Purpose: XML resource handler for wxMDI +// Author: David M. Falkinder & Vaclav Slavik +// Created: 14/02/2005 +// Copyright: (c) 2005 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_MDI_H_ +#define _WX_XH_MDI_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_MDI + +class WXDLLIMPEXP_FWD_CORE wxWindow; + +class WXDLLIMPEXP_XRC wxMdiXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxMdiXmlHandler); + +public: + wxMdiXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + wxWindow *CreateFrame(); +}; + +#endif // wxUSE_XRC && wxUSE_MDI + +#endif // _WX_XH_MDI_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_menu.h b/lib/wxWidgets/include/wx/xrc/xh_menu.h new file mode 100644 index 0000000..4f89509 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_menu.h @@ -0,0 +1,42 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_menu.h +// Purpose: XML resource handler for menus/menubars +// Author: Vaclav Slavik +// Created: 2000/03/05 +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_MENU_H_ +#define _WX_XH_MENU_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_MENUS + +class WXDLLIMPEXP_XRC wxMenuXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxMenuXmlHandler); + +public: + wxMenuXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + bool m_insideMenu; +}; + +class WXDLLIMPEXP_XRC wxMenuBarXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxMenuBarXmlHandler); + +public: + wxMenuBarXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC && wxUSE_MENUS + +#endif // _WX_XH_MENU_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_notbk.h b/lib/wxWidgets/include/wx/xrc/xh_notbk.h new file mode 100644 index 0000000..d39e44d --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_notbk.h @@ -0,0 +1,33 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_notbk.h +// Purpose: XML resource handler for wxNotebook +// Author: Vaclav Slavik +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_NOTBK_H_ +#define _WX_XH_NOTBK_H_ + +#include "wx/xrc/xh_bookctrlbase.h" + +#if wxUSE_XRC && wxUSE_NOTEBOOK + +class WXDLLIMPEXP_FWD_CORE wxNotebook; + +class WXDLLIMPEXP_XRC wxNotebookXmlHandler : public wxBookCtrlXmlHandlerBase +{ + wxDECLARE_DYNAMIC_CLASS(wxNotebookXmlHandler); + +public: + wxNotebookXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + wxNotebook *m_notebook; +}; + +#endif // wxUSE_XRC && wxUSE_NOTEBOOK + +#endif // _WX_XH_NOTBK_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_odcombo.h b/lib/wxWidgets/include/wx/xrc/xh_odcombo.h new file mode 100644 index 0000000..a5c9d43 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_odcombo.h @@ -0,0 +1,34 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_odcombo.h +// Purpose: XML resource handler for wxOwnerDrawnComboBox +// Author: Alex Bligh - based on wx/xrc/xh_combo.h +// Created: 2006/06/19 +// Copyright: (c) 2006 Alex Bligh +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_ODCOMBO_H_ +#define _WX_XH_ODCOMBO_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_ODCOMBOBOX + +class WXDLLIMPEXP_XRC wxOwnerDrawnComboBoxXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxOwnerDrawnComboBoxXmlHandler); + +public: + wxOwnerDrawnComboBoxXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + bool m_insideBox; + wxArrayString strList; +}; + +#endif // wxUSE_XRC && wxUSE_ODCOMBOBOX + +#endif // _WX_XH_ODCOMBO_H_ + diff --git a/lib/wxWidgets/include/wx/xrc/xh_panel.h b/lib/wxWidgets/include/wx/xrc/xh_panel.h new file mode 100644 index 0000000..0f0b4b0 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_panel.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_panel.h +// Purpose: XML resource handler for wxPanel +// Author: Vaclav Slavik +// Created: 2000/03/05 +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_PANEL_H_ +#define _WX_XH_PANEL_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC + +class WXDLLIMPEXP_XRC wxPanelXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxPanelXmlHandler); + +public: + wxPanelXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC + +#endif // _WX_XH_PANEL_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_propdlg.h b/lib/wxWidgets/include/wx/xrc/xh_propdlg.h new file mode 100644 index 0000000..ad746ce --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_propdlg.h @@ -0,0 +1,34 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_propdlg.h +// Purpose: XML resource handler for wxPropertySheetDialog +// Author: Sander Berents +// Created: 2007/07/12 +// Copyright: (c) 2007 Sander Berents +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_PROPDLG_H_ +#define _WX_XH_PROPDLG_H_ + +#include "wx/xrc/xh_bookctrlbase.h" + +#if wxUSE_XRC && wxUSE_BOOKCTRL + +class WXDLLIMPEXP_FWD_CORE wxPropertySheetDialog; + +class WXDLLIMPEXP_XRC wxPropertySheetDialogXmlHandler : public wxBookCtrlXmlHandlerBase +{ + wxDECLARE_DYNAMIC_CLASS(wxPropertySheetDialogXmlHandler); + +public: + wxPropertySheetDialogXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + wxPropertySheetDialog *m_dialog; +}; + +#endif // wxUSE_XRC && wxUSE_BOOKCTRL + +#endif // _WX_XH_PROPDLG_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_radbt.h b/lib/wxWidgets/include/wx/xrc/xh_radbt.h new file mode 100644 index 0000000..fafda37 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_radbt.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_radbt.h +// Purpose: XML resource handler for wxRadioButton +// Author: Bob Mitchell +// Created: 2000/03/21 +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_RADBT_H_ +#define _WX_XH_RADBT_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_RADIOBTN + +class WXDLLIMPEXP_XRC wxRadioButtonXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxRadioButtonXmlHandler); + +public: + wxRadioButtonXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC && wxUSE_RADIOBOX + +#endif // _WX_XH_RADBT_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_radbx.h b/lib/wxWidgets/include/wx/xrc/xh_radbx.h new file mode 100644 index 0000000..aa9702f --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_radbx.h @@ -0,0 +1,49 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_radbx.h +// Purpose: XML resource handler for wxRadioBox +// Author: Bob Mitchell +// Created: 2000/03/21 +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_RADBX_H_ +#define _WX_XH_RADBX_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_RADIOBOX + +class WXDLLIMPEXP_XRC wxRadioBoxXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxRadioBoxXmlHandler); + +public: + wxRadioBoxXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + bool m_insideBox; + + // the items labels + wxArrayString m_labels; + +#if wxUSE_TOOLTIPS + // the items tooltips + wxArrayString m_tooltips; +#endif // wxUSE_TOOLTIPS + + // the item help text + wxArrayString m_helptexts; + wxArrayInt m_helptextSpecified; + + // if the corresponding array element is 1, the radiobox item is + // disabled/hidden + wxArrayInt m_isEnabled, + m_isShown; +}; + +#endif // wxUSE_XRC && wxUSE_RADIOBOX + +#endif // _WX_XH_RADBX_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_ribbon.h b/lib/wxWidgets/include/wx/xrc/xh_ribbon.h new file mode 100644 index 0000000..14f6719 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_ribbon.h @@ -0,0 +1,47 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_ribbon.h +// Purpose: XML resource handler for wxRibbon related classes +// Author: Armel Asselin +// Created: 2010-04-23 +// Copyright: (c) 2010 Armel Asselin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XRC_XH_RIBBON_H_ +#define _WX_XRC_XH_RIBBON_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_RIBBON + +class WXDLLIMPEXP_FWD_RIBBON wxRibbonControl; + +class WXDLLIMPEXP_RIBBON wxRibbonXmlHandler : public wxXmlResourceHandler +{ +public: + wxRibbonXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + const wxClassInfo *m_isInside; + + bool IsRibbonControl (wxXmlNode *node); + + wxObject* Handle_buttonbar(); + wxObject* Handle_button(); + wxObject* Handle_control(); + wxObject* Handle_page(); + wxObject* Handle_gallery(); + wxObject* Handle_galleryitem(); + wxObject* Handle_panel(); + wxObject* Handle_bar(); + + void Handle_RibbonArtProvider(wxRibbonControl *control); + + wxDECLARE_DYNAMIC_CLASS(wxRibbonXmlHandler); +}; + +#endif // wxUSE_XRC && wxUSE_RIBBON + +#endif // _WX_XRC_XH_RIBBON_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_richtext.h b/lib/wxWidgets/include/wx/xrc/xh_richtext.h new file mode 100644 index 0000000..979d73d --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_richtext.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_richtext.h +// Purpose: XML resource handler for wxRichTextCtrl +// Author: Julian Smart +// Created: 2006-11-08 +// Copyright: (c) 2006 Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_RICHTEXT_H_ +#define _WX_XH_RICHTEXT_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_RICHTEXT + +class WXDLLIMPEXP_RICHTEXT wxRichTextCtrlXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxRichTextCtrlXmlHandler); + +public: + wxRichTextCtrlXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC && wxUSE_RICHTEXT + +#endif // _WX_XH_RICHTEXT_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_scrol.h b/lib/wxWidgets/include/wx/xrc/xh_scrol.h new file mode 100644 index 0000000..ffd366c --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_scrol.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_scrol.h +// Purpose: XML resource handler for wxScrollBar +// Author: Brian Gavin +// Created: 2000/09/09 +// Copyright: (c) 2000 Brian Gavin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_SCROL_H_ +#define _WX_XH_SCROL_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_SCROLLBAR + +class WXDLLIMPEXP_XRC wxScrollBarXmlHandler : public wxXmlResourceHandler +{ +public: + wxScrollBarXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxScrollBarXmlHandler); +}; + +#endif // wxUSE_XRC && wxUSE_SCROLLBAR + +#endif // _WX_XH_SCROL_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_scwin.h b/lib/wxWidgets/include/wx/xrc/xh_scwin.h new file mode 100644 index 0000000..6d5d5fc --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_scwin.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_scwin.h +// Purpose: XML resource handler for wxScrolledWindow +// Author: Vaclav Slavik +// Created: 2002/10/18 +// Copyright: (c) 2002 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_SCWIN_H_ +#define _WX_XH_SCWIN_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC + +class WXDLLIMPEXP_XRC wxScrolledWindowXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxScrolledWindowXmlHandler); + +public: + wxScrolledWindowXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC + +#endif // _WX_XH_SCWIN_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_simplebook.h b/lib/wxWidgets/include/wx/xrc/xh_simplebook.h new file mode 100644 index 0000000..818bafe --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_simplebook.h @@ -0,0 +1,36 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_simplebook.h +// Purpose: XML resource handler for wxSimplebook +// Author: Vadim Zeitlin +// Created: 2014-08-05 +// Copyright: (c) 2014 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_SIMPLEBOOK_H_ +#define _WX_XH_SIMPLEBOOK_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_BOOKCTRL + +class wxSimplebook; + +class WXDLLIMPEXP_XRC wxSimplebookXmlHandler : public wxXmlResourceHandler +{ +public: + wxSimplebookXmlHandler(); + + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + bool m_isInside; + wxSimplebook *m_simplebook; + + wxDECLARE_DYNAMIC_CLASS(wxSimplebookXmlHandler); +}; + +#endif // wxUSE_XRC && wxUSE_BOOKCTRL + +#endif // _WX_XH_SIMPLEBOOK_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_sizer.h b/lib/wxWidgets/include/wx/xrc/xh_sizer.h new file mode 100644 index 0000000..594106a --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_sizer.h @@ -0,0 +1,84 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_sizer.h +// Purpose: XML resource handler for wxBoxSizer +// Author: Vaclav Slavik +// Created: 2000/04/24 +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_SIZER_H_ +#define _WX_XH_SIZER_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC + +#include "wx/sizer.h" +#include "wx/gbsizer.h" + +class WXDLLIMPEXP_XRC wxSizerXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxSizerXmlHandler); + +public: + wxSizerXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +protected: + virtual wxSizer* DoCreateSizer(const wxString& name); + virtual bool IsSizerNode(wxXmlNode *node) const; + +private: + bool m_isInside; + bool m_isGBS; + + wxSizer *m_parentSizer; + + + wxObject* Handle_sizeritem(); + wxObject* Handle_spacer(); + wxObject* Handle_sizer(); + wxSizer* Handle_wxBoxSizer(); +#if wxUSE_STATBOX + wxSizer* Handle_wxStaticBoxSizer(); +#endif + wxSizer* Handle_wxGridSizer(); + wxFlexGridSizer* Handle_wxFlexGridSizer(); + wxGridBagSizer* Handle_wxGridBagSizer(); + wxSizer* Handle_wxWrapSizer(); + + bool ValidateGridSizerChildren(); + void SetFlexibleMode(wxFlexGridSizer* fsizer); + void SetGrowables(wxFlexGridSizer* fsizer, const wxChar* param, bool rows); + wxGBPosition GetGBPos(); + wxGBSpan GetGBSpan(); + wxSizerItem* MakeSizerItem(); + void SetSizerItemAttributes(wxSizerItem* sitem); + void AddSizerItem(wxSizerItem* sitem); + int GetSizerFlags(); +}; + +#if wxUSE_BUTTON + +class WXDLLIMPEXP_XRC wxStdDialogButtonSizerXmlHandler + : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxStdDialogButtonSizerXmlHandler); + +public: + wxStdDialogButtonSizerXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + bool m_isInside; + wxStdDialogButtonSizer *m_parentSizer; +}; + +#endif // wxUSE_BUTTON + +#endif // wxUSE_XRC + +#endif // _WX_XH_SIZER_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_slidr.h b/lib/wxWidgets/include/wx/xrc/xh_slidr.h new file mode 100644 index 0000000..267cb33 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_slidr.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_slidr.h +// Purpose: XML resource handler for wxSlider +// Author: Bob Mitchell +// Created: 2000/03/21 +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_SLIDR_H_ +#define _WX_XH_SLIDR_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_SLIDER + +class WXDLLIMPEXP_XRC wxSliderXmlHandler : public wxXmlResourceHandler +{ +public: + wxSliderXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxSliderXmlHandler); +}; + +#endif // wxUSE_XRC && wxUSE_SLIDER + +#endif // _WX_XH_SLIDR_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_spin.h b/lib/wxWidgets/include/wx/xrc/xh_spin.h new file mode 100644 index 0000000..bf522e9 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_spin.h @@ -0,0 +1,57 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_spin.h +// Purpose: XML resource handler for wxSpinButton, wxSpinCtrl, wxSpinCtrlDouble +// Author: Bob Mitchell +// Created: 2000/03/21 +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_SPIN_H_ +#define _WX_XH_SPIN_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC + +#if wxUSE_SPINBTN + +class WXDLLIMPEXP_XRC wxSpinButtonXmlHandler : public wxXmlResourceHandler +{ +public: + wxSpinButtonXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxSpinButtonXmlHandler); +}; + +#endif // wxUSE_SPINBTN + +#if wxUSE_SPINCTRL + +class WXDLLIMPEXP_XRC wxSpinCtrlXmlHandler : public wxXmlResourceHandler +{ +public: + wxSpinCtrlXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxSpinCtrlXmlHandler); +}; + +class WXDLLIMPEXP_XRC wxSpinCtrlDoubleXmlHandler : public wxXmlResourceHandler +{ +public: + wxSpinCtrlDoubleXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxSpinCtrlDoubleXmlHandler); +}; + +#endif // wxUSE_SPINCTRL + +#endif // wxUSE_XRC + +#endif // _WX_XH_SPIN_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_split.h b/lib/wxWidgets/include/wx/xrc/xh_split.h new file mode 100644 index 0000000..e182081 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_split.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_split.h +// Purpose: XRC resource for wxSplitterWindow +// Author: panga@freemail.hu, Vaclav Slavik +// Created: 2003/01/26 +// Copyright: (c) 2003 panga@freemail.hu, Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_SPLIT_H_ +#define _WX_XH_SPLIT_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_SPLITTER + +class WXDLLIMPEXP_XRC wxSplitterWindowXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxSplitterWindowXmlHandler); + +public: + wxSplitterWindowXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC && wxUSE_SPLITTER + +#endif // _WX_XH_SPLIT_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_srchctrl.h b/lib/wxWidgets/include/wx/xrc/xh_srchctrl.h new file mode 100644 index 0000000..47c122f --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_srchctrl.h @@ -0,0 +1,30 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_srchctl.h +// Purpose: XRC resource handler for wxSearchCtrl +// Author: Sander Berents +// Created: 2007/07/12 +// Copyright: (c) 2007 Sander Berents +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_SRCH_H_ +#define _WX_XH_SRCH_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_SEARCHCTRL + +class WXDLLIMPEXP_XRC wxSearchCtrlXmlHandler : public wxXmlResourceHandler +{ +public: + wxSearchCtrlXmlHandler(); + + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS(wxSearchCtrlXmlHandler); +}; + +#endif // wxUSE_XRC && wxUSE_SEARCHCTRL + +#endif // _WX_XH_SRCH_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_statbar.h b/lib/wxWidgets/include/wx/xrc/xh_statbar.h new file mode 100644 index 0000000..d73bbdf --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_statbar.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_statbar.h +// Purpose: XML resource handler for wxStatusBar +// Author: Brian Ravnsgaard Riis +// Created: 2004/01/21 +// Copyright: (c) 2004 Brian Ravnsgaard Riis +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_STATBAR_H_ +#define _WX_XH_STATBAR_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_STATUSBAR + +class WXDLLIMPEXP_XRC wxStatusBarXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxStatusBarXmlHandler); + +public: + wxStatusBarXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC && wxUSE_STATUSBAR + +#endif // _WX_XH_STATBAR_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_stbmp.h b/lib/wxWidgets/include/wx/xrc/xh_stbmp.h new file mode 100644 index 0000000..65c7559 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_stbmp.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_stbmp.h +// Purpose: XML resource handler for wxStaticBitmap +// Author: Vaclav Slavik +// Created: 2000/04/22 +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_STBMP_H_ +#define _WX_XH_STBMP_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_STATBMP + +class WXDLLIMPEXP_XRC wxStaticBitmapXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxStaticBitmapXmlHandler); + +public: + wxStaticBitmapXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC && wxUSE_STATBMP + +#endif // _WX_XH_STBMP_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_stbox.h b/lib/wxWidgets/include/wx/xrc/xh_stbox.h new file mode 100644 index 0000000..4a5704c --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_stbox.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_stbox.h +// Purpose: XML resource handler for wxStaticBox +// Author: Brian Gavin +// Created: 2000/09/00 +// Copyright: (c) 2000 Brian Gavin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_STBOX_H_ +#define _WX_XH_STBOX_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_STATBOX + +class WXDLLIMPEXP_XRC wxStaticBoxXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxStaticBoxXmlHandler); + +public: + wxStaticBoxXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC && wxUSE_STATBOX + +#endif // _WX_XH_STBOX_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_stlin.h b/lib/wxWidgets/include/wx/xrc/xh_stlin.h new file mode 100644 index 0000000..808f9bb --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_stlin.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_stlin.h +// Purpose: XML resource handler for wxStaticLine +// Author: Vaclav Slavik +// Created: 2000/09/00 +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_STLIN_H_ +#define _WX_XH_STLIN_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_STATLINE + +class WXDLLIMPEXP_XRC wxStaticLineXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxStaticLineXmlHandler); + +public: + wxStaticLineXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC && wxUSE_STATLINE + +#endif // _WX_XH_STLIN_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_sttxt.h b/lib/wxWidgets/include/wx/xrc/xh_sttxt.h new file mode 100644 index 0000000..6f99e3a --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_sttxt.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_sttxt.h +// Purpose: XML resource handler for wxStaticText +// Author: Bob Mitchell +// Created: 2000/03/21 +// Copyright: (c) 2000 Bob Mitchell +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_STTXT_H_ +#define _WX_XH_STTXT_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_STATTEXT + +class WXDLLIMPEXP_XRC wxStaticTextXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxStaticTextXmlHandler); + +public: + wxStaticTextXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC && wxUSE_STATTEXT + +#endif // _WX_XH_STTXT_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_styledtextctrl.h b/lib/wxWidgets/include/wx/xrc/xh_styledtextctrl.h new file mode 100644 index 0000000..fb78a35 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_styledtextctrl.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_styledtextctrl.h +// Purpose: XML resource handler for wxStyledTextCtrl +// Author: Alexander Koshelev +// Created: 2021-09-22 +// Copyright: (c) 2021 TT-Solutions SARL +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_STYLEDTEXTCTRL_H_ +#define _WX_XH_STYLEDTEXTCTRL_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_STC + +class WXDLLIMPEXP_STC wxStyledTextCtrlXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxStyledTextCtrlXmlHandler); + +public: + wxStyledTextCtrlXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC && wxUSE_STC + +#endif // _WX_XH_STYLEDTEXTCTRL_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_text.h b/lib/wxWidgets/include/wx/xrc/xh_text.h new file mode 100644 index 0000000..a2e8488 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_text.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_text.h +// Purpose: XML resource handler for wxTextCtrl +// Author: Aleksandras Gluchovas +// Created: 2000/03/21 +// Copyright: (c) 2000 Aleksandras Gluchovas +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_TEXT_H_ +#define _WX_XH_TEXT_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_TEXTCTRL + +class WXDLLIMPEXP_XRC wxTextCtrlXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxTextCtrlXmlHandler); + +public: + wxTextCtrlXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC && wxUSE_TEXTCTRL + +#endif // _WX_XH_TEXT_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_tglbtn.h b/lib/wxWidgets/include/wx/xrc/xh_tglbtn.h new file mode 100644 index 0000000..24ca1e8 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_tglbtn.h @@ -0,0 +1,35 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_tglbtn.h +// Purpose: XML resource handler for wxToggleButton +// Author: Julian Smart +// Created: 2004-08-30 +// Copyright: (c) 2004 Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_TGLBTN_H_ +#define _WX_XH_TGLBTN_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_TOGGLEBTN + +class WXDLLIMPEXP_XRC wxToggleButtonXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxToggleButtonXmlHandler); + +public: + wxToggleButtonXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +protected: + virtual void DoCreateToggleButton(wxObject *control); +#if !defined(__WXUNIVERSAL__) && !defined(__WXMOTIF__) && !(defined(__WXGTK__) && !defined(__WXGTK20__)) + virtual void DoCreateBitmapToggleButton(wxObject *control); +#endif +}; + +#endif // wxUSE_XRC && wxUSE_TOGGLEBTN + +#endif // _WX_XH_TGLBTN_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_timectrl.h b/lib/wxWidgets/include/wx/xrc/xh_timectrl.h new file mode 100644 index 0000000..9124670 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_timectrl.h @@ -0,0 +1,30 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_timectrl.h +// Purpose: XML resource handler for wxTimePickerCtrl +// Author: Vadim Zeitlin +// Created: 2011-09-22 +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_TIMECTRL_H_ +#define _WX_XH_TIMECTRL_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_TIMEPICKCTRL + +class WXDLLIMPEXP_XRC wxTimeCtrlXmlHandler : public wxXmlResourceHandler +{ +public: + wxTimeCtrlXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxTimeCtrlXmlHandler); +}; + +#endif // wxUSE_XRC && wxUSE_TIMEPICKCTRL + +#endif // _WX_XH_TIMECTRL_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_toolb.h b/lib/wxWidgets/include/wx/xrc/xh_toolb.h new file mode 100644 index 0000000..e3f3f14 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_toolb.h @@ -0,0 +1,36 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_toolb.h +// Purpose: XML resource handler for wxToolBar +// Author: Vaclav Slavik +// Created: 2000/08/11 +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_TOOLB_H_ +#define _WX_XH_TOOLB_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_TOOLBAR + +class WXDLLIMPEXP_FWD_CORE wxToolBar; + +class WXDLLIMPEXP_XRC wxToolBarXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxToolBarXmlHandler); + +public: + wxToolBarXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + bool m_isInside; + wxToolBar *m_toolbar; + wxSize m_toolSize; +}; + +#endif // wxUSE_XRC && wxUSE_TOOLBAR + +#endif // _WX_XH_TOOLB_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_toolbk.h b/lib/wxWidgets/include/wx/xrc/xh_toolbk.h new file mode 100644 index 0000000..29e7181 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_toolbk.h @@ -0,0 +1,35 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_toolbk.h +// Purpose: XML resource handler for wxToolbook +// Author: Andrea Zanellato +// Created: 2009/12/12 +// Copyright: (c) 2010 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_TOOLBK_H_ +#define _WX_XH_TOOLBK_H_ + +#include "wx/xrc/xh_bookctrlbase.h" + +#if wxUSE_XRC && wxUSE_TOOLBOOK + +class WXDLLIMPEXP_FWD_CORE wxToolbook; + +class WXDLLIMPEXP_XRC wxToolbookXmlHandler : public wxBookCtrlXmlHandlerBase +{ +public: + wxToolbookXmlHandler(); + + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + wxToolbook *m_toolbook; + + wxDECLARE_DYNAMIC_CLASS(wxToolbookXmlHandler); +}; + +#endif // wxUSE_XRC && wxUSE_TOOLBOOK + +#endif // _WX_XH_TOOLBK_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_tree.h b/lib/wxWidgets/include/wx/xrc/xh_tree.h new file mode 100644 index 0000000..01dd24f --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_tree.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_tree.h +// Purpose: XML resource handler for wxTreeCtrl +// Author: Brian Gavin +// Created: 2000/09/09 +// Copyright: (c) 2000 Brian Gavin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_TREE_H_ +#define _WX_XH_TREE_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_TREECTRL + +class WXDLLIMPEXP_XRC wxTreeCtrlXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxTreeCtrlXmlHandler); + +public: + wxTreeCtrlXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC && wxUSE_TREECTRL + +#endif // _WX_XH_TREE_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_treebk.h b/lib/wxWidgets/include/wx/xrc/xh_treebk.h new file mode 100644 index 0000000..fc5b28a --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_treebk.h @@ -0,0 +1,90 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_treebk.h +// Purpose: XML resource handler for wxTreebook +// Author: Evgeniy Tarassov +// Created: 2005/09/28 +// Copyright: (c) 2005 TT-Solutions +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_TREEBK_H_ +#define _WX_XH_TREEBK_H_ + +#include "wx/xrc/xh_bookctrlbase.h" + +#if wxUSE_XRC && wxUSE_TREEBOOK + +class WXDLLIMPEXP_FWD_CORE wxTreebook; +#include "wx/dynarray.h" + +WX_DEFINE_USER_EXPORTED_ARRAY_SIZE_T(size_t, wxArrayTbkPageIndexes, + class WXDLLIMPEXP_XRC); + +// --------------------------------------------------------------------- +// wxTreebookXmlHandler class +// --------------------------------------------------------------------- +// Resource xml structure have to be almost the "same" as for wxNotebook +// except the additional (size_t)depth parameter for treebookpage nodes +// which indicates the depth of the page in the tree. +// There is only one logical constraint on this parameter : +// it cannot be greater than the previous page depth plus one +class WXDLLIMPEXP_XRC wxTreebookXmlHandler : public wxBookCtrlXmlHandlerBase +{ + wxDECLARE_DYNAMIC_CLASS(wxTreebookXmlHandler); + +public: + wxTreebookXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + virtual void + DoAddPage(wxBookCtrlBase* book, size_t n, const PageWithAttrs& page) wxOVERRIDE; + + wxTreebook *m_tbk; + + // N-th element contains the index of the parent page at depth N. + wxArrayTbkPageIndexes m_treeContext; + + // The index of the parent page or -1 if the page is a top level one. + wxVector m_pageParents; +}; + + +// Example: +// ------- +// Label +// \--First +// | \--Second +// \--Third +// +// +// ... +// +// +// +// +// 0 +// +// +// +// +// 1 +// +// +// +// +// 2 +// +// +// +// +// 1 +// +// +// ... +// + +#endif // wxUSE_XRC && wxUSE_TREEBOOK + +#endif // _WX_XH_TREEBK_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_unkwn.h b/lib/wxWidgets/include/wx/xrc/xh_unkwn.h new file mode 100644 index 0000000..b675767 --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_unkwn.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_unkwn.h +// Purpose: XML resource handler for unknown widget +// Author: Vaclav Slavik +// Created: 2000/03/05 +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_UNKWN_H_ +#define _WX_XH_UNKWN_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC + +class WXDLLIMPEXP_XRC wxUnknownWidgetXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxUnknownWidgetXmlHandler); + +public: + wxUnknownWidgetXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; +}; + +#endif // wxUSE_XRC + +#endif // _WX_XH_UNKWN_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xh_wizrd.h b/lib/wxWidgets/include/wx/xrc/xh_wizrd.h new file mode 100644 index 0000000..235272d --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xh_wizrd.h @@ -0,0 +1,36 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xh_wizrd.h +// Purpose: XML resource handler for wxWizard +// Author: Vaclav Slavik +// Created: 2003/03/02 +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_WIZRD_H_ +#define _WX_XH_WIZRD_H_ + +#include "wx/xrc/xmlres.h" + +#if wxUSE_XRC && wxUSE_WIZARDDLG + +class WXDLLIMPEXP_FWD_CORE wxWizard; +class WXDLLIMPEXP_FWD_CORE wxWizardPageSimple; + +class WXDLLIMPEXP_XRC wxWizardXmlHandler : public wxXmlResourceHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxWizardXmlHandler); + +public: + wxWizardXmlHandler(); + virtual wxObject *DoCreateResource() wxOVERRIDE; + virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE; + +private: + wxWizard *m_wizard; + wxWizardPageSimple *m_lastSimplePage; +}; + +#endif // wxUSE_XRC && wxUSE_WIZARDDLG + +#endif // _WX_XH_WIZRD_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xmlres.h b/lib/wxWidgets/include/wx/xrc/xmlres.h new file mode 100644 index 0000000..ab7004e --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xmlres.h @@ -0,0 +1,698 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xmlres.h +// Purpose: XML resources +// Author: Vaclav Slavik +// Created: 2000/03/05 +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XMLRES_H_ +#define _WX_XMLRES_H_ + +#include "wx/defs.h" + +#if wxUSE_XRC + +#include "wx/string.h" +#include "wx/dynarray.h" +#include "wx/arrstr.h" +#include "wx/datetime.h" +#include "wx/list.h" +#include "wx/gdicmn.h" +#include "wx/filesys.h" +#include "wx/bitmap.h" +#include "wx/icon.h" +#include "wx/artprov.h" +#include "wx/colour.h" +#include "wx/vector.h" + +#include "wx/xrc/xmlreshandler.h" + +class WXDLLIMPEXP_FWD_BASE wxFileName; + +class WXDLLIMPEXP_FWD_CORE wxIconBundle; +class WXDLLIMPEXP_FWD_CORE wxImageList; +class WXDLLIMPEXP_FWD_CORE wxMenu; +class WXDLLIMPEXP_FWD_CORE wxMenuBar; +class WXDLLIMPEXP_FWD_CORE wxDialog; +class WXDLLIMPEXP_FWD_CORE wxPanel; +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxFrame; +class WXDLLIMPEXP_FWD_CORE wxToolBar; + +class WXDLLIMPEXP_FWD_XML wxXmlDocument; +class WXDLLIMPEXP_FWD_XML wxXmlNode; +class WXDLLIMPEXP_FWD_XRC wxXmlSubclassFactory; +class wxXmlSubclassFactories; +class wxXmlResourceModule; +class wxXmlResourceDataRecords; + +// These macros indicate current version of XML resources (this information is +// encoded in root node of XRC file as "version" property). +// +// Rules for increasing version number: +// - change it only if you made incompatible change to the format. Addition +// of new attribute to control handler is _not_ incompatible change, because +// older versions of the library may ignore it. +// - if you change version number, follow these steps: +// - set major, minor and release numbers to respective version numbers of +// the wxWidgets library (see wx/version.h) +// - reset revision to 0 unless the first three are same as before, +// in which case you should increase revision by one +#define WX_XMLRES_CURRENT_VERSION_MAJOR 2 +#define WX_XMLRES_CURRENT_VERSION_MINOR 5 +#define WX_XMLRES_CURRENT_VERSION_RELEASE 3 +#define WX_XMLRES_CURRENT_VERSION_REVISION 0 +#define WX_XMLRES_CURRENT_VERSION_STRING wxT("2.5.3.0") + +#define WX_XMLRES_CURRENT_VERSION \ + (WX_XMLRES_CURRENT_VERSION_MAJOR * 256*256*256 + \ + WX_XMLRES_CURRENT_VERSION_MINOR * 256*256 + \ + WX_XMLRES_CURRENT_VERSION_RELEASE * 256 + \ + WX_XMLRES_CURRENT_VERSION_REVISION) + +enum wxXmlResourceFlags +{ + wxXRC_USE_LOCALE = 1, + wxXRC_NO_SUBCLASSING = 2, + wxXRC_NO_RELOADING = 4, + wxXRC_USE_ENVVARS = 8 +}; + +// This class holds XML resources from one or more .xml files +// (or derived forms, either binary or zipped -- see manual for +// details). +class WXDLLIMPEXP_XRC wxXmlResource : public wxObject +{ +public: + // Constructor. + // Flags: wxXRC_USE_LOCALE + // translatable strings will be translated via _() + // using the given domain if specified + // wxXRC_NO_SUBCLASSING + // subclass property of object nodes will be ignored + // (useful for previews in XRC editors) + // wxXRC_NO_RELOADING + // don't check the modification time of the XRC files and + // reload them if they have changed on disk + // wxXRC_USE_ENVVARS + // expand environment variables for paths + // (such as bitmaps or icons). + wxXmlResource(int flags = wxXRC_USE_LOCALE, + const wxString& domain = wxEmptyString); + + // Constructor. + // Flags: wxXRC_USE_LOCALE + // translatable strings will be translated via _() + // using the given domain if specified + // wxXRC_NO_SUBCLASSING + // subclass property of object nodes will be ignored + // (useful for previews in XRC editors) + // wxXRC_NO_RELOADING + // don't check the modification time of the XRC files and + // reload them if they have changed on disk + // wxXRC_USE_ENVVARS + // expand environment variables for paths + // (such as bitmaps or icons). + wxXmlResource(const wxString& filemask, int flags = wxXRC_USE_LOCALE, + const wxString& domain = wxEmptyString); + + // Destructor. + virtual ~wxXmlResource(); + + // Loads resources from XML files that match given filemask. + // This method understands wxFileSystem URLs if wxUSE_FILESYS. + bool Load(const wxString& filemask); + + // Loads resources from single XRC file. + bool LoadFile(const wxFileName& file); + + // Loads all XRC files from a directory. + bool LoadAllFiles(const wxString& dirname); + + // Loads resources from the given XML document, taking ownership of it. + // + // The name argument is only used to Unload() the document later here and + // doesn't need to be an existing filename at all (but should be unique if + // specified, otherwise it's just synthesized internally). + bool LoadDocument(wxXmlDocument* doc, const wxString& name = wxString()); + + // Unload resource from the given XML file (wildcards not allowed) + bool Unload(const wxString& filename); + + // Initialize handlers for all supported controls/windows. This will + // make the executable quite big because it forces linking against + // most of the wxWidgets library. + void InitAllHandlers(); + + // Initialize only a specific handler (or custom handler). Convention says + // that handler name is equal to the control's name plus 'XmlHandler', for + // example wxTextCtrlXmlHandler, wxHtmlWindowXmlHandler. The XML resource + // compiler (xmlres) can create include file that contains initialization + // code for all controls used within the resource. + void AddHandler(wxXmlResourceHandler *handler); + + // Add a new handler at the beginning of the handler list + void InsertHandler(wxXmlResourceHandler *handler); + + // Removes all handlers + void ClearHandlers(); + + // Registers subclasses factory for use in XRC. This function is not meant + // for public use, please see the comment above wxXmlSubclassFactory + // definition. + static void AddSubclassFactory(wxXmlSubclassFactory *factory); + + // Loads menu from resource. Returns NULL on failure. + wxMenu *LoadMenu(const wxString& name); + + // Loads menubar from resource. Returns NULL on failure. + wxMenuBar *LoadMenuBar(wxWindow *parent, const wxString& name); + + // Loads menubar from resource. Returns NULL on failure. + wxMenuBar *LoadMenuBar(const wxString& name) { return LoadMenuBar(NULL, name); } + +#if wxUSE_TOOLBAR + // Loads a toolbar. + wxToolBar *LoadToolBar(wxWindow *parent, const wxString& name); +#endif + + // Loads a dialog. dlg points to parent window (if any). + wxDialog *LoadDialog(wxWindow *parent, const wxString& name); + + // Loads a dialog. dlg points to parent window (if any). This form + // is used to finish creation of already existing instance (main reason + // for this is that you may want to use derived class with new event table) + // Example (typical usage): + // MyDialog dlg; + // wxTheXmlResource->LoadDialog(&dlg, mainFrame, "my_dialog"); + // dlg->ShowModal(); + bool LoadDialog(wxDialog *dlg, wxWindow *parent, const wxString& name); + + // Loads a panel. panel points to parent window (if any). + wxPanel *LoadPanel(wxWindow *parent, const wxString& name); + + // Loads a panel. panel points to parent window (if any). This form + // is used to finish creation of already existing instance. + bool LoadPanel(wxPanel *panel, wxWindow *parent, const wxString& name); + + // Loads a frame. + wxFrame *LoadFrame(wxWindow* parent, const wxString& name); + bool LoadFrame(wxFrame* frame, wxWindow *parent, const wxString& name); + + // Load an object from the resource specifying both the resource name and + // the classname. This lets you load nonstandard container windows. + wxObject *LoadObject(wxWindow *parent, const wxString& name, + const wxString& classname) + { + return DoLoadObject(parent, name, classname, false /* !recursive */); + } + + // Load an object from the resource specifying both the resource name and + // the classname. This form lets you finish the creation of an existing + // instance. + bool LoadObject(wxObject *instance, + wxWindow *parent, + const wxString& name, + const wxString& classname) + { + return DoLoadObject(instance, parent, name, classname, false); + } + + // These versions of LoadObject() look for the object with the given name + // recursively (breadth first) and can be used to instantiate an individual + // control defined anywhere in an XRC file. No check is done that the name + // is unique, it's up to the caller to ensure this. + wxObject *LoadObjectRecursively(wxWindow *parent, + const wxString& name, + const wxString& classname) + { + return DoLoadObject(parent, name, classname, true /* recursive */); + } + + bool LoadObjectRecursively(wxObject *instance, + wxWindow *parent, + const wxString& name, + const wxString& classname) + { + return DoLoadObject(instance, parent, name, classname, true); + } + + // Loads a bitmap resource from a file. + wxBitmap LoadBitmap(const wxString& name); + + // Loads an icon resource from a file. + wxIcon LoadIcon(const wxString& name); + + // Attaches an unknown control to the given panel/window/dialog. + // Unknown controls are used in conjunction with . + bool AttachUnknownControl(const wxString& name, wxWindow *control, + wxWindow *parent = NULL); + + // Returns a numeric ID that is equivalent to the string ID used in an XML + // resource. If an unknown str_id is requested (i.e. other than wxID_XXX + // or integer), a new record is created which associates the given string + // with a number. If value_if_not_found == wxID_NONE, the number is obtained via + // wxWindow::NewControlId(). Otherwise value_if_not_found is used. + // Macro XRCID(name) is provided for convenient use in event tables. + static int GetXRCID(const wxString& str_id, int value_if_not_found = wxID_NONE) + { return DoGetXRCID(str_id.utf8_str(), value_if_not_found); } + + // version for internal use only + static int DoGetXRCID(const char *str_id, int value_if_not_found = wxID_NONE); + + + // Find the string ID with the given numeric value, returns an empty string + // if no such ID is found. + // + // Notice that unlike GetXRCID(), which is fast, this operation is slow as + // it checks all the IDs used in XRC. + static wxString FindXRCIDById(int numId); + + + // Returns version information (a.b.c.d = d+ 256*c + 256^2*b + 256^3*a). + long GetVersion() const { return m_version; } + + // Compares resources version to argument. Returns -1 if resources version + // is less than the argument, +1 if greater and 0 if they equal. + int CompareVersion(int major, int minor, int release, int revision) const + { + long diff = GetVersion() - + (major*256*256*256 + minor*256*256 + release*256 + revision); + if ( diff < 0 ) + return -1; + else if ( diff > 0 ) + return +1; + else + return 0; + } + + //// Singleton accessors. + + // Gets the global resources object or creates one if none exists. + static wxXmlResource *Get(); + + // Sets the global resources object and returns a pointer to the previous one (may be NULL). + static wxXmlResource *Set(wxXmlResource *res); + + // Returns flags, which is a bitlist of wxXmlResourceFlags. + int GetFlags() const { return m_flags; } + // Set flags after construction. + void SetFlags(int flags) { m_flags = flags; } + + // Get/Set the domain to be passed to the translation functions, defaults + // to empty string (no domain). + const wxString& GetDomain() const { return m_domain; } + void SetDomain(const wxString& domain); + + + // This function returns the wxXmlNode containing the definition of the + // object with the given name or NULL. + // + // It can be used to access additional information defined in the XRC file + // and not used by wxXmlResource itself. + const wxXmlNode *GetResourceNode(const wxString& name) const + { return GetResourceNodeAndLocation(name, wxString(), true); } + +protected: + // reports input error at position 'context' + void ReportError(const wxXmlNode *context, const wxString& message); + + // override this in derived class to customize errors reporting + virtual void DoReportError(const wxString& xrcFile, const wxXmlNode *position, + const wxString& message); + + // Load the contents of a single file and returns its contents as a new + // wxXmlDocument (which will be owned by caller) on success or NULL. + wxXmlDocument *DoLoadFile(const wxString& file); + + // Load XRC from the given document and returns true on success. + bool DoLoadDocument(const wxXmlDocument& doc); + + // Scans the resources list for unloaded files and loads them. Also reloads + // files that have been modified since last loading. + bool UpdateResources(); + + + // Common implementation of GetResourceNode() and FindResource(): searches + // all top-level or all (if recursive == true) nodes if all loaded XRC + // files and returns the node, if found, as well as the path of the file it + // was found in if path is non-NULL + wxXmlNode *GetResourceNodeAndLocation(const wxString& name, + const wxString& classname, + bool recursive = false, + wxString *path = NULL) const; + + + // Note that these functions are used outside of wxWidgets itself, e.g. + // there are several known cases of inheriting from wxXmlResource just to + // be able to call FindResource() so we keep them for compatibility even if + // their names are not really consistent with GetResourceNode() public + // function and FindResource() is also non-const because it changes the + // current path of m_curFileSystem to ensure that relative paths work + // correctly when CreateResFromNode() is called immediately afterwards + // (something const public function intentionally does not do) + + // Returns the node containing the resource with the given name and class + // name unless it's empty (then any class matches) or NULL if not found. + wxXmlNode *FindResource(const wxString& name, const wxString& classname, + bool recursive = false); + + // Helper function used by FindResource() to look under the given node. + wxXmlNode *DoFindResource(wxXmlNode *parent, const wxString& name, + const wxString& classname, bool recursive) const; + + // Creates a resource from information in the given node + // (Uses only 'handlerToUse' if != NULL) + wxObject *CreateResFromNode(wxXmlNode *node, wxObject *parent, + wxObject *instance = NULL, + wxXmlResourceHandler *handlerToUse = NULL) + { + return node ? DoCreateResFromNode(*node, parent, instance, handlerToUse) + : NULL; + } + + // Helper of Load() and Unload(): returns the URL corresponding to the + // given file if it's indeed a file, otherwise returns the original string + // unmodified + static wxString ConvertFileNameToURL(const wxString& filename); + + // loading resources from archives is impossible without wxFileSystem +#if wxUSE_FILESYSTEM + // Another helper: detect if the filename is a ZIP or XRS file + static bool IsArchive(const wxString& filename); +#endif // wxUSE_FILESYSTEM + +private: + wxXmlResourceDataRecords& Data() { return *m_data; } + const wxXmlResourceDataRecords& Data() const { return *m_data; } + + // the real implementation of CreateResFromNode(): this should be only + // called if node is non-NULL + wxObject *DoCreateResFromNode(wxXmlNode& node, + wxObject *parent, + wxObject *instance, + wxXmlResourceHandler *handlerToUse = NULL); + + // common part of LoadObject() and LoadObjectRecursively() + wxObject *DoLoadObject(wxWindow *parent, + const wxString& name, + const wxString& classname, + bool recursive); + bool DoLoadObject(wxObject *instance, + wxWindow *parent, + const wxString& name, + const wxString& classname, + bool recursive); + +private: + long m_version; + + int m_flags; + wxVector m_handlers; + wxXmlResourceDataRecords *m_data; +#if wxUSE_FILESYSTEM + wxFileSystem m_curFileSystem; + wxFileSystem& GetCurFileSystem() { return m_curFileSystem; } +#endif + + // domain to pass to translation functions, if any. + wxString m_domain; + + friend class wxXmlResourceHandlerImpl; + friend class wxXmlResourceModule; + friend class wxIdRangeManager; + friend class wxIdRange; + + static wxXmlSubclassFactories *ms_subclassFactories; + + // singleton instance: + static wxXmlResource *ms_instance; +}; + + +// This macro translates string identifier (as used in XML resource, +// e.g. ...) to integer id that is needed by +// wxWidgets event tables. +// Example: +// wxBEGIN_EVENT_TABLE(MyFrame, wxFrame) +// EVT_MENU(XRCID("quit"), MyFrame::OnQuit) +// EVT_MENU(XRCID("about"), MyFrame::OnAbout) +// EVT_MENU(XRCID("new"), MyFrame::OnNew) +// EVT_MENU(XRCID("open"), MyFrame::OnOpen) +// wxEND_EVENT_TABLE() + +#define XRCID(str_id) \ + wxXmlResource::DoGetXRCID(str_id) + + +// This macro returns pointer to particular control in dialog +// created using XML resources. You can use it to set/get values from +// controls. +// Example: +// wxDialog dlg; +// wxXmlResource::Get()->LoadDialog(&dlg, mainFrame, "my_dialog"); +// XRCCTRL(dlg, "my_textctrl", wxTextCtrl)->SetValue(wxT("default value")); + +#define XRCCTRL(window, id, type) \ + (wxStaticCast((window).FindWindow(XRCID(id)), type)) + +// This macro returns pointer to sizer item +// Example: +// +// +// 400, 300 +// +// +// wxSizerItem* item = XRCSIZERITEM(*this, "area") + +#define XRCSIZERITEM(window, id) \ + ((window).GetSizer() ? (window).GetSizer()->GetItemById(XRCID(id)) : NULL) + + +// wxXmlResourceHandlerImpl is the back-end of the wxXmlResourceHander class to +// really implementing all its functionality. It is defined in the "xrc" +// library unlike wxXmlResourceHandler itself which is defined in "core" to +// allow inheriting from it in the code from the other libraries too. + +class WXDLLIMPEXP_XRC wxXmlResourceHandlerImpl : public wxXmlResourceHandlerImplBase +{ +public: + // Constructor. + wxXmlResourceHandlerImpl(wxXmlResourceHandler *handler); + + // Destructor. + virtual ~wxXmlResourceHandlerImpl() {} + + // Creates an object (menu, dialog, control, ...) from an XML node. + // Should check for validity. + // parent is a higher-level object (usually window, dialog or panel) + // that is often necessary to create the resource. + // If instance is non-NULL it should not create a new instance via 'new' but + // should rather use this one, and call its Create method. + wxObject *CreateResource(wxXmlNode *node, wxObject *parent, + wxObject *instance) wxOVERRIDE; + + + // --- Handy methods: + + // Returns true if the node has a property class equal to classname, + // e.g. . + bool IsOfClass(wxXmlNode *node, const wxString& classname) const wxOVERRIDE; + + bool IsObjectNode(const wxXmlNode *node) const wxOVERRIDE; + // Gets node content from wxXML_ENTITY_NODE + // The problem is, content is represented as + // wxXML_ENTITY_NODE name="tag", content="" + // |-- wxXML_TEXT_NODE or + // wxXML_CDATA_SECTION_NODE name="" content="content" + wxString GetNodeContent(const wxXmlNode *node) wxOVERRIDE; + + wxXmlNode *GetNodeParent(const wxXmlNode *node) const wxOVERRIDE; + wxXmlNode *GetNodeNext(const wxXmlNode *node) const wxOVERRIDE; + wxXmlNode *GetNodeChildren(const wxXmlNode *node) const wxOVERRIDE; + + // Check to see if a parameter exists. + bool HasParam(const wxString& param) wxOVERRIDE; + + // Finds the node or returns NULL. + wxXmlNode *GetParamNode(const wxString& param) wxOVERRIDE; + + // Finds the parameter value or returns the empty string. + wxString GetParamValue(const wxString& param) wxOVERRIDE; + + // Returns the parameter value from given node. + wxString GetParamValue(const wxXmlNode* node) wxOVERRIDE; + + // Gets style flags from text in form "flag | flag2| flag3 |..." + // Only understands flags added with AddStyle + int GetStyle(const wxString& param = wxT("style"), int defaults = 0) wxOVERRIDE; + + // Gets text from param and does some conversions: + // - replaces \n, \r, \t by respective chars (according to C syntax) + // - replaces _ by & and __ by _ (needed for _File => &File because of XML) + // - calls wxGetTranslations (unless disabled in wxXmlResource) + // + // The first two conversions can be disabled by using wxXRC_TEXT_NO_ESCAPE + // in flags and the last one -- by using wxXRC_TEXT_NO_TRANSLATE. + wxString GetNodeText(const wxXmlNode *node, int flags = 0) wxOVERRIDE; + + // Returns the XRCID. + int GetID() wxOVERRIDE; + + // Returns the resource name. + wxString GetName() wxOVERRIDE; + + // Gets a bool flag (1, t, yes, on, true are true, everything else is false). + bool GetBool(const wxString& param, bool defaultv = false) wxOVERRIDE; + + // Gets an integer value from the parameter. + long GetLong(const wxString& param, long defaultv = 0) wxOVERRIDE; + + // Gets a float value from the parameter. + float GetFloat(const wxString& param, float defaultv = 0) wxOVERRIDE; + + // Gets colour in HTML syntax (#RRGGBB). + wxColour GetColour(const wxString& param, const wxColour& defaultv = wxNullColour) wxOVERRIDE; + + // Gets the size (may be in dialog units). + wxSize GetSize(const wxString& param = wxT("size"), + wxWindow *windowToUse = NULL) wxOVERRIDE; + + // Gets the position (may be in dialog units). + wxPoint GetPosition(const wxString& param = wxT("pos")) wxOVERRIDE; + + // Gets a dimension (may be in dialog units). + wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0, + wxWindow *windowToUse = NULL) wxOVERRIDE; + + // Gets a size which is not expressed in pixels, so not in dialog units. + wxSize GetPairInts(const wxString& param) wxOVERRIDE; + + // Gets a direction, complains if the value is invalid. + wxDirection GetDirection(const wxString& param, wxDirection dirDefault = wxLEFT) wxOVERRIDE; + + // Gets a bitmap. + wxBitmap GetBitmap(const wxString& param = wxT("bitmap"), + const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) wxOVERRIDE; + + // Gets a bitmap from an XmlNode. + wxBitmap GetBitmap(const wxXmlNode* node, + const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) wxOVERRIDE; + + // Gets a bitmap bundle. + wxBitmapBundle GetBitmapBundle(const wxString& param = wxT("bitmap"), + const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) wxOVERRIDE; + + // Gets a bitmap bundle from the provided node. + wxBitmapBundle GetBitmapBundle(const wxXmlNode* node, + const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) wxOVERRIDE; + + // Gets an icon. + wxIcon GetIcon(const wxString& param = wxT("icon"), + const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) wxOVERRIDE; + + // Gets an icon from an XmlNode. + wxIcon GetIcon(const wxXmlNode* node, + const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) wxOVERRIDE; + + // Gets an icon bundle. + wxIconBundle GetIconBundle(const wxString& param, + const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER)) wxOVERRIDE; + + // Gets an image list. + wxImageList *GetImageList(const wxString& param = wxT("imagelist")) wxOVERRIDE; + +#if wxUSE_ANIMATIONCTRL + // Gets an animation creating it using the provided control (so that it + // will be compatible with it) if any. + wxAnimation* GetAnimation(const wxString& param = wxT("animation"), + wxAnimationCtrlBase* ctrl = NULL) wxOVERRIDE; +#endif + + // Gets a font. + wxFont GetFont(const wxString& param = wxT("font"), wxWindow* parent = NULL) wxOVERRIDE; + + // Gets the value of a boolean attribute (only "0" and "1" are valid values) + bool GetBoolAttr(const wxString& attr, bool defaultv) wxOVERRIDE; + + // Gets a file path from the given node, expanding environment variables in + // it if wxXRC_USE_ENVVARS is in use. + wxString GetFilePath(const wxXmlNode* node) wxOVERRIDE; + + // Returns the window associated with the handler (may be NULL). + wxWindow* GetParentAsWindow() const { return m_handler->GetParentAsWindow(); } + + // Sets common window options. + void SetupWindow(wxWindow *wnd) wxOVERRIDE; + + // Creates children. + void CreateChildren(wxObject *parent, bool this_hnd_only = false) wxOVERRIDE; + + // Helper function. + void CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = NULL) wxOVERRIDE; + + // Creates a resource from a node. + wxObject *CreateResFromNode(wxXmlNode *node, + wxObject *parent, wxObject *instance = NULL) wxOVERRIDE; + + // helper +#if wxUSE_FILESYSTEM + wxFileSystem& GetCurFileSystem() wxOVERRIDE; +#endif + + // reports input error at position 'context' + void ReportError(wxXmlNode *context, const wxString& message) wxOVERRIDE; + // reports input error at m_node + void ReportError(const wxString& message) wxOVERRIDE; + // reports input error when parsing parameter with given name + void ReportParamError(const wxString& param, const wxString& message) wxOVERRIDE; +}; + + +// Programmer-friendly macros for writing XRC handlers: + +#define XRC_MAKE_INSTANCE(variable, classname) \ + classname *variable = NULL; \ + if (m_instance) \ + variable = wxStaticCast(m_instance, classname); \ + if (!variable) \ + variable = new classname; \ + if (GetBool(wxT("hidden"), 0) == 1) \ + variable->Hide(); + + +// FIXME -- remove this $%^#$%#$@# as soon as Ron checks his changes in!! +WXDLLIMPEXP_XRC void wxXmlInitResourceModule(); + + +// This class is used to create instances of XRC "object" nodes with "subclass" +// property. It is _not_ supposed to be used by XRC users, you should instead +// register your subclasses via wxWidgets' RTTI mechanism. This class is useful +// only for language bindings developer who need a way to implement subclassing +// in wxWidgets ports that don't support wxRTTI (e.g. wxPython). +class WXDLLIMPEXP_XRC wxXmlSubclassFactory +{ +public: + // Try to create instance of given class and return it, return NULL on + // failure: + virtual wxObject *Create(const wxString& className) = 0; + virtual ~wxXmlSubclassFactory() {} +}; + + +/* ------------------------------------------------------------------------- + Backward compatibility macros. Do *NOT* use, they may disappear in future + versions of the XRC library! + ------------------------------------------------------------------------- */ + +#endif // wxUSE_XRC + +#endif // _WX_XMLRES_H_ diff --git a/lib/wxWidgets/include/wx/xrc/xmlreshandler.h b/lib/wxWidgets/include/wx/xrc/xmlreshandler.h new file mode 100644 index 0000000..606eeda --- /dev/null +++ b/lib/wxWidgets/include/wx/xrc/xmlreshandler.h @@ -0,0 +1,454 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xrc/xmlreshandler.cpp +// Purpose: XML resource handler +// Author: Steven Lamerton +// Created: 2011/01/26 +// Copyright: (c) 2011 Steven Lamerton +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XRC_XMLRESHANDLER_H_ +#define _WX_XRC_XMLRESHANDLER_H_ + +#include "wx/defs.h" + +#if wxUSE_XRC + +#include "wx/string.h" +#include "wx/artprov.h" +#include "wx/colour.h" +#include "wx/filesys.h" +#include "wx/imaglist.h" +#include "wx/window.h" + +class WXDLLIMPEXP_FWD_CORE wxAnimation; +class WXDLLIMPEXP_FWD_CORE wxAnimationCtrlBase; + +class WXDLLIMPEXP_FWD_XML wxXmlNode; +class WXDLLIMPEXP_FWD_XML wxXmlResource; + +class WXDLLIMPEXP_FWD_CORE wxXmlResourceHandler; + +// Helper macro used by the classes derived from wxXmlResourceHandler but also +// by wxXmlResourceHandler implementation itself. +#define XRC_ADD_STYLE(style) AddStyle(wxT(#style), style) + +// Flags for GetNodeText(). +enum +{ + wxXRC_TEXT_NO_TRANSLATE = 1, + wxXRC_TEXT_NO_ESCAPE = 2 +}; + +// Abstract base class for the implementation object used by +// wxXmlResourceHandlerImpl. The real implementation is in +// wxXmlResourceHandlerImpl class in the "xrc" library while this class is in +// the "core" itself -- but it is so small that it doesn't matter. + +class WXDLLIMPEXP_CORE wxXmlResourceHandlerImplBase : public wxObject +{ +public: + // Constructor. + wxXmlResourceHandlerImplBase(wxXmlResourceHandler *handler) + : m_handler(handler) + {} + + // Destructor. + virtual ~wxXmlResourceHandlerImplBase() {} + + virtual wxObject *CreateResource(wxXmlNode *node, wxObject *parent, + wxObject *instance) = 0; + virtual bool IsOfClass(wxXmlNode *node, const wxString& classname) const = 0; + virtual bool IsObjectNode(const wxXmlNode *node) const = 0; + virtual wxString GetNodeContent(const wxXmlNode *node) = 0; + virtual wxXmlNode *GetNodeParent(const wxXmlNode *node) const = 0; + virtual wxXmlNode *GetNodeNext(const wxXmlNode *node) const = 0; + virtual wxXmlNode *GetNodeChildren(const wxXmlNode *node) const = 0; + virtual bool HasParam(const wxString& param) = 0; + virtual wxXmlNode *GetParamNode(const wxString& param) = 0; + virtual wxString GetParamValue(const wxString& param) = 0; + virtual wxString GetParamValue(const wxXmlNode* node) = 0; + virtual int GetStyle(const wxString& param = wxT("style"), int defaults = 0) = 0; + virtual wxString GetNodeText(const wxXmlNode *node, int flags = 0) = 0; + virtual int GetID() = 0; + virtual wxString GetName() = 0; + virtual bool GetBool(const wxString& param, bool defaultv = false) = 0; + virtual long GetLong(const wxString& param, long defaultv = 0) = 0; + virtual float GetFloat(const wxString& param, float defaultv = 0) = 0; + virtual wxColour GetColour(const wxString& param, + const wxColour& defaultv = wxNullColour) = 0; + virtual wxSize GetSize(const wxString& param = wxT("size"), + wxWindow *windowToUse = NULL) = 0; + virtual wxPoint GetPosition(const wxString& param = wxT("pos")) = 0; + virtual wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0, + wxWindow *windowToUse = NULL) = 0; + virtual wxSize GetPairInts(const wxString& param) = 0; + virtual wxDirection GetDirection(const wxString& param, wxDirection dir = wxLEFT) = 0; + virtual wxBitmap GetBitmap(const wxString& param = wxT("bitmap"), + const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) = 0; + virtual wxBitmap GetBitmap(const wxXmlNode* node, + const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) = 0; + virtual wxBitmapBundle GetBitmapBundle(const wxString& param = wxT("bitmap"), + const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) = 0; + virtual wxBitmapBundle GetBitmapBundle(const wxXmlNode* node, + const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) = 0; + virtual wxIcon GetIcon(const wxString& param = wxT("icon"), + const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) = 0; + virtual wxIcon GetIcon(const wxXmlNode* node, + const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) = 0; + virtual wxIconBundle GetIconBundle(const wxString& param, + const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER)) = 0; + virtual wxImageList *GetImageList(const wxString& param = wxT("imagelist")) = 0; + +#if wxUSE_ANIMATIONCTRL + virtual wxAnimation* GetAnimation(const wxString& param = wxT("animation"), + wxAnimationCtrlBase* ctrl = NULL) = 0; +#endif + + virtual wxFont GetFont(const wxString& param = wxT("font"), wxWindow* parent = NULL) = 0; + virtual bool GetBoolAttr(const wxString& attr, bool defaultv) = 0; + virtual wxString GetFilePath(const wxXmlNode* node) = 0; + virtual void SetupWindow(wxWindow *wnd) = 0; + virtual void CreateChildren(wxObject *parent, bool this_hnd_only = false) = 0; + virtual void CreateChildrenPrivately(wxObject *parent, + wxXmlNode *rootnode = NULL) = 0; + virtual wxObject *CreateResFromNode(wxXmlNode *node, wxObject *parent, + wxObject *instance = NULL) = 0; + +#if wxUSE_FILESYSTEM + virtual wxFileSystem& GetCurFileSystem() = 0; +#endif + virtual void ReportError(wxXmlNode *context, const wxString& message) = 0; + virtual void ReportError(const wxString& message) = 0; + virtual void ReportParamError(const wxString& param, const wxString& message) = 0; + + wxXmlResourceHandler* GetHandler() { return m_handler; } + +protected: + wxXmlResourceHandler *m_handler; +}; + +// Base class for all XRC handlers. +// +// Notice that this class is defined in the core library itself and so can be +// used as the base class by classes in any GUI library. However to actually be +// usable, it needs to be registered with wxXmlResource which implies linking +// the application with the xrc library. +// +// Also note that all the methods forwarding to GetImpl() are documented only +// in wxXmlResourceHandlerImpl in wx/xrc/xmlres.h to avoid duplication. + +class WXDLLIMPEXP_CORE wxXmlResourceHandler : public wxObject +{ +public: + // Constructor creates an unusable object, before anything can be done with + // it, SetImpl() needs to be called as done by wxXmlResource::AddHandler(). + wxXmlResourceHandler() + { + m_node = NULL; + m_parent = + m_instance = NULL; + m_parentAsWindow = NULL; + m_resource = NULL; + + m_impl = NULL; + } + + // This should be called exactly once. + void SetImpl(wxXmlResourceHandlerImplBase* impl) + { + wxASSERT_MSG( !m_impl, wxS("Should be called exactly once") ); + + m_impl = impl; + } + + + // Destructor. + virtual ~wxXmlResourceHandler() + { + delete m_impl; + } + + wxObject *CreateResource(wxXmlNode *node, wxObject *parent, + wxObject *instance) + { + return GetImpl()->CreateResource(node, parent, instance); + } + + // This one is called from CreateResource after variables + // were filled. + virtual wxObject *DoCreateResource() = 0; + + // Returns true if it understands this node and can create + // a resource from it, false otherwise. + virtual bool CanHandle(wxXmlNode *node) = 0; + + + void SetParentResource(wxXmlResource *res) + { + m_resource = res; + } + + + // These methods are not forwarded to wxXmlResourceHandlerImpl because they + // are called from the derived classes ctors and so before SetImpl() can be + // called. + + // Add a style flag (e.g. wxMB_DOCKABLE) to the list of flags + // understood by this handler. + void AddStyle(const wxString& name, int value); + + // Add styles common to all wxWindow-derived classes. + void AddWindowStyles(); + +protected: + // Everything else is simply forwarded to wxXmlResourceHandlerImpl. + void ReportError(wxXmlNode *context, const wxString& message) + { + GetImpl()->ReportError(context, message); + } + void ReportError(const wxString& message) + { + GetImpl()->ReportError(message); + } + void ReportParamError(const wxString& param, const wxString& message) + { + GetImpl()->ReportParamError(param, message); + } + + bool IsOfClass(wxXmlNode *node, const wxString& classname) const + { + return GetImpl()->IsOfClass(node, classname); + } + + bool IsObjectNode(const wxXmlNode *node) const + { + return GetImpl()->IsObjectNode(node); + } + wxString GetNodeContent(const wxXmlNode *node) + { + return GetImpl()->GetNodeContent(node); + } + + wxXmlNode *GetNodeParent(const wxXmlNode *node) const + { + return GetImpl()->GetNodeParent(node); + } + wxXmlNode *GetNodeNext(const wxXmlNode *node) const + { + return GetImpl()->GetNodeNext(node); + } + wxXmlNode *GetNodeChildren(const wxXmlNode *node) const + { + return GetImpl()->GetNodeChildren(node); + } + + bool HasParam(const wxString& param) + { + return GetImpl()->HasParam(param); + } + + wxXmlNode *GetParamNode(const wxString& param) + { + return GetImpl()->GetParamNode(param); + } + wxString GetParamValue(const wxString& param) + { + return GetImpl()->GetParamValue(param); + } + wxString GetParamValue(const wxXmlNode* node) + { + return GetImpl()->GetParamValue(node); + } + int GetStyle(const wxString& param = wxT("style"), int defaults = 0) + { + return GetImpl()->GetStyle(param, defaults); + } + wxString GetNodeText(const wxXmlNode *node, int flags = 0) + { + return GetImpl()->GetNodeText(node, flags); + } + wxString GetText(const wxString& param, bool translate = true) + { + return GetImpl()->GetNodeText(GetImpl()->GetParamNode(param), + translate ? 0 : wxXRC_TEXT_NO_TRANSLATE); + } + int GetID() const + { + return GetImpl()->GetID(); + } + wxString GetName() + { + return GetImpl()->GetName(); + } + bool GetBool(const wxString& param, bool defaultv = false) + { + return GetImpl()->GetBool(param, defaultv); + } + long GetLong(const wxString& param, long defaultv = 0) + { + return GetImpl()->GetLong(param, defaultv); + } + float GetFloat(const wxString& param, float defaultv = 0) + { + return GetImpl()->GetFloat(param, defaultv); + } + wxColour GetColour(const wxString& param, + const wxColour& defaultv = wxNullColour) + { + return GetImpl()->GetColour(param, defaultv); + } + wxSize GetSize(const wxString& param = wxT("size"), + wxWindow *windowToUse = NULL) + { + return GetImpl()->GetSize(param, windowToUse); + } + wxPoint GetPosition(const wxString& param = wxT("pos")) + { + return GetImpl()->GetPosition(param); + } + wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0, + wxWindow *windowToUse = NULL) + { + return GetImpl()->GetDimension(param, defaultv, windowToUse); + } + wxSize GetPairInts(const wxString& param) + { + return GetImpl()->GetPairInts(param); + } + wxDirection GetDirection(const wxString& param, wxDirection dir = wxLEFT) + { + return GetImpl()->GetDirection(param, dir); + } + wxBitmap GetBitmap(const wxString& param = wxT("bitmap"), + const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) + { + return GetImpl()->GetBitmap(param, defaultArtClient, size); + } + wxBitmap GetBitmap(const wxXmlNode* node, + const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) + { + return GetImpl()->GetBitmap(node, defaultArtClient, size); + } + wxBitmapBundle GetBitmapBundle(const wxString& param = wxT("bitmap"), + const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) + { + return GetImpl()->GetBitmapBundle(param, defaultArtClient, size); + } + wxBitmapBundle GetBitmapBundle(const wxXmlNode* node, + const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) + { + return GetImpl()->GetBitmapBundle(node, defaultArtClient, size); + } + wxIcon GetIcon(const wxString& param = wxT("icon"), + const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) + { + return GetImpl()->GetIcon(param, defaultArtClient, size); + } + wxIcon GetIcon(const wxXmlNode* node, + const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) + { + return GetImpl()->GetIcon(node, defaultArtClient, size); + } + wxIconBundle GetIconBundle(const wxString& param, + const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER)) + { + return GetImpl()->GetIconBundle(param, defaultArtClient); + } + wxImageList *GetImageList(const wxString& param = wxT("imagelist")) + { + return GetImpl()->GetImageList(param); + } + +#if wxUSE_ANIMATIONCTRL + wxAnimation* GetAnimation(const wxString& param = wxT("animation"), + wxAnimationCtrlBase* ctrl = NULL) + { + return GetImpl()->GetAnimation(param, ctrl); + } +#endif + + wxFont GetFont(const wxString& param = wxT("font"), + wxWindow* parent = NULL) + { + return GetImpl()->GetFont(param, parent); + } + bool GetBoolAttr(const wxString& attr, bool defaultv) + { + return GetImpl()->GetBoolAttr(attr, defaultv); + } + wxString GetFilePath(const wxXmlNode* node) + { + return GetImpl()->GetFilePath(node); + } + void SetupWindow(wxWindow *wnd) + { + GetImpl()->SetupWindow(wnd); + } + void CreateChildren(wxObject *parent, bool this_hnd_only = false) + { + GetImpl()->CreateChildren(parent, this_hnd_only); + } + void CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = NULL) + { + GetImpl()->CreateChildrenPrivately(parent, rootnode); + } + wxObject *CreateResFromNode(wxXmlNode *node, + wxObject *parent, wxObject *instance = NULL) + { + return GetImpl()->CreateResFromNode(node, parent, instance); + } + +#if wxUSE_FILESYSTEM + wxFileSystem& GetCurFileSystem() + { + return GetImpl()->GetCurFileSystem(); + } +#endif + + // Variables (filled by CreateResource) + wxXmlNode *m_node; + wxString m_class; + wxObject *m_parent, *m_instance; + wxWindow *m_parentAsWindow; + wxXmlResource *m_resource; + + // provide method access to those member variables + wxXmlResource* GetResource() const { return m_resource; } + wxXmlNode* GetNode() const { return m_node; } + wxString GetClass() const { return m_class; } + wxObject* GetParent() const { return m_parent; } + wxObject* GetInstance() const { return m_instance; } + wxWindow* GetParentAsWindow() const { return m_parentAsWindow; } + + + wxArrayString m_styleNames; + wxArrayInt m_styleValues; + + friend class wxXmlResourceHandlerImpl; + +private: + // This is supposed to never return NULL because SetImpl() should have been + // called. + wxXmlResourceHandlerImplBase* GetImpl() const; + + wxXmlResourceHandlerImplBase *m_impl; + + wxDECLARE_ABSTRACT_CLASS(wxXmlResourceHandler); +}; + +#endif // wxUSE_XRC + +#endif // _WX_XRC_XMLRESHANDLER_H_ diff --git a/lib/wxWidgets/include/wx/xti.h b/lib/wxWidgets/include/wx/xti.h new file mode 100644 index 0000000..ee8150a --- /dev/null +++ b/lib/wxWidgets/include/wx/xti.h @@ -0,0 +1,473 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xti.h +// Purpose: runtime metadata information (extended class info) +// Author: Stefan Csomor +// Modified by: Francesco Montorsi +// Created: 27/07/03 +// Copyright: (c) 1997 Julian Smart +// (c) 2003 Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XTIH__ +#define _WX_XTIH__ + +// We want to support properties, event sources and events sinks through +// explicit declarations, using templates and specialization to make the +// effort as painless as possible. +// +// This means we have the following domains : +// +// - Type Information for categorizing built in types as well as custom types +// this includes information about enums, their values and names +// - Type safe value storage : a kind of wxVariant, called right now wxAny +// which will be merged with wxVariant +// - Property Information and Property Accessors providing access to a class' +// values and exposed event delegates +// - Information about event handlers +// - extended Class Information for accessing all these + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" + +#if wxUSE_EXTENDED_RTTI + +class WXDLLIMPEXP_FWD_BASE wxAny; +class WXDLLIMPEXP_FWD_BASE wxAnyList; +class WXDLLIMPEXP_FWD_BASE wxObject; +class WXDLLIMPEXP_FWD_BASE wxString; +class WXDLLIMPEXP_FWD_BASE wxClassInfo; +class WXDLLIMPEXP_FWD_BASE wxHashTable; +class WXDLLIMPEXP_FWD_BASE wxObject; +class WXDLLIMPEXP_FWD_BASE wxPluginLibrary; +class WXDLLIMPEXP_FWD_BASE wxHashTable; +class WXDLLIMPEXP_FWD_BASE wxHashTable_Node; + +class WXDLLIMPEXP_FWD_BASE wxStringToAnyHashMap; +class WXDLLIMPEXP_FWD_BASE wxPropertyInfoMap; +class WXDLLIMPEXP_FWD_BASE wxPropertyAccessor; +class WXDLLIMPEXP_FWD_BASE wxObjectAllocatorAndCreator; +class WXDLLIMPEXP_FWD_BASE wxObjectAllocator; + + +#define wx_dynamic_cast(t, x) dynamic_cast(x) + +#include "wx/xtitypes.h" +#include "wx/xtihandler.h" + +// ---------------------------------------------------------------------------- +// wxClassInfo +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxObjectFunctor +{ +public: + virtual ~wxObjectFunctor(); + + // Invoke the actual event handler: + virtual void operator()(const wxObject *) = 0; +}; + +class WXDLLIMPEXP_FWD_BASE wxPropertyInfo; +class WXDLLIMPEXP_FWD_BASE wxHandlerInfo; + +typedef wxObject *(*wxObjectConstructorFn)(void); +typedef wxPropertyInfo *(*wxPropertyInfoFn)(void); +typedef wxHandlerInfo *(*wxHandlerInfoFn)(void); +typedef void (*wxVariantToObjectConverter)( const wxAny &data, wxObjectFunctor* fn ); +typedef wxObject* (*wxVariantToObjectPtrConverter) ( const wxAny& data); +typedef wxAny (*wxObjectToVariantConverter)( wxObject* ); + +WXDLLIMPEXP_BASE wxString wxAnyGetAsString( const wxAny& data); +WXDLLIMPEXP_BASE const wxObject* wxAnyGetAsObjectPtr( const wxAny& data); + +class WXDLLIMPEXP_BASE wxObjectWriter; +class WXDLLIMPEXP_BASE wxObjectWriterCallback; + +typedef bool (*wxObjectStreamingCallback) ( const wxObject *, wxObjectWriter *, \ + wxObjectWriterCallback *, const wxStringToAnyHashMap & ); + + + +class WXDLLIMPEXP_BASE wxClassInfo +{ + friend class WXDLLIMPEXP_BASE wxPropertyInfo; + friend class /* WXDLLIMPEXP_BASE */ wxHandlerInfo; + friend wxObject *wxCreateDynamicObject(const wxString& name); + +public: + wxClassInfo(const wxClassInfo **_Parents, + const wxChar *_UnitName, + const wxChar *_ClassName, + int size, + wxObjectConstructorFn ctor, + wxPropertyInfoFn _Props, + wxHandlerInfoFn _Handlers, + wxObjectAllocatorAndCreator* _Constructor, + const wxChar ** _ConstructorProperties, + const int _ConstructorPropertiesCount, + wxVariantToObjectPtrConverter _PtrConverter1, + wxVariantToObjectConverter _Converter2, + wxObjectToVariantConverter _Converter3, + wxObjectStreamingCallback _streamingCallback = NULL) : + m_className(_ClassName), + m_objectSize(size), + m_objectConstructor(ctor), + m_next(sm_first), + m_firstPropertyFn(_Props), + m_firstHandlerFn(_Handlers), + m_firstProperty(NULL), + m_firstHandler(NULL), + m_firstInited(false), + m_parents(_Parents), + m_unitName(_UnitName), + m_constructor(_Constructor), + m_constructorProperties(_ConstructorProperties), + m_constructorPropertiesCount(_ConstructorPropertiesCount), + m_variantOfPtrToObjectConverter(_PtrConverter1), + m_variantToObjectConverter(_Converter2), + m_objectToVariantConverter(_Converter3), + m_streamingCallback(_streamingCallback) + { + sm_first = this; + Register(); + } + + wxClassInfo(const wxChar *_UnitName, const wxChar *_ClassName, + const wxClassInfo **_Parents) : + m_className(_ClassName), + m_objectSize(0), + m_objectConstructor(NULL), + m_next(sm_first), + m_firstPropertyFn(NULL), + m_firstHandlerFn(NULL), + m_firstProperty(NULL), + m_firstHandler(NULL), + m_firstInited(true), + m_parents(_Parents), + m_unitName(_UnitName), + m_constructor(NULL), + m_constructorProperties(NULL), + m_constructorPropertiesCount(0), + m_variantOfPtrToObjectConverter(NULL), + m_variantToObjectConverter(NULL), + m_objectToVariantConverter(NULL), + m_streamingCallback(NULL) + { + sm_first = this; + Register(); + } + + // ctor compatible with old RTTI system + wxClassInfo(const wxChar *_ClassName, + const wxClassInfo *_Parent1, + const wxClassInfo *_Parent2, + int size, + wxObjectConstructorFn ctor) : + m_className(_ClassName), + m_objectSize(size), + m_objectConstructor(ctor), + m_next(sm_first), + m_firstPropertyFn(NULL), + m_firstHandlerFn(NULL), + m_firstProperty(NULL), + m_firstHandler(NULL), + m_firstInited(true), + m_parents(NULL), + m_unitName(NULL), + m_constructor(NULL), + m_constructorProperties(NULL), + m_constructorPropertiesCount(0), + m_variantOfPtrToObjectConverter(NULL), + m_variantToObjectConverter(NULL), + m_objectToVariantConverter(NULL), + m_streamingCallback(NULL) + { + sm_first = this; + m_parents[0] = _Parent1; + m_parents[1] = _Parent2; + m_parents[2] = NULL; + Register(); + } + + virtual ~wxClassInfo(); + + // allocates an instance of this class, this object does not have to be + // initialized or fully constructed as this call will be followed by a call to Create + virtual wxObject *AllocateObject() const + { return m_objectConstructor ? (*m_objectConstructor)() : 0; } + + // 'old naming' for AllocateObject staying here for backward compatibility + wxObject *CreateObject() const { return AllocateObject(); } + + // direct construction call for classes that cannot construct instances via alloc/create + wxObject *ConstructObject(int ParamCount, wxAny *Params) const; + + bool NeedsDirectConstruction() const; + + const wxChar *GetClassName() const + { return m_className; } + const wxChar *GetBaseClassName1() const + { return m_parents[0] ? m_parents[0]->GetClassName() : NULL; } + const wxChar *GetBaseClassName2() const + { return (m_parents[0] && m_parents[1]) ? m_parents[1]->GetClassName() : NULL; } + + const wxClassInfo *GetBaseClass1() const + { return m_parents[0]; } + const wxClassInfo *GetBaseClass2() const + { return m_parents[0] ? m_parents[1] : NULL; } + + const wxChar *GetIncludeName() const + { return m_unitName; } + const wxClassInfo **GetParents() const + { return m_parents; } + int GetSize() const + { return m_objectSize; } + bool IsDynamic() const + { return (NULL != m_objectConstructor); } + + wxObjectConstructorFn GetConstructor() const + { return m_objectConstructor; } + const wxClassInfo *GetNext() const + { return m_next; } + + // statics: + + static void CleanUp(); + static wxClassInfo *FindClass(const wxString& className); + static const wxClassInfo *GetFirst() + { return sm_first; } + + + // Climb upwards through inheritance hierarchy. + // Dual inheritance is catered for. + + bool IsKindOf(const wxClassInfo *info) const; + + wxDECLARE_CLASS_INFO_ITERATORS(); + + // if there is a callback registered with that class it will be called + // before this object will be written to disk, it can veto streaming out + // this object by returning false, if this class has not registered a + // callback, the search will go up the inheritance tree if no callback has + // been registered true will be returned by default + bool BeforeWriteObject( const wxObject *obj, wxObjectWriter *streamer, + wxObjectWriterCallback *writercallback, const wxStringToAnyHashMap &metadata) const; + + // gets the streaming callback from this class or any superclass + wxObjectStreamingCallback GetStreamingCallback() const; + + // returns the first property + wxPropertyInfo* GetFirstProperty() const + { EnsureInfosInited(); return m_firstProperty; } + + // returns the first handler + wxHandlerInfo* GetFirstHandler() const + { EnsureInfosInited(); return m_firstHandler; } + + // Call the Create upon an instance of the class, in the end the object is fully + // initialized + virtual bool Create (wxObject *object, int ParamCount, wxAny *Params) const; + + // get number of parameters for constructor + virtual int GetCreateParamCount() const + { return m_constructorPropertiesCount; } + + // get n-th constructor parameter + virtual const wxChar* GetCreateParamName(int n) const + { return m_constructorProperties[n]; } + + // Runtime access to objects for simple properties (get/set) by property + // name and variant data + virtual void SetProperty (wxObject *object, const wxChar *propertyName, + const wxAny &value) const; + virtual wxAny GetProperty (wxObject *object, const wxChar *propertyName) const; + + // Runtime access to objects for collection properties by property name + virtual wxAnyList GetPropertyCollection(wxObject *object, + const wxChar *propertyName) const; + virtual void AddToPropertyCollection(wxObject *object, const wxChar *propertyName, + const wxAny& value) const; + + // we must be able to cast variants to wxObject pointers, templates seem + // not to be suitable + void CallOnAny( const wxAny &data, wxObjectFunctor* functor ) const; + + wxObject* AnyToObjectPtr( const wxAny &data) const; + + wxAny ObjectPtrToAny( wxObject *object ) const; + + // find property by name + virtual const wxPropertyInfo *FindPropertyInfo (const wxChar *PropertyName) const; + + // find handler by name + virtual const wxHandlerInfo *FindHandlerInfo (const wxChar *handlerName) const; + + // find property by name + virtual wxPropertyInfo *FindPropertyInfoInThisClass (const wxChar *PropertyName) const; + + // find handler by name + virtual wxHandlerInfo *FindHandlerInfoInThisClass (const wxChar *handlerName) const; + + // puts all the properties of this class and its superclasses in the map, + // as long as there is not yet an entry with the same name (overriding mechanism) + void GetProperties( wxPropertyInfoMap &map ) const; + +private: + const wxChar *m_className; + int m_objectSize; + wxObjectConstructorFn m_objectConstructor; + + // class info object live in a linked list: + // pointers to its head and the next element in it + + static wxClassInfo *sm_first; + wxClassInfo *m_next; + + static wxHashTable *sm_classTable; + + wxPropertyInfoFn m_firstPropertyFn; + wxHandlerInfoFn m_firstHandlerFn; + + +protected: + void EnsureInfosInited() const + { + if ( !m_firstInited) + { + if ( m_firstPropertyFn != NULL) + m_firstProperty = (*m_firstPropertyFn)(); + if ( m_firstHandlerFn != NULL) + m_firstHandler = (*m_firstHandlerFn)(); + m_firstInited = true; + } + } + mutable wxPropertyInfo* m_firstProperty; + mutable wxHandlerInfo* m_firstHandler; + +private: + mutable bool m_firstInited; + + const wxClassInfo** m_parents; + const wxChar* m_unitName; + + wxObjectAllocatorAndCreator* m_constructor; + const wxChar ** m_constructorProperties; + const int m_constructorPropertiesCount; + wxVariantToObjectPtrConverter m_variantOfPtrToObjectConverter; + wxVariantToObjectConverter m_variantToObjectConverter; + wxObjectToVariantConverter m_objectToVariantConverter; + wxObjectStreamingCallback m_streamingCallback; + + const wxPropertyAccessor *FindAccessor (const wxChar *propertyName) const; + +protected: + // registers the class + void Register(); + void Unregister(); + + wxDECLARE_NO_COPY_CLASS(wxClassInfo); +}; + +WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxString& name); + +// ---------------------------------------------------------------------------- +// wxDynamicClassInfo +// ---------------------------------------------------------------------------- + +// this object leads to having a pure runtime-instantiation + +class WXDLLIMPEXP_BASE wxDynamicClassInfo : public wxClassInfo +{ + friend class WXDLLIMPEXP_BASE wxDynamicObject; + +public: + wxDynamicClassInfo( const wxChar *_UnitName, const wxChar *_ClassName, + const wxClassInfo* superClass ); + virtual ~wxDynamicClassInfo(); + + // constructs a wxDynamicObject with an instance + virtual wxObject *AllocateObject() const; + + // Call the Create method for a class + virtual bool Create (wxObject *object, int ParamCount, wxAny *Params) const; + + // get number of parameters for constructor + virtual int GetCreateParamCount() const; + + // get i-th constructor parameter + virtual const wxChar* GetCreateParamName(int i) const; + + // Runtime access to objects by property name, and variant data + virtual void SetProperty (wxObject *object, const wxChar *PropertyName, + const wxAny &Value) const; + virtual wxAny GetProperty (wxObject *object, const wxChar *PropertyName) const; + + // adds a property to this class at runtime + void AddProperty( const wxChar *propertyName, const wxTypeInfo* typeInfo ); + + // removes an existing runtime-property + void RemoveProperty( const wxChar *propertyName ); + + // renames an existing runtime-property + void RenameProperty( const wxChar *oldPropertyName, const wxChar *newPropertyName ); + + // as a handler to this class at runtime + void AddHandler( const wxChar *handlerName, wxObjectEventFunction address, + const wxClassInfo* eventClassInfo ); + + // removes an existing runtime-handler + void RemoveHandler( const wxChar *handlerName ); + + // renames an existing runtime-handler + void RenameHandler( const wxChar *oldHandlerName, const wxChar *newHandlerName ); + +private: + struct wxDynamicClassInfoInternal; + wxDynamicClassInfoInternal* m_data; +}; + +// ---------------------------------------------------------------------------- +// wxDECLARE class macros +// ---------------------------------------------------------------------------- + +#define _DECLARE_DYNAMIC_CLASS(name) \ + public: \ + static wxClassInfo ms_classInfo; \ + static const wxClassInfo* ms_classParents[]; \ + static wxPropertyInfo* GetPropertiesStatic(); \ + static wxHandlerInfo* GetHandlersStatic(); \ + static wxClassInfo *GetClassInfoStatic() \ + { return &name::ms_classInfo; } \ + virtual wxClassInfo *GetClassInfo() const \ + { return &name::ms_classInfo; } + +#define wxDECLARE_DYNAMIC_CLASS(name) \ + static wxObjectAllocatorAndCreator* ms_constructor; \ + static const wxChar * ms_constructorProperties[]; \ + static const int ms_constructorPropertiesCount; \ + _DECLARE_DYNAMIC_CLASS(name) + +#define wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(name) \ + wxDECLARE_NO_ASSIGN_CLASS(name); \ + wxDECLARE_DYNAMIC_CLASS(name) + +#define wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(name) \ + wxDECLARE_NO_ASSIGN_DEF_COPY(name); \ + wxDECLARE_DYNAMIC_CLASS(name) + +#define wxDECLARE_DYNAMIC_CLASS_NO_COPY(name) \ + wxDECLARE_NO_COPY_CLASS(name); \ + wxDECLARE_DYNAMIC_CLASS(name) + +#define wxDECLARE_CLASS(name) \ + wxDECLARE_DYNAMIC_CLASS(name) + +#define wxDECLARE_ABSTRACT_CLASS(name) _DECLARE_DYNAMIC_CLASS(name) +#define wxCLASSINFO(name) (&name::ms_classInfo) + +#endif // wxUSE_EXTENDED_RTTI +#endif // _WX_XTIH__ diff --git a/lib/wxWidgets/include/wx/xti2.h b/lib/wxWidgets/include/wx/xti2.h new file mode 100644 index 0000000..f153f17 --- /dev/null +++ b/lib/wxWidgets/include/wx/xti2.h @@ -0,0 +1,293 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/wxt2.h +// Purpose: runtime metadata information (extended class info) +// Author: Stefan Csomor +// Modified by: Francesco Montorsi +// Created: 27/07/03 +// Copyright: (c) 1997 Julian Smart +// (c) 2003 Stefan Csomor +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XTI2H__ +#define _WX_XTI2H__ + +// ---------------------------------------------------------------------------- +// second part of xti headers, is included from object.h +// ---------------------------------------------------------------------------- + +#if wxUSE_EXTENDED_RTTI + +// ---------------------------------------------------------------------------- +// wxDynamicObject class, its instances connect to a 'super class instance' +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxDynamicObject : public wxObject +{ + friend class WXDLLIMPEXP_FWD_BASE wxDynamicClassInfo ; +public: + // instantiates this object with an instance of its superclass + wxDynamicObject(wxObject* superClassInstance, const wxDynamicClassInfo *info) ; + virtual ~wxDynamicObject(); + + void SetProperty (const wxChar *propertyName, const wxAny &value); + wxAny GetProperty (const wxChar *propertyName) const ; + + // get the runtime identity of this object + wxClassInfo *GetClassInfo() const + { +#ifdef _MSC_VER + return (wxClassInfo*) m_classInfo; +#else + wxDynamicClassInfo *nonconst = const_cast(m_classInfo); + return static_cast(nonconst); +#endif + } + + wxObject* GetSuperClassInstance() const + { + return m_superClassInstance ; + } +private : + // removes an existing runtime-property + void RemoveProperty( const wxChar *propertyName ) ; + + // renames an existing runtime-property + void RenameProperty( const wxChar *oldPropertyName , const wxChar *newPropertyName ) ; + + wxObject *m_superClassInstance ; + const wxDynamicClassInfo *m_classInfo; + struct wxDynamicObjectInternal; + wxDynamicObjectInternal *m_data; +}; + +// ---------------------------------------------------------------------------- +// String conversion templates supporting older compilers +// ---------------------------------------------------------------------------- + +#if wxUSE_FUNC_TEMPLATE_POINTER +# define wxTO_STRING(type) wxToStringConverter +# define wxTO_STRING_IMP(type) +# define wxFROM_STRING(type) wxFromStringConverter +# define wxFROM_STRING_IMP(type) +#else +# define wxTO_STRING(type) ToString##type +# define wxTO_STRING_IMP(type) \ + inline void ToString##type( const wxAny& data, wxString &result ) \ +{ wxToStringConverter(data, result); } + +# define wxFROM_STRING(type) FromString##type +# define wxFROM_STRING_IMP(type) \ + inline void FromString##type( const wxString& data, wxAny &result ) \ +{ wxFromStringConverter(data, result); } +#endif + +#include "wx/xtiprop.h" +#include "wx/xtictor.h" + +// ---------------------------------------------------------------------------- +// wxIMPLEMENT class macros for concrete classes +// ---------------------------------------------------------------------------- + +// Single inheritance with one base class + +#define _DEFAULT_CONSTRUCTOR(name) \ +wxObject* wxConstructorFor##name() \ +{ return new name; } + +#define _DEFAULT_CONVERTERS(name) \ +wxObject* wxVariantOfPtrToObjectConverter##name ( const wxAny &data ) \ +{ return data.As( (name**)NULL ); } \ + wxAny wxObjectToVariantConverter##name ( wxObject *data ) \ +{ return wxAny( wx_dynamic_cast(name*, data) ); } + +#define _TYPEINFO_CLASSES(n, toString, fromString ) \ + wxClassTypeInfo s_typeInfo##n(wxT_OBJECT, &n::ms_classInfo, \ + toString, fromString, typeid(n).name()); \ + wxClassTypeInfo s_typeInfoPtr##n(wxT_OBJECT_PTR, &n::ms_classInfo, \ + toString, fromString, typeid(n*).name()); + +#define _IMPLEMENT_DYNAMIC_CLASS(name, basename, unit, callback) \ + _DEFAULT_CONSTRUCTOR(name) \ + _DEFAULT_CONVERTERS(name) \ + \ + const wxClassInfo* name::ms_classParents[] = \ +{ &basename::ms_classInfo, NULL }; \ + wxClassInfo name::ms_classInfo(name::ms_classParents, wxT(unit), \ + wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name, \ + name::GetPropertiesStatic, name::GetHandlersStatic, name::ms_constructor, \ + name::ms_constructorProperties, name::ms_constructorPropertiesCount, \ + wxVariantOfPtrToObjectConverter##name, NULL, wxObjectToVariantConverter##name, \ + callback); + +#define _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY(name, basename, unit, callback ) \ + _DEFAULT_CONSTRUCTOR(name) \ + _DEFAULT_CONVERTERS(name) \ + void wxVariantToObjectConverter##name ( const wxAny &data, wxObjectFunctor* fn ) \ + { name o = data.As(); (*fn)( &o ); } \ + \ + const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo,NULL }; \ + wxClassInfo name::ms_classInfo(name::ms_classParents, wxT(unit), \ + wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name, \ + name::GetPropertiesStatic,name::GetHandlersStatic,name::ms_constructor, \ + name::ms_constructorProperties, name::ms_constructorPropertiesCount, \ + wxVariantOfPtrToObjectConverter##name, wxVariantToObjectConverter##name, \ + wxObjectToVariantConverter##name, callback); + +#define wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name, basename ) \ + _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name, basename, "", NULL ) \ + _TYPEINFO_CLASSES(name, NULL, NULL) \ + const wxPropertyInfo *name::GetPropertiesStatic() \ +{ return (wxPropertyInfo*) NULL; } \ + const wxHandlerInfo *name::GetHandlersStatic() \ +{ return (wxHandlerInfo*) NULL; } \ + wxCONSTRUCTOR_DUMMY( name ) + +#define wxIMPLEMENT_DYNAMIC_CLASS( name, basename ) \ + _IMPLEMENT_DYNAMIC_CLASS( name, basename, "", NULL ) \ + _TYPEINFO_CLASSES(name, NULL, NULL) \ + wxPropertyInfo *name::GetPropertiesStatic() \ +{ return (wxPropertyInfo*) NULL; } \ + wxHandlerInfo *name::GetHandlersStatic() \ +{ return (wxHandlerInfo*) NULL; } \ + wxCONSTRUCTOR_DUMMY( name ) + +#define wxIMPLEMENT_DYNAMIC_CLASS_XTI( name, basename, unit ) \ + _IMPLEMENT_DYNAMIC_CLASS( name, basename, unit, NULL ) \ + _TYPEINFO_CLASSES(name, NULL, NULL) + +#define wxIMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK( name, basename, unit, callback )\ + _IMPLEMENT_DYNAMIC_CLASS( name, basename, unit, &callback ) \ + _TYPEINFO_CLASSES(name, NULL, NULL) + +#define wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_XTI( name, basename, unit ) \ + _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name, basename, unit, NULL ) \ + _TYPEINFO_CLASSES(name, NULL, NULL) + +#define wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( name, basename, \ + unit, toString, \ + fromString ) \ + _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name, basename, unit, NULL ) \ + _TYPEINFO_CLASSES(name, toString, fromString) + +// this is for classes that do not derive from wxObject, there are no creators for these + +#define wxIMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_NO_BASE_XTI( name, unit ) \ + const wxClassInfo* name::ms_classParents[] = { NULL }; \ + wxClassInfo name::ms_classInfo(name::ms_classParents, wxEmptyString, \ + wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) 0, \ + name::GetPropertiesStatic,name::GetHandlersStatic, 0, 0, \ + 0, 0, 0 ); \ + _TYPEINFO_CLASSES(name, NULL, NULL) + +// this is for subclasses that still do not derive from wxObject + +#define wxIMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_XTI( name, basename, unit ) \ + const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo, NULL }; \ + wxClassInfo name::ms_classInfo(name::ms_classParents, wxEmptyString, \ + wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) 0, \ + name::GetPropertiesStatic,name::GetHandlersStatic, 0, 0, \ + 0, 0, 0 ); \ + _TYPEINFO_CLASSES(name, NULL, NULL) + + +// Multiple inheritance with two base classes + +#define _IMPLEMENT_DYNAMIC_CLASS2(name, basename, basename2, unit, callback) \ + _DEFAULT_CONSTRUCTOR(name) \ + _DEFAULT_CONVERTERS(name) \ + \ + const wxClassInfo* name::ms_classParents[] = \ +{ &basename::ms_classInfo,&basename2::ms_classInfo, NULL }; \ + wxClassInfo name::ms_classInfo(name::ms_classParents, wxT(unit), \ + wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name, \ + name::GetPropertiesStatic,name::GetHandlersStatic,name::ms_constructor, \ + name::ms_constructorProperties, name::ms_constructorPropertiesCount, \ + wxVariantOfPtrToObjectConverter##name, NULL, wxObjectToVariantConverter##name, \ + callback); + +#define wxIMPLEMENT_DYNAMIC_CLASS2( name, basename, basename2) \ + _IMPLEMENT_DYNAMIC_CLASS2( name, basename, basename2, "", NULL) \ + _TYPEINFO_CLASSES(name, NULL, NULL) \ + wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL; } \ + wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL; } \ + wxCONSTRUCTOR_DUMMY( name ) + +#define wxIMPLEMENT_DYNAMIC_CLASS2_XTI( name, basename, basename2, unit) \ + _IMPLEMENT_DYNAMIC_CLASS2( name, basename, basename2, unit, NULL) \ + _TYPEINFO_CLASSES(name, NULL, NULL) + + + +// ---------------------------------------------------------------------------- +// wxIMPLEMENT class macros for abstract classes +// ---------------------------------------------------------------------------- + +// Single inheritance with one base class + +#define _IMPLEMENT_ABSTRACT_CLASS(name, basename) \ + _DEFAULT_CONVERTERS(name) \ + \ + const wxClassInfo* name::ms_classParents[] = \ +{ &basename::ms_classInfo,NULL }; \ + wxClassInfo name::ms_classInfo(name::ms_classParents, wxEmptyString, \ + wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) 0, \ + name::GetPropertiesStatic,name::GetHandlersStatic, 0, 0, \ + 0, wxVariantOfPtrToObjectConverter##name,0, \ + wxObjectToVariantConverter##name); \ + _TYPEINFO_CLASSES(name, NULL, NULL) + +#define wxIMPLEMENT_ABSTRACT_CLASS( name, basename ) \ + _IMPLEMENT_ABSTRACT_CLASS( name, basename ) \ + wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL; } \ + wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL; } + +// Multiple inheritance with two base classes + +#define wxIMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \ + wxClassInfo name::ms_classInfo(wxT(#name), wxT(#basename1), \ + wxT(#basename2), (int) sizeof(name), \ + (wxObjectConstructorFn) 0); + +// templated streaming, every type that can be converted to wxString +// must have their specialization for these methods + +template +void wxStringReadValue( const wxString &s, T &data ); + +template +void wxStringWriteValue( wxString &s, const T &data); + +template +void wxToStringConverter( const wxAny &v, wxString &s ) +{ wxStringWriteValue(s, v.As()); } + +template +void wxFromStringConverter( const wxString &s, wxAny &v) +{ T d; wxStringReadValue(s, d); v = wxAny(d); } + +// -------------------------------------------------------------------------- +// Collection Support +// -------------------------------------------------------------------------- + +template void wxListCollectionToAnyList( + const collection_t& coll, wxAnyList &value ) +{ + for ( iter current = coll.GetFirst(); current; + current = current->GetNext() ) + { + value.Append( new wxAny(current->GetData()) ); + } +} + +template void wxArrayCollectionToVariantArray( + const collection_t& coll, wxAnyList &value ) +{ + for( size_t i = 0; i < coll.GetCount(); i++ ) + { + value.Append( new wxAny(coll[i]) ); + } +} + +#endif + +#endif // _WX_XTIH2__ diff --git a/lib/wxWidgets/include/wx/xtictor.h b/lib/wxWidgets/include/wx/xtictor.h new file mode 100644 index 0000000..6969463 --- /dev/null +++ b/lib/wxWidgets/include/wx/xtictor.h @@ -0,0 +1,509 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xtictor.h +// Purpose: XTI constructors +// Author: Stefan Csomor +// Modified by: Francesco Montorsi +// Created: 27/07/03 +// Copyright: (c) 1997 Julian Smart +// (c) 2003 Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _XTICTOR_H_ +#define _XTICTOR_H_ + +#include "wx/defs.h" + +#if wxUSE_EXTENDED_RTTI + +#include "wx/xti.h" + +// ---------------------------------------------------------------------------- +// Constructor Bridges +// ---------------------------------------------------------------------------- + +// A constructor bridge allows to call a ctor with an arbitrary number +// or parameters during runtime +class WXDLLIMPEXP_BASE wxObjectAllocatorAndCreator +{ +public: + virtual ~wxObjectAllocatorAndCreator() { } + virtual bool Create(wxObject * &o, wxAny *args) = 0; +}; + +// a direct constructor bridge calls the operator new for this class and +// passes all params to the constructor. Needed for classes that cannot be +// instantiated using alloc-create semantics +class WXDLLIMPEXP_BASE wxObjectAllocator : public wxObjectAllocatorAndCreator +{ +public: + virtual bool Create(wxObject * &o, wxAny *args) = 0; +}; + + +// ---------------------------------------------------------------------------- +// Constructor Bridges for all Numbers of Params +// ---------------------------------------------------------------------------- + +// no params + +template +struct wxObjectAllocatorAndCreator_0 : public wxObjectAllocatorAndCreator +{ + bool Create(wxObject * &o, wxAny *) + { + Class *obj = wx_dynamic_cast(Class*, o); + return obj->Create(); + } +}; + +struct wxObjectAllocatorAndCreator_Dummy : public wxObjectAllocatorAndCreator +{ + bool Create(wxObject *&, wxAny *) + { + return true; + } +}; + +#define wxCONSTRUCTOR_0(klass) \ + wxObjectAllocatorAndCreator_0 constructor##klass; \ + wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \ + const wxChar *klass::ms_constructorProperties[] = { NULL }; \ + const int klass::ms_constructorPropertiesCount = 0; + +#define wxCONSTRUCTOR_DUMMY(klass) \ + wxObjectAllocatorAndCreator_Dummy constructor##klass; \ + wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \ + const wxChar *klass::ms_constructorProperties[] = { NULL }; \ + const int klass::ms_constructorPropertiesCount = 0; + +// direct constructor version + +template +struct wxDirectConstructorBridge_0 : public wxObjectAllocator +{ + bool Create(wxObject * &o, wxAny *args) + { + o = new Class( ); + return o != NULL; + } +}; + +#define wxDIRECT_CONSTRUCTOR_0(klass) \ + wxDirectConstructorBridge_0 constructor##klass; \ + wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \ + const wxChar *klass::ms_constructorProperties[] = { NULL }; \ + const int klass::ms_constructorPropertiesCount = 0; + + +// 1 param + +template +struct wxObjectAllocatorAndCreator_1 : public wxObjectAllocatorAndCreator +{ + bool Create(wxObject * &o, wxAny *args) + { + Class *obj = wx_dynamic_cast(Class*, o); + return obj->Create( + (args[0]).As(static_cast(NULL)) + ); + } +}; + +#define wxCONSTRUCTOR_1(klass,t0,v0) \ + wxObjectAllocatorAndCreator_1 constructor##klass; \ + wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) }; \ + const int klass::ms_constructorPropertiesCount = 1; + +// direct constructor version + +template +struct wxDirectConstructorBridge_1 : public wxObjectAllocator +{ + bool Create(wxObject * &o, wxAny *args) + { + o = new Class( + (args[0]).As(static_cast(NULL)) + ); + return o != NULL; + } +}; + +#define wxDIRECT_CONSTRUCTOR_1(klass,t0,v0) \ + wxDirectConstructorBridge_1 constructor##klass; \ + wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) }; \ + const int klass::ms_constructorPropertiesCount = 1; + + +// 2 params + +template +struct wxObjectAllocatorAndCreator_2 : public wxObjectAllocatorAndCreator +{ + bool Create(wxObject * &o, wxAny *args) + { + Class *obj = wx_dynamic_cast(Class*, o); + return obj->Create( + (args[0]).As(static_cast(NULL)), + (args[1]).As(static_cast(NULL)) + ); + } +}; + +#define wxCONSTRUCTOR_2(klass,t0,v0,t1,v1) \ + wxObjectAllocatorAndCreator_2 constructor##klass; \ + wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0), wxT(#v1) }; \ + const int klass::ms_constructorPropertiesCount = 2; + +// direct constructor version + +template +struct wxDirectConstructorBridge_2 : public wxObjectAllocator +{ + bool Create(wxObject * &o, wxAny *args) + { + o = new Class( + (args[0]).As(static_cast(NULL)), + (args[1]).As(static_cast(NULL)) + ); + return o != NULL; + } +}; + +#define wxDIRECT_CONSTRUCTOR_2(klass,t0,v0,t1,v1) \ + wxDirectConstructorBridge_2 constructor##klass; \ + wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0), wxT(#v1) }; \ + const int klass::ms_constructorPropertiesCount = 2; + + +// 3 params + +template +struct wxObjectAllocatorAndCreator_3 : public wxObjectAllocatorAndCreator +{ + bool Create(wxObject * &o, wxAny *args) + { + Class *obj = wx_dynamic_cast(Class*, o); + return obj->Create( + (args[0]).As(static_cast(NULL)), + (args[1]).As(static_cast(NULL)), + (args[2]).As(static_cast(NULL)) + ); + } +}; + +#define wxCONSTRUCTOR_3(klass,t0,v0,t1,v1,t2,v2) \ + wxObjectAllocatorAndCreator_3 constructor##klass; \ + wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0), wxT(#v1), wxT(#v2) }; \ + const int klass::ms_constructorPropertiesCount = 3; + +// direct constructor version + +template +struct wxDirectConstructorBridge_3 : public wxObjectAllocator +{ + bool Create(wxObject * &o, wxAny *args) + { + o = new Class( + (args[0]).As(static_cast(NULL)), + (args[1]).As(static_cast(NULL)), + (args[2]).As(static_cast(NULL)) + ); + return o != NULL; + } +}; + +#define wxDIRECT_CONSTRUCTOR_3(klass,t0,v0,t1,v1,t2,v2) \ + wxDirectConstructorBridge_3 constructor##klass; \ + wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0), wxT(#v1), wxT(#v2) }; \ + const int klass::ms_constructorPropertiesCount = 3; + + +// 4 params + +template +struct wxObjectAllocatorAndCreator_4 : public wxObjectAllocatorAndCreator +{ + bool Create(wxObject * &o, wxAny *args) + { + Class *obj = wx_dynamic_cast(Class*, o); + return obj->Create( + (args[0]).As(static_cast(NULL)), + (args[1]).As(static_cast(NULL)), + (args[2]).As(static_cast(NULL)), + (args[3]).As(static_cast(NULL)) + ); + } +}; + +#define wxCONSTRUCTOR_4(klass,t0,v0,t1,v1,t2,v2,t3,v3) \ + wxObjectAllocatorAndCreator_4 constructor##klass; \ + wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \ + const wxChar *klass::ms_constructorProperties[] = \ + { wxT(#v0), wxT(#v1), wxT(#v2), wxT(#v3) }; \ + const int klass::ms_constructorPropertiesCount = 4; + +// direct constructor version + +template +struct wxDirectConstructorBridge_4 : public wxObjectAllocator +{ + bool Create(wxObject * &o, wxAny *args) + { + o = new Class( + (args[0]).As(static_cast(NULL)), + (args[1]).As(static_cast(NULL)), + (args[2]).As(static_cast(NULL)), + (args[3]).As(static_cast(NULL)) + ); + return o != NULL; + } +}; + +#define wxDIRECT_CONSTRUCTOR_4(klass,t0,v0,t1,v1,t2,v2,t3,v3) \ + wxDirectConstructorBridge_4 constructor##klass; \ + wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \ + const wxChar *klass::ms_constructorProperties[] = \ + { wxT(#v0), wxT(#v1), wxT(#v2), wxT(#v3) }; \ + const int klass::ms_constructorPropertiesCount = 4; + + +// 5 params + +template +struct wxObjectAllocatorAndCreator_5 : public wxObjectAllocatorAndCreator +{ + bool Create(wxObject * &o, wxAny *args) + { + Class *obj = wx_dynamic_cast(Class*, o); + return obj->Create( + (args[0]).As(static_cast(NULL)), + (args[1]).As(static_cast(NULL)), + (args[2]).As(static_cast(NULL)), + (args[3]).As(static_cast(NULL)), + (args[4]).As(static_cast(NULL)) + ); + } +}; + +#define wxCONSTRUCTOR_5(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4) \ + wxObjectAllocatorAndCreator_5 constructor##klass; \ + wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \ + const wxChar *klass::ms_constructorProperties[] = \ + { wxT(#v0), wxT(#v1), wxT(#v2), wxT(#v3), wxT(#v4) }; \ + const int klass::ms_constructorPropertiesCount = 5; + +// direct constructor version + +template +struct wxDirectConstructorBridge_5 : public wxObjectAllocator +{ + bool Create(wxObject * &o, wxAny *args) + { + o = new Class( + (args[0]).As(static_cast(NULL)), + (args[1]).As(static_cast(NULL)), + (args[2]).As(static_cast(NULL)), + (args[3]).As(static_cast(NULL)), + (args[4]).As(static_cast(NULL)) + ); + return o != NULL; + } +}; + +#define wxDIRECT_CONSTRUCTOR_5(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4) \ + wxDirectConstructorBridge_5 constructor##klass; \ + wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \ + const wxChar *klass::ms_constructorProperties[] = \ + { wxT(#v0), wxT(#v1), wxT(#v2), wxT(#v3), wxT(#v4) }; \ + const int klass::ms_constructorPropertiesCount = 5; + + +// 6 params + +template +struct wxObjectAllocatorAndCreator_6 : public wxObjectAllocatorAndCreator +{ + bool Create(wxObject * &o, wxAny *args) + { + Class *obj = wx_dynamic_cast(Class*, o); + return obj->Create( + (args[0]).As(static_cast(NULL)), + (args[1]).As(static_cast(NULL)), + (args[2]).As(static_cast(NULL)), + (args[3]).As(static_cast(NULL)), + (args[4]).As(static_cast(NULL)), + (args[5]).As(static_cast(NULL)) + ); + } +}; + +#define wxCONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \ + wxObjectAllocatorAndCreator_6 constructor##klass; \ + wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \ + const wxChar *klass::ms_constructorProperties[] = \ + { wxT(#v0), wxT(#v1), wxT(#v2), wxT(#v3), wxT(#v4), wxT(#v5) }; \ + const int klass::ms_constructorPropertiesCount = 6; + +// direct constructor version + +template +struct wxDirectConstructorBridge_6 : public wxObjectAllocator +{ + bool Create(wxObject * &o, wxAny *args) + { + o = new Class( + (args[0]).As(static_cast(NULL)), + (args[1]).As(static_cast(NULL)), + (args[2]).As(static_cast(NULL)), + (args[3]).As(static_cast(NULL)), + (args[4]).As(static_cast(NULL)), + (args[5]).As(static_cast(NULL)) + ); + return o != NULL; + } +}; + +#define wxDIRECT_CONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \ + wxDirectConstructorBridge_6 constructor##klass; \ + wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0), wxT(#v1), \ + wxT(#v2), wxT(#v3), wxT(#v4), wxT(#v5) }; \ + const int klass::ms_constructorPropertiesCount = 6; + + +// 7 params + +template +struct wxObjectAllocatorAndCreator_7 : public wxObjectAllocatorAndCreator +{ + bool Create(wxObject * &o, wxAny *args) + { + Class *obj = wx_dynamic_cast(Class*, o); + return obj->Create( + (args[0]).As(static_cast(NULL)), + (args[1]).As(static_cast(NULL)), + (args[2]).As(static_cast(NULL)), + (args[3]).As(static_cast(NULL)), + (args[4]).As(static_cast(NULL)), + (args[5]).As(static_cast(NULL)), + (args[6]).As(static_cast(NULL)) + ); + } +}; + +#define wxCONSTRUCTOR_7(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6) \ + wxObjectAllocatorAndCreator_7 constructor##klass; \ + wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \ + const wxChar *klass::ms_constructorProperties[] = { wxT(#v0), wxT(#v1), \ + wxT(#v2), wxT(#v3), wxT(#v4), wxT(#v5), wxT(#v6) }; \ + const int klass::ms_constructorPropertiesCount = 7; + +// direct constructor version + +template +struct wxDirectConstructorBridge_7 : public wxObjectAllocator +{ + bool Create(wxObject * &o, wxAny *args) + { + o = new Class( + (args[0]).As(static_cast(NULL)), + (args[1]).As(static_cast(NULL)), + (args[2]).As(static_cast(NULL)), + (args[3]).As(static_cast(NULL)), + (args[4]).As(static_cast(NULL)), + (args[5]).As(static_cast(NULL)), + (args[6]).As(static_cast(NULL)) + ); + return o != NULL; + } +}; + +#define wxDIRECT_CONSTRUCTOR_7(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6) \ + wxDirectConstructorBridge_7 constructor##klass; \ + wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \ + const wxChar *klass::ms_constructorProperties[] = \ + { wxT(#v0), wxT(#v1), wxT(#v2), wxT(#v3), wxT(#v4), wxT(#v5), wxT(#v6) }; \ + const int klass::ms_constructorPropertiesCount = 7; + + +// 8 params + +template +struct wxObjectAllocatorAndCreator_8 : public wxObjectAllocatorAndCreator +{ + bool Create(wxObject * &o, wxAny *args) + { + Class *obj = wx_dynamic_cast(Class*, o); + return obj->Create( + (args[0]).As(static_cast(NULL)), + (args[1]).As(static_cast(NULL)), + (args[2]).As(static_cast(NULL)), + (args[3]).As(static_cast(NULL)), + (args[4]).As(static_cast(NULL)), + (args[5]).As(static_cast(NULL)), + (args[6]).As(static_cast(NULL)), + (args[7]).As(static_cast(NULL)) + ); + } +}; + +#define wxCONSTRUCTOR_8(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7) \ + wxObjectAllocatorAndCreator_8 constructor##klass; \ + wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \ + const wxChar *klass::ms_constructorProperties[] = \ + { wxT(#v0), wxT(#v1), wxT(#v2), wxT(#v3), wxT(#v4), wxT(#v5), wxT(#v6), wxT(#v7) }; \ + const int klass::ms_constructorPropertiesCount = 8; + +// direct constructor version + +template +struct wxDirectConstructorBridge_8 : public wxObjectAllocator +{ + bool Create(wxObject * &o, wxAny *args) + { + o = new Class( + (args[0]).As(static_cast(NULL)), + (args[1]).As(static_cast(NULL)), + (args[2]).As(static_cast(NULL)), + (args[3]).As(static_cast(NULL)), + (args[4]).As(static_cast(NULL)), + (args[5]).As(static_cast(NULL)), + (args[6]).As(static_cast(NULL)), + (args[7]).As(static_cast(NULL)) + ); + return o != NULL; + } +}; + +#define wxDIRECT_CONSTRUCTOR_8(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7) \ + wxDirectConstructorBridge_8 constructor##klass; \ + wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \ + const wxChar *klass::ms_constructorProperties[] = \ + { wxT(#v0), wxT(#v1), wxT(#v2), wxT(#v3), wxT(#v4), wxT(#v5), wxT(#v6), wxT(#v7) }; \ + const int klass::ms_constructorPropertiesCount = 8; + +#endif // wxUSE_EXTENDED_RTTI +#endif // _XTICTOR_H_ diff --git a/lib/wxWidgets/include/wx/xtihandler.h b/lib/wxWidgets/include/wx/xtihandler.h new file mode 100644 index 0000000..c63ddb3 --- /dev/null +++ b/lib/wxWidgets/include/wx/xtihandler.h @@ -0,0 +1,112 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xtihandler.h +// Purpose: XTI handlers +// Author: Stefan Csomor +// Modified by: Francesco Montorsi +// Created: 27/07/03 +// Copyright: (c) 1997 Julian Smart +// (c) 2003 Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _XTIHANDLER_H_ +#define _XTIHANDLER_H_ + +#include "wx/defs.h" + +#if wxUSE_EXTENDED_RTTI + +#include "wx/xti.h" + +// copied from event.h which cannot be included at this place + +class WXDLLIMPEXP_FWD_BASE wxEvent; + +#ifdef __VISUALC__ +#define wxMSVC_FWD_MULTIPLE_BASES __multiple_inheritance +#else +#define wxMSVC_FWD_MULTIPLE_BASES +#endif + +class WXDLLIMPEXP_FWD_BASE wxMSVC_FWD_MULTIPLE_BASES wxEvtHandler; +typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&); +typedef wxEventFunction wxObjectEventFunction; + +// ---------------------------------------------------------------------------- +// Handler Info +// +// this describes an event sink +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxHandlerInfo +{ + friend class WXDLLIMPEXP_BASE wxDynamicClassInfo; + +public: + wxHandlerInfo(wxHandlerInfo* &iter, + wxClassInfo* itsClass, + const wxString& name, + wxObjectEventFunction address, + const wxClassInfo* eventClassInfo) : + m_eventFunction(address), + m_name(name), + m_eventClassInfo(eventClassInfo), + m_itsClass(itsClass) + { + Insert(iter); + } + + ~wxHandlerInfo() + { Remove(); } + + // return the name of this handler + const wxString& GetName() const { return m_name; } + + // return the class info of the event + const wxClassInfo *GetEventClassInfo() const { return m_eventClassInfo; } + + // get the handler function pointer + wxObjectEventFunction GetEventFunction() const { return m_eventFunction; } + + // returns NULL if this is the last handler of this class + wxHandlerInfo* GetNext() const { return m_next; } + + // return the class this property is declared in + const wxClassInfo* GetDeclaringClass() const { return m_itsClass; } + +private: + + // inserts this handler at the end of the linked chain which begins + // with "iter" handler. + void Insert(wxHandlerInfo* &iter); + + // removes this handler from the linked chain of the m_itsClass handlers. + void Remove(); + + wxObjectEventFunction m_eventFunction; + wxString m_name; + const wxClassInfo* m_eventClassInfo; + wxHandlerInfo* m_next; + wxClassInfo* m_itsClass; +}; + +#define wxHANDLER(name,eventClassType) \ + static wxHandlerInfo _handlerInfo##name( first, class_t::GetClassInfoStatic(), \ + wxT(#name), (wxObjectEventFunction) (wxEventFunction) &name, \ + wxCLASSINFO( eventClassType ) ); + +#define wxBEGIN_HANDLERS_TABLE(theClass) \ + wxHandlerInfo *theClass::GetHandlersStatic() \ + { \ + typedef theClass class_t; \ + static wxHandlerInfo* first = NULL; + +#define wxEND_HANDLERS_TABLE() \ + return first; } + +#define wxEMPTY_HANDLERS_TABLE(theClass) \ + wxBEGIN_HANDLERS_TABLE(theClass) \ + wxEND_HANDLERS_TABLE() + +#endif // wxUSE_EXTENDED_RTTI +#endif // _XTIHANDLER_H_ diff --git a/lib/wxWidgets/include/wx/xtiprop.h b/lib/wxWidgets/include/wx/xtiprop.h new file mode 100644 index 0000000..d0d2003 --- /dev/null +++ b/lib/wxWidgets/include/wx/xtiprop.h @@ -0,0 +1,556 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xtiprop.h +// Purpose: XTI properties +// Author: Stefan Csomor +// Modified by: Francesco Montorsi +// Created: 27/07/03 +// Copyright: (c) 1997 Julian Smart +// (c) 2003 Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _XTIPROP_H_ +#define _XTIPROP_H_ + +#include "wx/defs.h" + +#if wxUSE_EXTENDED_RTTI + +#include "wx/xti.h" +#include "wx/any.h" + +/* +class WXDLLIMPEXP_BASE wxObject; +class WXDLLIMPEXP_BASE wxClassInfo; +class WXDLLIMPEXP_BASE wxDynamicClassInfo; +*/ +class WXDLLIMPEXP_BASE wxHashTable; +class WXDLLIMPEXP_BASE wxHashTable_Node; +class WXDLLIMPEXP_BASE wxEvent; +class WXDLLIMPEXP_BASE wxEvtHandler; + +// ---------------------------------------------------------------------------- +// Property Accessors +// +// wxPropertySetter/Getter/CollectionGetter/CollectionAdder are all property +// accessors which are managed by wxPropertyAccessor class which in turn is +// handled by wxPropertyInfo. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxPropertySetter +{ +public: + wxPropertySetter( const wxString name ) { m_name = name; } + virtual ~wxPropertySetter() {} + + virtual void Set( wxObject *object, const wxAny &variantValue ) const = 0; + const wxString& GetName() const { return m_name; } + +private: + wxString m_name; +}; + +class WXDLLIMPEXP_BASE wxPropertyGetter +{ +public: + wxPropertyGetter( const wxString name ) { m_name = name; } + virtual ~wxPropertyGetter() {} + + virtual void Get( const wxObject *object, wxAny& result) const = 0; + const wxString& GetName() const { return m_name; } + +private: + wxString m_name; +}; + +class WXDLLIMPEXP_BASE wxPropertyCollectionGetter +{ +public: + wxPropertyCollectionGetter( const wxString name ) { m_name = name; } + virtual ~wxPropertyCollectionGetter() {} + + virtual void Get( const wxObject *object, wxAnyList& result) const = 0; + const wxString& GetName() const { return m_name; } + +private: + wxString m_name; +}; + +template void WXDLLIMPEXP_BASE \ + wxCollectionToVariantArray( const coll_t& coll, wxAnyList& result ); + +class WXDLLIMPEXP_BASE wxPropertyCollectionAdder +{ +public: + wxPropertyCollectionAdder( const wxString name ) { m_name = name; } + virtual ~wxPropertyCollectionAdder() {} + + virtual void Add( wxObject *object, const wxAny &variantValue ) const= 0; + const wxString& GetName() const { return m_name; } + +private: + wxString m_name; +}; + +#define wxPROPERTY_SETTER( property, Klass, valueType, setterMethod ) \ +class wxPropertySetter##property : public wxPropertySetter \ +{ \ +public: \ + wxPropertySetter##property() : wxPropertySetter( wxT(#setterMethod) ) {} \ + virtual ~wxPropertySetter##property() {} \ + \ + void Set( wxObject *object, const wxAny &variantValue ) const \ + { \ + Klass *obj = dynamic_cast(object); \ + valueType tempobj; \ + if ( variantValue.GetAs(&tempobj) ) \ + obj->setterMethod(tempobj); \ + else \ + obj->setterMethod(*variantValue.As()); \ + } \ +}; + +#define wxPROPERTY_GETTER( property, Klass, valueType, gettermethod ) \ +class wxPropertyGetter##property : public wxPropertyGetter \ +{ \ +public: \ + wxPropertyGetter##property() : wxPropertyGetter( wxT(#gettermethod) ) {} \ + virtual ~wxPropertyGetter##property() {} \ + \ + void Get( const wxObject *object, wxAny &result) const \ + { \ + const Klass *obj = dynamic_cast(object); \ + result = wxAny( obj->gettermethod() ); \ + } \ +}; + +#define wxPROPERTY_COLLECTION_ADDER( property, Klass, valueType, addermethod ) \ +class wxPropertyCollectionAdder##property : public wxPropertyCollectionAdder \ +{ \ +public: \ + wxPropertyCollectionAdder##property() : wxPropertyCollectionAdder( wxT(#addermethod) ) {} \ + virtual ~wxPropertyCollectionAdder##property() {} \ + \ + void Add( wxObject *object, const wxAny &variantValue ) const \ + { \ + Klass *obj = dynamic_cast(object); \ + valueType tempobj; \ + if ( variantValue.GetAs(&tempobj) ) \ + obj->addermethod(tempobj); \ + else \ + obj->addermethod(*variantValue.As()); \ + } \ +}; + +#define wxPROPERTY_COLLECTION_GETTER( property, Klass, valueType, gettermethod ) \ +class wxPropertyCollectionGetter##property : public wxPropertyCollectionGetter \ +{ \ +public: \ + wxPropertyCollectionGetter##property() : wxPropertyCollectionGetter( wxT(#gettermethod) ) {} \ + virtual ~wxPropertyCollectionGetter##property() {} \ + \ + void Get( const wxObject *object, wxAnyList &result) const \ + { \ + const Klass *obj = dynamic_cast(object); \ + wxCollectionToVariantArray( obj->gettermethod(), result ); \ + } \ +}; + +class WXDLLIMPEXP_BASE wxPropertyAccessor +{ +public: + wxPropertyAccessor( wxPropertySetter *setter, wxPropertyGetter *getter, + wxPropertyCollectionAdder *adder, wxPropertyCollectionGetter *collectionGetter ) + { m_setter = setter; m_getter = getter; m_adder = adder; + m_collectionGetter = collectionGetter; } + + virtual ~wxPropertyAccessor() {} + + // Setting a simple property (non-collection) + virtual void SetProperty(wxObject *object, const wxAny &value) const + { + if ( m_setter ) + m_setter->Set( object, value ); + else + wxLogError( wxGetTranslation("SetProperty called w/o valid setter") ); + } + + // Getting a simple property (non-collection) + virtual void GetProperty(const wxObject *object, wxAny &result) const + { + if ( m_getter ) + m_getter->Get( object, result ); + else + wxLogError( wxGetTranslation("GetProperty called w/o valid getter") ); + } + + // Adding an element to a collection property + virtual void AddToPropertyCollection(wxObject *object, const wxAny &value) const + { + if ( m_adder ) + m_adder->Add( object, value ); + else + wxLogError( wxGetTranslation("AddToPropertyCollection called w/o valid adder") ); + } + + // Getting a collection property + virtual void GetPropertyCollection( const wxObject *obj, wxAnyList &result) const + { + if ( m_collectionGetter ) + m_collectionGetter->Get( obj, result); + else + wxLogError( wxGetTranslation("GetPropertyCollection called w/o valid collection getter") ); + } + + virtual bool HasSetter() const { return m_setter != NULL; } + virtual bool HasCollectionGetter() const { return m_collectionGetter != NULL; } + virtual bool HasGetter() const { return m_getter != NULL; } + virtual bool HasAdder() const { return m_adder != NULL; } + + virtual const wxString& GetCollectionGetterName() const + { return m_collectionGetter->GetName(); } + virtual const wxString& GetGetterName() const + { return m_getter->GetName(); } + virtual const wxString& GetSetterName() const + { return m_setter->GetName(); } + virtual const wxString& GetAdderName() const + { return m_adder->GetName(); } + +protected: + wxPropertySetter *m_setter; + wxPropertyCollectionAdder *m_adder; + wxPropertyGetter *m_getter; + wxPropertyCollectionGetter* m_collectionGetter; +}; + +class WXDLLIMPEXP_BASE wxGenericPropertyAccessor : public wxPropertyAccessor +{ +public: + wxGenericPropertyAccessor( const wxString &propName ); + virtual ~wxGenericPropertyAccessor(); + + void RenameProperty( const wxString& WXUNUSED_UNLESS_DEBUG(oldName), + const wxString& newName ) + { + wxASSERT( oldName == m_propertyName ); m_propertyName = newName; + } + + virtual bool HasSetter() const { return true; } + virtual bool HasGetter() const { return true; } + virtual bool HasAdder() const { return false; } + virtual bool HasCollectionGetter() const { return false; } + + virtual const wxString& GetGetterName() const + { return m_getterName; } + virtual const wxString& GetSetterName() const + { return m_setterName; } + + virtual void SetProperty(wxObject *object, const wxAny &value) const; + virtual void GetProperty(const wxObject *object, wxAny &value) const; + + // Adding an element to a collection property + virtual void AddToPropertyCollection(wxObject *WXUNUSED(object), + const wxAny &WXUNUSED(value)) const + { + wxLogError( wxGetTranslation("AddToPropertyCollection called on a generic accessor") ); + } + + // Getting a collection property + virtual void GetPropertyCollection( const wxObject *WXUNUSED(obj), + wxAnyList &WXUNUSED(result)) const + { + wxLogError ( wxGetTranslation("GetPropertyCollection called on a generic accessor") ); + } + +private: + struct wxGenericPropertyAccessorInternal; + wxGenericPropertyAccessorInternal* m_data; + wxString m_propertyName; + wxString m_setterName; + wxString m_getterName; +}; + +typedef long wxPropertyInfoFlags; +enum +{ + // will be removed in future releases + wxPROP_DEPRECATED = 0x00000001, + + // object graph property, will be streamed with priority (after constructor properties) + wxPROP_OBJECT_GRAPH = 0x00000002, + + // this will only be streamed out and in as enum/set, the internal representation + // is still a long + wxPROP_ENUM_STORE_LONG = 0x00000004, + + // don't stream out this property, needed eg to avoid streaming out children + // that are always created by their parents + wxPROP_DONT_STREAM = 0x00000008 +}; + + +// ---------------------------------------------------------------------------- +// Property Support +// +// wxPropertyInfo is used to inquire of the property by name. It doesn't +// provide access to the property, only information about it. If you +// want access, look at wxPropertyAccessor. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxPropertyInfo +{ + friend class /* WXDLLIMPEXP_BASE */ wxDynamicClassInfo; + +public: + wxPropertyInfo(wxPropertyInfo* &iter, + wxClassInfo* itsClass, + const wxString& name, + const wxString& typeName, + wxPropertyAccessor *accessor, + wxAny dv, + wxPropertyInfoFlags flags = 0, + const wxString& helpString = wxEmptyString, + const wxString& groupString = wxEmptyString) : + m_itsClass(itsClass), + m_name(name), + m_typeInfo(NULL), + m_typeName(typeName), + m_collectionElementTypeInfo(NULL), + m_accessor(accessor), + m_defaultValue(dv), + m_flags(flags), + m_helpString(helpString), + m_groupString(groupString) + { + Insert(iter); + } + + wxPropertyInfo(wxPropertyInfo* &iter, + wxClassInfo* itsClass, + const wxString& name, + wxEventSourceTypeInfo* type, + wxPropertyAccessor *accessor, + wxAny dv, + wxPropertyInfoFlags flags = 0, + const wxString& helpString = wxEmptyString, + const wxString& groupString = wxEmptyString) : + m_itsClass(itsClass), + m_name(name), + m_typeInfo(type), + m_collectionElementTypeInfo(NULL), + m_accessor(accessor), + m_defaultValue(dv), + m_flags(flags), + m_helpString(helpString), + m_groupString(groupString) + { + Insert(iter); + } + + wxPropertyInfo(wxPropertyInfo* &iter, + wxClassInfo* itsClass, const wxString& name, + const wxString& collectionTypeName, + const wxString& elementTypeName, + wxPropertyAccessor *accessor, + wxPropertyInfoFlags flags = 0, + const wxString& helpString = wxEmptyString, + const wxString& groupString = wxEmptyString) : + m_itsClass(itsClass), + m_name(name), + m_typeInfo(NULL), + m_typeName(collectionTypeName), + m_collectionElementTypeInfo(NULL), + m_collectionElementTypeName(elementTypeName), + m_accessor(accessor), + m_flags(flags), + m_helpString(helpString), + m_groupString(groupString) + { + Insert(iter); + } + + ~wxPropertyInfo() + { Remove(); } + + // return the class this property is declared in + const wxClassInfo* GetDeclaringClass() const { return m_itsClass; } + + // return the name of this property + const wxString& GetName() const { return m_name; } + + // returns the flags of this property + wxPropertyInfoFlags GetFlags() const { return m_flags; } + + // returns the short help string of this property + const wxString& GetHelpString() const { return m_helpString; } + + // returns the group string of this property + const wxString& GetGroupString() const { return m_groupString; } + + // return the element type info of this property (for collections, otherwise NULL) + const wxTypeInfo * GetCollectionElementTypeInfo() const + { + if ( m_collectionElementTypeInfo == NULL ) + m_collectionElementTypeInfo = wxTypeInfo::FindType(m_collectionElementTypeName); + return m_collectionElementTypeInfo; + } + + // return the type info of this property + const wxTypeInfo * GetTypeInfo() const + { + if ( m_typeInfo == NULL ) + m_typeInfo = wxTypeInfo::FindType(m_typeName); + return m_typeInfo; + } + + // return the accessor for this property + wxPropertyAccessor* GetAccessor() const { return m_accessor; } + + // returns NULL if this is the last property of this class + wxPropertyInfo* GetNext() const { return m_next; } + + // returns the default value of this property, its kind may be wxT_VOID if it is not valid + wxAny GetDefaultValue() const { return m_defaultValue; } + +private: + + // inserts this property at the end of the linked chain which begins + // with "iter" property. + void Insert(wxPropertyInfo* &iter); + + // removes this property from the linked chain of the m_itsClass properties. + void Remove(); + + wxClassInfo* m_itsClass; + wxString m_name; + mutable wxTypeInfo* m_typeInfo; + wxString m_typeName; + mutable wxTypeInfo* m_collectionElementTypeInfo; + wxString m_collectionElementTypeName; + wxPropertyAccessor* m_accessor; + wxAny m_defaultValue; + wxPropertyInfoFlags m_flags; + wxString m_helpString; + wxString m_groupString; + wxPropertyInfo* m_next; + + // FIXME: what's this comment about?? + // string representation of the default value + // to be assigned by the designer to the property + // when the component is dropped on the container. +}; + +// stl is giving problems when forwarding declarations, therefore we define it as a subclass + +WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxPropertyInfo*, wxPropertyInfoMapBase, + class WXDLLIMPEXP_BASE ); + +class WXDLLIMPEXP_BASE wxPropertyInfoMap : public wxPropertyInfoMapBase { +}; + +WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxAny, wxStringToAnyHashMapBase, + class WXDLLIMPEXP_BASE ); + +class WXDLLIMPEXP_FWD_BASE wxStringToAnyHashMap : public wxStringToAnyHashMapBase { +}; + +#define wxBEGIN_PROPERTIES_TABLE(theClass) \ + wxPropertyInfo *theClass::GetPropertiesStatic() \ + { \ + typedef theClass class_t; \ + static wxPropertyInfo* first = NULL; + +#define wxEND_PROPERTIES_TABLE() \ + return first; } + +#define wxHIDE_PROPERTY( pname ) \ + static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \ + wxT(#pname), typeid(void).name(), NULL, wxAny(), wxPROP_DONT_STREAM, \ + wxEmptyString, wxEmptyString ); + +#define wxPROPERTY( pname, type, setter, getter, defaultValue, flags, help, group) \ + wxPROPERTY_SETTER( pname, class_t, type, setter ) \ + static wxPropertySetter##pname _setter##pname; \ + wxPROPERTY_GETTER( pname, class_t, type, getter ) \ + static wxPropertyGetter##pname _getter##pname; \ + static wxPropertyAccessor _accessor##pname( &_setter##pname, \ + &_getter##pname, NULL, NULL ); \ + static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \ + wxT(#pname), typeid(type).name(), &_accessor##pname, \ + wxAny(defaultValue), flags, group, help ); + +#define wxPROPERTY_FLAGS( pname, flags, type, setter, getter,defaultValue, \ + pflags, help, group) \ + wxPROPERTY_SETTER( pname, class_t, type, setter ) \ + static wxPropertySetter##pname _setter##pname; \ + wxPROPERTY_GETTER( pname, class_t, type, getter ) \ + static wxPropertyGetter##pname _getter##pname; \ + static wxPropertyAccessor _accessor##pname( &_setter##pname, \ + &_getter##pname, NULL, NULL ); \ + static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \ + wxT(#pname), typeid(flags).name(), &_accessor##pname, \ + wxAny(defaultValue), wxPROP_ENUM_STORE_LONG | pflags, help, group ); + +#define wxREADONLY_PROPERTY( pname, type, getter,defaultValue, flags, help, group) \ + wxPROPERTY_GETTER( pname, class_t, type, getter ) \ + static wxPropertyGetter##pname _getter##pname; \ + static wxPropertyAccessor _accessor##pname( NULL, &_getter##pname, NULL, NULL ); \ + static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \ + wxT(#pname), typeid(type).name(),&_accessor##pname, \ + wxAny(defaultValue), flags, help, group ); + +#define wxREADONLY_PROPERTY_FLAGS( pname, flags, type, getter,defaultValue, \ + pflags, help, group) \ + wxPROPERTY_GETTER( pname, class_t, type, getter ) \ + static wxPropertyGetter##pname _getter##pname; \ + static wxPropertyAccessor _accessor##pname( NULL, &_getter##pname, NULL, NULL ); \ + static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \ + wxT(#pname), typeid(flags).name(),&_accessor##pname, \ + wxAny(defaultValue), wxPROP_ENUM_STORE_LONG | pflags, help, group ); + +#define wxPROPERTY_COLLECTION( pname, colltype, addelemtype, adder, getter, \ + flags, help, group ) \ + wxPROPERTY_COLLECTION_ADDER( pname, class_t, addelemtype, adder ) \ + static wxPropertyCollectionAdder##pname _adder##pname; \ + wxPROPERTY_COLLECTION_GETTER( pname, class_t, colltype, getter ) \ + static wxPropertyCollectionGetter##pname _collectionGetter##pname; \ + static wxPropertyAccessor _accessor##pname( NULL, NULL,&_adder##pname, \ + &_collectionGetter##pname ); \ + static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \ + wxT(#pname), typeid(colltype).name(),typeid(addelemtype).name(), \ + &_accessor##pname, flags, help, group ); + +#define wxREADONLY_PROPERTY_COLLECTION( pname, colltype, addelemtype, getter, \ + flags, help, group) \ + wxPROPERTY_COLLECTION_GETTER( pname, class_t, colltype, getter ) \ + static wxPropertyCollectionGetter##pname _collectionGetter##pname; \ + static wxPropertyAccessor _accessor##pname( NULL, NULL, NULL, \ + &_collectionGetter##pname ); \ + static wxPropertyInfo _propertyInfo##pname( first,class_t::GetClassInfoStatic(), \ + wxT(#pname), typeid(colltype).name(),typeid(addelemtype).name(), \ + &_accessor##pname, flags, help, group ); + +#define wxEVENT_PROPERTY( name, eventType, eventClass ) \ + static wxEventSourceTypeInfo _typeInfo##name( eventType, wxCLASSINFO( eventClass ) ); \ + static wxPropertyInfo _propertyInfo##name( first,class_t::GetClassInfoStatic(), \ + wxT(#name), &_typeInfo##name, NULL, wxAny() ); + +#define wxEVENT_RANGE_PROPERTY( name, eventType, lastEventType, eventClass ) \ + static wxEventSourceTypeInfo _typeInfo##name( eventType, lastEventType, \ + wxCLASSINFO( eventClass ) ); \ + static wxPropertyInfo _propertyInfo##name( first, class_t::GetClassInfoStatic(), \ + wxT(#name), &_typeInfo##name, NULL, wxAny() ); + +// ---------------------------------------------------------------------------- +// Implementation Helper for Simple Properties +// ---------------------------------------------------------------------------- + +#define wxIMPLEMENT_PROPERTY(name, type) \ +private: \ + type m_##name; \ +public: \ + void Set##name( type const & p) { m_##name = p; } \ + type const & Get##name() const { return m_##name; } + +#endif // wxUSE_EXTENDED_RTTI +#endif // _XTIPROP_H_ diff --git a/lib/wxWidgets/include/wx/xtistrm.h b/lib/wxWidgets/include/wx/xtistrm.h new file mode 100644 index 0000000..c0d0356 --- /dev/null +++ b/lib/wxWidgets/include/wx/xtistrm.h @@ -0,0 +1,408 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xtistrm.h +// Purpose: streaming runtime metadata information (extended class info) +// Author: Stefan Csomor +// Modified by: +// Created: 27/07/03 +// Copyright: (c) 2003 Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XTISTRMH__ +#define _WX_XTISTRMH__ + +#include "wx/defs.h" + +#if wxUSE_EXTENDED_RTTI + +#include "wx/object.h" + +const int wxInvalidObjectID = -2; +const int wxNullObjectID = -3; + +// Filer contains the interfaces for streaming objects in and out of XML, +// rendering them either to objects in memory, or to code. Note: We +// consider the process of generating code to be one of *depersisting* the +// object from xml, *not* of persisting the object to code from an object +// in memory. This distinction can be confusing, and should be kept +// in mind when looking at the property streamers and callback interfaces +// listed below. + + +// ---------------------------------------------------------------------------- +// wxObjectWriterCallback +// +// This class will be asked during the streaming-out process about every single +// property or object instance. It can veto streaming out by returning false +// or modify the value before it is streamed-out. +// ---------------------------------------------------------------------------- + +/* + class WXDLLIMPEXP_BASE wxClassInfo; + class WXDLLIMPEXP_BASE wxAnyList; + class WXDLLIMPEXP_BASE wxPropertyInfo; + class WXDLLIMPEXP_BASE wxAny; + class WXDLLIMPEXP_BASE wxHandlerInfo; + */ + +class WXDLLIMPEXP_BASE wxObjectWriter; +class WXDLLIMPEXP_BASE wxObjectReader; + +class WXDLLIMPEXP_BASE wxObjectWriterCallback +{ +public: + virtual ~wxObjectWriterCallback() {} + + // will be called before an object is written, may veto by returning false + virtual bool BeforeWriteObject( wxObjectWriter *WXUNUSED(writer), + const wxObject *WXUNUSED(object), + const wxClassInfo *WXUNUSED(classInfo), + const wxStringToAnyHashMap &WXUNUSED(metadata)) + { return true; } + + // will be called after this object has been written, may be + // needed for adjusting stacks + virtual void AfterWriteObject( wxObjectWriter *WXUNUSED(writer), + const wxObject *WXUNUSED(object), + const wxClassInfo *WXUNUSED(classInfo) ) + {} + + // will be called before a property gets written, may change the value, + // eg replace a concrete wxSize by wxSize( wxDefaultCoord, wxDefaultCoord ) + // or veto writing that property at all by returning false + virtual bool BeforeWriteProperty( wxObjectWriter *WXUNUSED(writer), + const wxObject *WXUNUSED(object), + const wxPropertyInfo *WXUNUSED(propInfo), + const wxAny &WXUNUSED(value) ) + { return true; } + + // will be called before a property gets written, may change the value, + // eg replace a concrete wxSize by wxSize( wxDefaultCoord, wxDefaultCoord ) + // or veto writing that property at all by returning false + virtual bool BeforeWriteProperty( wxObjectWriter *WXUNUSED(writer), + const wxObject *WXUNUSED(object), + const wxPropertyInfo *WXUNUSED(propInfo), + const wxAnyList &WXUNUSED(value) ) + { return true; } + + // will be called after a property has been written out, may be needed + // for adjusting stacks + virtual void AfterWriteProperty( wxObjectWriter *WXUNUSED(writer), + const wxPropertyInfo *WXUNUSED(propInfo) ) + {} + + // will be called before this delegate gets written + virtual bool BeforeWriteDelegate( wxObjectWriter *WXUNUSED(writer), + const wxObject *WXUNUSED(object), + const wxClassInfo* WXUNUSED(classInfo), + const wxPropertyInfo *WXUNUSED(propInfo), + const wxObject *&WXUNUSED(eventSink), + const wxHandlerInfo* &WXUNUSED(handlerInfo) ) + { return true; } + + virtual void AfterWriteDelegate( wxObjectWriter *WXUNUSED(writer), + const wxObject *WXUNUSED(object), + const wxClassInfo* WXUNUSED(classInfo), + const wxPropertyInfo *WXUNUSED(propInfo), + const wxObject *&WXUNUSED(eventSink), + const wxHandlerInfo* &WXUNUSED(handlerInfo) ) + { } +}; + +class WXDLLIMPEXP_BASE wxObjectWriterFunctor: public wxObjectFunctor +{ +}; + +class WXDLLIMPEXP_BASE wxObjectWriter: public wxObject +{ + friend class wxObjectWriterFunctor; +public: + wxObjectWriter(); + virtual ~wxObjectWriter(); + + // with this call you start writing out a new top-level object + void WriteObject(const wxObject *object, const wxClassInfo *classInfo, + wxObjectWriterCallback *writercallback, const wxString &name, + const wxStringToAnyHashMap &metadata); + + // Managing the object identity table a.k.a context + // + // these methods make sure that no object gets written twice, + // because sometimes multiple calls to the WriteObject will be + // made without wanting to have duplicate objects written, the + // object identity table will be reset manually + virtual void ClearObjectContext(); + + // gets the object Id for a passed in object in the context + int GetObjectID(const wxObject *obj); + + // returns true if this object has already been written in this context + bool IsObjectKnown( const wxObject *obj ); + + // + // streaming callbacks + // + // these callbacks really write out the values in the stream format + + // begins writing out a new toplevel entry which has the indicated unique name + virtual void DoBeginWriteTopLevelEntry( const wxString &name ) = 0; + + // ends writing out a new toplevel entry which has the indicated unique name + virtual void DoEndWriteTopLevelEntry( const wxString &name ) = 0; + + // start of writing an object having the passed in ID + virtual void DoBeginWriteObject(const wxObject *object, const wxClassInfo *classInfo, + int objectID, const wxStringToAnyHashMap &metadata ) = 0; + + // end of writing a toplevel object name param is used for unique + // identification within the container + virtual void DoEndWriteObject(const wxObject *object, + const wxClassInfo *classInfo, int objectID ) = 0; + + // writes a simple property in the stream format + virtual void DoWriteSimpleType( const wxAny &value ) = 0; + + // start of writing a complex property into the stream ( + virtual void DoBeginWriteProperty( const wxPropertyInfo *propInfo ) = 0; + + // end of writing a complex property into the stream + virtual void DoEndWriteProperty( const wxPropertyInfo *propInfo ) = 0; + + virtual void DoBeginWriteElement() = 0; + virtual void DoEndWriteElement() = 0; + // insert an object reference to an already written object + virtual void DoWriteRepeatedObject( int objectID ) = 0; + + // insert a null reference + virtual void DoWriteNullObject() = 0; + + // writes a delegate in the stream format + virtual void DoWriteDelegate( const wxObject *object, const wxClassInfo* classInfo, + const wxPropertyInfo *propInfo, const wxObject *eventSink, + int sinkObjectID, const wxClassInfo* eventSinkClassInfo, + const wxHandlerInfo* handlerIndo ) = 0; + + void WriteObject(const wxObject *object, const wxClassInfo *classInfo, + wxObjectWriterCallback *writercallback, bool isEmbedded, const wxStringToAnyHashMap &metadata ); + +protected: + struct wxObjectWriterInternal; + wxObjectWriterInternal* m_data; + + struct wxObjectWriterInternalPropertiesData; + + void WriteAllProperties( const wxObject * obj, const wxClassInfo* ci, + wxObjectWriterCallback *writercallback, + wxObjectWriterInternalPropertiesData * data ); + + void WriteOneProperty( const wxObject *obj, const wxClassInfo* ci, + const wxPropertyInfo* pi, wxObjectWriterCallback *writercallback, + wxObjectWriterInternalPropertiesData *data ); + + + void FindConnectEntry(const wxEvtHandler * evSource, + const wxEventSourceTypeInfo* dti, const wxObject* &sink, + const wxHandlerInfo *&handler); +}; + + +/* +Streaming callbacks for depersisting XML to code, or running objects +*/ + +class WXDLLIMPEXP_BASE wxObjectReaderCallback; + +/* +wxObjectReader handles streaming in a class from an arbitrary format. +While walking through it issues calls out to interfaces to readercallback +the guts from the underlying storage format. +*/ + +class WXDLLIMPEXP_BASE wxObjectReader: public wxObject +{ +public: + wxObjectReader(); + virtual ~wxObjectReader(); + + // the only thing wxObjectReader knows about is the class info by object ID + wxClassInfo *GetObjectClassInfo(int objectID); + bool HasObjectClassInfo( int objectID ); + void SetObjectClassInfo(int objectID, wxClassInfo* classInfo); + + // Reads the component the reader is pointed at from the underlying format. + // The return value is the root object ID, which can + // then be used to ask the depersister about that object + // if there was a problem you will get back wxInvalidObjectID and the current + // error log will carry the problems encountered + virtual int ReadObject( const wxString &name, wxObjectReaderCallback *readercallback ) = 0; + +private: + struct wxObjectReaderInternal; + wxObjectReaderInternal *m_data; +}; + +// This abstract class matches the allocate-init/create model of creation of objects. +// At runtime, these will create actual instances, and manipulate them. +// When generating code, these will just create statements of C++ +// code to create the objects. + +class WXDLLIMPEXP_BASE wxObjectReaderCallback +{ +public: + virtual ~wxObjectReaderCallback() {} + + // allocate the new object on the heap, that object will have the passed in ID + virtual void AllocateObject(int objectID, wxClassInfo *classInfo, + wxStringToAnyHashMap &metadata) = 0; + + // initialize the already allocated object having the ID objectID with the Create method + // creation parameters which are objects are having their Ids passed in objectIDValues + // having objectId <> wxInvalidObjectID + + virtual void CreateObject(int objectID, + const wxClassInfo *classInfo, + int paramCount, + wxAny *VariantValues, + int *objectIDValues, + const wxClassInfo **objectClassInfos, + wxStringToAnyHashMap &metadata) = 0; + + // construct the new object on the heap, that object will have the passed in ID + // (for objects that don't support allocate-create type of creation) + // creation parameters which are objects are having their Ids passed in + // objectIDValues having objectId <> wxInvalidObjectID + + virtual void ConstructObject(int objectID, + const wxClassInfo *classInfo, + int paramCount, + wxAny *VariantValues, + int *objectIDValues, + const wxClassInfo **objectClassInfos, + wxStringToAnyHashMap &metadata) = 0; + + // destroy the heap-allocated object having the ID objectID, this may be used + // if an object is embedded in another object and set via value semantics, + // so the intermediate object can be destroyed after safely + virtual void DestroyObject(int objectID, wxClassInfo *classInfo) = 0; + + // set the corresponding property + virtual void SetProperty(int objectID, + const wxClassInfo *classInfo, + const wxPropertyInfo* propertyInfo, + const wxAny &VariantValue) = 0; + + // sets the corresponding property (value is an object) + virtual void SetPropertyAsObject(int objectID, + const wxClassInfo *classInfo, + const wxPropertyInfo* propertyInfo, + int valueObjectId) = 0; + + // adds an element to a property collection + virtual void AddToPropertyCollection( int objectID, + const wxClassInfo *classInfo, + const wxPropertyInfo* propertyInfo, + const wxAny &VariantValue) = 0; + + // sets the corresponding property (value is an object) + virtual void AddToPropertyCollectionAsObject(int objectID, + const wxClassInfo *classInfo, + const wxPropertyInfo* propertyInfo, + int valueObjectId) = 0; + + // sets the corresponding event handler + virtual void SetConnect(int EventSourceObjectID, + const wxClassInfo *EventSourceClassInfo, + const wxPropertyInfo *delegateInfo, + const wxClassInfo *EventSinkClassInfo, + const wxHandlerInfo* handlerInfo, + int EventSinkObjectID ) = 0; +}; + +/* +wxObjectRuntimeReaderCallback implements the callbacks that will bring back +an object into a life memory instance +*/ + +class WXDLLIMPEXP_BASE wxObjectRuntimeReaderCallback: public wxObjectReaderCallback +{ + struct wxObjectRuntimeReaderCallbackInternal; + wxObjectRuntimeReaderCallbackInternal * m_data; + +public: + wxObjectRuntimeReaderCallback(); + virtual ~wxObjectRuntimeReaderCallback(); + + // returns the object having the corresponding ID fully constructed + wxObject *GetObject(int objectID); + + // allocate the new object on the heap, that object will have the passed in ID + virtual void AllocateObject(int objectID, wxClassInfo *classInfo, + wxStringToAnyHashMap &metadata); + + // initialize the already allocated object having the ID objectID with + // the Create method creation parameters which are objects are having + // their Ids passed in objectIDValues having objectId <> wxInvalidObjectID + + virtual void CreateObject(int objectID, + const wxClassInfo *classInfo, + int paramCount, + wxAny *VariantValues, + int *objectIDValues, + const wxClassInfo **objectClassInfos, + wxStringToAnyHashMap &metadata + ); + + // construct the new object on the heap, that object will have the + // passed in ID (for objects that don't support allocate-create type of + // creation) creation parameters which are objects are having their Ids + // passed in objectIDValues having objectId <> wxInvalidObjectID + + virtual void ConstructObject(int objectID, + const wxClassInfo *classInfo, + int paramCount, + wxAny *VariantValues, + int *objectIDValues, + const wxClassInfo **objectClassInfos, + wxStringToAnyHashMap &metadata); + + // destroy the heap-allocated object having the ID objectID, this may be + // used if an object is embedded in another object and set via value semantics, + // so the intermediate object can be destroyed after safely + virtual void DestroyObject(int objectID, wxClassInfo *classInfo); + + // set the corresponding property + virtual void SetProperty(int objectID, + const wxClassInfo *classInfo, + const wxPropertyInfo* propertyInfo, + const wxAny &variantValue); + + // sets the corresponding property (value is an object) + virtual void SetPropertyAsObject(int objectId, + const wxClassInfo *classInfo, + const wxPropertyInfo* propertyInfo, + int valueObjectId); + + // adds an element to a property collection + virtual void AddToPropertyCollection( int objectID, + const wxClassInfo *classInfo, + const wxPropertyInfo* propertyInfo, + const wxAny &VariantValue); + + // sets the corresponding property (value is an object) + virtual void AddToPropertyCollectionAsObject(int objectID, + const wxClassInfo *classInfo, + const wxPropertyInfo* propertyInfo, + int valueObjectId); + + // sets the corresponding event handler + virtual void SetConnect(int eventSourceObjectID, + const wxClassInfo *eventSourceClassInfo, + const wxPropertyInfo *delegateInfo, + const wxClassInfo *eventSinkClassInfo, + const wxHandlerInfo* handlerInfo, + int eventSinkObjectID ); +}; + +#endif // wxUSE_EXTENDED_RTTI + +#endif diff --git a/lib/wxWidgets/include/wx/xtitypes.h b/lib/wxWidgets/include/wx/xtitypes.h new file mode 100644 index 0000000..c0a1bcc --- /dev/null +++ b/lib/wxWidgets/include/wx/xtitypes.h @@ -0,0 +1,532 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xtitypes.h +// Purpose: enum, set, basic types support +// Author: Stefan Csomor +// Modified by: Francesco Montorsi +// Created: 27/07/03 +// Copyright: (c) 1997 Julian Smart +// (c) 2003 Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _XTITYPES_H_ +#define _XTITYPES_H_ + +#include "wx/defs.h" + +#if wxUSE_EXTENDED_RTTI + +#include "wx/string.h" +#include "wx/hashmap.h" +#include "wx/arrstr.h" +#include "wx/flags.h" +#include "wx/intl.h" +#include "wx/log.h" +#include + +class WXDLLIMPEXP_BASE wxClassInfo; + +// ---------------------------------------------------------------------------- +// Enum Support +// +// In the header files XTI requires no change from pure c++ code, however in the +// implementation, an enum needs to be enumerated e.g.: +// +// wxBEGIN_ENUM( wxFlavor ) +// wxENUM_MEMBER( Vanilla ) +// wxENUM_MEMBER( Chocolate ) +// wxENUM_MEMBER( Strawberry ) +// wxEND_ENUM( wxFlavor ) +// ---------------------------------------------------------------------------- + +struct WXDLLIMPEXP_BASE wxEnumMemberData +{ + const wxChar* m_name; + int m_value; +}; + +class WXDLLIMPEXP_BASE wxEnumData +{ +public: + wxEnumData( wxEnumMemberData* data ); + + // returns true if the member has been found and sets the int value + // pointed to accordingly (if ptr != null ) + // if not found returns false, value left unchanged + bool HasEnumMemberValue( const wxChar *name, int *value = NULL ) const; + + // returns the value of the member, if not found in debug mode an + // assert is issued, in release 0 is returned + int GetEnumMemberValue(const wxChar *name ) const; + + // returns the name of the enum member having the passed in value + // returns an empty string if not found + const wxChar *GetEnumMemberName(int value) const; + + // returns the number of members in this enum + int GetEnumCount() const { return m_count; } + + // returns the value of the nth member + int GetEnumMemberValueByIndex( int n ) const; + + // returns the value of the nth member + const wxChar *GetEnumMemberNameByIndex( int n ) const; + +private: + wxEnumMemberData *m_members; + int m_count; +}; + +#define wxBEGIN_ENUM( e ) \ + wxEnumMemberData s_enumDataMembers##e[] = { + +#define wxENUM_MEMBER( v ) { wxT(#v), v }, + +#define wxEND_ENUM( e ) \ + { NULL, 0 } }; \ + wxEnumData s_enumData##e( s_enumDataMembers##e ); \ + wxEnumData *wxGetEnumData(e) { return &s_enumData##e; } \ + template<> void wxStringReadValue(const wxString& s, e &data ) \ + { data = (e) s_enumData##e.GetEnumMemberValue(s.c_str()); } \ + template<> void wxStringWriteValue(wxString &s, const e &data ) \ + { s = s_enumData##e.GetEnumMemberName((int)data); } \ + void FromLong##e( long data, wxAny& result ) \ + { result = wxAny((e)data); } \ + void ToLong##e( const wxAny& data, long &result ) \ + { result = (long) (data).As(static_cast(NULL)); } \ + \ + wxTO_STRING_IMP( e ) \ + wxFROM_STRING_IMP( e ) \ + wxEnumTypeInfo s_typeInfo##e(wxT_ENUM, &s_enumData##e, \ + &wxTO_STRING( e ), &wxFROM_STRING( e ), &ToLong##e, \ + &FromLong##e, typeid(e).name() ); + + +// ---------------------------------------------------------------------------- +// Set Support +// +// in the header : +// +// enum wxFlavor +// { +// Vanilla, +// Chocolate, +// Strawberry, +// }; +// +// typedef wxBitset wxCoupe; +// +// in the implementation file : +// +// wxBEGIN_ENUM( wxFlavor ) +// wxENUM_MEMBER( Vanilla ) +// wxENUM_MEMBER( Chocolate ) +// wxENUM_MEMBER( Strawberry ) +// wxEND_ENUM( wxFlavor ) +// +// wxIMPLEMENT_SET_STREAMING( wxCoupe, wxFlavor ) +// +// implementation note: no partial specialization for streaming, but a delegation +// to a different class +// +// ---------------------------------------------------------------------------- + +void WXDLLIMPEXP_BASE wxSetStringToArray( const wxString &s, wxArrayString &array ); + +template +void wxSetFromString(const wxString &s, wxBitset &data ) +{ + wxEnumData* edata = wxGetEnumData((e) 0); + data.reset(); + + wxArrayString array; + wxSetStringToArray( s, array ); + wxString flag; + for ( int i = 0; i < array.Count(); ++i ) + { + flag = array[i]; + int ivalue; + if ( edata->HasEnumMemberValue( flag.c_str(), &ivalue ) ) + { + data.set( (e) ivalue ); + } + } +} + +template +void wxSetToString( wxString &s, const wxBitset &data ) +{ + wxEnumData* edata = wxGetEnumData((e) 0); + int count = edata->GetEnumCount(); + int i; + s.Clear(); + for ( i = 0; i < count; i++ ) + { + e value = (e) edata->GetEnumMemberValueByIndex(i); + if ( data.test( value ) ) + { + // this could also be done by the templated calls + if ( !s.empty() ) + s += wxT("|"); + s += edata->GetEnumMemberNameByIndex(i); + } + } +} + +#define wxIMPLEMENT_SET_STREAMING(SetName,e) \ + template<> void wxStringReadValue(const wxString &s, wxBitset &data ) \ + { wxSetFromString( s, data ); } \ + template<> void wxStringWriteValue( wxString &s, const wxBitset &data ) \ + { wxSetToString( s, data ); } \ + void FromLong##SetName( long data, wxAny& result ) \ + { result = wxAny(SetName((unsigned long)data)); } \ + void ToLong##SetName( const wxAny& data, long &result ) \ + { result = (long) (data).As(static_cast(NULL)).to_ulong(); } \ + wxTO_STRING_IMP( SetName ) \ + wxFROM_STRING_IMP( SetName ) \ + wxEnumTypeInfo s_typeInfo##SetName(wxT_SET, &s_enumData##e, \ + &wxTO_STRING( SetName ), &wxFROM_STRING( SetName ), \ + &ToLong##SetName, &FromLong##SetName, typeid(SetName).name() ); + +template +void wxFlagsFromString(const wxString &s, e &data ) +{ + wxEnumData* edata = wxGetEnumData((e*) 0); + data.m_data = 0; + + wxArrayString array; + wxSetStringToArray( s, array ); + wxString flag; + for ( size_t i = 0; i < array.Count(); ++i ) + { + flag = array[i]; + int ivalue; + if ( edata->HasEnumMemberValue( flag.c_str(), &ivalue ) ) + { + data.m_data |= ivalue; + } + } +} + +template +void wxFlagsToString( wxString &s, const e& data ) +{ + wxEnumData* edata = wxGetEnumData((e*) 0); + int count = edata->GetEnumCount(); + int i; + s.Clear(); + long dataValue = data.m_data; + for ( i = 0; i < count; i++ ) + { + int value = edata->GetEnumMemberValueByIndex(i); + // make this to allow for multi-bit constants to work + if ( value && ( dataValue & value ) == value ) + { + // clear the flags we just set + dataValue &= ~value; + // this could also be done by the templated calls + if ( !s.empty() ) + s +=wxT("|"); + s += edata->GetEnumMemberNameByIndex(i); + } + } +} + +#define wxBEGIN_FLAGS( e ) \ + wxEnumMemberData s_enumDataMembers##e[] = { + +#define wxFLAGS_MEMBER( v ) { wxT(#v), static_cast(v) }, + +#define wxEND_FLAGS( e ) \ + { NULL, 0 } }; \ + wxEnumData s_enumData##e( s_enumDataMembers##e ); \ + wxEnumData *wxGetEnumData(e*) { return &s_enumData##e; } \ + template<> void wxStringReadValue(const wxString &s, e &data ) \ + { wxFlagsFromString( s, data ); } \ + template<> void wxStringWriteValue( wxString &s, const e& data ) \ + { wxFlagsToString( s, data ); } \ + void FromLong##e( long data, wxAny& result ) \ + { result = wxAny(e(data)); } \ + void ToLong##e( const wxAny& data, long &result ) \ + { result = (long) (data).As(static_cast(NULL)).m_data; } \ + wxTO_STRING_IMP( e ) \ + wxFROM_STRING_IMP( e ) \ + wxEnumTypeInfo s_typeInfo##e(wxT_SET, &s_enumData##e, \ + &wxTO_STRING( e ), &wxFROM_STRING( e ), &ToLong##e, \ + &FromLong##e, typeid(e).name() ); + +// ---------------------------------------------------------------------------- +// Type Information +// ---------------------------------------------------------------------------- + +// All data exposed by the RTTI is characterized using the following classes. +// The first characterization is done by wxTypeKind. All enums up to and including +// wxT_CUSTOM represent so called simple types. These cannot be divided any further. +// They can be converted to and from wxStrings, that's all. +// Other wxTypeKinds can instead be split recursively into smaller parts until +// the simple types are reached. + +enum wxTypeKind +{ + wxT_VOID = 0, // unknown type + wxT_BOOL, + wxT_CHAR, + wxT_UCHAR, + wxT_INT, + wxT_UINT, + wxT_LONG, + wxT_ULONG, + wxT_LONGLONG, + wxT_ULONGLONG, + wxT_FLOAT, + wxT_DOUBLE, + wxT_STRING, // must be wxString + wxT_SET, // must be wxBitset<> template + wxT_ENUM, + wxT_CUSTOM, // user defined type (e.g. wxPoint) + + wxT_LAST_SIMPLE_TYPE_KIND = wxT_CUSTOM, + + wxT_OBJECT_PTR, // object reference + wxT_OBJECT, // embedded object + wxT_COLLECTION, // collection + + wxT_DELEGATE, // for connecting against an event source + + wxT_LAST_TYPE_KIND = wxT_DELEGATE // sentinel for bad data, asserts, debugging +}; + +class WXDLLIMPEXP_BASE wxAny; +class WXDLLIMPEXP_BASE wxTypeInfo; + +WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxTypeInfo*, wxTypeInfoMap, class WXDLLIMPEXP_BASE ); + +class WXDLLIMPEXP_BASE wxTypeInfo +{ +public: + typedef void (*wxVariant2StringFnc)( const wxAny& data, wxString &result ); + typedef void (*wxString2VariantFnc)( const wxString& data, wxAny &result ); + + wxTypeInfo(wxTypeKind kind, + wxVariant2StringFnc to = NULL, wxString2VariantFnc from = NULL, + const wxString &name = wxEmptyString): + m_toString(to), m_fromString(from), m_kind(kind), m_name(name) + { + Register(); + } +#if 0 // wxUSE_UNICODE + wxTypeInfo(wxTypeKind kind, + wxVariant2StringFnc to, wxString2VariantFnc from, + const char *name): + m_toString(to), m_fromString(from), m_kind(kind), + m_name(wxString::FromAscii(name)) + { + Register(); + } +#endif + + virtual ~wxTypeInfo() + { + Unregister(); + } + + // return the kind of this type (wxT_... constants) + wxTypeKind GetKind() const { return m_kind; } + + // returns the unique name of this type + const wxString& GetTypeName() const { return m_name; } + + // is this type a delegate type + bool IsDelegateType() const { return m_kind == wxT_DELEGATE; } + + // is this type a custom type + bool IsCustomType() const { return m_kind == wxT_CUSTOM; } + + // is this type an object type + bool IsObjectType() const { return m_kind == wxT_OBJECT || m_kind == wxT_OBJECT_PTR; } + + // can the content of this type be converted to and from strings ? + bool HasStringConverters() const { return m_toString != NULL && m_fromString != NULL; } + + // convert a wxAny holding data of this type into a string + void ConvertToString( const wxAny& data, wxString &result ) const + { + if ( m_toString ) + (*m_toString)( data, result ); + else + wxLogError( wxGetTranslation(wxT("String conversions not supported")) ); + } + + // convert a string into a wxAny holding the corresponding data in this type + void ConvertFromString( const wxString& data, wxAny &result ) const + { + if( m_fromString ) + (*m_fromString)( data, result ); + else + wxLogError( wxGetTranslation(wxT("String conversions not supported")) ); + } + + // statics: + + // looks for the corresponding type, will return NULL if not found + static wxTypeInfo *FindType( const wxString& typeName ); +private: + void Register(); + void Unregister(); + + wxVariant2StringFnc m_toString; + wxString2VariantFnc m_fromString; + + wxTypeKind m_kind; + wxString m_name; + + // the static list of all types we know about + static wxTypeInfoMap* ms_typeTable; +}; + +class WXDLLIMPEXP_BASE wxBuiltInTypeInfo : public wxTypeInfo +{ +public: + wxBuiltInTypeInfo( wxTypeKind kind, wxVariant2StringFnc to = NULL, + wxString2VariantFnc from = NULL, + const wxString &name = wxEmptyString ) : + wxTypeInfo( kind, to, from, name ) + { wxASSERT_MSG( GetKind() < wxT_SET, wxT("Illegal Kind for Base Type") ); } +}; + +class WXDLLIMPEXP_BASE wxCustomTypeInfo : public wxTypeInfo +{ +public: + wxCustomTypeInfo( const wxString &name, wxVariant2StringFnc to, + wxString2VariantFnc from ) : + wxTypeInfo( wxT_CUSTOM, to, from, name ) + {} +}; + +class WXDLLIMPEXP_BASE wxEnumTypeInfo : public wxTypeInfo +{ +public: + typedef void (*converterToLong_t)( const wxAny& data, long &result ); + typedef void (*converterFromLong_t)( long data, wxAny &result ); + + wxEnumTypeInfo( wxTypeKind kind, wxEnumData* enumInfo, wxVariant2StringFnc to, + wxString2VariantFnc from, converterToLong_t toLong, + converterFromLong_t fromLong, const wxString &name ) : + wxTypeInfo( kind, to, from, name ), m_toLong( toLong ), m_fromLong( fromLong ) + { + wxASSERT_MSG( kind == wxT_ENUM || kind == wxT_SET, + wxT("Illegal Kind for Enum Type")); + m_enumInfo = enumInfo; + } + + const wxEnumData* GetEnumData() const { return m_enumInfo; } + + // convert a wxAny holding data of this type into a long + void ConvertToLong( const wxAny& data, long &result ) const + { + if( m_toLong ) + (*m_toLong)( data, result ); + else + wxLogError( wxGetTranslation(wxT("Long Conversions not supported")) ); + } + + // convert a long into a wxAny holding the corresponding data in this type + void ConvertFromLong( long data, wxAny &result ) const + { + if( m_fromLong ) + (*m_fromLong)( data, result ); + else + wxLogError( wxGetTranslation(wxT("Long Conversions not supported")) ); + } + +private: + converterToLong_t m_toLong; + converterFromLong_t m_fromLong; + + wxEnumData *m_enumInfo; // Kind == wxT_ENUM or Kind == wxT_SET +}; + +class WXDLLIMPEXP_BASE wxClassTypeInfo : public wxTypeInfo +{ +public: + wxClassTypeInfo( wxTypeKind kind, wxClassInfo* classInfo, + wxVariant2StringFnc to = NULL, wxString2VariantFnc from = NULL, + const wxString &name = wxEmptyString); + + const wxClassInfo *GetClassInfo() const { return m_classInfo; } + +private: + wxClassInfo *m_classInfo; // Kind == wxT_OBJECT - could be NULL +}; + +class WXDLLIMPEXP_BASE wxCollectionTypeInfo : public wxTypeInfo +{ +public: + wxCollectionTypeInfo( const wxString &elementName, wxVariant2StringFnc to, + wxString2VariantFnc from , const wxString &name) : + wxTypeInfo( wxT_COLLECTION, to, from, name ) + { m_elementTypeName = elementName; m_elementType = NULL; } + + const wxTypeInfo* GetElementType() const + { + if ( m_elementType == NULL ) + m_elementType = wxTypeInfo::FindType( m_elementTypeName ); + return m_elementType; + } + +private: + mutable wxTypeInfo * m_elementType; + wxString m_elementTypeName; +}; + +class WXDLLIMPEXP_BASE wxEventSourceTypeInfo : public wxTypeInfo +{ +public: + wxEventSourceTypeInfo( int eventType, wxClassInfo* eventClass, + wxVariant2StringFnc to = NULL, + wxString2VariantFnc from = NULL ); + wxEventSourceTypeInfo( int eventType, int lastEventType, wxClassInfo* eventClass, + wxVariant2StringFnc to = NULL, wxString2VariantFnc from = NULL ); + + int GetEventType() const { return m_eventType; } + int GetLastEventType() const { return m_lastEventType; } + const wxClassInfo* GetEventClass() const { return m_eventClass; } + +private: + const wxClassInfo *m_eventClass; // (extended will merge into classinfo) + int m_eventType; + int m_lastEventType; +}; + +template const wxTypeInfo* wxGetTypeInfo( T * ) + { return wxTypeInfo::FindType(typeid(T).name()); } + +// this macro is for usage with custom, non-object derived classes and structs, +// wxPoint is such a custom type + +#if wxUSE_FUNC_TEMPLATE_POINTER + #define wxCUSTOM_TYPE_INFO( e, toString, fromString ) \ + wxCustomTypeInfo s_typeInfo##e(typeid(e).name(), &toString, &fromString); +#else + #define wxCUSTOM_TYPE_INFO( e, toString, fromString ) \ + void ToString##e( const wxAny& data, wxString &result ) \ + { toString(data, result); } \ + void FromString##e( const wxString& data, wxAny &result ) \ + { fromString(data, result); } \ + wxCustomTypeInfo s_typeInfo##e(typeid(e).name(), \ + &ToString##e, &FromString##e); +#endif + +#define wxCOLLECTION_TYPE_INFO( element, collection ) \ + wxCollectionTypeInfo s_typeInfo##collection( typeid(element).name(), \ + NULL, NULL, typeid(collection).name() ); + +// sometimes a compiler invents specializations that are nowhere called, +// use this macro to satisfy the refs, currently we don't have to play +// tricks, but if we will have to according to the compiler, we will use +// that macro for that + +#define wxILLEGAL_TYPE_SPECIALIZATION( a ) + +#endif // wxUSE_EXTENDED_RTTI +#endif // _XTITYPES_H_ diff --git a/lib/wxWidgets/include/wx/xtixml.h b/lib/wxWidgets/include/wx/xtixml.h new file mode 100644 index 0000000..d083203 --- /dev/null +++ b/lib/wxWidgets/include/wx/xtixml.h @@ -0,0 +1,119 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/xtixml.h +// Purpose: xml streaming runtime metadata information (extended class info) +// Author: Stefan Csomor +// Modified by: +// Created: 27/07/03 +// Copyright: (c) 2003 Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XTIXMLH__ +#define _WX_XTIXMLH__ + +#include "wx/defs.h" + +#if wxUSE_EXTENDED_RTTI + +#include "wx/string.h" +#include "wx/xtistrm.h" + +/* +class WXDLLIMPEXP_XML wxXmlNode; +class WXDLLIMPEXP_BASE wxPropertyInfo; +class WXDLLIMPEXP_BASE wxObject; +class WXDLLIMPEXP_BASE wxClassInfo; +class WXDLLIMPEXP_BASE wxAnyList; +class WXDLLIMPEXP_BASE wxHandlerInfo; +class WXDLLIMPEXP_BASE wxObjectWriterCallback; +*/ + +class WXDLLIMPEXP_XML wxObjectXmlWriter: public wxObjectWriter +{ +public: + + wxObjectXmlWriter( wxXmlNode * parent ); + virtual ~wxObjectXmlWriter(); + + // + // streaming callbacks + // + // these callbacks really write out the values in the stream format + // + + // + // streaming callbacks + // + // these callbacks really write out the values in the stream format + + // begins writing out a new toplevel entry which has the indicated unique name + virtual void DoBeginWriteTopLevelEntry( const wxString &name ); + + // ends writing out a new toplevel entry which has the indicated unique name + virtual void DoEndWriteTopLevelEntry( const wxString &name ); + + // start of writing an object having the passed in ID + virtual void DoBeginWriteObject(const wxObject *object, + const wxClassInfo *classInfo, int objectID, const wxStringToAnyHashMap &metadata ); + + // end of writing a toplevel object name param is used for unique + // identification within the container + virtual void DoEndWriteObject(const wxObject *object, + const wxClassInfo *classInfo, int objectID ); + + // writes a simple property in the stream format + virtual void DoWriteSimpleType( const wxAny &value ); + + // start of writing a complex property into the stream ( + virtual void DoBeginWriteProperty( const wxPropertyInfo *propInfo ); + + // end of writing a complex property into the stream + virtual void DoEndWriteProperty( const wxPropertyInfo *propInfo ); + + virtual void DoBeginWriteElement(); + virtual void DoEndWriteElement(); + + // insert an object reference to an already written object + virtual void DoWriteRepeatedObject( int objectID ); + + // insert a null reference + virtual void DoWriteNullObject(); + + // writes a delegate in the stream format + virtual void DoWriteDelegate( const wxObject *object, + const wxClassInfo* classInfo, const wxPropertyInfo *propInfo, + const wxObject *eventSink, int sinkObjectID, + const wxClassInfo* eventSinkClassInfo, const wxHandlerInfo* handlerIndo ); + +private: + struct wxObjectXmlWriterInternal; + wxObjectXmlWriterInternal* m_data; +}; + +/* +wxObjectXmlReader handles streaming in a class from XML +*/ + +class WXDLLIMPEXP_XML wxObjectXmlReader: public wxObjectReader +{ +public: + wxObjectXmlReader(wxXmlNode *parent) { m_parent = parent; } + virtual ~wxObjectXmlReader() {} + + // Reads a component from XML. The return value is the root object ID, which can + // then be used to ask the readercallback about that object + + virtual int ReadObject( const wxString &name, wxObjectReaderCallback *readercallback ); + +private: + int ReadComponent(wxXmlNode *parent, wxObjectReaderCallback *callbacks); + + // read the content of this node (simple type) and return the corresponding value + wxAny ReadValue(wxXmlNode *Node, const wxTypeInfo *type ); + + wxXmlNode * m_parent; +}; + +#endif // wxUSE_EXTENDED_RTTI + +#endif diff --git a/lib/wxWidgets/include/wx/zipstrm.h b/lib/wxWidgets/include/wx/zipstrm.h new file mode 100644 index 0000000..2a62313 --- /dev/null +++ b/lib/wxWidgets/include/wx/zipstrm.h @@ -0,0 +1,600 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/zipstrm.h +// Purpose: Streams for Zip files +// Author: Mike Wetherell +// Copyright: (c) Mike Wetherell +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WXZIPSTREAM_H__ +#define _WX_WXZIPSTREAM_H__ + +#include "wx/defs.h" + +#if wxUSE_ZIPSTREAM + +#include "wx/archive.h" +#include "wx/filename.h" + +// some methods from wxZipInputStream and wxZipOutputStream stream do not get +// exported/imported when compiled with Mingw versions before 3.4.2. So they +// are imported/exported individually as a workaround +#if (defined(__GNUWIN32__) || defined(__MINGW32__)) \ + && (!defined __GNUC__ \ + || !defined __GNUC_MINOR__ \ + || !defined __GNUC_PATCHLEVEL__ \ + || __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ < 30402) +#define WXZIPFIX WXDLLIMPEXP_BASE +#else +#define WXZIPFIX +#endif + +///////////////////////////////////////////////////////////////////////////// +// constants + +// Compression Method, only 0 (store) and 8 (deflate) are supported here +// +enum wxZipMethod +{ + wxZIP_METHOD_STORE, + wxZIP_METHOD_SHRINK, + wxZIP_METHOD_REDUCE1, + wxZIP_METHOD_REDUCE2, + wxZIP_METHOD_REDUCE3, + wxZIP_METHOD_REDUCE4, + wxZIP_METHOD_IMPLODE, + wxZIP_METHOD_TOKENIZE, + wxZIP_METHOD_DEFLATE, + wxZIP_METHOD_DEFLATE64, + wxZIP_METHOD_BZIP2 = 12, + wxZIP_METHOD_DEFAULT = 0xffff +}; + +// Originating File-System. +// +// These are Pkware's values. Note that Info-zip disagree on some of them, +// most notably NTFS. +// +enum wxZipSystem +{ + wxZIP_SYSTEM_MSDOS, + wxZIP_SYSTEM_AMIGA, + wxZIP_SYSTEM_OPENVMS, + wxZIP_SYSTEM_UNIX, + wxZIP_SYSTEM_VM_CMS, + wxZIP_SYSTEM_ATARI_ST, + wxZIP_SYSTEM_OS2_HPFS, + wxZIP_SYSTEM_MACINTOSH, + wxZIP_SYSTEM_Z_SYSTEM, + wxZIP_SYSTEM_CPM, + wxZIP_SYSTEM_WINDOWS_NTFS, + wxZIP_SYSTEM_MVS, + wxZIP_SYSTEM_VSE, + wxZIP_SYSTEM_ACORN_RISC, + wxZIP_SYSTEM_VFAT, + wxZIP_SYSTEM_ALTERNATE_MVS, + wxZIP_SYSTEM_BEOS, + wxZIP_SYSTEM_TANDEM, + wxZIP_SYSTEM_OS_400 +}; + +// Dos/Win file attributes +// +enum wxZipAttributes +{ + wxZIP_A_RDONLY = 0x01, + wxZIP_A_HIDDEN = 0x02, + wxZIP_A_SYSTEM = 0x04, + wxZIP_A_SUBDIR = 0x10, + wxZIP_A_ARCH = 0x20, + + wxZIP_A_MASK = 0x37 +}; + +// Values for the flags field in the zip headers +// +enum wxZipFlags +{ + wxZIP_ENCRYPTED = 0x0001, + wxZIP_DEFLATE_NORMAL = 0x0000, // normal compression + wxZIP_DEFLATE_EXTRA = 0x0002, // extra compression + wxZIP_DEFLATE_FAST = 0x0004, // fast compression + wxZIP_DEFLATE_SUPERFAST = 0x0006, // superfast compression + wxZIP_DEFLATE_MASK = 0x0006, + wxZIP_SUMS_FOLLOW = 0x0008, // crc and sizes come after the data + wxZIP_ENHANCED = 0x0010, + wxZIP_PATCH = 0x0020, + wxZIP_STRONG_ENC = 0x0040, + wxZIP_LANG_ENC_UTF8 = 0x0800, // filename and comment are UTF8 + wxZIP_UNUSED = 0x0F80, + wxZIP_RESERVED = 0xF000 +}; + +enum wxZipArchiveFormat +{ + /// Default zip format + wxZIP_FORMAT_DEFAULT, + /// ZIP64 format + wxZIP_FORMAT_ZIP64 +}; + +// Forward decls +// +class WXDLLIMPEXP_FWD_BASE wxZipEntry; +class WXDLLIMPEXP_FWD_BASE wxZipInputStream; + + +///////////////////////////////////////////////////////////////////////////// +// wxZipNotifier + +class WXDLLIMPEXP_BASE wxZipNotifier +{ +public: + virtual ~wxZipNotifier() { } + + virtual void OnEntryUpdated(wxZipEntry& entry) = 0; +}; + + +///////////////////////////////////////////////////////////////////////////// +// Zip Entry - holds the meta data for a file in the zip + +class wxDataOutputStream; + +class WXDLLIMPEXP_BASE wxZipEntry : public wxArchiveEntry +{ +public: + wxZipEntry(const wxString& name = wxEmptyString, + const wxDateTime& dt = wxDateTime::Now(), + wxFileOffset size = wxInvalidOffset); + virtual ~wxZipEntry(); + + wxZipEntry(const wxZipEntry& entry); + wxZipEntry& operator=(const wxZipEntry& entry); + + // Get accessors + wxDateTime GetDateTime() const wxOVERRIDE { return m_DateTime; } + wxFileOffset GetSize() const wxOVERRIDE { return m_Size; } + wxFileOffset GetOffset() const wxOVERRIDE { return m_Offset; } + wxString GetInternalName() const wxOVERRIDE { return m_Name; } + int GetMethod() const { return m_Method; } + int GetFlags() const { return m_Flags; } + wxUint32 GetCrc() const { return m_Crc; } + wxFileOffset GetCompressedSize() const { return m_CompressedSize; } + int GetSystemMadeBy() const { return m_SystemMadeBy; } + wxString GetComment() const { return m_Comment; } + wxUint32 GetExternalAttributes() const { return m_ExternalAttributes; } + wxPathFormat GetInternalFormat() const wxOVERRIDE { return wxPATH_UNIX; } + int GetMode() const; + const char *GetLocalExtra() const; + size_t GetLocalExtraLen() const; + const char *GetExtra() const; + size_t GetExtraLen() const; + wxString GetName(wxPathFormat format = wxPATH_NATIVE) const wxOVERRIDE; + + // is accessors + inline bool IsDir() const wxOVERRIDE; + inline bool IsText() const; + inline bool IsReadOnly() const wxOVERRIDE; + inline bool IsMadeByUnix() const; + + // set accessors + void SetDateTime(const wxDateTime& dt) wxOVERRIDE { m_DateTime = dt; } + void SetSize(wxFileOffset size) wxOVERRIDE { m_Size = size; } + void SetMethod(int method) { m_Method = (wxUint16)method; } + void SetComment(const wxString& comment) { m_Comment = comment; } + void SetExternalAttributes(wxUint32 attr ) { m_ExternalAttributes = attr; } + void SetSystemMadeBy(int system); + void SetMode(int mode); + void SetExtra(const char *extra, size_t len); + void SetLocalExtra(const char *extra, size_t len); + + inline void SetName(const wxString& name, + wxPathFormat format = wxPATH_NATIVE) wxOVERRIDE; + + static wxString GetInternalName(const wxString& name, + wxPathFormat format = wxPATH_NATIVE, + bool *pIsDir = NULL); + + // set is accessors + void SetIsDir(bool isDir = true) wxOVERRIDE; + inline void SetIsReadOnly(bool isReadOnly = true) wxOVERRIDE; + inline void SetIsText(bool isText = true); + + wxZipEntry *Clone() const { return ZipClone(); } + + void SetNotifier(wxZipNotifier& notifier); + void UnsetNotifier() wxOVERRIDE; + +protected: + // Internal attributes + enum { TEXT_ATTR = 1 }; + + // protected Get accessors + int GetVersionNeeded() const { return m_VersionNeeded; } + wxFileOffset GetKey() const { return m_Key; } + int GetVersionMadeBy() const { return m_VersionMadeBy; } + int GetDiskStart() const { return m_DiskStart; } + int GetInternalAttributes() const { return m_InternalAttributes; } + + void SetVersionNeeded(int version) { m_VersionNeeded = (wxUint16)version; } + void SetOffset(wxFileOffset offset) wxOVERRIDE { m_Offset = offset; } + void SetFlags(int flags) { m_Flags = (wxUint16)flags; } + void SetVersionMadeBy(int version) { m_VersionMadeBy = (wxUint8)version; } + void SetCrc(wxUint32 crc) { m_Crc = crc; } + void SetCompressedSize(wxFileOffset size) { m_CompressedSize = size; } + void SetKey(wxFileOffset offset) { m_Key = offset; } + void SetDiskStart(int start) { m_DiskStart = (wxUint16)start; } + void SetInternalAttributes(int attr) { m_InternalAttributes = (wxUint16)attr; } + + virtual wxZipEntry *ZipClone() const { return new wxZipEntry(*this); } + + void Notify(); + +private: + wxArchiveEntry* DoClone() const wxOVERRIDE { return ZipClone(); } + + size_t ReadLocal(wxInputStream& stream, wxMBConv& conv); + size_t WriteLocal(wxOutputStream& stream, wxMBConv& conv, wxZipArchiveFormat zipFormat); + + size_t ReadCentral(wxInputStream& stream, wxMBConv& conv); + size_t WriteCentral(wxOutputStream& stream, wxMBConv& conv) const; + + size_t ReadDescriptor(wxInputStream& stream); + size_t WriteDescriptor(wxOutputStream& stream, wxUint32 crc, + wxFileOffset compressedSize, wxFileOffset size); + + void WriteLocalFileSizes(wxDataOutputStream& ds) const; + void WriteLocalZip64ExtraInfo(wxOutputStream& stream) const; + + bool LoadExtraInfo(const char* extraData, wxUint16 extraLen, bool localInfo); + + wxUint16 GetInternalFlags(bool checkForUTF8) const; + + wxUint8 m_SystemMadeBy; // one of enum wxZipSystem + wxUint8 m_VersionMadeBy; // major * 10 + minor + + wxUint16 m_VersionNeeded; // ver needed to extract (20 i.e. v2.0) + wxUint16 m_Flags; + wxUint16 m_Method; // compression method (one of wxZipMethod) + wxDateTime m_DateTime; + wxUint32 m_Crc; + wxFileOffset m_CompressedSize; + wxFileOffset m_Size; + wxString m_Name; // in internal format + wxFileOffset m_Key; // the original offset for copied entries + wxFileOffset m_Offset; // file offset of the entry + + wxString m_Comment; + wxUint16 m_DiskStart; // for multidisk archives, not unsupported + wxUint16 m_InternalAttributes; // bit 0 set for text files + wxUint32 m_ExternalAttributes; // system specific depends on SystemMadeBy + wxUint16 m_z64infoOffset; // Offset of ZIP64 local extra data for file sizes + + class wxZipMemory *m_Extra; + class wxZipMemory *m_LocalExtra; + + wxZipNotifier *m_zipnotifier; + class wxZipWeakLinks *m_backlink; + + friend class wxZipInputStream; + friend class wxZipOutputStream; + + wxDECLARE_DYNAMIC_CLASS(wxZipEntry); +}; + + +///////////////////////////////////////////////////////////////////////////// +// wxZipOutputStream + +WX_DECLARE_LIST_WITH_DECL(wxZipEntry, wxZipEntryList_, class WXDLLIMPEXP_BASE); + +class WXDLLIMPEXP_BASE wxZipOutputStream : public wxArchiveOutputStream +{ +public: + wxZipOutputStream(wxOutputStream& stream, + int level = -1, + wxMBConv& conv = wxConvUTF8); + wxZipOutputStream(wxOutputStream *stream, + int level = -1, + wxMBConv& conv = wxConvUTF8); + virtual WXZIPFIX ~wxZipOutputStream(); + + bool PutNextEntry(wxZipEntry *entry) { return DoCreate(entry); } + + bool WXZIPFIX PutNextEntry(const wxString& name, + const wxDateTime& dt = wxDateTime::Now(), + wxFileOffset size = wxInvalidOffset) wxOVERRIDE; + + bool WXZIPFIX PutNextDirEntry(const wxString& name, + const wxDateTime& dt = wxDateTime::Now()) wxOVERRIDE; + + bool WXZIPFIX CopyEntry(wxZipEntry *entry, wxZipInputStream& inputStream); + bool WXZIPFIX CopyArchiveMetaData(wxZipInputStream& inputStream); + + void WXZIPFIX Sync() wxOVERRIDE; + bool WXZIPFIX CloseEntry() wxOVERRIDE; + bool WXZIPFIX Close() wxOVERRIDE; + + void SetComment(const wxString& comment) { m_Comment = comment; } + + int GetLevel() const { return m_level; } + void WXZIPFIX SetLevel(int level); + + void SetFormat(wxZipArchiveFormat format) { m_format = format; } + wxZipArchiveFormat GetFormat() const { return m_format; } + +protected: + virtual size_t WXZIPFIX OnSysWrite(const void *buffer, size_t size) wxOVERRIDE; + virtual wxFileOffset OnSysTell() const wxOVERRIDE { return m_entrySize; } + + // this protected interface isn't yet finalised + struct Buffer { const char *m_data; size_t m_size; }; + virtual wxOutputStream* WXZIPFIX OpenCompressor(wxOutputStream& stream, + wxZipEntry& entry, + const Buffer bufs[]); + virtual bool WXZIPFIX CloseCompressor(wxOutputStream *comp); + + bool IsParentSeekable() const + { return m_offsetAdjustment != wxInvalidOffset; } + +private: + void Init(int level); + + bool WXZIPFIX PutNextEntry(wxArchiveEntry *entry) wxOVERRIDE; + bool WXZIPFIX CopyEntry(wxArchiveEntry *entry, wxArchiveInputStream& stream) wxOVERRIDE; + bool WXZIPFIX CopyArchiveMetaData(wxArchiveInputStream& stream) wxOVERRIDE; + + bool IsOpened() const { return m_comp || m_pending; } + + bool DoCreate(wxZipEntry *entry, bool raw = false); + void CreatePendingEntry(const void *buffer, size_t size); + void CreatePendingEntry(); + + class wxStoredOutputStream *m_store; + class wxZlibOutputStream2 *m_deflate; + class wxZipStreamLink *m_backlink; + wxZipEntryList_ m_entries; + char *m_initialData; + size_t m_initialSize; + wxZipEntry *m_pending; + bool m_raw; + wxFileOffset m_headerOffset; + size_t m_headerSize; + wxFileOffset m_entrySize; + wxUint32 m_crcAccumulator; + wxOutputStream *m_comp; + int m_level; + wxFileOffset m_offsetAdjustment; + wxString m_Comment; + bool m_endrecWritten; + wxZipArchiveFormat m_format; + + wxDECLARE_NO_COPY_CLASS(wxZipOutputStream); +}; + + +///////////////////////////////////////////////////////////////////////////// +// wxZipInputStream + +class WXDLLIMPEXP_BASE wxZipInputStream : public wxArchiveInputStream +{ +public: + typedef wxZipEntry entry_type; + + wxZipInputStream(wxInputStream& stream, wxMBConv& conv = wxConvLocal); + wxZipInputStream(wxInputStream *stream, wxMBConv& conv = wxConvLocal); + + virtual WXZIPFIX ~wxZipInputStream(); + + bool OpenEntry(wxZipEntry& entry) { return DoOpen(&entry); } + bool WXZIPFIX CloseEntry() wxOVERRIDE; + + wxZipEntry *GetNextEntry(); + + wxString WXZIPFIX GetComment(); + int WXZIPFIX GetTotalEntries(); + + virtual wxFileOffset GetLength() const wxOVERRIDE { return m_entry.GetSize(); } + +protected: + size_t WXZIPFIX OnSysRead(void *buffer, size_t size) wxOVERRIDE; + wxFileOffset OnSysTell() const wxOVERRIDE { return m_decomp ? m_decomp->TellI() : 0; } + + // this protected interface isn't yet finalised + virtual wxInputStream* WXZIPFIX OpenDecompressor(wxInputStream& stream); + virtual bool WXZIPFIX CloseDecompressor(wxInputStream *decomp); + +private: + void Init(); + void Init(const wxString& file); + + wxArchiveEntry *DoGetNextEntry() wxOVERRIDE { return GetNextEntry(); } + + bool WXZIPFIX OpenEntry(wxArchiveEntry& entry) wxOVERRIDE; + + wxStreamError ReadLocal(bool readEndRec = false); + wxStreamError ReadCentral(); + + wxUint32 ReadSignature(); + bool FindEndRecord(); + bool LoadEndRecord(); + + bool AtHeader() const { return m_headerSize == 0; } + bool AfterHeader() const { return m_headerSize > 0 && !m_decomp; } + bool IsOpened() const { return m_decomp != NULL; } + + wxZipStreamLink *MakeLink(wxZipOutputStream *out); + + bool DoOpen(wxZipEntry *entry = NULL, bool raw = false); + bool OpenDecompressor(bool raw = false); + + class wxStoredInputStream *m_store; + class wxZlibInputStream2 *m_inflate; + class wxRawInputStream *m_rawin; + wxZipEntry m_entry; + bool m_raw; + size_t m_headerSize; + wxUint32 m_crcAccumulator; + wxInputStream *m_decomp; + bool m_parentSeekable; + class wxZipWeakLinks *m_weaklinks; + class wxZipStreamLink *m_streamlink; + wxFileOffset m_offsetAdjustment; + wxFileOffset m_position; + wxUint32 m_signature; + size_t m_TotalEntries; + wxString m_Comment; + + friend bool wxZipOutputStream::CopyEntry( + wxZipEntry *entry, wxZipInputStream& inputStream); + friend bool wxZipOutputStream::CopyArchiveMetaData( + wxZipInputStream& inputStream); + + wxDECLARE_NO_COPY_CLASS(wxZipInputStream); +}; + + +///////////////////////////////////////////////////////////////////////////// +// Iterators + +#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR +typedef wxArchiveIterator wxZipIter; +typedef wxArchiveIterator > wxZipPairIter; +#endif + + +///////////////////////////////////////////////////////////////////////////// +// wxZipClassFactory + +class WXDLLIMPEXP_BASE wxZipClassFactory : public wxArchiveClassFactory +{ +public: + typedef wxZipEntry entry_type; + typedef wxZipInputStream instream_type; + typedef wxZipOutputStream outstream_type; + typedef wxZipNotifier notifier_type; +#if wxUSE_STL || defined WX_TEST_ARCHIVE_ITERATOR + typedef wxZipIter iter_type; + typedef wxZipPairIter pairiter_type; +#endif + + wxZipClassFactory(); + + wxZipEntry *NewEntry() const + { return new wxZipEntry; } + wxZipInputStream *NewStream(wxInputStream& stream) const + { return new wxZipInputStream(stream, GetConv()); } + wxZipOutputStream *NewStream(wxOutputStream& stream) const + { return new wxZipOutputStream(stream, -1, GetConv()); } + wxZipInputStream *NewStream(wxInputStream *stream) const + { return new wxZipInputStream(stream, GetConv()); } + wxZipOutputStream *NewStream(wxOutputStream *stream) const + { return new wxZipOutputStream(stream, -1, GetConv()); } + + wxString GetInternalName(const wxString& name, + wxPathFormat format = wxPATH_NATIVE) const wxOVERRIDE + { return wxZipEntry::GetInternalName(name, format); } + + const wxChar * const *GetProtocols(wxStreamProtocolType type + = wxSTREAM_PROTOCOL) const wxOVERRIDE; + +protected: + wxArchiveEntry *DoNewEntry() const wxOVERRIDE + { return NewEntry(); } + wxArchiveInputStream *DoNewStream(wxInputStream& stream) const wxOVERRIDE + { return NewStream(stream); } + wxArchiveOutputStream *DoNewStream(wxOutputStream& stream) const wxOVERRIDE + { return NewStream(stream); } + wxArchiveInputStream *DoNewStream(wxInputStream *stream) const wxOVERRIDE + { return NewStream(stream); } + wxArchiveOutputStream *DoNewStream(wxOutputStream *stream) const wxOVERRIDE + { return NewStream(stream); } + +private: + wxDECLARE_DYNAMIC_CLASS(wxZipClassFactory); +}; + + +///////////////////////////////////////////////////////////////////////////// +// wxZipEntry inlines + +inline bool wxZipEntry::IsText() const +{ + return (m_InternalAttributes & TEXT_ATTR) != 0; +} + +inline bool wxZipEntry::IsDir() const +{ + return (m_ExternalAttributes & wxZIP_A_SUBDIR) != 0; +} + +inline bool wxZipEntry::IsReadOnly() const +{ + return (m_ExternalAttributes & wxZIP_A_RDONLY) != 0; +} + +inline bool wxZipEntry::IsMadeByUnix() const +{ + switch ( m_SystemMadeBy ) + { + case wxZIP_SYSTEM_MSDOS: + // note: some unix zippers put madeby = dos + return (m_ExternalAttributes & ~0xFFFF) != 0; + + case wxZIP_SYSTEM_OPENVMS: + case wxZIP_SYSTEM_UNIX: + case wxZIP_SYSTEM_ATARI_ST: + case wxZIP_SYSTEM_ACORN_RISC: + case wxZIP_SYSTEM_BEOS: + case wxZIP_SYSTEM_TANDEM: + return true; + + case wxZIP_SYSTEM_AMIGA: + case wxZIP_SYSTEM_VM_CMS: + case wxZIP_SYSTEM_OS2_HPFS: + case wxZIP_SYSTEM_MACINTOSH: + case wxZIP_SYSTEM_Z_SYSTEM: + case wxZIP_SYSTEM_CPM: + case wxZIP_SYSTEM_WINDOWS_NTFS: + case wxZIP_SYSTEM_MVS: + case wxZIP_SYSTEM_VSE: + case wxZIP_SYSTEM_VFAT: + case wxZIP_SYSTEM_ALTERNATE_MVS: + case wxZIP_SYSTEM_OS_400: + return false; + } + + // Unknown system, assume not Unix. + return false; +} + +inline void wxZipEntry::SetIsText(bool isText) +{ + if (isText) + m_InternalAttributes |= TEXT_ATTR; + else + m_InternalAttributes &= ~TEXT_ATTR; +} + +inline void wxZipEntry::SetIsReadOnly(bool isReadOnly) +{ + if (isReadOnly) + SetMode(GetMode() & ~0222); + else + SetMode(GetMode() | 0200); +} + +inline void wxZipEntry::SetName(const wxString& name, + wxPathFormat format /*=wxPATH_NATIVE*/) +{ + bool isDir; + m_Name = GetInternalName(name, format, &isDir); + SetIsDir(isDir); +} + + +#endif // wxUSE_ZIPSTREAM + +#endif // _WX_WXZIPSTREAM_H__ diff --git a/lib/wxWidgets/include/wx/zstream.h b/lib/wxWidgets/include/wx/zstream.h new file mode 100644 index 0000000..d739144 --- /dev/null +++ b/lib/wxWidgets/include/wx/zstream.h @@ -0,0 +1,148 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/zstream.h +// Purpose: Memory stream classes +// Author: Guilhem Lavaux +// Modified by: Mike Wetherell +// Created: 11/07/98 +// Copyright: (c) Guilhem Lavaux +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// +#ifndef _WX_WXZSTREAM_H__ +#define _WX_WXZSTREAM_H__ + +#include "wx/defs.h" + +#if wxUSE_ZLIB && wxUSE_STREAMS + +#include "wx/stream.h" +#include "wx/versioninfo.h" + +// Compression level +enum wxZlibCompressionLevels { + wxZ_DEFAULT_COMPRESSION = -1, + wxZ_NO_COMPRESSION = 0, + wxZ_BEST_SPEED = 1, + wxZ_BEST_COMPRESSION = 9 +}; + +// Flags +enum wxZLibFlags { + wxZLIB_NO_HEADER = 0, // raw deflate stream, no header or checksum + wxZLIB_ZLIB = 1, // zlib header and checksum + wxZLIB_GZIP = 2, // gzip header and checksum, requires zlib 1.2.1+ + wxZLIB_AUTO = 3 // autodetect header zlib or gzip +}; + +class WXDLLIMPEXP_BASE wxZlibInputStream: public wxFilterInputStream { + public: + wxZlibInputStream(wxInputStream& stream, int flags = wxZLIB_AUTO); + wxZlibInputStream(wxInputStream *stream, int flags = wxZLIB_AUTO); + virtual ~wxZlibInputStream(); + + char Peek() wxOVERRIDE { return wxInputStream::Peek(); } + wxFileOffset GetLength() const wxOVERRIDE { return wxInputStream::GetLength(); } + + static bool CanHandleGZip(); + + bool SetDictionary(const char *data, size_t datalen); + bool SetDictionary(const wxMemoryBuffer &buf); + + protected: + size_t OnSysRead(void *buffer, size_t size) wxOVERRIDE; + wxFileOffset OnSysTell() const wxOVERRIDE { return m_pos; } + + private: + void Init(int flags); + + protected: + size_t m_z_size; + unsigned char *m_z_buffer; + struct z_stream_s *m_inflate; + wxFileOffset m_pos; + + wxDECLARE_NO_COPY_CLASS(wxZlibInputStream); +}; + +class WXDLLIMPEXP_BASE wxZlibOutputStream: public wxFilterOutputStream { + public: + wxZlibOutputStream(wxOutputStream& stream, int level = -1, int flags = wxZLIB_ZLIB); + wxZlibOutputStream(wxOutputStream *stream, int level = -1, int flags = wxZLIB_ZLIB); + virtual ~wxZlibOutputStream() { Close(); } + + void Sync() wxOVERRIDE { DoFlush(false); } + bool Close() wxOVERRIDE; + wxFileOffset GetLength() const wxOVERRIDE { return m_pos; } + + static bool CanHandleGZip(); + + bool SetDictionary(const char *data, size_t datalen); + bool SetDictionary(const wxMemoryBuffer &buf); + + protected: + size_t OnSysWrite(const void *buffer, size_t size) wxOVERRIDE; + wxFileOffset OnSysTell() const wxOVERRIDE { return m_pos; } + + virtual void DoFlush(bool final); + + private: + void Init(int level, int flags); + + protected: + size_t m_z_size; + unsigned char *m_z_buffer; + struct z_stream_s *m_deflate; + wxFileOffset m_pos; + + wxDECLARE_NO_COPY_CLASS(wxZlibOutputStream); +}; + +class WXDLLIMPEXP_BASE wxZlibClassFactory: public wxFilterClassFactory +{ +public: + wxZlibClassFactory(); + + wxFilterInputStream *NewStream(wxInputStream& stream) const wxOVERRIDE + { return new wxZlibInputStream(stream); } + wxFilterOutputStream *NewStream(wxOutputStream& stream) const wxOVERRIDE + { return new wxZlibOutputStream(stream, -1); } + wxFilterInputStream *NewStream(wxInputStream *stream) const wxOVERRIDE + { return new wxZlibInputStream(stream); } + wxFilterOutputStream *NewStream(wxOutputStream *stream) const wxOVERRIDE + { return new wxZlibOutputStream(stream, -1); } + + const wxChar * const *GetProtocols(wxStreamProtocolType type + = wxSTREAM_PROTOCOL) const wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxZlibClassFactory); +}; + +class WXDLLIMPEXP_BASE wxGzipClassFactory: public wxFilterClassFactory +{ +public: + wxGzipClassFactory(); + + wxFilterInputStream *NewStream(wxInputStream& stream) const wxOVERRIDE + { return new wxZlibInputStream(stream); } + wxFilterOutputStream *NewStream(wxOutputStream& stream) const wxOVERRIDE + { return new wxZlibOutputStream(stream, -1); } + wxFilterInputStream *NewStream(wxInputStream *stream) const wxOVERRIDE + { return new wxZlibInputStream(stream); } + wxFilterOutputStream *NewStream(wxOutputStream *stream) const wxOVERRIDE + { return new wxZlibOutputStream(stream, -1); } + + const wxChar * const *GetProtocols(wxStreamProtocolType type + = wxSTREAM_PROTOCOL) const wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxGzipClassFactory); +}; + +WXDLLIMPEXP_BASE wxVersionInfo wxGetZlibVersionInfo(); + +#endif + // wxUSE_ZLIB && wxUSE_STREAMS + +#endif + // _WX_WXZSTREAM_H__ + diff --git a/lib/wxWidgets/lib/vc_x64_lib/mswu/wx/msw/rcdefs.h b/lib/wxWidgets/lib/vc_x64_lib/mswu/wx/msw/rcdefs.h new file mode 100644 index 0000000..e09c613 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/mswu/wx/msw/rcdefs.h @@ -0,0 +1,51 @@ + + + + + + + + + + + +#ifndef _WX_RCDEFS_H +#define _WX_RCDEFS_H + + + + + + + + + + +#define WX_CPU_AMD64 + + + + + + + + + + + + + + + + + + + + + + + + + + +#endif diff --git a/lib/wxWidgets/lib/vc_x64_lib/mswu/wx/setup.h b/lib/wxWidgets/lib/vc_x64_lib/mswu/wx/setup.h new file mode 100644 index 0000000..b1d20d9 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/mswu/wx/setup.h @@ -0,0 +1,1836 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/setup.h +// Purpose: Configuration for the library +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SETUP_H_ +#define _WX_SETUP_H_ + +/* --- start common options --- */ +// ---------------------------------------------------------------------------- +// global settings +// ---------------------------------------------------------------------------- + +// define this to 0 when building wxBase library - this can also be done from +// makefile/project file overriding the value here +#ifndef wxUSE_GUI + #define wxUSE_GUI 1 +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// compatibility settings +// ---------------------------------------------------------------------------- + +// This setting determines the compatibility with 2.8 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_8 0 + +// This setting determines the compatibility with 3.0 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_3_0 1 + +// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when +// default system font is used for wxWindow::GetCharWidth/Height() instead of +// the current font. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxDIALOG_UNIT_COMPATIBILITY 0 + +// Provide unsafe implicit conversions in wxString to "const char*" or +// "std::string" (depending on wxUSE_STD_STRING_CONV_IN_WXSTRING value). +// +// Default is 1 but only for compatibility reasons, it is recommended to set +// this to 0 because converting wxString to a narrow (non-Unicode) string may +// fail unless a locale using UTF-8 encoding is used, which is never the case +// under MSW, for example, hence such conversions can result in silent data +// loss. +// +// Recommended setting: 0 +#define wxUSE_UNSAFE_WXSTRING_CONV 1 + +// If set to 1, enables "reproducible builds", i.e. build output should be +// exactly the same if the same build is redone again. As using __DATE__ and +// __TIME__ macros clearly makes the build irreproducible, setting this option +// to 1 disables their use in the library code. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_REPRODUCIBLE_BUILD 0 + +// ---------------------------------------------------------------------------- +// debugging settings +// ---------------------------------------------------------------------------- + +// wxDEBUG_LEVEL will be defined as 1 in wx/debug.h so normally there is no +// need to define it here. You may do it for two reasons: either completely +// disable/compile out the asserts in release version (then do it inside #ifdef +// NDEBUG) or, on the contrary, enable more asserts, including the usually +// disabled ones, in the debug build (then do it inside #ifndef NDEBUG) +// +// #ifdef NDEBUG +// #define wxDEBUG_LEVEL 0 +// #else +// #define wxDEBUG_LEVEL 2 +// #endif + +// wxHandleFatalExceptions() may be used to catch the program faults at run +// time and, instead of terminating the program with a usual GPF message box, +// call the user-defined wxApp::OnFatalException() function. If you set +// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. +// +// This setting is for Win32 only and can only be enabled if your compiler +// supports Win32 structured exception handling (currently only VC++ does) +// +// Default is 1 +// +// Recommended setting: 1 if your compiler supports it. +#define wxUSE_ON_FATAL_EXCEPTION 1 + +// Set this to 1 to be able to generate a human-readable (unlike +// machine-readable minidump created by wxCrashReport::Generate()) stack back +// trace when your program crashes using wxStackWalker +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_STACKWALKER 1 + +// Set this to 1 to compile in wxDebugReport class which allows you to create +// and optionally upload to your web site a debug report consisting of back +// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, it is compiled into a separate library so there +// is no overhead if you don't use it +#define wxUSE_DEBUGREPORT 1 + +// Generic comment about debugging settings: they are very useful if you don't +// use any other memory leak detection tools such as Purify/BoundsChecker, but +// are probably redundant otherwise. Also, Visual C++ CRT has the same features +// as wxWidgets memory debugging subsystem built in since version 5.0 and you +// may prefer to use it instead of built in memory debugging code because it is +// faster and more fool proof. +// +// Using VC++ CRT memory debugging is enabled by default in debug build (_DEBUG +// is defined) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) +// and if __NO_VC_CRTDBG__ is not defined. + +// The rest of the options in this section are obsolete and not supported, +// enable them at your own risk. + +// If 1, enables wxDebugContext, for writing error messages to file, etc. If +// __WXDEBUG__ is not defined, will still use the normal memory operators. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_CONTEXT 0 + +// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* +// __WXDEBUG__ is also defined. +// +// WARNING: this code may not work with all architectures, especially if +// alignment is an issue. This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 1 if you are not using a memory debugging tool, else 0 +#define wxUSE_MEMORY_TRACING 0 + +// In debug mode, cause new and delete to be redefined globally. +// If this causes problems (e.g. link errors which is a common problem +// especially if you use another library which also redefines the global new +// and delete), set this to 0. +// This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If +// this causes problems (e.g. link errors), set this to 0. You may need to set +// this to 0 if using templates (at least for VC++). This switch is currently +// ignored for MinGW/Cygwin. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_NEW_ALWAYS 0 + + +// ---------------------------------------------------------------------------- +// Unicode support +// ---------------------------------------------------------------------------- + +// This option is deprecated: the library should be always built in Unicode mode +// now, only set wxUSE_UNICODE to 0 to compile legacy code in ANSI mode if +// absolutely necessary -- updating it is strongly recommended as the ANSI mode +// will disappear completely in future wxWidgets releases. +#ifndef wxUSE_UNICODE + #define wxUSE_UNICODE 1 +#endif + +// ---------------------------------------------------------------------------- +// global features +// ---------------------------------------------------------------------------- + +// Compile library in exception-safe mode? If set to 1, the library will try to +// behave correctly in presence of exceptions (even though it still will not +// use the exceptions itself) and notify the user code about any unhandled +// exceptions. If set to 0, propagation of the exceptions through the library +// code will lead to undefined behaviour -- but the code itself will be +// slightly smaller and faster. +// +// Note that like wxUSE_THREADS this option is automatically set to 0 if +// wxNO_EXCEPTIONS is defined. +// +// Default is 1 +// +// Recommended setting: depends on whether you intend to use C++ exceptions +// in your own code (1 if you do, 0 if you don't) +#define wxUSE_EXCEPTIONS 1 + +// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI +// +// This feature is incomplete and experimental, please only enable it if +// you want to participate in its development. +// +// Recommended setting: 0 (unless you wish to try working on it). +#define wxUSE_EXTENDED_RTTI 0 + +// Support for message/error logging. This includes wxLogXXX() functions and +// wxLog and derived classes. Don't set this to 0 unless you really know what +// you are doing. +// +// Default is 1 +// +// Recommended setting: 1 (always) +#define wxUSE_LOG 1 + +// Recommended setting: 1 +#define wxUSE_LOGWINDOW 1 + +// Recommended setting: 1 +#define wxUSE_LOGGUI 1 + +// Recommended setting: 1 +#define wxUSE_LOG_DIALOG 1 + +// Support for command line parsing using wxCmdLineParser class. +// +// Default is 1 +// +// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) +#define wxUSE_CMDLINE_PARSER 1 + +// Support for multithreaded applications: if 1, compile in thread classes +// (thread.h) and make the library a bit more thread safe. Although thread +// support is quite stable by now, you may still consider recompiling the +// library without it if you have no use for it - this will result in a +// somewhat smaller and faster operation. +// +// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset +// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in +// build/msw/config.* file this value will have no effect. +// +// Default is 1 +// +// Recommended setting: 0 unless you do plan to develop MT applications +#define wxUSE_THREADS 1 + +// If enabled, compiles wxWidgets streams classes +// +// wx stream classes are used for image IO, process IO redirection, network +// protocols implementation and much more and so disabling this results in a +// lot of other functionality being lost. +// +// Default is 1 +// +// Recommended setting: 1 as setting it to 0 disables many other things +#define wxUSE_STREAMS 1 + +// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. +// Note that if the system's implementation does not support positional +// parameters, setting this to 1 forces the use of the wxWidgets implementation +// of wxVsnprintf. The standard vsnprintf() supports positional parameters on +// many Unix systems but usually doesn't under Windows. +// +// Positional parameters are very useful when translating a program since using +// them in formatting strings allow translators to correctly reorder the +// translated sentences. +// +// Default is 1 +// +// Recommended setting: 1 if you want to support multiple languages +#define wxUSE_PRINTF_POS_PARAMS 1 + +// Enable the use of compiler-specific thread local storage keyword, if any. +// This is used for wxTLS_XXX() macros implementation and normally should use +// the compiler-provided support as it's simpler and more efficient, but is +// disabled under Windows in wx/msw/chkconf.h as it can't be used if wxWidgets +// is used in a dynamically loaded Win32 DLL (i.e. using LoadLibrary()) under +// XP as this triggers a bug in compiler TLS support that results in crashes +// when any TLS variables are used. +// +// If you're absolutely sure that your build of wxWidgets is never going to be +// used in such situation, either because it's not going to be linked from any +// kind of plugin or because you only target Vista or later systems, you can +// set this to 2 to force the use of compiler TLS even under MSW. +// +// Default is 1 meaning that compiler TLS is used only if it's 100% safe. +// +// Recommended setting: 2 if you want to have maximal performance and don't +// care about the scenario described above. +#define wxUSE_COMPILER_TLS 1 + +// ---------------------------------------------------------------------------- +// Interoperability with the standard library. +// ---------------------------------------------------------------------------- + +// Set wxUSE_STL to 1 to enable maximal interoperability with the standard +// library, even at the cost of backwards compatibility. +// +// Default is 0 +// +// Recommended setting: 0 as the options below already provide a relatively +// good level of interoperability and changing this option arguably isn't worth +// diverging from the official builds of the library. +#define wxUSE_STL 0 + +// This is not a real option but is used as the default value for +// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS_COMPATIBLY. +// +// Set it to 0 if you want to disable the use of all standard classes +// completely for some reason. +#define wxUSE_STD_DEFAULT 1 + +// Use standard C++ containers where it can be done without breaking backwards +// compatibility. +// +// This provides better interoperability with the standard library, e.g. with +// this option on it's possible to insert std::vector<> into many wxWidgets +// containers directly. +// +// Default is 1. +// +// Recommended setting is 1 unless you want to avoid all dependencies on the +// standard library. +#define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT + +// Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<> +// and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but +// usually more limited) implementations are used which allows to avoid the +// dependency on the C++ run-time library. +// +// Default is 0 for compatibility reasons. +// +// Recommended setting: 1 unless compatibility with the official wxWidgets +// build and/or the existing code is a concern. +#define wxUSE_STD_CONTAINERS 0 + +// Use standard C++ streams if 1 instead of wx streams in some places. If +// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the +// standard streams library. +// +// Notice that enabling this does not replace wx streams with std streams +// everywhere, in a lot of places wx streams are used no matter what. +// +// Default is 1 if compiler supports it. +// +// Recommended setting: 1 if you use the standard streams anyhow and so +// dependency on the standard streams library is not a +// problem +#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT + +// Enable minimal interoperability with the standard C++ string class if 1. +// "Minimal" means that wxString can be constructed from std::string or +// std::wstring but can't be implicitly converted to them. You need to enable +// the option below for the latter. +// +// Default is 1 for most compilers. +// +// Recommended setting: 1 unless you want to ensure your program doesn't use +// the standard C++ library at all. +#define wxUSE_STD_STRING wxUSE_STD_DEFAULT + +// Make wxString as much interchangeable with std::[w]string as possible, in +// particular allow implicit conversion of wxString to either of these classes. +// This comes at a price (or a benefit, depending on your point of view) of not +// allowing implicit conversion to "const char *" and "const wchar_t *". +// +// Because a lot of existing code relies on these conversions, this option is +// disabled by default but can be enabled for your build if you don't care +// about compatibility. +// +// Default is 0 if wxUSE_STL has its default value or 1 if it is enabled. +// +// Recommended setting: 0 to remain compatible with the official builds of +// wxWidgets. +#define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL + +// ---------------------------------------------------------------------------- +// non GUI features selection +// ---------------------------------------------------------------------------- + +// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit +// integer which is implemented in terms of native 64 bit integers if any or +// uses emulation otherwise. +// +// This class is required by wxDateTime and so you should enable it if you want +// to use wxDateTime. For most modern platforms, it will use the native 64 bit +// integers in which case (almost) all of its functions are inline and it +// almost does not take any space, so there should be no reason to switch it +// off. +// +// Recommended setting: 1 +#define wxUSE_LONGLONG 1 + +// Set wxUSE_BASE64 to 1, to compile in Base64 support. This is required for +// storing binary data in wxConfig on most platforms. +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_BASE64 1 + +// Set this to 1 to be able to use wxEventLoop even in console applications +// (i.e. using base library only, without GUI). This is mostly useful for +// processing socket events but is also necessary to use timers in console +// applications +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_CONSOLE_EVENTLOOP 1 + +// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level +// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. +// +// Default is 1 +// +// Recommended setting: 1 (wxFile is highly recommended as it is required by +// i18n code, wxFileConfig and others) +#define wxUSE_FILE 1 +#define wxUSE_FFILE 1 + +// Use wxFSVolume class providing access to the configured/active mount points +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely disabled if you don't use it) +#define wxUSE_FSVOLUME 1 + +// Use wxSecretStore class for storing passwords using OS-specific facilities. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely disabled if you don't use it) +#define wxUSE_SECRETSTORE 1 + +// Allow the use of the OS built-in spell checker in wxTextCtrl. +// +// Default is 1, the corresponding wxTextCtrl functions simply won't do +// anything if the functionality is not supported by the current platform. +// +// Recommended setting: 1 unless you want to save a tiny bit of code. +#define wxUSE_SPELLCHECK 1 + +// Use wxStandardPaths class which allows to retrieve some standard locations +// in the file system +// +// Default is 1 +// +// Recommended setting: 1 (may be disabled to save space, but not much) +#define wxUSE_STDPATHS 1 + +// use wxTextBuffer class: required by wxTextFile +#define wxUSE_TEXTBUFFER 1 + +// use wxTextFile class: requires wxFile and wxTextBuffer, required by +// wxFileConfig +#define wxUSE_TEXTFILE 1 + +// i18n support: _() macro, wxLocale class. +#define wxUSE_INTL 1 + +// Provide wxFoo_l() functions similar to standard foo() functions but taking +// an extra locale parameter. +// +// Notice that this is fully implemented only for the systems providing POSIX +// xlocale support or Microsoft Visual C++ >= 8 (which provides proprietary +// almost-equivalent of xlocale functions), otherwise wxFoo_l() functions will +// only work for the current user locale and "C" locale. You can use +// wxHAS_XLOCALE_SUPPORT to test whether the full support is available. +// +// Default is 1 +// +// Recommended setting: 1 but may be disabled if you are writing programs +// running only in C locale anyhow +#define wxUSE_XLOCALE 1 + +// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which +// allow to manipulate dates, times and time intervals. +// +// Requires: wxUSE_LONGLONG +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_DATETIME 1 + +// Set wxUSE_TIMER to 1 to compile wxTimer class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_TIMER 1 + +// Use wxStopWatch class. +// +// Default is 1 +// +// Recommended setting: 1 (needed by wxSocket) +#define wxUSE_STOPWATCH 1 + +// Set wxUSE_FSWATCHER to 1 if you want to enable wxFileSystemWatcher +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_FSWATCHER 1 + +// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes +// which allow the application to store its settings in the persistent +// storage. Setting this to 1 will also enable on-demand creation of the +// global config object in wxApp. +// +// See also wxUSE_CONFIG_NATIVE below. +// +// Recommended setting: 1 +#define wxUSE_CONFIG 1 + +// If wxUSE_CONFIG is 1, you may choose to use either the native config +// classes under Windows (using the registry) or the portable text file +// format used by the config classes under Unix. +// +// Default is 1 to use native classes. Note that you may still use +// wxFileConfig even if you set this to 1 - just the config object created by +// default for the applications needs will be a wxRegConfig or wxIniConfig and +// not wxFileConfig. +// +// Recommended setting: 1 +#define wxUSE_CONFIG_NATIVE 1 + +// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows +// to connect/disconnect from the network and be notified whenever the dial-up +// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DIALUP_MANAGER 1 + +// Compile in classes for run-time DLL loading and function calling. +// Required by wxUSE_DIALUP_MANAGER. +// +// This setting is for Win32 only +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DYNLIB_CLASS 1 + +// experimental, don't use for now +#define wxUSE_DYNAMIC_LOADER 1 + +// Set to 1 to use socket classes +#define wxUSE_SOCKETS 1 + +// Set to 1 to use ipv6 socket classes (requires wxUSE_SOCKETS) +// +// Default is 1. +// +// Recommended setting: 1. +#define wxUSE_IPV6 1 + +// Set to 1 to enable virtual file systems (required by wxHTML) +#define wxUSE_FILESYSTEM 1 + +// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ZIP 1 + +// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ARCHIVE 1 + +// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_INET 1 + +// wxArchive classes for accessing archives such as zip and tar +#define wxUSE_ARCHIVE_STREAMS 1 + +// Set to 1 to compile wxZipInput/OutputStream classes. +#define wxUSE_ZIPSTREAM 1 + +// Set to 1 to compile wxTarInput/OutputStream classes. +#define wxUSE_TARSTREAM 1 + +// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by +// wxUSE_LIBPNG +#define wxUSE_ZLIB 1 + +// Set to 1 if liblzma is available to enable wxLZMA{Input,Output}Stream +// classes. +// +// Notice that if you enable this build option when not using configure or +// CMake, you need to ensure that liblzma headers and libraries are available +// (i.e. by building the library yourself or downloading its binaries) and can +// be found, either by copying them to one of the locations searched by the +// compiler/linker by default (e.g. any of the directories in the INCLUDE or +// LIB environment variables, respectively, when using MSVC) or modify the +// make- or project files to add references to these directories. +// +// Default is 0 under MSW, auto-detected by configure. +// +// Recommended setting: 1 if you need LZMA compression. +#define wxUSE_LIBLZMA 0 + +// If enabled, the code written by Apple will be used to write, in a portable +// way, float on the disk. See extended.c for the license which is different +// from wxWidgets one. +// +// Default is 1. +// +// Recommended setting: 1 unless you don't like the license terms (unlikely) +#define wxUSE_APPLE_IEEE 1 + +// Joystick support class +#define wxUSE_JOYSTICK 1 + +// wxFontEnumerator class +#define wxUSE_FONTENUM 1 + +// wxFontMapper class +#define wxUSE_FONTMAP 1 + +// wxMimeTypesManager class +#define wxUSE_MIMETYPE 1 + +// wxWebRequest allows usage of system libraries for HTTP(S) requests. +// +// Note that for wxWebRequest to be built, at least one of its backends must be +// available. Under MSW and macOS this will always be the case unless +// explicitly disabled. +// +// Default is 1 +// +// Recommended setting: 1, setting it to 0 may be useful to avoid dependencies +// on libcurl on Unix systems. +#define wxUSE_WEBREQUEST 1 + +// wxWebRequest backend based on NSURLSession +// +// Default is 1 under macOS. +// +// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, +// otherwise wxWebRequest won't be available at all under Mac. +#ifdef __APPLE__ +#define wxUSE_WEBREQUEST_URLSESSION wxUSE_WEBREQUEST +#else +#define wxUSE_WEBREQUEST_URLSESSION 0 +#endif + +// wxWebRequest backend based on libcurl, can be used under all platforms. +// +// Default is 0 for MSW and macOS, detected automatically when using configure. +// +// Recommended setting: 0 on Windows and macOS, otherwise 1 as it is required +// for wxWebRequest to be available at all. +#define wxUSE_WEBREQUEST_CURL 0 + +// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP +// or wxURL you need to set this to 1. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_PROTOCOL 1 + +// The settings for the individual URL schemes +#define wxUSE_PROTOCOL_FILE 1 +#define wxUSE_PROTOCOL_FTP 1 +#define wxUSE_PROTOCOL_HTTP 1 + +// Define this to use wxURL class. +#define wxUSE_URL 1 + +// Define this to use native platform url and protocol support. +// Currently valid only for MS-Windows. +// Note: if you set this to 1, you can open ftp/http/gopher sites +// and obtain a valid input stream for these sites +// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. +// Doing so reduces the code size. +// +// This code is experimental and subject to change. +#define wxUSE_URL_NATIVE 0 + +// Support for wxVariant class used in several places throughout the library, +// notably in wxDataViewCtrl API. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size as much as +// possible in which case setting this to 0 can gain up to 100KB. +#define wxUSE_VARIANT 1 + +// Support for wxAny class, the successor for wxVariant. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size by a small amount, +// or your compiler cannot for some reason cope with complexity of templates used. +#define wxUSE_ANY 1 + +// Support for regular expression matching via wxRegEx class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_REGEX 1 + +// wxSystemOptions class +#define wxUSE_SYSTEM_OPTIONS 1 + +// wxSound class +#define wxUSE_SOUND 1 + +// Use wxMediaCtrl +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_MEDIACTRL 1 + +// Use wxWidget's XRC XML-based resource system. Recommended. +// +// Default is 1 +// +// Recommended setting: 1 (requires wxUSE_XML) +#define wxUSE_XRC 1 + +// XML parsing classes. +// +// Default is 1 +// +// Recommended setting: 1 (required by XRC) +#define wxUSE_XML 1 + +// Use wxWidget's AUI docking system +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_AUI 1 + +// Use wxWidget's Ribbon classes for interfaces +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_RIBBON 1 + +// Use wxPropertyGrid. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_PROPGRID 1 + +// Use wxStyledTextCtrl, a wxWidgets Scintilla wrapper. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STC 1 + +// Use wxWidget's web viewing classes +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_WEBVIEW 1 + +// Use the IE wxWebView backend +// +// Default is 1 on MSW +// +// Recommended setting: 1 +#ifdef __WXMSW__ +#define wxUSE_WEBVIEW_IE 1 +#else +#define wxUSE_WEBVIEW_IE 0 +#endif + +// Use the Edge (Chromium) wxWebView backend (Requires WebView2 SDK) +// +// Default is 0 because WebView2 is not always available, set it to 1 if you do have it. +// +// Recommended setting: 1 when building for Windows with WebView2 SDK +#define wxUSE_WEBVIEW_EDGE 0 + +// Use the Edge (Chromium) wxWebView backend without loader DLL +// +// Default is 0, set it to 1 if you don't want to depend on WebView2Loader.dll. +// +// Recommended setting: 0 +#define wxUSE_WEBVIEW_EDGE_STATIC 0 + +// Use the WebKit wxWebView backend +// +// Default is 1 on GTK and OSX +// +// Recommended setting: 1 +#if (defined(__WXGTK__) && !defined(__WXGTK3__)) || defined(__WXOSX__) +#define wxUSE_WEBVIEW_WEBKIT 1 +#else +#define wxUSE_WEBVIEW_WEBKIT 0 +#endif + +// Use the WebKit2 wxWebView backend +// +// Default is 1 on GTK3 +// +// Recommended setting: 1 +#if defined(__WXGTK3__) +#define wxUSE_WEBVIEW_WEBKIT2 1 +#else +#define wxUSE_WEBVIEW_WEBKIT2 0 +#endif + +// Enable wxGraphicsContext and related classes for a modern 2D drawing API. +// +// Default is 1 except if you're using a compiler without support for GDI+ +// under MSW, i.e. gdiplus.h and related headers (MSVC and MinGW >= 4.8 are +// known to have them). For other compilers (e.g. older mingw32) you may need +// to install the headers (and just the headers) yourself. If you do, change +// the setting below manually. +// +// Recommended setting: 1 if supported by the compilation environment + +// Notice that we can't use wxCHECK_VISUALC_VERSION() nor wxCHECK_GCC_VERSION() +// here as this file is included from wx/platform.h before they're defined. +#if defined(_MSC_VER) || \ + (defined(__MINGW32__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 8)) +#define wxUSE_GRAPHICS_CONTEXT 1 +#else +// Disable support for other Windows compilers, enable it if your compiler +// comes with new enough SDK or you installed the headers manually. +// +// Notice that this will be set by configure under non-Windows platforms +// anyhow so the value there is not important. +#define wxUSE_GRAPHICS_CONTEXT 0 +#endif + +// Enable wxGraphicsContext implementation using Cairo library. +// +// This is not needed under Windows and detected automatically by configure +// under other systems, however you may set this to 1 manually if you installed +// Cairo under Windows yourself and prefer to use it instead the native GDI+ +// implementation. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_CAIRO 0 + + +// ---------------------------------------------------------------------------- +// Individual GUI controls +// ---------------------------------------------------------------------------- + +// You must set wxUSE_CONTROLS to 1 if you are using any controls at all +// (without it, wxControl class is not compiled) +// +// Default is 1 +// +// Recommended setting: 1 (don't change except for very special programs) +#define wxUSE_CONTROLS 1 + +// Support markup in control labels, i.e. provide wxControl::SetLabelMarkup(). +// Currently markup is supported only by a few controls and only some ports but +// their number will increase with time. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you want to save on code size) +#define wxUSE_MARKUP 1 + +// wxPopupWindow class is a top level transient window. It is currently used +// to implement wxTipWindow +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) +#define wxUSE_POPUPWIN 1 + +// wxTipWindow allows to implement the custom tooltips, it is used by the +// context help classes. Requires wxUSE_POPUPWIN. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0) +#define wxUSE_TIPWINDOW 1 + +// Each of the settings below corresponds to one wxWidgets control. They are +// all switched on by default but may be disabled if you are sure that your +// program (including any standard dialogs it can show!) doesn't need them and +// if you desperately want to save some space. If you use any of these you must +// set wxUSE_CONTROLS as well. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_ACTIVITYINDICATOR 1 // wxActivityIndicator +#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl +#define wxUSE_BANNERWINDOW 1 // wxBannerWindow +#define wxUSE_BUTTON 1 // wxButton +#define wxUSE_BMPBUTTON 1 // wxBitmapButton +#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl +#define wxUSE_CHECKBOX 1 // wxCheckBox +#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) +#define wxUSE_CHOICE 1 // wxChoice +#define wxUSE_COLLPANE 1 // wxCollapsiblePane +#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl +#define wxUSE_COMBOBOX 1 // wxComboBox +#define wxUSE_COMMANDLINKBUTTON 1 // wxCommandLinkButton +#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl +#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl +#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl +#define wxUSE_EDITABLELISTBOX 1 // wxEditableListBox +#define wxUSE_FILECTRL 1 // wxFileCtrl +#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl +#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl +#define wxUSE_GAUGE 1 // wxGauge +#define wxUSE_HEADERCTRL 1 // wxHeaderCtrl +#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl +#define wxUSE_LISTBOX 1 // wxListBox +#define wxUSE_LISTCTRL 1 // wxListCtrl +#define wxUSE_RADIOBOX 1 // wxRadioBox +#define wxUSE_RADIOBTN 1 // wxRadioButton +#define wxUSE_RICHMSGDLG 1 // wxRichMessageDialog +#define wxUSE_SCROLLBAR 1 // wxScrollBar +#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl +#define wxUSE_SLIDER 1 // wxSlider +#define wxUSE_SPINBTN 1 // wxSpinButton +#define wxUSE_SPINCTRL 1 // wxSpinCtrl +#define wxUSE_STATBOX 1 // wxStaticBox +#define wxUSE_STATLINE 1 // wxStaticLine +#define wxUSE_STATTEXT 1 // wxStaticText +#define wxUSE_STATBMP 1 // wxStaticBitmap +#define wxUSE_TEXTCTRL 1 // wxTextCtrl +#define wxUSE_TIMEPICKCTRL 1 // wxTimePickerCtrl +#define wxUSE_TOGGLEBTN 1 // requires wxButton +#define wxUSE_TREECTRL 1 // wxTreeCtrl +#define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl + +// Use generic version of wxDataViewCtrl even if a native one is available? +// +// Default is 1. +// +// Recommended setting: 1, but can be set to 0 if your program is affected by +// the native control limitations. +#define wxUSE_NATIVE_DATAVIEWCTRL 1 + +// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR +// below either wxStatusBar95 or a generic wxStatusBar will be used. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STATUSBAR 1 + +// Two status bar implementations are available under Win32: the generic one +// or the wrapper around native control. For native look and feel the native +// version should be used. +// +// Default is 1 for the platforms where native status bar is supported. +// +// Recommended setting: 1 (there is no advantage in using the generic one) +#define wxUSE_NATIVE_STATUSBAR 1 + +// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar +// classes at all. Otherwise, use the native toolbar class unless +// wxUSE_TOOLBAR_NATIVE is 0. +// +// Default is 1 for all settings. +// +// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. +#define wxUSE_TOOLBAR 1 +#define wxUSE_TOOLBAR_NATIVE 1 + +// wxNotebook is a control with several "tabs" located on one of its sides. It +// may be used to logically organise the data presented to the user instead of +// putting everything in one huge dialog. It replaces wxTabControl and related +// classes of wxWin 1.6x. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTEBOOK 1 + +// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_LISTBOOK 1 + +// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CHOICEBOOK 1 + +// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TREEBOOK 1 + +// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of +// tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLBOOK 1 + +// wxTaskBarIcon is a small notification icon shown in the system toolbar or +// dock. +// +// Default is 1. +// +// Recommended setting: 1 (but can be set to 0 if you don't need it) +#define wxUSE_TASKBARICON 1 + +// wxGrid class +// +// Default is 1, set to 0 to cut down compilation time and binaries size if you +// don't use it. +// +// Recommended setting: 1 +// +#define wxUSE_GRID 1 + +// wxMiniFrame class: a frame with narrow title bar +// +// Default is 1. +// +// Recommended setting: 1 (it doesn't cost almost anything) +#define wxUSE_MINIFRAME 1 + +// wxComboCtrl and related classes: combobox with custom popup window and +// not necessarily a listbox. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it +// is used by wxComboBox +#define wxUSE_COMBOCTRL 1 + +// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox +// items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0, except where it is +// needed as a base class for generic wxBitmapComboBox. +#define wxUSE_ODCOMBOBOX 1 + +// wxBitmapComboBox is a combobox that can have images in front of text items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 +#define wxUSE_BITMAPCOMBOBOX 1 + +// wxRearrangeCtrl is a wxCheckListBox with two buttons allowing to move items +// up and down in it. It is also used as part of wxRearrangeDialog. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 (currently used only by +// wxHeaderCtrl) +#define wxUSE_REARRANGECTRL 1 + +// wxAddRemoveCtrl is a composite control containing a control showing some +// items (e.g. wxListBox, wxListCtrl, wxTreeCtrl, wxDataViewCtrl, ...) and "+"/ +// "-" buttons allowing to add and remove items to/from the control. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 if you don't need it (not +// used by the library itself). +#define wxUSE_ADDREMOVECTRL 1 + +// ---------------------------------------------------------------------------- +// Miscellaneous GUI stuff +// ---------------------------------------------------------------------------- + +// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) +#define wxUSE_ACCEL 1 + +// Use the standard art provider. The icons returned by this provider are +// embedded into the library as XPMs so disabling it reduces the library size +// somewhat but this should only be done if you use your own custom art +// provider returning the icons or never use any icons not provided by the +// native art provider (which might not be implemented at all for some +// platforms) or by the Tango icons provider (if it's not itself disabled +// below). +// +// Default is 1. +// +// Recommended setting: 1 unless you use your own custom art provider. +#define wxUSE_ARTPROVIDER_STD 1 + +// Use art provider providing Tango icons: this art provider has higher quality +// icons than the default one. It uses SVG format which allows much better scaling +// then when bitmaps are used, at the expense of somewhat larger library size. +// +// Default is 1 under non-GTK ports. Under wxGTK the native art provider using +// the GTK+ stock icons replaces it so it is normally not necessary. +// +// Recommended setting: 1 but can be turned off to reduce the library size. +#define wxUSE_ARTPROVIDER_TANGO 1 + +// Hotkey support (currently Windows and macOS only) +#define wxUSE_HOTKEY 1 + +// Use wxCaret: a class implementing a "cursor" in a text control (called caret +// under Windows). +// +// Default is 1. +// +// Recommended setting: 1 (can be safely set to 0, not used by the library) +#define wxUSE_CARET 1 + +// Use wxDisplay class: it allows enumerating all displays on a system and +// their geometries as well as finding the display on which the given point or +// window lies. +// +// Default is 1. +// +// Recommended setting: 1 if you need it, can be safely set to 0 otherwise +#define wxUSE_DISPLAY 1 + +// Miscellaneous geometry code: needed for Canvas library +#define wxUSE_GEOMETRY 1 + +// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and +// wxListCtrl. +// +// Default is 1. +// +// Recommended setting: 1 (set it to 0 if you don't use any of the controls +// enumerated above, then this class is mostly useless too) +#define wxUSE_IMAGLIST 1 + +// Use wxInfoBar class. +// +// Default is 1. +// +// Recommended setting: 1 (but can be disabled without problems as nothing +// depends on it) +#define wxUSE_INFOBAR 1 + +// Use wxMenu, wxMenuItem. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUS 1 + +// Use wxMenuBar. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUBAR 1 + +// Use wxNotificationMessage. +// +// wxNotificationMessage allows to show non-intrusive messages to the user +// using balloons, banners, popups or whatever is the appropriate method for +// the current platform. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTIFICATION_MESSAGE 1 + +// wxPreferencesEditor provides a common API for different ways of presenting +// the standard "Preferences" or "Properties" dialog under different platforms +// (e.g. some use modal dialogs, some use modeless ones; some apply the changes +// immediately while others require an explicit "Apply" button). +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_PREFERENCES_EDITOR 1 + +// wxFont::AddPrivateFont() allows to use fonts not installed on the system by +// loading them from font files during run-time. +// +// Default is 1 except under Unix where it will be turned off by configure if +// the required libraries are not available or not new enough. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it and +// want to avoid extra dependencies under Linux, for example). +#define wxUSE_PRIVATE_FONTS 1 + +// wxRichToolTip is a customizable tooltip class which has more functionality +// than the stock (but native, unlike this class) wxToolTip. +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely set to 0 if you don't need it) +#define wxUSE_RICHTOOLTIP 1 + +// Use wxSashWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SASH 1 + +// Use wxSplitterWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SPLITTER 1 + +// Use wxToolTip and wxWindow::Set/GetToolTip() methods. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLTIPS 1 + +// wxValidator class and related methods +#define wxUSE_VALIDATORS 1 + +// Use reference counted ID management: this means that wxWidgets will track +// the automatically allocated ids (those used when you use wxID_ANY when +// creating a window, menu or toolbar item &c) instead of just supposing that +// the program never runs out of them. This is mostly useful only under wxMSW +// where the total ids range is limited to SHRT_MIN..SHRT_MAX and where +// long-running programs can run into problems with ids reuse without this. On +// the other platforms, where the ids have the full int range, this shouldn't +// be necessary. +#ifdef __WXMSW__ +#define wxUSE_AUTOID_MANAGEMENT 1 +#else +#define wxUSE_AUTOID_MANAGEMENT 0 +#endif + +// ---------------------------------------------------------------------------- +// common dialogs +// ---------------------------------------------------------------------------- + +// Use common dialogs (e.g. file selector, printer dialog). Switching this off +// also switches off the printing architecture and interactive wxPrinterDC. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COMMON_DIALOGS 1 + +// wxBusyInfo displays window with message when app is busy. Works in same way +// as wxBusyCursor +#define wxUSE_BUSYINFO 1 + +// Use single/multiple choice dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_CHOICEDLG 1 + +// Use colour picker dialog +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COLOURDLG 1 + +// wxDirDlg class for getting a directory name from user +#define wxUSE_DIRDLG 1 + +// Use file open/save dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in many places in the library itself) +#define wxUSE_FILEDLG 1 + +// Use find/replace dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely set to 0) +#define wxUSE_FINDREPLDLG 1 + +// Use font picker dialog +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_FONTDLG 1 + +// Use wxMessageDialog and wxMessageBox. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_MSGDLG 1 + +// progress dialog class for lengthy operations +#define wxUSE_PROGRESSDLG 1 + +// Set to 0 to disable the use of the native progress dialog (currently only +// available under MSW and suffering from some bugs there, hence this option). +#define wxUSE_NATIVE_PROGRESSDLG 1 + +// support for startup tips (wxShowTip &c) +#define wxUSE_STARTUP_TIPS 1 + +// text entry dialog and wxGetTextFromUser function +#define wxUSE_TEXTDLG 1 + +// number entry dialog +#define wxUSE_NUMBERDLG 1 + +// credential entry dialog +#define wxUSE_CREDENTIALDLG 1 + +// splash screen class +#define wxUSE_SPLASH 1 + +// wizards +#define wxUSE_WIZARDDLG 1 + +// Compile in wxAboutBox() function showing the standard "About" dialog. +// +// Default is 1 +// +// Recommended setting: 1 but can be set to 0 to save some space if you don't +// use this function +#define wxUSE_ABOUTDLG 1 + +// wxFileHistory class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_FILE_HISTORY 1 + +// ---------------------------------------------------------------------------- +// Metafiles support +// ---------------------------------------------------------------------------- + +// Windows supports the graphics format known as metafile which, though not +// portable, is widely used under Windows and so is supported by wxWidgets +// (under Windows only, of course). Both the so-called "Window MetaFiles" or +// WMFs, and "Enhanced MetaFiles" or EMFs are supported in wxWin and, by +// default, EMFs will be used. This may be changed by setting +// wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting wxUSE_ENH_METAFILE to 0. +// You may also set wxUSE_METAFILE to 0 to not compile in any metafile +// related classes at all. +// +// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. +// +// Recommended setting: default or 0 for everything for portable programs. +#define wxUSE_METAFILE 1 +#define wxUSE_ENH_METAFILE 1 +#define wxUSE_WIN_METAFILES_ALWAYS 0 + +// ---------------------------------------------------------------------------- +// Big GUI components +// ---------------------------------------------------------------------------- + +// Set to 0 to disable MDI support. +// +// Requires wxUSE_NOTEBOOK under platforms other than MSW. +// +// Default is 1. +// +// Recommended setting: 1, can be safely set to 0. +#define wxUSE_MDI 1 + +// Set to 0 to disable document/view architecture +#define wxUSE_DOC_VIEW_ARCHITECTURE 1 + +// Set to 0 to disable MDI document/view architecture +// +// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE +#define wxUSE_MDI_ARCHITECTURE 1 + +// Set to 0 to disable print/preview architecture code +#define wxUSE_PRINTING_ARCHITECTURE 1 + +// wxHTML allows displaying simple HTML. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_HTML 1 + +// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL +// headers and libraries to be able to compile the library with wxUSE_GLCANVAS +// set to 1 and, under Windows, also to add opengl32.lib and glu32.lib to the +// list of libraries used to link your application when linking to wxWidgets +// statically (although this is done implicitly for Microsoft Visual C++ users). +// +// Default is 1. +// +// Recommended setting: 1 if you intend to use OpenGL, can be safely set to 0 +// otherwise. +#define wxUSE_GLCANVAS 1 + +// Setting wxUSE_GLCANVAS_EGL to 1 enables OpenGL EGL backend. This will be +// automatically enabled if EGL support is detected. EGL support is only +// available under Unix platforms. +// +// Default is 0. +// +#define wxUSE_GLCANVAS_EGL 0 + +// wxRichTextCtrl allows editing of styled text. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 if you want compile a +// smaller library. +#define wxUSE_RICHTEXT 1 + +// ---------------------------------------------------------------------------- +// Data transfer +// ---------------------------------------------------------------------------- + +// Use wxClipboard class for clipboard copy/paste. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CLIPBOARD 1 + +// Use wxDataObject and related classes. Needed for clipboard and OLE drag and +// drop +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DATAOBJ 1 + +// Use wxDropTarget and wxDropSource classes for drag and drop (this is +// different from "built in" drag and drop in wxTreeCtrl which is always +// available). Requires wxUSE_DATAOBJ. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DRAG_AND_DROP 1 + +// Use wxAccessible for enhanced and customisable accessibility. +// Depends on wxUSE_OLE on MSW. +// +// Default is 1 on MSW, 0 elsewhere. +// +// Recommended setting (at present): 1 (MSW-only) +#ifdef __WXMSW__ +#define wxUSE_ACCESSIBILITY 1 +#else +#define wxUSE_ACCESSIBILITY 0 +#endif + +// ---------------------------------------------------------------------------- +// miscellaneous settings +// ---------------------------------------------------------------------------- + +// wxSingleInstanceChecker class allows to verify at startup if another program +// instance is running. +// +// Default is 1 +// +// Recommended setting: 1 (the class is tiny, disabling it won't save much +// space) +#define wxUSE_SNGLINST_CHECKER 1 + +#define wxUSE_DRAGIMAGE 1 + +#define wxUSE_IPC 1 + // 0 for no interprocess comms +#define wxUSE_HELP 1 + // 0 for no help facility + +// Should we use MS HTML help for wxHelpController? If disabled, neither +// wxCHMHelpController nor wxBestHelpController are available. +// +// Default is 1 under MSW, 0 is always used for the other platforms. +// +// Recommended setting: 1, only set to 0 if you have trouble compiling +// wxCHMHelpController (could be a problem with really ancient compilers) +#define wxUSE_MS_HTML_HELP 1 + + +// Use wxHTML-based help controller? +#define wxUSE_WXHTML_HELP 1 + +#define wxUSE_CONSTRAINTS 1 + // 0 for no window layout constraint system + +#define wxUSE_SPLINES 1 + // 0 for no splines + +#define wxUSE_MOUSEWHEEL 1 + // Include mouse wheel support + +// Compile wxUIActionSimulator class? +#define wxUSE_UIACTIONSIMULATOR 1 + +// ---------------------------------------------------------------------------- +// wxDC classes for various output formats +// ---------------------------------------------------------------------------- + +// Set to 1 for PostScript device context. +#define wxUSE_POSTSCRIPT 0 + +// Set to 1 to use font metric files in GetTextExtent +#define wxUSE_AFM_FOR_POSTSCRIPT 1 + +// Set to 1 to compile in support for wxSVGFileDC, a wxDC subclass which allows +// to create files in SVG (Scalable Vector Graphics) format. +#define wxUSE_SVG 1 + +// Should wxDC provide SetTransformMatrix() and related methods? +// +// Default is 1 but can be set to 0 if this functionality is not used. Notice +// that currently wxMSW, wxGTK3 support this for wxDC and all platforms support +// this for wxGCDC so setting this to 0 doesn't change much if neither of these +// is used (although it will still save a few bytes probably). +// +// Recommended setting: 1. +#define wxUSE_DC_TRANSFORM_MATRIX 1 + +// ---------------------------------------------------------------------------- +// image format support +// ---------------------------------------------------------------------------- + +// wxImage supports many different image formats which can be configured at +// compile-time. BMP is always supported, others are optional and can be safely +// disabled if you don't plan to use images in such format sometimes saving +// substantial amount of code in the final library. +// +// Some formats require an extra library (e.g. libpng) which is always included in +// wxWidgets sources but some build systems (cmake, configure) can be configured to +// to use the system or user-provided version. +// +// Set to 1 for wxImage support (recommended). +#define wxUSE_IMAGE 1 + +// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. +#define wxUSE_LIBPNG 1 + +// Set to 1 for JPEG format support (requires libjpeg) +#define wxUSE_LIBJPEG 1 + +// Set to 1 for TIFF format support (requires libtiff) +#define wxUSE_LIBTIFF 1 + +// Set to 1 for SVG rasterizing support using nanosvg +#define wxUSE_NANOSVG 1 + +// Set to 1 to use external nanosvg library when wxUSE_NANOSVG is enabled +#define wxUSE_NANOSVG_EXTERNAL 0 + +// Set to 1 for TGA format support (loading only) +#define wxUSE_TGA 1 + +// Set to 1 for GIF format support +#define wxUSE_GIF 1 + +// Set to 1 for PNM format support +#define wxUSE_PNM 1 + +// Set to 1 for PCX format support +#define wxUSE_PCX 1 + +// Set to 1 for IFF format support (Amiga format) +#define wxUSE_IFF 0 + +// Set to 1 for XPM format support +#define wxUSE_XPM 1 + +// Set to 1 for MS Icons and Cursors format support +#define wxUSE_ICO_CUR 1 + +// Set to 1 to compile in wxPalette class +#define wxUSE_PALETTE 1 + +// ---------------------------------------------------------------------------- +// wxUniversal-only options +// ---------------------------------------------------------------------------- + +// Set to 1 to enable compilation of all themes, this is the default +#define wxUSE_ALL_THEMES 1 + +// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES +// is unset, if it is set these options are not used; notice that metal theme +// uses Win32 one +#define wxUSE_THEME_GTK 0 +#define wxUSE_THEME_METAL 0 +#define wxUSE_THEME_MONO 0 +#define wxUSE_THEME_WIN32 0 + +/* --- end common options --- */ + +/* --- start MSW options --- */ +// ---------------------------------------------------------------------------- +// Windows-specific backends choices +// ---------------------------------------------------------------------------- + +// The options here are only taken into account if wxUSE_GRAPHICS_CONTEXT is 1. + +// Enable support for GDI+-based implementation of wxGraphicsContext. +// +// Default is 1. +// +// Recommended setting: 1 if you need to support XP, as Direct2D is not +// available there. +#define wxUSE_GRAPHICS_GDIPLUS wxUSE_GRAPHICS_CONTEXT + +// Enable support for Direct2D-based implementation of wxGraphicsContext. +// +// Default is 1 for compilers which support it, i.e. VC10+ currently. If you +// use an earlier MSVC version or another compiler and installed the necessary +// SDK components manually, you need to change this setting. +// +// Recommended setting: 1 for faster and better quality graphics under Windows +// 7 and later systems (if wxUSE_GRAPHICS_GDIPLUS is also enabled, earlier +// systems will fall back on using GDI+). +#if defined(_MSC_VER) && _MSC_VER >= 1600 + #define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT +#else + #define wxUSE_GRAPHICS_DIRECT2D 0 +#endif + +// wxWebRequest backend based on WinHTTP. +// +// This is only taken into account if wxUSE_WEBREQUEST==1. +// +// Default is 1 if supported by the compiler (MSVS or MinGW64). +// +// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, +// otherwise wxWebRequest won't be available at all. +#define wxUSE_WEBREQUEST_WINHTTP 1 + +// ---------------------------------------------------------------------------- +// Windows-only settings +// ---------------------------------------------------------------------------- + +// Set this to 1 for generic OLE support: this is required for drag-and-drop, +// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and +// can't compile/doesn't have the OLE headers. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_OLE 1 + +// Set this to 1 to enable wxAutomationObject class. +// +// Default is 1. +// +// Recommended setting: 1 if you need to control other applications via OLE +// Automation, can be safely set to 0 otherwise +#define wxUSE_OLE_AUTOMATION 1 + +// Set this to 1 to enable wxActiveXContainer class allowing to embed OLE +// controls in wx. +// +// Default is 1. +// +// Recommended setting: 1, required by wxMediaCtrl +#define wxUSE_ACTIVEX 1 + +// Enable WinRT support +// +// Default is 1 for compilers which support it, i.e. VS2012+ currently. If you +// use an earlier MSVC version or another compiler and installed the necessary +// SDK components manually, you need to change this setting. +// +// Recommended setting: 1 +#if defined(_MSC_VER) && _MSC_VER >= 1700 && !defined(_USING_V110_SDK71_) + #define wxUSE_WINRT 1 +#else + #define wxUSE_WINRT 0 +#endif + +// wxDC caching implementation +#define wxUSE_DC_CACHEING 1 + +// Set this to 1 to enable wxDIB class used internally for manipulating +// wxBitmap data. +// +// Default is 1, set it to 0 only if you don't use wxImage either +// +// Recommended setting: 1 (without it conversion to/from wxImage won't work) +#define wxUSE_WXDIB 1 + +// Set to 0 to disable PostScript print/preview architecture code under Windows +// (just use Windows printing). +#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1 + +// Set this to 1 to compile in wxRegKey class. +// +// Default is 1 +// +// Recommended setting: 1, this is used internally by wx in a few places +#define wxUSE_REGKEY 1 + +// Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH +// which allows to put more than ~32Kb of text in it even under Win9x (NT +// doesn't have such limitation). +// +// Default is 1 for compilers which support it +// +// Recommended setting: 1, only set it to 0 if your compiler doesn't have +// or can't compile +#define wxUSE_RICHEDIT 1 + +// Set this to 1 to use extra features of richedit v2 and later controls +// +// Default is 1 for compilers which support it +// +// Recommended setting: 1 +#define wxUSE_RICHEDIT2 1 + +// Set this to 1 to enable support for the owner-drawn menu and listboxes. This +// is required by wxUSE_CHECKLISTBOX. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 for a small library size reduction +#define wxUSE_OWNER_DRAWN 1 + +// Set this to 1 to enable MSW-specific wxTaskBarIcon::ShowBalloon() method. It +// is required by native wxNotificationMessage implementation. +// +// Default is 1 but disabled in wx/msw/chkconf.h if SDK is too old to contain +// the necessary declarations. +// +// Recommended setting: 1, set to 0 for a tiny library size reduction +#define wxUSE_TASKBARICON_BALLOONS 1 + +// Set this to 1 to enable following functionality added in Windows 7: thumbnail +// representations, thumbnail toolbars, notification and status overlays, +// progress indicators and jump lists. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 for a tiny library size reduction +#define wxUSE_TASKBARBUTTON 1 + +// Set to 1 to compile MS Windows XP theme engine support +#define wxUSE_UXTHEME 1 + +// Set to 1 to use InkEdit control (Tablet PC), if available +#define wxUSE_INKEDIT 0 + +// Set to 1 to enable .INI files based wxConfig implementation (wxIniConfig) +// +// Default is 0. +// +// Recommended setting: 0, nobody uses .INI files any more +#define wxUSE_INICONF 0 + +// Set to 0 if you need to include rather than +// +// Default is 1. +// +// Recommended setting: 1, required to be 1 if wxUSE_IPV6 is 1. +#define wxUSE_WINSOCK2 1 + +// ---------------------------------------------------------------------------- +// Generic versions of native controls +// ---------------------------------------------------------------------------- + +// Set this to 1 to be able to use wxDatePickerCtrlGeneric in addition to the +// native wxDatePickerCtrl +// +// Default is 0. +// +// Recommended setting: 0, this is mainly used for testing +#define wxUSE_DATEPICKCTRL_GENERIC 0 + +// Set this to 1 to be able to use wxTimePickerCtrlGeneric in addition to the +// native wxTimePickerCtrl for the platforms that have the latter (MSW). +// +// Default is 0. +// +// Recommended setting: 0, this is mainly used for testing +#define wxUSE_TIMEPICKCTRL_GENERIC 0 + +// ---------------------------------------------------------------------------- +// Crash debugging helpers +// ---------------------------------------------------------------------------- + +// Set this to 1 to use dbghelp.dll for providing stack traces in crash +// reports. +// +// Default is 1 if the compiler supports it, 0 for old MinGW. +// +// Recommended setting: 1, there is not much gain in disabling this +#if defined(__VISUALC__) || defined(__MINGW64_TOOLCHAIN__) + #define wxUSE_DBGHELP 1 +#else + #define wxUSE_DBGHELP 0 +#endif + +// Set this to 1 to be able to use wxCrashReport::Generate() to create mini +// dumps of your program when it crashes (or at any other moment) +// +// Default is 1 if supported by the compiler (VC++ and recent BC++ only). +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_CRASHREPORT 1 +/* --- end MSW options --- */ + +#endif // _WX_SETUP_H_ diff --git a/lib/wxWidgets/lib/vc_x64_lib/mswud/wx/msw/rcdefs.h b/lib/wxWidgets/lib/vc_x64_lib/mswud/wx/msw/rcdefs.h new file mode 100644 index 0000000..e09c613 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/mswud/wx/msw/rcdefs.h @@ -0,0 +1,51 @@ + + + + + + + + + + + +#ifndef _WX_RCDEFS_H +#define _WX_RCDEFS_H + + + + + + + + + + +#define WX_CPU_AMD64 + + + + + + + + + + + + + + + + + + + + + + + + + + +#endif diff --git a/lib/wxWidgets/lib/vc_x64_lib/mswud/wx/setup.h b/lib/wxWidgets/lib/vc_x64_lib/mswud/wx/setup.h new file mode 100644 index 0000000..b1d20d9 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/mswud/wx/setup.h @@ -0,0 +1,1836 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/setup.h +// Purpose: Configuration for the library +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SETUP_H_ +#define _WX_SETUP_H_ + +/* --- start common options --- */ +// ---------------------------------------------------------------------------- +// global settings +// ---------------------------------------------------------------------------- + +// define this to 0 when building wxBase library - this can also be done from +// makefile/project file overriding the value here +#ifndef wxUSE_GUI + #define wxUSE_GUI 1 +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// compatibility settings +// ---------------------------------------------------------------------------- + +// This setting determines the compatibility with 2.8 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_8 0 + +// This setting determines the compatibility with 3.0 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_3_0 1 + +// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when +// default system font is used for wxWindow::GetCharWidth/Height() instead of +// the current font. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxDIALOG_UNIT_COMPATIBILITY 0 + +// Provide unsafe implicit conversions in wxString to "const char*" or +// "std::string" (depending on wxUSE_STD_STRING_CONV_IN_WXSTRING value). +// +// Default is 1 but only for compatibility reasons, it is recommended to set +// this to 0 because converting wxString to a narrow (non-Unicode) string may +// fail unless a locale using UTF-8 encoding is used, which is never the case +// under MSW, for example, hence such conversions can result in silent data +// loss. +// +// Recommended setting: 0 +#define wxUSE_UNSAFE_WXSTRING_CONV 1 + +// If set to 1, enables "reproducible builds", i.e. build output should be +// exactly the same if the same build is redone again. As using __DATE__ and +// __TIME__ macros clearly makes the build irreproducible, setting this option +// to 1 disables their use in the library code. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_REPRODUCIBLE_BUILD 0 + +// ---------------------------------------------------------------------------- +// debugging settings +// ---------------------------------------------------------------------------- + +// wxDEBUG_LEVEL will be defined as 1 in wx/debug.h so normally there is no +// need to define it here. You may do it for two reasons: either completely +// disable/compile out the asserts in release version (then do it inside #ifdef +// NDEBUG) or, on the contrary, enable more asserts, including the usually +// disabled ones, in the debug build (then do it inside #ifndef NDEBUG) +// +// #ifdef NDEBUG +// #define wxDEBUG_LEVEL 0 +// #else +// #define wxDEBUG_LEVEL 2 +// #endif + +// wxHandleFatalExceptions() may be used to catch the program faults at run +// time and, instead of terminating the program with a usual GPF message box, +// call the user-defined wxApp::OnFatalException() function. If you set +// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. +// +// This setting is for Win32 only and can only be enabled if your compiler +// supports Win32 structured exception handling (currently only VC++ does) +// +// Default is 1 +// +// Recommended setting: 1 if your compiler supports it. +#define wxUSE_ON_FATAL_EXCEPTION 1 + +// Set this to 1 to be able to generate a human-readable (unlike +// machine-readable minidump created by wxCrashReport::Generate()) stack back +// trace when your program crashes using wxStackWalker +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_STACKWALKER 1 + +// Set this to 1 to compile in wxDebugReport class which allows you to create +// and optionally upload to your web site a debug report consisting of back +// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, it is compiled into a separate library so there +// is no overhead if you don't use it +#define wxUSE_DEBUGREPORT 1 + +// Generic comment about debugging settings: they are very useful if you don't +// use any other memory leak detection tools such as Purify/BoundsChecker, but +// are probably redundant otherwise. Also, Visual C++ CRT has the same features +// as wxWidgets memory debugging subsystem built in since version 5.0 and you +// may prefer to use it instead of built in memory debugging code because it is +// faster and more fool proof. +// +// Using VC++ CRT memory debugging is enabled by default in debug build (_DEBUG +// is defined) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) +// and if __NO_VC_CRTDBG__ is not defined. + +// The rest of the options in this section are obsolete and not supported, +// enable them at your own risk. + +// If 1, enables wxDebugContext, for writing error messages to file, etc. If +// __WXDEBUG__ is not defined, will still use the normal memory operators. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_CONTEXT 0 + +// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* +// __WXDEBUG__ is also defined. +// +// WARNING: this code may not work with all architectures, especially if +// alignment is an issue. This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 1 if you are not using a memory debugging tool, else 0 +#define wxUSE_MEMORY_TRACING 0 + +// In debug mode, cause new and delete to be redefined globally. +// If this causes problems (e.g. link errors which is a common problem +// especially if you use another library which also redefines the global new +// and delete), set this to 0. +// This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If +// this causes problems (e.g. link errors), set this to 0. You may need to set +// this to 0 if using templates (at least for VC++). This switch is currently +// ignored for MinGW/Cygwin. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_NEW_ALWAYS 0 + + +// ---------------------------------------------------------------------------- +// Unicode support +// ---------------------------------------------------------------------------- + +// This option is deprecated: the library should be always built in Unicode mode +// now, only set wxUSE_UNICODE to 0 to compile legacy code in ANSI mode if +// absolutely necessary -- updating it is strongly recommended as the ANSI mode +// will disappear completely in future wxWidgets releases. +#ifndef wxUSE_UNICODE + #define wxUSE_UNICODE 1 +#endif + +// ---------------------------------------------------------------------------- +// global features +// ---------------------------------------------------------------------------- + +// Compile library in exception-safe mode? If set to 1, the library will try to +// behave correctly in presence of exceptions (even though it still will not +// use the exceptions itself) and notify the user code about any unhandled +// exceptions. If set to 0, propagation of the exceptions through the library +// code will lead to undefined behaviour -- but the code itself will be +// slightly smaller and faster. +// +// Note that like wxUSE_THREADS this option is automatically set to 0 if +// wxNO_EXCEPTIONS is defined. +// +// Default is 1 +// +// Recommended setting: depends on whether you intend to use C++ exceptions +// in your own code (1 if you do, 0 if you don't) +#define wxUSE_EXCEPTIONS 1 + +// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI +// +// This feature is incomplete and experimental, please only enable it if +// you want to participate in its development. +// +// Recommended setting: 0 (unless you wish to try working on it). +#define wxUSE_EXTENDED_RTTI 0 + +// Support for message/error logging. This includes wxLogXXX() functions and +// wxLog and derived classes. Don't set this to 0 unless you really know what +// you are doing. +// +// Default is 1 +// +// Recommended setting: 1 (always) +#define wxUSE_LOG 1 + +// Recommended setting: 1 +#define wxUSE_LOGWINDOW 1 + +// Recommended setting: 1 +#define wxUSE_LOGGUI 1 + +// Recommended setting: 1 +#define wxUSE_LOG_DIALOG 1 + +// Support for command line parsing using wxCmdLineParser class. +// +// Default is 1 +// +// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) +#define wxUSE_CMDLINE_PARSER 1 + +// Support for multithreaded applications: if 1, compile in thread classes +// (thread.h) and make the library a bit more thread safe. Although thread +// support is quite stable by now, you may still consider recompiling the +// library without it if you have no use for it - this will result in a +// somewhat smaller and faster operation. +// +// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset +// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in +// build/msw/config.* file this value will have no effect. +// +// Default is 1 +// +// Recommended setting: 0 unless you do plan to develop MT applications +#define wxUSE_THREADS 1 + +// If enabled, compiles wxWidgets streams classes +// +// wx stream classes are used for image IO, process IO redirection, network +// protocols implementation and much more and so disabling this results in a +// lot of other functionality being lost. +// +// Default is 1 +// +// Recommended setting: 1 as setting it to 0 disables many other things +#define wxUSE_STREAMS 1 + +// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. +// Note that if the system's implementation does not support positional +// parameters, setting this to 1 forces the use of the wxWidgets implementation +// of wxVsnprintf. The standard vsnprintf() supports positional parameters on +// many Unix systems but usually doesn't under Windows. +// +// Positional parameters are very useful when translating a program since using +// them in formatting strings allow translators to correctly reorder the +// translated sentences. +// +// Default is 1 +// +// Recommended setting: 1 if you want to support multiple languages +#define wxUSE_PRINTF_POS_PARAMS 1 + +// Enable the use of compiler-specific thread local storage keyword, if any. +// This is used for wxTLS_XXX() macros implementation and normally should use +// the compiler-provided support as it's simpler and more efficient, but is +// disabled under Windows in wx/msw/chkconf.h as it can't be used if wxWidgets +// is used in a dynamically loaded Win32 DLL (i.e. using LoadLibrary()) under +// XP as this triggers a bug in compiler TLS support that results in crashes +// when any TLS variables are used. +// +// If you're absolutely sure that your build of wxWidgets is never going to be +// used in such situation, either because it's not going to be linked from any +// kind of plugin or because you only target Vista or later systems, you can +// set this to 2 to force the use of compiler TLS even under MSW. +// +// Default is 1 meaning that compiler TLS is used only if it's 100% safe. +// +// Recommended setting: 2 if you want to have maximal performance and don't +// care about the scenario described above. +#define wxUSE_COMPILER_TLS 1 + +// ---------------------------------------------------------------------------- +// Interoperability with the standard library. +// ---------------------------------------------------------------------------- + +// Set wxUSE_STL to 1 to enable maximal interoperability with the standard +// library, even at the cost of backwards compatibility. +// +// Default is 0 +// +// Recommended setting: 0 as the options below already provide a relatively +// good level of interoperability and changing this option arguably isn't worth +// diverging from the official builds of the library. +#define wxUSE_STL 0 + +// This is not a real option but is used as the default value for +// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS_COMPATIBLY. +// +// Set it to 0 if you want to disable the use of all standard classes +// completely for some reason. +#define wxUSE_STD_DEFAULT 1 + +// Use standard C++ containers where it can be done without breaking backwards +// compatibility. +// +// This provides better interoperability with the standard library, e.g. with +// this option on it's possible to insert std::vector<> into many wxWidgets +// containers directly. +// +// Default is 1. +// +// Recommended setting is 1 unless you want to avoid all dependencies on the +// standard library. +#define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT + +// Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<> +// and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but +// usually more limited) implementations are used which allows to avoid the +// dependency on the C++ run-time library. +// +// Default is 0 for compatibility reasons. +// +// Recommended setting: 1 unless compatibility with the official wxWidgets +// build and/or the existing code is a concern. +#define wxUSE_STD_CONTAINERS 0 + +// Use standard C++ streams if 1 instead of wx streams in some places. If +// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the +// standard streams library. +// +// Notice that enabling this does not replace wx streams with std streams +// everywhere, in a lot of places wx streams are used no matter what. +// +// Default is 1 if compiler supports it. +// +// Recommended setting: 1 if you use the standard streams anyhow and so +// dependency on the standard streams library is not a +// problem +#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT + +// Enable minimal interoperability with the standard C++ string class if 1. +// "Minimal" means that wxString can be constructed from std::string or +// std::wstring but can't be implicitly converted to them. You need to enable +// the option below for the latter. +// +// Default is 1 for most compilers. +// +// Recommended setting: 1 unless you want to ensure your program doesn't use +// the standard C++ library at all. +#define wxUSE_STD_STRING wxUSE_STD_DEFAULT + +// Make wxString as much interchangeable with std::[w]string as possible, in +// particular allow implicit conversion of wxString to either of these classes. +// This comes at a price (or a benefit, depending on your point of view) of not +// allowing implicit conversion to "const char *" and "const wchar_t *". +// +// Because a lot of existing code relies on these conversions, this option is +// disabled by default but can be enabled for your build if you don't care +// about compatibility. +// +// Default is 0 if wxUSE_STL has its default value or 1 if it is enabled. +// +// Recommended setting: 0 to remain compatible with the official builds of +// wxWidgets. +#define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL + +// ---------------------------------------------------------------------------- +// non GUI features selection +// ---------------------------------------------------------------------------- + +// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit +// integer which is implemented in terms of native 64 bit integers if any or +// uses emulation otherwise. +// +// This class is required by wxDateTime and so you should enable it if you want +// to use wxDateTime. For most modern platforms, it will use the native 64 bit +// integers in which case (almost) all of its functions are inline and it +// almost does not take any space, so there should be no reason to switch it +// off. +// +// Recommended setting: 1 +#define wxUSE_LONGLONG 1 + +// Set wxUSE_BASE64 to 1, to compile in Base64 support. This is required for +// storing binary data in wxConfig on most platforms. +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_BASE64 1 + +// Set this to 1 to be able to use wxEventLoop even in console applications +// (i.e. using base library only, without GUI). This is mostly useful for +// processing socket events but is also necessary to use timers in console +// applications +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_CONSOLE_EVENTLOOP 1 + +// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level +// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. +// +// Default is 1 +// +// Recommended setting: 1 (wxFile is highly recommended as it is required by +// i18n code, wxFileConfig and others) +#define wxUSE_FILE 1 +#define wxUSE_FFILE 1 + +// Use wxFSVolume class providing access to the configured/active mount points +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely disabled if you don't use it) +#define wxUSE_FSVOLUME 1 + +// Use wxSecretStore class for storing passwords using OS-specific facilities. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely disabled if you don't use it) +#define wxUSE_SECRETSTORE 1 + +// Allow the use of the OS built-in spell checker in wxTextCtrl. +// +// Default is 1, the corresponding wxTextCtrl functions simply won't do +// anything if the functionality is not supported by the current platform. +// +// Recommended setting: 1 unless you want to save a tiny bit of code. +#define wxUSE_SPELLCHECK 1 + +// Use wxStandardPaths class which allows to retrieve some standard locations +// in the file system +// +// Default is 1 +// +// Recommended setting: 1 (may be disabled to save space, but not much) +#define wxUSE_STDPATHS 1 + +// use wxTextBuffer class: required by wxTextFile +#define wxUSE_TEXTBUFFER 1 + +// use wxTextFile class: requires wxFile and wxTextBuffer, required by +// wxFileConfig +#define wxUSE_TEXTFILE 1 + +// i18n support: _() macro, wxLocale class. +#define wxUSE_INTL 1 + +// Provide wxFoo_l() functions similar to standard foo() functions but taking +// an extra locale parameter. +// +// Notice that this is fully implemented only for the systems providing POSIX +// xlocale support or Microsoft Visual C++ >= 8 (which provides proprietary +// almost-equivalent of xlocale functions), otherwise wxFoo_l() functions will +// only work for the current user locale and "C" locale. You can use +// wxHAS_XLOCALE_SUPPORT to test whether the full support is available. +// +// Default is 1 +// +// Recommended setting: 1 but may be disabled if you are writing programs +// running only in C locale anyhow +#define wxUSE_XLOCALE 1 + +// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which +// allow to manipulate dates, times and time intervals. +// +// Requires: wxUSE_LONGLONG +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_DATETIME 1 + +// Set wxUSE_TIMER to 1 to compile wxTimer class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_TIMER 1 + +// Use wxStopWatch class. +// +// Default is 1 +// +// Recommended setting: 1 (needed by wxSocket) +#define wxUSE_STOPWATCH 1 + +// Set wxUSE_FSWATCHER to 1 if you want to enable wxFileSystemWatcher +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_FSWATCHER 1 + +// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes +// which allow the application to store its settings in the persistent +// storage. Setting this to 1 will also enable on-demand creation of the +// global config object in wxApp. +// +// See also wxUSE_CONFIG_NATIVE below. +// +// Recommended setting: 1 +#define wxUSE_CONFIG 1 + +// If wxUSE_CONFIG is 1, you may choose to use either the native config +// classes under Windows (using the registry) or the portable text file +// format used by the config classes under Unix. +// +// Default is 1 to use native classes. Note that you may still use +// wxFileConfig even if you set this to 1 - just the config object created by +// default for the applications needs will be a wxRegConfig or wxIniConfig and +// not wxFileConfig. +// +// Recommended setting: 1 +#define wxUSE_CONFIG_NATIVE 1 + +// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows +// to connect/disconnect from the network and be notified whenever the dial-up +// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DIALUP_MANAGER 1 + +// Compile in classes for run-time DLL loading and function calling. +// Required by wxUSE_DIALUP_MANAGER. +// +// This setting is for Win32 only +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DYNLIB_CLASS 1 + +// experimental, don't use for now +#define wxUSE_DYNAMIC_LOADER 1 + +// Set to 1 to use socket classes +#define wxUSE_SOCKETS 1 + +// Set to 1 to use ipv6 socket classes (requires wxUSE_SOCKETS) +// +// Default is 1. +// +// Recommended setting: 1. +#define wxUSE_IPV6 1 + +// Set to 1 to enable virtual file systems (required by wxHTML) +#define wxUSE_FILESYSTEM 1 + +// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ZIP 1 + +// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ARCHIVE 1 + +// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_INET 1 + +// wxArchive classes for accessing archives such as zip and tar +#define wxUSE_ARCHIVE_STREAMS 1 + +// Set to 1 to compile wxZipInput/OutputStream classes. +#define wxUSE_ZIPSTREAM 1 + +// Set to 1 to compile wxTarInput/OutputStream classes. +#define wxUSE_TARSTREAM 1 + +// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by +// wxUSE_LIBPNG +#define wxUSE_ZLIB 1 + +// Set to 1 if liblzma is available to enable wxLZMA{Input,Output}Stream +// classes. +// +// Notice that if you enable this build option when not using configure or +// CMake, you need to ensure that liblzma headers and libraries are available +// (i.e. by building the library yourself or downloading its binaries) and can +// be found, either by copying them to one of the locations searched by the +// compiler/linker by default (e.g. any of the directories in the INCLUDE or +// LIB environment variables, respectively, when using MSVC) or modify the +// make- or project files to add references to these directories. +// +// Default is 0 under MSW, auto-detected by configure. +// +// Recommended setting: 1 if you need LZMA compression. +#define wxUSE_LIBLZMA 0 + +// If enabled, the code written by Apple will be used to write, in a portable +// way, float on the disk. See extended.c for the license which is different +// from wxWidgets one. +// +// Default is 1. +// +// Recommended setting: 1 unless you don't like the license terms (unlikely) +#define wxUSE_APPLE_IEEE 1 + +// Joystick support class +#define wxUSE_JOYSTICK 1 + +// wxFontEnumerator class +#define wxUSE_FONTENUM 1 + +// wxFontMapper class +#define wxUSE_FONTMAP 1 + +// wxMimeTypesManager class +#define wxUSE_MIMETYPE 1 + +// wxWebRequest allows usage of system libraries for HTTP(S) requests. +// +// Note that for wxWebRequest to be built, at least one of its backends must be +// available. Under MSW and macOS this will always be the case unless +// explicitly disabled. +// +// Default is 1 +// +// Recommended setting: 1, setting it to 0 may be useful to avoid dependencies +// on libcurl on Unix systems. +#define wxUSE_WEBREQUEST 1 + +// wxWebRequest backend based on NSURLSession +// +// Default is 1 under macOS. +// +// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, +// otherwise wxWebRequest won't be available at all under Mac. +#ifdef __APPLE__ +#define wxUSE_WEBREQUEST_URLSESSION wxUSE_WEBREQUEST +#else +#define wxUSE_WEBREQUEST_URLSESSION 0 +#endif + +// wxWebRequest backend based on libcurl, can be used under all platforms. +// +// Default is 0 for MSW and macOS, detected automatically when using configure. +// +// Recommended setting: 0 on Windows and macOS, otherwise 1 as it is required +// for wxWebRequest to be available at all. +#define wxUSE_WEBREQUEST_CURL 0 + +// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP +// or wxURL you need to set this to 1. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_PROTOCOL 1 + +// The settings for the individual URL schemes +#define wxUSE_PROTOCOL_FILE 1 +#define wxUSE_PROTOCOL_FTP 1 +#define wxUSE_PROTOCOL_HTTP 1 + +// Define this to use wxURL class. +#define wxUSE_URL 1 + +// Define this to use native platform url and protocol support. +// Currently valid only for MS-Windows. +// Note: if you set this to 1, you can open ftp/http/gopher sites +// and obtain a valid input stream for these sites +// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. +// Doing so reduces the code size. +// +// This code is experimental and subject to change. +#define wxUSE_URL_NATIVE 0 + +// Support for wxVariant class used in several places throughout the library, +// notably in wxDataViewCtrl API. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size as much as +// possible in which case setting this to 0 can gain up to 100KB. +#define wxUSE_VARIANT 1 + +// Support for wxAny class, the successor for wxVariant. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size by a small amount, +// or your compiler cannot for some reason cope with complexity of templates used. +#define wxUSE_ANY 1 + +// Support for regular expression matching via wxRegEx class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_REGEX 1 + +// wxSystemOptions class +#define wxUSE_SYSTEM_OPTIONS 1 + +// wxSound class +#define wxUSE_SOUND 1 + +// Use wxMediaCtrl +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_MEDIACTRL 1 + +// Use wxWidget's XRC XML-based resource system. Recommended. +// +// Default is 1 +// +// Recommended setting: 1 (requires wxUSE_XML) +#define wxUSE_XRC 1 + +// XML parsing classes. +// +// Default is 1 +// +// Recommended setting: 1 (required by XRC) +#define wxUSE_XML 1 + +// Use wxWidget's AUI docking system +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_AUI 1 + +// Use wxWidget's Ribbon classes for interfaces +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_RIBBON 1 + +// Use wxPropertyGrid. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_PROPGRID 1 + +// Use wxStyledTextCtrl, a wxWidgets Scintilla wrapper. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STC 1 + +// Use wxWidget's web viewing classes +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_WEBVIEW 1 + +// Use the IE wxWebView backend +// +// Default is 1 on MSW +// +// Recommended setting: 1 +#ifdef __WXMSW__ +#define wxUSE_WEBVIEW_IE 1 +#else +#define wxUSE_WEBVIEW_IE 0 +#endif + +// Use the Edge (Chromium) wxWebView backend (Requires WebView2 SDK) +// +// Default is 0 because WebView2 is not always available, set it to 1 if you do have it. +// +// Recommended setting: 1 when building for Windows with WebView2 SDK +#define wxUSE_WEBVIEW_EDGE 0 + +// Use the Edge (Chromium) wxWebView backend without loader DLL +// +// Default is 0, set it to 1 if you don't want to depend on WebView2Loader.dll. +// +// Recommended setting: 0 +#define wxUSE_WEBVIEW_EDGE_STATIC 0 + +// Use the WebKit wxWebView backend +// +// Default is 1 on GTK and OSX +// +// Recommended setting: 1 +#if (defined(__WXGTK__) && !defined(__WXGTK3__)) || defined(__WXOSX__) +#define wxUSE_WEBVIEW_WEBKIT 1 +#else +#define wxUSE_WEBVIEW_WEBKIT 0 +#endif + +// Use the WebKit2 wxWebView backend +// +// Default is 1 on GTK3 +// +// Recommended setting: 1 +#if defined(__WXGTK3__) +#define wxUSE_WEBVIEW_WEBKIT2 1 +#else +#define wxUSE_WEBVIEW_WEBKIT2 0 +#endif + +// Enable wxGraphicsContext and related classes for a modern 2D drawing API. +// +// Default is 1 except if you're using a compiler without support for GDI+ +// under MSW, i.e. gdiplus.h and related headers (MSVC and MinGW >= 4.8 are +// known to have them). For other compilers (e.g. older mingw32) you may need +// to install the headers (and just the headers) yourself. If you do, change +// the setting below manually. +// +// Recommended setting: 1 if supported by the compilation environment + +// Notice that we can't use wxCHECK_VISUALC_VERSION() nor wxCHECK_GCC_VERSION() +// here as this file is included from wx/platform.h before they're defined. +#if defined(_MSC_VER) || \ + (defined(__MINGW32__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 8)) +#define wxUSE_GRAPHICS_CONTEXT 1 +#else +// Disable support for other Windows compilers, enable it if your compiler +// comes with new enough SDK or you installed the headers manually. +// +// Notice that this will be set by configure under non-Windows platforms +// anyhow so the value there is not important. +#define wxUSE_GRAPHICS_CONTEXT 0 +#endif + +// Enable wxGraphicsContext implementation using Cairo library. +// +// This is not needed under Windows and detected automatically by configure +// under other systems, however you may set this to 1 manually if you installed +// Cairo under Windows yourself and prefer to use it instead the native GDI+ +// implementation. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_CAIRO 0 + + +// ---------------------------------------------------------------------------- +// Individual GUI controls +// ---------------------------------------------------------------------------- + +// You must set wxUSE_CONTROLS to 1 if you are using any controls at all +// (without it, wxControl class is not compiled) +// +// Default is 1 +// +// Recommended setting: 1 (don't change except for very special programs) +#define wxUSE_CONTROLS 1 + +// Support markup in control labels, i.e. provide wxControl::SetLabelMarkup(). +// Currently markup is supported only by a few controls and only some ports but +// their number will increase with time. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you want to save on code size) +#define wxUSE_MARKUP 1 + +// wxPopupWindow class is a top level transient window. It is currently used +// to implement wxTipWindow +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) +#define wxUSE_POPUPWIN 1 + +// wxTipWindow allows to implement the custom tooltips, it is used by the +// context help classes. Requires wxUSE_POPUPWIN. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0) +#define wxUSE_TIPWINDOW 1 + +// Each of the settings below corresponds to one wxWidgets control. They are +// all switched on by default but may be disabled if you are sure that your +// program (including any standard dialogs it can show!) doesn't need them and +// if you desperately want to save some space. If you use any of these you must +// set wxUSE_CONTROLS as well. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_ACTIVITYINDICATOR 1 // wxActivityIndicator +#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl +#define wxUSE_BANNERWINDOW 1 // wxBannerWindow +#define wxUSE_BUTTON 1 // wxButton +#define wxUSE_BMPBUTTON 1 // wxBitmapButton +#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl +#define wxUSE_CHECKBOX 1 // wxCheckBox +#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) +#define wxUSE_CHOICE 1 // wxChoice +#define wxUSE_COLLPANE 1 // wxCollapsiblePane +#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl +#define wxUSE_COMBOBOX 1 // wxComboBox +#define wxUSE_COMMANDLINKBUTTON 1 // wxCommandLinkButton +#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl +#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl +#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl +#define wxUSE_EDITABLELISTBOX 1 // wxEditableListBox +#define wxUSE_FILECTRL 1 // wxFileCtrl +#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl +#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl +#define wxUSE_GAUGE 1 // wxGauge +#define wxUSE_HEADERCTRL 1 // wxHeaderCtrl +#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl +#define wxUSE_LISTBOX 1 // wxListBox +#define wxUSE_LISTCTRL 1 // wxListCtrl +#define wxUSE_RADIOBOX 1 // wxRadioBox +#define wxUSE_RADIOBTN 1 // wxRadioButton +#define wxUSE_RICHMSGDLG 1 // wxRichMessageDialog +#define wxUSE_SCROLLBAR 1 // wxScrollBar +#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl +#define wxUSE_SLIDER 1 // wxSlider +#define wxUSE_SPINBTN 1 // wxSpinButton +#define wxUSE_SPINCTRL 1 // wxSpinCtrl +#define wxUSE_STATBOX 1 // wxStaticBox +#define wxUSE_STATLINE 1 // wxStaticLine +#define wxUSE_STATTEXT 1 // wxStaticText +#define wxUSE_STATBMP 1 // wxStaticBitmap +#define wxUSE_TEXTCTRL 1 // wxTextCtrl +#define wxUSE_TIMEPICKCTRL 1 // wxTimePickerCtrl +#define wxUSE_TOGGLEBTN 1 // requires wxButton +#define wxUSE_TREECTRL 1 // wxTreeCtrl +#define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl + +// Use generic version of wxDataViewCtrl even if a native one is available? +// +// Default is 1. +// +// Recommended setting: 1, but can be set to 0 if your program is affected by +// the native control limitations. +#define wxUSE_NATIVE_DATAVIEWCTRL 1 + +// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR +// below either wxStatusBar95 or a generic wxStatusBar will be used. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STATUSBAR 1 + +// Two status bar implementations are available under Win32: the generic one +// or the wrapper around native control. For native look and feel the native +// version should be used. +// +// Default is 1 for the platforms where native status bar is supported. +// +// Recommended setting: 1 (there is no advantage in using the generic one) +#define wxUSE_NATIVE_STATUSBAR 1 + +// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar +// classes at all. Otherwise, use the native toolbar class unless +// wxUSE_TOOLBAR_NATIVE is 0. +// +// Default is 1 for all settings. +// +// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. +#define wxUSE_TOOLBAR 1 +#define wxUSE_TOOLBAR_NATIVE 1 + +// wxNotebook is a control with several "tabs" located on one of its sides. It +// may be used to logically organise the data presented to the user instead of +// putting everything in one huge dialog. It replaces wxTabControl and related +// classes of wxWin 1.6x. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTEBOOK 1 + +// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_LISTBOOK 1 + +// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CHOICEBOOK 1 + +// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TREEBOOK 1 + +// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of +// tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLBOOK 1 + +// wxTaskBarIcon is a small notification icon shown in the system toolbar or +// dock. +// +// Default is 1. +// +// Recommended setting: 1 (but can be set to 0 if you don't need it) +#define wxUSE_TASKBARICON 1 + +// wxGrid class +// +// Default is 1, set to 0 to cut down compilation time and binaries size if you +// don't use it. +// +// Recommended setting: 1 +// +#define wxUSE_GRID 1 + +// wxMiniFrame class: a frame with narrow title bar +// +// Default is 1. +// +// Recommended setting: 1 (it doesn't cost almost anything) +#define wxUSE_MINIFRAME 1 + +// wxComboCtrl and related classes: combobox with custom popup window and +// not necessarily a listbox. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it +// is used by wxComboBox +#define wxUSE_COMBOCTRL 1 + +// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox +// items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0, except where it is +// needed as a base class for generic wxBitmapComboBox. +#define wxUSE_ODCOMBOBOX 1 + +// wxBitmapComboBox is a combobox that can have images in front of text items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 +#define wxUSE_BITMAPCOMBOBOX 1 + +// wxRearrangeCtrl is a wxCheckListBox with two buttons allowing to move items +// up and down in it. It is also used as part of wxRearrangeDialog. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 (currently used only by +// wxHeaderCtrl) +#define wxUSE_REARRANGECTRL 1 + +// wxAddRemoveCtrl is a composite control containing a control showing some +// items (e.g. wxListBox, wxListCtrl, wxTreeCtrl, wxDataViewCtrl, ...) and "+"/ +// "-" buttons allowing to add and remove items to/from the control. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 if you don't need it (not +// used by the library itself). +#define wxUSE_ADDREMOVECTRL 1 + +// ---------------------------------------------------------------------------- +// Miscellaneous GUI stuff +// ---------------------------------------------------------------------------- + +// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) +#define wxUSE_ACCEL 1 + +// Use the standard art provider. The icons returned by this provider are +// embedded into the library as XPMs so disabling it reduces the library size +// somewhat but this should only be done if you use your own custom art +// provider returning the icons or never use any icons not provided by the +// native art provider (which might not be implemented at all for some +// platforms) or by the Tango icons provider (if it's not itself disabled +// below). +// +// Default is 1. +// +// Recommended setting: 1 unless you use your own custom art provider. +#define wxUSE_ARTPROVIDER_STD 1 + +// Use art provider providing Tango icons: this art provider has higher quality +// icons than the default one. It uses SVG format which allows much better scaling +// then when bitmaps are used, at the expense of somewhat larger library size. +// +// Default is 1 under non-GTK ports. Under wxGTK the native art provider using +// the GTK+ stock icons replaces it so it is normally not necessary. +// +// Recommended setting: 1 but can be turned off to reduce the library size. +#define wxUSE_ARTPROVIDER_TANGO 1 + +// Hotkey support (currently Windows and macOS only) +#define wxUSE_HOTKEY 1 + +// Use wxCaret: a class implementing a "cursor" in a text control (called caret +// under Windows). +// +// Default is 1. +// +// Recommended setting: 1 (can be safely set to 0, not used by the library) +#define wxUSE_CARET 1 + +// Use wxDisplay class: it allows enumerating all displays on a system and +// their geometries as well as finding the display on which the given point or +// window lies. +// +// Default is 1. +// +// Recommended setting: 1 if you need it, can be safely set to 0 otherwise +#define wxUSE_DISPLAY 1 + +// Miscellaneous geometry code: needed for Canvas library +#define wxUSE_GEOMETRY 1 + +// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and +// wxListCtrl. +// +// Default is 1. +// +// Recommended setting: 1 (set it to 0 if you don't use any of the controls +// enumerated above, then this class is mostly useless too) +#define wxUSE_IMAGLIST 1 + +// Use wxInfoBar class. +// +// Default is 1. +// +// Recommended setting: 1 (but can be disabled without problems as nothing +// depends on it) +#define wxUSE_INFOBAR 1 + +// Use wxMenu, wxMenuItem. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUS 1 + +// Use wxMenuBar. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUBAR 1 + +// Use wxNotificationMessage. +// +// wxNotificationMessage allows to show non-intrusive messages to the user +// using balloons, banners, popups or whatever is the appropriate method for +// the current platform. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTIFICATION_MESSAGE 1 + +// wxPreferencesEditor provides a common API for different ways of presenting +// the standard "Preferences" or "Properties" dialog under different platforms +// (e.g. some use modal dialogs, some use modeless ones; some apply the changes +// immediately while others require an explicit "Apply" button). +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_PREFERENCES_EDITOR 1 + +// wxFont::AddPrivateFont() allows to use fonts not installed on the system by +// loading them from font files during run-time. +// +// Default is 1 except under Unix where it will be turned off by configure if +// the required libraries are not available or not new enough. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it and +// want to avoid extra dependencies under Linux, for example). +#define wxUSE_PRIVATE_FONTS 1 + +// wxRichToolTip is a customizable tooltip class which has more functionality +// than the stock (but native, unlike this class) wxToolTip. +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely set to 0 if you don't need it) +#define wxUSE_RICHTOOLTIP 1 + +// Use wxSashWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SASH 1 + +// Use wxSplitterWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SPLITTER 1 + +// Use wxToolTip and wxWindow::Set/GetToolTip() methods. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLTIPS 1 + +// wxValidator class and related methods +#define wxUSE_VALIDATORS 1 + +// Use reference counted ID management: this means that wxWidgets will track +// the automatically allocated ids (those used when you use wxID_ANY when +// creating a window, menu or toolbar item &c) instead of just supposing that +// the program never runs out of them. This is mostly useful only under wxMSW +// where the total ids range is limited to SHRT_MIN..SHRT_MAX and where +// long-running programs can run into problems with ids reuse without this. On +// the other platforms, where the ids have the full int range, this shouldn't +// be necessary. +#ifdef __WXMSW__ +#define wxUSE_AUTOID_MANAGEMENT 1 +#else +#define wxUSE_AUTOID_MANAGEMENT 0 +#endif + +// ---------------------------------------------------------------------------- +// common dialogs +// ---------------------------------------------------------------------------- + +// Use common dialogs (e.g. file selector, printer dialog). Switching this off +// also switches off the printing architecture and interactive wxPrinterDC. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COMMON_DIALOGS 1 + +// wxBusyInfo displays window with message when app is busy. Works in same way +// as wxBusyCursor +#define wxUSE_BUSYINFO 1 + +// Use single/multiple choice dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_CHOICEDLG 1 + +// Use colour picker dialog +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COLOURDLG 1 + +// wxDirDlg class for getting a directory name from user +#define wxUSE_DIRDLG 1 + +// Use file open/save dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in many places in the library itself) +#define wxUSE_FILEDLG 1 + +// Use find/replace dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely set to 0) +#define wxUSE_FINDREPLDLG 1 + +// Use font picker dialog +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_FONTDLG 1 + +// Use wxMessageDialog and wxMessageBox. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_MSGDLG 1 + +// progress dialog class for lengthy operations +#define wxUSE_PROGRESSDLG 1 + +// Set to 0 to disable the use of the native progress dialog (currently only +// available under MSW and suffering from some bugs there, hence this option). +#define wxUSE_NATIVE_PROGRESSDLG 1 + +// support for startup tips (wxShowTip &c) +#define wxUSE_STARTUP_TIPS 1 + +// text entry dialog and wxGetTextFromUser function +#define wxUSE_TEXTDLG 1 + +// number entry dialog +#define wxUSE_NUMBERDLG 1 + +// credential entry dialog +#define wxUSE_CREDENTIALDLG 1 + +// splash screen class +#define wxUSE_SPLASH 1 + +// wizards +#define wxUSE_WIZARDDLG 1 + +// Compile in wxAboutBox() function showing the standard "About" dialog. +// +// Default is 1 +// +// Recommended setting: 1 but can be set to 0 to save some space if you don't +// use this function +#define wxUSE_ABOUTDLG 1 + +// wxFileHistory class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_FILE_HISTORY 1 + +// ---------------------------------------------------------------------------- +// Metafiles support +// ---------------------------------------------------------------------------- + +// Windows supports the graphics format known as metafile which, though not +// portable, is widely used under Windows and so is supported by wxWidgets +// (under Windows only, of course). Both the so-called "Window MetaFiles" or +// WMFs, and "Enhanced MetaFiles" or EMFs are supported in wxWin and, by +// default, EMFs will be used. This may be changed by setting +// wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting wxUSE_ENH_METAFILE to 0. +// You may also set wxUSE_METAFILE to 0 to not compile in any metafile +// related classes at all. +// +// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. +// +// Recommended setting: default or 0 for everything for portable programs. +#define wxUSE_METAFILE 1 +#define wxUSE_ENH_METAFILE 1 +#define wxUSE_WIN_METAFILES_ALWAYS 0 + +// ---------------------------------------------------------------------------- +// Big GUI components +// ---------------------------------------------------------------------------- + +// Set to 0 to disable MDI support. +// +// Requires wxUSE_NOTEBOOK under platforms other than MSW. +// +// Default is 1. +// +// Recommended setting: 1, can be safely set to 0. +#define wxUSE_MDI 1 + +// Set to 0 to disable document/view architecture +#define wxUSE_DOC_VIEW_ARCHITECTURE 1 + +// Set to 0 to disable MDI document/view architecture +// +// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE +#define wxUSE_MDI_ARCHITECTURE 1 + +// Set to 0 to disable print/preview architecture code +#define wxUSE_PRINTING_ARCHITECTURE 1 + +// wxHTML allows displaying simple HTML. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_HTML 1 + +// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL +// headers and libraries to be able to compile the library with wxUSE_GLCANVAS +// set to 1 and, under Windows, also to add opengl32.lib and glu32.lib to the +// list of libraries used to link your application when linking to wxWidgets +// statically (although this is done implicitly for Microsoft Visual C++ users). +// +// Default is 1. +// +// Recommended setting: 1 if you intend to use OpenGL, can be safely set to 0 +// otherwise. +#define wxUSE_GLCANVAS 1 + +// Setting wxUSE_GLCANVAS_EGL to 1 enables OpenGL EGL backend. This will be +// automatically enabled if EGL support is detected. EGL support is only +// available under Unix platforms. +// +// Default is 0. +// +#define wxUSE_GLCANVAS_EGL 0 + +// wxRichTextCtrl allows editing of styled text. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 if you want compile a +// smaller library. +#define wxUSE_RICHTEXT 1 + +// ---------------------------------------------------------------------------- +// Data transfer +// ---------------------------------------------------------------------------- + +// Use wxClipboard class for clipboard copy/paste. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CLIPBOARD 1 + +// Use wxDataObject and related classes. Needed for clipboard and OLE drag and +// drop +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DATAOBJ 1 + +// Use wxDropTarget and wxDropSource classes for drag and drop (this is +// different from "built in" drag and drop in wxTreeCtrl which is always +// available). Requires wxUSE_DATAOBJ. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DRAG_AND_DROP 1 + +// Use wxAccessible for enhanced and customisable accessibility. +// Depends on wxUSE_OLE on MSW. +// +// Default is 1 on MSW, 0 elsewhere. +// +// Recommended setting (at present): 1 (MSW-only) +#ifdef __WXMSW__ +#define wxUSE_ACCESSIBILITY 1 +#else +#define wxUSE_ACCESSIBILITY 0 +#endif + +// ---------------------------------------------------------------------------- +// miscellaneous settings +// ---------------------------------------------------------------------------- + +// wxSingleInstanceChecker class allows to verify at startup if another program +// instance is running. +// +// Default is 1 +// +// Recommended setting: 1 (the class is tiny, disabling it won't save much +// space) +#define wxUSE_SNGLINST_CHECKER 1 + +#define wxUSE_DRAGIMAGE 1 + +#define wxUSE_IPC 1 + // 0 for no interprocess comms +#define wxUSE_HELP 1 + // 0 for no help facility + +// Should we use MS HTML help for wxHelpController? If disabled, neither +// wxCHMHelpController nor wxBestHelpController are available. +// +// Default is 1 under MSW, 0 is always used for the other platforms. +// +// Recommended setting: 1, only set to 0 if you have trouble compiling +// wxCHMHelpController (could be a problem with really ancient compilers) +#define wxUSE_MS_HTML_HELP 1 + + +// Use wxHTML-based help controller? +#define wxUSE_WXHTML_HELP 1 + +#define wxUSE_CONSTRAINTS 1 + // 0 for no window layout constraint system + +#define wxUSE_SPLINES 1 + // 0 for no splines + +#define wxUSE_MOUSEWHEEL 1 + // Include mouse wheel support + +// Compile wxUIActionSimulator class? +#define wxUSE_UIACTIONSIMULATOR 1 + +// ---------------------------------------------------------------------------- +// wxDC classes for various output formats +// ---------------------------------------------------------------------------- + +// Set to 1 for PostScript device context. +#define wxUSE_POSTSCRIPT 0 + +// Set to 1 to use font metric files in GetTextExtent +#define wxUSE_AFM_FOR_POSTSCRIPT 1 + +// Set to 1 to compile in support for wxSVGFileDC, a wxDC subclass which allows +// to create files in SVG (Scalable Vector Graphics) format. +#define wxUSE_SVG 1 + +// Should wxDC provide SetTransformMatrix() and related methods? +// +// Default is 1 but can be set to 0 if this functionality is not used. Notice +// that currently wxMSW, wxGTK3 support this for wxDC and all platforms support +// this for wxGCDC so setting this to 0 doesn't change much if neither of these +// is used (although it will still save a few bytes probably). +// +// Recommended setting: 1. +#define wxUSE_DC_TRANSFORM_MATRIX 1 + +// ---------------------------------------------------------------------------- +// image format support +// ---------------------------------------------------------------------------- + +// wxImage supports many different image formats which can be configured at +// compile-time. BMP is always supported, others are optional and can be safely +// disabled if you don't plan to use images in such format sometimes saving +// substantial amount of code in the final library. +// +// Some formats require an extra library (e.g. libpng) which is always included in +// wxWidgets sources but some build systems (cmake, configure) can be configured to +// to use the system or user-provided version. +// +// Set to 1 for wxImage support (recommended). +#define wxUSE_IMAGE 1 + +// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. +#define wxUSE_LIBPNG 1 + +// Set to 1 for JPEG format support (requires libjpeg) +#define wxUSE_LIBJPEG 1 + +// Set to 1 for TIFF format support (requires libtiff) +#define wxUSE_LIBTIFF 1 + +// Set to 1 for SVG rasterizing support using nanosvg +#define wxUSE_NANOSVG 1 + +// Set to 1 to use external nanosvg library when wxUSE_NANOSVG is enabled +#define wxUSE_NANOSVG_EXTERNAL 0 + +// Set to 1 for TGA format support (loading only) +#define wxUSE_TGA 1 + +// Set to 1 for GIF format support +#define wxUSE_GIF 1 + +// Set to 1 for PNM format support +#define wxUSE_PNM 1 + +// Set to 1 for PCX format support +#define wxUSE_PCX 1 + +// Set to 1 for IFF format support (Amiga format) +#define wxUSE_IFF 0 + +// Set to 1 for XPM format support +#define wxUSE_XPM 1 + +// Set to 1 for MS Icons and Cursors format support +#define wxUSE_ICO_CUR 1 + +// Set to 1 to compile in wxPalette class +#define wxUSE_PALETTE 1 + +// ---------------------------------------------------------------------------- +// wxUniversal-only options +// ---------------------------------------------------------------------------- + +// Set to 1 to enable compilation of all themes, this is the default +#define wxUSE_ALL_THEMES 1 + +// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES +// is unset, if it is set these options are not used; notice that metal theme +// uses Win32 one +#define wxUSE_THEME_GTK 0 +#define wxUSE_THEME_METAL 0 +#define wxUSE_THEME_MONO 0 +#define wxUSE_THEME_WIN32 0 + +/* --- end common options --- */ + +/* --- start MSW options --- */ +// ---------------------------------------------------------------------------- +// Windows-specific backends choices +// ---------------------------------------------------------------------------- + +// The options here are only taken into account if wxUSE_GRAPHICS_CONTEXT is 1. + +// Enable support for GDI+-based implementation of wxGraphicsContext. +// +// Default is 1. +// +// Recommended setting: 1 if you need to support XP, as Direct2D is not +// available there. +#define wxUSE_GRAPHICS_GDIPLUS wxUSE_GRAPHICS_CONTEXT + +// Enable support for Direct2D-based implementation of wxGraphicsContext. +// +// Default is 1 for compilers which support it, i.e. VC10+ currently. If you +// use an earlier MSVC version or another compiler and installed the necessary +// SDK components manually, you need to change this setting. +// +// Recommended setting: 1 for faster and better quality graphics under Windows +// 7 and later systems (if wxUSE_GRAPHICS_GDIPLUS is also enabled, earlier +// systems will fall back on using GDI+). +#if defined(_MSC_VER) && _MSC_VER >= 1600 + #define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT +#else + #define wxUSE_GRAPHICS_DIRECT2D 0 +#endif + +// wxWebRequest backend based on WinHTTP. +// +// This is only taken into account if wxUSE_WEBREQUEST==1. +// +// Default is 1 if supported by the compiler (MSVS or MinGW64). +// +// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, +// otherwise wxWebRequest won't be available at all. +#define wxUSE_WEBREQUEST_WINHTTP 1 + +// ---------------------------------------------------------------------------- +// Windows-only settings +// ---------------------------------------------------------------------------- + +// Set this to 1 for generic OLE support: this is required for drag-and-drop, +// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and +// can't compile/doesn't have the OLE headers. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_OLE 1 + +// Set this to 1 to enable wxAutomationObject class. +// +// Default is 1. +// +// Recommended setting: 1 if you need to control other applications via OLE +// Automation, can be safely set to 0 otherwise +#define wxUSE_OLE_AUTOMATION 1 + +// Set this to 1 to enable wxActiveXContainer class allowing to embed OLE +// controls in wx. +// +// Default is 1. +// +// Recommended setting: 1, required by wxMediaCtrl +#define wxUSE_ACTIVEX 1 + +// Enable WinRT support +// +// Default is 1 for compilers which support it, i.e. VS2012+ currently. If you +// use an earlier MSVC version or another compiler and installed the necessary +// SDK components manually, you need to change this setting. +// +// Recommended setting: 1 +#if defined(_MSC_VER) && _MSC_VER >= 1700 && !defined(_USING_V110_SDK71_) + #define wxUSE_WINRT 1 +#else + #define wxUSE_WINRT 0 +#endif + +// wxDC caching implementation +#define wxUSE_DC_CACHEING 1 + +// Set this to 1 to enable wxDIB class used internally for manipulating +// wxBitmap data. +// +// Default is 1, set it to 0 only if you don't use wxImage either +// +// Recommended setting: 1 (without it conversion to/from wxImage won't work) +#define wxUSE_WXDIB 1 + +// Set to 0 to disable PostScript print/preview architecture code under Windows +// (just use Windows printing). +#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1 + +// Set this to 1 to compile in wxRegKey class. +// +// Default is 1 +// +// Recommended setting: 1, this is used internally by wx in a few places +#define wxUSE_REGKEY 1 + +// Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH +// which allows to put more than ~32Kb of text in it even under Win9x (NT +// doesn't have such limitation). +// +// Default is 1 for compilers which support it +// +// Recommended setting: 1, only set it to 0 if your compiler doesn't have +// or can't compile +#define wxUSE_RICHEDIT 1 + +// Set this to 1 to use extra features of richedit v2 and later controls +// +// Default is 1 for compilers which support it +// +// Recommended setting: 1 +#define wxUSE_RICHEDIT2 1 + +// Set this to 1 to enable support for the owner-drawn menu and listboxes. This +// is required by wxUSE_CHECKLISTBOX. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 for a small library size reduction +#define wxUSE_OWNER_DRAWN 1 + +// Set this to 1 to enable MSW-specific wxTaskBarIcon::ShowBalloon() method. It +// is required by native wxNotificationMessage implementation. +// +// Default is 1 but disabled in wx/msw/chkconf.h if SDK is too old to contain +// the necessary declarations. +// +// Recommended setting: 1, set to 0 for a tiny library size reduction +#define wxUSE_TASKBARICON_BALLOONS 1 + +// Set this to 1 to enable following functionality added in Windows 7: thumbnail +// representations, thumbnail toolbars, notification and status overlays, +// progress indicators and jump lists. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 for a tiny library size reduction +#define wxUSE_TASKBARBUTTON 1 + +// Set to 1 to compile MS Windows XP theme engine support +#define wxUSE_UXTHEME 1 + +// Set to 1 to use InkEdit control (Tablet PC), if available +#define wxUSE_INKEDIT 0 + +// Set to 1 to enable .INI files based wxConfig implementation (wxIniConfig) +// +// Default is 0. +// +// Recommended setting: 0, nobody uses .INI files any more +#define wxUSE_INICONF 0 + +// Set to 0 if you need to include rather than +// +// Default is 1. +// +// Recommended setting: 1, required to be 1 if wxUSE_IPV6 is 1. +#define wxUSE_WINSOCK2 1 + +// ---------------------------------------------------------------------------- +// Generic versions of native controls +// ---------------------------------------------------------------------------- + +// Set this to 1 to be able to use wxDatePickerCtrlGeneric in addition to the +// native wxDatePickerCtrl +// +// Default is 0. +// +// Recommended setting: 0, this is mainly used for testing +#define wxUSE_DATEPICKCTRL_GENERIC 0 + +// Set this to 1 to be able to use wxTimePickerCtrlGeneric in addition to the +// native wxTimePickerCtrl for the platforms that have the latter (MSW). +// +// Default is 0. +// +// Recommended setting: 0, this is mainly used for testing +#define wxUSE_TIMEPICKCTRL_GENERIC 0 + +// ---------------------------------------------------------------------------- +// Crash debugging helpers +// ---------------------------------------------------------------------------- + +// Set this to 1 to use dbghelp.dll for providing stack traces in crash +// reports. +// +// Default is 1 if the compiler supports it, 0 for old MinGW. +// +// Recommended setting: 1, there is not much gain in disabling this +#if defined(__VISUALC__) || defined(__MINGW64_TOOLCHAIN__) + #define wxUSE_DBGHELP 1 +#else + #define wxUSE_DBGHELP 0 +#endif + +// Set this to 1 to be able to use wxCrashReport::Generate() to create mini +// dumps of your program when it crashes (or at any other moment) +// +// Default is 1 if supported by the compiler (VC++ and recent BC++ only). +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_CRASHREPORT 1 +/* --- end MSW options --- */ + +#endif // _WX_SETUP_H_ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxbase32u.lib b/lib/wxWidgets/lib/vc_x64_lib/wxbase32u.lib new file mode 100644 index 0000000..01e0a29 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxbase32u.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxbase32u.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxbase32u.pdb new file mode 100644 index 0000000..5df7d0f --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxbase32u.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxbase32u_net.lib b/lib/wxWidgets/lib/vc_x64_lib/wxbase32u_net.lib new file mode 100644 index 0000000..9c2f35a --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxbase32u_net.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxbase32u_net.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxbase32u_net.pdb new file mode 100644 index 0000000..6db3768 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxbase32u_net.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxbase32u_xml.lib b/lib/wxWidgets/lib/vc_x64_lib/wxbase32u_xml.lib new file mode 100644 index 0000000..78877a1 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxbase32u_xml.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxbase32u_xml.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxbase32u_xml.pdb new file mode 100644 index 0000000..3f80ade --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxbase32u_xml.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxbase32ud.lib b/lib/wxWidgets/lib/vc_x64_lib/wxbase32ud.lib new file mode 100644 index 0000000..4014ef7 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxbase32ud.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxbase32ud.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxbase32ud.pdb new file mode 100644 index 0000000..810d6bf --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxbase32ud.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxbase32ud_net.lib b/lib/wxWidgets/lib/vc_x64_lib/wxbase32ud_net.lib new file mode 100644 index 0000000..9217cd5 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxbase32ud_net.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxbase32ud_net.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxbase32ud_net.pdb new file mode 100644 index 0000000..67cd51b --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxbase32ud_net.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxbase32ud_xml.lib b/lib/wxWidgets/lib/vc_x64_lib/wxbase32ud_xml.lib new file mode 100644 index 0000000..343d8f1 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxbase32ud_xml.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxbase32ud_xml.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxbase32ud_xml.pdb new file mode 100644 index 0000000..e363fef --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxbase32ud_xml.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxexpat.lib b/lib/wxWidgets/lib/vc_x64_lib/wxexpat.lib new file mode 100644 index 0000000..f43a30a --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxexpat.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxexpat.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxexpat.pdb new file mode 100644 index 0000000..769185d --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxexpat.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxexpatd.lib b/lib/wxWidgets/lib/vc_x64_lib/wxexpatd.lib new file mode 100644 index 0000000..77e1ec2 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxexpatd.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxexpatd.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxexpatd.pdb new file mode 100644 index 0000000..e462d77 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxexpatd.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxjpeg.lib b/lib/wxWidgets/lib/vc_x64_lib/wxjpeg.lib new file mode 100644 index 0000000..05fcac3 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxjpeg.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxjpeg.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxjpeg.pdb new file mode 100644 index 0000000..6c746df --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxjpeg.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxjpegd.lib b/lib/wxWidgets/lib/vc_x64_lib/wxjpegd.lib new file mode 100644 index 0000000..b610420 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxjpegd.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxjpegd.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxjpegd.pdb new file mode 100644 index 0000000..0b208ca --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxjpegd.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_adv.lib b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_adv.lib new file mode 100644 index 0000000..305a874 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_adv.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_adv.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_adv.pdb new file mode 100644 index 0000000..59bf178 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_adv.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_aui.lib b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_aui.lib new file mode 100644 index 0000000..03e3741 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_aui.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_aui.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_aui.pdb new file mode 100644 index 0000000..e5202fd --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_aui.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_core.lib b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_core.lib new file mode 100644 index 0000000..370051e --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_core.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_core.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_core.pdb new file mode 100644 index 0000000..e21999f --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_core.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_gl.lib b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_gl.lib new file mode 100644 index 0000000..95efdd0 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_gl.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_gl.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_gl.pdb new file mode 100644 index 0000000..ab5f2a4 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_gl.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_html.lib b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_html.lib new file mode 100644 index 0000000..e5b251a --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_html.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_html.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_html.pdb new file mode 100644 index 0000000..cf2c6b2 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_html.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_media.lib b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_media.lib new file mode 100644 index 0000000..6072ff1 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_media.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_media.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_media.pdb new file mode 100644 index 0000000..bdd400f --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_media.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_propgrid.lib b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_propgrid.lib new file mode 100644 index 0000000..c8bfe92 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_propgrid.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_propgrid.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_propgrid.pdb new file mode 100644 index 0000000..db98a15 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_propgrid.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_qa.lib b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_qa.lib new file mode 100644 index 0000000..2b5667d --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_qa.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_qa.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_qa.pdb new file mode 100644 index 0000000..c23f068 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_qa.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_ribbon.lib b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_ribbon.lib new file mode 100644 index 0000000..8be3281 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_ribbon.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_ribbon.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_ribbon.pdb new file mode 100644 index 0000000..6f0af69 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_ribbon.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_richtext.lib b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_richtext.lib new file mode 100644 index 0000000..1738547 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_richtext.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_richtext.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_richtext.pdb new file mode 100644 index 0000000..b284c1d --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_richtext.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_stc.lib b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_stc.lib new file mode 100644 index 0000000..4aac964 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_stc.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_stc.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_stc.pdb new file mode 100644 index 0000000..cfb3e7c --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_stc.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_webview.lib b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_webview.lib new file mode 100644 index 0000000..15aab3f --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_webview.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_webview.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_webview.pdb new file mode 100644 index 0000000..7dfce06 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_webview.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_xrc.lib b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_xrc.lib new file mode 100644 index 0000000..bc704f2 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_xrc.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_xrc.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_xrc.pdb new file mode 100644 index 0000000..ff3fc63 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32u_xrc.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_adv.lib b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_adv.lib new file mode 100644 index 0000000..65dfcce --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_adv.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_adv.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_adv.pdb new file mode 100644 index 0000000..a2aad54 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_adv.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_aui.lib b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_aui.lib new file mode 100644 index 0000000..1950d9f --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_aui.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_aui.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_aui.pdb new file mode 100644 index 0000000..ef9f838 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_aui.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_core.lib b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_core.lib new file mode 100644 index 0000000..d838b80 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_core.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_core.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_core.pdb new file mode 100644 index 0000000..64fc152 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_core.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_gl.lib b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_gl.lib new file mode 100644 index 0000000..9371c92 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_gl.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_gl.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_gl.pdb new file mode 100644 index 0000000..4b0f25a --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_gl.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_html.lib b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_html.lib new file mode 100644 index 0000000..cde0ea9 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_html.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_html.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_html.pdb new file mode 100644 index 0000000..239992d --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_html.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_media.lib b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_media.lib new file mode 100644 index 0000000..0863f5e --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_media.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_media.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_media.pdb new file mode 100644 index 0000000..e1f27e6 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_media.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_propgrid.lib b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_propgrid.lib new file mode 100644 index 0000000..e7927a1 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_propgrid.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_propgrid.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_propgrid.pdb new file mode 100644 index 0000000..ee8e0e8 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_propgrid.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_qa.lib b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_qa.lib new file mode 100644 index 0000000..7a8ebc3 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_qa.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_qa.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_qa.pdb new file mode 100644 index 0000000..2698eee --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_qa.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_ribbon.lib b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_ribbon.lib new file mode 100644 index 0000000..1f61ce7 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_ribbon.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_ribbon.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_ribbon.pdb new file mode 100644 index 0000000..fcba8e1 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_ribbon.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_richtext.lib b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_richtext.lib new file mode 100644 index 0000000..678eaee --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_richtext.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_richtext.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_richtext.pdb new file mode 100644 index 0000000..0e4591e --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_richtext.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_stc.lib b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_stc.lib new file mode 100644 index 0000000..67b2fe5 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_stc.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_stc.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_stc.pdb new file mode 100644 index 0000000..73d45a4 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_stc.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_webview.lib b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_webview.lib new file mode 100644 index 0000000..75afbd0 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_webview.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_webview.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_webview.pdb new file mode 100644 index 0000000..3809a1b --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_webview.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_xrc.lib b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_xrc.lib new file mode 100644 index 0000000..0e66d78 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_xrc.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_xrc.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_xrc.pdb new file mode 100644 index 0000000..2b95183 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxmsw32ud_xrc.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxpng.lib b/lib/wxWidgets/lib/vc_x64_lib/wxpng.lib new file mode 100644 index 0000000..2c2a93b --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxpng.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxpng.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxpng.pdb new file mode 100644 index 0000000..34c8667 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxpng.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxpngd.lib b/lib/wxWidgets/lib/vc_x64_lib/wxpngd.lib new file mode 100644 index 0000000..43fffa0 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxpngd.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxpngd.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxpngd.pdb new file mode 100644 index 0000000..22e627f --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxpngd.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxregexu.lib b/lib/wxWidgets/lib/vc_x64_lib/wxregexu.lib new file mode 100644 index 0000000..70a3ac0 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxregexu.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxregexu.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxregexu.pdb new file mode 100644 index 0000000..48c7243 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxregexu.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxregexud.lib b/lib/wxWidgets/lib/vc_x64_lib/wxregexud.lib new file mode 100644 index 0000000..c1a7bda --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxregexud.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxregexud.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxregexud.pdb new file mode 100644 index 0000000..6895147 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxregexud.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxscintilla.lib b/lib/wxWidgets/lib/vc_x64_lib/wxscintilla.lib new file mode 100644 index 0000000..08fc2de --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxscintilla.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxscintilla.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxscintilla.pdb new file mode 100644 index 0000000..e291f3d --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxscintilla.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxscintillad.lib b/lib/wxWidgets/lib/vc_x64_lib/wxscintillad.lib new file mode 100644 index 0000000..4abfdc2 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxscintillad.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxscintillad.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxscintillad.pdb new file mode 100644 index 0000000..9a2304a --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxscintillad.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxtiff.lib b/lib/wxWidgets/lib/vc_x64_lib/wxtiff.lib new file mode 100644 index 0000000..97d34fc --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxtiff.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxtiff.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxtiff.pdb new file mode 100644 index 0000000..56a4ec0 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxtiff.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxtiffd.lib b/lib/wxWidgets/lib/vc_x64_lib/wxtiffd.lib new file mode 100644 index 0000000..38c6bae --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxtiffd.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxtiffd.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxtiffd.pdb new file mode 100644 index 0000000..157298a --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxtiffd.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxzlib.lib b/lib/wxWidgets/lib/vc_x64_lib/wxzlib.lib new file mode 100644 index 0000000..5f3354a --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxzlib.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxzlib.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxzlib.pdb new file mode 100644 index 0000000..c689f29 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxzlib.pdb Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxzlibd.lib b/lib/wxWidgets/lib/vc_x64_lib/wxzlibd.lib new file mode 100644 index 0000000..4d5f2c5 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxzlibd.lib Binary files differ diff --git a/lib/wxWidgets/lib/vc_x64_lib/wxzlibd.pdb b/lib/wxWidgets/lib/vc_x64_lib/wxzlibd.pdb new file mode 100644 index 0000000..57ae502 --- /dev/null +++ b/lib/wxWidgets/lib/vc_x64_lib/wxzlibd.pdb Binary files differ diff --git a/resource.h b/resource.h new file mode 100644 index 0000000..3136086 --- /dev/null +++ b/resource.h @@ -0,0 +1,45 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ +#ifndef _RESOURCE_H +#define _RESOURCE_H + + +#define INCLUDE_RESOURCE_EXTERN(name) \ +extern const uint8_t name[];\ +extern const uint32_t name##_size; + + +#define INCLUDE_RESOURCE(name, file) \ +__asm__(\ +".section .rodata\n"\ +".global " #name "\n"\ +".type " #name ", @object\n"\ +".balign 4\n"\ +#name ":\n"\ +".incbin \"" #file "\"\n"\ +#name "_end:\n"\ +".global " #name "_size \n"\ +".type " #name "_size, @object\n"\ +".balign 4\n"\ +#name "_size:\n"\ +".int " #name "_end - " #name "\n"\ +);\ +INCLUDE_RESOURCE_EXTERN(name) + +#define RESOURCE_SIZE(name) ((size_t)name##_size) + +#endif diff --git a/submodules/build_scripts b/submodules/build_scripts new file mode 160000 index 0000000..7fcbf14 --- /dev/null +++ b/submodules/build_scripts @@ -0,0 +1 @@ +Subproject commit 7fcbf148b8ca73042abc17259effc45711f64904 diff --git a/submodules/wxWidgets b/submodules/wxWidgets new file mode 160000 index 0000000..3504084 --- /dev/null +++ b/submodules/wxWidgets @@ -0,0 +1 @@ +Subproject commit 35040847c208682ec3d0cac559c06329446573fc diff --git a/version.cpp b/version.cpp new file mode 100644 index 0000000..429fc50 --- /dev/null +++ b/version.cpp @@ -0,0 +1,21 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +const char * const g_version_tag = "PowerMon Manager"; +const uint16_t g_version_bcd = _BUILD_VERSION_BCD_; diff --git a/version.h b/version.h new file mode 100644 index 0000000..3871e51 --- /dev/null +++ b/version.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2020 - 2024, Thornwave Labs Inc + * Written by Razvan Turiac + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the “Software”), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _VERSION_H +#define _VERSION_H + +#include + +extern const char* const g_version_tag; +extern const uint16_t g_version_bcd; + +#endif +